Skip to content

Commit c14699c

Browse files
committed
feat: add mode-aware explainers, verification checkpoint, and html output
1 parent 17b8398 commit c14699c

File tree

14 files changed

+1936
-69
lines changed

14 files changed

+1936
-69
lines changed

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,14 @@ Outputs include:
66

77
- Crisp top-level overview (`OVERVIEW.md`)
88
- Linked deep explainers (architecture, modules, flows, dependencies, glossary)
9+
- Optional interactive HTML explainer (`html/ONBOARDING.html`)
910
- Mermaid source diagrams (`.mmd`)
1011
- Rendered SVG and PNG diagrams
1112
- Confidence, attribution, and quality reports (`meta/*.json`)
1213
- Documentation coverage report (`meta/coverage_report.json`)
14+
- Verification checkpoint (`meta/verification_checkpoint.json`)
15+
- Fact-check report (`meta/fact_check_report.json`)
16+
- Content completeness report (`meta/content_completeness.json`)
1317

1418
## Repository Layout
1519

@@ -143,6 +147,8 @@ python scripts/analyze.py analyze \
143147
--source <local_path_or_github_url> \
144148
--output <output_dir> \
145149
--mode standard \
150+
--format both \
151+
--explainer-type onboarding \
146152
--audience nontech \
147153
--overview-length medium \
148154
--enable-llm-descriptions true \
@@ -155,6 +161,11 @@ Useful optional controls:
155161

156162
- `--include-glob "<pattern>"` (repeatable) to scope analysis to specific paths
157163
- `--exclude-glob "<pattern>"` (repeatable) to remove generated/irrelevant files
164+
- `--format markdown|html|both`
165+
- `--explainer-type onboarding|project-recap|plan-review|diff-review`
166+
- `--since "<window>"` for `project-recap`
167+
- `--plan-file <path>` for `plan-review`
168+
- `--git-ref <ref>` for `diff-review`
158169

159170
For LLM-based narrative summaries:
160171

code-explainer/SKILL.md

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,13 @@ python scripts/analyze.py analyze \
3333
--source <local_path_or_github_url> \
3434
--output <output_dir> \
3535
--mode <quick|standard|deep> \
36+
--format <markdown|html|both> \
37+
--explainer-type <onboarding|project-recap|plan-review|diff-review> \
3638
--audience <nontech|mixed|engineering> \
3739
--overview-length <short|medium|long> \
40+
--since <time_window> \
41+
--git-ref <ref> \
42+
--plan-file <path> \
3843
--include-glob <pattern> \
3944
--exclude-glob <pattern> \
4045
--enable-llm-descriptions <true|false> \
@@ -46,6 +51,8 @@ python scripts/analyze.py analyze \
4651
Defaults:
4752

4853
- `mode=standard`
54+
- `format=markdown`
55+
- `explainer-type=onboarding`
4956
- `audience=nontech`
5057
- `overview-length=medium`
5158
- `enable-llm-descriptions=true`
@@ -83,13 +90,16 @@ bash ./scripts/install_runtime.sh
8390
2. Local index build (files/modules/symbol candidates).
8491
3. Stack/entrypoint/dependency/flow extraction.
8592
4. Documentation ingestion (`coverage_report.json`).
86-
5. Optional LLM narrative generation (`llm_summary.json`).
87-
6. Optional DeepWiki + web enrichment with attribution.
88-
7. Mermaid generation (Context + Container + flow set).
89-
8. Mermaid validation.
90-
9. SVG then PNG rendering.
91-
10. Overview + deep markdown generation.
92-
11. Quality gates and confidence report generation.
93+
5. Mode-specific context extraction (`explainer_context.json`).
94+
6. Verification checkpoint generation (`verification_checkpoint.json`).
95+
7. Optional LLM narrative generation (`llm_summary.json`).
96+
8. Optional DeepWiki + web enrichment with attribution.
97+
9. Mermaid generation (Context + Container + flow set).
98+
10. Mermaid validation.
99+
11. SVG then PNG rendering.
100+
12. Markdown and/or HTML explainer generation.
101+
13. Fact-check pass (`fact_check_report.json`).
102+
14. Quality gates, completeness checks, and confidence report generation.
93103

