Welcome to vibe-validate! This guide will help you set up validation orchestration with git tree hash caching in your project.
vibe-validate is a validation orchestration tool designed for developers using AI assistants. It:
- ✅ Automatically protects your work - every validation creates recoverable snapshots
- ✅ Caches validation results using git tree hashes (dramatic speedup)
- ✅ Runs validation steps in parallel for faster execution
- ✅ Formats errors for LLMs - strips noise, provides actionable fixes
- ✅ Detects AI assistants - auto-optimizes output for Claude Code, Cursor, Aider, Continue
- ✅ Integrates with git workflows - branch sync checking, pre-commit validation
- ✅ Works with any language - JavaScript/TypeScript templates included, but language-agnostic
- Node.js 20 or higher
- Git
- npm, pnpm, or yarn
# Using npm
npm install -D vibe-validate
# Using pnpm
pnpm add -D vibe-validate
# Using yarn
yarn add -D vibe-validateOnce installed, you can use the shorter vv command instead of npx vibe-validate:
vv validate # Same as: npx vibe-validate validate
vv init # Same as: npx vibe-validate init
vv doctor # Same as: npx vibe-validate doctor
vv run npm test # Same as: npx vibe-validate run npm testBenefits:
- Shorter: Type
vvinstead ofnpx vibe-validate(85% less typing!) - Context-aware: Automatically finds the right installation (dev, local, or global)
- Works everywhere: From any subdirectory in your project
- No npx overhead: Direct execution for faster startup
When to use what:
- Use
vvafter installation for day-to-day work (recommended) - Use
npx vibe-validatebefore installation to try it out - Both commands work identically - choose whichever you prefer
Examples in this guide:
- Pre-installation examples use
npx vibe-validate - Post-installation examples use
vvfor brevity - You can substitute one for the other at any time
Run the interactive setup wizard:
npx vibe-validate initBy default, this creates a minimal configuration. To use a specific template:
npx vibe-validate init --template typescript-nodejsAvailable templates:
minimal- Bare-bones starting point (default)typescript-library- npm packages and shared librariestypescript-nodejs- Node.js apps, APIs, and backend servicestypescript-react- React SPAs and Next.js applications
Result: Creates vibe-validate.config.yaml in your project root.
vv validateFirst run: Executes all validation steps (may take 30-120 seconds depending on project size).
Subsequent runs: If code unchanged, validation completes in under a second (cache hit!).
For convenience, add to your package.json:
{
"scripts": {
"validate": "vibe-validate validate",
"pre-commit": "vibe-validate pre-commit"
}
}Now you can run:
npm run validate
npm run pre-commitCongratulations! By running your first validation, you've created a safety snapshot of all your files.
If you accidentally delete or modify files, you can recover them:
# View your validation history
vv history list
# Shows something like:
# 2025-12-02 15:30:45 abc123def main ✓ PASSED
# That tree hash (abc123def) contains all your files
# You can view any file from that point:
git cat-file -p abc123def:src/index.ts
# Or recover it:
git cat-file -p abc123def:src/index.ts > src/index.tsWhat just happened?
vibe-validate created git objects for every file in your working directory (respecting .gitignore). Even if files are unstaged or untracked, they're now recoverable via the tree hash.
When does this happen?
- Every time you run
vv validate - Every time you run
vv pre-commit - Every time you run
vv run <command>(v0.15.0+)
Think of it as automatic "checkpoint saves" for your codebase.
Learn more: Work Protection Guide
After running init, you'll have a configuration file that looks like this:
# vibe-validate.config.yaml
$schema: https://unpkg.com/@vibe-validate/config/config.schema.json
# Git integration settings
git:
mainBranch: main
remoteOrigin: origin
autoSync: false # Never auto-merge - safety first
# CI/CD configuration
ci:
dependencyLockCheck:
runOn: pre-commit # Verify lock files before commit
# Validation configuration
validation:
phases:
- name: Validation
parallel: false
steps:
- name: Tests
command: npm test
failFast: true # Stop at first failureNote: This is the minimal template. For more comprehensive setups with linting, type-checking, and build steps, use one of the other templates:
typescript-library- Complete setup for npm packagestypescript-nodejs- Full validation for Node.js appstypescript-react- Optimized for React applications
View all templates at: https://github.com/jdutton/vibe-validate/tree/main/packages/cli/config-templates
Phases: Groups of validation steps
- Parallel phases: Steps run simultaneously (faster, good for independent checks)
- Sequential phases: Steps run one after another (for dependent checks)
Caching Strategy:
git-tree-hash(recommended): Caches based on actual code contenttimestamp: Caches based on file modification timesdisabled: No caching
Fail Fast:
false: Runs all steps even if some fail (better error visibility)true: Stops at first failure (faster feedback on breakage)
Recommended: Run validation before every commit to catch issues early.
Add to your workflow:
# Before committing
npm run pre-commit
# This command:
# 1. Checks if branch is behind origin/main
# 2. Runs validation (uses cache if code unchanged)
# 3. Reports status
# If validation passes, proceed with commit
git add .
git commit -m "feat: add new feature"Set up automatic validation on commit using Husky:
# Install Husky
npm install -D husky
npx husky installAdd to package.json:
{
"scripts": {
"prepare": "husky install"
}
}Create .husky/pre-commit:
#!/bin/sh
npm run pre-commitNow validation runs automatically before every commit!
Add to your GitHub Actions workflow:
# .github/workflows/validate.yml
name: Validate
on: [push, pull_request]
jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
- run: npm install
- run: npx vibe-validate validateBenefits:
- Consistent validation between local and CI
- JSON output for CI parsing
- Fast parallel execution
- Exit code 0 (pass) or 1 (fail)
vibe-validate uses deterministic git tree hashing for cache keys:
# First run (cache miss)
$ npx vibe-validate validate
Phase 1: Pre-Qualification ━━━━━━━━━━━━━━━ 15s
Phase 2: Testing ━━━━━━━━━━━━━━━━━━━━━━━━ 75s
✅ Validation passed (90s)
# Second run (cache hit - code unchanged)
$ npx vibe-validate validate
✅ Validation cached (< 1s)Cache key calculation:
git add --intent-to-add .- Mark untracked files (no actual staging)git write-tree- Generate content-based hashgit reset- Restore index to clean state
Why it works:
- Content-based (not timestamp-based)
- Includes untracked files
- Deterministic (same code = same hash)
- No side effects (index restored after calculation)
Cache is invalidated when:
- ✅ Any file content changes (tracked or untracked)
- ✅ New files are added
- ✅ Files are deleted
- ✅ Git tree structure changes
Cache is NOT invalidated by:
- ❌ File modification timestamps
- ❌ Git commit history
- ❌ Git branch changes
- ❌ Environment variables
-
Organize validation steps efficiently:
- Put fast checks first (TypeScript, ESLint)
- Put slow checks last (tests, builds)
- Run independent checks in parallel phases
-
Use fail-fast for quick feedback:
validation: failFast: true # Stop at first failure
-
Skip expensive checks in pre-commit:
- Run quick checks (lint, typecheck) in pre-commit
- Run full suite (tests, build) in CI
# Initialize configuration
vv init
# Run validation
vv validate
# Run validation (force, bypass cache)
vv validate --force
# Pre-commit workflow
vv pre-commit
# Check branch sync
vv sync-check
# Show validation state
vv state
# Show configuration
vv config
# Post-merge cleanup
vv cleanup- Customize configuration: See Configuration Reference
- Learn CLI commands: See CLI Reference
- Use config templates: See Config Templates Guide
- Set up dependency lock check: See Dependency Lock Check
- Integrate with AI assistants: See Agent Integration Guide
- Understand error extractors: See Error Extractors Guide
Problem: Cache not working, validation runs full every time.
Solution:
- Check validation status:
vv validate --check - Ensure working tree is clean:
git status - View validation state:
vv state - Try force re-validation:
vv validate --force
Problem: vv or vibe-validate command not recognized.
Solution:
- Ensure installed:
npm install -D vibe-validate - Try using
vvdirectly (post-install):vv validate - Use
npxprefix if needed:npx vibe-validate validate - Check npm bin directory is in PATH
Problem: "No configuration file found" error.
Solution:
- Run
vv initto create config (ornpx vibe-validate initpre-install) - Ensure config is in project root
- Config must be named
vibe-validate.config.yaml
Problem: Tests pass locally but fail in CI environment.
Solution:
- Run
vv validate --forcelocally - Check for environment-specific issues:
- Hardcoded paths
- Missing environment variables
- Flaky tests
- Timezone/locale differences
- Ensure test isolation (no shared state)
- Match CI Node.js version locally
- GitHub Issues: github.com/jdutton/vibe-validate/issues
- Documentation:
docs/ - Examples: See configuration templates in
packages/cli/config-templates/
See CONTRIBUTING.md for development setup and guidelines.