@@ -50,6 +50,49 @@ oxdraw --code-map ./ --gemini YOUR_API_KEY
5050oxdraw --code-map ./src/diagram.rs --no-ai --output test.png
5151```
5252
53+ ### Have AI Generate a Codedown (Markdown + Code Mappings)
54+
55+ https://github.com/user-attachments/assets/da77a7d0-9c22-4e48-ad8b-b7f29213ba45
56+
57+ "Codedowns" are Markdown documents that include embedded mapping metadata so the editor can make headings/paragraphs/inline code clickable and jump into the codebase.
58+ Aside from the explicit mappings, oxdraw will automatically map inline codeblocks to their definitions in the codebase or filenames to the relevant file.
59+
60+ ` --codedown-style ` selects a built-in prompt preset (architecture/tutorial/api). You can further refine the output by appending extra instructions via ` --prompt ` .
61+
62+ ``` bash
63+ # Generate a codedown from a repo and launch the viewer
64+ oxdraw --codedown ./ --gemini YOUR_API_KEY
65+
66+ # Same, but with extra instructions appended to a preset prompt
67+ oxdraw --codedown ./ --codedown-style architecture --gemini YOUR_API_KEY --prompt " Focus on auth + request lifecycle"
68+
69+ # Save the codedown to a file instead of launching the viewer
70+ oxdraw --codedown ./ --codedown-style api --gemini YOUR_API_KEY --output docs/architecture.md
71+
72+ # Print the codedown to stdout
73+ oxdraw --codedown ./ --gemini YOUR_API_KEY --output -
74+ ```
75+
76+ ### Augment an Existing Markdown File With Code Mappings
77+
78+ If you already have a markdown doc (e.g. ` docs/notes.md ` ) and want to add mappings so it becomes clickable in the viewer:
79+
80+ ``` bash
81+ # Produces docs/notes-mapped.md by default
82+ oxdraw --augment-markdown docs/notes.md --repo-path . --gemini YOUR_API_KEY
83+
84+ # Or explicitly write to a file
85+ oxdraw --augment-markdown docs/notes.md --repo-path . --gemini YOUR_API_KEY --output docs/notes.codedown.md
86+ ```
87+
88+ ### View a Codedown
89+
90+ If you pass a ` .md ` file via ` --input ` and it contains codedown mappings, ` oxdraw ` will open it in the codedown viewer.
91+
92+ ``` bash
93+ oxdraw --input docs/architecture.md
94+ ```
95+
5396## Features
5497
5598### CLI Flags
@@ -67,11 +110,18 @@ oxdraw --code-map ./src/diagram.rs --no-ai --output test.png
67110| ` -q, --quiet ` | Suppress informational stdout such as the success message after rendering to disk. |
68111| ` -n, --new ` | Create new mermaid file and serves for editing. |
69112| ` --code-map <PATH> ` | Generate a code map from the given codebase path. |
113+ | ` --codedown <PATH> ` | Generate a codedown (markdown with code mappings) from the given codebase path (launches viewer unless ` --output ` is set). |
114+ | ` --codedown-style <STYLE> ` | Documentation style for codedown generation: ` architecture ` , ` tutorial ` , or ` api ` (requires ` --codedown ` ). |
115+ | ` --augment-markdown <PATH> ` | Augment an existing markdown file with code mappings (writes to ` --output ` or defaults to ` <stem>-mapped.md ` ). |
116+ | ` --repo-path <PATH> ` | Repository path used by ` --augment-markdown ` (defaults to current directory). |
70117| ` --api-key <KEY> ` | API Key for the LLM (optional, defaults to environment variable if not set). |
71- | ` --model <MODEL> ` | Model to use for code map generation. |
118+ | ` --model <MODEL> ` | Model to use for AI-backed generation (codemap/codedown/augment-markdown) . |
72119| ` --api-url <URL> ` | API URL for the LLM. |
73- | ` --regen ` | Force regeneration of the code map even if a cache exists. |
74- | ` --prompt <PROMPT> ` | Custom prompt to append to the LLM instructions. |
120+ | ` --regen ` | Force regeneration even if a cache exists (codemap/codedown). |
121+ | ` --prompt <PROMPT> ` | Extra instructions appended to the AI prompt (codemap/codedown). |
122+ | ` --no-ai ` | Use deterministic generation instead of AI (only for ` --code-map ` ). |
123+ | ` --max-nodes <N> ` | Maximum number of nodes to generate in deterministic mode (default ` 20 ` ). |
124+ | ` --gemini <KEY> ` | Use Google Gemini API with the provided key (conflicts with ` --api-key ` ). |
75125
76126### Frontend Features
77127
0 commit comments