Vision: A zero-config, language-agnostic CLI that turns any git repository into high-quality visual documentation — useful from first
git cloneto ongoing refactoring.
This roadmap supersedes the previous incremental plan. The old plan grew organically and accreted layouts/concepts that never paid their keep; we’re starting from a clean architectural contract instead.
History: The first attempt at consolidation (
feat/phase1-scaffold) tried to bolt aCodeModelonto the existingBlueprintIR. It was dropped because the two contracts disagree on what “a module” is and the glue layer was accumulating workarounds faster than features. This v2 roadmap rebuilds the core from scratch so later phases plug in cleanly.
codetwin gen works out of the box; codetwin.toml is an optional
power-user knob.Cargo.toml,
pyproject.toml, package.json, go.mod, …).tree-sitter, petgraph, ignore, …) over bespoke
implementations.(CodeModel, Config) must render byte-identical output. This
unlocks snapshot tests and diffs.| Roadmap term | Scrum equivalent |
|---|---|
| Phase (integer) | Epic |
| Step (lowercase alpha) | Backlog item / User story |
| Task (hyphen) | Task |
Every TODO(Phase N.x) comment in the codebase points to a step in this document.
Rebuild the internal pipeline so every future feature plugs in cleanly.
CodeModel)CodeModel, Module, Symbol, Edge, Visibility enums (src/ir/).Symbol with a structured Signature (parameters + return) once a layout needs it.serde_json) — covered by tests/ir.rs.Edge) as first-class data (not derived).Driver trait: detect, parse, name (src/drivers/mod.rs).DriverRegistry with the four built-ins (rust, python, typescript, go).CodeModel.CodeModel.Layout trait + OutputFile + LayoutRegistry (src/layouts/).project-overview, architecture-map, c4, metrics (last two scaffolded).src/pipeline/).--dump-ir / --json dump the merged CodeModel.(module_id, symbol_name).--save semantics (persist to codetwin.toml).codetwin.toml (Config::load_or_default), deny_unknown_fields.source_dirs, output_file, layout, format, exclude_patterns, layers,
drivers.codetwin init --force.--watch flag on gen, snapshot, diff.exclude_patterns (glob) on top of .gitignore during discovery.Two layouts that cover the two primary audiences.
project-overviewgit clone.main, lib, index, __main__) and trace outward.architecture-mappetgraph::algo::tarjan_scc).[[layers]]; auto-detect when absent.render::markdown::MarkdownBuilder skeleton.render::mermaid::graph_td skeleton.<details>, code-fence, and subgraph helpers.docs/ on every merge.docs/VALIDATION.md with a reviewer checklist.docs/VALIDATION_LOG.md.codetwin snapshot [--ref <COMMIT>] [--watch] writes .codetwin/snapshots/<short>.json.codetwin diff [REF_A] [REF_B] (defaults: last snapshot → working tree).classDef.--json for programmatic consumption.tree-sitter-typescript; extract classes, interfaces, functions, exports, type aliases, generics.tsconfig.json or package.json with a typescript dependency.tree-sitter-go; extract structs, interfaces, functions, methods, packages.go.mod.docs/CONTRIBUTING_DRIVERS.md — “a new driver should be ~1 file + 1 fixture”.--json for CI integration (fail build if thresholds exceeded).theme config key: default, dark, forest, neutral, or custom overrides.--multi-file: one file per module/layer, plus an index file.--format html; static single-page HTML with inline Mermaid SVG.codetwin gen --format html --watch serves a local HTTP page with live reload.| Phase | Focus | Audience |
|---|---|---|
| 1 | Core engine redesign (IR, drivers, layouts, pipeline) | Foundation |
| 2 | MVP layouts: project-overview + architecture-map | Developers, architects |
| 3 | Dogfooding CI gate + test suite | Quality assurance |
| 4 | Architecture diff between commits | Developers refactoring |
| 5 | Additional language drivers | Polyglot repos |
| 6 | Advanced layouts, metrics, theming | Power users |
| 7 | HTML & interactive output | Teams, presentations |
codetwin gen [OPTIONS]
--layout <NAME> project-overview | architecture-map | c4 | metrics
--output <PATH> Output file path
--format <FMT> markdown (default) | html (Phase 7)
--source <DIR>... Override source directories
--exclude <PATTERN>... Additional exclude patterns
--drivers <NAME>... Override auto-detected drivers
--dump-ir Dump the merged CodeModel as JSON
--multi-file One output file per module/layer (Phase 6.d)
--watch Re-run on filesystem changes
--save Persist flag values to codetwin.toml
codetwin init [--force]
codetwin snapshot [--ref <COMMIT>] [--watch]
codetwin diff [REF_A] [REF_B] [--watch]
codetwin list [--drivers] [--layouts]
Global flags (on every subcommand): --verbose, --quiet, -C/--cwd, --json.
Entrypoint
codetwinis immutable — already published on crates.io, PyPI, and npm.
cargo release + git-cliff + cargo-dist + PyPI/npm wrappers remain
unchanged.codetwin.toml, ephemeral flags + --save.tree-sitter, petgraph, rayon, serde, clap, anyhow, tracing,
walkdir, ignore, glob, notify-debouncer-mini.CodeModel with dependency edges as first-class data (no more Blueprint).watch subcommand removed; --watch is a global flag on gen, snapshot, diff.snapshot, diff.list subcommand extended with --drivers / --layouts.edition = "2024" toolchain.TODO(Phase N.x) comment in the source — every one corresponds to a concrete step above.tests/ (see tests/README.md for the cheatsheet).cargo fmt --all && cargo clippy --all-targets -- -D warnings && cargo test --all.dev; keep each PR scoped to a single step.