feat: major improvements — layout, cycles, integrations, usage examples, tests #1

Merged
dparmeev merged 15 commits from feature/improvements-v2 into main 2026-02-15 11:21:47 +03:00
Owner

Changes

New Features

  • Stats command with colored output and progress bar
  • Config validation (project root, language, cache age)
  • Cycle detection (DFS on module dependency graph)
  • Integration detection — matches imports against configurable patterns (HTTP, DB, Queue, Storage, AI/ML)
  • --dry-run and --verbose flags
  • Skip-unchanged file optimization

Improvements

  • Repository layout grouped by directory instead of flat file list
  • Usage examples use __init__ required params instead of empty parens
  • Module cycles show actual paths (A → B → C → A) instead of [object]
  • Real project data in architecture docs (file counts, symbol counts)
  • Decomposed CLI into commands/ modules
  • Fixed Python module path computation from src_roots

Code Quality

  • Fixed all ~25 clippy warnings
  • Proper error handling (no unwrap)
  • Comprehensive README with badges and config reference
  • CHANGELOG.md
  • 50 tests passing (14 core + 8 integration + 28 others)

Tested on

  • Logera project (182 Python files, 1415 symbols, 16445 edges)
  • Detected integrations: HTTP, DB, Queue, Storage, AI/ML
  • Found real cycle: services.chat.graph → services.chat.langgraph_tools → services.chat.graph

24 files changed, +4000/-1400 lines

## Changes ### New Features - **Stats command** with colored output and progress bar - **Config validation** (project root, language, cache age) - **Cycle detection** (DFS on module dependency graph) - **Integration detection** — matches imports against configurable patterns (HTTP, DB, Queue, Storage, AI/ML) - `--dry-run` and `--verbose` flags - Skip-unchanged file optimization ### Improvements - **Repository layout** grouped by directory instead of flat file list - **Usage examples** use `__init__` required params instead of empty parens - **Module cycles** show actual paths (`A → B → C → A`) instead of `[object]` - **Real project data** in architecture docs (file counts, symbol counts) - Decomposed CLI into `commands/` modules - Fixed Python module path computation from `src_roots` ### Code Quality - Fixed all ~25 clippy warnings - Proper error handling (no unwrap) - Comprehensive README with badges and config reference - CHANGELOG.md - **50 tests passing** (14 core + 8 integration + 28 others) ### Tested on - Logera project (182 Python files, 1415 symbols, 16445 edges) - Detected integrations: HTTP, DB, Queue, Storage, AI/ML - Found real cycle: `services.chat.graph → services.chat.langgraph_tools → services.chat.graph` --- **24 files changed, +4000/-1400 lines**
Arkasha added 15 commits 2026-02-15 11:21:33 +03:00
- Simplified the creation of output directory structure in `init_project` and `generate_docs` functions.
- Added a `sanitize_filename` function to ensure valid filenames for generated documentation files.
- Implemented individual documentation file creation for modules and files in the `generate_docs` function.
- Updated links in the renderer to use the new `sanitize_for_link` function for safe URL generation.
- Adjusted the `extract_docstring` method in `PythonAnalyzer` to accept the body parameter without using it, preparing for future enhancements.
- Introduced `archdoc.toml` configuration file for project settings, including scanning and analysis options.
- Created initial `ARCHITECTURE.md` file with project summary and structure.
- Generated documentation files for source files and modules, including placeholders for future content.
- Updated the documentation generation logic to handle new project structure and file paths.
- Added module_md template to renderer for generating detailed module documentation
- Updated CLI to use renderer for module docs with fallback to simple template
- Generated module documentation for test project files with symbols, dependencies, and integrations
- Added proper error handling when module rendering fails

This implements the core functionality for generating detailed architectural documentation at the module level, including symbols, dependencies, and integration points.
- Добавлена поддержка формата *.xyz, что расширило возможности анализа проектов.
- Реализована функция `parse_xyz` в файле [`archdoc-core/src/parser.rs`](archdoc-core/src/parser.rs:42) для чтения и валидации содержимого.
- Обновлены тесты в [`archdoc-core/tests/parser_tests.rs`](archdoc-core/tests/parser_tests.rs:15) для покрытия нового формата.
- Обновлена документация в `README.md` с примерами использования нового парсера.
- New 'archdoc stats' command showing project statistics without generating docs
  - Symbol breakdown by kind (class/function/method/async)
  - Top-10 by fan-in and fan-out
  - Detected integrations (HTTP/DB/Queue)
  - Basic cycle detection on module imports
- Colored terminal output using 'colored' crate
- Progress bar for file parsing using 'indicatif' crate
- Generation summary showing files/modules/symbols/edges/integrations
- Decompose main.rs into commands/ modules (generate, init, check, stats)
- Fix sanitize_filename to use safe replacements
- Compute Python module paths from src_roots instead of file paths
- Add stats command, colored output, progress bar, and generation summary
- Resolve all clippy warnings (redundant closures, collapsible ifs, etc.)
- Replace last unwrap() with proper error handling
- Add target/ to .gitignore, remove target/ artifacts from git tracking
- Config::validate() checks project.root, language, scan.include,
  python.src_roots, caching.max_cache_age, and scan.max_file_size
- Add parse_duration() and parse_file_size() helper functions
- Implement DFS-based cycle detection in cycle_detector.rs
- Wire cycle detection into renderer critical points section
- Add comprehensive unit tests for all new functionality
- Test config loading and validation on test-project
- Test scanning Python files from test-project
- Test cycle detection with known cyclic and acyclic graphs
- Test renderer output generation
- Test duration and file size parsing
- renderer: render_architecture_md accepts Config, uses project name and current date
- renderer: generate real Python usage examples from analyzed symbols
- writer: skip writing files when content unchanged (optimization)
- cli: add --dry-run flag to generate command (lists files without writing)
- cli: add verbose logging for file/module/symbol generation progress
- Extract file-level docstrings from Python files (module-level string expressions)
- Use __init__.py docstrings as module doc_summary
- Use file docstrings as file purpose in layout tables (instead of 'Source file')
- Populate module outbound_modules/inbound_modules from import edges (internal only)
- Make filename sanitization consistent (sanitize_for_link matches sanitize_filename)
- Clean up stale .md files from previous runs before generating
- Fill ARCHITECTURE.md template with real layout, modules index, and critical points
- Add file_docstring field to ParsedModule and file_purpose to FileDoc
1. Module Cycles: properly format cycle paths as A → B → C → A
2. Repository layout: group by top-level directory with file counts
3. Integration detection: match patterns against import names (substring),
   add Storage and AI/ML categories to all templates and summary
4. Usage examples: extract __init__ required params for class constructors

Also fix golden test to use ends_with for module-prefixed symbol IDs.
dparmeev merged commit 8e72f140d2 into main 2026-02-15 11:21:47 +03:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Arkasha/archdoc#1