@reqvire-org/ads 0.3.3 → 0.3.6

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 (68) hide show
  1. package/README.md +17 -5
  2. package/dist/behaviors.mjs +157 -0
  3. package/dist/bootstrap-ds/ADS.md +16 -3
  4. package/dist/bootstrap-ds/README.md +10 -0
  5. package/dist/bootstrap-ds/design-system/controllers/.gitkeep +0 -0
  6. package/dist/boundaries.mjs +3 -0
  7. package/dist/check.mjs +20 -2
  8. package/dist/cli.mjs +17 -0
  9. package/dist/config.mjs +23 -3
  10. package/dist/css-values.mjs +26 -0
  11. package/dist/index.mjs +2 -0
  12. package/dist/init.mjs +1 -1
  13. package/dist/mcp/build-status.mjs +17 -7
  14. package/dist/mcp/catalog.mjs +11 -8
  15. package/dist/mcp/context.mjs +3 -3
  16. package/dist/mcp/edit-preparation.mjs +111 -0
  17. package/dist/mcp/mutations.mjs +64 -38
  18. package/dist/mcp/preview-owner-guard.mjs +29 -0
  19. package/dist/mcp/preview-watch.mjs +38 -8
  20. package/dist/mcp/preview-widget.bundle.js +2 -2
  21. package/dist/mcp/prompts.mjs +2 -2
  22. package/dist/mcp/server.mjs +88 -41
  23. package/dist/mcp/showcase-host.mjs +9 -5
  24. package/dist/mcp/text-diff.mjs +19 -0
  25. package/dist/preview-resources.mjs +45 -8
  26. package/dist/preview-scope.mjs +30 -0
  27. package/dist/public-api.mjs +39 -0
  28. package/dist/scenarios-compiler.mjs +41 -19
  29. package/dist/scenarios.mjs +72 -42
  30. package/dist/scoped-tokens.mjs +57 -0
  31. package/dist/skills/README.md +3 -3
  32. package/dist/skills/ads-break-ui/SKILL.md +26 -2
  33. package/dist/skills/ads-break-ui/references/guarded-editing.md +44 -0
  34. package/dist/skills/ads-break-ui/references/verification.md +6 -0
  35. package/dist/skills/ads-designer/SKILL.md +27 -3
  36. package/dist/skills/ads-designer/assets/bootstrap-ds/ADS.md +16 -3
  37. package/dist/skills/ads-designer/assets/bootstrap-ds/README.md +10 -0
  38. package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/controllers/.gitkeep +0 -0
  39. package/dist/skills/ads-designer/references/cli.md +1 -1
  40. package/dist/skills/ads-designer/references/design-craft.md +1 -1
  41. package/dist/skills/ads-designer/references/guarded-editing.md +44 -0
  42. package/dist/skills/ads-import/SKILL.md +26 -2
  43. package/dist/skills/ads-import/references/cli.md +1 -1
  44. package/dist/skills/ads-import/references/guarded-editing.md +44 -0
  45. package/dist/skills/ads-import/references/tokens.md +4 -2
  46. package/dist/skills/{ads-assimilate → ads-migrate}/SKILL.md +32 -8
  47. package/dist/skills/ads-migrate/agents/openai.yaml +4 -0
  48. package/dist/skills/{ads-assimilate → ads-migrate}/references/cli.md +1 -1
  49. package/dist/skills/ads-migrate/references/guarded-editing.md +44 -0
  50. package/dist/skills/{ads-assimilate → ads-migrate}/references/native-implementation.md +11 -0
  51. package/dist/skills/ads-motion/SKILL.md +26 -2
  52. package/dist/skills/ads-motion/references/guarded-editing.md +44 -0
  53. package/dist/token-fixtures.mjs +30 -0
  54. package/dist/tokens.mjs +11 -4
  55. package/dist/units.mjs +35 -9
  56. package/dist/verification/browser.mjs +27 -0
  57. package/dist/verification/playwright-reporter.cjs +20 -0
  58. package/dist/verification.mjs +214 -0
  59. package/docs/ADS.md +72 -4
  60. package/docs/ARCHITECTURE.md +60 -1
  61. package/docs/BEHAVIORS.md +241 -0
  62. package/docs/CHANGELOG.md +56 -0
  63. package/docs/GUIDE.md +24 -4
  64. package/docs/MCP.md +106 -12
  65. package/package.json +4 -2
  66. package/dist/skills/ads-assimilate/agents/openai.yaml +0 -4
  67. /package/dist/skills/{ads-assimilate → ads-migrate}/references/lint-and-docs.md +0 -0
  68. /package/dist/skills/{ads-assimilate → ads-migrate}/references/testing.md +0 -0
