@vibe-agent-toolkit/vat-development-agents 0.1.29 → 0.1.30-rc.2
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/dist/.claude/plugins/marketplaces/vat-skills/CHANGELOG.md +20 -0
- package/dist/.claude/plugins/marketplaces/vat-skills/plugins/vibe-agent-toolkit/.claude-plugin/plugin.json +1 -1
- package/dist/.claude/plugins/marketplaces/vat-skills/plugins/vibe-agent-toolkit/skills/audit/SKILL.md +21 -16
- package/dist/.claude/plugins/marketplaces/vat-skills/plugins/vibe-agent-toolkit/skills/authoring/SKILL.md +30 -12
- package/dist/.claude/plugins/marketplaces/vat-skills/plugins/vibe-agent-toolkit/skills/authoring/resources/skill-quality-checklist.md +42 -0
- package/dist/.claude/plugins/marketplaces/vat-skills/plugins/vibe-agent-toolkit/skills/debugging/SKILL.md +4 -4
- package/dist/.claude/plugins/marketplaces/vat-skills/plugins/vibe-agent-toolkit/skills/vibe-agent-toolkit/SKILL.md +6 -6
- package/dist/generated/resources/skills/vat-agent-authoring.js +3 -3
- package/dist/generated/resources/skills/vat-audit.js +5 -5
- package/dist/skills/audit/SKILL.md +21 -16
- package/dist/skills/authoring/SKILL.md +30 -12
- package/dist/skills/authoring/resources/skill-quality-checklist.md +42 -0
- package/dist/skills/debugging/SKILL.md +4 -4
- package/dist/skills/vibe-agent-toolkit/SKILL.md +6 -6
- package/package.json +4 -4
- package/dist/.claude/plugins/marketplaces/vat-skills/plugins/vibe-agent-toolkit/skills/debugging/resources/CLAUDE.md +0 -539
- package/dist/.claude/plugins/marketplaces/vat-skills/plugins/vibe-agent-toolkit/skills/debugging/resources/debug-and-test-vat-fixes.md +0 -111
- package/dist/.claude/plugins/marketplaces/vat-skills/plugins/vibe-agent-toolkit/skills/debugging/resources/writing-tests.md +0 -577
- package/dist/.claude/plugins/marketplaces/vat-skills/plugins/vibe-agent-toolkit/skills/vibe-agent-toolkit/resources/adding-runtime-adapters.md +0 -628
- package/dist/.claude/plugins/marketplaces/vat-skills/plugins/vibe-agent-toolkit/skills/vibe-agent-toolkit/resources/agent-authoring.md +0 -905
- package/dist/.claude/plugins/marketplaces/vat-skills/plugins/vibe-agent-toolkit/skills/vibe-agent-toolkit/resources/compiling-markdown-to-typescript.md +0 -501
- package/dist/.claude/plugins/marketplaces/vat-skills/plugins/vibe-agent-toolkit/skills/vibe-agent-toolkit/resources/getting-started.md +0 -360
- package/dist/.claude/plugins/marketplaces/vat-skills/plugins/vibe-agent-toolkit/skills/vibe-agent-toolkit/resources/orchestration.md +0 -859
- package/dist/.claude/plugins/marketplaces/vat-skills/plugins/vibe-agent-toolkit/skills/vibe-agent-toolkit/resources/rag-usage-guide.md +0 -770
- package/dist/skills/debugging/resources/CLAUDE.md +0 -539
- package/dist/skills/debugging/resources/debug-and-test-vat-fixes.md +0 -111
- package/dist/skills/debugging/resources/writing-tests.md +0 -577
- package/dist/skills/vibe-agent-toolkit/resources/adding-runtime-adapters.md +0 -628
- package/dist/skills/vibe-agent-toolkit/resources/agent-authoring.md +0 -905
- package/dist/skills/vibe-agent-toolkit/resources/compiling-markdown-to-typescript.md +0 -501
- package/dist/skills/vibe-agent-toolkit/resources/getting-started.md +0 -360
- package/dist/skills/vibe-agent-toolkit/resources/orchestration.md +0 -859
- package/dist/skills/vibe-agent-toolkit/resources/rag-usage-guide.md +0 -770
|
@@ -182,12 +182,12 @@ You've successfully adopted VAT when:
|
|
|
182
182
|
|
|
183
183
|
## Documentation Index
|
|
184
184
|
|
|
185
|
-
-
|
|
186
|
-
-
|
|
187
|
-
-
|
|
188
|
-
-
|
|
189
|
-
-
|
|
190
|
-
-
|
|
185
|
+
- Getting Started Guide
|
|
186
|
+
- Agent Authoring Guide — patterns and code examples
|
|
187
|
+
- Orchestration Guide — multi-agent workflows
|
|
188
|
+
- RAG Usage Guide
|
|
189
|
+
- Resource Compiler Guide
|
|
190
|
+
- Runtime Adapters
|
|
191
191
|
- Examples: `@vibe-agent-toolkit/vat-example-cat-agents`
|
|
192
192
|
|
|
193
193
|
## Running VAT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vibe-agent-toolkit/vat-development-agents",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.30-rc.2",
|
|
4
4
|
"description": "VAT development agents - dogfooding the vibe-agent-toolkit",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
@@ -65,13 +65,13 @@
|
|
|
65
65
|
"postinstall": "vat claude plugin install --npm-postinstall || exit 0"
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
|
-
"@vibe-agent-toolkit/agent-schema": "0.1.
|
|
69
|
-
"@vibe-agent-toolkit/cli": "0.1.
|
|
68
|
+
"@vibe-agent-toolkit/agent-schema": "0.1.30-rc.2",
|
|
69
|
+
"@vibe-agent-toolkit/cli": "0.1.30-rc.2",
|
|
70
70
|
"yaml": "^2.8.2"
|
|
71
71
|
},
|
|
72
72
|
"devDependencies": {
|
|
73
73
|
"@types/node": "^25.0.3",
|
|
74
|
-
"@vibe-agent-toolkit/resource-compiler": "0.1.
|
|
74
|
+
"@vibe-agent-toolkit/resource-compiler": "0.1.30-rc.2",
|
|
75
75
|
"ts-patch": "^3.2.1",
|
|
76
76
|
"typescript": "^5.7.3"
|
|
77
77
|
},
|
|
@@ -1,539 +0,0 @@
|
|
|
1
|
-
# CLI Package Development Guidelines
|
|
2
|
-
|
|
3
|
-
This document provides guidance specific to developing the vat CLI tool.
|
|
4
|
-
|
|
5
|
-
## Running vat Commands in Development
|
|
6
|
-
|
|
7
|
-
**In this monorepo during development**, use one of these approaches to run vat commands:
|
|
8
|
-
|
|
9
|
-
### From Root Directory
|
|
10
|
-
```bash
|
|
11
|
-
# Use the convenience script (recommended)
|
|
12
|
-
bun run vat <command> <args>
|
|
13
|
-
|
|
14
|
-
# Example:
|
|
15
|
-
bun run vat skills build
|
|
16
|
-
bun run vat resources validate docs/
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
### From Package Scripts
|
|
20
|
-
When calling vat from another package's build script, use the relative path:
|
|
21
|
-
|
|
22
|
-
```json
|
|
23
|
-
{
|
|
24
|
-
"scripts": {
|
|
25
|
-
"build": "bun run build:code && node ../cli/dist/bin/vat.js skills build"
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
**Why relative paths?** Workspace bin linking doesn't work reliably across Bun/npm/pnpm. Relative paths work everywhere and make dependencies explicit.
|
|
31
|
-
|
|
32
|
-
### For End Users (Self-Hosting)
|
|
33
|
-
Users who install VAT in their own projects should use:
|
|
34
|
-
|
|
35
|
-
```bash
|
|
36
|
-
# If installed globally
|
|
37
|
-
vat skills build
|
|
38
|
-
|
|
39
|
-
# If installed as dev dependency
|
|
40
|
-
npx vat skills build
|
|
41
|
-
# or
|
|
42
|
-
bunx vat skills build
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
## Debugging VAT Behavior & Testing Fixes
|
|
46
|
-
|
|
47
|
-
When VAT produces unexpected results and you need to test a code change in an adopter
|
|
48
|
-
project, use `VAT_ROOT_DIR` to redirect the installed `vat` binary to your local build:
|
|
49
|
-
|
|
50
|
-
```bash
|
|
51
|
-
export VAT_ROOT_DIR=/path/to/vibe-agent-toolkit
|
|
52
|
-
bun run build # always build first
|
|
53
|
-
cd /path/to/adopter-project
|
|
54
|
-
vat resources validate . # now uses your local build
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
Full debugging guide: [docs/debug-and-test-vat-fixes.md](debug-and-test-vat-fixes.md)
|
|
58
|
-
|
|
59
|
-
## CLI Package Architecture Principles
|
|
60
|
-
|
|
61
|
-
### The CLI Must Remain "Dumb"
|
|
62
|
-
|
|
63
|
-
**Critical Rule**: The CLI package sits at the top of the dependency chain. No other package can depend on it. This means:
|
|
64
|
-
|
|
65
|
-
✅ **CLI SHOULD contain**:
|
|
66
|
-
- Command definitions and argument parsing (Commander.js)
|
|
67
|
-
- User-facing help text and documentation
|
|
68
|
-
- Orchestration logic (calling other packages in sequence)
|
|
69
|
-
- Error handling and user-friendly error messages
|
|
70
|
-
- Output formatting (YAML, progress indicators)
|
|
71
|
-
|
|
72
|
-
❌ **CLI SHOULD NOT contain**:
|
|
73
|
-
- Business logic that other packages might need
|
|
74
|
-
- Path resolution algorithms
|
|
75
|
-
- File system utilities
|
|
76
|
-
- Validation logic
|
|
77
|
-
- Build/conversion logic
|
|
78
|
-
- Any reusable functionality
|
|
79
|
-
|
|
80
|
-
### Why This Matters
|
|
81
|
-
|
|
82
|
-
If you put logic in the CLI that other packages need, you create an impossible dependency situation:
|
|
83
|
-
- Other packages can't depend on CLI (circular dependency)
|
|
84
|
-
- Logic gets duplicated across packages (DRY violation)
|
|
85
|
-
- Changes require coordinating multiple packages
|
|
86
|
-
|
|
87
|
-
### The Right Place for Logic
|
|
88
|
-
|
|
89
|
-
| Logic Type | Wrong Place | Right Place | Why |
|
|
90
|
-
|------------|-------------|-------------|-----|
|
|
91
|
-
| Find agent's package root | CLI | agent-skills or utils | Other runtimes (langchain, etc.) will need this |
|
|
92
|
-
| Determine default output path | CLI | agent-skills | Each runtime knows where its bundles should go |
|
|
93
|
-
| Validate agent manifest | CLI | agent-config | Validation used by all consumers |
|
|
94
|
-
| Parse YAML | CLI | utils or agent-config | Common across many packages |
|
|
95
|
-
| Format user messages | CLI | ✅ CLI is fine | This is CLI-specific UX |
|
|
96
|
-
|
|
97
|
-
### Example: Agent Build Command
|
|
98
|
-
|
|
99
|
-
**Before (WRONG)** - Logic in CLI:
|
|
100
|
-
```typescript
|
|
101
|
-
// packages/cli/src/commands/agent/build.ts
|
|
102
|
-
function findAgentPackageRoot(agentPath: string): string {
|
|
103
|
-
// 50 lines of path-walking logic...
|
|
104
|
-
// ❌ This belongs elsewhere!
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
function determineOutputPath(target: string, agentPath: string): string {
|
|
108
|
-
const packageRoot = findAgentPackageRoot(agentPath);
|
|
109
|
-
return path.join(packageRoot, 'dist', 'vat-bundles', target);
|
|
110
|
-
}
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
**After (CORRECT)** - Logic in runtime package:
|
|
114
|
-
```typescript
|
|
115
|
-
// packages/cli/src/commands/agent/build.ts
|
|
116
|
-
const buildOptions = options.output
|
|
117
|
-
? { agentPath, target, outputPath: options.output }
|
|
118
|
-
: { agentPath, target };
|
|
119
|
-
// ✅ CLI just passes options, runtime figures out the rest
|
|
120
|
-
result = await buildAgentSkill(buildOptions);
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
```typescript
|
|
124
|
-
// packages/agent-skills/src/builder.ts
|
|
125
|
-
function getDefaultOutputPath(manifestPath: string, target: string): string {
|
|
126
|
-
const agentPackageRoot = findAgentPackageRoot(manifestPath);
|
|
127
|
-
return path.join(agentPackageRoot, 'dist', 'vat-bundles', target);
|
|
128
|
-
}
|
|
129
|
-
// ✅ Logic lives where it can be reused by other runtimes
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
### Quick Check: Does This Belong in CLI?
|
|
133
|
-
|
|
134
|
-
Ask yourself:
|
|
135
|
-
1. **"Could another package need this logic?"** → If yes, move to utils or the specific runtime package
|
|
136
|
-
2. **"Is this about user interaction?"** → If yes, CLI is probably fine
|
|
137
|
-
3. **"Does this involve file paths/resolution?"** → Probably belongs in utils or the consumer package
|
|
138
|
-
4. **"Is this domain logic?"** → Belongs in the domain package (agent-config, rag, runtime-*, etc.)
|
|
139
|
-
|
|
140
|
-
### Self-Hosting Consideration
|
|
141
|
-
|
|
142
|
-
Remember: **Other agent repos won't have packages/cli/**. If an agent package needs to build itself, it can depend on `@vibe-agent-toolkit/agent-skills` directly. The CLI is just one convenient way to invoke the build - not the only way.
|
|
143
|
-
|
|
144
|
-
### Audit Command Independence
|
|
145
|
-
|
|
146
|
-
**Intentional Architectural Decision**: The `vat skills audit` command maintains custom scanning logic rather than using `discovery.scan()`.
|
|
147
|
-
|
|
148
|
-
**Why**:
|
|
149
|
-
- `discovery.scan()` is optimized for VAT agent resources (finds markdown files, extracts frontmatter)
|
|
150
|
-
- Audit needs to find multiple file types in specific directory structures (`.claude-plugin/` directories, JSON manifests, TypeScript/JavaScript files)
|
|
151
|
-
- Different scanning requirements = different scanning implementations
|
|
152
|
-
|
|
153
|
-
**What IS Shared**:
|
|
154
|
-
- ✅ Skill validation logic (uses shared `validateSkill` from agent-skills)
|
|
155
|
-
- ✅ Validation result formatting (uses shared `validate` function)
|
|
156
|
-
- ✅ Claude paths resolution (uses `@vibe-agent-toolkit/utils/claude-paths`)
|
|
157
|
-
|
|
158
|
-
**What is NOT Shared**:
|
|
159
|
-
- ❌ Directory scanning (audit's requirements differ from discovery's design)
|
|
160
|
-
- ❌ File type detection (audit looks for `.claude-plugin/` structure, not markdown)
|
|
161
|
-
|
|
162
|
-
**This is not technical debt** - it's recognition that discovery and audit have fundamentally different scanning needs. Forcing them to share scanning logic would violate single responsibility principle and make both implementations more complex.
|
|
163
|
-
|
|
164
|
-
## Writing Useful CLI Help Documentation
|
|
165
|
-
|
|
166
|
-
**Golden Rule**: Help text should answer "What does this do?" and "How do I use it?" without requiring users to read external documentation.
|
|
167
|
-
|
|
168
|
-
### Principles for Effective CLI Help
|
|
169
|
-
|
|
170
|
-
#### 1. Be Descriptive, Not Terse
|
|
171
|
-
|
|
172
|
-
❌ **Bad**: "Validate resources"
|
|
173
|
-
✅ **Good**: "Validate markdown resources (link integrity, anchors)"
|
|
174
|
-
|
|
175
|
-
❌ **Bad**: "Scan directory"
|
|
176
|
-
✅ **Good**: "Discover markdown resources in directory and report statistics"
|
|
177
|
-
|
|
178
|
-
**Why**: Users need to understand what the command actually does before running it.
|
|
179
|
-
|
|
180
|
-
#### 2. Document What Happens
|
|
181
|
-
|
|
182
|
-
Every command should explain:
|
|
183
|
-
- **Input**: What does it operate on? (files, directories, config)
|
|
184
|
-
- **Processing**: What does it check/do?
|
|
185
|
-
- **Output**: What does it produce? (format, destination)
|
|
186
|
-
- **Side effects**: Does it modify anything?
|
|
187
|
-
|
|
188
|
-
**Example**:
|
|
189
|
-
```typescript
|
|
190
|
-
.addHelpText('after', `
|
|
191
|
-
Description:
|
|
192
|
-
Validates all markdown files for broken links, missing anchors, and
|
|
193
|
-
invalid references. Outputs YAML summary to stdout and test-format
|
|
194
|
-
errors to stderr.
|
|
195
|
-
|
|
196
|
-
Default path: current directory
|
|
197
|
-
Respects: vibe-agent-toolkit.config.yaml include/exclude patterns
|
|
198
|
-
`)
|
|
199
|
-
```
|
|
200
|
-
|
|
201
|
-
#### 3. Explain Output Format
|
|
202
|
-
|
|
203
|
-
Users need to know:
|
|
204
|
-
- What format is the output? (YAML, JSON, plain text)
|
|
205
|
-
- Where does it go? (stdout, stderr, file)
|
|
206
|
-
- What fields/structure to expect?
|
|
207
|
-
|
|
208
|
-
**Example**:
|
|
209
|
-
```typescript
|
|
210
|
-
Output:
|
|
211
|
-
- status: success/error
|
|
212
|
-
- filesScanned: number of markdown files found
|
|
213
|
-
- linksFound: total links discovered
|
|
214
|
-
- duration: scan time in milliseconds
|
|
215
|
-
|
|
216
|
-
Output Format:
|
|
217
|
-
YAML summary → stdout (for programmatic parsing)
|
|
218
|
-
Error details → stderr (file:line:column: message)
|
|
219
|
-
```
|
|
220
|
-
|
|
221
|
-
#### 4. Document Exit Codes
|
|
222
|
-
|
|
223
|
-
Critical for scripting and CI/CD:
|
|
224
|
-
|
|
225
|
-
```typescript
|
|
226
|
-
Exit Codes:
|
|
227
|
-
0 - All validations passed
|
|
228
|
-
1 - Validation errors found (broken links, missing anchors)
|
|
229
|
-
2 - System error (config invalid, directory not found, etc.)
|
|
230
|
-
```
|
|
231
|
-
|
|
232
|
-
**Why**: Scripts need to know when to fail builds, send alerts, etc.
|
|
233
|
-
|
|
234
|
-
#### 5. Show One Good Example
|
|
235
|
-
|
|
236
|
-
**Principle**: One example is good, two is too many. Help text is not a tutorial.
|
|
237
|
-
|
|
238
|
-
Show the **most common use case** that demonstrates the command clearly:
|
|
239
|
-
|
|
240
|
-
**Pattern**:
|
|
241
|
-
```typescript
|
|
242
|
-
Example:
|
|
243
|
-
$ vat resources validate docs/ # Validate markdown in docs folder
|
|
244
|
-
```
|
|
245
|
-
|
|
246
|
-
If you need to show advanced usage, put it in verbose help (`--help --verbose`) or documentation.
|
|
247
|
-
|
|
248
|
-
**Why**: Users scan help text. Too many examples → information overload → users skip everything.
|
|
249
|
-
|
|
250
|
-
#### 6. Clarify Design Decisions
|
|
251
|
-
|
|
252
|
-
When something might surprise users, explain why:
|
|
253
|
-
|
|
254
|
-
```typescript
|
|
255
|
-
Validation Checks:
|
|
256
|
-
- Internal file links (relative paths)
|
|
257
|
-
- Anchor links within files (#heading)
|
|
258
|
-
- Cross-file anchor links (file.md#heading)
|
|
259
|
-
- External URLs are NOT validated (by design)
|
|
260
|
-
```
|
|
261
|
-
|
|
262
|
-
**Why**: Prevents user confusion and support requests.
|
|
263
|
-
|
|
264
|
-
#### 7. Keep It Concise
|
|
265
|
-
|
|
266
|
-
**Less is more**. Every line in help text should earn its place.
|
|
267
|
-
|
|
268
|
-
✅ **Do**: Essential information only
|
|
269
|
-
❌ **Don't**: Repeat information users already know
|
|
270
|
-
❌ **Don't**: Multiple examples when one suffices
|
|
271
|
-
❌ **Don't**: Verbose explanations of obvious things
|
|
272
|
-
|
|
273
|
-
Users who need more detail will use `--help --verbose` or read the docs.
|
|
274
|
-
|
|
275
|
-
### Commander.js Patterns
|
|
276
|
-
|
|
277
|
-
#### Basic Command with Enhanced Help
|
|
278
|
-
|
|
279
|
-
```typescript
|
|
280
|
-
program
|
|
281
|
-
.command('mycommand [arg]')
|
|
282
|
-
.description('Short one-line description for command list')
|
|
283
|
-
.option('-d, --debug', 'Enable debug logging')
|
|
284
|
-
.action(myCommandHandler)
|
|
285
|
-
.addHelpText('after', `
|
|
286
|
-
Description:
|
|
287
|
-
Detailed explanation of what this command does and what users
|
|
288
|
-
should expect. Keep it under 3 sentences.
|
|
289
|
-
|
|
290
|
-
Output:
|
|
291
|
-
- field1: description of field
|
|
292
|
-
- field2: description of field
|
|
293
|
-
|
|
294
|
-
Example:
|
|
295
|
-
$ vat mycommand docs/ # Most common use case
|
|
296
|
-
`);
|
|
297
|
-
```
|
|
298
|
-
|
|
299
|
-
#### Command Group with Example
|
|
300
|
-
|
|
301
|
-
```typescript
|
|
302
|
-
const group = new Command('groupname');
|
|
303
|
-
|
|
304
|
-
group
|
|
305
|
-
.description('Brief description of command group')
|
|
306
|
-
.helpCommand(false) // Remove redundant help command
|
|
307
|
-
.addHelpText('after', `
|
|
308
|
-
Example:
|
|
309
|
-
$ vat groupname subcommand docs/ # Most common workflow
|
|
310
|
-
|
|
311
|
-
Configuration:
|
|
312
|
-
Create config.yaml in project root. See --help --verbose for details.
|
|
313
|
-
`);
|
|
314
|
-
```
|
|
315
|
-
|
|
316
|
-
### Help Text Organization
|
|
317
|
-
|
|
318
|
-
Use this structure for `.addHelpText('after', ...)`:
|
|
319
|
-
|
|
320
|
-
```
|
|
321
|
-
Description:
|
|
322
|
-
[2-3 sentences max - what it does, input, output]
|
|
323
|
-
|
|
324
|
-
[Optional command-specific section]:
|
|
325
|
-
Validation Checks: / Output Fields: / etc.
|
|
326
|
-
- Brief bullets only if essential
|
|
327
|
-
|
|
328
|
-
Exit Codes: (only for commands with multiple exit codes)
|
|
329
|
-
0 - Success
|
|
330
|
-
1 - Validation/expected failures
|
|
331
|
-
2 - System/unexpected errors
|
|
332
|
-
|
|
333
|
-
Example: (singular - one example only)
|
|
334
|
-
$ command common-case # The most typical usage
|
|
335
|
-
```
|
|
336
|
-
|
|
337
|
-
**Remember**: Brevity beats completeness. When in doubt, remove text.
|
|
338
|
-
|
|
339
|
-
### Testing Help Text
|
|
340
|
-
|
|
341
|
-
Always test help output:
|
|
342
|
-
|
|
343
|
-
```bash
|
|
344
|
-
# Test all help variations
|
|
345
|
-
node packages/cli/dist/bin.js --help
|
|
346
|
-
node packages/cli/dist/bin.js resources --help
|
|
347
|
-
node packages/cli/dist/bin.js resources scan --help
|
|
348
|
-
node packages/cli/dist/bin.js resources validate --help
|
|
349
|
-
|
|
350
|
-
# Test piping (help should go to stdout)
|
|
351
|
-
node packages/cli/dist/bin.js --help | less
|
|
352
|
-
node packages/cli/dist/bin.js --help | grep validate
|
|
353
|
-
```
|
|
354
|
-
|
|
355
|
-
### Anti-Patterns to Avoid
|
|
356
|
-
|
|
357
|
-
❌ **Don't**: Use terse descriptions
|
|
358
|
-
"Validate resources" tells users nothing useful
|
|
359
|
-
|
|
360
|
-
❌ **Don't**: Assume users know the output format
|
|
361
|
-
They won't know if it's YAML, JSON, or plain text
|
|
362
|
-
|
|
363
|
-
❌ **Don't**: Hide exit codes
|
|
364
|
-
Scripts and CI systems need this information
|
|
365
|
-
|
|
366
|
-
❌ **Don't**: Skip examples
|
|
367
|
-
Examples are the fastest way for users to understand
|
|
368
|
-
|
|
369
|
-
❌ **Don't**: Leave design decisions unexplained
|
|
370
|
-
"Why doesn't it validate external URLs?" will be asked
|
|
371
|
-
|
|
372
|
-
❌ **Don't**: Forget about piping
|
|
373
|
-
UNIX users expect `--help | less` to work (stdout, not stderr)
|
|
374
|
-
|
|
375
|
-
### When to Use Verbose Help
|
|
376
|
-
|
|
377
|
-
Use `--help --verbose` for:
|
|
378
|
-
- Comprehensive reference documentation
|
|
379
|
-
- Configuration file schemas
|
|
380
|
-
- Advanced usage patterns
|
|
381
|
-
- Architecture explanations
|
|
382
|
-
- Links to external resources
|
|
383
|
-
|
|
384
|
-
Regular `--help` should be complete enough for 90% of use cases.
|
|
385
|
-
|
|
386
|
-
## Command Implementation Patterns
|
|
387
|
-
|
|
388
|
-
### Command File Structure
|
|
389
|
-
|
|
390
|
-
```typescript
|
|
391
|
-
// commands/mycommand.ts
|
|
392
|
-
export interface MyCommandOptions {
|
|
393
|
-
debug?: boolean;
|
|
394
|
-
// ... other options
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
export async function myCommand(
|
|
398
|
-
pathArg: string | undefined,
|
|
399
|
-
options: MyCommandOptions
|
|
400
|
-
): Promise<void> {
|
|
401
|
-
const logger = createLogger(options.debug ? { debug: true } : {});
|
|
402
|
-
const startTime = Date.now();
|
|
403
|
-
|
|
404
|
-
try {
|
|
405
|
-
// 1. Validate inputs
|
|
406
|
-
// 2. Process
|
|
407
|
-
// 3. Output results (YAML to stdout)
|
|
408
|
-
// 4. Exit with appropriate code
|
|
409
|
-
|
|
410
|
-
process.exit(0);
|
|
411
|
-
} catch (error) {
|
|
412
|
-
handleCommandError(error, logger, startTime, 'MyCommand');
|
|
413
|
-
}
|
|
414
|
-
}
|
|
415
|
-
```
|
|
416
|
-
|
|
417
|
-
### Output Conventions
|
|
418
|
-
|
|
419
|
-
**Structured output (YAML)** → stdout
|
|
420
|
-
**Human-readable errors** → stderr
|
|
421
|
-
**Exit codes**: 0 = success, 1 = expected failure, 2 = unexpected error
|
|
422
|
-
|
|
423
|
-
This enables:
|
|
424
|
-
```bash
|
|
425
|
-
vat command | jq .status # Parse YAML
|
|
426
|
-
vat command 2>&1 | less # View all output
|
|
427
|
-
vat command > results.yaml # Save results
|
|
428
|
-
vat command && echo "Success" # Use in scripts
|
|
429
|
-
```
|
|
430
|
-
|
|
431
|
-
### Error Handling
|
|
432
|
-
|
|
433
|
-
Use the `handleCommandError` helper for consistent error handling:
|
|
434
|
-
|
|
435
|
-
```typescript
|
|
436
|
-
try {
|
|
437
|
-
// Command implementation
|
|
438
|
-
} catch (error) {
|
|
439
|
-
handleCommandError(error, logger, startTime, 'CommandName');
|
|
440
|
-
// handleCommandError calls process.exit() internally
|
|
441
|
-
}
|
|
442
|
-
```
|
|
443
|
-
|
|
444
|
-
This ensures:
|
|
445
|
-
- Consistent error format
|
|
446
|
-
- Duration logging
|
|
447
|
-
- Proper exit codes (1 for expected errors, 2 for unexpected)
|
|
448
|
-
|
|
449
|
-
## Testing CLI Commands
|
|
450
|
-
|
|
451
|
-
### System Tests
|
|
452
|
-
|
|
453
|
-
Create system tests in `test/system/` for end-to-end CLI testing:
|
|
454
|
-
|
|
455
|
-
```typescript
|
|
456
|
-
describe('MyCommand (system test)', () => {
|
|
457
|
-
let tempDir: string;
|
|
458
|
-
|
|
459
|
-
beforeAll(() => {
|
|
460
|
-
tempDir = createTestTempDir('vat-mycommand-test-');
|
|
461
|
-
});
|
|
462
|
-
|
|
463
|
-
afterAll(() => {
|
|
464
|
-
fs.rmSync(tempDir, { recursive: true, force: true });
|
|
465
|
-
});
|
|
466
|
-
|
|
467
|
-
it('should handle basic usage', () => {
|
|
468
|
-
const { result, parsed } = executeCommandAndParse(binPath, projectDir);
|
|
469
|
-
|
|
470
|
-
expect(result.status).toBe(0);
|
|
471
|
-
expect(parsed.status).toBe('success');
|
|
472
|
-
});
|
|
473
|
-
|
|
474
|
-
it('should handle errors correctly', () => {
|
|
475
|
-
// Test error scenarios with exit code 1 or 2
|
|
476
|
-
});
|
|
477
|
-
});
|
|
478
|
-
```
|
|
479
|
-
|
|
480
|
-
### Help Text Tests
|
|
481
|
-
|
|
482
|
-
Add tests to verify help text contains key information:
|
|
483
|
-
|
|
484
|
-
```typescript
|
|
485
|
-
it('should show comprehensive help', () => {
|
|
486
|
-
const result = spawnSync('node', [binPath, 'mycommand', '--help'], {
|
|
487
|
-
encoding: 'utf-8',
|
|
488
|
-
});
|
|
489
|
-
|
|
490
|
-
expect(result.status).toBe(0);
|
|
491
|
-
expect(result.stdout).toContain('Description:');
|
|
492
|
-
expect(result.stdout).toContain('Examples:');
|
|
493
|
-
expect(result.stdout).toContain('Exit Codes:');
|
|
494
|
-
});
|
|
495
|
-
```
|
|
496
|
-
|
|
497
|
-
## Documentation Maintenance
|
|
498
|
-
|
|
499
|
-
### CLI Help Documentation
|
|
500
|
-
|
|
501
|
-
The CLI help documentation lives in `packages/cli/docs/*.md`:
|
|
502
|
-
- `docs/index.md` - Root level verbose help (`vat --help --verbose`)
|
|
503
|
-
- `docs/resources.md` - Resources command verbose help (`vat resources --help --verbose`)
|
|
504
|
-
|
|
505
|
-
These markdown files are the single source of truth and are:
|
|
506
|
-
- Loaded at runtime by the CLI via `help-loader.ts`
|
|
507
|
-
- Included in the published npm package (in the `files` array)
|
|
508
|
-
- Browsable on GitHub and npm
|
|
509
|
-
|
|
510
|
-
**This ensures documentation never drifts from actual CLI behavior** - there is only one source.
|
|
511
|
-
|
|
512
|
-
### When to Update Help Text
|
|
513
|
-
|
|
514
|
-
Update help text when:
|
|
515
|
-
- ✅ Adding new commands or options
|
|
516
|
-
- ✅ Changing command behavior
|
|
517
|
-
- ✅ Adding new output fields
|
|
518
|
-
- ✅ Changing exit code meanings
|
|
519
|
-
- ✅ Users report confusion (help wasn't clear)
|
|
520
|
-
|
|
521
|
-
Don't wait to update help - do it in the same PR as the feature.
|
|
522
|
-
|
|
523
|
-
## Summary Checklist
|
|
524
|
-
|
|
525
|
-
When adding a new CLI command, ensure:
|
|
526
|
-
|
|
527
|
-
- [ ] Short description (for command list)
|
|
528
|
-
- [ ] Detailed description (what it does)
|
|
529
|
-
- [ ] Default behavior explained
|
|
530
|
-
- [ ] Output format documented
|
|
531
|
-
- [ ] Exit codes documented (if not 0-only)
|
|
532
|
-
- [ ] At least 3 examples (basic, intermediate, advanced)
|
|
533
|
-
- [ ] Configuration usage explained (if applicable)
|
|
534
|
-
- [ ] Design decisions clarified (if surprising)
|
|
535
|
-
- [ ] Help text goes to stdout (not stderr)
|
|
536
|
-
- [ ] System tests cover the command
|
|
537
|
-
- [ ] CLI reference docs regenerated
|
|
538
|
-
|
|
539
|
-
**Remember**: If you have to explain something in a GitHub issue or Slack, that explanation should be in the help text.
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
# Debugging & Testing VAT Fixes
|
|
2
|
-
|
|
3
|
-
Reference guide for diagnosing unexpected VAT behavior, testing local code changes
|
|
4
|
-
in adopter projects, and validating fixes before publishing.
|
|
5
|
-
|
|
6
|
-
> **Quick reference**: Also available as `vibe-agent-toolkit:debugging` skill
|
|
7
|
-
> when working in Claude Code.
|
|
8
|
-
|
|
9
|
-
## Check Which Version Is Running
|
|
10
|
-
|
|
11
|
-
```bash
|
|
12
|
-
# In the adopter project
|
|
13
|
-
cat node_modules/@vibe-agent-toolkit/cli/package.json | grep '"version"'
|
|
14
|
-
|
|
15
|
-
# Or via the binary
|
|
16
|
-
vat --version
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
Many "VAT bugs" are version mismatches — the adopter project has an older RC installed.
|
|
20
|
-
|
|
21
|
-
## Enable Debug Output
|
|
22
|
-
|
|
23
|
-
```bash
|
|
24
|
-
VAT_DEBUG=1 vat <command>
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
Prints: binary path resolution, context detection, config file found, and project root.
|
|
28
|
-
Use to confirm that VAT is reading the config and root you expect.
|
|
29
|
-
|
|
30
|
-
Other env vars:
|
|
31
|
-
|
|
32
|
-
| Variable | Purpose |
|
|
33
|
-
|---|---|
|
|
34
|
-
| `VAT_DEBUG=1` | Print resolution and context detection details |
|
|
35
|
-
| `VAT_ROOT_DIR=/path` | Redirect to a local monorepo build (see below) |
|
|
36
|
-
| `VAT_TEST_ROOT=/path` | Override project root (skips `.git` detection) |
|
|
37
|
-
| `VAT_TEST_CONFIG=/path` | Override config file path |
|
|
38
|
-
|
|
39
|
-
## Test With a Local Monorepo Build
|
|
40
|
-
|
|
41
|
-
To test a fix from your local `vibe-agent-toolkit` checkout in an adopter project
|
|
42
|
-
without publishing to npm, use `VAT_ROOT_DIR`:
|
|
43
|
-
|
|
44
|
-
```bash
|
|
45
|
-
# 1. Build the monorepo first (always required after code changes)
|
|
46
|
-
cd /path/to/vibe-agent-toolkit
|
|
47
|
-
bun run build
|
|
48
|
-
|
|
49
|
-
# 2. Point the adopter project at your local build
|
|
50
|
-
export VAT_ROOT_DIR=/path/to/vibe-agent-toolkit
|
|
51
|
-
|
|
52
|
-
# 3. Run any vat command — it now uses your local build
|
|
53
|
-
cd /path/to/adopter-project
|
|
54
|
-
vat resources validate .
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
The globally-installed `vat` wrapper detects `VAT_ROOT_DIR` and re-dispatches to
|
|
58
|
-
`$VAT_ROOT_DIR/packages/cli/dist/bin.js` automatically.
|
|
59
|
-
|
|
60
|
-
**Alternative (no global install needed):**
|
|
61
|
-
|
|
62
|
-
```bash
|
|
63
|
-
node /path/to/vibe-agent-toolkit/packages/cli/dist/bin/vat.js resources validate .
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
## Write a Failing Test Before Fixing
|
|
67
|
-
|
|
68
|
-
Reproduce the bug as a test before touching source code:
|
|
69
|
-
|
|
70
|
-
| Bug type | Test location |
|
|
71
|
-
|---|---|
|
|
72
|
-
| Pure logic, parsing, schema | `packages/<package>/test/*.test.ts` (unit) |
|
|
73
|
-
| CLI command behavior | `packages/cli/test/integration/*.integration.test.ts` |
|
|
74
|
-
| End-to-end workflow | `packages/cli/test/system/*.system.test.ts` |
|
|
75
|
-
|
|
76
|
-
See [docs/writing-tests.md](writing-tests.md) for patterns and classification guide.
|
|
77
|
-
|
|
78
|
-
Run just the test you added:
|
|
79
|
-
```bash
|
|
80
|
-
bun run test:unit -- <pattern> # unit
|
|
81
|
-
bun run test:integration -- <pattern> # integration
|
|
82
|
-
bun run test:system -- <pattern> # system
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
## Validate Before Committing
|
|
86
|
-
|
|
87
|
-
After fixing, run the full pipeline from the monorepo root:
|
|
88
|
-
|
|
89
|
-
```bash
|
|
90
|
-
bun run validate
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
Results are cached by git tree hash — instant if code is unchanged, re-runs only
|
|
94
|
-
what changed. Do not commit until this passes.
|
|
95
|
-
|
|
96
|
-
## Common Symptoms & Causes
|
|
97
|
-
|
|
98
|
-
| Symptom | Likely cause |
|
|
99
|
-
|---|---|
|
|
100
|
-
| Wrong anchor slugs in link validation | Check `generateSlug` in `packages/resources/src/link-parser.ts` |
|
|
101
|
-
| Headings not found in a file | Spurious ` ``` ` fence swallowing the heading — scan file for unclosed fences |
|
|
102
|
-
| Config not loading | Run `VAT_DEBUG=1 vat <command>` — shows which config file is found |
|
|
103
|
-
| Fix works locally but adopter still wrong | `bun run build` not run after the change, or adopter uses old installed version |
|
|
104
|
-
| Path wrong on Windows | Use `toForwardSlash()` from `@vibe-agent-toolkit/utils` for path comparisons |
|
|
105
|
-
| Test passes, CI fails | Different Node version; check matrix (Node 22/24 × Ubuntu/Windows) |
|
|
106
|
-
|
|
107
|
-
## See Also
|
|
108
|
-
|
|
109
|
-
- [docs/writing-tests.md](writing-tests.md) — Full test classification and patterns
|
|
110
|
-
- [packages/cli/CLAUDE.md](CLAUDE.md) — CLI development guidelines
|
|
111
|
-
- [docs/build-system.md]() — Build configuration reference
|