diff --git a/archdoc-cli/src/main.rs b/archdoc-cli/src/main.rs index 26e414b..297b420 100644 --- a/archdoc-cli/src/main.rs +++ b/archdoc-cli/src/main.rs @@ -2,7 +2,6 @@ use clap::{Parser, Subcommand}; use anyhow::Result; use archdoc_core::{Config, ProjectModel, scanner::FileScanner, python_analyzer::PythonAnalyzer}; use std::path::Path; -use std::collections::HashSet; /// CLI interface for ArchDoc #[derive(Parser)] @@ -324,14 +323,14 @@ fn generate_docs(model: &ProjectModel, out: &str) -> Result<()> { let output_path = std::path::Path::new(".").join("ARCHITECTURE.md"); // Create individual documentation files for modules and files - for (module_id, module) in &model.modules { + for (module_id, _module) in &model.modules { let module_doc_path = modules_path.join(format!("{}.md", sanitize_filename(module_id))); let module_content = format!("# Module: {}\n\nTODO: Add module documentation\n", module_id); std::fs::write(&module_doc_path, module_content) .map_err(|e| anyhow::anyhow!("Failed to create module doc {}: {}", module_doc_path.display(), e))?; } - for (file_id, file_doc) in &model.files { + for (_file_id, file_doc) in &model.files { let file_doc_path = files_path.join(format!("{}.md", sanitize_filename(&file_doc.path))); let file_content = format!("# File: {}\n\nTODO: Add file documentation\n", file_doc.path); std::fs::write(&file_doc_path, file_content) diff --git a/archdoc-core/src/renderer.rs b/archdoc-core/src/renderer.rs index e1c25d5..a06c29c 100644 --- a/archdoc-core/src/renderer.rs +++ b/archdoc-core/src/renderer.rs @@ -249,7 +249,7 @@ impl Renderer { // Collect layout information from files let mut layout_items = Vec::new(); - for (file_id, file_doc) in &model.files { + for (_file_id, file_doc) in &model.files { layout_items.push(serde_json::json!({ "path": file_doc.path, "purpose": "Source file", diff --git a/archdoc-core/tests/golden/test_project/ARCHITECTURE.md b/archdoc-core/tests/golden/test_project/ARCHITECTURE.md new file mode 100644 index 0000000..4cd103f --- /dev/null +++ b/archdoc-core/tests/golden/test_project/ARCHITECTURE.md @@ -0,0 +1,73 @@ +# ARCHITECTURE — New Project + + +## Project summary +**Name:** New Project +**Description:** + +## Key decisions (manual) +- + +## Non-goals (manual) +- + + +--- + +## Document metadata +- **Created:** 2026-01-25 +- **Updated:** 2026-01-25 +- **Generated by:** archdoc (cli) v0.1 + +--- + +## Rails / Tooling + + +No tooling information available. + + +--- + +## Repository layout (top-level) + + +| Path | Purpose | Link | +|------|---------|------| +| ./src/advanced_example.py | Source file | [details](docs/architecture/files/._src_advanced_example.py.md) | +| ./src/example.py | Source file | [details](docs/architecture/files/._src_example.py.md) | + + +--- + +## Modules index + + +| Module | Symbols | Inbound | Outbound | Link | +|--------|---------|---------|----------|------| +| ./src/advanced_example.py | 10 | 0 | 0 | [details](docs/architecture/modules/._src_advanced_example.py.md) | +| ./src/example.py | 5 | 0 | 0 | [details](docs/architecture/modules/._src_example.py.md) | + + +--- + +## Critical dependency points + + +### High Fan-in (Most Called) +| Symbol | Fan-in | Critical | +|--------|--------|----------| + +### High Fan-out (Calls Many) +| Symbol | Fan-out | Critical | +|--------|---------|----------| + +### Module Cycles + + +--- + + +## Change notes (manual) +- + \ No newline at end of file diff --git a/archdoc-core/tests/golden/test_project/archdoc.toml b/archdoc-core/tests/golden/test_project/archdoc.toml new file mode 100644 index 0000000..63e5dee --- /dev/null +++ b/archdoc-core/tests/golden/test_project/archdoc.toml @@ -0,0 +1,62 @@ +[project] +root = "." +out_dir = "docs/architecture" +entry_file = "ARCHITECTURE.md" +language = "python" + +[scan] +include = ["src", "app", "tests"] +exclude = [ + ".venv", "venv", "__pycache__", ".git", "dist", "build", + ".mypy_cache", ".ruff_cache", ".pytest_cache", "*.egg-info" +] +follow_symlinks = false +max_file_size = "10MB" + +[python] +src_roots = ["src", "."] +include_tests = true +parse_docstrings = true +max_parse_errors = 10 + +[analysis] +resolve_calls = true +resolve_inheritance = false +detect_integrations = true +integration_patterns = [ + { type = "http", patterns = ["requests", "httpx", "aiohttp"] }, + { type = "db", patterns = ["sqlalchemy", "psycopg", "mysql", "sqlite3"] }, + { type = "queue", patterns = ["celery", "kafka", "pika", "redis"] } +] + +[output] +single_file = false +per_file_docs = true +create_directories = true +overwrite_manual_sections = false + +[diff] +update_timestamp_on_change_only = true +hash_algorithm = "sha256" +preserve_manual_content = true + +[thresholds] +critical_fan_in = 20 +critical_fan_out = 20 +high_complexity = 50 + +[rendering] +template_engine = "handlebars" +max_table_rows = 100 +truncate_long_descriptions = true +description_max_length = 200 + +[logging] +level = "info" +file = "archdoc.log" +format = "compact" + +[caching] +enabled = true +cache_dir = ".archdoc/cache" +max_cache_age = "24h" diff --git a/archdoc-core/tests/golden/test_project/docs/architecture/files/._src_advanced_example.py.md b/archdoc-core/tests/golden/test_project/docs/architecture/files/._src_advanced_example.py.md new file mode 100644 index 0000000..026ab1e --- /dev/null +++ b/archdoc-core/tests/golden/test_project/docs/architecture/files/._src_advanced_example.py.md @@ -0,0 +1,3 @@ +# File: ./src/advanced_example.py + +TODO: Add file documentation diff --git a/archdoc-core/tests/golden/test_project/docs/architecture/files/._src_example.py.md b/archdoc-core/tests/golden/test_project/docs/architecture/files/._src_example.py.md new file mode 100644 index 0000000..5c40910 --- /dev/null +++ b/archdoc-core/tests/golden/test_project/docs/architecture/files/._src_example.py.md @@ -0,0 +1,3 @@ +# File: ./src/example.py + +TODO: Add file documentation diff --git a/archdoc-core/tests/golden/test_project/docs/architecture/modules/._src_advanced_example.py.md b/archdoc-core/tests/golden/test_project/docs/architecture/modules/._src_advanced_example.py.md new file mode 100644 index 0000000..a3101b7 --- /dev/null +++ b/archdoc-core/tests/golden/test_project/docs/architecture/modules/._src_advanced_example.py.md @@ -0,0 +1,3 @@ +# Module: ./src/advanced_example.py + +TODO: Add module documentation diff --git a/archdoc-core/tests/golden/test_project/docs/architecture/modules/._src_example.py.md b/archdoc-core/tests/golden/test_project/docs/architecture/modules/._src_example.py.md new file mode 100644 index 0000000..b09a478 --- /dev/null +++ b/archdoc-core/tests/golden/test_project/docs/architecture/modules/._src_example.py.md @@ -0,0 +1,3 @@ +# Module: ./src/example.py + +TODO: Add module documentation diff --git a/test-project/ARCHITECTURE.md b/test-project/ARCHITECTURE.md new file mode 100644 index 0000000..d22ead5 --- /dev/null +++ b/test-project/ARCHITECTURE.md @@ -0,0 +1,75 @@ +# ARCHITECTURE — New Project + + +## Project summary +**Name:** New Project +**Description:** + +## Key decisions (manual) +- + +## Non-goals (manual) +- + + +--- + +## Document metadata +- **Created:** 2026-01-25 +- **Updated:** 2026-01-25 +- **Generated by:** archdoc (cli) v0.1 + +--- + +## Rails / Tooling + + +No tooling information available. + + +--- + +## Repository layout (top-level) + + +| Path | Purpose | Link | +|------|---------|------| +| ./src/core.py | Source file | [details](docs/architecture/files/._src_core.py.md) | +| ./src/__init__.py | Source file | [details](docs/architecture/files/._src___init__.py.md) | +| ./src/utils.py | Source file | [details](docs/architecture/files/._src_utils.py.md) | + + +--- + +## Modules index + + +| Module | Symbols | Inbound | Outbound | Link | +|--------|---------|---------|----------|------| +| ./src/__init__.py | 0 | 0 | 0 | [details](docs/architecture/modules/._src___init__.py.md) | +| ./src/core.py | 6 | 0 | 0 | [details](docs/architecture/modules/._src_core.py.md) | +| ./src/utils.py | 4 | 0 | 0 | [details](docs/architecture/modules/._src_utils.py.md) | + + +--- + +## Critical dependency points + + +### High Fan-in (Most Called) +| Symbol | Fan-in | Critical | +|--------|--------|----------| + +### High Fan-out (Calls Many) +| Symbol | Fan-out | Critical | +|--------|---------|----------| + +### Module Cycles + + +--- + + +## Change notes (manual) +- + \ No newline at end of file diff --git a/test-project/archdoc.toml b/test-project/archdoc.toml new file mode 100644 index 0000000..63e5dee --- /dev/null +++ b/test-project/archdoc.toml @@ -0,0 +1,62 @@ +[project] +root = "." +out_dir = "docs/architecture" +entry_file = "ARCHITECTURE.md" +language = "python" + +[scan] +include = ["src", "app", "tests"] +exclude = [ + ".venv", "venv", "__pycache__", ".git", "dist", "build", + ".mypy_cache", ".ruff_cache", ".pytest_cache", "*.egg-info" +] +follow_symlinks = false +max_file_size = "10MB" + +[python] +src_roots = ["src", "."] +include_tests = true +parse_docstrings = true +max_parse_errors = 10 + +[analysis] +resolve_calls = true +resolve_inheritance = false +detect_integrations = true +integration_patterns = [ + { type = "http", patterns = ["requests", "httpx", "aiohttp"] }, + { type = "db", patterns = ["sqlalchemy", "psycopg", "mysql", "sqlite3"] }, + { type = "queue", patterns = ["celery", "kafka", "pika", "redis"] } +] + +[output] +single_file = false +per_file_docs = true +create_directories = true +overwrite_manual_sections = false + +[diff] +update_timestamp_on_change_only = true +hash_algorithm = "sha256" +preserve_manual_content = true + +[thresholds] +critical_fan_in = 20 +critical_fan_out = 20 +high_complexity = 50 + +[rendering] +template_engine = "handlebars" +max_table_rows = 100 +truncate_long_descriptions = true +description_max_length = 200 + +[logging] +level = "info" +file = "archdoc.log" +format = "compact" + +[caching] +enabled = true +cache_dir = ".archdoc/cache" +max_cache_age = "24h" diff --git a/test-project/docs/architecture/files/._src___init__.py.md b/test-project/docs/architecture/files/._src___init__.py.md new file mode 100644 index 0000000..417238a --- /dev/null +++ b/test-project/docs/architecture/files/._src___init__.py.md @@ -0,0 +1,3 @@ +# File: ./src/__init__.py + +TODO: Add file documentation diff --git a/test-project/docs/architecture/files/._src_core.py.md b/test-project/docs/architecture/files/._src_core.py.md new file mode 100644 index 0000000..269ca20 --- /dev/null +++ b/test-project/docs/architecture/files/._src_core.py.md @@ -0,0 +1,3 @@ +# File: ./src/core.py + +TODO: Add file documentation diff --git a/test-project/docs/architecture/files/._src_utils.py.md b/test-project/docs/architecture/files/._src_utils.py.md new file mode 100644 index 0000000..cdf28c4 --- /dev/null +++ b/test-project/docs/architecture/files/._src_utils.py.md @@ -0,0 +1,3 @@ +# File: ./src/utils.py + +TODO: Add file documentation diff --git a/test-project/docs/architecture/modules/._src___init__.py.md b/test-project/docs/architecture/modules/._src___init__.py.md new file mode 100644 index 0000000..cc5f3cc --- /dev/null +++ b/test-project/docs/architecture/modules/._src___init__.py.md @@ -0,0 +1,3 @@ +# Module: ./src/__init__.py + +TODO: Add module documentation diff --git a/test-project/docs/architecture/modules/._src_core.py.md b/test-project/docs/architecture/modules/._src_core.py.md new file mode 100644 index 0000000..e2ccd5a --- /dev/null +++ b/test-project/docs/architecture/modules/._src_core.py.md @@ -0,0 +1,3 @@ +# Module: ./src/core.py + +TODO: Add module documentation diff --git a/test-project/docs/architecture/modules/._src_utils.py.md b/test-project/docs/architecture/modules/._src_utils.py.md new file mode 100644 index 0000000..b00a05d --- /dev/null +++ b/test-project/docs/architecture/modules/._src_utils.py.md @@ -0,0 +1,3 @@ +# Module: ./src/utils.py + +TODO: Add module documentation