@reqvire-org/ads 0.3.53 → 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 (138) hide show
  1. package/README.md +9 -8
  2. package/dist/assets.mjs +1 -1
  3. package/dist/behaviors.mjs +6 -5
  4. package/dist/boundaries.mjs +5 -5
  5. package/dist/browser-audit.mjs +10 -5
  6. package/dist/bun-compiler.mjs +14 -7
  7. package/dist/check-service.mjs +83 -0
  8. package/dist/check.mjs +16 -17
  9. package/dist/cli.mjs +4 -2
  10. package/dist/config.mjs +17 -40
  11. package/dist/contracts.d.mts +9 -0
  12. package/dist/fonts-generated.mjs +2 -0
  13. package/dist/generated-entries.mjs +131 -0
  14. package/dist/icons.mjs +1 -1
  15. package/dist/init.mjs +11 -32
  16. package/dist/layers.mjs +7 -3
  17. package/dist/lint-config.mjs +4 -2
  18. package/dist/mcp/catalog.mjs +2 -1
  19. package/dist/mcp/context.mjs +3 -3
  20. package/dist/mcp/drafts.mjs +136 -121
  21. package/dist/mcp/mutations.mjs +65 -19
  22. package/dist/mcp/preview-watch.mjs +31 -5
  23. package/dist/mcp/prompts.mjs +1 -1
  24. package/dist/mcp/server.mjs +79 -38
  25. package/dist/mcp/showcase-host.mjs +20 -7
  26. package/dist/oxlint.mjs +3 -2
  27. package/dist/program-cache.mjs +36 -0
  28. package/dist/public-api.mjs +2 -1
  29. package/dist/scenarios-compiler.mjs +82 -14
  30. package/dist/scenarios-vite.mjs +1 -1
  31. package/dist/scenarios.mjs +4 -3
  32. package/dist/showcase/client.bundle.js +1 -1
  33. package/dist/showcase/index.html +2 -2
  34. package/dist/skills/ads-break-ui/SKILL.md +25 -28
  35. package/dist/skills/ads-break-ui/references/behaviors.md +7 -6
  36. package/dist/skills/ads-break-ui/references/captures.md +7 -32
  37. package/dist/skills/ads-break-ui/references/contracts.md +58 -25
  38. package/dist/skills/ads-break-ui/references/drafts.md +59 -43
  39. package/dist/skills/ads-break-ui/references/evidence.md +1 -1
  40. package/dist/skills/ads-break-ui/references/guarded-editing.md +58 -47
  41. package/dist/skills/ads-break-ui/references/review.md +9 -8
  42. package/dist/skills/ads-break-ui/references/scenarios.md +1 -1
  43. package/dist/skills/ads-break-ui/references/validation.md +8 -4
  44. package/dist/skills/ads-break-ui/references/workflows.md +15 -8
  45. package/dist/skills/ads-designer/SKILL.md +25 -28
  46. package/dist/skills/ads-designer/references/accessibility.md +9 -5
  47. package/dist/skills/ads-designer/references/behaviors.md +7 -6
  48. package/dist/skills/ads-designer/references/captures.md +7 -32
  49. package/dist/skills/ads-designer/references/cli.md +5 -1
  50. package/dist/skills/ads-designer/references/contracts.md +58 -25
  51. package/dist/skills/ads-designer/references/drafts.md +59 -43
  52. package/dist/skills/ads-designer/references/evidence.md +1 -1
  53. package/dist/skills/ads-designer/references/guarded-editing.md +58 -47
  54. package/dist/skills/ads-designer/references/performance.md +3 -2
  55. package/dist/skills/ads-designer/references/review.md +9 -8
  56. package/dist/skills/ads-designer/references/scenarios.md +1 -1
  57. package/dist/skills/ads-designer/references/validation.md +8 -4
  58. package/dist/skills/ads-designer/references/workflows.md +15 -8
  59. package/dist/skills/ads-import/SKILL.md +25 -28
  60. package/dist/skills/ads-import/references/behaviors.md +7 -6
  61. package/dist/skills/ads-import/references/captures.md +7 -32
  62. package/dist/skills/ads-import/references/cli.md +5 -1
  63. package/dist/skills/ads-import/references/contracts.md +58 -25
  64. package/dist/skills/ads-import/references/drafts.md +59 -43
  65. package/dist/skills/ads-import/references/evidence.md +1 -1
  66. package/dist/skills/ads-import/references/guarded-editing.md +58 -47
  67. package/dist/skills/ads-import/references/review.md +9 -8
  68. package/dist/skills/ads-import/references/scenarios.md +1 -1
  69. package/dist/skills/ads-import/references/validation.md +8 -4
  70. package/dist/skills/ads-import/references/workflows.md +15 -8
  71. package/dist/skills/ads-motion/SKILL.md +25 -28
  72. package/dist/skills/ads-motion/references/behaviors.md +7 -6
  73. package/dist/skills/ads-motion/references/captures.md +7 -32
  74. package/dist/skills/ads-motion/references/contracts.md +58 -25
  75. package/dist/skills/ads-motion/references/drafts.md +59 -43
  76. package/dist/skills/ads-motion/references/evidence.md +1 -1
  77. package/dist/skills/ads-motion/references/guarded-editing.md +58 -47
  78. package/dist/skills/ads-motion/references/review.md +9 -8
  79. package/dist/skills/ads-motion/references/scenarios.md +1 -1
  80. package/dist/skills/ads-motion/references/validation.md +8 -4
  81. package/dist/skills/ads-motion/references/workflows.md +15 -8
  82. package/dist/skills/ads-port/SKILL.md +25 -28
  83. package/dist/skills/ads-port/references/behaviors.md +7 -6
  84. package/dist/skills/ads-port/references/captures.md +7 -32
  85. package/dist/skills/ads-port/references/cli.md +5 -1
  86. package/dist/skills/ads-port/references/contracts.md +58 -25
  87. package/dist/skills/ads-port/references/drafts.md +59 -43
  88. package/dist/skills/ads-port/references/evidence.md +1 -1
  89. package/dist/skills/ads-port/references/guarded-editing.md +58 -47
  90. package/dist/skills/ads-port/references/native-implementation.md +6 -6
  91. package/dist/skills/ads-port/references/review.md +9 -8
  92. package/dist/skills/ads-port/references/scenarios.md +1 -1
  93. package/dist/skills/ads-port/references/validation.md +8 -4
  94. package/dist/skills/ads-port/references/workflows.md +15 -8
  95. package/dist/starters/preact/design-system/components/Layout/Grid/Grid.ads.contract.ts +6 -0
  96. package/dist/starters/preact/design-system/review/token-preview/TokenPreview.ads.contract.ts +6 -0
  97. package/dist/starters/preact/ds.config.json +0 -14
  98. package/dist/starters/react/README.md +9 -5
  99. package/dist/starters/react/design-system/components/Actions/Button/Button.ads.exports.ts +1 -0
  100. package/dist/starters/react/design-system/components/Actions/IconButton/IconButton.ads.exports.ts +1 -0
  101. package/dist/starters/react/design-system/components/Content/Icon/Icon.ads.exports.ts +1 -0
  102. package/dist/starters/react/design-system/components/Content/Image/Image.ads.exports.ts +1 -0
  103. package/dist/starters/react/design-system/components/Content/Logo/Logo.ads.exports.ts +1 -0
  104. package/dist/starters/react/design-system/components/Forms/TextField/TextField.ads.exports.ts +1 -0
  105. package/dist/starters/react/design-system/components/Layout/Grid/Grid.ads.contract.ts +6 -0
  106. package/dist/starters/react/design-system/components/Layout/Grid/Grid.ads.exports.ts +1 -0
  107. package/dist/starters/react/design-system/controllers/Palette/Palette.ads.exports.ts +1 -0
  108. package/dist/starters/react/design-system/index.ts +3 -7
  109. package/dist/starters/react/design-system/patterns/Search/SearchBar/SearchBar.ads.exports.ts +1 -0
  110. package/dist/starters/react/design-system/review/brand-preview/BrandPreview.ads.exports.ts +1 -0
  111. package/dist/starters/react/design-system/review/demo-frame/DemoFrame.ads.exports.ts +1 -0
  112. package/dist/starters/react/design-system/review/grid-cell/GridCell.ads.exports.ts +1 -0
  113. package/dist/starters/react/design-system/review/index.ts +4 -3
  114. package/dist/starters/react/design-system/review/screen-frame/ScreenFrame.ads.exports.ts +1 -0
  115. package/dist/starters/react/design-system/review/token-preview/TokenPreview.ads.contract.ts +6 -0
  116. package/dist/starters/react/design-system/review/token-preview/TokenPreview.ads.exports.ts +1 -0
  117. package/dist/starters/react/design-system/styles.css +1 -0
  118. package/dist/starters/react/ds.config.json +0 -14
  119. package/dist/style-boundaries.mjs +7 -6
  120. package/dist/test-boundaries.mjs +2 -2
  121. package/dist/themes-watch.mjs +9 -3
  122. package/dist/token-fixtures.mjs +1 -1
  123. package/dist/unit-contracts.mjs +38 -4
  124. package/dist/units.mjs +16 -91
  125. package/dist/validation-checks.mjs +7 -1
  126. package/docs/ADS.md +10 -10
  127. package/docs/ARCHITECTURE.md +79 -43
  128. package/docs/BEHAVIORS.md +8 -7
  129. package/docs/CACHING.md +15 -6
  130. package/docs/CHANGELOG.md +61 -12
  131. package/docs/COMPARISON.md +1 -1
  132. package/docs/CONTRACTS.md +10 -25
  133. package/docs/GUIDE.md +64 -55
  134. package/docs/MCP.md +116 -151
  135. package/package.json +1 -1
  136. package/dist/contract-migration.mjs +0 -110
  137. package/dist/mcp/draft-exports.mjs +0 -40
  138. package/dist/mcp/edit-preparation.mjs +0 -115
