@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
package/dist/smart-extractor.js
CHANGED
|
@@ -18,7 +18,7 @@ import { stripAnsiCodes } from './utils.js';
|
|
|
18
18
|
/**
|
|
19
19
|
* Auto-detect tool type from output patterns and extract errors
|
|
20
20
|
*
|
|
21
|
-
* Detection is 100% pattern-based
|
|
21
|
+
* Detection is 100% pattern-based from output analysis only.
|
|
22
22
|
* This ensures robust detection regardless of how users name their validation steps.
|
|
23
23
|
*
|
|
24
24
|
* Auto-detection rules (checked in order):
|
|
@@ -26,32 +26,34 @@ import { stripAnsiCodes } from './utils.js';
|
|
|
26
26
|
* 2. **ESLint**: `✖ X problems` summary or `line:col error/warning` format
|
|
27
27
|
* 3. **JUnit XML**: `<?xml` + `<testsuite>` tags
|
|
28
28
|
* 4. **Jasmine**: `Failures:` header + numbered list (`1) test name`)
|
|
29
|
-
* 5. **
|
|
30
|
-
* 6. **
|
|
31
|
-
* 7. **
|
|
32
|
-
* 8. **Vitest**:
|
|
29
|
+
* 5. **Jest**: `●` bullets or `Test Suites:` summary (checked before Mocha)
|
|
30
|
+
* 6. **Mocha**: `X passing`/`X failing` summary + numbered list
|
|
31
|
+
* 7. **Playwright**: `.spec.ts` files + numbered failures with `›` separator
|
|
32
|
+
* 8. **Vitest**: `×`/`❯`/`❌` symbols + `Test Files` summary
|
|
33
33
|
* 9. **Generic**: Fallback for all other formats
|
|
34
34
|
*
|
|
35
|
-
* @param
|
|
36
|
-
* @param output - Raw command output (may contain ANSI color codes)
|
|
35
|
+
* @param input - Raw command output (string) or separated streams (ExtractorInput)
|
|
37
36
|
* @returns Structured error information from appropriate extractor
|
|
38
37
|
*
|
|
39
38
|
* @example
|
|
40
39
|
* ```typescript
|
|
41
|
-
* //
|
|
42
|
-
* const result1 = autoDetectAndExtract(
|
|
43
|
-
* // Uses extractTypeScriptErrors
|
|
40
|
+
* // Legacy usage (string)
|
|
41
|
+
* const result1 = autoDetectAndExtract(tscOutput);
|
|
44
42
|
*
|
|
45
|
-
* //
|
|
46
|
-
* const result2 = autoDetectAndExtract(
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
* // Uses extractVitestErrors
|
|
43
|
+
* // New usage (separated streams)
|
|
44
|
+
* const result2 = autoDetectAndExtract({
|
|
45
|
+
* stdout: stdoutString,
|
|
46
|
+
* stderr: stderrString,
|
|
47
|
+
* combined: combinedString
|
|
48
|
+
* });
|
|
52
49
|
* ```
|
|
53
50
|
*/
|
|
54
|
-
|
|
51
|
+
// eslint-disable-next-line sonarjs/cognitive-complexity -- Complexity 26 acceptable for smart extractor (sequentially detects 9 different test framework output formats with pattern matching)
|
|
52
|
+
export function autoDetectAndExtract(input) {
|
|
53
|
+
// Normalize input to string for backwards compatibility
|
|
54
|
+
// Most extractors currently use combined output, but this structure
|
|
55
|
+
// allows future extractors to be stream-specific
|
|
56
|
+
const output = typeof input === 'string' ? input : input.combined;
|
|
55
57
|
// CRITICAL: Strip ANSI codes centrally before routing to extractors
|
|
56
58
|
//
|
|
57
59
|
// Design Decision: Central stripping (DRY & fail-safe)
|
|
@@ -65,44 +67,97 @@ export function autoDetectAndExtract(context, output) {
|
|
|
65
67
|
// - Impossible to forget (enforced for all extractors)
|
|
66
68
|
// - Consistent behavior across all extraction paths
|
|
67
69
|
// - Easier to maintain and test
|
|
68
|
-
const
|
|
70
|
+
const errorSummary = stripAnsiCodes(output);
|
|
69
71
|
// TypeScript detection: Check for TypeScript compiler error patterns
|
|
70
72
|
// - "error TS####:" (error code like TS2322, TS2345)
|
|
71
73
|
// - Format: file.ts(line,col): error TS####:
|
|
72
|
-
const hasTypeScriptMarkers =
|
|
74
|
+
const hasTypeScriptMarkers = /error TS\d+:/.exec(errorSummary);
|
|
73
75
|
if (hasTypeScriptMarkers) {
|
|
74
|
-
const result = extractTypeScriptErrors(
|
|
76
|
+
const result = extractTypeScriptErrors(errorSummary);
|
|
75
77
|
return addDetectionMetadata(result, 'typescript', 95, ['error TS#### pattern'], 'TypeScript compiler error format detected');
|
|
76
78
|
}
|
|
77
79
|
// ESLint detection: Check for ESLint-specific patterns
|
|
78
80
|
// - "✖ X problem(s)" summary line
|
|
79
81
|
// - File paths with line:col followed by error/warning (with optional colon)
|
|
80
|
-
const hasESLintMarkers =
|
|
81
|
-
|
|
82
|
+
const hasESLintMarkers =
|
|
83
|
+
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing -- Boolean OR for pattern matching, not nullish check
|
|
84
|
+
/✖ \d+ problems?/.exec(errorSummary) ||
|
|
85
|
+
// eslint-disable-next-line sonarjs/slow-regex -- Safe: only detects ESLint output format (controlled linter output), limited input size
|
|
86
|
+
/\d+:\d+:?\s+(error|warning)\s+/.exec(errorSummary);
|
|
82
87
|
if (hasESLintMarkers) {
|
|
83
|
-
const result = extractESLintErrors(
|
|
88
|
+
const result = extractESLintErrors(errorSummary);
|
|
84
89
|
const patterns = [];
|
|
85
|
-
if (
|
|
90
|
+
if (/✖ \d+ problems?/.exec(errorSummary))
|
|
86
91
|
patterns.push('✖ X problems summary');
|
|
87
|
-
|
|
92
|
+
// eslint-disable-next-line sonarjs/slow-regex -- Safe: only detects ESLint output format (controlled linter output), limited input size
|
|
93
|
+
if (/\d+:\d+:?\s+(error|warning)\s+/.exec(errorSummary))
|
|
88
94
|
patterns.push('line:col error/warning format');
|
|
89
95
|
return addDetectionMetadata(result, 'eslint', 90, patterns, 'ESLint error format detected');
|
|
90
96
|
}
|
|
97
|
+
// Vitest priority detection: Check for "RUN v" pattern (100% unique to vitest)
|
|
98
|
+
// CRITICAL: Must check BEFORE Jest to prevent false positives
|
|
99
|
+
// Jest's loose ● detection can match test names that mention Jest patterns
|
|
100
|
+
// (e.g., "should detect Jest from ● bullet marker")
|
|
101
|
+
// The "RUN v" pattern at the start of vitest output is unmistakable
|
|
102
|
+
// Note: Allow optional leading whitespace (ANSI stripping can leave spaces)
|
|
103
|
+
// eslint-disable-next-line sonarjs/slow-regex -- False positive: regex is anchored and has limited repetition
|
|
104
|
+
if (/^\s*RUN\s+v\d+\.\d+\.\d+/m.test(errorSummary)) {
|
|
105
|
+
const result = extractVitestErrors(errorSummary);
|
|
106
|
+
const patterns = ['RUN v#### version header'];
|
|
107
|
+
if (errorSummary.includes('×'))
|
|
108
|
+
patterns.push('× symbol (U+00D7)');
|
|
109
|
+
if (errorSummary.includes('❌'))
|
|
110
|
+
patterns.push('❌ cross mark');
|
|
111
|
+
if (errorSummary.includes(' ❯ '))
|
|
112
|
+
patterns.push('❯ arrow marker');
|
|
113
|
+
if (errorSummary.includes('Test Files'))
|
|
114
|
+
patterns.push('Test Files summary');
|
|
115
|
+
if (errorSummary.includes('.test.ts'))
|
|
116
|
+
patterns.push('.test.ts files');
|
|
117
|
+
if (/FAIL\s+\d+\s+test\s+(file|case)/i.exec(errorSummary))
|
|
118
|
+
patterns.push('FAIL N test files/cases pattern');
|
|
119
|
+
return addDetectionMetadata(result, 'vitest', 100, patterns, 'Vitest test output format detected (RUN v#### header)');
|
|
120
|
+
}
|
|
91
121
|
// Auto-detect JUnit XML format
|
|
92
122
|
// Must have both <?xml at start of line AND <testsuite tag (not just mentioned in text)
|
|
93
|
-
if (
|
|
94
|
-
const result = extractJUnitErrors(
|
|
123
|
+
if (/^<\?xml\s+/m.exec(errorSummary) && errorSummary.includes('<testsuite')) {
|
|
124
|
+
const result = extractJUnitErrors(errorSummary);
|
|
95
125
|
return addDetectionMetadata(result, 'junit', 100, ['<?xml header', '<testsuite> tag'], 'JUnit XML format detected');
|
|
96
126
|
}
|
|
97
127
|
// Auto-detect Jasmine format (distinctive "Failures:" header)
|
|
98
|
-
if (
|
|
99
|
-
const result = extractJasmineErrors(
|
|
128
|
+
if (errorSummary.includes('Failures:') && /^\d+\)\s+/m.exec(errorSummary)) {
|
|
129
|
+
const result = extractJasmineErrors(errorSummary);
|
|
100
130
|
return addDetectionMetadata(result, 'jasmine', 85, ['Failures: header', 'numbered test list'], 'Jasmine test output format detected');
|
|
101
131
|
}
|
|
132
|
+
// Jest detection: Check output for Jest-specific patterns
|
|
133
|
+
// CRITICAL: Must check BEFORE Mocha to avoid false positives
|
|
134
|
+
// - "●" bullet marker for detailed errors (Jest-specific, Vitest uses ×)
|
|
135
|
+
// - "Test Suites:" summary line (Jest-specific, Vitest uses "Test Files")
|
|
136
|
+
// Jest patterns are highly distinctive (confidence 90) vs Mocha's generic patterns (confidence 80)
|
|
137
|
+
// Mocha's "passing"/"failing" patterns can appear in Jest test names, causing misdetection
|
|
138
|
+
const hasJestMarkers = errorSummary.includes('●') ||
|
|
139
|
+
errorSummary.includes('Test Suites:');
|
|
140
|
+
if (hasJestMarkers) {
|
|
141
|
+
const result = extractJestErrors(errorSummary);
|
|
142
|
+
const patterns = [];
|
|
143
|
+
if (errorSummary.includes('●'))
|
|
144
|
+
patterns.push('● bullet marker');
|
|
145
|
+
if (errorSummary.includes('Test Suites:'))
|
|
146
|
+
patterns.push('Test Suites: summary');
|
|
147
|
+
// eslint-disable-next-line sonarjs/slow-regex -- Safe: only detects Jest test framework output format (controlled test framework output), not user input
|
|
148
|
+
if (/^\s*FAIL\s+/m.exec(errorSummary))
|
|
149
|
+
patterns.push('FAIL marker');
|
|
150
|
+
// eslint-disable-next-line sonarjs/slow-regex -- Safe: only detects Jest test framework output format (controlled test framework output), not user input
|
|
151
|
+
if (/^\s*PASS\s+/m.exec(errorSummary))
|
|
152
|
+
patterns.push('PASS marker');
|
|
153
|
+
return addDetectionMetadata(result, 'jest', 90, patterns, 'Jest test output format detected');
|
|
154
|
+
}
|
|
102
155
|
// Auto-detect Mocha format (distinctive "X passing"/"X failing" pattern)
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
156
|
+
// NOTE: Checked AFTER Jest because "passing"/"failing" can appear in Jest test names
|
|
157
|
+
if ((errorSummary.includes(' passing') || errorSummary.includes(' failing')) &&
|
|
158
|
+
// eslint-disable-next-line sonarjs/slow-regex -- Safe: only detects Mocha test framework output format (controlled test framework output), not user input
|
|
159
|
+
/\s+\d+\)\s+/.exec(errorSummary)) {
|
|
160
|
+
const result = extractMochaErrors(errorSummary);
|
|
106
161
|
return addDetectionMetadata(result, 'mocha', 80, ['passing/failing summary', 'numbered failures'], 'Mocha test output format detected');
|
|
107
162
|
}
|
|
108
163
|
// Playwright detection: Check for Playwright-specific patterns
|
|
@@ -110,43 +165,25 @@ export function autoDetectAndExtract(context, output) {
|
|
|
110
165
|
// - Numbered failures with › separator: "1) file.spec.ts:26:5 › test name"
|
|
111
166
|
// - ✘ symbol followed by .spec.ts file path
|
|
112
167
|
// IMPORTANT: Require .spec.ts with › separator OR ✘ + .spec.ts (not just mentioned in text)
|
|
113
|
-
// Must check BEFORE
|
|
114
|
-
const hasPlaywrightMarkers = (
|
|
115
|
-
(
|
|
116
|
-
|
|
168
|
+
// Must check BEFORE Vitest to avoid misdetection (.spec.ts vs .test.ts)
|
|
169
|
+
const hasPlaywrightMarkers = (errorSummary.includes('.spec.ts') &&
|
|
170
|
+
// eslint-disable-next-line sonarjs/slow-regex, @typescript-eslint/prefer-nullish-coalescing -- Safe: only detects Playwright test framework output format (controlled test framework output), not user input. Boolean OR for pattern matching.
|
|
171
|
+
(/\d+\)\s+.*\.spec\.ts:\d+:\d+\s+›/.exec(errorSummary) ||
|
|
172
|
+
// eslint-disable-next-line sonarjs/slow-regex -- Safe: only detects Playwright test framework output format (controlled test framework output), not user input
|
|
173
|
+
/✘.*\.spec\.ts/.exec(errorSummary)));
|
|
117
174
|
if (hasPlaywrightMarkers) {
|
|
118
|
-
const result = extractPlaywrightErrors(
|
|
175
|
+
const result = extractPlaywrightErrors(errorSummary);
|
|
119
176
|
const patterns = [];
|
|
120
|
-
if (
|
|
177
|
+
if (errorSummary.includes('.spec.ts'))
|
|
121
178
|
patterns.push('.spec.ts files');
|
|
122
|
-
|
|
179
|
+
// eslint-disable-next-line sonarjs/slow-regex -- Safe: only detects Playwright test framework output format (controlled test framework output), not user input
|
|
180
|
+
if (/\d+\)\s+.*\.spec\.ts:\d+:\d+\s+›/.exec(errorSummary))
|
|
123
181
|
patterns.push('numbered failures with › separator');
|
|
124
|
-
|
|
182
|
+
// eslint-disable-next-line sonarjs/slow-regex -- Safe: only detects Playwright test framework output format (controlled test framework output), not user input
|
|
183
|
+
if (/✘.*\.spec\.ts/.exec(errorSummary))
|
|
125
184
|
patterns.push('✘ failure with .spec.ts file');
|
|
126
185
|
return addDetectionMetadata(result, 'playwright', 95, patterns, 'Playwright test output format detected');
|
|
127
186
|
}
|
|
128
|
-
// Jest detection: Check output for Jest-specific patterns FIRST (before Vitest)
|
|
129
|
-
// Jest has very distinctive markers that should be checked first to avoid misdetection
|
|
130
|
-
// - " ● " bullet marker for detailed errors (Jest-specific, Vitest uses ×)
|
|
131
|
-
// - "Test Suites:" summary line (Jest-specific, Vitest uses "Test Files")
|
|
132
|
-
// NOTE: We don't use "FAIL" alone because Vitest also uses it (e.g., "FAIL tests/...")
|
|
133
|
-
// CRITICAL: Must check BEFORE Vitest because Jest stack traces can contain ❯ symbol
|
|
134
|
-
// from source code (e.g., in comments), which would trigger Vitest detection
|
|
135
|
-
const hasJestMarkers = cleanOutput.includes(' ● ') ||
|
|
136
|
-
cleanOutput.includes('Test Suites:');
|
|
137
|
-
if (hasJestMarkers) {
|
|
138
|
-
const result = extractJestErrors(cleanOutput);
|
|
139
|
-
const patterns = [];
|
|
140
|
-
if (cleanOutput.includes(' ● '))
|
|
141
|
-
patterns.push('● bullet marker');
|
|
142
|
-
if (cleanOutput.includes('Test Suites:'))
|
|
143
|
-
patterns.push('Test Suites: summary');
|
|
144
|
-
if (cleanOutput.match(/^\s*FAIL\s+/m))
|
|
145
|
-
patterns.push('FAIL marker');
|
|
146
|
-
if (cleanOutput.match(/^\s*PASS\s+/m))
|
|
147
|
-
patterns.push('PASS marker');
|
|
148
|
-
return addDetectionMetadata(result, 'jest', 90, patterns, 'Jest test output format detected');
|
|
149
|
-
}
|
|
150
187
|
// Vitest detection: Check output for Vitest-specific patterns
|
|
151
188
|
// - "×" symbol (U+00D7 multiplication, Vitest-specific - Jest uses ✕ U+2715)
|
|
152
189
|
// - "❌" cross mark symbol (Vitest failure marker in some formats)
|
|
@@ -157,27 +194,28 @@ export function autoDetectAndExtract(context, output) {
|
|
|
157
194
|
// NOTE: Both Vitest and Jest use ✓ (check mark), so we don't check for it alone
|
|
158
195
|
// IMPORTANT: Require MULTIPLE patterns together to avoid false positives
|
|
159
196
|
// (e.g., ❯ can appear in Jest stack traces from source code comments)
|
|
160
|
-
const hasVitestMarkers = (
|
|
161
|
-
|
|
197
|
+
const hasVitestMarkers = (errorSummary.includes('×') || errorSummary.includes(' ❯ ') || errorSummary.includes('❌')) &&
|
|
198
|
+
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing -- Boolean OR for pattern matching, not nullish check
|
|
199
|
+
(errorSummary.includes('Test Files') || /FAIL\s+\d+\s+test\s+(file|case)/i.exec(errorSummary) || errorSummary.includes('.test.ts'));
|
|
162
200
|
if (hasVitestMarkers) {
|
|
163
|
-
const result = extractVitestErrors(
|
|
201
|
+
const result = extractVitestErrors(errorSummary);
|
|
164
202
|
const patterns = [];
|
|
165
|
-
if (
|
|
203
|
+
if (errorSummary.includes('×'))
|
|
166
204
|
patterns.push('× symbol (U+00D7)');
|
|
167
|
-
if (
|
|
205
|
+
if (errorSummary.includes('❌'))
|
|
168
206
|
patterns.push('❌ cross mark');
|
|
169
|
-
if (
|
|
207
|
+
if (errorSummary.includes(' ❯ '))
|
|
170
208
|
patterns.push('❯ arrow marker');
|
|
171
|
-
if (
|
|
209
|
+
if (errorSummary.includes('Test Files'))
|
|
172
210
|
patterns.push('Test Files summary');
|
|
173
|
-
if (
|
|
211
|
+
if (errorSummary.includes('.test.ts'))
|
|
174
212
|
patterns.push('.test.ts files');
|
|
175
|
-
if (
|
|
213
|
+
if (/FAIL\s+\d+\s+test\s+(file|case)/i.exec(errorSummary))
|
|
176
214
|
patterns.push('FAIL N test files/cases pattern');
|
|
177
215
|
return addDetectionMetadata(result, 'vitest', 90, patterns, 'Vitest test output format detected');
|
|
178
216
|
}
|
|
179
217
|
// No specific pattern detected - use generic extractor
|
|
180
|
-
const result = extractGenericErrors(
|
|
218
|
+
const result = extractGenericErrors(errorSummary);
|
|
181
219
|
return addDetectionMetadata(result, 'generic', 50, ['no specific patterns'], 'No specific tool detected, using generic extractor');
|
|
182
220
|
}
|
|
183
221
|
/**
|
|
@@ -219,13 +257,11 @@ export function autoDetectAndExtract(context, output) {
|
|
|
219
257
|
function addDetectionMetadata(result, extractor, confidence, patterns, reason) {
|
|
220
258
|
// Only add detection metadata if it doesn't already exist
|
|
221
259
|
// (individual extractors might have their own metadata)
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
};
|
|
228
|
-
}
|
|
260
|
+
result.metadata ??= {
|
|
261
|
+
confidence: 100,
|
|
262
|
+
completeness: 100,
|
|
263
|
+
issues: [],
|
|
264
|
+
};
|
|
229
265
|
result.metadata.detection = {
|
|
230
266
|
extractor,
|
|
231
267
|
confidence,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"smart-extractor.js","sourceRoot":"","sources":["../src/smart-extractor.ts"],"names":[],"mappings":"AAAA;;;;;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AAI,CAAC,oBAAoB,CAAC,CAAC;QAC7E,IAAI,YAAY,CAAC,QAAQ,CAAC,UAAU,CAAC;YAAE,QAAQ,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;QACvE,IAAI,kCAAkC,CAAC,IAAI,CAAC,YAAY,CAAC;YAAE,QAAQ,CAAC,IAAI,CAAC,iCAAiC,CAAC,CAAC;QAC5G,OAAO,oBAAoB,CAAC,MAAM,EAAE,QAAQ,EAAE,EAAE,EAAE,QAAQ,EAAE,oCAAoC,CAAC,CAAC;IACpG,CAAC;IAED,uDAAuD;IACvD,MAAM,MAAM,GAAG,oBAAoB,CAAC,YAAY,CAAC,CAAC;IAClD,OAAO,oBAAoB,CAAC,MAAM,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC,sBAAsB,CAAC,EAAE,oDAAoD,CAAC,CAAC;AACrI,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,SAAS,oBAAoB,CAC3B,MAA4B,EAC5B,SAAiB,EACjB,UAAkB,EAClB,QAAkB,EAClB,MAAc;IAEd,0DAA0D;IAC1D,wDAAwD;IACxD,MAAM,CAAC,QAAQ,KAAK;QAChB,UAAU,EAAE,GAAG;QACf,YAAY,EAAE,GAAG;QACjB,MAAM,EAAE,EAAE;KACX,CAAC;IAEJ,MAAM,CAAC,QAAQ,CAAC,SAAS,GAAG;QAC1B,SAAS;QACT,UAAU;QACV,QAAQ;QACR,MAAM;KACP,CAAC;IAEF,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/dist/tap-extractor.js
CHANGED
|
@@ -27,8 +27,8 @@ export function extractTAPErrors(output) {
|
|
|
27
27
|
return {
|
|
28
28
|
summary: '0 test(s) failed',
|
|
29
29
|
errors: [],
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
totalErrors: 0,
|
|
31
|
+
errorSummary: '',
|
|
32
32
|
guidance: '',
|
|
33
33
|
metadata: {
|
|
34
34
|
confidence: 100,
|
|
@@ -40,9 +40,9 @@ export function extractTAPErrors(output) {
|
|
|
40
40
|
const errors = [];
|
|
41
41
|
let completeCount = 0;
|
|
42
42
|
for (const failure of failures) {
|
|
43
|
-
const file = failure.file
|
|
44
|
-
const message = failure.message
|
|
45
|
-
const context = failure.testName
|
|
43
|
+
const file = failure.file ?? undefined;
|
|
44
|
+
const message = failure.message ?? 'Test failed';
|
|
45
|
+
const context = failure.testName ?? '';
|
|
46
46
|
const isComplete = file && failure.line && message;
|
|
47
47
|
if (isComplete) {
|
|
48
48
|
completeCount++;
|
|
@@ -70,8 +70,8 @@ export function extractTAPErrors(output) {
|
|
|
70
70
|
return {
|
|
71
71
|
summary,
|
|
72
72
|
errors,
|
|
73
|
-
|
|
74
|
-
|
|
73
|
+
totalErrors: failures.length,
|
|
74
|
+
errorSummary: formatCleanOutput(errors),
|
|
75
75
|
guidance,
|
|
76
76
|
metadata
|
|
77
77
|
};
|
|
@@ -79,6 +79,7 @@ export function extractTAPErrors(output) {
|
|
|
79
79
|
/**
|
|
80
80
|
* Extract all failures from TAP output
|
|
81
81
|
*/
|
|
82
|
+
// eslint-disable-next-line sonarjs/cognitive-complexity -- Complexity 17 acceptable for TAP output parsing (handles test comments, failure markers, and YAML diagnostic blocks)
|
|
82
83
|
function extractFailures(output) {
|
|
83
84
|
const failures = [];
|
|
84
85
|
const lines = output.split('\n');
|
|
@@ -93,7 +94,8 @@ function extractFailures(output) {
|
|
|
93
94
|
continue;
|
|
94
95
|
}
|
|
95
96
|
// Look for failures: "not ok N message"
|
|
96
|
-
|
|
97
|
+
// eslint-disable-next-line sonarjs/slow-regex -- Safe: only parses TAP test framework output (controlled output), not user input
|
|
98
|
+
const failureMatch = /^not ok\s+\d+\s+(.+)$/.exec(line);
|
|
97
99
|
if (failureMatch) {
|
|
98
100
|
const message = failureMatch[1].trim();
|
|
99
101
|
const failure = {
|
|
@@ -109,7 +111,8 @@ function extractFailures(output) {
|
|
|
109
111
|
// Extract location from "at:" field
|
|
110
112
|
// Format: "at: Test.<anonymous> (file:///path/to/file.js:line:col)"
|
|
111
113
|
// or: "at: file.js:line:col"
|
|
112
|
-
|
|
114
|
+
// eslint-disable-next-line sonarjs/slow-regex -- Safe: only parses TAP test framework YAML diagnostics (controlled output), not user input
|
|
115
|
+
const atMatch = /^\s+at:\s+(.+)$/.exec(yamlLine);
|
|
113
116
|
if (atMatch) {
|
|
114
117
|
const location = atMatch[1];
|
|
115
118
|
const { file, line } = parseLocation(location);
|
|
@@ -141,17 +144,18 @@ function extractFailures(output) {
|
|
|
141
144
|
*/
|
|
142
145
|
function parseLocation(location) {
|
|
143
146
|
// Try to extract from parentheses first: (file:///path:line:col) or (path:line:col)
|
|
144
|
-
|
|
147
|
+
// eslint-disable-next-line sonarjs/slow-regex -- Safe: only parses TAP test framework location strings (controlled output), not user input
|
|
148
|
+
const parenMatch = /\(([^)]+)\)/.exec(location);
|
|
145
149
|
const pathString = parenMatch ? parenMatch[1] : location;
|
|
146
150
|
// Remove file:// protocol if present
|
|
147
151
|
const cleanPath = pathString.replace(/^file:\/\//, '');
|
|
148
152
|
// Extract file path and line number
|
|
149
153
|
// Format: /path/to/file.js:line:col or path/to/file.js:line:col
|
|
150
|
-
const match =
|
|
154
|
+
const match = /^(.+):(\d+):\d+$/.exec(cleanPath);
|
|
151
155
|
if (match) {
|
|
152
156
|
return {
|
|
153
157
|
file: match[1],
|
|
154
|
-
line: parseInt(match[2], 10)
|
|
158
|
+
line: Number.parseInt(match[2], 10)
|
|
155
159
|
};
|
|
156
160
|
}
|
|
157
161
|
return {};
|
|
@@ -215,8 +219,9 @@ function formatCleanOutput(errors) {
|
|
|
215
219
|
}
|
|
216
220
|
return errors
|
|
217
221
|
.map(error => {
|
|
222
|
+
const linePart = error.line ? `:${error.line}` : '';
|
|
218
223
|
const location = error.file
|
|
219
|
-
? `${error.file}${
|
|
224
|
+
? `${error.file}${linePart}`
|
|
220
225
|
: 'unknown location';
|
|
221
226
|
const context = error.context ? `[${error.context}] ` : '';
|
|
222
227
|
return `${location}: ${context}${error.message}`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tap-extractor.js","sourceRoot":"","sources":["../src/tap-extractor.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,gBAAgB,CAAC,MAAc;IAC7C,gEAAgE;IAEhE,uBAAuB;IACvB,MAAM,QAAQ,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC;IAEzC,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC1B,OAAO;YACL,OAAO,EAAE,kBAAkB;YAC3B,MAAM,EAAE,EAAE;YACV,
|
|
1
|
+
{"version":3,"file":"tap-extractor.js","sourceRoot":"","sources":["../src/tap-extractor.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,gBAAgB,CAAC,MAAc;IAC7C,gEAAgE;IAEhE,uBAAuB;IACvB,MAAM,QAAQ,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC;IAEzC,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC1B,OAAO;YACL,OAAO,EAAE,kBAAkB;YAC3B,MAAM,EAAE,EAAE;YACV,WAAW,EAAE,CAAC;YACd,YAAY,EAAE,EAAE;YAChB,QAAQ,EAAE,EAAE;YACZ,QAAQ,EAAE;gBACR,UAAU,EAAE,GAAG;gBACf,YAAY,EAAE,GAAG;gBACjB,MAAM,EAAE,EAAE;aACX;SACF,CAAC;IACJ,CAAC;IAED,MAAM,MAAM,GAAqB,EAAE,CAAC;IACpC,IAAI,aAAa,GAAG,CAAC,CAAC;IAEtB,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;QAC/B,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,IAAI,SAAS,CAAC;QACvC,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,aAAa,CA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
|
4
4
|
* Type definitions for LLM-optimized error extraction.
|
|
5
5
|
*
|
|
6
|
+
* NOTE: These types are now derived from Zod schemas in result-schema.ts
|
|
7
|
+
* This file re-exports them for backward compatibility.
|
|
8
|
+
*
|
|
6
9
|
* @package @vibe-validate/extractors
|
|
7
10
|
*/
|
|
11
|
+
import type { ErrorExtractorResult as ExtractorResult } from './result-schema.js';
|
|
12
|
+
export type { FormattedError, DetectionMetadata, ExtractionMetadata, ErrorExtractorResult, } from './result-schema.js';
|
|
8
13
|
/**
|
|
9
|
-
*
|
|
10
|
-
*/
|
|
11
|
-
export interface FormattedError {
|
|
12
|
-
/** File path where the error occurred (undefined if location cannot be determined) */
|
|
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
|
-
/** Guidance for fixing the error */
|
|
27
|
-
guidance?: string;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Metadata about which extractor was selected and why
|
|
31
|
-
*/
|
|
32
|
-
export interface DetectionMetadata {
|
|
33
|
-
/** Which extractor was used (e.g., "jest", "vitest", "typescript", "generic") */
|
|
34
|
-
extractor: string;
|
|
35
|
-
/** Confidence in detection (0-100) */
|
|
36
|
-
confidence: number;
|
|
37
|
-
/** Patterns that matched (e.g., ["FAIL pattern", "✕ symbols found"]) */
|
|
38
|
-
patterns: string[];
|
|
39
|
-
/** Why this extractor was chosen */
|
|
40
|
-
reason: string;
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Metadata about extraction quality (what the extractor knows about its own extraction)
|
|
14
|
+
* Input for error extraction with separated streams
|
|
44
15
|
*
|
|
45
|
-
*
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
detection?: DetectionMetadata;
|
|
50
|
-
/** Extraction confidence (0-100) based on pattern match quality */
|
|
51
|
-
confidence: number;
|
|
52
|
-
/** Percentage of extracted errors with complete data (file + line + message) */
|
|
53
|
-
completeness: number;
|
|
54
|
-
/** Issues encountered during extraction (e.g., "ambiguous patterns", "missing line numbers") */
|
|
55
|
-
issues: string[];
|
|
56
|
-
/** Suggestions for improving extraction quality (only included when developerFeedback: true) */
|
|
57
|
-
suggestions?: string[];
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Result of error extraction operation
|
|
16
|
+
* Allows extractors to choose the most appropriate stream(s) for extraction:
|
|
17
|
+
* - stdout: Standard output (clean, structured data)
|
|
18
|
+
* - stderr: Error output (warnings, errors, debug info)
|
|
19
|
+
* - combined: Chronological mix (for context-dependent extraction)
|
|
61
20
|
*/
|
|
62
|
-
export interface
|
|
63
|
-
/**
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
|
|
69
|
-
/** Step-specific actionable guidance for fixing errors */
|
|
70
|
-
guidance?: string;
|
|
71
|
-
/** Clean, formatted output for YAML/JSON embedding */
|
|
72
|
-
cleanOutput: string;
|
|
73
|
-
/** Extraction quality metadata (only included when developerFeedback: true) */
|
|
74
|
-
metadata?: ExtractionMetadata;
|
|
21
|
+
export interface ExtractorInput {
|
|
22
|
+
/** Raw stdout output */
|
|
23
|
+
stdout: string;
|
|
24
|
+
/** Raw stderr output */
|
|
25
|
+
stderr: string;
|
|
26
|
+
/** Combined chronological output (stdout + stderr) */
|
|
27
|
+
combined: string;
|
|
75
28
|
}
|
|
76
29
|
/**
|
|
77
30
|
* Error extractor interface for specific tool/format
|
|
@@ -83,6 +36,6 @@ export interface ErrorExtractor {
|
|
|
83
36
|
* @param _output - Raw command output (may include ANSI codes, noise)
|
|
84
37
|
* @returns Structured error information optimized for LLM consumption
|
|
85
38
|
*/
|
|
86
|
-
format(_output: string):
|
|
39
|
+
format(_output: string): ExtractorResult;
|
|
87
40
|
}
|
|
88
41
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,KAAK,EAAE,oBAAoB,IAAI,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAGlF,YAAY,EACV,cAAc,EACd,iBAAiB,EACjB,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,oBAAoB,CAAC;AAE5B;;;;;;;GAOG;AACH,MAAM,WAAW,cAAc;IAC7B,wBAAwB;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,wBAAwB;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,sDAAsD;IACtD,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B;;;;;OAKG;IACH,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,eAAe,CAAC;CAC1C"}
|
package/dist/types.js
CHANGED
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;;;;;;;;;GASG"}
|
|
@@ -1 +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;
|
|
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;AAGvE;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,MAAM,GAAG,oBAAoB,CAsD5E"}
|