@reqvire-org/ads 0.3.37 → 0.3.38

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 (36) hide show
  1. package/README.md +3 -1
  2. package/dist/bootstrap-ds/README.md +2 -2
  3. package/dist/bootstrap-ds/package.json +1 -1
  4. package/dist/cli.mjs +9 -1
  5. package/dist/config.mjs +4 -2
  6. package/dist/mcp/preview-owner-guard.mjs +7 -4
  7. package/dist/mcp/preview-widget.bundle.js +46 -47
  8. package/dist/mcp/project-widget.bundle.js +45 -46
  9. package/dist/mcp/server.mjs +5 -0
  10. package/dist/mcp/widget.bundle.js +47 -48
  11. package/dist/preview-bun.mjs +5 -2
  12. package/dist/resource-limits.mjs +146 -0
  13. package/dist/runtime-requirements.mjs +21 -0
  14. package/dist/scenarios-compiler.mjs +4 -3
  15. package/dist/showcase/client.bundle.js +56 -57
  16. package/dist/showcase/sandbox.bundle.js +1 -1
  17. package/dist/skills/ads-break-ui/SKILL.md +3 -2
  18. package/dist/skills/ads-break-ui/references/runtimes.md +85 -1
  19. package/dist/skills/ads-designer/SKILL.md +3 -2
  20. package/dist/skills/ads-designer/assets/bootstrap-ds/README.md +2 -2
  21. package/dist/skills/ads-designer/assets/bootstrap-ds/package.json +1 -1
  22. package/dist/skills/ads-designer/references/cli.md +2 -2
  23. package/dist/skills/ads-designer/references/runtimes.md +85 -1
  24. package/dist/skills/ads-import/SKILL.md +3 -2
  25. package/dist/skills/ads-import/references/cli.md +2 -2
  26. package/dist/skills/ads-import/references/runtimes.md +85 -1
  27. package/dist/skills/ads-motion/SKILL.md +3 -2
  28. package/dist/skills/ads-motion/references/runtimes.md +85 -1
  29. package/dist/skills/ads-port/SKILL.md +3 -2
  30. package/dist/skills/ads-port/references/cli.md +2 -2
  31. package/dist/skills/ads-port/references/runtimes.md +85 -1
  32. package/dist/verification/browser.mjs +8 -8
  33. package/docs/CHANGELOG.md +33 -13
  34. package/docs/GUIDE.md +1 -1
  35. package/docs/MCP.md +22 -2
  36. package/package.json +2 -2
