Skip to content

Commit a007bc9

Browse files
committed
feat: improve analysis fidelity with doc coverage and semantic gates
1 parent 3cf655d commit a007bc9

18 files changed

+1165
-226
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Outputs include:
99
- Mermaid source diagrams (`.mmd`)
1010
- Rendered SVG and PNG diagrams
1111
- Confidence, attribution, and quality reports (`meta/*.json`)
12+
- Documentation coverage report (`meta/coverage_report.json`)
1213

1314
## Repository Layout
1415

@@ -143,9 +144,15 @@ python scripts/analyze.py analyze \
143144
--output <output_dir> \
144145
--mode standard \
145146
--audience nontech \
147+
--overview-length medium \
146148
--enable-web-enrichment true
147149
```
148150

151+
Useful optional controls:
152+
153+
- `--include-glob "<pattern>"` (repeatable) to scope analysis to specific paths
154+
- `--exclude-glob "<pattern>"` (repeatable) to remove generated/irrelevant files
155+
149156
## Install From GitHub (For Other Developers)
150157

151158
Using Skills CLI:

code-explainer/SKILL.md

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,17 @@ python scripts/analyze.py analyze \
3434
--output <output_dir> \
3535
--mode <quick|standard|deep> \
3636
--audience <nontech|mixed|engineering> \
37+
--overview-length <short|medium|long> \
38+
--include-glob <pattern> \
39+
--exclude-glob <pattern> \
3740
--enable-web-enrichment <true|false>
3841
```
3942

4043
Defaults:
4144

4245
- `mode=standard`
4346
- `audience=nontech`
47+
- `overview-length=medium`
4448
- `enable-web-enrichment=true`
4549

4650
## Dependencies
@@ -72,12 +76,13 @@ bash ./scripts/install_runtime.sh
7276
1. Intake and source normalization.
7377
2. Local index build (files/modules/symbol candidates).
7478
3. Stack/entrypoint/dependency/flow extraction.
75-
4. Optional DeepWiki + web enrichment with attribution.
76-
5. Mermaid generation (Context + Container + flow set).
77-
6. Mermaid validation.
78-
7. SVG then PNG rendering.
79-
8. Overview + deep markdown generation.
80-
9. Quality gates and confidence report generation.
79+
4. Documentation ingestion (`coverage_report.json`).
80+
5. Optional DeepWiki + web enrichment with attribution.
81+
6. Mermaid generation (Context + Container + flow set).
82+
7. Mermaid validation.
83+
8. SVG then PNG rendering.
84+
9. Overview + deep markdown generation.
85+
10. Quality gates and confidence report generation.
8186

8287
## Notes
8388

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
Generated: {{generated_at}}
44
Architecture Pattern: **{{architecture_pattern}}**
55

6+
## Purpose Snapshot
7+
8+
{{plain_summary}}
9+
610
## System and Container View
711

812
- Context diagram: `../diagrams/svg/c4_context.svg`
@@ -20,11 +24,14 @@ Architecture Pattern: **{{architecture_pattern}}**
2024

2125
{{critical_paths}}
2226

27+
## Documentation Signals Used
28+
29+
{{docs_coverage}}
30+
2331
## Where To Modify for Common Changes
2432

2533
{{where_to_modify}}
2634

2735
## Diagram Inventory
2836

2937
{{diagram_links}}
30-

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ Generated: {{generated_at}}
66

77
{{request_lifecycle}}
88

9+
## Primary User Flow (Extracted)
10+
11+
`{{primary_user_flow_summary}}`
12+
913
## Flow and Sequence Diagrams
1014

1115
- Request lifecycle: `../diagrams/svg/request_lifecycle_sequence.svg`
@@ -24,4 +28,4 @@ If mode is `deep`, additional assets are also available:
2428
1. Start with one user flow.
2529
2. Trace the same path in entrypoint and service layers.
2630
3. Confirm dependency boundaries before proposing changes.
27-
31+
4. Cross-check assumptions using `meta/coverage_report.json` and `meta/confidence_report.json`.

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,17 @@ Generated: {{generated_at}}
1111
- Modules with larger file counts often represent primary feature or platform surfaces.
1212
- Use `module_dependency_graph.svg` to validate coupling before changing shared modules.
1313
- Prioritize low-coupling modules for first onboarding changes.
14+
- Use doc coverage below to anchor module understanding in existing repository docs.
1415

1516
## Where To Modify for Feature Work
1617

1718
{{where_to_modify}}
1819

20+
## Doc Coverage Context
21+
22+
{{docs_coverage}}
23+
1924
## Key Technology Context
2025

2126
- Languages: {{top_languages}}
2227
- Frameworks: {{top_frameworks}}
23-

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

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,35 +3,50 @@
33
Generated: {{generated_at}}
44
Source: `{{source}}`
55
Mode: `{{mode}}`
6-
Audience: `{{audience}}`
6+
Audience: `{{audience}}`
7+
Length: `{{overview_length}}`
78

