@reqvire-org/ads 0.3.52 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (151) hide show
  1. package/README.md +10 -9
  2. package/dist/assets.mjs +16 -2
  3. package/dist/behaviors.mjs +6 -5
  4. package/dist/boundaries.mjs +5 -5
  5. package/dist/browser-audit/first-render.mjs +22 -0
  6. package/dist/browser-audit/image-shape.mjs +36 -0
  7. package/dist/browser-audit/render-states.mjs +61 -35
  8. package/dist/browser-audit/worker.mjs +47 -12
  9. package/dist/browser-audit.mjs +75 -12
  10. package/dist/bun-compiler.mjs +14 -7
  11. package/dist/check-service.mjs +83 -0
  12. package/dist/check.mjs +20 -18
  13. package/dist/cli.mjs +5 -3
  14. package/dist/config.mjs +20 -41
  15. package/dist/contracts.d.mts +9 -0
  16. package/dist/finding-rules.mjs +8 -1
  17. package/dist/font-rules.mjs +103 -0
  18. package/dist/fonts-generated.mjs +32 -12
  19. package/dist/generated-entries.mjs +131 -0
  20. package/dist/icons.mjs +1 -1
  21. package/dist/init.mjs +11 -32
  22. package/dist/layers.mjs +7 -3
  23. package/dist/lint-config.mjs +4 -2
  24. package/dist/mcp/catalog.mjs +2 -1
  25. package/dist/mcp/context.mjs +3 -3
  26. package/dist/mcp/drafts.mjs +136 -121
  27. package/dist/mcp/mutations.mjs +65 -19
  28. package/dist/mcp/preview-watch.mjs +31 -5
  29. package/dist/mcp/preview-widget.bundle.js +50 -47
  30. package/dist/mcp/project-widget.bundle.js +45 -42
  31. package/dist/mcp/prompts.mjs +1 -1
  32. package/dist/mcp/server.mjs +81 -40
  33. package/dist/mcp/showcase-host.mjs +20 -7
  34. package/dist/mcp/widget.bundle.js +49 -46
  35. package/dist/oxlint.mjs +3 -2
  36. package/dist/program-cache.mjs +36 -0
  37. package/dist/public-api.mjs +2 -1
  38. package/dist/scenarios-compiler.mjs +82 -14
  39. package/dist/scenarios-vite.mjs +1 -1
  40. package/dist/scenarios.mjs +4 -3
  41. package/dist/showcase/client.bundle.js +27 -27
  42. package/dist/showcase/index.html +2 -2
  43. package/dist/skills/ads-break-ui/SKILL.md +25 -28
  44. package/dist/skills/ads-break-ui/references/behaviors.md +7 -6
  45. package/dist/skills/ads-break-ui/references/captures.md +7 -32
  46. package/dist/skills/ads-break-ui/references/contracts.md +58 -25
  47. package/dist/skills/ads-break-ui/references/drafts.md +59 -43
  48. package/dist/skills/ads-break-ui/references/evidence.md +1 -1
  49. package/dist/skills/ads-break-ui/references/guarded-editing.md +58 -47
  50. package/dist/skills/ads-break-ui/references/review.md +9 -8
  51. package/dist/skills/ads-break-ui/references/scenarios.md +1 -1
  52. package/dist/skills/ads-break-ui/references/validation.md +8 -4
  53. package/dist/skills/ads-break-ui/references/workflows.md +15 -8
  54. package/dist/skills/ads-designer/SKILL.md +30 -31
  55. package/dist/skills/ads-designer/references/accessibility.md +9 -5
  56. package/dist/skills/ads-designer/references/behaviors.md +7 -6
  57. package/dist/skills/ads-designer/references/branding.md +2 -2
  58. package/dist/skills/ads-designer/references/captures.md +7 -32
  59. package/dist/skills/ads-designer/references/cli.md +5 -1
  60. package/dist/skills/ads-designer/references/contracts.md +58 -25
  61. package/dist/skills/ads-designer/references/drafts.md +59 -43
  62. package/dist/skills/ads-designer/references/evidence.md +1 -1
  63. package/dist/skills/ads-designer/references/guarded-editing.md +58 -47
  64. package/dist/skills/ads-designer/references/performance.md +57 -6
  65. package/dist/skills/ads-designer/references/review.md +9 -8
  66. package/dist/skills/ads-designer/references/scenarios.md +1 -1
  67. package/dist/skills/ads-designer/references/validation.md +8 -4
  68. package/dist/skills/ads-designer/references/workflows.md +15 -8
  69. package/dist/skills/ads-import/SKILL.md +25 -28
  70. package/dist/skills/ads-import/references/behaviors.md +7 -6
  71. package/dist/skills/ads-import/references/captures.md +7 -32
  72. package/dist/skills/ads-import/references/cli.md +5 -1
  73. package/dist/skills/ads-import/references/contracts.md +58 -25
  74. package/dist/skills/ads-import/references/drafts.md +59 -43
  75. package/dist/skills/ads-import/references/evidence.md +1 -1
  76. package/dist/skills/ads-import/references/guarded-editing.md +58 -47
  77. package/dist/skills/ads-import/references/review.md +9 -8
  78. package/dist/skills/ads-import/references/scenarios.md +1 -1
  79. package/dist/skills/ads-import/references/validation.md +8 -4
  80. package/dist/skills/ads-import/references/workflows.md +15 -8
  81. package/dist/skills/ads-motion/SKILL.md +25 -28
  82. package/dist/skills/ads-motion/references/behaviors.md +7 -6
  83. package/dist/skills/ads-motion/references/captures.md +7 -32
  84. package/dist/skills/ads-motion/references/contracts.md +58 -25
  85. package/dist/skills/ads-motion/references/drafts.md +59 -43
  86. package/dist/skills/ads-motion/references/evidence.md +1 -1
  87. package/dist/skills/ads-motion/references/guarded-editing.md +58 -47
  88. package/dist/skills/ads-motion/references/review.md +9 -8
  89. package/dist/skills/ads-motion/references/scenarios.md +1 -1
  90. package/dist/skills/ads-motion/references/validation.md +8 -4
  91. package/dist/skills/ads-motion/references/workflows.md +15 -8
  92. package/dist/skills/ads-port/SKILL.md +25 -28
  93. package/dist/skills/ads-port/references/behaviors.md +7 -6
  94. package/dist/skills/ads-port/references/captures.md +7 -32
  95. package/dist/skills/ads-port/references/cli.md +5 -1
  96. package/dist/skills/ads-port/references/contracts.md +58 -25
  97. package/dist/skills/ads-port/references/drafts.md +59 -43
  98. package/dist/skills/ads-port/references/evidence.md +1 -1
  99. package/dist/skills/ads-port/references/guarded-editing.md +58 -47
  100. package/dist/skills/ads-port/references/native-implementation.md +6 -6
  101. package/dist/skills/ads-port/references/review.md +9 -8
  102. package/dist/skills/ads-port/references/scenarios.md +1 -1
  103. package/dist/skills/ads-port/references/validation.md +8 -4
  104. package/dist/skills/ads-port/references/workflows.md +15 -8
  105. package/dist/starters/preact/design-system/components/Layout/Grid/Grid.ads.contract.ts +6 -0
  106. package/dist/starters/preact/design-system/review/token-preview/TokenPreview.ads.contract.ts +6 -0
  107. package/dist/starters/preact/ds.config.json +0 -14
  108. package/dist/starters/react/README.md +9 -5
  109. package/dist/starters/react/design-system/brand/Icons/AppIcon/AppIcon.ads.fixture.ts +1 -1
  110. package/dist/starters/react/design-system/brand/Identity/Logo/Logo.ads.fixture.ts +2 -2
  111. package/dist/starters/react/design-system/components/Actions/Button/Button.ads.exports.ts +1 -0
  112. package/dist/starters/react/design-system/components/Actions/IconButton/IconButton.ads.exports.ts +1 -0
  113. package/dist/starters/react/design-system/components/Content/Icon/Icon.ads.exports.ts +1 -0
  114. package/dist/starters/react/design-system/components/Content/Image/Image.ads.exports.ts +1 -0
  115. package/dist/starters/react/design-system/components/Content/Logo/Logo.ads.exports.ts +1 -0
  116. package/dist/starters/react/design-system/components/Content/Logo/Logo.tsx +2 -2
  117. package/dist/starters/react/design-system/components/Forms/TextField/TextField.ads.exports.ts +1 -0
  118. package/dist/starters/react/design-system/components/Layout/Grid/Grid.ads.contract.ts +6 -0
  119. package/dist/starters/react/design-system/components/Layout/Grid/Grid.ads.exports.ts +1 -0
  120. package/dist/starters/react/design-system/controllers/Palette/Palette.ads.exports.ts +1 -0
  121. package/dist/starters/react/design-system/index.ts +3 -7
  122. package/dist/starters/react/design-system/patterns/Search/SearchBar/SearchBar.ads.exports.ts +1 -0
  123. package/dist/starters/react/design-system/review/brand-preview/BrandPreview.ads.exports.ts +1 -0
  124. package/dist/starters/react/design-system/review/demo-frame/DemoFrame.ads.exports.ts +1 -0
  125. package/dist/starters/react/design-system/review/grid-cell/GridCell.ads.exports.ts +1 -0
  126. package/dist/starters/react/design-system/review/index.ts +4 -3
  127. package/dist/starters/react/design-system/review/screen-frame/ScreenFrame.ads.exports.ts +1 -0
  128. package/dist/starters/react/design-system/review/token-preview/TokenPreview.ads.contract.ts +6 -0
  129. package/dist/starters/react/design-system/review/token-preview/TokenPreview.ads.exports.ts +1 -0
  130. package/dist/starters/react/design-system/styles.css +1 -0
  131. package/dist/starters/react/ds.config.json +0 -14
  132. package/dist/style-boundaries.mjs +7 -6
  133. package/dist/test-boundaries.mjs +2 -2
  134. package/dist/themes-watch.mjs +9 -3
  135. package/dist/token-fixtures.mjs +1 -1
  136. package/dist/unit-contracts.mjs +38 -4
  137. package/dist/units.mjs +16 -91
  138. package/dist/validation-checks.mjs +7 -1
  139. package/docs/ADS.md +10 -10
  140. package/docs/ARCHITECTURE.md +104 -44
  141. package/docs/BEHAVIORS.md +8 -7
  142. package/docs/CACHING.md +15 -6
  143. package/docs/CHANGELOG.md +107 -12
  144. package/docs/COMPARISON.md +1 -1
  145. package/docs/CONTRACTS.md +10 -25
  146. package/docs/GUIDE.md +98 -57
  147. package/docs/MCP.md +116 -151
  148. package/package.json +7 -7
  149. package/dist/contract-migration.mjs +0 -110
  150. package/dist/mcp/draft-exports.mjs +0 -40
  151. package/dist/mcp/edit-preparation.mjs +0 -115
