@vibe-validate/extractors 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/README.md +121 -0
- package/dist/eslint-extractor.d.ts +25 -0
- package/dist/eslint-extractor.d.ts.map +1 -0
- package/dist/eslint-extractor.js +143 -0
- package/dist/eslint-extractor.js.map +1 -0
- package/dist/generic-extractor.d.ts +29 -0
- package/dist/generic-extractor.d.ts.map +1 -0
- package/dist/generic-extractor.js +51 -0
- package/dist/generic-extractor.js.map +1 -0
- package/dist/index.d.ts +34 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +36 -0
- package/dist/index.js.map +1 -0
- package/dist/openapi-extractor.d.ts +25 -0
- package/dist/openapi-extractor.d.ts.map +1 -0
- package/dist/openapi-extractor.js +37 -0
- package/dist/openapi-extractor.js.map +1 -0
- package/dist/smart-extractor.d.ts +33 -0
- package/dist/smart-extractor.d.ts.map +1 -0
- package/dist/smart-extractor.js +52 -0
- package/dist/smart-extractor.js.map +1 -0
- package/dist/types.d.ts +54 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +9 -0
- package/dist/types.js.map +1 -0
- package/dist/typescript-extractor.d.ts +25 -0
- package/dist/typescript-extractor.d.ts.map +1 -0
- package/dist/typescript-extractor.js +93 -0
- package/dist/typescript-extractor.js.map +1 -0
- package/dist/utils.d.ts +39 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +64 -0
- package/dist/utils.js.map +1 -0
- package/dist/vitest-extractor.d.ts +30 -0
- package/dist/vitest-extractor.d.ts.map +1 -0
- package/dist/vitest-extractor.js +245 -0
- package/dist/vitest-extractor.js.map +1 -0
- package/package.json +58 -0
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error Extractor Types
|
|
3
|
+
*
|
|
4
|
+
* Type definitions for LLM-optimized error extraction.
|
|
5
|
+
*
|
|
6
|
+
* @package @vibe-validate/extractors
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Structured error information extracted from validation output
|
|
10
|
+
*/
|
|
11
|
+
export interface FormattedError {
|
|
12
|
+
/** File path where the error occurred */
|
|
13
|
+
file: string;
|
|
14
|
+
/** Line number (1-indexed) */
|
|
15
|
+
line?: number;
|
|
16
|
+
/** Column number (1-indexed) */
|
|
17
|
+
column?: number;
|
|
18
|
+
/** Error message */
|
|
19
|
+
message: string;
|
|
20
|
+
/** Error code (e.g., TS2322, ESLint rule name) */
|
|
21
|
+
code?: string;
|
|
22
|
+
/** Severity level */
|
|
23
|
+
severity?: 'error' | 'warning';
|
|
24
|
+
/** Additional context (surrounding code, stack trace excerpt) */
|
|
25
|
+
context?: string;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Result of error extraction operation
|
|
29
|
+
*/
|
|
30
|
+
export interface ErrorExtractorResult {
|
|
31
|
+
/** Parsed and structured errors (limited to first 10 for token efficiency) */
|
|
32
|
+
errors: FormattedError[];
|
|
33
|
+
/** Human-readable summary (e.g., "3 type errors, 2 warnings") */
|
|
34
|
+
summary: string;
|
|
35
|
+
/** Total error count (may exceed errors.length if truncated) */
|
|
36
|
+
totalCount: number;
|
|
37
|
+
/** Step-specific actionable guidance for fixing errors */
|
|
38
|
+
guidance?: string;
|
|
39
|
+
/** Clean, formatted output for YAML/JSON embedding */
|
|
40
|
+
cleanOutput: string;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Error extractor interface for specific tool/format
|
|
44
|
+
*/
|
|
45
|
+
export interface ErrorExtractor {
|
|
46
|
+
/**
|
|
47
|
+
* Format tool-specific error output into structured result
|
|
48
|
+
*
|
|
49
|
+
* @param _output - Raw command output (may include ANSI codes, noise)
|
|
50
|
+
* @returns Structured error information optimized for LLM consumption
|
|
51
|
+
*/
|
|
52
|
+
format(_output: string): ErrorExtractorResult;
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,yCAAyC;IACzC,IAAI,EAAE,MAAM,CAAC;IAEb,8BAA8B;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,gCAAgC;IAChC,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,oBAAoB;IACpB,OAAO,EAAE,MAAM,CAAC;IAEhB,kDAAkD;IAClD,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,qBAAqB;IACrB,QAAQ,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAE/B,iEAAiE;IACjE,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,8EAA8E;IAC9E,MAAM,EAAE,cAAc,EAAE,CAAC;IAEzB,iEAAiE;IACjE,OAAO,EAAE,MAAM,CAAC;IAEhB,gEAAgE;IAChE,UAAU,EAAE,MAAM,CAAC;IAEnB,0DAA0D;IAC1D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,sDAAsD;IACtD,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B;;;;;OAKG;IACH,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,oBAAoB,CAAC;CAC/C"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TypeScript Error Extractor
|
|
3
|
+
*
|
|
4
|
+
* Parses and formats TypeScript compiler (tsc) error output for LLM consumption.
|
|
5
|
+
*
|
|
6
|
+
* @package @vibe-validate/extractors
|
|
7
|
+
*/
|
|
8
|
+
import type { ErrorExtractorResult } from './types.js';
|
|
9
|
+
/**
|
|
10
|
+
* Format TypeScript compiler errors
|
|
11
|
+
*
|
|
12
|
+
* Parses tsc output format: `file(line,col): error TSxxxx: message`
|
|
13
|
+
*
|
|
14
|
+
* @param output - Raw tsc command output
|
|
15
|
+
* @returns Structured error information with TypeScript-specific guidance
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* const result = extractTypeScriptErrors(tscOutput);
|
|
20
|
+
* console.log(result.summary); // "3 type error(s), 0 warning(s)"
|
|
21
|
+
* console.log(result.guidance); // "Type mismatch - check variable/parameter types"
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export declare function extractTypeScriptErrors(output: string): ErrorExtractorResult;
|
|
25
|
+
//# sourceMappingURL=typescript-extractor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typescript-extractor.d.ts","sourceRoot":"","sources":["../src/typescript-extractor.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAkB,MAAM,YAAY,CAAC;AAEvE;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,MAAM,GAAG,oBAAoB,CAoD5E"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TypeScript Error Extractor
|
|
3
|
+
*
|
|
4
|
+
* Parses and formats TypeScript compiler (tsc) error output for LLM consumption.
|
|
5
|
+
*
|
|
6
|
+
* @package @vibe-validate/extractors
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Format TypeScript compiler errors
|
|
10
|
+
*
|
|
11
|
+
* Parses tsc output format: `file(line,col): error TSxxxx: message`
|
|
12
|
+
*
|
|
13
|
+
* @param output - Raw tsc command output
|
|
14
|
+
* @returns Structured error information with TypeScript-specific guidance
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* const result = extractTypeScriptErrors(tscOutput);
|
|
19
|
+
* console.log(result.summary); // "3 type error(s), 0 warning(s)"
|
|
20
|
+
* console.log(result.guidance); // "Type mismatch - check variable/parameter types"
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export function extractTypeScriptErrors(output) {
|
|
24
|
+
const errors = [];
|
|
25
|
+
// TypeScript error patterns - support both old and new formats:
|
|
26
|
+
// Old: file(line,col): error TSxxxx: message
|
|
27
|
+
// New: file:line:col - error TSxxxx: message
|
|
28
|
+
const oldPattern = /^(.+?)\((\d+),(\d+)\):\s*(error|warning)\s+(TS\d+):\s+(.+)$/gm;
|
|
29
|
+
const newPattern = /^(.+?):(\d+):(\d+)\s+-\s*(error|warning)\s+(TS\d+):\s+(.+)$/gm;
|
|
30
|
+
// Try new format first (more common in modern tsc)
|
|
31
|
+
let match;
|
|
32
|
+
while ((match = newPattern.exec(output)) !== null) {
|
|
33
|
+
errors.push({
|
|
34
|
+
file: match[1].trim(),
|
|
35
|
+
line: parseInt(match[2]),
|
|
36
|
+
column: parseInt(match[3]),
|
|
37
|
+
severity: match[4],
|
|
38
|
+
code: match[5],
|
|
39
|
+
message: match[6].trim()
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
// Try old format if no matches yet
|
|
43
|
+
if (errors.length === 0) {
|
|
44
|
+
while ((match = oldPattern.exec(output)) !== null) {
|
|
45
|
+
errors.push({
|
|
46
|
+
file: match[1].trim(),
|
|
47
|
+
line: parseInt(match[2]),
|
|
48
|
+
column: parseInt(match[3]),
|
|
49
|
+
severity: match[4],
|
|
50
|
+
code: match[5],
|
|
51
|
+
message: match[6].trim()
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
const errorCount = errors.filter(e => e.severity === 'error').length;
|
|
56
|
+
const warningCount = errors.filter(e => e.severity === 'warning').length;
|
|
57
|
+
// Build clean output (limit to first 10 for token efficiency)
|
|
58
|
+
const cleanOutput = errors
|
|
59
|
+
.slice(0, 10)
|
|
60
|
+
.map(e => `${e.file}:${e.line}:${e.column} - ${e.code}: ${e.message}`)
|
|
61
|
+
.join('\n');
|
|
62
|
+
return {
|
|
63
|
+
errors: errors.slice(0, 10),
|
|
64
|
+
summary: `${errorCount} type error(s), ${warningCount} warning(s)`,
|
|
65
|
+
totalCount: errors.length,
|
|
66
|
+
guidance: getTypeScriptGuidance(errors),
|
|
67
|
+
cleanOutput
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Generate TypeScript-specific guidance based on error codes
|
|
72
|
+
*
|
|
73
|
+
* @param errors - Parsed TypeScript errors
|
|
74
|
+
* @returns Actionable guidance string
|
|
75
|
+
*/
|
|
76
|
+
function getTypeScriptGuidance(errors) {
|
|
77
|
+
const errorCodes = new Set(errors.map(e => e.code));
|
|
78
|
+
const guidance = [];
|
|
79
|
+
if (errorCodes.has('TS2322')) {
|
|
80
|
+
guidance.push('Type mismatch - check variable/parameter types');
|
|
81
|
+
}
|
|
82
|
+
if (errorCodes.has('TS2304')) {
|
|
83
|
+
guidance.push('Cannot find name - check imports and type definitions');
|
|
84
|
+
}
|
|
85
|
+
if (errorCodes.has('TS2345')) {
|
|
86
|
+
guidance.push('Argument type mismatch - check function signatures');
|
|
87
|
+
}
|
|
88
|
+
if (guidance.length === 0) {
|
|
89
|
+
return 'Fix TypeScript type errors in listed files';
|
|
90
|
+
}
|
|
91
|
+
return guidance.join('. ');
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=typescript-extractor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typescript-extractor.js","sourceRoot":"","sources":["../src/typescript-extractor.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,uBAAuB,CAAC,MAAc;IACpD,MAAM,MAAM,GAAqB,EAAE,CAAC;IAEpC,g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,CAAC;IAED,IAAI,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC7B,QAAQ,CAAC,IAAI,CAAC,oDAAoD,CAAC,CAAC;IACtE,CAAC;IAED,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC1B,OAAO,4CAA4C,CAAC;IACtD,CAAC;IAED,OAAO,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC7B,CAAC"}
|
package/dist/utils.d.ts
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Extractor Utilities
|
|
3
|
+
*
|
|
4
|
+
* Shared utility functions for error extraction.
|
|
5
|
+
*
|
|
6
|
+
* @package @vibe-validate/extractors
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Remove ANSI color codes from text
|
|
10
|
+
*
|
|
11
|
+
* @param text - Text potentially containing ANSI escape sequences
|
|
12
|
+
* @returns Clean text without color codes
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```typescript
|
|
16
|
+
* const clean = stripAnsiCodes('\x1b[31mError\x1b[0m');
|
|
17
|
+
* console.log(clean); // "Error"
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export declare function stripAnsiCodes(text: string): string;
|
|
21
|
+
/**
|
|
22
|
+
* Extract error lines from output (filter out noise)
|
|
23
|
+
*
|
|
24
|
+
* Filters to lines that contain error indicators while removing:
|
|
25
|
+
* - Empty lines
|
|
26
|
+
* - npm script headers
|
|
27
|
+
* - npm error prefixes
|
|
28
|
+
*
|
|
29
|
+
* @param output - Raw command output
|
|
30
|
+
* @returns Array of relevant error lines
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```typescript
|
|
34
|
+
* const errors = extractErrorLines(commandOutput);
|
|
35
|
+
* console.log(errors); // ["file.ts:10:5 - error TS2322: Type mismatch"]
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
export declare function extractErrorLines(output: string): string[];
|
|
39
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;;;;;;;GAWG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAGnD;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAuB1D"}
|
package/dist/utils.js
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Extractor Utilities
|
|
3
|
+
*
|
|
4
|
+
* Shared utility functions for error extraction.
|
|
5
|
+
*
|
|
6
|
+
* @package @vibe-validate/extractors
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Remove ANSI color codes from text
|
|
10
|
+
*
|
|
11
|
+
* @param text - Text potentially containing ANSI escape sequences
|
|
12
|
+
* @returns Clean text without color codes
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```typescript
|
|
16
|
+
* const clean = stripAnsiCodes('\x1b[31mError\x1b[0m');
|
|
17
|
+
* console.log(clean); // "Error"
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export function stripAnsiCodes(text) {
|
|
21
|
+
// eslint-disable-next-line no-control-regex
|
|
22
|
+
return text.replace(/\x1b\[[0-9;]*m/g, '');
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Extract error lines from output (filter out noise)
|
|
26
|
+
*
|
|
27
|
+
* Filters to lines that contain error indicators while removing:
|
|
28
|
+
* - Empty lines
|
|
29
|
+
* - npm script headers
|
|
30
|
+
* - npm error prefixes
|
|
31
|
+
*
|
|
32
|
+
* @param output - Raw command output
|
|
33
|
+
* @returns Array of relevant error lines
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```typescript
|
|
37
|
+
* const errors = extractErrorLines(commandOutput);
|
|
38
|
+
* console.log(errors); // ["file.ts:10:5 - error TS2322: Type mismatch"]
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
export function extractErrorLines(output) {
|
|
42
|
+
return output
|
|
43
|
+
.split('\n')
|
|
44
|
+
.filter(line => {
|
|
45
|
+
const trimmed = line.trim();
|
|
46
|
+
// Skip empty lines
|
|
47
|
+
if (!trimmed)
|
|
48
|
+
return false;
|
|
49
|
+
// Skip npm script headers
|
|
50
|
+
if (trimmed.startsWith('>'))
|
|
51
|
+
return false;
|
|
52
|
+
// Skip npm errors (too verbose)
|
|
53
|
+
if (trimmed.includes('npm ERR!'))
|
|
54
|
+
return false;
|
|
55
|
+
// Keep error/warning lines
|
|
56
|
+
return trimmed.includes('error') ||
|
|
57
|
+
trimmed.includes('Error') ||
|
|
58
|
+
trimmed.includes('warning') ||
|
|
59
|
+
trimmed.includes('FAIL') ||
|
|
60
|
+
trimmed.includes('✗') ||
|
|
61
|
+
trimmed.includes('❯');
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,cAAc,CAAC,IAAY;IACzC,4CAA4C;IAC5C,OAAO,IAAI,CAAC,OAAO,CAAC,iBAAiB,EAAE,EAAE,CAAC,CAAC;AAC7C,CAAC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,iBAAiB,CAAC,MAAc;IAC9C,OAAO,MAAM;SACV,KAAK,CAAC,IAAI,CAAC;SACX,MAAM,CAAC,IAAI,CAAC,EAAE;QACb,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;QAE5B,mBAAmB;QACnB,IAAI,CAAC,OAAO;YAAE,OAAO,KAAK,CAAC;QAE3B,0BAA0B;QAC1B,IAAI,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC;YAAE,OAAO,KAAK,CAAC;QAE1C,gCAAgC;QAChC,IAAI,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC;YAAE,OAAO,KAAK,CAAC;QAE/C,2BAA2B;QAC3B,OAAO,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC;YACzB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC;YACzB,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC;YAC3B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC;YACxB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC;YACrB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;IAC/B,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vitest/Jest Error Extractor
|
|
3
|
+
*
|
|
4
|
+
* Parses and formats Vitest (and Jest) test failure output for LLM consumption.
|
|
5
|
+
*
|
|
6
|
+
* @package @vibe-validate/extractors
|
|
7
|
+
*/
|
|
8
|
+
import type { ErrorExtractorResult } from './types.js';
|
|
9
|
+
/**
|
|
10
|
+
* Format Vitest test failures
|
|
11
|
+
*
|
|
12
|
+
* Extracts:
|
|
13
|
+
* - Test file and location (file:line:column)
|
|
14
|
+
* - Test hierarchy (describe blocks > test name)
|
|
15
|
+
* - Assertion error message
|
|
16
|
+
* - Source code line that failed
|
|
17
|
+
* - Expected vs actual values (when available)
|
|
18
|
+
*
|
|
19
|
+
* @param output - Raw Vitest/Jest command output
|
|
20
|
+
* @returns Structured error information with test-specific guidance
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```typescript
|
|
24
|
+
* const result = extractVitestErrors(vitestOutput);
|
|
25
|
+
* console.log(result.summary); // "3 test failure(s)"
|
|
26
|
+
* console.log(result.guidance); // "Fix each failing test individually..."
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export declare function extractVitestErrors(output: string): ErrorExtractorResult;
|
|
30
|
+
//# sourceMappingURL=vitest-extractor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vitest-extractor.d.ts","sourceRoot":"","sources":["../src/vitest-extractor.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AA8CvD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,oBAAoB,CAkMxE"}
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vitest/Jest Error Extractor
|
|
3
|
+
*
|
|
4
|
+
* Parses and formats Vitest (and Jest) test failure output for LLM consumption.
|
|
5
|
+
*
|
|
6
|
+
* @package @vibe-validate/extractors
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Extract runtime errors (Unhandled Rejection, ENOENT, etc.)
|
|
10
|
+
*
|
|
11
|
+
* @param output - Full test output
|
|
12
|
+
* @returns Test failure object if runtime error found
|
|
13
|
+
*/
|
|
14
|
+
function extractRuntimeError(output) {
|
|
15
|
+
// Look for "Unhandled Rejection" section
|
|
16
|
+
const unhandledMatch = output.match(/⎯+\s*Unhandled Rejection\s*⎯+\s*\n\s*(Error:[^\n]+(?:\n\s*[^\n❯⎯]+)?)/);
|
|
17
|
+
if (!unhandledMatch) {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
// Error message may span multiple lines (e.g., path on next line)
|
|
21
|
+
const errorMessage = unhandledMatch[1].trim().replace(/\n\s+/g, ' ');
|
|
22
|
+
// Extract location from stack trace (❯ function file:line:col)
|
|
23
|
+
// File path may contain colons (e.g., node:internal/fs/promises), so match ❯ function filepath:number:number
|
|
24
|
+
const locationMatch = output.match(/❯\s+\S+\s+([\w:/.]+):(\d+):(\d+)/);
|
|
25
|
+
let file = 'unknown';
|
|
26
|
+
let location = '';
|
|
27
|
+
if (locationMatch) {
|
|
28
|
+
file = locationMatch[1];
|
|
29
|
+
location = `${locationMatch[1]}:${locationMatch[2]}:${locationMatch[3]}`;
|
|
30
|
+
}
|
|
31
|
+
return {
|
|
32
|
+
file,
|
|
33
|
+
location,
|
|
34
|
+
testHierarchy: 'Runtime Error',
|
|
35
|
+
errorMessage,
|
|
36
|
+
sourceLine: ''
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Format Vitest test failures
|
|
41
|
+
*
|
|
42
|
+
* Extracts:
|
|
43
|
+
* - Test file and location (file:line:column)
|
|
44
|
+
* - Test hierarchy (describe blocks > test name)
|
|
45
|
+
* - Assertion error message
|
|
46
|
+
* - Source code line that failed
|
|
47
|
+
* - Expected vs actual values (when available)
|
|
48
|
+
*
|
|
49
|
+
* @param output - Raw Vitest/Jest command output
|
|
50
|
+
* @returns Structured error information with test-specific guidance
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* ```typescript
|
|
54
|
+
* const result = extractVitestErrors(vitestOutput);
|
|
55
|
+
* console.log(result.summary); // "3 test failure(s)"
|
|
56
|
+
* console.log(result.guidance); // "Fix each failing test individually..."
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
export function extractVitestErrors(output) {
|
|
60
|
+
const lines = output.split('\n');
|
|
61
|
+
const failures = [];
|
|
62
|
+
let currentFailure = null;
|
|
63
|
+
// First, check for runtime errors (Unhandled Rejection, ENOENT, etc.)
|
|
64
|
+
const runtimeError = extractRuntimeError(output);
|
|
65
|
+
if (runtimeError) {
|
|
66
|
+
failures.push(runtimeError);
|
|
67
|
+
}
|
|
68
|
+
for (let i = 0; i < lines.length; i++) {
|
|
69
|
+
const line = lines[i];
|
|
70
|
+
// Match: FAIL test/unit/config/environment.test.ts > EnvironmentConfig > test name
|
|
71
|
+
// OR: ❌ packages/core/test/runner.test.ts > ValidationRunner > test name
|
|
72
|
+
// OR: × packages/cli/test/commands/validate.test.ts > validate command > test name
|
|
73
|
+
const failLineMatch = line.match(/(?:FAIL|❌|×)\s+([^\s]+\.test\.ts)\s*>\s*(.+)/);
|
|
74
|
+
if (failLineMatch) {
|
|
75
|
+
if (currentFailure && currentFailure.file) {
|
|
76
|
+
failures.push(currentFailure);
|
|
77
|
+
}
|
|
78
|
+
currentFailure = {
|
|
79
|
+
file: failLineMatch[1],
|
|
80
|
+
testHierarchy: failLineMatch[2].trim(),
|
|
81
|
+
errorMessage: '',
|
|
82
|
+
sourceLine: '',
|
|
83
|
+
location: ''
|
|
84
|
+
};
|
|
85
|
+
continue;
|
|
86
|
+
}
|
|
87
|
+
// Match: AssertionError: expected 3000 to be 9999 // Object.is equality
|
|
88
|
+
// OR: Error: Test timed out in 5000ms.
|
|
89
|
+
// OR: Snapshot `name` mismatched
|
|
90
|
+
if (currentFailure && !currentFailure.errorMessage) {
|
|
91
|
+
// Check for standard error patterns
|
|
92
|
+
const errorMatch = line.match(/((?:AssertionError|Error):\s*.+)/);
|
|
93
|
+
// Check for snapshot failures (doesn't have "Error:" prefix)
|
|
94
|
+
const snapshotMatch = line.match(/Snapshot\s+`([^`]+)`\s+mismatched/);
|
|
95
|
+
if (errorMatch || snapshotMatch) {
|
|
96
|
+
// Keep the full error including the type (AssertionError: ...)
|
|
97
|
+
let errorMessage = errorMatch ? errorMatch[1].trim() : line.trim();
|
|
98
|
+
const isSnapshotError = !!snapshotMatch;
|
|
99
|
+
// Capture additional lines (e.g., timeout guidance, long error messages, snapshot diffs)
|
|
100
|
+
// For snapshot errors: continue through blank lines until stack trace (no line limit)
|
|
101
|
+
// For other errors: stop at blank lines OR after 5 continuation lines (prevent verbose object dumps)
|
|
102
|
+
const MAX_CONTINUATION_LINES = 5;
|
|
103
|
+
let j = i + 1;
|
|
104
|
+
let linesConsumed = 0;
|
|
105
|
+
while (j < lines.length) {
|
|
106
|
+
const nextLine = lines[j].trim();
|
|
107
|
+
// Always stop at these markers
|
|
108
|
+
if (nextLine.startsWith('❯') || nextLine.match(/^\d+\|/) || nextLine.startsWith('FAIL') || nextLine.startsWith('✓') || nextLine.startsWith('❌') || nextLine.startsWith('×') || nextLine.startsWith('⎯')) {
|
|
109
|
+
break;
|
|
110
|
+
}
|
|
111
|
+
// Stop at stack trace (starts with "at ")
|
|
112
|
+
if (nextLine.startsWith('at ')) {
|
|
113
|
+
break;
|
|
114
|
+
}
|
|
115
|
+
// For non-snapshot errors, limit continuation lines to prevent massive object dumps
|
|
116
|
+
if (!isSnapshotError && linesConsumed >= MAX_CONTINUATION_LINES) {
|
|
117
|
+
if (nextLine) {
|
|
118
|
+
errorMessage += ' ...(truncated)';
|
|
119
|
+
}
|
|
120
|
+
break;
|
|
121
|
+
}
|
|
122
|
+
// For non-snapshot errors, stop at blank lines
|
|
123
|
+
// For snapshot errors, continue through blank lines to capture diff
|
|
124
|
+
if (!nextLine && !isSnapshotError) {
|
|
125
|
+
break;
|
|
126
|
+
}
|
|
127
|
+
// Add line to error message
|
|
128
|
+
// For snapshots: preserve formatting with newlines and indentation
|
|
129
|
+
// For other errors: join with spaces for compact output
|
|
130
|
+
if (nextLine || isSnapshotError) {
|
|
131
|
+
if (isSnapshotError) {
|
|
132
|
+
errorMessage += '\n' + lines[j]; // Preserve indentation for diffs
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
errorMessage += ' ' + nextLine; // Compact for normal errors
|
|
136
|
+
linesConsumed++;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
j++;
|
|
140
|
+
}
|
|
141
|
+
currentFailure.errorMessage = errorMessage;
|
|
142
|
+
i = j - 1; // Skip the lines we just consumed
|
|
143
|
+
}
|
|
144
|
+
continue;
|
|
145
|
+
}
|
|
146
|
+
// Match: ❯ test/unit/config/environment.test.ts:57:30
|
|
147
|
+
// OR stack trace: at Object.<anonymous> (packages/core/test/runner.test.ts:45:12)
|
|
148
|
+
if (currentFailure && !currentFailure.location) {
|
|
149
|
+
// Try vitest location marker first
|
|
150
|
+
const vitestLocation = line.match(/❯\s*(.+\.test\.ts):(\d+):(\d+)/);
|
|
151
|
+
if (vitestLocation) {
|
|
152
|
+
currentFailure.location = `${vitestLocation[1]}:${vitestLocation[2]}:${vitestLocation[3]}`;
|
|
153
|
+
continue;
|
|
154
|
+
}
|
|
155
|
+
// Try stack trace pattern
|
|
156
|
+
const stackLocation = line.match(/at\s+.+\(([^\s]+\.test\.ts):(\d+):(\d+)\)/);
|
|
157
|
+
if (stackLocation) {
|
|
158
|
+
currentFailure.location = `${stackLocation[1]}:${stackLocation[2]}:${stackLocation[3]}`;
|
|
159
|
+
continue;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
// Match source line: 57| expect(config.HTTP_PORT).toBe(9999);
|
|
163
|
+
if (currentFailure && line.match(/^\s*\d+\|\s+/)) {
|
|
164
|
+
const sourceMatch = line.match(/^\s*(\d+)\|\s*(.+)/);
|
|
165
|
+
if (sourceMatch) {
|
|
166
|
+
currentFailure.sourceLine = `${sourceMatch[1]}| ${sourceMatch[2].trim()}`;
|
|
167
|
+
}
|
|
168
|
+
continue;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
// Add last failure
|
|
172
|
+
if (currentFailure && currentFailure.file) {
|
|
173
|
+
failures.push(currentFailure);
|
|
174
|
+
}
|
|
175
|
+
// Extract expected/actual values if present in output
|
|
176
|
+
const { expected, actual } = extractExpectedActual(output);
|
|
177
|
+
// Format output with all extracted information + LLM guidance
|
|
178
|
+
const cleanOutput = failures
|
|
179
|
+
.slice(0, 10)
|
|
180
|
+
.map((f, idx) => {
|
|
181
|
+
const parts = [
|
|
182
|
+
`[Test ${idx + 1}/${failures.length}] ${f.location || f.file}`,
|
|
183
|
+
'',
|
|
184
|
+
`Test: ${f.testHierarchy}`,
|
|
185
|
+
`Error: ${f.errorMessage}`,
|
|
186
|
+
];
|
|
187
|
+
if (expected && actual) {
|
|
188
|
+
parts.push(`Expected: ${expected}`, `Actual: ${actual}`);
|
|
189
|
+
}
|
|
190
|
+
if (f.sourceLine) {
|
|
191
|
+
parts.push('', f.sourceLine);
|
|
192
|
+
}
|
|
193
|
+
return parts.filter(p => p).join('\n');
|
|
194
|
+
})
|
|
195
|
+
.join('\n\n');
|
|
196
|
+
// Enhanced LLM-friendly guidance
|
|
197
|
+
let guidance = `${failures.length} test(s) failed. `;
|
|
198
|
+
if (failures.length === 1) {
|
|
199
|
+
guidance += 'Fix the assertion in the test file at the location shown. ';
|
|
200
|
+
if (expected && actual) {
|
|
201
|
+
guidance += `The test expected "${expected}" but got "${actual}". `;
|
|
202
|
+
}
|
|
203
|
+
guidance += 'Run: npm test -- <test-file> to verify the fix.';
|
|
204
|
+
}
|
|
205
|
+
else {
|
|
206
|
+
guidance += 'Fix each failing test individually. Run: npm test -- <test-file> to test each file.';
|
|
207
|
+
}
|
|
208
|
+
return {
|
|
209
|
+
errors: failures.slice(0, 10).map(f => {
|
|
210
|
+
// Parse line:column from end of location string (file paths may contain colons)
|
|
211
|
+
let line;
|
|
212
|
+
let column;
|
|
213
|
+
if (f.location) {
|
|
214
|
+
const parts = f.location.split(':');
|
|
215
|
+
column = parseInt(parts.pop() || '');
|
|
216
|
+
line = parseInt(parts.pop() || '');
|
|
217
|
+
}
|
|
218
|
+
return {
|
|
219
|
+
file: f.file,
|
|
220
|
+
line: line !== undefined && !isNaN(line) ? line : undefined,
|
|
221
|
+
column: column !== undefined && !isNaN(column) ? column : undefined,
|
|
222
|
+
message: f.errorMessage || `Test failure: ${f.testHierarchy}`
|
|
223
|
+
};
|
|
224
|
+
}),
|
|
225
|
+
summary: `${failures.length} test failure(s)`,
|
|
226
|
+
totalCount: failures.length,
|
|
227
|
+
guidance,
|
|
228
|
+
cleanOutput
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Extract expected/actual values from test output
|
|
233
|
+
*
|
|
234
|
+
* @param output - Full test output
|
|
235
|
+
* @returns Expected and actual values (if found)
|
|
236
|
+
*/
|
|
237
|
+
function extractExpectedActual(fullOutput) {
|
|
238
|
+
const expectedMatch = fullOutput.match(/- Expected[^\n]*\n[^\n]*\n- (.+)/);
|
|
239
|
+
const actualMatch = fullOutput.match(/\+ Received[^\n]*\n[^\n]*\n\+ (.+)/);
|
|
240
|
+
return {
|
|
241
|
+
expected: expectedMatch ? expectedMatch[1].trim() : undefined,
|
|
242
|
+
actual: actualMatch ? actualMatch[1].trim() : undefined
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
//# sourceMappingURL=vitest-extractor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vitest-extractor.js","sourceRoot":"","sources":["../src/vitest-extractor.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAYH;;;;;GAKG;AACH,SAAS,mBAAmB,CAAC,MAAc;IACzC,yCAAyC;IACzC,MAAM,cAAc,GAAG,MAAM,CAAC,KAAK,CAAC,uEAAuE,CAAC,CAAC;IAC7G,IAAI,CAAC,cAAc,EAAE,CAAC;QACpB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,kEAAkE;IAClE,MAAM,YAAY,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;IAErE,+DAA+D;IAC/D,6GAA6G;IAC7G,MAAM,aAAa,GAAG,MAAM,CAAC,KAAK,CAAC,kCAAkC,CAAC,CAAC;IACvE,IAAI,IAAI,GAAG,SAAS,CAAC;IACrB,IAAI,QAAQ,GAAG,EAAE,CAAC;IAElB,IAAI,aAAa,EAAE,CAAC;QAClB,IAAI,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC;QACxB,QAAQ,GAAG,GAAG,aAAa,CAAC,CAAC,CAAC,IAAI,aAAa,CAAC,CAAC,CAAC,IAAI,aAAa,CAAC,CAAC,CAAC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,OAAO;gBACL,IAAI,EAAE,CAAC,CAAC,IAAI;gBACZ,IAAI,EAAE,IAAI,KAAK,SAAS,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS;gBAC3D,MAAM,EAAE,MAAM,KAAK,SAAS,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS;gBACnE,OAAO,EAAE,CAAC,CAAC,YAAY,IAAI,iBAAiB,CAAC,CAAC,aAAa,EAAE;aAC9D,CAAC;QACJ,CAAC,CAAC;QACF,OAAO,EAAE,GAAG,QAAQ,CAAC,MAAM,kBAAkB;QAC7C,UAAU,EAAE,QAAQ,CAAC,MAAM;QAC3B,QAAQ;QACR,WAAW;KACZ,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,SAAS,qBAAqB,CAAC,UAAkB;IAC/C,MAAM,aAAa,GAAG,UAAU,CAAC,KAAK,CAAC,kCAAkC,CAAC,CAAC;IAC3E,MAAM,WAAW,GAAG,UAAU,CAAC,KAAK,CAAC,oCAAoC,CAAC,CAAC;IAC3E,OAAO;QACL,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,SAAS;QAC7D,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,SAAS;KACxD,CAAC;AACJ,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@vibe-validate/extractors",
|
|
3
|
+
"version": "0.12.0",
|
|
4
|
+
"description": "LLM-optimized error extractors for validation output",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist"
|
|
16
|
+
],
|
|
17
|
+
"scripts": {
|
|
18
|
+
"build": "tsc",
|
|
19
|
+
"clean": "rm -rf dist",
|
|
20
|
+
"test": "vitest run",
|
|
21
|
+
"test:watch": "vitest",
|
|
22
|
+
"test:report": "tsx test/generate-quality-report.ts",
|
|
23
|
+
"test:regression": "tsx test/generate-quality-report.ts --check"
|
|
24
|
+
},
|
|
25
|
+
"keywords": [
|
|
26
|
+
"validation",
|
|
27
|
+
"error-extraction",
|
|
28
|
+
"llm-friendly",
|
|
29
|
+
"typescript",
|
|
30
|
+
"eslint",
|
|
31
|
+
"vitest",
|
|
32
|
+
"openapi"
|
|
33
|
+
],
|
|
34
|
+
"author": "Jeff Dutton",
|
|
35
|
+
"license": "MIT",
|
|
36
|
+
"repository": {
|
|
37
|
+
"type": "git",
|
|
38
|
+
"url": "git+https://github.com/jdutton/vibe-validate.git",
|
|
39
|
+
"directory": "packages/extractors"
|
|
40
|
+
},
|
|
41
|
+
"dependencies": {
|
|
42
|
+
"yaml": "^2.6.1"
|
|
43
|
+
},
|
|
44
|
+
"devDependencies": {
|
|
45
|
+
"@types/node": "^20.19.21",
|
|
46
|
+
"ajv": "^8.17.1",
|
|
47
|
+
"ajv-formats": "^3.0.1",
|
|
48
|
+
"tsx": "^4.20.6",
|
|
49
|
+
"typescript": "^5.7.3",
|
|
50
|
+
"vitest": "^3.2.4"
|
|
51
|
+
},
|
|
52
|
+
"engines": {
|
|
53
|
+
"node": ">=20.0.0"
|
|
54
|
+
},
|
|
55
|
+
"publishConfig": {
|
|
56
|
+
"access": "public"
|
|
57
|
+
}
|
|
58
|
+
}
|