@reqvire-org/ads 0.3.31 → 0.3.33

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 (59) hide show
  1. package/README.md +9 -0
  2. package/dist/bootstrap-ds/vite.config.ts +2 -1
  3. package/dist/boundaries.mjs +2 -0
  4. package/dist/capture.mjs +5 -3
  5. package/dist/config.mjs +5 -2
  6. package/dist/draft-boundary.mjs +27 -0
  7. package/dist/draft-workspace.mjs +10 -0
  8. package/dist/lint-config.mjs +1 -0
  9. package/dist/mcp/apps.mjs +3 -1
  10. package/dist/mcp/context.mjs +2 -2
  11. package/dist/mcp/draft-exports.mjs +40 -0
  12. package/dist/mcp/drafts.mjs +341 -0
  13. package/dist/mcp/edit-preparation.mjs +8 -7
  14. package/dist/mcp/execution-results.mjs +2 -0
  15. package/dist/mcp/mutations.mjs +8 -3
  16. package/dist/mcp/preview-watch.mjs +11 -3
  17. package/dist/mcp/preview-widget.bundle.js +13 -13
  18. package/dist/mcp/prompts.mjs +3 -2
  19. package/dist/mcp/server.mjs +75 -18
  20. package/dist/mcp/widget.bundle.js +1 -1
  21. package/dist/preview-files.mjs +2 -0
  22. package/dist/scenarios-compiler.mjs +2 -0
  23. package/dist/scenarios-vite.d.mts +1 -0
  24. package/dist/scenarios-vite.mjs +1 -0
  25. package/dist/showcase/client.bundle.js +42 -42
  26. package/dist/showcase/comparison.js +21 -0
  27. package/dist/showcase/index.html +3 -2
  28. package/dist/showcase/style.css +9 -0
  29. package/dist/skills/README.md +5 -0
  30. package/dist/skills/ads-break-ui/SKILL.md +26 -0
  31. package/dist/skills/ads-break-ui/references/captures.md +7 -0
  32. package/dist/skills/ads-break-ui/references/drafts.md +107 -0
  33. package/dist/skills/ads-break-ui/references/guarded-editing.md +6 -0
  34. package/dist/skills/ads-designer/SKILL.md +26 -0
  35. package/dist/skills/ads-designer/assets/bootstrap-ds/vite.config.ts +2 -1
  36. package/dist/skills/ads-designer/references/captures.md +7 -0
  37. package/dist/skills/ads-designer/references/drafts.md +107 -0
  38. package/dist/skills/ads-designer/references/guarded-editing.md +6 -0
  39. package/dist/skills/ads-import/SKILL.md +26 -0
  40. package/dist/skills/ads-import/references/captures.md +7 -0
  41. package/dist/skills/ads-import/references/drafts.md +107 -0
  42. package/dist/skills/ads-import/references/guarded-editing.md +6 -0
  43. package/dist/skills/ads-motion/SKILL.md +26 -0
  44. package/dist/skills/ads-motion/references/captures.md +7 -0
  45. package/dist/skills/ads-motion/references/drafts.md +107 -0
  46. package/dist/skills/ads-motion/references/guarded-editing.md +6 -0
  47. package/dist/skills/ads-port/SKILL.md +26 -0
  48. package/dist/skills/ads-port/references/captures.md +7 -0
  49. package/dist/skills/ads-port/references/drafts.md +107 -0
  50. package/dist/skills/ads-port/references/guarded-editing.md +6 -0
  51. package/dist/units.mjs +7 -1
  52. package/dist/validation-inputs.mjs +11 -1
  53. package/docs/ADS.md +13 -0
  54. package/docs/ARCHITECTURE.md +12 -0
  55. package/docs/CHANGELOG.md +31 -0
  56. package/docs/CONTRACTS.md +8 -0
  57. package/docs/GUIDE.md +19 -5
  58. package/docs/MCP.md +50 -0
  59. package/package.json +1 -1
