@reqvire-org/ads 0.3.28 → 0.3.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/dist/atomic-composition.mjs +2 -1
  2. package/dist/behaviors.mjs +2 -2
  3. package/dist/boundaries.mjs +6 -3
  4. package/dist/check.mjs +3 -0
  5. package/dist/cli.mjs +13 -0
  6. package/dist/config.mjs +11 -4
  7. package/dist/mcp/build-status.mjs +18 -5
  8. package/dist/mcp/context.mjs +2 -1
  9. package/dist/mcp/execution-results.mjs +4 -3
  10. package/dist/mcp/mutations.mjs +53 -51
  11. package/dist/mcp/preview-watch.mjs +23 -3
  12. package/dist/mcp/preview-widget.bundle.js +16 -15
  13. package/dist/mcp/resource-loader.js +40 -12
  14. package/dist/mcp/server.mjs +88 -46
  15. package/dist/oxlint.mjs +6 -1
  16. package/dist/preview-builder.mjs +10 -4
  17. package/dist/preview-files.mjs +19 -12
  18. package/dist/preview-inputs.mjs +6 -17
  19. package/dist/preview-resources.mjs +36 -7
  20. package/dist/preview-scope.mjs +6 -0
  21. package/dist/preview-workers.mjs +184 -0
  22. package/dist/project-documents.mjs +4 -0
  23. package/dist/scenario-inspector.mjs +34 -0
  24. package/dist/scenario-trace.mjs +5 -3
  25. package/dist/scenarios-compiler.mjs +200 -25
  26. package/dist/showcase/client.bundle.js +23 -22
  27. package/dist/showcase/index.html +2 -2
  28. package/dist/showcase/style.css +5 -1
  29. package/dist/skills/ads-break-ui/SKILL.md +3 -0
  30. package/dist/skills/ads-break-ui/references/behaviors.md +2 -0
  31. package/dist/skills/ads-break-ui/references/layers.md +6 -0
  32. package/dist/skills/ads-break-ui/references/runtimes.md +31 -0
  33. package/dist/skills/ads-break-ui/references/validation.md +69 -0
  34. package/dist/skills/ads-designer/SKILL.md +3 -0
  35. package/dist/skills/ads-designer/references/behaviors.md +2 -0
  36. package/dist/skills/ads-designer/references/layers.md +6 -0
  37. package/dist/skills/ads-designer/references/runtimes.md +31 -0
  38. package/dist/skills/ads-designer/references/validation.md +69 -0
  39. package/dist/skills/ads-import/SKILL.md +3 -0
  40. package/dist/skills/ads-import/references/behaviors.md +2 -0
  41. package/dist/skills/ads-import/references/layers.md +6 -0
  42. package/dist/skills/ads-import/references/runtimes.md +31 -0
  43. package/dist/skills/ads-import/references/validation.md +69 -0
  44. package/dist/skills/ads-motion/SKILL.md +3 -0
  45. package/dist/skills/ads-motion/references/behaviors.md +2 -0
  46. package/dist/skills/ads-motion/references/layers.md +6 -0
  47. package/dist/skills/ads-motion/references/runtimes.md +31 -0
  48. package/dist/skills/ads-motion/references/validation.md +69 -0
  49. package/dist/skills/ads-port/SKILL.md +3 -0
  50. package/dist/skills/ads-port/references/behaviors.md +2 -0
  51. package/dist/skills/ads-port/references/layers.md +6 -0
  52. package/dist/skills/ads-port/references/runtimes.md +31 -0
  53. package/dist/skills/ads-port/references/validation.md +69 -0
  54. package/dist/source-symbols.mjs +11 -0
  55. package/dist/source-values.mjs +10 -3
  56. package/dist/test-boundaries.mjs +96 -0
  57. package/dist/ui-framework.mjs +2 -1
  58. package/dist/units.mjs +12 -1
  59. package/dist/validation-checks.mjs +50 -0
  60. package/dist/validation-inputs.mjs +132 -0
  61. package/dist/validation.mjs +158 -0
  62. package/dist/verification/browser.mjs +3 -1
  63. package/dist/verification.mjs +1 -0
  64. package/docs/ARCHITECTURE.md +96 -20
  65. package/docs/BEHAVIORS.md +2 -0
  66. package/docs/CHANGELOG.md +74 -0
  67. package/docs/MCP.md +105 -12
  68. package/package.json +1 -1
