Skip to content

Commit ffd0359

Browse files
refactor(docs): code analysis engine
stats: lines: "+25875/-20282 (net +5593)" files: 29 complexity: "Stable complexity"
1 parent e8ff53e commit ffd0359

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+25912
-20287
lines changed

CHANGELOG.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,38 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [3.0.6] - 2026-03-08
11+
12+
### Docs
13+
- Update code2docs/project/README.md
14+
- Update code2docs/project/context.md
15+
- Update docs/CONTRIBUTING.md
16+
- Update docs/README.md
17+
- Update docs/api-changelog.md
18+
- Update docs/api.md
19+
- Update docs/architecture.md
20+
- Update docs/configuration.md
21+
- Update docs/coverage.md
22+
- Update docs/dependency-graph.md
23+
- ... and 6 more files
24+
25+
### Test
26+
- Update tests/project/dashboard.html
27+
- Update tests/project/project.yaml
28+
29+
### Other
30+
- Update code2docs/project/analysis.json
31+
- Update code2docs/project/analysis.toon
32+
- Update code2docs/project/analysis.yaml
33+
- Update code2docs/project/calls.mmd
34+
- Update code2docs/project/dashboard.html
35+
- Update code2docs/project/evolution.toon
36+
- Update code2docs/project/flow.mmd
37+
- Update code2docs/project/flow.toon
38+
- Update code2docs/project/map.toon
39+
- Update code2docs/project/project.toon
40+
- ... and 17 more files
41+
1042
## [3.0.5] - 2026-03-08
1143

1244
### Docs

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# code2docs
22

