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
| Task | Command |
|---|---|
| Compare two local versions | flow-delta --old before.flow-meta.xml --new after.flow-meta.xml --format json |
| Compare two Git refs | flow-delta --repo . --from origin/main --to HEAD --path 'force-app/**/*.flow-meta.xml' --changed-only --format md |
| Compare two org versions | flow-delta --org dev --flow My_Flow --from-version 6 --to-version 7 --format json |
| Explain a local Flow | flow-delta --as-built --file My_Flow.flow-meta.xml --format md |
What changed between two Git refs?
flow-delta --repo . --from origin/main --to HEAD --path 'force-app/**/*.flow-meta.xml' --changed-only --format mdUse 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.
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.
flow-delta --org dev --flow My_Flow --from-version 6 --to-version 7 --format jsonExplain a Flow
--as-built --format md prints an execution outline starting at the trigger. Use the form that matches your input.
flow-delta --as-built --file My_Flow.flow-meta.xml --format mdflow-delta --as-built --org dev --flow My_Flow --format mdflow-delta --as-built --repo . --at HEAD --path 'force-app/**/*.flow-meta.xml' --format mdThe 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 jsonprints one document with schema IDflow-delta/compact@1. In an as-built snapshot, walkedgesto follow control flow. See CLI output for scripts and agents.--jsonwrites a<stem>.diff.jsonartifact in the FlowDiff format used by the CI reporters.--format mdprints 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
--interactivewhen 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 --jsonin CI jobs that run a reporter. Reporters read the artifact files from the selected directory. See CI integration.