@@ -0,0 +1,158 @@
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 { validationInputFiles } from "./validation-inputs.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
+ /** Shared relevant-input inventory also discovers outside tests and their imports. */
28
+ export function validationInputs(options) {
29
+ const files = validationInputFiles(options);
30
+ return { files, revision: hash(JSON.stringify([toolRevision,files])) };
31
+ }
32
+
33
+ function outputFile(root, name) {
34
+ const folder = path.join(root,".ds");
35
+ if (existsSync(folder) && realpathSync(folder) !== folder) throw new Error("Validation output cannot resolve through a symlink.");
36
+ mkdirSync(folder,{recursive:true});
37
+ return path.join(folder,name);
38
+ }
39
+
40
+ export function createValidationController(directory) {
41
+ const root = path.resolve(directory);
42
+ let active, progress;
43
+ return {
44
+ status() { return { busy: !!active, ...(progress ? {progress} : {}) }; },
45
+ async close() { const pending = active; pending?.abort(); await pending?.completion; },
46
+ async run({scope = "all"} = {}, signal, onProgress) {
47
+ if (!["all","changed"].includes(scope)) throw new Error("Validation scope must be all or changed.");
48
+ if (active) throw new Error("Validation is already running.");
49
+ active = new AbortController();
50
+ const controller = active;
51
+ signal = signal ? AbortSignal.any([signal,controller.signal]) : controller.signal;
52
+ let finish; controller.completion = new Promise(resolve => { finish = resolve; });
53
+ const startedAt = Date.now(), checks = [], diagnostics = [], advisories = [], results = [];
54
+ const requestedScope = scope;
55
+ let inputs, changed = [], units = [], fallback;
56
+ function stage(name) { signal.throwIfAborted(); progress = {stage:name,elapsedMs:Date.now()-startedAt,completed:checks.length}; onProgress?.(progress); }
57
+ async function command(name, launch, options) {
58
+ stage(name);
59
+ try { const result = await checkCommand(launch.command, launch.args, root, signal, undefined, {category:"build",phase:name}, options.config.mcp.mutationCheckTimeoutMs); checks.push({name,...result}); }
60
+ catch (error) { checks.push({name,passed:false}); throw error; }
61
+ }
62
+ try {
63
+ const options = loadConfig(root);
64
+ inputs = validationInputs(options);
65
+ const baselineFile = outputFile(root,"validation-baseline.json");
66
+ if (scope === "changed") {
67
+ let baseline;
68
+ 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. */ }
69
+ 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.";
70
+ else {
71
+ changed = [...new Set([...Object.keys(inputs.files),...Object.keys(baseline.files)])].filter(file => inputs.files[file] !== baseline.files[file]);
72
+ const inventory = inspectUnits(options);
73
+ if (changed.some(file => {
74
+ const owner=inventory.owner(inventory.relative(file));
75
+ 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);
76
+ })) fallback = "Configuration, foundation, deleted ownership or unclassified inputs changed.";
77
+ }
78
+ if (fallback) scope = "all";
79
+ }
80
+ stage("architecture");
81
+ const core = checkProject(root);
82
+ diagnostics.push(...core.diagnostics); advisories.push(...(core.advisories ?? []));
83
+ checks.push({name:"architecture",passed:core.ok});
84
+ if (!core.ok) return complete();
85
+ const pkg = JSON.parse(readFileSync(path.join(root,"package.json"),"utf8"));
86
+ const scripts = projectChecks(options);
87
+ if (scope === "all") {
88
+ const configured = options.config.validation.checks;
89
+ if (configured) scripts.splice(0,scripts.length,...configured.map(script => {
90
+ if (typeof pkg.scripts?.[script] !== "string") throw new Error(`Configured validation script does not exist: ${script}`);
91
+ return packageScriptCommand(projectContext(options).packageManager,script);
92
+ }));
93
+ 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));
94
+ }
95
+ function recursive(script, seen = new Set()) {
96
+ if (seen.has(script)) return false;seen.add(script);
97
+ const text=pkg.scripts?.[script] ?? "";
98
+ 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));
99
+ }
100
+ 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.");
101
+ stage("registered-oxlint");
102
+ const require = createRequire(path.join(root,"package.json"));
103
+ const oxlintPackage = require.resolve("oxlint/package.json");
104
+ const bin = JSON.parse(readFileSync(oxlintPackage,"utf8")).bin;
105
+ const lintConfig = outputFile(root,`validation-lint-${randomUUID()}.json`);
106
+ try {
107
+ writeFileSync(lintConfig,JSON.stringify(createLintConfig(options)));
108
+ 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)));
109
+ 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);
110
+ } finally { rmSync(lintConfig,{force:true}); }
111
+ for (const launch of scripts) await command(`project:${launch.args.at(-1)}`,launch,options);
112
+ if (options.config.mcp.previewManifest || options.config.mcp.apps.length) {
113
+ stage("verified-previews");
114
+ const apps=[...options.config.mcp.apps,...inspectScenarios(options).scenarios.map(entry=>({id:entry.id,file:entry.artifact}))];
115
+ const build=inspectBuildStatus(root,{...options.config.mcp,apps});
116
+ const pending=build.previews.filter(entry=>!entry.current);
117
+ checks.push({name:"verified-previews",passed:!pending.length,previewCount:apps.length});
118
+ if (pending.length) {
119
+ 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})));
120
+ return complete();
121
+ }
122
+ } else checks.push({name:"verified-previews",passed:true,skipped:true,reason:"No managed preview output configured."});
123
+ const behaviors = inspectBehaviors(options);
124
+ units = scope === "all" ? behaviors.contracts.map(contract=>contract.unit) : affectedBehaviorUnits(options,changed);
125
+ if (units.length) {
126
+ stage("behavior");
127
+ const verification = createVerificationController(root);
128
+ let result;
129
+ try { result = await verification.run({units},signal,value=>{ progress={stage:"behavior",...value}; onProgress?.(progress); }); }
130
+ finally { await verification.close(); }
131
+ results.push(...result.results); diagnostics.push(...result.diagnostics);
132
+ checks.push({name:"registered-behavior",passed:result.ok});
133
+ if (!result.ok && !result.diagnostics.length) diagnostics.push({rule:"validation-behavior",message:"Registered behavior checks did not all pass. Inspect the recorded outcomes."});
134
+ } else checks.push({name:"registered-behavior",passed:true,skipped:true,reason:scope === "all" ? "No registered behavior contracts." : "No affected behavior contracts."});
135
+ } catch (error) { diagnostics.push(error.diagnostic ?? {rule:signal.aborted ? "validation-cancelled" : "validation-execution",message:error.message}); }
136
+ finally { /* Completion also runs for early architecture failures. */ }
137
+ return complete();
138
+
139
+ function complete() {
140
+ try {
141
+ let current = false;
142
+ try { current = !!inputs && validationInputs(loadConfig(root)).revision === inputs.revision; } catch (error) { diagnostics.push({rule:"validation-inputs",message:error.message}); }
143
+ if (inputs && !current) diagnostics.push({rule:"validation-stale",message:"Project inputs changed during validation. Rerun against current source."});
144
+ if (signal.aborted && !diagnostics.some(item=>item.rule==="validation-cancelled")) diagnostics.push({rule:"validation-cancelled",message:"Validation was cancelled."});
145
+ let ok = current && !signal.aborted && !diagnostics.length && checks.every(check=>check.passed);
146
+ if (ok && scope === "all") {
147
+ const file = outputFile(root,"validation-baseline.json"), temporary = `${file}.${randomUUID()}.tmp`;
148
+ try { writeFileSync(temporary,JSON.stringify({schemaVersion:1,root,toolRevision,...inputs})); renameSync(temporary,file); }
149
+ catch (error) { ok=false;diagnostics.push({rule:"validation-baseline",message:error.message}); }
150
+ finally { rmSync(temporary,{force:true}); }
151
+ }
152
+ return {ok,scope,requestedScope,...(fallback?{fallback}:{}),sourceRevision:inputs?.revision,current,elapsedMs:Date.now()-startedAt,selection:{files:changed,units},checks,diagnostics,advisories,results,
153
+ 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"])};
154
+ } finally { active=undefined;progress=undefined;finish(); }
155
+ }
156
+ },
157
+ };
158
+ }
@@ -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
- await page.goto(url, { waitUntil: "load", timeout });
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())) {
@@ -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
  }
