codetwin
A bidirectional documentation and code synchronization tool.
Status: early prototype. CLI scaffolding in place; functionality incoming.
Overview
Codetwin aims to keep code and docs in sync, reducing drift by:
- Extracting code from docs to verified snippets
- Embedding code references back into docs
- Providing a simple CLI workflow for local repos
Installation
You can build and run locally with Cargo (Rust toolchain required):
# From the repository root
Or run directly:
Usage
Initial scaffold prints a greeting to verify the toolchain:
As features land, the CLI will expose subcommands using clap.
Formatter layouts
- folder_markdown (Available): One Markdown per source folder plus an index file; default layout.
- mirror_tree (Proposed): Mirror
src/structure intodocs/with one Markdown per source file or module for path parity. - readme_append (Proposed): Append a generated section into README with markers to protect hand-written content.
- per_language (Proposed): Group outputs by language first, then folders for polyglot repos.
- site_bundle (Proposed): Emit Markdown plus minimal static-site-friendly index/metadata (e.g., mkdocs/sidebar) without bundling a generator.
- api_ref_only (Proposed): Produce lean API signature references without diagrams for compact docs.
- diagram_first (Proposed): Emit diagram-focused summaries (Mermaid/PlantUML blocks) with minimal prose.
Development
- Rust edition: 2024
- Min Rust: recent stable recommended
- Key deps:
clapwithderive
Common tasks:
# Format & lint
# Test
# Release build
Repository
License
MIT