CLI usage
CLI usage
FlowDelta’s CLI is the flow-delta binary, published in @syntax-syllogism/flow-delta. In a source checkout, the entry point is src/cli.ts.
npx @syntax-syllogism/flow-delta <options>Once the package is installed (npm install or npm install -g), the flow-delta binary is on your PATH or in node_modules/.bin, so npx flow-delta <options> works too. A bare npx flow-delta with nothing installed fails, because there’s no unscoped flow-delta package on npm.
From a source checkout, run the TypeScript entry point through the local runner: node --import tsx src/cli.ts <options> or npx --no-install tsx src/cli.ts <options>.
The CLI has four modes. They’re mutually exclusive, and the flags you pass select one.
Choose one input mode per invocation. FlowDelta rejects flags from other modes before reading inputs or creating the output directory. In Git mode, --changed-only belongs to comparisons, and --at belongs to snapshots.
As-built mode: render one current Flow
As-built mode makes a self-contained snapshot of a single Flow. There’s no before and after, so the artifact uses element-type colors, an element inventory, read-only property panels, and a provenance footer.
# Local filenpx @syntax-syllogism/flow-delta --as-built --file path/to/My_Flow.flow-meta.xml
# Latest Active (or highest) org version, or a named versionnpx @syntax-syllogism/flow-delta --as-built --org my-org --flow My_Flownpx @syntax-syllogism/flow-delta --as-built --org my-org --flow My_Flow --flow-version 3
# One git ref; --path may be a literal path or supported globnpx @syntax-syllogism/flow-delta --as-built --repo /path/to/repo --at v1.2 --path 'force-app/**/*.flow-meta.xml'Give exactly one of the three input forms. The Git pattern is relative to the repository root. A snapshot with no matches fails. --json writes the machine-readable snapshot as <stem>.diff.json, and --out picks the output directory. As-built mode can’t be combined with diff version flags (--old, --new, --from, --to, --from-version, --to-version) or with --interactive, --changed-only, or --keep.
Explain a Flow
Add --format md to an as-built command to print an execution outline on stdout. The outline starts with the trigger and indents decision outcomes, loop bodies, wait events, scheduled paths, and fault paths. A → go to line refers to an element already listed, which also covers cycles. Elements the trigger can’t reach are listed at the end under Unreachable elements:. A Flow with no start element prints (no start element) and then lists its elements flat.
The outline is for reading. --format json still prints the compact snapshot of nodes and edges, so agents that need control flow should walk edges there.
flow-delta --as-built --file My_Flow.flow-meta.xml --format mdflow-delta --as-built --org my-org --flow My_Flow --flow-version 3 --format mdflow-delta --as-built --repo /path/to/repo --at v1.2 --path 'force-app/**/*.flow-meta.xml' --format md## Account Before Save (Record-Triggered Flow, v3, Active)Trigger: Account · Before save · Create/UpdateEntry conditions: 1 filter1. Check Industry — Decision: 1 outcome + default If Technology ($Record.Industry EqualTo "Technology"): 2. Set Rating — Assignment: $Record.Rating = "Hot" Otherwise (Default Outcome): EndGit globs print one outline per matching Flow, separated by blank lines. Use --out or --json to also write snapshot artifacts.
File mode: compare two local files
npx @syntax-syllogism/flow-delta \ --old path/to/before.flow-meta.xml \ --new path/to/after.flow-meta.xml \ --out ./flow-delta-out \ --json--oldand--neware the two.flow-meta.xmlfiles. Both are required.
Git mode: compare two refs
npx @syntax-syllogism/flow-delta \ --repo /path/to/sfdx-repo \ --from <base-ref> --to <head-ref> \ --path 'force-app/**/*.flow-meta.xml' \ --out ./flow-delta-out \ --json--repois the repository to read.--fromand--toare the two git refs: SHAs, branches, or tags.--pathis a repository-root-relative path or glob (*within a segment,**across segments,?), even when--repopoints to a subdirectory. Full-tree discovery unions the paths from both refs.--changed-onlyuses Git’s changed path list with rename detection disabled. Renames appear as removal at the old path and addition at the new path.- If the pattern matches neither tree, the CLI warns on stderr and succeeds with an empty report. A pattern that matches only unchanged files succeeds quietly in changed-only mode.
--repo, --from, --to, and --path are all required. --changed-only is the only optional one.
Both products share the metadata and Git input boundary described in metadata-io.md. It normalizes pattern separators, reads Git paths without unquoting or trimming, and returns distinct paths in a stable order. Flag validation and default patterns stay in each CLI.
Org mode: compare two versions from Salesforce
Org mode reuses the Salesforce CLI’s authentication. The alias or username must start with a letter, digit, or underscore and can also contain internal spaces, periods, hyphens, plus signs, and @. Both Salesforce runners reject unsupported Windows shell characters before invoking a command shim. It retrieves two historical Flow versions as metadata XML and sends them through the same pipeline as file mode:
npx @syntax-syllogism/flow-delta \ --org my-org \ --flow My_Flow \ --from-version 1 --to-version 2 \ --out ./flow-delta-out \ --json--orgis a Salesforce org alias or username already authenticated insf.--flowis the Flow developer name. Leave it out to pick from an interactive list.--from-versionand--to-versionare the two version numbers. Leave either out to use the interactive picker, which defaults to the latest two versions.--interactivealways shows the picker.--keepkeeps the temporary Salesforce project for troubleshooting. Otherwise it’s deleted after the diff.
The picker needs a TTY. In CI or any other non-interactive setting, pass --flow, --from-version, and --to-version.
FlowDelta uses sfd when available for faster org queries and retrieves, including as-built snapshots. Sign in first with sf org login web. Set FLOW_DELTA_SF_CLI to one of these values:
auto(default) triessfdfirst and retries a failed query or retrieve withsf.sfalways uses the Salesforce CLI.sfdalways usessfdand reports its errors directly.
Values are case-sensitive. Invalid values warn once and use auto. Set FLOW_DELTA_DEBUG=1 to see fallback reasons on stderr. Fallback is silent by default. Errors cover a missing CLI, an unauthenticated org, an unknown Flow, an unavailable version, and a legacy Flow without a modern <start> element.
On Windows, FlowDelta uses the sfd.cmd and sf.cmd shims. The shell that launches Node needs the CLI directories on its PATH. If PowerShell finds sf but Git Bash doesn’t, add the Salesforce CLI directory to Git Bash’s PATH, or run the command from PowerShell.
Common flags
| Flag | Default | Meaning |
|---|---|---|
--out <dir> | ./flow-delta-out | Output directory. Created if it’s missing. |
--json | off | Also write <flow>.diff.json next to the HTML. |
Help and version
--help (or -h) prints the usage text. --version prints the binary name and the package version, then exits:
npx flow-delta --version # flow-delta 0.11.0All six binaries in the package support both flags: flow-delta, flexipage-delta, flow-delta-gitlab, flow-delta-github, flexipage-delta-gitlab, and flexipage-delta-github. --version is checked before any other argument is parsed, so it doesn’t read inputs or write output, even when other flags are present. An unknown option exits with code 1 and an error message instead of a stack trace.
Output
For each flow, the output directory gets:
Output stems come from artifactStem in src/util/file-name.ts. FlowDelta uses the new XML file’s name in file mode, the Flow API name (developerName) in org mode, and the metadata file’s name in Git mode. An as-built file uses its own name, and as-built org output uses the Flow API name. The stem drops the .flow-meta.xml suffix. A short, deterministic hash is appended when a name needs sanitizing, ends in a dot, or comes from a nested Git path. Git mode checks for stem collisions and fails the run with Artifact filename collision. FlexiPageDelta uses the same rules, with .flexipage-meta.xml as the suffix.
<stem>.html, the self-contained interactive diff or snapshot. Open it in a browser.<stem>.diff.json, the machine-readableFlowDiff, only with--json. As-built output hasmode: "snapshot"andpresentnodes and edges.
The CLI prints one summary line per flow:
My_Flow: nodes 1 added, 0 deleted, 1 modified; edges 2 added, 0 deletedAs-built mode prints an inventory instead:
My_Flow: 12 elements, 11 connectorsWhen curated flow-root attributes changed, the line gets a suffix:
My_Flow: nodes 0 added, 0 deleted, 0 modified; edges 0 added, 0 deleted; flow attributes: 1 changed (status)After the run, the CLI prints the absolute output directory, for example Artifacts written to C:\path\to\flow-delta-out.
Failures don’t spread. In git mode, if one flow fails to parse, the CLI logs an error and sets a non-zero exit code, but keeps going with the remaining flows.
Output for scripts and agents (--format)
--format md prints a Markdown change report for comparisons and an execution outline for as-built snapshots.
--format json prints a single JSON document using the flow-delta/compact@1 schema, including when Git mode finds multiple flows or no changes.
Both formats work with file, Git, org, and as-built inputs. As-built JSON includes every element and connector in the snapshot.
Use Markdown for reading and the versioned JSON schema for parsing.
flow-delta --old before.flow-meta.xml --new after.flow-meta.xml --format mdflow-delta --org dev --flow My_Flow --from-version 1 --to-version 2 --format jsonStdout contains only the report. Flow summaries, progress, and errors go to stderr. Formatted org diffs require --flow, --from-version, and --to-version.
--format cannot be combined with --interactive.
With --format, pass --out to also write HTML or --json to write HTML and <stem>.diff.json.
--json uses ./flow-delta-out when --out is omitted. The file still uses the existing FlowDiff schema that CI reporters read.
Render fixture artifacts
The fixture renderer accepts flow, flexipage, or all:
npm run render:fixtures -- flow # → flow-delta-out/fixtures/<case>.htmlnpm run render:fixtures -- flexipage # → flexipage-delta-out/fixtures/<case>.htmlnpm run render:fixtures # both product fixture setsall is the default. It writes Flow artifacts to flow-delta-out/fixtures/ and FlexiPage artifacts to flexipage-delta-out/fixtures/. You can put a custom output directory after the selector. In all mode, it gets flow/ and flexipage/ subdirectories. The older bin/render-fixtures.sh OUT_DIR form still works, for Flow only.
bin/render-fixtures.sh renders every selected fixture pair and names each artifact after its fixture directory, so two fixtures with the same internal metadata name never collide. See testing.md.
For GitLab MR reporting and artifact links, see ci.md.
FlexiPageDelta CLI
The same package ships FlexiPageDelta as the flexipage-delta binary. It compares .flexipage-meta.xml files and writes an offline outline artifact, plus a template-aware wireframe when geometry is available. The default output directory is ./flexipage-delta-out:
npx flexipage-delta \ --old path/to/before.flexipage-meta.xml \ --new path/to/after.flexipage-meta.xml \ --out ./flexipage-delta-out \ --jsonGit mode takes the same --repo, --from, --to, --path, --changed-only, --out, and --json flags. Without --path, it defaults to force-app/**/*.flexipage-meta.xml:
npx flexipage-delta \ --repo /path/to/sfdx-repo \ --from <base-ref> --to <head-ref> \ --changed-only \ --jsonThe output is <stem>.html, plus <stem>.diff.json with JSON output on. Stems follow the output naming rules. The summary counts components, regions, region metadata changes, and page attributes. See flexipage.md for the identity and canonicalization rules and how the outline behaves.