@auto-engineer/component-implementor-react 1.110.2 → 1.110.4

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 (96) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/.turbo/turbo-test.log +6 -6
  3. package/.turbo/turbo-type-check.log +1 -1
  4. package/CHANGELOG.md +32 -0
  5. package/dist/src/commands/implement-component.d.ts +5 -6
  6. package/dist/src/commands/implement-component.d.ts.map +1 -1
  7. package/dist/src/commands/implement-component.js +37 -9
  8. package/dist/src/commands/implement-component.js.map +1 -1
  9. package/dist/src/commands/implement-component.test.js +41 -54
  10. package/dist/src/commands/implement-component.test.js.map +1 -1
  11. package/dist/src/pipeline/run-pipeline.d.ts +25 -5
  12. package/dist/src/pipeline/run-pipeline.d.ts.map +1 -1
  13. package/dist/src/pipeline/run-pipeline.js +47 -17
  14. package/dist/src/pipeline/run-pipeline.js.map +1 -1
  15. package/dist/src/pipeline/run-pipeline.test.js +129 -29
  16. package/dist/src/pipeline/run-pipeline.test.js.map +1 -1
  17. package/dist/src/pipeline/steps/generate-component.test.js +5 -1
  18. package/dist/src/pipeline/steps/generate-component.test.js.map +1 -1
  19. package/dist/src/pipeline/steps/generate-story.test.js +5 -1
  20. package/dist/src/pipeline/steps/generate-story.test.js.map +1 -1
  21. package/dist/src/pipeline/steps/generate-test.test.js +5 -1
  22. package/dist/src/pipeline/steps/generate-test.test.js.map +1 -1
  23. package/dist/src/pipeline/steps/lint-fix-loop.d.ts +4 -0
  24. package/dist/src/pipeline/steps/lint-fix-loop.d.ts.map +1 -0
  25. package/dist/src/pipeline/steps/lint-fix-loop.js +46 -0
  26. package/dist/src/pipeline/steps/lint-fix-loop.js.map +1 -0
  27. package/dist/src/pipeline/steps/lint-fix-loop.test.d.ts +2 -0
  28. package/dist/src/pipeline/steps/lint-fix-loop.test.d.ts.map +1 -0
  29. package/dist/src/pipeline/steps/lint-fix-loop.test.js +123 -0
  30. package/dist/src/pipeline/steps/lint-fix-loop.test.js.map +1 -0
  31. package/dist/src/pipeline/steps/story-fix-loop.d.ts +4 -0
  32. package/dist/src/pipeline/steps/story-fix-loop.d.ts.map +1 -0
  33. package/dist/src/pipeline/steps/story-fix-loop.js +35 -0
  34. package/dist/src/pipeline/steps/story-fix-loop.js.map +1 -0
  35. package/dist/src/pipeline/steps/story-fix-loop.test.d.ts +2 -0
  36. package/dist/src/pipeline/steps/story-fix-loop.test.d.ts.map +1 -0
  37. package/dist/src/pipeline/steps/story-fix-loop.test.js +98 -0
  38. package/dist/src/pipeline/steps/story-fix-loop.test.js.map +1 -0
  39. package/dist/src/pipeline/steps/storybook-test.d.ts +3 -0
  40. package/dist/src/pipeline/steps/storybook-test.d.ts.map +1 -0
  41. package/dist/src/pipeline/steps/storybook-test.js +22 -0
  42. package/dist/src/pipeline/steps/storybook-test.js.map +1 -0
  43. package/dist/src/pipeline/steps/storybook-test.test.d.ts +2 -0
  44. package/dist/src/pipeline/steps/storybook-test.test.d.ts.map +1 -0
  45. package/dist/src/pipeline/steps/storybook-test.test.js +70 -0
  46. package/dist/src/pipeline/steps/storybook-test.test.js.map +1 -0
  47. package/dist/src/pipeline/steps/test-fix-loop.d.ts +4 -0
  48. package/dist/src/pipeline/steps/test-fix-loop.d.ts.map +1 -0
  49. package/dist/src/pipeline/steps/test-fix-loop.js +45 -0
  50. package/dist/src/pipeline/steps/test-fix-loop.js.map +1 -0
  51. package/dist/src/pipeline/steps/test-fix-loop.test.d.ts +2 -0
  52. package/dist/src/pipeline/steps/test-fix-loop.test.d.ts.map +1 -0
  53. package/dist/src/pipeline/steps/test-fix-loop.test.js +172 -0
  54. package/dist/src/pipeline/steps/test-fix-loop.test.js.map +1 -0
  55. package/dist/src/pipeline/steps/type-fix-loop.d.ts +4 -0
  56. package/dist/src/pipeline/steps/type-fix-loop.d.ts.map +1 -0
  57. package/dist/src/pipeline/steps/type-fix-loop.js +44 -0
  58. package/dist/src/pipeline/steps/type-fix-loop.js.map +1 -0
  59. package/dist/src/pipeline/steps/type-fix-loop.test.d.ts +2 -0
  60. package/dist/src/pipeline/steps/type-fix-loop.test.d.ts.map +1 -0
  61. package/dist/src/pipeline/steps/type-fix-loop.test.js +116 -0
  62. package/dist/src/pipeline/steps/type-fix-loop.test.js.map +1 -0
  63. package/dist/src/pipeline/steps/visual-test.d.ts +3 -0
  64. package/dist/src/pipeline/steps/visual-test.d.ts.map +1 -0
  65. package/dist/src/pipeline/steps/visual-test.js +4 -0
  66. package/dist/src/pipeline/steps/visual-test.js.map +1 -0
  67. package/dist/src/pipeline/steps/visual-test.test.d.ts +2 -0
  68. package/dist/src/pipeline/steps/visual-test.test.d.ts.map +1 -0
  69. package/dist/src/pipeline/steps/visual-test.test.js +9 -0
  70. package/dist/src/pipeline/steps/visual-test.test.js.map +1 -0
  71. package/dist/tsconfig.tsbuildinfo +1 -1
  72. package/package.json +3 -3
  73. package/src/commands/implement-component.test.ts +47 -57
  74. package/src/commands/implement-component.ts +51 -14
  75. package/src/pipeline/run-pipeline.test.ts +137 -32
  76. package/src/pipeline/run-pipeline.ts +74 -22
  77. package/src/pipeline/steps/generate-component.test.ts +5 -1
  78. package/src/pipeline/steps/generate-story.test.ts +5 -1
  79. package/src/pipeline/steps/generate-test.test.ts +5 -1
  80. package/src/pipeline/steps/lint-fix-loop.test.ts +159 -0
  81. package/src/pipeline/steps/lint-fix-loop.ts +60 -0
  82. package/src/pipeline/steps/story-fix-loop.test.ts +127 -0
  83. package/src/pipeline/steps/story-fix-loop.ts +48 -0
  84. package/src/pipeline/steps/storybook-test.test.ts +86 -0
  85. package/src/pipeline/steps/storybook-test.ts +27 -0
  86. package/src/pipeline/steps/test-fix-loop.test.ts +205 -0
  87. package/src/pipeline/steps/test-fix-loop.ts +57 -0
  88. package/src/pipeline/steps/type-fix-loop.test.ts +149 -0
  89. package/src/pipeline/steps/type-fix-loop.ts +56 -0
  90. package/src/pipeline/steps/visual-test.test.ts +10 -0
  91. package/src/pipeline/steps/visual-test.ts +5 -0
  92. package/dist/src/pipeline/steps/fix-from-feedback.d.ts +0 -4
  93. package/dist/src/pipeline/steps/fix-from-feedback.d.ts.map +0 -1
  94. package/dist/src/pipeline/steps/fix-from-feedback.js +0 -94
  95. package/dist/src/pipeline/steps/fix-from-feedback.js.map +0 -1
  96. 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
- }