@event4u/agent-config 12.0.0 → 13.0.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 (148) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/CHANGELOG.md +273 -0
  3. package/README.md +1 -1
  4. package/agents/templates/.ai-council.yml.example +46 -3
  5. package/dist/agent-src/commands/cost/report.md +23 -0
  6. package/dist/agent-src/contexts/execution/subagent-routing.md +148 -33
  7. package/dist/agent-src/contexts/model-recommendations.md +6 -4
  8. package/dist/agent-src/contexts/subagent-configuration.md +69 -7
  9. package/dist/agent-src/rules/autonomous-execution.md +1 -1
  10. package/dist/agent-src/rules/design-fidelity.md +1 -1
  11. package/dist/agent-src/rules/design-review-after-ui-write.md +10 -5
  12. package/dist/agent-src/rules/evaluator-independence.md +27 -5
  13. package/dist/agent-src/rules/git-history-discipline.md +5 -1
  14. package/dist/agent-src/rules/low-impact-corpus-privacy-floor.md +1 -0
  15. package/dist/agent-src/rules/missing-skill-recovery.md +89 -0
  16. package/dist/agent-src/rules/ui-audit-gate.md +9 -4
  17. package/dist/agent-src/scripts/archive_completed_roadmaps.ts +33 -0
  18. package/dist/agent-src/scripts/roadmap_gates.ts +30 -2
  19. package/dist/agent-src/scripts/update_roadmap_progress.ts +47 -1
  20. package/dist/agent-src/skills/authz-review/SKILL.md +4 -0
  21. package/dist/agent-src/skills/design-system-capture/SKILL.md +4 -0
  22. package/dist/agent-src/skills/design-system-capture/references/snapshot-preference-order.md +77 -0
  23. package/dist/agent-src/skills/merge-conflicts/SKILL.md +4 -0
  24. package/dist/agent-src/skills/prompt-optimizer/SKILL.md +17 -1
  25. package/dist/agent-src/skills/roadmap-writing/SKILL.md +11 -11
  26. package/dist/agent-src/skills/systematic-debugging/SKILL.md +4 -0
  27. package/dist/agent-src/skills/threat-modeling/SKILL.md +3 -0
  28. package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
  29. package/dist/agent-src/templates/roadmaps.md +41 -3
  30. package/dist/cli/registry.js +1 -0
  31. package/dist/cli/registry.js.map +1 -1
  32. package/dist/cli-delegate/{chunk-NN4KW4HZ.js → chunk-3B72LSZL.js} +123 -2338
  33. package/dist/cli-delegate/{chunk-55WZN5VF.js → chunk-EVTY7ISR.js} +2 -2
  34. package/dist/cli-delegate/chunk-N7FEST6D.js +3895 -0
  35. package/dist/cli-delegate/{chunk-L565YFXH.js → chunk-XURJ4AQC.js} +566 -298
  36. package/dist/cli-delegate/cmd_conformance.js +4 -4
  37. package/dist/cli-delegate/cmd_doctor.js +2 -2
  38. package/dist/cli-delegate/cmd_export.js +2 -2
  39. package/dist/cli-delegate/cmd_handoff.js +1 -1
  40. package/dist/cli-delegate/cmd_prune.js +2 -2
  41. package/dist/cli-delegate/cmd_settings_migrate.js +2 -2
  42. package/dist/cli-delegate/cmd_settings_set.js +1 -1
  43. package/dist/cli-delegate/cmd_sync.js +2 -2
  44. package/dist/cli-delegate/cmd_uninstall.js +2 -2
  45. package/dist/cli-delegate/cmd_validate.js +2 -2
  46. package/dist/discovery/deprecation-report.md +1 -1
  47. package/dist/discovery/discovery-manifest.json +44 -23
  48. package/dist/discovery/discovery-manifest.json.sha256 +1 -1
  49. package/dist/discovery/discovery-manifest.summary.md +3 -3
  50. package/dist/discovery/dormancy-report.md +1 -1
  51. package/dist/discovery/orphan-report.md +1 -1
  52. package/dist/discovery/packs.json +6 -5
  53. package/dist/discovery/trust-report.md +2 -2
  54. package/dist/discovery/workspaces.json +5 -4
  55. package/dist/hooks/dispatch.js +10625 -8541
  56. package/dist/install/install.mjs +754 -484
  57. package/dist/mcp/registry-manifest.json +3 -3
  58. package/dist/mcp/server.json +2 -2
  59. package/dist/mcp/server.mjs +1302 -167
  60. package/dist/router.json +1 -1
  61. package/dist/scripts/_lib/model_tier.js +9 -0
  62. package/dist/scripts/_lib/model_tier.js.map +1 -1
  63. package/dist/scripts/condense.js +50 -0
  64. package/dist/scripts/condense.js.map +1 -1
  65. package/dist/server/schemas/settings.js +2 -2
  66. package/dist/server/schemas/settings.js.map +1 -1
  67. package/docs/MIGRATION.md +20 -1
  68. package/docs/guidelines/design-fidelity-mechanics.md +21 -0
  69. package/docs/guidelines/design-handover-extraction.md +87 -0
  70. package/docs/guidelines/prompt-templates.md +24 -1
  71. package/package.json +1 -1
  72. package/src/agent-src/scripts/archive_completed_roadmaps.ts +33 -0
  73. package/src/agent-src/scripts/roadmap_gates.ts +30 -2
  74. package/src/agent-src/scripts/update_roadmap_progress.ts +47 -1
  75. package/src/config/evaluator-budgets.json +9 -8
  76. package/src/config/gate-coverage.yml +63 -11
  77. package/src/config/gate-violation-baselines.json +12 -0
  78. package/src/config/hook-token-budget.json +15 -2
  79. package/src/config/preamble-payload-budget.json +28 -0
  80. package/src/scripts/_dispatch.bash +10 -0
  81. package/src/scripts/_lib/bench_ab_complexity.ts +439 -0
  82. package/src/scripts/_lib/bench_ab_safety_tier.ts +142 -0
  83. package/src/scripts/_lib/bench_ab_scoring_v2.ts +28 -3
  84. package/src/scripts/_lib/bench_ab_search_adherence.ts +423 -0
  85. package/src/scripts/_lib/bench_ab_size_claim.ts +206 -0
  86. package/src/scripts/_lib/bench_ab_workspace.ts +111 -0
  87. package/src/scripts/_lib/git_common_dir.ts +173 -0
  88. package/src/scripts/_lib/model_tier.ts +9 -0
  89. package/src/scripts/_lib/release_highlights.ts +108 -7
  90. package/src/scripts/_lib/skill_catalogue.ts +1115 -0
  91. package/src/scripts/_lib/tier_budget_routing.ts +31 -331
  92. package/src/scripts/ai_council/clients.ts +197 -18
  93. package/src/scripts/ai_council/config.ts +16 -1
  94. package/src/scripts/ai_council/low_impact.ts +14 -1
  95. package/src/scripts/ai_council/orchestrator.ts +14 -1
  96. package/src/scripts/ai_council/transport_resolver.ts +32 -2
  97. package/src/scripts/bench_ab_v2_complexity.ts +252 -0
  98. package/src/scripts/bench_ab_v2_run.ts +3 -42
  99. package/src/scripts/bench_ab_v2_safety.ts +296 -0
  100. package/src/scripts/bench_ab_v2_search.ts +343 -0
  101. package/src/scripts/bench_ab_v2_stats.ts +191 -0
  102. package/src/scripts/build_archive_index.ts +383 -0
  103. package/src/scripts/capture_skill_catalogue.ts +279 -317
  104. package/src/scripts/check_branch_freshness.ts +7 -1
  105. package/src/scripts/check_release_published.ts +6 -2
  106. package/src/scripts/check_release_trunk_sync.ts +18 -2
  107. package/src/scripts/check_source_size_budget.ts +428 -0
  108. package/src/scripts/check_suppression_hygiene.ts +5 -1
  109. package/src/scripts/condense.ts +50 -1
  110. package/src/scripts/cost/backfill_rates.mjs +298 -0
  111. package/src/scripts/cost/budget.mjs +12 -32
  112. package/src/scripts/cost_summary.ts +25 -0
  113. package/src/scripts/dispatch_r2_reviewer.ts +15 -5
  114. package/src/scripts/evidence_report.ts +15 -4
  115. package/src/scripts/external_sources_denylist.json +1 -0
  116. package/src/scripts/hook_manifest.yaml +75 -15
  117. package/src/scripts/hooks/concern_registry.ts +4 -0
  118. package/src/scripts/hooks/orchestration_record_hook.ts +21 -0
  119. package/src/scripts/hooks/skill_route_hook.ts +226 -0
  120. package/src/scripts/hooks/tool_result_bytes_hook.ts +219 -0
  121. package/src/scripts/hooks/ui_route_nudge_hook.ts +6 -3
  122. package/src/scripts/hot_context_hook.ts +13 -1
  123. package/src/scripts/install.ts +129 -0
  124. package/src/scripts/janitor.ts +77 -2
  125. package/src/scripts/lint_design_antipattern_parity.ts +40 -6
  126. package/src/scripts/lint_harvest_provenance.ts +35 -1
  127. package/src/scripts/lint_plan_risk_register.ts +22 -9
  128. package/src/scripts/lint_roadmap_blockers.ts +109 -6
  129. package/src/scripts/lint_rule_skill_pack_reach.ts +43 -0
  130. package/src/scripts/lint_scheduled_deprecations.ts +738 -0
  131. package/src/scripts/lint_skill_router_head.ts +21 -0
  132. package/src/scripts/mcp_server/consumer_tool_catalog.json +26 -3
  133. package/src/scripts/mcp_server/tool_catalog_source.ts +6 -24
  134. package/src/scripts/mcp_server/tools.ts +87 -0
  135. package/src/scripts/migration_status.ts +17 -1
  136. package/src/scripts/probe_review_binding_drift.ts +731 -0
  137. package/src/scripts/release.ts +100 -6
  138. package/src/scripts/routing_doctor.ts +50 -13
  139. package/src/scripts/schemas/command.schema.json +3 -3
  140. package/src/scripts/schemas/skill.schema.json +20 -2
  141. package/src/scripts/schemas/subagent.schema.json +2 -2
  142. package/src/scripts/session_eol_report.ts +81 -0
  143. package/src/scripts/trigger_coverage.ts +224 -3
  144. package/src/scripts/workspace_doctor.ts +464 -0
  145. package/src/scripts/worktree_cleanup_check.ts +2 -1
  146. package/src/server/schemas/settings.ts +2 -2
  147. package/dist/cli-delegate/chunk-AYKQGIBG.js +0 -1594
  148. package/src/config/budget-routing.json +0 -7
