Skip to content

Commit bd67793

Browse files
committed
feat: add proof-backed excalidraw exports
1 parent 02b5e91 commit bd67793

17 files changed

+2207
-52
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,14 @@ __pycache__/
44

55
# Skill local outputs
66
.out*/
7+
.audit_tmp/
78
code-explainer-output/
89
code-explainer/.out*/
910
code-explainer/.out-gh/
1011
code-explainer/.ci-out/
12+
code-explainer/.audit_tmp/
1113
code-explainer/code-explainer-output/
14+
code-explainer/node_modules/
1215

1316
# OS/editor
1417
.DS_Store

PUBLISHING.md

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ From repository root:
66

77
```bash
88
git add .
9-
git commit -m "feat: rebuild code-explainer around grounded explanation quality"
10-
git remote add origin https://github.com/<your-org-or-user>/code-explainer.git
9+
git commit -m "feat: add proof-backed Excalidraw exports"
1110
git push -u origin main
1211
```
1312

@@ -16,12 +15,14 @@ git push -u origin main
1615
1. The repo-level docs match the shipped skill contract.
1716
2. `code-explainer/SKILL.md` reflects the current pipeline and proof path.
1817
3. `python code-explainer/scripts/self_audit.py` passes.
19-
4. `install_to_codex.ps1` installs the current package cleanly.
18+
4. `install_to_codex.ps1` copies the current package cleanly, including `package.json` and `package-lock.json`.
19+
5. `meta/excalidraw_report.json` is part of the output contract and the self-audit proves editable scene generation.
2020

2121
Recommended:
2222

2323
```bash
2424
cd code-explainer
25+
pwsh ./scripts/install_runtime.ps1
2526
python scripts/self_audit.py
2627
```
2728

@@ -49,11 +50,13 @@ Users need:
4950
- Node.js `18+` and npm
5051
- Git
5152

52-
Recommended for full diagram rendering:
53+
Recommended for higher-fidelity diagram rendering:
5354

5455
- Mermaid CLI (`@mermaid-js/mermaid-cli`)
5556

56-
Even without live LLM access, the proof path still works through `CODE_EXPLAINER_MOCK_LLM=true`.
57+
The repo also ships a local Excalidraw bridge dependency through `package.json`.
58+
59+
Even without live LLM access, the proof path still works through `CODE_EXPLAINER_MOCK_LLM=true`. Even if the official Excalidraw bridge is browser-dependent in the local environment, the shipped deterministic fallback scene generator keeps the editable-diagram proof path working and records the downgrade in `meta/excalidraw_report.json`.
5760

5861
## GitHub Distribution
5962

@@ -82,11 +85,13 @@ Suggested GitHub topics:
8285
- `codebase-analysis`
8386
- `onboarding`
8487
- `mermaid`
88+
- `excalidraw`
8589
- `developer-tools`
8690

8791
Useful publishing assets:
8892

8993
1. A short README section showing `overview/OVERVIEW.md`
90-
2. One example diagram image
94+
2. One example Mermaid diagram and one example Excalidraw scene screenshot
9195
3. The self-audit result summary
92-
4. A release note that explains the rebuild from generic output to proof-backed output
96+
4. The latest `audit-skill` report
97+
5. A release note that explains the shift from generic output to proof-backed explanation plus editable diagrams

README.md

Lines changed: 35 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# code-explainer
22

3-
`code-explainer` is a Codex skill for explaining a local repository or GitHub repository in simple, concrete language. The rebuilt version is explanation-first: it creates a grounded narrative plan, generates onboarding docs and focused diagrams from that plan, and scores the output for clarity, specificity, grounding, usefulness, and honesty.
3+
`code-explainer` is a Codex skill for turning a local repository or GitHub repository URL into grounded onboarding material. It is explanation-first: it builds a narrative plan from real repo evidence, generates docs and diagrams from that plan, and proves output quality with a shipped self-audit.
44

55
## What It Produces
66

@@ -15,6 +15,9 @@ A standard run writes:
1515
- `diagrams/*.mmd`
1616
- `diagrams/svg/*.svg`
1717
- `diagrams/png/*.png`
18+
- `diagrams/excalidraw/*.excalidraw.json`
19+
- `diagrams/excalidraw/svg/*.svg`
20+
- `diagrams/excalidraw/png/*.png`
1821
- `meta/*.json`
1922

