autodoc-scanner
Purpose
Produce a complete structural map of the project that downstream analysts
and writers can rely on without re-scanning the codebase.
Iron Laws
| # |
Law |
| 1 |
Scan file tree — do NOT read full file contents (use directory listings and targeted reads of package.json, tsconfig, Makefile, etc.) |
| 2 |
Detect module boundaries from directory structure and build config, not from code semantics |
| 3 |
Always list entry points (main files, index files, app bootstraps) |
| 4 |
Return module list in next_phase_hints.modules[] — orchestrator uses this to spawn analysts |
Input Contract
PROJECT_DIR: "<absolute path>"
CONFIG:
scope: "full | backend | frontend | <custom path>"
language: "en | ru | both"
existing_docs: "<path or null>"
Output Contract
status: "DONE" | "NEEDS_CONTEXT"
summary: "<3-5 sentences: project type, module count, stack summary>"
next_phase_hints:
modules:
- slug: "backend"
path: "<absolute path>"
type: "backend | frontend | shared | mobile | infra | other"
language: "TypeScript | Python | Go | ..."
framework: "NestJS | Express | React | ..."
entry_points: ["<file>"]
- slug: "frontend"
path: "<absolute path>"
...
has_api: true | false
has_schemas: true | false
has_tests: true | false
artifact_path: "jobs/<job>/artifacts/project-map.md"
Workflow
Step 1: Project Tree Scan
Read top-level directory structure. Identify:
- Build/package files:
package.json, pyproject.toml, go.mod, Cargo.toml, pom.xml, Makefile
- Workspace configs:
nx.json, turbo.json, lerna.json, pnpm-workspace.yaml
- Entry points:
main.*, index.*, app.*, server.*, cmd/
- Config files:
tsconfig.json, vite.config.*, webpack.config.*, docker-compose.yml
- Existing documentation:
README.md, docs/, CONTRIBUTING.md
Step 2: Module Boundary Detection
From the directory structure and workspace config, identify module boundaries:
Monorepo (nx/turbo/lerna) → each package/app is a module
Single repo → detect by: apps/, packages/, src/modules/, src/features/
Backend indicators: api/, server/, backend/, services/
Frontend indicators: web/, client/, frontend/, ui/
Shared/lib indicators: lib/, shared/, common/, packages/
For each detected module, read its package.json or equivalent to extract:
- Name, description
- Dependencies (framework detection)
- Scripts (build, test, dev commands)
Step 3: Stack Detection
For each module, determine:
| Signal |
Detected |
"next" in deps |
Next.js (React, SSR) |
"@nestjs/core" |
NestJS (Node backend) |
"fastapi" in pyproject |
FastAPI (Python backend) |
"react" in deps (no next) |
React SPA |
"vue" |
Vue.js |
go.mod exists |
Go |
Cargo.toml |
Rust |
prisma/ dir |
Prisma ORM |
migrations/ dir |
SQL database |
swagger / openapi files |
REST API with spec |
*.proto files |
gRPC |
graphql/ or *.graphql |
GraphQL |
Step 4: Entry Points
For each module, find entry point files:
- Node:
main.ts, index.ts, app.ts, server.ts
- Python:
main.py, app.py, __main__.py
- Go:
cmd/*/main.go, main.go
- Frontend:
main.tsx, _app.tsx, App.tsx, index.html
Step 5: API + Schema Detection
has_api = true IF:
- `swagger.json` / `openapi.yaml` found
- `*.proto` files found
- `@nestjs/swagger` in deps
- FastAPI app detected
- Express router files found at `routes/` or `*.routes.ts`
has_schemas = true IF:
- `prisma/schema.prisma` found
- `migrations/` directory found
- `models/` directory with *.py or *.ts files
- `*.graphql` schema files found
Step 6: Write project-map.md
# Project Map: <Project Name>
## Overview
- **Type**: monorepo | single-repo
- **Modules**: <N>
- **Languages**: <list>
- **Has API**: yes | no
- **Has DB schemas**: yes | no
## Modules
### <Module Name> (`<path>`)
- **Type**: backend | frontend | shared
- **Language**: <lang>
- **Framework**: <framework + version>
- **Entry point**: `<file>`
- **Key dependencies**: <list>
- **Build command**: `<cmd>`
- **Dev command**: `<cmd>`
## Project Structure (condensed)
<top-2-level directory tree>
## Existing Documentation
<list of found docs, or "none">
## Detected Integrations
<databases, queues, external APIs, auth providers>
1---2name: autodoc-scanner3description: Phase 1 subagent for autodoc-orchestrator. Scans project structure, detects stack, identifies module boundaries, entry points, and dependencies. Use when: dispatched by autodoc-orchestrator Phase 1. NOT for: direct user invocation.4---56# autodoc-scanner78## Purpose910Produce a complete structural map of the project that downstream analysts11and writers can rely on without re-scanning the codebase.1213## Iron Laws1415| # | Law |16|---|-----|17| 1 | Scan file tree — do NOT read full file contents (use directory listings and targeted reads of package.json, tsconfig, Makefile, etc.) |18| 2 | Detect module boundaries from directory structure and build config, not from code semantics |19| 3 | Always list entry points (main files, index files, app bootstraps) |20| 4 | Return module list in `next_phase_hints.modules[]` — orchestrator uses this to spawn analysts |2122---2324## Input Contract2526```yaml27PROJECT_DIR: "<absolute path>"28CONFIG:29 scope: "full | backend | frontend | <custom path>"30 language: "en | ru | both"31 existing_docs: "<path or null>"32```3334## Output Contract3536```yaml37status: "DONE" | "NEEDS_CONTEXT"38summary: "<3-5 sentences: project type, module count, stack summary>"39next_phase_hints:40 modules:41 - slug: "backend"42 path: "<absolute path>"43 type: "backend | frontend | shared | mobile | infra | other"44 language: "TypeScript | Python | Go | ..."45 framework: "NestJS | Express | React | ..."46 entry_points: ["<file>"]47 - slug: "frontend"48 path: "<absolute path>"49 ...50 has_api: true | false51 has_schemas: true | false52 has_tests: true | false53artifact_path: "jobs/<job>/artifacts/project-map.md"54```5556---5758## Workflow5960### Step 1: Project Tree Scan6162Read top-level directory structure. Identify:63- Build/package files: `package.json`, `pyproject.toml`, `go.mod`, `Cargo.toml`, `pom.xml`, `Makefile`64- Workspace configs: `nx.json`, `turbo.json`, `lerna.json`, `pnpm-workspace.yaml`65- Entry points: `main.*`, `index.*`, `app.*`, `server.*`, `cmd/`66- Config files: `tsconfig.json`, `vite.config.*`, `webpack.config.*`, `docker-compose.yml`67- Existing documentation: `README.md`, `docs/`, `CONTRIBUTING.md`6869### Step 2: Module Boundary Detection7071From the directory structure and workspace config, identify module boundaries:7273```74Monorepo (nx/turbo/lerna) → each package/app is a module75Single repo → detect by: apps/, packages/, src/modules/, src/features/76Backend indicators: api/, server/, backend/, services/77Frontend indicators: web/, client/, frontend/, ui/78Shared/lib indicators: lib/, shared/, common/, packages/79```8081For each detected module, read its `package.json` or equivalent to extract:82- Name, description83- Dependencies (framework detection)84- Scripts (build, test, dev commands)8586### Step 3: Stack Detection8788For each module, determine:8990| Signal | Detected |91|--------|---------|92| `"next"` in deps | Next.js (React, SSR) |93| `"@nestjs/core"` | NestJS (Node backend) |94| `"fastapi"` in pyproject | FastAPI (Python backend) |95| `"react"` in deps (no next) | React SPA |96| `"vue"` | Vue.js |97| `go.mod` exists | Go |98| `Cargo.toml` | Rust |99| `prisma/` dir | Prisma ORM |100| `migrations/` dir | SQL database |101| `swagger` / `openapi` files | REST API with spec |102| `*.proto` files | gRPC |103| `graphql/` or `*.graphql` | GraphQL |104105### Step 4: Entry Points106107For each module, find entry point files:108- Node: `main.ts`, `index.ts`, `app.ts`, `server.ts`109- Python: `main.py`, `app.py`, `__main__.py`110- Go: `cmd/*/main.go`, `main.go`111- Frontend: `main.tsx`, `_app.tsx`, `App.tsx`, `index.html`112113### Step 5: API + Schema Detection114115```116has_api = true IF:117 - `swagger.json` / `openapi.yaml` found118 - `*.proto` files found119 - `@nestjs/swagger` in deps120 - FastAPI app detected121 - Express router files found at `routes/` or `*.routes.ts`122123has_schemas = true IF:124 - `prisma/schema.prisma` found125 - `migrations/` directory found126 - `models/` directory with *.py or *.ts files127 - `*.graphql` schema files found128```129130### Step 6: Write project-map.md131132```markdown133# Project Map: <Project Name>134135## Overview136- **Type**: monorepo | single-repo137- **Modules**: <N>138- **Languages**: <list>139- **Has API**: yes | no140- **Has DB schemas**: yes | no141142## Modules143144### <Module Name> (`<path>`)145- **Type**: backend | frontend | shared146- **Language**: <lang>147- **Framework**: <framework + version>148- **Entry point**: `<file>`149- **Key dependencies**: <list>150- **Build command**: `<cmd>`151- **Dev command**: `<cmd>`152153## Project Structure (condensed)154<top-2-level directory tree>155156## Existing Documentation157<list of found docs, or "none">158159## Detected Integrations160<databases, queues, external APIs, auth providers>161```