@reqvire-org/ads 0.3.36 → 0.3.38

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 (86) hide show
  1. package/README.md +12 -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 +20 -8
  10. package/dist/config.mjs +24 -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-owner-guard.mjs +7 -4
  18. package/dist/mcp/preview-watch.mjs +21 -9
  19. package/dist/mcp/preview-widget.bundle.js +57 -63
  20. package/dist/mcp/preview-work.mjs +1 -15
  21. package/dist/mcp/project-widget.bundle.js +55 -61
  22. package/dist/mcp/prompts.mjs +2 -2
  23. package/dist/mcp/resource-loader.js +32 -10
  24. package/dist/mcp/server.mjs +94 -34
  25. package/dist/mcp/widget.bundle.js +58 -64
  26. package/dist/preview-builder.mjs +17 -5
  27. package/dist/preview-bun.mjs +269 -0
  28. package/dist/preview-imports.mjs +73 -0
  29. package/dist/preview-resources.mjs +26 -14
  30. package/dist/resource-limits.mjs +146 -0
  31. package/dist/runtime-requirements.mjs +21 -0
  32. package/dist/scenario-inspector.mjs +11 -4
  33. package/dist/scenarios-compiler.mjs +51 -9
  34. package/dist/showcase/client.bundle.js +66 -71
  35. package/dist/showcase/index.html +2 -2
  36. package/dist/showcase/sandbox.bundle.js +1 -1
  37. package/dist/showcase/style.css +4 -0
  38. package/dist/skills/ads-break-ui/SKILL.md +42 -42
  39. package/dist/skills/ads-break-ui/references/drafts.md +6 -3
  40. package/dist/skills/ads-break-ui/references/guarded-editing.md +4 -3
  41. package/dist/skills/ads-break-ui/references/runtimes.md +175 -140
  42. package/dist/skills/ads-break-ui/references/validation.md +13 -3
  43. package/dist/skills/ads-break-ui/references/workflows.md +82 -0
  44. package/dist/skills/ads-designer/SKILL.md +41 -41
  45. package/dist/skills/ads-designer/assets/bootstrap-ds/README.md +8 -9
  46. package/dist/skills/ads-designer/assets/bootstrap-ds/ds.config.json +1 -8
  47. package/dist/skills/ads-designer/assets/bootstrap-ds/package.json +4 -3
  48. package/dist/skills/ads-designer/assets/bootstrap-ds/scripts/build-mcp-previews.mjs +2 -32
  49. package/dist/skills/ads-designer/references/cli.md +25 -21
  50. package/dist/skills/ads-designer/references/drafts.md +6 -3
  51. package/dist/skills/ads-designer/references/guarded-editing.md +4 -3
  52. package/dist/skills/ads-designer/references/runtimes.md +175 -140
  53. package/dist/skills/ads-designer/references/validation.md +13 -3
  54. package/dist/skills/ads-designer/references/workflows.md +82 -0
  55. package/dist/skills/ads-import/SKILL.md +43 -44
  56. package/dist/skills/ads-import/references/cli.md +25 -21
  57. package/dist/skills/ads-import/references/drafts.md +6 -3
  58. package/dist/skills/ads-import/references/guarded-editing.md +4 -3
  59. package/dist/skills/ads-import/references/runtimes.md +175 -140
  60. package/dist/skills/ads-import/references/validation.md +13 -3
  61. package/dist/skills/ads-import/references/workflows.md +82 -0
  62. package/dist/skills/ads-motion/SKILL.md +40 -40
  63. package/dist/skills/ads-motion/references/drafts.md +6 -3
  64. package/dist/skills/ads-motion/references/guarded-editing.md +4 -3
  65. package/dist/skills/ads-motion/references/runtimes.md +175 -140
  66. package/dist/skills/ads-motion/references/validation.md +13 -3
  67. package/dist/skills/ads-motion/references/workflows.md +82 -0
  68. package/dist/skills/ads-port/SKILL.md +40 -40
  69. package/dist/skills/ads-port/references/cli.md +25 -21
  70. package/dist/skills/ads-port/references/drafts.md +6 -3
  71. package/dist/skills/ads-port/references/guarded-editing.md +4 -3
  72. package/dist/skills/ads-port/references/runtimes.md +175 -140
  73. package/dist/skills/ads-port/references/validation.md +13 -3
  74. package/dist/skills/ads-port/references/workflows.md +82 -0
  75. package/dist/usage.mjs +84 -0
  76. package/dist/validation.mjs +0 -12
  77. package/dist/verification/browser.mjs +77 -48
  78. package/docs/ADS.md +17 -11
  79. package/docs/ARCHITECTURE.md +43 -29
  80. package/docs/BEHAVIORS.md +3 -3
  81. package/docs/CHANGELOG.md +81 -13
  82. package/docs/GUIDE.md +96 -53
  83. package/docs/MCP.md +117 -123
  84. package/docs/benchmarks/bun-previews.md +91 -0
  85. package/docs/benchmarks/gidi-preview-memory.md +4 -0
  86. package/package.json +16 -14
@@ -1,10 +1,18 @@
1
- # Node and Bun development runtimes
1
+ # ADS compilation and project runtimes
2
2
 
