@bonesofspring/ai-rules 0.2.31 → 0.2.32

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 (313) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/docs/LOCAL-OVERLAY.md +14 -0
  3. package/package.json +1 -1
  4. package/presets/claude/android-kotlin/rules/tooling-and-review/agent-team-orchestrator.md +1 -2
  5. package/presets/claude/go/rules/tooling-and-review/agent-team-orchestrator.md +1 -2
  6. package/presets/claude/ios-swift/rules/tooling-and-review/agent-team-orchestrator.md +1 -2
  7. package/presets/claude/java/rules/tooling-and-review/agent-team-orchestrator.md +1 -2
  8. package/presets/claude/mcp-ts/rules/tooling-and-review/agent-team-orchestrator.md +1 -2
  9. package/presets/claude/next/REPO_AGENTS.md +11 -1
  10. package/presets/claude/next/agents/build-verifier.md +1 -0
  11. package/presets/claude/next/agents/code-reviewer.md +1 -0
  12. package/presets/claude/next/agents/feature-developer.md +1 -0
  13. package/presets/claude/next/agents/openspec-author.md +2 -0
  14. package/presets/claude/next/agents/task-analyst.md +7 -0
  15. package/presets/claude/next/agents/task-router.md +1 -0
  16. package/presets/claude/next/rules/README.md +3 -0
  17. package/presets/claude/next/rules/anti-hallucination/react-next-anti-hallucination.md +10 -0
  18. package/presets/claude/next/rules/api-and-data/store-rtk.md +6 -0
  19. package/presets/claude/next/rules/architecture/feature-delivery-workflow.md +5 -1
  20. package/presets/claude/next/rules/architecture/product-specs-authoring.md +1 -0
  21. package/presets/claude/next/rules/architecture/product-specs.md +1 -0
  22. package/presets/claude/next/rules/architecture/reference-features.md +5 -0
  23. package/presets/claude/next/rules/stack/next-app-core.md +3 -0
  24. package/presets/claude/next/rules/stack/next-static-export.md +36 -0
  25. package/presets/claude/next/rules/testing/tests-e2e-structure.md +1 -0
  26. package/presets/claude/next/rules/testing/tests-unit.md +1 -0
  27. package/presets/claude/next/rules/tooling-and-review/agent-team-orchestrator.md +1 -2
  28. package/presets/claude/next/rules/tooling-and-review/ai-local-overlay.md +16 -2
  29. package/presets/claude/next/rules/tooling-and-review/code-review-mr.md +4 -0
  30. package/presets/claude/next/rules/tooling-and-review/mcp-usage.md +1 -0
  31. package/presets/claude/next/rules/tooling-and-review/post-change-lint.md +4 -0
  32. package/presets/claude/next/rules/tooling-and-review/security-next.md +13 -0
  33. package/presets/claude/next/rules/ui-and-accessibility/component-catalog-gate.md +39 -0
  34. package/presets/claude/next/rules/ui-and-accessibility/design-tokens-binding.md +1 -1
  35. package/presets/claude/next/rules/ui-and-accessibility/forms-validation.md +35 -0
  36. package/presets/claude/next/rules/ui-and-accessibility/react-ui.md +19 -1
  37. package/presets/claude/next/team/fixtures/feature-with-ux-no-figma.json +3 -4
  38. package/presets/claude/nuxt/rules/tooling-and-review/agent-team-orchestrator.md +1 -2
  39. package/presets/claude/php-hexagonal/rules/tooling-and-review/agent-team-orchestrator.md +1 -2
  40. package/presets/claude/php-laravel/rules/tooling-and-review/agent-team-orchestrator.md +1 -2
  41. package/presets/claude/svelte/rules/tooling-and-review/agent-team-orchestrator.md +1 -2
  42. package/presets/cursor/android-kotlin/rules/agent-team-orchestrator.mdc +1 -1
  43. package/presets/cursor/go/rules/agent-team-orchestrator.mdc +1 -1
  44. package/presets/cursor/ios-swift/rules/agent-team-orchestrator.mdc +1 -1
  45. package/presets/cursor/java/rules/agent-team-orchestrator.mdc +1 -1
  46. package/presets/cursor/mcp-ts/rules/agent-team-orchestrator.mdc +1 -1
  47. package/presets/cursor/next/REPO_AGENTS.md +11 -1
  48. package/presets/cursor/next/agents/build-verifier.md +1 -0
  49. package/presets/cursor/next/agents/code-reviewer.md +1 -0
  50. package/presets/cursor/next/agents/feature-developer.md +1 -0
  51. package/presets/cursor/next/agents/openspec-author.md +2 -0
  52. package/presets/cursor/next/agents/task-analyst.md +7 -0
  53. package/presets/cursor/next/agents/task-router.md +1 -0
  54. package/presets/cursor/next/ai-local/rules-library/agent-artifacts-no-local-paths.md +41 -8
  55. package/presets/cursor/next/ai-local/rules-library/agent-pipeline-gates.md +19 -0
  56. package/presets/cursor/next/ai-local/rules-library/analytics-events.md +18 -0
  57. package/presets/cursor/next/ai-local/rules-library/api-contract-source.md +14 -0
  58. package/presets/cursor/next/ai-local/rules-library/artifact-lifecycle.md +17 -0
  59. package/presets/cursor/next/ai-local/rules-library/code-style.md +68 -0
  60. package/presets/cursor/next/ai-local/rules-library/component-child-decomposition.md +81 -0
  61. package/presets/cursor/next/ai-local/rules-library/feature-flags-experiments.md +15 -0
  62. package/presets/cursor/next/ai-local/rules-library/mcp-required-for-ui-layout.md +1 -1
  63. package/presets/cursor/next/ai-local/rules-library/no-react-fc.md +46 -0
  64. package/presets/cursor/next/ai-local/rules-library/no-test-driven-behavior-change.md +1 -1
  65. package/presets/cursor/next/ai-local/rules-library/pwa-service-worker.md +15 -0
  66. package/presets/cursor/next/ai-local/rules-library/qa-test-cases.md +14 -0
  67. package/presets/cursor/next/ai-local/rules-library/router-pages.md +4 -2
  68. package/presets/cursor/next/ai-local/rules-library/single-source-copy-constants.md +3 -1
  69. package/presets/cursor/next/ai-local/rules-library/storybook-catalog-structure.md +62 -0
  70. package/presets/cursor/next/ai-local/rules-library/storybook-cleanup-temp-screenshots.md +40 -0
  71. package/presets/cursor/next/ai-local/rules-library/storybook-csf-authoring.md +100 -0
  72. package/presets/cursor/next/ai-local/rules-library/storybook-dev-compare-figma.md +67 -0
  73. package/presets/cursor/next/ai-local/rules-library/storybook-keep-tests-current.md +75 -0
  74. package/presets/cursor/next/ai-local/rules-library/storybook-modals.md +64 -0
  75. package/presets/cursor/next/ai-local/rules-library/storybook-no-app-node-modules.md +40 -0
  76. package/presets/cursor/next/ai-local/rules-library/storybook-ui-quality-gate.md +38 -0
  77. package/presets/cursor/next/ai-local/rules-library/task-levels.md +28 -0
  78. package/presets/cursor/next/ai-local/rules-library/ui-change-review-gate.md +14 -0
  79. package/presets/cursor/next/rules/README.md +4 -1
  80. package/presets/cursor/next/rules/agent-team-orchestrator.mdc +1 -1
  81. package/presets/cursor/next/rules/ai-local-overlay.mdc +16 -2
  82. package/presets/cursor/next/rules/code-review-mr.mdc +4 -0
  83. package/presets/cursor/next/rules/component-catalog-gate.mdc +38 -0
  84. package/presets/cursor/next/rules/design-tokens-binding.mdc +1 -1
  85. package/presets/cursor/next/rules/feature-delivery-workflow.mdc +5 -1
  86. package/presets/cursor/next/rules/forms-validation.mdc +33 -0
  87. package/presets/cursor/next/rules/mcp-usage.mdc +1 -0
  88. package/presets/cursor/next/rules/next-app-core.mdc +3 -0
  89. package/presets/cursor/next/rules/next-static-export.mdc +35 -0
  90. package/presets/cursor/next/rules/post-change-lint.mdc +4 -0
  91. package/presets/cursor/next/rules/product-specs-authoring.mdc +1 -0
  92. package/presets/cursor/next/rules/product-specs.mdc +1 -0
  93. package/presets/cursor/next/rules/react-next-anti-hallucination.mdc +10 -0
  94. package/presets/cursor/next/rules/react-ui.mdc +19 -1
  95. package/presets/cursor/next/rules/reference-features.mdc +5 -0
  96. package/presets/cursor/next/rules/security-next.mdc +12 -0
  97. package/presets/cursor/next/rules/store-rtk.mdc +6 -0
  98. package/presets/cursor/next/rules/tests-e2e-structure.mdc +1 -0
  99. package/presets/cursor/next/rules/tests-unit.mdc +1 -0
  100. package/presets/cursor/next/team/fixtures/feature-with-ux-no-figma.json +3 -4
  101. package/presets/cursor/nuxt/rules/agent-team-orchestrator.mdc +1 -1
  102. package/presets/cursor/php-hexagonal/rules/agent-team-orchestrator.mdc +1 -1
  103. package/presets/cursor/php-laravel/rules/agent-team-orchestrator.mdc +1 -1
  104. package/presets/cursor/svelte/rules/agent-team-orchestrator.mdc +1 -1
  105. package/presets/mavis/android-kotlin/adapter-map.json +1 -1
  106. package/presets/mavis/android-kotlin/rules/agent-team-orchestrator.md +1 -2
  107. package/presets/mavis/android-kotlin/rules/code-review-mr.md +6 -6
  108. package/presets/mavis/go/adapter-map.json +1 -1
  109. package/presets/mavis/go/rules/agent-team-orchestrator.md +1 -2
  110. package/presets/mavis/go/rules/code-quality-and-refactoring.md +1 -1
  111. package/presets/mavis/ios-swift/adapter-map.json +1 -1
  112. package/presets/mavis/ios-swift/rules/agent-team-orchestrator.md +1 -2
  113. package/presets/mavis/ios-swift/rules/code-quality-and-refactoring.md +1 -1
  114. package/presets/mavis/ios-swift/rules/code-review-mr.md +6 -6
  115. package/presets/mavis/ios-swift/rules/feature-delivery-workflow.md +14 -14
  116. package/presets/mavis/ios-swift/rules/reference-features.md +3 -3
  117. package/presets/mavis/java/adapter-map.json +1 -1
  118. package/presets/mavis/java/rules/agent-team-orchestrator.md +1 -2
  119. package/presets/mavis/java/rules/code-quality-and-refactoring.md +1 -1
  120. package/presets/mavis/mcp-ts/adapter-map.json +1 -1
  121. package/presets/mavis/mcp-ts/rules/agent-team-orchestrator.md +1 -2
  122. package/presets/mavis/next/REPO_AGENTS.md +11 -1
  123. package/presets/mavis/next/adapter-map.json +192 -8
  124. package/presets/mavis/next/agents/build-verifier.md +1 -0
  125. package/presets/mavis/next/agents/code-reviewer.md +1 -0
  126. package/presets/mavis/next/agents/feature-developer.md +1 -0
  127. package/presets/mavis/next/agents/openspec-author.md +2 -0
  128. package/presets/mavis/next/agents/task-analyst.md +7 -0
  129. package/presets/mavis/next/agents/task-router.md +1 -0
  130. package/presets/mavis/next/ai-local/rules-library/agent-artifacts-no-local-paths.md +41 -8
  131. package/presets/mavis/next/ai-local/rules-library/agent-pipeline-gates.md +19 -0
  132. package/presets/mavis/next/ai-local/rules-library/analytics-events.md +18 -0
  133. package/presets/mavis/next/ai-local/rules-library/api-contract-source.md +14 -0
  134. package/presets/mavis/next/ai-local/rules-library/artifact-lifecycle.md +17 -0
  135. package/presets/mavis/next/ai-local/rules-library/code-style.md +68 -0
  136. package/presets/mavis/next/ai-local/rules-library/component-child-decomposition.md +81 -0
  137. package/presets/mavis/next/ai-local/rules-library/feature-flags-experiments.md +15 -0
  138. package/presets/mavis/next/ai-local/rules-library/mcp-required-for-ui-layout.md +1 -1
  139. package/presets/mavis/next/ai-local/rules-library/no-react-fc.md +46 -0
  140. package/presets/mavis/next/ai-local/rules-library/no-test-driven-behavior-change.md +1 -1
  141. package/presets/mavis/next/ai-local/rules-library/pwa-service-worker.md +15 -0
  142. package/presets/mavis/next/ai-local/rules-library/qa-test-cases.md +14 -0
  143. package/presets/mavis/next/ai-local/rules-library/router-pages.md +4 -2
  144. package/presets/mavis/next/ai-local/rules-library/single-source-copy-constants.md +3 -1
  145. package/presets/mavis/next/ai-local/rules-library/storybook-catalog-structure.md +62 -0
  146. package/presets/mavis/next/ai-local/rules-library/storybook-cleanup-temp-screenshots.md +40 -0
  147. package/presets/mavis/next/ai-local/rules-library/storybook-csf-authoring.md +100 -0
  148. package/presets/mavis/next/ai-local/rules-library/storybook-dev-compare-figma.md +67 -0
  149. package/presets/mavis/next/ai-local/rules-library/storybook-keep-tests-current.md +75 -0
  150. package/presets/mavis/next/ai-local/rules-library/storybook-modals.md +64 -0
  151. package/presets/mavis/next/ai-local/rules-library/storybook-no-app-node-modules.md +40 -0
  152. package/presets/mavis/next/ai-local/rules-library/storybook-ui-quality-gate.md +38 -0
  153. package/presets/mavis/next/ai-local/rules-library/task-levels.md +28 -0
  154. package/presets/mavis/next/ai-local/rules-library/ui-change-review-gate.md +14 -0
  155. package/presets/mavis/next/rules/agent-team-orchestrator.md +1 -2
  156. package/presets/mavis/next/rules/ai-local-overlay.md +16 -2
  157. package/presets/mavis/next/rules/code-quality-and-refactoring.md +2 -2
  158. package/presets/mavis/next/rules/code-review-mr.md +11 -7
  159. package/presets/mavis/next/rules/component-catalog-gate.md +31 -0
  160. package/presets/mavis/next/rules/design-tokens-binding.md +1 -1
  161. package/presets/mavis/next/rules/feature-delivery-workflow.md +22 -18
  162. package/presets/mavis/next/rules/forms-validation.md +26 -0
  163. package/presets/mavis/next/rules/mcp-usage.md +1 -0
  164. package/presets/mavis/next/rules/mockup-review.md +1 -1
  165. package/presets/mavis/next/rules/next-app-core.md +3 -0
  166. package/presets/mavis/next/rules/next-static-export.md +28 -0
  167. package/presets/mavis/next/rules/post-change-lint.md +4 -0
  168. package/presets/mavis/next/rules/product-specs-authoring.md +1 -0
  169. package/presets/mavis/next/rules/product-specs.md +1 -0
  170. package/presets/mavis/next/rules/react-next-anti-hallucination.md +10 -0
  171. package/presets/mavis/next/rules/react-ui.md +19 -1
  172. package/presets/mavis/next/rules/reference-features.md +7 -2
  173. package/presets/mavis/next/rules/security-next.md +12 -0
  174. package/presets/mavis/next/rules/store-rtk.md +6 -0
  175. package/presets/mavis/next/rules/tests-e2e-structure.md +2 -1
  176. package/presets/mavis/next/rules/tests-unit.md +1 -0
  177. package/presets/mavis/next/team/fixtures/feature-with-ux-no-figma.json +3 -4
  178. package/presets/mavis/nuxt/adapter-map.json +1 -1
  179. package/presets/mavis/nuxt/rules/agent-team-orchestrator.md +1 -2
  180. package/presets/mavis/nuxt/rules/code-review-mr.md +6 -6
  181. package/presets/mavis/nuxt/rules/feature-delivery-workflow.md +15 -15
  182. package/presets/mavis/nuxt/rules/reference-features.md +2 -2
  183. package/presets/mavis/nuxt/rules/tests-e2e-structure.md +1 -1
  184. package/presets/mavis/php-hexagonal/adapter-map.json +1 -1
  185. package/presets/mavis/php-hexagonal/rules/agent-team-orchestrator.md +1 -2
  186. package/presets/mavis/php-hexagonal/rules/code-quality-and-refactoring.md +1 -1
  187. package/presets/mavis/php-laravel/adapter-map.json +1 -1
  188. package/presets/mavis/php-laravel/rules/agent-team-orchestrator.md +1 -2
  189. package/presets/mavis/php-laravel/rules/code-quality-and-refactoring.md +1 -1
  190. package/presets/mavis/svelte/adapter-map.json +1 -1
  191. package/presets/mavis/svelte/rules/agent-team-orchestrator.md +1 -2
  192. package/presets/mavis/svelte/rules/code-review-mr.md +6 -6
  193. package/presets/mavis/svelte/rules/feature-delivery-workflow.md +1 -1
  194. package/presets/mavis/svelte/rules/reference-features.md +2 -2
  195. package/presets/mavis/svelte/rules/tests-e2e-structure.md +1 -1
  196. package/presets/opencode/android-kotlin/adapter-map.json +1 -1
  197. package/presets/opencode/android-kotlin/rules/agent-team-orchestrator.md +1 -2
  198. package/presets/opencode/android-kotlin/rules/code-review-mr.md +6 -6
  199. package/presets/opencode/go/adapter-map.json +1 -1
  200. package/presets/opencode/go/rules/agent-team-orchestrator.md +1 -2
  201. package/presets/opencode/go/rules/code-quality-and-refactoring.md +1 -1
  202. package/presets/opencode/ios-swift/adapter-map.json +1 -1
  203. package/presets/opencode/ios-swift/rules/agent-team-orchestrator.md +1 -2
  204. package/presets/opencode/ios-swift/rules/code-quality-and-refactoring.md +1 -1
  205. package/presets/opencode/ios-swift/rules/code-review-mr.md +6 -6
  206. package/presets/opencode/ios-swift/rules/feature-delivery-workflow.md +14 -14
  207. package/presets/opencode/ios-swift/rules/reference-features.md +3 -3
  208. package/presets/opencode/java/adapter-map.json +1 -1
  209. package/presets/opencode/java/rules/agent-team-orchestrator.md +1 -2
  210. package/presets/opencode/java/rules/code-quality-and-refactoring.md +1 -1
  211. package/presets/opencode/mcp-ts/adapter-map.json +1 -1
  212. package/presets/opencode/mcp-ts/rules/agent-team-orchestrator.md +1 -2
  213. package/presets/opencode/next/REPO_AGENTS.md +11 -1
  214. package/presets/opencode/next/adapter-map.json +192 -8
  215. package/presets/opencode/next/agents/build-verifier.md +1 -0
  216. package/presets/opencode/next/agents/code-reviewer.md +1 -0
  217. package/presets/opencode/next/agents/feature-developer.md +1 -0
  218. package/presets/opencode/next/agents/openspec-author.md +2 -0
  219. package/presets/opencode/next/agents/task-analyst.md +7 -0
  220. package/presets/opencode/next/agents/task-router.md +1 -0
  221. package/presets/opencode/next/ai-local/rules-library/agent-artifacts-no-local-paths.md +41 -8
  222. package/presets/opencode/next/ai-local/rules-library/agent-pipeline-gates.md +19 -0
  223. package/presets/opencode/next/ai-local/rules-library/analytics-events.md +18 -0
  224. package/presets/opencode/next/ai-local/rules-library/api-contract-source.md +14 -0
  225. package/presets/opencode/next/ai-local/rules-library/artifact-lifecycle.md +17 -0
  226. package/presets/opencode/next/ai-local/rules-library/code-style.md +68 -0
  227. package/presets/opencode/next/ai-local/rules-library/component-child-decomposition.md +81 -0
  228. package/presets/opencode/next/ai-local/rules-library/feature-flags-experiments.md +15 -0
  229. package/presets/opencode/next/ai-local/rules-library/mcp-required-for-ui-layout.md +1 -1
  230. package/presets/opencode/next/ai-local/rules-library/no-react-fc.md +46 -0
  231. package/presets/opencode/next/ai-local/rules-library/no-test-driven-behavior-change.md +1 -1
  232. package/presets/opencode/next/ai-local/rules-library/pwa-service-worker.md +15 -0
  233. package/presets/opencode/next/ai-local/rules-library/qa-test-cases.md +14 -0
  234. package/presets/opencode/next/ai-local/rules-library/router-pages.md +4 -2
  235. package/presets/opencode/next/ai-local/rules-library/single-source-copy-constants.md +3 -1
  236. package/presets/opencode/next/ai-local/rules-library/storybook-catalog-structure.md +62 -0
  237. package/presets/opencode/next/ai-local/rules-library/storybook-cleanup-temp-screenshots.md +40 -0
  238. package/presets/opencode/next/ai-local/rules-library/storybook-csf-authoring.md +100 -0
  239. package/presets/opencode/next/ai-local/rules-library/storybook-dev-compare-figma.md +67 -0
  240. package/presets/opencode/next/ai-local/rules-library/storybook-keep-tests-current.md +75 -0
  241. package/presets/opencode/next/ai-local/rules-library/storybook-modals.md +64 -0
  242. package/presets/opencode/next/ai-local/rules-library/storybook-no-app-node-modules.md +40 -0
  243. package/presets/opencode/next/ai-local/rules-library/storybook-ui-quality-gate.md +38 -0
  244. package/presets/opencode/next/ai-local/rules-library/task-levels.md +28 -0
  245. package/presets/opencode/next/ai-local/rules-library/ui-change-review-gate.md +14 -0
  246. package/presets/opencode/next/rules/agent-team-orchestrator.md +1 -2
  247. package/presets/opencode/next/rules/ai-local-overlay.md +16 -2
  248. package/presets/opencode/next/rules/code-quality-and-refactoring.md +2 -2
  249. package/presets/opencode/next/rules/code-review-mr.md +11 -7
  250. package/presets/opencode/next/rules/component-catalog-gate.md +31 -0
  251. package/presets/opencode/next/rules/design-tokens-binding.md +1 -1
  252. package/presets/opencode/next/rules/feature-delivery-workflow.md +22 -18
  253. package/presets/opencode/next/rules/forms-validation.md +26 -0
  254. package/presets/opencode/next/rules/mcp-usage.md +1 -0
  255. package/presets/opencode/next/rules/mockup-review.md +1 -1
  256. package/presets/opencode/next/rules/next-app-core.md +3 -0
  257. package/presets/opencode/next/rules/next-static-export.md +28 -0
  258. package/presets/opencode/next/rules/post-change-lint.md +4 -0
  259. package/presets/opencode/next/rules/product-specs-authoring.md +1 -0
  260. package/presets/opencode/next/rules/product-specs.md +1 -0
  261. package/presets/opencode/next/rules/react-next-anti-hallucination.md +10 -0
  262. package/presets/opencode/next/rules/react-ui.md +19 -1
  263. package/presets/opencode/next/rules/reference-features.md +7 -2
  264. package/presets/opencode/next/rules/security-next.md +12 -0
  265. package/presets/opencode/next/rules/store-rtk.md +6 -0
  266. package/presets/opencode/next/rules/tests-e2e-structure.md +2 -1
  267. package/presets/opencode/next/rules/tests-unit.md +1 -0
  268. package/presets/opencode/next/team/fixtures/feature-with-ux-no-figma.json +3 -4
  269. package/presets/opencode/nuxt/adapter-map.json +1 -1
  270. package/presets/opencode/nuxt/rules/agent-team-orchestrator.md +1 -2
  271. package/presets/opencode/nuxt/rules/code-review-mr.md +6 -6
  272. package/presets/opencode/nuxt/rules/feature-delivery-workflow.md +15 -15
  273. package/presets/opencode/nuxt/rules/reference-features.md +2 -2
  274. package/presets/opencode/nuxt/rules/tests-e2e-structure.md +1 -1
  275. package/presets/opencode/php-hexagonal/adapter-map.json +1 -1
  276. package/presets/opencode/php-hexagonal/rules/agent-team-orchestrator.md +1 -2
  277. package/presets/opencode/php-hexagonal/rules/code-quality-and-refactoring.md +1 -1
  278. package/presets/opencode/php-laravel/adapter-map.json +1 -1
  279. package/presets/opencode/php-laravel/rules/agent-team-orchestrator.md +1 -2
  280. package/presets/opencode/php-laravel/rules/code-quality-and-refactoring.md +1 -1
  281. package/presets/opencode/svelte/adapter-map.json +1 -1
  282. package/presets/opencode/svelte/rules/agent-team-orchestrator.md +1 -2
  283. package/presets/opencode/svelte/rules/code-review-mr.md +6 -6
  284. package/presets/opencode/svelte/rules/feature-delivery-workflow.md +1 -1
  285. package/presets/opencode/svelte/rules/reference-features.md +2 -2
  286. package/presets/opencode/svelte/rules/tests-e2e-structure.md +1 -1
  287. package/scripts/check-generated-drift.mjs +42 -2
  288. package/scripts/check-local-overlay.sh +39 -0
  289. package/scripts/fixtures/cli-golden/claude/next.json +44 -41
  290. package/scripts/fixtures/cli-golden/cursor/next.json +69 -46
  291. package/scripts/fixtures/cli-golden/mavis/android-kotlin.json +21 -21
  292. package/scripts/fixtures/cli-golden/mavis/go.json +8 -8
  293. package/scripts/fixtures/cli-golden/mavis/ios-swift.json +12 -12
  294. package/scripts/fixtures/cli-golden/mavis/java.json +8 -8
  295. package/scripts/fixtures/cli-golden/mavis/mcp-ts.json +5 -5
  296. package/scripts/fixtures/cli-golden/mavis/next.json +70 -47
  297. package/scripts/fixtures/cli-golden/mavis/nuxt.json +25 -25
  298. package/scripts/fixtures/cli-golden/mavis/php-hexagonal.json +8 -8
  299. package/scripts/fixtures/cli-golden/mavis/php-laravel.json +8 -8
  300. package/scripts/fixtures/cli-golden/mavis/svelte.json +25 -25
  301. package/scripts/fixtures/cli-golden/opencode/android-kotlin.json +21 -21
  302. package/scripts/fixtures/cli-golden/opencode/go.json +8 -8
  303. package/scripts/fixtures/cli-golden/opencode/ios-swift.json +12 -12
  304. package/scripts/fixtures/cli-golden/opencode/java.json +8 -8
  305. package/scripts/fixtures/cli-golden/opencode/mcp-ts.json +5 -5
  306. package/scripts/fixtures/cli-golden/opencode/next.json +70 -47
  307. package/scripts/fixtures/cli-golden/opencode/nuxt.json +25 -25
  308. package/scripts/fixtures/cli-golden/opencode/php-hexagonal.json +8 -8
  309. package/scripts/fixtures/cli-golden/opencode/php-laravel.json +8 -8
  310. package/scripts/fixtures/cli-golden/opencode/svelte.json +25 -25
  311. package/scripts/lib/generate-adapter-common.mjs +17 -0
  312. package/scripts/lib/generate-mavis-adapter.mjs +9 -3
  313. package/scripts/lib/generate-opencode-adapter.mjs +9 -3
