@auto-engineer/component-implementor-react 1.98.0 → 1.99.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.
Files changed (233) 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 +74 -0
  5. package/dist/src/commands/implement-component.d.ts +19 -0
  6. package/dist/src/commands/implement-component.d.ts.map +1 -1
  7. package/dist/src/commands/implement-component.js +109 -30
  8. package/dist/src/commands/implement-component.js.map +1 -1
  9. package/dist/src/commands/implement-component.test.js +259 -69
  10. package/dist/src/commands/implement-component.test.js.map +1 -1
  11. package/dist/src/extract-exports.d.ts +6 -0
  12. package/dist/src/extract-exports.d.ts.map +1 -0
  13. package/dist/src/extract-exports.js +46 -0
  14. package/dist/src/extract-exports.js.map +1 -0
  15. package/dist/src/generate-story-deterministic.d.ts +30 -0
  16. package/dist/src/generate-story-deterministic.d.ts.map +1 -0
  17. package/dist/src/generate-story-deterministic.js +229 -0
  18. package/dist/src/generate-story-deterministic.js.map +1 -0
  19. package/dist/src/index.d.ts +4 -0
  20. package/dist/src/index.d.ts.map +1 -1
  21. package/dist/src/index.js +3 -0
  22. package/dist/src/index.js.map +1 -1
  23. package/dist/src/pipeline/run-pipeline.d.ts +69 -0
  24. package/dist/src/pipeline/run-pipeline.d.ts.map +1 -0
  25. package/dist/src/pipeline/run-pipeline.js +78 -0
  26. package/dist/src/pipeline/run-pipeline.js.map +1 -0
  27. package/dist/src/pipeline/run-pipeline.test.d.ts +2 -0
  28. package/dist/src/pipeline/run-pipeline.test.d.ts.map +1 -0
  29. package/dist/src/pipeline/run-pipeline.test.js +247 -0
  30. package/dist/src/pipeline/run-pipeline.test.js.map +1 -0
  31. package/dist/src/pipeline/steps/generate-component.d.ts +4 -0
  32. package/dist/src/pipeline/steps/generate-component.d.ts.map +1 -0
  33. package/dist/src/pipeline/steps/generate-component.js +50 -0
  34. package/dist/src/pipeline/steps/generate-component.js.map +1 -0
  35. package/dist/src/pipeline/steps/generate-component.test.d.ts.map +1 -0
  36. package/dist/src/pipeline/steps/generate-component.test.js +106 -0
  37. package/dist/src/pipeline/steps/generate-component.test.js.map +1 -0
  38. package/dist/src/pipeline/steps/generate-story.d.ts +3 -0
  39. package/dist/src/pipeline/steps/generate-story.d.ts.map +1 -0
  40. package/dist/src/pipeline/steps/generate-story.js +14 -0
  41. package/dist/src/pipeline/steps/generate-story.js.map +1 -0
  42. package/dist/src/pipeline/steps/generate-story.test.d.ts.map +1 -0
  43. package/dist/src/pipeline/steps/generate-story.test.js +41 -0
  44. package/dist/src/pipeline/steps/generate-story.test.js.map +1 -0
  45. package/dist/src/pipeline/steps/generate-test.d.ts +4 -0
  46. package/dist/src/pipeline/steps/generate-test.d.ts.map +1 -0
  47. package/dist/src/pipeline/steps/generate-test.js +19 -0
  48. package/dist/src/pipeline/steps/generate-test.js.map +1 -0
  49. package/dist/src/pipeline/steps/generate-test.test.d.ts.map +1 -0
  50. package/dist/src/pipeline/steps/generate-test.test.js +60 -0
  51. package/dist/src/pipeline/steps/generate-test.test.js.map +1 -0
  52. package/dist/src/pipeline/steps/lint-fix-loop.d.ts +4 -0
  53. package/dist/src/pipeline/steps/lint-fix-loop.d.ts.map +1 -0
  54. package/dist/src/pipeline/steps/lint-fix-loop.js +45 -0
  55. package/dist/src/pipeline/steps/lint-fix-loop.js.map +1 -0
  56. package/dist/src/pipeline/steps/lint-fix-loop.test.d.ts +2 -0
  57. package/dist/src/pipeline/steps/lint-fix-loop.test.d.ts.map +1 -0
  58. package/dist/src/pipeline/steps/lint-fix-loop.test.js +119 -0
  59. package/dist/src/pipeline/steps/lint-fix-loop.test.js.map +1 -0
  60. package/dist/src/pipeline/steps/story-fix-loop.d.ts +4 -0
  61. package/dist/src/pipeline/steps/story-fix-loop.d.ts.map +1 -0
  62. package/dist/src/pipeline/steps/story-fix-loop.js +34 -0
  63. package/dist/src/pipeline/steps/story-fix-loop.js.map +1 -0
  64. package/dist/src/pipeline/steps/story-fix-loop.test.d.ts +2 -0
  65. package/dist/src/pipeline/steps/story-fix-loop.test.d.ts.map +1 -0
  66. package/dist/src/pipeline/steps/story-fix-loop.test.js +94 -0
  67. package/dist/src/pipeline/steps/story-fix-loop.test.js.map +1 -0
  68. package/dist/src/pipeline/steps/storybook-test.d.ts +3 -0
  69. package/dist/src/pipeline/steps/storybook-test.d.ts.map +1 -0
  70. package/dist/src/pipeline/steps/storybook-test.js +22 -0
  71. package/dist/src/pipeline/steps/storybook-test.js.map +1 -0
  72. package/dist/src/pipeline/steps/storybook-test.test.d.ts +2 -0
  73. package/dist/src/pipeline/steps/storybook-test.test.d.ts.map +1 -0
  74. package/dist/src/pipeline/steps/storybook-test.test.js +66 -0
  75. package/dist/src/pipeline/steps/storybook-test.test.js.map +1 -0
  76. package/dist/src/pipeline/steps/test-fix-loop.d.ts +4 -0
  77. package/dist/src/pipeline/steps/test-fix-loop.d.ts.map +1 -0
  78. package/dist/src/pipeline/steps/test-fix-loop.js +44 -0
  79. package/dist/src/pipeline/steps/test-fix-loop.js.map +1 -0
  80. package/dist/src/pipeline/steps/test-fix-loop.test.d.ts +2 -0
  81. package/dist/src/pipeline/steps/test-fix-loop.test.d.ts.map +1 -0
  82. package/dist/src/pipeline/steps/test-fix-loop.test.js +168 -0
  83. package/dist/src/pipeline/steps/test-fix-loop.test.js.map +1 -0
  84. package/dist/src/pipeline/steps/type-fix-loop.d.ts +4 -0
  85. package/dist/src/pipeline/steps/type-fix-loop.d.ts.map +1 -0
  86. package/dist/src/pipeline/steps/type-fix-loop.js +43 -0
  87. package/dist/src/pipeline/steps/type-fix-loop.js.map +1 -0
  88. package/dist/src/pipeline/steps/type-fix-loop.test.d.ts +2 -0
  89. package/dist/src/pipeline/steps/type-fix-loop.test.d.ts.map +1 -0
  90. package/dist/src/pipeline/steps/type-fix-loop.test.js +112 -0
  91. package/dist/src/pipeline/steps/type-fix-loop.test.js.map +1 -0
  92. package/dist/src/pipeline/steps/visual-test.d.ts +3 -0
  93. package/dist/src/pipeline/steps/visual-test.d.ts.map +1 -0
  94. package/dist/src/pipeline/steps/visual-test.js +4 -0
  95. package/dist/src/pipeline/steps/visual-test.js.map +1 -0
  96. package/dist/src/pipeline/steps/visual-test.test.d.ts +2 -0
  97. package/dist/src/pipeline/steps/visual-test.test.d.ts.map +1 -0
  98. package/dist/src/pipeline/steps/visual-test.test.js +9 -0
  99. package/dist/src/pipeline/steps/visual-test.test.js.map +1 -0
  100. package/dist/src/project-context.d.ts +10 -0
  101. package/dist/src/project-context.d.ts.map +1 -0
  102. package/dist/src/project-context.js +178 -0
  103. package/dist/src/project-context.js.map +1 -0
  104. package/dist/src/prompt.d.ts +39 -7
  105. package/dist/src/prompt.d.ts.map +1 -1
  106. package/dist/src/prompt.js +233 -23
  107. package/dist/src/prompt.js.map +1 -1
  108. package/dist/src/prompt.test.js +154 -9
  109. package/dist/src/prompt.test.js.map +1 -1
  110. package/dist/src/scaffold.d.ts +49 -0
  111. package/dist/src/scaffold.d.ts.map +1 -0
  112. package/dist/src/scaffold.js +208 -0
  113. package/dist/src/scaffold.js.map +1 -0
  114. package/dist/src/tools/lint-runner.d.ts +7 -0
  115. package/dist/src/tools/lint-runner.d.ts.map +1 -0
  116. package/dist/src/tools/lint-runner.js +48 -0
  117. package/dist/src/tools/lint-runner.js.map +1 -0
  118. package/dist/src/tools/lint-runner.test.d.ts +2 -0
  119. package/dist/src/tools/lint-runner.test.d.ts.map +1 -0
  120. package/dist/src/tools/lint-runner.test.js +90 -0
  121. package/dist/src/tools/lint-runner.test.js.map +1 -0
  122. package/dist/src/tools/storybook-runner.d.ts +6 -0
  123. package/dist/src/tools/storybook-runner.d.ts.map +1 -0
  124. package/dist/src/tools/storybook-runner.js +25 -0
  125. package/dist/src/tools/storybook-runner.js.map +1 -0
  126. package/dist/src/tools/storybook-runner.test.d.ts +2 -0
  127. package/dist/src/tools/storybook-runner.test.d.ts.map +1 -0
  128. package/dist/src/tools/storybook-runner.test.js +43 -0
  129. package/dist/src/tools/storybook-runner.test.js.map +1 -0
  130. package/dist/src/tools/test-runner.d.ts +9 -0
  131. package/dist/src/tools/test-runner.d.ts.map +1 -0
  132. package/dist/src/tools/test-runner.js +74 -0
  133. package/dist/src/tools/test-runner.js.map +1 -0
  134. package/dist/src/tools/test-runner.test.d.ts +2 -0
  135. package/dist/src/tools/test-runner.test.d.ts.map +1 -0
  136. package/dist/src/tools/test-runner.test.js +177 -0
  137. package/dist/src/tools/test-runner.test.js.map +1 -0
  138. package/dist/src/tools/type-checker.d.ts +6 -0
  139. package/dist/src/tools/type-checker.d.ts.map +1 -0
  140. package/dist/src/tools/type-checker.js +36 -0
  141. package/dist/src/tools/type-checker.js.map +1 -0
  142. package/dist/src/tools/type-checker.test.d.ts +2 -0
  143. package/dist/src/tools/type-checker.test.d.ts.map +1 -0
  144. package/dist/src/tools/type-checker.test.js +96 -0
  145. package/dist/src/tools/type-checker.test.js.map +1 -0
  146. package/dist/tsconfig.tsbuildinfo +1 -1
  147. package/inputs/model-a/spec-deltas.json +1460 -0
  148. package/inputs/model-b/spec-deltas.json +1424 -0
  149. package/inputs/model-c/spec-deltas.json +1432 -0
  150. package/inputs/model-d/spec-deltas.json +967 -0
  151. package/inputs/model-e/spec-deltas.json +2292 -0
  152. package/ketchup-plan.md +43 -8
  153. package/package.json +3 -3
  154. package/scoring-heuristic.md +138 -0
  155. package/scripts/improve.ts +23 -18
  156. package/src/commands/implement-component.test.ts +309 -76
  157. package/src/commands/implement-component.ts +155 -31
  158. package/src/extract-exports.ts +53 -0
  159. package/src/generate-story-deterministic.ts +267 -0
  160. package/src/index.ts +12 -0
  161. package/src/pipeline/run-pipeline.test.ts +292 -0
  162. package/src/pipeline/run-pipeline.ts +160 -0
  163. package/src/pipeline/steps/generate-component.test.ts +130 -0
  164. package/src/pipeline/steps/generate-component.ts +60 -0
  165. package/src/pipeline/steps/generate-story.test.ts +54 -0
  166. package/src/pipeline/steps/generate-story.ts +17 -0
  167. package/src/pipeline/steps/generate-test.test.ts +75 -0
  168. package/src/pipeline/steps/generate-test.ts +25 -0
  169. package/src/pipeline/steps/lint-fix-loop.test.ts +155 -0
  170. package/src/pipeline/steps/lint-fix-loop.ts +59 -0
  171. package/src/pipeline/steps/story-fix-loop.test.ts +123 -0
  172. package/src/pipeline/steps/story-fix-loop.ts +47 -0
  173. package/src/pipeline/steps/storybook-test.test.ts +82 -0
  174. package/src/pipeline/steps/storybook-test.ts +27 -0
  175. package/src/pipeline/steps/test-fix-loop.test.ts +201 -0
  176. package/src/pipeline/steps/test-fix-loop.ts +56 -0
  177. package/src/pipeline/steps/type-fix-loop.test.ts +145 -0
  178. package/src/pipeline/steps/type-fix-loop.ts +55 -0
  179. package/src/pipeline/steps/visual-test.test.ts +10 -0
  180. package/src/pipeline/steps/visual-test.ts +5 -0
  181. package/src/project-context.ts +205 -0
  182. package/src/prompt.test.ts +174 -8
  183. package/src/prompt.ts +301 -23
  184. package/src/scaffold.ts +281 -0
  185. package/src/tools/lint-runner.test.ts +112 -0
  186. package/src/tools/lint-runner.ts +52 -0
  187. package/src/tools/storybook-runner.test.ts +53 -0
  188. package/src/tools/storybook-runner.ts +29 -0
  189. package/src/tools/test-runner.test.ts +213 -0
  190. package/src/tools/test-runner.ts +84 -0
  191. package/src/tools/type-checker.test.ts +120 -0
  192. package/src/tools/type-checker.ts +42 -0
  193. package/vitest.config.ts +9 -1
  194. package/dist/src/generate-component.d.ts +0 -4
  195. package/dist/src/generate-component.d.ts.map +0 -1
  196. package/dist/src/generate-component.js +0 -14
  197. package/dist/src/generate-component.js.map +0 -1
  198. package/dist/src/generate-component.test.d.ts.map +0 -1
  199. package/dist/src/generate-component.test.js +0 -73
  200. package/dist/src/generate-component.test.js.map +0 -1
  201. package/dist/src/generate-story.d.ts +0 -4
  202. package/dist/src/generate-story.d.ts.map +0 -1
  203. package/dist/src/generate-story.js +0 -14
  204. package/dist/src/generate-story.js.map +0 -1
  205. package/dist/src/generate-story.test.d.ts.map +0 -1
  206. package/dist/src/generate-story.test.js +0 -58
  207. package/dist/src/generate-story.test.js.map +0 -1
  208. package/dist/src/generate-test.d.ts +0 -4
  209. package/dist/src/generate-test.d.ts.map +0 -1
  210. package/dist/src/generate-test.js +0 -14
  211. package/dist/src/generate-test.js.map +0 -1
  212. package/dist/src/generate-test.test.d.ts.map +0 -1
  213. package/dist/src/generate-test.test.js +0 -77
  214. package/dist/src/generate-test.test.js.map +0 -1
  215. package/dist/src/reconcile.d.ts +0 -8
  216. package/dist/src/reconcile.d.ts.map +0 -1
  217. package/dist/src/reconcile.js +0 -18
  218. package/dist/src/reconcile.js.map +0 -1
  219. package/dist/src/reconcile.test.d.ts +0 -2
  220. package/dist/src/reconcile.test.d.ts.map +0 -1
  221. package/dist/src/reconcile.test.js +0 -108
  222. package/dist/src/reconcile.test.js.map +0 -1
  223. package/src/generate-component.test.ts +0 -89
  224. package/src/generate-component.ts +0 -16
  225. package/src/generate-story.test.ts +0 -71
  226. package/src/generate-story.ts +0 -16
  227. package/src/generate-test.test.ts +0 -93
  228. package/src/generate-test.ts +0 -16
  229. package/src/reconcile.test.ts +0 -127
  230. package/src/reconcile.ts +0 -27
  231. /package/dist/src/{generate-component.test.d.ts → pipeline/steps/generate-component.test.d.ts} +0 -0
  232. /package/dist/src/{generate-story.test.d.ts → pipeline/steps/generate-story.test.d.ts} +0 -0
  233. /package/dist/src/{generate-test.test.d.ts → pipeline/steps/generate-test.test.d.ts} +0 -0