package/docs/MCP.md CHANGED
@@ -17,7 +17,11 @@ preview watcher and artifacts. Stdout remains exclusively JSON-RPC.
17
17
 
18
18
  For browser-only work, run `ads showcase` inside the project. It starts the same
19
19
  runtime without stdio. `--port 4185` selects a port; otherwise the OS chooses an
20
- available one. `ads mcp --no-showcase` disables the website for headless clients.
20
+ available one. For a stable address, add `"--port", "4191"` to the server's `args`
21
+ in `.mcp.json` (or the corresponding client configuration). An occupied explicit
22
+ port fails startup; ADS does not silently switch ports or terminate another live
23
+ client. Reuse the connected server's showcase instead of launching another one.
24
+ `ads mcp --no-showcase` disables the website for headless clients.
21
25
  The website binds to 127.0.0.1 and accepts its own origin only. It serves packaged
22
26
  client assets and MCP, with no arbitrary file reader or command launcher.
23
27
  Shutdown closes both transports, subscriptions and the managed compiler.
@@ -155,7 +159,7 @@ The server supplies agent guidance through its instructions, tool descriptions,
155
159
  | Tool | Purpose |
156
160
  |------|---------|
157
161
  | `ads_status` | Project paths, watcher/build states, preview revisions and diagnostics, skills |
158
- | `ads_catalog` | Bounded search for real public components/patterns and source/guide URIs |
162
+ | `ads_catalog` | Bounded search for public UI, controllers and hooks, with source/guide URIs |
159
163
  | `ads_tokens` | Bounded token-definition and theme inspection |
160
164
  | `ads_check` | Current core architectural diagnostics; registered Oxlint/build tests remain separate |
161
165
  | `ads_skills` | Workflow names/descriptions without loading instructions |
@@ -163,22 +167,53 @@ The server supplies agent guidance through its instructions, tool descriptions,
163
167
  | `ads_show_tokens` | Render a discovered token scenario; legacy compilers retain the definition inspector |
164
168
  | `ads_scenarios` | Bounded token/component/pattern/composition scenario discovery |
165
169
  | `ads_show_scenario` | Render an exact discovered scenario with its own fixtures |
170
+ | `ads_behaviors` | Bounded guarantee/evidence discovery; pass an exact unit for contract details |
171
+ | `ads_verify` | Execute an owner's registered checks and record revision-bound evidence |
166
172
  | `ads_show_<id>` | Optional explicitly configured grouped App |
167
173
  | `ads_units` | Discover edit owners and the files belonging to one unit |
174
+ | `ads_prepare_patch` | Prepare a local draft of one owner, then generate its Git patch |
175
+ | `ads_prepare_token_samples` | Reconcile real-token fixture samples using explicit project bindings |
176
+ | `ads_apply_transaction` | Validate and apply coupled owner patches as one final candidate |
168
177
  | `ads_read_file` | Read bounded source ranges, with owning unit and full-file digest |
169
178
  | `ads_apply_patch` | Opt-in Git unified diff for one ADS unit, with dry-run validation |
170
179
 
171
180
  Listings have bounded pages and opaque cursors. The source catalogue exposes
172
- public exports from `components/` and `patterns/`; it does not execute TSX to
181
+ public exports from `components/`, `patterns/` and `controllers/`; it does not execute TSX to
173
182
  guess component props. Read the exported API and owning guide. An export name
174
183
  alone does not prove that a preview renders that particular element.
175
184
 
