@reqvire-org/ads 0.3.36 → 0.3.37

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 (83) hide show
  1. package/README.md +10 -8
  2. package/dist/bootstrap-ds/README.md +8 -9
  3. package/dist/bootstrap-ds/ds.config.json +1 -8
  4. package/dist/bootstrap-ds/package.json +4 -3
  5. package/dist/bootstrap-ds/scripts/build-mcp-previews.mjs +2 -32
  6. package/dist/bun-compiler.mjs +13 -0
  7. package/dist/bun-worker.mjs +9 -0
  8. package/dist/check.mjs +7 -4
  9. package/dist/cli.mjs +11 -7
  10. package/dist/config.mjs +22 -4
  11. package/dist/development-runtime.mjs +3 -1
  12. package/dist/init.mjs +16 -18
  13. package/dist/mcp/build-status.mjs +6 -4
  14. package/dist/mcp/context.mjs +9 -4
  15. package/dist/mcp/drafts.mjs +4 -2
  16. package/dist/mcp/mutations.mjs +4 -14
  17. package/dist/mcp/preview-watch.mjs +21 -9
  18. package/dist/mcp/preview-widget.bundle.js +58 -63
  19. package/dist/mcp/preview-work.mjs +1 -15
  20. package/dist/mcp/project-widget.bundle.js +57 -62
  21. package/dist/mcp/prompts.mjs +2 -2
  22. package/dist/mcp/resource-loader.js +32 -10
  23. package/dist/mcp/server.mjs +89 -34
  24. package/dist/mcp/widget.bundle.js +59 -64
  25. package/dist/preview-builder.mjs +17 -5
  26. package/dist/preview-bun.mjs +266 -0
  27. package/dist/preview-imports.mjs +73 -0
  28. package/dist/preview-resources.mjs +26 -14
  29. package/dist/scenario-inspector.mjs +11 -4
  30. package/dist/scenarios-compiler.mjs +47 -6
  31. package/dist/showcase/client.bundle.js +68 -72
  32. package/dist/showcase/index.html +2 -2
  33. package/dist/showcase/sandbox.bundle.js +1 -1
  34. package/dist/showcase/style.css +4 -0
  35. package/dist/skills/ads-break-ui/SKILL.md +39 -40
  36. package/dist/skills/ads-break-ui/references/drafts.md +6 -3
  37. package/dist/skills/ads-break-ui/references/guarded-editing.md +4 -3
  38. package/dist/skills/ads-break-ui/references/runtimes.md +91 -140
  39. package/dist/skills/ads-break-ui/references/validation.md +13 -3
  40. package/dist/skills/ads-break-ui/references/workflows.md +82 -0
  41. package/dist/skills/ads-designer/SKILL.md +38 -39
  42. package/dist/skills/ads-designer/assets/bootstrap-ds/README.md +8 -9
  43. package/dist/skills/ads-designer/assets/bootstrap-ds/ds.config.json +1 -8
  44. package/dist/skills/ads-designer/assets/bootstrap-ds/package.json +4 -3
  45. package/dist/skills/ads-designer/assets/bootstrap-ds/scripts/build-mcp-previews.mjs +2 -32
  46. package/dist/skills/ads-designer/references/cli.md +24 -20
  47. package/dist/skills/ads-designer/references/drafts.md +6 -3
  48. package/dist/skills/ads-designer/references/guarded-editing.md +4 -3
  49. package/dist/skills/ads-designer/references/runtimes.md +91 -140
  50. package/dist/skills/ads-designer/references/validation.md +13 -3
  51. package/dist/skills/ads-designer/references/workflows.md +82 -0
  52. package/dist/skills/ads-import/SKILL.md +40 -42
  53. package/dist/skills/ads-import/references/cli.md +24 -20
  54. package/dist/skills/ads-import/references/drafts.md +6 -3
  55. package/dist/skills/ads-import/references/guarded-editing.md +4 -3
  56. package/dist/skills/ads-import/references/runtimes.md +91 -140
  57. package/dist/skills/ads-import/references/validation.md +13 -3
  58. package/dist/skills/ads-import/references/workflows.md +82 -0
  59. package/dist/skills/ads-motion/SKILL.md +37 -38
  60. package/dist/skills/ads-motion/references/drafts.md +6 -3
  61. package/dist/skills/ads-motion/references/guarded-editing.md +4 -3
  62. package/dist/skills/ads-motion/references/runtimes.md +91 -140
  63. package/dist/skills/ads-motion/references/validation.md +13 -3
  64. package/dist/skills/ads-motion/references/workflows.md +82 -0
  65. package/dist/skills/ads-port/SKILL.md +37 -38
  66. package/dist/skills/ads-port/references/cli.md +24 -20
  67. package/dist/skills/ads-port/references/drafts.md +6 -3
  68. package/dist/skills/ads-port/references/guarded-editing.md +4 -3
  69. package/dist/skills/ads-port/references/runtimes.md +91 -140
  70. package/dist/skills/ads-port/references/validation.md +13 -3
  71. package/dist/skills/ads-port/references/workflows.md +82 -0
  72. package/dist/usage.mjs +84 -0
  73. package/dist/validation.mjs +0 -12
  74. package/dist/verification/browser.mjs +77 -48
  75. package/docs/ADS.md +17 -11
  76. package/docs/ARCHITECTURE.md +43 -29
  77. package/docs/BEHAVIORS.md +3 -3
  78. package/docs/CHANGELOG.md +60 -12
  79. package/docs/GUIDE.md +96 -53
  80. package/docs/MCP.md +96 -122
  81. package/docs/benchmarks/bun-previews.md +91 -0
  82. package/docs/benchmarks/gidi-preview-memory.md +4 -0
  83. package/package.json +15 -13