3
- ADS supports Node 22.12+ and Bun 1.3.13+. A Bun project does not need Node or npm.
4
- The launcher selects the interpreter; package manager and UI framework are
5
- separate concerns. Preserve the target project's choices.
3
+ ADS tooling and MCP previews use Bun 1.4.1+ for bundling. Install Bun before
4
+ using the ADS CLI. The consuming application keeps its own package manager,
5
+ bundler, framework and production build. Node-compatible ADS checking APIs remain
6
+ available to projects that run their own checks under Node.
6
7
 
7
- For a Node/npm project, run inside its package root:
8
+ The minimum applies to the Bun executable running ADS, not to the application's
9
+ runtime. ADS rejects older Bun before starting commands or native compilation.
10
+ Keep a project's Bun pin/launcher compatible when it also launches ADS; do not
11
+ move Node-based application tools onto Bun to satisfy this requirement. Bun 1.4.1
12
+ fixes invalid split-module output observed with complex preview dependency graphs
13
+ on Bun 1.3.13. Compiler caches include the actual Bun version.
14
+
15
+ Use the installed/pinned ADS version. For npm projects:
8
16
 
9
17
  ```sh
10
18
  npx @reqvire-org/ads init --framework react
@@ -12,156 +20,183 @@ npm install
12
20
  npm run build
13
21
  ```
14
22
 
15
- For Bun:
23
+ For Bun projects:
16
24
 
17
25
  ```sh
18
- bunx --bun @reqvire-org/ads init --framework react
26
+ bunx @reqvire-org/ads init --framework react
19
27
  bun install
20
- bun --bun run build
21
- ```
22
-
23
- Use `--framework preact` for native Preact. Init detects an existing package
24
- manager or infers Bun from its launcher when no project choice exists. Use
25
- `--package-manager bun` only for an explicit override; existing project metadata
26
- and lockfiles take precedence over the launcher.
27
- Use the installed/pinned ADS version. Never substitute an unrelated bare package.
28
-
29
- `--bun` is essential to an explicit Bun runtime choice: many JavaScript tools
30
- have a `#!/usr/bin/env node` shebang. Bun can otherwise launch Node when it is
31
- available. Generated ADS scripts force Bun, including Oxlint and its JavaScript
32
- plugins. Existing application scripts and lockfiles are preserved; translate
33
- nested `npm` commands when intentionally converting an application to Bun.
34
- Dependency packages and custom build commands must support the chosen runtime.
35
-
36
- For ordinary `bun run build` commands to always select Bun, the project may
37
- set its own `bunfig.toml`:
38
-
39
- ```toml
40
- [run]
41
- bun = true
28
+ bun run build
42
29
  ```
43
30
 
44
- This is equivalent to passing `--bun` for script execution. ADS does not replace
45
- an existing Bun configuration. Keep the explicit flag in MCP launch settings.
31
+ Select `preact` for native Preact. Preserve project metadata and lockfiles.
32
+ ADS's `lint:ds` setup runs `ads check .` directly. ADS gates do not require
33
+ Oxlint. Projects can run their chosen linter through their own explicitly
34
+ configured check scripts. Init preserves application scripts and adds the ADS
35
+ check/assets step to its existing build hook.
46
36
 
47
37
  ## MCP connection
48
38
 
49
- For Bun, use these values in Claude's `.mcp.json` or Codex's MCP configuration:
39
+ Choose [direct code editing or MCP-only editing](workflows.md) independently of
40
+ compiler ownership. Read-only MCP supports direct editors using preview/check
41
+ tools. `--mutations` exposes MCP source editing; it does not force that workflow.
50
42
 
51
43
  ```json
52
- {
53
- "command": "bunx",
54
- "args": ["--bun", "@reqvire-org/ads", "mcp"]
55
- }
44
+ {"command":"bunx","args":["--bun","@reqvire-org/ads","mcp"]}
56
45
  ```
57
46
 