@@ -435,22 +435,46 @@ one-shot production/library builds keep their own compiler and optimization.
435
435
 
436
436
  ```mermaid
437
437
  flowchart LR
438
- Edit[Source edit] --> Registry[Refresh scenario registry]
439
- Registry --> Validate[Validate project]
440
- Registry --> Compile[Update persistent Vite graph]
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]
441
442
  Validate --> Publish[Check source revision and publish atomically]
442
443
  Compile --> Publish
443
- Publish --> App[Compare selected dependency closure]
444
+ Publish --> App
445
+ Validate -->|Failure| Revert[Restore last verified view]
444
446
  App --> Keep[Unchanged: keep mounted view]
445
447
  App --> Mount[Changed: remount selected view]
446
448
  ```
447
449
 
448
- Watch output is private scratch data under `.ds/incremental/`, not a successful
449
- published build. Both validation and compilation must succeed against unchanged
450
- source before the scheduler publishes immutable resources. Failed/superseded work
451
- retains the previous preview with stale diagnostics. Files outside Rollup's module
452
- graph still cause validation and build reconciliation. Normal compiler shutdown
453
- closes its Vite watcher and removes its scratch directory.
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.
454
478
 
455
479
  A successful global revision does not require remounting an unchanged selected
456
480
  view. The App compares its static module/style/asset closure, retains DOM/form/
@@ -466,15 +490,34 @@ foundation change can select every owner. Configured project checks still run as
466
490
  authored; releases run the full test suite. ADS does not claim per-test-case
467
491
  selection or skip validation because a module transform was cached.
468
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
+ Source scans prepare generated-directory and source-root comparisons once per
497
+ inventory. Every scan still discovers tests and hashes current input bytes.
498
+
469
499
  After source changes, validation and compilation must both succeed before a new
470
500
  graph becomes current. MCP announces build/resource updates.
471
501
  Build success records the project input digest captured before compilation;
472
- status reads independently verify that digest and the output bytes. Guarded
502
+ status reads independently verify that digest and the output bytes. Unchanged
503
+ asset checks reuse bounded verification metadata keyed by the expected digest
504
+ and file identity, size and nanosecond modification/change timestamps. Resource
505
+ delivery still hashes the actual returned bytes. Guarded
473
506
  publication invalidates the compiler explicitly. Content reconciliation recovers
