Code Canvas converts code control flow and call relationships into interactive flowcharts, helping developers quickly understand functions, components, hooks, event handlers, and cross-file call chains.
The project includes:
@haydenull/code-canvas: Validates.logic.jsonartifacts via CLI and displays nodes, branches, call relationships, module groups, and source code snippets in a Web Viewer.code-canvas-generatorSkill: Reads real source code and generates flowchart artifacts that conform to the spec.
Install dependencies:
bun installOpen the example flowchart in the repo:
bun run viewThe command starts a local server and prints the access URL. Defaults to 127.0.0.1 with a port assigned by the system.
Run the published CLI without installing via npx:
npx @haydenull/code-canvas validate artifacts/example.logic.json
npx @haydenull/code-canvas view artifacts/example.logic.json
npx @haydenull/code-canvas artifact pathIn development, run the source directly to validate artifacts:
bun src/cli.ts validate artifacts/example.logic.jsonThe view command requires static assets to be built first. It supports specifying a host and port:
bun run build
node dist/cli.js view artifacts/example.logic.json --host 0.0.0.0 --port 4173After building, you can also run via the dist output:
bun run build
node dist/cli.js validate artifacts/example.logic.json
node dist/cli.js view artifacts/example.logic.jsonThe built-in code-canvas-generator Skill reads the specified entry point and its required call chain, calls the CLI to get the .logic.json output path in the system temp directory, and writes the generated flowchart artifact to that path.
bun run test # Run tests
bun run check # TypeScript type check
bun run build # Build CLI with type checkSee Publishing Docs for publishing to npm.
src/
├── cli.ts # CLI entry point
├── commands/ # CLI commands
│ ├── artifact/
│ └── view/
├── services/ # Shared Node services
├── shared/ # Code shared by CLI and Viewer
│ ├── flow.ts # Flow conversion and layout
│ └── schema.ts # Artifact schema and validation
└── viewer/ # Viewer UI
docs/ # Docs
skills/
└── code-canvas-generator # Code Canvas artifact generation Skill
artifacts/ # Generated flowchart artifacts and examples