@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
@@ -18,10 +18,11 @@ inside the preview App with the project's framework, foundation, fonts and style
18
18
  Nothing depends on particular helper names or an imported component library.
19
19
 
20
20
  The development entry defaults to `review/index.ts` relative to `dsDir`; configure
21
- `reviewEntry` for another script inside `review/`. Its import alias is the
21
+ `reviewEntry` for another script inside `review/`. ADS generates it from the review
22
+ owners' `<Owner>.ads.exports.ts` files; never edit it by hand. Its import alias is the
22
23
  configured `publicAlias` plus `/review`, normally `@ds/review`. Discover the actual
23
- entry/alias through `ads_status.project.review`. Export helpers there, never from
24
- the production public barrel. Review implementations, types and styles must not
24
+ entry/alias through `ads_status.project.review`. Declare a review helper's exports in
25
+ its own exports file, never in a product owner's. Review implementations, types and styles must not
25
26
  enter application, component, pattern or controller dependencies. Tests, fixtures,
26
27
  scenarios and preview mounts can consume review code.
27
28
 
@@ -74,11 +75,11 @@ Production entrypoints never import the development entry. Inspect the product
74
75
  bundle for review modules/CSS; passing static checks does not prove bundle parity.
75
76
 
76
77
  Use `ads_units` for `review/<Owner>` units. Scenarios, local specs and helper files
77
- follow ordinary flat/directory ownership. A review patch may update only its own
78
- re-exports in the development entry and its own documented style boundaries.
79
- Product owners retain the separate production entry companion. Use prepared
80
- patches/dry runs and coupled transactions as described in
81
- [guarded-editing.md](guarded-editing.md); do not bypass a rejected mutation.
78
+ follow ordinary flat/directory ownership. A review owner declares its public
79
+ names in its own `<Owner>.ads.exports.ts`, from which ADS generates the development
80
+ entry, and its own style permissions in its contract. Use drafts and acceptance dry
81
+ runs as described in [guarded-editing.md](guarded-editing.md); do not bypass a
82
+ rejected acceptance.
82
83
 
83
84
  For an existing project, identify helpers by responsibility and actual consumers,
84
85
  not names or the number of imported components. Preserve real application patterns.
@@ -95,7 +95,7 @@ export function Frame({ visible = true } = {}) {
95
95
  return <section>{visible && <Part />}</section>;
96
96
  }
97
97
 
98
- // Colocated Scenario.tsx
98
+ // Colocated Frame.ads.scenario.tsx
99
99
  import { Frame } from "@ds";
100
100
  export const scenario = { title: "Frame", covers: ["Frame", "Part"] };
101
101
  export default function Scenario() { return <Frame />; }
@@ -41,9 +41,12 @@ implicitly requiring them at acceptance.
41
41
  all registered behavior checks. Use before a release, after ownership/test/config
42
42
  migrations and for an explicit complete audit. Changed scope narrows registered
43
43
  owners while project scripts and core gates retain full scope.
