vibe-validate 0.17.0 → 0.17.1-rc.3

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,570 @@
1
+ # CLI Reference
2
+
3
+ > **Complete command-line reference for vibe-validate**
4
+ >
5
+ > **This document is auto-synced with `vibe-validate --help --verbose` output**
6
+ >
7
+ > The content below is the exact output from running `vibe-validate --help --verbose`. This ensures perfect accuracy between CLI and documentation.
8
+
9
+ ---
10
+ # vibe-validate CLI Reference
11
+
12
+ > Agent-friendly validation framework with git tree hash caching
13
+
14
+ ## Usage
15
+
16
+ ```bash
17
+ vibe-validate <command> [options]
18
+ ```
19
+
20
+ ## Commands
21
+
22
+ ### `validate`
23
+
24
+ Run validation with git tree hash caching
25
+
26
+ **What it does:**
27
+
28
+ 1. Calculates git tree hash of working directory
29
+ 2. Checks if hash matches cached state
30
+ 3. If match: exits immediately (sub-second)
31
+ 4. If no match: runs validation pipeline (~60-90s)
32
+ 5. Caches result for next run
33
+
34
+ **Exit codes:**
35
+
36
+ - `0` - Validation passed (or cached pass)
37
+ - `1` - Validation failed
38
+ - `2` - Configuration error
39
+
40
+ **Creates/modifies:**
41
+
42
+ - Git notes under refs/notes/vibe-validate/validate
43
+
44
+ **Options:**
45
+
46
+ - `-f, --force` - Force validation even if already passed
47
+ - `-v, --verbose` - Show detailed progress and output
48
+ - `-y, --yaml` - Output validation result as YAML to stdout
49
+ - `-c, --check` - Check if validation has already passed (do not run)
50
+ - `-d, --debug` - Create output files for all steps (for debugging)
51
+ - `--no-lock` - Allow concurrent validation runs (disables single-instance mode)
52
+ - `--no-wait` - Exit immediately if validation is already running (for background hooks)
53
+ - `--wait-timeout <seconds>` - Maximum time to wait for running validation (default: 300)
54
+
55
+ **Examples:**
56
+
57
+ ```bash
58
+ vibe-validate validate # Use cache if available
59
+ vibe-validate validate --force # Always run validation
60
+ vibe-validate validate --check # Just check if already passed
61
+ ```
62
+
63
+ ---
64
+
65
+ ### `init`
66
+
67
+ Initialize vibe-validate configuration
68
+
69
+ **What it does:**
70
+
71
+ Creates vibe-validate.config.yaml in project root
72
+ Optionally sets up pre-commit hooks
73
+ Optionally creates GitHub Actions workflow
74
+ Optionally updates .gitignore
75
+
76
+ **Exit codes:**
77
+
78
+ - `0` - Configuration created successfully
79
+ - `1` - Failed (config exists without --force, or invalid template)
80
+
81
+ **Creates/modifies:**
82
+
83
+ - vibe-validate.config.yaml (always)
84
+ - .husky/pre-commit (with --setup-hooks)
85
+ - .github/workflows/validate.yml (with --setup-workflow)
86
+ - Updates .gitignore (with --fix-gitignore)
87
+
88
+ **Options:**
89
+
90
+ - `-t, --template <name>` - Template to use (minimal|typescript-library|typescript-nodejs|typescript-react)
91
+ - `-f, --force` - Overwrite existing configuration
92
+ - `--dry-run` - Preview changes without writing files
93
+ - `--setup-hooks` - Install pre-commit hook
94
+ - `--setup-workflow` - Create GitHub Actions workflow
95
+ - `--fix-gitignore` - Add state file to .gitignore
96
+
97
+ **Examples:**
98
+
99
+ ```bash
100
+ vibe-validate init # Uses minimal template
101
+ vibe-validate init --template typescript-nodejs
102
+ vibe-validate init --template typescript-nodejs --setup-workflow --setup-hooks
103
+ vibe-validate init --force --template typescript-react # Overwrite existing
104
+ ```
105
+
106
+ ---
107
+
108
+ ### `pre-commit`
109
+
110
+ Run branch sync check + validation (recommended before commit)
111
+
112
+ **What it does:**
113
+
114
+ 1. Runs sync-check (fails if branch behind origin/main)
115
+ 2. Runs validate (with caching)
116
+ 3. Reports git status (warns about unstaged files)
117
+
118
+ **Exit codes:**
119
+
120
+ - `0` - Sync OK and validation passed
121
+ - `1` - Sync failed OR validation failed
122
+
123
+ **When to use:** Run before every commit to ensure code is synced and validated
124
+
125
+ **Options:**
126
+
127
+ - `--skip-sync` - Skip branch sync check
128
+ - `-v, --verbose` - Show detailed progress and output
129
+
130
+ **Error recovery:**
131
+
132
+ If **sync failed**:
133
+ ```bash
134
+ git fetch origin
135
+ git merge origin/main
136
+ Resolve conflicts if any
137
+ vibe-validate pre-commit # Retry
138
+ ```
139
+
140
+ If **validation failed**:
141
+ ```bash
142
+ Fix errors shown in output
143
+ vibe-validate pre-commit # Retry
144
+ ```
145
+
146
+ **Examples:**
147
+
148
+ ```bash
149
+ vibe-validate pre-commit # Standard pre-commit workflow
150
+ vibe-validate pre-commit --skip-sync # Skip sync check (not recommended)
151
+ ```
152
+
153
+ ---
154
+
155
+ ### `state`
156
+
157
+ Show current validation state from git notes (or run cache if no config)
158
+
159
+ **What it does:**
160
+
161
+ Shows validation pass/fail status
162
+ Shows git tree hash (cache key)
163
+ Shows timestamp of last validation
164
+ Shows error summary (if failed)
165
+
166
+ **Exit codes:**
167
+
168
+ - `0` - State file found and read successfully
169
+ - `1` - State file not found or invalid
170
+
171
+ **When to use:** Debug why validation is cached/not cached, or see errors without re-running
172
+
173
+ **Options:**
174
+
175
+ - `-v, --verbose` - Show full error output without truncation
176
+ - `--runs` - Show only run cache (not validation history)
177
+ - `--all` - Show both validation history and run cache
178
+
179
+ **Examples:**
180
+
181
+ ```bash
182
+ vibe-validate state # Show current state
183
+ vibe-validate state --verbose # Show full error output
184
+ ```
185
+
186
+ ---
187
+
188
+ ### `sync-check`
189
+
190
+ Check if branch is behind remote main branch
191
+
192
+ **What it does:**
193
+
194
+ Checks if current branch is behind remote main
195
+ Compares local and remote commit histories
196
+ Reports sync status
197
+
198
+ **Exit codes:**
199
+
200
+ - `0` - Up to date or no remote tracking
201
+ - `1` - Branch is behind (needs merge)
202
+ - `2` - Git command failed
203
+
204
+ **Options:**
205
+
206
+ - `--main-branch <branch>` - Main branch name (overrides config)
207
+ - `--remote-origin <remote>` - Remote origin name (overrides config)
208
+ - `--yaml` - Output YAML only (no human-friendly display)
209
+
210
+ **Error recovery:**
211
+
212
+ If **branch behind (exit 1)**:
213
+ ```bash
214
+ git fetch origin
215
+ git merge origin/main # or git rebase origin/main
216
+ Resolve conflicts if any
217
+ vibe-validate pre-commit # Retry
218
+ ```
219
+
220
+ **Examples:**
221
+
222
+ ```bash
223
+ vibe-validate sync-check
224
+ vibe-validate sync-check --yaml # YAML output only
225
+ ```
226
+
227
+ ---
228
+
229
+ ### `cleanup`
230
+
231
+ Post-merge cleanup (switch to main, delete merged branches)
232
+
233
+ **What it does:**
234
+
235
+ 1. Switches to main branch
236
+ 2. Pulls latest from origin/main
237
+ 3. Identifies merged branches (via git log)
238
+ 4. Deletes confirmed-merged branches
239
+ 5. Reports cleanup summary
240
+
241
+ **Exit codes:**
242
+
243
+ - `0` - Cleanup successful
244
+ - `1` - Failed (not on deletable branch, git errors)
245
+
246
+ **When to use:** After PR merge to clean up local branches
247
+
248
+ **Options:**
249
+
250
+ - `--main-branch <branch>` - Main branch name
251
+ - `--dry-run` - Show what would be deleted without actually deleting
252
+ - `--yaml` - Output YAML only (no human-friendly display)
253
+
254
+ **Examples:**
255
+
256
+ ```bash
257
+ vibe-validate cleanup --dry-run # Preview
258
+ vibe-validate cleanup # Execute
259
+ ```
260
+
261
+ ---
262
+
263
+ ### `cleanup-temp`
264
+
265
+ Clean up old temporary output files
266
+
267
+ **Options:**
268
+
269
+ - `--older-than <days>` - Delete files older than N days
270
+ - `--all` - Delete all temp files regardless of age
271
+ - `--dry-run` - Show what would be deleted without actually deleting
272
+ - `--yaml` - Output YAML only (no human-friendly display)
273
+
274
+ ---
275
+
276
+ ### `config`
277
+
278
+ Show or validate vibe-validate configuration
279
+
280
+ **What it does:**
281
+
282
+ Shows resolved configuration
283
+ Validates configuration structure
284
+ Displays all configuration settings
285
+
286
+ **Exit codes:**
287
+
288
+ - `0` - Configuration valid
289
+ - `1` - Configuration invalid or not found
290
+
291
+ **Options:**
292
+
293
+ - `--validate` - Validate configuration only (exit 0 if valid, 1 if invalid)
294
+ - `-v, --verbose` - Show detailed configuration with explanations
295
+
296
+ **Examples:**
297
+
298
+ ```bash
299
+ vibe-validate config # Show config
300
+ vibe-validate config --validate # Validate only
301
+ ```
302
+
303
+ ---
304
+
305
+ ### `generate-workflow`
306
+
307
+ Generate GitHub Actions workflow from vibe-validate config
308
+
309
+ **What it does:**
310
+
311
+ Generates .github/workflows/validate.yml from config
312
+ Supports matrix mode (multiple Node/OS versions)
313
+ Supports non-matrix mode (separate jobs per phase)
314
+ Can check if workflow is in sync with config
315
+
316
+ **Exit codes:**
317
+
318
+ - `0` - Workflow generated (or in sync with --check)
319
+ - `1` - Generation failed (or out of sync with --check)
320
+
321
+ **Creates/modifies:**
322
+
323
+ - .github/workflows/validate.yml
324
+
325
+ **Options:**
326
+
327
+ - `--check` - Check if workflow is in sync with config (exit 0 if in sync, 1 if not)
328
+ - `--dry-run` - Show generated workflow without writing to file
329
+ - `--coverage` - Enable coverage reporting (Codecov)
330
+ - `--node-versions <versions>` - Node.js versions to test (comma-separated, default: "20,22")
331
+ - `--os <systems>` - Operating systems to test (comma-separated, default: "ubuntu-latest")
332
+ - `--fail-fast` - Fail fast in matrix strategy (default: false)
333
+
334
+ **Examples:**
335
+
336
+ ```bash
337
+ vibe-validate generate-workflow
338
+ vibe-validate generate-workflow --node-versions 20,22 --os ubuntu-latest,macos-latest
339
+ vibe-validate generate-workflow --check # Verify workflow is up to date
340
+ ```
341
+
342
+ ---
343
+
344
+ ### `doctor`
345
+
346
+ Diagnose vibe-validate setup and environment (run after upgrading)
347
+
348
+ **What it does:**
349
+
350
+ Checks Node.js version (20+)
351
+ Verifies git repository exists
352
+ Checks package manager availability
353
+ Validates configuration file
354
+ Checks pre-commit hook setup
355
+ Verifies GitHub Actions workflow
356
+
357
+ **Exit codes:**
358
+
359
+ - `0` - All critical checks passed
360
+ - `1` - One or more critical checks failed
361
+
362
+ **When to use:** Diagnose setup issues or verify environment before using vibe-validate
363
+
364
+ **Options:**
365
+
366
+ - `--yaml` - Output YAML only (no human-friendly display)
367
+
368
+ **Examples:**
369
+
370
+ ```bash
371
+ vibe-validate doctor # Run diagnostics
372
+ vibe-validate doctor --yaml # YAML output only
373
+ ```
374
+
375
+ ---
376
+
377
+ ### `watch-pr`
378
+
379
+ Watch CI checks for a pull/merge request in real-time
380
+
381
+ **What it does:**
382
+
383
+ 1. Detects PR from current branch (or uses provided PR number)
384
+ 2. Polls CI provider (GitHub Actions) for check status
385
+ 3. Shows real-time progress of all matrix jobs
386
+ 4. On failure: fetches logs and extracts vibe-validate state file
387
+ 5. Provides actionable recovery commands
388
+ 6. Exits when all checks complete or timeout reached
389
+
390
+ **Exit codes:**
391
+
392
+ - `0` - All checks passed
393
+ - `1` - One or more checks failed
394
+ - `2` - Timeout reached before completion
395
+
396
+ **When to use:** Monitor CI checks in real-time after pushing to PR, especially useful for AI agents
397
+
398
+ **Options:**
399
+
400
+ - `--provider <name>` - Force specific CI provider (github-actions, gitlab-ci)
401
+ - `--yaml` - Output YAML only (no interactive display)
402
+ - `--timeout <seconds>` - Maximum time to wait in seconds (default: 3600)
403
+ - `--poll-interval <seconds>` - Polling frequency in seconds (default: 10)
404
+ - `--fail-fast` - Exit immediately on first check failure
405
+
406
+ **Error recovery:**
407
+
408
+ If **check fails**:
409
+ ```bash
410
+ # View validation result from YAML output
411
+ vibe-validate watch-pr 42 --yaml | yq '.failures[0].validationResult'
412
+
413
+ # Re-run failed check
414
+ gh run rerun <run-id> --failed
415
+ ```
416
+
417
+ If **no PR found**:
418
+ ```bash
419
+ # Create PR first
420
+ gh pr create
421
+
422
+ # Or specify PR number explicitly
423
+ vibe-validate watch-pr 42
424
+ ```
425
+
426
+ **Examples:**
427
+
428
+ ```bash
429
+ git push origin my-branch
430
+ vibe-validate watch-pr # Auto-detect PR
431
+ vibe-validate watch-pr 42 # Watch specific PR
432
+ vibe-validate watch-pr --yaml # YAML output only
433
+ vibe-validate watch-pr --fail-fast # Exit on first failure
434
+ vibe-validate watch-pr --timeout 600 # 10 minute timeout
435
+ ```
436
+
437
+ ---
438
+
439
+ ### `history`
440
+
441
+ View and manage validation history stored in git notes
442
+
443
+ ---
444
+
445
+ ### `run`
446
+
447
+ Run a command and extract LLM-friendly errors (with smart caching)
448
+
449
+ **What it does:**
450
+
451
+ 1. Executes command in shell subprocess
452
+ 2. Captures stdout and stderr output
453
+ 3. Auto-detects format (vitest, jest, tsc, eslint, etc.)
454
+ 4. Extracts errors using appropriate extractor
455
+ 5. Outputs structured YAML with error details
456
+ 6. Passes through exit code from command
457
+
458
+ **Exit codes:**
459
+
460
+ - `0` - Command succeeded
461
+ - `1` - Command failed (same code as original command)
462
+
463
+ **When to use:** Run individual tests or validation steps with LLM-friendly error extraction
464
+
465
+ **Options:**
466
+
467
+ - `--check` - Check if cached result exists without executing
468
+ - `--force` - Force execution and update cache (bypass cache read)
469
+ - `--cwd <directory>` - Working directory relative to git root (default: git root)
470
+ - `--head <lines>` - Display first N lines of output after YAML (on stderr)
471
+ - `--tail <lines>` - Display last N lines of output after YAML (on stderr)
472
+ - `--verbose` - Display all output after YAML (on stderr)
473
+
474
+ **Examples:**
475
+
476
+ ```bash
477
+ vibe-validate run "npx vitest test.ts" # Single test file
478
+ vibe-validate run "npx vitest -t 'test name'" # Specific test
479
+ vibe-validate run "pnpm --filter @pkg test" # Package tests
480
+ vibe-validate run "npx tsc --noEmit" # Type check
481
+ vibe-validate run "pnpm lint" # Lint
482
+ ```
483
+
484
+ ---
485
+
486
+ ### `create-extractor`
487
+
488
+ Create a new extractor plugin from template
489
+
490
+ **Options:**
491
+
492
+ - `--description <desc>` - Plugin description
493
+ - `--author <author>` - Author name and email
494
+ - `--detection-pattern <pattern>` - Detection keyword or pattern
495
+ - `--priority <number>` - Detection priority (higher = check first)
496
+ - `-f, --force` - Overwrite existing plugin directory
497
+
498
+ ---
499
+
500
+ ## Global Options
501
+
502
+ - `-V, --version` - Show vibe-validate version
503
+ - `-v, --verbose` - Show detailed output (use with --help for this output)
504
+ - `-h, --help` - Show help for command
505
+
506
+ ## Files
507
+
508
+ | File | Purpose |
509
+ |------|---------|
510
+ | `vibe-validate.config.yaml` | Configuration (required) |
511
+ | `refs/notes/vibe-validate/validate` | Validation state (git notes, auto-created) |
512
+ | `.github/workflows/validate.yml` | CI workflow (optional, generated) |
513
+ | `.husky/pre-commit` | Pre-commit hook (optional, setup via init) |
514
+
515
+ ## Common Workflows
516
+
517
+ ### First-time setup
518
+
519
+ ```bash
520
+ vibe-validate init --template typescript-nodejs --setup-workflow
521
+ git add vibe-validate.config.yaml .github/workflows/validate.yml
522
+ git commit -m "feat: add vibe-validate"
523
+ ```
524
+
525
+ ### Before every commit (recommended)
526
+
527
+ ```bash
528
+ vibe-validate pre-commit
529
+ # If fails: fix errors and retry
530
+ ```
531
+
532
+ ### After PR merge
533
+
534
+ ```bash
535
+ vibe-validate cleanup
536
+ # Cleans up merged branches
537
+ ```
538
+
539
+ ### Check validation state
540
+
541
+ ```bash
542
+ vibe-validate state --verbose
543
+ # Debug why validation failed
544
+ ```
545
+
546
+ ### Force re-validation
547
+
548
+ ```bash
549
+ vibe-validate validate --force
550
+ # Bypass cache, always run
551
+ ```
552
+
553
+ ## Exit Codes
554
+
555
+ | Code | Meaning |
556
+ |------|---------|
557
+ | `0` | Success |
558
+ | `1` | Failure (validation failed, sync check failed, invalid config) |
559
+ | `2` | Error (git command failed, file system error) |
560
+
561
+ ## Caching
562
+
563
+ - **Cache key**: Git tree hash of working directory (includes untracked files)
564
+ - **Cache hit**: Validation skipped (sub-second)
565
+ - **Cache miss**: Full validation runs (~60-90s)
566
+ - **Invalidation**: Any file change (tracked or untracked)
567
+
568
+ ---
569
+
570
+ For more details: https://github.com/jdutton/vibe-validate