package/docs/GUIDE.md CHANGED
@@ -1,15 +1,17 @@
1
1
  # ADS tool guide
2
2
 
3
- For iterative design changes, use the [tracked auto-mode draft workflow](../skills/ads-designer/references/drafts.md):
4
- create a proposal, edit and preview it, review the actual result, then accept the
5
- exact revision. Drafts support coupled owners, shared token groups and component
6
- → pattern → composition dependencies. Explorer provides draft discovery and
7
- Accepted/Draft split comparison. Drafts are tracked source; `.ds/` preview caches
8
- are disposable. Required checks run at acceptance, and failed or unaccepted work
9
- must not be reported as a completed design change.
3
+ Choose [direct code editing or MCP-only editing](../skills/ads-designer/references/workflows.md).
4
+ Direct editors change owned files normally and use MCP for preview and validation;
5
+ ordinary edits do not require drafts or acceptance. MCP-only iterative editing
6
+ uses [tracked drafts](../skills/ads-designer/references/drafts.md), rendered review
7
+ and exact-revision acceptance. Direct editors may choose drafts for isolation and
8
+ Accepted/Draft comparison too. Complete any required tracked proposals before
9
+ reporting the design change finished. Compiler ownership is a separate choice:
10
+ the managed ADS compiler is the default for both editing routes; external
11
+ builders can publish resources/evidence with `mcp.previewWatch: false`.
10
12
 
11
13
  ADS is development tooling for a project's local design system. This package
12
- contains a Node/Bun CLI, shared token contract, static checks, an Oxlint plugin, and
14
+ contains a Bun CLI, shared token contract, native static checks, an optional linter adapter, and
13
15
  empty foundation scaffolding. It includes no component or pattern catalogue,
14
16
  fonts, mock screens, or UI runtime dependency.
15
17
 
@@ -31,15 +33,15 @@ An agent uses the MCP tools to inspect, edit and review the project:
31
33
  3. Open a discovered preview with `ads_show_scenario` or `ads_show_tokens`. These
32
34
  render the project's actual scenario, fixtures and adapter through MCP Apps.
33
35
  Use the returned showcase link when the client cannot render Apps.
34
- 4. For iterative changes with editing enabled, discover owners with `ads_units`,
35
- create a tracked proposal with `ads_create_draft`, and edit its marked source.
36
- `ads_read_file` reads both normal and registered draft source; use
37
- `ads_update_draft` to register additions/deletions. Preview with
38
- `ads_show_draft`, inspect the actual view or capture its exact revision with
39
- `ads_capture({scenario,draft,revision})`, then call `ads_accept`.
40
- Accept dependencies first and review dependent drafts again. Low-level
41
- `ads_apply_patch`/transactions and disposable `ads_prepare_patch` staging
42
- remain available for focused repairs/migrations.
36
+ 4. Select the editing route, independently of `mutations.enabled`. With direct
37
+ source access, edit owned files and use the existing compiler/preview; run
38
+ current gates and relevant project/behavior checks before finishing. With
39
+ MCP-only access and mutation tools enabled, discover owners with `ads_units`,
40
+ use `ads_create_draft`, `ads_read_file`/`ads_update_draft`, rendered
41
+ `ads_show_draft` review and exact-revision `ads_accept`. Accept dependencies
42
+ first and review dependents again. Guarded patches/transactions remain
43
+ available for MCP-only focused repairs/migrations. A read-only MCP connection
44
+ supports direct editors; it cannot edit for an MCP-only client.
43
45
  5. Review diagnostics, registered behavior evidence and the rendered result.
44
46
  `ads_behaviors` discovers guarantees; `ads_verify` executes selected registered
45
47
  checks. Recheck `ads_status.build` after changes; notifications alone do not
@@ -172,16 +174,17 @@ hooks. Init preserves the application's compiler, dependencies and mount adapter
172
174
  The example and empty starter use Biome only for CSS, configured in
173
175
  `biome.css.json`. Parsing rejects malformed CSS and invalid hex colors, including
174
176
  token values. Explicit lint rules reject duplicate font names and selectors;
175
- the starter also rejects duplicate properties. Formatting is disabled. Oxlint
176
- continues to handle JavaScript/TypeScript, and ADS guards enforce token usage and
177
- ownership separately. `ads init` preserves an existing project's lint tools.
177
+ the starter also rejects duplicate properties. Formatting is disabled. ADS directly checks architecture, token usage and
178
+ ownership in JavaScript/TypeScript. The tool repository uses Oxlint for its own
179
+ ordinary JavaScript linting; consumers do not need that extra pass. `ads init` preserves an existing project's lint tools.
178
180
 
179
181
  CSS regression tests cover rejected input, valid theme/nesting
180
182
  contexts, and exclusion of JavaScript and generated outputs.
181
183
 
182
184
  ## Set up an existing project
183
185
 
184
- Use Node 22.12+ or Bun 1.3.13+. Run inside the project containing `package.json`:
186
+ Install Bun 1.3.13+ for ADS tooling and previews. The application keeps its own
187
+ Node/npm or Bun pipeline. Run inside the project containing `package.json`:
185
188
 
186
189
  ```sh
187
190
  npx @reqvire-org/ads init --framework react
@@ -190,7 +193,7 @@ npm run build
190
193
  ```
191
194
 
192
195
  For a Bun-managed project, use
193
- `bunx --bun @reqvire-org/ads init --framework react`, followed by `bun install`
196
+ `bunx @reqvire-org/ads init --framework react`, followed by `bun install`
194
197
  and `bun --bun run build`. Node is unnecessary. No archive or directory argument is needed for a published
195
198
  release. `init` requires an existing project; it does not create an application.
196
199
  For starting from zero, the `ads-designer` skill carries a standalone empty
@@ -218,15 +221,14 @@ Initialization:
218
221
 
