@event4u/agent-config 9.11.0 → 9.12.0

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 (77) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/CHANGELOG.md +52 -0
  3. package/README.md +8 -1
  4. package/dist/agent-src/commands/fix/ci.md +29 -0
  5. package/dist/agent-src/commands/pr/create.md +60 -0
  6. package/dist/agent-src/contexts/authority/kernel-rule-edits.md +18 -2
  7. package/dist/agent-src/rules/design-fidelity.md +1 -1
  8. package/dist/agent-src/skills/ai-code-blindspots/SKILL.md +1 -0
  9. package/dist/agent-src/skills/design-intelligence/SKILL.md +27 -1
  10. package/dist/agent-src/skills/design-intelligence/data/font-pairings-reference.csv +74 -74
  11. package/dist/agent-src/skills/design-intelligence/data/manifest.json +2 -0
  12. package/dist/agent-src/skills/design-tokens/scripts/tokens.ts +0 -7
  13. package/dist/agent-src/skills/typography-system/SKILL.md +55 -11
  14. package/dist/agent-src/skills/ui-apply-generic/SKILL.md +180 -0
  15. package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
  16. package/dist/agent-src/templates/scripts/work_engine/directives/ui/apply.ts +9 -5
  17. package/dist/agent-src/templates/scripts/work_engine/directives/ui/polish.ts +9 -6
  18. package/dist/agent-src/templates/scripts/work_engine/directives/ui/review.ts +9 -5
  19. package/dist/agent-src/templates/scripts/work_engine/directives/ui/stack_bundles.ts +182 -29
  20. package/dist/agent-src/templates/scripts/work_engine/stack/detect.ts +311 -24
  21. package/dist/cli-delegate/chunk-523HCFYO.js +90 -0
  22. package/dist/cli-delegate/{chunk-IR7P7JWA.js → chunk-A3HJ6NTI.js} +271 -59
  23. package/dist/cli-delegate/chunk-EJYIGZ3T.js +125 -0
  24. package/dist/cli-delegate/{chunk-RDGRHAAB.js → chunk-HYWSRNUX.js} +6 -86
  25. package/dist/cli-delegate/{chunk-YMFO6FDN.js → chunk-QFKQLQ7X.js} +313 -81
  26. package/dist/cli-delegate/{chunk-4SV3XGFA.js → chunk-TEGJU2JX.js} +7 -9
  27. package/dist/cli-delegate/chunk-TJIAM5FW.js +133 -0
  28. package/dist/cli-delegate/cmd_conformance.js +4 -7
  29. package/dist/cli-delegate/cmd_doctor.js +3 -5
  30. package/dist/cli-delegate/cmd_explain.js +153 -85
  31. package/dist/cli-delegate/cmd_export.js +5 -3
  32. package/dist/cli-delegate/cmd_fleet.js +2 -1
  33. package/dist/cli-delegate/cmd_preflight.js +6 -123
  34. package/dist/cli-delegate/cmd_prune.js +5 -3
  35. package/dist/cli-delegate/cmd_settings_migrate.js +5 -3
  36. package/dist/cli-delegate/cmd_sync.js +5 -3
  37. package/dist/cli-delegate/cmd_uninstall.js +6 -5
  38. package/dist/cli-delegate/cmd_validate.js +5 -3
  39. package/dist/discovery/deprecation-report.md +1 -1
  40. package/dist/discovery/discovery-manifest.json +36 -14
  41. package/dist/discovery/discovery-manifest.json.sha256 +1 -1
  42. package/dist/discovery/discovery-manifest.summary.md +3 -3
  43. package/dist/discovery/orphan-report.md +1 -1
  44. package/dist/discovery/packs.json +6 -5
  45. package/dist/discovery/trust-report.md +2 -2
  46. package/dist/discovery/workspaces.json +5 -4
  47. package/dist/install/install.mjs +605 -412
  48. package/dist/install/ruleInScope.js +123 -0
  49. package/dist/install/ruleInScope.js.map +1 -0
  50. package/dist/install/rule_scope.js +2 -2
  51. package/dist/install/rule_scope.js.map +1 -1
  52. package/dist/install/wizard-plan.js +10 -1
  53. package/dist/install/wizard-plan.js.map +1 -1
  54. package/dist/mcp/registry-manifest.json +3 -3
  55. package/dist/mcp/server.json +2 -2
  56. package/dist/mcp/server.mjs +405 -2429
  57. package/dist/scripts/condense.js +6 -22
  58. package/dist/scripts/condense.js.map +1 -1
  59. package/docs/guidelines/design-fidelity-mechanics.md +14 -0
  60. package/package.json +1 -1
  61. package/src/agent-src/templates/scripts/work_engine/directives/ui/apply.ts +9 -5
  62. package/src/agent-src/templates/scripts/work_engine/directives/ui/polish.ts +9 -6
  63. package/src/agent-src/templates/scripts/work_engine/directives/ui/review.ts +9 -5
  64. package/src/agent-src/templates/scripts/work_engine/directives/ui/stack_bundles.ts +182 -29
  65. package/src/agent-src/templates/scripts/work_engine/stack/detect.ts +311 -24
  66. package/src/install/ruleInScope.ts +133 -0
  67. package/src/install/rule_scope.ts +2 -2
  68. package/src/install/wizard-plan.ts +11 -1
  69. package/src/scripts/_lib/global_deploy_inventory.ts +38 -2
  70. package/src/scripts/check_installer_import_purity.ts +295 -0
  71. package/src/scripts/condense.ts +7 -28
  72. package/src/scripts/install-hooks.sh +36 -4
  73. package/src/scripts/install.ts +210 -5
  74. package/src/scripts/lint_ui_stack_bundles.ts +31 -0
  75. package/dist/cli-delegate/chunk-7DSAMZFU.js +0 -356
  76. package/dist/cli-delegate/chunk-BJGXZNPM.js +0 -266
  77. package/dist/cli-delegate/chunk-TFG57JJM.js +0 -1969