44
- - Both policies run the axe-core audit of every rendered UI scenario in every brand
45
- and theme (`browser-accessibility-audit`); `browserAudit: false` turns it off for
46
- that policy. An `a11y-incomplete` info item means axe could not decide that rule on those elements: check it by hand, using the reason it names (`bgGradient` is text over a gradient). Its `a11y-axe`, `a11y-non-text-contrast` and `layout-overflow` findings are errors that fail the policy, and an audit
44
+ - The validation policy runs the axe-core audit of every rendered UI scenario in
45
+ every brand and theme (`browser-accessibility-audit`); it is the stage check after a
46
+ series of accepted drafts (`scope:"changed"` audits what changed since the last
47
+ full audit). `validation.browserAudit: false` turns it off. Draft acceptance audits
48
+ per `acceptance.browserAudit`: `"owners"` (default, the draft owners' own scenarios),
49
+ `"affected"` (every scenario the change reaches) or `false`. An `a11y-incomplete` info item means axe could not decide that rule on those elements: check it by hand, using the reason it names (`bgGradient` is text over a gradient). Its `a11y-axe`, `a11y-non-text-contrast` and `layout-overflow` findings are errors that fail the policy, and an audit
47
50
  that cannot run (no project Playwright or browser) fails it with a `browser-audit`
48
51
  error naming what to install. Under the acceptance policy, draft
49
52
  acceptance and guarded patches/transactions audit the candidate's affected UI
@@ -62,7 +65,8 @@ implicitly requiring them at acceptance.
62
65
  disable tests or weaken configuration to make a failing change pass.
63
66
 
64
67
  Defaults: both script lists are empty, acceptance `behaviorChecks:false`,
65
- validation `behaviorChecks:true`, both `browserAudit:true`. No lint/test/build script names are inferred.
68
+ validation `behaviorChecks:true`, acceptance `browserAudit:"owners"`, validation
69
+ `browserAudit:true`. No lint/test/build script names are inferred.
66
70
  Every listed script must exist; commands are trusted project configuration, not
67
71
  MCP arguments. `mcp.mutationChecks` is a configuration error: list those scripts in
68
72
  `acceptance.checks` and set `acceptance.behaviorChecks`. `mcp.mutationCheckTimeoutMs`
@@ -55,14 +55,21 @@ When no authorized source editor/filesystem channel is available, use the
55
55
  server's tools for source reads and changes. Do not assume returned server-local
56
56
  paths can be opened by the client. Discover capabilities with `ads_status`.
57
57
 
58
- With mutation tools enabled, follow [tracked drafts](drafts.md): discover owners
59
- with `ads_units`, create a coherent proposal with `ads_create_draft`, read/edit its
60
- marked source through `ads_read_file` and `ads_update_draft`, preview with
61
- `ads_show_draft`, review the rendered result and accept its exact revision with
58
+ With mutation tools enabled, every source change follows [tracked drafts](drafts.md):
59
+ discover owners with `ads_units`, create a coherent proposal with `ads_create_draft`,
60
+ read/edit its marked source through `ads_read_file` and `ads_update_draft` (file
61
+ contents or a Git diff), preview with `ads_show_draft`, review the rendered result,
62
+ optionally check with `ads_accept({dryRun:true})`, and accept its exact revision with
62
63
  `ads_accept`. Accept dependencies first and review dependents again. The agent
63
- performs auto-mode review; no additional human approval step is implied.
64
-
65
- Use [guarded patches](guarded-editing.md) for focused repairs and migrations.
64
+ performs auto-mode review; no additional human approval step is implied. An owner is
65
+ in at most one open draft, so concurrent clients work on different owners.
66
+
67
+ After a series of accepted drafts, run the stage check before reporting the work
68
+ complete or committing: `ads_validate` with the validation policy and
69
+ `scope:"changed"`. It runs the full accessibility audit of everything the changes
70
+ reached and the registered behavior checks; acceptance itself audits only the draft
71
+ owners' own scenarios by default. See [guarded editing](guarded-editing.md) for
72
+ focused repairs and what acceptance checks.
66
73
  Without mutation tools, an MCP-only client can inspect, preview and validate,
67
74
  but cannot change source. Report that capability limit if editing is required.
68
75
 
@@ -72,7 +79,7 @@ Both routes preserve project ownership, framework, public APIs, shared tokens,
72
79
  styling/geometry boundaries and configured checks. Compilation and HTML delivery
73
80
  do not prove visual or behavioral correctness. Report the scope and revision of
74
81
  actual passing checks; stale, failed or incomplete evidence remains unfinished.
75
- Never change access routes to bypass a rejected patch or failed acceptance.
82
+ Never change access routes to bypass a failed acceptance.
76
83
 
77
84
  Direct editors may deliberately choose tracked drafts for isolation, comparison
78
85
  or PR review. Once using a tracked proposal, finish a coherent design change by
@@ -67,28 +67,24 @@ inside a different or nested repository. Inspect the selected public API, owning
67
67
  source/available guides and relevant tokens, then mount its discovered scenario.
68
68
  Metadata and source reads do not prove rendered behavior.
69
69
 
70
- For MCP-only guarded editing with `ads_status.mutations.enabled`, discover the
71
- owner with `ads_units`, read
72
- relevant ranges with `ads_read_file` and send only a Git unified diff through
73
- `ads_apply_patch({ unit, patch, dryRun })`. A unit includes its own implementation,
74
- scenarios and fixtures; imported peers remain separate. `tokens` is the token
75
- foundation unit. Unit discovery and file ownership are distinct from preview IDs.
76
- Include only that owner's required re-exports in the public entry; preserve
77
- unrelated statements. Its real re-export may accompany removal of a redundant
78
- `export {};` placeholder; do not add empty exports. A `tokens` manifest lists the foundation
79
- entry in `companionFiles`: when creating/deleting a canonical token file such as
80
- `fonts.css`, include only its required import change there in the same patch.
81
- Preserve other imports/comments and the canonical order. Runtime owner manifests
82
- also list a `ds.config.json` companion: change only that owner's `inlineStyleFiles`
83
- and `boundaries.styleWrites` entries together with its source. Unused permissions
84
- fail the core checks; do not pre-register a boundary without its implementation.
85
- Use `dryRun: true` to
86
- inspect validation, including affected registered behavior checks on the isolated
87
- candidate. For a prepared draft, request its diff and dry-run the returned
88
- `patchFile`; `ads_verify` checks current source and accepts no draft argument.
89
- Applying re-runs the gates. Fix rejected patches in their
90
- owner. Use `ads_apply_transaction` for genuinely coupled owner patches;
91
- never bypass a rejection with direct source writes. Shared styles/helpers use `foundation`, root guides use
70
+ For MCP-only guarded editing with `ads_status.mutations.enabled`, every source change
71
+ goes through a draft: discover the owner with `ads_units`, create its draft with
72
+ `ads_create_draft`, read relevant ranges with `ads_read_file`, edit the draft's files
73
+ or send a Git unified diff with `ads_update_draft({id, revision, patch})`, review it
74
+ with `ads_show_draft`, then `ads_accept` its exact revision (`dryRun: true` checks
75
+ without writing). A unit includes its own implementation, scenarios and fixtures;
76
+ imported peers remain separate. `tokens` is the token foundation unit. Unit
77
+ discovery and file ownership are distinct from preview IDs. An owner is in at most
78
+ one open draft; coupled owners share one draft, and a draft can depend on another
79
+ owner's open draft. Every authored file has one owner: an owner declares its public
80
+ names in `<Owner>.ads.exports.ts` and its style permissions (`styles.writes`,
81
+ `styles.inline`, `customization`) in `<Owner>.ads.contract.ts`. The public barrel,
82
+ review entry and styles entry are generated, so no draft edits them. Unused
83
+ permissions fail the core checks; do not declare a permission without its
84
+ implementation. Acceptance runs the mandatory ADS gates and the project's acceptance
85
+ policy; registered tests run when `acceptance.behaviorChecks` is true. `ads_verify`
86
+ checks current source and accepts no draft argument. Fix a failed acceptance in the
87
+ draft; never bypass a rejection with direct source writes. Shared styles/helpers use `foundation`, root guides use
92
88
  `documentation`, and branding/fonts use their discovered `assets/*` unit.
93
89
  Intentional configuration, rule exceptions, registered guard code and compiler
94
90
  changes use `configuration`; validate the proposed settings and keep mandatory
@@ -289,7 +285,7 @@ may name its review renderer in `covers`; ordinary component/pattern scenarios
289
285
  cover their production subjects. Keep review exports in the separate review entry.
290
286
  Remove redundant helper catalogue scenarios during migration. Product UI retains
291
287
  its real render-coverage requirement. Keep directory ownership anchored by its
292
- implementation entry (`index` or a file matching the directory name) or colocated fixture.
288
+ implementation entry (`index` or a file matching the directory name).
293
289
  Import colocated image/font fixtures so MCP serves them through asset resources.
294
290
  For a broken-image case, use a local failing fixture, rather than an external
295
291
  network failure or a domain-specific CSP exception. Production asset APIs remain
@@ -338,11 +334,12 @@ Run ADS's own gates directly with `ads check`; acceptance and validation do not
338
334
  require Oxlint. Register project-specific checks as explicit package scripts in
339
335
  `mcp.mutationChecks` / `validation.checks`, and behavior tests through ADS contracts.
340
336
  A project can use its own linter in those scripts when desired. Measured renderer properties and documented
341
- non-state hooks use explicit `boundaries`; shared token writes and primitive
342
- state overrides cannot be allowlisted. When migrating JSX inline geometry to
343
- imperative writes, port the source and replace its own boundary entries together
344
- in the owner's patch. Remove obsolete `inlineStyleFiles` entries and unused
345
- `styleWrites` properties; do not broaden permissions to keep a migration passing.
337
+ non-state hooks are declared in the owner's contract (`styles.writes`,
338
+ `styles.inline`, `customization`); shared token writes and primitive state overrides
339
+ cannot be allowed. When moving JSX inline geometry to imperative writes, change the
340
+ source and its contract permissions together in the owner's draft. Remove obsolete
341
+ `styles.inline` entries and unused `styles.writes` properties; do not broaden
342
+ permissions to keep a change passing.
346
343
  Pointer-capture advisories call for review of cancellation, capture loss and
