Skip to content

Using FlowDelta from an agent

Using FlowDelta from an agent

Use --format md for reports you want to read and --format json for data you want to parse. Leave off --out and --json for stdout-only reports.

Quick reference

TaskCommand
Compare two local versionsflow-delta --old before.flow-meta.xml --new after.flow-meta.xml --format json
Compare two Git refsflow-delta --repo . --from origin/main --to HEAD --path 'force-app/**/*.flow-meta.xml' --changed-only --format md
Compare two org versionsflow-delta --org dev --flow My_Flow --from-version 6 --to-version 7 --format json
Explain a local Flowflow-delta --as-built --file My_Flow.flow-meta.xml --format md

What changed between two Git refs?

Terminal window
flow-delta --repo . --from origin/main --to HEAD --path 'force-app/**/*.flow-meta.xml' --changed-only --format md

Use the base ref for the older version and HEAD for the current commit. Quote the path glob so FlowDelta can match paths in Git. With --changed-only, the report covers changed Flow files.

What changed between the two latest org versions?

With an authenticated org, query the two highest version numbers by Flow developer name. Substitute your org alias and Flow name for dev and My_Flow.

Terminal window
sf data query --target-org dev --use-tooling-api --json \
--query "SELECT VersionNumber FROM Flow WHERE Definition.DeveloperName = 'My_Flow' ORDER BY VersionNumber DESC LIMIT 2"

Pass the lower number as --from-version and the higher number as --to-version. Formatted org comparisons require both arguments. The interactive picker defaults to the latest two versions.

Terminal window
flow-delta --org dev --flow My_Flow --from-version 6 --to-version 7 --format json

Explain a Flow

--as-built --format md prints an execution outline starting at the trigger. Use the form that matches your input.

Terminal window
flow-delta --as-built --file My_Flow.flow-meta.xml --format md
flow-delta --as-built --org dev --flow My_Flow --format md
flow-delta --as-built --repo . --at HEAD --path 'force-app/**/*.flow-meta.xml' --format md

The org form uses the highest active version, or the highest version if none is active. Add --flow-version 7 to select a specific version.

Output contracts

  • --format json prints one document with schema ID flow-delta/compact@1. In an as-built snapshot, walk edges to follow control flow. See CLI output for scripts and agents.
  • --json writes a <stem>.diff.json artifact in the FlowDiff format used by the CI reporters.
  • --format md prints a readable change report or execution outline. Use compact JSON for parsing.

Streams and exit codes

With --format, stdout carries only the report. Progress, summaries, and errors go to stderr. Exit code 0 means success, including a successful comparison with no changes. Exit code 1 means invalid usage or a runtime error. Mixed input-mode flags count as errors. A Git comparison warns on stderr if its pattern matches neither ref. A Git run can report successful Flows on stdout and still exit 1 if another Flow failed.

Org access

FlowDelta reuses your Salesforce CLI login. FLOW_DELTA_SF_CLI=auto is the default and uses sfd when available, with fallback to sf. Set it to sf or sfd to select one explicitly. Set FLOW_DELTA_DEBUG=1 to see fallback reasons on stderr. See CLI org mode.

Avoid in automation

  • Skip --interactive when stdin is a pipe or another non-TTY. It requires a TTY and is incompatible with --format.
  • Use compact stdout for agent tasks. Open the HTML artifact in a browser when you need the visual diff.
  • Keep --out flow-delta-out --json in CI jobs that run a reporter. Reporters read the artifact files from the selected directory. See CI integration.