474
507
  missed atomic file replacements, so OS watch delivery cannot establish freshness.
475
- The built-in client refreshes discovery and sends the current selection to the
476
- existing App. Its loader retains or remounts that view according to its dependency
477
- closure. Failed builds retain the previous view with visible stale diagnostics. Invalid scenario metadata at startup and later source
508
+ The built-in client uses `waitFor: compiled` for interactive selections, so it
509
+ can browse compiled feedback or a retained verified graph while checks run.
510
+ Default MCP preview calls, captures and verification still wait for verified
511
+ output. Pending selections never report App readiness as verified. Discovery
512
+ notifications are reconciled after validation rather than repeating synchronous
513
+ semantic inspection on the live update path. The App retains or remounts its view
514
+ according to its dependency closure. A quiet monochrome indicator in the
515
+ showcase's upper-right header exposes compilation, checking, reload and fallback
516
+ status through its accessible label, tooltip and details popover. Editing keeps
517
+ the widget area interactive without overlays. Switching entries uses a temporary
518
+ loading spinner until the selected App mounts; messages from an older selection
519
+ cannot end that transition. External Apps hosts retain an in-App
520
+ fallback. Invalid scenario metadata at startup and later source
478
521
  failures stay in the watcher's recoverable diagnostic path. Fixing source triggers validation again.
479
522
  If the compiler process exits, the next preview request starts one fresh child;
480
523
  MCP inspection remains available. Each child generation has its own status report,
@@ -489,9 +532,10 @@ reachable from the scenario entry; browser tests still verify mounting, states,
489
532
  accessibility and visual parity.
490
533
 
491
534
  The working example and starter build one shared multi-entry graph on first
492
- preview demand, then reuse it across selections and unchanged restarts. Only the
493
- selected scenario's static dependency closure loads in the App; dynamic imports
494
- remain lazy. Production bundles, workers and cancellation stay project-owned.
535
+ preview demand or accepted-edit preparation, then reuse it across selections and
536
+ unchanged restarts. The App loads the selected scenario's static dependency
537
+ closure and may prefetch changed peers; dynamic imports remain lazy. Production
538
+ bundles, workers and cancellation stay project-owned.
495
539
  The MCP server serves compiled bytes without evaluating project TSX. Compiler
496
540
  adapters normalize each entry to mount/unmount, retaining native React or Preact
497
541
  semantics; choosing a framework does not install one into the tooling host.
@@ -540,6 +584,32 @@ Static checks establish the policies and source formats they cover. Behavior
540
584
  tests and browser review verify the resulting accessibility, layout, themes,
541
585
  states, and motion. Both forms of verification support agent-driven iteration.
542
586
 
587
+ The CLI `ads validate` and MCP `ads_validate` share one audit engine, combining
588
+ architecture and test-boundary guards, registered lint rules, project commands
589
+ and behavior contracts. Full audits establish a content baseline. Changed audits
590
+ select affected behavior owners from that baseline; broad or unclassified changes
591
+ expand to full. Opaque project commands retain their declared scope.
592
+
593
+ Only a successful full audit against unchanged source advances the baseline.
594
+ This works without Git history and does not cache individual test results. Skills
595
+ guide agents toward affected checks during editing and full audits after ownership
596
+ or runner migrations, before releases and for explicit complete validation.
597
+
598
+ Freshness follows the design system and consuming UI, their local import/asset
599
+ dependencies, registered build and guard configuration, and project test inputs.
600
+ Unrelated backend, native-toolchain and documentation edits do not invalidate an
601
+ ADS candidate. Opaque commands declare additional files or directories through
602
+ `validation.inputs`; these declarations add to the mandatory scope. Guarded edits
603
+ also fence every patched file and both sides of a configuration change. Candidate
604
+ commands still cannot rewrite source while checking it.
605
+
606
+ Tests follow the same ownership boundaries as implementation: pure ADS tests stay
607
+ with their owners, marked behavior specs require registration, and private imports
608
+ cannot cross owners through helpers. Application integration tests stay with their
609
+ application subject. Static guards enforce these boundaries without claiming to
610
+ infer arbitrary assertion intent. Operational details live in the
611
+ [validation guide](../skills/ads-designer/references/validation.md).
612
+
543
613
  ## MCP makes the project ADS available to agents
544
614
 
545
615
  The stdio server exposes the same token inspection and core architecture checks
@@ -563,6 +633,9 @@ The MCP runtime owns its browser hosts and preview builder lifetime. Closing the
563
633
  client connection releases them together; a separate ownership guard can stop
564
634
  detached builders after abrupt owner death. A preview process must not outlive
565
635
  its owner and continue publishing stale output.
636
+ HTTP request instances share a source observer instead of initializing another
637
+ source/build inspection for each resource read. Immutable resources retain byte
638
+ integrity checks; status, build and validation requests still establish freshness.
566
639
  Build reports expose queued, validation, compilation and publication progress.