@@ -0,0 +1,15 @@
1
+ globs: app/src/constants/**/*.{ts,tsx},app/src/ui/**/*.{ts,tsx}
2
+
3
+ ## Body
4
+
5
+ # Feature flags & experiments (team conventions template)
6
+
7
+ When gating UI/behaviour by a flag or A/B experiment, acknowledge: `Using .ai.local: feature-flags-experiments(, …)*`.
8
+
9
+ ## Rules
10
+
11
+ - Local flags live in one module (e.g. `app/src/constants/localFeatureFlags.ts`) as `isFeature…Enabled`; remote experiments come from the experiments client (`@sh/experiments` analog).
12
+ - Read a flag through the repo's access path — a store slice / provider / singleton mounted at the app root — not by scattering `process.env` checks or ad-hoc constants.
13
+ - Experiment-gated routes are registered in the repo's allowlist (e.g. `EXPERIMENT_PAGES`); do not invent a parallel mechanism.
14
+ - Experimental / legacy page variants are **non-canonical** — do not copy them as the reference for new work, and do not delete a flag without the paired spec / story / e2e sync (flag removal is a cross-cutting change).
15
+ - A flag that flips layout or visual identity is still one purpose per component after the flag is removed — do not bake the flag into a universal branchy component (`react-ui`).
@@ -1,4 +1,4 @@
1
- globs: src/ui/**
1
+ globs: app/src/ui/**
2
2
 
3
3
  ## Body
4
4
 
@@ -0,0 +1,46 @@
1
+ globs: **/*.{tsx,ts}
2
+
3
+ ## Body
4
+
5
+ # No `FC` / `React.FC`
6
+
7
+ When this rule applies, acknowledge: `Using .ai.local: no-react-fc(, …)*`.
8
+
9
+ Do **not** type React components as `FC`, `React.FC`, `FunctionComponent`, or `React.FunctionComponent`.
10
+
11
+ `FC` adds implicit `children`, is outdated for React 18+, and the rest of a typical repo already uses a plain arrow + props type.
12
+
13
+ ## Required shape
14
+
15
+ ```tsx
16
+ interface IProps {
17
+ title: string
18
+ }
19
+
20
+ export const Example = ({ title }: IProps) => {
21
+ return <s.Root>{title}</s.Root>
22
+ }
23
+ ```
24
+
25
+ If there are no props:
26
+
27
+ ```tsx
28
+ export const Example = () => <s.Root />
29
+ ```
30
+
31
+ ## Forbidden
32
+
33
+ ```tsx
34
+ import { type FC } from 'react'
35
+
36
+ export const Example: FC<IProps> = ({ title }) => { /* … */ }
37
+ ```
38
+
39
+ ```tsx
40
+ export const Example: React.FC<IProps> = ({ title }) => { /* … */ }
41
+ ```
42
+
43
+ ## Notes
44
+
45
+ - Type props with `interface IProps` / `type TProps` (match the neighboring file).
46
+ - If the component accepts `children`, declare `children` explicitly on the props type — do not get it from `FC`.
@@ -1,4 +1,4 @@
1
- globs: src/**/*.{ts,tsx}
1
+ globs: app/src/**/*.{ts,tsx},app/__tests__/**/*.{ts,tsx},storybook/**/*.stories.tsx
2
2
 