347
344
  teardown, including cleanup delegated to hooks. Verify actual cleanup in a browser;
348
345
  a locally present handler alone does not prove correctness.
@@ -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
  Projects explicitly approve installed runtime packages through
25
26
  `behaviorLibraries` in `ds.config.json`; each must also be a `package.json`
@@ -38,7 +39,7 @@ build and browser review; declaring a dependency does not prove it is headless.
38
39
  Register owner behavior in `<Owner>.ads.contract.ts` with actual API and
39
40
  implementation references. The
40
41
  [contract reference](contracts.md) covers static authoring, `.ads.behavior.spec.ts`,
41
- declarative `exercises`, required browser checks and guarded migration.
42
+ declarative `exercises` and required browser checks.
42
43
  A contract declaration alone is not passing evidence. Use
43
44
  `auditBehaviorPaints(frame)` after relevant binding updates to repeat the current
44
45
  App's generic paint audit, in addition to assertions for the named guarantee.
@@ -46,7 +47,7 @@ App's generic paint audit, in addition to assertions for the named guarantee.
46
47
  ## Development boundary
47
48
 
48
49
  Production includes real components, controllers, tokens and compiled styles.
49
- Scenarios and fixtures are included only in previews. Behavior manifests and test
50
+ Scenarios and fixtures are included only in previews. Owner contracts and test
50
51
  files are development/tooling inputs. Runtime imports and public re-exports of