@@ -0,0 +1,21 @@
1
+ import { AppBridge, PostMessageTransport } from "@modelcontextprotocol/ext-apps/app-bridge";
2
+
3
+ /** Each version gets its own ordinary opaque MCP App, never another browser shell. */
4
+ export async function mountComparisonApp({slot,title,sandboxUrl,resourceUri,result,readResource,callTool,context,onError}) {
5
+ const resource=await readResource({uri:resourceUri});
6
+ const content=resource.contents.find(item=>item.mimeType==="text/html;profile=mcp-app"&&typeof item.text==="string");
7
+ if(!content)throw new Error("Comparison preview App is unavailable.");
8
+ const frame=document.createElement("iframe");frame.title=title;frame.setAttribute("sandbox","allow-scripts allow-same-origin allow-forms");frame.src=sandboxUrl;slot.append(frame);
9
+ const bridge=new AppBridge(null,{name:"ADS showcase",version:"1.0.0"},{serverResources:{},serverTools:{},logging:{}},{hostContext:context(frame)});
10
+ bridge.onreadresource=readResource;bridge.oncalltool=callTool;bridge.onerror=onError;
11
+ bridge.onloggingmessage=value=>{if(value.logger==="ads-preview"&&value.data?.state==="error")onError(new Error(value.data.message));};
12
+ let timer;
13
+ const initialized=new Promise((resolve,reject)=>{timer=setTimeout(()=>reject(new Error("Comparison App initialization timed out.")),15000);bridge.oninitialized=()=>{clearTimeout(timer);resolve();};});
14
+ bridge.onsandboxready=()=>bridge.sendSandboxResourceReady({html:content.text,csp:content._meta?.ui?.csp,sandbox:"allow-scripts allow-forms"});
15
+ const observer=new ResizeObserver(()=>bridge.setHostContext(context(frame)));
16
+ try{
17
+ await Promise.all([bridge.connect(new PostMessageTransport(frame.contentWindow,frame.contentWindow)),initialized]);
18
+ observer.observe(frame);await bridge.sendToolInput({arguments:{}});await bridge.sendToolResult(result);
19
+ }catch(error){observer.disconnect();await bridge.close();throw error;}finally{clearTimeout(timer);}
20
+ return {updateResult:value=>bridge.sendToolResult(value),refreshContext:()=>bridge.setHostContext(context(frame)),async close(){observer.disconnect();try{await bridge.teardownResource({},{timeout:500});}catch{/* A disconnected App may not acknowledge teardown. */}await bridge.close();}};
21
+ }
@@ -9,9 +9,10 @@
9
9
  <button data-section="components"><svg viewBox="0 0 16 16"><path d="m8 1 6 3.5v7L8 15l-6-3.5v-7L8 1Zm-6 3.5 6 3.5 6-3.5M8 8v7"/></svg>Components</button>
10
10
  <button data-section="patterns"><svg viewBox="0 0 16 16"><rect x="2" y="2" width="5" height="5"/><rect x="10" y="2" width="4" height="5"/><rect x="2" y="10" width="5" height="4"/><rect x="10" y="10" width="4" height="4"/></svg>Patterns</button>
11
11
  <button data-section="composition"><svg viewBox="0 0 16 16"><path d="M2 2h4v4H2zM10 2h4v4h-4zM2 10h4v4H2zM10 10h4v4h-4z"/></svg>Composition</button>
12
+ <button data-section="drafts"><svg viewBox="0 0 16 16"><path d="M3 2h7l3 3v9H3zM10 2v4h3M5 9h5M5 12h4"/></svg>Drafts</button>
12
13
  </nav>
13
- <div class="actions"><button id="preview-status" data-phase="opening" aria-label="Preview status: Connecting to ADS MCP…" title="Connecting to ADS MCP…" popovertarget="status-details"><span class="status-dot" aria-hidden="true"></span></button><div id="status-details" popover><p id="status" role="status">Connecting to ADS MCP…</p></div><button id="theme" aria-label="Use dark theme" title="Use dark theme"><svg viewBox="0 0 16 16"><path d="M13.5 9a5.5 5.5 0 0 1-6.5-6.5A5.5 5.5 0 1 0 13.5 9Z"/></svg></button><button id="minimize" aria-label="Minimize showcase menu" title="Minimize showcase menu (refresh to restore)"><svg viewBox="0 0 16 16"><path d="m4 10 4-4 4 4"/></svg></button></div>
14
+ <div class="actions"><button id="preview-status" data-phase="opening" aria-label="Preview status: Connecting to ADS MCP…" title="Connecting to ADS MCP…" popovertarget="status-details"><span class="status-dot" aria-hidden="true"></span></button><div id="status-details" popover><p id="status" role="status">Connecting to ADS MCP…</p></div><button id="viewport" aria-label="Phone viewport" aria-pressed="false" aria-controls="frame-slot" title="Preview at phone width (390 px)"><svg viewBox="0 0 16 16" aria-hidden="true"><rect x="4" y="1" width="8" height="14" rx="1.5"/><path d="M7 12.5h2"/></svg></button><button id="theme" aria-label="Use dark theme" title="Use dark theme"><svg viewBox="0 0 16 16"><path d="M13.5 9a5.5 5.5 0 0 1-6.5-6.5A5.5 5.5 0 1 0 13.5 9Z"/></svg></button><button id="minimize" aria-label="Minimize showcase menu" title="Minimize showcase menu (refresh to restore)"><svg viewBox="0 0 16 16"><path d="m4 10 4-4 4 4"/></svg></button></div>
14
15
  </header>
15
- <main><aside id="sidebar"><nav id="entries" aria-label="Tokens"></nav></aside><section id="preview" aria-label="Preview"><div id="loader" role="status" aria-label="Loading preview" hidden><span class="spinner" aria-hidden="true"></span></div><div id="frame-slot"></div></section></main>
16
+ <main><aside id="sidebar"><nav id="entries" aria-label="Tokens"></nav></aside><section id="preview" aria-label="Preview"><div id="draft-controls" hidden><label>Scenario <select id="draft-scenario" aria-label="Draft scenario"></select></label><span id="draft-state" role="status"></span></div><div id="loader" role="status" aria-label="Loading preview" hidden><span class="spinner" aria-hidden="true"></span></div><div id="frame-slot"></div></section></main>
16
17
  <script type="module" src="/client.js"></script>
17
18
  </body></html>