89
## What This System Is
910

10-
This repository contains the core software system for **{{repo_name}}**.
11+
{{plain_summary}}
12+
1113
It appears to follow a **{{architecture_pattern}}** architecture with a stack centered on:
1214

1315
- Languages: {{top_languages}}
1416
- Frameworks: {{top_frameworks}}
1517

1618
## Who Uses It and Why
1719

18-
- PMs and designers use this explainer to understand product surfaces and user flows.
19-
- New engineers use this explainer to identify entry points and module boundaries.
20-
- Senior engineers use deep docs to evaluate architecture and dependency risk.
20+
- {{audience_note}}
21+
- {{mode_note}}
22+
- {{overview_length_note}}
2123

2224
## Key Building Blocks (3-7)
2325

2426
{{building_blocks}}
2527

28+
## Documentation Coverage
29+
30+
{{docs_coverage}}
31+
32+
Start with these docs:
33+
34+
{{docs_quick_links}}
35+
2636
## High-Level Architecture Diagram
2737

2838
![C4 Context](../diagrams/svg/c4_context.svg)
2939

3040
## If You Are PM / Designer / New Engineer, Start Here
3141

3242
1. Read this file top-to-bottom once.
33-
2. Open the user flow image: `../diagrams/svg/primary_user_flow.svg`.
43+
2. Open `../diagrams/svg/primary_user_flow.svg` and trace the flow: `{{primary_user_flow_summary}}`.
3444
3. Jump to module ownership and “where to modify” in the deep docs.
45+
4. If needed, inspect `meta/coverage_report.json` and `meta/confidence_report.json` for caveats.
46+
47+
## External Context (Optional Enrichment)
48+
49+
{{external_context_summary}}
3550

3651
## Deep Dive Links
3752

@@ -40,4 +55,3 @@ It appears to follow a **{{architecture_pattern}}** architecture with a stack ce
4055
- [Flows Deep Explainer](../deep/FLOWS_DEEP.md)
4156
- [Dependencies Deep Explainer](../deep/DEPENDENCIES_DEEP.md)
4257
- [Glossary](../deep/GLOSSARY.md)
43-

code-explainer/references/mode-behavior.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Goal: Fast orientation with lightweight outputs.
77
- Reduced dependency/flow depth.
88
- Core docs still generated.
99
- Fewer inferred critical paths.
10+
- Lower documentation ingestion cap.
1011

1112
## Standard (Default)
1213

@@ -15,6 +16,7 @@ Goal: Balanced fidelity and runtime for most repositories.
1516
- Full required two-tier docs.
1617
- Mandatory standard diagram set.
1718
- Context + container + request + dependency views.
19+
- Balanced doc ingestion and semantic quality checks.
1820

1921
## Deep
2022

@@ -23,4 +25,16 @@ Goal: Maximum fidelity and audit-ready onboarding.
2325
- Adds advanced diagrams and richer flow analysis.
2426
- Includes trust boundary and data lineage outputs.
2527
- Better suited for large or complex repos.
28+
- Higher doc ingestion cap and longer extracted flow traces.
2629

30+
## Audience Behavior
31+
32+
- `nontech`: plain-language phrasing first, minimal jargon.
33+
- `mixed`: business-and-technical balance.
34+
- `engineering`: technical detail and traceability emphasis.
35+
36+
## Overview Length
37+
38+
- `short`: executive skim.
39+
- `medium`: balanced default.
40+
- `long`: expanded onboarding context and references.

code-explainer/references/output-contract.md

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@
2323
19. `meta/mermaid_validation.json`
2424
20. `meta/render_report.json`
2525
21. `meta/enrichment.json`
26-
22. `meta/docs_generation.json`
27-
23. `meta/quality_report.json`
26+
22. `meta/coverage_report.json`
27+
23. `meta/docs_generation.json`
28+
24. `meta/quality_report.json`
2829

2930
## Manifest Schema
3031

@@ -40,6 +41,25 @@
4041
- `entrypoints`
4142
- `module_count`
4243
- `diagram_count`
44+
- `audience`
45+
- `overview_length`
46+
- `include_globs[]`
47+
- `exclude_globs[]`
48+
- `docs_discovered`
49+
- `docs_parsed`
50+
51+
## Coverage Schema
52+
53+
`coverage_report.json` contains:
54+
55+
- `generated_at`
56+
- `mode`
57+
- `discovered_count`
58+
- `parsed_count`
59+
- `skipped_count`
60+
- `discovered_docs[]`
61+
- `parsed_docs[]` with `path`, `title`, `summary`, `headings[]`, `line_count`, `size_bytes`, `keywords[]`
62+
- `skipped_docs[]` with `path`, `reason`
4363

4464
## Confidence Schema
4565

@@ -63,4 +83,3 @@
6383
- `source_type` (`local`, `web`, or `deepwiki`)
6484
- `source_uri`
6585
- `extraction_timestamp`
66-

0 commit comments

Comments
 (0)