@sandrinio/vdoc 3.0.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/LICENSE +21 -0
- package/README.md +169 -0
- package/bin/vdoc.mjs +244 -0
- package/package.json +30 -0
- package/skills/agents/AGENTS.md +170 -0
- package/skills/claude/SKILL.md +212 -0
- package/skills/claude/references/doc-template.md +67 -0
- package/skills/claude/references/manifest-schema.json +16 -0
- package/skills/cline/vdoc-workflow.md +27 -0
- package/skills/cline/vdoc.md +175 -0
- package/skills/continue/vdoc-command.md +29 -0
- package/skills/continue/vdoc.md +177 -0
- package/skills/cursor/vdoc-command.md +33 -0
- package/skills/cursor/vdoc.mdc +176 -0
- package/skills/gemini/GEMINI.md +174 -0
- package/skills/gemini/vdoc.toml +27 -0
- package/skills/jetbrains-ai/vdoc.md +170 -0
- package/skills/junie/guidelines.md +174 -0
- package/skills/vscode/copilot-instructions.md +12 -0
- package/skills/vscode/vdoc.instructions.md +174 -0
- package/skills/vscode/vdoc.prompt.md +31 -0
- package/skills/windsurf/vdoc-workflow.md +31 -0
- package/skills/windsurf/vdoc.md +94 -0
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: vdoc
|
|
3
|
+
description: "Generate and maintain feature-centric product documentation. Handles init (explore codebase, plan docs, generate), audit (detect stale/missing/dead docs, patch), and query (route questions via semantic manifest)."
|
|
4
|
+
alwaysApply: false
|
|
5
|
+
globs:
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# vdoc — Documentation Generator
|
|
9
|
+
|
|
10
|
+
You generate and maintain feature-centric documentation for codebases. You have three modes: **init**, **audit**, and **query**.
|
|
11
|
+
|
|
12
|
+
All documentation lives in `vdocs/` at the project root. The manifest at `vdocs/_manifest.json` is the semantic index you read first.
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Mode 1: Init
|
|
17
|
+
|
|
18
|
+
**Trigger:** User says "document this project" or similar.
|
|
19
|
+
|
|
20
|
+
### Step 1 — Explore
|
|
21
|
+
|
|
22
|
+
Read the codebase thoroughly. Identify:
|
|
23
|
+
|
|
24
|
+
- **Tech stack**: languages, frameworks, databases, ORMs
|
|
25
|
+
- **Features**: authentication, API, payments, notifications, search, etc.
|
|
26
|
+
- **Architecture**: monolith vs microservices, frontend/backend split, key patterns
|
|
27
|
+
- **Integrations**: third-party services (Stripe, AWS, Redis, etc.)
|
|
28
|
+
- **Entry points**: where requests come in, how they flow through the system
|
|
29
|
+
|
|
30
|
+
Do not skim. Read key files — entry points, config, routes, schemas, middleware.
|
|
31
|
+
|
|
32
|
+
### Step 2 — Plan
|
|
33
|
+
|
|
34
|
+
Create `vdocs/_DOCUMENTATION_PLAN.md` listing each proposed doc with a one-line description. Present to user. Suggest merges, additions, or removals. Wait for approval.
|
|
35
|
+
|
|
36
|
+
### Step 3 — Generate
|
|
37
|
+
|
|
38
|
+
For each approved doc, read ALL relevant source files and generate using this template:
|
|
39
|
+
|
|
40
|
+
```markdown
|
|
41
|
+
# {Feature Title}
|
|
42
|
+
|
|
43
|
+
> {One-line description}
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## Overview
|
|
48
|
+
{What it does, why it exists, how it fits in the system.}
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## How It Works
|
|
53
|
+
{Core logic and flow.}
|
|
54
|
+
{Mermaid diagram(s) — max 7-9 nodes per diagram, split if larger.}
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## Data Model
|
|
59
|
+
{Entities this feature owns. Mermaid ER diagram or table.}
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## Key Files
|
|
64
|
+
| File | Purpose |
|
|
65
|
+
|------|---------|
|
|
66
|
+
| `src/path/file.ts` | What this file does |
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## Dependencies & Integrations
|
|
71
|
+
{External services, internal features, packages this relies on.}
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## Configuration
|
|
76
|
+
| Variable | Purpose | Required |
|
|
77
|
+
|----------|---------|----------|
|
|
78
|
+
| `ENV_VAR` | What it controls | Yes/No |
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## Error Handling
|
|
83
|
+
{Failure modes, what the user sees, retry logic. Mermaid diagram if non-trivial.}
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## Constraints & Decisions
|
|
88
|
+
{Why it's built this way. What you CANNOT change without breaking things.}
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
## Related Features
|
|
93
|
+
{Cross-references to other docs by filename. Blast radius notes.}
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
*Generated by vdoc v3.0.0 • Last updated: {timestamp}*
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
**Writing rules:**
|
|
101
|
+
|
|
102
|
+
- **Mermaid diagrams are mandatory** in "How It Works". Max 7-9 nodes — split larger flows.
|
|
103
|
+
- **Data Model** must show real entities from the code, not placeholders.
|
|
104
|
+
- **Constraints & Decisions** is the most valuable section. Dig for non-obvious choices. If unclear, write: `Reason: unknown — verify with team`.
|
|
105
|
+
- **Related Features** must reference other doc filenames and explain coupling.
|
|
106
|
+
- **Configuration** must list actual env vars from the code.
|
|
107
|
+
- **Error Handling** — trace what happens when things fail.
|
|
108
|
+
|
|
109
|
+
### Step 4 — Manifest
|
|
110
|
+
|
|
111
|
+
Create `vdocs/_manifest.json`:
|
|
112
|
+
|
|
113
|
+
```json
|
|
114
|
+
{
|
|
115
|
+
"project": "<project-name>",
|
|
116
|
+
"vdoc_version": "3.0.0",
|
|
117
|
+
"created_at": "<ISO-8601>",
|
|
118
|
+
"last_updated": "<ISO-8601>",
|
|
119
|
+
"last_commit": "<short-sha>",
|
|
120
|
+
"documentation": [
|
|
121
|
+
{
|
|
122
|
+
"filepath": "FEATURE_NAME_DOC.md",
|
|
123
|
+
"title": "Human-Readable Title",
|
|
124
|
+
"version": "1.0.0",
|
|
125
|
+
"description": "Rich semantic description with technology names, patterns, concepts. Detailed enough for AI to route questions to this doc.",
|
|
126
|
+
"tags": ["keyword-tag"]
|
|
127
|
+
}
|
|
128
|
+
]
|
|
129
|
+
}
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### Step 5 — Self-Review
|
|
133
|
+
|
|
134
|
+
Verify: every doc has mermaid diagrams, at least 2 constraints, real file paths, actual env vars, cross-references. Manifest descriptions are detailed for semantic routing. No hallucinated content.
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
## Mode 2: Audit
|
|
139
|
+
|
|
140
|
+
**Trigger:** User says "audit docs" or similar.
|
|
141
|
+
|
|
142
|
+
1. **Read manifest** — load `vdocs/_manifest.json`
|
|
143
|
+
2. **Detect stale** — `git diff` or `git log --name-only --since="<last_updated>"` to find changed source files. Cross-reference with each doc's "Key Files" section.
|
|
144
|
+
3. **Detect gaps** — scan codebase for significant source files not covered by any doc (new routes, services, models, config).
|
|
145
|
+
4. **Detect dead docs** — check each doc's "Key Files" against filesystem. Flag docs referencing deleted files.
|
|
146
|
+
5. **Check cross-refs** — verify "Related Features" links still exist and coupling is accurate.
|
|
147
|
+
6. **Report** — present stale, gaps, dead, cross-ref issues, and current docs. Wait for user direction.
|
|
148
|
+
7. **Patch** — update stale docs, generate new docs for gaps, flag dead docs, fix cross-refs. Update manifest.
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## Mode 3: Query
|
|
153
|
+
|
|
154
|
+
**Trigger:** User asks any question about the codebase or documentation.
|
|
155
|
+
|
|
156
|
+
1. Read `vdocs/_manifest.json`
|
|
157
|
+
2. Match question against `description` and `tags` fields
|
|
158
|
+
3. Read matching doc(s)
|
|
159
|
+
4. Answer from documented knowledge
|
|
160
|
+
5. If no match, suggest running an audit
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
## Naming Convention
|
|
165
|
+
|
|
166
|
+
Files: `FEATURE_NAME_DOC.md` — uppercase, feature-named, `_DOC` suffix.
|
|
167
|
+
|
|
168
|
+
---
|
|
169
|
+
|
|
170
|
+
## Rules
|
|
171
|
+
|
|
172
|
+
1. **Feature-centric, not file-centric.** One doc per logical feature, not per source file.
|
|
173
|
+
2. **Mermaid over prose.** Diagram flows. Max 7-9 nodes per diagram.
|
|
174
|
+
3. **Constraints are gold.** Always fill "Constraints & Decisions".
|
|
175
|
+
4. **Rich manifest descriptions.** Pack with specific terms for semantic routing.
|
|
176
|
+
5. **No hallucination.** Only document what exists in code.
|
|
177
|
+
6. **Plan first, always.** Never generate without user-approved plan.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# /vdoc — Documentation Generator
|
|
2
|
+
|
|
3
|
+
Run documentation workflows for this project. The detailed instructions are in `.cursor/rules/vdoc.mdc`.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
- `/vdoc init` — Explore codebase, create documentation plan, generate docs
|
|
8
|
+
- `/vdoc audit` — Detect stale, missing, and dead docs, then patch
|
|
9
|
+
- `/vdoc` (no args) — Show available commands
|
|
10
|
+
|
|
11
|
+
## Execution
|
|
12
|
+
|
|
13
|
+
$ARGUMENTS
|
|
14
|
+
|
|
15
|
+
**If the argument is `init` or empty with no existing `vdocs/` folder:**
|
|
16
|
+
|
|
17
|
+
1. **Explore** — Read the codebase thoroughly: tech stack, features, architecture, integrations, entry points. Read actual files, don't skim.
|
|
18
|
+
2. **Plan** — Create `vdocs/_DOCUMENTATION_PLAN.md` listing each proposed doc. Present to user. Wait for approval.
|
|
19
|
+
3. **Generate** — For each approved doc, read ALL relevant source files. Write `vdocs/FEATURE_NAME_DOC.md` following the template and writing rules in `.cursor/rules/vdoc.mdc`.
|
|
20
|
+
4. **Manifest** — Create `vdocs/_manifest.json` with rich semantic descriptions per doc.
|
|
21
|
+
5. **Self-review** — Verify: mermaid diagrams, real file paths, 2+ constraints per doc, cross-references, no hallucinated content.
|
|
22
|
+
|
|
23
|
+
**If the argument is `audit` or empty with existing `vdocs/` folder:**
|
|
24
|
+
|
|
25
|
+
1. **Read** `vdocs/_manifest.json`
|
|
26
|
+
2. **Stale** — git diff since `last_updated`, cross-ref with each doc's "Key Files" section
|
|
27
|
+
3. **Gaps** — find undocumented features (new routes, services, models)
|
|
28
|
+
4. **Dead** — docs referencing deleted source files
|
|
29
|
+
5. **Cross-refs** — verify Related Features links still valid
|
|
30
|
+
6. **Report** — present findings, wait for user direction
|
|
31
|
+
7. **Patch** — update stale docs, generate new ones for gaps, fix cross-refs, update manifest
|
|
32
|
+
|
|
33
|
+
**If no arguments and `vdocs/` exists, treat as audit.**
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Generate and maintain feature-centric product documentation. Handles init (explore codebase, plan docs, generate), audit (detect stale/missing/dead docs, patch), and query (route questions via semantic manifest). Activates when user asks about documentation, says 'document this project', 'audit docs', or asks questions about codebase features."
|
|
3
|
+
globs:
|
|
4
|
+
alwaysApply: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# vdoc — Documentation Generator
|
|
8
|
+
|
|
9
|
+
You generate and maintain feature-centric documentation for codebases. You have three modes: **init**, **audit**, and **query**.
|
|
10
|
+
|
|
11
|
+
All documentation lives in `vdocs/` at the project root. The manifest at `vdocs/_manifest.json` is the semantic index you read first.
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## Mode 1: Init
|
|
16
|
+
|
|
17
|
+
**Trigger:** User says "document this project" or similar.
|
|
18
|
+
|
|
19
|
+
### Step 1 — Explore
|
|
20
|
+
|
|
21
|
+
Read the codebase thoroughly. Identify:
|
|
22
|
+
|
|
23
|
+
- **Tech stack**: languages, frameworks, databases, ORMs
|
|
24
|
+
- **Features**: authentication, API, payments, notifications, search, etc.
|
|
25
|
+
- **Architecture**: monolith vs microservices, frontend/backend split, key patterns
|
|
26
|
+
- **Integrations**: third-party services (Stripe, AWS, Redis, etc.)
|
|
27
|
+
- **Entry points**: where requests come in, how they flow through the system
|
|
28
|
+
|
|
29
|
+
Do not skim. Read key files — entry points, config, routes, schemas, middleware.
|
|
30
|
+
|
|
31
|
+
### Step 2 — Plan
|
|
32
|
+
|
|
33
|
+
Create `vdocs/_DOCUMENTATION_PLAN.md` listing each proposed doc with a one-line description. Present to user. Suggest merges, additions, or removals. Wait for approval.
|
|
34
|
+
|
|
35
|
+
### Step 3 — Generate
|
|
36
|
+
|
|
37
|
+
For each approved doc, read ALL relevant source files and generate using this template:
|
|
38
|
+
|
|
39
|
+
```markdown
|
|
40
|
+
# {Feature Title}
|
|
41
|
+
|
|
42
|
+
> {One-line description}
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## Overview
|
|
47
|
+
{What it does, why it exists, how it fits in the system.}
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## How It Works
|
|
52
|
+
{Core logic and flow.}
|
|
53
|
+
{Mermaid diagram(s) — max 7-9 nodes per diagram, split if larger.}
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## Data Model
|
|
58
|
+
{Entities this feature owns. Mermaid ER diagram or table.}
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## Key Files
|
|
63
|
+
| File | Purpose |
|
|
64
|
+
|------|---------|
|
|
65
|
+
| `src/path/file.ts` | What this file does |
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## Dependencies & Integrations
|
|
70
|
+
{External services, internal features, packages this relies on.}
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## Configuration
|
|
75
|
+
| Variable | Purpose | Required |
|
|
76
|
+
|----------|---------|----------|
|
|
77
|
+
| `ENV_VAR` | What it controls | Yes/No |
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
## Error Handling
|
|
82
|
+
{Failure modes, what the user sees, retry logic. Mermaid diagram if non-trivial.}
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
## Constraints & Decisions
|
|
87
|
+
{Why it's built this way. What you CANNOT change without breaking things.}
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## Related Features
|
|
92
|
+
{Cross-references to other docs by filename. Blast radius notes.}
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
*Generated by vdoc v3.0.0 • Last updated: {timestamp}*
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
**Writing rules:**
|
|
100
|
+
|
|
101
|
+
- **Mermaid diagrams are mandatory** in "How It Works". Max 7-9 nodes — split larger flows into multiple diagrams.
|
|
102
|
+
- **Data Model** must show real entities from the code, not placeholders.
|
|
103
|
+
- **Constraints & Decisions** is the most valuable section. Dig for non-obvious choices. If the reason is unclear, write: `Reason: unknown — verify with team`.
|
|
104
|
+
- **Related Features** must reference other doc filenames and explain the coupling.
|
|
105
|
+
- **Configuration** must list actual env vars from the code.
|
|
106
|
+
- **Error Handling** — trace what happens when things fail.
|
|
107
|
+
|
|
108
|
+
### Step 4 — Manifest
|
|
109
|
+
|
|
110
|
+
Create `vdocs/_manifest.json`:
|
|
111
|
+
|
|
112
|
+
```json
|
|
113
|
+
{
|
|
114
|
+
"project": "<project-name>",
|
|
115
|
+
"vdoc_version": "3.0.0",
|
|
116
|
+
"created_at": "<ISO-8601>",
|
|
117
|
+
"last_updated": "<ISO-8601>",
|
|
118
|
+
"last_commit": "<short-sha>",
|
|
119
|
+
"documentation": [
|
|
120
|
+
{
|
|
121
|
+
"filepath": "FEATURE_NAME_DOC.md",
|
|
122
|
+
"title": "Human-Readable Title",
|
|
123
|
+
"version": "1.0.0",
|
|
124
|
+
"description": "Rich semantic description with technology names, patterns, concepts. Detailed enough for AI to route questions to this doc.",
|
|
125
|
+
"tags": ["keyword-tag"]
|
|
126
|
+
}
|
|
127
|
+
]
|
|
128
|
+
}
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### Step 5 — Self-Review
|
|
132
|
+
|
|
133
|
+
Verify: every doc has mermaid diagrams, at least 2 constraints, real file paths, actual env vars, cross-references. Manifest descriptions are detailed enough for semantic routing. No hallucinated content.
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
## Mode 2: Audit
|
|
138
|
+
|
|
139
|
+
**Trigger:** User says "audit docs" or similar.
|
|
140
|
+
|
|
141
|
+
1. **Read manifest** — load `vdocs/_manifest.json`
|
|
142
|
+
2. **Detect stale** — `git diff` or `git log --name-only --since="<last_updated>"` to find changed source files. Cross-reference with each doc's "Key Files" section.
|
|
143
|
+
3. **Detect gaps** — scan codebase for significant features not covered by any doc (new routes, services, models, config).
|
|
144
|
+
4. **Detect dead docs** — check each doc's "Key Files" against filesystem. Flag docs referencing deleted files.
|
|
145
|
+
5. **Check cross-refs** — verify "Related Features" links still exist and coupling descriptions are accurate.
|
|
146
|
+
6. **Report** — present stale docs, coverage gaps, dead docs, cross-ref issues, and current docs. Wait for user direction.
|
|
147
|
+
7. **Patch** — update stale docs (re-read source, update affected sections). Generate new docs for gaps. Flag dead docs for removal. Fix cross-refs. Update manifest.
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
## Mode 3: Query
|
|
152
|
+
|
|
153
|
+
**Trigger:** User asks any question about the codebase or documentation.
|
|
154
|
+
|
|
155
|
+
1. Read `vdocs/_manifest.json`
|
|
156
|
+
2. Match question against `description` and `tags` fields
|
|
157
|
+
3. Read matching doc(s)
|
|
158
|
+
4. Answer from documented knowledge
|
|
159
|
+
5. If no match, say so and suggest running an audit
|
|
160
|
+
|
|
161
|
+
---
|
|
162
|
+
|
|
163
|
+
## Naming Convention
|
|
164
|
+
|
|
165
|
+
Files: `FEATURE_NAME_DOC.md` — uppercase, feature-named, `_DOC` suffix.
|
|
166
|
+
|
|
167
|
+
---
|
|
168
|
+
|
|
169
|
+
## Rules
|
|
170
|
+
|
|
171
|
+
1. **Feature-centric, not file-centric.** One doc per logical feature, not per source file.
|
|
172
|
+
2. **Mermaid over prose.** Diagram flows. Max 7-9 nodes per diagram.
|
|
173
|
+
3. **Constraints are gold.** Always fill "Constraints & Decisions". It prevents breaking changes.
|
|
174
|
+
4. **Rich manifest descriptions.** Pack with specific terms for semantic routing.
|
|
175
|
+
5. **No hallucination.** Only document what exists in code.
|
|
176
|
+
6. **Plan first, always.** Never generate without user-approved plan. Report before patching.
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
<!-- vdoc:start -->
|
|
2
|
+
|
|
3
|
+
# vdoc — Documentation Generator
|
|
4
|
+
|
|
5
|
+
You generate and maintain feature-centric documentation for codebases. You have three modes: **init**, **audit**, and **query**.
|
|
6
|
+
|
|
7
|
+
All documentation lives in `vdocs/` at the project root. The manifest at `vdocs/_manifest.json` is the semantic index you read first.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Mode 1: Init
|
|
12
|
+
|
|
13
|
+
**Trigger:** User says "document this project" or similar.
|
|
14
|
+
|
|
15
|
+
### Step 1 — Explore
|
|
16
|
+
|
|
17
|
+
Read the codebase thoroughly. Identify:
|
|
18
|
+
|
|
19
|
+
- **Tech stack**: languages, frameworks, databases, ORMs
|
|
20
|
+
- **Features**: authentication, API, payments, notifications, search, etc.
|
|
21
|
+
- **Architecture**: monolith vs microservices, frontend/backend split, key patterns
|
|
22
|
+
- **Integrations**: third-party services (Stripe, AWS, Redis, etc.)
|
|
23
|
+
- **Entry points**: where requests come in, how they flow through the system
|
|
24
|
+
|
|
25
|
+
Do not skim. Read key files — entry points, config, routes, schemas, middleware.
|
|
26
|
+
|
|
27
|
+
### Step 2 — Plan
|
|
28
|
+
|
|
29
|
+
Create `vdocs/_DOCUMENTATION_PLAN.md` listing each proposed doc with a one-line description. Present to user. Suggest merges, additions, or removals. Wait for approval.
|
|
30
|
+
|
|
31
|
+
### Step 3 — Generate
|
|
32
|
+
|
|
33
|
+
For each approved doc, read ALL relevant source files and generate using this template:
|
|
34
|
+
|
|
35
|
+
```markdown
|
|
36
|
+
# {Feature Title}
|
|
37
|
+
|
|
38
|
+
> {One-line description}
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## Overview
|
|
43
|
+
{What it does, why it exists, how it fits in the system.}
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## How It Works
|
|
48
|
+
{Core logic and flow.}
|
|
49
|
+
{Mermaid diagram(s) — max 7-9 nodes per diagram, split if larger.}
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## Data Model
|
|
54
|
+
{Entities this feature owns. Mermaid ER diagram or table.}
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## Key Files
|
|
59
|
+
| File | Purpose |
|
|
60
|
+
|------|---------|
|
|
61
|
+
| `src/path/file.ts` | What this file does |
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## Dependencies & Integrations
|
|
66
|
+
{External services, internal features, packages this relies on.}
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## Configuration
|
|
71
|
+
| Variable | Purpose | Required |
|
|
72
|
+
|----------|---------|----------|
|
|
73
|
+
| `ENV_VAR` | What it controls | Yes/No |
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## Error Handling
|
|
78
|
+
{Failure modes, what the user sees, retry logic. Mermaid diagram if non-trivial.}
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## Constraints & Decisions
|
|
83
|
+
{Why it's built this way. What you CANNOT change without breaking things.}
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## Related Features
|
|
88
|
+
{Cross-references to other docs by filename. Blast radius notes.}
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
*Generated by vdoc v3.0.0 • Last updated: {timestamp}*
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
**Writing rules:**
|
|
96
|
+
|
|
97
|
+
- **Mermaid diagrams are mandatory** in "How It Works". Max 7-9 nodes — split larger flows.
|
|
98
|
+
- **Data Model** must show real entities from the code, not placeholders.
|
|
99
|
+
- **Constraints & Decisions** is the most valuable section. Dig for non-obvious choices. If unclear, write: `Reason: unknown — verify with team`.
|
|
100
|
+
- **Related Features** must reference other doc filenames and explain coupling.
|
|
101
|
+
- **Configuration** must list actual env vars from the code.
|
|
102
|
+
- **Error Handling** — trace what happens when things fail.
|
|
103
|
+
|
|
104
|
+
### Step 4 — Manifest
|
|
105
|
+
|
|
106
|
+
Create `vdocs/_manifest.json`:
|
|
107
|
+
|
|
108
|
+
```json
|
|
109
|
+
{
|
|
110
|
+
"project": "<project-name>",
|
|
111
|
+
"vdoc_version": "3.0.0",
|
|
112
|
+
"created_at": "<ISO-8601>",
|
|
113
|
+
"last_updated": "<ISO-8601>",
|
|
114
|
+
"last_commit": "<short-sha>",
|
|
115
|
+
"documentation": [
|
|
116
|
+
{
|
|
117
|
+
"filepath": "FEATURE_NAME_DOC.md",
|
|
118
|
+
"title": "Human-Readable Title",
|
|
119
|
+
"version": "1.0.0",
|
|
120
|
+
"description": "Rich semantic description with technology names, patterns, concepts. Detailed enough for AI to route questions to this doc.",
|
|
121
|
+
"tags": ["keyword-tag"]
|
|
122
|
+
}
|
|
123
|
+
]
|
|
124
|
+
}
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### Step 5 — Self-Review
|
|
128
|
+
|
|
129
|
+
Verify: every doc has mermaid diagrams, at least 2 constraints, real file paths, actual env vars, cross-references. Manifest descriptions are detailed for semantic routing. No hallucinated content.
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
## Mode 2: Audit
|
|
134
|
+
|
|
135
|
+
**Trigger:** User says "audit docs" or similar.
|
|
136
|
+
|
|
137
|
+
1. **Read manifest** — load `vdocs/_manifest.json`
|
|
138
|
+
2. **Detect stale** — `git diff` or `git log --name-only --since="<last_updated>"` to find changed source files. Cross-reference with each doc's "Key Files" section.
|
|
139
|
+
3. **Detect gaps** — scan codebase for significant source files not covered by any doc (new routes, services, models, config).
|
|
140
|
+
4. **Detect dead docs** — check each doc's "Key Files" against filesystem. Flag docs referencing deleted files.
|
|
141
|
+
5. **Check cross-refs** — verify "Related Features" links still exist and coupling is accurate.
|
|
142
|
+
6. **Report** — present stale, gaps, dead, cross-ref issues, and current docs. Wait for user direction.
|
|
143
|
+
7. **Patch** — update stale docs, generate new docs for gaps, flag dead docs, fix cross-refs. Update manifest.
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
## Mode 3: Query
|
|
148
|
+
|
|
149
|
+
**Trigger:** User asks any question about the codebase or documentation.
|
|
150
|
+
|
|
151
|
+
1. Read `vdocs/_manifest.json`
|
|
152
|
+
2. Match question against `description` and `tags` fields
|
|
153
|
+
3. Read matching doc(s)
|
|
154
|
+
4. Answer from documented knowledge
|
|
155
|
+
5. If no match, suggest running an audit
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
## Naming Convention
|
|
160
|
+
|
|
161
|
+
Files: `FEATURE_NAME_DOC.md` — uppercase, feature-named, `_DOC` suffix.
|
|
162
|
+
|
|
163
|
+
---
|
|
164
|
+
|
|
165
|
+
## Rules
|
|
166
|
+
|
|
167
|
+
1. **Feature-centric, not file-centric.** One doc per logical feature, not per source file.
|
|
168
|
+
2. **Mermaid over prose.** Diagram flows. Max 7-9 nodes per diagram.
|
|
169
|
+
3. **Constraints are gold.** Always fill "Constraints & Decisions".
|
|
170
|
+
4. **Rich manifest descriptions.** Pack with specific terms for semantic routing.
|
|
171
|
+
5. **No hallucination.** Only document what exists in code.
|
|
172
|
+
6. **Plan first, always.** Never generate without user-approved plan.
|
|
173
|
+
|
|
174
|
+
<!-- vdoc:end -->
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
description = "Generate and maintain feature-centric product documentation. Use: /vdoc init or /vdoc audit"
|
|
2
|
+
|
|
3
|
+
prompt = """
|
|
4
|
+
# vdoc — Documentation Generator
|
|
5
|
+
|
|
6
|
+
Run documentation workflows for this project. Full instructions are in GEMINI.md under the vdoc section.
|
|
7
|
+
|
|
8
|
+
**User request:** {{args}}
|
|
9
|
+
|
|
10
|
+
## If "init" or no vdocs/ folder exists:
|
|
11
|
+
|
|
12
|
+
1. **Explore** — Read the codebase: tech stack, features, architecture, integrations, entry points. Read actual files.
|
|
13
|
+
2. **Plan** — Create `vdocs/_DOCUMENTATION_PLAN.md` listing proposed docs. Present to user. Wait for approval.
|
|
14
|
+
3. **Generate** — For each doc, read ALL relevant source files. Write `vdocs/FEATURE_NAME_DOC.md` following the template in GEMINI.md.
|
|
15
|
+
4. **Manifest** — Create `vdocs/_manifest.json` with rich semantic descriptions.
|
|
16
|
+
5. **Verify** — Every doc has mermaid diagrams, real paths, 2+ constraints, cross-references.
|
|
17
|
+
|
|
18
|
+
## If "audit" or vdocs/ already exists:
|
|
19
|
+
|
|
20
|
+
1. Read `vdocs/_manifest.json`
|
|
21
|
+
2. **Stale** — git diff since last_updated, cross-ref with each doc's Key Files section
|
|
22
|
+
3. **Gaps** — undocumented features (new routes, services, models)
|
|
23
|
+
4. **Dead** — docs referencing deleted files
|
|
24
|
+
5. **Cross-refs** — verify Related Features links
|
|
25
|
+
6. **Report** — present findings, wait for user direction
|
|
26
|
+
7. **Patch** — update stale, generate gaps, fix cross-refs, update manifest
|
|
27
|
+
"""
|