58
- Add `--mutations` to enable guarded source changes and `--port 4191` when the
59
- project pins its showcase port. Append a project directory when the client
60
- does not launch in the package root. For a local installed tool, use the
61
- generated `ads-mcp` or `ads-read-mcp` package script. Keep stdout for JSON-RPC.
47
+ Add `--mutations` for guarded edits and `--port` if a fixed Explorer port is
48
+ needed. Use the generated `ads-mcp` / `ads-read-mcp` package scripts for a local
49
+ installation. Keep stdout for JSON-RPC. Explicit project behavior-profile
50
+ commands retain their own runtime requirements; `runtime` selects ADS's launcher.
51
+ ADS dispatches Bun project checks with `bun run`, preserving explicitly selected
52
+ Node/Bun commands and their flags. Use `bun` in a script when that individual tool
53
+ must run on Bun; ADS does not force the application's tools onto its own runtime.
54
+
55
+ ## Project resource budgets
56
+
57
+ When setting up or changing compilation/test commands, put resource limits in
58
+ the project's configuration and scripts so ordinary builds, CI and ADS-started
59
+ checks use them. Account for the MCP server, accepted/draft compilers, test
60
+ workers and browsers together; one process's heap is not the whole workload.
61
+
62
+ - Preserve each tool's supported runtime in `package.json`. A Bun package
63
+ manager or ADS compiler does not imply that Vitest, Vite or every Node CLI
64
+ should be forced onto Bun. Change a tool's runtime only after its real workload
65
+ passes with measured time and memory under a bounded process tree.
66
+ Verify the executable actually used: when real Node is absent, Bun can supply
67
+ a `node` shim that runs Bun. `process.versions.node` alone does not prove Node;
68
+ inspect `process.execPath` and ensure `process.versions.bun` is absent. A project
69
+ launcher must select real Node or fail clearly before launching a Node-only tool;
70
+ V8 heap flags do not constrain Bun's shim runtime.
71
+ - Set worker counts in runner configuration, including project Vitest and
72
+ Playwright configs. Start with a small count appropriate to the machine and
73
+ measure before increasing it. Worker limits apply to the configured runner,
74
+ not every concurrently running project.
75
+ - Set explicit heap ceilings for Node tools in their scripts. For example,
76
+ `node --max-old-space-size=1200 node_modules/vitest/vitest.mjs run` and
77
+ `test: { maxWorkers: 2 }` are possible project settings, not universal defaults.
78
+ Check child processes too: runners can replace inherited Node flags. For
79
+ Vitest's fork pool, configure its `execArgv` heap flag explicitly when needed.
80
+ A heap ceiling excludes native allocations, browser processes and other heaps.
81
+ - Use a process-tree memory ceiling in the project's launcher or CI/container
82
+ when the platform supports it. On Linux with a user systemd manager, a bounded
83
+ launch can use `systemd-run --user --scope --quiet -p MemoryMax=3G
84
+ -p MemorySwapMax=0 bun run test`. Keep MCP stdout reserved for JSON-RPC when
85
+ wrapping its launcher. Account for simultaneous launchers; separate caps do
86
+ not establish an aggregate machine-wide limit.
87
+ - Run the complete affected workload under its saved limits. Record elapsed
88
+ time, peak tree memory and actual passing scope. A growing worker, killed
89
+ process, starved timeout or missing case is a failed/incomplete run. Diagnose
90
+ it; do not silently raise budgets, switch runtimes or remove checks to claim
91
+ success. Scope temporary probes and stop their owned process trees afterward.
92
+
93
+ Standalone project scripts need their own limits even when the same scripts can
94
+ be invoked through ADS. `mcp.mutationCheckTimeoutMs` and behavior-profile timeouts
95
+ limit elapsed time, not RAM. Use only settings supported by the installed ADS
96
+ version; ADS 0.3.37 has no built-in project memory-budget configuration field.
97
+ Do not invent one or describe a JS heap flag as a hard process-tree guarantee.
98
+ Direct editors change project scripts/configuration normally; MCP-only editors
99
+ use the available guarded configuration unit. See [editing workflows](workflows.md).
100
+
101
+ ## ADS command memory limits (ADS 0.3.38+)
102
+
103
+ ADS 0.3.38 adds `resources.memoryLimitMb` to `ds.config.json` for CLI
104
+ commands, including MCP, Explorer, compilation and validation. Published ADS
105
+ 0.3.37 does not support this field; check the installed version before adding it.
106
+
107
+ ```json
108
+ {"resources":{"memoryLimitMb":4096}}
109
+ ```
110
+
111
+ Missing/null chooses an automatic budget: at most 6 GiB, one quarter of physical
112
+ RAM, and available memory minus 1 GiB of headroom, bounded by an inherited Linux
113
+ cgroup limit. Explicit positive MiB budgets override automatic sizing. Restart
114
+ the ADS command after changing its budget. Nested ADS commands share the outer
115
+ envelope rather than each getting a fresh allowance.
116
+
117
+ On Linux with a user systemd manager, ADS uses a kernel process-tree cap and
118
+ disables additional swap for that scope. It preserves an existing finite parent
119
+ envelope instead of moving work outside the caller's limit. Other launches use
120
+ a separate process-tree watchdog when a kernel scope is unavailable. Watchdog
121
+ sampling can overshoot and shared RSS can overestimate memory; it is not a
122
+ kernel guarantee. `ads_status.resourceLimits` reports the budget, enforcement
123
+ mode and whether the reported limit is hard. An exceeded budget fails the
124
+ invocation with `ADS_MEMORY_LIMIT`; inspect retained results before retrying.
125
+
126
+ Embedded APIs report `host-managed`: their caller owns the enclosing process
127
+ policy. Direct project scripts using these APIs, and tests launched outside an
128
+ ADS command, still need project/OS limits. Separate ADS launches have separate
129
+ budgets, not a machine-wide reservation. Keep shared host headroom when choosing
130
+ project concurrency.
62
131
 
63
- ## Compiler and browser workers
132
+ ## Native preview compilation
64
133
 
65
- Use the portable command in `ds.config.json`:
134
+ Configure the framework and generated manifest:
66
135
 
67
136
  ```json
68
- {
69
- "mcp": {
70
- "previewWatch": {
71
- "command": "runtime",
72
- "args": ["scripts/build-mcp-previews.mjs", "--watch"]
73
- }
74
- }
75
- }
137
+ {"framework":"react","mcp":{"previewManifest":".ds/preview/manifest.json"}}
76
138
  ```
