@auto-engineer/component-implementor-react 1.110.2 → 1.110.3
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/.turbo/turbo-build.log +1 -1
- package/.turbo/turbo-test.log +6 -6
- package/.turbo/turbo-type-check.log +1 -1
- package/CHANGELOG.md +19 -0
- package/dist/src/commands/implement-component.d.ts +5 -6
- package/dist/src/commands/implement-component.d.ts.map +1 -1
- package/dist/src/commands/implement-component.js +37 -9
- package/dist/src/commands/implement-component.js.map +1 -1
- package/dist/src/commands/implement-component.test.js +41 -54
- package/dist/src/commands/implement-component.test.js.map +1 -1
- package/dist/src/pipeline/run-pipeline.d.ts +25 -5
- package/dist/src/pipeline/run-pipeline.d.ts.map +1 -1
- package/dist/src/pipeline/run-pipeline.js +47 -17
- package/dist/src/pipeline/run-pipeline.js.map +1 -1
- package/dist/src/pipeline/run-pipeline.test.js +129 -29
- package/dist/src/pipeline/run-pipeline.test.js.map +1 -1
- package/dist/src/pipeline/steps/generate-component.test.js +5 -1
- package/dist/src/pipeline/steps/generate-component.test.js.map +1 -1
- package/dist/src/pipeline/steps/generate-story.test.js +5 -1
- package/dist/src/pipeline/steps/generate-story.test.js.map +1 -1
- package/dist/src/pipeline/steps/generate-test.test.js +5 -1
- package/dist/src/pipeline/steps/generate-test.test.js.map +1 -1
- package/dist/src/pipeline/steps/lint-fix-loop.d.ts +4 -0
- package/dist/src/pipeline/steps/lint-fix-loop.d.ts.map +1 -0
- package/dist/src/pipeline/steps/lint-fix-loop.js +46 -0
- package/dist/src/pipeline/steps/lint-fix-loop.js.map +1 -0
- package/dist/src/pipeline/steps/lint-fix-loop.test.d.ts +2 -0
- package/dist/src/pipeline/steps/lint-fix-loop.test.d.ts.map +1 -0
- package/dist/src/pipeline/steps/lint-fix-loop.test.js +123 -0
- package/dist/src/pipeline/steps/lint-fix-loop.test.js.map +1 -0
- package/dist/src/pipeline/steps/story-fix-loop.d.ts +4 -0
- package/dist/src/pipeline/steps/story-fix-loop.d.ts.map +1 -0
- package/dist/src/pipeline/steps/story-fix-loop.js +35 -0
- package/dist/src/pipeline/steps/story-fix-loop.js.map +1 -0
- package/dist/src/pipeline/steps/story-fix-loop.test.d.ts +2 -0
- package/dist/src/pipeline/steps/story-fix-loop.test.d.ts.map +1 -0
- package/dist/src/pipeline/steps/story-fix-loop.test.js +98 -0
- package/dist/src/pipeline/steps/story-fix-loop.test.js.map +1 -0
- package/dist/src/pipeline/steps/storybook-test.d.ts +3 -0
- package/dist/src/pipeline/steps/storybook-test.d.ts.map +1 -0
- package/dist/src/pipeline/steps/storybook-test.js +22 -0
- package/dist/src/pipeline/steps/storybook-test.js.map +1 -0
- package/dist/src/pipeline/steps/storybook-test.test.d.ts +2 -0
- package/dist/src/pipeline/steps/storybook-test.test.d.ts.map +1 -0
- package/dist/src/pipeline/steps/storybook-test.test.js +70 -0
- package/dist/src/pipeline/steps/storybook-test.test.js.map +1 -0
- package/dist/src/pipeline/steps/test-fix-loop.d.ts +4 -0
- package/dist/src/pipeline/steps/test-fix-loop.d.ts.map +1 -0
- package/dist/src/pipeline/steps/test-fix-loop.js +45 -0
- package/dist/src/pipeline/steps/test-fix-loop.js.map +1 -0
- package/dist/src/pipeline/steps/test-fix-loop.test.d.ts +2 -0
- package/dist/src/pipeline/steps/test-fix-loop.test.d.ts.map +1 -0
- package/dist/src/pipeline/steps/test-fix-loop.test.js +172 -0
- package/dist/src/pipeline/steps/test-fix-loop.test.js.map +1 -0
- package/dist/src/pipeline/steps/type-fix-loop.d.ts +4 -0
- package/dist/src/pipeline/steps/type-fix-loop.d.ts.map +1 -0
- package/dist/src/pipeline/steps/type-fix-loop.js +44 -0
- package/dist/src/pipeline/steps/type-fix-loop.js.map +1 -0
- package/dist/src/pipeline/steps/type-fix-loop.test.d.ts +2 -0
- package/dist/src/pipeline/steps/type-fix-loop.test.d.ts.map +1 -0
- package/dist/src/pipeline/steps/type-fix-loop.test.js +116 -0
- package/dist/src/pipeline/steps/type-fix-loop.test.js.map +1 -0
- package/dist/src/pipeline/steps/visual-test.d.ts +3 -0
- package/dist/src/pipeline/steps/visual-test.d.ts.map +1 -0
- package/dist/src/pipeline/steps/visual-test.js +4 -0
- package/dist/src/pipeline/steps/visual-test.js.map +1 -0
- package/dist/src/pipeline/steps/visual-test.test.d.ts +2 -0
- package/dist/src/pipeline/steps/visual-test.test.d.ts.map +1 -0
- package/dist/src/pipeline/steps/visual-test.test.js +9 -0
- package/dist/src/pipeline/steps/visual-test.test.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/src/commands/implement-component.test.ts +47 -57
- package/src/commands/implement-component.ts +51 -14
- package/src/pipeline/run-pipeline.test.ts +137 -32
- package/src/pipeline/run-pipeline.ts +74 -22
- package/src/pipeline/steps/generate-component.test.ts +5 -1
- package/src/pipeline/steps/generate-story.test.ts +5 -1
- package/src/pipeline/steps/generate-test.test.ts +5 -1
- package/src/pipeline/steps/lint-fix-loop.test.ts +159 -0
- package/src/pipeline/steps/lint-fix-loop.ts +60 -0
- package/src/pipeline/steps/story-fix-loop.test.ts +127 -0
- package/src/pipeline/steps/story-fix-loop.ts +48 -0
- package/src/pipeline/steps/storybook-test.test.ts +86 -0
- package/src/pipeline/steps/storybook-test.ts +27 -0
- package/src/pipeline/steps/test-fix-loop.test.ts +205 -0
- package/src/pipeline/steps/test-fix-loop.ts +57 -0
- package/src/pipeline/steps/type-fix-loop.test.ts +149 -0
- package/src/pipeline/steps/type-fix-loop.ts +56 -0
- package/src/pipeline/steps/visual-test.test.ts +10 -0
- package/src/pipeline/steps/visual-test.ts +5 -0
- package/dist/src/pipeline/steps/fix-from-feedback.d.ts +0 -4
- package/dist/src/pipeline/steps/fix-from-feedback.d.ts.map +0 -1
- package/dist/src/pipeline/steps/fix-from-feedback.js +0 -94
- package/dist/src/pipeline/steps/fix-from-feedback.js.map +0 -1
- package/src/pipeline/steps/fix-from-feedback.ts +0 -105
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import { readFile, writeFile } from 'node:fs/promises';
|
|
2
|
-
import type { LanguageModel } from 'ai';
|
|
3
|
-
import { generateText } from 'ai';
|
|
4
|
-
import { extractCodeBlocks } from '../../extract-code-block';
|
|
5
|
-
import { buildLintFixPrompt, buildTestFixPrompt, buildTypeFixPrompt } from '../../prompt';
|
|
6
|
-
import type { PipelineContext, StepResult } from '../run-pipeline';
|
|
7
|
-
|
|
8
|
-
type ErrorCategory = 'type' | 'test' | 'lint' | 'mixed';
|
|
9
|
-
|
|
10
|
-
function categorizeErrors(errorFeedback: string): ErrorCategory {
|
|
11
|
-
const hasTypeError = /error TS\d+|type.*error|typescript/i.test(errorFeedback);
|
|
12
|
-
const hasTestFailure = /test.*fail|vitest|expect.*to|assertion/i.test(errorFeedback);
|
|
13
|
-
const hasLintError = /lint|biome|eslint/i.test(errorFeedback);
|
|
14
|
-
|
|
15
|
-
const categories = [hasTypeError, hasTestFailure, hasLintError].filter(Boolean).length;
|
|
16
|
-
|
|
17
|
-
if (categories > 1) return 'mixed';
|
|
18
|
-
if (hasTypeError) return 'type';
|
|
19
|
-
if (hasTestFailure) return 'test';
|
|
20
|
-
if (hasLintError) return 'lint';
|
|
21
|
-
|
|
22
|
-
// Default to test errors if we can't categorize
|
|
23
|
-
return 'test';
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export async function fixFromFeedbackStep(model: LanguageModel, ctx: PipelineContext): Promise<StepResult> {
|
|
27
|
-
if (!ctx.errorFeedback) {
|
|
28
|
-
return { success: true };
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
// Read existing files
|
|
32
|
-
const componentCode = await readFile(ctx.componentPath, 'utf-8');
|
|
33
|
-
const testCode = await readFile(ctx.testPath, 'utf-8');
|
|
34
|
-
|
|
35
|
-
ctx.componentCode = componentCode;
|
|
36
|
-
ctx.testCode = testCode;
|
|
37
|
-
|
|
38
|
-
const errorCategory = categorizeErrors(ctx.errorFeedback);
|
|
39
|
-
|
|
40
|
-
let system: string;
|
|
41
|
-
let prompt: string;
|
|
42
|
-
|
|
43
|
-
switch (errorCategory) {
|
|
44
|
-
case 'type': {
|
|
45
|
-
const typePrompt = buildTypeFixPrompt({
|
|
46
|
-
componentCode,
|
|
47
|
-
testCode,
|
|
48
|
-
errors: [ctx.errorFeedback],
|
|
49
|
-
});
|
|
50
|
-
system = typePrompt.system;
|
|
51
|
-
prompt = typePrompt.prompt;
|
|
52
|
-
break;
|
|
53
|
-
}
|
|
54
|
-
case 'test': {
|
|
55
|
-
const testPrompt = buildTestFixPrompt({
|
|
56
|
-
componentCode,
|
|
57
|
-
testCode,
|
|
58
|
-
failures: [ctx.errorFeedback],
|
|
59
|
-
testOutput: ctx.errorFeedback,
|
|
60
|
-
});
|
|
61
|
-
system = testPrompt.system;
|
|
62
|
-
prompt = testPrompt.prompt;
|
|
63
|
-
break;
|
|
64
|
-
}
|
|
65
|
-
case 'lint': {
|
|
66
|
-
const lintPrompt = buildLintFixPrompt({
|
|
67
|
-
componentCode,
|
|
68
|
-
testCode,
|
|
69
|
-
errors: [ctx.errorFeedback],
|
|
70
|
-
});
|
|
71
|
-
system = lintPrompt.system;
|
|
72
|
-
prompt = lintPrompt.prompt;
|
|
73
|
-
break;
|
|
74
|
-
}
|
|
75
|
-
case 'mixed':
|
|
76
|
-
default: {
|
|
77
|
-
// For mixed errors, use test fix prompt (most comprehensive)
|
|
78
|
-
const mixedPrompt = buildTestFixPrompt({
|
|
79
|
-
componentCode,
|
|
80
|
-
testCode,
|
|
81
|
-
failures: [ctx.errorFeedback],
|
|
82
|
-
testOutput: ctx.errorFeedback,
|
|
83
|
-
});
|
|
84
|
-
system = mixedPrompt.system;
|
|
85
|
-
prompt = mixedPrompt.prompt;
|
|
86
|
-
break;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
const { text } = await generateText({ model, system, prompt });
|
|
91
|
-
ctx.llmCalls++;
|
|
92
|
-
|
|
93
|
-
const blocks = extractCodeBlocks(text);
|
|
94
|
-
if (blocks.length >= 2) {
|
|
95
|
-
ctx.componentCode = blocks[0];
|
|
96
|
-
ctx.testCode = blocks[1];
|
|
97
|
-
await writeFile(ctx.componentPath, blocks[0], 'utf-8');
|
|
98
|
-
await writeFile(ctx.testPath, blocks[1], 'utf-8');
|
|
99
|
-
} else if (blocks.length === 1) {
|
|
100
|
-
ctx.componentCode = blocks[0];
|
|
101
|
-
await writeFile(ctx.componentPath, blocks[0], 'utf-8');
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
return { success: true };
|
|
105
|
-
}
|