codetwin

CodeTwin Roadmap

Vision: A zero-config, language-agnostic CLI that turns any git repository into high-quality visual documentation — useful from first git clone to 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 a CodeModel onto the existing Blueprint IR. 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.


Architecture Principles


Terminology

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.


Phase 1 — Core Engine Redesign

Rebuild the internal pipeline so every future feature plugs in cleanly.

a. Define the IR (CodeModel)

b. Driver trait + auto-detection registry

c. Layout trait + registry

d. Pipeline orchestration

e. Configuration v2


Phase 2 — MVP Layouts

Two layouts that cover the two primary audiences.

a. project-overview

b. architecture-map

c. Shared render helpers

d. Integration tests


Phase 3 — Dogfooding & Quality Gate

a. Self-documentation CI job

b. Manual validation checklist

c. Fixture-based functional tests


Phase 4 — Architecture Diff

a. Snapshot capture

b. Diff engine

c. Diff output

d. Integration tests


Phase 5 — Additional Drivers

a. TypeScript driver

b. Go driver

c. Driver contribution guide


Phase 6 — Advanced Layouts & Features

a. C4 Model layout

b. Coupling & metrics layout

c. Mermaid theming

d. Multi-file output


Phase 7 — HTML & Interactive Output

a. HTML renderer

b. Interactive features

c. Live preview


Phase Summary

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

CLI Surface

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 codetwin is immutable — already published on crates.io, PyPI, and npm.


What Stays From Current Implementation

What Changes


How to Contribute

  1. Pick a TODO(Phase N.x) comment in the source — every one corresponds to a concrete step above.
  2. Add a test under tests/ (see tests/README.md for the cheatsheet).
  3. Run cargo fmt --all && cargo clippy --all-targets -- -D warnings && cargo test --all.
  4. Open a PR against dev; keep each PR scoped to a single step.