@reqvire-org/ads 0.4.0 → 0.4.3

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 (410) hide show
  1. package/README.md +115 -87
  2. package/dist/a11y.mjs +133 -48
  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 +142 -0
  7. package/dist/analysis/impact.mjs +20 -0
  8. package/dist/analysis/inputs.mjs +22 -0
  9. package/dist/analysis/module-resolvers.mjs +46 -0
  10. package/dist/analysis/native-adapter.mjs +180 -0
  11. package/dist/analysis/native-project.mjs +323 -0
  12. package/dist/analysis/queries.mjs +133 -0
  13. package/dist/analysis/service.mjs +153 -0
  14. package/dist/analysis/standalone.mjs +57 -0
  15. package/dist/analysis/syntax.mjs +179 -0
  16. package/dist/analysis/worker.mjs +182 -0
  17. package/dist/assets.mjs +6 -6
  18. package/dist/atomic-composition.mjs +191 -70
  19. package/dist/atomic-trace.mjs +120 -50
  20. package/dist/behavior-libraries.mjs +106 -37
  21. package/dist/behaviors.mjs +219 -77
  22. package/dist/boundaries.mjs +140 -41
  23. package/dist/brand-assets.mjs +219 -47
  24. package/dist/brands.mjs +86 -27
  25. package/dist/bun-compiler.mjs +28 -14
  26. package/dist/bun-worker.mjs +7 -5
  27. package/dist/capture/worker.mjs +15 -4
  28. package/dist/capture-store.mjs +4 -2
  29. package/dist/capture.mjs +17 -14
  30. package/dist/check-service.mjs +44 -58
  31. package/dist/check.mjs +754 -188
  32. package/dist/cli.mjs +200 -99
  33. package/dist/color-values.mjs +21 -21
  34. package/dist/component-contrast.mjs +127 -9
  35. package/dist/config.mjs +303 -135
  36. package/dist/construction-styles.cjs +10 -0
  37. package/dist/contrast-composition.mjs +134 -0
  38. package/dist/control-padding.mjs +45 -25
  39. package/dist/css-values.mjs +3 -2
  40. package/dist/declarative-flow.mjs +209 -109
  41. package/dist/design-values.mjs +136 -51
  42. package/dist/development-runtime.mjs +4 -6
  43. package/dist/draft-boundary.mjs +11 -6
  44. package/dist/evidence.mjs +1 -1
  45. package/dist/finding-rules.mjs +9 -5
  46. package/dist/font-rules.mjs +22 -17
  47. package/dist/fonts-generated.mjs +23 -16
  48. package/dist/foundation-views.mjs +242 -0
  49. package/dist/foundation.mjs +63 -39
  50. package/dist/generated-entries.mjs +101 -34
  51. package/dist/icons.mjs +79 -32
  52. package/dist/image-attributes.mjs +143 -66
  53. package/dist/image-size.mjs +1 -1
  54. package/dist/index.mjs +0 -2
  55. package/dist/init.mjs +122 -41
  56. package/dist/investigations.mjs +2 -2
  57. package/dist/layers.mjs +298 -129
  58. package/dist/layout-widths.mjs +180 -85
  59. package/dist/linaria/preserve-values.cjs +7 -0
  60. package/dist/linaria/spatial-inputs.cjs +56 -0
  61. package/dist/lockup-composition.mjs +44 -0
  62. package/dist/lockup-model.cjs +64 -0
  63. package/dist/mcp/THIRD_PARTY_NOTICES.md +51 -1
  64. package/dist/mcp/apps.mjs +4 -30
  65. package/dist/mcp/behavior-pages.mjs +72 -24
  66. package/dist/mcp/build-status.mjs +257 -64
  67. package/dist/mcp/catalog.mjs +90 -26
  68. package/dist/mcp/context.mjs +17 -18
  69. package/dist/mcp/draft-discovery.mjs +44 -21
  70. package/dist/mcp/drafts.mjs +903 -281
  71. package/dist/mcp/execution-coordinator.mjs +417 -167
  72. package/dist/mcp/execution-results.mjs +7 -7
  73. package/dist/mcp/mutations.mjs +673 -234
  74. package/dist/mcp/preview-watch.mjs +448 -170
  75. package/dist/mcp/preview-widget.bundle.js +44 -50
  76. package/dist/mcp/prompts.mjs +5 -5
  77. package/dist/mcp/result-pages.mjs +1 -1
  78. package/dist/mcp/sandbox-host.mjs +1 -1
  79. package/dist/mcp/server.mjs +2409 -577
  80. package/dist/mcp/showcase-host.mjs +165 -41
  81. package/dist/mcp/skills.mjs +1 -1
  82. package/dist/mcp/text-diff.mjs +29 -10
  83. package/dist/paint-contracts.mjs +174 -81
  84. package/dist/palette-generated.mjs +2 -2
  85. package/dist/pictogram-model.mjs +59 -0
  86. package/dist/pictograms.mjs +52 -0
  87. package/dist/preview-bun.mjs +494 -187
  88. package/dist/preview-failure.mjs +1 -1
  89. package/dist/preview-files.mjs +13 -13
  90. package/dist/preview-imports.mjs +104 -55
  91. package/dist/preview-inputs.mjs +2 -2
  92. package/dist/preview-requests.mjs +24 -0
  93. package/dist/preview-resources.mjs +288 -147
  94. package/dist/preview-scope.mjs +5 -4
  95. package/dist/program-cache.mjs +8 -34
  96. package/dist/project-documents.mjs +1 -1
  97. package/dist/public-api.mjs +69 -31
  98. package/dist/public-props.mjs +39 -22
  99. package/dist/{browser-audit → render-audit}/axe-run.mjs +3 -3
  100. package/dist/{browser-audit → render-audit}/image-shape.mjs +15 -5
  101. package/dist/{browser-audit → render-audit}/layout-overflow.mjs +86 -23
  102. package/dist/{browser-audit → render-audit}/non-text-contrast.mjs +86 -27
  103. package/dist/render-audit/pictograms.mjs +88 -0
  104. package/dist/{browser-audit → render-audit}/render-states.mjs +208 -52
  105. package/dist/{browser-audit → render-audit}/worker.mjs +98 -30
  106. package/dist/render-audit.mjs +838 -0
  107. package/dist/render-color-probe.mjs +96 -42
  108. package/dist/render-composition.mjs +164 -0
  109. package/dist/resource-limits.mjs +229 -97
  110. package/dist/runtime-contracts.mjs +467 -185
  111. package/dist/scenario-groups.mjs +22 -10
  112. package/dist/scenario-inspector.mjs +6 -43
  113. package/dist/scenario-program.mjs +8 -25
  114. package/dist/scenario-registry.mjs +72 -30
  115. package/dist/scenario-selectors.mjs +161 -64
  116. package/dist/scenario-slots.mjs +149 -56
  117. package/dist/scenario-trace.mjs +215 -109
  118. package/dist/scenarios-compiler.mjs +719 -378
  119. package/dist/scenarios-vite.d.mts +1 -3
  120. package/dist/scenarios-vite.mjs +2 -81
  121. package/dist/scenarios.mjs +421 -157
  122. package/dist/selector-match.mjs +2 -2
  123. package/dist/showcase/client.bundle.js +57 -56
  124. package/dist/showcase/draft-navigation.js +21 -3
  125. package/dist/showcase/favicon.ico +0 -0
  126. package/dist/showcase/favicon.svg +1 -0
  127. package/dist/showcase/foundation-view.css +58 -0
  128. package/dist/showcase/foundation-view.mjs +255 -0
  129. package/dist/showcase/guide-controls.ads.review.mjs +32 -0
  130. package/dist/showcase/icons.js +1 -145
  131. package/dist/showcase/index.html +3 -31
  132. package/dist/showcase/pictogram-view.mjs +53 -0
  133. package/dist/showcase/preview-frame.ads.review.css +46 -0
  134. package/dist/showcase/preview-frame.ads.review.d.mts +11 -0
  135. package/dist/showcase/preview-frame.ads.review.mjs +22 -0
  136. package/dist/showcase/preview-state.js +0 -9
  137. package/dist/showcase/refresh-scheduler.js +23 -0
  138. package/dist/showcase/style.css +5 -47
  139. package/dist/showcase/ui/ui.css +1353 -0
  140. package/dist/showcase/ui/ui.js +1064 -0
  141. package/dist/showcase-coverage.mjs +58 -37
  142. package/dist/skills/README.md +24 -23
  143. package/dist/skills/ads-designer/README.md +8 -2
  144. package/dist/skills/ads-designer/SKILL.md +143 -120
  145. package/dist/skills/ads-designer/references/accessibility.md +78 -15
  146. package/dist/skills/ads-designer/references/atomic-styles.md +4 -4
  147. package/dist/skills/ads-designer/references/behaviors.md +30 -27
  148. package/dist/skills/ads-designer/references/branding.md +101 -24
  149. package/dist/skills/ads-designer/references/captures.md +25 -0
  150. package/dist/skills/ads-designer/references/cli.md +21 -24
  151. package/dist/skills/ads-designer/references/contracts.md +7 -6
  152. package/dist/skills/ads-designer/references/design-data.md +49 -52
  153. package/dist/skills/ads-designer/references/drafts.md +20 -17
  154. package/dist/skills/ads-designer/references/evidence.md +1 -5
  155. package/dist/skills/ads-designer/references/guarded-editing.md +14 -18
  156. package/dist/skills/ads-designer/references/layers.md +1 -1
  157. package/dist/skills/ads-designer/references/layout.md +347 -0
  158. package/dist/skills/ads-designer/references/mobile.md +2 -1
  159. package/dist/skills/{ads-motion/references/performance.md → ads-designer/references/motion-performance.md} +5 -1
  160. package/dist/skills/{ads-motion/references/build.md → ads-designer/references/motion.md} +73 -5
  161. package/dist/skills/ads-designer/references/performance.md +3 -2
  162. package/dist/skills/ads-designer/references/pictograms.md +131 -0
  163. package/dist/skills/ads-designer/references/review.md +37 -34
  164. package/dist/skills/ads-designer/references/runtimes.md +33 -30
  165. package/dist/skills/ads-designer/references/scenarios.md +16 -18
  166. package/dist/skills/{ads-break-ui/references/catalog.md → ads-designer/references/stress-catalog.md} +3 -1
  167. package/dist/skills/ads-designer/references/stress-test.md +68 -0
  168. package/dist/skills/ads-designer/references/validation.md +83 -75
  169. package/dist/skills/ads-designer/references/workflows.md +8 -33
  170. package/dist/skills/ads-import/SKILL.md +43 -325
  171. package/dist/skills/ads-import/references/atomic-styles.md +4 -4
  172. package/dist/skills/ads-import/references/behaviors.md +30 -27
  173. package/dist/skills/ads-import/references/branding.md +5 -5
  174. package/dist/skills/ads-import/references/captures.md +25 -0
  175. package/dist/skills/ads-import/references/cli.md +21 -24
  176. package/dist/skills/ads-import/references/compatibility.md +1 -1
  177. package/dist/skills/ads-import/references/contracts.md +7 -6
  178. package/dist/skills/ads-import/references/design-data.md +49 -52
  179. package/dist/skills/ads-import/references/drafts.md +20 -17
  180. package/dist/skills/ads-import/references/evidence.md +1 -5
  181. package/dist/skills/ads-import/references/guarded-editing.md +14 -18
  182. package/dist/skills/ads-import/references/implementation.md +2 -1
  183. package/dist/skills/ads-import/references/layers.md +1 -1
  184. package/dist/skills/ads-import/references/layout.md +347 -0
  185. package/dist/skills/ads-import/references/review.md +37 -34
  186. package/dist/skills/ads-import/references/runtimes.md +33 -30
  187. package/dist/skills/ads-import/references/scenarios.md +16 -18
  188. package/dist/skills/ads-import/references/tokens.md +3 -3
  189. package/dist/skills/ads-import/references/validation.md +83 -75
  190. package/dist/skills/ads-import/references/workflows.md +8 -33
  191. package/dist/skills/ads-migrate/SKILL.md +56 -0
  192. package/dist/skills/ads-migrate/references/0.4.1-to-0.4.2.md +602 -0
  193. package/dist/skills/ads-port/SKILL.md +58 -344
  194. package/dist/skills/ads-port/references/atomic-styles.md +4 -4
  195. package/dist/skills/ads-port/references/behaviors.md +30 -27
  196. package/dist/skills/ads-port/references/captures.md +25 -0
  197. package/dist/skills/ads-port/references/cli.md +21 -24
  198. package/dist/skills/ads-port/references/contracts.md +7 -6
  199. package/dist/skills/ads-port/references/design-data.md +49 -52
  200. package/dist/skills/ads-port/references/drafts.md +20 -17
  201. package/dist/skills/ads-port/references/evidence.md +1 -5
  202. package/dist/skills/ads-port/references/guarded-editing.md +14 -18
  203. package/dist/skills/ads-port/references/layers.md +1 -1
  204. package/dist/skills/ads-port/references/layout.md +347 -0
  205. package/dist/skills/ads-port/references/lint-and-docs.md +8 -11
  206. package/dist/skills/ads-port/references/native-implementation.md +2 -1
  207. package/dist/skills/ads-port/references/review.md +37 -34
  208. package/dist/skills/ads-port/references/runtimes.md +33 -30
  209. package/dist/skills/ads-port/references/scenarios.md +16 -18
  210. package/dist/skills/ads-port/references/validation.md +83 -75
  211. package/dist/skills/ads-port/references/workflows.md +8 -33
  212. package/dist/source-symbols.mjs +1 -8
  213. package/dist/source-values.mjs +270 -129
  214. package/dist/spatial-composition.mjs +322 -0
  215. package/dist/spatial-contexts.cjs +56 -0
  216. package/dist/spatial-css.cjs +351 -0
  217. package/dist/spatial-inputs.cjs +80 -0
  218. package/dist/spatial-metadata.mjs +18 -0
  219. package/dist/spatial-model.cjs +322 -0
  220. package/dist/spatial.mjs +21 -0
  221. package/dist/stage-timing.cjs +20 -0
  222. package/dist/starters/preact/design-system/patterns/Conversation/Conversation.tsx +105 -0
  223. package/dist/starters/preact/design-system/patterns/Shell/Shell.tsx +275 -0
  224. package/dist/starters/preact/design-system/review/demo-frame/DemoFrame.ads.review.tsx +7 -0
  225. package/dist/starters/preact/design-system/review/screen-frame/ScreenFrame.ads.review.tsx +10 -0
  226. package/dist/starters/preact/design-system/showcase/mcp/main.ads.mount.tsx +8 -0
  227. package/dist/starters/preact/ds.config.json +25 -6
  228. package/dist/starters/preact/package.json +4 -8
  229. package/dist/starters/preact/tsconfig.json +4 -5
  230. package/dist/starters/preact/vite.config.ts +3 -3
  231. package/dist/starters/react/ADS.md +42 -47
  232. package/dist/starters/react/README.md +47 -49
  233. package/dist/starters/react/design-system/assets/pictograms/catalog.ads.json +13 -0
  234. package/dist/starters/react/design-system/assets/pictograms/journey.dark.svg +7 -0
  235. package/dist/starters/react/design-system/assets/pictograms/journey.svg +7 -0
  236. package/dist/starters/react/design-system/components/Actions/IconButton/IconButton.tsx +18 -2
  237. package/dist/starters/react/design-system/components/Actions/IconButton/README.md +3 -0
  238. package/dist/starters/react/design-system/components/Content/Pictogram/Pictogram.ads.exports.ts +1 -0
  239. package/dist/starters/react/design-system/components/Content/Pictogram/Pictogram.ads.fixture.ts +1 -0
  240. package/dist/starters/react/design-system/components/Content/Pictogram/Pictogram.ads.scenario.tsx +7 -0
  241. package/dist/starters/react/design-system/components/Content/Pictogram/Pictogram.tsx +26 -0
  242. package/dist/starters/react/design-system/composition/Workspace/WorkspacePage/README.md +5 -0
  243. package/dist/starters/react/design-system/composition/Workspace/WorkspacePage/WorkspacePage.ads.fixture.ts +13 -0
  244. package/dist/starters/react/design-system/composition/Workspace/WorkspacePage/WorkspacePage.ads.scenario.tsx +22 -0
  245. package/dist/starters/react/design-system/index.ts +2 -1
  246. package/dist/starters/react/design-system/patterns/Conversation/Conversation.ads.exports.ts +1 -0
  247. package/dist/starters/react/design-system/patterns/Conversation/Conversation.ads.fixture.ts +7 -0
  248. package/dist/starters/react/design-system/patterns/Conversation/Conversation.ads.scenario.tsx +15 -0
  249. package/dist/starters/react/design-system/patterns/Conversation/Conversation.tsx +105 -0
  250. package/dist/starters/react/design-system/patterns/Conversation/README.md +9 -0
  251. package/dist/starters/react/design-system/patterns/Shell/Floating.ads.fixture.ts +5 -0
  252. package/dist/starters/react/design-system/patterns/Shell/Floating.ads.scenario.tsx +21 -0
  253. package/dist/starters/react/design-system/patterns/Shell/README.md +43 -0
  254. package/dist/starters/react/design-system/patterns/Shell/Shell.ads.exports.ts +1 -0
  255. package/dist/starters/react/design-system/patterns/Shell/Shell.ads.fixture.ts +5 -0
  256. package/dist/starters/react/design-system/patterns/Shell/Shell.ads.scenario.tsx +21 -0
  257. package/dist/starters/react/design-system/patterns/Shell/Shell.tsx +274 -0
  258. package/dist/starters/react/design-system/review/demo-frame/DemoFrame.ads.exports.ts +1 -1
  259. package/dist/starters/react/design-system/review/demo-frame/DemoFrame.ads.review.tsx +7 -0
  260. package/dist/starters/react/design-system/review/index.ads.review.ts +4 -0
  261. package/dist/starters/react/design-system/review/region-block/RegionBlock.ads.exports.ts +1 -0
  262. package/dist/starters/react/design-system/review/region-block/RegionBlock.ads.review.tsx +6 -0
  263. package/dist/starters/react/design-system/review/screen-frame/ScreenFrame.ads.exports.ts +1 -1
  264. package/dist/starters/react/design-system/review/screen-frame/ScreenFrame.ads.review.tsx +10 -0
  265. package/dist/starters/react/design-system/showcase/mcp/{main.tsx → main.ads.mount.tsx} +4 -2
  266. package/dist/starters/react/design-system/tokens/catalog.ads.json +1221 -0
  267. package/dist/starters/react/design-system/tokens/colors.css +1 -1
  268. package/dist/starters/react/design-system/tokens/spacing.css +22 -32
  269. package/dist/starters/react/design-system/tokens/spatial.ads.json +70 -0
  270. package/dist/starters/react/design-system/tokens/themes.generated.ts +1 -1
  271. package/dist/starters/react/ds.config.json +25 -6
  272. package/dist/starters/react/package.json +2 -6
  273. package/dist/starters/react/tsconfig.json +2 -3
  274. package/dist/starters/react/vite.config.ts +3 -3
  275. package/dist/style-boundaries.mjs +70 -25
  276. package/dist/task-cache.mjs +173 -72
  277. package/dist/task-worker.mjs +22 -11
  278. package/dist/test-boundaries.mjs +132 -59
  279. package/dist/themes-generated.mjs +1 -1
  280. package/dist/themes-watch.mjs +57 -22
  281. package/dist/themes.mjs +176 -73
  282. package/dist/token-export.mjs +39 -14
  283. package/dist/token-policy.mjs +6 -3
  284. package/dist/token-quality.mjs +6 -6
  285. package/dist/token-samples.mjs +16 -5
  286. package/dist/tokens.mjs +71 -26
  287. package/dist/ui-framework.mjs +16 -14
  288. package/dist/unit-contracts.mjs +251 -104
  289. package/dist/units.mjs +209 -99
  290. package/dist/usage.mjs +138 -38
  291. package/dist/validation-checks.mjs +115 -38
  292. package/dist/validation-inputs.mjs +191 -78
  293. package/dist/validation.mjs +268 -102
  294. package/dist/verification/browser.mjs +27 -5
  295. package/dist/verification.mjs +711 -187
  296. package/docs/ADS.md +96 -80
  297. package/docs/ARCHITECTURE.md +368 -137
  298. package/docs/BEHAVIORS.md +29 -25
  299. package/docs/CACHING.md +77 -17
  300. package/docs/CHANGELOG.md +332 -17
  301. package/docs/CONTRACTS.md +12 -4
  302. package/docs/DESIGN-REFERENCES.md +40 -0
  303. package/docs/GUIDE.md +300 -263
  304. package/docs/MCP.md +187 -324
  305. package/docs/SPATIAL-CHECKS.md +69 -0
  306. package/docs/benchmarks/README.md +39 -0
  307. package/package.json +43 -34
  308. package/dist/browser-audit.mjs +0 -429
  309. package/dist/create.mjs +0 -48
  310. package/dist/lint-config.mjs +0 -50
  311. package/dist/mcp/project-widget.bundle.js +0 -114
  312. package/dist/mcp/reports.mjs +0 -101
  313. package/dist/mcp/widget.bundle.js +0 -147
  314. package/dist/oxlint.mjs +0 -89
  315. package/dist/preview-builder.mjs +0 -133
  316. package/dist/preview-workers.mjs +0 -184
  317. package/dist/showcase.mjs +0 -77
  318. package/dist/skills/ads-break-ui/LICENSE.upstream +0 -21
  319. package/dist/skills/ads-break-ui/README.md +0 -16
  320. package/dist/skills/ads-break-ui/SKILL.md +0 -412
  321. package/dist/skills/ads-break-ui/agents/openai.yaml +0 -4
  322. package/dist/skills/ads-break-ui/references/atomic-styles.md +0 -293
  323. package/dist/skills/ads-break-ui/references/behaviors.md +0 -412
  324. package/dist/skills/ads-break-ui/references/captures.md +0 -135
  325. package/dist/skills/ads-break-ui/references/contracts.md +0 -317
  326. package/dist/skills/ads-break-ui/references/design-data.md +0 -354
  327. package/dist/skills/ads-break-ui/references/drafts.md +0 -194
  328. package/dist/skills/ads-break-ui/references/evidence.md +0 -128
  329. package/dist/skills/ads-break-ui/references/guarded-editing.md +0 -165
  330. package/dist/skills/ads-break-ui/references/layers.md +0 -145
  331. package/dist/skills/ads-break-ui/references/reporting.md +0 -101
  332. package/dist/skills/ads-break-ui/references/review.md +0 -97
  333. package/dist/skills/ads-break-ui/references/runtimes.md +0 -203
  334. package/dist/skills/ads-break-ui/references/scenarios.md +0 -246
  335. package/dist/skills/ads-break-ui/references/validation.md +0 -166
  336. package/dist/skills/ads-break-ui/references/verification.md +0 -58
  337. package/dist/skills/ads-break-ui/references/workflows.md +0 -90
  338. package/dist/skills/ads-designer/references/reporting.md +0 -101
  339. package/dist/skills/ads-import/references/reporting.md +0 -101
  340. package/dist/skills/ads-motion/LICENSE.upstream +0 -21
  341. package/dist/skills/ads-motion/README.md +0 -22
  342. package/dist/skills/ads-motion/SKILL.md +0 -385
  343. package/dist/skills/ads-motion/agents/openai.yaml +0 -4
  344. package/dist/skills/ads-motion/references/atomic-styles.md +0 -293
  345. package/dist/skills/ads-motion/references/audit.md +0 -44
  346. package/dist/skills/ads-motion/references/behaviors.md +0 -412
  347. package/dist/skills/ads-motion/references/captures.md +0 -135
  348. package/dist/skills/ads-motion/references/contracts.md +0 -317
  349. package/dist/skills/ads-motion/references/design-data.md +0 -354
  350. package/dist/skills/ads-motion/references/drafts.md +0 -194
  351. package/dist/skills/ads-motion/references/evidence.md +0 -128
  352. package/dist/skills/ads-motion/references/guarded-editing.md +0 -165
  353. package/dist/skills/ads-motion/references/layers.md +0 -145
  354. package/dist/skills/ads-motion/references/motion-review.md +0 -35
  355. package/dist/skills/ads-motion/references/reporting.md +0 -101
  356. package/dist/skills/ads-motion/references/review.md +0 -97
  357. package/dist/skills/ads-motion/references/runtimes.md +0 -203
  358. package/dist/skills/ads-motion/references/scenarios.md +0 -246
  359. package/dist/skills/ads-motion/references/validation.md +0 -166
  360. package/dist/skills/ads-motion/references/verification.md +0 -39
  361. package/dist/skills/ads-motion/references/workflows.md +0 -90
  362. package/dist/skills/ads-port/references/reporting.md +0 -101
  363. package/dist/starters/preact/design-system/components/Layout/Grid/Grid.ads.contract.ts +0 -6
  364. package/dist/starters/preact/design-system/components/Layout/Grid/Grid.tsx +0 -76
  365. package/dist/starters/preact/design-system/review/demo-frame/DemoFrame.tsx +0 -29
  366. package/dist/starters/preact/design-system/review/screen-frame/ScreenFrame.tsx +0 -34
  367. package/dist/starters/preact/design-system/review/token-preview/TokenPreview.ads.contract.ts +0 -6
  368. package/dist/starters/preact/design-system/review/token-preview/TokenPreview.tsx +0 -137
  369. package/dist/starters/preact/design-system/showcase/mcp/main.tsx +0 -6
  370. package/dist/starters/react/design-system/brand/Icons/AppIcon/AppIcon.ads.fixture.ts +0 -7
  371. package/dist/starters/react/design-system/brand/Icons/AppIcon/AppIcon.ads.scenario.tsx +0 -4
  372. package/dist/starters/react/design-system/brand/Identity/Logo/Logo.ads.fixture.ts +0 -7
  373. package/dist/starters/react/design-system/brand/Identity/Logo/Logo.ads.scenario.tsx +0 -4
  374. package/dist/starters/react/design-system/components/Layout/Grid/Grid.ads.contract.ts +0 -6
  375. package/dist/starters/react/design-system/components/Layout/Grid/Grid.ads.exports.ts +0 -1
  376. package/dist/starters/react/design-system/components/Layout/Grid/Grid.ads.fixture.ts +0 -12
  377. package/dist/starters/react/design-system/components/Layout/Grid/Grid.ads.scenario.tsx +0 -17
  378. package/dist/starters/react/design-system/components/Layout/Grid/Grid.tsx +0 -75
  379. package/dist/starters/react/design-system/components/Layout/Grid/README.md +0 -21
  380. package/dist/starters/react/design-system/review/brand-preview/BrandPreview.ads.exports.ts +0 -1
  381. package/dist/starters/react/design-system/review/brand-preview/BrandPreview.tsx +0 -112
  382. package/dist/starters/react/design-system/review/demo-frame/DemoFrame.tsx +0 -29
  383. package/dist/starters/react/design-system/review/grid-cell/GridCell.ads.exports.ts +0 -1
  384. package/dist/starters/react/design-system/review/grid-cell/GridCell.tsx +0 -18
  385. package/dist/starters/react/design-system/review/index.ts +0 -6
  386. package/dist/starters/react/design-system/review/screen-frame/ScreenFrame.tsx +0 -34
  387. package/dist/starters/react/design-system/review/token-preview/TokenPreview.ads.contract.ts +0 -6
  388. package/dist/starters/react/design-system/review/token-preview/TokenPreview.ads.exports.ts +0 -1
  389. package/dist/starters/react/design-system/review/token-preview/TokenPreview.tsx +0 -137
  390. package/dist/starters/react/design-system/showcase/mcp/index.html +0 -1
  391. package/dist/starters/react/design-system/tokens/Color.ads.fixture.ts +0 -124
  392. package/dist/starters/react/design-system/tokens/Color.ads.scenario.tsx +0 -4
  393. package/dist/starters/react/design-system/tokens/Layout.ads.fixture.ts +0 -39
  394. package/dist/starters/react/design-system/tokens/Layout.ads.scenario.tsx +0 -4
  395. package/dist/starters/react/design-system/tokens/Motion.ads.fixture.ts +0 -18
  396. package/dist/starters/react/design-system/tokens/Motion.ads.scenario.tsx +0 -4
  397. package/dist/starters/react/design-system/tokens/Shape.ads.fixture.ts +0 -30
  398. package/dist/starters/react/design-system/tokens/Shape.ads.scenario.tsx +0 -4
  399. package/dist/starters/react/design-system/tokens/Space.ads.fixture.ts +0 -37
  400. package/dist/starters/react/design-system/tokens/Space.ads.scenario.tsx +0 -4
  401. package/dist/starters/react/design-system/tokens/Type.ads.fixture.ts +0 -29
  402. package/dist/starters/react/design-system/tokens/Type.ads.scenario.tsx +0 -4
  403. package/dist/starters/react/package-lock.json +0 -4707
  404. package/dist/token-fixtures.mjs +0 -30
  405. package/docs/benchmarks/bun-previews.md +0 -91
  406. package/docs/benchmarks/preview-memory.md +0 -147
  407. package/docs/benchmarks/turbo-poc.md +0 -284
  408. package/docs/plans/execution-coordination.md +0 -57
  409. /package/dist/{browser-audit → render-audit}/first-render.mjs +0 -0
  410. /package/dist/{browser-audit → render-audit}/layout-shift.mjs +0 -0