51
52
  those inputs are rejected, including dynamic imports and aliases.
52
53
 
@@ -384,9 +385,9 @@ project policy; registration alone does not require execution at acceptance.
384
385
  `ads_verify` always runs the requested checks. See [validation policies](validation.md). Imported shared
385
386
  controller changes also select dependent contracts conservatively. Rejected and
386
387
  dry-run patches publish no source changes. Verification output stays under `.ds/`.
387
- To check a prepared draft, request its diff and pass the returned `patchFile` to
388
- `ads_apply_patch` with `dryRun:true`. This checks the isolated candidate using the acceptance policy, including
389
- affected behavior contracts and their configured browser preview when enabled. Candidate evidence
388
+ To check a draft, call `ads_accept({id, revision, dryRun:true})`. This checks the
389
+ candidate using the acceptance policy, including affected behavior contracts and
390
+ their browser preview when enabled, rendered through the project's own compiler. Candidate evidence
390
391
  is not persisted as passing evidence for live source. `ads_verify` selects checks
391
392
  for current source and has no draft argument.
392
393
 
@@ -81,43 +81,18 @@ Screenshots hide the text caret and disable animations by default. Set
81
81
  `animations:"allow"` when motion must remain active, and account for nondeterminism.
82
82
  The same capture settings are used for both sides of a candidate comparison.
83
83
 
84
- ## Review a patch without applying it
84
+ ## Review a draft without accepting it
85
85
 
86
- Prepare/diff an owner draft normally, then request screenshots during its guarded
87
- dry run:
86
+ Capture the draft's exact revision beside the accepted version, without acceptance
87
+ checks:
88
88
 
89
89
  ```js
90
- ads_apply_patch({
91
- unit: "components/Example",
92
- patchFile: ".ds/patches/<returned-name>.patch",
93
- dryRun: true,
94
- screenshot: true,
95
- captures: [{ scenario: "components/Example", target: "control", theme: "light" }]
96
- })
90
+ ads_capture({ scenario: "components/Example", target: "control", theme: "light", draft: "<draft id>", revision: "<draft revision>" })
97
91
  ```
98
92
 
99
- The placeholder owner/ID/path must come from discovery/preparation. Transactions
100
- accept the same `screenshot`/`captures` fields. Select 1–8 distinct scenario/target
101
- pairs explicitly; do not capture every affected scenario by default. Ordinary dry
102
- runs and patches create no screenshots. `screenshot:true` requires `dryRun:true`.
103
-
104
- Core, registered lint/project and affected behavior gates pass first. ADS then
105
- captures current source and the isolated candidate under matching theme, viewport,
106
- animation and browser settings. Candidate screenshots survive candidate-directory
107
- cleanup. Final source/conflict checks still run before the pair is published. A
108
- failed/cancelled capture does not replace existing image slots or apply source.
109
- If a scenario/target is newly introduced, `current` is null with an explicit
110
- `currentAbsent` explanation; only the real candidate image exists.
111
-
112
- The edit reply is a summary. Read `ads_results({resultId,section:"captures"})` for
113
- the requested image resource URIs and `section:"diagnostics"` for relevant
114
- messages; follow `nextCursor` when needed. Read image resources explicitly.
115
- Standalone `ads_capture` continues returning its selected capture directly.
116
-
117
- Review those images and diagnostics, fix the draft if necessary, then apply
118
- with `dryRun:false`. Apply reruns all gates. An image is promoted only when the
119
- accepted source revision matches the captured candidate; other proposals remain
120
- stale. Images do not approve a patch or certify interaction/accessibility/parity.
93
+ The placeholder IDs come from discovery and `ads_drafts`. A capture is an explicit
94
+ call: acceptance and its dry run take no screenshots. A new scenario has only a
95
+ candidate image. Edits during capture prevent publication of its image slots.
121
96
 