77
139
 
78
- `runtime` means the interpreter that launched ADS, including its absolute
79
- executable when available through an environment manager. It also works in
80
- registered behavior profiles, with the project's installed runner entry file in
81
- `args`. Explicit `node`, `bun` and custom executable commands retain their meaning;
82
- ADS never silently substitutes another interpreter for them. Node-specific
83
- commands still need Node, even in a Bun-managed package.
84
-
85
- Mandatory architecture/Oxlint validation, ownership guards and screenshot workers
86
- inherit ADS's interpreter. Browser tests remain project-owned Playwright specs;
87
- Chromium/WebKit is a separate browser dependency, not a Node requirement. Runtime
88
- identity participates in behavior evidence freshness.
89
-
90
- For diagnosis, inspect `ads_status.project.runtime`: `name`, `version`,
91
- `executable` and `binDir`. `project.commands` contains the discovered package
92
- commands with the appropriate Bun flags. The MCP process and agent shell may
93
- have different PATHs; use these reported values instead of scanning the machine
94
- or installing another runtime without evidence.
95
-
96
- For incremental preview compilation, the project adapter passes
97
- `createVitePreviewBuilder({ build, configure })` from
98
- `@reqvire-org/ads/scenarios/vite` as `runScenarioCompiler`'s `buildGraph`.
99
- `configure(entries, options)` returns the existing Vite configuration, including
100
- framework/Linaria plugins, aliases and entries. The helper retains a watched
101
- Rollup graph, captures private output, tracks dependencies and closes with the
102
- compiler. Existing custom adapters still work; they must adopt the helper to gain
103
- incremental transforms. Upgrade the project dependency and restart the builder.
104
- Keep the full validation callback and production build behavior.
105
-
106
- Managed acceptance builds every scenario in production mode and shares the
107
- candidate compiler/checked output with browser verification. Remove
108
- `build:mcp-previews` from `mcp.mutationChecks` after upgrading ADS; keep that script
109
- in normal builds. Explicit project commands still run as configured. During
110
- acceptance ADS parks accepted/draft compilers but retains their publications;
111
- an old view remains visible while verified preview requests wait. Do not launch
112
- a second compiler to work around that wait. Semantic workers retire after five
113
- idle seconds and rediscover from revision-fenced metadata when needed.
114
-
115
- The shared watched builder reuses completed self-contained IIFE worker bundles
116
- for constructor URLs and standard `?worker`/`?worker&url` imports. It uses Vite's
117
- configured worker plugins, deduplicates pending requests, tracks real worker and
118
- configuration dependencies and checks resolution-directory changes. Assets are
119
- included on every refresh. Changing a transitive worker import rebuilds its
120
- bundle; failed or superseded work cannot populate the cache. Nested, inline and
121
- split workers keep the normal Vite path. Keep worker lifetimes/cancellation in
122
- their owning component/controller; compiler reuse does not keep runtime workers
123
- alive. Do not add project-specific worker names or lists to ADS.
124
-
125
- Watched resource builds publish explicitly unverified live feedback while full
126
- checks and semantic registry inspection run in the background. Rapid edits
127
- coalesce behind one verification run. The showcase can browse that feedback
128
- without a blocking loading overlay; a quiet header indicator exposes checking,
129
- reload, failure and fallback details. A failed edit restores the last verified
130
- view. Preview minification is disabled only for watched builds.
131
-
132
- `ads_show_scenario` and `ads_show_tokens` default to `waitFor: "verified"`.
133
- Interactive browsing can request `waitFor: "compiled"`, which may return live or
134
- retained output with `build.current: false`. `build.live.validated: false` and
135
- `ads://preview/live` are never proof of passing checks. Captures, behavior checks
136
- and guarded publication still require accepted, current output. Do not replace
137
- the validation callback with a faster incomplete check to speed up the viewer.
138
-
139
- Accepted MCP edits prepare previews without requiring a viewer request. Matching
140
- checked candidate graphs and registry metadata reuse the existing project cache;
141
- incompatible output falls back to background compilation. The connected showcase
142
- can prefetch changed peers' static bytes without evaluating or mounting them.
143
- Reuse depends on content and dependencies, with no time-based expiry. Preparation
144
- does not establish additional behavior or visual evidence.
145
-
146
- The App preserves selected form/scroll state across accepted unrelated graph
147
- updates, reruns audits and remounts when its own module/style/asset closure changes.
148
- Do not promise component-level HMR. Guarded edits select affected behavior owners
149
- from their input dependencies and run their registered checks; project scripts
150
- remain as configured and releases run the complete suite. Incremental compilation
151
- alone does not make arbitrary lint/typecheck/test scripts incremental.
152
-
153
- Preview watching excludes standard output trees by default, including nested
154
- Cargo `target/` directories, without allocating watches inside them. Explicit
155
- `sourceDir` and `dsDir` take priority over those default output names. Register
156
- custom outputs in `assets.generatedPaths`; do not copy the default list into a
157
- new project's config. `ENOSPC` from `fs.watch` can mean the OS watch limit rather
158
- than disk space: inspect the failing path and generated-tree traversal before
159
- raising system limits or deleting files. Generated churn must not mark previews
160
- stale; actual source changes must still rebuild.
161
-
162
- Bundled binary renderers may load their forwarded `blob:` resources. ADS's
163
- showcase/explorer permits WebAssembly compilation while keeping JavaScript eval
164
- and undeclared network requests blocked. External MCP hosts control their CSP.
165
- Test the actual renderer inside the App; a successful website build does not
166
- establish binary-resource or WebAssembly support. Keep transport and resource
167
- loading in explicit injected adapters or declared renderer dependencies.
140
+ ADS supplies its Bun compiler automatically. Remove the project's former
141
+ `mcp.previewWatch` command when adopting native compilation. No Vite/Rollup
142
+ preview adapter or application compiler configuration is needed. Keep the
143
+ framework mount in `design-system/showcase/mcp/main.tsx` (relative to the actual
144
+ ADS root); it exports `mountScenario(Scenario,container)` and returns cleanup.
145
+ ADS resolves the public alias, extracts Linaria using the shared atomic tag
146
+ resolver, and registers compiled modules, CSS, fonts, images and workers as
147
+ immutable MCP resources. The selected ADS framework controls JSX compilation.
148
+
149
+ `ads compile .` builds all production previews for project builds or CI.
150
+ `ads compile . --watch` runs the same source scheduler continuously.
151
+ Programmatic project setup can call `compilePreviews` from
152
+ `@reqvire-org/ads/scenarios/compile`. A project may run `ads check`, `ads verify`
153
+ or `ads validate` explicitly in its own scripts/CI; these commands use the same
154
+ ADS gates and registered behavior tests as MCP. Keep application production
155
+ builds and project tests as registered checks where integration needs them.
156
+
157
+ ## Responsive Explorer
158
+
159
+ MCP starts serving before warming finishes. One shared compiler warms the last selected view first, then the remaining
160
+ graph in one background build. Compiler jobs run sequentially; a foreground
161
+ selection takes priority over queued background work. Reuse retained output and the current per-file
162
+ Linaria/worker cache; do not introduce one compiler per view or retain revision
163
+ histories in memory. Completed unchanged views require no compilation to open.
164
+ For direct editing with an external builder, set `mcp.previewWatch: false`.
165
+ An agent or human edits code and runs `ads compile .` (or manages its watch mode
166
+ externally); MCP only serves/inspects the published previews and starts no
167
+ compiler. A compatible builder must publish the ADS resource graph and build
168
+ evidence, not just an application bundle. Existing views can remain visible while
169
+ building, but changed source makes their evidence stale until a verified update
170
+ is published. Direct editing normally uses the managed compiler; omit the setting
171
+ or use null for that default. See [the two editing workflows](workflows.md).
172
+
173
+ `ads://project/build` exposes `warmup` progress (`state`, `completed`, `total`,
174
+ `failed`) alongside each view's freshness and diagnostics. Supported clients
175
+ subscribe to build/resource updates; Explorer follows them automatically.
176
+ Navigation bootstraps through the compact `ads://project/explorer` resource.
177
+ Semantic discovery runs in a worker, outside the interactive request loop.
178
+
179
+ Watched builds publish explicitly unverified feedback while ADS validation and
180
+ semantic checks continue. Keep the previous preview visible until the replacement
181
+ is available. A preview request has a bounded compiler budget and Retry action;
182
+ changing the selection cancels the superseded request. Do not use network idle
183
+ as readiness: persistent MCP streams remain active.
184
+
185
+ `ads_show_scenario` and `ads_show_tokens` default to `waitFor:"verified"`.
186
+ Interactive browsing may use `waitFor:"compiled"`; `build.current:false` or
187
+ `build.live.validated:false` cannot establish passing evidence. Captures,
188
+ behavior checks and publication still require verified current output.
189
+
190
+ Acceptance builds the complete candidate in production mode, then releases its
191
+ compiler while browser checks use the hosted immutable graph. Interactive
192
+ accepted/draft previews stay available throughout. Background checks serialize
193
+ without borrowing the interactive compiler. Keep configured project checks;
194
+ remove a duplicate standalone preview build from `mcp.mutationChecks` because
195
+ ADS already performs that build once. Keep `ads compile` in ordinary builds if
196
+ that project needs preview artifacts there.
197
+
198
+ Workers compile to self-contained scripts for the opaque-origin MCP App sandbox.
199
+ Unchanged worker output reuses dependency hashes; changes to transitive inputs
200
+ rebuild it. Temporary worker compiler processes run sequentially and exit after
201
+ producing output. Their build lifetime is separate from runtime worker cleanup,
202
+ which remains owned by the component/controller.
@@ -1,5 +1,9 @@
1
1
  # Validation scope