package/dist/config.mjs CHANGED
@@ -1,13 +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
5
  import { defaultThemes, validateThemes } from "./themes.mjs";
7
6
  import { validateBrands } from "./brands.mjs";
8
7
 
9
8
  export const supportedFrameworks = ["react", "preact"];
10
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
+
11
19
  export const defaultConfig = {
12
20
  schemaVersion: 1,
13
21
  framework: null,
@@ -15,24 +23,39 @@ export const defaultConfig = {
15
23
  usage: { notifications: [], restrictedImports: [] },
16
24
  sourceDir: "src",
17
25
  dsDir: "design-system",
18
- publicAlias: "@ds",
19
- publicEntry: "index.ts",
20
- reviewEntry: "review/index.ts",
21
- stylesEntry: "styles.css",
22
- tokenDir: "tokens",
23
26
  themes: defaultThemes,
24
27
  // Optional brand axis beside the themes; empty means one brand.
25
28
  brands: [],
26
29
  // With no data-theme on the root, the OS color scheme picks the first theme of that scheme.
27
30
  followSystemTheme: false,
28
- assets: { publicDirs: ["public/assets"], generatedPaths: ["dist", "dist-showcase", ".vite", ".ds"], generatedFiles: [], iconSource: null, targets: [], glyphs: null, imageBudgetKb: null, fontBudgetKb: null, preloadFonts: null },
29
- oxlint: { plugins: [], rules: {}, overrides: [] },
30
- acceptance: { checks: [], behaviorChecks: false, browserAudit: "owners" },
31
- 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: [] },
32
47
  resources: { memoryLimitMb: null },
33
48
  // Width tokens and owners allowed fixed widths; see src/layout-widths.mjs.
34
49
  layout: { widthTokens: [], fixedWidthUnits: [] },
35
- mcp: { showcaseUrl: null, showcaseTitle: null, apps: [], previewWatch: null, previewManifest: null, mutationCheckTimeoutMs: 60000, previewBuildTimeoutMs: 300000, auditPages: 4, 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
+ },
36
59
  };
