@event4u/agent-config 9.13.0 → 9.15.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 (280) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/CHANGELOG.md +113 -67
  3. package/README.md +9 -1
  4. package/dist/agent-src/commands/agents/audit.md +7 -7
  5. package/dist/agent-src/commands/agents/optimize.md +1 -1
  6. package/dist/agent-src/commands/analyze/reference-repo.md +1 -1
  7. package/dist/agent-src/commands/chat-history.md +1 -0
  8. package/dist/agent-src/commands/context.md +1 -0
  9. package/dist/agent-src/commands/council.md +1 -1
  10. package/dist/agent-src/commands/ghostwriter.md +1 -1
  11. package/dist/agent-src/commands/memory.md +2 -1
  12. package/dist/agent-src/commands/module.md +1 -0
  13. package/dist/agent-src/commands/optimize/agents-dir.md +1 -1
  14. package/dist/agent-src/commands/optimize/deep.md +150 -0
  15. package/dist/agent-src/commands/optimize/skills.md +5 -5
  16. package/dist/agent-src/commands/optimize.md +12 -6
  17. package/dist/agent-src/commands/override.md +1 -0
  18. package/dist/agent-src/commands/prediction-pool.md +4 -4
  19. package/dist/agent-src/commands/research/deep.md +1 -1
  20. package/dist/agent-src/commands/roadmap.md +2 -1
  21. package/dist/agent-src/commands/rule-compliance-audit.md +1 -1
  22. package/dist/agent-src/commands/tdd.md +1 -0
  23. package/dist/agent-src/commands/tests.md +1 -0
  24. package/dist/agent-src/commands/upstream-contribute.md +5 -5
  25. package/dist/agent-src/commands/video/from-script.md +1 -1
  26. package/dist/agent-src/commands/video/from-song.md +1 -1
  27. package/dist/agent-src/commands/video/scene.md +1 -1
  28. package/dist/agent-src/commands/video/stitch.md +1 -1
  29. package/dist/agent-src/commands/video/storyboard.md +1 -1
  30. package/dist/agent-src/commands/worktree/create.md +2 -1
  31. package/dist/agent-src/contexts/augment-infrastructure.md +1 -1
  32. package/dist/agent-src/contexts/contracts/artifact-engagement-flow.md +5 -5
  33. package/dist/agent-src/contexts/contracts/command-suggestion-flow.md +3 -3
  34. package/dist/agent-src/contexts/contracts/emergency-triage-block.md +2 -2
  35. package/dist/agent-src/contexts/execution/roadmap-process-loop.md +4 -3
  36. package/dist/agent-src/contexts/execution/subagent-routing.md +19 -0
  37. package/dist/agent-src/contexts/override-system.md +1 -1
  38. package/dist/agent-src/ghostwriter/fictional-fixture-v1.md +1 -1
  39. package/dist/agent-src/rules/augment-edit-discipline.md +1 -1
  40. package/dist/agent-src/rules/autonomous-execution.md +2 -1
  41. package/dist/agent-src/rules/brand-consistency.md +1 -0
  42. package/dist/agent-src/rules/brand-source-of-truth.md +1 -0
  43. package/dist/agent-src/rules/code-comment-discipline.md +2 -0
  44. package/dist/agent-src/rules/communication-through-line.md +1 -0
  45. package/dist/agent-src/rules/content-quoting-floor.md +1 -0
  46. package/dist/agent-src/rules/cross-source-consistency.md +0 -1
  47. package/dist/agent-src/rules/downstream-changes.md +1 -0
  48. package/dist/agent-src/rules/external-code-graph-interop.md +1 -0
  49. package/dist/agent-src/rules/external-reference-deep-dive.md +1 -0
  50. package/dist/agent-src/rules/fast-path-marker-visibility.md +1 -0
  51. package/dist/agent-src/rules/finance-safety-floor.md +0 -1
  52. package/dist/agent-src/rules/icon-consistency.md +1 -0
  53. package/dist/agent-src/rules/image-likeness-and-rights.md +1 -0
  54. package/dist/agent-src/rules/improve-before-implement.md +1 -1
  55. package/dist/agent-src/rules/invite-challenge.md +1 -0
  56. package/dist/agent-src/rules/lethal-trifecta-guard.md +1 -0
  57. package/dist/agent-src/rules/low-impact-corpus-privacy-floor.md +1 -0
  58. package/dist/agent-src/rules/markdown-safe-codeblocks.md +1 -0
  59. package/dist/agent-src/rules/media-governance-routing.md +4 -3
  60. package/dist/agent-src/rules/media-sync-ground-truth.md +1 -0
  61. package/dist/agent-src/rules/no-attribution-footers.md +1 -0
  62. package/dist/agent-src/rules/no-decorative-emojis-in-git-surfaces.md +1 -0
  63. package/dist/agent-src/rules/no-pr-progress-comments.md +1 -0
  64. package/dist/agent-src/rules/onboarding-gate.md +1 -0
  65. package/dist/agent-src/rules/output-discipline.md +1 -0
  66. package/dist/agent-src/rules/prefer-enums-over-literals.md +1 -0
  67. package/dist/agent-src/rules/preservation-guard.md +1 -0
  68. package/dist/agent-src/rules/question-not-instruction.md +1 -0
  69. package/dist/agent-src/rules/roadmap-ci-steps-policy.md +1 -0
  70. package/dist/agent-src/rules/role-mode-adherence.md +1 -0
  71. package/dist/agent-src/rules/runtime-safety.md +1 -0
  72. package/dist/agent-src/rules/security-sensitive-stop.md +1 -0
  73. package/dist/agent-src/rules/session-canary.md +9 -2
  74. package/dist/agent-src/rules/source-confidentiality.md +1 -0
  75. package/dist/agent-src/rules/source-of-truth.md +1 -0
  76. package/dist/agent-src/rules/spreadsheet-source-quality.md +1 -0
  77. package/dist/agent-src/rules/think-before-action.md +1 -0
  78. package/dist/agent-src/rules/token-budget-discipline.md +1 -0
  79. package/dist/agent-src/rules/token-efficiency.md +1 -0
  80. package/dist/agent-src/rules/token-optimizer-maintenance.md +5 -5
  81. package/dist/agent-src/rules/tool-safety.md +1 -0
  82. package/dist/agent-src/rules/untrusted-input-defense.md +2 -0
  83. package/dist/agent-src/rules/user-interaction.md +1 -0
  84. package/dist/agent-src/rules/user-interrupt-priority.md +1 -0
  85. package/dist/agent-src/skills/adr-create/SKILL.md +1 -1
  86. package/dist/agent-src/skills/check-refs/SKILL.md +1 -1
  87. package/dist/agent-src/skills/competitive-positioning/SKILL.md +1 -1
  88. package/dist/agent-src/skills/condense-memory/SKILL.md +1 -1
  89. package/dist/agent-src/skills/context-authoring/SKILL.md +1 -1
  90. package/dist/agent-src/skills/copilot-agents-optimization/SKILL.md +1 -1
  91. package/dist/agent-src/skills/description-assist/SKILL.md +1 -1
  92. package/dist/agent-src/skills/github-ci/SKILL.md +1 -0
  93. package/dist/agent-src/skills/guideline-writing/SKILL.md +1 -1
  94. package/dist/agent-src/skills/lint-skills/SKILL.md +1 -1
  95. package/dist/agent-src/skills/readme-reviewer/SKILL.md +1 -1
  96. package/dist/agent-src/skills/roadmap-management/SKILL.md +8 -1
  97. package/dist/agent-src/skills/roadmap-writing/SKILL.md +1 -1
  98. package/dist/agent-src/skills/skill-improvement-pipeline/SKILL.md +1 -1
  99. package/dist/agent-src/skills/skill-writing/SKILL.md +4 -4
  100. package/dist/agent-src/skills/token-optimizer/SKILL.md +4 -4
  101. package/dist/agent-src/skills/upstream-contribute/SKILL.md +6 -6
  102. package/dist/agent-src/skills/using-git-worktrees/SKILL.md +25 -0
  103. package/dist/agent-src/templates/AGENTS.md +1 -1
  104. package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
  105. package/dist/agent-src/templates/command.md +1 -1
  106. package/dist/agent-src/templates/copilot-instructions.md +3 -3
  107. package/dist/agent-src/templates/rule.md +2 -2
  108. package/dist/agent-src/templates/scripts/work_engine/orchestration.ts +1 -1
  109. package/dist/agent-src/templates/skill-archive-note.md +5 -5
  110. package/dist/agent-src/templates/skill.md +1 -1
  111. package/dist/cli/agent-config.js +66 -19
  112. package/dist/cli/agent-config.js.map +1 -1
  113. package/dist/cli/main.js +9 -4
  114. package/dist/cli/main.js.map +1 -1
  115. package/dist/cli/python/workspace_drive.js +2 -0
  116. package/dist/cli/python/workspace_drive.js.map +1 -1
  117. package/dist/cli/python/workspace_drive_health.js +2 -0
  118. package/dist/cli/python/workspace_drive_health.js.map +1 -1
  119. package/dist/cli/python/workspace_hosts.js +2 -0
  120. package/dist/cli/python/workspace_hosts.js.map +1 -1
  121. package/dist/cli/python/workspace_sessions.js +2 -0
  122. package/dist/cli/python/workspace_sessions.js.map +1 -1
  123. package/dist/cli/registry.js +1 -0
  124. package/dist/cli/registry.js.map +1 -1
  125. package/dist/cli-delegate/{chunk-A3HJ6NTI.js → chunk-63WSP6YZ.js} +2 -1
  126. package/dist/cli-delegate/{chunk-EJYIGZ3T.js → chunk-BKO2AZ7Z.js} +1 -1
  127. package/dist/cli-delegate/{chunk-QFKQLQ7X.js → chunk-H574KOUH.js} +340 -462
  128. package/dist/cli-delegate/chunk-NXFWFAYV.js +339 -0
  129. package/dist/cli-delegate/{chunk-TEGJU2JX.js → chunk-ZXXJLL5K.js} +2 -2
  130. package/dist/cli-delegate/cmd_conformance.js +29 -23
  131. package/dist/cli-delegate/cmd_doctor.js +3 -3
  132. package/dist/cli-delegate/cmd_export.js +4 -4
  133. package/dist/cli-delegate/cmd_preflight.js +2 -2
  134. package/dist/cli-delegate/cmd_prune.js +4 -4
  135. package/dist/cli-delegate/cmd_settings_migrate.js +4 -4
  136. package/dist/cli-delegate/cmd_sync.js +4 -4
  137. package/dist/cli-delegate/cmd_uninstall.js +4 -4
  138. package/dist/cli-delegate/cmd_validate.js +4 -4
  139. package/dist/discovery/deprecation-report.md +1 -1
  140. package/dist/discovery/discovery-manifest.json +163 -103
  141. package/dist/discovery/discovery-manifest.json.sha256 +1 -1
  142. package/dist/discovery/discovery-manifest.summary.md +3 -3
  143. package/dist/discovery/orphan-report.md +1 -1
  144. package/dist/discovery/packs.json +6 -5
  145. package/dist/discovery/trust-report.md +3 -3
  146. package/dist/discovery/workspaces.json +5 -4
  147. package/dist/hooks/dispatch.js +729 -430
  148. package/dist/install/install.mjs +700 -625
  149. package/dist/install/rule_scope.js +18 -2
  150. package/dist/install/rule_scope.js.map +1 -1
  151. package/dist/mcp/registry-manifest.json +3 -3
  152. package/dist/mcp/server.json +2 -2
  153. package/dist/mcp/server.mjs +564 -424
  154. package/dist/router.json +1 -1
  155. package/dist/scripts/_lib/claude_settings_hooks.js +30 -5
  156. package/dist/scripts/_lib/claude_settings_hooks.js.map +1 -1
  157. package/dist/scripts/_lib/scoped_projection.js +223 -0
  158. package/dist/scripts/_lib/scoped_projection.js.map +1 -0
  159. package/dist/scripts/_lib/surface_tiers.js +125 -0
  160. package/dist/scripts/_lib/surface_tiers.js.map +1 -0
  161. package/dist/scripts/_lib/token_count.js +166 -0
  162. package/dist/scripts/_lib/token_count.js.map +1 -0
  163. package/dist/scripts/_lib/trigger_eval_floors.js +8 -0
  164. package/dist/scripts/_lib/trigger_eval_floors.js.map +1 -1
  165. package/dist/scripts/condense.js +139 -9
  166. package/dist/scripts/condense.js.map +1 -1
  167. package/dist/scripts/project_thin_rules.js +450 -0
  168. package/dist/scripts/project_thin_rules.js.map +1 -0
  169. package/dist/server/routes/workspace.js +2 -0
  170. package/dist/server/routes/workspace.js.map +1 -1
  171. package/dist/server/schemas/settings.js +9 -3
  172. package/dist/server/schemas/settings.js.map +1 -1
  173. package/dist/ui/assets/index-DJY_vQVn.js +40 -0
  174. package/dist/ui/assets/index-DJY_vQVn.js.map +1 -0
  175. package/dist/ui/index.html +1 -1
  176. package/docs/guidelines/agent-infra/roadmap-progress-mechanics.md +1 -1
  177. package/package.json +11 -11
  178. package/src/agent-src/templates/AGENTS.md +1 -1
  179. package/src/agent-src/templates/scripts/work_engine/orchestration.ts +1 -1
  180. package/src/config/agent-settings.template.yml +59 -11
  181. package/src/config/ci-local-parity.yml +8 -0
  182. package/src/config/discovery/unassigned-artefacts.yml +23 -25
  183. package/src/config/evaluator-budgets.json +35 -5
  184. package/src/config/gate-coverage.yml +147 -0
  185. package/src/config/gate-violation-baselines.json +25 -0
  186. package/src/install/rule_scope.ts +27 -2
  187. package/src/scripts/_cli/cmd_conformance.ts +13 -24
  188. package/src/scripts/_dispatch.bash +10 -0
  189. package/src/scripts/_lib/claude_settings_hooks.ts +30 -4
  190. package/src/scripts/_lib/exec_evidence.ts +5 -0
  191. package/src/scripts/_lib/gate_baseline.ts +213 -0
  192. package/src/scripts/_lib/scoped_projection.ts +262 -0
  193. package/src/scripts/_lib/tier_budget_routing.ts +234 -0
  194. package/src/scripts/_lib/tool_adapter_registry.ts +8 -1
  195. package/src/scripts/_lib/trigger_eval_floors.ts +9 -0
  196. package/src/scripts/_lib/trigger_routers.ts +17 -5
  197. package/src/scripts/adr/regenerate_index.ts +4 -3
  198. package/src/scripts/ai-video/lib/parse-blueprint.sh +1 -1
  199. package/src/scripts/ai_council/compile_corpus.ts +1 -1
  200. package/src/scripts/audit_cloud_compatibility.ts +37 -2
  201. package/src/scripts/audit_initial_context.ts +53 -19
  202. package/src/scripts/audit_likelihood.ts +31 -2
  203. package/src/scripts/audit_user_type_axis.ts +58 -11
  204. package/src/scripts/bench_hook_latency.ts +172 -41
  205. package/src/scripts/build_mcp_catalog.ts +12 -1
  206. package/src/scripts/check_always_budget.ts +122 -11
  207. package/src/scripts/check_artefact_count_messaging.ts +128 -15
  208. package/src/scripts/check_augment_description_cap.ts +24 -3
  209. package/src/scripts/check_ci_strict_superset.ts +150 -0
  210. package/src/scripts/check_cluster_patterns.ts +100 -0
  211. package/src/scripts/check_consumer_scope_flip.ts +26 -4
  212. package/src/scripts/check_evaluator_budgets.ts +198 -19
  213. package/src/scripts/check_gate_coverage.ts +337 -1
  214. package/src/scripts/check_generator_output_coverage.ts +2 -1
  215. package/src/scripts/check_iron_law_prominence.ts +1 -1
  216. package/src/scripts/check_kernel_rule_bundle.ts +1 -1
  217. package/src/scripts/check_no_new_legacy_path.ts +167 -3
  218. package/src/scripts/check_pack_size.ts +18 -4
  219. package/src/scripts/check_portability.ts +37 -7
  220. package/src/scripts/check_references.ts +19 -3
  221. package/src/scripts/check_release_pr_shape.ts +13 -0
  222. package/src/scripts/check_token_regression.ts +9 -2
  223. package/src/scripts/condense.ts +155 -12
  224. package/src/scripts/cost/budget.mjs +63 -2
  225. package/src/scripts/count_scoped_projection.ts +104 -0
  226. package/src/scripts/evaluator_umbrella.sh +34 -1
  227. package/src/scripts/generate_capability_matrix.ts +8 -0
  228. package/src/scripts/generate_router_coverage_from_matrix.ts +155 -0
  229. package/src/scripts/hook_manifest.yaml +17 -3
  230. package/src/scripts/hooks/block_config_weakening.ts +337 -0
  231. package/src/scripts/hooks/concern_registry.ts +2 -0
  232. package/src/scripts/hooks/probe_throttle.ts +75 -0
  233. package/src/scripts/install-hooks.sh +24 -2
  234. package/src/scripts/install.ts +15 -92
  235. package/src/scripts/lint_agents_md.ts +9 -3
  236. package/src/scripts/lint_archived_skills.ts +1 -1
  237. package/src/scripts/lint_artefact_frontmatter.ts +185 -37
  238. package/src/scripts/lint_command_routing.ts +21 -52
  239. package/src/scripts/lint_command_verbs.ts +47 -28
  240. package/src/scripts/lint_context_spine_usage.ts +38 -12
  241. package/src/scripts/lint_framework_leakage.ts +25 -6
  242. package/src/scripts/lint_handoffs.ts +49 -2
  243. package/src/scripts/lint_media_policy_linkage.ts +62 -30
  244. package/src/scripts/lint_namespace.ts +92 -7
  245. package/src/scripts/lint_new_skill_gate.ts +39 -31
  246. package/src/scripts/lint_originality_shingles.ts +7 -1
  247. package/src/scripts/lint_override_kernel_guard.ts +21 -3
  248. package/src/scripts/lint_pack_boundaries.ts +461 -91
  249. package/src/scripts/lint_pack_dependencies.ts +24 -57
  250. package/src/scripts/lint_persona_governance.ts +1 -1
  251. package/src/scripts/lint_role_experiences.ts +34 -5
  252. package/src/scripts/lint_trigger_precision.ts +142 -0
  253. package/src/scripts/mcp_server/consumer_tool_catalog.json +12 -201
  254. package/src/scripts/mcp_server/tools.ts +1 -1
  255. package/src/scripts/prepack-check.mjs +40 -1
  256. package/src/scripts/prepack_router_targets.d.mts +7 -0
  257. package/src/scripts/prepack_router_targets.mjs +93 -0
  258. package/src/scripts/print_required_checks.ts +72 -18
  259. package/src/scripts/profile_staleness_hook.ts +12 -0
  260. package/src/scripts/record_evaluator_measurements.mjs +105 -0
  261. package/src/scripts/recruit_preflight.sh +1 -1
  262. package/src/scripts/release.ts +105 -1
  263. package/src/scripts/router_target_paths.d.mts +4 -0
  264. package/src/scripts/router_target_paths.mjs +69 -0
  265. package/src/scripts/router_telemetry.ts +52 -1
  266. package/src/scripts/routing_doctor.ts +485 -0
  267. package/src/scripts/rule_trigger_eval.ts +403 -0
  268. package/src/scripts/schemas/rule.schema.json +5 -1
  269. package/src/scripts/session_canary_hook.ts +96 -5
  270. package/src/scripts/skill_linter.ts +90 -42
  271. package/src/scripts/smoke/skills.sh +1 -1
  272. package/src/scripts/sweep_dead_scan_roots.ts +356 -10
  273. package/src/scripts/trigger_coverage.ts +13 -2
  274. package/src/scripts/update_counts.ts +91 -12
  275. package/src/scripts/validate_telegraph_carveouts.ts +1 -1
  276. package/src/scripts/wrapper_freshness_hook.ts +14 -0
  277. package/src/server/schemas/settings.ts +19 -5
  278. package/dist/cli-delegate/chunk-TJIAM5FW.js +0 -133
  279. package/dist/ui/assets/index-BpSQt5vm.js +0 -40
  280. package/dist/ui/assets/index-BpSQt5vm.js.map +0 -1