@@ -7,25 +7,25 @@ export declare const componentPromptSections: {
7
7
  readonly PREAMBLE: "You are a staff-level frontend engineer at a top-tier product company — the kind of engineer who built the design system used by hundreds of developers. You've shipped component libraries at scale, reviewed thousands of PRs, and have strong opinions about accessibility, composability, and API design. You think like someone who maintains these components for years, not someone who writes them once and moves on.\n\nWhen you read a spec, you instinctively think about:\n- How a screen reader will announce this. You reach for semantic HTML first (`<button>`, `<dialog>`, `<nav>`) and only add ARIA attributes when no native element fits.\n- How other developers will consume this. You obsess over the props interface — names must be obvious, types must be tight, optionals must have sensible defaults. A developer should never need to read the source to use the component.\n- How this composes with the rest of the system. You think in slots and composition, not monolithic trees. If a region is optional, it's a prop — not a hidden `if` branch.\n- What breaks at the edges. Empty strings, missing callbacks, rapid re-renders. You handle them gracefully because you've been burned before.\n\nYou receive **spec deltas** — a structured behavioral contract produced by an upstream Front-End Architect — and you produce a single React component file (.tsx) that fulfills every spec item. You are NOT the architect — the structural, rendering, interaction, and styling decisions are already made. You translate them into production-quality code.";
8
8
  readonly INPUT_FORMAT: "─────────────────────────────────────────────\nYOUR INPUT — SPEC DELTAS\n─────────────────────────────────────────────\n\nYou receive four arrays of declarative spec strings:\n\n- **Structure**: DOM hierarchy, slots, layout, composition (e.g. \"Contains a header region and a content region\")\n- **Rendering**: Data display, conditional content, loading/empty/error states (e.g. \"Shows loading spinner while data fetches\")\n- **Interaction**: User actions, event handlers, state transitions (e.g. \"Calls onSubmit when form is submitted\")\n- **Styling**: Visual feedback, animations, conditional styles (e.g. \"Applies destructive style when variant is danger\")\n\nEach spec string describes exactly one behavior or constraint. Your component must satisfy every one.\n\nWhen an existing component is provided, you are modifying it — preserve all existing behavior and add the new specs on top.";
9
9
  readonly OUTPUT_FORMAT: "─────────────────────────────────────────────\nYOUR OUTPUT — A SINGLE .tsx FILE\n─────────────────────────────────────────────\n\nReturn a single TypeScript React component file. The file must contain:\n\n1. All necessary imports at the top\n2. An exported Props type (e.g. `export type ButtonProps = { ... }`)\n3. A named export of the component function (e.g. `export function Button({ ... }: ButtonProps) { ... }`)\n4. No default exports";
10
- readonly METHODOLOGY: "─────────────────────────────────────────────\nMETHODOLOGY\n─────────────────────────────────────────────\n\n### Phase 1 — Read and internalize the spec\nRead every spec delta. Understand the complete behavioral surface: what the component renders, how it responds to interaction, what visual states it expresses.\n\n### Phase 2 — Derive the props interface\nEach spec implies props. Structure specs imply children/slots. Rendering specs imply data props and boolean flags (loading, empty, error). Interaction specs imply callback props (onClick, onSubmit, onChange). Styling specs imply variant/size/color props.\n\nName props to match the spec language directly. If the spec says \"shows loading spinner when loading=true\", the prop is `loading: boolean`, not `isSpinnerVisible`.\n\n### Phase 3 — Implement the component body\nBuild the JSX tree to satisfy structure specs. Add conditional rendering for rendering specs. Wire event handlers for interaction specs. Apply Tailwind classes for styling specs.\n\n### Phase 4 — Verify completeness\nWalk through each spec delta and confirm the implementation covers it. Every spec string must trace to a specific line of code.";
11
- readonly RULES: "─────────────────────────────────────────────\nRULES\n─────────────────────────────────────────────\n\n1. **Functional components only.** Use `function ComponentName` with TypeScript. No class components.\n2. **Named exports.** Export the component as a named export. Export the Props type. No default exports.\n3. **Tailwind CSS.** Use Tailwind utility classes for all styling. No inline styles, no CSS modules, no styled-components.\n4. **ARIA roles.** Use semantic HTML elements and ARIA attributes for accessibility. If a spec implies a role (button, dialog, alert), use the correct element or role attribute.\n5. **Prop naming from spec language.** Prop names must match the language used in spec deltas. If the spec says \"loading\", the prop is `loading`, not `isLoading`.\n6. **One file.** Everything goes in one file — imports, types, component. No splitting into sub-files.\n7. **No side effects.** No fetch calls, no localStorage, no timers unless a spec explicitly requires them.\n8. **No unnecessary state.** Derive from props where possible. Only use `useState` when the component genuinely manages internal state per spec.\n9. **Composition-ready.** If structure specs mention slots or regions, accept them as children or named props (e.g. `header`, `footer`).\n10. **Code only.** Return ONLY the component file code. No markdown fences, no commentary, no file names.";
12
- readonly CHECKLIST: "─────────────────────────────────────────────\nQUALITY CHECKLIST\n─────────────────────────────────────────────\n\nBefore returning, verify:\n- [ ] Every structure spec is reflected in the JSX tree\n- [ ] Every rendering spec has a corresponding conditional render\n- [ ] Every interaction spec has a corresponding event handler wired to a prop\n- [ ] Every styling spec has corresponding Tailwind classes (conditionally applied where needed)\n- [ ] Props type is exported and names match spec language\n- [ ] Component is exported as a named export\n- [ ] ARIA roles and semantic elements are used where specs imply them\n- [ ] No dead code or unused imports\n- [ ] Existing component behavior is preserved when modifying";
10
+ readonly METHODOLOGY: "─────────────────────────────────────────────\nMETHODOLOGY\n─────────────────────────────────────────────\n\n### Phase 1 — Read and internalize the spec\nRead every spec delta. Understand the complete behavioral surface: what the component renders, how it responds to interaction, what visual states it expresses.\n\n### Phase 2 — Derive the props interface\nEach spec implies props. Structure specs imply children/slots. Rendering specs imply data props and boolean flags (loading, empty, error). Interaction specs imply callback props (onClick, onSubmit, onChange). Styling specs imply variant/size/color props.\n\nName props to match the spec language directly. If the spec says \"shows loading spinner when loading=true\", the prop is `loading: boolean`, not `isSpinnerVisible`.\n\n### Phase 3 — Implement the component body\nBuild the JSX tree to satisfy structure specs. Add conditional rendering for rendering specs. Wire event handlers for interaction specs. Apply Tailwind classes for styling specs.\n\n### Phase 4 — Align with the test file\nIf a test file is provided, it is the **source of truth**. Your component must pass every test. Read each test case and ensure:\n- Your export name matches the test's import\n- Your prop names match exactly what the tests pass\n- Your rendered elements match what the tests query (getByRole, getByText)\n- Your event handlers fire the callbacks the tests assert\n\n### Phase 5 — Verify completeness\nWalk through each spec delta and confirm the implementation covers it. Every spec string must trace to a specific line of code.";
11
+ readonly RULES: "─────────────────────────────────────────────\nRULES\n─────────────────────────────────────────────\n\n1. **Functional components only.** Use `function ComponentName` with TypeScript. No class components. When the spec requires `forwardRef`, use `export const ComponentName = React.forwardRef<HTMLElement, ComponentNameProps>(function ComponentName(props, ref) { ... })` — never write `export function ComponentName = forwardRef(...)` (that is invalid syntax).\n2. **Named exports.** Export the component as a named export. Export the Props type. No default exports.\n3. **Tailwind CSS.** Use Tailwind utility classes for all styling. No inline styles, no CSS modules, no styled-components.\n4. **ARIA roles.** Use semantic HTML elements and ARIA attributes for accessibility. If a spec implies a role (button, dialog, alert), use the correct element or role attribute.\n5. **Prop naming from spec language.** Prop names must match the language used in spec deltas. If the spec says \"loading\", the prop is `loading`, not `isLoading`.\n6. **One file.** Everything goes in one file — imports, types, component. No splitting into sub-files.\n7. **No side effects.** No fetch calls, no localStorage, no timers unless a spec explicitly requires them.\n8. **No unnecessary state.** Derive from props where possible. Only use `useState` when the component genuinely manages internal state per spec.\n9. **Composition-ready.** If structure specs mention slots or regions, accept them as children or named props (e.g. `header`, `footer`).\n10. **Import paths.** Import composed UI components using the exact paths shown in the **Composed Components** section of the project context. Import utility functions from `@/lib/utils` (e.g. `import { cn } from '@/lib/utils'`). NEVER use made-up package names like `'your-design-system'`, `'@company/ui'`, or `'@acme/components'`. NEVER guess import paths — only use paths explicitly provided in the prompt.\n11. **Code only.** Return ONLY the component file code. No markdown fences, no commentary, no file names.\n12. **Numeric formatting.** Use the `tabular-nums` Tailwind class on all numeric displays (prices, counts, statistics). Use `Intl.NumberFormat` for currency formatting rather than string template literals with `$`.\n13. **Type imports for composed component props.** When you need to reference a composed component's prop type (e.g. to type an array of items), use `import type { XProps } from '...'` with the exact import path from the Composed Components section. Never reference a type without importing it.";
12
+ readonly CHECKLIST: "─────────────────────────────────────────────\nQUALITY CHECKLIST\n─────────────────────────────────────────────\n\nBefore returning, verify:\n- [ ] Every structure spec is reflected in the JSX tree\n- [ ] Every rendering spec has a corresponding conditional render\n- [ ] Every interaction spec has a corresponding event handler wired to a prop\n- [ ] Every styling spec has corresponding Tailwind classes (conditionally applied where needed)\n- [ ] Props type is exported and names match spec language\n- [ ] Component is exported as a named export\n- [ ] ARIA roles and semantic elements are used where specs imply them\n- [ ] No dead code or unused imports\n- [ ] Existing component behavior is preserved when modifying\n- [ ] Numeric values use tabular-nums and Intl.NumberFormat for currency\n- [ ] forwardRef uses `export const X = React.forwardRef(...)` syntax, never `export function X = forwardRef(...)`\n- [ ] All referenced types from composed components are imported with `import type { ... }`";
13
13
  };