37
60
 
38
61
  export function isInside(parent, file) {
@@ -53,29 +76,42 @@ function validateBrandTargets(targets, { root, dsRoot }) {
53
76
  for (const [index, target] of targets.entries()) {
54
77
  const field = `assets.targets[${index}]`;
55
78
  if (!target || typeof target !== "object" || Array.isArray(target)) throw new Error(`${field} must be an object.`);
56
- 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));
57
80
  if (unknown.length) throw new Error(`${field} has unknown keys: ${unknown.join(", ")}.`);
58
81
  const source = projectPath(dsRoot, target.from, `${field}.from`);
59
82
  const sourceFormat = path.extname(source).toLowerCase();
60
- 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(", ")}).`);
61
85
  const output = projectPath(root, target.to, `${field}.to`);
62
- 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/.`);
63
88
  if (outputs.has(output)) throw new Error(`${field}.to repeats an earlier target's output.`);
64
89
  outputs.add(output);
65
90
  const format = path.extname(output).toLowerCase();
66
- const sized = sizeKeys.some(key => key in target);
91
+ const sized = sizeKeys.some((key) => key in target);
67
92
  // The same format without sizes is a copy of the supplied file.
68
93
  if (!sized && format === sourceFormat) continue;
69
94
  if (format === ".svg") throw new Error(`${field} copies an SVG master to .svg; it takes no sizes.`);