567
640
  A timed-out preview request marks the builder stalled; the next explicit request
568
641
  restarts it within the same MCP session. A running process alone is not freshness.
@@ -571,8 +644,11 @@ Opt-in MCP editing makes validation part of the write operation. The agent sends
571
644
  a Git unified diff for one logical ADS unit: its implementation and owned preview
572
645
  context, or the shared token foundation. ADS resolves file ownership, reconstructs
573
646
  candidate files locally and validates a temporary project copy with architecture
574
- checks, registered lint rules and project validation scripts. Affected registered
575
- behavior checks, including consumers of a changed shared controller, also run in
647
+ checks, registered lint rules and project validation scripts.
648
+ The temporary copy contains the relevant input graph and patched files, with room
649
+ for 100,000 files / 2 GiB. Unrelated native artifacts are not copied. Declared extra
650
+ inputs support project commands that read data outside the UI graph. Affected
651
+ registered behavior checks, including consumers of a changed shared controller, also run in
576
652
  the isolated candidate project. The project owns its test code and runner policy;
577
653
  ADS owns affected-check selection, candidate hosting, progress, evidence freshness
578
654
  and process cleanup. One profile timeout bounds its entire runner process. Parallel
@@ -599,7 +675,7 @@ sections without rerunning checks. Pages have at most 20 rows and 8 KiB of JSON;
599
675
  truncated records support bounded text ranges. Discovery and investigation
600
676
  sections use the same paging budget. Cursors bind the query and result/revision;
601
677
  superseded IDs fail explicitly instead of silently returning another run.
602
- Only the latest verification and mutation snapshots are retained, each at most
678
+ Only the latest validation, verification and mutation snapshots are retained, each at most
603
679
  8 MiB under `.ds/tool-results/`. Oversized reports retain a summary with an
604
680
  explicit unavailable-details warning. Storage/notification failure cannot change
605
681
  an accepted edit's applied state. These are payload byte budgets, not tokenizer
package/docs/BEHAVIORS.md CHANGED
@@ -166,6 +166,8 @@ do not run. It preserves the project's worker configuration.
166
166
 
167
167
  `timeoutMs` bounds the complete runner process for one profile, including runner
168
168
  startup, hooks, retries and all selected cases. It is not a per-test timeout.
169
+ The default is 60000 ms; explicit budgets may range from 100 to 900000 ms
170
+ (fifteen minutes), so larger catalogues can complete a full run.
169
171
  Playwright's own test/hook timeouts remain separate project settings. Set the
170
172
  profile budget from measured suite durations with headroom; increasing it does
171
173
  not repair a stalled assertion or cleanup.
package/docs/CHANGELOG.md CHANGED
@@ -1,5 +1,79 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.3.31
4
+
5
+ - Allow the Bun-only package smoke case one minute for cold candidate/browser
6
+ startup, two minutes for its runner, and six minutes for the complete smoke
7
+ process. Preserve all checks and assertions. Version 0.3.30 was not published
8
+ after CI caught its previous twenty-second startup budget.
9
+
10
+ - Prepare path exclusions once per source scan instead of resolving the same
11
+ generated directories for every visited file. Preserve source-root precedence,
12
+ complete test discovery and current-byte freshness checks.
13
+
14
+ - Reuse digest verification metadata for unchanged preview assets during status
15
+ polling. Invalidate on file identity, size or timestamp changes and keep actual
16
+ resource delivery checked against its expected bytes.
17
+
18
+ - Accept conditional data-only scenario prop spreads without treating their
19
+ absent className alternatives as custom styling. Keep styled branches subject
20
+ to the existing class provenance checks.
21
+
22
+ - Fence mutations, validation baselines and preview freshness against ADS/UI and
23
+ actual local dependencies instead of unrelated project source. Keep test-boundary
24
+ coverage, candidate source-write detection and all patched paths protected. Add
25
+ additive `validation.inputs` for data read by opaque project commands.
26
+ Copy only those inputs and patched files into mutation candidates; leave native
27
+ caches out and allow up to 100,000 files / 2 GiB of relevant source.
28
+ Keep HTTP resource reads on the immutable byte path with the shared observer,
29
+ avoiding repeated source/build observation initialization for each request.
30
+
31
+ - Allow explicit behavior-profile budgets up to fifteen minutes so larger
32
+ catalogues can complete verification. Keep the one-minute default, whole-run
33
+ cancellation and separate project-command/capture limits.
34
+
35
+ - Restore the preview pane's spinner when navigating to a different entry, until
36
+ that scenario mounts. Keep editing and validation on the quiet header ring.
37
+ Ignore messages from the previous selection, expose pending navigation through
38
+ `aria-busy` and respect reduced motion.
39
+
40
+ ## 0.3.29
41
+
42
+ - Prepare managed previews after accepted MCP edits, including unopened viewers.
43
+ Reuse matching portable candidate graphs through the existing verified cache;
44
+ otherwise warm the normal compiler in the background. Prefetch changed peers'
45
+ static resources into the connected showcase's existing byte cache without
46
+ evaluating or mounting them. Content changes invalidate reuse; elapsed time does not.
47
+
48
+ - Add shared `ads validate` / `ads_validate` full and changed audits, source-fenced
49
+ full baselines, independent paged validation results and skill trigger guidance.
50
+ Reuse configured project commands and registered behaviors with explicit scope
51
+ expansion, skipped-stage reporting and cancellation.
52
+ - Enforce actual test-owner private imports, including development-helper chains;
53
+ reject unregistered marked behavior specs and pure ADS tests outside an owner.
54
+
55
+ - Reuse self-contained IIFE worker bundles generically in the shared watched
56
+ preview builder. Keep the project's Vite worker compiler/plugins, deduplicate
57
+ requests across constructor/query imports, fingerprint transitive inputs and
58
+ resolution directories, re-emit assets and include worker inputs in successful
59
+ graph caching. Preserve importer transforms and failure/source fences.
60
+
61
+ - Separate live visual feedback from verified preview publication. Compile edits
62
+ while full checks and worker-based registry inspection run in the background;
63
+ coalesce rapid edits, preserve unchanged mounted views and restore the last
64
+ verified graph on failure. Fence live resources to source/session and keep
65
+ captures, guarded edits and default MCP preview calls on verified output.
66
+ - Keep showcase navigation usable during checks with an explicit compiled-preview
67
+ mode. Replace blocking preview overlays with a quiet monochrome header
68
+ indicator and on-demand status details. Disable watched-preview minification
69
+ and batch shared graph cache/report writes.
70
+
71
+ - Reduce validation overhead without skipping checks: read TypeScript compiler
72
+ options without repeatedly enumerating source trees, share symbol identities
73
+ within immutable checkers, and look up style permissions only for candidate
74
+ writes. Keep fresh source/configuration inspection and full global validation;
75
+ no persistent diagnostic cache or per-owner validation shortcut is introduced.
76
+
3
77
  ## 0.3.28
