@reqvire-org/ads 0.3.29 → 0.3.32

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 (38) hide show
  1. package/dist/config.mjs +7 -2
  2. package/dist/mcp/apps.mjs +3 -1
  3. package/dist/mcp/build-status.mjs +1 -1
  4. package/dist/mcp/mutations.mjs +49 -8
  5. package/dist/mcp/server.mjs +14 -10
  6. package/dist/preview-files.mjs +19 -12
  7. package/dist/preview-inputs.mjs +6 -17
  8. package/dist/preview-resources.mjs +25 -3
  9. package/dist/project-documents.mjs +4 -0
  10. package/dist/scenario-trace.mjs +2 -1
  11. package/dist/showcase/client.bundle.js +23 -23
  12. package/dist/showcase/index.html +2 -2
  13. package/dist/showcase/style.css +7 -0
  14. package/dist/skills/ads-break-ui/references/behaviors.md +2 -0
  15. package/dist/skills/ads-break-ui/references/layers.md +6 -0
  16. package/dist/skills/ads-break-ui/references/validation.md +16 -0
  17. package/dist/skills/ads-designer/references/behaviors.md +2 -0
  18. package/dist/skills/ads-designer/references/layers.md +6 -0
  19. package/dist/skills/ads-designer/references/validation.md +16 -0
  20. package/dist/skills/ads-import/references/behaviors.md +2 -0
  21. package/dist/skills/ads-import/references/layers.md +6 -0
  22. package/dist/skills/ads-import/references/validation.md +16 -0
  23. package/dist/skills/ads-motion/references/behaviors.md +2 -0
  24. package/dist/skills/ads-motion/references/layers.md +6 -0
  25. package/dist/skills/ads-motion/references/validation.md +16 -0
  26. package/dist/skills/ads-port/references/behaviors.md +2 -0
  27. package/dist/skills/ads-port/references/layers.md +6 -0
  28. package/dist/skills/ads-port/references/validation.md +16 -0
  29. package/dist/test-boundaries.mjs +3 -2
  30. package/dist/units.mjs +8 -2
  31. package/dist/validation-inputs.mjs +142 -0
  32. package/dist/validation.mjs +3 -17
  33. package/docs/ARCHITECTURE.md +26 -5
  34. package/docs/BEHAVIORS.md +2 -0
  35. package/docs/CHANGELOG.md +49 -0
  36. package/docs/GUIDE.md +2 -0
  37. package/docs/MCP.md +38 -4
  38. package/package.json +1 -1
@@ -10,8 +10,8 @@
10
10
  <button data-section="patterns"><svg viewBox="0 0 16 16"><rect x="2" y="2" width="5" height="5"/><rect x="10" y="2" width="4" height="5"/><rect x="2" y="10" width="5" height="4"/><rect x="10" y="10" width="4" height="4"/></svg>Patterns</button>
11
11
  <button data-section="composition"><svg viewBox="0 0 16 16"><path d="M2 2h4v4H2zM10 2h4v4h-4zM2 10h4v4H2zM10 10h4v4h-4z"/></svg>Composition</button>
12
12
  </nav>
13
- <div class="actions"><button id="preview-status" data-phase="opening" aria-label="Preview status: Connecting to ADS MCP…" title="Connecting to ADS MCP…" popovertarget="status-details"><span class="status-dot" aria-hidden="true"></span></button><div id="status-details" popover><p id="status" role="status">Connecting to ADS MCP…</p></div><button id="theme" aria-label="Use dark theme" title="Use dark theme"><svg viewBox="0 0 16 16"><path d="M13.5 9a5.5 5.5 0 0 1-6.5-6.5A5.5 5.5 0 1 0 13.5 9Z"/></svg></button><button id="minimize" aria-label="Minimize showcase menu" title="Minimize showcase menu (refresh to restore)"><svg viewBox="0 0 16 16"><path d="m4 10 4-4 4 4"/></svg></button></div>
13
+ <div class="actions"><button id="preview-status" data-phase="opening" aria-label="Preview status: Connecting to ADS MCP…" title="Connecting to ADS MCP…" popovertarget="status-details"><span class="status-dot" aria-hidden="true"></span></button><div id="status-details" popover><p id="status" role="status">Connecting to ADS MCP…</p></div><button id="viewport" aria-label="Phone viewport" aria-pressed="false" aria-controls="frame-slot" title="Preview at phone width (390 px)"><svg viewBox="0 0 16 16" aria-hidden="true"><rect x="4" y="1" width="8" height="14" rx="1.5"/><path d="M7 12.5h2"/></svg></button><button id="theme" aria-label="Use dark theme" title="Use dark theme"><svg viewBox="0 0 16 16"><path d="M13.5 9a5.5 5.5 0 0 1-6.5-6.5A5.5 5.5 0 1 0 13.5 9Z"/></svg></button><button id="minimize" aria-label="Minimize showcase menu" title="Minimize showcase menu (refresh to restore)"><svg viewBox="0 0 16 16"><path d="m4 10 4-4 4 4"/></svg></button></div>
14
14
  </header>
