@vibe-validate/core 0.10.3 → 0.12.0

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/index.d.ts CHANGED
@@ -44,7 +44,9 @@
44
44
  *
45
45
  * @packageDocumentation
46
46
  */
47
- export type { ValidationStep, ValidationPhase, ValidationConfig, ValidationResult, StepResult, PhaseResult, } from './types.js';
48
- export { runValidation, runStepsInParallel, checkExistingValidation, parseFailures, setupSignalHandlers, } from './runner.js';
47
+ export type { ValidationStep, ValidationPhase, ValidationConfig, ValidationResult, StepResult, PhaseResult, ExtractionQuality, } from './types.js';
48
+ export { runValidation, runStepsInParallel, parseFailures, setupSignalHandlers, } from './runner.js';
49
49
  export { stopProcessGroup, } from './process-utils.js';
50
+ export { ValidationResultSchema, StepResultSchema, PhaseResultSchema, safeValidateResult, validateResult, } from './result-schema.js';
51
+ export { validationResultJsonSchema, generateValidationResultJsonSchema, } from './result-schema-export.js';
50
52
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AAGH,YAAY,EACV,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,UAAU,EACV,WAAW,GACZ,MAAM,YAAY,CAAC;AAGpB,OAAO,EACL,aAAa,EACb,kBAAkB,EAClB,uBAAuB,EACvB,aAAa,EACb,mBAAmB,GACpB,MAAM,aAAa,CAAC;AAGrB,OAAO,EACL,gBAAgB,GACjB,MAAM,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AAGH,YAAY,EACV,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,UAAU,EACV,WAAW,EACX,iBAAiB,GAClB,MAAM,YAAY,CAAC;AAGpB,OAAO,EACL,aAAa,EACb,kBAAkB,EAClB,aAAa,EACb,mBAAmB,GACpB,MAAM,aAAa,CAAC;AAGrB,OAAO,EACL,gBAAgB,GACjB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EACL,sBAAsB,EACtB,gBAAgB,EAChB,iBAAiB,EACjB,kBAAkB,EAClB,cAAc,GACf,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EACL,0BAA0B,EAC1B,kCAAkC,GACnC,MAAM,2BAA2B,CAAC"}
package/dist/index.js CHANGED
@@ -45,7 +45,11 @@
45
45
  * @packageDocumentation
46
46
  */
47
47
  // Export core runner functions
48
- export { runValidation, runStepsInParallel, checkExistingValidation, parseFailures, setupSignalHandlers, } from './runner.js';
48
+ export { runValidation, runStepsInParallel, parseFailures, setupSignalHandlers, } from './runner.js';
49
49
  // Export process utilities
50
50
  export { stopProcessGroup, } from './process-utils.js';
51
+ // Export validation result schema and validators
52
+ export { ValidationResultSchema, StepResultSchema, PhaseResultSchema, safeValidateResult, validateResult, } from './result-schema.js';
53
+ // Export JSON Schema generation
54
+ export { validationResultJsonSchema, generateValidationResultJsonSchema, } from './result-schema-export.js';
51
55
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AAYH,+BAA+B;AAC/B,OAAO,EACL,aAAa,EACb,kBAAkB,EAClB,uBAAuB,EACvB,aAAa,EACb,mBAAmB,GACpB,MAAM,aAAa,CAAC;AAErB,2BAA2B;AAC3B,OAAO,EACL,gBAAgB,GACjB,MAAM,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AAaH,+BAA+B;AAC/B,OAAO,EACL,aAAa,EACb,kBAAkB,EAClB,aAAa,EACb,mBAAmB,GACpB,MAAM,aAAa,CAAC;AAErB,2BAA2B;AAC3B,OAAO,EACL,gBAAgB,GACjB,MAAM,oBAAoB,CAAC;AAE5B,iDAAiD;AACjD,OAAO,EACL,sBAAsB,EACtB,gBAAgB,EAChB,iBAAiB,EACjB,kBAAkB,EAClB,cAAc,GACf,MAAM,oBAAoB,CAAC;AAE5B,gCAAgC;AAChC,OAAO,EACL,0BAA0B,EAC1B,kCAAkC,GACnC,MAAM,2BAA2B,CAAC"}
@@ -6,14 +6,17 @@
6
6
  */