@@ -12,3 +12,12 @@ main{flex:1;min-height:0;display:flex}#sidebar{width:var(--pane-width);flex:none
12
12
 
13
13
  /* A different selection loads in the preview pane; edits keep using the header ring. */
14
14
  #loader{position:absolute;inset:0;z-index:2;display:grid;place-items:center;background:var(--frame-bg)}.spinner{width:24px;height:24px;border:2px solid var(--frame-line);border-top-color:var(--frame-ink);border-radius:50%;animation:spin .8s linear infinite}@keyframes spin{to{transform:rotate(360deg)}}@media(prefers-reduced-motion:reduce){.spinner{animation:none}}
15
+
16
+ /* A real iframe viewport keeps phone previews responsive without changing the app host. */
17
+ :root[data-viewport="phone"] #frame-slot{width:min(390px,100%);margin-inline:auto}
18
+ #viewport[aria-pressed="true"]{background:var(--frame-ink);color:var(--frame-bg)}
19
+ #split-view[aria-pressed="true"]{background:var(--frame-ink);color:var(--frame-bg)}button:disabled{cursor:default;opacity:.45}
20
+ .draft-badge{font-size:11px;padding:1px 5px;margin-inline-start:8px}.draft-comparison{height:100%;display:grid;grid-template-columns:minmax(0,1fr);min-width:0}.draft-comparison[data-split="true"]{grid-template-columns:repeat(2,minmax(0,1fr))}.draft-version{display:flex;flex-direction:column;min-width:0;min-height:0}.draft-version+ .draft-version{border-inline-start:1px solid var(--frame-line)}.draft-version h2{font-size:12px;font-weight:600;padding:6px 12px;margin:0;border-bottom:1px solid var(--frame-line)}.draft-stage{flex:1;min-height:0;display:flex;justify-content:center}.draft-stage iframe{min-width:0}
21
+ #draft-controls{display:flex;gap:12px;align-items:center;flex-wrap:wrap;padding:6px 12px;border-bottom:1px solid var(--frame-line)}#draft-scenario{font:inherit;background:var(--frame-bg);color:var(--frame-ink);border:1px solid var(--frame-line);border-radius:4px;max-width:260px}#draft-state{font-size:12px}
22
+ :root[data-viewport="phone"] #frame-slot:has(.draft-comparison){width:100%}:root[data-viewport="phone"] .draft-stage iframe{width:min(390px,100%)}
23
+ @media(max-width:760px){.draft-comparison[data-split="true"]{grid-template-columns:minmax(0,1fr);grid-template-rows:repeat(2,minmax(0,1fr))}.draft-version+ .draft-version{border-inline-start:0;border-top:1px solid var(--frame-line)}}
@@ -1,5 +1,10 @@
1
1
  # ADS skills
2
2
 
3
+ All change-authoring workflows share the [auto-mode draft guide](ads-designer/references/drafts.md).
4
+ Drafts are tracked and previewable, including dependency and token-group changes.
5
+ Agents must review and accept the required drafts before reporting a coherent
6
+ design change complete; failed acceptance remains unfinished work.
7
+
3
8
  Install the skills you need with `npx skills`:
4
9
 
5
10
  ```sh
@@ -3,6 +3,32 @@ name: ads-break-ui
3
3
  description: Stress-test a project's local design-system components or patterns with extreme realistic content, empty and failure states, narrow containers, and accessibility settings. Build development fixtures, report layout failures, and fix them when requested.
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`.
30
+
31
+
6
32
  For validation scope, full audits, and CLI/MCP parity, read
7
33
  [validation.md](references/validation.md).
8
34
 
@@ -1,5 +1,12 @@
1
1
  # On-demand visual captures
2
2
 
3
+ For a [tracked draft](drafts.md), pass `draft` and its exact `revision` to
4
+ `ads_capture`. Accepted/current and Draft/candidate images use warm preview hosts
5
+ without running draft acceptance checks. The candidate records the proposal
6
+ revision; changed inputs prevent publication. Read the returned PNG resources
7
+ for model-visible review before `ads_accept`. Compilation/screenshots alone do
8
+ not establish behavioral or acceptance evidence.
9
+
3
10
  Use captures when reviewing appearance or a proposed visual change. Discover exact
4
11
  scenario IDs with `ads_scenarios`; these are project-owned independently mountable
5
12
  token, component, pattern and composition views. A component export alone is not