2023
Important proof artifacts:
@@ -23,22 +26,27 @@ Important proof artifacts:
2326
- `meta/explanation_quality.json`
2427
- `meta/verification_checkpoint.json`
2528
- `meta/fact_check_report.json`
29+
- `meta/excalidraw_report.json`
2630
- `meta/quality_report.json`
2731

2832
## Why This Version Is Better
2933

30-
The older build overpromised and produced generic output. This rebuild changes the contract:
34+
The older build looked polished but produced weak output. The current contract is stricter:
3135

32-
- the explanation is planned before docs are written
33-
- diagrams are tied to onboarding questions
34-
- the quality gate can fail generic or weakly grounded output
35-
- the repo ships fixture repos plus a self-audit path
36+
- explanation planning happens before doc generation
37+
- every diagram has an onboarding purpose
38+
- Mermaid is the canonical diagram source
39+
- editable Excalidraw scenes are generated from the same diagram set
40+
- quality gates fail generic, weakly grounded, or incomplete output
41+
- the repo ships fixture repos and a self-audit path
3642

3743
## Repository Layout
3844

3945
```text
4046
code-explainer/
4147
SKILL.md
48+
package.json
49+
package-lock.json
4250
agents/openai.yaml
4351
assets/
4452
fixtures/
@@ -50,7 +58,7 @@ PUBLISHING.md
5058
install_to_codex.ps1
5159
```
5260

53-
## Install Runtime Dependencies
61+
## Runtime Dependencies
5462

5563
Required:
5664

@@ -62,6 +70,10 @@ Recommended:
6270

6371
- Mermaid CLI (`mmdc`) from `@mermaid-js/mermaid-cli`
6472

73+
Installed locally by the skill runtime:
74+
75+
- `@excalidraw/mermaid-to-excalidraw`
76+
6577
Windows:
6678

6779
```powershell
@@ -82,7 +94,7 @@ From this repository root:
8294
powershell -ExecutionPolicy Bypass -File .\install_to_codex.ps1
8395
```
8496

85-
This copies the skill into `~/.codex/skills/code-explainer`. Restart Codex after installation.
97+
This copies the current skill package into `~/.codex/skills/code-explainer`. Restart Codex after installation, then run the skill runtime installer inside the installed copy if you need the local Node dependencies there.
8698

8799
## Run
88100

@@ -97,6 +109,7 @@ python scripts/analyze.py analyze \
97109
--audience nontech \
98110
--overview-length medium \
99111
--enable-llm-descriptions true \
112+
--enable-excalidraw-export true \
100113
--ask-before-llm-use false \
101114
--prompt-for-llm-key false \
102115
--enable-web-enrichment false
@@ -110,6 +123,14 @@ Useful controls:
110123
- `--mode quick|standard|deep`
111124
- `--explainer-type onboarding|project-recap|plan-review|diff-review`
112125
- `--audience nontech|mixed|engineering`
126+
- `--enable-excalidraw-export true|false`
127+
128+
## Diagram and Excalidraw Behavior
129+
130+
- Mermaid remains the canonical source of truth.
131+
- The skill exports editable Excalidraw scenes from that Mermaid set.
132+
- If the official Excalidraw bridge works in the local runtime, it is used directly.
133+
- If the official bridge is browser-dependent or unavailable, the skill falls back to a deterministic local scene generator for the Mermaid subset it emits and records that downgrade in `meta/excalidraw_report.json`.
113134

114135
## LLM Behavior
115136

@@ -132,7 +153,12 @@ This runs the skill against fixture repositories in `assets/fixtures/` and write
132153

133154
## Current Status
134155

135-
The rebuilt skill audited at `97.1/100` and is currently `production-grade` under the local `audit-skill` rubric.
156+
The current build audits at `98.8/100` and is `production-grade` under the local `audit-skill` rubric. The self-audit currently proves:
157+
158+
- `2` fixture repositories
159+
- `5` diagrams per fixture
160+
- `5` Excalidraw scenes per fixture
161+
- `97.1` explanation-quality score per fixture
136162

