@event4u/agent-config 9.10.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 (142) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/CHANGELOG.md +111 -0
  3. package/README.md +20 -16
  4. package/agents/templates/.ai-council.yml.example +481 -0
  5. package/agents/templates/.ai-video.xml.example +247 -0
  6. package/dist/agent-src/commands/fix/ci.md +29 -0
  7. package/dist/agent-src/commands/pr/create.md +60 -0
  8. package/dist/agent-src/contexts/authority/kernel-rule-edits.md +18 -2
  9. package/dist/agent-src/rules/design-fidelity.md +2 -2
  10. package/dist/agent-src/skills/ai-code-blindspots/SKILL.md +1 -0
  11. package/dist/agent-src/skills/design-intelligence/SKILL.md +27 -1
  12. package/dist/agent-src/skills/design-intelligence/data/font-pairings-reference.csv +74 -74
  13. package/dist/agent-src/skills/design-intelligence/data/manifest.json +2 -0
  14. package/dist/agent-src/skills/design-tokens/scripts/tokens.ts +0 -7
  15. package/dist/agent-src/skills/existing-ui-audit/SKILL.md +15 -2
  16. package/dist/agent-src/skills/fe-design/SKILL.md +10 -0
  17. package/dist/agent-src/skills/typography-system/SKILL.md +55 -11
  18. package/dist/agent-src/skills/ui-apply-generic/SKILL.md +180 -0
  19. package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
  20. package/dist/agent-src/templates/scripts/work_engine/directives/ui/apply.ts +34 -30
  21. package/dist/agent-src/templates/scripts/work_engine/directives/ui/design.ts +88 -33
  22. package/dist/agent-src/templates/scripts/work_engine/directives/ui/polish.ts +23 -0
  23. package/dist/agent-src/templates/scripts/work_engine/directives/ui/review.ts +24 -1
  24. package/dist/agent-src/templates/scripts/work_engine/directives/ui/stack_bundles.ts +332 -0
  25. package/dist/agent-src/templates/scripts/work_engine/stack/detect.ts +449 -11
  26. package/dist/agent-src/templates/scripts/work_engine/state.ts +21 -4
  27. package/dist/cli/initRouting.js +74 -11
  28. package/dist/cli/initRouting.js.map +1 -1
  29. package/dist/cli/main.js +14 -3
  30. package/dist/cli/main.js.map +1 -1
  31. package/dist/cli-delegate/chunk-523HCFYO.js +90 -0
  32. package/dist/cli-delegate/chunk-736JCWLM.js +1104 -0
  33. package/dist/cli-delegate/chunk-7HQ52DHU.js +74 -0
  34. package/dist/cli-delegate/chunk-A3HJ6NTI.js +1084 -0
  35. package/dist/cli-delegate/chunk-EJYIGZ3T.js +125 -0
  36. package/dist/cli-delegate/chunk-FTAISGDQ.js +117 -0
  37. package/dist/cli-delegate/chunk-GME3Q44L.js +82 -0
  38. package/dist/cli-delegate/chunk-GRRPEPRN.js +336 -0
  39. package/dist/cli-delegate/chunk-HJ6DAJHR.js +502 -0
  40. package/dist/cli-delegate/chunk-HYWSRNUX.js +179 -0
  41. package/dist/cli-delegate/chunk-J55WI3RR.js +47 -0
  42. package/dist/cli-delegate/chunk-MCJYCQPF.js +35 -0
  43. package/dist/cli-delegate/chunk-NDJLNC6Q.js +169 -0
  44. package/dist/cli-delegate/chunk-OMIVVCG2.js +26 -0
  45. package/dist/cli-delegate/chunk-OY53J6II.js +7336 -0
  46. package/dist/cli-delegate/chunk-QFKQLQ7X.js +10835 -0
  47. package/dist/cli-delegate/chunk-TEGJU2JX.js +6908 -0
  48. package/dist/cli-delegate/chunk-TJIAM5FW.js +133 -0
  49. package/dist/cli-delegate/chunk-XX6TOPD7.js +715 -0
  50. package/dist/cli-delegate/cmd_analyze_session.js +294 -0
  51. package/dist/cli-delegate/cmd_conformance.js +643 -0
  52. package/dist/cli-delegate/cmd_converge.js +326 -0
  53. package/dist/cli-delegate/cmd_doctor.js +142 -0
  54. package/dist/cli-delegate/cmd_explain.js +2576 -0
  55. package/dist/cli-delegate/cmd_export.js +298 -0
  56. package/dist/cli-delegate/cmd_fleet.js +333 -0
  57. package/dist/cli-delegate/cmd_memory_get.js +3878 -0
  58. package/dist/cli-delegate/cmd_migrate.js +11 -0
  59. package/dist/cli-delegate/cmd_preflight.js +153 -0
  60. package/dist/cli-delegate/cmd_prune.js +446 -0
  61. package/dist/cli-delegate/cmd_refresh.js +28 -0
  62. package/dist/cli-delegate/cmd_settings_check.js +574 -0
  63. package/dist/cli-delegate/cmd_settings_migrate.js +225 -0
  64. package/dist/cli-delegate/cmd_sync.js +266 -0
  65. package/dist/cli-delegate/cmd_uninstall.js +657 -0
  66. package/dist/cli-delegate/cmd_update.js +425 -0
  67. package/dist/cli-delegate/cmd_upgrade.js +444 -0
  68. package/dist/cli-delegate/cmd_validate.js +307 -0
  69. package/dist/cli-delegate/cmd_versions.js +370 -0
  70. package/dist/discovery/deprecation-report.md +1 -1
  71. package/dist/discovery/discovery-manifest.json +45 -16
  72. package/dist/discovery/discovery-manifest.json.sha256 +1 -1
  73. package/dist/discovery/discovery-manifest.summary.md +3 -3
  74. package/dist/discovery/orphan-report.md +1 -1
  75. package/dist/discovery/packs.json +13 -7
  76. package/dist/discovery/trust-report.md +2 -2
  77. package/dist/discovery/workspaces.json +6 -4
  78. package/dist/install/emit_host_rules_cli.js +2 -1
  79. package/dist/install/emit_host_rules_cli.js.map +1 -1
  80. package/dist/install/install.mjs +634 -409
  81. package/dist/install/ruleInScope.js +123 -0
  82. package/dist/install/ruleInScope.js.map +1 -0
  83. package/dist/install/rule_scope.js +7 -3
  84. package/dist/install/rule_scope.js.map +1 -1
  85. package/dist/install/toolDetection.js +40 -12
  86. package/dist/install/toolDetection.js.map +1 -1
  87. package/dist/install/wizard-plan.js +12 -3
  88. package/dist/install/wizard-plan.js.map +1 -1
  89. package/dist/mcp/registry-manifest.json +3 -3
  90. package/dist/mcp/server.json +2 -2
  91. package/dist/mcp/server.mjs +1553 -2728
  92. package/dist/router.json +1 -1
  93. package/dist/scripts/condense.js +6 -22
  94. package/dist/scripts/condense.js.map +1 -1
  95. package/docs/guidelines/design-fidelity-mechanics.md +14 -0
  96. package/package.json +4 -2
  97. package/src/agent-src/templates/scripts/work_engine/directives/ui/apply.ts +34 -30
  98. package/src/agent-src/templates/scripts/work_engine/directives/ui/design.ts +88 -33
  99. package/src/agent-src/templates/scripts/work_engine/directives/ui/polish.ts +23 -0
  100. package/src/agent-src/templates/scripts/work_engine/directives/ui/review.ts +24 -1
  101. package/src/agent-src/templates/scripts/work_engine/directives/ui/stack_bundles.ts +332 -0
  102. package/src/agent-src/templates/scripts/work_engine/stack/detect.ts +449 -11
  103. package/src/agent-src/templates/scripts/work_engine/state.ts +21 -4
  104. package/src/config/discovery/packs.yml +7 -0
  105. package/src/config/evaluator-budgets.json +1 -1
  106. package/src/config/pack-size-budget.json +27 -0
  107. package/src/install/emit_host_rules_cli.ts +2 -1
  108. package/src/install/ruleInScope.ts +133 -0
  109. package/src/install/rule_scope.ts +7 -3
  110. package/src/install/toolDetection.ts +39 -8
  111. package/src/install/wizard-plan.ts +13 -3
  112. package/src/scripts/_cli/cmd_conformance.ts +2 -1
  113. package/src/scripts/_cli/cmd_converge.ts +2 -1
  114. package/src/scripts/_cli/cmd_doctor.ts +214 -13
  115. package/src/scripts/_cli/cmd_export.ts +2 -1
  116. package/src/scripts/_cli/cmd_fleet.ts +2 -1
  117. package/src/scripts/_cli/cmd_migrate.ts +2 -1
  118. package/src/scripts/_cli/cmd_preflight.ts +2 -1
  119. package/src/scripts/_cli/cmd_refresh.ts +2 -1
  120. package/src/scripts/_cli/cmd_update.ts +2 -1
  121. package/src/scripts/_cli/cmd_upgrade.ts +2 -1
  122. package/src/scripts/_cli/cmd_versions.ts +2 -1
  123. package/src/scripts/_cli/detection_report.ts +480 -0
  124. package/src/scripts/_dispatch.bash +52 -14
  125. package/src/scripts/_lib/changelog_eras.ts +103 -9
  126. package/src/scripts/_lib/environment_detector.ts +441 -0
  127. package/src/scripts/_lib/global_deploy_inventory.ts +38 -2
  128. package/src/scripts/_lib/package_root.ts +72 -0
  129. package/src/scripts/ai_council/config.ts +15 -7
  130. package/src/scripts/ai_council/modes.ts +68 -2
  131. package/src/scripts/ai_council/transport_resolver.ts +331 -0
  132. package/src/scripts/check_bundle_path_leakage.ts +10 -4
  133. package/src/scripts/check_dependency_floors.ts +153 -0
  134. package/src/scripts/check_installer_import_purity.ts +295 -0
  135. package/src/scripts/check_pack_size.ts +188 -0
  136. package/src/scripts/condense.ts +7 -28
  137. package/src/scripts/council_cli.ts +6 -2
  138. package/src/scripts/evaluator_umbrella.sh +34 -1
  139. package/src/scripts/install-hooks.sh +36 -4
  140. package/src/scripts/install.ts +210 -5
  141. package/src/scripts/lint_eval_fixture_citations.ts +113 -0
  142. package/src/scripts/lint_ui_stack_bundles.ts +201 -0
