This project is an offline, local-first AI-powered documentation generator that scans your codebase, analyzes its structure, and produces high-quality documentation describing the architecture, technologies, and flow of the project — without sending your code to any external servers.
It’s designed for developers who need instant, private insights into their repositories and want to avoid the overhead of manual documentation.
- Offline & Private – Runs entirely on your local machine. No external API calls unless you explicitly integrate one.
- Intelligent File Discovery – Recursively scans your project directory while respecting
.gitignorerules. - Multi-language Parsing – Uses Python’s
astmodule, Tree-sitter, and custom parsers for accurate code structure extraction. - Detailed Code Structure Analysis – Extracts:
- Functions, classes, and methods
- Parameters and decorators
- Imports and dependencies
- Cyclomatic complexity estimates
- Docstring Coverage Metrics – Identifies undocumented code sections.
- Concurrent File Processing – Reads and analyzes multiple files in parallel for speed.
- JSON Output + Caching – Deterministic, machine-parsable results with caching to avoid reprocessing unchanged files.
- Documentation Generation – Summarizes architecture, technologies, and data flow into a formatted Markdown or text report.
-
Directory Scan
The agent traverses the provided project path, filtering files based on.gitignoreand supported extensions. -
File Analysis
Each file is:- Read with safe encoding fallbacks
- Parsed using AST or Tree-sitter
- Analyzed for functions, classes, methods, imports, and complexity
-
Data Aggregation
Extracted information is stored in structured JSON format, enabling further automated processing. -
Documentation Generation
An AI model processes the aggregated data to produce:- A high-level overview of the project
- Technology stack details
- Execution flow and architecture notes
-
Output Formatting
Documentation is saved indocs/as Markdown for easy viewing, editing, or publishing.
- Summary of the codebase
- Breakdown of modules and files
- Key classes, functions, and their roles
- Flow of execution and data
- Detected technologies and libraries
- All analysis is performed locally.
- No files or code leave your machine.
- Optional LLM integration can be configured to use a local model (e.g., ollama, llama.cpp, GPT4All).
flowchart TD
A[Start] --> B[Directory Scan]
B --> C[Filter files via .gitignore & extensions]
C --> D[Read files with encoding fallbacks]
D --> E[Parse files with AST / Tree-sitter]
E --> F[Extract code elements: classes, functions, imports, complexity]
F --> G[Aggregate extracted metadata into structured JSON]
G --> H[Generate project documentation using AI model]
H --> I[Format & Save as Markdown in docs/]
I --> J[End]
python main.py /path/to/your/codebase