@@ -0,0 +1,107 @@
1
+ # Tracked drafts and auto-mode acceptance
2
+
3
+ Use this workflow for iterative design changes. Auto mode means the agent reviews
4
+ the rendered result and accepts it; it does not introduce a human approval gate.
5
+ Human acceptance controls are not part of this version.
6
+
7
+ ## Complete a coherent design change
8
+
9
+ A unit of design work can span several components, a pattern or an entire view.
10
+ Do not finish that work with its intended changes left only in drafts. Review,
11
+ validate and accept all required drafts before reporting the change complete.
12
+ Accept dependency drafts first, then review their dependents again. If checks or
13
+ baseline conflicts block acceptance, fix them and continue. If progress requires
14
+ missing user input or an external change, report the work as unfinished, with the
15
+ exact draft and blocker. Never silently drop requested work or accept a failing
16
+ draft to meet this completion rule. Leave a draft intentionally only when the
17
+ user asks to retain a proposal for later review.
18
+
19
+ ## Source and lifecycle
20
+
21
+ `ads_create_draft({units:["components/Button"], title:"Button spacing"})` creates
22
+ `ads-drafts/<id>/proposal.ads.draft.json` and `.ads` draft sources.
23
+ For example, `Button.tsx.ads` maps to the normal `Button.tsx` target. The final
24
+ `.ads` extension keeps proposed code out of default TypeScript/lint discovery,
25
+ without editing project tsconfig files. The manifest remains
26
+ `proposal.ads.draft.json`. These are ordinary tracked project files: commit them and review them in a PR.
27
+ Git is not required to create or recover a draft. Restarting ADS or cloning the
28
+ project discovers the same source. Generated compiler workspaces and execution
29
+ events remain under ignored `.ds/`; an interrupted check is never a pass.
30
+
31
+ The manifest maps each proposed file to its normal project target and records
32
+ its baseline fingerprint and owner. Edit returned source files with local file
33
+ tools. `ads_read_file` reads mapped draft source in bounded ranges.
34
+ `ads_update_draft` registers additions/deletions or edits source for remote
35
+ clients; pass the current revision from `ads_drafts`. `content:null` proposes a
36
+ deletion. Binary content uses `encoding:"base64"`; acceptance uses Git's existing
37
+ binary patch support. Do not edit accepted source to iterate a proposal.
38
+
39
+ `ads_drafts` lists only drafts. Filter by unit/query, page with offset/limit, or
40
+ pass id to inspect file mappings. Catalogue and scenario entries expose their
41
+ draft references. `ads_tokens` also lists tokenGroups derived from token CSS
42
+ files. For a group draft, create `{units:["tokens"],tokenGroups:["colors"]}` using
43
+ the actual returned IDs. Shared tokens remain owned by `tokens`; groups do not
44
+ create component-local value catalogues.
45
+
46
+ ## Preview and dependencies
47
+
48
+ Call `ads_show_draft({id,scenario?})`, then inspect its actual `showcaseUrl` in a
49
+ browser. The preview reuses an isolated compiler workspace across edits and does
50
+ not run acceptance checks. Up to four draft compiler sessions stay warm; opening
51
+ more reclaims an older generated workspace without deleting its tracked proposal.
52
+ Reopen after edits to obtain the current revision.
53
+ Compilation is feedback, not passing behavior/visual evidence.
54
+
55
+ For model-visible images, use `ads_capture({scenario,draft:id,revision,...settings})`
56
+ and read the returned PNG resource URIs. This captures Accepted/current and
57
+ Draft/candidate without acceptance checks; new scenarios have only a candidate.
58
+ The candidate records the exact proposal revision. Edits during capture prevent
59
+ publication of its image slots. Captures establish appearance at those settings,
60
+ not passing acceptance or behavioral checks.
61
+
62
+ A pattern draft may use a component draft; a composition may use component,
63
+ pattern and token drafts. Declare their IDs in `dependencies` when creating or
64
+ updating the dependent draft. Keep normal `@ds` imports in all implementations
65
+ and scenarios. The preview overlays the proposed files at canonical paths; no
66
+ project code imports `.ads` draft source. Cycles, missing dependencies and
67
+ overlapping non-barrel edits are errors. Use one coupled draft for overlapping
68
+ changes. A coupled draft may declare up to eight existing/new owners.
69
+
70
+ Accept dependencies first. ADS removes resolved dependency IDs from dependent
71
+ manifests and their previews use the final accepted implementation automatically.
72
+ Independent shared-barrel exports are merged; overlapping source changes remain
73
+ explicit conflicts. Review the dependent's new revision before accepting it.
74
+ If a dependency is dropped, correct the remaining draft's dependency list.
75
+
76
+ DS Explorer has a Drafts section and draft badges. Its header Split view toggle
77
+ compares Accepted and Draft in the right pane, preserving navigation. Both use
78
+ the same scenario/theme and available or phone viewport width. New scenarios
79
+ without an accepted counterpart show only the draft and disable comparison.
80
+
81
+ ## Accept or drop
82
+
83
+ After rendered review, call `ads_accept({id,revision})` once. It checks that exact
84
+ revision, runs mandatory ADS/registered Oxlint/project checks and affected
85
+ behavior checks against an isolated candidate, and applies passing changes at
86
+ their normal paths. Changes during checking or baseline conflicts prevent
87
+ application. Successful acceptance removes the proposal and records an event.
88
+ There is no separate Apply or Iterate action. A failed attempt retains the draft;
89
+ inspect its returned resultId with `ads_results` and fix the reported boundary.
90
+
91
+ `ads_drop_draft({id,revision})` deletes a proposal and its generated preview,
92
+ without changing accepted source. Drop replaces a separate refusal action.
93
+ Read `ads_status.drafts`, `ads_drafts.events` or `ads://project/drafts` to observe
94
+ decisions. Resource notifications are available, but the host may not wake an
95
+ agent; always use the returned outcome or persisted status as the fallback.
96
+
97
+ ## Build isolation
98
+
99
+ Draft presence alone must not fail an application build. Drafts are excluded from
100
+ normal ADS discovery and validation inputs. ADS import guards reject direct,
101
+ aliased, re-exported, dynamic and symlink imports of marked files or ads-drafts/,
102
+ including attempts from scenarios/tests outside the isolated preview overlay.
103
+ Install `draftImportGuard()` from `@reqvire-org/ads/scenarios/vite` in application
104
+ Vite/Rollup builds as well as keeping the mandatory ADS check/build pipeline.
105
+ It rejects resolved draft modules and glob-expanded module loads. Merely adding a
106
+ TypeScript exclude pattern is not an import boundary. Do not export drafts, add
107
+ production aliases to them, or copy draft storage into published assets.
@@ -1,5 +1,11 @@
1
1
  # Advanced guarded editing