137163
## Publishing
138164

code-explainer/SKILL.md

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,11 @@ This skill should fail quality gates if the output is generic, vague, or weakly
2424
1. `overview/OVERVIEW.md` for the plain-language explanation.
2525
2. `deep/*.md` for architecture, modules, flows, dependencies, and glossary.
2626
3. `diagrams/*.mmd` plus rendered `diagrams/svg/*.svg` and `diagrams/png/*.png`.
27-
4. `meta/explanation_plan.json` describing the intended narrative.
28-
5. `meta/explanation_quality.json` scoring clarity, specificity, grounding, usefulness, diagram usefulness, and honesty.
29-
6. `meta/*.json` for indexing, verification, confidence, attribution, and quality reports.
27+
4. `diagrams/excalidraw/*.excalidraw.json` plus mirrored preview assets under `diagrams/excalidraw/svg/*.svg` and `diagrams/excalidraw/png/*.png`.
28+
5. `meta/explanation_plan.json` describing the intended narrative.
29+
6. `meta/explanation_quality.json` scoring clarity, specificity, grounding, usefulness, diagram usefulness, and honesty.
30+
7. `meta/excalidraw_report.json` proving whether editable Excalidraw scenes were created or why that export was blocked.
31+
8. `meta/*.json` for indexing, verification, confidence, attribution, and quality reports.
3032

3133
See `references/output-contract.md` for exact artifacts and `references/evaluation-rubric.md` for the passing bar.
3234

@@ -49,6 +51,7 @@ python scripts/analyze.py analyze \
4951
--include-glob <pattern> \
5052
--exclude-glob <pattern> \
5153
--enable-llm-descriptions <true|false> \
54+
--enable-excalidraw-export <true|false> \
5255
--ask-before-llm-use <true|false> \
5356
--prompt-for-llm-key <true|false> \
5457
--enable-web-enrichment <true|false>
@@ -62,6 +65,7 @@ Defaults:
6265
- `audience=nontech`
6366
- `overview-length=medium`
6467
- `enable-llm-descriptions=true`
68+
- `enable-excalidraw-export=true`
6569
- `ask-before-llm-use=false`
6670
- `prompt-for-llm-key=false`
6771
- `enable-web-enrichment=true`
@@ -80,9 +84,10 @@ Defaults:
8084
3. Build `explanation_plan.json` with top modules, audience starting points, diagram purposes, and caveats.
8185
4. Generate the narrative layer with LLM or grounded mock/deterministic fallback.
8286
5. Build focused diagrams tied to onboarding questions.
83-
6. Generate overview and deep docs from the explanation plan plus narrative layer.
84-
7. Run fact-check and explanation-quality evaluation.
85-
8. Fail the run if quality gates do not clear the rubric.
87+
6. Export those diagrams into editable Excalidraw scenes when the local runtime is installed.
88+
7. Generate overview and deep docs from the explanation plan plus narrative layer.
89+
8. Run fact-check and explanation-quality evaluation.
90+
9. Fail the run if quality gates do not clear the rubric.
8691

8792
## Proof Path
8893

@@ -105,6 +110,7 @@ Required:
105110
Recommended:
106111

107112
- Mermaid CLI (`mmdc`) from `@mermaid-js/mermaid-cli` for higher-fidelity diagram rendering
113+
- `@excalidraw/mermaid-to-excalidraw` installed locally via `npm install` for editable Excalidraw scene export
108114

109115
Install dependencies:
110116

@@ -122,6 +128,8 @@ bash ./scripts/install_runtime.sh
122128

123129
- This skill does not mutate the analyzed repository.
124130
- If the explanation-quality score is below the rubric threshold, treat the output as failed even if files were produced.
131+
- If Excalidraw export is enabled, treat missing or partial editable scene generation as a real quality issue, not a cosmetic extra.
132+
- When the official Excalidraw bridge is unavailable or browser-dependent in the local runtime, the skill falls back to a deterministic local scene generator for the Mermaid subset it emits and records that downgrade in `meta/excalidraw_report.json`.
125133
- Use include/exclude globs to narrow analysis when the repository is very large or noisy.
126134

127135
## References

0 commit comments

Comments
 (0)