@reqvire-org/ads 0.3.25 → 0.3.27

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 (128) hide show
  1. package/README.md +28 -15
  2. package/dist/bootstrap-ds/ADS.md +28 -30
  3. package/dist/bootstrap-ds/README.md +13 -11
  4. package/dist/bootstrap-ds/design-system/assets/brand/README.md +3 -2
  5. package/dist/bootstrap-ds/ds.config.json +1 -1
  6. package/dist/bootstrap-ds/scripts/build-mcp-previews.mjs +1 -1
  7. package/dist/boundaries.mjs +0 -3
  8. package/dist/capture.mjs +1 -1
  9. package/dist/check.mjs +15 -22
  10. package/dist/config.mjs +3 -7
  11. package/dist/contract-migration.mjs +2 -2
  12. package/dist/contracts.d.mts +0 -1
  13. package/dist/design-values.mjs +81 -0
  14. package/dist/development-runtime.mjs +17 -0
  15. package/dist/evidence.mjs +1 -1
  16. package/dist/index.mjs +1 -1
  17. package/dist/init.mjs +14 -12
  18. package/dist/mcp/apps.mjs +1 -1
  19. package/dist/mcp/context.mjs +8 -7
  20. package/dist/mcp/mutations.mjs +3 -2
  21. package/dist/mcp/preview-watch.mjs +2 -1
  22. package/dist/mcp/prompts.mjs +4 -4
  23. package/dist/mcp/reports.mjs +101 -0
  24. package/dist/mcp/server.mjs +41 -3
  25. package/dist/mcp/widget.bundle.js +1 -1
  26. package/dist/paint-contracts.mjs +4 -5
  27. package/dist/preview-files.mjs +33 -0
  28. package/dist/preview-inputs.mjs +6 -5
  29. package/dist/preview-resources.mjs +1 -2
  30. package/dist/scenarios-compiler.mjs +7 -7
  31. package/dist/scenarios.mjs +14 -14
  32. package/dist/showcase/sandbox.bundle.js +1 -1
  33. package/dist/skills/README.md +14 -4
  34. package/dist/skills/ads-break-ui/SKILL.md +29 -15
  35. package/dist/skills/ads-break-ui/references/atomic-styles.md +9 -2
  36. package/dist/skills/ads-break-ui/references/behaviors.md +396 -0
  37. package/dist/skills/ads-break-ui/references/captures.md +1 -1
  38. package/dist/skills/ads-break-ui/references/contracts.md +18 -37
  39. package/dist/skills/ads-break-ui/references/design-data.md +91 -0
  40. package/dist/skills/ads-break-ui/references/evidence.md +4 -0
  41. package/dist/skills/ads-break-ui/references/guarded-editing.md +7 -11
  42. package/dist/skills/ads-break-ui/references/layers.md +16 -0
  43. package/dist/skills/ads-break-ui/references/reporting.md +101 -0
  44. package/dist/skills/ads-break-ui/references/runtimes.md +110 -0
  45. package/dist/skills/ads-break-ui/references/scenarios.md +9 -15
  46. package/dist/skills/ads-designer/README.md +6 -0
  47. package/dist/skills/ads-designer/SKILL.md +35 -20
  48. package/dist/skills/ads-designer/assets/bootstrap-ds/ADS.md +28 -30
  49. package/dist/skills/ads-designer/assets/bootstrap-ds/README.md +13 -11
  50. package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/assets/brand/README.md +3 -2
  51. package/dist/skills/ads-designer/assets/bootstrap-ds/ds.config.json +1 -1
  52. package/dist/skills/ads-designer/assets/bootstrap-ds/scripts/build-mcp-previews.mjs +1 -1
  53. package/dist/skills/ads-designer/references/atomic-styles.md +9 -2
  54. package/dist/skills/ads-designer/references/behaviors.md +396 -0
  55. package/dist/skills/ads-designer/references/captures.md +1 -1
  56. package/dist/skills/ads-designer/references/cli.md +10 -7
  57. package/dist/skills/ads-designer/references/contracts.md +18 -37
  58. package/dist/skills/ads-designer/references/design-craft.md +32 -1
  59. package/dist/skills/ads-designer/references/design-data.md +91 -0
  60. package/dist/skills/ads-designer/references/evidence.md +4 -0
  61. package/dist/skills/ads-designer/references/guarded-editing.md +7 -11
  62. package/dist/skills/ads-designer/references/layers.md +16 -0
  63. package/dist/skills/ads-designer/references/mobile.md +1 -1
  64. package/dist/skills/ads-designer/references/reporting.md +101 -0
  65. package/dist/skills/ads-designer/references/runtimes.md +110 -0
  66. package/dist/skills/ads-designer/references/scenarios.md +9 -15
  67. package/dist/skills/ads-import/SKILL.md +51 -20
  68. package/dist/skills/ads-import/agents/openai.yaml +2 -2
  69. package/dist/skills/ads-import/references/atomic-styles.md +9 -2
  70. package/dist/skills/ads-import/references/behaviors.md +396 -0
  71. package/dist/skills/ads-import/references/branding.md +1 -1
  72. package/dist/skills/ads-import/references/captures.md +1 -1
  73. package/dist/skills/ads-import/references/cli.md +10 -7
  74. package/dist/skills/ads-import/references/compatibility.md +113 -0
  75. package/dist/skills/ads-import/references/contracts.md +18 -37
  76. package/dist/skills/ads-import/references/design-data.md +91 -0
  77. package/dist/skills/ads-import/references/evidence.md +4 -0
  78. package/dist/skills/ads-import/references/guarded-editing.md +7 -11
  79. package/dist/skills/ads-import/references/implementation.md +9 -2
  80. package/dist/skills/ads-import/references/layers.md +16 -0
  81. package/dist/skills/ads-import/references/reporting.md +101 -0
  82. package/dist/skills/ads-import/references/runtimes.md +110 -0
  83. package/dist/skills/ads-import/references/scenarios.md +9 -15
  84. package/dist/skills/ads-import/references/tokens.md +11 -9
  85. package/dist/skills/ads-motion/SKILL.md +28 -14
  86. package/dist/skills/ads-motion/references/atomic-styles.md +9 -2
  87. package/dist/skills/ads-motion/references/behaviors.md +396 -0
  88. package/dist/skills/ads-motion/references/captures.md +1 -1
  89. package/dist/skills/ads-motion/references/contracts.md +18 -37
  90. package/dist/skills/ads-motion/references/design-data.md +91 -0
  91. package/dist/skills/ads-motion/references/evidence.md +4 -0
  92. package/dist/skills/ads-motion/references/guarded-editing.md +7 -11
  93. package/dist/skills/ads-motion/references/layers.md +16 -0
  94. package/dist/skills/ads-motion/references/reporting.md +101 -0
  95. package/dist/skills/ads-motion/references/runtimes.md +110 -0
  96. package/dist/skills/ads-motion/references/scenarios.md +9 -15
  97. package/dist/skills/{ads-migrate → ads-port}/SKILL.md +64 -33
  98. package/dist/skills/ads-port/agents/openai.yaml +4 -0
  99. package/dist/skills/{ads-migrate → ads-port}/references/atomic-styles.md +9 -2
  100. package/dist/skills/ads-port/references/behaviors.md +396 -0
  101. package/dist/skills/{ads-migrate → ads-port}/references/captures.md +1 -1
  102. package/dist/skills/{ads-migrate → ads-port}/references/cli.md +10 -7
  103. package/dist/skills/{ads-migrate → ads-port}/references/contracts.md +18 -37
  104. package/dist/skills/ads-port/references/design-data.md +91 -0
  105. package/dist/skills/{ads-migrate → ads-port}/references/evidence.md +4 -0
  106. package/dist/skills/{ads-migrate → ads-port}/references/guarded-editing.md +7 -11
  107. package/dist/skills/{ads-migrate → ads-port}/references/layers.md +16 -0
  108. package/dist/skills/{ads-migrate → ads-port}/references/lint-and-docs.md +5 -0
  109. package/dist/skills/{ads-migrate → ads-port}/references/native-implementation.md +49 -15
  110. package/dist/skills/ads-port/references/reporting.md +101 -0
  111. package/dist/skills/ads-port/references/runtimes.md +110 -0
  112. package/dist/skills/{ads-migrate → ads-port}/references/scenarios.md +9 -15
  113. package/dist/skills/{ads-migrate → ads-port}/references/testing.md +11 -1
  114. package/dist/tokens.mjs +5 -8
  115. package/dist/unit-contracts.mjs +1 -8
  116. package/dist/verification.mjs +4 -3
  117. package/docs/ADS.md +59 -73
  118. package/docs/ARCHITECTURE.md +68 -20
  119. package/docs/BEHAVIORS.md +46 -41
  120. package/docs/CHANGELOG.md +44 -1
  121. package/docs/COMPARISON.md +63 -0
  122. package/docs/CONTRACTS.md +18 -37
  123. package/docs/GUIDE.md +41 -23
  124. package/docs/MCP.md +100 -15
  125. package/package.json +5 -4
  126. package/dist/scoped-tokens.mjs +0 -68
  127. package/dist/skills/ads-migrate/agents/openai.yaml +0 -4
  128. /package/dist/skills/{ads-migrate → ads-port}/references/review.md +0 -0
