sfpm
CLI reference

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

CommandWhat it doesReference
sfpm projectShows the package dependency tree.Project commands
sfpm project initChecks the project setup (git, remote, sfdx-project.json, packages).Project commands
sfpm project init turboScaffolds a pnpm and Turborepo workspace, or migrates an existing one.Project commands
sfpm project syncGenerates sfdx-project.json from the workspace package.json files.Project commands
sfpm project version bumpBumps package versions in the workspace.Project commands
sfpm package createScaffolds a new package directory.Project commands
sfpm addAdds packages as dependencies with pnpm.Project commands
sfpm buildBuilds packages in dependency order and runs validation.Build
sfpm build statusShows the state of async validation started by sfpm build --async.Build
sfpm deployDeploys packages from local project source to an org.Deploy and install
sfpm deploy artifactFetches published artifacts and deploys their source to an org.Deploy and install
sfpm installFetches published artifacts and installs them into an org.Deploy and install
sfpm publishPublishes 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.

FlagDefaultDescription
--jsonoffPrints 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.
--plainoffNon-interactive output with no spinners or cursor movement. Useful in CI logs.
--log-level <level>errorDiagnostic 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

VariableUsed byEffect
SFPM_PROJECT_DIRCommands that resolve the project rootUses this directory as the project root instead of searching from the current directory.
SFPM_LOG_LEVELAll commandsDefault for --log-level.
SFPM_FORCE_BUILDsfpm buildSame as --force.
SFPM_SOURCE_ONLYsfpm buildSame as --source-only.
SF_DEV_HUBsfpm buildDefault for --target-dev-hub.
SF_TARGET_ORGsfpm deploy, sfpm deploy artifact, sfpm installDefault 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.

Where to next?

On this page