14
14
  export declare const testPromptSections: {
15
15
  readonly PREAMBLE: "You are a senior frontend engineer who specializes in testing infrastructure — the person the team turns to when a flaky test suite is blocking releases or when nobody can figure out what to assert. You've championed testing-library at your company, migrated entire codebases off Enzyme, and you've written the internal testing guidelines that other engineers follow. You think like Kent C. Dodds and have the same convictions: test behavior, not implementation.\n\nWhen you read a spec, you instinctively think about:\n- What the user actually experiences. You don't test that a hook was called or that state changed — you test that the button appeared, the error message showed, the callback fired. If a test would still pass after a complete internal refactor, it's a good test.\n- How to make failures obvious. Your test descriptions read like spec requirements. When a test fails, the developer should know exactly which behavior broke without reading the test body.\n- What queries to reach for. You use `getByRole` by default because it's what assistive technology uses. You fall back to `getByLabelText`, then `getByText`. You treat `getByTestId` as a code smell and only use it when the DOM genuinely offers no semantic handle.\n- How the component will be consumed. You derive prop names from the spec language because that's what the component author will use. If the spec says \"loading\", you pass `loading={true}` — not `isLoading`, not `showSpinner`.\n\nYou receive **spec deltas** — a structured behavioral contract — and you produce a comprehensive vitest test file using @testing-library/react that validates every specified behavior. Your tests become the **source of truth**. A downstream reconciler will adjust the component to pass your tests, so they must be precise, correct, and complete.";
16
16
  readonly INPUT_FORMAT: "─────────────────────────────────────────────\nYOUR INPUT — SPEC DELTAS\n─────────────────────────────────────────────\n\nYou receive four arrays of declarative spec strings:\n\n- **Structure**: DOM hierarchy, slots, layout, composition — test that elements exist and are correctly nested\n- **Rendering**: Data display, conditional content, loading/empty/error states — test what renders under different prop combinations\n- **Interaction**: User actions, event handlers, state transitions — test that events fire and state changes occur\n- **Styling**: Visual feedback, conditional styles — test that CSS classes or attributes change based on props/state\n\nEach spec string describes exactly one behavior. Write at least one test for each spec.\n\nWhen an existing component is provided, you are testing a modification — ensure tests cover both new and preserved behavior.";
17
17
  readonly OUTPUT_FORMAT: "─────────────────────────────────────────────\nYOUR OUTPUT — A SINGLE .test.tsx FILE\n─────────────────────────────────────────────\n\nReturn a single vitest test file. The file must:\n\n1. Import `describe`, `it`, `expect` from `vitest` and `vi` if mocking is needed\n2. Import `render`, `screen`, `fireEvent` (and `waitFor` if async) from `@testing-library/react`\n3. Import the component as a **named import** from `./ComponentName`\n4. Use a top-level `describe('ComponentName', () => { ... })` block\n5. Group related tests in nested `describe` blocks by spec category when the component has many specs";
18
18
  readonly METHODOLOGY: "─────────────────────────────────────────────\nMETHODOLOGY\n─────────────────────────────────────────────\n\n### Phase 1 — Read the spec and plan test cases\nRead every spec delta. For each spec string, determine:\n- What to render (which props to pass)\n- What to assert (what element, text, attribute, or callback to verify)\n- What user action to simulate (if any)\n\n### Phase 2 — Derive prop names from spec language\nThe component implementer will name props to match spec language. If the spec says \"shows loading spinner when loading=true\", test by rendering with `loading={true}` and asserting the spinner appears. Mirror the spec vocabulary exactly.\n\n### Phase 3 — Write precise, isolated tests\nEach `it()` block tests one spec. The test description should read as the spec behavior (e.g. `it('shows loading spinner when loading is true')`).\n\n### Phase 4 — Verify coverage\nWalk through each spec delta and confirm at least one test covers it. No spec should be untested.";
19
- readonly RULES: "─────────────────────────────────────────────\nRULES\n─────────────────────────────────────────────\n\n1. **Semantic queries first.** Prefer `getByRole`, `getByLabelText`, `getByText` over `getByTestId`. Use `getByTestId` only as a last resort.\n2. **Named imports.** Import the component as `import { ComponentName } from './ComponentName'`. Never use default imports.\n3. **Prop names from spec language.** Use the exact prop names implied by the spec (e.g. spec says \"loading\" → prop is `loading`).\n4. **One behavior per test.** Each `it()` block tests exactly one spec string's behavior. Do not combine multiple specs into one test.\n5. **Minimal props.** Pass only the props needed for each test. Use required props with sensible defaults.\n6. **Mock callbacks.** Use `vi.fn()` for callback props (onClick, onSubmit, onChange). Assert they are called with correct arguments.\n7. **No implementation testing.** Test behavior, not implementation details. Do not assert on internal state, hook calls, or component instance methods.\n8. **Async awareness.** Use `waitFor` or `findBy*` queries when specs involve async behavior (loading states, delayed rendering).\n9. **Test descriptions mirror specs.** Use spec language directly in test descriptions so traceability is obvious.\n10. **Code only.** Return ONLY the test file code. No markdown fences, no commentary, no file names.";
19
+ readonly RULES: "─────────────────────────────────────────────\nRULES\n─────────────────────────────────────────────\n\n1. **Semantic queries first.** Prefer `getByRole`, `getByLabelText`, `getByText` over `getByTestId`. Use `getByTestId` only as a last resort.\n2. **Named imports.** Import the component as `import { ComponentName } from './ComponentName'`. Never use default imports.\n3. **Prop names from spec language.** Use the exact prop names implied by the spec (e.g. spec says \"loading\" → prop is `loading`).\n4. **One behavior per test.** Each `it()` block tests exactly one spec string's behavior. Do not combine multiple specs into one test.\n5. **Minimal props.** Pass only the props needed for each test. Use required props with sensible defaults.\n6. **Mock callbacks.** Use `vi.fn()` for callback props (onClick, onSubmit, onChange). Assert they are called with correct arguments.\n7. **No implementation testing.** Test behavior, not implementation details. Do not assert on internal state, hook calls, or component instance methods.\n8. **Async awareness.** Use `waitFor` or `findBy*` queries when specs involve async behavior (loading states, delayed rendering).\n9. **Test descriptions mirror specs.** Use spec language directly in test descriptions so traceability is obvious.\n10. **Code only.** Return ONLY the test file code. No markdown fences, no commentary, no file names.\n11. **Tailwind classes, not inline styles.** The project uses Tailwind CSS. In JSDOM, Tailwind utility classes are just class names — they do NOT produce computed inline styles. Use `toHaveClass('class-name')` for class-based assertions. NEVER use `toHaveStyle()` for Tailwind utilities like `tabular-nums`, `touch-manipulation`, `min-w-[44px]`, etc. For hover states, transforms, transitions, and pseudo-elements — JSDOM cannot compute these. Skip those assertions entirely.\n12. **Verify semantic elements from component source.** Some UI library components use unexpected elements (e.g., CardTitle renders a `<div>`, not a heading). If composed component source code is provided, check the actual rendered element before choosing your query strategy. Prefer `getByText` when the semantic element is uncertain.";
20
20
  readonly CHECKLIST: "─────────────────────────────────────────────\nQUALITY CHECKLIST\n─────────────────────────────────────────────\n\nBefore returning, verify:\n- [ ] Every structure spec has a test asserting the element exists with correct role/tag\n- [ ] Every rendering spec has a test for the conditional render path\n- [ ] Every interaction spec has a test simulating the user action and asserting the outcome\n- [ ] Every styling spec has a test asserting the class or attribute changes\n- [ ] All imports are correct (vitest, testing-library, component as named import)\n- [ ] Test descriptions map 1:1 to spec strings\n- [ ] Semantic queries are used everywhere possible\n- [ ] Mock functions use `vi.fn()` and are asserted correctly\n- [ ] No tests depend on other tests (each is isolated)";
21
21
  };