122
97
  ## Two slots, no automatic history
123
98
 
@@ -42,6 +42,54 @@ the runtime dependency closure. Review custom emitter configurations through
42
42
  the configuration owner before migrating a consuming project. Guards remain tooling. Production prop types
43
43
  belong in runtime files, never inferred from a development contract.
44
44
 
45
+ ## Public names and generated entries
46
+
47
+ Each owner declares its public names in its own `<Owner>.ads.exports.ts`, beside its
48
+ source (`components/Button.ads.exports.ts` for a flat owner,
49
+ `components/Forms/Input/Input.ads.exports.ts` for a directory owner):
50
+
51
+ ```ts
52
+ export { Button } from "./Button";
53
+ export type { ButtonProps } from "./Button";
54
+ ```
55
+
56
+ An exports file holds only named re-exports of its own owner's modules by relative
57
+ path: no `export *`, no other code, no peers' files. Public names are unique across
58
+ owners. ADS generates the public barrel (`publicEntry`, normally `index.ts`) by copying
59
+ every exports file's re-exports with paths rebased onto the barrel, so it names each
60
+ public export directly from its source and a product build never includes an exports
61
+ file. The review entry is generated the same way from the exports files under `review/`. It also generates the styles entry (`stylesEntry`) with one `@import`
62
+ per canonical token sheet in foundation order; the public barrel imports it first.
63
+ Never edit a generated entry: `ads check` reports a stale or hand-edited one
64
+ (`generated-entry`), and the showcase, the MCP server, draft previews, acceptance
65
+ and `ads assets` rewrite them. An exports file belongs to its owner's layer:
66
+ production, or development under `review/`.
67
+
68
+ ## Style permissions
69
+
70
+ An owner declares the style permissions its own code needs in its contract, with
71
+ paths relative to the contract:
72
+
73
+ ```ts
74
+ export default {
75
+ schemaVersion: 1,
76
+ styles: {
77
+ writes: { "./Menu.tsx": ["--ds-menu-x", "--ds-menu-y"] },
78
+ inline: ["./Menu.tsx"],
79
+ },
80
+ customization: ["--ds-menu-gap"],
81
+ } satisfies UnitContract;
82
+ ```
83
+
84
+ `styles.writes` lists the CSS properties or owned `--ds-`/`--ux-`/`--showcase-`
85
+ variables a file writes at runtime (never `cssText`, state variables or shared
86
+ tokens); `styles.inline` lists files that may use inline JSX/factory styles for
87
+ measured geometry; `customization` lists a component's non-state `--ds-*` variables
88
+ that patterns, the showcase and the application may set. Contracts are allowed for
89
+ component, pattern, controller, review and showcase owners; `customization` only for
90
+ components. An unused permission is reported as stale on the contract.
91
+ `ds.config.json` holds no per-owner entries.
92
+
45
93
  ## A contract uses actual implementation references
46
94
 
