@vibe-validate/extractors 0.16.0 → 0.17.0-rc.5
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/extractor-registry.d.ts +104 -0
- package/dist/extractor-registry.d.ts.map +1 -0
- package/dist/extractor-registry.js +278 -0
- package/dist/extractor-registry.js.map +1 -0
- package/dist/extractors/ava/index.d.ts +23 -0
- package/dist/extractors/ava/index.d.ts.map +1 -0
- package/dist/extractors/ava/index.js +507 -0
- package/dist/extractors/ava/index.js.map +1 -0
- package/dist/extractors/ava/index.test.d.ts +7 -0
- package/dist/extractors/ava/index.test.d.ts.map +1 -0
- package/dist/extractors/ava/index.test.js +408 -0
- package/dist/extractors/ava/index.test.js.map +1 -0
- package/dist/extractors/eslint/index.d.ts +18 -0
- package/dist/extractors/eslint/index.d.ts.map +1 -0
- package/dist/extractors/eslint/index.js +206 -0
- package/dist/extractors/eslint/index.js.map +1 -0
- package/dist/extractors/eslint/index.test.d.ts +9 -0
- package/dist/extractors/eslint/index.test.d.ts.map +1 -0
- package/dist/extractors/eslint/index.test.js +191 -0
- package/dist/extractors/eslint/index.test.js.map +1 -0
- package/dist/extractors/generic/index.d.ts +30 -0
- package/dist/extractors/generic/index.d.ts.map +1 -0
- package/dist/extractors/generic/index.js +140 -0
- package/dist/extractors/generic/index.js.map +1 -0
- package/dist/extractors/generic/index.test.d.ts +7 -0
- package/dist/extractors/generic/index.test.d.ts.map +1 -0
- package/dist/extractors/generic/index.test.js +61 -0
- package/dist/extractors/generic/index.test.js.map +1 -0
- package/dist/extractors/jasmine/index.d.ts +17 -0
- package/dist/extractors/jasmine/index.d.ts.map +1 -0
- package/dist/extractors/jasmine/index.js +242 -0
- package/dist/extractors/jasmine/index.js.map +1 -0
- package/dist/extractors/jasmine/index.test.d.ts +7 -0
- package/dist/extractors/jasmine/index.test.d.ts.map +1 -0
- package/dist/extractors/jasmine/index.test.js +318 -0
- package/dist/extractors/jasmine/index.test.js.map +1 -0
- package/dist/extractors/jest/index.d.ts +17 -0
- package/dist/extractors/jest/index.d.ts.map +1 -0
- package/dist/extractors/jest/index.js +273 -0
- package/dist/extractors/jest/index.js.map +1 -0
- package/dist/extractors/jest/index.test.d.ts +9 -0
- package/dist/extractors/jest/index.test.d.ts.map +1 -0
- package/dist/extractors/jest/index.test.js +338 -0
- package/dist/extractors/jest/index.test.js.map +1 -0
- package/dist/extractors/junit/index.d.ts +18 -0
- package/dist/extractors/junit/index.d.ts.map +1 -0
- package/dist/extractors/junit/index.js +259 -0
- package/dist/extractors/junit/index.js.map +1 -0
- package/dist/extractors/junit/index.test.d.ts +7 -0
- package/dist/extractors/junit/index.test.d.ts.map +1 -0
- package/dist/extractors/junit/index.test.js +341 -0
- package/dist/extractors/junit/index.test.js.map +1 -0
- package/dist/extractors/maven-checkstyle/index.d.ts +23 -0
- package/dist/extractors/maven-checkstyle/index.d.ts.map +1 -0
- package/dist/extractors/maven-checkstyle/index.js +263 -0
- package/dist/extractors/maven-checkstyle/index.js.map +1 -0
- package/dist/extractors/maven-checkstyle/index.test.d.ts +2 -0
- package/dist/extractors/maven-checkstyle/index.test.d.ts.map +1 -0
- package/dist/extractors/maven-checkstyle/index.test.js +197 -0
- package/dist/extractors/maven-checkstyle/index.test.js.map +1 -0
- package/dist/extractors/maven-compiler/index.d.ts +23 -0
- package/dist/extractors/maven-compiler/index.d.ts.map +1 -0
- package/dist/extractors/maven-compiler/index.js +271 -0
- package/dist/extractors/maven-compiler/index.js.map +1 -0
- package/dist/extractors/maven-compiler/index.test.d.ts +2 -0
- package/dist/extractors/maven-compiler/index.test.d.ts.map +1 -0
- package/dist/extractors/maven-compiler/index.test.js +189 -0
- package/dist/extractors/maven-compiler/index.test.js.map +1 -0
- package/dist/extractors/maven-surefire/index.d.ts +23 -0
- package/dist/extractors/maven-surefire/index.d.ts.map +1 -0
- package/dist/extractors/maven-surefire/index.js +292 -0
- package/dist/extractors/maven-surefire/index.js.map +1 -0
- package/dist/extractors/maven-surefire/index.test.d.ts +2 -0
- package/dist/extractors/maven-surefire/index.test.d.ts.map +1 -0
- package/dist/extractors/maven-surefire/index.test.js +163 -0
- package/dist/extractors/maven-surefire/index.test.js.map +1 -0
- package/dist/extractors/mocha/index.d.ts +17 -0
- package/dist/extractors/mocha/index.d.ts.map +1 -0
- package/dist/extractors/mocha/index.js +241 -0
- package/dist/extractors/mocha/index.js.map +1 -0
- package/dist/extractors/mocha/index.test.d.ts +7 -0
- package/dist/extractors/mocha/index.test.d.ts.map +1 -0
- package/dist/extractors/mocha/index.test.js +300 -0
- package/dist/extractors/mocha/index.test.js.map +1 -0
- package/dist/extractors/playwright/index.d.ts +17 -0
- package/dist/extractors/playwright/index.d.ts.map +1 -0
- package/dist/extractors/playwright/index.js +320 -0
- package/dist/extractors/playwright/index.js.map +1 -0
- package/dist/extractors/playwright/index.test.d.ts +7 -0
- package/dist/extractors/playwright/index.test.d.ts.map +1 -0
- package/dist/extractors/playwright/index.test.js +274 -0
- package/dist/extractors/playwright/index.test.js.map +1 -0
- package/dist/extractors/tap/index.d.ts +23 -0
- package/dist/extractors/tap/index.d.ts.map +1 -0
- package/dist/extractors/tap/index.js +352 -0
- package/dist/extractors/tap/index.js.map +1 -0
- package/dist/extractors/tap/index.test.d.ts +7 -0
- package/dist/extractors/tap/index.test.d.ts.map +1 -0
- package/dist/extractors/tap/index.test.js +100 -0
- package/dist/extractors/tap/index.test.js.map +1 -0
- package/dist/extractors/typescript/index.d.ts +17 -0
- package/dist/extractors/typescript/index.d.ts.map +1 -0
- package/dist/extractors/typescript/index.js +150 -0
- package/dist/extractors/typescript/index.js.map +1 -0
- package/dist/extractors/typescript/index.test.d.ts +9 -0
- package/dist/extractors/typescript/index.test.d.ts.map +1 -0
- package/dist/extractors/typescript/index.test.js +177 -0
- package/dist/extractors/typescript/index.test.js.map +1 -0
- package/dist/extractors/vitest/index.d.ts +17 -0
- package/dist/extractors/vitest/index.d.ts.map +1 -0
- package/dist/extractors/vitest/index.js +564 -0
- package/dist/extractors/vitest/index.js.map +1 -0
- package/dist/extractors/vitest/index.test.d.ts +9 -0
- package/dist/extractors/vitest/index.test.d.ts.map +1 -0
- package/dist/extractors/vitest/index.test.js +373 -0
- package/dist/extractors/vitest/index.test.js.map +1 -0
- package/dist/index.d.ts +27 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +27 -11
- package/dist/index.js.map +1 -1
- package/dist/maven-checkstyle-extractor.d.ts +20 -0
- package/dist/maven-checkstyle-extractor.d.ts.map +1 -0
- package/dist/maven-checkstyle-extractor.js +193 -0
- package/dist/maven-checkstyle-extractor.js.map +1 -0
- package/dist/maven-compiler-extractor.d.ts +20 -0
- package/dist/maven-compiler-extractor.d.ts.map +1 -0
- package/dist/maven-compiler-extractor.js +218 -0
- package/dist/maven-compiler-extractor.js.map +1 -0
- package/dist/maven-surefire-extractor.d.ts +20 -0
- package/dist/maven-surefire-extractor.d.ts.map +1 -0
- package/dist/maven-surefire-extractor.js +228 -0
- package/dist/maven-surefire-extractor.js.map +1 -0
- package/dist/maven-utils.d.ts +24 -0
- package/dist/maven-utils.d.ts.map +1 -0
- package/dist/maven-utils.js +36 -0
- package/dist/maven-utils.js.map +1 -0
- package/dist/plugin-loader.d.ts +82 -0
- package/dist/plugin-loader.d.ts.map +1 -0
- package/dist/plugin-loader.js +200 -0
- package/dist/plugin-loader.js.map +1 -0
- package/dist/sandbox.d.ts +161 -0
- package/dist/sandbox.d.ts.map +1 -0
- package/dist/sandbox.js +254 -0
- package/dist/sandbox.js.map +1 -0
- package/dist/sandbox.test.d.ts +8 -0
- package/dist/sandbox.test.d.ts.map +1 -0
- package/dist/sandbox.test.js +395 -0
- package/dist/sandbox.test.js.map +1 -0
- package/dist/sandboxed-extractor.d.ts +46 -0
- package/dist/sandboxed-extractor.d.ts.map +1 -0
- package/dist/sandboxed-extractor.js +172 -0
- package/dist/sandboxed-extractor.js.map +1 -0
- package/dist/sandboxed-extractor.test.d.ts +5 -0
- package/dist/sandboxed-extractor.test.d.ts.map +1 -0
- package/dist/sandboxed-extractor.test.js +346 -0
- package/dist/sandboxed-extractor.test.js.map +1 -0
- package/dist/smart-extractor.d.ts +22 -10
- package/dist/smart-extractor.d.ts.map +1 -1
- package/dist/smart-extractor.js +116 -163
- package/dist/smart-extractor.js.map +1 -1
- package/dist/types.d.ts +94 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +2 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../../../src/extractors/eslint/index.test.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ESLint Extractor Plugin Tests
|
|
3
|
+
*
|
|
4
|
+
* Tests ESLint error parsing and formatting.
|
|
5
|
+
*
|
|
6
|
+
* @package @vibe-validate/extractors
|
|
7
|
+
*/
|
|
8
|
+
import { describe, it, expect } from 'vitest';
|
|
9
|
+
import eslintPlugin from './index.js';
|
|
10
|
+
describe('ESLint Plugin', () => {
|
|
11
|
+
describe('detect', () => {
|
|
12
|
+
it('should detect modern ESLint format', () => {
|
|
13
|
+
const output = `src/index.ts:10:5: error Unexpected console statement no-console`;
|
|
14
|
+
const result = eslintPlugin.detect(output);
|
|
15
|
+
expect(result.confidence).toBe(85);
|
|
16
|
+
expect(result.patterns).toContain('file:line:col: error/warning rule-name');
|
|
17
|
+
expect(result.reason).toBe('ESLint error format detected');
|
|
18
|
+
});
|
|
19
|
+
it('should detect stylish format', () => {
|
|
20
|
+
const output = ` 10:5 error Unexpected console statement no-console`;
|
|
21
|
+
const result = eslintPlugin.detect(output);
|
|
22
|
+
expect(result.confidence).toBe(85);
|
|
23
|
+
expect(result.patterns).toContain('file:line:col: error/warning rule-name');
|
|
24
|
+
});
|
|
25
|
+
it('should not detect non-ESLint output', () => {
|
|
26
|
+
const output = `Some random text that is not ESLint output`;
|
|
27
|
+
const result = eslintPlugin.detect(output);
|
|
28
|
+
expect(result.confidence).toBe(0);
|
|
29
|
+
expect(result.patterns).toEqual([]);
|
|
30
|
+
});
|
|
31
|
+
it('should not detect TypeScript errors', () => {
|
|
32
|
+
const output = `src/index.ts(10,5): error TS2322: Type mismatch`;
|
|
33
|
+
const result = eslintPlugin.detect(output);
|
|
34
|
+
expect(result.confidence).toBe(0);
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
describe('extract', () => {
|
|
38
|
+
it('should parse single ESLint error', () => {
|
|
39
|
+
const output = `src/index.ts:10:5: error Unexpected console statement no-console`;
|
|
40
|
+
const result = eslintPlugin.extract(output);
|
|
41
|
+
expect(result.errors).toHaveLength(1);
|
|
42
|
+
expect(result.errors[0]).toEqual({
|
|
43
|
+
file: 'src/index.ts',
|
|
44
|
+
line: 10,
|
|
45
|
+
column: 5,
|
|
46
|
+
severity: 'error',
|
|
47
|
+
message: 'Unexpected console statement (no-console)',
|
|
48
|
+
code: 'no-console'
|
|
49
|
+
});
|
|
50
|
+
expect(result.summary).toBe('1 ESLint error(s), 0 warning(s)');
|
|
51
|
+
expect(result.totalErrors).toBe(1);
|
|
52
|
+
});
|
|
53
|
+
it('should parse multiple ESLint errors and warnings', () => {
|
|
54
|
+
const output = `src/index.ts:10:5: error Unexpected console statement no-console
|
|
55
|
+
src/config.ts:25:12: warning 'unusedVar' is defined but never used @typescript-eslint/no-unused-vars
|
|
56
|
+
src/utils.ts:100:3: error Missing semicolon semi`;
|
|
57
|
+
const result = eslintPlugin.extract(output);
|
|
58
|
+
expect(result.errors).toHaveLength(3);
|
|
59
|
+
expect(result.summary).toBe('2 ESLint error(s), 1 warning(s)');
|
|
60
|
+
expect(result.totalErrors).toBe(3);
|
|
61
|
+
// Verify first error
|
|
62
|
+
expect(result.errors[0].file).toBe('src/index.ts');
|
|
63
|
+
expect(result.errors[0].severity).toBe('error');
|
|
64
|
+
expect(result.errors[0].code).toBe('no-console');
|
|
65
|
+
// Verify warning
|
|
66
|
+
expect(result.errors[1].severity).toBe('warning');
|
|
67
|
+
expect(result.errors[1].code).toBe('@typescript-eslint/no-unused-vars');
|
|
68
|
+
});
|
|
69
|
+
it('should limit output to first 10 errors', () => {
|
|
70
|
+
// Generate 15 errors
|
|
71
|
+
const errors = Array.from({ length: 15 }, (_, i) => `src/file${i}.ts:${i + 1}:5: error Error message ${i + 1} rule-${i}`).join('\n');
|
|
72
|
+
const result = eslintPlugin.extract(errors);
|
|
73
|
+
expect(result.totalErrors).toBe(15);
|
|
74
|
+
expect(result.errors).toHaveLength(10);
|
|
75
|
+
expect(result.summary).toBe('15 ESLint error(s), 0 warning(s)');
|
|
76
|
+
});
|
|
77
|
+
it('should generate no-console guidance', () => {
|
|
78
|
+
const output = `src/index.ts:10:5: error Unexpected console statement no-console`;
|
|
79
|
+
const result = eslintPlugin.extract(output);
|
|
80
|
+
expect(result.guidance).toContain('Replace console.log with logger');
|
|
81
|
+
});
|
|
82
|
+
it('should generate no-unused-vars guidance', () => {
|
|
83
|
+
const output = `src/config.ts:25:12: warning 'unusedVar' is defined but never used @typescript-eslint/no-unused-vars`;
|
|
84
|
+
const result = eslintPlugin.extract(output);
|
|
85
|
+
expect(result.guidance).toContain('Remove or prefix unused variables with underscore');
|
|
86
|
+
});
|
|
87
|
+
it('should generate generic guidance for unknown rules', () => {
|
|
88
|
+
const output = `src/index.ts:10:5: error Unknown error unknown-rule`;
|
|
89
|
+
const result = eslintPlugin.extract(output);
|
|
90
|
+
expect(result.guidance).toBe('Fix ESLint errors - run with --fix to auto-fix some issues');
|
|
91
|
+
});
|
|
92
|
+
it('should combine multiple guidance messages', () => {
|
|
93
|
+
const output = `src/index.ts:10:5: error Unexpected console statement no-console
|
|
94
|
+
src/config.ts:25:12: warning 'unusedVar' is defined but never used @typescript-eslint/no-unused-vars`;
|
|
95
|
+
const result = eslintPlugin.extract(output);
|
|
96
|
+
expect(result.guidance).toContain('Replace console.log with logger');
|
|
97
|
+
expect(result.guidance).toContain('Remove or prefix unused variables with underscore');
|
|
98
|
+
});
|
|
99
|
+
it('should generate clean output with file:line:column format', () => {
|
|
100
|
+
const output = `src/index.ts:10:5: error Unexpected console statement no-console
|
|
101
|
+
src/config.ts:25:12: warning 'unusedVar' is defined but never used @typescript-eslint/no-unused-vars`;
|
|
102
|
+
const result = eslintPlugin.extract(output);
|
|
103
|
+
expect(result.errorSummary).toContain('src/index.ts:10:5 - Unexpected console statement (no-console) [no-console]');
|
|
104
|
+
expect(result.errorSummary).toContain('src/config.ts:25:12 - \'unusedVar\' is defined but never used (@typescript-eslint/no-unused-vars) [@typescript-eslint/no-unused-vars]');
|
|
105
|
+
});
|
|
106
|
+
it('should handle empty output', () => {
|
|
107
|
+
const result = eslintPlugin.extract('');
|
|
108
|
+
expect(result.errors).toHaveLength(0);
|
|
109
|
+
expect(result.summary).toBe('0 ESLint error(s), 0 warning(s)');
|
|
110
|
+
expect(result.totalErrors).toBe(0);
|
|
111
|
+
expect(result.guidance).toBe('Fix ESLint errors - run with --fix to auto-fix some issues');
|
|
112
|
+
});
|
|
113
|
+
it('should handle output with no matches', () => {
|
|
114
|
+
const output = `Some random text
|
|
115
|
+
That does not match
|
|
116
|
+
The ESLint error format`;
|
|
117
|
+
const result = eslintPlugin.extract(output);
|
|
118
|
+
expect(result.errors).toHaveLength(0);
|
|
119
|
+
expect(result.summary).toBe('0 ESLint error(s), 0 warning(s)');
|
|
120
|
+
});
|
|
121
|
+
it('should handle files with spaces in path', () => {
|
|
122
|
+
const output = `src/my folder/index.ts:10:5: error Error message rule-name`;
|
|
123
|
+
const result = eslintPlugin.extract(output);
|
|
124
|
+
expect(result.errors).toHaveLength(1);
|
|
125
|
+
expect(result.errors[0].file).toBe('src/my folder/index.ts');
|
|
126
|
+
});
|
|
127
|
+
it('should handle TypeScript ESLint rules', () => {
|
|
128
|
+
const output = `src/index.ts:10:5: error Missing return type @typescript-eslint/explicit-function-return-type
|
|
129
|
+
src/config.ts:25:12: error Promise must be handled @typescript-eslint/no-floating-promises`;
|
|
130
|
+
const result = eslintPlugin.extract(output);
|
|
131
|
+
expect(result.errors).toHaveLength(2);
|
|
132
|
+
expect(result.errors[0].code).toBe('@typescript-eslint/explicit-function-return-type');
|
|
133
|
+
expect(result.errors[1].code).toBe('@typescript-eslint/no-floating-promises');
|
|
134
|
+
});
|
|
135
|
+
it('should handle scoped package rule names', () => {
|
|
136
|
+
const output = `src/index.ts:10:5: error Custom error @my-org/custom-rule`;
|
|
137
|
+
const result = eslintPlugin.extract(output);
|
|
138
|
+
expect(result.errors).toHaveLength(1);
|
|
139
|
+
expect(result.errors[0].code).toBe('@my-org/custom-rule');
|
|
140
|
+
});
|
|
141
|
+
});
|
|
142
|
+
describe('samples', () => {
|
|
143
|
+
it('should have valid sample test cases', () => {
|
|
144
|
+
expect(eslintPlugin.samples).toBeDefined();
|
|
145
|
+
expect(eslintPlugin.samples.length).toBeGreaterThan(0);
|
|
146
|
+
for (const sample of eslintPlugin.samples) {
|
|
147
|
+
expect(sample.name).toBeTruthy();
|
|
148
|
+
expect(sample.description).toBeTruthy();
|
|
149
|
+
expect(sample.input).toBeTruthy();
|
|
150
|
+
expect(sample.expectedErrors).toBeGreaterThan(0);
|
|
151
|
+
expect(sample.expectedPatterns.length).toBeGreaterThan(0);
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
it('should extract expected errors from samples', () => {
|
|
155
|
+
for (const sample of eslintPlugin.samples) {
|
|
156
|
+
const result = eslintPlugin.extract(sample.input);
|
|
157
|
+
expect(result.errors.length).toBe(sample.expectedErrors);
|
|
158
|
+
// Verify expected patterns appear in output
|
|
159
|
+
for (const pattern of sample.expectedPatterns) {
|
|
160
|
+
const found = result.errors.some(e => e.code?.includes(pattern) ||
|
|
161
|
+
e.message?.includes(pattern) ||
|
|
162
|
+
result.guidance?.includes(pattern));
|
|
163
|
+
expect(found).toBe(true);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
});
|
|
168
|
+
describe('metadata', () => {
|
|
169
|
+
it('should have complete metadata', () => {
|
|
170
|
+
expect(eslintPlugin.metadata.name).toBe('eslint');
|
|
171
|
+
expect(eslintPlugin.metadata.version).toBeTruthy();
|
|
172
|
+
expect(eslintPlugin.metadata.author).toBeTruthy();
|
|
173
|
+
expect(eslintPlugin.metadata.description).toBeTruthy();
|
|
174
|
+
expect(eslintPlugin.metadata.repository).toBeTruthy();
|
|
175
|
+
expect(eslintPlugin.metadata.tags.length).toBeGreaterThan(0);
|
|
176
|
+
});
|
|
177
|
+
});
|
|
178
|
+
describe('hints', () => {
|
|
179
|
+
it('should have performance hints defined', () => {
|
|
180
|
+
expect(eslintPlugin.hints).toBeDefined();
|
|
181
|
+
expect(eslintPlugin.hints.required).toBeDefined();
|
|
182
|
+
expect(eslintPlugin.hints.anyOf).toBeDefined();
|
|
183
|
+
});
|
|
184
|
+
});
|
|
185
|
+
describe('priority', () => {
|
|
186
|
+
it('should have priority set', () => {
|
|
187
|
+
expect(eslintPlugin.priority).toBe(85);
|
|
188
|
+
});
|
|
189
|
+
});
|
|
190
|
+
});
|
|
191
|
+
//# sourceMappingURL=index.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.test.js","sourceRoot":"","sources":["../../../src/extractors/eslint/index.test.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,YAAY,MAAM,YAAY,CAAC;AAEtC,QAAQ,CAAC,eAAe,EAAE,GAAG,EAAE;IAC7B,QAAQ,CAAC,QAAQ,EAAE,GAAG,EAAE;QACtB,EAAE,CAAC,oCAAoC,EAAE,GAAG,EAAE;YAC5C,MAAM,MAAM,GAAG,kEAAkE,CAAC;YAClF,MAAM,MAAM,GAAG,YAAY,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;YAE3C,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC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AC,CAAC;YAClD,MAAM,CAAC,YAAY,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,UAAU,EAAE,CAAC;YACnD,MAAM,CAAC,YAAY,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,UAAU,EAAE,CAAC;YAClD,MAAM,CAAC,YAAY,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,UAAU,EAAE,CAAC;YACvD,MAAM,CAAC,YAAY,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,UAAU,EAAE,CAAC;YACtD,MAAM,CAAC,YAAY,CAAC,QAAQ,CAAC,IAAK,CAAC,MAAM,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;QAChE,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,OAAO,EAAE,GAAG,EAAE;QACrB,EAAE,CAAC,uCAAuC,EAAE,GAAG,EAAE;YAC/C,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,WAAW,EAAE,CAAC;YACzC,MAAM,CAAC,YAAY,CAAC,KAAM,CAAC,QAAQ,CAAC,CAAC,WAAW,EAAE,CAAC;YACnD,MAAM,CAAC,YAAY,CAAC,KAAM,CAAC,KAAK,CAAC,CAAC,WAAW,EAAE,CAAC;QAClD,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,UAAU,EAAE,GAAG,EAAE;QACxB,EAAE,CAAC,0BAA0B,EAAE,GAAG,EAAE;YAClC,MAAM,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACzC,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generic Error Extractor Plugin
|
|
3
|
+
*
|
|
4
|
+
* Fallback extractor for unknown validation step types.
|
|
5
|
+
* Intelligently extracts error keywords and relevant lines for LLM consumption.
|
|
6
|
+
*
|
|
7
|
+
* @package @vibe-validate/extractors
|
|
8
|
+
*/
|
|
9
|
+
import type { ExtractorPlugin, DetectionResult, ErrorExtractorResult } from '../../types.js';
|
|
10
|
+
/**
|
|
11
|
+
* Generic extractor always accepts (lowest priority fallback)
|
|
12
|
+
*/
|
|
13
|
+
export declare function detectGeneric(_output: string): DetectionResult;
|
|
14
|
+
/**
|
|
15
|
+
* Generic error extractor (fallback)
|
|
16
|
+
*
|
|
17
|
+
* Intelligently extracts error information by:
|
|
18
|
+
* - Identifying lines with error keywords
|
|
19
|
+
* - Extracting file paths with line numbers
|
|
20
|
+
* - Capturing summary lines
|
|
21
|
+
* - Removing npm/package manager noise
|
|
22
|
+
* - Limiting to 20 most relevant lines
|
|
23
|
+
*/
|
|
24
|
+
export declare function extractGeneric(output: string, _command?: string): ErrorExtractorResult;
|
|
25
|
+
/**
|
|
26
|
+
* Generic Extractor Plugin (Fallback)
|
|
27
|
+
*/
|
|
28
|
+
declare const genericExtractor: ExtractorPlugin;
|
|
29
|
+
export default genericExtractor;
|
|
30
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/extractors/generic/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AA0B7F;;GAEG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,eAAe,CAM9D;AAED;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,oBAAoB,CA4DtF;AAED;;GAEG;AACH,QAAA,MAAM,gBAAgB,EAAE,eA6BvB,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generic Error Extractor Plugin
|
|
3
|
+
*
|
|
4
|
+
* Fallback extractor for unknown validation step types.
|
|
5
|
+
* Intelligently extracts error keywords and relevant lines for LLM consumption.
|
|
6
|
+
*
|
|
7
|
+
* @package @vibe-validate/extractors
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Error keyword patterns for intelligent extraction
|
|
11
|
+
*/
|
|
12
|
+
const ERROR_KEYWORDS = [
|
|
13
|
+
'failed', 'fail', 'error', 'exception', 'traceback', 'assertionerror',
|
|
14
|
+
'typeerror', 'valueerror', 'panic:', 'fatal:', 'syntaxerror', 'referenceerror',
|
|
15
|
+
'comparisonerror', 'comparisonfailure', 'arithmeticexception',
|
|
16
|
+
'at ', '-->', 'undefined:',
|
|
17
|
+
];
|
|
18
|
+
/**
|
|
19
|
+
* Noise patterns to filter out
|
|
20
|
+
*/
|
|
21
|
+
const NOISE_PATTERNS = [
|
|
22
|
+
/^>/,
|
|
23
|
+
/npm ERR!/,
|
|
24
|
+
/^npm WARN/,
|
|
25
|
+
/^warning:/i,
|
|
26
|
+
/node_modules/,
|
|
27
|
+
/^Download/i,
|
|
28
|
+
/^Resolving packages/i,
|
|
29
|
+
/^Already up[- ]to[- ]date/i,
|
|
30
|
+
];
|
|
31
|
+
/**
|
|
32
|
+
* Generic extractor always accepts (lowest priority fallback)
|
|
33
|
+
*/
|
|
34
|
+
export function detectGeneric(_output) {
|
|
35
|
+
return {
|
|
36
|
+
confidence: 10, // Lowest priority
|
|
37
|
+
patterns: ['Generic fallback'],
|
|
38
|
+
reason: 'Fallback extractor for unknown formats',
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Generic error extractor (fallback)
|
|
43
|
+
*
|
|
44
|
+
* Intelligently extracts error information by:
|
|
45
|
+
* - Identifying lines with error keywords
|
|
46
|
+
* - Extracting file paths with line numbers
|
|
47
|
+
* - Capturing summary lines
|
|
48
|
+
* - Removing npm/package manager noise
|
|
49
|
+
* - Limiting to 20 most relevant lines
|
|
50
|
+
*/
|
|
51
|
+
export function extractGeneric(output, _command) {
|
|
52
|
+
const lines = output.split('\n');
|
|
53
|
+
const relevantLines = [];
|
|
54
|
+
for (const line of lines) {
|
|
55
|
+
const trimmed = line.trim();
|
|
56
|
+
if (trimmed === '')
|
|
57
|
+
continue;
|
|
58
|
+
if (NOISE_PATTERNS.some((pattern) => pattern.test(line)))
|
|
59
|
+
continue;
|
|
60
|
+
const lineLower = line.toLowerCase();
|
|
61
|
+
const hasErrorKeyword = ERROR_KEYWORDS.some((keyword) => lineLower.includes(keyword));
|
|
62
|
+
// Optimized: Use atomic groups or possessive quantifiers equivalent - simple alternation
|
|
63
|
+
const hasFileLineRef = /(?:\.py|\.go|\.rs|\.rb|\.java|\.cpp|\.c|\.h|\.js|\.ts|\.tsx|\.jsx):\d+/.test(line);
|
|
64
|
+
// Optimized: Use substring checks to avoid regex backtracking entirely
|
|
65
|
+
const isSummaryLine = lineLower.includes(' failed') ||
|
|
66
|
+
lineLower.includes(' passed') ||
|
|
67
|
+
lineLower.includes(' error') ||
|
|
68
|
+
lineLower.includes(' success') ||
|
|
69
|
+
lineLower.includes(' example');
|
|
70
|
+
if (hasErrorKeyword || hasFileLineRef || isSummaryLine) {
|
|
71
|
+
relevantLines.push(line);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
let errorSummary;
|
|
75
|
+
if (relevantLines.length > 0) {
|
|
76
|
+
errorSummary = relevantLines.slice(0, 20).join('\n');
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
errorSummary = lines
|
|
80
|
+
.filter((line) => {
|
|
81
|
+
if (line.trim() === '')
|
|
82
|
+
return false;
|
|
83
|
+
if (NOISE_PATTERNS.some((pattern) => pattern.test(line)))
|
|
84
|
+
return false;
|
|
85
|
+
return true;
|
|
86
|
+
})
|
|
87
|
+
.slice(0, 20)
|
|
88
|
+
.join('\n');
|
|
89
|
+
}
|
|
90
|
+
const hasErrors = relevantLines.length > 0;
|
|
91
|
+
return {
|
|
92
|
+
errors: [],
|
|
93
|
+
summary: hasErrors ? 'Command failed - see output' : 'No errors detected',
|
|
94
|
+
totalErrors: 0,
|
|
95
|
+
guidance: hasErrors ? 'Review the output above and fix the errors' : '',
|
|
96
|
+
errorSummary,
|
|
97
|
+
metadata: {
|
|
98
|
+
detection: {
|
|
99
|
+
extractor: 'generic',
|
|
100
|
+
confidence: 10,
|
|
101
|
+
patterns: ['Generic fallback'],
|
|
102
|
+
reason: 'Fallback extractor',
|
|
103
|
+
},
|
|
104
|
+
confidence: 50,
|
|
105
|
+
completeness: 50,
|
|
106
|
+
issues: [],
|
|
107
|
+
},
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Generic Extractor Plugin (Fallback)
|
|
112
|
+
*/
|
|
113
|
+
const genericExtractor = {
|
|
114
|
+
metadata: {
|
|
115
|
+
name: 'generic',
|
|
116
|
+
version: '1.0.0',
|
|
117
|
+
author: 'Jeff Dutton <jeff@duckcreek.com>',
|
|
118
|
+
description: 'Fallback extractor for unknown validation output formats',
|
|
119
|
+
repository: 'https://github.com/jdutton/vibe-validate',
|
|
120
|
+
tags: ['generic', 'fallback'],
|
|
121
|
+
},
|
|
122
|
+
hints: undefined, // No hints - accepts everything
|
|
123
|
+
priority: 10, // Lowest priority (fallback)
|
|
124
|
+
detect: detectGeneric,
|
|
125
|
+
extract: extractGeneric,
|
|
126
|
+
samples: [
|
|
127
|
+
{
|
|
128
|
+
name: 'python-pytest',
|
|
129
|
+
description: 'Python pytest output',
|
|
130
|
+
input: `FAILED tests/test_foo.py::test_divide - ZeroDivisionError
|
|
131
|
+
FAILED tests/test_bar.py::test_validate - AssertionError
|
|
132
|
+
2 failed, 3 passed`,
|
|
133
|
+
expected: {
|
|
134
|
+
totalErrors: 0, // Generic doesn't populate errors array
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
],
|
|
138
|
+
};
|
|
139
|
+
export default genericExtractor;
|
|
140
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/extractors/generic/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH;;GAEG;AACH,MAAM,cAAc,GAAG;IACrB,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,gBAAgB;IACrE,WAAW,EAAE,YAAY,EAAE,QAAQ,EAAE,QAAQ,EAAE,aAAa,EAAE,gBAAgB;IAC9E,iBAAiB,EAAE,mBAAmB,EAAE,qBAAqB;IAC7D,KAAK,EAAE,KAAK,EAAE,YAAY;CAC3B,CAAC;AAEF;;GAEG;AACH,MAAM,cAAc,GAAG;IACrB,IAAI;IACJ,UAAU;IACV,WAAW;IACX,YAAY;IACZ,cAAc;IACd,YAAY;IACZ,sBAAsB;IACtB,4BAA4B;CAC7B,CAAC;AAEF;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,OAAe;IAC3C,OAAO;QACL,UAAU,EAAE,EAAE,EAAE,kBAAkB;QAClC,QAAQ,EAAE,CAAC,kBAAkB,CAAC;QAC9B,MAAM,EAAE,wCAAwC;KACjD,CAAC;AACJ,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,cAAc,CAAC,MAAc,EAAE,QAAiB;IAC9D,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACjC,MAAM,aAAa,GAAa,EAAE,CAAC;IAEnC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;QAC5B,IAAI,OAAO,KAAK,EAAE;YAAE,SAAS;QAC7B,IAAI,cAAc,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAAE,SAAS;QA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ic/index.test.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generic Extractor Tests
|
|
3
|
+
*
|
|
4
|
+
* @package @vibe-validate/extractors
|
|
5
|
+
*/
|
|
6
|
+
import { describe, it, expect } from 'vitest';
|
|
7
|
+
import genericExtractor from './index.js';
|
|
8
|
+
const { extract: extractGenericErrors } = genericExtractor;
|
|
9
|
+
describe('Generic Extractor Plugin', () => {
|
|
10
|
+
describe('Python pytest output', () => {
|
|
11
|
+
it('should extract error lines from pytest output', () => {
|
|
12
|
+
const pytestOutput = `
|
|
13
|
+
FAILED tests/test_foo.py::test_divide - ZeroDivisionError
|
|
14
|
+
FAILED tests/test_bar.py::test_validate - AssertionError
|
|
15
|
+
2 failed, 3 passed
|
|
16
|
+
`;
|
|
17
|
+
const result = extractGenericErrors(pytestOutput);
|
|
18
|
+
expect(result.summary).toBe('Command failed - see output');
|
|
19
|
+
expect(result.errorSummary).toContain('FAILED');
|
|
20
|
+
expect(result.errorSummary).toContain('ZeroDivisionError');
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
describe('Go test output', () => {
|
|
24
|
+
it('should extract FAIL lines from Go output', () => {
|
|
25
|
+
const goOutput = `
|
|
26
|
+
--- FAIL: TestDivide (0.00s)
|
|
27
|
+
panic: runtime error
|
|
28
|
+
FAIL example.com/project 0.123s
|
|
29
|
+
`;
|
|
30
|
+
const result = extractGenericErrors(goOutput);
|
|
31
|
+
expect(result.errorSummary).toContain('FAIL: TestDivide');
|
|
32
|
+
expect(result.errorSummary).toContain('panic:');
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
describe('Token efficiency', () => {
|
|
36
|
+
it('should limit errorSummary to 20 lines max', () => {
|
|
37
|
+
const manyErrors = Array.from({ length: 50 }, (_, i) => `FAILED test${i}.py - Error`).join('\n');
|
|
38
|
+
const result = extractGenericErrors(manyErrors);
|
|
39
|
+
const lineCount = result.errorSummary.split('\n').length;
|
|
40
|
+
expect(lineCount).toBeLessThanOrEqual(20);
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
describe('Data integrity', () => {
|
|
44
|
+
it('should always have totalErrors = 0 (generic doesnt populate errors array)', () => {
|
|
45
|
+
const result = extractGenericErrors('FAILED test - error');
|
|
46
|
+
expect(result.totalErrors).toBe(0);
|
|
47
|
+
expect(result.errors).toEqual([]);
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
describe('Plugin Samples', () => {
|
|
51
|
+
it('should pass all registered samples', () => {
|
|
52
|
+
for (const sample of genericExtractor.samples) {
|
|
53
|
+
const result = extractGenericErrors(sample.input);
|
|
54
|
+
if (sample.expected.totalErrors !== undefined) {
|
|
55
|
+
expect(result.totalErrors).toBe(sample.expected.totalErrors);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
//# sourceMappingURL=index.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.test.js","sourceRoot":"","sources":["../../../src/extractors/generic/index.test.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,gBAAgB,MAAM,YAAY,CAAC;AAE1C,MAAM,EAAE,OAAO,EAAE,oBAAoB,EAAE,GAAG,gBAAgB,CAAC;AAE3D,QAAQ,CAAC,0BAA0B,EAAE,GAAG,EAAE;IACxC,QAAQ,CAAC,sBAAsB,EAAE,GAAG,EAAE;QACpC,EAAE,CAAC,+CAA+C,EAAE,GAAG,EAAE;YACvD,MAAM,YAAY,GAAG;;;;CAI1B,CAAC;YAEI,MAAM,MAAM,GAAG,oBAAoB,CAAC,YAAY,CAAC,CAAC;YAElD,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,6BAA6B,CAAC,CAAC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,GAAG,EAAE;YACnF,MAAM,MAAM,GAAG,oBAAoB,CAAC,qBAAqB,CAAC,CAAC;YAC3D,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YACnC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QACpC,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;QAC9B,EAAE,CAAC,oCAAoC,EAAE,GAAG,EAAE;YAC5C,KAAK,MAAM,MAAM,IAAI,gBAAgB,CAAC,OAAO,EAAE,CAAC;gBAC9C,MAAM,MAAM,GAAG,oBAAoB,CAAC,MAAM,CAAC,KAAM,CAAC,CAAC;gBACnD,IAAI,MAAM,CAAC,QAAS,CAAC,WAAW,KAAK,SAAS,EAAE,CAAC;oBAC/C,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,QAAS,CAAC,WAAW,CAAC,CAAC;gBAChE,CAAC;YACH,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Jasmine Error Extractor Plugin
|
|
3
|
+
*
|
|
4
|
+
* Parses and formats Jasmine test output for LLM consumption.
|
|
5
|
+
*
|
|
6
|
+
* @package @vibe-validate/extractors
|
|
7
|
+
*/
|
|
8
|
+
import type { ExtractorPlugin } from '../../types.js';
|
|
9
|
+
/**
|
|
10
|
+
* Jasmine Error Extractor Plugin
|
|
11
|
+
*
|
|
12
|
+
* Extracts Jasmine test framework errors with 85% confidence.
|
|
13
|
+
* Parses Message: and Stack: sections with structured format.
|
|
14
|
+
*/
|
|
15
|
+
declare const jasminePlugin: ExtractorPlugin;
|
|
16
|
+
export default jasminePlugin;
|
|
17
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/extractors/jasmine/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EACV,eAAe,EAIhB,MAAM,gBAAgB,CAAC;AA4OxB;;;;;GAKG;AACH,QAAA,MAAM,aAAa,EAAE,eAiBpB,CAAC;AAEF,eAAe,aAAa,CAAC"}
|