@vibe-validate/extractors 0.16.1 → 0.17.0-rc.6

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.
Files changed (163) hide show
  1. package/dist/extractor-registry.d.ts +104 -0
  2. package/dist/extractor-registry.d.ts.map +1 -0
  3. package/dist/extractor-registry.js +278 -0
  4. package/dist/extractor-registry.js.map +1 -0
  5. package/dist/extractors/ava/index.d.ts +23 -0
  6. package/dist/extractors/ava/index.d.ts.map +1 -0
  7. package/dist/extractors/ava/index.js +507 -0
  8. package/dist/extractors/ava/index.js.map +1 -0
  9. package/dist/extractors/ava/index.test.d.ts +7 -0
  10. package/dist/extractors/ava/index.test.d.ts.map +1 -0
  11. package/dist/extractors/ava/index.test.js +408 -0
  12. package/dist/extractors/ava/index.test.js.map +1 -0
  13. package/dist/extractors/eslint/index.d.ts +18 -0
  14. package/dist/extractors/eslint/index.d.ts.map +1 -0
  15. package/dist/extractors/eslint/index.js +206 -0
  16. package/dist/extractors/eslint/index.js.map +1 -0
  17. package/dist/extractors/eslint/index.test.d.ts +9 -0
  18. package/dist/extractors/eslint/index.test.d.ts.map +1 -0
  19. package/dist/extractors/eslint/index.test.js +191 -0
  20. package/dist/extractors/eslint/index.test.js.map +1 -0
  21. package/dist/extractors/generic/index.d.ts +30 -0
  22. package/dist/extractors/generic/index.d.ts.map +1 -0
  23. package/dist/extractors/generic/index.js +140 -0
  24. package/dist/extractors/generic/index.js.map +1 -0
  25. package/dist/extractors/generic/index.test.d.ts +7 -0
  26. package/dist/extractors/generic/index.test.d.ts.map +1 -0
  27. package/dist/extractors/generic/index.test.js +61 -0
  28. package/dist/extractors/generic/index.test.js.map +1 -0
  29. package/dist/extractors/jasmine/index.d.ts +17 -0
  30. package/dist/extractors/jasmine/index.d.ts.map +1 -0
  31. package/dist/extractors/jasmine/index.js +242 -0
  32. package/dist/extractors/jasmine/index.js.map +1 -0
  33. package/dist/extractors/jasmine/index.test.d.ts +7 -0
  34. package/dist/extractors/jasmine/index.test.d.ts.map +1 -0
  35. package/dist/extractors/jasmine/index.test.js +318 -0
  36. package/dist/extractors/jasmine/index.test.js.map +1 -0
  37. package/dist/extractors/jest/index.d.ts +17 -0
  38. package/dist/extractors/jest/index.d.ts.map +1 -0
  39. package/dist/extractors/jest/index.js +273 -0
  40. package/dist/extractors/jest/index.js.map +1 -0
  41. package/dist/extractors/jest/index.test.d.ts +9 -0
  42. package/dist/extractors/jest/index.test.d.ts.map +1 -0
  43. package/dist/extractors/jest/index.test.js +338 -0
  44. package/dist/extractors/jest/index.test.js.map +1 -0
  45. package/dist/extractors/junit/index.d.ts +18 -0
  46. package/dist/extractors/junit/index.d.ts.map +1 -0
  47. package/dist/extractors/junit/index.js +259 -0
  48. package/dist/extractors/junit/index.js.map +1 -0
  49. package/dist/extractors/junit/index.test.d.ts +7 -0
  50. package/dist/extractors/junit/index.test.d.ts.map +1 -0
  51. package/dist/extractors/junit/index.test.js +341 -0
  52. package/dist/extractors/junit/index.test.js.map +1 -0
  53. package/dist/extractors/maven-checkstyle/index.d.ts +23 -0
  54. package/dist/extractors/maven-checkstyle/index.d.ts.map +1 -0
  55. package/dist/extractors/maven-checkstyle/index.js +263 -0
  56. package/dist/extractors/maven-checkstyle/index.js.map +1 -0
  57. package/dist/extractors/maven-checkstyle/index.test.d.ts +2 -0
  58. package/dist/extractors/maven-checkstyle/index.test.d.ts.map +1 -0
  59. package/dist/extractors/maven-checkstyle/index.test.js +197 -0
  60. package/dist/extractors/maven-checkstyle/index.test.js.map +1 -0
  61. package/dist/extractors/maven-compiler/index.d.ts +23 -0
  62. package/dist/extractors/maven-compiler/index.d.ts.map +1 -0
  63. package/dist/extractors/maven-compiler/index.js +271 -0
  64. package/dist/extractors/maven-compiler/index.js.map +1 -0
  65. package/dist/extractors/maven-compiler/index.test.d.ts +2 -0
  66. package/dist/extractors/maven-compiler/index.test.d.ts.map +1 -0
  67. package/dist/extractors/maven-compiler/index.test.js +189 -0
  68. package/dist/extractors/maven-compiler/index.test.js.map +1 -0
  69. package/dist/extractors/maven-surefire/index.d.ts +23 -0
  70. package/dist/extractors/maven-surefire/index.d.ts.map +1 -0
  71. package/dist/extractors/maven-surefire/index.js +292 -0
  72. package/dist/extractors/maven-surefire/index.js.map +1 -0
  73. package/dist/extractors/maven-surefire/index.test.d.ts +2 -0
  74. package/dist/extractors/maven-surefire/index.test.d.ts.map +1 -0
  75. package/dist/extractors/maven-surefire/index.test.js +163 -0
  76. package/dist/extractors/maven-surefire/index.test.js.map +1 -0
  77. package/dist/extractors/mocha/index.d.ts +17 -0
  78. package/dist/extractors/mocha/index.d.ts.map +1 -0
  79. package/dist/extractors/mocha/index.js +241 -0
  80. package/dist/extractors/mocha/index.js.map +1 -0
  81. package/dist/extractors/mocha/index.test.d.ts +7 -0
  82. package/dist/extractors/mocha/index.test.d.ts.map +1 -0
  83. package/dist/extractors/mocha/index.test.js +300 -0
  84. package/dist/extractors/mocha/index.test.js.map +1 -0
  85. package/dist/extractors/playwright/index.d.ts +17 -0
  86. package/dist/extractors/playwright/index.d.ts.map +1 -0
  87. package/dist/extractors/playwright/index.js +320 -0
  88. package/dist/extractors/playwright/index.js.map +1 -0
  89. package/dist/extractors/playwright/index.test.d.ts +7 -0
  90. package/dist/extractors/playwright/index.test.d.ts.map +1 -0
  91. package/dist/extractors/playwright/index.test.js +274 -0
  92. package/dist/extractors/playwright/index.test.js.map +1 -0
  93. package/dist/extractors/tap/index.d.ts +23 -0
  94. package/dist/extractors/tap/index.d.ts.map +1 -0
  95. package/dist/extractors/tap/index.js +352 -0
  96. package/dist/extractors/tap/index.js.map +1 -0
  97. package/dist/extractors/tap/index.test.d.ts +7 -0
  98. package/dist/extractors/tap/index.test.d.ts.map +1 -0
  99. package/dist/extractors/tap/index.test.js +100 -0
  100. package/dist/extractors/tap/index.test.js.map +1 -0
  101. package/dist/extractors/typescript/index.d.ts +17 -0
  102. package/dist/extractors/typescript/index.d.ts.map +1 -0
  103. package/dist/extractors/typescript/index.js +150 -0
  104. package/dist/extractors/typescript/index.js.map +1 -0
  105. package/dist/extractors/typescript/index.test.d.ts +9 -0
  106. package/dist/extractors/typescript/index.test.d.ts.map +1 -0
  107. package/dist/extractors/typescript/index.test.js +177 -0
  108. package/dist/extractors/typescript/index.test.js.map +1 -0
  109. package/dist/extractors/vitest/index.d.ts +17 -0
  110. package/dist/extractors/vitest/index.d.ts.map +1 -0
  111. package/dist/extractors/vitest/index.js +564 -0
  112. package/dist/extractors/vitest/index.js.map +1 -0
  113. package/dist/extractors/vitest/index.test.d.ts +9 -0
  114. package/dist/extractors/vitest/index.test.d.ts.map +1 -0
  115. package/dist/extractors/vitest/index.test.js +373 -0
  116. package/dist/extractors/vitest/index.test.js.map +1 -0
  117. package/dist/index.d.ts +27 -11
  118. package/dist/index.d.ts.map +1 -1
  119. package/dist/index.js +27 -11
  120. package/dist/index.js.map +1 -1
  121. package/dist/maven-checkstyle-extractor.d.ts +20 -0
  122. package/dist/maven-checkstyle-extractor.d.ts.map +1 -0
  123. package/dist/maven-checkstyle-extractor.js +208 -0
  124. package/dist/maven-checkstyle-extractor.js.map +1 -0
  125. package/dist/maven-compiler-extractor.d.ts +20 -0
  126. package/dist/maven-compiler-extractor.d.ts.map +1 -0
  127. package/dist/maven-compiler-extractor.js +218 -0
  128. package/dist/maven-compiler-extractor.js.map +1 -0
  129. package/dist/maven-surefire-extractor.d.ts +20 -0
  130. package/dist/maven-surefire-extractor.d.ts.map +1 -0
  131. package/dist/maven-surefire-extractor.js +228 -0
  132. package/dist/maven-surefire-extractor.js.map +1 -0
  133. package/dist/maven-utils.d.ts +24 -0
  134. package/dist/maven-utils.d.ts.map +1 -0
  135. package/dist/maven-utils.js +36 -0
  136. package/dist/maven-utils.js.map +1 -0
  137. package/dist/plugin-loader.d.ts +82 -0
  138. package/dist/plugin-loader.d.ts.map +1 -0
  139. package/dist/plugin-loader.js +200 -0
  140. package/dist/plugin-loader.js.map +1 -0
  141. package/dist/sandbox.d.ts +161 -0
  142. package/dist/sandbox.d.ts.map +1 -0
  143. package/dist/sandbox.js +254 -0
  144. package/dist/sandbox.js.map +1 -0
  145. package/dist/sandbox.test.d.ts +8 -0
  146. package/dist/sandbox.test.d.ts.map +1 -0
  147. package/dist/sandbox.test.js +395 -0
  148. package/dist/sandbox.test.js.map +1 -0
  149. package/dist/sandboxed-extractor.d.ts +46 -0
  150. package/dist/sandboxed-extractor.d.ts.map +1 -0
  151. package/dist/sandboxed-extractor.js +172 -0
  152. package/dist/sandboxed-extractor.js.map +1 -0
  153. package/dist/sandboxed-extractor.test.d.ts +5 -0
  154. package/dist/sandboxed-extractor.test.d.ts.map +1 -0
  155. package/dist/sandboxed-extractor.test.js +346 -0
  156. package/dist/sandboxed-extractor.test.js.map +1 -0
  157. package/dist/smart-extractor.d.ts +22 -10
  158. package/dist/smart-extractor.d.ts.map +1 -1
  159. package/dist/smart-extractor.js +116 -163
  160. package/dist/smart-extractor.js.map +1 -1
  161. package/dist/types.d.ts +94 -0
  162. package/dist/types.d.ts.map +1 -1
  163. package/package.json +1 -1
