Quickstart
1. Analyze a file
Check docstring coverage on a single file:
$ legacy-doc-ai analyze src/legacy/processor.py
┌─────────────────────────────────────┐
│ File Analysis Report │
├─────────────────────────────────────┤
│ File: src/legacy/processor.py │
│ Functions found: 12 │
│ With docstrings: 5 (42%) │
│ Stale docs: 3 (25%) │
│ Missing: 4 (33%) │
└─────────────────────────────────────┘
2. Generate docs for a folder
Generate docstrings for all undocumented functions in a directory:
$ legacy-doc-ai docstrings src/legacy/ --dry-run
--- a/src/legacy/processor.py
+++ b/src/legacy/processor.py
-def validate_input(data, schema=None):
+def validate_input(data, schema=None):
+ \"\"\"Validate input data against optional schema.
+
+ Args:
+ data: Dict of input values to validate.
+ schema: Optional validation schema dict.
+
+ Returns:
+ tuple[bool, list[str]]: Valid flag and error messages.
+ \"\"\"
3. Output format options
Generate documentation in different formats:
$ legacy-doc-ai docstrings src/ --format rst --output docs/
✓ Generated: docs/api.md
✓ Generated: docs/classes.md
✓ Generated: docs/functions.md
3 files written, 147 new docstrings generated
Configuration
Set your LLM provider via environment variable:
$ export OPENAI_API_KEY=sk-...
Supported providers: OpenAI, Anthropic, or any OpenAI-compatible endpoint.