219
222
  - Adds the tool to `devDependencies`, with the executing version pinned by
220
223
  default. Keeps an existing tool version unless `--tool-package` overrides it.
221
- Adds Oxlint if the project does not already depend on it.
222
224
  - Creates missing `ds.config.json`, foundation CSS, a public entry, and empty
223
225
  component/pattern directories, brand guidance, and an empty font directory.
224
226
  Seeds token defaults only when the configured
225
227
  token folder contains no CSS. New foundation scenarios use the selected
226
228
  framework's hooks. Existing ADS source and token values remain unchanged;
227
229
  incomplete existing token contracts need an explicit migration.
228
- - Adds `lint:ds`, which refreshes lint configuration, runs `ads check`, and
229
- executes core and registered project Oxlint rules.
230
+ - Adds `lint:ds`, which runs native `ads check` directly. Project linter and test
231
+ commands remain explicitly owned by the project.
230
232
  - Adds `assets:ds` (`ads assets`) after those checks and before the existing
231
233
  `prebuild` hook, preserving the actual
232
234
  `build` command. If the project has no build script, adds a validation/generation
@@ -237,7 +239,8 @@ Initialization:
237
239
  preserved; deliberately switch it when migrating to the built-in MCP client.
238
240
  - Adds `ads-mcp` with guarded editing enabled and `ads-read-mcp` with editing
239
241
  disabled, preserving existing scripts with those names. Both start the showcase.
240
- - Generates `.ds/oxlintrc.json` and appends `.ds/` to the project's ignore file.
242
+ - Appends `.ds/` to the project's ignore file and supplies a framework mount
243
+ adapter for ADS's native preview compiler when one is missing.
241
244
 
242
245
  Application files, framework configuration, unrelated scripts/dependencies,
243
246
  and lockfiles are preserved. `init` does not install dependencies or configure
@@ -270,7 +273,7 @@ An existing Bun lockfile takes precedence over the npm runner used by `npx`.
270
273
  For a Bun project with no lockfile or package-manager metadata yet:
271
274
 
272
275
  ```sh
273
- bunx --bun @reqvire-org/ads init --framework react
276
+ bunx @reqvire-org/ads init --framework react
274
277
  bun install
275
278
  bun --bun run build
276
279
  ```
@@ -278,8 +281,8 @@ bun --bun run build
278
281
  Bun is inferred from the launcher when the project has no saved manager or lockfile.
279
282
  Use `--package-manager bun` only to override an existing project choice. Init
280
283
  does not translate the app's existing scripts. Bun hooks explicitly use `bun --bun run` so package executables,
281
- including ADS and Oxlint's JavaScript plugins, run on Bun despite Node shebangs.
282
- Launch the MCP server with `bunx --bun @reqvire-org/ads mcp`, or its generated
284
+ including ADS, run on Bun despite Node shebangs.
285
+ Launch the MCP server with `bunx @reqvire-org/ads mcp`, or its generated
283
286
  `ads-mcp` script. Managed workers and screenshot capture inherit the interpreter.
284
287
  Use `command: "runtime"` for portable preview compiler/behavior profiles;
285
288
  explicit `node`, `bun` or other commands are respected. Project-specific tools
@@ -465,8 +468,9 @@ These are static checks, not framework type checking or browser CSS evaluation.
465
468
  Arbitrary computed expressions, combined conditional cascade behavior, computed
466
469
  module specifiers, JSX spreads, other styling engines, and renderer-specific APIs
467
470
  need the project's existing checks and review. Continue to run its type checking,
468
- component tests, and browser comparisons. Component-specific rules run through
469
- Oxlint in `lint:ds`; `ads check` does not execute those plugins.
471
+ component tests, and browser comparisons. Register component-specific guards as
472
+ explicit project scripts; include them in builds and `mcp.mutationChecks` when
473
+ required. `ads check` does not invoke project linter plugins.
470
474
 
471
475
  ## Showcase
472
476
 
@@ -485,23 +489,27 @@ stale retained output. Its neutral header and left pane align and collapse
485
489
  together. Themes flow through the Apps host context. No project catalogue pages
486
490
  or direct component imports are used by this client.
487
491
 
488
- The project's responsibilities are the real implementations, colocated scenarios
489
- and fixtures, foundation CSS/Linaria extraction, and a preview compiler. The
490
- empty React starter includes a Vite compiler adapter and its tiny mount entry
491
- under `design-system/showcase/mcp/`. Init alone does not install or wire this
492
- compiler. For an existing app, adapt the starter's build script and mount entry,
493
- add its `build:mcp-previews` package script, and configure it explicitly:
492
+ The project owns implementations, colocated scenarios/fixtures, foundation
493
+ CSS and a framework mount adapter. ADS supplies its native Bun preview compiler.
494
+ The empty starter and init provide the mount under `design-system/showcase/mcp/`.
495
+ Configure the framework and preview manifest; no Vite preview script is required:
494
496
 
495
497
  ```json
496
498
  {
499
+ "framework": "react",
497
500
  "mcp": {
498
501
  "showcaseTitle": "My Project Design System",
499
- "previewManifest": ".ds/preview/manifest.json",
500
- "previewWatch": { "command": "node", "args": ["scripts/build-mcp-previews.mjs", "--watch"] }
502
+ "previewManifest": ".ds/preview/manifest.json"
501
503
  }
502
504
  }
503
505
  ```
504
506
 
507
+ For direct editing with an externally managed builder, add `previewWatch: false`
508
+ and run `ads compile .` or manage `ads compile . --watch` outside MCP. MCP then
509
+ serves published resources/evidence without starting a compiler. Existing views
510
+ can stay visible, but changed-source evidence stays stale until a verified update
511
+ is published. See [editing workflows](../skills/ads-designer/references/workflows.md).
512
+
505
513
  Keep the saved `framework` (`react` or `preact`), JSX transform and mount adapter