2
2
 
3
+ For iterative design, prefer the [tracked auto-mode draft workflow](drafts.md):
4
+ ordinary edits and fast previews, then exact-revision acceptance. Complete a
5
+ coherent change by accepting its required drafts, or report it as unfinished.
6
+ The disposable `.ds/patch-drafts/` copies described below are low-level patch
7
+ staging for focused repairs and migrations, not tracked review proposals.
8
+
3
9
  Use `ads_apply_patch` for independent owner edits. `ads_prepare_patch` can create a
4
10
  local draft of one owner and its companions; edit that directory with local file
5
11
  tools, request `action:"diff"`, then apply the returned patchFile. Discard the
@@ -3,6 +3,32 @@ name: ads-designer
3
3
  description: Bootstrap an empty local React design system from bundled scaffolding, or build UI using a project's existing design system. Covers shared token contracts, local ownership, public APIs, external source integration, showcase inspection, and validation.
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`.
30
+
31
+
6
32
  For validation scope, full audits, and CLI/MCP parity, read
7
33
  [validation.md](references/validation.md).
8
34
 
@@ -3,9 +3,10 @@ import { defineConfig } from "vite";
3
3
  import react from "@vitejs/plugin-react";
4
4
  import wyw from "@wyw-in-js/vite";
5
5
  import { linariaTagResolver } from "@reqvire-org/ads/linaria";
6
+ import { draftImportGuard } from "@reqvire-org/ads/scenarios/vite";
6
7
 
7
8
  export default defineConfig({
8
- plugins: [wyw({ tagResolver: linariaTagResolver }), react()],
9
+ plugins: [draftImportGuard(), wyw({ tagResolver: linariaTagResolver }), react()],
9
10
  resolve: {
10
11
  alias: { "@ds/review": path.resolve(import.meta.dirname, "design-system/review/index.ts"), "@ds": path.resolve(import.meta.dirname, "design-system/index.ts") },
11
12
  },
@@ -1,5 +1,12 @@
1
1
  # On-demand visual captures
2
2
 
3
+ For a [tracked draft](drafts.md), pass `draft` and its exact `revision` to
4
+ `ads_capture`. Accepted/current and Draft/candidate images use warm preview hosts
5
+ without running draft acceptance checks. The candidate records the proposal
6
+ revision; changed inputs prevent publication. Read the returned PNG resources
7
+ for model-visible review before `ads_accept`. Compilation/screenshots alone do
8
+ not establish behavioral or acceptance evidence.
9
+
3
10
  Use captures when reviewing appearance or a proposed visual change. Discover exact
4
11
  scenario IDs with `ads_scenarios`; these are project-owned independently mountable
5
12
  token, component, pattern and composition views. A component export alone is not
@@ -0,0 +1,107 @@
1
+ # Tracked drafts and auto-mode acceptance
2
+
3
+ Use this workflow for iterative design changes. Auto mode means the agent reviews
4
+ the rendered result and accepts it; it does not introduce a human approval gate.
5
+ Human acceptance controls are not part of this version.
6
+
7
+ ## Complete a coherent design change
8
+
9
+ A unit of design work can span several components, a pattern or an entire view.
10
+ Do not finish that work with its intended changes left only in drafts. Review,
11
+ validate and accept all required drafts before reporting the change complete.
12
+ Accept dependency drafts first, then review their dependents again. If checks or
13
+ baseline conflicts block acceptance, fix them and continue. If progress requires
14
+ missing user input or an external change, report the work as unfinished, with the
15
+ exact draft and blocker. Never silently drop requested work or accept a failing
16
+ draft to meet this completion rule. Leave a draft intentionally only when the
17
+ user asks to retain a proposal for later review.
18
+
19
+ ## Source and lifecycle
20
+
21
+ `ads_create_draft({units:["components/Button"], title:"Button spacing"})` creates
22
+ `ads-drafts/<id>/proposal.ads.draft.json` and `.ads` draft sources.
23
+ For example, `Button.tsx.ads` maps to the normal `Button.tsx` target. The final
24
+ `.ads` extension keeps proposed code out of default TypeScript/lint discovery,
25
+ without editing project tsconfig files. The manifest remains
26
+ `proposal.ads.draft.json`. These are ordinary tracked project files: commit them and review them in a PR.
27
+ Git is not required to create or recover a draft. Restarting ADS or cloning the
28
+ project discovers the same source. Generated compiler workspaces and execution
29
+ events remain under ignored `.ds/`; an interrupted check is never a pass.
30
+
31
+ The manifest maps each proposed file to its normal project target and records
32
+ its baseline fingerprint and owner. Edit returned source files with local file
33
+ tools. `ads_read_file` reads mapped draft source in bounded ranges.
34
+ `ads_update_draft` registers additions/deletions or edits source for remote
35
+ clients; pass the current revision from `ads_drafts`. `content:null` proposes a
36
+ deletion. Binary content uses `encoding:"base64"`; acceptance uses Git's existing
37
+ binary patch support. Do not edit accepted source to iterate a proposal.
38
+
39
+ `ads_drafts` lists only drafts. Filter by unit/query, page with offset/limit, or
40
+ pass id to inspect file mappings. Catalogue and scenario entries expose their
41
+ draft references. `ads_tokens` also lists tokenGroups derived from token CSS
42
+ files. For a group draft, create `{units:["tokens"],tokenGroups:["colors"]}` using
43
+ the actual returned IDs. Shared tokens remain owned by `tokens`; groups do not
44
+ create component-local value catalogues.
45
+
46
+ ## Preview and dependencies
47
+
48
+ Call `ads_show_draft({id,scenario?})`, then inspect its actual `showcaseUrl` in a
49
+ browser. The preview reuses an isolated compiler workspace across edits and does
50
+ not run acceptance checks. Up to four draft compiler sessions stay warm; opening
51
+ more reclaims an older generated workspace without deleting its tracked proposal.
52
+ Reopen after edits to obtain the current revision.
53
+ Compilation is feedback, not passing behavior/visual evidence.
54
+
55
+ For model-visible images, use `ads_capture({scenario,draft:id,revision,...settings})`
56
+ and read the returned PNG resource URIs. This captures Accepted/current and
57
+ Draft/candidate without acceptance checks; new scenarios have only a candidate.
58
+ The candidate records the exact proposal revision. Edits during capture prevent
59
+ publication of its image slots. Captures establish appearance at those settings,
60
+ not passing acceptance or behavioral checks.
61
+
62
+ A pattern draft may use a component draft; a composition may use component,
63
+ pattern and token drafts. Declare their IDs in `dependencies` when creating or
64
+ updating the dependent draft. Keep normal `@ds` imports in all implementations
65
+ and scenarios. The preview overlays the proposed files at canonical paths; no
66
+ project code imports `.ads` draft source. Cycles, missing dependencies and
67
+ overlapping non-barrel edits are errors. Use one coupled draft for overlapping
68
+ changes. A coupled draft may declare up to eight existing/new owners.
69
+
70
+ Accept dependencies first. ADS removes resolved dependency IDs from dependent
71
+ manifests and their previews use the final accepted implementation automatically.
72
+ Independent shared-barrel exports are merged; overlapping source changes remain
73
+ explicit conflicts. Review the dependent's new revision before accepting it.
74
+ If a dependency is dropped, correct the remaining draft's dependency list.
75
+
76
+ DS Explorer has a Drafts section and draft badges. Its header Split view toggle
77
+ compares Accepted and Draft in the right pane, preserving navigation. Both use
78
+ the same scenario/theme and available or phone viewport width. New scenarios
79
+ without an accepted counterpart show only the draft and disable comparison.
80
+
81
+ ## Accept or drop
82
+
83
+ After rendered review, call `ads_accept({id,revision})` once. It checks that exact
84
+ revision, runs mandatory ADS/registered Oxlint/project checks and affected
85
+ behavior checks against an isolated candidate, and applies passing changes at
86
+ their normal paths. Changes during checking or baseline conflicts prevent
87
+ application. Successful acceptance removes the proposal and records an event.
88
+ There is no separate Apply or Iterate action. A failed attempt retains the draft;
89
+ inspect its returned resultId with `ads_results` and fix the reported boundary.
90
+
91
+ `ads_drop_draft({id,revision})` deletes a proposal and its generated preview,
92
+ without changing accepted source. Drop replaces a separate refusal action.
93
+ Read `ads_status.drafts`, `ads_drafts.events` or `ads://project/drafts` to observe
94
+ decisions. Resource notifications are available, but the host may not wake an
95
+ agent; always use the returned outcome or persisted status as the fallback.
96
+
97
+ ## Build isolation
98
+
99
+ Draft presence alone must not fail an application build. Drafts are excluded from
100
+ normal ADS discovery and validation inputs. ADS import guards reject direct,
101
+ aliased, re-exported, dynamic and symlink imports of marked files or ads-drafts/,
102
+ including attempts from scenarios/tests outside the isolated preview overlay.
103
+ Install `draftImportGuard()` from `@reqvire-org/ads/scenarios/vite` in application
104
+ Vite/Rollup builds as well as keeping the mandatory ADS check/build pipeline.
105
+ It rejects resolved draft modules and glob-expanded module loads. Merely adding a
106
+ TypeScript exclude pattern is not an import boundary. Do not export drafts, add
107
+ production aliases to them, or copy draft storage into published assets.
@@ -1,5 +1,11 @@
1
1
  # Advanced guarded editing