176
- `ads://project/status`, `/build`, `/tokens`, `/catalog`, `/scenarios`, and `/checks` carry complete JSON
185
+ `ads://project/status`, `/build`, `/tokens`, `/catalog`, `/scenarios`, `/behaviors`, and `/checks` carry complete JSON
177
186
  detail. Allowed project documentation/source and skill files are separate
178
187
  resources. No arbitrary filesystem reader is exposed. Prefer bounded tools for
179
188
  large catalogues; explicit resource reads can enter model context and a client
180
189
  may truncate large payloads.
181
190
 
191
+ ### Behavioral verification
192
+
193
+ Read `ads://guides/behaviors` or the [behavior guide](BEHAVIORS.md) for the contract
194
+ and runner schema. `ads_behaviors({ "unit": "components/MessageScroller" })`
195
+ returns subjects, guarantees, demonstration links and check IDs for a discovered
196
+ owner. `ads_verify({ "unit": "components/MessageScroller", "checks": ["prepend-anchor"] })`
197
+ runs those registered cases. The names here are examples, never built-in cases.
198
+
199
+ `covers` describes rendered UI; optional `exercises` describes public behavioral
200
+ APIs used through reachable scenario code. Neither metadata nor README prose is
201
+ passing evidence. Verification runs trusted project commands from configured
202
+ profiles, without installing dependencies. It is available in read-only source
203
+ mode too and is annotated as executing commands/writing generated evidence.
204
+ Missing/skipped cases, unavailable runners and changed inputs cannot pass.
205
+ Results and subscribed resource notifications are available through
206
+ `ads://project/behaviors`; explicitly re-read evidence when notifications are absent.
207
+
208
+ Browser profiles start an isolated showcase and verify its sandboxed App using
209
+ the selected candidate's sources. StrictMode profiles need a project React
210
+ development harness. Profiles describe the execution environment, not a proof
211
+ that every possible interaction or lifecycle has been tested.
212
+
213
+ Guarded mutations also run affected registered behavior checks, including contracts
214
+ that depend on changed shared controllers. Failures reject the candidate before
215
+ writing real source. Projects without contracts retain their existing checks.
216
+
182
217
  ## Guarded editing
183
218
 
184
219
  Enable editing in the MCP launch arguments and reconnect:
@@ -188,8 +223,9 @@ npx -y @reqvire-org/ads mcp --mutations
188
223
  ```
189
224
 
190
225
  `ads_status.mutations` reports the mode, checks, limits and latest result. Editing
191
- is disabled by default. The editing tool accepts **one Git unified diff for one
192
- ADS unit**, not replacement file bodies or a caller-selected batch of owners.
226
+ is disabled by default. The default editing tool accepts **one Git unified diff
227
+ for one ADS unit**. Replacement file bodies are not mutation inputs. Genuinely
228
+ coupled changes use the bounded owner transaction described below.
193
229
 
194
230
  Find the owner with `ads_units({ "query": "Button" })`, then request its file
195
231
  manifest with `ads_units({ "unit": "components/core/Button" })`. IDs derive from
@@ -199,6 +235,8 @@ composition owns its scenario and mock inputs. Imported components and patterns
199
235
  remain separate owners. `tokens` is one foundation unit covering token definitions,
200
236
  themes and token scenarios/fixtures, whose coverage spans shared source files.
201
237
  Preview IDs remain separate: several token previews belong to `tokens`.
238
+ Unit-local token definitions and their previews stay in their component/pattern
239
+ owner; see [owner tokens](ADS.md#owner-local-tokens).
202
240
 
203
241
  The `tokens` manifest also returns `companionFiles` with the configured foundation
204
242
  entry path. When creating or deleting a canonical token foundation file, include
@@ -224,6 +262,8 @@ name) or colocated fixture keeps ownership stable without `Scenario.tsx`.
224
262
  A redundant standalone scenario can be removed when other registered scenarios
225
263
  still declare and actually render its public exports. Coverage requirements remain
226
264
  in force; there is no metadata waiver for uncovered UI.
265
+ An empty `.gitkeep` may be deleted alongside new source in the selected owner
266
+ beneath that marker. Other hidden files and nonempty markers remain blocked.
227
267
 
228
268
  The same discovery covers the rest of the project ADS:
229
269
 
@@ -278,6 +318,47 @@ not an edit to live ADS source. Binary `ads_read_file` results return the digest
278
318
  byte count without encoded content. Git verifies the original binary blob and
279
319
  reconstructs the result inside the validation copy.
280
320
 
321
+ For local editing without a second Git mirror, call
322
+ `ads_prepare_patch({unit, action:"create"})`. It returns a draft ID and a local
323
+ directory containing only the owner and declared companions. Edit that directory
324
+ using the client's local file tools, then call
325
+ `ads_prepare_patch({unit, action:"diff", draft})`. It checks source/baseline
326
+ freshness and owner paths and returns a `patchFile`; it changes no live source.
327
+ Apply the result through `ads_apply_patch`, which runs the normal candidate gates.
328
+ Use `action:"discard"` to remove the draft. Remote clients can continue sending
329
+ inline Git diffs. Drafts are local conveniences, not an alternative mutation API.
330
+
331
+ `ads_prepare_token_samples({id, bindings?})` reconciles the selected token
332
+ scenario's consumed literal sample array. Existing bindings and other fixture
333
+ fields are preserved; undeclared samples are removed. New bindings explicitly
334
+ name a real `token`, CSS `property` and `probe`. Missing mappings are reported as
335
+ `unresolved`; ADS never guesses a property or renderer from the token name.
336
+ The result is an owner patch file for guarded application. This preparation does
337
+ not establish rendered effects or waive token coverage.
338
+
339
+ For a coupled rename or upgrade, call `ads_apply_transaction`:
340
+
341
+ ```json
342
+ {
343
+ "patches": [
344
+ { "unit": "tokens", "patchFile": ".ds/patches/tokens.patch" },
345
+ { "unit": "components/Button", "patchFile": ".ds/patches/button.patch" }
346
+ ],
347
+ "dryRun": true
348
+ }
349
+ ```
350
+
351
+ It accepts 2–8 distinct owners, at most 32 distinct files and 16 MiB of combined
352
+ Git diff text. Each patch obeys its own ownership/companion rules. Patches apply
353
+ in order inside one candidate; shared-entry hunks in a later patch must match
354
+ the earlier candidate's content. Core checks, registered Oxlint, project commands
355
+ and all affected behavior checks run against the final candidate. No intermediate
356
+ candidate is published. Dry runs, failures, conflicts and cancellation write no
357
+ source; a publication failure rolls back prior writes. This coordinates owned
358
+ source migrations, not dependency installation or arbitrary application files.
359
+ Install changed dependencies before verification; candidates use the project's
360
+ installed `node_modules`.
361
+
281
362
  Resolve ownership diagnostics by preserving the required capability in its proper
282
363
  layer. Demo-only sizing, borders and framing belong in a public review/layout
283
364
  pattern; a component API addition needs a runtime use case. Measured imperative
@@ -294,8 +375,8 @@ a new directory owner, or change unrelated public-entry statements. Shared
294
375
  public-entry changes are limited to re-exports from the selected unit. Alongside
295
376
  its real re-export, a patch can remove an obsolete `export {};` placeholder;
296
377
  it cannot add one or change unrelated statements. Init generates no empty-export
297
- placeholder. Report unsupported coupled changes rather than bypassing a rejected
298
- mutation with direct source writes.
378
+ placeholder. For coupled owners use the bounded transaction; a rejection still
379
+ requires correcting its owner/policy, never a direct-write bypass.
299
380
 
300
381
  Set `dryRun` to `false` to apply. ADS reconstructs complete candidate files locally
301
382
  and validates a temporary project copy with core guards and registered Oxlint
@@ -525,7 +606,13 @@ wrappers require their own launcher and are not shell-executed by ADS.
525
606
  Both build output streams go to stderr, keeping stdout exclusively for MCP.
526
607
  Opening an App waits up to 30 seconds for validated current output. A matching
527
608
  success cache is republished in the new watcher session without recompilation;
528
- merely finding an older HTML file is insufficient. A timeout leaves the watcher running: inspect the
609
+ merely finding an older HTML file is insufficient. Managed resource graphs and
610
+ HTML descriptors use private session output; standalone build commands retain
611
+ the configured output. One cannot overwrite the other's success record. The
612
+ compiler caches at most six verified graph snapshots under `.ds/preview-graphs/`
613
+ and cleans its session output on ordinary shutdown. These are generated files;
614
+ do not track or use them as source. Legacy self-contained HTML builders retain
615
+ their existing publication contract. A timeout leaves the watcher running: inspect the
529
616
  logs and invoke the preview again. `ads_status` distinguishes watcher process
530
617
  state from reported build state. Token inspection and other ordinary tools
531
618
  remain available after a build failure. Invalid scenario metadata at startup and
@@ -540,8 +627,15 @@ Managed configuration changes replace the compiler through the same supervisor.
540
627
  Updating ADS server code itself still requires reconnecting the MCP client to load
541
628
  the new package. Normal component, fixture and style edits remain automatic.
542
629
 
543
- ADS stops the managed watcher and its compiler subprocesses when stdin closes or
544
- it receives SIGINT/SIGTERM. The project must keep its watcher in the foreground,
630
+ ADS closes both network hosts and stops the managed watcher and its compiler
631
+ subprocesses when the stdio wire closes, including EOF or broken output, or it
632
+ receives SIGINT/SIGTERM. Active browser subscriptions do not retain the runtime.
633
+ A small independent ownership guard watches a pipe from MCP; owner death closes
634
+ that pipe even after SIGKILL. The guard terminates the owned compiler process
635
+ group, escalates for stubborn descendants, then exits. It is disarmed on ordinary
636
+ shutdown; `previewWatch.guardPid` identifies it while running. This requires no
637
+ second user command and applies to custom builders too.
638
+ The project must keep its watcher in the foreground,
545
639
  rather than launching detached background processes. The configuration is
546
640
  trusted project setup; MCP tools accept no executable or command arguments.
547
641
  To manage builds yourself, omit `previewWatch` or set it to `null`, then run the
@@ -680,7 +774,7 @@ See the [MCP Apps specification](https://github.com/modelcontextprotocol/ext-app
680
774
  | Each of the five ADS skill names | `request` | Select that workflow and its skill resource |
681
775
 
682
776
  Example: get `ads-inspect` with `element="Button states in both themes"`, or
683
- `ads-assimilate` with `request` containing the upstream component-library URL.
777
+ `ads-migrate` with `request` containing the upstream component-library URL.
684
778
  Prompts explain Data/UX/Skin ownership, public API reuse, fixture boundaries,
685
779
  which tools select widgets, progressive skill reads and validation. They guide
686
780
  reasoning rather than inventing another component implementation.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reqvire-org/ads",
3
- "version": "0.3.3",
3
+ "version": "0.3.6",
4
4
  "type": "module",
5
5
  "description": "A design system your agent can see and shape. Your components. Your look. Your code.",
6
6
  "repository": {
@@ -69,6 +69,7 @@
69
69
  "@modelcontextprotocol/client": "2.3.1",
70
70
  "@modelcontextprotocol/ext-apps": "2.0.3",
71
71
  "@modelcontextprotocol/sdk": "1.32.1",
72
+ "@playwright/test": "1.64.1",
72
73
  "@preact/signals": "2.11.3",
73
74
  "@types/node": "^25.9.2",
74
75
  "@types/react": "^19.2.17",
@@ -98,7 +99,8 @@
98
99
  "./mcp/build": "./dist/mcp/build-status.mjs",
99
100
  "./scenarios": "./dist/scenarios.mjs",
100
101
  "./scenarios/vite": "./dist/scenarios-vite.mjs",
101
- "./scenarios/compiler": "./dist/scenarios-compiler.mjs"
102
+ "./scenarios/compiler": "./dist/scenarios-compiler.mjs",
103
+ "./verification": "./dist/verification/browser.mjs"
102
104
  },
103
105
  "files": [
104
106
  "dist",
@@ -1,4 +0,0 @@
1
- interface:
2
- display_name: "ADS Assimilate"
3
- short_description: "Adapt reference components into a native design system"
4
- default_prompt: "Use $ads-assimilate with a component-library URL to implement and verify a native design-system component."