This file provides guidance when working with code in this repository.
This is @salesforce/plugin-org, an oclif plugin for the Salesforce CLI that provides commands for working with Salesforce orgs (scratch orgs, sandboxes, production orgs). It is bundled with the official Salesforce CLI and follows Salesforce's standard plugin architecture.
# Install dependencies and compile
yarn install
yarn build
# Compile TypeScript (incremental)
yarn compile
# Run linter
yarn lint
# Format code
yarn format
# Run local development version of CLI
./bin/dev.js org list
./bin/dev.js org create scratch --help# Run all tests (unit + NUTs + linting + schemas)
yarn test
# Run only unit tests
yarn test:only
# Run unit tests in watch mode
yarn test:watch
# Run NUTs (Non-Unit Tests) - integration tests against real orgs
yarn test:nuts
# Run a specific NUT
yarn mocha path/to/test.nut.ts# Run commands via bin/dev.js, it compiles TS source on the fly (no need to run `yarn compile` after every change)
./bin/dev.js org listCommands follow oclif's file-based routing and are organized under src/commands/org/:
create/- Create scratch orgs and sandboxesdelete/- Delete scratch orgs and sandboxesresume/- Resume async org creation operationsrefresh/- Refresh sandboxeslist/- List orgs and metadataopen/- Open orgs in browserenable/anddisable/- Manage source tracking
Messages are stored in messages/*.md files using Salesforce's message framework. Each command typically has its own message file (e.g., create_scratch.md, create.sandbox.md).
test/unit/- Unit tests using Mocha + Sinontest/nut/- Integration tests (NUTs) using@salesforce/cli-plugins-testkittest/shared/- Tests for shared utilities- Sandbox NUTs (
*.sandboxNut.ts) are extremely slow and should be run selectively via GitHub Actions
@oclif/core- CLI framework@salesforce/core- Core Salesforce functionality (Org, AuthInfo, Connection, etc.)@salesforce/sf-plugins-core- Shared plugin utilities and base command classes@salesforce/source-deploy-retrieve- Metadata operations@oclif/multi-stage-output- Progress indicators for long-running operations
- Sandbox NUTs are slow due to actual org creation/refresh operations
- Use the
SandboxNutsGitHub Action workflow instead of running locally - Unit tests should mock
@salesforce/corecomponents (Org, Connection, etc.) - NUTs use real orgs and require appropriate hub/production org authentication