@vibe-validate/cli 0.14.0 → 0.14.1

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,348 @@
1
+ # vibe-validate Configuration Templates
2
+
3
+ Ready-to-use YAML configuration templates optimized for specific frameworks and project types.
4
+
5
+ ## What are Config Templates?
6
+
7
+ Configuration templates are battle-tested configs that provide:
8
+
9
+ - **Sensible defaults** - Pre-configured validation phases and steps
10
+ - **Performance optimization** - Parallel execution where possible
11
+ - **Fail-fast ordering** - Fast checks run first
12
+ - **Framework-specific tools** - TypeScript, ESLint, test runners, etc.
13
+ - **Easy customization** - Edit YAML directly to fit your needs
14
+
15
+ **Benefits:**
16
+ - ⚔ **Fast setup** - Copy and customize in seconds
17
+ - šŸŽÆ **Best practices** - Based on real-world usage patterns
18
+ - šŸ“ **Transparent** - Everything visible in YAML (no hidden defaults)
19
+ - šŸ” **Discoverable** - Browse templates on GitHub
20
+ - šŸ¤ **Contributable** - Anyone can submit template PRs (no TypeScript knowledge needed)
21
+
22
+ ## Available Templates
23
+
24
+ ### [minimal.yaml](./minimal.yaml)
25
+ **For:** Custom projects, starting from scratch
26
+
27
+ **Validation phases:**
28
+ 1. Quick Check: Lint + tests
29
+
30
+ **Use when:**
31
+ - Building non-TypeScript projects (Python, Rust, Go, etc.)
32
+ - Need complete control over validation phases
33
+ - Learning the configuration format
34
+ - Experimenting with custom workflows
35
+
36
+ ---
37
+
38
+ ### [typescript-library.yaml](./typescript-library.yaml)
39
+ **For:** TypeScript libraries, npm packages, shared components
40
+
41
+ **Validation phases:**
42
+ 1. Pre-Qualification (parallel): TypeScript compilation, ESLint
43
+ 2. Build & Test: Unit tests, then build
44
+
45
+ **Use when:**
46
+ - Publishing to npm
47
+ - Building reusable libraries
48
+ - Creating shared components
49
+
50
+ ---
51
+
52
+ ### [typescript-nodejs.yaml](./typescript-nodejs.yaml)
53
+ **For:** Node.js applications, backend services, APIs, CLI tools
54
+
55
+ **Validation phases:**
56
+ 1. Pre-Qualification (parallel): TypeScript compilation, ESLint
57
+ 2. Testing (parallel): Unit tests, integration tests
58
+ 3. Build: Application build
59
+
60
+ **Use when:**
61
+ - Building REST APIs
62
+ - Creating Express/Fastify applications
63
+ - Developing backend microservices
64
+ - Building CLI tools
65
+ - Creating serverless functions
66
+
67
+ ---
68
+
69
+ ### [typescript-react.yaml](./typescript-react.yaml)
70
+ **For:** React applications, SPAs, Next.js apps
71
+
72
+ **Validation phases:**
73
+ 1. Pre-Qualification (parallel): TypeScript compilation, ESLint
74
+ 2. Testing: Unit tests with coverage
75
+ 3. Build: Application build
76
+
77
+ **Use when:**
78
+ - Building React SPAs
79
+ - Creating Next.js applications
80
+ - Developing React Native apps
81
+ - Building frontend applications
82
+
83
+ ---
84
+
85
+ ## Using These Templates
86
+
87
+ You can use these templates by copying them directly from this directory. In the future, `vibe-validate init` will support interactive template selection.
88
+
89
+ ### Option 1: Download with curl
90
+
91
+ ```bash
92
+ # Choose a template and download
93
+ curl -o vibe-validate.config.yaml \
94
+ https://raw.githubusercontent.com/jdutton/vibe-validate/main/config-templates/typescript-nodejs.yaml
95
+ ```
96
+
97
+ ### Option 2: Manual Copy
98
+
99
+ 1. Browse templates: [`config-templates/`](https://github.com/jdutton/vibe-validate/tree/main/config-templates)
100
+ 2. Open the template that fits your project
101
+ 3. Click "Raw" button
102
+ 4. Copy the content
103
+ 5. Create `vibe-validate.config.yaml` in your project root
104
+ 6. Paste the content
105
+
106
+ ### Option 3: Clone and Copy
107
+
108
+ ```bash
109
+ # Clone vibe-validate repo
110
+ git clone https://github.com/jdutton/vibe-validate.git
111
+
112
+ # Copy template to your project
113
+ cp vibe-validate/config-templates/typescript-nodejs.yaml \
114
+ /path/to/your/project/vibe-validate.config.yaml
115
+
116
+ # Clean up
117
+ rm -rf vibe-validate
118
+ ```
119
+
120
+ ---
121
+
122
+ ## Customizing Templates
123
+
124
+ All templates can be customized to match your project needs:
125
+
126
+ ### Change Commands
127
+
128
+ Update step commands to match your package.json scripts:
129
+
130
+ ```yaml
131
+ steps:
132
+ - name: Tests
133
+ command: pnpm test # Change from: npm test
134
+ ```
135
+
136
+ ### Add New Steps
137
+
138
+ Add additional validation steps to any phase:
139
+
140
+ ```yaml
141
+ steps:
142
+ - name: TypeScript
143
+ command: tsc --noEmit
144
+ - name: ESLint
145
+ command: eslint src/
146
+ - name: Prettier # ← Add this
147
+ command: prettier --check .
148
+ ```
149
+
150
+ ### Add New Phases
151
+
152
+ Add entirely new validation phases:
153
+
154
+ ```yaml
155
+ phases:
156
+ - name: Pre-Qualification
157
+ # ... existing steps
158
+
159
+ - name: Security # ← Add this phase
160
+ parallel: false
161
+ steps:
162
+ - name: Audit
163
+ command: npm audit --production
164
+ ```
165
+
166
+ ### Adjust Parallelization
167
+
168
+ ```yaml
169
+ validation:
170
+ phases:
171
+ - name: Testing
172
+ parallel: false # Changed from 'true' - run sequentially
173
+ steps:
174
+ - name: Unit Tests
175
+ command: npm run test:unit
176
+ - name: Integration Tests
177
+ command: npm run test:integration
178
+ ```
179
+
180
+ ### Override Git Settings
181
+
182
+ ```yaml
183
+ git:
184
+ mainBranch: develop # Changed from 'main'
185
+ autoSync: true # Changed from 'false'
186
+ ```
187
+
188
+ ---
189
+
190
+ ## Template Best Practices
191
+
192
+ ### 1. Start with a Template
193
+
194
+ **Don't start from scratch** - Choose the template closest to your project type and customize it.
195
+
196
+ ### 2. Keep Commands Simple
197
+
198
+ **Good:**
199
+ ```yaml
200
+ - name: Tests
201
+ command: npm test
202
+ ```
203
+
204
+ **Avoid:**
205
+ ```yaml
206
+ - name: Tests
207
+ command: npm test && npm run coverage && npm run report
208
+ ```
209
+
210
+ **Why:** Separate concerns into individual steps for:
211
+ - Better failure isolation
212
+ - Clearer error messages
213
+ - Easier debugging
214
+ - More granular caching
215
+
216
+ ### 3. Order Steps by Speed
217
+
218
+ **Fast checks first:**
219
+ ```yaml
220
+ steps:
221
+ - name: Lint (2s)
222
+ command: npm run lint
223
+ - name: Type Check (5s)
224
+ command: tsc --noEmit
225
+ - name: Tests (30s)
226
+ command: npm test
227
+ - name: Build (45s)
228
+ command: npm run build
229
+ ```
230
+
231
+ **Why:** Fail-fast principle - catch errors early, save time.
232
+
233
+ ### 4. Use Parallel Execution Wisely
234
+
235
+ **Parallelize when steps are independent:**
236
+ ```yaml
237
+ - name: Pre-Qualification
238
+ parallel: true # āœ… These can run at the same time
239
+ steps:
240
+ - name: TypeScript
241
+ command: tsc --noEmit
242
+ - name: ESLint
243
+ command: eslint .
244
+ ```
245
+
246
+ **Sequential when steps depend on each other:**
247
+ ```yaml
248
+ - name: Build & Deploy
249
+ parallel: false # āœ… Build must finish before deploy
250
+ steps:
251
+ - name: Build
252
+ command: npm run build
253
+ - name: Deploy
254
+ command: npm run deploy
255
+ ```
256
+
257
+ ### 5. Keep Phases Focused
258
+
259
+ **Good:**
260
+ ```yaml
261
+ validation:
262
+ phases:
263
+ - name: Code Quality
264
+ steps: [lint, typecheck]
265
+ - name: Testing
266
+ steps: [unit tests, integration tests]
267
+ - name: Build
268
+ steps: [build]
269
+ ```
270
+
271
+ **Avoid:**
272
+ ```yaml
273
+ validation:
274
+ phases:
275
+ - name: Everything
276
+ steps: [lint, typecheck, test, build, deploy, cleanup]
277
+ ```
278
+
279
+ **Why:** Focused phases make:
280
+ - Failures easier to diagnose
281
+ - Logs easier to read
282
+ - Caching more granular
283
+
284
+ ### 6. Document Custom Commands
285
+
286
+ If your project uses non-standard commands, add comments:
287
+
288
+ ```yaml
289
+ steps:
290
+ - name: Custom Validation
291
+ command: ./scripts/validate-schemas.sh # Validates JSON schemas in /config
292
+ ```
293
+
294
+ ### 7. Test Your Config
295
+
296
+ After customizing a template:
297
+
298
+ ```bash
299
+ # Validate config syntax
300
+ vibe-validate config --validate
301
+
302
+ # Run validation once
303
+ vibe-validate validate
304
+
305
+ # Check results
306
+ vibe-validate state
307
+ ```
308
+
309
+ ---
310
+
311
+ ## Validation
312
+
313
+ All templates in this directory are:
314
+
315
+ āœ… **Valid YAML** - Syntax checked
316
+ āœ… **Schema compliant** - Validated against JSON Schema
317
+ āœ… **Tested** - Used in CI/CD tests
318
+ āœ… **Documented** - Include helpful comments
319
+
320
+ ---
321
+
322
+ ## Related Documentation
323
+
324
+ - [Getting Started Guide](../docs/getting-started.md)
325
+ - [Configuration Reference](../docs/configuration-reference.md)
326
+ - [CLI Reference](../docs/cli-reference.md)
327
+
328
+ ---
329
+
330
+ ## Contributing
331
+
332
+ When adding new templates:
333
+
334
+ 1. Follow existing naming convention: `{framework}-{type}.yaml`
335
+ 2. Include header comment explaining the template's purpose
336
+ 3. Add comprehensive inline comments
337
+ 4. Update this README with template description
338
+ 5. Add tests to verify template validity
339
+ 6. Ensure JSON Schema URL is correct
340
+
341
+ **Template checklist:**
342
+ - [ ] Valid YAML syntax
343
+ - [ ] Includes `$schema` URL
344
+ - [ ] Has descriptive header comment
345
+ - [ ] Includes inline comments explaining phases
346
+ - [ ] Lists required npm scripts (if applicable)
347
+ - [ ] Added to this README
348
+ - [ ] Tested with `vibe-validate config --validate`
@@ -0,0 +1,47 @@
1
+ # ============================================================================
2
+ # CONFIGURATION TEMPLATE - Minimal vibe-validate Configuration
3
+ # ============================================================================
4
+ #
5
+ # USAGE:
6
+ # 1. Copy this file to your project root as 'vibe-validate.config.yaml'
7
+ # 2. Customize the validation phases and commands for your project
8
+ # 3. Run: vibe-validate validate
9
+ #
10
+ # This is a minimal configuration template with just the essentials.
11
+ # Use this as a starting point for custom projects or non-TypeScript projects
12
+ # (Python, Rust, Go, etc.).
13
+ #
14
+ # Learn more: https://github.com/jdutton/vibe-validate/blob/main/docs/configuration-reference.md
15
+ # ============================================================================
16
+
17
+ $schema: https://raw.githubusercontent.com/jdutton/vibe-validate/main/packages/config/vibe-validate.schema.json
18
+
19
+ # Git settings
20
+ git:
21
+ mainBranch: main
22
+
23
+ # Pre-commit hooks configuration
24
+ hooks:
25
+ preCommit:
26
+ enabled: true
27
+ # Secret scanning prevents accidental credential commits
28
+ # Runs before validation to catch secrets in staged files
29
+ secretScanning:
30
+ enabled: true
31
+ # Gitleaks is recommended for speed and comprehensive detection (160+ secret types)
32
+ # Install: brew install gitleaks (macOS) | https://github.com/gitleaks/gitleaks#installation
33
+ scanCommand: "gitleaks protect --staged --verbose"
34
+ # Alternative tools:
35
+ # - detect-secrets: scanCommand: "detect-secrets scan --staged"
36
+ # - semgrep: scanCommand: "semgrep scan --config auto"
37
+ #
38
+ # False positives: Create .gitleaksignore file with fingerprints
39
+ # To disable: set enabled: false
40
+
41
+ # Validation configuration
42
+ validation:
43
+ phases:
44
+ - name: Validation
45
+ steps:
46
+ - name: Tests
47
+ command: npm test
@@ -0,0 +1,57 @@
1
+ # ============================================================================
2
+ # CONFIGURATION TEMPLATE - vibe-validate for TypeScript Libraries
3
+ # ============================================================================
4
+ #
5
+ # USAGE:
6
+ # 1. Copy this file to your project root as 'vibe-validate.config.yaml'
7
+ # 2. Customize the validation phases and commands for your project
8
+ # 3. Run: vibe-validate validate
9
+ #
10
+ # This template is optimized for TypeScript libraries and npm packages.
11
+ # It includes pre-configured validation phases for type checking, linting,
12
+ # testing, and building.
13
+ #
14
+ # Learn more: https://github.com/jdutton/vibe-validate/blob/main/docs/configuration-reference.md
15
+ # ============================================================================
16
+
17
+ $schema: https://raw.githubusercontent.com/jdutton/vibe-validate/main/packages/config/vibe-validate.schema.json
18
+
19
+ # Git settings
20
+ git:
21
+ mainBranch: main
22
+
23
+ # Pre-commit hooks configuration
24
+ hooks:
25
+ preCommit:
26
+ enabled: true
27
+ # Secret scanning prevents accidental credential commits
28
+ # Runs before validation to catch secrets in staged files
29
+ secretScanning:
30
+ enabled: true
31
+ # Gitleaks is recommended for speed and comprehensive detection (160+ secret types)
32
+ # Install: brew install gitleaks (macOS) | https://github.com/gitleaks/gitleaks#installation
33
+ scanCommand: "gitleaks protect --staged --verbose"
34
+ # Alternative tools:
35
+ # - detect-secrets: scanCommand: "detect-secrets scan --staged"
36
+ # - semgrep: scanCommand: "semgrep scan --config auto"
37
+ #
38
+ # False positives: Create .gitleaksignore file with fingerprints
39
+ # To disable: set enabled: false
40
+
41
+ # Validation configuration
42
+ validation:
43
+ phases:
44
+ - name: Pre-Qualification
45
+ parallel: true
46
+ steps:
47
+ - name: TypeScript
48
+ command: tsc --noEmit
49
+ - name: ESLint
50
+ command: eslint .
51
+
52
+ - name: Build & Test
53
+ steps:
54
+ - name: Unit Tests
55
+ command: npm test
56
+ - name: Build
57
+ command: npm run build
@@ -0,0 +1,64 @@
1
+ # ============================================================================
2
+ # CONFIGURATION TEMPLATE - vibe-validate for Node.js Applications
3
+ # ============================================================================
4
+ #
5
+ # USAGE:
6
+ # 1. Copy this file to your project root as 'vibe-validate.config.yaml'
7
+ # 2. Customize the validation phases and commands for your project
8
+ # 3. Run: vibe-validate validate
9
+ #
10
+ # This template is optimized for Node.js applications including backend services,
11
+ # REST APIs, Express/Fastify apps, CLI tools, and serverless functions.
12
+ # It includes pre-configured validation phases for type checking, linting,
13
+ # unit tests, integration tests, and building.
14
+ #
15
+ # Learn more: https://github.com/jdutton/vibe-validate/blob/main/docs/configuration-reference.md
16
+ # ============================================================================
17
+
18
+ $schema: https://raw.githubusercontent.com/jdutton/vibe-validate/main/packages/config/vibe-validate.schema.json
19
+
20
+ # Git settings
21
+ git:
22
+ mainBranch: main
23
+
24
+ # Pre-commit hooks configuration
25
+ hooks:
26
+ preCommit:
27
+ enabled: true
28
+ # Secret scanning prevents accidental credential commits
29
+ # Runs before validation to catch secrets in staged files
30
+ secretScanning:
31
+ enabled: true
32
+ # Gitleaks is recommended for speed and comprehensive detection (160+ secret types)
33
+ # Install: brew install gitleaks (macOS) | https://github.com/gitleaks/gitleaks#installation
34
+ scanCommand: "gitleaks protect --staged --verbose"
35
+ # Alternative tools:
36
+ # - detect-secrets: scanCommand: "detect-secrets scan --staged"
37
+ # - semgrep: scanCommand: "semgrep scan --config auto"
38
+ #
39
+ # False positives: Create .gitleaksignore file with fingerprints
40
+ # To disable: set enabled: false
41
+
42
+ # Validation configuration
43
+ validation:
44
+ phases:
45
+ - name: Pre-Qualification
46
+ parallel: true
47
+ steps:
48
+ - name: TypeScript
49
+ command: tsc --noEmit
50
+ - name: ESLint
51
+ command: eslint src/
52
+
53
+ - name: Testing
54
+ parallel: true
55
+ steps:
56
+ - name: Unit Tests
57
+ command: npm run test:unit
58
+ - name: Integration Tests
59
+ command: npm run test:integration
60
+
61
+ - name: Build
62
+ steps:
63
+ - name: Build
64
+ command: npm run build
@@ -0,0 +1,64 @@
1
+ # ============================================================================
2
+ # CONFIGURATION TEMPLATE - vibe-validate for React Applications
3
+ # ============================================================================
4
+ #
5
+ # USAGE:
6
+ # 1. Copy this file to your project root as 'vibe-validate.config.yaml'
7
+ # 2. Customize the validation phases and commands for your project
8
+ # 3. Run: vibe-validate validate
9
+ #
10
+ # This template is optimized for React applications including SPAs, Next.js apps,
11
+ # React Native apps, and other frontend applications.
12
+ # It includes pre-configured validation phases for type checking, linting,
13
+ # unit tests, component tests, and building.
14
+ #
15
+ # Learn more: https://github.com/jdutton/vibe-validate/blob/main/docs/configuration-reference.md
16
+ # ============================================================================
17
+
18
+ $schema: https://raw.githubusercontent.com/jdutton/vibe-validate/main/packages/config/vibe-validate.schema.json
19
+
20
+ # Git settings
21
+ git:
22
+ mainBranch: main
23
+
24
+ # Pre-commit hooks configuration
25
+ hooks:
26
+ preCommit:
27
+ enabled: true
28
+ # Secret scanning prevents accidental credential commits
29
+ # Runs before validation to catch secrets in staged files
30
+ secretScanning:
31
+ enabled: true
32
+ # Gitleaks is recommended for speed and comprehensive detection (160+ secret types)
33
+ # Install: brew install gitleaks (macOS) | https://github.com/gitleaks/gitleaks#installation
34
+ scanCommand: "gitleaks protect --staged --verbose"
35
+ # Alternative tools:
36
+ # - detect-secrets: scanCommand: "detect-secrets scan --staged"
37
+ # - semgrep: scanCommand: "semgrep scan --config auto"
38
+ #
39
+ # False positives: Create .gitleaksignore file with fingerprints
40
+ # To disable: set enabled: false
41
+
42
+ # Validation configuration
43
+ validation:
44
+ phases:
45
+ - name: Pre-Qualification
46
+ parallel: true
47
+ steps:
48
+ - name: TypeScript
49
+ command: tsc --noEmit
50
+ - name: ESLint
51
+ command: eslint src/
52
+
53
+ - name: Testing
54
+ parallel: true
55
+ steps:
56
+ - name: Unit Tests
57
+ command: npm run test:unit
58
+ - name: Component Tests
59
+ command: npm run test:component
60
+
61
+ - name: Build
62
+ steps:
63
+ - name: Build
64
+ command: npm run build
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vibe-validate/cli",
3
- "version": "0.14.0",
3
+ "version": "0.14.1",
4
4
  "description": "Command-line interface for vibe-validate validation framework",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -17,6 +17,7 @@
17
17
  },