@@ -2,9 +2,15 @@ import { createRequire as __acCreateRequire } from 'node:module'; const require
2
2
  import {
3
3
  main
4
4
  } from "./chunk-XX6TOPD7.js";
5
+ import {
6
+ RULE_SOURCE_REL
7
+ } from "./chunk-EJYIGZ3T.js";
5
8
  import {
6
9
  ScopeMismatchError,
10
+ build_claude_hook_matrix,
11
+ ensure_managed_hooks,
7
12
  expected_deploy_files,
13
+ is_ancestor,
8
14
  load_inventory,
9
15
  manifest_path,
10
16
  read_manifest,
@@ -14,7 +20,7 @@ import {
14
20
  save_inventory,
15
21
  upsert_tool,
16
22
  write_manifest
17
- } from "./chunk-IR7P7JWA.js";
23
+ } from "./chunk-A3HJ6NTI.js";
18
24
  import {
19
25
  check_version,
20
26
  classify_mismatch,
@@ -26,13 +32,10 @@ import {
26
32
  write_lockfile
27
33
  } from "./chunk-GRRPEPRN.js";
28
34
  import {
29
- TIER_TO_CLAUDE_MODEL,
30
- build_claude_hook_matrix,
31
- ensure_managed_hooks,
32
- is_claude_builtin_name,
33
- read_model_tier,
34
- render_native_model_md
35
- } from "./chunk-7DSAMZFU.js";
35
+ LEGACY_ALL,
36
+ ruleFileArrives,
37
+ ruleScopeFromSettings
38
+ } from "./chunk-TJIAM5FW.js";
36
39
  import {
37
40
  find_project_root_with_anchor,
38
41
  load_agent_settings
@@ -255,12 +258,128 @@ function subtract_pointers(doc, entries) {
255
258
  // src/scripts/install.ts
256
259
  import { spawn, spawnSync } from "node:child_process";
257
260
  import * as crypto3 from "node:crypto";
258
- import * as fs5 from "node:fs";
261
+ import * as fs6 from "node:fs";
259
262
  import * as os2 from "node:os";
260
263
  import * as path5 from "node:path";
261
264
  import process2 from "node:process";
262
265
  import { fileURLToPath, pathToFileURL } from "node:url";
263
266
 
267
+ // src/scripts/_lib/claude_builtin_names.ts
268
+ var _CURRENT = [
269
+ "add-dir",
270
+ "advisor",
271
+ "agents",
272
+ "autofix-pr",
273
+ "background",
274
+ "batch",
275
+ "branch",
276
+ "btw",
277
+ "cd",
278
+ "chrome",
279
+ "claude-api",
280
+ "clear",
281
+ "code-review",
282
+ "color",
283
+ "compact",
284
+ "config",
285
+ "context",
286
+ "copy",
287
+ "cost",
288
+ "dataviz",
289
+ "debug",
290
+ "deep-research",
291
+ "design-login",
292
+ "design-sync",
293
+ "desktop",
294
+ "diff",
295
+ "doctor",
296
+ "effort",
297
+ "exit",
298
+ "export",
299
+ "fast",
300
+ "feedback",
301
+ "fewer-permission-prompts",
302
+ "focus",
303
+ "fork",
304
+ "goal",
305
+ "heapdump",
306
+ "help",
307
+ "hooks",
308
+ "ide",
309
+ "init",
310
+ "insights",
311
+ "install-github-app",
312
+ "install-slack-app",
313
+ "keybindings",
314
+ "login",
315
+ "logout",
316
+ "loop",
317
+ "mcp",
318
+ "memory",
319
+ "mobile",
320
+ "model",
321
+ "passes",
322
+ "permissions",
323
+ "plan",
324
+ "plugin",
325
+ "powerup",
326
+ "pr-comments",
327
+ "privacy-settings",
328
+ "radio",
329
+ "recap",
330
+ "release-notes",
331
+ "reload-plugins",
332
+ "reload-skills",
333
+ "remote-control",
334
+ "remote-env",
335
+ "rename",
336
+ "resume",
337
+ "review",
338
+ "rewind",
339
+ "run",
340
+ "run-skill-generator",
341
+ "sandbox",
342
+ "schedule",
343
+ "scroll-speed",
344
+ "security-review",
345
+ "setup-bedrock",
346
+ "setup-vertex",
347
+ "simplify",
348
+ "skills",
349
+ "stats",
350
+ "status",
351
+ "statusline",
352
+ "stickers",
353
+ "teleport",
354
+ "thinking",
355
+ "trust",
356
+ "upgrade",
357
+ "usage",
358
+ "verify",
359
+ "vim",
360
+ "web",
361
+ "whats-new",
362
+ "workflow",
363
+ "workflows",
364
+ "worktree"
365
+ ];
366
+ var _LEGACY = [
367
+ "bashes",
368
+ "bug",
369
+ "migrate-installer",
370
+ "output-style",
371
+ "terminal-setup",
372
+ "theme",
373
+ "todos"
374
+ ];
375
+ var CLAUDE_CODE_BUILTIN_NAMES = /* @__PURE__ */ new Set([
376
+ ..._CURRENT,
377
+ ..._LEGACY
378
+ ]);
379
+ function is_claude_builtin_name(slug) {
380
+ return CLAUDE_CODE_BUILTIN_NAMES.has(slug.toLowerCase());
381
+ }
382
+
264
383
  // src/scripts/_lib/surface_tiers.ts
265
384
  import * as fs from "node:fs";
266
385
  import * as path from "node:path";
@@ -6752,6 +6871,31 @@ function detect_module_roots(project_root) {
6752
6871
  return [...high, ...medium];
6753
6872
  }
6754
6873
 
6874
+ // src/scripts/_lib/model_tier.ts
6875
+ import fs5 from "node:fs";
6876
+ var TIER_TO_CLAUDE_MODEL = {
6877
+ high: "opus",
6878
+ medium: "sonnet",
6879
+ lite: "haiku"
6880
+ };
6881
+ var MODEL_TIER_RE = /^model_tier:\s*"?([a-z]+)"?\s*$/m;
6882
+ function read_model_tier(skill_md) {
6883
+ if (!fs5.existsSync(skill_md)) return null;
6884
+ const text = fs5.readFileSync(skill_md).toString("utf-8");
6885
+ if (!text.startsWith("---\n")) return null;
6886
+ const end = text.indexOf("\n---\n", 4);
6887
+ if (end === -1) return null;
6888
+ const m = MODEL_TIER_RE.exec(text.slice(4, end));
6889
+ return m ? m[1] : null;
6890
+ }
6891
+ function render_native_model_md(text, tier) {
6892
+ const model = TIER_TO_CLAUDE_MODEL[tier];
6893
+ if (model === void 0) {
6894
+ throw new Error(`'${tier}'`);
6895
+ }
6896
+ return text.replace(MODEL_TIER_RE, `model: ${model}`);
6897
+ }
6898
+
6755
6899
  // src/scripts/install.ts
6756
6900
  var _HERE = fileURLToPath(import.meta.url);
6757
6901
  var SystemExitError = class extends Error {
@@ -6777,28 +6921,28 @@ function expanduser2(p) {
6777
6921
  }
6778
6922
  function resolvePath(p) {
6779
6923
  try {
6780
- return fs5.realpathSync(path5.resolve(p));
6924
+ return fs6.realpathSync(path5.resolve(p));
6781
6925
  } catch {
6782
6926
  return path5.resolve(p);
6783
6927
  }
6784
6928
  }
6785
6929
  function isFile(p) {
6786
6930
  try {
6787
- return fs5.statSync(p).isFile();
6931
+ return fs6.statSync(p).isFile();
6788
6932
  } catch {
6789
6933
  return false;
6790
6934
  }
6791
6935
  }
6792
6936
  function isDir(p) {
6793
6937
  try {
6794
- return fs5.statSync(p).isDirectory();
6938
+ return fs6.statSync(p).isDirectory();
6795
6939
  } catch {
6796
6940
  return false;
6797
6941
  }
6798
6942
  }
6799
6943
  function pathExists(p) {
6800
6944
  try {
6801
- fs5.statSync(p);
6945
+ fs6.statSync(p);
6802
6946
  return true;
6803
6947
  } catch {
6804
6948
  return false;
@@ -6806,24 +6950,24 @@ function pathExists(p) {
6806
6950
  }
6807
6951
  function isSymlink(p) {
6808
6952
  try {
6809
- return fs5.lstatSync(p).isSymbolicLink();
6953
+ return fs6.lstatSync(p).isSymbolicLink();
6810
6954
  } catch {
6811
6955
  return false;
6812
6956
  }
6813
6957
  }
6814
6958
  function readText(p) {
6815
- return fs5.readFileSync(p, "utf-8");
6959
+ return fs6.readFileSync(p, "utf-8");
6816
6960
  }
6817
6961
  function writeText(p, content) {
6818
- fs5.writeFileSync(p, content, "utf-8");
6962
+ fs6.writeFileSync(p, content, "utf-8");
6819
6963
  }
6820
6964
  function mkdirp(p) {
6821
- fs5.mkdirSync(p, { recursive: true });
6965
+ fs6.mkdirSync(p, { recursive: true });
6822
6966
  }
6823
6967
  function sortedGlobStems(directory, suffix) {
6824
6968
  let entries;
6825
6969
  try {
6826
- entries = fs5.readdirSync(directory);
6970
+ entries = fs6.readdirSync(directory);
6827
6971
  } catch {
6828
6972
  return [];
6829
6973
  }
@@ -6843,7 +6987,7 @@ function sortedGlobStems(directory, suffix) {
6843
6987
  function countZips(directory) {
6844
6988
  if (!isDir(directory)) return 0;
6845
6989
  let n = 0;
6846
- for (const name of fs5.readdirSync(directory)) {
6990
+ for (const name of fs6.readdirSync(directory)) {
6847
6991
  if (name.endsWith(".zip")) n += 1;
6848
6992
  }
6849
6993
  return n;
@@ -6851,7 +6995,7 @@ function countZips(directory) {
6851
6995
  function sha256OfFile(p) {
6852
6996
  let data;
6853
6997
  try {
6854
- data = fs5.readFileSync(p);
6998
+ data = fs6.readFileSync(p);
6855
6999
  } catch {
6856
7000
  return null;
6857
7001
  }
@@ -6865,21 +7009,21 @@ function atomicWrite0644(target, body, prefix) {
6865
7009
  );
6866
7010
  let fd = null;
6867
7011
  try {
6868
- fd = fs5.openSync(tmpName, "wx", 420);
6869
- fs5.writeFileSync(fd, body, "utf-8");
6870
- fs5.closeSync(fd);
7012
+ fd = fs6.openSync(tmpName, "wx", 420);
7013
+ fs6.writeFileSync(fd, body, "utf-8");
7014
+ fs6.closeSync(fd);
6871
7015
  fd = null;
6872
- fs5.chmodSync(tmpName, 420);
6873
- fs5.renameSync(tmpName, target);
7016
+ fs6.chmodSync(tmpName, 420);
7017
+ fs6.renameSync(tmpName, target);
6874
7018
  } catch (err) {
6875
7019
  if (fd !== null) {
6876
7020
  try {
6877
- fs5.closeSync(fd);
7021
+ fs6.closeSync(fd);
6878
7022
  } catch {
6879
7023
  }
6880
7024
  }
6881
7025
  try {
6882
- fs5.unlinkSync(tmpName);
7026
+ fs6.unlinkSync(tmpName);
6883
7027
  } catch {
6884
7028
  }
6885
7029
  throw err;
@@ -7295,7 +7439,7 @@ function _migrate_legacy_if_present(project_root, template_body) {
7295
7439
  rendered = _append_unknown_legacy(rendered, values, unknown);
7296
7440
  const backup_target = path5.join(project_root, LEGACY_BACKUP_FILE);
7297
7441
  writeText(backup_target, legacy_text);
7298
- fs5.unlinkSync(legacy_target);
7442
+ fs6.unlinkSync(legacy_target);
7299
7443
  info(`Migrated legacy ${LEGACY_SETTINGS_FILE} \u2192 ${SETTINGS_FILE}`);
7300
7444
  info(`Backup saved to ${LEGACY_BACKUP_FILE}`);
7301
7445
  if (unknown.length > 0) {
@@ -7412,7 +7556,7 @@ function ensure_agent_settings(project_root, package_root, profile, force, user_
7412
7556
  if (isFile(legacy_root) && !pathExists(target)) {
7413
7557
  mkdirp(path5.dirname(target));
7414
7558
  writeText(target, readText(legacy_root));
7415
- fs5.unlinkSync(legacy_root);
7559
+ fs6.unlinkSync(legacy_root);
7416
7560
  success(`Migrated ${SETTINGS_FILE} \u2192 agents/settings/${SETTINGS_FILE} (ADR-038)`);
7417
7561
  return;
7418
7562
  }
@@ -7490,7 +7634,7 @@ function _deploy_augment_trampoline(package_root, name, force) {
7490
7634
  skip(`~/.augment/hooks/${name} already up to date`);
7491
7635
  } else {
7492
7636
  writeText(dst, src_text);
7493
- fs5.chmodSync(dst, 493);
7637
+ fs6.chmodSync(dst, 493);
7494
7638
  success(`~/.augment/hooks/${name} installed`);
7495
7639
  }
7496
7640
  return dst;
@@ -7500,7 +7644,7 @@ function _remove_legacy_augment_trampolines() {
7500
7644
  const legacy = path5.join(AUGMENT_USER_HOOKS_DIR, name);
7501
7645
  try {
7502
7646
  if (isFile(legacy)) {
7503
- fs5.unlinkSync(legacy);
7647
+ fs6.unlinkSync(legacy);
7504
7648
  skip(`removed legacy ~/.augment/hooks/${name}`);
7505
7649
  }
7506
7650
  } catch {
@@ -7591,7 +7735,7 @@ function ensure_cursor_user_hooks(package_root, force) {
7591
7735
  skip(`~/.cursor/hooks/${CURSOR_DISPATCHER_TRAMPOLINE} already up to date`);
7592
7736
  } else {
7593
7737
  writeText(dst, src_text);
7594
- fs5.chmodSync(dst, 493);
7738
+ fs6.chmodSync(dst, 493);
7595
7739
  success(`~/.cursor/hooks/${CURSOR_DISPATCHER_TRAMPOLINE} installed`);
7596
7740
  }
7597
7741
  const hooks = {};
@@ -7658,7 +7802,7 @@ function ensure_cline_bridge(project_root, force) {
7658
7802
  continue;
7659
7803
  }
7660
7804
  writeText(target, body);
7661
- fs5.chmodSync(target, 493);
7805
+ fs6.chmodSync(target, 493);
7662
7806
  written += 1;
7663
7807
  }
7664
7808
  if (written) {
@@ -7682,7 +7826,7 @@ function ensure_cline_user_hooks(package_root, force) {
7682
7826
  skip(`~/Documents/Cline/Hooks/${CLINE_DISPATCHER_TRAMPOLINE} already up to date`);
7683
7827
  } else {
7684
7828
  writeText(trampoline, src_text);
7685
- fs5.chmodSync(trampoline, 493);
7829
+ fs6.chmodSync(trampoline, 493);
7686
7830
  success(`~/Documents/Cline/Hooks/${CLINE_DISPATCHER_TRAMPOLINE} installed`);
7687
7831
  }
7688
7832
  const trampoline_quoted = shlexQuote(trampoline);
@@ -7697,7 +7841,7 @@ exec ${trampoline_quoted} ${ac_event} ${native_event}
7697
7841
  continue;
7698
7842
  }
7699
7843
  writeText(wrapper, body);
7700
- fs5.chmodSync(wrapper, 493);
7844
+ fs6.chmodSync(wrapper, 493);
7701
7845
  }
7702
7846
  }
7703
7847
  var WINDSURF_DISPATCHER_BINDINGS = [
@@ -7740,7 +7884,7 @@ function ensure_windsurf_user_hooks(package_root, force) {
7740
7884
  skip(`~/.codeium/windsurf/hooks/${WINDSURF_DISPATCHER_TRAMPOLINE} already up to date`);
7741
7885
  } else {
7742
7886
  writeText(dst, src_text);
7743
- fs5.chmodSync(dst, 493);
7887
+ fs6.chmodSync(dst, 493);
7744
7888
  success(`~/.codeium/windsurf/hooks/${WINDSURF_DISPATCHER_TRAMPOLINE} installed`);
7745
7889
  }
7746
7890
  const hooks = {};
@@ -7803,7 +7947,7 @@ function ensure_gemini_user_hooks(package_root, force) {
7803
7947
  skip(`~/.gemini/hooks/${GEMINI_DISPATCHER_TRAMPOLINE} already up to date`);
7804
7948
  } else {
7805
7949
  writeText(dst, src_text);
7806
- fs5.chmodSync(dst, 493);
7950
+ fs6.chmodSync(dst, 493);
7807
7951
  success(`~/.gemini/hooks/${GEMINI_DISPATCHER_TRAMPOLINE} installed`);
7808
7952
  }
7809
7953
  const settings_patch = {
@@ -8080,7 +8224,7 @@ var SMOKE_BRIDGE_PATHS = {
8080
8224
  };
8081
8225
  function dirHasEntries(p) {
8082
8226
  try {
8083
- return fs5.readdirSync(p).length > 0;
8227
+ return fs6.readdirSync(p).length > 0;
8084
8228
  } catch {
8085
8229
  return false;
8086
8230
  }
@@ -8470,7 +8614,7 @@ function readLineSyncRaw(promptText) {
8470
8614
  for (; ; ) {
8471
8615
  let n;
8472
8616
  try {
8473
- n = fs5.readSync(0, buf, 0, 1, null);
8617
+ n = fs6.readSync(0, buf, 0, 1, null);
8474
8618
  } catch (err) {
8475
8619
  const code = err.code;
8476
8620
  if (code === "EAGAIN") {
@@ -8629,7 +8773,7 @@ function _is_agent_config_source_repo(project_root) {
8629
8773
  }
8630
8774
  const packages_dir = path5.join(project_root, "packages");
8631
8775
  if (isDir(packages_dir)) {
8632
- for (const child of fs5.readdirSync(packages_dir)) {
8776
+ for (const child of fs6.readdirSync(packages_dir)) {
8633
8777
  if (isDir(path5.join(packages_dir, child, ".agent-src.uncondensed"))) {
8634
8778
  return [true, `packages/${child}/.agent-src.uncondensed/`];
8635
8779
  }
@@ -8721,7 +8865,7 @@ function _remove_legacy_consumer_bridge_marker(project_root, env = null) {
8721
8865
  const target = path5.join(project_root, CONSUMER_BRIDGE_MARKER_RELPATH);
8722
8866
  if (!isFile(target)) return null;
8723
8867
  try {
8724
- fs5.rmSync(target);
8868
+ fs6.rmSync(target);
8725
8869
  } catch {
8726
8870
  return null;
8727
8871
  }
@@ -8823,16 +8967,37 @@ function _inject_package_tag(target, source, package_root) {
8823
8967
  writeText(target, new_text);
8824
8968
  }
8825
8969
  }
8826
- function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null) {
8970
+ function _escapes_package_root(resolved, package_root) {
8971
+ if (package_root === null) return false;
8972
+ let root;
8973
+ try {
8974
+ root = fs6.realpathSync(package_root);
8975
+ } catch {
8976
+ return false;
8977
+ }
8978
+ return !is_ancestor(root, resolved);
8979
+ }
8980
+ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null, file_filter = null) {
8827
8981
  let written = 0;
8828
8982
  let skipped = 0;
8829
8983
  const written_paths = [];
8830
8984
  if (!pathExists(src)) return [0, 0, written_paths];
8831
8985
  if (!isDir(src)) {
8986
+ if (file_filter !== null && !file_filter(src)) return [0, 0, written_paths];
8987
+ let resolved_src = src;
8988
+ try {
8989
+ resolved_src = fs6.realpathSync(src);
8990
+ } catch {
8991
+ resolved_src = src;
8992
+ }
8993
+ if (_escapes_package_root(resolved_src, package_root)) {
8994
+ warn(`refused: ${src} dereferences outside the package root \u2014 not copied`);
8995
+ return [0, 0, written_paths];
8996
+ }
8832
8997
  mkdirp(path5.dirname(dest));
8833
8998
  const decision = _resolve_file_conflict(dest, force);
8834
8999
  if (decision === "skip") return [0, 1, written_paths];
8835
- fs5.copyFileSync(src, dest);
9000
+ fs6.copyFileSync(src, dest);
8836
9001
  _inject_package_tag(dest, src, package_root);
8837
9002
  written_paths.push(dest);
8838
9003
  return [1, 0, written_paths];
@@ -8840,11 +9005,11 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null)
8840
9005
  mkdirp(dest);
8841
9006
  const walk = (node) => {
8842
9007
  const acc = [];
8843
- const names = fs5.readdirSync(node).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
9008
+ const names = fs6.readdirSync(node).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
8844
9009
  for (const name of names) {
8845
9010
  const entry = path5.join(node, name);
8846
9011
  acc.push(entry);
8847
- const lst = fs5.lstatSync(entry);
9012
+ const lst = fs6.lstatSync(entry);
8848
9013
  if (lst.isDirectory() && !lst.isSymbolicLink()) {
8849
9014
  acc.push(...walk(entry));
8850
9015
  }
@@ -8854,7 +9019,7 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null)
8854
9019
  for (const entry of walk(src)) {
8855
9020
  const rel = path5.relative(src, entry);
8856
9021
  const target = path5.join(dest, rel);
8857
- const lst = fs5.lstatSync(entry);
9022
+ const lst = fs6.lstatSync(entry);
8858
9023
  if (lst.isDirectory() && !lst.isSymbolicLink()) {
8859
9024
  mkdirp(target);
8860
9025
  continue;
@@ -8862,31 +9027,39 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null)
8862
9027
  let resolvedIsDir = false;
8863
9028
  let resolved = entry;
8864
9029
  try {
8865
- resolved = fs5.realpathSync(entry);
8866
- resolvedIsDir = fs5.statSync(entry).isDirectory();
9030
+ resolved = fs6.realpathSync(entry);
9031
+ resolvedIsDir = fs6.statSync(entry).isDirectory();
8867
9032
  } catch {
8868
9033
  resolvedIsDir = false;
8869
9034
  }
9035
+ if (_escapes_package_root(resolved, package_root)) {
9036
+ warn(`refused: ${entry} dereferences outside the package root \u2014 not copied`);
9037
+ continue;
9038
+ }
8870
9039
  if (resolvedIsDir) {
8871
9040
  mkdirp(target);
8872
9041
  const [sub_w, sub_s, sub_p] = _copy_dir_dereferencing_symlinks(
8873
9042
  resolved,
8874
9043
  target,
8875
9044
  force,
8876
- package_root
9045
+ package_root,
9046
+ file_filter
8877
9047
  );
8878
9048
  written += sub_w;
8879
9049
  skipped += sub_s;
8880
9050
  written_paths.push(...sub_p);
8881
9051
  continue;
8882
9052
  }
9053
+ if (file_filter !== null && !file_filter(entry)) {
9054
+ continue;
9055
+ }
8883
9056
  const decision = _resolve_file_conflict(target, force);
8884
9057
  if (decision === "skip") {
8885
9058
  skipped += 1;
8886
9059
  continue;
8887
9060
  }
8888
9061
  mkdirp(path5.dirname(target));
8889
- fs5.copyFileSync(resolved, target);
9062
+ fs6.copyFileSync(resolved, target);
8890
9063
  _inject_package_tag(target, resolved, package_root);
8891
9064
  written += 1;
8892
9065
  written_paths.push(target);
@@ -8925,20 +9098,20 @@ function _apply_claude_flat_command_wrappers(anchor, package_root, current_files
8925
9098
  const commands_dir = path5.join(anchor, "commands");
8926
9099
  let flat_entries = [];
8927
9100
  try {
8928
- flat_entries = fs5.readdirSync(commands_dir).filter((f) => f.endsWith(".md"));
9101
+ flat_entries = fs6.readdirSync(commands_dir).filter((f) => f.endsWith(".md"));
8929
9102
  } catch {
8930
9103
  }
8931
9104
  for (const fname of flat_entries.sort()) {
8932
9105
  const slug = fname.slice(0, -".md".length);
8933
9106
  if (!is_claude_builtin_name(slug)) continue;
8934
- fs5.rmSync(path5.join(commands_dir, fname), { force: true });
9107
+ fs6.rmSync(path5.join(commands_dir, fname), { force: true });
8935
9108
  current_files.delete(`commands/${fname}`);
8936
9109
  reserved.push(slug);
8937
9110
  }
8938
9111
  const eligible = new Set(_CLAUDE_FLAT_WRAPPER_EXTRA);
8939
9112
  try {
8940
9113
  const manifest = JSON.parse(
8941
- fs5.readFileSync(path5.join(package_root, "dist", "discovery", "discovery-manifest.json"), "utf8")
9114
+ fs6.readFileSync(path5.join(package_root, "dist", "discovery", "discovery-manifest.json"), "utf8")
8942
9115
  );
8943
9116
  for (const a of manifest.artefacts ?? []) {
8944
9117
  if (a.category !== "command" || typeof a.slug !== "string") continue;
@@ -8950,21 +9123,21 @@ function _apply_claude_flat_command_wrappers(anchor, package_root, current_files
8950
9123
  for (const slug of [...eligible].sort()) {
8951
9124
  const flat_rel = `commands/${slug}.md`;
8952
9125
  const flat_abs = path5.join(anchor, "commands", `${slug}.md`);
8953
- if (!fs5.existsSync(flat_abs)) continue;
9126
+ if (!fs6.existsSync(flat_abs)) continue;
8954
9127
  const skill_dir = path5.join(anchor, "skills", slug);
8955
- if (fs5.existsSync(skill_dir)) {
9128
+ if (fs6.existsSync(skill_dir)) {
8956
9129
  collisions.push(slug);
8957
9130
  continue;
8958
9131
  }
8959
- let body = fs5.readFileSync(flat_abs, "utf8");
9132
+ let body = fs6.readFileSync(flat_abs, "utf8");
8960
9133
  if (body.startsWith("---\n") && !/^name:/m.test(body.split("\n---")[0] ?? "")) {
8961
9134
  body = body.replace("---\n", `---
8962
9135
  name: ${slug}
8963
9136
  `);
8964
9137
  }
8965
- fs5.mkdirSync(skill_dir, { recursive: true });
8966
- fs5.writeFileSync(path5.join(skill_dir, "SKILL.md"), body, "utf8");
8967
- fs5.rmSync(flat_abs, { force: true });
9138
+ fs6.mkdirSync(skill_dir, { recursive: true });
9139
+ fs6.writeFileSync(path5.join(skill_dir, "SKILL.md"), body, "utf8");
9140
+ fs6.rmSync(flat_abs, { force: true });
8968
9141
  current_files.delete(flat_rel);
8969
9142
  current_files.add(`skills/${slug}/SKILL.md`);
8970
9143
  wrapped.push(slug);
@@ -8973,6 +9146,7 @@ name: ${slug}
8973
9146
  }
8974
9147
  function _deploy_global_content(tools, force, package_root, lockfile_path2) {
8975
9148
  const results = {};
9149
+ const rule_scope = _resolve_global_rule_scope(package_root);
8976
9150
  for (const tool_id of [...tools].sort()) {
8977
9151
  if (tool_id === "claude-desktop") {
8978
9152
  results[tool_id] = _deploy_claude_desktop(force, package_root, lockfile_path2);
@@ -8997,13 +9171,24 @@ function _deploy_global_content(tools, force, package_root, lockfile_path2) {
8997
9171
  for (const [src_rel, dest_sub] of plan) {
8998
9172
  const src = path5.join(package_root, src_rel);
8999
9173
  const dest = dest_sub ? path5.join(anchor, dest_sub) : anchor;
9000
- const [w, s, paths] = _copy_dir_dereferencing_symlinks(src, dest, force, package_root);
9174
+ const rule_filter = _rule_filter_for_source(src_rel, rule_scope);
9175
+ const [w, s, paths] = _copy_dir_dereferencing_symlinks(
9176
+ src,
9177
+ dest,
9178
+ force,
9179
+ package_root,
9180
+ rule_filter
9181
+ );
9001
9182
  written_total += w;
9002
9183
  skipped_total += s;
9003
9184
  written_paths.push(...paths);
9004
9185
  current_files = setUnion(
9005
9186
  current_files,
9006
- expected_deploy_files(src, dest_sub ? dest_sub : "")
9187
+ expected_deploy_files(
9188
+ src,
9189
+ dest_sub ? dest_sub : "",
9190
+ rule_filter
9191
+ )
9007
9192
  );
9008
9193
  }
9009
9194
  if (tool_id === "claude-code") {
@@ -9090,6 +9275,7 @@ function setUnion(a, b) {
9090
9275
  function _preview_global_reap(tools, package_root) {
9091
9276
  const inventory = load_inventory();
9092
9277
  const preview = {};
9278
+ const rule_scope = _resolve_global_rule_scope(package_root);
9093
9279
  for (const tool_id of [...tools].sort()) {
9094
9280
  const plan = GLOBAL_DEPLOY_SOURCES[tool_id];
9095
9281
  if (plan === void 0) continue;
@@ -9101,7 +9287,11 @@ function _preview_global_reap(tools, package_root) {
9101
9287
  const src = path5.join(package_root, src_rel);
9102
9288
  current_files = setUnion(
9103
9289
  current_files,
9104
- expected_deploy_files(src, dest_sub ? dest_sub : "")
9290
+ expected_deploy_files(
9291
+ src,
9292
+ dest_sub ? dest_sub : "",
9293
+ _rule_filter_for_source(src_rel, rule_scope)
9294
+ )
9105
9295
  );
9106
9296
  }
9107
9297
  let would_reap = [];
@@ -9135,7 +9325,7 @@ function _verify_deploy_targets(anchor, plan) {
9135
9325
  continue;
9136
9326
  }
9137
9327
  try {
9138
- const entries = fs5.readdirSync(target);
9328
+ const entries = fs6.readdirSync(target);
9139
9329
  if (entries.length === 0) missing.push(label);
9140
9330
  } catch {
9141
9331
  missing.push(label);
@@ -9180,12 +9370,12 @@ function _prune_modules_by(deploy_results, is_pruned) {
9180
9370
  (is_target ? delete_files : keep).push(p);
9181
9371
  }
9182
9372
  for (const d of pruned_skill_dirs) {
9183
- fs5.rmSync(d, { recursive: true, force: true });
9373
+ fs6.rmSync(d, { recursive: true, force: true });
9184
9374
  }
9185
9375
  for (const p of delete_files) {
9186
9376
  if (p.split(path5.sep).includes("commands") && pathExists(p)) {
9187
9377
  try {
9188
- fs5.unlinkSync(p);
9378
+ fs6.unlinkSync(p);
9189
9379
  } catch {
9190
9380
  }
9191
9381
  }
@@ -9248,11 +9438,15 @@ function _compute_active_pack_ids(packs, runtime_active_packs) {
9248
9438
  return active;
9249
9439
  }
9250
9440
  function _resolve_global_settings_doc() {
9441
+ const p = _resolve_global_settings_path();
9442
+ return p === null ? null : _load_yaml_doc(p);
9443
+ }
9444
+ function _resolve_global_settings_path() {
9251
9445
  const root = event4u_root();
9252
9446
  const canonical = path5.join(root, "settings", SETTINGS_FILE);
9253
- if (pathExists(canonical)) return _load_yaml_doc(canonical);
9447
+ if (pathExists(canonical)) return canonical;
9254
9448
  const legacy = path5.join(root, SETTINGS_FILE);
9255
- if (pathExists(legacy)) return _load_yaml_doc(legacy);
9449
+ if (pathExists(legacy)) return legacy;
9256
9450
  return null;
9257
9451
  }
9258
9452
  function _resolve_scoped_projection(package_root) {
@@ -9264,6 +9458,44 @@ function _resolve_scoped_projection(package_root) {
9264
9458
  const active_packs = Array.isArray(active_packs_raw) ? active_packs_raw.filter((v) => typeof v === "string") : [];
9265
9459
  return { mode, active_packs };
9266
9460
  }
9461
+ function _resolve_global_rule_scope(package_root) {
9462
+ const settings_path = _resolve_global_settings_path();
9463
+ if (settings_path === null) {
9464
+ try {
9465
+ return ruleScopeFromSettings(_load_default_settings(package_root));
9466
+ } catch {
9467
+ return LEGACY_ALL;
9468
+ }
9469
+ }
9470
+ let text;
9471
+ try {
9472
+ text = readText(settings_path);
9473
+ } catch (e) {
9474
+ warn(
9475
+ `could not read ${settings_path} (${String(e)}) \u2014 rule scoping falls back to legacy-all, so ALL rules including maintainer-only ones will be installed. Fix the file to restore scoping.`
9476
+ );
9477
+ return LEGACY_ALL;
9478
+ }
9479
+ const parsed = yamlSafeLoad(text);
9480
+ if (!_isPlainObject(parsed)) {
9481
+ warn(
9482
+ `${settings_path} is not a YAML mapping \u2014 rule scoping falls back to legacy-all, so ALL rules including maintainer-only ones will be installed. Fix the file to restore scoping.`
9483
+ );
9484
+ return LEGACY_ALL;
9485
+ }
9486
+ try {
9487
+ return ruleScopeFromSettings(parsed);
9488
+ } catch (e) {
9489
+ warn(
9490
+ `could not derive rule scope from ${settings_path} (${String(e)}) \u2014 falling back to legacy-all; ALL rules will be installed.`
9491
+ );
9492
+ return LEGACY_ALL;
9493
+ }
9494
+ }
9495
+ function _rule_filter_for_source(src_rel, scope) {
9496
+ if (src_rel !== RULE_SOURCE_REL) return null;
9497
+ return (srcFile) => ruleFileArrives(srcFile, scope);
9498
+ }
9267
9499
  function _prune_scoped_modules(deploy_results, active_ids) {
9268
9500
  return _prune_modules_by(deploy_results, (p) => {
9269
9501
  const packs = frontmatter_packs(p);
@@ -9474,15 +9706,15 @@ function _write_settings_surface_snapshot(installed_version) {
9474
9706
  const next = _current_settings_surface(installed_version);
9475
9707
  let previous = null;
9476
9708
  try {
9477
- const parsed = JSON.parse(fs5.readFileSync(surface_path, "utf8"));
9709
+ const parsed = JSON.parse(fs6.readFileSync(surface_path, "utf8"));
9478
9710
  if (parsed !== null && typeof parsed === "object" && parsed.entries !== void 0) previous = parsed;
9479
9711
  } catch {
9480
9712
  }
9481
9713
  if (previous !== null && previous.version !== next.version) {
9482
9714
  const delta = computeSurfaceDelta(previous, next);
9483
9715
  if (delta.changes.length > 0) {
9484
- fs5.mkdirSync(path5.dirname(delta_path), { recursive: true, mode: 448 });
9485
- fs5.writeFileSync(delta_path, `${JSON.stringify(delta, null, 2)}
9716
+ fs6.mkdirSync(path5.dirname(delta_path), { recursive: true, mode: 448 });
9717
+ fs6.writeFileSync(delta_path, `${JSON.stringify(delta, null, 2)}
9486
9718
  `, { mode: 384 });
9487
9719
  if (!state.QUIET) {
9488
9720
  const counts = {};
@@ -9494,8 +9726,8 @@ function _write_settings_surface_snapshot(installed_version) {
9494
9726
  }
9495
9727
  }
9496
9728
  }
9497
- fs5.mkdirSync(path5.dirname(surface_path), { recursive: true, mode: 448 });
9498
- fs5.writeFileSync(surface_path, `${JSON.stringify(next, null, 2)}
9729
+ fs6.mkdirSync(path5.dirname(surface_path), { recursive: true, mode: 448 });
9730
+ fs6.writeFileSync(surface_path, `${JSON.stringify(next, null, 2)}
9499
9731
  `, { mode: 384 });
9500
9732
  }
9501
9733
  function arrayStrEqual(a, b) {
@@ -9931,7 +10163,7 @@ function _pid_is_agent_config(pid) {
9931
10163
  }
9932
10164
  function unlinkMissingOk(p) {
9933
10165
  try {
9934
- fs5.unlinkSync(p);
10166
+ fs6.unlinkSync(p);
9935
10167
  } catch {
9936
10168
  }
9937
10169
  }
@@ -10016,7 +10248,7 @@ function _wizard_run_sync(cmd, env, cli) {
10016
10248
  let child;
10017
10249
  let log_fd = null;
10018
10250
  try {
10019
- log_fd = fs5.openSync(log_path, "w");
10251
+ log_fd = fs6.openSync(log_path, "w");
10020
10252
  child = spawn(cmd[0], cmd.slice(1), {
10021
10253
  env,
10022
10254
  detached: true,
@@ -10034,7 +10266,7 @@ function _wizard_run_sync(cmd, env, cli) {
10034
10266
  } finally {
10035
10267
  if (log_fd !== null) {
10036
10268
  try {
10037
- fs5.closeSync(log_fd);
10269
+ fs6.closeSync(log_fd);
10038
10270
  } catch {
10039
10271
  }
10040
10272
  }
@@ -10383,7 +10615,7 @@ function finalize_claude_model_tiers(project_root) {
10383
10615
  if (!isDir(claude_skills) || !isDir(augment_skills)) return 0;
10384
10616
  if (_read_consumer_auto_switch(project_root) !== "auto") return 0;
10385
10617
  let rendered = 0;
10386
- const entries = fs5.readdirSync(claude_skills).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
10618
+ const entries = fs6.readdirSync(claude_skills).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
10387
10619
  for (const name of entries) {
10388
10620
  const entry = path5.join(claude_skills, name);
10389
10621
  const src_dir = path5.join(augment_skills, name);
@@ -10396,12 +10628,12 @@ function finalize_claude_model_tiers(project_root) {
10396
10628
  }
10397
10629
  if (tier === null || !(tier in TIER_TO_CLAUDE_MODEL) || !isDir(src_dir)) continue;
10398
10630
  if (isSymlink(entry) || isFile(entry)) {
10399
- fs5.unlinkSync(entry);
10631
+ fs6.unlinkSync(entry);
10400
10632
  } else if (isDir(entry)) {
10401
- fs5.rmSync(entry, { recursive: true, force: true });
10633
+ fs6.rmSync(entry, { recursive: true, force: true });
10402
10634
  }
10403
10635
  mkdirp(entry);
10404
- const srcFiles = fs5.readdirSync(src_dir).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
10636
+ const srcFiles = fs6.readdirSync(src_dir).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
10405
10637
  for (const fname of srcFiles) {
10406
10638
  if (fname === "SKILL.md") {
10407
10639
  writeText(
@@ -10409,7 +10641,7 @@ function finalize_claude_model_tiers(project_root) {
10409
10641
  render_native_model_md(readText(src_md), tier)
10410
10642
  );
10411
10643
  } else {
10412
- fs5.symlinkSync(
10644
+ fs6.symlinkSync(
10413
10645
  path5.join("../../../.augment/skills", name, fname),
10414
10646
  path5.join(entry, fname)
10415
10647
  );
@@ -10564,7 +10796,7 @@ function _main_project_install(opts, project_root, parsed_tools, is_first_run) {
10564
10796
  function _resolvedArgv1() {
10565
10797
  if (process2.argv[1] === void 0) return void 0;
10566
10798
  try {
10567
- return fs5.realpathSync(path5.resolve(process2.argv[1]));
10799
+ return fs6.realpathSync(path5.resolve(process2.argv[1]));
10568
10800
  } catch {
10569
10801
  return path5.resolve(process2.argv[1]);
10570
10802
  }