4
78
 
5
79
  - Group component, pattern and composition showcase navigation using folder
package/docs/MCP.md CHANGED
@@ -63,9 +63,14 @@ policy. A disconnected subscription marks retained output stale and tears down
63
63
  App watchers; refresh the page after restarting ADS. Compilation remains necessary for project TSX/Linaria, performed by the
64
64
  managed project compiler on demand and after relevant source changes.
65
65
 
66
- Switching entries overlays a centered loading spinner, then reveals the new
67
- scenario inside the existing App. Loading and diagnostic overlays do not move the
68
- preview. Token presentation comes from project-owned scenarios, fixtures and
66
+ Switching entries updates the scenario inside the existing App. A quiet monochrome
67
+ indicator in the upper-right header reports compilation, checking, readiness or
68
+ failure; hover or click reveals details. The preview remains interactive during
69
+ background checks. Switching to another entry shows a loading spinner in the
70
+ preview pane until that selection mounts. Editing the current entry uses only
71
+ the header ring, without covering the preview. Messages from the previous
72
+ selection cannot clear navigation's loading state.
73
+ Token presentation comes from project-owned scenarios, fixtures and
69
74
  development-only review helpers, using the project's real foundation CSS and extracted
70
75
  styles. The App runtime contains no token sample templates or named token ordering.
71
76
  The generic definition inspector remains available without a scenario build.
@@ -208,6 +213,7 @@ The server supplies agent guidance through its instructions, tool descriptions,
208
213
  | `ads_show_scenario` | Render an exact discovered scenario with its own fixtures |
209
214
  | `ads_behaviors` | Paged owner discovery; select a unit and detail section |
210
215
  | `ads_verify` | Execute an owner's registered checks and record revision-bound evidence |
216
+ | `ads_validate` | Run the complete project audit, or affected checks since a successful full baseline |
211
217
  | `ads_results` | Page saved execution outcomes, diagnostics, logs and captures without rerunning |
212
218
  | `ads_investigate` | Read one check's summary, then paged requests/errors/artifacts |
213
219
  | `ads_capture` | On-demand PNG of a discovered scenario or named element; replace current and clear candidate |
@@ -317,7 +323,10 @@ Results and subscribed resource notifications are available through
317
323
  During a run, `ads_status.behaviors.progress` exposes completed/active/pending
318
324
  checks, timings and the profile's whole-run timeout. Candidate mutation checks use
319
325
  `ads_status.mutations.progress`. Requested MCP progress notifications also report
320
- runner activity. Playwright uses the project's workers and filters selected case
326
+ runner activity. Profiles accept an explicit `timeoutMs` from 100 to 900000 ms
327
+ (up to fifteen minutes), with a 60000 ms default. This covers the complete
328
+ selected suite; each runner's individual test/hook timeouts are separate.
329
+ Playwright uses the project's workers and filters selected case
321
330
  tags; ADS does not silently change timeout or parallelism policy. Timeout results
