@event4u/agent-config 14.18.0 → 14.20.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 (210) hide show
  1. package/.augment-plugin/marketplace.json +3 -3
  2. package/.augment-plugin/plugin.json +1 -1
  3. package/.claude-plugin/marketplace.json +1 -1
  4. package/CHANGELOG.md +120 -129
  5. package/README.md +71 -149
  6. package/dist/agent-src/README.md +1 -1
  7. package/dist/agent-src/commands/agent-handoff.md +44 -43
  8. package/dist/agent-src/commands/review/changes.md +19 -19
  9. package/dist/agent-src/commands/review.md +2 -2
  10. package/dist/agent-src/contexts/execution/host-capability-manifest.md +37 -4
  11. package/dist/agent-src/rules/autonomous-execution.md +1 -1
  12. package/dist/agent-src/rules/git-history-discipline.md +2 -2
  13. package/dist/agent-src/rules/guidelines.md +1 -1
  14. package/dist/agent-src/rules/session-canary.md +2 -2
  15. package/dist/agent-src/rules/token-efficiency.md +1 -1
  16. package/dist/agent-src/rules/untrusted-input-defense.md +0 -2
  17. package/dist/agent-src/skills/adversarial-review/SKILL.md +0 -8
  18. package/dist/agent-src/skills/canvas-design/SKILL.md +1 -1
  19. package/dist/agent-src/skills/design-intelligence/SKILL.md +1 -1
  20. package/dist/agent-src/skills/design-intelligence/data/app-interface.csv +1 -1
  21. package/dist/agent-src/skills/design-intelligence/data/motion.csv +17 -17
  22. package/dist/agent-src/skills/design-intelligence/data/ux-guidelines.csv +2 -2
  23. package/dist/agent-src/skills/design-intelligence/references/context-and-registers.md +17 -0
  24. package/dist/agent-src/skills/design-intelligence/references/design-rules-checklist.md +4 -4
  25. package/dist/agent-src/skills/design-review/SKILL.md +1 -1
  26. package/dist/agent-src/skills/design-variations/SKILL.md +1 -1
  27. package/dist/agent-src/skills/evaluate-llm-feature/SKILL.md +1 -1
  28. package/dist/agent-src/skills/existing-ui-audit/SKILL.md +1 -1
  29. package/dist/agent-src/skills/fe-design/SKILL.md +32 -5
  30. package/dist/agent-src/skills/fe-design/references/craft-floor.md +7 -0
  31. package/dist/agent-src/skills/fe-design/references/design-patterns.md +47 -2
  32. package/dist/agent-src/skills/laravel-scheduling/SKILL.md +3 -1
  33. package/dist/agent-src/skills/markitdown/SKILL.md +1 -1
  34. package/dist/agent-src/skills/project-analyzer/SKILL.md +0 -6
  35. package/dist/agent-src/skills/react-native-setup/SKILL.md +3 -3
  36. package/dist/agent-src/skills/react-shadcn-ui/SKILL.md +1 -1
  37. package/dist/agent-src/skills/sequential-thinking/SKILL.md +18 -8
  38. package/dist/agent-src/skills/skill-improvement-pipeline/SKILL.md +28 -6
  39. package/dist/agent-src/skills/tailwind-engineer/SKILL.md +1 -1
  40. package/dist/agent-src/skills/test-driven-development/SKILL.md +1 -3
  41. package/dist/agent-src/skills/ui-apply-generic/SKILL.md +1 -1
  42. package/dist/agent-src/skills/ui-component-architect/SKILL.md +1 -1
  43. package/dist/agent-src/skills/using-git-worktrees/SKILL.md +17 -2
  44. package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
  45. package/dist/agent-src/templates/roadmaps.md +14 -1
  46. package/dist/agent-src/templates/scripts/telemetry/mcp_lite.ts +213 -0
  47. package/dist/agent-src/templates/scripts/telemetry/report_renderer.ts +16 -0
  48. package/dist/agent-src/templates/scripts/telemetry_report.ts +22 -2
  49. package/dist/cli/commands/recordTriggerEval.js +2 -2
  50. package/dist/cli/main.js +1 -1
  51. package/dist/cli/mcp/dispatch.js +10 -0
  52. package/dist/cli/mcp/stdio.js +33 -2
  53. package/dist/cli/mcp/telemetry.js +227 -0
  54. package/dist/cli-delegate/{chunk-AKJGUQNO.js → chunk-C6IPZRDA.js} +484 -353
  55. package/dist/cli-delegate/{chunk-CYH5SP6M.js → chunk-I6RHFQEG.js} +151 -16
  56. package/dist/cli-delegate/{chunk-7RXIKF62.js → chunk-NUMQHLS5.js} +304 -136
  57. package/dist/cli-delegate/{chunk-PMEKGDED.js → chunk-PI2GU3DP.js} +163 -1
  58. package/dist/cli-delegate/{chunk-7PRE6ZV2.js → chunk-YS6XTLEK.js} +199 -4
  59. package/dist/cli-delegate/chunk-ZVBOHSVF.js +1109 -0
  60. package/dist/cli-delegate/cmd_adr_effective.js +318 -81
  61. package/dist/cli-delegate/cmd_conformance.js +489 -121
  62. package/dist/cli-delegate/cmd_doctor.js +2 -2
  63. package/dist/cli-delegate/cmd_export.js +2 -2
  64. package/dist/cli-delegate/cmd_handoff.js +42 -12
  65. package/dist/cli-delegate/cmd_memory_get.js +1 -1
  66. package/dist/cli-delegate/cmd_prune.js +2 -2
  67. package/dist/cli-delegate/cmd_route_audit.js +2 -2
  68. package/dist/cli-delegate/cmd_session_recycle.js +59 -902
  69. package/dist/cli-delegate/cmd_settings_migrate.js +2 -2
  70. package/dist/cli-delegate/cmd_sync.js +2 -2
  71. package/dist/cli-delegate/cmd_uninstall.js +2 -2
  72. package/dist/cli-delegate/cmd_validate.js +2 -2
  73. package/dist/discovery/deprecation-report.md +1 -1
  74. package/dist/discovery/discovery-manifest.json +34 -33
  75. package/dist/discovery/discovery-manifest.json.sha256 +1 -1
  76. package/dist/discovery/discovery-manifest.summary.md +1 -1
  77. package/dist/discovery/dormancy-report.md +1 -1
  78. package/dist/discovery/orphan-report.md +1 -1
  79. package/dist/discovery/packs.json +2 -2
  80. package/dist/discovery/trust-report.md +1 -1
  81. package/dist/discovery/workspaces.json +2 -2
  82. package/dist/hooks/dispatch.js +4455 -3025
  83. package/dist/install/install.mjs +975 -689
  84. package/dist/mcp/registry-manifest.json +2 -2
  85. package/dist/mcp/server.json +2 -2
  86. package/dist/mcp/server.mjs +2087 -1134
  87. package/dist/scripts/_lib/model_tier.js +1 -1
  88. package/dist/scripts/mcp_server/telemetry.js +148 -0
  89. package/docs/guidelines/agent-infra/evaluator-independence-mechanics.md +1 -1
  90. package/docs/guidelines/agent-infra/naming.md +1 -1
  91. package/docs/guidelines/agent-infra/roadmap-progress-mechanics.md +1 -1
  92. package/docs/guidelines/agent-infra/security-lint-containment.md +46 -6
  93. package/docs/guidelines/agent-infra/self-improvement-pipeline.md +4 -4
  94. package/docs/guidelines/agent-infra/untrusted-input-spotlighting.md +1 -1
  95. package/docs/guidelines/design-antipatterns.md +87 -64
  96. package/docs/guidelines/redundancy-taxonomy.md +28 -0
  97. package/package.json +1 -1
  98. package/src/agent-src/README.md +1 -1
  99. package/src/agent-src/templates/scripts/telemetry/mcp_lite.ts +213 -0
  100. package/src/agent-src/templates/scripts/telemetry/report_renderer.ts +16 -0
  101. package/src/agent-src/templates/scripts/telemetry_report.ts +22 -2
  102. package/src/config/assurance-capability-registry.json +9 -0
  103. package/src/config/ci-local-parity.yml +6 -0
  104. package/src/config/gate-coverage.yml +225 -0
  105. package/src/config/gate-violation-baselines.json +18 -6
  106. package/src/config/release-gate-locality.yml +12 -0
  107. package/src/scripts/_cli/cmd_doctor.ts +2 -2
  108. package/src/scripts/_cli/cmd_handoff.ts +1 -1
  109. package/src/scripts/_cli/cmd_session_recycle.ts +51 -3
  110. package/src/scripts/_cli/cmd_update.ts +1 -1
  111. package/src/scripts/_cli/cmd_versions.ts +1 -1
  112. package/src/scripts/_lib/adr_frontmatter.ts +44 -0
  113. package/src/scripts/_lib/audit_field_provenance.ts +44 -3
  114. package/src/scripts/_lib/consequence_objects.ts +152 -0
  115. package/src/scripts/_lib/exec_evidence.ts +7 -0
  116. package/src/scripts/_lib/global_deploy_inventory.ts +2 -2
  117. package/src/scripts/_lib/host_capability.ts +38 -0
  118. package/src/scripts/_lib/host_permission_checks.ts +251 -0
  119. package/src/scripts/_lib/install_reach_checks.ts +33 -1
  120. package/src/scripts/_lib/mcp_bridge.ts +222 -10
  121. package/src/scripts/_lib/mcp_consent_residual.ts +173 -0
  122. package/src/scripts/_lib/model_tier.ts +1 -1
  123. package/src/scripts/_lib/obligation_frequency.ts +2 -2
  124. package/src/scripts/_lib/orchestration_record.ts +23 -1
  125. package/src/scripts/_lib/recycle_envelope_paths.ts +190 -0
  126. package/src/scripts/_lib/release_highlights.ts +93 -0
  127. package/src/scripts/_lib/release_material.ts +64 -1
  128. package/src/scripts/_lib/release_position.ts +96 -0
  129. package/src/scripts/_lib/review_skipped_record.ts +17 -1
  130. package/src/scripts/_lib/runtime_journal.ts +26 -3
  131. package/src/scripts/_lib/runtime_wiring_checks.ts +12 -1
  132. package/src/scripts/_lib/security_lint.ts +179 -7
  133. package/src/scripts/_lib/self_repair.ts +141 -6
  134. package/src/scripts/_lib/self_repair_store.ts +273 -7
  135. package/src/scripts/_lib/session_register.ts +11 -6
  136. package/src/scripts/_lib/sqlite_schema.ts +22 -0
  137. package/src/scripts/_lib/subagent_capsule.ts +155 -3
  138. package/src/scripts/_lib/surface.ts +86 -0
  139. package/src/scripts/_lib/ui_authority.ts +116 -0
  140. package/src/scripts/adr/regenerate_index.ts +54 -1
  141. package/src/scripts/adr_cite_check.ts +71 -15
  142. package/src/scripts/ai_council/clients.ts +1 -1
  143. package/src/scripts/autonomy_friction_corpus.ts +229 -0
  144. package/src/scripts/build_proof.ts +15 -2
  145. package/src/scripts/build_rule_trigger_matrix.ts +5 -0
  146. package/src/scripts/check_beta_review_markers.ts +141 -17
  147. package/src/scripts/check_enforcement_coverage.ts +1 -1
  148. package/src/scripts/check_enforcement_denominator.ts +121 -11
  149. package/src/scripts/check_finding_dispositions.ts +66 -9
  150. package/src/scripts/check_gate_coverage.ts +96 -0
  151. package/src/scripts/check_mcp_doc_drift.ts +217 -0
  152. package/src/scripts/check_pack_size.ts +321 -3
  153. package/src/scripts/check_release_highlights.ts +74 -1
  154. package/src/scripts/check_skill_activation_claim.ts +179 -0
  155. package/src/scripts/check_trigger_evals.ts +1 -1
  156. package/src/scripts/conformance_scan.ts +44 -3
  157. package/src/scripts/explain_run.ts +1 -1
  158. package/src/scripts/generate_capability_matrix.ts +1 -1
  159. package/src/scripts/git_authorization_hook.ts +75 -1
  160. package/src/scripts/handoff_context_hook.ts +54 -7
  161. package/src/scripts/hook_manifest.json +1 -1
  162. package/src/scripts/hook_manifest.yaml +14 -11
  163. package/src/scripts/hooks/augment-dispatcher.sh +1 -1
  164. package/src/scripts/hooks/category_a.ts +291 -0
  165. package/src/scripts/hooks/cline-dispatcher.sh +1 -1
  166. package/src/scripts/hooks/cursor-dispatcher.sh +11 -5
  167. package/src/scripts/hooks/dispatch_hook.ts +17 -22
  168. package/src/scripts/hooks/git_command_classifier.ts +156 -1
  169. package/src/scripts/hooks/host_lowering.ts +215 -0
  170. package/src/scripts/hooks/host_lowering.yaml +185 -0
  171. package/src/scripts/hooks/host_semantics.ts +105 -37
  172. package/src/scripts/hooks/journal_record_hook.ts +10 -0
  173. package/src/scripts/hooks/permission_gate.ts +117 -0
  174. package/src/scripts/hooks/session_eol_hook.ts +18 -7
  175. package/src/scripts/hooks_status.ts +12 -10
  176. package/src/scripts/install.ts +57 -86
  177. package/src/scripts/install_anthropic_key.sh +2 -2
  178. package/src/scripts/lint_agent_security.ts +316 -25
  179. package/src/scripts/lint_confusables.ts +42 -6
  180. package/src/scripts/lint_design_antipattern_parity.ts +80 -0
  181. package/src/scripts/lint_evidence_artifacts.ts +45 -1
  182. package/src/scripts/lint_handoffs.ts +0 -132
  183. package/src/scripts/lint_hidden_unicode.ts +49 -7
  184. package/src/scripts/lint_hook_manifest.ts +87 -3
  185. package/src/scripts/lint_instruction_smuggling.ts +42 -6
  186. package/src/scripts/lint_mcp_config_security.ts +42 -6
  187. package/src/scripts/lint_motion_authority_drift.ts +731 -0
  188. package/src/scripts/lint_readme_size.ts +158 -12
  189. package/src/scripts/lint_reasoning_fixtures.ts +216 -0
  190. package/src/scripts/lint_roadmap_later_disposition.ts +217 -27
  191. package/src/scripts/lint_skill_frontmatter_safety.ts +43 -7
  192. package/src/scripts/lint_skill_trigger_contradiction.ts +161 -0
  193. package/src/scripts/mcp_server/resources.ts +41 -0
  194. package/src/scripts/mcp_server/telemetry.ts +19 -4
  195. package/src/scripts/measure_sibling_naming.ts +150 -0
  196. package/src/scripts/orchestration_record.ts +12 -1
  197. package/src/scripts/redact_hook_capture.ts +1 -1
  198. package/src/scripts/release.ts +24 -24
  199. package/src/scripts/release_publication.ts +6 -2
  200. package/src/scripts/report_skill_activation.ts +319 -7
  201. package/src/scripts/schemas/review-findings.schema.json +5 -0
  202. package/src/scripts/schemas/skill.schema.json +2 -2
  203. package/src/scripts/self_repair_cli.ts +31 -1
  204. package/src/scripts/session_canary_hook.ts +1 -1
  205. package/src/scripts/session_register_hook.ts +4 -3
  206. package/src/scripts/skill_scout.ts +69 -0
  207. package/src/scripts/trigger_eval_grandfather.json +5 -1
  208. package/src/scripts/validate_agent_settings.ts +1 -1
  209. package/dist/cli-delegate/chunk-2GNWGMAL.js +0 -172
  210. package/dist/cli-delegate/chunk-LPPWO5CE.js +0 -161