2
2
 
3
+ These checks apply to both [direct editing and MCP-only editing](workflows.md).
4
+ Direct source edits need current checks and rendered review; ordinary edits do
5
+ not require a draft or acceptance call. Tracked proposals validate on acceptance.
6
+
3
7
  Use `ads_validate({})` for the complete project audit, equivalent to `ads validate`.
4
8
  Use `ads_validate({scope:"changed"})`, equivalent to `ads validate --changed`, during
5
9
  editing when a successful full baseline exists. Both interfaces call the same
@@ -19,16 +23,22 @@ engine. Full is the default.
19
23
  checks and configured scripts, not arbitrary assertions, visual parity or every
20
24
  application state.
21
25
 
22
- Full validation runs core architecture/test-boundary guards, registered Oxlint,
23
- project scripts and every registered behavior contract. Defaults use the existing
26
+ Full validation runs core architecture/test-boundary guards, configured project scripts and every registered behavior contract. Defaults use the existing
24
27
  mutation-check scripts plus a project's `test` and build scripts when present.
25
28
  Build selection prefers `build:lib`, then `build:app`, then `build`.
26
29
  Projects can declare `validation.checks` as a list of package
27
- script names for the complete audit; core/Oxlint and registered behaviors remain
30
+ script names for the complete audit; core ADS and registered behaviors remain
28
31
  mandatory. Commands are trusted project configuration, never MCP arguments.