@@ -0,0 +1,352 @@
1
+ /**
2
+ * TAP Error Extractor Plugin
3
+ *
4
+ * Parses TAP (Test Anything Protocol) test output and formats failures for LLM consumption.
5
+ * Supports TAP version 13 and compatible test frameworks (tape, node-tap, etc.)
6
+ *
7
+ * @package @vibe-validate/extractors
8
+ */
9
+ import { formatCleanOutput } from '../../utils/formatter-utils.js';
10
+ import { generateGuidanceFromPatterns } from '../../utils/guidance-generator.js';
11
+ /**
12
+ * TAP-specific guidance patterns
13
+ * TAP uses detectErrorType() which returns specific keys, so we map those to guidance
14
+ */
15
+ const TAP_GUIDANCE_PATTERNS = [
16
+ {
17
+ key: 'assertion',
18
+ messageMatchers: ['expected', 'should'],
19
+ guidance: 'Review the assertion logic and expected vs actual values',
20
+ },
21
+ {
22
+ key: 'timeout',
23
+ messageMatchers: ['timeout', 'timed out'],
24
+ guidance: 'Increase timeout limit or optimize async operations',
25
+ },
26
+ {
27
+ key: 'file-not-found',
28
+ messageMatchers: ['enoent', 'no such file'],
29
+ guidance: 'Verify file path exists and permissions are correct',
30
+ },
31
+ {
32
+ key: 'type-error',
33
+ messageMatchers: ['cannot read properties', 'typeerror'],
34
+ guidance: 'Check for null/undefined values before accessing properties',
35
+ },
36
+ ];
37
+ /**
38
+ * Detects if output is from TAP protocol
39
+ */
40
+ // eslint-disable-next-line sonarjs/cognitive-complexity -- Complexity 16 acceptable for TAP detection (pattern scoring with multiple marker types)
41
+ export function detectTAP(output) {
42
+ const lines = output.split('\n');
43
+ let score = 0;
44
+ const foundPatterns = [];
45
+ let hasTAPVersion = false;
46
+ let hasNotOk = false;
47
+ let hasYAMLBlock = false;
48
+ let hasTestComment = false;
49
+ for (const line of lines) {
50
+ const trimmed = line.trim();
51
+ // High-value markers (30 points each)
52
+ if (!hasTAPVersion && /^TAP version \d+/.test(trimmed)) {
53
+ score += 30;
54
+ foundPatterns.push('TAP version header');
55
+ hasTAPVersion = true;
56
+ }
57
+ // Medium-value markers (20 points)
58
+ if (!hasNotOk && /^not ok \d+/.test(trimmed)) {
59
+ score += 20;
60
+ foundPatterns.push('not ok N failure marker');
61
+ hasNotOk = true;
62
+ }
63
+ if (!hasYAMLBlock && trimmed === '---') {
64
+ score += 15;
65
+ foundPatterns.push('YAML diagnostic block (---)');
66
+ hasYAMLBlock = true;
67
+ }
68
+ // Low-value markers (10 points)
69
+ if (!hasTestComment && trimmed.startsWith('# ')) {
70
+ score += 10;
71
+ foundPatterns.push('Test comment marker (#)');
72
+ hasTestComment = true;
73
+ }
74
+ }
75
+ // Determine reason based on score
76
+ let reason;
77
+ if (score >= 60) {
78
+ reason = 'TAP protocol output detected';
79
+ }
80
+ else if (score >= 30) {
81
+ reason = 'Possible TAP output';
82
+ }
83
+ else {
84
+ reason = 'Not TAP output';
85
+ }
86
+ return {
87
+ confidence: Math.min(score, 100),
88
+ patterns: foundPatterns,
89
+ reason,
90
+ };
91
+ }
92
+ /**
93
+ * Extract errors from TAP test output
94
+ */
95
+ export function extractTAP(output, _command) {
96
+ const detection = detectTAP(output);
97
+ if (detection.confidence < 30) {
98
+ return {
99
+ summary: 'Not TAP output',
100
+ totalErrors: 0,
101
+ errors: [],
102
+ metadata: {
103
+ detection: {
104
+ extractor: 'tap',
105
+ confidence: detection.confidence,
106
+ patterns: detection.patterns,
107
+ reason: detection.reason,
108
+ },
109
+ confidence: detection.confidence,
110
+ completeness: 100,
111
+ issues: [],
112
+ },
113
+ };
114
+ }
115
+ // Extract all failures
116
+ const failures = extractFailures(output);
117
+ if (failures.length === 0) {
118
+ return {
119
+ summary: '0 test(s) failed',
120
+ errors: [],
121
+ totalErrors: 0,
122
+ errorSummary: '',
123
+ guidance: '',
124
+ metadata: {
125
+ detection: {
126
+ extractor: 'tap',
127
+ confidence: detection.confidence,
128
+ patterns: detection.patterns,
129
+ reason: detection.reason,
130
+ },
131
+ confidence: 100,
132
+ completeness: 100,
133
+ issues: [],
134
+ },
135
+ };
136
+ }
137
+ const errors = [];
138
+ let completeCount = 0;
139
+ for (const failure of failures) {
140
+ const file = failure.file ?? undefined;
141
+ const message = failure.message ?? 'Test failed';
142
+ const context = failure.testName ?? '';
143
+ const isComplete = file && failure.line && message;
144
+ if (isComplete) {
145
+ completeCount++;
146
+ }
147
+ errors.push({
148
+ file,
149
+ line: failure.line,
150
+ message,
151
+ context,
152
+ guidance: failure.guidance,
153
+ });
154
+ }
155
+ // Generate summary
156
+ const summary = `${failures.length} test(s) failed`;
157
+ // Generate guidance using TAP-specific patterns
158
+ const guidance = generateGuidanceFromPatterns(failures, TAP_GUIDANCE_PATTERNS);
159
+ // Calculate quality metadata
160
+ const completeness = failures.length > 0 ? (completeCount / failures.length) * 100 : 100;
161
+ const confidence = failures.length > 0 ? 95 : 100; // High confidence for TAP
162
+ const metadata = {
163
+ detection: {
164
+ extractor: 'tap',
165
+ confidence: detection.confidence,
166
+ patterns: detection.patterns,
167
+ reason: detection.reason,
168
+ },
169
+ confidence,
170
+ completeness,
171
+ issues: [],
172
+ };
173
+ return {
174
+ summary,
175
+ errors,
176
+ totalErrors: failures.length,
177
+ errorSummary: formatCleanOutput(errors),
178
+ guidance,
179
+ metadata,
180
+ };
181
+ }
182
+ /**
183
+ * Extract all failures from TAP output
184
+ */
185
+ // eslint-disable-next-line sonarjs/cognitive-complexity -- Complexity 17 acceptable for TAP output parsing (handles test comments, failure markers, and YAML diagnostic blocks)
186
+ function extractFailures(output) {
187
+ const failures = [];
188
+ const lines = output.split('\n');
189
+ let currentTestName = '';
190
+ let i = 0;
191
+ while (i < lines.length) {
192
+ const line = lines[i];
193
+ // Track test names from comments
194
+ if (line.trim().startsWith('#')) {
195
+ currentTestName = line.trim().substring(1).trim();
196
+ i++;
197
+ continue;
198
+ }
199
+ // Look for failures: "not ok N message"
200
+ // eslint-disable-next-line sonarjs/slow-regex -- Safe: only parses TAP test framework output (controlled output), not user input
201
+ const failureMatch = /^not ok\s+\d+\s+(.+)$/.exec(line);
202
+ if (failureMatch) {
203
+ const message = failureMatch[1].trim();
204
+ const failure = {
205
+ message,
206
+ testName: currentTestName,
207
+ };
208
+ // Look for YAML diagnostic block (starts with " ---")
209
+ if (i + 1 < lines.length && lines[i + 1].trim() === '---') {
210
+ i += 2; // Skip "not ok" line and "---" line
211
+ // Parse YAML block until we hit "..."
212
+ while (i < lines.length && !lines[i].trim().startsWith('...')) {
213
+ const yamlLine = lines[i];
214
+ // Extract location from "at:" field
215
+ // Format: "at: Test.<anonymous> (file:///path/to/file.js:line:col)"
216
+ // or: "at: file.js:line:col"
217
+ // eslint-disable-next-line sonarjs/slow-regex -- Safe: only parses TAP test framework YAML diagnostics (controlled output), not user input
218
+ const atMatch = /^\s+at:\s+(.+)$/.exec(yamlLine);
219
+ if (atMatch) {
220
+ const location = atMatch[1];
221
+ const { file, line } = parseLocation(location);
222
+ if (file)
223
+ failure.file = file;
224
+ if (line)
225
+ failure.line = line;
226
+ }
227
+ i++;
228
+ }
229
+ }
230
+ // Detect error type and add guidance
231
+ const errorType = detectErrorType(message);
232
+ failure.errorType = errorType;
233
+ failure.guidance = getErrorGuidance(errorType);
234
+ failures.push(failure);
235
+ }
236
+ i++;
237
+ }
238
+ return failures;
239
+ }
240
+ /**
241
+ * Parse location string to extract file and line number
242
+ *
243
+ * Handles formats:
244
+ * - Test.<anonymous> (file:///path/to/file.js:28:5)
245
+ * - Test.<anonymous> (./path/to/file.js:28:5)
246
+ * - file.js:28:5
247
+ */
248
+ function parseLocation(location) {
249
+ // Try to extract from parentheses first: (file:///path:line:col) or (path:line:col)
250
+ // eslint-disable-next-line sonarjs/slow-regex -- Safe: only parses TAP test framework location strings (controlled output), not user input
251
+ const parenMatch = /\(([^)]+)\)/.exec(location);
252
+ const pathString = parenMatch ? parenMatch[1] : location;
253
+ // Remove file:// protocol if present
254
+ const cleanPath = pathString.replace(/^file:\/\//, '');
255
+ // Extract file path and line number
256
+ // Format: /path/to/file.js:line:col or path/to/file.js:line:col
257
+ const match = /^(.+):(\d+):\d+$/.exec(cleanPath);
258
+ if (match) {
259
+ return {
260
+ file: match[1],
261
+ line: Number.parseInt(match[2], 10),
262
+ };
263
+ }
264
+ return {};
265
+ }
266
+ /**
267
+ * Detect error type from message
268
+ */
269
+ function detectErrorType(message) {
270
+ const lowerMessage = message.toLowerCase();
271
+ if (lowerMessage.includes('timeout') || lowerMessage.includes('timed out')) {
272
+ return 'timeout';
273
+ }
274
+ if (lowerMessage.includes('enoent') || lowerMessage.includes('no such file')) {
275
+ return 'file-not-found';
276
+ }
277
+ if (lowerMessage.includes('cannot read properties') || lowerMessage.includes('typeerror')) {
278
+ return 'type-error';
279
+ }
280
+ if (lowerMessage.includes('expected') || lowerMessage.includes('should')) {
281
+ return 'assertion';
282
+ }
283
+ return 'unknown';
284
+ }
285
+ /**
286
+ * Get guidance for a specific error type
287
+ */
288
+ function getErrorGuidance(errorType) {
289
+ const pattern = TAP_GUIDANCE_PATTERNS.find((p) => p.key === errorType);
290
+ return pattern?.guidance;
291
+ }
292
+ /**
293
+ * TAP Extractor Plugin
294
+ */
295
+ const tapExtractor = {
296
+ metadata: {
297
+ name: 'tap',
298
+ version: '1.0.0',
299
+ author: 'Jeff Dutton <jeff@duckcreek.com>',
300
+ description: 'Extracts test failures from TAP (Test Anything Protocol) output',
301
+ repository: 'https://github.com/jdutton/vibe-validate',
302
+ tags: ['tap', 'test', 'tape', 'node-tap'],
303
+ },
304
+ hints: {
305
+ anyOf: ['not ok', 'TAP version', '---'],
306
+ },
307
+ priority: 78,
308
+ detect: detectTAP,
309
+ extract: extractTAP,
310
+ samples: [
311
+ {
312
+ name: 'basic-failure',
313
+ description: 'Simple TAP failure with YAML diagnostics',
314
+ // NOSONAR -- /tmp path is part of test fixture sample data, not actual temporary file creation or manipulation
315
+ input: `TAP version 13
316
+ # Test › should pass assertion
317
+ not ok 1 should have 5 errors
318
+ ---
319
+ operator: equal
320
+ expected: 5
321
+ actual: 1
322
+ at: Test.<anonymous> (file:///tmp/test.js:28:5)
323
+ stack: |-
324
+ Error: should have 5 errors
325
+ at Test.assert [as _assert] (/path/to/tape/lib/test.js:492:48)
326
+ at Test.<anonymous> (file:///tmp/test.js:28:5)
327
+ ...
328
+ `,
329
+ expected: {
330
+ totalErrors: 1,
331
+ errors: [
332
+ {
333
+ // eslint-disable-next-line sonarjs/publicly-writable-directories -- /tmp path is part of test fixture sample data, not actual temporary file creation
334
+ file: '/tmp/test.js',
335
+ line: 28,
336
+ message: 'should have 5 errors',
337
+ },
338
+ ],
339
+ },
340
+ },
341
+ {
342
+ name: 'comprehensive-failures',
343
+ description: 'Real TAP comprehensive failure output',
344
+ inputFile: './samples/comprehensive-failures-001.txt',
345
+ expected: {
346
+ totalErrors: 15,
347
+ },
348
+ },
349
+ ],
350
+ };
351
+ export default tapExtractor;
352
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/extractors/tap/index.ts"],"names":[],"mappings":"AAAA;;;;;;;G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E,KAAK;QACX,OAAO,EAAE,OAAO;QAChB,MAAM,EAAE,kCAAkC;QAC1C,WAAW,EAAE,iEAAiE;QAC9E,UAAU,EAAE,0CAA0C;QACtD,IAAI,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,CAAC;KAC1C;IAED,KAAK,EAAE;QACL,KAAK,EAAE,CAAC,QAAQ,EAAE,aAAa,EAAE,KAAK,CAAC;KACxC;IAED,QAAQ,EAAE,EAAE;IAEZ,MAAM,EAAE,SAAS;IACjB,OAAO,EAAE,UAAU;IAEnB,OAAO,EAAE;QACP;YACE,IAAI,EAAE,eAAe;YACrB,WAAW,EAAE,0CAA0C;YACvD,+GAA+G;YAC/G,KAAK,EAAE;;;;;;;;;;;;;CAaZ;YACK,QAAQ,EAAE;gBACR,WAAW,EAAE,CAAC;gBACd,MAAM,EAAE;oBACN;wBACE,sJAAsJ;wBACtJ,IAAI,EAAE,cAAc;wBACpB,IAAI,EAAE,EAAE;wBACR,OAAO,EAAE,sBAAsB;qBAChC;iBACF;aACF;SACF;QACD;YACE,IAAI,EAAE,wBAAwB;YAC9B,WAAW,EAAE,uCAAuC;YACpD,SAAS,EAAE,0CAA0C;YACrD,QAAQ,EAAE;gBACR,WAAW,EAAE,EAAE;aAChB;SACF;KACF;CACF,CAAC;AAEF,eAAe,YAAY,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * TAP Error Extractor Tests
3
+ *
4
+ * @package @vibe-validate/extractors
5
+ */
6
+ export {};
7
+ //# sourceMappingURL=index.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../../../src/extractors/tap/index.test.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
@@ -0,0 +1,100 @@
1
+ /**
2
+ * TAP Error Extractor Tests
3
+ *
4
+ * @package @vibe-validate/extractors
5
+ */
6
+ import { describe, it, expect } from 'vitest';
7
+ import tapExtractor from './index.js';
8
+ import { readFileSync } from 'node:fs';
9
+ import { join, dirname } from 'node:path';
10
+ import { fileURLToPath } from 'node:url';
11
+ const __filename = fileURLToPath(import.meta.url);
12
+ const __dirname = dirname(__filename);
13
+ const { extract: extractTAPErrors, detect: detectTAP } = tapExtractor;
14
+ describe('TAP Extractor Plugin', () => {
15
+ describe('Detection', () => {
16
+ it('should detect TAP output with high confidence', () => {
17
+ const input = `TAP version 13
18
+ not ok 1 test failed
19
+ ---
20
+ at: test.js:10:5
21
+ ...
22
+ `;
23
+ const result = detectTAP(input);
24
+ expect(result.confidence).toBeGreaterThanOrEqual(60);
25
+ expect(result.patterns).toContain('TAP version header');
26
+ });
27
+ it('should reject non-TAP output', () => {
28
+ const input = `
29
+ PASS tests/test.js
30
+ ✓ test passes
31
+ `;
32
+ const result = detectTAP(input);
33
+ expect(result.confidence).toBeLessThan(30);
34
+ });
35
+ });
36
+ describe('Basic Extraction', () => {
37
+ it('should extract single test failure from TAP output', () => {
38
+ // NOSONAR -- /tmp path is part of test fixture sample data, not actual temporary file creation
39
+ const input = `TAP version 13
40
+ # Test › should pass assertion
41
+ not ok 1 should have 5 errors
42
+ ---
43
+ operator: equal
44
+ expected: 5
45
+ actual: 1
46
+ at: Test.<anonymous> (file:///tmp/test.js:28:5)
47
+ ...
48
+ `;
49
+ const result = extractTAPErrors(input);
50
+ expect(result.summary).toBe('1 test(s) failed');
51
+ expect(result.errors).toHaveLength(1);
52
+ expect(result.errors[0]).toMatchObject({
53
+ // eslint-disable-next-line sonarjs/publicly-writable-directories -- /tmp path is part of test fixture sample data, not actual temporary file creation
54
+ file: '/tmp/test.js',
55
+ line: 28,
56
+ message: 'should have 5 errors',
57
+ });
58
+ });
59
+ it('should extract multiple test failures', () => {
60
+ const input = `TAP version 13
61
+ # Test 1
62
+ not ok 1 first error
63
+ ---
64
+ at: Test.<anonymous> (test.js:10:5)
65
+ ...
66
+ # Test 2
67
+ not ok 2 second error
68
+ ---
69
+ at: Test.<anonymous> (test.js:20:5)
70
+ ...
71
+ `;
72
+ const result = extractTAPErrors(input);
73
+ expect(result.summary).toBe('2 test(s) failed');
74
+ expect(result.errors).toHaveLength(2);
75
+ expect(result.errors[0].line).toBe(10);
76
+ expect(result.errors[1].line).toBe(20);
77
+ });
78
+ });
79
+ describe('Comprehensive Sample', () => {
80
+ it('should extract all failures from comprehensive sample', () => {
81
+ const samplePath = join(__dirname, 'samples', 'comprehensive-failures-001.txt');
82
+ const input = readFileSync(samplePath, 'utf8');
83
+ const result = extractTAPErrors(input);
84
+ expect(result.errors.length).toBeGreaterThanOrEqual(10);
85
+ expect(result.metadata.confidence).toBeGreaterThanOrEqual(80);
86
+ });
87
+ });
88
+ describe('Plugin Samples', () => {
89
+ it('should pass all registered samples', () => {
90
+ for (const sample of tapExtractor.samples) {
91
+ const input = sample.input ?? readFileSync(join(__dirname, sample.inputFile), 'utf-8');
92
+ const result = extractTAPErrors(input);
93
+ if (sample.expected.totalErrors !== undefined) {
94
+ expect(result.totalErrors).toBe(sample.expected.totalErrors);
95
+ }
96
+ }
97
+ });
98
+ });
99
+ });
100
+ //# sourceMappingURL=index.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.test.js","sourceRoot":"","sources":["../../../src/extractors/tap/index.test.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,YAAY,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAEtC,MAAM,EAAE,OAAO,EAAE,g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G,EAAE;QAC9B,EAAE,CAAC,oCAAoC,EAAE,GAAG,EAAE;YAC5C,KAAK,MAAM,MAAM,IAAI,YAAY,CAAC,OAAO,EAAE,CAAC;gBAC1C,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,IAAI,YAAY,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,SAAU,CAAC,EAAE,OAAO,CAAC,CAAC;gBACxF,MAAM,MAAM,GAAG,gBAAgB,CAAC,KAAK,CAAC,CAAC;gBAEvC,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
+ * TypeScript Error Extractor Plugin
3
+ *
4
+ * Parses and formats TypeScript compiler (tsc) error output for LLM consumption.
5
+ *
6
+ * @package @vibe-validate/extractors
7
+ */
8
+ import type { ExtractorPlugin } from '../../types.js';
9
+ /**
10
+ * TypeScript Error Extractor Plugin
11
+ *
12
+ * Extracts TypeScript compiler errors with high confidence (95%).
13
+ * Supports both old (file(line,col)) and new (file:line:col) formats.
14
+ */
15
+ declare const typescriptPlugin: ExtractorPlugin;
16
+ export default typescriptPlugin;
17
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/extractors/typescript/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EACV,eAAe,EAKhB,MAAM,gBAAgB,CAAC;AAsIxB;;;;;GAKG;AACH,QAAA,MAAM,gBAAgB,EAAE,eAiBvB,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
@@ -0,0 +1,150 @@
1
+ /**
2
+ * TypeScript Error Extractor Plugin
3
+ *
4
+ * Parses and formats TypeScript compiler (tsc) error output for LLM consumption.
5
+ *
6
+ * @package @vibe-validate/extractors
7
+ */
8
+ import { MAX_ERRORS_IN_ARRAY } from '../../result-schema.js';
9
+ /**
10
+ * Generate TypeScript-specific guidance based on error codes
11
+ *
12
+ * @param errors - Parsed TypeScript errors
13
+ * @returns Actionable guidance string
14
+ */
15
+ function getTypeScriptGuidance(errors) {
16
+ const errorCodes = new Set(errors.map((e) => e.code));
17
+ const guidance = [];
18
+ if (errorCodes.has('TS2322')) {
19
+ guidance.push('Type mismatch - check variable/parameter types');
20
+ }
21
+ if (errorCodes.has('TS2304')) {
22
+ guidance.push('Cannot find name - check imports and type definitions');
23
+ }
24
+ if (errorCodes.has('TS2345')) {
25
+ guidance.push('Argument type mismatch - check function signatures');
26
+ }
27
+ if (guidance.length === 0) {
28
+ return 'Fix TypeScript type errors in listed files';
29
+ }
30
+ return guidance.join('. ');
31
+ }
32
+ /**
33
+ * Extract TypeScript compiler errors from output
34
+ *
35
+ * @param output - Raw tsc command output
36
+ * @returns Structured error information with TypeScript-specific guidance
37
+ */
38
+ function extract(output) {
39
+ const errors = [];
40
+ // TypeScript error patterns - support both old and new formats:
41
+ // Old: file(line,col): error TSxxxx: message
42
+ // New: file:line:col - error TSxxxx: message
43
+ // eslint-disable-next-line sonarjs/slow-regex -- Safe: only parses TypeScript compiler output (controlled tool output), not user input
44
+ const oldPattern = /^(.+?)\((\d+),(\d+)\):\s*(error|warning)\s+(TS\d+):\s+(.+)$/gm;
45
+ // eslint-disable-next-line sonarjs/slow-regex -- Safe: only parses TypeScript compiler output (controlled tool output), not user input
46
+ const newPattern = /^(.+?):(\d+):(\d+)\s+-\s*(error|warning)\s+(TS\d+):\s+(.+)$/gm;
47
+ // Try new format first (more common in modern tsc)
48
+ let match;
49
+ while ((match = newPattern.exec(output)) !== null) {
50
+ errors.push({
51
+ file: match[1].trim(),
52
+ line: Number.parseInt(match[2]),
53
+ column: Number.parseInt(match[3]),
54
+ severity: match[4],
55
+ code: match[5],
56
+ message: match[6].trim(),
57
+ });
58
+ }
59
+ // Try old format if no matches yet
60
+ if (errors.length === 0) {
61
+ while ((match = oldPattern.exec(output)) !== null) {
62
+ errors.push({
63
+ file: match[1].trim(),
64
+ line: Number.parseInt(match[2]),
65
+ column: Number.parseInt(match[3]),
66
+ severity: match[4],
67
+ code: match[5],
68
+ message: match[6].trim(),
69
+ });
70
+ }
71
+ }
72
+ const errorCount = errors.filter((e) => e.severity === 'error').length;
73
+ const warningCount = errors.filter((e) => e.severity === 'warning').length;
74
+ // Build error summary (limit to MAX_ERRORS_IN_ARRAY for token efficiency)
75
+ const errorSummary = errors
76
+ .slice(0, MAX_ERRORS_IN_ARRAY)
77
+ .map((e) => `${e.file}:${e.line}:${e.column} - ${e.code}: ${e.message}`)
78
+ .join('\n');
79
+ return {
80
+ errors: errors.slice(0, MAX_ERRORS_IN_ARRAY),
81
+ summary: `${errorCount} type error(s), ${warningCount} warning(s)`,
82
+ totalErrors: errors.length,
83
+ guidance: getTypeScriptGuidance(errors),
84
+ errorSummary,
85
+ };
86
+ }
87
+ /**
88
+ * Detect if output is from TypeScript compiler
89
+ *
90
+ * @param output - Command output to analyze
91
+ * @returns Detection result with confidence and patterns
92
+ */
93
+ function detect(output) {
94
+ const match = /error TS\d+:/.exec(output);
95
+ if (match) {
96
+ return {
97
+ confidence: 95,
98
+ patterns: ['error TS#### pattern'],
99
+ reason: 'TypeScript compiler error format detected',
100
+ };
101
+ }
102
+ return { confidence: 0, patterns: [], reason: '' };
103
+ }
104
+ /**
105
+ * Sample test cases for TypeScript extractor
106
+ */
107
+ const samples = [
108
+ {
109
+ name: 'single-type-error',
110
+ description: 'Single TypeScript type mismatch error',
111
+ input: `src/index.ts(10,5): error TS2322: Type 'string' is not assignable to type 'number'.`,
112
+ expectedErrors: 1,
113
+ expectedPatterns: ['TS2322', 'Type mismatch'],
114
+ },
115
+ {
116
+ name: 'multiple-errors-with-warning',
117
+ description: 'Multiple TypeScript errors with one warning',
118
+ input: `src/index.ts(10,5): error TS2322: Type 'string' is not assignable to type 'number'.
119
+ src/config.ts(25,12): error TS2304: Cannot find name 'process'.
120
+ src/utils.ts(100,3): warning TS6133: 'unusedVar' is declared but never used.`,
121
+ expectedErrors: 3,
122
+ expectedPatterns: ['TS2322', 'TS2304', 'TS6133'],
123
+ },
124
+ ];
125
+ /**
126
+ * TypeScript Error Extractor Plugin
127
+ *
128
+ * Extracts TypeScript compiler errors with high confidence (95%).
129
+ * Supports both old (file(line,col)) and new (file:line:col) formats.
130
+ */
131
+ const typescriptPlugin = {
132
+ metadata: {
133
+ name: 'typescript',
134
+ version: '1.0.0',
135
+ author: 'vibe-validate',
136
+ description: 'Extracts TypeScript compiler (tsc) errors',
137
+ repository: 'https://github.com/jdutton/vibe-validate',
138
+ tags: ['typescript', 'compiler', 'type-checking'],
139
+ },
140
+ hints: {
141
+ required: ['error TS'],
142
+ anyOf: [],
143
+ },
144
+ priority: 95,
145
+ detect,
146
+ extract,
147
+ samples,
148
+ };
149
+ export default typescriptPlugin;
150
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/extractors/typescript/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AASH,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAE7D;;;;;GAKG;AACH,SAAS,qBAAqB,CAAC,MAAwB;IACrD,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;IACtD,MAAM,QAAQ,GAAa,EAAE,CAAC;IAE9B,IAAI,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC7B,QAAQ,CAAC,IAAI,CAAC,gDAAgD,CAAC,CAAC;IAClE,CAAC;IAED,I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