94104
## Notes
95105

code-explainer/assets/templates/deep_architecture.md.j2

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ Architecture Pattern: **{{architecture_pattern}}**
3232

3333
{{llm_deep_dive_starters}}
3434

35+
## Mode-Specific Context
36+
37+
{{mode_specific_context}}
38+
3539
## Where To Modify for Common Changes
3640

3741
{{where_to_modify}}

code-explainer/assets/templates/overview.md.j2

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ It appears to follow a **{{architecture_pattern}}** architecture with a stack ce
2929

3030
{{directory_plain_summaries}}
3131

32+
## Explainer Focus
33+
34+
{{analysis_focus_section}}
35+
3236
## Documentation Coverage
3337

3438
{{docs_coverage}}

code-explainer/references/mode-behavior.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,22 @@ Goal: Maximum fidelity and audit-ready onboarding.
5050
- `CODE_EXPLAINER_LLM_API_KEY` (or `OPENAI_API_KEY`)
5151
- `CODE_EXPLAINER_LLM_BASE_URL` (optional)
5252
- `CODE_EXPLAINER_LLM_MODEL` (optional)
53+
54+
## Output Format
55+
56+
- `--format markdown`: generate markdown explainers (overview + deep docs).
57+
- `--format html`: generate a single interactive HTML explainer page.
58+
- `--format both`: generate markdown + interactive HTML.
59+
60+
## Explainer Type
61+
62+
- `--explainer-type onboarding`: default onboarding narrative.
63+
- `--explainer-type project-recap`: emphasizes recent activity and mental model refresh.
64+
- `--explainer-type plan-review`: compares plan/spec references against actual codebase.
65+
- `--explainer-type diff-review`: frames explainer around code changes from `--git-ref`.
66+
67+
Optional supporting flags:
68+
69+
- `--since "<window>"` for `project-recap` (default: `2 weeks ago`)
70+
- `--plan-file <path>` for `plan-review`
71+
- `--git-ref <ref>` for `diff-review`

code-explainer/references/output-contract.md

Lines changed: 81 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,37 @@
22

33
`code-explainer` writes the following deterministic output tree under `<output>/`:
44

5-
1. `overview/OVERVIEW.md`
6-
2. `deep/ARCHITECTURE_DEEP.md`
7-
3. `deep/MODULES_DEEP.md`
8-
4. `deep/FLOWS_DEEP.md`
9-
5. `deep/DEPENDENCIES_DEEP.md`
10-
6. `deep/GLOSSARY.md`
11-
7. `diagrams/*.mmd`
12-
8. `diagrams/svg/*.svg`
13-
9. `diagrams/png/*.png`
14-
10. `meta/analysis_manifest.json`
15-
11. `meta/confidence_report.json`
16-
12. `meta/source_attribution.json`
17-
13. `meta/index.json`
18-
14. `meta/stack.json`
19-
15. `meta/entrypoints.json`
20-
16. `meta/dependencies.json`
21-
17. `meta/flows.json`
22-
18. `meta/diagram_manifest.json`
23-
19. `meta/mermaid_validation.json`
24-
20. `meta/render_report.json`
25-
21. `meta/enrichment.json`
26-
22. `meta/coverage_report.json`
27-
23. `meta/llm_summary.json`
28-
24. `meta/docs_generation.json`
29-
25. `meta/quality_report.json`
5+
1. `overview/OVERVIEW.md` (when `--format markdown|both`)
6+
2. `deep/ARCHITECTURE_DEEP.md` (when `--format markdown|both`)
7+
3. `deep/MODULES_DEEP.md` (when `--format markdown|both`)
8+
4. `deep/FLOWS_DEEP.md` (when `--format markdown|both`)
9+
5. `deep/DEPENDENCIES_DEEP.md` (when `--format markdown|both`)
10+
6. `deep/GLOSSARY.md` (when `--format markdown|both`)
11+
7. `html/ONBOARDING.html` (when `--format html|both`)
12+
8. `diagrams/*.mmd`
13+
9. `diagrams/svg/*.svg`
14+
10. `diagrams/png/*.png`
15+
11. `meta/analysis_manifest.json`
16+
12. `meta/confidence_report.json`
17+
13. `meta/source_attribution.json`
18+
14. `meta/index.json`
19+
15. `meta/stack.json`
20+
16. `meta/entrypoints.json`
21+
17. `meta/dependencies.json`
22+
18. `meta/flows.json`
23+
19. `meta/diagram_manifest.json`
24+
20. `meta/mermaid_validation.json`
25+
21. `meta/render_report.json`
26+
22. `meta/enrichment.json`
27+
23. `meta/coverage_report.json`
28+
24. `meta/explainer_context.json`
29+
25. `meta/verification_checkpoint.json`
30+
26. `meta/llm_summary.json`
31+
27. `meta/docs_generation.json`
32+
28. `meta/html_generation.json` (when `--format html|both`)
33+
29. `meta/fact_check_report.json`
34+
30. `meta/content_completeness.json`
35+
31. `meta/quality_report.json`
3036

