@reqvire-org/ads 0.3.32 → 0.3.34

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 (84) hide show
  1. package/README.md +9 -0
  2. package/dist/behavior-libraries.mjs +93 -0
  3. package/dist/behaviors.mjs +0 -6
  4. package/dist/bootstrap-ds/ds.config.json +1 -0
  5. package/dist/bootstrap-ds/vite.config.ts +2 -1
  6. package/dist/boundaries.mjs +2 -0
  7. package/dist/capture.mjs +8 -6
  8. package/dist/check.mjs +2 -0
  9. package/dist/config.mjs +9 -2
  10. package/dist/draft-boundary.mjs +27 -0
  11. package/dist/draft-workspace.mjs +10 -0
  12. package/dist/lint-config.mjs +8 -0
  13. package/dist/mcp/build-status.mjs +1 -1
  14. package/dist/mcp/catalog.mjs +4 -2
  15. package/dist/mcp/context.mjs +2 -2
  16. package/dist/mcp/draft-discovery.mjs +55 -0
  17. package/dist/mcp/draft-exports.mjs +40 -0
  18. package/dist/mcp/drafts.mjs +460 -0
  19. package/dist/mcp/edit-preparation.mjs +8 -7
  20. package/dist/mcp/execution-results.mjs +2 -0
  21. package/dist/mcp/mutations.mjs +6 -2
  22. package/dist/mcp/preview-watch.mjs +24 -5
  23. package/dist/mcp/preview-widget.bundle.js +14 -14
  24. package/dist/mcp/prompts.mjs +3 -2
  25. package/dist/mcp/server.mjs +178 -39
  26. package/dist/mcp/widget.bundle.js +1 -1
  27. package/dist/preview-files.mjs +2 -0
  28. package/dist/scenario-inspector.mjs +5 -5
  29. package/dist/scenario-program.mjs +36 -0
  30. package/dist/scenario-registry.mjs +90 -0
  31. package/dist/scenarios-compiler.mjs +68 -22
  32. package/dist/scenarios-vite.d.mts +1 -0
  33. package/dist/scenarios-vite.mjs +1 -0
  34. package/dist/scenarios.mjs +2 -1
  35. package/dist/showcase/client.bundle.js +28 -28
  36. package/dist/showcase/comparison.js +45 -0
  37. package/dist/showcase/draft-navigation.js +41 -0
  38. package/dist/showcase/preview-state.js +19 -0
  39. package/dist/showcase/style.css +5 -0
  40. package/dist/skills/README.md +5 -0
  41. package/dist/skills/ads-break-ui/SKILL.md +26 -0
  42. package/dist/skills/ads-break-ui/references/behaviors.md +10 -0
  43. package/dist/skills/ads-break-ui/references/captures.md +7 -0
  44. package/dist/skills/ads-break-ui/references/drafts.md +146 -0
  45. package/dist/skills/ads-break-ui/references/guarded-editing.md +6 -0
  46. package/dist/skills/ads-break-ui/references/validation.md +6 -0
  47. package/dist/skills/ads-designer/SKILL.md +33 -0
  48. package/dist/skills/ads-designer/assets/bootstrap-ds/ds.config.json +1 -0
  49. package/dist/skills/ads-designer/assets/bootstrap-ds/vite.config.ts +2 -1
  50. package/dist/skills/ads-designer/references/behaviors.md +10 -0
  51. package/dist/skills/ads-designer/references/captures.md +7 -0
  52. package/dist/skills/ads-designer/references/drafts.md +146 -0
  53. package/dist/skills/ads-designer/references/guarded-editing.md +6 -0
  54. package/dist/skills/ads-designer/references/validation.md +6 -0
  55. package/dist/skills/ads-import/SKILL.md +30 -0
  56. package/dist/skills/ads-import/references/behaviors.md +10 -0
  57. package/dist/skills/ads-import/references/captures.md +7 -0
  58. package/dist/skills/ads-import/references/drafts.md +146 -0
  59. package/dist/skills/ads-import/references/guarded-editing.md +6 -0
  60. package/dist/skills/ads-import/references/validation.md +6 -0
  61. package/dist/skills/ads-motion/SKILL.md +26 -0
  62. package/dist/skills/ads-motion/references/behaviors.md +10 -0
  63. package/dist/skills/ads-motion/references/captures.md +7 -0
  64. package/dist/skills/ads-motion/references/drafts.md +146 -0
  65. package/dist/skills/ads-motion/references/guarded-editing.md +6 -0
  66. package/dist/skills/ads-motion/references/validation.md +6 -0
  67. package/dist/skills/ads-port/SKILL.md +34 -1
  68. package/dist/skills/ads-port/references/behaviors.md +10 -0
  69. package/dist/skills/ads-port/references/captures.md +7 -0
  70. package/dist/skills/ads-port/references/drafts.md +146 -0
  71. package/dist/skills/ads-port/references/guarded-editing.md +6 -0
  72. package/dist/skills/ads-port/references/native-implementation.md +14 -1
  73. package/dist/skills/ads-port/references/validation.md +6 -0
  74. package/dist/unit-contracts.mjs +2 -2
  75. package/dist/units.mjs +6 -0
  76. package/dist/verification/browser.d.mts +27 -0
  77. package/dist/verification.mjs +3 -0
  78. package/docs/ADS.md +13 -0
  79. package/docs/ARCHITECTURE.md +94 -0
  80. package/docs/CHANGELOG.md +111 -0
  81. package/docs/CONTRACTS.md +8 -0
  82. package/docs/GUIDE.md +46 -9
  83. package/docs/MCP.md +90 -0
  84. package/package.json +6 -4