3
3
  ## Body
4
4
 
@@ -0,0 +1,15 @@
1
+ globs: app/src/lib/pwa/**/*.{ts,tsx},app/public/**
2
+
3
+ ## Body
4
+
5
+ # PWA / service worker (team conventions template)
6
+
7
+ When touching the service worker, manifest, or offline behaviour, acknowledge: `Using .ai.local: pwa-service-worker(, …)*`.
8
+
9
+ ## Rules
10
+
11
+ - Service worker and web manifest are wired through the app root / document head via one init hook; do not register a second service worker or add a competing `<link rel="manifest">`.
12
+ - Service-worker scope and asset paths are derived from `basePath` / `assetPrefix` — a hardcoded `/` breaks scoped deployments.
13
+ - A dev-only `Service-Worker-Allowed` header (or equivalent) is a dev concern; do not assume it exists in production.
14
+ - Do not introduce `next-pwa`-style tooling unless the repo already uses it; follow the existing registration path.
15
+ - Offline/caching changes are behaviour changes: update the spec / e2e / QA case that covers offline flows.
@@ -0,0 +1,14 @@
1
+ globs: docs/qa/**/*.md,app/__tests__/e2e/**/*.cases.md
2
+
3
+ ## Body
4
+
5
+ # Consolidated QA test cases (`docs/qa/**`)
6
+
7
+ When editing QA case docs or the matching e2e plan, acknowledge: `Using .ai.local: qa-test-cases(, …)*`.
8
+
9
+ ## Rules
10
+
11
+ - A consolidated QA doc (`docs/qa/<area>-test-cases.md`) is a **derived view** of the spec + `*.cases.md` — not a second source of truth. Cite the source (spec path / scenario id) per case.
12
+ - Keep the route table, PREFIX map, and grouping in sync with the executable plan; mark each case `as-is` (characterization) or `target` (planned).
13
+ - On a behaviour change, update the QA doc in the same changeset as the `*.cases.md` / spec.
14
+ - Do not weaken or delete cases to match an unintended behaviour change — fix the implementation or file a task (`no-test-driven-behavior-change`).
@@ -1,5 +1,5 @@
1
1
  override: kill next-app-router