3-
![version](https://img.shields.io/badge/version-3.0.5-blue) ![python](https://img.shields.io/badge/python-%3E%3D3.9-blue) ![docs](https://img.shields.io/badge/docs-auto--generated-blueviolet)
3+
![version](https://img.shields.io/badge/version-3.0.6-blue) ![python](https://img.shields.io/badge/python-%3E%3D3.9-blue) ![docs](https://img.shields.io/badge/docs-auto--generated-blueviolet)
44

55
> Auto-generate and sync project documentation from source code analysis.
66
@@ -140,7 +140,7 @@ code2docs can update only specific sections of an existing README using markers:
140140
```markdown
141141
<!-- code2docs:start --># code2docs
142142

143-
![version](https://img.shields.io/badge/version-3.0.5-blue) ![python](https://img.shields.io/badge/python-%3E%3D3.9-blue) ![coverage](https://img.shields.io/badge/coverage-unknown-lightgrey) ![functions](https://img.shields.io/badge/functions-276-green)
143+
![version](https://img.shields.io/badge/version-3.0.6-blue) ![python](https://img.shields.io/badge/python-%3E%3D3.9-blue) ![coverage](https://img.shields.io/badge/coverage-unknown-lightgrey) ![functions](https://img.shields.io/badge/functions-276-green)
144144
> **276** functions | **57** classes | **51** files | CC̄ = 3.8
145145

146146
> Auto-generated project documentation from source code analysis.

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.0.5
1+
3.0.6

code2docs/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
README.md, API references, module docs, examples, and architecture diagrams.
66
"""
77

8-
__version__ = "3.0.5"
8+
__version__ = "3.0.6"
99
__author__ = "Tom Sapletta"
1010

1111
from .config import Code2DocsConfig

code2docs/project/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ When you run `code2llm ./ -f all`, the following files are created:
1010

1111
| File | Format | Purpose | Key Insights |
1212
|------|--------|---------|--------------|
13-
| `analysis.toon` | **TOON** | **🔥 Health diagnostics** - Complexity, god modules, coupling | 22 critical functions, 0 god modules |
13+
| `analysis.toon` | **TOON** | **🔥 Health diagnostics** - Complexity, god modules, coupling | 25 critical functions, 0 god modules |
1414
| `evolution.toon` | **TOON** | **📋 Refactoring queue** - Prioritized improvements | 0 refactoring actions needed |
1515
| `flow.toon` | **TOON** | **🔄 Data flow analysis** - Pipelines, contracts, types | Data dependencies and side effects |
1616
| `map.toon` | **TOON** | **🗺️ Structural map** - Modules, imports, signatures | Project architecture overview |
@@ -338,8 +338,8 @@ code2llm ./ -f yaml --separate-orphans
338338

339339
**Generated by**: `code2llm ./ -f all --readme`
340340
**Analysis Date**: 2026-03-08
341-
**Total Functions**: 237
342-
**Total Classes**: 54
343-
**Modules**: 39
341+
**Total Functions**: 252
342+
**Total Classes**: 56
343+
**Modules**: 40
344344

345345
For more information about code2llm, visit: https://github.com/tom-sapletta/code2llm

code2docs/project/analysis.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

code2docs/project/analysis.toon

Lines changed: 48 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
1-
# code2llm | 37f 4982L | py:37 | 2026-03-08
2-
# CC̄=4.1 | critical:22/237 | dups:0 | cycles:1
1+
# code2llm | 38f 5373L | py:38 | 2026-03-08
2+
# CC̄=4.2 | critical:25/252 | dups:0 | cycles:1
33

4-
HEALTH[9]:
4+
HEALTH[10]:
55
🟡 CC _extract_project_metadata CC=29 (limit:15)
66
🟡 CC _render_first_usage CC=15 (limit:15)
77
🟡 CC _generate_intro CC=16 (limit:15)
88
🟡 CC parse_gitignore CC=15 (limit:15)
99
🟡 CC _run_code2llm CC=17 (limit:15)
1010
🟡 CC generate CC=18 (limit:15)
1111
🟡 CC _render_module_detail CC=25 (limit:15)
12+
🟡 CC _extract_description CC=17 (limit:15)
1213
🟡 CC _render_module_section CC=25 (limit:15)
1314
🟡 CC _generate_advanced CC=22 (limit:15)
1415

1516
REFACTOR[2]:
16-
1. split 9 high-CC methods (CC>15)
17+
1. split 10 high-CC methods (CC>15)
1718
2. break 1 circular dependencies
1819

1920
COUPLING:
@@ -26,23 +27,24 @@ COUPLING:
2627
CYCLES: 1
2728

2829
LAYERS:
29-
generators/ CC̄=4.8 ←in:0 →out:1
30+
generators/ CC̄=4.9 ←in:0 →out:1
3031
│ !! readme_gen 463L 1C 18m CC=29 ←0
31-
│ !! examples_gen 399L 1C 14m CC=22 ←0
32+
│ !! examples_gen 443L 1C 15m CC=22 ←0
3233
│ ! architecture_gen 294L 1C 10m CC=13 ←0
33-
│ _registry_adapters 251L 13C 26m CC=7 ←0
34+
│ _registry_adapters 287L 14C 28m CC=7 ←0
35+
│ !! org_readme_gen 227L 1C 10m CC=17 ←0
3436
│ !! code2llm_gen 206L 1C 6m CC=17 ←0
3537
│ !! module_docs_gen 198L 1C 9m CC=25 ←0
3638
│ ! api_changelog_gen 196L 2C 9m CC=14 ←0
37-
│ !! getting_started_gen 166L 1C 8m CC=16 ←0
39+
│ !! getting_started_gen 167L 1C 8m CC=16 ←0
3840
│ !! api_reference_gen 163L 1C 7m CC=25 ←0
3941
│ depgraph_gen 140L 1C 9m CC=9 ←0
40-
│ contributing_gen 136L 1C 8m CC=8 ←0
42+
│ contributing_gen 137L 1C 8m CC=8 ←0
4143
│ ! config_docs_gen 125L 1C 4m CC=10 ←0
4244
│ changelog_gen 121L 2C 6m CC=6 ←0
45+
│ mkdocs_gen 110L 1C 5m CC=5 ←0
4346
│ ! coverage_gen 104L 1C 7m CC=12 ←0
4447
│ _source_links 76L 1C 6m CC=5 ←0
45-
│ mkdocs_gen 70L 1C 4m CC=5 ←0
4648
│ __init__ 59L 0C 1m CC=5 ←0
4749
4850
sync/ CC̄=3.6 ←in:1 →out:0
@@ -51,16 +53,16 @@ LAYERS:
5153
│ updater 51L 1C 2m CC=4 ←0
5254
│ __init__ 6L 0C 0m CC=0.0 ←0
5355
54-
analyzers/ CC̄=3.4 ←in:0 →out:0
55-
│ dependency_scanner 159L 3C 6m CC=8 ←0
56+
analyzers/ CC̄=3.5 ←in:0 →out:0
57+
│ dependency_scanner 197L 3C 7m CC=8 ←0
5658
│ docstring_extractor 140L 2C 10m CC=8 ←0
5759
│ endpoint_detector 113L 2C 3m CC=5 ←0
5860
│ project_scanner 42L 1C 4m CC=2 ←0
5961
│ __init__ 13L 0C 0m CC=0.0 ←0
6062
6163
./ CC̄=2.9 ←in:0 →out:0
62-
│ ! cli 316L 1C 14m CC=10 ←0
63-
│ ! config 296L 7C 5m CC=10 ←1
64+
│ ! cli 319L 1C 14m CC=10 ←0
65+
│ ! config 297L 7C 5m CC=10 ←1
6466
│ llm_helper 161L 1C 7m CC=7 ←0
6567
│ base 46L 2C 3m CC=1 ←0
6668
│ registry 39L 1C 4m CC=4 ←0
@@ -76,74 +78,78 @@ LAYERS:
7678

7779
DUPLICATES[0]: none
7880

79-
FUNCTIONS (CC≥10, 22 of 237):
81+
FUNCTIONS (CC≥10, 25 of 252):
8082
29.0 ReadmeGenerator._extract_project_metadata 14n 2exit loops+cond+ret !! split
8183
25.0 ModuleDocsGenerator._render_module_detail 18n 2exit loops+cond+ret !! split
8284
25.0 ApiReferenceGenerator._render_module_section 13n 2exit loops+cond+ret !! split
8385
22.0 ExamplesGenerator._generate_advanced 24n 2exit loops+cond+ret !! split
8486
18.0 ModuleDocsGenerator.generate 12n 2exit loops+cond+ret !! split
8587
17.0 Code2LlmGenerator._run_code2llm 20n 1exit cond !! split
88+
17.0 OrgReadmeGenerator._extract_description 9n 3exit loops+cond+ret !! split
8689
16.0 GettingStartedGenerator._generate_intro 6n 3exit cond+ret !! split
8790
15.0 GettingStartedGenerator._render_first_usage 7n 2exit cond+ret !! split
8891
15.0 parse_gitignore 6n 3exit cond+ret !! split
8992
14.0 ApiChangelogGenerator._render 17n 4exit loops+cond+ret
93+
13.0 ExamplesGenerator._generate_quickstart 17n 2exit loops+cond+ret
9094
13.0 ArchitectureGenerator.generate 15n 2exit loops+cond+ret
9195
12.0 ReadmeGenerator._build_context 3n 2exit ret
9296
12.0 CoverageGenerator._collect_module_stats 4n 2exit loops+ret
9397
11.0 _make_badge 21n 6exit cond+ret
9498
11.0 ApiReferenceGenerator.generate 10n 2exit loops+cond+ret
99+
11.0 ExamplesGenerator._example_from_type 18n 7exit cond+ret
95100
11.0 ArchitectureGenerator._generate_class_diagram 12n 2exit loops+cond+ret
96101
10.0 ConfigDocsGenerator._render_section 14n 2exit loops+cond+ret
97102
10.0 ApiReferenceGenerator._has_content 6n 3exit cond+ret
103+
10.0 _run_check 11n 1exit loops+cond
98104
10.0 ApiChangelogGenerator._diff_functions 9n 1exit loops+cond
99105
10.0 ApiChangelogGenerator._diff_classes 15n 1exit loops+cond
100-
10.0 _run_check 11n 1exit loops+cond
101106
10.0 Code2DocsConfig.from_yaml 20n 3exit cond+ret
102107

103108
summary:
104-
critical(≥10): 22 | high(5-10): 47 | medium(2-5): 99 | low(<2): 69
105-
9% CC≥10 29% CC≥5
109+
critical(≥10): 25 | high(5-10): 52 | medium(2-5): 105 | low(<2): 70
110+
10% CC≥10 31% CC≥5
106111

107112
HOTSPOTS:
108113
#1 _run_check fan=24 "calls 24 functions"
109114
#2 ReadmeGenerator._extract_project_metadata fan=23 "ReadmeGenerator method, fan-out=23"
110115
#3 start_watcher fan=22 "calls 22 functions"
111116
#4 ApiReferenceGenerator._render_module_section fan=21 "ApiReferenceGenerator method, fan-out=21"
112-
#5 ModuleDocsGenerator.generate fan=19 "ModuleDocsGenerator method, fan-out=19"
113-
#6 Code2DocsConfig.from_yaml fan=19 "Code2DocsConfig method, fan-out=19"
114-
#7 ReadmeGenerator._build_context fan=17 "ReadmeGenerator method, fan-out=17"
115-
#8 Updater.apply fan=16 "Updater method, fan-out=16"
116-
#9 ModuleDocsGenerator._render_module_detail fan=16 "ModuleDocsGenerator method, fan-out=16"
117-
#10 ArchitectureGenerator.generate fan=16 "ArchitectureGenerator method, fan-out=16"
117+
#5 OrgReadmeGenerator._extract_description fan=20 "OrgReadmeGenerator method, fan-out=20"
118+
#6 ModuleDocsGenerator.generate fan=19 "ModuleDocsGenerator method, fan-out=19"
119+
#7 Code2DocsConfig.from_yaml fan=19 "Code2DocsConfig method, fan-out=19"
120+
#8 ReadmeGenerator._build_context fan=17 "ReadmeGenerator method, fan-out=17"
121+
#9 Updater.apply fan=16 "Updater method, fan-out=16"
122+
#10 ModuleDocsGenerator._render_module_detail fan=16 "ModuleDocsGenerator method, fan-out=16"
118123

119124
CLASSES:
120125
ReadmeGenerator ████████████████████████ 17m CC̄=5.9 max=29 !!
121-
ExamplesGenerator ███████████████████ 14m CC̄=5.6 max=22 !!
126+
ExamplesGenerator █████████████████████ 15m CC̄=6.1 max=22 !!
122127
MarkdownFormatter ██████████████████ 13m CC̄=1.2 max=4
128+
OrgReadmeGenerator ██████████████ 10m CC̄=5.2 max=17 !!
123129
ArchitectureGenerator ██████████████ 10m CC̄=6.9 max=13
124130
DocstringExtractor ██████████████ 10m CC̄=3.5 max=8
125131
DepGraphGenerator ████████████ 9m CC̄=3.9 max=9
126132
ModuleDocsGenerator ████████████ 9m CC̄=8.0 max=25 !!
127133
ApiChangelogGenerator ████████████ 9m CC̄=5.4 max=14
128-
GettingStartedGenerator ███████████ 8m CC̄=5.8 max=16 !!
129-
ContributingGenerator ███████████ 8m CC̄=2.5 max=8
134+
GettingStartedGenerator ███████████ 8m CC̄=5.9 max=16 !!
135+
ContributingGenerator ███████████ 8m CC̄=2.6 max=8
130136
CoverageGenerator █████████ 7m CC̄=4.4 max=12
131137
ApiReferenceGenerator █████████ 7m CC̄=8.7 max=25 !!
138+
DependencyScanner █████████ 7m CC̄=4.6 max=8
132139
LLMHelper ████████ 6m CC̄=2.0 max=7
133140
Differ ████████ 6m CC̄=4.0 max=6
134141
SourceLinker ████████ 6m CC̄=3.0 max=5
135142
ChangelogGenerator ████████ 6m CC̄=3.5 max=6
136-
DependencyScanner ███████ 6m CC̄=4.5 max=8
143+
MkDocsGenerator ███████ 5m CC̄=3.2 max=5
137144
GeneratorRegistry █████ 4m CC̄=2.5 max=4
138145
ConfigDocsGenerator █████ 4m CC̄=4.2 max=10
139146
Code2LlmGenerator █████ 4m CC̄=6.2 max=17 !!
140-
MkDocsGenerator █████ 4m CC̄=2.2 max=5
141147
Code2DocsConfig █████ 4m CC̄=4.0 max=10
142148
BaseGenerator ████ 3m CC̄=1.0 max=1
143-
ProjectScanner ████ 3m CC̄=1.3 max=2
144149
EndpointDetector ████ 3m CC̄=4.0 max=5
150+
ProjectScanner ████ 3m CC̄=1.3 max=2
145151
Updater ██ 2m CC̄=3.0 max=4
146-
ReadmeGeneratorAdapter ██ 2m CC̄=2.0 max=3
152+
ReadmeGeneratorAdapter ██ 2m CC̄=2.5 max=4
147153
ApiReferenceAdapter ██ 2m CC̄=2.0 max=2
148154
ModuleDocsAdapter ██ 2m CC̄=2.0 max=2
149155
ArchitectureAdapter ██ 2m CC̄=2.0 max=2
@@ -156,6 +162,7 @@ CLASSES:
156162
ConfigDocsAdapter ██ 2m CC̄=1.5 max=2
157163
ContributingAdapter ██ 2m CC̄=1.5 max=2
158164
Code2LlmAdapter ██ 2m CC̄=4.0 max=7
165+
OrgReadmeAdapter ██ 2m CC̄=3.0 max=4
159166
ChangeInfo █ 1m CC̄=1.0 max=1
160167
DefaultGroup █ 1m CC̄=4.0 max=4
161168
LLMConfig █ 1m CC̄=1.0 max=1
@@ -167,10 +174,10 @@ CLASSES:
167174
ExamplesConfig 0m CC̄=0.0 max=0.0
168175
SyncConfig 0m CC̄=0.0 max=0.0
169176
Code2LlmConfig 0m CC̄=0.0 max=0.0
177+
Endpoint 0m CC̄=0.0 max=0.0
170178
DependencyInfo 0m CC̄=0.0 max=0.0
171179
ProjectDependencies 0m CC̄=0.0 max=0.0
172180
DocstringInfo 0m CC̄=0.0 max=0.0
173-
Endpoint 0m CC̄=0.0 max=0.0
174181

175182
D:
176183
generators/readme_gen.py:
@@ -199,6 +206,10 @@ Thi...
199206
__init__(2) CC=1.0
200207
parse_gitignore(project_path)
201208
generate_code2llm_analysis(project_path,config)
209+
generators/org_readme_gen.py:
210+
e: OrgReadmeGenerator
211+
OrgReadmeGenerator # Generate organization README with list of projects and brief...
212+
__init__(3) CC=2.0
202213
generators/getting_started_gen.py:
203214
e: GettingStartedGenerator
204215
GettingStartedGenerator # Generate docs/getting-started.md from entry points and depen...
@@ -230,7 +241,7 @@ Thi...
230241
parse_args(2) CC=4.0
231242
→ parse_args(2) CC=4.0
232243
main()
233-
generate(project_path,config_path,readme_only,sections,output,verbose,dry_run,llm_model)
244+
generate(project_path,config_path,readme_only,sections,output,verbose,dry_run,llm_model,org_name)
234245
sync(project_path,config_path,verbose,dry_run)
235246
watch(project_path,config_path,verbose)
236247
init(project_path,output)
@@ -269,6 +280,7 @@ Thi...
269280
DependencyScanner # Scan and parse project dependency files....
270281
scan(1) CC=4.0
271282
→ _parse_pyproject(1) CC=8.0
283+
→ _detect_version(2) CC=5.0
272284
→ _parse_pyproject_regex(1) CC=4.0
273285
→ _parse_dep_string(0) CC=2.0
274286
→ _parse_setup_py(1) CC=4.0
@@ -290,7 +302,7 @@ I...
290302
__init__(1) CC=1.0
291303
_get_litellm()
292304
generators/_registry_adapters.py:
293-
e: ReadmeGeneratorAdapter,ApiReferenceAdapter,ModuleDocsAdapter,ArchitectureAdapter,DepGraphAdapter,CoverageAdapter,ApiChangelogAdapter,ExamplesAdapter,MkDocsAdapter,GettingStartedAdapter,ConfigDocsAdapter,ContributingAdapter,Code2LlmAdapter
305+
e: ReadmeGeneratorAdapter,ApiReferenceAdapter,ModuleDocsAdapter,ArchitectureAdapter,DepGraphAdapter,CoverageAdapter,ApiChangelogAdapter,ExamplesAdapter,MkDocsAdapter,GettingStartedAdapter,ConfigDocsAdapter,ContributingAdapter,Code2LlmAdapter,OrgReadmeAdapter
294306
ReadmeGeneratorAdapter
295307
should_run(0) CC=1.0
296308
ApiReferenceAdapter
@@ -317,6 +329,8 @@ I...
317329
should_run(0) CC=1.0
318330
Code2LlmAdapter # Adapter for code2llm analysis generation....
319331
should_run(0) CC=1.0
332+
OrgReadmeAdapter # Adapter for organization README generation....
333+
should_run(0) CC=2.0
320334
sync/differ.py:
321335
e: ChangeInfo,Differ
322336
ChangeInfo # Describes a detected change....

0 commit comments

Comments
 (0)