@@ -18,6 +18,12 @@ the enforceable contract, [GUIDE.md](GUIDE.md) covers tool integration, and the
18
18
 
19
19
  ## Shared tooling, project-owned design
20
20
 
21
+ Skills ship in the package and are served as an immutable snapshot, each file under
22
+ `skill://ads/<name>/`. Connections on protocol `2026-07-28` get the skills extension: entries with
23
+ verbatim frontmatter and complete manifests, each digest computed from the bytes served, and directory
24
+ reads. Earlier connections get the same files as ordinary resources and through tools. ADS serves
25
+ content; verification, approval and activation belong to the host.
26
+
21
27
  The shared layer supplies architectural rules, token definitions, checks,
22
28
  skills, and setup. Components, patterns, themes, and examples are authored in
23
29
  the project or brought in through explicit imports and adaptations.
@@ -279,8 +285,8 @@ checks retain their scope; it introduces no new package-CSS certification gate.
279
285
  For example, Floating UI's `computePosition` can supply `x` and `y` to an
280
286
  allowlisted producer's `style.setProperty("--ds-popover-x", ...)` and
281
287
  `style.setProperty("--ds-popover-y", ...)`; project Linaria owns positioning
282
- rules and visual treatment. Register those exact properties using the existing
283
- `boundaries.styleWrites` mechanism. Clean up positioning observers on unmount.
288
+ rules and visual treatment. Declare those exact properties in the owner contract's
289
+ `styles.writes`. Clean up positioning observers on unmount.
284
290
  The project preview compiler bundles used library code into the normal MCP App