70
- if (!renderableFormats.includes(sourceFormat)) throw new Error(`${field} copies the finished ${sourceFormat} file; give it the same extension and no sizes.`);
71
- const pixels = value => Number.isInteger(value) && value >= 1 && value <= 4096;
72
- 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.`);
73
100
  if (format === ".png") {
74
- const square = target.size !== undefined, rectangle = target.width !== undefined || target.height !== undefined;
75
- 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.`);
76
105
  } else if (format === ".ico" || format === ".icns") {
77
106
  const allowed = format === ".ico" ? [16, 24, 32, 48, 64, 128, 256] : iconSizes;
78
- 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(", ")}.`);
79
115
  } else throw new Error(`${field}.to must end in .svg, .png, .ico or .icns, or keep the supplied file's extension.`);
80
116
  }
81
117
  }
@@ -83,14 +119,22 @@ function validateBrandTargets(targets, { root, dsRoot }) {
83
119
  function validateGlyphs(glyphs, { dsRoot }) {
84
120
  if (glyphs === null) return;
85
121
  if (!glyphs || typeof glyphs !== "object" || Array.isArray(glyphs)) throw new Error("assets.glyphs must be an object or null.");
86
- 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));
87
123
  if (unknown.length) throw new Error(`assets.glyphs has unknown keys: ${unknown.join(", ")}.`);
