@reqvire-org/ads 0.3.53 → 0.4.2

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 (401) hide show
  1. package/README.md +114 -94
  2. package/dist/a11y.mjs +108 -29
  3. package/dist/analysis/compiler-options.mjs +13 -0
  4. package/dist/analysis/context.mjs +46 -0
  5. package/dist/analysis/file-tree.mjs +52 -0
  6. package/dist/analysis/helpers.mjs +140 -0
  7. package/dist/analysis/impact.mjs +20 -0
  8. package/dist/analysis/inputs.mjs +15 -0
  9. package/dist/analysis/native-adapter.mjs +180 -0
  10. package/dist/analysis/native-project.mjs +323 -0
  11. package/dist/analysis/queries.mjs +133 -0
  12. package/dist/analysis/service.mjs +146 -0
  13. package/dist/analysis/standalone.mjs +57 -0
  14. package/dist/analysis/syntax.mjs +164 -0
  15. package/dist/analysis/worker.mjs +182 -0
  16. package/dist/assets.mjs +6 -6
  17. package/dist/atomic-composition.mjs +191 -70
  18. package/dist/atomic-trace.mjs +120 -50
  19. package/dist/behavior-libraries.mjs +106 -37
  20. package/dist/behaviors.mjs +222 -79
  21. package/dist/boundaries.mjs +137 -40
  22. package/dist/brand-assets.mjs +219 -47
  23. package/dist/brands.mjs +86 -27
  24. package/dist/bun-compiler.mjs +34 -13
  25. package/dist/bun-worker.mjs +7 -5
  26. package/dist/capture/worker.mjs +15 -4
  27. package/dist/capture-store.mjs +4 -2
  28. package/dist/capture.mjs +17 -14
  29. package/dist/check-service.mjs +66 -0
  30. package/dist/check.mjs +756 -196
  31. package/dist/cli.mjs +203 -100
  32. package/dist/color-values.mjs +21 -21
  33. package/dist/component-contrast.mjs +2 -2
  34. package/dist/config.mjs +308 -163
  35. package/dist/construction-styles.cjs +10 -0
  36. package/dist/contracts.d.mts +9 -0
  37. package/dist/control-padding.mjs +45 -25
  38. package/dist/css-values.mjs +3 -2
  39. package/dist/declarative-flow.mjs +209 -109
  40. package/dist/design-values.mjs +136 -51
  41. package/dist/development-runtime.mjs +4 -6
  42. package/dist/draft-boundary.mjs +11 -6
  43. package/dist/evidence.mjs +1 -1
  44. package/dist/finding-rules.mjs +7 -5
  45. package/dist/font-rules.mjs +2 -2
  46. package/dist/fonts-generated.mjs +4 -2
  47. package/dist/foundation-views.mjs +238 -0
  48. package/dist/foundation.mjs +63 -39
  49. package/dist/generated-entries.mjs +198 -0
  50. package/dist/icons.mjs +80 -33
  51. package/dist/image-attributes.mjs +109 -36
  52. package/dist/image-size.mjs +1 -1
  53. package/dist/index.mjs +0 -2
  54. package/dist/init.mjs +128 -68
  55. package/dist/investigations.mjs +2 -2
  56. package/dist/layers.mjs +300 -127
  57. package/dist/layout-widths.mjs +180 -85
  58. package/dist/linaria/preserve-values.cjs +7 -0
  59. package/dist/linaria/spatial-inputs.cjs +56 -0
  60. package/dist/lockup-composition.mjs +44 -0
  61. package/dist/lockup-model.cjs +64 -0
  62. package/dist/mcp/THIRD_PARTY_NOTICES.md +51 -1
  63. package/dist/mcp/apps.mjs +4 -30
  64. package/dist/mcp/behavior-pages.mjs +72 -24
  65. package/dist/mcp/build-status.mjs +257 -64
  66. package/dist/mcp/catalog.mjs +91 -26
  67. package/dist/mcp/context.mjs +17 -18
  68. package/dist/mcp/draft-discovery.mjs +44 -21
  69. package/dist/mcp/drafts.mjs +978 -343
  70. package/dist/mcp/execution-coordinator.mjs +417 -167
  71. package/dist/mcp/execution-results.mjs +7 -7
  72. package/dist/mcp/mutations.mjs +701 -219
  73. package/dist/mcp/preview-watch.mjs +465 -161
  74. package/dist/mcp/preview-widget.bundle.js +44 -50
  75. package/dist/mcp/prompts.mjs +6 -6
  76. package/dist/mcp/result-pages.mjs +1 -1
  77. package/dist/mcp/sandbox-host.mjs +1 -1
  78. package/dist/mcp/server.mjs +2436 -570
  79. package/dist/mcp/showcase-host.mjs +176 -39
  80. package/dist/mcp/skills.mjs +1 -1
  81. package/dist/mcp/text-diff.mjs +29 -10
  82. package/dist/paint-contracts.mjs +174 -81
  83. package/dist/palette-generated.mjs +2 -2
  84. package/dist/preview-bun.mjs +493 -187
  85. package/dist/preview-failure.mjs +1 -1
  86. package/dist/preview-files.mjs +13 -13
  87. package/dist/preview-imports.mjs +104 -55
  88. package/dist/preview-inputs.mjs +2 -2
  89. package/dist/preview-requests.mjs +24 -0
  90. package/dist/preview-resources.mjs +288 -147
  91. package/dist/preview-scope.mjs +5 -4
  92. package/dist/program-cache.mjs +10 -0
  93. package/dist/project-documents.mjs +1 -1
  94. package/dist/public-api.mjs +70 -31
  95. package/dist/public-props.mjs +39 -22
  96. package/dist/{browser-audit → render-audit}/axe-run.mjs +3 -3
  97. package/dist/{browser-audit → render-audit}/image-shape.mjs +2 -2
  98. package/dist/{browser-audit → render-audit}/layout-overflow.mjs +86 -23
  99. package/dist/{browser-audit → render-audit}/non-text-contrast.mjs +86 -27
  100. package/dist/{browser-audit → render-audit}/render-states.mjs +208 -52
  101. package/dist/{browser-audit → render-audit}/worker.mjs +86 -30
  102. package/dist/render-audit.mjs +828 -0
  103. package/dist/render-color-probe.mjs +96 -42
  104. package/dist/resource-limits.mjs +229 -97
  105. package/dist/runtime-contracts.mjs +467 -185
  106. package/dist/scenario-groups.mjs +22 -10
  107. package/dist/scenario-inspector.mjs +6 -43
  108. package/dist/scenario-program.mjs +8 -25
  109. package/dist/scenario-registry.mjs +72 -30
  110. package/dist/scenario-selectors.mjs +161 -64
  111. package/dist/scenario-slots.mjs +149 -56
  112. package/dist/scenario-trace.mjs +215 -109
  113. package/dist/scenarios-compiler.mjs +768 -359
  114. package/dist/scenarios-vite.d.mts +1 -3
  115. package/dist/scenarios-vite.mjs +2 -81
  116. package/dist/scenarios.mjs +424 -159
  117. package/dist/selector-match.mjs +2 -2
  118. package/dist/showcase/client.bundle.js +57 -56
  119. package/dist/showcase/draft-navigation.js +18 -0
  120. package/dist/showcase/favicon.ico +0 -0
  121. package/dist/showcase/favicon.svg +1 -0
  122. package/dist/showcase/foundation-view.css +55 -0
  123. package/dist/showcase/foundation-view.mjs +252 -0
  124. package/dist/showcase/guide-controls.ads.review.mjs +32 -0
  125. package/dist/showcase/icons.js +1 -145
  126. package/dist/showcase/index.html +3 -31
  127. package/dist/showcase/preview-frame.ads.review.css +46 -0
  128. package/dist/showcase/preview-frame.ads.review.d.mts +11 -0
  129. package/dist/showcase/preview-frame.ads.review.mjs +22 -0
  130. package/dist/showcase/preview-state.js +0 -9
  131. package/dist/showcase/refresh-scheduler.js +23 -0
  132. package/dist/showcase/style.css +5 -47
  133. package/dist/showcase/ui/ui.css +1353 -0
  134. package/dist/showcase/ui/ui.js +1062 -0
  135. package/dist/showcase-coverage.mjs +58 -37
  136. package/dist/skills/README.md +24 -23
  137. package/dist/skills/ads-designer/README.md +8 -2
  138. package/dist/skills/ads-designer/SKILL.md +152 -144
  139. package/dist/skills/ads-designer/references/accessibility.md +14 -11
  140. package/dist/skills/ads-designer/references/atomic-styles.md +4 -4
  141. package/dist/skills/ads-designer/references/behaviors.md +34 -30
  142. package/dist/skills/ads-designer/references/branding.md +98 -10
  143. package/dist/skills/ads-designer/references/captures.md +31 -31
  144. package/dist/skills/ads-designer/references/cli.md +21 -20
  145. package/dist/skills/ads-designer/references/contracts.md +63 -29
  146. package/dist/skills/ads-designer/references/design-data.md +49 -52
  147. package/dist/skills/ads-designer/references/drafts.md +71 -52
  148. package/dist/skills/ads-designer/references/evidence.md +1 -5
  149. package/dist/skills/ads-designer/references/guarded-editing.md +58 -51
  150. package/dist/skills/ads-designer/references/layers.md +1 -1
  151. package/dist/skills/ads-designer/references/layout.md +347 -0
  152. package/dist/skills/ads-designer/references/mobile.md +2 -1
  153. package/dist/skills/{ads-motion/references/performance.md → ads-designer/references/motion-performance.md} +5 -1
  154. package/dist/skills/{ads-motion/references/build.md → ads-designer/references/motion.md} +73 -5
  155. package/dist/skills/ads-designer/references/performance.md +3 -2
  156. package/dist/skills/ads-designer/references/review.md +42 -38
  157. package/dist/skills/ads-designer/references/runtimes.md +33 -30
  158. package/dist/skills/ads-designer/references/scenarios.md +17 -19
  159. package/dist/skills/{ads-break-ui/references/catalog.md → ads-designer/references/stress-catalog.md} +3 -1
  160. package/dist/skills/ads-designer/references/stress-test.md +68 -0
  161. package/dist/skills/ads-designer/references/validation.md +83 -71
  162. package/dist/skills/ads-designer/references/workflows.md +19 -37
  163. package/dist/skills/ads-import/SKILL.md +43 -328
  164. package/dist/skills/ads-import/references/atomic-styles.md +4 -4
  165. package/dist/skills/ads-import/references/behaviors.md +34 -30
  166. package/dist/skills/ads-import/references/branding.md +5 -5
  167. package/dist/skills/ads-import/references/captures.md +31 -31
  168. package/dist/skills/ads-import/references/cli.md +21 -20
  169. package/dist/skills/ads-import/references/compatibility.md +1 -1
  170. package/dist/skills/ads-import/references/contracts.md +63 -29
  171. package/dist/skills/ads-import/references/design-data.md +49 -52
  172. package/dist/skills/ads-import/references/drafts.md +71 -52
  173. package/dist/skills/ads-import/references/evidence.md +1 -5
  174. package/dist/skills/ads-import/references/guarded-editing.md +58 -51
  175. package/dist/skills/ads-import/references/implementation.md +2 -1
  176. package/dist/skills/ads-import/references/layers.md +1 -1
  177. package/dist/skills/ads-import/references/layout.md +347 -0
  178. package/dist/skills/ads-import/references/review.md +42 -38
  179. package/dist/skills/ads-import/references/runtimes.md +33 -30
  180. package/dist/skills/ads-import/references/scenarios.md +17 -19
  181. package/dist/skills/ads-import/references/tokens.md +3 -3
  182. package/dist/skills/ads-import/references/validation.md +83 -71
  183. package/dist/skills/ads-import/references/workflows.md +19 -37
  184. package/dist/skills/ads-migrate/SKILL.md +56 -0
  185. package/dist/skills/ads-migrate/references/0.4.1-to-0.4.2.md +602 -0
  186. package/dist/skills/ads-port/SKILL.md +54 -346
  187. package/dist/skills/ads-port/references/atomic-styles.md +4 -4
  188. package/dist/skills/ads-port/references/behaviors.md +34 -30
  189. package/dist/skills/ads-port/references/captures.md +31 -31
  190. package/dist/skills/ads-port/references/cli.md +21 -20
  191. package/dist/skills/ads-port/references/contracts.md +63 -29
  192. package/dist/skills/ads-port/references/design-data.md +49 -52
  193. package/dist/skills/ads-port/references/drafts.md +71 -52
  194. package/dist/skills/ads-port/references/evidence.md +1 -5
  195. package/dist/skills/ads-port/references/guarded-editing.md +58 -51
  196. package/dist/skills/ads-port/references/layers.md +1 -1
  197. package/dist/skills/ads-port/references/layout.md +347 -0
  198. package/dist/skills/ads-port/references/lint-and-docs.md +8 -11
  199. package/dist/skills/ads-port/references/native-implementation.md +8 -7
  200. package/dist/skills/ads-port/references/review.md +42 -38
  201. package/dist/skills/ads-port/references/runtimes.md +33 -30
  202. package/dist/skills/ads-port/references/scenarios.md +17 -19
  203. package/dist/skills/ads-port/references/validation.md +83 -71
  204. package/dist/skills/ads-port/references/workflows.md +19 -37
  205. package/dist/source-symbols.mjs +1 -8
  206. package/dist/source-values.mjs +266 -128
  207. package/dist/spatial-composition.mjs +322 -0
  208. package/dist/spatial-contexts.cjs +56 -0
  209. package/dist/spatial-css.cjs +351 -0
  210. package/dist/spatial-inputs.cjs +80 -0
  211. package/dist/spatial-metadata.mjs +18 -0
  212. package/dist/spatial-model.cjs +322 -0
  213. package/dist/spatial.mjs +21 -0
  214. package/dist/stage-timing.cjs +20 -0
  215. package/dist/starters/preact/design-system/patterns/Conversation/Conversation.tsx +105 -0
  216. package/dist/starters/preact/design-system/patterns/Shell/Shell.tsx +275 -0
  217. package/dist/starters/preact/design-system/review/demo-frame/DemoFrame.ads.review.tsx +7 -0
  218. package/dist/starters/preact/design-system/review/screen-frame/ScreenFrame.ads.review.tsx +10 -0
  219. package/dist/starters/preact/design-system/showcase/mcp/main.ads.mount.tsx +8 -0
  220. package/dist/starters/preact/ds.config.json +24 -19
  221. package/dist/starters/preact/package.json +4 -8
  222. package/dist/starters/preact/tsconfig.json +4 -5
  223. package/dist/starters/preact/vite.config.ts +3 -3
  224. package/dist/starters/react/ADS.md +42 -47
  225. package/dist/starters/react/README.md +54 -52
  226. package/dist/starters/react/design-system/components/Actions/Button/Button.ads.exports.ts +1 -0
  227. package/dist/starters/react/design-system/components/Actions/IconButton/IconButton.ads.exports.ts +1 -0
  228. package/dist/starters/react/design-system/components/Actions/IconButton/IconButton.tsx +18 -2
  229. package/dist/starters/react/design-system/components/Actions/IconButton/README.md +3 -0
  230. package/dist/starters/react/design-system/components/Content/Icon/Icon.ads.exports.ts +1 -0
  231. package/dist/starters/react/design-system/components/Content/Image/Image.ads.exports.ts +1 -0
  232. package/dist/starters/react/design-system/components/Content/Logo/Logo.ads.exports.ts +1 -0
  233. package/dist/starters/react/design-system/components/Forms/TextField/TextField.ads.exports.ts +1 -0
  234. package/dist/starters/react/design-system/composition/Workspace/WorkspacePage/README.md +5 -0
  235. package/dist/starters/react/design-system/composition/Workspace/WorkspacePage/WorkspacePage.ads.fixture.ts +13 -0
  236. package/dist/starters/react/design-system/composition/Workspace/WorkspacePage/WorkspacePage.ads.scenario.tsx +22 -0
  237. package/dist/starters/react/design-system/controllers/Palette/Palette.ads.exports.ts +1 -0
  238. package/dist/starters/react/design-system/index.ts +5 -8
  239. package/dist/starters/react/design-system/patterns/Conversation/Conversation.ads.exports.ts +1 -0
  240. package/dist/starters/react/design-system/patterns/Conversation/Conversation.ads.fixture.ts +7 -0
  241. package/dist/starters/react/design-system/patterns/Conversation/Conversation.ads.scenario.tsx +15 -0
  242. package/dist/starters/react/design-system/patterns/Conversation/Conversation.tsx +105 -0
  243. package/dist/starters/react/design-system/patterns/Conversation/README.md +9 -0
  244. package/dist/starters/react/design-system/patterns/Search/SearchBar/SearchBar.ads.exports.ts +1 -0
  245. package/dist/starters/react/design-system/patterns/Shell/Floating.ads.fixture.ts +5 -0
  246. package/dist/starters/react/design-system/patterns/Shell/Floating.ads.scenario.tsx +21 -0
  247. package/dist/starters/react/design-system/patterns/Shell/README.md +43 -0
  248. package/dist/starters/react/design-system/patterns/Shell/Shell.ads.exports.ts +1 -0
  249. package/dist/starters/react/design-system/patterns/Shell/Shell.ads.fixture.ts +5 -0
  250. package/dist/starters/react/design-system/patterns/Shell/Shell.ads.scenario.tsx +21 -0
  251. package/dist/starters/react/design-system/patterns/Shell/Shell.tsx +274 -0
  252. package/dist/starters/react/design-system/review/demo-frame/DemoFrame.ads.exports.ts +1 -0
  253. package/dist/starters/react/design-system/review/demo-frame/DemoFrame.ads.review.tsx +7 -0
  254. package/dist/starters/react/design-system/review/index.ads.review.ts +4 -0
  255. package/dist/starters/react/design-system/review/region-block/RegionBlock.ads.exports.ts +1 -0
  256. package/dist/starters/react/design-system/review/region-block/RegionBlock.ads.review.tsx +6 -0
  257. package/dist/starters/react/design-system/review/screen-frame/ScreenFrame.ads.exports.ts +1 -0
  258. package/dist/starters/react/design-system/review/screen-frame/ScreenFrame.ads.review.tsx +10 -0
  259. package/dist/starters/react/design-system/showcase/mcp/{main.tsx → main.ads.mount.tsx} +4 -2
  260. package/dist/starters/react/design-system/styles.css +1 -0
  261. package/dist/starters/react/design-system/tokens/catalog.ads.json +1221 -0
  262. package/dist/starters/react/design-system/tokens/colors.css +1 -1
  263. package/dist/starters/react/design-system/tokens/spacing.css +22 -32
  264. package/dist/starters/react/design-system/tokens/spatial.ads.json +70 -0
  265. package/dist/starters/react/design-system/tokens/themes.generated.ts +1 -1
  266. package/dist/starters/react/ds.config.json +24 -19
  267. package/dist/starters/react/package.json +2 -6
  268. package/dist/starters/react/tsconfig.json +2 -3
  269. package/dist/starters/react/vite.config.ts +3 -3
  270. package/dist/style-boundaries.mjs +73 -27
  271. package/dist/task-cache.mjs +173 -72
  272. package/dist/task-worker.mjs +22 -11
  273. package/dist/test-boundaries.mjs +133 -60
  274. package/dist/themes-generated.mjs +1 -1
  275. package/dist/themes-watch.mjs +60 -19
  276. package/dist/themes.mjs +176 -73
  277. package/dist/token-export.mjs +39 -14
  278. package/dist/token-policy.mjs +6 -3
  279. package/dist/token-quality.mjs +6 -6
  280. package/dist/token-samples.mjs +16 -5
  281. package/dist/tokens.mjs +71 -26
  282. package/dist/ui-framework.mjs +16 -14
  283. package/dist/unit-contracts.mjs +270 -89
  284. package/dist/units.mjs +215 -180
  285. package/dist/usage.mjs +138 -38
  286. package/dist/validation-checks.mjs +121 -38
  287. package/dist/validation-inputs.mjs +187 -78
  288. package/dist/validation.mjs +268 -102
  289. package/dist/verification/browser.mjs +27 -5
  290. package/dist/verification.mjs +711 -187
  291. package/docs/ADS.md +100 -89
  292. package/docs/ARCHITECTURE.md +353 -159
  293. package/docs/BEHAVIORS.md +33 -28
  294. package/docs/CACHING.md +55 -11
  295. package/docs/CHANGELOG.md +358 -17
  296. package/docs/COMPARISON.md +1 -1
  297. package/docs/CONTRACTS.md +22 -29
  298. package/docs/DESIGN-REFERENCES.md +40 -0
  299. package/docs/GUIDE.md +313 -292
  300. package/docs/MCP.md +261 -439
  301. package/docs/SPATIAL-CHECKS.md +69 -0
  302. package/docs/benchmarks/README.md +39 -0
  303. package/package.json +42 -34
  304. package/dist/browser-audit.mjs +0 -424
  305. package/dist/contract-migration.mjs +0 -110
  306. package/dist/create.mjs +0 -48
  307. package/dist/lint-config.mjs +0 -48
  308. package/dist/mcp/draft-exports.mjs +0 -40
  309. package/dist/mcp/edit-preparation.mjs +0 -115
  310. package/dist/mcp/project-widget.bundle.js +0 -114
  311. package/dist/mcp/reports.mjs +0 -101
  312. package/dist/mcp/widget.bundle.js +0 -147
  313. package/dist/oxlint.mjs +0 -88
  314. package/dist/preview-builder.mjs +0 -133
  315. package/dist/preview-workers.mjs +0 -184
  316. package/dist/showcase.mjs +0 -77
  317. package/dist/skills/ads-break-ui/LICENSE.upstream +0 -21
  318. package/dist/skills/ads-break-ui/README.md +0 -16
  319. package/dist/skills/ads-break-ui/SKILL.md +0 -415
  320. package/dist/skills/ads-break-ui/agents/openai.yaml +0 -4
  321. package/dist/skills/ads-break-ui/references/atomic-styles.md +0 -293
  322. package/dist/skills/ads-break-ui/references/behaviors.md +0 -411
  323. package/dist/skills/ads-break-ui/references/captures.md +0 -160
  324. package/dist/skills/ads-break-ui/references/contracts.md +0 -284
  325. package/dist/skills/ads-break-ui/references/design-data.md +0 -354
  326. package/dist/skills/ads-break-ui/references/drafts.md +0 -178
  327. package/dist/skills/ads-break-ui/references/evidence.md +0 -128
  328. package/dist/skills/ads-break-ui/references/guarded-editing.md +0 -154
  329. package/dist/skills/ads-break-ui/references/layers.md +0 -145
  330. package/dist/skills/ads-break-ui/references/reporting.md +0 -101
  331. package/dist/skills/ads-break-ui/references/review.md +0 -96
  332. package/dist/skills/ads-break-ui/references/runtimes.md +0 -203
  333. package/dist/skills/ads-break-ui/references/scenarios.md +0 -246
  334. package/dist/skills/ads-break-ui/references/validation.md +0 -162
  335. package/dist/skills/ads-break-ui/references/verification.md +0 -58
  336. package/dist/skills/ads-break-ui/references/workflows.md +0 -83
  337. package/dist/skills/ads-designer/references/reporting.md +0 -101
  338. package/dist/skills/ads-import/references/reporting.md +0 -101
  339. package/dist/skills/ads-motion/LICENSE.upstream +0 -21
  340. package/dist/skills/ads-motion/README.md +0 -22
  341. package/dist/skills/ads-motion/SKILL.md +0 -388
  342. package/dist/skills/ads-motion/agents/openai.yaml +0 -4
  343. package/dist/skills/ads-motion/references/atomic-styles.md +0 -293
  344. package/dist/skills/ads-motion/references/audit.md +0 -44
  345. package/dist/skills/ads-motion/references/behaviors.md +0 -411
  346. package/dist/skills/ads-motion/references/captures.md +0 -160
  347. package/dist/skills/ads-motion/references/contracts.md +0 -284
  348. package/dist/skills/ads-motion/references/design-data.md +0 -354
  349. package/dist/skills/ads-motion/references/drafts.md +0 -178
  350. package/dist/skills/ads-motion/references/evidence.md +0 -128
  351. package/dist/skills/ads-motion/references/guarded-editing.md +0 -154
  352. package/dist/skills/ads-motion/references/layers.md +0 -145
  353. package/dist/skills/ads-motion/references/motion-review.md +0 -35
  354. package/dist/skills/ads-motion/references/reporting.md +0 -101
  355. package/dist/skills/ads-motion/references/review.md +0 -96
  356. package/dist/skills/ads-motion/references/runtimes.md +0 -203
  357. package/dist/skills/ads-motion/references/scenarios.md +0 -246
  358. package/dist/skills/ads-motion/references/validation.md +0 -162
  359. package/dist/skills/ads-motion/references/verification.md +0 -39
  360. package/dist/skills/ads-motion/references/workflows.md +0 -83
  361. package/dist/skills/ads-port/references/reporting.md +0 -101
  362. package/dist/starters/preact/design-system/components/Layout/Grid/Grid.tsx +0 -76
  363. package/dist/starters/preact/design-system/review/demo-frame/DemoFrame.tsx +0 -29
  364. package/dist/starters/preact/design-system/review/screen-frame/ScreenFrame.tsx +0 -34
  365. package/dist/starters/preact/design-system/review/token-preview/TokenPreview.tsx +0 -137
  366. package/dist/starters/preact/design-system/showcase/mcp/main.tsx +0 -6
  367. package/dist/starters/react/design-system/brand/Icons/AppIcon/AppIcon.ads.fixture.ts +0 -7
  368. package/dist/starters/react/design-system/brand/Icons/AppIcon/AppIcon.ads.scenario.tsx +0 -4
  369. package/dist/starters/react/design-system/brand/Identity/Logo/Logo.ads.fixture.ts +0 -7
  370. package/dist/starters/react/design-system/brand/Identity/Logo/Logo.ads.scenario.tsx +0 -4
  371. package/dist/starters/react/design-system/components/Layout/Grid/Grid.ads.fixture.ts +0 -12
  372. package/dist/starters/react/design-system/components/Layout/Grid/Grid.ads.scenario.tsx +0 -17
  373. package/dist/starters/react/design-system/components/Layout/Grid/Grid.tsx +0 -75
  374. package/dist/starters/react/design-system/components/Layout/Grid/README.md +0 -21
  375. package/dist/starters/react/design-system/review/brand-preview/BrandPreview.tsx +0 -112
  376. package/dist/starters/react/design-system/review/demo-frame/DemoFrame.tsx +0 -29
  377. package/dist/starters/react/design-system/review/grid-cell/GridCell.tsx +0 -18
  378. package/dist/starters/react/design-system/review/index.ts +0 -5
  379. package/dist/starters/react/design-system/review/screen-frame/ScreenFrame.tsx +0 -34
  380. package/dist/starters/react/design-system/review/token-preview/TokenPreview.tsx +0 -137
  381. package/dist/starters/react/design-system/showcase/mcp/index.html +0 -1
  382. package/dist/starters/react/design-system/tokens/Color.ads.fixture.ts +0 -124
  383. package/dist/starters/react/design-system/tokens/Color.ads.scenario.tsx +0 -4
  384. package/dist/starters/react/design-system/tokens/Layout.ads.fixture.ts +0 -39
  385. package/dist/starters/react/design-system/tokens/Layout.ads.scenario.tsx +0 -4
  386. package/dist/starters/react/design-system/tokens/Motion.ads.fixture.ts +0 -18
  387. package/dist/starters/react/design-system/tokens/Motion.ads.scenario.tsx +0 -4
  388. package/dist/starters/react/design-system/tokens/Shape.ads.fixture.ts +0 -30
  389. package/dist/starters/react/design-system/tokens/Shape.ads.scenario.tsx +0 -4
  390. package/dist/starters/react/design-system/tokens/Space.ads.fixture.ts +0 -37
  391. package/dist/starters/react/design-system/tokens/Space.ads.scenario.tsx +0 -4
  392. package/dist/starters/react/design-system/tokens/Type.ads.fixture.ts +0 -29
  393. package/dist/starters/react/design-system/tokens/Type.ads.scenario.tsx +0 -4
  394. package/dist/starters/react/package-lock.json +0 -4707
  395. package/dist/token-fixtures.mjs +0 -30
  396. package/docs/benchmarks/bun-previews.md +0 -91
  397. package/docs/benchmarks/preview-memory.md +0 -147
  398. package/docs/benchmarks/turbo-poc.md +0 -284
  399. package/docs/plans/execution-coordination.md +0 -57
  400. /package/dist/{browser-audit → render-audit}/first-render.mjs +0 -0
  401. /package/dist/{browser-audit → render-audit}/layout-shift.mjs +0 -0