@@ -0,0 +1,146 @@
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
+ Creation queues compiler prewarming without delaying its response. Bursts of
53
+ creations coalesce, and only one queued compiler initializes at a time. A newer
54
+ speculative prewarm reclaims the older unused one; explicitly opened sessions
55
+ remain warm within the four-session bound. MCP edits
56
+ and direct draft-file edits notify warm previews through file events; periodic
57
+ reconciliation recovers missed events. Watched builds compile requested scenarios
58
+ and their dependencies, retaining roots used by other open previews. Full builds
59
+ and validation still cover the complete configured scope. Incremental semantic
60
+ analysis reuses unchanged TypeScript source trees without caching passing checks.
61
+ Reopening a known scenario renders through the existing compiler while a worker
62
+ refreshes catalogue metadata. Read `discovery.state` (`current`, `pending`,
63
+ `error`) and its metadata revision separately from the exact proposal revision.
64
+ New/missing scenario identities wait for fresh discovery. A previous preview may
65
+ stay visible until compilation finishes; pending/stale output is not evidence.
66
+ Reopen after edits to obtain the current revision.
67
+ Compilation is feedback, not passing behavior/visual evidence.
68
+
69
+ For model-visible images, use `ads_capture({scenario,draft:id,revision,...settings})`
70
+ and read the returned PNG resource URIs. This captures Accepted/current and
71
+ Draft/candidate without acceptance checks; new scenarios have only a candidate.
72
+ The candidate records the exact proposal revision. Edits during capture prevent
73
+ publication of its image slots. Captures establish appearance at those settings,
74
+ not passing acceptance or behavioral checks.
75
+
76
+ A pattern draft may use a component draft; a composition may use component,
77
+ pattern and token drafts. Declare their IDs in `dependencies` when creating or
78
+ updating the dependent draft. Keep normal `@ds` imports in all implementations
79
+ and scenarios. The preview overlays the proposed files at canonical paths; no
80
+ project code imports `.ads` draft source. Cycles, missing dependencies and
81
+ overlapping non-barrel edits are errors. Use one coupled draft for overlapping
82
+ changes. A coupled draft may declare up to eight existing/new owners.
83
+
84
+ Accept dependencies first. ADS removes resolved dependency IDs from dependent
85
+ manifests and their previews use the final accepted implementation automatically.
86
+ Independent shared-barrel exports are merged; overlapping source changes remain
87
+ explicit conflicts. Review the dependent's new revision before accepting it.
88
+ If a dependency is dropped, correct the remaining draft's dependency list.
89
+
90
+ DS Explorer keeps drafts in the ordinary Tokens, Components, Patterns and
91
+ Composition navigation. A Draft badge marks an owner with a pending proposal,
92
+ whether or not it has an accepted version. Select that entry and use the header
93
+ Split view toggle to compare Accepted and Draft in the right pane. Both use the
94
+ same scenario/theme and available or phone viewport width. New owners appear
95
+ in their normal section; without an accepted counterpart they show only the
96
+ draft and disable comparison. There is no separate Drafts tab or scenario picker.
97
+ An isolated overlay can also render an unchanged scenario as an explicit review
98
+ context; that alone does not give its owner a Draft badge. Use `ads_drafts` for
99
+ draft-only MCP listing.
100
+
101
+ After 20 retained module revisions, Explorer restarts the affected App to release
102
+ its module cache, then restores the selected scenario/theme/viewport. Comparison
103
+ keeps the other version mounted; no manual reload or draft acceptance is needed.
104
+
105
+ Explorer entry glyphs separately show preview build states in monochrome: not
106
+ built, building, compiled/checking, ready, stale and failed. MCP draft summaries
107
+ include `preview` and preview calls include `build`; inspect `building`,
108
+ `current`, `stale`, scenario revisions and `preview.resourceUri` for detail.
109
+ Subscribe to `ads://project/build` and `ads://project/drafts` for standard
110
+ resource-update notifications on completion, failure and metadata refresh, or
111
+ subscribe only to an active draft's `preview.resourceUri` for its isolated report.
112
+ Modern clients use `subscriptions/listen` resource filters; older clients use
113
+ `resources/subscribe`. Re-read notified resources to update the existing view;
114
+ unsubscribe on teardown and resubscribe/read after reconnect. Removal invalidates
115
+ the scoped resource. Poll when the host does not forward notifications.
116
+ Build completion and mounted-App rendering readiness are separate. Ready draft
117
+ output remains unaccepted. Review the
118
+ current rendered revision and complete acceptance before finishing the change.
119
+
120
+ ## Accept or drop
121
+
122
+ After rendered review, call `ads_accept({id,revision})` once. It checks that exact
123
+ revision, runs mandatory ADS/registered Oxlint/project checks and affected
124
+ behavior checks against an isolated candidate, and applies passing changes at
125
+ their normal paths. Changes during checking or baseline conflicts prevent
126
+ application. Successful acceptance removes the proposal and records an event.
127
+ There is no separate Apply or Iterate action. A failed attempt retains the draft;
128
+ inspect its returned resultId with `ads_results` and fix the reported boundary.
129
+
130
+ `ads_drop_draft({id,revision})` deletes a proposal and its generated preview,
131
+ without changing accepted source. Drop replaces a separate refusal action.
132
+ Read `ads_status.drafts`, `ads_drafts.events` or `ads://project/drafts` to observe
133
+ decisions. Resource notifications are available, but the host may not wake an
134
+ agent; always use the returned outcome or persisted status as the fallback.
135
+
136
+ ## Build isolation
137
+
138
+ Draft presence alone must not fail an application build. Drafts are excluded from
139
+ normal ADS discovery and validation inputs. ADS import guards reject direct,
140
+ aliased, re-exported, dynamic and symlink imports of marked files or ads-drafts/,
141
+ including attempts from scenarios/tests outside the isolated preview overlay.
142
+ Install `draftImportGuard()` from `@reqvire-org/ads/scenarios/vite` in application
143
+ Vite/Rollup builds as well as keeping the mandatory ADS check/build pipeline.
144
+ It rejects resolved draft modules and glob-expanded module loads. Merely adding a
145
+ TypeScript exclude pattern is not an import boundary. Do not export drafts, add
146
+ 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
@@ -62,7 +62,20 @@ Dependency installation does not establish styling ownership. Keep only needed,
62
62
  declared runtime dependencies; inspect any stylesheet, reset, theme provider or