2
2
 
3
+ For iterative design, prefer the [tracked auto-mode draft workflow](drafts.md):
4
+ ordinary edits and fast previews, then exact-revision acceptance. Complete a
5
+ coherent change by accepting its required drafts, or report it as unfinished.
6
+ The disposable `.ds/patch-drafts/` copies described below are low-level patch
7
+ staging for focused repairs and migrations, not tracked review proposals.
8
+
3
9
  Use `ads_apply_patch` for independent owner edits. `ads_prepare_patch` can create a
4
10
  local draft of one owner and its companions; edit that directory with local file
5
11
  tools, request `action:"diff"`, then apply the returned patchFile. Discard the
@@ -3,6 +3,32 @@ 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`.
30
+
31
+
6
32
  For validation scope, full audits, and CLI/MCP parity, read
7
33
  [validation.md](references/validation.md).
8
34
 
@@ -1,5 +1,12 @@
1
1
  # On-demand visual captures
2
2
 
3
+ For a [tracked draft](drafts.md), pass `draft` and its exact `revision` to
4
+ `ads_capture`. Accepted/current and Draft/candidate images use warm preview hosts
5
+ without running draft acceptance checks. The candidate records the proposal
6
+ revision; changed inputs prevent publication. Read the returned PNG resources
7
+ for model-visible review before `ads_accept`. Compilation/screenshots alone do
8
+ not establish behavioral or acceptance evidence.
9
+
3
10
  Use captures when reviewing appearance or a proposed visual change. Discover exact
4
11
  scenario IDs with `ads_scenarios`; these are project-owned independently mountable
5
12
  token, component, pattern and composition views. A component export alone is not
@@ -0,0 +1,107 @@
1
+ # Tracked drafts and auto-mode acceptance
2
+
3
+ Use this workflow for iterative design changes. Auto mode means the agent reviews
4
+ the rendered result and accepts it; it does not introduce a human approval gate.
5
+ Human acceptance controls are not part of this version.
6
+
7
+ ## Complete a coherent design change
8
+
9
+ A unit of design work can span several components, a pattern or an entire view.
10
+ Do not finish that work with its intended changes left only in drafts. Review,
11
+ validate and accept all required drafts before reporting the change complete.
12
+ Accept dependency drafts first, then review their dependents again. If checks or
13
+ baseline conflicts block acceptance, fix them and continue. If progress requires
14
+ missing user input or an external change, report the work as unfinished, with the
15
+ exact draft and blocker. Never silently drop requested work or accept a failing
16
+ draft to meet this completion rule. Leave a draft intentionally only when the
17
+ user asks to retain a proposal for later review.
18
+
19
+ ## Source and lifecycle
20
+
21
+ `ads_create_draft({units:["components/Button"], title:"Button spacing"})` creates
22
+ `ads-drafts/<id>/proposal.ads.draft.json` and `.ads` draft sources.
23
+ For example, `Button.tsx.ads` maps to the normal `Button.tsx` target. The final
24
+ `.ads` extension keeps proposed code out of default TypeScript/lint discovery,
25
+ without editing project tsconfig files. The manifest remains
26
+ `proposal.ads.draft.json`. These are ordinary tracked project files: commit them and review them in a PR.
27
+ Git is not required to create or recover a draft. Restarting ADS or cloning the
28
+ project discovers the same source. Generated compiler workspaces and execution
29
+ events remain under ignored `.ds/`; an interrupted check is never a pass.
30
+
31
+ The manifest maps each proposed file to its normal project target and records
32
+ its baseline fingerprint and owner. Edit returned source files with local file
33
+ tools. `ads_read_file` reads mapped draft source in bounded ranges.
34
+ `ads_update_draft` registers additions/deletions or edits source for remote
35
+ clients; pass the current revision from `ads_drafts`. `content:null` proposes a
36
+ deletion. Binary content uses `encoding:"base64"`; acceptance uses Git's existing
37
+ binary patch support. Do not edit accepted source to iterate a proposal.
38
+
39
+ `ads_drafts` lists only drafts. Filter by unit/query, page with offset/limit, or
40
+ pass id to inspect file mappings. Catalogue and scenario entries expose their
41
+ draft references. `ads_tokens` also lists tokenGroups derived from token CSS
42
+ files. For a group draft, create `{units:["tokens"],tokenGroups:["colors"]}` using
43
+ the actual returned IDs. Shared tokens remain owned by `tokens`; groups do not
44
+ create component-local value catalogues.
45
+
46
+ ## Preview and dependencies
47
+
48
+ Call `ads_show_draft({id,scenario?})`, then inspect its actual `showcaseUrl` in a
49
+ browser. The preview reuses an isolated compiler workspace across edits and does
50
+ not run acceptance checks. Up to four draft compiler sessions stay warm; opening
51
+ more reclaims an older generated workspace without deleting its tracked proposal.
52
+ Reopen after edits to obtain the current revision.
53
+ Compilation is feedback, not passing behavior/visual evidence.
54
+
55
+ For model-visible images, use `ads_capture({scenario,draft:id,revision,...settings})`
56
+ and read the returned PNG resource URIs. This captures Accepted/current and
57
+ Draft/candidate without acceptance checks; new scenarios have only a candidate.
58
+ The candidate records the exact proposal revision. Edits during capture prevent
59
+ publication of its image slots. Captures establish appearance at those settings,
60
+ not passing acceptance or behavioral checks.
61
+
62
+ A pattern draft may use a component draft; a composition may use component,
63
+ pattern and token drafts. Declare their IDs in `dependencies` when creating or
64
+ updating the dependent draft. Keep normal `@ds` imports in all implementations
65
+ and scenarios. The preview overlays the proposed files at canonical paths; no
66
+ project code imports `.ads` draft source. Cycles, missing dependencies and
67
+ overlapping non-barrel edits are errors. Use one coupled draft for overlapping
68
+ changes. A coupled draft may declare up to eight existing/new owners.
69
+
70
+ Accept dependencies first. ADS removes resolved dependency IDs from dependent
71
+ manifests and their previews use the final accepted implementation automatically.
72
+ Independent shared-barrel exports are merged; overlapping source changes remain
73
+ explicit conflicts. Review the dependent's new revision before accepting it.
74
+ If a dependency is dropped, correct the remaining draft's dependency list.
75
+
76
+ DS Explorer has a Drafts section and draft badges. Its header Split view toggle
77
+ compares Accepted and Draft in the right pane, preserving navigation. Both use
78
+ the same scenario/theme and available or phone viewport width. New scenarios
79
+ without an accepted counterpart show only the draft and disable comparison.
80
+
81
+ ## Accept or drop
82
+
83
+ After rendered review, call `ads_accept({id,revision})` once. It checks that exact
84
+ revision, runs mandatory ADS/registered Oxlint/project checks and affected
85
+ behavior checks against an isolated candidate, and applies passing changes at
86
+ their normal paths. Changes during checking or baseline conflicts prevent
87
+ application. Successful acceptance removes the proposal and records an event.
88
+ There is no separate Apply or Iterate action. A failed attempt retains the draft;
89
+ inspect its returned resultId with `ads_results` and fix the reported boundary.
90
+
91
+ `ads_drop_draft({id,revision})` deletes a proposal and its generated preview,
92
+ without changing accepted source. Drop replaces a separate refusal action.
93
+ Read `ads_status.drafts`, `ads_drafts.events` or `ads://project/drafts` to observe
94
+ decisions. Resource notifications are available, but the host may not wake an
95
+ agent; always use the returned outcome or persisted status as the fallback.
96
+
97
+ ## Build isolation
98
+
99
+ Draft presence alone must not fail an application build. Drafts are excluded from
100
+ normal ADS discovery and validation inputs. ADS import guards reject direct,
101
+ aliased, re-exported, dynamic and symlink imports of marked files or ads-drafts/,
102
+ including attempts from scenarios/tests outside the isolated preview overlay.
103
+ Install `draftImportGuard()` from `@reqvire-org/ads/scenarios/vite` in application
104
+ Vite/Rollup builds as well as keeping the mandatory ADS check/build pipeline.
105
+ It rejects resolved draft modules and glob-expanded module loads. Merely adding a
106
+ TypeScript exclude pattern is not an import boundary. Do not export drafts, add
107
+ production aliases to them, or copy draft storage into published assets.
@@ -1,5 +1,11 @@
1
1
  # Advanced guarded editing