18
18
  "files": [
19
19
  "dist",
20
+ "config-templates",
20
21
  "watch-pr-result.schema.json",
21
22
  "README.md"
22
23
  ],
@@ -59,11 +60,11 @@
59
60
  "yaml": "^2.6.1",
60
61
  "zod": "^3.24.1",
61
62
  "zod-to-json-schema": "^3.24.6",
62
- "@vibe-validate/config": "0.14.0",
63
- "@vibe-validate/extractors": "0.14.0",
64
- "@vibe-validate/core": "0.14.0",
65
- "@vibe-validate/git": "0.14.0",
66
- "@vibe-validate/history": "0.14.0"
63
+ "@vibe-validate/core": "0.14.1",
64
+ "@vibe-validate/git": "0.14.1",
65
+ "@vibe-validate/extractors": "0.14.1",
66
+ "@vibe-validate/config": "0.14.1",
67
+ "@vibe-validate/history": "0.14.1"
67
68
  },
68
69
  "devDependencies": {
69
70
  "@types/node": "^20.14.8",
@@ -71,7 +72,7 @@
71
72
  "vitest": "^2.0.5"
72
73
  },
73
74
  "scripts": {
74
- "build": "tsc && node dist/scripts/generate-watch-pr-schema.js",
75
+ "build": "tsc && node dist/scripts/generate-watch-pr-schema.js && node scripts/copy-templates.js",
75
76
  "test": "vitest run",
76
77
  "test:watch": "vitest",
77
78
  "test:coverage": "vitest run --coverage",
@@ -1,48 +0,0 @@
1
- /**
2
- * Run Validation with Caching
3
- *
4
- * Shared workflow for running validation with git tree hash caching.
5
- * Used by both validate and pre-commit commands to ensure consistent behavior.
6
- */
7
- import type { ValidationResult, ValidationConfig } from '@vibe-validate/core';
8
- export interface ValidationWorkflowOptions {
9
- /** Runner configuration for validation */
10
- runnerConfig: ValidationConfig;
11
- /** Force validation even if cached */
12
- force?: boolean;
13
- /** Show verbose output */
14
- verbose?: boolean;
15
- /** Callback for displaying cache hit information */
16
- onCacheHit?: (info: {
17
- treeHash: string;
18
- timestamp: string;
19
- duration: number;
20
- branch: string;
21
- result: ValidationResult;
22
- }) => void;
23
- }
24
- export interface ValidationWorkflowResult {
25
- /** Validation result */
26
- result: ValidationResult;
27
- /** Whether result was from cache */
28
- fromCache: boolean;
29
- /** Git tree hash (if in git repo) */
30
- treeHash: string | null;
31
- }
32
- /**
33
- * Run validation with full git tree hash caching workflow.
34
- *
35
- * This is the complete workflow used by both validate and pre-commit commands:
36
- * 1. Get git tree hash
37
- * 2. Check cache (git notes)
38
- * 3. If cache hit: return cached result
39
- * 4. If cache miss: run validation
40
- * 5. Record result to git notes
41
- * 6. Check worktree stability
42
- * 7. Run health checks
43
- *
44
- * @param options - Validation workflow options
45
- * @returns Validation workflow result
46
- */
47
- export declare function runValidationWithCache(options: ValidationWorkflowOptions): Promise<ValidationWorkflowResult>;
48
- //# sourceMappingURL=run-validation-with-cache.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"run-validation-with-cache.d.ts","sourceRoot":"","sources":["../../src/utils/run-validation-with-cache.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAUH,OAAO,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAG9E,MAAM,WAAW,yBAAyB;IACxC,0CAA0C;IAC1C,YAAY,EAAE,gBAAgB,CAAC;IAE/B,sCAAsC;IACtC,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB,0BAA0B;IAC1B,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,oDAAoD;IACpD,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE;QAClB,QAAQ,EAAE,MAAM,CAAC;QACjB,SAAS,EAAE,MAAM,CAAC;QAClB,QAAQ,EAAE,MAAM,CAAC;QACjB,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,EAAE,gBAAgB,CAAC;KAC1B,KAAK,IAAI,CAAC;CACZ;AAED,MAAM,WAAW,wBAAwB;IACvC,wBAAwB;IACxB,MAAM,EAAE,gBAAgB,CAAC;IAEzB,oCAAoC;IACpC,SAAS,EAAE,OAAO,CAAC;IAEnB,qCAAqC;IACrC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,sBAAsB,CAC1C,OAAO,EAAE,yBAAyB,GACjC,OAAO,CAAC,wBAAwB,CAAC,CAqGnC"}
@@ -1,123 +0,0 @@
1
- /**
2
- * Run Validation with Caching
3
- *
4
- * Shared workflow for running validation with git tree hash caching.
5
- * Used by both validate and pre-commit commands to ensure consistent behavior.
6
- */
7
- import { runValidation } from '@vibe-validate/core';
8
- import { getGitTreeHash } from '@vibe-validate/git';
9
- import { recordValidationHistory, checkWorktreeStability, checkHistoryHealth, readHistoryNote, } from '@vibe-validate/history';
10
- import chalk from 'chalk';
11
- /**
12
- * Run validation with full git tree hash caching workflow.
13
- *
14
- * This is the complete workflow used by both validate and pre-commit commands:
15
- * 1. Get git tree hash
16
- * 2. Check cache (git notes)
17
- * 3. If cache hit: return cached result
18
- * 4. If cache miss: run validation
19
- * 5. Record result to git notes
20
- * 6. Check worktree stability
21
- * 7. Run health checks
22
- *
23
- * @param options - Validation workflow options
24
- * @returns Validation workflow result
25
- */
26
- export async function runValidationWithCache(options) {
27
- const { runnerConfig, force = false, verbose = false, onCacheHit } = options;
28
- // Get tree hash BEFORE validation (for caching and stability check)
29
- let treeHashBefore = null;
30
- try {
31
- treeHashBefore = await getGitTreeHash();
32
- }
33
- catch (_error) {
34
- // Not in git repo or git command failed - continue without history
35
- if (verbose) {
36
- console.warn(chalk.yellow('āš ļø Could not get git tree hash - history recording disabled'));
37
- }
38
- }
39
- // Check cache: if validation already passed for this tree hash, skip re-running
40
- if (treeHashBefore && !force) {
41
- try {
42
- const historyNote = await readHistoryNote(treeHashBefore);
43
- if (historyNote && historyNote.runs.length > 0) {
44
- // Find most recent passing run
45
- const passingRun = [...historyNote.runs]
46
- .reverse()
47
- .find(run => run.passed);
48
- if (passingRun && passingRun.result) {
49
- // Cache hit! Call callback if provided
50
- if (onCacheHit) {
51
- onCacheHit({
52
- treeHash: treeHashBefore,
53
- timestamp: passingRun.timestamp,
54
- duration: passingRun.duration,
55
- branch: passingRun.branch,
56
- result: passingRun.result,
57
- });
58
- }
59
- return {
60
- result: passingRun.result,
61
- fromCache: true,
62
- treeHash: treeHashBefore,
63
- };
64
- }
65
- }
66
- }
67
- catch (_error) {
68
- // Cache check failed - proceed with validation
69
- // This is expected for first-time validation
70
- }
71
- }
72
- // Cache miss - run validation
73
- const result = await runValidation(runnerConfig);
74
- // Record validation history (if in git repo and stability check passes)
75
- if (treeHashBefore) {
76
- try {
77
- // Check if worktree changed during validation
78
- const stability = await checkWorktreeStability(treeHashBefore);
79
- if (!stability.stable) {
80
- console.warn(chalk.yellow('\nāš ļø Worktree changed during validation'));
81
- console.warn(chalk.yellow(` Before: ${stability.treeHashBefore.slice(0, 12)}...`));
82
- console.warn(chalk.yellow(` After: ${stability.treeHashAfter.slice(0, 12)}...`));
83
- console.warn(chalk.yellow(' Results valid but history not recorded (unstable state)'));
84
- }
85
- else {
86
- // Record to git notes
87
- const recordResult = await recordValidationHistory(treeHashBefore, result);
88
- if (recordResult.recorded) {
89
- if (verbose) {
90
- console.log(chalk.gray(`\nšŸ“ History recorded (tree: ${treeHashBefore.slice(0, 12)})`));
91
- }
92
- }
93
- else if (verbose) {
94
- console.warn(chalk.yellow(`āš ļø History recording failed: ${recordResult.reason}`));
95
- }
96
- }
97
- }
98
- catch (error) {
99
- // Silent failure - don't block validation
100
- if (verbose) {
101
- const errorMessage = error instanceof Error ? error.message : String(error);
102
- console.warn(chalk.yellow(`āš ļø History recording error: ${errorMessage}`));
103
- }
104
- }
105
- }
106
- // Proactive health check (non-blocking)
107
- try {
108
- const health = await checkHistoryHealth();
109
- if (health.shouldWarn) {
110
- console.log('');
111
- console.log(chalk.blue(health.warningMessage));
112
- }
113
- }
114
- catch {
115
- // Silent failure - don't block validation
116
- }
117
- return {
118
- result,
119
- fromCache: false,
120
- treeHash: treeHashBefore,
121
- };
122
- }
123
- //# sourceMappingURL=run-validation-with-cache.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"run-validation-with-cache.js","sourceRoot":"","sources":["../../src/utils/run-validation-with-cache.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EACL,uBAAuB,EACvB,sBAAsB,EACtB,kBAAkB,EAClB,eAAe,GAChB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,KAAK,MAAM,OAAO,CAAC;AAiC1B;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAC1C,OAAkC;IAElC,MAAM,EAAE,YAAY,EAAE,KAAK,GAAG,KAAK,EAAE,OAAO,GAAG,KAAK,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;IAE7E,oEAAoE;IACpE,IAAI,cAAc,GAAkB,IAAI,CAAC;IACzC,IAAI,CAAC;QACH,cAAc,GAAG,MAAM,cAAc,EAAE,CAAC;IAC1C,CAAC;IAAC,OAAO,MAAM,EAAE,CAAC;QAChB,mEAAmE;QACnE,IAAI,OAAO,EAAE,CAAC;YACZ,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,8DAA8D,CAAC,C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I,CAAC,KAAK,CAAC,MAAM,CAAC,gCAAgC,YAAY,EAAE,CAAC,CAAC,CAAC;YAC7E,CAAC;QACH,CAAC;IACH,CAAC;IAED,wCAAwC;IACxC,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,kBAAkB,EAAE,CAAC;QAC1C,IAAI,MAAM,CAAC,UAAU,EAAE,CAAC;YACtB,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YAChB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC;QACjD,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACP,0CAA0C;IAC5C,CAAC;IAED,OAAO;QACL,MAAM;QACN,SAAS,EAAE,KAAK;QAChB,QAAQ,EAAE,cAAc;KACzB,CAAC;AACJ,CAAC"}
@@ -1,30 +0,0 @@
1
- /**
2
- * Validation Cache Utility
3
- *
4
- * Provides git tree hash-based caching for validation results.
5
- * Used by both validate and pre-commit commands to avoid redundant validation.
6
- */
7
- import type { ValidationResult } from '@vibe-validate/core';
8
- export interface CacheCheckResult {
9
- /** Whether a cached passing result was found */
10
- cacheHit: boolean;
11
- /** The git tree hash that was checked */
12
- treeHash: string | null;
13
- /** The cached validation result (if cache hit) */
14
- cachedResult?: ValidationResult;
15
- /** Metadata about the cached run */
16
- cachedRun?: {
17
- timestamp: string;
18
- duration: number;
19
- branch: string;
20
- };
21
- }
22
- /**
23
- * Check if validation has already passed for the current working tree.
24
- * Returns cache hit info including the cached result if found.
25
- *
26
- * @param force - If true, bypass cache and force re-validation
27
- * @returns Cache check result with tree hash and optional cached result
28
- */
29
- export declare function checkValidationCache(force?: boolean): Promise<CacheCheckResult>;
30
- //# sourceMappingURL=validation-cache.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"validation-cache.d.ts","sourceRoot":"","sources":["../../src/utils/validation-cache.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAE5D,MAAM,WAAW,gBAAgB;IAC/B,gDAAgD;IAChD,QAAQ,EAAE,OAAO,CAAC;IAElB,yCAAyC;IACzC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IAExB,kDAAkD;IAClD,YAAY,CAAC,EAAE,gBAAgB,CAAC;IAEhC,oCAAoC;IACpC,SAAS,CAAC,EAAE;QACV,SAAS,EAAE,MAAM,CAAC;QAClB,QAAQ,EAAE,MAAM,CAAC;QACjB,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;CACH;AAED;;;;;;GAMG;AACH,wBAAsB,oBAAoB,CAAC,KAAK,UAAQ,GAAG,OAAO,CAAC,gBAAgB,CAAC,CA2CnF"}
@@ -1,57 +0,0 @@
1
- /**
2
- * Validation Cache Utility
3
- *
4
- * Provides git tree hash-based caching for validation results.
5
- * Used by both validate and pre-commit commands to avoid redundant validation.
6
- */
7
- import { getGitTreeHash } from '@vibe-validate/git';
8
- import { readHistoryNote } from '@vibe-validate/history';
9
- /**
10
- * Check if validation has already passed for the current working tree.
11
- * Returns cache hit info including the cached result if found.
12
- *
13
- * @param force - If true, bypass cache and force re-validation
14
- * @returns Cache check result with tree hash and optional cached result
15
- */
16
- export async function checkValidationCache(force = false) {
17
- // Get tree hash for current working directory
18
- let treeHash = null;
19
- try {
20
- treeHash = await getGitTreeHash();
21
- }
22
- catch (_error) {
23
- // Not in git repo or git command failed
24
- return { cacheHit: false, treeHash: null };
25
- }
26
- // If force flag set, skip cache check
27
- if (force) {
28
- return { cacheHit: false, treeHash };
29
- }
30
- // Check git notes for cached validation result
31
- try {
32
- const historyNote = await readHistoryNote(treeHash);
33
- if (historyNote && historyNote.runs.length > 0) {
34
- // Find most recent passing run
35
- const passingRun = [...historyNote.runs]
36
- .reverse()
37
- .find(run => run.passed);
38
- if (passingRun && passingRun.result) {
39
- return {
40
- cacheHit: true,
41
- treeHash,
42
- cachedResult: passingRun.result,
43
- cachedRun: {
44
- timestamp: passingRun.timestamp,
45
- duration: passingRun.duration,
46
- branch: passingRun.branch,
47
- },
48
- };
49
- }
50
- }
51
- }
52
- catch (_error) {
53
- // Cache read failed - proceed without cache
54
- }
55
- return { cacheHit: false, treeHash };
56
- }
57
- //# sourceMappingURL=validation-cache.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"validation-cache.js","sourceRoot":"","sources":["../../src/utils/validation-cache.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAqBzD;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,KAAK,GAAG,KAAK;IACtD,8CAA8C;IAC9C,IAAI,QAAQ,GAAkB,IAAI,CAAC;IACnC,IAAI,CAAC;QACH,QAAQ,GAAG,MAAM,cAAc,EAAE,CAAC;IACpC,CAAC;IAAC,OAAO,MAAM,EAAE,CAAC;QAChB,wCAAwC;QACxC,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC7C,CAAC;IAED,sCAAsC;IACtC,IAAI,KAAK,EAAE,CAAC;QACV,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;IACvC,CAAC;IAED,+CAA+C;IAC/C,IAAI,CAAC;QACH,MAAM,WAAW,GAAG,MAAM,eAAe,CAAC,QAAQ,CAAC,CAAC;QAEpD,IAAI,WAAW,IAAI,WAAW,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC/C,+BAA+B;YAC/B,MAAM,UAAU,GAAG,CAAC,GAAG,WAAW,CAAC,IAAI,CAAC;iBACrC,OAAO,EAAE;iBACT,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;YAE3B,IAAI,UAAU,IAAI,UAA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