15
- <main><aside id="sidebar"><nav id="entries" aria-label="Tokens"></nav></aside><section id="preview" aria-label="Preview"><div id="frame-slot"></div></section></main>
15
+ <main><aside id="sidebar"><nav id="entries" aria-label="Tokens"></nav></aside><section id="preview" aria-label="Preview"><div id="loader" role="status" aria-label="Loading preview" hidden><span class="spinner" aria-hidden="true"></span></div><div id="frame-slot"></div></section></main>
16
16
  <script type="module" src="/client.js"></script>
17
17
  </body></html>
@@ -9,3 +9,10 @@ main{flex:1;min-height:0;display:flex}#sidebar{width:var(--pane-width);flex:none
9
9
  /* The capture host keeps the same MCP client/bridge and gives the App the exact requested viewport. */
10
10
  .entry-group{min-width:0}.entry-group summary{cursor:pointer;padding:8px;font-weight:600;overflow-wrap:anywhere}.entry-group summary:focus-visible{outline:2px solid var(--frame-ink);outline-offset:-2px}.entry-group>div{display:flex;flex-direction:column;gap:4px;padding-inline-start:8px}
11
11
  :root[data-capture="true"] #header,:root[data-capture="true"] #sidebar{display:none!important}
12
+
13
+ /* A different selection loads in the preview pane; edits keep using the header ring. */
14
+ #loader{position:absolute;inset:0;z-index:2;display:grid;place-items:center;background:var(--frame-bg)}.spinner{width:24px;height:24px;border:2px solid var(--frame-line);border-top-color:var(--frame-ink);border-radius:50%;animation:spin .8s linear infinite}@keyframes spin{to{transform:rotate(360deg)}}@media(prefers-reduced-motion:reduce){.spinner{animation:none}}
15
+
16
+ /* A real iframe viewport keeps phone previews responsive without changing the app host. */
17
+ :root[data-viewport="phone"] #frame-slot{width:min(390px,100%);margin-inline:auto}
18
+ #viewport[aria-pressed="true"]{background:var(--frame-ink);color:var(--frame-bg)}
@@ -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.
@@ -17,6 +17,12 @@ Layout parts may arrange `children` without importing several components.
17
17
  Patterns may compose other patterns. A native wrapper or a large implementation
18
18
  does not decide the layer.
19
19
 
20
+ A product workflow's essential controls belong to its pattern. Require their
21
+ typed models and callbacks; reserve optional action slots for extensions. Its
22
+ independent scenario and registered checks must exercise those controls instead
23
+ of adding them only in composition fixtures. ADS enforces the declared API and
24
+ checks; it cannot infer application requirements that were never modeled.
25
+
20
26
  An **application adapter** supplies domain data, store access, route state and
21
27
  navigation/service callbacks. Domain-shaped inputs are valid in project-owned
22
28
  patterns; importing a particular application store/router is not.
@@ -29,6 +29,22 @@ mandatory. Commands are trusted project configuration, never MCP arguments.
29
29
  Use scripts that check/build without changing source. Avoid calling `ads validate`
30
30
  from a script selected by validation.
31
31
 
32
+ Freshness tracks ADS and consuming UI roots, public assets, their local dependency
33
+ chains, registered configuration/command entrypoints, package files, and supported
34
+ project tests plus helpers. Unrelated native/backend/docs edits can continue during
35
+ validation. Patched files are always fenced. For selected commands that read files
36
+ dynamically, declare those project-relative source files or directories in
37
+ `validation.inputs`, for example `["schemas/ui.json", "tools/check-data"]`. These
38
+ paths add to mandatory inputs; use no globs, generated output, dependencies or
39
+ metadata. A missing declared path is tracked when it is created later. Do not
40
+ remove a real input to make stale evidence pass. After changing this configuration,
41
+ run full validation.
42
+
43
+ Guarded edits copy these inputs and patched files into an isolated candidate,
44
+ with a 100,000-file / 2 GiB allowance. Native build artifacts outside the input
45
+ graph consume no copy budget. Selected commands must declare opaque data they
46
+ read outside the UI graph. The whole candidate is checked for source rewrites.
47
+
32
48
  Changed mode compares current content, including added/deleted files, with the
33
49
  last successful full baseline in `.ds/validation-baseline.json`. No Git history is
34
50
  required. A missing/incompatible baseline or a change to configuration, foundation,
@@ -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.
@@ -17,6 +17,12 @@ Layout parts may arrange `children` without importing several components.
17
17
  Patterns may compose other patterns. A native wrapper or a large implementation
