@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
@@ -1,6 +1,6 @@
1
1
  import { readFileSync } from "node:fs";
2
2
  import path from "node:path";
3
- import ts from "typescript";
3
+ import ts from "./analysis/syntax.mjs";
4
4
  import postcss from "postcss";
5
5
  import { isDevelopmentFile, isInside, isTestFile, sourceFiles } from "./config.mjs";
6
6
  import { findingSeverity } from "./finding-rules.mjs";
@@ -13,29 +13,40 @@ import { findingSeverity } from "./finding-rules.mjs";
13
13
  * A srcset with width descriptors needs sizes, on <img> and on the project's Image. */
14
14
 
15
15
  const guidance = "ads://guides/performance";
16
- const sized = declarations => /^(?:absolute|fixed)$/.test(declarations.get("position") ?? "") || declarations.has("aspect-ratio") || ["width", "inline-size"].some(name => declarations.get(name) && declarations.get(name) !== "auto") && ["height", "block-size"].some(name => declarations.get(name) && declarations.get(name) !== "auto");
16
+ const sized = (declarations) =>
17
+ /^(?:absolute|fixed)$/.test(declarations.get("position") ?? "") ||
18
+ declarations.has("aspect-ratio") ||
19
+ (["width", "inline-size"].some((name) => declarations.get(name) && declarations.get(name) !== "auto") &&
20
+ ["height", "block-size"].some((name) => declarations.get(name) && declarations.get(name) !== "auto"));
17
21
 
18
22
  /** What this file's css templates set: per variable, per class and on img selectors. */