2
- globs: src/pages/**/*.{ts,tsx},src/ui/**/*.{ts,tsx},next.config.ts
2
+ globs: app/src/pages/**/*.{ts,tsx},app/src/ui/**/*.{ts,tsx},app/next.config.ts
3
3
 
4
4
  ## Body
5
5
 
@@ -15,9 +15,11 @@ This rule drops the preset's `next-app-router` rule from context for repos using
15
15
  - Domain UI lives in `src/ui/pages/<Name>Page`; route files do not contain layout/business logic.
16
16
  - Navigation: `next/router` (`useRouter`) and `next/link`. **Never** `next/navigation`.
17
17
  - `_app.tsx` / `_document.tsx` stay in `src/pages/`.
18
+ - Dynamic routes: the dynamic segment is **last**, `[id].tsx` → `[id].html`; do **not** add catch-all `[...slug]` routes. Read a dynamic param only after the router is ready (`useRouterReady()` analog) and parse it with the repo's slug helper; push `/404` when it is invalid.
18
19
 
19
20
  ## Forbidden
20
21
 
21
22
  - Creating App Router files (`src/app/**`, `page.tsx`, `layout.tsx`, `loading.tsx`, `error.tsx`, `route.ts`).
22
23
  - Importing `next/navigation` or App Router server APIs (`cookies()`, `headers()`, `redirect()`).