29
32
  Use scripts that check/build without changing source. Avoid calling `ads validate`
30
33
  from a script selected by validation.
31
34
 
35
+ Prefer native ADS usage policies over project lint plugins. Notification APIs
36
+ and hosts can be registered as `usage.notifications: [{api, host, rootFiles}]`;
37
+ `usage.restrictedImports` blocks packages that bypass the project-owned API.
38
+ `ads check`, acceptance and validation enforce these in the existing AST pass.
39
+ Do not keep an additional toast lint runner after migrating its policy. Preserve
40
+ ordinary project tests and independent linters for checks ADS does not own.
41
+
32
42
  Freshness tracks ADS and consuming UI roots, public assets, their local dependency
33
43
  chains, registered configuration/command entrypoints, package files, and supported
34
44
  project tests plus helpers. Unrelated native/backend/docs edits can continue during
@@ -0,0 +1,82 @@
1
+ # Direct editing and MCP-only editing
2
+
3
+ Choose the route from the user's instructions and the editor/filesystem access
4
+ actually available to the agent. `ads_status.mutations.enabled` describes MCP
5
+ capabilities; it does not require a local editor to use MCP mutation tools.
6
+ Compiler ownership is a separate choice from editing access.
7
+
8
+ ## Direct design-system code access
9
+
10
+ An agent or human edits the project's owned source with their normal editor.
11
+ MCP provides discovery, rendered previews, captures and validation; it need not
12
+ write source. A read-only MCP connection is sufficient for this workflow.
13
+
14
+ 1. Use `ads_status` to establish the connected project root, commands, compiler
15
+ state and public API. Inspect relevant source, tokens, guides and real scenarios.
16
+ 2. Edit the implementation, its scenarios/fixtures and required public exports
17
+ directly. Ordinary working-tree edits do not require `ads_create_draft` or
18
+ `ads_accept`; they change project source immediately, without isolated rollback.
19
+ 3. With the default ADS-managed compiler, let the existing watcher rebuild. Open
20
+ the scenario through `ads_show_scenario` or Explorer and inspect the rendered
21
+ result. Do not launch a second compiler beside the managed one.
22
+ 4. Inspect `ads_status.build` or `ads://project/build`. Run native ADS gates and
23
+ appropriate project/registered behavior checks, using MCP or the equivalent
24
+ CLI/project commands. Review the final current view before finishing. See
25
+ [validation scope](validation.md).
26
+
27
+ ### External builder: `mcp.previewWatch: false`
28
+
29
+ This is the direct-editing workflow with compilation managed outside the MCP
30
+ process. An agent or human edits code and runs a builder; MCP is used to preview
31
+ and inspect the published output rather than to edit or compile it.
32
+
33
+ ```json
34
+ {"framework":"react","mcp":{"previewManifest":".ds/preview/manifest.json","previewWatch":false}}
35
+ ```
36
+
37
+ ADS does not start a compiler in this mode. Run `ads compile .` after edits, or
38
+ manage `ads compile . --watch` externally. A custom compatible builder must publish
39
+ the ADS resource graph, manifest and build evidence; an ordinary application
40
+ bundle alone is insufficient. Keep only one builder responsible for these outputs.
41
+ MCP serves the published resources and reports their freshness. Existing views
42
+ can remain visible during the build, but source changes make their evidence stale
43
+ until a verified update is published. Inspect build state explicitly; resource
44
+ notifications help supported clients refresh but do not establish passing checks.
45
+
46
+ Omitting `previewWatch` or setting it to `null` selects ADS's native compiler when
47
+ the framework and preview manifest are configured. Direct editing does not imply
48
+ `false`: the managed compiler is the usual direct-editing setup. See
49
+ [runtimes](runtimes.md) for compilation and publication details.
50
+
51
+ ## MCP-only design-system access
52
+
53
+ When no authorized source editor/filesystem channel is available, use the
54
+ server's tools for source reads and changes. Do not assume returned server-local
55
+ paths can be opened by the client. Discover capabilities with `ads_status`.
56
+
57
+ With mutation tools enabled, follow [tracked drafts](drafts.md): discover owners
58
+ with `ads_units`, create a coherent proposal with `ads_create_draft`, read/edit its
59
+ marked source through `ads_read_file` and `ads_update_draft`, preview with
60
+ `ads_show_draft`, review the rendered result and accept its exact revision with
61
+ `ads_accept`. Accept dependencies first and review dependents again. The agent
62
+ performs auto-mode review; no additional human approval step is implied.
63
+
64
+ Use [guarded patches](guarded-editing.md) for focused repairs and migrations.
65
+ Without mutation tools, an MCP-only client can inspect, preview and validate,
66
+ but cannot change source. Report that capability limit if editing is required.
67
+
68
+ ## Completion and shared rules
69
+
70
+ Both routes preserve project ownership, framework, public APIs, shared tokens,
71
+ styling/geometry boundaries and configured checks. Compilation and HTML delivery
72
+ do not prove visual or behavioral correctness. Report the scope and revision of
73
+ actual passing checks; stale, failed or incomplete evidence remains unfinished.
74
+ Never change access routes to bypass a rejected patch or failed acceptance.
75
+
76
+ Direct editors may deliberately choose tracked drafts for isolation, comparison
77
+ or PR review. Once using a tracked proposal, finish a coherent design change by
78
+ reviewing and accepting its required drafts, unless the user asks to retain the
79
+ proposal. Do not silently leave requested work only in drafts. This completion
80
+ rule also applies to MCP-only drafts; it does not impose draft acceptance on
81
+ ordinary direct source edits. Never import marked `.ads` draft source into
82
+ application or accepted ADS runtime code.
@@ -3,37 +3,35 @@ name: ads-import
3
3
  description: "Import selected source ADS components, patterns, styles, brand artwork or theme values into a project's design system. Check compatibility with the destination's framework, dependencies, APIs and token policy before applying. Preserve behavior, credits and license notices."
