@vibe-validate/extractors 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/dist/ava-extractor.js +35 -39
- package/dist/ava-extractor.js.map +1 -1
- package/dist/eslint-extractor.d.ts.map +1 -1
- package/dist/eslint-extractor.js +16 -14
- package/dist/eslint-extractor.js.map +1 -1
- package/dist/generic-extractor.d.ts +16 -10
- package/dist/generic-extractor.d.ts.map +1 -1
- package/dist/generic-extractor.js +106 -29
- package/dist/generic-extractor.js.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/jasmine-extractor.d.ts.map +1 -1
- package/dist/jasmine-extractor.js +25 -20
- package/dist/jasmine-extractor.js.map +1 -1
- package/dist/jest-extractor.d.ts.map +1 -1
- package/dist/jest-extractor.js +118 -64
- package/dist/jest-extractor.js.map +1 -1
- package/dist/junit-extractor.d.ts.map +1 -1
- package/dist/junit-extractor.js +41 -50
- package/dist/junit-extractor.js.map +1 -1
- package/dist/mocha-extractor.d.ts.map +1 -1
- package/dist/mocha-extractor.js +26 -21
- package/dist/mocha-extractor.js.map +1 -1
- package/dist/playwright-extractor.d.ts.map +1 -1
- package/dist/playwright-extractor.js +24 -14
- package/dist/playwright-extractor.js.map +1 -1
- package/dist/result-schema-export.d.ts +29 -0
- package/dist/result-schema-export.d.ts.map +1 -0
- package/dist/result-schema-export.js +37 -0
- package/dist/result-schema-export.js.map +1 -0
- package/dist/result-schema.d.ts +349 -0
- package/dist/result-schema.d.ts.map +1 -0
- package/dist/result-schema.js +139 -0
- package/dist/result-schema.js.map +1 -0
- package/dist/scripts/generate-result-schema.d.ts +10 -0
- package/dist/scripts/generate-result-schema.d.ts.map +1 -0
- package/dist/scripts/generate-result-schema.js +20 -0
- package/dist/scripts/generate-result-schema.js.map +1 -0
- package/dist/smart-extractor.d.ts +17 -20
- package/dist/smart-extractor.d.ts.map +1 -1
- package/dist/smart-extractor.js +116 -80
- package/dist/smart-extractor.js.map +1 -1
- package/dist/tap-extractor.js +18 -13
- package/dist/tap-extractor.js.map +1 -1
- package/dist/types.d.ts +18 -65
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -1
- package/dist/typescript-extractor.d.ts.map +1 -1
- package/dist/typescript-extractor.js +13 -10
- package/dist/typescript-extractor.js.map +1 -1
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +2 -1
- package/dist/utils.js.map +1 -1
- package/dist/vitest-extractor.d.ts.map +1 -1
- package/dist/vitest-extractor.js +310 -163
- package/dist/vitest-extractor.js.map +1 -1
- package/error-extractor-result.schema.json +134 -0
- package/package.json +8 -3
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zod Schema for Error Extractor Results
|
|
3
|
+
*
|
|
4
|
+
* This schema defines the structure of extractor output and enables
|
|
5
|
+
* runtime validation and JSON Schema generation for documentation.
|
|
6
|
+
*
|
|
7
|
+
* @packageDocumentation
|
|
8
|
+
*/
|
|
9
|
+
import { z } from 'zod';
|
|
10
|
+
/**
|
|
11
|
+
* Maximum number of errors to include in errors array
|
|
12
|
+
*
|
|
13
|
+
* Limits token usage in LLM context window. Full count available in totalErrors field.
|
|
14
|
+
*/
|
|
15
|
+
export declare const MAX_ERRORS_IN_ARRAY = 10;
|
|
16
|
+
/**
|
|
17
|
+
* Formatted Error Schema
|
|
18
|
+
*
|
|
19
|
+
* Structured error information extracted from validation output
|
|
20
|
+
*/
|
|
21
|
+
export declare const FormattedErrorSchema: z.ZodObject<{
|
|
22
|
+
/** File path where the error occurred */
|
|
23
|
+
file: z.ZodOptional<z.ZodString>;
|
|
24
|
+
/** Line number (1-indexed) */
|
|
25
|
+
line: z.ZodOptional<z.ZodNumber>;
|
|
26
|
+
/** Column number (1-indexed) */
|
|
27
|
+
column: z.ZodOptional<z.ZodNumber>;
|
|
28
|
+
/** Error message */
|
|
29
|
+
message: z.ZodString;
|
|
30
|
+
/** Error code (e.g., TS2322, ESLint rule name) */
|
|
31
|
+
code: z.ZodOptional<z.ZodString>;
|
|
32
|
+
/** Severity level */
|
|
33
|
+
severity: z.ZodOptional<z.ZodEnum<["error", "warning"]>>;
|
|
34
|
+
/** Additional context (surrounding code, stack trace excerpt) */
|
|
35
|
+
context: z.ZodOptional<z.ZodString>;
|
|
36
|
+
/** Guidance for fixing the error */
|
|
37
|
+
guidance: z.ZodOptional<z.ZodString>;
|
|
38
|
+
}, "strip", z.ZodTypeAny, {
|
|
39
|
+
message: string;
|
|
40
|
+
file?: string | undefined;
|
|
41
|
+
line?: number | undefined;
|
|
42
|
+
column?: number | undefined;
|
|
43
|
+
code?: string | undefined;
|
|
44
|
+
severity?: "error" | "warning" | undefined;
|
|
45
|
+
context?: string | undefined;
|
|
46
|
+
guidance?: string | undefined;
|
|
47
|
+
}, {
|
|
48
|
+
message: string;
|
|
49
|
+
file?: string | undefined;
|
|
50
|
+
line?: number | undefined;
|
|
51
|
+
column?: number | undefined;
|
|
52
|
+
code?: string | undefined;
|
|
53
|
+
severity?: "error" | "warning" | undefined;
|
|
54
|
+
context?: string | undefined;
|
|
55
|
+
guidance?: string | undefined;
|
|
56
|
+
}>;
|
|
57
|
+
/**
|
|
58
|
+
* Detection Metadata Schema
|
|
59
|
+
*
|
|
60
|
+
* Information about which extractor was selected and why
|
|
61
|
+
*/
|
|
62
|
+
export declare const DetectionMetadataSchema: z.ZodObject<{
|
|
63
|
+
/** Which extractor was used */
|
|
64
|
+
extractor: z.ZodString;
|
|
65
|
+
/** Confidence in detection (0-100) */
|
|
66
|
+
confidence: z.ZodNumber;
|
|
67
|
+
/** Patterns that matched */
|
|
68
|
+
patterns: z.ZodArray<z.ZodString, "many">;
|
|
69
|
+
/** Why this extractor was chosen */
|
|
70
|
+
reason: z.ZodString;
|
|
71
|
+
}, "strip", z.ZodTypeAny, {
|
|
72
|
+
extractor: string;
|
|
73
|
+
confidence: number;
|
|
74
|
+
patterns: string[];
|
|
75
|
+
reason: string;
|
|
76
|
+
}, {
|
|
77
|
+
extractor: string;
|
|
78
|
+
confidence: number;
|
|
79
|
+
patterns: string[];
|
|
80
|
+
reason: string;
|
|
81
|
+
}>;
|
|
82
|
+
/**
|
|
83
|
+
* Extraction Metadata Schema
|
|
84
|
+
*
|
|
85
|
+
* Quality information about the extraction process
|
|
86
|
+
*/
|
|
87
|
+
export declare const ExtractionMetadataSchema: z.ZodObject<{
|
|
88
|
+
/** Detection information (only included when developerFeedback: true) */
|
|
89
|
+
detection: z.ZodOptional<z.ZodObject<{
|
|
90
|
+
/** Which extractor was used */
|
|
91
|
+
extractor: z.ZodString;
|
|
92
|
+
/** Confidence in detection (0-100) */
|
|
93
|
+
confidence: z.ZodNumber;
|
|
94
|
+
/** Patterns that matched */
|
|
95
|
+
patterns: z.ZodArray<z.ZodString, "many">;
|
|
96
|
+
/** Why this extractor was chosen */
|
|
97
|
+
reason: z.ZodString;
|
|
98
|
+
}, "strip", z.ZodTypeAny, {
|
|
99
|
+
extractor: string;
|
|
100
|
+
confidence: number;
|
|
101
|
+
patterns: string[];
|
|
102
|
+
reason: string;
|
|
103
|
+
}, {
|
|
104
|
+
extractor: string;
|
|
105
|
+
confidence: number;
|
|
106
|
+
patterns: string[];
|
|
107
|
+
reason: string;
|
|
108
|
+
}>>;
|
|
109
|
+
/** Extraction confidence (0-100) */
|
|
110
|
+
confidence: z.ZodNumber;
|
|
111
|
+
/** Percentage of extracted errors with complete data (0-100) */
|
|
112
|
+
completeness: z.ZodNumber;
|
|
113
|
+
/** Issues encountered during extraction */
|
|
114
|
+
issues: z.ZodArray<z.ZodString, "many">;
|
|
115
|
+
/** Suggestions for improvement (only included when developerFeedback: true) */
|
|
116
|
+
suggestions: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
117
|
+
}, "strip", z.ZodTypeAny, {
|
|
118
|
+
issues: string[];
|
|
119
|
+
confidence: number;
|
|
120
|
+
completeness: number;
|
|
121
|
+
detection?: {
|
|
122
|
+
extractor: string;
|
|
123
|
+
confidence: number;
|
|
124
|
+
patterns: string[];
|
|
125
|
+
reason: string;
|
|
126
|
+
} | undefined;
|
|
127
|
+
suggestions?: string[] | undefined;
|
|
128
|
+
}, {
|
|
129
|
+
issues: string[];
|
|
130
|
+
confidence: number;
|
|
131
|
+
completeness: number;
|
|
132
|
+
detection?: {
|
|
133
|
+
extractor: string;
|
|
134
|
+
confidence: number;
|
|
135
|
+
patterns: string[];
|
|
136
|
+
reason: string;
|
|
137
|
+
} | undefined;
|
|
138
|
+
suggestions?: string[] | undefined;
|
|
139
|
+
}>;
|
|
140
|
+
/**
|
|
141
|
+
* Error Extractor Result Schema
|
|
142
|
+
*
|
|
143
|
+
* Complete result structure from error extraction operation
|
|
144
|
+
*
|
|
145
|
+
* Field ordering optimized for LLM consumption:
|
|
146
|
+
* - Summary and count first (high-level overview)
|
|
147
|
+
* - Structured errors (detailed breakdown)
|
|
148
|
+
* - Guidance and errorSummary (actionable context)
|
|
149
|
+
* - Metadata last (quality metrics)
|
|
150
|
+
*/
|
|
151
|
+
export declare const ErrorExtractorResultSchema: z.ZodObject<{
|
|
152
|
+
/** Human-readable summary (e.g., "2 test failures", "5 type errors") */
|
|
153
|
+
summary: z.ZodString;
|
|
154
|
+
/** Total error count (may exceed errors.length if truncated to MAX_ERRORS_IN_ARRAY) */
|
|
155
|
+
totalErrors: z.ZodNumber;
|
|
156
|
+
/** Parsed and structured errors (limited to MAX_ERRORS_IN_ARRAY for token efficiency) */
|
|
157
|
+
errors: z.ZodArray<z.ZodObject<{
|
|
158
|
+
/** File path where the error occurred */
|
|
159
|
+
file: z.ZodOptional<z.ZodString>;
|
|
160
|
+
/** Line number (1-indexed) */
|
|
161
|
+
line: z.ZodOptional<z.ZodNumber>;
|
|
162
|
+
/** Column number (1-indexed) */
|
|
163
|
+
column: z.ZodOptional<z.ZodNumber>;
|
|
164
|
+
/** Error message */
|
|
165
|
+
message: z.ZodString;
|
|
166
|
+
/** Error code (e.g., TS2322, ESLint rule name) */
|
|
167
|
+
code: z.ZodOptional<z.ZodString>;
|
|
168
|
+
/** Severity level */
|
|
169
|
+
severity: z.ZodOptional<z.ZodEnum<["error", "warning"]>>;
|
|
170
|
+
/** Additional context (surrounding code, stack trace excerpt) */
|
|
171
|
+
context: z.ZodOptional<z.ZodString>;
|
|
172
|
+
/** Guidance for fixing the error */
|
|
173
|
+
guidance: z.ZodOptional<z.ZodString>;
|
|
174
|
+
}, "strip", z.ZodTypeAny, {
|
|
175
|
+
message: string;
|
|
176
|
+
file?: string | undefined;
|
|
177
|
+
line?: number | undefined;
|
|
178
|
+
column?: number | undefined;
|
|
179
|
+
code?: string | undefined;
|
|
180
|
+
severity?: "error" | "warning" | undefined;
|
|
181
|
+
context?: string | undefined;
|
|
182
|
+
guidance?: string | undefined;
|
|
183
|
+
}, {
|
|
184
|
+
message: string;
|
|
185
|
+
file?: string | undefined;
|
|
186
|
+
line?: number | undefined;
|
|
187
|
+
column?: number | undefined;
|
|
188
|
+
code?: string | undefined;
|
|
189
|
+
severity?: "error" | "warning" | undefined;
|
|
190
|
+
context?: string | undefined;
|
|
191
|
+
guidance?: string | undefined;
|
|
192
|
+
}>, "many">;
|
|
193
|
+
/** Step-specific actionable guidance for fixing errors */
|
|
194
|
+
guidance: z.ZodOptional<z.ZodString>;
|
|
195
|
+
/**
|
|
196
|
+
* Formatted error summary - LLM-optimized text view of errors
|
|
197
|
+
*
|
|
198
|
+
* When errors exist: Concise file:line:column - message format
|
|
199
|
+
* When no errors: Keyword extraction from output (FAILED, Error, etc.)
|
|
200
|
+
* ANSI codes stripped, limited to first 10-20 relevant lines
|
|
201
|
+
* Provides 40x context window savings vs raw output
|
|
202
|
+
*
|
|
203
|
+
* Optional - only included when it provides value beyond structured errors array
|
|
204
|
+
*/
|
|
205
|
+
errorSummary: z.ZodOptional<z.ZodString>;
|
|
206
|
+
/** Extraction quality metadata (only included when developerFeedback: true) */
|
|
207
|
+
metadata: z.ZodOptional<z.ZodObject<{
|
|
208
|
+
/** Detection information (only included when developerFeedback: true) */
|
|
209
|
+
detection: z.ZodOptional<z.ZodObject<{
|
|
210
|
+
/** Which extractor was used */
|
|
211
|
+
extractor: z.ZodString;
|
|
212
|
+
/** Confidence in detection (0-100) */
|
|
213
|
+
confidence: z.ZodNumber;
|
|
214
|
+
/** Patterns that matched */
|
|
215
|
+
patterns: z.ZodArray<z.ZodString, "many">;
|
|
216
|
+
/** Why this extractor was chosen */
|
|
217
|
+
reason: z.ZodString;
|
|
218
|
+
}, "strip", z.ZodTypeAny, {
|
|
219
|
+
extractor: string;
|
|
220
|
+
confidence: number;
|
|
221
|
+
patterns: string[];
|
|
222
|
+
reason: string;
|
|
223
|
+
}, {
|
|
224
|
+
extractor: string;
|
|
225
|
+
confidence: number;
|
|
226
|
+
patterns: string[];
|
|
227
|
+
reason: string;
|
|
228
|
+
}>>;
|
|
229
|
+
/** Extraction confidence (0-100) */
|
|
230
|
+
confidence: z.ZodNumber;
|
|
231
|
+
/** Percentage of extracted errors with complete data (0-100) */
|
|
232
|
+
completeness: z.ZodNumber;
|
|
233
|
+
/** Issues encountered during extraction */
|
|
234
|
+
issues: z.ZodArray<z.ZodString, "many">;
|
|
235
|
+
/** Suggestions for improvement (only included when developerFeedback: true) */
|
|
236
|
+
suggestions: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
237
|
+
}, "strip", z.ZodTypeAny, {
|
|
238
|
+
issues: string[];
|
|
239
|
+
confidence: number;
|
|
240
|
+
completeness: number;
|
|
241
|
+
detection?: {
|
|
242
|
+
extractor: string;
|
|
243
|
+
confidence: number;
|
|
244
|
+
patterns: string[];
|
|
245
|
+
reason: string;
|
|
246
|
+
} | undefined;
|
|
247
|
+
suggestions?: string[] | undefined;
|
|
248
|
+
}, {
|
|
249
|
+
issues: string[];
|
|
250
|
+
confidence: number;
|
|
251
|
+
completeness: number;
|
|
252
|
+
detection?: {
|
|
253
|
+
extractor: string;
|
|
254
|
+
confidence: number;
|
|
255
|
+
patterns: string[];
|
|
256
|
+
reason: string;
|
|
257
|
+
} | undefined;
|
|
258
|
+
suggestions?: string[] | undefined;
|
|
259
|
+
}>>;
|
|
260
|
+
}, "strip", z.ZodTypeAny, {
|
|
261
|
+
summary: string;
|
|
262
|
+
totalErrors: number;
|
|
263
|
+
errors: {
|
|
264
|
+
message: string;
|
|
265
|
+
file?: string | undefined;
|
|
266
|
+
line?: number | undefined;
|
|
267
|
+
column?: number | undefined;
|
|
268
|
+
code?: string | undefined;
|
|
269
|
+
severity?: "error" | "warning" | undefined;
|
|
270
|
+
context?: string | undefined;
|
|
271
|
+
guidance?: string | undefined;
|
|
272
|
+
}[];
|
|
273
|
+
guidance?: string | undefined;
|
|
274
|
+
errorSummary?: string | undefined;
|
|
275
|
+
metadata?: {
|
|
276
|
+
issues: string[];
|
|
277
|
+
confidence: number;
|
|
278
|
+
completeness: number;
|
|
279
|
+
detection?: {
|
|
280
|
+
extractor: string;
|
|
281
|
+
confidence: number;
|
|
282
|
+
patterns: string[];
|
|
283
|
+
reason: string;
|
|
284
|
+
} | undefined;
|
|
285
|
+
suggestions?: string[] | undefined;
|
|
286
|
+
} | undefined;
|
|
287
|
+
}, {
|
|
288
|
+
summary: string;
|
|
289
|
+
totalErrors: number;
|
|
290
|
+
errors: {
|
|
291
|
+
message: string;
|
|
292
|
+
file?: string | undefined;
|
|
293
|
+
line?: number | undefined;
|
|
294
|
+
column?: number | undefined;
|
|
295
|
+
code?: string | undefined;
|
|
296
|
+
severity?: "error" | "warning" | undefined;
|
|
297
|
+
context?: string | undefined;
|
|
298
|
+
guidance?: string | undefined;
|
|
299
|
+
}[];
|
|
300
|
+
guidance?: string | undefined;
|
|
301
|
+
errorSummary?: string | undefined;
|
|
302
|
+
metadata?: {
|
|
303
|
+
issues: string[];
|
|
304
|
+
confidence: number;
|
|
305
|
+
completeness: number;
|
|
306
|
+
detection?: {
|
|
307
|
+
extractor: string;
|
|
308
|
+
confidence: number;
|
|
309
|
+
patterns: string[];
|
|
310
|
+
reason: string;
|
|
311
|
+
} | undefined;
|
|
312
|
+
suggestions?: string[] | undefined;
|
|
313
|
+
} | undefined;
|
|
314
|
+
}>;
|
|
315
|
+
/**
|
|
316
|
+
* Inferred TypeScript types from Zod schemas
|
|
317
|
+
*/
|
|
318
|
+
export type FormattedError = z.infer<typeof FormattedErrorSchema>;
|
|
319
|
+
export type DetectionMetadata = z.infer<typeof DetectionMetadataSchema>;
|
|
320
|
+
export type ExtractionMetadata = z.infer<typeof ExtractionMetadataSchema>;
|
|
321
|
+
export type ErrorExtractorResult = z.infer<typeof ErrorExtractorResultSchema>;
|
|
322
|
+
/**
|
|
323
|
+
* Safe validation function for ErrorExtractorResult
|
|
324
|
+
*
|
|
325
|
+
* NOTE: This duplicates the pattern from @vibe-validate/core's createSafeValidator.
|
|
326
|
+
* We can't import from core here due to circular dependency (core → extractors).
|
|
327
|
+
* This is an acceptable trade-off for a foundational package.
|
|
328
|
+
*
|
|
329
|
+
* @param data - Data to validate
|
|
330
|
+
* @returns Validation result with success/error information
|
|
331
|
+
*/
|
|
332
|
+
export declare function safeValidateExtractorResult(data: unknown): {
|
|
333
|
+
success: true;
|
|
334
|
+
data: ErrorExtractorResult;
|
|
335
|
+
} | {
|
|
336
|
+
success: false;
|
|
337
|
+
errors: string[];
|
|
338
|
+
};
|
|
339
|
+
/**
|
|
340
|
+
* Strict validation function for ErrorExtractorResult
|
|
341
|
+
*
|
|
342
|
+
* Validates and throws on error.
|
|
343
|
+
*
|
|
344
|
+
* @param data - Data to validate
|
|
345
|
+
* @returns Validated result
|
|
346
|
+
* @throws {Error} If validation fails
|
|
347
|
+
*/
|
|
348
|
+
export declare function validateExtractorResult(data: unknown): ErrorExtractorResult;
|
|
349
|
+
//# sourceMappingURL=result-schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"result-schema.d.ts","sourceRoot":"","s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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0C/E,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAClE,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AACxE,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAC1E,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAE9E;;;;;;;;;GASG;AACH,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,OAAO,GACrD;IAAE,OAAO,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,oBAAoB,CAAA;CAAE,GAC7C;IAAE,OAAO,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAE,CAcvC;AAED;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,OAAO,GAAG,oBAAoB,CAE3E"}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zod Schema for Error Extractor Results
|
|
3
|
+
*
|
|
4
|
+
* This schema defines the structure of extractor output and enables
|
|
5
|
+
* runtime validation and JSON Schema generation for documentation.
|
|
6
|
+
*
|
|
7
|
+
* @packageDocumentation
|
|
8
|
+
*/
|
|
9
|
+
import { z } from 'zod';
|
|
10
|
+
/**
|
|
11
|
+
* Maximum number of errors to include in errors array
|
|
12
|
+
*
|
|
13
|
+
* Limits token usage in LLM context window. Full count available in totalErrors field.
|
|
14
|
+
*/
|
|
15
|
+
export const MAX_ERRORS_IN_ARRAY = 10;
|
|
16
|
+
/**
|
|
17
|
+
* Formatted Error Schema
|
|
18
|
+
*
|
|
19
|
+
* Structured error information extracted from validation output
|
|
20
|
+
*/
|
|
21
|
+
export const FormattedErrorSchema = z.object({
|
|
22
|
+
/** File path where the error occurred */
|
|
23
|
+
file: z.string().optional(),
|
|
24
|
+
/** Line number (1-indexed) */
|
|
25
|
+
line: z.number().int().positive().optional(),
|
|
26
|
+
/** Column number (1-indexed) */
|
|
27
|
+
column: z.number().int().positive().optional(),
|
|
28
|
+
/** Error message */
|
|
29
|
+
message: z.string(),
|
|
30
|
+
/** Error code (e.g., TS2322, ESLint rule name) */
|
|
31
|
+
code: z.string().optional(),
|
|
32
|
+
/** Severity level */
|
|
33
|
+
severity: z.enum(['error', 'warning']).optional(),
|
|
34
|
+
/** Additional context (surrounding code, stack trace excerpt) */
|
|
35
|
+
context: z.string().optional(),
|
|
36
|
+
/** Guidance for fixing the error */
|
|
37
|
+
guidance: z.string().optional(),
|
|
38
|
+
});
|
|
39
|
+
/**
|
|
40
|
+
* Detection Metadata Schema
|
|
41
|
+
*
|
|
42
|
+
* Information about which extractor was selected and why
|
|
43
|
+
*/
|
|
44
|
+
export const DetectionMetadataSchema = z.object({
|
|
45
|
+
/** Which extractor was used */
|
|
46
|
+
extractor: z.string(),
|
|
47
|
+
/** Confidence in detection (0-100) */
|
|
48
|
+
confidence: z.number().min(0).max(100),
|
|
49
|
+
/** Patterns that matched */
|
|
50
|
+
patterns: z.array(z.string()),
|
|
51
|
+
/** Why this extractor was chosen */
|
|
52
|
+
reason: z.string(),
|
|
53
|
+
});
|
|
54
|
+
/**
|
|
55
|
+
* Extraction Metadata Schema
|
|
56
|
+
*
|
|
57
|
+
* Quality information about the extraction process
|
|
58
|
+
*/
|
|
59
|
+
export const ExtractionMetadataSchema = z.object({
|
|
60
|
+
/** Detection information (only included when developerFeedback: true) */
|
|
61
|
+
detection: DetectionMetadataSchema.optional(),
|
|
62
|
+
/** Extraction confidence (0-100) */
|
|
63
|
+
confidence: z.number().min(0).max(100),
|
|
64
|
+
/** Percentage of extracted errors with complete data (0-100) */
|
|
65
|
+
completeness: z.number().min(0).max(100),
|
|
66
|
+
/** Issues encountered during extraction */
|
|
67
|
+
issues: z.array(z.string()),
|
|
68
|
+
/** Suggestions for improvement (only included when developerFeedback: true) */
|
|
69
|
+
suggestions: z.array(z.string()).optional(),
|
|
70
|
+
});
|
|
71
|
+
/**
|
|
72
|
+
* Error Extractor Result Schema
|
|
73
|
+
*
|
|
74
|
+
* Complete result structure from error extraction operation
|
|
75
|
+
*
|
|
76
|
+
* Field ordering optimized for LLM consumption:
|
|
77
|
+
* - Summary and count first (high-level overview)
|
|
78
|
+
* - Structured errors (detailed breakdown)
|
|
79
|
+
* - Guidance and errorSummary (actionable context)
|
|
80
|
+
* - Metadata last (quality metrics)
|
|
81
|
+
*/
|
|
82
|
+
export const ErrorExtractorResultSchema = z.object({
|
|
83
|
+
/** Human-readable summary (e.g., "2 test failures", "5 type errors") */
|
|
84
|
+
summary: z.string(),
|
|
85
|
+
/** Total error count (may exceed errors.length if truncated to MAX_ERRORS_IN_ARRAY) */
|
|
86
|
+
totalErrors: z.number().int().nonnegative(),
|
|
87
|
+
/** Parsed and structured errors (limited to MAX_ERRORS_IN_ARRAY for token efficiency) */
|
|
88
|
+
errors: z.array(FormattedErrorSchema),
|
|
89
|
+
/** Step-specific actionable guidance for fixing errors */
|
|
90
|
+
guidance: z.string().optional(),
|
|
91
|
+
/**
|
|
92
|
+
* Formatted error summary - LLM-optimized text view of errors
|
|
93
|
+
*
|
|
94
|
+
* When errors exist: Concise file:line:column - message format
|
|
95
|
+
* When no errors: Keyword extraction from output (FAILED, Error, etc.)
|
|
96
|
+
* ANSI codes stripped, limited to first 10-20 relevant lines
|
|
97
|
+
* Provides 40x context window savings vs raw output
|
|
98
|
+
*
|
|
99
|
+
* Optional - only included when it provides value beyond structured errors array
|
|
100
|
+
*/
|
|
101
|
+
errorSummary: z.string().optional(),
|
|
102
|
+
/** Extraction quality metadata (only included when developerFeedback: true) */
|
|
103
|
+
metadata: ExtractionMetadataSchema.optional(),
|
|
104
|
+
});
|
|
105
|
+
/**
|
|
106
|
+
* Safe validation function for ErrorExtractorResult
|
|
107
|
+
*
|
|
108
|
+
* NOTE: This duplicates the pattern from @vibe-validate/core's createSafeValidator.
|
|
109
|
+
* We can't import from core here due to circular dependency (core → extractors).
|
|
110
|
+
* This is an acceptable trade-off for a foundational package.
|
|
111
|
+
*
|
|
112
|
+
* @param data - Data to validate
|
|
113
|
+
* @returns Validation result with success/error information
|
|
114
|
+
*/
|
|
115
|
+
export function safeValidateExtractorResult(data) {
|
|
116
|
+
const result = ErrorExtractorResultSchema.safeParse(data);
|
|
117
|
+
if (result.success) {
|
|
118
|
+
return { success: true, data: result.data };
|
|
119
|
+
}
|
|
120
|
+
// Extract error messages with full path
|
|
121
|
+
const errors = result.error.errors.map(err => {
|
|
122
|
+
const path = err.path.join('.');
|
|
123
|
+
return path ? `${path}: ${err.message}` : err.message;
|
|
124
|
+
});
|
|
125
|
+
return { success: false, errors };
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Strict validation function for ErrorExtractorResult
|
|
129
|
+
*
|
|
130
|
+
* Validates and throws on error.
|
|
131
|
+
*
|
|
132
|
+
* @param data - Data to validate
|
|
133
|
+
* @returns Validated result
|
|
134
|
+
* @throws {Error} If validation fails
|
|
135
|
+
*/
|
|
136
|
+
export function validateExtractorResult(data) {
|
|
137
|
+
return ErrorExtractorResultSchema.parse(data);
|
|
138
|
+
}
|
|
139
|
+
//# sourceMappingURL=result-schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"result-schema.js","sourceRoot":"","sources":["../src/result-schema.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,EAAE,CAAC;AAEtC;;;;GAIG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,y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AE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC;IAC9C,CAAC;IAED,wCAAwC;IACxC,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,uBAAuB,CAAC,IAAa;IACnD,OAAO,0BAA0B,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;AAChD,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Generate JSON Schema File for Error Extractor Results
|
|
4
|
+
*
|
|
5
|
+
* Creates error-extractor-result.schema.json in the package root for use in
|
|
6
|
+
* validating documentation examples and agent integration code.
|
|
7
|
+
* This script runs during the build process.
|
|
8
|
+
*/
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=generate-result-schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-result-schema.d.ts","sourceRoot":"","sources":["../../src/scripts/generate-result-schema.ts"],"names":[],"mappings":";AACA;;;;;;GAMG"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Generate JSON Schema File for Error Extractor Results
|
|
4
|
+
*
|
|
5
|
+
* Creates error-extractor-result.schema.json in the package root for use in
|
|
6
|
+
* validating documentation examples and agent integration code.
|
|
7
|
+
* This script runs during the build process.
|
|
8
|
+
*/
|
|
9
|
+
import { writeFileSync } from 'node:fs';
|
|
10
|
+
import { fileURLToPath } from 'node:url';
|
|
11
|
+
import { dirname, join } from 'node:path';
|
|
12
|
+
import { extractorResultJsonSchema } from '../result-schema-export.js';
|
|
13
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
14
|
+
const __dirname = dirname(__filename);
|
|
15
|
+
const packageRoot = join(__dirname, '..', '..');
|
|
16
|
+
const schemaPath = join(packageRoot, 'error-extractor-result.schema.json');
|
|
17
|
+
// Generate and write schema file
|
|
18
|
+
writeFileSync(schemaPath, JSON.stringify(extractorResultJsonSchema, null, 2), 'utf-8');
|
|
19
|
+
console.log('✓ Generated error-extractor-result.schema.json');
|
|
20
|
+
//# sourceMappingURL=generate-result-schema.js.map
|
|
@@ -0,0 +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,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AAEvE,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,oCAAoC,CAAC,CAAC;AAE3E,iCAAiC;AACjC,aAAa,CACX,UAAU,EACV,IAAI,CAAC,SAAS,CAAC,yBAAyB,EAAE,IAAI,EAAE,CAAC,CAAC,EAClD,OAAO,CACR,CAAC;AAEF,OAAO,CAAC,GAAG,CAAC,gDAAgD,CAAC,CAAC"}
|
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
*
|
|
6
6
|
* @package @vibe-validate/extractors
|
|
7
7
|
*/
|
|
8
|
-
import type { ErrorExtractorResult } from './types.js';
|
|
8
|
+
import type { ErrorExtractorResult, ExtractorInput } from './types.js';
|
|
9
9
|
/**
|
|
10
10
|
* Auto-detect tool type from output patterns and extract errors
|
|
11
11
|
*
|
|
12
|
-
* Detection is 100% pattern-based
|
|
12
|
+
* Detection is 100% pattern-based from output analysis only.
|
|
13
13
|
* This ensures robust detection regardless of how users name their validation steps.
|
|
14
14
|
*
|
|
15
15
|
* Auto-detection rules (checked in order):
|
|
@@ -17,30 +17,27 @@ import type { ErrorExtractorResult } from './types.js';
|
|
|
17
17
|
* 2. **ESLint**: `✖ X problems` summary or `line:col error/warning` format
|
|
18
18
|
* 3. **JUnit XML**: `<?xml` + `<testsuite>` tags
|
|
19
19
|
* 4. **Jasmine**: `Failures:` header + numbered list (`1) test name`)
|
|
20
|
-
* 5. **
|
|
21
|
-
* 6. **
|
|
22
|
-
* 7. **
|
|
23
|
-
* 8. **Vitest**:
|
|
20
|
+
* 5. **Jest**: `●` bullets or `Test Suites:` summary (checked before Mocha)
|
|
21
|
+
* 6. **Mocha**: `X passing`/`X failing` summary + numbered list
|
|
22
|
+
* 7. **Playwright**: `.spec.ts` files + numbered failures with `›` separator
|
|
23
|
+
* 8. **Vitest**: `×`/`❯`/`❌` symbols + `Test Files` summary
|
|
24
24
|
* 9. **Generic**: Fallback for all other formats
|
|
25
25
|
*
|
|
26
|
-
* @param
|
|
27
|
-
* @param output - Raw command output (may contain ANSI color codes)
|
|
26
|
+
* @param input - Raw command output (string) or separated streams (ExtractorInput)
|
|
28
27
|
* @returns Structured error information from appropriate extractor
|
|
29
28
|
*
|
|
30
29
|
* @example
|
|
31
30
|
* ```typescript
|
|
32
|
-
* //
|
|
33
|
-
* const result1 = autoDetectAndExtract(
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
* const result3 = autoDetectAndExtract('Check', vitestOutput);
|
|
42
|
-
* // Uses extractVitestErrors
|
|
31
|
+
* // Legacy usage (string)
|
|
32
|
+
* const result1 = autoDetectAndExtract(tscOutput);
|
|
33
|
+
*
|
|
34
|
+
* // New usage (separated streams)
|
|
35
|
+
* const result2 = autoDetectAndExtract({
|
|
36
|
+
* stdout: stdoutString,
|
|
37
|
+
* stderr: stderrString,
|
|
38
|
+
* combined: combinedString
|
|
39
|
+
* });
|
|
43
40
|
* ```
|
|
44
41
|
*/
|
|
45
|
-
export declare function autoDetectAndExtract(
|
|
42
|
+
export declare function autoDetectAndExtract(input: string | ExtractorInput): ErrorExtractorResult;
|
|
46
43
|
//# sourceMappingURL=smart-extractor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"smart-extractor.d.ts","sourceRoot":"","sources":["../src/smart-extractor.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"smart-extractor.d.ts","sourceRoot":"","sources":["../src/smart-extractor.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAYvE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,cAAc,GAAG,oBAAoB,CAmKzF"}
|