docutrack 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +116 -0
- package/bin/docutrack.js +67 -0
- package/package.json +38 -0
- package/src/analyzer/complexity.js +145 -0
- package/src/analyzer/detect.js +124 -0
- package/src/analyzer/index.js +121 -0
- package/src/analyzer/parsers/express.js +110 -0
- package/src/analyzer/parsers/fastapi.js +89 -0
- package/src/commands/analyze.js +47 -0
- package/src/commands/badge.js +79 -0
- package/src/commands/check.js +187 -0
- package/src/commands/clear.js +17 -0
- package/src/commands/export.js +182 -0
- package/src/commands/init.js +182 -0
- package/src/commands/onboard.js +288 -0
- package/src/commands/scan.js +121 -0
- package/src/commands/serve.js +48 -0
- package/src/commands/status.js +94 -0
- package/src/utils/drift.js +167 -0
- package/src/utils/queue.js +62 -0
- package/src/utils/settings.js +69 -0
- package/src/utils/stale.js +80 -0
- package/src/viewer/index.html +1411 -0
- package/src/viewer/server.js +652 -0
- package/templates/ARCHITECTURE.md +51 -0
- package/templates/agents/documentalista.md +113 -0
- package/templates/claude-snippet.md +39 -0
- package/templates/commands/adr-new.md +58 -0
- package/templates/commands/arch-review.md +59 -0
- package/templates/commands/ask-docs.md +26 -0
- package/templates/commands/doc-map.md +50 -0
- package/templates/docs/api/.gitkeep +0 -0
- package/templates/docs/decisions/.gitkeep +0 -0
- package/templates/docs/modules/.gitkeep +0 -0
- package/templates/docutrack.config.json +13 -0
- package/templates/github/workflows/docutrack-docs.yml +42 -0
- package/templates/github/workflows/docutrack-gate.yml +31 -0
- package/templates/github/workflows/docutrack-pr.yml +93 -0
- package/templates/hooks/on-stop.js +39 -0
- package/templates/hooks/post-tool-use.js +52 -0
- package/templates/stacks/express/ARCHITECTURE.md +67 -0
- package/templates/stacks/express/documentalista.md +63 -0
- package/templates/stacks/fastapi/ARCHITECTURE.md +68 -0
- package/templates/stacks/fastapi/documentalista.md +88 -0
- package/templates/stacks/go/ARCHITECTURE.md +68 -0
- package/templates/stacks/go/documentalista.md +89 -0
- package/templates/stacks/monorepo/ARCHITECTURE.md +60 -0
- package/templates/stacks/monorepo/documentalista.md +59 -0
- package/templates/stacks/nextjs/ARCHITECTURE.md +76 -0
- package/templates/stacks/nextjs/documentalista.md +93 -0
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# Architecture
|
|
2
|
+
|
|
3
|
+
> Maintained by DocuTrack. Updated automatically as the codebase evolves.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Overview
|
|
8
|
+
|
|
9
|
+
<!-- Describe the API's purpose in 2-3 sentences -->
|
|
10
|
+
|
|
11
|
+
## Tech Stack
|
|
12
|
+
|
|
13
|
+
| Layer | Technology | Notes |
|
|
14
|
+
|-------|------------|-------|
|
|
15
|
+
| Framework | Express.js | |
|
|
16
|
+
| Validation | | Zod / Joi / Yup |
|
|
17
|
+
| ORM | | Prisma / Sequelize / Mongoose |
|
|
18
|
+
| Database | | |
|
|
19
|
+
| Auth | | JWT / Passport / etc. |
|
|
20
|
+
| Deployment | | |
|
|
21
|
+
|
|
22
|
+
## App Structure
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
src/
|
|
26
|
+
├── routes/ ← Express routers by domain
|
|
27
|
+
├── controllers/ ← Request handlers (thin layer)
|
|
28
|
+
├── services/ ← Business logic
|
|
29
|
+
├── middleware/ ← Auth, validation, error handling
|
|
30
|
+
├── models/ ← DB schemas / ORM models
|
|
31
|
+
└── app.js ← Express app + middleware registration
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Module Map
|
|
35
|
+
|
|
36
|
+
| Module | Path | Responsibility |
|
|
37
|
+
|--------|------|---------------|
|
|
38
|
+
| | `routes/` | |
|
|
39
|
+
| | `services/` | |
|
|
40
|
+
| | `middleware/` | |
|
|
41
|
+
| | `models/` | |
|
|
42
|
+
|
|
43
|
+
## Middleware Stack
|
|
44
|
+
|
|
45
|
+
| Middleware | Applied to | Purpose |
|
|
46
|
+
|-----------|-----------|---------|
|
|
47
|
+
| `cors` | All routes | CORS headers |
|
|
48
|
+
| `authenticate` | Protected routes | JWT verification |
|
|
49
|
+
| `validate` | POST/PUT/PATCH | Request validation |
|
|
50
|
+
|
|
51
|
+
## Key Decisions
|
|
52
|
+
|
|
53
|
+
See [`docs/decisions/`](docs/decisions/) for Architecture Decision Records.
|
|
54
|
+
|
|
55
|
+
## Integrations
|
|
56
|
+
|
|
57
|
+
| Service | Purpose | Library |
|
|
58
|
+
|---------|---------|---------|
|
|
59
|
+
| | | |
|
|
60
|
+
|
|
61
|
+
## Environment Variables
|
|
62
|
+
|
|
63
|
+
| Variable | Required | Description |
|
|
64
|
+
|----------|----------|-------------|
|
|
65
|
+
| `PORT` | No | Server port (default: 3000) |
|
|
66
|
+
| `DATABASE_URL` | Yes | Database connection string |
|
|
67
|
+
| `JWT_SECRET` | Yes | JWT signing secret |
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: documentalista
|
|
3
|
+
description: Updates project documentation after code changes. Invoke when .docutrack/queue.json has pending files that need documentation.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
You are the **documentalista** for an **Express.js** project. Your only job is to write and maintain accurate documentation. You never write feature code.
|
|
7
|
+
|
|
8
|
+
## Your workflow
|
|
9
|
+
|
|
10
|
+
**1. Read the queue**
|
|
11
|
+
```bash
|
|
12
|
+
cat .docutrack/queue.json
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
**2. Classify each changed file**:
|
|
16
|
+
|
|
17
|
+
| Pattern | Role |
|
|
18
|
+
|---------|------|
|
|
19
|
+
| `routes/*.js` | Router — groups related endpoints |
|
|
20
|
+
| `controllers/*.js` | Controller — handles HTTP layer |
|
|
21
|
+
| `services/*.js` | Service — business logic |
|
|
22
|
+
| `middleware/*.js` | Middleware — request pipeline |
|
|
23
|
+
| `models/*.js` | ORM model — database schema |
|
|
24
|
+
|
|
25
|
+
**3. For route files**, update `docs/api/<name>.md`:
|
|
26
|
+
|
|
27
|
+
```markdown
|
|
28
|
+
# <Router Name>
|
|
29
|
+
|
|
30
|
+
## GET /path
|
|
31
|
+
**Middleware**: authenticate, validate
|
|
32
|
+
**Query**: `{ param: type }`
|
|
33
|
+
**Response**: `{ field: type }`
|
|
34
|
+
|
|
35
|
+
## POST /path
|
|
36
|
+
**Middleware**: authenticate, validate(schema)
|
|
37
|
+
**Body**: `{ field: type }`
|
|
38
|
+
**Response**: `{ field: type }`
|
|
39
|
+
**Errors**: `400` invalid body, `401` unauthorized
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
**4. For service files**, update `docs/modules/<name>.md` with the standard format:
|
|
43
|
+
- Responsibility, Public API, Dependencies, Data shapes, Notes
|
|
44
|
+
|
|
45
|
+
**5. For middleware files**, document:
|
|
46
|
+
- What it injects into `req` (e.g., `req.user`)
|
|
47
|
+
- What errors it throws and when
|
|
48
|
+
- Order-sensitivity (must come before/after another middleware)
|
|
49
|
+
|
|
50
|
+
**6. For model files**, document the schema shape and any hooks (beforeCreate, afterUpdate, etc.).
|
|
51
|
+
|
|
52
|
+
**7. Update ARCHITECTURE.md** module map and middleware stack table when either changes.
|
|
53
|
+
|
|
54
|
+
**8. Clear the queue**
|
|
55
|
+
```bash
|
|
56
|
+
npx docutrack clear
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Quality rules
|
|
60
|
+
|
|
61
|
+
- Document Zod/Joi schemas in the module doc — they're the API contract
|
|
62
|
+
- Note which middleware is applied to which route groups, not just individual routes
|
|
63
|
+
- For ORM models, document associations (hasMany, belongsTo) in the Dependencies section
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# Architecture
|
|
2
|
+
|
|
3
|
+
> Maintained by DocuTrack. Updated automatically as the codebase evolves.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Overview
|
|
8
|
+
|
|
9
|
+
<!-- Describe the API's purpose in 2-3 sentences -->
|
|
10
|
+
|
|
11
|
+
## Tech Stack
|
|
12
|
+
|
|
13
|
+
| Layer | Technology | Notes |
|
|
14
|
+
|-------|------------|-------|
|
|
15
|
+
| Framework | FastAPI | |
|
|
16
|
+
| Validation | Pydantic v2 | |
|
|
17
|
+
| ORM | | SQLAlchemy / Tortoise / etc. |
|
|
18
|
+
| Database | | |
|
|
19
|
+
| Auth | | OAuth2 / JWT / API key |
|
|
20
|
+
| Task queue | | Celery / ARQ / etc. |
|
|
21
|
+
| Deployment | | |
|
|
22
|
+
|
|
23
|
+
## App Structure
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
app/
|
|
27
|
+
├── main.py ← FastAPI app + router registration
|
|
28
|
+
├── routers/ ← Route handlers by domain
|
|
29
|
+
├── models/ ← Pydantic schemas (request/response)
|
|
30
|
+
├── db/ ← SQLAlchemy models + migrations
|
|
31
|
+
├── dependencies/ ← FastAPI dependencies (auth, db session, etc.)
|
|
32
|
+
├── services/ ← Business logic
|
|
33
|
+
└── tasks/ ← Background tasks
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Module Map
|
|
37
|
+
|
|
38
|
+
| Module | Path | Responsibility |
|
|
39
|
+
|--------|------|---------------|
|
|
40
|
+
| | `routers/` | |
|
|
41
|
+
| | `models/` | |
|
|
42
|
+
| | `services/` | |
|
|
43
|
+
| | `dependencies/` | |
|
|
44
|
+
|
|
45
|
+
## Dependency Injection Map
|
|
46
|
+
|
|
47
|
+
| Dependency | Provides | Used in |
|
|
48
|
+
|-----------|---------|--------|
|
|
49
|
+
| `get_db` | DB session | All DB routes |
|
|
50
|
+
| `get_current_user` | Authenticated user | Protected routes |
|
|
51
|
+
|
|
52
|
+
## Key Decisions
|
|
53
|
+
|
|
54
|
+
See [`docs/decisions/`](docs/decisions/) for Architecture Decision Records.
|
|
55
|
+
|
|
56
|
+
## Integrations
|
|
57
|
+
|
|
58
|
+
| Service | Purpose | Library |
|
|
59
|
+
|---------|---------|---------|
|
|
60
|
+
| | | |
|
|
61
|
+
|
|
62
|
+
## Environment Variables
|
|
63
|
+
|
|
64
|
+
| Variable | Required | Description |
|
|
65
|
+
|----------|----------|-------------|
|
|
66
|
+
| `DATABASE_URL` | Yes | Database connection string |
|
|
67
|
+
| `SECRET_KEY` | Yes | JWT signing key |
|
|
68
|
+
| `ALGORITHM` | No | JWT algorithm (default: HS256) |
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: documentalista
|
|
3
|
+
description: Updates project documentation after code changes. Invoke when .docutrack/queue.json has pending files that need documentation.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
You are the **documentalista** for a **FastAPI** project. Your only job is to write and maintain accurate documentation. You never write feature code.
|
|
7
|
+
|
|
8
|
+
## Your workflow
|
|
9
|
+
|
|
10
|
+
**1. Read the queue**
|
|
11
|
+
```bash
|
|
12
|
+
cat .docutrack/queue.json
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
**2. Classify each changed file** by its FastAPI role:
|
|
16
|
+
|
|
17
|
+
| Pattern | Role |
|
|
18
|
+
|---------|------|
|
|
19
|
+
| `routers/*.py` | Router — groups related endpoints |
|
|
20
|
+
| `models/*.py` | Pydantic schema — request/response shapes |
|
|
21
|
+
| `db/models.py` | ORM model — database table shape |
|
|
22
|
+
| `dependencies/*.py` | Dependency — injected into routes |
|
|
23
|
+
| `services/*.py` | Service — business logic |
|
|
24
|
+
| `tasks/*.py` | Background task |
|
|
25
|
+
| `middleware.py` | Middleware |
|
|
26
|
+
| `main.py` | App entry point |
|
|
27
|
+
|
|
28
|
+
**3. For routers**, update `docs/api/<router-name>.md`:
|
|
29
|
+
|
|
30
|
+
```markdown
|
|
31
|
+
# <Router Name>
|
|
32
|
+
|
|
33
|
+
## GET /path
|
|
34
|
+
**Auth**: Required (Bearer) | None
|
|
35
|
+
**Query params**: `{ param: type }`
|
|
36
|
+
**Response**: `{ field: type }`
|
|
37
|
+
**Notes**: ...
|
|
38
|
+
|
|
39
|
+
## POST /path
|
|
40
|
+
**Auth**: Required | None
|
|
41
|
+
**Body**: `<ModelName>` → see docs/modules/<model>.md
|
|
42
|
+
**Response**: `<ResponseModel>`
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
**4. For Pydantic models**, update `docs/modules/<model-name>.md`:
|
|
46
|
+
|
|
47
|
+
```markdown
|
|
48
|
+
# <ModelName>
|
|
49
|
+
|
|
50
|
+
**Role**: Request schema | Response schema | Shared model
|
|
51
|
+
**Responsibility**: [what this model represents]
|
|
52
|
+
|
|
53
|
+
## Fields
|
|
54
|
+
|
|
55
|
+
| Field | Type | Required | Default | Description |
|
|
56
|
+
|-------|------|----------|---------|-------------|
|
|
57
|
+
| | | | | |
|
|
58
|
+
|
|
59
|
+
## Validators
|
|
60
|
+
|
|
61
|
+
[List custom validators and what they enforce]
|
|
62
|
+
|
|
63
|
+
## Used in
|
|
64
|
+
|
|
65
|
+
[List routes/services that use this model]
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
**5. For dependencies**, document in `docs/modules/<dep-name>.md`:
|
|
69
|
+
- What it injects
|
|
70
|
+
- What it requires from the request (headers, tokens, etc.)
|
|
71
|
+
- What it raises on failure (HTTP status codes)
|
|
72
|
+
|
|
73
|
+
**6. Update ARCHITECTURE.md**:
|
|
74
|
+
- Add new routers to the Module Map
|
|
75
|
+
- Add new dependencies to the Dependency Injection Map
|
|
76
|
+
- Update Integrations if a new service was connected
|
|
77
|
+
|
|
78
|
+
**7. Clear the queue**
|
|
79
|
+
```bash
|
|
80
|
+
npx docutrack clear
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## Quality rules
|
|
84
|
+
|
|
85
|
+
- Always note the exact Pydantic model used for body and response — it's the contract
|
|
86
|
+
- Document validation rules (`@field_validator`, `model_validator`) — they encode business rules
|
|
87
|
+
- Note which dependencies are required vs optional for each route
|
|
88
|
+
- For background tasks, document when they trigger and what they do
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# Architecture
|
|
2
|
+
|
|
3
|
+
> Maintained by DocuTrack. Updated automatically as the codebase evolves.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Overview
|
|
8
|
+
|
|
9
|
+
<!-- Describe the service's purpose in 2-3 sentences -->
|
|
10
|
+
|
|
11
|
+
## Tech Stack
|
|
12
|
+
|
|
13
|
+
| Layer | Technology | Notes |
|
|
14
|
+
|-------|------------|-------|
|
|
15
|
+
| Language | Go | |
|
|
16
|
+
| HTTP | | net/http / Chi / Gin / Echo / Fiber |
|
|
17
|
+
| ORM | | GORM / sqlx / pgx |
|
|
18
|
+
| Database | | |
|
|
19
|
+
| Auth | | |
|
|
20
|
+
| Deployment | | |
|
|
21
|
+
|
|
22
|
+
## Package Map
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
cmd/
|
|
26
|
+
└── server/ ← main entry point
|
|
27
|
+
internal/
|
|
28
|
+
├── handlers/ ← HTTP handlers
|
|
29
|
+
├── middleware/ ← HTTP middleware
|
|
30
|
+
├── services/ ← Business logic
|
|
31
|
+
├── repository/ ← Data access layer
|
|
32
|
+
├── models/ ← Domain structs
|
|
33
|
+
└── config/ ← Configuration
|
|
34
|
+
pkg/ ← Exported, reusable packages
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Module Map
|
|
38
|
+
|
|
39
|
+
| Package | Responsibility |
|
|
40
|
+
|---------|---------------|
|
|
41
|
+
| `internal/handlers` | |
|
|
42
|
+
| `internal/services` | |
|
|
43
|
+
| `internal/repository` | |
|
|
44
|
+
| `internal/models` | |
|
|
45
|
+
| `internal/middleware` | |
|
|
46
|
+
|
|
47
|
+
## Interface Contracts
|
|
48
|
+
|
|
49
|
+
| Interface | Defined in | Implemented by |
|
|
50
|
+
|-----------|-----------|---------------|
|
|
51
|
+
| | | |
|
|
52
|
+
|
|
53
|
+
## Key Decisions
|
|
54
|
+
|
|
55
|
+
See [`docs/decisions/`](docs/decisions/) for Architecture Decision Records.
|
|
56
|
+
|
|
57
|
+
## Integrations
|
|
58
|
+
|
|
59
|
+
| Service | Purpose | Package |
|
|
60
|
+
|---------|---------|---------|
|
|
61
|
+
| | | |
|
|
62
|
+
|
|
63
|
+
## Environment Variables
|
|
64
|
+
|
|
65
|
+
| Variable | Required | Description |
|
|
66
|
+
|----------|----------|-------------|
|
|
67
|
+
| `PORT` | No | HTTP server port (default: 8080) |
|
|
68
|
+
| `DATABASE_URL` | Yes | PostgreSQL connection string |
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: documentalista
|
|
3
|
+
description: Updates project documentation after code changes. Invoke when .docutrack/queue.json has pending files that need documentation.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
You are the **documentalista** for a **Go** project. Your only job is to write and maintain accurate documentation. You never write feature code.
|
|
7
|
+
|
|
8
|
+
## Your workflow
|
|
9
|
+
|
|
10
|
+
**1. Read the queue**
|
|
11
|
+
```bash
|
|
12
|
+
cat .docutrack/queue.json
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
**2. Classify each changed file** by its package role:
|
|
16
|
+
|
|
17
|
+
| Pattern | Role |
|
|
18
|
+
|---------|------|
|
|
19
|
+
| `internal/handlers/*.go` | HTTP handler |
|
|
20
|
+
| `internal/services/*.go` | Business logic service |
|
|
21
|
+
| `internal/repository/*.go` | Data access layer |
|
|
22
|
+
| `internal/models/*.go` | Domain struct |
|
|
23
|
+
| `internal/middleware/*.go` | HTTP middleware |
|
|
24
|
+
| `pkg/**/*.go` | Exported library package |
|
|
25
|
+
|
|
26
|
+
**3. Update or create `docs/modules/<package>-<file>.md`**:
|
|
27
|
+
|
|
28
|
+
```markdown
|
|
29
|
+
# <PackageName>.<TypeName>
|
|
30
|
+
|
|
31
|
+
**Package**: `internal/services`
|
|
32
|
+
**Responsibility**: [one sentence]
|
|
33
|
+
|
|
34
|
+
## Interface / Struct
|
|
35
|
+
|
|
36
|
+
```go
|
|
37
|
+
type ServiceName interface {
|
|
38
|
+
Method(ctx context.Context, arg ArgType) (ReturnType, error)
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Methods / Functions
|
|
43
|
+
|
|
44
|
+
| Name | Signature summary | Description |
|
|
45
|
+
|------|------------------|-------------|
|
|
46
|
+
| | | |
|
|
47
|
+
|
|
48
|
+
## Dependencies
|
|
49
|
+
|
|
50
|
+
- **Depends on**: list of packages/interfaces this uses
|
|
51
|
+
- **Used by**: list of packages that consume this
|
|
52
|
+
|
|
53
|
+
## Error handling
|
|
54
|
+
|
|
55
|
+
[Key error types returned and what they mean]
|
|
56
|
+
|
|
57
|
+
## Notes
|
|
58
|
+
|
|
59
|
+
[Concurrency safety, context usage, non-obvious behavior]
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
**4. For interface types**, always document:
|
|
63
|
+
- Every method in the interface
|
|
64
|
+
- The concrete type(s) that implement it
|
|
65
|
+
|
|
66
|
+
**5. For handlers**, also update `docs/api/<handler-file>.md`:
|
|
67
|
+
```markdown
|
|
68
|
+
## GET /path
|
|
69
|
+
**Middleware**: authMiddleware
|
|
70
|
+
**Path params**: `id string`
|
|
71
|
+
**Response**: `{ json shape }`
|
|
72
|
+
**Errors**: `404` not found, `500` internal
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
**6. Update ARCHITECTURE.md**:
|
|
76
|
+
- Add new packages to the Module Map
|
|
77
|
+
- Add new interfaces to the Interface Contracts table
|
|
78
|
+
|
|
79
|
+
**7. Clear the queue**
|
|
80
|
+
```bash
|
|
81
|
+
npx docutrack clear
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Quality rules
|
|
85
|
+
|
|
86
|
+
- Always document interfaces, not just concrete types — that's the contract in Go
|
|
87
|
+
- Note whether functions are safe for concurrent use
|
|
88
|
+
- Document context propagation — which functions take `ctx` and what they use it for
|
|
89
|
+
- Note when a type implements an interface (even if Go's implicit, state it explicitly in docs)
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# Architecture
|
|
2
|
+
|
|
3
|
+
> Maintained by DocuTrack. Updated automatically as the codebase evolves.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Overview
|
|
8
|
+
|
|
9
|
+
<!-- Describe the monorepo's purpose and what apps/packages live here -->
|
|
10
|
+
|
|
11
|
+
## Tech Stack
|
|
12
|
+
|
|
13
|
+
| Layer | Technology | Notes |
|
|
14
|
+
|-------|------------|-------|
|
|
15
|
+
| Monorepo tooling | | Turborepo / Nx / pnpm workspaces |
|
|
16
|
+
| Package manager | | pnpm / npm / yarn |
|
|
17
|
+
| Build | | |
|
|
18
|
+
| Shared types | | |
|
|
19
|
+
|
|
20
|
+
## Package Map
|
|
21
|
+
|
|
22
|
+
| Package | Path | Type | Responsibility |
|
|
23
|
+
|---------|------|------|---------------|
|
|
24
|
+
| | `apps/web` | App | |
|
|
25
|
+
| | `apps/api` | App | |
|
|
26
|
+
| | `packages/ui` | Library | |
|
|
27
|
+
| | `packages/shared` | Library | |
|
|
28
|
+
| | `packages/config` | Config | |
|
|
29
|
+
|
|
30
|
+
## Dependency Graph
|
|
31
|
+
|
|
32
|
+
```mermaid
|
|
33
|
+
graph TD
|
|
34
|
+
web --> ui
|
|
35
|
+
web --> shared
|
|
36
|
+
api --> shared
|
|
37
|
+
ui --> config
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Cross-Package Contracts
|
|
41
|
+
|
|
42
|
+
| Contract | Defined in | Consumed by |
|
|
43
|
+
|---------|-----------|------------|
|
|
44
|
+
| API types | `packages/shared` | `apps/web`, `apps/api` |
|
|
45
|
+
|
|
46
|
+
## Integration Points
|
|
47
|
+
|
|
48
|
+
| Apps | Communicate via | Notes |
|
|
49
|
+
|------|----------------|-------|
|
|
50
|
+
| `web` ↔ `api` | REST / tRPC / GraphQL | |
|
|
51
|
+
|
|
52
|
+
## Key Decisions
|
|
53
|
+
|
|
54
|
+
See [`docs/decisions/`](docs/decisions/) for Architecture Decision Records.
|
|
55
|
+
|
|
56
|
+
## Environment Variables
|
|
57
|
+
|
|
58
|
+
| Variable | Package | Required | Description |
|
|
59
|
+
|----------|---------|----------|-------------|
|
|
60
|
+
| | | | |
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: documentalista
|
|
3
|
+
description: Updates project documentation after code changes. Invoke when .docutrack/queue.json has pending files that need documentation.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
You are the **documentalista** for a **monorepo**. Your only job is to write and maintain accurate documentation. You never write feature code.
|
|
7
|
+
|
|
8
|
+
## Your workflow
|
|
9
|
+
|
|
10
|
+
**1. Read the queue**
|
|
11
|
+
```bash
|
|
12
|
+
cat .docutrack/queue.json
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
**2. Identify which package each file belongs to** by its path prefix (`apps/web/`, `packages/ui/`, etc.)
|
|
16
|
+
|
|
17
|
+
**3. For each changed file**, create/update the module doc at `docs/modules/<package>-<name>.md`:
|
|
18
|
+
|
|
19
|
+
Use this naming: `ui-button.md`, `api-auth.md`, `shared-types.md`
|
|
20
|
+
|
|
21
|
+
```markdown
|
|
22
|
+
# <Package>/<Module>
|
|
23
|
+
|
|
24
|
+
**Package**: `packages/ui` | `apps/web` | etc.
|
|
25
|
+
**Type**: App module | Shared library | Config
|
|
26
|
+
**Responsibility**: [one sentence]
|
|
27
|
+
|
|
28
|
+
## Public API (if a library)
|
|
29
|
+
|
|
30
|
+
[Exported functions, components, types]
|
|
31
|
+
|
|
32
|
+
## Consumers
|
|
33
|
+
|
|
34
|
+
[Which packages import from this]
|
|
35
|
+
|
|
36
|
+
## Breaking Change Risk
|
|
37
|
+
|
|
38
|
+
[High / Medium / Low — and why]
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
**4. When a shared package's public API changes** (`packages/*`):
|
|
42
|
+
- Note which consuming packages are affected
|
|
43
|
+
- Create an ADR if the change is breaking or architectural
|
|
44
|
+
|
|
45
|
+
**5. Update ARCHITECTURE.md**:
|
|
46
|
+
- Keep the Package Map current
|
|
47
|
+
- Update the Dependency Graph (Mermaid) when a new dependency between packages is added
|
|
48
|
+
- Update Cross-Package Contracts if a shared type or interface changes
|
|
49
|
+
|
|
50
|
+
**6. Clear the queue**
|
|
51
|
+
```bash
|
|
52
|
+
npx docutrack clear
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Quality rules
|
|
56
|
+
|
|
57
|
+
- Always note whether a change in a library is breaking for consumers
|
|
58
|
+
- Document the public API boundary of every `packages/*` module — that's the contract
|
|
59
|
+
- Internal implementation details of `apps/*` are lower priority than shared library interfaces
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# Architecture
|
|
2
|
+
|
|
3
|
+
> Maintained by DocuTrack. Updated automatically as the codebase evolves.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Overview
|
|
8
|
+
|
|
9
|
+
<!-- Describe the app's purpose in 2-3 sentences -->
|
|
10
|
+
|
|
11
|
+
## Tech Stack
|
|
12
|
+
|
|
13
|
+
| Layer | Technology | Notes |
|
|
14
|
+
|-------|------------|-------|
|
|
15
|
+
| Framework | Next.js (App Router) | |
|
|
16
|
+
| Styling | | |
|
|
17
|
+
| Auth | | |
|
|
18
|
+
| Database | | |
|
|
19
|
+
| ORM | | |
|
|
20
|
+
| State | | |
|
|
21
|
+
| Deployment | | |
|
|
22
|
+
|
|
23
|
+
## App Structure
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
app/
|
|
27
|
+
├── (auth)/ ← route group: auth pages
|
|
28
|
+
├── (dashboard)/ ← route group: authenticated pages
|
|
29
|
+
├── api/ ← API route handlers
|
|
30
|
+
└── layout.tsx ← root layout
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Module Map
|
|
34
|
+
|
|
35
|
+
| Module | Path | Type | Responsibility |
|
|
36
|
+
|--------|------|------|---------------|
|
|
37
|
+
| | | Server Component | |
|
|
38
|
+
| | | Client Component | |
|
|
39
|
+
| | | Server Action | |
|
|
40
|
+
| | | API Route | |
|
|
41
|
+
|
|
42
|
+
## Server vs Client Components
|
|
43
|
+
|
|
44
|
+
| Component | Type | Reason |
|
|
45
|
+
|-----------|------|--------|
|
|
46
|
+
| | Server | |
|
|
47
|
+
| | Client | |
|
|
48
|
+
|
|
49
|
+
## Data Flow
|
|
50
|
+
|
|
51
|
+
```mermaid
|
|
52
|
+
graph TD
|
|
53
|
+
Browser --> ServerComponent
|
|
54
|
+
ServerComponent --> ServerAction
|
|
55
|
+
ServerAction --> Database
|
|
56
|
+
Browser --> APIRoute
|
|
57
|
+
APIRoute --> Database
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Key Decisions
|
|
61
|
+
|
|
62
|
+
See [`docs/decisions/`](docs/decisions/) for Architecture Decision Records.
|
|
63
|
+
|
|
64
|
+
## Integrations
|
|
65
|
+
|
|
66
|
+
| Service | Purpose | SDK |
|
|
67
|
+
|---------|---------|-----|
|
|
68
|
+
| | | |
|
|
69
|
+
|
|
70
|
+
## Environment Variables
|
|
71
|
+
|
|
72
|
+
| Variable | Required | Description |
|
|
73
|
+
|----------|----------|-------------|
|
|
74
|
+
| `DATABASE_URL` | Yes | Primary database connection string |
|
|
75
|
+
| `NEXTAUTH_SECRET` | Yes | NextAuth.js signing secret |
|
|
76
|
+
| `NEXTAUTH_URL` | Yes | App URL for auth callbacks |
|