package/dist/config.mjs CHANGED
@@ -1,14 +1,21 @@
1
1
  import { existsSync, readFileSync, readdirSync } from "node:fs";
2
2
  import path from "node:path";
3
3
  import { hasProjectConfig } from "./project-boundary.mjs";
4
- import { fileURLToPath } from "node:url";
5
4
  import { isDraftFile, draftImportViolation } from "./draft-boundary.mjs";
6
- import { isSharedToken } from "./token-policy.mjs";
7
5
  import { defaultThemes, validateThemes } from "./themes.mjs";
8
6
  import { validateBrands } from "./brands.mjs";
9
7
 
10
8
  export const supportedFrameworks = ["react", "preact"];
11
9
 
10
+ /** The design system's fixed layout inside dsDir, and the alias the app imports it by. ADS generates these entries. */
11
+ export const fixedLayout = {
12
+ publicAlias: "@ds",
13
+ publicEntry: "index.ts",
14
+ reviewEntry: "review/index.ads.review.ts",
15
+ stylesEntry: "styles.css",
16
+ tokenDir: "tokens",
17
+ };
18
+
12
19
  export const defaultConfig = {
13
20
  schemaVersion: 1,
14
21
  framework: null,
@@ -16,26 +23,39 @@ export const defaultConfig = {
16
23
  usage: { notifications: [], restrictedImports: [] },
17
24
  sourceDir: "src",
18
25
  dsDir: "design-system",
19
- publicAlias: "@ds",
20
- publicEntry: "index.ts",
21
- reviewEntry: "review/index.ts",
22
- stylesEntry: "styles.css",
23
- tokenDir: "tokens",
24
26
  themes: defaultThemes,
25
27
  // Optional brand axis beside the themes; empty means one brand.
26
28
  brands: [],
27
29
  // With no data-theme on the root, the OS color scheme picks the first theme of that scheme.
28
30
  followSystemTheme: false,
29
- inlineStyleFiles: [],
30
- boundaries: { styleWrites: [], componentVariables: [] },
31
- assets: { publicDirs: ["public/assets"], generatedPaths: ["dist", "dist-showcase", ".vite", ".ds"], generatedFiles: [], iconSource: null, targets: [], glyphs: null, imageBudgetKb: null, fontBudgetKb: null, preloadFonts: null },
32
- oxlint: { plugins: [], rules: {}, overrides: [] },
33
- acceptance: { checks: [], behaviorChecks: false, browserAudit: true },
34
- validation: { checks: [], behaviorChecks: true, browserAudit: true, inputs: [] },
31
+ assets: {
32
+ publicDirs: ["public/assets"],
33
+ generatedPaths: ["dist", "dist-showcase", ".vite", ".ds"],
34
+ generatedFiles: [],
35
+ iconSource: null,
36
+ targets: [],
37
+ glyphs: null,
38
+ imageBudgetKb: null,
39
+ fontBudgetKb: null,
40
+ preloadFonts: null,
41
+ },
42
+ // Draft acceptance runs ads check, these scripts, and the draft owners' own behavior tests and
43
+ // render audit. ads_validate runs ads check, both script lists, and every behavior test and render
44
+ // audit its change set reaches; it has no depth settings.
45
+ acceptance: { scripts: [], behavior: true, audit: true },
46
+ validation: { scripts: [], inputs: [] },
35
47
  resources: { memoryLimitMb: null },
36
48
  // Width tokens and owners allowed fixed widths; see src/layout-widths.mjs.
37
49
  layout: { widthTokens: [], fixedWidthUnits: [] },
38
- mcp: { showcaseUrl: null, showcaseTitle: null, apps: [], previewWatch: null, previewManifest: null, mutationCheckTimeoutMs: 60000, behaviorProfiles: {}, capture: {}, resultRetention: {maxRuns:50,maxAgeDays:7,maxBytesMb:256} },
50
+ mcp: {
51
+ showcaseTitle: null,
52
+ mutationCheckTimeoutMs: 60000,
53
+ previewBuildTimeoutMs: 300000,
54
+ auditPages: 4,
55
+ behaviorProfiles: {},
56
+ capture: {},
57
+ resultRetention: { maxRuns: 50, maxAgeDays: 7, maxBytesMb: 256 },
58
+ },
39
59
  };
40
60
 
41
61
  export function isInside(parent, file) {
@@ -56,29 +76,42 @@ function validateBrandTargets(targets, { root, dsRoot }) {
56
76
  for (const [index, target] of targets.entries()) {
57
77
  const field = `assets.targets[${index}]`;
58
78
  if (!target || typeof target !== "object" || Array.isArray(target)) throw new Error(`${field} must be an object.`);
59
- const unknown = Object.keys(target).filter(key => !["from", "to", ...sizeKeys].includes(key));
79
+ const unknown = Object.keys(target).filter((key) => !["from", "to", ...sizeKeys].includes(key));
60
80
  if (unknown.length) throw new Error(`${field} has unknown keys: ${unknown.join(", ")}.`);
61
81
  const source = projectPath(dsRoot, target.from, `${field}.from`);
62
82
  const sourceFormat = path.extname(source).toLowerCase();
63
- if (!isInside(path.join(dsRoot, "assets/brand"), source) || !brandFormats.includes(sourceFormat)) throw new Error(`${field}.from must name brand artwork inside the ADS's assets/brand/ folder (${brandFormats.join(", ")}).`);
83
+ if (!isInside(path.join(dsRoot, "assets/brand"), source) || !brandFormats.includes(sourceFormat))
84
+ throw new Error(`${field}.from must name brand artwork inside the ADS's assets/brand/ folder (${brandFormats.join(", ")}).`);
64
85
  const output = projectPath(root, target.to, `${field}.to`);
65
- if (isInside(path.join(dsRoot, "assets"), output) || isInside(path.join(root, ".ds"), output)) throw new Error(`${field}.to must be outside the ADS assets/ folder and .ds/.`);
86
+ if (isInside(path.join(dsRoot, "assets"), output) || isInside(path.join(root, ".ds"), output))
87
+ throw new Error(`${field}.to must be outside the ADS assets/ folder and .ds/.`);
66
88
  if (outputs.has(output)) throw new Error(`${field}.to repeats an earlier target's output.`);
67
89
  outputs.add(output);
68
90
  const format = path.extname(output).toLowerCase();
69
- const sized = sizeKeys.some(key => key in target);
91
+ const sized = sizeKeys.some((key) => key in target);
70
92
  // The same format without sizes is a copy of the supplied file.
71
93
  if (!sized && format === sourceFormat) continue;
72
94
  if (format === ".svg") throw new Error(`${field} copies an SVG master to .svg; it takes no sizes.`);
73
- if (!renderableFormats.includes(sourceFormat)) throw new Error(`${field} copies the finished ${sourceFormat} file; give it the same extension and no sizes.`);
74
- const pixels = value => Number.isInteger(value) && value >= 1 && value <= 4096;
75
- if (target.background !== undefined && (typeof target.background !== "string" || !/^#(?:[0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(target.background))) throw new Error(`${field}.background must be a #RGB, #RRGGBB or #RRGGBBAA colour on a PNG, ICO or ICNS target.`);
95
+ if (!renderableFormats.includes(sourceFormat))
96
+ throw new Error(`${field} copies the finished ${sourceFormat} file; give it the same extension and no sizes.`);
97
+ const pixels = (value) => Number.isInteger(value) && value >= 1 && value <= 4096;
98
+ if (target.background !== undefined && (typeof target.background !== "string" || !/^#(?:[0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(target.background)))
99
+ throw new Error(`${field}.background must be a #RGB, #RRGGBB or #RRGGBBAA colour on a PNG, ICO or ICNS target.`);
76
100
  if (format === ".png") {
77
- const square = target.size !== undefined, rectangle = target.width !== undefined || target.height !== undefined;
78
- if (square === rectangle || target.sizes !== undefined || (square ? !pixels(target.size) : !pixels(target.width) || !pixels(target.height))) throw new Error(`${field} renders a PNG at one size (1–4096) or one width and height.`);
101
+ const square = target.size !== undefined,
102
+ rectangle = target.width !== undefined || target.height !== undefined;
103
+ if (square === rectangle || target.sizes !== undefined || (square ? !pixels(target.size) : !pixels(target.width) || !pixels(target.height)))
104
+ throw new Error(`${field} renders a PNG at one size (1–4096) or one width and height.`);
79
105
  } else if (format === ".ico" || format === ".icns") {
80
106
  const allowed = format === ".ico" ? [16, 24, 32, 48, 64, 128, 256] : iconSizes;
81
- if (["size", "width", "height"].some(key => key in target) || !Array.isArray(target.sizes) || !target.sizes.length || new Set(target.sizes).size !== target.sizes.length || target.sizes.some(size => !allowed.includes(size))) throw new Error(`${field}.sizes must list distinct ${format.slice(1).toUpperCase()} sizes from ${allowed.join(", ")}.`);
107
+ if (
108
+ ["size", "width", "height"].some((key) => key in target) ||
109
+ !Array.isArray(target.sizes) ||
110
+ !target.sizes.length ||
111
+ new Set(target.sizes).size !== target.sizes.length ||
112
+ target.sizes.some((size) => !allowed.includes(size))
113
+ )
114
+ throw new Error(`${field}.sizes must list distinct ${format.slice(1).toUpperCase()} sizes from ${allowed.join(", ")}.`);
82
115
  } else throw new Error(`${field}.to must end in .svg, .png, .ico or .icns, or keep the supplied file's extension.`);
83
116
  }
84
117
  }
@@ -86,14 +119,22 @@ function validateBrandTargets(targets, { root, dsRoot }) {
86
119
  function validateGlyphs(glyphs, { dsRoot }) {
87
120
  if (glyphs === null) return;
88
121
  if (!glyphs || typeof glyphs !== "object" || Array.isArray(glyphs)) throw new Error("assets.glyphs must be an object or null.");
89
- const unknown = Object.keys(glyphs).filter(key => !["source", "output", "attributes"].includes(key));
122
+ const unknown = Object.keys(glyphs).filter((key) => !["source", "output", "attributes"].includes(key));
90
123
  if (unknown.length) throw new Error(`assets.glyphs has unknown keys: ${unknown.join(", ")}.`);
91
124
  const source = projectPath(dsRoot, glyphs.source, "assets.glyphs.source");
92
- if (!isInside(path.join(dsRoot, "assets"), source) || source === path.join(dsRoot, "assets")) throw new Error("assets.glyphs.source must be a folder inside the ADS's assets/ folder.");
125
+ if (!isInside(path.join(dsRoot, "assets"), source) || source === path.join(dsRoot, "assets"))
126
+ throw new Error("assets.glyphs.source must be a folder inside the ADS's assets/ folder.");
93
127
  const output = projectPath(dsRoot, glyphs.output, "assets.glyphs.output");
94
- if (isInside(path.join(dsRoot, "assets"), output) || path.extname(output) !== ".ts") throw new Error("assets.glyphs.output must be a .ts module in the ADS, outside assets/.");
128
+ if (isInside(path.join(dsRoot, "assets"), output) || path.extname(output) !== ".ts")
129
+ throw new Error("assets.glyphs.output must be a .ts module in the ADS, outside assets/.");
95
130
  const attributes = glyphs.attributes ?? {};
96
- if (!attributes || typeof attributes !== "object" || Array.isArray(attributes) || Object.entries(attributes).some(([name, value]) => !/^[a-z][a-z0-9-]*$/.test(name) || typeof value !== "string" || /["<>]/.test(value))) throw new Error("assets.glyphs.attributes maps SVG attribute names to plain string values.");
131
+ if (
132
+ !attributes ||
133
+ typeof attributes !== "object" ||
134
+ Array.isArray(attributes) ||
135
+ Object.entries(attributes).some(([name, value]) => !/^[a-z][a-z0-9-]*$/.test(name) || typeof value !== "string" || /["<>]/.test(value))
136
+ )
137
+ throw new Error("assets.glyphs.attributes maps SVG attribute names to plain string values.");
97
138
  }
98
139
 
99
140
  export function projectPath(root, value, field) {
@@ -105,82 +146,171 @@ export function projectPath(root, value, field) {
105
146
  return absolute;
106
147
  }
107
148
 
149
+ /** Where ADS publishes the verified preview graph, relative to the project root. */
150
+ export const PREVIEW_MANIFEST = ".ds/preview/manifest.json";
151
+
108
152
  export function loadConfig(directory = process.cwd()) {
109
153
  const root = path.resolve(directory);
110
154
  const configFile = path.join(root, "ds.config.json");
111
155
  const user = existsSync(configFile) ? JSON.parse(readFileSync(configFile, "utf8")) : {};
112
156
  if (!user || typeof user !== "object" || Array.isArray(user)) throw new Error("ds.config.json must be an object.");
113
- if (Object.hasOwn(user, "enforce")) throw new Error("enforce was removed in 0.3.47: ADS findings are errors, review items or info. Remove enforce from ds.config.json.");
114
157
  for (const field of Object.keys(user)) {
115
158
  if (!(field in defaultConfig)) throw new Error(`Unknown ADS configuration field: ${field}`);
116
159
  }
117
- if (user.oxlint !== undefined && (!user.oxlint || typeof user.oxlint !== "object" || Array.isArray(user.oxlint))) throw new Error("oxlint must be an object.");
118
- if (user.mcp && Object.hasOwn(user.mcp,"mutationChecks")) throw new Error("Move mcp.mutationChecks to acceptance.checks; choose acceptance.behaviorChecks explicitly. ADS no longer infers project scripts.");
119
- for (const field of ["boundaries", "assets", "oxlint", "mcp", "acceptance", "validation", "usage", "resources", "layout"]) {
120
- if (user[field] !== undefined && (!user[field] || typeof user[field] !== "object" || Array.isArray(user[field]))) throw new Error(`${field} must be an object.`);
121
- for (const key of Object.keys(user[field] ?? {})) if (!(key in defaultConfig[field])) throw new Error(`Unknown ${field} configuration field: ${key}`);
160
+
161
+ for (const field of ["assets", "mcp", "acceptance", "validation", "usage", "resources", "layout"]) {
162
+ if (user[field] !== undefined && (!user[field] || typeof user[field] !== "object" || Array.isArray(user[field])))
163
+ throw new Error(`${field} must be an object.`);
164
+ for (const key of Object.keys(user[field] ?? {})) {
165
+ if (!(key in defaultConfig[field])) throw new Error(`Unknown ${field} configuration field: ${key}`);
166
+ }
122
167
  }
123
- const config = { ...defaultConfig, ...user, boundaries: { ...defaultConfig.boundaries, ...user.boundaries }, assets: { ...defaultConfig.assets, ...user.assets }, oxlint: { ...defaultConfig.oxlint, ...user.oxlint }, acceptance: { ...defaultConfig.acceptance, ...user.acceptance }, validation: { ...defaultConfig.validation, ...user.validation }, mcp: { ...defaultConfig.mcp, ...user.mcp }, usage: { ...defaultConfig.usage, ...user.usage }, resources: { ...defaultConfig.resources, ...user.resources }, layout: { ...defaultConfig.layout, ...user.layout } };
168
+ const config = {
169
+ ...defaultConfig,
170
+ ...user,
171
+ ...fixedLayout,
172
+ assets: { ...defaultConfig.assets, ...user.assets },
173
+ acceptance: { ...defaultConfig.acceptance, ...user.acceptance },
174
+ validation: { ...defaultConfig.validation, ...user.validation },
175
+ mcp: { ...defaultConfig.mcp, ...user.mcp },
176
+ usage: { ...defaultConfig.usage, ...user.usage },
177
+ resources: { ...defaultConfig.resources, ...user.resources },
178
+ layout: { ...defaultConfig.layout, ...user.layout },
179
+ };
124
180
  validateThemes(config.themes);
125
181
  validateBrands(config.brands);
126
182
  if (typeof config.followSystemTheme !== "boolean") throw new Error("followSystemTheme must be true or false.");
127
183
  if (config.followSystemTheme) {
128
184
  const other = config.themes[0].scheme === "dark" ? "light" : "dark";
129
- if (!config.themes.some(theme => theme.scheme === other)) throw new Error(`followSystemTheme needs a declared theme with scheme ${other}.`);
185
+ if (!config.themes.some((theme) => theme.scheme === other)) throw new Error(`followSystemTheme needs a declared theme with scheme ${other}.`);
130
186
  }
131
- for (const brand of config.brands) if (config.themes.some(theme => theme.name === `brand-${brand.name}`)) throw new Error(`Theme "brand-${brand.name}" and brand "${brand.name}" would share the display switch --display-brand-${brand.name}; rename one.`);
132
- if(config.resources.memoryLimitMb!==null&&(!Number.isInteger(config.resources.memoryLimitMb)||config.resources.memoryLimitMb<64||config.resources.memoryLimitMb>1048576))throw new Error("resources.memoryLimitMb must be null (automatic) or an integer from 64 to 1048576 MiB.");
133
- if (config.assets.imageBudgetKb !== null && (!Number.isInteger(config.assets.imageBudgetKb) || config.assets.imageBudgetKb < 1 || config.assets.imageBudgetKb > 1048576)) throw new Error("assets.imageBudgetKb must be null (a limit per format) or a positive whole number of KB for every format.");
134
- if (config.assets.preloadFonts !== null && (!Array.isArray(config.assets.preloadFonts) || config.assets.preloadFonts.some(item => !item || typeof item !== "object" || Array.isArray(item) || Object.keys(item).some(key => !["family", "weight"].includes(key)) || typeof item.family !== "string" || !item.family || !Number.isInteger(item.weight) || item.weight < 1 || item.weight > 1000))) throw new Error('assets.preloadFonts must be null or an array of { "family": "Name", "weight": 400 }.');
135
- if (config.assets.fontBudgetKb !== null && (!Number.isInteger(config.assets.fontBudgetKb) || config.assets.fontBudgetKb < 1 || config.assets.fontBudgetKb > 1048576)) throw new Error("assets.fontBudgetKb must be null (the default limit) or a positive whole number of KB.");
136
- if (!Array.isArray(config.layout.widthTokens) || config.layout.widthTokens.length > 200 || new Set(config.layout.widthTokens).size !== config.layout.widthTokens.length || config.layout.widthTokens.some(name => typeof name !== "string" || !/^--[\w-][\w*-]*$/.test(name))) throw new Error("layout.widthTokens must contain distinct token names or globs such as --panel-*, and cannot name every token.");
137
- if (!Array.isArray(config.layout.fixedWidthUnits) || config.layout.fixedWidthUnits.length > 200 || new Set(config.layout.fixedWidthUnits).size !== config.layout.fixedWidthUnits.length || config.layout.fixedWidthUnits.some(glob => typeof glob !== "string" || !glob || glob.includes("\\") || glob.startsWith("/") || glob.split("/").includes("..") || !/[^*/]/.test(glob))) throw new Error("layout.fixedWidthUnits must contain distinct unit ids or project-relative globs such as components/Overlay/*, and cannot name every unit.");
138
- if (!Array.isArray(config.usage.notifications) || config.usage.notifications.length > 100) throw new Error("usage.notifications must be an array of notification API registrations.");
187
+ for (const brand of config.brands)
188
+ if (config.themes.some((theme) => theme.name === `brand-${brand.name}`))
189
+ throw new Error(`Theme "brand-${brand.name}" and brand "${brand.name}" would share the display switch --display-brand-${brand.name}; rename one.`);
190
+ if (
191
+ config.resources.memoryLimitMb !== null &&
192
+ (!Number.isInteger(config.resources.memoryLimitMb) || config.resources.memoryLimitMb < 64 || config.resources.memoryLimitMb > 1048576)
193
+ )
194
+ throw new Error("resources.memoryLimitMb must be null (automatic) or an integer from 64 to 1048576 MiB.");
195
+ if (
196
+ config.assets.imageBudgetKb !== null &&
197
+ (!Number.isInteger(config.assets.imageBudgetKb) || config.assets.imageBudgetKb < 1 || config.assets.imageBudgetKb > 1048576)
198
+ )
199
+ throw new Error("assets.imageBudgetKb must be null (a limit per format) or a positive whole number of KB for every format.");
200
+ if (
201
+ config.assets.preloadFonts !== null &&
202
+ (!Array.isArray(config.assets.preloadFonts) ||
203
+ config.assets.preloadFonts.some(
204
+ (item) =>
205
+ !item ||
206
+ typeof item !== "object" ||
207
+ Array.isArray(item) ||
208
+ Object.keys(item).some((key) => !["family", "weight"].includes(key)) ||
209
+ typeof item.family !== "string" ||
210
+ !item.family ||
211
+ !Number.isInteger(item.weight) ||
212
+ item.weight < 1 ||
213
+ item.weight > 1000,
214
+ ))
215
+ )
216
+ throw new Error('assets.preloadFonts must be null or an array of { "family": "Name", "weight": 400 }.');
217
+ if (
218
+ config.assets.fontBudgetKb !== null &&
219
+ (!Number.isInteger(config.assets.fontBudgetKb) || config.assets.fontBudgetKb < 1 || config.assets.fontBudgetKb > 1048576)
220
+ )
221
+ throw new Error("assets.fontBudgetKb must be null (the default limit) or a positive whole number of KB.");
222
+ if (
223
+ !Array.isArray(config.layout.widthTokens) ||
224
+ config.layout.widthTokens.length > 200 ||
225
+ new Set(config.layout.widthTokens).size !== config.layout.widthTokens.length ||
226
+ config.layout.widthTokens.some((name) => typeof name !== "string" || !/^--[\w-][\w*-]*$/.test(name))
227
+ )
228
+ throw new Error("layout.widthTokens must contain distinct token names or globs such as --panel-*, and cannot name every token.");
229
+ if (
230
+ !Array.isArray(config.layout.fixedWidthUnits) ||
231
+ config.layout.fixedWidthUnits.length > 200 ||
232
+ new Set(config.layout.fixedWidthUnits).size !== config.layout.fixedWidthUnits.length ||
233
+ config.layout.fixedWidthUnits.some(
234
+ (glob) => typeof glob !== "string" || !glob || glob.includes("\\") || glob.startsWith("/") || glob.split("/").includes("..") || !/[^*/]/.test(glob),
235
+ )
236
+ )
237
+ throw new Error(
238
+ "layout.fixedWidthUnits must contain distinct unit ids or project-relative globs such as components/Overlay/*, and cannot name every unit.",
239
+ );
240
+ if (!Array.isArray(config.usage.notifications) || config.usage.notifications.length > 100)
241
+ throw new Error("usage.notifications must be an array of notification API registrations.");
139
242
  const notificationNames = new Set();
140
243
  for (const entry of config.usage.notifications) {
141
- if (!entry || typeof entry !== "object" || Array.isArray(entry) || Object.keys(entry).some(key => !["api", "host", "rootFiles"].includes(key)) || ![entry.api, entry.host].every(name => typeof name === "string" && /^[A-Za-z_$][\w$]*$/.test(name))) throw new Error("Each usage.notifications entry requires public api and host export names and rootFiles.");
142
- if (notificationNames.has(entry.api) || notificationNames.has(entry.host) || entry.api === entry.host) throw new Error("Notification API and host registrations must be distinct.");
143
- notificationNames.add(entry.api); notificationNames.add(entry.host);
144
- if (!Array.isArray(entry.rootFiles) || !entry.rootFiles.length || entry.rootFiles.length > 100 || new Set(entry.rootFiles).size !== entry.rootFiles.length) throw new Error("Notification rootFiles must contain distinct project-relative source files.");
244
+ if (
245
+ !entry ||
246
+ typeof entry !== "object" ||
247
+ Array.isArray(entry) ||
248
+ Object.keys(entry).some((key) => !["api", "host", "rootFiles"].includes(key)) ||
249
+ ![entry.api, entry.host].every((name) => typeof name === "string" && /^[A-Za-z_$][\w$]*$/.test(name))
250
+ )
251
+ throw new Error("Each usage.notifications entry requires public api and host export names and rootFiles.");
252
+ if (notificationNames.has(entry.api) || notificationNames.has(entry.host) || entry.api === entry.host)
253
+ throw new Error("Notification API and host registrations must be distinct.");
254
+ notificationNames.add(entry.api);
255
+ notificationNames.add(entry.host);
256
+ if (!Array.isArray(entry.rootFiles) || !entry.rootFiles.length || entry.rootFiles.length > 100 || new Set(entry.rootFiles).size !== entry.rootFiles.length)
257
+ throw new Error("Notification rootFiles must contain distinct project-relative source files.");
145
258
  for (const file of entry.rootFiles) {
146
259
  projectPath(root, file, "usage.notifications.rootFiles");
147
- if (!/\.[cm]?[jt]sx?$/.test(file) || file.includes("\\") || file.split("/").some(part => !part || [".", "..", "node_modules", ".git", ".ds"].includes(part))) throw new Error("Notification rootFiles must name canonical project-relative source files.");
260
+ if (
261
+ !/\.[cm]?[jt]sx?$/.test(file) ||
262
+ file.includes("\\") ||
263
+ file.split("/").some((part) => !part || [".", "..", "node_modules", ".git", ".ds"].includes(part))
264
+ )
265
+ throw new Error("Notification rootFiles must name canonical project-relative source files.");
148
266
  }
149
267
  }
150
- if (!Array.isArray(config.usage.restrictedImports) || config.usage.restrictedImports.length > 100 || new Set(config.usage.restrictedImports).size !== config.usage.restrictedImports.length || config.usage.restrictedImports.some(name => typeof name !== "string" || !/^(?:@[a-z0-9][a-z0-9._~-]*\/)?[a-z0-9][a-z0-9._~-]*$/.test(name))) throw new Error("usage.restrictedImports must contain distinct npm package names.");
151
- for (const name of ["acceptance","validation"]) {
152
- const policy=config[name];
153
- if (!Array.isArray(policy.checks) || policy.checks.length>20 || new Set(policy.checks).size!==policy.checks.length || policy.checks.some(script=>typeof script!=="string" || !/^[a-zA-Z0-9][\w:.-]*$/.test(script))) throw new Error(`${name}.checks must contain up to 20 unique package script names.`);
154
- if(typeof policy.behaviorChecks!=="boolean")throw new Error(`${name}.behaviorChecks must be a boolean.`);
155
- if(typeof policy.browserAudit!=="boolean")throw new Error(`${name}.browserAudit must be a boolean.`);
268
+ if (
269
+ !Array.isArray(config.usage.restrictedImports) ||
270
+ config.usage.restrictedImports.length > 100 ||
271
+ new Set(config.usage.restrictedImports).size !== config.usage.restrictedImports.length ||
272
+ config.usage.restrictedImports.some((name) => typeof name !== "string" || !/^(?:@[a-z0-9][a-z0-9._~-]*\/)?[a-z0-9][a-z0-9._~-]*$/.test(name))
273
+ )
274
+ throw new Error("usage.restrictedImports must contain distinct npm package names.");
275
+ for (const name of ["acceptance", "validation"]) {
276
+ const scripts = config[name].scripts;
277
+ if (
278
+ !Array.isArray(scripts) ||
279
+ scripts.length > 20 ||
280
+ new Set(scripts).size !== scripts.length ||
281
+ scripts.some((script) => typeof script !== "string" || !/^[a-zA-Z0-9][\w:.-]*$/.test(script))
282
+ )
283
+ throw new Error(`${name}.scripts must contain up to 20 unique package script names.`);
156
284
  }
157
- if (!Array.isArray(config.validation.inputs) || config.validation.inputs.length > 200 || new Set(config.validation.inputs).size !== config.validation.inputs.length) throw new Error("validation.inputs must contain at most 200 unique project-relative files or directories.");
285
+ for (const key of ["behavior", "audit"]) if (typeof config.acceptance[key] !== "boolean") throw new Error(`acceptance.${key} must be true or false.`);
286
+ if (config.validation.scripts.some((script) => config.acceptance.scripts.includes(script)))
287
+ throw new Error("validation.scripts run after acceptance.scripts; list each script once.");
288
+ if (
289
+ !Array.isArray(config.validation.inputs) ||
290
+ config.validation.inputs.length > 200 ||
291
+ new Set(config.validation.inputs).size !== config.validation.inputs.length
292
+ )
293
+ throw new Error("validation.inputs must contain at most 200 unique project-relative files or directories.");
158
294
  for (const file of config.validation.inputs) {
159
- const absolute = projectPath(root,file,"validation.inputs");
160
- if (absolute === root || path.relative(root,absolute).replaceAll("\\","/") !== file || file.split("/").some(part=>["node_modules",".git",".ds"].includes(part))) throw new Error("validation.inputs must name canonical source paths below the project root, excluding dependency and metadata directories.");
295
+ const absolute = projectPath(root, file, "validation.inputs");
296
+ if (
297
+ absolute === root ||
298
+ path.relative(root, absolute).replaceAll("\\", "/") !== file ||
299
+ file.split("/").some((part) => ["node_modules", ".git", ".ds"].includes(part))
300
+ )
301
+ throw new Error("validation.inputs must name canonical source paths below the project root, excluding dependency and metadata directories.");
161
302
  }
162
303
  if (config.schemaVersion !== 1) throw new Error(`Unsupported ADS config version: ${config.schemaVersion}`);
163
304
  if (user.framework !== undefined && !supportedFrameworks.includes(user.framework)) throw new Error("framework must be react or preact.");
164
- if (!Array.isArray(config.behaviorLibraries) || config.behaviorLibraries.length > 100
165
- || new Set(config.behaviorLibraries).size !== config.behaviorLibraries.length
166
- || config.behaviorLibraries.some(name => typeof name !== "string" || name.length > 214 || !/^(?:@[a-z0-9][a-z0-9._~-]*\/)?[a-z0-9][a-z0-9._~-]*$/.test(name))) throw new Error("behaviorLibraries must contain up to 100 unique npm package names, without versions, subpaths or wildcards.");
167
- if (typeof config.publicAlias !== "string" || !config.publicAlias.trim()) throw new Error("publicAlias must be a non-empty string.");
168
- if (!Array.isArray(config.inlineStyleFiles)) throw new Error("inlineStyleFiles must be an array of relative paths.");
305
+ if (
306
+ !Array.isArray(config.behaviorLibraries) ||
307
+ config.behaviorLibraries.length > 100 ||
308
+ new Set(config.behaviorLibraries).size !== config.behaviorLibraries.length ||
309
+ config.behaviorLibraries.some((name) => typeof name !== "string" || name.length > 214 || !/^(?:@[a-z0-9][a-z0-9._~-]*\/)?[a-z0-9][a-z0-9._~-]*$/.test(name))
310
+ )
311
+ throw new Error("behaviorLibraries must contain up to 100 unique npm package names, without versions, subpaths or wildcards.");
169
312
  const sourceRoot = projectPath(root, config.sourceDir, "sourceDir");
170
313
  const dsRoot = projectPath(root, config.dsDir, "dsDir");
171
- for (const field of ["publicEntry", "reviewEntry", "stylesEntry", "tokenDir"]) projectPath(dsRoot, config[field], field);
172
- if (!isInside(path.join(dsRoot, "review"), path.resolve(dsRoot, config.reviewEntry)) || path.resolve(dsRoot, config.reviewEntry) === path.join(dsRoot, "review") || !/\.[cm]?[jt]sx?$/.test(config.reviewEntry)) throw new Error("reviewEntry must name a script entry inside the ADS review/ development layer.");
173
- for (const file of config.inlineStyleFiles) projectPath(root, file, "inlineStyleFiles");
174
- if (!Array.isArray(config.boundaries.componentVariables) || config.boundaries.componentVariables.some((name) => typeof name !== "string" || !/^--ds-[\w-]+$/.test(name) || isStateVariable(name))) throw new Error("boundaries.componentVariables must name non-state --ds-* customization variables.");
175
- if (!Array.isArray(config.boundaries.styleWrites)) throw new Error("boundaries.styleWrites must be an array.");
176
- const boundaryFiles = new Set();
177
- for (const boundary of config.boundaries.styleWrites) {
178
- if (!boundary || typeof boundary !== "object" || Array.isArray(boundary) || Object.keys(boundary).some((key) => !["file", "properties"].includes(key))) throw new Error("Each styleWrites boundary requires file and properties.");
179
- const file = projectPath(root, boundary.file, "boundaries.styleWrites.file");
180
- if (boundaryFiles.has(file)) throw new Error("Duplicate styleWrites file boundary.");
181
- boundaryFiles.add(file);
182
- if (!Array.isArray(boundary.properties) || !boundary.properties.length || boundary.properties.some((name) => typeof name !== "string" || !/^(?:--[\w-]+|[a-z][a-z0-9-]*)$/.test(name) || name === "css-text" || isStateVariable(name) || isSharedToken(name) || name.startsWith("--") && !/^(?:--ds-|--ux-|--showcase-)/.test(name))) throw new Error("styleWrites.properties must name explicit CSS properties; bulk cssText, shared tokens, foreign prefixes, and primitive-state writes cannot be allowed.");
183
- }
184
314
  for (const field of ["publicDirs", "generatedPaths", "generatedFiles"]) {
185
315
  if (!Array.isArray(config.assets[field])) throw new Error(`assets.${field} must be an array.`);
186
316
  for (const entry of config.assets[field]) {
@@ -189,73 +319,90 @@ export function loadConfig(directory = process.cwd()) {
189
319
  if (absolute === base) throw new Error(`assets.${field} must name a path below its root.`);
190
320
  }
191
321
  }
192
- if (!Array.isArray(config.oxlint.plugins) || !config.oxlint.rules || typeof config.oxlint.rules !== "object" || Array.isArray(config.oxlint.rules)) {
193
- throw new Error("oxlint requires plugins (array) and rules (object).");
194
- }
195
- if (!Array.isArray(config.oxlint.overrides)) throw new Error("oxlint.overrides must be an array.");
196
- for (const override of config.oxlint.overrides) {
197
- if (!override || typeof override !== "object" || Array.isArray(override) || Object.keys(override).some((key) => !["files", "rules"].includes(key))) throw new Error("Each oxlint override requires files and rules only.");
198
- if (!Array.isArray(override.files) || !override.files.length || override.files.some((file) => typeof file !== "string" || !file.trim() || file.startsWith("!") || path.isAbsolute(file) || file.split(/[\\/]/).includes(".."))) throw new Error("oxlint.overrides.files must contain project-relative paths or globs.");
199
- if (!override.rules || typeof override.rules !== "object" || Array.isArray(override.rules)) throw new Error("oxlint.overrides.rules must be an object.");
200
- }
201
322
  if (config.assets.iconSource !== null) {
202
323
  const source = projectPath(dsRoot, config.assets.iconSource, "assets.iconSource");
203
- if (!isInside(path.join(dsRoot, "assets/brand"), source) || !renderableFormats.includes(path.extname(source).toLowerCase())) throw new Error("assets.iconSource must name an SVG, or a square PNG, JPEG or WebP of at least 512 px, inside the ADS's assets/brand/ folder.");
324
+ if (!isInside(path.join(dsRoot, "assets/brand"), source) || !renderableFormats.includes(path.extname(source).toLowerCase()))
325
+ throw new Error("assets.iconSource must name an SVG, or a square PNG, JPEG or WebP of at least 512 px, inside the ADS's assets/brand/ folder.");
204
326
  }
205
327
  validateBrandTargets(config.assets.targets, { root, dsRoot });
206
328
  validateGlyphs(config.assets.glyphs, { dsRoot });
207
- for (const plugin of config.oxlint.plugins) {
208
- if (!plugin || Object.keys(plugin).some((key) => !["name", "path"].includes(key)) || typeof plugin.name !== "string" || !plugin.name || typeof plugin.path !== "string") {
209
- throw new Error("Each project Oxlint plugin needs a name and a relative path.");
210
- }
211
- projectPath(root, plugin.path, "oxlint.plugins.path");
212
- }
213
- if (config.mcp.showcaseUrl !== null) {
214
- let url;
215
- try { url = new URL(config.mcp.showcaseUrl); } catch { throw new Error("mcp.showcaseUrl must be an http(s) URL or null."); }
216
- if (!["http:", "https:"].includes(url.protocol) || url.username || url.password) throw new Error("mcp.showcaseUrl must be an http(s) URL without credentials.");
217
- }
218
- if (config.mcp.showcaseTitle !== null && (typeof config.mcp.showcaseTitle !== "string" || !config.mcp.showcaseTitle.trim() || config.mcp.showcaseTitle.length > 120)) throw new Error("mcp.showcaseTitle must be a non-empty title of at most 120 characters or null.");
219
- if (!Array.isArray(config.mcp.apps)) throw new Error("mcp.apps must be an array of built project previews.");
329
+ if (
330
+ config.mcp.showcaseTitle !== null &&
331
+ (typeof config.mcp.showcaseTitle !== "string" || !config.mcp.showcaseTitle.trim() || config.mcp.showcaseTitle.length > 120)
332
+ )
333
+ throw new Error("mcp.showcaseTitle must be a non-empty title of at most 120 characters or null.");
220
334
  const capture = config.mcp.capture;
221
- if (!capture || typeof capture !== "object" || Array.isArray(capture) || Object.keys(capture).some(key => !["browser", "channel", "timeoutMs"].includes(key))
222
- || !["chromium", "firefox", "webkit"].includes(capture.browser ?? "chromium")
223
- || capture.channel !== undefined && (typeof capture.channel !== "string" || !/^[\w-]{1,60}$/.test(capture.channel) || ![undefined, "chromium"].includes(capture.browser))
224
- || capture.timeoutMs !== undefined && (!Number.isInteger(capture.timeoutMs) || capture.timeoutMs < 100 || capture.timeoutMs > 300000)) throw new Error("mcp.capture accepts browser (chromium/firefox/webkit), an optional Chromium channel, and timeoutMs (100–300000). Install Playwright and its browser in the project; ADS installs nothing.");
225
- if (!config.mcp.behaviorProfiles || typeof config.mcp.behaviorProfiles !== "object" || Array.isArray(config.mcp.behaviorProfiles) || Object.keys(config.mcp.behaviorProfiles).length > 20) throw new Error("mcp.behaviorProfiles must be an object of up to 20 registered execution profiles.");
335
+ if (
336
+ !capture ||
337
+ typeof capture !== "object" ||
338
+ Array.isArray(capture) ||
339
+ Object.keys(capture).some((key) => !["browser", "channel", "timeoutMs"].includes(key)) ||
340
+ !["chromium", "firefox", "webkit"].includes(capture.browser ?? "chromium") ||
341
+ (capture.channel !== undefined &&
342
+ (typeof capture.channel !== "string" || !/^[\w-]{1,60}$/.test(capture.channel) || ![undefined, "chromium"].includes(capture.browser))) ||
343
+ (capture.timeoutMs !== undefined && (!Number.isInteger(capture.timeoutMs) || capture.timeoutMs < 100 || capture.timeoutMs > 300000))
344
+ )
345
+ throw new Error(
346
+ "mcp.capture accepts browser (chromium/firefox/webkit), an optional Chromium channel, and timeoutMs (100–300000). Install Playwright and its browser in the project; ADS installs nothing.",
347
+ );
348
+ if (
349
+ !config.mcp.behaviorProfiles ||
350
+ typeof config.mcp.behaviorProfiles !== "object" ||
351
+ Array.isArray(config.mcp.behaviorProfiles) ||
352
+ Object.keys(config.mcp.behaviorProfiles).length > 20
353
+ )
354
+ throw new Error("mcp.behaviorProfiles must be an object of up to 20 registered execution profiles.");
226
355
  for (const [name, profile] of Object.entries(config.mcp.behaviorProfiles)) {
227
- if (!/^[a-zA-Z0-9][\w.-]{0,79}$/.test(name) || !profile || typeof profile !== "object" || Array.isArray(profile)
228
- || Object.keys(profile).some(key => !["command", "args", "timeoutMs", "runner", "framework", "mode"].includes(key))
229
- || typeof profile.command !== "string" || !profile.command.trim() || profile.command.includes("\0")
230
- || !Array.isArray(profile.args) || profile.args.some(arg => typeof arg !== "string" || arg.includes("\0"))
231
- || !["protocol", "playwright"].includes(profile.runner ?? "protocol")
232
- || profile.framework !== undefined && profile.framework !== config.framework
233
- || profile.mode !== undefined && !["browser", "strict", "unit"].includes(profile.mode)
234
- || profile.timeoutMs !== undefined && (!Number.isInteger(profile.timeoutMs) || profile.timeoutMs < 100 || profile.timeoutMs > 900000)) throw new Error(`Invalid behavior profile ${name}. Use literal executable/args, a protocol or Playwright runner, a matching framework and a timeout from 100 to 900000 ms. Profiles do not install dependencies or receive APIs from an MCP host.`);
235
- if (profile.mode === "strict" && config.framework !== "react") throw new Error(`Behavior profile ${name}: React StrictMode requires framework react; use the configured framework's lifecycle tests instead.`);
236
- }
237
- const retention={...defaultConfig.mcp.resultRetention,...config.mcp.resultRetention};
238
- if(!config.mcp.resultRetention || typeof config.mcp.resultRetention!=="object" || Array.isArray(config.mcp.resultRetention) || Object.keys(config.mcp.resultRetention).some(key=>!["maxRuns","maxAgeDays","maxBytesMb"].includes(key)) || !Number.isInteger(retention.maxRuns) || retention.maxRuns<1 || retention.maxRuns>1000 || !Number.isInteger(retention.maxAgeDays) || retention.maxAgeDays<1 || retention.maxAgeDays>365 || !Number.isInteger(retention.maxBytesMb) || retention.maxBytesMb<8 || retention.maxBytesMb>16384)throw new Error("mcp.resultRetention requires maxRuns (1–1000), maxAgeDays (1–365), maxBytesMb (8–16384).");
239
- config.mcp.resultRetention=retention;
240
- if (!Number.isInteger(config.mcp.mutationCheckTimeoutMs) || config.mcp.mutationCheckTimeoutMs < 100 || config.mcp.mutationCheckTimeoutMs > 300000) throw new Error("mcp.mutationCheckTimeoutMs must be an integer from 100 to 300000. This budget applies to each registered project script, separately from behavior profiles.");
241
- if (config.mcp.previewManifest !== null) {
242
- const manifest = projectPath(root, config.mcp.previewManifest, "mcp.previewManifest");
243
- if (!isInside(path.join(root, ".ds"), manifest) || path.extname(manifest) !== ".json") throw new Error("mcp.previewManifest must name a generated JSON manifest inside .ds/.");
244
- }
245
- if (config.mcp.previewWatch !== null && config.mcp.previewWatch !== false) {
246
- const watch = config.mcp.previewWatch;
247
- if (!watch || typeof watch !== "object" || Array.isArray(watch) || Object.keys(watch).some((key) => !["command", "args"].includes(key)) || typeof watch.command !== "string" || !watch.command.trim() || watch.command.includes("\0") || !Array.isArray(watch.args) || watch.args.some((arg) => typeof arg !== "string" || arg.includes("\0"))) throw new Error("mcp.previewWatch requires command (executable) and args (string array), null (native compiler), or false (externally prebuilt previews).");
248
- }
249
- if(config.framework&&config.mcp.previewManifest&&config.mcp.previewWatch===null){
250
- config.mcp.previewWatch={command:"bun",args:[fileURLToPath(new URL("./bun-compiler.mjs",import.meta.url)),"--watch"]};
251
- }
252
- const appIds = new Set();
253
- for (const app of config.mcp.apps) {
254
- if (!app || typeof app !== "object" || Object.keys(app).some((key) => !["id", "title", "kind", "file", "description"].includes(key)) || !/^[a-z][a-z0-9-]{0,63}$/.test(app.id) || app.id === "tokens" || appIds.has(app.id) || typeof app.title !== "string" || !app.title.trim() || !["components", "patterns", "showcase"].includes(app.kind) || app.description !== undefined && typeof app.description !== "string") throw new Error("Each mcp.apps entry needs a unique id (tokens is reserved), title, kind (components/patterns/showcase), and project-relative HTML file.");
255
- const file = projectPath(root, app.file, "mcp.apps.file");
256
- if (path.extname(file) !== ".html") throw new Error("mcp.apps.file must be a built, self-contained HTML file.");
257
- appIds.add(app.id);
356
+ if (
357
+ !/^[a-zA-Z0-9][\w.-]{0,79}$/.test(name) ||
358
+ !profile ||
359
+ typeof profile !== "object" ||
360
+ Array.isArray(profile) ||
361
+ Object.keys(profile).some((key) => !["command", "args", "timeoutMs", "runner", "framework", "mode"].includes(key)) ||
362
+ typeof profile.command !== "string" ||
363
+ !profile.command.trim() ||
364
+ profile.command.includes("\0") ||
365
+ !Array.isArray(profile.args) ||
366
+ profile.args.some((arg) => typeof arg !== "string" || arg.includes("\0")) ||
367
+ !["protocol", "playwright"].includes(profile.runner ?? "protocol") ||
368
+ (profile.framework !== undefined && profile.framework !== config.framework) ||
369
+ (profile.mode !== undefined && !["browser", "strict", "unit"].includes(profile.mode)) ||
370
+ (profile.timeoutMs !== undefined && (!Number.isInteger(profile.timeoutMs) || profile.timeoutMs < 100 || profile.timeoutMs > 900000))
371
+ )
372
+ throw new Error(
373
+ `Invalid behavior profile ${name}. Use literal executable/args, a protocol or Playwright runner, a matching framework and a timeout from 100 to 900000 ms. Profiles do not install dependencies or receive APIs from an MCP host.`,
374
+ );
375
+ if (profile.mode === "strict" && config.framework !== "react")
376
+ throw new Error(`Behavior profile ${name}: React StrictMode requires framework react; use the configured framework's lifecycle tests instead.`);
258
377
  }
378
+ const retention = { ...defaultConfig.mcp.resultRetention, ...config.mcp.resultRetention };
379
+ if (
380
+ !config.mcp.resultRetention ||
381
+ typeof config.mcp.resultRetention !== "object" ||
382
+ Array.isArray(config.mcp.resultRetention) ||
383
+ Object.keys(config.mcp.resultRetention).some((key) => !["maxRuns", "maxAgeDays", "maxBytesMb"].includes(key)) ||
384
+ !Number.isInteger(retention.maxRuns) ||
385
+ retention.maxRuns < 1 ||
386
+ retention.maxRuns > 1000 ||
387
+ !Number.isInteger(retention.maxAgeDays) ||
388
+ retention.maxAgeDays < 1 ||
389
+ retention.maxAgeDays > 365 ||
390
+ !Number.isInteger(retention.maxBytesMb) ||
391
+ retention.maxBytesMb < 8 ||
392
+ retention.maxBytesMb > 16384
393
+ )
394
+ throw new Error("mcp.resultRetention requires maxRuns (1–1000), maxAgeDays (1–365), maxBytesMb (8–16384).");
395
+ config.mcp.resultRetention = retention;
396
+ if (!Number.isInteger(config.mcp.mutationCheckTimeoutMs) || config.mcp.mutationCheckTimeoutMs < 100 || config.mcp.mutationCheckTimeoutMs > 300000)
397
+ throw new Error(
398
+ "mcp.mutationCheckTimeoutMs must be an integer from 100 to 300000. This budget applies to each registered project script, separately from behavior profiles.",
399
+ );
400
+ if (!Number.isInteger(config.mcp.auditPages) || config.mcp.auditPages < 1 || config.mcp.auditPages > 16)
401
+ throw new Error("mcp.auditPages must be an integer from 1 to 16: how many pages the render audit renders at once.");
402
+ if (!Number.isInteger(config.mcp.previewBuildTimeoutMs) || config.mcp.previewBuildTimeoutMs < 1000 || config.mcp.previewBuildTimeoutMs > 3600000)
403
+ throw new Error(
404
+ "mcp.previewBuildTimeoutMs must be an integer from 1000 to 3600000. It is how long a preview waits for its build, including the first build after the MCP server starts.",
405
+ );
259
406
  return { root, config, sourceRoot, dsRoot };
260
407
  }
261
408
 
@@ -268,19 +415,11 @@ export function isTestFile(file) {
268
415
  }
269
416
 
270
417
  export function isScenarioFile(file) {
271
- return /(?:^|[\\/])Scenario\.[cm]?[jt]sx?$/.test(file) || /\.scenario\.[cm]?[jt]sx?$/.test(file);
272
- }
273
-
274
- export function isFixtureFile(file) {
275
- return /(?:^|[\\/])fixtures?\.(?:[cm]?[jt]sx?|json)$/.test(file) || /\.fixtures?\.(?:[cm]?[jt]sx?|json)$/.test(file);
276
- }
277
-
278
- /** File role, rather than folder location, keeps colocated preview code private. */
279
- export function isBehaviorFile(file) {
280
- return /(?:^|[\\/])behavior\.json$|\.behavior\.json$/.test(file);
418
+ return /\.ads\.scenario\.[cm]?[jt]sx?$/.test(file);
281
419
  }
282
420
 
283
- /** A visible development boundary, independent of whether its role is supported. */
421
+ /** A visible development boundary, independent of whether its role is supported.
422
+ * File role, rather than folder location, keeps colocated development code private. */
284
423
  export function adsFileRole(file) {
285
424
  const match = path.basename(file).match(/\.ads\.(.+)\.[^.]+$/);
286
425
  return match ? match[1] : null;
@@ -290,9 +429,12 @@ export function isContractFile(file) {
290
429
  return /\.ads\.contract\.[cm]?ts$/.test(file);
291
430
  }
292
431
 
293
- /** Filenames may change without changing the identity used by clients/checks. */
432
+ /** The ADS-relative path without `.ads.scenario.*`; a canonical `<Dir>/<Dir>.ads.scenario.*` identifies the directory. */
294
433
  export function scenarioIdentity(file, dsRoot) {
295
- let id = path.relative(dsRoot, file).replaceAll("\\", "/").replace(/\.ads(?=\.)/, "").replace(/(?:\/Scenario|\.scenario)\.[^.]+$/, "");
434
+ let id = path
435
+ .relative(dsRoot, file)
436
+ .replaceAll("\\", "/")
437
+ .replace(/\.ads\.scenario\.[^.]+$/, "");
296
438
  if (adsFileRole(file) === "scenario" && path.posix.basename(id) === path.posix.basename(path.posix.dirname(id))) id = path.posix.dirname(id);
297
439
  return id;
298
440
  }
@@ -300,19 +442,16 @@ export function scenarioIdentity(file, dsRoot) {
300
442
  export function isDevelopmentFile(file, { dsRoot }) {
301
443
  if (isDraftFile(file)) return true;
302
444
  if (!isInside(dsRoot, file)) return isTestFile(file) || adsFileRole(file) !== null;
303
- const relative = path.relative(dsRoot, file).replaceAll("\\", "/");
304
- return adsFileRole(file) !== null || isTestFile(file) || isScenarioFile(file) || isFixtureFile(file) || isBehaviorFile(file)
305
- || /^(?:showcase|composition|review|brand)\//.test(relative)
306
- || /(?:^|\/)(?:scenario|fixtures)(?:\/|$)/.test(relative)
307
- || /\.scenario(?:-adapter)?\.[cm]?[jt]sx?$/.test(relative);
445
+ // An exports file belongs to its owner's layer: production for the public barrel, development under review/.
446
+ return (adsFileRole(file) !== null && (adsFileRole(file) !== "exports" || isInside(path.join(dsRoot, "review"), file))) || isTestFile(file);
308
447
  }
309
448
 
310
449
  /** Review implementations may own demo presentation; scenarios/fixtures may not. */
311
450
  export function isReviewFile(file, { dsRoot }) {
312
- return !isDraftFile(file) && isInside(path.join(dsRoot, "review"), file) && adsFileRole(file) === null && !isTestFile(file) && !isScenarioFile(file) && !isFixtureFile(file) && !isBehaviorFile(file);
451
+ return !isDraftFile(file) && isInside(dsRoot, file) && adsFileRole(file) === "review" && !isTestFile(file);
313
452
  }
314
453
 
315
- const ignored = new Set(["node_modules", "dist", "dist-showcase", "dist-kit", ".git", ".vite", ".ds", "coverage"]);
454
+ const ignored = new Set(["node_modules", "dist", "dist-showcase", ".git", ".vite", ".ds", "coverage"]);
316
455
 
317
456
  export function sourceFiles(root) {
318
457
  if (!existsSync(root)) return [];
@@ -320,23 +459,28 @@ export function sourceFiles(root) {
320
459
  for (const entry of readdirSync(root, { withFileTypes: true })) {
321
460
  if (ignored.has(entry.name) || entry.isSymbolicLink() || isDraftFile(path.join(root, entry.name))) continue;
322
461
  const file = path.join(root, entry.name);
323
- if (entry.isDirectory()) { if (!hasProjectConfig(file)) files.push(...sourceFiles(file)); }
324
- else if (entry.isFile() && (/\.(css|html|[cm]?[jt]sx?)$/.test(entry.name) || isBehaviorFile(entry.name))) files.push(file);
462
+ if (entry.isDirectory()) {
463
+ if (!hasProjectConfig(file)) files.push(...sourceFiles(file));
464
+ } else if (entry.isFile() && /\.(css|html|[cm]?[jt]sx?)$/.test(entry.name)) files.push(file);
325
465
  }
326
466
  return files.sort();
327
467
  }
328
468
 
329
- export function importViolation(specifier, filename, options, resolve) {
330
- if (draftImportViolation(specifier, filename, resolve ?? ((id, file) => [path.resolve(path.dirname(file), id)]))) return true;
469
+ export async function importViolation(specifier, filename, options, resolve) {
470
+ if (await draftImportViolation(specifier, filename, resolve ?? ((id, file) => [path.resolve(path.dirname(file), id)]))) return true;
331
471
  const { root, dsRoot, config } = options;
332
472
  // ADS implementation code needs its private imports; the showcase is a consumer.
333
473
  if (isInside(dsRoot, filename) && (!isDevelopmentFile(filename, options) || isContractFile(filename))) return false; // Contract symbol ownership is checked without executing imports.
334
474
  if (specifier === `${config.publicAlias}/review`) return !isDevelopmentFile(filename, options) && !isTestFile(filename);
335
475
  if (specifier.startsWith(`${config.publicAlias}/`)) return true;
336
476
  if (specifier === config.publicAlias) return false;
337
- const imported = resolve ? resolve(specifier, filename)
338
- : specifier.startsWith(".") ? [path.resolve(path.dirname(filename), specifier)]
339
- : specifier.startsWith(`${config.dsDir}/`) ? [path.resolve(root, specifier)] : [];
477
+ const imported = resolve
478
+ ? await resolve(specifier, filename)
479
+ : specifier.startsWith(".")
480
+ ? [path.resolve(path.dirname(filename), specifier)]
481
+ : specifier.startsWith(`${config.dsDir}/`)
482
+ ? [path.resolve(root, specifier)]
483
+ : [];
340
484
  return imported.some((file) => {
341
485
  if (!isInside(dsRoot, file)) return false;
342
486
  // Previews may show the ADS's own artwork and fonts: asset files are data, not implementation.
@@ -346,7 +490,8 @@ export function importViolation(specifier, filename, options, resolve) {
346
490
  if (isReviewFile(filename, options)) return false;
347
491
  // Owner-local white-box tests may exercise private helpers without making
348
492
  // those helpers public API. Scenarios remain public-API consumers.
349
- if (isTestFile(filename) && isInside(dsRoot, filename) && options.testOwner?.(filename) && options.testOwner(filename) === options.testOwner(file)) return false;
493
+ if (isTestFile(filename) && isInside(dsRoot, filename) && options.testOwner?.(filename) && options.testOwner(filename) === options.testOwner(file))
494
+ return false;
350
495
  if (isDevelopmentFile(filename, options) && isDevelopmentFile(file, options)) return false;
351
496
  if (isTestFile(filename) && (isInside(path.join(dsRoot, "showcase"), file) || isTestFile(file))) return false;
352
497
  if (isInside(path.join(dsRoot, "showcase"), filename) && isInside(path.join(dsRoot, "showcase"), file)) return false;