19
23
  function fileStyles(source) {
20
- const variables = new Map(), classes = new Map();
24
+ const variables = new Map(),
25
+ classes = new Map();
21
26
  let imgRule = false;
22
27
  const read = (name, template) => {
23
- const text = ts.isNoSubstitutionTemplateLiteral(template) ? template.text : `${template.head.text}${template.templateSpans.map(span => `__ads__${span.literal.text}`).join("")}`;
28
+ const text = ts.isNoSubstitutionTemplateLiteral(template)
29
+ ? template.text
30
+ : `${template.head.text}${template.templateSpans.map((span) => `__ads__${span.literal.text}`).join("")}`;
24
31
  try {
25
- const css = postcss.parse(text), own = new Map();
32
+ const css = postcss.parse(text),
33
+ own = new Map();
26
34
  for (const node of css.nodes) if (node.type === "decl") own.set(node.prop.toLowerCase(), node.value.trim());
27
35
  if (name) variables.set(name, own);
28
- css.walkRules(rule => {
36
+ css.walkRules((rule) => {
29
37
  const declarations = new Map();
30
38
  for (const node of rule.nodes) if (node.type === "decl") declarations.set(node.prop.toLowerCase(), node.value.trim());
31
39
  if (!sized(declarations)) return;
32
40
  if (/(?:^|[\s,>+~(])img\b/.test(rule.selector)) imgRule = true;
33
41
  for (const [, name] of rule.selector.matchAll(/\.([\w-]+)/g)) classes.set(name, declarations);
34
42
  });
35
- } catch { /* The core CSS syntax diagnostic owns malformed templates. */ }
43
+ } catch {
44
+ /* The core CSS syntax diagnostic owns malformed templates. */
45
+ }
36
46
  };
37
- const visit = node => {
38
- if (ts.isTaggedTemplateExpression(node) && /(?:^|\.)css$|^styled/.test(node.tag.getText(source))) read(ts.isVariableDeclaration(node.parent) ? node.parent.name.getText(source) : undefined, node.template);
47
+ const visit = (node) => {
48
+ if (ts.isTaggedTemplateExpression(node) && /(?:^|\.)css$|^styled/.test(node.tag.getText(source)))
49
+ read(ts.isVariableDeclaration(node.parent) ? node.parent.name.getText(source) : undefined, node.template);
39
50
  ts.forEachChild(node, visit);
40
51
  };
41
52
  visit(source);
@@ -44,30 +55,47 @@ function fileStyles(source) {
44
55
 
45
56
  /** Whether a className expression sizes the image: true, false, or null when it cannot tell. */
46
57
  function classSize(expression, { variables, classes }) {
47
- let found = false, unknown = false;
48
- const words = text => { for (const name of text.split(/\s+/)) if (classes.has(name)) found = true; };
49
- const visit = node => {
58
+ let found = false,
59
+ unknown = false;
60
+ const words = (text) => {
61
+ for (const name of text.split(/\s+/)) if (classes.has(name)) found = true;
62
+ };
63
+ const visit = (node) => {
50
64
  if (ts.isStringLiteralLike(node)) words(node.text);
51
- else if (ts.isIdentifier(node)) { if (!variables.has(node.text)) unknown = true; else if (sized(variables.get(node.text))) found = true; }
52
- else if (ts.isCallExpression(node) && ts.isIdentifier(node.expression) && node.expression.text === "cx") node.arguments.forEach(visit);
53
- else if (ts.isConditionalExpression(node)) { visit(node.whenTrue); visit(node.whenFalse); }
54
- else if (ts.isBinaryExpression(node)) { if (node.operatorToken.kind === ts.SyntaxKind.AmpersandAmpersandToken) visit(node.right); else { visit(node.left); visit(node.right); } }
55
- else if (ts.isParenthesizedExpression(node) || ts.isJsxExpression(node)) { if (node.expression) visit(node.expression); }
56
- else unknown = true;
65
+ else if (ts.isIdentifier(node)) {
66
+ if (!variables.has(node.text)) unknown = true;
67
+ else if (sized(variables.get(node.text))) found = true;
68
+ } else if (ts.isCallExpression(node) && ts.isIdentifier(node.expression) && node.expression.text === "cx") node.arguments.forEach(visit);
69
+ else if (ts.isConditionalExpression(node)) {
70
+ visit(node.whenTrue);
71
+ visit(node.whenFalse);
72
+ } else if (ts.isBinaryExpression(node)) {
73
+ if (node.operatorToken.kind === ts.SyntaxKind.AmpersandAmpersandToken) visit(node.right);
74
+ else {
75
+ visit(node.left);
76
+ visit(node.right);
77
+ }
78
+ } else if (ts.isParenthesizedExpression(node) || ts.isJsxExpression(node)) {
79
+ if (node.expression) visit(node.expression);
80
+ } else unknown = true;
57
81
  };
58
82
  visit(expression);
59
83
  return found ? true : unknown ? null : false;
60
84
  }
61
85
 
62
- export function imageAttributeFindings({ root, dsRoot }) {
63
- const options = { root, dsRoot }, findings = [];
64
- const inScope = file => isInside(path.join(dsRoot, "composition"), file) && !isTestFile(file) || ["components", "patterns"].some(layer => isInside(path.join(dsRoot, layer), file)) && !isDevelopmentFile(file, options);
65
- for (const file of sourceFiles(dsRoot).filter(file => /\.[jt]sx$/.test(file) && inScope(file))) {
86
+ export async function imageAttributeFindings({ root, dsRoot }) {
87
+ const options = { root, dsRoot },
88
+ findings = [];
89
+ const inScope = (file) =>
90
+ (isInside(path.join(dsRoot, "composition"), file) && !isTestFile(file)) ||
91
+ (["components", "patterns"].some((layer) => isInside(path.join(dsRoot, layer), file)) && !isDevelopmentFile(file, options));
92
+ for (const file of sourceFiles(dsRoot).filter((file) => /\.[jt]sx$/.test(file) && inScope(file))) {
66
93
  const text = readFileSync(file, "utf8");
67
94
  if (!/<(?:img|Image)\b/.test(text)) continue;
68
- const source = ts.createSourceFile(file, text, ts.ScriptTarget.Latest, true, ts.ScriptKind.TSX), relative = path.relative(root, file).replaceAll("\\", "/");
95
+ const source = await ts.createSourceFile(file, text, ts.ScriptTarget.Latest, true, ts.ScriptKind.TSX),
96
+ relative = path.relative(root, file).replaceAll("\\", "/");
69
97
  const styles = fileStyles(source);
70
- const visit = node => {
98
+ const visit = (node) => {
71
99
  if (ts.isJsxSelfClosingElement(node) || ts.isJsxOpeningElement(node)) {
72
100
  const tag = node.tagName.getText(source);
73
101
  if (tag === "img" || tag === "Image") inspectCandidates(node, tag);
@@ -78,31 +106,76 @@ export function imageAttributeFindings({ root, dsRoot }) {
78
106
  /** Width descriptors say nothing about display size, so sizes must. */
79
107
  const inspectCandidates = (node, tag) => {
80
108
  const attributes = node.attributes.properties;
81
- const attribute = name => attributes.find(item => ts.isJsxAttribute(item) && item.name.getText(source) === name);
109
+ const attribute = (name) => attributes.find((item) => ts.isJsxAttribute(item) && item.name.getText(source) === name);
82
110
  const candidates = attribute("srcset") ?? attribute("srcSet");
83
111
  if (!candidates || attribute("sizes")) return;
84
112
  const { line, character } = source.getLineAndCharacterOfPosition(node.getStart(source));
85
- const add = (rule, message) => findings.push({ rule, severity: findingSeverity(rule), file: relative, line: line + 1, column: character + 1, guidanceUri: guidance, message: `${relative}:${line + 1} ${message}` });
113
+ const add = (rule, message) =>
114
+ findings.push({
115
+ rule,
116
+ severity: findingSeverity(rule),
117
+ file: relative,
118
+ line: line + 1,
119
+ column: character + 1,
120
+ guidanceUri: guidance,
121
+ message: `${relative}:${line + 1} ${message}`,
122
+ });
86
123
  let value = candidates.initializer;
87
124
  if (value && ts.isJsxExpression(value)) value = value.expression;
88
125
  const literal = value && ts.isStringLiteralLike(value) ? value.text : null;
89
- if (attributes.some(ts.isJsxSpreadAttribute) || literal === null) add("img-attributes-unresolved", `<${tag}> has a srcset ADS cannot read or spread props that may hold sizes. With width descriptors it needs sizes, the width it displays at.`);
90
- else if (/\d\s*w\s*(?:,|$)/.test(literal.trim())) add("img-attributes", `<${tag}> has a srcset with width descriptors and no sizes, so the browser assumes the full viewport width and can pick a larger file than it shows. Add sizes, such as "(min-width: 1024px) 50vw, 100vw".`);
126
+ if (attributes.some(ts.isJsxSpreadAttribute) || literal === null)
127
+ add(
128
+ "img-attributes-unresolved",
129
+ `<${tag}> has a srcset ADS cannot read or spread props that may hold sizes. With width descriptors it needs sizes, the width it displays at.`,
130
+ );
131
+ else if (/\d\s*w\s*(?:,|$)/.test(literal.trim()))
132
+ add(
133
+ "img-attributes",
134
+ `<${tag}> has a srcset with width descriptors and no sizes, so the browser assumes the full viewport width and can pick a larger file than it shows. Add sizes, such as "(min-width: 1024px) 50vw, 100vw".`,
135
+ );
91
136
  };
92
- const inspect = node => {
137
+ const inspect = (node) => {
93
138
  const { line, character } = source.getLineAndCharacterOfPosition(node.getStart(source));
94
- const add = (rule, message) => findings.push({ rule, severity: findingSeverity(rule), file: relative, line: line + 1, column: character + 1, guidanceUri: guidance, message: `${relative}:${line + 1} ${message}` });
95
- const attributes = node.attributes.properties, spread = attributes.some(ts.isJsxSpreadAttribute);
96
- const attribute = name => attributes.find(item => ts.isJsxAttribute(item) && item.name.getText(source) === name);
139
+ const add = (rule, message) =>
140
+ findings.push({
141
+ rule,
142
+ severity: findingSeverity(rule),
143
+ file: relative,
144
+ line: line + 1,
145
+ column: character + 1,
146
+ guidanceUri: guidance,
147
+ message: `${relative}:${line + 1} ${message}`,
148
+ });
149
+ const attributes = node.attributes.properties,
150
+ spread = attributes.some(ts.isJsxSpreadAttribute);
151
+ const attribute = (name) => attributes.find((item) => ts.isJsxAttribute(item) && item.name.getText(source) === name);
97
152
  const styleText = attribute("style")?.initializer?.getText(source) ?? "";
98
153
  const className = attribute("className") ?? attribute("class");
99
154
  let size = !!(attribute("width") && attribute("height")) || /\baspectRatio\b|aspect-ratio/.test(styleText) || styles.imgRule;
100
155
  if (!size && className?.initializer) size = classSize(className.initializer, styles);
101
156
  const loading = !!attribute("loading");
102
- if (spread && (size !== true || !loading)) { add("img-attributes-unresolved", `spreads props onto <img>, so ADS cannot see its dimensions or loading. Pass width, height and loading explicitly so the page reserves the space and the load order is a choice.`); return; }
103
- if (size === null) add("img-attributes-unresolved", `styles <img> with a class ADS cannot read here, so its size is not checked. Set width and height so the page reserves the space.`);
104
- if (size === false) add("img-attributes", `<img> has no width and height or a visible aspect-ratio, so the page shifts when it loads. Set the file's width and height, or a sized aspect-ratio in its style.`);
105
- if (!loading) add("img-attributes", `<img> has no loading attribute. Use loading="lazy" below the fold; the page's main visible image uses loading="eager" with fetchpriority="high", or the project's image component with priority.`);
157
+ if (spread && (size !== true || !loading)) {
158
+ add(
159
+ "img-attributes-unresolved",
160
+ `spreads props onto <img>, so ADS cannot see its dimensions or loading. Pass width, height and loading explicitly so the page reserves the space and the load order is a choice.`,
161
+ );
162
+ return;
163
+ }
164
+ if (size === null)
165
+ add(
166
+ "img-attributes-unresolved",
167
+ `styles <img> with a class ADS cannot read here, so its size is not checked. Set width and height so the page reserves the space.`,
168
+ );
169
+ if (size === false)
170
+ add(
171
+ "img-attributes",
172
+ `<img> has no width and height or a visible aspect-ratio, so the page shifts when it loads. Set the file's width and height, or a sized aspect-ratio in its style.`,
173
+ );
174
+ if (!loading)
175
+ add(
176
+ "img-attributes",
177
+ `<img> has no loading attribute. Use loading="lazy" below the fold; the page's main visible image uses loading="eager" with fetchpriority="high", or the project's image component with priority.`,
178
+ );
106
179
  };
107
180
  visit(source);
108
181
  }
@@ -20,7 +20,7 @@ export function imageSize(bytes) {
20
20
  if (chunk === "VP8 ") return { width: bytes.readUInt16LE(26) & 0x3fff, height: bytes.readUInt16LE(28) & 0x3fff };
21
21
  if (chunk === "VP8L") {
22
22
  const bits = bytes.readUInt32LE(21);
23
- return { width: (bits & 0x3fff) + 1, height: ((bits >> 14) & 0x3fff) + 1 };
23
+ return { width: (bits & 0x3fff) + 1, height: ((bits>>14)&0x3fff) + 1 };
24
24
  }
25
25
  if (chunk === "VP8X") return { width: 1 + bytes.readUIntLE(24, 3), height: 1 + bytes.readUIntLE(27, 3) };
26
26
  }
package/dist/index.mjs CHANGED
@@ -1,9 +1,7 @@
1
1
  export { initProject } from "./init.mjs";
2
- export { createProject } from "./create.mjs";
3
2
  export { checkProject } from "./check.mjs";
4
3
  export { inspectTokens, tokenContract } from "./tokens.mjs";
5
4
  export { inspectTokenOrigins } from "./token-origins.mjs";
6
- export { generateLintConfig } from "./lint-config.mjs";
7
5
  export { generateBrandAssets } from "./brand-assets.mjs";
8
6
  // Development-only helpers for registered project lint extensions. They reuse the
9
7
  // same validated configuration and property boundary as the core checker.
package/dist/init.mjs CHANGED
@@ -1,10 +1,10 @@
1
1
  import { existsSync, lstatSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, renameSync, rmSync, rmdirSync, writeFileSync, chmodSync } from "node:fs";
2
2
  import path from "node:path";
3
3
  import { fileURLToPath } from "node:url";
4
- import ts from "typescript";
5
- import { isInside, loadConfig, sourceFiles, supportedFrameworks } from "./config.mjs";
4
+ import { isInside, loadConfig, sourceFiles, supportedFrameworks, fixedLayout } from "./config.mjs";
6
5
  import { foundationFiles } from "./token-policy.mjs";
7
6
  import { generatedPaletteFile } from "./palette-generated.mjs";
7
+ import { generatedEntries } from "./generated-entries.mjs";
8
8
  import { assertFrameworkCompiler } from "./ui-framework.mjs";
9
9
 
10
10
  const tool = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8"));
@@ -27,17 +27,18 @@ function dependencySpec(value) {
27
27
  return value;
28
28
  }
29
29
 
30
- function detectManager(root, pkg, requested) {
31
- if (requested !== undefined) return requested;
30
+ /** The package manager the project declares: packageManager in package.json, else its lockfile. */
31
+ function detectManager(root, pkg) {
32
32
  if (typeof pkg.packageManager === "string") return pkg.packageManager.split("@")[0];
33
33
  const bun = ["bun.lock", "bun.lockb"].some((name) => existsSync(path.join(root, name)));
34
34
  const npm = existsSync(path.join(root, "package-lock.json"));
35
- if (bun && npm) throw new Error("Both Bun and npm lockfiles exist. Specify --package-manager bun or npm.");
35
+ if (bun && npm) throw new Error('Both Bun and npm lockfiles exist. Keep the one the project uses, or set "packageManager" in package.json.');
36
36
  if (bun) return "bun";
37
37
  if (npm) return "npm";
38
38
  if (["pnpm-lock.yaml", "yarn.lock"].some((name) => existsSync(path.join(root, name)))) throw new Error("This version supports npm and Bun projects.");
39
- if(process.env.npm_config_user_agent?.startsWith("npm/"))return "npm";
40
- return process.versions.bun || process.env.npm_config_user_agent?.startsWith("bun/") ? "bun" : "npm";
39
+ throw new Error(
40
+ 'The project declares no package manager. Set "packageManager" in package.json (such as "npm@11.7.0" or "bun@1.4.1"), or install its dependencies with npm or Bun so its lockfile exists, then run ads init.',
41
+ );
41
42
  }
42
43
 
43
44
  function assertLocalFile(root, file) {
@@ -69,7 +70,8 @@ function commit(root, updates) {
69
70
  try {
70
71
  for (const [index, entry] of entries.entries()) {
71
72
  const current = existsSync(entry.file) ? readFileSync(entry.file) : null;
72
- if ((current === null) !== (entry.before === null) || (current && !current.equals(entry.before))) throw new Error(`Project file changed during init: ${entry.file}`);
73
+ if ((current === null) !== (entry.before === null) || (current && !current.equals(entry.before)))
74
+ throw new Error(`Project file changed during init: ${entry.file}`);
73
75
  const temporary = path.join(staging, String(index));
74
76
  writeFileSync(temporary, entry.content);
75
77
  if (entry.mode !== undefined) chmodSync(temporary, entry.mode);
@@ -94,7 +96,7 @@ function commit(root, updates) {
94
96
  }
95
97
  }
96
98
 
97
- export function initProject(directory = process.cwd(), { toolPackage, packageManager, framework } = {}) {
99
+ export async function initProject(directory = process.cwd(), { toolPackage, framework, includeStarter = false } = {}) {
98
100
  const root = path.resolve(directory);
99
101
  const packageFile = path.join(root, "package.json");
100
102
  assertLocalFile(root, packageFile);
@@ -103,34 +105,68 @@ export function initProject(directory = process.cwd(), { toolPackage, packageMan
103
105
  const pkg = JSON.parse(originalPackage);
104
106
  if (!pkg || typeof pkg !== "object" || Array.isArray(pkg)) throw new Error("package.json must be an object.");
105
107
  for (const field of ["scripts", "dependencies", "devDependencies"]) {
106
- if (pkg[field] !== undefined && (!pkg[field] || typeof pkg[field] !== "object" || Array.isArray(pkg[field]))) throw new Error(`package.json ${field} must be an object.`);
108
+ if (pkg[field] !== undefined && (!pkg[field] || typeof pkg[field] !== "object" || Array.isArray(pkg[field])))
109
+ throw new Error(`package.json ${field} must be an object.`);
107
110
  }
108
111
  for (const [name, script] of Object.entries(pkg.scripts ?? {})) {
109
112
  if (typeof script !== "string") throw new Error(`package.json script ${name} must be a string.`);
110
113
  }
111
- const manager = detectManager(root, pkg, packageManager);
114
+ const manager = detectManager(root, pkg);
112
115
  if (!["npm", "bun"].includes(manager)) throw new Error("packageManager must be npm or bun.");
113
116
  const run = manager === "bun" ? "bun run" : "npm run";
114
117
  const ads = manager === "bun" ? "bun run ads" : "ads";
115
118
  const spec = dependencySpec(toolPackage ?? pkg.devDependencies?.[tool.name] ?? pkg.dependencies?.[tool.name] ?? tool.version);
116
119
  const { config, dsRoot } = loadConfig(root);
117
- const initialConfigFile=path.join(root,"ds.config.json"),initialConfig=existsSync(initialConfigFile)?JSON.parse(readFileSync(initialConfigFile,"utf8")):{};
118
- const nativePreviewMissing=initialConfig.mcp?.previewManifest===undefined;
119
- if(nativePreviewMissing)config.mcp.previewManifest=".ds/preview/manifest.json";
120
+ // ADS generates the barrels and the styles entry. A hand-written one stops init before any write.
121
+ for (const entry of [config.publicEntry, config.reviewEntry, config.stylesEntry]) {
122
+ const file = path.join(dsRoot, entry);
123
+ if (existsSync(file) && !/^(?:\/\/|\/\*) Generated by ADS/.test(readFileSync(file, "utf8")))
124
+ throw new Error(
125
+ `${path.relative(root, file).replaceAll("\\", "/")} is hand-written, but ADS generates it. Move each public export into its owner's <Owner>.ads.exports.ts (token sheets feed the styles entry), delete the file and run ads init again.`,
126
+ );
127
+ }
120
128
  if (framework !== undefined && !supportedFrameworks.includes(framework)) throw new Error("framework must be react or preact.");
121
- if (framework !== undefined && config.framework !== null && framework !== config.framework) throw new Error(`ADS is configured for ${config.framework}; --framework ${framework} would change it. Migrate the project and update ds.config.json explicitly before running init.`);
129
+ if (framework !== undefined && config.framework !== null && framework !== config.framework)
130
+ throw new Error(
131
+ `ADS is configured for ${config.framework}; --framework ${framework} would change it. Migrate the project and update ds.config.json explicitly before running init.`,
132
+ );
122
133
  const selectedFramework = framework ?? config.framework;
123
- if (selectedFramework === null) throw new Error("Specify --framework react or --framework preact on first init, including when adopting an existing ADS config without a framework.");
124
- assertFrameworkCompiler(root, selectedFramework);
134
+ if (selectedFramework === null)
135
+ throw new Error("Specify --framework react or --framework preact on first init, including when adopting an existing ADS config without a framework.");
136
+ await assertFrameworkCompiler(root, selectedFramework);
125
137
  config.framework = selectedFramework;
126
138
  const lint = `${ads} check .`;
139
+ // --include-starter: the starter's package settings, scripts and dev dependencies the project lacks.
140
+ if (includeStarter) {
141
+ const starterPackage = JSON.parse(readFileSync(starterFile(selectedFramework, "package.json"), "utf8"));
142
+ for (const field of ["type", "sideEffects"]) if (pkg[field] === undefined && starterPackage[field] !== undefined) pkg[field] = starterPackage[field];
143
+ pkg.scripts = {
144
+ ...Object.fromEntries(Object.entries(starterPackage.scripts).map(([name, command]) => [name, command.replaceAll("npm run ", `${run} `)])),
145
+ ...pkg.scripts,
146
+ };
147
+ pkg.devDependencies = {
148
+ ...Object.fromEntries(Object.entries(starterPackage.devDependencies).filter(([name]) => !pkg.dependencies?.[name])),
149
+ ...pkg.devDependencies,
150
+ };
151
+ }
127
152
  const scripts = { ...pkg.scripts };
128
- if (scripts["lint:ds"] && scripts["lint:ds"] !== lint && !["ads check .", "bun run ads check .", "bun --bun run ads check .", "ds check .", "bun --bun run ds check .", "ads lint-config . && ads check .", "ds lint-config . && ds check .", "bun --bun run ads lint-config . && bun --bun run ads check ."].some(prefix => scripts["lint:ds"].startsWith(prefix))) throw new Error("An existing custom lint:ds script would conflict. Rename it or integrate ADS checks before running init.");
153
+ if (
154
+ scripts["lint:ds"] &&
155
+ scripts["lint:ds"] !== lint &&
156
+ !["ads check .", "bun run ads check .", "bun --bun run ads check ."].some((prefix) => scripts["lint:ds"].startsWith(prefix))
157
+ )
158
+ throw new Error("An existing custom lint:ds script would conflict. Rename it or integrate ADS checks before running init.");
129
159
  scripts["lint:ds"] = lint;
130
- if (scripts["assets:ds"] && !["ads assets", "ds assets", "bun run ads assets", "bun --bun run ads assets"].includes(scripts["assets:ds"])) throw new Error("An existing custom assets:ds script would conflict. Rename it or integrate ADS asset generation before running init.");
160
+ if (scripts["assets:ds"] && !["ads assets", "bun run ads assets", "bun --bun run ads assets"].includes(scripts["assets:ds"]))
161
+ throw new Error("An existing custom assets:ds script would conflict. Rename it or integrate ADS asset generation before running init.");
131
162
  scripts["assets:ds"] = `${ads} assets`;
132
- for (const [name, command] of [["dev:showcase", "showcase"], ["ads-mcp", "mcp --mutations"], ["ads-read-mcp", "mcp"]]) {
133
- if (!scripts[name] || [`ds ${command}`, `ads ${command}`, `bun run ads ${command}`, `bun --bun run ads ${command}`].includes(scripts[name])) scripts[name] = `${ads} ${command}`;
163
+ for (const [name, command] of [
164
+ ["dev:showcase", "showcase"],
165
+ ["ads-mcp", "mcp --mutations"],
166
+ ["ads-read-mcp", "mcp"],
167
+ ]) {
168
+ if (!scripts[name] || [`ads ${command}`, `bun run ads ${command}`, `bun --bun run ads ${command}`].includes(scripts[name]))
169
+ scripts[name] = `${ads} ${command}`;
134
170
  }
135
171
  const managedBuild = /^(?:npm|bun(?: --bun)?) run lint:ds(?: && (?:npm|bun(?: --bun)?) run assets:ds)?$/.test(scripts.build ?? "");
136
172
  if (scripts.build && !managedBuild) {
@@ -145,55 +181,31 @@ export function initProject(directory = process.cwd(), { toolPackage, packageMan
145
181
  }
146
182
  pkg.scripts = scripts;
147
183
  pkg.devDependencies = { ...pkg.devDependencies, [tool.name]: spec };
148
- // The validation and acceptance policies run the browser audit, which needs project Playwright.
149
- if (!["@playwright/test", "playwright"].some(name => pkg.devDependencies[name] ?? pkg.dependencies?.[name])) pkg.devDependencies["@playwright/test"] = tool.devDependencies["@playwright/test"];
184
+ // ads validate and draft acceptance run the render audit, which needs project Playwright.
185
+ if (!["@playwright/test", "playwright"].some((name) => pkg.devDependencies[name] ?? pkg.dependencies?.[name]))
186
+ pkg.devDependencies["@playwright/test"] = tool.devDependencies["@playwright/test"];
150
187
  if (pkg.dependencies?.[tool.name]) delete pkg.dependencies[tool.name];
151
188
 
152
189
  const updates = new Map();
153
- function addMissing(file, content) { assertLocalFile(root, file); if (!existsSync(file)) updates.set(file, content); }
190
+ function addMissing(file, content) {
191
+ assertLocalFile(root, file);
192
+ if (!existsSync(file)) updates.set(file, content);
193
+ }
154
194
  const tokenRoot = path.join(dsRoot, config.tokenDir);
155
195
  const existingTokens = sourceFiles(tokenRoot).filter((file) => file.endsWith(".css"));
156
- const tokenFiles = existingTokens.length ? existingTokens : foundationFiles.filter((name) => existsSync(path.join(starter, "design-system/tokens", name))).map((name) => {
157
- const file = path.join(tokenRoot, name);
158
- addMissing(file, readFileSync(path.join(starter, "design-system/tokens", name)));
159
- return file;
160
- });
196
+ if (!existingTokens.length)
197
+ for (const name of foundationFiles.filter((name) => existsSync(path.join(starter, "design-system/tokens", name))))
198
+ addMissing(path.join(tokenRoot, name), readFileSync(path.join(starter, "design-system/tokens", name)));
161
199
  if (!existingTokens.length) {
162
200
  // The renderer palette generated from the starter's token sheets, beside its theme sheet.
163
201
  addMissing(path.join(tokenRoot, generatedPaletteFile), readFileSync(path.join(starter, "design-system/tokens", generatedPaletteFile)));
164
- // The starter's token groups, each a scenario with its fixture.
165
- for (const name of readdirSync(path.join(starter, "design-system/tokens")).filter(name => /\.ads\.(?:scenario\.tsx|fixture\.ts)$/.test(name)).sort()) {
166
- const content = readFileSync(path.join(starter, "design-system/tokens", name), "utf8").replaceAll('"@ds/review"', JSON.stringify(`${config.publicAlias}/review`)).replaceAll('"@ds"', JSON.stringify(config.publicAlias));
202
+ // Foundation definitions/metadata are shared; ADS owns their presentation.
203
+ for (const name of readdirSync(path.join(starter, "design-system/tokens"))
204
+ .filter((name) => name.endsWith(".ads.json"))
205
+ .sort()) {
206
+ const content = readFileSync(path.join(starter, "design-system/tokens", name), "utf8");
167
207
  addMissing(path.join(tokenRoot, name), content);
168
208
  }
169
- for (const name of ["TokenPreview.tsx"]) {
170
- const content = readFileSync(starterFile(selectedFramework, `design-system/review/token-preview/${name}`), "utf8");
171
- addMissing(path.join(dsRoot, "review/token-preview", name), content.replaceAll('"@ds"', JSON.stringify(config.publicAlias)));
172
- }
173
- const reviewFile = path.relative(root, path.join(dsRoot, "review/token-preview/TokenPreview.tsx")).replaceAll("\\", "/");
174
- if (!config.boundaries.styleWrites.some(item => item.file === reviewFile)) config.boundaries.styleWrites.push({ file: reviewFile, properties: ["--ux-token-preview-value"] });
175
- }
176
- tokenFiles.sort((a, b) => foundationFiles.indexOf(path.basename(a)) - foundationFiles.indexOf(path.basename(b)) || a.localeCompare(b));
177
- const stylesFile = path.join(dsRoot, config.stylesEntry);
178
- const relativeImport = (from, to) => {
179
- const relative = path.relative(path.dirname(from), to).split(path.sep).join("/");
180
- return relative.startsWith(".") ? relative : `./${relative}`;
181
- };
182
- addMissing(stylesFile, tokenFiles.map((file) => `@import ${JSON.stringify(relativeImport(stylesFile, file))};`).join("\n") + "\n");
183
- const entryFile = path.join(dsRoot, config.publicEntry);
184
- addMissing(entryFile, `// Export your project's public components and types here.\nimport ${JSON.stringify(relativeImport(entryFile, stylesFile))};\n`);
185
- if (!existingTokens.length) {
186
- const reviewEntry = path.join(dsRoot, config.reviewEntry);
187
- const reviewExport = `export { TokenPreview } from ${JSON.stringify(relativeImport(reviewEntry, path.join(dsRoot, "review/token-preview/TokenPreview")))};\n`;
188
- addMissing(reviewEntry, reviewExport);
189
- if (existsSync(reviewEntry) && !readFileSync(reviewEntry, "utf8").includes("token-preview/TokenPreview")) throw new Error("The project owns an existing review entry. Add the new token renderer through that development API before initializing the foundation.");
190
- if (existsSync(entryFile)) {
191
- let current = readFileSync(entryFile, "utf8");
192
- const ast = ts.createSourceFile(entryFile, current, ts.ScriptTarget.Latest, true);
193
- for (const statement of [...ast.statements].reverse()) if (ts.isExportDeclaration(statement) && !statement.moduleSpecifier && statement.exportClause && ts.isNamedExports(statement.exportClause) && !statement.exportClause.elements.length) current = current.slice(0, statement.getStart(ast)) + current.slice(statement.end);
194
- if (!ast.statements.some(statement => ts.isImportDeclaration(statement) || statement.modifiers?.some(modifier => modifier.kind === ts.SyntaxKind.ExportKeyword))) current += `\nimport ${JSON.stringify(relativeImport(entryFile, stylesFile))};\n`;
195
- if (current !== readFileSync(entryFile, "utf8")) updates.set(entryFile, current);
196
- }
197
209
  }
198
210
  // Keeps a section folder that has nothing in it yet.
199
211
  for (const section of ["components", "patterns", "controllers", "composition"]) {
@@ -204,24 +216,72 @@ export function initProject(directory = process.cwd(), { toolPackage, packageMan
204
216
  addMissing(path.join(dsRoot, "assets/fonts/.gitkeep"), "");
205
217
  const configFile = path.join(root, "ds.config.json");
206
218
  assertLocalFile(root, configFile);
207
- if (!existsSync(configFile)) updates.set(configFile, `${JSON.stringify(config, null, 2)}\n`);
208
- else {
219
+ // The fixed layout is ADS's own; a new config records only the project's choices.
220
+ if (!existsSync(configFile)) {
221
+ // A complete starter needs its glyph/brand configuration as well as its files.
222
+ // Existing project configuration is never replaced by starter defaults.
223
+ const choices = includeStarter
224
+ ? JSON.parse(readFileSync(starterFile(selectedFramework, "ds.config.json"), "utf8"))
225
+ : Object.fromEntries(Object.entries(config).filter(([key]) => !(key in fixedLayout)));
226
+ updates.set(configFile, `${JSON.stringify(choices, null, 2)}\n`);
227
+ } else {
209
228
  const original = readFileSync(configFile, "utf8");
210
229
  const saved = JSON.parse(original);
211
- if (saved.framework === undefined || !existingTokens.length || nativePreviewMissing) {
230
+ if (saved.framework === undefined || !existingTokens.length) {
212
231
  const indent = original.match(/\n([\t ]+)"/)?.[1] ?? " ";
213
- updates.set(configFile, `${JSON.stringify({ ...saved, framework: selectedFramework, ...(nativePreviewMissing?{mcp:{...saved.mcp,previewManifest:config.mcp.previewManifest}}:{}), ...(!existingTokens.length ? { boundaries: config.boundaries } : {}) }, null, indent)}\n`);
232
+ updates.set(configFile, `${JSON.stringify({ ...saved, framework: selectedFramework }, null, indent)}\n`);
214
233
  }
215
234
  }
216
235
  // The framework's scenario mount, as the starter has it.
217
- addMissing(path.join(dsRoot, "showcase/mcp/main.tsx"), readFileSync(starterFile(selectedFramework, "design-system/showcase/mcp/main.tsx"), "utf8").replaceAll('"@ds"', JSON.stringify(config.publicAlias)));
236
+ addMissing(
237
+ path.join(dsRoot, "showcase/mcp/main.ads.mount.tsx"),
238
+ readFileSync(starterFile(selectedFramework, "design-system/showcase/mcp/main.ads.mount.tsx"), "utf8"),
239
+ );
240
+ // --include-starter: the starter's example design system and app files, where the project has none.
241
+ // The project's own package files and ADS's generated entries are never copied.
242
+ if (includeStarter) {
243
+ const skipped = new Set([
244
+ "package.json",
245
+ "package-lock.json",
246
+ "ds.config.json",
247
+ ".gitignore",
248
+ "gitignore.template",
249
+ "design-system/index.ts",
250
+ "design-system/review/index.ads.review.ts",
251
+ "design-system/styles.css",
252
+ ]);
253
+ const files = new Map();
254
+ for (const base of [starter, ...(selectedFramework === "react" ? [] : [fileURLToPath(new URL(`./starters/${selectedFramework}/`, import.meta.url))])])
255
+ for (const entry of readdirSync(base, { recursive: true, withFileTypes: true })) {
256
+ if (!entry.isFile()) continue;
257
+ const relative = path.relative(base, path.join(entry.parentPath, entry.name)).replaceAll("\\", "/");
258
+ if (!skipped.has(relative) && !relative.startsWith("node_modules/")) files.set(relative, path.join(base, relative));
259
+ }
260
+ for (const [relative, source] of files)
261
+ addMissing(
262
+ relative.startsWith("design-system/") ? path.join(dsRoot, relative.slice("design-system/".length)) : path.join(root, relative),
263
+ readFileSync(source),
264
+ );
265
+ }
218
266
  const ignoreFile = path.join(root, ".gitignore");
219
267
  assertLocalFile(root, ignoreFile);
220
- const ignore = existsSync(ignoreFile) ? readFileSync(ignoreFile, "utf8") : "";
221
- if (!ignore.split(/\r?\n/).some((line) => [".ds/", ".ds", "/.ds/", "/.ds"].includes(line))) updates.set(ignoreFile, `${ignore}${ignore && !ignore.endsWith("\n") ? "\n" : ""}.ds/\n`);
268
+ // A project without .gitignore takes the starter's with --include-starter (npm ships it as gitignore.template).
269
+ const starterIgnore = [".gitignore", "gitignore.template"].map((name) => path.join(starter, name)).find((file) => existsSync(file));
270
+ const ignore = existsSync(ignoreFile) ? readFileSync(ignoreFile, "utf8") : includeStarter && starterIgnore ? readFileSync(starterIgnore, "utf8") : "";
271
+ const ignoresDs = ignore.split(/\r?\n/).some((line) => [".ds/", ".ds", "/.ds/", "/.ds"].includes(line));
272
+ if (!ignoresDs) updates.set(ignoreFile, `${ignore}${ignore && !ignore.endsWith("\n") ? "\n" : ""}.ds/\n`);
273
+ else if (!existsSync(ignoreFile)) updates.set(ignoreFile, ignore);
222
274
  const indent = originalPackage.match(/\n([\t ]+)"/)?.[1] ?? " ";
223
275
  const nextPackage = `${JSON.stringify(pkg, null, indent)}\n`;
224
276
  if (nextPackage !== originalPackage) updates.set(packageFile, nextPackage);
225
277
  commit(root, updates);
226
- return { directory: root, framework: selectedFramework, packageManager: manager, toolDependency: { name: tool.name, spec }, updatedFiles: [...updates.keys()] };
278
+ // The styles entry and the barrels are generated from the token sheets and exports files.
279
+ commit(root, new Map((await generatedEntries(loadConfig(root))).map((entry) => [entry.file, entry.text])));
280
+ return {
281
+ directory: root,
282
+ framework: selectedFramework,
283
+ packageManager: manager,
284
+ toolDependency: { name: tool.name, spec },
285
+ updatedFiles: [...updates.keys()],
286
+ };
227
287
  }
@@ -10,7 +10,7 @@ export const investigationUri = entry => `ads://investigations/${encodeURICompon
10
10
  const ordinary = file => { try { return realpathSync(file)===path.resolve(file)&&lstatSync(file).isFile()&&lstatSync(file).nlink===1; } catch { return false; } };
11
11
  const digest = bytes => `sha256:${createHash("sha256").update(bytes).digest("hex")}`;
12
12
  function saved(root,runId) {
13
- if(runId!==undefined && (typeof runId!=="string" || !/^[a-zA-Z0-9_-]{1,100}$/.test(runId)))throw new Error("Invalid investigation run ID.");
13
+ if(runId!==undefined &&( typeof runId!=="string" || !/^[a-zA-Z0-9_-]{1,100}$/.test(runId)))throw new Error("Invalid investigation run ID.");
14
14
  const file=runId===undefined?indexFile(root):path.join(root,".ds/investigation-runs",`${runId}.json`);
15
15
  if(!ordinary(file)||lstatSync(file).size>2*1024*1024)return {};
16
16
  try {const value=JSON.parse(readFileSync(file,"utf8"));return value.schemaVersion===1&&value.bundles&&typeof value.bundles==="object"&&!Array.isArray(value.bundles)?value.bundles:{};}catch{return {};}
@@ -52,7 +52,7 @@ export function readInvestigation(root,{unit,check,runId}) {
52
52
  const latest=saved(root)[identity({unit,check})];
53
53
  const bundle=runId===undefined||latest?.runId===runId?latest:saved(root,runId)[identity({unit,check})];
54
54
  if(!bundle)throw new Error("No retained investigation exists for this check/run. It may have expired; discover current evidence with ads_behaviors.");
55
- return {...bundle,artifacts:(bundle.artifacts??[]).map(artifact=>({...artifact,available:!!artifactPath(root,artifact.path)}))};
55
+ return {...bundle,artifacts:(bundle.artifacts??[]).map( (artifact )=>({...artifact,available:!!artifactPath(root,artifact.path)}))};
56
56
  }
57
57
 
58
58
  export const investigationSections=["summary","details","requests","browserErrors","artifacts"];