18
18
  does not decide the layer.
19
19
 
20
+ A product workflow's essential controls belong to its pattern. Require their
21
+ typed models and callbacks; reserve optional action slots for extensions. Its
22
+ independent scenario and registered checks must exercise those controls instead
23
+ of adding them only in composition fixtures. ADS enforces the declared API and
24
+ checks; it cannot infer application requirements that were never modeled.
25
+
20
26
  An **application adapter** supplies domain data, store access, route state and
21
27
  navigation/service callbacks. Domain-shaped inputs are valid in project-owned
22
28
  patterns; importing a particular application store/router is not.
@@ -29,6 +29,22 @@ mandatory. Commands are trusted project configuration, never MCP arguments.
29
29
  Use scripts that check/build without changing source. Avoid calling `ads validate`
30
30
  from a script selected by validation.
31
31
 
32
+ Freshness tracks ADS and consuming UI roots, public assets, their local dependency
33
+ chains, registered configuration/command entrypoints, package files, and supported
34
+ project tests plus helpers. Unrelated native/backend/docs edits can continue during
35
+ validation. Patched files are always fenced. For selected commands that read files
36
+ dynamically, declare those project-relative source files or directories in
37
+ `validation.inputs`, for example `["schemas/ui.json", "tools/check-data"]`. These
38
+ paths add to mandatory inputs; use no globs, generated output, dependencies or
39
+ metadata. A missing declared path is tracked when it is created later. Do not
40
+ remove a real input to make stale evidence pass. After changing this configuration,
41
+ run full validation.
42
+
43
+ Guarded edits copy these inputs and patched files into an isolated candidate,
44
+ with a 100,000-file / 2 GiB allowance. Native build artifacts outside the input
45
+ graph consume no copy budget. Selected commands must declare opaque data they
46
+ read outside the UI graph. The whole candidate is checked for source rewrites.
47
+
32
48
  Changed mode compares current content, including added/deleted files, with the
33
49
  last successful full baseline in `.ds/validation-baseline.json`. No Git history is
34
50
  required. A missing/incompatible baseline or a change to configuration, foundation,
@@ -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.
@@ -17,6 +17,12 @@ Layout parts may arrange `children` without importing several components.
17
17
  Patterns may compose other patterns. A native wrapper or a large implementation
18
18
  does not decide the layer.
19
19
 
20
+ A product workflow's essential controls belong to its pattern. Require their
21
+ typed models and callbacks; reserve optional action slots for extensions. Its
22
+ independent scenario and registered checks must exercise those controls instead
23
+ of adding them only in composition fixtures. ADS enforces the declared API and
24
+ checks; it cannot infer application requirements that were never modeled.
25
+
20
26
  An **application adapter** supplies domain data, store access, route state and
21
27
  navigation/service callbacks. Domain-shaped inputs are valid in project-owned
22
28
  patterns; importing a particular application store/router is not.
@@ -29,6 +29,22 @@ mandatory. Commands are trusted project configuration, never MCP arguments.
29
29
  Use scripts that check/build without changing source. Avoid calling `ads validate`
30
30
  from a script selected by validation.
31
31
 
32
+ Freshness tracks ADS and consuming UI roots, public assets, their local dependency
33
+ chains, registered configuration/command entrypoints, package files, and supported
34
+ project tests plus helpers. Unrelated native/backend/docs edits can continue during
35
+ validation. Patched files are always fenced. For selected commands that read files
36
+ dynamically, declare those project-relative source files or directories in
37
+ `validation.inputs`, for example `["schemas/ui.json", "tools/check-data"]`. These
38
+ paths add to mandatory inputs; use no globs, generated output, dependencies or
39
+ metadata. A missing declared path is tracked when it is created later. Do not
40
+ remove a real input to make stale evidence pass. After changing this configuration,
41
+ run full validation.
42
+
43
+ Guarded edits copy these inputs and patched files into an isolated candidate,
44
+ with a 100,000-file / 2 GiB allowance. Native build artifacts outside the input
45
+ graph consume no copy budget. Selected commands must declare opaque data they
46
+ read outside the UI graph. The whole candidate is checked for source rewrites.
47
+
32
48
  Changed mode compares current content, including added/deleted files, with the
33
49
  last successful full baseline in `.ds/validation-baseline.json`. No Git history is
34
50
  required. A missing/incompatible baseline or a change to configuration, foundation,
@@ -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.
@@ -17,6 +17,12 @@ Layout parts may arrange `children` without importing several components.
17
17
  Patterns may compose other patterns. A native wrapper or a large implementation
18
18
  does not decide the layer.
19
19
 