@@ -0,0 +1,396 @@
1
+ # Controllers and behavioral verification
2
+
3
+ Controllers own reusable UI behavior: state, subscriptions, DOM measurements and
4
+ lifecycle coordination. A controller may be a class, function, hook, state
5
+ machine or context provider. Linaria and tokens own its consumers' visual design.
6
+
7
+ Private controllers stay inside their component/pattern mutation unit. Shared
8
+ controllers use `design-system/controllers/<Name>/` with an `index` entry or a
9
+ runtime file matching the directory name. The unit ID is `controllers/<Name>`.
10
+ Its implementation, tests and guides can change together, including only its own
11
+ required public re-exports. A shared controller needs no artificial visual preview.
12
+ Consumers normally create separate instances; sharing implementation does not
13
+ implicitly share state.
14
+
15
+ Use the project's `framework` from `ds.config.json` for framework-specific APIs.
16
+ Plain TypeScript, browser APIs and local behavior helpers remain supported.
17
+ Declare external dependencies in the project package. ADS does not install them
18
+ or assume a renderer/library supplied by an MCP host. The framework field selects
19
+ compilation/mounting; controller checks also validate runtime imports. Type-only
20
+ UI references are allowed, but shared controllers cannot import component/pattern
21
+ runtime implementations. Keep business data in application adapters. Measured
22
+ style writes retain exact `boundaries.styleWrites` properties; they do not allow
23
+ shared-token overrides or an extra styling layer.
24
+ These gates inspect supported direct imports, markup and style boundaries.
25
+ External package internals and delegated DOM behavior still require source,
26
+ build and browser review; declaring a dependency does not prove it is headless.
27
+
28
+ Register owner behavior in `<Owner>.ads.contract.ts` with actual API and
29
+ implementation references. The
30
+ [contract reference](contracts.md) covers static authoring, `.ads.behavior.spec.ts`,
31
+ declarative `exercises`, required browser checks and guarded migration.
32
+ A contract declaration alone is not passing evidence. Use
33
+ `auditBehaviorPaints(frame)` after relevant binding updates to repeat the current
34
+ App's generic paint audit, in addition to assertions for the named guarantee.
35
+
36
+ ## Development boundary
37
+
38
+ Production includes real components, controllers, tokens and compiled styles.
39
+ Scenarios and fixtures are included only in previews. Behavior manifests and test
40
+ files are development/tooling inputs. Runtime imports and public re-exports of
41
+ those inputs are rejected, including dynamic imports and aliases.
42
+
43
+ ## Register guarantees
44
+
45
+ An optional `<Owner>.ads.contract.ts` belongs to one unit. Owners without a
46
+ behavior declaration have no implied behavioral verification. ADS reads the
47
+ contract statically; it does not execute these imports or a project command:
48
+
49
+ ```ts
50
+ import type { UnitContract } from "@reqvire-org/ads/contracts";
51
+ import { ScrollerController } from "./scroller-controller";
52
+ import { useMessageScroller } from "./MessageScroller";
53
+
54
+ export default {
55
+ schemaVersion: 1,
56
+ behavior: {
57
+ subjects: {
58
+ controller: { implementation: ScrollerController },
59
+ "scroll-api": { api: useMessageScroller },
60
+ },
61
+ guarantees: [{
62
+ id: "prepend-anchor",
63
+ description: "Prepending history preserves the visible anchor after layout settles.",
64
+ subjects: ["controller", "scroll-api"],
65
+ checks: ["prepend-anchor"],
66
+ }],
67
+ checks: {
68
+ "prepend-anchor": {
69
+ file: "./MessageScroller.ads.behavior.spec.ts",
70
+ case: "prepend-anchor",
71
+ scenario: "components/MessageScroller",
72
+ profile: "widget",
73
+ },
74
+ },
75
+ },
76
+ } satisfies UnitContract;
77
+ ```
78
+
79
+ Names above are illustrative project choices. A subject identifies a public API
80
+ or an implementation symbol owned by the unit. Private subjects do not become
81
+ public API. A guarantee references known subjects and checks. Each check names a
82
+ colocated test/spec file, stable case ID, registered profile and optional
83
+ discovered scenario. Several guarantees may reference one check. Repeated
84
+ execution identities use the same check ID.
85
+
86
+ Private subjects default to the headless controller role. For an intentionally
87
+ visual internal renderer or binding producer, declare `role: "implementation"`
88
+ alongside its `implementation` reference in the contract. Its source ownership and normal runtime gates
89
+ still apply; registration does not make it public API. Shared `controllers/`
90
+ source remains headless regardless of subject metadata. See the
91
+ [owner contract](contracts.md#a-contract-uses-actual-implementation-references).
92
+
93
+ Static validation establishes registration and ownership, not that the guarantee
94
+ is true. README prose is not automatically certified. Link specific guarantees
95
+ when describing the evidence available for a behavior.
96
+
97
+ ## Link a public API to a demonstration
98
+
99
+ Scenario `covers` retains its existing render-reference contract. Optional
100
+ `exercises` identifies public behavioral APIs:
101
+
102
+ ```tsx
103
+ export const scenario = {
104
+ title: "Message scrolling",
105
+ covers: ["MessageScroller", "MessageScrollerViewport"],
106
+ exercises: ["useMessageScroller", "useMessageScrollerScrollable"],
107
+ };
108
+ ```
109
+
110
+ Call hooks in a rendered local scenario adapter. Calls/construction are matched by
111
+ resolved symbol, not a `use*` naming convention. An unused import, dead adapter or
112
+ metadata string does not count. Dynamically passed behavior references produce a
113
+ review advisory when a direct call cannot be established; verify those through
114
+ registered execution checks rather than changing the API for the analyzer.
115
+
116
+ Callable exports may be functions, callable objects with attached methods, or
117
+ factory results. ADS uses their TypeScript call/construct signatures, including
118
+ the project's library declarations; it does not execute modules or maintain a
119
+ list of recognized factory names. The fast source guard resolves ambiguous public
120
+ values lazily and shares that type discovery within the check. Untyped `any`
121
+ values and objects containing methods do not establish a callable API.
122
+ An invalid `exercises` entry names the offending value and fails validation while
123
+ retaining independent render evidence for `covers`.
124
+ Calls to a callable's attached methods also exercise that public receiver,
125
+ including statically named member calls inside reachable event-handler closures.
126
+ Aliases, namespace access and re-exports retain the receiver identity. Reading a
127
+ method or defining an unused callback does not establish an invocation.
128
+
129
+ Public APIs appear in `ads_catalog` with `apiKind: "ui"` or `"behavior"` and their
130
+ scenario links. `ads_behaviors` joins contracts to demonstrations and evidence.
131
+ A demonstrated API is not automatically a verified guarantee.
132
+
133
+ ## Register execution profiles
134
+
135
+ Profiles are explicit trusted development commands in `ds.config.json`. They use
136
+ literal executable/argument arrays, no shell interpolation or model-supplied
137
+ command. For a project with an installed Playwright test runner:
138
+
139
+ ```json
140
+ {
141
+ "mcp": {
142
+ "behaviorProfiles": {
143
+ "widget": {
144
+ "runner": "playwright",
145
+ "command": "runtime",
146
+ "args": ["node_modules/@playwright/test/cli.js", "test"],
147
+ "mode": "browser",
148
+ "timeoutMs": 60000
149
+ }
150
+ }
151
+ }
152
+ }
153
+ ```
154
+
155
+ Here `runtime` uses the Node or Bun interpreter that launched ADS, and the
156
+ project supplies the installed Playwright entry. Explicit executable commands
157
+ retain their meaning. A Bun package-script profile can use `command: "bun"`
158
+ with `args: ["--bun", "run", "test:behavior", "--"]`. The Playwright
159
+ configuration must discover colocated spec files. Configure browser installation
160
+ and any required test setup in that project. The ADS tooling host gains no
161
+ framework or browser dependency from a profile.
162
+
163
+ The Playwright adapter appends selected file paths and case-tag filtering, its
164
+ reporter and a generated artifact directory. Unselected cases in the same spec
165
+ do not run. It preserves the project's worker configuration.
166
+
167
+ `timeoutMs` bounds the complete runner process for one profile, including runner
168
+ startup, hooks, retries and all selected cases. It is not a per-test timeout.
169
+ Playwright's own test/hook timeouts remain separate project settings. Set the
170
+ profile budget from measured suite durations with headroom; increasing it does
171
+ not repair a stalled assertion or cleanup.
172
+
173
+ Independent specs can use multiple Playwright workers against the same managed
174
+ candidate host. Each check needs its own page/context and state; avoid fixed ports,
175
+ shared mutable fixtures and test-order dependencies. Start with a small worker
176
+ count and measure on the target machine. Files normally run in parallel; tests
177
+ within one file normally remain sequential. ADS does not force parallelism or
178
+ change verification policy. See [Playwright parallelism](https://playwright.dev/docs/test-parallel).
179
+ Prefer readiness/assertion polling over arbitrary sleeps. Timer-only guarantees
180
+ may use [Playwright's clock](https://playwright.dev/docs/clock); retain real time
181
+ when browser motion, pointer gestures or layout timing are what the check verifies.
182
+
183
+ An ordinary test-failure exit (code 1) with a complete report and actual failing
184
+ cases preserves independent case outcomes: passing checks stay `passed`, failed
185
+ checks stay `failed`, and overall verification still blocks the mutation. The
186
+ report must account for every selected check, with no active cases or suite errors.
187
+ The same rule supports older custom reports without an explicit `complete` field
188
+ after normal process completion. An unexplained nonzero exit cannot certify a
189
+ pass, even if all reported cases claim success. Results retain `reportedStatus`
190
+ and `runnerExitCode` and explain the overall failure. Suite-level browser errors and
191
+ bounded runner output appear in diagnostics. `openBehaviorScenario` includes the
192
+ scenario ID and failed browser requests in startup failures; App resource errors
193
+ identify the resource URI. The ADS showcase retries only `resources/read` fetch
194
+ transport failures, with at most three attempts and 200/800 ms backoff. Recovered
195
+ startup reads appear in `startupDiagnostics` with retry counts and failed browser
196
+ requests; each retry is also logged in the browser console. This does not retry a
197
+ tool call, assertion, check or complete startup. HTTP/protocol/content errors,
198
+ integrity failures and cancellations do not retry. Persistent loading failures
199
+ still fail the check and block mutations. External hosts control their own
200
+ transport recovery.
201
+
202
+ `net::ERR_NETWORK_CHANGED` reports Chrome's network-change error, not proof that
203
+ the MCP endpoint restarted or that a particular interface changed. To investigate
204
+ an intermittent failure, correlate the saved case timestamps with Chrome's
205
+ network log, server availability and live interface monitoring (for example,
206
+ `ip -ts monitor link address route` on Linux). Interfaces being present, or stable
207
+ after a failure, does not establish the cause. Preserve the draft and original
208
+ diagnostic; do not change a component API, reference example or verification
209
+ policy to compensate for a resource-loading failure.
210
+
211
+ The reporter atomically publishes partial snapshots at test start/end. While a
212
+ run is active, `ads_status.behaviors.progress` exposes the profile, runner budget,
213
+ elapsed time, completed/active/pending counts, worker count when available and
214
+ case identities/timings. Candidate mutation verification exposes the same data at
215
+ `ads_status.mutations.progress`. Clients requesting MCP progress receive updates
216
+ and a heartbeat during the runner phase; client-side request timeouts still apply.
217
+ `durationMs` records completed case execution, including attempts, separately from
218
+ the suite's wall time. Parallel case durations can sum to more than wall time.
219
+
220
+ After a deadline, valid completed outcomes remain visible through `reportedStatus`
221
+ and durations, alongside active and unstarted case identities. A passed case from
222
+ an interrupted run has blocking status `incomplete`; real assertion failures retain
223
+ their own messages. No incomplete run can accept a mutation or certify a guarantee.
224
+ Reports and artifacts stay under the live project's `.ds/verification/` even after
225
+ the candidate copy is removed. This is diagnostic output, not passing live-source
226
+ evidence. Old/custom runners without incremental progress use `not_reported` for
227
+ cases whose execution state cannot be established.
228
+
229
+ Use native test tags for stable case identity:
230
+
231
+ ```ts
232
+ import { test, expect } from "@playwright/test";
233
+ import { openBehaviorScenario } from "@reqvire-org/ads/verification";
234
+
235
+ test("history preserves the visible anchor", { tag: "@ads:prepend-anchor" }, async ({ page }) => {
236
+ const frame = await openBehaviorScenario(page, "prepend-anchor");
237
+ // Perform real interactions and assert the project's guarantee here.
238
+ await expect(frame.getByRole("region", { name: "Messages" })).toBeVisible();
239
+ });
240
+ ```
241
+
242
+ The shown assertion is only a harness example; it does not establish anchoring.
243
+ Write meaningful assertions for the registered guarantee. The helper waits for
244
+ the current selected scenario inside the real sandboxed MCP App. It uses `load`
245
+ and explicit readiness, not `networkidle`: MCP keeps event connections open.
246
+
247
+ Compare reference and candidate under equivalent framing. In a reported Chrome
248
+ comparison, `content-visibility` initially used placeholder geometry inside a
249
+ cross-origin App iframe for both ADS and the upstream reference; the same content
250
+ measured differently as a top-level page. This is an observed browser/layout
251
+ condition, not evidence of an ADS defect. App readiness does not imply that every
252
+ off-screen item has rendered. For geometry assertions, bring the relevant content
253
+ into view and wait for its measured layout to settle. Record the framing and
254
+ visibility state; test initial placeholder behavior separately when it matters to
255
+ the guarantee. Wait for focus and positioning readiness before normal keyboard
256
+ comparisons, and test rapid input separately rather than hiding it behind delays.
257
+
258
+ `mode: "browser"` starts an isolated managed showcase on an automatic port. Test
259
+ requests contain its scenario URLs, and cleanup closes its host/compiler tree.
260
+ Mutation candidates use their own source, generated graph and server; a passing
261
+ test against an older fixed-port live showcase cannot validate a candidate.
262
+
263
+ Use `mode: "strict"` only for React with a project development harness that mounts
264
+ the relevant API in StrictMode. The production MCP App does not replay development
265
+ effects. This profile does not receive a production showcase URL from the helper.
266
+ For Preact, register its actual lifecycle tests without claiming React StrictMode.
267
+ The profile names record the chosen environment; ADS does not infer that a test's
268
+ assertions cover every lifecycle condition.
269
+
270
+ Other runners use `runner: "protocol"` (the default). ADS provides
271
+ `ADS_VERIFY_REQUEST` and `ADS_VERIFY_REPORT` absolute paths. Read the request's
272
+ `schemaVersion`, unique `runId`, `projectRoot`, `framework`, `profile`, `mode`,
273
+ selected `checks` and optional `scenarios` URLs. Write a bounded JSON report:
274
+
275
+ ```json
276
+ {
277
+ "schemaVersion": 1,
278
+ "runId": "<the request's runId>",
279
+ "cases": [
280
+ {
281
+ "id": "prepend-anchor",
282
+ "file": "design-system/components/MessageScroller/MessageScroller.ads.behavior.spec.ts",
283
+ "status": "passed"
284
+ }
285
+ ]
286
+ }
287
+ ```
288
+
289
+ Case statuses are `passed`, `failed` or `skipped`, with optional `message` and
290
+ `durationMs`. Protocol runners may atomically publish intermediate reports with
291
+ `complete:false` and an `active` list of `{id,file,startedAt,workerIndex?}`, then
292
+ publish `complete:true` at completion. Older final reports without `complete`
293
+ remain supported after normal process completion. An explicitly incomplete report
294
+ cannot pass even with exit code zero. Partial reports retain the same schema/run
295
+ identity and size limits as final reports.
296
+ Cases may optionally include `failure: {category,phase,code,certainty?}`,
297
+ `source: {file,line,column}`, `failingStep`, `viewport`/`viewportSource`, and
298
+ `artifacts: [{name,mimeType,path}]`. Artifact paths are relative to the report
299
+ directory and must remain under that run's `artifacts/` directory. The built-in
300
+ Playwright reporter supplies these from actual step/startup/attachment evidence.
301
+ Older protocol runners can omit them; ADS preserves that lack of classification
302
+ instead of treating an arbitrary thrown message as an assertion.
303
+ `file` is project-relative. Nonzero process exit, missing cases, skipped cases,
304
+ wrong run IDs and unavailable reports do not pass. Test commands are trusted
305
+ project code; an adapter cannot prove the quality or honesty of their assertions.
306
+
307
+ ## Execute and inspect evidence
308
+
309
+ Use `ads_behaviors` for bounded discovery; request an exact unit for its contract.
310
+ General listings return counts and short API/guarantee/scenario summaries. Exact
311
+ owner requests return the registered details; source reads remain available for
312
+ bounded inspection of large contracts. No full guide or test body is injected
313
+ into discovery results.
314
+ Call `ads_verify({unit, checks?})` for selected registered checks. Read
315
+ `ads://project/behaviors` for current evidence or `ads://guides/behaviors` for this
316
+ guide. CLI/CI equivalents are:
317
+
318
+ ```sh
319
+ ads behaviors . --json
320
+ ads verify . --unit controllers/ScrollFollow
321
+ ads verify . --unit components/MessageScroller --check prepend-anchor --json
322
+ ```
323
+
324
+ Execution has bounded output, a configured timeout, cancellation and process-tree
325
+ ownership. Evidence records case/profile identity, source/dependency revision,
326
+ completion time, report path and the available preview revision. Later input
327
+ changes mark results stale; changes during execution prevent a current pass.
328
+ Guarantees report passing only when all their checks have current passing evidence.
329
+ Passing applies to those cases and profiles, not every application state.
330
+
331
+ Results expose structured `failure` boundaries and explicit `acceptance` scope.
332
+ MCP execution replies contain counts, bounded acceptance, at most three failure
333
+ previews and a `resultId` (4 KiB UTF-8 JSON maximum). Use `ads_results` to read
334
+ selected `outcomes`, `checks`, `diagnostics` or other sections without execution.
335
+ Pages default to 10 rows, allow at most 20 and stay within 8 KiB; follow
336
+ `nextCursor` with identical selection/status. Truncated records provide
337
+ `recordIndex` for exact `offset`/`chars` ranges. Only the latest verification and
338
+ mutation snapshots are retained, independently, at most 8 MiB each. Replaced IDs
339
+ fail explicitly. Validation still uses complete internal outcomes.
340
+
341
+ Use `ads_investigate({unit,check,runId})` with an outcome's exact IDs for its compact
342
+ summary (4 KiB maximum); details, requests, browser errors and artifact metadata are separate
343
+ paged sections (8 KiB maximum). Truncated records support exact text ranges with
344
+ the recorded run ID. Saved outcomes describe completion time; compare current
345
+ `ads_behaviors` revisions for freshness. It includes isolated dry runs; `ads://project/investigations` lists available entries. Exact
346
+ input and observed preview revisions, failing step/source, startup viewport,
347
+ failed startup requests and available project-recorded artifacts keep diagnosis
348
+ separate from an inferred component defect. No artifact is invented or test
349
+ retried. Each check retains one latest bundle; old artifact resource access is
350
+ superseded. Candidate bundles remain distinct from passing live-source evidence.
351
+ Read the portable [evidence reference](evidence.md)
352
+ for category meanings, collection limits and artifact policy.
353
+
354
+ Revisions include owned files, literal import dependencies, local CSS imports and
355
+ asset URLs, token foundation, project/runner configuration, lockfiles and tooling.
356
+ Computed module selection conservatively includes all ADS owners. Environment,
357
+ network and other unregistered external inputs remain the runner's responsibility;
358
+ an evidence record is not a proof about arbitrary external state.
359
+
360
+ For named imports through simple re-export barrels, ADS follows selected bindings
361
+ and retains dependencies with declared side effects. This narrowing requires a
362
+ package `sideEffects:false` or a supported simple `sideEffects` glob array; preserve
363
+ CSS/global effects in that policy. Unknown policies/patterns, wildcard exports and
364
+ computed imports remain conservative. Barrel source changes still invalidate
365
+ dependents. ADS caches source parsing, resolution and digests within an inspection
366
+ only; later runs read current source again.
367
+
368
+ Guarded mutations execute affected registered behavior contracts after core,
369
+ Oxlint and configured project checks, before writing source. Imported shared
370
+ controller changes also select dependent contracts conservatively. Rejected and
371
+ dry-run patches publish no source changes. Verification output stays under `.ds/`.
372
+ To check a prepared draft, request its diff and pass the returned `patchFile` to
373
+ `ads_apply_patch` with `dryRun:true`. This checks the isolated candidate, including
374
+ affected behavior contracts and its configured browser preview. Candidate evidence
375
+ is not persisted as passing evidence for live source. `ads_verify` selects checks
376
+ for current source and has no draft argument.
377
+
378
+ ## Packaging and performance
379
+
380
+ Controllers follow normal component/scenario imports into the project's compiled
381
+ resource graph. Their framework dependencies are bundled by the project compiler
382
+ and served through MCP resources inside the App iframe; external hosts install
383
+ nothing. The selected scenario loads its dependency closure. Shared modules are
384
+ cached within that App instance, and each separately opened App has its own runtime.
385
+
386
+ Keep ESM modules and explicit imports. Avoid an eagerly imported controller
387
+ registry. Tree shaking and shared chunks follow the project bundler: class methods,
388
+ side effects, global CSS and dynamic maps can retain extra code. Inspect emitted
389
+ resources instead of assuming a controller produces a minimal bundle.
390
+
391
+ Development-only `review/<Owner>` units may register the same guarantee/check
392
+ contracts for review presentation and controls. Subjects can name that owner's
393
+ separate review API or local headless helpers; checks still run registered project
394
+ profiles and can refer to an existing real scenario. This grants no production
395
+ API, catalogue entry, `covers` credit or runtime import permission. See the
396
+ [portable review guide](review.md).
@@ -59,7 +59,7 @@ export const scenario = {
59
59
  };
60
60
  ```
61
61
 
62
- Use attributes/selectors already owned by the real UI or its public review pattern.
62
+ Use attributes/selectors already owned by the real UI or its development-only review helper.
63
63
  Scenarios keep their existing styling/control rules. A target is not permission
64
64
  to add demo-only product props, custom CSS or synthetic native controls. Each
65
65
  selector is scoped to the App iframe and must match exactly one visible element.
@@ -1,6 +1,6 @@
1
1
  # Static owner contracts and development files
2
2
 
3
- Use one optional `<Owner>.ads.contract.ts` for owner-local tokens, constrained
3
+ Use one optional `<Owner>.ads.contract.ts` for constrained
4
4
  paint inputs, scoped runtime bindings, declarative parts and behavioral checks.
5
5
  The import `import type { UnitContract } from "@reqvire-org/ads/contracts"` supplies
6
6
  development typing. ADS reads its AST and resolves real symbols without importing
@@ -15,12 +15,9 @@ components/Plot/
15
15
  renderer.tsx production consumer
16
16
  paints.ts production binding producer
17
17
  types.ts production prop types
18
- tokens.css optional production token definitions
19
18
  Plot.ads.contract.ts static tool declaration
20
19
  Plot.ads.scenario.tsx demonstration
21
20
  Plot.ads.fixture.ts demonstration data
22
- Tokens.ads.scenario.tsx real owner-token samples
23
- Tokens.ads.fixture.ts sample bindings/probes
24
21
  Plot.ads.behavior.spec.ts registered browser checks
25
22
  Plot.ads.test.tsx optional unit tests
26
23
  Plot.ads.helpers.ts development-only adapters
@@ -56,7 +53,6 @@ import { paints } from "./paints";
56
53
 
57
54
  export default {
58
55
  schemaVersion: 1,
59
- tokens: { namespace: "--plot-", stylesheet: "./tokens.css" },
60
56
  paintInputs: [
61
57
  { api: Plot, property: "config.*.paint", kind: "paint-reference" },
62
58
  { api: Series, property: "fill", kind: "paint-reference", bindings: ["items"] },
@@ -164,17 +160,17 @@ Raw constants, undeclared fields, extra writes and unknown transforms are reject
164
160
  The browser audit checks actual accessible color references in both branches;
165
161
  a local SVG URL or `none` is not a CSS color inside `light-dark()`.
166
162
 
167
- Families cannot overlap shared tokens, owner-token namespaces, private runtime
163
+ Families cannot overlap shared tokens, private runtime
168
164
  prefixes or other bindings. A broad family such as `--color-${key}` grants no
169
165
  shared-token exception. Use a distinct private family where collision freedom
170
166
  cannot be established. Registered paint consumers list their allowed binding IDs;
171
- borrowing a peer's family or private token remains invalid. Bindings are scoped
167
+ borrowing a peer's binding family or private runtime variable remains invalid. Bindings are scoped
172
168
  to their actual root; portals outside it need deliberate project integration.
173
169
 
174
170
  A registered binding producer may combine two accessible color references as
175
171
  `light-dark(var(--light-token), var(--dark-token))`. The App paint audit checks
176
172
  both branches and their observed effect in the active color scheme. Raw colors,
177
- unknown/private tokens and SVG URLs inside this color function remain invalid.
173
+ undefined tokens and SVG URLs inside this color function remain invalid.
178
174
  This derived binding form does not widen public paint-input types; use constrained
179
175
  references for each theme input and verify both color schemes in browser checks.
180
176
 
@@ -239,38 +235,23 @@ retained. Unreadable prerequisites report coverage as not established. Inspect
239
235
  the exact source diagnostic and bounded results; do not assume every subsequent
240
236
  missing preview means its runtime API is invalid.
241
237
 
242
- ## Local tokens and project consistency
243
-
244
- `tokens.css` remains optional production design data for component/pattern owners,
245
- imported by the runtime owner. Controllers stay headless; review uses the shared
246
- vocabulary and its own development presentation state. Only root/theme definitions belong there. Tokens require real sample
247
- coverage, including independently built owner token scenarios. One namespace
248
- cannot be shared by peer components. Private references remain private through
249
- TS constants, re-exports, helper returns, SVG/paint props and property reads/writes.
250
- Normal composition of a public component using its own tokens remains valid.
251
- Source analysis covers supported value flows; arbitrary dynamic code is not
252
- proof of ownership. CSS variables remain browser-visible; namespacing is an
253
- architecture boundary, not browser encapsulation.
254
-
255
- Ownership does not establish a project's visual scale:
256
-
257
- - A component redefining shared `--space-4` fails.
258
- - Its private `--plot-gap: 7px` can be valid component geometry.
259
- - `--plot-gap: var(--space-4)` preserves a shared scale with local meaning.
260
-
261
- Choose project policy explicitly. A registered project check can use tooling-only
262
- `inspectTokens(root)` and `inspectTokenOrigins(inventory, name, { stopAt: names })`
263
- from `@reqvire-org/ads`. `aliasOnly` verifies every theme definition follows only
264
- aliases to the explicitly selected origins; `literals` and `diagnostics` explain
265
- violations/limits. Select the exact targets and permitted shared origins. Keep
266
- intentional geometry exceptions exact with documented reasons. ADS neither
267
- infers spacing meaning from names nor prescribes a global spacing palette.
238
+ ## Shared Data and project consistency
239
+
240
+ Data has one shared design vocabulary in the configured token foundation. There
241
+ is no owner-contract token namespace or private value stylesheet. Components map
242
+ shared values into `--ds-*`; patterns use `--ux-*`. Static literals cannot bypass
243
+ this boundary through aliases, fallbacks, themes or helper/import interpolation.
244
+ Shared token samples belong under the token directory. See
245
+ [shared Data and component mappings](design-data.md).
246
+
247
+ `inspectTokenOrigins(inventory, name, {stopAt: names})` remains available for
248
+ project-specific audits of shared alias relationships. It supplements mandatory
249
+ core source checks and does not enable independent local values.
268
250
 
269
251
  ## Migration and MCP editing
270
252
 
271
- Legacy `tokens.json`/`<Owner>.tokens.json` and `behavior.json` remain readable.
272
- Use either authoring form per section; competing declarations fail. New contracts
273
- normalize into the same discovery, ownership, source revisions, affected-check
253
+ Use the static owner contract for new registrations. Competing declarations fail.
254
+ Contracts participate in discovery, ownership, source revisions, affected-check
274
255
  selection and candidate gates. `ads_units` exposes `contractFile`; `ads_catalog`
275
256
  reports constrained paint paths and declarative parent/consumer/check references.
276
257
  Use bounded file reads and paged detailed results, not repeated whole-project dumps.
@@ -0,0 +1,91 @@
1
+ # Shared Data, component mappings and design consistency
2
+
3
+ ADS has three cooperating responsibilities: Data supplies one shared design
4
+ vocabulary; UX owns structure, behavior and accessibility; Skin maps Data to
5
+ states and variants. Components own their implementation, not separate design
6
+ systems. Project values and themes remain project-owned.
7
+
8
+ ## One design catalogue
9
+
10
+ Define static design values, semantic roles, formulas and themes in the configured
11
+ shared token foundation: colors, typography, spacing and elevation. Reuse existing
12
+ roles before introducing another token. A new value is a visible project design
13
+ decision. Do not copy every imported library constant into another name merely to
14
+ satisfy a guard. Existing project font, text, spacing and other semantic roles
15
+ take precedence over divergent upstream constants. Preserve the capability and
16
+ interaction contract, then document deliberate visual differences from the
17
+ migration reference. Do not add a private or duplicate role to recover an
18
+ upstream font or size that project policy intentionally replaces.
19
+
20
+ Porting should converge on the destination's visual language. Different upstream
21
+ dependencies do not justify separate scales or duplicate roles. Consolidate
22
+ equivalent roles introduced by the selected port, update their consumers and
23
+ samples, and remove obsolete source sheets when unused. Compare semantics,
24
+ themes, states and actual use before merging; equal numbers alone are not enough.
25
+ For an empty destination, establish a coherent initial vocabulary across the
26
+ selected scope. Exact upstream pixels are not a default acceptance requirement.
27
+ Document intentional adaptations and verify consistency with existing UI while
28
+ preserving required behavior. Unrelated cleanup or removal of an existing public
29
+ token needs its own scope/compatibility decision.
30
+
31
+ There are no owner-local token namespaces, token manifests, component token value
32
+ sheets or `tokens` sections in owner contracts. Token previews and their fixtures
33
+ belong under the shared token directory. The public contract remains about shared
34
+ names, meanings, types and alias relationships; ADS supplies no hardcoded palette,
35
+ spacing grid or component catalogue.
36
+
37
+ ## Component variables are mappings and runtime mechanics
38
+
39
+ `--ds-*` belongs to component implementations, `--ux-*` to patterns and review
40
+ presentation, and `--showcase-*` to development scaffolding. They are not additional
41
+ token vocabularies. State styling remains owned by the control. Documented non-state
42
+ customization hooks keep their narrow registration and ownership rules.
43
+
44
+ ```css
45
+ /* In component Linaria: map project Data into a state. */
46
+ --ds-control-bg: var(--accent);
47
+ --ds-control-hover-bg: var(--accent-hover);
48
+ --ds-control-gap: var(--space-4);
49
+ --ds-control-font: var(--font-sans);
50
+
51
+ /* Rejected: private design values, even behind aliases or fallbacks. */
52
+ --ds-control-gap: 7px;
53
+ --ds-control-bg: red;
54
+ --ds-control-gap: var(--space-4, 7px);
55
+ --ds-control-font: Arial;
56
+ ```
57
+
58
+ Styles and static interpolations from imports/helpers obey the same source rule.
59
+ Unknown interpolation is not proof of a valid design source. Typography/layering
60
+ roles follow variable references to their actual consuming properties; a different
61
+ variable name cannot conceal an independent font, weight or stacking level.
62
+
63
+ Zero, structural unitless geometry, percentages, grid fractions, responsive
64
+ viewport/container relationships and structural angles retain their existing use.
65
+ Measured instance geometry still uses exact, documented style-write boundaries;
66
+ those boundaries do not authorize another static design palette. Typed per-instance
67
+ paint bindings retain their provenance and browser checks. Inputs select shared
68
+ paints or local SVG resources, rather than supplying arbitrary visual strings.
69
+
70
+ A calculation containing a raw design length/color is still rejected. Structural
71
+ calculations using shared values can remain valid; static analysis cannot prove
72
+ whether a dimensionless factor represents real geometry or an invented scale.
73
+ Review that intent and do not disguise a new design decision as arithmetic.
74
+
75
+ ## Review overlap without deleting legitimate roles
76
+
77
+ `token-overlap-review` is a nonblocking warning for shared tokens with identical
78
+ normalized definitions across their declared theme/condition scopes. It identifies
79
+ the tokens and source. Inspect their consumers and roles. If one decision is being
80
+ copied, reuse one shared token or make its relationship explicit with an alias.
81
+ Equal values alone do not prove equal purpose: body text and strong text, spacing
82
+ and control sizes, or two motion roles may intentionally differ later. A light-only
83
+ match does not justify merging tokens whose dark/reduced-motion values differ.
84
+
85
+ For our existing workspaces, convert independent component constants explicitly:
86
+ select an existing shared role when it means the same thing; centralize genuinely
87
+ missing decisions; remove private sheets/imports and contract fields; update token
88
+ sample coverage in the shared directory. Preserve themes, units, public APIs and
89
+ behavior unless changing the visual policy was explicitly intended. Review a Git
90
+ diff and run core, project and browser checks. There is no compatibility mode that
91
+ keeps independent component token definitions valid.
@@ -118,3 +118,7 @@ the smallest source/browser reproduction when ownership remains unprovable.
118
118
  guard acceptance; registered tests establish only their actual cases/profiles.
119
119
  Neither establishes untested states, visual parity, an accessibility audit or
120
120
  another MCP host's compatibility. Captures show an appearance, not a transition.
121
+
122
+ When targeted investigation suggests a tooling defect or missing capability, read
123
+ [reporting.md](reporting.md), then use the matching intake tool. Reports preserve
124
+ compact evidence without certifying an ADS cause or changing validation policy.
@@ -19,7 +19,7 @@ managed preview, not the live showcase. Read the summary, then page failing
19
19
  `outcomes`, `diagnostics` or pipeline `checks` through `ads_results` with its
20
20
  `resultId`. Inspect one exact outcome with `ads_investigate({unit,check,runId})`;
21
21
  fix the draft and diff again. See [evidence.md](evidence.md) for page/range limits.
22
- Keep behavior.json/specs with their owner and use registered checks; a scratchpad
22
+ Keep `<Owner>.ads.contract.ts` and specs with their owner and use registered checks; a scratchpad
23
23
  run against live source cannot verify unapplied changes. After validation, apply
24
24
  with `dryRun:false`; ADS revalidates before writing. Dry-run evidence is not saved
25
25
  as passing evidence for the live project.
@@ -106,15 +106,11 @@ on the final candidate before live source is written. Dry-run first. Rejection,
106
106
  conflict and cancellation publish nothing. Dependency installation remains local;
107
107
  the candidate uses installed node_modules. Never bypass a rejected gate directly.
108
108
 
109
- A component/pattern can own constants without expanding the shared vocabulary:
110
- colocate `tokens.json` with `{ "schemaVersion":1, "namespace":"--<owner>-" }`
111
- and a definition-only `tokens.css`, imported by its runtime source. Flat owners use
112
- `<Owner>.tokens.json`/`<Owner>.tokens.css`. Namespaces are unique and cannot overlap
113
- shared or --ds-/--ux-/--showcase- variables. Only that owner consumes/defines its
114
- local tokens; aliases can use shared or own tokens. UI styles stay in Linaria.
115
- Add a colocated token scenario with `kind:"tokens"`, real fixture `samples` and a
116
- development-only review renderer. These inputs belong to the same owner and need real sample
117
- coverage. Manifests and fixtures stay out of the product bundle.
109
+ Static design values and formulas belong in the shared Data foundation. Components
110
+ map those values with `--ds-*` variables; patterns use `--ux-*`. There are no private
111
+ token namespaces/value sheets or token sections in owner contracts. Keep measured
112
+ runtime geometry separate. Read [design-data.md](design-data.md) before adding a
113
+ design value or repairing an ownership/value-source diagnostic.
118
114
 
119
115
  `ads_prepare_token_samples({id, bindings?})` preserves existing project samples,
120
116
  removes undeclared names and returns an owner patchFile. Supply explicit
@@ -138,7 +134,7 @@ DOM. Source ownership must be proven; an `asChild` flag or a lookalike marker is
138
134
  insufficient. Standalone controls and custom scenario styling remain rejected. See
139
135
  [scenarios.md](scenarios.md) for evidence and limits. Preserve the intended
140
136
  composition instead of substituting an unrelated styled control or adding a
141
- demo-only component prop. Review framing belongs in public layout patterns.
137
+ demo-only component prop. Review framing belongs in development-only `review/`, through its separate public entry.
142
138
 
143
139
  A complete runner report containing an ordinary failed assertion preserves each
144
140
  passing check as `passed`; the failed check remains `failed`, and overall