4
4
  ---
5
5
 
6
- ## Auto-mode tracked drafts
7
-
8
- For iterative design work, read [tracked drafts](references/drafts.md) and use
9
- `ads_create_draft` → ordinary edits → `ads_show_draft` → rendered review →
10
- `ads_accept({id,revision})`. Use `ads_drafts` to find pending proposals and their
11
- current revisions; catalogue entries mark owners with drafts. Enable mutations
12
- for acceptance. The low-level guarded patch workflow below remains available for
13
- focused repairs/migrations; it does not replace the draft preview loop.
14
-
15
- A coherent design change may span multiple components, patterns or an entire
16
- view. **Do not report that change complete while its intended work exists only
17
- in drafts.** Validate and accept its required drafts, accepting dependencies
18
- first and reviewing dependents again after promotion. If acceptance is blocked,
19
- continue fixing it or report the exact unfinished draft/blocker. Retain a
20
- proposal for later only when the user requests that outcome; never silently drop
21
- requested work or bypass failed checks. Auto mode requires agent review, not a
22
- new human confirmation step.
23
-
24
- Drafts live in tracked `ads-drafts/` with `.ads` source. Pattern and
25
- composition previews may depend on component/pattern/token drafts through normal
26
- `@ds` imports in an isolated overlay. Accepting a dependency automatically switches
27
- dependent drafts to its final implementation. Never import `.ads` draft files
28
- into application or accepted ADS code. Shared token drafts support discovered
29
- groups from `ads_tokens.tokenGroups`; they remain owned by `tokens`.
6
+ ## Choose the editing workflow
7
+
8
+ Read [direct editing and MCP-only editing](references/workflows.md) and use the
9
+ route matching the user's instructions and your actual source access:
10
+
11
+ - **Direct code access:** edit owned files with the normal editor; use MCP for
12
+ discovery, preview, captures and validation. Ordinary source edits do not
13
+ require a tracked draft or `ads_accept`, even when MCP mutations are enabled.
14
+ - **MCP-only access:** use source/draft mutation tools, rendered review and
15
+ exact-revision acceptance. Follow [tracked drafts](references/drafts.md).
16
+ Without mutation tools or another source channel, editing is unavailable.
17
+
18
+ Direct editors can also choose tracked drafts for isolation and comparison.
19
+ When using drafts, do not report coherent design work complete before reviewing
20
+ and accepting its required proposals. If blocked, report the exact unfinished
21
+ draft/blocker; retain a proposal intentionally only when the user requests it.
22
+ Auto mode means agent review, without an extra human approval step.
23
+
24
+ Compiler ownership is independent: direct edits normally use ADS's managed
25
+ compiler. `mcp.previewWatch: false` is the externally managed builder variant;
26
+ MCP serves published previews and evidence without starting a compiler.
30
27
 
31
28
 
32
29
  For validation scope, full audits, and CLI/MCP parity, read
33
30
  [validation.md](references/validation.md).
34
31
 
35
- For Node/Bun setup, MCP launch and compiler workers, read
36
- [runtimes.md](references/runtimes.md).
32
+ For Node/Bun setup, MCP launch, compiler workers and project resource budgets,
33
+ read [runtimes.md](references/runtimes.md). Keep runtime choices, worker counts
34
+ and memory limits in project configuration; verify real workloads under them.
37
35
 
38
36
  # ADS Import
39
37
 
@@ -48,7 +46,8 @@ inside a different or nested repository. Inspect the selected public API, owning
48
46
  source/available guides and relevant tokens, then mount its discovered scenario.
