@auto-engineer/component-implementor-react 1.98.0 → 1.100.0
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 +92 -0
- package/dist/src/commands/implement-component.d.ts +19 -0
- package/dist/src/commands/implement-component.d.ts.map +1 -1
- package/dist/src/commands/implement-component.js +109 -30
- package/dist/src/commands/implement-component.js.map +1 -1
- package/dist/src/commands/implement-component.test.js +259 -69
- package/dist/src/commands/implement-component.test.js.map +1 -1
- package/dist/src/extract-exports.d.ts +6 -0
- package/dist/src/extract-exports.d.ts.map +1 -0
- package/dist/src/extract-exports.js +46 -0
- package/dist/src/extract-exports.js.map +1 -0
- package/dist/src/generate-story-deterministic.d.ts +30 -0
- package/dist/src/generate-story-deterministic.d.ts.map +1 -0
- package/dist/src/generate-story-deterministic.js +229 -0
- package/dist/src/generate-story-deterministic.js.map +1 -0
- package/dist/src/index.d.ts +4 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +3 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/pipeline/run-pipeline.d.ts +69 -0
- package/dist/src/pipeline/run-pipeline.d.ts.map +1 -0
- package/dist/src/pipeline/run-pipeline.js +78 -0
- package/dist/src/pipeline/run-pipeline.js.map +1 -0
- package/dist/src/pipeline/run-pipeline.test.d.ts +2 -0
- package/dist/src/pipeline/run-pipeline.test.d.ts.map +1 -0
- package/dist/src/pipeline/run-pipeline.test.js +247 -0
- package/dist/src/pipeline/run-pipeline.test.js.map +1 -0
- package/dist/src/pipeline/steps/generate-component.d.ts +4 -0
- package/dist/src/pipeline/steps/generate-component.d.ts.map +1 -0
- package/dist/src/pipeline/steps/generate-component.js +50 -0
- package/dist/src/pipeline/steps/generate-component.js.map +1 -0
- package/dist/src/pipeline/steps/generate-component.test.d.ts.map +1 -0
- package/dist/src/pipeline/steps/generate-component.test.js +106 -0
- package/dist/src/pipeline/steps/generate-component.test.js.map +1 -0
- package/dist/src/pipeline/steps/generate-story.d.ts +3 -0
- package/dist/src/pipeline/steps/generate-story.d.ts.map +1 -0
- package/dist/src/pipeline/steps/generate-story.js +14 -0
- package/dist/src/pipeline/steps/generate-story.js.map +1 -0
- package/dist/src/pipeline/steps/generate-story.test.d.ts.map +1 -0
- package/dist/src/pipeline/steps/generate-story.test.js +41 -0
- package/dist/src/pipeline/steps/generate-story.test.js.map +1 -0
- package/dist/src/pipeline/steps/generate-test.d.ts +4 -0
- package/dist/src/pipeline/steps/generate-test.d.ts.map +1 -0
- package/dist/src/pipeline/steps/generate-test.js +19 -0
- package/dist/src/pipeline/steps/generate-test.js.map +1 -0
- package/dist/src/pipeline/steps/generate-test.test.d.ts.map +1 -0
- package/dist/src/pipeline/steps/generate-test.test.js +60 -0
- package/dist/src/pipeline/steps/generate-test.test.js.map +1 -0
- 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 +45 -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 +119 -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 +34 -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 +94 -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 +66 -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 +44 -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 +168 -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 +43 -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 +112 -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/src/project-context.d.ts +10 -0
- package/dist/src/project-context.d.ts.map +1 -0
- package/dist/src/project-context.js +178 -0
- package/dist/src/project-context.js.map +1 -0
- package/dist/src/prompt.d.ts +39 -7
- package/dist/src/prompt.d.ts.map +1 -1
- package/dist/src/prompt.js +233 -23
- package/dist/src/prompt.js.map +1 -1
- package/dist/src/prompt.test.js +154 -9
- package/dist/src/prompt.test.js.map +1 -1
- package/dist/src/scaffold.d.ts +49 -0
- package/dist/src/scaffold.d.ts.map +1 -0
- package/dist/src/scaffold.js +208 -0
- package/dist/src/scaffold.js.map +1 -0
- package/dist/src/tools/lint-runner.d.ts +7 -0
- package/dist/src/tools/lint-runner.d.ts.map +1 -0
- package/dist/src/tools/lint-runner.js +48 -0
- package/dist/src/tools/lint-runner.js.map +1 -0
- package/dist/src/tools/lint-runner.test.d.ts +2 -0
- package/dist/src/tools/lint-runner.test.d.ts.map +1 -0
- package/dist/src/tools/lint-runner.test.js +90 -0
- package/dist/src/tools/lint-runner.test.js.map +1 -0
- package/dist/src/tools/storybook-runner.d.ts +6 -0
- package/dist/src/tools/storybook-runner.d.ts.map +1 -0
- package/dist/src/tools/storybook-runner.js +25 -0
- package/dist/src/tools/storybook-runner.js.map +1 -0
- package/dist/src/tools/storybook-runner.test.d.ts +2 -0
- package/dist/src/tools/storybook-runner.test.d.ts.map +1 -0
- package/dist/src/tools/storybook-runner.test.js +43 -0
- package/dist/src/tools/storybook-runner.test.js.map +1 -0
- package/dist/src/tools/test-runner.d.ts +9 -0
- package/dist/src/tools/test-runner.d.ts.map +1 -0
- package/dist/src/tools/test-runner.js +74 -0
- package/dist/src/tools/test-runner.js.map +1 -0
- package/dist/src/tools/test-runner.test.d.ts +2 -0
- package/dist/src/tools/test-runner.test.d.ts.map +1 -0
- package/dist/src/tools/test-runner.test.js +177 -0
- package/dist/src/tools/test-runner.test.js.map +1 -0
- package/dist/src/tools/type-checker.d.ts +6 -0
- package/dist/src/tools/type-checker.d.ts.map +1 -0
- package/dist/src/tools/type-checker.js +36 -0
- package/dist/src/tools/type-checker.js.map +1 -0
- package/dist/src/tools/type-checker.test.d.ts +2 -0
- package/dist/src/tools/type-checker.test.d.ts.map +1 -0
- package/dist/src/tools/type-checker.test.js +96 -0
- package/dist/src/tools/type-checker.test.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/inputs/model-a/spec-deltas.json +1460 -0
- package/inputs/model-b/spec-deltas.json +1424 -0
- package/inputs/model-c/spec-deltas.json +1432 -0
- package/inputs/model-d/spec-deltas.json +967 -0
- package/inputs/model-e/spec-deltas.json +2292 -0
- package/ketchup-plan.md +43 -8
- package/package.json +3 -3
- package/scoring-heuristic.md +138 -0
- package/scripts/improve.ts +23 -18
- package/src/commands/implement-component.test.ts +309 -76
- package/src/commands/implement-component.ts +155 -31
- package/src/extract-exports.ts +53 -0
- package/src/generate-story-deterministic.ts +267 -0
- package/src/index.ts +12 -0
- package/src/pipeline/run-pipeline.test.ts +292 -0
- package/src/pipeline/run-pipeline.ts +160 -0
- package/src/pipeline/steps/generate-component.test.ts +130 -0
- package/src/pipeline/steps/generate-component.ts +60 -0
- package/src/pipeline/steps/generate-story.test.ts +54 -0
- package/src/pipeline/steps/generate-story.ts +17 -0
- package/src/pipeline/steps/generate-test.test.ts +75 -0
- package/src/pipeline/steps/generate-test.ts +25 -0
- package/src/pipeline/steps/lint-fix-loop.test.ts +155 -0
- package/src/pipeline/steps/lint-fix-loop.ts +59 -0
- package/src/pipeline/steps/story-fix-loop.test.ts +123 -0
- package/src/pipeline/steps/story-fix-loop.ts +47 -0
- package/src/pipeline/steps/storybook-test.test.ts +82 -0
- package/src/pipeline/steps/storybook-test.ts +27 -0
- package/src/pipeline/steps/test-fix-loop.test.ts +201 -0
- package/src/pipeline/steps/test-fix-loop.ts +56 -0
- package/src/pipeline/steps/type-fix-loop.test.ts +145 -0
- package/src/pipeline/steps/type-fix-loop.ts +55 -0
- package/src/pipeline/steps/visual-test.test.ts +10 -0
- package/src/pipeline/steps/visual-test.ts +5 -0
- package/src/project-context.ts +205 -0
- package/src/prompt.test.ts +174 -8
- package/src/prompt.ts +301 -23
- package/src/scaffold.ts +281 -0
- package/src/tools/lint-runner.test.ts +112 -0
- package/src/tools/lint-runner.ts +52 -0
- package/src/tools/storybook-runner.test.ts +53 -0
- package/src/tools/storybook-runner.ts +29 -0
- package/src/tools/test-runner.test.ts +213 -0
- package/src/tools/test-runner.ts +84 -0
- package/src/tools/type-checker.test.ts +120 -0
- package/src/tools/type-checker.ts +42 -0
- package/vitest.config.ts +9 -1
- package/dist/src/generate-component.d.ts +0 -4
- package/dist/src/generate-component.d.ts.map +0 -1
- package/dist/src/generate-component.js +0 -14
- package/dist/src/generate-component.js.map +0 -1
- package/dist/src/generate-component.test.d.ts.map +0 -1
- package/dist/src/generate-component.test.js +0 -73
- package/dist/src/generate-component.test.js.map +0 -1
- package/dist/src/generate-story.d.ts +0 -4
- package/dist/src/generate-story.d.ts.map +0 -1
- package/dist/src/generate-story.js +0 -14
- package/dist/src/generate-story.js.map +0 -1
- package/dist/src/generate-story.test.d.ts.map +0 -1
- package/dist/src/generate-story.test.js +0 -58
- package/dist/src/generate-story.test.js.map +0 -1
- package/dist/src/generate-test.d.ts +0 -4
- package/dist/src/generate-test.d.ts.map +0 -1
- package/dist/src/generate-test.js +0 -14
- package/dist/src/generate-test.js.map +0 -1
- package/dist/src/generate-test.test.d.ts.map +0 -1
- package/dist/src/generate-test.test.js +0 -77
- package/dist/src/generate-test.test.js.map +0 -1
- package/dist/src/reconcile.d.ts +0 -8
- package/dist/src/reconcile.d.ts.map +0 -1
- package/dist/src/reconcile.js +0 -18
- package/dist/src/reconcile.js.map +0 -1
- package/dist/src/reconcile.test.d.ts +0 -2
- package/dist/src/reconcile.test.d.ts.map +0 -1
- package/dist/src/reconcile.test.js +0 -108
- package/dist/src/reconcile.test.js.map +0 -1
- package/src/generate-component.test.ts +0 -89
- package/src/generate-component.ts +0 -16
- package/src/generate-story.test.ts +0 -71
- package/src/generate-story.ts +0 -16
- package/src/generate-test.test.ts +0 -93
- package/src/generate-test.ts +0 -16
- package/src/reconcile.test.ts +0 -127
- package/src/reconcile.ts +0 -27
- /package/dist/src/{generate-component.test.d.ts → pipeline/steps/generate-component.test.d.ts} +0 -0
- /package/dist/src/{generate-story.test.d.ts → pipeline/steps/generate-story.test.d.ts} +0 -0
- /package/dist/src/{generate-test.test.d.ts → pipeline/steps/generate-test.test.d.ts} +0 -0
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
// ═══════════════════════════════════════════════════════════════════
|
|
2
|
+
// Deterministic story generator — no LLM call, pure template logic
|
|
3
|
+
// ═══════════════════════════════════════════════════════════════════
|
|
4
|
+
/**
|
|
5
|
+
* Generates a Storybook CSF3 story file deterministically (no LLM call).
|
|
6
|
+
*
|
|
7
|
+
* Uses structured prop data and optional story variants to emit a complete
|
|
8
|
+
* `.stories.tsx` file string. When no variants are provided, a Default
|
|
9
|
+
* story is synthesized from the props with sensible placeholder values.
|
|
10
|
+
*/
|
|
11
|
+
export function generateStoryDeterministic(input) {
|
|
12
|
+
const { componentName, componentImportPath, props, storyVariants } = input;
|
|
13
|
+
const lines = [];
|
|
14
|
+
// ── Imports ──────────────────────────────────────────────────────
|
|
15
|
+
lines.push(`import type { Meta, StoryObj } from '@storybook/react-vite';`);
|
|
16
|
+
lines.push(`import { ${componentName} } from '${componentImportPath}';`);
|
|
17
|
+
lines.push('');
|
|
18
|
+
// ── Meta ─────────────────────────────────────────────────────────
|
|
19
|
+
lines.push(`const meta: Meta<typeof ${componentName}> = {`);
|
|
20
|
+
lines.push(` title: 'UI Components/${componentName}',`);
|
|
21
|
+
lines.push(` component: ${componentName},`);
|
|
22
|
+
lines.push(`};`);
|
|
23
|
+
lines.push(`export default meta;`);
|
|
24
|
+
lines.push('');
|
|
25
|
+
// ── Story type alias ─────────────────────────────────────────────
|
|
26
|
+
lines.push(`type Story = StoryObj<typeof ${componentName}>;`);
|
|
27
|
+
// ── Stories ──────────────────────────────────────────────────────
|
|
28
|
+
if (storyVariants && storyVariants.length > 0) {
|
|
29
|
+
for (const variant of storyVariants) {
|
|
30
|
+
lines.push('');
|
|
31
|
+
lines.push(`export const ${variant.name}: Story = {`);
|
|
32
|
+
const argsBlock = serializeArgs(variant.args);
|
|
33
|
+
if (argsBlock) {
|
|
34
|
+
lines.push(` args: {`);
|
|
35
|
+
lines.push(argsBlock);
|
|
36
|
+
lines.push(` },`);
|
|
37
|
+
}
|
|
38
|
+
lines.push(`};`);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
// Derive a Default story from props
|
|
43
|
+
const defaultArgs = deriveDefaultArgs(props ?? []);
|
|
44
|
+
lines.push('');
|
|
45
|
+
lines.push(`export const Default: Story = {`);
|
|
46
|
+
const argsBlock = serializeArgs(defaultArgs);
|
|
47
|
+
if (argsBlock) {
|
|
48
|
+
lines.push(` args: {`);
|
|
49
|
+
lines.push(argsBlock);
|
|
50
|
+
lines.push(` },`);
|
|
51
|
+
}
|
|
52
|
+
lines.push(`};`);
|
|
53
|
+
}
|
|
54
|
+
lines.push('');
|
|
55
|
+
return lines.join('\n');
|
|
56
|
+
}
|
|
57
|
+
// ═══════════════════════════════════════════════════════════════════
|
|
58
|
+
// Internals
|
|
59
|
+
// ═══════════════════════════════════════════════════════════════════
|
|
60
|
+
/**
|
|
61
|
+
* Derives sensible default arg values from structured prop definitions.
|
|
62
|
+
*
|
|
63
|
+
* - `callback` props are omitted (Storybook auto-detects them via argTypes).
|
|
64
|
+
* - `slot` props are omitted (ReactNode cannot be serialized to args).
|
|
65
|
+
* - `data` props get placeholder values based on their TypeScript type.
|
|
66
|
+
* - `visual` props use the declared default if present, otherwise a placeholder.
|
|
67
|
+
* - `state` props default to `false`.
|
|
68
|
+
* - `config` props use the declared default if present, otherwise a placeholder.
|
|
69
|
+
*/
|
|
70
|
+
function deriveDefaultArgs(props) {
|
|
71
|
+
const args = {};
|
|
72
|
+
for (const prop of props) {
|
|
73
|
+
// Skip categories that cannot or should not be serialized in args
|
|
74
|
+
if (prop.category === 'callback' || prop.category === 'slot') {
|
|
75
|
+
continue;
|
|
76
|
+
}
|
|
77
|
+
if (prop.category === 'state') {
|
|
78
|
+
args[prop.name] = false;
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
// If a default is declared, try to use it
|
|
82
|
+
if (prop.default !== undefined) {
|
|
83
|
+
const parsed = parseDefaultValue(prop.default);
|
|
84
|
+
if (parsed !== undefined) {
|
|
85
|
+
args[prop.name] = parsed;
|
|
86
|
+
continue;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
// Otherwise generate a placeholder based on the TypeScript type string
|
|
90
|
+
args[prop.name] = placeholderForType(prop.type);
|
|
91
|
+
}
|
|
92
|
+
return args;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Attempts to parse a default value string into a JS primitive.
|
|
96
|
+
* Returns `undefined` when the string cannot be meaningfully parsed
|
|
97
|
+
* (e.g. an arrow function or complex expression).
|
|
98
|
+
*/
|
|
99
|
+
function parseDefaultValue(raw) {
|
|
100
|
+
const trimmed = raw.trim();
|
|
101
|
+
if (trimmed === 'true')
|
|
102
|
+
return true;
|
|
103
|
+
if (trimmed === 'false')
|
|
104
|
+
return false;
|
|
105
|
+
if (trimmed === 'null')
|
|
106
|
+
return null;
|
|
107
|
+
if (trimmed === 'undefined')
|
|
108
|
+
return undefined;
|
|
109
|
+
// Quoted string
|
|
110
|
+
const stringMatch = trimmed.match(/^['"](.*)['"]$/);
|
|
111
|
+
if (stringMatch)
|
|
112
|
+
return stringMatch[1];
|
|
113
|
+
// Numeric
|
|
114
|
+
const num = Number(trimmed);
|
|
115
|
+
if (!Number.isNaN(num) && trimmed !== '')
|
|
116
|
+
return num;
|
|
117
|
+
// Array or object literal — attempt JSON parse
|
|
118
|
+
if (trimmed.startsWith('[') || trimmed.startsWith('{')) {
|
|
119
|
+
try {
|
|
120
|
+
return JSON.parse(trimmed);
|
|
121
|
+
}
|
|
122
|
+
catch {
|
|
123
|
+
return undefined;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
// Anything else (functions, expressions) → skip
|
|
127
|
+
return undefined;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Returns a sensible placeholder value for a given TypeScript type string.
|
|
131
|
+
*/
|
|
132
|
+
function placeholderForType(typeStr) {
|
|
133
|
+
const t = typeStr.trim();
|
|
134
|
+
if (t === 'string')
|
|
135
|
+
return 'Example';
|
|
136
|
+
if (t === 'number')
|
|
137
|
+
return 42;
|
|
138
|
+
if (t === 'boolean')
|
|
139
|
+
return true;
|
|
140
|
+
// Union of string literals — pick the first literal
|
|
141
|
+
const literalUnion = t.match(/^['"]([^'"]+)['"]/);
|
|
142
|
+
if (literalUnion)
|
|
143
|
+
return literalUnion[1];
|
|
144
|
+
// Array types
|
|
145
|
+
if (t.endsWith('[]') || t.startsWith('Array<'))
|
|
146
|
+
return [];
|
|
147
|
+
// Generic object / Record
|
|
148
|
+
if (t === 'object' || t.startsWith('Record<') || t.startsWith('{'))
|
|
149
|
+
return {};
|
|
150
|
+
// Fallback
|
|
151
|
+
return undefined;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Serializes an args record into indented TypeScript object body lines.
|
|
155
|
+
* Returns an empty string when the args record is empty (caller should
|
|
156
|
+
* omit the `args` block entirely).
|
|
157
|
+
*
|
|
158
|
+
* Each value is formatted as a valid TypeScript literal:
|
|
159
|
+
* - strings → quoted
|
|
160
|
+
* - numbers / booleans → as-is
|
|
161
|
+
* - arrays / plain objects → JSON.stringify
|
|
162
|
+
* - undefined, null, functions → skipped
|
|
163
|
+
*/
|
|
164
|
+
function serializeArgs(args) {
|
|
165
|
+
const entries = [];
|
|
166
|
+
for (const [key, value] of Object.entries(args)) {
|
|
167
|
+
const formatted = formatArgValue(value);
|
|
168
|
+
if (formatted === null)
|
|
169
|
+
continue;
|
|
170
|
+
entries.push(` ${key}: ${formatted},`);
|
|
171
|
+
}
|
|
172
|
+
return entries.join('\n');
|
|
173
|
+
}
|
|
174
|
+
function formatArgValue(value) {
|
|
175
|
+
if (value === undefined)
|
|
176
|
+
return null;
|
|
177
|
+
if (value === null)
|
|
178
|
+
return null;
|
|
179
|
+
if (typeof value === 'function')
|
|
180
|
+
return null;
|
|
181
|
+
if (typeof value === 'string') {
|
|
182
|
+
// Callback strings like "() => {}" — emit as raw JS, not quoted
|
|
183
|
+
if (/^\s*\(/.test(value) || /^\s*function\s*\(/.test(value)) {
|
|
184
|
+
return value;
|
|
185
|
+
}
|
|
186
|
+
return JSON.stringify(value);
|
|
187
|
+
}
|
|
188
|
+
if (typeof value === 'number')
|
|
189
|
+
return String(value);
|
|
190
|
+
if (typeof value === 'boolean')
|
|
191
|
+
return String(value);
|
|
192
|
+
// Arrays and plain objects — deep-fix stringified JSON values first
|
|
193
|
+
if (Array.isArray(value) || typeof value === 'object') {
|
|
194
|
+
const fixed = deepParseStringifiedJson(value);
|
|
195
|
+
return JSON.stringify(fixed);
|
|
196
|
+
}
|
|
197
|
+
return null;
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Recursively walks a value and parses any string that looks like
|
|
201
|
+
* stringified JSON back into an actual object/array. This fixes
|
|
202
|
+
* FEA output where nested objects are accidentally double-stringified.
|
|
203
|
+
*/
|
|
204
|
+
function deepParseStringifiedJson(value) {
|
|
205
|
+
if (typeof value === 'string') {
|
|
206
|
+
const trimmed = value.trim();
|
|
207
|
+
if ((trimmed.startsWith('{') && trimmed.endsWith('}')) || (trimmed.startsWith('[') && trimmed.endsWith(']'))) {
|
|
208
|
+
try {
|
|
209
|
+
return deepParseStringifiedJson(JSON.parse(trimmed));
|
|
210
|
+
}
|
|
211
|
+
catch {
|
|
212
|
+
return value;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
return value;
|
|
216
|
+
}
|
|
217
|
+
if (Array.isArray(value)) {
|
|
218
|
+
return value.map(deepParseStringifiedJson);
|
|
219
|
+
}
|
|
220
|
+
if (value !== null && typeof value === 'object') {
|
|
221
|
+
const result = {};
|
|
222
|
+
for (const [k, v] of Object.entries(value)) {
|
|
223
|
+
result[k] = deepParseStringifiedJson(v);
|
|
224
|
+
}
|
|
225
|
+
return result;
|
|
226
|
+
}
|
|
227
|
+
return value;
|
|
228
|
+
}
|
|
229
|
+
//# sourceMappingURL=generate-story-deterministic.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-story-deterministic.js","sourceRoot":"","sources":["../../src/generate-story-deterministic.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,mEAAmE;AACnE,sEAAsE;AA0BtE;;;;;;GAMG;AACH,MAAM,UAAU,0BAA0B,CAAC,KAA8B;IACvE,MAAM,EAAE,aAAa,EAAE,mBAAmB,EAAE,KAAK,EAAE,aAAa,EAAE,GAAG,KAAK,CAAC;IAE3E,MAAM,KAAK,GAAa,EAAE,CAAC;IAE3B,oEAAoE;IACpE,KAAK,CAAC,IAAI,CAAC,8DAA8D,CAAC,CAAC;IAC3E,KAAK,CAAC,IAAI,CAAC,YAAY,aAAa,YAAY,mBAAmB,IAAI,CAAC,CAAC;IACzE,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAEf,oEAAoE;IACpE,KAAK,CAAC,IAAI,CAAC,2BAA2B,aAAa,OAAO,CAAC,CAAC;IAC5D,KAAK,CAAC,IAAI,CAAC,2BAA2B,aAAa,IAAI,CAAC,CAAC;IACzD,KAAK,CAAC,IAAI,CAAC,gBAAgB,aAAa,GAAG,CAAC,CAAC;IAC7C,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACjB,KAAK,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;IACnC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAEf,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MAAM,CAAC;IAChB,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
|
package/dist/src/index.d.ts
CHANGED
|
@@ -9,4 +9,8 @@ export declare const COMMANDS: import("@auto-engineer/message-bus").UnifiedComma
|
|
|
9
9
|
export { implementComponentHandler };
|
|
10
10
|
export type { ComponentImplementationFailedEvent, ComponentImplementedEvent, ImplementComponentCommand, ImplementComponentEvents, } from './commands/implement-component';
|
|
11
11
|
export { handleImplementComponent } from './commands/implement-component';
|
|
12
|
+
export { generateStoryDeterministic } from './generate-story-deterministic';
|
|
13
|
+
export type { ModelConfig, PipelineConfig, PipelineContext, PipelineModels, PipelineResult, PipelineStep, StepResult, } from './pipeline/run-pipeline';
|
|
14
|
+
export { buildPipelineSteps, runPipeline } from './pipeline/run-pipeline';
|
|
15
|
+
export { generateScaffold } from './scaffold';
|
|
12
16
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,IAAI,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAE7F,eAAO,MAAM,QAAQ;;;;;;KAA8B,CAAC;AACpD,OAAO,EAAE,yBAAyB,EAAE,CAAC;AACrC,YAAY,EACV,kCAAkC,EAClC,yBAAyB,EACzB,yBAAyB,EACzB,wBAAwB,GACzB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,IAAI,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAE7F,eAAO,MAAM,QAAQ;;;;;;KAA8B,CAAC;AACpD,OAAO,EAAE,yBAAyB,EAAE,CAAC;AACrC,YAAY,EACV,kCAAkC,EAClC,yBAAyB,EACzB,yBAAyB,EACzB,wBAAwB,GACzB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAC1E,OAAO,EAAE,0BAA0B,EAAE,MAAM,gCAAgC,CAAC;AAC5E,YAAY,EACV,WAAW,EACX,cAAc,EACd,eAAe,EACf,cAAc,EACd,cAAc,EACd,YAAY,EACZ,UAAU,GACX,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/src/index.js
CHANGED
|
@@ -2,4 +2,7 @@ import { commandHandler as implementComponentHandler } from './commands/implemen
|
|
|
2
2
|
export const COMMANDS = [implementComponentHandler];
|
|
3
3
|
export { implementComponentHandler };
|
|
4
4
|
export { handleImplementComponent } from './commands/implement-component.js';
|
|
5
|
+
export { generateStoryDeterministic } from './generate-story-deterministic.js';
|
|
6
|
+
export { buildPipelineSteps, runPipeline } from './pipeline/run-pipeline.js';
|
|
7
|
+
export { generateScaffold } from './scaffold.js';
|
|
5
8
|
//# sourceMappingURL=index.js.map
|
package/dist/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,IAAI,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAE7F,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,yBAAyB,CAAC,CAAC;AACpD,OAAO,EAAE,yBAAyB,EAAE,CAAC;AAOrC,OAAO,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,IAAI,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAE7F,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,yBAAyB,CAAC,CAAC;AACpD,OAAO,EAAE,yBAAyB,EAAE,CAAC;AAOrC,OAAO,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAC1E,OAAO,EAAE,0BAA0B,EAAE,MAAM,gCAAgC,CAAC;AAU5E,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { LanguageModel } from 'ai';
|
|
2
|
+
import type { DeterministicStoryProp, StoryVariant } from '../generate-story-deterministic';
|
|
3
|
+
import type { SpecDeltas } from '../spec-contract';
|
|
4
|
+
export type StepResult = {
|
|
5
|
+
success: boolean;
|
|
6
|
+
error?: string;
|
|
7
|
+
};
|
|
8
|
+
export type PipelineStep = {
|
|
9
|
+
name: string;
|
|
10
|
+
run: () => Promise<StepResult>;
|
|
11
|
+
};
|
|
12
|
+
export type PipelineContext = {
|
|
13
|
+
componentName: string;
|
|
14
|
+
componentPath: string;
|
|
15
|
+
testPath: string;
|
|
16
|
+
storyPath: string;
|
|
17
|
+
componentImportPath: string;
|
|
18
|
+
targetDir: string;
|
|
19
|
+
specDeltas: SpecDeltas;
|
|
20
|
+
projectSection: string;
|
|
21
|
+
props?: DeterministicStoryProp[];
|
|
22
|
+
composes: Array<{
|
|
23
|
+
id: string;
|
|
24
|
+
path: string;
|
|
25
|
+
}>;
|
|
26
|
+
existingComponent?: string;
|
|
27
|
+
existingTest?: string;
|
|
28
|
+
isModify: boolean;
|
|
29
|
+
storyVariants?: StoryVariant[];
|
|
30
|
+
testCode?: string;
|
|
31
|
+
componentCode?: string;
|
|
32
|
+
storyCode?: string;
|
|
33
|
+
llmCalls: number;
|
|
34
|
+
fixIterations: number;
|
|
35
|
+
};
|
|
36
|
+
export type ModelConfig = {
|
|
37
|
+
generateTest: string;
|
|
38
|
+
generateComponent: string;
|
|
39
|
+
typeFixer: string;
|
|
40
|
+
testFixer: string;
|
|
41
|
+
lintFixer: string;
|
|
42
|
+
storyFixer: string;
|
|
43
|
+
};
|
|
44
|
+
export type PipelineConfig = {
|
|
45
|
+
models: ModelConfig;
|
|
46
|
+
maxTypeFixIterations: number;
|
|
47
|
+
maxTestFixIterations: number;
|
|
48
|
+
maxLintFixIterations: number;
|
|
49
|
+
maxStoryFixIterations: number;
|
|
50
|
+
enableStorybookTest: boolean;
|
|
51
|
+
enableVisualTest: boolean;
|
|
52
|
+
};
|
|
53
|
+
export type PipelineModels = {
|
|
54
|
+
generateTest: LanguageModel;
|
|
55
|
+
generateComponent: LanguageModel;
|
|
56
|
+
typeFixer: LanguageModel;
|
|
57
|
+
testFixer: LanguageModel;
|
|
58
|
+
lintFixer: LanguageModel;
|
|
59
|
+
storyFixer: LanguageModel;
|
|
60
|
+
};
|
|
61
|
+
export type PipelineResult = {
|
|
62
|
+
success: boolean;
|
|
63
|
+
error?: string;
|
|
64
|
+
llmCalls: number;
|
|
65
|
+
fixIterations: number;
|
|
66
|
+
};
|
|
67
|
+
export declare function buildPipelineSteps(models: PipelineModels, config: PipelineConfig, ctx: PipelineContext): PipelineStep[];
|
|
68
|
+
export declare function runPipeline(steps: PipelineStep[], ctx: PipelineContext): Promise<PipelineResult>;
|
|
69
|
+
//# sourceMappingURL=run-pipeline.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-pipeline.d.ts","sourceRoot":"","sources":["../../../src/pipeline/run-pipeline.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AAExC,OAAO,KAAK,EAAE,sBAAsB,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC5F,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAanD,MAAM,MAAM,UAAU,GAAG;IACvB,OAAO,EAA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W,CAAC;IACpB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,oBAAoB,EAAE,MAAM,CAAC;IAC7B,oBAAoB,EAAE,MAAM,CAAC;IAC7B,qBAAqB,EAAE,MAAM,CAAC;IAC9B,mBAAmB,EAAE,OAAO,CAAC;IAC7B,gBAAgB,EAAE,OAAO,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,YAAY,EAAE,aAAa,CAAC;IAC5B,iBAAiB,EAAE,aAAa,CAAC;IACjC,SAAS,EAAE,aAAa,CAAC;IACzB,SAAS,EAAE,aAAa,CAAC;IACzB,SAAS,EAAE,aAAa,CAAC;IACzB,UAAU,EAAE,aAAa,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,cAAc,EACtB,MAAM,EAAE,cAAc,EACtB,GAAG,EAAE,eAAe,GACnB,YAAY,EAAE,CA+ChB;AAED,wBAAsB,WAAW,CAAC,KAAK,EAAE,YAAY,EAAE,EAAE,GAAG,EAAE,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC,CAuBtG"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import createDebug from 'debug';
|
|
2
|
+
import { generateComponentStep } from './steps/generate-component.js';
|
|
3
|
+
import { generateStoryStep } from './steps/generate-story.js';
|
|
4
|
+
import { generateTestStep } from './steps/generate-test.js';
|
|
5
|
+
import { lintFixLoop } from './steps/lint-fix-loop.js';
|
|
6
|
+
import { storyFixLoop } from './steps/story-fix-loop.js';
|
|
7
|
+
import { storybookTestStep } from './steps/storybook-test.js';
|
|
8
|
+
import { testFixLoop } from './steps/test-fix-loop.js';
|
|
9
|
+
import { typeFixLoop } from './steps/type-fix-loop.js';
|
|
10
|
+
import { visualTestStep } from './steps/visual-test.js';
|
|
11
|
+
const debug = createDebug('auto:component-implementor-react:pipeline');
|
|
12
|
+
export function buildPipelineSteps(models, config, ctx) {
|
|
13
|
+
const steps = [
|
|
14
|
+
{
|
|
15
|
+
name: 'Generate Test',
|
|
16
|
+
run: () => generateTestStep(models.generateTest, ctx),
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
name: 'Generate Component',
|
|
20
|
+
run: () => generateComponentStep(models.generateComponent, ctx),
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
name: 'Type Fix Loop',
|
|
24
|
+
run: () => typeFixLoop(models.typeFixer, ctx, config.maxTypeFixIterations),
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
name: 'Test Fix Loop',
|
|
28
|
+
run: () => testFixLoop(models.testFixer, ctx, config.maxTestFixIterations),
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
name: 'Lint Fix Loop',
|
|
32
|
+
run: () => lintFixLoop(models.lintFixer, ctx, config.maxLintFixIterations),
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
name: 'Generate Story',
|
|
36
|
+
run: () => generateStoryStep(ctx),
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
name: 'Story Fix Loop',
|
|
40
|
+
run: () => storyFixLoop(models.storyFixer, ctx, config.maxStoryFixIterations),
|
|
41
|
+
},
|
|
42
|
+
];
|
|
43
|
+
if (config.enableStorybookTest) {
|
|
44
|
+
steps.push({
|
|
45
|
+
name: 'Storybook Test',
|
|
46
|
+
run: () => storybookTestStep(ctx, true),
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
if (config.enableVisualTest) {
|
|
50
|
+
steps.push({
|
|
51
|
+
name: 'Visual Test',
|
|
52
|
+
run: () => visualTestStep(),
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
return steps;
|
|
56
|
+
}
|
|
57
|
+
export async function runPipeline(steps, ctx) {
|
|
58
|
+
for (const step of steps) {
|
|
59
|
+
debug('Running step: %s', step.name);
|
|
60
|
+
const result = await step.run();
|
|
61
|
+
if (!result.success) {
|
|
62
|
+
debug('Step failed: %s — %s', step.name, result.error);
|
|
63
|
+
return {
|
|
64
|
+
success: false,
|
|
65
|
+
error: `Step "${step.name}" failed: ${result.error}`,
|
|
66
|
+
llmCalls: ctx.llmCalls,
|
|
67
|
+
fixIterations: ctx.fixIterations,
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
debug('Step passed: %s', step.name);
|
|
71
|
+
}
|
|
72
|
+
return {
|
|
73
|
+
success: true,
|
|
74
|
+
llmCalls: ctx.llmCalls,
|
|
75
|
+
fixIterations: ctx.fixIterations,
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=run-pipeline.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-pipeline.js","sourceRoot":"","sources":["../../../src/pipeline/run-pipeline.ts"],"names":[],"mappings":"AACA,OAAO,WAAW,MAAM,OAAO,CAAC;AAGhC,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,MAAM,KAAK,GAAG,WAAW,CAAC,2CAA2C,CAAC,CAAC;AAqEvE,MAAM,UAAU,kBAAkB,CAChC,MA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