@@ -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, path15) {
121
- const ctrl = callVisitor(key, node, visitor, path15);
120
+ function visit_(key, node, visitor, path16) {
121
+ const ctrl = callVisitor(key, node, visitor, path16);
122
122
  if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
123
- replaceNode(key, path15, ctrl);
124
- return visit_(key, ctrl, visitor, path15);
123
+ replaceNode(key, path16, ctrl);
124
+ return visit_(key, ctrl, visitor, path16);
125
125
  }
126
126
  if (typeof ctrl !== "symbol") {
127
127
  if (identity.isCollection(node)) {
128
- path15 = Object.freeze(path15.concat(node));
128
+ path16 = Object.freeze(path16.concat(node));
129
129
  for (let i = 0; i < node.items.length; ++i) {
130
- const ci = visit_(i, node.items[i], visitor, path15);
130
+ const ci = visit_(i, node.items[i], visitor, path16);
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
- path15 = Object.freeze(path15.concat(node));
142
- const ck = visit_("key", node.key, visitor, path15);
141
+ path16 = Object.freeze(path16.concat(node));
142
+ const ck = visit_("key", node.key, visitor, path16);
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, path15);
147
+ const cv = visit_("value", node.value, visitor, path16);
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, path15) {
169
- const ctrl = await callVisitor(key, node, visitor, path15);
168
+ async function visitAsync_(key, node, visitor, path16) {
169
+ const ctrl = await callVisitor(key, node, visitor, path16);
170
170
  if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
171
- replaceNode(key, path15, ctrl);
172
- return visitAsync_(key, ctrl, visitor, path15);
171
+ replaceNode(key, path16, ctrl);
172
+ return visitAsync_(key, ctrl, visitor, path16);
173
173
  }
174
174
  if (typeof ctrl !== "symbol") {
175
175
  if (identity.isCollection(node)) {
176
- path15 = Object.freeze(path15.concat(node));
176
+ path16 = Object.freeze(path16.concat(node));
177
177
  for (let i = 0; i < node.items.length; ++i) {
178
- const ci = await visitAsync_(i, node.items[i], visitor, path15);
178
+ const ci = await visitAsync_(i, node.items[i], visitor, path16);
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
- path15 = Object.freeze(path15.concat(node));
190
- const ck = await visitAsync_("key", node.key, visitor, path15);
189
+ path16 = Object.freeze(path16.concat(node));
190
+ const ck = await visitAsync_("key", node.key, visitor, path16);
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, path15);
195
+ const cv = await visitAsync_("value", node.value, visitor, path16);
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, path15) {
222
+ function callVisitor(key, node, visitor, path16) {
223
223
  if (typeof visitor === "function")
224
- return visitor(key, node, path15);
224
+ return visitor(key, node, path16);
225
225
  if (identity.isMap(node))
226
- return visitor.Map?.(key, node, path15);
226
+ return visitor.Map?.(key, node, path16);
227
227
  if (identity.isSeq(node))
228
- return visitor.Seq?.(key, node, path15);
228
+ return visitor.Seq?.(key, node, path16);
229
229
  if (identity.isPair(node))
230
- return visitor.Pair?.(key, node, path15);
230
+ return visitor.Pair?.(key, node, path16);
231
231
  if (identity.isScalar(node))
232
- return visitor.Scalar?.(key, node, path15);
232
+ return visitor.Scalar?.(key, node, path16);
233
233
  if (identity.isAlias(node))
234
- return visitor.Alias?.(key, node, path15);
234
+ return visitor.Alias?.(key, node, path16);
235
235
  return void 0;
236
236
  }
237
- function replaceNode(key, path15, node) {
238
- const parent = path15[path15.length - 1];
237
+ function replaceNode(key, path16, node) {
238
+ const parent = path16[path16.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, path15, value) {
848
+ function collectionFromPath(schema, path16, value) {
849
849
  let v = value;
850
- for (let i = path15.length - 1; i >= 0; --i) {
851
- const k = path15[i];
850
+ for (let i = path16.length - 1; i >= 0; --i) {
851
+ const k = path16[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 = (path15) => path15 == null || typeof path15 === "object" && !!path15[Symbol.iterator]().next().done;
870
+ var isEmptyPath = (path16) => path16 == null || typeof path16 === "object" && !!path16[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(path15, value) {
901
- if (isEmptyPath(path15))
900
+ addIn(path16, value) {
901
+ if (isEmptyPath(path16))
902
902
  this.add(value);
903
903
  else {
904
- const [key, ...rest] = path15;
904
+ const [key, ...rest] = path16;
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(path15) {
919
- const [key, ...rest] = path15;
918
+ deleteIn(path16) {
919
+ const [key, ...rest] = path16;
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(path15, keepScalar) {
934
- const [key, ...rest] = path15;
933
+ getIn(path16, keepScalar) {
934
+ const [key, ...rest] = path16;
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(path15) {
953
- const [key, ...rest] = path15;
952
+ hasIn(path16) {
953
+ const [key, ...rest] = path16;
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(path15, value) {
964
- const [key, ...rest] = path15;
963
+ setIn(path16, value) {
964
+ const [key, ...rest] = path16;
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(path15, value) {
3479
+ addIn(path16, value) {
3480
3480
  if (assertCollection(this.contents))
3481
- this.contents.addIn(path15, value);
3481
+ this.contents.addIn(path16, 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(path15) {
3557
- if (Collection.isEmptyPath(path15)) {
3556
+ deleteIn(path16) {
3557
+ if (Collection.isEmptyPath(path16)) {
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(path15) : false;
3563
+ return assertCollection(this.contents) ? this.contents.deleteIn(path16) : 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(path15, keepScalar) {
3579
- if (Collection.isEmptyPath(path15))
3578
+ getIn(path16, keepScalar) {
3579
+ if (Collection.isEmptyPath(path16))
3580
3580
  return !keepScalar && identity.isScalar(this.contents) ? this.contents.value : this.contents;
3581
- return identity.isCollection(this.contents) ? this.contents.getIn(path15, keepScalar) : void 0;
3581
+ return identity.isCollection(this.contents) ? this.contents.getIn(path16, 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(path15) {
3593
- if (Collection.isEmptyPath(path15))
3592
+ hasIn(path16) {
3593
+ if (Collection.isEmptyPath(path16))
3594
3594
  return this.contents !== void 0;
3595
- return identity.isCollection(this.contents) ? this.contents.hasIn(path15) : false;
3595
+ return identity.isCollection(this.contents) ? this.contents.hasIn(path16) : 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(path15, value) {
3613
- if (Collection.isEmptyPath(path15)) {
3612
+ setIn(path16, value) {
3613
+ if (Collection.isEmptyPath(path16)) {
3614
3614
  this.contents = value;
3615
3615
  } else if (this.contents == null) {
3616
- this.contents = Collection.collectionFromPath(this.schema, Array.from(path15), value);
3616
+ this.contents = Collection.collectionFromPath(this.schema, Array.from(path16), value);
3617
3617
  } else if (assertCollection(this.contents)) {
3618
- this.contents.setIn(path15, value);
3618
+ this.contents.setIn(path16, 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, path15) => {
5578
+ visit.itemAtPath = (cst, path16) => {
5579
5579
  let item = cst;
5580
- for (const [field, index] of path15) {
5580
+ for (const [field, index] of path16) {
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, path15) => {
5590
- const parent = visit.itemAtPath(cst, path15.slice(0, -1));
5591
- const field = path15[path15.length - 1][0];
5589
+ visit.parentCollection = (cst, path16) => {
5590
+ const parent = visit.itemAtPath(cst, path16.slice(0, -1));
5591
+ const field = path16[path16.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(path15, item, visitor) {
5598
- let ctrl = visitor(item, path15);
5597
+ function _visit(path16, item, visitor) {
5598
+ let ctrl = visitor(item, path16);
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(path15.concat([[field, i]])), token.items[i], visitor);
5605
+ const ci = _visit(Object.freeze(path16.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, path15);
5616
+ ctrl = ctrl(item, path16);
5617
5617
  }
5618
5618
  }
5619
- return typeof ctrl === "function" ? ctrl(item, path15) : ctrl;
5619
+ return typeof ctrl === "function" ? ctrl(item, path16) : 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 fs17 = this.flowScalar(this.type);
6921
+ const fs18 = this.flowScalar(this.type);
6922
6922
  if (atNextItem || it.value) {
6923
- map.items.push({ start, key: fs17, sep: [] });
6923
+ map.items.push({ start, key: fs18, sep: [] });
6924
6924
  this.onKeyLine = true;
6925
6925
  } else if (it.sep) {
6926
- this.stack.push(fs17);
6926
+ this.stack.push(fs18);
6927
6927
  } else {
6928
- Object.assign(it, { key: fs17, sep: [] });
6928
+ Object.assign(it, { key: fs18, 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 fs17 = this.flowScalar(this.type);
7056
+ const fs18 = this.flowScalar(this.type);
7057
7057
  if (!it || it.value)
7058
- fc.items.push({ start: [], key: fs17, sep: [] });
7058
+ fc.items.push({ start: [], key: fs18, sep: [] });
7059
7059
  else if (it.sep)
7060
- this.stack.push(fs17);
7060
+ this.stack.push(fs18);
7061
7061
  else
7062
- Object.assign(it, { key: fs17, sep: [] });
7062
+ Object.assign(it, { key: fs18, sep: [] });
7063
7063
  return;
7064
7064
  }
7065
7065
  case "flow-map-end":
@@ -7370,9 +7370,9 @@ var require_dist = __commonJS({
7370
7370
  // src/scripts/install.ts
7371
7371
  import { spawn, spawnSync as spawnSync2 } from "node:child_process";
7372
7372
  import * as crypto3 from "node:crypto";
7373
- import * as fs16 from "node:fs";
7373
+ import * as fs17 from "node:fs";
7374
7374
  import * as os7 from "node:os";
7375
- import * as path14 from "node:path";
7375
+ import * as path15 from "node:path";
7376
7376
  import process3 from "node:process";
7377
7377
  import { fileURLToPath as fileURLToPath4, pathToFileURL as pathToFileURL2 } from "node:url";
7378
7378
 
@@ -7872,8 +7872,8 @@ function lockfile_write_path(env) {
7872
7872
  }
7873
7873
  return write_target("installed.lock", { env: env ?? null });
7874
7874
  }
7875
- function read_lockfile(path15) {
7876
- const target = path15 ?? lockfile_path();
7875
+ function read_lockfile(path16) {
7876
+ const target = path16 ?? lockfile_path();
7877
7877
  let text;
7878
7878
  try {
7879
7879
  text = fs2.readFileSync(target, { encoding: "utf-8" });
@@ -8108,6 +8108,11 @@ function current_package_version(repo_root) {
8108
8108
  return _find_package_version_upward(here) ?? "0.0.0";
8109
8109
  }
8110
8110
 
8111
+ // src/scripts/_lib/scoped_projection.ts
8112
+ import * as fs4 from "node:fs";
8113
+ import { createRequire } from "node:module";
8114
+ import * as path4 from "node:path";
8115
+
8111
8116
  // src/scripts/_lib/surface_tiers.ts
8112
8117
  import * as fs3 from "node:fs";
8113
8118
  import * as path3 from "node:path";
@@ -8198,11 +8203,108 @@ function _strip_quotes(s) {
8198
8203
  return out;
8199
8204
  }
8200
8205
 
8206
+ // src/scripts/_lib/scoped_projection.ts
8207
+ var _require = createRequire(import.meta.url);
8208
+ var SCOPED_ACTIVE_WORKSPACES = /* @__PURE__ */ new Set([
8209
+ "engineering",
8210
+ "agent-config-maintainer"
8211
+ ]);
8212
+ function isPlainObject(v) {
8213
+ return typeof v === "object" && v !== null && !Array.isArray(v);
8214
+ }
8215
+ function yamlSafeLoad(text) {
8216
+ let YAML3;
8217
+ try {
8218
+ YAML3 = _require("yaml");
8219
+ } catch {
8220
+ return null;
8221
+ }
8222
+ try {
8223
+ return YAML3.parse(text, { version: "1.1" }) ?? null;
8224
+ } catch {
8225
+ return null;
8226
+ }
8227
+ }
8228
+ var PACKS_YML_REL = path4.join("src", "config", "discovery", "packs.yml");
8229
+ function load_packs_registry(package_root) {
8230
+ const vocab_path = path4.join(package_root, PACKS_YML_REL);
8231
+ const data = yamlSafeLoad(fs4.readFileSync(vocab_path, "utf-8"));
8232
+ if (!Array.isArray(data)) {
8233
+ throw new Error(`packs.yml did not parse to a list: ${vocab_path}`);
8234
+ }
8235
+ const out = [];
8236
+ for (const entry of data) {
8237
+ if (!isPlainObject(entry)) continue;
8238
+ const id = entry["id"];
8239
+ if (typeof id !== "string" || id === "") continue;
8240
+ const workspaces_raw = entry["workspaces"];
8241
+ const workspaces = Array.isArray(workspaces_raw) ? workspaces_raw.filter((w) => typeof w === "string") : [];
8242
+ const requires_raw = entry["requires"] ?? entry["requires_hint"];
8243
+ const requires = Array.isArray(requires_raw) ? requires_raw.filter((r) => typeof r === "string") : [];
8244
+ out.push({ id, workspaces, requires });
8245
+ }
8246
+ return out;
8247
+ }
8248
+ function compute_active_pack_ids(packs, runtime_active_packs) {
8249
+ const by_id = /* @__PURE__ */ new Map();
8250
+ for (const p of packs) by_id.set(p.id, p);
8251
+ const active = /* @__PURE__ */ new Set();
8252
+ for (const p of packs) {
8253
+ if (p.workspaces.some((w) => SCOPED_ACTIVE_WORKSPACES.has(w))) {
8254
+ active.add(p.id);
8255
+ }
8256
+ }
8257
+ for (const id of runtime_active_packs) {
8258
+ active.add(id);
8259
+ }
8260
+ let frontier = [...active];
8261
+ while (frontier.length > 0) {
8262
+ const next = [];
8263
+ for (const id of frontier) {
8264
+ const rec = by_id.get(id);
8265
+ if (rec === void 0) continue;
8266
+ for (const dep of rec.requires) {
8267
+ if (!active.has(dep)) {
8268
+ active.add(dep);
8269
+ next.push(dep);
8270
+ }
8271
+ }
8272
+ }
8273
+ frontier = next;
8274
+ }
8275
+ return active;
8276
+ }
8277
+ function is_pruned_under_scoped(md_path, active_ids) {
8278
+ const packs = frontmatter_packs(md_path);
8279
+ if (packs.size === 0) return false;
8280
+ for (const id of packs) {
8281
+ if (active_ids.has(id)) return false;
8282
+ }
8283
+ return true;
8284
+ }
8285
+ var RULE_PACKS_AUTO = "auto";
8286
+ function resolve_rule_pack_scope(raw, package_root, runtime_active_packs = []) {
8287
+ const is_auto = raw === RULE_PACKS_AUTO || Array.isArray(raw) && raw.length === 1 && raw[0] === RULE_PACKS_AUTO;
8288
+ if (is_auto) {
8289
+ try {
8290
+ return [
8291
+ ...compute_active_pack_ids(load_packs_registry(package_root), runtime_active_packs)
8292
+ ].sort();
8293
+ } catch {
8294
+ return null;
8295
+ }
8296
+ }
8297
+ if (Array.isArray(raw) && raw.length > 0) {
8298
+ return raw.map((v) => String(v));
8299
+ }
8300
+ return null;
8301
+ }
8302
+
8201
8303
  // src/scripts/_lib/global_deploy_inventory.ts
8202
8304
  import { randomBytes as randomBytes2 } from "node:crypto";
8203
- import * as fs4 from "node:fs";
8305
+ import * as fs5 from "node:fs";
8204
8306
  import * as os3 from "node:os";
8205
- import * as path4 from "node:path";
8307
+ import * as path5 from "node:path";
8206
8308
  var SCHEMA_VERSION2 = 1;
8207
8309
  var INVENTORY_BASENAME = "deployed-files.json";
8208
8310
  var INVENTORY_ENV = "AGENT_CONFIG_DEPLOY_INVENTORY";
@@ -8211,22 +8313,22 @@ function expanduser3(p) {
8211
8313
  return os3.homedir();
8212
8314
  }
8213
8315
  if (p.startsWith("~/") || process.platform === "win32" && p.startsWith("~\\")) {
8214
- return path4.join(os3.homedir(), p.slice(2));
8316
+ return path5.join(os3.homedir(), p.slice(2));
8215
8317
  }
8216
8318
  return p;
8217
8319
  }
8218
8320
  function resolve_path(p) {
8219
8321
  try {
8220
- return fs4.realpathSync(p);
8322
+ return fs5.realpathSync(p);
8221
8323
  } catch {
8222
- const abs = path4.resolve(p);
8223
- const parts = abs.split(path4.sep);
8324
+ const abs = path5.resolve(p);
8325
+ const parts = abs.split(path5.sep);
8224
8326
  for (let i = parts.length; i > 0; i -= 1) {
8225
- const prefix = parts.slice(0, i).join(path4.sep) || path4.sep;
8327
+ const prefix = parts.slice(0, i).join(path5.sep) || path5.sep;
8226
8328
  try {
8227
- const real = fs4.realpathSync(prefix);
8329
+ const real = fs5.realpathSync(prefix);
8228
8330
  const rest = parts.slice(i);
8229
- return rest.length > 0 ? path4.join(real, ...rest) : real;
8331
+ return rest.length > 0 ? path5.join(real, ...rest) : real;
8230
8332
  } catch {
8231
8333
  continue;
8232
8334
  }
@@ -8236,7 +8338,7 @@ function resolve_path(p) {
8236
8338
  }
8237
8339
  function path_exists(p) {
8238
8340
  try {
8239
- fs4.statSync(p);
8341
+ fs5.statSync(p);
8240
8342
  return true;
8241
8343
  } catch {
8242
8344
  return false;
@@ -8254,7 +8356,7 @@ function load_inventory(p) {
8254
8356
  const target = p ?? inventory_path();
8255
8357
  let data;
8256
8358
  try {
8257
- data = JSON.parse(fs4.readFileSync(target, { encoding: "utf-8" }));
8359
+ data = JSON.parse(fs5.readFileSync(target, { encoding: "utf-8" }));
8258
8360
  } catch {
8259
8361
  return { schema_version: SCHEMA_VERSION2, tools: {} };
8260
8362
  }
@@ -8265,15 +8367,15 @@ function load_inventory(p) {
8265
8367
  }
8266
8368
  function save_inventory(data, p) {
8267
8369
  const target = p ?? inventory_path();
8268
- fs4.mkdirSync(path4.dirname(target), { recursive: true });
8370
+ fs5.mkdirSync(path5.dirname(target), { recursive: true });
8269
8371
  const payload = json_dumps_sorted(data, 2) + "\n";
8270
- const parent = path4.dirname(target);
8372
+ const parent = path5.dirname(target);
8271
8373
  let fd = null;
8272
8374
  let tmp_name = "";
8273
8375
  for (let attempt = 0; attempt < 32; attempt += 1) {
8274
- tmp_name = path4.join(parent, `${path4.basename(target)}.${randomBytes2(6).toString("hex")}`);
8376
+ tmp_name = path5.join(parent, `${path5.basename(target)}.${randomBytes2(6).toString("hex")}`);
8275
8377
  try {
8276
- fd = fs4.openSync(tmp_name, "wx", 384);
8378
+ fd = fs5.openSync(tmp_name, "wx", 384);
8277
8379
  break;
8278
8380
  } catch (err) {
8279
8381
  if (err.code === "EEXIST") {
@@ -8286,16 +8388,16 @@ function save_inventory(data, p) {
8286
8388
  throw new Error("save_inventory: could not create a unique temp file");
8287
8389
  }
8288
8390
  try {
8289
- fs4.writeFileSync(fd, payload, { encoding: "utf-8" });
8290
- fs4.closeSync(fd);
8291
- fs4.renameSync(tmp_name, target);
8391
+ fs5.writeFileSync(fd, payload, { encoding: "utf-8" });
8392
+ fs5.closeSync(fd);
8393
+ fs5.renameSync(tmp_name, target);
8292
8394
  } catch (err) {
8293
8395
  try {
8294
- fs4.closeSync(fd);
8396
+ fs5.closeSync(fd);
8295
8397
  } catch {
8296
8398
  }
8297
8399
  try {
8298
- fs4.unlinkSync(tmp_name);
8400
+ fs5.unlinkSync(tmp_name);
8299
8401
  } catch {
8300
8402
  }
8301
8403
  throw err;
@@ -8354,7 +8456,7 @@ function expected_deploy_files(src, dest_rel, file_filter = null) {
8354
8456
  const out = /* @__PURE__ */ new Set();
8355
8457
  let src_stat;
8356
8458
  try {
8357
- src_stat = fs4.statSync(src);
8459
+ src_stat = fs5.statSync(src);
8358
8460
  } catch {
8359
8461
  return out;
8360
8462
  }
@@ -8366,23 +8468,23 @@ function expected_deploy_files(src, dest_rel, file_filter = null) {
8366
8468
  return out;
8367
8469
  }
8368
8470
  const _walk = (node, prefix) => {
8369
- const entries = fs4.readdirSync(node).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
8471
+ const entries = fs5.readdirSync(node).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
8370
8472
  for (const name of entries) {
8371
- const entry = path4.join(node, name);
8473
+ const entry = path5.join(node, name);
8372
8474
  const rel = join_rel(prefix, name);
8373
- const lst = fs4.lstatSync(entry);
8475
+ const lst = fs5.lstatSync(entry);
8374
8476
  if (lst.isDirectory() && !lst.isSymbolicLink()) {
8375
8477
  _walk(entry, rel);
8376
8478
  continue;
8377
8479
  }
8378
8480
  let resolved_is_dir = false;
8379
8481
  try {
8380
- resolved_is_dir = fs4.statSync(entry).isDirectory();
8482
+ resolved_is_dir = fs5.statSync(entry).isDirectory();
8381
8483
  } catch {
8382
8484
  resolved_is_dir = false;
8383
8485
  }
8384
8486
  if (resolved_is_dir) {
8385
- _walk(fs4.realpathSync(entry), rel);
8487
+ _walk(fs5.realpathSync(entry), rel);
8386
8488
  continue;
8387
8489
  }
8388
8490
  if (file_filter !== null && !file_filter(entry)) {
@@ -8395,13 +8497,13 @@ function expected_deploy_files(src, dest_rel, file_filter = null) {
8395
8497
  return out;
8396
8498
  }
8397
8499
  function join_rel(prefix, name) {
8398
- return prefix ? path4.join(prefix, name) : name;
8500
+ return prefix ? path5.join(prefix, name) : name;
8399
8501
  }
8400
8502
  function as_posix(p) {
8401
8503
  if (p === "") {
8402
8504
  return ".";
8403
8505
  }
8404
- return p.split(path4.sep).join("/");
8506
+ return p.split(path5.sep).join("/");
8405
8507
  }
8406
8508
  function reap_stale(tool_id, anchor, current_files, inventory, dry_run = false) {
8407
8509
  const tools = inventory["tools"] ?? {};
@@ -8426,15 +8528,15 @@ function reap_stale(tool_id, anchor, current_files, inventory, dry_run = false)
8426
8528
  if (typeof rel !== "string" || !rel || rel.startsWith("/") || rel.startsWith("..")) {
8427
8529
  continue;
8428
8530
  }
8429
- const target = path4.join(anchor_resolved, rel);
8531
+ const target = path5.join(anchor_resolved, rel);
8430
8532
  try {
8431
- relative_to(resolve_path(path4.dirname(target)), anchor_resolved);
8533
+ relative_to(resolve_path(path5.dirname(target)), anchor_resolved);
8432
8534
  } catch {
8433
8535
  continue;
8434
8536
  }
8435
8537
  let lst = null;
8436
8538
  try {
8437
- lst = fs4.lstatSync(target);
8539
+ lst = fs5.lstatSync(target);
8438
8540
  } catch {
8439
8541
  lst = null;
8440
8542
  }
@@ -8448,12 +8550,12 @@ function reap_stale(tool_id, anchor, current_files, inventory, dry_run = false)
8448
8550
  continue;
8449
8551
  }
8450
8552
  try {
8451
- fs4.unlinkSync(target);
8553
+ fs5.unlinkSync(target);
8452
8554
  } catch {
8453
8555
  continue;
8454
8556
  }
8455
8557
  deleted.push(target);
8456
- prune_candidates.add(path4.dirname(target));
8558
+ prune_candidates.add(path5.dirname(target));
8457
8559
  }
8458
8560
  prune_empty_dirs(prune_candidates, anchor_resolved);
8459
8561
  return deleted;
@@ -8464,10 +8566,10 @@ function reap_tagged_orphans(anchor, dest_subs, current_files, package_tag, dry_
8464
8566
  const prune_candidates = /* @__PURE__ */ new Set();
8465
8567
  const needle = `package: ${package_tag}`;
8466
8568
  for (const dest_sub of dest_subs) {
8467
- const root = dest_sub ? path4.join(anchor_resolved, dest_sub) : anchor_resolved;
8569
+ const root = dest_sub ? path5.join(anchor_resolved, dest_sub) : anchor_resolved;
8468
8570
  let root_stat;
8469
8571
  try {
8470
- root_stat = fs4.statSync(root);
8572
+ root_stat = fs5.statSync(root);
8471
8573
  } catch {
8472
8574
  continue;
8473
8575
  }
@@ -8477,7 +8579,7 @@ function reap_tagged_orphans(anchor, dest_subs, current_files, package_tag, dry_
8477
8579
  for (const md of rglob_md(root)) {
8478
8580
  let md_lst;
8479
8581
  try {
8480
- md_lst = fs4.lstatSync(md);
8582
+ md_lst = fs5.lstatSync(md);
8481
8583
  } catch {
8482
8584
  continue;
8483
8585
  }
@@ -8489,13 +8591,13 @@ function reap_tagged_orphans(anchor, dest_subs, current_files, package_tag, dry_
8489
8591
  continue;
8490
8592
  }
8491
8593
  try {
8492
- relative_to(resolve_path(path4.dirname(md)), anchor_resolved);
8594
+ relative_to(resolve_path(path5.dirname(md)), anchor_resolved);
8493
8595
  } catch {
8494
8596
  continue;
8495
8597
  }
8496
8598
  let head;
8497
8599
  try {
8498
- head = fs4.readFileSync(md, { encoding: "utf-8" });
8600
+ head = fs5.readFileSync(md, { encoding: "utf-8" });
8499
8601
  } catch {
8500
8602
  continue;
8501
8603
  }
@@ -8513,12 +8615,12 @@ function reap_tagged_orphans(anchor, dest_subs, current_files, package_tag, dry_
8513
8615
  continue;
8514
8616
  }
8515
8617
  try {
8516
- fs4.unlinkSync(md);
8618
+ fs5.unlinkSync(md);
8517
8619
  } catch {
8518
8620
  continue;
8519
8621
  }
8520
8622
  deleted.push(md);
8521
- prune_candidates.add(path4.dirname(md));
8623
+ prune_candidates.add(path5.dirname(md));
8522
8624
  }
8523
8625
  }
8524
8626
  prune_empty_dirs(prune_candidates, anchor_resolved);
@@ -8538,51 +8640,51 @@ function record_deploy(tool_id, anchor, current_files, inventory) {
8538
8640
  }
8539
8641
  function prune_empty_dirs(prune_candidates, anchor_resolved) {
8540
8642
  const ordered = [...prune_candidates].sort(
8541
- (a, b) => b.split(path4.sep).length - a.split(path4.sep).length
8643
+ (a, b) => b.split(path5.sep).length - a.split(path5.sep).length
8542
8644
  );
8543
8645
  for (const start of ordered) {
8544
8646
  let node = start;
8545
8647
  while (node !== anchor_resolved && is_ancestor(anchor_resolved, node)) {
8546
8648
  try {
8547
- fs4.rmdirSync(node);
8649
+ fs5.rmdirSync(node);
8548
8650
  } catch {
8549
8651
  break;
8550
8652
  }
8551
- node = path4.dirname(node);
8653
+ node = path5.dirname(node);
8552
8654
  }
8553
8655
  }
8554
8656
  }
8555
8657
  function is_ancestor(anchor, node) {
8556
- const rel = path4.relative(anchor, node);
8557
- return rel !== "" && !rel.startsWith("..") && !path4.isAbsolute(rel);
8658
+ const rel = path5.relative(anchor, node);
8659
+ return rel !== "" && !rel.startsWith("..") && !path5.isAbsolute(rel);
8558
8660
  }
8559
8661
  function relative_to(child, parent) {
8560
8662
  if (child === parent) {
8561
8663
  return "";
8562
8664
  }
8563
- const rel = path4.relative(parent, child);
8564
- if (rel.startsWith("..") || path4.isAbsolute(rel)) {
8665
+ const rel = path5.relative(parent, child);
8666
+ if (rel.startsWith("..") || path5.isAbsolute(rel)) {
8565
8667
  throw new Error(`'${child}' is not in the subpath of '${parent}'`);
8566
8668
  }
8567
8669
  return rel;
8568
8670
  }
8569
8671
  function relative_to_posix(child, parent) {
8570
- return path4.relative(parent, child).split(path4.sep).join("/");
8672
+ return path5.relative(parent, child).split(path5.sep).join("/");
8571
8673
  }
8572
8674
  function rglob_md(root) {
8573
8675
  const out = [];
8574
8676
  const walk = (dir) => {
8575
8677
  let names;
8576
8678
  try {
8577
- names = fs4.readdirSync(dir).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
8679
+ names = fs5.readdirSync(dir).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
8578
8680
  } catch {
8579
8681
  return;
8580
8682
  }
8581
8683
  for (const name of names) {
8582
- const full = path4.join(dir, name);
8684
+ const full = path5.join(dir, name);
8583
8685
  let lst;
8584
8686
  try {
8585
- lst = fs4.lstatSync(full);
8687
+ lst = fs5.lstatSync(full);
8586
8688
  } catch {
8587
8689
  continue;
8588
8690
  }
@@ -8623,13 +8725,13 @@ function splitlines2(text) {
8623
8725
  }
8624
8726
 
8625
8727
  // src/scripts/_lib/installed_tools.ts
8626
- import * as fs6 from "node:fs";
8728
+ import * as fs7 from "node:fs";
8627
8729
  import * as os4 from "node:os";
8628
8730
  import * as fsPath from "node:path";
8629
8731
 
8630
8732
  // src/scripts/_lib/fs_atomic.ts
8631
- import fs5 from "node:fs";
8632
- import path5 from "node:path";
8733
+ import fs6 from "node:fs";
8734
+ import path6 from "node:path";
8633
8735
  import { randomBytes as randomBytes3 } from "node:crypto";
8634
8736
  function _normalize_encoding(encoding) {
8635
8737
  const compact = encoding.toLowerCase().replace(/[-_\s]/g, "");
@@ -8645,9 +8747,9 @@ function _normalize_encoding(encoding) {
8645
8747
  }
8646
8748
  function write_atomic(p, data, options = {}) {
8647
8749
  const encoding = options.encoding ?? "utf-8";
8648
- const target = path5.normalize(p);
8649
- const parent = path5.dirname(target);
8650
- fs5.mkdirSync(parent, { recursive: true });
8750
+ const target = path6.normalize(p);
8751
+ const parent = path6.dirname(target);
8752
+ fs6.mkdirSync(parent, { recursive: true });
8651
8753
  let payload;
8652
8754
  if (typeof data === "string") {
8653
8755
  payload = Buffer.from(data, _normalize_encoding(encoding));
@@ -8661,12 +8763,12 @@ function write_atomic(p, data, options = {}) {
8661
8763
  let fd = null;
8662
8764
  let tmp_path = "";
8663
8765
  for (let attempt = 0; attempt < 32; attempt += 1) {
8664
- tmp_path = path5.join(
8766
+ tmp_path = path6.join(
8665
8767
  parent,
8666
- `.${path5.basename(target)}.tmp.${randomBytes3(6).toString("hex")}`
8768
+ `.${path6.basename(target)}.tmp.${randomBytes3(6).toString("hex")}`
8667
8769
  );
8668
8770
  try {
8669
- fd = fs5.openSync(tmp_path, "wx", 384);
8771
+ fd = fs6.openSync(tmp_path, "wx", 384);
8670
8772
  break;
8671
8773
  } catch (err) {
8672
8774
  if (err.code === "EEXIST") continue;
@@ -8680,24 +8782,24 @@ function write_atomic(p, data, options = {}) {
8680
8782
  try {
8681
8783
  let offset = 0;
8682
8784
  while (offset < payload.length) {
8683
- offset += fs5.writeSync(fd, payload, offset, payload.length - offset);
8785
+ offset += fs6.writeSync(fd, payload, offset, payload.length - offset);
8684
8786
  }
8685
8787
  try {
8686
- fs5.fsyncSync(fd);
8788
+ fs6.fsyncSync(fd);
8687
8789
  } catch {
8688
8790
  }
8689
- fs5.closeSync(fd);
8791
+ fs6.closeSync(fd);
8690
8792
  closed = true;
8691
- fs5.renameSync(tmp_path, target);
8793
+ fs6.renameSync(tmp_path, target);
8692
8794
  } catch (err) {
8693
8795
  if (!closed) {
8694
8796
  try {
8695
- fs5.closeSync(fd);
8797
+ fs6.closeSync(fd);
8696
8798
  } catch {
8697
8799
  }
8698
8800
  }
8699
8801
  try {
8700
- fs5.unlinkSync(tmp_path);
8802
+ fs6.unlinkSync(tmp_path);
8701
8803
  } catch {
8702
8804
  }
8703
8805
  throw err;
@@ -8708,17 +8810,17 @@ function write_atomic(p, data, options = {}) {
8708
8810
  function _fsync_dir(directory) {
8709
8811
  let dir_fd;
8710
8812
  try {
8711
- dir_fd = fs5.openSync(directory, fs5.constants.O_RDONLY);
8813
+ dir_fd = fs6.openSync(directory, fs6.constants.O_RDONLY);
8712
8814
  } catch {
8713
8815
  return;
8714
8816
  }
8715
8817
  try {
8716
8818
  try {
8717
- fs5.fsyncSync(dir_fd);
8819
+ fs6.fsyncSync(dir_fd);
8718
8820
  } catch {
8719
8821
  }
8720
8822
  } finally {
8721
- fs5.closeSync(dir_fd);
8823
+ fs6.closeSync(dir_fd);
8722
8824
  }
8723
8825
  }
8724
8826
 
@@ -8747,18 +8849,18 @@ function manifest_path(project_root, env) {
8747
8849
  var _TOP_KEY_RE = /^([A-Za-z_][A-Za-z0-9_]*)\s*:\s*"?([^"\n]*?)"?\s*$/;
8748
8850
  var _LIST_DASH_RE = /^\s*-\s*(.+?)\s*$/;
8749
8851
  var _INDENT_KEY_RE = /^\s+([A-Za-z_][A-Za-z0-9_]*)\s*:\s*"?([^"\n]*?)"?\s*$/;
8750
- function read_manifest(path15) {
8852
+ function read_manifest(path16) {
8751
8853
  let text;
8752
8854
  try {
8753
- text = require_read_text(path15);
8855
+ text = require_read_text(path16);
8754
8856
  } catch {
8755
8857
  return null;
8756
8858
  }
8757
8859
  const data = _parse_manual(text);
8758
8860
  return _normalise_v2_shape(data);
8759
8861
  }
8760
- function require_read_text(path15) {
8761
- return fs6.readFileSync(path15, { encoding: "utf-8" });
8862
+ function require_read_text(path16) {
8863
+ return fs7.readFileSync(path16, { encoding: "utf-8" });
8762
8864
  }
8763
8865
  function _normalise_v2_shape(data) {
8764
8866
  if (data["tools"] === void 0 || data["tools"] === null) {
@@ -8939,9 +9041,9 @@ function stable_sort(items, key) {
8939
9041
  return a.index - b.index;
8940
9042
  }).map((entry) => entry.item);
8941
9043
  }
8942
- function write_manifest(path15, version, tools, options = {}) {
9044
+ function write_manifest(path16, version, tools, options = {}) {
8943
9045
  const rendered = _render2(version, tools, { deploy_roots: options.deploy_roots ?? null });
8944
- return write_atomic(path15, rendered);
9046
+ return write_atomic(path16, rendered);
8945
9047
  }
8946
9048
  var ScopeMismatchError = class extends Error {
8947
9049
  name_;
@@ -9032,25 +9134,25 @@ function _today() {
9032
9134
  // src/scripts/_lib/install_drift.ts
9033
9135
  var import_yaml = __toESM(require_dist(), 1);
9034
9136
  import * as crypto from "node:crypto";
9035
- import * as fs7 from "node:fs";
9137
+ import * as fs8 from "node:fs";
9036
9138
  import * as os5 from "node:os";
9037
- import * as path6 from "node:path";
9139
+ import * as path7 from "node:path";
9038
9140
  function expanduser5(p) {
9039
9141
  if (p === "~") {
9040
9142
  return os5.homedir();
9041
9143
  }
9042
9144
  if (p.startsWith("~/") || process.platform === "win32" && p.startsWith("~\\")) {
9043
- return path6.join(os5.homedir(), p.slice(2));
9145
+ return path7.join(os5.homedir(), p.slice(2));
9044
9146
  }
9045
9147
  return p;
9046
9148
  }
9047
9149
  function resolve_entry_path(project_root, raw) {
9048
9150
  const p = expanduser5(raw);
9049
- return path6.isAbsolute(p) ? p : path6.join(project_root, p);
9151
+ return path7.isAbsolute(p) ? p : path7.join(project_root, p);
9050
9152
  }
9051
9153
  function sha256_of_file(p) {
9052
9154
  try {
9053
- return crypto.createHash("sha256").update(fs7.readFileSync(p)).digest("hex");
9155
+ return crypto.createHash("sha256").update(fs8.readFileSync(p)).digest("hex");
9054
9156
  } catch {
9055
9157
  return null;
9056
9158
  }
@@ -9059,7 +9161,7 @@ function collect_drift(project_root, env) {
9059
9161
  const target = manifest_path(project_root, env);
9060
9162
  let text;
9061
9163
  try {
9062
- text = fs7.readFileSync(target, "utf-8");
9164
+ text = fs8.readFileSync(target, "utf-8");
9063
9165
  } catch {
9064
9166
  return null;
9065
9167
  }
@@ -9104,7 +9206,7 @@ function collect_drift(project_root, env) {
9104
9206
  continue;
9105
9207
  }
9106
9208
  const resolved = resolve_entry_path(project_root, raw_path);
9107
- if (!fs7.existsSync(resolved)) {
9209
+ if (!fs8.existsSync(resolved)) {
9108
9210
  out.push({
9109
9211
  tool_id,
9110
9212
  path: resolved,
@@ -9158,8 +9260,8 @@ function format_drift_report(entries) {
9158
9260
 
9159
9261
  // src/scripts/_lib/claude_desktop_bundler.ts
9160
9262
  import * as crypto2 from "node:crypto";
9161
- import * as fs8 from "node:fs";
9162
- import * as path7 from "node:path";
9263
+ import * as fs9 from "node:fs";
9264
+ import * as path8 from "node:path";
9163
9265
 
9164
9266
  // src/scripts/_lib/zip_min.ts
9165
9267
  import * as zlib from "node:zlib";
@@ -9266,7 +9368,7 @@ function _is_excluded(rel_parts) {
9266
9368
  }
9267
9369
  function _is_dir(p) {
9268
9370
  try {
9269
- return fs8.statSync(p).isDirectory();
9371
+ return fs9.statSync(p).isDirectory();
9270
9372
  } catch {
9271
9373
  return false;
9272
9374
  }
@@ -9278,12 +9380,12 @@ function _compare_rel_parts(a, b) {
9278
9380
  }
9279
9381
  function _walk_skill_files(skill_dir) {
9280
9382
  const out = [];
9281
- const resolved = fs8.realpathSync(skill_dir);
9383
+ const resolved = fs9.realpathSync(skill_dir);
9282
9384
  const walk = (root, relRoot) => {
9283
9385
  const dirNames = [];
9284
9386
  const fileNames = [];
9285
- for (const dirent of fs8.readdirSync(root, { withFileTypes: true })) {
9286
- const full = path7.join(root, dirent.name);
9387
+ for (const dirent of fs9.readdirSync(root, { withFileTypes: true })) {
9388
+ const full = path8.join(root, dirent.name);
9287
9389
  const isDir2 = dirent.isDirectory() || dirent.isSymbolicLink() && _is_dir(full);
9288
9390
  if (isDir2) {
9289
9391
  dirNames.push(dirent.name);
@@ -9296,13 +9398,13 @@ function _walk_skill_files(skill_dir) {
9296
9398
  if (_is_excluded(rel_parts)) {
9297
9399
  continue;
9298
9400
  }
9299
- out.push([path7.join(root, fname), rel_parts]);
9401
+ out.push([path8.join(root, fname), rel_parts]);
9300
9402
  }
9301
9403
  for (const dname of dirNames) {
9302
9404
  if (_is_excluded([dname])) {
9303
9405
  continue;
9304
9406
  }
9305
- walk(path7.join(root, dname), [...relRoot, dname]);
9407
+ walk(path8.join(root, dname), [...relRoot, dname]);
9306
9408
  }
9307
9409
  };
9308
9410
  walk(resolved, []);
@@ -9315,53 +9417,53 @@ function _manifest_digest(files) {
9315
9417
  const rel = rel_parts.join("/");
9316
9418
  h.update(Buffer.from(rel, "utf-8"));
9317
9419
  h.update(Buffer.from([0]));
9318
- h.update(crypto2.createHash("sha256").update(fs8.readFileSync(abs_path)).digest());
9420
+ h.update(crypto2.createHash("sha256").update(fs9.readFileSync(abs_path)).digest());
9319
9421
  h.update(Buffer.from([0]));
9320
9422
  }
9321
9423
  return h.digest("hex");
9322
9424
  }
9323
9425
  function _atomic_write_zip(zip_path, files) {
9324
- fs8.mkdirSync(path7.dirname(zip_path), { recursive: true });
9325
- const stem = path7.basename(zip_path, path7.extname(zip_path));
9326
- const tmp_path = path7.join(
9327
- path7.dirname(zip_path),
9426
+ fs9.mkdirSync(path8.dirname(zip_path), { recursive: true });
9427
+ const stem = path8.basename(zip_path, path8.extname(zip_path));
9428
+ const tmp_path = path8.join(
9429
+ path8.dirname(zip_path),
9328
9430
  `.${stem}.${crypto2.randomBytes(6).toString("hex")}.zip.tmp`
9329
9431
  );
9330
9432
  try {
9331
9433
  const entries = files.map(([abs_path, rel_parts]) => ({
9332
9434
  name: rel_parts.join("/"),
9333
- data: fs8.readFileSync(abs_path)
9435
+ data: fs9.readFileSync(abs_path)
9334
9436
  }));
9335
- fs8.writeFileSync(tmp_path, zip_write_sync(entries));
9336
- fs8.renameSync(tmp_path, zip_path);
9437
+ fs9.writeFileSync(tmp_path, zip_write_sync(entries));
9438
+ fs9.renameSync(tmp_path, zip_path);
9337
9439
  } finally {
9338
- if (fs8.existsSync(tmp_path)) {
9339
- fs8.unlinkSync(tmp_path);
9440
+ if (fs9.existsSync(tmp_path)) {
9441
+ fs9.unlinkSync(tmp_path);
9340
9442
  }
9341
9443
  }
9342
9444
  }
9343
9445
  function _write_if_changed(dest_dir, slug, files, force, written) {
9344
9446
  const digest = _manifest_digest(files);
9345
- const zip_path = path7.join(dest_dir, `${slug}.zip`);
9346
- const digest_path = path7.join(dest_dir, `${slug}.sha256`);
9347
- const recorded = fs8.existsSync(digest_path) ? fs8.readFileSync(digest_path, "utf-8").trim() : "";
9348
- if (!force && recorded === digest && fs8.existsSync(zip_path)) {
9447
+ const zip_path = path8.join(dest_dir, `${slug}.zip`);
9448
+ const digest_path = path8.join(dest_dir, `${slug}.sha256`);
9449
+ const recorded = fs9.existsSync(digest_path) ? fs9.readFileSync(digest_path, "utf-8").trim() : "";
9450
+ if (!force && recorded === digest && fs9.existsSync(zip_path)) {
9349
9451
  return;
9350
9452
  }
9351
9453
  _atomic_write_zip(zip_path, files);
9352
- fs8.writeFileSync(digest_path, digest + "\n", "utf-8");
9454
+ fs9.writeFileSync(digest_path, digest + "\n", "utf-8");
9353
9455
  written.push(zip_path);
9354
9456
  }
9355
9457
  function build_skill_bundles(package_root, dest_dir, force = false, curation = null) {
9356
- const skills_root = path7.join(package_root, "dist/agent-src", "skills");
9458
+ const skills_root = path8.join(package_root, "dist/agent-src", "skills");
9357
9459
  if (!_is_dir(skills_root)) {
9358
9460
  return [];
9359
9461
  }
9360
- fs8.mkdirSync(dest_dir, { recursive: true });
9462
+ fs9.mkdirSync(dest_dir, { recursive: true });
9361
9463
  const written = [];
9362
- for (const name of fs8.readdirSync(skills_root).sort()) {
9363
- const entry = path7.join(skills_root, name);
9364
- const isSymlink2 = fs8.lstatSync(entry).isSymbolicLink();
9464
+ for (const name of fs9.readdirSync(skills_root).sort()) {
9465
+ const entry = path8.join(skills_root, name);
9466
+ const isSymlink2 = fs9.lstatSync(entry).isSymbolicLink();
9365
9467
  if (!(_is_dir(entry) || isSymlink2)) {
9366
9468
  continue;
9367
9469
  }
@@ -9369,8 +9471,8 @@ function build_skill_bundles(package_root, dest_dir, force = false, curation = n
9369
9471
  if (curation !== null && !curation.includes(skill_name)) {
9370
9472
  continue;
9371
9473
  }
9372
- const skill_md = path7.join(entry, "SKILL.md");
9373
- if (!fs8.existsSync(skill_md)) {
9474
+ const skill_md = path8.join(entry, "SKILL.md");
9475
+ if (!fs9.existsSync(skill_md)) {
9374
9476
  continue;
9375
9477
  }
9376
9478
  const files = _walk_skill_files(entry);
@@ -9382,15 +9484,15 @@ function build_skill_bundles(package_root, dest_dir, force = false, curation = n
9382
9484
  return written;
9383
9485
  }
9384
9486
  function _command_slug(source_file, commands_root) {
9385
- const rel = path7.relative(commands_root, source_file);
9386
- const noExt = rel.slice(0, rel.length - path7.extname(rel).length);
9387
- return noExt.split(path7.sep).join("-");
9487
+ const rel = path8.relative(commands_root, source_file);
9488
+ const noExt = rel.slice(0, rel.length - path8.extname(rel).length);
9489
+ return noExt.split(path8.sep).join("-");
9388
9490
  }
9389
9491
  function _iter_command_files(commands_root) {
9390
9492
  const found = [];
9391
9493
  const walk = (dir) => {
9392
- for (const dirent of fs8.readdirSync(dir, { withFileTypes: true })) {
9393
- const full = path7.join(dir, dirent.name);
9494
+ for (const dirent of fs9.readdirSync(dir, { withFileTypes: true })) {
9495
+ const full = path8.join(dir, dirent.name);
9394
9496
  if (dirent.isDirectory() || dirent.isSymbolicLink() && _is_dir(full)) {
9395
9497
  walk(full);
9396
9498
  } else if (dirent.name.endsWith(".md")) {
@@ -9400,21 +9502,21 @@ function _iter_command_files(commands_root) {
9400
9502
  };
9401
9503
  walk(commands_root);
9402
9504
  found.sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
9403
- return found.filter((source_file) => path7.basename(source_file) !== "AGENTS.md");
9505
+ return found.filter((source_file) => path8.basename(source_file) !== "AGENTS.md");
9404
9506
  }
9405
9507
  function build_command_bundles(package_root, dest_dir, force = false, curation = null) {
9406
- const commands_root = path7.join(package_root, "dist/agent-src", "commands");
9508
+ const commands_root = path8.join(package_root, "dist/agent-src", "commands");
9407
9509
  if (!_is_dir(commands_root)) {
9408
9510
  return [];
9409
9511
  }
9410
- const skills_root = path7.join(package_root, "dist/agent-src", "skills");
9512
+ const skills_root = path8.join(package_root, "dist/agent-src", "skills");
9411
9513
  let skill_names = /* @__PURE__ */ new Set();
9412
9514
  if (_is_dir(skills_root)) {
9413
9515
  skill_names = new Set(
9414
- fs8.readdirSync(skills_root).filter((name) => _is_dir(path7.join(skills_root, name)))
9516
+ fs9.readdirSync(skills_root).filter((name) => _is_dir(path8.join(skills_root, name)))
9415
9517
  );
9416
9518
  }
9417
- fs8.mkdirSync(dest_dir, { recursive: true });
9519
+ fs9.mkdirSync(dest_dir, { recursive: true });
9418
9520
  const written = [];
9419
9521
  for (const source_file of _iter_command_files(commands_root)) {
9420
9522
  const slug = _command_slug(source_file, commands_root);
@@ -9424,7 +9526,7 @@ function build_command_bundles(package_root, dest_dir, force = false, curation =
9424
9526
  if (curation !== null && !curation.includes(slug)) {
9425
9527
  continue;
9426
9528
  }
9427
- const files = [[fs8.realpathSync(source_file), ["SKILL.md"]]];
9529
+ const files = [[fs9.realpathSync(source_file), ["SKILL.md"]]];
9428
9530
  _write_if_changed(dest_dir, slug, files, force, written);
9429
9531
  }
9430
9532
  return written;
@@ -9432,8 +9534,8 @@ function build_command_bundles(package_root, dest_dir, force = false, curation =
9432
9534
 
9433
9535
  // src/scripts/_lib/claude_settings_hooks.ts
9434
9536
  var YAML = __toESM(require_dist(), 1);
9435
- import * as fs9 from "node:fs";
9436
- import * as path8 from "node:path";
9537
+ import * as fs10 from "node:fs";
9538
+ import * as path9 from "node:path";
9437
9539
 
9438
9540
  // src/install/atomic.ts
9439
9541
  import {
@@ -9441,17 +9543,17 @@ import {
9441
9543
  fsyncSync,
9442
9544
  mkdirSync as mkdirSync5,
9443
9545
  openSync as openSync3,
9444
- readFileSync as readFileSync7,
9546
+ readFileSync as readFileSync8,
9445
9547
  renameSync as renameSync5,
9446
9548
  unlinkSync as unlinkSync4,
9447
9549
  writeSync
9448
9550
  } from "node:fs";
9449
- import { dirname as dirname4, join as join8 } from "node:path";
9551
+ import { dirname as dirname4, join as join9 } from "node:path";
9450
9552
  function atomicWriteFile(target, data, options = {}) {
9451
9553
  const mode = options.mode ?? 420;
9452
9554
  const parent = dirname4(target);
9453
9555
  mkdirSync5(parent, { recursive: true });
9454
- const tmp = join8(parent, `.tmp.${process.pid}.${randSuffix()}`);
9556
+ const tmp = join9(parent, `.tmp.${process.pid}.${randSuffix()}`);
9455
9557
  let fd = null;
9456
9558
  try {
9457
9559
  fd = openSync3(tmp, "w", mode);
@@ -9501,7 +9603,7 @@ var SettingsLockError = class extends Error {
9501
9603
  }
9502
9604
  };
9503
9605
  function build_claude_hook_matrix(manifest_path2) {
9504
- const raw = fs9.readFileSync(manifest_path2, "utf8");
9606
+ const raw = fs10.readFileSync(manifest_path2, "utf8");
9505
9607
  const manifest = _yaml_parse(raw) ?? {};
9506
9608
  const hook_spec = manifest["schema_version"] ?? 1;
9507
9609
  const platforms = manifest["platforms"] ?? {};
@@ -9517,7 +9619,8 @@ function build_claude_hook_matrix(manifest_path2) {
9517
9619
  if (!concerns || Array.isArray(concerns) && concerns.length === 0) continue;
9518
9620
  const native = ac_to_native[ac_event];
9519
9621
  if (native === void 0) continue;
9520
- matrix[native] = `BIN="$CLAUDE_PROJECT_DIR/agent-config"; [ -x "$BIN" ] || BIN=agent-config; command -v "$BIN" >/dev/null 2>&1 || exit 0; "$BIN" dispatch:hook --platform claude --event ${ac_event} --native-event ${native} --project-dir "$CLAUDE_PROJECT_DIR" --min-version ${String(hook_spec)}`;
9622
+ const dispatchArgs = `--platform claude --event ${ac_event} --native-event ${native} --project-dir "$CLAUDE_PROJECT_DIR" --min-version ${String(hook_spec)}`;
9623
+ matrix[native] = `B=""; [ -f "$CLAUDE_PROJECT_DIR/node_modules/@event4u/agent-config/dist/hooks/dispatch.js" ] && B="$CLAUDE_PROJECT_DIR/node_modules/@event4u/agent-config/dist/hooks/dispatch.js"; [ -z "$B" ] && [ -f "$CLAUDE_PROJECT_DIR/dist/hooks/dispatch.js" ] && [ -f "$CLAUDE_PROJECT_DIR/src/scripts/hook_manifest.yaml" ] && B="$CLAUDE_PROJECT_DIR/dist/hooks/dispatch.js"; if [ -n "$B" ] && command -v node >/dev/null 2>&1; then exec node "$B" ${dispatchArgs}; fi; BIN="$CLAUDE_PROJECT_DIR/agent-config"; [ -x "$BIN" ] || BIN=agent-config; command -v "$BIN" >/dev/null 2>&1 || exit 0; "$BIN" dispatch:hook ${dispatchArgs}`;
9521
9624
  }
9522
9625
  return matrix;
9523
9626
  }
@@ -9530,8 +9633,8 @@ function _is_managed_group(group) {
9530
9633
  );
9531
9634
  }
9532
9635
  function _read_settings(settings_path) {
9533
- if (!fs9.existsSync(settings_path)) return {};
9534
- const raw = fs9.readFileSync(settings_path, "utf8");
9636
+ if (!fs10.existsSync(settings_path)) return {};
9637
+ const raw = fs10.readFileSync(settings_path, "utf8");
9535
9638
  if (raw.trim() === "") return {};
9536
9639
  let parsed;
9537
9640
  try {
@@ -9546,18 +9649,18 @@ function _read_settings(settings_path) {
9546
9649
  }
9547
9650
  function _with_lock(settings_path, fn) {
9548
9651
  const lockPath = settings_path + ".agent-config.lock";
9549
- fs9.mkdirSync(path8.dirname(lockPath), { recursive: true });
9652
+ fs10.mkdirSync(path9.dirname(lockPath), { recursive: true });
9550
9653
  let fd;
9551
9654
  try {
9552
- fd = fs9.openSync(lockPath, "wx");
9655
+ fd = fs10.openSync(lockPath, "wx");
9553
9656
  } catch {
9554
9657
  throw new SettingsLockError(lockPath);
9555
9658
  }
9556
9659
  try {
9557
9660
  return fn();
9558
9661
  } finally {
9559
- fs9.closeSync(fd);
9560
- fs9.rmSync(lockPath, { force: true });
9662
+ fs10.closeSync(fd);
9663
+ fs10.rmSync(lockPath, { force: true });
9561
9664
  }
9562
9665
  }
9563
9666
  function ensure_managed_hooks(settings_path, matrix) {
@@ -9587,11 +9690,11 @@ function ensure_managed_hooks(settings_path, matrix) {
9587
9690
  }
9588
9691
 
9589
9692
  // src/scripts/_lib/agent_settings.ts
9590
- import { createRequire } from "node:module";
9591
- import * as fs10 from "node:fs";
9693
+ import { createRequire as createRequire2 } from "node:module";
9694
+ import * as fs11 from "node:fs";
9592
9695
  import * as os6 from "node:os";
9593
- import * as path9 from "node:path";
9594
- var _require = createRequire(import.meta.url);
9696
+ import * as path10 from "node:path";
9697
+ var _require2 = createRequire2(import.meta.url);
9595
9698
  var Logger = class {
9596
9699
  name = "scripts._lib.agent_settings";
9597
9700
  records = [];
@@ -9630,10 +9733,10 @@ var DEFAULT_PROJECT_FILE = ".agent-settings.yml";
9630
9733
  var LOCAL_PROJECT_FILE = ".agent-settings.local.yml";
9631
9734
  var LOCAL_PROJECT_SUBDIR = ["agents", "settings"];
9632
9735
  function _local_settings_path(project_root) {
9633
- return path9.join(project_root, ...LOCAL_PROJECT_SUBDIR, LOCAL_PROJECT_FILE);
9736
+ return path10.join(project_root, ...LOCAL_PROJECT_SUBDIR, LOCAL_PROJECT_FILE);
9634
9737
  }
9635
9738
  function _canonical_settings_path(project_root) {
9636
- return path9.join(project_root, ...LOCAL_PROJECT_SUBDIR, DEFAULT_PROJECT_FILE);
9739
+ return path10.join(project_root, ...LOCAL_PROJECT_SUBDIR, DEFAULT_PROJECT_FILE);
9637
9740
  }
9638
9741
  var USER_GLOBAL_FILENAME = "agent-settings.yml";
9639
9742
  function DEFAULT_USER_GLOBAL_FILE() {
@@ -9681,8 +9784,8 @@ var _AGENTS_DIR_MARKERS = [
9681
9784
  var _LEGACY_ANCHOR_ENV = "AGENT_CONFIG_LEGACY_ANCHOR";
9682
9785
  function _exists(p) {
9683
9786
  try {
9684
- fs10.lstatSync(p);
9685
- fs10.statSync(p);
9787
+ fs11.lstatSync(p);
9788
+ fs11.statSync(p);
9686
9789
  return true;
9687
9790
  } catch {
9688
9791
  return false;
@@ -9690,22 +9793,22 @@ function _exists(p) {
9690
9793
  }
9691
9794
  function _is_dir2(p) {
9692
9795
  try {
9693
- return fs10.statSync(p).isDirectory();
9796
+ return fs11.statSync(p).isDirectory();
9694
9797
  } catch {
9695
9798
  return false;
9696
9799
  }
9697
9800
  }
9698
9801
  function _is_file(p) {
9699
9802
  try {
9700
- return fs10.statSync(p).isFile();
9803
+ return fs11.statSync(p).isFile();
9701
9804
  } catch {
9702
9805
  return false;
9703
9806
  }
9704
9807
  }
9705
9808
  function _resolve(p) {
9706
- const absolute = path9.resolve(p);
9809
+ const absolute = path10.resolve(p);
9707
9810
  try {
9708
- return fs10.realpathSync(absolute);
9811
+ return fs11.realpathSync(absolute);
9709
9812
  } catch {
9710
9813
  return absolute;
9711
9814
  }
@@ -9715,7 +9818,7 @@ function _ancestor_chain(start) {
9715
9818
  let cursor = start;
9716
9819
  for (; ; ) {
9717
9820
  chain.push(cursor);
9718
- const parent = path9.dirname(cursor);
9821
+ const parent = path10.dirname(cursor);
9719
9822
  if (parent === cursor) {
9720
9823
  break;
9721
9824
  }
@@ -9724,15 +9827,15 @@ function _ancestor_chain(start) {
9724
9827
  return chain;
9725
9828
  }
9726
9829
  function _boundary_anchor_at(dir) {
9727
- const agents_dir = path9.join(dir, "agents");
9830
+ const agents_dir = path10.join(dir, "agents");
9728
9831
  if (_is_dir2(agents_dir)) {
9729
9832
  for (const marker of _AGENTS_DIR_MARKERS) {
9730
- if (_exists(path9.join(agents_dir, marker))) {
9833
+ if (_exists(path10.join(agents_dir, marker))) {
9731
9834
  return ANCHOR_AGENTS_DIR;
9732
9835
  }
9733
9836
  }
9734
9837
  }
9735
- if (_exists(path9.join(dir, ".git"))) {
9838
+ if (_exists(path10.join(dir, ".git"))) {
9736
9839
  return ANCHOR_GIT;
9737
9840
  }
9738
9841
  return null;
@@ -9743,7 +9846,7 @@ function find_project_root_with_anchor(start) {
9743
9846
  const chain = _ancestor_chain(current);
9744
9847
  if (legacy) {
9745
9848
  for (const candidate of chain) {
9746
- if (_exists(path9.join(candidate, ".git"))) {
9849
+ if (_exists(path10.join(candidate, ".git"))) {
9747
9850
  return [candidate, ANCHOR_GIT];
9748
9851
  }
9749
9852
  }
@@ -9757,7 +9860,7 @@ function find_project_root_with_anchor(start) {
9757
9860
  }
9758
9861
  let outermost = null;
9759
9862
  for (const candidate of chain) {
9760
- if (_exists(path9.join(candidate, DEFAULT_PROJECT_FILE))) {
9863
+ if (_exists(path10.join(candidate, DEFAULT_PROJECT_FILE))) {
9761
9864
  outermost = candidate;
9762
9865
  }
9763
9866
  }
@@ -9801,7 +9904,7 @@ function _expanduser(p) {
9801
9904
  return os6.homedir();
9802
9905
  }
9803
9906
  if (p.startsWith("~/") || process.platform === "win32" && p.startsWith("~\\")) {
9804
- return path9.join(os6.homedir(), p.slice(2));
9907
+ return path10.join(os6.homedir(), p.slice(2));
9805
9908
  }
9806
9909
  return p;
9807
9910
  }
@@ -9830,13 +9933,13 @@ function resolve_project_root(arg, options = {}) {
9830
9933
  function _resolve_cascade_paths(cwd, project_path) {
9831
9934
  if (cwd === null) {
9832
9935
  const legacy = project_path ? project_path : DEFAULT_PROJECT_FILE;
9833
- const parent = path9.dirname(legacy);
9936
+ const parent = path10.dirname(legacy);
9834
9937
  return [legacy, _canonical_settings_path(parent), _local_settings_path(parent)];
9835
9938
  }
9836
9939
  const root = find_project_root(cwd);
9837
9940
  if (root === null) {
9838
9941
  const legacy = project_path ? project_path : DEFAULT_PROJECT_FILE;
9839
- const parent = path9.dirname(legacy);
9942
+ const parent = path10.dirname(legacy);
9840
9943
  return [legacy, _canonical_settings_path(parent), _local_settings_path(parent)];
9841
9944
  }
9842
9945
  const cwd_resolved = _resolve(cwd);
@@ -9847,7 +9950,7 @@ function _resolve_cascade_paths(cwd, project_path) {
9847
9950
  if (cursor === root) {
9848
9951
  break;
9849
9952
  }
9850
- const parent = path9.dirname(cursor);
9953
+ const parent = path10.dirname(cursor);
9851
9954
  if (parent === cursor) {
9852
9955
  break;
9853
9956
  }
@@ -9855,7 +9958,7 @@ function _resolve_cascade_paths(cwd, project_path) {
9855
9958
  }
9856
9959
  chain.reverse();
9857
9960
  return [
9858
- ...chain.map((d) => path9.join(d, DEFAULT_PROJECT_FILE)),
9961
+ ...chain.map((d) => path10.join(d, DEFAULT_PROJECT_FILE)),
9859
9962
  _canonical_settings_path(root),
9860
9963
  _local_settings_path(root)
9861
9964
  ];
@@ -9890,13 +9993,13 @@ function _read_yaml(p) {
9890
9993
  }
9891
9994
  let YAML3;
9892
9995
  try {
9893
- YAML3 = _require("yaml");
9996
+ YAML3 = _require2("yaml");
9894
9997
  } catch {
9895
9998
  return null;
9896
9999
  }
9897
10000
  let data;
9898
10001
  try {
9899
- const text = fs10.readFileSync(p, "utf-8");
10002
+ const text = fs11.readFileSync(p, "utf-8");
9900
10003
  data = YAML3.parse(text, { version: "1.1" });
9901
10004
  if (data === null || data === void 0) {
9902
10005
  data = {};
@@ -9988,11 +10091,11 @@ function _is_plain_dict(value) {
9988
10091
  }
9989
10092
 
9990
10093
  // src/install/rule_scope.ts
9991
- import * as path10 from "node:path";
10094
+ import * as path11 from "node:path";
9992
10095
 
9993
10096
  // src/install/ruleInScope.ts
9994
10097
  var YAML2 = __toESM(require_dist(), 1);
9995
- import * as fs11 from "node:fs";
10098
+ import * as fs12 from "node:fs";
9996
10099
  function parseYaml2(text) {
9997
10100
  try {
9998
10101
  const data = YAML2.parse(text, { version: "1.1" });
@@ -10030,7 +10133,7 @@ function rule_in_scope(source_path, scope, pack_scope = null, role_scope = null)
10030
10133
  if (scope === null && pack_scope === null && role_scope === null) {
10031
10134
  return true;
10032
10135
  }
10033
- const [meta] = parseFrontmatter(fs11.readFileSync(source_path, "utf-8"));
10136
+ const [meta] = parseFrontmatter(fs12.readFileSync(source_path, "utf-8"));
10034
10137
  if (meta["type"] === "always" || meta["alwaysApply"] === true) {
10035
10138
  return true;
10036
10139
  }
@@ -10056,23 +10159,32 @@ function _list(value) {
10056
10159
  }
10057
10160
  return null;
10058
10161
  }
10059
- function ruleScopeFromSettings(settings) {
10162
+ function ruleScopeFromSettings(settings, packageRoot) {
10060
10163
  const proj = settings["projection"];
10061
10164
  if (typeof proj !== "object" || proj === null || Array.isArray(proj)) {
10062
10165
  return LEGACY_ALL;
10063
10166
  }
10064
10167
  const p = proj;
10168
+ const packs = packageRoot === void 0 ? _list(p["rule_packs"]) : resolve_rule_pack_scope(
10169
+ p["rule_packs"],
10170
+ packageRoot,
10171
+ _list(_runtimeActivePacks(settings)) ?? []
10172
+ );
10065
10173
  return {
10066
10174
  workspaces: _list(p["rule_workspaces"]),
10067
- packs: _list(p["rule_packs"]),
10175
+ packs,
10068
10176
  roles: _list(p["rule_roles"])
10069
10177
  };
10070
10178
  }
10179
+ function _runtimeActivePacks(settings) {
10180
+ const rt = settings["runtime"];
10181
+ return typeof rt === "object" && rt !== null && !Array.isArray(rt) ? rt["active_packs"] : null;
10182
+ }
10071
10183
  function ruleFileArrives(sourcePath, scope) {
10072
10184
  if (!sourcePath.endsWith(".md")) {
10073
10185
  return true;
10074
10186
  }
10075
- const basename5 = path10.basename(sourcePath);
10187
+ const basename5 = path11.basename(sourcePath);
10076
10188
  if (COMPAT_ALWAYS_EXCLUDED.includes(basename5)) {
10077
10189
  return false;
10078
10190
  }
@@ -10630,8 +10742,8 @@ function getErrorMap() {
10630
10742
 
10631
10743
  // node_modules/zod/v3/helpers/parseUtil.js
10632
10744
  var makeIssue = (params) => {
10633
- const { data, path: path15, errorMaps, issueData } = params;
10634
- const fullPath = [...path15, ...issueData.path || []];
10745
+ const { data, path: path16, errorMaps, issueData } = params;
10746
+ const fullPath = [...path16, ...issueData.path || []];
10635
10747
  const fullIssue = {
10636
10748
  ...issueData,
10637
10749
  path: fullPath
@@ -10747,11 +10859,11 @@ var errorUtil;
10747
10859
 
10748
10860
  // node_modules/zod/v3/types.js
10749
10861
  var ParseInputLazyPath = class {
10750
- constructor(parent, value, path15, key) {
10862
+ constructor(parent, value, path16, key) {
10751
10863
  this._cachedPath = [];
10752
10864
  this.parent = parent;
10753
10865
  this.data = value;
10754
- this._path = path15;
10866
+ this._path = path16;
10755
10867
  this._key = key;
10756
10868
  }
10757
10869
  get path() {
@@ -14233,8 +14345,8 @@ var settingsSchema = external_exports.object({
14233
14345
  rule_workspaces: external_exports.array(external_exports.string()).default([]).describe(
14234
14346
  "Workspace scope for the RULE layer only (road-to-request-scoped-rule-load P1/P1b, opt-in). Absent or empty = legacy-all: every rule projects AND installs. Non-empty = only rules whose workspaces frontmatter intersects this list are projected (condense) and installed (install.sh + global wizard payload). Kernel rules always ship; untagged rules fail safe. The default flip to a scoped value is a HUMAN release gate \u2014 do not set this from automation."
14235
14347
  ),
14236
- rule_packs: external_exports.array(external_exports.string()).default([]).describe(
14237
- "Optional second scoping axis for the RULE layer, per pack ids (src/config/discovery/packs.yml). When set, a non-kernel rule also needs a packs frontmatter intersection to ship \u2014 e.g. deselecting frontend-design drops ui-audit-gate + design-fidelity. Same opt-in / human-gate semantics as rule_workspaces."
14348
+ rule_packs: external_exports.union([external_exports.literal("auto"), external_exports.array(external_exports.string())]).default([]).describe(
14349
+ 'Optional second scoping axis for the RULE layer, per pack ids (src/config/discovery/packs.yml). When set, a non-kernel rule also needs a packs frontmatter intersection to ship \u2014 e.g. deselecting frontend-design drops ui-audit-gate + design-fidelity. Same opt-in / human-gate semantics as rule_workspaces. The literal "auto" derives the id list from the active-pack set (the same set the skill/command prune uses), so a domain safety floor stops shipping into installs that do not have the pack it guards; an explicit list stays supported and wins over the derivation.'
14238
14350
  )
14239
14351
  }).default({ mode: "legacy-all" }),
14240
14352
  rule_loading_tier: ruleLoadingTier.default("balanced").describe(
@@ -14258,7 +14370,18 @@ var settingsSchema = external_exports.object({
14258
14370
  ),
14259
14371
  monthly: external_exports.number().min(0).default(0).describe(
14260
14372
  "Calendar-month USD ceiling. Pairs with cost.enforcement = hard-stop for a hard cap on agent spend before the next billing cycle. Set 0 to disable."
14261
- )
14373
+ ),
14374
+ per_tier: external_exports.object({
14375
+ cheap: external_exports.number().min(0).nullable().default(null).describe(
14376
+ "USD ceiling for the cheap model tier under budget-aware delegation (docs/contracts/budget-routing.md). null = no separate tier cap; global ceilings still apply."
14377
+ ),
14378
+ medium: external_exports.number().min(0).nullable().default(null).describe(
14379
+ "USD ceiling for the medium model tier. null = no separate tier cap."
14380
+ ),
14381
+ strong: external_exports.number().min(0).nullable().default(null).describe(
14382
+ "USD ceiling for the strong model tier. null = no separate tier cap \u2014 with cheap exhausted and strong funded, budget routing uses the strong tier rather than blocking work."
14383
+ )
14384
+ }).default({ cheap: null, medium: null, strong: null })
14262
14385
  }),
14263
14386
  enforcement: enforcementMode.default("advisory").describe(
14264
14387
  "What happens when a budget hits 100%. advisory = show a banner, keep working (default \u2014 never blocks an active task). hard-stop = refuse further model calls until the budget resets or you raise the ceiling."
@@ -14283,7 +14406,7 @@ var settingsSchema = external_exports.object({
14283
14406
  "Prefer short bullets and tables (true, default) vs verbose prose with rationale (false). Affects every chat reply; flip to false during debugging when you want the agent to think out loud."
14284
14407
  ),
14285
14408
  canary_name: external_exports.string().default("").describe(
14286
- 'Session canary \u2014 the name the agent addresses you with at the start of every new task (e.g. "Alex"). When the greeting silently disappears, the context window is degrading: start a fresh conversation. Also keeps the reply-close markers (end-summary, PR URL as literal last line) alive. Empty = off. See rules/session-canary.md.'
14409
+ 'Session canary \u2014 the name the agent addresses you with at the start of every new task (e.g. "Alex"). When the greeting silently disappears, the context window is degrading: start a fresh conversation. Also keeps the reply-close markers (end-summary, PR URL as literal last line) alive. Empty = fall back to the user-global canary_name, then to identity.name from the setup wizard; no name anywhere = off. See rules/session-canary.md.'
14287
14410
  ),
14288
14411
  play_by_play: external_exports.boolean().default(false).describe(
14289
14412
  `Narrate intermediate findings between tool calls ("Found it.", "Let me check Y."). Off by default \u2014 most users find it noisy. Turn on when you want to follow the agent's reasoning step by step.`
@@ -14367,8 +14490,8 @@ var settingsSchema = external_exports.object({
14367
14490
  quality_cadence: qualityCadence.default("end_of_roadmap").describe(
14368
14491
  "When the agent runs the full quality / test suite during /roadmap:process-* runs. end_of_roadmap = once, after the last step (fastest, default). per_phase = after each phase boundary. per_step = after every single step (slowest, highest confidence)."
14369
14492
  ),
14370
- dashboard_regen_cadence: regenCadence.default("per_step").describe(
14371
- "How often the agent regenerates agents/roadmaps/dashboard.md during a roadmap run. per_step = after every step (default, freshest dashboard). every_5_steps = batch the regen. phase_boundary = only at phase edges."
14493
+ dashboard_regen_cadence: regenCadence.default("every_5_steps").describe(
14494
+ "How often the agent regenerates agents/roadmaps/dashboard.md during a roadmap run. every_5_steps = batch the regen (default). per_step = after every step (freshest dashboard, highest subprocess overhead). phase_boundary = only at phase edges. A rename, phase add, or archive always regenerates immediately regardless."
14372
14495
  ),
14373
14496
  horizon_weeks: external_exports.number().int().min(0).default(0).describe(
14374
14497
  'Optional planning horizon (weeks) the agent shows in roadmap framing ("next 4 weeks"). Set 0 to omit the horizon \u2014 most teams prefer to ship without a hardcoded window.'
@@ -14468,6 +14591,9 @@ var settingsSchema = external_exports.object({
14468
14591
  downshift: external_exports.boolean().default(true).describe(
14469
14592
  "Route delegable sub-tasks to the lowest-capable model tier (cost + speed via model downshift). false = every subagent runs on the session tier."
14470
14593
  ),
14594
+ budget_routing: external_exports.enum(["ask", "auto", "off"]).default("ask").describe(
14595
+ "Budget-aware cheap-request delegation (docs/contracts/budget-routing.md): pick the cheapest classifier-adequate tier WITH available budget (cost.budgets.per_tier); cheap exhausted but strong funded \u2192 strong tier; all exhausted \u2192 session model + notice. Work is never blocked to save money; the session model is never switched (delegation with a model override). ask = confirm the first budget-motivated downshift per session (default). auto = apply silently with telemetry. off = today's behavior (single-flip rollback). Distinct from downshift: that is the quality/cost knob, this is the resource-availability gate."
14596
+ ),
14471
14597
  quota_arbitrage: external_exports.boolean().default(true).describe(
14472
14598
  "Prefer a separate quota-pool model for delegable sub-tasks where the host manifest reports one. Optional bonus only \u2014 identical behaviour (minus the quota win) where unsupported. Never load-bearing."
14473
14599
  ),
@@ -15981,8 +16107,8 @@ var zodToJsonSchema = (schema, options) => {
15981
16107
  };
15982
16108
 
15983
16109
  // src/scripts/_lib/module_detection.ts
15984
- import * as fs12 from "node:fs";
15985
- import * as path11 from "node:path";
16110
+ import * as fs13 from "node:fs";
16111
+ import * as path12 from "node:path";
15986
16112
  var _SKIP_DIRS = /* @__PURE__ */ new Set([".module-template", ".example"]);
15987
16113
  var _RULES = [
15988
16114
  ["app/Modules", "laravel-hmvc", "App\\Modules\\{ModuleName}"],
@@ -15996,14 +16122,14 @@ var _RULES = [
15996
16122
  ];
15997
16123
  function _isDir(p) {
15998
16124
  try {
15999
- return fs12.statSync(p).isDirectory();
16125
+ return fs13.statSync(p).isDirectory();
16000
16126
  } catch {
16001
16127
  return false;
16002
16128
  }
16003
16129
  }
16004
16130
  function _isFile(p) {
16005
16131
  try {
16006
- return fs12.statSync(p).isFile();
16132
+ return fs13.statSync(p).isFile();
16007
16133
  } catch {
16008
16134
  return false;
16009
16135
  }
@@ -16017,13 +16143,13 @@ function _isUpperChar(ch) {
16017
16143
  function _list_module_subdirs(root) {
16018
16144
  let entries;
16019
16145
  try {
16020
- entries = fs12.readdirSync(root).sort();
16146
+ entries = fs13.readdirSync(root).sort();
16021
16147
  } catch {
16022
16148
  return [];
16023
16149
  }
16024
16150
  const out = [];
16025
16151
  for (const name of entries) {
16026
- if (!_isDir(path11.join(root, name))) {
16152
+ if (!_isDir(path12.join(root, name))) {
16027
16153
  continue;
16028
16154
  }
16029
16155
  if (name.startsWith(".")) {
@@ -16045,11 +16171,11 @@ function _score_confidence(stack, root, subdirs) {
16045
16171
  return capitalized.length > 0 ? "high" : "medium";
16046
16172
  }
16047
16173
  if (stack === "node-monorepo") {
16048
- const withPkgJson = subdirs.filter((name) => _isFile(path11.join(root, name, "package.json")));
16174
+ const withPkgJson = subdirs.filter((name) => _isFile(path12.join(root, name, "package.json")));
16049
16175
  return withPkgJson.length > 0 ? "high" : "medium";
16050
16176
  }
16051
16177
  if (stack === "python-src") {
16052
- const withInit = subdirs.filter((name) => _isFile(path11.join(root, name, "__init__.py")));
16178
+ const withInit = subdirs.filter((name) => _isFile(path12.join(root, name, "__init__.py")));
16053
16179
  return withInit.length > 0 ? "high" : "medium";
16054
16180
  }
16055
16181
  if (stack === "go-internal") {
@@ -16061,7 +16187,7 @@ function detect_module_roots(project_root) {
16061
16187
  const high = [];
16062
16188
  const medium = [];
16063
16189
  for (const [rel_path, stack, namespace_template] of _RULES) {
16064
- const abs_path = path11.join(project_root, rel_path);
16190
+ const abs_path = path12.join(project_root, rel_path);
16065
16191
  if (!_isDir(abs_path)) {
16066
16192
  continue;
16067
16193
  }
@@ -16083,7 +16209,7 @@ function detect_module_roots(project_root) {
16083
16209
  }
16084
16210
 
16085
16211
  // src/scripts/_lib/model_tier.ts
16086
- import fs13 from "node:fs";
16212
+ import fs14 from "node:fs";
16087
16213
  var TIER_TO_CLAUDE_MODEL = {
16088
16214
  high: "opus",
16089
16215
  medium: "sonnet",
@@ -16091,8 +16217,8 @@ var TIER_TO_CLAUDE_MODEL = {
16091
16217
  };
16092
16218
  var MODEL_TIER_RE = /^model_tier:\s*"?([a-z]+)"?\s*$/m;
16093
16219
  function read_model_tier(skill_md) {
16094
- if (!fs13.existsSync(skill_md)) return null;
16095
- const text = fs13.readFileSync(skill_md).toString("utf-8");
16220
+ if (!fs14.existsSync(skill_md)) return null;
16221
+ const text = fs14.readFileSync(skill_md).toString("utf-8");
16096
16222
  if (!text.startsWith("---\n")) return null;
16097
16223
  const end = text.indexOf("\n---\n", 4);
16098
16224
  if (end === -1) return null;
@@ -16109,39 +16235,39 @@ function render_native_model_md(text, tier) {
16109
16235
 
16110
16236
  // src/scripts/_cli/cmd_migrate.ts
16111
16237
  import { spawnSync } from "node:child_process";
16112
- import * as fs15 from "node:fs";
16113
- import * as path13 from "node:path";
16238
+ import * as fs16 from "node:fs";
16239
+ import * as path14 from "node:path";
16114
16240
  import process2 from "node:process";
16115
16241
  import { fileURLToPath as fileURLToPath3, pathToFileURL } from "node:url";
16116
16242
 
16117
16243
  // src/scripts/_lib/package_root.ts
16118
- import * as fs14 from "node:fs";
16119
- import * as path12 from "node:path";
16244
+ import * as fs15 from "node:fs";
16245
+ import * as path13 from "node:path";
16120
16246
  import { fileURLToPath as fileURLToPath2 } from "node:url";
16121
16247
  var PACKAGE_NAME = "@event4u/agent-config";
16122
16248
  var MAX_ASCENT = 16;
16123
16249
  function resolvePackageRoot(fromUrlOrPath, legacyHops = 3) {
16124
16250
  const start = fromUrlOrPath.startsWith("file:") ? fileURLToPath2(fromUrlOrPath) : fromUrlOrPath;
16125
- const startDir = path12.dirname(start);
16251
+ const startDir = path13.dirname(start);
16126
16252
  let dir = startDir;
16127
16253
  for (let i = 0; i < MAX_ASCENT; i++) {
16128
- const manifest = path12.join(dir, "package.json");
16129
- if (fs14.existsSync(manifest)) {
16254
+ const manifest = path13.join(dir, "package.json");
16255
+ if (fs15.existsSync(manifest)) {
16130
16256
  try {
16131
- const parsed = JSON.parse(fs14.readFileSync(manifest, "utf8"));
16257
+ const parsed = JSON.parse(fs15.readFileSync(manifest, "utf8"));
16132
16258
  if (parsed.name === PACKAGE_NAME) {
16133
16259
  return dir;
16134
16260
  }
16135
16261
  } catch {
16136
16262
  }
16137
16263
  }
16138
- const parent = path12.dirname(dir);
16264
+ const parent = path13.dirname(dir);
16139
16265
  if (parent === dir) {
16140
16266
  break;
16141
16267
  }
16142
16268
  dir = parent;
16143
16269
  }
16144
- return path12.resolve(startDir, ...Array.from({ length: legacyHops }, () => ".."));
16270
+ return path13.resolve(startDir, ...Array.from({ length: legacyHops }, () => ".."));
16145
16271
  }
16146
16272
 
16147
16273
  // src/scripts/_cli/cmd_migrate.ts
@@ -16162,7 +16288,7 @@ var LEGACY_SETTINGS_FILES = [".agent-settings.yml", ".agent-user.yml"];
16162
16288
  var LEGACY_STATE_FILENAME = ".implement-ticket-state.json";
16163
16289
  var LEGACY_STATE_V1_FILENAME = ".work-state.json";
16164
16290
  var LEGACY_AGENT_CONFIG_SHELL = "agent-config";
16165
- var _HERE_DIR = path13.dirname(fileURLToPath3(import.meta.url));
16291
+ var _HERE_DIR = path14.dirname(fileURLToPath3(import.meta.url));
16166
16292
  var ArgparseExit = class extends Error {
16167
16293
  code;
16168
16294
  constructor(code) {
@@ -16261,38 +16387,38 @@ function _jsonDumpsIndentAscii(value, indent) {
16261
16387
  }
16262
16388
  function _isFile2(p) {
16263
16389
  try {
16264
- return fs15.statSync(p).isFile();
16390
+ return fs16.statSync(p).isFile();
16265
16391
  } catch {
16266
16392
  return false;
16267
16393
  }
16268
16394
  }
16269
16395
  function _isDir2(p) {
16270
16396
  try {
16271
- return fs15.statSync(p).isDirectory();
16397
+ return fs16.statSync(p).isDirectory();
16272
16398
  } catch {
16273
16399
  return false;
16274
16400
  }
16275
16401
  }
16276
16402
  function _isSymlink(p) {
16277
16403
  try {
16278
- return fs15.lstatSync(p).isSymbolicLink();
16404
+ return fs16.lstatSync(p).isSymbolicLink();
16279
16405
  } catch {
16280
16406
  return false;
16281
16407
  }
16282
16408
  }
16283
16409
  function _exists2(p) {
16284
16410
  try {
16285
- fs15.lstatSync(p);
16411
+ fs16.lstatSync(p);
16286
16412
  return true;
16287
16413
  } catch {
16288
16414
  return false;
16289
16415
  }
16290
16416
  }
16291
16417
  function _readText(p) {
16292
- return fs15.readFileSync(p, { encoding: "utf-8" });
16418
+ return fs16.readFileSync(p, { encoding: "utf-8" });
16293
16419
  }
16294
16420
  function _writeText(p, text) {
16295
- fs15.writeFileSync(p, text, { encoding: "utf-8" });
16421
+ fs16.writeFileSync(p, text, { encoding: "utf-8" });
16296
16422
  }
16297
16423
  function _jsonLoadFile(p) {
16298
16424
  return JSON.parse(_readText(p));
@@ -16348,7 +16474,7 @@ function _classify_symlink(link) {
16348
16474
  }
16349
16475
  let target;
16350
16476
  try {
16351
- target = fs15.readlinkSync(link);
16477
+ target = fs16.readlinkSync(link);
16352
16478
  } catch {
16353
16479
  return null;
16354
16480
  }
@@ -16359,16 +16485,16 @@ function _classify_symlink(link) {
16359
16485
  return "user";
16360
16486
  }
16361
16487
  function _detect_legacy_state(project) {
16362
- return _isFile2(path13.join(project, LEGACY_STATE_FILENAME));
16488
+ return _isFile2(path14.join(project, LEGACY_STATE_FILENAME));
16363
16489
  }
16364
16490
  function _detect_legacy_settings(project) {
16365
16491
  const found = [];
16366
16492
  for (const name of LEGACY_SETTINGS_FILES) {
16367
- const flat = path13.join(project, name);
16493
+ const flat = path14.join(project, name);
16368
16494
  if (_isFile2(flat)) {
16369
16495
  found.push(flat);
16370
16496
  }
16371
- const typed = path13.join(project, "settings", name);
16497
+ const typed = path14.join(project, "settings", name);
16372
16498
  if (_isFile2(typed)) {
16373
16499
  found.push(typed);
16374
16500
  }
@@ -16376,25 +16502,25 @@ function _detect_legacy_settings(project) {
16376
16502
  return found;
16377
16503
  }
16378
16504
  function _detect_empty_shell(project) {
16379
- const shell = path13.join(project, LEGACY_AGENT_CONFIG_SHELL);
16505
+ const shell = path14.join(project, LEGACY_AGENT_CONFIG_SHELL);
16380
16506
  if (!_isDir2(shell) || _isSymlink(shell)) {
16381
16507
  return false;
16382
16508
  }
16383
16509
  try {
16384
- return fs15.readdirSync(shell).length === 0;
16510
+ return fs16.readdirSync(shell).length === 0;
16385
16511
  } catch {
16386
16512
  return false;
16387
16513
  }
16388
16514
  }
16389
16515
  function _detect_already_migrated(project) {
16390
- if (_detect_npm(path13.join(project, "package.json"))) {
16516
+ if (_detect_npm(path14.join(project, "package.json"))) {
16391
16517
  return false;
16392
16518
  }
16393
- if (_detect_composer(path13.join(project, "composer.json"))) {
16519
+ if (_detect_composer(path14.join(project, "composer.json"))) {
16394
16520
  return false;
16395
16521
  }
16396
16522
  for (const name of MANAGED_SYMLINKS) {
16397
- if (_classify_symlink(path13.join(project, name)) === "legacy") {
16523
+ if (_classify_symlink(path14.join(project, name)) === "legacy") {
16398
16524
  return false;
16399
16525
  }
16400
16526
  }
@@ -16465,11 +16591,11 @@ function _purge_legacy_symlinks(project) {
16465
16591
  const removed = [];
16466
16592
  const preserved = [];
16467
16593
  for (const name of MANAGED_SYMLINKS) {
16468
- const link = path13.join(project, name);
16594
+ const link = path14.join(project, name);
16469
16595
  const kind = _classify_symlink(link);
16470
16596
  if (kind === "legacy") {
16471
16597
  try {
16472
- fs15.unlinkSync(link);
16598
+ fs16.unlinkSync(link);
16473
16599
  removed.push(name);
16474
16600
  } catch {
16475
16601
  preserved.push(name);
@@ -16481,14 +16607,14 @@ function _purge_legacy_symlinks(project) {
16481
16607
  return [removed, preserved];
16482
16608
  }
16483
16609
  function _migrate_state_file(project) {
16484
- const source = path13.join(project, LEGACY_STATE_FILENAME);
16610
+ const source = path14.join(project, LEGACY_STATE_FILENAME);
16485
16611
  if (!_isFile2(source)) {
16486
16612
  return null;
16487
16613
  }
16488
- const target = path13.join(project, LEGACY_STATE_V1_FILENAME);
16614
+ const target = path14.join(project, LEGACY_STATE_V1_FILENAME);
16489
16615
  if (_exists2(target)) {
16490
16616
  try {
16491
- fs15.unlinkSync(source);
16617
+ fs16.unlinkSync(source);
16492
16618
  return `removed stale ${LEGACY_STATE_FILENAME} (v1 already present)`;
16493
16619
  } catch {
16494
16620
  return null;
@@ -16503,7 +16629,7 @@ function _migrate_state_file(project) {
16503
16629
  }
16504
16630
  function _load_state_migrator() {
16505
16631
  const pkg_root = resolvePackageRoot(import.meta.url);
16506
- const rel = path13.join(
16632
+ const rel = path14.join(
16507
16633
  "agent-src",
16508
16634
  "templates",
16509
16635
  "scripts",
@@ -16511,8 +16637,8 @@ function _load_state_migrator() {
16511
16637
  "migration",
16512
16638
  "v0_to_v1.ts"
16513
16639
  );
16514
- const driver = [path13.join(pkg_root, "dist", rel), path13.join(pkg_root, "src", rel)].find(
16515
- (p) => fs15.existsSync(p)
16640
+ const driver = [path14.join(pkg_root, "dist", rel), path14.join(pkg_root, "src", rel)].find(
16641
+ (p) => fs16.existsSync(p)
16516
16642
  ) ?? null;
16517
16643
  if (driver === null) {
16518
16644
  return null;
@@ -16520,12 +16646,12 @@ function _load_state_migrator() {
16520
16646
  const binName = process2.platform === "win32" ? "tsx.cmd" : "tsx";
16521
16647
  let tsxBin = null;
16522
16648
  for (let dir = pkg_root; ; ) {
16523
- const cand = path13.join(dir, "node_modules", ".bin", binName);
16524
- if (fs15.existsSync(cand)) {
16649
+ const cand = path14.join(dir, "node_modules", ".bin", binName);
16650
+ if (fs16.existsSync(cand)) {
16525
16651
  tsxBin = cand;
16526
16652
  break;
16527
16653
  }
16528
- const parent = path13.dirname(dir);
16654
+ const parent = path14.dirname(dir);
16529
16655
  if (parent === dir) break;
16530
16656
  dir = parent;
16531
16657
  }
@@ -16552,17 +16678,17 @@ function _delete_legacy_settings(project) {
16552
16678
  const removed = [];
16553
16679
  for (const p of _detect_legacy_settings(project)) {
16554
16680
  try {
16555
- fs15.unlinkSync(p);
16556
- removed.push(path13.relative(project, p));
16681
+ fs16.unlinkSync(p);
16682
+ removed.push(path14.relative(project, p));
16557
16683
  } catch {
16558
16684
  continue;
16559
16685
  }
16560
16686
  }
16561
- const settings_dir = path13.join(project, "settings");
16687
+ const settings_dir = path14.join(project, "settings");
16562
16688
  if (_isDir2(settings_dir) && !_isSymlink(settings_dir)) {
16563
16689
  try {
16564
- if (fs15.readdirSync(settings_dir).length === 0) {
16565
- fs15.rmdirSync(settings_dir);
16690
+ if (fs16.readdirSync(settings_dir).length === 0) {
16691
+ fs16.rmdirSync(settings_dir);
16566
16692
  removed.push("settings/");
16567
16693
  }
16568
16694
  } catch {
@@ -16571,12 +16697,12 @@ function _delete_legacy_settings(project) {
16571
16697
  return removed;
16572
16698
  }
16573
16699
  function _remove_empty_shell(project) {
16574
- const shell = path13.join(project, LEGACY_AGENT_CONFIG_SHELL);
16700
+ const shell = path14.join(project, LEGACY_AGENT_CONFIG_SHELL);
16575
16701
  if (!_detect_empty_shell(project)) {
16576
16702
  return false;
16577
16703
  }
16578
16704
  try {
16579
- fs15.rmdirSync(shell);
16705
+ fs16.rmdirSync(shell);
16580
16706
  } catch {
16581
16707
  return false;
16582
16708
  }
@@ -16586,7 +16712,7 @@ function _reEscape(s) {
16586
16712
  return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
16587
16713
  }
16588
16714
  function _update_gitignore(project) {
16589
- const gitignore = path13.join(project, ".gitignore");
16715
+ const gitignore = path14.join(project, ".gitignore");
16590
16716
  const block = `${GITIGNORE_BLOCK_START}
16591
16717
  ${GITIGNORE_NEW_BODY}${GITIGNORE_BLOCK_END}
16592
16718
  `;
@@ -16617,16 +16743,16 @@ ${GITIGNORE_NEW_BODY}${GITIGNORE_BLOCK_END}
16617
16743
  }
16618
16744
  function _build_plan(project) {
16619
16745
  return {
16620
- npm: _detect_npm(path13.join(project, "package.json")),
16621
- composer: _detect_composer(path13.join(project, "composer.json")),
16746
+ npm: _detect_npm(path14.join(project, "package.json")),
16747
+ composer: _detect_composer(path14.join(project, "composer.json")),
16622
16748
  symlinks_legacy: MANAGED_SYMLINKS.filter(
16623
- (name) => _classify_symlink(path13.join(project, name)) === "legacy"
16749
+ (name) => _classify_symlink(path14.join(project, name)) === "legacy"
16624
16750
  ),
16625
16751
  symlinks_user: MANAGED_SYMLINKS.filter(
16626
- (name) => _classify_symlink(path13.join(project, name)) === "user"
16752
+ (name) => _classify_symlink(path14.join(project, name)) === "user"
16627
16753
  ),
16628
- state_file: _isFile2(path13.join(project, LEGACY_STATE_FILENAME)),
16629
- settings_files: _detect_legacy_settings(project).map((p) => path13.relative(project, p)),
16754
+ state_file: _isFile2(path14.join(project, LEGACY_STATE_FILENAME)),
16755
+ settings_files: _detect_legacy_settings(project).map((p) => path14.relative(project, p)),
16630
16756
  empty_shell: _detect_empty_shell(project)
16631
16757
  };
16632
16758
  }
@@ -16690,10 +16816,10 @@ function _warn_on_major_mismatch(from_major, plan, out) {
16690
16816
  }
16691
16817
  function _apply(project, out, err) {
16692
16818
  const summary = [];
16693
- if (_strip_npm_entry(path13.join(project, "package.json"))) {
16819
+ if (_strip_npm_entry(path14.join(project, "package.json"))) {
16694
16820
  summary.push(`removed ${PACKAGE_NAME_NPM} from package.json`);
16695
16821
  }
16696
- if (_strip_composer_entry(path13.join(project, "composer.json"))) {
16822
+ if (_strip_composer_entry(path14.join(project, "composer.json"))) {
16697
16823
  summary.push(`removed ${PACKAGE_NAME_COMPOSER} from composer.json`);
16698
16824
  }
16699
16825
  const [removed_links, preserved_links] = _purge_legacy_symlinks(project);
@@ -16819,13 +16945,13 @@ function _isCliEntry() {
16819
16945
  if (process2.argv[1] === void 0) {
16820
16946
  return false;
16821
16947
  }
16822
- const argvUrl = pathToFileURL(path13.resolve(process2.argv[1])).href;
16948
+ const argvUrl = pathToFileURL(path14.resolve(process2.argv[1])).href;
16823
16949
  if (import.meta.url === argvUrl) {
16824
16950
  return true;
16825
16951
  }
16826
16952
  try {
16827
- const here = fs15.realpathSync(fileURLToPath3(import.meta.url));
16828
- const argv = fs15.realpathSync(path13.resolve(process2.argv[1]));
16953
+ const here = fs16.realpathSync(fileURLToPath3(import.meta.url));
16954
+ const argv = fs16.realpathSync(path14.resolve(process2.argv[1]));
16829
16955
  return here === argv;
16830
16956
  } catch {
16831
16957
  return false;
@@ -16862,34 +16988,34 @@ var ArgparseExit2 = class extends Error {
16862
16988
  function expanduser6(p) {
16863
16989
  if (p === "~") return os7.homedir();
16864
16990
  if (p.startsWith("~/") || p.startsWith("~\\")) {
16865
- return path14.join(os7.homedir(), p.slice(2));
16991
+ return path15.join(os7.homedir(), p.slice(2));
16866
16992
  }
16867
16993
  return p;
16868
16994
  }
16869
16995
  function resolvePath(p) {
16870
16996
  try {
16871
- return fs16.realpathSync(path14.resolve(p));
16997
+ return fs17.realpathSync(path15.resolve(p));
16872
16998
  } catch {
16873
- return path14.resolve(p);
16999
+ return path15.resolve(p);
16874
17000
  }
16875
17001
  }
16876
17002
  function isFile(p) {
16877
17003
  try {
16878
- return fs16.statSync(p).isFile();
17004
+ return fs17.statSync(p).isFile();
16879
17005
  } catch {
16880
17006
  return false;
16881
17007
  }
16882
17008
  }
16883
17009
  function isDir(p) {
16884
17010
  try {
16885
- return fs16.statSync(p).isDirectory();
17011
+ return fs17.statSync(p).isDirectory();
16886
17012
  } catch {
16887
17013
  return false;
16888
17014
  }
16889
17015
  }
16890
17016
  function pathExists(p) {
16891
17017
  try {
16892
- fs16.statSync(p);
17018
+ fs17.statSync(p);
16893
17019
  return true;
16894
17020
  } catch {
16895
17021
  return false;
@@ -16897,24 +17023,24 @@ function pathExists(p) {
16897
17023
  }
16898
17024
  function isSymlink(p) {
16899
17025
  try {
16900
- return fs16.lstatSync(p).isSymbolicLink();
17026
+ return fs17.lstatSync(p).isSymbolicLink();
16901
17027
  } catch {
16902
17028
  return false;
16903
17029
  }
16904
17030
  }
16905
17031
  function readText(p) {
16906
- return fs16.readFileSync(p, "utf-8");
17032
+ return fs17.readFileSync(p, "utf-8");
16907
17033
  }
16908
17034
  function writeText(p, content) {
16909
- fs16.writeFileSync(p, content, "utf-8");
17035
+ fs17.writeFileSync(p, content, "utf-8");
16910
17036
  }
16911
17037
  function mkdirp(p) {
16912
- fs16.mkdirSync(p, { recursive: true });
17038
+ fs17.mkdirSync(p, { recursive: true });
16913
17039
  }
16914
17040
  function sortedGlobStems(directory, suffix) {
16915
17041
  let entries;
16916
17042
  try {
16917
- entries = fs16.readdirSync(directory);
17043
+ entries = fs17.readdirSync(directory);
16918
17044
  } catch {
16919
17045
  return [];
16920
17046
  }
@@ -16934,7 +17060,7 @@ function sortedGlobStems(directory, suffix) {
16934
17060
  function countZips(directory) {
16935
17061
  if (!isDir(directory)) return 0;
16936
17062
  let n = 0;
16937
- for (const name of fs16.readdirSync(directory)) {
17063
+ for (const name of fs17.readdirSync(directory)) {
16938
17064
  if (name.endsWith(".zip")) n += 1;
16939
17065
  }
16940
17066
  return n;
@@ -16942,35 +17068,35 @@ function countZips(directory) {
16942
17068
  function sha256OfFile(p) {
16943
17069
  let data;
16944
17070
  try {
16945
- data = fs16.readFileSync(p);
17071
+ data = fs17.readFileSync(p);
16946
17072
  } catch {
16947
17073
  return null;
16948
17074
  }
16949
17075
  return crypto3.createHash("sha256").update(data).digest("hex");
16950
17076
  }
16951
17077
  function atomicWrite0644(target, body, prefix) {
16952
- const dir = path14.dirname(target);
16953
- const tmpName = path14.join(
17078
+ const dir = path15.dirname(target);
17079
+ const tmpName = path15.join(
16954
17080
  dir,
16955
17081
  `${prefix}${process3.pid}.${crypto3.randomBytes(6).toString("hex")}.yml.tmp`
16956
17082
  );
16957
17083
  let fd = null;
16958
17084
  try {
16959
- fd = fs16.openSync(tmpName, "wx", 420);
16960
- fs16.writeFileSync(fd, body, "utf-8");
16961
- fs16.closeSync(fd);
17085
+ fd = fs17.openSync(tmpName, "wx", 420);
17086
+ fs17.writeFileSync(fd, body, "utf-8");
17087
+ fs17.closeSync(fd);
16962
17088
  fd = null;
16963
- fs16.chmodSync(tmpName, 420);
16964
- fs16.renameSync(tmpName, target);
17089
+ fs17.chmodSync(tmpName, 420);
17090
+ fs17.renameSync(tmpName, target);
16965
17091
  } catch (err) {
16966
17092
  if (fd !== null) {
16967
17093
  try {
16968
- fs16.closeSync(fd);
17094
+ fs17.closeSync(fd);
16969
17095
  } catch {
16970
17096
  }
16971
17097
  }
16972
17098
  try {
16973
- fs16.unlinkSync(tmpName);
17099
+ fs17.unlinkSync(tmpName);
16974
17100
  } catch {
16975
17101
  }
16976
17102
  throw err;
@@ -17070,7 +17196,7 @@ function jsonDumpsCompact(value) {
17070
17196
  }
17071
17197
  return _jsonStrNoAscii(String(value));
17072
17198
  }
17073
- function yamlSafeLoad(text) {
17199
+ function yamlSafeLoad2(text) {
17074
17200
  let YAML3;
17075
17201
  try {
17076
17202
  YAML3 = require_dist();
@@ -17094,12 +17220,12 @@ var LEGACY_SETTINGS_FILE = ".agent-settings";
17094
17220
  var LEGACY_BACKUP_FILE = ".agent-settings.backup.key-value";
17095
17221
  var SETTINGS_SUBDIR = ["agents", "settings"];
17096
17222
  function _canonical_settings_target(project_root) {
17097
- return path14.join(project_root, ...SETTINGS_SUBDIR, SETTINGS_FILE);
17223
+ return path15.join(project_root, ...SETTINGS_SUBDIR, SETTINGS_FILE);
17098
17224
  }
17099
17225
  function _resolve_settings_read(project_root) {
17100
17226
  const canonical = _canonical_settings_target(project_root);
17101
17227
  if (pathExists(canonical)) return canonical;
17102
- const legacy = path14.join(project_root, SETTINGS_FILE);
17228
+ const legacy = path15.join(project_root, SETTINGS_FILE);
17103
17229
  if (pathExists(legacy)) return legacy;
17104
17230
  return canonical;
17105
17231
  }
@@ -17163,9 +17289,9 @@ function fail(msg) {
17163
17289
  throw new SystemExitError(1);
17164
17290
  }
17165
17291
  function detect_package_root(project_root) {
17166
- const npm_path = path14.join(project_root, "node_modules", "@event4u", "agent-config");
17292
+ const npm_path = path15.join(project_root, "node_modules", "@event4u", "agent-config");
17167
17293
  if (isDir(npm_path)) return resolvePath(npm_path);
17168
- if (pathExists(path14.join(project_root, "src", "config", "profiles", "minimal.ini"))) {
17294
+ if (pathExists(path15.join(project_root, "src", "config", "profiles", "minimal.ini"))) {
17169
17295
  return project_root;
17170
17296
  }
17171
17297
  fail(
@@ -17173,12 +17299,12 @@ function detect_package_root(project_root) {
17173
17299
  );
17174
17300
  }
17175
17301
  function detect_package_type(package_root) {
17176
- if (package_root.split(path14.sep).includes("node_modules")) return "npm";
17302
+ if (package_root.split(path15.sep).includes("node_modules")) return "npm";
17177
17303
  return "local";
17178
17304
  }
17179
17305
  function detect_package_type_for_project(project_root, package_root) {
17180
17306
  const npm_path = resolvePath(
17181
- path14.join(project_root, "node_modules", "@event4u", "agent-config")
17307
+ path15.join(project_root, "node_modules", "@event4u", "agent-config")
17182
17308
  );
17183
17309
  const package_resolved = resolvePath(package_root);
17184
17310
  if (package_resolved === npm_path) return "npm";
@@ -17198,7 +17324,7 @@ function ensure_directory(p) {
17198
17324
  mkdirp(p);
17199
17325
  }
17200
17326
  function write_file(p, content) {
17201
- ensure_directory(path14.dirname(p));
17327
+ ensure_directory(path15.dirname(p));
17202
17328
  writeText(p, content);
17203
17329
  }
17204
17330
  function read_json_file(p) {
@@ -17369,7 +17495,7 @@ function _append_unknown_legacy(rendered, legacy_values, unknown_keys) {
17369
17495
  return rendered + "\n" + suffix;
17370
17496
  }
17371
17497
  function _migrate_legacy_if_present(project_root, template_body) {
17372
- const legacy_target = path14.join(project_root, LEGACY_SETTINGS_FILE);
17498
+ const legacy_target = path15.join(project_root, LEGACY_SETTINGS_FILE);
17373
17499
  if (!isFile(legacy_target)) return null;
17374
17500
  const legacy_text = readText(legacy_target);
17375
17501
  const [values, unknown] = _parse_legacy_settings(legacy_text);
@@ -17384,9 +17510,9 @@ function _migrate_legacy_if_present(project_root, template_body) {
17384
17510
  }
17385
17511
  }
17386
17512
  rendered = _append_unknown_legacy(rendered, values, unknown);
17387
- const backup_target = path14.join(project_root, LEGACY_BACKUP_FILE);
17513
+ const backup_target = path15.join(project_root, LEGACY_BACKUP_FILE);
17388
17514
  writeText(backup_target, legacy_text);
17389
- fs16.unlinkSync(legacy_target);
17515
+ fs17.unlinkSync(legacy_target);
17390
17516
  info(`Migrated legacy ${LEGACY_SETTINGS_FILE} \u2192 ${SETTINGS_FILE}`);
17391
17517
  info(`Backup saved to ${LEGACY_BACKUP_FILE}`);
17392
17518
  if (unknown.length > 0) {
@@ -17421,7 +17547,7 @@ function _render_template(template, profile_values) {
17421
17547
  return body;
17422
17548
  }
17423
17549
  function _load_valid_user_types(package_root) {
17424
- const directory = path14.join(package_root, USER_TYPES_DIR);
17550
+ const directory = path15.join(package_root, USER_TYPES_DIR);
17425
17551
  if (!isDir(directory)) return [];
17426
17552
  return sortedGlobStems(directory, ".yml");
17427
17553
  }
@@ -17478,8 +17604,8 @@ function splitlinesKeepends(text) {
17478
17604
  }
17479
17605
  function ensure_agent_settings(project_root, package_root, profile, force, user_type = "", packs = null) {
17480
17606
  const target = _canonical_settings_target(project_root);
17481
- const profile_source = path14.join(package_root, "src", "config", "profiles", `${profile}.ini`);
17482
- const template_source = path14.join(package_root, "src", "config", "agent-settings.template.yml");
17607
+ const profile_source = path15.join(package_root, "src", "config", "profiles", `${profile}.ini`);
17608
+ const template_source = path15.join(package_root, "src", "config", "agent-settings.template.yml");
17483
17609
  if (!pathExists(profile_source)) fail(`Missing profile preset: ${profile_source}`);
17484
17610
  if (!pathExists(template_source)) fail(`Missing settings template: ${template_source}`);
17485
17611
  const template = readText(template_source);
@@ -17493,21 +17619,21 @@ function ensure_agent_settings(project_root, package_root, profile, force, user_
17493
17619
  if (profile_values["rule_loading_tier"] !== profile) {
17494
17620
  const got = "rule_loading_tier" in profile_values ? `'${profile_values["rule_loading_tier"]}'` : "None";
17495
17621
  fail(
17496
- `Profile preset ${path14.basename(profile_source)} has rule_loading_tier=${got} but --profile=${profile}`
17622
+ `Profile preset ${path15.basename(profile_source)} has rule_loading_tier=${got} but --profile=${profile}`
17497
17623
  );
17498
17624
  }
17499
17625
  profile_values["user_type"] = _validate_user_type(package_root, user_type);
17500
17626
  let template_body = _render_template(template, profile_values);
17501
17627
  template_body = _inject_packs(template_body, packs ?? []);
17502
- const legacy_root = path14.join(project_root, SETTINGS_FILE);
17628
+ const legacy_root = path15.join(project_root, SETTINGS_FILE);
17503
17629
  if (isFile(legacy_root) && !pathExists(target)) {
17504
- mkdirp(path14.dirname(target));
17630
+ mkdirp(path15.dirname(target));
17505
17631
  writeText(target, readText(legacy_root));
17506
- fs16.unlinkSync(legacy_root);
17632
+ fs17.unlinkSync(legacy_root);
17507
17633
  success(`Migrated ${SETTINGS_FILE} \u2192 agents/settings/${SETTINGS_FILE} (ADR-038)`);
17508
17634
  return;
17509
17635
  }
17510
- const legacy_target = path14.join(project_root, LEGACY_SETTINGS_FILE);
17636
+ const legacy_target = path15.join(project_root, LEGACY_SETTINGS_FILE);
17511
17637
  if (isFile(legacy_target) && pathExists(target)) {
17512
17638
  warn(
17513
17639
  `Both ${SETTINGS_FILE} and legacy ${LEGACY_SETTINGS_FILE} exist. Skipping migration to avoid overwriting ${SETTINGS_FILE}. Delete one of them manually and re-run.`
@@ -17524,7 +17650,7 @@ function ensure_agent_settings(project_root, package_root, profile, force, user_
17524
17650
  skip(`${SETTINGS_FILE} already exists`);
17525
17651
  return;
17526
17652
  }
17527
- mkdirp(path14.dirname(target));
17653
+ mkdirp(path15.dirname(target));
17528
17654
  write_file(target, template_body);
17529
17655
  const user_type_value = profile_values["user_type"] ?? "";
17530
17656
  const suffix = user_type_value ? `, user_type=${user_type_value}` : "";
@@ -17537,7 +17663,7 @@ function ensure_vscode_bridge(project_root, package_type, force) {
17537
17663
  const plugin_path = plugin_paths[package_type] ?? "./plugin/agent-config";
17538
17664
  const bridge = { "chat.pluginLocations": { [plugin_path]: true } };
17539
17665
  merge_json_file(
17540
- path14.join(project_root, ".vscode", "settings.json"),
17666
+ path15.join(project_root, ".vscode", "settings.json"),
17541
17667
  bridge,
17542
17668
  force,
17543
17669
  ".vscode/settings.json"
@@ -17546,14 +17672,14 @@ function ensure_vscode_bridge(project_root, package_type, force) {
17546
17672
  function ensure_augment_bridge(project_root, force) {
17547
17673
  const bridge = { enabledPlugins: { "agent-config@event4u": true } };
17548
17674
  return merge_json_file(
17549
- path14.join(project_root, ".augment", "settings.json"),
17675
+ path15.join(project_root, ".augment", "settings.json"),
17550
17676
  bridge,
17551
17677
  force,
17552
17678
  ".augment/settings.json"
17553
17679
  );
17554
17680
  }
17555
- var AUGMENT_USER_DIR = path14.join(os7.homedir(), ".augment");
17556
- var AUGMENT_USER_HOOKS_DIR = path14.join(AUGMENT_USER_DIR, "hooks");
17681
+ var AUGMENT_USER_DIR = path15.join(os7.homedir(), ".augment");
17682
+ var AUGMENT_USER_HOOKS_DIR = path15.join(AUGMENT_USER_DIR, "hooks");
17557
17683
  var AUGMENT_DISPATCHER_TRAMPOLINE = "augment-dispatcher.sh";
17558
17684
  var AUGMENT_LEGACY_TRAMPOLINES = [
17559
17685
  "augment-chat-history.sh",
@@ -17569,29 +17695,29 @@ var AUGMENT_DISPATCHER_BINDINGS = [
17569
17695
  ["post_tool_use", "PostToolUse"]
17570
17696
  ];
17571
17697
  function _deploy_augment_trampoline(package_root, name, force) {
17572
- const src = path14.join(package_root, "scripts", "hooks", name);
17698
+ const src = path15.join(package_root, "scripts", "hooks", name);
17573
17699
  if (!pathExists(src)) {
17574
17700
  skip(`augment trampoline missing in package: ${src}`);
17575
17701
  return null;
17576
17702
  }
17577
17703
  mkdirp(AUGMENT_USER_HOOKS_DIR);
17578
- const dst = path14.join(AUGMENT_USER_HOOKS_DIR, name);
17704
+ const dst = path15.join(AUGMENT_USER_HOOKS_DIR, name);
17579
17705
  const src_text = readText(src);
17580
17706
  if (pathExists(dst) && readText(dst) === src_text && !force) {
17581
17707
  skip(`~/.augment/hooks/${name} already up to date`);
17582
17708
  } else {
17583
17709
  writeText(dst, src_text);
17584
- fs16.chmodSync(dst, 493);
17710
+ fs17.chmodSync(dst, 493);
17585
17711
  success(`~/.augment/hooks/${name} installed`);
17586
17712
  }
17587
17713
  return dst;
17588
17714
  }
17589
17715
  function _remove_legacy_augment_trampolines() {
17590
17716
  for (const name of AUGMENT_LEGACY_TRAMPOLINES) {
17591
- const legacy = path14.join(AUGMENT_USER_HOOKS_DIR, name);
17717
+ const legacy = path15.join(AUGMENT_USER_HOOKS_DIR, name);
17592
17718
  try {
17593
17719
  if (isFile(legacy)) {
17594
- fs16.unlinkSync(legacy);
17720
+ fs17.unlinkSync(legacy);
17595
17721
  skip(`removed legacy ~/.augment/hooks/${name}`);
17596
17722
  }
17597
17723
  } catch {
@@ -17610,7 +17736,7 @@ function ensure_augment_user_hooks(package_root, force) {
17610
17736
  }
17611
17737
  const settings_patch = { hooks: per_event };
17612
17738
  return merge_json_file(
17613
- path14.join(AUGMENT_USER_DIR, "settings.json"),
17739
+ path15.join(AUGMENT_USER_DIR, "settings.json"),
17614
17740
  settings_patch,
17615
17741
  force,
17616
17742
  "~/.augment/settings.json"
@@ -17635,7 +17761,7 @@ function _heal_legacy_claude_plugin_ids(p) {
17635
17761
  return removed;
17636
17762
  }
17637
17763
  function ensure_claude_bridge(project_root, force) {
17638
- const target = path14.join(project_root, ".claude", "settings.json");
17764
+ const target = path15.join(project_root, ".claude", "settings.json");
17639
17765
  const healed = _heal_legacy_claude_plugin_ids(target);
17640
17766
  for (const pid of healed) {
17641
17767
  success(`.claude/settings.json: removed stale plugin id \`${pid}\``);
@@ -17660,29 +17786,29 @@ function ensure_cursor_bridge(project_root, force) {
17660
17786
  }
17661
17787
  const bridge = { version: 1, hooks };
17662
17788
  return merge_json_file(
17663
- path14.join(project_root, ".cursor", "hooks.json"),
17789
+ path15.join(project_root, ".cursor", "hooks.json"),
17664
17790
  bridge,
17665
17791
  force,
17666
17792
  ".cursor/hooks.json"
17667
17793
  );
17668
17794
  }
17669
- var CURSOR_USER_DIR = path14.join(os7.homedir(), ".cursor");
17670
- var CURSOR_USER_HOOKS_DIR = path14.join(CURSOR_USER_DIR, "hooks");
17795
+ var CURSOR_USER_DIR = path15.join(os7.homedir(), ".cursor");
17796
+ var CURSOR_USER_HOOKS_DIR = path15.join(CURSOR_USER_DIR, "hooks");
17671
17797
  var CURSOR_DISPATCHER_TRAMPOLINE = "cursor-dispatcher.sh";
17672
17798
  function ensure_cursor_user_hooks(package_root, force) {
17673
- const src = path14.join(package_root, "scripts", "hooks", CURSOR_DISPATCHER_TRAMPOLINE);
17799
+ const src = path15.join(package_root, "scripts", "hooks", CURSOR_DISPATCHER_TRAMPOLINE);
17674
17800
  if (!pathExists(src)) {
17675
17801
  skip(`cursor trampoline missing in package: ${src}`);
17676
17802
  return [];
17677
17803
  }
17678
17804
  mkdirp(CURSOR_USER_HOOKS_DIR);
17679
- const dst = path14.join(CURSOR_USER_HOOKS_DIR, CURSOR_DISPATCHER_TRAMPOLINE);
17805
+ const dst = path15.join(CURSOR_USER_HOOKS_DIR, CURSOR_DISPATCHER_TRAMPOLINE);
17680
17806
  const src_text = readText(src);
17681
17807
  if (pathExists(dst) && readText(dst) === src_text && !force) {
17682
17808
  skip(`~/.cursor/hooks/${CURSOR_DISPATCHER_TRAMPOLINE} already up to date`);
17683
17809
  } else {
17684
17810
  writeText(dst, src_text);
17685
- fs16.chmodSync(dst, 493);
17811
+ fs17.chmodSync(dst, 493);
17686
17812
  success(`~/.cursor/hooks/${CURSOR_DISPATCHER_TRAMPOLINE} installed`);
17687
17813
  }
17688
17814
  const hooks = {};
@@ -17691,7 +17817,7 @@ function ensure_cursor_user_hooks(package_root, force) {
17691
17817
  }
17692
17818
  const settings_patch = { version: 1, hooks };
17693
17819
  return merge_json_file(
17694
- path14.join(CURSOR_USER_DIR, "hooks.json"),
17820
+ path15.join(CURSOR_USER_DIR, "hooks.json"),
17695
17821
  settings_patch,
17696
17822
  force,
17697
17823
  "~/.cursor/hooks.json"
@@ -17734,12 +17860,12 @@ exit 0
17734
17860
  `;
17735
17861
  }
17736
17862
  function ensure_cline_bridge(project_root, force) {
17737
- const hooks_dir = path14.join(project_root, ".clinerules", "hooks");
17863
+ const hooks_dir = path15.join(project_root, ".clinerules", "hooks");
17738
17864
  mkdirp(hooks_dir);
17739
17865
  const workspace_quoted = shlexQuote(resolvePath(project_root));
17740
17866
  let written = 0;
17741
17867
  for (const [ac_event, native_event] of CLINE_DISPATCHER_BINDINGS) {
17742
- const target = path14.join(hooks_dir, native_event);
17868
+ const target = path15.join(hooks_dir, native_event);
17743
17869
  const body = clineProjectHookBody(native_event, ac_event, workspace_quoted);
17744
17870
  if (pathExists(target) && readText(target) === body && !force) {
17745
17871
  continue;
@@ -17749,7 +17875,7 @@ function ensure_cline_bridge(project_root, force) {
17749
17875
  continue;
17750
17876
  }
17751
17877
  writeText(target, body);
17752
- fs16.chmodSync(target, 493);
17878
+ fs17.chmodSync(target, 493);
17753
17879
  written += 1;
17754
17880
  }
17755
17881
  if (written) {
@@ -17758,27 +17884,27 @@ function ensure_cline_bridge(project_root, force) {
17758
17884
  skip(".clinerules/hooks/ already up to date");
17759
17885
  }
17760
17886
  }
17761
- var CLINE_USER_DIR = path14.join(os7.homedir(), "Documents", "Cline", "Hooks");
17887
+ var CLINE_USER_DIR = path15.join(os7.homedir(), "Documents", "Cline", "Hooks");
17762
17888
  var CLINE_DISPATCHER_TRAMPOLINE = "cline-dispatcher.sh";
17763
17889
  function ensure_cline_user_hooks(package_root, force) {
17764
- const src = path14.join(package_root, "scripts", "hooks", CLINE_DISPATCHER_TRAMPOLINE);
17890
+ const src = path15.join(package_root, "scripts", "hooks", CLINE_DISPATCHER_TRAMPOLINE);
17765
17891
  if (!pathExists(src)) {
17766
17892
  skip(`cline trampoline missing in package: ${src}`);
17767
17893
  return;
17768
17894
  }
17769
17895
  mkdirp(CLINE_USER_DIR);
17770
- const trampoline = path14.join(CLINE_USER_DIR, CLINE_DISPATCHER_TRAMPOLINE);
17896
+ const trampoline = path15.join(CLINE_USER_DIR, CLINE_DISPATCHER_TRAMPOLINE);
17771
17897
  const src_text = readText(src);
17772
17898
  if (pathExists(trampoline) && readText(trampoline) === src_text && !force) {
17773
17899
  skip(`~/Documents/Cline/Hooks/${CLINE_DISPATCHER_TRAMPOLINE} already up to date`);
17774
17900
  } else {
17775
17901
  writeText(trampoline, src_text);
17776
- fs16.chmodSync(trampoline, 493);
17902
+ fs17.chmodSync(trampoline, 493);
17777
17903
  success(`~/Documents/Cline/Hooks/${CLINE_DISPATCHER_TRAMPOLINE} installed`);
17778
17904
  }
17779
17905
  const trampoline_quoted = shlexQuote(trampoline);
17780
17906
  for (const [ac_event, native_event] of CLINE_DISPATCHER_BINDINGS) {
17781
- const wrapper = path14.join(CLINE_USER_DIR, native_event);
17907
+ const wrapper = path15.join(CLINE_USER_DIR, native_event);
17782
17908
  const body = `#!/usr/bin/env bash
17783
17909
  # Generated by event4u/agent-config install.py \u2014 DO NOT EDIT.
17784
17910
  # User-scope Cline hook for ${native_event} \u2192 agent-config ${ac_event}.
@@ -17788,7 +17914,7 @@ exec ${trampoline_quoted} ${ac_event} ${native_event}
17788
17914
  continue;
17789
17915
  }
17790
17916
  writeText(wrapper, body);
17791
- fs16.chmodSync(wrapper, 493);
17917
+ fs17.chmodSync(wrapper, 493);
17792
17918
  }
17793
17919
  }
17794
17920
  var WINDSURF_DISPATCHER_BINDINGS = [
@@ -17809,29 +17935,29 @@ function ensure_windsurf_bridge(project_root, force) {
17809
17935
  }
17810
17936
  const bridge = { hooks };
17811
17937
  return merge_json_file(
17812
- path14.join(project_root, ".windsurf", "hooks.json"),
17938
+ path15.join(project_root, ".windsurf", "hooks.json"),
17813
17939
  bridge,
17814
17940
  force,
17815
17941
  ".windsurf/hooks.json"
17816
17942
  );
17817
17943
  }
17818
- var WINDSURF_USER_DIR = path14.join(os7.homedir(), ".codeium", "windsurf");
17819
- var WINDSURF_USER_HOOKS_DIR = path14.join(WINDSURF_USER_DIR, "hooks");
17944
+ var WINDSURF_USER_DIR = path15.join(os7.homedir(), ".codeium", "windsurf");
17945
+ var WINDSURF_USER_HOOKS_DIR = path15.join(WINDSURF_USER_DIR, "hooks");
17820
17946
  var WINDSURF_DISPATCHER_TRAMPOLINE = "windsurf-dispatcher.sh";
17821
17947
  function ensure_windsurf_user_hooks(package_root, force) {
17822
- const src = path14.join(package_root, "scripts", "hooks", WINDSURF_DISPATCHER_TRAMPOLINE);
17948
+ const src = path15.join(package_root, "scripts", "hooks", WINDSURF_DISPATCHER_TRAMPOLINE);
17823
17949
  if (!pathExists(src)) {
17824
17950
  skip(`windsurf trampoline missing in package: ${src}`);
17825
17951
  return [];
17826
17952
  }
17827
17953
  mkdirp(WINDSURF_USER_HOOKS_DIR);
17828
- const dst = path14.join(WINDSURF_USER_HOOKS_DIR, WINDSURF_DISPATCHER_TRAMPOLINE);
17954
+ const dst = path15.join(WINDSURF_USER_HOOKS_DIR, WINDSURF_DISPATCHER_TRAMPOLINE);
17829
17955
  const src_text = readText(src);
17830
17956
  if (pathExists(dst) && readText(dst) === src_text && !force) {
17831
17957
  skip(`~/.codeium/windsurf/hooks/${WINDSURF_DISPATCHER_TRAMPOLINE} already up to date`);
17832
17958
  } else {
17833
17959
  writeText(dst, src_text);
17834
- fs16.chmodSync(dst, 493);
17960
+ fs17.chmodSync(dst, 493);
17835
17961
  success(`~/.codeium/windsurf/hooks/${WINDSURF_DISPATCHER_TRAMPOLINE} installed`);
17836
17962
  }
17837
17963
  const hooks = {};
@@ -17843,7 +17969,7 @@ function ensure_windsurf_user_hooks(package_root, force) {
17843
17969
  }
17844
17970
  const settings_patch = { hooks };
17845
17971
  return merge_json_file(
17846
- path14.join(WINDSURF_USER_DIR, "hooks.json"),
17972
+ path15.join(WINDSURF_USER_DIR, "hooks.json"),
17847
17973
  settings_patch,
17848
17974
  force,
17849
17975
  "~/.codeium/windsurf/hooks.json"
@@ -17872,43 +17998,43 @@ function _gemini_hooks_dict(command_factory) {
17872
17998
  function ensure_gemini_bridge(project_root, force) {
17873
17999
  const bridge = { hooks: _gemini_hooks_dict(_gemini_dispatch_command) };
17874
18000
  return merge_json_file(
17875
- path14.join(project_root, ".gemini", "settings.json"),
18001
+ path15.join(project_root, ".gemini", "settings.json"),
17876
18002
  bridge,
17877
18003
  force,
17878
18004
  ".gemini/settings.json"
17879
18005
  );
17880
18006
  }
17881
- var GEMINI_USER_DIR = path14.join(os7.homedir(), ".gemini");
17882
- var GEMINI_USER_HOOKS_DIR = path14.join(GEMINI_USER_DIR, "hooks");
18007
+ var GEMINI_USER_DIR = path15.join(os7.homedir(), ".gemini");
18008
+ var GEMINI_USER_HOOKS_DIR = path15.join(GEMINI_USER_DIR, "hooks");
17883
18009
  var GEMINI_DISPATCHER_TRAMPOLINE = "gemini-dispatcher.sh";
17884
18010
  function ensure_gemini_user_hooks(package_root, force) {
17885
- const src = path14.join(package_root, "scripts", "hooks", GEMINI_DISPATCHER_TRAMPOLINE);
18011
+ const src = path15.join(package_root, "scripts", "hooks", GEMINI_DISPATCHER_TRAMPOLINE);
17886
18012
  if (!pathExists(src)) {
17887
18013
  skip(`gemini trampoline missing in package: ${src}`);
17888
18014
  return [];
17889
18015
  }
17890
18016
  mkdirp(GEMINI_USER_HOOKS_DIR);
17891
- const dst = path14.join(GEMINI_USER_HOOKS_DIR, GEMINI_DISPATCHER_TRAMPOLINE);
18017
+ const dst = path15.join(GEMINI_USER_HOOKS_DIR, GEMINI_DISPATCHER_TRAMPOLINE);
17892
18018
  const src_text = readText(src);
17893
18019
  if (pathExists(dst) && readText(dst) === src_text && !force) {
17894
18020
  skip(`~/.gemini/hooks/${GEMINI_DISPATCHER_TRAMPOLINE} already up to date`);
17895
18021
  } else {
17896
18022
  writeText(dst, src_text);
17897
- fs16.chmodSync(dst, 493);
18023
+ fs17.chmodSync(dst, 493);
17898
18024
  success(`~/.gemini/hooks/${GEMINI_DISPATCHER_TRAMPOLINE} installed`);
17899
18025
  }
17900
18026
  const settings_patch = {
17901
18027
  hooks: _gemini_hooks_dict((ac_event, native) => `${dst} ${ac_event} ${native}`)
17902
18028
  };
17903
18029
  return merge_json_file(
17904
- path14.join(GEMINI_USER_DIR, "settings.json"),
18030
+ path15.join(GEMINI_USER_DIR, "settings.json"),
17905
18031
  settings_patch,
17906
18032
  force,
17907
18033
  "~/.gemini/settings.json"
17908
18034
  );
17909
18035
  }
17910
18036
  function ensure_copilot_bridge(project_root, force) {
17911
- const target = path14.join(project_root, ".github", "plugin", "marketplace.json");
18037
+ const target = path15.join(project_root, ".github", "plugin", "marketplace.json");
17912
18038
  const bridge = {
17913
18039
  marketplace: {
17914
18040
  name: "event4u-agent-marketplace",
@@ -17951,7 +18077,7 @@ See \`docs/setup/per-ide/roocode.md\` for the full activation guide.
17951
18077
  Run \`./agent-config --help\` for available commands.
17952
18078
  `;
17953
18079
  function ensure_roocode_bridge(project_root, force) {
17954
- const target = path14.join(project_root, ".roo", "rules", "agent-config.md");
18080
+ const target = path15.join(project_root, ".roo", "rules", "agent-config.md");
17955
18081
  if (pathExists(target) && !force) {
17956
18082
  skip(".roo/rules/agent-config.md already exists");
17957
18083
  return;
@@ -17973,7 +18099,7 @@ To wire Claude Desktop to this project's rules, run:
17973
18099
  Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
17974
18100
  `;
17975
18101
  function ensure_claude_desktop_bridge(project_root, force) {
17976
- const target = path14.join(project_root, ".claude-desktop", "agent-config.md");
18102
+ const target = path15.join(project_root, ".claude-desktop", "agent-config.md");
17977
18103
  if (pathExists(target) && !force) {
17978
18104
  skip(".claude-desktop/agent-config.md already exists");
17979
18105
  return;
@@ -17998,7 +18124,7 @@ Or pass \`--read .aider/agent-config.md\` on the command line.
17998
18124
  Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
17999
18125
  `;
18000
18126
  function ensure_aider_bridge(project_root, force) {
18001
- const target = path14.join(project_root, ".aider", "agent-config.md");
18127
+ const target = path15.join(project_root, ".aider", "agent-config.md");
18002
18128
  if (pathExists(target) && !force) {
18003
18129
  skip(".aider/agent-config.md already exists");
18004
18130
  return;
@@ -18017,7 +18143,7 @@ developers where the rules and skills live.
18017
18143
  Canonical rule and skill source: \`.augment/\` (see project \`AGENTS.md\`).
18018
18144
  `;
18019
18145
  function ensure_codex_bridge(project_root, force) {
18020
- const target = path14.join(project_root, ".codex", "agent-config.md");
18146
+ const target = path15.join(project_root, ".codex", "agent-config.md");
18021
18147
  if (pathExists(target) && !force) {
18022
18148
  skip(".codex/agent-config.md already exists");
18023
18149
  return;
@@ -18035,7 +18161,7 @@ rules per session. The canonical rule and skill source lives under
18035
18161
  orientation).
18036
18162
  `;
18037
18163
  function ensure_continue_bridge(project_root, force) {
18038
- const target = path14.join(project_root, ".continue", "rules", "agent-config.md");
18164
+ const target = path15.join(project_root, ".continue", "rules", "agent-config.md");
18039
18165
  if (pathExists(target) && !force) {
18040
18166
  skip(".continue/rules/agent-config.md already exists");
18041
18167
  return;
@@ -18066,7 +18192,7 @@ orientation).
18066
18192
  See \`docs/setup/per-ide/kilocode.md\` for the full activation guide.
18067
18193
  `;
18068
18194
  function ensure_kilocode_bridge(project_root, force) {
18069
- const target = path14.join(project_root, ".kilocode", "rules", "agent-config.md");
18195
+ const target = path15.join(project_root, ".kilocode", "rules", "agent-config.md");
18070
18196
  if (pathExists(target) && !force) {
18071
18197
  skip(".kilocode/rules/agent-config.md already exists");
18072
18198
  return;
@@ -18093,7 +18219,7 @@ canonical source (or symlink it):
18093
18219
  Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
18094
18220
  `;
18095
18221
  function ensure_zed_bridge(project_root, force) {
18096
- const target = path14.join(project_root, ".zed", "agent-config.md");
18222
+ const target = path15.join(project_root, ".zed", "agent-config.md");
18097
18223
  if (pathExists(target) && !force) {
18098
18224
  skip(".zed/agent-config.md already exists");
18099
18225
  return;
@@ -18114,7 +18240,7 @@ rules into your JetBrains profile.
18114
18240
  Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
18115
18241
  `;
18116
18242
  function ensure_jetbrains_bridge(project_root, force) {
18117
- const target = path14.join(project_root, ".jetbrains", "agent-config.md");
18243
+ const target = path15.join(project_root, ".jetbrains", "agent-config.md");
18118
18244
  if (pathExists(target) && !force) {
18119
18245
  skip(".jetbrains/agent-config.md already exists");
18120
18246
  return;
@@ -18145,7 +18271,7 @@ session. The canonical rule and skill source lives under \`.augment/\`
18145
18271
  See \`docs/setup/per-ide/kiro.md\` for the full activation guide.
18146
18272
  `;
18147
18273
  function ensure_kiro_bridge(project_root, force) {
18148
- const target = path14.join(project_root, ".kiro", "steering", "agent-config.md");
18274
+ const target = path15.join(project_root, ".kiro", "steering", "agent-config.md");
18149
18275
  if (pathExists(target) && !force) {
18150
18276
  skip(".kiro/steering/agent-config.md already exists");
18151
18277
  return;
@@ -18171,35 +18297,35 @@ var SMOKE_BRIDGE_PATHS = {
18171
18297
  };
18172
18298
  function dirHasEntries(p) {
18173
18299
  try {
18174
- return fs16.readdirSync(p).length > 0;
18300
+ return fs17.readdirSync(p).length > 0;
18175
18301
  } catch {
18176
18302
  return false;
18177
18303
  }
18178
18304
  }
18179
18305
  function _resolve_tsx_invocation(scriptPath, scriptArgs) {
18180
18306
  const binName = process3.platform === "win32" ? "tsx.cmd" : "tsx";
18181
- let dir = path14.dirname(scriptPath);
18307
+ let dir = path15.dirname(scriptPath);
18182
18308
  for (; ; ) {
18183
- const candidate = path14.join(dir, "node_modules", ".bin", binName);
18309
+ const candidate = path15.join(dir, "node_modules", ".bin", binName);
18184
18310
  if (isFile(candidate)) {
18185
18311
  return { command: candidate, args: [scriptPath, ...scriptArgs] };
18186
18312
  }
18187
- const parent = path14.dirname(dir);
18313
+ const parent = path15.dirname(dir);
18188
18314
  if (parent === dir) break;
18189
18315
  dir = parent;
18190
18316
  }
18191
18317
  return { command: "npx", args: ["tsx", scriptPath, ...scriptArgs] };
18192
18318
  }
18193
18319
  function _smoke_test_hooks(project_root, package_root) {
18194
- const dispatcher = path14.join(package_root, "scripts", "hooks", "dispatch_hook.ts");
18195
- const manifest = path14.join(package_root, "scripts", "hook_manifest.yaml");
18320
+ const dispatcher = path15.join(package_root, "scripts", "hooks", "dispatch_hook.ts");
18321
+ const manifest = path15.join(package_root, "scripts", "hook_manifest.yaml");
18196
18322
  if (!isFile(dispatcher) || !isFile(manifest)) return 0;
18197
18323
  const failed = [];
18198
18324
  const skipped = [];
18199
18325
  const passed = [];
18200
18326
  for (const [platform, native] of SMOKE_PROBE_EVENTS) {
18201
18327
  const rel_bridge = SMOKE_BRIDGE_PATHS[platform] ?? "";
18202
- const bridge_path = rel_bridge ? path14.join(project_root, rel_bridge) : null;
18328
+ const bridge_path = rel_bridge ? path15.join(project_root, rel_bridge) : null;
18203
18329
  const bridge_present = Boolean(
18204
18330
  bridge_path && (isFile(bridge_path) || isDir(bridge_path) && dirHasEntries(bridge_path))
18205
18331
  );
@@ -18399,9 +18525,9 @@ To remove this marker, delete this file.
18399
18525
  `;
18400
18526
  }
18401
18527
  var _CLAUDE_DESKTOP_BUNDLES_SUBPATH = "claude-desktop/bundles";
18402
- var GLOBAL_ROOT = path14.join(os7.homedir(), ".event4u", "agent-config");
18403
- var GLOBAL_USER_SETTINGS_PATH = path14.join(GLOBAL_ROOT, ".agent-user.yml");
18404
- var GLOBAL_AGENT_SETTINGS_PATH = path14.join(GLOBAL_ROOT, ".agent-settings.yml");
18528
+ var GLOBAL_ROOT = path15.join(os7.homedir(), ".event4u", "agent-config");
18529
+ var GLOBAL_USER_SETTINGS_PATH = path15.join(GLOBAL_ROOT, ".agent-user.yml");
18530
+ var GLOBAL_AGENT_SETTINGS_PATH = path15.join(GLOBAL_ROOT, ".agent-settings.yml");
18405
18531
  function _bridge_marker(tool_id, scope) {
18406
18532
  if (scope === "global") return USER_SCOPE_PATHS[tool_id] ?? "";
18407
18533
  return PROJECT_BRIDGE_MARKERS[tool_id] ?? "";
@@ -18446,11 +18572,11 @@ function _load_yaml_doc(p) {
18446
18572
  } catch {
18447
18573
  return {};
18448
18574
  }
18449
- const data = yamlSafeLoad(text);
18575
+ const data = yamlSafeLoad2(text);
18450
18576
  return _isPlainObject2(data) ? data : {};
18451
18577
  }
18452
18578
  function _load_default_settings(package_root) {
18453
- const template_source = path14.join(package_root, "src", "config", "agent-settings.template.yml");
18579
+ const template_source = path15.join(package_root, "src", "config", "agent-settings.template.yml");
18454
18580
  if (!pathExists(template_source)) return {};
18455
18581
  let text;
18456
18582
  try {
@@ -18459,7 +18585,7 @@ function _load_default_settings(package_root) {
18459
18585
  return {};
18460
18586
  }
18461
18587
  const rendered = text.split(RULE_LOADING_TIER_PLACEHOLDER).join(DEFAULT_PROFILE).split(USER_TYPE_PLACEHOLDER).join("");
18462
- const data = yamlSafeLoad(rendered);
18588
+ const data = yamlSafeLoad2(rendered);
18463
18589
  return _isPlainObject2(data) ? data : {};
18464
18590
  }
18465
18591
  function _resolve_scope(opts, detected, detect_reason, custom_path) {
@@ -18538,9 +18664,9 @@ function detect_scope(cwd) {
18538
18664
  if (pathExists(_resolve_settings_read(cwd))) {
18539
18665
  return ["project", `existing ${SETTINGS_FILE}`];
18540
18666
  }
18541
- const has_manifest = SCOPE_DETECT_MANIFESTS.find((m) => pathExists(path14.join(cwd, m))) ?? null;
18542
- const has_ai_dir = SCOPE_DETECT_AI_DIRS.find((d) => isDir(path14.join(cwd, d))) ?? null;
18543
- const has_ai_file = SCOPE_DETECT_AI_FILES.find((f) => pathExists(path14.join(cwd, f))) ?? null;
18667
+ const has_manifest = SCOPE_DETECT_MANIFESTS.find((m) => pathExists(path15.join(cwd, m))) ?? null;
18668
+ const has_ai_dir = SCOPE_DETECT_AI_DIRS.find((d) => isDir(path15.join(cwd, d))) ?? null;
18669
+ const has_ai_file = SCOPE_DETECT_AI_FILES.find((f) => pathExists(path15.join(cwd, f))) ?? null;
18544
18670
  if (has_manifest && (has_ai_dir || has_ai_file)) {
18545
18671
  const marker = has_ai_dir || has_ai_file;
18546
18672
  return ["prompt", `manifest (${has_manifest}) + AI-tool config (${marker})`];
@@ -18561,7 +18687,7 @@ function readLineSyncRaw(promptText) {
18561
18687
  for (; ; ) {
18562
18688
  let n;
18563
18689
  try {
18564
- n = fs16.readSync(0, buf, 0, 1, null);
18690
+ n = fs17.readSync(0, buf, 0, 1, null);
18565
18691
  } catch (err) {
18566
18692
  const code = err.code;
18567
18693
  if (code === "EAGAIN") {
@@ -18636,8 +18762,8 @@ function _files_by_tool_from_bridges(tools, project_root, scope) {
18636
18762
  const marker = _bridge_marker(tool_id, scope);
18637
18763
  if (!marker) continue;
18638
18764
  let marker_path = marker;
18639
- if (!path14.isAbsolute(marker_path)) {
18640
- marker_path = path14.join(project_root, marker_path);
18765
+ if (!path15.isAbsolute(marker_path)) {
18766
+ marker_path = path15.join(project_root, marker_path);
18641
18767
  }
18642
18768
  out[tool_id] = [_file_entry(marker_path, "bridge", false)];
18643
18769
  }
@@ -18676,26 +18802,26 @@ function _update_installed_tools_manifest(project_root, tools, scope, force, fil
18676
18802
  }
18677
18803
  write_manifest(target, version, entries);
18678
18804
  if (!state.QUIET) {
18679
- const rel = isRelativeTo(target, project_root) ? path14.relative(project_root, target) : target;
18805
+ const rel = isRelativeTo(target, project_root) ? path15.relative(project_root, target) : target;
18680
18806
  info(`Manifest updated: ${rel}`);
18681
18807
  }
18682
18808
  return 0;
18683
18809
  }
18684
18810
  function isRelativeTo(child, parent) {
18685
- const rel = path14.relative(parent, child);
18686
- return rel === "" || !rel.startsWith("..") && !path14.isAbsolute(rel);
18811
+ const rel = path15.relative(parent, child);
18812
+ return rel === "" || !rel.startsWith("..") && !path15.isAbsolute(rel);
18687
18813
  }
18688
18814
  function _resolve_package_root_for_global() {
18689
18815
  const here = resolvePath(_HERE2);
18690
- const candidate = path14.dirname(path14.dirname(path14.dirname(here)));
18691
- if (!pathExists(path14.join(candidate, "src", "config", "profiles", "minimal.ini"))) {
18816
+ const candidate = path15.dirname(path15.dirname(path15.dirname(here)));
18817
+ if (!pathExists(path15.join(candidate, "src", "config", "profiles", "minimal.ini"))) {
18692
18818
  fail(
18693
18819
  `Could not locate agent-config package root from ${here}. Expected src/config/profiles/minimal.ini at the parent directory.`
18694
18820
  );
18695
18821
  }
18696
18822
  return candidate;
18697
18823
  }
18698
- var CONSUMER_BRIDGE_MARKER_RELPATH = path14.join("agents", ".event4u-bridge.yml");
18824
+ var CONSUMER_BRIDGE_MARKER_RELPATH = path15.join("agents", ".event4u-bridge.yml");
18699
18825
  var MIGRATE_LEGACY_YAML_FILES = [".agent-settings.yml", ".agent-user.yml"];
18700
18826
  var MIGRATE_LEGACY_TOOL_DIRS = [".augment", ".claude", ".cursor"];
18701
18827
  var AGENT_CONFIG_PACKAGE_NAME = "@event4u/agent-config";
@@ -18703,7 +18829,7 @@ function _is_agent_config_source_repo(project_root) {
18703
18829
  if (process3.env["AGENT_CONFIG_CONSUMER_MODE"] === "1") {
18704
18830
  return [false, "consumer-mode-override"];
18705
18831
  }
18706
- const pkg_json = path14.join(project_root, "package.json");
18832
+ const pkg_json = path15.join(project_root, "package.json");
18707
18833
  if (isFile(pkg_json)) {
18708
18834
  let data = {};
18709
18835
  try {
@@ -18715,18 +18841,18 @@ function _is_agent_config_source_repo(project_root) {
18715
18841
  return [true, "package.json:name"];
18716
18842
  }
18717
18843
  }
18718
- if (isDir(path14.join(project_root, ".agent-src.uncondensed"))) {
18844
+ if (isDir(path15.join(project_root, ".agent-src.uncondensed"))) {
18719
18845
  return [true, ".agent-src.uncondensed/"];
18720
18846
  }
18721
- const packages_dir = path14.join(project_root, "packages");
18847
+ const packages_dir = path15.join(project_root, "packages");
18722
18848
  if (isDir(packages_dir)) {
18723
- for (const child of fs16.readdirSync(packages_dir)) {
18724
- if (isDir(path14.join(packages_dir, child, ".agent-src.uncondensed"))) {
18849
+ for (const child of fs17.readdirSync(packages_dir)) {
18850
+ if (isDir(path15.join(packages_dir, child, ".agent-src.uncondensed"))) {
18725
18851
  return [true, `packages/${child}/.agent-src.uncondensed/`];
18726
18852
  }
18727
18853
  }
18728
18854
  }
18729
- const installer_self = path14.join(project_root, "scripts", "install.py");
18855
+ const installer_self = path15.join(project_root, "scripts", "install.py");
18730
18856
  try {
18731
18857
  if (isFile(installer_self) && resolvePath(installer_self) === resolvePath(_HERE2)) {
18732
18858
  return [true, "src/scripts/install.py (self)"];
@@ -18746,17 +18872,17 @@ function _detect_legacy_for_migration(project_root) {
18746
18872
  }
18747
18873
  return [];
18748
18874
  }
18749
- if (isFile(path14.join(project_root, INSTALL_MODE_MARKER_REL))) return [];
18875
+ if (isFile(path15.join(project_root, INSTALL_MODE_MARKER_REL))) return [];
18750
18876
  const found = [];
18751
18877
  for (const name of MIGRATE_LEGACY_YAML_FILES) {
18752
- if (isFile(path14.join(project_root, name))) {
18878
+ if (isFile(path15.join(project_root, name))) {
18753
18879
  found.push(name);
18754
- } else if (isFile(path14.join(project_root, "settings", name))) {
18880
+ } else if (isFile(path15.join(project_root, "settings", name))) {
18755
18881
  found.push(`settings/${name}`);
18756
18882
  }
18757
18883
  }
18758
18884
  for (const name of MIGRATE_LEGACY_TOOL_DIRS) {
18759
- const p = path14.join(project_root, name);
18885
+ const p = path15.join(project_root, name);
18760
18886
  if (isDir(p) && !isSymlink(p)) {
18761
18887
  found.push(`${name}/`);
18762
18888
  }
@@ -18768,7 +18894,7 @@ function _prompt_migrate_to_global(project_root, artefacts) {
18768
18894
  process3.stdout.write("\n");
18769
18895
  warn("Legacy project-local artefacts detected \u2014 pre-ADR-020 layout:");
18770
18896
  for (const rel of artefacts) {
18771
- info(` ${path14.join(project_root, rel)}`);
18897
+ info(` ${path15.join(project_root, rel)}`);
18772
18898
  }
18773
18899
  info("The unified `agent-config migrate` sweeps these in one pass.");
18774
18900
  info("The wizard recreates fresh config afterwards.");
@@ -18799,20 +18925,20 @@ function _run_migrate_to_global(project_root) {
18799
18925
  function _format_global_root_for_marker(global_root) {
18800
18926
  const home = resolvePath(os7.homedir());
18801
18927
  const resolved = resolvePath(global_root);
18802
- const rel = path14.relative(home, resolved);
18803
- if (rel === "" || rel.startsWith("..") || path14.isAbsolute(rel)) {
18928
+ const rel = path15.relative(home, resolved);
18929
+ if (rel === "" || rel.startsWith("..") || path15.isAbsolute(rel)) {
18804
18930
  return global_root;
18805
18931
  }
18806
- return `~/${rel.split(path14.sep).join("/")}`;
18932
+ return `~/${rel.split(path15.sep).join("/")}`;
18807
18933
  }
18808
18934
  function _remove_legacy_consumer_bridge_marker(project_root, env = null) {
18809
18935
  const env_map = env ?? process3.env;
18810
18936
  if (env_map["AGENT_CONFIG_DEV_MODE"] === "1") return null;
18811
- if (isDir(path14.join(project_root, ".agent-src.uncondensed"))) return null;
18812
- const target = path14.join(project_root, CONSUMER_BRIDGE_MARKER_RELPATH);
18937
+ if (isDir(path15.join(project_root, ".agent-src.uncondensed"))) return null;
18938
+ const target = path15.join(project_root, CONSUMER_BRIDGE_MARKER_RELPATH);
18813
18939
  if (!isFile(target)) return null;
18814
18940
  try {
18815
- fs16.rmSync(target);
18941
+ fs17.rmSync(target);
18816
18942
  } catch {
18817
18943
  return null;
18818
18944
  }
@@ -18826,7 +18952,7 @@ var PROJECT_ANCHOR_TOOLS = {
18826
18952
  function _write_per_tool_project_anchors(project_root, tools, env = null, now = null) {
18827
18953
  const env_map = env ?? process3.env;
18828
18954
  if (env_map["AGENT_CONFIG_DEV_MODE"] === "1") return [];
18829
- if (isDir(path14.join(project_root, ".agent-src.uncondensed"))) return [];
18955
+ if (isDir(path15.join(project_root, ".agent-src.uncondensed"))) return [];
18830
18956
  const global_root_str = _format_global_root_for_marker(
18831
18957
  event4u_root(env_map)
18832
18958
  );
@@ -18835,8 +18961,8 @@ function _write_per_tool_project_anchors(project_root, tools, env = null, now =
18835
18961
  for (const tool_id of Object.keys(PROJECT_ANCHOR_TOOLS).sort()) {
18836
18962
  const rel_path = PROJECT_ANCHOR_TOOLS[tool_id];
18837
18963
  if (!tools.has(tool_id)) continue;
18838
- const target = path14.join(project_root, rel_path);
18839
- mkdirp(path14.dirname(target));
18964
+ const target = path15.join(project_root, rel_path);
18965
+ mkdirp(path15.dirname(target));
18840
18966
  const body = `# event4u/agent-config \u2014 per-tool project anchor (auto-written).
18841
18967
  # Spec: docs/contracts/consumer-bridge.md \xA7 Per-tool anchor strategy.
18842
18968
  # Tool: ${tool_id}. Resolves the global install directly \u2014 no
@@ -18854,7 +18980,7 @@ installed_at: ${stamp}
18854
18980
  }
18855
18981
  var PACKAGE_TAG_ID = "event4u/agent-config";
18856
18982
  function _inject_package_tag(target, source, package_root) {
18857
- if (path14.extname(target) !== ".md") return;
18983
+ if (path15.extname(target) !== ".md") return;
18858
18984
  let text;
18859
18985
  try {
18860
18986
  text = readText(target);
@@ -18882,8 +19008,8 @@ function _inject_package_tag(target, source, package_root) {
18882
19008
  resolved_src = source;
18883
19009
  }
18884
19010
  if (package_root !== null) {
18885
- const rel = path14.relative(resolvePath(package_root), resolved_src);
18886
- if (rel !== "" && !rel.startsWith("..") && !path14.isAbsolute(rel)) {
19011
+ const rel = path15.relative(resolvePath(package_root), resolved_src);
19012
+ if (rel !== "" && !rel.startsWith("..") && !path15.isAbsolute(rel)) {
18887
19013
  source_value = rel;
18888
19014
  } else {
18889
19015
  source_value = resolved_src;
@@ -18918,7 +19044,7 @@ function _escapes_package_root(resolved, package_root) {
18918
19044
  if (package_root === null) return false;
18919
19045
  let root;
18920
19046
  try {
18921
- root = fs16.realpathSync(package_root);
19047
+ root = fs17.realpathSync(package_root);
18922
19048
  } catch {
18923
19049
  return false;
18924
19050
  }
@@ -18933,7 +19059,7 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
18933
19059
  if (file_filter !== null && !file_filter(src)) return [0, 0, written_paths];
18934
19060
  let resolved_src = src;
18935
19061
  try {
18936
- resolved_src = fs16.realpathSync(src);
19062
+ resolved_src = fs17.realpathSync(src);
18937
19063
  } catch {
18938
19064
  resolved_src = src;
18939
19065
  }
@@ -18941,10 +19067,10 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
18941
19067
  warn(`refused: ${src} dereferences outside the package root \u2014 not copied`);
18942
19068
  return [0, 0, written_paths];
18943
19069
  }
18944
- mkdirp(path14.dirname(dest));
19070
+ mkdirp(path15.dirname(dest));
18945
19071
  const decision = _resolve_file_conflict(dest, force);
18946
19072
  if (decision === "skip") return [0, 1, written_paths];
18947
- fs16.copyFileSync(src, dest);
19073
+ fs17.copyFileSync(src, dest);
18948
19074
  _inject_package_tag(dest, src, package_root);
18949
19075
  written_paths.push(dest);
18950
19076
  return [1, 0, written_paths];
@@ -18952,11 +19078,11 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
18952
19078
  mkdirp(dest);
18953
19079
  const walk = (node) => {
18954
19080
  const acc = [];
18955
- const names = fs16.readdirSync(node).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
19081
+ const names = fs17.readdirSync(node).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
18956
19082
  for (const name of names) {
18957
- const entry = path14.join(node, name);
19083
+ const entry = path15.join(node, name);
18958
19084
  acc.push(entry);
18959
- const lst = fs16.lstatSync(entry);
19085
+ const lst = fs17.lstatSync(entry);
18960
19086
  if (lst.isDirectory() && !lst.isSymbolicLink()) {
18961
19087
  acc.push(...walk(entry));
18962
19088
  }
@@ -18964,9 +19090,9 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
18964
19090
  return acc;
18965
19091
  };
18966
19092
  for (const entry of walk(src)) {
18967
- const rel = path14.relative(src, entry);
18968
- const target = path14.join(dest, rel);
18969
- const lst = fs16.lstatSync(entry);
19093
+ const rel = path15.relative(src, entry);
19094
+ const target = path15.join(dest, rel);
19095
+ const lst = fs17.lstatSync(entry);
18970
19096
  if (lst.isDirectory() && !lst.isSymbolicLink()) {
18971
19097
  mkdirp(target);
18972
19098
  continue;
@@ -18974,8 +19100,8 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
18974
19100
  let resolvedIsDir = false;
18975
19101
  let resolved = entry;
18976
19102
  try {
18977
- resolved = fs16.realpathSync(entry);
18978
- resolvedIsDir = fs16.statSync(entry).isDirectory();
19103
+ resolved = fs17.realpathSync(entry);
19104
+ resolvedIsDir = fs17.statSync(entry).isDirectory();
18979
19105
  } catch {
18980
19106
  resolvedIsDir = false;
18981
19107
  }
@@ -19005,8 +19131,8 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
19005
19131
  skipped += 1;
19006
19132
  continue;
19007
19133
  }
19008
- mkdirp(path14.dirname(target));
19009
- fs16.copyFileSync(resolved, target);
19134
+ mkdirp(path15.dirname(target));
19135
+ fs17.copyFileSync(resolved, target);
19010
19136
  _inject_package_tag(target, resolved, package_root);
19011
19137
  written += 1;
19012
19138
  written_paths.push(target);
@@ -19018,7 +19144,7 @@ function _claude_desktop_bundles_dir() {
19018
19144
  }
19019
19145
  function _write_claude_desktop_marker(_force, lockfile_path2, bundles_dir, bundle_count) {
19020
19146
  const anchor = expanduser6(USER_SCOPE_PATHS["claude-desktop"]);
19021
- const target = path14.join(anchor, "agent-config.md");
19147
+ const target = path15.join(anchor, "agent-config.md");
19022
19148
  mkdirp(anchor);
19023
19149
  const body = claudeDesktopMarkerBody(lockfile_path2, anchor, bundles_dir, bundle_count);
19024
19150
  writeText(target, body);
@@ -19042,23 +19168,23 @@ function _apply_claude_flat_command_wrappers(anchor, package_root, current_files
19042
19168
  const wrapped = [];
19043
19169
  const collisions = [];
19044
19170
  const reserved = [];
19045
- const commands_dir = path14.join(anchor, "commands");
19171
+ const commands_dir = path15.join(anchor, "commands");
19046
19172
  let flat_entries = [];
19047
19173
  try {
19048
- flat_entries = fs16.readdirSync(commands_dir).filter((f) => f.endsWith(".md"));
19174
+ flat_entries = fs17.readdirSync(commands_dir).filter((f) => f.endsWith(".md"));
19049
19175
  } catch {
19050
19176
  }
19051
19177
  for (const fname of flat_entries.sort()) {
19052
19178
  const slug = fname.slice(0, -".md".length);
19053
19179
  if (!is_claude_builtin_name(slug)) continue;
19054
- fs16.rmSync(path14.join(commands_dir, fname), { force: true });
19180
+ fs17.rmSync(path15.join(commands_dir, fname), { force: true });
19055
19181
  current_files.delete(`commands/${fname}`);
19056
19182
  reserved.push(slug);
19057
19183
  }
19058
19184
  const eligible = new Set(_CLAUDE_FLAT_WRAPPER_EXTRA);
19059
19185
  try {
19060
19186
  const manifest = JSON.parse(
19061
- fs16.readFileSync(path14.join(package_root, "dist", "discovery", "discovery-manifest.json"), "utf8")
19187
+ fs17.readFileSync(path15.join(package_root, "dist", "discovery", "discovery-manifest.json"), "utf8")
19062
19188
  );
19063
19189
  for (const a of manifest.artefacts ?? []) {
19064
19190
  if (a.category !== "command" || typeof a.slug !== "string") continue;
@@ -19069,22 +19195,22 @@ function _apply_claude_flat_command_wrappers(anchor, package_root, current_files
19069
19195
  }
19070
19196
  for (const slug of [...eligible].sort()) {
19071
19197
  const flat_rel = `commands/${slug}.md`;
19072
- const flat_abs = path14.join(anchor, "commands", `${slug}.md`);
19073
- if (!fs16.existsSync(flat_abs)) continue;
19074
- const skill_dir = path14.join(anchor, "skills", slug);
19075
- if (fs16.existsSync(skill_dir)) {
19198
+ const flat_abs = path15.join(anchor, "commands", `${slug}.md`);
19199
+ if (!fs17.existsSync(flat_abs)) continue;
19200
+ const skill_dir = path15.join(anchor, "skills", slug);
19201
+ if (fs17.existsSync(skill_dir)) {
19076
19202
  collisions.push(slug);
19077
19203
  continue;
19078
19204
  }
19079
- let body = fs16.readFileSync(flat_abs, "utf8");
19205
+ let body = fs17.readFileSync(flat_abs, "utf8");
19080
19206
  if (body.startsWith("---\n") && !/^name:/m.test(body.split("\n---")[0] ?? "")) {
19081
19207
  body = body.replace("---\n", `---
19082
19208
  name: ${slug}
19083
19209
  `);
19084
19210
  }
19085
- fs16.mkdirSync(skill_dir, { recursive: true });
19086
- fs16.writeFileSync(path14.join(skill_dir, "SKILL.md"), body, "utf8");
19087
- fs16.rmSync(flat_abs, { force: true });
19211
+ fs17.mkdirSync(skill_dir, { recursive: true });
19212
+ fs17.writeFileSync(path15.join(skill_dir, "SKILL.md"), body, "utf8");
19213
+ fs17.rmSync(flat_abs, { force: true });
19088
19214
  current_files.delete(flat_rel);
19089
19215
  current_files.add(`skills/${slug}/SKILL.md`);
19090
19216
  wrapped.push(slug);
@@ -19116,8 +19242,8 @@ function _deploy_global_content(tools, force, package_root, lockfile_path2) {
19116
19242
  const written_paths = [];
19117
19243
  let current_files = /* @__PURE__ */ new Set();
19118
19244
  for (const [src_rel, dest_sub] of plan) {
19119
- const src = path14.join(package_root, src_rel);
19120
- const dest = dest_sub ? path14.join(anchor, dest_sub) : anchor;
19245
+ const src = path15.join(package_root, src_rel);
19246
+ const dest = dest_sub ? path15.join(anchor, dest_sub) : anchor;
19121
19247
  const rule_filter = _rule_filter_for_source(src_rel, rule_scope);
19122
19248
  const [w, s, paths] = _copy_dir_dereferencing_symlinks(
19123
19249
  src,
@@ -19191,10 +19317,10 @@ function _deploy_global_content(tools, force, package_root, lockfile_path2) {
19191
19317
  results[tool_id] = [written_total, skipped_total, "deployed", written_paths];
19192
19318
  if (tool_id === "claude-code") {
19193
19319
  try {
19194
- const manifest = path14.join(package_root, "src", "scripts", "hook_manifest.yaml");
19320
+ const manifest = path15.join(package_root, "src", "scripts", "hook_manifest.yaml");
19195
19321
  const matrix = build_claude_hook_matrix(manifest);
19196
19322
  const res = ensure_managed_hooks(
19197
- path14.join(anchor, "settings.json"),
19323
+ path15.join(anchor, "settings.json"),
19198
19324
  matrix
19199
19325
  );
19200
19326
  if (!state.QUIET) {
@@ -19231,7 +19357,7 @@ function _preview_global_reap(tools, package_root) {
19231
19357
  const anchor = expanduser6(anchor_raw);
19232
19358
  let current_files = /* @__PURE__ */ new Set();
19233
19359
  for (const [src_rel, dest_sub] of plan) {
19234
- const src = path14.join(package_root, src_rel);
19360
+ const src = path15.join(package_root, src_rel);
19235
19361
  current_files = setUnion(
19236
19362
  current_files,
19237
19363
  expected_deploy_files(
@@ -19265,14 +19391,14 @@ function _preview_global_reap(tools, package_root) {
19265
19391
  function _verify_deploy_targets(anchor, plan) {
19266
19392
  const missing = [];
19267
19393
  for (const [, dest_sub] of plan) {
19268
- const target = dest_sub ? path14.join(anchor, dest_sub) : anchor;
19394
+ const target = dest_sub ? path15.join(anchor, dest_sub) : anchor;
19269
19395
  const label = dest_sub || ".";
19270
19396
  if (!isDir(target)) {
19271
19397
  missing.push(label);
19272
19398
  continue;
19273
19399
  }
19274
19400
  try {
19275
- const entries = fs16.readdirSync(target);
19401
+ const entries = fs17.readdirSync(target);
19276
19402
  if (entries.length === 0) missing.push(label);
19277
19403
  } catch {
19278
19404
  missing.push(label);
@@ -19287,13 +19413,13 @@ function _prune_modules_by(deploy_results, is_pruned) {
19287
19413
  const [written, skipped, status, paths] = deploy_results[tool_id];
19288
19414
  const pruned_skill_dirs = /* @__PURE__ */ new Set();
19289
19415
  for (const p of paths) {
19290
- const parts = p.split(path14.sep);
19416
+ const parts = p.split(path15.sep);
19291
19417
  if (parts.includes("skills")) {
19292
19418
  const i = parts.indexOf("skills");
19293
19419
  if (i + 1 < parts.length) {
19294
- const skill_root = parts.slice(0, i + 2).join(path14.sep);
19420
+ const skill_root = parts.slice(0, i + 2).join(path15.sep);
19295
19421
  if (!pruned_skill_dirs.has(skill_root)) {
19296
- const skillmd = path14.join(skill_root, "SKILL.md");
19422
+ const skillmd = path15.join(skill_root, "SKILL.md");
19297
19423
  if (pathExists(skillmd) && is_pruned(skillmd)) {
19298
19424
  pruned_skill_dirs.add(skill_root);
19299
19425
  }
@@ -19304,25 +19430,25 @@ function _prune_modules_by(deploy_results, is_pruned) {
19304
19430
  const keep = [];
19305
19431
  const delete_files = [];
19306
19432
  for (const p of paths) {
19307
- const parts = p.split(path14.sep);
19433
+ const parts = p.split(path15.sep);
19308
19434
  let is_target = false;
19309
19435
  if (parts.includes("skills")) {
19310
19436
  const i = parts.indexOf("skills");
19311
- if (i + 1 < parts.length && pruned_skill_dirs.has(parts.slice(0, i + 2).join(path14.sep))) {
19437
+ if (i + 1 < parts.length && pruned_skill_dirs.has(parts.slice(0, i + 2).join(path15.sep))) {
19312
19438
  is_target = true;
19313
19439
  }
19314
- } else if (parts.includes("commands") && path14.extname(p) === ".md" && is_pruned(p)) {
19440
+ } else if (parts.includes("commands") && path15.extname(p) === ".md" && is_pruned(p)) {
19315
19441
  is_target = true;
19316
19442
  }
19317
19443
  (is_target ? delete_files : keep).push(p);
19318
19444
  }
19319
19445
  for (const d of pruned_skill_dirs) {
19320
- fs16.rmSync(d, { recursive: true, force: true });
19446
+ fs17.rmSync(d, { recursive: true, force: true });
19321
19447
  }
19322
19448
  for (const p of delete_files) {
19323
- if (p.split(path14.sep).includes("commands") && pathExists(p)) {
19449
+ if (p.split(path15.sep).includes("commands") && pathExists(p)) {
19324
19450
  try {
19325
- fs16.unlinkSync(p);
19451
+ fs17.unlinkSync(p);
19326
19452
  } catch {
19327
19453
  }
19328
19454
  }
@@ -19335,64 +19461,17 @@ function _prune_modules_by(deploy_results, is_pruned) {
19335
19461
  function _prune_lab_modules(deploy_results, lab_ids) {
19336
19462
  return _prune_modules_by(deploy_results, (p) => is_lab_artefact(p, lab_ids));
19337
19463
  }
19338
- var SCOPED_ACTIVE_WORKSPACES = /* @__PURE__ */ new Set(["engineering", "agent-config-maintainer"]);
19339
- function _load_packs_registry(package_root) {
19340
- const vocab_path = path14.join(package_root, "src", "config", "discovery", "packs.yml");
19341
- const data = yamlSafeLoad(readText(vocab_path));
19342
- if (!Array.isArray(data)) {
19343
- throw new Error(`packs.yml did not parse to a list: ${vocab_path}`);
19344
- }
19345
- const out = [];
19346
- for (const entry of data) {
19347
- if (!_isPlainObject2(entry)) continue;
19348
- const id = entry["id"];
19349
- if (typeof id !== "string" || id === "") continue;
19350
- const workspaces_raw = entry["workspaces"];
19351
- const workspaces = Array.isArray(workspaces_raw) ? workspaces_raw.filter((w) => typeof w === "string") : [];
19352
- const requires_raw = entry["requires"] ?? entry["requires_hint"];
19353
- const requires = Array.isArray(requires_raw) ? requires_raw.filter((r) => typeof r === "string") : [];
19354
- out.push({ id, workspaces, requires });
19355
- }
19356
- return out;
19357
- }
19358
- function _compute_active_pack_ids(packs, runtime_active_packs) {
19359
- const by_id = /* @__PURE__ */ new Map();
19360
- for (const p of packs) by_id.set(p.id, p);
19361
- const active = /* @__PURE__ */ new Set();
19362
- for (const p of packs) {
19363
- if (p.workspaces.some((w) => SCOPED_ACTIVE_WORKSPACES.has(w))) {
19364
- active.add(p.id);
19365
- }
19366
- }
19367
- for (const id of runtime_active_packs) {
19368
- active.add(id);
19369
- }
19370
- let frontier = [...active];
19371
- while (frontier.length > 0) {
19372
- const next = [];
19373
- for (const id of frontier) {
19374
- const rec = by_id.get(id);
19375
- if (rec === void 0) continue;
19376
- for (const dep of rec.requires) {
19377
- if (!active.has(dep)) {
19378
- active.add(dep);
19379
- next.push(dep);
19380
- }
19381
- }
19382
- }
19383
- frontier = next;
19384
- }
19385
- return active;
19386
- }
19464
+ var _load_packs_registry = load_packs_registry;
19465
+ var _compute_active_pack_ids = compute_active_pack_ids;
19387
19466
  function _resolve_global_settings_doc() {
19388
19467
  const p = _resolve_global_settings_path();
19389
19468
  return p === null ? null : _load_yaml_doc(p);
19390
19469
  }
19391
19470
  function _resolve_global_settings_path() {
19392
19471
  const root = event4u_root();
19393
- const canonical = path14.join(root, "settings", SETTINGS_FILE);
19472
+ const canonical = path15.join(root, "settings", SETTINGS_FILE);
19394
19473
  if (pathExists(canonical)) return canonical;
19395
- const legacy = path14.join(root, SETTINGS_FILE);
19474
+ const legacy = path15.join(root, SETTINGS_FILE);
19396
19475
  if (pathExists(legacy)) return legacy;
19397
19476
  return null;
19398
19477
  }
@@ -19409,7 +19488,7 @@ function _resolve_global_rule_scope(package_root) {
19409
19488
  const settings_path = _resolve_global_settings_path();
19410
19489
  if (settings_path === null) {
19411
19490
  try {
19412
- return ruleScopeFromSettings(_load_default_settings(package_root));
19491
+ return ruleScopeFromSettings(_load_default_settings(package_root), package_root);
19413
19492
  } catch {
19414
19493
  return LEGACY_ALL;
19415
19494
  }
@@ -19423,7 +19502,7 @@ function _resolve_global_rule_scope(package_root) {
19423
19502
  );
19424
19503
  return LEGACY_ALL;
19425
19504
  }
19426
- const parsed = yamlSafeLoad(text);
19505
+ const parsed = yamlSafeLoad2(text);
19427
19506
  if (!_isPlainObject2(parsed)) {
19428
19507
  warn(
19429
19508
  `${settings_path} is not a YAML mapping \u2014 rule scoping falls back to legacy-all, so ALL rules including maintainer-only ones will be installed. Fix the file to restore scoping.`
@@ -19431,7 +19510,7 @@ function _resolve_global_rule_scope(package_root) {
19431
19510
  return LEGACY_ALL;
19432
19511
  }
19433
19512
  try {
19434
- return ruleScopeFromSettings(parsed);
19513
+ return ruleScopeFromSettings(parsed, package_root);
19435
19514
  } catch (e) {
19436
19515
  warn(
19437
19516
  `could not derive rule scope from ${settings_path} (${String(e)}) \u2014 falling back to legacy-all; ALL rules will be installed.`
@@ -19444,14 +19523,10 @@ function _rule_filter_for_source(src_rel, scope) {
19444
19523
  return (srcFile) => ruleFileArrives(srcFile, scope);
19445
19524
  }
19446
19525
  function _prune_scoped_modules(deploy_results, active_ids) {
19447
- return _prune_modules_by(deploy_results, (p) => {
19448
- const packs = frontmatter_packs(p);
19449
- if (packs.size === 0) return false;
19450
- for (const id of packs) {
19451
- if (active_ids.has(id)) return false;
19452
- }
19453
- return true;
19454
- });
19526
+ return _prune_modules_by(
19527
+ deploy_results,
19528
+ (p) => is_pruned_under_scoped(p, active_ids)
19529
+ );
19455
19530
  }
19456
19531
  function install_global(tools, force, project_root = null, core_only = false) {
19457
19532
  const migrated = migrate_legacy_namespace();
@@ -19507,7 +19582,7 @@ function install_global(tools, force, project_root = null, core_only = false) {
19507
19582
  info(` schema_version=1, agent_config_version=${installed_version}`);
19508
19583
  info(` tools=${merged_tools.join(",")}`);
19509
19584
  }
19510
- if (project_root !== null && pathExists(_resolve_settings_read(project_root)) && !isDir(path14.join(project_root, ".agent-src.uncondensed"))) {
19585
+ if (project_root !== null && pathExists(_resolve_settings_read(project_root)) && !isDir(path15.join(project_root, ".agent-src.uncondensed"))) {
19511
19586
  const drift = collect_drift(project_root);
19512
19587
  if (!state.QUIET) {
19513
19588
  process3.stdout.write("\n");
@@ -19607,19 +19682,19 @@ function install_global(tools, force, project_root = null, core_only = false) {
19607
19682
  }
19608
19683
  }
19609
19684
  }
19610
- if (project_root !== null && pathExists(_resolve_settings_read(project_root)) && !isDir(path14.join(project_root, ".agent-src.uncondensed"))) {
19685
+ if (project_root !== null && pathExists(_resolve_settings_read(project_root)) && !isDir(path15.join(project_root, ".agent-src.uncondensed"))) {
19611
19686
  const files_by_tool = _files_by_tool_from_deploy(deploy_results);
19612
19687
  const rc = _update_installed_tools_manifest(project_root, tools, "global", force, files_by_tool);
19613
19688
  if (rc !== 0) return rc;
19614
19689
  const removed_marker = _remove_legacy_consumer_bridge_marker(project_root);
19615
19690
  if (removed_marker !== null && !state.QUIET) {
19616
- const rel = isRelativeTo(removed_marker, project_root) ? path14.relative(project_root, removed_marker) : removed_marker;
19691
+ const rel = isRelativeTo(removed_marker, project_root) ? path15.relative(project_root, removed_marker) : removed_marker;
19617
19692
  info(`Removed legacy bridge marker: ${rel}`);
19618
19693
  }
19619
19694
  const anchor_paths = _write_per_tool_project_anchors(project_root, tools);
19620
19695
  if (anchor_paths.length > 0 && !state.QUIET) {
19621
19696
  for (const p of anchor_paths) {
19622
- const rel = isRelativeTo(p, project_root) ? path14.relative(project_root, p) : p;
19697
+ const rel = isRelativeTo(p, project_root) ? path15.relative(project_root, p) : p;
19623
19698
  info(`Project anchor written: ${rel}`);
19624
19699
  }
19625
19700
  }
@@ -19636,8 +19711,8 @@ function install_global(tools, force, project_root = null, core_only = false) {
19636
19711
  }
19637
19712
  return 0;
19638
19713
  }
19639
- var SETTINGS_SURFACE_REL = path14.join("state", "settings-surface.json");
19640
- var SETTINGS_DELTA_REL = path14.join("state", "settings-delta.json");
19714
+ var SETTINGS_SURFACE_REL = path15.join("state", "settings-surface.json");
19715
+ var SETTINGS_DELTA_REL = path15.join("state", "settings-delta.json");
19641
19716
  function _current_settings_surface(version) {
19642
19717
  const jsonSchema = zodToJsonSchema(settingsSchema, {
19643
19718
  name: "AgentSettings",
@@ -19648,20 +19723,20 @@ function _current_settings_surface(version) {
19648
19723
  }
19649
19724
  function _write_settings_surface_snapshot(installed_version) {
19650
19725
  const root = event4u_root();
19651
- const surface_path = path14.join(root, SETTINGS_SURFACE_REL);
19652
- const delta_path = path14.join(root, SETTINGS_DELTA_REL);
19726
+ const surface_path = path15.join(root, SETTINGS_SURFACE_REL);
19727
+ const delta_path = path15.join(root, SETTINGS_DELTA_REL);
19653
19728
  const next = _current_settings_surface(installed_version);
19654
19729
  let previous = null;
19655
19730
  try {
19656
- const parsed = JSON.parse(fs16.readFileSync(surface_path, "utf8"));
19731
+ const parsed = JSON.parse(fs17.readFileSync(surface_path, "utf8"));
19657
19732
  if (parsed !== null && typeof parsed === "object" && parsed.entries !== void 0) previous = parsed;
19658
19733
  } catch {
19659
19734
  }
19660
19735
  if (previous !== null && previous.version !== next.version) {
19661
19736
  const delta = computeSurfaceDelta(previous, next);
19662
19737
  if (delta.changes.length > 0) {
19663
- fs16.mkdirSync(path14.dirname(delta_path), { recursive: true, mode: 448 });
19664
- fs16.writeFileSync(delta_path, `${JSON.stringify(delta, null, 2)}
19738
+ fs17.mkdirSync(path15.dirname(delta_path), { recursive: true, mode: 448 });
19739
+ fs17.writeFileSync(delta_path, `${JSON.stringify(delta, null, 2)}
19665
19740
  `, { mode: 384 });
19666
19741
  if (!state.QUIET) {
19667
19742
  const counts = {};
@@ -19673,8 +19748,8 @@ function _write_settings_surface_snapshot(installed_version) {
19673
19748
  }
19674
19749
  }
19675
19750
  }
19676
- fs16.mkdirSync(path14.dirname(surface_path), { recursive: true, mode: 448 });
19677
- fs16.writeFileSync(surface_path, `${JSON.stringify(next, null, 2)}
19751
+ fs17.mkdirSync(path15.dirname(surface_path), { recursive: true, mode: 448 });
19752
+ fs17.writeFileSync(surface_path, `${JSON.stringify(next, null, 2)}
19678
19753
  `, { mode: 384 });
19679
19754
  }
19680
19755
  function arrayStrEqual(a, b) {
@@ -19886,13 +19961,13 @@ function _minimal_templates_root() {
19886
19961
  const chain = [start];
19887
19962
  let cur = start;
19888
19963
  for (; ; ) {
19889
- const parent = path14.dirname(cur);
19964
+ const parent = path15.dirname(cur);
19890
19965
  if (parent === cur) break;
19891
19966
  chain.push(parent);
19892
19967
  cur = parent;
19893
19968
  }
19894
19969
  for (const ancestor of chain) {
19895
- const candidate = path14.join(ancestor, "src", "templates", "minimal");
19970
+ const candidate = path15.join(ancestor, "src", "templates", "minimal");
19896
19971
  if (isDir(candidate)) return candidate;
19897
19972
  }
19898
19973
  fail("Could not locate src/templates/minimal/ \u2014 package install is corrupt.");
@@ -19900,9 +19975,9 @@ function _minimal_templates_root() {
19900
19975
  var INSTALL_MODE_MARKER_REL = "agents/.agent-state/install-mode.txt";
19901
19976
  function _write_install_mode_marker(project_root, mode) {
19902
19977
  if (mode !== "minimal" && mode !== "full") return;
19903
- const marker = path14.join(project_root, INSTALL_MODE_MARKER_REL);
19978
+ const marker = path15.join(project_root, INSTALL_MODE_MARKER_REL);
19904
19979
  try {
19905
- mkdirp(path14.dirname(marker));
19980
+ mkdirp(path15.dirname(marker));
19906
19981
  writeText(marker, `${mode}
19907
19982
  `);
19908
19983
  } catch {
@@ -19911,7 +19986,7 @@ function _write_install_mode_marker(project_root, mode) {
19911
19986
  function install_minimal(target_root_in, force, user_type = "") {
19912
19987
  let target_root = resolvePath(target_root_in);
19913
19988
  mkdirp(target_root);
19914
- const parent = path14.dirname(target_root);
19989
+ const parent = path15.dirname(target_root);
19915
19990
  if (parent !== target_root) {
19916
19991
  const existing = find_project_root_with_anchor(parent);
19917
19992
  if (existing !== null && existing[0] !== target_root) {
@@ -19922,21 +19997,21 @@ function install_minimal(target_root_in, force, user_type = "") {
19922
19997
  }
19923
19998
  }
19924
19999
  const templates = _minimal_templates_root();
19925
- const settings_src = path14.join(templates, SETTINGS_FILE);
19926
- const overrides_gitkeep_src = path14.join(templates, "overrides-gitkeep");
19927
- const overrides_readme_src = path14.join(templates, "agents-overrides-readme.md");
20000
+ const settings_src = path15.join(templates, SETTINGS_FILE);
20001
+ const overrides_gitkeep_src = path15.join(templates, "overrides-gitkeep");
20002
+ const overrides_readme_src = path15.join(templates, "agents-overrides-readme.md");
19928
20003
  if (!isFile(settings_src)) fail(`Bundled minimal settings template missing under ${templates}`);
19929
20004
  if (!isFile(overrides_gitkeep_src) || !isFile(overrides_readme_src)) {
19930
20005
  fail(`Bundled overrides scaffold templates missing under ${templates}`);
19931
20006
  }
19932
20007
  info(`Minimal init \u2192 ${target_root}`);
19933
- const overrides_root = path14.join(target_root, "agents", "overrides");
20008
+ const overrides_root = path15.join(target_root, "agents", "overrides");
19934
20009
  mkdirp(overrides_root);
19935
20010
  const gitkeep_body = readText(overrides_gitkeep_src);
19936
20011
  for (const sub of ["rules", "skills", "commands"]) {
19937
- const sub_dir = path14.join(overrides_root, sub);
20012
+ const sub_dir = path15.join(overrides_root, sub);
19938
20013
  mkdirp(sub_dir);
19939
- const gitkeep_dst = path14.join(sub_dir, ".gitkeep");
20014
+ const gitkeep_dst = path15.join(sub_dir, ".gitkeep");
19940
20015
  if (pathExists(gitkeep_dst) && !force) {
19941
20016
  skip(`agents/overrides/${sub}/.gitkeep already exists (use --force to overwrite)`);
19942
20017
  } else {
@@ -19944,7 +20019,7 @@ function install_minimal(target_root_in, force, user_type = "") {
19944
20019
  success(`Wrote agents/overrides/${sub}/.gitkeep`);
19945
20020
  }
19946
20021
  }
19947
- const readme_dst = path14.join(overrides_root, "README.md");
20022
+ const readme_dst = path15.join(overrides_root, "README.md");
19948
20023
  if (pathExists(readme_dst) && !force) {
19949
20024
  skip("agents/overrides/README.md already exists (use --force to overwrite)");
19950
20025
  } else {
@@ -19962,14 +20037,14 @@ function install_minimal(target_root_in, force, user_type = "") {
19962
20037
  personal:
19963
20038
  user_type: ${user_type}
19964
20039
  `;
19965
- mkdirp(path14.dirname(settings_dst));
20040
+ mkdirp(path15.dirname(settings_dst));
19966
20041
  writeText(settings_dst, body);
19967
20042
  success(`Wrote ${SETTINGS_FILE} (user_type=${user_type})`);
19968
20043
  }
19969
20044
  }
19970
20045
  const removed_marker = _remove_legacy_consumer_bridge_marker(target_root);
19971
20046
  if (removed_marker !== null) {
19972
- const rel = isRelativeTo(removed_marker, target_root) ? path14.relative(target_root, removed_marker) : removed_marker;
20047
+ const rel = isRelativeTo(removed_marker, target_root) ? path15.relative(target_root, removed_marker) : removed_marker;
19973
20048
  success(`Removed legacy bridge marker: ${rel}`);
19974
20049
  }
19975
20050
  _write_install_mode_marker(target_root, "minimal");
@@ -20043,7 +20118,7 @@ function run_interactive_init(project_root, force) {
20043
20118
  );
20044
20119
  return 0;
20045
20120
  }
20046
- const target = path14.join(project_root, _LOCAL_CONFIG_FILE);
20121
+ const target = path15.join(project_root, _LOCAL_CONFIG_FILE);
20047
20122
  if (pathExists(target) && !force) {
20048
20123
  warn(
20049
20124
  `${_LOCAL_CONFIG_FILE} already exists; re-run with --force to overwrite. Skipping interactive init.`
@@ -20070,7 +20145,7 @@ function run_interactive_init(project_root, force) {
20070
20145
  warn(`Could not write ${target}: ${String(exc)}`);
20071
20146
  return 1;
20072
20147
  }
20073
- success(`Wrote ${path14.relative(project_root, target)} (${user_type} / ${stack} / ${verbosity})`);
20148
+ success(`Wrote ${path15.relative(project_root, target)} (${user_type} / ${stack} / ${verbosity})`);
20074
20149
  return 0;
20075
20150
  }
20076
20151
  var _WIZARD_READY_RE = /^WIZARD_READY (http:\/\/(?:127\.0\.0\.1|localhost):\d+\/\S*)\r?$/;
@@ -20088,12 +20163,12 @@ function _wizard_should_launch(opts) {
20088
20163
  return [true, ""];
20089
20164
  }
20090
20165
  function _wizard_cli_dist(_project_root) {
20091
- const package_root = path14.dirname(path14.dirname(path14.dirname(resolvePath(_HERE2))));
20092
- const cli = path14.join(package_root, "dist", "cli", "agent-config.js");
20166
+ const package_root = path15.dirname(path15.dirname(path15.dirname(resolvePath(_HERE2))));
20167
+ const cli = path15.join(package_root, "dist", "cli", "agent-config.js");
20093
20168
  return pathExists(cli) ? cli : null;
20094
20169
  }
20095
20170
  function _server_info_path() {
20096
- return path14.join(os7.homedir(), ".event4u", "agent-config", "local-server.json");
20171
+ return path15.join(os7.homedir(), ".event4u", "agent-config", "local-server.json");
20097
20172
  }
20098
20173
  function _pid_is_agent_config(pid) {
20099
20174
  let res;
@@ -20110,7 +20185,7 @@ function _pid_is_agent_config(pid) {
20110
20185
  }
20111
20186
  function unlinkMissingOk(p) {
20112
20187
  try {
20113
- fs16.unlinkSync(p);
20188
+ fs17.unlinkSync(p);
20114
20189
  } catch {
20115
20190
  }
20116
20191
  }
@@ -20188,14 +20263,14 @@ function _wizard_spawn(project_root, pass_project_root = true) {
20188
20263
  }
20189
20264
  function _wizard_run_sync(cmd, env, cli) {
20190
20265
  const total = _WIZARD_TIMEOUTS.reduce((a, b) => a + b, 0);
20191
- const log_path = path14.join(
20266
+ const log_path = path15.join(
20192
20267
  os7.tmpdir(),
20193
20268
  `agent-config-wizard-${process3.pid}-${Date.now()}.log`
20194
20269
  );
20195
20270
  let child;
20196
20271
  let log_fd = null;
20197
20272
  try {
20198
- log_fd = fs16.openSync(log_path, "w");
20273
+ log_fd = fs17.openSync(log_path, "w");
20199
20274
  child = spawn(cmd[0], cmd.slice(1), {
20200
20275
  env,
20201
20276
  detached: true,
@@ -20213,7 +20288,7 @@ function _wizard_run_sync(cmd, env, cli) {
20213
20288
  } finally {
20214
20289
  if (log_fd !== null) {
20215
20290
  try {
20216
- fs16.closeSync(log_fd);
20291
+ fs17.closeSync(log_fd);
20217
20292
  } catch {
20218
20293
  }
20219
20294
  }
@@ -20463,8 +20538,8 @@ function main2(argv) {
20463
20538
  const target_root = resolvePath(
20464
20539
  opts.custom_path || opts.project || process3.env["PROJECT_ROOT"] || process3.cwd()
20465
20540
  );
20466
- const minimal_package_root = path14.dirname(
20467
- path14.dirname(path14.dirname(_minimal_templates_root()))
20541
+ const minimal_package_root = path15.dirname(
20542
+ path15.dirname(path15.dirname(_minimal_templates_root()))
20468
20543
  );
20469
20544
  const validated_user_type = _validate_user_type(minimal_package_root, opts.user_type);
20470
20545
  return install_minimal(target_root, opts.force, validated_user_type);
@@ -20493,7 +20568,7 @@ function main2(argv) {
20493
20568
  return rc2;
20494
20569
  }
20495
20570
  const project_root = custom_path || resolvePath(opts.project || process3.env["PROJECT_ROOT"] || process3.cwd());
20496
- const is_first_run = !pathExists(path14.join(project_root, SETTINGS_FILE));
20571
+ const is_first_run = !pathExists(path15.join(project_root, SETTINGS_FILE));
20497
20572
  const rc = _main_project_install(opts, project_root, parsed_tools, is_first_run);
20498
20573
  if (rc === 0 && opts.interactive) {
20499
20574
  run_interactive_init(project_root, opts.force);
@@ -20557,16 +20632,16 @@ function _team_setup_hint_line(project_root) {
20557
20632
  return " \u2022 Claude Code team mode (optional cross-model review via the official codex plugin): run `agent-config doctor --check team` for setup status.";
20558
20633
  }
20559
20634
  function finalize_claude_model_tiers(project_root) {
20560
- const claude_skills = path14.join(project_root, ".claude", "skills");
20561
- const augment_skills = path14.join(project_root, ".augment", "skills");
20635
+ const claude_skills = path15.join(project_root, ".claude", "skills");
20636
+ const augment_skills = path15.join(project_root, ".augment", "skills");
20562
20637
  if (!isDir(claude_skills) || !isDir(augment_skills)) return 0;
20563
20638
  if (_read_consumer_auto_switch(project_root) !== "auto") return 0;
20564
20639
  let rendered = 0;
20565
- const entries = fs16.readdirSync(claude_skills).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
20640
+ const entries = fs17.readdirSync(claude_skills).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
20566
20641
  for (const name of entries) {
20567
- const entry = path14.join(claude_skills, name);
20568
- const src_dir = path14.join(augment_skills, name);
20569
- const src_md = path14.join(src_dir, "SKILL.md");
20642
+ const entry = path15.join(claude_skills, name);
20643
+ const src_dir = path15.join(augment_skills, name);
20644
+ const src_md = path15.join(src_dir, "SKILL.md");
20570
20645
  let tier;
20571
20646
  try {
20572
20647
  tier = read_model_tier(src_md);
@@ -20575,22 +20650,22 @@ function finalize_claude_model_tiers(project_root) {
20575
20650
  }
20576
20651
  if (tier === null || !(tier in TIER_TO_CLAUDE_MODEL) || !isDir(src_dir)) continue;
20577
20652
  if (isSymlink(entry) || isFile(entry)) {
20578
- fs16.unlinkSync(entry);
20653
+ fs17.unlinkSync(entry);
20579
20654
  } else if (isDir(entry)) {
20580
- fs16.rmSync(entry, { recursive: true, force: true });
20655
+ fs17.rmSync(entry, { recursive: true, force: true });
20581
20656
  }
20582
20657
  mkdirp(entry);
20583
- const srcFiles = fs16.readdirSync(src_dir).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
20658
+ const srcFiles = fs17.readdirSync(src_dir).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
20584
20659
  for (const fname of srcFiles) {
20585
20660
  if (fname === "SKILL.md") {
20586
20661
  writeText(
20587
- path14.join(entry, "SKILL.md"),
20662
+ path15.join(entry, "SKILL.md"),
20588
20663
  render_native_model_md(readText(src_md), tier)
20589
20664
  );
20590
20665
  } else {
20591
- fs16.symlinkSync(
20592
- path14.join("../../../.augment/skills", name, fname),
20593
- path14.join(entry, fname)
20666
+ fs17.symlinkSync(
20667
+ path15.join("../../../.augment/skills", name, fname),
20668
+ path15.join(entry, fname)
20594
20669
  );
20595
20670
  }
20596
20671
  }
@@ -20608,7 +20683,7 @@ function _main_project_install(opts, project_root, parsed_tools, is_first_run) {
20608
20683
  let package_type;
20609
20684
  if (opts.package) {
20610
20685
  package_root = resolvePath(opts.package);
20611
- if (!pathExists(path14.join(package_root, "src", "config", "profiles", "minimal.ini"))) {
20686
+ if (!pathExists(path15.join(package_root, "src", "config", "profiles", "minimal.ini"))) {
20612
20687
  fail(`Invalid --package path (missing src/config/profiles/minimal.ini): ${package_root}`);
20613
20688
  }
20614
20689
  package_type = detect_package_type_for_project(project_root, package_root);
@@ -20743,9 +20818,9 @@ function _main_project_install(opts, project_root, parsed_tools, is_first_run) {
20743
20818
  function _resolvedArgv1() {
20744
20819
  if (process3.argv[1] === void 0) return void 0;
20745
20820
  try {
20746
- return fs16.realpathSync(path14.resolve(process3.argv[1]));
20821
+ return fs17.realpathSync(path15.resolve(process3.argv[1]));
20747
20822
  } catch {
20748
- return path14.resolve(process3.argv[1]);
20823
+ return path15.resolve(process3.argv[1]);
20749
20824
  }
20750
20825
  }
20751
20826
  var _argv1 = _resolvedArgv1();