322
331
  retain partial outcomes and reports under `.ds/verification/`, but incomplete
323
332
  runs still block application and cannot establish passing guarantees. See the
@@ -601,8 +610,8 @@ project settings. The project continues to own its architecture and extensions.
601
610
 
602
611
  One unit patch is limited to 32 entries and 256 KiB inline, or 16 MiB through
603
612
  `patchFile`. Each original/resulting file is limited to 16 MiB. Validation snapshots
604
- are bounded to 20,000 files and 128 MiB, and retain the original project's Git
605
- tracking checks. Malformed or mismatched patches, changed project inputs and
613
+ copy relevant inputs only, are bounded to 100,000 files and 2 GiB, and retain the
614
+ original project's Git tracking checks. Malformed or mismatched patches, changed project inputs and
606
615
  cancelled checks leave source unchanged. Write failures roll back applied entries.
607
616
 
608
617
  Acceptance refreshes discovery, generated branding and previews. Configuration
@@ -630,6 +639,14 @@ fixtures. `ads_show_tokens({category})` selects a discovered token scenario;
630
639
  omitting category selects the first token entry. The tool contains no project
631
640
  token templates or copied values.
632
641
 
642
+ Both tools default to `waitFor: "verified"`. The showcase requests
643
+ `waitFor: "compiled"` to browse live feedback or the last verified graph while
644
+ checks run. That mode can return `build.current: false`; it is visual feedback,
645
+ not successful verification evidence. It does not alter capture, behavior or
646
+ guarded-edit acceptance. Legacy HTML compilers retain their existing wait path.
647
+ Registered browser verification URLs and `openPreviewScenario` explicitly select
648
+ `waitFor=verified`; captures also retain verified readiness.
649
+
633
650
  ### One App, shared resources
634
651
 
635
652
  With the resource compiler enabled, both tools link **`ui://ads/preview`**. Their
@@ -652,6 +669,7 @@ the tool result. `resources/read` supplies these registered resources:
652
669
  |-----|-------------------|
653
670
  | `ui://ads/preview` | Tool-owned App bootstrap, official App SDK and resource loader |
654
671
  | `ads://preview/manifest` | Project compiler's versioned scenario/dependency graph |
672
+ | `ads://preview/live` | Current-source compiled feedback while checks are pending; explicitly unverified |
655
673
  | `ads://assets/<hash>.js` | Compiled shared runtime or scenario module |
656
674
  | `ads://assets/<hash>.css` | Extracted foundation or scenario styles |
657
675
  | `ads://assets/<hash>.woff2` (and other asset types) | Binary font/image/worker assets |