@@ -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, path21) {
121
- const ctrl = callVisitor(key, node, visitor, path21);
120
+ function visit_(key, node, visitor, path22) {
121
+ const ctrl = callVisitor(key, node, visitor, path22);
122
122
  if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
123
- replaceNode(key, path21, ctrl);
124
- return visit_(key, ctrl, visitor, path21);
123
+ replaceNode(key, path22, ctrl);
124
+ return visit_(key, ctrl, visitor, path22);
125
125
  }
126
126
  if (typeof ctrl !== "symbol") {
127
127
  if (identity.isCollection(node)) {
128
- path21 = Object.freeze(path21.concat(node));
128
+ path22 = Object.freeze(path22.concat(node));
129
129
  for (let i = 0; i < node.items.length; ++i) {
130
- const ci = visit_(i, node.items[i], visitor, path21);
130
+ const ci = visit_(i, node.items[i], visitor, path22);
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
- path21 = Object.freeze(path21.concat(node));
142
- const ck = visit_("key", node.key, visitor, path21);
141
+ path22 = Object.freeze(path22.concat(node));
142
+ const ck = visit_("key", node.key, visitor, path22);
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, path21);
147
+ const cv = visit_("value", node.value, visitor, path22);
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, path21) {
169
- const ctrl = await callVisitor(key, node, visitor, path21);
168
+ async function visitAsync_(key, node, visitor, path22) {
169
+ const ctrl = await callVisitor(key, node, visitor, path22);
170
170
  if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
171
- replaceNode(key, path21, ctrl);
172
- return visitAsync_(key, ctrl, visitor, path21);
171
+ replaceNode(key, path22, ctrl);
172
+ return visitAsync_(key, ctrl, visitor, path22);
173
173
  }
174
174
  if (typeof ctrl !== "symbol") {
175
175
  if (identity.isCollection(node)) {
176
- path21 = Object.freeze(path21.concat(node));
176
+ path22 = Object.freeze(path22.concat(node));
177
177
  for (let i = 0; i < node.items.length; ++i) {
178
- const ci = await visitAsync_(i, node.items[i], visitor, path21);
178
+ const ci = await visitAsync_(i, node.items[i], visitor, path22);
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
- path21 = Object.freeze(path21.concat(node));
190
- const ck = await visitAsync_("key", node.key, visitor, path21);
189
+ path22 = Object.freeze(path22.concat(node));
190
+ const ck = await visitAsync_("key", node.key, visitor, path22);
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, path21);
195
+ const cv = await visitAsync_("value", node.value, visitor, path22);
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, path21) {
222
+ function callVisitor(key, node, visitor, path22) {
223
223
  if (typeof visitor === "function")
224
- return visitor(key, node, path21);
224
+ return visitor(key, node, path22);
225
225
  if (identity.isMap(node))
226
- return visitor.Map?.(key, node, path21);
226
+ return visitor.Map?.(key, node, path22);
227
227
  if (identity.isSeq(node))
228
- return visitor.Seq?.(key, node, path21);
228
+ return visitor.Seq?.(key, node, path22);
229
229
  if (identity.isPair(node))
230
- return visitor.Pair?.(key, node, path21);
230
+ return visitor.Pair?.(key, node, path22);
231
231
  if (identity.isScalar(node))
232
- return visitor.Scalar?.(key, node, path21);
232
+ return visitor.Scalar?.(key, node, path22);
233
233
  if (identity.isAlias(node))
234
- return visitor.Alias?.(key, node, path21);
234
+ return visitor.Alias?.(key, node, path22);
235
235
  return void 0;
236
236
  }
237
- function replaceNode(key, path21, node) {
238
- const parent = path21[path21.length - 1];
237
+ function replaceNode(key, path22, node) {
238
+ const parent = path22[path22.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, path21, value) {
848
+ function collectionFromPath(schema, path22, value) {
849
849
  let v = value;
850
- for (let i = path21.length - 1; i >= 0; --i) {
851
- const k = path21[i];
850
+ for (let i = path22.length - 1; i >= 0; --i) {
851
+ const k = path22[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 = (path21) => path21 == null || typeof path21 === "object" && !!path21[Symbol.iterator]().next().done;
870
+ var isEmptyPath = (path22) => path22 == null || typeof path22 === "object" && !!path22[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(path21, value) {
901
- if (isEmptyPath(path21))
900
+ addIn(path22, value) {
901
+ if (isEmptyPath(path22))
902
902
  this.add(value);
903
903
  else {
904
- const [key, ...rest] = path21;
904
+ const [key, ...rest] = path22;
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(path21) {
919
- const [key, ...rest] = path21;
918
+ deleteIn(path22) {
919
+ const [key, ...rest] = path22;
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(path21, keepScalar) {
934
- const [key, ...rest] = path21;
933
+ getIn(path22, keepScalar) {
934
+ const [key, ...rest] = path22;
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(path21) {
953
- const [key, ...rest] = path21;
952
+ hasIn(path22) {
953
+ const [key, ...rest] = path22;
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(path21, value) {
964
- const [key, ...rest] = path21;
963
+ setIn(path22, value) {
964
+ const [key, ...rest] = path22;
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(path21, value) {
3479
+ addIn(path22, value) {
3480
3480
  if (assertCollection(this.contents))
3481
- this.contents.addIn(path21, value);
3481
+ this.contents.addIn(path22, 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(path21) {
3557
- if (Collection.isEmptyPath(path21)) {
3556
+ deleteIn(path22) {
3557
+ if (Collection.isEmptyPath(path22)) {
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(path21) : false;
3563
+ return assertCollection(this.contents) ? this.contents.deleteIn(path22) : 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(path21, keepScalar) {
3579
- if (Collection.isEmptyPath(path21))
3578
+ getIn(path22, keepScalar) {
3579
+ if (Collection.isEmptyPath(path22))
3580
3580
  return !keepScalar && identity.isScalar(this.contents) ? this.contents.value : this.contents;
3581
- return identity.isCollection(this.contents) ? this.contents.getIn(path21, keepScalar) : void 0;
3581
+ return identity.isCollection(this.contents) ? this.contents.getIn(path22, 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(path21) {
3593
- if (Collection.isEmptyPath(path21))
3592
+ hasIn(path22) {
3593
+ if (Collection.isEmptyPath(path22))
3594
3594
  return this.contents !== void 0;
3595
- return identity.isCollection(this.contents) ? this.contents.hasIn(path21) : false;
3595
+ return identity.isCollection(this.contents) ? this.contents.hasIn(path22) : 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(path21, value) {
3613
- if (Collection.isEmptyPath(path21)) {
3612
+ setIn(path22, value) {
3613
+ if (Collection.isEmptyPath(path22)) {
3614
3614
  this.contents = value;
3615
3615
  } else if (this.contents == null) {
3616
- this.contents = Collection.collectionFromPath(this.schema, Array.from(path21), value);
3616
+ this.contents = Collection.collectionFromPath(this.schema, Array.from(path22), value);
3617
3617
  } else if (assertCollection(this.contents)) {
3618
- this.contents.setIn(path21, value);
3618
+ this.contents.setIn(path22, 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, path21) => {
5578
+ visit.itemAtPath = (cst, path22) => {
5579
5579
  let item = cst;
5580
- for (const [field, index] of path21) {
5580
+ for (const [field, index] of path22) {
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, path21) => {
5590
- const parent = visit.itemAtPath(cst, path21.slice(0, -1));
5591
- const field = path21[path21.length - 1][0];
5589
+ visit.parentCollection = (cst, path22) => {
5590
+ const parent = visit.itemAtPath(cst, path22.slice(0, -1));
5591
+ const field = path22[path22.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(path21, item, visitor) {
5598
- let ctrl = visitor(item, path21);
5597
+ function _visit(path22, item, visitor) {
5598
+ let ctrl = visitor(item, path22);
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(path21.concat([[field, i]])), token.items[i], visitor);
5605
+ const ci = _visit(Object.freeze(path22.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, path21);
5616
+ ctrl = ctrl(item, path22);
5617
5617
  }
5618
5618
  }
5619
- return typeof ctrl === "function" ? ctrl(item, path21) : ctrl;
5619
+ return typeof ctrl === "function" ? ctrl(item, path22) : 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 fs24 = this.flowScalar(this.type);
6921
+ const fs25 = this.flowScalar(this.type);
6922
6922
  if (atNextItem || it.value) {
6923
- map.items.push({ start, key: fs24, sep: [] });
6923
+ map.items.push({ start, key: fs25, sep: [] });
6924
6924
  this.onKeyLine = true;
6925
6925
  } else if (it.sep) {
6926
- this.stack.push(fs24);
6926
+ this.stack.push(fs25);
6927
6927
  } else {
6928
- Object.assign(it, { key: fs24, sep: [] });
6928
+ Object.assign(it, { key: fs25, 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 fs24 = this.flowScalar(this.type);
7056
+ const fs25 = this.flowScalar(this.type);
7057
7057
  if (!it || it.value)
7058
- fc.items.push({ start: [], key: fs24, sep: [] });
7058
+ fc.items.push({ start: [], key: fs25, sep: [] });
7059
7059
  else if (it.sep)
7060
- this.stack.push(fs24);
7060
+ this.stack.push(fs25);
7061
7061
  else
7062
- Object.assign(it, { key: fs24, sep: [] });
7062
+ Object.assign(it, { key: fs25, sep: [] });
7063
7063
  return;
7064
7064
  }
7065
7065
  case "flow-map-end":
@@ -7370,11 +7370,11 @@ var require_dist = __commonJS({
7370
7370
  // src/scripts/install.ts
7371
7371
  import { spawn, spawnSync as spawnSync2 } from "node:child_process";
7372
7372
  import * as crypto3 from "node:crypto";
7373
- import * as fs23 from "node:fs";
7373
+ import * as fs24 from "node:fs";
7374
7374
  import * as os8 from "node:os";
7375
- import * as path20 from "node:path";
7376
- import process3 from "node:process";
7377
- import { fileURLToPath as fileURLToPath5, pathToFileURL as pathToFileURL2 } from "node:url";
7375
+ import * as path21 from "node:path";
7376
+ import process4 from "node:process";
7377
+ import { fileURLToPath as fileURLToPath6, pathToFileURL as pathToFileURL2 } from "node:url";
7378
7378
 
7379
7379
  // src/scripts/_lib/json_pointers.ts
7380
7380
  import { createHash } from "node:crypto";
@@ -7873,8 +7873,8 @@ function lockfile_write_path(env) {
7873
7873
  }
7874
7874
  return write_target("installed.lock", { env: env ?? null });
7875
7875
  }
7876
- function read_lockfile(path21) {
7877
- const target = path21 ?? lockfile_path();
7876
+ function read_lockfile(path22) {
7877
+ const target = path22 ?? lockfile_path();
7878
7878
  let text;
7879
7879
  try {
7880
7880
  text = fs2.readFileSync(target, { encoding: "utf-8" });
@@ -8130,17 +8130,170 @@ function current_package_version(repo_root) {
8130
8130
  // src/scripts/_lib/mcp_bridge.ts
8131
8131
  import * as fs3 from "node:fs";
8132
8132
  import * as path3 from "node:path";
8133
+
8134
+ // src/scripts/_lib/host_capability.ts
8135
+ import process2 from "node:process";
8136
+ var SAFE_DEFAULT = {
8137
+ schema_version: 1,
8138
+ subagent_spawn: false,
8139
+ parallel_spawn: false,
8140
+ status_polling: false,
8141
+ separate_quota_pool: false,
8142
+ agent_teams: false,
8143
+ worker_respawn: false,
8144
+ reads_project_mcp_config: false,
8145
+ // `true` because the safe answer here is "there is still a step", not
8146
+ // "there is nothing to do" — see the field's own note.
8147
+ mcp_needs_manual_activation: true
8148
+ };
8149
+ function asBool(value) {
8150
+ return value === true;
8151
+ }
8152
+ function normalizeHostManifest(input) {
8153
+ if (input === null || typeof input !== "object") {
8154
+ return { ...SAFE_DEFAULT };
8155
+ }
8156
+ const src = input;
8157
+ return {
8158
+ schema_version: 1,
8159
+ subagent_spawn: asBool(src.subagent_spawn),
8160
+ parallel_spawn: asBool(src.parallel_spawn),
8161
+ status_polling: asBool(src.status_polling),
8162
+ separate_quota_pool: asBool(src.separate_quota_pool),
8163
+ agent_teams: asBool(src.agent_teams),
8164
+ worker_respawn: asBool(src.worker_respawn),
8165
+ reads_project_mcp_config: asBool(src.reads_project_mcp_config),
8166
+ // Inverted coercion, matching the inverted default: only an explicit
8167
+ // `false` clears the residual, so an absent or malformed value keeps
8168
+ // the manual step visible instead of silently dropping it.
8169
+ mcp_needs_manual_activation: src.mcp_needs_manual_activation !== false
8170
+ };
8171
+ }
8172
+ var HOST_CAPABILITY_REGISTRY = {
8173
+ claude: { subagent_spawn: true, parallel_spawn: true }
8174
+ };
8175
+ function resolveHostCapabilities(hostId, override) {
8176
+ if (override !== void 0 && override !== null && typeof override === "object" && !Array.isArray(override)) {
8177
+ return normalizeHostManifest(override);
8178
+ }
8179
+ const row = hostId !== null && hostId !== void 0 ? HOST_CAPABILITY_REGISTRY[hostId] : void 0;
8180
+ if (row === void 0) {
8181
+ return { ...SAFE_DEFAULT };
8182
+ }
8183
+ return { ...SAFE_DEFAULT, ...row, schema_version: 1 };
8184
+ }
8185
+ function probeHostCapabilities(hostId) {
8186
+ const base = resolveHostCapabilities(hostId);
8187
+ const flag = process2.env.CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS;
8188
+ const probedAgentTeams = typeof flag === "string" && flag !== "";
8189
+ return { ...base, agent_teams: base.agent_teams || probedAgentTeams };
8190
+ }
8191
+ var CAPABILITY_FIELDS = [
8192
+ "subagent_spawn",
8193
+ "parallel_spawn",
8194
+ "status_polling",
8195
+ "separate_quota_pool",
8196
+ "agent_teams",
8197
+ "worker_respawn",
8198
+ "reads_project_mcp_config",
8199
+ "mcp_needs_manual_activation"
8200
+ ];
8201
+ function describeHostCapabilities(hostId) {
8202
+ const manifest = probeHostCapabilities(hostId);
8203
+ const row = hostId !== null && hostId !== void 0 ? HOST_CAPABILITY_REGISTRY[hostId] : void 0;
8204
+ const flag = process2.env.CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS;
8205
+ const probedAgentTeams = typeof flag === "string" && flag !== "";
8206
+ const sources = {};
8207
+ for (const field of CAPABILITY_FIELDS) {
8208
+ if (row !== void 0 && typeof row[field] === "boolean") {
8209
+ sources[field] = "registry";
8210
+ } else if (field === "agent_teams" && probedAgentTeams) {
8211
+ sources[field] = "live-probe";
8212
+ } else {
8213
+ sources[field] = "default";
8214
+ }
8215
+ }
8216
+ return { manifest, sources };
8217
+ }
8218
+
8219
+ // src/scripts/_lib/mcp_bridge.ts
8133
8220
  var MCP_SERVER_KEY = "agent-config";
8134
- var MCP_BRIDGE_ENTRY = {
8135
- mcpServers: {
8136
- [MCP_SERVER_KEY]: {
8137
- command: "npx",
8138
- args: ["-y", "@event4u/agent-config", "mcp-server"]
8221
+ var MCP_PACKAGE_NAME = "@event4u/agent-config";
8222
+ function mcpBridgeEntry(packageRoot) {
8223
+ const version = readPackageVersion(packageRoot);
8224
+ const spec = version === null ? MCP_PACKAGE_NAME : `${MCP_PACKAGE_NAME}@${version}`;
8225
+ return {
8226
+ mcpServers: {
8227
+ [MCP_SERVER_KEY]: {
8228
+ command: "npx",
8229
+ args: ["-y", spec, "mcp-server"]
8230
+ }
8139
8231
  }
8232
+ };
8233
+ }
8234
+ function readPackageVersion(packageRoot) {
8235
+ try {
8236
+ const raw = fs3.readFileSync(path3.join(packageRoot, "package.json"), "utf-8");
8237
+ const v = JSON.parse(raw).version;
8238
+ return typeof v === "string" && v.trim() !== "" ? v : null;
8239
+ } catch {
8240
+ return null;
8140
8241
  }
8141
- };
8242
+ }
8142
8243
  function makeEnsureMcpBridge(mergeJsonFile) {
8143
- return (projectRoot, force) => mergeJsonFile(path3.join(projectRoot, ".mcp.json"), MCP_BRIDGE_ENTRY, force, ".mcp.json");
8244
+ return (projectRoot, force, packageRoot = projectRoot) => mergeJsonFile(
8245
+ path3.join(projectRoot, ".mcp.json"),
8246
+ mcpBridgeEntry(packageRoot),
8247
+ force,
8248
+ ".mcp.json"
8249
+ );
8250
+ }
8251
+ var MCP_PROJECT_CONFIG = {
8252
+ "claude-code": { hostId: "claude", relPath: ".mcp.json" },
8253
+ cursor: { hostId: "cursor", relPath: ".cursor/mcp.json" },
8254
+ "gemini-cli": { hostId: "gemini", relPath: ".gemini/settings.json" }
8255
+ };
8256
+ function mcpRegistrationTargets(tools, readsConfig) {
8257
+ const out = [];
8258
+ for (const [toolId, spec] of Object.entries(MCP_PROJECT_CONFIG)) {
8259
+ if (toolId === "claude-code") continue;
8260
+ if (!tools.has(toolId)) continue;
8261
+ if (!readsConfig(spec.hostId)) continue;
8262
+ out.push({ toolId, hostId: spec.hostId, relPath: spec.relPath });
8263
+ }
8264
+ return out;
8265
+ }
8266
+ function makeEnsureMcpRegistrations(mergeJsonFile) {
8267
+ return (projectRoot, force, packageRoot, targets) => {
8268
+ const merged = {};
8269
+ for (const t of targets) {
8270
+ merged[t.toolId] = mergeJsonFile(
8271
+ path3.join(projectRoot, ...t.relPath.split("/")),
8272
+ mcpBridgeEntry(packageRoot),
8273
+ force,
8274
+ t.relPath
8275
+ );
8276
+ }
8277
+ return merged;
8278
+ };
8279
+ }
8280
+ function readsProjectMcpConfig(hostId) {
8281
+ return probeHostCapabilities(hostId).reads_project_mcp_config;
8282
+ }
8283
+ function registerMcpHosts(mergeJsonFile, projectRoot, force, packageRoot, tools, into, readsConfig = readsProjectMcpConfig) {
8284
+ const ensure = makeEnsureMcpRegistrations(mergeJsonFile);
8285
+ const claude = MCP_PROJECT_CONFIG["claude-code"];
8286
+ if (tools.has("claude-code") && claude !== void 0) {
8287
+ const merged = ensure(projectRoot, force, packageRoot, [
8288
+ { toolId: "claude-code", hostId: claude.hostId, relPath: claude.relPath }
8289
+ ]);
8290
+ (into["claude-code"] ??= []).push(...merged["claude-code"] ?? []);
8291
+ }
8292
+ for (const [toolId, keys] of Object.entries(
8293
+ ensure(projectRoot, force, packageRoot, mcpRegistrationTargets(tools, readsConfig))
8294
+ )) {
8295
+ (into[toolId] ??= []).push(...keys);
8296
+ }
8144
8297
  }
8145
8298
  function projectionModeOf(raw) {
8146
8299
  return raw === "scoped" ? "scoped" : raw === "tiered" ? "tiered" : "legacy-all";
@@ -8184,6 +8337,79 @@ function applyTieredPrune(deployResults, packageRoot, pruneBy) {
8184
8337
  };
8185
8338
  }
8186
8339
 
8340
+ // src/scripts/_lib/mcp_consent_residual.ts
8341
+ var SEEDED = {
8342
+ claude: {
8343
+ hostId: "claude",
8344
+ residual: "Approve the project-scoped `agent-config` server the first time the host prompts \u2014 the installer writes `.mcp.json` but does not pre-approve it.",
8345
+ source: "vendor-doc",
8346
+ cite: "Host documentation: a project-scope MCP server requires explicit approval, suppressible only through the user-global `enabledMcpjsonServers` key, which this package deliberately does not write (blocker `mcp-user-scope-approval-consent`)."
8347
+ }
8348
+ };
8349
+ var TOOL_TO_HOST = {
8350
+ "claude-code": "claude",
8351
+ cursor: "cursor",
8352
+ "gemini-cli": "gemini",
8353
+ windsurf: "windsurf",
8354
+ cline: "cline",
8355
+ copilot: "copilot",
8356
+ augment: "augment"
8357
+ };
8358
+ function residualFor(hostId) {
8359
+ const { manifest, sources } = describeHostCapabilities(hostId);
8360
+ if (sources.mcp_needs_manual_activation === "registry" && !manifest.mcp_needs_manual_activation) {
8361
+ return null;
8362
+ }
8363
+ return SEEDED[hostId] ?? null;
8364
+ }
8365
+ function isRecorded(hostId) {
8366
+ const { sources } = describeHostCapabilities(hostId);
8367
+ return hostId in SEEDED || sources.mcp_needs_manual_activation === "registry";
8368
+ }
8369
+ function residualLine(hostId) {
8370
+ const r = residualFor(hostId);
8371
+ if (r !== null) {
8372
+ return {
8373
+ hostId,
8374
+ state: "residual",
8375
+ text: `${hostId}: ${r.residual} (source: ${r.source} \u2014 not observed here)`
8376
+ };
8377
+ }
8378
+ if (isRecorded(hostId)) {
8379
+ return {
8380
+ hostId,
8381
+ state: "cleared",
8382
+ text: `${hostId}: nothing left to do (source: observed)`
8383
+ };
8384
+ }
8385
+ return {
8386
+ hostId,
8387
+ state: "unrecorded",
8388
+ text: `${hostId}: no residual recorded \u2014 nobody checked this host, which is not the same as nothing to do`
8389
+ };
8390
+ }
8391
+ function residualReport(toolIds) {
8392
+ const seen = /* @__PURE__ */ new Set();
8393
+ const out = [];
8394
+ for (const toolId of toolIds) {
8395
+ const hostId = TOOL_TO_HOST[toolId];
8396
+ if (hostId === void 0 || seen.has(hostId)) continue;
8397
+ seen.add(hostId);
8398
+ const line = residualLine(hostId);
8399
+ if (line.state !== "cleared") out.push(line);
8400
+ }
8401
+ return out;
8402
+ }
8403
+ function printResiduals(toolIds, quiet, write = (s) => process.stdout.write(s)) {
8404
+ if (quiet) return;
8405
+ const lines = residualReport(toolIds);
8406
+ if (lines.length === 0) return;
8407
+ write(" Still needs you (MCP):\n");
8408
+ for (const line of lines) write(` \u2022 ${line.text}
8409
+ `);
8410
+ write("\n");
8411
+ }
8412
+
8187
8413
  // src/scripts/_lib/scoped_projection.ts
8188
8414
  import * as fs5 from "node:fs";
8189
8415
  import { createRequire } from "node:module";
@@ -9079,18 +9305,18 @@ function manifest_path(project_root, env) {
9079
9305
  var _TOP_KEY_RE = /^([A-Za-z_][A-Za-z0-9_]*)\s*:\s*"?([^"\n]*?)"?\s*$/;
9080
9306
  var _LIST_DASH_RE = /^\s*-\s*(.+?)\s*$/;
9081
9307
  var _INDENT_KEY_RE = /^\s+([A-Za-z_][A-Za-z0-9_]*)\s*:\s*"?([^"\n]*?)"?\s*$/;
9082
- function read_manifest(path21) {
9308
+ function read_manifest(path22) {
9083
9309
  let text;
9084
9310
  try {
9085
- text = require_read_text(path21);
9311
+ text = require_read_text(path22);
9086
9312
  } catch {
9087
9313
  return null;
9088
9314
  }
9089
9315
  const data = _parse_manual(text);
9090
9316
  return _normalise_v2_shape(data);
9091
9317
  }
9092
- function require_read_text(path21) {
9093
- return fs9.readFileSync(path21, { encoding: "utf-8" });
9318
+ function require_read_text(path22) {
9319
+ return fs9.readFileSync(path22, { encoding: "utf-8" });
9094
9320
  }
9095
9321
  function _normalise_v2_shape(data) {
9096
9322
  if (data["tools"] === void 0 || data["tools"] === null) {
@@ -9271,9 +9497,9 @@ function stable_sort(items, key) {
9271
9497
  return a.index - b.index;
9272
9498
  }).map((entry) => entry.item);
9273
9499
  }
9274
- function write_manifest(path21, version, tools, options = {}) {
9500
+ function write_manifest(path22, version, tools, options = {}) {
9275
9501
  const rendered = _render2(version, tools, { deploy_roots: options.deploy_roots ?? null });
9276
- return write_atomic(path21, rendered);
9502
+ return write_atomic(path22, rendered);
9277
9503
  }
9278
9504
  var ScopeMismatchError = class extends Error {
9279
9505
  name_;
@@ -10119,12 +10345,106 @@ function ensure_managed_hooks(settings_path, matrix) {
10119
10345
  });
10120
10346
  }
10121
10347
 
10122
- // src/scripts/_lib/agent_settings.ts
10123
- import { createRequire as createRequire2 } from "node:module";
10348
+ // src/scripts/hooks/host_lowering.ts
10349
+ var import_yaml2 = __toESM(require_dist(), 1);
10124
10350
  import * as fs14 from "node:fs";
10125
- import * as os6 from "node:os";
10126
10351
  import * as path13 from "node:path";
10127
10352
  import { fileURLToPath as fileURLToPath2 } from "node:url";
10353
+ var _IN_BUNDLE = true;
10354
+ var _REPO_ROOT = path13.resolve(
10355
+ path13.dirname(fileURLToPath2(import.meta.url)),
10356
+ ..._IN_BUNDLE ? ["..", ".."] : ["..", "..", ".."]
10357
+ );
10358
+ var HOST_LOWERING_PATH = path13.join(_REPO_ROOT, "src", "scripts", "hooks", "host_lowering.yaml");
10359
+ var DEFAULT_SURFACE = "any";
10360
+ function _asString(v) {
10361
+ if (v === null || v === void 0) return null;
10362
+ if (v instanceof Date) return v.toISOString().slice(0, 10);
10363
+ return String(v);
10364
+ }
10365
+ function _parse(text) {
10366
+ const raw = (0, import_yaml2.parse)(text);
10367
+ const hostsRaw = raw?.["hosts"];
10368
+ if (typeof hostsRaw !== "object" || hostsRaw === null) {
10369
+ throw new Error("host_lowering.yaml: missing `hosts:` map");
10370
+ }
10371
+ const out = /* @__PURE__ */ new Map();
10372
+ for (const [host, hv] of Object.entries(hostsRaw)) {
10373
+ const surfacesRaw = hv?.["surfaces"];
10374
+ if (typeof surfacesRaw !== "object" || surfacesRaw === null) {
10375
+ throw new Error(`host_lowering.yaml: ${host} has no \`surfaces:\` map`);
10376
+ }
10377
+ const surfaces = /* @__PURE__ */ new Map();
10378
+ for (const [surface, sv] of Object.entries(surfacesRaw)) {
10379
+ const s = sv;
10380
+ const verifiedRaw = s["verified"];
10381
+ let verified = null;
10382
+ if (verifiedRaw) {
10383
+ const expires = _asString(verifiedRaw["expires"]);
10384
+ if (!expires) {
10385
+ throw new Error(`host_lowering.yaml: ${host}/${surface} verified block has no \`expires\``);
10386
+ }
10387
+ verified = {
10388
+ docs_at: _asString(verifiedRaw["docs_at"]),
10389
+ docs_url: _asString(verifiedRaw["docs_url"]),
10390
+ probe_at: _asString(verifiedRaw["probe_at"]),
10391
+ host_version: _asString(verifiedRaw["host_version"]),
10392
+ expires
10393
+ };
10394
+ }
10395
+ const slots = /* @__PURE__ */ new Map();
10396
+ for (const [slot, rvRaw] of Object.entries(s["slots"] ?? {})) {
10397
+ const rv = rvRaw;
10398
+ const nativeRaw = rv["native"];
10399
+ const native = Array.isArray(nativeRaw) ? nativeRaw.map(String) : [String(nativeRaw)];
10400
+ const be = rv["block_exit"];
10401
+ const row = {
10402
+ native,
10403
+ block_exit: typeof be === "number" ? be : null
10404
+ };
10405
+ if (typeof rv["matcher"] === "string") row.matcher = rv["matcher"];
10406
+ slots.set(slot, row);
10407
+ }
10408
+ surfaces.set(surface, {
10409
+ entry_shape: String(s["entry_shape"] ?? "none"),
10410
+ json_shape: String(s["json_shape"] ?? "none"),
10411
+ fail_policy: String(s["fail_policy"] ?? "discard"),
10412
+ timeout_unit: String(s["timeout_unit"] ?? "unknown"),
10413
+ timeout_default: typeof s["timeout_default"] === "number" ? s["timeout_default"] : null,
10414
+ verified,
10415
+ slots
10416
+ });
10417
+ }
10418
+ out.set(host, surfaces);
10419
+ }
10420
+ return out;
10421
+ }
10422
+ var _cache = null;
10423
+ function loadHostLowering() {
10424
+ if (_cache === null) _cache = _parse(fs14.readFileSync(HOST_LOWERING_PATH, "utf-8"));
10425
+ return _cache;
10426
+ }
10427
+ function surfaceRow(host, surface = DEFAULT_SURFACE, table = loadHostLowering()) {
10428
+ return table.get(host)?.get(surface) ?? table.get(host)?.get(DEFAULT_SURFACE) ?? null;
10429
+ }
10430
+ function hostBindings(host, table = loadHostLowering()) {
10431
+ const row = surfaceRow(host, DEFAULT_SURFACE, table);
10432
+ if (!row) return [];
10433
+ const out = [];
10434
+ for (const [slot, sr] of row.slots) {
10435
+ for (const native of sr.native) {
10436
+ out.push({ slot, native, matcher: sr.matcher ?? "" });
10437
+ }
10438
+ }
10439
+ return out;
10440
+ }
10441
+
10442
+ // src/scripts/_lib/agent_settings.ts
10443
+ import { createRequire as createRequire2 } from "node:module";
10444
+ import * as fs15 from "node:fs";
10445
+ import * as os6 from "node:os";
10446
+ import * as path14 from "node:path";
10447
+ import { fileURLToPath as fileURLToPath3 } from "node:url";
10128
10448
 
10129
10449
  // src/shared/settingsCarveOut.ts
10130
10450
  var SETTINGS_CARVE_OUT = [
@@ -10221,10 +10541,10 @@ var DEFAULT_PROJECT_FILE = ".agent-settings.yml";
10221
10541
  var LOCAL_PROJECT_FILE = ".agent-settings.local.yml";
10222
10542
  var LOCAL_PROJECT_SUBDIR = ["agents", "settings"];
10223
10543
  function _local_settings_path(project_root) {
10224
- return path13.join(project_root, ...LOCAL_PROJECT_SUBDIR, LOCAL_PROJECT_FILE);
10544
+ return path14.join(project_root, ...LOCAL_PROJECT_SUBDIR, LOCAL_PROJECT_FILE);
10225
10545
  }
10226
10546
  function _canonical_settings_path(project_root) {
10227
- return path13.join(project_root, ...LOCAL_PROJECT_SUBDIR, DEFAULT_PROJECT_FILE);
10547
+ return path14.join(project_root, ...LOCAL_PROJECT_SUBDIR, DEFAULT_PROJECT_FILE);
10228
10548
  }
10229
10549
  var USER_GLOBAL_FILENAME = "agent-settings.yml";
10230
10550
  function DEFAULT_USER_GLOBAL_FILE() {
@@ -10278,10 +10598,10 @@ var MERGEABLE_KEYS = [
10278
10598
  "knowledge.global_sharing.freshness.hypothesis_after_days",
10279
10599
  "knowledge.global_sharing.freshness.stale_after_days"
10280
10600
  ];
10281
- var TEMPLATE_RELATIVE = path13.join("src", "config", "agent-settings.template.yml");
10282
- var _PACKAGE_ROOT = path13.resolve(path13.dirname(fileURLToPath2(import.meta.url)), "..", "..", "..");
10601
+ var TEMPLATE_RELATIVE = path14.join("src", "config", "agent-settings.template.yml");
10602
+ var _PACKAGE_ROOT = path14.resolve(path14.dirname(fileURLToPath3(import.meta.url)), "..", "..", "..");
10283
10603
  function default_template_path() {
10284
- return path13.join(_PACKAGE_ROOT, TEMPLATE_RELATIVE);
10604
+ return path14.join(_PACKAGE_ROOT, TEMPLATE_RELATIVE);
10285
10605
  }
10286
10606
  function _is_placeholder(value) {
10287
10607
  return typeof value === "string" && /^__[A-Z0-9_]+__$/.test(value);
@@ -10332,8 +10652,8 @@ var _AGENTS_DIR_MARKERS = [
10332
10652
  var _LEGACY_ANCHOR_ENV = "AGENT_CONFIG_LEGACY_ANCHOR";
10333
10653
  function _exists(p) {
10334
10654
  try {
10335
- fs14.lstatSync(p);
10336
- fs14.statSync(p);
10655
+ fs15.lstatSync(p);
10656
+ fs15.statSync(p);
10337
10657
  return true;
10338
10658
  } catch {
10339
10659
  return false;
@@ -10341,22 +10661,22 @@ function _exists(p) {
10341
10661
  }
10342
10662
  function _is_dir2(p) {
10343
10663
  try {
10344
- return fs14.statSync(p).isDirectory();
10664
+ return fs15.statSync(p).isDirectory();
10345
10665
  } catch {
10346
10666
  return false;
10347
10667
  }
10348
10668
  }
10349
10669
  function _is_file(p) {
10350
10670
  try {
10351
- return fs14.statSync(p).isFile();
10671
+ return fs15.statSync(p).isFile();
10352
10672
  } catch {
10353
10673
  return false;
10354
10674
  }
10355
10675
  }
10356
10676
  function _resolve(p) {
10357
- const absolute = path13.resolve(p);
10677
+ const absolute = path14.resolve(p);
10358
10678
  try {
10359
- return fs14.realpathSync(absolute);
10679
+ return fs15.realpathSync(absolute);
10360
10680
  } catch {
10361
10681
  return absolute;
10362
10682
  }
@@ -10366,7 +10686,7 @@ function _ancestor_chain(start) {
10366
10686
  let cursor = start;
10367
10687
  for (; ; ) {
10368
10688
  chain.push(cursor);
10369
- const parent = path13.dirname(cursor);
10689
+ const parent = path14.dirname(cursor);
10370
10690
  if (parent === cursor) {
10371
10691
  break;
10372
10692
  }
@@ -10375,15 +10695,15 @@ function _ancestor_chain(start) {
10375
10695
  return chain;
10376
10696
  }
10377
10697
  function _boundary_anchor_at(dir) {
10378
- const agents_dir = path13.join(dir, "agents");
10698
+ const agents_dir = path14.join(dir, "agents");
10379
10699
  if (_is_dir2(agents_dir)) {
10380
10700
  for (const marker of _AGENTS_DIR_MARKERS) {
10381
- if (_exists(path13.join(agents_dir, marker))) {
10701
+ if (_exists(path14.join(agents_dir, marker))) {
10382
10702
  return ANCHOR_AGENTS_DIR;
10383
10703
  }
10384
10704
  }
10385
10705
  }
10386
- if (_exists(path13.join(dir, ".git"))) {
10706
+ if (_exists(path14.join(dir, ".git"))) {
10387
10707
  return ANCHOR_GIT;
10388
10708
  }
10389
10709
  return null;
@@ -10394,7 +10714,7 @@ function find_project_root_with_anchor(start) {
10394
10714
  const chain = _ancestor_chain(current);
10395
10715
  if (legacy) {
10396
10716
  for (const candidate of chain) {
10397
- if (_exists(path13.join(candidate, ".git"))) {
10717
+ if (_exists(path14.join(candidate, ".git"))) {
10398
10718
  return [candidate, ANCHOR_GIT];
10399
10719
  }
10400
10720
  }
@@ -10408,7 +10728,7 @@ function find_project_root_with_anchor(start) {
10408
10728
  }
10409
10729
  let outermost = null;
10410
10730
  for (const candidate of chain) {
10411
- if (_exists(path13.join(candidate, DEFAULT_PROJECT_FILE))) {
10731
+ if (_exists(path14.join(candidate, DEFAULT_PROJECT_FILE))) {
10412
10732
  outermost = candidate;
10413
10733
  }
10414
10734
  }
@@ -10452,7 +10772,7 @@ function _expanduser(p) {
10452
10772
  return os6.homedir();
10453
10773
  }
10454
10774
  if (p.startsWith("~/") || process.platform === "win32" && p.startsWith("~\\")) {
10455
- return path13.join(os6.homedir(), p.slice(2));
10775
+ return path14.join(os6.homedir(), p.slice(2));
10456
10776
  }
10457
10777
  return p;
10458
10778
  }
@@ -10481,13 +10801,13 @@ function resolve_project_root(arg, options = {}) {
10481
10801
  function _resolve_cascade_paths(cwd, project_path) {
10482
10802
  if (cwd === null) {
10483
10803
  const legacy = project_path ? project_path : DEFAULT_PROJECT_FILE;
10484
- const parent = path13.dirname(legacy);
10804
+ const parent = path14.dirname(legacy);
10485
10805
  return [legacy, _canonical_settings_path(parent), _local_settings_path(parent)];
10486
10806
  }
10487
10807
  const root = find_project_root(cwd);
10488
10808
  if (root === null) {
10489
10809
  const legacy = project_path ? project_path : DEFAULT_PROJECT_FILE;
10490
- const parent = path13.dirname(legacy);
10810
+ const parent = path14.dirname(legacy);
10491
10811
  return [legacy, _canonical_settings_path(parent), _local_settings_path(parent)];
10492
10812
  }
10493
10813
  const cwd_resolved = _resolve(cwd);
@@ -10498,7 +10818,7 @@ function _resolve_cascade_paths(cwd, project_path) {
10498
10818
  if (cursor === root) {
10499
10819
  break;
10500
10820
  }
10501
- const parent = path13.dirname(cursor);
10821
+ const parent = path14.dirname(cursor);
10502
10822
  if (parent === cursor) {
10503
10823
  break;
10504
10824
  }
@@ -10506,7 +10826,7 @@ function _resolve_cascade_paths(cwd, project_path) {
10506
10826
  }
10507
10827
  chain.reverse();
10508
10828
  return [
10509
- ...chain.map((d) => path13.join(d, DEFAULT_PROJECT_FILE)),
10829
+ ...chain.map((d) => path14.join(d, DEFAULT_PROJECT_FILE)),
10510
10830
  _canonical_settings_path(root),
10511
10831
  _local_settings_path(root)
10512
10832
  ];
@@ -10593,7 +10913,7 @@ function _read_yaml(p) {
10593
10913
  }
10594
10914
  let data;
10595
10915
  try {
10596
- const text = fs14.readFileSync(p, "utf-8");
10916
+ const text = fs15.readFileSync(p, "utf-8");
10597
10917
  data = YAML3.parse(text, { version: "1.1" });
10598
10918
  if (data === null || data === void 0) {
10599
10919
  data = {};
@@ -10693,12 +11013,12 @@ function _is_plain_dict(value) {
10693
11013
  }
10694
11014
 
10695
11015
  // src/install/rule_scope.ts
10696
- import * as path14 from "node:path";
11016
+ import * as path15 from "node:path";
10697
11017
 
10698
11018
  // src/install/ruleInScope.ts
10699
11019
  var YAML2 = __toESM(require_dist(), 1);
10700
- import * as fs15 from "node:fs";
10701
- function parseYaml2(text) {
11020
+ import * as fs16 from "node:fs";
11021
+ function parseYaml3(text) {
10702
11022
  try {
10703
11023
  const data = YAML2.parse(text, { version: "1.1" });
10704
11024
  return data === void 0 ? null : data;
@@ -10722,7 +11042,7 @@ function parseFrontmatter(content) {
10722
11042
  }
10723
11043
  const raw = strip(content.slice(3, end));
10724
11044
  const body = lstripNewlines(content.slice(end + 4));
10725
- let meta = parseYaml2(raw);
11045
+ let meta = parseYaml3(raw);
10726
11046
  if (meta === null || meta === void 0) {
10727
11047
  meta = {};
10728
11048
  }
@@ -10735,7 +11055,7 @@ function rule_in_scope(source_path, scope, pack_scope = null, role_scope = null)
10735
11055
  if (scope === null && pack_scope === null && role_scope === null) {
10736
11056
  return true;
10737
11057
  }
10738
- const [meta] = parseFrontmatter(fs15.readFileSync(source_path, "utf-8"));
11058
+ const [meta] = parseFrontmatter(fs16.readFileSync(source_path, "utf-8"));
10739
11059
  if (meta["type"] === "always" || meta["alwaysApply"] === true) {
10740
11060
  return true;
10741
11061
  }
@@ -10786,7 +11106,7 @@ function ruleFileArrives(sourcePath, scope) {
10786
11106
  if (!sourcePath.endsWith(".md")) {
10787
11107
  return true;
10788
11108
  }
10789
- const basename7 = path14.basename(sourcePath);
11109
+ const basename7 = path15.basename(sourcePath);
10790
11110
  if (COMPAT_ALWAYS_EXCLUDED.includes(basename7)) {
10791
11111
  return false;
10792
11112
  }
@@ -10794,26 +11114,26 @@ function ruleFileArrives(sourcePath, scope) {
10794
11114
  }
10795
11115
 
10796
11116
  // src/install/partitionEligibility.ts
10797
- import * as fs17 from "node:fs";
11117
+ import * as fs18 from "node:fs";
10798
11118
  import * as os7 from "node:os";
10799
11119
 
10800
11120
  // src/install/hostLayerFingerprint.ts
10801
11121
  import { createHash as createHash4 } from "node:crypto";
10802
- import * as fs16 from "node:fs";
10803
- import * as path15 from "node:path";
11122
+ import * as fs17 from "node:fs";
11123
+ import * as path16 from "node:path";
10804
11124
  var FINGERPRINT_SCHEMA = 1;
10805
11125
  function collectFiles(dir) {
10806
11126
  const out = [];
10807
11127
  const walk = (d) => {
10808
11128
  let entries;
10809
11129
  try {
10810
- entries = fs16.readdirSync(d, { withFileTypes: true });
11130
+ entries = fs17.readdirSync(d, { withFileTypes: true });
10811
11131
  } catch {
10812
11132
  return;
10813
11133
  }
10814
11134
  const sorted = [...entries].sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0);
10815
11135
  for (const e of sorted) {
10816
- const p = path15.join(d, e.name);
11136
+ const p = path16.join(d, e.name);
10817
11137
  if (e.isDirectory()) {
10818
11138
  walk(p);
10819
11139
  } else if (e.isFile()) {
@@ -10830,10 +11150,10 @@ function fingerprintLayers(layers) {
10830
11150
  for (const layer of layers) {
10831
11151
  h.update(`layer:${layer.label}\0`);
10832
11152
  for (const file of collectFiles(layer.root)) {
10833
- h.update(path15.relative(layer.root, file));
11153
+ h.update(path16.relative(layer.root, file));
10834
11154
  h.update("\0");
10835
11155
  try {
10836
- h.update(fs16.readFileSync(file));
11156
+ h.update(fs17.readFileSync(file));
10837
11157
  } catch {
10838
11158
  h.update("\0unreadable\0");
10839
11159
  }
@@ -10843,11 +11163,11 @@ function fingerprintLayers(layers) {
10843
11163
  return h.digest("hex");
10844
11164
  }
10845
11165
  function hostLayerInputs(userHome) {
10846
- const claude = path15.join(userHome, ".claude");
11166
+ const claude = path16.join(userHome, ".claude");
10847
11167
  return [
10848
- { label: "rules", root: path15.join(claude, "rules") },
10849
- { label: "skills", root: path15.join(claude, "skills") },
10850
- { label: "commands", root: path15.join(claude, "commands") }
11168
+ { label: "rules", root: path16.join(claude, "rules") },
11169
+ { label: "skills", root: path16.join(claude, "skills") },
11170
+ { label: "commands", root: path16.join(claude, "commands") }
10851
11171
  ];
10852
11172
  }
10853
11173
 
@@ -10856,7 +11176,7 @@ var MAINTAINER_WORKSPACE = "agent-config-maintainer";
10856
11176
  function isExclusivelyPackageOnly(source_path) {
10857
11177
  let meta;
10858
11178
  try {
10859
- [meta] = parseFrontmatter(fs17.readFileSync(source_path, "utf-8"));
11179
+ [meta] = parseFrontmatter(fs18.readFileSync(source_path, "utf-8"));
10860
11180
  } catch {
10861
11181
  return false;
10862
11182
  }
@@ -10887,8 +11207,8 @@ function stampHostLayerFingerprint(installedVersion, tools, lockfilePath, skip2,
10887
11207
  }
10888
11208
 
10889
11209
  // src/install/claudeRuleRewrite.ts
10890
- import * as fs18 from "node:fs";
10891
- import * as path16 from "node:path";
11210
+ import * as fs19 from "node:fs";
11211
+ import * as path17 from "node:path";
10892
11212
 
10893
11213
  // src/install/claudePathsPlan.ts
10894
11214
  function derive_trigger_globs(meta) {
@@ -11044,22 +11364,22 @@ function rewriteClaudeRules(rulesDir) {
11044
11364
  const result = { rewritten: 0, scoped: [], dropped: [], failed: [] };
11045
11365
  let entries;
11046
11366
  try {
11047
- entries = fs18.readdirSync(rulesDir);
11367
+ entries = fs19.readdirSync(rulesDir);
11048
11368
  } catch {
11049
11369
  return result;
11050
11370
  }
11051
11371
  for (const name of entries.filter((n) => n.endsWith(".md")).sort()) {
11052
- const full = path16.join(rulesDir, name);
11372
+ const full = path17.join(rulesDir, name);
11053
11373
  let stat;
11054
11374
  try {
11055
- stat = fs18.lstatSync(full);
11375
+ stat = fs19.lstatSync(full);
11056
11376
  } catch {
11057
11377
  continue;
11058
11378
  }
11059
11379
  if (!stat.isFile() || stat.isSymbolicLink()) continue;
11060
11380
  let text;
11061
11381
  try {
11062
- text = fs18.readFileSync(full, "utf-8");
11382
+ text = fs19.readFileSync(full, "utf-8");
11063
11383
  } catch {
11064
11384
  continue;
11065
11385
  }
@@ -11069,7 +11389,7 @@ function rewriteClaudeRules(rulesDir) {
11069
11389
  const withOwnership = _withPreservedKeys(rendered.text, text);
11070
11390
  if (withOwnership !== text) {
11071
11391
  try {
11072
- fs18.writeFileSync(full, withOwnership, "utf-8");
11392
+ fs19.writeFileSync(full, withOwnership, "utf-8");
11073
11393
  } catch (e) {
11074
11394
  result.failed.push({
11075
11395
  rule: name.slice(0, -3),
@@ -11639,8 +11959,8 @@ function getErrorMap() {
11639
11959
 
11640
11960
  // node_modules/zod/v3/helpers/parseUtil.js
11641
11961
  var makeIssue = (params) => {
11642
- const { data, path: path21, errorMaps, issueData } = params;
11643
- const fullPath = [...path21, ...issueData.path || []];
11962
+ const { data, path: path22, errorMaps, issueData } = params;
11963
+ const fullPath = [...path22, ...issueData.path || []];
11644
11964
  const fullIssue = {
11645
11965
  ...issueData,
11646
11966
  path: fullPath
@@ -11756,11 +12076,11 @@ var errorUtil;
11756
12076
 
11757
12077
  // node_modules/zod/v3/types.js
11758
12078
  var ParseInputLazyPath = class {
11759
- constructor(parent, value, path21, key) {
12079
+ constructor(parent, value, path22, key) {
11760
12080
  this._cachedPath = [];
11761
12081
  this.parent = parent;
11762
12082
  this.data = value;
11763
- this._path = path21;
12083
+ this._path = path22;
11764
12084
  this._key = key;
11765
12085
  }
11766
12086
  get path() {
@@ -17053,8 +17373,8 @@ var zodToJsonSchema = (schema, options) => {
17053
17373
  };
17054
17374
 
17055
17375
  // src/scripts/_lib/module_detection.ts
17056
- import * as fs19 from "node:fs";
17057
- import * as path17 from "node:path";
17376
+ import * as fs20 from "node:fs";
17377
+ import * as path18 from "node:path";
17058
17378
  var _SKIP_DIRS = /* @__PURE__ */ new Set([".module-template", ".example"]);
17059
17379
  var _RULES = [
17060
17380
  ["app/Modules", "laravel-hmvc", "App\\Modules\\{ModuleName}"],
@@ -17068,14 +17388,14 @@ var _RULES = [
17068
17388
  ];
17069
17389
  function _isDir(p) {
17070
17390
  try {
17071
- return fs19.statSync(p).isDirectory();
17391
+ return fs20.statSync(p).isDirectory();
17072
17392
  } catch {
17073
17393
  return false;
17074
17394
  }
17075
17395
  }
17076
17396
  function _isFile(p) {
17077
17397
  try {
17078
- return fs19.statSync(p).isFile();
17398
+ return fs20.statSync(p).isFile();
17079
17399
  } catch {
17080
17400
  return false;
17081
17401
  }
@@ -17089,13 +17409,13 @@ function _isUpperChar(ch) {
17089
17409
  function _list_module_subdirs(root) {
17090
17410
  let entries;
17091
17411
  try {
17092
- entries = fs19.readdirSync(root).sort();
17412
+ entries = fs20.readdirSync(root).sort();
17093
17413
  } catch {
17094
17414
  return [];
17095
17415
  }
17096
17416
  const out = [];
17097
17417
  for (const name of entries) {
17098
- if (!_isDir(path17.join(root, name))) {
17418
+ if (!_isDir(path18.join(root, name))) {
17099
17419
  continue;
17100
17420
  }
17101
17421
  if (name.startsWith(".")) {
@@ -17117,11 +17437,11 @@ function _score_confidence(stack, root, subdirs) {
17117
17437
  return capitalized.length > 0 ? "high" : "medium";
17118
17438
  }
17119
17439
  if (stack === "node-monorepo") {
17120
- const withPkgJson = subdirs.filter((name) => _isFile(path17.join(root, name, "package.json")));
17440
+ const withPkgJson = subdirs.filter((name) => _isFile(path18.join(root, name, "package.json")));
17121
17441
  return withPkgJson.length > 0 ? "high" : "medium";
17122
17442
  }
17123
17443
  if (stack === "python-src") {
17124
- const withInit = subdirs.filter((name) => _isFile(path17.join(root, name, "__init__.py")));
17444
+ const withInit = subdirs.filter((name) => _isFile(path18.join(root, name, "__init__.py")));
17125
17445
  return withInit.length > 0 ? "high" : "medium";
17126
17446
  }
17127
17447
  if (stack === "go-internal") {
@@ -17133,7 +17453,7 @@ function detect_module_roots(project_root) {
17133
17453
  const high = [];
17134
17454
  const medium = [];
17135
17455
  for (const [rel_path, stack, namespace_template] of _RULES) {
17136
- const abs_path = path17.join(project_root, rel_path);
17456
+ const abs_path = path18.join(project_root, rel_path);
17137
17457
  if (!_isDir(abs_path)) {
17138
17458
  continue;
17139
17459
  }
@@ -17155,7 +17475,7 @@ function detect_module_roots(project_root) {
17155
17475
  }
17156
17476
 
17157
17477
  // src/scripts/_lib/model_tier.ts
17158
- import fs20 from "node:fs";
17478
+ import fs21 from "node:fs";
17159
17479
  var TIER_TO_CLAUDE_MODEL = {
17160
17480
  frontier: "fable",
17161
17481
  high: "opus",
@@ -17164,8 +17484,8 @@ var TIER_TO_CLAUDE_MODEL = {
17164
17484
  };
17165
17485
  var MODEL_TIER_RE = /^model_tier:\s*"?([a-z]+)"?\s*$/m;
17166
17486
  function read_model_tier(skill_md) {
17167
- if (!fs20.existsSync(skill_md)) return null;
17168
- const text = fs20.readFileSync(skill_md).toString("utf-8");
17487
+ if (!fs21.existsSync(skill_md)) return null;
17488
+ const text = fs21.readFileSync(skill_md).toString("utf-8");
17169
17489
  if (!text.startsWith("---\n")) return null;
17170
17490
  const end = text.indexOf("\n---\n", 4);
17171
17491
  if (end === -1) return null;
@@ -17182,39 +17502,39 @@ function render_native_model_md(text, tier) {
17182
17502
 
17183
17503
  // src/scripts/_cli/cmd_migrate.ts
17184
17504
  import { spawnSync } from "node:child_process";
17185
- import * as fs22 from "node:fs";
17186
- import * as path19 from "node:path";
17187
- import process2 from "node:process";
17188
- import { fileURLToPath as fileURLToPath4, pathToFileURL } from "node:url";
17505
+ import * as fs23 from "node:fs";
17506
+ import * as path20 from "node:path";
17507
+ import process3 from "node:process";
17508
+ import { fileURLToPath as fileURLToPath5, pathToFileURL } from "node:url";
17189
17509
 
17190
17510
  // src/scripts/_lib/package_root.ts
17191
- import * as fs21 from "node:fs";
17192
- import * as path18 from "node:path";
17193
- import { fileURLToPath as fileURLToPath3 } from "node:url";
17511
+ import * as fs22 from "node:fs";
17512
+ import * as path19 from "node:path";
17513
+ import { fileURLToPath as fileURLToPath4 } from "node:url";
17194
17514
  var PACKAGE_NAME = "@event4u/agent-config";
17195
17515
  var MAX_ASCENT = 16;
17196
17516
  function resolvePackageRoot(fromUrlOrPath, legacyHops = 3) {
17197
- const start = fromUrlOrPath.startsWith("file:") ? fileURLToPath3(fromUrlOrPath) : fromUrlOrPath;
17198
- const startDir = path18.dirname(start);
17517
+ const start = fromUrlOrPath.startsWith("file:") ? fileURLToPath4(fromUrlOrPath) : fromUrlOrPath;
17518
+ const startDir = path19.dirname(start);
17199
17519
  let dir = startDir;
17200
17520
  for (let i = 0; i < MAX_ASCENT; i++) {
17201
- const manifest = path18.join(dir, "package.json");
17202
- if (fs21.existsSync(manifest)) {
17521
+ const manifest = path19.join(dir, "package.json");
17522
+ if (fs22.existsSync(manifest)) {
17203
17523
  try {
17204
- const parsed = JSON.parse(fs21.readFileSync(manifest, "utf8"));
17524
+ const parsed = JSON.parse(fs22.readFileSync(manifest, "utf8"));
17205
17525
  if (parsed.name === PACKAGE_NAME) {
17206
17526
  return dir;
17207
17527
  }
17208
17528
  } catch {
17209
17529
  }
17210
17530
  }
17211
- const parent = path18.dirname(dir);
17531
+ const parent = path19.dirname(dir);
17212
17532
  if (parent === dir) {
17213
17533
  break;
17214
17534
  }
17215
17535
  dir = parent;
17216
17536
  }
17217
- return path18.resolve(startDir, ...Array.from({ length: legacyHops }, () => ".."));
17537
+ return path19.resolve(startDir, ...Array.from({ length: legacyHops }, () => ".."));
17218
17538
  }
17219
17539
 
17220
17540
  // src/scripts/_cli/cmd_migrate.ts
@@ -17235,7 +17555,7 @@ var LEGACY_SETTINGS_FILES = [".agent-settings.yml", ".agent-user.yml"];
17235
17555
  var LEGACY_STATE_FILENAME = ".implement-ticket-state.json";
17236
17556
  var LEGACY_STATE_V1_FILENAME = ".work-state.json";
17237
17557
  var LEGACY_AGENT_CONFIG_SHELL = "agent-config";
17238
- var _HERE_DIR = path19.dirname(fileURLToPath4(import.meta.url));
17558
+ var _HERE_DIR = path20.dirname(fileURLToPath5(import.meta.url));
17239
17559
  var ArgparseExit = class extends Error {
17240
17560
  code;
17241
17561
  constructor(code) {
@@ -17245,10 +17565,10 @@ var ArgparseExit = class extends Error {
17245
17565
  }
17246
17566
  };
17247
17567
  function _stdoutSink() {
17248
- return { write: (t) => process2.stdout.write(t) };
17568
+ return { write: (t) => process3.stdout.write(t) };
17249
17569
  }
17250
17570
  function _stderrSink() {
17251
- return { write: (t) => process2.stderr.write(t) };
17571
+ return { write: (t) => process3.stderr.write(t) };
17252
17572
  }
17253
17573
  function _print(out, line = "") {
17254
17574
  out.write(line + "\n");
@@ -17334,38 +17654,38 @@ function _jsonDumpsIndentAscii(value, indent) {
17334
17654
  }
17335
17655
  function _isFile2(p) {
17336
17656
  try {
17337
- return fs22.statSync(p).isFile();
17657
+ return fs23.statSync(p).isFile();
17338
17658
  } catch {
17339
17659
  return false;
17340
17660
  }
17341
17661
  }
17342
17662
  function _isDir2(p) {
17343
17663
  try {
17344
- return fs22.statSync(p).isDirectory();
17664
+ return fs23.statSync(p).isDirectory();
17345
17665
  } catch {
17346
17666
  return false;
17347
17667
  }
17348
17668
  }
17349
17669
  function _isSymlink(p) {
17350
17670
  try {
17351
- return fs22.lstatSync(p).isSymbolicLink();
17671
+ return fs23.lstatSync(p).isSymbolicLink();
17352
17672
  } catch {
17353
17673
  return false;
17354
17674
  }
17355
17675
  }
17356
17676
  function _exists2(p) {
17357
17677
  try {
17358
- fs22.lstatSync(p);
17678
+ fs23.lstatSync(p);
17359
17679
  return true;
17360
17680
  } catch {
17361
17681
  return false;
17362
17682
  }
17363
17683
  }
17364
17684
  function _readText(p) {
17365
- return fs22.readFileSync(p, { encoding: "utf-8" });
17685
+ return fs23.readFileSync(p, { encoding: "utf-8" });
17366
17686
  }
17367
17687
  function _writeText(p, text) {
17368
- fs22.writeFileSync(p, text, { encoding: "utf-8" });
17688
+ fs23.writeFileSync(p, text, { encoding: "utf-8" });
17369
17689
  }
17370
17690
  function _jsonLoadFile(p) {
17371
17691
  return JSON.parse(_readText(p));
@@ -17421,7 +17741,7 @@ function _classify_symlink(link) {
17421
17741
  }
17422
17742
  let target;
17423
17743
  try {
17424
- target = fs22.readlinkSync(link);
17744
+ target = fs23.readlinkSync(link);
17425
17745
  } catch {
17426
17746
  return null;
17427
17747
  }
@@ -17432,16 +17752,16 @@ function _classify_symlink(link) {
17432
17752
  return "user";
17433
17753
  }
17434
17754
  function _detect_legacy_state(project) {
17435
- return _isFile2(path19.join(project, LEGACY_STATE_FILENAME));
17755
+ return _isFile2(path20.join(project, LEGACY_STATE_FILENAME));
17436
17756
  }
17437
17757
  function _detect_legacy_settings(project) {
17438
17758
  const found = [];
17439
17759
  for (const name of LEGACY_SETTINGS_FILES) {
17440
- const flat = path19.join(project, name);
17760
+ const flat = path20.join(project, name);
17441
17761
  if (_isFile2(flat)) {
17442
17762
  found.push(flat);
17443
17763
  }
17444
- const typed = path19.join(project, "settings", name);
17764
+ const typed = path20.join(project, "settings", name);
17445
17765
  if (_isFile2(typed)) {
17446
17766
  found.push(typed);
17447
17767
  }
@@ -17449,25 +17769,25 @@ function _detect_legacy_settings(project) {
17449
17769
  return found;
17450
17770
  }
17451
17771
  function _detect_empty_shell(project) {
17452
- const shell = path19.join(project, LEGACY_AGENT_CONFIG_SHELL);
17772
+ const shell = path20.join(project, LEGACY_AGENT_CONFIG_SHELL);
17453
17773
  if (!_isDir2(shell) || _isSymlink(shell)) {
17454
17774
  return false;
17455
17775
  }
17456
17776
  try {
17457
- return fs22.readdirSync(shell).length === 0;
17777
+ return fs23.readdirSync(shell).length === 0;
17458
17778
  } catch {
17459
17779
  return false;
17460
17780
  }
17461
17781
  }
17462
17782
  function _detect_already_migrated(project) {
17463
- if (_detect_npm(path19.join(project, "package.json"))) {
17783
+ if (_detect_npm(path20.join(project, "package.json"))) {
17464
17784
  return false;
17465
17785
  }
17466
- if (_detect_composer(path19.join(project, "composer.json"))) {
17786
+ if (_detect_composer(path20.join(project, "composer.json"))) {
17467
17787
  return false;
17468
17788
  }
17469
17789
  for (const name of MANAGED_SYMLINKS) {
17470
- if (_classify_symlink(path19.join(project, name)) === "legacy") {
17790
+ if (_classify_symlink(path20.join(project, name)) === "legacy") {
17471
17791
  return false;
17472
17792
  }
17473
17793
  }
@@ -17538,11 +17858,11 @@ function _purge_legacy_symlinks(project) {
17538
17858
  const removed = [];
17539
17859
  const preserved = [];
17540
17860
  for (const name of MANAGED_SYMLINKS) {
17541
- const link = path19.join(project, name);
17861
+ const link = path20.join(project, name);
17542
17862
  const kind = _classify_symlink(link);
17543
17863
  if (kind === "legacy") {
17544
17864
  try {
17545
- fs22.unlinkSync(link);
17865
+ fs23.unlinkSync(link);
17546
17866
  removed.push(name);
17547
17867
  } catch {
17548
17868
  preserved.push(name);
@@ -17554,14 +17874,14 @@ function _purge_legacy_symlinks(project) {
17554
17874
  return [removed, preserved];
17555
17875
  }
17556
17876
  function _migrate_state_file(project) {
17557
- const source = path19.join(project, LEGACY_STATE_FILENAME);
17877
+ const source = path20.join(project, LEGACY_STATE_FILENAME);
17558
17878
  if (!_isFile2(source)) {
17559
17879
  return null;
17560
17880
  }
17561
- const target = path19.join(project, LEGACY_STATE_V1_FILENAME);
17881
+ const target = path20.join(project, LEGACY_STATE_V1_FILENAME);
17562
17882
  if (_exists2(target)) {
17563
17883
  try {
17564
- fs22.unlinkSync(source);
17884
+ fs23.unlinkSync(source);
17565
17885
  return `removed stale ${LEGACY_STATE_FILENAME} (v1 already present)`;
17566
17886
  } catch {
17567
17887
  return null;
@@ -17576,7 +17896,7 @@ function _migrate_state_file(project) {
17576
17896
  }
17577
17897
  function _load_state_migrator() {
17578
17898
  const pkg_root = resolvePackageRoot(import.meta.url);
17579
- const rel = path19.join(
17899
+ const rel = path20.join(
17580
17900
  "agent-src",
17581
17901
  "templates",
17582
17902
  "scripts",
@@ -17584,21 +17904,21 @@ function _load_state_migrator() {
17584
17904
  "migration",
17585
17905
  "v0_to_v1.ts"
17586
17906
  );
17587
- const driver = [path19.join(pkg_root, "dist", rel), path19.join(pkg_root, "src", rel)].find(
17588
- (p) => fs22.existsSync(p)
17907
+ const driver = [path20.join(pkg_root, "dist", rel), path20.join(pkg_root, "src", rel)].find(
17908
+ (p) => fs23.existsSync(p)
17589
17909
  ) ?? null;
17590
17910
  if (driver === null) {
17591
17911
  return null;
17592
17912
  }
17593
- const binName = process2.platform === "win32" ? "tsx.cmd" : "tsx";
17913
+ const binName = process3.platform === "win32" ? "tsx.cmd" : "tsx";
17594
17914
  let tsxBin = null;
17595
17915
  for (let dir = pkg_root; ; ) {
17596
- const cand = path19.join(dir, "node_modules", ".bin", binName);
17597
- if (fs22.existsSync(cand)) {
17916
+ const cand = path20.join(dir, "node_modules", ".bin", binName);
17917
+ if (fs23.existsSync(cand)) {
17598
17918
  tsxBin = cand;
17599
17919
  break;
17600
17920
  }
17601
- const parent = path19.dirname(dir);
17921
+ const parent = path20.dirname(dir);
17602
17922
  if (parent === dir) break;
17603
17923
  dir = parent;
17604
17924
  }
@@ -17625,17 +17945,17 @@ function _delete_legacy_settings(project) {
17625
17945
  const removed = [];
17626
17946
  for (const p of _detect_legacy_settings(project)) {
17627
17947
  try {
17628
- fs22.unlinkSync(p);
17629
- removed.push(path19.relative(project, p));
17948
+ fs23.unlinkSync(p);
17949
+ removed.push(path20.relative(project, p));
17630
17950
  } catch {
17631
17951
  continue;
17632
17952
  }
17633
17953
  }
17634
- const settings_dir = path19.join(project, "settings");
17954
+ const settings_dir = path20.join(project, "settings");
17635
17955
  if (_isDir2(settings_dir) && !_isSymlink(settings_dir)) {
17636
17956
  try {
17637
- if (fs22.readdirSync(settings_dir).length === 0) {
17638
- fs22.rmdirSync(settings_dir);
17957
+ if (fs23.readdirSync(settings_dir).length === 0) {
17958
+ fs23.rmdirSync(settings_dir);
17639
17959
  removed.push("settings/");
17640
17960
  }
17641
17961
  } catch {
@@ -17644,12 +17964,12 @@ function _delete_legacy_settings(project) {
17644
17964
  return removed;
17645
17965
  }
17646
17966
  function _remove_empty_shell(project) {
17647
- const shell = path19.join(project, LEGACY_AGENT_CONFIG_SHELL);
17967
+ const shell = path20.join(project, LEGACY_AGENT_CONFIG_SHELL);
17648
17968
  if (!_detect_empty_shell(project)) {
17649
17969
  return false;
17650
17970
  }
17651
17971
  try {
17652
- fs22.rmdirSync(shell);
17972
+ fs23.rmdirSync(shell);
17653
17973
  } catch {
17654
17974
  return false;
17655
17975
  }
@@ -17659,7 +17979,7 @@ function _reEscape(s) {
17659
17979
  return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
17660
17980
  }
17661
17981
  function _update_gitignore(project) {
17662
- const gitignore = path19.join(project, ".gitignore");
17982
+ const gitignore = path20.join(project, ".gitignore");
17663
17983
  const block = `${GITIGNORE_BLOCK_START}
17664
17984
  ${GITIGNORE_NEW_BODY}${GITIGNORE_BLOCK_END}
17665
17985
  `;
@@ -17690,16 +18010,16 @@ ${GITIGNORE_NEW_BODY}${GITIGNORE_BLOCK_END}
17690
18010
  }
17691
18011
  function _build_plan(project) {
17692
18012
  return {
17693
- npm: _detect_npm(path19.join(project, "package.json")),
17694
- composer: _detect_composer(path19.join(project, "composer.json")),
18013
+ npm: _detect_npm(path20.join(project, "package.json")),
18014
+ composer: _detect_composer(path20.join(project, "composer.json")),
17695
18015
  symlinks_legacy: MANAGED_SYMLINKS.filter(
17696
- (name) => _classify_symlink(path19.join(project, name)) === "legacy"
18016
+ (name) => _classify_symlink(path20.join(project, name)) === "legacy"
17697
18017
  ),
17698
18018
  symlinks_user: MANAGED_SYMLINKS.filter(
17699
- (name) => _classify_symlink(path19.join(project, name)) === "user"
18019
+ (name) => _classify_symlink(path20.join(project, name)) === "user"
17700
18020
  ),
17701
- state_file: _isFile2(path19.join(project, LEGACY_STATE_FILENAME)),
17702
- settings_files: _detect_legacy_settings(project).map((p) => path19.relative(project, p)),
18021
+ state_file: _isFile2(path20.join(project, LEGACY_STATE_FILENAME)),
18022
+ settings_files: _detect_legacy_settings(project).map((p) => path20.relative(project, p)),
17703
18023
  empty_shell: _detect_empty_shell(project)
17704
18024
  };
17705
18025
  }
@@ -17763,10 +18083,10 @@ function _warn_on_major_mismatch(from_major, plan, out) {
17763
18083
  }
17764
18084
  function _apply(project, out, err) {
17765
18085
  const summary = [];
17766
- if (_strip_npm_entry(path19.join(project, "package.json"))) {
18086
+ if (_strip_npm_entry(path20.join(project, "package.json"))) {
17767
18087
  summary.push(`removed ${PACKAGE_NAME_NPM} from package.json`);
17768
18088
  }
17769
- if (_strip_composer_entry(path19.join(project, "composer.json"))) {
18089
+ if (_strip_composer_entry(path20.join(project, "composer.json"))) {
17770
18090
  summary.push(`removed ${PACKAGE_NAME_COMPOSER} from composer.json`);
17771
18091
  }
17772
18092
  const [removed_links, preserved_links] = _purge_legacy_symlinks(project);
@@ -17802,7 +18122,7 @@ function _apply(project, out, err) {
17802
18122
  _print(out, "\n Next: review the diff and commit.");
17803
18123
  return 0;
17804
18124
  }
17805
- function _parse(argv, out, err) {
18125
+ function _parse2(argv, out, err) {
17806
18126
  const prog = "agent-config migrate";
17807
18127
  const usage = `usage: ${prog} [-h] [--dry-run | --check] [--from {4,5}]
17808
18128
  `;
@@ -17861,7 +18181,7 @@ function _parse(argv, out, err) {
17861
18181
  function main(argv = null, options = {}) {
17862
18182
  const out = options.out ?? _stdoutSink();
17863
18183
  const err = options.err ?? _stderrSink();
17864
- const args = _parse(argv ?? process2.argv.slice(2), out, err);
18184
+ const args = _parse2(argv ?? process3.argv.slice(2), out, err);
17865
18185
  const [project] = resolve_project_root(null, { cwd: options.cwd ?? null });
17866
18186
  if (args.from_major) {
17867
18187
  _print(out, `\u2139\uFE0F declared source major: ${args.from_major}.x`);
@@ -17887,34 +18207,34 @@ function main(argv = null, options = {}) {
17887
18207
  return _apply(project, out, err);
17888
18208
  }
17889
18209
  var _inForeignBundle = !(typeof __AGENT_CONFIG_CLI_DELEGATE__ !== "undefined" && __AGENT_CONFIG_CLI_DELEGATE__);
17890
- var _HERE = fileURLToPath4(import.meta.url);
18210
+ var _HERE = fileURLToPath5(import.meta.url);
17891
18211
  function _isCliEntry() {
17892
- if (process2.argv[1] === void 0) {
18212
+ if (process3.argv[1] === void 0) {
17893
18213
  return false;
17894
18214
  }
17895
18215
  if (typeof __AGENT_CONFIG_CLI_DELEGATE__ !== "undefined" && __AGENT_CONFIG_CLI_DELEGATE__) {
17896
- if (path19.basename(process2.argv[1], ".js") === "cmd_migrate") {
18216
+ if (path20.basename(process3.argv[1], ".js") === "cmd_migrate") {
17897
18217
  return true;
17898
18218
  }
17899
18219
  }
17900
- const argvUrl = pathToFileURL(path19.resolve(process2.argv[1])).href;
18220
+ const argvUrl = pathToFileURL(path20.resolve(process3.argv[1])).href;
17901
18221
  if (import.meta.url === argvUrl) {
17902
18222
  return true;
17903
18223
  }
17904
18224
  try {
17905
- const here = fs22.realpathSync(fileURLToPath4(import.meta.url));
17906
- const argv = fs22.realpathSync(path19.resolve(process2.argv[1]));
18225
+ const here = fs23.realpathSync(fileURLToPath5(import.meta.url));
18226
+ const argv = fs23.realpathSync(path20.resolve(process3.argv[1]));
17907
18227
  return here === argv;
17908
18228
  } catch {
17909
18229
  return false;
17910
18230
  }
17911
18231
  }
17912
- if (!_inForeignBundle && (_isCliEntry() || process2.argv[1] === _HERE)) {
18232
+ if (!_inForeignBundle && (_isCliEntry() || process3.argv[1] === _HERE)) {
17913
18233
  try {
17914
- process2.exitCode = main(process2.argv.slice(2));
18234
+ process3.exitCode = main(process3.argv.slice(2));
17915
18235
  } catch (exc) {
17916
18236
  if (exc instanceof ArgparseExit) {
17917
- process2.exitCode = exc.code;
18237
+ process3.exitCode = exc.code;
17918
18238
  } else {
17919
18239
  throw exc;
17920
18240
  }
@@ -17946,7 +18266,7 @@ var SCOPE_DETECT_AI_DIRS = [
17946
18266
  ];
17947
18267
 
17948
18268
  // src/scripts/install.ts
17949
- var _HERE2 = fileURLToPath5(import.meta.url);
18269
+ var _HERE2 = fileURLToPath6(import.meta.url);
17950
18270
  var SystemExitError = class extends Error {
17951
18271
  constructor(code) {
17952
18272
  super(`system-exit-${code}`);
@@ -17964,34 +18284,34 @@ var ArgparseExit2 = class extends Error {
17964
18284
  function expanduser6(p) {
17965
18285
  if (p === "~") return os8.homedir();
17966
18286
  if (p.startsWith("~/") || p.startsWith("~\\")) {
17967
- return path20.join(os8.homedir(), p.slice(2));
18287
+ return path21.join(os8.homedir(), p.slice(2));
17968
18288
  }
17969
18289
  return p;
17970
18290
  }
17971
18291
  function resolvePath(p) {
17972
18292
  try {
17973
- return fs23.realpathSync(path20.resolve(p));
18293
+ return fs24.realpathSync(path21.resolve(p));
17974
18294
  } catch {
17975
- return path20.resolve(p);
18295
+ return path21.resolve(p);
17976
18296
  }
17977
18297
  }
17978
18298
  function isFile(p) {
17979
18299
  try {
17980
- return fs23.statSync(p).isFile();
18300
+ return fs24.statSync(p).isFile();
17981
18301
  } catch {
17982
18302
  return false;
17983
18303
  }
17984
18304
  }
17985
18305
  function isDir(p) {
17986
18306
  try {
17987
- return fs23.statSync(p).isDirectory();
18307
+ return fs24.statSync(p).isDirectory();
17988
18308
  } catch {
17989
18309
  return false;
17990
18310
  }
17991
18311
  }
17992
18312
  function pathExists(p) {
17993
18313
  try {
17994
- fs23.statSync(p);
18314
+ fs24.statSync(p);
17995
18315
  return true;
17996
18316
  } catch {
17997
18317
  return false;
@@ -17999,24 +18319,24 @@ function pathExists(p) {
17999
18319
  }
18000
18320
  function isSymlink(p) {
18001
18321
  try {
18002
- return fs23.lstatSync(p).isSymbolicLink();
18322
+ return fs24.lstatSync(p).isSymbolicLink();
18003
18323
  } catch {
18004
18324
  return false;
18005
18325
  }
18006
18326
  }
18007
18327
  function readText(p) {
18008
- return fs23.readFileSync(p, "utf-8");
18328
+ return fs24.readFileSync(p, "utf-8");
18009
18329
  }
18010
18330
  function writeText(p, content) {
18011
- fs23.writeFileSync(p, content, "utf-8");
18331
+ fs24.writeFileSync(p, content, "utf-8");
18012
18332
  }
18013
18333
  function mkdirp(p) {
18014
- fs23.mkdirSync(p, { recursive: true });
18334
+ fs24.mkdirSync(p, { recursive: true });
18015
18335
  }
18016
18336
  function sortedGlobStems(directory, suffix) {
18017
18337
  let entries;
18018
18338
  try {
18019
- entries = fs23.readdirSync(directory);
18339
+ entries = fs24.readdirSync(directory);
18020
18340
  } catch {
18021
18341
  return [];
18022
18342
  }
@@ -18036,7 +18356,7 @@ function sortedGlobStems(directory, suffix) {
18036
18356
  function countZips(directory) {
18037
18357
  if (!isDir(directory)) return 0;
18038
18358
  let n = 0;
18039
- for (const name of fs23.readdirSync(directory)) {
18359
+ for (const name of fs24.readdirSync(directory)) {
18040
18360
  if (name.endsWith(".zip")) n += 1;
18041
18361
  }
18042
18362
  return n;
@@ -18044,35 +18364,35 @@ function countZips(directory) {
18044
18364
  function sha256OfFile(p) {
18045
18365
  let data;
18046
18366
  try {
18047
- data = fs23.readFileSync(p);
18367
+ data = fs24.readFileSync(p);
18048
18368
  } catch {
18049
18369
  return null;
18050
18370
  }
18051
18371
  return crypto3.createHash("sha256").update(data).digest("hex");
18052
18372
  }
18053
18373
  function atomicWrite0644(target, body, prefix) {
18054
- const dir = path20.dirname(target);
18055
- const tmpName = path20.join(
18374
+ const dir = path21.dirname(target);
18375
+ const tmpName = path21.join(
18056
18376
  dir,
18057
- `${prefix}${process3.pid}.${crypto3.randomBytes(6).toString("hex")}.yml.tmp`
18377
+ `${prefix}${process4.pid}.${crypto3.randomBytes(6).toString("hex")}.yml.tmp`
18058
18378
  );
18059
18379
  let fd = null;
18060
18380
  try {
18061
- fd = fs23.openSync(tmpName, "wx", 420);
18062
- fs23.writeFileSync(fd, body, "utf-8");
18063
- fs23.closeSync(fd);
18381
+ fd = fs24.openSync(tmpName, "wx", 420);
18382
+ fs24.writeFileSync(fd, body, "utf-8");
18383
+ fs24.closeSync(fd);
18064
18384
  fd = null;
18065
- fs23.chmodSync(tmpName, 420);
18066
- fs23.renameSync(tmpName, target);
18385
+ fs24.chmodSync(tmpName, 420);
18386
+ fs24.renameSync(tmpName, target);
18067
18387
  } catch (err) {
18068
18388
  if (fd !== null) {
18069
18389
  try {
18070
- fs23.closeSync(fd);
18390
+ fs24.closeSync(fd);
18071
18391
  } catch {
18072
18392
  }
18073
18393
  }
18074
18394
  try {
18075
- fs23.unlinkSync(tmpName);
18395
+ fs24.unlinkSync(tmpName);
18076
18396
  } catch {
18077
18397
  }
18078
18398
  throw err;
@@ -18196,12 +18516,12 @@ var LEGACY_SETTINGS_FILE = ".agent-settings";
18196
18516
  var LEGACY_BACKUP_FILE = ".agent-settings.backup.key-value";
18197
18517
  var SETTINGS_SUBDIR = ["agents", "settings"];
18198
18518
  function _canonical_settings_target(project_root) {
18199
- return path20.join(project_root, ...SETTINGS_SUBDIR, SETTINGS_FILE);
18519
+ return path21.join(project_root, ...SETTINGS_SUBDIR, SETTINGS_FILE);
18200
18520
  }
18201
18521
  function _resolve_settings_read(project_root) {
18202
18522
  const canonical = _canonical_settings_target(project_root);
18203
18523
  if (pathExists(canonical)) return canonical;
18204
- const legacy = path20.join(project_root, SETTINGS_FILE);
18524
+ const legacy = path21.join(project_root, SETTINGS_FILE);
18205
18525
  if (pathExists(legacy)) return legacy;
18206
18526
  return canonical;
18207
18527
  }
@@ -18230,7 +18550,7 @@ var state = {
18230
18550
  };
18231
18551
  function _emit_progress(obj) {
18232
18552
  if (!state.PROGRESS_NDJSON) return;
18233
- process3.stdout.write(jsonDumpsCompact(obj) + "\n");
18553
+ process4.stdout.write(jsonDumpsCompact(obj) + "\n");
18234
18554
  }
18235
18555
  function _emit_progress_terminal(rc) {
18236
18556
  if (!state.PROGRESS_NDJSON) return;
@@ -18241,33 +18561,33 @@ function _emit_progress_terminal(rc) {
18241
18561
  }
18242
18562
  }
18243
18563
  function info(msg) {
18244
- if (!state.QUIET) process3.stdout.write(` ${msg}
18564
+ if (!state.QUIET) process4.stdout.write(` ${msg}
18245
18565
  `);
18246
18566
  }
18247
18567
  function success(msg) {
18248
- if (!state.QUIET) process3.stdout.write(` \u2705 ${msg}
18568
+ if (!state.QUIET) process4.stdout.write(` \u2705 ${msg}
18249
18569
  `);
18250
18570
  }
18251
18571
  function skip(msg) {
18252
- if (!state.QUIET) process3.stdout.write(` \u23ED\uFE0F ${msg}
18572
+ if (!state.QUIET) process4.stdout.write(` \u23ED\uFE0F ${msg}
18253
18573
  `);
18254
18574
  }
18255
18575
  function warn(msg) {
18256
- process3.stderr.write(` \u26A0\uFE0F ${msg}
18576
+ process4.stderr.write(` \u26A0\uFE0F ${msg}
18257
18577
  `);
18258
18578
  }
18259
18579
  function fail(msg) {
18260
- process3.stderr.write(` \u274C ${msg}
18580
+ process4.stderr.write(` \u274C ${msg}
18261
18581
  `);
18262
- process3.stderr.write(
18582
+ process4.stderr.write(
18263
18583
  " Diagnose: `./agent-config doctor` (or `--check <id>` for a single category)\n"
18264
18584
  );
18265
18585
  throw new SystemExitError(1);
18266
18586
  }
18267
18587
  function detect_package_root(project_root) {
18268
- const npm_path = path20.join(project_root, "node_modules", "@event4u", "agent-config");
18588
+ const npm_path = path21.join(project_root, "node_modules", "@event4u", "agent-config");
18269
18589
  if (isDir(npm_path)) return resolvePath(npm_path);
18270
- if (pathExists(path20.join(project_root, "src", "config", "profiles", "minimal.ini"))) {
18590
+ if (pathExists(path21.join(project_root, "src", "config", "profiles", "minimal.ini"))) {
18271
18591
  return project_root;
18272
18592
  }
18273
18593
  fail(
@@ -18275,12 +18595,12 @@ function detect_package_root(project_root) {
18275
18595
  );
18276
18596
  }
18277
18597
  function detect_package_type(package_root) {
18278
- if (package_root.split(path20.sep).includes("node_modules")) return "npm";
18598
+ if (package_root.split(path21.sep).includes("node_modules")) return "npm";
18279
18599
  return "local";
18280
18600
  }
18281
18601
  function detect_package_type_for_project(project_root, package_root) {
18282
18602
  const npm_path = resolvePath(
18283
- path20.join(project_root, "node_modules", "@event4u", "agent-config")
18603
+ path21.join(project_root, "node_modules", "@event4u", "agent-config")
18284
18604
  );
18285
18605
  const package_resolved = resolvePath(package_root);
18286
18606
  if (package_resolved === npm_path) return "npm";
@@ -18288,7 +18608,7 @@ function detect_package_type_for_project(project_root, package_root) {
18288
18608
  }
18289
18609
  function _is_interactive() {
18290
18610
  try {
18291
- return Boolean(process3.stdin.isTTY) && Boolean(process3.stdout.isTTY);
18611
+ return Boolean(process4.stdin.isTTY) && Boolean(process4.stdout.isTTY);
18292
18612
  } catch {
18293
18613
  return false;
18294
18614
  }
@@ -18300,7 +18620,7 @@ function ensure_directory(p) {
18300
18620
  mkdirp(p);
18301
18621
  }
18302
18622
  function write_file(p, content) {
18303
- ensure_directory(path20.dirname(p));
18623
+ ensure_directory(path21.dirname(p));
18304
18624
  writeText(p, content);
18305
18625
  }
18306
18626
  function read_json_file(p) {
@@ -18471,7 +18791,7 @@ function _append_unknown_legacy(rendered, legacy_values, unknown_keys) {
18471
18791
  return rendered + "\n" + suffix;
18472
18792
  }
18473
18793
  function _migrate_legacy_if_present(project_root, template_body) {
18474
- const legacy_target = path20.join(project_root, LEGACY_SETTINGS_FILE);
18794
+ const legacy_target = path21.join(project_root, LEGACY_SETTINGS_FILE);
18475
18795
  if (!isFile(legacy_target)) return null;
18476
18796
  const legacy_text = readText(legacy_target);
18477
18797
  const [values, unknown] = _parse_legacy_settings(legacy_text);
@@ -18486,9 +18806,9 @@ function _migrate_legacy_if_present(project_root, template_body) {
18486
18806
  }
18487
18807
  }
18488
18808
  rendered = _append_unknown_legacy(rendered, values, unknown);
18489
- const backup_target = path20.join(project_root, LEGACY_BACKUP_FILE);
18809
+ const backup_target = path21.join(project_root, LEGACY_BACKUP_FILE);
18490
18810
  writeText(backup_target, legacy_text);
18491
- fs23.unlinkSync(legacy_target);
18811
+ fs24.unlinkSync(legacy_target);
18492
18812
  info(`Migrated legacy ${LEGACY_SETTINGS_FILE} \u2192 ${SETTINGS_FILE}`);
18493
18813
  info(`Backup saved to ${LEGACY_BACKUP_FILE}`);
18494
18814
  if (unknown.length > 0) {
@@ -18523,7 +18843,7 @@ function _render_template(template, profile_values) {
18523
18843
  return body;
18524
18844
  }
18525
18845
  function _load_valid_user_types(package_root) {
18526
- const directory = path20.join(package_root, USER_TYPES_DIR);
18846
+ const directory = path21.join(package_root, USER_TYPES_DIR);
18527
18847
  if (!isDir(directory)) return [];
18528
18848
  return sortedGlobStems(directory, ".yml");
18529
18849
  }
@@ -18580,8 +18900,8 @@ function splitlinesKeepends(text) {
18580
18900
  }
18581
18901
  function ensure_agent_settings(project_root, package_root, profile, force, user_type = "", packs = null) {
18582
18902
  const target = _canonical_settings_target(project_root);
18583
- const profile_source = path20.join(package_root, "src", "config", "profiles", `${profile}.ini`);
18584
- const template_source = path20.join(package_root, "src", "config", "agent-settings.template.yml");
18903
+ const profile_source = path21.join(package_root, "src", "config", "profiles", `${profile}.ini`);
18904
+ const template_source = path21.join(package_root, "src", "config", "agent-settings.template.yml");
18585
18905
  if (!pathExists(profile_source)) fail(`Missing profile preset: ${profile_source}`);
18586
18906
  if (!pathExists(template_source)) fail(`Missing settings template: ${template_source}`);
18587
18907
  const template = readText(template_source);
@@ -18595,21 +18915,21 @@ function ensure_agent_settings(project_root, package_root, profile, force, user_
18595
18915
  if (profile_values["rule_loading_tier"] !== profile) {
18596
18916
  const got = "rule_loading_tier" in profile_values ? `'${profile_values["rule_loading_tier"]}'` : "None";
18597
18917
  fail(
18598
- `Profile preset ${path20.basename(profile_source)} has rule_loading_tier=${got} but --profile=${profile}`
18918
+ `Profile preset ${path21.basename(profile_source)} has rule_loading_tier=${got} but --profile=${profile}`
18599
18919
  );
18600
18920
  }
18601
18921
  profile_values["user_type"] = _validate_user_type(package_root, user_type);
18602
18922
  let template_body = _render_template(template, profile_values);
18603
18923
  template_body = _inject_packs(template_body, packs ?? []);
18604
- const legacy_root = path20.join(project_root, SETTINGS_FILE);
18924
+ const legacy_root = path21.join(project_root, SETTINGS_FILE);
18605
18925
  if (isFile(legacy_root) && !pathExists(target)) {
18606
- mkdirp(path20.dirname(target));
18926
+ mkdirp(path21.dirname(target));
18607
18927
  writeText(target, readText(legacy_root));
18608
- fs23.unlinkSync(legacy_root);
18928
+ fs24.unlinkSync(legacy_root);
18609
18929
  success(`Migrated ${SETTINGS_FILE} \u2192 agents/settings/${SETTINGS_FILE} (ADR-038)`);
18610
18930
  return;
18611
18931
  }
18612
- const legacy_target = path20.join(project_root, LEGACY_SETTINGS_FILE);
18932
+ const legacy_target = path21.join(project_root, LEGACY_SETTINGS_FILE);
18613
18933
  if (isFile(legacy_target) && pathExists(target)) {
18614
18934
  warn(
18615
18935
  `Both ${SETTINGS_FILE} and legacy ${LEGACY_SETTINGS_FILE} exist. Skipping migration to avoid overwriting ${SETTINGS_FILE}. Delete one of them manually and re-run.`
@@ -18626,7 +18946,7 @@ function ensure_agent_settings(project_root, package_root, profile, force, user_
18626
18946
  skip(`${SETTINGS_FILE} already exists`);
18627
18947
  return;
18628
18948
  }
18629
- mkdirp(path20.dirname(target));
18949
+ mkdirp(path21.dirname(target));
18630
18950
  write_file(target, template_body);
18631
18951
  const user_type_value = profile_values["user_type"] ?? "";
18632
18952
  const suffix = user_type_value ? `, user_type=${user_type_value}` : "";
@@ -18639,7 +18959,7 @@ function ensure_vscode_bridge(project_root, package_type, force) {
18639
18959
  const plugin_path = plugin_paths[package_type] ?? "./plugin/agent-config";
18640
18960
  const bridge = { "chat.pluginLocations": { [plugin_path]: true } };
18641
18961
  return merge_json_file(
18642
- path20.join(project_root, ".vscode", "settings.json"),
18962
+ path21.join(project_root, ".vscode", "settings.json"),
18643
18963
  bridge,
18644
18964
  force,
18645
18965
  ".vscode/settings.json"
@@ -18648,14 +18968,14 @@ function ensure_vscode_bridge(project_root, package_type, force) {
18648
18968
  function ensure_augment_bridge(project_root, force) {
18649
18969
  const bridge = { enabledPlugins: { "agent-config@event4u": true } };
18650
18970
  return merge_json_file(
18651
- path20.join(project_root, ".augment", "settings.json"),
18971
+ path21.join(project_root, ".augment", "settings.json"),
18652
18972
  bridge,
18653
18973
  force,
18654
18974
  ".augment/settings.json"
18655
18975
  );
18656
18976
  }
18657
- var AUGMENT_USER_DIR = path20.join(os8.homedir(), ".augment");
18658
- var AUGMENT_USER_HOOKS_DIR = path20.join(AUGMENT_USER_DIR, "hooks");
18977
+ var AUGMENT_USER_DIR = path21.join(os8.homedir(), ".augment");
18978
+ var AUGMENT_USER_HOOKS_DIR = path21.join(AUGMENT_USER_DIR, "hooks");
18659
18979
  var AUGMENT_DISPATCHER_TRAMPOLINE = "augment-dispatcher.sh";
18660
18980
  var AUGMENT_LEGACY_TRAMPOLINES = [
18661
18981
  "augment-chat-history.sh",
@@ -18663,37 +18983,30 @@ var AUGMENT_LEGACY_TRAMPOLINES = [
18663
18983
  "augment-onboarding-gate.sh",
18664
18984
  "augment-context-hygiene.sh"
18665
18985
  ];
18666
- var AUGMENT_DISPATCHER_BINDINGS = [
18667
- ["session_start", "SessionStart"],
18668
- ["session_end", "SessionEnd"],
18669
- ["stop", "Stop"],
18670
- ["pre_tool_use", "PreToolUse"],
18671
- ["post_tool_use", "PostToolUse"]
18672
- ];
18673
18986
  function _deploy_augment_trampoline(package_root, name, force) {
18674
- const src = path20.join(package_root, "scripts", "hooks", name);
18987
+ const src = path21.join(package_root, "scripts", "hooks", name);
18675
18988
  if (!pathExists(src)) {
18676
18989
  skip(`augment trampoline missing in package: ${src}`);
18677
18990
  return null;
18678
18991
  }
18679
18992
  mkdirp(AUGMENT_USER_HOOKS_DIR);
18680
- const dst = path20.join(AUGMENT_USER_HOOKS_DIR, name);
18993
+ const dst = path21.join(AUGMENT_USER_HOOKS_DIR, name);
18681
18994
  const src_text = readText(src);
18682
18995
  if (pathExists(dst) && readText(dst) === src_text && !force) {
18683
18996
  skip(`~/.augment/hooks/${name} already up to date`);
18684
18997
  } else {
18685
18998
  writeText(dst, src_text);
18686
- fs23.chmodSync(dst, 493);
18999
+ fs24.chmodSync(dst, 493);
18687
19000
  success(`~/.augment/hooks/${name} installed`);
18688
19001
  }
18689
19002
  return dst;
18690
19003
  }
18691
19004
  function _remove_legacy_augment_trampolines() {
18692
19005
  for (const name of AUGMENT_LEGACY_TRAMPOLINES) {
18693
- const legacy = path20.join(AUGMENT_USER_HOOKS_DIR, name);
19006
+ const legacy = path21.join(AUGMENT_USER_HOOKS_DIR, name);
18694
19007
  try {
18695
19008
  if (isFile(legacy)) {
18696
- fs23.unlinkSync(legacy);
19009
+ fs24.unlinkSync(legacy);
18697
19010
  skip(`removed legacy ~/.augment/hooks/${name}`);
18698
19011
  }
18699
19012
  } catch (err) {
@@ -18706,14 +19019,14 @@ function ensure_augment_user_hooks(package_root, force) {
18706
19019
  if (dst === null) return [];
18707
19020
  _remove_legacy_augment_trampolines();
18708
19021
  const per_event = {};
18709
- for (const [ac_event, native] of AUGMENT_DISPATCHER_BINDINGS) {
18710
- const cmd = `${dst} ${ac_event} ${native}`;
19022
+ for (const { slot, native } of hostBindings("augment")) {
19023
+ const cmd = `${dst} ${slot} ${native}`;
18711
19024
  const entry = { hooks: [{ type: "command", command: cmd }] };
18712
19025
  (per_event[native] ??= []).push(entry);
18713
19026
  }
18714
19027
  const settings_patch = { hooks: per_event };
18715
19028
  return merge_json_file(
18716
- path20.join(AUGMENT_USER_DIR, "settings.json"),
19029
+ path21.join(AUGMENT_USER_DIR, "settings.json"),
18717
19030
  settings_patch,
18718
19031
  force,
18719
19032
  "~/.augment/settings.json"
@@ -18738,7 +19051,7 @@ function _heal_legacy_claude_plugin_ids(p) {
18738
19051
  return removed;
18739
19052
  }
18740
19053
  function ensure_claude_bridge(project_root, force) {
18741
- const target = path20.join(project_root, ".claude", "settings.json");
19054
+ const target = path21.join(project_root, ".claude", "settings.json");
18742
19055
  const healed = _heal_legacy_claude_plugin_ids(target);
18743
19056
  for (const pid of healed) {
18744
19057
  success(`.claude/settings.json: removed stale plugin id \`${pid}\``);
@@ -18750,68 +19063,53 @@ var ensure_mcp_bridge = makeEnsureMcpBridge(merge_json_file);
18750
19063
  var _resolve_tier_b = resolveTierB;
18751
19064
  var _tier_b_advisory = tierBAdvisory;
18752
19065
  var _prune_tier_b_modules = (dr, tier_b) => _prune_modules_by(dr, tierBPrunePredicate(tier_b));
18753
- var CURSOR_DISPATCHER_BINDINGS = [
18754
- ["session_start", "sessionStart"],
18755
- ["session_end", "sessionEnd"],
18756
- ["stop", "stop"],
18757
- ["user_prompt_submit", "beforeSubmitPrompt"],
18758
- ["post_tool_use", "postToolUse"]
18759
- ];
18760
19066
  function _cursor_dispatch_command(ac_event, native) {
18761
19067
  return `[ -x ./agent-config ] || exit 0; ./agent-config dispatch:hook --platform cursor --event ${ac_event} --native-event ${native}`;
18762
19068
  }
18763
19069
  function ensure_cursor_bridge(project_root, force) {
18764
19070
  const hooks = {};
18765
- for (const [ac_event, native] of CURSOR_DISPATCHER_BINDINGS) {
18766
- (hooks[native] ??= []).push({ command: _cursor_dispatch_command(ac_event, native) });
19071
+ for (const { slot, native } of hostBindings("cursor")) {
19072
+ (hooks[native] ??= []).push({ command: _cursor_dispatch_command(slot, native) });
18767
19073
  }
18768
19074
  const bridge = { version: 1, hooks };
18769
19075
  return merge_json_file(
18770
- path20.join(project_root, ".cursor", "hooks.json"),
19076
+ path21.join(project_root, ".cursor", "hooks.json"),
18771
19077
  bridge,
18772
19078
  force,
18773
19079
  ".cursor/hooks.json"
18774
19080
  );
18775
19081
  }
18776
- var CURSOR_USER_DIR = path20.join(os8.homedir(), ".cursor");
18777
- var CURSOR_USER_HOOKS_DIR = path20.join(CURSOR_USER_DIR, "hooks");
19082
+ var CURSOR_USER_DIR = path21.join(os8.homedir(), ".cursor");
19083
+ var CURSOR_USER_HOOKS_DIR = path21.join(CURSOR_USER_DIR, "hooks");
18778
19084
  var CURSOR_DISPATCHER_TRAMPOLINE = "cursor-dispatcher.sh";
18779
19085
  function ensure_cursor_user_hooks(package_root, force) {
18780
- const src = path20.join(package_root, "scripts", "hooks", CURSOR_DISPATCHER_TRAMPOLINE);
19086
+ const src = path21.join(package_root, "scripts", "hooks", CURSOR_DISPATCHER_TRAMPOLINE);
18781
19087
  if (!pathExists(src)) {
18782
19088
  skip(`cursor trampoline missing in package: ${src}`);
18783
19089
  return [];
18784
19090
  }
18785
19091
  mkdirp(CURSOR_USER_HOOKS_DIR);
18786
- const dst = path20.join(CURSOR_USER_HOOKS_DIR, CURSOR_DISPATCHER_TRAMPOLINE);
19092
+ const dst = path21.join(CURSOR_USER_HOOKS_DIR, CURSOR_DISPATCHER_TRAMPOLINE);
18787
19093
  const src_text = readText(src);
18788
19094
  if (pathExists(dst) && readText(dst) === src_text && !force) {
18789
19095
  skip(`~/.cursor/hooks/${CURSOR_DISPATCHER_TRAMPOLINE} already up to date`);
18790
19096
  } else {
18791
19097
  writeText(dst, src_text);
18792
- fs23.chmodSync(dst, 493);
19098
+ fs24.chmodSync(dst, 493);
18793
19099
  success(`~/.cursor/hooks/${CURSOR_DISPATCHER_TRAMPOLINE} installed`);
18794
19100
  }
18795
19101
  const hooks = {};
18796
- for (const [ac_event, native] of CURSOR_DISPATCHER_BINDINGS) {
18797
- (hooks[native] ??= []).push({ command: `${dst} ${ac_event} ${native}` });
19102
+ for (const { slot, native } of hostBindings("cursor")) {
19103
+ (hooks[native] ??= []).push({ command: `${dst} ${slot} ${native}` });
18798
19104
  }
18799
19105
  const settings_patch = { version: 1, hooks };
18800
19106
  return merge_json_file(
18801
- path20.join(CURSOR_USER_DIR, "hooks.json"),
19107
+ path21.join(CURSOR_USER_DIR, "hooks.json"),
18802
19108
  settings_patch,
18803
19109
  force,
18804
19110
  "~/.cursor/hooks.json"
18805
19111
  );
18806
19112
  }
18807
- var CLINE_DISPATCHER_BINDINGS = [
18808
- ["session_start", "TaskStart"],
18809
- ["session_start", "TaskResume"],
18810
- ["session_end", "TaskComplete"],
18811
- ["stop", "TaskCancel"],
18812
- ["user_prompt_submit", "UserPromptSubmit"],
18813
- ["post_tool_use", "PostToolUse"]
18814
- ];
18815
19113
  function shlexQuote(s) {
18816
19114
  if (s === "") return "''";
18817
19115
  if (/^[A-Za-z0-9_@%+=:,./-]+$/.test(s)) return s;
@@ -18819,7 +19117,7 @@ function shlexQuote(s) {
18819
19117
  }
18820
19118
  function clineProjectHookBody(native_event, ac_event, workspace_quoted) {
18821
19119
  return `#!/usr/bin/env bash
18822
- # Generated by event4u/agent-config install.py \u2014 DO NOT EDIT.
19120
+ # Generated by event4u/agent-config \u2014 DO NOT EDIT.
18823
19121
  # Project-scope Cline hook for ${native_event} \u2192 agent-config ${ac_event}.
18824
19122
  # Phase 7.6 (docs/contracts/hook-architecture-v1.md).
18825
19123
  set -u
@@ -18841,22 +19139,22 @@ exit 0
18841
19139
  `;
18842
19140
  }
18843
19141
  function ensure_cline_bridge(project_root, force) {
18844
- const hooks_dir = path20.join(project_root, ".clinerules", "hooks");
19142
+ const hooks_dir = path21.join(project_root, ".clinerules", "hooks");
18845
19143
  mkdirp(hooks_dir);
18846
19144
  const workspace_quoted = shlexQuote(resolvePath(project_root));
18847
19145
  let written = 0;
18848
- for (const [ac_event, native_event] of CLINE_DISPATCHER_BINDINGS) {
18849
- const target = path20.join(hooks_dir, native_event);
18850
- const body = clineProjectHookBody(native_event, ac_event, workspace_quoted);
19146
+ for (const { slot, native } of hostBindings("cline")) {
19147
+ const target = path21.join(hooks_dir, native);
19148
+ const body = clineProjectHookBody(native, slot, workspace_quoted);
18851
19149
  if (pathExists(target) && readText(target) === body && !force) {
18852
19150
  continue;
18853
19151
  }
18854
19152
  if (pathExists(target) && !force) {
18855
- skip(`.clinerules/hooks/${native_event} exists, needs update (use --force)`);
19153
+ skip(`.clinerules/hooks/${native} exists, needs update (use --force)`);
18856
19154
  continue;
18857
19155
  }
18858
19156
  writeText(target, body);
18859
- fs23.chmodSync(target, 493);
19157
+ fs24.chmodSync(target, 493);
18860
19158
  written += 1;
18861
19159
  }
18862
19160
  if (written) {
@@ -18865,113 +19163,101 @@ function ensure_cline_bridge(project_root, force) {
18865
19163
  skip(".clinerules/hooks/ already up to date");
18866
19164
  }
18867
19165
  }
18868
- var CLINE_USER_DIR = path20.join(os8.homedir(), "Documents", "Cline", "Hooks");
19166
+ var CLINE_USER_DIR = path21.join(os8.homedir(), "Documents", "Cline", "Hooks");
18869
19167
  var CLINE_DISPATCHER_TRAMPOLINE = "cline-dispatcher.sh";
18870
19168
  function ensure_cline_user_hooks(package_root, force) {
18871
- const src = path20.join(package_root, "scripts", "hooks", CLINE_DISPATCHER_TRAMPOLINE);
19169
+ const src = path21.join(package_root, "scripts", "hooks", CLINE_DISPATCHER_TRAMPOLINE);
18872
19170
  if (!pathExists(src)) {
18873
19171
  skip(`cline trampoline missing in package: ${src}`);
18874
19172
  return;
18875
19173
  }
18876
19174
  mkdirp(CLINE_USER_DIR);
18877
- const trampoline = path20.join(CLINE_USER_DIR, CLINE_DISPATCHER_TRAMPOLINE);
19175
+ const trampoline = path21.join(CLINE_USER_DIR, CLINE_DISPATCHER_TRAMPOLINE);
18878
19176
  const src_text = readText(src);
18879
19177
  if (pathExists(trampoline) && readText(trampoline) === src_text && !force) {
18880
19178
  skip(`~/Documents/Cline/Hooks/${CLINE_DISPATCHER_TRAMPOLINE} already up to date`);
18881
19179
  } else {
18882
19180
  writeText(trampoline, src_text);
18883
- fs23.chmodSync(trampoline, 493);
19181
+ fs24.chmodSync(trampoline, 493);
18884
19182
  success(`~/Documents/Cline/Hooks/${CLINE_DISPATCHER_TRAMPOLINE} installed`);
18885
19183
  }
18886
19184
  const trampoline_quoted = shlexQuote(trampoline);
18887
- for (const [ac_event, native_event] of CLINE_DISPATCHER_BINDINGS) {
18888
- const wrapper = path20.join(CLINE_USER_DIR, native_event);
19185
+ for (const { slot, native } of hostBindings("cline")) {
19186
+ const wrapper = path21.join(CLINE_USER_DIR, native);
18889
19187
  const body = `#!/usr/bin/env bash
18890
- # Generated by event4u/agent-config install.py \u2014 DO NOT EDIT.
18891
- # User-scope Cline hook for ${native_event} \u2192 agent-config ${ac_event}.
18892
- exec ${trampoline_quoted} ${ac_event} ${native_event}
19188
+ # Generated by event4u/agent-config \u2014 DO NOT EDIT.
19189
+ # User-scope Cline hook for ${native} \u2192 agent-config ${slot}.
19190
+ exec ${trampoline_quoted} ${slot} ${native}
18893
19191
  `;
18894
19192
  if (pathExists(wrapper) && readText(wrapper) === body && !force) {
18895
19193
  continue;
18896
19194
  }
18897
19195
  writeText(wrapper, body);
18898
- fs23.chmodSync(wrapper, 493);
19196
+ fs24.chmodSync(wrapper, 493);
18899
19197
  }
18900
19198
  }
18901
- var WINDSURF_DISPATCHER_BINDINGS = [
18902
- ["session_start", "post_setup_worktree"],
18903
- ["user_prompt_submit", "pre_user_prompt"],
18904
- ["stop", "post_cascade_response"]
18905
- ];
18906
19199
  function _windsurf_dispatch_command(ac_event, native) {
18907
19200
  return `[ -x ./agent-config ] || exit 0; ./agent-config dispatch:hook --platform windsurf --event ${ac_event} --native-event ${native}`;
18908
19201
  }
18909
19202
  function ensure_windsurf_bridge(project_root, force) {
18910
19203
  const hooks = {};
18911
- for (const [ac_event, native] of WINDSURF_DISPATCHER_BINDINGS) {
19204
+ for (const { slot, native } of hostBindings("windsurf")) {
18912
19205
  (hooks[native] ??= []).push({
18913
- command: _windsurf_dispatch_command(ac_event, native),
19206
+ command: _windsurf_dispatch_command(slot, native),
18914
19207
  show_output: false
18915
19208
  });
18916
19209
  }
18917
19210
  const bridge = { hooks };
18918
19211
  return merge_json_file(
18919
- path20.join(project_root, ".windsurf", "hooks.json"),
19212
+ path21.join(project_root, ".windsurf", "hooks.json"),
18920
19213
  bridge,
18921
19214
  force,
18922
19215
  ".windsurf/hooks.json"
18923
19216
  );
18924
19217
  }
18925
- var WINDSURF_USER_DIR = path20.join(os8.homedir(), ".codeium", "windsurf");
18926
- var WINDSURF_USER_HOOKS_DIR = path20.join(WINDSURF_USER_DIR, "hooks");
19218
+ var WINDSURF_USER_DIR = path21.join(os8.homedir(), ".codeium", "windsurf");
19219
+ var WINDSURF_USER_HOOKS_DIR = path21.join(WINDSURF_USER_DIR, "hooks");
18927
19220
  var WINDSURF_DISPATCHER_TRAMPOLINE = "windsurf-dispatcher.sh";
18928
19221
  function ensure_windsurf_user_hooks(package_root, force) {
18929
- const src = path20.join(package_root, "scripts", "hooks", WINDSURF_DISPATCHER_TRAMPOLINE);
19222
+ const src = path21.join(package_root, "scripts", "hooks", WINDSURF_DISPATCHER_TRAMPOLINE);
18930
19223
  if (!pathExists(src)) {
18931
19224
  skip(`windsurf trampoline missing in package: ${src}`);
18932
19225
  return [];
18933
19226
  }
18934
19227
  mkdirp(WINDSURF_USER_HOOKS_DIR);
18935
- const dst = path20.join(WINDSURF_USER_HOOKS_DIR, WINDSURF_DISPATCHER_TRAMPOLINE);
19228
+ const dst = path21.join(WINDSURF_USER_HOOKS_DIR, WINDSURF_DISPATCHER_TRAMPOLINE);
18936
19229
  const src_text = readText(src);
18937
19230
  if (pathExists(dst) && readText(dst) === src_text && !force) {
18938
19231
  skip(`~/.codeium/windsurf/hooks/${WINDSURF_DISPATCHER_TRAMPOLINE} already up to date`);
18939
19232
  } else {
18940
19233
  writeText(dst, src_text);
18941
- fs23.chmodSync(dst, 493);
19234
+ fs24.chmodSync(dst, 493);
18942
19235
  success(`~/.codeium/windsurf/hooks/${WINDSURF_DISPATCHER_TRAMPOLINE} installed`);
18943
19236
  }
18944
19237
  const hooks = {};
18945
- for (const [ac_event, native] of WINDSURF_DISPATCHER_BINDINGS) {
19238
+ for (const { slot, native } of hostBindings("windsurf")) {
18946
19239
  (hooks[native] ??= []).push({
18947
- command: `${dst} ${ac_event} ${native}`,
19240
+ command: `${dst} ${slot} ${native}`,
18948
19241
  show_output: false
18949
19242
  });
18950
19243
  }
18951
19244
  const settings_patch = { hooks };
18952
19245
  return merge_json_file(
18953
- path20.join(WINDSURF_USER_DIR, "hooks.json"),
19246
+ path21.join(WINDSURF_USER_DIR, "hooks.json"),
18954
19247
  settings_patch,
18955
19248
  force,
18956
19249
  "~/.codeium/windsurf/hooks.json"
18957
19250
  );
18958
19251
  }
18959
- var GEMINI_DISPATCHER_BINDINGS = [
18960
- ["session_start", "SessionStart", ""],
18961
- ["session_end", "SessionEnd", ""],
18962
- ["stop", "AfterAgent", ""],
18963
- ["user_prompt_submit", "BeforeAgent", ""],
18964
- ["post_tool_use", "AfterTool", ".*"]
18965
- ];
18966
19252
  function _gemini_dispatch_command(ac_event, native) {
18967
19253
  return `[ -x ./agent-config ] || exit 0; ./agent-config dispatch:hook --platform gemini --event ${ac_event} --native-event ${native}`;
18968
19254
  }
18969
19255
  function _gemini_hooks_dict(command_factory) {
18970
19256
  const out = {};
18971
- for (const [ac_event, native, matcher] of GEMINI_DISPATCHER_BINDINGS) {
19257
+ for (const { slot, native, matcher } of hostBindings("gemini")) {
18972
19258
  (out[native] ??= []).push({
18973
19259
  matcher,
18974
- hooks: [{ type: "command", command: command_factory(ac_event, native) }]
19260
+ hooks: [{ type: "command", command: command_factory(slot, native) }]
18975
19261
  });
18976
19262
  }
18977
19263
  return out;
@@ -18979,43 +19265,43 @@ function _gemini_hooks_dict(command_factory) {
18979
19265
  function ensure_gemini_bridge(project_root, force) {
18980
19266
  const bridge = { hooks: _gemini_hooks_dict(_gemini_dispatch_command) };
18981
19267
  return merge_json_file(
18982
- path20.join(project_root, ".gemini", "settings.json"),
19268
+ path21.join(project_root, ".gemini", "settings.json"),
18983
19269
  bridge,
18984
19270
  force,
18985
19271
  ".gemini/settings.json"
18986
19272
  );
18987
19273
  }
18988
- var GEMINI_USER_DIR = path20.join(os8.homedir(), ".gemini");
18989
- var GEMINI_USER_HOOKS_DIR = path20.join(GEMINI_USER_DIR, "hooks");
19274
+ var GEMINI_USER_DIR = path21.join(os8.homedir(), ".gemini");
19275
+ var GEMINI_USER_HOOKS_DIR = path21.join(GEMINI_USER_DIR, "hooks");
18990
19276
  var GEMINI_DISPATCHER_TRAMPOLINE = "gemini-dispatcher.sh";
18991
19277
  function ensure_gemini_user_hooks(package_root, force) {
18992
- const src = path20.join(package_root, "scripts", "hooks", GEMINI_DISPATCHER_TRAMPOLINE);
19278
+ const src = path21.join(package_root, "scripts", "hooks", GEMINI_DISPATCHER_TRAMPOLINE);
18993
19279
  if (!pathExists(src)) {
18994
19280
  skip(`gemini trampoline missing in package: ${src}`);
18995
19281
  return [];
18996
19282
  }
18997
19283
  mkdirp(GEMINI_USER_HOOKS_DIR);
18998
- const dst = path20.join(GEMINI_USER_HOOKS_DIR, GEMINI_DISPATCHER_TRAMPOLINE);
19284
+ const dst = path21.join(GEMINI_USER_HOOKS_DIR, GEMINI_DISPATCHER_TRAMPOLINE);
18999
19285
  const src_text = readText(src);
19000
19286
  if (pathExists(dst) && readText(dst) === src_text && !force) {
19001
19287
  skip(`~/.gemini/hooks/${GEMINI_DISPATCHER_TRAMPOLINE} already up to date`);
19002
19288
  } else {
19003
19289
  writeText(dst, src_text);
19004
- fs23.chmodSync(dst, 493);
19290
+ fs24.chmodSync(dst, 493);
19005
19291
  success(`~/.gemini/hooks/${GEMINI_DISPATCHER_TRAMPOLINE} installed`);
19006
19292
  }
19007
19293
  const settings_patch = {
19008
19294
  hooks: _gemini_hooks_dict((ac_event, native) => `${dst} ${ac_event} ${native}`)
19009
19295
  };
19010
19296
  return merge_json_file(
19011
- path20.join(GEMINI_USER_DIR, "settings.json"),
19297
+ path21.join(GEMINI_USER_DIR, "settings.json"),
19012
19298
  settings_patch,
19013
19299
  force,
19014
19300
  "~/.gemini/settings.json"
19015
19301
  );
19016
19302
  }
19017
19303
  function ensure_copilot_bridge(project_root, force) {
19018
- const target = path20.join(project_root, ".github", "plugin", "marketplace.json");
19304
+ const target = path21.join(project_root, ".github", "plugin", "marketplace.json");
19019
19305
  const bridge = {
19020
19306
  marketplace: {
19021
19307
  name: "event4u-agent-marketplace",
@@ -19058,7 +19344,7 @@ See \`docs/setup/per-ide/roocode.md\` for the full activation guide.
19058
19344
  Run \`./agent-config --help\` for available commands.
19059
19345
  `;
19060
19346
  function ensure_roocode_bridge(project_root, force) {
19061
- const target = path20.join(project_root, ".roo", "rules", "agent-config.md");
19347
+ const target = path21.join(project_root, ".roo", "rules", "agent-config.md");
19062
19348
  if (pathExists(target) && !force) {
19063
19349
  skip(".roo/rules/agent-config.md already exists");
19064
19350
  return;
@@ -19080,7 +19366,7 @@ To wire Claude Desktop to this project's rules, run:
19080
19366
  Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
19081
19367
  `;
19082
19368
  function ensure_claude_desktop_bridge(project_root, force) {
19083
- const target = path20.join(project_root, ".claude-desktop", "agent-config.md");
19369
+ const target = path21.join(project_root, ".claude-desktop", "agent-config.md");
19084
19370
  if (pathExists(target) && !force) {
19085
19371
  skip(".claude-desktop/agent-config.md already exists");
19086
19372
  return;
@@ -19105,7 +19391,7 @@ Or pass \`--read .aider/agent-config.md\` on the command line.
19105
19391
  Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
19106
19392
  `;
19107
19393
  function ensure_aider_bridge(project_root, force) {
19108
- const target = path20.join(project_root, ".aider", "agent-config.md");
19394
+ const target = path21.join(project_root, ".aider", "agent-config.md");
19109
19395
  if (pathExists(target) && !force) {
19110
19396
  skip(".aider/agent-config.md already exists");
19111
19397
  return;
@@ -19124,7 +19410,7 @@ developers where the rules and skills live.
19124
19410
  Canonical rule and skill source: \`.augment/\` (see project \`AGENTS.md\`).
19125
19411
  `;
19126
19412
  function ensure_codex_bridge(project_root, force) {
19127
- const target = path20.join(project_root, ".codex", "agent-config.md");
19413
+ const target = path21.join(project_root, ".codex", "agent-config.md");
19128
19414
  if (pathExists(target) && !force) {
19129
19415
  skip(".codex/agent-config.md already exists");
19130
19416
  return;
@@ -19142,7 +19428,7 @@ rules per session. The canonical rule and skill source lives under
19142
19428
  orientation).
19143
19429
  `;
19144
19430
  function ensure_continue_bridge(project_root, force) {
19145
- const target = path20.join(project_root, ".continue", "rules", "agent-config.md");
19431
+ const target = path21.join(project_root, ".continue", "rules", "agent-config.md");
19146
19432
  if (pathExists(target) && !force) {
19147
19433
  skip(".continue/rules/agent-config.md already exists");
19148
19434
  return;
@@ -19173,7 +19459,7 @@ orientation).
19173
19459
  See \`docs/setup/per-ide/kilocode.md\` for the full activation guide.
19174
19460
  `;
19175
19461
  function ensure_kilocode_bridge(project_root, force) {
19176
- const target = path20.join(project_root, ".kilocode", "rules", "agent-config.md");
19462
+ const target = path21.join(project_root, ".kilocode", "rules", "agent-config.md");
19177
19463
  if (pathExists(target) && !force) {
19178
19464
  skip(".kilocode/rules/agent-config.md already exists");
19179
19465
  return;
@@ -19200,7 +19486,7 @@ canonical source (or symlink it):
19200
19486
  Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
19201
19487
  `;
19202
19488
  function ensure_zed_bridge(project_root, force) {
19203
- const target = path20.join(project_root, ".zed", "agent-config.md");
19489
+ const target = path21.join(project_root, ".zed", "agent-config.md");
19204
19490
  if (pathExists(target) && !force) {
19205
19491
  skip(".zed/agent-config.md already exists");
19206
19492
  return;
@@ -19221,7 +19507,7 @@ rules into your JetBrains profile.
19221
19507
  Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
19222
19508
  `;
19223
19509
  function ensure_jetbrains_bridge(project_root, force) {
19224
- const target = path20.join(project_root, ".jetbrains", "agent-config.md");
19510
+ const target = path21.join(project_root, ".jetbrains", "agent-config.md");
19225
19511
  if (pathExists(target) && !force) {
19226
19512
  skip(".jetbrains/agent-config.md already exists");
19227
19513
  return;
@@ -19252,7 +19538,7 @@ session. The canonical rule and skill source lives under \`.augment/\`
19252
19538
  See \`docs/setup/per-ide/kiro.md\` for the full activation guide.
19253
19539
  `;
19254
19540
  function ensure_kiro_bridge(project_root, force) {
19255
- const target = path20.join(project_root, ".kiro", "steering", "agent-config.md");
19541
+ const target = path21.join(project_root, ".kiro", "steering", "agent-config.md");
19256
19542
  if (pathExists(target) && !force) {
19257
19543
  skip(".kiro/steering/agent-config.md already exists");
19258
19544
  return;
@@ -19260,14 +19546,25 @@ function ensure_kiro_bridge(project_root, force) {
19260
19546
  write_file(target, KIRO_MARKER);
19261
19547
  success(".kiro/steering/agent-config.md created");
19262
19548
  }
19263
- var SMOKE_PROBE_EVENTS = [
19549
+ var SMOKE_PROBE_SLOTS = [
19264
19550
  ["augment", "session_start"],
19265
- ["claude", "SessionStart"],
19266
- ["cursor", "beforeShellExecution"],
19551
+ ["claude", "session_start"],
19552
+ ["cursor", "session_start"],
19267
19553
  ["cline", "session_start"],
19268
- ["windsurf", "post_setup_worktree"],
19269
- ["gemini", "SessionStart"]
19554
+ ["windsurf", "session_start"],
19555
+ ["gemini", "session_start"]
19270
19556
  ];
19557
+ function smokeProbeEvents() {
19558
+ return SMOKE_PROBE_SLOTS.map(([platform, slot]) => {
19559
+ const binding = hostBindings(platform).find((b) => b.slot === slot);
19560
+ if (binding === void 0) {
19561
+ throw new Error(
19562
+ `install smoke probe: host_lowering.yaml has no \`${slot}\` binding for \`${platform}\``
19563
+ );
19564
+ }
19565
+ return [platform, binding.native];
19566
+ });
19567
+ }
19271
19568
  var SMOKE_BRIDGE_PATHS = {
19272
19569
  augment: ".augment/settings.json",
19273
19570
  claude: ".claude/settings.json",
@@ -19278,35 +19575,35 @@ var SMOKE_BRIDGE_PATHS = {
19278
19575
  };
19279
19576
  function dirHasEntries(p) {
19280
19577
  try {
19281
- return fs23.readdirSync(p).length > 0;
19578
+ return fs24.readdirSync(p).length > 0;
19282
19579
  } catch {
19283
19580
  return false;
19284
19581
  }
19285
19582
  }
19286
19583
  function _resolve_tsx_invocation(scriptPath, scriptArgs) {
19287
- const binName = process3.platform === "win32" ? "tsx.cmd" : "tsx";
19288
- let dir = path20.dirname(scriptPath);
19584
+ const binName = process4.platform === "win32" ? "tsx.cmd" : "tsx";
19585
+ let dir = path21.dirname(scriptPath);
19289
19586
  for (; ; ) {
19290
- const candidate = path20.join(dir, "node_modules", ".bin", binName);
19587
+ const candidate = path21.join(dir, "node_modules", ".bin", binName);
19291
19588
  if (isFile(candidate)) {
19292
19589
  return { command: candidate, args: [scriptPath, ...scriptArgs] };
19293
19590
  }
19294
- const parent = path20.dirname(dir);
19591
+ const parent = path21.dirname(dir);
19295
19592
  if (parent === dir) break;
19296
19593
  dir = parent;
19297
19594
  }
19298
19595
  return { command: "npx", args: ["tsx", scriptPath, ...scriptArgs] };
19299
19596
  }
19300
19597
  function _smoke_test_hooks(project_root, package_root) {
19301
- const dispatcher = path20.join(package_root, "scripts", "hooks", "dispatch_hook.ts");
19302
- const manifest = path20.join(package_root, "scripts", "hook_manifest.yaml");
19598
+ const dispatcher = path21.join(package_root, "scripts", "hooks", "dispatch_hook.ts");
19599
+ const manifest = path21.join(package_root, "scripts", "hook_manifest.yaml");
19303
19600
  if (!isFile(dispatcher) || !isFile(manifest)) return 0;
19304
19601
  const failed = [];
19305
19602
  const skipped = [];
19306
19603
  const passed = [];
19307
- for (const [platform, native] of SMOKE_PROBE_EVENTS) {
19604
+ for (const [platform, native] of smokeProbeEvents()) {
19308
19605
  const rel_bridge = SMOKE_BRIDGE_PATHS[platform] ?? "";
19309
- const bridge_path = rel_bridge ? path20.join(project_root, rel_bridge) : null;
19606
+ const bridge_path = rel_bridge ? path21.join(project_root, rel_bridge) : null;
19310
19607
  const bridge_present = Boolean(
19311
19608
  bridge_path && (isFile(bridge_path) || isDir(bridge_path) && dirHasEntries(bridge_path))
19312
19609
  );
@@ -19506,9 +19803,9 @@ To remove this marker, delete this file.
19506
19803
  `;
19507
19804
  }
19508
19805
  var _CLAUDE_DESKTOP_BUNDLES_SUBPATH = "claude-desktop/bundles";
19509
- var GLOBAL_ROOT = path20.join(os8.homedir(), ".event4u", "agent-config");
19510
- var GLOBAL_USER_SETTINGS_PATH = path20.join(GLOBAL_ROOT, ".agent-user.yml");
19511
- var GLOBAL_AGENT_SETTINGS_PATH = path20.join(GLOBAL_ROOT, ".agent-settings.yml");
19806
+ var GLOBAL_ROOT = path21.join(os8.homedir(), ".event4u", "agent-config");
19807
+ var GLOBAL_USER_SETTINGS_PATH = path21.join(GLOBAL_ROOT, ".agent-user.yml");
19808
+ var GLOBAL_AGENT_SETTINGS_PATH = path21.join(GLOBAL_ROOT, ".agent-settings.yml");
19512
19809
  function _bridge_marker(tool_id, scope) {
19513
19810
  if (scope === "global") return USER_SCOPE_PATHS[tool_id] ?? "";
19514
19811
  return PROJECT_BRIDGE_MARKERS[tool_id] ?? "";
@@ -19517,7 +19814,7 @@ function _validate_scope(tools, scope, was_all) {
19517
19814
  if (scope !== "project" && scope !== "global") {
19518
19815
  fail(`_validate_scope: unknown scope '${scope}'`);
19519
19816
  }
19520
- if (process3.env["AGENT_CONFIG_DEV_MODE"] === "1") return tools;
19817
+ if (process4.env["AGENT_CONFIG_DEV_MODE"] === "1") return tools;
19521
19818
  const incompatible = [...tools].filter((t) => {
19522
19819
  const sup = SCOPE_SUPPORT[t] ?? "both";
19523
19820
  return sup !== "both" && sup !== scope;
@@ -19531,14 +19828,14 @@ function _validate_scope(tools, scope, was_all) {
19531
19828
  }
19532
19829
  function _enforce_consumer_global_only(scope) {
19533
19830
  if (scope !== "project") return;
19534
- if (process3.env["AGENT_CONFIG_DEV_MODE"] === "1") return;
19831
+ if (process4.env["AGENT_CONFIG_DEV_MODE"] === "1") return;
19535
19832
  fail(
19536
19833
  "--scope=project is reserved for maintainers (ADR-020 \u2014 consumer installs are global-only). Set AGENT_CONFIG_DEV_MODE=1 to opt in. See docs/maintainers/dev-mode.md."
19537
19834
  );
19538
19835
  }
19539
19836
  function _enforce_not_source_repo(scope, project_root) {
19540
19837
  if (scope === "global") return;
19541
- if (process3.env["AGENT_CONFIG_ALLOW_SELF_INSTALL"] === "1") return;
19838
+ if (process4.env["AGENT_CONFIG_ALLOW_SELF_INSTALL"] === "1") return;
19542
19839
  const [is_source, signature] = _is_agent_config_source_repo(project_root);
19543
19840
  if (!is_source) return;
19544
19841
  fail(
@@ -19557,7 +19854,7 @@ function _load_yaml_doc(p) {
19557
19854
  return _isPlainObject2(data) ? data : {};
19558
19855
  }
19559
19856
  function _load_default_settings(package_root) {
19560
- const template_source = path20.join(package_root, "src", "config", "agent-settings.template.yml");
19857
+ const template_source = path21.join(package_root, "src", "config", "agent-settings.template.yml");
19561
19858
  if (!pathExists(template_source)) return {};
19562
19859
  let text;
19563
19860
  try {
@@ -19571,11 +19868,11 @@ function _load_default_settings(package_root) {
19571
19868
  }
19572
19869
  var RULE_LAYER_CHOICES = ["global", "project", "both-acknowledged"];
19573
19870
  function _suppress_rule_layer(project_root, suppress_dir) {
19574
- const target = path20.join(project_root, ".claude", "settings.local.json");
19871
+ const target = path21.join(project_root, ".claude", "settings.local.json");
19575
19872
  const existing = pathExists(target) ? read_json_file(target) : {};
19576
19873
  let real_dir = suppress_dir;
19577
19874
  try {
19578
- real_dir = fs23.realpathSync(suppress_dir);
19875
+ real_dir = fs24.realpathSync(suppress_dir);
19579
19876
  } catch {
19580
19877
  real_dir = suppress_dir;
19581
19878
  }
@@ -19586,8 +19883,8 @@ function _suppress_rule_layer(project_root, suppress_dir) {
19586
19883
  success(`.claude/settings.local.json: claudeMdExcludes += ${entry}`);
19587
19884
  }
19588
19885
  function _gate_rule_layer_overlap(project_root, layer, dry_run) {
19589
- const global_dir = path20.join(os8.homedir(), ".claude", "rules");
19590
- const project_dir = path20.join(project_root, ".claude", "rules");
19886
+ const global_dir = path21.join(os8.homedir(), ".claude", "rules");
19887
+ const project_dir = path21.join(project_root, ".claude", "rules");
19591
19888
  const g = readRuleLayer(global_dir);
19592
19889
  const p = readRuleLayer(project_dir);
19593
19890
  if (g === null || p === null) return true;
@@ -19642,7 +19939,7 @@ function _resolve_scope(opts, detected, detect_reason, custom_path) {
19642
19939
  return "project";
19643
19940
  }
19644
19941
  function _run_scope_prompt(opts, reason, custom_path) {
19645
- if (!process3.stdin.isTTY && custom_path === null) {
19942
+ if (!process4.stdin.isTTY && custom_path === null) {
19646
19943
  fail(
19647
19944
  "Ambiguous install scope detected and stdin is not a TTY. Pass --scope=project|global (or --custom-path=<dir>) to override."
19648
19945
  );
@@ -19675,9 +19972,9 @@ function detect_scope(cwd) {
19675
19972
  if (pathExists(_resolve_settings_read(cwd))) {
19676
19973
  return ["project", `existing ${SETTINGS_FILE}`];
19677
19974
  }
19678
- const has_manifest = SCOPE_DETECT_MANIFESTS.find((m) => pathExists(path20.join(cwd, m))) ?? null;
19679
- const has_ai_dir = SCOPE_DETECT_AI_DIRS.find((d) => isDir(path20.join(cwd, d))) ?? null;
19680
- const has_ai_file = SCOPE_DETECT_AI_FILES.find((f) => pathExists(path20.join(cwd, f))) ?? null;
19975
+ const has_manifest = SCOPE_DETECT_MANIFESTS.find((m) => pathExists(path21.join(cwd, m))) ?? null;
19976
+ const has_ai_dir = SCOPE_DETECT_AI_DIRS.find((d) => isDir(path21.join(cwd, d))) ?? null;
19977
+ const has_ai_file = SCOPE_DETECT_AI_FILES.find((f) => pathExists(path21.join(cwd, f))) ?? null;
19681
19978
  if (has_manifest && (has_ai_dir || has_ai_file)) {
19682
19979
  const marker = has_ai_dir || has_ai_file;
19683
19980
  return ["prompt", `manifest (${has_manifest}) + AI-tool config (${marker})`];
@@ -19691,14 +19988,14 @@ function _read_line(prompt_text) {
19691
19988
  return line.trim();
19692
19989
  }
19693
19990
  function readLineSyncRaw(promptText) {
19694
- process3.stdout.write(promptText);
19991
+ process4.stdout.write(promptText);
19695
19992
  const buf = Buffer.alloc(1);
19696
19993
  const bytes = [];
19697
19994
  let sawAny = false;
19698
19995
  for (; ; ) {
19699
19996
  let n;
19700
19997
  try {
19701
- n = fs23.readSync(0, buf, 0, 1, null);
19998
+ n = fs24.readSync(0, buf, 0, 1, null);
19702
19999
  } catch (err) {
19703
20000
  const code = err.code;
19704
20001
  if (code === "EAGAIN") {
@@ -19722,13 +20019,13 @@ function readLineSyncRaw(promptText) {
19722
20019
  return Buffer.from(bytes).toString("utf-8");
19723
20020
  }
19724
20021
  function prompt_scope_choice(reason) {
19725
- process3.stdout.write("\n");
20022
+ process4.stdout.write("\n");
19726
20023
  info(`Ambiguous install scope: ${reason}.`);
19727
20024
  info("Choose where to install:");
19728
- process3.stdout.write(" 1) Project \u2014 install into the current directory\n");
19729
- process3.stdout.write(" 2) User \u2014 install into ~/ (recommended; one install per machine)\n");
19730
- process3.stdout.write(" 3) Custom \u2014 specify an explicit destination path\n");
19731
- process3.stdout.write("\n");
20025
+ process4.stdout.write(" 1) Project \u2014 install into the current directory\n");
20026
+ process4.stdout.write(" 2) User \u2014 install into ~/ (recommended; one install per machine)\n");
20027
+ process4.stdout.write(" 3) Custom \u2014 specify an explicit destination path\n");
20028
+ process4.stdout.write("\n");
19732
20029
  let attempts = 0;
19733
20030
  while (attempts < 3) {
19734
20031
  const reply = _read_line("Choose [1/2/3]: ");
@@ -19773,8 +20070,8 @@ function _files_by_tool_from_bridges(tools, project_root, scope) {
19773
20070
  const marker = _bridge_marker(tool_id, scope);
19774
20071
  if (!marker) continue;
19775
20072
  let marker_path = marker;
19776
- if (!path20.isAbsolute(marker_path)) {
19777
- marker_path = path20.join(project_root, marker_path);
20073
+ if (!path21.isAbsolute(marker_path)) {
20074
+ marker_path = path21.join(project_root, marker_path);
19778
20075
  }
19779
20076
  out[tool_id] = [_file_entry(marker_path, "bridge", false)];
19780
20077
  }
@@ -19813,34 +20110,34 @@ function _update_installed_tools_manifest(project_root, tools, scope, force, fil
19813
20110
  }
19814
20111
  write_manifest(target, version, entries);
19815
20112
  if (!state.QUIET) {
19816
- const rel = isRelativeTo(target, project_root) ? path20.relative(project_root, target) : target;
20113
+ const rel = isRelativeTo(target, project_root) ? path21.relative(project_root, target) : target;
19817
20114
  info(`Manifest updated: ${rel}`);
19818
20115
  }
19819
20116
  return 0;
19820
20117
  }
19821
20118
  function isRelativeTo(child, parent) {
19822
- const rel = path20.relative(parent, child);
19823
- return rel === "" || !rel.startsWith("..") && !path20.isAbsolute(rel);
20119
+ const rel = path21.relative(parent, child);
20120
+ return rel === "" || !rel.startsWith("..") && !path21.isAbsolute(rel);
19824
20121
  }
19825
20122
  function _resolve_package_root_for_global() {
19826
20123
  const here = resolvePath(_HERE2);
19827
- const candidate = path20.dirname(path20.dirname(path20.dirname(here)));
19828
- if (!pathExists(path20.join(candidate, "src", "config", "profiles", "minimal.ini"))) {
20124
+ const candidate = path21.dirname(path21.dirname(path21.dirname(here)));
20125
+ if (!pathExists(path21.join(candidate, "src", "config", "profiles", "minimal.ini"))) {
19829
20126
  fail(
19830
20127
  `Could not locate agent-config package root from ${here}. Expected src/config/profiles/minimal.ini at the parent directory.`
19831
20128
  );
19832
20129
  }
19833
20130
  return candidate;
19834
20131
  }
19835
- var CONSUMER_BRIDGE_MARKER_RELPATH = path20.join("agents", ".event4u-bridge.yml");
20132
+ var CONSUMER_BRIDGE_MARKER_RELPATH = path21.join("agents", ".event4u-bridge.yml");
19836
20133
  var MIGRATE_LEGACY_YAML_FILES = [".agent-settings.yml", ".agent-user.yml"];
19837
20134
  var MIGRATE_LEGACY_TOOL_DIRS = [".augment", ".claude", ".cursor"];
19838
20135
  var AGENT_CONFIG_PACKAGE_NAME = "@event4u/agent-config";
19839
20136
  function _is_agent_config_source_repo(project_root) {
19840
- if (process3.env["AGENT_CONFIG_CONSUMER_MODE"] === "1") {
20137
+ if (process4.env["AGENT_CONFIG_CONSUMER_MODE"] === "1") {
19841
20138
  return [false, "consumer-mode-override"];
19842
20139
  }
19843
- const pkg_json = path20.join(project_root, "package.json");
20140
+ const pkg_json = path21.join(project_root, "package.json");
19844
20141
  if (isFile(pkg_json)) {
19845
20142
  let data = {};
19846
20143
  try {
@@ -19852,28 +20149,21 @@ function _is_agent_config_source_repo(project_root) {
19852
20149
  return [true, "package.json:name"];
19853
20150
  }
19854
20151
  }
19855
- if (isDir(path20.join(project_root, ".agent-src.uncondensed"))) {
20152
+ if (isDir(path21.join(project_root, ".agent-src.uncondensed"))) {
19856
20153
  return [true, ".agent-src.uncondensed/"];
19857
20154
  }
19858
- const packages_dir = path20.join(project_root, "packages");
20155
+ const packages_dir = path21.join(project_root, "packages");
19859
20156
  if (isDir(packages_dir)) {
19860
- for (const child of fs23.readdirSync(packages_dir)) {
19861
- if (isDir(path20.join(packages_dir, child, ".agent-src.uncondensed"))) {
20157
+ for (const child of fs24.readdirSync(packages_dir)) {
20158
+ if (isDir(path21.join(packages_dir, child, ".agent-src.uncondensed"))) {
19862
20159
  return [true, `packages/${child}/.agent-src.uncondensed/`];
19863
20160
  }
19864
20161
  }
19865
20162
  }
19866
- const installer_self = path20.join(project_root, "scripts", "install.py");
19867
- try {
19868
- if (isFile(installer_self) && resolvePath(installer_self) === resolvePath(_HERE2)) {
19869
- return [true, "src/scripts/install.py (self)"];
19870
- }
19871
- } catch {
19872
- }
19873
20163
  return [false, ""];
19874
20164
  }
19875
20165
  function _detect_legacy_for_migration(project_root) {
19876
- if (process3.env["AGENT_CONFIG_DEV_MODE"] === "1") return [];
20166
+ if (process4.env["AGENT_CONFIG_DEV_MODE"] === "1") return [];
19877
20167
  const [is_source, signature] = _is_agent_config_source_repo(project_root);
19878
20168
  if (is_source) {
19879
20169
  if (!state.QUIET) {
@@ -19883,17 +20173,17 @@ function _detect_legacy_for_migration(project_root) {
19883
20173
  }
19884
20174
  return [];
19885
20175
  }
19886
- if (isFile(path20.join(project_root, INSTALL_MODE_MARKER_REL))) return [];
20176
+ if (isFile(path21.join(project_root, INSTALL_MODE_MARKER_REL))) return [];
19887
20177
  const found = [];
19888
20178
  for (const name of MIGRATE_LEGACY_YAML_FILES) {
19889
- if (isFile(path20.join(project_root, name))) {
20179
+ if (isFile(path21.join(project_root, name))) {
19890
20180
  found.push(name);
19891
- } else if (isFile(path20.join(project_root, "settings", name))) {
20181
+ } else if (isFile(path21.join(project_root, "settings", name))) {
19892
20182
  found.push(`settings/${name}`);
19893
20183
  }
19894
20184
  }
19895
20185
  for (const name of MIGRATE_LEGACY_TOOL_DIRS) {
19896
- const p = path20.join(project_root, name);
20186
+ const p = path21.join(project_root, name);
19897
20187
  if (isDir(p) && !isSymlink(p)) {
19898
20188
  found.push(`${name}/`);
19899
20189
  }
@@ -19902,10 +20192,10 @@ function _detect_legacy_for_migration(project_root) {
19902
20192
  }
19903
20193
  function _prompt_migrate_to_global(project_root, artefacts) {
19904
20194
  if (!state.QUIET) {
19905
- process3.stdout.write("\n");
20195
+ process4.stdout.write("\n");
19906
20196
  warn("Legacy project-local artefacts detected \u2014 pre-ADR-020 layout:");
19907
20197
  for (const rel of artefacts) {
19908
- info(` ${path20.join(project_root, rel)}`);
20198
+ info(` ${path21.join(project_root, rel)}`);
19909
20199
  }
19910
20200
  info("The unified `agent-config migrate` sweeps these in one pass.");
19911
20201
  info("The wizard recreates fresh config afterwards.");
@@ -19936,20 +20226,20 @@ function _run_migrate_to_global(project_root) {
19936
20226
  function _format_global_root_for_marker(global_root) {
19937
20227
  const home = resolvePath(os8.homedir());
19938
20228
  const resolved = resolvePath(global_root);
19939
- const rel = path20.relative(home, resolved);
19940
- if (rel === "" || rel.startsWith("..") || path20.isAbsolute(rel)) {
20229
+ const rel = path21.relative(home, resolved);
20230
+ if (rel === "" || rel.startsWith("..") || path21.isAbsolute(rel)) {
19941
20231
  return global_root;
19942
20232
  }
19943
- return `~/${rel.split(path20.sep).join("/")}`;
20233
+ return `~/${rel.split(path21.sep).join("/")}`;
19944
20234
  }
19945
20235
  function _remove_legacy_consumer_bridge_marker(project_root, env = null) {
19946
- const env_map = env ?? process3.env;
20236
+ const env_map = env ?? process4.env;
19947
20237
  if (env_map["AGENT_CONFIG_DEV_MODE"] === "1") return null;
19948
- if (isDir(path20.join(project_root, ".agent-src.uncondensed"))) return null;
19949
- const target = path20.join(project_root, CONSUMER_BRIDGE_MARKER_RELPATH);
20238
+ if (isDir(path21.join(project_root, ".agent-src.uncondensed"))) return null;
20239
+ const target = path21.join(project_root, CONSUMER_BRIDGE_MARKER_RELPATH);
19950
20240
  if (!isFile(target)) return null;
19951
20241
  try {
19952
- fs23.rmSync(target);
20242
+ fs24.rmSync(target);
19953
20243
  } catch {
19954
20244
  return null;
19955
20245
  }
@@ -19961,9 +20251,9 @@ var PROJECT_ANCHOR_TOOLS = {
19961
20251
  "gemini-cli": ".gemini/agent-config.bridge.yml"
19962
20252
  };
19963
20253
  function _write_per_tool_project_anchors(project_root, tools, env = null, now = null) {
19964
- const env_map = env ?? process3.env;
20254
+ const env_map = env ?? process4.env;
19965
20255
  if (env_map["AGENT_CONFIG_DEV_MODE"] === "1") return [];
19966
- if (isDir(path20.join(project_root, ".agent-src.uncondensed"))) return [];
20256
+ if (isDir(path21.join(project_root, ".agent-src.uncondensed"))) return [];
19967
20257
  const global_root_str = _format_global_root_for_marker(
19968
20258
  event4u_root(env_map)
19969
20259
  );
@@ -19972,8 +20262,8 @@ function _write_per_tool_project_anchors(project_root, tools, env = null, now =
19972
20262
  for (const tool_id of Object.keys(PROJECT_ANCHOR_TOOLS).sort()) {
19973
20263
  const rel_path = PROJECT_ANCHOR_TOOLS[tool_id];
19974
20264
  if (!tools.has(tool_id)) continue;
19975
- const target = path20.join(project_root, rel_path);
19976
- mkdirp(path20.dirname(target));
20265
+ const target = path21.join(project_root, rel_path);
20266
+ mkdirp(path21.dirname(target));
19977
20267
  const body = `# event4u/agent-config \u2014 per-tool project anchor (auto-written).
19978
20268
  # Spec: docs/contracts/consumer-bridge.md \xA7 Per-tool anchor strategy.
19979
20269
  # Tool: ${tool_id}. Resolves the global install directly \u2014 no
@@ -19991,7 +20281,7 @@ installed_at: ${stamp}
19991
20281
  }
19992
20282
  var PACKAGE_TAG_ID = "event4u/agent-config";
19993
20283
  function _inject_package_tag(target, source, package_root) {
19994
- if (path20.extname(target) !== ".md") return;
20284
+ if (path21.extname(target) !== ".md") return;
19995
20285
  let text;
19996
20286
  try {
19997
20287
  text = readText(target);
@@ -20019,8 +20309,8 @@ function _inject_package_tag(target, source, package_root) {
20019
20309
  resolved_src = source;
20020
20310
  }
20021
20311
  if (package_root !== null) {
20022
- const rel = path20.relative(resolvePath(package_root), resolved_src);
20023
- if (rel !== "" && !rel.startsWith("..") && !path20.isAbsolute(rel)) {
20312
+ const rel = path21.relative(resolvePath(package_root), resolved_src);
20313
+ if (rel !== "" && !rel.startsWith("..") && !path21.isAbsolute(rel)) {
20024
20314
  source_value = rel;
20025
20315
  } else {
20026
20316
  source_value = resolved_src;
@@ -20055,7 +20345,7 @@ function _escapes_package_root(resolved, package_root) {
20055
20345
  if (package_root === null) return false;
20056
20346
  let root;
20057
20347
  try {
20058
- root = fs23.realpathSync(package_root);
20348
+ root = fs24.realpathSync(package_root);
20059
20349
  } catch {
20060
20350
  return false;
20061
20351
  }
@@ -20070,7 +20360,7 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
20070
20360
  if (file_filter !== null && !file_filter(src)) return [0, 0, written_paths];
20071
20361
  let resolved_src = src;
20072
20362
  try {
20073
- resolved_src = fs23.realpathSync(src);
20363
+ resolved_src = fs24.realpathSync(src);
20074
20364
  } catch {
20075
20365
  resolved_src = src;
20076
20366
  }
@@ -20078,10 +20368,10 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
20078
20368
  warn(`refused: ${src} dereferences outside the package root \u2014 not copied`);
20079
20369
  return [0, 0, written_paths];
20080
20370
  }
20081
- mkdirp(path20.dirname(dest));
20371
+ mkdirp(path21.dirname(dest));
20082
20372
  const decision = _resolve_file_conflict(dest, force);
20083
20373
  if (decision === "skip") return [0, 1, written_paths];
20084
- fs23.copyFileSync(src, dest);
20374
+ fs24.copyFileSync(src, dest);
20085
20375
  _inject_package_tag(dest, src, package_root);
20086
20376
  written_paths.push(dest);
20087
20377
  return [1, 0, written_paths];
@@ -20089,11 +20379,11 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
20089
20379
  mkdirp(dest);
20090
20380
  const walk = (node) => {
20091
20381
  const acc = [];
20092
- const names = fs23.readdirSync(node).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
20382
+ const names = fs24.readdirSync(node).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
20093
20383
  for (const name of names) {
20094
- const entry = path20.join(node, name);
20384
+ const entry = path21.join(node, name);
20095
20385
  acc.push(entry);
20096
- const lst = fs23.lstatSync(entry);
20386
+ const lst = fs24.lstatSync(entry);
20097
20387
  if (lst.isDirectory() && !lst.isSymbolicLink()) {
20098
20388
  acc.push(...walk(entry));
20099
20389
  }
@@ -20101,9 +20391,9 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
20101
20391
  return acc;
20102
20392
  };
20103
20393
  for (const entry of walk(src)) {
20104
- const rel = path20.relative(src, entry);
20105
- const target = path20.join(dest, rel);
20106
- const lst = fs23.lstatSync(entry);
20394
+ const rel = path21.relative(src, entry);
20395
+ const target = path21.join(dest, rel);
20396
+ const lst = fs24.lstatSync(entry);
20107
20397
  if (lst.isDirectory() && !lst.isSymbolicLink()) {
20108
20398
  mkdirp(target);
20109
20399
  continue;
@@ -20111,8 +20401,8 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
20111
20401
  let resolvedIsDir = false;
20112
20402
  let resolved = entry;
20113
20403
  try {
20114
- resolved = fs23.realpathSync(entry);
20115
- resolvedIsDir = fs23.statSync(entry).isDirectory();
20404
+ resolved = fs24.realpathSync(entry);
20405
+ resolvedIsDir = fs24.statSync(entry).isDirectory();
20116
20406
  } catch {
20117
20407
  resolvedIsDir = false;
20118
20408
  }
@@ -20142,8 +20432,8 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
20142
20432
  skipped += 1;
20143
20433
  continue;
20144
20434
  }
20145
- mkdirp(path20.dirname(target));
20146
- fs23.copyFileSync(resolved, target);
20435
+ mkdirp(path21.dirname(target));
20436
+ fs24.copyFileSync(resolved, target);
20147
20437
  _inject_package_tag(target, resolved, package_root);
20148
20438
  written += 1;
20149
20439
  written_paths.push(target);
@@ -20155,7 +20445,7 @@ function _claude_desktop_bundles_dir() {
20155
20445
  }
20156
20446
  function _write_claude_desktop_marker(_force, lockfile_path2, bundles_dir, bundle_count) {
20157
20447
  const anchor = expanduser6(USER_SCOPE_PATHS["claude-desktop"]);
20158
- const target = path20.join(anchor, "agent-config.md");
20448
+ const target = path21.join(anchor, "agent-config.md");
20159
20449
  mkdirp(anchor);
20160
20450
  const body = claudeDesktopMarkerBody(lockfile_path2, anchor, bundles_dir, bundle_count);
20161
20451
  writeText(target, body);
@@ -20179,23 +20469,23 @@ function _apply_claude_flat_command_wrappers(anchor, package_root, current_files
20179
20469
  const wrapped = [];
20180
20470
  const collisions = [];
20181
20471
  const reserved = [];
20182
- const commands_dir = path20.join(anchor, "commands");
20472
+ const commands_dir = path21.join(anchor, "commands");
20183
20473
  let flat_entries = [];
20184
20474
  try {
20185
- flat_entries = fs23.readdirSync(commands_dir).filter((f) => f.endsWith(".md"));
20475
+ flat_entries = fs24.readdirSync(commands_dir).filter((f) => f.endsWith(".md"));
20186
20476
  } catch {
20187
20477
  }
20188
20478
  for (const fname of flat_entries.sort()) {
20189
20479
  const slug = fname.slice(0, -".md".length);
20190
20480
  if (!is_claude_builtin_name(slug)) continue;
20191
- fs23.rmSync(path20.join(commands_dir, fname), { force: true });
20481
+ fs24.rmSync(path21.join(commands_dir, fname), { force: true });
20192
20482
  current_files.delete(`commands/${fname}`);
20193
20483
  reserved.push(slug);
20194
20484
  }
20195
20485
  const eligible = new Set(_CLAUDE_FLAT_WRAPPER_EXTRA);
20196
20486
  try {
20197
20487
  const manifest = JSON.parse(
20198
- fs23.readFileSync(path20.join(package_root, "dist", "discovery", "discovery-manifest.json"), "utf8")
20488
+ fs24.readFileSync(path21.join(package_root, "dist", "discovery", "discovery-manifest.json"), "utf8")
20199
20489
  );
20200
20490
  for (const a of manifest.artefacts ?? []) {
20201
20491
  if (a.category !== "command" || typeof a.slug !== "string") continue;
@@ -20206,22 +20496,22 @@ function _apply_claude_flat_command_wrappers(anchor, package_root, current_files
20206
20496
  }
20207
20497
  for (const slug of [...eligible].sort()) {
20208
20498
  const flat_rel = `commands/${slug}.md`;
20209
- const flat_abs = path20.join(anchor, "commands", `${slug}.md`);
20210
- if (!fs23.existsSync(flat_abs)) continue;
20211
- const skill_dir = path20.join(anchor, "skills", slug);
20212
- if (fs23.existsSync(skill_dir)) {
20499
+ const flat_abs = path21.join(anchor, "commands", `${slug}.md`);
20500
+ if (!fs24.existsSync(flat_abs)) continue;
20501
+ const skill_dir = path21.join(anchor, "skills", slug);
20502
+ if (fs24.existsSync(skill_dir)) {
20213
20503
  collisions.push(slug);
20214
20504
  continue;
20215
20505
  }
20216
- let body = fs23.readFileSync(flat_abs, "utf8");
20506
+ let body = fs24.readFileSync(flat_abs, "utf8");
20217
20507
  if (body.startsWith("---\n") && !/^name:/m.test(body.split("\n---")[0] ?? "")) {
20218
20508
  body = body.replace("---\n", `---
20219
20509
  name: ${slug}
20220
20510
  `);
20221
20511
  }
20222
- fs23.mkdirSync(skill_dir, { recursive: true });
20223
- fs23.writeFileSync(path20.join(skill_dir, "SKILL.md"), body, "utf8");
20224
- fs23.rmSync(flat_abs, { force: true });
20512
+ fs24.mkdirSync(skill_dir, { recursive: true });
20513
+ fs24.writeFileSync(path21.join(skill_dir, "SKILL.md"), body, "utf8");
20514
+ fs24.rmSync(flat_abs, { force: true });
20225
20515
  current_files.delete(flat_rel);
20226
20516
  current_files.add(`skills/${slug}/SKILL.md`);
20227
20517
  wrapped.push(slug);
@@ -20253,8 +20543,8 @@ function _deploy_global_content(tools, force, package_root, lockfile_path2) {
20253
20543
  const written_paths = [];
20254
20544
  let current_files = /* @__PURE__ */ new Set();
20255
20545
  for (const [src_rel, dest_sub] of plan) {
20256
- const src = path20.join(package_root, src_rel);
20257
- const dest = dest_sub ? path20.join(anchor, dest_sub) : anchor;
20546
+ const src = path21.join(package_root, src_rel);
20547
+ const dest = dest_sub ? path21.join(anchor, dest_sub) : anchor;
20258
20548
  const rule_filter = _rule_filter_for_source(src_rel, rule_scope);
20259
20549
  const [w, s, paths] = _copy_dir_dereferencing_symlinks(
20260
20550
  src,
@@ -20278,7 +20568,7 @@ function _deploy_global_content(tools, force, package_root, lockfile_path2) {
20278
20568
  if (tool_id === "claude-code") {
20279
20569
  const res = _apply_claude_flat_command_wrappers(anchor, package_root, current_files);
20280
20570
  rewriteAndReport(
20281
- path20.join(anchor, "rules"),
20571
+ path21.join(anchor, "rules"),
20282
20572
  state.QUIET,
20283
20573
  info,
20284
20574
  warn,
@@ -20325,10 +20615,10 @@ function _deploy_global_content(tools, force, package_root, lockfile_path2) {
20325
20615
  results[tool_id] = [written_total, skipped_total, "deployed", written_paths];
20326
20616
  if (tool_id === "claude-code") {
20327
20617
  try {
20328
- const manifest = path20.join(package_root, "src", "scripts", "hook_manifest.yaml");
20618
+ const manifest = path21.join(package_root, "src", "scripts", "hook_manifest.yaml");
20329
20619
  const matrix = build_claude_hook_matrix(manifest);
20330
20620
  const res = ensure_managed_hooks(
20331
- path20.join(anchor, "settings.json"),
20621
+ path21.join(anchor, "settings.json"),
20332
20622
  matrix
20333
20623
  );
20334
20624
  if (!state.QUIET) {
@@ -20365,7 +20655,7 @@ function _preview_global_reap(tools, package_root) {
20365
20655
  const anchor = expanduser6(anchor_raw);
20366
20656
  let current_files = /* @__PURE__ */ new Set();
20367
20657
  for (const [src_rel, dest_sub] of plan) {
20368
- const src = path20.join(package_root, src_rel);
20658
+ const src = path21.join(package_root, src_rel);
20369
20659
  current_files = setUnion(
20370
20660
  current_files,
20371
20661
  expected_deploy_files(
@@ -20399,14 +20689,14 @@ function _preview_global_reap(tools, package_root) {
20399
20689
  function _verify_deploy_targets(anchor, plan) {
20400
20690
  const missing = [];
20401
20691
  for (const [, dest_sub] of plan) {
20402
- const target = dest_sub ? path20.join(anchor, dest_sub) : anchor;
20692
+ const target = dest_sub ? path21.join(anchor, dest_sub) : anchor;
20403
20693
  const label = dest_sub || ".";
20404
20694
  if (!isDir(target)) {
20405
20695
  missing.push(label);
20406
20696
  continue;
20407
20697
  }
20408
20698
  try {
20409
- const entries = fs23.readdirSync(target);
20699
+ const entries = fs24.readdirSync(target);
20410
20700
  if (entries.length === 0) missing.push(label);
20411
20701
  } catch {
20412
20702
  missing.push(label);
@@ -20424,9 +20714,9 @@ function _resolve_global_settings_doc() {
20424
20714
  }
20425
20715
  function _resolve_global_settings_path() {
20426
20716
  const root = event4u_root();
20427
- const canonical = path20.join(root, "settings", SETTINGS_FILE);
20717
+ const canonical = path21.join(root, "settings", SETTINGS_FILE);
20428
20718
  if (pathExists(canonical)) return canonical;
20429
- const legacy = path20.join(root, SETTINGS_FILE);
20719
+ const legacy = path21.join(root, SETTINGS_FILE);
20430
20720
  if (pathExists(legacy)) return legacy;
20431
20721
  return null;
20432
20722
  }
@@ -20497,13 +20787,13 @@ function install_global(tools, force, project_root = null, core_only = false) {
20497
20787
  const classification = classify_mismatch(installed_version, recorded);
20498
20788
  if (classification === "downgrade" && !force) {
20499
20789
  if (!state.QUIET) {
20500
- process3.stdout.write("\n");
20790
+ process4.stdout.write("\n");
20501
20791
  warn("Refusing global install: lockfile records a newer version.");
20502
20792
  info(` Lockfile: ${read_path}`);
20503
20793
  info(` Recorded version: ${recorded}`);
20504
20794
  info(` Current package: ${installed_version}`);
20505
20795
  info(" Fix: upgrade the package, or re-run with `--force`");
20506
- process3.stdout.write("\n");
20796
+ process4.stdout.write("\n");
20507
20797
  }
20508
20798
  return 1;
20509
20799
  }
@@ -20517,13 +20807,13 @@ function install_global(tools, force, project_root = null, core_only = false) {
20517
20807
  );
20518
20808
  }
20519
20809
  if (!state.QUIET) {
20520
- process3.stdout.write("\n");
20810
+ process4.stdout.write("\n");
20521
20811
  info("Agent Config \u2014 Global (user-scope) install [ADR-007]");
20522
20812
  info("Per-tool anchor paths:");
20523
20813
  for (const tool_id of [...tools].sort()) {
20524
20814
  const anchor = USER_SCOPE_PATHS[tool_id];
20525
20815
  if (anchor === void 0) continue;
20526
- process3.stdout.write(` ${tool_id.padEnd(15)} \u2192 ${anchor}
20816
+ process4.stdout.write(` ${tool_id.padEnd(15)} \u2192 ${anchor}
20527
20817
  `);
20528
20818
  }
20529
20819
  }
@@ -20532,15 +20822,15 @@ function install_global(tools, force, project_root = null, core_only = false) {
20532
20822
  const merged_tools = [.../* @__PURE__ */ new Set([...existing_tools, ...tools])].sort();
20533
20823
  const written = write_lockfile(installed_version, merged_tools, { path: write_path });
20534
20824
  if (!state.QUIET) {
20535
- process3.stdout.write("\n");
20825
+ process4.stdout.write("\n");
20536
20826
  info(`Lockfile written: ${written}`);
20537
20827
  info(` schema_version=1, agent_config_version=${installed_version}`);
20538
20828
  info(` tools=${merged_tools.join(",")}`);
20539
20829
  }
20540
- if (project_root !== null && pathExists(_resolve_settings_read(project_root)) && !isDir(path20.join(project_root, ".agent-src.uncondensed"))) {
20830
+ if (project_root !== null && pathExists(_resolve_settings_read(project_root)) && !isDir(path21.join(project_root, ".agent-src.uncondensed"))) {
20541
20831
  const drift = collect_drift(project_root);
20542
20832
  if (!state.QUIET) {
20543
- process3.stdout.write("\n");
20833
+ process4.stdout.write("\n");
20544
20834
  for (const line of format_drift_report(drift).replace(/\n$/, "").split("\n")) {
20545
20835
  info(line);
20546
20836
  }
@@ -20621,49 +20911,49 @@ function install_global(tools, force, project_root = null, core_only = false) {
20621
20911
  });
20622
20912
  }
20623
20913
  if (!state.QUIET) {
20624
- process3.stdout.write("\n");
20914
+ process4.stdout.write("\n");
20625
20915
  info("Deployed per-tool content:");
20626
20916
  for (const tool_id of Object.keys(deploy_results).sort()) {
20627
20917
  const [w, s, status] = deploy_results[tool_id];
20628
20918
  const anchor = USER_SCOPE_PATHS[tool_id] ?? "";
20629
20919
  if (status === "deployed" && tool_id === "claude-desktop") {
20630
20920
  const bundles_dir = _claude_desktop_bundles_dir();
20631
- process3.stdout.write(` ${tool_id.padEnd(15)} \u2192 ${bundles_dir} (${w} bundles)
20921
+ process4.stdout.write(` ${tool_id.padEnd(15)} \u2192 ${bundles_dir} (${w} bundles)
20632
20922
  `);
20633
20923
  } else if (status === "deployed") {
20634
- process3.stdout.write(` ${tool_id.padEnd(15)} \u2192 ${anchor} (${w} files, ${s} skipped)
20924
+ process4.stdout.write(` ${tool_id.padEnd(15)} \u2192 ${anchor} (${w} files, ${s} skipped)
20635
20925
  `);
20636
20926
  } else if (status === "marker") {
20637
- process3.stdout.write(
20927
+ process4.stdout.write(
20638
20928
  ` ${tool_id.padEnd(15)} \u2192 ${anchor}agent-config.md (${w ? "written" : "skipped"})
20639
20929
  `
20640
20930
  );
20641
20931
  } else if (status === "hint") {
20642
- process3.stdout.write(
20932
+ process4.stdout.write(
20643
20933
  ` ${tool_id.padEnd(15)} \u2192 no user-scope convention; use \`agent-config export --tool=${tool_id}\`
20644
20934
  `
20645
20935
  );
20646
20936
  } else {
20647
- process3.stdout.write(
20937
+ process4.stdout.write(
20648
20938
  ` ${tool_id.padEnd(15)} \u2192 no global-scope content yet (project-scope install supported)
20649
20939
  `
20650
20940
  );
20651
20941
  }
20652
20942
  }
20653
20943
  }
20654
- if (project_root !== null && pathExists(_resolve_settings_read(project_root)) && !isDir(path20.join(project_root, ".agent-src.uncondensed"))) {
20944
+ if (project_root !== null && pathExists(_resolve_settings_read(project_root)) && !isDir(path21.join(project_root, ".agent-src.uncondensed"))) {
20655
20945
  const files_by_tool = _files_by_tool_from_deploy(deploy_results);
20656
20946
  const rc = _update_installed_tools_manifest(project_root, tools, "global", force, files_by_tool);
20657
20947
  if (rc !== 0) return rc;
20658
20948
  const removed_marker = _remove_legacy_consumer_bridge_marker(project_root);
20659
20949
  if (removed_marker !== null && !state.QUIET) {
20660
- const rel = isRelativeTo(removed_marker, project_root) ? path20.relative(project_root, removed_marker) : removed_marker;
20950
+ const rel = isRelativeTo(removed_marker, project_root) ? path21.relative(project_root, removed_marker) : removed_marker;
20661
20951
  info(`Removed legacy bridge marker: ${rel}`);
20662
20952
  }
20663
20953
  const anchor_paths = _write_per_tool_project_anchors(project_root, tools);
20664
20954
  if (anchor_paths.length > 0 && !state.QUIET) {
20665
20955
  for (const p of anchor_paths) {
20666
- const rel = isRelativeTo(p, project_root) ? path20.relative(project_root, p) : p;
20956
+ const rel = isRelativeTo(p, project_root) ? path21.relative(project_root, p) : p;
20667
20957
  info(`Project anchor written: ${rel}`);
20668
20958
  }
20669
20959
  }
@@ -20679,28 +20969,28 @@ function install_global(tools, force, project_root = null, core_only = false) {
20679
20969
  warn(line);
20680
20970
  }
20681
20971
  const notice = _scoped_migration_notice(deploy_results, project_root, package_root, {
20682
- env: process3.env,
20683
- stdinTty: process3.stdin.isTTY === true,
20684
- stdoutTty: process3.stdout.isTTY === true
20972
+ env: process4.env,
20973
+ stdinTty: process4.stdin.isTTY === true,
20974
+ stdoutTty: process4.stdout.isTTY === true
20685
20975
  });
20686
20976
  if (notice.length > 0) {
20687
- process3.stdout.write("\n");
20977
+ process4.stdout.write("\n");
20688
20978
  for (const line of notice) info(line);
20689
20979
  }
20690
20980
  } catch {
20691
20981
  }
20692
20982
  }
20693
20983
  if (!state.QUIET) {
20694
- process3.stdout.write("\n");
20984
+ process4.stdout.write("\n");
20695
20985
  success(`Global install completed (v${installed_version}).`);
20696
- process3.stdout.write("\n");
20986
+ process4.stdout.write("\n");
20697
20987
  }
20698
20988
  return 0;
20699
20989
  }
20700
20990
  function _catalogue_truncation_warnings(deploy_results, project_root) {
20701
20991
  const log_candidates = [
20702
- path20.join(event4u_root(), "state", "skill-catalogue.jsonl"),
20703
- ...project_root ? [path20.join(project_root, OBSERVATION_LOG)] : []
20992
+ path21.join(event4u_root(), "state", "skill-catalogue.jsonl"),
20993
+ ...project_root ? [path21.join(project_root, OBSERVATION_LOG)] : []
20704
20994
  ];
20705
20995
  const records = log_candidates.flatMap((p) => readObservationLog(p));
20706
20996
  if (records.length === 0) return [];
@@ -20723,13 +21013,13 @@ function _catalogue_truncation_warnings(deploy_results, project_root) {
20723
21013
  function _scoped_migration_notice(deploy_results, project_root, package_root, probe) {
20724
21014
  if (!isInteractiveSession(probe)) return [];
20725
21015
  const log_candidates = [
20726
- path20.join(event4u_root(), "state", "skill-catalogue.jsonl"),
20727
- ...project_root ? [path20.join(project_root, OBSERVATION_LOG)] : []
21016
+ path21.join(event4u_root(), "state", "skill-catalogue.jsonl"),
21017
+ ...project_root ? [path21.join(project_root, OBSERVATION_LOG)] : []
20728
21018
  ];
20729
21019
  const limits = knownHostLimits(log_candidates.flatMap((p) => readObservationLog(p)));
20730
21020
  if (limits.size === 0) return [];
20731
21021
  const resolved = _resolve_scoped_projection(package_root);
20732
- const settings_path = _resolve_global_settings_path() ?? path20.join(event4u_root(), "settings", SETTINGS_FILE);
21022
+ const settings_path = _resolve_global_settings_path() ?? path21.join(event4u_root(), "settings", SETTINGS_FILE);
20733
21023
  for (const tool_id of Object.keys(deploy_results).sort()) {
20734
21024
  const [, , status] = deploy_results[tool_id];
20735
21025
  if (status !== "deployed") continue;
@@ -20748,8 +21038,8 @@ function _scoped_migration_notice(deploy_results, project_root, package_root, pr
20748
21038
  }
20749
21039
  return [];
20750
21040
  }
20751
- var SETTINGS_SURFACE_REL = path20.join("state", "settings-surface.json");
20752
- var SETTINGS_DELTA_REL = path20.join("state", "settings-delta.json");
21041
+ var SETTINGS_SURFACE_REL = path21.join("state", "settings-surface.json");
21042
+ var SETTINGS_DELTA_REL = path21.join("state", "settings-delta.json");
20753
21043
  function _current_settings_surface(version) {
20754
21044
  const jsonSchema = zodToJsonSchema(settingsSchema, {
20755
21045
  name: "AgentSettings",
@@ -20760,20 +21050,20 @@ function _current_settings_surface(version) {
20760
21050
  }
20761
21051
  function _write_settings_surface_snapshot(installed_version) {
20762
21052
  const root = event4u_root();
20763
- const surface_path = path20.join(root, SETTINGS_SURFACE_REL);
20764
- const delta_path = path20.join(root, SETTINGS_DELTA_REL);
21053
+ const surface_path = path21.join(root, SETTINGS_SURFACE_REL);
21054
+ const delta_path = path21.join(root, SETTINGS_DELTA_REL);
20765
21055
  const next = _current_settings_surface(installed_version);
20766
21056
  let previous = null;
20767
21057
  try {
20768
- const parsed = JSON.parse(fs23.readFileSync(surface_path, "utf8"));
21058
+ const parsed = JSON.parse(fs24.readFileSync(surface_path, "utf8"));
20769
21059
  if (parsed !== null && typeof parsed === "object" && parsed.entries !== void 0) previous = parsed;
20770
21060
  } catch {
20771
21061
  }
20772
21062
  if (previous !== null && previous.version !== next.version) {
20773
21063
  const delta = computeSurfaceDelta(previous, next);
20774
21064
  if (delta.changes.length > 0) {
20775
- fs23.mkdirSync(path20.dirname(delta_path), { recursive: true, mode: 448 });
20776
- fs23.writeFileSync(delta_path, `${JSON.stringify(delta, null, 2)}
21065
+ fs24.mkdirSync(path21.dirname(delta_path), { recursive: true, mode: 448 });
21066
+ fs24.writeFileSync(delta_path, `${JSON.stringify(delta, null, 2)}
20777
21067
  `, { mode: 384 });
20778
21068
  if (!state.QUIET) {
20779
21069
  const counts = {};
@@ -20785,8 +21075,8 @@ function _write_settings_surface_snapshot(installed_version) {
20785
21075
  }
20786
21076
  }
20787
21077
  }
20788
- fs23.mkdirSync(path20.dirname(surface_path), { recursive: true, mode: 448 });
20789
- fs23.writeFileSync(surface_path, `${JSON.stringify(next, null, 2)}
21078
+ fs24.mkdirSync(path21.dirname(surface_path), { recursive: true, mode: 448 });
21079
+ fs24.writeFileSync(surface_path, `${JSON.stringify(next, null, 2)}
20790
21080
  `, { mode: 384 });
20791
21081
  }
20792
21082
  function arrayStrEqual(a, b) {
@@ -20803,7 +21093,7 @@ function _merge_tools_aliases(tools, ai) {
20803
21093
  }
20804
21094
  return items.length > 0 ? items.join(",") : "all";
20805
21095
  }
20806
- var PROG = "install.py";
21096
+ var PROG = "agent-config install";
20807
21097
  var USAGE = `usage: ${PROG} [-h] [--profile PROFILE] [--user-type USER_TYPE] [--force]
20808
21098
  [--skip-bridges] [--augment-user-hooks]
20809
21099
  [--cursor-user-hooks] [--cline-user-hooks]
@@ -20850,8 +21140,8 @@ var _VALUE_FLAGS = {
20850
21140
  "--layer": "layer"
20851
21141
  };
20852
21142
  function _argError(msg) {
20853
- process3.stderr.write(USAGE);
20854
- process3.stderr.write(`${PROG}: error: ${msg}
21143
+ process4.stderr.write(USAGE);
21144
+ process4.stderr.write(`${PROG}: error: ${msg}
20855
21145
  `);
20856
21146
  throw new ArgparseExit2(2);
20857
21147
  }
@@ -20890,7 +21180,7 @@ function parse_options(argv) {
20890
21180
  while (i < argv.length) {
20891
21181
  const a = argv[i];
20892
21182
  if (a === "-h" || a === "--help") {
20893
- process3.stdout.write(USAGE);
21183
+ process4.stdout.write(USAGE);
20894
21184
  throw new ArgparseExit2(0);
20895
21185
  }
20896
21186
  const eq = a.startsWith("--") ? a.indexOf("=") : -1;
@@ -21006,13 +21296,13 @@ function _minimal_templates_root() {
21006
21296
  const chain = [start];
21007
21297
  let cur = start;
21008
21298
  for (; ; ) {
21009
- const parent = path20.dirname(cur);
21299
+ const parent = path21.dirname(cur);
21010
21300
  if (parent === cur) break;
21011
21301
  chain.push(parent);
21012
21302
  cur = parent;
21013
21303
  }
21014
21304
  for (const ancestor of chain) {
21015
- const candidate = path20.join(ancestor, "src", "templates", "minimal");
21305
+ const candidate = path21.join(ancestor, "src", "templates", "minimal");
21016
21306
  if (isDir(candidate)) return candidate;
21017
21307
  }
21018
21308
  fail("Could not locate src/templates/minimal/ \u2014 package install is corrupt.");
@@ -21020,9 +21310,9 @@ function _minimal_templates_root() {
21020
21310
  var INSTALL_MODE_MARKER_REL = "agents/.agent-state/install-mode.txt";
21021
21311
  function _write_install_mode_marker(project_root, mode) {
21022
21312
  if (mode !== "minimal" && mode !== "full") return;
21023
- const marker = path20.join(project_root, INSTALL_MODE_MARKER_REL);
21313
+ const marker = path21.join(project_root, INSTALL_MODE_MARKER_REL);
21024
21314
  try {
21025
- mkdirp(path20.dirname(marker));
21315
+ mkdirp(path21.dirname(marker));
21026
21316
  writeText(marker, `${mode}
21027
21317
  `);
21028
21318
  } catch {
@@ -21031,7 +21321,7 @@ function _write_install_mode_marker(project_root, mode) {
21031
21321
  function install_minimal(target_root_in, force, user_type = "") {
21032
21322
  let target_root = resolvePath(target_root_in);
21033
21323
  mkdirp(target_root);
21034
- const parent = path20.dirname(target_root);
21324
+ const parent = path21.dirname(target_root);
21035
21325
  if (parent !== target_root) {
21036
21326
  const existing = find_project_root_with_anchor(parent);
21037
21327
  if (existing !== null && existing[0] !== target_root) {
@@ -21042,21 +21332,21 @@ function install_minimal(target_root_in, force, user_type = "") {
21042
21332
  }
21043
21333
  }
21044
21334
  const templates = _minimal_templates_root();
21045
- const settings_src = path20.join(templates, SETTINGS_FILE);
21046
- const overrides_gitkeep_src = path20.join(templates, "overrides-gitkeep");
21047
- const overrides_readme_src = path20.join(templates, "agents-overrides-readme.md");
21335
+ const settings_src = path21.join(templates, SETTINGS_FILE);
21336
+ const overrides_gitkeep_src = path21.join(templates, "overrides-gitkeep");
21337
+ const overrides_readme_src = path21.join(templates, "agents-overrides-readme.md");
21048
21338
  if (!isFile(settings_src)) fail(`Bundled minimal settings template missing under ${templates}`);
21049
21339
  if (!isFile(overrides_gitkeep_src) || !isFile(overrides_readme_src)) {
21050
21340
  fail(`Bundled overrides scaffold templates missing under ${templates}`);
21051
21341
  }
21052
21342
  info(`Minimal init \u2192 ${target_root}`);
21053
- const overrides_root = path20.join(target_root, "agents", "overrides");
21343
+ const overrides_root = path21.join(target_root, "agents", "overrides");
21054
21344
  mkdirp(overrides_root);
21055
21345
  const gitkeep_body = readText(overrides_gitkeep_src);
21056
21346
  for (const sub of ["rules", "skills", "commands"]) {
21057
- const sub_dir = path20.join(overrides_root, sub);
21347
+ const sub_dir = path21.join(overrides_root, sub);
21058
21348
  mkdirp(sub_dir);
21059
- const gitkeep_dst = path20.join(sub_dir, ".gitkeep");
21349
+ const gitkeep_dst = path21.join(sub_dir, ".gitkeep");
21060
21350
  if (pathExists(gitkeep_dst) && !force) {
21061
21351
  skip(`agents/overrides/${sub}/.gitkeep already exists (use --force to overwrite)`);
21062
21352
  } else {
@@ -21064,7 +21354,7 @@ function install_minimal(target_root_in, force, user_type = "") {
21064
21354
  success(`Wrote agents/overrides/${sub}/.gitkeep`);
21065
21355
  }
21066
21356
  }
21067
- const readme_dst = path20.join(overrides_root, "README.md");
21357
+ const readme_dst = path21.join(overrides_root, "README.md");
21068
21358
  if (pathExists(readme_dst) && !force) {
21069
21359
  skip("agents/overrides/README.md already exists (use --force to overwrite)");
21070
21360
  } else {
@@ -21082,24 +21372,24 @@ function install_minimal(target_root_in, force, user_type = "") {
21082
21372
  personal:
21083
21373
  user_type: ${user_type}
21084
21374
  `;
21085
- mkdirp(path20.dirname(settings_dst));
21375
+ mkdirp(path21.dirname(settings_dst));
21086
21376
  writeText(settings_dst, body);
21087
21377
  success(`Wrote ${SETTINGS_FILE} (user_type=${user_type})`);
21088
21378
  }
21089
21379
  }
21090
21380
  const removed_marker = _remove_legacy_consumer_bridge_marker(target_root);
21091
21381
  if (removed_marker !== null) {
21092
- const rel = isRelativeTo(removed_marker, target_root) ? path20.relative(target_root, removed_marker) : removed_marker;
21382
+ const rel = isRelativeTo(removed_marker, target_root) ? path21.relative(target_root, removed_marker) : removed_marker;
21093
21383
  success(`Removed legacy bridge marker: ${rel}`);
21094
21384
  }
21095
21385
  _write_install_mode_marker(target_root, "minimal");
21096
21386
  if (!state.QUIET) {
21097
- process3.stderr.write(
21387
+ process4.stderr.write(
21098
21388
  "\u2139\uFE0F Minimal install \u2014 run `agent-config install --force` to add AGENTS.md, bridges, and tool integrations.\n"
21099
21389
  );
21100
21390
  }
21101
21391
  if (!state.QUIET) {
21102
- process3.stdout.write("\n");
21392
+ process4.stdout.write("\n");
21103
21393
  info("Next steps:");
21104
21394
  info(" \u2022 Ensure `agent-config` is on $PATH: npm install -g @event4u/agent-config");
21105
21395
  info(" \u2022 Drop project-scoped overrides under `agents/overrides/{rules,skills,commands}/`.");
@@ -21131,14 +21421,14 @@ var _INTERACTIVE_VERBOSITIES = [
21131
21421
  ];
21132
21422
  var _LOCAL_CONFIG_FILE = ".agent-config.local.json";
21133
21423
  function _interactive_prompt_choice(label, options) {
21134
- process3.stdout.write("\n");
21135
- process3.stdout.write(` ${label}
21424
+ process4.stdout.write("\n");
21425
+ process4.stdout.write(` ${label}
21136
21426
  `);
21137
21427
  options.forEach(([key, blurb], idx) => {
21138
- process3.stdout.write(` ${idx + 1}. ${key} \u2014 ${blurb}
21428
+ process4.stdout.write(` ${idx + 1}. ${key} \u2014 ${blurb}
21139
21429
  `);
21140
21430
  });
21141
- process3.stdout.write("\n");
21431
+ process4.stdout.write("\n");
21142
21432
  for (; ; ) {
21143
21433
  const raw = _read_line(` Choice [1-${options.length}, default 1]: `);
21144
21434
  if (raw === null) return options[0][0];
@@ -21150,27 +21440,27 @@ function _interactive_prompt_choice(label, options) {
21150
21440
  for (const [key] of options) {
21151
21441
  if (raw.toLowerCase() === key) return key;
21152
21442
  }
21153
- process3.stdout.write(
21443
+ process4.stdout.write(
21154
21444
  ` \u26A0\uFE0F Pick a number 1-${options.length} or one of: ${options.map(([k]) => k).join(", ")}.
21155
21445
  `
21156
21446
  );
21157
21447
  }
21158
21448
  }
21159
21449
  function run_interactive_init(project_root, force) {
21160
- if (!process3.stdin.isTTY) {
21450
+ if (!process4.stdin.isTTY) {
21161
21451
  warn(
21162
21452
  `--interactive requested but stdin is not a TTY; skipping the prompt. Re-run interactively or hand-edit ${_LOCAL_CONFIG_FILE}.`
21163
21453
  );
21164
21454
  return 0;
21165
21455
  }
21166
- const target = path20.join(project_root, _LOCAL_CONFIG_FILE);
21456
+ const target = path21.join(project_root, _LOCAL_CONFIG_FILE);
21167
21457
  if (pathExists(target) && !force) {
21168
21458
  warn(
21169
21459
  `${_LOCAL_CONFIG_FILE} already exists; re-run with --force to overwrite. Skipping interactive init.`
21170
21460
  );
21171
21461
  return 0;
21172
21462
  }
21173
- process3.stdout.write("\n");
21463
+ process4.stdout.write("\n");
21174
21464
  info("Interactive init \u2014 captures user-type / stack / verbosity");
21175
21465
  info("(forward-compatible stub; runtime filtering activates with step-9)");
21176
21466
  const user_type = _interactive_prompt_choice("Primary user type:", _INTERACTIVE_USER_TYPES);
@@ -21190,17 +21480,17 @@ function run_interactive_init(project_root, force) {
21190
21480
  warn(`Could not write ${target}: ${String(exc)}`);
21191
21481
  return 1;
21192
21482
  }
21193
- success(`Wrote ${path20.relative(project_root, target)} (${user_type} / ${stack} / ${verbosity})`);
21483
+ success(`Wrote ${path21.relative(project_root, target)} (${user_type} / ${stack} / ${verbosity})`);
21194
21484
  return 0;
21195
21485
  }
21196
21486
  var _WIZARD_READY_RE = /^WIZARD_READY (http:\/\/(?:127\.0\.0\.1|localhost):\d+\/\S*)\r?$/;
21197
21487
  var _WIZARD_TIMEOUTS = [10, 20, 40, 80];
21198
21488
  function _wizard_should_launch(opts) {
21199
21489
  if (opts.no_ui) return [false, "--no-ui flag set"];
21200
- const env_no_ui = (process3.env["AGENT_CONFIG_NO_UI"] ?? "").trim();
21490
+ const env_no_ui = (process4.env["AGENT_CONFIG_NO_UI"] ?? "").trim();
21201
21491
  if (env_no_ui && env_no_ui !== "0") return [false, "AGENT_CONFIG_NO_UI env set"];
21202
- if ((process3.env["CI"] ?? "").trim()) return [false, "CI environment detected"];
21203
- if (!process3.stdout.isTTY) return [false, "stdout is not a TTY"];
21492
+ if ((process4.env["CI"] ?? "").trim()) return [false, "CI environment detected"];
21493
+ if (!process4.stdout.isTTY) return [false, "stdout is not a TTY"];
21204
21494
  const tools_raw = opts.tools;
21205
21495
  if (tools_raw && !_tools_was_all(tools_raw)) {
21206
21496
  return [false, "explicit --tools= selection (headless install)"];
@@ -21208,12 +21498,12 @@ function _wizard_should_launch(opts) {
21208
21498
  return [true, ""];
21209
21499
  }
21210
21500
  function _wizard_cli_dist(_project_root) {
21211
- const package_root = path20.dirname(path20.dirname(path20.dirname(resolvePath(_HERE2))));
21212
- const cli = path20.join(package_root, "dist", "cli", "agent-config.js");
21501
+ const package_root = path21.dirname(path21.dirname(path21.dirname(resolvePath(_HERE2))));
21502
+ const cli = path21.join(package_root, "dist", "cli", "agent-config.js");
21213
21503
  return pathExists(cli) ? cli : null;
21214
21504
  }
21215
21505
  function _server_info_path() {
21216
- return path20.join(os8.homedir(), ".event4u", "agent-config", "local-server.json");
21506
+ return path21.join(os8.homedir(), ".event4u", "agent-config", "local-server.json");
21217
21507
  }
21218
21508
  function _pid_is_agent_config(pid) {
21219
21509
  let res;
@@ -21230,13 +21520,13 @@ function _pid_is_agent_config(pid) {
21230
21520
  }
21231
21521
  function unlinkMissingOk(p) {
21232
21522
  try {
21233
- fs23.unlinkSync(p);
21523
+ fs24.unlinkSync(p);
21234
21524
  } catch {
21235
21525
  }
21236
21526
  }
21237
21527
  function pidAlive(pid) {
21238
21528
  try {
21239
- process3.kill(pid, 0);
21529
+ process4.kill(pid, 0);
21240
21530
  return true;
21241
21531
  } catch (err) {
21242
21532
  return err.code === "EPERM";
@@ -21261,7 +21551,7 @@ function _kill_stale_wizard_server() {
21261
21551
  }
21262
21552
  if (!_pid_is_agent_config(pid)) return;
21263
21553
  try {
21264
- process3.kill(pid, "SIGTERM");
21554
+ process4.kill(pid, "SIGTERM");
21265
21555
  } catch {
21266
21556
  unlinkMissingOk(p);
21267
21557
  return;
@@ -21276,12 +21566,12 @@ function _kill_stale_wizard_server() {
21276
21566
  }
21277
21567
  if (!exited) {
21278
21568
  try {
21279
- process3.kill(pid, "SIGKILL");
21569
+ process4.kill(pid, "SIGKILL");
21280
21570
  } catch {
21281
21571
  }
21282
21572
  }
21283
21573
  unlinkMissingOk(p);
21284
- process3.stdout.write("(Stopped the previous wizard server.)\n");
21574
+ process4.stdout.write("(Stopped the previous wizard server.)\n");
21285
21575
  }
21286
21576
  function sleepMs(ms) {
21287
21577
  const end = Date.now() + ms;
@@ -21294,7 +21584,7 @@ function _wizard_spawn(project_root, pass_project_root = true) {
21294
21584
  _kill_stale_wizard_server();
21295
21585
  const cli = _wizard_cli_dist(project_root);
21296
21586
  if (cli === null) {
21297
- process3.stdout.write(
21587
+ process4.stdout.write(
21298
21588
  "(Wizard not available \u2014 CLI bundle not built. Run 'npm run build' at the package root to produce dist/cli/.)\n"
21299
21589
  );
21300
21590
  return 0;
@@ -21303,19 +21593,19 @@ function _wizard_spawn(project_root, pass_project_root = true) {
21303
21593
  if (pass_project_root) {
21304
21594
  cmd.push("--project-root", project_root);
21305
21595
  }
21306
- const env = { ...process3.env };
21596
+ const env = { ...process4.env };
21307
21597
  return _wizard_run_sync(cmd, env, cli);
21308
21598
  }
21309
21599
  function _wizard_run_sync(cmd, env, cli) {
21310
21600
  const total = _WIZARD_TIMEOUTS.reduce((a, b) => a + b, 0);
21311
- const log_path = path20.join(
21601
+ const log_path = path21.join(
21312
21602
  os8.tmpdir(),
21313
- `agent-config-wizard-${process3.pid}-${Date.now()}.log`
21603
+ `agent-config-wizard-${process4.pid}-${Date.now()}.log`
21314
21604
  );
21315
21605
  let child;
21316
21606
  let log_fd = null;
21317
21607
  try {
21318
- log_fd = fs23.openSync(log_path, "w");
21608
+ log_fd = fs24.openSync(log_path, "w");
21319
21609
  child = spawn(cmd[0], cmd.slice(1), {
21320
21610
  env,
21321
21611
  detached: true,
@@ -21325,7 +21615,7 @@ function _wizard_run_sync(cmd, env, cli) {
21325
21615
  });
21326
21616
  child.unref();
21327
21617
  } catch (exc) {
21328
- process3.stdout.write(
21618
+ process4.stdout.write(
21329
21619
  `(Wizard failed to start: ${String(exc)}; run 'node ${cli} install --no-open' manually.)
21330
21620
  `
21331
21621
  );
@@ -21333,7 +21623,7 @@ function _wizard_run_sync(cmd, env, cli) {
21333
21623
  } finally {
21334
21624
  if (log_fd !== null) {
21335
21625
  try {
21336
- fs23.closeSync(log_fd);
21626
+ fs24.closeSync(log_fd);
21337
21627
  } catch {
21338
21628
  }
21339
21629
  }
@@ -21364,7 +21654,7 @@ function _wizard_run_sync(cmd, env, cli) {
21364
21654
  if (matched_url === null) {
21365
21655
  const logLines = read_log().split("\n").filter((l) => l !== "");
21366
21656
  const tail = logLines.length ? logLines.slice(-20).join("\n ") : "(no output captured)";
21367
- process3.stdout.write(
21657
+ process4.stdout.write(
21368
21658
  `(Wizard server did not report ready within ${Math.trunc(total)}s; run 'node ${cli} install --no-open' manually.)
21369
21659
  Last output:
21370
21660
  ${tail}
@@ -21372,49 +21662,49 @@ function _wizard_run_sync(cmd, env, cli) {
21372
21662
  );
21373
21663
  return 0;
21374
21664
  }
21375
- process3.stdout.write("\n");
21376
- process3.stdout.write(`Setup wizard ready: ${matched_url}
21665
+ process4.stdout.write("\n");
21666
+ process4.stdout.write(`Setup wizard ready: ${matched_url}
21377
21667
  `);
21378
21668
  _openBrowser(matched_url);
21379
- process3.stdout.write(
21669
+ process4.stdout.write(
21380
21670
  "(Wizard server keeps running in the background \u2014 finish the wizard in the browser tab; the next install run stops any stale server.)\n"
21381
21671
  );
21382
21672
  return 0;
21383
21673
  }
21384
21674
  function _openBrowser(url) {
21385
21675
  try {
21386
- const opener = process3.platform === "darwin" ? ["open", [url]] : process3.platform === "win32" ? ["cmd", ["/c", "start", "", url]] : ["xdg-open", [url]];
21676
+ const opener = process4.platform === "darwin" ? ["open", [url]] : process4.platform === "win32" ? ["cmd", ["/c", "start", "", url]] : ["xdg-open", [url]];
21387
21677
  spawnSync2(opener[0], opener[1], { stdio: "ignore" });
21388
21678
  } catch {
21389
21679
  }
21390
21680
  }
21391
21681
  function _dry_run_summary(opts) {
21392
21682
  const target = resolvePath(
21393
- opts.custom_path || opts.project || process3.env["PROJECT_ROOT"] || process3.cwd()
21683
+ opts.custom_path || opts.project || process4.env["PROJECT_ROOT"] || process4.cwd()
21394
21684
  );
21395
21685
  const [will_launch, why_not] = _wizard_should_launch(opts);
21396
- process3.stdout.write("\n");
21397
- process3.stdout.write("[dry-run] Plan summary \u2014 no files written, no subprocesses spawned:\n");
21398
- process3.stdout.write(` profile: ${opts.profile}
21686
+ process4.stdout.write("\n");
21687
+ process4.stdout.write("[dry-run] Plan summary \u2014 no files written, no subprocesses spawned:\n");
21688
+ process4.stdout.write(` profile: ${opts.profile}
21399
21689
  `);
21400
- process3.stdout.write(` user-type: ${opts.user_type || "(none)"}
21690
+ process4.stdout.write(` user-type: ${opts.user_type || "(none)"}
21401
21691
  `);
21402
- process3.stdout.write(` scope: ${opts.scope || (opts.global_install ? "global" : "auto")}
21692
+ process4.stdout.write(` scope: ${opts.scope || (opts.global_install ? "global" : "auto")}
21403
21693
  `);
21404
- process3.stdout.write(` tools: ${opts.tools || "all"}
21694
+ process4.stdout.write(` tools: ${opts.tools || "all"}
21405
21695
  `);
21406
- process3.stdout.write(` target: ${target}
21696
+ process4.stdout.write(` target: ${target}
21407
21697
  `);
21408
- process3.stdout.write(` minimal: ${pyBool(opts.minimal)}
21698
+ process4.stdout.write(` minimal: ${pyBool(opts.minimal)}
21409
21699
  `);
21410
- process3.stdout.write(` force: ${pyBool(opts.force)}
21700
+ process4.stdout.write(` force: ${pyBool(opts.force)}
21411
21701
  `);
21412
- process3.stdout.write(` offline: ${pyBool(opts.offline)}
21702
+ process4.stdout.write(` offline: ${pyBool(opts.offline)}
21413
21703
  `);
21414
21704
  if (will_launch) {
21415
- process3.stdout.write(" wizard: Would auto-launch (pass --no-ui to suppress).\n");
21705
+ process4.stdout.write(" wizard: Would auto-launch (pass --no-ui to suppress).\n");
21416
21706
  } else {
21417
- process3.stdout.write(` wizard: Suppressed (${why_not}).
21707
+ process4.stdout.write(` wizard: Suppressed (${why_not}).
21418
21708
  `);
21419
21709
  }
21420
21710
  if (opts.global_install) {
@@ -21428,21 +21718,21 @@ function _dry_run_summary(opts) {
21428
21718
  preview = {};
21429
21719
  }
21430
21720
  const total = Object.values(preview).reduce((a, v) => a + v.length, 0);
21431
- process3.stdout.write("\n");
21721
+ process4.stdout.write("\n");
21432
21722
  if (total === 0) {
21433
- process3.stdout.write(" reap (cleanup): nothing to reap \u2014 no stale deployed files.\n");
21723
+ process4.stdout.write(" reap (cleanup): nothing to reap \u2014 no stale deployed files.\n");
21434
21724
  } else {
21435
- process3.stdout.write(` reap (cleanup): would remove ${total} stale file(s):
21725
+ process4.stdout.write(` reap (cleanup): would remove ${total} stale file(s):
21436
21726
  `);
21437
21727
  for (const tool_id of Object.keys(preview).sort()) {
21438
21728
  for (const p of preview[tool_id]) {
21439
- process3.stdout.write(` ${tool_id}: ${p}
21729
+ process4.stdout.write(` ${tool_id}: ${p}
21440
21730
  `);
21441
21731
  }
21442
21732
  }
21443
21733
  }
21444
21734
  }
21445
- process3.stdout.write("\n");
21735
+ process4.stdout.write("\n");
21446
21736
  return 0;
21447
21737
  }
21448
21738
  function pyBool(v) {
@@ -21451,45 +21741,45 @@ function pyBool(v) {
21451
21741
  function _apply_payload_preview(payload, opts) {
21452
21742
  const schema_version = payload["schema_version"] ?? "<missing>";
21453
21743
  const target = resolvePath(
21454
- opts.custom_path || opts.project || process3.env["PROJECT_ROOT"] || process3.cwd()
21744
+ opts.custom_path || opts.project || process4.env["PROJECT_ROOT"] || process4.cwd()
21455
21745
  );
21456
- process3.stdout.write("\n");
21457
- process3.stdout.write(
21746
+ process4.stdout.write("\n");
21747
+ process4.stdout.write(
21458
21748
  "[apply-payload] Plan summary \u2014 no files written, no subprocesses spawned:\n"
21459
21749
  );
21460
- process3.stdout.write(` schema: ${schema_version}
21750
+ process4.stdout.write(` schema: ${schema_version}
21461
21751
  `);
21462
21752
  if (schema_version === "wizard-v2") {
21463
21753
  const tools = payload["tools"] || [];
21464
21754
  const packs = payload["packs"] || [];
21465
21755
  const settings = payload["settings"] || {};
21466
21756
  const scope_to_project = Boolean(payload["scope_to_project_only"] ?? false);
21467
- process3.stdout.write(` tools: ${tools.length ? tools.join(",") : "(none)"}
21757
+ process4.stdout.write(` tools: ${tools.length ? tools.join(",") : "(none)"}
21468
21758
  `);
21469
- process3.stdout.write(` packs: ${packs.length ? packs.join(",") : "(base)"}
21759
+ process4.stdout.write(` packs: ${packs.length ? packs.join(",") : "(base)"}
21470
21760
  `);
21471
- process3.stdout.write(` settings: ${Object.keys(settings).length} top-level key(s)
21761
+ process4.stdout.write(` settings: ${Object.keys(settings).length} top-level key(s)
21472
21762
  `);
21473
- process3.stdout.write(` scope: ${scope_to_project ? "project" : "global"}
21763
+ process4.stdout.write(` scope: ${scope_to_project ? "project" : "global"}
21474
21764
  `);
21475
21765
  } else if (schema_version === "installer-v1") {
21476
21766
  const ai_tools = payload["ai_tools"] || [];
21477
21767
  const configs = payload["configs"] || {};
21478
- process3.stdout.write(` ai_tools: ${ai_tools.length ? ai_tools.join(",") : "(none)"}
21768
+ process4.stdout.write(` ai_tools: ${ai_tools.length ? ai_tools.join(",") : "(none)"}
21479
21769
  `);
21480
- process3.stdout.write(` configs: ${Object.keys(configs).length} tool config(s)
21770
+ process4.stdout.write(` configs: ${Object.keys(configs).length} tool config(s)
21481
21771
  `);
21482
21772
  } else {
21483
- process3.stdout.write(` error: unsupported schema_version: ${pyRepr(schema_version)}
21773
+ process4.stdout.write(` error: unsupported schema_version: ${pyRepr(schema_version)}
21484
21774
  `);
21485
- process3.stdout.write("\n");
21775
+ process4.stdout.write("\n");
21486
21776
  return 2;
21487
21777
  }
21488
- process3.stdout.write(` target: ${target}
21778
+ process4.stdout.write(` target: ${target}
21489
21779
  `);
21490
- process3.stdout.write(` dry_run: ${pyBool(Boolean(payload["dry_run"] ?? opts.dry_run))}
21780
+ process4.stdout.write(` dry_run: ${pyBool(Boolean(payload["dry_run"] ?? opts.dry_run))}
21491
21781
  `);
21492
- process3.stdout.write("\n");
21782
+ process4.stdout.write("\n");
21493
21783
  return 0;
21494
21784
  }
21495
21785
  function pyRepr(v) {
@@ -21562,8 +21852,8 @@ function main2(argv) {
21562
21852
  state.QUIET = true;
21563
21853
  }
21564
21854
  if (opts.offline) {
21565
- process3.env["AGENT_CONFIG_OFFLINE"] = "1";
21566
- process3.env["AGENT_CONFIG_NO_UPDATE_CHECK"] = "1";
21855
+ process4.env["AGENT_CONFIG_OFFLINE"] = "1";
21856
+ process4.env["AGENT_CONFIG_NO_UPDATE_CHECK"] = "1";
21567
21857
  }
21568
21858
  if (!SUPPORTED_PROFILES.includes(opts.profile)) {
21569
21859
  fail(`Unsupported profile: ${opts.profile}. Supported: ${SUPPORTED_PROFILES.join(", ")}`);
@@ -21581,15 +21871,15 @@ function main2(argv) {
21581
21871
  }
21582
21872
  if (opts.minimal) {
21583
21873
  const target_root = resolvePath(
21584
- opts.custom_path || opts.project || process3.env["PROJECT_ROOT"] || process3.cwd()
21874
+ opts.custom_path || opts.project || process4.env["PROJECT_ROOT"] || process4.cwd()
21585
21875
  );
21586
- const minimal_package_root = path20.dirname(
21587
- path20.dirname(path20.dirname(_minimal_templates_root()))
21876
+ const minimal_package_root = path21.dirname(
21877
+ path21.dirname(path21.dirname(_minimal_templates_root()))
21588
21878
  );
21589
21879
  const validated_user_type = _validate_user_type(minimal_package_root, opts.user_type);
21590
21880
  return install_minimal(target_root, opts.force, validated_user_type);
21591
21881
  }
21592
- const detect_root = resolvePath(opts.project || process3.env["PROJECT_ROOT"] || process3.cwd());
21882
+ const detect_root = resolvePath(opts.project || process4.env["PROJECT_ROOT"] || process4.cwd());
21593
21883
  const [detected, detect_reason] = detect_scope(detect_root);
21594
21884
  const custom_path = opts.custom_path ? resolvePath(opts.custom_path) : null;
21595
21885
  const scope = _resolve_scope(opts, detected, detect_reason, custom_path);
@@ -21615,8 +21905,8 @@ function main2(argv) {
21615
21905
  }
21616
21906
  return rc2;
21617
21907
  }
21618
- const project_root = custom_path || resolvePath(opts.project || process3.env["PROJECT_ROOT"] || process3.cwd());
21619
- const is_first_run = !pathExists(path20.join(project_root, SETTINGS_FILE));
21908
+ const project_root = custom_path || resolvePath(opts.project || process4.env["PROJECT_ROOT"] || process4.cwd());
21909
+ const is_first_run = !pathExists(path21.join(project_root, SETTINGS_FILE));
21620
21910
  const rc = _main_project_install(opts, project_root, parsed_tools, is_first_run);
21621
21911
  if (rc === 0 && opts.interactive) {
21622
21912
  run_interactive_init(project_root, opts.force);
@@ -21625,7 +21915,7 @@ function main2(argv) {
21625
21915
  return rc;
21626
21916
  }
21627
21917
  function _propose_modules_config(project_root, is_first_run) {
21628
- if (!is_first_run || state.QUIET || !process3.stdin.isTTY || !process3.stdout.isTTY) return;
21918
+ if (!is_first_run || state.QUIET || !process4.stdin.isTTY || !process4.stdout.isTTY) return;
21629
21919
  let candidates;
21630
21920
  try {
21631
21921
  candidates = detect_module_roots(project_root);
@@ -21633,21 +21923,21 @@ function _propose_modules_config(project_root, is_first_run) {
21633
21923
  return;
21634
21924
  }
21635
21925
  if (!candidates || candidates.length === 0) return;
21636
- process3.stdout.write("\n");
21926
+ process4.stdout.write("\n");
21637
21927
  info("Module-root candidates detected \u2014 propose `modules:` block");
21638
21928
  info("Paste into .agent-project-settings.yml to enable module-aware skills (or skip; the block stays opt-in).");
21639
- process3.stdout.write("\n");
21640
- process3.stdout.write(" modules:\n");
21641
- process3.stdout.write(" enabled: true\n");
21642
- process3.stdout.write(" root_paths: [" + candidates.map((c) => c.path).join(", ") + "]\n");
21929
+ process4.stdout.write("\n");
21930
+ process4.stdout.write(" modules:\n");
21931
+ process4.stdout.write(" enabled: true\n");
21932
+ process4.stdout.write(" root_paths: [" + candidates.map((c) => c.path).join(", ") + "]\n");
21643
21933
  const primary_ns = candidates.find((c) => c.namespace_template_guess)?.namespace_template_guess ?? "";
21644
21934
  if (primary_ns) {
21645
- process3.stdout.write(` namespace_template: '${primary_ns}'
21935
+ process4.stdout.write(` namespace_template: '${primary_ns}'
21646
21936
  `);
21647
21937
  }
21648
- process3.stdout.write(" agent_folder: agents\n");
21649
- process3.stdout.write(" skip_dirs: [.module-template, .example]\n");
21650
- process3.stdout.write("\n");
21938
+ process4.stdout.write(" agent_folder: agents\n");
21939
+ process4.stdout.write(" skip_dirs: [.module-template, .example]\n");
21940
+ process4.stdout.write("\n");
21651
21941
  info(
21652
21942
  "Re-run anytime via `./scripts-run src/scripts/propose_modules_config` (installed under <package>/src/scripts/)."
21653
21943
  );
@@ -21680,16 +21970,16 @@ function _team_setup_hint_line(project_root) {
21680
21970
  return " \u2022 Claude Code team mode (optional cross-model review via the official codex plugin): run `agent-config doctor --check team` for setup status.";
21681
21971
  }
21682
21972
  function finalize_claude_model_tiers(project_root) {
21683
- const claude_skills = path20.join(project_root, ".claude", "skills");
21684
- const augment_skills = path20.join(project_root, ".augment", "skills");
21973
+ const claude_skills = path21.join(project_root, ".claude", "skills");
21974
+ const augment_skills = path21.join(project_root, ".augment", "skills");
21685
21975
  if (!isDir(claude_skills) || !isDir(augment_skills)) return 0;
21686
21976
  if (_read_consumer_auto_switch(project_root) !== "auto") return 0;
21687
21977
  let rendered = 0;
21688
- const entries = fs23.readdirSync(claude_skills).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
21978
+ const entries = fs24.readdirSync(claude_skills).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
21689
21979
  for (const name of entries) {
21690
- const entry = path20.join(claude_skills, name);
21691
- const src_dir = path20.join(augment_skills, name);
21692
- const src_md = path20.join(src_dir, "SKILL.md");
21980
+ const entry = path21.join(claude_skills, name);
21981
+ const src_dir = path21.join(augment_skills, name);
21982
+ const src_md = path21.join(src_dir, "SKILL.md");
21693
21983
  let tier;
21694
21984
  try {
21695
21985
  tier = read_model_tier(src_md);
@@ -21698,22 +21988,22 @@ function finalize_claude_model_tiers(project_root) {
21698
21988
  }
21699
21989
  if (tier === null || !(tier in TIER_TO_CLAUDE_MODEL) || !isDir(src_dir)) continue;
21700
21990
  if (isSymlink(entry) || isFile(entry)) {
21701
- fs23.unlinkSync(entry);
21991
+ fs24.unlinkSync(entry);
21702
21992
  } else if (isDir(entry)) {
21703
- fs23.rmSync(entry, { recursive: true, force: true });
21993
+ fs24.rmSync(entry, { recursive: true, force: true });
21704
21994
  }
21705
21995
  mkdirp(entry);
21706
- const srcFiles = fs23.readdirSync(src_dir).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
21996
+ const srcFiles = fs24.readdirSync(src_dir).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
21707
21997
  for (const fname of srcFiles) {
21708
21998
  if (fname === "SKILL.md") {
21709
21999
  writeText(
21710
- path20.join(entry, "SKILL.md"),
22000
+ path21.join(entry, "SKILL.md"),
21711
22001
  render_native_model_md(readText(src_md), tier)
21712
22002
  );
21713
22003
  } else {
21714
- fs23.symlinkSync(
21715
- path20.join("../../../.augment/skills", name, fname),
21716
- path20.join(entry, fname)
22004
+ fs24.symlinkSync(
22005
+ path21.join("../../../.augment/skills", name, fname),
22006
+ path21.join(entry, fname)
21717
22007
  );
21718
22008
  }
21719
22009
  }
@@ -21731,7 +22021,7 @@ function _main_project_install(opts, project_root, parsed_tools, is_first_run) {
21731
22021
  let package_type;
21732
22022
  if (opts.package) {
21733
22023
  package_root = resolvePath(opts.package);
21734
- if (!pathExists(path20.join(package_root, "src", "config", "profiles", "minimal.ini"))) {
22024
+ if (!pathExists(path21.join(package_root, "src", "config", "profiles", "minimal.ini"))) {
21735
22025
  fail(`Invalid --package path (missing src/config/profiles/minimal.ini): ${package_root}`);
21736
22026
  }
21737
22027
  package_type = detect_package_type_for_project(project_root, package_root);
@@ -21740,14 +22030,14 @@ function _main_project_install(opts, project_root, parsed_tools, is_first_run) {
21740
22030
  package_type = detect_package_type(package_root);
21741
22031
  }
21742
22032
  if (!state.QUIET) {
21743
- process3.stdout.write("\n");
22033
+ process4.stdout.write("\n");
21744
22034
  info("Agent Config \u2014 Project Bridge Installer");
21745
22035
  info(`Project: ${project_root}`);
21746
22036
  info(`Package: ${package_root}`);
21747
22037
  info(`Type: ${package_type}`);
21748
22038
  info(`Profile: ${opts.profile}`);
21749
22039
  if (opts.user_type) info(`UserType: ${opts.user_type}`);
21750
- process3.stdout.write("\n");
22040
+ process4.stdout.write("\n");
21751
22041
  }
21752
22042
  ensure_agent_settings(project_root, package_root, opts.profile, opts.force, opts.user_type, opts.packs ?? null);
21753
22043
  _write_install_mode_marker(project_root, "full");
@@ -21759,11 +22049,9 @@ function _main_project_install(opts, project_root, parsed_tools, is_first_run) {
21759
22049
  ...ensure_augment_bridge(project_root, opts.force)
21760
22050
  ];
21761
22051
  if (_is_tool_enabled(tools, "claude-code")) {
21762
- merged_keys_by_tool["claude-code"] = [
21763
- ...ensure_claude_bridge(project_root, opts.force),
21764
- ...ensure_mcp_bridge(project_root, opts.force)
21765
- ];
22052
+ merged_keys_by_tool["claude-code"] = ensure_claude_bridge(project_root, opts.force);
21766
22053
  }
22054
+ registerMcpHosts(merge_json_file, project_root, opts.force, package_root, tools, merged_keys_by_tool);
21767
22055
  if (_is_tool_enabled(tools, "cursor")) {
21768
22056
  merged_keys_by_tool["cursor"] = ensure_cursor_bridge(project_root, opts.force);
21769
22057
  }
@@ -21813,7 +22101,7 @@ function _main_project_install(opts, project_root, parsed_tools, is_first_run) {
21813
22101
  }
21814
22102
  if (!opts.skip_bridges && !opts.no_smoke) {
21815
22103
  if (!state.QUIET) {
21816
- process3.stdout.write("\n");
22104
+ process4.stdout.write("\n");
21817
22105
  info("Smoke-testing installed hook bridges (dry-run)");
21818
22106
  }
21819
22107
  _smoke_test_hooks(project_root, package_root);
@@ -21834,34 +22122,35 @@ function _main_project_install(opts, project_root, parsed_tools, is_first_run) {
21834
22122
  finalize_claude_model_tiers(project_root);
21835
22123
  }
21836
22124
  if (!state.QUIET) {
21837
- process3.stdout.write("\n");
22125
+ process4.stdout.write("\n");
21838
22126
  success("Done.");
21839
22127
  if (is_first_run) {
21840
- process3.stdout.write("\n");
21841
- process3.stdout.write(" Try these 3 prompts with your agent:\n");
21842
- process3.stdout.write(' 1. "Refactor this function" \u2192 agent analyzes first\n');
21843
- process3.stdout.write(' 2. "Add caching to this" \u2192 agent asks instead of guessing\n');
21844
- process3.stdout.write(' 3. "Implement this feature" \u2192 agent respects your codebase\n');
21845
- process3.stdout.write("\n");
21846
- process3.stdout.write(" Next steps:\n");
21847
- process3.stdout.write(" \u2022 Commit .agent-settings.yml and bridge files to your repo\n");
21848
- process3.stdout.write(" \u2022 New team members run `npx @event4u/agent-config init` \u2014 done\n");
21849
- process3.stdout.write(" \u2022 Inspect hook coverage: ./agent-config hooks:status\n");
21850
- process3.stdout.write(
22128
+ process4.stdout.write("\n");
22129
+ process4.stdout.write(" Try these 3 prompts with your agent:\n");
22130
+ process4.stdout.write(' 1. "Refactor this function" \u2192 agent analyzes first\n');
22131
+ process4.stdout.write(' 2. "Add caching to this" \u2192 agent asks instead of guessing\n');
22132
+ process4.stdout.write(' 3. "Implement this feature" \u2192 agent respects your codebase\n');
22133
+ process4.stdout.write("\n");
22134
+ process4.stdout.write(" Next steps:\n");
22135
+ process4.stdout.write(" \u2022 Commit .agent-settings.yml and bridge files to your repo\n");
22136
+ process4.stdout.write(" \u2022 New team members run `npx @event4u/agent-config init` \u2014 done\n");
22137
+ process4.stdout.write(" \u2022 Inspect hook coverage: ./agent-config hooks:status\n");
22138
+ process4.stdout.write(
21851
22139
  " \u2022 Full walkthrough: https://github.com/event4u-app/agent-config/blob/main/docs/getting-started.md\n"
21852
22140
  );
21853
- process3.stdout.write("\n");
22141
+ process4.stdout.write("\n");
21854
22142
  } else {
21855
- process3.stdout.write(
22143
+ process4.stdout.write(
21856
22144
  " Re-run complete. Walkthrough: https://github.com/event4u-app/agent-config/blob/main/docs/getting-started.md\n"
21857
22145
  );
21858
- process3.stdout.write("\n");
22146
+ process4.stdout.write("\n");
21859
22147
  }
22148
+ printResiduals(tools, state.QUIET);
21860
22149
  if (_is_tool_enabled(tools, "claude-code")) {
21861
22150
  const team_hint = _team_setup_hint_line(project_root);
21862
22151
  if (team_hint !== null) {
21863
- process3.stdout.write(team_hint + "\n");
21864
- process3.stdout.write("\n");
22152
+ process4.stdout.write(team_hint + "\n");
22153
+ process4.stdout.write("\n");
21865
22154
  }
21866
22155
  }
21867
22156
  }
@@ -21873,21 +22162,21 @@ function _main_project_install(opts, project_root, parsed_tools, is_first_run) {
21873
22162
  return 0;
21874
22163
  }
21875
22164
  function _resolvedArgv1() {
21876
- if (process3.argv[1] === void 0) return void 0;
22165
+ if (process4.argv[1] === void 0) return void 0;
21877
22166
  try {
21878
- return fs23.realpathSync(path20.resolve(process3.argv[1]));
22167
+ return fs24.realpathSync(path21.resolve(process4.argv[1]));
21879
22168
  } catch {
21880
- return path20.resolve(process3.argv[1]);
22169
+ return path21.resolve(process4.argv[1]);
21881
22170
  }
21882
22171
  }
21883
22172
  var _argv1 = _resolvedArgv1();
21884
22173
  var _isCliEntry2 = _argv1 !== void 0 && import.meta.url === pathToFileURL2(_argv1).href;
21885
22174
  if (_isCliEntry2 || _argv1 === _HERE2) {
21886
22175
  try {
21887
- process3.exitCode = main2(process3.argv.slice(2));
22176
+ process4.exitCode = main2(process4.argv.slice(2));
21888
22177
  } catch (e) {
21889
22178
  if (e instanceof SystemExitError || e instanceof ArgparseExit2) {
21890
- process3.exitCode = e.code;
22179
+ process4.exitCode = e.code;
21891
22180
  } else {
21892
22181
  throw e;
21893
22182
  }
@@ -21897,12 +22186,9 @@ export {
21897
22186
  AIDER_MARKER,
21898
22187
  ArgparseExit2 as ArgparseExit,
21899
22188
  CLAUDE_DESKTOP_MARKER,
21900
- CLINE_DISPATCHER_BINDINGS,
21901
22189
  CODEX_MARKER,
21902
22190
  CONTINUE_MARKER,
21903
- CURSOR_DISPATCHER_BINDINGS,
21904
22191
  DEFAULT_PROFILE,
21905
- GEMINI_DISPATCHER_BINDINGS,
21906
22192
  GLOBAL_AGENT_SETTINGS_PATH,
21907
22193
  GLOBAL_USER_SETTINGS_PATH,
21908
22194
  JETBRAINS_MARKER,
@@ -21915,7 +22201,6 @@ export {
21915
22201
  SUPPORTED_PROFILES,
21916
22202
  SystemExitError,
21917
22203
  USER_SCOPE_PATHS,
21918
- WINDSURF_DISPATCHER_BINDINGS,
21919
22204
  ZED_MARKER,
21920
22205
  _VALID_TOOLS,
21921
22206
  _append_unknown_legacy,
@@ -21980,5 +22265,6 @@ export {
21980
22265
  jsonDumpsIndent,
21981
22266
  main2 as main,
21982
22267
  parse_options,
22268
+ smokeProbeEvents,
21983
22269
  state
21984
22270
  };