47
95
  ```ts
@@ -251,34 +299,19 @@ Shared token samples belong under the token directory. See
251
299
  project-specific audits of shared alias relationships. It supplements mandatory
252
300
  core source checks and does not enable independent local values.
253
301
 
254
- ## Migration and MCP editing
302
+ ## MCP editing
255
303
 
256
- Use the static owner contract for new registrations. Competing declarations fail.
304
+ The static owner contract is the only token, paint, declarative-part and behavior
305
+ registration. Competing declarations fail.
257
306
  Contracts participate in discovery, ownership, source revisions, affected-check
258
307
  selection and candidate gates. `ads_units` exposes `contractFile`; `ads_catalog`
259
308
  reports constrained paint paths and declarative parent/consumer/check references.
260
309
  Use bounded file reads and paged detailed results, not repeated whole-project dumps.
261
310
 
262
- Install supporting ADS tooling before migrating a consuming project and reconnect
263
- MCP before replacing a package used by a running server. Then:
264
-
265
- 1. Discover one owner with `ads_units`.
266
- 2. `ads_prepare_patch({ unit, action: "migrate" })` creates a normal local draft.
267
- 3. Review the converted contract, renamed files/imports and migration notes.
268
- 4. `ads_prepare_patch({ unit, action: "diff", draft })` emits its Git patchFile.
269
- 5. Dry-run/apply with `ads_apply_patch`, or a genuinely coupled transaction.
270
-
271
- Migration never edits live source or bypasses gates. It retains stable scenario
272
- IDs, check case IDs and directory ownership. A canonical `<Owner>.ads.scenario.tsx` is the same
273
- development entry as `Scenario.tsx`, even without a production entry or owner
274
- contract. Explicit flat IDs and existing flat peer families remain separate.
275
- An optional static `scenario.id` preserves a legacy
276
- identity when a renamed filename would otherwise be ambiguous; it must stay
277
- inside the owning unit and be unique. Whole-file or unimportable private behavior subjects stay
278
- in legacy registration with a note until deliberately resolved. Unknown runner
279
- globs, custom adapters and documentation references require review. Ambiguous
280
- flat-to-directory renames stay in the legacy form with a migration note so file
281
- ownership cannot silently change. Preserve
282
- licenses, pending drafts and unrelated work; keep transactions within their limits.
283
- There is no alternate JSON contract editor. Do not loosen a guard or make a valid
284
- API private merely to complete a migration.
311
+ A canonical `<Dir>/<Dir>.ads.scenario.tsx` is the development entry of the
312
+ directory owner `<Dir>`, even without a production entry or owner contract. In a
313
+ folder without that entry, each `<Owner>.ads.scenario.tsx` belongs to its own flat
314
+ owner, and an explicit flat `scenario.id` (`<Dir>/<Dir>`) keeps the canonical file
315
+ a flat entry. An optional static `scenario.id` keeps an identity stable when a
316
+ renamed filename would otherwise be ambiguous; it must stay inside the owning unit
317
+ and be unique.
@@ -1,9 +1,10 @@
1
1
  # Tracked drafts and auto-mode acceptance
2
2
 
3
- Use this workflow for MCP-only iterative design, or when a direct editor chooses
4
- tracked proposals for isolation and comparison. Ordinary direct source edits use
5
- the separate [direct editing workflow](workflows.md#direct-design-system-code-access)
6
- and do not require draft acceptance. Auto mode means the agent reviews the
3
+ Every MCP source change goes through a draft: only `ads_accept` of an exact draft
4
+ revision writes accepted source. Direct editors can choose drafts too, for isolation
5
+ and comparison; ordinary direct source edits use the separate
6
+ [direct editing workflow](workflows.md#direct-design-system-code-access) and do not
7
+ require draft acceptance. Auto mode means the agent reviews the
7
8
  rendered result and accepts it; it does not introduce a human approval gate.
8
9
  Human acceptance controls are not part of this version.
9
10
 
@@ -33,19 +34,29 @@ use one multi-owner draft: its previews share a compiler workspace and acceptanc
33
34
  validates the combined candidate once, then applies all changes together. The
34
35
  existing source and patch byte budgets still apply.
35
36
 
36
- A Git checkout is not required to create or recover a draft. Refresh uses the
37
- installed Git executable for three-way text merging. Restarting ADS or cloning the
38
- project discovers the same source. Generated compiler workspaces and execution
39
- events remain under ignored `.ds/`; an interrupted check is never a pass.
40
-
41
- The manifest maps each proposed file to its normal project target and records
42
- its baseline fingerprint, original baseline source and owner. Baseline files under
43
- `bases/` are recovery data; edit only the proposed `files/` source. Edit returned source files with local file
44
- tools. `ads_read_file` reads mapped draft source in bounded ranges.
45
- `ads_update_draft` registers additions/deletions or edits source for remote
46
- clients; pass the current revision from `ads_drafts`. `content:null` proposes a
47
- deletion. Binary content uses `encoding:"base64"`; acceptance uses Git's existing
48
- binary patch support. Do not edit accepted source to iterate a proposal.
37
+ **An owner is in at most one open draft.** Creating a draft for an owner that another
38
+ open draft holds is refused and names that draft, so concurrent clients edit
39
+ different owners and drafts never share a file. Accepting or dropping a draft frees
40
+ its owners. To build on an unaccepted change of another owner, depend on its draft.
41
+
42
+ A draft starts with only its owners' own files. A shared companion such as
43
+ `ds.config.json` joins the draft when the draft changes it. Shared entries are never
44
+ in a draft: the public barrel, the review entry and the styles entry are generated
45
+ from the owners' `.ads.exports.ts` files and token sheets (see
46
+ [contracts.md](contracts.md)).
47
+
48
+ A Git checkout is not required to create or recover a draft. Restarting ADS or
49
+ cloning the project discovers the same source. Generated compiler workspaces and
50
+ execution events remain under ignored `.ds/`; an interrupted check is never a pass.
51
+
52
+ The manifest maps each proposed file to its normal project target and records its
53
+ baseline fingerprint and owner. Edit the proposed `files/` source with local file
54
+ tools, or send changes through `ads_update_draft` (pass the current revision from
55
+ `ads_drafts`): `changes` with contents (`content:null` proposes a deletion; binary
56
+ content uses `encoding:"base64"`), or `patch`/`patchFile` with a Git unified diff
57
+ written against canonical paths, applied exactly to the draft's current proposal.
58
+ New paths join their declared owner. `ads_read_file` reads mapped draft source in
59
+ bounded ranges. Do not edit accepted source to iterate a proposal.
49
60
 
50
61
  `ads_drafts` lists only drafts. Filter by unit/query, page with offset/limit, or
51
62
  pass id to inspect file mappings. Catalogue and scenario entries expose their
@@ -57,8 +68,12 @@ create component-local value catalogues.
57
68
  ## Preview and dependencies
58
69
 
59
70
  Call `ads_show_draft({id,scenario?})`, then inspect its actual `showcaseUrl` in a
60
- browser. The preview reuses an isolated compiler workspace across edits and does
61
- not run acceptance checks. Up to four draft compiler sessions stay warm; opening
71
+ browser: the project's own showcase with the draft beside its accepted version
72
+ (`?draft=<id>&split=1`). `isolatedShowcaseUrl` (`/draft/<id>/` on the same host)
73
+ shows the draft's workspace alone. A draft has no server, port or compiler of its
74
+ own: its workspace is compiled by the project's one compiler, which builds the draft
75
+ being viewed first, then the project, then background work. The preview reuses that
76
+ workspace across edits and does not run acceptance checks. Up to four draft compiler sessions stay warm; opening
62
77
  more reclaims an older generated workspace without deleting its tracked proposal.
63
78
  Creation queues compiler prewarming without delaying its response. Bursts of
64
79
  creations coalesce, and only one queued compiler initializes at a time. A newer
@@ -75,25 +90,20 @@ refreshes catalogue metadata. Read `discovery.state` (`current`, `pending`,
75
90
  New/missing scenario identities wait for fresh discovery. A previous preview may
76
91
  stay visible until compilation finishes; pending/stale output is not evidence.
77
92
  Preview workspaces follow current project inputs, including deletions, and overlay
78
- only actual draft changes. A restarted session rebuilds its disposable workspace;
93
+ only actual draft changes. A draft's own edits and the draft being viewed resync at
94
+ once; other drafts behind an accepted-source change catch up in the background
95
+ without delaying the viewed one. A restarted session rebuilds its disposable workspace;
79
96
  a missing workspace is recreated. Accept/drop removes it even after a restart,
80
97
  and startup prunes workspaces whose proposals no longer exist.
81
98
  When discovery fails, `ads_show_draft` returns the draft's own diagnostics and
82
99
  `diagnosticsUri`; the accepted `ads://project/scenarios` is a different registry.