23
- - `getServerSideProps` / `getStaticProps` — the app is a client-rendered static export; data goes through the store/`@/api`.
24
+ - `getServerSideProps` / `getStaticProps` — the app is a client-rendered static export; data goes through the store/`@/api`.
25
+ - Reading `router.query` before `router.isReady` (cold-load crash); non-integer / non-final dynamic segments (nginx serves only integer slugs at the end).
@@ -1,4 +1,4 @@
1
- globs: src/**/*.{ts,tsx}
1
+ globs: app/src/**/*.{ts,tsx}
2
2
 
3
3
  ## Body
4
4
 
@@ -11,6 +11,8 @@ Copy (button labels, headings, alt text, aria-labels), constants, enums, and rou
11
11
  ## Rules
12
12
 
13
13
  - User-visible copy: inline unless the same string is used in ≥2 distinct places OR is consumed by tests/stories that need a shared reference. Multi-instance refactors belong to a dedicated task.
14
+ - A new inline data table (dictionary/map) larger than ~50 entries requires a cited source (spec, mockup node, or contract) in the task artifact — otherwise it is invented content.
15
+ - Copy changes cite a spec or mockup node.
14
16
  - Numeric / pixel / token aliases: inline directly; do not re-wrap into a named constant when used exactly once in the same file.
15
17
  - Counters and derived single-use values: inline (`array.length`, computed expressions).
16
18
  - Layout sizes of one component (skeleton `height`/`width`/`maxWidth`, one-off `px`) stay as literals in the JSX prop or in `styles.ts`. Do not hoist them into named constants or a `*.data.ts`, even when the same number is repeated in that component's JSX and its styles.