20
+ A product workflow's essential controls belong to its pattern. Require their
21
+ typed models and callbacks; reserve optional action slots for extensions. Its
22
+ independent scenario and registered checks must exercise those controls instead
23
+ of adding them only in composition fixtures. ADS enforces the declared API and
24
+ checks; it cannot infer application requirements that were never modeled.
25
+
20
26
  An **application adapter** supplies domain data, store access, route state and
21
27
  navigation/service callbacks. Domain-shaped inputs are valid in project-owned
22
28
  patterns; importing a particular application store/router is not.
@@ -29,6 +29,22 @@ mandatory. Commands are trusted project configuration, never MCP arguments.
29
29
  Use scripts that check/build without changing source. Avoid calling `ads validate`
30
30
  from a script selected by validation.
31
31
 
32
+ Freshness tracks ADS and consuming UI roots, public assets, their local dependency
33
+ chains, registered configuration/command entrypoints, package files, and supported
34
+ project tests plus helpers. Unrelated native/backend/docs edits can continue during
35
+ validation. Patched files are always fenced. For selected commands that read files
36
+ dynamically, declare those project-relative source files or directories in
37
+ `validation.inputs`, for example `["schemas/ui.json", "tools/check-data"]`. These
38
+ paths add to mandatory inputs; use no globs, generated output, dependencies or
39
+ metadata. A missing declared path is tracked when it is created later. Do not
40
+ remove a real input to make stale evidence pass. After changing this configuration,
41
+ run full validation.
42
+
43
+ Guarded edits copy these inputs and patched files into an isolated candidate,
44
+ with a 100,000-file / 2 GiB allowance. Native build artifacts outside the input
45
+ graph consume no copy budget. Selected commands must declare opaque data they
46
+ read outside the UI graph. The whole candidate is checked for source rewrites.
47
+
32
48
  Changed mode compares current content, including added/deleted files, with the
33
49
  last successful full baseline in `.ds/validation-baseline.json`. No Git history is
34
50
  required. A missing/incompatible baseline or a change to configuration, foundation,
@@ -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.
@@ -17,6 +17,12 @@ Layout parts may arrange `children` without importing several components.
17
17
  Patterns may compose other patterns. A native wrapper or a large implementation
18
18
  does not decide the layer.
19
19
 
20
+ A product workflow's essential controls belong to its pattern. Require their
21
+ typed models and callbacks; reserve optional action slots for extensions. Its
22
+ independent scenario and registered checks must exercise those controls instead
23
+ of adding them only in composition fixtures. ADS enforces the declared API and
24
+ checks; it cannot infer application requirements that were never modeled.
25
+
20
26
  An **application adapter** supplies domain data, store access, route state and
21
27
  navigation/service callbacks. Domain-shaped inputs are valid in project-owned
22
28
  patterns; importing a particular application store/router is not.
@@ -29,6 +29,22 @@ mandatory. Commands are trusted project configuration, never MCP arguments.
29
29
  Use scripts that check/build without changing source. Avoid calling `ads validate`
30
30
  from a script selected by validation.
31
31
 
32
+ Freshness tracks ADS and consuming UI roots, public assets, their local dependency
33
+ chains, registered configuration/command entrypoints, package files, and supported
34
+ project tests plus helpers. Unrelated native/backend/docs edits can continue during
35
+ validation. Patched files are always fenced. For selected commands that read files
36
+ dynamically, declare those project-relative source files or directories in
37
+ `validation.inputs`, for example `["schemas/ui.json", "tools/check-data"]`. These
38
+ paths add to mandatory inputs; use no globs, generated output, dependencies or
39
+ metadata. A missing declared path is tracked when it is created later. Do not
40
+ remove a real input to make stale evidence pass. After changing this configuration,
41
+ run full validation.
42
+
43
+ Guarded edits copy these inputs and patched files into an isolated candidate,
44
+ with a 100,000-file / 2 GiB allowance. Native build artifacts outside the input
45
+ graph consume no copy budget. Selected commands must declare opaque data they
46
+ read outside the UI graph. The whole candidate is checked for source rewrites.
47
+
32
48
  Changed mode compares current content, including added/deleted files, with the
33
49
  last successful full baseline in `.ds/validation-baseline.json`. No Git history is
34
50
  required. A missing/incompatible baseline or a change to configuration, foundation,
@@ -3,11 +3,12 @@ import path from "node:path";
3
3
  import ts from "typescript";
4
4
  import { adsFileRole, isInside, isDevelopmentFile, isTestFile } from "./config.mjs";
5
5
  import { importResolver } from "./boundaries.mjs";
6
- import { previewFileIgnored } from "./preview-files.mjs";
6
+ import { createPreviewFileFilter } from "./preview-files.mjs";
7
7
 
8
8
  /** Test ownership is structural; arbitrary assertion intent remains the runner's concern. */