506
514
  consistent. The optional title defaults to the project package name followed by
507
515
  ` · Design System`. The browser shell stays the same for both frameworks. There is
@@ -664,10 +672,10 @@ intact. Sources, duplicate output mounts, and symlinked write paths are checked.
664
672
  Initialized builds run:
665
673
 
666
674
  ```text
667
- lint-config → ads check → Oxlint → ads assets → existing prebuild → existing build
675
+ ads check → ads assets → existing prebuild → existing build
668
676
  ```
669
677
 
670
- `lint:ds` remains read-only except for generated lint configuration. `assets:ds`
678
+ `lint:ds` runs the native, read-only ADS gates. `assets:ds`
671
679
  runs `ads assets`; checks do not require outputs on a clean checkout. A failed
672
680
  check or generation stops the build. Re-running init preserves token values,
673
681
  artwork, existing configuration, and unrelated scripts.
@@ -703,7 +711,10 @@ queries. ADS implementations and showcase fixtures cannot import app code.
703
711
  Private imports within ADS implementations remain allowed, including when the ADS
704
712
  is nested inside `src/`. Application integration harnesses belong in test support.
705
713
 
706
- Project rule registration is explicit:
714
+ Projects that explicitly choose Oxlint may use the optional adapter below.
715
+ Declare it as a project dependency and run `ads lint-config` followed by Oxlint
716
+ in an explicit project script; ADS acceptance and validation do not run it
717
+ automatically:
707
718
 
708
719
  ```json
709
720
  {
@@ -723,6 +734,38 @@ can import development-only `loadConfig`, `importResolver`, and `styleWriteViola
723
734
  from `@reqvire-org/ads` when it needs the same validated boundaries as core.
724
735
  Unknown configuration fields fail rather than silently weakening checks.
725
736
 
737
+ Notification usage can be enforced directly by ADS, without a project lint
738
+ plugin or another parse/lint pass:
739
+
740
+ ```json
741
+ {
742
+ "usage": {
743
+ "notifications": [{
744
+ "api": "toast",
745
+ "host": "Toaster",
746
+ "rootFiles": ["src/App.tsx", "design-system/components/Toast.ads.scenario.tsx"]
747
+ }],
748
+ "restrictedImports": ["sonner"]
749
+ }
750
+ }
751
+ ```
752
+
753
+ `api` and `host` name exports imported from the configured public alias. ADS
754
+ recognizes named aliases and namespace imports, respecting shadowed bindings.
755
+ It rejects direct module/render calls and calls in `use server` modules, requires
756
+ a stable `id` for directly effect-created notifications with inspectable options,
757
+ and restricts the host to the exact declared roots. Direct conditional hosts and
758
+ duplicate static host IDs in one file fail. `restrictedImports` rejects runtime
759
+ package and subpath imports, re-exports, literal dynamic imports and unshadowed
760
+ `require` calls; type-only imports are exempt. Both policies are empty by default.
761
+
762
+ These native guards run in `ads check`, acceptance and validation. They inspect
763
+ source and ADS runtime/scenario files, excluding tests and declaration contracts.
764
+ They do not prove cross-module host uniqueness or trace helper calls, dynamic
765
+ IDs/options, aliases assigned to local variables or framework render callbacks.
766
+ Keep route persistence and lifecycle browser tests. ADS does not assume a toast
767
+ implementation exists or install one.
768
+
726
769
  Component interaction variables such as `--ds-button-hover-bg` cannot be
727
770
  assigned by app code, patterns, or showcase code. This includes static JSX style
728
771
  objects in files with inline-style exceptions. Reading a variable is allowed;
@@ -732,8 +775,8 @@ are registered explicitly. State variables cannot be allowlisted.
732
775
  Keep renderer-, framework-, and component-specific project guards too. The
733
776
  shared tool does not validate a third-party graph renderer's own APIs, arbitrary
734
777
  runtime spreads, or the semantic meaning of a
735
- measured value. Register Oxlint plugins through `oxlint.plugins` / `oxlint.rules`
736
- and continue running standalone checks through the existing build.
778
+ measured value. Register project-specific guard scripts in the existing build
779
+ and required MCP checks. The optional linter adapter is one project choice.
737
780
 
738
781
  ### Project boundaries and assets
739
782
 
@@ -802,8 +845,9 @@ the required init-time framework choice. Run `ads init --framework react` (or
802
845
  `preact`) to save it. To use another layout, write this configuration before init. Configure TypeScript and the app bundler to resolve
803
846
  the same alias; this file does not rewrite their configuration.
804
847
 
805
- Colocate component-specific rules with the project component and register a
806
- project-owned Oxlint plugin adapter explicitly:
848
+ Colocate component-specific guards with their owner and register their command
849
+ in the project build. If that project chooses Oxlint, its optional adapter can
850
+ be configured explicitly:
807
851
 
808
852
  ```json
809
853
  {
@@ -816,11 +860,12 @@ project-owned Oxlint plugin adapter explicitly:
816
860
  }
817
861
  ```
818
862
 
819
- Merge that section into the project configuration, then run the normal build.
863
+ Merge that section into the project configuration and explicitly run
864
+ `ads lint-config` followed by the project linter.
820
865
  Generated configuration registers `ads/public-import`, `ads/no-inline-style`, `ads/no-app-import`, and
821
866
  explicit project plugins. Core tooling imports no particular component.
822
867
  Registered project configuration and build helpers may import one another;
823
- this boundary is derived when lint configuration is generated. It does not
868
+ native ADS import guards enforce this boundary. It does not
824
869
  allow application code to import private ADS modules or build helpers to import
825
870
  private UI implementation.