@@ -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, path17) {
121
- const ctrl = callVisitor(key, node, visitor, path17);
120
+ function visit_(key, node, visitor, path18) {
121
+ const ctrl = callVisitor(key, node, visitor, path18);
122
122
  if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
123
- replaceNode(key, path17, ctrl);
124
- return visit_(key, ctrl, visitor, path17);
123
+ replaceNode(key, path18, ctrl);
124
+ return visit_(key, ctrl, visitor, path18);
125
125
  }
126
126
  if (typeof ctrl !== "symbol") {
127
127
  if (identity.isCollection(node)) {
128
- path17 = Object.freeze(path17.concat(node));
128
+ path18 = Object.freeze(path18.concat(node));
129
129
  for (let i = 0; i < node.items.length; ++i) {
130
- const ci = visit_(i, node.items[i], visitor, path17);
130
+ const ci = visit_(i, node.items[i], visitor, path18);
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
- path17 = Object.freeze(path17.concat(node));
142
- const ck = visit_("key", node.key, visitor, path17);
141
+ path18 = Object.freeze(path18.concat(node));
142
+ const ck = visit_("key", node.key, visitor, path18);
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, path17);
147
+ const cv = visit_("value", node.value, visitor, path18);
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, path17) {
169
- const ctrl = await callVisitor(key, node, visitor, path17);
168
+ async function visitAsync_(key, node, visitor, path18) {
169
+ const ctrl = await callVisitor(key, node, visitor, path18);
170
170
  if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
171
- replaceNode(key, path17, ctrl);
172
- return visitAsync_(key, ctrl, visitor, path17);
171
+ replaceNode(key, path18, ctrl);
172
+ return visitAsync_(key, ctrl, visitor, path18);
173
173
  }
174
174
  if (typeof ctrl !== "symbol") {
175
175
  if (identity.isCollection(node)) {
176
- path17 = Object.freeze(path17.concat(node));
176
+ path18 = Object.freeze(path18.concat(node));
177
177
  for (let i = 0; i < node.items.length; ++i) {
178
- const ci = await visitAsync_(i, node.items[i], visitor, path17);
178
+ const ci = await visitAsync_(i, node.items[i], visitor, path18);
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
- path17 = Object.freeze(path17.concat(node));
190
- const ck = await visitAsync_("key", node.key, visitor, path17);
189
+ path18 = Object.freeze(path18.concat(node));
190
+ const ck = await visitAsync_("key", node.key, visitor, path18);
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, path17);
195
+ const cv = await visitAsync_("value", node.value, visitor, path18);
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, path17) {
222
+ function callVisitor(key, node, visitor, path18) {
223
223
  if (typeof visitor === "function")
224
- return visitor(key, node, path17);
224
+ return visitor(key, node, path18);
225
225
  if (identity.isMap(node))
226
- return visitor.Map?.(key, node, path17);
226
+ return visitor.Map?.(key, node, path18);
227
227
  if (identity.isSeq(node))
228
- return visitor.Seq?.(key, node, path17);
228
+ return visitor.Seq?.(key, node, path18);
229
229
  if (identity.isPair(node))
230
- return visitor.Pair?.(key, node, path17);
230
+ return visitor.Pair?.(key, node, path18);
231
231
  if (identity.isScalar(node))
232
- return visitor.Scalar?.(key, node, path17);
232
+ return visitor.Scalar?.(key, node, path18);
233
233
  if (identity.isAlias(node))
234
- return visitor.Alias?.(key, node, path17);
234
+ return visitor.Alias?.(key, node, path18);
235
235
  return void 0;
236
236
  }
237
- function replaceNode(key, path17, node) {
238
- const parent = path17[path17.length - 1];
237
+ function replaceNode(key, path18, node) {
238
+ const parent = path18[path18.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, path17, value) {
848
+ function collectionFromPath(schema, path18, value) {
849
849
  let v = value;
850
- for (let i = path17.length - 1; i >= 0; --i) {
851
- const k = path17[i];
850
+ for (let i = path18.length - 1; i >= 0; --i) {
851
+ const k = path18[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 = (path17) => path17 == null || typeof path17 === "object" && !!path17[Symbol.iterator]().next().done;
870
+ var isEmptyPath = (path18) => path18 == null || typeof path18 === "object" && !!path18[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(path17, value) {
901
- if (isEmptyPath(path17))
900
+ addIn(path18, value) {
901
+ if (isEmptyPath(path18))
902
902
  this.add(value);
903
903
  else {
904
- const [key, ...rest] = path17;
904
+ const [key, ...rest] = path18;
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(path17) {
919
- const [key, ...rest] = path17;
918
+ deleteIn(path18) {
919
+ const [key, ...rest] = path18;
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(path17, keepScalar) {
934
- const [key, ...rest] = path17;
933
+ getIn(path18, keepScalar) {
934
+ const [key, ...rest] = path18;
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(path17) {
953
- const [key, ...rest] = path17;
952
+ hasIn(path18) {
953
+ const [key, ...rest] = path18;
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(path17, value) {
964
- const [key, ...rest] = path17;
963
+ setIn(path18, value) {
964
+ const [key, ...rest] = path18;
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(path17, value) {
3479
+ addIn(path18, value) {
3480
3480
  if (assertCollection(this.contents))
3481
- this.contents.addIn(path17, value);
3481
+ this.contents.addIn(path18, 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(path17) {
3557
- if (Collection.isEmptyPath(path17)) {
3556
+ deleteIn(path18) {
3557
+ if (Collection.isEmptyPath(path18)) {
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(path17) : false;
3563
+ return assertCollection(this.contents) ? this.contents.deleteIn(path18) : 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(path17, keepScalar) {
3579
- if (Collection.isEmptyPath(path17))
3578
+ getIn(path18, keepScalar) {
3579
+ if (Collection.isEmptyPath(path18))
3580
3580
  return !keepScalar && identity.isScalar(this.contents) ? this.contents.value : this.contents;
3581
- return identity.isCollection(this.contents) ? this.contents.getIn(path17, keepScalar) : void 0;
3581
+ return identity.isCollection(this.contents) ? this.contents.getIn(path18, 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(path17) {
3593
- if (Collection.isEmptyPath(path17))
3592
+ hasIn(path18) {
3593
+ if (Collection.isEmptyPath(path18))
3594
3594
  return this.contents !== void 0;
3595
- return identity.isCollection(this.contents) ? this.contents.hasIn(path17) : false;
3595
+ return identity.isCollection(this.contents) ? this.contents.hasIn(path18) : 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(path17, value) {
3613
- if (Collection.isEmptyPath(path17)) {
3612
+ setIn(path18, value) {
3613
+ if (Collection.isEmptyPath(path18)) {
3614
3614
  this.contents = value;
3615
3615
  } else if (this.contents == null) {
3616
- this.contents = Collection.collectionFromPath(this.schema, Array.from(path17), value);
3616
+ this.contents = Collection.collectionFromPath(this.schema, Array.from(path18), value);
3617
3617
  } else if (assertCollection(this.contents)) {
3618
- this.contents.setIn(path17, value);
3618
+ this.contents.setIn(path18, 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, path17) => {
5578
+ visit.itemAtPath = (cst, path18) => {
5579
5579
  let item = cst;
5580
- for (const [field, index] of path17) {
5580
+ for (const [field, index] of path18) {
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, path17) => {
5590
- const parent = visit.itemAtPath(cst, path17.slice(0, -1));
5591
- const field = path17[path17.length - 1][0];
5589
+ visit.parentCollection = (cst, path18) => {
5590
+ const parent = visit.itemAtPath(cst, path18.slice(0, -1));
5591
+ const field = path18[path18.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(path17, item, visitor) {
5598
- let ctrl = visitor(item, path17);
5597
+ function _visit(path18, item, visitor) {
5598
+ let ctrl = visitor(item, path18);
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(path17.concat([[field, i]])), token.items[i], visitor);
5605
+ const ci = _visit(Object.freeze(path18.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, path17);
5616
+ ctrl = ctrl(item, path18);
5617
5617
  }
5618
5618
  }
5619
- return typeof ctrl === "function" ? ctrl(item, path17) : ctrl;
5619
+ return typeof ctrl === "function" ? ctrl(item, path18) : 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 fs19 = this.flowScalar(this.type);
6921
+ const fs20 = this.flowScalar(this.type);
6922
6922
  if (atNextItem || it.value) {
6923
- map.items.push({ start, key: fs19, sep: [] });
6923
+ map.items.push({ start, key: fs20, sep: [] });
6924
6924
  this.onKeyLine = true;
6925
6925
  } else if (it.sep) {
6926
- this.stack.push(fs19);
6926
+ this.stack.push(fs20);
6927
6927
  } else {
6928
- Object.assign(it, { key: fs19, sep: [] });
6928
+ Object.assign(it, { key: fs20, 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 fs19 = this.flowScalar(this.type);
7056
+ const fs20 = this.flowScalar(this.type);
7057
7057
  if (!it || it.value)
7058
- fc.items.push({ start: [], key: fs19, sep: [] });
7058
+ fc.items.push({ start: [], key: fs20, sep: [] });
7059
7059
  else if (it.sep)
7060
- this.stack.push(fs19);
7060
+ this.stack.push(fs20);
7061
7061
  else
7062
- Object.assign(it, { key: fs19, sep: [] });
7062
+ Object.assign(it, { key: fs20, sep: [] });
7063
7063
  return;
7064
7064
  }
7065
7065
  case "flow-map-end":
@@ -7370,9 +7370,9 @@ 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 fs18 from "node:fs";
7373
+ import * as fs19 from "node:fs";
7374
7374
  import * as os7 from "node:os";
7375
- import * as path16 from "node:path";
7375
+ import * as path17 from "node:path";
7376
7376
  import process3 from "node:process";
7377
7377
  import { fileURLToPath as fileURLToPath5, pathToFileURL as pathToFileURL2 } from "node:url";
7378
7378
 
@@ -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(path17) {
7876
- const target = path17 ?? lockfile_path();
7875
+ function read_lockfile(path18) {
7876
+ const target = path18 ?? lockfile_path();
7877
7877
  let text;
7878
7878
  try {
7879
7879
  text = fs2.readFileSync(target, { encoding: "utf-8" });
@@ -8948,18 +8948,18 @@ function manifest_path(project_root, env) {
8948
8948
  var _TOP_KEY_RE = /^([A-Za-z_][A-Za-z0-9_]*)\s*:\s*"?([^"\n]*?)"?\s*$/;
8949
8949
  var _LIST_DASH_RE = /^\s*-\s*(.+?)\s*$/;
8950
8950
  var _INDENT_KEY_RE = /^\s+([A-Za-z_][A-Za-z0-9_]*)\s*:\s*"?([^"\n]*?)"?\s*$/;
8951
- function read_manifest(path17) {
8951
+ function read_manifest(path18) {
8952
8952
  let text;
8953
8953
  try {
8954
- text = require_read_text(path17);
8954
+ text = require_read_text(path18);
8955
8955
  } catch {
8956
8956
  return null;
8957
8957
  }
8958
8958
  const data = _parse_manual(text);
8959
8959
  return _normalise_v2_shape(data);
8960
8960
  }
8961
- function require_read_text(path17) {
8962
- return fs8.readFileSync(path17, { encoding: "utf-8" });
8961
+ function require_read_text(path18) {
8962
+ return fs8.readFileSync(path18, { encoding: "utf-8" });
8963
8963
  }
8964
8964
  function _normalise_v2_shape(data) {
8965
8965
  if (data["tools"] === void 0 || data["tools"] === null) {
@@ -9140,9 +9140,9 @@ function stable_sort(items, key) {
9140
9140
  return a.index - b.index;
9141
9141
  }).map((entry) => entry.item);
9142
9142
  }
9143
- function write_manifest(path17, version, tools, options = {}) {
9143
+ function write_manifest(path18, version, tools, options = {}) {
9144
9144
  const rendered = _render2(version, tools, { deploy_roots: options.deploy_roots ?? null });
9145
- return write_atomic(path17, rendered);
9145
+ return write_atomic(path18, rendered);
9146
9146
  }
9147
9147
  var ScopeMismatchError = class extends Error {
9148
9148
  name_;
@@ -9357,10 +9357,209 @@ function format_drift_report(entries) {
9357
9357
  return lines.join("\n") + "\n";
9358
9358
  }
9359
9359
 
9360
- // src/scripts/_lib/claude_desktop_bundler.ts
9361
- import * as crypto2 from "node:crypto";
9360
+ // src/scripts/_lib/skill_catalogue.ts
9362
9361
  import * as fs10 from "node:fs";
9363
9362
  import * as path9 from "node:path";
9363
+ var OBSERVATION_LOG = path9.join(
9364
+ "agents",
9365
+ "evidence",
9366
+ "metrics",
9367
+ "skill-catalogue.jsonl"
9368
+ );
9369
+ function frontmatterOf(content) {
9370
+ if (!content.startsWith("---")) return "";
9371
+ const end = content.indexOf("\n---", 3);
9372
+ if (end === -1) return "";
9373
+ return content.slice(3, end);
9374
+ }
9375
+ function topLevelKeys(frontmatter) {
9376
+ const keys = [];
9377
+ for (const line of frontmatter.split("\n")) {
9378
+ const match = /^([A-Za-z_][A-Za-z0-9_-]*):/.exec(line);
9379
+ if (match) keys.push(match[1]);
9380
+ }
9381
+ return keys;
9382
+ }
9383
+ function descriptionOf(frontmatter) {
9384
+ const lines = frontmatter.split("\n");
9385
+ for (let i = 0; i < lines.length; i += 1) {
9386
+ const match = /^description:\s*(.*)$/.exec(lines[i]);
9387
+ if (!match) continue;
9388
+ const rest = match[1].trim();
9389
+ if (/^[|>][-+]?\d*$/.test(rest)) {
9390
+ const body = [];
9391
+ for (let j = i + 1; j < lines.length; j += 1) {
9392
+ const line = lines[j];
9393
+ if (line.trim() === "") {
9394
+ body.push("");
9395
+ continue;
9396
+ }
9397
+ if (!/^\s/.test(line)) break;
9398
+ body.push(line.trim());
9399
+ }
9400
+ return body.join(" ").trim();
9401
+ }
9402
+ return rest.replace(/^["']|["']$/g, "");
9403
+ }
9404
+ return "";
9405
+ }
9406
+ function readProjectedCatalogue(root) {
9407
+ const names = fs10.readdirSync(root).filter((n) => fs10.existsSync(path9.join(root, n, "SKILL.md"))).sort();
9408
+ return names.map((name, index) => {
9409
+ const content = fs10.readFileSync(path9.join(root, name, "SKILL.md"), "utf-8");
9410
+ const frontmatter = frontmatterOf(content);
9411
+ const description = descriptionOf(frontmatter);
9412
+ return {
9413
+ name,
9414
+ position: index + 1,
9415
+ hasDescription: description.length > 0,
9416
+ descriptionLength: description.length,
9417
+ description,
9418
+ frontmatterKeys: topLevelKeys(frontmatter)
9419
+ };
9420
+ });
9421
+ }
9422
+ function truncationModeOf(record) {
9423
+ return record.truncation_mode ?? "per-entry";
9424
+ }
9425
+ function markdownFilesUnder(root) {
9426
+ if (!fs10.existsSync(root)) return [];
9427
+ const out = [];
9428
+ const walk = (dir) => {
9429
+ for (const entry of fs10.readdirSync(dir, { withFileTypes: true })) {
9430
+ const full = path9.join(dir, entry.name);
9431
+ if (fs10.statSync(full).isDirectory()) walk(full);
9432
+ else if (entry.name.endsWith(".md")) out.push(full);
9433
+ }
9434
+ };
9435
+ walk(root);
9436
+ return out;
9437
+ }
9438
+ function measureCatalogueVolume(host, root) {
9439
+ const skillsRoot = path9.join(root, "skills");
9440
+ const skills = fs10.existsSync(skillsRoot) ? readProjectedCatalogue(skillsRoot) : [];
9441
+ const commandEntries = markdownFilesUnder(path9.join(root, "commands")).length;
9442
+ return {
9443
+ host,
9444
+ root,
9445
+ skillEntries: skills.length,
9446
+ commandEntries,
9447
+ artefacts: skills.length + commandEntries,
9448
+ descriptionBytes: skills.reduce((sum, e) => sum + Buffer.byteLength(e.description), 0)
9449
+ };
9450
+ }
9451
+ function _supersedes(candidate, incumbent) {
9452
+ if (candidate.observed_at !== incumbent.observed_at) {
9453
+ return candidate.observed_at > incumbent.observed_at;
9454
+ }
9455
+ return (candidate.dropped_count ?? 0) > (incumbent.dropped_count ?? 0);
9456
+ }
9457
+ function knownHostLimits(records) {
9458
+ const out = /* @__PURE__ */ new Map();
9459
+ const chosen = /* @__PURE__ */ new Map();
9460
+ for (const record of records) {
9461
+ if (truncationModeOf(record) !== "budget-strip-and-drop") continue;
9462
+ if (typeof record.dropped_count !== "number") continue;
9463
+ if (record.dropped_count <= 0) continue;
9464
+ const previous = chosen.get(record.host);
9465
+ if (previous !== void 0 && !_supersedes(record, previous)) continue;
9466
+ chosen.set(record.host, record);
9467
+ out.set(record.host, {
9468
+ host: record.host,
9469
+ droppedEntries: record.dropped_count,
9470
+ projectedVolume: record.entries_total,
9471
+ projectedSkills: record.projected_skill_count ?? null,
9472
+ observedAt: record.observed_at
9473
+ });
9474
+ }
9475
+ return out;
9476
+ }
9477
+ function catalogueLimitWarning(volume, limit) {
9478
+ if (limit === void 0) return null;
9479
+ if (limit.projectedSkills === null) return null;
9480
+ if (volume.skillEntries < limit.projectedSkills) return null;
9481
+ return `${volume.host}: deploying ${volume.skillEntries} skills. This host reported dropping ${limit.droppedEntries} entries from the model-visible list when last measured (${limit.observedAt}, at ${limit.projectedSkills} skills) \u2014 that much never reaches the model. Explain: \`agent-config exec capture_skill_catalogue --limits\``;
9482
+ }
9483
+ function migrationEligibility(host, resolvedMode, currentSkillCount, limits) {
9484
+ if (resolvedMode === "scoped") return { eligible: false, reason: "already-scoped" };
9485
+ const limit = limits.get(host);
9486
+ if (limit === void 0) return { eligible: false, reason: "no-observation-for-host" };
9487
+ if (limit.projectedSkills === null) return { eligible: false, reason: "observation-not-comparable" };
9488
+ if (limit.droppedEntries <= 0) return { eligible: false, reason: "no-truncation-observed" };
9489
+ if (currentSkillCount < limit.projectedSkills) {
9490
+ return { eligible: false, reason: "below-observed-skill-volume" };
9491
+ }
9492
+ return {
9493
+ eligible: true,
9494
+ reason: "eligible",
9495
+ droppedEntries: limit.droppedEntries,
9496
+ observedAt: limit.observedAt
9497
+ };
9498
+ }
9499
+ function migrationPromptLines(host, eligibility, settingsPath) {
9500
+ return [
9501
+ `${host}: ${eligibility.droppedEntries} catalogue entries never reach the model.`,
9502
+ `Measured on this machine (${eligibility.observedAt}). This install is on \`legacy-all\`,`,
9503
+ "which ships everything and lets the host drop what does not fit \u2014 silently.",
9504
+ "",
9505
+ "Scoping the projection to your active packs is the alternative. Nothing here",
9506
+ "changes it for you: `projection.mode` is yours to set, by hand or in the GUI.",
9507
+ "",
9508
+ ` edit ${settingsPath}`,
9509
+ " projection:",
9510
+ " mode: scoped",
9511
+ "",
9512
+ " or agent-config config (Settings \u2192 projection)",
9513
+ "",
9514
+ "Keeping `legacy-all` is a legitimate choice \u2014 this is a notification, not a gate."
9515
+ ];
9516
+ }
9517
+ function readObservationLog(logPath) {
9518
+ if (!fs10.existsSync(logPath)) return [];
9519
+ const out = [];
9520
+ for (const line of fs10.readFileSync(logPath, "utf-8").split("\n")) {
9521
+ const trimmed = line.trim();
9522
+ if (trimmed.length === 0) continue;
9523
+ try {
9524
+ out.push(JSON.parse(trimmed));
9525
+ } catch {
9526
+ continue;
9527
+ }
9528
+ }
9529
+ return out;
9530
+ }
9531
+
9532
+ // src/shared/interactiveContext.ts
9533
+ var CI_ENV_KEYS = ["CI", "GITHUB_ACTIONS", "AGENT_CONFIG_CI"];
9534
+ function _flagSet(env, key) {
9535
+ const raw = (env[key] ?? "").trim();
9536
+ return raw !== "" && raw !== "0";
9537
+ }
9538
+ function nonInteractiveReason(probe) {
9539
+ for (const key of CI_ENV_KEYS) {
9540
+ if (_flagSet(probe.env, key)) {
9541
+ return "ci";
9542
+ }
9543
+ }
9544
+ if (_flagSet(probe.env, "AGENT_CONFIG_NO_UI")) {
9545
+ return "no-ui-requested";
9546
+ }
9547
+ if (!probe.stdinTty || !probe.stdoutTty) {
9548
+ return "not-a-tty";
9549
+ }
9550
+ if (probe.headless === true) {
9551
+ return "headless";
9552
+ }
9553
+ return null;
9554
+ }
9555
+ function isInteractiveSession(probe) {
9556
+ return nonInteractiveReason(probe) === null;
9557
+ }
9558
+
9559
+ // src/scripts/_lib/claude_desktop_bundler.ts
9560
+ import * as crypto2 from "node:crypto";
9561
+ import * as fs11 from "node:fs";
9562
+ import * as path10 from "node:path";
9364
9563
 
9365
9564
  // src/scripts/_lib/zip_min.ts
9366
9565
  import * as zlib from "node:zlib";
@@ -9467,7 +9666,7 @@ function _is_excluded(rel_parts) {
9467
9666
  }
9468
9667
  function _is_dir(p) {
9469
9668
  try {
9470
- return fs10.statSync(p).isDirectory();
9669
+ return fs11.statSync(p).isDirectory();
9471
9670
  } catch {
9472
9671
  return false;
9473
9672
  }
@@ -9479,12 +9678,12 @@ function _compare_rel_parts(a, b) {
9479
9678
  }
9480
9679
  function _walk_skill_files(skill_dir) {
9481
9680
  const out = [];
9482
- const resolved = fs10.realpathSync(skill_dir);
9681
+ const resolved = fs11.realpathSync(skill_dir);
9483
9682
  const walk = (root, relRoot) => {
9484
9683
  const dirNames = [];
9485
9684
  const fileNames = [];
9486
- for (const dirent of fs10.readdirSync(root, { withFileTypes: true })) {
9487
- const full = path9.join(root, dirent.name);
9685
+ for (const dirent of fs11.readdirSync(root, { withFileTypes: true })) {
9686
+ const full = path10.join(root, dirent.name);
9488
9687
  const isDir2 = dirent.isDirectory() || dirent.isSymbolicLink() && _is_dir(full);
9489
9688
  if (isDir2) {
9490
9689
  dirNames.push(dirent.name);
@@ -9497,13 +9696,13 @@ function _walk_skill_files(skill_dir) {
9497
9696
  if (_is_excluded(rel_parts)) {
9498
9697
  continue;
9499
9698
  }
9500
- out.push([path9.join(root, fname), rel_parts]);
9699
+ out.push([path10.join(root, fname), rel_parts]);
9501
9700
  }
9502
9701
  for (const dname of dirNames) {
9503
9702
  if (_is_excluded([dname])) {
9504
9703
  continue;
9505
9704
  }
9506
- walk(path9.join(root, dname), [...relRoot, dname]);
9705
+ walk(path10.join(root, dname), [...relRoot, dname]);
9507
9706
  }
9508
9707
  };
9509
9708
  walk(resolved, []);
@@ -9516,53 +9715,53 @@ function _manifest_digest(files) {
9516
9715
  const rel = rel_parts.join("/");
9517
9716
  h.update(Buffer.from(rel, "utf-8"));
9518
9717
  h.update(Buffer.from([0]));
9519
- h.update(crypto2.createHash("sha256").update(fs10.readFileSync(abs_path)).digest());
9718
+ h.update(crypto2.createHash("sha256").update(fs11.readFileSync(abs_path)).digest());
9520
9719
  h.update(Buffer.from([0]));
9521
9720
  }
9522
9721
  return h.digest("hex");
9523
9722
  }
9524
9723
  function _atomic_write_zip(zip_path, files) {
9525
- fs10.mkdirSync(path9.dirname(zip_path), { recursive: true });
9526
- const stem = path9.basename(zip_path, path9.extname(zip_path));
9527
- const tmp_path = path9.join(
9528
- path9.dirname(zip_path),
9724
+ fs11.mkdirSync(path10.dirname(zip_path), { recursive: true });
9725
+ const stem = path10.basename(zip_path, path10.extname(zip_path));
9726
+ const tmp_path = path10.join(
9727
+ path10.dirname(zip_path),
9529
9728
  `.${stem}.${crypto2.randomBytes(6).toString("hex")}.zip.tmp`
9530
9729
  );
9531
9730
  try {
9532
9731
  const entries = files.map(([abs_path, rel_parts]) => ({
9533
9732
  name: rel_parts.join("/"),
9534
- data: fs10.readFileSync(abs_path)
9733
+ data: fs11.readFileSync(abs_path)
9535
9734
  }));
9536
- fs10.writeFileSync(tmp_path, zip_write_sync(entries));
9537
- fs10.renameSync(tmp_path, zip_path);
9735
+ fs11.writeFileSync(tmp_path, zip_write_sync(entries));
9736
+ fs11.renameSync(tmp_path, zip_path);
9538
9737
  } finally {
9539
- if (fs10.existsSync(tmp_path)) {
9540
- fs10.unlinkSync(tmp_path);
9738
+ if (fs11.existsSync(tmp_path)) {
9739
+ fs11.unlinkSync(tmp_path);
9541
9740
  }
9542
9741
  }
9543
9742
  }
9544
9743
  function _write_if_changed(dest_dir, slug, files, force, written) {
9545
9744
  const digest = _manifest_digest(files);
9546
- const zip_path = path9.join(dest_dir, `${slug}.zip`);
9547
- const digest_path = path9.join(dest_dir, `${slug}.sha256`);
9548
- const recorded = fs10.existsSync(digest_path) ? fs10.readFileSync(digest_path, "utf-8").trim() : "";
9549
- if (!force && recorded === digest && fs10.existsSync(zip_path)) {
9745
+ const zip_path = path10.join(dest_dir, `${slug}.zip`);
9746
+ const digest_path = path10.join(dest_dir, `${slug}.sha256`);
9747
+ const recorded = fs11.existsSync(digest_path) ? fs11.readFileSync(digest_path, "utf-8").trim() : "";
9748
+ if (!force && recorded === digest && fs11.existsSync(zip_path)) {
9550
9749
  return;
9551
9750
  }
9552
9751
  _atomic_write_zip(zip_path, files);
9553
- fs10.writeFileSync(digest_path, digest + "\n", "utf-8");
9752
+ fs11.writeFileSync(digest_path, digest + "\n", "utf-8");
9554
9753
  written.push(zip_path);
9555
9754
  }
9556
9755
  function build_skill_bundles(package_root, dest_dir, force = false, curation = null) {
9557
- const skills_root = path9.join(package_root, "dist/agent-src", "skills");
9756
+ const skills_root = path10.join(package_root, "dist/agent-src", "skills");
9558
9757
  if (!_is_dir(skills_root)) {
9559
9758
  return [];
9560
9759
  }
9561
- fs10.mkdirSync(dest_dir, { recursive: true });
9760
+ fs11.mkdirSync(dest_dir, { recursive: true });
9562
9761
  const written = [];
9563
- for (const name of fs10.readdirSync(skills_root).sort()) {
9564
- const entry = path9.join(skills_root, name);
9565
- const isSymlink2 = fs10.lstatSync(entry).isSymbolicLink();
9762
+ for (const name of fs11.readdirSync(skills_root).sort()) {
9763
+ const entry = path10.join(skills_root, name);
9764
+ const isSymlink2 = fs11.lstatSync(entry).isSymbolicLink();
9566
9765
  if (!(_is_dir(entry) || isSymlink2)) {
9567
9766
  continue;
9568
9767
  }
@@ -9570,8 +9769,8 @@ function build_skill_bundles(package_root, dest_dir, force = false, curation = n
9570
9769
  if (curation !== null && !curation.includes(skill_name)) {
9571
9770
  continue;
9572
9771
  }
9573
- const skill_md = path9.join(entry, "SKILL.md");
9574
- if (!fs10.existsSync(skill_md)) {
9772
+ const skill_md = path10.join(entry, "SKILL.md");
9773
+ if (!fs11.existsSync(skill_md)) {
9575
9774
  continue;
9576
9775
  }
9577
9776
  const files = _walk_skill_files(entry);
@@ -9583,15 +9782,15 @@ function build_skill_bundles(package_root, dest_dir, force = false, curation = n
9583
9782
  return written;
9584
9783
  }
9585
9784
  function _command_slug(source_file, commands_root) {
9586
- const rel = path9.relative(commands_root, source_file);
9587
- const noExt = rel.slice(0, rel.length - path9.extname(rel).length);
9588
- return noExt.split(path9.sep).join("-");
9785
+ const rel = path10.relative(commands_root, source_file);
9786
+ const noExt = rel.slice(0, rel.length - path10.extname(rel).length);
9787
+ return noExt.split(path10.sep).join("-");
9589
9788
  }
9590
9789
  function _iter_command_files(commands_root) {
9591
9790
  const found = [];
9592
9791
  const walk = (dir) => {
9593
- for (const dirent of fs10.readdirSync(dir, { withFileTypes: true })) {
9594
- const full = path9.join(dir, dirent.name);
9792
+ for (const dirent of fs11.readdirSync(dir, { withFileTypes: true })) {
9793
+ const full = path10.join(dir, dirent.name);
9595
9794
  if (dirent.isDirectory() || dirent.isSymbolicLink() && _is_dir(full)) {
9596
9795
  walk(full);
9597
9796
  } else if (dirent.name.endsWith(".md")) {
@@ -9601,21 +9800,21 @@ function _iter_command_files(commands_root) {
9601
9800
  };
9602
9801
  walk(commands_root);
9603
9802
  found.sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
9604
- return found.filter((source_file) => path9.basename(source_file) !== "AGENTS.md");
9803
+ return found.filter((source_file) => path10.basename(source_file) !== "AGENTS.md");
9605
9804
  }
9606
9805
  function build_command_bundles(package_root, dest_dir, force = false, curation = null) {
9607
- const commands_root = path9.join(package_root, "dist/agent-src", "commands");
9806
+ const commands_root = path10.join(package_root, "dist/agent-src", "commands");
9608
9807
  if (!_is_dir(commands_root)) {
9609
9808
  return [];
9610
9809
  }
9611
- const skills_root = path9.join(package_root, "dist/agent-src", "skills");
9810
+ const skills_root = path10.join(package_root, "dist/agent-src", "skills");
9612
9811
  let skill_names = /* @__PURE__ */ new Set();
9613
9812
  if (_is_dir(skills_root)) {
9614
9813
  skill_names = new Set(
9615
- fs10.readdirSync(skills_root).filter((name) => _is_dir(path9.join(skills_root, name)))
9814
+ fs11.readdirSync(skills_root).filter((name) => _is_dir(path10.join(skills_root, name)))
9616
9815
  );
9617
9816
  }
9618
- fs10.mkdirSync(dest_dir, { recursive: true });
9817
+ fs11.mkdirSync(dest_dir, { recursive: true });
9619
9818
  const written = [];
9620
9819
  for (const source_file of _iter_command_files(commands_root)) {
9621
9820
  const slug = _command_slug(source_file, commands_root);
@@ -9625,7 +9824,7 @@ function build_command_bundles(package_root, dest_dir, force = false, curation =
9625
9824
  if (curation !== null && !curation.includes(slug)) {
9626
9825
  continue;
9627
9826
  }
9628
- const files = [[fs10.realpathSync(source_file), ["SKILL.md"]]];
9827
+ const files = [[fs11.realpathSync(source_file), ["SKILL.md"]]];
9629
9828
  _write_if_changed(dest_dir, slug, files, force, written);
9630
9829
  }
9631
9830
  return written;
@@ -9633,8 +9832,8 @@ function build_command_bundles(package_root, dest_dir, force = false, curation =
9633
9832
 
9634
9833
  // src/scripts/_lib/claude_settings_hooks.ts
9635
9834
  var YAML = __toESM(require_dist(), 1);
9636
- import * as fs11 from "node:fs";
9637
- import * as path10 from "node:path";
9835
+ import * as fs12 from "node:fs";
9836
+ import * as path11 from "node:path";
9638
9837
 
9639
9838
  // src/install/atomic.ts
9640
9839
  import {
@@ -9642,17 +9841,17 @@ import {
9642
9841
  fsyncSync,
9643
9842
  mkdirSync as mkdirSync5,
9644
9843
  openSync as openSync3,
9645
- readFileSync as readFileSync9,
9844
+ readFileSync as readFileSync10,
9646
9845
  renameSync as renameSync5,
9647
9846
  unlinkSync as unlinkSync4,
9648
9847
  writeSync
9649
9848
  } from "node:fs";
9650
- import { dirname as dirname4, join as join10 } from "node:path";
9849
+ import { dirname as dirname4, join as join11 } from "node:path";
9651
9850
  function atomicWriteFile(target, data, options = {}) {
9652
9851
  const mode = options.mode ?? 420;
9653
9852
  const parent = dirname4(target);
9654
9853
  mkdirSync5(parent, { recursive: true });
9655
- const tmp = join10(parent, `.tmp.${process.pid}.${randSuffix()}`);
9854
+ const tmp = join11(parent, `.tmp.${process.pid}.${randSuffix()}`);
9656
9855
  let fd = null;
9657
9856
  try {
9658
9857
  fd = openSync3(tmp, "w", mode);
@@ -9702,7 +9901,7 @@ var SettingsLockError = class extends Error {
9702
9901
  }
9703
9902
  };
9704
9903
  function build_claude_hook_matrix(manifest_path2) {
9705
- const raw = fs11.readFileSync(manifest_path2, "utf8");
9904
+ const raw = fs12.readFileSync(manifest_path2, "utf8");
9706
9905
  const manifest = _yaml_parse(raw) ?? {};
9707
9906
  const hook_spec = manifest["schema_version"] ?? 1;
9708
9907
  const platforms = manifest["platforms"] ?? {};
@@ -9732,8 +9931,8 @@ function _is_managed_group(group) {
9732
9931
  );
9733
9932
  }
9734
9933
  function _read_settings(settings_path) {
9735
- if (!fs11.existsSync(settings_path)) return {};
9736
- const raw = fs11.readFileSync(settings_path, "utf8");
9934
+ if (!fs12.existsSync(settings_path)) return {};
9935
+ const raw = fs12.readFileSync(settings_path, "utf8");
9737
9936
  if (raw.trim() === "") return {};
9738
9937
  let parsed;
9739
9938
  try {
@@ -9748,18 +9947,18 @@ function _read_settings(settings_path) {
9748
9947
  }
9749
9948
  function _with_lock(settings_path, fn) {
9750
9949
  const lockPath = settings_path + ".agent-config.lock";
9751
- fs11.mkdirSync(path10.dirname(lockPath), { recursive: true });
9950
+ fs12.mkdirSync(path11.dirname(lockPath), { recursive: true });
9752
9951
  let fd;
9753
9952
  try {
9754
- fd = fs11.openSync(lockPath, "wx");
9953
+ fd = fs12.openSync(lockPath, "wx");
9755
9954
  } catch {
9756
9955
  throw new SettingsLockError(lockPath);
9757
9956
  }
9758
9957
  try {
9759
9958
  return fn();
9760
9959
  } finally {
9761
- fs11.closeSync(fd);
9762
- fs11.rmSync(lockPath, { force: true });
9960
+ fs12.closeSync(fd);
9961
+ fs12.rmSync(lockPath, { force: true });
9763
9962
  }
9764
9963
  }
9765
9964
  function ensure_managed_hooks(settings_path, matrix) {
@@ -9790,9 +9989,9 @@ function ensure_managed_hooks(settings_path, matrix) {
9790
9989
 
9791
9990
  // src/scripts/_lib/agent_settings.ts
9792
9991
  import { createRequire as createRequire2 } from "node:module";
9793
- import * as fs12 from "node:fs";
9992
+ import * as fs13 from "node:fs";
9794
9993
  import * as os6 from "node:os";
9795
- import * as path11 from "node:path";
9994
+ import * as path12 from "node:path";
9796
9995
  import { fileURLToPath as fileURLToPath2 } from "node:url";
9797
9996
 
9798
9997
  // src/shared/settingsCarveOut.ts
@@ -9890,10 +10089,10 @@ var DEFAULT_PROJECT_FILE = ".agent-settings.yml";
9890
10089
  var LOCAL_PROJECT_FILE = ".agent-settings.local.yml";
9891
10090
  var LOCAL_PROJECT_SUBDIR = ["agents", "settings"];
9892
10091
  function _local_settings_path(project_root) {
9893
- return path11.join(project_root, ...LOCAL_PROJECT_SUBDIR, LOCAL_PROJECT_FILE);
10092
+ return path12.join(project_root, ...LOCAL_PROJECT_SUBDIR, LOCAL_PROJECT_FILE);
9894
10093
  }
9895
10094
  function _canonical_settings_path(project_root) {
9896
- return path11.join(project_root, ...LOCAL_PROJECT_SUBDIR, DEFAULT_PROJECT_FILE);
10095
+ return path12.join(project_root, ...LOCAL_PROJECT_SUBDIR, DEFAULT_PROJECT_FILE);
9897
10096
  }
9898
10097
  var USER_GLOBAL_FILENAME = "agent-settings.yml";
9899
10098
  function DEFAULT_USER_GLOBAL_FILE() {
@@ -9947,10 +10146,10 @@ var MERGEABLE_KEYS = [
9947
10146
  "knowledge.global_sharing.freshness.hypothesis_after_days",
9948
10147
  "knowledge.global_sharing.freshness.stale_after_days"
9949
10148
  ];
9950
- var TEMPLATE_RELATIVE = path11.join("src", "config", "agent-settings.template.yml");
9951
- var _PACKAGE_ROOT = path11.resolve(path11.dirname(fileURLToPath2(import.meta.url)), "..", "..", "..");
10149
+ var TEMPLATE_RELATIVE = path12.join("src", "config", "agent-settings.template.yml");
10150
+ var _PACKAGE_ROOT = path12.resolve(path12.dirname(fileURLToPath2(import.meta.url)), "..", "..", "..");
9952
10151
  function default_template_path() {
9953
- return path11.join(_PACKAGE_ROOT, TEMPLATE_RELATIVE);
10152
+ return path12.join(_PACKAGE_ROOT, TEMPLATE_RELATIVE);
9954
10153
  }
9955
10154
  function _is_placeholder(value) {
9956
10155
  return typeof value === "string" && /^__[A-Z0-9_]+__$/.test(value);
@@ -10001,8 +10200,8 @@ var _AGENTS_DIR_MARKERS = [
10001
10200
  var _LEGACY_ANCHOR_ENV = "AGENT_CONFIG_LEGACY_ANCHOR";
10002
10201
  function _exists(p) {
10003
10202
  try {
10004
- fs12.lstatSync(p);
10005
- fs12.statSync(p);
10203
+ fs13.lstatSync(p);
10204
+ fs13.statSync(p);
10006
10205
  return true;
10007
10206
  } catch {
10008
10207
  return false;
@@ -10010,22 +10209,22 @@ function _exists(p) {
10010
10209
  }
10011
10210
  function _is_dir2(p) {
10012
10211
  try {
10013
- return fs12.statSync(p).isDirectory();
10212
+ return fs13.statSync(p).isDirectory();
10014
10213
  } catch {
10015
10214
  return false;
10016
10215
  }
10017
10216
  }
10018
10217
  function _is_file(p) {
10019
10218
  try {
10020
- return fs12.statSync(p).isFile();
10219
+ return fs13.statSync(p).isFile();
10021
10220
  } catch {
10022
10221
  return false;
10023
10222
  }
10024
10223
  }
10025
10224
  function _resolve(p) {
10026
- const absolute = path11.resolve(p);
10225
+ const absolute = path12.resolve(p);
10027
10226
  try {
10028
- return fs12.realpathSync(absolute);
10227
+ return fs13.realpathSync(absolute);
10029
10228
  } catch {
10030
10229
  return absolute;
10031
10230
  }
@@ -10035,7 +10234,7 @@ function _ancestor_chain(start) {
10035
10234
  let cursor = start;
10036
10235
  for (; ; ) {
10037
10236
  chain.push(cursor);
10038
- const parent = path11.dirname(cursor);
10237
+ const parent = path12.dirname(cursor);
10039
10238
  if (parent === cursor) {
10040
10239
  break;
10041
10240
  }
@@ -10044,15 +10243,15 @@ function _ancestor_chain(start) {
10044
10243
  return chain;
10045
10244
  }
10046
10245
  function _boundary_anchor_at(dir) {
10047
- const agents_dir = path11.join(dir, "agents");
10246
+ const agents_dir = path12.join(dir, "agents");
10048
10247
  if (_is_dir2(agents_dir)) {
10049
10248
  for (const marker of _AGENTS_DIR_MARKERS) {
10050
- if (_exists(path11.join(agents_dir, marker))) {
10249
+ if (_exists(path12.join(agents_dir, marker))) {
10051
10250
  return ANCHOR_AGENTS_DIR;
10052
10251
  }
10053
10252
  }
10054
10253
  }
10055
- if (_exists(path11.join(dir, ".git"))) {
10254
+ if (_exists(path12.join(dir, ".git"))) {
10056
10255
  return ANCHOR_GIT;
10057
10256
  }
10058
10257
  return null;
@@ -10063,7 +10262,7 @@ function find_project_root_with_anchor(start) {
10063
10262
  const chain = _ancestor_chain(current);
10064
10263
  if (legacy) {
10065
10264
  for (const candidate of chain) {
10066
- if (_exists(path11.join(candidate, ".git"))) {
10265
+ if (_exists(path12.join(candidate, ".git"))) {
10067
10266
  return [candidate, ANCHOR_GIT];
10068
10267
  }
10069
10268
  }
@@ -10077,7 +10276,7 @@ function find_project_root_with_anchor(start) {
10077
10276
  }
10078
10277
  let outermost = null;
10079
10278
  for (const candidate of chain) {
10080
- if (_exists(path11.join(candidate, DEFAULT_PROJECT_FILE))) {
10279
+ if (_exists(path12.join(candidate, DEFAULT_PROJECT_FILE))) {
10081
10280
  outermost = candidate;
10082
10281
  }
10083
10282
  }
@@ -10121,7 +10320,7 @@ function _expanduser(p) {
10121
10320
  return os6.homedir();
10122
10321
  }
10123
10322
  if (p.startsWith("~/") || process.platform === "win32" && p.startsWith("~\\")) {
10124
- return path11.join(os6.homedir(), p.slice(2));
10323
+ return path12.join(os6.homedir(), p.slice(2));
10125
10324
  }
10126
10325
  return p;
10127
10326
  }
@@ -10150,13 +10349,13 @@ function resolve_project_root(arg, options = {}) {
10150
10349
  function _resolve_cascade_paths(cwd, project_path) {
10151
10350
  if (cwd === null) {
10152
10351
  const legacy = project_path ? project_path : DEFAULT_PROJECT_FILE;
10153
- const parent = path11.dirname(legacy);
10352
+ const parent = path12.dirname(legacy);
10154
10353
  return [legacy, _canonical_settings_path(parent), _local_settings_path(parent)];
10155
10354
  }
10156
10355
  const root = find_project_root(cwd);
10157
10356
  if (root === null) {
10158
10357
  const legacy = project_path ? project_path : DEFAULT_PROJECT_FILE;
10159
- const parent = path11.dirname(legacy);
10358
+ const parent = path12.dirname(legacy);
10160
10359
  return [legacy, _canonical_settings_path(parent), _local_settings_path(parent)];
10161
10360
  }
10162
10361
  const cwd_resolved = _resolve(cwd);
@@ -10167,7 +10366,7 @@ function _resolve_cascade_paths(cwd, project_path) {
10167
10366
  if (cursor === root) {
10168
10367
  break;
10169
10368
  }
10170
- const parent = path11.dirname(cursor);
10369
+ const parent = path12.dirname(cursor);
10171
10370
  if (parent === cursor) {
10172
10371
  break;
10173
10372
  }
@@ -10175,7 +10374,7 @@ function _resolve_cascade_paths(cwd, project_path) {
10175
10374
  }
10176
10375
  chain.reverse();
10177
10376
  return [
10178
- ...chain.map((d) => path11.join(d, DEFAULT_PROJECT_FILE)),
10377
+ ...chain.map((d) => path12.join(d, DEFAULT_PROJECT_FILE)),
10179
10378
  _canonical_settings_path(root),
10180
10379
  _local_settings_path(root)
10181
10380
  ];
@@ -10262,7 +10461,7 @@ function _read_yaml(p) {
10262
10461
  }
10263
10462
  let data;
10264
10463
  try {
10265
- const text = fs12.readFileSync(p, "utf-8");
10464
+ const text = fs13.readFileSync(p, "utf-8");
10266
10465
  data = YAML3.parse(text, { version: "1.1" });
10267
10466
  if (data === null || data === void 0) {
10268
10467
  data = {};
@@ -10362,11 +10561,11 @@ function _is_plain_dict(value) {
10362
10561
  }
10363
10562
 
10364
10563
  // src/install/rule_scope.ts
10365
- import * as path12 from "node:path";
10564
+ import * as path13 from "node:path";
10366
10565
 
10367
10566
  // src/install/ruleInScope.ts
10368
10567
  var YAML2 = __toESM(require_dist(), 1);
10369
- import * as fs13 from "node:fs";
10568
+ import * as fs14 from "node:fs";
10370
10569
  function parseYaml2(text) {
10371
10570
  try {
10372
10571
  const data = YAML2.parse(text, { version: "1.1" });
@@ -10404,7 +10603,7 @@ function rule_in_scope(source_path, scope, pack_scope = null, role_scope = null)
10404
10603
  if (scope === null && pack_scope === null && role_scope === null) {
10405
10604
  return true;
10406
10605
  }
10407
- const [meta] = parseFrontmatter(fs13.readFileSync(source_path, "utf-8"));
10606
+ const [meta] = parseFrontmatter(fs14.readFileSync(source_path, "utf-8"));
10408
10607
  if (meta["type"] === "always" || meta["alwaysApply"] === true) {
10409
10608
  return true;
10410
10609
  }
@@ -10455,7 +10654,7 @@ function ruleFileArrives(sourcePath, scope) {
10455
10654
  if (!sourcePath.endsWith(".md")) {
10456
10655
  return true;
10457
10656
  }
10458
- const basename6 = path12.basename(sourcePath);
10657
+ const basename6 = path13.basename(sourcePath);
10459
10658
  if (COMPAT_ALWAYS_EXCLUDED.includes(basename6)) {
10460
10659
  return false;
10461
10660
  }
@@ -11013,8 +11212,8 @@ function getErrorMap() {
11013
11212
 
11014
11213
  // node_modules/zod/v3/helpers/parseUtil.js
11015
11214
  var makeIssue = (params) => {
11016
- const { data, path: path17, errorMaps, issueData } = params;
11017
- const fullPath = [...path17, ...issueData.path || []];
11215
+ const { data, path: path18, errorMaps, issueData } = params;
11216
+ const fullPath = [...path18, ...issueData.path || []];
11018
11217
  const fullIssue = {
11019
11218
  ...issueData,
11020
11219
  path: fullPath
@@ -11130,11 +11329,11 @@ var errorUtil;
11130
11329
 
11131
11330
  // node_modules/zod/v3/types.js
11132
11331
  var ParseInputLazyPath = class {
11133
- constructor(parent, value, path17, key) {
11332
+ constructor(parent, value, path18, key) {
11134
11333
  this._cachedPath = [];
11135
11334
  this.parent = parent;
11136
11335
  this.data = value;
11137
- this._path = path17;
11336
+ this._path = path18;
11138
11337
  this._key = key;
11139
11338
  }
11140
11339
  get path() {
@@ -14643,13 +14842,13 @@ var settingsSchema = external_exports.object({
14643
14842
  ),
14644
14843
  per_tier: external_exports.object({
14645
14844
  cheap: external_exports.number().min(0).nullable().default(null).describe(
14646
- "USD ceiling for the cheap model tier under budget-aware delegation (docs/contracts/budget-routing.md). null = no separate tier cap; global ceilings still apply."
14845
+ "USD ceiling for the cheap model tier. Budget-aware delegation was ARCHIVED 2026-08-16 (docs/contracts/budget-routing.md), so no code routes on this today; the cap is still summed and reported by `budget.mjs tier`. null = no separate tier cap; global ceilings still apply."
14647
14846
  ),
14648
14847
  medium: external_exports.number().min(0).nullable().default(null).describe(
14649
14848
  "USD ceiling for the medium model tier. null = no separate tier cap."
14650
14849
  ),
14651
14850
  strong: external_exports.number().min(0).nullable().default(null).describe(
14652
- "USD ceiling for the strong model tier. null = no separate tier cap \u2014 with cheap exhausted and strong funded, budget routing uses the strong tier rather than blocking work."
14851
+ "USD ceiling for the strong model tier. null = no separate tier cap. The never-block-to-save-money relation this used to describe went with the archived budget-routing layer (docs/contracts/budget-routing.md); nothing routes between tiers today."
14653
14852
  )
14654
14853
  }).default({ cheap: null, medium: null, strong: null })
14655
14854
  }),
@@ -16404,8 +16603,8 @@ var zodToJsonSchema = (schema, options) => {
16404
16603
  };
16405
16604
 
16406
16605
  // src/scripts/_lib/module_detection.ts
16407
- import * as fs14 from "node:fs";
16408
- import * as path13 from "node:path";
16606
+ import * as fs15 from "node:fs";
16607
+ import * as path14 from "node:path";
16409
16608
  var _SKIP_DIRS = /* @__PURE__ */ new Set([".module-template", ".example"]);
16410
16609
  var _RULES = [
16411
16610
  ["app/Modules", "laravel-hmvc", "App\\Modules\\{ModuleName}"],
@@ -16419,14 +16618,14 @@ var _RULES = [
16419
16618
  ];
16420
16619
  function _isDir(p) {
16421
16620
  try {
16422
- return fs14.statSync(p).isDirectory();
16621
+ return fs15.statSync(p).isDirectory();
16423
16622
  } catch {
16424
16623
  return false;
16425
16624
  }
16426
16625
  }
16427
16626
  function _isFile(p) {
16428
16627
  try {
16429
- return fs14.statSync(p).isFile();
16628
+ return fs15.statSync(p).isFile();
16430
16629
  } catch {
16431
16630
  return false;
16432
16631
  }
@@ -16440,13 +16639,13 @@ function _isUpperChar(ch) {
16440
16639
  function _list_module_subdirs(root) {
16441
16640
  let entries;
16442
16641
  try {
16443
- entries = fs14.readdirSync(root).sort();
16642
+ entries = fs15.readdirSync(root).sort();
16444
16643
  } catch {
16445
16644
  return [];
16446
16645
  }
16447
16646
  const out = [];
16448
16647
  for (const name of entries) {
16449
- if (!_isDir(path13.join(root, name))) {
16648
+ if (!_isDir(path14.join(root, name))) {
16450
16649
  continue;
16451
16650
  }
16452
16651
  if (name.startsWith(".")) {
@@ -16468,11 +16667,11 @@ function _score_confidence(stack, root, subdirs) {
16468
16667
  return capitalized.length > 0 ? "high" : "medium";
16469
16668
  }
16470
16669
  if (stack === "node-monorepo") {
16471
- const withPkgJson = subdirs.filter((name) => _isFile(path13.join(root, name, "package.json")));
16670
+ const withPkgJson = subdirs.filter((name) => _isFile(path14.join(root, name, "package.json")));
16472
16671
  return withPkgJson.length > 0 ? "high" : "medium";
16473
16672
  }
16474
16673
  if (stack === "python-src") {
16475
- const withInit = subdirs.filter((name) => _isFile(path13.join(root, name, "__init__.py")));
16674
+ const withInit = subdirs.filter((name) => _isFile(path14.join(root, name, "__init__.py")));
16476
16675
  return withInit.length > 0 ? "high" : "medium";
16477
16676
  }
16478
16677
  if (stack === "go-internal") {
@@ -16484,7 +16683,7 @@ function detect_module_roots(project_root) {
16484
16683
  const high = [];
16485
16684
  const medium = [];
16486
16685
  for (const [rel_path, stack, namespace_template] of _RULES) {
16487
- const abs_path = path13.join(project_root, rel_path);
16686
+ const abs_path = path14.join(project_root, rel_path);
16488
16687
  if (!_isDir(abs_path)) {
16489
16688
  continue;
16490
16689
  }
@@ -16506,16 +16705,17 @@ function detect_module_roots(project_root) {
16506
16705
  }
16507
16706
 
16508
16707
  // src/scripts/_lib/model_tier.ts
16509
- import fs15 from "node:fs";
16708
+ import fs16 from "node:fs";
16510
16709
  var TIER_TO_CLAUDE_MODEL = {
16710
+ frontier: "fable",
16511
16711
  high: "opus",
16512
16712
  medium: "sonnet",
16513
16713
  lite: "haiku"
16514
16714
  };
16515
16715
  var MODEL_TIER_RE = /^model_tier:\s*"?([a-z]+)"?\s*$/m;
16516
16716
  function read_model_tier(skill_md) {
16517
- if (!fs15.existsSync(skill_md)) return null;
16518
- const text = fs15.readFileSync(skill_md).toString("utf-8");
16717
+ if (!fs16.existsSync(skill_md)) return null;
16718
+ const text = fs16.readFileSync(skill_md).toString("utf-8");
16519
16719
  if (!text.startsWith("---\n")) return null;
16520
16720
  const end = text.indexOf("\n---\n", 4);
16521
16721
  if (end === -1) return null;
@@ -16532,39 +16732,39 @@ function render_native_model_md(text, tier) {
16532
16732
 
16533
16733
  // src/scripts/_cli/cmd_migrate.ts
16534
16734
  import { spawnSync } from "node:child_process";
16535
- import * as fs17 from "node:fs";
16536
- import * as path15 from "node:path";
16735
+ import * as fs18 from "node:fs";
16736
+ import * as path16 from "node:path";
16537
16737
  import process2 from "node:process";
16538
16738
  import { fileURLToPath as fileURLToPath4, pathToFileURL } from "node:url";
16539
16739
 
16540
16740
  // src/scripts/_lib/package_root.ts
16541
- import * as fs16 from "node:fs";
16542
- import * as path14 from "node:path";
16741
+ import * as fs17 from "node:fs";
16742
+ import * as path15 from "node:path";
16543
16743
  import { fileURLToPath as fileURLToPath3 } from "node:url";
16544
16744
  var PACKAGE_NAME = "@event4u/agent-config";
16545
16745
  var MAX_ASCENT = 16;
16546
16746
  function resolvePackageRoot(fromUrlOrPath, legacyHops = 3) {
16547
16747
  const start = fromUrlOrPath.startsWith("file:") ? fileURLToPath3(fromUrlOrPath) : fromUrlOrPath;
16548
- const startDir = path14.dirname(start);
16748
+ const startDir = path15.dirname(start);
16549
16749
  let dir = startDir;
16550
16750
  for (let i = 0; i < MAX_ASCENT; i++) {
16551
- const manifest = path14.join(dir, "package.json");
16552
- if (fs16.existsSync(manifest)) {
16751
+ const manifest = path15.join(dir, "package.json");
16752
+ if (fs17.existsSync(manifest)) {
16553
16753
  try {
16554
- const parsed = JSON.parse(fs16.readFileSync(manifest, "utf8"));
16754
+ const parsed = JSON.parse(fs17.readFileSync(manifest, "utf8"));
16555
16755
  if (parsed.name === PACKAGE_NAME) {
16556
16756
  return dir;
16557
16757
  }
16558
16758
  } catch {
16559
16759
  }
16560
16760
  }
16561
- const parent = path14.dirname(dir);
16761
+ const parent = path15.dirname(dir);
16562
16762
  if (parent === dir) {
16563
16763
  break;
16564
16764
  }
16565
16765
  dir = parent;
16566
16766
  }
16567
- return path14.resolve(startDir, ...Array.from({ length: legacyHops }, () => ".."));
16767
+ return path15.resolve(startDir, ...Array.from({ length: legacyHops }, () => ".."));
16568
16768
  }
16569
16769
 
16570
16770
  // src/scripts/_cli/cmd_migrate.ts
@@ -16585,7 +16785,7 @@ var LEGACY_SETTINGS_FILES = [".agent-settings.yml", ".agent-user.yml"];
16585
16785
  var LEGACY_STATE_FILENAME = ".implement-ticket-state.json";
16586
16786
  var LEGACY_STATE_V1_FILENAME = ".work-state.json";
16587
16787
  var LEGACY_AGENT_CONFIG_SHELL = "agent-config";
16588
- var _HERE_DIR = path15.dirname(fileURLToPath4(import.meta.url));
16788
+ var _HERE_DIR = path16.dirname(fileURLToPath4(import.meta.url));
16589
16789
  var ArgparseExit = class extends Error {
16590
16790
  code;
16591
16791
  constructor(code) {
@@ -16684,38 +16884,38 @@ function _jsonDumpsIndentAscii(value, indent) {
16684
16884
  }
16685
16885
  function _isFile2(p) {
16686
16886
  try {
16687
- return fs17.statSync(p).isFile();
16887
+ return fs18.statSync(p).isFile();
16688
16888
  } catch {
16689
16889
  return false;
16690
16890
  }
16691
16891
  }
16692
16892
  function _isDir2(p) {
16693
16893
  try {
16694
- return fs17.statSync(p).isDirectory();
16894
+ return fs18.statSync(p).isDirectory();
16695
16895
  } catch {
16696
16896
  return false;
16697
16897
  }
16698
16898
  }
16699
16899
  function _isSymlink(p) {
16700
16900
  try {
16701
- return fs17.lstatSync(p).isSymbolicLink();
16901
+ return fs18.lstatSync(p).isSymbolicLink();
16702
16902
  } catch {
16703
16903
  return false;
16704
16904
  }
16705
16905
  }
16706
16906
  function _exists2(p) {
16707
16907
  try {
16708
- fs17.lstatSync(p);
16908
+ fs18.lstatSync(p);
16709
16909
  return true;
16710
16910
  } catch {
16711
16911
  return false;
16712
16912
  }
16713
16913
  }
16714
16914
  function _readText(p) {
16715
- return fs17.readFileSync(p, { encoding: "utf-8" });
16915
+ return fs18.readFileSync(p, { encoding: "utf-8" });
16716
16916
  }
16717
16917
  function _writeText(p, text) {
16718
- fs17.writeFileSync(p, text, { encoding: "utf-8" });
16918
+ fs18.writeFileSync(p, text, { encoding: "utf-8" });
16719
16919
  }
16720
16920
  function _jsonLoadFile(p) {
16721
16921
  return JSON.parse(_readText(p));
@@ -16771,7 +16971,7 @@ function _classify_symlink(link) {
16771
16971
  }
16772
16972
  let target;
16773
16973
  try {
16774
- target = fs17.readlinkSync(link);
16974
+ target = fs18.readlinkSync(link);
16775
16975
  } catch {
16776
16976
  return null;
16777
16977
  }
@@ -16782,16 +16982,16 @@ function _classify_symlink(link) {
16782
16982
  return "user";
16783
16983
  }
16784
16984
  function _detect_legacy_state(project) {
16785
- return _isFile2(path15.join(project, LEGACY_STATE_FILENAME));
16985
+ return _isFile2(path16.join(project, LEGACY_STATE_FILENAME));
16786
16986
  }
16787
16987
  function _detect_legacy_settings(project) {
16788
16988
  const found = [];
16789
16989
  for (const name of LEGACY_SETTINGS_FILES) {
16790
- const flat = path15.join(project, name);
16990
+ const flat = path16.join(project, name);
16791
16991
  if (_isFile2(flat)) {
16792
16992
  found.push(flat);
16793
16993
  }
16794
- const typed = path15.join(project, "settings", name);
16994
+ const typed = path16.join(project, "settings", name);
16795
16995
  if (_isFile2(typed)) {
16796
16996
  found.push(typed);
16797
16997
  }
@@ -16799,25 +16999,25 @@ function _detect_legacy_settings(project) {
16799
16999
  return found;
16800
17000
  }
16801
17001
  function _detect_empty_shell(project) {
16802
- const shell = path15.join(project, LEGACY_AGENT_CONFIG_SHELL);
17002
+ const shell = path16.join(project, LEGACY_AGENT_CONFIG_SHELL);
16803
17003
  if (!_isDir2(shell) || _isSymlink(shell)) {
16804
17004
  return false;
16805
17005
  }
16806
17006
  try {
16807
- return fs17.readdirSync(shell).length === 0;
17007
+ return fs18.readdirSync(shell).length === 0;
16808
17008
  } catch {
16809
17009
  return false;
16810
17010
  }
16811
17011
  }
16812
17012
  function _detect_already_migrated(project) {
16813
- if (_detect_npm(path15.join(project, "package.json"))) {
17013
+ if (_detect_npm(path16.join(project, "package.json"))) {
16814
17014
  return false;
16815
17015
  }
16816
- if (_detect_composer(path15.join(project, "composer.json"))) {
17016
+ if (_detect_composer(path16.join(project, "composer.json"))) {
16817
17017
  return false;
16818
17018
  }
16819
17019
  for (const name of MANAGED_SYMLINKS) {
16820
- if (_classify_symlink(path15.join(project, name)) === "legacy") {
17020
+ if (_classify_symlink(path16.join(project, name)) === "legacy") {
16821
17021
  return false;
16822
17022
  }
16823
17023
  }
@@ -16888,11 +17088,11 @@ function _purge_legacy_symlinks(project) {
16888
17088
  const removed = [];
16889
17089
  const preserved = [];
16890
17090
  for (const name of MANAGED_SYMLINKS) {
16891
- const link = path15.join(project, name);
17091
+ const link = path16.join(project, name);
16892
17092
  const kind = _classify_symlink(link);
16893
17093
  if (kind === "legacy") {
16894
17094
  try {
16895
- fs17.unlinkSync(link);
17095
+ fs18.unlinkSync(link);
16896
17096
  removed.push(name);
16897
17097
  } catch {
16898
17098
  preserved.push(name);
@@ -16904,14 +17104,14 @@ function _purge_legacy_symlinks(project) {
16904
17104
  return [removed, preserved];
16905
17105
  }
16906
17106
  function _migrate_state_file(project) {
16907
- const source = path15.join(project, LEGACY_STATE_FILENAME);
17107
+ const source = path16.join(project, LEGACY_STATE_FILENAME);
16908
17108
  if (!_isFile2(source)) {
16909
17109
  return null;
16910
17110
  }
16911
- const target = path15.join(project, LEGACY_STATE_V1_FILENAME);
17111
+ const target = path16.join(project, LEGACY_STATE_V1_FILENAME);
16912
17112
  if (_exists2(target)) {
16913
17113
  try {
16914
- fs17.unlinkSync(source);
17114
+ fs18.unlinkSync(source);
16915
17115
  return `removed stale ${LEGACY_STATE_FILENAME} (v1 already present)`;
16916
17116
  } catch {
16917
17117
  return null;
@@ -16926,7 +17126,7 @@ function _migrate_state_file(project) {
16926
17126
  }
16927
17127
  function _load_state_migrator() {
16928
17128
  const pkg_root = resolvePackageRoot(import.meta.url);
16929
- const rel = path15.join(
17129
+ const rel = path16.join(
16930
17130
  "agent-src",
16931
17131
  "templates",
16932
17132
  "scripts",
@@ -16934,8 +17134,8 @@ function _load_state_migrator() {
16934
17134
  "migration",
16935
17135
  "v0_to_v1.ts"
16936
17136
  );
16937
- const driver = [path15.join(pkg_root, "dist", rel), path15.join(pkg_root, "src", rel)].find(
16938
- (p) => fs17.existsSync(p)
17137
+ const driver = [path16.join(pkg_root, "dist", rel), path16.join(pkg_root, "src", rel)].find(
17138
+ (p) => fs18.existsSync(p)
16939
17139
  ) ?? null;
16940
17140
  if (driver === null) {
16941
17141
  return null;
@@ -16943,12 +17143,12 @@ function _load_state_migrator() {
16943
17143
  const binName = process2.platform === "win32" ? "tsx.cmd" : "tsx";
16944
17144
  let tsxBin = null;
16945
17145
  for (let dir = pkg_root; ; ) {
16946
- const cand = path15.join(dir, "node_modules", ".bin", binName);
16947
- if (fs17.existsSync(cand)) {
17146
+ const cand = path16.join(dir, "node_modules", ".bin", binName);
17147
+ if (fs18.existsSync(cand)) {
16948
17148
  tsxBin = cand;
16949
17149
  break;
16950
17150
  }
16951
- const parent = path15.dirname(dir);
17151
+ const parent = path16.dirname(dir);
16952
17152
  if (parent === dir) break;
16953
17153
  dir = parent;
16954
17154
  }
@@ -16975,17 +17175,17 @@ function _delete_legacy_settings(project) {
16975
17175
  const removed = [];
16976
17176
  for (const p of _detect_legacy_settings(project)) {
16977
17177
  try {
16978
- fs17.unlinkSync(p);
16979
- removed.push(path15.relative(project, p));
17178
+ fs18.unlinkSync(p);
17179
+ removed.push(path16.relative(project, p));
16980
17180
  } catch {
16981
17181
  continue;
16982
17182
  }
16983
17183
  }
16984
- const settings_dir = path15.join(project, "settings");
17184
+ const settings_dir = path16.join(project, "settings");
16985
17185
  if (_isDir2(settings_dir) && !_isSymlink(settings_dir)) {
16986
17186
  try {
16987
- if (fs17.readdirSync(settings_dir).length === 0) {
16988
- fs17.rmdirSync(settings_dir);
17187
+ if (fs18.readdirSync(settings_dir).length === 0) {
17188
+ fs18.rmdirSync(settings_dir);
16989
17189
  removed.push("settings/");
16990
17190
  }
16991
17191
  } catch {
@@ -16994,12 +17194,12 @@ function _delete_legacy_settings(project) {
16994
17194
  return removed;
16995
17195
  }
16996
17196
  function _remove_empty_shell(project) {
16997
- const shell = path15.join(project, LEGACY_AGENT_CONFIG_SHELL);
17197
+ const shell = path16.join(project, LEGACY_AGENT_CONFIG_SHELL);
16998
17198
  if (!_detect_empty_shell(project)) {
16999
17199
  return false;
17000
17200
  }
17001
17201
  try {
17002
- fs17.rmdirSync(shell);
17202
+ fs18.rmdirSync(shell);
17003
17203
  } catch {
17004
17204
  return false;
17005
17205
  }
@@ -17009,7 +17209,7 @@ function _reEscape(s) {
17009
17209
  return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
17010
17210
  }
17011
17211
  function _update_gitignore(project) {
17012
- const gitignore = path15.join(project, ".gitignore");
17212
+ const gitignore = path16.join(project, ".gitignore");
17013
17213
  const block = `${GITIGNORE_BLOCK_START}
17014
17214
  ${GITIGNORE_NEW_BODY}${GITIGNORE_BLOCK_END}
17015
17215
  `;
@@ -17040,16 +17240,16 @@ ${GITIGNORE_NEW_BODY}${GITIGNORE_BLOCK_END}
17040
17240
  }
17041
17241
  function _build_plan(project) {
17042
17242
  return {
17043
- npm: _detect_npm(path15.join(project, "package.json")),
17044
- composer: _detect_composer(path15.join(project, "composer.json")),
17243
+ npm: _detect_npm(path16.join(project, "package.json")),
17244
+ composer: _detect_composer(path16.join(project, "composer.json")),
17045
17245
  symlinks_legacy: MANAGED_SYMLINKS.filter(
17046
- (name) => _classify_symlink(path15.join(project, name)) === "legacy"
17246
+ (name) => _classify_symlink(path16.join(project, name)) === "legacy"
17047
17247
  ),
17048
17248
  symlinks_user: MANAGED_SYMLINKS.filter(
17049
- (name) => _classify_symlink(path15.join(project, name)) === "user"
17249
+ (name) => _classify_symlink(path16.join(project, name)) === "user"
17050
17250
  ),
17051
- state_file: _isFile2(path15.join(project, LEGACY_STATE_FILENAME)),
17052
- settings_files: _detect_legacy_settings(project).map((p) => path15.relative(project, p)),
17251
+ state_file: _isFile2(path16.join(project, LEGACY_STATE_FILENAME)),
17252
+ settings_files: _detect_legacy_settings(project).map((p) => path16.relative(project, p)),
17053
17253
  empty_shell: _detect_empty_shell(project)
17054
17254
  };
17055
17255
  }
@@ -17113,10 +17313,10 @@ function _warn_on_major_mismatch(from_major, plan, out) {
17113
17313
  }
17114
17314
  function _apply(project, out, err) {
17115
17315
  const summary = [];
17116
- if (_strip_npm_entry(path15.join(project, "package.json"))) {
17316
+ if (_strip_npm_entry(path16.join(project, "package.json"))) {
17117
17317
  summary.push(`removed ${PACKAGE_NAME_NPM} from package.json`);
17118
17318
  }
17119
- if (_strip_composer_entry(path15.join(project, "composer.json"))) {
17319
+ if (_strip_composer_entry(path16.join(project, "composer.json"))) {
17120
17320
  summary.push(`removed ${PACKAGE_NAME_COMPOSER} from composer.json`);
17121
17321
  }
17122
17322
  const [removed_links, preserved_links] = _purge_legacy_symlinks(project);
@@ -17243,17 +17443,17 @@ function _isCliEntry() {
17243
17443
  return false;
17244
17444
  }
17245
17445
  if (typeof __AGENT_CONFIG_CLI_DELEGATE__ !== "undefined" && __AGENT_CONFIG_CLI_DELEGATE__) {
17246
- if (path15.basename(process2.argv[1], ".js") === "cmd_migrate") {
17446
+ if (path16.basename(process2.argv[1], ".js") === "cmd_migrate") {
17247
17447
  return true;
17248
17448
  }
17249
17449
  }
17250
- const argvUrl = pathToFileURL(path15.resolve(process2.argv[1])).href;
17450
+ const argvUrl = pathToFileURL(path16.resolve(process2.argv[1])).href;
17251
17451
  if (import.meta.url === argvUrl) {
17252
17452
  return true;
17253
17453
  }
17254
17454
  try {
17255
- const here = fs17.realpathSync(fileURLToPath4(import.meta.url));
17256
- const argv = fs17.realpathSync(path15.resolve(process2.argv[1]));
17455
+ const here = fs18.realpathSync(fileURLToPath4(import.meta.url));
17456
+ const argv = fs18.realpathSync(path16.resolve(process2.argv[1]));
17257
17457
  return here === argv;
17258
17458
  } catch {
17259
17459
  return false;
@@ -17290,34 +17490,34 @@ var ArgparseExit2 = class extends Error {
17290
17490
  function expanduser6(p) {
17291
17491
  if (p === "~") return os7.homedir();
17292
17492
  if (p.startsWith("~/") || p.startsWith("~\\")) {
17293
- return path16.join(os7.homedir(), p.slice(2));
17493
+ return path17.join(os7.homedir(), p.slice(2));
17294
17494
  }
17295
17495
  return p;
17296
17496
  }
17297
17497
  function resolvePath(p) {
17298
17498
  try {
17299
- return fs18.realpathSync(path16.resolve(p));
17499
+ return fs19.realpathSync(path17.resolve(p));
17300
17500
  } catch {
17301
- return path16.resolve(p);
17501
+ return path17.resolve(p);
17302
17502
  }
17303
17503
  }
17304
17504
  function isFile(p) {
17305
17505
  try {
17306
- return fs18.statSync(p).isFile();
17506
+ return fs19.statSync(p).isFile();
17307
17507
  } catch {
17308
17508
  return false;
17309
17509
  }
17310
17510
  }
17311
17511
  function isDir(p) {
17312
17512
  try {
17313
- return fs18.statSync(p).isDirectory();
17513
+ return fs19.statSync(p).isDirectory();
17314
17514
  } catch {
17315
17515
  return false;
17316
17516
  }
17317
17517
  }
17318
17518
  function pathExists(p) {
17319
17519
  try {
17320
- fs18.statSync(p);
17520
+ fs19.statSync(p);
17321
17521
  return true;
17322
17522
  } catch {
17323
17523
  return false;
@@ -17325,24 +17525,24 @@ function pathExists(p) {
17325
17525
  }
17326
17526
  function isSymlink(p) {
17327
17527
  try {
17328
- return fs18.lstatSync(p).isSymbolicLink();
17528
+ return fs19.lstatSync(p).isSymbolicLink();
17329
17529
  } catch {
17330
17530
  return false;
17331
17531
  }
17332
17532
  }
17333
17533
  function readText(p) {
17334
- return fs18.readFileSync(p, "utf-8");
17534
+ return fs19.readFileSync(p, "utf-8");
17335
17535
  }
17336
17536
  function writeText(p, content) {
17337
- fs18.writeFileSync(p, content, "utf-8");
17537
+ fs19.writeFileSync(p, content, "utf-8");
17338
17538
  }
17339
17539
  function mkdirp(p) {
17340
- fs18.mkdirSync(p, { recursive: true });
17540
+ fs19.mkdirSync(p, { recursive: true });
17341
17541
  }
17342
17542
  function sortedGlobStems(directory, suffix) {
17343
17543
  let entries;
17344
17544
  try {
17345
- entries = fs18.readdirSync(directory);
17545
+ entries = fs19.readdirSync(directory);
17346
17546
  } catch {
17347
17547
  return [];
17348
17548
  }
@@ -17362,7 +17562,7 @@ function sortedGlobStems(directory, suffix) {
17362
17562
  function countZips(directory) {
17363
17563
  if (!isDir(directory)) return 0;
17364
17564
  let n = 0;
17365
- for (const name of fs18.readdirSync(directory)) {
17565
+ for (const name of fs19.readdirSync(directory)) {
17366
17566
  if (name.endsWith(".zip")) n += 1;
17367
17567
  }
17368
17568
  return n;
@@ -17370,35 +17570,35 @@ function countZips(directory) {
17370
17570
  function sha256OfFile(p) {
17371
17571
  let data;
17372
17572
  try {
17373
- data = fs18.readFileSync(p);
17573
+ data = fs19.readFileSync(p);
17374
17574
  } catch {
17375
17575
  return null;
17376
17576
  }
17377
17577
  return crypto3.createHash("sha256").update(data).digest("hex");
17378
17578
  }
17379
17579
  function atomicWrite0644(target, body, prefix) {
17380
- const dir = path16.dirname(target);
17381
- const tmpName = path16.join(
17580
+ const dir = path17.dirname(target);
17581
+ const tmpName = path17.join(
17382
17582
  dir,
17383
17583
  `${prefix}${process3.pid}.${crypto3.randomBytes(6).toString("hex")}.yml.tmp`
17384
17584
  );
17385
17585
  let fd = null;
17386
17586
  try {
17387
- fd = fs18.openSync(tmpName, "wx", 420);
17388
- fs18.writeFileSync(fd, body, "utf-8");
17389
- fs18.closeSync(fd);
17587
+ fd = fs19.openSync(tmpName, "wx", 420);
17588
+ fs19.writeFileSync(fd, body, "utf-8");
17589
+ fs19.closeSync(fd);
17390
17590
  fd = null;
17391
- fs18.chmodSync(tmpName, 420);
17392
- fs18.renameSync(tmpName, target);
17591
+ fs19.chmodSync(tmpName, 420);
17592
+ fs19.renameSync(tmpName, target);
17393
17593
  } catch (err) {
17394
17594
  if (fd !== null) {
17395
17595
  try {
17396
- fs18.closeSync(fd);
17596
+ fs19.closeSync(fd);
17397
17597
  } catch {
17398
17598
  }
17399
17599
  }
17400
17600
  try {
17401
- fs18.unlinkSync(tmpName);
17601
+ fs19.unlinkSync(tmpName);
17402
17602
  } catch {
17403
17603
  }
17404
17604
  throw err;
@@ -17522,12 +17722,12 @@ var LEGACY_SETTINGS_FILE = ".agent-settings";
17522
17722
  var LEGACY_BACKUP_FILE = ".agent-settings.backup.key-value";
17523
17723
  var SETTINGS_SUBDIR = ["agents", "settings"];
17524
17724
  function _canonical_settings_target(project_root) {
17525
- return path16.join(project_root, ...SETTINGS_SUBDIR, SETTINGS_FILE);
17725
+ return path17.join(project_root, ...SETTINGS_SUBDIR, SETTINGS_FILE);
17526
17726
  }
17527
17727
  function _resolve_settings_read(project_root) {
17528
17728
  const canonical = _canonical_settings_target(project_root);
17529
17729
  if (pathExists(canonical)) return canonical;
17530
- const legacy = path16.join(project_root, SETTINGS_FILE);
17730
+ const legacy = path17.join(project_root, SETTINGS_FILE);
17531
17731
  if (pathExists(legacy)) return legacy;
17532
17732
  return canonical;
17533
17733
  }
@@ -17591,9 +17791,9 @@ function fail(msg) {
17591
17791
  throw new SystemExitError(1);
17592
17792
  }
17593
17793
  function detect_package_root(project_root) {
17594
- const npm_path = path16.join(project_root, "node_modules", "@event4u", "agent-config");
17794
+ const npm_path = path17.join(project_root, "node_modules", "@event4u", "agent-config");
17595
17795
  if (isDir(npm_path)) return resolvePath(npm_path);
17596
- if (pathExists(path16.join(project_root, "src", "config", "profiles", "minimal.ini"))) {
17796
+ if (pathExists(path17.join(project_root, "src", "config", "profiles", "minimal.ini"))) {
17597
17797
  return project_root;
17598
17798
  }
17599
17799
  fail(
@@ -17601,12 +17801,12 @@ function detect_package_root(project_root) {
17601
17801
  );
17602
17802
  }
17603
17803
  function detect_package_type(package_root) {
17604
- if (package_root.split(path16.sep).includes("node_modules")) return "npm";
17804
+ if (package_root.split(path17.sep).includes("node_modules")) return "npm";
17605
17805
  return "local";
17606
17806
  }
17607
17807
  function detect_package_type_for_project(project_root, package_root) {
17608
17808
  const npm_path = resolvePath(
17609
- path16.join(project_root, "node_modules", "@event4u", "agent-config")
17809
+ path17.join(project_root, "node_modules", "@event4u", "agent-config")
17610
17810
  );
17611
17811
  const package_resolved = resolvePath(package_root);
17612
17812
  if (package_resolved === npm_path) return "npm";
@@ -17626,7 +17826,7 @@ function ensure_directory(p) {
17626
17826
  mkdirp(p);
17627
17827
  }
17628
17828
  function write_file(p, content) {
17629
- ensure_directory(path16.dirname(p));
17829
+ ensure_directory(path17.dirname(p));
17630
17830
  writeText(p, content);
17631
17831
  }
17632
17832
  function read_json_file(p) {
@@ -17797,7 +17997,7 @@ function _append_unknown_legacy(rendered, legacy_values, unknown_keys) {
17797
17997
  return rendered + "\n" + suffix;
17798
17998
  }
17799
17999
  function _migrate_legacy_if_present(project_root, template_body) {
17800
- const legacy_target = path16.join(project_root, LEGACY_SETTINGS_FILE);
18000
+ const legacy_target = path17.join(project_root, LEGACY_SETTINGS_FILE);
17801
18001
  if (!isFile(legacy_target)) return null;
17802
18002
  const legacy_text = readText(legacy_target);
17803
18003
  const [values, unknown] = _parse_legacy_settings(legacy_text);
@@ -17812,9 +18012,9 @@ function _migrate_legacy_if_present(project_root, template_body) {
17812
18012
  }
17813
18013
  }
17814
18014
  rendered = _append_unknown_legacy(rendered, values, unknown);
17815
- const backup_target = path16.join(project_root, LEGACY_BACKUP_FILE);
18015
+ const backup_target = path17.join(project_root, LEGACY_BACKUP_FILE);
17816
18016
  writeText(backup_target, legacy_text);
17817
- fs18.unlinkSync(legacy_target);
18017
+ fs19.unlinkSync(legacy_target);
17818
18018
  info(`Migrated legacy ${LEGACY_SETTINGS_FILE} \u2192 ${SETTINGS_FILE}`);
17819
18019
  info(`Backup saved to ${LEGACY_BACKUP_FILE}`);
17820
18020
  if (unknown.length > 0) {
@@ -17849,7 +18049,7 @@ function _render_template(template, profile_values) {
17849
18049
  return body;
17850
18050
  }
17851
18051
  function _load_valid_user_types(package_root) {
17852
- const directory = path16.join(package_root, USER_TYPES_DIR);
18052
+ const directory = path17.join(package_root, USER_TYPES_DIR);
17853
18053
  if (!isDir(directory)) return [];
17854
18054
  return sortedGlobStems(directory, ".yml");
17855
18055
  }
@@ -17906,8 +18106,8 @@ function splitlinesKeepends(text) {
17906
18106
  }
17907
18107
  function ensure_agent_settings(project_root, package_root, profile, force, user_type = "", packs = null) {
17908
18108
  const target = _canonical_settings_target(project_root);
17909
- const profile_source = path16.join(package_root, "src", "config", "profiles", `${profile}.ini`);
17910
- const template_source = path16.join(package_root, "src", "config", "agent-settings.template.yml");
18109
+ const profile_source = path17.join(package_root, "src", "config", "profiles", `${profile}.ini`);
18110
+ const template_source = path17.join(package_root, "src", "config", "agent-settings.template.yml");
17911
18111
  if (!pathExists(profile_source)) fail(`Missing profile preset: ${profile_source}`);
17912
18112
  if (!pathExists(template_source)) fail(`Missing settings template: ${template_source}`);
17913
18113
  const template = readText(template_source);
@@ -17921,21 +18121,21 @@ function ensure_agent_settings(project_root, package_root, profile, force, user_
17921
18121
  if (profile_values["rule_loading_tier"] !== profile) {
17922
18122
  const got = "rule_loading_tier" in profile_values ? `'${profile_values["rule_loading_tier"]}'` : "None";
17923
18123
  fail(
17924
- `Profile preset ${path16.basename(profile_source)} has rule_loading_tier=${got} but --profile=${profile}`
18124
+ `Profile preset ${path17.basename(profile_source)} has rule_loading_tier=${got} but --profile=${profile}`
17925
18125
  );
17926
18126
  }
17927
18127
  profile_values["user_type"] = _validate_user_type(package_root, user_type);
17928
18128
  let template_body = _render_template(template, profile_values);
17929
18129
  template_body = _inject_packs(template_body, packs ?? []);
17930
- const legacy_root = path16.join(project_root, SETTINGS_FILE);
18130
+ const legacy_root = path17.join(project_root, SETTINGS_FILE);
17931
18131
  if (isFile(legacy_root) && !pathExists(target)) {
17932
- mkdirp(path16.dirname(target));
18132
+ mkdirp(path17.dirname(target));
17933
18133
  writeText(target, readText(legacy_root));
17934
- fs18.unlinkSync(legacy_root);
18134
+ fs19.unlinkSync(legacy_root);
17935
18135
  success(`Migrated ${SETTINGS_FILE} \u2192 agents/settings/${SETTINGS_FILE} (ADR-038)`);
17936
18136
  return;
17937
18137
  }
17938
- const legacy_target = path16.join(project_root, LEGACY_SETTINGS_FILE);
18138
+ const legacy_target = path17.join(project_root, LEGACY_SETTINGS_FILE);
17939
18139
  if (isFile(legacy_target) && pathExists(target)) {
17940
18140
  warn(
17941
18141
  `Both ${SETTINGS_FILE} and legacy ${LEGACY_SETTINGS_FILE} exist. Skipping migration to avoid overwriting ${SETTINGS_FILE}. Delete one of them manually and re-run.`
@@ -17952,7 +18152,7 @@ function ensure_agent_settings(project_root, package_root, profile, force, user_
17952
18152
  skip(`${SETTINGS_FILE} already exists`);
17953
18153
  return;
17954
18154
  }
17955
- mkdirp(path16.dirname(target));
18155
+ mkdirp(path17.dirname(target));
17956
18156
  write_file(target, template_body);
17957
18157
  const user_type_value = profile_values["user_type"] ?? "";
17958
18158
  const suffix = user_type_value ? `, user_type=${user_type_value}` : "";
@@ -17965,7 +18165,7 @@ function ensure_vscode_bridge(project_root, package_type, force) {
17965
18165
  const plugin_path = plugin_paths[package_type] ?? "./plugin/agent-config";
17966
18166
  const bridge = { "chat.pluginLocations": { [plugin_path]: true } };
17967
18167
  return merge_json_file(
17968
- path16.join(project_root, ".vscode", "settings.json"),
18168
+ path17.join(project_root, ".vscode", "settings.json"),
17969
18169
  bridge,
17970
18170
  force,
17971
18171
  ".vscode/settings.json"
@@ -17974,14 +18174,14 @@ function ensure_vscode_bridge(project_root, package_type, force) {
17974
18174
  function ensure_augment_bridge(project_root, force) {
17975
18175
  const bridge = { enabledPlugins: { "agent-config@event4u": true } };
17976
18176
  return merge_json_file(
17977
- path16.join(project_root, ".augment", "settings.json"),
18177
+ path17.join(project_root, ".augment", "settings.json"),
17978
18178
  bridge,
17979
18179
  force,
17980
18180
  ".augment/settings.json"
17981
18181
  );
17982
18182
  }
17983
- var AUGMENT_USER_DIR = path16.join(os7.homedir(), ".augment");
17984
- var AUGMENT_USER_HOOKS_DIR = path16.join(AUGMENT_USER_DIR, "hooks");
18183
+ var AUGMENT_USER_DIR = path17.join(os7.homedir(), ".augment");
18184
+ var AUGMENT_USER_HOOKS_DIR = path17.join(AUGMENT_USER_DIR, "hooks");
17985
18185
  var AUGMENT_DISPATCHER_TRAMPOLINE = "augment-dispatcher.sh";
17986
18186
  var AUGMENT_LEGACY_TRAMPOLINES = [
17987
18187
  "augment-chat-history.sh",
@@ -17997,29 +18197,29 @@ var AUGMENT_DISPATCHER_BINDINGS = [
17997
18197
  ["post_tool_use", "PostToolUse"]
17998
18198
  ];
17999
18199
  function _deploy_augment_trampoline(package_root, name, force) {
18000
- const src = path16.join(package_root, "scripts", "hooks", name);
18200
+ const src = path17.join(package_root, "scripts", "hooks", name);
18001
18201
  if (!pathExists(src)) {
18002
18202
  skip(`augment trampoline missing in package: ${src}`);
18003
18203
  return null;
18004
18204
  }
18005
18205
  mkdirp(AUGMENT_USER_HOOKS_DIR);
18006
- const dst = path16.join(AUGMENT_USER_HOOKS_DIR, name);
18206
+ const dst = path17.join(AUGMENT_USER_HOOKS_DIR, name);
18007
18207
  const src_text = readText(src);
18008
18208
  if (pathExists(dst) && readText(dst) === src_text && !force) {
18009
18209
  skip(`~/.augment/hooks/${name} already up to date`);
18010
18210
  } else {
18011
18211
  writeText(dst, src_text);
18012
- fs18.chmodSync(dst, 493);
18212
+ fs19.chmodSync(dst, 493);
18013
18213
  success(`~/.augment/hooks/${name} installed`);
18014
18214
  }
18015
18215
  return dst;
18016
18216
  }
18017
18217
  function _remove_legacy_augment_trampolines() {
18018
18218
  for (const name of AUGMENT_LEGACY_TRAMPOLINES) {
18019
- const legacy = path16.join(AUGMENT_USER_HOOKS_DIR, name);
18219
+ const legacy = path17.join(AUGMENT_USER_HOOKS_DIR, name);
18020
18220
  try {
18021
18221
  if (isFile(legacy)) {
18022
- fs18.unlinkSync(legacy);
18222
+ fs19.unlinkSync(legacy);
18023
18223
  skip(`removed legacy ~/.augment/hooks/${name}`);
18024
18224
  }
18025
18225
  } catch (err) {
@@ -18039,7 +18239,7 @@ function ensure_augment_user_hooks(package_root, force) {
18039
18239
  }
18040
18240
  const settings_patch = { hooks: per_event };
18041
18241
  return merge_json_file(
18042
- path16.join(AUGMENT_USER_DIR, "settings.json"),
18242
+ path17.join(AUGMENT_USER_DIR, "settings.json"),
18043
18243
  settings_patch,
18044
18244
  force,
18045
18245
  "~/.augment/settings.json"
@@ -18064,7 +18264,7 @@ function _heal_legacy_claude_plugin_ids(p) {
18064
18264
  return removed;
18065
18265
  }
18066
18266
  function ensure_claude_bridge(project_root, force) {
18067
- const target = path16.join(project_root, ".claude", "settings.json");
18267
+ const target = path17.join(project_root, ".claude", "settings.json");
18068
18268
  const healed = _heal_legacy_claude_plugin_ids(target);
18069
18269
  for (const pid of healed) {
18070
18270
  success(`.claude/settings.json: removed stale plugin id \`${pid}\``);
@@ -18089,29 +18289,29 @@ function ensure_cursor_bridge(project_root, force) {
18089
18289
  }
18090
18290
  const bridge = { version: 1, hooks };
18091
18291
  return merge_json_file(
18092
- path16.join(project_root, ".cursor", "hooks.json"),
18292
+ path17.join(project_root, ".cursor", "hooks.json"),
18093
18293
  bridge,
18094
18294
  force,
18095
18295
  ".cursor/hooks.json"
18096
18296
  );
18097
18297
  }
18098
- var CURSOR_USER_DIR = path16.join(os7.homedir(), ".cursor");
18099
- var CURSOR_USER_HOOKS_DIR = path16.join(CURSOR_USER_DIR, "hooks");
18298
+ var CURSOR_USER_DIR = path17.join(os7.homedir(), ".cursor");
18299
+ var CURSOR_USER_HOOKS_DIR = path17.join(CURSOR_USER_DIR, "hooks");
18100
18300
  var CURSOR_DISPATCHER_TRAMPOLINE = "cursor-dispatcher.sh";
18101
18301
  function ensure_cursor_user_hooks(package_root, force) {
18102
- const src = path16.join(package_root, "scripts", "hooks", CURSOR_DISPATCHER_TRAMPOLINE);
18302
+ const src = path17.join(package_root, "scripts", "hooks", CURSOR_DISPATCHER_TRAMPOLINE);
18103
18303
  if (!pathExists(src)) {
18104
18304
  skip(`cursor trampoline missing in package: ${src}`);
18105
18305
  return [];
18106
18306
  }
18107
18307
  mkdirp(CURSOR_USER_HOOKS_DIR);
18108
- const dst = path16.join(CURSOR_USER_HOOKS_DIR, CURSOR_DISPATCHER_TRAMPOLINE);
18308
+ const dst = path17.join(CURSOR_USER_HOOKS_DIR, CURSOR_DISPATCHER_TRAMPOLINE);
18109
18309
  const src_text = readText(src);
18110
18310
  if (pathExists(dst) && readText(dst) === src_text && !force) {
18111
18311
  skip(`~/.cursor/hooks/${CURSOR_DISPATCHER_TRAMPOLINE} already up to date`);
18112
18312
  } else {
18113
18313
  writeText(dst, src_text);
18114
- fs18.chmodSync(dst, 493);
18314
+ fs19.chmodSync(dst, 493);
18115
18315
  success(`~/.cursor/hooks/${CURSOR_DISPATCHER_TRAMPOLINE} installed`);
18116
18316
  }
18117
18317
  const hooks = {};
@@ -18120,7 +18320,7 @@ function ensure_cursor_user_hooks(package_root, force) {
18120
18320
  }
18121
18321
  const settings_patch = { version: 1, hooks };
18122
18322
  return merge_json_file(
18123
- path16.join(CURSOR_USER_DIR, "hooks.json"),
18323
+ path17.join(CURSOR_USER_DIR, "hooks.json"),
18124
18324
  settings_patch,
18125
18325
  force,
18126
18326
  "~/.cursor/hooks.json"
@@ -18163,12 +18363,12 @@ exit 0
18163
18363
  `;
18164
18364
  }
18165
18365
  function ensure_cline_bridge(project_root, force) {
18166
- const hooks_dir = path16.join(project_root, ".clinerules", "hooks");
18366
+ const hooks_dir = path17.join(project_root, ".clinerules", "hooks");
18167
18367
  mkdirp(hooks_dir);
18168
18368
  const workspace_quoted = shlexQuote(resolvePath(project_root));
18169
18369
  let written = 0;
18170
18370
  for (const [ac_event, native_event] of CLINE_DISPATCHER_BINDINGS) {
18171
- const target = path16.join(hooks_dir, native_event);
18371
+ const target = path17.join(hooks_dir, native_event);
18172
18372
  const body = clineProjectHookBody(native_event, ac_event, workspace_quoted);
18173
18373
  if (pathExists(target) && readText(target) === body && !force) {
18174
18374
  continue;
@@ -18178,7 +18378,7 @@ function ensure_cline_bridge(project_root, force) {
18178
18378
  continue;
18179
18379
  }
18180
18380
  writeText(target, body);
18181
- fs18.chmodSync(target, 493);
18381
+ fs19.chmodSync(target, 493);
18182
18382
  written += 1;
18183
18383
  }
18184
18384
  if (written) {
@@ -18187,27 +18387,27 @@ function ensure_cline_bridge(project_root, force) {
18187
18387
  skip(".clinerules/hooks/ already up to date");
18188
18388
  }
18189
18389
  }
18190
- var CLINE_USER_DIR = path16.join(os7.homedir(), "Documents", "Cline", "Hooks");
18390
+ var CLINE_USER_DIR = path17.join(os7.homedir(), "Documents", "Cline", "Hooks");
18191
18391
  var CLINE_DISPATCHER_TRAMPOLINE = "cline-dispatcher.sh";
18192
18392
  function ensure_cline_user_hooks(package_root, force) {
18193
- const src = path16.join(package_root, "scripts", "hooks", CLINE_DISPATCHER_TRAMPOLINE);
18393
+ const src = path17.join(package_root, "scripts", "hooks", CLINE_DISPATCHER_TRAMPOLINE);
18194
18394
  if (!pathExists(src)) {
18195
18395
  skip(`cline trampoline missing in package: ${src}`);
18196
18396
  return;
18197
18397
  }
18198
18398
  mkdirp(CLINE_USER_DIR);
18199
- const trampoline = path16.join(CLINE_USER_DIR, CLINE_DISPATCHER_TRAMPOLINE);
18399
+ const trampoline = path17.join(CLINE_USER_DIR, CLINE_DISPATCHER_TRAMPOLINE);
18200
18400
  const src_text = readText(src);
18201
18401
  if (pathExists(trampoline) && readText(trampoline) === src_text && !force) {
18202
18402
  skip(`~/Documents/Cline/Hooks/${CLINE_DISPATCHER_TRAMPOLINE} already up to date`);
18203
18403
  } else {
18204
18404
  writeText(trampoline, src_text);
18205
- fs18.chmodSync(trampoline, 493);
18405
+ fs19.chmodSync(trampoline, 493);
18206
18406
  success(`~/Documents/Cline/Hooks/${CLINE_DISPATCHER_TRAMPOLINE} installed`);
18207
18407
  }
18208
18408
  const trampoline_quoted = shlexQuote(trampoline);
18209
18409
  for (const [ac_event, native_event] of CLINE_DISPATCHER_BINDINGS) {
18210
- const wrapper = path16.join(CLINE_USER_DIR, native_event);
18410
+ const wrapper = path17.join(CLINE_USER_DIR, native_event);
18211
18411
  const body = `#!/usr/bin/env bash
18212
18412
  # Generated by event4u/agent-config install.py \u2014 DO NOT EDIT.
18213
18413
  # User-scope Cline hook for ${native_event} \u2192 agent-config ${ac_event}.
@@ -18217,7 +18417,7 @@ exec ${trampoline_quoted} ${ac_event} ${native_event}
18217
18417
  continue;
18218
18418
  }
18219
18419
  writeText(wrapper, body);
18220
- fs18.chmodSync(wrapper, 493);
18420
+ fs19.chmodSync(wrapper, 493);
18221
18421
  }
18222
18422
  }
18223
18423
  var WINDSURF_DISPATCHER_BINDINGS = [
@@ -18238,29 +18438,29 @@ function ensure_windsurf_bridge(project_root, force) {
18238
18438
  }
18239
18439
  const bridge = { hooks };
18240
18440
  return merge_json_file(
18241
- path16.join(project_root, ".windsurf", "hooks.json"),
18441
+ path17.join(project_root, ".windsurf", "hooks.json"),
18242
18442
  bridge,
18243
18443
  force,
18244
18444
  ".windsurf/hooks.json"
18245
18445
  );
18246
18446
  }
18247
- var WINDSURF_USER_DIR = path16.join(os7.homedir(), ".codeium", "windsurf");
18248
- var WINDSURF_USER_HOOKS_DIR = path16.join(WINDSURF_USER_DIR, "hooks");
18447
+ var WINDSURF_USER_DIR = path17.join(os7.homedir(), ".codeium", "windsurf");
18448
+ var WINDSURF_USER_HOOKS_DIR = path17.join(WINDSURF_USER_DIR, "hooks");
18249
18449
  var WINDSURF_DISPATCHER_TRAMPOLINE = "windsurf-dispatcher.sh";
18250
18450
  function ensure_windsurf_user_hooks(package_root, force) {
18251
- const src = path16.join(package_root, "scripts", "hooks", WINDSURF_DISPATCHER_TRAMPOLINE);
18451
+ const src = path17.join(package_root, "scripts", "hooks", WINDSURF_DISPATCHER_TRAMPOLINE);
18252
18452
  if (!pathExists(src)) {
18253
18453
  skip(`windsurf trampoline missing in package: ${src}`);
18254
18454
  return [];
18255
18455
  }
18256
18456
  mkdirp(WINDSURF_USER_HOOKS_DIR);
18257
- const dst = path16.join(WINDSURF_USER_HOOKS_DIR, WINDSURF_DISPATCHER_TRAMPOLINE);
18457
+ const dst = path17.join(WINDSURF_USER_HOOKS_DIR, WINDSURF_DISPATCHER_TRAMPOLINE);
18258
18458
  const src_text = readText(src);
18259
18459
  if (pathExists(dst) && readText(dst) === src_text && !force) {
18260
18460
  skip(`~/.codeium/windsurf/hooks/${WINDSURF_DISPATCHER_TRAMPOLINE} already up to date`);
18261
18461
  } else {
18262
18462
  writeText(dst, src_text);
18263
- fs18.chmodSync(dst, 493);
18463
+ fs19.chmodSync(dst, 493);
18264
18464
  success(`~/.codeium/windsurf/hooks/${WINDSURF_DISPATCHER_TRAMPOLINE} installed`);
18265
18465
  }
18266
18466
  const hooks = {};
@@ -18272,7 +18472,7 @@ function ensure_windsurf_user_hooks(package_root, force) {
18272
18472
  }
18273
18473
  const settings_patch = { hooks };
18274
18474
  return merge_json_file(
18275
- path16.join(WINDSURF_USER_DIR, "hooks.json"),
18475
+ path17.join(WINDSURF_USER_DIR, "hooks.json"),
18276
18476
  settings_patch,
18277
18477
  force,
18278
18478
  "~/.codeium/windsurf/hooks.json"
@@ -18301,43 +18501,43 @@ function _gemini_hooks_dict(command_factory) {
18301
18501
  function ensure_gemini_bridge(project_root, force) {
18302
18502
  const bridge = { hooks: _gemini_hooks_dict(_gemini_dispatch_command) };
18303
18503
  return merge_json_file(
18304
- path16.join(project_root, ".gemini", "settings.json"),
18504
+ path17.join(project_root, ".gemini", "settings.json"),
18305
18505
  bridge,
18306
18506
  force,
18307
18507
  ".gemini/settings.json"
18308
18508
  );
18309
18509
  }
18310
- var GEMINI_USER_DIR = path16.join(os7.homedir(), ".gemini");
18311
- var GEMINI_USER_HOOKS_DIR = path16.join(GEMINI_USER_DIR, "hooks");
18510
+ var GEMINI_USER_DIR = path17.join(os7.homedir(), ".gemini");
18511
+ var GEMINI_USER_HOOKS_DIR = path17.join(GEMINI_USER_DIR, "hooks");
18312
18512
  var GEMINI_DISPATCHER_TRAMPOLINE = "gemini-dispatcher.sh";
18313
18513
  function ensure_gemini_user_hooks(package_root, force) {
18314
- const src = path16.join(package_root, "scripts", "hooks", GEMINI_DISPATCHER_TRAMPOLINE);
18514
+ const src = path17.join(package_root, "scripts", "hooks", GEMINI_DISPATCHER_TRAMPOLINE);
18315
18515
  if (!pathExists(src)) {
18316
18516
  skip(`gemini trampoline missing in package: ${src}`);
18317
18517
  return [];
18318
18518
  }
18319
18519
  mkdirp(GEMINI_USER_HOOKS_DIR);
18320
- const dst = path16.join(GEMINI_USER_HOOKS_DIR, GEMINI_DISPATCHER_TRAMPOLINE);
18520
+ const dst = path17.join(GEMINI_USER_HOOKS_DIR, GEMINI_DISPATCHER_TRAMPOLINE);
18321
18521
  const src_text = readText(src);
18322
18522
  if (pathExists(dst) && readText(dst) === src_text && !force) {
18323
18523
  skip(`~/.gemini/hooks/${GEMINI_DISPATCHER_TRAMPOLINE} already up to date`);
18324
18524
  } else {
18325
18525
  writeText(dst, src_text);
18326
- fs18.chmodSync(dst, 493);
18526
+ fs19.chmodSync(dst, 493);
18327
18527
  success(`~/.gemini/hooks/${GEMINI_DISPATCHER_TRAMPOLINE} installed`);
18328
18528
  }
18329
18529
  const settings_patch = {
18330
18530
  hooks: _gemini_hooks_dict((ac_event, native) => `${dst} ${ac_event} ${native}`)
18331
18531
  };
18332
18532
  return merge_json_file(
18333
- path16.join(GEMINI_USER_DIR, "settings.json"),
18533
+ path17.join(GEMINI_USER_DIR, "settings.json"),
18334
18534
  settings_patch,
18335
18535
  force,
18336
18536
  "~/.gemini/settings.json"
18337
18537
  );
18338
18538
  }
18339
18539
  function ensure_copilot_bridge(project_root, force) {
18340
- const target = path16.join(project_root, ".github", "plugin", "marketplace.json");
18540
+ const target = path17.join(project_root, ".github", "plugin", "marketplace.json");
18341
18541
  const bridge = {
18342
18542
  marketplace: {
18343
18543
  name: "event4u-agent-marketplace",
@@ -18380,7 +18580,7 @@ See \`docs/setup/per-ide/roocode.md\` for the full activation guide.
18380
18580
  Run \`./agent-config --help\` for available commands.
18381
18581
  `;
18382
18582
  function ensure_roocode_bridge(project_root, force) {
18383
- const target = path16.join(project_root, ".roo", "rules", "agent-config.md");
18583
+ const target = path17.join(project_root, ".roo", "rules", "agent-config.md");
18384
18584
  if (pathExists(target) && !force) {
18385
18585
  skip(".roo/rules/agent-config.md already exists");
18386
18586
  return;
@@ -18402,7 +18602,7 @@ To wire Claude Desktop to this project's rules, run:
18402
18602
  Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
18403
18603
  `;
18404
18604
  function ensure_claude_desktop_bridge(project_root, force) {
18405
- const target = path16.join(project_root, ".claude-desktop", "agent-config.md");
18605
+ const target = path17.join(project_root, ".claude-desktop", "agent-config.md");
18406
18606
  if (pathExists(target) && !force) {
18407
18607
  skip(".claude-desktop/agent-config.md already exists");
18408
18608
  return;
@@ -18427,7 +18627,7 @@ Or pass \`--read .aider/agent-config.md\` on the command line.
18427
18627
  Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
18428
18628
  `;
18429
18629
  function ensure_aider_bridge(project_root, force) {
18430
- const target = path16.join(project_root, ".aider", "agent-config.md");
18630
+ const target = path17.join(project_root, ".aider", "agent-config.md");
18431
18631
  if (pathExists(target) && !force) {
18432
18632
  skip(".aider/agent-config.md already exists");
18433
18633
  return;
@@ -18446,7 +18646,7 @@ developers where the rules and skills live.
18446
18646
  Canonical rule and skill source: \`.augment/\` (see project \`AGENTS.md\`).
18447
18647
  `;
18448
18648
  function ensure_codex_bridge(project_root, force) {
18449
- const target = path16.join(project_root, ".codex", "agent-config.md");
18649
+ const target = path17.join(project_root, ".codex", "agent-config.md");
18450
18650
  if (pathExists(target) && !force) {
18451
18651
  skip(".codex/agent-config.md already exists");
18452
18652
  return;
@@ -18464,7 +18664,7 @@ rules per session. The canonical rule and skill source lives under
18464
18664
  orientation).
18465
18665
  `;
18466
18666
  function ensure_continue_bridge(project_root, force) {
18467
- const target = path16.join(project_root, ".continue", "rules", "agent-config.md");
18667
+ const target = path17.join(project_root, ".continue", "rules", "agent-config.md");
18468
18668
  if (pathExists(target) && !force) {
18469
18669
  skip(".continue/rules/agent-config.md already exists");
18470
18670
  return;
@@ -18495,7 +18695,7 @@ orientation).
18495
18695
  See \`docs/setup/per-ide/kilocode.md\` for the full activation guide.
18496
18696
  `;
18497
18697
  function ensure_kilocode_bridge(project_root, force) {
18498
- const target = path16.join(project_root, ".kilocode", "rules", "agent-config.md");
18698
+ const target = path17.join(project_root, ".kilocode", "rules", "agent-config.md");
18499
18699
  if (pathExists(target) && !force) {
18500
18700
  skip(".kilocode/rules/agent-config.md already exists");
18501
18701
  return;
@@ -18522,7 +18722,7 @@ canonical source (or symlink it):
18522
18722
  Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
18523
18723
  `;
18524
18724
  function ensure_zed_bridge(project_root, force) {
18525
- const target = path16.join(project_root, ".zed", "agent-config.md");
18725
+ const target = path17.join(project_root, ".zed", "agent-config.md");
18526
18726
  if (pathExists(target) && !force) {
18527
18727
  skip(".zed/agent-config.md already exists");
18528
18728
  return;
@@ -18543,7 +18743,7 @@ rules into your JetBrains profile.
18543
18743
  Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
18544
18744
  `;
18545
18745
  function ensure_jetbrains_bridge(project_root, force) {
18546
- const target = path16.join(project_root, ".jetbrains", "agent-config.md");
18746
+ const target = path17.join(project_root, ".jetbrains", "agent-config.md");
18547
18747
  if (pathExists(target) && !force) {
18548
18748
  skip(".jetbrains/agent-config.md already exists");
18549
18749
  return;
@@ -18574,7 +18774,7 @@ session. The canonical rule and skill source lives under \`.augment/\`
18574
18774
  See \`docs/setup/per-ide/kiro.md\` for the full activation guide.
18575
18775
  `;
18576
18776
  function ensure_kiro_bridge(project_root, force) {
18577
- const target = path16.join(project_root, ".kiro", "steering", "agent-config.md");
18777
+ const target = path17.join(project_root, ".kiro", "steering", "agent-config.md");
18578
18778
  if (pathExists(target) && !force) {
18579
18779
  skip(".kiro/steering/agent-config.md already exists");
18580
18780
  return;
@@ -18600,35 +18800,35 @@ var SMOKE_BRIDGE_PATHS = {
18600
18800
  };
18601
18801
  function dirHasEntries(p) {
18602
18802
  try {
18603
- return fs18.readdirSync(p).length > 0;
18803
+ return fs19.readdirSync(p).length > 0;
18604
18804
  } catch {
18605
18805
  return false;
18606
18806
  }
18607
18807
  }
18608
18808
  function _resolve_tsx_invocation(scriptPath, scriptArgs) {
18609
18809
  const binName = process3.platform === "win32" ? "tsx.cmd" : "tsx";
18610
- let dir = path16.dirname(scriptPath);
18810
+ let dir = path17.dirname(scriptPath);
18611
18811
  for (; ; ) {
18612
- const candidate = path16.join(dir, "node_modules", ".bin", binName);
18812
+ const candidate = path17.join(dir, "node_modules", ".bin", binName);
18613
18813
  if (isFile(candidate)) {
18614
18814
  return { command: candidate, args: [scriptPath, ...scriptArgs] };
18615
18815
  }
18616
- const parent = path16.dirname(dir);
18816
+ const parent = path17.dirname(dir);
18617
18817
  if (parent === dir) break;
18618
18818
  dir = parent;
18619
18819
  }
18620
18820
  return { command: "npx", args: ["tsx", scriptPath, ...scriptArgs] };
18621
18821
  }
18622
18822
  function _smoke_test_hooks(project_root, package_root) {
18623
- const dispatcher = path16.join(package_root, "scripts", "hooks", "dispatch_hook.ts");
18624
- const manifest = path16.join(package_root, "scripts", "hook_manifest.yaml");
18823
+ const dispatcher = path17.join(package_root, "scripts", "hooks", "dispatch_hook.ts");
18824
+ const manifest = path17.join(package_root, "scripts", "hook_manifest.yaml");
18625
18825
  if (!isFile(dispatcher) || !isFile(manifest)) return 0;
18626
18826
  const failed = [];
18627
18827
  const skipped = [];
18628
18828
  const passed = [];
18629
18829
  for (const [platform, native] of SMOKE_PROBE_EVENTS) {
18630
18830
  const rel_bridge = SMOKE_BRIDGE_PATHS[platform] ?? "";
18631
- const bridge_path = rel_bridge ? path16.join(project_root, rel_bridge) : null;
18831
+ const bridge_path = rel_bridge ? path17.join(project_root, rel_bridge) : null;
18632
18832
  const bridge_present = Boolean(
18633
18833
  bridge_path && (isFile(bridge_path) || isDir(bridge_path) && dirHasEntries(bridge_path))
18634
18834
  );
@@ -18828,9 +19028,9 @@ To remove this marker, delete this file.
18828
19028
  `;
18829
19029
  }
18830
19030
  var _CLAUDE_DESKTOP_BUNDLES_SUBPATH = "claude-desktop/bundles";
18831
- var GLOBAL_ROOT = path16.join(os7.homedir(), ".event4u", "agent-config");
18832
- var GLOBAL_USER_SETTINGS_PATH = path16.join(GLOBAL_ROOT, ".agent-user.yml");
18833
- var GLOBAL_AGENT_SETTINGS_PATH = path16.join(GLOBAL_ROOT, ".agent-settings.yml");
19031
+ var GLOBAL_ROOT = path17.join(os7.homedir(), ".event4u", "agent-config");
19032
+ var GLOBAL_USER_SETTINGS_PATH = path17.join(GLOBAL_ROOT, ".agent-user.yml");
19033
+ var GLOBAL_AGENT_SETTINGS_PATH = path17.join(GLOBAL_ROOT, ".agent-settings.yml");
18834
19034
  function _bridge_marker(tool_id, scope) {
18835
19035
  if (scope === "global") return USER_SCOPE_PATHS[tool_id] ?? "";
18836
19036
  return PROJECT_BRIDGE_MARKERS[tool_id] ?? "";
@@ -18879,7 +19079,7 @@ function _load_yaml_doc(p) {
18879
19079
  return _isPlainObject2(data) ? data : {};
18880
19080
  }
18881
19081
  function _load_default_settings(package_root) {
18882
- const template_source = path16.join(package_root, "src", "config", "agent-settings.template.yml");
19082
+ const template_source = path17.join(package_root, "src", "config", "agent-settings.template.yml");
18883
19083
  if (!pathExists(template_source)) return {};
18884
19084
  let text;
18885
19085
  try {
@@ -18893,11 +19093,11 @@ function _load_default_settings(package_root) {
18893
19093
  }
18894
19094
  var RULE_LAYER_CHOICES = ["global", "project", "both-acknowledged"];
18895
19095
  function _suppress_rule_layer(project_root, suppress_dir) {
18896
- const target = path16.join(project_root, ".claude", "settings.local.json");
19096
+ const target = path17.join(project_root, ".claude", "settings.local.json");
18897
19097
  const existing = pathExists(target) ? read_json_file(target) : {};
18898
19098
  let real_dir = suppress_dir;
18899
19099
  try {
18900
- real_dir = fs18.realpathSync(suppress_dir);
19100
+ real_dir = fs19.realpathSync(suppress_dir);
18901
19101
  } catch {
18902
19102
  real_dir = suppress_dir;
18903
19103
  }
@@ -18908,8 +19108,8 @@ function _suppress_rule_layer(project_root, suppress_dir) {
18908
19108
  success(`.claude/settings.local.json: claudeMdExcludes += ${entry}`);
18909
19109
  }
18910
19110
  function _gate_rule_layer_overlap(project_root, layer, dry_run) {
18911
- const global_dir = path16.join(os7.homedir(), ".claude", "rules");
18912
- const project_dir = path16.join(project_root, ".claude", "rules");
19111
+ const global_dir = path17.join(os7.homedir(), ".claude", "rules");
19112
+ const project_dir = path17.join(project_root, ".claude", "rules");
18913
19113
  const g = readRuleLayer(global_dir);
18914
19114
  const p = readRuleLayer(project_dir);
18915
19115
  if (g === null || p === null) return true;
@@ -19019,9 +19219,9 @@ function detect_scope(cwd) {
19019
19219
  if (pathExists(_resolve_settings_read(cwd))) {
19020
19220
  return ["project", `existing ${SETTINGS_FILE}`];
19021
19221
  }
19022
- const has_manifest = SCOPE_DETECT_MANIFESTS.find((m) => pathExists(path16.join(cwd, m))) ?? null;
19023
- const has_ai_dir = SCOPE_DETECT_AI_DIRS.find((d) => isDir(path16.join(cwd, d))) ?? null;
19024
- const has_ai_file = SCOPE_DETECT_AI_FILES.find((f) => pathExists(path16.join(cwd, f))) ?? null;
19222
+ const has_manifest = SCOPE_DETECT_MANIFESTS.find((m) => pathExists(path17.join(cwd, m))) ?? null;
19223
+ const has_ai_dir = SCOPE_DETECT_AI_DIRS.find((d) => isDir(path17.join(cwd, d))) ?? null;
19224
+ const has_ai_file = SCOPE_DETECT_AI_FILES.find((f) => pathExists(path17.join(cwd, f))) ?? null;
19025
19225
  if (has_manifest && (has_ai_dir || has_ai_file)) {
19026
19226
  const marker = has_ai_dir || has_ai_file;
19027
19227
  return ["prompt", `manifest (${has_manifest}) + AI-tool config (${marker})`];
@@ -19042,7 +19242,7 @@ function readLineSyncRaw(promptText) {
19042
19242
  for (; ; ) {
19043
19243
  let n;
19044
19244
  try {
19045
- n = fs18.readSync(0, buf, 0, 1, null);
19245
+ n = fs19.readSync(0, buf, 0, 1, null);
19046
19246
  } catch (err) {
19047
19247
  const code = err.code;
19048
19248
  if (code === "EAGAIN") {
@@ -19117,8 +19317,8 @@ function _files_by_tool_from_bridges(tools, project_root, scope) {
19117
19317
  const marker = _bridge_marker(tool_id, scope);
19118
19318
  if (!marker) continue;
19119
19319
  let marker_path = marker;
19120
- if (!path16.isAbsolute(marker_path)) {
19121
- marker_path = path16.join(project_root, marker_path);
19320
+ if (!path17.isAbsolute(marker_path)) {
19321
+ marker_path = path17.join(project_root, marker_path);
19122
19322
  }
19123
19323
  out[tool_id] = [_file_entry(marker_path, "bridge", false)];
19124
19324
  }
@@ -19157,26 +19357,26 @@ function _update_installed_tools_manifest(project_root, tools, scope, force, fil
19157
19357
  }
19158
19358
  write_manifest(target, version, entries);
19159
19359
  if (!state.QUIET) {
19160
- const rel = isRelativeTo(target, project_root) ? path16.relative(project_root, target) : target;
19360
+ const rel = isRelativeTo(target, project_root) ? path17.relative(project_root, target) : target;
19161
19361
  info(`Manifest updated: ${rel}`);
19162
19362
  }
19163
19363
  return 0;
19164
19364
  }
19165
19365
  function isRelativeTo(child, parent) {
19166
- const rel = path16.relative(parent, child);
19167
- return rel === "" || !rel.startsWith("..") && !path16.isAbsolute(rel);
19366
+ const rel = path17.relative(parent, child);
19367
+ return rel === "" || !rel.startsWith("..") && !path17.isAbsolute(rel);
19168
19368
  }
19169
19369
  function _resolve_package_root_for_global() {
19170
19370
  const here = resolvePath(_HERE2);
19171
- const candidate = path16.dirname(path16.dirname(path16.dirname(here)));
19172
- if (!pathExists(path16.join(candidate, "src", "config", "profiles", "minimal.ini"))) {
19371
+ const candidate = path17.dirname(path17.dirname(path17.dirname(here)));
19372
+ if (!pathExists(path17.join(candidate, "src", "config", "profiles", "minimal.ini"))) {
19173
19373
  fail(
19174
19374
  `Could not locate agent-config package root from ${here}. Expected src/config/profiles/minimal.ini at the parent directory.`
19175
19375
  );
19176
19376
  }
19177
19377
  return candidate;
19178
19378
  }
19179
- var CONSUMER_BRIDGE_MARKER_RELPATH = path16.join("agents", ".event4u-bridge.yml");
19379
+ var CONSUMER_BRIDGE_MARKER_RELPATH = path17.join("agents", ".event4u-bridge.yml");
19180
19380
  var MIGRATE_LEGACY_YAML_FILES = [".agent-settings.yml", ".agent-user.yml"];
19181
19381
  var MIGRATE_LEGACY_TOOL_DIRS = [".augment", ".claude", ".cursor"];
19182
19382
  var AGENT_CONFIG_PACKAGE_NAME = "@event4u/agent-config";
@@ -19184,7 +19384,7 @@ function _is_agent_config_source_repo(project_root) {
19184
19384
  if (process3.env["AGENT_CONFIG_CONSUMER_MODE"] === "1") {
19185
19385
  return [false, "consumer-mode-override"];
19186
19386
  }
19187
- const pkg_json = path16.join(project_root, "package.json");
19387
+ const pkg_json = path17.join(project_root, "package.json");
19188
19388
  if (isFile(pkg_json)) {
19189
19389
  let data = {};
19190
19390
  try {
@@ -19196,18 +19396,18 @@ function _is_agent_config_source_repo(project_root) {
19196
19396
  return [true, "package.json:name"];
19197
19397
  }
19198
19398
  }
19199
- if (isDir(path16.join(project_root, ".agent-src.uncondensed"))) {
19399
+ if (isDir(path17.join(project_root, ".agent-src.uncondensed"))) {
19200
19400
  return [true, ".agent-src.uncondensed/"];
19201
19401
  }
19202
- const packages_dir = path16.join(project_root, "packages");
19402
+ const packages_dir = path17.join(project_root, "packages");
19203
19403
  if (isDir(packages_dir)) {
19204
- for (const child of fs18.readdirSync(packages_dir)) {
19205
- if (isDir(path16.join(packages_dir, child, ".agent-src.uncondensed"))) {
19404
+ for (const child of fs19.readdirSync(packages_dir)) {
19405
+ if (isDir(path17.join(packages_dir, child, ".agent-src.uncondensed"))) {
19206
19406
  return [true, `packages/${child}/.agent-src.uncondensed/`];
19207
19407
  }
19208
19408
  }
19209
19409
  }
19210
- const installer_self = path16.join(project_root, "scripts", "install.py");
19410
+ const installer_self = path17.join(project_root, "scripts", "install.py");
19211
19411
  try {
19212
19412
  if (isFile(installer_self) && resolvePath(installer_self) === resolvePath(_HERE2)) {
19213
19413
  return [true, "src/scripts/install.py (self)"];
@@ -19227,17 +19427,17 @@ function _detect_legacy_for_migration(project_root) {
19227
19427
  }
19228
19428
  return [];
19229
19429
  }
19230
- if (isFile(path16.join(project_root, INSTALL_MODE_MARKER_REL))) return [];
19430
+ if (isFile(path17.join(project_root, INSTALL_MODE_MARKER_REL))) return [];
19231
19431
  const found = [];
19232
19432
  for (const name of MIGRATE_LEGACY_YAML_FILES) {
19233
- if (isFile(path16.join(project_root, name))) {
19433
+ if (isFile(path17.join(project_root, name))) {
19234
19434
  found.push(name);
19235
- } else if (isFile(path16.join(project_root, "settings", name))) {
19435
+ } else if (isFile(path17.join(project_root, "settings", name))) {
19236
19436
  found.push(`settings/${name}`);
19237
19437
  }
19238
19438
  }
19239
19439
  for (const name of MIGRATE_LEGACY_TOOL_DIRS) {
19240
- const p = path16.join(project_root, name);
19440
+ const p = path17.join(project_root, name);
19241
19441
  if (isDir(p) && !isSymlink(p)) {
19242
19442
  found.push(`${name}/`);
19243
19443
  }
@@ -19249,7 +19449,7 @@ function _prompt_migrate_to_global(project_root, artefacts) {
19249
19449
  process3.stdout.write("\n");
19250
19450
  warn("Legacy project-local artefacts detected \u2014 pre-ADR-020 layout:");
19251
19451
  for (const rel of artefacts) {
19252
- info(` ${path16.join(project_root, rel)}`);
19452
+ info(` ${path17.join(project_root, rel)}`);
19253
19453
  }
19254
19454
  info("The unified `agent-config migrate` sweeps these in one pass.");
19255
19455
  info("The wizard recreates fresh config afterwards.");
@@ -19280,20 +19480,20 @@ function _run_migrate_to_global(project_root) {
19280
19480
  function _format_global_root_for_marker(global_root) {
19281
19481
  const home = resolvePath(os7.homedir());
19282
19482
  const resolved = resolvePath(global_root);
19283
- const rel = path16.relative(home, resolved);
19284
- if (rel === "" || rel.startsWith("..") || path16.isAbsolute(rel)) {
19483
+ const rel = path17.relative(home, resolved);
19484
+ if (rel === "" || rel.startsWith("..") || path17.isAbsolute(rel)) {
19285
19485
  return global_root;
19286
19486
  }
19287
- return `~/${rel.split(path16.sep).join("/")}`;
19487
+ return `~/${rel.split(path17.sep).join("/")}`;
19288
19488
  }
19289
19489
  function _remove_legacy_consumer_bridge_marker(project_root, env = null) {
19290
19490
  const env_map = env ?? process3.env;
19291
19491
  if (env_map["AGENT_CONFIG_DEV_MODE"] === "1") return null;
19292
- if (isDir(path16.join(project_root, ".agent-src.uncondensed"))) return null;
19293
- const target = path16.join(project_root, CONSUMER_BRIDGE_MARKER_RELPATH);
19492
+ if (isDir(path17.join(project_root, ".agent-src.uncondensed"))) return null;
19493
+ const target = path17.join(project_root, CONSUMER_BRIDGE_MARKER_RELPATH);
19294
19494
  if (!isFile(target)) return null;
19295
19495
  try {
19296
- fs18.rmSync(target);
19496
+ fs19.rmSync(target);
19297
19497
  } catch {
19298
19498
  return null;
19299
19499
  }
@@ -19307,7 +19507,7 @@ var PROJECT_ANCHOR_TOOLS = {
19307
19507
  function _write_per_tool_project_anchors(project_root, tools, env = null, now = null) {
19308
19508
  const env_map = env ?? process3.env;
19309
19509
  if (env_map["AGENT_CONFIG_DEV_MODE"] === "1") return [];
19310
- if (isDir(path16.join(project_root, ".agent-src.uncondensed"))) return [];
19510
+ if (isDir(path17.join(project_root, ".agent-src.uncondensed"))) return [];
19311
19511
  const global_root_str = _format_global_root_for_marker(
19312
19512
  event4u_root(env_map)
19313
19513
  );
@@ -19316,8 +19516,8 @@ function _write_per_tool_project_anchors(project_root, tools, env = null, now =
19316
19516
  for (const tool_id of Object.keys(PROJECT_ANCHOR_TOOLS).sort()) {
19317
19517
  const rel_path = PROJECT_ANCHOR_TOOLS[tool_id];
19318
19518
  if (!tools.has(tool_id)) continue;
19319
- const target = path16.join(project_root, rel_path);
19320
- mkdirp(path16.dirname(target));
19519
+ const target = path17.join(project_root, rel_path);
19520
+ mkdirp(path17.dirname(target));
19321
19521
  const body = `# event4u/agent-config \u2014 per-tool project anchor (auto-written).
19322
19522
  # Spec: docs/contracts/consumer-bridge.md \xA7 Per-tool anchor strategy.
19323
19523
  # Tool: ${tool_id}. Resolves the global install directly \u2014 no
@@ -19335,7 +19535,7 @@ installed_at: ${stamp}
19335
19535
  }
19336
19536
  var PACKAGE_TAG_ID = "event4u/agent-config";
19337
19537
  function _inject_package_tag(target, source, package_root) {
19338
- if (path16.extname(target) !== ".md") return;
19538
+ if (path17.extname(target) !== ".md") return;
19339
19539
  let text;
19340
19540
  try {
19341
19541
  text = readText(target);
@@ -19363,8 +19563,8 @@ function _inject_package_tag(target, source, package_root) {
19363
19563
  resolved_src = source;
19364
19564
  }
19365
19565
  if (package_root !== null) {
19366
- const rel = path16.relative(resolvePath(package_root), resolved_src);
19367
- if (rel !== "" && !rel.startsWith("..") && !path16.isAbsolute(rel)) {
19566
+ const rel = path17.relative(resolvePath(package_root), resolved_src);
19567
+ if (rel !== "" && !rel.startsWith("..") && !path17.isAbsolute(rel)) {
19368
19568
  source_value = rel;
19369
19569
  } else {
19370
19570
  source_value = resolved_src;
@@ -19399,7 +19599,7 @@ function _escapes_package_root(resolved, package_root) {
19399
19599
  if (package_root === null) return false;
19400
19600
  let root;
19401
19601
  try {
19402
- root = fs18.realpathSync(package_root);
19602
+ root = fs19.realpathSync(package_root);
19403
19603
  } catch {
19404
19604
  return false;
19405
19605
  }
@@ -19414,7 +19614,7 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
19414
19614
  if (file_filter !== null && !file_filter(src)) return [0, 0, written_paths];
19415
19615
  let resolved_src = src;
19416
19616
  try {
19417
- resolved_src = fs18.realpathSync(src);
19617
+ resolved_src = fs19.realpathSync(src);
19418
19618
  } catch {
19419
19619
  resolved_src = src;
19420
19620
  }
@@ -19422,10 +19622,10 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
19422
19622
  warn(`refused: ${src} dereferences outside the package root \u2014 not copied`);
19423
19623
  return [0, 0, written_paths];
19424
19624
  }
19425
- mkdirp(path16.dirname(dest));
19625
+ mkdirp(path17.dirname(dest));
19426
19626
  const decision = _resolve_file_conflict(dest, force);
19427
19627
  if (decision === "skip") return [0, 1, written_paths];
19428
- fs18.copyFileSync(src, dest);
19628
+ fs19.copyFileSync(src, dest);
19429
19629
  _inject_package_tag(dest, src, package_root);
19430
19630
  written_paths.push(dest);
19431
19631
  return [1, 0, written_paths];
@@ -19433,11 +19633,11 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
19433
19633
  mkdirp(dest);
19434
19634
  const walk = (node) => {
19435
19635
  const acc = [];
19436
- const names = fs18.readdirSync(node).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
19636
+ const names = fs19.readdirSync(node).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
19437
19637
  for (const name of names) {
19438
- const entry = path16.join(node, name);
19638
+ const entry = path17.join(node, name);
19439
19639
  acc.push(entry);
19440
- const lst = fs18.lstatSync(entry);
19640
+ const lst = fs19.lstatSync(entry);
19441
19641
  if (lst.isDirectory() && !lst.isSymbolicLink()) {
19442
19642
  acc.push(...walk(entry));
19443
19643
  }
@@ -19445,9 +19645,9 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
19445
19645
  return acc;
19446
19646
  };
19447
19647
  for (const entry of walk(src)) {
19448
- const rel = path16.relative(src, entry);
19449
- const target = path16.join(dest, rel);
19450
- const lst = fs18.lstatSync(entry);
19648
+ const rel = path17.relative(src, entry);
19649
+ const target = path17.join(dest, rel);
19650
+ const lst = fs19.lstatSync(entry);
19451
19651
  if (lst.isDirectory() && !lst.isSymbolicLink()) {
19452
19652
  mkdirp(target);
19453
19653
  continue;
@@ -19455,8 +19655,8 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
19455
19655
  let resolvedIsDir = false;
19456
19656
  let resolved = entry;
19457
19657
  try {
19458
- resolved = fs18.realpathSync(entry);
19459
- resolvedIsDir = fs18.statSync(entry).isDirectory();
19658
+ resolved = fs19.realpathSync(entry);
19659
+ resolvedIsDir = fs19.statSync(entry).isDirectory();
19460
19660
  } catch {
19461
19661
  resolvedIsDir = false;
19462
19662
  }
@@ -19486,8 +19686,8 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
19486
19686
  skipped += 1;
19487
19687
  continue;
19488
19688
  }
19489
- mkdirp(path16.dirname(target));
19490
- fs18.copyFileSync(resolved, target);
19689
+ mkdirp(path17.dirname(target));
19690
+ fs19.copyFileSync(resolved, target);
19491
19691
  _inject_package_tag(target, resolved, package_root);
19492
19692
  written += 1;
19493
19693
  written_paths.push(target);
@@ -19499,7 +19699,7 @@ function _claude_desktop_bundles_dir() {
19499
19699
  }
19500
19700
  function _write_claude_desktop_marker(_force, lockfile_path2, bundles_dir, bundle_count) {
19501
19701
  const anchor = expanduser6(USER_SCOPE_PATHS["claude-desktop"]);
19502
- const target = path16.join(anchor, "agent-config.md");
19702
+ const target = path17.join(anchor, "agent-config.md");
19503
19703
  mkdirp(anchor);
19504
19704
  const body = claudeDesktopMarkerBody(lockfile_path2, anchor, bundles_dir, bundle_count);
19505
19705
  writeText(target, body);
@@ -19523,23 +19723,23 @@ function _apply_claude_flat_command_wrappers(anchor, package_root, current_files
19523
19723
  const wrapped = [];
19524
19724
  const collisions = [];
19525
19725
  const reserved = [];
19526
- const commands_dir = path16.join(anchor, "commands");
19726
+ const commands_dir = path17.join(anchor, "commands");
19527
19727
  let flat_entries = [];
19528
19728
  try {
19529
- flat_entries = fs18.readdirSync(commands_dir).filter((f) => f.endsWith(".md"));
19729
+ flat_entries = fs19.readdirSync(commands_dir).filter((f) => f.endsWith(".md"));
19530
19730
  } catch {
19531
19731
  }
19532
19732
  for (const fname of flat_entries.sort()) {
19533
19733
  const slug = fname.slice(0, -".md".length);
19534
19734
  if (!is_claude_builtin_name(slug)) continue;
19535
- fs18.rmSync(path16.join(commands_dir, fname), { force: true });
19735
+ fs19.rmSync(path17.join(commands_dir, fname), { force: true });
19536
19736
  current_files.delete(`commands/${fname}`);
19537
19737
  reserved.push(slug);
19538
19738
  }
19539
19739
  const eligible = new Set(_CLAUDE_FLAT_WRAPPER_EXTRA);
19540
19740
  try {
19541
19741
  const manifest = JSON.parse(
19542
- fs18.readFileSync(path16.join(package_root, "dist", "discovery", "discovery-manifest.json"), "utf8")
19742
+ fs19.readFileSync(path17.join(package_root, "dist", "discovery", "discovery-manifest.json"), "utf8")
19543
19743
  );
19544
19744
  for (const a of manifest.artefacts ?? []) {
19545
19745
  if (a.category !== "command" || typeof a.slug !== "string") continue;
@@ -19550,22 +19750,22 @@ function _apply_claude_flat_command_wrappers(anchor, package_root, current_files
19550
19750
  }
19551
19751
  for (const slug of [...eligible].sort()) {
19552
19752
  const flat_rel = `commands/${slug}.md`;
19553
- const flat_abs = path16.join(anchor, "commands", `${slug}.md`);
19554
- if (!fs18.existsSync(flat_abs)) continue;
19555
- const skill_dir = path16.join(anchor, "skills", slug);
19556
- if (fs18.existsSync(skill_dir)) {
19753
+ const flat_abs = path17.join(anchor, "commands", `${slug}.md`);
19754
+ if (!fs19.existsSync(flat_abs)) continue;
19755
+ const skill_dir = path17.join(anchor, "skills", slug);
19756
+ if (fs19.existsSync(skill_dir)) {
19557
19757
  collisions.push(slug);
19558
19758
  continue;
19559
19759
  }
19560
- let body = fs18.readFileSync(flat_abs, "utf8");
19760
+ let body = fs19.readFileSync(flat_abs, "utf8");
19561
19761
  if (body.startsWith("---\n") && !/^name:/m.test(body.split("\n---")[0] ?? "")) {
19562
19762
  body = body.replace("---\n", `---
19563
19763
  name: ${slug}
19564
19764
  `);
19565
19765
  }
19566
- fs18.mkdirSync(skill_dir, { recursive: true });
19567
- fs18.writeFileSync(path16.join(skill_dir, "SKILL.md"), body, "utf8");
19568
- fs18.rmSync(flat_abs, { force: true });
19766
+ fs19.mkdirSync(skill_dir, { recursive: true });
19767
+ fs19.writeFileSync(path17.join(skill_dir, "SKILL.md"), body, "utf8");
19768
+ fs19.rmSync(flat_abs, { force: true });
19569
19769
  current_files.delete(flat_rel);
19570
19770
  current_files.add(`skills/${slug}/SKILL.md`);
19571
19771
  wrapped.push(slug);
@@ -19597,8 +19797,8 @@ function _deploy_global_content(tools, force, package_root, lockfile_path2) {
19597
19797
  const written_paths = [];
19598
19798
  let current_files = /* @__PURE__ */ new Set();
19599
19799
  for (const [src_rel, dest_sub] of plan) {
19600
- const src = path16.join(package_root, src_rel);
19601
- const dest = dest_sub ? path16.join(anchor, dest_sub) : anchor;
19800
+ const src = path17.join(package_root, src_rel);
19801
+ const dest = dest_sub ? path17.join(anchor, dest_sub) : anchor;
19602
19802
  const rule_filter = _rule_filter_for_source(src_rel, rule_scope);
19603
19803
  const [w, s, paths] = _copy_dir_dereferencing_symlinks(
19604
19804
  src,
@@ -19672,10 +19872,10 @@ function _deploy_global_content(tools, force, package_root, lockfile_path2) {
19672
19872
  results[tool_id] = [written_total, skipped_total, "deployed", written_paths];
19673
19873
  if (tool_id === "claude-code") {
19674
19874
  try {
19675
- const manifest = path16.join(package_root, "src", "scripts", "hook_manifest.yaml");
19875
+ const manifest = path17.join(package_root, "src", "scripts", "hook_manifest.yaml");
19676
19876
  const matrix = build_claude_hook_matrix(manifest);
19677
19877
  const res = ensure_managed_hooks(
19678
- path16.join(anchor, "settings.json"),
19878
+ path17.join(anchor, "settings.json"),
19679
19879
  matrix
19680
19880
  );
19681
19881
  if (!state.QUIET) {
@@ -19712,7 +19912,7 @@ function _preview_global_reap(tools, package_root) {
19712
19912
  const anchor = expanduser6(anchor_raw);
19713
19913
  let current_files = /* @__PURE__ */ new Set();
19714
19914
  for (const [src_rel, dest_sub] of plan) {
19715
- const src = path16.join(package_root, src_rel);
19915
+ const src = path17.join(package_root, src_rel);
19716
19916
  current_files = setUnion(
19717
19917
  current_files,
19718
19918
  expected_deploy_files(
@@ -19746,14 +19946,14 @@ function _preview_global_reap(tools, package_root) {
19746
19946
  function _verify_deploy_targets(anchor, plan) {
19747
19947
  const missing = [];
19748
19948
  for (const [, dest_sub] of plan) {
19749
- const target = dest_sub ? path16.join(anchor, dest_sub) : anchor;
19949
+ const target = dest_sub ? path17.join(anchor, dest_sub) : anchor;
19750
19950
  const label = dest_sub || ".";
19751
19951
  if (!isDir(target)) {
19752
19952
  missing.push(label);
19753
19953
  continue;
19754
19954
  }
19755
19955
  try {
19756
- const entries = fs18.readdirSync(target);
19956
+ const entries = fs19.readdirSync(target);
19757
19957
  if (entries.length === 0) missing.push(label);
19758
19958
  } catch {
19759
19959
  missing.push(label);
@@ -19768,13 +19968,13 @@ function _prune_modules_by(deploy_results, is_pruned) {
19768
19968
  const [written, skipped, status, paths] = deploy_results[tool_id];
19769
19969
  const pruned_skill_dirs = /* @__PURE__ */ new Set();
19770
19970
  for (const p of paths) {
19771
- const parts = p.split(path16.sep);
19971
+ const parts = p.split(path17.sep);
19772
19972
  if (parts.includes("skills")) {
19773
19973
  const i = parts.indexOf("skills");
19774
19974
  if (i + 1 < parts.length) {
19775
- const skill_root = parts.slice(0, i + 2).join(path16.sep);
19975
+ const skill_root = parts.slice(0, i + 2).join(path17.sep);
19776
19976
  if (!pruned_skill_dirs.has(skill_root)) {
19777
- const skillmd = path16.join(skill_root, "SKILL.md");
19977
+ const skillmd = path17.join(skill_root, "SKILL.md");
19778
19978
  if (pathExists(skillmd) && is_pruned(skillmd)) {
19779
19979
  pruned_skill_dirs.add(skill_root);
19780
19980
  }
@@ -19785,25 +19985,25 @@ function _prune_modules_by(deploy_results, is_pruned) {
19785
19985
  const keep = [];
19786
19986
  const delete_files = [];
19787
19987
  for (const p of paths) {
19788
- const parts = p.split(path16.sep);
19988
+ const parts = p.split(path17.sep);
19789
19989
  let is_target = false;
19790
19990
  if (parts.includes("skills")) {
19791
19991
  const i = parts.indexOf("skills");
19792
- if (i + 1 < parts.length && pruned_skill_dirs.has(parts.slice(0, i + 2).join(path16.sep))) {
19992
+ if (i + 1 < parts.length && pruned_skill_dirs.has(parts.slice(0, i + 2).join(path17.sep))) {
19793
19993
  is_target = true;
19794
19994
  }
19795
- } else if (parts.includes("commands") && path16.extname(p) === ".md" && is_pruned(p)) {
19995
+ } else if (parts.includes("commands") && path17.extname(p) === ".md" && is_pruned(p)) {
19796
19996
  is_target = true;
19797
19997
  }
19798
19998
  (is_target ? delete_files : keep).push(p);
19799
19999
  }
19800
20000
  for (const d of pruned_skill_dirs) {
19801
- fs18.rmSync(d, { recursive: true, force: true });
20001
+ fs19.rmSync(d, { recursive: true, force: true });
19802
20002
  }
19803
20003
  for (const p of delete_files) {
19804
- if (p.split(path16.sep).includes("commands") && pathExists(p)) {
20004
+ if (p.split(path17.sep).includes("commands") && pathExists(p)) {
19805
20005
  try {
19806
- fs18.unlinkSync(p);
20006
+ fs19.unlinkSync(p);
19807
20007
  } catch {
19808
20008
  }
19809
20009
  }
@@ -19824,9 +20024,9 @@ function _resolve_global_settings_doc() {
19824
20024
  }
19825
20025
  function _resolve_global_settings_path() {
19826
20026
  const root = event4u_root();
19827
- const canonical = path16.join(root, "settings", SETTINGS_FILE);
20027
+ const canonical = path17.join(root, "settings", SETTINGS_FILE);
19828
20028
  if (pathExists(canonical)) return canonical;
19829
- const legacy = path16.join(root, SETTINGS_FILE);
20029
+ const legacy = path17.join(root, SETTINGS_FILE);
19830
20030
  if (pathExists(legacy)) return legacy;
19831
20031
  return null;
19832
20032
  }
@@ -19937,7 +20137,7 @@ function install_global(tools, force, project_root = null, core_only = false) {
19937
20137
  info(` schema_version=1, agent_config_version=${installed_version}`);
19938
20138
  info(` tools=${merged_tools.join(",")}`);
19939
20139
  }
19940
- if (project_root !== null && pathExists(_resolve_settings_read(project_root)) && !isDir(path16.join(project_root, ".agent-src.uncondensed"))) {
20140
+ if (project_root !== null && pathExists(_resolve_settings_read(project_root)) && !isDir(path17.join(project_root, ".agent-src.uncondensed"))) {
19941
20141
  const drift = collect_drift(project_root);
19942
20142
  if (!state.QUIET) {
19943
20143
  process3.stdout.write("\n");
@@ -20037,19 +20237,19 @@ function install_global(tools, force, project_root = null, core_only = false) {
20037
20237
  }
20038
20238
  }
20039
20239
  }
20040
- if (project_root !== null && pathExists(_resolve_settings_read(project_root)) && !isDir(path16.join(project_root, ".agent-src.uncondensed"))) {
20240
+ if (project_root !== null && pathExists(_resolve_settings_read(project_root)) && !isDir(path17.join(project_root, ".agent-src.uncondensed"))) {
20041
20241
  const files_by_tool = _files_by_tool_from_deploy(deploy_results);
20042
20242
  const rc = _update_installed_tools_manifest(project_root, tools, "global", force, files_by_tool);
20043
20243
  if (rc !== 0) return rc;
20044
20244
  const removed_marker = _remove_legacy_consumer_bridge_marker(project_root);
20045
20245
  if (removed_marker !== null && !state.QUIET) {
20046
- const rel = isRelativeTo(removed_marker, project_root) ? path16.relative(project_root, removed_marker) : removed_marker;
20246
+ const rel = isRelativeTo(removed_marker, project_root) ? path17.relative(project_root, removed_marker) : removed_marker;
20047
20247
  info(`Removed legacy bridge marker: ${rel}`);
20048
20248
  }
20049
20249
  const anchor_paths = _write_per_tool_project_anchors(project_root, tools);
20050
20250
  if (anchor_paths.length > 0 && !state.QUIET) {
20051
20251
  for (const p of anchor_paths) {
20052
- const rel = isRelativeTo(p, project_root) ? path16.relative(project_root, p) : p;
20252
+ const rel = isRelativeTo(p, project_root) ? path17.relative(project_root, p) : p;
20053
20253
  info(`Project anchor written: ${rel}`);
20054
20254
  }
20055
20255
  }
@@ -20059,6 +20259,23 @@ function install_global(tools, force, project_root = null, core_only = false) {
20059
20259
  } catch (e) {
20060
20260
  if (!state.QUIET) warn(`settings-surface snapshot failed \u2014 ${String(e)}`);
20061
20261
  }
20262
+ if (!state.QUIET) {
20263
+ try {
20264
+ for (const line of _catalogue_truncation_warnings(deploy_results, project_root)) {
20265
+ warn(line);
20266
+ }
20267
+ const notice = _scoped_migration_notice(deploy_results, project_root, package_root, {
20268
+ env: process3.env,
20269
+ stdinTty: process3.stdin.isTTY === true,
20270
+ stdoutTty: process3.stdout.isTTY === true
20271
+ });
20272
+ if (notice.length > 0) {
20273
+ process3.stdout.write("\n");
20274
+ for (const line of notice) info(line);
20275
+ }
20276
+ } catch {
20277
+ }
20278
+ }
20062
20279
  if (!state.QUIET) {
20063
20280
  process3.stdout.write("\n");
20064
20281
  success(`Global install completed (v${installed_version}).`);
@@ -20066,8 +20283,59 @@ function install_global(tools, force, project_root = null, core_only = false) {
20066
20283
  }
20067
20284
  return 0;
20068
20285
  }
20069
- var SETTINGS_SURFACE_REL = path16.join("state", "settings-surface.json");
20070
- var SETTINGS_DELTA_REL = path16.join("state", "settings-delta.json");
20286
+ function _catalogue_truncation_warnings(deploy_results, project_root) {
20287
+ const log_candidates = [
20288
+ path17.join(event4u_root(), "state", "skill-catalogue.jsonl"),
20289
+ ...project_root ? [path17.join(project_root, OBSERVATION_LOG)] : []
20290
+ ];
20291
+ const records = log_candidates.flatMap((p) => readObservationLog(p));
20292
+ if (records.length === 0) return [];
20293
+ const limits = knownHostLimits(records);
20294
+ if (limits.size === 0) return [];
20295
+ const lines = [];
20296
+ for (const tool_id of Object.keys(deploy_results).sort()) {
20297
+ const [, , status] = deploy_results[tool_id];
20298
+ if (status !== "deployed") continue;
20299
+ const limit = limits.get(tool_id);
20300
+ if (limit === void 0) continue;
20301
+ const anchor_raw = USER_SCOPE_PATHS[tool_id];
20302
+ if (!anchor_raw) continue;
20303
+ const volume = measureCatalogueVolume(tool_id, expanduser6(anchor_raw));
20304
+ const warning = catalogueLimitWarning(volume, limit);
20305
+ if (warning !== null) lines.push(warning);
20306
+ }
20307
+ return lines;
20308
+ }
20309
+ function _scoped_migration_notice(deploy_results, project_root, package_root, probe) {
20310
+ if (!isInteractiveSession(probe)) return [];
20311
+ const log_candidates = [
20312
+ path17.join(event4u_root(), "state", "skill-catalogue.jsonl"),
20313
+ ...project_root ? [path17.join(project_root, OBSERVATION_LOG)] : []
20314
+ ];
20315
+ const limits = knownHostLimits(log_candidates.flatMap((p) => readObservationLog(p)));
20316
+ if (limits.size === 0) return [];
20317
+ const resolved = _resolve_scoped_projection(package_root);
20318
+ const settings_path = _resolve_global_settings_path() ?? path17.join(event4u_root(), "settings", SETTINGS_FILE);
20319
+ for (const tool_id of Object.keys(deploy_results).sort()) {
20320
+ const [, , status] = deploy_results[tool_id];
20321
+ if (status !== "deployed") continue;
20322
+ const anchor_raw = USER_SCOPE_PATHS[tool_id];
20323
+ if (!anchor_raw) continue;
20324
+ const volume = measureCatalogueVolume(tool_id, expanduser6(anchor_raw));
20325
+ const eligibility = migrationEligibility(
20326
+ tool_id,
20327
+ resolved.mode,
20328
+ volume.skillEntries,
20329
+ limits
20330
+ );
20331
+ if (eligibility.eligible) {
20332
+ return migrationPromptLines(tool_id, eligibility, settings_path);
20333
+ }
20334
+ }
20335
+ return [];
20336
+ }
20337
+ var SETTINGS_SURFACE_REL = path17.join("state", "settings-surface.json");
20338
+ var SETTINGS_DELTA_REL = path17.join("state", "settings-delta.json");
20071
20339
  function _current_settings_surface(version) {
20072
20340
  const jsonSchema = zodToJsonSchema(settingsSchema, {
20073
20341
  name: "AgentSettings",
@@ -20078,20 +20346,20 @@ function _current_settings_surface(version) {
20078
20346
  }
20079
20347
  function _write_settings_surface_snapshot(installed_version) {
20080
20348
  const root = event4u_root();
20081
- const surface_path = path16.join(root, SETTINGS_SURFACE_REL);
20082
- const delta_path = path16.join(root, SETTINGS_DELTA_REL);
20349
+ const surface_path = path17.join(root, SETTINGS_SURFACE_REL);
20350
+ const delta_path = path17.join(root, SETTINGS_DELTA_REL);
20083
20351
  const next = _current_settings_surface(installed_version);
20084
20352
  let previous = null;
20085
20353
  try {
20086
- const parsed = JSON.parse(fs18.readFileSync(surface_path, "utf8"));
20354
+ const parsed = JSON.parse(fs19.readFileSync(surface_path, "utf8"));
20087
20355
  if (parsed !== null && typeof parsed === "object" && parsed.entries !== void 0) previous = parsed;
20088
20356
  } catch {
20089
20357
  }
20090
20358
  if (previous !== null && previous.version !== next.version) {
20091
20359
  const delta = computeSurfaceDelta(previous, next);
20092
20360
  if (delta.changes.length > 0) {
20093
- fs18.mkdirSync(path16.dirname(delta_path), { recursive: true, mode: 448 });
20094
- fs18.writeFileSync(delta_path, `${JSON.stringify(delta, null, 2)}
20361
+ fs19.mkdirSync(path17.dirname(delta_path), { recursive: true, mode: 448 });
20362
+ fs19.writeFileSync(delta_path, `${JSON.stringify(delta, null, 2)}
20095
20363
  `, { mode: 384 });
20096
20364
  if (!state.QUIET) {
20097
20365
  const counts = {};
@@ -20103,8 +20371,8 @@ function _write_settings_surface_snapshot(installed_version) {
20103
20371
  }
20104
20372
  }
20105
20373
  }
20106
- fs18.mkdirSync(path16.dirname(surface_path), { recursive: true, mode: 448 });
20107
- fs18.writeFileSync(surface_path, `${JSON.stringify(next, null, 2)}
20374
+ fs19.mkdirSync(path17.dirname(surface_path), { recursive: true, mode: 448 });
20375
+ fs19.writeFileSync(surface_path, `${JSON.stringify(next, null, 2)}
20108
20376
  `, { mode: 384 });
20109
20377
  }
20110
20378
  function arrayStrEqual(a, b) {
@@ -20324,13 +20592,13 @@ function _minimal_templates_root() {
20324
20592
  const chain = [start];
20325
20593
  let cur = start;
20326
20594
  for (; ; ) {
20327
- const parent = path16.dirname(cur);
20595
+ const parent = path17.dirname(cur);
20328
20596
  if (parent === cur) break;
20329
20597
  chain.push(parent);
20330
20598
  cur = parent;
20331
20599
  }
20332
20600
  for (const ancestor of chain) {
20333
- const candidate = path16.join(ancestor, "src", "templates", "minimal");
20601
+ const candidate = path17.join(ancestor, "src", "templates", "minimal");
20334
20602
  if (isDir(candidate)) return candidate;
20335
20603
  }
20336
20604
  fail("Could not locate src/templates/minimal/ \u2014 package install is corrupt.");
@@ -20338,9 +20606,9 @@ function _minimal_templates_root() {
20338
20606
  var INSTALL_MODE_MARKER_REL = "agents/.agent-state/install-mode.txt";
20339
20607
  function _write_install_mode_marker(project_root, mode) {
20340
20608
  if (mode !== "minimal" && mode !== "full") return;
20341
- const marker = path16.join(project_root, INSTALL_MODE_MARKER_REL);
20609
+ const marker = path17.join(project_root, INSTALL_MODE_MARKER_REL);
20342
20610
  try {
20343
- mkdirp(path16.dirname(marker));
20611
+ mkdirp(path17.dirname(marker));
20344
20612
  writeText(marker, `${mode}
20345
20613
  `);
20346
20614
  } catch {
@@ -20349,7 +20617,7 @@ function _write_install_mode_marker(project_root, mode) {
20349
20617
  function install_minimal(target_root_in, force, user_type = "") {
20350
20618
  let target_root = resolvePath(target_root_in);
20351
20619
  mkdirp(target_root);
20352
- const parent = path16.dirname(target_root);
20620
+ const parent = path17.dirname(target_root);
20353
20621
  if (parent !== target_root) {
20354
20622
  const existing = find_project_root_with_anchor(parent);
20355
20623
  if (existing !== null && existing[0] !== target_root) {
@@ -20360,21 +20628,21 @@ function install_minimal(target_root_in, force, user_type = "") {
20360
20628
  }
20361
20629
  }
20362
20630
  const templates = _minimal_templates_root();
20363
- const settings_src = path16.join(templates, SETTINGS_FILE);
20364
- const overrides_gitkeep_src = path16.join(templates, "overrides-gitkeep");
20365
- const overrides_readme_src = path16.join(templates, "agents-overrides-readme.md");
20631
+ const settings_src = path17.join(templates, SETTINGS_FILE);
20632
+ const overrides_gitkeep_src = path17.join(templates, "overrides-gitkeep");
20633
+ const overrides_readme_src = path17.join(templates, "agents-overrides-readme.md");
20366
20634
  if (!isFile(settings_src)) fail(`Bundled minimal settings template missing under ${templates}`);
20367
20635
  if (!isFile(overrides_gitkeep_src) || !isFile(overrides_readme_src)) {
20368
20636
  fail(`Bundled overrides scaffold templates missing under ${templates}`);
20369
20637
  }
20370
20638
  info(`Minimal init \u2192 ${target_root}`);
20371
- const overrides_root = path16.join(target_root, "agents", "overrides");
20639
+ const overrides_root = path17.join(target_root, "agents", "overrides");
20372
20640
  mkdirp(overrides_root);
20373
20641
  const gitkeep_body = readText(overrides_gitkeep_src);
20374
20642
  for (const sub of ["rules", "skills", "commands"]) {
20375
- const sub_dir = path16.join(overrides_root, sub);
20643
+ const sub_dir = path17.join(overrides_root, sub);
20376
20644
  mkdirp(sub_dir);
20377
- const gitkeep_dst = path16.join(sub_dir, ".gitkeep");
20645
+ const gitkeep_dst = path17.join(sub_dir, ".gitkeep");
20378
20646
  if (pathExists(gitkeep_dst) && !force) {
20379
20647
  skip(`agents/overrides/${sub}/.gitkeep already exists (use --force to overwrite)`);
20380
20648
  } else {
@@ -20382,7 +20650,7 @@ function install_minimal(target_root_in, force, user_type = "") {
20382
20650
  success(`Wrote agents/overrides/${sub}/.gitkeep`);
20383
20651
  }
20384
20652
  }
20385
- const readme_dst = path16.join(overrides_root, "README.md");
20653
+ const readme_dst = path17.join(overrides_root, "README.md");
20386
20654
  if (pathExists(readme_dst) && !force) {
20387
20655
  skip("agents/overrides/README.md already exists (use --force to overwrite)");
20388
20656
  } else {
@@ -20400,14 +20668,14 @@ function install_minimal(target_root_in, force, user_type = "") {
20400
20668
  personal:
20401
20669
  user_type: ${user_type}
20402
20670
  `;
20403
- mkdirp(path16.dirname(settings_dst));
20671
+ mkdirp(path17.dirname(settings_dst));
20404
20672
  writeText(settings_dst, body);
20405
20673
  success(`Wrote ${SETTINGS_FILE} (user_type=${user_type})`);
20406
20674
  }
20407
20675
  }
20408
20676
  const removed_marker = _remove_legacy_consumer_bridge_marker(target_root);
20409
20677
  if (removed_marker !== null) {
20410
- const rel = isRelativeTo(removed_marker, target_root) ? path16.relative(target_root, removed_marker) : removed_marker;
20678
+ const rel = isRelativeTo(removed_marker, target_root) ? path17.relative(target_root, removed_marker) : removed_marker;
20411
20679
  success(`Removed legacy bridge marker: ${rel}`);
20412
20680
  }
20413
20681
  _write_install_mode_marker(target_root, "minimal");
@@ -20481,7 +20749,7 @@ function run_interactive_init(project_root, force) {
20481
20749
  );
20482
20750
  return 0;
20483
20751
  }
20484
- const target = path16.join(project_root, _LOCAL_CONFIG_FILE);
20752
+ const target = path17.join(project_root, _LOCAL_CONFIG_FILE);
20485
20753
  if (pathExists(target) && !force) {
20486
20754
  warn(
20487
20755
  `${_LOCAL_CONFIG_FILE} already exists; re-run with --force to overwrite. Skipping interactive init.`
@@ -20508,7 +20776,7 @@ function run_interactive_init(project_root, force) {
20508
20776
  warn(`Could not write ${target}: ${String(exc)}`);
20509
20777
  return 1;
20510
20778
  }
20511
- success(`Wrote ${path16.relative(project_root, target)} (${user_type} / ${stack} / ${verbosity})`);
20779
+ success(`Wrote ${path17.relative(project_root, target)} (${user_type} / ${stack} / ${verbosity})`);
20512
20780
  return 0;
20513
20781
  }
20514
20782
  var _WIZARD_READY_RE = /^WIZARD_READY (http:\/\/(?:127\.0\.0\.1|localhost):\d+\/\S*)\r?$/;
@@ -20526,12 +20794,12 @@ function _wizard_should_launch(opts) {
20526
20794
  return [true, ""];
20527
20795
  }
20528
20796
  function _wizard_cli_dist(_project_root) {
20529
- const package_root = path16.dirname(path16.dirname(path16.dirname(resolvePath(_HERE2))));
20530
- const cli = path16.join(package_root, "dist", "cli", "agent-config.js");
20797
+ const package_root = path17.dirname(path17.dirname(path17.dirname(resolvePath(_HERE2))));
20798
+ const cli = path17.join(package_root, "dist", "cli", "agent-config.js");
20531
20799
  return pathExists(cli) ? cli : null;
20532
20800
  }
20533
20801
  function _server_info_path() {
20534
- return path16.join(os7.homedir(), ".event4u", "agent-config", "local-server.json");
20802
+ return path17.join(os7.homedir(), ".event4u", "agent-config", "local-server.json");
20535
20803
  }
20536
20804
  function _pid_is_agent_config(pid) {
20537
20805
  let res;
@@ -20548,7 +20816,7 @@ function _pid_is_agent_config(pid) {
20548
20816
  }
20549
20817
  function unlinkMissingOk(p) {
20550
20818
  try {
20551
- fs18.unlinkSync(p);
20819
+ fs19.unlinkSync(p);
20552
20820
  } catch {
20553
20821
  }
20554
20822
  }
@@ -20626,14 +20894,14 @@ function _wizard_spawn(project_root, pass_project_root = true) {
20626
20894
  }
20627
20895
  function _wizard_run_sync(cmd, env, cli) {
20628
20896
  const total = _WIZARD_TIMEOUTS.reduce((a, b) => a + b, 0);
20629
- const log_path = path16.join(
20897
+ const log_path = path17.join(
20630
20898
  os7.tmpdir(),
20631
20899
  `agent-config-wizard-${process3.pid}-${Date.now()}.log`
20632
20900
  );
20633
20901
  let child;
20634
20902
  let log_fd = null;
20635
20903
  try {
20636
- log_fd = fs18.openSync(log_path, "w");
20904
+ log_fd = fs19.openSync(log_path, "w");
20637
20905
  child = spawn(cmd[0], cmd.slice(1), {
20638
20906
  env,
20639
20907
  detached: true,
@@ -20651,7 +20919,7 @@ function _wizard_run_sync(cmd, env, cli) {
20651
20919
  } finally {
20652
20920
  if (log_fd !== null) {
20653
20921
  try {
20654
- fs18.closeSync(log_fd);
20922
+ fs19.closeSync(log_fd);
20655
20923
  } catch {
20656
20924
  }
20657
20925
  }
@@ -20901,8 +21169,8 @@ function main2(argv) {
20901
21169
  const target_root = resolvePath(
20902
21170
  opts.custom_path || opts.project || process3.env["PROJECT_ROOT"] || process3.cwd()
20903
21171
  );
20904
- const minimal_package_root = path16.dirname(
20905
- path16.dirname(path16.dirname(_minimal_templates_root()))
21172
+ const minimal_package_root = path17.dirname(
21173
+ path17.dirname(path17.dirname(_minimal_templates_root()))
20906
21174
  );
20907
21175
  const validated_user_type = _validate_user_type(minimal_package_root, opts.user_type);
20908
21176
  return install_minimal(target_root, opts.force, validated_user_type);
@@ -20934,7 +21202,7 @@ function main2(argv) {
20934
21202
  return rc2;
20935
21203
  }
20936
21204
  const project_root = custom_path || resolvePath(opts.project || process3.env["PROJECT_ROOT"] || process3.cwd());
20937
- const is_first_run = !pathExists(path16.join(project_root, SETTINGS_FILE));
21205
+ const is_first_run = !pathExists(path17.join(project_root, SETTINGS_FILE));
20938
21206
  const rc = _main_project_install(opts, project_root, parsed_tools, is_first_run);
20939
21207
  if (rc === 0 && opts.interactive) {
20940
21208
  run_interactive_init(project_root, opts.force);
@@ -20998,16 +21266,16 @@ function _team_setup_hint_line(project_root) {
20998
21266
  return " \u2022 Claude Code team mode (optional cross-model review via the official codex plugin): run `agent-config doctor --check team` for setup status.";
20999
21267
  }
21000
21268
  function finalize_claude_model_tiers(project_root) {
21001
- const claude_skills = path16.join(project_root, ".claude", "skills");
21002
- const augment_skills = path16.join(project_root, ".augment", "skills");
21269
+ const claude_skills = path17.join(project_root, ".claude", "skills");
21270
+ const augment_skills = path17.join(project_root, ".augment", "skills");
21003
21271
  if (!isDir(claude_skills) || !isDir(augment_skills)) return 0;
21004
21272
  if (_read_consumer_auto_switch(project_root) !== "auto") return 0;
21005
21273
  let rendered = 0;
21006
- const entries = fs18.readdirSync(claude_skills).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
21274
+ const entries = fs19.readdirSync(claude_skills).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
21007
21275
  for (const name of entries) {
21008
- const entry = path16.join(claude_skills, name);
21009
- const src_dir = path16.join(augment_skills, name);
21010
- const src_md = path16.join(src_dir, "SKILL.md");
21276
+ const entry = path17.join(claude_skills, name);
21277
+ const src_dir = path17.join(augment_skills, name);
21278
+ const src_md = path17.join(src_dir, "SKILL.md");
21011
21279
  let tier;
21012
21280
  try {
21013
21281
  tier = read_model_tier(src_md);
@@ -21016,22 +21284,22 @@ function finalize_claude_model_tiers(project_root) {
21016
21284
  }
21017
21285
  if (tier === null || !(tier in TIER_TO_CLAUDE_MODEL) || !isDir(src_dir)) continue;
21018
21286
  if (isSymlink(entry) || isFile(entry)) {
21019
- fs18.unlinkSync(entry);
21287
+ fs19.unlinkSync(entry);
21020
21288
  } else if (isDir(entry)) {
21021
- fs18.rmSync(entry, { recursive: true, force: true });
21289
+ fs19.rmSync(entry, { recursive: true, force: true });
21022
21290
  }
21023
21291
  mkdirp(entry);
21024
- const srcFiles = fs18.readdirSync(src_dir).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
21292
+ const srcFiles = fs19.readdirSync(src_dir).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
21025
21293
  for (const fname of srcFiles) {
21026
21294
  if (fname === "SKILL.md") {
21027
21295
  writeText(
21028
- path16.join(entry, "SKILL.md"),
21296
+ path17.join(entry, "SKILL.md"),
21029
21297
  render_native_model_md(readText(src_md), tier)
21030
21298
  );
21031
21299
  } else {
21032
- fs18.symlinkSync(
21033
- path16.join("../../../.augment/skills", name, fname),
21034
- path16.join(entry, fname)
21300
+ fs19.symlinkSync(
21301
+ path17.join("../../../.augment/skills", name, fname),
21302
+ path17.join(entry, fname)
21035
21303
  );
21036
21304
  }
21037
21305
  }
@@ -21049,7 +21317,7 @@ function _main_project_install(opts, project_root, parsed_tools, is_first_run) {
21049
21317
  let package_type;
21050
21318
  if (opts.package) {
21051
21319
  package_root = resolvePath(opts.package);
21052
- if (!pathExists(path16.join(package_root, "src", "config", "profiles", "minimal.ini"))) {
21320
+ if (!pathExists(path17.join(package_root, "src", "config", "profiles", "minimal.ini"))) {
21053
21321
  fail(`Invalid --package path (missing src/config/profiles/minimal.ini): ${package_root}`);
21054
21322
  }
21055
21323
  package_type = detect_package_type_for_project(project_root, package_root);
@@ -21186,9 +21454,9 @@ function _main_project_install(opts, project_root, parsed_tools, is_first_run) {
21186
21454
  function _resolvedArgv1() {
21187
21455
  if (process3.argv[1] === void 0) return void 0;
21188
21456
  try {
21189
- return fs18.realpathSync(path16.resolve(process3.argv[1]));
21457
+ return fs19.realpathSync(path17.resolve(process3.argv[1]));
21190
21458
  } catch {
21191
- return path16.resolve(process3.argv[1]);
21459
+ return path17.resolve(process3.argv[1]);
21192
21460
  }
21193
21461
  }
21194
21462
  var _argv1 = _resolvedArgv1();
@@ -21234,6 +21502,7 @@ export {
21234
21502
  _apply_payload_preview,
21235
21503
  _bridge_marker,
21236
21504
  _canonical_settings_target,
21505
+ _catalogue_truncation_warnings,
21237
21506
  _compute_active_pack_ids,
21238
21507
  _copy_dir_dereferencing_symlinks,
21239
21508
  _current_settings_surface,
@@ -21264,6 +21533,7 @@ export {
21264
21533
  _resolve_scope,
21265
21534
  _resolve_scoped_projection,
21266
21535
  _resolve_settings_read,
21536
+ _scoped_migration_notice,
21267
21537
  _team_setup_hint_line,
21268
21538
  _tools_was_all,
21269
21539
  _validate_scope,