7
7
  import { ChildProcess } from 'child_process';
8
8
  /**
9
- * Stop a child process and its entire process group
9
+ * Stop a child process and its entire process group (cross-platform)
10
10
  *
11
- * Uses negative PID to kill process group, ensuring all children are terminated.
11
+ * **Windows Implementation:**
12
+ * - Uses `taskkill /pid <PID> /T /F` to terminate process tree
13
+ * - /T flag kills child processes
14
+ * - /F flag forces termination
12
15
  *
13
- * **Implementation:**
14
- * - Graceful shutdown: SIGTERM to process group (-PID)
16
+ * **Unix Implementation:**
17
+ * - Uses negative PID to kill process group (-PID)
18
+ * - Graceful shutdown: SIGTERM to process group
15
19
  * - Force kill after 1s: SIGKILL to process group
16
- * - Ultimate timeout: Resolves after 2s regardless
17
20
  *
18
21
  * @param childProcess - The child process to stop
19
22
  * @param processName - Optional name for logging (e.g., "TypeScript", "ESLint")
@@ -21,7 +24,7 @@ import { ChildProcess } from 'child_process';
21
24
  *
22
25
  * @example
23
26
  * ```typescript
24
- * const proc = spawn('tsc', ['--noEmit']);
27
+ * const proc = spawn('tsc --noEmit', [], { shell: true });
25
28
  * await stopProcessGroup(proc, 'TypeScript');
26
29
  * ```
27
30
  */