63
63
  visual default they require. Do not introduce a dependency's styling system or
64
64
  global reset to make its pixels match. Adapt owned styles through Linaria and
65
- shared Data; preserve any supported headless dependency's behavior contract.
65
+ shared Data; preserve installed behavior libraries explicitly approved through
66
+ `behaviorLibraries` in `ds.config.json` and listed in `package.json` dependencies.
67
+ Use their installed APIs with minimal lifecycle/event integration; do not vendor
68
+ or rewrite their source. For hard behavior, prefer the project's declared library.
69
+ If none fits, suggest a framework-free package for approval or implement natively.
70
+ Do not add a package or allowlist entry without authorization already covering it.
71
+ ADS checks the declaration and installation, not third-party dependency internals.
72
+
73
+ Floating UI's `computePosition` can feed `x`/`y` through exact allowlisted writes
74
+ such as `element.style.setProperty("--ds-popover-x", x + "px")` and the equivalent
75
+ `--ds-popover-y`. Register only these measured properties in
76
+ `boundaries.styleWrites`; keep placement CSS and visual treatment in project
77
+ Linaria and clean up `autoUpdate` observers on unmount. Library approval creates
78
+ no additional inline-style or CSSProperties exception.
66
79
 
67
80
  Preserve required capabilities, accessibility and interactions while applying
68
81
  the project's visual language. Source pixels are a reference, not an automatic
@@ -67,3 +67,9 @@ separate latest validation result, alongside verification and mutation results.
67
67
  Source changes during execution reject success and leave the previous full
68
68
  baseline intact. Skipped registered behavior cases never pass; a project with no
69
69
  registered behavior contracts reports that stage as skipped with a reason.
70
+
71
+ Registered browser verification queues the selected scenario roots together
72
+ before browser workers open their pages. They share one candidate graph and
73
+ keep independent App state. This avoids compiling a growing graph per page.
74
+ A graph revision changing during startup keeps the preview pending until a
75
+ coherent current build mounts; it does not establish passing case evidence.
@@ -96,14 +96,14 @@ export function staticContractValue(expression, checker, options, locations = ne
96
96
  return read(expression);
97
97
  }
98
98
 