@@ -117,17 +117,17 @@ var require_visit = __commonJS({
117
117
  visit.BREAK = BREAK;
118
118
  visit.SKIP = SKIP;
119
119
  visit.REMOVE = REMOVE;
120
- function visit_(key, node, visitor, path13) {
121
- const ctrl = callVisitor(key, node, visitor, path13);
120
+ function visit_(key, node, visitor, path15) {
121
+ const ctrl = callVisitor(key, node, visitor, path15);
122
122
  if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
123
- replaceNode(key, path13, ctrl);
124
- return visit_(key, ctrl, visitor, path13);
123
+ replaceNode(key, path15, ctrl);
124
+ return visit_(key, ctrl, visitor, path15);
125
125
  }
126
126
  if (typeof ctrl !== "symbol") {
127
127
  if (identity.isCollection(node)) {
128
- path13 = Object.freeze(path13.concat(node));
128
+ path15 = Object.freeze(path15.concat(node));
129
129
  for (let i = 0; i < node.items.length; ++i) {
130
- const ci = visit_(i, node.items[i], visitor, path13);
130
+ const ci = visit_(i, node.items[i], visitor, path15);
131
131
  if (typeof ci === "number")
132
132
  i = ci - 1;
133
133
  else if (ci === BREAK)
@@ -138,13 +138,13 @@ var require_visit = __commonJS({
138
138
  }
139
139
  }
140
140
  } else if (identity.isPair(node)) {
141
- path13 = Object.freeze(path13.concat(node));
142
- const ck = visit_("key", node.key, visitor, path13);
141
+ path15 = Object.freeze(path15.concat(node));
142
+ const ck = visit_("key", node.key, visitor, path15);
143
143
  if (ck === BREAK)
144
144
  return BREAK;
145
145
  else if (ck === REMOVE)
146
146
  node.key = null;
147
- const cv = visit_("value", node.value, visitor, path13);
147
+ const cv = visit_("value", node.value, visitor, path15);
148
148
  if (cv === BREAK)
149
149
  return BREAK;
150
150
  else if (cv === REMOVE)
@@ -165,17 +165,17 @@ var require_visit = __commonJS({
165
165
  visitAsync.BREAK = BREAK;
166
166
  visitAsync.SKIP = SKIP;
167
167
  visitAsync.REMOVE = REMOVE;
168
- async function visitAsync_(key, node, visitor, path13) {
169
- const ctrl = await callVisitor(key, node, visitor, path13);
168
+ async function visitAsync_(key, node, visitor, path15) {
169
+ const ctrl = await callVisitor(key, node, visitor, path15);
170
170
  if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
171
- replaceNode(key, path13, ctrl);
172
- return visitAsync_(key, ctrl, visitor, path13);
171
+ replaceNode(key, path15, ctrl);
172
+ return visitAsync_(key, ctrl, visitor, path15);
173
173
  }
174
174
  if (typeof ctrl !== "symbol") {
175
175
  if (identity.isCollection(node)) {
176
- path13 = Object.freeze(path13.concat(node));
176
+ path15 = Object.freeze(path15.concat(node));
177
177
  for (let i = 0; i < node.items.length; ++i) {
178
- const ci = await visitAsync_(i, node.items[i], visitor, path13);
178
+ const ci = await visitAsync_(i, node.items[i], visitor, path15);
179
179
  if (typeof ci === "number")
180
180
  i = ci - 1;
181
181
  else if (ci === BREAK)
@@ -186,13 +186,13 @@ var require_visit = __commonJS({
186
186
  }
187
187
  }
188
188
  } else if (identity.isPair(node)) {
189
- path13 = Object.freeze(path13.concat(node));
190
- const ck = await visitAsync_("key", node.key, visitor, path13);
189
+ path15 = Object.freeze(path15.concat(node));
190
+ const ck = await visitAsync_("key", node.key, visitor, path15);
191
191
  if (ck === BREAK)
192
192
  return BREAK;
193
193
  else if (ck === REMOVE)
194
194
  node.key = null;
195
- const cv = await visitAsync_("value", node.value, visitor, path13);
195
+ const cv = await visitAsync_("value", node.value, visitor, path15);
196
196
  if (cv === BREAK)
197
197
  return BREAK;
198
198
  else if (cv === REMOVE)
@@ -219,23 +219,23 @@ var require_visit = __commonJS({
219
219
  }
220
220
  return visitor;
221
221
  }
222
- function callVisitor(key, node, visitor, path13) {
222
+ function callVisitor(key, node, visitor, path15) {
223
223
  if (typeof visitor === "function")
224
- return visitor(key, node, path13);
224
+ return visitor(key, node, path15);
225
225
  if (identity.isMap(node))
226
- return visitor.Map?.(key, node, path13);
226
+ return visitor.Map?.(key, node, path15);
227
227
  if (identity.isSeq(node))
228
- return visitor.Seq?.(key, node, path13);
228
+ return visitor.Seq?.(key, node, path15);
229
229
  if (identity.isPair(node))
230
- return visitor.Pair?.(key, node, path13);
230
+ return visitor.Pair?.(key, node, path15);
231
231
  if (identity.isScalar(node))
232
- return visitor.Scalar?.(key, node, path13);
232
+ return visitor.Scalar?.(key, node, path15);
233
233
  if (identity.isAlias(node))
234
- return visitor.Alias?.(key, node, path13);
234
+ return visitor.Alias?.(key, node, path15);
235
235
  return void 0;
236
236
  }
237
- function replaceNode(key, path13, node) {
238
- const parent = path13[path13.length - 1];
237
+ function replaceNode(key, path15, node) {
238
+ const parent = path15[path15.length - 1];
239
239
  if (identity.isCollection(parent)) {
240
240
  parent.items[key] = node;
241
241
  } else if (identity.isPair(parent)) {
@@ -845,10 +845,10 @@ var require_Collection = __commonJS({
845
845
  var createNode = require_createNode();
846
846
  var identity = require_identity();
847
847
  var Node = require_Node();
848
- function collectionFromPath(schema, path13, value) {
848
+ function collectionFromPath(schema, path15, value) {
849
849
  let v = value;
850
- for (let i = path13.length - 1; i >= 0; --i) {
851
- const k = path13[i];
850
+ for (let i = path15.length - 1; i >= 0; --i) {
851
+ const k = path15[i];
852
852
  if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
853
853
  const a = [];
854
854
  a[k] = v;
@@ -867,7 +867,7 @@ var require_Collection = __commonJS({
867
867
  sourceObjects: /* @__PURE__ */ new Map()
868
868
  });
869
869
  }
870
- var isEmptyPath = (path13) => path13 == null || typeof path13 === "object" && !!path13[Symbol.iterator]().next().done;
870
+ var isEmptyPath = (path15) => path15 == null || typeof path15 === "object" && !!path15[Symbol.iterator]().next().done;
871
871
  var Collection = class extends Node.NodeBase {
872
872
  constructor(type, schema) {
873
873
  super(type);
@@ -897,11 +897,11 @@ var require_Collection = __commonJS({
897
897
  * be a Pair instance or a `{ key, value }` object, which may not have a key
898
898
  * that already exists in the map.
899
899
  */
900
- addIn(path13, value) {
901
- if (isEmptyPath(path13))
900
+ addIn(path15, value) {
901
+ if (isEmptyPath(path15))
902
902
  this.add(value);
903
903
  else {
904
- const [key, ...rest] = path13;
904
+ const [key, ...rest] = path15;
905
905
  const node = this.get(key, true);
906
906
  if (identity.isCollection(node))
907
907
  node.addIn(rest, value);
@@ -915,8 +915,8 @@ var require_Collection = __commonJS({
915
915
  * Removes a value from the collection.
916
916
  * @returns `true` if the item was found and removed.
917
917
  */
918
- deleteIn(path13) {
919
- const [key, ...rest] = path13;
918
+ deleteIn(path15) {
919
+ const [key, ...rest] = path15;
920
920
  if (rest.length === 0)
921
921
  return this.delete(key);
922
922
  const node = this.get(key, true);
@@ -930,8 +930,8 @@ var require_Collection = __commonJS({
930
930
  * scalar values from their surrounding node; to disable set `keepScalar` to
931
931
  * `true` (collections are always returned intact).
932
932
  */
933
- getIn(path13, keepScalar) {
934
- const [key, ...rest] = path13;
933
+ getIn(path15, keepScalar) {
934
+ const [key, ...rest] = path15;
935
935
  const node = this.get(key, true);
936
936
  if (rest.length === 0)
937
937
  return !keepScalar && identity.isScalar(node) ? node.value : node;
@@ -949,8 +949,8 @@ var require_Collection = __commonJS({
949
949
  /**
950
950
  * Checks if the collection includes a value with the key `key`.
951
951
  */
952
- hasIn(path13) {
953
- const [key, ...rest] = path13;
952
+ hasIn(path15) {
953
+ const [key, ...rest] = path15;
954
954
  if (rest.length === 0)
955
955
  return this.has(key);
956
956
  const node = this.get(key, true);
@@ -960,8 +960,8 @@ var require_Collection = __commonJS({
960
960
  * Sets a value in this collection. For `!!set`, `value` needs to be a
961
961
  * boolean to add/remove the item from the set.
962
962
  */
963
- setIn(path13, value) {
964
- const [key, ...rest] = path13;
963
+ setIn(path15, value) {
964
+ const [key, ...rest] = path15;
965
965
  if (rest.length === 0) {
966
966
  this.set(key, value);
967
967
  } else {
@@ -3476,9 +3476,9 @@ var require_Document = __commonJS({
3476
3476
  this.contents.add(value);
3477
3477
  }
3478
3478
  /** Adds a value to the document. */
3479
- addIn(path13, value) {
3479
+ addIn(path15, value) {
3480
3480
  if (assertCollection(this.contents))
3481
- this.contents.addIn(path13, value);
3481
+ this.contents.addIn(path15, value);
3482
3482
  }
3483
3483
  /**
3484
3484
  * Create a new `Alias` node, ensuring that the target `node` has the required anchor.
@@ -3553,14 +3553,14 @@ var require_Document = __commonJS({
3553
3553
  * Removes a value from the document.
3554
3554
  * @returns `true` if the item was found and removed.
3555
3555
  */
3556
- deleteIn(path13) {
3557
- if (Collection.isEmptyPath(path13)) {
3556
+ deleteIn(path15) {
3557
+ if (Collection.isEmptyPath(path15)) {
3558
3558
  if (this.contents == null)
3559
3559
  return false;
3560
3560
  this.contents = null;
3561
3561
  return true;
3562
3562
  }
3563
- return assertCollection(this.contents) ? this.contents.deleteIn(path13) : false;
3563
+ return assertCollection(this.contents) ? this.contents.deleteIn(path15) : false;
3564
3564
  }
3565
3565
  /**
3566
3566
  * Returns item at `key`, or `undefined` if not found. By default unwraps
@@ -3575,10 +3575,10 @@ var require_Document = __commonJS({
3575
3575
  * scalar values from their surrounding node; to disable set `keepScalar` to
3576
3576
  * `true` (collections are always returned intact).
3577
3577
  */
3578
- getIn(path13, keepScalar) {
3579
- if (Collection.isEmptyPath(path13))
3578
+ getIn(path15, keepScalar) {
3579
+ if (Collection.isEmptyPath(path15))
3580
3580
  return !keepScalar && identity.isScalar(this.contents) ? this.contents.value : this.contents;
3581
- return identity.isCollection(this.contents) ? this.contents.getIn(path13, keepScalar) : void 0;
3581
+ return identity.isCollection(this.contents) ? this.contents.getIn(path15, keepScalar) : void 0;
3582
3582
  }
3583
3583
  /**
3584
3584
  * Checks if the document includes a value with the key `key`.
@@ -3589,10 +3589,10 @@ var require_Document = __commonJS({
3589
3589
  /**
3590
3590
  * Checks if the document includes a value at `path`.
3591
3591
  */
3592
- hasIn(path13) {
3593
- if (Collection.isEmptyPath(path13))
3592
+ hasIn(path15) {
3593
+ if (Collection.isEmptyPath(path15))
3594
3594
  return this.contents !== void 0;
3595
- return identity.isCollection(this.contents) ? this.contents.hasIn(path13) : false;
3595
+ return identity.isCollection(this.contents) ? this.contents.hasIn(path15) : false;
3596
3596
  }
3597
3597
  /**
3598
3598
  * Sets a value in this document. For `!!set`, `value` needs to be a
@@ -3609,13 +3609,13 @@ var require_Document = __commonJS({
3609
3609
  * Sets a value in this document. For `!!set`, `value` needs to be a
3610
3610
  * boolean to add/remove the item from the set.
3611
3611
  */
3612
- setIn(path13, value) {
3613
- if (Collection.isEmptyPath(path13)) {
3612
+ setIn(path15, value) {
3613
+ if (Collection.isEmptyPath(path15)) {
3614
3614
  this.contents = value;
3615
3615
  } else if (this.contents == null) {
3616
- this.contents = Collection.collectionFromPath(this.schema, Array.from(path13), value);
3616
+ this.contents = Collection.collectionFromPath(this.schema, Array.from(path15), value);
3617
3617
  } else if (assertCollection(this.contents)) {
3618
- this.contents.setIn(path13, value);
3618
+ this.contents.setIn(path15, value);
3619
3619
  }
3620
3620
  }
3621
3621
  /**
@@ -5575,9 +5575,9 @@ var require_cst_visit = __commonJS({
5575
5575
  visit.BREAK = BREAK;
5576
5576
  visit.SKIP = SKIP;
5577
5577
  visit.REMOVE = REMOVE;
5578
- visit.itemAtPath = (cst, path13) => {
5578
+ visit.itemAtPath = (cst, path15) => {
5579
5579
  let item = cst;
5580
- for (const [field, index] of path13) {
5580
+ for (const [field, index] of path15) {
5581
5581
  const tok = item?.[field];
5582
5582
  if (tok && "items" in tok) {
5583
5583
  item = tok.items[index];
@@ -5586,23 +5586,23 @@ var require_cst_visit = __commonJS({
5586
5586
  }
5587
5587
  return item;
5588
5588
  };
5589
- visit.parentCollection = (cst, path13) => {
5590
- const parent = visit.itemAtPath(cst, path13.slice(0, -1));
5591
- const field = path13[path13.length - 1][0];
5589
+ visit.parentCollection = (cst, path15) => {
5590
+ const parent = visit.itemAtPath(cst, path15.slice(0, -1));
5591
+ const field = path15[path15.length - 1][0];
5592
5592
  const coll = parent?.[field];
5593
5593
  if (coll && "items" in coll)
5594
5594
  return coll;
5595
5595
  throw new Error("Parent collection not found");
5596
5596
  };
5597
- function _visit(path13, item, visitor) {
5598
- let ctrl = visitor(item, path13);
5597
+ function _visit(path15, item, visitor) {
5598
+ let ctrl = visitor(item, path15);
5599
5599
  if (typeof ctrl === "symbol")
5600
5600
  return ctrl;
5601
5601
  for (const field of ["key", "value"]) {
5602
5602
  const token = item[field];
5603
5603
  if (token && "items" in token) {
5604
5604
  for (let i = 0; i < token.items.length; ++i) {
5605
- const ci = _visit(Object.freeze(path13.concat([[field, i]])), token.items[i], visitor);
5605
+ const ci = _visit(Object.freeze(path15.concat([[field, i]])), token.items[i], visitor);
5606
5606
  if (typeof ci === "number")
5607
5607
  i = ci - 1;
5608
5608
  else if (ci === BREAK)
@@ -5613,10 +5613,10 @@ var require_cst_visit = __commonJS({
5613
5613
  }
5614
5614
  }
5615
5615
  if (typeof ctrl === "function" && field === "key")
5616
- ctrl = ctrl(item, path13);
5616
+ ctrl = ctrl(item, path15);
5617
5617
  }
5618
5618
  }
5619
- return typeof ctrl === "function" ? ctrl(item, path13) : ctrl;
5619
+ return typeof ctrl === "function" ? ctrl(item, path15) : ctrl;
5620
5620
  }
5621
5621
  exports.visit = visit;
5622
5622
  }
@@ -6918,14 +6918,14 @@ var require_parser = __commonJS({
6918
6918
  case "scalar":
6919
6919
  case "single-quoted-scalar":
6920
6920
  case "double-quoted-scalar": {
6921
- const fs15 = this.flowScalar(this.type);
6921
+ const fs17 = this.flowScalar(this.type);
6922
6922
  if (atNextItem || it.value) {
6923
- map.items.push({ start, key: fs15, sep: [] });
6923
+ map.items.push({ start, key: fs17, sep: [] });
6924
6924
  this.onKeyLine = true;
6925
6925
  } else if (it.sep) {
6926
- this.stack.push(fs15);
6926
+ this.stack.push(fs17);
6927
6927
  } else {
6928
- Object.assign(it, { key: fs15, sep: [] });
6928
+ Object.assign(it, { key: fs17, sep: [] });
6929
6929
  this.onKeyLine = true;
6930
6930
  }
6931
6931
  return;
@@ -7053,13 +7053,13 @@ var require_parser = __commonJS({
7053
7053
  case "scalar":
7054
7054
  case "single-quoted-scalar":
7055
7055
  case "double-quoted-scalar": {
7056
- const fs15 = this.flowScalar(this.type);
7056
+ const fs17 = this.flowScalar(this.type);
7057
7057
  if (!it || it.value)
7058
- fc.items.push({ start: [], key: fs15, sep: [] });
7058
+ fc.items.push({ start: [], key: fs17, sep: [] });
7059
7059
  else if (it.sep)
7060
- this.stack.push(fs15);
7060
+ this.stack.push(fs17);
7061
7061
  else
7062
- Object.assign(it, { key: fs15, sep: [] });
7062
+ Object.assign(it, { key: fs17, sep: [] });
7063
7063
  return;
7064
7064
  }
7065
7065
  case "flow-map-end":
@@ -7267,7 +7267,7 @@ var require_public_api = __commonJS({
7267
7267
  }
7268
7268
  return doc;
7269
7269
  }
7270
- function parse2(src, reviver, options) {
7270
+ function parse3(src, reviver, options) {
7271
7271
  let _reviver = void 0;
7272
7272
  if (typeof reviver === "function") {
7273
7273
  _reviver = reviver;
@@ -7308,7 +7308,7 @@ var require_public_api = __commonJS({
7308
7308
  return value.toString(options);
7309
7309
  return new Document.Document(value, _replacer, options).toString(options);
7310
7310
  }
7311
- exports.parse = parse2;
7311
+ exports.parse = parse3;
7312
7312
  exports.parseAllDocuments = parseAllDocuments;
7313
7313
  exports.parseDocument = parseDocument;
7314
7314
  exports.stringify = stringify;
@@ -7370,11 +7370,11 @@ var require_dist = __commonJS({
7370
7370
  // src/scripts/install.ts
7371
7371
  import { spawn, spawnSync as spawnSync2 } from "node:child_process";
7372
7372
  import * as crypto3 from "node:crypto";
7373
- import * as fs14 from "node:fs";
7373
+ import * as fs16 from "node:fs";
7374
7374
  import * as os7 from "node:os";
7375
- import * as path12 from "node:path";
7375
+ import * as path14 from "node:path";
7376
7376
  import process3 from "node:process";
7377
- import { fileURLToPath as fileURLToPath3, pathToFileURL as pathToFileURL2 } from "node:url";
7377
+ import { fileURLToPath as fileURLToPath4, pathToFileURL as pathToFileURL2 } from "node:url";
7378
7378
 
7379
7379
  // src/scripts/_lib/json_pointers.ts
7380
7380
  import { createHash } from "node:crypto";
@@ -7872,8 +7872,8 @@ function lockfile_write_path(env) {
7872
7872
  }
7873
7873
  return write_target("installed.lock", { env: env ?? null });
7874
7874
  }
7875
- function read_lockfile(path13) {
7876
- const target = path13 ?? lockfile_path();
7875
+ function read_lockfile(path15) {
7876
+ const target = path15 ?? lockfile_path();
7877
7877
  let text;
7878
7878
  try {
7879
7879
  text = fs2.readFileSync(target, { encoding: "utf-8" });
@@ -8116,8 +8116,8 @@ function load_lab_pack_ids(repo_root) {
8116
8116
  const vocab = path3.join(repo_root, "src", "config", "discovery", "packs.yml");
8117
8117
  const ids = /* @__PURE__ */ new Set();
8118
8118
  try {
8119
- const YAML2 = require_dist();
8120
- const data = YAML2.parse(fs3.readFileSync(vocab, "utf-8"), { version: "1.1" });
8119
+ const YAML3 = require_dist();
8120
+ const data = YAML3.parse(fs3.readFileSync(vocab, "utf-8"), { version: "1.1" });
8121
8121
  for (const entry of data ?? []) {
8122
8122
  if (entry && typeof entry === "object" && !Array.isArray(entry)) {
8123
8123
  const rec = entry;
@@ -8350,7 +8350,7 @@ function json_string_ascii(s) {
8350
8350
  }
8351
8351
  return out;
8352
8352
  }
8353
- function expected_deploy_files(src, dest_rel) {
8353
+ function expected_deploy_files(src, dest_rel, file_filter = null) {
8354
8354
  const out = /* @__PURE__ */ new Set();
8355
8355
  let src_stat;
8356
8356
  try {
@@ -8359,6 +8359,9 @@ function expected_deploy_files(src, dest_rel) {
8359
8359
  return out;
8360
8360
  }
8361
8361
  if (!src_stat.isDirectory()) {
8362
+ if (file_filter !== null && !file_filter(src)) {
8363
+ return out;
8364
+ }
8362
8365
  out.add(as_posix(dest_rel));
8363
8366
  return out;
8364
8367
  }
@@ -8382,6 +8385,9 @@ function expected_deploy_files(src, dest_rel) {
8382
8385
  _walk(fs4.realpathSync(entry), rel);
8383
8386
  continue;
8384
8387
  }
8388
+ if (file_filter !== null && !file_filter(entry)) {
8389
+ continue;
8390
+ }
8385
8391
  out.add(as_posix(rel));
8386
8392
  }
8387
8393
  };
@@ -8741,18 +8747,18 @@ function manifest_path(project_root, env) {
8741
8747
  var _TOP_KEY_RE = /^([A-Za-z_][A-Za-z0-9_]*)\s*:\s*"?([^"\n]*?)"?\s*$/;
8742
8748
  var _LIST_DASH_RE = /^\s*-\s*(.+?)\s*$/;
8743
8749
  var _INDENT_KEY_RE = /^\s+([A-Za-z_][A-Za-z0-9_]*)\s*:\s*"?([^"\n]*?)"?\s*$/;
8744
- function read_manifest(path13) {
8750
+ function read_manifest(path15) {
8745
8751
  let text;
8746
8752
  try {
8747
- text = require_read_text(path13);
8753
+ text = require_read_text(path15);
8748
8754
  } catch {
8749
8755
  return null;
8750
8756
  }
8751
8757
  const data = _parse_manual(text);
8752
8758
  return _normalise_v2_shape(data);
8753
8759
  }
8754
- function require_read_text(path13) {
8755
- return fs6.readFileSync(path13, { encoding: "utf-8" });
8760
+ function require_read_text(path15) {
8761
+ return fs6.readFileSync(path15, { encoding: "utf-8" });
8756
8762
  }
8757
8763
  function _normalise_v2_shape(data) {
8758
8764
  if (data["tools"] === void 0 || data["tools"] === null) {
@@ -8933,9 +8939,9 @@ function stable_sort(items, key) {
8933
8939
  return a.index - b.index;
8934
8940
  }).map((entry) => entry.item);
8935
8941
  }
8936
- function write_manifest(path13, version, tools, options = {}) {
8942
+ function write_manifest(path15, version, tools, options = {}) {
8937
8943
  const rendered = _render2(version, tools, { deploy_roots: options.deploy_roots ?? null });
8938
- return write_atomic(path13, rendered);
8944
+ return write_atomic(path15, rendered);
8939
8945
  }
8940
8946
  var ScopeMismatchError = class extends Error {
8941
8947
  name_;
@@ -9882,16 +9888,16 @@ function _read_yaml(p) {
9882
9888
  if (!_is_file(p)) {
9883
9889
  return null;
9884
9890
  }
9885
- let YAML2;
9891
+ let YAML3;
9886
9892
  try {
9887
- YAML2 = _require("yaml");
9893
+ YAML3 = _require("yaml");
9888
9894
  } catch {
9889
9895
  return null;
9890
9896
  }
9891
9897
  let data;
9892
9898
  try {
9893
9899
  const text = fs10.readFileSync(p, "utf-8");
9894
- data = YAML2.parse(text, { version: "1.1" });
9900
+ data = YAML3.parse(text, { version: "1.1" });
9895
9901
  if (data === null || data === void 0) {
9896
9902
  data = {};
9897
9903
  }
@@ -9981,6 +9987,101 @@ function _is_plain_dict(value) {
9981
9987
  return typeof value === "object" && value !== null && !Array.isArray(value);
9982
9988
  }
9983
9989
 
9990
+ // src/install/rule_scope.ts
9991
+ import * as path10 from "node:path";
9992
+
9993
+ // src/install/ruleInScope.ts
9994
+ var YAML2 = __toESM(require_dist(), 1);
9995
+ import * as fs11 from "node:fs";
9996
+ function parseYaml2(text) {
9997
+ try {
9998
+ const data = YAML2.parse(text, { version: "1.1" });
9999
+ return data === void 0 ? null : data;
10000
+ } catch {
10001
+ return null;
10002
+ }
10003
+ }
10004
+ function strip(s) {
10005
+ return s.replace(/^\s+/u, "").replace(/\s+$/u, "");
10006
+ }
10007
+ function lstripNewlines(s) {
10008
+ return s.replace(/^\n+/, "");
10009
+ }
10010
+ function parseFrontmatter(content) {
10011
+ if (!content.startsWith("---")) {
10012
+ return [{}, content];
10013
+ }
10014
+ const end = content.indexOf("\n---", 3);
10015
+ if (end === -1) {
10016
+ return [{}, content];
10017
+ }
10018
+ const raw = strip(content.slice(3, end));
10019
+ const body = lstripNewlines(content.slice(end + 4));
10020
+ let meta = parseYaml2(raw);
10021
+ if (meta === null || meta === void 0) {
10022
+ meta = {};
10023
+ }
10024
+ if (typeof meta === "object" && meta !== null && !Array.isArray(meta)) {
10025
+ return [meta, body];
10026
+ }
10027
+ return [{}, body];
10028
+ }
10029
+ function rule_in_scope(source_path, scope, pack_scope = null, role_scope = null) {
10030
+ if (scope === null && pack_scope === null && role_scope === null) {
10031
+ return true;
10032
+ }
10033
+ const [meta] = parseFrontmatter(fs11.readFileSync(source_path, "utf-8"));
10034
+ if (meta["type"] === "always" || meta["alwaysApply"] === true) {
10035
+ return true;
10036
+ }
10037
+ const axis = (key, configured) => {
10038
+ if (configured === null) {
10039
+ return true;
10040
+ }
10041
+ const values = Array.isArray(meta[key]) ? meta[key].map((w) => String(w)) : [];
10042
+ if (values.length === 0) {
10043
+ return true;
10044
+ }
10045
+ return values.some((v) => configured.includes(v));
10046
+ };
10047
+ return axis("workspaces", scope) && axis("packs", pack_scope) && axis("roles", role_scope);
10048
+ }
10049
+
10050
+ // src/install/rule_scope.ts
10051
+ var COMPAT_ALWAYS_EXCLUDED = ["source-of-truth.md"];
10052
+ var LEGACY_ALL = { workspaces: null, packs: null };
10053
+ function _list(value) {
10054
+ if (Array.isArray(value) && value.length > 0) {
10055
+ return value.map((v) => String(v));
10056
+ }
10057
+ return null;
10058
+ }
10059
+ function ruleScopeFromSettings(settings) {
10060
+ const proj = settings["projection"];
10061
+ if (typeof proj !== "object" || proj === null || Array.isArray(proj)) {
10062
+ return LEGACY_ALL;
10063
+ }
10064
+ const p = proj;
10065
+ return {
10066
+ workspaces: _list(p["rule_workspaces"]),
10067
+ packs: _list(p["rule_packs"]),
10068
+ roles: _list(p["rule_roles"])
10069
+ };
10070
+ }
10071
+ function ruleFileArrives(sourcePath, scope) {
10072
+ if (!sourcePath.endsWith(".md")) {
10073
+ return true;
10074
+ }
10075
+ const basename5 = path10.basename(sourcePath);
10076
+ if (COMPAT_ALWAYS_EXCLUDED.includes(basename5)) {
10077
+ return false;
10078
+ }
10079
+ return rule_in_scope(sourcePath, scope.workspaces, scope.packs, scope.roles ?? null);
10080
+ }
10081
+
10082
+ // src/install/wizard-plan.ts
10083
+ var RULE_SOURCE_REL = "dist/agent-src/rules";
10084
+
9984
10085
  // src/shared/settingsSurface.ts
9985
10086
  function unwrapRef(root) {
9986
10087
  if (root.$ref !== void 0 && root.definitions !== void 0) {
@@ -10529,8 +10630,8 @@ function getErrorMap() {
10529
10630
 
10530
10631
  // node_modules/zod/v3/helpers/parseUtil.js
10531
10632
  var makeIssue = (params) => {
10532
- const { data, path: path13, errorMaps, issueData } = params;
10533
- const fullPath = [...path13, ...issueData.path || []];
10633
+ const { data, path: path15, errorMaps, issueData } = params;
10634
+ const fullPath = [...path15, ...issueData.path || []];
10534
10635
  const fullIssue = {
10535
10636
  ...issueData,
10536
10637
  path: fullPath
@@ -10646,11 +10747,11 @@ var errorUtil;
10646
10747
 
10647
10748
  // node_modules/zod/v3/types.js
10648
10749
  var ParseInputLazyPath = class {
10649
- constructor(parent, value, path13, key) {
10750
+ constructor(parent, value, path15, key) {
10650
10751
  this._cachedPath = [];
10651
10752
  this.parent = parent;
10652
10753
  this.data = value;
10653
- this._path = path13;
10754
+ this._path = path15;
10654
10755
  this._key = key;
10655
10756
  }
10656
10757
  get path() {
@@ -15880,8 +15981,8 @@ var zodToJsonSchema = (schema, options) => {
15880
15981
  };
15881
15982
 
15882
15983
  // src/scripts/_lib/module_detection.ts
15883
- import * as fs11 from "node:fs";
15884
- import * as path10 from "node:path";
15984
+ import * as fs12 from "node:fs";
15985
+ import * as path11 from "node:path";
15885
15986
  var _SKIP_DIRS = /* @__PURE__ */ new Set([".module-template", ".example"]);
15886
15987
  var _RULES = [
15887
15988
  ["app/Modules", "laravel-hmvc", "App\\Modules\\{ModuleName}"],
@@ -15895,14 +15996,14 @@ var _RULES = [
15895
15996
  ];
15896
15997
  function _isDir(p) {
15897
15998
  try {
15898
- return fs11.statSync(p).isDirectory();
15999
+ return fs12.statSync(p).isDirectory();
15899
16000
  } catch {
15900
16001
  return false;
15901
16002
  }
15902
16003
  }
15903
16004
  function _isFile(p) {
15904
16005
  try {
15905
- return fs11.statSync(p).isFile();
16006
+ return fs12.statSync(p).isFile();
15906
16007
  } catch {
15907
16008
  return false;
15908
16009
  }
@@ -15916,13 +16017,13 @@ function _isUpperChar(ch) {
15916
16017
  function _list_module_subdirs(root) {
15917
16018
  let entries;
15918
16019
  try {
15919
- entries = fs11.readdirSync(root).sort();
16020
+ entries = fs12.readdirSync(root).sort();
15920
16021
  } catch {
15921
16022
  return [];
15922
16023
  }
15923
16024
  const out = [];
15924
16025
  for (const name of entries) {
15925
- if (!_isDir(path10.join(root, name))) {
16026
+ if (!_isDir(path11.join(root, name))) {
15926
16027
  continue;
15927
16028
  }
15928
16029
  if (name.startsWith(".")) {
@@ -15944,11 +16045,11 @@ function _score_confidence(stack, root, subdirs) {
15944
16045
  return capitalized.length > 0 ? "high" : "medium";
15945
16046
  }
15946
16047
  if (stack === "node-monorepo") {
15947
- const withPkgJson = subdirs.filter((name) => _isFile(path10.join(root, name, "package.json")));
16048
+ const withPkgJson = subdirs.filter((name) => _isFile(path11.join(root, name, "package.json")));
15948
16049
  return withPkgJson.length > 0 ? "high" : "medium";
15949
16050
  }
15950
16051
  if (stack === "python-src") {
15951
- const withInit = subdirs.filter((name) => _isFile(path10.join(root, name, "__init__.py")));
16052
+ const withInit = subdirs.filter((name) => _isFile(path11.join(root, name, "__init__.py")));
15952
16053
  return withInit.length > 0 ? "high" : "medium";
15953
16054
  }
15954
16055
  if (stack === "go-internal") {
@@ -15960,7 +16061,7 @@ function detect_module_roots(project_root) {
15960
16061
  const high = [];
15961
16062
  const medium = [];
15962
16063
  for (const [rel_path, stack, namespace_template] of _RULES) {
15963
- const abs_path = path10.join(project_root, rel_path);
16064
+ const abs_path = path11.join(project_root, rel_path);
15964
16065
  if (!_isDir(abs_path)) {
15965
16066
  continue;
15966
16067
  }
@@ -15982,7 +16083,7 @@ function detect_module_roots(project_root) {
15982
16083
  }
15983
16084
 
15984
16085
  // src/scripts/_lib/model_tier.ts
15985
- import fs12 from "node:fs";
16086
+ import fs13 from "node:fs";
15986
16087
  var TIER_TO_CLAUDE_MODEL = {
15987
16088
  high: "opus",
15988
16089
  medium: "sonnet",
@@ -15990,8 +16091,8 @@ var TIER_TO_CLAUDE_MODEL = {
15990
16091
  };
15991
16092
  var MODEL_TIER_RE = /^model_tier:\s*"?([a-z]+)"?\s*$/m;
15992
16093
  function read_model_tier(skill_md) {
15993
- if (!fs12.existsSync(skill_md)) return null;
15994
- const text = fs12.readFileSync(skill_md).toString("utf-8");
16094
+ if (!fs13.existsSync(skill_md)) return null;
16095
+ const text = fs13.readFileSync(skill_md).toString("utf-8");
15995
16096
  if (!text.startsWith("---\n")) return null;
15996
16097
  const end = text.indexOf("\n---\n", 4);
15997
16098
  if (end === -1) return null;
@@ -16008,10 +16109,42 @@ function render_native_model_md(text, tier) {
16008
16109
 
16009
16110
  // src/scripts/_cli/cmd_migrate.ts
16010
16111
  import { spawnSync } from "node:child_process";
16011
- import * as fs13 from "node:fs";
16012
- import * as path11 from "node:path";
16112
+ import * as fs15 from "node:fs";
16113
+ import * as path13 from "node:path";
16013
16114
  import process2 from "node:process";
16014
- import { fileURLToPath as fileURLToPath2, pathToFileURL } from "node:url";
16115
+ import { fileURLToPath as fileURLToPath3, pathToFileURL } from "node:url";
16116
+
16117
+ // src/scripts/_lib/package_root.ts
16118
+ import * as fs14 from "node:fs";
16119
+ import * as path12 from "node:path";
16120
+ import { fileURLToPath as fileURLToPath2 } from "node:url";
16121
+ var PACKAGE_NAME = "@event4u/agent-config";
16122
+ var MAX_ASCENT = 16;
16123
+ function resolvePackageRoot(fromUrlOrPath, legacyHops = 3) {
16124
+ const start = fromUrlOrPath.startsWith("file:") ? fileURLToPath2(fromUrlOrPath) : fromUrlOrPath;
16125
+ const startDir = path12.dirname(start);
16126
+ let dir = startDir;
16127
+ for (let i = 0; i < MAX_ASCENT; i++) {
16128
+ const manifest = path12.join(dir, "package.json");
16129
+ if (fs14.existsSync(manifest)) {
16130
+ try {
16131
+ const parsed = JSON.parse(fs14.readFileSync(manifest, "utf8"));
16132
+ if (parsed.name === PACKAGE_NAME) {
16133
+ return dir;
16134
+ }
16135
+ } catch {
16136
+ }
16137
+ }
16138
+ const parent = path12.dirname(dir);
16139
+ if (parent === dir) {
16140
+ break;
16141
+ }
16142
+ dir = parent;
16143
+ }
16144
+ return path12.resolve(startDir, ...Array.from({ length: legacyHops }, () => ".."));
16145
+ }
16146
+
16147
+ // src/scripts/_cli/cmd_migrate.ts
16015
16148
  var PACKAGE_NAME_NPM = "@event4u/agent-config";
16016
16149
  var PACKAGE_NAME_COMPOSER = "event4u/agent-config";
16017
16150
  var LEGACY_DIRS = ["vendor", "node_modules"];
@@ -16029,7 +16162,7 @@ var LEGACY_SETTINGS_FILES = [".agent-settings.yml", ".agent-user.yml"];
16029
16162
  var LEGACY_STATE_FILENAME = ".implement-ticket-state.json";
16030
16163
  var LEGACY_STATE_V1_FILENAME = ".work-state.json";
16031
16164
  var LEGACY_AGENT_CONFIG_SHELL = "agent-config";
16032
- var _HERE_DIR = path11.dirname(fileURLToPath2(import.meta.url));
16165
+ var _HERE_DIR = path13.dirname(fileURLToPath3(import.meta.url));
16033
16166
  var ArgparseExit = class extends Error {
16034
16167
  code;
16035
16168
  constructor(code) {
@@ -16128,38 +16261,38 @@ function _jsonDumpsIndentAscii(value, indent) {
16128
16261
  }
16129
16262
  function _isFile2(p) {
16130
16263
  try {
16131
- return fs13.statSync(p).isFile();
16264
+ return fs15.statSync(p).isFile();
16132
16265
  } catch {
16133
16266
  return false;
16134
16267
  }
16135
16268
  }
16136
16269
  function _isDir2(p) {
16137
16270
  try {
16138
- return fs13.statSync(p).isDirectory();
16271
+ return fs15.statSync(p).isDirectory();
16139
16272
  } catch {
16140
16273
  return false;
16141
16274
  }
16142
16275
  }
16143
16276
  function _isSymlink(p) {
16144
16277
  try {
16145
- return fs13.lstatSync(p).isSymbolicLink();
16278
+ return fs15.lstatSync(p).isSymbolicLink();
16146
16279
  } catch {
16147
16280
  return false;
16148
16281
  }
16149
16282
  }
16150
16283
  function _exists2(p) {
16151
16284
  try {
16152
- fs13.lstatSync(p);
16285
+ fs15.lstatSync(p);
16153
16286
  return true;
16154
16287
  } catch {
16155
16288
  return false;
16156
16289
  }
16157
16290
  }
16158
16291
  function _readText(p) {
16159
- return fs13.readFileSync(p, { encoding: "utf-8" });
16292
+ return fs15.readFileSync(p, { encoding: "utf-8" });
16160
16293
  }
16161
16294
  function _writeText(p, text) {
16162
- fs13.writeFileSync(p, text, { encoding: "utf-8" });
16295
+ fs15.writeFileSync(p, text, { encoding: "utf-8" });
16163
16296
  }
16164
16297
  function _jsonLoadFile(p) {
16165
16298
  return JSON.parse(_readText(p));
@@ -16215,7 +16348,7 @@ function _classify_symlink(link) {
16215
16348
  }
16216
16349
  let target;
16217
16350
  try {
16218
- target = fs13.readlinkSync(link);
16351
+ target = fs15.readlinkSync(link);
16219
16352
  } catch {
16220
16353
  return null;
16221
16354
  }
@@ -16226,16 +16359,16 @@ function _classify_symlink(link) {
16226
16359
  return "user";
16227
16360
  }
16228
16361
  function _detect_legacy_state(project) {
16229
- return _isFile2(path11.join(project, LEGACY_STATE_FILENAME));
16362
+ return _isFile2(path13.join(project, LEGACY_STATE_FILENAME));
16230
16363
  }
16231
16364
  function _detect_legacy_settings(project) {
16232
16365
  const found = [];
16233
16366
  for (const name of LEGACY_SETTINGS_FILES) {
16234
- const flat = path11.join(project, name);
16367
+ const flat = path13.join(project, name);
16235
16368
  if (_isFile2(flat)) {
16236
16369
  found.push(flat);
16237
16370
  }
16238
- const typed = path11.join(project, "settings", name);
16371
+ const typed = path13.join(project, "settings", name);
16239
16372
  if (_isFile2(typed)) {
16240
16373
  found.push(typed);
16241
16374
  }
@@ -16243,25 +16376,25 @@ function _detect_legacy_settings(project) {
16243
16376
  return found;
16244
16377
  }
16245
16378
  function _detect_empty_shell(project) {
16246
- const shell = path11.join(project, LEGACY_AGENT_CONFIG_SHELL);
16379
+ const shell = path13.join(project, LEGACY_AGENT_CONFIG_SHELL);
16247
16380
  if (!_isDir2(shell) || _isSymlink(shell)) {
16248
16381
  return false;
16249
16382
  }
16250
16383
  try {
16251
- return fs13.readdirSync(shell).length === 0;
16384
+ return fs15.readdirSync(shell).length === 0;
16252
16385
  } catch {
16253
16386
  return false;
16254
16387
  }
16255
16388
  }
16256
16389
  function _detect_already_migrated(project) {
16257
- if (_detect_npm(path11.join(project, "package.json"))) {
16390
+ if (_detect_npm(path13.join(project, "package.json"))) {
16258
16391
  return false;
16259
16392
  }
16260
- if (_detect_composer(path11.join(project, "composer.json"))) {
16393
+ if (_detect_composer(path13.join(project, "composer.json"))) {
16261
16394
  return false;
16262
16395
  }
16263
16396
  for (const name of MANAGED_SYMLINKS) {
16264
- if (_classify_symlink(path11.join(project, name)) === "legacy") {
16397
+ if (_classify_symlink(path13.join(project, name)) === "legacy") {
16265
16398
  return false;
16266
16399
  }
16267
16400
  }
@@ -16332,11 +16465,11 @@ function _purge_legacy_symlinks(project) {
16332
16465
  const removed = [];
16333
16466
  const preserved = [];
16334
16467
  for (const name of MANAGED_SYMLINKS) {
16335
- const link = path11.join(project, name);
16468
+ const link = path13.join(project, name);
16336
16469
  const kind = _classify_symlink(link);
16337
16470
  if (kind === "legacy") {
16338
16471
  try {
16339
- fs13.unlinkSync(link);
16472
+ fs15.unlinkSync(link);
16340
16473
  removed.push(name);
16341
16474
  } catch {
16342
16475
  preserved.push(name);
@@ -16348,14 +16481,14 @@ function _purge_legacy_symlinks(project) {
16348
16481
  return [removed, preserved];
16349
16482
  }
16350
16483
  function _migrate_state_file(project) {
16351
- const source = path11.join(project, LEGACY_STATE_FILENAME);
16484
+ const source = path13.join(project, LEGACY_STATE_FILENAME);
16352
16485
  if (!_isFile2(source)) {
16353
16486
  return null;
16354
16487
  }
16355
- const target = path11.join(project, LEGACY_STATE_V1_FILENAME);
16488
+ const target = path13.join(project, LEGACY_STATE_V1_FILENAME);
16356
16489
  if (_exists2(target)) {
16357
16490
  try {
16358
- fs13.unlinkSync(source);
16491
+ fs15.unlinkSync(source);
16359
16492
  return `removed stale ${LEGACY_STATE_FILENAME} (v1 already present)`;
16360
16493
  } catch {
16361
16494
  return null;
@@ -16369,8 +16502,8 @@ function _migrate_state_file(project) {
16369
16502
  return `migrated ${LEGACY_STATE_FILENAME} \u2192 ${LEGACY_STATE_V1_FILENAME}`;
16370
16503
  }
16371
16504
  function _load_state_migrator() {
16372
- const pkg_root = path11.resolve(_HERE_DIR, "..", "..", "..");
16373
- const rel = path11.join(
16505
+ const pkg_root = resolvePackageRoot(import.meta.url);
16506
+ const rel = path13.join(
16374
16507
  "agent-src",
16375
16508
  "templates",
16376
16509
  "scripts",
@@ -16378,8 +16511,8 @@ function _load_state_migrator() {
16378
16511
  "migration",
16379
16512
  "v0_to_v1.ts"
16380
16513
  );
16381
- const driver = [path11.join(pkg_root, "dist", rel), path11.join(pkg_root, "src", rel)].find(
16382
- (p) => fs13.existsSync(p)
16514
+ const driver = [path13.join(pkg_root, "dist", rel), path13.join(pkg_root, "src", rel)].find(
16515
+ (p) => fs15.existsSync(p)
16383
16516
  ) ?? null;
16384
16517
  if (driver === null) {
16385
16518
  return null;
@@ -16387,12 +16520,12 @@ function _load_state_migrator() {
16387
16520
  const binName = process2.platform === "win32" ? "tsx.cmd" : "tsx";
16388
16521
  let tsxBin = null;
16389
16522
  for (let dir = pkg_root; ; ) {
16390
- const cand = path11.join(dir, "node_modules", ".bin", binName);
16391
- if (fs13.existsSync(cand)) {
16523
+ const cand = path13.join(dir, "node_modules", ".bin", binName);
16524
+ if (fs15.existsSync(cand)) {
16392
16525
  tsxBin = cand;
16393
16526
  break;
16394
16527
  }
16395
- const parent = path11.dirname(dir);
16528
+ const parent = path13.dirname(dir);
16396
16529
  if (parent === dir) break;
16397
16530
  dir = parent;
16398
16531
  }
@@ -16419,17 +16552,17 @@ function _delete_legacy_settings(project) {
16419
16552
  const removed = [];
16420
16553
  for (const p of _detect_legacy_settings(project)) {
16421
16554
  try {
16422
- fs13.unlinkSync(p);
16423
- removed.push(path11.relative(project, p));
16555
+ fs15.unlinkSync(p);
16556
+ removed.push(path13.relative(project, p));
16424
16557
  } catch {
16425
16558
  continue;
16426
16559
  }
16427
16560
  }
16428
- const settings_dir = path11.join(project, "settings");
16561
+ const settings_dir = path13.join(project, "settings");
16429
16562
  if (_isDir2(settings_dir) && !_isSymlink(settings_dir)) {
16430
16563
  try {
16431
- if (fs13.readdirSync(settings_dir).length === 0) {
16432
- fs13.rmdirSync(settings_dir);
16564
+ if (fs15.readdirSync(settings_dir).length === 0) {
16565
+ fs15.rmdirSync(settings_dir);
16433
16566
  removed.push("settings/");
16434
16567
  }
16435
16568
  } catch {
@@ -16438,12 +16571,12 @@ function _delete_legacy_settings(project) {
16438
16571
  return removed;
16439
16572
  }
16440
16573
  function _remove_empty_shell(project) {
16441
- const shell = path11.join(project, LEGACY_AGENT_CONFIG_SHELL);
16574
+ const shell = path13.join(project, LEGACY_AGENT_CONFIG_SHELL);
16442
16575
  if (!_detect_empty_shell(project)) {
16443
16576
  return false;
16444
16577
  }
16445
16578
  try {
16446
- fs13.rmdirSync(shell);
16579
+ fs15.rmdirSync(shell);
16447
16580
  } catch {
16448
16581
  return false;
16449
16582
  }
@@ -16453,7 +16586,7 @@ function _reEscape(s) {
16453
16586
  return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
16454
16587
  }
16455
16588
  function _update_gitignore(project) {
16456
- const gitignore = path11.join(project, ".gitignore");
16589
+ const gitignore = path13.join(project, ".gitignore");
16457
16590
  const block = `${GITIGNORE_BLOCK_START}
16458
16591
  ${GITIGNORE_NEW_BODY}${GITIGNORE_BLOCK_END}
16459
16592
  `;
@@ -16484,16 +16617,16 @@ ${GITIGNORE_NEW_BODY}${GITIGNORE_BLOCK_END}
16484
16617
  }
16485
16618
  function _build_plan(project) {
16486
16619
  return {
16487
- npm: _detect_npm(path11.join(project, "package.json")),
16488
- composer: _detect_composer(path11.join(project, "composer.json")),
16620
+ npm: _detect_npm(path13.join(project, "package.json")),
16621
+ composer: _detect_composer(path13.join(project, "composer.json")),
16489
16622
  symlinks_legacy: MANAGED_SYMLINKS.filter(
16490
- (name) => _classify_symlink(path11.join(project, name)) === "legacy"
16623
+ (name) => _classify_symlink(path13.join(project, name)) === "legacy"
16491
16624
  ),
16492
16625
  symlinks_user: MANAGED_SYMLINKS.filter(
16493
- (name) => _classify_symlink(path11.join(project, name)) === "user"
16626
+ (name) => _classify_symlink(path13.join(project, name)) === "user"
16494
16627
  ),
16495
- state_file: _isFile2(path11.join(project, LEGACY_STATE_FILENAME)),
16496
- settings_files: _detect_legacy_settings(project).map((p) => path11.relative(project, p)),
16628
+ state_file: _isFile2(path13.join(project, LEGACY_STATE_FILENAME)),
16629
+ settings_files: _detect_legacy_settings(project).map((p) => path13.relative(project, p)),
16497
16630
  empty_shell: _detect_empty_shell(project)
16498
16631
  };
16499
16632
  }
@@ -16557,10 +16690,10 @@ function _warn_on_major_mismatch(from_major, plan, out) {
16557
16690
  }
16558
16691
  function _apply(project, out, err) {
16559
16692
  const summary = [];
16560
- if (_strip_npm_entry(path11.join(project, "package.json"))) {
16693
+ if (_strip_npm_entry(path13.join(project, "package.json"))) {
16561
16694
  summary.push(`removed ${PACKAGE_NAME_NPM} from package.json`);
16562
16695
  }
16563
- if (_strip_composer_entry(path11.join(project, "composer.json"))) {
16696
+ if (_strip_composer_entry(path13.join(project, "composer.json"))) {
16564
16697
  summary.push(`removed ${PACKAGE_NAME_COMPOSER} from composer.json`);
16565
16698
  }
16566
16699
  const [removed_links, preserved_links] = _purge_legacy_symlinks(project);
@@ -16681,18 +16814,18 @@ function main(argv = null, options = {}) {
16681
16814
  return _apply(project, out, err);
16682
16815
  }
16683
16816
  var _bundled = true;
16684
- var _HERE = fileURLToPath2(import.meta.url);
16817
+ var _HERE = fileURLToPath3(import.meta.url);
16685
16818
  function _isCliEntry() {
16686
16819
  if (process2.argv[1] === void 0) {
16687
16820
  return false;
16688
16821
  }
16689
- const argvUrl = pathToFileURL(path11.resolve(process2.argv[1])).href;
16822
+ const argvUrl = pathToFileURL(path13.resolve(process2.argv[1])).href;
16690
16823
  if (import.meta.url === argvUrl) {
16691
16824
  return true;
16692
16825
  }
16693
16826
  try {
16694
- const here = fs13.realpathSync(fileURLToPath2(import.meta.url));
16695
- const argv = fs13.realpathSync(path11.resolve(process2.argv[1]));
16827
+ const here = fs15.realpathSync(fileURLToPath3(import.meta.url));
16828
+ const argv = fs15.realpathSync(path13.resolve(process2.argv[1]));
16696
16829
  return here === argv;
16697
16830
  } catch {
16698
16831
  return false;
@@ -16711,7 +16844,7 @@ if (!_bundled && (_isCliEntry() || process2.argv[1] === _HERE)) {
16711
16844
  }
16712
16845
 
16713
16846
  // src/scripts/install.ts
16714
- var _HERE2 = fileURLToPath3(import.meta.url);
16847
+ var _HERE2 = fileURLToPath4(import.meta.url);
16715
16848
  var SystemExitError = class extends Error {
16716
16849
  constructor(code) {
16717
16850
  super(`system-exit-${code}`);
@@ -16729,34 +16862,34 @@ var ArgparseExit2 = class extends Error {
16729
16862
  function expanduser6(p) {
16730
16863
  if (p === "~") return os7.homedir();
16731
16864
  if (p.startsWith("~/") || p.startsWith("~\\")) {
16732
- return path12.join(os7.homedir(), p.slice(2));
16865
+ return path14.join(os7.homedir(), p.slice(2));
16733
16866
  }
16734
16867
  return p;
16735
16868
  }
16736
16869
  function resolvePath(p) {
16737
16870
  try {
16738
- return fs14.realpathSync(path12.resolve(p));
16871
+ return fs16.realpathSync(path14.resolve(p));
16739
16872
  } catch {
16740
- return path12.resolve(p);
16873
+ return path14.resolve(p);
16741
16874
  }
16742
16875
  }
16743
16876
  function isFile(p) {
16744
16877
  try {
16745
- return fs14.statSync(p).isFile();
16878
+ return fs16.statSync(p).isFile();
16746
16879
  } catch {
16747
16880
  return false;
16748
16881
  }
16749
16882
  }
16750
16883
  function isDir(p) {
16751
16884
  try {
16752
- return fs14.statSync(p).isDirectory();
16885
+ return fs16.statSync(p).isDirectory();
16753
16886
  } catch {
16754
16887
  return false;
16755
16888
  }
16756
16889
  }
16757
16890
  function pathExists(p) {
16758
16891
  try {
16759
- fs14.statSync(p);
16892
+ fs16.statSync(p);
16760
16893
  return true;
16761
16894
  } catch {
16762
16895
  return false;
@@ -16764,24 +16897,24 @@ function pathExists(p) {
16764
16897
  }
16765
16898
  function isSymlink(p) {
16766
16899
  try {
16767
- return fs14.lstatSync(p).isSymbolicLink();
16900
+ return fs16.lstatSync(p).isSymbolicLink();
16768
16901
  } catch {
16769
16902
  return false;
16770
16903
  }
16771
16904
  }
16772
16905
  function readText(p) {
16773
- return fs14.readFileSync(p, "utf-8");
16906
+ return fs16.readFileSync(p, "utf-8");
16774
16907
  }
16775
16908
  function writeText(p, content) {
16776
- fs14.writeFileSync(p, content, "utf-8");
16909
+ fs16.writeFileSync(p, content, "utf-8");
16777
16910
  }
16778
16911
  function mkdirp(p) {
16779
- fs14.mkdirSync(p, { recursive: true });
16912
+ fs16.mkdirSync(p, { recursive: true });
16780
16913
  }
16781
16914
  function sortedGlobStems(directory, suffix) {
16782
16915
  let entries;
16783
16916
  try {
16784
- entries = fs14.readdirSync(directory);
16917
+ entries = fs16.readdirSync(directory);
16785
16918
  } catch {
16786
16919
  return [];
16787
16920
  }
@@ -16801,7 +16934,7 @@ function sortedGlobStems(directory, suffix) {
16801
16934
  function countZips(directory) {
16802
16935
  if (!isDir(directory)) return 0;
16803
16936
  let n = 0;
16804
- for (const name of fs14.readdirSync(directory)) {
16937
+ for (const name of fs16.readdirSync(directory)) {
16805
16938
  if (name.endsWith(".zip")) n += 1;
16806
16939
  }
16807
16940
  return n;
@@ -16809,35 +16942,35 @@ function countZips(directory) {
16809
16942
  function sha256OfFile(p) {
16810
16943
  let data;
16811
16944
  try {
16812
- data = fs14.readFileSync(p);
16945
+ data = fs16.readFileSync(p);
16813
16946
  } catch {
16814
16947
  return null;
16815
16948
  }
16816
16949
  return crypto3.createHash("sha256").update(data).digest("hex");
16817
16950
  }
16818
16951
  function atomicWrite0644(target, body, prefix) {
16819
- const dir = path12.dirname(target);
16820
- const tmpName = path12.join(
16952
+ const dir = path14.dirname(target);
16953
+ const tmpName = path14.join(
16821
16954
  dir,
16822
16955
  `${prefix}${process3.pid}.${crypto3.randomBytes(6).toString("hex")}.yml.tmp`
16823
16956
  );
16824
16957
  let fd = null;
16825
16958
  try {
16826
- fd = fs14.openSync(tmpName, "wx", 420);
16827
- fs14.writeFileSync(fd, body, "utf-8");
16828
- fs14.closeSync(fd);
16959
+ fd = fs16.openSync(tmpName, "wx", 420);
16960
+ fs16.writeFileSync(fd, body, "utf-8");
16961
+ fs16.closeSync(fd);
16829
16962
  fd = null;
16830
- fs14.chmodSync(tmpName, 420);
16831
- fs14.renameSync(tmpName, target);
16963
+ fs16.chmodSync(tmpName, 420);
16964
+ fs16.renameSync(tmpName, target);
16832
16965
  } catch (err) {
16833
16966
  if (fd !== null) {
16834
16967
  try {
16835
- fs14.closeSync(fd);
16968
+ fs16.closeSync(fd);
16836
16969
  } catch {
16837
16970
  }
16838
16971
  }
16839
16972
  try {
16840
- fs14.unlinkSync(tmpName);
16973
+ fs16.unlinkSync(tmpName);
16841
16974
  } catch {
16842
16975
  }
16843
16976
  throw err;
@@ -16938,14 +17071,14 @@ function jsonDumpsCompact(value) {
16938
17071
  return _jsonStrNoAscii(String(value));
16939
17072
  }
16940
17073
  function yamlSafeLoad(text) {
16941
- let YAML2;
17074
+ let YAML3;
16942
17075
  try {
16943
- YAML2 = require_dist();
17076
+ YAML3 = require_dist();
16944
17077
  } catch {
16945
17078
  return null;
16946
17079
  }
16947
17080
  try {
16948
- const data = YAML2.parse(text, { version: "1.1" });
17081
+ const data = YAML3.parse(text, { version: "1.1" });
16949
17082
  return data;
16950
17083
  } catch {
16951
17084
  return void 0;
@@ -16961,12 +17094,12 @@ var LEGACY_SETTINGS_FILE = ".agent-settings";
16961
17094
  var LEGACY_BACKUP_FILE = ".agent-settings.backup.key-value";
16962
17095
  var SETTINGS_SUBDIR = ["agents", "settings"];
16963
17096
  function _canonical_settings_target(project_root) {
16964
- return path12.join(project_root, ...SETTINGS_SUBDIR, SETTINGS_FILE);
17097
+ return path14.join(project_root, ...SETTINGS_SUBDIR, SETTINGS_FILE);
16965
17098
  }
16966
17099
  function _resolve_settings_read(project_root) {
16967
17100
  const canonical = _canonical_settings_target(project_root);
16968
17101
  if (pathExists(canonical)) return canonical;
16969
- const legacy = path12.join(project_root, SETTINGS_FILE);
17102
+ const legacy = path14.join(project_root, SETTINGS_FILE);
16970
17103
  if (pathExists(legacy)) return legacy;
16971
17104
  return canonical;
16972
17105
  }
@@ -17030,9 +17163,9 @@ function fail(msg) {
17030
17163
  throw new SystemExitError(1);
17031
17164
  }
17032
17165
  function detect_package_root(project_root) {
17033
- const npm_path = path12.join(project_root, "node_modules", "@event4u", "agent-config");
17166
+ const npm_path = path14.join(project_root, "node_modules", "@event4u", "agent-config");
17034
17167
  if (isDir(npm_path)) return resolvePath(npm_path);
17035
- if (pathExists(path12.join(project_root, "src", "config", "profiles", "minimal.ini"))) {
17168
+ if (pathExists(path14.join(project_root, "src", "config", "profiles", "minimal.ini"))) {
17036
17169
  return project_root;
17037
17170
  }
17038
17171
  fail(
@@ -17040,12 +17173,12 @@ function detect_package_root(project_root) {
17040
17173
  );
17041
17174
  }
17042
17175
  function detect_package_type(package_root) {
17043
- if (package_root.split(path12.sep).includes("node_modules")) return "npm";
17176
+ if (package_root.split(path14.sep).includes("node_modules")) return "npm";
17044
17177
  return "local";
17045
17178
  }
17046
17179
  function detect_package_type_for_project(project_root, package_root) {
17047
17180
  const npm_path = resolvePath(
17048
- path12.join(project_root, "node_modules", "@event4u", "agent-config")
17181
+ path14.join(project_root, "node_modules", "@event4u", "agent-config")
17049
17182
  );
17050
17183
  const package_resolved = resolvePath(package_root);
17051
17184
  if (package_resolved === npm_path) return "npm";
@@ -17065,7 +17198,7 @@ function ensure_directory(p) {
17065
17198
  mkdirp(p);
17066
17199
  }
17067
17200
  function write_file(p, content) {
17068
- ensure_directory(path12.dirname(p));
17201
+ ensure_directory(path14.dirname(p));
17069
17202
  writeText(p, content);
17070
17203
  }
17071
17204
  function read_json_file(p) {
@@ -17236,7 +17369,7 @@ function _append_unknown_legacy(rendered, legacy_values, unknown_keys) {
17236
17369
  return rendered + "\n" + suffix;
17237
17370
  }
17238
17371
  function _migrate_legacy_if_present(project_root, template_body) {
17239
- const legacy_target = path12.join(project_root, LEGACY_SETTINGS_FILE);
17372
+ const legacy_target = path14.join(project_root, LEGACY_SETTINGS_FILE);
17240
17373
  if (!isFile(legacy_target)) return null;
17241
17374
  const legacy_text = readText(legacy_target);
17242
17375
  const [values, unknown] = _parse_legacy_settings(legacy_text);
@@ -17251,9 +17384,9 @@ function _migrate_legacy_if_present(project_root, template_body) {
17251
17384
  }
17252
17385
  }
17253
17386
  rendered = _append_unknown_legacy(rendered, values, unknown);
17254
- const backup_target = path12.join(project_root, LEGACY_BACKUP_FILE);
17387
+ const backup_target = path14.join(project_root, LEGACY_BACKUP_FILE);
17255
17388
  writeText(backup_target, legacy_text);
17256
- fs14.unlinkSync(legacy_target);
17389
+ fs16.unlinkSync(legacy_target);
17257
17390
  info(`Migrated legacy ${LEGACY_SETTINGS_FILE} \u2192 ${SETTINGS_FILE}`);
17258
17391
  info(`Backup saved to ${LEGACY_BACKUP_FILE}`);
17259
17392
  if (unknown.length > 0) {
@@ -17288,7 +17421,7 @@ function _render_template(template, profile_values) {
17288
17421
  return body;
17289
17422
  }
17290
17423
  function _load_valid_user_types(package_root) {
17291
- const directory = path12.join(package_root, USER_TYPES_DIR);
17424
+ const directory = path14.join(package_root, USER_TYPES_DIR);
17292
17425
  if (!isDir(directory)) return [];
17293
17426
  return sortedGlobStems(directory, ".yml");
17294
17427
  }
@@ -17345,8 +17478,8 @@ function splitlinesKeepends(text) {
17345
17478
  }
17346
17479
  function ensure_agent_settings(project_root, package_root, profile, force, user_type = "", packs = null) {
17347
17480
  const target = _canonical_settings_target(project_root);
17348
- const profile_source = path12.join(package_root, "src", "config", "profiles", `${profile}.ini`);
17349
- const template_source = path12.join(package_root, "src", "config", "agent-settings.template.yml");
17481
+ const profile_source = path14.join(package_root, "src", "config", "profiles", `${profile}.ini`);
17482
+ const template_source = path14.join(package_root, "src", "config", "agent-settings.template.yml");
17350
17483
  if (!pathExists(profile_source)) fail(`Missing profile preset: ${profile_source}`);
17351
17484
  if (!pathExists(template_source)) fail(`Missing settings template: ${template_source}`);
17352
17485
  const template = readText(template_source);
@@ -17360,21 +17493,21 @@ function ensure_agent_settings(project_root, package_root, profile, force, user_
17360
17493
  if (profile_values["rule_loading_tier"] !== profile) {
17361
17494
  const got = "rule_loading_tier" in profile_values ? `'${profile_values["rule_loading_tier"]}'` : "None";
17362
17495
  fail(
17363
- `Profile preset ${path12.basename(profile_source)} has rule_loading_tier=${got} but --profile=${profile}`
17496
+ `Profile preset ${path14.basename(profile_source)} has rule_loading_tier=${got} but --profile=${profile}`
17364
17497
  );
17365
17498
  }
17366
17499
  profile_values["user_type"] = _validate_user_type(package_root, user_type);
17367
17500
  let template_body = _render_template(template, profile_values);
17368
17501
  template_body = _inject_packs(template_body, packs ?? []);
17369
- const legacy_root = path12.join(project_root, SETTINGS_FILE);
17502
+ const legacy_root = path14.join(project_root, SETTINGS_FILE);
17370
17503
  if (isFile(legacy_root) && !pathExists(target)) {
17371
- mkdirp(path12.dirname(target));
17504
+ mkdirp(path14.dirname(target));
17372
17505
  writeText(target, readText(legacy_root));
17373
- fs14.unlinkSync(legacy_root);
17506
+ fs16.unlinkSync(legacy_root);
17374
17507
  success(`Migrated ${SETTINGS_FILE} \u2192 agents/settings/${SETTINGS_FILE} (ADR-038)`);
17375
17508
  return;
17376
17509
  }
17377
- const legacy_target = path12.join(project_root, LEGACY_SETTINGS_FILE);
17510
+ const legacy_target = path14.join(project_root, LEGACY_SETTINGS_FILE);
17378
17511
  if (isFile(legacy_target) && pathExists(target)) {
17379
17512
  warn(
17380
17513
  `Both ${SETTINGS_FILE} and legacy ${LEGACY_SETTINGS_FILE} exist. Skipping migration to avoid overwriting ${SETTINGS_FILE}. Delete one of them manually and re-run.`
@@ -17391,7 +17524,7 @@ function ensure_agent_settings(project_root, package_root, profile, force, user_
17391
17524
  skip(`${SETTINGS_FILE} already exists`);
17392
17525
  return;
17393
17526
  }
17394
- mkdirp(path12.dirname(target));
17527
+ mkdirp(path14.dirname(target));
17395
17528
  write_file(target, template_body);
17396
17529
  const user_type_value = profile_values["user_type"] ?? "";
17397
17530
  const suffix = user_type_value ? `, user_type=${user_type_value}` : "";
@@ -17404,7 +17537,7 @@ function ensure_vscode_bridge(project_root, package_type, force) {
17404
17537
  const plugin_path = plugin_paths[package_type] ?? "./plugin/agent-config";
17405
17538
  const bridge = { "chat.pluginLocations": { [plugin_path]: true } };
17406
17539
  merge_json_file(
17407
- path12.join(project_root, ".vscode", "settings.json"),
17540
+ path14.join(project_root, ".vscode", "settings.json"),
17408
17541
  bridge,
17409
17542
  force,
17410
17543
  ".vscode/settings.json"
@@ -17413,14 +17546,14 @@ function ensure_vscode_bridge(project_root, package_type, force) {
17413
17546
  function ensure_augment_bridge(project_root, force) {
17414
17547
  const bridge = { enabledPlugins: { "agent-config@event4u": true } };
17415
17548
  return merge_json_file(
17416
- path12.join(project_root, ".augment", "settings.json"),
17549
+ path14.join(project_root, ".augment", "settings.json"),
17417
17550
  bridge,
17418
17551
  force,
17419
17552
  ".augment/settings.json"
17420
17553
  );
17421
17554
  }
17422
- var AUGMENT_USER_DIR = path12.join(os7.homedir(), ".augment");
17423
- var AUGMENT_USER_HOOKS_DIR = path12.join(AUGMENT_USER_DIR, "hooks");
17555
+ var AUGMENT_USER_DIR = path14.join(os7.homedir(), ".augment");
17556
+ var AUGMENT_USER_HOOKS_DIR = path14.join(AUGMENT_USER_DIR, "hooks");
17424
17557
  var AUGMENT_DISPATCHER_TRAMPOLINE = "augment-dispatcher.sh";
17425
17558
  var AUGMENT_LEGACY_TRAMPOLINES = [
17426
17559
  "augment-chat-history.sh",
@@ -17436,29 +17569,29 @@ var AUGMENT_DISPATCHER_BINDINGS = [
17436
17569
  ["post_tool_use", "PostToolUse"]
17437
17570
  ];
17438
17571
  function _deploy_augment_trampoline(package_root, name, force) {
17439
- const src = path12.join(package_root, "scripts", "hooks", name);
17572
+ const src = path14.join(package_root, "scripts", "hooks", name);
17440
17573
  if (!pathExists(src)) {
17441
17574
  skip(`augment trampoline missing in package: ${src}`);
17442
17575
  return null;
17443
17576
  }
17444
17577
  mkdirp(AUGMENT_USER_HOOKS_DIR);
17445
- const dst = path12.join(AUGMENT_USER_HOOKS_DIR, name);
17578
+ const dst = path14.join(AUGMENT_USER_HOOKS_DIR, name);
17446
17579
  const src_text = readText(src);
17447
17580
  if (pathExists(dst) && readText(dst) === src_text && !force) {
17448
17581
  skip(`~/.augment/hooks/${name} already up to date`);
17449
17582
  } else {
17450
17583
  writeText(dst, src_text);
17451
- fs14.chmodSync(dst, 493);
17584
+ fs16.chmodSync(dst, 493);
17452
17585
  success(`~/.augment/hooks/${name} installed`);
17453
17586
  }
17454
17587
  return dst;
17455
17588
  }
17456
17589
  function _remove_legacy_augment_trampolines() {
17457
17590
  for (const name of AUGMENT_LEGACY_TRAMPOLINES) {
17458
- const legacy = path12.join(AUGMENT_USER_HOOKS_DIR, name);
17591
+ const legacy = path14.join(AUGMENT_USER_HOOKS_DIR, name);
17459
17592
  try {
17460
17593
  if (isFile(legacy)) {
17461
- fs14.unlinkSync(legacy);
17594
+ fs16.unlinkSync(legacy);
17462
17595
  skip(`removed legacy ~/.augment/hooks/${name}`);
17463
17596
  }
17464
17597
  } catch {
@@ -17477,7 +17610,7 @@ function ensure_augment_user_hooks(package_root, force) {
17477
17610
  }
17478
17611
  const settings_patch = { hooks: per_event };
17479
17612
  return merge_json_file(
17480
- path12.join(AUGMENT_USER_DIR, "settings.json"),
17613
+ path14.join(AUGMENT_USER_DIR, "settings.json"),
17481
17614
  settings_patch,
17482
17615
  force,
17483
17616
  "~/.augment/settings.json"
@@ -17502,7 +17635,7 @@ function _heal_legacy_claude_plugin_ids(p) {
17502
17635
  return removed;
17503
17636
  }
17504
17637
  function ensure_claude_bridge(project_root, force) {
17505
- const target = path12.join(project_root, ".claude", "settings.json");
17638
+ const target = path14.join(project_root, ".claude", "settings.json");
17506
17639
  const healed = _heal_legacy_claude_plugin_ids(target);
17507
17640
  for (const pid of healed) {
17508
17641
  success(`.claude/settings.json: removed stale plugin id \`${pid}\``);
@@ -17527,29 +17660,29 @@ function ensure_cursor_bridge(project_root, force) {
17527
17660
  }
17528
17661
  const bridge = { version: 1, hooks };
17529
17662
  return merge_json_file(
17530
- path12.join(project_root, ".cursor", "hooks.json"),
17663
+ path14.join(project_root, ".cursor", "hooks.json"),
17531
17664
  bridge,
17532
17665
  force,
17533
17666
  ".cursor/hooks.json"
17534
17667
  );
17535
17668
  }
17536
- var CURSOR_USER_DIR = path12.join(os7.homedir(), ".cursor");
17537
- var CURSOR_USER_HOOKS_DIR = path12.join(CURSOR_USER_DIR, "hooks");
17669
+ var CURSOR_USER_DIR = path14.join(os7.homedir(), ".cursor");
17670
+ var CURSOR_USER_HOOKS_DIR = path14.join(CURSOR_USER_DIR, "hooks");
17538
17671
  var CURSOR_DISPATCHER_TRAMPOLINE = "cursor-dispatcher.sh";
17539
17672
  function ensure_cursor_user_hooks(package_root, force) {
17540
- const src = path12.join(package_root, "scripts", "hooks", CURSOR_DISPATCHER_TRAMPOLINE);
17673
+ const src = path14.join(package_root, "scripts", "hooks", CURSOR_DISPATCHER_TRAMPOLINE);
17541
17674
  if (!pathExists(src)) {
17542
17675
  skip(`cursor trampoline missing in package: ${src}`);
17543
17676
  return [];
17544
17677
  }
17545
17678
  mkdirp(CURSOR_USER_HOOKS_DIR);
17546
- const dst = path12.join(CURSOR_USER_HOOKS_DIR, CURSOR_DISPATCHER_TRAMPOLINE);
17679
+ const dst = path14.join(CURSOR_USER_HOOKS_DIR, CURSOR_DISPATCHER_TRAMPOLINE);
17547
17680
  const src_text = readText(src);
17548
17681
  if (pathExists(dst) && readText(dst) === src_text && !force) {
17549
17682
  skip(`~/.cursor/hooks/${CURSOR_DISPATCHER_TRAMPOLINE} already up to date`);
17550
17683
  } else {
17551
17684
  writeText(dst, src_text);
17552
- fs14.chmodSync(dst, 493);
17685
+ fs16.chmodSync(dst, 493);
17553
17686
  success(`~/.cursor/hooks/${CURSOR_DISPATCHER_TRAMPOLINE} installed`);
17554
17687
  }
17555
17688
  const hooks = {};
@@ -17558,7 +17691,7 @@ function ensure_cursor_user_hooks(package_root, force) {
17558
17691
  }
17559
17692
  const settings_patch = { version: 1, hooks };
17560
17693
  return merge_json_file(
17561
- path12.join(CURSOR_USER_DIR, "hooks.json"),
17694
+ path14.join(CURSOR_USER_DIR, "hooks.json"),
17562
17695
  settings_patch,
17563
17696
  force,
17564
17697
  "~/.cursor/hooks.json"
@@ -17601,12 +17734,12 @@ exit 0
17601
17734
  `;
17602
17735
  }
17603
17736
  function ensure_cline_bridge(project_root, force) {
17604
- const hooks_dir = path12.join(project_root, ".clinerules", "hooks");
17737
+ const hooks_dir = path14.join(project_root, ".clinerules", "hooks");
17605
17738
  mkdirp(hooks_dir);
17606
17739
  const workspace_quoted = shlexQuote(resolvePath(project_root));
17607
17740
  let written = 0;
17608
17741
  for (const [ac_event, native_event] of CLINE_DISPATCHER_BINDINGS) {
17609
- const target = path12.join(hooks_dir, native_event);
17742
+ const target = path14.join(hooks_dir, native_event);
17610
17743
  const body = clineProjectHookBody(native_event, ac_event, workspace_quoted);
17611
17744
  if (pathExists(target) && readText(target) === body && !force) {
17612
17745
  continue;
@@ -17616,7 +17749,7 @@ function ensure_cline_bridge(project_root, force) {
17616
17749
  continue;
17617
17750
  }
17618
17751
  writeText(target, body);
17619
- fs14.chmodSync(target, 493);
17752
+ fs16.chmodSync(target, 493);
17620
17753
  written += 1;
17621
17754
  }
17622
17755
  if (written) {
@@ -17625,27 +17758,27 @@ function ensure_cline_bridge(project_root, force) {
17625
17758
  skip(".clinerules/hooks/ already up to date");
17626
17759
  }
17627
17760
  }
17628
- var CLINE_USER_DIR = path12.join(os7.homedir(), "Documents", "Cline", "Hooks");
17761
+ var CLINE_USER_DIR = path14.join(os7.homedir(), "Documents", "Cline", "Hooks");
17629
17762
  var CLINE_DISPATCHER_TRAMPOLINE = "cline-dispatcher.sh";
17630
17763
  function ensure_cline_user_hooks(package_root, force) {
17631
- const src = path12.join(package_root, "scripts", "hooks", CLINE_DISPATCHER_TRAMPOLINE);
17764
+ const src = path14.join(package_root, "scripts", "hooks", CLINE_DISPATCHER_TRAMPOLINE);
17632
17765
  if (!pathExists(src)) {
17633
17766
  skip(`cline trampoline missing in package: ${src}`);
17634
17767
  return;
17635
17768
  }
17636
17769
  mkdirp(CLINE_USER_DIR);
17637
- const trampoline = path12.join(CLINE_USER_DIR, CLINE_DISPATCHER_TRAMPOLINE);
17770
+ const trampoline = path14.join(CLINE_USER_DIR, CLINE_DISPATCHER_TRAMPOLINE);
17638
17771
  const src_text = readText(src);
17639
17772
  if (pathExists(trampoline) && readText(trampoline) === src_text && !force) {
17640
17773
  skip(`~/Documents/Cline/Hooks/${CLINE_DISPATCHER_TRAMPOLINE} already up to date`);
17641
17774
  } else {
17642
17775
  writeText(trampoline, src_text);
17643
- fs14.chmodSync(trampoline, 493);
17776
+ fs16.chmodSync(trampoline, 493);
17644
17777
  success(`~/Documents/Cline/Hooks/${CLINE_DISPATCHER_TRAMPOLINE} installed`);
17645
17778
  }
17646
17779
  const trampoline_quoted = shlexQuote(trampoline);
17647
17780
  for (const [ac_event, native_event] of CLINE_DISPATCHER_BINDINGS) {
17648
- const wrapper = path12.join(CLINE_USER_DIR, native_event);
17781
+ const wrapper = path14.join(CLINE_USER_DIR, native_event);
17649
17782
  const body = `#!/usr/bin/env bash
17650
17783
  # Generated by event4u/agent-config install.py \u2014 DO NOT EDIT.
17651
17784
  # User-scope Cline hook for ${native_event} \u2192 agent-config ${ac_event}.
@@ -17655,7 +17788,7 @@ exec ${trampoline_quoted} ${ac_event} ${native_event}
17655
17788
  continue;
17656
17789
  }
17657
17790
  writeText(wrapper, body);
17658
- fs14.chmodSync(wrapper, 493);
17791
+ fs16.chmodSync(wrapper, 493);
17659
17792
  }
17660
17793
  }
17661
17794
  var WINDSURF_DISPATCHER_BINDINGS = [
@@ -17676,29 +17809,29 @@ function ensure_windsurf_bridge(project_root, force) {
17676
17809
  }
17677
17810
  const bridge = { hooks };
17678
17811
  return merge_json_file(
17679
- path12.join(project_root, ".windsurf", "hooks.json"),
17812
+ path14.join(project_root, ".windsurf", "hooks.json"),
17680
17813
  bridge,
17681
17814
  force,
17682
17815
  ".windsurf/hooks.json"
17683
17816
  );
17684
17817
  }
17685
- var WINDSURF_USER_DIR = path12.join(os7.homedir(), ".codeium", "windsurf");
17686
- var WINDSURF_USER_HOOKS_DIR = path12.join(WINDSURF_USER_DIR, "hooks");
17818
+ var WINDSURF_USER_DIR = path14.join(os7.homedir(), ".codeium", "windsurf");
17819
+ var WINDSURF_USER_HOOKS_DIR = path14.join(WINDSURF_USER_DIR, "hooks");
17687
17820
  var WINDSURF_DISPATCHER_TRAMPOLINE = "windsurf-dispatcher.sh";
17688
17821
  function ensure_windsurf_user_hooks(package_root, force) {
17689
- const src = path12.join(package_root, "scripts", "hooks", WINDSURF_DISPATCHER_TRAMPOLINE);
17822
+ const src = path14.join(package_root, "scripts", "hooks", WINDSURF_DISPATCHER_TRAMPOLINE);
17690
17823
  if (!pathExists(src)) {
17691
17824
  skip(`windsurf trampoline missing in package: ${src}`);
17692
17825
  return [];
17693
17826
  }
17694
17827
  mkdirp(WINDSURF_USER_HOOKS_DIR);
17695
- const dst = path12.join(WINDSURF_USER_HOOKS_DIR, WINDSURF_DISPATCHER_TRAMPOLINE);
17828
+ const dst = path14.join(WINDSURF_USER_HOOKS_DIR, WINDSURF_DISPATCHER_TRAMPOLINE);
17696
17829
  const src_text = readText(src);
17697
17830
  if (pathExists(dst) && readText(dst) === src_text && !force) {
17698
17831
  skip(`~/.codeium/windsurf/hooks/${WINDSURF_DISPATCHER_TRAMPOLINE} already up to date`);
17699
17832
  } else {
17700
17833
  writeText(dst, src_text);
17701
- fs14.chmodSync(dst, 493);
17834
+ fs16.chmodSync(dst, 493);
17702
17835
  success(`~/.codeium/windsurf/hooks/${WINDSURF_DISPATCHER_TRAMPOLINE} installed`);
17703
17836
  }
17704
17837
  const hooks = {};
@@ -17710,7 +17843,7 @@ function ensure_windsurf_user_hooks(package_root, force) {
17710
17843
  }
17711
17844
  const settings_patch = { hooks };
17712
17845
  return merge_json_file(
17713
- path12.join(WINDSURF_USER_DIR, "hooks.json"),
17846
+ path14.join(WINDSURF_USER_DIR, "hooks.json"),
17714
17847
  settings_patch,
17715
17848
  force,
17716
17849
  "~/.codeium/windsurf/hooks.json"
@@ -17739,43 +17872,43 @@ function _gemini_hooks_dict(command_factory) {
17739
17872
  function ensure_gemini_bridge(project_root, force) {
17740
17873
  const bridge = { hooks: _gemini_hooks_dict(_gemini_dispatch_command) };
17741
17874
  return merge_json_file(
17742
- path12.join(project_root, ".gemini", "settings.json"),
17875
+ path14.join(project_root, ".gemini", "settings.json"),
17743
17876
  bridge,
17744
17877
  force,
17745
17878
  ".gemini/settings.json"
17746
17879
  );
17747
17880
  }
17748
- var GEMINI_USER_DIR = path12.join(os7.homedir(), ".gemini");
17749
- var GEMINI_USER_HOOKS_DIR = path12.join(GEMINI_USER_DIR, "hooks");
17881
+ var GEMINI_USER_DIR = path14.join(os7.homedir(), ".gemini");
17882
+ var GEMINI_USER_HOOKS_DIR = path14.join(GEMINI_USER_DIR, "hooks");
17750
17883
  var GEMINI_DISPATCHER_TRAMPOLINE = "gemini-dispatcher.sh";
17751
17884
  function ensure_gemini_user_hooks(package_root, force) {
17752
- const src = path12.join(package_root, "scripts", "hooks", GEMINI_DISPATCHER_TRAMPOLINE);
17885
+ const src = path14.join(package_root, "scripts", "hooks", GEMINI_DISPATCHER_TRAMPOLINE);
17753
17886
  if (!pathExists(src)) {
17754
17887
  skip(`gemini trampoline missing in package: ${src}`);
17755
17888
  return [];
17756
17889
  }
17757
17890
  mkdirp(GEMINI_USER_HOOKS_DIR);
17758
- const dst = path12.join(GEMINI_USER_HOOKS_DIR, GEMINI_DISPATCHER_TRAMPOLINE);
17891
+ const dst = path14.join(GEMINI_USER_HOOKS_DIR, GEMINI_DISPATCHER_TRAMPOLINE);
17759
17892
  const src_text = readText(src);
17760
17893
  if (pathExists(dst) && readText(dst) === src_text && !force) {
17761
17894
  skip(`~/.gemini/hooks/${GEMINI_DISPATCHER_TRAMPOLINE} already up to date`);
17762
17895
  } else {
17763
17896
  writeText(dst, src_text);
17764
- fs14.chmodSync(dst, 493);
17897
+ fs16.chmodSync(dst, 493);
17765
17898
  success(`~/.gemini/hooks/${GEMINI_DISPATCHER_TRAMPOLINE} installed`);
17766
17899
  }
17767
17900
  const settings_patch = {
17768
17901
  hooks: _gemini_hooks_dict((ac_event, native) => `${dst} ${ac_event} ${native}`)
17769
17902
  };
17770
17903
  return merge_json_file(
17771
- path12.join(GEMINI_USER_DIR, "settings.json"),
17904
+ path14.join(GEMINI_USER_DIR, "settings.json"),
17772
17905
  settings_patch,
17773
17906
  force,
17774
17907
  "~/.gemini/settings.json"
17775
17908
  );
17776
17909
  }
17777
17910
  function ensure_copilot_bridge(project_root, force) {
17778
- const target = path12.join(project_root, ".github", "plugin", "marketplace.json");
17911
+ const target = path14.join(project_root, ".github", "plugin", "marketplace.json");
17779
17912
  const bridge = {
17780
17913
  marketplace: {
17781
17914
  name: "event4u-agent-marketplace",
@@ -17818,7 +17951,7 @@ See \`docs/setup/per-ide/roocode.md\` for the full activation guide.
17818
17951
  Run \`./agent-config --help\` for available commands.
17819
17952
  `;
17820
17953
  function ensure_roocode_bridge(project_root, force) {
17821
- const target = path12.join(project_root, ".roo", "rules", "agent-config.md");
17954
+ const target = path14.join(project_root, ".roo", "rules", "agent-config.md");
17822
17955
  if (pathExists(target) && !force) {
17823
17956
  skip(".roo/rules/agent-config.md already exists");
17824
17957
  return;
@@ -17840,7 +17973,7 @@ To wire Claude Desktop to this project's rules, run:
17840
17973
  Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
17841
17974
  `;
17842
17975
  function ensure_claude_desktop_bridge(project_root, force) {
17843
- const target = path12.join(project_root, ".claude-desktop", "agent-config.md");
17976
+ const target = path14.join(project_root, ".claude-desktop", "agent-config.md");
17844
17977
  if (pathExists(target) && !force) {
17845
17978
  skip(".claude-desktop/agent-config.md already exists");
17846
17979
  return;
@@ -17865,7 +17998,7 @@ Or pass \`--read .aider/agent-config.md\` on the command line.
17865
17998
  Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
17866
17999
  `;
17867
18000
  function ensure_aider_bridge(project_root, force) {
17868
- const target = path12.join(project_root, ".aider", "agent-config.md");
18001
+ const target = path14.join(project_root, ".aider", "agent-config.md");
17869
18002
  if (pathExists(target) && !force) {
17870
18003
  skip(".aider/agent-config.md already exists");
17871
18004
  return;
@@ -17884,7 +18017,7 @@ developers where the rules and skills live.
17884
18017
  Canonical rule and skill source: \`.augment/\` (see project \`AGENTS.md\`).
17885
18018
  `;
17886
18019
  function ensure_codex_bridge(project_root, force) {
17887
- const target = path12.join(project_root, ".codex", "agent-config.md");
18020
+ const target = path14.join(project_root, ".codex", "agent-config.md");
17888
18021
  if (pathExists(target) && !force) {
17889
18022
  skip(".codex/agent-config.md already exists");
17890
18023
  return;
@@ -17902,7 +18035,7 @@ rules per session. The canonical rule and skill source lives under
17902
18035
  orientation).
17903
18036
  `;
17904
18037
  function ensure_continue_bridge(project_root, force) {
17905
- const target = path12.join(project_root, ".continue", "rules", "agent-config.md");
18038
+ const target = path14.join(project_root, ".continue", "rules", "agent-config.md");
17906
18039
  if (pathExists(target) && !force) {
17907
18040
  skip(".continue/rules/agent-config.md already exists");
17908
18041
  return;
@@ -17933,7 +18066,7 @@ orientation).
17933
18066
  See \`docs/setup/per-ide/kilocode.md\` for the full activation guide.
17934
18067
  `;
17935
18068
  function ensure_kilocode_bridge(project_root, force) {
17936
- const target = path12.join(project_root, ".kilocode", "rules", "agent-config.md");
18069
+ const target = path14.join(project_root, ".kilocode", "rules", "agent-config.md");
17937
18070
  if (pathExists(target) && !force) {
17938
18071
  skip(".kilocode/rules/agent-config.md already exists");
17939
18072
  return;
@@ -17960,7 +18093,7 @@ canonical source (or symlink it):
17960
18093
  Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
17961
18094
  `;
17962
18095
  function ensure_zed_bridge(project_root, force) {
17963
- const target = path12.join(project_root, ".zed", "agent-config.md");
18096
+ const target = path14.join(project_root, ".zed", "agent-config.md");
17964
18097
  if (pathExists(target) && !force) {
17965
18098
  skip(".zed/agent-config.md already exists");
17966
18099
  return;
@@ -17981,7 +18114,7 @@ rules into your JetBrains profile.
17981
18114
  Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
17982
18115
  `;
17983
18116
  function ensure_jetbrains_bridge(project_root, force) {
17984
- const target = path12.join(project_root, ".jetbrains", "agent-config.md");
18117
+ const target = path14.join(project_root, ".jetbrains", "agent-config.md");
17985
18118
  if (pathExists(target) && !force) {
17986
18119
  skip(".jetbrains/agent-config.md already exists");
17987
18120
  return;
@@ -18012,7 +18145,7 @@ session. The canonical rule and skill source lives under \`.augment/\`
18012
18145
  See \`docs/setup/per-ide/kiro.md\` for the full activation guide.
18013
18146
  `;
18014
18147
  function ensure_kiro_bridge(project_root, force) {
18015
- const target = path12.join(project_root, ".kiro", "steering", "agent-config.md");
18148
+ const target = path14.join(project_root, ".kiro", "steering", "agent-config.md");
18016
18149
  if (pathExists(target) && !force) {
18017
18150
  skip(".kiro/steering/agent-config.md already exists");
18018
18151
  return;
@@ -18038,35 +18171,35 @@ var SMOKE_BRIDGE_PATHS = {
18038
18171
  };
18039
18172
  function dirHasEntries(p) {
18040
18173
  try {
18041
- return fs14.readdirSync(p).length > 0;
18174
+ return fs16.readdirSync(p).length > 0;
18042
18175
  } catch {
18043
18176
  return false;
18044
18177
  }
18045
18178
  }
18046
18179
  function _resolve_tsx_invocation(scriptPath, scriptArgs) {
18047
18180
  const binName = process3.platform === "win32" ? "tsx.cmd" : "tsx";
18048
- let dir = path12.dirname(scriptPath);
18181
+ let dir = path14.dirname(scriptPath);
18049
18182
  for (; ; ) {
18050
- const candidate = path12.join(dir, "node_modules", ".bin", binName);
18183
+ const candidate = path14.join(dir, "node_modules", ".bin", binName);
18051
18184
  if (isFile(candidate)) {
18052
18185
  return { command: candidate, args: [scriptPath, ...scriptArgs] };
18053
18186
  }
18054
- const parent = path12.dirname(dir);
18187
+ const parent = path14.dirname(dir);
18055
18188
  if (parent === dir) break;
18056
18189
  dir = parent;
18057
18190
  }
18058
18191
  return { command: "npx", args: ["tsx", scriptPath, ...scriptArgs] };
18059
18192
  }
18060
18193
  function _smoke_test_hooks(project_root, package_root) {
18061
- const dispatcher = path12.join(package_root, "scripts", "hooks", "dispatch_hook.ts");
18062
- const manifest = path12.join(package_root, "scripts", "hook_manifest.yaml");
18194
+ const dispatcher = path14.join(package_root, "scripts", "hooks", "dispatch_hook.ts");
18195
+ const manifest = path14.join(package_root, "scripts", "hook_manifest.yaml");
18063
18196
  if (!isFile(dispatcher) || !isFile(manifest)) return 0;
18064
18197
  const failed = [];
18065
18198
  const skipped = [];
18066
18199
  const passed = [];
18067
18200
  for (const [platform, native] of SMOKE_PROBE_EVENTS) {
18068
18201
  const rel_bridge = SMOKE_BRIDGE_PATHS[platform] ?? "";
18069
- const bridge_path = rel_bridge ? path12.join(project_root, rel_bridge) : null;
18202
+ const bridge_path = rel_bridge ? path14.join(project_root, rel_bridge) : null;
18070
18203
  const bridge_present = Boolean(
18071
18204
  bridge_path && (isFile(bridge_path) || isDir(bridge_path) && dirHasEntries(bridge_path))
18072
18205
  );
@@ -18266,9 +18399,9 @@ To remove this marker, delete this file.
18266
18399
  `;
18267
18400
  }
18268
18401
  var _CLAUDE_DESKTOP_BUNDLES_SUBPATH = "claude-desktop/bundles";
18269
- var GLOBAL_ROOT = path12.join(os7.homedir(), ".event4u", "agent-config");
18270
- var GLOBAL_USER_SETTINGS_PATH = path12.join(GLOBAL_ROOT, ".agent-user.yml");
18271
- var GLOBAL_AGENT_SETTINGS_PATH = path12.join(GLOBAL_ROOT, ".agent-settings.yml");
18402
+ var GLOBAL_ROOT = path14.join(os7.homedir(), ".event4u", "agent-config");
18403
+ var GLOBAL_USER_SETTINGS_PATH = path14.join(GLOBAL_ROOT, ".agent-user.yml");
18404
+ var GLOBAL_AGENT_SETTINGS_PATH = path14.join(GLOBAL_ROOT, ".agent-settings.yml");
18272
18405
  function _bridge_marker(tool_id, scope) {
18273
18406
  if (scope === "global") return USER_SCOPE_PATHS[tool_id] ?? "";
18274
18407
  return PROJECT_BRIDGE_MARKERS[tool_id] ?? "";
@@ -18317,7 +18450,7 @@ function _load_yaml_doc(p) {
18317
18450
  return _isPlainObject2(data) ? data : {};
18318
18451
  }
18319
18452
  function _load_default_settings(package_root) {
18320
- const template_source = path12.join(package_root, "src", "config", "agent-settings.template.yml");
18453
+ const template_source = path14.join(package_root, "src", "config", "agent-settings.template.yml");
18321
18454
  if (!pathExists(template_source)) return {};
18322
18455
  let text;
18323
18456
  try {
@@ -18405,9 +18538,9 @@ function detect_scope(cwd) {
18405
18538
  if (pathExists(_resolve_settings_read(cwd))) {
18406
18539
  return ["project", `existing ${SETTINGS_FILE}`];
18407
18540
  }
18408
- const has_manifest = SCOPE_DETECT_MANIFESTS.find((m) => pathExists(path12.join(cwd, m))) ?? null;
18409
- const has_ai_dir = SCOPE_DETECT_AI_DIRS.find((d) => isDir(path12.join(cwd, d))) ?? null;
18410
- const has_ai_file = SCOPE_DETECT_AI_FILES.find((f) => pathExists(path12.join(cwd, f))) ?? null;
18541
+ const has_manifest = SCOPE_DETECT_MANIFESTS.find((m) => pathExists(path14.join(cwd, m))) ?? null;
18542
+ const has_ai_dir = SCOPE_DETECT_AI_DIRS.find((d) => isDir(path14.join(cwd, d))) ?? null;
18543
+ const has_ai_file = SCOPE_DETECT_AI_FILES.find((f) => pathExists(path14.join(cwd, f))) ?? null;
18411
18544
  if (has_manifest && (has_ai_dir || has_ai_file)) {
18412
18545
  const marker = has_ai_dir || has_ai_file;
18413
18546
  return ["prompt", `manifest (${has_manifest}) + AI-tool config (${marker})`];
@@ -18428,7 +18561,7 @@ function readLineSyncRaw(promptText) {
18428
18561
  for (; ; ) {
18429
18562
  let n;
18430
18563
  try {
18431
- n = fs14.readSync(0, buf, 0, 1, null);
18564
+ n = fs16.readSync(0, buf, 0, 1, null);
18432
18565
  } catch (err) {
18433
18566
  const code = err.code;
18434
18567
  if (code === "EAGAIN") {
@@ -18503,8 +18636,8 @@ function _files_by_tool_from_bridges(tools, project_root, scope) {
18503
18636
  const marker = _bridge_marker(tool_id, scope);
18504
18637
  if (!marker) continue;
18505
18638
  let marker_path = marker;
18506
- if (!path12.isAbsolute(marker_path)) {
18507
- marker_path = path12.join(project_root, marker_path);
18639
+ if (!path14.isAbsolute(marker_path)) {
18640
+ marker_path = path14.join(project_root, marker_path);
18508
18641
  }
18509
18642
  out[tool_id] = [_file_entry(marker_path, "bridge", false)];
18510
18643
  }
@@ -18543,26 +18676,26 @@ function _update_installed_tools_manifest(project_root, tools, scope, force, fil
18543
18676
  }
18544
18677
  write_manifest(target, version, entries);
18545
18678
  if (!state.QUIET) {
18546
- const rel = isRelativeTo(target, project_root) ? path12.relative(project_root, target) : target;
18679
+ const rel = isRelativeTo(target, project_root) ? path14.relative(project_root, target) : target;
18547
18680
  info(`Manifest updated: ${rel}`);
18548
18681
  }
18549
18682
  return 0;
18550
18683
  }
18551
18684
  function isRelativeTo(child, parent) {
18552
- const rel = path12.relative(parent, child);
18553
- return rel === "" || !rel.startsWith("..") && !path12.isAbsolute(rel);
18685
+ const rel = path14.relative(parent, child);
18686
+ return rel === "" || !rel.startsWith("..") && !path14.isAbsolute(rel);
18554
18687
  }
18555
18688
  function _resolve_package_root_for_global() {
18556
18689
  const here = resolvePath(_HERE2);
18557
- const candidate = path12.dirname(path12.dirname(path12.dirname(here)));
18558
- if (!pathExists(path12.join(candidate, "src", "config", "profiles", "minimal.ini"))) {
18690
+ const candidate = path14.dirname(path14.dirname(path14.dirname(here)));
18691
+ if (!pathExists(path14.join(candidate, "src", "config", "profiles", "minimal.ini"))) {
18559
18692
  fail(
18560
18693
  `Could not locate agent-config package root from ${here}. Expected src/config/profiles/minimal.ini at the parent directory.`
18561
18694
  );
18562
18695
  }
18563
18696
  return candidate;
18564
18697
  }
18565
- var CONSUMER_BRIDGE_MARKER_RELPATH = path12.join("agents", ".event4u-bridge.yml");
18698
+ var CONSUMER_BRIDGE_MARKER_RELPATH = path14.join("agents", ".event4u-bridge.yml");
18566
18699
  var MIGRATE_LEGACY_YAML_FILES = [".agent-settings.yml", ".agent-user.yml"];
18567
18700
  var MIGRATE_LEGACY_TOOL_DIRS = [".augment", ".claude", ".cursor"];
18568
18701
  var AGENT_CONFIG_PACKAGE_NAME = "@event4u/agent-config";
@@ -18570,7 +18703,7 @@ function _is_agent_config_source_repo(project_root) {
18570
18703
  if (process3.env["AGENT_CONFIG_CONSUMER_MODE"] === "1") {
18571
18704
  return [false, "consumer-mode-override"];
18572
18705
  }
18573
- const pkg_json = path12.join(project_root, "package.json");
18706
+ const pkg_json = path14.join(project_root, "package.json");
18574
18707
  if (isFile(pkg_json)) {
18575
18708
  let data = {};
18576
18709
  try {
@@ -18582,18 +18715,18 @@ function _is_agent_config_source_repo(project_root) {
18582
18715
  return [true, "package.json:name"];
18583
18716
  }
18584
18717
  }
18585
- if (isDir(path12.join(project_root, ".agent-src.uncondensed"))) {
18718
+ if (isDir(path14.join(project_root, ".agent-src.uncondensed"))) {
18586
18719
  return [true, ".agent-src.uncondensed/"];
18587
18720
  }
18588
- const packages_dir = path12.join(project_root, "packages");
18721
+ const packages_dir = path14.join(project_root, "packages");
18589
18722
  if (isDir(packages_dir)) {
18590
- for (const child of fs14.readdirSync(packages_dir)) {
18591
- if (isDir(path12.join(packages_dir, child, ".agent-src.uncondensed"))) {
18723
+ for (const child of fs16.readdirSync(packages_dir)) {
18724
+ if (isDir(path14.join(packages_dir, child, ".agent-src.uncondensed"))) {
18592
18725
  return [true, `packages/${child}/.agent-src.uncondensed/`];
18593
18726
  }
18594
18727
  }
18595
18728
  }
18596
- const installer_self = path12.join(project_root, "scripts", "install.py");
18729
+ const installer_self = path14.join(project_root, "scripts", "install.py");
18597
18730
  try {
18598
18731
  if (isFile(installer_self) && resolvePath(installer_self) === resolvePath(_HERE2)) {
18599
18732
  return [true, "src/scripts/install.py (self)"];
@@ -18613,17 +18746,17 @@ function _detect_legacy_for_migration(project_root) {
18613
18746
  }
18614
18747
  return [];
18615
18748
  }
18616
- if (isFile(path12.join(project_root, INSTALL_MODE_MARKER_REL))) return [];
18749
+ if (isFile(path14.join(project_root, INSTALL_MODE_MARKER_REL))) return [];
18617
18750
  const found = [];
18618
18751
  for (const name of MIGRATE_LEGACY_YAML_FILES) {
18619
- if (isFile(path12.join(project_root, name))) {
18752
+ if (isFile(path14.join(project_root, name))) {
18620
18753
  found.push(name);
18621
- } else if (isFile(path12.join(project_root, "settings", name))) {
18754
+ } else if (isFile(path14.join(project_root, "settings", name))) {
18622
18755
  found.push(`settings/${name}`);
18623
18756
  }
18624
18757
  }
18625
18758
  for (const name of MIGRATE_LEGACY_TOOL_DIRS) {
18626
- const p = path12.join(project_root, name);
18759
+ const p = path14.join(project_root, name);
18627
18760
  if (isDir(p) && !isSymlink(p)) {
18628
18761
  found.push(`${name}/`);
18629
18762
  }
@@ -18635,7 +18768,7 @@ function _prompt_migrate_to_global(project_root, artefacts) {
18635
18768
  process3.stdout.write("\n");
18636
18769
  warn("Legacy project-local artefacts detected \u2014 pre-ADR-020 layout:");
18637
18770
  for (const rel of artefacts) {
18638
- info(` ${path12.join(project_root, rel)}`);
18771
+ info(` ${path14.join(project_root, rel)}`);
18639
18772
  }
18640
18773
  info("The unified `agent-config migrate` sweeps these in one pass.");
18641
18774
  info("The wizard recreates fresh config afterwards.");
@@ -18666,20 +18799,20 @@ function _run_migrate_to_global(project_root) {
18666
18799
  function _format_global_root_for_marker(global_root) {
18667
18800
  const home = resolvePath(os7.homedir());
18668
18801
  const resolved = resolvePath(global_root);
18669
- const rel = path12.relative(home, resolved);
18670
- if (rel === "" || rel.startsWith("..") || path12.isAbsolute(rel)) {
18802
+ const rel = path14.relative(home, resolved);
18803
+ if (rel === "" || rel.startsWith("..") || path14.isAbsolute(rel)) {
18671
18804
  return global_root;
18672
18805
  }
18673
- return `~/${rel.split(path12.sep).join("/")}`;
18806
+ return `~/${rel.split(path14.sep).join("/")}`;
18674
18807
  }
18675
18808
  function _remove_legacy_consumer_bridge_marker(project_root, env = null) {
18676
18809
  const env_map = env ?? process3.env;
18677
18810
  if (env_map["AGENT_CONFIG_DEV_MODE"] === "1") return null;
18678
- if (isDir(path12.join(project_root, ".agent-src.uncondensed"))) return null;
18679
- const target = path12.join(project_root, CONSUMER_BRIDGE_MARKER_RELPATH);
18811
+ if (isDir(path14.join(project_root, ".agent-src.uncondensed"))) return null;
18812
+ const target = path14.join(project_root, CONSUMER_BRIDGE_MARKER_RELPATH);
18680
18813
  if (!isFile(target)) return null;
18681
18814
  try {
18682
- fs14.rmSync(target);
18815
+ fs16.rmSync(target);
18683
18816
  } catch {
18684
18817
  return null;
18685
18818
  }
@@ -18693,7 +18826,7 @@ var PROJECT_ANCHOR_TOOLS = {
18693
18826
  function _write_per_tool_project_anchors(project_root, tools, env = null, now = null) {
18694
18827
  const env_map = env ?? process3.env;
18695
18828
  if (env_map["AGENT_CONFIG_DEV_MODE"] === "1") return [];
18696
- if (isDir(path12.join(project_root, ".agent-src.uncondensed"))) return [];
18829
+ if (isDir(path14.join(project_root, ".agent-src.uncondensed"))) return [];
18697
18830
  const global_root_str = _format_global_root_for_marker(
18698
18831
  event4u_root(env_map)
18699
18832
  );
@@ -18702,8 +18835,8 @@ function _write_per_tool_project_anchors(project_root, tools, env = null, now =
18702
18835
  for (const tool_id of Object.keys(PROJECT_ANCHOR_TOOLS).sort()) {
18703
18836
  const rel_path = PROJECT_ANCHOR_TOOLS[tool_id];
18704
18837
  if (!tools.has(tool_id)) continue;
18705
- const target = path12.join(project_root, rel_path);
18706
- mkdirp(path12.dirname(target));
18838
+ const target = path14.join(project_root, rel_path);
18839
+ mkdirp(path14.dirname(target));
18707
18840
  const body = `# event4u/agent-config \u2014 per-tool project anchor (auto-written).
18708
18841
  # Spec: docs/contracts/consumer-bridge.md \xA7 Per-tool anchor strategy.
18709
18842
  # Tool: ${tool_id}. Resolves the global install directly \u2014 no
@@ -18721,7 +18854,7 @@ installed_at: ${stamp}
18721
18854
  }
18722
18855
  var PACKAGE_TAG_ID = "event4u/agent-config";
18723
18856
  function _inject_package_tag(target, source, package_root) {
18724
- if (path12.extname(target) !== ".md") return;
18857
+ if (path14.extname(target) !== ".md") return;
18725
18858
  let text;
18726
18859
  try {
18727
18860
  text = readText(target);
@@ -18749,8 +18882,8 @@ function _inject_package_tag(target, source, package_root) {
18749
18882
  resolved_src = source;
18750
18883
  }
18751
18884
  if (package_root !== null) {
18752
- const rel = path12.relative(resolvePath(package_root), resolved_src);
18753
- if (rel !== "" && !rel.startsWith("..") && !path12.isAbsolute(rel)) {
18885
+ const rel = path14.relative(resolvePath(package_root), resolved_src);
18886
+ if (rel !== "" && !rel.startsWith("..") && !path14.isAbsolute(rel)) {
18754
18887
  source_value = rel;
18755
18888
  } else {
18756
18889
  source_value = resolved_src;
@@ -18781,16 +18914,37 @@ function _inject_package_tag(target, source, package_root) {
18781
18914
  writeText(target, new_text);
18782
18915
  }
18783
18916
  }
18784
- function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null) {
18917
+ function _escapes_package_root(resolved, package_root) {
18918
+ if (package_root === null) return false;
18919
+ let root;
18920
+ try {
18921
+ root = fs16.realpathSync(package_root);
18922
+ } catch {
18923
+ return false;
18924
+ }
18925
+ return !is_ancestor(root, resolved);
18926
+ }
18927
+ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null, file_filter = null) {
18785
18928
  let written = 0;
18786
18929
  let skipped = 0;
18787
18930
  const written_paths = [];
18788
18931
  if (!pathExists(src)) return [0, 0, written_paths];
18789
18932
  if (!isDir(src)) {
18790
- mkdirp(path12.dirname(dest));
18933
+ if (file_filter !== null && !file_filter(src)) return [0, 0, written_paths];
18934
+ let resolved_src = src;
18935
+ try {
18936
+ resolved_src = fs16.realpathSync(src);
18937
+ } catch {
18938
+ resolved_src = src;
18939
+ }
18940
+ if (_escapes_package_root(resolved_src, package_root)) {
18941
+ warn(`refused: ${src} dereferences outside the package root \u2014 not copied`);
18942
+ return [0, 0, written_paths];
18943
+ }
18944
+ mkdirp(path14.dirname(dest));
18791
18945
  const decision = _resolve_file_conflict(dest, force);
18792
18946
  if (decision === "skip") return [0, 1, written_paths];
18793
- fs14.copyFileSync(src, dest);
18947
+ fs16.copyFileSync(src, dest);
18794
18948
  _inject_package_tag(dest, src, package_root);
18795
18949
  written_paths.push(dest);
18796
18950
  return [1, 0, written_paths];
@@ -18798,11 +18952,11 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null)
18798
18952
  mkdirp(dest);
18799
18953
  const walk = (node) => {
18800
18954
  const acc = [];
18801
- const names = fs14.readdirSync(node).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
18955
+ const names = fs16.readdirSync(node).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
18802
18956
  for (const name of names) {
18803
- const entry = path12.join(node, name);
18957
+ const entry = path14.join(node, name);
18804
18958
  acc.push(entry);
18805
- const lst = fs14.lstatSync(entry);
18959
+ const lst = fs16.lstatSync(entry);
18806
18960
  if (lst.isDirectory() && !lst.isSymbolicLink()) {
18807
18961
  acc.push(...walk(entry));
18808
18962
  }
@@ -18810,9 +18964,9 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null)
18810
18964
  return acc;
18811
18965
  };
18812
18966
  for (const entry of walk(src)) {
18813
- const rel = path12.relative(src, entry);
18814
- const target = path12.join(dest, rel);
18815
- const lst = fs14.lstatSync(entry);
18967
+ const rel = path14.relative(src, entry);
18968
+ const target = path14.join(dest, rel);
18969
+ const lst = fs16.lstatSync(entry);
18816
18970
  if (lst.isDirectory() && !lst.isSymbolicLink()) {
18817
18971
  mkdirp(target);
18818
18972
  continue;
@@ -18820,31 +18974,39 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null)
18820
18974
  let resolvedIsDir = false;
18821
18975
  let resolved = entry;
18822
18976
  try {
18823
- resolved = fs14.realpathSync(entry);
18824
- resolvedIsDir = fs14.statSync(entry).isDirectory();
18977
+ resolved = fs16.realpathSync(entry);
18978
+ resolvedIsDir = fs16.statSync(entry).isDirectory();
18825
18979
  } catch {
18826
18980
  resolvedIsDir = false;
18827
18981
  }
18982
+ if (_escapes_package_root(resolved, package_root)) {
18983
+ warn(`refused: ${entry} dereferences outside the package root \u2014 not copied`);
18984
+ continue;
18985
+ }
18828
18986
  if (resolvedIsDir) {
18829
18987
  mkdirp(target);
18830
18988
  const [sub_w, sub_s, sub_p] = _copy_dir_dereferencing_symlinks(
18831
18989
  resolved,
18832
18990
  target,
18833
18991
  force,
18834
- package_root
18992
+ package_root,
18993
+ file_filter
18835
18994
  );
18836
18995
  written += sub_w;
18837
18996
  skipped += sub_s;
18838
18997
  written_paths.push(...sub_p);
18839
18998
  continue;
18840
18999
  }
19000
+ if (file_filter !== null && !file_filter(entry)) {
19001
+ continue;
19002
+ }
18841
19003
  const decision = _resolve_file_conflict(target, force);
18842
19004
  if (decision === "skip") {
18843
19005
  skipped += 1;
18844
19006
  continue;
18845
19007
  }
18846
- mkdirp(path12.dirname(target));
18847
- fs14.copyFileSync(resolved, target);
19008
+ mkdirp(path14.dirname(target));
19009
+ fs16.copyFileSync(resolved, target);
18848
19010
  _inject_package_tag(target, resolved, package_root);
18849
19011
  written += 1;
18850
19012
  written_paths.push(target);
@@ -18856,7 +19018,7 @@ function _claude_desktop_bundles_dir() {
18856
19018
  }
18857
19019
  function _write_claude_desktop_marker(_force, lockfile_path2, bundles_dir, bundle_count) {
18858
19020
  const anchor = expanduser6(USER_SCOPE_PATHS["claude-desktop"]);
18859
- const target = path12.join(anchor, "agent-config.md");
19021
+ const target = path14.join(anchor, "agent-config.md");
18860
19022
  mkdirp(anchor);
18861
19023
  const body = claudeDesktopMarkerBody(lockfile_path2, anchor, bundles_dir, bundle_count);
18862
19024
  writeText(target, body);
@@ -18880,23 +19042,23 @@ function _apply_claude_flat_command_wrappers(anchor, package_root, current_files
18880
19042
  const wrapped = [];
18881
19043
  const collisions = [];
18882
19044
  const reserved = [];
18883
- const commands_dir = path12.join(anchor, "commands");
19045
+ const commands_dir = path14.join(anchor, "commands");
18884
19046
  let flat_entries = [];
18885
19047
  try {
18886
- flat_entries = fs14.readdirSync(commands_dir).filter((f) => f.endsWith(".md"));
19048
+ flat_entries = fs16.readdirSync(commands_dir).filter((f) => f.endsWith(".md"));
18887
19049
  } catch {
18888
19050
  }
18889
19051
  for (const fname of flat_entries.sort()) {
18890
19052
  const slug = fname.slice(0, -".md".length);
18891
19053
  if (!is_claude_builtin_name(slug)) continue;
18892
- fs14.rmSync(path12.join(commands_dir, fname), { force: true });
19054
+ fs16.rmSync(path14.join(commands_dir, fname), { force: true });
18893
19055
  current_files.delete(`commands/${fname}`);
18894
19056
  reserved.push(slug);
18895
19057
  }
18896
19058
  const eligible = new Set(_CLAUDE_FLAT_WRAPPER_EXTRA);
18897
19059
  try {
18898
19060
  const manifest = JSON.parse(
18899
- fs14.readFileSync(path12.join(package_root, "dist", "discovery", "discovery-manifest.json"), "utf8")
19061
+ fs16.readFileSync(path14.join(package_root, "dist", "discovery", "discovery-manifest.json"), "utf8")
18900
19062
  );
18901
19063
  for (const a of manifest.artefacts ?? []) {
18902
19064
  if (a.category !== "command" || typeof a.slug !== "string") continue;
@@ -18907,22 +19069,22 @@ function _apply_claude_flat_command_wrappers(anchor, package_root, current_files
18907
19069
  }
18908
19070
  for (const slug of [...eligible].sort()) {
18909
19071
  const flat_rel = `commands/${slug}.md`;
18910
- const flat_abs = path12.join(anchor, "commands", `${slug}.md`);
18911
- if (!fs14.existsSync(flat_abs)) continue;
18912
- const skill_dir = path12.join(anchor, "skills", slug);
18913
- if (fs14.existsSync(skill_dir)) {
19072
+ const flat_abs = path14.join(anchor, "commands", `${slug}.md`);
19073
+ if (!fs16.existsSync(flat_abs)) continue;
19074
+ const skill_dir = path14.join(anchor, "skills", slug);
19075
+ if (fs16.existsSync(skill_dir)) {
18914
19076
  collisions.push(slug);
18915
19077
  continue;
18916
19078
  }
18917
- let body = fs14.readFileSync(flat_abs, "utf8");
19079
+ let body = fs16.readFileSync(flat_abs, "utf8");
18918
19080
  if (body.startsWith("---\n") && !/^name:/m.test(body.split("\n---")[0] ?? "")) {
18919
19081
  body = body.replace("---\n", `---
18920
19082
  name: ${slug}
18921
19083
  `);
18922
19084
  }
18923
- fs14.mkdirSync(skill_dir, { recursive: true });
18924
- fs14.writeFileSync(path12.join(skill_dir, "SKILL.md"), body, "utf8");
18925
- fs14.rmSync(flat_abs, { force: true });
19085
+ fs16.mkdirSync(skill_dir, { recursive: true });
19086
+ fs16.writeFileSync(path14.join(skill_dir, "SKILL.md"), body, "utf8");
19087
+ fs16.rmSync(flat_abs, { force: true });
18926
19088
  current_files.delete(flat_rel);
18927
19089
  current_files.add(`skills/${slug}/SKILL.md`);
18928
19090
  wrapped.push(slug);
@@ -18931,6 +19093,7 @@ name: ${slug}
18931
19093
  }
18932
19094
  function _deploy_global_content(tools, force, package_root, lockfile_path2) {
18933
19095
  const results = {};
19096
+ const rule_scope = _resolve_global_rule_scope(package_root);
18934
19097
  for (const tool_id of [...tools].sort()) {
18935
19098
  if (tool_id === "claude-desktop") {
18936
19099
  results[tool_id] = _deploy_claude_desktop(force, package_root, lockfile_path2);
@@ -18953,15 +19116,26 @@ function _deploy_global_content(tools, force, package_root, lockfile_path2) {
18953
19116
  const written_paths = [];
18954
19117
  let current_files = /* @__PURE__ */ new Set();
18955
19118
  for (const [src_rel, dest_sub] of plan) {
18956
- const src = path12.join(package_root, src_rel);
18957
- const dest = dest_sub ? path12.join(anchor, dest_sub) : anchor;
18958
- const [w, s, paths] = _copy_dir_dereferencing_symlinks(src, dest, force, package_root);
19119
+ const src = path14.join(package_root, src_rel);
19120
+ const dest = dest_sub ? path14.join(anchor, dest_sub) : anchor;
19121
+ const rule_filter = _rule_filter_for_source(src_rel, rule_scope);
19122
+ const [w, s, paths] = _copy_dir_dereferencing_symlinks(
19123
+ src,
19124
+ dest,
19125
+ force,
19126
+ package_root,
19127
+ rule_filter
19128
+ );
18959
19129
  written_total += w;
18960
19130
  skipped_total += s;
18961
19131
  written_paths.push(...paths);
18962
19132
  current_files = setUnion(
18963
19133
  current_files,
18964
- expected_deploy_files(src, dest_sub ? dest_sub : "")
19134
+ expected_deploy_files(
19135
+ src,
19136
+ dest_sub ? dest_sub : "",
19137
+ rule_filter
19138
+ )
18965
19139
  );
18966
19140
  }
18967
19141
  if (tool_id === "claude-code") {
@@ -19017,10 +19191,10 @@ function _deploy_global_content(tools, force, package_root, lockfile_path2) {
19017
19191
  results[tool_id] = [written_total, skipped_total, "deployed", written_paths];
19018
19192
  if (tool_id === "claude-code") {
19019
19193
  try {
19020
- const manifest = path12.join(package_root, "src", "scripts", "hook_manifest.yaml");
19194
+ const manifest = path14.join(package_root, "src", "scripts", "hook_manifest.yaml");
19021
19195
  const matrix = build_claude_hook_matrix(manifest);
19022
19196
  const res = ensure_managed_hooks(
19023
- path12.join(anchor, "settings.json"),
19197
+ path14.join(anchor, "settings.json"),
19024
19198
  matrix
19025
19199
  );
19026
19200
  if (!state.QUIET) {
@@ -19048,6 +19222,7 @@ function setUnion(a, b) {
19048
19222
  function _preview_global_reap(tools, package_root) {
19049
19223
  const inventory = load_inventory();
19050
19224
  const preview = {};
19225
+ const rule_scope = _resolve_global_rule_scope(package_root);
19051
19226
  for (const tool_id of [...tools].sort()) {
19052
19227
  const plan = GLOBAL_DEPLOY_SOURCES[tool_id];
19053
19228
  if (plan === void 0) continue;
@@ -19056,10 +19231,14 @@ function _preview_global_reap(tools, package_root) {
19056
19231
  const anchor = expanduser6(anchor_raw);
19057
19232
  let current_files = /* @__PURE__ */ new Set();
19058
19233
  for (const [src_rel, dest_sub] of plan) {
19059
- const src = path12.join(package_root, src_rel);
19234
+ const src = path14.join(package_root, src_rel);
19060
19235
  current_files = setUnion(
19061
19236
  current_files,
19062
- expected_deploy_files(src, dest_sub ? dest_sub : "")
19237
+ expected_deploy_files(
19238
+ src,
19239
+ dest_sub ? dest_sub : "",
19240
+ _rule_filter_for_source(src_rel, rule_scope)
19241
+ )
19063
19242
  );
19064
19243
  }
19065
19244
  let would_reap = [];
@@ -19086,14 +19265,14 @@ function _preview_global_reap(tools, package_root) {
19086
19265
  function _verify_deploy_targets(anchor, plan) {
19087
19266
  const missing = [];
19088
19267
  for (const [, dest_sub] of plan) {
19089
- const target = dest_sub ? path12.join(anchor, dest_sub) : anchor;
19268
+ const target = dest_sub ? path14.join(anchor, dest_sub) : anchor;
19090
19269
  const label = dest_sub || ".";
19091
19270
  if (!isDir(target)) {
19092
19271
  missing.push(label);
19093
19272
  continue;
19094
19273
  }
19095
19274
  try {
19096
- const entries = fs14.readdirSync(target);
19275
+ const entries = fs16.readdirSync(target);
19097
19276
  if (entries.length === 0) missing.push(label);
19098
19277
  } catch {
19099
19278
  missing.push(label);
@@ -19108,13 +19287,13 @@ function _prune_modules_by(deploy_results, is_pruned) {
19108
19287
  const [written, skipped, status, paths] = deploy_results[tool_id];
19109
19288
  const pruned_skill_dirs = /* @__PURE__ */ new Set();
19110
19289
  for (const p of paths) {
19111
- const parts = p.split(path12.sep);
19290
+ const parts = p.split(path14.sep);
19112
19291
  if (parts.includes("skills")) {
19113
19292
  const i = parts.indexOf("skills");
19114
19293
  if (i + 1 < parts.length) {
19115
- const skill_root = parts.slice(0, i + 2).join(path12.sep);
19294
+ const skill_root = parts.slice(0, i + 2).join(path14.sep);
19116
19295
  if (!pruned_skill_dirs.has(skill_root)) {
19117
- const skillmd = path12.join(skill_root, "SKILL.md");
19296
+ const skillmd = path14.join(skill_root, "SKILL.md");
19118
19297
  if (pathExists(skillmd) && is_pruned(skillmd)) {
19119
19298
  pruned_skill_dirs.add(skill_root);
19120
19299
  }
@@ -19125,25 +19304,25 @@ function _prune_modules_by(deploy_results, is_pruned) {
19125
19304
  const keep = [];
19126
19305
  const delete_files = [];
19127
19306
  for (const p of paths) {
19128
- const parts = p.split(path12.sep);
19307
+ const parts = p.split(path14.sep);
19129
19308
  let is_target = false;
19130
19309
  if (parts.includes("skills")) {
19131
19310
  const i = parts.indexOf("skills");
19132
- if (i + 1 < parts.length && pruned_skill_dirs.has(parts.slice(0, i + 2).join(path12.sep))) {
19311
+ if (i + 1 < parts.length && pruned_skill_dirs.has(parts.slice(0, i + 2).join(path14.sep))) {
19133
19312
  is_target = true;
19134
19313
  }
19135
- } else if (parts.includes("commands") && path12.extname(p) === ".md" && is_pruned(p)) {
19314
+ } else if (parts.includes("commands") && path14.extname(p) === ".md" && is_pruned(p)) {
19136
19315
  is_target = true;
19137
19316
  }
19138
19317
  (is_target ? delete_files : keep).push(p);
19139
19318
  }
19140
19319
  for (const d of pruned_skill_dirs) {
19141
- fs14.rmSync(d, { recursive: true, force: true });
19320
+ fs16.rmSync(d, { recursive: true, force: true });
19142
19321
  }
19143
19322
  for (const p of delete_files) {
19144
- if (p.split(path12.sep).includes("commands") && pathExists(p)) {
19323
+ if (p.split(path14.sep).includes("commands") && pathExists(p)) {
19145
19324
  try {
19146
- fs14.unlinkSync(p);
19325
+ fs16.unlinkSync(p);
19147
19326
  } catch {
19148
19327
  }
19149
19328
  }
@@ -19158,7 +19337,7 @@ function _prune_lab_modules(deploy_results, lab_ids) {
19158
19337
  }
19159
19338
  var SCOPED_ACTIVE_WORKSPACES = /* @__PURE__ */ new Set(["engineering", "agent-config-maintainer"]);
19160
19339
  function _load_packs_registry(package_root) {
19161
- const vocab_path = path12.join(package_root, "src", "config", "discovery", "packs.yml");
19340
+ const vocab_path = path14.join(package_root, "src", "config", "discovery", "packs.yml");
19162
19341
  const data = yamlSafeLoad(readText(vocab_path));
19163
19342
  if (!Array.isArray(data)) {
19164
19343
  throw new Error(`packs.yml did not parse to a list: ${vocab_path}`);
@@ -19206,11 +19385,15 @@ function _compute_active_pack_ids(packs, runtime_active_packs) {
19206
19385
  return active;
19207
19386
  }
19208
19387
  function _resolve_global_settings_doc() {
19388
+ const p = _resolve_global_settings_path();
19389
+ return p === null ? null : _load_yaml_doc(p);
19390
+ }
19391
+ function _resolve_global_settings_path() {
19209
19392
  const root = event4u_root();
19210
- const canonical = path12.join(root, "settings", SETTINGS_FILE);
19211
- if (pathExists(canonical)) return _load_yaml_doc(canonical);
19212
- const legacy = path12.join(root, SETTINGS_FILE);
19213
- if (pathExists(legacy)) return _load_yaml_doc(legacy);
19393
+ const canonical = path14.join(root, "settings", SETTINGS_FILE);
19394
+ if (pathExists(canonical)) return canonical;
19395
+ const legacy = path14.join(root, SETTINGS_FILE);
19396
+ if (pathExists(legacy)) return legacy;
19214
19397
  return null;
19215
19398
  }
19216
19399
  function _resolve_scoped_projection(package_root) {
@@ -19222,6 +19405,44 @@ function _resolve_scoped_projection(package_root) {
19222
19405
  const active_packs = Array.isArray(active_packs_raw) ? active_packs_raw.filter((v) => typeof v === "string") : [];
19223
19406
  return { mode, active_packs };
19224
19407
  }
19408
+ function _resolve_global_rule_scope(package_root) {
19409
+ const settings_path = _resolve_global_settings_path();
19410
+ if (settings_path === null) {
19411
+ try {
19412
+ return ruleScopeFromSettings(_load_default_settings(package_root));
19413
+ } catch {
19414
+ return LEGACY_ALL;
19415
+ }
19416
+ }
19417
+ let text;
19418
+ try {
19419
+ text = readText(settings_path);
19420
+ } catch (e) {
19421
+ warn(
19422
+ `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.`
19423
+ );
19424
+ return LEGACY_ALL;
19425
+ }
19426
+ const parsed = yamlSafeLoad(text);
19427
+ if (!_isPlainObject2(parsed)) {
19428
+ warn(
19429
+ `${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.`
19430
+ );
19431
+ return LEGACY_ALL;
19432
+ }
19433
+ try {
19434
+ return ruleScopeFromSettings(parsed);
19435
+ } catch (e) {
19436
+ warn(
19437
+ `could not derive rule scope from ${settings_path} (${String(e)}) \u2014 falling back to legacy-all; ALL rules will be installed.`
19438
+ );
19439
+ return LEGACY_ALL;
19440
+ }
19441
+ }
19442
+ function _rule_filter_for_source(src_rel, scope) {
19443
+ if (src_rel !== RULE_SOURCE_REL) return null;
19444
+ return (srcFile) => ruleFileArrives(srcFile, scope);
19445
+ }
19225
19446
  function _prune_scoped_modules(deploy_results, active_ids) {
19226
19447
  return _prune_modules_by(deploy_results, (p) => {
19227
19448
  const packs = frontmatter_packs(p);
@@ -19286,7 +19507,7 @@ function install_global(tools, force, project_root = null, core_only = false) {
19286
19507
  info(` schema_version=1, agent_config_version=${installed_version}`);
19287
19508
  info(` tools=${merged_tools.join(",")}`);
19288
19509
  }
19289
- if (project_root !== null && pathExists(_resolve_settings_read(project_root)) && !isDir(path12.join(project_root, ".agent-src.uncondensed"))) {
19510
+ if (project_root !== null && pathExists(_resolve_settings_read(project_root)) && !isDir(path14.join(project_root, ".agent-src.uncondensed"))) {
19290
19511
  const drift = collect_drift(project_root);
19291
19512
  if (!state.QUIET) {
19292
19513
  process3.stdout.write("\n");
@@ -19386,19 +19607,19 @@ function install_global(tools, force, project_root = null, core_only = false) {
19386
19607
  }
19387
19608
  }
19388
19609
  }
19389
- if (project_root !== null && pathExists(_resolve_settings_read(project_root)) && !isDir(path12.join(project_root, ".agent-src.uncondensed"))) {
19610
+ if (project_root !== null && pathExists(_resolve_settings_read(project_root)) && !isDir(path14.join(project_root, ".agent-src.uncondensed"))) {
19390
19611
  const files_by_tool = _files_by_tool_from_deploy(deploy_results);
19391
19612
  const rc = _update_installed_tools_manifest(project_root, tools, "global", force, files_by_tool);
19392
19613
  if (rc !== 0) return rc;
19393
19614
  const removed_marker = _remove_legacy_consumer_bridge_marker(project_root);
19394
19615
  if (removed_marker !== null && !state.QUIET) {
19395
- const rel = isRelativeTo(removed_marker, project_root) ? path12.relative(project_root, removed_marker) : removed_marker;
19616
+ const rel = isRelativeTo(removed_marker, project_root) ? path14.relative(project_root, removed_marker) : removed_marker;
19396
19617
  info(`Removed legacy bridge marker: ${rel}`);
19397
19618
  }
19398
19619
  const anchor_paths = _write_per_tool_project_anchors(project_root, tools);
19399
19620
  if (anchor_paths.length > 0 && !state.QUIET) {
19400
19621
  for (const p of anchor_paths) {
19401
- const rel = isRelativeTo(p, project_root) ? path12.relative(project_root, p) : p;
19622
+ const rel = isRelativeTo(p, project_root) ? path14.relative(project_root, p) : p;
19402
19623
  info(`Project anchor written: ${rel}`);
19403
19624
  }
19404
19625
  }
@@ -19415,8 +19636,8 @@ function install_global(tools, force, project_root = null, core_only = false) {
19415
19636
  }
19416
19637
  return 0;
19417
19638
  }
19418
- var SETTINGS_SURFACE_REL = path12.join("state", "settings-surface.json");
19419
- var SETTINGS_DELTA_REL = path12.join("state", "settings-delta.json");
19639
+ var SETTINGS_SURFACE_REL = path14.join("state", "settings-surface.json");
19640
+ var SETTINGS_DELTA_REL = path14.join("state", "settings-delta.json");
19420
19641
  function _current_settings_surface(version) {
19421
19642
  const jsonSchema = zodToJsonSchema(settingsSchema, {
19422
19643
  name: "AgentSettings",
@@ -19427,20 +19648,20 @@ function _current_settings_surface(version) {
19427
19648
  }
19428
19649
  function _write_settings_surface_snapshot(installed_version) {
19429
19650
  const root = event4u_root();
19430
- const surface_path = path12.join(root, SETTINGS_SURFACE_REL);
19431
- const delta_path = path12.join(root, SETTINGS_DELTA_REL);
19651
+ const surface_path = path14.join(root, SETTINGS_SURFACE_REL);
19652
+ const delta_path = path14.join(root, SETTINGS_DELTA_REL);
19432
19653
  const next = _current_settings_surface(installed_version);
19433
19654
  let previous = null;
19434
19655
  try {
19435
- const parsed = JSON.parse(fs14.readFileSync(surface_path, "utf8"));
19656
+ const parsed = JSON.parse(fs16.readFileSync(surface_path, "utf8"));
19436
19657
  if (parsed !== null && typeof parsed === "object" && parsed.entries !== void 0) previous = parsed;
19437
19658
  } catch {
19438
19659
  }
19439
19660
  if (previous !== null && previous.version !== next.version) {
19440
19661
  const delta = computeSurfaceDelta(previous, next);
19441
19662
  if (delta.changes.length > 0) {
19442
- fs14.mkdirSync(path12.dirname(delta_path), { recursive: true, mode: 448 });
19443
- fs14.writeFileSync(delta_path, `${JSON.stringify(delta, null, 2)}
19663
+ fs16.mkdirSync(path14.dirname(delta_path), { recursive: true, mode: 448 });
19664
+ fs16.writeFileSync(delta_path, `${JSON.stringify(delta, null, 2)}
19444
19665
  `, { mode: 384 });
19445
19666
  if (!state.QUIET) {
19446
19667
  const counts = {};
@@ -19452,8 +19673,8 @@ function _write_settings_surface_snapshot(installed_version) {
19452
19673
  }
19453
19674
  }
19454
19675
  }
19455
- fs14.mkdirSync(path12.dirname(surface_path), { recursive: true, mode: 448 });
19456
- fs14.writeFileSync(surface_path, `${JSON.stringify(next, null, 2)}
19676
+ fs16.mkdirSync(path14.dirname(surface_path), { recursive: true, mode: 448 });
19677
+ fs16.writeFileSync(surface_path, `${JSON.stringify(next, null, 2)}
19457
19678
  `, { mode: 384 });
19458
19679
  }
19459
19680
  function arrayStrEqual(a, b) {
@@ -19665,13 +19886,13 @@ function _minimal_templates_root() {
19665
19886
  const chain = [start];
19666
19887
  let cur = start;
19667
19888
  for (; ; ) {
19668
- const parent = path12.dirname(cur);
19889
+ const parent = path14.dirname(cur);
19669
19890
  if (parent === cur) break;
19670
19891
  chain.push(parent);
19671
19892
  cur = parent;
19672
19893
  }
19673
19894
  for (const ancestor of chain) {
19674
- const candidate = path12.join(ancestor, "src", "templates", "minimal");
19895
+ const candidate = path14.join(ancestor, "src", "templates", "minimal");
19675
19896
  if (isDir(candidate)) return candidate;
19676
19897
  }
19677
19898
  fail("Could not locate src/templates/minimal/ \u2014 package install is corrupt.");
@@ -19679,9 +19900,9 @@ function _minimal_templates_root() {
19679
19900
  var INSTALL_MODE_MARKER_REL = "agents/.agent-state/install-mode.txt";
19680
19901
  function _write_install_mode_marker(project_root, mode) {
19681
19902
  if (mode !== "minimal" && mode !== "full") return;
19682
- const marker = path12.join(project_root, INSTALL_MODE_MARKER_REL);
19903
+ const marker = path14.join(project_root, INSTALL_MODE_MARKER_REL);
19683
19904
  try {
19684
- mkdirp(path12.dirname(marker));
19905
+ mkdirp(path14.dirname(marker));
19685
19906
  writeText(marker, `${mode}
19686
19907
  `);
19687
19908
  } catch {
@@ -19690,7 +19911,7 @@ function _write_install_mode_marker(project_root, mode) {
19690
19911
  function install_minimal(target_root_in, force, user_type = "") {
19691
19912
  let target_root = resolvePath(target_root_in);
19692
19913
  mkdirp(target_root);
19693
- const parent = path12.dirname(target_root);
19914
+ const parent = path14.dirname(target_root);
19694
19915
  if (parent !== target_root) {
19695
19916
  const existing = find_project_root_with_anchor(parent);
19696
19917
  if (existing !== null && existing[0] !== target_root) {
@@ -19701,21 +19922,21 @@ function install_minimal(target_root_in, force, user_type = "") {
19701
19922
  }
19702
19923
  }
19703
19924
  const templates = _minimal_templates_root();
19704
- const settings_src = path12.join(templates, SETTINGS_FILE);
19705
- const overrides_gitkeep_src = path12.join(templates, "overrides-gitkeep");
19706
- const overrides_readme_src = path12.join(templates, "agents-overrides-readme.md");
19925
+ const settings_src = path14.join(templates, SETTINGS_FILE);
19926
+ const overrides_gitkeep_src = path14.join(templates, "overrides-gitkeep");
19927
+ const overrides_readme_src = path14.join(templates, "agents-overrides-readme.md");
19707
19928
  if (!isFile(settings_src)) fail(`Bundled minimal settings template missing under ${templates}`);
19708
19929
  if (!isFile(overrides_gitkeep_src) || !isFile(overrides_readme_src)) {
19709
19930
  fail(`Bundled overrides scaffold templates missing under ${templates}`);
19710
19931
  }
19711
19932
  info(`Minimal init \u2192 ${target_root}`);
19712
- const overrides_root = path12.join(target_root, "agents", "overrides");
19933
+ const overrides_root = path14.join(target_root, "agents", "overrides");
19713
19934
  mkdirp(overrides_root);
19714
19935
  const gitkeep_body = readText(overrides_gitkeep_src);
19715
19936
  for (const sub of ["rules", "skills", "commands"]) {
19716
- const sub_dir = path12.join(overrides_root, sub);
19937
+ const sub_dir = path14.join(overrides_root, sub);
19717
19938
  mkdirp(sub_dir);
19718
- const gitkeep_dst = path12.join(sub_dir, ".gitkeep");
19939
+ const gitkeep_dst = path14.join(sub_dir, ".gitkeep");
19719
19940
  if (pathExists(gitkeep_dst) && !force) {
19720
19941
  skip(`agents/overrides/${sub}/.gitkeep already exists (use --force to overwrite)`);
19721
19942
  } else {
@@ -19723,7 +19944,7 @@ function install_minimal(target_root_in, force, user_type = "") {
19723
19944
  success(`Wrote agents/overrides/${sub}/.gitkeep`);
19724
19945
  }
19725
19946
  }
19726
- const readme_dst = path12.join(overrides_root, "README.md");
19947
+ const readme_dst = path14.join(overrides_root, "README.md");
19727
19948
  if (pathExists(readme_dst) && !force) {
19728
19949
  skip("agents/overrides/README.md already exists (use --force to overwrite)");
19729
19950
  } else {
@@ -19741,14 +19962,14 @@ function install_minimal(target_root_in, force, user_type = "") {
19741
19962
  personal:
19742
19963
  user_type: ${user_type}
19743
19964
  `;
19744
- mkdirp(path12.dirname(settings_dst));
19965
+ mkdirp(path14.dirname(settings_dst));
19745
19966
  writeText(settings_dst, body);
19746
19967
  success(`Wrote ${SETTINGS_FILE} (user_type=${user_type})`);
19747
19968
  }
19748
19969
  }
19749
19970
  const removed_marker = _remove_legacy_consumer_bridge_marker(target_root);
19750
19971
  if (removed_marker !== null) {
19751
- const rel = isRelativeTo(removed_marker, target_root) ? path12.relative(target_root, removed_marker) : removed_marker;
19972
+ const rel = isRelativeTo(removed_marker, target_root) ? path14.relative(target_root, removed_marker) : removed_marker;
19752
19973
  success(`Removed legacy bridge marker: ${rel}`);
19753
19974
  }
19754
19975
  _write_install_mode_marker(target_root, "minimal");
@@ -19822,7 +20043,7 @@ function run_interactive_init(project_root, force) {
19822
20043
  );
19823
20044
  return 0;
19824
20045
  }
19825
- const target = path12.join(project_root, _LOCAL_CONFIG_FILE);
20046
+ const target = path14.join(project_root, _LOCAL_CONFIG_FILE);
19826
20047
  if (pathExists(target) && !force) {
19827
20048
  warn(
19828
20049
  `${_LOCAL_CONFIG_FILE} already exists; re-run with --force to overwrite. Skipping interactive init.`
@@ -19849,7 +20070,7 @@ function run_interactive_init(project_root, force) {
19849
20070
  warn(`Could not write ${target}: ${String(exc)}`);
19850
20071
  return 1;
19851
20072
  }
19852
- success(`Wrote ${path12.relative(project_root, target)} (${user_type} / ${stack} / ${verbosity})`);
20073
+ success(`Wrote ${path14.relative(project_root, target)} (${user_type} / ${stack} / ${verbosity})`);
19853
20074
  return 0;
19854
20075
  }
19855
20076
  var _WIZARD_READY_RE = /^WIZARD_READY (http:\/\/(?:127\.0\.0\.1|localhost):\d+\/\S*)\r?$/;
@@ -19867,12 +20088,12 @@ function _wizard_should_launch(opts) {
19867
20088
  return [true, ""];
19868
20089
  }
19869
20090
  function _wizard_cli_dist(_project_root) {
19870
- const package_root = path12.dirname(path12.dirname(path12.dirname(resolvePath(_HERE2))));
19871
- const cli = path12.join(package_root, "dist", "cli", "agent-config.js");
20091
+ const package_root = path14.dirname(path14.dirname(path14.dirname(resolvePath(_HERE2))));
20092
+ const cli = path14.join(package_root, "dist", "cli", "agent-config.js");
19872
20093
  return pathExists(cli) ? cli : null;
19873
20094
  }
19874
20095
  function _server_info_path() {
19875
- return path12.join(os7.homedir(), ".event4u", "agent-config", "local-server.json");
20096
+ return path14.join(os7.homedir(), ".event4u", "agent-config", "local-server.json");
19876
20097
  }
19877
20098
  function _pid_is_agent_config(pid) {
19878
20099
  let res;
@@ -19889,7 +20110,7 @@ function _pid_is_agent_config(pid) {
19889
20110
  }
19890
20111
  function unlinkMissingOk(p) {
19891
20112
  try {
19892
- fs14.unlinkSync(p);
20113
+ fs16.unlinkSync(p);
19893
20114
  } catch {
19894
20115
  }
19895
20116
  }
@@ -19967,14 +20188,14 @@ function _wizard_spawn(project_root, pass_project_root = true) {
19967
20188
  }
19968
20189
  function _wizard_run_sync(cmd, env, cli) {
19969
20190
  const total = _WIZARD_TIMEOUTS.reduce((a, b) => a + b, 0);
19970
- const log_path = path12.join(
20191
+ const log_path = path14.join(
19971
20192
  os7.tmpdir(),
19972
20193
  `agent-config-wizard-${process3.pid}-${Date.now()}.log`
19973
20194
  );
19974
20195
  let child;
19975
20196
  let log_fd = null;
19976
20197
  try {
19977
- log_fd = fs14.openSync(log_path, "w");
20198
+ log_fd = fs16.openSync(log_path, "w");
19978
20199
  child = spawn(cmd[0], cmd.slice(1), {
19979
20200
  env,
19980
20201
  detached: true,
@@ -19992,7 +20213,7 @@ function _wizard_run_sync(cmd, env, cli) {
19992
20213
  } finally {
19993
20214
  if (log_fd !== null) {
19994
20215
  try {
19995
- fs14.closeSync(log_fd);
20216
+ fs16.closeSync(log_fd);
19996
20217
  } catch {
19997
20218
  }
19998
20219
  }
@@ -20242,8 +20463,8 @@ function main2(argv) {
20242
20463
  const target_root = resolvePath(
20243
20464
  opts.custom_path || opts.project || process3.env["PROJECT_ROOT"] || process3.cwd()
20244
20465
  );
20245
- const minimal_package_root = path12.dirname(
20246
- path12.dirname(path12.dirname(_minimal_templates_root()))
20466
+ const minimal_package_root = path14.dirname(
20467
+ path14.dirname(path14.dirname(_minimal_templates_root()))
20247
20468
  );
20248
20469
  const validated_user_type = _validate_user_type(minimal_package_root, opts.user_type);
20249
20470
  return install_minimal(target_root, opts.force, validated_user_type);
@@ -20272,7 +20493,7 @@ function main2(argv) {
20272
20493
  return rc2;
20273
20494
  }
20274
20495
  const project_root = custom_path || resolvePath(opts.project || process3.env["PROJECT_ROOT"] || process3.cwd());
20275
- const is_first_run = !pathExists(path12.join(project_root, SETTINGS_FILE));
20496
+ const is_first_run = !pathExists(path14.join(project_root, SETTINGS_FILE));
20276
20497
  const rc = _main_project_install(opts, project_root, parsed_tools, is_first_run);
20277
20498
  if (rc === 0 && opts.interactive) {
20278
20499
  run_interactive_init(project_root, opts.force);
@@ -20336,16 +20557,16 @@ function _team_setup_hint_line(project_root) {
20336
20557
  return " \u2022 Claude Code team mode (optional cross-model review via the official codex plugin): run `agent-config doctor --check team` for setup status.";
20337
20558
  }
20338
20559
  function finalize_claude_model_tiers(project_root) {
20339
- const claude_skills = path12.join(project_root, ".claude", "skills");
20340
- const augment_skills = path12.join(project_root, ".augment", "skills");
20560
+ const claude_skills = path14.join(project_root, ".claude", "skills");
20561
+ const augment_skills = path14.join(project_root, ".augment", "skills");
20341
20562
  if (!isDir(claude_skills) || !isDir(augment_skills)) return 0;
20342
20563
  if (_read_consumer_auto_switch(project_root) !== "auto") return 0;
20343
20564
  let rendered = 0;
20344
- const entries = fs14.readdirSync(claude_skills).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
20565
+ const entries = fs16.readdirSync(claude_skills).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
20345
20566
  for (const name of entries) {
20346
- const entry = path12.join(claude_skills, name);
20347
- const src_dir = path12.join(augment_skills, name);
20348
- const src_md = path12.join(src_dir, "SKILL.md");
20567
+ const entry = path14.join(claude_skills, name);
20568
+ const src_dir = path14.join(augment_skills, name);
20569
+ const src_md = path14.join(src_dir, "SKILL.md");
20349
20570
  let tier;
20350
20571
  try {
20351
20572
  tier = read_model_tier(src_md);
@@ -20354,22 +20575,22 @@ function finalize_claude_model_tiers(project_root) {
20354
20575
  }
20355
20576
  if (tier === null || !(tier in TIER_TO_CLAUDE_MODEL) || !isDir(src_dir)) continue;
20356
20577
  if (isSymlink(entry) || isFile(entry)) {
20357
- fs14.unlinkSync(entry);
20578
+ fs16.unlinkSync(entry);
20358
20579
  } else if (isDir(entry)) {
20359
- fs14.rmSync(entry, { recursive: true, force: true });
20580
+ fs16.rmSync(entry, { recursive: true, force: true });
20360
20581
  }
20361
20582
  mkdirp(entry);
20362
- const srcFiles = fs14.readdirSync(src_dir).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
20583
+ const srcFiles = fs16.readdirSync(src_dir).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
20363
20584
  for (const fname of srcFiles) {
20364
20585
  if (fname === "SKILL.md") {
20365
20586
  writeText(
20366
- path12.join(entry, "SKILL.md"),
20587
+ path14.join(entry, "SKILL.md"),
20367
20588
  render_native_model_md(readText(src_md), tier)
20368
20589
  );
20369
20590
  } else {
20370
- fs14.symlinkSync(
20371
- path12.join("../../../.augment/skills", name, fname),
20372
- path12.join(entry, fname)
20591
+ fs16.symlinkSync(
20592
+ path14.join("../../../.augment/skills", name, fname),
20593
+ path14.join(entry, fname)
20373
20594
  );
20374
20595
  }
20375
20596
  }
@@ -20387,7 +20608,7 @@ function _main_project_install(opts, project_root, parsed_tools, is_first_run) {
20387
20608
  let package_type;
20388
20609
  if (opts.package) {
20389
20610
  package_root = resolvePath(opts.package);
20390
- if (!pathExists(path12.join(package_root, "src", "config", "profiles", "minimal.ini"))) {
20611
+ if (!pathExists(path14.join(package_root, "src", "config", "profiles", "minimal.ini"))) {
20391
20612
  fail(`Invalid --package path (missing src/config/profiles/minimal.ini): ${package_root}`);
20392
20613
  }
20393
20614
  package_type = detect_package_type_for_project(project_root, package_root);
@@ -20522,9 +20743,9 @@ function _main_project_install(opts, project_root, parsed_tools, is_first_run) {
20522
20743
  function _resolvedArgv1() {
20523
20744
  if (process3.argv[1] === void 0) return void 0;
20524
20745
  try {
20525
- return fs14.realpathSync(path12.resolve(process3.argv[1]));
20746
+ return fs16.realpathSync(path14.resolve(process3.argv[1]));
20526
20747
  } catch {
20527
- return path12.resolve(process3.argv[1]);
20748
+ return path14.resolve(process3.argv[1]);
20528
20749
  }
20529
20750
  }
20530
20751
  var _argv1 = _resolvedArgv1();
@@ -20570,7 +20791,9 @@ export {
20570
20791
  _bridge_marker,
20571
20792
  _canonical_settings_target,
20572
20793
  _compute_active_pack_ids,
20794
+ _copy_dir_dereferencing_symlinks,
20573
20795
  _current_settings_surface,
20796
+ _deploy_global_content,
20574
20797
  _detect_legacy_for_migration,
20575
20798
  _dry_run_summary,
20576
20799
  _files_by_tool_from_bridges,
@@ -20584,12 +20807,14 @@ export {
20584
20807
  _parse_legacy_settings,
20585
20808
  _parse_profile_ini,
20586
20809
  _parse_tools,
20810
+ _preview_global_reap,
20587
20811
  _prune_lab_modules,
20588
20812
  _prune_modules_by,
20589
20813
  _prune_scoped_modules,
20590
20814
  _render_template,
20591
20815
  _replace_template_value,
20592
20816
  _replace_template_value_raw,
20817
+ _resolve_global_rule_scope,
20593
20818
  _resolve_global_settings_doc,
20594
20819
  _resolve_scope,
20595
20820
  _resolve_scoped_projection,