@reqvire-org/ads 0.3.27 → 0.3.29
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/dist/atomic-composition.mjs +2 -1
- package/dist/behaviors.mjs +2 -2
- package/dist/bootstrap-ds/scripts/build-mcp-previews.mjs +6 -7
- package/dist/boundaries.mjs +6 -3
- package/dist/check.mjs +3 -0
- package/dist/cli.mjs +13 -0
- package/dist/config.mjs +5 -3
- package/dist/mcp/build-status.mjs +17 -4
- package/dist/mcp/context.mjs +2 -1
- package/dist/mcp/execution-results.mjs +4 -3
- package/dist/mcp/mutations.mjs +5 -43
- package/dist/mcp/preview-watch.mjs +23 -3
- package/dist/mcp/preview-widget.bundle.js +16 -15
- package/dist/mcp/project-widget.bundle.js +13 -13
- package/dist/mcp/resource-loader.js +50 -13
- package/dist/mcp/server.mjs +81 -39
- package/dist/oxlint.mjs +6 -1
- package/dist/preview-builder.mjs +114 -0
- package/dist/preview-inputs.mjs +8 -1
- package/dist/preview-resources.mjs +11 -4
- package/dist/preview-scope.mjs +6 -0
- package/dist/preview-workers.mjs +184 -0
- package/dist/scenario-groups.mjs +47 -0
- package/dist/scenario-inspector.mjs +34 -0
- package/dist/scenario-trace.mjs +3 -2
- package/dist/scenarios-compiler.mjs +203 -27
- package/dist/scenarios-vite.mjs +13 -5
- package/dist/scenarios.mjs +4 -1
- package/dist/showcase/client.bundle.js +23 -22
- package/dist/showcase/index.html +2 -2
- package/dist/showcase/navigation.js +13 -0
- package/dist/showcase/style.css +3 -1
- package/dist/skills/ads-break-ui/SKILL.md +4 -1
- package/dist/skills/ads-break-ui/references/runtimes.md +48 -0
- package/dist/skills/ads-break-ui/references/scenarios.md +19 -0
- package/dist/skills/ads-break-ui/references/validation.md +53 -0
- package/dist/skills/ads-designer/SKILL.md +4 -1
- package/dist/skills/ads-designer/assets/bootstrap-ds/scripts/build-mcp-previews.mjs +6 -7
- package/dist/skills/ads-designer/references/runtimes.md +48 -0
- package/dist/skills/ads-designer/references/scenarios.md +19 -0
- package/dist/skills/ads-designer/references/validation.md +53 -0
- package/dist/skills/ads-import/SKILL.md +4 -1
- package/dist/skills/ads-import/references/runtimes.md +48 -0
- package/dist/skills/ads-import/references/scenarios.md +19 -0
- package/dist/skills/ads-import/references/validation.md +53 -0
- package/dist/skills/ads-motion/SKILL.md +4 -1
- package/dist/skills/ads-motion/references/runtimes.md +48 -0
- package/dist/skills/ads-motion/references/scenarios.md +19 -0
- package/dist/skills/ads-motion/references/validation.md +53 -0
- package/dist/skills/ads-port/SKILL.md +4 -1
- package/dist/skills/ads-port/references/runtimes.md +48 -0
- package/dist/skills/ads-port/references/scenarios.md +19 -0
- package/dist/skills/ads-port/references/validation.md +53 -0
- package/dist/source-symbols.mjs +11 -0
- package/dist/source-values.mjs +10 -3
- package/dist/test-boundaries.mjs +95 -0
- package/dist/ui-framework.mjs +2 -1
- package/dist/units.mjs +12 -1
- package/dist/validation-checks.mjs +50 -0
- package/dist/validation.mjs +172 -0
- package/dist/verification/browser.mjs +3 -1
- package/dist/verification.mjs +1 -0
- package/docs/ADS.md +12 -2
- package/docs/ARCHITECTURE.md +125 -7
- package/docs/BEHAVIORS.md +7 -0
- package/docs/CHANGELOG.md +54 -0
- package/docs/GUIDE.md +31 -0
- package/docs/MCP.md +127 -16
- package/package.json +1 -1
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { createHash, randomUUID } from "node:crypto";
|
|
2
|
+
import { existsSync, lstatSync, mkdirSync, readFileSync, readdirSync, realpathSync, renameSync, rmSync, writeFileSync } from "node:fs";
|
|
3
|
+
import { createRequire } from "node:module";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
import { fileURLToPath } from "node:url";
|
|
6
|
+
import { checkProject } from "./check.mjs";
|
|
7
|
+
import { loadConfig, isInside } from "./config.mjs";
|
|
8
|
+
import { createLintConfig } from "./lint-config.mjs";
|
|
9
|
+
import { inspectUnits } from "./units.mjs";
|
|
10
|
+
import { inspectBehaviors } from "./behaviors.mjs";
|
|
11
|
+
import { affectedBehaviorUnits, createVerificationController } from "./verification.mjs";
|
|
12
|
+
import { previewFileIgnored } from "./preview-files.mjs";
|
|
13
|
+
import { checkCommand, projectChecks } from "./validation-checks.mjs";
|
|
14
|
+
import { projectContext } from "./mcp/context.mjs";
|
|
15
|
+
import { packageScriptCommand } from "./development-runtime.mjs";
|
|
16
|
+
import { acceptance } from "./evidence.mjs";
|
|
17
|
+
import { inspectScenarios } from "./scenarios.mjs";
|
|
18
|
+
import { inspectBuildStatus } from "./mcp/build-status.mjs";
|
|
19
|
+
|
|
20
|
+
const hash = value => createHash("sha256").update(value).digest("hex");
|
|
21
|
+
function toolInputs() {
|
|
22
|
+
const root=path.dirname(fileURLToPath(import.meta.url)),rows=[];
|
|
23
|
+
function visit(directory){for(const entry of readdirSync(directory,{withFileTypes:true}).sort((a,b)=>a.name.localeCompare(b.name))){const file=path.join(directory,entry.name);if(entry.isDirectory()&&!["skills","bootstrap-ds","showcase"].includes(entry.name))visit(file);else if(entry.isFile()&&/\.(?:mjs|js|cjs|json)$/.test(file))rows.push([path.relative(root,file),hash(readFileSync(file))]);}}
|
|
24
|
+
visit(root);return rows;
|
|
25
|
+
}
|
|
26
|
+
const toolRevision = hash(JSON.stringify([toolInputs(),process.versions.bun??process.version,process.platform,process.arch]));
|
|
27
|
+
const ignored = new Set(["test-results", "playwright-report", ".playwright-cli", "output"]);
|
|
28
|
+
|
|
29
|
+
/** One content inventory includes new/deleted tests and source outside ADS roots. */
|
|
30
|
+
export function validationInputs(options) {
|
|
31
|
+
const files = {};
|
|
32
|
+
function walk(directory) {
|
|
33
|
+
for (const entry of readdirSync(directory, { withFileTypes: true }).sort((a,b) => a.name.localeCompare(b.name))) {
|
|
34
|
+
const file = path.join(directory, entry.name);
|
|
35
|
+
if (ignored.has(entry.name) || previewFileIgnored(options, file) || entry.name.endsWith(".tsbuildinfo")) continue;
|
|
36
|
+
if (entry.isSymbolicLink()) throw new Error(`Validation source cannot be a symlink: ${path.relative(options.root,file)}`);
|
|
37
|
+
if (entry.isDirectory()) walk(file);
|
|
38
|
+
else if (entry.isFile()) files[path.relative(options.root,file).replaceAll("\\", "/")] = hash(readFileSync(file));
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
walk(options.root);
|
|
42
|
+
const installed = path.join(options.root,"node_modules/.package-lock.json");
|
|
43
|
+
files["node_modules/.package-lock.json"] = existsSync(installed) ? hash(readFileSync(installed)) : null;
|
|
44
|
+
return { files, revision: hash(JSON.stringify([toolRevision,files])) };
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function outputFile(root, name) {
|
|
48
|
+
const folder = path.join(root,".ds");
|
|
49
|
+
if (existsSync(folder) && realpathSync(folder) !== folder) throw new Error("Validation output cannot resolve through a symlink.");
|
|
50
|
+
mkdirSync(folder,{recursive:true});
|
|
51
|
+
return path.join(folder,name);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export function createValidationController(directory) {
|
|
55
|
+
const root = path.resolve(directory);
|
|
56
|
+
let active, progress;
|
|
57
|
+
return {
|
|
58
|
+
status() { return { busy: !!active, ...(progress ? {progress} : {}) }; },
|
|
59
|
+
async close() { const pending = active; pending?.abort(); await pending?.completion; },
|
|
60
|
+
async run({scope = "all"} = {}, signal, onProgress) {
|
|
61
|
+
if (!["all","changed"].includes(scope)) throw new Error("Validation scope must be all or changed.");
|
|
62
|
+
if (active) throw new Error("Validation is already running.");
|
|
63
|
+
active = new AbortController();
|
|
64
|
+
const controller = active;
|
|
65
|
+
signal = signal ? AbortSignal.any([signal,controller.signal]) : controller.signal;
|
|
66
|
+
let finish; controller.completion = new Promise(resolve => { finish = resolve; });
|
|
67
|
+
const startedAt = Date.now(), checks = [], diagnostics = [], advisories = [], results = [];
|
|
68
|
+
const requestedScope = scope;
|
|
69
|
+
let inputs, changed = [], units = [], fallback;
|
|
70
|
+
function stage(name) { signal.throwIfAborted(); progress = {stage:name,elapsedMs:Date.now()-startedAt,completed:checks.length}; onProgress?.(progress); }
|
|
71
|
+
async function command(name, launch, options) {
|
|
72
|
+
stage(name);
|
|
73
|
+
try { const result = await checkCommand(launch.command, launch.args, root, signal, undefined, {category:"build",phase:name}, options.config.mcp.mutationCheckTimeoutMs); checks.push({name,...result}); }
|
|
74
|
+
catch (error) { checks.push({name,passed:false}); throw error; }
|
|
75
|
+
}
|
|
76
|
+
try {
|
|
77
|
+
const options = loadConfig(root);
|
|
78
|
+
inputs = validationInputs(options);
|
|
79
|
+
const baselineFile = outputFile(root,"validation-baseline.json");
|
|
80
|
+
if (scope === "changed") {
|
|
81
|
+
let baseline;
|
|
82
|
+
try { if (realpathSync(baselineFile) === baselineFile && lstatSync(baselineFile).size < 8*1024*1024) baseline = JSON.parse(readFileSync(baselineFile,"utf8")); } catch { /* No trusted baseline: perform the complete audit. */ }
|
|
83
|
+
if (baseline?.schemaVersion !== 1 || baseline.root !== root || baseline.toolRevision !== toolRevision || !baseline.files || hash(JSON.stringify([toolRevision,baseline.files])) !== baseline.revision) fallback = "No compatible successful full-validation baseline.";
|
|
84
|
+
else {
|
|
85
|
+
changed = [...new Set([...Object.keys(inputs.files),...Object.keys(baseline.files)])].filter(file => inputs.files[file] !== baseline.files[file]);
|
|
86
|
+
const inventory = inspectUnits(options);
|
|
87
|
+
if (changed.some(file => {
|
|
88
|
+
const owner=inventory.owner(inventory.relative(file));
|
|
89
|
+
return !isInside(options.dsRoot,path.join(root,file)) && !isInside(options.sourceRoot,path.join(root,file)) || [null,"configuration","foundation","tokens"].includes(owner) || !inventory.units.some(unit=>unit.id===owner);
|
|
90
|
+
})) fallback = "Configuration, foundation, deleted ownership or unclassified inputs changed.";
|
|
91
|
+
}
|
|
92
|
+
if (fallback) scope = "all";
|
|
93
|
+
}
|
|
94
|
+
stage("architecture");
|
|
95
|
+
const core = checkProject(root);
|
|
96
|
+
diagnostics.push(...core.diagnostics); advisories.push(...(core.advisories ?? []));
|
|
97
|
+
checks.push({name:"architecture",passed:core.ok});
|
|
98
|
+
if (!core.ok) return complete();
|
|
99
|
+
const pkg = JSON.parse(readFileSync(path.join(root,"package.json"),"utf8"));
|
|
100
|
+
const scripts = projectChecks(options);
|
|
101
|
+
if (scope === "all") {
|
|
102
|
+
const configured = options.config.validation.checks;
|
|
103
|
+
if (configured) scripts.splice(0,scripts.length,...configured.map(script => {
|
|
104
|
+
if (typeof pkg.scripts?.[script] !== "string") throw new Error(`Configured validation script does not exist: ${script}`);
|
|
105
|
+
return packageScriptCommand(projectContext(options).packageManager,script);
|
|
106
|
+
}));
|
|
107
|
+
else for (const script of ["test", pkg.scripts?.["build:lib"] ? "build:lib" : pkg.scripts?.["build:app"] ? "build:app" : "build"]) if (typeof pkg.scripts?.[script] === "string" && !scripts.some(item => item.args.at(-1) === script)) scripts.splice(Math.max(0,scripts.length-1),0,packageScriptCommand(projectContext(options).packageManager,script));
|
|
108
|
+
}
|
|
109
|
+
function recursive(script, seen = new Set()) {
|
|
110
|
+
if (seen.has(script)) return false;seen.add(script);
|
|
111
|
+
const text=pkg.scripts?.[script] ?? "";
|
|
112
|
+
return /\bads\s+validate\b|\bcli\.mjs["']?\s+validate\b/.test(text) || [...text.matchAll(/\b(?:npm|bun)\s+(?:--bun\s+)?run\s+([\w:.-]+)/g)].some(match=>recursive(match[1],seen));
|
|
113
|
+
}
|
|
114
|
+
if (scripts.some(launch=>recursive(launch.args.at(-1)))) throw new Error("A selected project script calls ads validate recursively. Use leaf check/build scripts in validation.checks.");
|
|
115
|
+
stage("registered-oxlint");
|
|
116
|
+
const require = createRequire(path.join(root,"package.json"));
|
|
117
|
+
const oxlintPackage = require.resolve("oxlint/package.json");
|
|
118
|
+
const bin = JSON.parse(readFileSync(oxlintPackage,"utf8")).bin;
|
|
119
|
+
const lintConfig = outputFile(root,`validation-lint-${randomUUID()}.json`);
|
|
120
|
+
try {
|
|
121
|
+
writeFileSync(lintConfig,JSON.stringify(createLintConfig(options)));
|
|
122
|
+
const paths = [...new Set([options.config.dsDir,options.config.sourceDir,...inspectUnits(options).units.find(unit=>unit.id==="configuration").files.filter(file=>/\.[cm]?[jt]sx?$/.test(file))])].filter(file=>existsSync(path.join(root,file)));
|
|
123
|
+
await command("registered-oxlint",{command:process.execPath,args:[path.resolve(path.dirname(oxlintPackage),typeof bin === "string" ? bin : bin.oxlint),"--deny-warnings","--config",lintConfig,...paths]},options);
|
|
124
|
+
} finally { rmSync(lintConfig,{force:true}); }
|
|
125
|
+
for (const launch of scripts) await command(`project:${launch.args.at(-1)}`,launch,options);
|
|
126
|
+
if (options.config.mcp.previewManifest || options.config.mcp.apps.length) {
|
|
127
|
+
stage("verified-previews");
|
|
128
|
+
const apps=[...options.config.mcp.apps,...inspectScenarios(options).scenarios.map(entry=>({id:entry.id,file:entry.artifact}))];
|
|
129
|
+
const build=inspectBuildStatus(root,{...options.config.mcp,apps});
|
|
130
|
+
const pending=build.previews.filter(entry=>!entry.current);
|
|
131
|
+
checks.push({name:"verified-previews",passed:!pending.length,previewCount:apps.length});
|
|
132
|
+
if (pending.length) {
|
|
133
|
+
diagnostics.push(...pending.map(entry=>({rule:"validation-previews",message:`${entry.id}: ${entry.state}. A current verified preview is required; successful command exit alone is insufficient.`,details:entry.diagnostics})));
|
|
134
|
+
return complete();
|
|
135
|
+
}
|
|
136
|
+
} else checks.push({name:"verified-previews",passed:true,skipped:true,reason:"No managed preview output configured."});
|
|
137
|
+
const behaviors = inspectBehaviors(options);
|
|
138
|
+
units = scope === "all" ? behaviors.contracts.map(contract=>contract.unit) : affectedBehaviorUnits(options,changed);
|
|
139
|
+
if (units.length) {
|
|
140
|
+
stage("behavior");
|
|
141
|
+
const verification = createVerificationController(root);
|
|
142
|
+
let result;
|
|
143
|
+
try { result = await verification.run({units},signal,value=>{ progress={stage:"behavior",...value}; onProgress?.(progress); }); }
|
|
144
|
+
finally { await verification.close(); }
|
|
145
|
+
results.push(...result.results); diagnostics.push(...result.diagnostics);
|
|
146
|
+
checks.push({name:"registered-behavior",passed:result.ok});
|
|
147
|
+
if (!result.ok && !result.diagnostics.length) diagnostics.push({rule:"validation-behavior",message:"Registered behavior checks did not all pass. Inspect the recorded outcomes."});
|
|
148
|
+
} else checks.push({name:"registered-behavior",passed:true,skipped:true,reason:scope === "all" ? "No registered behavior contracts." : "No affected behavior contracts."});
|
|
149
|
+
} catch (error) { diagnostics.push(error.diagnostic ?? {rule:signal.aborted ? "validation-cancelled" : "validation-execution",message:error.message}); }
|
|
150
|
+
finally { /* Completion also runs for early architecture failures. */ }
|
|
151
|
+
return complete();
|
|
152
|
+
|
|
153
|
+
function complete() {
|
|
154
|
+
try {
|
|
155
|
+
let current = false;
|
|
156
|
+
try { current = !!inputs && validationInputs(loadConfig(root)).revision === inputs.revision; } catch (error) { diagnostics.push({rule:"validation-inputs",message:error.message}); }
|
|
157
|
+
if (inputs && !current) diagnostics.push({rule:"validation-stale",message:"Project inputs changed during validation. Rerun against current source."});
|
|
158
|
+
if (signal.aborted && !diagnostics.some(item=>item.rule==="validation-cancelled")) diagnostics.push({rule:"validation-cancelled",message:"Validation was cancelled."});
|
|
159
|
+
let ok = current && !signal.aborted && !diagnostics.length && checks.every(check=>check.passed);
|
|
160
|
+
if (ok && scope === "all") {
|
|
161
|
+
const file = outputFile(root,"validation-baseline.json"), temporary = `${file}.${randomUUID()}.tmp`;
|
|
162
|
+
try { writeFileSync(temporary,JSON.stringify({schemaVersion:1,root,toolRevision,...inputs})); renameSync(temporary,file); }
|
|
163
|
+
catch (error) { ok=false;diagnostics.push({rule:"validation-baseline",message:error.message}); }
|
|
164
|
+
finally { rmSync(temporary,{force:true}); }
|
|
165
|
+
}
|
|
166
|
+
return {ok,scope,requestedScope,...(fallback?{fallback}:{}),sourceRevision:inputs?.revision,current,elapsedMs:Date.now()-startedAt,selection:{files:changed,units},checks,diagnostics,advisories,results,
|
|
167
|
+
acceptance:acceptance(scope === "all" ? "full-project-validation" : "affected-project-validation",ok,checks.filter(check=>check.passed&&!check.skipped).map(check=>check.name),["unconfigured-project-checks","unasserted-behavior","visual-parity","accessibility-audit"])};
|
|
168
|
+
} finally { active=undefined;progress=undefined;finish(); }
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
};
|
|
172
|
+
}
|
|
@@ -142,7 +142,9 @@ async function openPreviewScenario(page, url, scenario, { timeout = 3e4 } = {})
|
|
|
142
142
|
page.on("response", response);
|
|
143
143
|
page.on("pageerror", pageError);
|
|
144
144
|
try {
|
|
145
|
-
|
|
145
|
+
const verified = new URL(url);
|
|
146
|
+
verified.searchParams.set("waitFor", "verified");
|
|
147
|
+
await page.goto(verified.href, { waitUntil: "load", timeout });
|
|
146
148
|
const end = Date.now() + timeout;
|
|
147
149
|
while (Date.now() < end) {
|
|
148
150
|
for (const frame of page.frames().filter((frame2) => frame2 !== page.mainFrame())) {
|
package/dist/verification.mjs
CHANGED
|
@@ -261,6 +261,7 @@ export function createVerificationController(root, { reportRoot = root, onProgre
|
|
|
261
261
|
for (const check of group.filter(check => check.scenario)) {
|
|
262
262
|
const url = new URL(host.url);
|
|
263
263
|
url.searchParams.set("scenario", check.scenario);
|
|
264
|
+
url.searchParams.set("waitFor", "verified");
|
|
264
265
|
scenarios[check.scenario] = url.href;
|
|
265
266
|
}
|
|
266
267
|
}
|
package/docs/ADS.md
CHANGED
|
@@ -67,8 +67,10 @@ the built-in client. Its tooling CSS is separate from the project style contract
|
|
|
67
67
|
The shared resource compiler builds one graph for all discovered scenarios on
|
|
68
68
|
first demand. Selections reuse the App and load their dependency closure. The
|
|
69
69
|
project's `mountScenario(Scenario, container)` adapter returns an unmount callback
|
|
70
|
-
that releases owned roots, listeners, timers, portals and workers. Switching
|
|
71
|
-
|
|
70
|
+
that releases owned roots, listeners, timers, portals and workers. Switching a
|
|
71
|
+
scenario or changing its compiled dependency closure resets its state. Successful
|
|
72
|
+
unrelated graph updates
|
|
73
|
+
preserve its mounted state while retaining unchanged shared modules.
|
|
72
74
|
Host context selects the project theme; it does not replace the project's skin.
|
|
73
75
|
|
|
74
76
|
|
|
@@ -95,6 +97,14 @@ design-system/
|
|
|
95
97
|
main.tsx
|
|
96
98
|
```
|
|
97
99
|
|
|
100
|
+
Container folders above owners organize component/pattern/composition navigation.
|
|
101
|
+
A group folder has only real-directory children (hidden entries ignored); its exact
|
|
102
|
+
folder name supplies the label. Owner folders and layer roots never become groups.
|
|
103
|
+
Direct regular files or symlinks disqualify a container. Nested groups use one path
|
|
104
|
+
label; ungrouped entries have no Default heading. `group` is derived MCP output,
|
|
105
|
+
not scenario/owner metadata. Move complete owners to change groups and update
|
|
106
|
+
path-based references. Grouping does not alter architecture or coverage rules.
|
|
107
|
+
|
|
98
108
|
Private controllers remain in that component/pattern owner. Shared controllers use
|
|
99
109
|
`controllers/<Name>/` with an index or same-name runtime entry and independently
|
|
100
110
|
guarded public re-exports. They may use the configured framework and declared
|
package/docs/ARCHITECTURE.md
CHANGED
|
@@ -403,15 +403,114 @@ appearance, keyboard behavior or visual parity; browser checks remain necessary.
|
|
|
403
403
|
The skill-local [scenario guide](../skills/ads-designer/references/scenarios.md)
|
|
404
404
|
explains evidence, limits and diagnostics.
|
|
405
405
|
|
|
406
|
+
### Folder-derived navigation
|
|
407
|
+
|
|
408
|
+
The filesystem is the only grouping source. A nonempty container above an owner,
|
|
409
|
+
whose non-hidden children are all real directories, supplies its exact folder
|
|
410
|
+
name. An owner directory and layer root never become groups; a direct file or
|
|
411
|
+
symlink disqualifies a container. Nested qualifying containers form a path label
|
|
412
|
+
such as `Forms / Selection`. Flat owners stay ungrouped with no Default heading.
|
|
413
|
+
This applies to components, patterns and compositions; token categories remain
|
|
414
|
+
unchanged. Move owners to reorganize groups, updating imports and path-derived
|
|
415
|
+
identities where needed. No scenario/owner metadata can override the folder rule.
|
|
416
|
+
|
|
417
|
+
Discovery adds an optional derived `group` to scenario results. One registry feeds
|
|
418
|
+
`ads_scenarios`, its searchable group labels, `ads://project/scenarios` and the
|
|
419
|
+
showcase. The browser only groups those results; it does not scan folders or own a
|
|
420
|
+
second taxonomy. Directory entries participate in discovery and build freshness,
|
|
421
|
+
so adding/removing a non-source file also updates grouping without a TSX edit.
|
|
422
|
+
Public catalogue preview IDs, edit-unit ownership and compiled
|
|
423
|
+
resource selection continue to use the real owner/scenario paths. Grouping grants
|
|
424
|
+
no API visibility, render coverage, styling permission or runtime behavior.
|
|
425
|
+
|
|
426
|
+
### Incremental compilation and refresh
|
|
427
|
+
|
|
428
|
+
`runScenarioCompiler` owns scheduling, validation, freshness and publication.
|
|
429
|
+
The project's `createVitePreviewBuilder({ build, configure })` adapter owns its
|
|
430
|
+
framework and Linaria configuration. During a watched session it retains one
|
|
431
|
+
Vite/Rollup graph, reusing unchanged module transforms and rebuilding dependencies
|
|
432
|
+
that changed. An entry-list or project-configuration change creates a fresh graph.
|
|
433
|
+
Existing custom adapters retain their behavior until they adopt this helper;
|
|
434
|
+
one-shot production/library builds keep their own compiler and optimization.
|
|
435
|
+
|
|
436
|
+
```mermaid
|
|
437
|
+
flowchart LR
|
|
438
|
+
Edit[Source edit] --> Compile[Update persistent Vite graph]
|
|
439
|
+
Compile --> Validate[Validate project and inspect registry in background]
|
|
440
|
+
Compile --> Live[Unverified live resources]
|
|
441
|
+
Live --> App[Compare selected dependency closure]
|
|
442
|
+
Validate --> Publish[Check source revision and publish atomically]
|
|
443
|
+
Compile --> Publish
|
|
444
|
+
Publish --> App
|
|
445
|
+
Validate -->|Failure| Revert[Restore last verified view]
|
|
446
|
+
App --> Keep[Unchanged: keep mounted view]
|
|
447
|
+
App --> Mount[Changed: remount selected view]
|
|
448
|
+
```
|
|
449
|
+
|
|
450
|
+
Watched compilation provides immediate visual feedback while validation and
|
|
451
|
+
scenario inspection run in the background. Inspection uses a persistent worker
|
|
452
|
+
to keep the compiler responsive. Rapid edits replace pending work, with one
|
|
453
|
+
verification run in flight. Production builds retain their own optimization.
|
|
454
|
+
|
|
455
|
+
Live resources are fenced to the current source digest and managed session.
|
|
456
|
+
They never update accepted artifacts, the successful graph cache or `current`.
|
|
457
|
+
Only validation and compilation passing against unchanged source can publish the
|
|
458
|
+
verified graph. Failure restores the last verified view; compilation errors are
|
|
459
|
+
reported without waiting for a slow validation command. Files outside Rollup's
|
|
460
|
+
module graph still cause validation and build reconciliation. Normal compiler
|
|
461
|
+
shutdown closes its Vite watcher and removes its scratch directory.
|
|
462
|
+
|
|
463
|
+
The shared builder also reuses unchanged worker bundles through the project's
|
|
464
|
+
Vite pipeline. Worker code, transitive dependencies and configuration determine
|
|
465
|
+
reuse; changed inputs rebuild the affected bundle. This is generic build caching,
|
|
466
|
+
independent of any design system and separate from source-validation evidence.
|
|
467
|
+
|
|
468
|
+
Accepted MCP edits prepare previews even when no viewer has opened them. A
|
|
469
|
+
matching checked candidate graph and scenario registry carry into the project's existing cache;
|
|
470
|
+
otherwise the normal watcher builds it in the background. Builds tied to a
|
|
471
|
+
temporary candidate location are rebuilt. Source, dependencies, compiler and
|
|
472
|
+
output content determine reuse, with no expiry based on elapsed time.
|
|
473
|
+
|
|
474
|
+
After the selected view paints, a connected showcase can prefetch changed peers'
|
|
475
|
+
static resources into the App's existing byte cache. This bounded, opportunistic
|
|
476
|
+
work neither evaluates modules nor mounts hidden examples. Navigation remains
|
|
477
|
+
independent of background preparation, and resource integrity checks still apply.
|
|
478
|
+
|
|
479
|
+
A successful global revision does not require remounting an unchanged selected
|
|
480
|
+
view. The App compares its static module/style/asset closure, retains DOM/form/
|
|
481
|
+
scroll state when that closure matches, and reruns token/paint audits against the
|
|
482
|
+
accepted manifest. A changed selected closure remounts through the project's
|
|
483
|
+
adapter. Native ESM resources still obey digest checks and the existing bounded
|
|
484
|
+
revision lifecycle; this is state-preserving refresh, not component-level HMR.
|
|
485
|
+
|
|
486
|
+
Incremental compilation is separate from test selection. Preview refresh runs the
|
|
487
|
+
adapter's validation callback. Guarded mutations select affected behavior owners
|
|
488
|
+
by registered input dependencies, then execute their registered checks. A shared
|
|
489
|
+
foundation change can select every owner. Configured project checks still run as
|
|
490
|
+
authored; releases run the full test suite. ADS does not claim per-test-case
|
|
491
|
+
selection or skip validation because a module transform was cached.
|
|
492
|
+
|
|
493
|
+
Architecture inspection shares analysis within one immutable TypeScript checker
|
|
494
|
+
and avoids redundant source discovery. A new inspection still observes current
|
|
495
|
+
source and configuration; successful diagnostics are not cached across edits.
|
|
496
|
+
|
|
406
497
|
After source changes, validation and compilation must both succeed before a new
|
|
407
498
|
graph becomes current. MCP announces build/resource updates.
|
|
408
499
|
Build success records the project input digest captured before compilation;
|
|
409
500
|
status reads independently verify that digest and the output bytes. Guarded
|
|
410
501
|
publication invalidates the compiler explicitly. Content reconciliation recovers
|
|
411
502
|
missed atomic file replacements, so OS watch delivery cannot establish freshness.
|
|
412
|
-
The built-in client
|
|
413
|
-
|
|
414
|
-
|
|
503
|
+
The built-in client uses `waitFor: compiled` for interactive selections, so it
|
|
504
|
+
can browse compiled feedback or a retained verified graph while checks run.
|
|
505
|
+
Default MCP preview calls, captures and verification still wait for verified
|
|
506
|
+
output. Pending selections never report App readiness as verified. Discovery
|
|
507
|
+
notifications are reconciled after validation rather than repeating synchronous
|
|
508
|
+
semantic inspection on the live update path. The App retains or remounts its view
|
|
509
|
+
according to its dependency closure. A quiet monochrome indicator in the
|
|
510
|
+
showcase's upper-right header exposes compilation, checking, reload and fallback
|
|
511
|
+
status through its accessible label, tooltip and details popover. No status or
|
|
512
|
+
loading overlay covers the widget area; external Apps hosts retain an in-App
|
|
513
|
+
fallback. Invalid scenario metadata at startup and later source
|
|
415
514
|
failures stay in the watcher's recoverable diagnostic path. Fixing source triggers validation again.
|
|
416
515
|
If the compiler process exits, the next preview request starts one fresh child;
|
|
417
516
|
MCP inspection remains available. Each child generation has its own status report,
|
|
@@ -426,9 +525,10 @@ reachable from the scenario entry; browser tests still verify mounting, states,
|
|
|
426
525
|
accessibility and visual parity.
|
|
427
526
|
|
|
428
527
|
The working example and starter build one shared multi-entry graph on first
|
|
429
|
-
preview demand, then reuse it across selections and
|
|
430
|
-
|
|
431
|
-
|
|
528
|
+
preview demand or accepted-edit preparation, then reuse it across selections and
|
|
529
|
+
unchanged restarts. The App loads the selected scenario's static dependency
|
|
530
|
+
closure and may prefetch changed peers; dynamic imports remain lazy. Production
|
|
531
|
+
bundles, workers and cancellation stay project-owned.
|
|
432
532
|
The MCP server serves compiled bytes without evaluating project TSX. Compiler
|
|
433
533
|
adapters normalize each entry to mount/unmount, retaining native React or Preact
|
|
434
534
|
semantics; choosing a framework does not install one into the tooling host.
|
|
@@ -477,6 +577,24 @@ Static checks establish the policies and source formats they cover. Behavior
|
|
|
477
577
|
tests and browser review verify the resulting accessibility, layout, themes,
|
|
478
578
|
states, and motion. Both forms of verification support agent-driven iteration.
|
|
479
579
|
|
|
580
|
+
The CLI `ads validate` and MCP `ads_validate` share one audit engine, combining
|
|
581
|
+
architecture and test-boundary guards, registered lint rules, project commands
|
|
582
|
+
and behavior contracts. Full audits establish a content baseline. Changed audits
|
|
583
|
+
select affected behavior owners from that baseline; broad or unclassified changes
|
|
584
|
+
expand to full. Opaque project commands retain their declared scope.
|
|
585
|
+
|
|
586
|
+
Only a successful full audit against unchanged source advances the baseline.
|
|
587
|
+
This works without Git history and does not cache individual test results. Skills
|
|
588
|
+
guide agents toward affected checks during editing and full audits after ownership
|
|
589
|
+
or runner migrations, before releases and for explicit complete validation.
|
|
590
|
+
|
|
591
|
+
Tests follow the same ownership boundaries as implementation: pure ADS tests stay
|
|
592
|
+
with their owners, marked behavior specs require registration, and private imports
|
|
593
|
+
cannot cross owners through helpers. Application integration tests stay with their
|
|
594
|
+
application subject. Static guards enforce these boundaries without claiming to
|
|
595
|
+
infer arbitrary assertion intent. Operational details live in the
|
|
596
|
+
[validation guide](../skills/ads-designer/references/validation.md).
|
|
597
|
+
|
|
480
598
|
## MCP makes the project ADS available to agents
|
|
481
599
|
|
|
482
600
|
The stdio server exposes the same token inspection and core architecture checks
|
|
@@ -536,7 +654,7 @@ sections without rerunning checks. Pages have at most 20 rows and 8 KiB of JSON;
|
|
|
536
654
|
truncated records support bounded text ranges. Discovery and investigation
|
|
537
655
|
sections use the same paging budget. Cursors bind the query and result/revision;
|
|
538
656
|
superseded IDs fail explicitly instead of silently returning another run.
|
|
539
|
-
Only the latest verification and mutation snapshots are retained, each at most
|
|
657
|
+
Only the latest validation, verification and mutation snapshots are retained, each at most
|
|
540
658
|
8 MiB under `.ds/tool-results/`. Oversized reports retain a summary with an
|
|
541
659
|
explicit unavailable-details warning. Storage/notification failure cannot change
|
|
542
660
|
an accepted edit's applied state. These are payload byte budgets, not tokenizer
|
package/docs/BEHAVIORS.md
CHANGED
|
@@ -365,6 +365,13 @@ computed imports remain conservative. Barrel source changes still invalidate
|
|
|
365
365
|
dependents. ADS caches source parsing, resolution and digests within an inspection
|
|
366
366
|
only; later runs read current source again.
|
|
367
367
|
|
|
368
|
+
Test selection is at owner-contract granularity: when a registered check's input
|
|
369
|
+
dependencies intersect changed files, that owner is selected and its registered
|
|
370
|
+
checks run. A shared token/foundation edit can affect every owner. Project check
|
|
371
|
+
scripts still run as configured; ordinary live preview does not automatically run
|
|
372
|
+
browser checks and release validation runs the full suite. Persistent Vite
|
|
373
|
+
compilation and retained preview state do not imply per-test-case execution caches.
|
|
374
|
+
|
|
368
375
|
Guarded mutations execute affected registered behavior contracts after core,
|
|
369
376
|
Oxlint and configured project checks, before writing source. Imported shared
|
|
370
377
|
controller changes also select dependent contracts conservatively. Rejected and
|
package/docs/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,59 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.3.29
|
|
4
|
+
|
|
5
|
+
- Prepare managed previews after accepted MCP edits, including unopened viewers.
|
|
6
|
+
Reuse matching portable candidate graphs through the existing verified cache;
|
|
7
|
+
otherwise warm the normal compiler in the background. Prefetch changed peers'
|
|
8
|
+
static resources into the connected showcase's existing byte cache without
|
|
9
|
+
evaluating or mounting them. Content changes invalidate reuse; elapsed time does not.
|
|
10
|
+
|
|
11
|
+
- Add shared `ads validate` / `ads_validate` full and changed audits, source-fenced
|
|
12
|
+
full baselines, independent paged validation results and skill trigger guidance.
|
|
13
|
+
Reuse configured project commands and registered behaviors with explicit scope
|
|
14
|
+
expansion, skipped-stage reporting and cancellation.
|
|
15
|
+
- Enforce actual test-owner private imports, including development-helper chains;
|
|
16
|
+
reject unregistered marked behavior specs and pure ADS tests outside an owner.
|
|
17
|
+
|
|
18
|
+
- Reuse self-contained IIFE worker bundles generically in the shared watched
|
|
19
|
+
preview builder. Keep the project's Vite worker compiler/plugins, deduplicate
|
|
20
|
+
requests across constructor/query imports, fingerprint transitive inputs and
|
|
21
|
+
resolution directories, re-emit assets and include worker inputs in successful
|
|
22
|
+
graph caching. Preserve importer transforms and failure/source fences.
|
|
23
|
+
|
|
24
|
+
- Separate live visual feedback from verified preview publication. Compile edits
|
|
25
|
+
while full checks and worker-based registry inspection run in the background;
|
|
26
|
+
coalesce rapid edits, preserve unchanged mounted views and restore the last
|
|
27
|
+
verified graph on failure. Fence live resources to source/session and keep
|
|
28
|
+
captures, guarded edits and default MCP preview calls on verified output.
|
|
29
|
+
- Keep showcase navigation usable during checks with an explicit compiled-preview
|
|
30
|
+
mode. Replace blocking preview overlays with a quiet monochrome header
|
|
31
|
+
indicator and on-demand status details. Disable watched-preview minification
|
|
32
|
+
and batch shared graph cache/report writes.
|
|
33
|
+
|
|
34
|
+
- Reduce validation overhead without skipping checks: read TypeScript compiler
|
|
35
|
+
options without repeatedly enumerating source trees, share symbol identities
|
|
36
|
+
within immutable checkers, and look up style permissions only for candidate
|
|
37
|
+
writes. Keep fresh source/configuration inspection and full global validation;
|
|
38
|
+
no persistent diagnostic cache or per-owner validation shortcut is introduced.
|
|
39
|
+
|
|
40
|
+
## 0.3.28
|
|
41
|
+
|
|
42
|
+
- Group component, pattern and composition showcase navigation using folder
|
|
43
|
+
containers only. Preserve exact folder names; reject metadata overrides and
|
|
44
|
+
retain flat navigation without a Default heading. Search derived groups through
|
|
45
|
+
MCP while keeping preview IDs, edit ownership and source reads aligned. Track
|
|
46
|
+
container structure in discovery and build freshness, including non-source files.
|
|
47
|
+
- Add an opt-in persistent Vite preview builder and adopt it in the starter.
|
|
48
|
+
Reuse unaffected module transforms and retain mounted preview state when its
|
|
49
|
+
dependency closure is unchanged; keep validation and atomic source checks.
|
|
50
|
+
- Inline focused HTML without interpreting framework JavaScript strings as
|
|
51
|
+
document stylesheet links.
|
|
52
|
+
|
|
53
|
+
- Preserve transition-family properties when probing token samples. Other probes
|
|
54
|
+
still disable transitions to avoid measuring intermediate values, and every
|
|
55
|
+
probe restores the original document and sample styles.
|
|
56
|
+
|
|
3
57
|
## 0.3.27
|
|
4
58
|
|
|
5
59
|
- Bound the release suite to two test workers to avoid memory contention while
|
package/docs/GUIDE.md
CHANGED
|
@@ -511,6 +511,37 @@ export default function Scenario() { return <Button>{fixture.label}</Button>; }
|
|
|
511
511
|
```
|
|
512
512
|
|
|
513
513
|
IDs derive from filenames; do not maintain another registry or hand-assigned IDs.
|
|
514
|
+
Showcase groups come only from folders. A folder above an owner becomes a group
|
|
515
|
+
when its non-hidden children are all real directories:
|
|
516
|
+
|
|
517
|
+
```text
|
|
518
|
+
components/
|
|
519
|
+
Forms/ # group: Forms
|
|
520
|
+
Input/
|
|
521
|
+
Input.ads.scenario.tsx
|
|
522
|
+
Select/
|
|
523
|
+
Select.ads.scenario.tsx
|
|
524
|
+
Switch/ # ungrouped owner
|
|
525
|
+
Switch.ads.scenario.tsx
|
|
526
|
+
```
|
|
527
|
+
|
|
528
|
+
The folder name is the group name, with spelling and case unchanged:
|
|
529
|
+
`form-controls/` displays as `form-controls`. The owner's own directory and the
|
|
530
|
+
layer root are never groups. The same convention applies to `patterns/` and
|
|
531
|
+
`composition/`. Nested containers appear as one label, such as
|
|
532
|
+
`Forms / Selection`. A regular file (`index.ts`, `README.md`, etc.) or a symbolic
|
|
533
|
+
link prevents that container from becoming a group. Hidden entries are ignored.
|
|
534
|
+
|
|
535
|
+
There is no grouping metadata, tag list or grouping registry. Do not add `group`
|
|
536
|
+
to the scenario export or owner contract. The optional `group` in MCP discovery
|
|
537
|
+
results is computed from folders; it is not authoring input. Change a group by
|
|
538
|
+
moving complete owner directories and updating imports, exports and any scenario,
|
|
539
|
+
behavior or capture references whose path-derived IDs change.
|
|
540
|
+
|
|
541
|
+
Ungrouped entries remain directly visible without a Default heading. Named groups
|
|
542
|
+
are collapsible and sorted alphabetically within each layer. Existing flat
|
|
543
|
+
projects continue to work without moving files. Tokens retain their categories.
|
|
544
|
+
|
|
514
545
|
Token scenarios live beside foundation CSS under the configured token directory.
|
|
515
546
|
The starter includes `tokens/Foundation.ads.scenario.tsx` and its local fixture for
|
|
516
547
|
a project-owned token review renderer. Keep its presentation in development-only `review/`:
|