88
124
  const source = projectPath(dsRoot, glyphs.source, "assets.glyphs.source");
89
- 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.");
90
127
  const output = projectPath(dsRoot, glyphs.output, "assets.glyphs.output");
91
- 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/.");
92
130
  const attributes = glyphs.attributes ?? {};
93
- 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.");
94
138
  }
95
139
 
96
140
  export function projectPath(root, value, field) {
@@ -102,70 +146,171 @@ export function projectPath(root, value, field) {
102
146
  return absolute;
103
147
  }
104
148
 
149
+ /** Where ADS publishes the verified preview graph, relative to the project root. */
150
+ export const PREVIEW_MANIFEST = ".ds/preview/manifest.json";
151
+
105
152
  export function loadConfig(directory = process.cwd()) {
106
153
  const root = path.resolve(directory);
107
154
  const configFile = path.join(root, "ds.config.json");
108
155
  const user = existsSync(configFile) ? JSON.parse(readFileSync(configFile, "utf8")) : {};
109
156
  if (!user || typeof user !== "object" || Array.isArray(user)) throw new Error("ds.config.json must be an object.");
110
- 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.");
111
157
  for (const field of Object.keys(user)) {
112
158
  if (!(field in defaultConfig)) throw new Error(`Unknown ADS configuration field: ${field}`);
113
159
  }
114
- if (user.oxlint !== undefined && (!user.oxlint || typeof user.oxlint !== "object" || Array.isArray(user.oxlint))) throw new Error("oxlint must be an object.");
115
- for (const field of ["assets", "oxlint", "mcp", "acceptance", "validation", "usage", "resources", "layout"]) {
116
- if (user[field] !== undefined && (!user[field] || typeof user[field] !== "object" || Array.isArray(user[field]))) throw new Error(`${field} must be an object.`);
117
- 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
+ }
118
167
  }
119
- const config = { ...defaultConfig, ...user, 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
+ };
120
180
  validateThemes(config.themes);
121
181
  validateBrands(config.brands);
122
182
  if (typeof config.followSystemTheme !== "boolean") throw new Error("followSystemTheme must be true or false.");
123
183
  if (config.followSystemTheme) {
124
184
  const other = config.themes[0].scheme === "dark" ? "light" : "dark";
125
- 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}.`);
126
186
  }
127
- 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.`);
128
- 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.");
129
- 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.");
130
- 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 }.');
131
- 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.");
132
- 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.");
133
- 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.");
134
- 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.");
135
242
  const notificationNames = new Set();
