11# code2docs — Architecture
22
3- > 40 modules | 255 functions | 56 classes
3+ > 55 modules | 298 functions | 60 classes
44
55## How It Works
66
@@ -38,12 +38,12 @@ Source files ──► code2llm (tree-sitter + AST) ──► AnalysisResult
3838
3939``` mermaid
4040graph TD
41- Other["Other<br/>25 modules"]
41+ Other["Other<br/>36 modules"]
4242 Analysis["Analysis<br/>5 modules"]
4343 Core["Core<br/>1 modules"]
44- API___CLI["API / CLI<br/>3 modules"]
45- Config["Config<br/>2 modules"]
46- Export___Output["Export / Output<br/>4 modules"]
44+ API___CLI["API / CLI<br/>5 modules"]
45+ Config["Config<br/>3 modules"]
46+ Export___Output["Export / Output<br/>5 modules"]
4747 Other --> Analysis
4848 Analysis --> Core
4949 Core --> API___CLI
@@ -53,61 +53,76 @@ graph TD
5353
5454### Other
5555
56- - ` __main__ `
5756- ` code2docs `
57+ - ` code2docs.__main__ `
58+ - ` code2docs.examples.advanced_usage `
59+ - ` code2docs.examples.quickstart `
60+ - ` code2docs.generators `
61+ - ` code2docs.generators._registry_adapters `
62+ - ` code2docs.generators._source_links `
63+ - ` code2docs.generators.architecture_gen `
64+ - ` code2docs.generators.changelog_gen `
65+ - ` code2docs.generators.code2llm_gen `
66+ - ` code2docs.generators.contributing_gen `
67+ - ` code2docs.generators.coverage_gen `
68+ - ` code2docs.generators.depgraph_gen `
69+ - ` code2docs.generators.examples_gen `
70+ - ` code2docs.generators.getting_started_gen `
71+ - ` code2docs.generators.mkdocs_gen `
72+ - ` code2docs.generators.module_docs_gen `
73+ - ` code2docs.generators.org_readme_gen `
74+ - ` code2docs.generators.readme_gen `
75+ - ` code2docs.llm_helper `
76+ - ` code2docs.registry `
77+ - ` code2docs.sync `
78+ - ` code2docs.sync.differ `
79+ - ` code2docs.sync.updater `
80+ - ` code2docs.sync.watcher `
81+ - ` docs.examples.advanced_usage `
82+ - ` docs.examples.quickstart `
83+ - ` examples.04_sync_and_watch `
84+ - ` examples.05_custom_generators `
85+ - ` examples.07_web_frameworks `
5886- ` examples.advanced_usage `
87+ - ` examples.basic_usage `
88+ - ` examples.class_examples `
89+ - ` examples.entry_points `
5990- ` examples.quickstart `
60- - ` generators `
61- - ` generators._registry_adapters `
62- - ` generators._source_links `
63- - ` generators.architecture_gen `
64- - ` generators.changelog_gen `
65- - ` generators.code2llm_gen `
66- - ` generators.contributing_gen `
67- - ` generators.coverage_gen `
68- - ` generators.depgraph_gen `
69- - ` generators.examples_gen `
70- - ` generators.getting_started_gen `
71- - ` generators.mkdocs_gen `
72- - ` generators.module_docs_gen `
73- - ` generators.org_readme_gen `
74- - ` generators.readme_gen `
75- - ` llm_helper `
76- - ` registry `
77- - ` sync `
78- - ` sync.differ `
79- - ` sync.updater `
80- - ` sync.watcher `
91+ - ` project `
8192
8293### Analysis
8394
84- - ` analyzers `
85- - ` analyzers.dependency_scanner `
86- - ` analyzers.docstring_extractor `
87- - ` analyzers.endpoint_detector `
88- - ` analyzers.project_scanner `
95+ - ` code2docs. analyzers`
96+ - ` code2docs. analyzers.dependency_scanner`
97+ - ` code2docs. analyzers.docstring_extractor`
98+ - ` code2docs. analyzers.endpoint_detector`
99+ - ` code2docs. analyzers.project_scanner`
89100
90101### Core
91102
92- - ` base `
103+ - ` code2docs. base`
93104
94105### API / CLI
95106
96- - ` cli `
97- - ` generators.api_changelog_gen `
98- - ` generators.api_reference_gen `
107+ - ` code2docs.cli `
108+ - ` code2docs.generators.api_changelog_gen `
109+ - ` code2docs.generators.api_reference_gen `
110+ - ` examples.01_cli_usage `
111+ - ` examples.03_programmatic_api `
99112
100113### Config
101114
102- - ` config `
103- - ` generators.config_docs_gen `
115+ - ` code2docs.config `
116+ - ` code2docs.generators.config_docs_gen `
117+ - ` examples.02_configuration `
104118
105119### Export / Output
106120
107- - ` formatters `
108- - ` formatters.badges `
109- - ` formatters.markdown `
110- - ` formatters.toc `
121+ - ` code2docs.formatters `
122+ - ` code2docs.formatters.badges `
123+ - ` code2docs.formatters.markdown `
124+ - ` code2docs.formatters.toc `
125+ - ` examples.06_formatters `
111126
112127## Module Dependency Graph
113128
@@ -250,15 +265,6 @@ classDiagram
250265 -_render_code_style(tools) None
251266 -_render_pull_request() None
252267 }
253- class LLMHelper {
254- -__init__(self, config) None
255- +llm_helper.LLMHelper.available()
256- +complete(self, prompt, system) None
257- +generate_project_description(self, project_name, modules_summary) None
258- +generate_architecture_summary(self, project_name, layers) None
259- +generate_getting_started_summary(self, project_name, cli_commands) None
260- +enhance_module_docstring(self, module_name, functions) None
261- }
262268 class CoverageGenerator {
263269 -__init__(self, config, result) None
264270 +generate(self) None
@@ -277,36 +283,70 @@ classDiagram
277283 -_get_public_methods(self, cls_info) None
278284 -_format_signature(func) None
279285 }
286+ class LLMHelper {
287+ -__init__(self, config) None
288+ +code2docs.llm_helper.LLMHelper.available()
289+ +complete(self, prompt, system) None
290+ +generate_project_description(self, project_name, modules_summary) None
291+ +generate_architecture_summary(self, project_name, layers) None
292+ +generate_getting_started_summary(self, project_name, cli_commands) None
293+ +enhance_module_docstring(self, module_name, functions) None
294+ }
280295```
281296
282297## Detected Patterns
283298
284- - ** recursion_analyze** (recursion) — confidence: 90%, functions: ` analyzers.project_scanner.ProjectScanner.analyze `
285- - ** state_machine_Differ** (state_machine) — confidence: 70%, functions: ` sync.differ.Differ.__init__ ` , ` sync.differ.Differ.detect_changes ` , ` sync.differ.Differ.save_state ` , ` sync.differ.Differ._load_state ` , ` sync.differ.Differ._compute_state `
299+ - ** recursion_analyze** (recursion) — confidence: 90%, functions: ` code2docs. analyzers.project_scanner.ProjectScanner.analyze`
300+ - ** state_machine_Differ** (state_machine) — confidence: 70%, functions: ` code2docs. sync.differ.Differ.__init__` , ` code2docs. sync.differ.Differ.detect_changes` , ` code2docs. sync.differ.Differ.save_state` , ` code2docs. sync.differ.Differ._load_state` , ` code2docs. sync.differ.Differ._compute_state`
286301
287302## Public Entry Points
288303
289- - ` formatters.toc.generate_toc ` — Generate a table of contents from Markdown headings.
290- - ` generators.readme_gen.generate_readme ` — Convenience function to generate a README.
291- - ` generators.generate_docs ` — High-level function to generate all documentation.
292- - ` generators.code2llm_gen.generate_code2llm_analysis ` — Convenience function to generate code2llm analysis.
293- - ` cli.main ` — code2docs — Auto-generate project documentation from source code.
294- - ` cli.generate ` — Generate documentation (default command).
295- - ` cli.sync ` — Synchronize documentation with source code changes.
296- - ` cli.watch ` — Watch for file changes and auto-regenerate docs.
297- - ` cli.init ` — Initialize code2docs.yaml configuration file.
298- - ` cli.check ` — Health check — verify documentation completeness.
299- - ` cli.diff ` — Preview what would change without writing anything.
300- - ` analyzers.project_scanner.analyze_and_document ` — Convenience function: analyze a project in one call.
304+ - ` code2docs.cli.main ` — code2docs — Auto-generate project documentation from source code.
305+ - ` code2docs.cli.generate ` — Generate documentation (default command).
306+ - ` code2docs.cli.sync ` — Synchronize documentation with source code changes.
307+ - ` code2docs.cli.watch ` — Watch for file changes and auto-regenerate docs.
308+ - ` code2docs.cli.init ` — Initialize code2docs.yaml configuration file.
309+ - ` code2docs.cli.check ` — Health check — verify documentation completeness.
310+ - ` code2docs.cli.diff ` — Preview what would change without writing anything.
311+ - ` code2docs.generators.generate_docs ` — High-level function to generate all documentation.
312+ - ` code2docs.generators.code2llm_gen.generate_code2llm_analysis ` — Convenience function to generate code2llm analysis.
313+ - ` code2docs.analyzers.project_scanner.analyze_and_document ` — Convenience function: analyze a project in one call.
314+ - ` examples.04_sync_and_watch.detect_changes_example ` — Detect what files have changed since last documentation generation.
315+ - ` examples.04_sync_and_watch.update_docs_incrementally ` — Update only the parts of docs that need changing.
316+ - ` examples.04_sync_and_watch.force_full_regeneration ` — Force full regeneration of all documentation.
317+ - ` examples.04_sync_and_watch.watch_and_auto_regenerate ` — Watch for file changes and auto-regenerate documentation.
318+ - ` examples.04_sync_and_watch.custom_watcher_with_hooks ` — Set up a custom watcher with pre/post generation hooks.
319+ - ` examples.04_sync_and_watch.sync_with_git_changes ` — Only regenerate docs for files changed in git.
320+ - ` examples.05_custom_generators.generate_custom_report ` — Generate a custom metrics report.
321+ - ` examples.06_formatters.markdown_formatting_examples ` — Demonstrate markdown formatting utilities.
322+ - ` examples.06_formatters.generate_complex_document ` — Generate a complex markdown document using the formatter.
323+ - ` examples.06_formatters.badge_examples ` — Generate various badge examples.
324+ - ` examples.06_formatters.toc_examples ` — Demonstrate table of contents generation.
325+ - ` examples.06_formatters.build_custom_readme ` — Build a custom README using formatters.
326+ - ` examples.03_programmatic_api.generate_readme_simple ` — Generate README.md content from a project.
327+ - ` examples.03_programmatic_api.generate_full_documentation ` — Generate complete documentation for a project.
328+ - ` examples.03_programmatic_api.custom_documentation_pipeline ` — Create a custom documentation pipeline.
329+ - ` examples.03_programmatic_api.inspect_project_structure ` — Inspect project structure from analysis.
330+ - ` examples.03_programmatic_api.generate_docs_if_needed ` — Only generate docs if code has changed.
331+ - ` examples.07_web_frameworks.detect_flask_endpoints ` — Detect Flask endpoints in a project.
332+ - ` examples.07_web_frameworks.detect_fastapi_endpoints ` — Detect FastAPI endpoints in a project.
333+ - ` examples.07_web_frameworks.create_example_web_apps ` — Create example Flask and FastAPI apps for testing.
334+ - ` examples.07_web_frameworks.document_web_project ` — Complete workflow: detect endpoints and generate docs.
335+ - ` examples.01_cli_usage.run_cli_basic ` — Run code2docs CLI programmatically.
336+ - ` examples.01_cli_usage.run_cli_with_config ` — Run with custom configuration.
337+ - ` examples.02_configuration.create_basic_config ` — Create a basic configuration.
338+ - ` examples.02_configuration.create_advanced_config ` — Create advanced configuration with all options.
339+ - ` examples.02_configuration.save_yaml_config_example ` — Save example YAML config to file.
340+ - ` examples.02_configuration.load_config_from_yaml ` — Load configuration from YAML file.
301341
302342## Metrics Summary
303343
304344| Metric | Value |
305345| --------| -------|
306- | Modules | 40 |
307- | Functions | 255 |
308- | Classes | 56 |
309- | CFG Nodes | 1606 |
346+ | Modules | 55 |
347+ | Functions | 298 |
348+ | Classes | 60 |
349+ | CFG Nodes | 1792 |
310350| Patterns | 2 |
311- | Avg Complexity | 4.4 |
312- | Analysis Time | 1.09s |
351+ | Avg Complexity | 4.1 |
352+ | Analysis Time | 4.3s |
0 commit comments