Getting Started
Getting started
FlowDelta is a TypeScript CLI that compares Salesforce Flow metadata and produces a visual diff. This page gets you from a fresh clone to a first run.
Prerequisites
- Node.js 24 or later (
node --version) - npm, which comes with Node
- git
- Real Flow metadata to try it on (optional, but more fun)
- The Salesforce CLI (
sf) and an authenticated org alias, only for org mode and live org smoke checks.sfdis optional; FlowDelta uses it when installed and falls back tosf.
Set up
git clone https://github.com/Syntax-Syllogism/flow-delta.gitcd flow-deltanpm installRun the tests
The test suite is the quickest way to confirm your setup works:
npm run typecheck # typecheck source, tests, and the worker examplenpm test # full suite: parser, semantic diff, render, CLI, GitLabnpm run test:parser # parser regression suite only (fast)npm run test:org # offline org-mode runner and picker coverageTests use Node’s built-in runner and finish in under 10 seconds. The typecheck is a separate gate. Testing explains its three project scopes and the rendered-artifact harness.
Run the CLI locally
During development, tsx runs the CLI directly, so there’s nothing to build:
# File modenpx tsx src/cli.ts --old path/to/before.flow-meta.xml --new path/to/after.flow-meta.xml --out ./output
# Git modenpx tsx src/cli.ts --repo /path/to/sfdx-repo --from main --to feature-branch --path 'force-app/**/*.flow-meta.xml' --out ./output
# Org mode (needs sf authentication; pin versions in scripts)npx tsx src/cli.ts --org my-org --flow My_Flow --from-version 1 --to-version 2 --out ./output --jsonFor the published binaries, see CLI usage.
Render the fixtures
The repo ships fixture flows that cover the main kinds of change. Render the Flow set with:
npm run render:fixtures -- flowThe HTML lands in flow-delta-out/fixtures/. Use npm run render:fixtures -- flexipage for the FlexiPage set, or leave off the selector to render both. Open an artifact in a browser and check that:
- the visual diff renders correctly;
- the filters (All / After / Before / Changes only) work;
- the side panel shows property changes for a modified node;
- pan, zoom, and panel resizing behave.
Project structure
src/ parser/ # Vendored Apache-2.0 parser from google-flow-lens (DO NOT EDIT) io/ # File, git, and Salesforce org I/O model/ # Graph model types and canonicalization (graph-model.ts, build-model.ts) diff/ # Deep diff and model comparison (deep-diff.ts, diff-model.ts) render/ # HTML rendering and layout (render-html.ts, layout.ts, section-schemas.ts) render/browser/ # Client scripts and CSS, bundled into the offline artifacts flexipage/ # FlexiPageDelta parse, canonicalize, diff, and render ci/ # GitLab + GitHub reporters and platform adapters (report-core.ts, gitlab-adapter.ts, github-adapter.ts) cli/ # Per-mode orchestration and option parsing (options.ts, file-mode.ts, artifacts.ts) util/ # Helpers (file-name.ts, version.ts, ...) cli.ts # Entry point; delegates to cli/
test/ semantic-diff.test.ts # Main test suite with fixtures org-flow.test.ts # Offline org-mode runner, picker, and error tests parser.test.ts # Parser regression suite report-core.test.ts # Shared reporting-core tests + package/bin/build checks gitlab-report.test.ts # GitLab reporter tests github-report.test.ts # GitHub reporter tests smoke-common.test.ts # Shared smoke-harness scaffold tests smoke-github.test.ts # GitHub smoke-harness workflow tests
fixtures/ parse/ # Single-flow parser goldens diff/ # before/after fixture pairs for diff testing noop_save/ # Zero-diff save (coordinate churn only) add_node/ # Node addition modify_assignment/ # Assignment modification modify_decision/ # Decision modification rewire_connector/ # Edge rewiring fault_path/ # Fault path changes
docs/ architecture.md # Pipeline and module map cli.md # Command-line usage render.md # HTML artifact and interactive features testing.md # Test layout and fixture authoring ci.md # GitLab integration publishing.md # Build and release vendoring.md # Parser provenance and do-not-edit policyCommon tasks
Add a test case
- Retrieve a flow from your org in its before and after states.
- Save them as
fixtures/diff/<case_name>/before.flow-meta.xmlandafter.flow-meta.xml. - Add a row to the
DIFF_CASEStable intest/semantic-diff.test.tswith the expected node and edge counts. - Run
npm test. - Run
npm run render:fixturesand look at the result.
More in Testing.
Follow the pipeline
The code is a straight line:
XML (before) ┐ ├─► parser ─► GraphModel ─┐XML (after) ┘ (build-model)├─► FlowDiff ─► layout ─► HTML + JSON ┊ (diff-model) (render)Architecture has the module map and the invariants.
Debug a diff that looks wrong
- Check the raw diff. Run
npx tsx src/cli.ts --old before.xml --new after.xml --out out --jsonand readout/*.diff.json. - Check canonicalization. Coordinates, connector references, and array order shouldn’t produce diffs. See the invariants.
- Look at the render. Open the
.htmland check the side panel for each changed node.
Debugging and troubleshooting has more.
Where next
- Architecture, for the pipeline.
- Rendering, for the interactive HTML.
- The fixtures in
fixtures/diff/, for real change patterns. - CONTRIBUTING.md, for code style and PR expectations.
Stuck? Try Debugging and troubleshooting, or open an issue on GitHub.