136
243
  for (const entry of config.usage.notifications) {
137
- 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.");
138
- if (notificationNames.has(entry.api) || notificationNames.has(entry.host) || entry.api === entry.host) throw new Error("Notification API and host registrations must be distinct.");
139
- notificationNames.add(entry.api); notificationNames.add(entry.host);
140
- 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.");
141
258
  for (const file of entry.rootFiles) {
142
259
  projectPath(root, file, "usage.notifications.rootFiles");
143
- 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.");
144
266
  }
145
267
  }
146
- 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.");
147
- for (const name of ["acceptance","validation"]) {
148
- const policy=config[name];
149
- 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.`);
150
- if(typeof policy.behaviorChecks!=="boolean")throw new Error(`${name}.behaviorChecks must be a boolean.`);
151
- // Acceptance audits the draft's own owners, or everything they affect; the validation stage audits fully.
152
- if(name==="acceptance"?!["owners","affected",false].includes(policy.browserAudit):typeof policy.browserAudit!=="boolean")throw new Error(name==="acceptance"?'acceptance.browserAudit must be "owners" (the draft owners\' own scenarios), "affected" (every scenario they reach) or false.':`${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.`);
153
284
  }
154
- 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.");
155
294
  for (const file of config.validation.inputs) {
156
- const absolute = projectPath(root,file,"validation.inputs");
157
- 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.");
158
302
  }
159
303
  if (config.schemaVersion !== 1) throw new Error(`Unsupported ADS config version: ${config.schemaVersion}`);
160
304
  if (user.framework !== undefined && !supportedFrameworks.includes(user.framework)) throw new Error("framework must be react or preact.");
161
- if (!Array.isArray(config.behaviorLibraries) || config.behaviorLibraries.length > 100
162
- || new Set(config.behaviorLibraries).size !== config.behaviorLibraries.length
163
- || 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.");
164
- if (typeof config.publicAlias !== "string" || !config.publicAlias.trim()) throw new Error("publicAlias must be a non-empty string.");
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.");
165
312
  const sourceRoot = projectPath(root, config.sourceDir, "sourceDir");
166
313
  const dsRoot = projectPath(root, config.dsDir, "dsDir");
167
- for (const field of ["publicEntry", "reviewEntry", "stylesEntry", "tokenDir"]) projectPath(dsRoot, config[field], field);
168
- 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.");
169
314
  for (const field of ["publicDirs", "generatedPaths", "generatedFiles"]) {
170
315
  if (!Array.isArray(config.assets[field])) throw new Error(`assets.${field} must be an array.`);
171
316
  for (const entry of config.assets[field]) {
@@ -174,75 +319,90 @@ export function loadConfig(directory = process.cwd()) {
174
319
  if (absolute === base) throw new Error(`assets.${field} must name a path below its root.`);
175
320
  }
176
321
  }
177
- if (!Array.isArray(config.oxlint.plugins) || !config.oxlint.rules || typeof config.oxlint.rules !== "object" || Array.isArray(config.oxlint.rules)) {
178
- throw new Error("oxlint requires plugins (array) and rules (object).");
179
- }
180
- if (!Array.isArray(config.oxlint.overrides)) throw new Error("oxlint.overrides must be an array.");
181
- for (const override of config.oxlint.overrides) {
182
- 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.");
183
- 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.");
184
- if (!override.rules || typeof override.rules !== "object" || Array.isArray(override.rules)) throw new Error("oxlint.overrides.rules must be an object.");
185
- }
186
322
  if (config.assets.iconSource !== null) {
187
323
  const source = projectPath(dsRoot, config.assets.iconSource, "assets.iconSource");
188
- 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.");
189
326
  }
190
327
  validateBrandTargets(config.assets.targets, { root, dsRoot });
191
328
  validateGlyphs(config.assets.glyphs, { dsRoot });
192
- for (const plugin of config.oxlint.plugins) {
193
- if (!plugin || Object.keys(plugin).some((key) => !["name", "path"].includes(key)) || typeof plugin.name !== "string" || !plugin.name || typeof plugin.path !== "string") {
194
- throw new Error("Each project Oxlint plugin needs a name and a relative path.");
195
- }
196
- projectPath(root, plugin.path, "oxlint.plugins.path");
197
- }
198
- if (config.mcp.showcaseUrl !== null) {
199
- let url;
200
- try { url = new URL(config.mcp.showcaseUrl); } catch { throw new Error("mcp.showcaseUrl must be an http(s) URL or null."); }
201
- if (!["http:", "https:"].includes(url.protocol) || url.username || url.password) throw new Error("mcp.showcaseUrl must be an http(s) URL without credentials.");
202
- }
203
- 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.");
204
- 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.");
205
334
  const capture = config.mcp.capture;
206
- if (!capture || typeof capture !== "object" || Array.isArray(capture) || Object.keys(capture).some(key => !["browser", "channel", "timeoutMs"].includes(key))
207
- || !["chromium", "firefox", "webkit"].includes(capture.browser ?? "chromium")
208
- || capture.channel !== undefined && (typeof capture.channel !== "string" || !/^[\w-]{1,60}$/.test(capture.channel) || ![undefined, "chromium"].includes(capture.browser))
209
- || 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.");
210
- 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.");
211
355
  for (const [name, profile] of Object.entries(config.mcp.behaviorProfiles)) {
212
- if (!/^[a-zA-Z0-9][\w.-]{0,79}$/.test(name) || !profile || typeof profile !== "object" || Array.isArray(profile)
213
- || Object.keys(profile).some(key => !["command", "args", "timeoutMs", "runner", "framework", "mode"].includes(key))
214
- || typeof profile.command !== "string" || !profile.command.trim() || profile.command.includes("\0")
215
- || !Array.isArray(profile.args) || profile.args.some(arg => typeof arg !== "string" || arg.includes("\0"))
216
- || !["protocol", "playwright"].includes(profile.runner ?? "protocol")
217
- || profile.framework !== undefined && profile.framework !== config.framework
218
- || profile.mode !== undefined && !["browser", "strict", "unit"].includes(profile.mode)
219
- || 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.`);
220
- 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.`);
221
- }
222
- const retention={...defaultConfig.mcp.resultRetention,...config.mcp.resultRetention};
223
- 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).");
224
- config.mcp.resultRetention=retention;
225
- 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.");
226
- if (!Number.isInteger(config.mcp.auditPages) || config.mcp.auditPages < 1 || config.mcp.auditPages > 16) throw new Error("mcp.auditPages must be an integer from 1 to 16: how many pages the browser audit renders at once.");
227
- if (!Number.isInteger(config.mcp.previewBuildTimeoutMs) || config.mcp.previewBuildTimeoutMs < 1000 || config.mcp.previewBuildTimeoutMs > 3600000) throw new Error("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.");
228
- if (config.mcp.previewManifest !== null) {
229
- const manifest = projectPath(root, config.mcp.previewManifest, "mcp.previewManifest");
230
- if (!isInside(path.join(root, ".ds"), manifest) || path.extname(manifest) !== ".json") throw new Error("mcp.previewManifest must name a generated JSON manifest inside .ds/.");
231
- }
232
- if (config.mcp.previewWatch !== null && config.mcp.previewWatch !== false) {
233
- const watch = config.mcp.previewWatch;
234
- 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).");
235
- }
236
- if(config.framework&&config.mcp.previewManifest&&config.mcp.previewWatch===null){
237
- config.mcp.previewWatch={command:"bun",args:[fileURLToPath(new URL("./bun-compiler.mjs",import.meta.url)),"--watch"]};
238
- }
239
- const appIds = new Set();
240
- for (const app of config.mcp.apps) {
241
- 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.");
242
- const file = projectPath(root, app.file, "mcp.apps.file");
243
- if (path.extname(file) !== ".html") throw new Error("mcp.apps.file must be a built, self-contained HTML file.");
244
- 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.`);
245
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
+ );
246
406
  return { root, config, sourceRoot, dsRoot };