826
871
 
@@ -836,14 +881,12 @@ but the complete checked candidate must contain the matching use.
836
881
  not broad styling exceptions. Ignore `.ds/`; generated paths refer to the project
837
882
  and its locally installed tool.
838
883
 
839
- `lint-config` remains a low-level command for custom build integration and
840
- debugging. For pipelines outside package-manager build hooks, run the same
841
- sequence before compilation, from the project root with local binaries available:
884
+ `lint-config` is optional linter integration. For native ADS gates outside
885
+ package-manager hooks, run the installed tool directly:
842
886
 
843
887
  ```sh
844
- ads lint-config .
845
888
  ads check .
846
- oxlint --deny-warnings --config .ds/oxlintrc.json src design-system
889
+ ads compile .
847
890
  ```
848
891
 
849
892
  Retain unrelated lint, type checking, and framework build commands.
package/docs/MCP.md CHANGED
@@ -13,6 +13,14 @@ preview watcher and serves the built-in browser showcase, so the client needs
13
13
  only one launch command. Source editing is disabled by default; `--mutations`
14
14
  enables guarded ADS edits. MCP does not install skills or add a production runtime.
15
15
 
16
+ The browser starts from `ads://project/explorer`, a compact snapshot of navigation,
17
+ preview-tool capabilities, draft references and build state. It subscribes to index,
18
+ token and build changes rather than repeatedly fetching full semantic catalogues.
19
+ Interactive previews compile independently of background checks. A preview request
20
+ uses the compiler's advertised build budget plus transport overhead; changing the
21
+ selection cancels its pending request. Build failures remain visible with a Retry
22
+ action and do not require restarting MCP.
23
+
16
24
  `ads_status.behaviorLibraries` reports each explicitly allowed project package,
17
25
  its installed version and the ADS units that use it. Catalog entries expose their
18
26
  `behaviorLibraries`, following local helpers and controllers. This allowlist
@@ -26,12 +34,30 @@ The ADS MCP server supports development, inspection and review of that UI. Its
26
34
  showcase renders real implementations as MCP Apps, providing evidence for the
27
35
  exercised conditions alongside normal application integration checks.
28
36
 
37
+ ## Editing access and compiler ownership
38
+
39
+ Use [the direct editing and MCP-only workflows](../skills/ads-designer/references/workflows.md),
40
+ also served as `ads://guides/workflows` and linked by `ads_status.workflow.editing`.
41
+ With direct source access, an agent or human edits owned files in their normal
42
+ editor and uses MCP for previews, inspection and checks. A read-only connection
43
+ is sufficient; ordinary direct edits do not require drafts or `ads_accept`.
44
+ With MCP-only access, enabled mutation tools provide source/draft edits and
45
+ exact-revision acceptance. Without them or a separate editor, source editing is
46
+ unavailable. `mutations.enabled` reports server capability, not the chosen route.
47
+
48
+ Direct editing normally uses the ADS-managed compiler. Setting
49
+ `mcp.previewWatch: false` selects an external builder: the editor/builder publishes
50
+ the ADS resource graph and build evidence, and MCP serves previews without
51
+ starting a compiler. Existing views may remain visible during compilation, but
52
+ changed-source evidence is stale until verified updated artifacts are published.
53
+ Both editing routes require current ADS/project checks and rendered review.
54
+
29
55
  ## Built-in showcase client
30
56
 
31
57
  ### Auto-mode tracked drafts
32
58
 
33
- Use the [draft workflow](../skills/ads-designer/references/drafts.md) for iterative
34
- design. With `--mutations`, `ads_create_draft` creates a tracked proposal for 1–64
59
+ Use the [draft workflow](../skills/ads-designer/references/drafts.md) for MCP-only
60
+ iterative design, or when direct editors choose isolated tracked proposals. With `--mutations`, `ads_create_draft` creates a tracked proposal for 1–64
35
61
  owners; ordinary file edits or `ads_update_draft` continue it. `ads_show_draft`
36
62
  reuses an isolated compiler workspace and returns both an MCP App preview and
37
63
  browser URLs without running acceptance checks. `ads_drafts` lists only pending
@@ -49,7 +75,7 @@ the slots. Read the returned PNG resources before visual acceptance; the result
49
75
  is explicitly `previewOnly`, not behavioral or acceptance evidence.
50
76
 
51
77
  `ads_accept({id,revision})` validates and applies the exact reviewed revision in
52
- one operation. Architecture, registered Oxlint/project commands and affected
78
+ one operation. Architecture, configured project commands and affected
53
79
  behavior checks remain mandatory. Edits during checking and baseline conflicts
54
80
  prevent application; failures retain the draft and return execution evidence.
55
81
  Successful acceptance removes draft source, records an event and resolves draft
@@ -208,11 +234,11 @@ published package when absent. `-y` prevents an install prompt from blocking
208
234
  MCP startup. For this `npx` setup, Node and npm must be available to the client.
209
235
 
210
236
  For **Bun**, use `command = "bunx"` and
211
- `args = ["--bun", "@reqvire-org/ads", "mcp"]` in Codex, or these equivalent
237
+ `args = ["@reqvire-org/ads", "mcp"]` in Codex, or these equivalent
212
238
  `command`/`args` values in Claude's JSON. Bun 1.3.13+ is sufficient; Node and npm
213
- are unnecessary. The `--bun` flag must precede the package name so Bun executes
214
- the CLI despite its Node shebang. For a local installation, the generated
215
- `ads-mcp`/`ads-read-mcp` scripts explicitly select Bun too.
239
+ are unnecessary for ADS itself. The CLI has a Bun shebang. Generated local
240
+ launchers use the installed CLI while preserving interpreters selected by
241
+ application check/build scripts.
216
242
  Runtime setup and diagnostics are also available in `ads://guides/runtimes`.
