vibe-validate 0.17.0 → 0.17.1-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/package.json +7 -4
- package/scripts/install-skill.js +88 -0
- package/skill/SKILL.md +666 -0
- package/skill/resources/cli-reference.md +570 -0
- package/skill/resources/configuration-reference.md +980 -0
- package/skill/resources/configure-project.md +126 -0
- package/skill/resources/error-extractors-guide.md +742 -0
- package/skill/resources/extending-extraction.md +451 -0
- package/skill/resources/run-capability.md +229 -0
- package/skill/resources/troubleshooting.md +65 -0
|
@@ -0,0 +1,451 @@
|
|
|
1
|
+
# Creating Custom Extractors for vibe-validate
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
This guide helps you create custom error extractors when vibe-validate isn't capturing errors properly for your tools.
|
|
5
|
+
|
|
6
|
+
## When to Use This Guide
|
|
7
|
+
|
|
8
|
+
**You're in the right place if:**
|
|
9
|
+
1. Validation fails but no errors were extracted (exitCode !== 0 but totalErrors === 0)
|
|
10
|
+
2. Generic extractor is being used (extractor: "generic" in metadata)
|
|
11
|
+
3. You want to create a custom extractor for an unsupported tool
|
|
12
|
+
4. Errors aren't being captured properly
|
|
13
|
+
|
|
14
|
+
**Signs extraction is failing:**
|
|
15
|
+
```yaml
|
|
16
|
+
command: ./gradlew build
|
|
17
|
+
exitCode: 1
|
|
18
|
+
extraction:
|
|
19
|
+
totalErrors: 0 # ❌ No errors despite failure
|
|
20
|
+
metadata:
|
|
21
|
+
detection:
|
|
22
|
+
extractor: generic # ❌ Fell back to generic
|
|
23
|
+
confidence: 50
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
**Want to understand how extractors work first?** See [Error Extractors Guide](error-extractors-guide.md) for complete details on the extraction system.
|
|
27
|
+
|
|
28
|
+
## Quick Start: Using the CLI Tool
|
|
29
|
+
|
|
30
|
+
**CRITICAL**: vibe-validate includes a scaffolding command for creating extractors. **Always use this command first** before manually implementing:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
vv create-extractor <tool-name> \
|
|
34
|
+
--description "Brief description of the tool" \
|
|
35
|
+
--author "User Name <email@example.com>" \
|
|
36
|
+
--detection-pattern "ERROR_KEYWORD"
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Command Options
|
|
40
|
+
|
|
41
|
+
- `<tool-name>`: Name of the tool (e.g., `gradle`, `maven`, `webpack`)
|
|
42
|
+
- `--description`: What the extractor does
|
|
43
|
+
- `--author`: Author information
|
|
44
|
+
- `--detection-pattern`: Key pattern that appears in error output (e.g., "ERROR:", "FAILED:", "✖")
|
|
45
|
+
- `--force`: Overwrite existing plugin directory (optional)
|
|
46
|
+
|
|
47
|
+
### What Gets Generated
|
|
48
|
+
|
|
49
|
+
```
|
|
50
|
+
vibe-validate-plugin-<tool-name>/
|
|
51
|
+
├── package.json # NPM package metadata
|
|
52
|
+
├── tsconfig.json # TypeScript configuration
|
|
53
|
+
├── index.ts # Plugin implementation (edit this!)
|
|
54
|
+
└── README.md # Usage instructions
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Step-by-Step Workflow
|
|
58
|
+
|
|
59
|
+
### Step 1: Analyze Failed Output
|
|
60
|
+
|
|
61
|
+
When a user encounters extraction failure:
|
|
62
|
+
|
|
63
|
+
1. **Ask to see the actual error output**:
|
|
64
|
+
```
|
|
65
|
+
"Can you show me the raw output from the failed command?
|
|
66
|
+
I need to see what error patterns appear."
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
2. **Identify key patterns**:
|
|
70
|
+
- Error markers: "ERROR:", "FAILED:", "Exception", "✖", etc.
|
|
71
|
+
- File/line references: `file.ts:42:5`, `(file.ts:42)`, etc.
|
|
72
|
+
- Message structure: How errors are formatted
|
|
73
|
+
|
|
74
|
+
### Step 2: Generate Plugin Scaffold
|
|
75
|
+
|
|
76
|
+
**Run the create-extractor command:**
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
vv create-extractor <tool-name> \
|
|
80
|
+
--description "Extracts errors from <tool-name> output" \
|
|
81
|
+
--author "User Name <user@example.com>" \
|
|
82
|
+
--detection-pattern "<DETECTED_PATTERN>"
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
**Example:**
|
|
86
|
+
```bash
|
|
87
|
+
# For Gradle builds
|
|
88
|
+
vv create-extractor gradle \
|
|
89
|
+
--description "Extracts compilation errors from Gradle build output" \
|
|
90
|
+
--author "Jane Developer <jane@example.com>" \
|
|
91
|
+
--detection-pattern "FAILURE: Build failed"
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Step 3: Customize the Generated Plugin
|
|
95
|
+
|
|
96
|
+
Open `vibe-validate-plugin-<tool-name>/index.ts` and customize:
|
|
97
|
+
|
|
98
|
+
#### Detection Logic
|
|
99
|
+
|
|
100
|
+
Update the `detect()` function to identify your tool's output:
|
|
101
|
+
|
|
102
|
+
```typescript
|
|
103
|
+
detect(output: string) {
|
|
104
|
+
// Check for tool-specific markers
|
|
105
|
+
const hasToolMarker = output.includes('> Task :') || output.includes('BUILD FAILED');
|
|
106
|
+
const hasErrorMarker = /FAILURE: Build failed/.test(output);
|
|
107
|
+
|
|
108
|
+
if (hasToolMarker && hasErrorMarker) {
|
|
109
|
+
return {
|
|
110
|
+
confidence: 95, // High confidence = specific patterns
|
|
111
|
+
hints: {
|
|
112
|
+
required: ['FAILURE: Build failed'], // Must have these
|
|
113
|
+
optional: ['> Task :'], // Nice to have
|
|
114
|
+
},
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
return { confidence: 0, hints: { required: [], optional: [] } };
|
|
119
|
+
}
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
**Confidence Levels:**
|
|
123
|
+
- `95-100`: Very specific patterns (e.g., "TypeScript compilation error TS2322")
|
|
124
|
+
- `80-94`: Tool-specific but generic (e.g., "BUILD FAILED" + tool name)
|
|
125
|
+
- `60-79`: Generic patterns (e.g., "ERROR:" alone)
|
|
126
|
+
- `0-59`: Not confident, don't use this extractor
|
|
127
|
+
|
|
128
|
+
#### Extraction Logic
|
|
129
|
+
|
|
130
|
+
Update the `extract()` function to parse errors:
|
|
131
|
+
|
|
132
|
+
```typescript
|
|
133
|
+
extract(output: string) {
|
|
134
|
+
const lines = output.split('\n');
|
|
135
|
+
const errors: any[] = [];
|
|
136
|
+
|
|
137
|
+
for (const line of lines) {
|
|
138
|
+
// Example: Parse "file.ts:42:5 - error TS2322: Type mismatch"
|
|
139
|
+
const match = line.match(/^(.+?):(\d+):(\d+) - error (\w+): (.+)$/);
|
|
140
|
+
if (match) {
|
|
141
|
+
errors.push({
|
|
142
|
+
file: match[1],
|
|
143
|
+
line: parseInt(match[2], 10),
|
|
144
|
+
column: parseInt(match[3], 10),
|
|
145
|
+
code: match[4],
|
|
146
|
+
message: match[5],
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
return {
|
|
152
|
+
errors,
|
|
153
|
+
totalErrors: errors.length,
|
|
154
|
+
summary: `${errors.length} error(s) in build`,
|
|
155
|
+
guidance: 'Fix errors shown above',
|
|
156
|
+
errorSummary: errors.map(e => `${e.file}:${e.line} - ${e.message}`).join('\n'),
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### Step 4: Build the Plugin
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
cd vibe-validate-plugin-<tool-name>
|
|
165
|
+
npm install
|
|
166
|
+
npm run build
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
### Step 5: Test with Real Output
|
|
170
|
+
|
|
171
|
+
**Move to the auto-discovery location:**
|
|
172
|
+
```bash
|
|
173
|
+
cd ..
|
|
174
|
+
mkdir -p vibe-validate-local-plugins
|
|
175
|
+
mv vibe-validate-plugin-<tool-name> vibe-validate-local-plugins/
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
**Run the command that was failing:**
|
|
179
|
+
```bash
|
|
180
|
+
vv run <failing-command>
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
**Check if extraction worked:**
|
|
184
|
+
```bash
|
|
185
|
+
vv state
|
|
186
|
+
|
|
187
|
+
# Look for:
|
|
188
|
+
# metadata:
|
|
189
|
+
# detection:
|
|
190
|
+
# extractor: <tool-name> # Your plugin!
|
|
191
|
+
# confidence: 95
|
|
192
|
+
# errors:
|
|
193
|
+
# - file: ...
|
|
194
|
+
# line: ...
|
|
195
|
+
# message: ...
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
### Step 6: Iterate and Refine
|
|
199
|
+
|
|
200
|
+
**If extraction isn't working:**
|
|
201
|
+
|
|
202
|
+
1. **Check detection**:
|
|
203
|
+
- Is confidence high enough? (should be 60+)
|
|
204
|
+
- Are the patterns matching?
|
|
205
|
+
- Add debug logging to `detect()` function
|
|
206
|
+
|
|
207
|
+
2. **Check extraction**:
|
|
208
|
+
- Are regex patterns matching the actual output format?
|
|
209
|
+
- Test regex patterns in isolation first
|
|
210
|
+
- Handle multi-line errors if needed
|
|
211
|
+
|
|
212
|
+
3. **Add more examples**:
|
|
213
|
+
- Collect multiple failure samples
|
|
214
|
+
- Ensure patterns match all cases
|
|
215
|
+
|
|
216
|
+
## Common Patterns
|
|
217
|
+
|
|
218
|
+
### Pattern: Line-based Errors
|
|
219
|
+
|
|
220
|
+
```typescript
|
|
221
|
+
// Format: "ERROR: Something went wrong at line 42"
|
|
222
|
+
const errorPattern = /ERROR: (.+?) at line (\d+)/;
|
|
223
|
+
const match = line.match(errorPattern);
|
|
224
|
+
if (match) {
|
|
225
|
+
errors.push({
|
|
226
|
+
message: match[1],
|
|
227
|
+
line: parseInt(match[2], 10),
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
### Pattern: File:Line:Column Errors
|
|
233
|
+
|
|
234
|
+
```typescript
|
|
235
|
+
// Format: "src/index.ts:42:5 - Type mismatch"
|
|
236
|
+
const errorPattern = /^(.+?):(\d+):(\d+) - (.+)$/;
|
|
237
|
+
const match = line.match(errorPattern);
|
|
238
|
+
if (match) {
|
|
239
|
+
errors.push({
|
|
240
|
+
file: match[1],
|
|
241
|
+
line: parseInt(match[2], 10),
|
|
242
|
+
column: parseInt(match[3], 10),
|
|
243
|
+
message: match[4],
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
### Pattern: Multi-line Context
|
|
249
|
+
|
|
250
|
+
```typescript
|
|
251
|
+
// Errors span multiple lines
|
|
252
|
+
let currentError: any = null;
|
|
253
|
+
|
|
254
|
+
for (const line of lines) {
|
|
255
|
+
if (line.startsWith('ERROR:')) {
|
|
256
|
+
if (currentError) errors.push(currentError);
|
|
257
|
+
currentError = { message: line.replace('ERROR:', '').trim(), details: [] };
|
|
258
|
+
} else if (currentError && line.trim()) {
|
|
259
|
+
currentError.details.push(line.trim());
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
if (currentError) errors.push(currentError);
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
## Plugin Discovery
|
|
267
|
+
|
|
268
|
+
**Automatic discovery locations:**
|
|
269
|
+
1. `vibe-validate-local-plugins/` directory (relative to project root)
|
|
270
|
+
2. Directories matching `vibe-validate-plugin-*` pattern in project root
|
|
271
|
+
|
|
272
|
+
**Manual registration (optional):**
|
|
273
|
+
```yaml
|
|
274
|
+
# vibe-validate.config.yaml
|
|
275
|
+
extractors:
|
|
276
|
+
- path: ./vibe-validate-local-plugins/vibe-validate-plugin-gradle
|
|
277
|
+
trust: sandbox # Run in sandboxed environment (recommended)
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
## Security Considerations
|
|
281
|
+
|
|
282
|
+
**Sandboxing:**
|
|
283
|
+
- By default, plugins run in a sandboxed environment
|
|
284
|
+
- Limited access to Node.js APIs (no `fs`, `child_process`, network)
|
|
285
|
+
- Can only parse strings and return structured data
|
|
286
|
+
|
|
287
|
+
**Trust levels:**
|
|
288
|
+
- `sandbox` (default): Safe, limited APIs
|
|
289
|
+
- `trusted`: Full access (requires explicit user consent)
|
|
290
|
+
|
|
291
|
+
**Best practices:**
|
|
292
|
+
- Use only string operations, regex, and array/object manipulation
|
|
293
|
+
- Don't try to execute commands or access files
|
|
294
|
+
- Don't use `eval()` or `Function()` constructor
|
|
295
|
+
|
|
296
|
+
## Troubleshooting
|
|
297
|
+
|
|
298
|
+
### Plugin Not Loading
|
|
299
|
+
|
|
300
|
+
**Check:**
|
|
301
|
+
1. Is the plugin in the right location? (`vibe-validate-local-plugins/` or `vibe-validate-plugin-*` name)
|
|
302
|
+
2. Did you build it? (`npm run build` in plugin directory)
|
|
303
|
+
3. Is the compiled JS present? (check `dist/` directory)
|
|
304
|
+
4. Are there any warnings when running `vv run`? (look for plugin loading errors)
|
|
305
|
+
|
|
306
|
+
### Detection Not Working
|
|
307
|
+
|
|
308
|
+
**Debug detection:**
|
|
309
|
+
```typescript
|
|
310
|
+
detect(output: string) {
|
|
311
|
+
const hasMarker = output.includes('YOUR_PATTERN');
|
|
312
|
+
console.log('[DEBUG] hasMarker:', hasMarker); // Shows in vv output
|
|
313
|
+
// ... rest of detection
|
|
314
|
+
}
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
**Common issues:**
|
|
318
|
+
- Pattern is case-sensitive but output varies
|
|
319
|
+
- Pattern includes ANSI color codes (strip them first)
|
|
320
|
+
- Pattern appears in success cases too (add more specificity)
|
|
321
|
+
|
|
322
|
+
### Extraction Returning No Errors
|
|
323
|
+
|
|
324
|
+
**Debug extraction:**
|
|
325
|
+
```typescript
|
|
326
|
+
extract(output: string) {
|
|
327
|
+
const lines = output.split('\n');
|
|
328
|
+
console.log('[DEBUG] Total lines:', lines.length);
|
|
329
|
+
|
|
330
|
+
for (const line of lines) {
|
|
331
|
+
console.log('[DEBUG] Testing line:', line.substring(0, 100));
|
|
332
|
+
// ... rest of extraction
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
**Common issues:**
|
|
338
|
+
- Regex pattern doesn't match actual output format
|
|
339
|
+
- Output has unexpected whitespace or formatting
|
|
340
|
+
- Error lines are multi-line but code assumes single-line
|
|
341
|
+
|
|
342
|
+
## Advanced: Contributing Back
|
|
343
|
+
|
|
344
|
+
Once your plugin is working well:
|
|
345
|
+
|
|
346
|
+
1. **Prepare for contribution:**
|
|
347
|
+
```bash
|
|
348
|
+
# Ensure tests are added
|
|
349
|
+
npm test
|
|
350
|
+
|
|
351
|
+
# Ensure no sensitive data in test fixtures
|
|
352
|
+
# Redact any company-specific paths or identifiers
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
2. **Submit to vibe-validate repo:**
|
|
356
|
+
- Fork the repository
|
|
357
|
+
- Add plugin to `packages/extractors/src/extractors/`
|
|
358
|
+
- Add tests to `packages/extractors/test/`
|
|
359
|
+
- Update `extractor-registry.ts` to include in built-in list
|
|
360
|
+
- Submit pull request
|
|
361
|
+
|
|
362
|
+
3. **Benefits of contributing:**
|
|
363
|
+
- Other users automatically get your extractor
|
|
364
|
+
- Built-in extractors are maintained and optimized
|
|
365
|
+
- Community recognition
|
|
366
|
+
|
|
367
|
+
## Example Workflows
|
|
368
|
+
|
|
369
|
+
### Workflow 1: Gradle Build Failures
|
|
370
|
+
|
|
371
|
+
**Problem:** Gradle build fails but errors aren't captured
|
|
372
|
+
|
|
373
|
+
**Solution:**
|
|
374
|
+
```bash
|
|
375
|
+
# 1. Create plugin
|
|
376
|
+
vv create-extractor gradle \
|
|
377
|
+
--description "Gradle build error extractor" \
|
|
378
|
+
--author "User <user@example.com>" \
|
|
379
|
+
--detection-pattern "BUILD FAILED"
|
|
380
|
+
|
|
381
|
+
# 2. Customize detection in index.ts (add "Task :" pattern)
|
|
382
|
+
# 3. Customize extraction (parse "error:" lines)
|
|
383
|
+
|
|
384
|
+
# 4. Build and test
|
|
385
|
+
cd vibe-validate-plugin-gradle
|
|
386
|
+
npm install && npm run build
|
|
387
|
+
cd ..
|
|
388
|
+
mv vibe-validate-plugin-gradle vibe-validate-local-plugins/
|
|
389
|
+
|
|
390
|
+
# 5. Verify
|
|
391
|
+
vv run ./gradlew build
|
|
392
|
+
vv state # Should show extracted errors
|
|
393
|
+
```
|
|
394
|
+
|
|
395
|
+
### Workflow 2: Custom Internal Tool
|
|
396
|
+
|
|
397
|
+
**Problem:** Company uses proprietary build tool
|
|
398
|
+
|
|
399
|
+
**Solution:**
|
|
400
|
+
```bash
|
|
401
|
+
# 1. Capture real failure output
|
|
402
|
+
./company-tool build > /tmp/failure.log 2>&1
|
|
403
|
+
|
|
404
|
+
# 2. Analyze patterns in failure.log
|
|
405
|
+
cat /tmp/failure.log | grep -i error
|
|
406
|
+
|
|
407
|
+
# 3. Create plugin with identified pattern
|
|
408
|
+
vv create-extractor company-tool \
|
|
409
|
+
--description "Company tool error extractor" \
|
|
410
|
+
--author "Developer <dev@company.com>" \
|
|
411
|
+
--detection-pattern "COMPILATION FAILURE"
|
|
412
|
+
|
|
413
|
+
# 4. Edit index.ts based on failure.log patterns
|
|
414
|
+
# 5. Test iteratively until all errors extracted
|
|
415
|
+
```
|
|
416
|
+
|
|
417
|
+
## Related Documentation
|
|
418
|
+
|
|
419
|
+
- [Error Extractors Guide](../../../docs/error-extractors-guide.md) - Comprehensive extractor documentation
|
|
420
|
+
- [Extractor Plugin Architecture](../../../docs/extractor-plugin-architecture.md) - Technical architecture details
|
|
421
|
+
- [CLI Reference](../../../docs/cli-reference.md) - Full CLI command documentation
|
|
422
|
+
|
|
423
|
+
## Quick Reference
|
|
424
|
+
|
|
425
|
+
**Create plugin:**
|
|
426
|
+
```bash
|
|
427
|
+
vv create-extractor <name> --description "..." --author "..." --detection-pattern "..."
|
|
428
|
+
```
|
|
429
|
+
|
|
430
|
+
**Build plugin:**
|
|
431
|
+
```bash
|
|
432
|
+
cd vibe-validate-plugin-<name> && npm run build
|
|
433
|
+
```
|
|
434
|
+
|
|
435
|
+
**Move to auto-discovery:**
|
|
436
|
+
```bash
|
|
437
|
+
mkdir -p vibe-validate-local-plugins
|
|
438
|
+
mv vibe-validate-plugin-<name> vibe-validate-local-plugins/
|
|
439
|
+
```
|
|
440
|
+
|
|
441
|
+
**Test:**
|
|
442
|
+
```bash
|
|
443
|
+
vv run <failing-command>
|
|
444
|
+
vv state # Check extraction results
|
|
445
|
+
```
|
|
446
|
+
|
|
447
|
+
**Iterate:**
|
|
448
|
+
1. Edit `index.ts`
|
|
449
|
+
2. Rebuild (`npm run build`)
|
|
450
|
+
3. Test (`vv run ...`)
|
|
451
|
+
4. Repeat until errors extracted correctly
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
# Run Capability: Immediate Caching + Extraction
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
The `vv run` capability provides **immediate benefits without any project configuration**. Just wrap any command to get:
|
|
6
|
+
- **312x speedup** via git tree hash caching
|
|
7
|
+
- **95% token reduction** via smart error extraction
|
|
8
|
+
- **Zero configuration** required
|
|
9
|
+
|
|
10
|
+
## Quick Start
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
# No installation needed
|
|
14
|
+
npx vibe-validate run <any-command>
|
|
15
|
+
|
|
16
|
+
# Examples
|
|
17
|
+
npx vibe-validate run npm test
|
|
18
|
+
npx vibe-validate run pytest
|
|
19
|
+
npx vibe-validate run gradle build
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## After Installing
|
|
23
|
+
|
|
24
|
+
Once installed (`npm install vibe-validate` or `npm install -g vibe-validate`):
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
vv run <command> # Shorthand
|
|
28
|
+
vibe-validate run <command> # Full name
|
|
29
|
+
|
|
30
|
+
# Examples
|
|
31
|
+
vv run npm test
|
|
32
|
+
vv run pnpm typecheck
|
|
33
|
+
vv run ./gradlew build
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## How It Works
|
|
37
|
+
|
|
38
|
+
### 1. Git Tree Hash Caching
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
# First run: executes command
|
|
42
|
+
vv run npm test
|
|
43
|
+
|
|
44
|
+
# Second run (no code changes): uses cache
|
|
45
|
+
vv run npm test # Instant! (312x faster)
|
|
46
|
+
|
|
47
|
+
# After code change: re-runs automatically
|
|
48
|
+
vv run npm test # Executes again
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
**Cache key:** Git tree hash of your code (deterministic, content-based)
|
|
52
|
+
|
|
53
|
+
**Force re-run:**
|
|
54
|
+
```bash
|
|
55
|
+
vv run --force npm test # Skip cache
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### 2. Error Extraction
|
|
59
|
+
|
|
60
|
+
**Without vibe-validate:**
|
|
61
|
+
```
|
|
62
|
+
# 1500+ lines of verbose test output
|
|
63
|
+
Running tests...
|
|
64
|
+
✓ test 1
|
|
65
|
+
✓ test 2
|
|
66
|
+
...
|
|
67
|
+
✗ test 42
|
|
68
|
+
Expected: 5
|
|
69
|
+
Received: 4
|
|
70
|
+
at foo.test.ts:42:10
|
|
71
|
+
...
|
|
72
|
+
# (1400 more lines)
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
**With vibe-validate:**
|
|
76
|
+
```yaml
|
|
77
|
+
exitCode: 1
|
|
78
|
+
extraction:
|
|
79
|
+
totalErrors: 1
|
|
80
|
+
errors:
|
|
81
|
+
- file: foo.test.ts
|
|
82
|
+
line: 42
|
|
83
|
+
column: 10
|
|
84
|
+
message: "Expected: 5, Received: 4"
|
|
85
|
+
summary: "1 test failure"
|
|
86
|
+
guidance: "Fix assertion at foo.test.ts:42"
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
**Result:** 1500 tokens → 75 tokens (95% reduction)
|
|
90
|
+
|
|
91
|
+
## Supported Tools (Built-in Extractors)
|
|
92
|
+
|
|
93
|
+
vibe-validate automatically detects and extracts errors from:
|
|
94
|
+
|
|
95
|
+
- **TypeScript**: `tsc --noEmit`
|
|
96
|
+
- **ESLint**: All output formats
|
|
97
|
+
- **Vitest/Jest**: Test failures
|
|
98
|
+
- **Prettier**: Formatting issues
|
|
99
|
+
- **OpenAPI**: Validation errors
|
|
100
|
+
- **Maven**: Compilation errors, test failures
|
|
101
|
+
- **Generic**: Fallback for unknown tools
|
|
102
|
+
|
|
103
|
+
## YAML Output Format
|
|
104
|
+
|
|
105
|
+
```yaml
|
|
106
|
+
passed: false
|
|
107
|
+
command: npm test
|
|
108
|
+
exitCode: 1
|
|
109
|
+
durationSecs: 2.5
|
|
110
|
+
extraction:
|
|
111
|
+
totalErrors: 3
|
|
112
|
+
errors:
|
|
113
|
+
- file: src/index.ts
|
|
114
|
+
line: 42
|
|
115
|
+
column: 5
|
|
116
|
+
message: "error TS2322: Type 'string' is not assignable to type 'number'"
|
|
117
|
+
- file: src/auth.ts
|
|
118
|
+
line: 128
|
|
119
|
+
column: 10
|
|
120
|
+
message: "error TS2345: Argument of type 'null' is not assignable"
|
|
121
|
+
- file: tests/foo.test.ts
|
|
122
|
+
line: 15
|
|
123
|
+
message: "Expected: 5, Received: 4"
|
|
124
|
+
summary: "3 errors found"
|
|
125
|
+
guidance: "Fix type errors in src/index.ts and src/auth.ts"
|
|
126
|
+
metadata:
|
|
127
|
+
detection:
|
|
128
|
+
extractor: typescript
|
|
129
|
+
confidence: 95
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## When to Use
|
|
133
|
+
|
|
134
|
+
### ✅ Use `vv run` when:
|
|
135
|
+
- Running repetitive commands (tests, lint, build)
|
|
136
|
+
- Want immediate caching without configuration
|
|
137
|
+
- Need concise error output (LLM-friendly)
|
|
138
|
+
- Testing in any project (Node.js, Python, Java, etc.)
|
|
139
|
+
|
|
140
|
+
### ❌ Don't use `vv run` for:
|
|
141
|
+
- Interactive commands (`git log`, `npm init`)
|
|
142
|
+
- Watch modes (`npm run dev`, `vitest --watch`)
|
|
143
|
+
- Commands that already cache well
|
|
144
|
+
- One-time commands
|
|
145
|
+
|
|
146
|
+
## Common Patterns
|
|
147
|
+
|
|
148
|
+
### Pattern 1: Test-Driven Development
|
|
149
|
+
```bash
|
|
150
|
+
# Edit code
|
|
151
|
+
vim src/index.ts
|
|
152
|
+
|
|
153
|
+
# Run tests (fast if code unchanged, extracts errors)
|
|
154
|
+
vv run npm test
|
|
155
|
+
|
|
156
|
+
# Fix errors, re-run (fast due to cache)
|
|
157
|
+
vv run npm test
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
### Pattern 2: Pre-Commit Checks
|
|
161
|
+
```bash
|
|
162
|
+
# Run multiple checks
|
|
163
|
+
vv run npm test
|
|
164
|
+
vv run pnpm lint
|
|
165
|
+
vv run pnpm typecheck
|
|
166
|
+
|
|
167
|
+
# All cached if code unchanged!
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### Pattern 3: Monorepo Testing
|
|
171
|
+
```bash
|
|
172
|
+
# Test all packages (caching per-package)
|
|
173
|
+
vv run pnpm -r test
|
|
174
|
+
|
|
175
|
+
# Only changed packages re-run
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
## Checking Cache Status
|
|
179
|
+
|
|
180
|
+
```bash
|
|
181
|
+
# Run command
|
|
182
|
+
vv run npm test
|
|
183
|
+
|
|
184
|
+
# Check if result is cached
|
|
185
|
+
vv run --check npm test
|
|
186
|
+
|
|
187
|
+
# Output:
|
|
188
|
+
# ✓ Cached (tree: a1b2c3d4...)
|
|
189
|
+
# Last run: 2 minutes ago
|
|
190
|
+
# exitCode: 0
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
## Advanced: Debugging Extraction
|
|
194
|
+
|
|
195
|
+
If errors aren't being extracted properly:
|
|
196
|
+
|
|
197
|
+
```bash
|
|
198
|
+
# 1. Check what extractor was used
|
|
199
|
+
vv run npm test # Look for metadata.detection.extractor
|
|
200
|
+
|
|
201
|
+
# 2. If "generic" extractor used, may need custom extractor
|
|
202
|
+
# See: resources/extending-extraction.md
|
|
203
|
+
|
|
204
|
+
# 3. Force verbose output temporarily
|
|
205
|
+
npm test # Run without vibe-validate to see raw output
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
## Transition to Full Adoption
|
|
209
|
+
|
|
210
|
+
Once you see the benefits with `vv run`, consider configuring the project:
|
|
211
|
+
|
|
212
|
+
```bash
|
|
213
|
+
# Install in project
|
|
214
|
+
npm install vibe-validate
|
|
215
|
+
|
|
216
|
+
# Initialize configuration
|
|
217
|
+
vv init
|
|
218
|
+
|
|
219
|
+
# Now `vv validate` runs full validation suite with caching
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
See: **resources/configure-project.md** for full adoption workflow.
|
|
223
|
+
|
|
224
|
+
## Related Documentation
|
|
225
|
+
|
|
226
|
+
- **Main docs:** `docs/error-extractors-guide.md` (comprehensive extractor documentation)
|
|
227
|
+
- **CLI reference:** `docs/cli-reference.md`
|
|
228
|
+
- **Extending extraction:** `resources/extending-extraction.md` (if errors not captured)
|
|
229
|
+
- **Project configuration:** `resources/configure-project.md` (adopt for team)
|