@@ -285,8 +285,8 @@ checks retain their scope; it introduces no new package-CSS certification gate.
285
285
  For example, Floating UI's `computePosition` can supply `x` and `y` to an
286
286
  allowlisted producer's `style.setProperty("--ds-popover-x", ...)` and
287
287
  `style.setProperty("--ds-popover-y", ...)`; project Linaria owns positioning
288
- rules and visual treatment. Register those exact properties using the existing
289
- `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.
290
290
  The project preview compiler bundles used library code into the normal MCP App
291
291
  resource graph; declarations alone do not load packages or change its sandbox.
292
292
 
@@ -309,15 +309,40 @@ side effects, rather than the controller directory name.
309
309
 
310
310
  ## The showcase is the shared design workspace
311
311
 
312
- Iterative proposals use tracked `ads-drafts/` source and explicit `.ads`
313
- source, with canonical target mappings and baseline fingerprints. Production
314
- discovery/imports exclude drafts. Generated preview mirrors retain the normal
315
- project layout and public imports while overlaying proposed owner files and
316
- declared draft dependencies; their compiler stays alive across edits. Only these
317
- isolated mirrors skip acceptance validation for fast feedback. Acceptance uses
318
- the ordinary guarded candidate pipeline, fences the exact reviewed revision and
319
- rechecks live inputs before transactional publication. Pattern/composition and
320
- 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.
321
346
  The [draft guide](../skills/ads-designer/references/drafts.md) defines lifecycle,
322
347
  completion requirements, build integration and recovery.
323
348
 
@@ -541,10 +566,10 @@ worker discovery; accepted comparison metadata is independently revision-fenced.
541
566
  The response's `discovery` distinguishes current, pending and failed metadata
542
567
  from the exact proposal revision and the actual preview build. Superseded worker
543
568
  results cannot replace newer requests; drop/shutdown retires their state/worker.
544
- Preview analysis retains a bounded set of TypeScript programs and unchanged
545
- source trees across edits; module lookups are refreshed so added/deleted files
546
- cannot inherit old resolution results. Full validation uses fresh independent
547
- 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,
548
573
  preserving roots used by other mounted Apps; untouched catalogue entries are not
549
574
  compiled until requested. Unwatched full builds retain complete entry coverage.
550
575
  Snapshot publication fences source edits during inspection. This cache supplies
@@ -615,10 +640,12 @@ of the accepted/draft preview lane. They never suspend Explorer's compiler or
615
640
  make a cold selection wait for a browser verification suite. Existing publications
616
641
  remain readable while interactive source changes compile.
617
642
 
618
- For managed resource previews, ADS requests all scenarios in production mode
619
- through that candidate's compiler. It closes an incremental Rollup graph before
620
- starting production compilation. The candidate compiler is parked after production publication, while its host
621
- 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.
622
649
  Warming an already-current selection does not restart or wait for that compiler.
623
650
  Production reuse requires a successful production build of the exact inputs,
624
651
  not merely a previously compiled development graph. Project-owned additional
@@ -715,9 +742,9 @@ sandboxed App the requested viewport. Project runtime, fonts and styles remain
715
742
  inside the App resource graph. The image excludes showcase chrome.
716
743
 
717
744
  Captures exist only when requested. `ads_capture` replaces current and removes any
718
- candidate for that scenario/target. Guarded patch/transaction dry runs can opt into
719
- `screenshot:true` with explicit selected captures: after the normal gates, ADS
720
- 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.
721
748
  A new scenario has no fabricated baseline. Final freshness/conflict checks precede
722
749
  image publication. Matching accepted source promotes candidate to current.
723
750
 
@@ -817,7 +844,16 @@ did not. The audit also renders what a scenario shows only after someone acts on
817
844
  `aria-haspopup` controls open, and hovers and focuses controls for contrast. Each worker lists what
818
845
  every render could measure, then assigns targets in request order, so which render measures a shared
819
846
  control does not depend on page speed. Its result states what it covered, and what it skipped is an
820
- info item per reason.
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.
821
857
 
822
858
  Static errors split by what they stop. A preview session the audit starts renders despite policy
823
859
  errors, records no pass, and reports them with the audit's findings; the audit still exits non-zero.
@@ -900,18 +936,22 @@ Build reports expose queued, validation, compilation and publication progress.
900
936
  A timed-out preview request marks the builder stalled; the next explicit request
901
937
  restarts it within the same MCP session. A running process alone is not freshness.
902
938
 
903
- Opt-in MCP editing makes validation part of the write operation. The agent sends
904
- a Git unified diff for one logical ADS unit: its implementation and owned preview
905
- context, or the shared token foundation. ADS resolves file ownership, reconstructs
906
- candidate files locally and validates a temporary project copy with architecture
907
- 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.
908
944
  The temporary copy contains the relevant input graph and patched files, with room
909
945
  for 100,000 files / 2 GiB. Unrelated native artifacts are not copied. Declared extra
910
946
  inputs support project commands that read data outside the UI graph. When
911
947
  `acceptance.behaviorChecks` is true, affected registered behavior checks, including
912
948
  consumers of a changed shared controller, run in the isolated candidate project.
913
- Architecture batch checks use the internal pinned Turbo runner and its installed
914
- 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
915
955
  reuse is enabled by default and fenced by current input/tool/runtime/Git state;
916
956
  policy results, browser evidence, locks and baselines are never task outputs.
917
957
  Project scripts remain uncached without a known deterministic contract. The warm
@@ -968,18 +1008,15 @@ replace the managed process while retaining the MCP connection. Normal build gat
968
1008
  remain in place for source changes made through other editors; preview review remains
969
1009
  necessary after either editing path.
970
1010
 
971
- For genuinely coupled changes, a bounded transaction accepts one Git patch per
972
- distinct owner and validates a single complete candidate before publication.
973
- Each patch retains its ownership and companion rules. Local owner drafts remove
974
- the need for a separate project mirror; token-sample reconciliation preserves
975
- project bindings and reports unresolved mappings. Neither preparation changes live
976
- 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.
977
1015
 
978
- Required shared-entry bookkeeping can accompany its owner: component/pattern
979
- re-exports, canonical foundation imports for token files created or deleted, and
980
- only that owner’s style-boundary entries in project configuration in the same
981
- patch. ADS restricts these companion edits and validates the complete candidate
982
- 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.
983
1020
 
984
1021
  The architecture makes that inspection practical. A public export has an owning
985
1022
  source and addressable preview coverage. Token definitions expose its visual
@@ -1080,8 +1117,7 @@ Shared token references remain visible across the project. Component state and
1080
1117
  implementation variables retain their existing ownership boundaries. Project checks
1081
1118
  may use `inspectTokenOrigins` to audit more specific shared alias relationships;
1082
1119
  core Data/UX/Skin separation does not depend on opting into such a check. ADS does
1083
- not hardcode a spacing scale or palette. Contract/file-role migration still uses
1084
- ordinary owner drafts, candidate gates and rollback.
1120
+ not hardcode a spacing scale or palette.
1085
1121
 
1086
1122
  Preview scheduling prunes standard generated output trees before allocating OS
1087
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,83 @@
1
1
  # Changelog
2
2
 
3
- ## 0.3.53
3
+ ## 0.4.0
4
4
 
5
5
  <!-- ads-local-tests:start -->
6
- Local verification: **783/783 passed** with `ADS_TEST_BUN=1 npm test`.
7
- Tested commit: `8f3a806ac725a95486d5a607e67b6ec4e534c8f4`; Node v24.13.0, Bun 1.4.1.
8
- Completed 2026-11-03T00:48:45.537Z (1159 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.53",
14
- "commit": "8f3a806ac725a95486d5a607e67b6ec4e534c8f4",
15
- "sourceSha256": "45f075cbced8c463385133739ed676adc4cd15954e507c946ecec8f73f71c545",
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": 783,
19
- "pass": 783,
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-03T00:48:45.537Z",
26
- "durationMs": 1158876,
27
- "logSha256": "43e59421b92a927e4319b81a0aab98cb51e0f38d227ffc7f8be166d68d0b368c"
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
+
32
81
  - **Run `ads assets` once after upgrading.** The generated font module changed, so `ads check` fails it as
33
82
  stale (`themes-generated`) until then.
34
83
  - **`assets.preloadFonts` names the fonts to preload.** An array of `{ family, weight }` replaces the
@@ -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.