247
407
  }
248
408
 
@@ -271,7 +431,10 @@ export function isContractFile(file) {
271
431
 
272
432
  /** The ADS-relative path without `.ads.scenario.*`; a canonical `<Dir>/<Dir>.ads.scenario.*` identifies the directory. */
273
433
  export function scenarioIdentity(file, dsRoot) {
274
- let id = path.relative(dsRoot, file).replaceAll("\\", "/").replace(/\.ads\.scenario\.[^.]+$/, "");
434
+ let id = path
435
+ .relative(dsRoot, file)
436
+ .replaceAll("\\", "/")
437
+ .replace(/\.ads\.scenario\.[^.]+$/, "");
275
438
  if (adsFileRole(file) === "scenario" && path.posix.basename(id) === path.posix.basename(path.posix.dirname(id))) id = path.posix.dirname(id);
276
439
  return id;
277
440
  }
@@ -279,17 +442,16 @@ export function scenarioIdentity(file, dsRoot) {
279
442
  export function isDevelopmentFile(file, { dsRoot }) {
280
443
  if (isDraftFile(file)) return true;
281
444
  if (!isInside(dsRoot, file)) return isTestFile(file) || adsFileRole(file) !== null;
282
- const relative = path.relative(dsRoot, file).replaceAll("\\", "/");
283
445
  // An exports file belongs to its owner's layer: production for the public barrel, development under review/.
284
- return adsFileRole(file) !== null && adsFileRole(file) !== "exports" || isTestFile(file) || /^(?:showcase|composition|review|brand)\//.test(relative);
446
+ return (adsFileRole(file) !== null && (adsFileRole(file) !== "exports" || isInside(path.join(dsRoot, "review"), file))) || isTestFile(file);
285
447
  }
286
448
 
287
449
  /** Review implementations may own demo presentation; scenarios/fixtures may not. */
288
450
  export function isReviewFile(file, { dsRoot }) {
289
- return !isDraftFile(file) && isInside(path.join(dsRoot, "review"), file) && adsFileRole(file) === null && !isTestFile(file);
451
+ return !isDraftFile(file) && isInside(dsRoot, file) && adsFileRole(file) === "review" && !isTestFile(file);
290
452
  }
291
453
 
292
- 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"]);
293
455
 
294
456
  export function sourceFiles(root) {
295
457
  if (!existsSync(root)) return [];
@@ -297,23 +459,28 @@ export function sourceFiles(root) {
297
459
  for (const entry of readdirSync(root, { withFileTypes: true })) {
298
460
  if (ignored.has(entry.name) || entry.isSymbolicLink() || isDraftFile(path.join(root, entry.name))) continue;
299
461
  const file = path.join(root, entry.name);
300
- if (entry.isDirectory()) { if (!hasProjectConfig(file)) files.push(...sourceFiles(file)); }
301
- else if (entry.isFile() && /\.(css|html|[cm]?[jt]sx?)$/.test(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);
302
465
  }
303
466
  return files.sort();
304
467
  }
305
468
 
306
- export function importViolation(specifier, filename, options, resolve) {
307
- 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;
308
471
  const { root, dsRoot, config } = options;
309
472
  // ADS implementation code needs its private imports; the showcase is a consumer.
310
473
  if (isInside(dsRoot, filename) && (!isDevelopmentFile(filename, options) || isContractFile(filename))) return false; // Contract symbol ownership is checked without executing imports.
311
474
  if (specifier === `${config.publicAlias}/review`) return !isDevelopmentFile(filename, options) && !isTestFile(filename);
312
475
  if (specifier.startsWith(`${config.publicAlias}/`)) return true;
313
476
  if (specifier === config.publicAlias) return false;
314
- const imported = resolve ? resolve(specifier, filename)
315
- : specifier.startsWith(".") ? [path.resolve(path.dirname(filename), specifier)]
316
- : 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
+ : [];
317
484
  return imported.some((file) => {
318
485
  if (!isInside(dsRoot, file)) return false;
319
486
  // Previews may show the ADS's own artwork and fonts: asset files are data, not implementation.
@@ -323,7 +490,8 @@ export function importViolation(specifier, filename, options, resolve) {
323
490
  if (isReviewFile(filename, options)) return false;
324
491
  // Owner-local white-box tests may exercise private helpers without making
325
492
  // those helpers public API. Scenarios remain public-API consumers.
326
- 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;
327
495
  if (isDevelopmentFile(filename, options) && isDevelopmentFile(file, options)) return false;
328
496
  if (isTestFile(filename) && (isInside(path.join(dsRoot, "showcase"), file) || isTestFile(file))) return false;
329
497
  if (isInside(path.join(dsRoot, "showcase"), filename) && isInside(path.join(dsRoot, "showcase"), file)) return false;