@vibe-validate/core 0.14.2 → 0.15.0-rc.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.
- package/README.md +24 -0
- package/dist/index.d.ts +9 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -2
- package/dist/index.js.map +1 -1
- package/dist/output-capture-schema.d.ts +144 -0
- package/dist/output-capture-schema.d.ts.map +1 -0
- package/dist/output-capture-schema.js +52 -0
- package/dist/output-capture-schema.js.map +1 -0
- package/dist/process-utils.d.ts +85 -1
- package/dist/process-utils.d.ts.map +1 -1
- package/dist/process-utils.js +176 -1
- package/dist/process-utils.js.map +1 -1
- package/dist/result-schema.d.ts +1352 -88
- package/dist/result-schema.d.ts.map +1 -1
- package/dist/result-schema.js +114 -57
- package/dist/result-schema.js.map +1 -1
- package/dist/run-output-parser.d.ts +47 -0
- package/dist/run-output-parser.d.ts.map +1 -0
- package/dist/run-output-parser.js +109 -0
- package/dist/run-output-parser.js.map +1 -0
- package/dist/runner.d.ts +36 -3
- package/dist/runner.d.ts.map +1 -1
- package/dist/runner.js +199 -172
- package/dist/runner.js.map +1 -1
- package/dist/schema-utils.d.ts +57 -0
- package/dist/schema-utils.d.ts.map +1 -0
- package/dist/schema-utils.js +67 -0
- package/dist/schema-utils.js.map +1 -0
- package/dist/scripts/generate-result-schema.d.ts +1 -1
- package/dist/scripts/generate-result-schema.js +3 -3
- package/dist/scripts/generate-result-schema.js.map +1 -1
- package/dist/types.js +5 -1
- package/dist/types.js.map +1 -1
- package/package.json +6 -5
- package/validate-result.schema.json +245 -0
- package/dist/types.d.ts +0 -138
- package/dist/types.d.ts.map +0 -1
- package/validation-result.schema.json +0 -100
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zod Schema Utilities
|
|
3
|
+
*
|
|
4
|
+
* Shared validation helpers for consistent error handling across packages.
|
|
5
|
+
*
|
|
6
|
+
* @packageDocumentation
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Create a type-safe validator function from a Zod schema
|
|
10
|
+
*
|
|
11
|
+
* Provides consistent error formatting across all schema validations.
|
|
12
|
+
* Error messages include full path (e.g., "phases.0.steps.2.command: Required")
|
|
13
|
+
*
|
|
14
|
+
* @param schema - Zod schema to validate against
|
|
15
|
+
* @returns Safe validation function with success/error union type
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* const safeValidateResult = createSafeValidator(ValidationResultSchema);
|
|
20
|
+
*
|
|
21
|
+
* const result = safeValidateResult(data);
|
|
22
|
+
* if (result.success) {
|
|
23
|
+
* console.log(result.data); // Typed as ValidationResult
|
|
24
|
+
* } else {
|
|
25
|
+
* console.error(result.errors); // Array of formatted error messages
|
|
26
|
+
* }
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export function createSafeValidator(schema) {
|
|
30
|
+
return function safeValidate(data) {
|
|
31
|
+
const result = schema.safeParse(data);
|
|
32
|
+
if (result.success) {
|
|
33
|
+
return { success: true, data: result.data };
|
|
34
|
+
}
|
|
35
|
+
// Extract error messages with full path
|
|
36
|
+
const errors = result.error.errors.map(err => {
|
|
37
|
+
const path = err.path.join('.');
|
|
38
|
+
return path ? `${path}: ${err.message}` : err.message;
|
|
39
|
+
});
|
|
40
|
+
return { success: false, errors };
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Create a strict validator function from a Zod schema
|
|
45
|
+
*
|
|
46
|
+
* Throws on validation failure (useful when invalid data is a critical error).
|
|
47
|
+
*
|
|
48
|
+
* @param schema - Zod schema to validate against
|
|
49
|
+
* @returns Strict validation function that throws on error
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```typescript
|
|
53
|
+
* const validateResult = createStrictValidator(ValidationResultSchema);
|
|
54
|
+
*
|
|
55
|
+
* try {
|
|
56
|
+
* const result = validateResult(data); // Typed as ValidationResult
|
|
57
|
+
* } catch (error) {
|
|
58
|
+
* console.error('Invalid data:', error);
|
|
59
|
+
* }
|
|
60
|
+
* ```
|
|
61
|
+
*/
|
|
62
|
+
export function createStrictValidator(schema) {
|
|
63
|
+
return function validate(data) {
|
|
64
|
+
return schema.parse(data);
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=schema-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-utils.js","sourceRoot":"","sources":["../src/schema-utils.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,mBAAmB,CAAsB,MAAS;IAChE,OAAO,SAAS,YAAY,CAAC,IAAa;QAGxC,MAAM,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QAEtC,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;YACnB,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC;QAC9C,CAAC;QAED,wCAAwC;QACxC,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE;YAC3C,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YAChC,OAAO,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,KAAK,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC;QACxD,CAAC,CAAC,CAAC;QAEH,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;IACpC,CAAC,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,qBAAqB,CAAsB,MAAS;IAClE,OAAO,SAAS,QAAQ,CAAC,IAAa;QACpC,OAAO,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC5B,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Generate JSON Schema File for Validation Results
|
|
4
4
|
*
|
|
5
|
-
* Creates
|
|
5
|
+
* Creates validate-result.schema.json in the package root for use in
|
|
6
6
|
* validating documentation examples and agent integration code.
|
|
7
7
|
* This script runs during the build process.
|
|
8
8
|
*/
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Generate JSON Schema File for Validation Results
|
|
4
4
|
*
|
|
5
|
-
* Creates
|
|
5
|
+
* Creates validate-result.schema.json in the package root for use in
|
|
6
6
|
* validating documentation examples and agent integration code.
|
|
7
7
|
* This script runs during the build process.
|
|
8
8
|
*/
|
|
@@ -13,8 +13,8 @@ import { validationResultJsonSchema } from '../result-schema-export.js';
|
|
|
13
13
|
const __filename = fileURLToPath(import.meta.url);
|
|
14
14
|
const __dirname = dirname(__filename);
|
|
15
15
|
const packageRoot = join(__dirname, '..', '..');
|
|
16
|
-
const schemaPath = join(packageRoot, '
|
|
16
|
+
const schemaPath = join(packageRoot, 'validate-result.schema.json');
|
|
17
17
|
// Generate and write schema file
|
|
18
18
|
writeFileSync(schemaPath, JSON.stringify(validationResultJsonSchema, null, 2), 'utf-8');
|
|
19
|
-
console.log('✓ Generated
|
|
19
|
+
console.log('✓ Generated validate-result.schema.json');
|
|
20
20
|
//# sourceMappingURL=generate-result-schema.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-result-schema.js","sourceRoot":"","sources":["../../src/scripts/generate-result-schema.ts"],"names":[],"mappings":";AACA;;;;;;GAMG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAC;AAExE,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AACtC,MAAM,WAAW,GAAG,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AAChD,MAAM,UAAU,GAAG,IAAI,CAAC,WAAW,EAAE
|
|
1
|
+
{"version":3,"file":"generate-result-schema.js","sourceRoot":"","sources":["../../src/scripts/generate-result-schema.ts"],"names":[],"mappings":";AACA;;;;;;GAMG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAC;AAExE,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AACtC,MAAM,WAAW,GAAG,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AAChD,MAAM,UAAU,GAAG,IAAI,CAAC,WAAW,EAAE,6BAA6B,CAAC,CAAC;AAEpE,iCAAiC;AACjC,aAAa,CACX,UAAU,EACV,IAAI,CAAC,SAAS,CAAC,0BAA0B,EAAE,IAAI,EAAE,CAAC,CAAC,EACnD,OAAO,CACR,CAAC;AAEF,OAAO,CAAC,GAAG,CAAC,yCAAyC,CAAC,CAAC"}
|
package/dist/types.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Core validation types for vibe-validate
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* Re-exports types from schema packages (single source of truth):
|
|
5
|
+
* - Input config types (ValidationStep, ValidationPhase) from @vibe-validate/config
|
|
6
|
+
* - Output result types (StepResult, PhaseResult, ValidationResult) from ./result-schema
|
|
7
|
+
*
|
|
8
|
+
* Defines runtime-only types (ValidationConfig with callbacks, ExtractionQuality)
|
|
5
9
|
*/
|
|
6
10
|
export {};
|
|
7
11
|
//# sourceMappingURL=types.js.map
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vibe-validate/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.0-rc.1",
|
|
4
4
|
"description": "Core validation orchestration engine for vibe-validate",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
},
|
|
14
14
|
"files": [
|
|
15
15
|
"dist",
|
|
16
|
-
"
|
|
16
|
+
"validate-result.schema.json"
|
|
17
17
|
],
|
|
18
18
|
"keywords": [
|
|
19
19
|
"validation",
|
|
@@ -40,8 +40,9 @@
|
|
|
40
40
|
"yaml": "^2.6.1",
|
|
41
41
|
"zod": "^3.24.1",
|
|
42
42
|
"zod-to-json-schema": "^3.24.6",
|
|
43
|
-
"@vibe-validate/
|
|
44
|
-
"@vibe-validate/
|
|
43
|
+
"@vibe-validate/config": "0.15.0-rc.1",
|
|
44
|
+
"@vibe-validate/extractors": "0.15.0-rc.1",
|
|
45
|
+
"@vibe-validate/git": "0.15.0-rc.1"
|
|
45
46
|
},
|
|
46
47
|
"devDependencies": {
|
|
47
48
|
"@types/node": "^20.17.6",
|
|
@@ -53,6 +54,6 @@
|
|
|
53
54
|
"dev": "tsc --watch",
|
|
54
55
|
"test": "vitest run",
|
|
55
56
|
"test:watch": "vitest",
|
|
56
|
-
"clean": "rm -rf dist *.tsbuildinfo
|
|
57
|
+
"clean": "rm -rf dist *.tsbuildinfo validate-result.schema.json"
|
|
57
58
|
}
|
|
58
59
|
}
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$ref": "#/definitions/ValidationResult",
|
|
3
|
+
"definitions": {
|
|
4
|
+
"ValidationResult": {
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"timestamp": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"format": "date-time"
|
|
10
|
+
},
|
|
11
|
+
"treeHash": {
|
|
12
|
+
"type": "string",
|
|
13
|
+
"minLength": 1
|
|
14
|
+
},
|
|
15
|
+
"passed": {
|
|
16
|
+
"type": "boolean"
|
|
17
|
+
},
|
|
18
|
+
"summary": {
|
|
19
|
+
"type": "string"
|
|
20
|
+
},
|
|
21
|
+
"isCachedResult": {
|
|
22
|
+
"type": "boolean"
|
|
23
|
+
},
|
|
24
|
+
"failedStep": {
|
|
25
|
+
"type": "string"
|
|
26
|
+
},
|
|
27
|
+
"phases": {
|
|
28
|
+
"type": "array",
|
|
29
|
+
"items": {
|
|
30
|
+
"type": "object",
|
|
31
|
+
"properties": {
|
|
32
|
+
"name": {
|
|
33
|
+
"type": "string"
|
|
34
|
+
},
|
|
35
|
+
"passed": {
|
|
36
|
+
"type": "boolean"
|
|
37
|
+
},
|
|
38
|
+
"durationSecs": {
|
|
39
|
+
"type": "number"
|
|
40
|
+
},
|
|
41
|
+
"steps": {
|
|
42
|
+
"type": "array",
|
|
43
|
+
"items": {
|
|
44
|
+
"type": "object",
|
|
45
|
+
"properties": {
|
|
46
|
+
"command": {
|
|
47
|
+
"type": "string",
|
|
48
|
+
"minLength": 1
|
|
49
|
+
},
|
|
50
|
+
"exitCode": {
|
|
51
|
+
"type": "integer"
|
|
52
|
+
},
|
|
53
|
+
"durationSecs": {
|
|
54
|
+
"type": "number"
|
|
55
|
+
},
|
|
56
|
+
"extraction": {
|
|
57
|
+
"type": "object",
|
|
58
|
+
"properties": {
|
|
59
|
+
"summary": {
|
|
60
|
+
"type": "string"
|
|
61
|
+
},
|
|
62
|
+
"totalErrors": {
|
|
63
|
+
"type": "integer",
|
|
64
|
+
"minimum": 0
|
|
65
|
+
},
|
|
66
|
+
"errors": {
|
|
67
|
+
"type": "array",
|
|
68
|
+
"items": {
|
|
69
|
+
"type": "object",
|
|
70
|
+
"properties": {
|
|
71
|
+
"file": {
|
|
72
|
+
"type": "string"
|
|
73
|
+
},
|
|
74
|
+
"line": {
|
|
75
|
+
"type": "integer",
|
|
76
|
+
"exclusiveMinimum": 0
|
|
77
|
+
},
|
|
78
|
+
"column": {
|
|
79
|
+
"type": "integer",
|
|
80
|
+
"exclusiveMinimum": 0
|
|
81
|
+
},
|
|
82
|
+
"message": {
|
|
83
|
+
"type": "string"
|
|
84
|
+
},
|
|
85
|
+
"code": {
|
|
86
|
+
"type": "string"
|
|
87
|
+
},
|
|
88
|
+
"severity": {
|
|
89
|
+
"type": "string",
|
|
90
|
+
"enum": [
|
|
91
|
+
"error",
|
|
92
|
+
"warning"
|
|
93
|
+
]
|
|
94
|
+
},
|
|
95
|
+
"context": {
|
|
96
|
+
"type": "string"
|
|
97
|
+
},
|
|
98
|
+
"guidance": {
|
|
99
|
+
"type": "string"
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
"required": [
|
|
103
|
+
"message"
|
|
104
|
+
],
|
|
105
|
+
"additionalProperties": false
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
"guidance": {
|
|
109
|
+
"type": "string"
|
|
110
|
+
},
|
|
111
|
+
"errorSummary": {
|
|
112
|
+
"type": "string"
|
|
113
|
+
},
|
|
114
|
+
"metadata": {
|
|
115
|
+
"type": "object",
|
|
116
|
+
"properties": {
|
|
117
|
+
"detection": {
|
|
118
|
+
"type": "object",
|
|
119
|
+
"properties": {
|
|
120
|
+
"extractor": {
|
|
121
|
+
"type": "string"
|
|
122
|
+
},
|
|
123
|
+
"confidence": {
|
|
124
|
+
"type": "number",
|
|
125
|
+
"minimum": 0,
|
|
126
|
+
"maximum": 100
|
|
127
|
+
},
|
|
128
|
+
"patterns": {
|
|
129
|
+
"type": "array",
|
|
130
|
+
"items": {
|
|
131
|
+
"type": "string"
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
"reason": {
|
|
135
|
+
"type": "string"
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
"required": [
|
|
139
|
+
"extractor",
|
|
140
|
+
"confidence",
|
|
141
|
+
"patterns",
|
|
142
|
+
"reason"
|
|
143
|
+
],
|
|
144
|
+
"additionalProperties": false
|
|
145
|
+
},
|
|
146
|
+
"confidence": {
|
|
147
|
+
"type": "number",
|
|
148
|
+
"minimum": 0,
|
|
149
|
+
"maximum": 100
|
|
150
|
+
},
|
|
151
|
+
"completeness": {
|
|
152
|
+
"type": "number",
|
|
153
|
+
"minimum": 0,
|
|
154
|
+
"maximum": 100
|
|
155
|
+
},
|
|
156
|
+
"issues": {
|
|
157
|
+
"type": "array",
|
|
158
|
+
"items": {
|
|
159
|
+
"type": "string"
|
|
160
|
+
}
|
|
161
|
+
},
|
|
162
|
+
"suggestions": {
|
|
163
|
+
"type": "array",
|
|
164
|
+
"items": {
|
|
165
|
+
"type": "string"
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
"required": [
|
|
170
|
+
"confidence",
|
|
171
|
+
"completeness",
|
|
172
|
+
"issues"
|
|
173
|
+
],
|
|
174
|
+
"additionalProperties": false
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
"required": [
|
|
178
|
+
"summary",
|
|
179
|
+
"totalErrors",
|
|
180
|
+
"errors"
|
|
181
|
+
],
|
|
182
|
+
"additionalProperties": false
|
|
183
|
+
},
|
|
184
|
+
"name": {
|
|
185
|
+
"type": "string"
|
|
186
|
+
},
|
|
187
|
+
"passed": {
|
|
188
|
+
"type": "boolean"
|
|
189
|
+
},
|
|
190
|
+
"isCachedResult": {
|
|
191
|
+
"type": "boolean"
|
|
192
|
+
},
|
|
193
|
+
"outputFiles": {
|
|
194
|
+
"type": "object",
|
|
195
|
+
"properties": {
|
|
196
|
+
"stdout": {
|
|
197
|
+
"type": "string"
|
|
198
|
+
},
|
|
199
|
+
"stderr": {
|
|
200
|
+
"type": "string"
|
|
201
|
+
},
|
|
202
|
+
"combined": {
|
|
203
|
+
"type": "string"
|
|
204
|
+
}
|
|
205
|
+
},
|
|
206
|
+
"required": [
|
|
207
|
+
"combined"
|
|
208
|
+
],
|
|
209
|
+
"additionalProperties": false
|
|
210
|
+
}
|
|
211
|
+
},
|
|
212
|
+
"required": [
|
|
213
|
+
"command",
|
|
214
|
+
"exitCode",
|
|
215
|
+
"durationSecs",
|
|
216
|
+
"name",
|
|
217
|
+
"passed"
|
|
218
|
+
],
|
|
219
|
+
"additionalProperties": false
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
},
|
|
223
|
+
"required": [
|
|
224
|
+
"name",
|
|
225
|
+
"passed",
|
|
226
|
+
"durationSecs",
|
|
227
|
+
"steps"
|
|
228
|
+
],
|
|
229
|
+
"additionalProperties": false
|
|
230
|
+
}
|
|
231
|
+
},
|
|
232
|
+
"fullLogFile": {
|
|
233
|
+
"type": "string"
|
|
234
|
+
}
|
|
235
|
+
},
|
|
236
|
+
"required": [
|
|
237
|
+
"timestamp",
|
|
238
|
+
"treeHash",
|
|
239
|
+
"passed"
|
|
240
|
+
],
|
|
241
|
+
"additionalProperties": false
|
|
242
|
+
}
|
|
243
|
+
},
|
|
244
|
+
"$schema": "http://json-schema.org/draft-07/schema#"
|
|
245
|
+
}
|
package/dist/types.d.ts
DELETED
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Core validation types for vibe-validate
|
|
3
|
-
*
|
|
4
|
-
* These types define the validation configuration structure and result types.
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* A single validation step (language-agnostic)
|
|
8
|
-
*/
|
|
9
|
-
export interface ValidationStep {
|
|
10
|
-
/** Human-readable step name */
|
|
11
|
-
name: string;
|
|
12
|
-
/** Command to execute (can be any shell command, not just npm scripts) */
|
|
13
|
-
command: string;
|
|
14
|
-
/** Optional timeout in milliseconds */
|
|
15
|
-
timeout?: number;
|
|
16
|
-
/** Optional environment variables for this step */
|
|
17
|
-
env?: Record<string, string>;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* A validation phase containing multiple steps
|
|
21
|
-
*/
|
|
22
|
-
export interface ValidationPhase {
|
|
23
|
-
/** Human-readable phase name */
|
|
24
|
-
name: string;
|
|
25
|
-
/** Run steps in parallel? */
|
|
26
|
-
parallel: boolean;
|
|
27
|
-
/** Steps to execute in this phase */
|
|
28
|
-
steps: ValidationStep[];
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Extraction quality metrics for a validation step
|
|
32
|
-
*/
|
|
33
|
-
export interface ExtractionQuality {
|
|
34
|
-
/** Tool detected from output (vitest, tsc, eslint, etc.) */
|
|
35
|
-
detectedTool: string;
|
|
36
|
-
/** Confidence level of tool detection */
|
|
37
|
-
confidence: 'high' | 'medium' | 'low';
|
|
38
|
-
/** Quality score (0-100) based on field extraction */
|
|
39
|
-
score: number;
|
|
40
|
-
/** Number of warnings extracted (even from passing tests) */
|
|
41
|
-
warnings: number;
|
|
42
|
-
/** Number of errors/failures extracted */
|
|
43
|
-
errorsExtracted: number;
|
|
44
|
-
/** Is the extraction actionable? (has structured failures/warnings) */
|
|
45
|
-
actionable: boolean;
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Result from executing a validation step
|
|
49
|
-
*/
|
|
50
|
-
export interface StepResult {
|
|
51
|
-
/** Step name */
|
|
52
|
-
name: string;
|
|
53
|
-
/** Did the step pass? */
|
|
54
|
-
passed: boolean;
|
|
55
|
-
/** Execution duration in seconds */
|
|
56
|
-
durationSecs: number;
|
|
57
|
-
/** Output from the step (stdout + stderr) */
|
|
58
|
-
output?: string;
|
|
59
|
-
/** Extracted test failures (file:line - message) */
|
|
60
|
-
failedTests?: string[];
|
|
61
|
-
/** Extraction quality metrics (populated for all steps with output) */
|
|
62
|
-
extractionQuality?: ExtractionQuality;
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Result from executing a validation phase
|
|
66
|
-
*/
|
|
67
|
-
export interface PhaseResult {
|
|
68
|
-
/** Phase name */
|
|
69
|
-
name: string;
|
|
70
|
-
/** Phase execution duration in seconds */
|
|
71
|
-
durationSecs: number;
|
|
72
|
-
/** Did the phase pass? */
|
|
73
|
-
passed: boolean;
|
|
74
|
-
/** Results from individual steps */
|
|
75
|
-
steps: StepResult[];
|
|
76
|
-
/** Output from failed step (if any) */
|
|
77
|
-
output?: string;
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Overall validation result
|
|
81
|
-
*
|
|
82
|
-
* IMPORTANT: Field order matters for YAML truncation safety!
|
|
83
|
-
* Verbose fields (failedStepOutput, phases with output) are at the END
|
|
84
|
-
* so that truncation doesn't break critical metadata (passed, timestamp, rerunCommand).
|
|
85
|
-
*/
|
|
86
|
-
export interface ValidationResult {
|
|
87
|
-
/** Did validation pass? */
|
|
88
|
-
passed: boolean;
|
|
89
|
-
/** ISO 8601 timestamp */
|
|
90
|
-
timestamp: string;
|
|
91
|
-
/** Git tree hash (if in git repo) */
|
|
92
|
-
treeHash: string;
|
|
93
|
-
/** Name of failed step (if any) */
|
|
94
|
-
failedStep?: string;
|
|
95
|
-
/** Command to re-run failed step */
|
|
96
|
-
rerunCommand?: string;
|
|
97
|
-
/** Failed test names (if applicable) */
|
|
98
|
-
failedTests?: string[];
|
|
99
|
-
/** Path to full log file */
|
|
100
|
-
fullLogFile?: string;
|
|
101
|
-
/** Summary message */
|
|
102
|
-
summary?: string;
|
|
103
|
-
/** Results from each phase (may contain verbose output field) */
|
|
104
|
-
phases?: PhaseResult[];
|
|
105
|
-
/** Output from the failed step (verbose - placed last for truncation safety) */
|
|
106
|
-
failedStepOutput?: string;
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* Validation configuration
|
|
110
|
-
*
|
|
111
|
-
* Note: State management (caching, forceRun) is now handled at the CLI layer
|
|
112
|
-
* via git notes. See packages/cli/src/commands/validate.ts and @vibe-validate/history.
|
|
113
|
-
*/
|
|
114
|
-
export interface ValidationConfig {
|
|
115
|
-
/** Validation phases to execute */
|
|
116
|
-
phases: ValidationPhase[];
|
|
117
|
-
/** Path to log file (default: os.tmpdir()/validation-{timestamp}.log) */
|
|
118
|
-
logPath?: string;
|
|
119
|
-
/** Enable fail-fast (stop on first failure) */
|
|
120
|
-
enableFailFast?: boolean;
|
|
121
|
-
/** Show verbose output (stream command stdout/stderr in real-time) */
|
|
122
|
-
verbose?: boolean;
|
|
123
|
-
/** Output YAML result to stdout (redirects subprocess output to stderr when true) */
|
|
124
|
-
yaml?: boolean;
|
|
125
|
-
/** Developer feedback for continuous quality improvement (default: false) */
|
|
126
|
-
developerFeedback?: boolean;
|
|
127
|
-
/** Environment variables to pass to all child processes */
|
|
128
|
-
env?: Record<string, string>;
|
|
129
|
-
/** Callback when phase starts */
|
|
130
|
-
onPhaseStart?: (_phase: ValidationPhase) => void;
|
|
131
|
-
/** Callback when phase completes */
|
|
132
|
-
onPhaseComplete?: (_phase: ValidationPhase, _result: PhaseResult) => void;
|
|
133
|
-
/** Callback when step starts */
|
|
134
|
-
onStepStart?: (_step: ValidationStep) => void;
|
|
135
|
-
/** Callback when step completes */
|
|
136
|
-
onStepComplete?: (_step: ValidationStep, _result: StepResult) => void;
|
|
137
|
-
}
|
|
138
|
-
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"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IACjC,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,eAAe,KAAK,IAAI,CAAC;IAEjD,oCAAoC;IACpC,eAAe,CAAC,EAAE,CAAC,MAAM,EAAE,eAAe,EAAE,OAAO,EAAE,WAAW,KAAK,IAAI,CAAC;IAE1E,gCAAgC;IAChC,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,cAAc,KAAK,IAAI,CAAC;IAE9C,mCAAmC;IACnC,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,cAAc,EAAE,OAAO,EAAE,UAAU,KAAK,IAAI,CAAC;CACvE"}
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$ref": "#/definitions/ValidationResult",
|
|
3
|
-
"definitions": {
|
|
4
|
-
"ValidationResult": {
|
|
5
|
-
"type": "object",
|
|
6
|
-
"properties": {
|
|
7
|
-
"passed": {
|
|
8
|
-
"type": "boolean"
|
|
9
|
-
},
|
|
10
|
-
"timestamp": {
|
|
11
|
-
"type": "string"
|
|
12
|
-
},
|
|
13
|
-
"treeHash": {
|
|
14
|
-
"type": "string"
|
|
15
|
-
},
|
|
16
|
-
"phases": {
|
|
17
|
-
"type": "array",
|
|
18
|
-
"items": {
|
|
19
|
-
"type": "object",
|
|
20
|
-
"properties": {
|
|
21
|
-
"name": {
|
|
22
|
-
"type": "string"
|
|
23
|
-
},
|
|
24
|
-
"durationSecs": {
|
|
25
|
-
"type": "number"
|
|
26
|
-
},
|
|
27
|
-
"passed": {
|
|
28
|
-
"type": "boolean"
|
|
29
|
-
},
|
|
30
|
-
"steps": {
|
|
31
|
-
"type": "array",
|
|
32
|
-
"items": {
|
|
33
|
-
"type": "object",
|
|
34
|
-
"properties": {
|
|
35
|
-
"name": {
|
|
36
|
-
"type": "string"
|
|
37
|
-
},
|
|
38
|
-
"passed": {
|
|
39
|
-
"type": "boolean"
|
|
40
|
-
},
|
|
41
|
-
"durationSecs": {
|
|
42
|
-
"type": "number"
|
|
43
|
-
},
|
|
44
|
-
"output": {
|
|
45
|
-
"type": "string"
|
|
46
|
-
}
|
|
47
|
-
},
|
|
48
|
-
"required": [
|
|
49
|
-
"name",
|
|
50
|
-
"passed",
|
|
51
|
-
"durationSecs"
|
|
52
|
-
],
|
|
53
|
-
"additionalProperties": false
|
|
54
|
-
}
|
|
55
|
-
},
|
|
56
|
-
"output": {
|
|
57
|
-
"type": "string"
|
|
58
|
-
}
|
|
59
|
-
},
|
|
60
|
-
"required": [
|
|
61
|
-
"name",
|
|
62
|
-
"durationSecs",
|
|
63
|
-
"passed",
|
|
64
|
-
"steps"
|
|
65
|
-
],
|
|
66
|
-
"additionalProperties": false
|
|
67
|
-
}
|
|
68
|
-
},
|
|
69
|
-
"failedStep": {
|
|
70
|
-
"type": "string"
|
|
71
|
-
},
|
|
72
|
-
"rerunCommand": {
|
|
73
|
-
"type": "string"
|
|
74
|
-
},
|
|
75
|
-
"failedStepOutput": {
|
|
76
|
-
"type": "string"
|
|
77
|
-
},
|
|
78
|
-
"failedTests": {
|
|
79
|
-
"type": "array",
|
|
80
|
-
"items": {
|
|
81
|
-
"type": "string"
|
|
82
|
-
}
|
|
83
|
-
},
|
|
84
|
-
"fullLogFile": {
|
|
85
|
-
"type": "string"
|
|
86
|
-
},
|
|
87
|
-
"summary": {
|
|
88
|
-
"type": "string"
|
|
89
|
-
}
|
|
90
|
-
},
|
|
91
|
-
"required": [
|
|
92
|
-
"passed",
|
|
93
|
-
"timestamp",
|
|
94
|
-
"treeHash"
|
|
95
|
-
],
|
|
96
|
-
"additionalProperties": false
|
|
97
|
-
}
|
|
98
|
-
},
|
|
99
|
-
"$schema": "http://json-schema.org/draft-07/schema#"
|
|
100
|
-
}
|