Bun/TypeScript knowledge graph generator — codebase AST analysis AND federated story knowledge graph for Remotion series
Bun/TypeScript knowledge graph generator with two modes:
bun install --cwd bun_app/bun_graphify
python -c "import graphify" 2>/dev/null || pip install graphifyy -q
Detect mode from the path argument:
scripts/narration.ts) → Episode mode → read operations/episode.md*-ch*-ep*) → → read operations/pipeline.mdoperations/codebase.mdRead ONLY the operation file you need. Do NOT read all operation files.
| Op | When | Read |
|---|---|---|
pipeline | Series dir with *-ch*-ep* episodes | operations/pipeline.md |
episode | Single episode dir with narration.ts | operations/episode.md |
merge | Explicit merge request | operations/merge.md |
html | Explicit HTML gen request | operations/html.md |
check | Explicit consistency check request | operations/check.md |
codebase | Non-Remotion source path | operations/codebase.md |
After any operation, read post-run.md for knowledge capture and self-reflection protocol.
| Script | Purpose |
|---|---|
src/cli.ts | Codebase mode: detect → extract → build → cluster → export |
src/scripts/graphify-episode.ts | Per-episode regex extraction from narration.ts |
src/scripts/graphify-merge.ts | Concatenate sub-graphs + add link edges |
src/scripts/graphify-check.ts | Consistency checking via link edges |
src/scripts/graphify-pipeline.ts | Full pipeline: episode → merge → html → check |
src/scripts/gen-story-html.ts | graph.json → vis.js HTML (single + merged) |
src/scripts/codebase-map.ts | Generate CODEBASE_MAP.md |
bun run --cwd bun_app/bun_graphify sets CWD for the spawned process only. All <dir> arguments must be absolute paths (e.g., /Users/.../weapon-forger-ch1-ep2), NOT relative. Relative paths get resolved from bun_app/bun_graphify/ and fail silently..gitignore — output is ephemeral