@@ -1 +1 @@
1
- {"version":3,"file":"process-utils.d.ts","sourceRoot":"","sources":["../src/process-utils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7C;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,gBAAgB,CACpC,YAAY,EAAE,YAAY,EAC1B,WAAW,GAAE,MAAkB,GAC9B,OAAO,CAAC,IAAI,CAAC,CAmCf"}
1
+ {"version":3,"file":"process-utils.d.ts","sourceRoot":"","sources":["../src/process-utils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,YAAY,EAAY,MAAM,eAAe,CAAC;AAEvD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAsB,gBAAgB,CACpC,YAAY,EAAE,YAAY,EAC1B,WAAW,GAAE,MAAkB,GAC9B,OAAO,CAAC,IAAI,CAAC,CA+Cf"}
@@ -4,15 +4,19 @@
4
4
  * Provides reliable process group cleanup for spawned child processes.
5
5
  * Used by validation runner for signal handling and fail-fast behavior.
6
6
  */
7
+ import { execSync } from 'child_process';
7
8
  /**
8
- * Stop a child process and its entire process group
9
+ * Stop a child process and its entire process group (cross-platform)
9
10
  *
10
- * Uses negative PID to kill process group, ensuring all children are terminated.
11
+ * **Windows Implementation:**
12
+ * - Uses `taskkill /pid <PID> /T /F` to terminate process tree
13
+ * - /T flag kills child processes
14
+ * - /F flag forces termination
11
15
  *
12
- * **Implementation:**
13
- * - Graceful shutdown: SIGTERM to process group (-PID)
16
+ * **Unix Implementation:**
17
+ * - Uses negative PID to kill process group (-PID)
18
+ * - Graceful shutdown: SIGTERM to process group
14
19
  * - Force kill after 1s: SIGKILL to process group
15
- * - Ultimate timeout: Resolves after 2s regardless
16
20
  *
17
21
  * @param childProcess - The child process to stop
18
22
  * @param processName - Optional name for logging (e.g., "TypeScript", "ESLint")
@@ -20,7 +24,7 @@
20
24
  *
21
25
  * @example
22
26
  * ```typescript
23
- * const proc = spawn('tsc', ['--noEmit']);
27
+ * const proc = spawn('tsc --noEmit', [], { shell: true });
24
28
  * await stopProcessGroup(proc, 'TypeScript');
25
29
  * ```
26
30
  */
@@ -32,23 +36,37 @@ export async function stopProcessGroup(childProcess, processName = 'Process') {
32
36
  console.log(`🛑 ${processName} stopped`);
33
37
  resolve();
34
38
  });
35
- // Kill the entire process group by negating the PID
36
- // This kills the process and all its children
37
- try {
38
- process.kill(-pid, 'SIGTERM');
39
- }
40
- catch {
41
- // Process may already be dead, ignore error
39
+ // Platform-specific process termination
40
+ if (process.platform === 'win32') {
41
+ // Windows: Use taskkill to terminate process tree
42
+ // /T - Terminates all child processes
43
+ // /F - Forcefully terminates the process
44
+ try {
45
+ execSync(`taskkill /pid ${pid} /T /F`, { stdio: 'ignore' });
46
+ }
47
+ catch {
48
+ // Process may already be dead, ignore error
49
+ }
42
50
  }
43
- // Force kill entire process group after 1 second if not stopped
44
- setTimeout(() => {
51
+ else {
52
+ // Unix: Kill process group with negative PID
53
+ // This kills the process and all its children
45
54
  try {
46
- process.kill(-pid, 'SIGKILL');
55
+ process.kill(-pid, 'SIGTERM');
47
56
  }
48
57
  catch {
49
58
  // Process may already be dead, ignore error
50
59
  }
51
- }, 1000);
60
+ // Force kill entire process group after 1 second if not stopped
61
+ setTimeout(() => {
62
+ try {
63
+ process.kill(-pid, 'SIGKILL');
64
+ }
65
+ catch {
66
+ // Process may already be dead, ignore error
67
+ }
68
+ }, 1000);
69
+ }
52
70
  // Ultimate timeout - resolve after 2 seconds regardless
53
71
  setTimeout(() => {
54
72
  resolve();
@@ -1 +1 @@
1
- {"version":3,"file":"process-utils.js","sourceRoot":"","sources":["../src/process-utils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,YAA0B,EAC1B,cAAsB,SAAS;IAE/B,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,IAAI,CAAC,YAAY,CAAC,MAAM,IAAI,YAAY,CAAC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AY,CAAC,GAAG,CAAC;YAE7B,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE;gBAC3B,OAAO,CAAC,GAAG,CAAC,MAAM,WAAW,UAAU,CAAC,CAAC;gBACzC,OAAO,EAAE,CAAC;YACZ,CAAC,CAAC,CAAC;YAEH,wCAAwC;YACxC,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,EAAE,CAAC;gBACjC,kDAAkD;gBAClD,sCAAsC;gBACtC,yCAAyC;gBACzC,IAAI,CAAC;oBACH,QAAQ,CAAC,iBAAiB,GAAG,QAAQ,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC;gBAC9D,CAAC;gBAAC,MAAM,CAAC;oBACP,4CAA4C;gBAC9C,CAAC;YACH,CAAC;iBAAM,CAAC;gBACN,6CAA6C;gBAC7C,8CAA8C;gBAC9C,IAAI,CAAC;oBACH,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;gBAChC,CAAC;gBAAC,MAAM,CAAC;oBACP,4CAA4C;gBAC9C,CAAC;gBAED,gEAAgE;gBAChE,UAAU,CAAC,GAAG,EAAE;oBACd,IAAI,CAAC;wBACH,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;oBAChC,CAAC;oBAAC,MAAM,CAAC;wBACP,4CAA4C;oBAC9C,CAAC;gBACH,CAAC,EAAE,IAAI,CAAC,CAAC;YACX,CAAC;YAED,wDAAwD;YACxD,UAAU,CAAC,GAAG,EAAE;gBACd,OAAO,EAAE,CAAC;YACZ,CAAC,EAAE,IAAI,CAAC,CAAC;QACX,CAAC;aAAM,CAAC;YACN,OAAO,EAAE,CAAC;QACZ,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * JSON Schema Export for Validation Result
3
+ *
4
+ * Generates JSON Schema from Zod validation result schema to enable
5
+ * validation of examples in documentation and agent integration guides.
6
+ */
7
+ /**
8
+ * Generate JSON Schema from Zod validation result schema
9
+ *
10
+ * This schema can be used to validate examples in documentation:
11
+ * ```yaml
12
+ * # Example validation result
13
+ * passed: false
14
+ * timestamp: "2025-10-20T12:00:00.000Z"
15
+ * treeHash: "abc123..."
16
+ * failedStep: "TypeScript"
17
+ * ```
18
+ *
19
+ * @returns JSON Schema object
20
+ */
21
+ export declare function generateValidationResultJsonSchema(): object;
22
+ /**
23
+ * Pre-generated JSON Schema (exported for bundling in npm package)
24
+ */
25
+ export declare const validationResultJsonSchema: object;
26
+ //# sourceMappingURL=result-schema-export.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"result-schema-export.d.ts","sourceRoot":"","sources":["../src/result-schema-export.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH;;;;;;;;;;;;;GAaG;AACH,wBAAgB,kCAAkC,IAAI,MAAM,CAM3D;AAED;;GAEG;AACH,eAAO,MAAM,0BAA0B,QAAuC,CAAC"}
@@ -0,0 +1,34 @@
1
+ /**
2
+ * JSON Schema Export for Validation Result
3
+ *
4
+ * Generates JSON Schema from Zod validation result schema to enable
5
+ * validation of examples in documentation and agent integration guides.
6
+ */
7
+ import { zodToJsonSchema } from 'zod-to-json-schema';
8
+ import { ValidationResultSchema } from './result-schema.js';
9
+ /**
10
+ * Generate JSON Schema from Zod validation result schema
11
+ *
12
+ * This schema can be used to validate examples in documentation:
13
+ * ```yaml
14
+ * # Example validation result
15
+ * passed: false
16
+ * timestamp: "2025-10-20T12:00:00.000Z"
17
+ * treeHash: "abc123..."
18
+ * failedStep: "TypeScript"
19
+ * ```
20
+ *
21
+ * @returns JSON Schema object
22
+ */
23
+ export function generateValidationResultJsonSchema() {
24
+ return zodToJsonSchema(ValidationResultSchema, {
25
+ name: 'ValidationResult',
26
+ $refStrategy: 'none', // Inline all references for simplicity
27
+ target: 'jsonSchema7',
28
+ });
29
+ }
30
+ /**
31
+ * Pre-generated JSON Schema (exported for bundling in npm package)
32
+ */
33
+ export const validationResultJsonSchema = generateValidationResultJsonSchema();
34
+ //# sourceMappingURL=result-schema-export.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"result-schema-export.js","sourceRoot":"","sources":["../src/result-schema-export.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAE5D;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,kCAAkC;IAChD,OAAO,eAAe,CAAC,sBAAsB,EAAE;QAC7C,IAAI,EAAE,kBAAkB;QACxB,YAAY,EAAE,MAAM,EAAE,uCAAuC;QAC7D,MAAM,EAAE,aAAa;KACtB,CAAC,CAAC;AACL,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,kCAAkC,EAAE,CAAC"}
@@ -0,0 +1,242 @@
1
+ /**
2
+ * Zod Schema for Validation Results
3
+ *
4
+ * This schema defines the structure of validation state files and enables
5
+ * runtime validation and JSON Schema generation for documentation.
6
+ */
7
+ import { z } from 'zod';
8
+ /**
9
+ * Validation Step Result Schema
10
+ */
11
+ export declare const StepResultSchema: z.ZodObject<{
12
+ /** Step name */
13
+ name: z.ZodString;
14
+ /** Did the step pass? */
15
+ passed: z.ZodBoolean;
16
+ /** Execution duration in seconds */
17
+ durationSecs: z.ZodNumber;
18
+ /** Output from the step (stdout + stderr) */
19
+ output: z.ZodOptional<z.ZodString>;
20
+ }, "strip", z.ZodTypeAny, {
21
+ durationSecs: number;
22
+ name: string;
23
+ passed: boolean;
24
+ output?: string | undefined;
25
+ }, {
26
+ durationSecs: number;
27
+ name: string;
28
+ passed: boolean;
29
+ output?: string | undefined;
30
+ }>;
31
+ /**
32
+ * Validation Phase Result Schema
33
+ */
34
+ export declare const PhaseResultSchema: z.ZodObject<{
35
+ /** Phase name */
36
+ name: z.ZodString;
37
+ /** Phase execution duration in seconds */
38
+ durationSecs: z.ZodNumber;
39
+ /** Did the phase pass? */
40
+ passed: z.ZodBoolean;
41
+ /** Results from individual steps */
42
+ steps: z.ZodArray<z.ZodObject<{
43
+ /** Step name */
44
+ name: z.ZodString;
45
+ /** Did the step pass? */
46
+ passed: z.ZodBoolean;
47
+ /** Execution duration in seconds */
48
+ durationSecs: z.ZodNumber;
49
+ /** Output from the step (stdout + stderr) */
50
+ output: z.ZodOptional<z.ZodString>;
51
+ }, "strip", z.ZodTypeAny, {
52
+ durationSecs: number;
53
+ name: string;
54
+ passed: boolean;
55
+ output?: string | undefined;
56
+ }, {
57
+ durationSecs: number;
58
+ name: string;
59
+ passed: boolean;
60
+ output?: string | undefined;
61
+ }>, "many">;
62
+ /** Output from failed step (if any) */
63
+ output: z.ZodOptional<z.ZodString>;
64
+ }, "strip", z.ZodTypeAny, {
65
+ durationSecs: number;
66
+ name: string;
67
+ passed: boolean;
68
+ steps: {
69
+ durationSecs: number;
70
+ name: string;
71
+ passed: boolean;
72
+ output?: string | undefined;
73
+ }[];
74
+ output?: string | undefined;
75
+ }, {
76
+ durationSecs: number;
77
+ name: string;
78
+ passed: boolean;
79
+ steps: {
80
+ durationSecs: number;
81
+ name: string;
82
+ passed: boolean;
83
+ output?: string | undefined;
84
+ }[];
85
+ output?: string | undefined;
86
+ }>;
87
+ /**
88
+ * Validation Result Schema
89
+ *
90
+ * This schema defines the validation result structure returned by the validation
91
+ * runner and stored in git notes (v0.12.0+) for history tracking.
92
+ */
93
+ export declare const ValidationResultSchema: z.ZodObject<{
94
+ /** Did validation pass? */
95
+ passed: z.ZodBoolean;
96
+ /** ISO 8601 timestamp */
97
+ timestamp: z.ZodString;
98
+ /** Git tree hash (if in git repo) */
99
+ treeHash: z.ZodString;
100
+ /** Results from each phase */
101
+ phases: z.ZodOptional<z.ZodArray<z.ZodObject<{
102
+ /** Phase name */
103
+ name: z.ZodString;
104
+ /** Phase execution duration in seconds */
105
+ durationSecs: z.ZodNumber;
106
+ /** Did the phase pass? */
107
+ passed: z.ZodBoolean;
108
+ /** Results from individual steps */
109
+ steps: z.ZodArray<z.ZodObject<{
110
+ /** Step name */
111
+ name: z.ZodString;
112
+ /** Did the step pass? */
113
+ passed: z.ZodBoolean;
114
+ /** Execution duration in seconds */
115
+ durationSecs: z.ZodNumber;
116
+ /** Output from the step (stdout + stderr) */
117
+ output: z.ZodOptional<z.ZodString>;
118
+ }, "strip", z.ZodTypeAny, {
119
+ durationSecs: number;
120
+ name: string;
121
+ passed: boolean;
122
+ output?: string | undefined;
123
+ }, {
124
+ durationSecs: number;
125
+ name: string;
126
+ passed: boolean;
127
+ output?: string | undefined;
128
+ }>, "many">;
129
+ /** Output from failed step (if any) */
130
+ output: z.ZodOptional<z.ZodString>;
131
+ }, "strip", z.ZodTypeAny, {
132
+ durationSecs: number;
133
+ name: string;
134
+ passed: boolean;
135
+ steps: {
136
+ durationSecs: number;
137
+ name: string;
138
+ passed: boolean;
139
+ output?: string | undefined;
140
+ }[];
141
+ output?: string | undefined;
142
+ }, {
143
+ durationSecs: number;
144
+ name: string;
145
+ passed: boolean;
146
+ steps: {
147
+ durationSecs: number;
148
+ name: string;
149
+ passed: boolean;
150
+ output?: string | undefined;
151
+ }[];
152
+ output?: string | undefined;
153
+ }>, "many">>;
154
+ /** Name of failed step (if any) */
155
+ failedStep: z.ZodOptional<z.ZodString>;
156
+ /** Command to re-run failed step */
157
+ rerunCommand: z.ZodOptional<z.ZodString>;
158
+ /** Output from the failed step */
159
+ failedStepOutput: z.ZodOptional<z.ZodString>;
160
+ /** Failed test names (if applicable) */
161
+ failedTests: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
162
+ /** Path to full log file */
163
+ fullLogFile: z.ZodOptional<z.ZodString>;
164
+ /** Summary message */
165
+ summary: z.ZodOptional<z.ZodString>;
166
+ }, "strip", z.ZodTypeAny, {
167
+ passed: boolean;
168
+ timestamp: string;
169
+ treeHash: string;
170
+ failedStep?: string | undefined;
171
+ phases?: {
172
+ durationSecs: number;
173
+ name: string;
174
+ passed: boolean;
175
+ steps: {
176
+ durationSecs: number;
177
+ name: string;
178
+ passed: boolean;
179
+ output?: string | undefined;
180
+ }[];
181
+ output?: string | undefined;
182
+ }[] | undefined;
183
+ rerunCommand?: string | undefined;
184
+ failedStepOutput?: string | undefined;
185
+ failedTests?: string[] | undefined;
186
+ fullLogFile?: string | undefined;
187
+ summary?: string | undefined;
188
+ }, {
189
+ passed: boolean;
190
+ timestamp: string;
191
+ treeHash: string;
192
+ failedStep?: string | undefined;
193
+ phases?: {
194
+ durationSecs: number;
195
+ name: string;
196
+ passed: boolean;
197
+ steps: {
198
+ durationSecs: number;
199
+ name: string;
200
+ passed: boolean;
201
+ output?: string | undefined;
202
+ }[];
203
+ output?: string | undefined;
204
+ }[] | undefined;
205
+ rerunCommand?: string | undefined;
206
+ failedStepOutput?: string | undefined;
207
+ failedTests?: string[] | undefined;
208
+ fullLogFile?: string | undefined;
209
+ summary?: string | undefined;
210
+ }>;
211
+ /**
212
+ * Inferred TypeScript types from Zod schemas
213
+ */
214
+ export type StepResult = z.infer<typeof StepResultSchema>;
215
+ export type PhaseResult = z.infer<typeof PhaseResultSchema>;
216
+ export type ValidationResult = z.infer<typeof ValidationResultSchema>;
217
+ /**
218
+ * Safe validation function
219
+ *
220
+ * Validates a validation result object against the schema.
221
+ *
222
+ * @param data - Data to validate
223
+ * @returns Validation result with success/error information
224
+ */
225
+ export declare function safeValidateResult(data: unknown): {
226
+ success: true;
227
+ data: ValidationResult;
228
+ } | {
229
+ success: false;
230
+ errors: string[];
231
+ };
232
+ /**
233
+ * Strict validation function
234
+ *
235
+ * Validates and throws on error.
236
+ *
237
+ * @param data - Data to validate
238
+ * @returns Validated result
239
+ * @throws {Error} If validation fails
240
+ */
241
+ export declare function validateResult(data: unknown): ValidationResult;
242
+ //# sourceMappingURL=result-schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"result-schema.d.ts","sourceRoot":"","sources":["../src/result-schema.ts"],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C,IAAI,EAAE,OAAO,GAC5C;IAAE,OAAO,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,gBAAgB,CAAA;CAAE,GACzC;IAAE,OAAO,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAE,CAcvC;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,OAAO,GAAG,gBAAgB,CAE9D"}
@@ -0,0 +1,96 @@
1
+ /**
2
+ * Zod Schema for Validation Results
3
+ *
4
+ * This schema defines the structure of validation state files and enables
5
+ * runtime validation and JSON Schema generation for documentation.
6
+ */
7
+ import { z } from 'zod';
8
+ /**
9
+ * Validation Step Result Schema
10
+ */
11
+ export const StepResultSchema = z.object({
12
+ /** Step name */
13
+ name: z.string(),
14
+ /** Did the step pass? */
15
+ passed: z.boolean(),
16
+ /** Execution duration in seconds */
17
+ durationSecs: z.coerce.number(),
18
+ /** Output from the step (stdout + stderr) */
19
+ output: z.string().optional(),
20
+ });
21
+ /**
22
+ * Validation Phase Result Schema
23
+ */
24
+ export const PhaseResultSchema = z.object({
25
+ /** Phase name */
26
+ name: z.string(),
27
+ /** Phase execution duration in seconds */
28
+ durationSecs: z.coerce.number(),
29
+ /** Did the phase pass? */
30
+ passed: z.boolean(),
31
+ /** Results from individual steps */
32
+ steps: z.array(StepResultSchema),
33
+ /** Output from failed step (if any) */
34
+ output: z.string().optional(),
35
+ });
36
+ /**
37
+ * Validation Result Schema
38
+ *
39
+ * This schema defines the validation result structure returned by the validation
40
+ * runner and stored in git notes (v0.12.0+) for history tracking.
41
+ */
42
+ export const ValidationResultSchema = z.object({
43
+ /** Did validation pass? */
44
+ passed: z.boolean(),
45
+ /** ISO 8601 timestamp */
46
+ timestamp: z.string(),
47
+ /** Git tree hash (if in git repo) */
48
+ treeHash: z.string(),
49
+ /** Results from each phase */
50
+ phases: z.array(PhaseResultSchema).optional(),
51
+ /** Name of failed step (if any) */
52
+ failedStep: z.string().optional(),
53
+ /** Command to re-run failed step */
54
+ rerunCommand: z.string().optional(),
55
+ /** Output from the failed step */
56
+ failedStepOutput: z.string().optional(),
57
+ /** Failed test names (if applicable) */
58
+ failedTests: z.array(z.string()).optional(),
59
+ /** Path to full log file */
60
+ fullLogFile: z.string().optional(),
61
+ /** Summary message */
62
+ summary: z.string().optional(),
63
+ });
64
+ /**
65
+ * Safe validation function
66
+ *
67
+ * Validates a validation result object against the schema.
68
+ *
69
+ * @param data - Data to validate
70
+ * @returns Validation result with success/error information
71
+ */
72
+ export function safeValidateResult(data) {
73
+ const result = ValidationResultSchema.safeParse(data);
74
+ if (result.success) {
75
+ return { success: true, data: result.data };
76
+ }
77
+ // Extract error messages
78
+ const errors = result.error.errors.map(err => {
79
+ const path = err.path.join('.');
80
+ return path ? `${path}: ${err.message}` : err.message;
81
+ });
82
+ return { success: false, errors };
83
+ }
84
+ /**
85
+ * Strict validation function
86
+ *
87
+ * Validates and throws on error.
88
+ *
89
+ * @param data - Data to validate
90
+ * @returns Validated result
91
+ * @throws {Error} If validation fails
92
+ */
93
+ export function validateResult(data) {
94
+ return ValidationResultSchema.parse(data);
95
+ }
96
+ //# sourceMappingURL=result-schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"result-schema.js","sourceRoot":"","sources":["../src/result-schema.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IACvC,gBAAgB;IAChB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAEhB,yBAAyB;IACzB,MAAM,EAAE,CAAC,CAAC,OAAO,EAAE;IAEnB,oCAAoC;IACpC,YAAY,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,EAAE;IAE/B,6CAA6C;IAC7C,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC9B,C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AAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC/B,CAAC,CAAC;AASH;;;;;;;GAOG;AACH,MAAM,UAAU,kBAAkB,CAAC,IAAa;IAG9C,MAAM,MAAM,GAAG,sBAAsB,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IAEtD,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;QACnB,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC;IAC9C,CAAC;IAED,yBAAyB;IACzB,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE;QAC3C,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAChC,OAAO,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,KAAK,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC;IACxD,CAAC,CAAC,CAAC;IAEH,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;AACpC,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,cAAc,CAAC,IAAa;IAC1C,OAAO,sBAAsB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;AAC5C,CAAC"}
package/dist/runner.d.ts CHANGED
@@ -11,51 +11,14 @@
11
11
  */
12
12
  import { type ChildProcess } from 'child_process';
13
13
  import type { ValidationStep, ValidationResult, ValidationConfig, StepResult } from './types.js';
14
- /**
15
- * Legacy function - REMOVED in favor of @vibe-validate/git package
16
- *
17
- * Use `getGitTreeHash()` from '@vibe-validate/git' instead.
18
- * This provides deterministic, content-based tree hashing.
19
- *
20
- * @deprecated Removed in v0.9.11 - Use @vibe-validate/git instead
21
- */
22
- /**
23
- * Check if validation has already passed for current working tree state
24
- *
25
- * Reads the validation state file and compares the git tree hash to determine
26
- * if validation can be skipped (cache hit).
27
- *
28
- * @param currentTreeHash - Current git tree hash of working directory
29
- * @param stateFilePath - Path to validation state file
30
- * @returns Object with alreadyPassed flag and optional previousState
31
- *
32
- * @example
33
- * ```typescript
34
- * const { alreadyPassed, previousState } = checkExistingValidation(
35
- * 'abc123...',
36
- * '.validate-state.json'
37
- * );
38
- *
39
- * if (alreadyPassed) {
40
- * console.log('Validation already passed!');
41
- * return previousState;
42
- * }
43
- * ```
44
- *
45
- * @public
46
- */
47
- export declare function checkExistingValidation(currentTreeHash: string, stateFilePath: string): {
48
- alreadyPassed: boolean;
49
- previousState?: ValidationResult;
50
- };
51
14
  /**
52
15
  * Parse test output to extract specific failures
53
16
  *
54
17
  * Extracts failure details from validation step output using pattern matching.
55
18
  * Supports Vitest, TypeScript, and ESLint error formats.
56
19
  *
57
- * Note: This is a basic implementation - the formatters package provides
58
- * more sophisticated parsing with tool-specific formatters.
20
+ * Note: This is a basic implementation - the extractors package provides
21
+ * more sophisticated parsing with tool-specific extractors.
59
22
  *
60
23
  * @param output - Raw stdout/stderr output from validation step
61
24
  * @returns Array of extracted failure messages (max 10 per failure type)
@@ -72,6 +35,7 @@ export declare function checkExistingValidation(currentTreeHash: string, stateFi
72
35
  * ```
73
36
  *
74
37
  * @public
38
+ * @deprecated Use extractByStepName() from @vibe-validate/extractors instead
75
39
  */
76
40
  export declare function parseFailures(output: string): string[];
77
41
  /**
@@ -106,7 +70,7 @@ export declare function parseFailures(output: string): string[];
106
70
  *
107
71
  * @public
108
72
  */
109
- export declare function runStepsInParallel(steps: ValidationStep[], phaseName: string, enableFailFast?: boolean, env?: Record<string, string>, verbose?: boolean): Promise<{
73
+ export declare function runStepsInParallel(steps: ValidationStep[], phaseName: string, enableFailFast?: boolean, env?: Record<string, string>, verbose?: boolean, yaml?: boolean, developerFeedback?: boolean): Promise<{
110
74
  success: boolean;
111
75
  failedStep?: ValidationStep;
112
76
  outputs: Map<string, string>;
@@ -142,9 +106,7 @@ export declare function runStepsInParallel(steps: ValidationStep[], phaseName: s
142
106
  * ],
143
107
  * },
144
108
  * ],
145
- * stateFilePath: '.vibe-validate-state.yaml',
146
109
  * enableFailFast: false,
147
- * forceRun: false,
148
110
  * });
149
111
  *
150
112
  * if (result.passed) {