3137
## Manifest Schema
3238

@@ -44,13 +50,18 @@
4450
- `diagram_count`
4551
- `audience`
4652
- `overview_length`
53+
- `output_format`
54+
- `analysis_type`
4755
- `include_globs[]`
4856
- `exclude_globs[]`
4957
- `docs_discovered`
5058
- `docs_parsed`
5159
- `llm_descriptions_enabled`
5260
- `llm_descriptions_used`
5361
- `llm_model`
62+
- `verification_fact_count`
63+
- `fact_check_passed`
64+
- `html_generated`
5465

5566
## Coverage Schema
5667

@@ -65,6 +76,37 @@
6576
- `parsed_docs[]` with `path`, `title`, `summary`, `headings[]`, `line_count`, `size_bytes`, `keywords[]`
6677
- `skipped_docs[]` with `path`, `reason`
6778

79+
## Explainer Context Schema
80+
81+
`explainer_context.json` contains:
82+
83+
- `generated_at`
84+
- `analysis_type` (`onboarding|project-recap|plan-review|diff-review`)
85+
- `source`
86+
- `repo_root`
87+
- `since`
88+
- `git_ref`
89+
- `plan_file`
90+
- `project_recap` (mode-specific)
91+
- `plan_review` (mode-specific)
92+
- `diff_review` (mode-specific)
93+
- `highlights[]`
94+
95+
## Verification Schema
96+
97+
`verification_checkpoint.json` contains:
98+
99+
- `generated_at`
100+
- `analysis_type`
101+
- `fact_count`
102+
- `facts[]` with:
103+
- `claim_id`
104+
- `claim_text`
105+
- `expected_text`
106+
- `must_include_tokens[]`
107+
- `status`
108+
- `evidence_locations[]` with `path`, `line`, `excerpt`
109+
68110
## LLM Narrative Schema
69111

70112
`llm_summary.json` contains:
@@ -82,6 +124,20 @@
82124
- `confidence_notes[]`
83125
- `error`
84126

127+
## Fact-Check Schema
128+
129+
`fact_check_report.json` contains:
130+
131+
- `checked_at`
132+
- `output_format`
133+
- `analysis_type`
134+
- `fact_count`
135+
- `confirmed_count`
136+
- `mismatch_count`
137+
- `passed`
138+
- `checks[]`
139+
- `advisory_checks[]`
140+
85141
## Confidence Schema
86142

87143
`confidence_report.json` contains:

0 commit comments

Comments
 (0)