9
9
  export function inspectTestBoundaries(options, inventory, contracts, program) {
10
10
  const diagnostics = [], resolve = importResolver(options), parsed = new Map(), tests = [];
11
+ const ignored = createPreviewFileFilter(options);
11
12
  const owner = file => inventory.owner(inventory.relative(path.relative(options.root,file)));
12
13
  function source(file) {
13
14
  if (!parsed.has(file)) parsed.set(file,program?.getSourceFile(file) ?? ts.createSourceFile(file,readFileSync(file,"utf8"),ts.ScriptTarget.Latest,true));
@@ -16,7 +17,7 @@ export function inspectTestBoundaries(options, inventory, contracts, program) {
16
17
  function walk(directory) {
17
18
  for (const entry of readdirSync(directory,{withFileTypes:true})) {
18
19
  const file = path.join(directory,entry.name);
19
- if (entry.isSymbolicLink() || previewFileIgnored(options,file) || ["output","test-results","playwright-report",".playwright-cli"].includes(entry.name)) continue;
20
+ if (entry.isSymbolicLink() || ignored(file) || ["output","test-results","playwright-report",".playwright-cli"].includes(entry.name)) continue;
20
21
  if (entry.isDirectory()) walk(file);
21
22
  else if (entry.isFile() && /\.[cm]?[jt]sx?$/.test(file) && isTestFile(file)) {
22
23
  let executable=/\.(?:test|spec)\.[cm]?[jt]sx?$/.test(file);
package/dist/units.mjs CHANGED
@@ -20,7 +20,13 @@ export function configurationFiles(options) {
20
20
  }
21
21
  const resolve = importResolver(options), visited = new Set();
22
22
  function visit(file, entrypoint = false, typeConfig = false) {
23
- if (!isInside(root, file) || file === root || /(?:^|[\\/])(?:node_modules|\.git|\.ds|dist)(?:[\\/]|$)/.test(path.relative(root, file)) || visited.has(file) || !existsSync(file)) return;
23
+ if (!isInside(root, file) || file === root || /(?:^|[\\/])(?:node_modules|\.git|\.ds|dist)(?:[\\/]|$)/.test(path.relative(root, file)) || visited.has(file)) return;
24
+ if (!existsSync(file)) {
25
+ // A proposed package script can refer to a live input that has not yet
26
+ // entered the isolated candidate. Keep its path so it can be copied.
27
+ if (entrypoint) files.add(slash(path.relative(root, file)));
28
+ return;
29
+ }
24
30
  // Registering a test command must not reassign its colocated checks or
25
31
  // fixtures to configuration. Those remain in the behavior owner's patch.
26
32
  if (isInside(dsRoot, file) && isDevelopmentFile(file, options)) return;
@@ -66,7 +72,7 @@ export function configurationFiles(options) {
66
72
  for (const match of command.matchAll(/\b(?:npm|bun)\s+run\s+([\w:.-]+)/g)) script(match[1]);
67
73
  for (const match of command.matchAll(/\b(?:node|bun|tsx|ts-node)\s+([^\s;&|]+\.[cm]?[jt]sx?)(?=\s|$)/g)) visit(path.resolve(root, match[1]), true);
68
74
  }
69
- for (const name of ["lint:ds", "lint:style", "lint:project", "typecheck", "build:mcp-previews", "generate:icons", "build:lib", "build:app", ...(config.validation?.checks ?? []), ...(config.mcp.mutationChecks ?? [])]) script(name);
75
+ for (const name of ["lint:ds", "lint:style", "lint:project", "typecheck", "test", "build", "build:mcp-previews", "generate:icons", "build:lib", "build:app", ...(config.validation?.checks ?? []), ...(config.mcp.mutationChecks ?? [])]) script(name);
70
76
  const watch = config.mcp.previewWatch;
71
77
  if (watch) {
72
78
  if (["npm", "bun"].includes(watch.command) && watch.args[0] === "run") script(watch.args[1]);
@@ -0,0 +1,142 @@
1
+ import { createHash } from "node:crypto";
2
+ import { existsSync, lstatSync, readFileSync, readdirSync, realpathSync } from "node:fs";
3
+ import path from "node:path";
4
+ import ts from "typescript";
5
+ import postcss from "postcss";
6
+ import valueParser from "postcss-value-parser";
7
+ import { defaultConfig, isInside, isTestFile } from "./config.mjs";
8
+ import { importResolver } from "./boundaries.mjs";
9
+ import { configurationFiles } from "./units.mjs";
10
+ import { createPreviewFileFilter } from "./preview-files.mjs";
11
+ import { projectNoticeFiles } from "./project-documents.mjs";
12
+
13
+ const digest = file => `sha256:${createHash("sha256").update(readFileSync(file)).digest("hex")}`;
14
+ const ignored = new Set(["output", "test-results", "playwright-report", ".playwright-cli"]);
15
+ const script = /\.[cm]?[jt]sx?$/;
16
+ const slash = file => file.replaceAll("\\", "/");
17
+ // Cache only parsed references by content, never freshness or file resolution.
18
+ // Every inventory still reads bytes and resolves against the current project.
19
+ const parsedScripts = new Map();
20
+ function references(file, content, revision) {
21
+ const key=`${path.extname(file)}:${revision}`;
22
+ if (parsedScripts.has(key)) return parsedScripts.get(key);
23
+ const imports=[],assets=[],ast=ts.createSourceFile(file,content.toString("utf8"),ts.ScriptTarget.Latest,true);
24
+ function walk(node) {
25
+ if ((ts.isImportDeclaration(node)||ts.isExportDeclaration(node)) && node.moduleSpecifier && ts.isStringLiteralLike(node.moduleSpecifier)) imports.push(node.moduleSpecifier.text);
26
+ if (ts.isCallExpression(node) && (node.expression.kind===ts.SyntaxKind.ImportKeyword || ts.isIdentifier(node.expression)&&node.expression.text==="require" || ts.isPropertyAccessExpression(node.expression)&&node.expression.getText(ast)==="require.resolve") && node.arguments[0] && ts.isStringLiteralLike(node.arguments[0])) imports.push(node.arguments[0].text);
27
+ if (ts.isNewExpression(node)&&ts.isIdentifier(node.expression)&&node.expression.text==="URL"&&node.arguments?.[0]&&ts.isStringLiteralLike(node.arguments[0])) assets.push(node.arguments[0].text);
28
+ ts.forEachChild(node,walk);
29
+ }
30
+ walk(ast);
31
+ if (parsedScripts.size>=2048) parsedScripts.delete(parsedScripts.keys().next().value);
32
+ const result={imports,assets};parsedScripts.set(key,result);return result;
33
+ }
34
+
35
+ /** Mandatory UI/guard inputs, real local dependencies and declared opaque inputs. */
36
+ export function validationInputFiles(options, extraFiles = [], {maxFiles=Infinity,maxBytes=Infinity} = {}) {
37
+ const supplied=options.config;
38
+ const normalized={...defaultConfig,...supplied,assets:{...defaultConfig.assets,...supplied.assets},mcp:{...defaultConfig.mcp,...supplied.mcp},oxlint:{...defaultConfig.oxlint,...supplied.oxlint}};
39
+ options = { ...options, config:normalized, dsRoot: options.dsRoot ?? path.resolve(options.root,normalized.dsDir), sourceRoot: options.sourceRoot ?? path.resolve(options.root,normalized.sourceDir) };
40
+ const { root, config } = options, files = new Map(), visited = new Set(), resolve = importResolver(options);
41
+ const previewIgnored = createPreviewFileFilter(options);
42
+ let inputBytes=0,inputCount=0;
43
+ const safeDirectories=new Set([root]);
44
+ function checkParent(directory) {
45
+ if (safeDirectories.has(directory)) return;
46
+ checkParent(path.dirname(directory));
47
+ const stat=lstatSync(directory);
48
+ if (stat.isSymbolicLink() || !stat.isDirectory()) throw new Error(`Validation input cannot resolve through a symlink: ${slash(path.relative(root,directory))}`);
49
+ safeDirectories.add(directory);
50
+ }
51
+ const outputs = new Set((config.mcp.apps??[]).map(app => path.resolve(root, app.file)));
52
+ const covered=[options.dsRoot,options.sourceRoot,...config.assets.publicDirs.map(file=>path.resolve(root,file))];
53
+ const forced = new Set(extraFiles.filter(file=>file!=="installed-dependencies").map(file=>path.resolve(root,file)));
54
+ function excluded(file) {
55
+ return previewIgnored(file) || outputs.has(file) || path.relative(root,file).split(path.sep).some(name=>ignored.has(name)) || [".gitkeep",".keep"].includes(path.basename(file)) || file.endsWith(".tsbuildinfo");
56
+ }
57
+ for (const file of config.validation?.inputs??[]) if (excluded(path.resolve(root,file))) throw new Error(`validation.inputs must name source inputs, not generated output or metadata: ${file}`);
58
+ function visit(file) {
59
+ file = path.resolve(file);
60
+ if (!isInside(root, file) || !forced.has(file) && excluded(file)) return;
61
+ const relative = slash(path.relative(root, file));
62
+ if (visited.has(file)) return;
63
+ visited.add(file);
64
+ let stat;
65
+ try { stat=lstatSync(file); } catch(error) { if(error.code!=="ENOENT"&&error.code!=="ENOTDIR")throw error;files.set(relative,null);return; }
66
+ if (file!==root) checkParent(path.dirname(file));
67
+ if (stat.isSymbolicLink()) throw new Error(`Validation input cannot resolve through a symlink: ${relative}`);
68
+ if (stat.isDirectory()) {
69
+ safeDirectories.add(file);
70
+ for (const entry of readdirSync(file).sort()) visit(path.join(file,entry));
71
+ return;
72
+ }
73
+ if (!stat.isFile()) return;
74
+ if (++inputCount>maxFiles || (inputBytes+=stat.size)>maxBytes) throw Object.assign(new Error("Relevant inputs exceed the bounded validation snapshot limit."),{code:"ADS_INPUT_LIMIT"});
75
+ const content=readFileSync(file),revision=`sha256:${createHash("sha256").update(content).digest("hex")}`;
76
+ files.set(relative, revision);
77
+ for (let directory=path.dirname(file);isInside(root,directory);directory=path.dirname(directory)) {
78
+ const manifest=path.join(directory,"package.json");
79
+ if (existsSync(manifest)) { visit(manifest); break; }
80
+ if (directory===root) break;
81
+ }
82
+ function local(specifier) {
83
+ if (!specifier || /^(?:[a-z][\w+.-]*:|\/|#)/i.test(specifier)) return;
84
+ visit(path.resolve(path.dirname(file),specifier.replace(/[?#].*$/,"")));
85
+ }
86
+ if (script.test(file)) {
87
+ const refs=references(file,content,revision);
88
+ for (const specifier of refs.imports) {
89
+ // Entire mandatory roots are already inventoried. Avoid resolving every
90
+ // colocated import again; directory/package imports still need resolution
91
+ // because a package entry can lead outside its containing root.
92
+ if ([config.publicAlias,`${config.publicAlias}/review`].includes(specifier)) continue;
93
+ if (specifier.startsWith(".")) {
94
+ const base=path.resolve(path.dirname(file),specifier.replace(/[?#].*$/,""));
95
+ if (covered.some(directory=>isInside(directory,base)) && [base,...[".ts",".tsx",".js",".jsx",".mjs",".cjs",".mts",".cts"].map(extension=>base+extension)].some(target=>existsSync(target)&&lstatSync(target).isFile())) continue;
96
+ }
97
+ if (!/^[a-z][\w+.-]*:/i.test(specifier)) for (const dependency of resolve(specifier,file)) {
98
+ const target=existsSync(dependency) ? realpathSync(dependency) : dependency;
99
+ if (!target.split(path.sep).includes("node_modules")) {
100
+ visit(target);
101
+ // TypeScript may resolve a JavaScript import to its declaration.
102
+ // Candidate builds need the runtime beside that declaration too,
103
+ // including its own imports and asset references.
104
+ const extension = /\.d\.(ts|mts|cts)$/.exec(target)?.[1];
105
+ if (extension) {
106
+ const runtime = target.replace(/\.d\.(?:ts|mts|cts)$/, extension === "mts" ? ".mjs" : extension === "cts" ? ".cjs" : ".js");
107
+ if (existsSync(runtime)) visit(runtime);
108
+ }
109
+ }
110
+ }
111
+ }
112
+ for (const asset of refs.assets) local(asset);
113
+ } else if (file.endsWith(".css")) {
114
+ const css=postcss.parse(content.toString("utf8"),{from:file});
115
+ css.walkAtRules("import",rule=>{const first=valueParser(rule.params).nodes.find(node=>!["space","comment"].includes(node.type));if(first?.type==="string")local(first.value);});
116
+ css.walk(node=>{if(node.type==="decl"||node.type==="atrule")valueParser(node.type==="decl"?node.value:node.params).walk(value=>{if(value.type==="function"&&value.value.toLowerCase()==="url")local(value.nodes.filter(part=>part.type!=="space").map(part=>part.value).join(""));});});
117
+ } else if (file.endsWith(".html")) {
118
+ for (const match of content.toString("utf8").matchAll(/\b(?:src|href)\s*=\s*["']([^"']+)["']/g)) local(match[1]);
119
+ }
120
+ }
121
+ // These roots cannot be excluded through optional declarations.
122
+ for (const file of [options.dsRoot,options.sourceRoot,...config.assets.publicDirs.map(file=>path.resolve(root,file)),...configurationFiles(options)].map(file=>path.resolve(root,file))) visit(file);
123
+ for (const file of projectNoticeFiles(root)) visit(path.resolve(root,file));
124
+ for (const file of ["index.html","package-lock.json","npm-shrinkwrap.json","yarn.lock","pnpm-lock.yaml","bun.lock","bun.lockb","bunfig.toml",".npmrc",".yarnrc.yml",...(config.validation?.inputs??[]),...extraFiles]) if(file!=="installed-dependencies") visit(path.resolve(root,file));
125
+ const manifest=path.join(root,"package.json");
126
+ const pkg=existsSync(manifest)?JSON.parse(readFileSync(manifest,"utf8")):{};
127
+ for (const file of Object.values(pkg.patchedDependencies??{})) if(typeof file==="string")visit(path.resolve(root,file));
128
+ // The architecture guard discovers tests anywhere in the project. Retain that
129
+ // coverage, including added tests and their helper/dependency chains.
130
+ function tests(directory) {
131
+ for (const entry of readdirSync(directory,{withFileTypes:true})) {
132
+ const file=path.join(directory,entry.name);
133
+ if(entry.isSymbolicLink()||ignored.has(entry.name)||previewIgnored(file))continue;
134
+ if(entry.isDirectory())tests(file);
135
+ else if(entry.isFile()&&script.test(file)&&isTestFile(file))visit(file);
136
+ }
137
+ }
138
+ tests(root);
139
+ const installed=path.join(root,"node_modules/.package-lock.json");
140
+ files.set("installed-dependencies",existsSync(installed)?digest(installed):null);
141
+ return Object.fromEntries([...files].sort(([a],[b])=>a.localeCompare(b)));
142
+ }
@@ -9,7 +9,7 @@ import { createLintConfig } from "./lint-config.mjs";
9
9
  import { inspectUnits } from "./units.mjs";
10
10
  import { inspectBehaviors } from "./behaviors.mjs";
11
11
  import { affectedBehaviorUnits, createVerificationController } from "./verification.mjs";
12
- import { previewFileIgnored } from "./preview-files.mjs";
12
+ import { validationInputFiles } from "./validation-inputs.mjs";
13
13
  import { checkCommand, projectChecks } from "./validation-checks.mjs";
14
14
  import { projectContext } from "./mcp/context.mjs";
15
15
  import { packageScriptCommand } from "./development-runtime.mjs";
@@ -24,23 +24,9 @@ function toolInputs() {
24
24
  visit(root);return rows;
25
25
  }
26
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. */
27
+ /** Shared relevant-input inventory also discovers outside tests and their imports. */
30
28
  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;
29
+ const files = validationInputFiles(options);
44
30
  return { files, revision: hash(JSON.stringify([toolRevision,files])) };
45
31
  }
46
32
 
@@ -493,11 +493,16 @@ selection or skip validation because a module transform was cached.
493
493
  Architecture inspection shares analysis within one immutable TypeScript checker
494
494
  and avoids redundant source discovery. A new inspection still observes current
495
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.
496
498
 
497
499
  After source changes, validation and compilation must both succeed before a new
498
500
  graph becomes current. MCP announces build/resource updates.
499
501
  Build success records the project input digest captured before compilation;
500
- 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
501
506
  publication invalidates the compiler explicitly. Content reconciliation recovers
502
507
  missed atomic file replacements, so OS watch delivery cannot establish freshness.
503
508
  The built-in client uses `waitFor: compiled` for interactive selections, so it
@@ -508,8 +513,10 @@ notifications are reconciled after validation rather than repeating synchronous
508
513
  semantic inspection on the live update path. The App retains or remounts its view
509
514
  according to its dependency closure. A quiet monochrome indicator in the
510
515
  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
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
513
520
  fallback. Invalid scenario metadata at startup and later source
514
521
  failures stay in the watcher's recoverable diagnostic path. Fixing source triggers validation again.
515
522
  If the compiler process exits, the next preview request starts one fresh child;
@@ -588,6 +595,14 @@ This works without Git history and does not cache individual test results. Skill
588
595
  guide agents toward affected checks during editing and full audits after ownership
589
596
  or runner migrations, before releases and for explicit complete validation.
590
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
+
591
606
  Tests follow the same ownership boundaries as implementation: pure ADS tests stay
592
607
  with their owners, marked behavior specs require registration, and private imports
593
608
  cannot cross owners through helpers. Application integration tests stay with their
@@ -618,6 +633,9 @@ The MCP runtime owns its browser hosts and preview builder lifetime. Closing the
618
633
  client connection releases them together; a separate ownership guard can stop
619
634
  detached builders after abrupt owner death. A preview process must not outlive
620
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.
621
639
  Build reports expose queued, validation, compilation and publication progress.
622
640
  A timed-out preview request marks the builder stalled; the next explicit request
623
641
  restarts it within the same MCP session. A running process alone is not freshness.
@@ -626,8 +644,11 @@ Opt-in MCP editing makes validation part of the write operation. The agent sends
626
644
  a Git unified diff for one logical ADS unit: its implementation and owned preview
627
645
  context, or the shared token foundation. ADS resolves file ownership, reconstructs
628
646
  candidate files locally and validates a temporary project copy with architecture
629
- checks, registered lint rules and project validation scripts. Affected registered
630
- 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
631
652
  the isolated candidate project. The project owns its test code and runner policy;
632
653
  ADS owns affected-check selection, candidate hosting, progress, evidence freshness
633
654
  and process cleanup. One profile timeout bounds its entire runner process. Parallel
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.