Skip to content

Commit 49c57d7

Browse files
authored
Merge pull request #4 from BinarCode/feature/coverage_report
feat: Coverage with visual progress bars
2 parents 0ff97b3 + 44204bf commit 49c57d7

6 files changed

Lines changed: 1153 additions & 3 deletions

File tree

CLAUDE.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,22 @@ aidocs export-pdf docs/page.md
3434
# Watch mode (auto-sync on file changes)
3535
aidocs watch # Watch docs/ and auto-chunk on changes
3636
aidocs watch --with-vectors # Also generate embeddings
37+
38+
# Documentation coverage analysis
39+
aidocs coverage # Show coverage report
40+
aidocs coverage --format json # Machine-readable output
41+
aidocs coverage --ci # Exit code 1 if below 80%
3742
```
3843

3944
## Architecture
4045

4146
```
4247
src/aidocs_cli/
4348
├── __init__.py # Version and entry point
44-
├── cli.py # Typer CLI commands (init, check, serve, rag-*, export-pdf, watch)
49+
├── cli.py # Typer CLI commands (init, check, serve, rag-*, export-pdf, watch, coverage)
4550
├── installer.py # Copies templates to target project (.claude/commands/, .claude/workflows/)
4651
├── chunker.py # Splits markdown at ## headings for RAG
52+
├── coverage.py # Documentation coverage analysis (routes, components, models detection)
4753
├── embeddings.py # OpenAI embeddings + SQL generation for pgvector
4854
├── server.py # MkDocs config generation and nav discovery
4955
├── pdf_exporter.py # Markdown→HTML→PDF with Chrome/Playwright
@@ -59,6 +65,7 @@ src/aidocs_cli/
5965
- **CLI (cli.py)**: Uses Typer with Rich for terminal UI. Entry point is `app()`.
6066
- **Installer**: Copies command/workflow templates to target project's `.claude/` directory (or `.cursor/` for Cursor).
6167
- **Chunker**: Creates `.chunks.json` files alongside markdown, tracks changes via `docs/.chunks/manifest.json`.
68+
- **Coverage**: Analyzes codebase for routes/components/models, matches against docs, reports coverage with visual progress bars.
6269
- **Embeddings**: Calls OpenAI API (text-embedding-3-small, 1536 dimensions), outputs `docs/.chunks/sync.sql` for pgvector import.
6370
- **Server**: Auto-discovers nav structure from folder hierarchy, generates ephemeral `mkdocs.yml`.
6471

README.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -548,6 +548,69 @@ aidocs serve
548548
# Edit docs in your editor - changes auto-sync!
549549
```
550550

551+
### `aidocs coverage`
552+
553+
Analyze documentation coverage for your codebase. Scans for routes, components, and models, then checks which items are mentioned in your documentation.
554+
555+
```bash
556+
aidocs coverage # Show coverage summary
557+
aidocs coverage --format json # Machine-readable output
558+
aidocs coverage --format csv # CSV export
559+
aidocs coverage --ci # Exit code 1 if below 80%
560+
aidocs coverage --threshold 70 # Custom threshold
561+
aidocs coverage -c ./src # Specify codebase path
562+
aidocs coverage --all # Show all items
563+
```
564+
565+
**Options:**
566+
| Option | Description |
567+
|--------|-------------|
568+
| `--codebase, -c` | Path to codebase root (default: parent of docs dir) |
569+
| `--format, -f` | Output format: `summary`, `json`, or `csv` |
570+
| `--threshold, -t` | Minimum coverage percentage (exit 1 if below) |
571+
| `--ci` | CI mode: exit 1 if coverage below 80% |
572+
| `--save/--no-save` | Save report to `.chunks/coverage.json` (default: save) |
573+
| `--all, -a` | Show all items (documented and undocumented) |
574+
575+
**Example output:**
576+
```
577+
╭───────────────────────────────────────────────╮
578+
│ Documentation Coverage Report │
579+
│ ───────────────────────────────────────────── │
580+
│ │
581+
│ Routes: 12/15 ( 80%) █████████░░░ │
582+
│ Components: 8/20 ( 40%) ████░░░░░░░░ │
583+
│ Models: 5/5 (100%) ████████████ │
584+
│ │
585+
│ Overall: 25/40 (63%) ███████░░░░░ │
586+
╰───────────────────────────────────────────────╯
587+
588+
Missing documentation:
589+
Routes:
590+
✗ POST /api/webhooks/stripe
591+
src/app/api/webhooks/stripe/route.ts:1
592+
Components:
593+
✗ PaymentForm
594+
src/components/PaymentForm.tsx:1
595+
```
596+
597+
**Supported frameworks:**
598+
- **Next.js** - App Router routes and pages
599+
- **React** - Function and class components
600+
- **Vue/Svelte** - Single-file components
601+
- **Express** - Route handlers
602+
- **FastAPI/Flask** - Python API routes
603+
- **Laravel** - PHP routes
604+
- **Prisma** - Database models
605+
- **TypeScript** - Interfaces and types
606+
607+
**CI/CD integration:**
608+
```yaml
609+
# GitHub Actions example
610+
- name: Check documentation coverage
611+
run: aidocs coverage --ci
612+
```
613+
551614
## Slash Commands
552615
553616
After running `aidocs init`, these commands are available in Claude Code:

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "aidocs"
3-
version = "0.17.0"
3+
version = "0.18.0"
44
description = "AI-powered documentation generator for web applications. Install docs commands into your Claude Code project."
55
readme = "README.md"
66
license = { text = "MIT" }

0 commit comments

Comments
 (0)