@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
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Sandro Sulaberidze
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
# vdoc
|
|
2
|
+
|
|
3
|
+
**Documentation skills for AI coding agents.**
|
|
4
|
+
|
|
5
|
+
One install command. Your AI handles the rest.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## What is vdoc?
|
|
10
|
+
|
|
11
|
+
vdoc teaches your AI coding agent how to create and maintain feature-centric documentation for your codebase. It's not a CLI you run — it's a skill file that gets installed into your AI platform. After install, you just talk to your AI.
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
/vdoc init → AI explores codebase → proposes plan → you approve → generates docs
|
|
15
|
+
/vdoc audit → AI detects stale, missing, dead docs → reports → patches
|
|
16
|
+
"how does auth work?" → AI reads manifest → routes to right doc → answers
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Quick Start
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npx vdoc install cursor
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Then open Cursor and type: **`/vdoc init`**
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Supported Platforms
|
|
32
|
+
|
|
33
|
+
| Platform | Install Command | `/vdoc` Command | Invocation |
|
|
34
|
+
|----------|----------------|----------------|------------|
|
|
35
|
+
| **Claude Code** | `npx vdoc install claude` | `/vdoc init` `/vdoc audit` | Skill (SKILL.md) |
|
|
36
|
+
| **Cursor** | `npx vdoc install cursor` | `/vdoc init` `/vdoc audit` | Command + Rule |
|
|
37
|
+
| **Windsurf** | `npx vdoc install windsurf` | `/vdoc` | Workflow + Rule |
|
|
38
|
+
| **VS Code (Copilot)** | `npx vdoc install vscode` | `/vdoc` | Prompt + Instructions |
|
|
39
|
+
| **Continue** | `npx vdoc install continue` | `/vdoc init` `/vdoc audit` | Invokable Prompt + Rule |
|
|
40
|
+
| **Cline** | `npx vdoc install cline` | `/vdoc` | Workflow + Rule |
|
|
41
|
+
| **Gemini CLI** | `npx vdoc install gemini` | `/vdoc init` `/vdoc audit` | TOML Command + GEMINI.md |
|
|
42
|
+
| **JetBrains AI** | `npx vdoc install jetbrains` | Natural language | Rule only |
|
|
43
|
+
| **JetBrains Junie** | `npx vdoc install junie` | Natural language | Guidelines only |
|
|
44
|
+
| **Universal** | `npx vdoc install agents` | Natural language | AGENTS.md |
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## How It Works
|
|
49
|
+
|
|
50
|
+
### 1. Install (~5 seconds)
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
npx vdoc install claude
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Copies skill files to your AI platform's rules and commands locations. That's it.
|
|
57
|
+
|
|
58
|
+
### 2. Init
|
|
59
|
+
|
|
60
|
+
Type **`/vdoc init`** in your AI tool (or say "document this project"). The skill tells the AI to:
|
|
61
|
+
|
|
62
|
+
1. **Explore** — identify features, tech stack, architecture
|
|
63
|
+
2. **Plan** — propose a documentation plan for your approval
|
|
64
|
+
3. **Generate** — create feature-centric docs using a consistent template
|
|
65
|
+
4. **Index** — build a semantic manifest for future queries
|
|
66
|
+
|
|
67
|
+
### 3. Audit
|
|
68
|
+
|
|
69
|
+
Type **`/vdoc audit`** (or say "audit docs"). The AI detects what changed via git, finds coverage gaps, flags dead docs, checks cross-references, reports everything, and patches only what you approve.
|
|
70
|
+
|
|
71
|
+
### 4. Query
|
|
72
|
+
|
|
73
|
+
Ask any question. The AI reads the manifest, routes to the right doc, and answers from documented knowledge.
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## What Gets Created
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
your-project/
|
|
81
|
+
└── vdocs/
|
|
82
|
+
├── _manifest.json ← Semantic index (AI reads first)
|
|
83
|
+
├── _DOCUMENTATION_PLAN.md ← Approved plan (kept for reference)
|
|
84
|
+
├── PROJECT_OVERVIEW_DOC.md
|
|
85
|
+
├── AUTHENTICATION_DOC.md
|
|
86
|
+
├── API_REFERENCE_DOC.md
|
|
87
|
+
├── DATABASE_SCHEMA_DOC.md
|
|
88
|
+
└── ...
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Docs are **feature-centric** — organized by what your system does, not by file paths.
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## Documentation Template
|
|
96
|
+
|
|
97
|
+
Every generated doc follows a consistent structure:
|
|
98
|
+
|
|
99
|
+
- **Overview** — what it does, why it exists
|
|
100
|
+
- **How It Works** — core logic with mermaid diagrams (max 7-9 nodes per diagram)
|
|
101
|
+
- **Data Model** — entities and relationships
|
|
102
|
+
- **Key Files** — source files that implement this feature
|
|
103
|
+
- **Dependencies & Integrations** — external services, internal features
|
|
104
|
+
- **Configuration** — env vars, feature flags, secrets
|
|
105
|
+
- **Error Handling** — failure modes and user-facing behavior
|
|
106
|
+
- **Constraints & Decisions** — why it's built this way, what you can't change
|
|
107
|
+
- **Related Features** — cross-references and blast radius
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
## Manifest
|
|
112
|
+
|
|
113
|
+
The `_manifest.json` acts as a semantic index. Each entry has a rich `description` field that AI uses to route queries to the right doc:
|
|
114
|
+
|
|
115
|
+
```json
|
|
116
|
+
{
|
|
117
|
+
"documentation": [
|
|
118
|
+
{
|
|
119
|
+
"filepath": "AUTHENTICATION_DOC.md",
|
|
120
|
+
"title": "Authentication - OAuth2 & JWT",
|
|
121
|
+
"version": "1.0.0",
|
|
122
|
+
"description": "OAuth2 flow with Google/GitHub providers, JWT lifecycle, session management via NextAuth.js, route protection middleware, and role-based access control.",
|
|
123
|
+
"tags": ["oauth2", "jwt", "session-management", "rbac"]
|
|
124
|
+
}
|
|
125
|
+
]
|
|
126
|
+
}
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
## Uninstall
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
npx vdoc uninstall
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Removes all vdoc skill and rule files from **every** supported platform in one command. No platform argument needed — it scans for and deletes everything vdoc may have created:
|
|
138
|
+
|
|
139
|
+
| Platform | Files Removed |
|
|
140
|
+
|----------|--------------|
|
|
141
|
+
| Claude Code | `.claude/skills/vdoc/` |
|
|
142
|
+
| Cursor | `.cursor/rules/vdoc.mdc`, `.cursor/commands/vdoc.md` |
|
|
143
|
+
| Windsurf | `.windsurf/rules/vdoc.md`, `.windsurf/workflows/vdoc.md` |
|
|
144
|
+
| VS Code (Copilot) | `.github/instructions/vdoc.instructions.md`, `.github/prompts/vdoc.prompt.md` |
|
|
145
|
+
| Continue | `.continue/rules/vdoc.md`, `.continue/prompts/vdoc-command.md` |
|
|
146
|
+
| Cline | `.clinerules/vdoc.md`, `.clinerules/workflows/vdoc.md` |
|
|
147
|
+
| Gemini CLI | `.gemini/commands/vdoc.toml` |
|
|
148
|
+
| JetBrains AI | `.aiassistant/rules/vdoc.md` |
|
|
149
|
+
| Universal | `AGENTS.md` (vdoc section only) |
|
|
150
|
+
|
|
151
|
+
For files shared with other tools (`GEMINI.md`, `.junie/guidelines.md`, `.github/copilot-instructions.md`), only the vdoc-injected section is removed.
|
|
152
|
+
|
|
153
|
+
Your `vdocs/` documentation folder is **always kept intact**.
|
|
154
|
+
|
|
155
|
+
---
|
|
156
|
+
|
|
157
|
+
## Requirements
|
|
158
|
+
|
|
159
|
+
None. Your AI coding agent is the runtime.
|
|
160
|
+
|
|
161
|
+
---
|
|
162
|
+
|
|
163
|
+
## License
|
|
164
|
+
|
|
165
|
+
[MIT](LICENSE)
|
|
166
|
+
|
|
167
|
+
---
|
|
168
|
+
|
|
169
|
+
*vdoc v3.0.0 — Documentation skills for AI coding agents*
|
package/bin/vdoc.mjs
ADDED
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { readFileSync, writeFileSync, mkdirSync, unlinkSync, rmSync, existsSync, readdirSync, statSync } from 'fs';
|
|
4
|
+
import { join, dirname, resolve } from 'path';
|
|
5
|
+
import { fileURLToPath } from 'url';
|
|
6
|
+
|
|
7
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
8
|
+
const SKILLS = resolve(__dirname, '..', 'skills');
|
|
9
|
+
const CWD = process.cwd();
|
|
10
|
+
|
|
11
|
+
// ── Platform mappings ──────────────────────────────────────────────
|
|
12
|
+
|
|
13
|
+
const PLATFORMS = {
|
|
14
|
+
claude: {
|
|
15
|
+
files: [
|
|
16
|
+
{ src: 'claude/SKILL.md', dest: '.claude/skills/vdoc/SKILL.md' },
|
|
17
|
+
{ src: 'claude/references/doc-template.md', dest: '.claude/skills/vdoc/references/doc-template.md' },
|
|
18
|
+
{ src: 'claude/references/manifest-schema.json', dest: '.claude/skills/vdoc/references/manifest-schema.json' },
|
|
19
|
+
],
|
|
20
|
+
},
|
|
21
|
+
cursor: {
|
|
22
|
+
files: [
|
|
23
|
+
{ src: 'cursor/vdoc.mdc', dest: '.cursor/rules/vdoc.mdc' },
|
|
24
|
+
{ src: 'cursor/vdoc-command.md', dest: '.cursor/commands/vdoc.md' },
|
|
25
|
+
],
|
|
26
|
+
},
|
|
27
|
+
windsurf: {
|
|
28
|
+
files: [
|
|
29
|
+
{ src: 'windsurf/vdoc.md', dest: '.windsurf/rules/vdoc.md' },
|
|
30
|
+
{ src: 'windsurf/vdoc-workflow.md', dest: '.windsurf/workflows/vdoc.md' },
|
|
31
|
+
],
|
|
32
|
+
},
|
|
33
|
+
vscode: {
|
|
34
|
+
files: [
|
|
35
|
+
{ src: 'vscode/vdoc.instructions.md', dest: '.github/instructions/vdoc.instructions.md' },
|
|
36
|
+
{ src: 'vscode/vdoc.prompt.md', dest: '.github/prompts/vdoc.prompt.md' },
|
|
37
|
+
{ src: 'vscode/copilot-instructions.md', dest: '.github/copilot-instructions.md', inject: true },
|
|
38
|
+
],
|
|
39
|
+
},
|
|
40
|
+
continue: {
|
|
41
|
+
files: [
|
|
42
|
+
{ src: 'continue/vdoc.md', dest: '.continue/rules/vdoc.md' },
|
|
43
|
+
{ src: 'continue/vdoc-command.md', dest: '.continue/prompts/vdoc-command.md' },
|
|
44
|
+
],
|
|
45
|
+
},
|
|
46
|
+
cline: {
|
|
47
|
+
files: [
|
|
48
|
+
{ src: 'cline/vdoc.md', dest: '.clinerules/vdoc.md' },
|
|
49
|
+
{ src: 'cline/vdoc-workflow.md', dest: '.clinerules/workflows/vdoc.md' },
|
|
50
|
+
],
|
|
51
|
+
},
|
|
52
|
+
gemini: {
|
|
53
|
+
files: [
|
|
54
|
+
{ src: 'gemini/vdoc.toml', dest: '.gemini/commands/vdoc.toml' },
|
|
55
|
+
{ src: 'gemini/GEMINI.md', dest: 'GEMINI.md', inject: true },
|
|
56
|
+
],
|
|
57
|
+
},
|
|
58
|
+
jetbrains: {
|
|
59
|
+
files: [
|
|
60
|
+
{ src: 'jetbrains-ai/vdoc.md', dest: '.aiassistant/rules/vdoc.md' },
|
|
61
|
+
],
|
|
62
|
+
},
|
|
63
|
+
junie: {
|
|
64
|
+
files: [
|
|
65
|
+
{ src: 'junie/guidelines.md', dest: '.junie/guidelines.md', inject: true },
|
|
66
|
+
],
|
|
67
|
+
},
|
|
68
|
+
agents: {
|
|
69
|
+
files: [
|
|
70
|
+
{ src: 'agents/AGENTS.md', dest: 'AGENTS.md', inject: true },
|
|
71
|
+
],
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
const MARKER_START = '<!-- vdoc:start -->';
|
|
76
|
+
const MARKER_END = '<!-- vdoc:end -->';
|
|
77
|
+
|
|
78
|
+
// ── Helpers ────────────────────────────────────────────────────────
|
|
79
|
+
|
|
80
|
+
function copyFile(src, dest) {
|
|
81
|
+
const srcPath = join(SKILLS, src);
|
|
82
|
+
const destPath = join(CWD, dest);
|
|
83
|
+
mkdirSync(dirname(destPath), { recursive: true });
|
|
84
|
+
writeFileSync(destPath, readFileSync(srcPath));
|
|
85
|
+
console.log(` ✓ ${dest}`);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function injectFile(src, dest) {
|
|
89
|
+
const srcPath = join(SKILLS, src);
|
|
90
|
+
const destPath = join(CWD, dest);
|
|
91
|
+
const content = readFileSync(srcPath, 'utf8');
|
|
92
|
+
|
|
93
|
+
// Ensure content has markers
|
|
94
|
+
const injection = content.includes(MARKER_START)
|
|
95
|
+
? content
|
|
96
|
+
: `${MARKER_START}\n${content}\n${MARKER_END}`;
|
|
97
|
+
|
|
98
|
+
if (existsSync(destPath)) {
|
|
99
|
+
const existing = readFileSync(destPath, 'utf8');
|
|
100
|
+
const startIdx = existing.indexOf(MARKER_START);
|
|
101
|
+
const endIdx = existing.indexOf(MARKER_END);
|
|
102
|
+
|
|
103
|
+
if (startIdx !== -1 && endIdx !== -1) {
|
|
104
|
+
// Replace between markers
|
|
105
|
+
const before = existing.slice(0, startIdx);
|
|
106
|
+
const after = existing.slice(endIdx + MARKER_END.length);
|
|
107
|
+
writeFileSync(destPath, before + injection + after);
|
|
108
|
+
} else {
|
|
109
|
+
// Append
|
|
110
|
+
writeFileSync(destPath, existing.trimEnd() + '\n\n' + injection + '\n');
|
|
111
|
+
}
|
|
112
|
+
} else {
|
|
113
|
+
mkdirSync(dirname(destPath), { recursive: true });
|
|
114
|
+
writeFileSync(destPath, injection.endsWith('\n') ? injection : injection + '\n');
|
|
115
|
+
}
|
|
116
|
+
console.log(` ✓ ${dest} (injected)`);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function removeFile(dest) {
|
|
120
|
+
const destPath = join(CWD, dest);
|
|
121
|
+
if (existsSync(destPath)) {
|
|
122
|
+
unlinkSync(destPath);
|
|
123
|
+
console.log(` ✓ removed ${dest}`);
|
|
124
|
+
cleanEmptyDirs(dirname(destPath));
|
|
125
|
+
return true;
|
|
126
|
+
}
|
|
127
|
+
return false;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
function uninjectFile(dest) {
|
|
131
|
+
const destPath = join(CWD, dest);
|
|
132
|
+
if (!existsSync(destPath)) return false;
|
|
133
|
+
|
|
134
|
+
const content = readFileSync(destPath, 'utf8');
|
|
135
|
+
const startIdx = content.indexOf(MARKER_START);
|
|
136
|
+
const endIdx = content.indexOf(MARKER_END);
|
|
137
|
+
|
|
138
|
+
if (startIdx === -1 || endIdx === -1) return false;
|
|
139
|
+
|
|
140
|
+
const before = content.slice(0, startIdx);
|
|
141
|
+
const after = content.slice(endIdx + MARKER_END.length);
|
|
142
|
+
const remaining = (before + after).trim();
|
|
143
|
+
|
|
144
|
+
if (remaining.length === 0) {
|
|
145
|
+
unlinkSync(destPath);
|
|
146
|
+
console.log(` ✓ removed ${dest}`);
|
|
147
|
+
cleanEmptyDirs(dirname(destPath));
|
|
148
|
+
} else {
|
|
149
|
+
writeFileSync(destPath, remaining + '\n');
|
|
150
|
+
console.log(` ✓ cleaned vdoc section from ${dest}`);
|
|
151
|
+
}
|
|
152
|
+
return true;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
function cleanEmptyDirs(dir) {
|
|
156
|
+
// Don't clean above CWD
|
|
157
|
+
if (!dir.startsWith(CWD) || dir === CWD) return;
|
|
158
|
+
try {
|
|
159
|
+
const entries = readdirSync(dir);
|
|
160
|
+
if (entries.length === 0) {
|
|
161
|
+
rmSync(dir);
|
|
162
|
+
cleanEmptyDirs(dirname(dir));
|
|
163
|
+
}
|
|
164
|
+
} catch { /* ignore */ }
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
function isDirEmpty(dir) {
|
|
168
|
+
try {
|
|
169
|
+
return readdirSync(dir).length === 0;
|
|
170
|
+
} catch { return true; }
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// ── Commands ───────────────────────────────────────────────────────
|
|
174
|
+
|
|
175
|
+
function install(platform) {
|
|
176
|
+
const config = PLATFORMS[platform];
|
|
177
|
+
if (!config) {
|
|
178
|
+
console.error(`Unknown platform: ${platform}`);
|
|
179
|
+
console.error(`Supported: ${Object.keys(PLATFORMS).join(', ')}`);
|
|
180
|
+
process.exit(1);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
console.log(`\nvdoc → installing for ${platform}\n`);
|
|
184
|
+
|
|
185
|
+
for (const file of config.files) {
|
|
186
|
+
if (file.inject) {
|
|
187
|
+
injectFile(file.src, file.dest);
|
|
188
|
+
} else {
|
|
189
|
+
copyFile(file.src, file.dest);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
console.log(`\nDone. Open your AI tool and type: /vdoc init\n`);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
function uninstall() {
|
|
197
|
+
console.log(`\nvdoc → removing all skill files\n`);
|
|
198
|
+
|
|
199
|
+
let removed = 0;
|
|
200
|
+
|
|
201
|
+
for (const [, config] of Object.entries(PLATFORMS)) {
|
|
202
|
+
for (const file of config.files) {
|
|
203
|
+
if (file.inject) {
|
|
204
|
+
if (uninjectFile(file.dest)) removed++;
|
|
205
|
+
} else {
|
|
206
|
+
if (removeFile(file.dest)) removed++;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
// Also clean .claude/skills/vdoc/ directory if it exists
|
|
212
|
+
const claudeSkillDir = join(CWD, '.claude', 'skills', 'vdoc');
|
|
213
|
+
if (existsSync(claudeSkillDir)) {
|
|
214
|
+
rmSync(claudeSkillDir, { recursive: true });
|
|
215
|
+
cleanEmptyDirs(dirname(claudeSkillDir));
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
if (removed === 0) {
|
|
219
|
+
console.log(' No vdoc files found.');
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
console.log(`\nDone. Your vdocs/ documentation folder was kept intact.\n`);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
// ── Main ───────────────────────────────────────────────────────────
|
|
226
|
+
|
|
227
|
+
const [,, command, platform] = process.argv;
|
|
228
|
+
|
|
229
|
+
if (command === 'install' && platform) {
|
|
230
|
+
install(platform);
|
|
231
|
+
} else if (command === 'uninstall') {
|
|
232
|
+
uninstall();
|
|
233
|
+
} else {
|
|
234
|
+
console.log(`
|
|
235
|
+
vdoc v3.0.0 — Documentation skills for AI coding agents
|
|
236
|
+
|
|
237
|
+
Usage:
|
|
238
|
+
npx vdoc install <platform> Install skill files for a platform
|
|
239
|
+
npx vdoc uninstall Remove all vdoc skill files (keeps vdocs/)
|
|
240
|
+
|
|
241
|
+
Platforms:
|
|
242
|
+
${Object.keys(PLATFORMS).join(', ')}
|
|
243
|
+
`);
|
|
244
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@sandrinio/vdoc",
|
|
3
|
+
"version": "3.0.0",
|
|
4
|
+
"description": "Documentation skills for AI coding agents",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"vdoc": "bin/vdoc.mjs"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"bin/",
|
|
11
|
+
"skills/"
|
|
12
|
+
],
|
|
13
|
+
"keywords": [
|
|
14
|
+
"documentation",
|
|
15
|
+
"ai",
|
|
16
|
+
"coding-agent",
|
|
17
|
+
"cursor",
|
|
18
|
+
"claude",
|
|
19
|
+
"copilot",
|
|
20
|
+
"windsurf",
|
|
21
|
+
"cline",
|
|
22
|
+
"continue",
|
|
23
|
+
"gemini"
|
|
24
|
+
],
|
|
25
|
+
"license": "MIT",
|
|
26
|
+
"repository": {
|
|
27
|
+
"type": "git",
|
|
28
|
+
"url": "git+https://github.com/sandrinio/vdoc.git"
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
# vdoc — Documentation Generator
|
|
2
|
+
|
|
3
|
+
You generate and maintain feature-centric documentation for codebases. You have three modes: **init**, **audit**, and **query**.
|
|
4
|
+
|
|
5
|
+
All documentation lives in `vdocs/` at the project root. The manifest at `vdocs/_manifest.json` is the semantic index you read first.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Mode 1: Init
|
|
10
|
+
|
|
11
|
+
**Trigger:** User says "document this project" or similar.
|
|
12
|
+
|
|
13
|
+
### Step 1 — Explore
|
|
14
|
+
|
|
15
|
+
Read the codebase thoroughly. Identify:
|
|
16
|
+
|
|
17
|
+
- **Tech stack**: languages, frameworks, databases, ORMs
|
|
18
|
+
- **Features**: authentication, API, payments, notifications, search, etc.
|
|
19
|
+
- **Architecture**: monolith vs microservices, frontend/backend split, key patterns
|
|
20
|
+
- **Integrations**: third-party services (Stripe, AWS, Redis, etc.)
|
|
21
|
+
- **Entry points**: where requests come in, how they flow through the system
|
|
22
|
+
|
|
23
|
+
Do not skim. Read key files — entry points, config, routes, schemas, middleware.
|
|
24
|
+
|
|
25
|
+
### Step 2 — Plan
|
|
26
|
+
|
|
27
|
+
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.
|
|
28
|
+
|
|
29
|
+
### Step 3 — Generate
|
|
30
|
+
|
|
31
|
+
For each approved doc, read ALL relevant source files and generate using this template:
|
|
32
|
+
|
|
33
|
+
```markdown
|
|
34
|
+
# {Feature Title}
|
|
35
|
+
|
|
36
|
+
> {One-line description}
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## Overview
|
|
41
|
+
{What it does, why it exists, how it fits in the system.}
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## How It Works
|
|
46
|
+
{Core logic and flow.}
|
|
47
|
+
{Mermaid diagram(s) — max 7-9 nodes per diagram, split if larger.}
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## Data Model
|
|
52
|
+
{Entities this feature owns. Mermaid ER diagram or table.}
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## Key Files
|
|
57
|
+
| File | Purpose |
|
|
58
|
+
|------|---------|
|
|
59
|
+
| `src/path/file.ts` | What this file does |
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## Dependencies & Integrations
|
|
64
|
+
{External services, internal features, packages this relies on.}
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## Configuration
|
|
69
|
+
| Variable | Purpose | Required |
|
|
70
|
+
|----------|---------|----------|
|
|
71
|
+
| `ENV_VAR` | What it controls | Yes/No |
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## Error Handling
|
|
76
|
+
{Failure modes, what the user sees, retry logic. Mermaid diagram if non-trivial.}
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
## Constraints & Decisions
|
|
81
|
+
{Why it's built this way. What you CANNOT change without breaking things.}
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## Related Features
|
|
86
|
+
{Cross-references to other docs by filename. Blast radius notes.}
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
*Generated by vdoc v3.0.0 • Last updated: {timestamp}*
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
**Writing rules:**
|
|
94
|
+
|
|
95
|
+
- **Mermaid diagrams are mandatory** in "How It Works". Max 7-9 nodes — split larger flows.
|
|
96
|
+
- **Data Model** must show real entities from the code, not placeholders.
|
|
97
|
+
- **Constraints & Decisions** is the most valuable section. Dig for non-obvious choices. If unclear, write: `Reason: unknown — verify with team`.
|
|
98
|
+
- **Related Features** must reference other doc filenames and explain coupling.
|
|
99
|
+
- **Configuration** must list actual env vars from the code.
|
|
100
|
+
- **Error Handling** — trace what happens when things fail.
|
|
101
|
+
|
|
102
|
+
### Step 4 — Manifest
|
|
103
|
+
|
|
104
|
+
Create `vdocs/_manifest.json`:
|
|
105
|
+
|
|
106
|
+
```json
|
|
107
|
+
{
|
|
108
|
+
"project": "<project-name>",
|
|
109
|
+
"vdoc_version": "3.0.0",
|
|
110
|
+
"created_at": "<ISO-8601>",
|
|
111
|
+
"last_updated": "<ISO-8601>",
|
|
112
|
+
"last_commit": "<short-sha>",
|
|
113
|
+
"documentation": [
|
|
114
|
+
{
|
|
115
|
+
"filepath": "FEATURE_NAME_DOC.md",
|
|
116
|
+
"title": "Human-Readable Title",
|
|
117
|
+
"version": "1.0.0",
|
|
118
|
+
"description": "Rich semantic description with technology names, patterns, concepts. Detailed enough for AI to route questions to this doc.",
|
|
119
|
+
"tags": ["keyword-tag"]
|
|
120
|
+
}
|
|
121
|
+
]
|
|
122
|
+
}
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### Step 5 — Self-Review
|
|
126
|
+
|
|
127
|
+
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.
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
## Mode 2: Audit
|
|
132
|
+
|
|
133
|
+
**Trigger:** User says "audit docs" or similar.
|
|
134
|
+
|
|
135
|
+
1. **Read manifest** — load `vdocs/_manifest.json`
|
|
136
|
+
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.
|
|
137
|
+
3. **Detect gaps** — scan codebase for significant source files not covered by any doc (new routes, services, models, config).
|
|
138
|
+
4. **Detect dead docs** — check each doc's "Key Files" against filesystem. Flag docs referencing deleted files.
|
|
139
|
+
5. **Check cross-refs** — verify "Related Features" links still exist and coupling is accurate.
|
|
140
|
+
6. **Report** — present stale, gaps, dead, cross-ref issues, and current docs. Wait for user direction.
|
|
141
|
+
7. **Patch** — update stale docs, generate new docs for gaps, flag dead docs, fix cross-refs. Update manifest.
|
|
142
|
+
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
## Mode 3: Query
|
|
146
|
+
|
|
147
|
+
**Trigger:** User asks any question about the codebase or documentation.
|
|
148
|
+
|
|
149
|
+
1. Read `vdocs/_manifest.json`
|
|
150
|
+
2. Match question against `description` and `tags` fields
|
|
151
|
+
3. Read matching doc(s)
|
|
152
|
+
4. Answer from documented knowledge
|
|
153
|
+
5. If no match, suggest running an audit
|
|
154
|
+
|
|
155
|
+
---
|
|
156
|
+
|
|
157
|
+
## Naming Convention
|
|
158
|
+
|
|
159
|
+
Files: `FEATURE_NAME_DOC.md` — uppercase, feature-named, `_DOC` suffix.
|
|
160
|
+
|
|
161
|
+
---
|
|
162
|
+
|
|
163
|
+
## Rules
|
|
164
|
+
|
|
165
|
+
1. **Feature-centric, not file-centric.** One doc per logical feature, not per source file.
|
|
166
|
+
2. **Mermaid over prose.** Diagram flows. Max 7-9 nodes per diagram.
|
|
167
|
+
3. **Constraints are gold.** Always fill "Constraints & Decisions".
|
|
168
|
+
4. **Rich manifest descriptions.** Pack with specific terms for semantic routing.
|
|
169
|
+
5. **No hallucination.** Only document what exists in code.
|
|
170
|
+
6. **Plan first, always.** Never generate without user-approved plan.
|