@@ -149,6 +149,240 @@ Content outside the markers is preserved when regenerating. Enable this with `sy
149149
150150## Architecture
151151
152+ ```
153+ code2docs/
154+ ├── project ├── quickstart ├── advanced_usage ├── registry ├── base├── code2docs/ ├── __main__ ├── updater ├── sync/ ├── watcher ├── differ ├── quickstart ├── advanced_usage ├── markdown ├── badges ├── toc ├── formatters/ ├── config ├── coverage_gen ├── _source_links ├── depgraph_gen ├── getting_started_gen ├── config_docs_gen ├── changelog_gen ├── generators/ ├── code2llm_gen ├── module_docs_gen ├── org_readme_gen ├── api_reference_gen ├── readme_gen ├── mkdocs_gen ├── examples_gen ├── api_changelog_gen ├── _registry_adapters ├── contributing_gen ├── architecture_gen ├── analyzers/ ├── docstring_extractor ├── endpoint_detector ├── dependency_scanner ├── cli ├── 04_sync_and_watch ├── quickstart ├── 05_custom_generators ├── 06_formatters ├── advanced_usage ├── entry_points ├── 03_programmatic_api ├── class_examples ├── basic_usage ├── 07_web_frameworks ├── 01_cli_usage ├── 02_configuration ├── project_scanner ├── llm_helper```
155+
156+ ## API Overview
157+
158+ ### Classes
159+
160+ - **`GeneratorRegistry`** — Registry of documentation generators.
161+ - **`GenerateContext`** — Shared context passed to all generators during a run.
162+ - **`BaseGenerator`** — Abstract base for all documentation generators.
163+ - **`Updater`** — Apply selective documentation updates based on detected changes.
164+ - **`ChangeInfo`** — Describes a detected change.
165+ - **`Differ`** — Detect changes between current source and previous state.
166+ - **`MarkdownFormatter`** — Helper for constructing Markdown documents.
167+ - **`ReadmeConfig`** — Configuration for README generation.
168+ - **`DocsConfig`** — Configuration for docs/ generation.
169+ - **`ExamplesConfig`** — Configuration for examples/ generation.
170+ - **`SyncConfig`** — Configuration for synchronization.
171+ - **`Code2LlmConfig`** — Configuration for code2llm analysis generation.
172+ - **`LLMConfig`** — Configuration for optional LLM-assisted documentation generation.
173+ - **`Code2DocsConfig`** — Main configuration for code2docs.
174+ - **`CoverageGenerator`** — Generate docs/coverage.md — docstring coverage report.
175+ - **`SourceLinker`** — Build source-code links (relative paths + optional GitHub/GitLab URLs).
176+ - **`DepGraphGenerator`** — Generate docs/dependency-graph.md with Mermaid diagrams.
177+ - **`GettingStartedGenerator`** — Generate docs/getting-started.md from entry points and dependencies.
178+ - **`ConfigDocsGenerator`** — Generate docs/configuration.md from Code2DocsConfig dataclass.
179+ - **`ChangelogEntry`** — A single changelog entry.
180+ - **`ChangelogGenerator`** — Generate CHANGELOG.md from git log and analysis diff.
181+ - **`Code2LlmGenerator`** — Generate code2llm analysis files in project/ directory.
182+ - **`ModuleDocsGenerator`** — Generate docs/modules.md — consolidated module documentation.
183+ - **`OrgReadmeGenerator`** — Generate organization README with list of projects and brief descriptions.
184+ - **`ApiReferenceGenerator`** — Generate docs/api.md — consolidated API reference.
185+ - **`ReadmeGenerator`** — Generate README.md from AnalysisResult.
186+ - **`MkDocsGenerator`** — Generate mkdocs.yml from the docs/ directory structure.
187+ - **`ExamplesGenerator`** — Generate examples/ — usage examples from public API signatures.
188+ - **`ApiChange`** — A single API change between two analysis snapshots.
189+ - **`ApiChangelogGenerator`** — Generate API changelog by diffing current analysis with a saved snapshot.
190+ - **`ReadmeGeneratorAdapter`** — —
191+ - **`ApiReferenceAdapter`** — —
192+ - **`ModuleDocsAdapter`** — —
193+ - **`ArchitectureAdapter`** — —
194+ - **`DepGraphAdapter`** — —
195+ - **`CoverageAdapter`** — —
196+ - **`ApiChangelogAdapter`** — —
197+ - **`ExamplesAdapter`** — —
198+ - **`MkDocsAdapter`** — —
199+ - **`GettingStartedAdapter`** — —
200+ - **`ConfigDocsAdapter`** — —
201+ - **`ContributingAdapter`** — —
202+ - **`Code2LlmAdapter`** — Adapter for code2llm analysis generation.
203+ - **`OrgReadmeAdapter`** — Adapter for organization README generation.
204+ - **`IndexHtmlAdapter`** — Adapter for generating index.html for GitHub Pages browsing.
205+ - **`ContributingGenerator`** — Generate CONTRIBUTING.md by detecting dev tools from pyproject.toml.
206+ - **`ArchitectureGenerator`** — Generate docs/architecture.md — architecture overview with diagrams.
207+ - **`DocstringInfo`** — Parsed docstring with sections.
208+ - **`DocstringExtractor`** — Extract and parse docstrings from AnalysisResult.
209+ - **`Endpoint`** — Represents a detected web endpoint.
210+ - **`EndpointDetector`** — Detects web endpoints from decorator patterns in source code.
211+ - **`DependencyInfo`** — Information about a project dependency.
212+ - **`ProjectDependencies`** — All detected project dependencies.
213+ - **`DependencyScanner`** — Scan and parse project dependency files.
214+ - **`DefaultGroup`** — Click Group that routes unknown subcommands to 'generate'.
215+ - **`MetricsReportGenerator`** — Generate a metrics report from code analysis.
216+ - **`APIChangelogGenerator`** — Generate changelog based on API changes.
217+ - **`CustomGenerator`** — Example of extending the base generator class.
218+ - **`ProjectScanner`** — Wraps code2llm's ProjectAnalyzer with code2docs-specific defaults.
219+ - **`LLMHelper`** — Thin wrapper around litellm for documentation generation.
220+
221+ ### Functions
222+
223+ - `start_watcher(project_path, config)` — Start watching project for file changes and auto-resync docs.
224+ - `generate_badges(project_name, badge_types, stats, deps)` — Generate shields.io badge Markdown strings.
225+ - `generate_toc(markdown_content, max_depth)` — Generate a table of contents from Markdown headings.
226+ - `extract_headings(content, max_depth)` — Extract headings from Markdown content.
227+ - `generate_docs(project_path, config)` — High-level function to generate all documentation.
228+ - `parse_gitignore(project_path)` — Parse .gitignore file and return list of patterns to exclude.
229+ - `generate_code2llm_analysis(project_path, config)` — Convenience function to generate code2llm analysis.
230+ - `generate_readme(project_path, output, sections, sync_markers)` — Convenience function to generate a README.
231+ - `main()` — code2docs — Auto-generate project documentation from source code.
232+ - `generate(project_path, config_path, readme_only, sections)` — Generate documentation (default command).
233+ - `sync(project_path, config_path, verbose, dry_run)` — Synchronize documentation with source code changes.
234+ - `watch(project_path, config_path, verbose)` — Watch for file changes and auto-regenerate docs.
235+ - `init(project_path, output)` — Initialize code2docs.yaml configuration file.
236+ - `check(project_path, config_path, target)` — Health check — verify documentation completeness.
237+ - `diff(project_path, config_path)` — Preview what would change without writing anything.
238+ - `detect_changes_example(project_path)` — Detect what files have changed since last documentation generation.
239+ - `update_docs_incrementally(project_path)` — Update only the parts of docs that need changing.
240+ - `force_full_regeneration(project_path)` — Force full regeneration of all documentation.
241+ - `watch_and_auto_regenerate(project_path, interval)` — Watch for file changes and auto-regenerate documentation.
242+ - `custom_watcher_with_hooks(project_path)` — Set up a custom watcher with pre/post generation hooks.
243+ - `sync_with_git_changes(project_path)` — Only regenerate docs for files changed in git.
244+ - `generate_custom_report(project_path)` — Generate a custom metrics report.
245+ - `markdown_formatting_examples()` — Demonstrate markdown formatting utilities.
246+ - `generate_complex_document()` — Generate a complex markdown document using the formatter.
247+ - `badge_examples()` — Generate various badge examples.
248+ - `toc_examples()` — Demonstrate table of contents generation.
249+ - `build_custom_readme()` — Build a custom README using formatters.
250+ - `generate_readme_simple(project_path)` — Generate README.md content from a project.
251+ - `generate_full_documentation(project_path)` — Generate complete documentation for a project.
252+ - `custom_documentation_pipeline(project_path)` — Create a custom documentation pipeline.
253+ - `inspect_project_structure(project_path)` — Inspect project structure from analysis.
254+ - `generate_docs_if_needed(project_path, force)` — Only generate docs if code has changed.
255+ - `detect_flask_endpoints(project_path)` — Detect Flask endpoints in a project.
256+ - `detect_fastapi_endpoints(project_path)` — Detect FastAPI endpoints in a project.
257+ - `generate_api_docs_from_endpoints(project_path, output_dir)` — Generate API documentation from detected endpoints.
258+ - `create_example_web_apps(target_dir)` — Create example Flask and FastAPI apps for testing.
259+ - `document_web_project(project_path)` — Complete workflow: detect endpoints and generate docs.
260+ - `run_cli_basic(project_path)` — Run code2docs CLI programmatically.
261+ - `run_cli_with_config(project_path, config_path)` — Run with custom configuration.
262+ - `create_basic_config()` — Create a basic configuration.
263+ - `create_advanced_config()` — Create advanced configuration with all options.
264+ - `save_yaml_config_example(path)` — Save example YAML config to file.
265+ - `load_config_from_yaml(path)` — Load configuration from YAML file.
266+ - `analyze_and_document(project_path, config)` — Convenience function: analyze a project in one call.
267+
268+
269+ ## Project Structure
270+
271+ 📦 `code2docs` (1 functions)
272+ 📄 `code2docs.__main__`
273+ 📦 `code2docs.analyzers`
274+ 📄 `code2docs.analyzers.dependency_scanner` (10 functions, 3 classes)
275+ 📄 `code2docs.analyzers.docstring_extractor` (10 functions, 2 classes)
276+ 📄 `code2docs.analyzers.endpoint_detector` (3 functions, 2 classes)
277+ 📄 `code2docs.analyzers.project_scanner` (4 functions, 1 classes)
278+ 📄 `code2docs.base` (3 functions, 2 classes)
279+ 📄 `code2docs.cli` (14 functions, 1 classes)
280+ 📄 `code2docs.config` (5 functions, 7 classes)
281+ 📄 `code2docs.examples.advanced_usage`
282+ 📄 `code2docs.examples.quickstart`
283+ 📦 `code2docs.formatters`
284+ 📄 `code2docs.formatters.badges` (2 functions)
285+ 📄 `code2docs.formatters.markdown` (13 functions, 1 classes)
286+ 📄 `code2docs.formatters.toc` (3 functions)
287+ 📦 `code2docs.generators` (1 functions)
288+ 📄 `code2docs.generators._registry_adapters` (31 functions, 15 classes)
289+ 📄 `code2docs.generators._source_links` (6 functions, 1 classes)
290+ 📄 `code2docs.generators.api_changelog_gen` (9 functions, 2 classes)
291+ 📄 `code2docs.generators.api_reference_gen` (7 functions, 1 classes)
292+ 📄 `code2docs.generators.architecture_gen` (10 functions, 1 classes)
293+ 📄 `code2docs.generators.changelog_gen` (6 functions, 2 classes)
294+ 📄 `code2docs.generators.code2llm_gen` (6 functions, 1 classes)
295+ 📄 `code2docs.generators.config_docs_gen` (4 functions, 1 classes)
296+ 📄 `code2docs.generators.contributing_gen` (8 functions, 1 classes)
297+ 📄 `code2docs.generators.coverage_gen` (7 functions, 1 classes)
298+ 📄 `code2docs.generators.depgraph_gen` (9 functions, 1 classes)
299+ 📄 `code2docs.generators.examples_gen` (15 functions, 1 classes)
300+ 📄 `code2docs.generators.getting_started_gen` (8 functions, 1 classes)
301+ 📄 `code2docs.generators.mkdocs_gen` (5 functions, 1 classes)
302+ 📄 `code2docs.generators.module_docs_gen` (9 functions, 1 classes)
303+ 📄 `code2docs.generators.org_readme_gen` (10 functions, 1 classes)
304+ 📄 `code2docs.generators.readme_gen` (18 functions, 1 classes)
305+ 📄 `code2docs.llm_helper` (7 functions, 1 classes)
306+ 📄 `code2docs.registry` (4 functions, 1 classes)
307+ 📦 `code2docs.sync`
308+ 📄 `code2docs.sync.differ` (7 functions, 2 classes)
309+ 📄 `code2docs.sync.updater` (2 functions, 1 classes)
310+ 📄 `code2docs.sync.watcher` (1 functions)
311+ 📄 `docs.examples.advanced_usage`
312+ 📄 `docs.examples.quickstart`
313+ 📄 `examples.01_cli_usage` (2 functions)
314+ 📄 `examples.02_configuration` (4 functions)
315+ 📄 `examples.03_programmatic_api` (5 functions)
316+ 📄 `examples.04_sync_and_watch` (6 functions)
317+ 📄 `examples.05_custom_generators` (13 functions, 3 classes)
318+ 📄 `examples.06_formatters` (5 functions)
319+ 📄 `examples.07_web_frameworks` (5 functions)
320+ 📄 `examples.advanced_usage`
321+ 📄 `examples.basic_usage`
322+ 📄 `examples.class_examples`
323+ 📄 `examples.entry_points`
324+ 📄 `examples.quickstart`
325+ 📄 `project`
326+
327+ ## Requirements
328+
329+ - Python >= >=3.9
330+ - code2llm >=0.5.0- jinja2 >=3.1- click >=8.0- pyyaml >=6.0- rich >=13.0
331+
332+ ## Contributing
333+
334+ **Contributors:**
335+ - Tom Softreck <tom@sapletta.com>
336+ - Tom Sapletta <tom-sapletta-com@users.noreply.github.com>
337+
338+ We welcome contributions! Please see [CONTRIBUTING.md](./CONTRIBUTING.md) for guidelines.
339+
340+ ### Development Setup
341+
342+ ```bash
343+ # Clone the repository
344+ git clone https://github.com/wronai/code2docs
345+ cd code2docs
346+
347+ # Install in development mode
348+ pip install -e ".[dev]"
349+
350+ # Run tests
351+ pytest
352+ ```
353+
354+ ## Documentation
355+
356+ - 📖 [ Full Documentation] ( https://github.com/wronai/code2docs/tree/main/docs ) — API reference, module docs, architecture
357+ - 🚀 [ Getting Started] ( https://github.com/wronai/code2docs/blob/main/docs/getting-started.md ) — Quick start guide
358+ - 📚 [ API Reference] ( https://github.com/wronai/code2docs/blob/main/docs/api.md ) — Complete API documentation
359+ - 🔧 [ Configuration] ( https://github.com/wronai/code2docs/blob/main/docs/configuration.md ) — Configuration options
360+ - 💡 [ Examples] ( ./examples ) — Usage examples and code samples
361+
362+ ### Generated Files
363+
364+ | Output | Description | Link |
365+ | --------| -------------| ------|
366+ | ` README.md ` | Project overview (this file) | — |
367+ | ` docs/api.md ` | Consolidated API reference | [ View] ( ./docs/api.md ) |
368+ | ` docs/modules.md ` | Module reference with metrics | [ View] ( ./docs/modules.md ) |
369+ | ` docs/architecture.md ` | Architecture with diagrams | [ View] ( ./docs/architecture.md ) |
370+ | ` docs/dependency-graph.md ` | Dependency graphs | [ View] ( ./docs/dependency-graph.md ) |
371+ | ` docs/coverage.md ` | Docstring coverage report | [ View] ( ./docs/coverage.md ) |
372+ | ` docs/getting-started.md ` | Getting started guide | [ View] ( ./docs/getting-started.md ) |
373+ | ` docs/configuration.md ` | Configuration reference | [ View] ( ./docs/configuration.md ) |
374+ | ` docs/api-changelog.md ` | API change tracking | [ View] ( ./docs/api-changelog.md ) |
375+ | ` CONTRIBUTING.md ` | Contribution guidelines | [ View] ( ./CONTRIBUTING.md ) |
376+ | ` examples/ ` | Usage examples | [ Browse] ( ./examples ) |
377+ | ` mkdocs.yml ` | MkDocs configuration | — |
378+
379+ <!-- code2docs:end -->
380+ ```
381+
382+ Content outside the markers is preserved when regenerating. Enable this with `sync_markers: true` in your configuration.
383+
384+ ## Architecture
385+
152386```
153387code2docs/
154388├── project ├── quickstart ├── advanced_usage ├── registry ├── base├── code2docs/ ├── __main__ ├── updater ├── sync/ ├── watcher ├── differ ├── quickstart ├── advanced_usage ├── markdown ├── badges ├── toc ├── formatters/ ├── readme_gen ├── coverage_gen ├── _source_links ├── depgraph_gen ├── getting_started_gen ├── cli ├── config_docs_gen ├── generators/ ├── code2llm_gen ├── module_docs_gen ├── changelog_gen ├── org_readme_gen ├── api_reference_gen ├── mkdocs_gen ├── config ├── examples_gen ├── api_changelog_gen ├── architecture_gen ├── contributing_gen ├── analyzers/ ├── _registry_adapters ├── docstring_extractor ├── project_scanner ├── 04_sync_and_watch ├── 05_custom_generators ├── quickstart ├── 06_formatters ├── advanced_usage ├── 03_programmatic_api ├── entry_points ├── 07_web_frameworks ├── class_examples ├── basic_usage ├── 01_cli_usage ├── 02_configuration ├── dependency_scanner ├── endpoint_detector ├── llm_helper```
0 commit comments