2
2
 
3
+ For iterative design, prefer the [tracked auto-mode draft workflow](drafts.md):
4
+ ordinary edits and fast previews, then exact-revision acceptance. Complete a
5
+ coherent change by accepting its required drafts, or report it as unfinished.
6
+ The disposable `.ds/patch-drafts/` copies described below are low-level patch
7
+ staging for focused repairs and migrations, not tracked review proposals.
8
+
3
9
  Use `ads_apply_patch` for independent owner edits. `ads_prepare_patch` can create a
4
10
  local draft of one owner and its companions; edit that directory with local file
5
11
  tools, request `action:"diff"`, then apply the returned patchFile. Discard the
@@ -3,6 +3,32 @@ name: ads-motion
3
3
  description: Implement, review, audit, or profile web animation in a project's local design system. Use for motion purpose, easing, timing, origins, interruptibility, reduced motion, and rendering performance while preserving token and component ownership.
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`.
30
+
31
+
6
32
  For validation scope, full audits, and CLI/MCP parity, read
7
33
  [validation.md](references/validation.md).
8
34
 
@@ -1,5 +1,12 @@
1
1
  # On-demand visual captures
2
2
 
3
+ For a [tracked draft](drafts.md), pass `draft` and its exact `revision` to
4
+ `ads_capture`. Accepted/current and Draft/candidate images use warm preview hosts
5
+ without running draft acceptance checks. The candidate records the proposal
6
+ revision; changed inputs prevent publication. Read the returned PNG resources
7
+ for model-visible review before `ads_accept`. Compilation/screenshots alone do
8
+ not establish behavioral or acceptance evidence.
9
+
3
10
  Use captures when reviewing appearance or a proposed visual change. Discover exact
4
11
  scenario IDs with `ads_scenarios`; these are project-owned independently mountable
5
12
  token, component, pattern and composition views. A component export alone is not