217
243
 
218
244
  For **Claude Desktop**, use the same JSON in its MCP configuration and append
@@ -295,7 +321,7 @@ The server supplies agent guidance through its instructions, tool descriptions,
295
321
  | `ads_status` | Project paths, watcher/build states, preview revisions and diagnostics, skills |
296
322
  | `ads_catalog` | Bounded search for public UI, controllers and hooks, with source/guide URIs |
297
323
  | `ads_tokens` | Bounded token-definition and theme inspection |
298
- | `ads_check` | Current core architectural diagnostics; registered Oxlint/build tests remain separate |
324
+ | `ads_check` | Current core architectural diagnostics; configured project build tests remain separate |
299
325
  | `ads_skills` | Workflow names/descriptions without loading instructions |
300
326
  | `ads_read_skill` | Explicit text instruction/support-file reads in bounded chunks |
301
327
  | `ads_show_tokens` | Render a discovered token scenario; legacy compilers retain the definition inspector |
@@ -641,7 +667,7 @@ For a coupled rename or upgrade, call `ads_apply_transaction`:
641
667
  It accepts 2–64 distinct owners, at most 256 distinct files and 16 MiB of combined
642
668
  Git diff text. Each patch obeys its own ownership/companion rules. Patches apply
643
669
  in order inside one candidate; shared-entry hunks in a later patch must match
644
- the earlier candidate's content. Core checks, registered Oxlint, project commands
670
+ the earlier candidate's content. Core checks, configured project commands
645
671
  and all affected behavior checks run against the final candidate. No intermediate
646
672
  candidate is published. Dry runs, failures, conflicts and cancellation write no
647
673
  source; a publication failure rolls back prior writes. This coordinates owned
@@ -669,9 +695,8 @@ placeholder. For coupled owners use the bounded transaction; a rejection still
669
695
  requires correcting its owner/policy, never a direct-write bypass.
670
696
 
671
697
  Set `dryRun` to `false` to apply. ADS reconstructs complete candidate files locally
672
- and validates a temporary project copy with core guards and registered Oxlint
673
- rules, including warnings. By default it also runs available `lint:project`
674
- (or `lint`) and `typecheck` scripts. For resource projects with `mcp.previewWatch`,
698
+ and validates a temporary project copy with native ADS guards, including warnings. By default it also runs available `lint:project`
699
+ (or `lint`) and `typecheck` scripts. For managed resource previews,
675
700
  ADS also requests a full production preview build from the managed compiler and
676
701
  uses that same host and checked graph for registered browser verification. Keep
677
702
  `build:mcp-previews` for standalone builds; remove it from `mutationChecks` to
@@ -683,12 +708,11 @@ Override the additional script list through project-owned configuration:
683
708
  { "mcp": { "mutationChecks": ["lint", "typecheck"], "mutationCheckTimeoutMs": 120000 } }