package/README.md CHANGED
@@ -42,6 +42,8 @@ uses Preact. See [implementation support](docs/GUIDE.md#implementation-support).
42
42
  - **Iterate in tracked drafts** without rerunning acceptance checks after every
43
43
  edit. Commit proposals for PR review, compare Accepted/Draft in Explorer, and
44
44
  let the agent accept an exact reviewed revision after required checks pass.
45
+ - **Bound command memory** with project process-tree budgets and reported kernel
46
+ or watchdog enforcement. See [resource budgets](skills/ads-designer/references/runtimes.md#ads-command-memory-limits-ads-0338).
45
47
  - **Verify behavior** through project-owned guarantees and registered tests,
46
48
  with progress, timings and evidence tied to current source.
47
49
  - **Keep contracts explicit** for typed paint inputs, scoped data bindings and
@@ -63,7 +65,7 @@ Drafts survive restart and Git clone, but cannot enter production imports.
63
65
 
64
66
  ## Set up your project
65
67
 
66
- Run **inside your project**, where `package.json` lives. Install Bun 1.3.13+ for
68
+ Run **inside your project**, where `package.json` lives. Install Bun 1.4.1+ for
67
69
  ADS tooling and previews. Your application can continue using Node/npm or Bun.
68
70
 
69
71
  ```sh
@@ -12,7 +12,7 @@ Read the local [contract](ADS.md) and the
12
12
 
13
13
  Copy the contents of `bootstrap-ds/`, including dotfiles, into a new project.
14
14
  The installed `ads-designer` skill contains the same files in
15
- `assets/bootstrap-ds/`. Set the project name in `package.json`. Install Bun 1.3.13+ for ADS tooling and previews. The application can keep its
15
+ `assets/bootstrap-ds/`. Set the project name in `package.json`. Install Bun 1.4.1+ for ADS tooling and previews. The application can keep its
16
16
  Node/npm build pipeline. Use a current ADS release.
17
17
 
18
18
  ```sh
@@ -36,7 +36,7 @@ lockfile and translate nested npm scripts to `bun --bun run`. Initialize with
36
36
  `bunx @reqvire-org/ads init`. Init detects existing
37
37
  Bun projects and preserves their scripts/lockfiles. Use `bun install` and
38
38
  `bun --bun run build`/`bun --bun run dev:showcase`. Node is unnecessary with Bun
39
- 1.3.13+. ADS supplies its Bun preview compiler independently of the project build.
39
+ 1.4.1+. ADS supplies its Bun preview compiler independently of the project build.
40
40
 
41
41
  For an existing application, merge only the ADS source and required extraction,
42
42
  aliases and preview adapter. Preserve its framework, entry points and build.
@@ -6,7 +6,7 @@
6
6
  "description": "Private starter workspace for a project's local React design system.",
7
7
  "engines": {
8
8
  "node": ">=22.12.0",
9
- "bun": ">=1.3.13"
9
+ "bun": ">=1.4.1"
10
10
  },
11
11
  "sideEffects": [
12
12
  "**/*.css"
package/dist/cli.mjs CHANGED
@@ -1,7 +1,9 @@
1
1
  #!/usr/bin/env bun
2
2
  import { readFileSync } from "node:fs";
3
3
  import path from "node:path";
4
- import { checkProject, generateBrandAssets, generateLintConfig, initProject, inspectTokens } from "./index.mjs";
4
+ import { loadConfig } from "./config.mjs";
5
+ import { enterMemoryBudget } from "./resource-limits.mjs";
6
+ import { assertBunRuntime } from "./runtime-requirements.mjs";
5
7
 
6
8
  const pkg = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8"));
7
9
  const help = `ADS ${pkg.version} — tooling for a project's local design system
@@ -40,6 +42,7 @@ No component library or example catalogue is bundled.
40
42
  async function main(args) {
41
43
  if (!args.length || args.includes("--help")) { process.stdout.write(help); return; }
42
44
  if (args.length === 1 && args[0] === "--version") { console.log(pkg.version); return; }
45
+ if (process.versions.bun) assertBunRuntime();
43
46
  let json = false;
44
47
  let toolPackage;
45
48
  let packageManager;
@@ -83,6 +86,11 @@ async function main(args) {
83
86
  }
84
87
  if (positional.length > 2) throw new Error("Extra argument. Run ads --help.");
85
88
  const [command, directory] = positional;
89
+ if(command!=="init"){
90
+ const exitCode=await enterMemoryBudget(loadConfig(path.resolve(directory??process.cwd())).config,args);
91
+ if(exitCode!==null){process.exitCode=exitCode;return;}
92
+ }
93
+ const { checkProject, generateBrandAssets, generateLintConfig, initProject, inspectTokens } = await import("./index.mjs");
86
94
  if(watched&&command!=="compile")throw new Error("--watch is supported only by compile.");
87
95
  if(command==="compile"){const {compilePreviews}=await import("./bun-compiler.mjs");await compilePreviews(path.resolve(directory??process.cwd()),{watched});return;}
88
96
  if (changed && command !== "validate") throw new Error("--changed is supported only by validate.");
package/dist/config.mjs CHANGED
@@ -23,6 +23,7 @@ export const defaultConfig = {
23
23
  assets: { publicDirs: ["public/assets"], generatedPaths: ["dist", "dist-showcase", ".vite", ".ds"], generatedFiles: [], iconSource: null },
24
24
  oxlint: { plugins: [], rules: {}, overrides: [] },
25
25
  validation: { checks: null, inputs: [] },
26
+ resources: { memoryLimitMb: null },
26
27
  mcp: { showcaseUrl: null, showcaseTitle: null, apps: [], previewWatch: null, previewManifest: null, mutationChecks: null, mutationCheckTimeoutMs: 60000, behaviorProfiles: {}, capture: {} },
27
28
  };
28
29
 
@@ -49,11 +50,12 @@ export function loadConfig(directory = process.cwd()) {
49
50
  if (!(field in defaultConfig)) throw new Error(`Unknown ADS configuration field: ${field}`);
50
51
  }
51
52
  if (user.oxlint !== undefined && (!user.oxlint || typeof user.oxlint !== "object" || Array.isArray(user.oxlint))) throw new Error("oxlint must be an object.");
52
- for (const field of ["boundaries", "assets", "oxlint", "mcp", "validation", "usage"]) {
53
+ for (const field of ["boundaries", "assets", "oxlint", "mcp", "validation", "usage", "resources"]) {
53
54
  if (user[field] !== undefined && (!user[field] || typeof user[field] !== "object" || Array.isArray(user[field]))) throw new Error(`${field} must be an object.`);
54
55
  for (const key of Object.keys(user[field] ?? {})) if (!(key in defaultConfig[field])) throw new Error(`Unknown ${field} configuration field: ${key}`);
55
56
  }
56
- const config = { ...defaultConfig, ...user, boundaries: { ...defaultConfig.boundaries, ...user.boundaries }, assets: { ...defaultConfig.assets, ...user.assets }, oxlint: { ...defaultConfig.oxlint, ...user.oxlint }, validation: { ...defaultConfig.validation, ...user.validation }, mcp: { ...defaultConfig.mcp, ...user.mcp }, usage: { ...defaultConfig.usage, ...user.usage } };
57
+ const config = { ...defaultConfig, ...user, boundaries: { ...defaultConfig.boundaries, ...user.boundaries }, assets: { ...defaultConfig.assets, ...user.assets }, oxlint: { ...defaultConfig.oxlint, ...user.oxlint }, validation: { ...defaultConfig.validation, ...user.validation }, mcp: { ...defaultConfig.mcp, ...user.mcp }, usage: { ...defaultConfig.usage, ...user.usage }, resources: { ...defaultConfig.resources, ...user.resources } };
58
+ if(config.resources.memoryLimitMb!==null&&(!Number.isInteger(config.resources.memoryLimitMb)||config.resources.memoryLimitMb<64||config.resources.memoryLimitMb>1048576))throw new Error("resources.memoryLimitMb must be null (automatic) or an integer from 64 to 1048576 MiB.");
57
59
  if (!Array.isArray(config.usage.notifications) || config.usage.notifications.length > 100) throw new Error("usage.notifications must be an array of notification API registrations.");
58
60
  const notificationNames = new Set();
59
61
  for (const entry of config.usage.notifications) {
@@ -34,13 +34,14 @@ function signalTree(signal) {
34
34
  try { process.kill(id,signal); } catch (error) { if(error.code!=="ESRCH")process.exitCode=1; }
35
35
  }
36
36
  }
37
- function stop() {
37
+ function stop(immediate = false) {
38
+ immediate = immediate === true;
38
39
  if (released || stopping) return;
39
40
  stopping = true;
40
41
  clearInterval(observe);
41
42
  if (tree) {
42
- collect();signalTree("SIGTERM");
43
- if (owned.size) timer=setTimeout(()=>signalTree("SIGKILL"),1500);
43
+ collect();signalTree(immediate ? "SIGKILL" : "SIGTERM");
44
+ if (owned.size && !immediate) timer=setTimeout(()=>signalTree("SIGKILL"),1500);
44
45
  return;
45
46
  }
46
47
  if (process.platform === "win32") {
@@ -48,8 +49,9 @@ function stop() {
48
49
  terminator.on("error", () => { process.exitCode = 1; });
49
50
  return;
50
51
  }
51
- try { process.kill(-pid, "SIGTERM"); }
52
+ try { process.kill(-pid, immediate ? "SIGKILL" : "SIGTERM"); }
52
53
  catch (error) { if (error.code !== "ESRCH") process.exitCode = 1; return; }
54
+ if (immediate) return;
53
55
  timer = setTimeout(() => {
54
56
  try { process.kill(-pid, "SIGKILL"); }
55
57
  catch (error) { if (error.code !== "ESRCH") process.exitCode = 1; }
@@ -57,6 +59,7 @@ function stop() {
57
59
  }
58
60
  process.stdin.on("data", bytes => {
59
61
  input = (input + bytes).slice(-32);
62
+ if (input === "kill\n") stop(true);
60
63
  if (input === "disarm\n") { released = true; clearTimeout(timer); clearInterval(observe); }
61
64
  });
62
65
  for (const event of ["end", "close", "error"]) process.stdin.once(event, stop);