CLI reference
Grouped summary of every sfpm command, its global flags, and the environment variables it reads.
sfpm <command> --help is the authoritative flag reference. The CLI defines
the flags, defaults, and accepted values, so check --help when this page and
the installed version disagree. The pages below group the commands and explain
the parts that are easy to get wrong.
sfpm is pre-1.0. Commands and flags may change between releases, so run
sfpm <command> --help after you upgrade.
Commands
| Command | What it does | Reference |
|---|---|---|
sfpm project | Shows the package dependency tree. | Project commands |
sfpm project init | Checks the project setup (git, remote, sfdx-project.json, packages). | Project commands |
sfpm project init turbo | Scaffolds a pnpm and Turborepo workspace, or migrates an existing one. | Project commands |
sfpm project sync | Generates sfdx-project.json from the workspace package.json files. | Project commands |
sfpm project version bump | Bumps package versions in the workspace. | Project commands |
sfpm package create | Scaffolds a new package directory. | Project commands |
sfpm add | Adds packages as dependencies with pnpm. | Project commands |
sfpm build | Builds packages in dependency order and runs validation. | Build |
sfpm build status | Shows the state of async validation started by sfpm build --async. | Build |
sfpm deploy | Deploys packages from local project source to an org. | Deploy and install |
sfpm deploy artifact | Fetches published artifacts and deploys their source to an org. | Deploy and install |
sfpm install | Fetches published artifacts and installs them into an org. | Deploy and install |
sfpm publish | Publishes built packages from their dist/ directories to npm. | Deploy and install |
See Scratch org pools for pool commands, and
Bootstrap your org for sfpm bootstrap.
Global flags
These flags come from the shared base command, so the CLI accepts them on every command.
| Flag | Default | Description |
|---|---|---|
--json | off | Prints the result as JSON. Cannot be combined with --plain. On sfpm project sync, sfpm project init turbo, and sfpm package create, the command's own JSON result and the shared base command's JSON envelope can both print, so expect two JSON values on those three commands rather than one. |
--plain | off | Non-interactive output with no spinners or cursor movement. Useful in CI logs. |
--log-level <level> | error | Diagnostic log level: trace, debug, info, warn, or error. Diagnostic output goes to stderr. Env: SFPM_LOG_LEVEL. |
The JSON envelope has these fields: command, status (success or error),
duration (milliseconds), and either result on success or error.message on
failure. Use --json when a script or CI step needs to read the outcome.
Output switches to plain mode automatically when CI=true, when TERM=dumb,
when stdout is not a TTY, or when --log-level is set below error.
Environment variables
| Variable | Used by | Effect |
|---|---|---|
SFPM_PROJECT_DIR | Commands that resolve the project root | Uses this directory as the project root instead of searching from the current directory. |
SFPM_LOG_LEVEL | All commands | Default for --log-level. |
SFPM_FORCE_BUILD | sfpm build | Same as --force. |
SFPM_SOURCE_ONLY | sfpm build | Same as --source-only. |
SF_DEV_HUB | sfpm build | Default for --target-dev-hub. |
SF_TARGET_ORG | sfpm deploy, sfpm deploy artifact, sfpm install | Default for --target-org. |
When no project root is given, most commands use the current directory
directly. sfpm.config.ts (or .js/.mjs) is the exception: it's searched
for by walking up from the current directory, all the way to the filesystem
root, before other project markers like pnpm-workspace.yaml or
sfdx-project.json are checked.