@@ -722,8 +740,12 @@ and native-client evidence is recorded in [compatibility notes](#protocols-notif
722
740
  Host context selects the project's light/dark theme and conveys available space.
723
741
  It does not silently replace project tokens/fonts with a host palette.
724
742
  Compositions retain the complete project skin. App readiness uses standard Apps
725
- initialization plus optional structured `ads-preview` logging (`loading`, `ready`,
726
- `error`); no custom parent-window readiness message is required.
743
+ initialization plus optional structured `ads-preview` logging (`loading`,
744
+ `checking`, `reverting`, `ready`, `error`); no custom parent-window readiness
745
+ message is required. `checking` never establishes verified App readiness. The
746
+ showcase puts these states in a small monochrome header indicator with tooltip
747
+ and expandable details; it keeps status and loading overlays out of the widget
748
+ area. Other Apps hosts retain the in-App status fallback.
727
749
 
728
750
  ### Configure the project compiler
729
751
 
@@ -810,19 +832,45 @@ Linaria, shared foundation or validation configuration. Upgrade the project ADS
810
832
  dependency and restart its managed compiler to load the helper. Merely upgrading
811
833
  the server does not convert a custom project adapter to incremental compilation.
812
834
 
813
- On first demand, the adapter builds a shared graph for all registered scenarios.
814
- A selection loads only its static dependency closure. Validation and compilation
815
- run together; both must succeed before publication. `.ds/preview-cache.json`
835
+ Watched resource builds reuse self-contained IIFE worker bundles through the same
836
+ helper. `new Worker(new URL("./worker.ts", import.meta.url))`, `?worker` and
837
+ `?worker&url` imports use Vite's configured worker compiler on first demand, then
838
+ reuse its output while tracked source/configuration/dependency contents and
839
+ resolution directories match. Requests for one worker share the same pending
840
+ build. Every preview still receives its worker assets. Changed transitive inputs
841
+ rebuild the affected bundle; topology changes may invalidate more. Nested,
842
+ inline and split workers keep the normal Vite compilation path. No project names
843
+ or manually maintained worker dependency lists are needed.
844
+
845
+ On first demand or accepted-edit preparation, the adapter builds a shared graph for all registered scenarios.
846
+ A selection loads only its static dependency closure. Both validation and compilation
847
+ must succeed before verified publication. Watched compilation
848
+ can publish a separate live graph first, with `build.live.validated: false` and
849
+ `build.current: false`. Live reads require the current source digest and session;
850
+ they write no accepted scenario artifact or successful graph cache. The App
851
+ renders that feedback while checks run and restores the last verified graph on
852
+ failure. Validation and semantic registry inspection run off the visual update
853
+ path; new checks start after compilation, and rapid edits coalesce behind one
854
+ verification run. Compiled syntax errors
855
+ surface immediately. `.ds/preview-cache.json`
816
856
  reuses successful validation/output only when inputs, compiler/tool code,
817
857
  lockfile, recorded dependencies and content digests match. A source edit
818
858
  revalidates the project and incrementally updates the watched module graph. Both
819
- must succeed against unchanged source before atomic publication; a failed or
859
+ must succeed against unchanged source before verified atomic publication; a failed or
820
860
  superseded build cannot become current. Files outside Rollup's graph still trigger
821
861
  validation and a reconciled build. Preview refresh retains the selected view's
822
862
  state when its complete static module/style/asset closure is unchanged, while
823
863
  rerunning its token/paint audits against the new manifest. Actual selected-view
824
864
  changes remount it. Normal application builds retain their own chunking and optimization.
825
865
 
866
+ Accepted MCP edits enqueue preparation even without an open preview. Matching
867
+ validated candidate graphs seed the same project cache; location-dependent,
868
+ missing or incompatible output falls back to the normal compiler. A connected
869
+ showcase opportunistically prefetches changed peers' static resources after the
870
+ selected view paints, using its existing integrity-checked byte cache. This does
871
+ not import modules, attach styles or mount hidden examples; dynamic imports stay
872
+ lazy. Preparation is bounded and never establishes passing evidence by itself.
873
+
826
874
  The graph lives beside the configured manifest, under `assets/`. Tiny
827
875
  `.ds/scenarios/<id>/index.html` descriptors retain the reporter/registry contract;
828
876
  they are not standalone runnable previews. Six previous graph revisions retain
@@ -1240,3 +1288,48 @@ maintenance when needed. `ads_status.reports` identifies the two intake tools,
1240
1288
  storage directory and `ads://guides/reporting`, without listing report contents.
1241
1289
  All five skills include the same portable
1242
1290
  [reporting reference](../skills/ads-designer/references/reporting.md).
1291
+
1292
+ ## Complete and affected validation
1293
+
1294
+ `ads_validate({})` and `ads validate` share the full validation engine.
1295
+ `ads_validate({scope:"changed"})` matches `ads validate --changed`. The MCP tool
1296
+ runs trusted configured project commands with cancellation and bounded output; it
1297
+ is available with source mutations disabled and writes only build/evidence output
1298
+ when project commands honor their checking contract. Summaries include scope,
1299
+ requestedScope, fallback reason, sourceRevision, current, elapsedMs and resultId.
1300
+ Read diagnostics/checks/outcomes with `ads_results`; progress and the latest
1301
+ validation summary are in `ads_status.validation`. Retention is latest per kind:
1302
+ validation, verification and mutation are independent.
1303
+
1304
+ Read `ads://guides/validation` for trigger guidance, baseline expansion, test
1305
+ boundaries, script selection and limits. Full audits include configured scripts
1306
+ and registered guarantees; changed mode narrows behavior owners while core and
1307
+ opaque project scripts remain complete. Neither mode rewrites npm test commands
1308
+ or treats compiled live previews as verification evidence.
1309
+
1310
+ Source freshness covers the configured ADS and UI roots, public assets, local
1311
+ imports/workers/assets, registered configuration and command entrypoints, package
1312
+ manifests/locks/patches, and supported project tests with their dependencies.
1313
+ Unrelated native/backend/documentation changes do not reject an ADS mutation or
1314
+ stale its preview. Every patched file remains protected, including documentation.
1315
+ Changes to either the original or proposed configuration's inputs reject a stale
1316
+ candidate; validation commands that write candidate source still fail.
1317
+ Unrelated source symlinks are omitted from the temporary copy; tracked source
1318
+ paths retain their symlink checks.
1319
+ The HTTP host uses its shared observer for change detection. Serving immutable
1320
+ resource bytes does not initialize a second source/build scan per request, and
1321
+ still verifies the resource digest. Explicit status and validation retain their
1322
+ freshness checks.
1323
+
1324
+ For opaque command inputs that static imports cannot reveal, add project-relative
1325
+ files or directories to `validation.inputs`, for example:
1326
+
1327
+ ```json
1328
+ { "validation": { "inputs": ["schemas/ui.json", "tools/check-data"] } }
1329
+ ```
1330
+
1331
+ These are additive source paths, not globs or exclusions. Missing paths are tracked
1332
+ so later creation invalidates evidence. Dependencies, metadata and generated output
1333
+ are not source inputs. The setting defaults to an empty list and accepts up to 200
1334
+ unique canonical paths below the project root. Declare data read dynamically by
1335
+ selected commands; ADS cannot infer arbitrary filesystem access inside a command.