@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.
@@ -0,0 +1,212 @@
1
+ ---
2
+ name: vdoc
3
+ description: Generate and maintain feature-centric product documentation from source code
4
+ argument-hint: "[init|audit] or ask any documentation question"
5
+ user-invocable: true
6
+ allowed-tools: ["Bash", "Read", "Write", "Edit", "Glob", "Grep"]
7
+ ---
8
+
9
+ # vdoc — Documentation Generator
10
+
11
+ You generate and maintain feature-centric documentation for codebases. You have three modes: **init**, **audit**, and **query**.
12
+
13
+ All documentation lives in `vdocs/` at the project root. Every doc follows the template in `references/doc-template.md`. The manifest at `vdocs/_manifest.json` is the semantic index you read first.
14
+
15
+ ---
16
+
17
+ ## Mode 1: Init
18
+
19
+ **Trigger:** `/vdoc init` or user says "document this project"
20
+
21
+ ### Step 1 — Explore
22
+
23
+ Read the codebase thoroughly. Identify:
24
+
25
+ - **Tech stack**: languages, frameworks, databases, ORMs
26
+ - **Features**: authentication, API, payments, notifications, search, etc.
27
+ - **Architecture**: monolith vs microservices, frontend/backend split, key patterns (MVC, event-driven, etc.)
28
+ - **Integrations**: third-party services (Stripe, AWS, Redis, etc.)
29
+ - **Entry points**: where requests come in, how they flow through the system
30
+
31
+ Do not skim. Read key files — entry points, config files, route definitions, schema files, middleware. Understand how the system actually works before proposing docs.
32
+
33
+ ### Step 2 — Plan
34
+
35
+ Create `vdocs/_DOCUMENTATION_PLAN.md` listing each proposed doc:
36
+
37
+ ```markdown
38
+ # Documentation Plan
39
+
40
+ ## Proposed Documents
41
+
42
+ 1. **PROJECT_OVERVIEW_DOC.md** — Tech stack, architecture, project structure, dev setup
43
+ 2. **AUTHENTICATION_DOC.md** — OAuth2 flow, JWT lifecycle, session management, RBAC
44
+ 3. **API_REFERENCE_DOC.md** — All endpoints, request/response shapes, error codes
45
+ ...
46
+
47
+ ## Notes
48
+ - Each doc covers one logical feature, not one file
49
+ - Docs should be useful for onboarding AND as AI context for planning changes
50
+ ```
51
+
52
+ Present the plan to the user. Actively suggest changes:
53
+ - "Should I merge X and Y into one doc?"
54
+ - "I found a websocket system — want that documented separately?"
55
+ - "Any internal/legacy systems I should skip?"
56
+
57
+ Wait for user approval before proceeding.
58
+
59
+ ### Step 3 — Generate
60
+
61
+ For each approved doc:
62
+
63
+ 1. Read ALL relevant source files for that feature — not just the main file, but helpers, types, middleware, tests
64
+ 2. Follow the template in `references/doc-template.md` exactly
65
+ 3. Write to `vdocs/FEATURE_NAME_DOC.md`
66
+
67
+ **Writing rules:**
68
+
69
+ - **Mermaid diagrams are mandatory** in "How It Works". Show the actual flow — request lifecycle, state transitions, data pipeline. If a flow has more than 7-9 nodes, split into multiple diagrams.
70
+ - **Data Model** must show real entities from the code, not generic placeholders. Use mermaid ER diagrams for relational data, tables for simpler models.
71
+ - **Constraints & Decisions** is the most valuable section. Dig into the code for non-obvious choices: "Uses polling instead of websockets because...", "Auth tokens expire in 15min because...". If you can't find the reason, state the constraint and mark it: `Reason: unknown — verify with team`.
72
+ - **Related Features** must reference other docs by filename and explain the coupling: "Changes to the JWT schema will require updates to API_REFERENCE_DOC.md (auth middleware affects all endpoints)."
73
+ - **Configuration** must list actual env vars/secrets from the code, not hypothetical ones.
74
+ - **Error Handling** — trace what happens when things fail. What does the user see? What gets logged? Is there retry logic?
75
+
76
+ ### Step 4 — Manifest
77
+
78
+ Create `vdocs/_manifest.json`:
79
+
80
+ ```json
81
+ {
82
+ "project": "<project-name>",
83
+ "vdoc_version": "3.0.0",
84
+ "created_at": "<ISO-8601>",
85
+ "last_updated": "<ISO-8601>",
86
+ "last_commit": "<short-sha>",
87
+ "documentation": [
88
+ {
89
+ "filepath": "AUTHENTICATION_DOC.md",
90
+ "title": "Authentication - OAuth2 & JWT",
91
+ "version": "1.0.0",
92
+ "description": "OAuth2 flow with Google/GitHub providers, JWT token lifecycle, session management via NextAuth.js, route protection middleware, and role-based access control.",
93
+ "tags": ["oauth2", "jwt", "session-management", "rbac"]
94
+ }
95
+ ]
96
+ }
97
+ ```
98
+
99
+ The `description` field is critical — write it rich enough that you can route any user question to the right doc by matching against descriptions. Include specific technology names, patterns, and concepts.
100
+
101
+ ### Step 5 — Self-Review
102
+
103
+ Before finishing, verify:
104
+
105
+ - [ ] Every doc has at least one mermaid diagram in "How It Works"
106
+ - [ ] Every doc has at least 2 entries in "Constraints & Decisions"
107
+ - [ ] Every doc's "Key Files" lists real paths that exist in the codebase
108
+ - [ ] Every doc's "Configuration" lists actual env vars from the code
109
+ - [ ] Every doc's "Related Features" references other doc filenames
110
+ - [ ] Manifest `description` is detailed enough for semantic routing
111
+ - [ ] No doc is just a shallow restatement of file names — each explains WHY and HOW
112
+
113
+ ---
114
+
115
+ ## Mode 2: Audit
116
+
117
+ **Trigger:** `/vdoc audit` or user says "audit docs"
118
+
119
+ ### Step 1 — Read Current State
120
+
121
+ Read `vdocs/_manifest.json`. Load the list of documented features and their source files.
122
+
123
+ ### Step 2 — Detect Changes
124
+
125
+ Run `git log --name-only --since="<last_updated>" --pretty=format:""` or use `git diff` to find all source files that changed since the last audit.
126
+
127
+ Cross-reference changed files against each doc's "Key Files" section to identify which docs are stale.
128
+
129
+ ### Step 3 — Detect Coverage Gaps
130
+
131
+ Scan the codebase for significant features not covered by any doc. Look for:
132
+ - New route files / API endpoints
133
+ - New service classes or modules
134
+ - New database models / schema changes
135
+ - New configuration or infrastructure files
136
+
137
+ If you find undocumented features, propose new docs.
138
+
139
+ ### Step 4 — Detect Dead Docs
140
+
141
+ Check each doc's "Key Files" section against the actual filesystem. If key files no longer exist, the doc may be dead. Flag it: "PAYMENT_PROCESSING_DOC.md references 3 files that no longer exist — remove or archive?"
142
+
143
+ ### Step 5 — Check Cross-References
144
+
145
+ Read each doc's "Related Features" section. Verify that:
146
+ - Referenced doc filenames still exist
147
+ - The described coupling is still accurate (skim the relevant code)
148
+
149
+ ### Step 6 — Report
150
+
151
+ Present a clear report:
152
+
153
+ ```
154
+ Audit Results:
155
+
156
+ STALE (source files changed):
157
+ - AUTHENTICATION_DOC.md — src/lib/auth.ts changed (added GitHub provider)
158
+ - API_REFERENCE_DOC.md — 2 new endpoints added
159
+
160
+ COVERAGE GAPS (undocumented features):
161
+ - src/services/notification.ts — no doc covers notifications
162
+
163
+ DEAD DOCS (source files removed):
164
+ - LEGACY_ADMIN_DOC.md — all 4 source files deleted
165
+
166
+ CROSS-REF ISSUES:
167
+ - AUTHENTICATION_DOC.md references BILLING_DOC.md which no longer exists
168
+
169
+ CURRENT (no changes needed):
170
+ - DATABASE_SCHEMA_DOC.md
171
+ - PROJECT_OVERVIEW_DOC.md
172
+
173
+ Proceed with fixes?
174
+ ```
175
+
176
+ Wait for user direction, then:
177
+ - Patch stale docs (re-read source files, update affected sections only)
178
+ - Generate new docs for coverage gaps (follow init workflow for each)
179
+ - Flag dead docs for user to confirm deletion
180
+ - Fix cross-reference issues
181
+ - Update manifest: bump versions, update `last_updated`, `last_commit`
182
+
183
+ ---
184
+
185
+ ## Mode 3: Query
186
+
187
+ **Trigger:** User asks any question about the codebase or its documentation.
188
+
189
+ 1. Read `vdocs/_manifest.json`
190
+ 2. Match the question against `description` and `tags` fields
191
+ 3. Read the matching doc(s)
192
+ 4. Answer from the documented knowledge
193
+ 5. If no doc matches, say so and suggest running `/vdoc audit` to check for coverage gaps
194
+
195
+ ---
196
+
197
+ ## Naming Convention
198
+
199
+ Files: `FEATURE_NAME_DOC.md` — uppercase, feature-named, `_DOC` suffix.
200
+
201
+ Examples: `PROJECT_OVERVIEW_DOC.md`, `AUTHENTICATION_DOC.md`, `API_REFERENCE_DOC.md`, `DATABASE_SCHEMA_DOC.md`, `PAYMENT_PROCESSING_DOC.md`
202
+
203
+ ---
204
+
205
+ ## Rules
206
+
207
+ 1. **Feature-centric, not file-centric.** One doc per logical feature, not per source file. A feature may span 20 files.
208
+ 2. **Mermaid over prose.** If you can diagram it, diagram it. Max 7-9 nodes per diagram — split larger flows.
209
+ 3. **Constraints are gold.** The "Constraints & Decisions" section prevents future developers (and AI agents) from breaking things. Always fill it.
210
+ 4. **Rich manifest descriptions.** The description is a semantic search index. Pack it with specific terms, technology names, and concepts.
211
+ 5. **No hallucination.** Only document what exists in the code. If you're unsure about a decision's rationale, say "Reason: unknown — verify with team" rather than guessing.
212
+ 6. **Plan first, always.** Never generate docs without user-approved plan. Even in audit mode, report before patching.
@@ -0,0 +1,67 @@
1
+ # {Feature Title}
2
+
3
+ > {One-line description of what this covers}
4
+
5
+ ---
6
+
7
+ ## Overview
8
+
9
+ {What it does, why it exists, how it fits in the system.}
10
+
11
+ ---
12
+
13
+ ## How It Works
14
+
15
+ {Core logic and flow.}
16
+
17
+ {Mermaid diagram(s) — max 7-9 nodes per diagram, split into multiple if larger.}
18
+
19
+ ---
20
+
21
+ ## Data Model
22
+
23
+ {Entities this feature owns and their relationships. Mermaid ER diagram or table.}
24
+
25
+ ---
26
+
27
+ ## Key Files
28
+
29
+ | File | Purpose |
30
+ |------|---------|
31
+ | `src/path/file.ts` | What this file does |
32
+
33
+ ---
34
+
35
+ ## Dependencies & Integrations
36
+
37
+ {External services, internal features, packages this relies on.}
38
+
39
+ ---
40
+
41
+ ## Configuration
42
+
43
+ | Variable | Purpose | Required |
44
+ |----------|---------|----------|
45
+ | `ENV_VAR` | What it controls | Yes/No |
46
+
47
+ ---
48
+
49
+ ## Error Handling
50
+
51
+ {Failure modes, what the user sees, retry logic. Mermaid diagram if the error flow is non-trivial.}
52
+
53
+ ---
54
+
55
+ ## Constraints & Decisions
56
+
57
+ {Why it's built this way. What you CANNOT change without breaking things.}
58
+
59
+ ---
60
+
61
+ ## Related Features
62
+
63
+ {Cross-references to other docs by filename. Blast radius — what breaks if this changes.}
64
+
65
+ ---
66
+
67
+ *Generated by vdoc v3.0.0 • Last updated: {timestamp}*
@@ -0,0 +1,16 @@
1
+ {
2
+ "project": "<project-name>",
3
+ "vdoc_version": "3.0.0",
4
+ "created_at": "<ISO-8601>",
5
+ "last_updated": "<ISO-8601>",
6
+ "last_commit": "<short-sha>",
7
+ "documentation": [
8
+ {
9
+ "filepath": "FEATURE_NAME_DOC.md",
10
+ "title": "Human-Readable Feature Title",
11
+ "version": "1.0.0",
12
+ "description": "Rich semantic description with specific technology names, patterns, and concepts. Detailed enough that an AI can route any user question to this doc by matching against this field.",
13
+ "tags": ["keyword-1", "keyword-2"]
14
+ }
15
+ ]
16
+ }
@@ -0,0 +1,27 @@
1
+ # /vdoc — Documentation Generator
2
+
3
+ Run documentation workflows for this project. Full instructions are in `.clinerules/vdoc.md`.
4
+
5
+ ## Determine Mode
6
+
7
+ Check if `vdocs/_manifest.json` exists:
8
+ - **No manifest** → run Init mode
9
+ - **Manifest exists** → run Audit mode
10
+
11
+ ## Init Mode
12
+
13
+ 1. **Explore** — Read the codebase: tech stack, features, architecture, integrations, entry points. Use `read_file` and `list_files` to explore thoroughly.
14
+ 2. **Plan** — Create `vdocs/_DOCUMENTATION_PLAN.md` listing proposed docs. Present to user via `ask_followup_question`. Wait for approval.
15
+ 3. **Generate** — For each doc, read ALL relevant source files. Write `vdocs/FEATURE_NAME_DOC.md` using `write_to_file`, following the template in `.clinerules/vdoc.md`.
16
+ 4. **Manifest** — Create `vdocs/_manifest.json` with rich semantic descriptions.
17
+ 5. **Verify** — Every doc has mermaid diagrams, real paths, 2+ constraints, cross-references.
18
+
19
+ ## Audit Mode
20
+
21
+ 1. Read `vdocs/_manifest.json`
22
+ 2. **Stale** — Run `execute_command` with `git log --name-only --since="<last_updated>"`. Cross-ref with each doc's "Key Files" section.
23
+ 3. **Gaps** — Find undocumented features (new routes, services, models)
24
+ 4. **Dead** — Docs referencing deleted files
25
+ 5. **Cross-refs** — Verify Related Features links still valid
26
+ 6. **Report** — Present findings via `ask_followup_question`, wait for user direction
27
+ 7. **Patch** — Update stale docs, generate gaps, fix cross-refs, update manifest
@@ -0,0 +1,175 @@
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)."
3
+ globs: "vdocs/**"
4
+ ---
5
+
6
+ # vdoc — Documentation Generator
7
+
8
+ You generate and maintain feature-centric documentation for codebases. You have three modes: **init**, **audit**, and **query**.
9
+
10
+ All documentation lives in `vdocs/` at the project root. The manifest at `vdocs/_manifest.json` is the semantic index you read first.
11
+
12
+ ---
13
+
14
+ ## Mode 1: Init
15
+
16
+ **Trigger:** User says "document this project" or similar.
17
+
18
+ ### Step 1 — Explore
19
+
20
+ Read the codebase thoroughly. Identify:
21
+
22
+ - **Tech stack**: languages, frameworks, databases, ORMs
23
+ - **Features**: authentication, API, payments, notifications, search, etc.
24
+ - **Architecture**: monolith vs microservices, frontend/backend split, key patterns
25
+ - **Integrations**: third-party services (Stripe, AWS, Redis, etc.)
26
+ - **Entry points**: where requests come in, how they flow through the system
27
+
28
+ Do not skim. Read key files — entry points, config, routes, schemas, middleware.
29
+
30
+ ### Step 2 — Plan
31
+
32
+ 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.
33
+
34
+ ### Step 3 — Generate
35
+
36
+ For each approved doc, read ALL relevant source files and generate using this template:
37
+
38
+ ```markdown
39
+ # {Feature Title}
40
+
41
+ > {One-line description}
42
+
43
+ ---
44
+
45
+ ## Overview
46
+ {What it does, why it exists, how it fits in the system.}
47
+
48
+ ---
49
+
50
+ ## How It Works
51
+ {Core logic and flow.}
52
+ {Mermaid diagram(s) — max 7-9 nodes per diagram, split if larger.}
53
+
54
+ ---
55
+
56
+ ## Data Model
57
+ {Entities this feature owns. Mermaid ER diagram or table.}
58
+
59
+ ---
60
+
61
+ ## Key Files
62
+ | File | Purpose |
63
+ |------|---------|
64
+ | `src/path/file.ts` | What this file does |
65
+
66
+ ---
67
+
68
+ ## Dependencies & Integrations
69
+ {External services, internal features, packages this relies on.}
70
+
71
+ ---
72
+
73
+ ## Configuration
74
+ | Variable | Purpose | Required |
75
+ |----------|---------|----------|
76
+ | `ENV_VAR` | What it controls | Yes/No |
77
+
78
+ ---
79
+
80
+ ## Error Handling
81
+ {Failure modes, what the user sees, retry logic. Mermaid diagram if non-trivial.}
82
+
83
+ ---
84
+
85
+ ## Constraints & Decisions
86
+ {Why it's built this way. What you CANNOT change without breaking things.}
87
+
88
+ ---
89
+
90
+ ## Related Features
91
+ {Cross-references to other docs by filename. Blast radius notes.}
92
+
93
+ ---
94
+
95
+ *Generated by vdoc v3.0.0 • Last updated: {timestamp}*
96
+ ```
97
+
98
+ **Writing rules:**
99
+
100
+ - **Mermaid diagrams are mandatory** in "How It Works". Max 7-9 nodes — split larger flows.
101
+ - **Data Model** must show real entities from the code, not placeholders.
102
+ - **Constraints & Decisions** is the most valuable section. Dig for non-obvious choices. If unclear, write: `Reason: unknown — verify with team`.
103
+ - **Related Features** must reference other doc filenames and explain coupling.
104
+ - **Configuration** must list actual env vars from the code.
105
+ - **Error Handling** — trace what happens when things fail.
106
+
107
+ ### Step 4 — Manifest
108
+
109
+ Create `vdocs/_manifest.json`:
110
+
111
+ ```json
112
+ {
113
+ "project": "<project-name>",
114
+ "vdoc_version": "3.0.0",
115
+ "created_at": "<ISO-8601>",
116
+ "last_updated": "<ISO-8601>",
117
+ "last_commit": "<short-sha>",
118
+ "documentation": [
119
+ {
120
+ "filepath": "FEATURE_NAME_DOC.md",
121
+ "title": "Human-Readable Title",
122
+ "version": "1.0.0",
123
+ "description": "Rich semantic description with technology names, patterns, concepts. Detailed enough for AI to route questions to this doc.",
124
+ "tags": ["keyword-tag"]
125
+ }
126
+ ]
127
+ }
128
+ ```
129
+
130
+ ### Step 5 — Self-Review
131
+
132
+ 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.
133
+
134
+ ---
135
+
136
+ ## Mode 2: Audit
137
+
138
+ **Trigger:** User says "audit docs" or similar.
139
+
140
+ 1. **Read manifest** — load `vdocs/_manifest.json`
141
+ 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.
142
+ 3. **Detect gaps** — scan codebase for significant source files not covered by any doc (new routes, services, models, config).
143
+ 4. **Detect dead docs** — check each doc's "Key Files" against filesystem. Flag docs referencing deleted files.
144
+ 5. **Check cross-refs** — verify "Related Features" links still exist and coupling is accurate.
145
+ 6. **Report** — present stale, gaps, dead, cross-ref issues, and current docs. Wait for user direction.
146
+ 7. **Patch** — update stale docs, generate new docs for gaps, flag dead docs, fix cross-refs. Update manifest.
147
+
148
+ ---
149
+
150
+ ## Mode 3: Query
151
+
152
+ **Trigger:** User asks any question about the codebase or documentation.
153
+
154
+ 1. Read `vdocs/_manifest.json`
155
+ 2. Match question against `description` and `tags` fields
156
+ 3. Read matching doc(s)
157
+ 4. Answer from documented knowledge
158
+ 5. If no match, suggest running an audit
159
+
160
+ ---
161
+
162
+ ## Naming Convention
163
+
164
+ Files: `FEATURE_NAME_DOC.md` — uppercase, feature-named, `_DOC` suffix.
165
+
166
+ ---
167
+
168
+ ## Rules
169
+
170
+ 1. **Feature-centric, not file-centric.** One doc per logical feature, not per source file.
171
+ 2. **Mermaid over prose.** Diagram flows. Max 7-9 nodes per diagram.
172
+ 3. **Constraints are gold.** Always fill "Constraints & Decisions".
173
+ 4. **Rich manifest descriptions.** Pack with specific terms for semantic routing.
174
+ 5. **No hallucination.** Only document what exists in code.
175
+ 6. **Plan first, always.** Never generate without user-approved plan.
@@ -0,0 +1,29 @@
1
+ ---
2
+ name: vdoc
3
+ description: "Generate and maintain feature-centric product documentation"
4
+ invokable: true
5
+ ---
6
+
7
+ # /vdoc — Documentation Generator
8
+
9
+ Run documentation workflows for this project. Full instructions are in `.continue/rules/vdoc.md`.
10
+
11
+ **Arguments:** $ARGUMENTS
12
+
13
+ ## If `init` or no `vdocs/` folder exists:
14
+
15
+ 1. **Explore** — Read the codebase: tech stack, features, architecture, integrations, entry points. Read actual files.
16
+ 2. **Plan** — Create `vdocs/_DOCUMENTATION_PLAN.md` listing proposed docs. Present to user. Wait for approval.
17
+ 3. **Generate** — For each doc, read ALL relevant source files. Write `vdocs/FEATURE_NAME_DOC.md` following the template in `.continue/rules/vdoc.md`.
18
+ 4. **Manifest** — Create `vdocs/_manifest.json` with rich semantic descriptions.
19
+ 5. **Verify** — Every doc has mermaid diagrams, real paths, 2+ constraints, cross-references.
20
+
21
+ ## If `audit` or `vdocs/` already exists:
22
+
23
+ 1. Read `vdocs/_manifest.json`
24
+ 2. **Stale** — git diff since `last_updated`, cross-ref with each doc's "Key Files" section
25
+ 3. **Gaps** — undocumented features (new routes, services, models)
26
+ 4. **Dead** — docs referencing deleted files
27
+ 5. **Cross-refs** — verify Related Features links
28
+ 6. **Report** — present findings, wait for user direction
29
+ 7. **Patch** — update stale, generate gaps, fix cross-refs, update manifest