@reqvire-org/ads 0.0.0-stage → 0.2.9
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.
- package/LICENSE +21 -0
- package/README.md +284 -2
- package/dist/assets.mjs +52 -0
- package/dist/bootstrap-ds/ADS.md +203 -0
- package/dist/bootstrap-ds/README.md +98 -0
- package/dist/bootstrap-ds/biome.css.json +21 -0
- package/dist/bootstrap-ds/design-system/assets/brand/README.md +28 -0
- package/dist/bootstrap-ds/design-system/assets/fonts/.gitkeep +0 -0
- package/dist/bootstrap-ds/design-system/components/.gitkeep +0 -0
- package/dist/bootstrap-ds/design-system/composition/.gitkeep +0 -0
- package/dist/bootstrap-ds/design-system/index.ts +5 -0
- package/dist/bootstrap-ds/design-system/patterns/.gitkeep +0 -0
- package/dist/bootstrap-ds/design-system/showcase/mcp/index.html +1 -0
- package/dist/bootstrap-ds/design-system/showcase/mcp/main.tsx +8 -0
- package/dist/bootstrap-ds/design-system/styles.css +5 -0
- package/dist/bootstrap-ds/design-system/tokens/Foundation.fixture.ts +47 -0
- package/dist/bootstrap-ds/design-system/tokens/Foundation.scenario.tsx +14 -0
- package/dist/bootstrap-ds/design-system/tokens/base.css +27 -0
- package/dist/bootstrap-ds/design-system/tokens/colors.css +29 -0
- package/dist/bootstrap-ds/design-system/tokens/elevation.css +15 -0
- package/dist/bootstrap-ds/design-system/tokens/spacing.css +15 -0
- package/dist/bootstrap-ds/design-system/tokens/typography.css +13 -0
- package/dist/bootstrap-ds/ds.config.json +13 -0
- package/dist/bootstrap-ds/gitignore.template +8 -0
- package/dist/bootstrap-ds/package-lock.json +4660 -0
- package/dist/bootstrap-ds/package.json +41 -0
- package/dist/bootstrap-ds/scripts/build-mcp-previews.mjs +33 -0
- package/dist/bootstrap-ds/src/vite-env.d.ts +7 -0
- package/dist/bootstrap-ds/tsconfig.build.json +12 -0
- package/dist/bootstrap-ds/tsconfig.json +20 -0
- package/dist/bootstrap-ds/vite.config.ts +21 -0
- package/dist/boundaries.mjs +130 -0
- package/dist/brand-assets.mjs +82 -0
- package/dist/check.mjs +222 -0
- package/dist/cli.mjs +106 -0
- package/dist/config.mjs +181 -0
- package/dist/contracts/tokens.json +52 -0
- package/dist/html.mjs +30 -0
- package/dist/index.mjs +9 -0
- package/dist/init.mjs +194 -0
- package/dist/lint-config.mjs +40 -0
- package/dist/mcp/THIRD_PARTY_NOTICES.md +786 -0
- package/dist/mcp/apps.mjs +53 -0
- package/dist/mcp/build-status.mjs +164 -0
- package/dist/mcp/catalog.mjs +65 -0
- package/dist/mcp/context.mjs +69 -0
- package/dist/mcp/mutations.mjs +301 -0
- package/dist/mcp/patch.mjs +114 -0
- package/dist/mcp/preview-watch.mjs +169 -0
- package/dist/mcp/preview-widget.bundle.js +113 -0
- package/dist/mcp/project-widget.bundle.js +113 -0
- package/dist/mcp/prompts.mjs +28 -0
- package/dist/mcp/resource-loader.js +138 -0
- package/dist/mcp/sandbox-host.mjs +22 -0
- package/dist/mcp/server.mjs +377 -0
- package/dist/mcp/showcase-host.mjs +68 -0
- package/dist/mcp/skills.mjs +77 -0
- package/dist/mcp/widget.bundle.js +150 -0
- package/dist/oxlint.mjs +81 -0
- package/dist/preview-resources.mjs +198 -0
- package/dist/project-documents.mjs +27 -0
- package/dist/public-props.mjs +74 -0
- package/dist/scenarios-compiler.mjs +287 -0
- package/dist/scenarios-vite.d.mts +3 -0
- package/dist/scenarios-vite.mjs +71 -0
- package/dist/scenarios.mjs +212 -0
- package/dist/showcase/client.bundle.js +127 -0
- package/dist/showcase/index.html +17 -0
- package/dist/showcase/sandbox.js +30 -0
- package/dist/showcase/style.css +7 -0
- package/dist/showcase-coverage.mjs +118 -0
- package/dist/showcase.mjs +77 -0
- package/dist/skills/README.md +68 -0
- package/dist/skills/ads-assimilate/SKILL.md +292 -0
- package/dist/skills/ads-assimilate/agents/openai.yaml +4 -0
- package/dist/skills/ads-assimilate/references/cli.md +111 -0
- package/dist/skills/ads-assimilate/references/lint-and-docs.md +87 -0
- package/dist/skills/ads-assimilate/references/native-implementation.md +98 -0
- package/dist/skills/ads-assimilate/references/testing.md +107 -0
- package/dist/skills/ads-break-ui/LICENSE.upstream +21 -0
- package/dist/skills/ads-break-ui/README.md +16 -0
- package/dist/skills/ads-break-ui/SKILL.md +235 -0
- package/dist/skills/ads-break-ui/agents/openai.yaml +4 -0
- package/dist/skills/ads-break-ui/references/catalog.md +135 -0
- package/dist/skills/ads-break-ui/references/verification.md +48 -0
- package/dist/skills/ads-designer/LICENSE.upstream +21 -0
- package/dist/skills/ads-designer/README.md +19 -0
- package/dist/skills/ads-designer/SKILL.md +400 -0
- package/dist/skills/ads-designer/agents/openai.yaml +4 -0
- package/dist/skills/ads-designer/assets/bootstrap-ds/ADS.md +203 -0
- package/dist/skills/ads-designer/assets/bootstrap-ds/README.md +98 -0
- package/dist/skills/ads-designer/assets/bootstrap-ds/biome.css.json +21 -0
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/assets/brand/README.md +28 -0
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/assets/fonts/.gitkeep +0 -0
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/components/.gitkeep +0 -0
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/composition/.gitkeep +0 -0
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/index.ts +5 -0
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/patterns/.gitkeep +0 -0
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/showcase/mcp/index.html +1 -0
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/showcase/mcp/main.tsx +8 -0
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/styles.css +5 -0
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/tokens/Foundation.fixture.ts +47 -0
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/tokens/Foundation.scenario.tsx +14 -0
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/tokens/base.css +27 -0
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/tokens/colors.css +29 -0
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/tokens/elevation.css +15 -0
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/tokens/spacing.css +15 -0
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/tokens/typography.css +13 -0
- package/dist/skills/ads-designer/assets/bootstrap-ds/ds.config.json +13 -0
- package/dist/skills/ads-designer/assets/bootstrap-ds/gitignore.template +8 -0
- package/dist/skills/ads-designer/assets/bootstrap-ds/package-lock.json +4660 -0
- package/dist/skills/ads-designer/assets/bootstrap-ds/package.json +41 -0
- package/dist/skills/ads-designer/assets/bootstrap-ds/scripts/build-mcp-previews.mjs +33 -0
- package/dist/skills/ads-designer/assets/bootstrap-ds/src/vite-env.d.ts +7 -0
- package/dist/skills/ads-designer/assets/bootstrap-ds/tsconfig.build.json +12 -0
- package/dist/skills/ads-designer/assets/bootstrap-ds/tsconfig.json +20 -0
- package/dist/skills/ads-designer/assets/bootstrap-ds/vite.config.ts +21 -0
- package/dist/skills/ads-designer/references/cli.md +111 -0
- package/dist/skills/ads-designer/references/design-craft.md +65 -0
- package/dist/skills/ads-designer/references/mobile.md +73 -0
- package/dist/skills/ads-import/SKILL.md +335 -0
- package/dist/skills/ads-import/agents/openai.yaml +4 -0
- package/dist/skills/ads-import/references/branding.md +44 -0
- package/dist/skills/ads-import/references/cli.md +111 -0
- package/dist/skills/ads-import/references/implementation.md +111 -0
- package/dist/skills/ads-import/references/tokens.md +96 -0
- package/dist/skills/ads-motion/LICENSE.upstream +21 -0
- package/dist/skills/ads-motion/README.md +22 -0
- package/dist/skills/ads-motion/SKILL.md +217 -0
- package/dist/skills/ads-motion/agents/openai.yaml +4 -0
- package/dist/skills/ads-motion/references/audit.md +44 -0
- package/dist/skills/ads-motion/references/build.md +81 -0
- package/dist/skills/ads-motion/references/performance.md +55 -0
- package/dist/skills/ads-motion/references/review.md +35 -0
- package/dist/skills/ads-motion/references/verification.md +39 -0
- package/dist/token-policy.mjs +10 -0
- package/dist/tokens.mjs +142 -0
- package/dist/ui-framework.mjs +59 -0
- package/dist/units.mjs +168 -0
- package/docs/ADS.md +310 -0
- package/docs/ARCHITECTURE.md +311 -0
- package/docs/CHANGELOG.md +106 -0
- package/docs/GUIDE.md +722 -0
- package/docs/MCP.md +690 -0
- package/package.json +107 -4
package/docs/MCP.md
ADDED
|
@@ -0,0 +1,690 @@
|
|
|
1
|
+
# ADS over MCP
|
|
2
|
+
|
|
3
|
+
`ads mcp [directory]` serves a project's local design system over stdio. It uses
|
|
4
|
+
the same `ds.config.json`, token inspection and core checks as the CLI. It reads
|
|
5
|
+
source and build artifacts. Optionally it manages one configured project
|
|
6
|
+
preview watcher and serves the built-in browser showcase, so the client needs
|
|
7
|
+
only one launch command. Source editing is disabled by default; `--mutations`
|
|
8
|
+
enables guarded ADS edits. MCP does not install skills or add a production runtime.
|
|
9
|
+
|
|
10
|
+
## Built-in showcase client
|
|
11
|
+
|
|
12
|
+
Starting `ads mcp` automatically serves a loopback showcase. Its URL is printed
|
|
13
|
+
on stderr and returned by `ads_status.showcaseUrl`/`project.showcase.url`.
|
|
14
|
+
The agent keeps its stdio connection; the browser connects to `/mcp` on the same
|
|
15
|
+
runtime using HTTP and the current modern protocol. Both share the configured
|
|
16
|
+
preview watcher and artifacts. Stdout remains exclusively JSON-RPC.
|
|
17
|
+
|
|
18
|
+
For browser-only work, run `ads showcase` inside the project. It starts the same
|
|
19
|
+
runtime without stdio. `--port 4185` selects a port; otherwise the OS chooses an
|
|
20
|
+
available one. `ads mcp --no-showcase` disables the website for headless clients.
|
|
21
|
+
The website binds to 127.0.0.1 and accepts its own origin only. It serves packaged
|
|
22
|
+
client assets and MCP, with no arbitrary file reader or command launcher.
|
|
23
|
+
Shutdown closes both transports, subscriptions and the managed compiler.
|
|
24
|
+
|
|
25
|
+
The shell is minimal: header, section tabs, collapsible left menu, theme switch,
|
|
26
|
+
status/diagnostics when needed, and the App slot. Its MCP client does discovery,
|
|
27
|
+
tool calls, resource forwarding and notification handling. Token categories come
|
|
28
|
+
from `ads_tokens.categories` (discovered token scenarios); all four sections also
|
|
29
|
+
come from the same `ads_scenarios` registry.
|
|
30
|
+
It invokes the selected App tool and uses the official Apps bridge to render its
|
|
31
|
+
HTML in an opaque sandbox. Project UI is never imported into the shell.
|
|
32
|
+
|
|
33
|
+
The built-in client refreshes menus after catalogue changes and automatically
|
|
34
|
+
refreshes the active scenario inside the same reusable App after a current
|
|
35
|
+
successful build. Failed builds show
|
|
36
|
+
file/line diagnostics and identify a retained view as stale. Themes and available
|
|
37
|
+
space flow through host context. Other coding-agent hosts retain their own reload
|
|
38
|
+
policy. A disconnected subscription marks retained output stale and tears down
|
|
39
|
+
App watchers; refresh the page after restarting ADS. Compilation remains necessary for project TSX/Linaria, performed by the
|
|
40
|
+
managed project compiler on demand and after relevant source changes.
|
|
41
|
+
|
|
42
|
+
Switching entries overlays a centered loading spinner, then reveals the new
|
|
43
|
+
scenario inside the existing App. Loading and diagnostic overlays do not move the
|
|
44
|
+
preview. Token presentation comes from project-owned scenarios, fixtures and
|
|
45
|
+
public review patterns, using the project's real foundation CSS and extracted
|
|
46
|
+
styles. The tool contains no token sample templates or named token ordering.
|
|
47
|
+
The generic definition inspector remains available without a scenario build.
|
|
48
|
+
|
|
49
|
+
There are no required browser-page files in the project. Colocated scenarios and
|
|
50
|
+
fixtures, optional public review-layout patterns, and the project's compiler
|
|
51
|
+
entry supply the presentation. Use the existing runtime URL when MCP is connected
|
|
52
|
+
instead of starting a second compiler for that project.
|
|
53
|
+
|
|
54
|
+
## Connect Codex or Claude
|
|
55
|
+
|
|
56
|
+
Use the published package through `npx`. No ADS checkout or global installation
|
|
57
|
+
is needed. Open your client in the project folder containing `ds.config.json`.
|
|
58
|
+
|
|
59
|
+
For **Codex**, add this to the project's `.codex/config.toml`:
|
|
60
|
+
|
|
61
|
+
```toml
|
|
62
|
+
[mcp_servers.ads]
|
|
63
|
+
command = "npx"
|
|
64
|
+
args = ["-y", "@reqvire-org/ads", "mcp"]
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
For **Claude Code**, add this to the project's `.mcp.json`:
|
|
68
|
+
|
|
69
|
+
```json
|
|
70
|
+
{
|
|
71
|
+
"mcpServers": {
|
|
72
|
+
"ads": {
|
|
73
|
+
"command": "npx",
|
|
74
|
+
"args": ["-y", "@reqvire-org/ads", "mcp"]
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Restart/reconnect the client, then ask it to inspect your design system.
|
|
81
|
+
`npx` uses the project's installed ADS version when present, or downloads the
|
|
82
|
+
published package when absent. `-y` prevents an install prompt from blocking
|
|
83
|
+
MCP startup. Node and npm must be available to the client.
|
|
84
|
+
|
|
85
|
+
For **Claude Desktop**, use the same JSON in its MCP configuration and append
|
|
86
|
+
the project path to `args`, since it does not open inside your project:
|
|
87
|
+
`["-y", "@reqvire-org/ads", "mcp", "/absolute/project"]`.
|
|
88
|
+
The same directory argument targets a nested frontend from another working
|
|
89
|
+
directory. ADS reads that project's `ds.config.json`.
|
|
90
|
+
|
|
91
|
+
The client launches the stdio server and its showcase automatically. No separate
|
|
92
|
+
terminal or explorer process is needed. For browser-only inspection, run
|
|
93
|
+
`npx @reqvire-org/ads showcase` inside the project and open the printed URL.
|
|
94
|
+
|
|
95
|
+
These configurations follow [Codex's stdio documentation](https://learn.chatgpt.com/docs/extend/mcp?surface=cli)
|
|
96
|
+
and [Claude's MCP configuration](https://code.claude.com/docs/en/mcp).
|
|
97
|
+
For tool development, use the separate [local linking workflow](GUIDE.md#develop-ads-locally)
|
|
98
|
+
and [diagnostic explorer](../mcp-explorer/README.md).
|
|
99
|
+
|
|
100
|
+
In the ADS checkout, `npm run ads-mcp` builds and starts the local server with
|
|
101
|
+
guarded mutations; `npm run ads-read-mcp` starts it with editing disabled. Both
|
|
102
|
+
also start the showcase and managed preview compiler. Append `-- --port 4191`
|
|
103
|
+
to choose **http://127.0.0.1:4191/**. When a client launches these npm scripts,
|
|
104
|
+
use `npm --silent run ads-mcp` or `npm --silent run ads-read-mcp` to keep stdout
|
|
105
|
+
exclusive to JSON-RPC. Consumer projects use their installed tool; these checkout
|
|
106
|
+
scripts rebuild ADS source first.
|
|
107
|
+
|
|
108
|
+
## Protocol surface
|
|
109
|
+
|
|
110
|
+
Checked against the current [base specification, 2026-07-28](https://modelcontextprotocol.io/specification/2026-07-28),
|
|
111
|
+
the stable [Skills extension](https://github.com/modelcontextprotocol/ext-skills/blob/main/specification/stable/skills.mdx),
|
|
112
|
+
and [Apps revision 2026-01-26](https://github.com/modelcontextprotocol/ext-apps/blob/main/specification/2026-01-26/apps.mdx).
|
|
113
|
+
Skills and Apps are optional negotiated extensions. ADS keeps older protocol paths
|
|
114
|
+
for clients that do not offer those capabilities.
|
|
115
|
+
|
|
116
|
+
| Content | Protocol surface |
|
|
117
|
+
|---------|------------------|
|
|
118
|
+
| Discovery, checks and preview selection | `tools/list`, `tools/call`; small structured results |
|
|
119
|
+
| Source, guides, tokens, build reports, manifests and compiled bytes | `resources/list`, `resources/read`; URI-addressed text or binary content |
|
|
120
|
+
| Packaged agent workflows and their complete file manifests | `skills/list`, `skills/get` on the Skills extension; ordinary resource/tool access on older clients |
|
|
121
|
+
| Skill folders and direct children | `resources/directory/read`, gated by `directoryRead: true`; directory MIME type `inode/directory` |
|
|
122
|
+
| Reusable user-selected workflow messages | `prompts/list`, `prompts/get` |
|
|
123
|
+
| Interactive previews | Tool `_meta.ui.resourceUri` points to a `ui://` HTML App resource; rendering uses the Apps lifecycle and resource bridge |
|
|
124
|
+
| Source/catalogue, build and resource changes | List-change and resource-update notifications; modern `subscriptions/listen`, legacy resource subscriptions |
|
|
125
|
+
|
|
126
|
+
Directory reads cover the packaged skill trees, including references and starter
|
|
127
|
+
assets. They are not an arbitrary project filesystem browser. File manifests
|
|
128
|
+
carry byte sizes and SHA-256 digests; each read returns the advertised snapshot.
|
|
129
|
+
Invalid skill/directory URIs and listing cursors use protocol invalid-parameter
|
|
130
|
+
errors. Expired asset URIs fail as unavailable resources, not successful previews.
|
|
131
|
+
|
|
132
|
+
The server exposes these capabilities; each client chooses its UI, resource
|
|
133
|
+
retrieval, prompt picker and skill activation. The showcase uses the modern
|
|
134
|
+
protocol. The diagnostic explorer defaults to compatible mode; select
|
|
135
|
+
**2026 · native Skills** to test native skill discovery and folder browsing.
|
|
136
|
+
|
|
137
|
+
## Tools and resources
|
|
138
|
+
|
|
139
|
+
### Inspect the design system
|
|
140
|
+
|
|
141
|
+
Call `ads_status` to identify the connected project and preview build state.
|
|
142
|
+
For example, find Button with
|
|
143
|
+
`ads_catalog({ "query": "Button", "kind": "components", "limit": 5 })`, then
|
|
144
|
+
open one of its returned preview IDs with `ads_show_scenario`. Results link to
|
|
145
|
+
the owning source and guides; `ads_scenarios` lists available previews.
|
|
146
|
+
|
|
147
|
+
`ads_tokens` inspects definitions and values. `ads_show_tokens` renders the
|
|
148
|
+
project's token scenarios. If the client cannot render Apps, use the returned
|
|
149
|
+
showcase URL. Build reports identify current, stale and failed output; browser
|
|
150
|
+
review and project checks still verify behavior.
|
|
151
|
+
|
|
152
|
+
The server supplies agent guidance through its instructions, tool descriptions,
|
|
153
|
+
`ads://project/guide` and packaged ADS skills.
|
|
154
|
+
|
|
155
|
+
| Tool | Purpose |
|
|
156
|
+
|------|---------|
|
|
157
|
+
| `ads_status` | Project paths, watcher/build states, preview revisions and diagnostics, skills |
|
|
158
|
+
| `ads_catalog` | Bounded search for real public components/patterns and source/guide URIs |
|
|
159
|
+
| `ads_tokens` | Bounded token-definition and theme inspection |
|
|
160
|
+
| `ads_check` | Current core architectural diagnostics; registered Oxlint/build tests remain separate |
|
|
161
|
+
| `ads_skills` | Workflow names/descriptions without loading instructions |
|
|
162
|
+
| `ads_read_skill` | Explicit text instruction/support-file reads in bounded chunks |
|
|
163
|
+
| `ads_show_tokens` | Render a discovered token scenario; legacy compilers retain the definition inspector |
|
|
164
|
+
| `ads_scenarios` | Bounded token/component/pattern/composition scenario discovery |
|
|
165
|
+
| `ads_show_scenario` | Render an exact discovered scenario with its own fixtures |
|
|
166
|
+
| `ads_show_<id>` | Optional explicitly configured grouped App |
|
|
167
|
+
| `ads_units` | Discover edit owners and the files belonging to one unit |
|
|
168
|
+
| `ads_read_file` | Read bounded source ranges, with owning unit and full-file digest |
|
|
169
|
+
| `ads_apply_patch` | Opt-in Git unified diff for one ADS unit, with dry-run validation |
|
|
170
|
+
|
|
171
|
+
Listings have bounded pages and opaque cursors. The source catalogue exposes
|
|
172
|
+
public exports from `components/` and `patterns/`; it does not execute TSX to
|
|
173
|
+
guess component props. Read the exported API and owning guide. An export name
|
|
174
|
+
alone does not prove that a preview renders that particular element.
|
|
175
|
+
|
|
176
|
+
`ads://project/status`, `/build`, `/tokens`, `/catalog`, `/scenarios`, and `/checks` carry complete JSON
|
|
177
|
+
detail. Allowed project documentation/source and skill files are separate
|
|
178
|
+
resources. No arbitrary filesystem reader is exposed. Prefer bounded tools for
|
|
179
|
+
large catalogues; explicit resource reads can enter model context and a client
|
|
180
|
+
may truncate large payloads.
|
|
181
|
+
|
|
182
|
+
## Guarded editing
|
|
183
|
+
|
|
184
|
+
Enable editing in the MCP launch arguments and reconnect:
|
|
185
|
+
|
|
186
|
+
```sh
|
|
187
|
+
npx -y @reqvire-org/ads mcp --mutations
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
`ads_status.mutations` reports the mode, checks, limits and latest result. Editing
|
|
191
|
+
is disabled by default. The editing tool accepts **one Git unified diff for one
|
|
192
|
+
ADS unit**, not replacement file bodies or a caller-selected batch of owners.
|
|
193
|
+
|
|
194
|
+
Find the owner with `ads_units({ "query": "Button" })`, then request its file
|
|
195
|
+
manifest with `ads_units({ "unit": "components/core/Button" })`. IDs derive from
|
|
196
|
+
the flat/directory colocation convention. A component or pattern unit includes
|
|
197
|
+
its implementation and colocated scenarios, fixtures, tests and guides. A
|
|
198
|
+
composition owns its scenario and mock inputs. Imported components and patterns
|
|
199
|
+
remain separate owners. `tokens` is one foundation unit covering token definitions,
|
|
200
|
+
themes and token scenarios/fixtures, whose coverage spans shared source files.
|
|
201
|
+
Preview IDs remain separate: several token previews belong to `tokens`.
|
|
202
|
+
|
|
203
|
+
The same discovery covers the rest of the project ADS:
|
|
204
|
+
|
|
205
|
+
| Unit | Scope |
|
|
206
|
+
|------|-------|
|
|
207
|
+
| `foundation` | Shared ADS entry styles and root helpers |
|
|
208
|
+
| `documentation` | ADS guides/licenses and the project's README, GUIDE, MCP, Architecture and ADS Markdown guides |
|
|
209
|
+
| `assets/brand`, `assets/fonts`, other `assets/*` groups | Original SVG, image, font and other asset files |
|
|
210
|
+
| `configuration` | `ds.config.json`, package/TypeScript/bundler/lint configuration, registered ADS guard modules, compiler/check entrypoints and their static local dependencies |
|
|
211
|
+
|
|
212
|
+
Configuration ownership follows the project's registrations. It does not absorb
|
|
213
|
+
components merely because a guard or compiler reads them. Guard registration,
|
|
214
|
+
implementation, helpers and the associated check script can change together.
|
|
215
|
+
Unregistered application code and installed dependencies retain their own owners.
|
|
216
|
+
|
|
217
|
+
Read relevant source with `ads_read_file({ "path": "design-system/components/core/Button.tsx" })`.
|
|
218
|
+
Reads are bounded to 12,000 UTF-16 characters. `offset`, `nextOffset`, `startLine`
|
|
219
|
+
and `totalChars` support focused follow-up reads. The digest describes the whole
|
|
220
|
+
file, but the agent does not need to read or send that whole file or supply its
|
|
221
|
+
digest to apply a patch.
|
|
222
|
+
|
|
223
|
+
```json
|
|
224
|
+
{
|
|
225
|
+
"unit": "components/core/Button",
|
|
226
|
+
"dryRun": true,
|
|
227
|
+
"patch": "<Git unified diff for this unit>"
|
|
228
|
+
}
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
Send this to `ads_apply_patch`. Use ordinary `diff --git`, `--- a/path`,
|
|
232
|
+
`+++ b/path` and `@@ -old,count +new,count @@` text hunks with project-relative
|
|
233
|
+
paths. Context and removed lines must match the current source at the stated
|
|
234
|
+
positions; ADS uses no fuzzy matching. `/dev/null` identifies a created or deleted
|
|
235
|
+
file. New files naturally contain their added lines. Original binary images,
|
|
236
|
+
fonts and other assets use `git diff --binary --full-index`; Git 2.29 or newer must be installed
|
|
237
|
+
to validate/apply those blocks. Rename metadata and permission changes are
|
|
238
|
+
unsupported; owned deletion/creation can move a file within its unit.
|
|
239
|
+
|
|
240
|
+
For a large or binary diff, write the Git patch to a regular file in
|
|
241
|
+
`.ds/patches/`, then send a reference instead of its bytes:
|
|
242
|
+
|
|
243
|
+
```json
|
|
244
|
+
{
|
|
245
|
+
"unit": "assets/fonts",
|
|
246
|
+
"dryRun": false,
|
|
247
|
+
"patchFile": ".ds/patches/font.patch"
|
|
248
|
+
}
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
Provide exactly one of `patch` or `patchFile`. This file is a proposed diff,
|
|
252
|
+
not an edit to live ADS source. Binary `ads_read_file` results return the digest and
|
|
253
|
+
byte count without encoded content. Git verifies the original binary blob and
|
|
254
|
+
reconstructs the result inside the validation copy.
|
|
255
|
+
|
|
256
|
+
A small change needs only its hunk. A complete new component may include its
|
|
257
|
+
implementation, public re-export, scenario and fixture in the same unit patch,
|
|
258
|
+
so coverage is checked against a complete candidate. New units use a new
|
|
259
|
+
`components/`, `patterns/` or `composition/` owner ID following the same colocation
|
|
260
|
+
convention. A patch cannot include a peer unit, capture existing peers beneath
|
|
261
|
+
a new directory owner, or change unrelated public-entry statements. Shared
|
|
262
|
+
public-entry changes are limited to re-exports from the selected unit.
|
|
263
|
+
|
|
264
|
+
Set `dryRun` to `false` to apply. ADS reconstructs complete candidate files locally
|
|
265
|
+
and validates a temporary project copy with core guards and registered Oxlint
|
|
266
|
+
rules, including warnings. By default it also runs available `lint:project`
|
|
267
|
+
(or `lint`), `typecheck` and `build:mcp-previews` scripts. Override only that
|
|
268
|
+
additional list through project-owned configuration:
|
|
269
|
+
|
|
270
|
+
```json
|
|
271
|
+
{ "mcp": { "mutationChecks": ["lint", "typecheck", "build:mcp-previews"] } }
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
Every listed script must exist. An empty list still runs mandatory ADS and Oxlint
|
|
275
|
+
checks. Scripts use the project's npm/Bun runner; installed dependencies are
|
|
276
|
+
shared with the validation copy. These are trusted project commands, not an OS
|
|
277
|
+
sandbox. An explicit `configuration` patch can change project commands, registered
|
|
278
|
+
rules and reviewed exceptions; validation runs the proposed configuration and
|
|
279
|
+
scripts. Mandatory core and generated Oxlint checks still run on every write.
|
|
280
|
+
Configuration changes cannot bundle unrelated component edits. Checks that
|
|
281
|
+
rewrite source are rejected. Each command has a 60-second limit; the diagnostic
|
|
282
|
+
explorer allows up to 15 minutes for the complete request.
|
|
283
|
+
|
|
284
|
+
Ordinary source and asset files owned by the selected unit are editable. Generated
|
|
285
|
+
outputs, dependency directories, Git metadata and symlink/hardlink targets are
|
|
286
|
+
excluded. Change original branding artwork; ADS validates generation in the
|
|
287
|
+
candidate and refreshes derived icons after application. Source-level suppression
|
|
288
|
+
directives are rejected outside `configuration`; express reviewed exceptions in
|
|
289
|
+
project settings. The project continues to own its architecture and extensions.
|
|
290
|
+
|
|
291
|
+
One unit patch is limited to 32 entries and 256 KiB inline, or 16 MiB through
|
|
292
|
+
`patchFile`. Each original/resulting file is limited to 16 MiB. Validation snapshots
|
|
293
|
+
are bounded to 20,000 files and 128 MiB, and retain the original project's Git
|
|
294
|
+
tracking checks. Malformed or mismatched patches, changed project inputs and
|
|
295
|
+
cancelled checks leave source unchanged. Write failures roll back applied entries.
|
|
296
|
+
|
|
297
|
+
Acceptance refreshes discovery, generated branding and previews. Configuration
|
|
298
|
+
changes restart the shared managed compiler in place; the MCP connection stays
|
|
299
|
+
open. Failed preview builds report diagnostics and stale output. Inspect current
|
|
300
|
+
build status and real UI; source checks do not establish visual correctness.
|
|
301
|
+
|
|
302
|
+
The mutation tool is marked as a model-only write in Apps metadata. Both browser
|
|
303
|
+
hosts reject App-initiated calls to it; other hosts must respect that visibility.
|
|
304
|
+
MCP enforces this editing path. Direct filesystem edits remain subject to the
|
|
305
|
+
project's normal lint/build gates.
|
|
306
|
+
|
|
307
|
+
## Experimental Apps
|
|
308
|
+
|
|
309
|
+
`ads_scenarios` discovers path-derived IDs for token, component, pattern and
|
|
310
|
+
composition scenarios. `ads_catalog` links public exports to their coverage.
|
|
311
|
+
`ads_show_scenario({id})` selects an independently mountable entry with its own
|
|
312
|
+
fixtures. `ads_show_tokens({category})` selects a discovered token scenario;
|
|
313
|
+
omitting category selects the first token entry. The tool contains no project
|
|
314
|
+
token templates or copied values.
|
|
315
|
+
|
|
316
|
+
### One App, shared resources
|
|
317
|
+
|
|
318
|
+
With the resource compiler enabled, both tools link **`ui://ads/preview`**. Their
|
|
319
|
+
small structured result identifies the selection and current build:
|
|
320
|
+
|
|
321
|
+
```json
|
|
322
|
+
{
|
|
323
|
+
"scenario": { "id": "components/core/Button", "kind": "components" },
|
|
324
|
+
"manifestUri": "ads://preview/manifest",
|
|
325
|
+
"manifestRevision": "<sha256 revision>",
|
|
326
|
+
"build": { "state": "ready", "current": true },
|
|
327
|
+
"showcaseUrl": "http://127.0.0.1:4185/?scenario=components%2Fcore%2FButton"
|
|
328
|
+
}
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
The example omits catalogue/build detail. Executable bytes are not embedded in
|
|
332
|
+
the tool result. `resources/read` supplies these registered resources:
|
|
333
|
+
|
|
334
|
+
| URI | Content and owner |
|
|
335
|
+
|-----|-------------------|
|
|
336
|
+
| `ui://ads/preview` | Tool-owned App bootstrap, official App SDK and resource loader |
|
|
337
|
+
| `ads://preview/manifest` | Project compiler's versioned scenario/dependency graph |
|
|
338
|
+
| `ads://assets/<hash>.js` | Compiled shared runtime or scenario module |
|
|
339
|
+
| `ads://assets/<hash>.css` | Extracted foundation or scenario styles |
|
|
340
|
+
| `ads://assets/<hash>.woff2` (and other asset types) | Binary font/image/worker assets |
|
|
341
|
+
| `ui://ads/previews/<id>` | Same App seeded with that scenario for direct resource access |
|
|
342
|
+
|
|
343
|
+
The manifest has `schemaVersion: 1`, `framework`, `revision`, watcher `session`,
|
|
344
|
+
`scenarios: [{id,title,kind,module}]`, and an `assets` map. Each asset records its
|
|
345
|
+
MIME type, byte size, SHA-256 digest, kind, static imports, dynamic imports, styles
|
|
346
|
+
and asset references. URIs are immutable identities; manifests publish atomically
|
|
347
|
+
after all files exist. The server validates the graph and served bytes. Binary
|
|
348
|
+
resources use MCP `blob` content rather than text encoding.
|
|
349
|
+
|
|
350
|
+
The loader runs **inside the App iframe**. It reads through the host's resource
|
|
351
|
+
bridge, verifies bytes, materializes Blob URLs and native ESM import maps, loads
|
|
352
|
+
CSS/fonts, then invokes the selected module's `mount(container)`. It caches
|
|
353
|
+
unchanged resources and shared runtime modules within that App. Dynamic imports
|
|
354
|
+
load their own dependency closure when invoked. Vite's self-contained worker
|
|
355
|
+
output remains a separate asset; workers must be stopped by their owner.
|
|
356
|
+
The preview adapter uses `worker.format: "iife"`: Chrome rejects module Blob
|
|
357
|
+
worker fetches in opaque origins, so the resource compiler adapts those
|
|
358
|
+
self-contained preview constructors to classic workers. Production worker mode
|
|
359
|
+
is untouched. Worker output with unresolved module imports requires a different
|
|
360
|
+
compiler adapter and is rejected rather than falsely reported ready.
|
|
361
|
+
|
|
362
|
+
The built-in showcase keeps this App alive across selections. It unmounts the
|
|
363
|
+
previous scenario before mounting the next; scenario state resets while runtime
|
|
364
|
+
and unchanged styles/fonts are reused. External hosts may create a fresh App for
|
|
365
|
+
each tool call. Each fresh App loads independently through the same contract.
|
|
366
|
+
There is no special local direct-artifact rendering path.
|
|
367
|
+
|
|
368
|
+
### Host boundary and compatibility
|
|
369
|
+
|
|
370
|
+
The showcase's packaged shell retains its own minimal CSS and navigation. It
|
|
371
|
+
contains no project runtime, fonts, styles or rendered UI. A second loopback
|
|
372
|
+
origin hosts the sandbox proxy; that proxy creates an opaque inner App iframe
|
|
373
|
+
and forwards the standard Apps bridge messages. The diagnostic explorer follows
|
|
374
|
+
the same sandbox model. Only the App materializes and executes project resources.
|
|
375
|
+
|
|
376
|
+
Hosts need Apps support, server resource forwarding, native ESM/import maps and
|
|
377
|
+
a CSP permitting declared `blob:` script/style/font/worker resources. Project
|
|
378
|
+
previews declare no network connections. The host may enforce stricter policy;
|
|
379
|
+
missing capabilities or blocked loads must show an error. Use the returned local
|
|
380
|
+
showcase URL when an external host cannot render the App. Actual local browser
|
|
381
|
+
and native-client evidence is recorded in [compatibility notes](#protocols-notifications-and-compatibility).
|
|
382
|
+
|
|
383
|
+
Host context selects the project's light/dark theme and conveys available space.
|
|
384
|
+
It does not silently replace project tokens/fonts with a host palette.
|
|
385
|
+
Compositions retain the complete project skin. App readiness uses standard Apps
|
|
386
|
+
initialization plus optional structured `ads-preview` logging (`loading`, `ready`,
|
|
387
|
+
`error`); no custom parent-window readiness message is required.
|
|
388
|
+
|
|
389
|
+
### Configure the project compiler
|
|
390
|
+
|
|
391
|
+
```json
|
|
392
|
+
{
|
|
393
|
+
"framework": "react",
|
|
394
|
+
"mcp": {
|
|
395
|
+
"previewManifest": ".ds/preview/manifest.json",
|
|
396
|
+
"previewWatch": {
|
|
397
|
+
"command": "node",
|
|
398
|
+
"args": ["scripts/build-mcp-previews.mjs", "--watch"]
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
```
|
|
403
|
+
|
|
404
|
+
This launches the compiler directly for either npm- or Bun-managed projects.
|
|
405
|
+
The starter adapter selects the runner for validation scripts from the project's
|
|
406
|
+
`packageManager` field or Bun lockfile. Node remains required by ADS.
|
|
407
|
+
|
|
408
|
+
Use `preact` for native Preact and a matching JSX/mount adapter. The project owns
|
|
409
|
+
framework compilation and Linaria extraction. The starter's
|
|
410
|
+
`scripts/build-mcp-previews.mjs` demonstrates the complete integration:
|
|
411
|
+
|
|
412
|
+
- `runScenarioCompiler()` from `@reqvire-org/ads/scenarios/compiler` handles
|
|
413
|
+
scheduling, validation, source freshness, successful caches and build reporting.
|
|
414
|
+
- Its `buildGraph(entries, options, track)` adapter runs one multi-entry Vite build
|
|
415
|
+
with `previewEntriesPlugin()` and `createPreviewResources()` from
|
|
416
|
+
`@reqvire-org/ads/scenarios/vite`.
|
|
417
|
+
- Keep `preserveEntrySignatures: "strict"`, `cssCodeSplit: true`,
|
|
418
|
+
`assetsInlineLimit: 0`, `modulePreload: false`, and `write: false`. Include the
|
|
419
|
+
supplied dependency-tracking plugin and the project's Linaria/framework plugins.
|
|
420
|
+
- `showcase/mcp/main.tsx` exports `mountScenario(Scenario, container)` and returns
|
|
421
|
+
an unmount callback. It imports the same project foundation used in production.
|
|
422
|
+
It creates no App bridge; ADS supplies that bridge once.
|
|
423
|
+
|
|
424
|
+
On first demand, the adapter builds a shared graph for all registered scenarios.
|
|
425
|
+
A selection loads only its static dependency closure. Validation and compilation
|
|
426
|
+
run together; both must succeed before publication. `.ds/preview-cache.json`
|
|
427
|
+
reuses successful validation/output only when inputs, compiler/tool code,
|
|
428
|
+
lockfile, recorded dependencies and content digests match. A source edit
|
|
429
|
+
revalidates and recompiles the graph; Vite shares common modules across entries.
|
|
430
|
+
Normal application builds retain their own chunking and optimization.
|
|
431
|
+
|
|
432
|
+
The graph lives beside the configured manifest, under `assets/`. Tiny
|
|
433
|
+
`.ds/scenarios/<id>/index.html` descriptors retain the reporter/registry contract;
|
|
434
|
+
they are not standalone runnable previews. Six previous graph revisions retain
|
|
435
|
+
old assets for in-flight reads; older references expire with a refresh error.
|
|
436
|
+
An App permits 20 build revisions to bound retained native ESM modules. The
|
|
437
|
+
built-in host then recreates the App automatically; external hosts receive an
|
|
438
|
+
explicit reopen diagnostic. Manifest size is capped at 2 MiB and individual resources
|
|
439
|
+
at 16 MiB; those development transport limits do not alter production bundles.
|
|
440
|
+
|
|
441
|
+
### Existing HTML compilers
|
|
442
|
+
|
|
443
|
+
Missing/null `mcp.previewManifest` retains the older per-scenario self-contained
|
|
444
|
+
HTML contract, `ui://ads/scenario`, and generic `ui://ads/tokens` definition
|
|
445
|
+
inspector. `inlineScenarioHtml()` and the scheduler's `build(entry,...)` adapter
|
|
446
|
+
remain available during migration. The older nested widget requires its declared
|
|
447
|
+
`about:` frame CSP; it does not share runtime modules across scenarios.
|
|
448
|
+
Do not set `previewManifest` until the compiler emits the graph and mount adapter.
|
|
449
|
+
|
|
450
|
+
Explicit `mcp.apps` entries still accept unique lowercase/hyphen IDs, title, kind
|
|
451
|
+
(`components`, `patterns`, `showcase`) and a project-relative self-contained HTML
|
|
452
|
+
file. They remain capped at 2 MiB and do not replace scenario coverage.
|
|
453
|
+
The generic token definition inspector remains available as a resource for source
|
|
454
|
+
and alias diagnostics; `ads_tokens` works even when project previews cannot build.
|
|
455
|
+
|
|
456
|
+
### One client command, managed preview builds
|
|
457
|
+
|
|
458
|
+
`mcp.previewWatch` is optional. When configured, `ads mcp` starts the project's
|
|
459
|
+
watch command on connection/use, once per MCP process. The client configuration
|
|
460
|
+
above stays the same; no second terminal or separately managed server is needed.
|
|
461
|
+
For this checkout, build the tool once and let the client launch:
|
|
462
|
+
|
|
463
|
+
```sh
|
|
464
|
+
npm run build
|
|
465
|
+
node dist/cli.mjs mcp
|
|
466
|
+
```
|
|
467
|
+
|
|
468
|
+
The resource adapter builds a shared graph on demand and rebuilds it after
|
|
469
|
+
source changes, using one compiler process. Apps load selected dependencies. React and native
|
|
470
|
+
Preact projects supply their own build and mount adapters to the same scheduler. The
|
|
471
|
+
[example build](../scripts/build-mcp-previews.mjs) is project glue, excluded from
|
|
472
|
+
the npm tool. Another project uses its own framework/build. ADS supplies no
|
|
473
|
+
component library and does not auto-generate lookalikes. Unconfigured projects
|
|
474
|
+
still get the token widget.
|
|
475
|
+
|
|
476
|
+
The configured command runs in the project root. `command` names an executable;
|
|
477
|
+
`args` is a literal argument array, with no shell parsing. Local
|
|
478
|
+
`node_modules/.bin` and the running Node's directory are added to its PATH.
|
|
479
|
+
Use `node` with a project script for a portable direct launch; Windows `.cmd`
|
|
480
|
+
wrappers require their own launcher and are not shell-executed by ADS.
|
|
481
|
+
|
|
482
|
+
Both build output streams go to stderr, keeping stdout exclusively for MCP.
|
|
483
|
+
Opening an App waits up to 30 seconds for validated current output. A matching
|
|
484
|
+
success cache is republished in the new watcher session without recompilation;
|
|
485
|
+
merely finding an older HTML file is insufficient. A timeout leaves the watcher running: inspect the
|
|
486
|
+
logs and invoke the preview again. `ads_status` distinguishes watcher process
|
|
487
|
+
state from reported build state. Token inspection and other ordinary tools
|
|
488
|
+
remain available after a build failure. An exited watcher needs reconnection;
|
|
489
|
+
an active watcher can recover on the next successful rebuild. Changes to
|
|
490
|
+
`previewWatch`, the compiler adapter or ADS tooling require reconnection to load
|
|
491
|
+
new process code. The shared scheduler rejects publication if its loaded adapter
|
|
492
|
+
files change; normal component, fixture and style edits remain automatic.
|
|
493
|
+
|
|
494
|
+
ADS stops the managed watcher and its compiler subprocesses when stdin closes or
|
|
495
|
+
it receives SIGINT/SIGTERM. The project must keep its watcher in the foreground,
|
|
496
|
+
rather than launching detached background processes. The configuration is
|
|
497
|
+
trusted project setup; MCP tools accept no executable or command arguments.
|
|
498
|
+
To manage builds yourself, omit `previewWatch` or set it to `null`, then run the
|
|
499
|
+
project's existing build/watch command independently.
|
|
500
|
+
|
|
501
|
+
### When a component changes
|
|
502
|
+
|
|
503
|
+
Edit the owned component/pattern and its fixture. The managed watcher rebuilds
|
|
504
|
+
the artifacts when their source changes. It is a child process supervised by
|
|
505
|
+
MCP; the client launches only `ads mcp`. The project's compiler owns extraction
|
|
506
|
+
and rebuilding, while MCP watches the resulting artifacts and serves them.
|
|
507
|
+
|
|
508
|
+
The MCP server detects the new artifact and sends resource-change notifications.
|
|
509
|
+
The built-in host forwards the current selection after a successful build;
|
|
510
|
+
the App reads the new manifest and remounts the scenario. Invoking the preview
|
|
511
|
+
tool again also works in compatible external hosts. The App checks freshness
|
|
512
|
+
every two seconds when notifications are unavailable. Legacy HTML adapters
|
|
513
|
+
retain their own reload behavior.
|
|
514
|
+
No ADS package release or skill reinstall is needed for project component changes.
|
|
515
|
+
|
|
516
|
+
### When code or styles break
|
|
517
|
+
|
|
518
|
+
A preview publisher reports `building`, `ready` or `error` to
|
|
519
|
+
`.ds/build-status.json`. `ads_status.build` and the `ads://project/build` resource
|
|
520
|
+
expose those states, each preview's build revision, last successful revision,
|
|
521
|
+
availability, freshness and diagnostics. Diagnostic positions are one-based.
|
|
522
|
+
Tool summaries include the first three diagnostics per preview, capped at 1,000
|
|
523
|
+
characters each, with counts and truncation flags; the build resource retains
|
|
524
|
+
the complete bounded report.
|
|
525
|
+
A watcher session separates revisions across restarts, and an artifact digest
|
|
526
|
+
checks that the served output matches the reported successful build.
|
|
527
|
+
|
|
528
|
+
On each status transition MCP sends `notifications/resources/updated` to build
|
|
529
|
+
resource subscribers. Legacy connections use `resources/subscribe`; modern
|
|
530
|
+
connections use the SDK's `subscriptions/listen`. The notification identifies
|
|
531
|
+
the resource to read; it does not carry the diagnostics. This follows the
|
|
532
|
+
[resource subscription contract](https://modelcontextprotocol.io/specification/2025-11-25/server/resources#subscriptions).
|
|
533
|
+
An unchanged resource catalogue needs no list-change notification for a build
|
|
534
|
+
status update. The host controls whether a notification starts an agent turn.
|
|
535
|
+
|
|
536
|
+
Preview tools wait while a reported build is pending. A reported failure returns
|
|
537
|
+
`isError: true`, readable file/line messages and structured build diagnostics,
|
|
538
|
+
including the build resource URI. Scenario-specific App resources also refuse a
|
|
539
|
+
failed build even when older output remains on disk. The reusable bootstrap and
|
|
540
|
+
retained immutable assets stay readable so an existing App can report freshness;
|
|
541
|
+
readability alone does not establish a current preview. After a successful rebuild the same
|
|
542
|
+
tool works again without restarting MCP. If the watcher itself exits, its
|
|
543
|
+
failure is reported and the client must reconnect after fixing the command.
|
|
544
|
+
|
|
545
|
+
Already-mounted Apps show rebuilding, failure or a newer available revision
|
|
546
|
+
when the host permits server resource reads. They check build status every two
|
|
547
|
+
seconds and stop on teardown. Resource Apps automatically mount a new successful
|
|
548
|
+
graph without replacing their iframe; failed builds leave the earlier view marked
|
|
549
|
+
stale. The built-in host recreates the App after its retained-module limit. Other hosts can also reinvoke the tool or reload the App. Token source
|
|
550
|
+
inspection is independent of component build failures.
|
|
551
|
+
|
|
552
|
+
Builders without status reporting remain usable, with freshness explicitly
|
|
553
|
+
`unreported` (`current: false`, `stale: null`). A running process or an existing
|
|
554
|
+
HTML file is not proof of current source. `ads_check` separately reports source/CSS
|
|
555
|
+
syntax and architecture violations. Typechecks, behavior tests and browser
|
|
556
|
+
review still cover runtime exceptions, incorrect layout and motion. MCP does
|
|
557
|
+
not repair source automatically.
|
|
558
|
+
|
|
559
|
+
### Custom builder integration (advanced)
|
|
560
|
+
|
|
561
|
+
The standard graph adapter already uses this reporter through
|
|
562
|
+
`runScenarioCompiler`; use [the compiler setup](#configure-the-project-compiler)
|
|
563
|
+
for that path. Custom builders can integrate the framework-independent reporter
|
|
564
|
+
with their own publication step. A selective HTML builder, for example, uses one
|
|
565
|
+
shared reporter for the compiler process:
|
|
566
|
+
|
|
567
|
+
```js
|
|
568
|
+
import { createBuildReporter } from "@reqvire-org/ads/mcp/build";
|
|
569
|
+
import { loadConfig } from "@reqvire-org/ads";
|
|
570
|
+
|
|
571
|
+
import { inspectScenarios } from "@reqvire-org/ads/scenarios";
|
|
572
|
+
// loadConfig is also exported by @reqvire-org/ads.
|
|
573
|
+
const { scenarios } = inspectScenarios(loadConfig(process.cwd()));
|
|
574
|
+
const reports = createBuildReporter(process.cwd(), {
|
|
575
|
+
apps: scenarios.map(entry => ({ id: entry.id, file: entry.artifact })),
|
|
576
|
+
});
|
|
577
|
+
|
|
578
|
+
async function rebuild(entry) {
|
|
579
|
+
const revision = reports.begin(entry.id);
|
|
580
|
+
try {
|
|
581
|
+
await buildProjectPreview(entry); // project-owned compilation, extraction and checks
|
|
582
|
+
reports.ready(entry.id, revision); // only after writing complete output
|
|
583
|
+
} catch (error) {
|
|
584
|
+
reports.error(entry.id, revision, error);
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
```
|
|
588
|
+
|
|
589
|
+
For selective builds, MCP also supplies `ADS_MCP_REQUEST_FILE`: an atomically
|
|
590
|
+
updated JSON file `{session, active, files: [project-relative artifact paths]}`.
|
|
591
|
+
`active` is the most recently selected artifact path; prioritize it when draining
|
|
592
|
+
affected builds. The shared scheduler handles this. Custom builders may ignore
|
|
593
|
+
that optional field. Watch/read
|
|
594
|
+
it, validate the session against `ADS_MCP_BUILD_SESSION`, and match paths against
|
|
595
|
+
the discovered registry before building. Newly requested paths need a build;
|
|
596
|
+
source changes invalidate and rebuild requested entries. A builder that compiles
|
|
597
|
+
all entries may ignore this request file. It is removed when MCP stops.
|
|
598
|
+
|
|
599
|
+
ADS provides `ADS_MCP_BUILD_SESSION` and `ADS_MCP_BUILD_STATUS` to a managed child;
|
|
600
|
+
the reporter uses them automatically. Standalone builders use the same project
|
|
601
|
+
file and a new session. Updates are atomic and bounded to 256 KiB, with at most
|
|
602
|
+
20 diagnostics per preview. The builder must report failures from its checks as
|
|
603
|
+
well as its compiler. Call `begin` when source is invalidated, and capture a
|
|
604
|
+
separate revision for each actual build; a completion from an older revision
|
|
605
|
+
cannot clear a newer invalidation or error.
|
|
606
|
+
|
|
607
|
+
This checkout's [Vite example](../scripts/build-mcp-previews.mjs) reports initial and
|
|
608
|
+
incremental builds, compiler/output errors and immediate invalidation. Another
|
|
609
|
+
project wires the reporter into its existing build hooks; ADS does not infer
|
|
610
|
+
success from free-form console output or install another compiler.
|
|
611
|
+
|
|
612
|
+
Invoke an App's entry **tool** to ask a capable host to render it. Reading its
|
|
613
|
+
HTML resource is a data read, not evidence of a rendered view. When Apps are
|
|
614
|
+
unavailable, tool results provide a bounded descriptor and the runtime's
|
|
615
|
+
showcase URL. The same MCP process already serves that website, unless started
|
|
616
|
+
with `--no-showcase`.
|
|
617
|
+
See the [MCP Apps specification](https://github.com/modelcontextprotocol/ext-apps/blob/main/specification/2026-01-26/apps.mdx).
|
|
618
|
+
|
|
619
|
+
## Prompts
|
|
620
|
+
|
|
621
|
+
| Prompt | Required argument | Use |
|
|
622
|
+
|--------|-------------------|-----|
|
|
623
|
+
| `ads-design` | `request` | Plan and implement a project-owned ADS change |
|
|
624
|
+
| `ads-inspect` | `element` | Discover an existing element, its API and relevant view |
|
|
625
|
+
| `ads-show` | `target` | Choose tokens or an exact discovered scenario ID |
|
|
626
|
+
| Each of the five ADS skill names | `request` | Select that workflow and its skill resource |
|
|
627
|
+
|
|
628
|
+
Example: get `ads-inspect` with `element="Button states in both themes"`, or
|
|
629
|
+
`ads-assimilate` with `request` containing the upstream component-library URL.
|
|
630
|
+
Prompts explain Data/UX/Skin ownership, public API reuse, fixture boundaries,
|
|
631
|
+
which tools select widgets, progressive skill reads and validation. They guide
|
|
632
|
+
reasoning rather than inventing another component implementation.
|
|
633
|
+
|
|
634
|
+
Hosts choose whether prompt pickers/methods reach the agent. If unavailable,
|
|
635
|
+
the agent can use the same tools and selected skill resources directly. Prompt
|
|
636
|
+
retrieval itself does not execute the workflow or change project files.
|
|
637
|
+
|
|
638
|
+
## Skills
|
|
639
|
+
|
|
640
|
+
The npm distribution includes the five ADS skills, references, empty designer
|
|
641
|
+
scaffold, credits and upstream notices. Each `skill://ads/<name>/SKILL.md` has
|
|
642
|
+
a complete manifest of file URIs, UTF-8 byte lengths and SHA-256 digests.
|
|
643
|
+
Supporting files are read lazily via `resources/read`; directory browsing is
|
|
644
|
+
available on the newer protocol. The packaged scaffold's `.gitignore` remains
|
|
645
|
+
addressable at its original resource URI.
|
|
646
|
+
|
|
647
|
+
On protocol `2026-07-28`, discovery advertises `io.modelcontextprotocol/skills`
|
|
648
|
+
with directory reading and implements `skills/list`, `skills/get`, and
|
|
649
|
+
`resources/directory/read`. Older connections retain ordinary skill resources,
|
|
650
|
+
`ads_skills` and `ads_read_skill`; their metadata listing does not pretend to be
|
|
651
|
+
native skill activation. Relative references resolve from the skill URI.
|
|
652
|
+
|
|
653
|
+
The host controls integrity verification, user approval and activation. Reading
|
|
654
|
+
`SKILL.md` through ordinary resources/tools does not prove activation. Local
|
|
655
|
+
installation with `npx skills` remains supported independently. See the
|
|
656
|
+
[Skills extension specification](https://github.com/modelcontextprotocol/ext-skills/blob/main/specification/stable/skills.mdx).
|
|
657
|
+
|
|
658
|
+
## Protocols, notifications and compatibility
|
|
659
|
+
|
|
660
|
+
The same SDK server factory serves `2024-11-05`, `2025-03-26`, `2025-06-18` and
|
|
661
|
+
`2025-11-25` through the initialize lifecycle, and `2026-07-28` through modern
|
|
662
|
+
discovery/per-request metadata. An older client is not forced onto the modern
|
|
663
|
+
protocol. Apps use their separate `2026-01-26` UI handshake.
|
|
664
|
+
|
|
665
|
+
Project source changes invalidate catalogue caches and notify resource
|
|
666
|
+
list/read subscribers. Artifact and build-status changes notify preview/build
|
|
667
|
+
subscribers without rediscovering unchanged source. Configured preview changes
|
|
668
|
+
also notify the tool catalog.
|
|
669
|
+
Publishing a changed asset catalogue also sends a resource-list notification;
|
|
670
|
+
status-only transitions with unchanged resource identities need only updates.
|
|
671
|
+
The server polls file metadata once a second, so replaced files and newly added
|
|
672
|
+
directories are detected. On modern connections, notifications use the SDK's
|
|
673
|
+
`subscriptions/listen`; legacy clients retain list-change and subscribed-resource
|
|
674
|
+
notifications. Hosts may require a manual refresh. The older generic definition
|
|
675
|
+
inspector also provides an explicit Refresh action; project token scenarios
|
|
676
|
+
supply their own controls.
|
|
677
|
+
|
|
678
|
+
Client support varies by product and version. Ordinary tools and resources
|
|
679
|
+
remain available without Apps or native Skills support. ADS uses bounded tool
|
|
680
|
+
results and separate resource reads; previews also return showcase links for
|
|
681
|
+
clients without Apps. Native Skills support is optional.
|
|
682
|
+
|
|
683
|
+
Automated tests verify both protocol eras, resource/skill integrity, prompt
|
|
684
|
+
retrieval, bounded tools, initial preview readiness, managed rebuilds, process
|
|
685
|
+
cleanup and resource notifications. SDK and
|
|
686
|
+
browser-host tests are distinct from a real Codex/Claude session. In a new host,
|
|
687
|
+
verify tools, explicit resources, an App entry tool and its UI handshake,
|
|
688
|
+
Refresh/theme behavior, notifications, prompts, then native Skills separately.
|
|
689
|
+
Record the client build and negotiated protocol; HTML delivery or ordinary
|
|
690
|
+
instruction reads alone do not establish Apps/Skills activation.
|