A local CLI that turns a codebase into a user-flow map: screens, transitions, captured frames, and a lint on the graph. The command is code2flow. Package version 0.4.1, from package.json. Node 20 or later (engines in that file). The canvas is served on http://127.0.0.1:4317 (VIEWER_PORT in src/schema/stage-bridge-protocol.ts).
Three adapters are registered in src/parser/ingest.ts today: Next.js App Router, React Router, and static HTML. Eight lint rules live in src/lint/flow-lint.ts: orphan-screen, dead-end, not-captured, broken-link, low-confidence, needs-sample, login-gated, and capture-failed. Twelve commands are dispatched in src/cli/index.ts.
code2flow serve opens the canvas on 127.0.0.1, port 4317.
What it makes
These are real captures already in this repository, not mocks.
A scan writes .code2flow/graph.json. snapshot captures each screen. export writes a self-contained HTML file. render writes PNG or PDF hand-outs. lint prints the eight rules above and can fail a CI job (--fail-on). stories scaffolds and validates a story manifest against the graph. diff compares two scans.
How it works
code2flow scan picks an adapter from src/parser/ingest.ts, reads routes and transitions from the source, and writes the graph. snapshot and run capture frames when you give them a local URL. lint runs lintFlow. serve hosts the viewer on loopback. Nothing is uploaded.
TanStack Router, Expo Router, SwiftUI, Flutter and Jetpack Compose are not registered adapters in this version. Do not expect those codebases to scan until an adapter for them lands in src/parser/ingest.ts.
Commands
From src/cli/index.ts:
Command
What it does
code2flow scan <repo>
Parse routes, screens and transitions into <repo>/.code2flow/graph.json