49
47
  Metadata and source reads do not prove rendered behavior.
50
48
 
51
- When `ads_status.mutations.enabled`, discover the owner with `ads_units`, read
49
+ For MCP-only guarded editing with `ads_status.mutations.enabled`, discover the
50
+ owner with `ads_units`, read
52
51
  relevant ranges with `ads_read_file` and send only a Git unified diff through
53
52
  `ads_apply_patch({ unit, patch, dryRun })`. A unit includes its own implementation,
54
53
  scenarios and fixtures; imported peers remain separate. `tokens` is the token
@@ -74,8 +73,9 @@ Intentional configuration, rule exceptions, registered guard code and compiler
74
73
  changes use `configuration`; validate the proposed settings and keep mandatory
75
74
  ADS gates. For binary/large assets, generate `git diff --binary --full-index` into
76
75
  `.ds/patches/<name>.patch` and send `patchFile` instead of inline `patch`, so bytes
77
- stay out of model context. Binary changes require Git. When editing is disabled,
78
- use the client's normal source-editing tools.
76
+ stay out of model context. Binary changes require Git. These tool instructions
77
+ apply to the MCP editing route; direct editors use the workflow above and run
78
+ the same required gates/checks.
79
79
  For owner drafts, token-sample reconciliation, coupled transactions and local
80
80
  shared Data ownership, read [guarded-editing.md](references/guarded-editing.md).
81
81
  For on-demand current/candidate screenshots and visual dry-run review, read
@@ -360,13 +360,13 @@ initialize the entry. Several contextual public parts may share one scenario.
360
360
  IDs derive from ADS-relative filenames: both `components/core/Button/Button.ads.scenario.tsx`
361
361
  and `components/core/Button.ads.scenario.tsx` identify `components/core/Button`.
362
362
  Use one form, no duplicate IDs or hand-maintained registry. Renames change IDs.
363
- The showcase and external hosts mount the same discovered entry. The Vite
364
- adapter uses `previewEntriesPlugin` and `createPreviewResources` with
365
- `runScenarioCompiler` to publish the shared graph. Its framework mount adapter
366
- returns cleanup; the project owns rendering and Linaria extraction. The older
367
- `scenarioRegistryPlugin` is only for retained legacy browsers. MCP discovers
368
- metadata without importing executable TSX. Existing apps need an explicitly
369
- integrated compiler; init alone adds no compiler or extraction setup.
363
+ The showcase and external hosts mount the same discovered entry. ADS owns Bun
364
+ preview compilation and Linaria extraction independently of the application's
365
+ bundler. Configure the ADS framework and preview manifest; keep the project-owned
366
+ framework mount adapter and its cleanup. Use `ads compile` for standalone/CI
367
+ preview builds. MCP discovers metadata without importing executable TSX. Read
368
+ [Runtime and compiler setup](references/runtimes.md) when setting up or migrating
369
+ the compiler.
370
370
  Use `ads_scenarios` (query/kind/limit) and `ads_show_scenario({id})` to open an exact
371
371
  entry. Check its build freshness; HTML delivery is not browser verification.
372
372
  If Apps or resource forwarding are unavailable, open that scenario in the real
@@ -464,10 +464,10 @@ the ADS server package itself. Persistent SSE/notification streams make
464
464
 
465
465
 
466
466
 
467
- Register component/project Oxlint plugins and rules in `ds.config.json`. Use
468
- scoped `oxlint.overrides` for justified file-specific settings; never edit
469
- `.ds/oxlintrc.json`. These overrides configure Oxlint, not the independent
470
- architecture checks in `ads check`. Measured renderer properties and documented
467
+ Run ADS's own gates directly with `ads check`; acceptance and validation do not
468
+ require Oxlint. Register project-specific checks as explicit package scripts in
469
+ `mcp.mutationChecks` / `validation.checks`, and behavior tests through ADS contracts.
470
+ A project can use its own linter in those scripts when desired. Measured renderer properties and documented
471
471
  non-state hooks use explicit `boundaries`; shared token writes and primitive
472
472
  state overrides cannot be allowlisted. When migrating JSX inline geometry to
473
473
  imperative writes, port the source and replace its own boundary entries together
@@ -497,10 +497,9 @@ differences. Token-value imports also need consumer checks for existing theme,
497
497
  typography, spacing, and motion behavior.
498
498
 
499
499
  Follow [references/cli.md](references/cli.md) to integrate the tool as a
500
- development dependency in the target's actual lint/build pipeline. Register
501
- imported component rules through its project-owned plugin adapter and
502
- `ds.config.json` Oxlint plugins/rules, then run the normal project build; its lint
503
- step refreshes configuration and runs ADS/core/project rules automatically.
500
+ development dependency in the target's actual lint/build pipeline. Run native ADS gates with `ads check`. Register imported component-specific
501
+ guards as explicit project scripts and include them in the project build and,
502
+ when needed, `mcp.mutationChecks`.
504
503
  Use npx for bootstrap or ad hoc checks. Preserve unrelated existing lint setup;
505
504
  do not add catalogue imports to core tooling. CLI checks complement the project
506
505
  build and behavior tests.