684
709
  ```
685
710
 
686
- Every listed script must exist. An empty list still runs mandatory ADS, Oxlint
687
- and configured managed preview checks. Scripts use the project's npm/Bun runner; installed dependencies are
711
+ Every listed script must exist. An empty list still runs mandatory ADS and configured managed preview checks. Scripts use the project's npm/Bun runner; installed dependencies are
688
712
  shared with the validation copy. These are trusted project commands, not an OS
689
713
  sandbox. An explicit `configuration` patch can change project commands, registered
690
714
  rules and reviewed exceptions; validation runs the proposed configuration and
691
- scripts. Mandatory core and generated Oxlint checks still run on every write.
715
+ scripts. Mandatory native ADS checks still run on every write.
692
716
  Configuration changes cannot bundle unrelated component edits. Checks that
693
717
  rewrite source are rejected. Each registered project script defaults to a
694
718
  60-second limit. `mcp.mutationCheckTimeoutMs` sets its explicit budget
@@ -781,7 +805,7 @@ The loader runs **inside the App iframe**. It reads through the host's resource
781
805
  bridge, verifies bytes, materializes Blob URLs and native ESM import maps, loads
782
806
  CSS/fonts, then invokes the selected module's `mount(container)`. It caches
783
807
  unchanged resources and shared runtime modules within that App. Dynamic imports
784
- load their own dependency closure when invoked. Vite's self-contained worker
808
+ load their own dependency closure when invoked. Bun's self-contained worker
785
809
  output remains a separate asset; workers must be stopped by their owner.
786
810
  The preview adapter uses `worker.format: "iife"`: Chrome rejects module Blob
787
811
  worker fetches in opaque origins, so the resource compiler adapts those
@@ -842,100 +866,41 @@ showcase puts these states in a small monochrome header indicator with tooltip
842
866
  and expandable details; it keeps status and loading overlays out of the widget
843
867
  area. Other Apps hosts retain the in-App status fallback.
844
868
 
845
- ### Configure the project compiler
846
-
847
- ```json
848
- {
849
- "framework": "react",
850
- "mcp": {
851
- "previewManifest": ".ds/preview/manifest.json",
852
- "previewWatch": {
853
- "command": "runtime",
854
- "args": ["scripts/build-mcp-previews.mjs", "--watch"]
855
- }
856
- }
857
- }
858
- ```
869
+ ### ADS-owned Bun compiler
859
870
 
860
- This launches the compiler directly for either npm- or Bun-managed projects.
861
- The starter adapter selects the runner for validation scripts from the project's
862
- `packageManager` field or Bun lockfile, forcing Bun for Bun scripts.
863
- `command: "runtime"` uses the interpreter that launched ADS. Explicit `node`
864
- or `bun` commands retain their meaning; a Node-specific project command still
865
- requires Node. The same portable command is supported in behavior profiles.
866
-
867
- Use `preact` for native Preact and a matching JSX/mount adapter. The project owns
868
- framework compilation and Linaria extraction. The starter's
869
- `scripts/build-mcp-previews.mjs` demonstrates the complete integration:
870
-
871
- - `runScenarioCompiler()` from `@reqvire-org/ads/scenarios/compiler` handles
872
- scheduling, validation, source freshness, successful caches and build reporting.
873
- - `createVitePreviewBuilder({ build, configure })` from
874
- `@reqvire-org/ads/scenarios/vite` supplies `buildGraph`. `build` is the project's
875
- Vite build function; `configure(entries, options)` returns its Vite configuration
876
- with `previewEntriesPlugin()` and the project's framework/Linaria plugins.
877
- It keeps one Rollup watch graph in managed development, retaining unaffected
878
- module transforms. A changed entry list or project configuration resets the graph.
879
- Normal non-watch builds remain one-shot and in memory.
880
- Each mount imports the project's shared foundation entry. Keep that import in
881
- the preview module graph so independently built token scenarios receive the
882
- same shared Data as production UI.
883
- - Keep `preserveEntrySignatures: "strict"`, `cssCodeSplit: true`,
884
- `assetsInlineLimit: 0`, `modulePreload: false`, and `write: false` in the returned
885
- configuration. The helper captures watched output in private `.ds/incremental/`
886
- scratch files; this is not the published graph. It removes its scratch directory
887
- and closes its watcher when the compiler stops.
888
- Watched builds use one module output (no output array or `output.file`). Under
889
- Bun, dependency watches use polling to recover rapid native watch reattachments;
890
- project `build.watch.chokidar` options can override this choice.
891
- - Existing custom `buildGraph(entries, options, track)` adapters still work. The
892
- optional fourth argument supplies `{ watched }`; custom adapters must include
893
- the supplied dependency-tracking plugin and may expose an async `.close()`.
894
- Adopt the helper explicitly to gain persistent Vite compilation.
895
- - Use `linariaTagResolver` from `@reqvire-org/ads/linaria` in WyW's `tagResolver`
896
- option in both the product build and preview builder. It preserves opaque
897
- custom-property values through atomic extraction, including whitespace needed
898
- by arithmetic later substituted into `calc()`. Existing custom builders need
899
- this integration explicitly; disabling minification does not fix extraction.
900
- See the skill-local [atomic styling guide](../skills/ads-designer/references/atomic-styles.md#preserve-custom-property-arithmetic-during-extraction).
901
- - `showcase/mcp/main.tsx` exports `mountScenario(Scenario, container)` and returns
902
- an unmount callback. It imports the same project foundation used in production.
903
- It creates no App bridge; ADS supplies that bridge once.
904
-
905
- To migrate an existing adapter, keep its current Vite configuration and plugins,
906
- return that configuration from `configure`, and replace its fresh-build wrapper:
871
+ Bun 1.3.13+ compiles ADS browser bundles and MCP previews independently of the
872
+ application's bundler. Configure `framework` and `mcp.previewManifest`; ADS
873
+ supplies its compiler when no explicit project watcher is configured:
907
874
 
908
- ```js
909
- import { createVitePreviewBuilder } from "@reqvire-org/ads/scenarios/vite";
910
-
911
- await runScenarioCompiler(root, {
912
- watched: process.argv.includes("--watch"),
913
- validate, // retain the project's validation callback
914
- compilerFiles: [import.meta.filename],
915
- buildGraph: createVitePreviewBuilder({
916
- build, // the project's Vite build function
917
- configure(entries, options) {
918
- return previewConfig(entries, options); // existing aliases, entries and plugins
919
- },
920
- }),
921
- });
875
+ ```json
876
+ {"framework":"react","mcp":{"previewManifest":".ds/preview/manifest.json"}}
922
877
  ```
923
878
 
924
- The helper adds dependency tracking and resource conversion; remove the old
925
- `await build(...)` / `createPreviewResources(...)` wrapper, not its framework,
926
- Linaria, shared foundation or validation configuration. Upgrade the project ADS
927
- dependency and restart its managed compiler to load the helper. Merely upgrading
928
- the server does not convert a custom project adapter to incremental compilation.
929
-
930
- Watched resource builds reuse self-contained IIFE worker bundles through the same
931
- helper. `new Worker(new URL("./worker.ts", import.meta.url))`, `?worker` and
932
- `?worker&url` imports use Vite's configured worker compiler on first demand, then
933
- reuse its output while tracked source/configuration/dependency contents and
934
- resolution directories match. Requests for one worker share the same pending
935
- build. Every preview still receives its worker assets. Changed transitive inputs
936
- rebuild the affected bundle; topology changes may invalidate more. Nested,
937
- inline and split workers keep the normal Vite compilation path. No project names
938
- or manually maintained worker dependency lists are needed.
879
+ Use `preact` for native Preact. Remove the old project `mcp.previewWatch` command
880
+ to adopt this compiler. The project retains its framework mount in
881
+ `showcase/mcp/main.tsx` under the ADS root. It exports
882
+ `mountScenario(Scenario,container)` and returns cleanup. Bun selects the ADS JSX
883
+ runtime, resolves the public alias and extracts Linaria through the shared tag
884
+ resolver. Project application build settings stay under project control.
885
+
886
+ Run `ads compile .` for production previews or `ads compile . --watch` for a
887
+ continuous compiler. Project setup can call `compilePreviews` from
888
+ `@reqvire-org/ads/scenarios/compile`. Projects can integrate `ads check`,
889
+ `ads verify` and `ads validate` into their own build/test/CI scripts. ADS acceptance
890
+ always runs native gates and selected registered behavior checks; configured
891
+ project checks run explicitly. Oxlint is not an ADS gate dependency.
892
+
893
+ MCP warms the prioritized view first, then compiles the remaining graph in
894
+ one background build, without delaying service startup. One compiler job runs
895
+ at a time; foreground selections take priority over queued warming. Compiled views stay cached; unchanged warmed navigation
896
+ needs no compilation. Linaria transforms and worker bundles reuse source and
897
+ transitive dependency hashes. Worker compilation also uses Bun and temporary
898
+ worker compiler processes release their heaps after output is captured.
899
+
900
+ The build resource includes `warmup: {state,completed,total,failed}`. Build changes
901
+ notify supported MCP subscribers and Explorer updates automatically. Warming and
902
+ acceptance never suspend the interactive compiler. Cached output remains visible
903
+ while changed source compiles and validates.
939
904
 