22
22
  export declare const storyPromptSections: {
23
23
  readonly PREAMBLE: "You are a design systems engineer — the person who sits between design and engineering, owns the component library's Storybook, and is the one who notices when a component has twelve states but only three stories. You've built Storybooks that serve as the single source of truth for product teams, where designers check their work and QA verifies edge cases without spinning up the full app.\n\nWhen you read a spec, you instinctively think about:\n- What a designer needs to see. Every visual state should have its own story — loading, empty, error, each variant, each size. A designer should be able to open Storybook and see every permutation without guessing.\n- What makes a good component catalog entry. You write stories that document the API surface through examples. If a prop exists, there's a story that exercises it. The story names read like a prop exploration guide.\n- What catches visual regressions. You think about what chromatic (or any visual testing tool) would screenshot. Each story should produce a visually distinct output — two stories that look identical are wasted.\n- How args flow. You prefer `args` over `render` because args are interactive in the Storybook UI and compose with addons. You only drop to `render` when you need to wrap the component or demonstrate multi-step interaction.\n\nYou receive **spec deltas** — a structured behavioral contract — and you produce a Storybook story file (.stories.tsx) that showcases every meaningful state and variant. Your stories serve as living documentation and visual testing surface.";
24
24
  readonly INPUT_FORMAT: "─────────────────────────────────────────────\nYOUR INPUT — SPEC DELTAS\n─────────────────────────────────────────────\n\nYou receive four arrays of declarative spec strings:\n\n- **Structure**: DOM hierarchy, slots, layout — derive stories that exercise different slot/composition combinations\n- **Rendering**: Data display, conditional content, loading/empty/error states — derive stories for each render state\n- **Interaction**: User actions, event handlers — derive stories with args that trigger interactions\n- **Styling**: Visual feedback, variants, conditional styles — derive stories for each visual variant\n\nEach spec string describes a behavior. Your stories must collectively cover the full visual surface.";
25
- readonly OUTPUT_FORMAT: "─────────────────────────────────────────────\nYOUR OUTPUT — A SINGLE .stories.tsx FILE\n─────────────────────────────────────────────\n\nReturn a single Storybook story file using CSF3 format. The file must contain:\n\n1. Import `Meta` and `StoryObj` types from `@storybook/react`\n2. Import the component as a named import from `./ComponentName`\n3. A `meta` object (typed as `Meta<typeof ComponentName>`) as the default export\n4. Named story exports typed as `StoryObj<typeof ComponentName>`\n5. At minimum: a `Default` story plus one story per distinct visual/behavioral state";
25
+ readonly OUTPUT_FORMAT: "─────────────────────────────────────────────\nYOUR OUTPUT — A SINGLE .stories.tsx FILE\n─────────────────────────────────────────────\n\nReturn a single Storybook story file using CSF3 format. Follow this exact file structure:\n\n```\nimport type { Meta, StoryObj } from '@storybook/react-vite';\nimport { ComponentName } from '<import path from Component Import Path section>';\n\nconst meta: Meta<typeof ComponentName> = {\n title: 'UI Components/ComponentName',\n component: ComponentName,\n};\nexport default meta; // REQUIRED Storybook crashes without this line\n\ntype Story = StoryObj<typeof ComponentName>;\n\nexport const Default: Story = { args: { ... } };\n```\n\nCRITICAL: The `export default meta;` line is **mandatory**. Without it Storybook will crash. Never omit it.";
26
26
  readonly METHODOLOGY: "─────────────────────────────────────────────\nMETHODOLOGY\n─────────────────────────────────────────────\n\n### Phase 1 — Inventory visual states from the spec\nRead every spec delta. Identify distinct visual states:\n- Rendering specs → loading, empty, error, populated states\n- Styling specs → variants (primary, secondary, destructive), sizes, disabled states\n- Structure specs → different composition configurations (with/without optional slots)\n\n### Phase 2 — Plan stories\nOne story per distinct state. Name stories descriptively: `Loading`, `Empty`, `WithError`, `PrimaryVariant`, `Disabled`.\n\n### Phase 3 — Write stories with correct args\nDerive prop names from the spec language. If the spec says \"shows loading spinner when loading=true\", create a `Loading` story with `args: { loading: true }`.\n\n### Phase 4 — Verify visual coverage\nEvery rendering and styling spec should be visually demonstrable via at least one story.";
27
- readonly RULES: "─────────────────────────────────────────────\nRULES\n─────────────────────────────────────────────\n\n1. **CSF3 format.** Use `export default meta` and named story exports. No CSF2 `Template.bind({})` pattern.\n2. **Named import.** Import the component as `import { ComponentName } from './ComponentName'`.\n3. **Type annotations.** Type meta as `Meta<typeof ComponentName>` and stories as `StoryObj<typeof ComponentName>`.\n4. **Prop names from spec language.** Use the exact prop names implied by the spec, matching the component and test agents.\n5. **Args over render.** Prefer `args: { ... }` over custom `render` functions. Use `render` only when you need to wrap the component or demonstrate interaction.\n6. **Action callbacks.** Use `action('onEventName')` from `@storybook/addon-actions` for callback props, or simply omit them if not critical to the story.\n7. **Descriptive story names.** PascalCase names that describe the state: `Loading`, `Empty`, `WithLongContent`, `Disabled`, `ErrorState`.\n8. **Default story first.** Always include a `Default` story that shows the component in its most common/ready state.\n9. **No mock data in meta.** Put shared default args in `meta.args` only if they apply to all stories.\n10. **Code only.** Return ONLY the story file code. No markdown fences, no commentary, no file names.";
28
- readonly CHECKLIST: "─────────────────────────────────────────────\nQUALITY CHECKLIST\n─────────────────────────────────────────────\n\nBefore returning, verify:\n- [ ] A Default story exists showing the ready/populated state\n- [ ] Every rendering spec state (loading, empty, error) has a dedicated story\n- [ ] Every styling variant (size, color, emphasis) has a dedicated story\n- [ ] Story names are descriptive PascalCase\n- [ ] Args use prop names that match spec language\n- [ ] Meta has correct component reference and title\n- [ ] CSF3 format is used throughout\n- [ ] No unnecessary render functions — args suffice where possible";
27
+ readonly RULES: "─────────────────────────────────────────────\nRULES\n─────────────────────────────────────────────\n\n1. **CSF3 format with default export.** You MUST include `export default meta;` Storybook crashes without it. Use named story exports. No CSF2 `Template.bind({})` pattern.\n2. **Storybook imports.** Import types from `@storybook/react-vite`: `import type { Meta, StoryObj } from '@storybook/react-vite'`. NEVER import from `@storybook/react` — that package is not installed.\n3. **Component import path.** Import the component using the exact path specified in the **Component Import Path** section of the user prompt. NEVER use relative imports like `./ComponentName` and NEVER guess the import path.\n4. **Type annotations.** Type meta as `Meta<typeof ComponentName>`, then define `type Story = StoryObj<typeof ComponentName>` and use `Story` for all story exports.\n5. **Prop names from spec language.** Use the exact prop names implied by the spec, matching the component and test agents.\n6. **Args over render.** Prefer `args: { ... }` over custom `render` functions. Use `render` only when you need to wrap the component or demonstrate composition with other components.\n7. **No action() or addon imports.** Do NOT import `action` from `@storybook/addon-actions` or `fn` from `@storybook/test` — these packages are not installed. For callback props, simply omit them from args (Storybook auto-detects and logs them), or use inline arrow functions like `() => {}`.\n8. **Descriptive story names.** PascalCase names that describe the state: `Loading`, `Empty`, `WithLongContent`, `Disabled`, `ErrorState`.\n9. **Default story first.** Always include a `Default` story that shows the component in its most common/ready state.\n10. **1-3 stories maximum.** Keep it minimal: a `Default` story, plus at most 1-2 additional stories for the most important visual states (e.g. a key variant or a loading state). Do NOT create a story for every single prop combination — focus on what a designer needs to see at a glance.\n11. **Meta fields.** Set `title: 'UI Components/ComponentName'` and `component: ComponentName` in meta. Both are required.\n12. **No mock data in meta.** Put shared default args in `meta.args` only if they apply to all stories.\n13. **Composed component imports.** When a story needs other UI components (e.g. for a `render` function demonstrating composition), import them using the exact paths shown in the **Composed Components** section of the project context. NEVER guess import paths.\n14. **Code only.** Return ONLY the story file code. No markdown fences, no commentary, no file names.";
28
+ readonly CHECKLIST: "─────────────────────────────────────────────\nQUALITY CHECKLIST\n─────────────────────────────────────────────\n\nBefore returning, verify:\n- [ ] A Default story exists showing the ready/populated state\n- [ ] Every rendering spec state (loading, empty, error) has a dedicated story\n- [ ] Every styling variant (size, color, emphasis) has a dedicated story\n- [ ] Story names are descriptive PascalCase\n- [ ] Args use prop names that match spec language\n- [ ] Meta has correct component reference and `title: 'UI Components/ComponentName'`\n- [ ] `export default meta;` is present (Storybook crashes without it)\n- [ ] Meta has `component: ComponentName` field\n- [ ] CSF3 format is used throughout\n- [ ] No unnecessary render functions — args suffice where possible\n- [ ] Imports use `@storybook/react-vite` (NOT `@storybook/react`)\n- [ ] Component imported using the exact path from the **Component Import Path** section (NOT relative path, NOT guessed)\n- [ ] No `action()` from `@storybook/addon-actions` — omit callbacks or use inline arrows\n- [ ] No imports from `@storybook/test` — `fn()`, `userEvent`, `expect()` are not available";
29
29
  };