@@ -0,0 +1,62 @@
1
+ globs: storybook/stories/**/*.stories.tsx, storybook/stories/**/README.md, storybook/stories/**/*
2
+
3
+ ## Body
4
+
5
+ # Storybook catalog structure
6
+
7
+ When editing Storybook catalog files, acknowledge: `Using .ai.local: storybook-catalog-structure(, …)*`.
8
+
9
+ ## Before you add a story
10
+
11
+ - UI develop/refactor starts with **`storybook-ui-quality-gate`** (preview vs mockup + story tests) — stories are not post-hoc docs.
12
+ - Read the folder README: `storybook/stories/pages/README.md`, `components/README.md`, `modals/README.md`.
13
+ - Copy the nearest analog file; do not invent a new sidebar branch.
14
+ - After add/edit (and after UI refactors that stories cover): **`storybook-keep-tests-current`** — tests + baselines green.
15
+
16
+ ## Sidebar roots (fixed)
17
+
18
+ | Title pattern | Path | Notes |
19
+ |---------------|------|-------|
20
+ | `UI/Pages/<ShortName>` | `pages/<Page>/<Page>.stories.tsx` | Full page; `layout: 'fullscreen'`, `defaultViewport: 'desktop'`. |
21
+ | `UI/Pages/<Page>/Components/<Block>` | `pages/<Page>/Components/<Block>.stories.tsx` | **Required** for page-level blocks. |
22
+ | `UI/Pages/<Page>/Cards/<Card>` | `pages/<Page>/Cards/` | List cards only. |
23
+ | `UI/Components/<Name>` | `components/` | Reusable `app/src/ui/components/**`. |
24
+ | `UI/Modals/<Domain>/<Modal>` | `modals/<Domain>/` | Isolated dialogs only. |
25
+
26
+ ## Page Components section (required)
27
+
28
+ When a page has distinct blocks (summary, side panel, files, skeletons, etc.):
29
+
30
+ - Add `storybook/stories/pages/<Page>/Components/<BlockName>.stories.tsx`.
31
+ - Title: `UI/Pages/<ShortName>/Components/<BlockName>`.
32
+ - Cover **every code-implemented visual state** (loading skeleton, empty, error, feature-flag variants).
33
+ - Document in page `README.md`: block × state → export name → fixture/mock id.
34
+ - Nested modals inside blocks: story the **block** or use existing `UI/Modals/*` — not a separate modal story.
35
+ - Pure skeleton/presentational blocks: single default export is OK.
36
+ - White-card blocks: apply the grey-canvas decorator so the card edge is visible. Skip grey/primary/secondary roots (see `storybook-csf-authoring`).
37
+ - If the page CSF grows: extract a block into `Components/` — **never** `PageName.p1.stories.tsx`.
38
+
39
+ ## Placement rules
40
+
41
+ - Reusable across pages → `storybook/stories/components/` (see components README out-of-scope table).
42
+ - Modal/dialog → `storybook/stories/modals/` only.
43
+ - Page-only block → page `Components/` (not `UI/Components/`).
44
+ - List cards → `pages/<Page>/Cards/` (not modal wrappers).
45
+
46
+ ## README requirement
47
+
48
+ Each page folder keeps `README.md`: mock id map, state vocabulary, vitest validation path, Components catalog when present.
49
+
50
+ Example validation (from `storybook/`):
51
+
52
+ ```bash
53
+ yarn vitest run --project=storybook stories/pages/<Page>/Components/<Block>.stories.tsx
54
+ ```
55
+
56
+ ## Forbidden
57
+
58
+ - Duplicating a modal under page/Components when `UI/Modals/...` already exists.
59
+ - New `*Modal*` titles under `UI/Components/`.
60
+ - New flat page-block files at page root — use `Components/`.
61
+ - **No** `*.p1.stories.tsx`, `*.p2.stories.tsx`, or any `*.pN.stories.tsx` — one CSF per `title`.
62
+ - **No** viewport-duplicate stories: `Mobile*`, `Mobile_*`, `defaultViewport: 'mobile*'`, `isMobile` preloads.
@@ -0,0 +1,40 @@
1
+ glob: always
2
+
3
+ ## Body
4
+
5
+ # Storybook temp screenshot cleanup
6
+
7
+ When this rule applies, acknowledge: `Using .ai.local: storybook-cleanup-temp-screenshots(, …)*`.
8
+
9
+ ## When (mandatory)
10
+
11
+ Before declaring Storybook or UI work complete, and after any browser / Figma / Playwright / Storybook MCP screenshot: delete files **this turn created** that are not product assets or vis baselines.
12
+
13
+ Leaving dump PNGs in the repo is incomplete work — same severity as red Storybook tests.
14
+
15
+ ## Delete
16
+
17
+ Typical dumps (names vary):
18
+
19
+ - Repo-root images: `*-after.png`, `*-before.png`, `positive-story.png`, and any other untracked `*.png` / `*.jpg` / `*.webp` at the workspace root that you created.
20
+ - `/tmp/**` review dumps.
21
+ - Workspace copies of Figma screenshots, browser screenshots, or Playwright traces/screenshots written **into the git worktree** (not CI artifacts).
22
+
23
+ ## Keep
24
+
25
+ - `storybook/__vis__/<platform>/__baselines__` — CI vis; refresh via `--update`, never `rm` to hide drift.
26
+ - `storybook/__vis__/local` — gitignored local baselines; still refresh, do not wipe.
27
+ - Product assets: `app/public/**`, component `images/`, committed mocks.
28
+ - Files the user explicitly asked to keep.
29
+
30
+ ## How
31
+
32
+ 1. `git status --short` (and `ls` repo root) for untracked/modified images from this turn.
33
+ 2. Delete **only those paths**. No `git clean -fd`, no `git checkout` of vis baselines.
34
+ 3. Confirm gone. Do not `git add` temp screenshots.
35
+
36
+ ## Forbidden
37
+
38
+ - Committing verification / MCP / Playwright dump images.
39
+ - Leaving repo-root PNGs "for the user to review" unless they asked.
40
+ - Deleting vis baselines instead of `--update`.
@@ -0,0 +1,100 @@
1
+ globs: storybook/**/*.stories.tsx, storybook/**/*.fixtures.ts, storybook/**/*.fixtures.data.ts, storybook/**/*.stories.meta.ts
2
+
3
+ ## Body
4
+
5
+ # Storybook CSF authoring
6
+
7
+ When editing CSF/fixtures, acknowledge: `Using .ai.local: storybook-csf-authoring(, …)*`.
8
+
9
+ ## CSF3 skeleton
10
+
11
+ ```tsx
12
+ import type { Meta, StoryObj } from '@storybook/react';
13
+
14
+ const meta = {
15
+ title: 'UI/Pages/ExamplePage',
16
+ component: ExamplePage,
17
+ tags: ['test', 'snapshot'],
18
+ decorators: [withStoreProvider({ preloadedState })],
19
+ parameters: { layout: 'fullscreen', viewport: { defaultViewport: 'desktop' } },
20
+ } satisfies Meta<typeof ExamplePage>;
21
+
22
+ export default meta;
23
+ type TStory = StoryObj<typeof meta>;
24
+
25
+ /** S01 — default loaded state */
26
+ export const Default: TStory = { /* … */ };
27
+ ```
28
+
29
+ ## Imports
30
+
31
+ - Production: `@/ui/...`, `@/store/...`, `@/types/...`.
32
+ - Storybook: the project's shared decorators/helpers (`withStoreProvider`, `withGreyCanvas`, `withStorybookSearchParams`, `withDocumentReferrer`), the shared MSW helper, and the test utilities (`expect`, `within`, `userEvent`, `fn`, `waitFor`).
33
+ - Play helpers: co-locate in `*.stories.meta.ts` or `*.fixtures.ts` — do not duplicate selectors.
34
+
35
+ ## Data & decorators
36
+
37
+ - MSW: `parameters: { ...storyMsw(handlers) }` from the shared MSW helper.
38
+ - Store: `decorators: [withStoreProvider({ preloadedState })]` — use fixture builders.
39
+ - Search params: `withStorybookSearchParams({ key: 'value' })`.
40
+ - Browser globals (render-time): `withDocumentReferrer('')` — `document.referrer` and in-app list session signals are **story fixtures**, not play-only setup. Reset session keys when production reads them at render.
41
+ - White-card isolated blocks **only** (a solid white surface token): `withGreyCanvas`. Do not use on grey primary/secondary roots.
42
+ - **Never** `parameters.nextjs.appDirectory`. Do not null-guard production `useSearchParams`.
43
+
44
+ ## Fixtures
45
+
46
+ Split: handlers/ids (`*.fixtures.ts`), static data (`*.fixtures.data.ts`), play constants (`*.stories.meta.ts`).
47
+ Reuse page fixtures before inventing ids. Document story-local id ranges in the README.
48
+
49
+ ## One CSF file per `title` (strict)
50
+
51
+ Allowed: `PageName.stories.tsx`, `Components/<Block>.stories.tsx`, `modals/<Domain>/<Modal>.stories.tsx`.
52
+
53
+ **Forbidden:**
54
+
55
+ - New `*.p1.stories.tsx`, `*.p2.stories.tsx`, or any `*.pN.stories.tsx`.
56
+ - Adding exports to existing p1/p2 files.
57
+ - Numbered overflow siblings sharing the same `title`.
58
+
59
+ Existing p1/p2 in a repo are **legacy — do not copy or extend**. If the main file is large, extract a page block into `Components/` (new `title`).
60
+
61
+ ## No mobile/viewport duplicates (strict)
62
+
63
+ One desktop canvas per logical state; reviewers use the Storybook viewport toolbar.
64
+
65
+ **Ban:** `export const Mobile*`, `Mobile_*`, `defaultViewport: 'mobile1'` / `'mobile2'`, `isMobile: true` preloads, `*MobileMediaPreload` fixtures, dedicated `*Mobile*.stories.tsx` for viewport variants.
66
+
67
+ **Keep only** product UI whose name is Mobile (a distinct component, not a second viewport of a page).
68
+
69
+ ## Play vs visual
70
+
71
+ - Every snapshot story has a `play` asserting primary `data-testid`s or visible copy.
72
+ - Call the visual-settle helper after icon/header paint (~300ms) when flaking — use it on isolated blocks/modals with masked icons before vis.
73
+ - Portals: assert `within(canvasElement.ownerDocument.body)`.
74
+ - **Loading / spinner vis:** preload the store slice (`loadingStatus: 'loading'`) or MSW `delay('infinite')`. **Forbidden:** click download/submit then vis the in-flight frame without pinning the request.
75
+ - Freeze animations only on spinner/QR/skeleton stories, as the last line of `play`; then `--update -t` that story only.
76
+ - **Intentional** `LoadFailed` export (MSW 500) ≠ an accidental "failed to load the page" (missing API mocking).
77
+
78
+ ## Tags & layout
79
+
80
+ - `tags: ['test', 'snapshot']` on visual catalog entries.
81
+ - Page: `layout: 'fullscreen'`, `viewport.defaultViewport: 'desktop'`.
82
+ - Isolated block: `layout: 'centered'` unless the block needs width.
83
+
84
+ ## Grey canvas (white cards only)
85
+
86
+ Apply the grey-canvas decorator **only** when the production root is a solid white surface. Use the project's grey-surface token. Never hex.
87
+
88
+ ```tsx
89
+ import { withGreyCanvas } from '<shared-decorators>' // adjust depth
90
+
91
+ decorators: [withGreyCanvas], // outer; width shells stay inside
92
+ ```
93
+
94
+ **Do not apply** when the root is already grey, transparent, a fullscreen page, or a modal. Grey-on-grey hides radius and rest/hover fills.
95
+
96
+ **Forbidden:** `parameters.backgrounds` hex lists; a grey wrapper the same size as the card (edge still invisible).
97
+
98
+ ## After batch
99
+
100
+ Mandatory: **`storybook-ui-quality-gate`** — preview stories, compare canvas vs mockup, then run story tests. Then **`storybook-keep-tests-current`**: fix play/fixtures, targeted vitest, `--update` vis after intentional visual changes, re-run green. Then **`storybook-cleanup-temp-screenshots`** — delete dump PNGs from this turn; do not commit them.
@@ -0,0 +1,67 @@
1
+ globs: app/src/ui/**/*.tsx, app/src/ui/**/*.ts, storybook/stories/**/*.stories.tsx
2
+
3
+ ## Body
4
+
5
+ # Storybook dev-time Figma visual compare (mandatory)
6
+
7
+ When this rule applies, acknowledge: `Using .ai.local: storybook-dev-compare-figma(, …)*`.
8
+
9
+ While implementing or refactoring `app/src/ui/**` (new component, visual/interaction change, layout, styles, copy, hover/open), the **source of visual truth is Figma** — not Storybook vis-baselines. Vis-baselines are a **regression detector** (they catch "you broke what was working"), not a design spec (they do not validate "this matches the Figma mockup"). They can lock in a wrong implementation as the baseline if `--update` is run before the implementation is correct.
10
+
11
+ This rule makes the dev-loop **mandatory** and forbids the failure mode where an agent captures a `--update` baseline against a wrong implementation, the wrong implementation becomes the "correct" baseline, and the next round of changes is compared against the wrong baseline — drift is hidden forever.
12
+
13
+ ## The required loop (every visual change)
14
+
15
+ 1. **Read Figma first** — `figma_get_metadata` for the node structure, `figma_get_design_context` for the actual styles/tokens, `figma_get_variable_defs` for design tokens, `figma_get_screenshot` for the visual reference. Do not pick the wrong reference node (e.g. a wrapper frame instead of the card component). Pick the **innermost** matching node.
16
+ 2. **Implement to spec** — every token (color, padding, gap, font, radius) must come from `figma_get_design_context` / `figma_get_variable_defs`, not from memory or from guessing. If a style is not in the Figma spec, the implementation is wrong; do not invent.
17
+ 3. **Open the story in a browser** — navigate to the story URL (e.g. `http://localhost:6006/?path=/story/<story-id>`). If Storybook is not running, start it with `yarn storybook` from `storybook/`.
18
+ 4. **Take a screenshot** — of the **opened dialog / visible state**, not the Storybook iframe placeholder.
19
+ 5. **Visual compare with Figma** — open the Figma screenshot in the same view (saved PNG of the Figma node). Compare element-by-element:
20
+ - Title (font, size, weight, color, line-height, letter-spacing)
21
+ - Subtitle / supporting text (same)
22
+ - Container (background, border, radius, padding, gap)
23
+ - Icon (image content, size, container styling)
24
+ - Status / state (text + color)
25
+ - Disclosure / actions (icon, size, position)
26
+ - Hover state (compare in both the Figma "Hover" variant AND Storybook hover)
27
+ 6. **Diff and fix** — if the Storybook render does not match the Figma, fix the production code (or fixture, if the data was wrong) and re-screenshot. Do not `--update` the baseline until the Figma match is confirmed by a human-readable visual side-by-side.
28
+ 7. **Only then `--update`** — `yarn vitest run --project=storybook <path> --update` records the now-correct baseline. After the rewrite, run **without** `--update` once to confirm the new baseline is stable.
29
+
30
+ ## Why baselines are NOT enough
31
+
32
+ A baseline is a pixel diff against an existing image. If the existing image is wrong, the baseline silently approves future wrongness.
33
+
34
+ The failure mode this guards against: an agent implements UI with wrong border, wrong icon, wrong font, and wrong background; captures a `--update` baseline; vis-tests go green. The next round tightens tokens but keeps the wrong icon; `--update` again; still green. An operator later opens the story and it looks nothing like Figma. The "green" vis-tests had been comparing to a wrong baseline for two rounds.
35
+
36
+ The fix is not "more `--update` discipline". The fix is a **mandatory dev-time visual compare with Figma** before any `--update`.
37
+
38
+ ## Forbidden
39
+
40
+ - Running `yarn vitest -u` against a story that has not been visually compared with Figma in the current session.
41
+ - "Vis-tests are green" used as evidence the UI matches Figma.
42
+ - Comparing only via a single Figma screenshot and then trusting memory for the rest of the change.
43
+ - Using a Figma screenshot of a **different node** as the reference (e.g. the outer modal instead of the card component, the empty state instead of the loaded state, the desktop variant instead of the mobile variant).
44
+ - Skipping the dev-time compare and relying on the operator to spot drift after the fact.
45
+
46
+ ## Required when
47
+
48
+ Mandatory for any change under `app/src/ui/**` that affects:
49
+
50
+ - Layout, padding, gap, alignment
51
+ - Typography (font, size, weight, color)
52
+ - Color, background, border, radius, shadow
53
+ - Icon / image / illustration
54
+ - Hover / open / focused / error / empty / loading visual states
55
+ - Storybook vis-baseline first capture (`--update`) or any intentional change to baselines
56
+
57
+ ## MCP wiring
58
+
59
+ - `chrome-devtools_*` (in the session MCP catalog) is the preferred browser navigation / screenshot tool for the dev-time compare. If it is `error` / `needsAuth` / `loading`, **stop** and report the block, do not approximate.
60
+ - `playwright` MCP can be used as a substitute **only if** `chrome-devtools` is unavailable — but `chrome-devtools` is preferred because it gives a real DOM + screenshot of the running app.
61
+ - A `localhost:6006` reached via a browser MCP is the right way; a screenshot of the production Next.js route is **not** an acceptable substitute (per `mcp-required-for-ui-layout.md`).
62
+
63
+ ## Reference
64
+
65
+ - `storybook-ui-quality-gate.md` — this rule makes its "compare with mockup" step mandatory and dev-time, not at-the-end.
66
+ - `storybook-keep-tests-current.md` — the post-change half (play + baseline refresh); this rule is the pre-`--update` half.
67
+ - `mcp-required-for-ui-layout.md` — Figma + Storybook MCP gate.
@@ -0,0 +1,75 @@
1
+ globs: storybook/**/*.stories.tsx, storybook/**/*.fixtures.ts, storybook/**/*.fixtures.data.ts, storybook/**/*.stories.meta.ts, storybook/stories/**/README.md, app/src/ui/**/*.tsx, app/src/ui/**/*.ts
2
+
3
+ ## Body
4
+
5
+ # Storybook keep tests current
6
+
7
+ When this rule applies, acknowledge: `Using .ai.local: storybook-keep-tests-current(, …)*`.
8
+
9
+ ## When (mandatory)
10
+
11
+ Storybook tests and vis baselines are **part of the change**. Do not finish with red or stale snapshots.
12
+
13
+ Triggers:
14
+
15
+ 1. Add or edit a story, fixture, `*.stories.meta.ts`, or page Storybook README.
16
+ 2. Change production UI a story imports (`app/src/ui/**`) — layout, styles, copy, `data-testid`, states. New/refactored UI must already have stories via **`storybook-ui-quality-gate`** (preview vs mockup); this rule is the test/baseline half.
17
+ 3. Change mocks / domain / store fields that stories preload — grep `storybook/stories` and apply this gate.
18
+
19
+ Leaving play broken or skipping `--update` after an intentional visual change is incomplete work.
20
+
21
+ ## Find related stories
22
+
23
+ Grep `storybook/stories` for the component name and its import. Cover **all** hits: page, `Components/<Block>`, cards, modals — not only the file you opened. Check the page `README.md` state map.
24
+
25
+ ## Keep working
26
+
27
+ - **Play:** selectors, copy, `data-testid`s, settle/portal helpers must match the new UI.
28
+ - **Fixtures / MSW / preloadedState:** match domain after mapper or store changes.
29
+ - New production visual state → new story export (catalog structure). Removed UI → delete or retarget the story.
30
+ - Page `README.md`: state → export → fixture id.
31
+
32
+ **Forbidden:** commenting out `play`; dropping `test` / `snapshot` tags to silence failures; ignoring vis drift.
33
+
34
+ ## Computed copy & browser fixtures
35
+
36
+ When play asserts **visible copy** that production derives from `document.referrer`, sessionStorage, in-app signals, or i18n: stub those inputs in a **decorator** (sync before mount). Play is too late.
37
+
38
+ - Do not treat a hard-coded label as a stable selector when the same `data-testid` can show two production strings. Assert the variant's **inputs** first, then the copy.
39
+ - After adding/changing a story that depends on browser document state, grep production for `document.referrer` / session keys used at render.
40
+
41
+ ## Play queries & timeouts
42
+
43
+ - Static shells (no fetch): prefer `getByTestId` / `getByRole` so a missing node fails immediately, not `Test timed out in 30000ms`.
44
+ - `findBy*` / `waitFor` only when UI is actually async (MSW, loader). Cap timeout (e.g. 3–5s). Never wait for a testid that production does not mount without mocks.
45
+ - Vitest `testTimeout` includes the vis auto-snapshot `afterEach`. A 30s timeout on a story with a tiny `play` is often vis (icon masks, large SVG, full header/footer), not a missing node. Isolated green + full-suite 30s timeout → cap the wait, do not raise `testTimeout`.
46
+ - Any `new Image()` / mask-URL wait **must** have a 3–5s cap. Unbounded `Image()` → full-suite hang while isolated still passes.
47
+ - **Vis loading race:** a `userEvent.click` that dispatches an unmocked thunk (download, fetch) → vis captures spinner **or** idle. Pin the frame: preload the store slice (`loadingStatus: 'loading'`) or MSW `delay('infinite')`. **Forbidden:** click-then-snapshot an in-flight request.
48
+
49
+ ## Run (from `storybook/`)
50
+
51
+ Targeted path only — do not `--update` the whole catalog.
52
+
53
+ ```bash
54
+ yarn vitest run --project=storybook <path>
55
+ ```
56
+
57
+ Play / fixture failures: **fix CSF**, then re-run. Do not `--update` to hide a broken `play`.
58
+
59
+ After an **intentional** visual change, refresh baselines (`--update` **after** the path):
60
+
61
+ ```bash
62
+ yarn vitest run --project=storybook <path> --update
63
+ yarn vitest run --project=storybook <path> -t '<Story name>' --update
64
+ ```
65
+
66
+ `--update` on a **file path** rewrites **every** export in that file. A spinner/animation-freeze story can recapture siblings not yet painted. Use `-t '<Story name>'` for one snapshot. Review each rewritten PNG; do not blind-accept.
67
+
68
+ Re-run **without** `--update` until exit 0. After a vis/timeout flake: re-run the **originally failing files together** (isolated green ≠ full-suite green).
69
+
70
+ ## Baselines
71
+
72
+ - Local: `storybook/__vis__/local` (gitignored) — still refresh so the next local run is green.
73
+ - CI: `storybook/__vis__/<platform>/__baselines__` — add when those files exist in git.
74
+ - Done only when targeted vitest is green **without** `--update`.
75
+ - Done only after **`storybook-cleanup-temp-screenshots`**: no leftover dump PNGs from this turn.
@@ -0,0 +1,64 @@
1
+ globs: storybook/stories/modals/**
2
+
3
+ ## Body
4
+
5
+ # Storybook modals catalog
6
+
7
+ When editing modal stories, acknowledge: `Using .ai.local: storybook-modals(, …)*`.
8
+
9
+ ## Scope
10
+
11
+ - Isolated modal components only — no page underlay.
12
+ - No "card wrapper" stories when `UI/Modals/...` already covers the trigger (see the modals README reuse table).
13
+ - A component-catalog open-by-default `ConfirmModal` is a component-catalog exception — **do not copy** that pattern here.
14
+
15
+ ## Title & path
16
+
17
+ - Title: `UI/Modals/<Domain>/<ModalName>` matching `storybook/stories/modals/<Domain>/`.
18
+ - Never place modal titles under `UI/Pages/` or `UI/Components/`.
19
+
20
+ ## Closed by default
21
+
22
+ First paint shows a labeled trigger (`BasicButton`), not an open dialog.
23
+
24
+ - Trigger: a stable `data-testid` (e.g. `modal-story__open-trigger`).
25
+ - **Forbidden:** always-open default export; snapshot variants that skip the closed state unless separately named + justified in README.
26
+
27
+ ## Render helpers
28
+
29
+ From the shared modal decorators module:
30
+
31
+ - `createReduxModalStoryRender` — dispatch prod open actions from a closed `preloadedState`.
32
+ - `createLocalModalStoryRender` — `useState(isOpen)` harness.
33
+ - A `ModalStoryShell` wrapper; pass `isMounted` when prod conditionally mounts the modal.
34
+
35
+ ## Play sequence
36
+
37
+ 1. `expectNoModalDialog`
38
+ 2. `clickModalStoryTrigger`
39
+ 3. `expectVisibleTextInModal` / `expectVisibleTestIdInModal`
40
+ 4. Close via prod affordances (overlay, cancel/confirm) — no story-only close button.
41
+
42
+ Portals: assert `within(canvasElement.ownerDocument.body)`.
43
+
44
+ ## Visual
45
+
46
+ Vis addon snapshots **after** play (opened dialog + trigger). Document per-modal exceptions (e.g. a modal that closes after confirm).
47
+
48
+ - After open + copy assertions: call the visual-settle helper when the dialog has masked icons. Isolated green + full-suite `Test timed out in 30000ms` → vis afterEach / unbounded icon wait, not a missing node.
49
+ - Do not add `new Image()` / mask waits without a 3–5s cap.
50
+ - Do not raise story `testTimeout` to hide a CDN hang.
51
+
52
+ After add/edit/UI refactor: **`storybook-ui-quality-gate`** (preview vs mockup) then **`storybook-keep-tests-current`** — play + `--update` + re-run green.
53
+
54
+ ## MSW / store / query-open
55
+
56
+ - Fetch-on-mount: shared MSW helper + store provider (same as pages).
57
+ - Postpayment / query-open modals: shell-controlled `isOpen` + `withStorybookSearchParams` when prod uses query params.
58
+
59
+ ## Forbidden
60
+
61
+ - Always-open default export.
62
+ - Duplicate card modals under `modals/` when listed in the modals README reuse table.
63
+ - Viewport-duplicate modal stories (`Mobile*`, `defaultViewport: 'mobile*'`).
64
+ - New `*.pN.stories.tsx` overflow files — one CSF per modal `title`.
@@ -0,0 +1,40 @@
1
+ glob: always
2
+
3
+ ## Body
4
+
5
+ # Storybook must not resolve packages from app/node_modules
6
+
7
+ When this rule applies, acknowledge: `Using .ai.local: storybook-no-app-node-modules`.
8
+
9
+ ## Rule
10
+
11
+ When Storybook lives in its own package (`storybook/package.json`, `storybook/yarn.lock`, `storybook/node_modules`), it **must not** load npm dependencies from the app's `node_modules`.
12
+
13
+ Categorical. Missing a design-system package, "versions match `app/`", ESLint plugin lookup, a Vite alias, or a Docker `COPY` of `app/node_modules` do not waive it. Do not cite an existing violation as a pattern to copy.
14
+
15
+ ## Forbidden
16
+
17
+ Any mechanism that makes Storybook (dev, build, test, lint, typecheck, Docker) import an installed package from `app/node_modules`:
18
+
19
+ - Vite/webpack `resolve.alias`, `resolve.modules`, `optimizeDeps`, `dedupe`, or a plugin `resolveId` aimed at `app/node_modules` / `../app/node_modules`.
20
+ - `paths` in any `storybook/**/tsconfig*.json` that point at `../app/node_modules/**`.
21
+ - `NODE_PATH`, yarn/npm/pnpm link, workspace hoisting, or a symlink from `storybook/node_modules` into `app/node_modules`.
22
+ - Docker `COPY`, volume, or bind-mount of `app/node_modules` into a Storybook stage or image.
23
+ - ESLint, Stylelint, Vitest, or another Storybook tool resolving plugins or packages from `app/node_modules`.
24
+
25
+ ## Allowed
26
+
27
+ Application **source and static files**, not installed packages:
28
+
29
+ - `@/` → `app/src/**`
30
+ - `app/next.config.ts`, `app/environment.d.ts`, `app/public/**`, `app/src/assets/**`
31
+
32
+ `server.fs.allow` may include `app/` so Vite can read that source. It must not be used to import from `app/node_modules`.
33
+
34
+ ## If a package is missing
35
+
36
+ Add it to `storybook/package.json`, install it into `storybook/node_modules`, and align the version with `app/package.json`. Do not alias it into `app/node_modules`.
37
+
38
+ ## Known violations — do not extend
39
+
40
+ Existing aliases, `paths`, and Docker `COPY` sites that resolve through `app/node_modules` today are violations, not a pattern. A change that edits one of those sites removes that `app/node_modules` binding in the same change.
@@ -0,0 +1,38 @@
1
+ glob: always
2
+
3
+ ## Body
4
+
5
+ # Storybook UI quality gate
6
+
7
+ When this rule applies, acknowledge: `Using .ai.local: storybook-ui-quality-gate(, …)*`.
8
+
9
+ Storybook is the **mandatory** surface for developing and refactoring UI. Use it to compare the canvas with the mockup and to control visual/interaction quality. A Next.js route screenshot, source-only review, or unit tests without stories is **not** enough.
10
+
11
+ ## When (mandatory)
12
+
13
+ Triggers:
14
+
15
+ 1. New page, block, modal, or reusable component (`app/src/ui/**`).
16
+ 2. Visual or interaction refactor — layout, styles, tokens, copy, hover/open, empty/error/loading.
17
+ 3. Existing UI that already has stories (then also **`storybook-keep-tests-current`**).
18
+
19
+ **Skip:** types / API / store / mocks with **no** render or style change.
20
+
21
+ ## Loop (do not skip steps)
22
+
23
+ 1. **Before UI code:** read the Storybook story instructions (Storybook MCP) if available. Copy the nearest analog CSF. If the brief has a `figma.com` URL, keep that node as the visual SoT.
24
+ 2. **Stories with the UI — not after.** Cover **every implemented visual state** (see `storybook-catalog-structure`). New state without an export is incomplete work.
25
+ 3. **Compare with mockup:** preview the stories and open **every** returned URL. Side-by-side story canvas vs Figma (or vs AC / `ux-design.md` when there is no Figma). Check spacing, tokens, typography, empty/error/loading, hover/open. Use the viewport **toolbar** — no `Mobile*` duplicate stories.
26
+ 4. **Quality:** run the story tests, then **`storybook-keep-tests-current`** (play + vis green without `--update`). Then **`storybook-cleanup-temp-screenshots`**.
27
+
28
+ Mismatch with the mockup → fix **production** (or the fixture if data was wrong), then preview again. Do not "accept" drift.
29
+
30
+ MCP down: `yarn storybook` + folder README analog; still visually review the canvas and run vitest from `storybook/`.
31
+
32
+ ## Forbidden
33
+
34
+ - Shipping UI without stories for new/changed visual states.
35
+ - "Looks fine on the Next.js page" without Storybook preview.
36
+ - Skipping preview / story tests when MCP is up.
37
+ - Treating Storybook as post-hoc docs after the feature is "done".
38
+ - Closing the task while canvas ≠ mockup for a state that was in scope.