83
100
  Read the scoped URI even when the compiler could not start.
84
101
 
85
- If accepted source advanced, use
86
- `ads_update_draft({id,revision,refresh:true})` after accepted source changes.
87
- Stored originals allow non-overlapping text edits and independent owner exports
88
- to merge. Untouched copies advance to current source. Overlaps return
89
- `refreshed:false` plus file diagnostics and leave the proposal unchanged; resolve
90
- them deliberately by passing `refresh:true` with `changes` containing the
91
- resolved contents of those existing files and their owners. Refresh separately
92
- from dependency changes. Non-overlapping JSON object fields merge structurally;
93
- conflicting arrays/values remain explicit. Older drafts without originals can refresh untouched files,
94
- but overlapping changed files require explicit resolution. Review the new
95
- revision and preview after every successful refresh.
96
- Reopen after edits to obtain the current revision.
102
+ ADS does not merge. With one draft per owner, drafts never overlap; accepted source
103
+ can still change underneath a draft through a direct edit or a Git pull. Then
104
+ `ads_accept` refuses with a baseline conflict naming the files: drop the draft and
105
+ create a new one from current source. Reopen after edits to obtain the current
106
+ revision.
97
107
  Compilation is feedback, not passing behavior/visual evidence.
98
108
 
99
109
  For model-visible images, use `ads_capture({scenario,draft:id,revision,...settings})`