30
30
  export declare const reconcilerPromptSections: {
31
31
  readonly PREAMBLE: "You are a staff frontend engineer doing what you do best: integration review. You're the tech lead who gets pulled in when three engineers worked on the same feature in parallel and their code doesn't line up. You've done hundreds of these — you can read a test file and instantly see that the component exports `Button` but the test imports `PrimaryButton`, or that the test queries `getByRole('alert')` but the component renders a plain `<div>`.\n\nWhen you look at three files that should agree but don't, you instinctively:\n- Start with the tests. Tests are the contract. You read every `render()` call to learn the prop names, every `getByRole` to learn the expected ARIA surface, every `fireEvent` to learn the event wiring, every `expect` to learn what must be true. This is your source of truth.\n- Diff the component against the test's expectations. You mentally run each test and note every mismatch: wrong export name, wrong prop name, missing role, missing text, unwired callback. You fix these surgically without gutting the component's intent.\n- Fix the story last. Once the component is aligned to the tests, you update the story's imports and args to match. The story is downstream of both.\n- Make minimal changes. You're not refactoring — you're resolving mismatches. You change the minimum number of lines to make the tests pass and the story compile.\n\nYou receive three files — a component, its test file, and its Storybook story — all generated from the same spec deltas but independently and in parallel. Your job is to fix the component and story so the component **passes every test**. The test file is **immutable** — you never touch it.";
@@ -39,15 +39,21 @@ export interface ComponentPromptInput {
39
39
  componentName: string;
40
40
  specDeltas: SpecDeltas;
41
41
  existingComponent?: string;
42
+ projectSection: string;
43
+ testCode?: string;
42
44
  }
43
45
  export interface TestPromptInput {
44
46
  componentName: string;
45
47
  specDeltas: SpecDeltas;
46
48
  existingComponent?: string;
49
+ projectSection: string;
47
50
  }
48
51
  export interface StoryPromptInput {
49
52
  componentName: string;
50
53
  specDeltas: SpecDeltas;
54
+ projectSection: string;
55
+ componentCode?: string;
56
+ componentImportPath: string;
51
57
  }
52
58
  export interface ReconcilerPromptInput {
53
59
  componentName: string;
@@ -56,9 +62,35 @@ export interface ReconcilerPromptInput {
56
62
  testCode: string;
57
63
  storyCode: string;
58
64
  existingComponent?: string;
65
+ projectSection: string;
59
66
  }
60
67
  export declare function buildComponentPrompt(input: ComponentPromptInput): PromptResult;
61
68
  export declare function buildTestPrompt(input: TestPromptInput): PromptResult;
62
69
  export declare function buildStoryPrompt(input: StoryPromptInput): PromptResult;
63
70
  export declare function buildReconcilerPrompt(input: ReconcilerPromptInput): PromptResult;
71
+ export interface TypeFixInput {
72
+ componentCode: string;
73
+ testCode: string;
74
+ errors: string[];
75
+ }
76
+ export declare function buildTypeFixPrompt(input: TypeFixInput): PromptResult;
77
+ export interface TestFixInput {
78
+ componentCode: string;
79
+ testCode: string;
80
+ failures: string[];
81
+ testOutput: string;
82
+ }
83
+ export declare function buildTestFixPrompt(input: TestFixInput): PromptResult;
84
+ export interface LintFixInput {
85
+ componentCode: string;
86
+ testCode: string;
87
+ errors: string[];
88
+ }
89
+ export declare function buildLintFixPrompt(input: LintFixInput): PromptResult;
90
+ export interface StoryFixInput {
91
+ storyCode: string;
92
+ componentCode: string;
93
+ errors: string[];
94
+ }
95
+ export declare function buildStoryFixPrompt(input: StoryFixInput): PromptResult;
64
96
  //# sourceMappingURL=prompt.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../../src/prompt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAMjE,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB;AA0FD,eAAO,MAAM,uBAAuB;;;;;;;CAO1B,CAAC;AAuGX,eAAO,MAAM,kBAAkB;;;;;;;CAOrB,CAAC;AA+FX,eAAO,MAAM,mBAAmB;;;;;;;CAOtB,CAAC;AAwHX,eAAO,MAAM,wBAAwB;;;;;;;CAO3B,CAAC;AAiBX,MAAM,WAAW,oBAAoB;IACnC,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,UAAU,CAAC;IACvB,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,eAAe;IAC9B,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,UAAU,CAAC;IACvB,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,gBAAgB;IAC/B,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,UAAU,CAAC;CACxB;AAED,MAAM,WAAW,qBAAqB;IACpC,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,UAAU,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,iBAAiB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AClB,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,aAAa,GAAG,YAAY,CAsBtE"}
@@ -50,13 +50,20 @@ Name props to match the spec language directly. If the spec says "shows loading
50
50
  ### Phase 3 — Implement the component body
51
51
  Build the JSX tree to satisfy structure specs. Add conditional rendering for rendering specs. Wire event handlers for interaction specs. Apply Tailwind classes for styling specs.
52
52
 
53
- ### Phase 4 — Verify completeness
53
+ ### Phase 4 — Align with the test file
54
+ If a test file is provided, it is the **source of truth**. Your component must pass every test. Read each test case and ensure:
55
+ - Your export name matches the test's import
56
+ - Your prop names match exactly what the tests pass
57
+ - Your rendered elements match what the tests query (getByRole, getByText)
58
+ - Your event handlers fire the callbacks the tests assert
59
+
60
+ ### Phase 5 — Verify completeness
54
61
  Walk through each spec delta and confirm the implementation covers it. Every spec string must trace to a specific line of code.`;
55
62
  const COMPONENT_RULES = `─────────────────────────────────────────────
56
63
  RULES
57
64
  ─────────────────────────────────────────────
58
65
 
59
- 1. **Functional components only.** Use \`function ComponentName\` with TypeScript. No class components.
66
+ 1. **Functional components only.** Use \`function ComponentName\` with TypeScript. No class components. When the spec requires \`forwardRef\`, use \`export const ComponentName = React.forwardRef<HTMLElement, ComponentNameProps>(function ComponentName(props, ref) { ... })\` — never write \`export function ComponentName = forwardRef(...)\` (that is invalid syntax).
60
67
  2. **Named exports.** Export the component as a named export. Export the Props type. No default exports.
61
68
  3. **Tailwind CSS.** Use Tailwind utility classes for all styling. No inline styles, no CSS modules, no styled-components.
62
69
  4. **ARIA roles.** Use semantic HTML elements and ARIA attributes for accessibility. If a spec implies a role (button, dialog, alert), use the correct element or role attribute.
@@ -65,7 +72,10 @@ RULES
65
72
  7. **No side effects.** No fetch calls, no localStorage, no timers unless a spec explicitly requires them.
66
73
  8. **No unnecessary state.** Derive from props where possible. Only use \`useState\` when the component genuinely manages internal state per spec.
67
74
  9. **Composition-ready.** If structure specs mention slots or regions, accept them as children or named props (e.g. \`header\`, \`footer\`).
68
- 10. **Code only.** Return ONLY the component file code. No markdown fences, no commentary, no file names.`;
75
+ 10. **Import paths.** Import composed UI components using the exact paths shown in the **Composed Components** section of the project context. Import utility functions from \`@/lib/utils\` (e.g. \`import { cn } from '@/lib/utils'\`). NEVER use made-up package names like \`'your-design-system'\`, \`'@company/ui'\`, or \`'@acme/components'\`. NEVER guess import paths — only use paths explicitly provided in the prompt.
76
+ 11. **Code only.** Return ONLY the component file code. No markdown fences, no commentary, no file names.
77
+ 12. **Numeric formatting.** Use the \`tabular-nums\` Tailwind class on all numeric displays (prices, counts, statistics). Use \`Intl.NumberFormat\` for currency formatting rather than string template literals with \`$\`.
78
+ 13. **Type imports for composed component props.** When you need to reference a composed component's prop type (e.g. to type an array of items), use \`import type { XProps } from '...'\` with the exact import path from the Composed Components section. Never reference a type without importing it.`;
69
79
  const COMPONENT_CHECKLIST = `─────────────────────────────────────────────
70
80
  QUALITY CHECKLIST
71
81
  ─────────────────────────────────────────────
@@ -79,7 +89,10 @@ Before returning, verify:
79
89
  - [ ] Component is exported as a named export
80
90
  - [ ] ARIA roles and semantic elements are used where specs imply them
81
91
  - [ ] No dead code or unused imports
82
- - [ ] Existing component behavior is preserved when modifying`;
92
+ - [ ] Existing component behavior is preserved when modifying
93
+ - [ ] Numeric values use tabular-nums and Intl.NumberFormat for currency
94
+ - [ ] forwardRef uses \`export const X = React.forwardRef(...)\` syntax, never \`export function X = forwardRef(...)\`
95
+ - [ ] All referenced types from composed components are imported with \`import type { ... }\``;
83
96
  export const componentPromptSections = {
84
97
  PREAMBLE: COMPONENT_PREAMBLE,
85
98
  INPUT_FORMAT: COMPONENT_INPUT_FORMAT,
@@ -166,7 +179,9 @@ RULES
166
179
  7. **No implementation testing.** Test behavior, not implementation details. Do not assert on internal state, hook calls, or component instance methods.
167
180
  8. **Async awareness.** Use \`waitFor\` or \`findBy*\` queries when specs involve async behavior (loading states, delayed rendering).
168
181
  9. **Test descriptions mirror specs.** Use spec language directly in test descriptions so traceability is obvious.
169
- 10. **Code only.** Return ONLY the test file code. No markdown fences, no commentary, no file names.`;
182
+ 10. **Code only.** Return ONLY the test file code. No markdown fences, no commentary, no file names.
183
+ 11. **Tailwind classes, not inline styles.** The project uses Tailwind CSS. In JSDOM, Tailwind utility classes are just class names — they do NOT produce computed inline styles. Use \`toHaveClass('class-name')\` for class-based assertions. NEVER use \`toHaveStyle()\` for Tailwind utilities like \`tabular-nums\`, \`touch-manipulation\`, \`min-w-[44px]\`, etc. For hover states, transforms, transitions, and pseudo-elements — JSDOM cannot compute these. Skip those assertions entirely.
184
+ 12. **Verify semantic elements from component source.** Some UI library components use unexpected elements (e.g., CardTitle renders a \`<div>\`, not a heading). If composed component source code is provided, check the actual rendered element before choosing your query strategy. Prefer \`getByText\` when the semantic element is uncertain.`;
170
185
  const TEST_CHECKLIST = `─────────────────────────────────────────────
171
186
  QUALITY CHECKLIST
172
187
  ─────────────────────────────────────────────
@@ -220,13 +235,24 @@ const STORY_OUTPUT_FORMAT = `─────────────────
220
235
  YOUR OUTPUT — A SINGLE .stories.tsx FILE
221
236
  ─────────────────────────────────────────────
222
237
 
223
- Return a single Storybook story file using CSF3 format. The file must contain:
238
+ Return a single Storybook story file using CSF3 format. Follow this exact file structure:
224
239
 
225
- 1. Import \`Meta\` and \`StoryObj\` types from \`@storybook/react\`
226
- 2. Import the component as a named import from \`./ComponentName\`
227
- 3. A \`meta\` object (typed as \`Meta<typeof ComponentName>\`) as the default export
228
- 4. Named story exports typed as \`StoryObj<typeof ComponentName>\`
229
- 5. At minimum: a \`Default\` story plus one story per distinct visual/behavioral state`;
240
+ \`\`\`
241
+ import type { Meta, StoryObj } from '@storybook/react-vite';
242
+ import { ComponentName } from '<import path from Component Import Path section>';
243
+
244
+ const meta: Meta<typeof ComponentName> = {
245
+ title: 'UI Components/ComponentName',
246
+ component: ComponentName,
247
+ };
248
+ export default meta; // ← REQUIRED — Storybook crashes without this line
249
+
250
+ type Story = StoryObj<typeof ComponentName>;
251
+
252
+ export const Default: Story = { args: { ... } };
253
+ \`\`\`
254
+
255
+ CRITICAL: The \`export default meta;\` line is **mandatory**. Without it Storybook will crash. Never omit it.`;
230
256
  const STORY_METHODOLOGY = `─────────────────────────────────────────────
231
257
  METHODOLOGY
232
258
  ─────────────────────────────────────────────
@@ -249,16 +275,20 @@ const STORY_RULES = `───────────────────
249
275
  RULES
250
276
  ─────────────────────────────────────────────
251
277
 
252
- 1. **CSF3 format.** Use \`export default meta\` and named story exports. No CSF2 \`Template.bind({})\` pattern.
253
- 2. **Named import.** Import the component as \`import { ComponentName } from './ComponentName'\`.
254
- 3. **Type annotations.** Type meta as \`Meta<typeof ComponentName>\` and stories as \`StoryObj<typeof ComponentName>\`.
255
- 4. **Prop names from spec language.** Use the exact prop names implied by the spec, matching the component and test agents.
256
- 5. **Args over render.** Prefer \`args: { ... }\` over custom \`render\` functions. Use \`render\` only when you need to wrap the component or demonstrate interaction.
257
- 6. **Action callbacks.** Use \`action('onEventName')\` from \`@storybook/addon-actions\` for callback props, or simply omit them if not critical to the story.
258
- 7. **Descriptive story names.** PascalCase names that describe the state: \`Loading\`, \`Empty\`, \`WithLongContent\`, \`Disabled\`, \`ErrorState\`.
259
- 8. **Default story first.** Always include a \`Default\` story that shows the component in its most common/ready state.
260
- 9. **No mock data in meta.** Put shared default args in \`meta.args\` only if they apply to all stories.
261
- 10. **Code only.** Return ONLY the story file code. No markdown fences, no commentary, no file names.`;
278
+ 1. **CSF3 format with default export.** You MUST include \`export default meta;\` Storybook crashes without it. Use named story exports. No CSF2 \`Template.bind({})\` pattern.
279
+ 2. **Storybook imports.** Import types from \`@storybook/react-vite\`: \`import type { Meta, StoryObj } from '@storybook/react-vite'\`. NEVER import from \`@storybook/react\` — that package is not installed.
280
+ 3. **Component import path.** Import the component using the exact path specified in the **Component Import Path** section of the user prompt. NEVER use relative imports like \`./ComponentName\` and NEVER guess the import path.
281
+ 4. **Type annotations.** Type meta as \`Meta<typeof ComponentName>\`, then define \`type Story = StoryObj<typeof ComponentName>\` and use \`Story\` for all story exports.
282
+ 5. **Prop names from spec language.** Use the exact prop names implied by the spec, matching the component and test agents.
283
+ 6. **Args over render.** Prefer \`args: { ... }\` over custom \`render\` functions. Use \`render\` only when you need to wrap the component or demonstrate composition with other components.
284
+ 7. **No action() or addon imports.** Do NOT import \`action\` from \`@storybook/addon-actions\` or \`fn\` from \`@storybook/test\` — these packages are not installed. For callback props, simply omit them from args (Storybook auto-detects and logs them), or use inline arrow functions like \`() => {}\`.
285
+ 8. **Descriptive story names.** PascalCase names that describe the state: \`Loading\`, \`Empty\`, \`WithLongContent\`, \`Disabled\`, \`ErrorState\`.
286
+ 9. **Default story first.** Always include a \`Default\` story that shows the component in its most common/ready state.
287
+ 10. **1-3 stories maximum.** Keep it minimal: a \`Default\` story, plus at most 1-2 additional stories for the most important visual states (e.g. a key variant or a loading state). Do NOT create a story for every single prop combination — focus on what a designer needs to see at a glance.
288
+ 11. **Meta fields.** Set \`title: 'UI Components/ComponentName'\` and \`component: ComponentName\` in meta. Both are required.
289
+ 12. **No mock data in meta.** Put shared default args in \`meta.args\` only if they apply to all stories.
290
+ 13. **Composed component imports.** When a story needs other UI components (e.g. for a \`render\` function demonstrating composition), import them using the exact paths shown in the **Composed Components** section of the project context. NEVER guess import paths.
291
+ 14. **Code only.** Return ONLY the story file code. No markdown fences, no commentary, no file names.`;
262
292
  const STORY_CHECKLIST = `─────────────────────────────────────────────
263
293
  QUALITY CHECKLIST
264
294
  ─────────────────────────────────────────────
@@ -269,9 +299,15 @@ Before returning, verify:
269
299
  - [ ] Every styling variant (size, color, emphasis) has a dedicated story
270
300
  - [ ] Story names are descriptive PascalCase
271
301
  - [ ] Args use prop names that match spec language
272
- - [ ] Meta has correct component reference and title
302
+ - [ ] Meta has correct component reference and \`title: 'UI Components/ComponentName'\`
303
+ - [ ] \`export default meta;\` is present (Storybook crashes without it)
304
+ - [ ] Meta has \`component: ComponentName\` field
273
305
  - [ ] CSF3 format is used throughout
274
- - [ ] No unnecessary render functions — args suffice where possible`;
306
+ - [ ] No unnecessary render functions — args suffice where possible
307
+ - [ ] Imports use \`@storybook/react-vite\` (NOT \`@storybook/react\`)
308
+ - [ ] Component imported using the exact path from the **Component Import Path** section (NOT relative path, NOT guessed)
309
+ - [ ] No \`action()\` from \`@storybook/addon-actions\` — omit callbacks or use inline arrows
310
+ - [ ] No imports from \`@storybook/test\` — \`fn()\`, \`userEvent\`, \`expect()\` are not available`;
275
311
  export const storyPromptSections = {
276
312
  PREAMBLE: STORY_PREAMBLE,
277
313
  INPUT_FORMAT: STORY_INPUT_FORMAT,
@@ -419,6 +455,21 @@ export function buildComponentPrompt(input) {
419
455
  parts.push(input.existingComponent);
420
456
  parts.push('```');
421
457
  }
458
+ if (input.testCode) {
459
+ parts.push('\n\n## Test File (source of truth — your component MUST pass every test)\n');
460
+ parts.push('The test file below was generated first and is immutable. Study it carefully:');
461
+ parts.push('- Match the exact export name the tests import');
462
+ parts.push('- Accept every prop the tests pass (with exact names)');
463
+ parts.push('- Render elements the tests query (getByRole, getByText)');
464
+ parts.push('- Wire event handlers the tests fire (fireEvent.click → onClick prop)');
465
+ parts.push('- Produce the conditional rendering the tests expect\n');
466
+ parts.push('```tsx');
467
+ parts.push(input.testCode);
468
+ parts.push('```');
469
+ }
470
+ if (input.projectSection) {
471
+ parts.push('\n\n' + input.projectSection);
472
+ }
422
473
  return {
423
474
  system: buildComponentSystemPrompt(),
424
475
  prompt: parts.join('\n'),
@@ -435,6 +486,9 @@ export function buildTestPrompt(input) {
435
486
  parts.push(input.existingComponent);
436
487
  parts.push('```');
437
488
  }
489
+ if (input.projectSection) {
490
+ parts.push('\n\n' + input.projectSection);
491
+ }
438
492
  return {
439
493
  system: buildTestSystemPrompt(),
440
494
  prompt: parts.join('\n'),
@@ -443,8 +497,19 @@ export function buildTestPrompt(input) {
443
497
  export function buildStoryPrompt(input) {
444
498
  const parts = [];
445
499
  parts.push(`Write Storybook stories for the React component **${input.componentName}** from the following spec deltas.\n`);
500
+ parts.push('## Component Import Path\n');
501
+ parts.push(`Import the component as: \`import { ${input.componentName} } from '${input.componentImportPath}'\`\n`);
446
502
  parts.push('## Spec Deltas\n');
447
503
  parts.push(buildSpecText(input.specDeltas));
504
+ if (input.componentCode) {
505
+ parts.push('\n\n## Component Code (use this as the source of truth for props, exports, and types)\n');
506
+ parts.push('```tsx');
507
+ parts.push(input.componentCode);
508
+ parts.push('```');
509
+ }
510
+ if (input.projectSection) {
511
+ parts.push('\n\n' + input.projectSection);
512
+ }
448
513
  return {
449
514
  system: buildStorySystemPrompt(),
450
515
  prompt: parts.join('\n'),
@@ -473,9 +538,154 @@ export function buildReconcilerPrompt(input) {
473
538
  parts.push('```tsx');
474
539
  parts.push(input.storyCode);
475
540
  parts.push('```');
541
+ if (input.projectSection) {
542
+ parts.push('\n\n' + input.projectSection);
543
+ }
476
544
  return {
477
545
  system: buildReconcilerSystemPrompt(),
478
546
  prompt: parts.join('\n'),
479
547
  };
480
548
  }
549
+ // ═══════════════════════════════════════════════════════════════════
550
+ // TYPE FIXER — fixes TypeScript compilation errors
551
+ // ═══════════════════════════════════════════════════════════════════
552
+ const TYPE_FIX_SYSTEM = `You are a TypeScript error fixer. You receive a React component file, its test file, and TypeScript compiler errors. Your job is to make minimal surgical changes to fix the type errors.
553
+
554
+ Return EXACTLY two code blocks:
555
+ 1. First block: the fixed component file
556
+ 2. Second block: the fixed test file
557
+
558
+ Rules:
559
+ - Fix ONLY the errors listed. Do not refactor or improve unrelated code.
560
+ - Preserve all existing behavior and functionality.
561
+ - Prefer fixing the component over the test (test is source of truth).
562
+ - If a type error is in the test, only fix it if the test has an import/type mismatch — never change test behavior.
563
+ - Return complete files, not diffs.
564
+ - No commentary, no explanations. Just the two code blocks.`;
565
+ export function buildTypeFixPrompt(input) {
566
+ const parts = [];
567
+ parts.push('## TypeScript Errors\n');
568
+ parts.push('```');
569
+ parts.push(input.errors.join('\n'));
570
+ parts.push('```');
571
+ parts.push('\n\n## Component Code\n');
572
+ parts.push('```tsx');
573
+ parts.push(input.componentCode);
574
+ parts.push('```');
575
+ parts.push('\n\n## Test Code\n');
576
+ parts.push('```tsx');
577
+ parts.push(input.testCode);
578
+ parts.push('```');
579
+ return {
580
+ system: TYPE_FIX_SYSTEM,
581
+ prompt: parts.join('\n'),
582
+ };
583
+ }
584
+ // ═══════════════════════════════════════════════════════════════════
585
+ // TEST FIXER — fixes test failures by adjusting the component
586
+ // ═══════════════════════════════════════════════════════════════════
587
+ const TEST_FIX_SYSTEM = `You are a test failure fixer. You receive a React component, its test file, and vitest failure output. The test is the source of truth — fix the component to pass the tests.
588
+
589
+ Return EXACTLY two code blocks:
590
+ 1. First block: the fixed component file
591
+ 2. Second block: the fixed test file (usually unchanged)
592
+
593
+ Rules:
594
+ - The test file is the source of truth. Prefer fixing the component.
595
+ - Only modify the test if it has a genuine bug (e.g. wrong import path, typo in query). Never weaken assertions.
596
+ - Make minimal changes to pass the failing tests without breaking passing ones.
597
+ - Return complete files, not diffs.
598
+ - No commentary, no explanations. Just the two code blocks.`;
599
+ export function buildTestFixPrompt(input) {
600
+ const parts = [];
601
+ parts.push('## Test Failures\n');
602
+ for (const failure of input.failures) {
603
+ parts.push('```');
604
+ parts.push(failure);
605
+ parts.push('```\n');
606
+ }
607
+ parts.push('\n## Test Output\n');
608
+ parts.push('```');
609
+ parts.push(input.testOutput);
610
+ parts.push('```');
611
+ parts.push('\n\n## Component Code\n');
612
+ parts.push('```tsx');
613
+ parts.push(input.componentCode);
614
+ parts.push('```');
615
+ parts.push('\n\n## Test Code\n');
616
+ parts.push('```tsx');
617
+ parts.push(input.testCode);
618
+ parts.push('```');
619
+ return {
620
+ system: TEST_FIX_SYSTEM,
621
+ prompt: parts.join('\n'),
622
+ };
623
+ }
624
+ // ═══════════════════════════════════════════════════════════════════
625
+ // LINT FIXER — fixes lint errors that biome --write couldn't auto-fix
626
+ // ═══════════════════════════════════════════════════════════════════
627
+ const LINT_FIX_SYSTEM = `You are a lint error fixer. You receive source files and lint errors that could not be auto-fixed by biome. Fix the remaining lint issues with minimal changes.
628
+
629
+ Return EXACTLY two code blocks:
630
+ 1. First block: the fixed component file
631
+ 2. Second block: the fixed test file
632
+
633
+ Rules:
634
+ - Fix ONLY the lint errors listed. Do not refactor unrelated code.
635
+ - Preserve all behavior and functionality.
636
+ - Return complete files, not diffs.
637
+ - No commentary, no explanations. Just the two code blocks.`;
638
+ export function buildLintFixPrompt(input) {
639
+ const parts = [];
640
+ parts.push('## Lint Errors\n');
641
+ parts.push('```');
642
+ parts.push(input.errors.join('\n'));
643
+ parts.push('```');
644
+ parts.push('\n\n## Component Code\n');
645
+ parts.push('```tsx');
646
+ parts.push(input.componentCode);
647
+ parts.push('```');
648
+ parts.push('\n\n## Test Code\n');
649
+ parts.push('```tsx');
650
+ parts.push(input.testCode);
651
+ parts.push('```');
652
+ return {
653
+ system: LINT_FIX_SYSTEM,
654
+ prompt: parts.join('\n'),
655
+ };
656
+ }
657
+ // ═══════════════════════════════════════════════════════════════════
658
+ // STORY FIXER — fixes story type errors
659
+ // ═══════════════════════════════════════════════════════════════════
660
+ const STORY_FIX_SYSTEM = `You are a Storybook story fixer. You receive a story file, the component it references, and TypeScript errors. Fix the story to compile correctly.
661
+
662
+ Return EXACTLY one code block: the fixed story file.
663
+
664
+ Rules:
665
+ - Fix ONLY the errors listed. Do not add stories or change story behavior.
666
+ - Ensure imports match the component's actual exports.
667
+ - Ensure args match the component's actual props.
668
+ - Use CSF3 format with \`export default meta;\`.
669
+ - Import types from \`@storybook/react-vite\`.
670
+ - Return the complete file, not a diff.
671
+ - No commentary, no explanations. Just the one code block.`;
672
+ export function buildStoryFixPrompt(input) {
673
+ const parts = [];
674
+ parts.push('## TypeScript Errors\n');
675
+ parts.push('```');
676
+ parts.push(input.errors.join('\n'));
677
+ parts.push('```');
678
+ parts.push('\n\n## Story Code\n');
679
+ parts.push('```tsx');
680
+ parts.push(input.storyCode);
681
+ parts.push('```');
682
+ parts.push('\n\n## Component Code (reference)\n');
683
+ parts.push('```tsx');
684
+ parts.push(input.componentCode);
685
+ parts.push('```');
686
+ return {
687
+ system: STORY_FIX_SYSTEM,
688
+ prompt: parts.join('\n'),
689
+ };
690
+ }
481
691
  //# sourceMappingURL=prompt.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"prompt.js","sourceRoot":"","sources":["../../src/prompt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAmB,MAAM,iBAAiB,CAAC;AAWjE,sEAAsE;AACtE,iDAAiD;AACjD,sEAAsE;AAEtE,MAAM,kBAAkB,GAAG;;;;;;;;8VAQmU,CAAC;AAE/V,MAAM,sBAAsB,GAAG;;;;;;;;;;;;;4HAa6F,CAAC;AAE7H,MAAM,uBAAuB,GAAG;;;;;;;;;sBASV,CAAC;AAEvB,MAAM,qBAAqB,GAAG;;;;;;;;;;;;;;;;gIAgBkG,CAAC;AAEjI,MAAM,eAAe,GAAG;;;;;;;;;;;;;0GAakF,CAAC;AAE3G,MAAM,mBAAmB,GAAG;;;;;;;;;;;;;8DAakC,CAAC;AAE/D,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,QAAQ,EAAE,kBAAkB;IAC5B,YAAY,EAAE,sBAAsB;IACpC,aAAa,EAAE,uBAAuB;IACtC,WAAW,EAAE,qBAAqB;IAClC,KAAK,EAAE,eAAe;IACtB,SAAS,EAAE,mBAAmB;CACtB,CAAC;AAEX,SAAS,0BAA0B;IACjC,OAAO;QACL,kBAAkB;QAClB,sBAAsB;QACtB,uBAAuB;QACvB,qBAAqB;QACrB,eAAe;QACf,mBAAmB;KACpB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AACjB,CAAC;AAED,sEAAsE;AACtE,gDAAgD;AAChD,sEAAsE;AAEtE,MAAM,aAAa,GAAG;;;;;;;;yVAQmU,CAAC;AAE1V,MAAM,iBAAiB,GAAG;;;;;;;;;;;;;6HAamG,CA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