@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
@@ -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
@@ -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.
@@ -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
 
@@ -256,6 +282,10 @@ style ownership, documentation, and verification. Copy selected items and needed
256
282
  helpers/styles/assets into the matching target layers. Reuse target dependencies
257
283
  only after checking compatible APIs and behavior. Merge only necessary external
258
284
  dependencies and build support; keep the target's framework and unrelated scripts.
285
+ When selected items use an external behavior package, confirm authorization to add
286
+ it to the destination's `behaviorLibraries` and `package.json` dependencies, reusing
287
+ an existing compatible installation. Do not ask again when that choice is already
288
+ authorized. Preserve the installed library API; ADS's style/geometry rules still apply.
259
289
 
260
290
  Preserve interaction, accessibility, lifecycle, gestures, and animation mechanics.
261
291
  Rewrite paths, token references, and exports as required by the integration. A different
@@ -21,6 +21,16 @@ UI references are allowed, but shared controllers cannot import component/patter
21
21
  runtime implementations. Keep business data in application adapters. Measured
22
22
  style writes retain exact `boundaries.styleWrites` properties; they do not allow
23
23
  shared-token overrides or an extra styling layer.
24
+ Projects explicitly approve installed runtime packages through
25
+ `behaviorLibraries` in `ds.config.json`; each must also be a `package.json`
26
+ dependency. Components, patterns and controllers may use them directly, including
27
+ package subpaths. Extract a shared controller when behavior is shared. Type-only
28
+ and development-role imports retain their existing rules. An empty/missing list
29
+ allows no additional runtime packages beyond the configured framework and Linaria.
30
+ ADS checks declarations and installed versions, not third-party source or
31
+ transitive dependency trees. The preview build bundles used code normally inside
32
+ the MCP App sandbox. Existing project styling and measured-geometry guards keep
33
+ their scope; declaration creates no broad style-write permissions.
24
34
  These gates inspect supported direct imports, markup and style boundaries.
25
35
  External package internals and delegated DOM behavior still require source,
26
36
  build and browser review; declaring a dependency does not prove it is headless.
@@ -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,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
@@ -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.
@@ -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
 
@@ -21,6 +21,16 @@ UI references are allowed, but shared controllers cannot import component/patter
21
21
  runtime implementations. Keep business data in application adapters. Measured
22
22
  style writes retain exact `boundaries.styleWrites` properties; they do not allow
23
23
  shared-token overrides or an extra styling layer.
24
+ Projects explicitly approve installed runtime packages through
25
+ `behaviorLibraries` in `ds.config.json`; each must also be a `package.json`
26
+ dependency. Components, patterns and controllers may use them directly, including
27
+ package subpaths. Extract a shared controller when behavior is shared. Type-only
28
+ and development-role imports retain their existing rules. An empty/missing list
29
+ allows no additional runtime packages beyond the configured framework and Linaria.
30
+ ADS checks declarations and installed versions, not third-party source or
31
+ transitive dependency trees. The preview build bundles used code normally inside
32
+ the MCP App sandbox. Existing project styling and measured-geometry guards keep
33
+ their scope; declaration creates no broad style-write permissions.
24
34
  These gates inspect supported direct imports, markup and style boundaries.
25
35
  External package internals and delegated DOM behavior still require source,
26
36
  build and browser review; declaring a dependency does not prove it is headless.
@@ -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,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
@@ -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.
@@ -1,8 +1,34 @@
1
1
  ---
2
2
  name: ads-port
3
- description: "Port existing library components into a coherent project-owned ADS, reusing shared tokens and primitives while preserving required behavior. Use for native adaptation from a library URL, with reference comparison and provenance; not dependency installation or wrapping."
3
+ description: "Port existing library components into a coherent project-owned ADS, reusing shared tokens and primitives while preserving required behavior. Use for native adaptation from a library URL, with reference comparison and provenance; reuse explicitly declared behavior libraries as installed."
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
 
@@ -99,6 +125,13 @@ matching-property fixes, plus the build resolver for preserving opaque custom
99
125
  properties through extraction. Review warnings in the real `cx` composition and verify
100
126
  computed styles across affected sizes/states; retain intentional product behavior.
101
127
 
128
+ For positioning, menu/listbox keyboard handling, focus trapping and virtual lists,
129
+ prefer an installed library already listed in `ds.config.json` behaviorLibraries.
130
+ Use the installed API with minimal lifecycle/event integration and project-owned
131
+ styling; preserve the existing measured-geometry boundaries. If none fits, suggest
132
+ a framework-free package for approval or port natively. Add dependencies and
133
+ allowlist entries only with authorization; existing approval need not be repeated.
134
+
102
135
  Controllers are UI behavior owners: private helpers stay with their component or
103
136
  pattern; reusable controllers use discovered `controllers/<Name>` units. Use the
104
137
  project's configured framework and declared dependencies, or plain TypeScript,
@@ -21,6 +21,16 @@ UI references are allowed, but shared controllers cannot import component/patter
21
21
  runtime implementations. Keep business data in application adapters. Measured
22
22
  style writes retain exact `boundaries.styleWrites` properties; they do not allow
23
23
  shared-token overrides or an extra styling layer.
24
+ Projects explicitly approve installed runtime packages through
25
+ `behaviorLibraries` in `ds.config.json`; each must also be a `package.json`
26
+ dependency. Components, patterns and controllers may use them directly, including
27
+ package subpaths. Extract a shared controller when behavior is shared. Type-only
28
+ and development-role imports retain their existing rules. An empty/missing list
29
+ allows no additional runtime packages beyond the configured framework and Linaria.
30
+ ADS checks declarations and installed versions, not third-party source or
31
+ transitive dependency trees. The preview build bundles used code normally inside
32
+ the MCP App sandbox. Existing project styling and measured-geometry guards keep
33
+ their scope; declaration creates no broad style-write permissions.
24
34
  These gates inspect supported direct imports, markup and style boundaries.
25
35
  External package internals and delegated DOM behavior still require source,
26
36
  build and browser review; declaring a dependency does not prove it is headless.
@@ -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