99
- export function inspectUnitContracts(options) {
99
+ export function inspectUnitContracts(options, suppliedProgram) {
100
100
  if (options.unitContracts) return options.unitContracts;
101
101
  const files = sourceFiles(options.dsRoot).filter(isContractFile);
102
102
  const result = { contracts: [], diagnostics: [], program: null };
103
103
  options.unitContracts = result;
104
104
  if (!files.length) return result;
105
105
  const inventory = inspectUnits(options);
106
- const program = ts.createProgram(sourceFiles(options.dsRoot).filter(file => /\.[cm]?[jt]sx?$/.test(file)), { ...projectCompilerOptions(options), allowJs: true });
106
+ const program = suppliedProgram ?? ts.createProgram(sourceFiles(options.dsRoot).filter(file => /\.[cm]?[jt]sx?$/.test(file)), { ...projectCompilerOptions(options), allowJs: true });
107
107
  result.program = program;
108
108
  const checker = program.getTypeChecker();
109
109
  const publicItems = [...publicApi(program, options), ...reviewApi(program, options)];
package/dist/units.mjs CHANGED
@@ -64,6 +64,12 @@ export function configurationFiles(options) {
64
64
  for (const file of files) visit(path.resolve(root,file),true, /^(?:ts|js)config[^/]*\.jsonc?$/.test(file));
65
65
  for (const plugin of config.oxlint.plugins) visit(path.resolve(root, plugin.path), true);
66
66
  const pkg = existsSync(path.join(root, "package.json")) ? JSON.parse(readFileSync(path.join(root, "package.json"), "utf8")) : {};
67
+ // Explicit build-tool config flags identify setup files even inside the ADS
68
+ // directory. Their tooling imports are not production behavior dependencies.
69
+ for (const command of Object.values(pkg.scripts ?? {})) if (typeof command === "string") {
70
+ for (const match of command.matchAll(/\b(?:vite|vitest|playwright)\b[^;&|\n]*?\s(?:--config(?:=|\s+)|-c\s+)(?:"([^"]+)"|'([^']+)'|([^\s;&|]+))/g))
71
+ visit(path.resolve(root, match[1] ?? match[2] ?? match[3]), true);
72
+ }
67
73
  const scripts = new Set();
68
74
  function script(name) {
69
75
  if (scripts.has(name)) return;
@@ -0,0 +1,27 @@
1
+ import type { Frame, Page } from "@playwright/test";
2
+
3
+ /** Development-only helpers; Playwright is provided by the project's runner. */
4
+ export interface VerificationRequest {
5
+ schemaVersion: 1;
6
+ runId: string;
7
+ projectRoot: string;
8
+ framework: string;
9
+ profile: string;
10
+ mode: string;
11
+ checks: { id: string; scenario?: string; [key: string]: unknown }[];
12
+ scenarios: Record<string, string>;
13
+ }
14
+
15
+ export interface PaintAuditResult {
16
+ ok: boolean;
17
+ complete?: boolean;
18
+ verified: { owner: string; binding: string; variable: string }[];
19
+ diagnostics: string[];
20
+ limits?: string[];
21
+ scope?: string;
22
+ }
23
+
24
+ export function verificationRequest(): VerificationRequest;
25
+ export function auditBehaviorPaints(frame: Frame): Promise<PaintAuditResult>;
26
+ export function openBehaviorScenario(page: Page, checkId: string, options?: { timeout?: number }): Promise<Frame>;
27
+ export function openPreviewScenario(page: Page, url: string, scenario: string, options?: { timeout?: number }): Promise<Frame>;
@@ -258,6 +258,9 @@ export function createVerificationController(root, { reportRoot = root, onProgre
258
258
  if (profile.mode === "browser" && group.some(check => check.scenario)) {
259
259
  const { startAdsMcp } = await import("./mcp/server.mjs");
260
260
  host ??= await startAdsMcp(root, { stdio: false, showcase: true });
261
+ // Queue all selected roots before parallel browser workers open. A
262
+ // single graph avoids repeated compilation and startup handovers.
263
+ await host.warmScenarios([...new Set(group.map(check => check.scenario).filter(Boolean))], signal);
261
264
  for (const check of group.filter(check => check.scenario)) {
262
265
  const url = new URL(host.url);
263
266
  url.searchParams.set("scenario", check.scenario);
package/docs/ADS.md CHANGED
@@ -6,6 +6,19 @@ UX, and Skin pillars. [GUIDE.md](GUIDE.md) gives setup and configuration steps.
6
6
 
7
7
  ## Ownership boundary
8
8
 
9
+ Iterative design uses the [tracked draft contract](../skills/ads-designer/references/drafts.md).
10
+ Drafts are Git-committable proposals under `ads-drafts/` using `.ads`
11
+ source and a target/baseline manifest. They are excluded from normal discovery
12
+ and may not be imported, re-exported or resolved into application builds. Use
13
+ mandatory ADS checks and `draftImportGuard()` in application Vite/Rollup builds.
14
+ Only an isolated draft preview overlays them onto canonical project paths.
15
+ Components, patterns, compositions and shared token groups can participate;
16
+ dependency drafts must be accepted before their dependents. Acceptance applies
17
+ the exact reviewed revision through the existing ownership/validation gates.
18
+ Draft edits, stale inputs, conflicts and failed checks cannot publish source.
19
+ Agents must accept the required drafts before reporting a coherent design change
20
+ complete, unless the user explicitly requested a retained proposal.
21
+
9
22
  MCP source editing is opt-in through `ads mcp --mutations`. Its write operation
10
23
  accepts a Git unified diff for one ADS unit (or bounded owner patches for coupled
11
24
  transactions) and validates its source, scenario and
@@ -241,6 +241,29 @@ dependencies, with no runtime supplied by the MCP host. Shared controllers do no
241
241
  import styled consumers or introduce another skin layer. Existing measurement and
242
242
  style-write boundaries still apply.
243
243
 
244
+ Projects can explicitly allow installed runtime packages with
245
+ `"behaviorLibraries": ["@floating-ui/dom", "tabbable"]` in `ds.config.json`.
246
+ Each name must also appear in `package.json` dependencies and be installed.
247
+ Production ADS code may import those packages and their subpaths directly from
248
+ components, patterns or controllers; extract a shared controller only when the
249
+ behavior is shared. Other external runtime imports fail
250
+ `behavior-library-undeclared`. Type-only imports and development roles retain
251
+ their existing rules, as do the configured framework and Linaria exceptions.
252
+ `ads lint-config` reports import locations and the exact list to declare.
253
+
254
+ This is project approval, not a recursive dependency audit or a guarantee about
255
+ third-party internals. ADS reads installed versions without executing packages
256
+ or scanning their dependency source or stylesheets. The declaration authorizes
257
+ package imports and subpaths. Existing source styling and measured-geometry
258
+ checks retain their scope; it introduces no new package-CSS certification gate. Use libraries as installed, with minimal lifecycle/event integration.
259
+ For example, Floating UI's `computePosition` can supply `x` and `y` to an
260
+ allowlisted producer's `style.setProperty("--ds-popover-x", ...)` and
261
+ `style.setProperty("--ds-popover-y", ...)`; project Linaria owns positioning
262
+ rules and visual treatment. Register those exact properties using the existing
263
+ `boundaries.styleWrites` mechanism. Clean up positioning observers on unmount.
264
+ The project preview compiler bundles used library code into the normal MCP App
265
+ resource graph; declarations alone do not load packages or change its sandbox.
266
+
244
267
  Optional `<Owner>.ads.contract.ts` modules identify public APIs or private
245
268
  implementation symbols, named guarantees and registered execution checks. Scenario
246
269
  `exercises` links public behavior APIs to reachable demonstrations; `covers`
@@ -260,6 +283,18 @@ side effects, rather than the controller directory name.
260
283
 
261
284
  ## The showcase is the shared design workspace
262
285
 
286
+ Iterative proposals use tracked `ads-drafts/` source and explicit `.ads`
287
+ source, with canonical target mappings and baseline fingerprints. Production
288
+ discovery/imports exclude drafts. Generated preview mirrors retain the normal
289
+ project layout and public imports while overlaying proposed owner files and
290
+ declared draft dependencies; their compiler stays alive across edits. Only these
291
+ isolated mirrors skip acceptance validation for fast feedback. Acceptance uses
292
+ the ordinary guarded candidate pipeline, fences the exact reviewed revision and
293
+ rechecks live inputs before transactional publication. Pattern/composition and
294
+ token-group draft dependencies resolve to normal accepted source after promotion.
295
+ The [draft guide](../skills/ads-designer/references/drafts.md) defines lifecycle,
296
+ completion requirements, build integration and recovery.
297
+
263
298
  Humans and coding agents inspect the same project through MCP. The showcase is
264
299
  **a minimal shell plus an MCP client and Apps host**, shipped as development
265
300
  tooling. Its header, section tabs, collapsible left menu, theme switch and preview
@@ -452,6 +487,60 @@ scenario inspection run in the background. Inspection uses a persistent worker
452
487
  to keep the compiler responsive. Rapid edits replace pending work, with one
453
488
  verification run in flight. Production builds retain their own optimization.
454
489
 
490
+ Preview discovery shares `.ds/scenario-registry.json` between the MCP host,
491
+ draft selector and compiler processes. The snapshot contains scenario metadata
492
+ and diagnostics, keyed to the full relevant source/dependency/directory revision
493
+ and the loaded ADS code/runtime. Accepted and draft roots retain separate
494
+ snapshots. A matching snapshot avoids repeating TypeScript analysis during
495
+ startup; changed inputs or missing/corrupt snapshots trigger fresh discovery.
496
+ Explicit catalogue reads fence their in-memory registry against current source,
497
+ so edits and removals are visible before the next observation/reconciliation tick.
498
+ Reopening an already known draft scenario retains its last discovered metadata
499
+ while a persistent worker refreshes the catalogue. It does not run synchronous
500
+ semantic discovery on the preview request. New/missing scenario identities await
501
+ worker discovery; accepted comparison metadata is independently revision-fenced.
502
+ The response's `discovery` distinguishes current, pending and failed metadata
503
+ from the exact proposal revision and the actual preview build. Superseded worker
504
+ results cannot replace newer requests; drop/shutdown retires their state/worker.
505
+ Preview analysis retains a bounded set of TypeScript programs and unchanged
506
+ source trees across edits; module lookups are refreshed so added/deleted files
507
+ cannot inherit old resolution results. Full validation uses fresh independent
508
+ analysis. Watched graphs include requested scenario roots and their dependencies,
509
+ preserving roots used by other mounted Apps; untouched catalogue entries are not
510
+ compiled until requested. Unwatched full builds retain complete entry coverage.
511
+ Snapshot publication fences source edits during inspection. This cache supplies
512
+ no passing validation or behavior evidence: architecture and acceptance checks
513
+ continue to inspect and validate source independently.
514
+
515
+ Draft creation queues background compiler initialization. One prewarm runs at a
516
+ time, newer pending drafts supersede unused queued work and reclaim an older
517
+ unused speculative session, and explicit preview requests share the same startup.
518
+ Explicitly opened sessions remain subject to the four-session bound.
519
+ File events and MCP writes synchronize warm
520
+ overlays after a short debounce; a slower periodic reconciliation recovers lost
521
+ events and replaced directories. Closing ADS stops queued jobs, source watchers
522
+ and every owned compiler.
523
+
524
+ Draft build reports flow from their preview hosts into the parent build resource
525
+ and proposal summaries. `ads://project/build.drafts` identifies active proposal
526
+ builds, their scenario states, session/revision, freshness and scoped resource
527
+ addresses; `ads_drafts` and relevant discovery/preview results carry compact
528
+ status. Draft source edits immediately mark an existing preview queued/stale.
529
+ Build transitions change the parent resource fingerprint and emit standard
530
+ resource-update notifications for build/draft subscribers, including completion
531
+ and failure without another edit. Active scoped build resources are listed and
532
+ subscribable; removal emits a final invalidation and a resource-list change.
533
+ Observers share draft events across connections, detach when closed and serialize
534
+ refreshes so overlapping file events cannot replay older state. Native report-file
535
+ events notify promptly; periodic observation also covers missed/replaced files.
536
+ Stateless HTTP mutation handlers forward refreshes to those observers; they do
537
+ not initialize fresh observation and misclassify each request as a source edit.
538
+ Draft-only edits preserve accepted registry/catalogue snapshots. Capture updates
539
+ reuse source-fenced discovery rather than allocating another semantic program.
540
+ Explorer uses these reports for monochrome
541
+ entry glyphs and refreshes its mounted Apps. A ready draft preview remains
542
+ unaccepted; catalogue metadata or compiled feedback cannot establish acceptance.
543
+
455
544
  Live resources are fenced to the current source digest and managed session.
456
545
  They never update accepted artifacts, the successful graph cache or `current`.
457
546
  Only validation and compilation passing against unchanged source can publish the
@@ -470,6 +559,11 @@ matching checked candidate graph and scenario registry carry into the project's
470
559
  otherwise the normal watcher builds it in the background. Builds tied to a
471
560
  temporary candidate location are rebuilt. Source, dependencies, compiler and
472
561
  output content determine reuse, with no expiry based on elapsed time.
562
+ Cache recording checks the compiled source stamp before and after hashing
563
+ dependencies. An edit racing publication cannot associate previous output with
564
+ newer inputs; it leaves the previous cache intact and requires the next build.
565
+ A transferred checked graph can refresh older watcher metadata without recompiling
566
+ it, while a partial watched graph cannot replace the complete catalogue.
473
567
 
474
568
  After the selected view paints, a connected showcase can prefetch changed peers'
475
569
  static resources into the App's existing byte cache. This bounded, opportunistic
package/docs/CHANGELOG.md CHANGED
@@ -1,5 +1,116 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.3.34
4
+
5
+ <!-- ads-local-tests:start -->
6
+ Local verification: **535/535 passed** with `ADS_TEST_BUN=1 npm test`.
7
+ Tested commit: `7e1573d7c1d210b5955cf41778ac3886b515d6af`; Node v24.13.0, Bun 1.3.13.
8
+ Completed 2026-10-22T20:53:31.087Z (614 seconds).
9
+
10
+ <!-- ads-local-test-proof
11
+ {
12
+ "schema": 1,
13
+ "version": "0.3.34",
14
+ "commit": "7e1573d7c1d210b5955cf41778ac3886b515d6af",
15
+ "sourceSha256": "c020f82b1ceab0b30bb61722b26e8bba44c72e115687032fc7a5377487896c96",
16
+ "command": "ADS_TEST_BUN=1 npm test",
17
+ "result": "pass",
18
+ "tests": 535,
19
+ "pass": 535,
20
+ "fail": 0,
21
+ "cancelled": 0,
22
+ "skipped": 0,
23
+ "node": "v24.13.0",
24
+ "bun": "1.3.13",
25
+ "completedAt": "2026-10-22T20:53:31.087Z",
26
+ "durationMs": 613940,
27
+ "logSha256": "d66e7ddc9334e67567af1c47644e23c82348ab03e0297589301f7f5f00e72005"
28
+ }
29
+ -->
30
+ <!-- ads-local-tests:end -->
31
+
32
+ - Ship typed browser verification helpers so strict project typechecks retain
33
+ Playwright's DOM callback inference. Recognize explicitly configured nested
34
+ Vite/Playwright build files as tooling rather than ADS runtime imports.
35
+
36
+ - Batch selected verification scenario roots into one watched graph before parallel
37
+ browser startup. Keep graph handovers pending until a coherent current build
38
+ mounts, preserving selection fencing and avoiding transient startup failures.
39
+ Keep first-visit resources lazy; background peer prefetch follows later edits.
40
+
41
+ - Add `behaviorLibraries`, an explicit project allowlist for installed runtime
42
+ dependencies and subpaths. Enforce it across production ADS source, retaining
43
+ type-only/development and controller skin/framework rules. Require package.json
44
+ dependencies and installation, with actionable lint-config migration messages.
45
+ This is project approval; ADS does not audit third-party source/dependency trees.
46
+ - Report allowed package versions and direct/local-controller usage in MCP status
47
+ and catalog. Preserve existing styling/geometry boundaries and normal sandboxed
48
+ preview bundling. Update design, port and import guidance and the empty starter.
49
+
50
+ - Require a committed local verification stamp in this changelog before release.
51
+ CI verifies its tested commit and source digest instead of repeating the heavy
52
+ browser/package suite. Run the complete suite serially with Bun coverage locally.
53
+
54
+ - Fence cache recording before and after dependency hashing against the compiled
55
+ source revision. An edit during publication cannot make previous output reusable
56
+ for new source. Cover the race with a deterministic regression test.
57
+ - Adopt current checked graph metadata during accepted-edit handover, avoiding a
58
+ second compilation when the watcher still holds previous scenario titles.
59
+ Preserve the full catalogue when reusing partial watched graphs.
60
+ - Allow three minutes for the complete browser workflow with twenty continued
61
+ edits, captures and four dependency acceptances, retaining all assertions and
62
+ reporting each acceptance duration.
63
+
64
+ - Remove synchronous semantic discovery from known draft preview refreshes.
65
+ Refresh metadata in a persistent worker, coalesce revisions and discard stale
66
+ results; discover new identities before selecting them and retain exact-revision
67
+ acceptance checks. Report metadata freshness separately from rendered builds.
68
+ - Show monochrome preview-state glyphs in Explorer entries. Expose draft build
69
+ states in MCP summaries and the parent build resource, with completion/failure
70
+ resource notifications so existing views update without another source edit.
71
+ List active scoped draft build resources and support filtered subscriptions,
72
+ removal invalidation, unsubscribe and reconnect across both MCP protocol eras.
73
+ Serialize overlapping refreshes and detach closed shared observers.
74
+ - Keep stateless HTTP edits on the shared observer instead of treating each new
75
+ request as a source change. Preserve accepted discovery/catalogue caches for
76
+ draft-only edits and reuse revision-fenced metadata for capture updates.
77
+ - Automatically restart only the affected comparison App at its module-revision
78
+ limit, keeping the other version mounted during long draft editing sessions.
79
+ - Refresh draft overlays through file events and immediate MCP edit notifications;
80
+ retain periodic reconciliation for missed events. Queue compiler prewarming
81
+ during creation, coalescing bursts and sharing startup with explicit previews.
82
+ - Reuse TypeScript source trees across preview revisions while refreshing module
83
+ resolution. Compile requested scenario roots in watched graphs; preserve other
84
+ mounted roots and keep full builds/validation complete.
85
+ - Reuse revision-keyed scenario discovery across draft previews, MCP hosts and
86
+ compiler workers. Keep source/tool invalidation and independent validation;
87
+ missing or corrupt generated registry snapshots fall back to fresh discovery.
88
+ Fence explicit catalogue reads against source rather than waiting for polling.
89
+ - Move Explorer draft comparison into ordinary catalogue selection. Enable the
90
+ Split view button for accepted entries with drafts, show new draft owners in
91
+ their normal sections, and remove the separate Drafts tab and scenario picker.
92
+ - Keep owner badges distinct from unchanged overlay review contexts and preserve
93
+ scenario ownership/group metadata when discovering draft-only previews.
94
+
95
+ ## 0.3.33
96
+
97
+ - Add auto-mode tracked drafts with persistent manifests and terminal `.ads`
98
+ source, draft-only MCP discovery, catalogue indicators, exact-revision guarded
99
+ acceptance, Drop and persisted decision events.
100
+ - Reuse isolated preview compilers across ordinary edits without rerunning full
101
+ acceptance checks. Support shared token groups and component → pattern →
102
+ composition draft dependencies that switch automatically to accepted source.
103
+ - Add Explorer's Drafts section and header Split view comparison, using separate
104
+ sandboxed MCP Apps with shared scenario/theme/viewport settings. New scenarios
105
+ without accepted counterparts disable comparison.
106
+ - Capture exact draft revisions through MCP PNG resources, borrowing warm preview
107
+ hosts and keeping draft edits out of accepted catalogue/compiler invalidation.
108
+ Keep shared diagnostic sinks free of per-compiler pipe listeners.
109
+ - Reject production imports of unaccepted drafts, including aliases/symlinks;
110
+ export `draftImportGuard()` and install it in the empty starter's Vite build.
111
+ - Update all distributed design skills to require acceptance before finishing a
112
+ coherent design change, while reporting blocked work as unfinished.
113
+
3
114
  ## 0.3.32
4
115
 
5
116
  - Add a phone-width showcase toggle for components, patterns and compositions.
package/docs/CONTRACTS.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Static owner contracts and development files
2
2
 
3
+ Tracked proposals add the reserved `.ads` source role and `ads-drafts/` directory.
4
+ They are not runtime owners or ordinary scenario/fixture modules. Normal
5
+ discovery excludes them, and import/build guards reject dependencies on them.
6
+ The isolated preview maps proposed source to normal owner paths before analysis
7
+ and compilation. Acceptance uses the same owner contracts and project checks as
8
+ the resulting normal source. See the [draft contract](../skills/ads-designer/references/drafts.md)
9
+ for tracked manifests, token groups, dependency promotion and exact-revision acceptance.
10
+
3
11
  Use one optional `<Owner>.ads.contract.ts` for constrained
4
12
  paint inputs, scoped runtime bindings, declarative parts and behavioral checks.
5
13
  The import `import type { UnitContract } from "@reqvire-org/ads/contracts"` supplies
package/docs/GUIDE.md CHANGED
@@ -1,5 +1,13 @@
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.
10
+
3
11
  ADS is development tooling for a project's local design system. This package
4
12
  contains a Node/Bun CLI, shared token contract, static checks, an Oxlint plugin, and
5
13
  empty foundation scaffolding. It includes no component or pattern catalogue,
@@ -23,11 +31,15 @@ An agent uses the MCP tools to inspect, edit and review the project:
23
31
  3. Open a discovered preview with `ads_show_scenario` or `ads_show_tokens`. These
24
32
  render the project's actual scenario, fixtures and adapter through MCP Apps.
25
33
  Use the returned showcase link when the client cannot render Apps.
26
- 4. When editing is enabled, discover ownership with `ads_units`, read relevant
27
- source through `ads_read_file`, and submit an owner Git patch through
28
- `ads_apply_patch`. Use `ads_apply_transaction` for genuinely coupled owners.
29
- Prepare/diff a local draft with `ads_prepare_patch` when useful. Dry-run first;
30
- ADS checks an isolated candidate before any live source is written.
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.
31
43
  5. Review diagnostics, registered behavior evidence and the rendered result.
32
44
  `ads_behaviors` discovers guarantees; `ads_verify` executes selected registered
33
45
  checks. Recheck `ads_status.build` after changes; notifications alone do not
@@ -854,10 +866,10 @@ Published npm versions cannot be replaced, even by moving or recreating a Git
854
866
  tag; see [npm publishing rules](https://docs.npmjs.com/cli/v11/commands/npm-publish/).
855
867
 
856
868
  Update `package.json` and its lockfile with
857
- `npm version <new-version> --no-git-tag-version --ignore-scripts`, commit and push
858
- those files, then push the matching `v<new-version>` tag. `release.yml` checks
859
- version availability, tests packed npm/Bun installs, publishes the package and
860
- creates the GitHub release. Stable tags publish as `latest`; prerelease tags
869
+ `npm version <new-version> --no-git-tag-version --ignore-scripts`. Follow the
870
+ [local verification and changelog stamp workflow](#releasing-the-ads-tool), then
871
+ push the matching `v<new-version>` tag. `release.yml` checks version availability
872
+ and the committed local proof, packs, publishes and creates the GitHub release. Stable tags publish as `latest`; prerelease tags
861
873
  publish as `next`. Check the workflow result and npm version before updating
862
874
  consumer dependencies. The manual workflow moves a label to an existing
863
875
  published version; it does not publish new source.
@@ -886,3 +898,28 @@ all themes; inspect `literals`/`diagnostics` for raw values, cycles and limits.
886
898
  Choose exact targets/origins and documented geometry exceptions in project code;
887
899
  register the command in `mcp.mutationChecks` and the normal build. ADS owns no
888
900
  universal spacing scale and infers no design meaning from token names.
901
+
902
+ ## Releasing the ADS tool
903
+
904
+ Run the complete tool, browser and packed npm/Bun suite locally before tagging.
905
+ Commit the implementation, documentation and package version first, then run
906
+ `npm run release:verify` with Node, Bun and Chrome available. Tests run serially;
907
+ use an OS memory limit when exercising the full browser/compiler suite. The
908
+ runner forces `ADS_TEST_BUN=1`, rejects failed, cancelled or skipped tests, and
909
+ refuses uncommitted inputs or source changes during the run.
910
+
911
+ A successful run writes a generated verification stamp under the matching
912
+ version in `docs/CHANGELOG.md`. It records the tested implementation commit,
913
+ command, counts, runtimes, completion time, duration, source SHA-256 and log
914
+ SHA-256. The full log remains in `output/local-tests.log`. Commit that stamp
915
+ and tag the resulting commit. Do not hand-author a passing stamp.
916
+
917
+ `npm run release:proof` verifies that the tested commit is an ancestor and its
918
+ source digest matches both the release tree and working inputs. Only generated
919
+ proof blocks and the machine-specific, unpackaged `.mcp.json` launcher are
920
+ excluded from the digest; other tracked changes require another local run.
921
+ Untracked release source must be committed before testing. This is a record of
922
+ trusted local verification, not a signed attestation or a substitute for review.
923
+
924
+ Release CI checks the committed proof, builds and packs the tool, and publishes
925
+ the tagged version with its changelog entry as the release notes. It does not repeat the local browser/package suite.