@@ -108,13 +118,13 @@ pattern and token drafts. Declare their IDs in `dependencies` when creating or
108
118
  updating the dependent draft. Keep normal `@ds` imports in all implementations
109
119
  and scenarios. The preview overlays the proposed files at canonical paths; no
110
120
  project code imports `.ads` draft source. Cycles, missing dependencies and
111
- overlapping non-barrel edits are errors. Use one coupled draft for overlapping
112
- changes. A coupled draft may declare up to 64 existing/new owners.
121
+ an owner held by another open draft are errors. Use one coupled draft for coupled
122
+ owners. A coupled draft may declare up to 64 existing/new owners.
113
123
 
114
124
  Accept dependencies first. ADS removes resolved dependency IDs from dependent
115
- manifests and their previews use the final accepted implementation automatically.
116
- Independent shared-barrel exports are merged; overlapping source changes remain
117
- explicit conflicts. Review the dependent's new revision before accepting it.
125
+ manifests and their previews use the final accepted implementation automatically;
126
+ each owner's exports file feeds the generated barrel, so dependents need no barrel
127
+ edit. Review the dependent's new revision before accepting it.
118
128
  If a dependency is dropped, correct the remaining draft's dependency list.
119
129
 
120
130
  DS Explorer keeps drafts in the ordinary Tokens, Components, Patterns and
@@ -149,12 +159,18 @@ current rendered revision and complete acceptance before finishing the change.
149
159
 
150
160
  ## Accept or drop
151
161
 
152
- After rendered review, call `ads_accept({id,revision})` once. It checks that exact
153
- revision, runs mandatory ADS guards plus `acceptance.checks` and, when
154
- `acceptance.behaviorChecks` is enabled, affected registered behavior checks against an isolated candidate, and applies passing changes at
155
- their normal paths. Unless `acceptance.browserAudit` is false it also runs the axe-core
156
- audit on the candidate's affected UI scenarios; an `a11y-axe` error rejects the draft.
157
- Fix it in the component and accept the new revision. Changes during checking or baseline conflicts prevent
162
+ After rendered review, call `ads_accept({id,revision})`, or first
163
+ `ads_accept({id,revision,dryRun:true})` to run every check without writing. It checks
164
+ that exact revision, runs mandatory ADS guards plus `acceptance.checks` and, when
165
+ `acceptance.behaviorChecks` is enabled, affected registered behavior checks, and
166
+ applies passing changes at their normal paths. `acceptance.browserAudit` chooses the
167
+ axe-core audit: `"owners"` (default) the draft owners' own UI scenarios, `"affected"`
168
+ every scenario the change reaches, `false` none; an `a11y-axe` error rejects the
169
+ draft. Checks and renders run in the draft's reviewed workspace through the project's
170
+ compiler and showcase, and accepting a revision a dry run just passed reuses its
171
+ results. Fix a failure in the component and accept the new revision. After a series
172
+ of accepted drafts, run the full audit of everything affected as a stage:
173
+ `ads_validate` with the validation policy and `scope:"changed"`. Changes during checking or baseline conflicts prevent
158
174
  application. Successful acceptance removes the proposal and records an event.
159
175
  There is no separate Apply or Iterate action. A failed attempt retains the draft;
160
176
  inspect its returned resultId with `ads_results` and fix the reported boundary.
@@ -22,7 +22,7 @@ a pass. Keep the reported case outcome separate from whole-run acceptance.
22
22
 
23
23
  ## Retrieve only the evidence needed
24
24
 
25
- `ads_verify`, `ads_apply_patch` and `ads_apply_transaction` reply with counts,
25
+ `ads_verify` and `ads_accept` reply with counts,
26
26
  bounded acceptance, at most three failure previews and `resultId`, within 4096
27
27
  UTF-8 JSON bytes. Full validation still decides acceptance. Do not repeat a suite
28
28
  merely to recover its output, or restate the complete report in conversation.