285
291
  resource graph; declarations alone do not load packages or change its sandbox.
286
292
 
@@ -303,15 +309,40 @@ side effects, rather than the controller directory name.
303
309
 
304
310
  ## The showcase is the shared design workspace
305
311
 
306
- Iterative proposals use tracked `ads-drafts/` source and explicit `.ads`
307
- source, with canonical target mappings and baseline fingerprints. Production
308
- discovery/imports exclude drafts. Generated preview mirrors retain the normal
309
- project layout and public imports while overlaying proposed owner files and
310
- declared draft dependencies; their compiler stays alive across edits. Only these
311
- isolated mirrors skip acceptance validation for fast feedback. Acceptance uses
312
- the ordinary guarded candidate pipeline, fences the exact reviewed revision and
313
- rechecks live inputs before transactional publication. Pattern/composition and
314
- token-group draft dependencies resolve to normal accepted source after promotion.
312
+ Every MCP source change is a tracked proposal: `ads-drafts/` source in explicit
313
+ `.ads` files, with canonical target mappings and baseline fingerprints. Only
314
+ `ads_accept` of an exact draft revision writes accepted source. Production
315
+ discovery/imports exclude drafts.
316
+
317
+ Ownership makes drafts independent. Every authored file has one owner, and an owner
318
+ is in at most one open draft, so concurrent clients edit different owners and drafts
319
+ never share a file. A draft carries only its owners' files; a companion such as
320
+ `ds.config.json` joins when the draft changes it. Shared entries are generated from
321
+ owned files: the public barrel and review entry from each owner's
322
+ `<Owner>.ads.exports.ts` (its named re-exports, copied with rebased paths, so a product
323
+ build never includes an exports file), the styles entry from the canonical token sheets, the theme
324
+ files from the token halves. Style permissions live in the owner's contract. ADS
325
+ therefore never merges: if accepted source changes under a draft (a direct edit or a
326
+ Git pull), acceptance reports a baseline conflict and the draft is recreated.
327
+
328
+ There is one runtime and one compiler process per project. Generated preview
329
+ workspaces (`.ds/draft-previews/<id>/project`) retain the normal project layout and
330
+ public imports while overlaying proposed owner files and declared draft dependencies,
331
+ with the generated entries regenerated. The project's compiler process hosts each
332
+ draft workspace as an in-process instance listed in a control file, and one scheduler
333
+ runs their builds in turn: the viewed draft first, then the project, then background
334
+ work. A draft's preview is a view of its workspace served by the project's showcase,
335
+ in comparison (`?draft=<id>`) or alone (`/draft/<id>/`, the same client with that
336
+ workspace's MCP endpoint). Only these workspaces skip acceptance validation for fast
337
+ feedback. A draft's own edits and the viewed draft resync at once; other drafts
338
+ behind an accepted-source change catch up in the background.
339
+
340
+ Acceptance fences the exact reviewed revision, builds a candidate copy and rechecks
341
+ live inputs before publication. When the draft's workspace holds the same inputs as
342
+ the candidate, `ads check` and the browser renders run there, through the project's
343
+ compiler and host, so a dry run followed by acceptance of the same revision reuses its
344
+ check and audit results. Pattern/composition and token-group draft dependencies
345
+ resolve to normal accepted source after promotion.
315
346
  The [draft guide](../skills/ads-designer/references/drafts.md) defines lifecycle,
316
347
  completion requirements, build integration and recovery.
317
348
 
@@ -535,10 +566,10 @@ worker discovery; accepted comparison metadata is independently revision-fenced.
535
566
  The response's `discovery` distinguishes current, pending and failed metadata
536
567
  from the exact proposal revision and the actual preview build. Superseded worker
537
568
  results cannot replace newer requests; drop/shutdown retires their state/worker.
538
- Preview analysis retains a bounded set of TypeScript programs and unchanged
539
- source trees across edits; module lookups are refreshed so added/deleted files
540
- cannot inherit old resolution results. Full validation uses fresh independent
541
- analysis. Watched graphs include requested scenario roots and their dependencies,
569
+ Preview analysis and checks retain a bounded set of TypeScript programs and
570
+ unchanged source trees across edits (`program-cache.mjs`); module lookups are
571
+ refreshed so added/deleted files cannot inherit old resolution results, and a changed
572
+ file is always parsed again. Watched graphs include requested scenario roots and their dependencies,
542
573
  preserving roots used by other mounted Apps; untouched catalogue entries are not
543
574
  compiled until requested. Unwatched full builds retain complete entry coverage.
544
575
  Snapshot publication fences source edits during inspection. This cache supplies
@@ -609,10 +640,12 @@ of the accepted/draft preview lane. They never suspend Explorer's compiler or
609
640
  make a cold selection wait for a browser verification suite. Existing publications
610
641
  remain readable while interactive source changes compile.
611
642
 
612
- For managed resource previews, ADS requests all scenarios in production mode
613
- through that candidate's compiler. It closes an incremental Rollup graph before
614
- starting production compilation. The candidate compiler is parked after production publication, while its host
615
- continues serving that immutable graph to registered browser verification.
643
+ For managed resource previews, ADS requests the scenarios in production mode
644
+ through the reviewed draft's workspace, compiled by the project's compiler and
645
+ served by its host. Only a candidate without such a workspace gets a preview host
646
+ of its own; its compiler is parked after production publication while the host
647
+ continues serving that immutable graph to registered browser verification. Either
648
+ way the incremental graph is closed before production compilation starts.
616
649
  Warming an already-current selection does not restart or wait for that compiler.
617
650
  Production reuse requires a successful production build of the exact inputs,
618
651
  not merely a previously compiled development graph. Project-owned additional
@@ -709,9 +742,9 @@ sandboxed App the requested viewport. Project runtime, fonts and styles remain
709
742
  inside the App resource graph. The image excludes showcase chrome.
710
743
 
711
744
  Captures exist only when requested. `ads_capture` replaces current and removes any
712
- candidate for that scenario/target. Guarded patch/transaction dry runs can opt into
713
- `screenshot:true` with explicit selected captures: after the normal gates, ADS
714
- renders current and candidate under matching settings without changing live source.
745
+ candidate for that scenario/target; with a draft and its exact revision it renders
746
+ current and candidate under matching settings without changing live source.
747
+ Acceptance and its dry run take no screenshots.
715
748
  A new scenario has no fabricated baseline. Final freshness/conflict checks precede
716
749
  image publication. Matching accepted source promotes candidate to current.
717
750
 
@@ -802,8 +835,35 @@ that float above the layout (`layout.fixedWidthUnits`) in `ds.config.json`, and
802
835
  both for review; ADS knows a unit's layer, not whether it is an overlay, and there is no
803
836
  per-declaration exception. The browser
804
837
  audit adds what source cannot show: axe-core, non-text contrast of control borders and icons,
805
- and horizontal overflow at 390, 768 and 1280 px, by resizing each rendered scenario, and in a
806
- 240 px container for components and patterns, where a set width above the small-part limit must fit.
838
+ image shape and horizontal overflow at 390, 768 and 1280 px, by resizing each rendered scenario. It
839
+ also narrows components and patterns to a 240 px container: a set width above the small-part limit
840
+ that overflows it is a review item, since whether a part ever sits in a pane takes judgement.
841
+
842
+ Each render waits, bounded, for its content to settle before anything is measured, and says so when it
843
+ did not. The audit also renders what a scenario shows only after someone acts on it. It opens what
844
+ `aria-haspopup` controls open, and hovers and focuses controls for contrast. Each worker lists what
845
+ every render could measure, then assigns targets in request order, so which render measures a shared
846
+ control does not depend on page speed. Its result states what it covered, and what it skipped is an
847
+ info item per reason. `mcp.auditPages` (1–16, default 4) sets how many pages render at once.
848
+
849
+ The audit runs in two places. Draft acceptance audits per `acceptance.browserAudit`:
850
+ `"owners"` (default) the draft owners' own UI scenarios, `"affected"` every scenario
851
+ the change reaches through imports (all of them for shared configuration, foundation
852
+ or token changes), `false` none. The cost of an affected audit grows with how widely
853
+ the owner is used, so the full audit of everything a series of drafts reached runs as
854
+ a stage: `ads_validate` with the validation policy and `scope:"changed"`, before a
855
+ commit or release. A dry run's audit is remembered by candidate revision and selection,
856
+ so accepting that revision does not render again.
857
+
858
+ Static errors split by what they stop. A preview session the audit starts renders despite policy
859
+ errors, records no pass, and reports them with the audit's findings; the audit still exits non-zero.
860
+ Only errors that stop rendering block it (source and CSS syntax, project structure, the styles entry,
861
+ scenario contracts). `ads check`, `ads compile`, validation and acceptance stop on every error.
862
+
863
+ Fonts are read from `tokens/fonts.css` and `base.css`. `ads assets` generates a module naming the files
864
+ the first text uses, importing each plainly so that Vite, Bun and the preview compiler give the
865
+ stylesheet's URL. `ads check` holds declared faces against the weights CSS uses. ADS writes no HTML and
866
+ touches no hosting: the module's list, tags and header value are for the project to place.
807
867
 
808
868
  Static checks establish the policies and source formats they cover. Behavior
809
869
  tests and browser review verify the resulting accessibility, layout, themes,
@@ -876,18 +936,22 @@ Build reports expose queued, validation, compilation and publication progress.
876
936
  A timed-out preview request marks the builder stalled; the next explicit request
877
937
  restarts it within the same MCP session. A running process alone is not freshness.
878
938
 
879
- Opt-in MCP editing makes validation part of the write operation. The agent sends
880
- a Git unified diff for one logical ADS unit: its implementation and owned preview
881
- context, or the shared token foundation. ADS resolves file ownership, reconstructs
882
- candidate files locally and validates a temporary project copy with architecture
883
- checks, registered lint rules and project validation scripts.
939
+ Opt-in MCP editing makes validation part of the write operation. The agent edits a
940
+ draft of one or more owners (file contents or a Git unified diff) and accepts it. ADS
941
+ resolves file ownership, takes the draft's files as they are and validates a
942
+ temporary project copy with architecture checks, registered lint rules and project
943
+ validation scripts.
884
944
  The temporary copy contains the relevant input graph and patched files, with room
885
945
  for 100,000 files / 2 GiB. Unrelated native artifacts are not copied. Declared extra
886
946
  inputs support project commands that read data outside the UI graph. When
887
947
  `acceptance.behaviorChecks` is true, affected registered behavior checks, including
888
948
  consumers of a changed shared controller, run in the isolated candidate project.
889
- Architecture batch checks use the internal pinned Turbo runner and its installed
890
- platform binary; no global Turbo or runtime dependency installer is invoked. Local artifact
949
+ Architecture batch checks from the CLI and CI use the internal pinned Turbo runner
950
+ and its installed platform binary; no global Turbo or runtime dependency installer is
951
+ invoked. The MCP server and its preview compiler instead run them in one warm worker
952
+ thread (`check-service.mjs`): it keeps its TypeScript programs and parsed sources, so
953
+ a check after an edit reparses only what changed, and an exact repeat of the same
954
+ inputs returns the remembered passing report. Local artifact
891
955
  reuse is enabled by default and fenced by current input/tool/runtime/Git state;
892
956
  policy results, browser evidence, locks and baselines are never task outputs.
893
957
  Project scripts remain uncached without a known deterministic contract. The warm
@@ -944,18 +1008,15 @@ replace the managed process while retaining the MCP connection. Normal build gat
944
1008
  remain in place for source changes made through other editors; preview review remains
945
1009
  necessary after either editing path.
946
1010
 
947
- For genuinely coupled changes, a bounded transaction accepts one Git patch per
948
- distinct owner and validates a single complete candidate before publication.
949
- Each patch retains its ownership and companion rules. Local owner drafts remove
950
- the need for a separate project mirror; token-sample reconciliation preserves
951
- project bindings and reports unresolved mappings. Neither preparation changes live
952
- source or substitutes for guarded application and rendered review.
1011
+ Genuinely coupled owners share one draft (up to 64 owners), validated as a single
1012
+ complete candidate and published together. Token-sample reconciliation writes into
1013
+ a draft, preserves project bindings and reports unresolved mappings; it never
1014
+ changes live source or substitutes for rendered review and acceptance.
953
1015
 
954
- Required shared-entry bookkeeping can accompany its owner: component/pattern
955
- re-exports, canonical foundation imports for token files created or deleted, and
956
- only that owner’s style-boundary entries in project configuration in the same
957
- patch. ADS restricts these companion edits and validates the complete candidate
958
- before writing, so coupled changes do not need a guard bypass.
1016
+ No owner edits a shared entry. An owner's public names, its style permissions and its
1017
+ token sheets are its own files; ADS regenerates the barrels and the styles entry in
1018
+ the candidate, and deletes an empty `.gitkeep` itself when accepted source is added
1019
+ beneath it. Coupled changes therefore need no companion edits or guard bypass.
959
1020
 
960
1021
  The architecture makes that inspection practical. A public export has an owning
961
1022
  source and addressable preview coverage. Token definitions expose its visual
@@ -1056,8 +1117,7 @@ Shared token references remain visible across the project. Component state and
1056
1117
  implementation variables retain their existing ownership boundaries. Project checks
1057
1118
  may use `inspectTokenOrigins` to audit more specific shared alias relationships;
1058
1119
  core Data/UX/Skin separation does not depend on opting into such a check. ADS does
1059
- not hardcode a spacing scale or palette. Contract/file-role migration still uses
1060
- ordinary owner drafts, candidate gates and rollback.
1120
+ not hardcode a spacing scale or palette.
1061
1121
 
1062
1122
  Preview scheduling prunes standard generated output trees before allocating OS
1063
1123
  watches and computing source freshness. Explicit source roots retain priority;
package/docs/BEHAVIORS.md CHANGED
@@ -19,7 +19,8 @@ or assume a renderer/library supplied by an MCP host. The framework field select
19
19
  compilation/mounting; controller checks also validate runtime imports. Type-only
20
20
  UI references are allowed, but shared controllers cannot import component/pattern
21
21
  runtime implementations. Keep business data in application adapters. Measured
22
- style writes retain exact `boundaries.styleWrites` properties; they do not allow
22
+ style writes retain the exact properties declared in the owner contract's
23
+ `styles.writes`; they do not allow
23
24
  shared-token overrides or an extra styling layer.
24
25
  These gates inspect supported direct imports, markup and style boundaries.
25
26
  External package internals and delegated DOM behavior still require source,
@@ -28,7 +29,7 @@ build and browser review; declaring a dependency does not prove it is headless.
28
29
  Register owner behavior in `<Owner>.ads.contract.ts` with actual API and
29
30
  implementation references. The
30
31
  [contract reference](CONTRACTS.md) covers static authoring, `.ads.behavior.spec.ts`,
31
- declarative `exercises`, required browser checks and guarded migration.
32
+ declarative `exercises` and required browser checks.
32
33
  A contract declaration alone is not passing evidence. Use
33
34
  `auditBehaviorPaints(frame)` after relevant binding updates to repeat the current
34
35
  App's generic paint audit, in addition to assertions for the named guarantee.
@@ -36,7 +37,7 @@ App's generic paint audit, in addition to assertions for the named guarantee.
36
37
  ## Development boundary
37
38
 
38
39
  Production includes real components, controllers, tokens and compiled styles.
39
- Scenarios and fixtures are included only in previews. Behavior manifests and test
40
+ Scenarios and fixtures are included only in previews. Owner contracts and test
40
41
  files are development/tooling inputs. Runtime imports and public re-exports of
41
42
  those inputs are rejected, including dynamic imports and aliases.
42
43
 
@@ -378,10 +379,10 @@ When `acceptance.behaviorChecks` is true, guarded mutations execute affected
378
379
  registered behavior contracts after mandatory native ADS gates
379
380
  and configured project checks, before writing source. Imported shared
380
381
  controller changes also select dependent contracts conservatively. Rejected and
381
- dry-run patches publish no source changes. Verification output stays under `.ds/`.
382
- To check a prepared draft, request its diff and pass the returned `patchFile` to
383
- `ads_apply_patch` with `dryRun:true`. This checks the isolated candidate using the acceptance policy, including
384
- affected behavior contracts and their browser preview when enabled.
382
+ dry-run acceptances publish no source changes. Verification output stays under `.ds/`.
383
+ To check a draft, call `ads_accept({id, revision, dryRun:true})`. This checks the
384
+ candidate using the acceptance policy, including affected behavior contracts and
385
+ their browser preview when enabled, rendered through the project's own compiler.
385
386
  `validation.behaviorChecks` separately controls validation, while explicit
386
387
  `ads_verify` always runs requested tests. Candidate evidence
387
388
  is not persisted as passing evidence for live source. `ads_verify` selects checks
package/docs/CACHING.md CHANGED
@@ -1,11 +1,20 @@
1
1
  # Batch task caching
2
2
 
3
- ADS uses its pinned Turborepo dependency internally for architecture batch tasks.
4
- Projects do not install Turbo, create `turbo.json`, or choose between backends.
5
- Local caching is enabled out of the box for `ads check` and the source-check
6
- stages of validation, acceptance, guarded mutations and preview compilation.
7
- The synchronous exported `checkProject` function remains the analysis primitive;
8
- the CLI and managed execution paths use the internal task runner. ADS invokes
3
+ ADS uses its pinned Turborepo dependency internally for architecture batch tasks
4
+ run by the CLI and CI. Projects do not install Turbo, create `turbo.json`, or choose
5
+ between backends. Local caching is enabled out of the box for `ads check` and the
6
+ source-check stage of `ads validate`. The synchronous exported `checkProject`
7
+ function remains the analysis primitive.
8
+
9
+ The MCP server and its preview compiler do not start a Turbo task per check. They run
10
+ `ads check` in one warm worker thread (`check-service.mjs`) that keeps its TypeScript
11
+ programs and parsed sources (`program-cache.mjs`): a check after an edit reparses only
12
+ what changed, and an exact repeat of the same inputs (by the same content key the
13
+ Turbo task uses) returns the remembered passing report. Failing reports are not
14
+ remembered. Draft acceptance runs its check in the draft's preview workspace, a
15
+ stable path, so a dry run followed by acceptance of the same revision is an exact
16
+ repeat; the dry run's accessibility audit is likewise remembered by candidate
17
+ revision and scenario selection. ADS invokes
9
18
  the already-installed platform binary directly. It never runs Turbo's automatic
10
19
  repair installer; a missing binary reports `ADS_TASK_RUNTIME_MISSING` and asks
11
20
  for dependency reinstallation with optional platform packages enabled.
package/docs/CHANGELOG.md CHANGED
@@ -1,34 +1,129 @@
1
1
  # Changelog
2
2
 
3
- ## 0.3.52
3
+ ## 0.4.0
4
4
 
5
5
  <!-- ads-local-tests:start -->
6
- Local verification: **770/770 passed** with `ADS_TEST_BUN=1 npm test`.
7
- Tested commit: `adeddf07a52742b7c59489af892386db40d2cffa`; Node v24.13.0, Bun 1.4.1.
8
- Completed 2026-11-02T14:52:08.397Z (1076 seconds).
6
+ Local verification: **779/779 passed** with `ADS_TEST_BUN=1 npm test`.
7
+ Tested commit: `5fe8287d965f4138d4371a19f96d906c1be38bfc`; Node v24.13.0, Bun 1.4.1.
8
+ Completed 2026-11-04T02:37:52.914Z (2021 seconds).
9
9
 
10
10
  <!-- ads-local-test-proof
11
11
  {
12
12
  "schema": 1,
13
- "version": "0.3.52",
14
- "commit": "adeddf07a52742b7c59489af892386db40d2cffa",
15
- "sourceSha256": "50d65df97db4e4f86ab1f1973d7ec5fa0d5fb80facece575484116781df60e6c",
13
+ "version": "0.4.0",
14
+ "commit": "5fe8287d965f4138d4371a19f96d906c1be38bfc",
15
+ "sourceSha256": "a4566093dce1f89b0767ce73d1eae7ee7f41f01490409153cf9e302c32d0fa44",
16
16
  "command": "ADS_TEST_BUN=1 npm test",
17
17
  "result": "pass",
18
- "tests": 770,
19
- "pass": 770,
18
+ "tests": 779,
19
+ "pass": 779,
20
20
  "fail": 0,
21
21
  "cancelled": 0,
22
22
  "skipped": 0,
23
23
  "node": "v24.13.0",
24
24
  "bun": "1.4.1",
25
- "completedAt": "2026-11-02T14:52:08.397Z",
26
- "durationMs": 1075944,
27
- "logSha256": "b4c0f94cc4bfca21785e7f71b1042daa23d922a0ab5e0056b575e06054e83ba7"
25
+ "completedAt": "2026-11-04T02:37:52.914Z",
26
+ "durationMs": 2020694,
27
+ "logSha256": "1f6b98b02b780248fea700a41b2a2fd191622c7d002c7c93fc3819afe1d694fb"
28
28
  }
29
29
  -->
30
30
  <!-- ads-local-tests:end -->
31
31
 
32
+ - `mcp.previewBuildTimeoutMs` sets how long a preview waits for its build,
33
+ including the first build after the MCP server starts (1000–3600000 ms). The
34
+ default rises from 30 seconds to 5 minutes, so slower computers finish the
35
+ first build.
36
+ - Only `.ads.`-marked development files are recognized. Unmarked
37
+ `Scenario.tsx`, `*.scenario.*`, `*.fixture.*`, `behavior.json` and
38
+ `*.scenario-adapter.*` files are no longer read; behavior is declared in
39
+ `<Owner>.ads.contract.ts`.
40
+ - Drafts are the only MCP editing route: `ads_apply_patch`, `ads_apply_transaction`
41
+ and `ads_prepare_patch` are removed, and only `ads_accept` of an exact draft
42
+ revision writes accepted source. `ads_update_draft` takes a Git diff
43
+ (`patch`/`patchFile`) applied exactly to the draft. `ads_accept` takes `dryRun:true`.
44
+ `ads_prepare_token_samples` writes into a draft. Contract migration is removed.
45
+ - An owner is in at most one open draft, so concurrent clients edit different owners.
46
+ Drafts carry only their owners' files. `refresh` and three-way merging are removed:
47
+ a baseline conflict means the draft is dropped and recreated.
48
+ - Shared entries are generated. Each owner declares its public names in
49
+ `<Owner>.ads.exports.ts`; ADS writes the public barrel and review entry from them and
50
+ the styles entry from the token sheets, and `ads check` reports a stale or
51
+ hand-edited one (`generated-entry`). `ads init` stops before writing anything when it
52
+ finds a hand-written entry and says to move its exports into owners' exports files.
53
+ The generated barrel names each export directly from its source, so a product build
54
+ never includes an exports file, and it re-exports the generated font preloads
55
+ (`preloadFonts()` and the tag/header helpers) once `ads assets` has written
56
+ `tokens/fonts.preload.generated.ts`. ADS deletes an empty `.gitkeep` itself when
57
+ accepted source is added beneath it.
58
+ - Style permissions move from `ds.config.json` into the owner contract:
59
+ `styles.writes`, `styles.inline` and `customization` replace
60
+ `boundaries.styleWrites`, `inlineStyleFiles` and `boundaries.componentVariables`,
61
+ which are no longer accepted. Contracts are allowed for showcase owners. Application
62
+ code has no owner contract, so it gets no inline-style exception: measured geometry
63
+ belongs in a design-system owner that declares it.
64
+ - One runtime and one compiler per project. Draft previews are views of their
65
+ workspaces, compiled by the project's compiler process (viewed draft first) and
66
+ served by its showcase, alone at `/draft/<id>/`; no draft starts a server, port or
67
+ compiler. Acceptance checks and renders in the reviewed workspace. Other drafts
68
+ resync in the background. A custom compiler passes `runScenarioCompiler` a function of
69
+ the root, so the same process builds each draft with its own builder.
70
+ - `acceptance.browserAudit` is `"owners"` (default: the draft owners' own scenarios),
71
+ `"affected"` or `false`; the full audit of everything affected runs as a stage with
72
+ `ads_validate`. A dry run's check and audit are remembered for accepting the same
73
+ revision. `mcp.auditPages` (1–16, default 4) sets how many pages render at once.
74
+ - Faster checks: per-file facts are computed once in `ads check`, TypeScript programs
75
+ and parsed sources are reused across checks, the MCP server and compiler check in a
76
+ warm worker that remembers passing reports, and the scenario inspector stays warm
77
+ while previews are in use.
78
+
79
+ ## 0.3.53
80
+
81
+ - **Run `ads assets` once after upgrading.** The generated font module changed, so `ads check` fails it as
82
+ stale (`themes-generated`) until then.
83
+ - **`assets.preloadFonts` names the fonts to preload.** An array of `{ family, weight }` replaces the
84
+ reading of `base.css`; a variable range counts as a match. An entry `tokens/fonts.css` does not have
85
+ is a `font-preload-config` error. Without it, nothing changes.
86
+ - **`npm run build` syncs skill references** before it continues, so editing
87
+ `skills/ads-designer/references/` and building leaves every skill current. `lint:tool` run alone and
88
+ `release:verify` still fail on copies that differ, and the proof refuses a sync left uncommitted.
89
+ - **MCP SDKs updated, and skills checked against the final extension.** `@modelcontextprotocol/server` and
90
+ `client` 2.4.0, `ext-apps` 2.0.4, `sdk` 1.32.2. `skills/list` now returns all skills at once instead of
91
+ two per page, and `resources/directory/read` now carries `ttlMs` and `cacheScope`.
92
+ - **The audit measures settled content.** It waits, up to 5 s, for no change in the scenario for 500 ms,
93
+ no finite animation and nothing loading, so colours that land after first render are measured every
94
+ run. A page that never settles is a `content-still-changing` info item.
95
+ - **Font rules.** New errors: `font-weight-missing` for a weight no face in `tokens/fonts.css` covers, and
96
+ `asset-font-budget` for a file above 150 KB (`assets.fontBudgetKb`). New review items: `font-file-unused`,
97
+ `font-display` (none or `optional`), `font-format` (not WOFF2). Weight ranges and faces with no
98
+ `font-weight` cover what they span. System-font projects get none of this. Run `ads assets` to
99
+ regenerate the preload module.
100
+ - **Plain `bun build` works with generated fonts and the starter Logo.** The generated module and the
101
+ starter import files plainly, not with `?url`, which Bun cannot resolve. Vite and the preview compiler
102
+ read both.
103
+ - **Early font preloads.** The generated module adds `fontPreloadTags()` and `fontPreloadHeader()`, for a
104
+ build step or prerender to put the exact URLs in HTML or a `Link` header. It still selects the same
105
+ files.
106
+ - **The performance guide** covers font choices and preloading, image shape and theme pairs, width caps,
107
+ and how to read Lighthouse.
108
+ - **The audit says what it covers.** A new line reports renders, overlays opened and controls measured,
109
+ and the result gains `coverage`. What was skipped is an info item per reason (`browser-audit-skipped`):
110
+ an overlay that did not open, a trigger or control that left the page or timed out, a cap reached
111
+ with no other scenario holding those targets. A render that could measure none of its targets is
112
+ a `browser-audit-nothing-measured` review item. A page that fails to render stays a `browser-audit` error.
113
+ - **Coverage is the same each run.** A shared control or trigger is now measured by the first scenario in
114
+ request order, not the first page to load, which also fixes which scenario a shared finding names.
115
+ Brands no longer share that bookkeeping. Controls that failed no longer count as measured. An overlay
116
+ whose element a closed one left behind now counts as opening, a trigger gets a second click, and a
117
+ focus outline is read after its transition.
118
+ - **The focus check skips what a keyboard cannot reach:** `aria-hidden` on it or an ancestor, `inert`, and
119
+ `tabindex="-1"` outside a composite widget that holds a `tabindex="0"`. Hover is still measured.
120
+ - **New `img-shape` error.** The audit fails a visible image whose box differs from its CSS `aspect-ratio`,
121
+ or, with none and `object-fit: fill`, from its `width` and `height`. A height attribute beats
122
+ `aspect-ratio` unless the CSS says `height: auto`, so such an image reserves its space and passes
123
+ `layout-shift` while cropped.
124
+
125
+ ## 0.3.52
126
+
32
127
  - **The audit opens overlays.** It clicks each distinct `aria-haspopup` control, up to 3 per render,
33
128
  and runs axe, non-text contrast and a phone-width check on what opens, in every theme. An overlay a
34
129
  scenario renders open is measured the same way. Results name the state, such as
@@ -26,7 +26,7 @@ built-in workflows. "Custom setup" means additional project tooling or integrati
26
26
  | **Agent access** | Varies; MUI provides documentation MCP. [Docs](https://mui.com/material-ui/getting-started/mcp/) | MCP registry browsing, search and installation. [Docs](https://ui.shadcn.com/docs/mcp) | MCP access to the actual project's APIs, tokens, source, rendered UI, diagnostics and verification |
27
27
  | **Enforced shared design values** | Theme APIs and conventions; additional enforcement requires setup | Theme variables and conventions; additional enforcement requires setup | Guards enforce shared design-value ownership and token references |
28
28
  | **Enforced architectural boundaries** | Custom setup | Custom setup | Checks dependency direction, public APIs, style ownership and application/development separation |
29
- | **Guarded agent edits** | Project editing and CI workflow | Source editing plus project checks | Owner-scoped Git patches and coupled transactions validated before application. [Contract](MCP.md#guarded-editing) |
29
+ | **Guarded agent edits** | Project editing and CI workflow | Source editing plus project checks | Owner-scoped drafts (file contents or Git patches), one open draft per owner, validated before acceptance. [Contract](MCP.md#guarded-editing) |
30
30
  | **Behavior contracts and evidence** | Custom project integration | Custom project integration | Registered guarantees, configured checks and current execution evidence |
31
31
  | **Current/candidate screenshots through MCP** | Custom integration | Custom integration | On-demand captures and visual comparison during patch dry runs |
32
32
  | **Import compatibility and adaptation** | Project-managed integration | Registry delivery followed by project adaptation | Agent-led destination assessment and adaptation, followed by destination guards and verification |
package/docs/CONTRACTS.md CHANGED
@@ -259,34 +259,19 @@ Shared token samples belong under the token directory. See
259
259
  project-specific audits of shared alias relationships. It supplements mandatory
260
260
  core source checks and does not enable independent local values.
261
261
 
262
- ## Migration and MCP editing
262
+ ## MCP editing
263
263
 
264
- Use the static owner contract for new registrations. Competing declarations fail.
264
+ The static owner contract is the only token, paint, declarative-part and behavior
265
+ registration. Competing declarations fail.
265
266
  Contracts participate in discovery, ownership, source revisions, affected-check
266
267
  selection and candidate gates. `ads_units` exposes `contractFile`; `ads_catalog`
267
268
  reports constrained paint paths and declarative parent/consumer/check references.
268
269
  Use bounded file reads and paged detailed results, not repeated whole-project dumps.
269
270
 
270
- Install supporting ADS tooling before migrating a consuming project and reconnect
271
- MCP before replacing a package used by a running server. Then:
272
-
273
- 1. Discover one owner with `ads_units`.
274
- 2. `ads_prepare_patch({ unit, action: "migrate" })` creates a normal local draft.
275
- 3. Review the converted contract, renamed files/imports and migration notes.
276
- 4. `ads_prepare_patch({ unit, action: "diff", draft })` emits its Git patchFile.
277
- 5. Dry-run/apply with `ads_apply_patch`, or a genuinely coupled transaction.
278
-
279
- Migration never edits live source or bypasses gates. It retains stable scenario
280
- IDs, check case IDs and directory ownership. A canonical `<Owner>.ads.scenario.tsx` is the same
281
- development entry as `Scenario.tsx`, even without a production entry or owner
282
- contract. Explicit flat IDs and existing flat peer families remain separate.
283
- An optional static `scenario.id` preserves a legacy
284
- identity when a renamed filename would otherwise be ambiguous; it must stay
285
- inside the owning unit and be unique. Whole-file or unimportable private behavior subjects stay
286
- in legacy registration with a note until deliberately resolved. Unknown runner
287
- globs, custom adapters and documentation references require review. Ambiguous
288
- flat-to-directory renames stay in the legacy form with a migration note so file
289
- ownership cannot silently change. Preserve
290
- licenses, pending drafts and unrelated work; keep transactions within their limits.
291
- There is no alternate JSON contract editor. Do not loosen a guard or make a valid
292
- API private merely to complete a migration.
271
+ A canonical `<Dir>/<Dir>.ads.scenario.tsx` is the development entry of the
272
+ directory owner `<Dir>`, even without a production entry or owner contract. In a
273
+ folder without that entry, each `<Owner>.ads.scenario.tsx` belongs to its own flat
274
+ owner, and an explicit flat `scenario.id` (`<Dir>/<Dir>`) keeps the canonical file
275
+ a flat entry. An optional static `scenario.id` keeps an identity stable when a
276
+ renamed filename would otherwise be ambiguous; it must stay inside the owning unit
277
+ and be unique.