Skip to Content
CLICommand ReferenceCore & Deployment

Core & Deployment

The standard sfdt deployment cycle:

sfdt preflight # validate the branch is ready sfdt test # run Apex tests sfdt manifest # generate package.xml from git diff sfdt deploy # deploy to the target org sfdt smoke # post-deploy verification sfdt changelog generate # update CHANGELOG.md sfdt notify deploy-success

sfdt deploy automatically runs preflight first unless you pass --skip-preflight.


sfdt init

Initializes the .sfdt/ configuration directory interactively. Run it once from your Salesforce DX project root.

sfdt init

It prompts for a project name, default org alias, coverage threshold, and AI provider, then scans your packageDirectories for Apex test classes to populate test-config.json. See Configuration for what it writes.


sfdt deploy

Deploys metadata to a Salesforce org. Preflight runs automatically first unless skipped. Output streams to your terminal with full TTY passthrough (spinner, colors, interactive prompts).

sfdt deploy sfdt deploy --managed sfdt deploy --skip-preflight sfdt deploy --source-dir force-app/feature-a # deploy a folder directly (no manifest) sfdt deploy --tag --create-pr --notify # tag, open a PR, and notify after a successful deploy
OptionDescription
--managedUse the managed-package deploy path (namespace + version locking)
--skip-preflightSkip the preflight validation step
--dry-runShow what would run without making changes
--source-dir <path>Deploy a source directory directly instead of a manifest
--org <alias>Target org (defaults to config.defaultOrg)
--tagTag the release in git (v<version>) after a successful deploy. Interactive runs pre-select “tag after deployment”; CI runs tag and push automatically.
--create-prOpen a pull request from the current branch to the default branch (defaultBranch, default main) via the gh CLI after a successful deploy
--notifySend the deploy success/failure notification through sfdt notify (the non-interactive path now sends the success event too)

--tag and --create-pr apply to the standard manifest deploy only — combining them with --smart, --managed, or --source-dir prints a warning instead of silently doing nothing. --notify now also works with --smart (see Smart Deploy); with --managed or --source-dir it still prints a warning.

Manifest auto-detection. The interactive picker (and non-interactive auto-select) offers any .xml manifest found in your manifest directory (manifestDir, default manifest/release/) — generated rl-*-package.xml releases are listed first (and still preferred by auto-select), but plain package.xml files, sf project generate manifest output, and sfdt manifest previews (preview-package.xml) all work too. Companion *-destructiveChanges.xml / *no-overwrite*.xml files and the deploy//deployed/ subfolders are excluded.

Use --source-dir for targeted deploys of a single package directory without generating a manifest first — handy during development. For git-delta deploys with smart test selection and overwrite protection, see Smart Deploy (sfdt deploy --smart).


sfdt preflight

Runs pre-deployment validation checks without deploying — the same checks sfdt deploy runs internally. The result is written to logs/preflight-latest.json and shows in the dashboard.

sfdt preflight sfdt preflight --strict
OptionDescription
--strictFail on any warning, not just errors
--dry-runPreview without writing results

What it checks (controlled by deployment.preflight.* in config):

  • Branch-naming conventions
  • Apex-test presence
  • CHANGELOG.md has unreleased content

Set the enforce* flags in config to turn warnings into hard failures.


sfdt rollback

Rolls back a deployment to a target org. By default it backs up the org’s current state first (deployment.backupBeforeRollback, default true).

sfdt rollback sfdt rollback --org staging
OptionDescription
--org <alias>Target org (defaults to config.defaultOrg)
--dry-runPreview the rollback
--jsonStructured output

sfdt smoke

Runs post-deployment smoke tests against a target org to verify the deploy succeeded. Intended to run immediately after a successful sfdt deploy.

sfdt smoke sfdt smoke --org production
OptionDescription
--org <alias>Target org (defaults to config.defaultOrg)
--dry-runPreview

sfdt release

Generates a versioned release manifest, optionally creates AI release notes, and walks you through a git commit → tag → deploy → push workflow. Every git step is optional — bail at any confirm prompt.

sfdt release 1.5.0 sfdt release # version resolved from config or prompted
ArgumentDescription
[version]Semver version string (e.g. 1.5.0). Optional.

What happens:

  1. Produces versioned manifests in manifest/release/ (e.g. rl-1.5.0-package.xml).
  2. If AI is enabled, offers to generate release notes to release-notes/rl-1.5.0-RELEASE-NOTES.md.
  3. Stages manifests, CHANGELOG.md, and release notes.
  4. Prompts to commit (release: Generate manifests for 1.5.0).
  5. Prompts to create an annotated tag (v1.5.0).
  6. Prompts to deploy.
  7. Prompts to push the tag.

See the Production Release workflow for the full sequence.


sfdt ci

Generates ready-to-use CI/CD pipeline templates for GitHub, GitLab, Azure DevOps, or Bitbucket — four workflow types: scheduled org monitoring, PR smart-deploy validation, approval-gated release deploys, and scratch-org CI. One subcommand: init.

sfdt ci init --provider github --type monitor --cron "0 6 * * *" sfdt ci init --provider gitlab --type deploy --org uat --auth jwt sfdt ci init --provider github --type release --branch main --environment production sfdt ci init --provider bitbucket --type deploy --print

Key options: --provider github|gitlab|azure|bitbucket (required), --type monitor|deploy|release|scratch, --auth sfdx-url|jwt, --runner npx|docker|action, plus per-type flags (--cron, --org, --branch, --environment, --delta-base, --definition-file, --node) and output control (--out, --print, --force, --json).

The full flag reference, workflow-type breakdown, approval gating per provider, and required secrets live on the CI/CD Integration page; org authentication for the generated pipelines is covered in CI Authentication.

sfdt monitor schedule --provider <name> is a thin alias for sfdt ci init --type monitor.


sfdt pr

Pull-request helpers. One subcommand: comment — posts a comment to the current PR via the GitHub CLI (gh), rendering the latest audit/monitor snapshot to markdown, or posting inline text / a file.

sfdt pr comment --type monitor # post the latest monitor snapshot sfdt pr comment --type audit sfdt pr comment --body "Deployed to UAT" sfdt pr comment --file notes.md --pr 42
OptionDescription
--type <type>Render the latest snapshot: audit | monitor (default monitor)
--body <text>Post this inline text instead of a snapshot
--file <path>Post the contents of this file (relative to project root)
--pr <id>Target PR number or URL (defaults to the current branch PR)
--jsonStructured output

Snapshot mode reads logs/audit-latest.json / logs/monitor-latest.json — run sfdt audit all / sfdt monitor all first. sfdt deploy --smart --pr-comment decorates the PR with the delta summary and deploy outcome automatically.

Requires the GitHub CLI (gh) installed and authenticated (gh auth login; GITHUB_TOKEN in CI). See Retrofit & PR Comments for the workflow context.

Last updated on