940
905
  On first demand or accepted-edit preparation, the adapter builds a shared graph for all registered scenarios.
941
906
  A selection loads only its static dependency closure. Both validation and compilation
@@ -992,9 +957,20 @@ and alias diagnostics; `ads_tokens` works even when project previews cannot buil
992
957
 
993
958
  ### One client command, managed preview builds
994
959
 
995
- `mcp.previewWatch` is optional. When configured, `ads mcp` starts the project's
996
- watch command on connection/use, once per MCP process. The client configuration
997
- above stays the same; no second terminal or separately managed server is needed.
960
+ With a declared framework and preview manifest, `ads mcp` starts ADS's Bun
961
+ compiler and warms the prioritized view followed by the remaining graph in
962
+ the background. Jobs run sequentially; foreground selections have priority. The client configuration above stays the same; no second terminal
963
+ or separately managed server is needed. An explicit `mcp.previewWatch` is reserved
964
+ for a custom compiler integration; remove former project Vite build commands to
965
+ adopt native compilation.
966
+ For direct editing with external compilation, set `mcp.previewWatch: false`.
967
+ An agent or human edits code and runs `ads compile .` or an external watch/builder
968
+ that publishes the ADS resource graph and build evidence. MCP serves that output
969
+ without starting a compiler. Existing views can remain visible while building;
970
+ source changes make their evidence stale until a verified update is published.
971
+ Missing or null uses the native compiler when the framework and preview manifest
972
+ are configured. This compiler choice does not force direct editors to use MCP
973
+ mutation tools.
998
974
  Standard output trees (`dist`, `build`, `target`, `out`, `.next`, `.nuxt`,
999
975
  `.svelte-kit`, `.turbo`) are excluded from preview watches and freshness inputs
1000
976
  outside the configured source roots. Nested outputs are pruned before OS watches
@@ -1005,16 +981,14 @@ For this checkout, build the tool once and let the client launch:
1005
981
 
1006
982
  ```sh
1007
983
  npm run build
1008
- node dist/cli.mjs mcp
984
+ bun dist/cli.mjs mcp
1009
985
  ```
1010
986
 
1011
- The resource adapter builds a shared graph on demand and rebuilds it after
1012
- source changes, using one compiler process. Apps load selected dependencies. React and native
1013
- Preact projects supply their own build and mount adapters to the same scheduler. The
1014
- [example build](../scripts/build-mcp-previews.mjs) is project glue, excluded from
1015
- the npm tool. Another project uses its own framework/build. ADS supplies no
1016
- component library and does not auto-generate lookalikes. Unconfigured projects
1017
- still get the token widget.
987
+ The resource adapter retains compiled views and rebuilds them after source
988
+ changes using one compiler process. Apps load their selected dependency closure.
989
+ React and native Preact projects supply a mount adapter; ADS supplies compilation,
990
+ Linaria extraction and publication. The application keeps its own build tools.
991
+ Unconfigured projects still get the token widget.
1018
992
 
1019
993
  Compiled Apps may fetch their bundled `blob:` assets, including Wasm, without
1020
994
  external network access. The ADS showcase/explorer permits WebAssembly compilation
@@ -1063,15 +1037,15 @@ second user command and applies to custom builders too.
1063
1037
  The project must keep its watcher in the foreground,
1064
1038
  rather than launching detached background processes. The configuration is
1065
1039
  trusted project setup; MCP tools accept no executable or command arguments.
1066
- To manage builds yourself, omit `previewWatch` or set it to `null`, then run the
1067
- project's existing build/watch command independently.
1040
+ For resource previews, missing or null `previewWatch` selects the native compiler.
1041
+ Custom standalone HTML integrations must declare their own publication contract.
1068
1042
 
1069
1043
  ### When a component changes
1070
1044
 
1071
1045
  Edit the owned component/pattern and its fixture. The managed watcher rebuilds
1072
1046
  the artifacts when their source changes. It is a child process supervised by
1073
- MCP; the client launches only `ads mcp`. The project's compiler owns extraction
1074
- and rebuilding, while MCP watches the resulting artifacts and serves them.
1047
+ MCP; the client launches only `ads mcp`. ADS's compiler owns extraction and rebuilding, while MCP watches the resulting
1048
+ artifacts and serves them.
1075
1049
 
1076
1050
  The MCP server detects the new artifact and sends resource-change notifications.
1077
1051
  The built-in host forwards the current selection after a successful build;
@@ -1188,7 +1162,7 @@ well as its compiler. Call `begin` when source is invalidated, and capture a
1188
1162
  separate revision for each actual build; a completion from an older revision
1189
1163
  cannot clear a newer invalidation or error.
1190
1164
 
1191
- This checkout's [Vite example](../scripts/build-mcp-previews.mjs) reports initial and
1165
+ This checkout's [native compiler entry](../scripts/build-mcp-previews.mjs) reports initial and
1192
1166
  incremental builds, compiler/output errors and immediate invalidation. Another
1193
1167
  project wires the reporter into its existing build hooks; ADS does not infer
1194
1168
  success from free-form console output or install another compiler.