@event4u/agent-config 8.1.0 → 8.3.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 (615) hide show
  1. package/.claude-plugin/marketplace.json +3 -3
  2. package/CHANGELOG.md +83 -292
  3. package/MIGRATION.md +18 -0
  4. package/README.md +86 -3
  5. package/dist/agent-src/commands/agents/init.md +3 -3
  6. package/dist/agent-src/commands/chat-history/import.md +5 -5
  7. package/dist/agent-src/commands/chat-history.md +1 -1
  8. package/dist/agent-src/commands/condense.md +1 -1
  9. package/dist/agent-src/commands/context/create.md +1 -1
  10. package/dist/agent-src/commands/council/analysis.md +2 -2
  11. package/dist/agent-src/commands/council/default.md +3 -3
  12. package/dist/agent-src/commands/council/design.md +2 -2
  13. package/dist/agent-src/commands/council/optimize.md +1 -1
  14. package/dist/agent-src/commands/council/pr.md +2 -2
  15. package/dist/agent-src/commands/council.md +1 -1
  16. package/dist/agent-src/commands/feature/plan.md +1 -1
  17. package/dist/agent-src/commands/ghostwriter/list.md +1 -1
  18. package/dist/agent-src/commands/ghostwriter/write.md +1 -1
  19. package/dist/agent-src/commands/ghostwriter.md +1 -1
  20. package/dist/agent-src/commands/implement-ticket.md +2 -2
  21. package/dist/agent-src/commands/judge/on-diff.md +1 -1
  22. package/dist/agent-src/commands/judge/steps.md +3 -1
  23. package/dist/agent-src/commands/memory/add.md +2 -2
  24. package/dist/agent-src/commands/memory/learn-low-impact.md +1 -1
  25. package/dist/agent-src/commands/memory/load.md +1 -1
  26. package/dist/agent-src/commands/memory/mine-session.md +1 -1
  27. package/dist/agent-src/commands/memory/promote.md +1 -1
  28. package/dist/agent-src/commands/memory/propose.md +1 -1
  29. package/dist/agent-src/commands/mission/upgrade.md +1 -1
  30. package/dist/agent-src/commands/module/explore.md +3 -3
  31. package/dist/agent-src/commands/optimize/agents-dir.md +1 -1
  32. package/dist/agent-src/commands/optimize/skills.md +1 -1
  33. package/dist/agent-src/commands/optimize-project.md +1 -1
  34. package/dist/agent-src/commands/orchestrate.md +2 -2
  35. package/dist/agent-src/commands/project-analyze.md +1 -1
  36. package/dist/agent-src/commands/project-health.md +1 -1
  37. package/dist/agent-src/commands/roadmap/ai-council.md +1 -1
  38. package/dist/agent-src/commands/roadmap/create.md +2 -2
  39. package/dist/agent-src/commands/roadmap/process-full.md +3 -1
  40. package/dist/agent-src/commands/roadmap/process-phase.md +4 -2
  41. package/dist/agent-src/commands/roadmap/process-step.md +3 -1
  42. package/dist/agent-src/commands/security-audit-config.md +1 -1
  43. package/dist/agent-src/commands/sync-agent-settings.md +7 -7
  44. package/dist/agent-src/commands/sync-gitignore/fix.md +3 -3
  45. package/dist/agent-src/commands/sync-gitignore.md +4 -4
  46. package/dist/agent-src/commands/work.md +3 -3
  47. package/dist/agent-src/contexts/communication/rules-auto/skill-quality-mechanics.md +1 -1
  48. package/dist/agent-src/contexts/communication/rules-auto/slash-command-routing-policy-mechanics.md +2 -2
  49. package/dist/agent-src/contexts/contracts/artifact-engagement-flow.md +1 -1
  50. package/dist/agent-src/contexts/contracts/command-suggestion-flow.md +8 -7
  51. package/dist/agent-src/contexts/execution/evidence-discipline.md +2 -2
  52. package/dist/agent-src/contexts/execution/roadmap-process-loop.md +9 -4
  53. package/dist/agent-src/contexts/execution/toolchain-resolver.md +10 -9
  54. package/dist/agent-src/contexts/execution/verification-mechanics.md +13 -1
  55. package/dist/agent-src/packs/README.md +1 -1
  56. package/dist/agent-src/presets/README.md +1 -1
  57. package/dist/agent-src/profiles/README.md +1 -1
  58. package/dist/agent-src/rules/architecture.md +2 -2
  59. package/dist/agent-src/rules/context-hygiene.md +2 -2
  60. package/dist/agent-src/rules/fast-path-marker-visibility.md +1 -1
  61. package/dist/agent-src/rules/framework-neutrality-in-generic-skills.md +1 -1
  62. package/dist/agent-src/rules/linked-projects-onboarding-gate.md +1 -1
  63. package/dist/agent-src/rules/low-impact-corpus-privacy-floor.md +3 -3
  64. package/dist/agent-src/rules/media-governance-routing.md +1 -1
  65. package/dist/agent-src/rules/no-roadmap-references.md +3 -3
  66. package/dist/agent-src/rules/preservation-guard.md +2 -2
  67. package/dist/agent-src/rules/roadmap-ci-steps-policy.md +6 -5
  68. package/dist/agent-src/rules/roadmap-progress-sync.md +3 -3
  69. package/dist/agent-src/rules/security-sensitive-stop.md +7 -9
  70. package/dist/agent-src/rules/source-confidentiality.md +1 -1
  71. package/dist/agent-src/rules/telegraph-speak.md +1 -1
  72. package/dist/agent-src/rules/token-optimizer-maintenance.md +1 -1
  73. package/dist/agent-src/rules/ui-audit-gate.md +1 -1
  74. package/dist/agent-src/scripts/archive_completed_roadmaps.ts +22 -4
  75. package/dist/agent-src/scripts/update_roadmap_progress.ts +29 -1
  76. package/dist/agent-src/skills/accessibility-auditor/SKILL.md +3 -2
  77. package/dist/agent-src/skills/adr-create/SKILL.md +8 -6
  78. package/dist/agent-src/skills/agent-docs-writing/SKILL.md +1 -1
  79. package/dist/agent-src/skills/agents-md-thin-root/SKILL.md +2 -2
  80. package/dist/agent-src/skills/ai-council/SKILL.md +15 -15
  81. package/dist/agent-src/skills/api-design/SKILL.md +1 -1
  82. package/dist/agent-src/skills/api-endpoint/SKILL.md +2 -1
  83. package/dist/agent-src/skills/authz-review/SKILL.md +1 -1
  84. package/dist/agent-src/skills/blade-ui/SKILL.md +11 -10
  85. package/dist/agent-src/skills/blameless-post-mortem/SKILL.md +9 -8
  86. package/dist/agent-src/skills/code-review/SKILL.md +3 -4
  87. package/dist/agent-src/skills/command-routing/SKILL.md +3 -3
  88. package/dist/agent-src/skills/command-writing/SKILL.md +3 -3
  89. package/dist/agent-src/skills/condense-memory/SKILL.md +2 -2
  90. package/dist/agent-src/skills/context-authoring/SKILL.md +1 -1
  91. package/dist/agent-src/skills/context-document/SKILL.md +1 -1
  92. package/dist/agent-src/skills/copilot-agents-optimization/SKILL.md +1 -1
  93. package/dist/agent-src/skills/corpus-grounding/SKILL.md +16 -11
  94. package/dist/agent-src/skills/corpus-grounding/scripts/ground.ts +24 -3
  95. package/dist/agent-src/skills/dashboard-design/SKILL.md +2 -1
  96. package/dist/agent-src/skills/database/SKILL.md +2 -1
  97. package/dist/agent-src/skills/description-assist/SKILL.md +6 -6
  98. package/dist/agent-src/skills/design-intelligence/SKILL.md +6 -5
  99. package/dist/agent-src/skills/design-tokens/SKILL.md +5 -5
  100. package/dist/agent-src/skills/design-tokens/scripts/tokens.ts +24 -3
  101. package/dist/agent-src/skills/existing-ui-audit/SKILL.md +3 -3
  102. package/dist/agent-src/skills/fe-design/SKILL.md +7 -7
  103. package/dist/agent-src/skills/finishing-a-development-branch/SKILL.md +11 -4
  104. package/dist/agent-src/skills/flux/SKILL.md +10 -9
  105. package/dist/agent-src/skills/git-workflow/SKILL.md +4 -5
  106. package/dist/agent-src/skills/guideline-writing/SKILL.md +2 -2
  107. package/dist/agent-src/skills/learning-to-rule-or-skill/SKILL.md +2 -2
  108. package/dist/agent-src/skills/livewire/SKILL.md +10 -9
  109. package/dist/agent-src/skills/memory-consolidation/SKILL.md +2 -2
  110. package/dist/agent-src/skills/module-detect-on-the-fly/SKILL.md +5 -5
  111. package/dist/agent-src/skills/module-management/SKILL.md +2 -2
  112. package/dist/agent-src/skills/prediction-pool-optimizer/SKILL.md +11 -11
  113. package/dist/agent-src/skills/prediction-pool-optimizer/reference/ev-fixtures.md +6 -6
  114. package/dist/agent-src/skills/prediction-pool-optimizer/reference/odds-and-bonus.md +1 -1
  115. package/dist/agent-src/skills/premortem/SKILL.md +1 -1
  116. package/dist/agent-src/skills/project-docs/SKILL.md +1 -1
  117. package/dist/agent-src/skills/quality-tools/SKILL.md +26 -2
  118. package/dist/agent-src/skills/react-shadcn-ui/SKILL.md +8 -7
  119. package/dist/agent-src/skills/react-shadcn-ui/scripts/shadcn_add.ts +31 -10
  120. package/dist/agent-src/skills/refine-prompt/SKILL.md +14 -14
  121. package/dist/agent-src/skills/refine-ticket/SKILL.md +24 -25
  122. package/dist/agent-src/skills/refine-ticket/detection-map.yml +1 -1
  123. package/dist/agent-src/skills/review-routing/SKILL.md +6 -7
  124. package/dist/agent-src/skills/roadmap-management/SKILL.md +11 -6
  125. package/dist/agent-src/skills/rule-refactor/SKILL.md +1 -1
  126. package/dist/agent-src/skills/rule-writing/SKILL.md +5 -5
  127. package/dist/agent-src/skills/script-writing/SKILL.md +28 -41
  128. package/dist/agent-src/skills/skill-writing/SKILL.md +3 -3
  129. package/dist/agent-src/skills/source-discovery/SKILL.md +3 -3
  130. package/dist/agent-src/skills/sql-writing/SKILL.md +2 -1
  131. package/dist/agent-src/skills/subagent-orchestration/SKILL.md +1 -1
  132. package/dist/agent-src/skills/systematic-debugging/SKILL.md +5 -7
  133. package/dist/agent-src/skills/tailwind-engineer/SKILL.md +2 -2
  134. package/dist/agent-src/skills/tailwind-engineer/scripts/tailwind_config_gen.ts +25 -4
  135. package/dist/agent-src/skills/token-optimizer/SKILL.md +1 -1
  136. package/dist/agent-src/skills/typography-system/SKILL.md +1 -1
  137. package/dist/agent-src/skills/validate-feature-fit/SKILL.md +5 -7
  138. package/dist/agent-src/skills/verify-completion-evidence/SKILL.md +13 -1
  139. package/dist/agent-src/templates/agent-settings.md +34 -25
  140. package/dist/agent-src/templates/agents/agent-project-settings.example.yml +3 -3
  141. package/dist/agent-src/templates/agents/memory/incident-learnings.example.yml +1 -1
  142. package/dist/agent-src/templates/agents/proposal.example.md +4 -4
  143. package/dist/agent-src/templates/copilot-instructions.md +1 -1
  144. package/dist/agent-src/templates/github-workflows/memory-hygiene.yml +10 -10
  145. package/dist/agent-src/templates/github-workflows/pr-risk-review.yml +19 -8
  146. package/dist/agent-src/templates/github-workflows/proposal-drift.yml +11 -8
  147. package/dist/agent-src/templates/github-workflows/roadmap-progress-check.yml +10 -12
  148. package/dist/agent-src/templates/hooks/pre-commit-frontmatter +21 -11
  149. package/dist/agent-src/templates/hooks/pre-commit-roadmap-progress +43 -29
  150. package/dist/agent-src/templates/roadmaps.md +9 -4
  151. package/dist/agent-src/templates/rule.md +3 -3
  152. package/dist/agent-src/templates/scripts/README.md +6 -6
  153. package/dist/agent-src/templates/scripts/check_memory.ts +24 -2
  154. package/dist/agent-src/templates/scripts/check_memory_proposal.ts +23 -4
  155. package/dist/agent-src/templates/scripts/historical-bug-patterns.example.yml +1 -1
  156. package/dist/agent-src/templates/scripts/memory_hash.ts +24 -2
  157. package/dist/agent-src/templates/scripts/memory_lookup.ts +24 -2
  158. package/dist/agent-src/templates/scripts/memory_report.ts +24 -2
  159. package/dist/agent-src/templates/scripts/memory_signal.ts +24 -2
  160. package/dist/agent-src/templates/scripts/memory_status.ts +26 -2
  161. package/dist/agent-src/templates/scripts/ownership-map.example.yml +1 -1
  162. package/dist/agent-src/templates/scripts/pr-risk-config.example.yml +1 -1
  163. package/dist/agent-src/templates/scripts/pr_review_routing.ts +24 -3
  164. package/dist/agent-src/templates/scripts/pr_risk_review.ts +0 -0
  165. package/dist/agent-src/templates/scripts/telemetry_record.ts +24 -3
  166. package/dist/agent-src/templates/scripts/telemetry_report.ts +25 -3
  167. package/dist/agent-src/templates/scripts/telemetry_status.ts +24 -3
  168. package/dist/agent-src/templates/scripts/tier_usage_report.ts +24 -2
  169. package/dist/agent-src/templates/scripts/work_engine/_lib/agent_settings.ts +44 -10
  170. package/dist/agent-src/templates/scripts/work_engine/hooks/builtin/_chat_history_base.ts +26 -13
  171. package/dist/agent-src/templates/skill.md +2 -2
  172. package/dist/cli/python/knowledge_ingest.js +24 -3
  173. package/dist/cli/python/knowledge_ingest.js.map +1 -1
  174. package/dist/cli/python/workspace_analytics.js +23 -3
  175. package/dist/cli/python/workspace_analytics.js.map +1 -1
  176. package/dist/cli/python/workspace_crypto.js +23 -3
  177. package/dist/cli/python/workspace_crypto.js.map +1 -1
  178. package/dist/cli/python/workspace_documents.js +23 -3
  179. package/dist/cli/python/workspace_documents.js.map +1 -1
  180. package/dist/cli/python/workspace_drive.js +24 -3
  181. package/dist/cli/python/workspace_drive.js.map +1 -1
  182. package/dist/cli/python/workspace_drive_health.js +23 -3
  183. package/dist/cli/python/workspace_drive_health.js.map +1 -1
  184. package/dist/cli/python/workspace_explain.js +23 -3
  185. package/dist/cli/python/workspace_explain.js.map +1 -1
  186. package/dist/cli/python/workspace_hosts.js +23 -3
  187. package/dist/cli/python/workspace_hosts.js.map +1 -1
  188. package/dist/cli/python/workspace_inbox.js +23 -3
  189. package/dist/cli/python/workspace_inbox.js.map +1 -1
  190. package/dist/cli/python/workspace_render.js +23 -3
  191. package/dist/cli/python/workspace_render.js.map +1 -1
  192. package/dist/cli/python/workspace_roles.js +23 -3
  193. package/dist/cli/python/workspace_roles.js.map +1 -1
  194. package/dist/cli/python/workspace_sessions.js +23 -3
  195. package/dist/cli/python/workspace_sessions.js.map +1 -1
  196. package/dist/cli/python/workspace_skills.js +23 -3
  197. package/dist/cli/python/workspace_skills.js.map +1 -1
  198. package/dist/cli/registry.js +2 -0
  199. package/dist/cli/registry.js.map +1 -1
  200. package/dist/discovery/deprecation-report.md +1 -1
  201. package/dist/discovery/discovery-manifest.json +118 -118
  202. package/dist/discovery/discovery-manifest.json.sha256 +1 -1
  203. package/dist/discovery/discovery-manifest.summary.md +2 -2
  204. package/dist/discovery/orphan-report.md +1 -1
  205. package/dist/discovery/packs.json +3 -3
  206. package/dist/discovery/trust-report.md +1 -1
  207. package/dist/discovery/workspaces.json +3 -3
  208. package/dist/install/install.mjs +647 -408
  209. package/dist/mcp/registry-manifest.json +3 -3
  210. package/dist/server/routes/settings.js +4 -4
  211. package/dist/server/routes/settings.js.map +1 -1
  212. package/dist/server/schemas/settings.js +1 -1
  213. package/dist/server/schemas/settings.js.map +1 -1
  214. package/docs/CLAIMS.md +2 -2
  215. package/docs/archive/CHANGELOG-pre-8.1.0.md +316 -0
  216. package/docs/benchmark.md +40 -0
  217. package/docs/contracts/CHANGELOG-conventions.md +8 -5
  218. package/docs/contracts/branch-protection-policy.md +14 -5
  219. package/docs/contracts/mcp-phase-1-scope.md +75 -0
  220. package/docs/contracts/mcp-tool-inventory.md +22 -15
  221. package/docs/contracts/release-pr-gating.md +22 -11
  222. package/docs/contracts/skill-bundled-assets.md +2 -2
  223. package/docs/customization.md +1 -1
  224. package/docs/decisions/ADR-110-discipline-profile-resolution-locus.md +9 -4
  225. package/docs/decisions/ADR-111-canonical-glama-listing.md +97 -0
  226. package/docs/decisions/ADR-112-stdio-lite-stays-read-only.md +92 -0
  227. package/docs/decisions/ADR-113-ci-native-release-label-trigger.md +201 -0
  228. package/docs/decisions/INDEX.md +3 -0
  229. package/docs/distribution/registry-submissions.md +1 -1
  230. package/docs/getting-started.md +8 -6
  231. package/docs/guidelines/agent-infra/corpus-grounding-authoring.md +2 -2
  232. package/docs/guidelines/agent-infra/engineering-memory-data-format.md +4 -4
  233. package/docs/guidelines/agent-infra/installed-tools-manifest.md +3 -3
  234. package/docs/guidelines/agent-infra/language-and-tone-examples.md +2 -2
  235. package/docs/guidelines/agent-infra/layered-settings.md +4 -4
  236. package/docs/guidelines/agent-infra/memory-access.md +19 -18
  237. package/docs/guidelines/agent-infra/naming.md +1 -1
  238. package/docs/guidelines/agent-infra/roadmap-progress-mechanics.md +5 -5
  239. package/docs/guidelines/agent-infra/role-contracts.md +1 -1
  240. package/docs/guidelines/agent-infra/security-lint-containment.md +2 -2
  241. package/docs/guidelines/agent-infra/self-improvement-pipeline.md +1 -1
  242. package/docs/guidelines/agent-infra/size-and-scope.md +1 -1
  243. package/docs/guidelines/agent-infra/skill-quality-checklist.md +5 -5
  244. package/docs/guidelines/augment-portability-patterns.md +1 -1
  245. package/docs/installation.md +13 -14
  246. package/docs/mcp-server.md +32 -20
  247. package/docs/proof.md +1 -1
  248. package/docs/setup/mcp-cloud-endpoints.md +9 -2
  249. package/docs/setup/per-ide/claude-code.md +10 -4
  250. package/package.json +4 -3
  251. package/src/config/agent-settings.template.yml +31 -17
  252. package/src/config/host-capabilities.yml +25 -16
  253. package/src/config/profiles/balanced.ini +5 -3
  254. package/src/scripts/_cli/cmd_analyze_session.ts +23 -4
  255. package/src/scripts/_cli/cmd_conformance.ts +23 -4
  256. package/src/scripts/_cli/cmd_doctor.ts +196 -8
  257. package/src/scripts/_cli/cmd_explain.ts +23 -4
  258. package/src/scripts/_cli/cmd_export.ts +23 -4
  259. package/src/scripts/_cli/cmd_fleet.ts +23 -4
  260. package/src/scripts/_cli/cmd_migrate.ts +23 -4
  261. package/src/scripts/_cli/cmd_preflight.ts +24 -4
  262. package/src/scripts/_cli/cmd_prune.ts +23 -4
  263. package/src/scripts/_cli/cmd_refresh.ts +23 -4
  264. package/src/scripts/_cli/cmd_settings_check.ts +23 -4
  265. package/src/scripts/_cli/cmd_settings_migrate.ts +23 -4
  266. package/src/scripts/_cli/cmd_sync.ts +23 -4
  267. package/src/scripts/_cli/cmd_uninstall.ts +45 -4
  268. package/src/scripts/_cli/cmd_update.ts +23 -4
  269. package/src/scripts/_cli/cmd_upgrade.ts +307 -17
  270. package/src/scripts/_cli/cmd_validate.ts +23 -4
  271. package/src/scripts/_cli/cmd_versions.ts +23 -4
  272. package/src/scripts/_dispatch.bash +62 -19
  273. package/src/scripts/_lib/claude_plugin.ts +83 -0
  274. package/src/scripts/_lib/claude_settings_hooks.ts +251 -0
  275. package/src/scripts/_lib/knowledge_global.ts +24 -2
  276. package/src/scripts/_lib/knowledge_global_promote.ts +24 -2
  277. package/src/scripts/_lib/knowledge_global_redaction.ts +24 -2
  278. package/src/scripts/_lib/link_crypto.ts +24 -5
  279. package/src/scripts/_lib/pin_resolver.ts +24 -3
  280. package/src/scripts/adoption_report.ts +23 -4
  281. package/src/scripts/adoption_snapshot.ts +23 -1
  282. package/src/scripts/adoption_status.ts +23 -4
  283. package/src/scripts/adr/regenerate_index.ts +24 -3
  284. package/src/scripts/ai_council/airgap.ts +25 -2
  285. package/src/scripts/ai_council/compile_corpus.ts +24 -2
  286. package/src/scripts/ai_council/pricing.ts +11 -1
  287. package/src/scripts/analysis_freshness.ts +23 -4
  288. package/src/scripts/annotate_discovery.ts +23 -1
  289. package/src/scripts/apply_modules_config.ts +23 -4
  290. package/src/scripts/audit_adr_coverage.ts +23 -4
  291. package/src/scripts/audit_auto_rules.ts +23 -1
  292. package/src/scripts/audit_cloud_compatibility.ts +23 -4
  293. package/src/scripts/audit_command_surface.ts +23 -4
  294. package/src/scripts/audit_initial_context.ts +23 -3
  295. package/src/scripts/audit_likelihood.ts +23 -1
  296. package/src/scripts/audit_mcp_tools.ts +23 -3
  297. package/src/scripts/audit_overlap.ts +23 -1
  298. package/src/scripts/audit_skill_descriptions.ts +24 -2
  299. package/src/scripts/audit_skill_overlap.ts +23 -1
  300. package/src/scripts/audit_user_type_axis.ts +23 -4
  301. package/src/scripts/backfill_model_tier.ts +23 -4
  302. package/src/scripts/bench_ab_cache_dispatch.ts +23 -1
  303. package/src/scripts/bench_ab_clone.ts +23 -1
  304. package/src/scripts/bench_ab_diff.ts +23 -1
  305. package/src/scripts/bench_ab_integrity.ts +23 -1
  306. package/src/scripts/bench_ab_run.ts +23 -2
  307. package/src/scripts/bench_ab_task_runner.ts +23 -1
  308. package/src/scripts/bench_ab_tracka_run.ts +23 -2
  309. package/src/scripts/bench_ab_v2_run.ts +23 -1
  310. package/src/scripts/bench_ab_v2_stats.ts +23 -1
  311. package/src/scripts/bench_baseline_ready.ts +23 -1
  312. package/src/scripts/bench_condense_memory.ts +23 -1
  313. package/src/scripts/bench_drift_check.ts +23 -2
  314. package/src/scripts/bench_matrix.ts +23 -4
  315. package/src/scripts/bench_per_tool.ts +23 -1
  316. package/src/scripts/bench_quality_run.ts +23 -2
  317. package/src/scripts/bench_rtk_savings.ts +23 -1
  318. package/src/scripts/bench_rule_load_latency.ts +23 -2
  319. package/src/scripts/bench_run.ts +23 -2
  320. package/src/scripts/bench_runner.ts +23 -1
  321. package/src/scripts/build_cloud_bundle.ts +23 -3
  322. package/src/scripts/build_discovery_manifest.ts +23 -4
  323. package/src/scripts/build_linear_digest.ts +23 -3
  324. package/src/scripts/build_mcp_registry_manifest.ts +23 -4
  325. package/src/scripts/build_rule_trigger_matrix.ts +23 -4
  326. package/src/scripts/capture_showcase_session.ts +23 -1
  327. package/src/scripts/chat_history.ts +24 -3
  328. package/src/scripts/check_always_budget.ts +23 -2
  329. package/src/scripts/check_artefact_checksums.ts +23 -4
  330. package/src/scripts/check_augment_description_cap.ts +23 -4
  331. package/src/scripts/check_augmentignore.ts +23 -4
  332. package/src/scripts/check_beta_review_markers.ts +23 -4
  333. package/src/scripts/check_cluster_patterns.ts +23 -4
  334. package/src/scripts/check_command_count_messaging.ts +23 -4
  335. package/src/scripts/check_comparison.ts +23 -1
  336. package/src/scripts/check_condensation.ts +24 -3
  337. package/src/scripts/check_condensed_paths.ts +23 -2
  338. package/src/scripts/check_context_paths.ts +23 -4
  339. package/src/scripts/check_council_config_location.ts +23 -4
  340. package/src/scripts/check_council_layout.ts +23 -4
  341. package/src/scripts/check_council_references.ts +23 -4
  342. package/src/scripts/check_discovery_determinism.ts +24 -4
  343. package/src/scripts/check_gate_paths.ts +23 -4
  344. package/src/scripts/check_generated_artefact_headers.ts +23 -4
  345. package/src/scripts/check_generator_output_coverage.ts +23 -4
  346. package/src/scripts/check_gitignore_freshness.ts +23 -4
  347. package/src/scripts/check_iron_law_prominence.ts +23 -4
  348. package/src/scripts/check_kernel_prefix_stability.ts +0 -0
  349. package/src/scripts/check_kernel_rule_bundle.ts +23 -4
  350. package/src/scripts/check_knowledge_cards.ts +23 -1
  351. package/src/scripts/check_md_language.ts +23 -4
  352. package/src/scripts/check_media_deps.ts +24 -1
  353. package/src/scripts/check_memory.ts +24 -2
  354. package/src/scripts/check_memory_proposal.ts +23 -4
  355. package/src/scripts/check_module_management_neutral.ts +23 -4
  356. package/src/scripts/check_no_conflict_markers.ts +23 -4
  357. package/src/scripts/check_no_external_sources.ts +23 -4
  358. package/src/scripts/check_no_local_settings_committed.ts +24 -4
  359. package/src/scripts/check_no_new_legacy_path.ts +23 -4
  360. package/src/scripts/check_no_roadmap_refs.ts +23 -4
  361. package/src/scripts/check_one_off_location.ts +23 -4
  362. package/src/scripts/check_overlay_cascade_subdirs.ts +23 -4
  363. package/src/scripts/check_portability.ts +24 -3
  364. package/src/scripts/check_proposal.ts +0 -0
  365. package/src/scripts/check_public_catalog_links.ts +23 -4
  366. package/src/scripts/check_public_links.ts +23 -4
  367. package/src/scripts/check_quality_regression.ts +23 -2
  368. package/src/scripts/check_references.ts +23 -4
  369. package/src/scripts/check_release_includes_discovery.ts +23 -4
  370. package/src/scripts/check_release_pr_shape.ts +23 -4
  371. package/src/scripts/check_release_published.ts +23 -4
  372. package/src/scripts/check_release_trunk_sync.ts +23 -4
  373. package/src/scripts/check_reply_consistency.ts +23 -4
  374. package/src/scripts/check_roadmap_trackable.ts +23 -4
  375. package/src/scripts/check_role_doc_links.ts +23 -4
  376. package/src/scripts/check_safety_floor_untouched.ts +24 -4
  377. package/src/scripts/check_site_links.ts +23 -1
  378. package/src/scripts/check_skill_gaps.ts +23 -1
  379. package/src/scripts/check_skill_requires.ts +23 -4
  380. package/src/scripts/check_structural_breaking.ts +24 -4
  381. package/src/scripts/check_surface_tiers.ts +23 -4
  382. package/src/scripts/check_template_pin_drift.ts +23 -4
  383. package/src/scripts/check_test_coverage_diff.ts +23 -4
  384. package/src/scripts/check_token_optimizer_freshness.ts +23 -4
  385. package/src/scripts/check_token_quality_golden.ts +23 -2
  386. package/src/scripts/check_token_regression.ts +23 -2
  387. package/src/scripts/check_tracked_but_ignored.ts +24 -4
  388. package/src/scripts/check_trigger_evals.ts +23 -4
  389. package/src/scripts/check_trunk_drift.ts +24 -1
  390. package/src/scripts/check_update_banner.ts +23 -4
  391. package/src/scripts/ci_summary.ts +23 -4
  392. package/src/scripts/ci_time_ratio.ts +23 -4
  393. package/src/scripts/cluster_near_miss_patterns.ts +0 -0
  394. package/src/scripts/compile_router.ts +23 -4
  395. package/src/scripts/condense.ts +30 -31
  396. package/src/scripts/condense_memory.ts +24 -2
  397. package/src/scripts/config/packs.ts +24 -4
  398. package/src/scripts/config/session_profiles.ts +23 -4
  399. package/src/scripts/context_hygiene_hook.ts +24 -3
  400. package/src/scripts/cost_by_conversation.ts +23 -4
  401. package/src/scripts/cost_summary.ts +23 -4
  402. package/src/scripts/council_cli.ts +35 -7
  403. package/src/scripts/council_prune.ts +25 -2
  404. package/src/scripts/cross_repo_retrieve.ts +23 -4
  405. package/src/scripts/discovery_stats.ts +23 -4
  406. package/src/scripts/evidence_report.ts +23 -1
  407. package/src/scripts/export_replay_corpus.ts +23 -2
  408. package/src/scripts/extract_audit_patterns.ts +23 -1
  409. package/src/scripts/first_run_gate_hook.ts +24 -3
  410. package/src/scripts/gen_discovery_baseline.ts +23 -4
  411. package/src/scripts/generate_capabilities_index.ts +24 -5
  412. package/src/scripts/generate_capability_matrix.ts +23 -4
  413. package/src/scripts/generate_catalog.ts +23 -1
  414. package/src/scripts/generate_command_flows.ts +23 -4
  415. package/src/scripts/generate_cookbook.ts +23 -4
  416. package/src/scripts/generate_index.ts +23 -4
  417. package/src/scripts/generate_ownership_matrix.ts +23 -1
  418. package/src/scripts/generate_pack_manifests.ts +24 -5
  419. package/src/scripts/generate_role_experiences_catalog.ts +23 -4
  420. package/src/scripts/hooks/block_no_verify.ts +23 -4
  421. package/src/scripts/hooks/design_slop_hook.ts +24 -3
  422. package/src/scripts/hooks/dispatch_hook.ts +47 -14
  423. package/src/scripts/hooks/replay_hook.ts +23 -2
  424. package/src/scripts/hooks/rtk_wrap_hook.ts +24 -5
  425. package/src/scripts/hooks_doctor.ts +23 -2
  426. package/src/scripts/hooks_status.ts +23 -2
  427. package/src/scripts/injection_scan_hook.ts +24 -5
  428. package/src/scripts/install +23 -4
  429. package/src/scripts/install.ts +102 -44
  430. package/src/scripts/inventory_abstraction_budget.ts +23 -1
  431. package/src/scripts/inventory_frontmatter.ts +23 -1
  432. package/src/scripts/inventory_meta_layers.ts +23 -1
  433. package/src/scripts/iron_law_sha.ts +23 -4
  434. package/src/scripts/janitor.ts +23 -4
  435. package/src/scripts/knowledge_global_cli.ts +24 -2
  436. package/src/scripts/linked_projects_list.ts +23 -4
  437. package/src/scripts/lint_agent_security.ts +23 -4
  438. package/src/scripts/lint_agent_skill_names.ts +23 -4
  439. package/src/scripts/lint_agents_layout.ts +23 -4
  440. package/src/scripts/lint_agents_md.ts +23 -4
  441. package/src/scripts/lint_archived_skills.ts +23 -4
  442. package/src/scripts/lint_artefact_frontmatter.ts +23 -4
  443. package/src/scripts/lint_bench_ab.ts +23 -4
  444. package/src/scripts/lint_bench_corpus.ts +23 -2
  445. package/src/scripts/lint_command_flow_coverage.ts +23 -4
  446. package/src/scripts/lint_command_routing.ts +23 -4
  447. package/src/scripts/lint_command_tiers.ts +23 -2
  448. package/src/scripts/lint_command_verbs.ts +23 -4
  449. package/src/scripts/lint_commit_subjects.ts +24 -4
  450. package/src/scripts/lint_confusables.ts +25 -5
  451. package/src/scripts/lint_context_spine_usage.ts +23 -4
  452. package/src/scripts/lint_discovery_manifest.ts +23 -4
  453. package/src/scripts/lint_discovery_vocabulary.ts +23 -4
  454. package/src/scripts/lint_empty_roadmaps.ts +23 -4
  455. package/src/scripts/lint_eval_freshness.ts +23 -4
  456. package/src/scripts/lint_examples.ts +23 -4
  457. package/src/scripts/lint_explain_trace.ts +23 -4
  458. package/src/scripts/lint_featured_skills.ts +0 -0
  459. package/src/scripts/lint_flows.ts +23 -4
  460. package/src/scripts/lint_framework_leakage.ts +23 -4
  461. package/src/scripts/lint_frontmatter_boilerplate.ts +23 -4
  462. package/src/scripts/lint_ghostwriter_source.ts +23 -4
  463. package/src/scripts/lint_glama_drift.ts +75 -0
  464. package/src/scripts/lint_global_paths.ts +23 -2
  465. package/src/scripts/lint_handoffs.ts +23 -4
  466. package/src/scripts/lint_hidden_unicode.ts +24 -5
  467. package/src/scripts/lint_hook_concern_budget.ts +23 -4
  468. package/src/scripts/lint_hook_manifest.ts +23 -2
  469. package/src/scripts/lint_instruction_smuggling.ts +25 -5
  470. package/src/scripts/lint_legal_pack.ts +23 -1
  471. package/src/scripts/lint_load_context.ts +23 -4
  472. package/src/scripts/lint_marketplace.ts +24 -3
  473. package/src/scripts/lint_marketplace_install_completeness.ts +23 -4
  474. package/src/scripts/lint_mcp_config_security.ts +25 -5
  475. package/src/scripts/lint_mcp_registry_manifest.ts +23 -4
  476. package/src/scripts/lint_media_policy_linkage.ts +23 -4
  477. package/src/scripts/lint_missions.ts +23 -4
  478. package/src/scripts/lint_model_tier_coverage.ts +23 -4
  479. package/src/scripts/lint_namespace.ts +23 -4
  480. package/src/scripts/lint_namespace_collisions.ts +23 -4
  481. package/src/scripts/lint_new_skill_gate.ts +23 -4
  482. package/src/scripts/lint_no_new_atomic_commands.ts +23 -4
  483. package/src/scripts/lint_one_off_age.ts +23 -4
  484. package/src/scripts/lint_orchestration_dsl.ts +23 -4
  485. package/src/scripts/lint_orchestrator_auto_detect.ts +23 -4
  486. package/src/scripts/lint_pack_boundaries.ts +23 -4
  487. package/src/scripts/lint_pack_dependencies.ts +23 -2
  488. package/src/scripts/lint_pack_first_win.ts +23 -4
  489. package/src/scripts/lint_pack_risk_class.ts +23 -1
  490. package/src/scripts/lint_persona_governance.ts +23 -4
  491. package/src/scripts/lint_positioning.ts +23 -4
  492. package/src/scripts/lint_profile_overlay_set_only.ts +23 -4
  493. package/src/scripts/lint_readme_jargon.ts +23 -4
  494. package/src/scripts/lint_readme_size.ts +23 -4
  495. package/src/scripts/lint_regression.ts +23 -4
  496. package/src/scripts/lint_roadmap_blockers.ts +23 -4
  497. package/src/scripts/lint_roadmap_ci_steps.ts +23 -4
  498. package/src/scripts/lint_roadmap_complexity.ts +23 -4
  499. package/src/scripts/lint_roadmap_later_disposition.ts +23 -4
  500. package/src/scripts/lint_role_experiences.ts +23 -4
  501. package/src/scripts/lint_rule_interactions.ts +23 -4
  502. package/src/scripts/lint_rule_tiers.ts +24 -3
  503. package/src/scripts/lint_showcase_sessions.ts +23 -4
  504. package/src/scripts/lint_skill_frontmatter_safety.ts +25 -5
  505. package/src/scripts/lint_skill_originality.ts +23 -4
  506. package/src/scripts/lint_skill_tools.ts +23 -4
  507. package/src/scripts/lint_subagent_determinism.ts +23 -4
  508. package/src/scripts/lint_ticket_buildable.ts +23 -4
  509. package/src/scripts/lint_topics_yaml.ts +23 -4
  510. package/src/scripts/lint_trust_coherence.ts +23 -4
  511. package/src/scripts/lint_value_dashboard.ts +23 -4
  512. package/src/scripts/lint_workflow_security.ts +23 -4
  513. package/src/scripts/lint_workspace_boundary.ts +23 -4
  514. package/src/scripts/mcp_exec/safety_envelope.ts +105 -0
  515. package/src/scripts/mcp_parity_smoke.ts +23 -2
  516. package/src/scripts/mcp_registry_submit.sh +14 -3
  517. package/src/scripts/mcp_render.ts +23 -4
  518. package/src/scripts/mcp_server/__main__.ts +6 -8
  519. package/src/scripts/mcp_server/consumer_tool_catalog.json +78 -3
  520. package/src/scripts/mcp_server/tools.ts +731 -0
  521. package/src/scripts/mcp_telemetry_health.ts +23 -4
  522. package/src/scripts/mcp_telemetry_query.ts +23 -4
  523. package/src/scripts/mcp_telemetry_store.ts +23 -4
  524. package/src/scripts/measure_augment_budget.ts +23 -1
  525. package/src/scripts/measure_density.ts +23 -1
  526. package/src/scripts/measure_frugality_savings.ts +23 -1
  527. package/src/scripts/measure_markitdown_lift.ts +23 -1
  528. package/src/scripts/measure_patterns.ts +23 -1
  529. package/src/scripts/measure_projection_bytes.ts +23 -1
  530. package/src/scripts/measure_rule_budget.ts +23 -4
  531. package/src/scripts/measure_skill_reduction.ts +23 -1
  532. package/src/scripts/memory_hash.ts +24 -2
  533. package/src/scripts/memory_lookup.ts +24 -2
  534. package/src/scripts/memory_report.ts +24 -2
  535. package/src/scripts/memory_signal.ts +24 -2
  536. package/src/scripts/memory_status.ts +26 -2
  537. package/src/scripts/migrate_command_suggestions.ts +23 -4
  538. package/src/scripts/migrate_frontmatter_defaults.ts +23 -4
  539. package/src/scripts/migration_status.ts +25 -4
  540. package/src/scripts/mine_missing_guardrails.ts +23 -1
  541. package/src/scripts/mine_session.ts +23 -1
  542. package/src/scripts/minimal_safe_diff_hook.ts +24 -3
  543. package/src/scripts/new_skill.ts +23 -3
  544. package/src/scripts/onboarding_gate_hook.ts +24 -3
  545. package/src/scripts/parity/coverage_diff.ts +25 -3
  546. package/src/scripts/parity/phase_gate.ts +25 -4
  547. package/src/scripts/parity/replay.ts +25 -3
  548. package/src/scripts/pattern_share.ts +23 -4
  549. package/src/scripts/plan_physical_move.ts +23 -4
  550. package/src/scripts/prediction-pool/poisson_sim.ts +24 -3
  551. package/src/scripts/prediction-pool/pool_winsim.ts +24 -3
  552. package/src/scripts/prediction-pool/score_ev.ts +24 -3
  553. package/src/scripts/print_required_checks.ts +24 -4
  554. package/src/scripts/probe_host_compliance.ts +23 -2
  555. package/src/scripts/probe_projection_fidelity.ts +23 -1
  556. package/src/scripts/probe_skill_registration.ts +24 -2
  557. package/src/scripts/profile_staleness_hook.ts +24 -3
  558. package/src/scripts/profile_use.ts +23 -4
  559. package/src/scripts/project_thin_rules.ts +23 -3
  560. package/src/scripts/propose_modules_config.ts +23 -4
  561. package/src/scripts/prototype_lint_contradictions.ts +23 -1
  562. package/src/scripts/prove_pack_extractable.ts +23 -4
  563. package/src/scripts/readme_linter.ts +23 -3
  564. package/src/scripts/redact_hook_capture.ts +23 -4
  565. package/src/scripts/refine_ticket_detect.ts +23 -4
  566. package/src/scripts/release.ts +226 -43
  567. package/src/scripts/render_benchmark_composite.ts +23 -4
  568. package/src/scripts/render_benchmark_md.ts +23 -4
  569. package/src/scripts/roadmap_progress_hook.ts +46 -16
  570. package/src/scripts/run_skill_evals.ts +23 -4
  571. package/src/scripts/runtime_dispatcher.ts +23 -4
  572. package/src/scripts/runtime_registry.ts +23 -4
  573. package/src/scripts/score_skill_selection.ts +23 -1
  574. package/src/scripts/security_audit_config.ts +24 -5
  575. package/src/scripts/skill_collision_clusters.ts +23 -4
  576. package/src/scripts/skill_discovery.ts +23 -4
  577. package/src/scripts/skill_linter.ts +23 -2
  578. package/src/scripts/skill_preview.ts +23 -4
  579. package/src/scripts/skill_tools/audit_persona_coverage.ts +23 -1
  580. package/src/scripts/skill_tools/audit_user_type_coverage.ts +23 -1
  581. package/src/scripts/skill_tools/run_block_d_eval.ts +23 -1
  582. package/src/scripts/skill_tools/score_skill_relevance.ts +23 -1
  583. package/src/scripts/skill_tools/suggest_skill_for_task.ts +24 -1
  584. package/src/scripts/skill_usage_collect.ts +23 -4
  585. package/src/scripts/smoke_path_resolution.ts +23 -4
  586. package/src/scripts/smoke_quickstart.ts +23 -4
  587. package/src/scripts/snapshot_agent_outputs.ts +23 -4
  588. package/src/scripts/spotcheck_thin_root.ts +23 -4
  589. package/src/scripts/sync_agent_settings.ts +23 -4
  590. package/src/scripts/sync_github_metadata.ts +23 -4
  591. package/src/scripts/sync_gitignore.ts +23 -4
  592. package/src/scripts/telegraph_stats.ts +23 -4
  593. package/src/scripts/tool_registry.ts +24 -4
  594. package/src/scripts/trigger_coverage.ts +23 -4
  595. package/src/scripts/update_counts.ts +23 -4
  596. package/src/scripts/update_prices.ts +23 -1
  597. package/src/scripts/validate_agent_settings.ts +23 -4
  598. package/src/scripts/validate_decision_engine.ts +23 -4
  599. package/src/scripts/validate_discovery_manifest.ts +23 -4
  600. package/src/scripts/validate_frontmatter.ts +23 -2
  601. package/src/scripts/validate_pack_yaml.ts +0 -0
  602. package/src/scripts/validate_safe_paths.ts +24 -4
  603. package/src/scripts/validate_telegraph_carveouts.ts +23 -4
  604. package/src/scripts/verify_before_complete_hook.ts +24 -3
  605. package/src/scripts/verify_physical_move.ts +23 -4
  606. package/src/scripts/wrapper_freshness_hook.ts +107 -8
  607. package/tests/fixtures/hooks/README.md +92 -0
  608. package/tests/fixtures/hooks/agent_error.json +7 -0
  609. package/tests/fixtures/hooks/post_tool_use.json +13 -0
  610. package/tests/fixtures/hooks/pre_compact.json +7 -0
  611. package/tests/fixtures/hooks/pre_tool_use.json +9 -0
  612. package/tests/fixtures/hooks/session_end.json +6 -0
  613. package/tests/fixtures/hooks/session_start.json +6 -0
  614. package/tests/fixtures/hooks/stop.json +6 -0
  615. package/tests/fixtures/hooks/user_prompt_submit.json +7 -0
@@ -1,5 +1,11 @@
1
1
  #!/usr/bin/env tsx
2
+ import { createRequire as __acCreateRequire } from 'node:module'; const require = globalThis.require ?? __acCreateRequire(import.meta.url);
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
2
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
3
9
  var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
4
10
  get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
5
11
  }) : x)(function(x) {
@@ -9,6 +15,22 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
9
15
  var __commonJS = (cb, mod) => function __require2() {
10
16
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
11
17
  };
18
+ var __copyProps = (to, from, except, desc) => {
19
+ if (from && typeof from === "object" || typeof from === "function") {
20
+ for (let key of __getOwnPropNames(from))
21
+ if (!__hasOwnProp.call(to, key) && key !== except)
22
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
23
+ }
24
+ return to;
25
+ };
26
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
27
+ // If the importer is in node compatibility mode or this is not an ESM
28
+ // file that has been converted to a CommonJS file using a Babel-
29
+ // compatible transform (i.e. "__esModule" has not been set), then set
30
+ // "default" to the CommonJS "module.exports" for node compatibility.
31
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
32
+ mod
33
+ ));
12
34
 
13
35
  // node_modules/yaml/dist/nodes/identity.js
14
36
  var require_identity = __commonJS({
@@ -87,17 +109,17 @@ var require_visit = __commonJS({
87
109
  visit.BREAK = BREAK;
88
110
  visit.SKIP = SKIP;
89
111
  visit.REMOVE = REMOVE;
90
- function visit_(key, node, visitor, path11) {
91
- const ctrl = callVisitor(key, node, visitor, path11);
112
+ function visit_(key, node, visitor, path12) {
113
+ const ctrl = callVisitor(key, node, visitor, path12);
92
114
  if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
93
- replaceNode(key, path11, ctrl);
94
- return visit_(key, ctrl, visitor, path11);
115
+ replaceNode(key, path12, ctrl);
116
+ return visit_(key, ctrl, visitor, path12);
95
117
  }
96
118
  if (typeof ctrl !== "symbol") {
97
119
  if (identity.isCollection(node)) {
98
- path11 = Object.freeze(path11.concat(node));
120
+ path12 = Object.freeze(path12.concat(node));
99
121
  for (let i = 0; i < node.items.length; ++i) {
100
- const ci = visit_(i, node.items[i], visitor, path11);
122
+ const ci = visit_(i, node.items[i], visitor, path12);
101
123
  if (typeof ci === "number")
102
124
  i = ci - 1;
103
125
  else if (ci === BREAK)
@@ -108,13 +130,13 @@ var require_visit = __commonJS({
108
130
  }
109
131
  }
110
132
  } else if (identity.isPair(node)) {
111
- path11 = Object.freeze(path11.concat(node));
112
- const ck = visit_("key", node.key, visitor, path11);
133
+ path12 = Object.freeze(path12.concat(node));
134
+ const ck = visit_("key", node.key, visitor, path12);
113
135
  if (ck === BREAK)
114
136
  return BREAK;
115
137
  else if (ck === REMOVE)
116
138
  node.key = null;
117
- const cv = visit_("value", node.value, visitor, path11);
139
+ const cv = visit_("value", node.value, visitor, path12);
118
140
  if (cv === BREAK)
119
141
  return BREAK;
120
142
  else if (cv === REMOVE)
@@ -135,17 +157,17 @@ var require_visit = __commonJS({
135
157
  visitAsync.BREAK = BREAK;
136
158
  visitAsync.SKIP = SKIP;
137
159
  visitAsync.REMOVE = REMOVE;
138
- async function visitAsync_(key, node, visitor, path11) {
139
- const ctrl = await callVisitor(key, node, visitor, path11);
160
+ async function visitAsync_(key, node, visitor, path12) {
161
+ const ctrl = await callVisitor(key, node, visitor, path12);
140
162
  if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
141
- replaceNode(key, path11, ctrl);
142
- return visitAsync_(key, ctrl, visitor, path11);
163
+ replaceNode(key, path12, ctrl);
164
+ return visitAsync_(key, ctrl, visitor, path12);
143
165
  }
144
166
  if (typeof ctrl !== "symbol") {
145
167
  if (identity.isCollection(node)) {
146
- path11 = Object.freeze(path11.concat(node));
168
+ path12 = Object.freeze(path12.concat(node));
147
169
  for (let i = 0; i < node.items.length; ++i) {
148
- const ci = await visitAsync_(i, node.items[i], visitor, path11);
170
+ const ci = await visitAsync_(i, node.items[i], visitor, path12);
149
171
  if (typeof ci === "number")
150
172
  i = ci - 1;
151
173
  else if (ci === BREAK)
@@ -156,13 +178,13 @@ var require_visit = __commonJS({
156
178
  }
157
179
  }
158
180
  } else if (identity.isPair(node)) {
159
- path11 = Object.freeze(path11.concat(node));
160
- const ck = await visitAsync_("key", node.key, visitor, path11);
181
+ path12 = Object.freeze(path12.concat(node));
182
+ const ck = await visitAsync_("key", node.key, visitor, path12);
161
183
  if (ck === BREAK)
162
184
  return BREAK;
163
185
  else if (ck === REMOVE)
164
186
  node.key = null;
165
- const cv = await visitAsync_("value", node.value, visitor, path11);
187
+ const cv = await visitAsync_("value", node.value, visitor, path12);
166
188
  if (cv === BREAK)
167
189
  return BREAK;
168
190
  else if (cv === REMOVE)
@@ -189,23 +211,23 @@ var require_visit = __commonJS({
189
211
  }
190
212
  return visitor;
191
213
  }
192
- function callVisitor(key, node, visitor, path11) {
214
+ function callVisitor(key, node, visitor, path12) {
193
215
  if (typeof visitor === "function")
194
- return visitor(key, node, path11);
216
+ return visitor(key, node, path12);
195
217
  if (identity.isMap(node))
196
- return visitor.Map?.(key, node, path11);
218
+ return visitor.Map?.(key, node, path12);
197
219
  if (identity.isSeq(node))
198
- return visitor.Seq?.(key, node, path11);
220
+ return visitor.Seq?.(key, node, path12);
199
221
  if (identity.isPair(node))
200
- return visitor.Pair?.(key, node, path11);
222
+ return visitor.Pair?.(key, node, path12);
201
223
  if (identity.isScalar(node))
202
- return visitor.Scalar?.(key, node, path11);
224
+ return visitor.Scalar?.(key, node, path12);
203
225
  if (identity.isAlias(node))
204
- return visitor.Alias?.(key, node, path11);
226
+ return visitor.Alias?.(key, node, path12);
205
227
  return void 0;
206
228
  }
207
- function replaceNode(key, path11, node) {
208
- const parent = path11[path11.length - 1];
229
+ function replaceNode(key, path12, node) {
230
+ const parent = path12[path12.length - 1];
209
231
  if (identity.isCollection(parent)) {
210
232
  parent.items[key] = node;
211
233
  } else if (identity.isPair(parent)) {
@@ -815,10 +837,10 @@ var require_Collection = __commonJS({
815
837
  var createNode = require_createNode();
816
838
  var identity = require_identity();
817
839
  var Node = require_Node();
818
- function collectionFromPath(schema, path11, value) {
840
+ function collectionFromPath(schema, path12, value) {
819
841
  let v = value;
820
- for (let i = path11.length - 1; i >= 0; --i) {
821
- const k = path11[i];
842
+ for (let i = path12.length - 1; i >= 0; --i) {
843
+ const k = path12[i];
822
844
  if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
823
845
  const a = [];
824
846
  a[k] = v;
@@ -837,7 +859,7 @@ var require_Collection = __commonJS({
837
859
  sourceObjects: /* @__PURE__ */ new Map()
838
860
  });
839
861
  }
840
- var isEmptyPath = (path11) => path11 == null || typeof path11 === "object" && !!path11[Symbol.iterator]().next().done;
862
+ var isEmptyPath = (path12) => path12 == null || typeof path12 === "object" && !!path12[Symbol.iterator]().next().done;
841
863
  var Collection = class extends Node.NodeBase {
842
864
  constructor(type, schema) {
843
865
  super(type);
@@ -867,11 +889,11 @@ var require_Collection = __commonJS({
867
889
  * be a Pair instance or a `{ key, value }` object, which may not have a key
868
890
  * that already exists in the map.
869
891
  */
870
- addIn(path11, value) {
871
- if (isEmptyPath(path11))
892
+ addIn(path12, value) {
893
+ if (isEmptyPath(path12))
872
894
  this.add(value);
873
895
  else {
874
- const [key, ...rest] = path11;
896
+ const [key, ...rest] = path12;
875
897
  const node = this.get(key, true);
876
898
  if (identity.isCollection(node))
877
899
  node.addIn(rest, value);
@@ -885,8 +907,8 @@ var require_Collection = __commonJS({
885
907
  * Removes a value from the collection.
886
908
  * @returns `true` if the item was found and removed.
887
909
  */
888
- deleteIn(path11) {
889
- const [key, ...rest] = path11;
910
+ deleteIn(path12) {
911
+ const [key, ...rest] = path12;
890
912
  if (rest.length === 0)
891
913
  return this.delete(key);
892
914
  const node = this.get(key, true);
@@ -900,8 +922,8 @@ var require_Collection = __commonJS({
900
922
  * scalar values from their surrounding node; to disable set `keepScalar` to
901
923
  * `true` (collections are always returned intact).
902
924
  */
903
- getIn(path11, keepScalar) {
904
- const [key, ...rest] = path11;
925
+ getIn(path12, keepScalar) {
926
+ const [key, ...rest] = path12;
905
927
  const node = this.get(key, true);
906
928
  if (rest.length === 0)
907
929
  return !keepScalar && identity.isScalar(node) ? node.value : node;
@@ -919,8 +941,8 @@ var require_Collection = __commonJS({
919
941
  /**
920
942
  * Checks if the collection includes a value with the key `key`.
921
943
  */
922
- hasIn(path11) {
923
- const [key, ...rest] = path11;
944
+ hasIn(path12) {
945
+ const [key, ...rest] = path12;
924
946
  if (rest.length === 0)
925
947
  return this.has(key);
926
948
  const node = this.get(key, true);
@@ -930,8 +952,8 @@ var require_Collection = __commonJS({
930
952
  * Sets a value in this collection. For `!!set`, `value` needs to be a
931
953
  * boolean to add/remove the item from the set.
932
954
  */
933
- setIn(path11, value) {
934
- const [key, ...rest] = path11;
955
+ setIn(path12, value) {
956
+ const [key, ...rest] = path12;
935
957
  if (rest.length === 0) {
936
958
  this.set(key, value);
937
959
  } else {
@@ -3446,9 +3468,9 @@ var require_Document = __commonJS({
3446
3468
  this.contents.add(value);
3447
3469
  }
3448
3470
  /** Adds a value to the document. */
3449
- addIn(path11, value) {
3471
+ addIn(path12, value) {
3450
3472
  if (assertCollection(this.contents))
3451
- this.contents.addIn(path11, value);
3473
+ this.contents.addIn(path12, value);
3452
3474
  }
3453
3475
  /**
3454
3476
  * Create a new `Alias` node, ensuring that the target `node` has the required anchor.
@@ -3523,14 +3545,14 @@ var require_Document = __commonJS({
3523
3545
  * Removes a value from the document.
3524
3546
  * @returns `true` if the item was found and removed.
3525
3547
  */
3526
- deleteIn(path11) {
3527
- if (Collection.isEmptyPath(path11)) {
3548
+ deleteIn(path12) {
3549
+ if (Collection.isEmptyPath(path12)) {
3528
3550
  if (this.contents == null)
3529
3551
  return false;
3530
3552
  this.contents = null;
3531
3553
  return true;
3532
3554
  }
3533
- return assertCollection(this.contents) ? this.contents.deleteIn(path11) : false;
3555
+ return assertCollection(this.contents) ? this.contents.deleteIn(path12) : false;
3534
3556
  }
3535
3557
  /**
3536
3558
  * Returns item at `key`, or `undefined` if not found. By default unwraps
@@ -3545,10 +3567,10 @@ var require_Document = __commonJS({
3545
3567
  * scalar values from their surrounding node; to disable set `keepScalar` to
3546
3568
  * `true` (collections are always returned intact).
3547
3569
  */
3548
- getIn(path11, keepScalar) {
3549
- if (Collection.isEmptyPath(path11))
3570
+ getIn(path12, keepScalar) {
3571
+ if (Collection.isEmptyPath(path12))
3550
3572
  return !keepScalar && identity.isScalar(this.contents) ? this.contents.value : this.contents;
3551
- return identity.isCollection(this.contents) ? this.contents.getIn(path11, keepScalar) : void 0;
3573
+ return identity.isCollection(this.contents) ? this.contents.getIn(path12, keepScalar) : void 0;
3552
3574
  }
3553
3575
  /**
3554
3576
  * Checks if the document includes a value with the key `key`.
@@ -3559,10 +3581,10 @@ var require_Document = __commonJS({
3559
3581
  /**
3560
3582
  * Checks if the document includes a value at `path`.
3561
3583
  */
3562
- hasIn(path11) {
3563
- if (Collection.isEmptyPath(path11))
3584
+ hasIn(path12) {
3585
+ if (Collection.isEmptyPath(path12))
3564
3586
  return this.contents !== void 0;
3565
- return identity.isCollection(this.contents) ? this.contents.hasIn(path11) : false;
3587
+ return identity.isCollection(this.contents) ? this.contents.hasIn(path12) : false;
3566
3588
  }
3567
3589
  /**
3568
3590
  * Sets a value in this document. For `!!set`, `value` needs to be a
@@ -3579,13 +3601,13 @@ var require_Document = __commonJS({
3579
3601
  * Sets a value in this document. For `!!set`, `value` needs to be a
3580
3602
  * boolean to add/remove the item from the set.
3581
3603
  */
3582
- setIn(path11, value) {
3583
- if (Collection.isEmptyPath(path11)) {
3604
+ setIn(path12, value) {
3605
+ if (Collection.isEmptyPath(path12)) {
3584
3606
  this.contents = value;
3585
3607
  } else if (this.contents == null) {
3586
- this.contents = Collection.collectionFromPath(this.schema, Array.from(path11), value);
3608
+ this.contents = Collection.collectionFromPath(this.schema, Array.from(path12), value);
3587
3609
  } else if (assertCollection(this.contents)) {
3588
- this.contents.setIn(path11, value);
3610
+ this.contents.setIn(path12, value);
3589
3611
  }
3590
3612
  }
3591
3613
  /**
@@ -5545,9 +5567,9 @@ var require_cst_visit = __commonJS({
5545
5567
  visit.BREAK = BREAK;
5546
5568
  visit.SKIP = SKIP;
5547
5569
  visit.REMOVE = REMOVE;
5548
- visit.itemAtPath = (cst, path11) => {
5570
+ visit.itemAtPath = (cst, path12) => {
5549
5571
  let item = cst;
5550
- for (const [field, index] of path11) {
5572
+ for (const [field, index] of path12) {
5551
5573
  const tok = item?.[field];
5552
5574
  if (tok && "items" in tok) {
5553
5575
  item = tok.items[index];
@@ -5556,23 +5578,23 @@ var require_cst_visit = __commonJS({
5556
5578
  }
5557
5579
  return item;
5558
5580
  };
5559
- visit.parentCollection = (cst, path11) => {
5560
- const parent = visit.itemAtPath(cst, path11.slice(0, -1));
5561
- const field = path11[path11.length - 1][0];
5581
+ visit.parentCollection = (cst, path12) => {
5582
+ const parent = visit.itemAtPath(cst, path12.slice(0, -1));
5583
+ const field = path12[path12.length - 1][0];
5562
5584
  const coll = parent?.[field];
5563
5585
  if (coll && "items" in coll)
5564
5586
  return coll;
5565
5587
  throw new Error("Parent collection not found");
5566
5588
  };
5567
- function _visit(path11, item, visitor) {
5568
- let ctrl = visitor(item, path11);
5589
+ function _visit(path12, item, visitor) {
5590
+ let ctrl = visitor(item, path12);
5569
5591
  if (typeof ctrl === "symbol")
5570
5592
  return ctrl;
5571
5593
  for (const field of ["key", "value"]) {
5572
5594
  const token = item[field];
5573
5595
  if (token && "items" in token) {
5574
5596
  for (let i = 0; i < token.items.length; ++i) {
5575
- const ci = _visit(Object.freeze(path11.concat([[field, i]])), token.items[i], visitor);
5597
+ const ci = _visit(Object.freeze(path12.concat([[field, i]])), token.items[i], visitor);
5576
5598
  if (typeof ci === "number")
5577
5599
  i = ci - 1;
5578
5600
  else if (ci === BREAK)
@@ -5583,10 +5605,10 @@ var require_cst_visit = __commonJS({
5583
5605
  }
5584
5606
  }
5585
5607
  if (typeof ctrl === "function" && field === "key")
5586
- ctrl = ctrl(item, path11);
5608
+ ctrl = ctrl(item, path12);
5587
5609
  }
5588
5610
  }
5589
- return typeof ctrl === "function" ? ctrl(item, path11) : ctrl;
5611
+ return typeof ctrl === "function" ? ctrl(item, path12) : ctrl;
5590
5612
  }
5591
5613
  exports.visit = visit;
5592
5614
  }
@@ -6888,14 +6910,14 @@ var require_parser = __commonJS({
6888
6910
  case "scalar":
6889
6911
  case "single-quoted-scalar":
6890
6912
  case "double-quoted-scalar": {
6891
- const fs13 = this.flowScalar(this.type);
6913
+ const fs14 = this.flowScalar(this.type);
6892
6914
  if (atNextItem || it.value) {
6893
- map.items.push({ start, key: fs13, sep: [] });
6915
+ map.items.push({ start, key: fs14, sep: [] });
6894
6916
  this.onKeyLine = true;
6895
6917
  } else if (it.sep) {
6896
- this.stack.push(fs13);
6918
+ this.stack.push(fs14);
6897
6919
  } else {
6898
- Object.assign(it, { key: fs13, sep: [] });
6920
+ Object.assign(it, { key: fs14, sep: [] });
6899
6921
  this.onKeyLine = true;
6900
6922
  }
6901
6923
  return;
@@ -7023,13 +7045,13 @@ var require_parser = __commonJS({
7023
7045
  case "scalar":
7024
7046
  case "single-quoted-scalar":
7025
7047
  case "double-quoted-scalar": {
7026
- const fs13 = this.flowScalar(this.type);
7048
+ const fs14 = this.flowScalar(this.type);
7027
7049
  if (!it || it.value)
7028
- fc.items.push({ start: [], key: fs13, sep: [] });
7050
+ fc.items.push({ start: [], key: fs14, sep: [] });
7029
7051
  else if (it.sep)
7030
- this.stack.push(fs13);
7052
+ this.stack.push(fs14);
7031
7053
  else
7032
- Object.assign(it, { key: fs13, sep: [] });
7054
+ Object.assign(it, { key: fs14, sep: [] });
7033
7055
  return;
7034
7056
  }
7035
7057
  case "flow-map-end":
@@ -7237,7 +7259,7 @@ var require_public_api = __commonJS({
7237
7259
  }
7238
7260
  return doc;
7239
7261
  }
7240
- function parse(src, reviver, options) {
7262
+ function parse2(src, reviver, options) {
7241
7263
  let _reviver = void 0;
7242
7264
  if (typeof reviver === "function") {
7243
7265
  _reviver = reviver;
@@ -7278,7 +7300,7 @@ var require_public_api = __commonJS({
7278
7300
  return value.toString(options);
7279
7301
  return new Document.Document(value, _replacer, options).toString(options);
7280
7302
  }
7281
- exports.parse = parse;
7303
+ exports.parse = parse2;
7282
7304
  exports.parseAllDocuments = parseAllDocuments;
7283
7305
  exports.parseDocument = parseDocument;
7284
7306
  exports.stringify = stringify;
@@ -7338,11 +7360,11 @@ var require_dist = __commonJS({
7338
7360
  });
7339
7361
 
7340
7362
  // src/scripts/install.ts
7341
- import { spawnSync as spawnSync2 } from "node:child_process";
7363
+ import { spawn, spawnSync as spawnSync2 } from "node:child_process";
7342
7364
  import * as crypto2 from "node:crypto";
7343
- import * as fs12 from "node:fs";
7365
+ import * as fs13 from "node:fs";
7344
7366
  import * as os6 from "node:os";
7345
- import * as path10 from "node:path";
7367
+ import * as path11 from "node:path";
7346
7368
  import process3 from "node:process";
7347
7369
  import { fileURLToPath as fileURLToPath3, pathToFileURL as pathToFileURL2 } from "node:url";
7348
7370
 
@@ -7726,8 +7748,8 @@ function lockfile_write_path(env) {
7726
7748
  }
7727
7749
  return write_target("installed.lock", { env: env ?? null });
7728
7750
  }
7729
- function read_lockfile(path11) {
7730
- const target = path11 ?? lockfile_path();
7751
+ function read_lockfile(path12) {
7752
+ const target = path12 ?? lockfile_path();
7731
7753
  let text;
7732
7754
  try {
7733
7755
  text = fs2.readFileSync(target, { encoding: "utf-8" });
@@ -7970,8 +7992,8 @@ function load_lab_pack_ids(repo_root) {
7970
7992
  const vocab = path3.join(repo_root, "src", "config", "discovery", "packs.yml");
7971
7993
  const ids = /* @__PURE__ */ new Set();
7972
7994
  try {
7973
- const YAML = require_dist();
7974
- const data = YAML.parse(fs3.readFileSync(vocab, "utf-8"), { version: "1.1" });
7995
+ const YAML2 = require_dist();
7996
+ const data = YAML2.parse(fs3.readFileSync(vocab, "utf-8"), { version: "1.1" });
7975
7997
  for (const entry of data ?? []) {
7976
7998
  if (entry && typeof entry === "object" && !Array.isArray(entry)) {
7977
7999
  const rec = entry;
@@ -8595,18 +8617,18 @@ function manifest_path(project_root, env) {
8595
8617
  var _TOP_KEY_RE = /^([A-Za-z_][A-Za-z0-9_]*)\s*:\s*"?([^"\n]*?)"?\s*$/;
8596
8618
  var _LIST_DASH_RE = /^\s*-\s*(.+?)\s*$/;
8597
8619
  var _INDENT_KEY_RE = /^\s+([A-Za-z_][A-Za-z0-9_]*)\s*:\s*"?([^"\n]*?)"?\s*$/;
8598
- function read_manifest(path11) {
8620
+ function read_manifest(path12) {
8599
8621
  let text;
8600
8622
  try {
8601
- text = require_read_text(path11);
8623
+ text = require_read_text(path12);
8602
8624
  } catch {
8603
8625
  return null;
8604
8626
  }
8605
8627
  const data = _parse_manual(text);
8606
8628
  return _normalise_v2_shape(data);
8607
8629
  }
8608
- function require_read_text(path11) {
8609
- return fs6.readFileSync(path11, { encoding: "utf-8" });
8630
+ function require_read_text(path12) {
8631
+ return fs6.readFileSync(path12, { encoding: "utf-8" });
8610
8632
  }
8611
8633
  function _normalise_v2_shape(data) {
8612
8634
  if (data["tools"] === void 0 || data["tools"] === null) {
@@ -8787,9 +8809,9 @@ function stable_sort(items, key) {
8787
8809
  return a.index - b.index;
8788
8810
  }).map((entry) => entry.item);
8789
8811
  }
8790
- function write_manifest(path11, version, tools, options = {}) {
8812
+ function write_manifest(path12, version, tools, options = {}) {
8791
8813
  const rendered = _render2(version, tools, { deploy_roots: options.deploy_roots ?? null });
8792
- return write_atomic(path11, rendered);
8814
+ return write_atomic(path12, rendered);
8793
8815
  }
8794
8816
  var ScopeMismatchError = class extends Error {
8795
8817
  name_;
@@ -9151,11 +9173,167 @@ function build_command_bundles(package_root, dest_dir, force = false, curation =
9151
9173
  return written;
9152
9174
  }
9153
9175
 
9176
+ // src/scripts/_lib/claude_settings_hooks.ts
9177
+ var YAML = __toESM(require_dist(), 1);
9178
+ import * as fs8 from "node:fs";
9179
+ import * as path7 from "node:path";
9180
+
9181
+ // src/install/atomic.ts
9182
+ import {
9183
+ closeSync as closeSync3,
9184
+ fsyncSync,
9185
+ mkdirSync as mkdirSync5,
9186
+ openSync as openSync3,
9187
+ readFileSync as readFileSync6,
9188
+ renameSync as renameSync5,
9189
+ unlinkSync as unlinkSync4,
9190
+ writeSync
9191
+ } from "node:fs";
9192
+ import { dirname as dirname4, join as join7 } from "node:path";
9193
+ function atomicWriteFile(target, data, options = {}) {
9194
+ const mode = options.mode ?? 420;
9195
+ const parent = dirname4(target);
9196
+ mkdirSync5(parent, { recursive: true });
9197
+ const tmp = join7(parent, `.tmp.${process.pid}.${randSuffix()}`);
9198
+ let fd = null;
9199
+ try {
9200
+ fd = openSync3(tmp, "w", mode);
9201
+ const buf = typeof data === "string" ? Buffer.from(data, "utf8") : data;
9202
+ writeSync(fd, buf, 0, buf.length, 0);
9203
+ fsyncSync(fd);
9204
+ closeSync3(fd);
9205
+ fd = null;
9206
+ renameSync5(tmp, target);
9207
+ } catch (err) {
9208
+ if (fd !== null) {
9209
+ try {
9210
+ closeSync3(fd);
9211
+ } catch {
9212
+ }
9213
+ }
9214
+ try {
9215
+ unlinkSync4(tmp);
9216
+ } catch {
9217
+ }
9218
+ throw err;
9219
+ }
9220
+ }
9221
+ function randSuffix() {
9222
+ return Math.floor(Math.random() * 281474976710655).toString(16).padStart(12, "0");
9223
+ }
9224
+
9225
+ // src/scripts/_lib/claude_settings_hooks.ts
9226
+ function _yaml_parse(text) {
9227
+ return YAML.parse(text);
9228
+ }
9229
+ var MANAGED_SIGNATURE = "dispatch:hook --platform claude";
9230
+ var CorruptSettingsError = class extends Error {
9231
+ constructor(file, cause) {
9232
+ super(
9233
+ `${file} exists but is not valid JSON (${cause}). Refusing to overwrite a user-owned settings file \u2014 fix or remove it, then re-run.`
9234
+ );
9235
+ this.name = "CorruptSettingsError";
9236
+ }
9237
+ };
9238
+ var SettingsLockError = class extends Error {
9239
+ constructor(lockPath) {
9240
+ super(
9241
+ `settings lock ${lockPath} is held by another process. Re-run when the concurrent install finishes (stale lock: delete the file).`
9242
+ );
9243
+ this.name = "SettingsLockError";
9244
+ }
9245
+ };
9246
+ function build_claude_hook_matrix(manifest_path2) {
9247
+ const raw = fs8.readFileSync(manifest_path2, "utf8");
9248
+ const manifest = _yaml_parse(raw) ?? {};
9249
+ const hook_spec = manifest["schema_version"] ?? 1;
9250
+ const platforms = manifest["platforms"] ?? {};
9251
+ const claude_events = (platforms["claude"] ?? {}) || {};
9252
+ const aliasesAll = manifest["native_event_aliases"] ?? {};
9253
+ const aliases = (aliasesAll["claude"] ?? {}) || {};
9254
+ const ac_to_native = {};
9255
+ for (const [native, ac] of Object.entries(aliases)) {
9256
+ ac_to_native[String(ac)] = native;
9257
+ }
9258
+ const matrix = {};
9259
+ for (const [ac_event, concerns] of Object.entries(claude_events)) {
9260
+ if (!concerns || Array.isArray(concerns) && concerns.length === 0) continue;
9261
+ const native = ac_to_native[ac_event];
9262
+ if (native === void 0) continue;
9263
+ matrix[native] = `BIN="$CLAUDE_PROJECT_DIR/agent-config"; [ -x "$BIN" ] || BIN=agent-config; "$BIN" dispatch:hook --platform claude --event ${ac_event} --native-event ${native} --project-dir "$CLAUDE_PROJECT_DIR" --min-version ${String(hook_spec)}`;
9264
+ }
9265
+ return matrix;
9266
+ }
9267
+ function _is_managed_group(group) {
9268
+ if (typeof group !== "object" || group === null || Array.isArray(group)) return false;
9269
+ const hooks = group.hooks;
9270
+ if (!Array.isArray(hooks)) return false;
9271
+ return hooks.some(
9272
+ (h) => typeof h === "object" && h !== null && typeof h.command === "string" && h.command.includes(MANAGED_SIGNATURE)
9273
+ );
9274
+ }
9275
+ function _read_settings(settings_path) {
9276
+ if (!fs8.existsSync(settings_path)) return {};
9277
+ const raw = fs8.readFileSync(settings_path, "utf8");
9278
+ if (raw.trim() === "") return {};
9279
+ let parsed;
9280
+ try {
9281
+ parsed = JSON.parse(raw);
9282
+ } catch (e) {
9283
+ throw new CorruptSettingsError(settings_path, e.message);
9284
+ }
9285
+ if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
9286
+ throw new CorruptSettingsError(settings_path, "top level is not an object");
9287
+ }
9288
+ return parsed;
9289
+ }
9290
+ function _with_lock(settings_path, fn) {
9291
+ const lockPath = settings_path + ".agent-config.lock";
9292
+ fs8.mkdirSync(path7.dirname(lockPath), { recursive: true });
9293
+ let fd;
9294
+ try {
9295
+ fd = fs8.openSync(lockPath, "wx");
9296
+ } catch {
9297
+ throw new SettingsLockError(lockPath);
9298
+ }
9299
+ try {
9300
+ return fn();
9301
+ } finally {
9302
+ fs8.closeSync(fd);
9303
+ fs8.rmSync(lockPath, { force: true });
9304
+ }
9305
+ }
9306
+ function ensure_managed_hooks(settings_path, matrix) {
9307
+ return _with_lock(settings_path, () => {
9308
+ const settings = _read_settings(settings_path);
9309
+ const before = JSON.stringify(settings);
9310
+ const hooks = (settings["hooks"] ?? {}) || {};
9311
+ const touched = [];
9312
+ for (const [native, command] of Object.entries(matrix)) {
9313
+ const existing = Array.isArray(hooks[native]) ? hooks[native] : [];
9314
+ const user_groups = existing.filter((g) => !_is_managed_group(g));
9315
+ const managed_group = {
9316
+ hooks: [{ type: "command", command }]
9317
+ };
9318
+ const next = [...user_groups, managed_group];
9319
+ if (JSON.stringify(next) !== JSON.stringify(existing)) touched.push(native);
9320
+ hooks[native] = next;
9321
+ }
9322
+ settings["hooks"] = hooks;
9323
+ const after = JSON.stringify(settings);
9324
+ if (after === before) {
9325
+ return { changed: false, events: [] };
9326
+ }
9327
+ atomicWriteFile(settings_path, JSON.stringify(settings, null, 2) + "\n");
9328
+ return { changed: true, events: touched };
9329
+ });
9330
+ }
9331
+
9154
9332
  // src/scripts/_lib/agent_settings.ts
9155
9333
  import { createRequire } from "node:module";
9156
- import * as fs8 from "node:fs";
9334
+ import * as fs9 from "node:fs";
9157
9335
  import * as os5 from "node:os";
9158
- import * as path7 from "node:path";
9336
+ import * as path8 from "node:path";
9159
9337
  var _require = createRequire(import.meta.url);
9160
9338
  var Logger = class {
9161
9339
  name = "scripts._lib.agent_settings";
@@ -9195,10 +9373,10 @@ var DEFAULT_PROJECT_FILE = ".agent-settings.yml";
9195
9373
  var LOCAL_PROJECT_FILE = ".agent-settings.local.yml";
9196
9374
  var LOCAL_PROJECT_SUBDIR = ["agents", "settings"];
9197
9375
  function _local_settings_path(project_root) {
9198
- return path7.join(project_root, ...LOCAL_PROJECT_SUBDIR, LOCAL_PROJECT_FILE);
9376
+ return path8.join(project_root, ...LOCAL_PROJECT_SUBDIR, LOCAL_PROJECT_FILE);
9199
9377
  }
9200
9378
  function _canonical_settings_path(project_root) {
9201
- return path7.join(project_root, ...LOCAL_PROJECT_SUBDIR, DEFAULT_PROJECT_FILE);
9379
+ return path8.join(project_root, ...LOCAL_PROJECT_SUBDIR, DEFAULT_PROJECT_FILE);
9202
9380
  }
9203
9381
  var USER_GLOBAL_FILENAME = "agent-settings.yml";
9204
9382
  function DEFAULT_USER_GLOBAL_FILE() {
@@ -9243,8 +9421,8 @@ var _AGENTS_DIR_MARKERS = [
9243
9421
  var _LEGACY_ANCHOR_ENV = "AGENT_CONFIG_LEGACY_ANCHOR";
9244
9422
  function _exists(p) {
9245
9423
  try {
9246
- fs8.lstatSync(p);
9247
- fs8.statSync(p);
9424
+ fs9.lstatSync(p);
9425
+ fs9.statSync(p);
9248
9426
  return true;
9249
9427
  } catch {
9250
9428
  return false;
@@ -9252,22 +9430,22 @@ function _exists(p) {
9252
9430
  }
9253
9431
  function _is_dir2(p) {
9254
9432
  try {
9255
- return fs8.statSync(p).isDirectory();
9433
+ return fs9.statSync(p).isDirectory();
9256
9434
  } catch {
9257
9435
  return false;
9258
9436
  }
9259
9437
  }
9260
9438
  function _is_file(p) {
9261
9439
  try {
9262
- return fs8.statSync(p).isFile();
9440
+ return fs9.statSync(p).isFile();
9263
9441
  } catch {
9264
9442
  return false;
9265
9443
  }
9266
9444
  }
9267
9445
  function _resolve(p) {
9268
- const absolute = path7.resolve(p);
9446
+ const absolute = path8.resolve(p);
9269
9447
  try {
9270
- return fs8.realpathSync(absolute);
9448
+ return fs9.realpathSync(absolute);
9271
9449
  } catch {
9272
9450
  return absolute;
9273
9451
  }
@@ -9277,7 +9455,7 @@ function _ancestor_chain(start) {
9277
9455
  let cursor = start;
9278
9456
  for (; ; ) {
9279
9457
  chain.push(cursor);
9280
- const parent = path7.dirname(cursor);
9458
+ const parent = path8.dirname(cursor);
9281
9459
  if (parent === cursor) {
9282
9460
  break;
9283
9461
  }
@@ -9286,15 +9464,15 @@ function _ancestor_chain(start) {
9286
9464
  return chain;
9287
9465
  }
9288
9466
  function _boundary_anchor_at(dir) {
9289
- const agents_dir = path7.join(dir, "agents");
9467
+ const agents_dir = path8.join(dir, "agents");
9290
9468
  if (_is_dir2(agents_dir)) {
9291
9469
  for (const marker of _AGENTS_DIR_MARKERS) {
9292
- if (_exists(path7.join(agents_dir, marker))) {
9470
+ if (_exists(path8.join(agents_dir, marker))) {
9293
9471
  return ANCHOR_AGENTS_DIR;
9294
9472
  }
9295
9473
  }
9296
9474
  }
9297
- if (_exists(path7.join(dir, ".git"))) {
9475
+ if (_exists(path8.join(dir, ".git"))) {
9298
9476
  return ANCHOR_GIT;
9299
9477
  }
9300
9478
  return null;
@@ -9305,7 +9483,7 @@ function find_project_root_with_anchor(start) {
9305
9483
  const chain = _ancestor_chain(current);
9306
9484
  if (legacy) {
9307
9485
  for (const candidate of chain) {
9308
- if (_exists(path7.join(candidate, ".git"))) {
9486
+ if (_exists(path8.join(candidate, ".git"))) {
9309
9487
  return [candidate, ANCHOR_GIT];
9310
9488
  }
9311
9489
  }
@@ -9319,7 +9497,7 @@ function find_project_root_with_anchor(start) {
9319
9497
  }
9320
9498
  let outermost = null;
9321
9499
  for (const candidate of chain) {
9322
- if (_exists(path7.join(candidate, DEFAULT_PROJECT_FILE))) {
9500
+ if (_exists(path8.join(candidate, DEFAULT_PROJECT_FILE))) {
9323
9501
  outermost = candidate;
9324
9502
  }
9325
9503
  }
@@ -9363,7 +9541,7 @@ function _expanduser(p) {
9363
9541
  return os5.homedir();
9364
9542
  }
9365
9543
  if (p.startsWith("~/") || process.platform === "win32" && p.startsWith("~\\")) {
9366
- return path7.join(os5.homedir(), p.slice(2));
9544
+ return path8.join(os5.homedir(), p.slice(2));
9367
9545
  }
9368
9546
  return p;
9369
9547
  }
@@ -9392,13 +9570,13 @@ function resolve_project_root(arg, options = {}) {
9392
9570
  function _resolve_cascade_paths(cwd, project_path) {
9393
9571
  if (cwd === null) {
9394
9572
  const legacy = project_path ? project_path : DEFAULT_PROJECT_FILE;
9395
- const parent = path7.dirname(legacy);
9573
+ const parent = path8.dirname(legacy);
9396
9574
  return [legacy, _canonical_settings_path(parent), _local_settings_path(parent)];
9397
9575
  }
9398
9576
  const root = find_project_root(cwd);
9399
9577
  if (root === null) {
9400
9578
  const legacy = project_path ? project_path : DEFAULT_PROJECT_FILE;
9401
- const parent = path7.dirname(legacy);
9579
+ const parent = path8.dirname(legacy);
9402
9580
  return [legacy, _canonical_settings_path(parent), _local_settings_path(parent)];
9403
9581
  }
9404
9582
  const cwd_resolved = _resolve(cwd);
@@ -9409,7 +9587,7 @@ function _resolve_cascade_paths(cwd, project_path) {
9409
9587
  if (cursor === root) {
9410
9588
  break;
9411
9589
  }
9412
- const parent = path7.dirname(cursor);
9590
+ const parent = path8.dirname(cursor);
9413
9591
  if (parent === cursor) {
9414
9592
  break;
9415
9593
  }
@@ -9417,7 +9595,7 @@ function _resolve_cascade_paths(cwd, project_path) {
9417
9595
  }
9418
9596
  chain.reverse();
9419
9597
  return [
9420
- ...chain.map((d) => path7.join(d, DEFAULT_PROJECT_FILE)),
9598
+ ...chain.map((d) => path8.join(d, DEFAULT_PROJECT_FILE)),
9421
9599
  _canonical_settings_path(root),
9422
9600
  _local_settings_path(root)
9423
9601
  ];
@@ -9450,16 +9628,16 @@ function _read_yaml(p) {
9450
9628
  if (!_is_file(p)) {
9451
9629
  return null;
9452
9630
  }
9453
- let YAML;
9631
+ let YAML2;
9454
9632
  try {
9455
- YAML = _require("yaml");
9633
+ YAML2 = _require("yaml");
9456
9634
  } catch {
9457
9635
  return null;
9458
9636
  }
9459
9637
  let data;
9460
9638
  try {
9461
- const text = fs8.readFileSync(p, "utf-8");
9462
- data = YAML.parse(text, { version: "1.1" });
9639
+ const text = fs9.readFileSync(p, "utf-8");
9640
+ data = YAML2.parse(text, { version: "1.1" });
9463
9641
  if (data === null || data === void 0) {
9464
9642
  data = {};
9465
9643
  }
@@ -9550,8 +9728,8 @@ function _is_plain_dict(value) {
9550
9728
  }
9551
9729
 
9552
9730
  // src/scripts/_lib/module_detection.ts
9553
- import * as fs9 from "node:fs";
9554
- import * as path8 from "node:path";
9731
+ import * as fs10 from "node:fs";
9732
+ import * as path9 from "node:path";
9555
9733
  var _SKIP_DIRS = /* @__PURE__ */ new Set([".module-template", ".example"]);
9556
9734
  var _RULES = [
9557
9735
  ["app/Modules", "laravel-hmvc", "App\\Modules\\{ModuleName}"],
@@ -9565,14 +9743,14 @@ var _RULES = [
9565
9743
  ];
9566
9744
  function _isDir(p) {
9567
9745
  try {
9568
- return fs9.statSync(p).isDirectory();
9746
+ return fs10.statSync(p).isDirectory();
9569
9747
  } catch {
9570
9748
  return false;
9571
9749
  }
9572
9750
  }
9573
9751
  function _isFile(p) {
9574
9752
  try {
9575
- return fs9.statSync(p).isFile();
9753
+ return fs10.statSync(p).isFile();
9576
9754
  } catch {
9577
9755
  return false;
9578
9756
  }
@@ -9586,13 +9764,13 @@ function _isUpperChar(ch) {
9586
9764
  function _list_module_subdirs(root) {
9587
9765
  let entries;
9588
9766
  try {
9589
- entries = fs9.readdirSync(root).sort();
9767
+ entries = fs10.readdirSync(root).sort();
9590
9768
  } catch {
9591
9769
  return [];
9592
9770
  }
9593
9771
  const out = [];
9594
9772
  for (const name of entries) {
9595
- if (!_isDir(path8.join(root, name))) {
9773
+ if (!_isDir(path9.join(root, name))) {
9596
9774
  continue;
9597
9775
  }
9598
9776
  if (name.startsWith(".")) {
@@ -9614,11 +9792,11 @@ function _score_confidence(stack, root, subdirs) {
9614
9792
  return capitalized.length > 0 ? "high" : "medium";
9615
9793
  }
9616
9794
  if (stack === "node-monorepo") {
9617
- const withPkgJson = subdirs.filter((name) => _isFile(path8.join(root, name, "package.json")));
9795
+ const withPkgJson = subdirs.filter((name) => _isFile(path9.join(root, name, "package.json")));
9618
9796
  return withPkgJson.length > 0 ? "high" : "medium";
9619
9797
  }
9620
9798
  if (stack === "python-src") {
9621
- const withInit = subdirs.filter((name) => _isFile(path8.join(root, name, "__init__.py")));
9799
+ const withInit = subdirs.filter((name) => _isFile(path9.join(root, name, "__init__.py")));
9622
9800
  return withInit.length > 0 ? "high" : "medium";
9623
9801
  }
9624
9802
  if (stack === "go-internal") {
@@ -9630,7 +9808,7 @@ function detect_module_roots(project_root) {
9630
9808
  const high = [];
9631
9809
  const medium = [];
9632
9810
  for (const [rel_path, stack, namespace_template] of _RULES) {
9633
- const abs_path = path8.join(project_root, rel_path);
9811
+ const abs_path = path9.join(project_root, rel_path);
9634
9812
  if (!_isDir(abs_path)) {
9635
9813
  continue;
9636
9814
  }
@@ -9652,7 +9830,7 @@ function detect_module_roots(project_root) {
9652
9830
  }
9653
9831
 
9654
9832
  // src/scripts/_lib/model_tier.ts
9655
- import fs10 from "node:fs";
9833
+ import fs11 from "node:fs";
9656
9834
  var TIER_TO_CLAUDE_MODEL = {
9657
9835
  high: "opus",
9658
9836
  medium: "sonnet",
@@ -9660,8 +9838,8 @@ var TIER_TO_CLAUDE_MODEL = {
9660
9838
  };
9661
9839
  var MODEL_TIER_RE = /^model_tier:\s*"?([a-z]+)"?\s*$/m;
9662
9840
  function read_model_tier(skill_md) {
9663
- if (!fs10.existsSync(skill_md)) return null;
9664
- const text = fs10.readFileSync(skill_md).toString("utf-8");
9841
+ if (!fs11.existsSync(skill_md)) return null;
9842
+ const text = fs11.readFileSync(skill_md).toString("utf-8");
9665
9843
  if (!text.startsWith("---\n")) return null;
9666
9844
  const end = text.indexOf("\n---\n", 4);
9667
9845
  if (end === -1) return null;
@@ -9678,8 +9856,8 @@ function render_native_model_md(text, tier) {
9678
9856
 
9679
9857
  // src/scripts/_cli/cmd_migrate.ts
9680
9858
  import { spawnSync } from "node:child_process";
9681
- import * as fs11 from "node:fs";
9682
- import * as path9 from "node:path";
9859
+ import * as fs12 from "node:fs";
9860
+ import * as path10 from "node:path";
9683
9861
  import process2 from "node:process";
9684
9862
  import { fileURLToPath as fileURLToPath2, pathToFileURL } from "node:url";
9685
9863
  var PACKAGE_NAME_NPM = "@event4u/agent-config";
@@ -9699,7 +9877,7 @@ var LEGACY_SETTINGS_FILES = [".agent-settings.yml", ".agent-user.yml"];
9699
9877
  var LEGACY_STATE_FILENAME = ".implement-ticket-state.json";
9700
9878
  var LEGACY_STATE_V1_FILENAME = ".work-state.json";
9701
9879
  var LEGACY_AGENT_CONFIG_SHELL = "agent-config";
9702
- var _HERE_DIR = path9.dirname(fileURLToPath2(import.meta.url));
9880
+ var _HERE_DIR = path10.dirname(fileURLToPath2(import.meta.url));
9703
9881
  var ArgparseExit = class extends Error {
9704
9882
  code;
9705
9883
  constructor(code) {
@@ -9798,38 +9976,38 @@ function _jsonDumpsIndentAscii(value, indent) {
9798
9976
  }
9799
9977
  function _isFile2(p) {
9800
9978
  try {
9801
- return fs11.statSync(p).isFile();
9979
+ return fs12.statSync(p).isFile();
9802
9980
  } catch {
9803
9981
  return false;
9804
9982
  }
9805
9983
  }
9806
9984
  function _isDir2(p) {
9807
9985
  try {
9808
- return fs11.statSync(p).isDirectory();
9986
+ return fs12.statSync(p).isDirectory();
9809
9987
  } catch {
9810
9988
  return false;
9811
9989
  }
9812
9990
  }
9813
9991
  function _isSymlink(p) {
9814
9992
  try {
9815
- return fs11.lstatSync(p).isSymbolicLink();
9993
+ return fs12.lstatSync(p).isSymbolicLink();
9816
9994
  } catch {
9817
9995
  return false;
9818
9996
  }
9819
9997
  }
9820
9998
  function _exists2(p) {
9821
9999
  try {
9822
- fs11.lstatSync(p);
10000
+ fs12.lstatSync(p);
9823
10001
  return true;
9824
10002
  } catch {
9825
10003
  return false;
9826
10004
  }
9827
10005
  }
9828
10006
  function _readText(p) {
9829
- return fs11.readFileSync(p, { encoding: "utf-8" });
10007
+ return fs12.readFileSync(p, { encoding: "utf-8" });
9830
10008
  }
9831
10009
  function _writeText(p, text) {
9832
- fs11.writeFileSync(p, text, { encoding: "utf-8" });
10010
+ fs12.writeFileSync(p, text, { encoding: "utf-8" });
9833
10011
  }
9834
10012
  function _jsonLoadFile(p) {
9835
10013
  return JSON.parse(_readText(p));
@@ -9885,7 +10063,7 @@ function _classify_symlink(link) {
9885
10063
  }
9886
10064
  let target;
9887
10065
  try {
9888
- target = fs11.readlinkSync(link);
10066
+ target = fs12.readlinkSync(link);
9889
10067
  } catch {
9890
10068
  return null;
9891
10069
  }
@@ -9896,16 +10074,16 @@ function _classify_symlink(link) {
9896
10074
  return "user";
9897
10075
  }
9898
10076
  function _detect_legacy_state(project) {
9899
- return _isFile2(path9.join(project, LEGACY_STATE_FILENAME));
10077
+ return _isFile2(path10.join(project, LEGACY_STATE_FILENAME));
9900
10078
  }
9901
10079
  function _detect_legacy_settings(project) {
9902
10080
  const found = [];
9903
10081
  for (const name of LEGACY_SETTINGS_FILES) {
9904
- const flat = path9.join(project, name);
10082
+ const flat = path10.join(project, name);
9905
10083
  if (_isFile2(flat)) {
9906
10084
  found.push(flat);
9907
10085
  }
9908
- const typed = path9.join(project, "settings", name);
10086
+ const typed = path10.join(project, "settings", name);
9909
10087
  if (_isFile2(typed)) {
9910
10088
  found.push(typed);
9911
10089
  }
@@ -9913,25 +10091,25 @@ function _detect_legacy_settings(project) {
9913
10091
  return found;
9914
10092
  }
9915
10093
  function _detect_empty_shell(project) {
9916
- const shell = path9.join(project, LEGACY_AGENT_CONFIG_SHELL);
10094
+ const shell = path10.join(project, LEGACY_AGENT_CONFIG_SHELL);
9917
10095
  if (!_isDir2(shell) || _isSymlink(shell)) {
9918
10096
  return false;
9919
10097
  }
9920
10098
  try {
9921
- return fs11.readdirSync(shell).length === 0;
10099
+ return fs12.readdirSync(shell).length === 0;
9922
10100
  } catch {
9923
10101
  return false;
9924
10102
  }
9925
10103
  }
9926
10104
  function _detect_already_migrated(project) {
9927
- if (_detect_npm(path9.join(project, "package.json"))) {
10105
+ if (_detect_npm(path10.join(project, "package.json"))) {
9928
10106
  return false;
9929
10107
  }
9930
- if (_detect_composer(path9.join(project, "composer.json"))) {
10108
+ if (_detect_composer(path10.join(project, "composer.json"))) {
9931
10109
  return false;
9932
10110
  }
9933
10111
  for (const name of MANAGED_SYMLINKS) {
9934
- if (_classify_symlink(path9.join(project, name)) === "legacy") {
10112
+ if (_classify_symlink(path10.join(project, name)) === "legacy") {
9935
10113
  return false;
9936
10114
  }
9937
10115
  }
@@ -10002,11 +10180,11 @@ function _purge_legacy_symlinks(project) {
10002
10180
  const removed = [];
10003
10181
  const preserved = [];
10004
10182
  for (const name of MANAGED_SYMLINKS) {
10005
- const link = path9.join(project, name);
10183
+ const link = path10.join(project, name);
10006
10184
  const kind = _classify_symlink(link);
10007
10185
  if (kind === "legacy") {
10008
10186
  try {
10009
- fs11.unlinkSync(link);
10187
+ fs12.unlinkSync(link);
10010
10188
  removed.push(name);
10011
10189
  } catch {
10012
10190
  preserved.push(name);
@@ -10018,14 +10196,14 @@ function _purge_legacy_symlinks(project) {
10018
10196
  return [removed, preserved];
10019
10197
  }
10020
10198
  function _migrate_state_file(project) {
10021
- const source = path9.join(project, LEGACY_STATE_FILENAME);
10199
+ const source = path10.join(project, LEGACY_STATE_FILENAME);
10022
10200
  if (!_isFile2(source)) {
10023
10201
  return null;
10024
10202
  }
10025
- const target = path9.join(project, LEGACY_STATE_V1_FILENAME);
10203
+ const target = path10.join(project, LEGACY_STATE_V1_FILENAME);
10026
10204
  if (_exists2(target)) {
10027
10205
  try {
10028
- fs11.unlinkSync(source);
10206
+ fs12.unlinkSync(source);
10029
10207
  return `removed stale ${LEGACY_STATE_FILENAME} (v1 already present)`;
10030
10208
  } catch {
10031
10209
  return null;
@@ -10039,8 +10217,8 @@ function _migrate_state_file(project) {
10039
10217
  return `migrated ${LEGACY_STATE_FILENAME} \u2192 ${LEGACY_STATE_V1_FILENAME}`;
10040
10218
  }
10041
10219
  function _load_state_migrator() {
10042
- const pkg_root = path9.resolve(_HERE_DIR, "..", "..", "..");
10043
- const rel = path9.join(
10220
+ const pkg_root = path10.resolve(_HERE_DIR, "..", "..", "..");
10221
+ const rel = path10.join(
10044
10222
  "agent-src",
10045
10223
  "templates",
10046
10224
  "scripts",
@@ -10048,8 +10226,8 @@ function _load_state_migrator() {
10048
10226
  "migration",
10049
10227
  "v0_to_v1.ts"
10050
10228
  );
10051
- const driver = [path9.join(pkg_root, "dist", rel), path9.join(pkg_root, "src", rel)].find(
10052
- (p) => fs11.existsSync(p)
10229
+ const driver = [path10.join(pkg_root, "dist", rel), path10.join(pkg_root, "src", rel)].find(
10230
+ (p) => fs12.existsSync(p)
10053
10231
  ) ?? null;
10054
10232
  if (driver === null) {
10055
10233
  return null;
@@ -10057,12 +10235,12 @@ function _load_state_migrator() {
10057
10235
  const binName = process2.platform === "win32" ? "tsx.cmd" : "tsx";
10058
10236
  let tsxBin = null;
10059
10237
  for (let dir = pkg_root; ; ) {
10060
- const cand = path9.join(dir, "node_modules", ".bin", binName);
10061
- if (fs11.existsSync(cand)) {
10238
+ const cand = path10.join(dir, "node_modules", ".bin", binName);
10239
+ if (fs12.existsSync(cand)) {
10062
10240
  tsxBin = cand;
10063
10241
  break;
10064
10242
  }
10065
- const parent = path9.dirname(dir);
10243
+ const parent = path10.dirname(dir);
10066
10244
  if (parent === dir) break;
10067
10245
  dir = parent;
10068
10246
  }
@@ -10089,17 +10267,17 @@ function _delete_legacy_settings(project) {
10089
10267
  const removed = [];
10090
10268
  for (const p of _detect_legacy_settings(project)) {
10091
10269
  try {
10092
- fs11.unlinkSync(p);
10093
- removed.push(path9.relative(project, p));
10270
+ fs12.unlinkSync(p);
10271
+ removed.push(path10.relative(project, p));
10094
10272
  } catch {
10095
10273
  continue;
10096
10274
  }
10097
10275
  }
10098
- const settings_dir = path9.join(project, "settings");
10276
+ const settings_dir = path10.join(project, "settings");
10099
10277
  if (_isDir2(settings_dir) && !_isSymlink(settings_dir)) {
10100
10278
  try {
10101
- if (fs11.readdirSync(settings_dir).length === 0) {
10102
- fs11.rmdirSync(settings_dir);
10279
+ if (fs12.readdirSync(settings_dir).length === 0) {
10280
+ fs12.rmdirSync(settings_dir);
10103
10281
  removed.push("settings/");
10104
10282
  }
10105
10283
  } catch {
@@ -10108,12 +10286,12 @@ function _delete_legacy_settings(project) {
10108
10286
  return removed;
10109
10287
  }
10110
10288
  function _remove_empty_shell(project) {
10111
- const shell = path9.join(project, LEGACY_AGENT_CONFIG_SHELL);
10289
+ const shell = path10.join(project, LEGACY_AGENT_CONFIG_SHELL);
10112
10290
  if (!_detect_empty_shell(project)) {
10113
10291
  return false;
10114
10292
  }
10115
10293
  try {
10116
- fs11.rmdirSync(shell);
10294
+ fs12.rmdirSync(shell);
10117
10295
  } catch {
10118
10296
  return false;
10119
10297
  }
@@ -10123,7 +10301,7 @@ function _reEscape(s) {
10123
10301
  return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
10124
10302
  }
10125
10303
  function _update_gitignore(project) {
10126
- const gitignore = path9.join(project, ".gitignore");
10304
+ const gitignore = path10.join(project, ".gitignore");
10127
10305
  const block = `${GITIGNORE_BLOCK_START}
10128
10306
  ${GITIGNORE_NEW_BODY}${GITIGNORE_BLOCK_END}
10129
10307
  `;
@@ -10154,16 +10332,16 @@ ${GITIGNORE_NEW_BODY}${GITIGNORE_BLOCK_END}
10154
10332
  }
10155
10333
  function _build_plan(project) {
10156
10334
  return {
10157
- npm: _detect_npm(path9.join(project, "package.json")),
10158
- composer: _detect_composer(path9.join(project, "composer.json")),
10335
+ npm: _detect_npm(path10.join(project, "package.json")),
10336
+ composer: _detect_composer(path10.join(project, "composer.json")),
10159
10337
  symlinks_legacy: MANAGED_SYMLINKS.filter(
10160
- (name) => _classify_symlink(path9.join(project, name)) === "legacy"
10338
+ (name) => _classify_symlink(path10.join(project, name)) === "legacy"
10161
10339
  ),
10162
10340
  symlinks_user: MANAGED_SYMLINKS.filter(
10163
- (name) => _classify_symlink(path9.join(project, name)) === "user"
10341
+ (name) => _classify_symlink(path10.join(project, name)) === "user"
10164
10342
  ),
10165
- state_file: _isFile2(path9.join(project, LEGACY_STATE_FILENAME)),
10166
- settings_files: _detect_legacy_settings(project).map((p) => path9.relative(project, p)),
10343
+ state_file: _isFile2(path10.join(project, LEGACY_STATE_FILENAME)),
10344
+ settings_files: _detect_legacy_settings(project).map((p) => path10.relative(project, p)),
10167
10345
  empty_shell: _detect_empty_shell(project)
10168
10346
  };
10169
10347
  }
@@ -10227,10 +10405,10 @@ function _warn_on_major_mismatch(from_major, plan, out) {
10227
10405
  }
10228
10406
  function _apply(project, out, err) {
10229
10407
  const summary = [];
10230
- if (_strip_npm_entry(path9.join(project, "package.json"))) {
10408
+ if (_strip_npm_entry(path10.join(project, "package.json"))) {
10231
10409
  summary.push(`removed ${PACKAGE_NAME_NPM} from package.json`);
10232
10410
  }
10233
- if (_strip_composer_entry(path9.join(project, "composer.json"))) {
10411
+ if (_strip_composer_entry(path10.join(project, "composer.json"))) {
10234
10412
  summary.push(`removed ${PACKAGE_NAME_COMPOSER} from composer.json`);
10235
10413
  }
10236
10414
  const [removed_links, preserved_links] = _purge_legacy_symlinks(project);
@@ -10352,8 +10530,23 @@ function main(argv = null, options = {}) {
10352
10530
  }
10353
10531
  var _bundled = true;
10354
10532
  var _HERE = fileURLToPath2(import.meta.url);
10355
- var _isCliEntry = process2.argv[1] !== void 0 && import.meta.url === pathToFileURL(path9.resolve(process2.argv[1])).href;
10356
- if (!_bundled && (_isCliEntry || process2.argv[1] === _HERE)) {
10533
+ function _isCliEntry() {
10534
+ if (process2.argv[1] === void 0) {
10535
+ return false;
10536
+ }
10537
+ const argvUrl = pathToFileURL(path10.resolve(process2.argv[1])).href;
10538
+ if (import.meta.url === argvUrl) {
10539
+ return true;
10540
+ }
10541
+ try {
10542
+ const here = fs12.realpathSync(fileURLToPath2(import.meta.url));
10543
+ const argv = fs12.realpathSync(path10.resolve(process2.argv[1]));
10544
+ return here === argv;
10545
+ } catch {
10546
+ return false;
10547
+ }
10548
+ }
10549
+ if (!_bundled && (_isCliEntry() || process2.argv[1] === _HERE)) {
10357
10550
  try {
10358
10551
  process2.exitCode = main(process2.argv.slice(2));
10359
10552
  } catch (exc) {
@@ -10384,34 +10577,34 @@ var ArgparseExit2 = class extends Error {
10384
10577
  function expanduser5(p) {
10385
10578
  if (p === "~") return os6.homedir();
10386
10579
  if (p.startsWith("~/") || p.startsWith("~\\")) {
10387
- return path10.join(os6.homedir(), p.slice(2));
10580
+ return path11.join(os6.homedir(), p.slice(2));
10388
10581
  }
10389
10582
  return p;
10390
10583
  }
10391
10584
  function resolvePath(p) {
10392
10585
  try {
10393
- return fs12.realpathSync(path10.resolve(p));
10586
+ return fs13.realpathSync(path11.resolve(p));
10394
10587
  } catch {
10395
- return path10.resolve(p);
10588
+ return path11.resolve(p);
10396
10589
  }
10397
10590
  }
10398
10591
  function isFile(p) {
10399
10592
  try {
10400
- return fs12.statSync(p).isFile();
10593
+ return fs13.statSync(p).isFile();
10401
10594
  } catch {
10402
10595
  return false;
10403
10596
  }
10404
10597
  }
10405
10598
  function isDir(p) {
10406
10599
  try {
10407
- return fs12.statSync(p).isDirectory();
10600
+ return fs13.statSync(p).isDirectory();
10408
10601
  } catch {
10409
10602
  return false;
10410
10603
  }
10411
10604
  }
10412
10605
  function pathExists(p) {
10413
10606
  try {
10414
- fs12.statSync(p);
10607
+ fs13.statSync(p);
10415
10608
  return true;
10416
10609
  } catch {
10417
10610
  return false;
@@ -10419,24 +10612,24 @@ function pathExists(p) {
10419
10612
  }
10420
10613
  function isSymlink(p) {
10421
10614
  try {
10422
- return fs12.lstatSync(p).isSymbolicLink();
10615
+ return fs13.lstatSync(p).isSymbolicLink();
10423
10616
  } catch {
10424
10617
  return false;
10425
10618
  }
10426
10619
  }
10427
10620
  function readText(p) {
10428
- return fs12.readFileSync(p, "utf-8");
10621
+ return fs13.readFileSync(p, "utf-8");
10429
10622
  }
10430
10623
  function writeText(p, content) {
10431
- fs12.writeFileSync(p, content, "utf-8");
10624
+ fs13.writeFileSync(p, content, "utf-8");
10432
10625
  }
10433
10626
  function mkdirp(p) {
10434
- fs12.mkdirSync(p, { recursive: true });
10627
+ fs13.mkdirSync(p, { recursive: true });
10435
10628
  }
10436
10629
  function sortedGlobStems(directory, suffix) {
10437
10630
  let entries;
10438
10631
  try {
10439
- entries = fs12.readdirSync(directory);
10632
+ entries = fs13.readdirSync(directory);
10440
10633
  } catch {
10441
10634
  return [];
10442
10635
  }
@@ -10456,7 +10649,7 @@ function sortedGlobStems(directory, suffix) {
10456
10649
  function countZips(directory) {
10457
10650
  if (!isDir(directory)) return 0;
10458
10651
  let n = 0;
10459
- for (const name of fs12.readdirSync(directory)) {
10652
+ for (const name of fs13.readdirSync(directory)) {
10460
10653
  if (name.endsWith(".zip")) n += 1;
10461
10654
  }
10462
10655
  return n;
@@ -10464,35 +10657,35 @@ function countZips(directory) {
10464
10657
  function sha256OfFile(p) {
10465
10658
  let data;
10466
10659
  try {
10467
- data = fs12.readFileSync(p);
10660
+ data = fs13.readFileSync(p);
10468
10661
  } catch {
10469
10662
  return null;
10470
10663
  }
10471
10664
  return crypto2.createHash("sha256").update(data).digest("hex");
10472
10665
  }
10473
10666
  function atomicWrite0644(target, body, prefix) {
10474
- const dir = path10.dirname(target);
10475
- const tmpName = path10.join(
10667
+ const dir = path11.dirname(target);
10668
+ const tmpName = path11.join(
10476
10669
  dir,
10477
10670
  `${prefix}${process3.pid}.${crypto2.randomBytes(6).toString("hex")}.yml.tmp`
10478
10671
  );
10479
10672
  let fd = null;
10480
10673
  try {
10481
- fd = fs12.openSync(tmpName, "wx", 420);
10482
- fs12.writeFileSync(fd, body, "utf-8");
10483
- fs12.closeSync(fd);
10674
+ fd = fs13.openSync(tmpName, "wx", 420);
10675
+ fs13.writeFileSync(fd, body, "utf-8");
10676
+ fs13.closeSync(fd);
10484
10677
  fd = null;
10485
- fs12.chmodSync(tmpName, 420);
10486
- fs12.renameSync(tmpName, target);
10678
+ fs13.chmodSync(tmpName, 420);
10679
+ fs13.renameSync(tmpName, target);
10487
10680
  } catch (err) {
10488
10681
  if (fd !== null) {
10489
10682
  try {
10490
- fs12.closeSync(fd);
10683
+ fs13.closeSync(fd);
10491
10684
  } catch {
10492
10685
  }
10493
10686
  }
10494
10687
  try {
10495
- fs12.unlinkSync(tmpName);
10688
+ fs13.unlinkSync(tmpName);
10496
10689
  } catch {
10497
10690
  }
10498
10691
  throw err;
@@ -10602,12 +10795,12 @@ var LEGACY_SETTINGS_FILE = ".agent-settings";
10602
10795
  var LEGACY_BACKUP_FILE = ".agent-settings.backup.key-value";
10603
10796
  var SETTINGS_SUBDIR = ["agents", "settings"];
10604
10797
  function _canonical_settings_target(project_root) {
10605
- return path10.join(project_root, ...SETTINGS_SUBDIR, SETTINGS_FILE);
10798
+ return path11.join(project_root, ...SETTINGS_SUBDIR, SETTINGS_FILE);
10606
10799
  }
10607
10800
  function _resolve_settings_read(project_root) {
10608
10801
  const canonical = _canonical_settings_target(project_root);
10609
10802
  if (pathExists(canonical)) return canonical;
10610
- const legacy = path10.join(project_root, SETTINGS_FILE);
10803
+ const legacy = path11.join(project_root, SETTINGS_FILE);
10611
10804
  if (pathExists(legacy)) return legacy;
10612
10805
  return canonical;
10613
10806
  }
@@ -10671,9 +10864,9 @@ function fail(msg) {
10671
10864
  throw new SystemExitError(1);
10672
10865
  }
10673
10866
  function detect_package_root(project_root) {
10674
- const npm_path = path10.join(project_root, "node_modules", "@event4u", "agent-config");
10867
+ const npm_path = path11.join(project_root, "node_modules", "@event4u", "agent-config");
10675
10868
  if (isDir(npm_path)) return resolvePath(npm_path);
10676
- if (pathExists(path10.join(project_root, "src", "config", "profiles", "minimal.ini"))) {
10869
+ if (pathExists(path11.join(project_root, "src", "config", "profiles", "minimal.ini"))) {
10677
10870
  return project_root;
10678
10871
  }
10679
10872
  fail(
@@ -10681,12 +10874,12 @@ function detect_package_root(project_root) {
10681
10874
  );
10682
10875
  }
10683
10876
  function detect_package_type(package_root) {
10684
- if (package_root.split(path10.sep).includes("node_modules")) return "npm";
10877
+ if (package_root.split(path11.sep).includes("node_modules")) return "npm";
10685
10878
  return "local";
10686
10879
  }
10687
10880
  function detect_package_type_for_project(project_root, package_root) {
10688
10881
  const npm_path = resolvePath(
10689
- path10.join(project_root, "node_modules", "@event4u", "agent-config")
10882
+ path11.join(project_root, "node_modules", "@event4u", "agent-config")
10690
10883
  );
10691
10884
  const package_resolved = resolvePath(package_root);
10692
10885
  if (package_resolved === npm_path) return "npm";
@@ -10706,7 +10899,7 @@ function ensure_directory(p) {
10706
10899
  mkdirp(p);
10707
10900
  }
10708
10901
  function write_file(p, content) {
10709
- ensure_directory(path10.dirname(p));
10902
+ ensure_directory(path11.dirname(p));
10710
10903
  writeText(p, content);
10711
10904
  }
10712
10905
  function read_json_file(p) {
@@ -10877,7 +11070,7 @@ function _append_unknown_legacy(rendered, legacy_values, unknown_keys) {
10877
11070
  return rendered + "\n" + suffix;
10878
11071
  }
10879
11072
  function _migrate_legacy_if_present(project_root, template_body) {
10880
- const legacy_target = path10.join(project_root, LEGACY_SETTINGS_FILE);
11073
+ const legacy_target = path11.join(project_root, LEGACY_SETTINGS_FILE);
10881
11074
  if (!isFile(legacy_target)) return null;
10882
11075
  const legacy_text = readText(legacy_target);
10883
11076
  const [values, unknown] = _parse_legacy_settings(legacy_text);
@@ -10892,9 +11085,9 @@ function _migrate_legacy_if_present(project_root, template_body) {
10892
11085
  }
10893
11086
  }
10894
11087
  rendered = _append_unknown_legacy(rendered, values, unknown);
10895
- const backup_target = path10.join(project_root, LEGACY_BACKUP_FILE);
11088
+ const backup_target = path11.join(project_root, LEGACY_BACKUP_FILE);
10896
11089
  writeText(backup_target, legacy_text);
10897
- fs12.unlinkSync(legacy_target);
11090
+ fs13.unlinkSync(legacy_target);
10898
11091
  info(`Migrated legacy ${LEGACY_SETTINGS_FILE} \u2192 ${SETTINGS_FILE}`);
10899
11092
  info(`Backup saved to ${LEGACY_BACKUP_FILE}`);
10900
11093
  if (unknown.length > 0) {
@@ -10929,7 +11122,7 @@ function _render_template(template, profile_values) {
10929
11122
  return body;
10930
11123
  }
10931
11124
  function _load_valid_user_types(package_root) {
10932
- const directory = path10.join(package_root, USER_TYPES_DIR);
11125
+ const directory = path11.join(package_root, USER_TYPES_DIR);
10933
11126
  if (!isDir(directory)) return [];
10934
11127
  return sortedGlobStems(directory, ".yml");
10935
11128
  }
@@ -10986,8 +11179,8 @@ function splitlinesKeepends(text) {
10986
11179
  }
10987
11180
  function ensure_agent_settings(project_root, package_root, profile, force, user_type = "", packs = null) {
10988
11181
  const target = _canonical_settings_target(project_root);
10989
- const profile_source = path10.join(package_root, "src", "config", "profiles", `${profile}.ini`);
10990
- const template_source = path10.join(package_root, "src", "config", "agent-settings.template.yml");
11182
+ const profile_source = path11.join(package_root, "src", "config", "profiles", `${profile}.ini`);
11183
+ const template_source = path11.join(package_root, "src", "config", "agent-settings.template.yml");
10991
11184
  if (!pathExists(profile_source)) fail(`Missing profile preset: ${profile_source}`);
10992
11185
  if (!pathExists(template_source)) fail(`Missing settings template: ${template_source}`);
10993
11186
  const template = readText(template_source);
@@ -11001,21 +11194,21 @@ function ensure_agent_settings(project_root, package_root, profile, force, user_
11001
11194
  if (profile_values["rule_loading_tier"] !== profile) {
11002
11195
  const got = "rule_loading_tier" in profile_values ? `'${profile_values["rule_loading_tier"]}'` : "None";
11003
11196
  fail(
11004
- `Profile preset ${path10.basename(profile_source)} has rule_loading_tier=${got} but --profile=${profile}`
11197
+ `Profile preset ${path11.basename(profile_source)} has rule_loading_tier=${got} but --profile=${profile}`
11005
11198
  );
11006
11199
  }
11007
11200
  profile_values["user_type"] = _validate_user_type(package_root, user_type);
11008
11201
  let template_body = _render_template(template, profile_values);
11009
11202
  template_body = _inject_packs(template_body, packs ?? []);
11010
- const legacy_root = path10.join(project_root, SETTINGS_FILE);
11203
+ const legacy_root = path11.join(project_root, SETTINGS_FILE);
11011
11204
  if (isFile(legacy_root) && !pathExists(target)) {
11012
- mkdirp(path10.dirname(target));
11205
+ mkdirp(path11.dirname(target));
11013
11206
  writeText(target, readText(legacy_root));
11014
- fs12.unlinkSync(legacy_root);
11207
+ fs13.unlinkSync(legacy_root);
11015
11208
  success(`Migrated ${SETTINGS_FILE} \u2192 agents/settings/${SETTINGS_FILE} (ADR-038)`);
11016
11209
  return;
11017
11210
  }
11018
- const legacy_target = path10.join(project_root, LEGACY_SETTINGS_FILE);
11211
+ const legacy_target = path11.join(project_root, LEGACY_SETTINGS_FILE);
11019
11212
  if (isFile(legacy_target) && pathExists(target)) {
11020
11213
  warn(
11021
11214
  `Both ${SETTINGS_FILE} and legacy ${LEGACY_SETTINGS_FILE} exist. Skipping migration to avoid overwriting ${SETTINGS_FILE}. Delete one of them manually and re-run.`
@@ -11032,7 +11225,7 @@ function ensure_agent_settings(project_root, package_root, profile, force, user_
11032
11225
  skip(`${SETTINGS_FILE} already exists`);
11033
11226
  return;
11034
11227
  }
11035
- mkdirp(path10.dirname(target));
11228
+ mkdirp(path11.dirname(target));
11036
11229
  write_file(target, template_body);
11037
11230
  const user_type_value = profile_values["user_type"] ?? "";
11038
11231
  const suffix = user_type_value ? `, user_type=${user_type_value}` : "";
@@ -11045,7 +11238,7 @@ function ensure_vscode_bridge(project_root, package_type, force) {
11045
11238
  const plugin_path = plugin_paths[package_type] ?? "./plugin/agent-config";
11046
11239
  const bridge = { "chat.pluginLocations": { [plugin_path]: true } };
11047
11240
  merge_json_file(
11048
- path10.join(project_root, ".vscode", "settings.json"),
11241
+ path11.join(project_root, ".vscode", "settings.json"),
11049
11242
  bridge,
11050
11243
  force,
11051
11244
  ".vscode/settings.json"
@@ -11054,14 +11247,14 @@ function ensure_vscode_bridge(project_root, package_type, force) {
11054
11247
  function ensure_augment_bridge(project_root, force) {
11055
11248
  const bridge = { enabledPlugins: { "agent-config@event4u": true } };
11056
11249
  return merge_json_file(
11057
- path10.join(project_root, ".augment", "settings.json"),
11250
+ path11.join(project_root, ".augment", "settings.json"),
11058
11251
  bridge,
11059
11252
  force,
11060
11253
  ".augment/settings.json"
11061
11254
  );
11062
11255
  }
11063
- var AUGMENT_USER_DIR = path10.join(os6.homedir(), ".augment");
11064
- var AUGMENT_USER_HOOKS_DIR = path10.join(AUGMENT_USER_DIR, "hooks");
11256
+ var AUGMENT_USER_DIR = path11.join(os6.homedir(), ".augment");
11257
+ var AUGMENT_USER_HOOKS_DIR = path11.join(AUGMENT_USER_DIR, "hooks");
11065
11258
  var AUGMENT_DISPATCHER_TRAMPOLINE = "augment-dispatcher.sh";
11066
11259
  var AUGMENT_LEGACY_TRAMPOLINES = [
11067
11260
  "augment-chat-history.sh",
@@ -11077,29 +11270,29 @@ var AUGMENT_DISPATCHER_BINDINGS = [
11077
11270
  ["post_tool_use", "PostToolUse"]
11078
11271
  ];
11079
11272
  function _deploy_augment_trampoline(package_root, name, force) {
11080
- const src = path10.join(package_root, "scripts", "hooks", name);
11273
+ const src = path11.join(package_root, "scripts", "hooks", name);
11081
11274
  if (!pathExists(src)) {
11082
11275
  skip(`augment trampoline missing in package: ${src}`);
11083
11276
  return null;
11084
11277
  }
11085
11278
  mkdirp(AUGMENT_USER_HOOKS_DIR);
11086
- const dst = path10.join(AUGMENT_USER_HOOKS_DIR, name);
11279
+ const dst = path11.join(AUGMENT_USER_HOOKS_DIR, name);
11087
11280
  const src_text = readText(src);
11088
11281
  if (pathExists(dst) && readText(dst) === src_text && !force) {
11089
11282
  skip(`~/.augment/hooks/${name} already up to date`);
11090
11283
  } else {
11091
11284
  writeText(dst, src_text);
11092
- fs12.chmodSync(dst, 493);
11285
+ fs13.chmodSync(dst, 493);
11093
11286
  success(`~/.augment/hooks/${name} installed`);
11094
11287
  }
11095
11288
  return dst;
11096
11289
  }
11097
11290
  function _remove_legacy_augment_trampolines() {
11098
11291
  for (const name of AUGMENT_LEGACY_TRAMPOLINES) {
11099
- const legacy = path10.join(AUGMENT_USER_HOOKS_DIR, name);
11292
+ const legacy = path11.join(AUGMENT_USER_HOOKS_DIR, name);
11100
11293
  try {
11101
11294
  if (isFile(legacy)) {
11102
- fs12.unlinkSync(legacy);
11295
+ fs13.unlinkSync(legacy);
11103
11296
  skip(`removed legacy ~/.augment/hooks/${name}`);
11104
11297
  }
11105
11298
  } catch {
@@ -11118,7 +11311,7 @@ function ensure_augment_user_hooks(package_root, force) {
11118
11311
  }
11119
11312
  const settings_patch = { hooks: per_event };
11120
11313
  return merge_json_file(
11121
- path10.join(AUGMENT_USER_DIR, "settings.json"),
11314
+ path11.join(AUGMENT_USER_DIR, "settings.json"),
11122
11315
  settings_patch,
11123
11316
  force,
11124
11317
  "~/.augment/settings.json"
@@ -11143,7 +11336,7 @@ function _heal_legacy_claude_plugin_ids(p) {
11143
11336
  return removed;
11144
11337
  }
11145
11338
  function ensure_claude_bridge(project_root, force) {
11146
- const target = path10.join(project_root, ".claude", "settings.json");
11339
+ const target = path11.join(project_root, ".claude", "settings.json");
11147
11340
  const healed = _heal_legacy_claude_plugin_ids(target);
11148
11341
  for (const pid of healed) {
11149
11342
  success(`.claude/settings.json: removed stale plugin id \`${pid}\``);
@@ -11168,29 +11361,29 @@ function ensure_cursor_bridge(project_root, force) {
11168
11361
  }
11169
11362
  const bridge = { version: 1, hooks };
11170
11363
  return merge_json_file(
11171
- path10.join(project_root, ".cursor", "hooks.json"),
11364
+ path11.join(project_root, ".cursor", "hooks.json"),
11172
11365
  bridge,
11173
11366
  force,
11174
11367
  ".cursor/hooks.json"
11175
11368
  );
11176
11369
  }
11177
- var CURSOR_USER_DIR = path10.join(os6.homedir(), ".cursor");
11178
- var CURSOR_USER_HOOKS_DIR = path10.join(CURSOR_USER_DIR, "hooks");
11370
+ var CURSOR_USER_DIR = path11.join(os6.homedir(), ".cursor");
11371
+ var CURSOR_USER_HOOKS_DIR = path11.join(CURSOR_USER_DIR, "hooks");
11179
11372
  var CURSOR_DISPATCHER_TRAMPOLINE = "cursor-dispatcher.sh";
11180
11373
  function ensure_cursor_user_hooks(package_root, force) {
11181
- const src = path10.join(package_root, "scripts", "hooks", CURSOR_DISPATCHER_TRAMPOLINE);
11374
+ const src = path11.join(package_root, "scripts", "hooks", CURSOR_DISPATCHER_TRAMPOLINE);
11182
11375
  if (!pathExists(src)) {
11183
11376
  skip(`cursor trampoline missing in package: ${src}`);
11184
11377
  return [];
11185
11378
  }
11186
11379
  mkdirp(CURSOR_USER_HOOKS_DIR);
11187
- const dst = path10.join(CURSOR_USER_HOOKS_DIR, CURSOR_DISPATCHER_TRAMPOLINE);
11380
+ const dst = path11.join(CURSOR_USER_HOOKS_DIR, CURSOR_DISPATCHER_TRAMPOLINE);
11188
11381
  const src_text = readText(src);
11189
11382
  if (pathExists(dst) && readText(dst) === src_text && !force) {
11190
11383
  skip(`~/.cursor/hooks/${CURSOR_DISPATCHER_TRAMPOLINE} already up to date`);
11191
11384
  } else {
11192
11385
  writeText(dst, src_text);
11193
- fs12.chmodSync(dst, 493);
11386
+ fs13.chmodSync(dst, 493);
11194
11387
  success(`~/.cursor/hooks/${CURSOR_DISPATCHER_TRAMPOLINE} installed`);
11195
11388
  }
11196
11389
  const hooks = {};
@@ -11199,7 +11392,7 @@ function ensure_cursor_user_hooks(package_root, force) {
11199
11392
  }
11200
11393
  const settings_patch = { version: 1, hooks };
11201
11394
  return merge_json_file(
11202
- path10.join(CURSOR_USER_DIR, "hooks.json"),
11395
+ path11.join(CURSOR_USER_DIR, "hooks.json"),
11203
11396
  settings_patch,
11204
11397
  force,
11205
11398
  "~/.cursor/hooks.json"
@@ -11242,12 +11435,12 @@ exit 0
11242
11435
  `;
11243
11436
  }
11244
11437
  function ensure_cline_bridge(project_root, force) {
11245
- const hooks_dir = path10.join(project_root, ".clinerules", "hooks");
11438
+ const hooks_dir = path11.join(project_root, ".clinerules", "hooks");
11246
11439
  mkdirp(hooks_dir);
11247
11440
  const workspace_quoted = shlexQuote(resolvePath(project_root));
11248
11441
  let written = 0;
11249
11442
  for (const [ac_event, native_event] of CLINE_DISPATCHER_BINDINGS) {
11250
- const target = path10.join(hooks_dir, native_event);
11443
+ const target = path11.join(hooks_dir, native_event);
11251
11444
  const body = clineProjectHookBody(native_event, ac_event, workspace_quoted);
11252
11445
  if (pathExists(target) && readText(target) === body && !force) {
11253
11446
  continue;
@@ -11257,7 +11450,7 @@ function ensure_cline_bridge(project_root, force) {
11257
11450
  continue;
11258
11451
  }
11259
11452
  writeText(target, body);
11260
- fs12.chmodSync(target, 493);
11453
+ fs13.chmodSync(target, 493);
11261
11454
  written += 1;
11262
11455
  }
11263
11456
  if (written) {
@@ -11266,27 +11459,27 @@ function ensure_cline_bridge(project_root, force) {
11266
11459
  skip(".clinerules/hooks/ already up to date");
11267
11460
  }
11268
11461
  }
11269
- var CLINE_USER_DIR = path10.join(os6.homedir(), "Documents", "Cline", "Hooks");
11462
+ var CLINE_USER_DIR = path11.join(os6.homedir(), "Documents", "Cline", "Hooks");
11270
11463
  var CLINE_DISPATCHER_TRAMPOLINE = "cline-dispatcher.sh";
11271
11464
  function ensure_cline_user_hooks(package_root, force) {
11272
- const src = path10.join(package_root, "scripts", "hooks", CLINE_DISPATCHER_TRAMPOLINE);
11465
+ const src = path11.join(package_root, "scripts", "hooks", CLINE_DISPATCHER_TRAMPOLINE);
11273
11466
  if (!pathExists(src)) {
11274
11467
  skip(`cline trampoline missing in package: ${src}`);
11275
11468
  return;
11276
11469
  }
11277
11470
  mkdirp(CLINE_USER_DIR);
11278
- const trampoline = path10.join(CLINE_USER_DIR, CLINE_DISPATCHER_TRAMPOLINE);
11471
+ const trampoline = path11.join(CLINE_USER_DIR, CLINE_DISPATCHER_TRAMPOLINE);
11279
11472
  const src_text = readText(src);
11280
11473
  if (pathExists(trampoline) && readText(trampoline) === src_text && !force) {
11281
11474
  skip(`~/Documents/Cline/Hooks/${CLINE_DISPATCHER_TRAMPOLINE} already up to date`);
11282
11475
  } else {
11283
11476
  writeText(trampoline, src_text);
11284
- fs12.chmodSync(trampoline, 493);
11477
+ fs13.chmodSync(trampoline, 493);
11285
11478
  success(`~/Documents/Cline/Hooks/${CLINE_DISPATCHER_TRAMPOLINE} installed`);
11286
11479
  }
11287
11480
  const trampoline_quoted = shlexQuote(trampoline);
11288
11481
  for (const [ac_event, native_event] of CLINE_DISPATCHER_BINDINGS) {
11289
- const wrapper = path10.join(CLINE_USER_DIR, native_event);
11482
+ const wrapper = path11.join(CLINE_USER_DIR, native_event);
11290
11483
  const body = `#!/usr/bin/env bash
11291
11484
  # Generated by event4u/agent-config install.py \u2014 DO NOT EDIT.
11292
11485
  # User-scope Cline hook for ${native_event} \u2192 agent-config ${ac_event}.
@@ -11296,7 +11489,7 @@ exec ${trampoline_quoted} ${ac_event} ${native_event}
11296
11489
  continue;
11297
11490
  }
11298
11491
  writeText(wrapper, body);
11299
- fs12.chmodSync(wrapper, 493);
11492
+ fs13.chmodSync(wrapper, 493);
11300
11493
  }
11301
11494
  }
11302
11495
  var WINDSURF_DISPATCHER_BINDINGS = [
@@ -11317,29 +11510,29 @@ function ensure_windsurf_bridge(project_root, force) {
11317
11510
  }
11318
11511
  const bridge = { hooks };
11319
11512
  return merge_json_file(
11320
- path10.join(project_root, ".windsurf", "hooks.json"),
11513
+ path11.join(project_root, ".windsurf", "hooks.json"),
11321
11514
  bridge,
11322
11515
  force,
11323
11516
  ".windsurf/hooks.json"
11324
11517
  );
11325
11518
  }
11326
- var WINDSURF_USER_DIR = path10.join(os6.homedir(), ".codeium", "windsurf");
11327
- var WINDSURF_USER_HOOKS_DIR = path10.join(WINDSURF_USER_DIR, "hooks");
11519
+ var WINDSURF_USER_DIR = path11.join(os6.homedir(), ".codeium", "windsurf");
11520
+ var WINDSURF_USER_HOOKS_DIR = path11.join(WINDSURF_USER_DIR, "hooks");
11328
11521
  var WINDSURF_DISPATCHER_TRAMPOLINE = "windsurf-dispatcher.sh";
11329
11522
  function ensure_windsurf_user_hooks(package_root, force) {
11330
- const src = path10.join(package_root, "scripts", "hooks", WINDSURF_DISPATCHER_TRAMPOLINE);
11523
+ const src = path11.join(package_root, "scripts", "hooks", WINDSURF_DISPATCHER_TRAMPOLINE);
11331
11524
  if (!pathExists(src)) {
11332
11525
  skip(`windsurf trampoline missing in package: ${src}`);
11333
11526
  return [];
11334
11527
  }
11335
11528
  mkdirp(WINDSURF_USER_HOOKS_DIR);
11336
- const dst = path10.join(WINDSURF_USER_HOOKS_DIR, WINDSURF_DISPATCHER_TRAMPOLINE);
11529
+ const dst = path11.join(WINDSURF_USER_HOOKS_DIR, WINDSURF_DISPATCHER_TRAMPOLINE);
11337
11530
  const src_text = readText(src);
11338
11531
  if (pathExists(dst) && readText(dst) === src_text && !force) {
11339
11532
  skip(`~/.codeium/windsurf/hooks/${WINDSURF_DISPATCHER_TRAMPOLINE} already up to date`);
11340
11533
  } else {
11341
11534
  writeText(dst, src_text);
11342
- fs12.chmodSync(dst, 493);
11535
+ fs13.chmodSync(dst, 493);
11343
11536
  success(`~/.codeium/windsurf/hooks/${WINDSURF_DISPATCHER_TRAMPOLINE} installed`);
11344
11537
  }
11345
11538
  const hooks = {};
@@ -11351,7 +11544,7 @@ function ensure_windsurf_user_hooks(package_root, force) {
11351
11544
  }
11352
11545
  const settings_patch = { hooks };
11353
11546
  return merge_json_file(
11354
- path10.join(WINDSURF_USER_DIR, "hooks.json"),
11547
+ path11.join(WINDSURF_USER_DIR, "hooks.json"),
11355
11548
  settings_patch,
11356
11549
  force,
11357
11550
  "~/.codeium/windsurf/hooks.json"
@@ -11380,43 +11573,43 @@ function _gemini_hooks_dict(command_factory) {
11380
11573
  function ensure_gemini_bridge(project_root, force) {
11381
11574
  const bridge = { hooks: _gemini_hooks_dict(_gemini_dispatch_command) };
11382
11575
  return merge_json_file(
11383
- path10.join(project_root, ".gemini", "settings.json"),
11576
+ path11.join(project_root, ".gemini", "settings.json"),
11384
11577
  bridge,
11385
11578
  force,
11386
11579
  ".gemini/settings.json"
11387
11580
  );
11388
11581
  }
11389
- var GEMINI_USER_DIR = path10.join(os6.homedir(), ".gemini");
11390
- var GEMINI_USER_HOOKS_DIR = path10.join(GEMINI_USER_DIR, "hooks");
11582
+ var GEMINI_USER_DIR = path11.join(os6.homedir(), ".gemini");
11583
+ var GEMINI_USER_HOOKS_DIR = path11.join(GEMINI_USER_DIR, "hooks");
11391
11584
  var GEMINI_DISPATCHER_TRAMPOLINE = "gemini-dispatcher.sh";
11392
11585
  function ensure_gemini_user_hooks(package_root, force) {
11393
- const src = path10.join(package_root, "scripts", "hooks", GEMINI_DISPATCHER_TRAMPOLINE);
11586
+ const src = path11.join(package_root, "scripts", "hooks", GEMINI_DISPATCHER_TRAMPOLINE);
11394
11587
  if (!pathExists(src)) {
11395
11588
  skip(`gemini trampoline missing in package: ${src}`);
11396
11589
  return [];
11397
11590
  }
11398
11591
  mkdirp(GEMINI_USER_HOOKS_DIR);
11399
- const dst = path10.join(GEMINI_USER_HOOKS_DIR, GEMINI_DISPATCHER_TRAMPOLINE);
11592
+ const dst = path11.join(GEMINI_USER_HOOKS_DIR, GEMINI_DISPATCHER_TRAMPOLINE);
11400
11593
  const src_text = readText(src);
11401
11594
  if (pathExists(dst) && readText(dst) === src_text && !force) {
11402
11595
  skip(`~/.gemini/hooks/${GEMINI_DISPATCHER_TRAMPOLINE} already up to date`);
11403
11596
  } else {
11404
11597
  writeText(dst, src_text);
11405
- fs12.chmodSync(dst, 493);
11598
+ fs13.chmodSync(dst, 493);
11406
11599
  success(`~/.gemini/hooks/${GEMINI_DISPATCHER_TRAMPOLINE} installed`);
11407
11600
  }
11408
11601
  const settings_patch = {
11409
11602
  hooks: _gemini_hooks_dict((ac_event, native) => `${dst} ${ac_event} ${native}`)
11410
11603
  };
11411
11604
  return merge_json_file(
11412
- path10.join(GEMINI_USER_DIR, "settings.json"),
11605
+ path11.join(GEMINI_USER_DIR, "settings.json"),
11413
11606
  settings_patch,
11414
11607
  force,
11415
11608
  "~/.gemini/settings.json"
11416
11609
  );
11417
11610
  }
11418
11611
  function ensure_copilot_bridge(project_root, force) {
11419
- const target = path10.join(project_root, ".github", "plugin", "marketplace.json");
11612
+ const target = path11.join(project_root, ".github", "plugin", "marketplace.json");
11420
11613
  const bridge = {
11421
11614
  marketplace: {
11422
11615
  name: "event4u-agent-marketplace",
@@ -11459,7 +11652,7 @@ See \`docs/setup/per-ide/roocode.md\` for the full activation guide.
11459
11652
  Run \`./agent-config --help\` for available commands.
11460
11653
  `;
11461
11654
  function ensure_roocode_bridge(project_root, force) {
11462
- const target = path10.join(project_root, ".roo", "rules", "agent-config.md");
11655
+ const target = path11.join(project_root, ".roo", "rules", "agent-config.md");
11463
11656
  if (pathExists(target) && !force) {
11464
11657
  skip(".roo/rules/agent-config.md already exists");
11465
11658
  return;
@@ -11481,7 +11674,7 @@ To wire Claude Desktop to this project's rules, run:
11481
11674
  Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
11482
11675
  `;
11483
11676
  function ensure_claude_desktop_bridge(project_root, force) {
11484
- const target = path10.join(project_root, ".claude-desktop", "agent-config.md");
11677
+ const target = path11.join(project_root, ".claude-desktop", "agent-config.md");
11485
11678
  if (pathExists(target) && !force) {
11486
11679
  skip(".claude-desktop/agent-config.md already exists");
11487
11680
  return;
@@ -11506,7 +11699,7 @@ Or pass \`--read .aider/agent-config.md\` on the command line.
11506
11699
  Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
11507
11700
  `;
11508
11701
  function ensure_aider_bridge(project_root, force) {
11509
- const target = path10.join(project_root, ".aider", "agent-config.md");
11702
+ const target = path11.join(project_root, ".aider", "agent-config.md");
11510
11703
  if (pathExists(target) && !force) {
11511
11704
  skip(".aider/agent-config.md already exists");
11512
11705
  return;
@@ -11525,7 +11718,7 @@ developers where the rules and skills live.
11525
11718
  Canonical rule and skill source: \`.augment/\` (see project \`AGENTS.md\`).
11526
11719
  `;
11527
11720
  function ensure_codex_bridge(project_root, force) {
11528
- const target = path10.join(project_root, ".codex", "agent-config.md");
11721
+ const target = path11.join(project_root, ".codex", "agent-config.md");
11529
11722
  if (pathExists(target) && !force) {
11530
11723
  skip(".codex/agent-config.md already exists");
11531
11724
  return;
@@ -11543,7 +11736,7 @@ rules per session. The canonical rule and skill source lives under
11543
11736
  orientation).
11544
11737
  `;
11545
11738
  function ensure_continue_bridge(project_root, force) {
11546
- const target = path10.join(project_root, ".continue", "rules", "agent-config.md");
11739
+ const target = path11.join(project_root, ".continue", "rules", "agent-config.md");
11547
11740
  if (pathExists(target) && !force) {
11548
11741
  skip(".continue/rules/agent-config.md already exists");
11549
11742
  return;
@@ -11574,7 +11767,7 @@ orientation).
11574
11767
  See \`docs/setup/per-ide/kilocode.md\` for the full activation guide.
11575
11768
  `;
11576
11769
  function ensure_kilocode_bridge(project_root, force) {
11577
- const target = path10.join(project_root, ".kilocode", "rules", "agent-config.md");
11770
+ const target = path11.join(project_root, ".kilocode", "rules", "agent-config.md");
11578
11771
  if (pathExists(target) && !force) {
11579
11772
  skip(".kilocode/rules/agent-config.md already exists");
11580
11773
  return;
@@ -11601,7 +11794,7 @@ canonical source (or symlink it):
11601
11794
  Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
11602
11795
  `;
11603
11796
  function ensure_zed_bridge(project_root, force) {
11604
- const target = path10.join(project_root, ".zed", "agent-config.md");
11797
+ const target = path11.join(project_root, ".zed", "agent-config.md");
11605
11798
  if (pathExists(target) && !force) {
11606
11799
  skip(".zed/agent-config.md already exists");
11607
11800
  return;
@@ -11622,7 +11815,7 @@ rules into your JetBrains profile.
11622
11815
  Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
11623
11816
  `;
11624
11817
  function ensure_jetbrains_bridge(project_root, force) {
11625
- const target = path10.join(project_root, ".jetbrains", "agent-config.md");
11818
+ const target = path11.join(project_root, ".jetbrains", "agent-config.md");
11626
11819
  if (pathExists(target) && !force) {
11627
11820
  skip(".jetbrains/agent-config.md already exists");
11628
11821
  return;
@@ -11653,7 +11846,7 @@ session. The canonical rule and skill source lives under \`.augment/\`
11653
11846
  See \`docs/setup/per-ide/kiro.md\` for the full activation guide.
11654
11847
  `;
11655
11848
  function ensure_kiro_bridge(project_root, force) {
11656
- const target = path10.join(project_root, ".kiro", "steering", "agent-config.md");
11849
+ const target = path11.join(project_root, ".kiro", "steering", "agent-config.md");
11657
11850
  if (pathExists(target) && !force) {
11658
11851
  skip(".kiro/steering/agent-config.md already exists");
11659
11852
  return;
@@ -11679,35 +11872,35 @@ var SMOKE_BRIDGE_PATHS = {
11679
11872
  };
11680
11873
  function dirHasEntries(p) {
11681
11874
  try {
11682
- return fs12.readdirSync(p).length > 0;
11875
+ return fs13.readdirSync(p).length > 0;
11683
11876
  } catch {
11684
11877
  return false;
11685
11878
  }
11686
11879
  }
11687
11880
  function _resolve_tsx_invocation(scriptPath, scriptArgs) {
11688
11881
  const binName = process3.platform === "win32" ? "tsx.cmd" : "tsx";
11689
- let dir = path10.dirname(scriptPath);
11882
+ let dir = path11.dirname(scriptPath);
11690
11883
  for (; ; ) {
11691
- const candidate = path10.join(dir, "node_modules", ".bin", binName);
11884
+ const candidate = path11.join(dir, "node_modules", ".bin", binName);
11692
11885
  if (isFile(candidate)) {
11693
11886
  return { command: candidate, args: [scriptPath, ...scriptArgs] };
11694
11887
  }
11695
- const parent = path10.dirname(dir);
11888
+ const parent = path11.dirname(dir);
11696
11889
  if (parent === dir) break;
11697
11890
  dir = parent;
11698
11891
  }
11699
11892
  return { command: "npx", args: ["tsx", scriptPath, ...scriptArgs] };
11700
11893
  }
11701
11894
  function _smoke_test_hooks(project_root, package_root) {
11702
- const dispatcher = path10.join(package_root, "scripts", "hooks", "dispatch_hook.ts");
11703
- const manifest = path10.join(package_root, "scripts", "hook_manifest.yaml");
11895
+ const dispatcher = path11.join(package_root, "scripts", "hooks", "dispatch_hook.ts");
11896
+ const manifest = path11.join(package_root, "scripts", "hook_manifest.yaml");
11704
11897
  if (!isFile(dispatcher) || !isFile(manifest)) return 0;
11705
11898
  const failed = [];
11706
11899
  const skipped = [];
11707
11900
  const passed = [];
11708
11901
  for (const [platform, native] of SMOKE_PROBE_EVENTS) {
11709
11902
  const rel_bridge = SMOKE_BRIDGE_PATHS[platform] ?? "";
11710
- const bridge_path = rel_bridge ? path10.join(project_root, rel_bridge) : null;
11903
+ const bridge_path = rel_bridge ? path11.join(project_root, rel_bridge) : null;
11711
11904
  const bridge_present = Boolean(
11712
11905
  bridge_path && (isFile(bridge_path) || isDir(bridge_path) && dirHasEntries(bridge_path))
11713
11906
  );
@@ -11907,9 +12100,9 @@ To remove this marker, delete this file.
11907
12100
  `;
11908
12101
  }
11909
12102
  var _CLAUDE_DESKTOP_BUNDLES_SUBPATH = "claude-desktop/bundles";
11910
- var GLOBAL_ROOT = path10.join(os6.homedir(), ".event4u", "agent-config");
11911
- var GLOBAL_USER_SETTINGS_PATH = path10.join(GLOBAL_ROOT, ".agent-user.yml");
11912
- var GLOBAL_AGENT_SETTINGS_PATH = path10.join(GLOBAL_ROOT, ".agent-settings.yml");
12103
+ var GLOBAL_ROOT = path11.join(os6.homedir(), ".event4u", "agent-config");
12104
+ var GLOBAL_USER_SETTINGS_PATH = path11.join(GLOBAL_ROOT, ".agent-user.yml");
12105
+ var GLOBAL_AGENT_SETTINGS_PATH = path11.join(GLOBAL_ROOT, ".agent-settings.yml");
11913
12106
  function _bridge_marker(tool_id, scope) {
11914
12107
  if (scope === "global") return USER_SCOPE_PATHS[tool_id] ?? "";
11915
12108
  return PROJECT_BRIDGE_MARKERS[tool_id] ?? "";
@@ -12022,9 +12215,9 @@ function detect_scope(cwd) {
12022
12215
  if (pathExists(_resolve_settings_read(cwd))) {
12023
12216
  return ["project", `existing ${SETTINGS_FILE}`];
12024
12217
  }
12025
- const has_manifest = SCOPE_DETECT_MANIFESTS.find((m) => pathExists(path10.join(cwd, m))) ?? null;
12026
- const has_ai_dir = SCOPE_DETECT_AI_DIRS.find((d) => isDir(path10.join(cwd, d))) ?? null;
12027
- const has_ai_file = SCOPE_DETECT_AI_FILES.find((f) => pathExists(path10.join(cwd, f))) ?? null;
12218
+ const has_manifest = SCOPE_DETECT_MANIFESTS.find((m) => pathExists(path11.join(cwd, m))) ?? null;
12219
+ const has_ai_dir = SCOPE_DETECT_AI_DIRS.find((d) => isDir(path11.join(cwd, d))) ?? null;
12220
+ const has_ai_file = SCOPE_DETECT_AI_FILES.find((f) => pathExists(path11.join(cwd, f))) ?? null;
12028
12221
  if (has_manifest && (has_ai_dir || has_ai_file)) {
12029
12222
  const marker = has_ai_dir || has_ai_file;
12030
12223
  return ["prompt", `manifest (${has_manifest}) + AI-tool config (${marker})`];
@@ -12045,7 +12238,7 @@ function readLineSyncRaw(promptText) {
12045
12238
  for (; ; ) {
12046
12239
  let n;
12047
12240
  try {
12048
- n = fs12.readSync(0, buf, 0, 1, null);
12241
+ n = fs13.readSync(0, buf, 0, 1, null);
12049
12242
  } catch (err) {
12050
12243
  const code = err.code;
12051
12244
  if (code === "EAGAIN") {
@@ -12120,8 +12313,8 @@ function _files_by_tool_from_bridges(tools, project_root, scope) {
12120
12313
  const marker = _bridge_marker(tool_id, scope);
12121
12314
  if (!marker) continue;
12122
12315
  let marker_path = marker;
12123
- if (!path10.isAbsolute(marker_path)) {
12124
- marker_path = path10.join(project_root, marker_path);
12316
+ if (!path11.isAbsolute(marker_path)) {
12317
+ marker_path = path11.join(project_root, marker_path);
12125
12318
  }
12126
12319
  out[tool_id] = [_file_entry(marker_path, "bridge", false)];
12127
12320
  }
@@ -12160,26 +12353,26 @@ function _update_installed_tools_manifest(project_root, tools, scope, force, fil
12160
12353
  }
12161
12354
  write_manifest(target, version, entries);
12162
12355
  if (!state.QUIET) {
12163
- const rel = isRelativeTo(target, project_root) ? path10.relative(project_root, target) : target;
12356
+ const rel = isRelativeTo(target, project_root) ? path11.relative(project_root, target) : target;
12164
12357
  info(`Manifest updated: ${rel}`);
12165
12358
  }
12166
12359
  return 0;
12167
12360
  }
12168
12361
  function isRelativeTo(child, parent) {
12169
- const rel = path10.relative(parent, child);
12170
- return rel === "" || !rel.startsWith("..") && !path10.isAbsolute(rel);
12362
+ const rel = path11.relative(parent, child);
12363
+ return rel === "" || !rel.startsWith("..") && !path11.isAbsolute(rel);
12171
12364
  }
12172
12365
  function _resolve_package_root_for_global() {
12173
12366
  const here = resolvePath(_HERE2);
12174
- const candidate = path10.dirname(path10.dirname(path10.dirname(here)));
12175
- if (!pathExists(path10.join(candidate, "src", "config", "profiles", "minimal.ini"))) {
12367
+ const candidate = path11.dirname(path11.dirname(path11.dirname(here)));
12368
+ if (!pathExists(path11.join(candidate, "src", "config", "profiles", "minimal.ini"))) {
12176
12369
  fail(
12177
12370
  `Could not locate agent-config package root from ${here}. Expected src/config/profiles/minimal.ini at the parent directory.`
12178
12371
  );
12179
12372
  }
12180
12373
  return candidate;
12181
12374
  }
12182
- var CONSUMER_BRIDGE_MARKER_RELPATH = path10.join("agents", ".event4u-bridge.yml");
12375
+ var CONSUMER_BRIDGE_MARKER_RELPATH = path11.join("agents", ".event4u-bridge.yml");
12183
12376
  var MIGRATE_LEGACY_YAML_FILES = [".agent-settings.yml", ".agent-user.yml"];
12184
12377
  var MIGRATE_LEGACY_TOOL_DIRS = [".augment", ".claude", ".cursor"];
12185
12378
  var AGENT_CONFIG_PACKAGE_NAME = "@event4u/agent-config";
@@ -12187,7 +12380,7 @@ function _is_agent_config_source_repo(project_root) {
12187
12380
  if (process3.env["AGENT_CONFIG_CONSUMER_MODE"] === "1") {
12188
12381
  return [false, "consumer-mode-override"];
12189
12382
  }
12190
- const pkg_json = path10.join(project_root, "package.json");
12383
+ const pkg_json = path11.join(project_root, "package.json");
12191
12384
  if (isFile(pkg_json)) {
12192
12385
  let data = {};
12193
12386
  try {
@@ -12199,18 +12392,18 @@ function _is_agent_config_source_repo(project_root) {
12199
12392
  return [true, "package.json:name"];
12200
12393
  }
12201
12394
  }
12202
- if (isDir(path10.join(project_root, ".agent-src.uncondensed"))) {
12395
+ if (isDir(path11.join(project_root, ".agent-src.uncondensed"))) {
12203
12396
  return [true, ".agent-src.uncondensed/"];
12204
12397
  }
12205
- const packages_dir = path10.join(project_root, "packages");
12398
+ const packages_dir = path11.join(project_root, "packages");
12206
12399
  if (isDir(packages_dir)) {
12207
- for (const child of fs12.readdirSync(packages_dir)) {
12208
- if (isDir(path10.join(packages_dir, child, ".agent-src.uncondensed"))) {
12400
+ for (const child of fs13.readdirSync(packages_dir)) {
12401
+ if (isDir(path11.join(packages_dir, child, ".agent-src.uncondensed"))) {
12209
12402
  return [true, `packages/${child}/.agent-src.uncondensed/`];
12210
12403
  }
12211
12404
  }
12212
12405
  }
12213
- const installer_self = path10.join(project_root, "scripts", "install.py");
12406
+ const installer_self = path11.join(project_root, "scripts", "install.py");
12214
12407
  try {
12215
12408
  if (isFile(installer_self) && resolvePath(installer_self) === resolvePath(_HERE2)) {
12216
12409
  return [true, "src/scripts/install.py (self)"];
@@ -12230,17 +12423,17 @@ function _detect_legacy_for_migration(project_root) {
12230
12423
  }
12231
12424
  return [];
12232
12425
  }
12233
- if (isFile(path10.join(project_root, CONSUMER_BRIDGE_MARKER_RELPATH))) return [];
12426
+ if (isFile(path11.join(project_root, CONSUMER_BRIDGE_MARKER_RELPATH))) return [];
12234
12427
  const found = [];
12235
12428
  for (const name of MIGRATE_LEGACY_YAML_FILES) {
12236
- if (isFile(path10.join(project_root, name))) {
12429
+ if (isFile(path11.join(project_root, name))) {
12237
12430
  found.push(name);
12238
- } else if (isFile(path10.join(project_root, "settings", name))) {
12431
+ } else if (isFile(path11.join(project_root, "settings", name))) {
12239
12432
  found.push(`settings/${name}`);
12240
12433
  }
12241
12434
  }
12242
12435
  for (const name of MIGRATE_LEGACY_TOOL_DIRS) {
12243
- const p = path10.join(project_root, name);
12436
+ const p = path11.join(project_root, name);
12244
12437
  if (isDir(p) && !isSymlink(p)) {
12245
12438
  found.push(`${name}/`);
12246
12439
  }
@@ -12252,7 +12445,7 @@ function _prompt_migrate_to_global(project_root, artefacts) {
12252
12445
  process3.stdout.write("\n");
12253
12446
  warn("Legacy project-local artefacts detected \u2014 pre-ADR-020 layout:");
12254
12447
  for (const rel of artefacts) {
12255
- info(` ${path10.join(project_root, rel)}`);
12448
+ info(` ${path11.join(project_root, rel)}`);
12256
12449
  }
12257
12450
  info("The unified `agent-config migrate` sweeps these in one pass.");
12258
12451
  info("The wizard recreates fresh config afterwards.");
@@ -12283,16 +12476,16 @@ function _run_migrate_to_global(project_root) {
12283
12476
  function _format_global_root_for_marker(global_root) {
12284
12477
  const home = resolvePath(os6.homedir());
12285
12478
  const resolved = resolvePath(global_root);
12286
- const rel = path10.relative(home, resolved);
12287
- if (rel === "" || rel.startsWith("..") || path10.isAbsolute(rel)) {
12479
+ const rel = path11.relative(home, resolved);
12480
+ if (rel === "" || rel.startsWith("..") || path11.isAbsolute(rel)) {
12288
12481
  return global_root;
12289
12482
  }
12290
- return `~/${rel.split(path10.sep).join("/")}`;
12483
+ return `~/${rel.split(path11.sep).join("/")}`;
12291
12484
  }
12292
12485
  function _write_consumer_bridge_marker(project_root, installer_version, env = null, now = null) {
12293
12486
  const env_map = env ?? process3.env;
12294
12487
  if (env_map["AGENT_CONFIG_DEV_MODE"] === "1") return null;
12295
- if (isDir(path10.join(project_root, ".agent-src.uncondensed"))) return null;
12488
+ if (isDir(path11.join(project_root, ".agent-src.uncondensed"))) return null;
12296
12489
  const global_root_str = _format_global_root_for_marker(
12297
12490
  event4u_root(env_map)
12298
12491
  );
@@ -12306,8 +12499,8 @@ global_root: ${global_root_str}
12306
12499
  installed_at: ${stamp}
12307
12500
  installer_version: ${installer_version}
12308
12501
  `;
12309
- const target = path10.join(project_root, CONSUMER_BRIDGE_MARKER_RELPATH);
12310
- mkdirp(path10.dirname(target));
12502
+ const target = path11.join(project_root, CONSUMER_BRIDGE_MARKER_RELPATH);
12503
+ mkdirp(path11.dirname(target));
12311
12504
  atomicWrite0644(target, body, ".event4u-bridge.");
12312
12505
  return target;
12313
12506
  }
@@ -12319,7 +12512,7 @@ var PROJECT_ANCHOR_TOOLS = {
12319
12512
  function _write_per_tool_project_anchors(project_root, tools, env = null, now = null) {
12320
12513
  const env_map = env ?? process3.env;
12321
12514
  if (env_map["AGENT_CONFIG_DEV_MODE"] === "1") return [];
12322
- if (isDir(path10.join(project_root, ".agent-src.uncondensed"))) return [];
12515
+ if (isDir(path11.join(project_root, ".agent-src.uncondensed"))) return [];
12323
12516
  const global_root_str = _format_global_root_for_marker(
12324
12517
  event4u_root(env_map)
12325
12518
  );
@@ -12328,10 +12521,10 @@ function _write_per_tool_project_anchors(project_root, tools, env = null, now =
12328
12521
  for (const tool_id of Object.keys(PROJECT_ANCHOR_TOOLS).sort()) {
12329
12522
  const rel_path = PROJECT_ANCHOR_TOOLS[tool_id];
12330
12523
  if (!tools.has(tool_id)) continue;
12331
- const target = path10.join(project_root, rel_path);
12332
- mkdirp(path10.dirname(target));
12333
- const bridge_abs = path10.join(project_root, CONSUMER_BRIDGE_MARKER_RELPATH);
12334
- const bridge_rel = path10.relative(path10.dirname(target), bridge_abs);
12524
+ const target = path11.join(project_root, rel_path);
12525
+ mkdirp(path11.dirname(target));
12526
+ const bridge_abs = path11.join(project_root, CONSUMER_BRIDGE_MARKER_RELPATH);
12527
+ const bridge_rel = path11.relative(path11.dirname(target), bridge_abs);
12335
12528
  const body = `# event4u/agent-config \u2014 per-tool project anchor (auto-written).
12336
12529
  # Spec: docs/contracts/consumer-bridge.md \xA7 Per-tool anchor strategy.
12337
12530
  # Tool: ${tool_id}. Bridge marker: agents/.event4u-bridge.yml.
@@ -12348,7 +12541,7 @@ installed_at: ${stamp}
12348
12541
  }
12349
12542
  var PACKAGE_TAG_ID = "event4u/agent-config";
12350
12543
  function _inject_package_tag(target, source, package_root) {
12351
- if (path10.extname(target) !== ".md") return;
12544
+ if (path11.extname(target) !== ".md") return;
12352
12545
  let text;
12353
12546
  try {
12354
12547
  text = readText(target);
@@ -12376,8 +12569,8 @@ function _inject_package_tag(target, source, package_root) {
12376
12569
  resolved_src = source;
12377
12570
  }
12378
12571
  if (package_root !== null) {
12379
- const rel = path10.relative(resolvePath(package_root), resolved_src);
12380
- if (rel !== "" && !rel.startsWith("..") && !path10.isAbsolute(rel)) {
12572
+ const rel = path11.relative(resolvePath(package_root), resolved_src);
12573
+ if (rel !== "" && !rel.startsWith("..") && !path11.isAbsolute(rel)) {
12381
12574
  source_value = rel;
12382
12575
  } else {
12383
12576
  source_value = resolved_src;
@@ -12414,10 +12607,10 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null)
12414
12607
  const written_paths = [];
12415
12608
  if (!pathExists(src)) return [0, 0, written_paths];
12416
12609
  if (!isDir(src)) {
12417
- mkdirp(path10.dirname(dest));
12610
+ mkdirp(path11.dirname(dest));
12418
12611
  const decision = _resolve_file_conflict(dest, force);
12419
12612
  if (decision === "skip") return [0, 1, written_paths];
12420
- fs12.copyFileSync(src, dest);
12613
+ fs13.copyFileSync(src, dest);
12421
12614
  _inject_package_tag(dest, src, package_root);
12422
12615
  written_paths.push(dest);
12423
12616
  return [1, 0, written_paths];
@@ -12425,11 +12618,11 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null)
12425
12618
  mkdirp(dest);
12426
12619
  const walk = (node) => {
12427
12620
  const acc = [];
12428
- const names = fs12.readdirSync(node).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
12621
+ const names = fs13.readdirSync(node).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
12429
12622
  for (const name of names) {
12430
- const entry = path10.join(node, name);
12623
+ const entry = path11.join(node, name);
12431
12624
  acc.push(entry);
12432
- const lst = fs12.lstatSync(entry);
12625
+ const lst = fs13.lstatSync(entry);
12433
12626
  if (lst.isDirectory() && !lst.isSymbolicLink()) {
12434
12627
  acc.push(...walk(entry));
12435
12628
  }
@@ -12437,9 +12630,9 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null)
12437
12630
  return acc;
12438
12631
  };
12439
12632
  for (const entry of walk(src)) {
12440
- const rel = path10.relative(src, entry);
12441
- const target = path10.join(dest, rel);
12442
- const lst = fs12.lstatSync(entry);
12633
+ const rel = path11.relative(src, entry);
12634
+ const target = path11.join(dest, rel);
12635
+ const lst = fs13.lstatSync(entry);
12443
12636
  if (lst.isDirectory() && !lst.isSymbolicLink()) {
12444
12637
  mkdirp(target);
12445
12638
  continue;
@@ -12447,8 +12640,8 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null)
12447
12640
  let resolvedIsDir = false;
12448
12641
  let resolved = entry;
12449
12642
  try {
12450
- resolved = fs12.realpathSync(entry);
12451
- resolvedIsDir = fs12.statSync(entry).isDirectory();
12643
+ resolved = fs13.realpathSync(entry);
12644
+ resolvedIsDir = fs13.statSync(entry).isDirectory();
12452
12645
  } catch {
12453
12646
  resolvedIsDir = false;
12454
12647
  }
@@ -12470,8 +12663,8 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null)
12470
12663
  skipped += 1;
12471
12664
  continue;
12472
12665
  }
12473
- mkdirp(path10.dirname(target));
12474
- fs12.copyFileSync(resolved, target);
12666
+ mkdirp(path11.dirname(target));
12667
+ fs13.copyFileSync(resolved, target);
12475
12668
  _inject_package_tag(target, resolved, package_root);
12476
12669
  written += 1;
12477
12670
  written_paths.push(target);
@@ -12483,7 +12676,7 @@ function _claude_desktop_bundles_dir() {
12483
12676
  }
12484
12677
  function _write_claude_desktop_marker(_force, lockfile_path2, bundles_dir, bundle_count) {
12485
12678
  const anchor = expanduser5(USER_SCOPE_PATHS["claude-desktop"]);
12486
- const target = path10.join(anchor, "agent-config.md");
12679
+ const target = path11.join(anchor, "agent-config.md");
12487
12680
  mkdirp(anchor);
12488
12681
  const body = claudeDesktopMarkerBody(lockfile_path2, anchor, bundles_dir, bundle_count);
12489
12682
  writeText(target, body);
@@ -12526,8 +12719,8 @@ function _deploy_global_content(tools, force, package_root, lockfile_path2) {
12526
12719
  const written_paths = [];
12527
12720
  let current_files = /* @__PURE__ */ new Set();
12528
12721
  for (const [src_rel, dest_sub] of plan) {
12529
- const src = path10.join(package_root, src_rel);
12530
- const dest = dest_sub ? path10.join(anchor, dest_sub) : anchor;
12722
+ const src = path11.join(package_root, src_rel);
12723
+ const dest = dest_sub ? path11.join(anchor, dest_sub) : anchor;
12531
12724
  const [w, s, paths] = _copy_dir_dereferencing_symlinks(src, dest, force, package_root);
12532
12725
  written_total += w;
12533
12726
  skipped_total += s;
@@ -12575,6 +12768,28 @@ function _deploy_global_content(tools, force, package_root, lockfile_path2) {
12575
12768
  }
12576
12769
  _emit_progress({ type: "reaped", tool: tool_id, count: reaped.length });
12577
12770
  results[tool_id] = [written_total, skipped_total, "deployed", written_paths];
12771
+ if (tool_id === "claude-code") {
12772
+ try {
12773
+ const manifest = path11.join(package_root, "src", "scripts", "hook_manifest.yaml");
12774
+ const matrix = build_claude_hook_matrix(manifest);
12775
+ const res = ensure_managed_hooks(
12776
+ path11.join(anchor, "settings.json"),
12777
+ matrix
12778
+ );
12779
+ if (!state.QUIET) {
12780
+ if (res.changed) {
12781
+ success(
12782
+ `claude-code: managed hooks registered in ~/.claude/settings.json (${res.events.length} event(s))`
12783
+ );
12784
+ } else {
12785
+ skip("claude-code: managed hooks already registered");
12786
+ }
12787
+ }
12788
+ } catch (e) {
12789
+ warn(`claude-code: managed-hook registration failed \u2014 ${String(e)}`);
12790
+ _emit_progress({ type: "hooks_failed", tool: tool_id, error: String(e) });
12791
+ }
12792
+ }
12578
12793
  }
12579
12794
  return results;
12580
12795
  }
@@ -12594,7 +12809,7 @@ function _preview_global_reap(tools, package_root) {
12594
12809
  const anchor = expanduser5(anchor_raw);
12595
12810
  let current_files = /* @__PURE__ */ new Set();
12596
12811
  for (const [src_rel, dest_sub] of plan) {
12597
- const src = path10.join(package_root, src_rel);
12812
+ const src = path11.join(package_root, src_rel);
12598
12813
  current_files = setUnion(
12599
12814
  current_files,
12600
12815
  expected_deploy_files(src, dest_sub ? dest_sub : "")
@@ -12624,14 +12839,14 @@ function _preview_global_reap(tools, package_root) {
12624
12839
  function _verify_deploy_targets(anchor, plan) {
12625
12840
  const missing = [];
12626
12841
  for (const [, dest_sub] of plan) {
12627
- const target = dest_sub ? path10.join(anchor, dest_sub) : anchor;
12842
+ const target = dest_sub ? path11.join(anchor, dest_sub) : anchor;
12628
12843
  const label = dest_sub || ".";
12629
12844
  if (!isDir(target)) {
12630
12845
  missing.push(label);
12631
12846
  continue;
12632
12847
  }
12633
12848
  try {
12634
- const entries = fs12.readdirSync(target);
12849
+ const entries = fs13.readdirSync(target);
12635
12850
  if (entries.length === 0) missing.push(label);
12636
12851
  } catch {
12637
12852
  missing.push(label);
@@ -12646,13 +12861,13 @@ function _prune_lab_modules(deploy_results, lab_ids) {
12646
12861
  const [written, skipped, status, paths] = deploy_results[tool_id];
12647
12862
  const lab_skill_dirs = /* @__PURE__ */ new Set();
12648
12863
  for (const p of paths) {
12649
- const parts = p.split(path10.sep);
12864
+ const parts = p.split(path11.sep);
12650
12865
  if (parts.includes("skills")) {
12651
12866
  const i = parts.indexOf("skills");
12652
12867
  if (i + 1 < parts.length) {
12653
- const skill_root = parts.slice(0, i + 2).join(path10.sep);
12868
+ const skill_root = parts.slice(0, i + 2).join(path11.sep);
12654
12869
  if (!lab_skill_dirs.has(skill_root)) {
12655
- const skillmd = path10.join(skill_root, "SKILL.md");
12870
+ const skillmd = path11.join(skill_root, "SKILL.md");
12656
12871
  if (pathExists(skillmd) && is_lab_artefact(skillmd, lab_ids)) {
12657
12872
  lab_skill_dirs.add(skill_root);
12658
12873
  }
@@ -12663,25 +12878,25 @@ function _prune_lab_modules(deploy_results, lab_ids) {
12663
12878
  const keep = [];
12664
12879
  const delete_files = [];
12665
12880
  for (const p of paths) {
12666
- const parts = p.split(path10.sep);
12881
+ const parts = p.split(path11.sep);
12667
12882
  let is_lab = false;
12668
12883
  if (parts.includes("skills")) {
12669
12884
  const i = parts.indexOf("skills");
12670
- if (i + 1 < parts.length && lab_skill_dirs.has(parts.slice(0, i + 2).join(path10.sep))) {
12885
+ if (i + 1 < parts.length && lab_skill_dirs.has(parts.slice(0, i + 2).join(path11.sep))) {
12671
12886
  is_lab = true;
12672
12887
  }
12673
- } else if (parts.includes("commands") && path10.extname(p) === ".md" && is_lab_artefact(p, lab_ids)) {
12888
+ } else if (parts.includes("commands") && path11.extname(p) === ".md" && is_lab_artefact(p, lab_ids)) {
12674
12889
  is_lab = true;
12675
12890
  }
12676
12891
  (is_lab ? delete_files : keep).push(p);
12677
12892
  }
12678
12893
  for (const d of lab_skill_dirs) {
12679
- fs12.rmSync(d, { recursive: true, force: true });
12894
+ fs13.rmSync(d, { recursive: true, force: true });
12680
12895
  }
12681
12896
  for (const p of delete_files) {
12682
- if (p.split(path10.sep).includes("commands") && pathExists(p)) {
12897
+ if (p.split(path11.sep).includes("commands") && pathExists(p)) {
12683
12898
  try {
12684
- fs12.unlinkSync(p);
12899
+ fs13.unlinkSync(p);
12685
12900
  } catch {
12686
12901
  }
12687
12902
  }
@@ -12818,26 +13033,26 @@ function install_global(tools, force, project_root = null, core_only = false) {
12818
13033
  }
12819
13034
  }
12820
13035
  }
12821
- if (project_root !== null && pathExists(_resolve_settings_read(project_root)) && !isDir(path10.join(project_root, ".agent-src.uncondensed"))) {
13036
+ if (project_root !== null && pathExists(_resolve_settings_read(project_root)) && !isDir(path11.join(project_root, ".agent-src.uncondensed"))) {
12822
13037
  const files_by_tool = _files_by_tool_from_deploy(deploy_results);
12823
13038
  const rc = _update_installed_tools_manifest(project_root, tools, "global", force, files_by_tool);
12824
13039
  if (rc !== 0) return rc;
12825
13040
  const marker_path = _write_consumer_bridge_marker(project_root, installed_version);
12826
13041
  if (marker_path !== null && !state.QUIET) {
12827
- const rel = isRelativeTo(marker_path, project_root) ? path10.relative(project_root, marker_path) : marker_path;
13042
+ const rel = isRelativeTo(marker_path, project_root) ? path11.relative(project_root, marker_path) : marker_path;
12828
13043
  info(`Bridge marker written: ${rel}`);
12829
13044
  }
12830
13045
  const anchor_paths = _write_per_tool_project_anchors(project_root, tools);
12831
13046
  if (anchor_paths.length > 0 && !state.QUIET) {
12832
13047
  for (const p of anchor_paths) {
12833
- const rel = isRelativeTo(p, project_root) ? path10.relative(project_root, p) : p;
13048
+ const rel = isRelativeTo(p, project_root) ? path11.relative(project_root, p) : p;
12834
13049
  info(`Project anchor written: ${rel}`);
12835
13050
  }
12836
13051
  }
12837
13052
  }
12838
13053
  if (!state.QUIET) {
12839
13054
  process3.stdout.write("\n");
12840
- success("Global install completed.");
13055
+ success(`Global install completed (v${installed_version}).`);
12841
13056
  process3.stdout.write("\n");
12842
13057
  }
12843
13058
  return 0;
@@ -13051,13 +13266,13 @@ function _minimal_templates_root() {
13051
13266
  const chain = [start];
13052
13267
  let cur = start;
13053
13268
  for (; ; ) {
13054
- const parent = path10.dirname(cur);
13269
+ const parent = path11.dirname(cur);
13055
13270
  if (parent === cur) break;
13056
13271
  chain.push(parent);
13057
13272
  cur = parent;
13058
13273
  }
13059
13274
  for (const ancestor of chain) {
13060
- const candidate = path10.join(ancestor, "src", "templates", "minimal");
13275
+ const candidate = path11.join(ancestor, "src", "templates", "minimal");
13061
13276
  if (isDir(candidate)) return candidate;
13062
13277
  }
13063
13278
  fail("Could not locate src/templates/minimal/ \u2014 package install is corrupt.");
@@ -13065,9 +13280,9 @@ function _minimal_templates_root() {
13065
13280
  var INSTALL_MODE_MARKER_REL = "agents/.agent-state/install-mode.txt";
13066
13281
  function _write_install_mode_marker(project_root, mode) {
13067
13282
  if (mode !== "minimal" && mode !== "full") return;
13068
- const marker = path10.join(project_root, INSTALL_MODE_MARKER_REL);
13283
+ const marker = path11.join(project_root, INSTALL_MODE_MARKER_REL);
13069
13284
  try {
13070
- mkdirp(path10.dirname(marker));
13285
+ mkdirp(path11.dirname(marker));
13071
13286
  writeText(marker, `${mode}
13072
13287
  `);
13073
13288
  } catch {
@@ -13076,7 +13291,7 @@ function _write_install_mode_marker(project_root, mode) {
13076
13291
  function install_minimal(target_root_in, force, user_type = "") {
13077
13292
  let target_root = resolvePath(target_root_in);
13078
13293
  mkdirp(target_root);
13079
- const parent = path10.dirname(target_root);
13294
+ const parent = path11.dirname(target_root);
13080
13295
  if (parent !== target_root) {
13081
13296
  const existing = find_project_root_with_anchor(parent);
13082
13297
  if (existing !== null && existing[0] !== target_root) {
@@ -13087,21 +13302,21 @@ function install_minimal(target_root_in, force, user_type = "") {
13087
13302
  }
13088
13303
  }
13089
13304
  const templates = _minimal_templates_root();
13090
- const settings_src = path10.join(templates, SETTINGS_FILE);
13091
- const overrides_gitkeep_src = path10.join(templates, "overrides-gitkeep");
13092
- const overrides_readme_src = path10.join(templates, "agents-overrides-readme.md");
13305
+ const settings_src = path11.join(templates, SETTINGS_FILE);
13306
+ const overrides_gitkeep_src = path11.join(templates, "overrides-gitkeep");
13307
+ const overrides_readme_src = path11.join(templates, "agents-overrides-readme.md");
13093
13308
  if (!isFile(settings_src)) fail(`Bundled minimal settings template missing under ${templates}`);
13094
13309
  if (!isFile(overrides_gitkeep_src) || !isFile(overrides_readme_src)) {
13095
13310
  fail(`Bundled overrides scaffold templates missing under ${templates}`);
13096
13311
  }
13097
13312
  info(`Minimal init \u2192 ${target_root}`);
13098
- const overrides_root = path10.join(target_root, "agents", "overrides");
13313
+ const overrides_root = path11.join(target_root, "agents", "overrides");
13099
13314
  mkdirp(overrides_root);
13100
13315
  const gitkeep_body = readText(overrides_gitkeep_src);
13101
13316
  for (const sub of ["rules", "skills", "commands"]) {
13102
- const sub_dir = path10.join(overrides_root, sub);
13317
+ const sub_dir = path11.join(overrides_root, sub);
13103
13318
  mkdirp(sub_dir);
13104
- const gitkeep_dst = path10.join(sub_dir, ".gitkeep");
13319
+ const gitkeep_dst = path11.join(sub_dir, ".gitkeep");
13105
13320
  if (pathExists(gitkeep_dst) && !force) {
13106
13321
  skip(`agents/overrides/${sub}/.gitkeep already exists (use --force to overwrite)`);
13107
13322
  } else {
@@ -13109,7 +13324,7 @@ function install_minimal(target_root_in, force, user_type = "") {
13109
13324
  success(`Wrote agents/overrides/${sub}/.gitkeep`);
13110
13325
  }
13111
13326
  }
13112
- const readme_dst = path10.join(overrides_root, "README.md");
13327
+ const readme_dst = path11.join(overrides_root, "README.md");
13113
13328
  if (pathExists(readme_dst) && !force) {
13114
13329
  skip("agents/overrides/README.md already exists (use --force to overwrite)");
13115
13330
  } else {
@@ -13127,7 +13342,7 @@ function install_minimal(target_root_in, force, user_type = "") {
13127
13342
  personal:
13128
13343
  user_type: ${user_type}
13129
13344
  `;
13130
- mkdirp(path10.dirname(settings_dst));
13345
+ mkdirp(path11.dirname(settings_dst));
13131
13346
  writeText(settings_dst, body);
13132
13347
  success(`Wrote ${SETTINGS_FILE} (user_type=${user_type})`);
13133
13348
  }
@@ -13135,7 +13350,7 @@ personal:
13135
13350
  const installed_version = current_package_version();
13136
13351
  const marker_path = _write_consumer_bridge_marker(target_root, installed_version);
13137
13352
  if (marker_path !== null) {
13138
- const rel = isRelativeTo(marker_path, target_root) ? path10.relative(target_root, marker_path) : marker_path;
13353
+ const rel = isRelativeTo(marker_path, target_root) ? path11.relative(target_root, marker_path) : marker_path;
13139
13354
  success(`Wrote ${rel}`);
13140
13355
  }
13141
13356
  _write_install_mode_marker(target_root, "minimal");
@@ -13209,7 +13424,7 @@ function run_interactive_init(project_root, force) {
13209
13424
  );
13210
13425
  return 0;
13211
13426
  }
13212
- const target = path10.join(project_root, _LOCAL_CONFIG_FILE);
13427
+ const target = path11.join(project_root, _LOCAL_CONFIG_FILE);
13213
13428
  if (pathExists(target) && !force) {
13214
13429
  warn(
13215
13430
  `${_LOCAL_CONFIG_FILE} already exists; re-run with --force to overwrite. Skipping interactive init.`
@@ -13236,7 +13451,7 @@ function run_interactive_init(project_root, force) {
13236
13451
  warn(`Could not write ${target}: ${String(exc)}`);
13237
13452
  return 1;
13238
13453
  }
13239
- success(`Wrote ${path10.relative(project_root, target)} (${user_type} / ${stack} / ${verbosity})`);
13454
+ success(`Wrote ${path11.relative(project_root, target)} (${user_type} / ${stack} / ${verbosity})`);
13240
13455
  return 0;
13241
13456
  }
13242
13457
  var _WIZARD_READY_RE = /^WIZARD_READY (http:\/\/(?:127\.0\.0\.1|localhost):\d+\/\S*)\r?$/;
@@ -13254,12 +13469,12 @@ function _wizard_should_launch(opts) {
13254
13469
  return [true, ""];
13255
13470
  }
13256
13471
  function _wizard_cli_dist(_project_root) {
13257
- const package_root = path10.dirname(path10.dirname(path10.dirname(resolvePath(_HERE2))));
13258
- const cli = path10.join(package_root, "dist", "cli", "agent-config.js");
13472
+ const package_root = path11.dirname(path11.dirname(path11.dirname(resolvePath(_HERE2))));
13473
+ const cli = path11.join(package_root, "dist", "cli", "agent-config.js");
13259
13474
  return pathExists(cli) ? cli : null;
13260
13475
  }
13261
13476
  function _server_info_path() {
13262
- return path10.join(os6.homedir(), ".event4u", "agent-config", "local-server.json");
13477
+ return path11.join(os6.homedir(), ".event4u", "agent-config", "local-server.json");
13263
13478
  }
13264
13479
  function _pid_is_agent_config(pid) {
13265
13480
  let res;
@@ -13276,7 +13491,7 @@ function _pid_is_agent_config(pid) {
13276
13491
  }
13277
13492
  function unlinkMissingOk(p) {
13278
13493
  try {
13279
- fs12.unlinkSync(p);
13494
+ fs13.unlinkSync(p);
13280
13495
  } catch {
13281
13496
  }
13282
13497
  }
@@ -13354,43 +13569,65 @@ function _wizard_spawn(project_root, pass_project_root = true) {
13354
13569
  }
13355
13570
  function _wizard_run_sync(cmd, env, cli) {
13356
13571
  const total = _WIZARD_TIMEOUTS.reduce((a, b) => a + b, 0);
13357
- let res;
13572
+ const log_path = path11.join(
13573
+ os6.tmpdir(),
13574
+ `agent-config-wizard-${process3.pid}-${Date.now()}.log`
13575
+ );
13576
+ let child;
13577
+ let log_fd = null;
13358
13578
  try {
13359
- res = spawnSync2(cmd[0], cmd.slice(1), {
13579
+ log_fd = fs13.openSync(log_path, "w");
13580
+ child = spawn(cmd[0], cmd.slice(1), {
13360
13581
  env,
13361
- encoding: "utf-8",
13362
- timeout: total * 1e3,
13363
- maxBuffer: 64 * 1024 * 1024
13582
+ detached: true,
13583
+ stdio: ["ignore", log_fd, log_fd]
13364
13584
  });
13585
+ child.on("error", () => {
13586
+ });
13587
+ child.unref();
13365
13588
  } catch (exc) {
13366
13589
  process3.stdout.write(
13367
13590
  `(Wizard failed to start: ${String(exc)}; run 'node ${cli} install --no-open' manually.)
13368
13591
  `
13369
13592
  );
13370
13593
  return 0;
13594
+ } finally {
13595
+ if (log_fd !== null) {
13596
+ try {
13597
+ fs13.closeSync(log_fd);
13598
+ } catch {
13599
+ }
13600
+ }
13371
13601
  }
13372
- if (res.error && res.error.code === "ENOENT") {
13373
- process3.stdout.write(
13374
- `(Wizard failed to start: ${String(res.error)}; run 'node ${cli} install --no-open' manually.)
13375
- `
13376
- );
13377
- return 0;
13378
- }
13379
- const stdout = res.stdout || "";
13602
+ const read_log = () => {
13603
+ try {
13604
+ return readText(log_path);
13605
+ } catch {
13606
+ return "";
13607
+ }
13608
+ };
13609
+ const deadline = Date.now() + total * 1e3;
13380
13610
  let matched_url = null;
13381
- for (const line of stdout.split("\n")) {
13382
- const m = _WIZARD_READY_RE.exec(line + "\n");
13383
- if (m) {
13384
- matched_url = m[1];
13385
- break;
13611
+ for (; ; ) {
13612
+ for (const line of read_log().split("\n")) {
13613
+ const m = _WIZARD_READY_RE.exec(line + "\n");
13614
+ if (m) {
13615
+ matched_url = m[1];
13616
+ break;
13617
+ }
13386
13618
  }
13619
+ if (matched_url !== null) break;
13620
+ const pid = child.pid;
13621
+ if (pid === void 0 || !pidAlive(pid)) break;
13622
+ if (Date.now() >= deadline) break;
13623
+ sleepMs(200);
13387
13624
  }
13388
13625
  if (matched_url === null) {
13389
- const stderrLines = (res.stderr || "").split("\n").filter((l) => l !== "");
13390
- const tail = stderrLines.length ? stderrLines.slice(-20).join("\n ") : "(no stderr captured)";
13626
+ const logLines = read_log().split("\n").filter((l) => l !== "");
13627
+ const tail = logLines.length ? logLines.slice(-20).join("\n ") : "(no output captured)";
13391
13628
  process3.stdout.write(
13392
- `(Wizard server boot timed out after ${Math.trunc(total)}s; run 'node ${cli} install --no-open' manually.)
13393
- Last stderr:
13629
+ `(Wizard server did not report ready within ${Math.trunc(total)}s; run 'node ${cli} install --no-open' manually.)
13630
+ Last output:
13394
13631
  ${tail}
13395
13632
  `
13396
13633
  );
@@ -13400,8 +13637,10 @@ function _wizard_run_sync(cmd, env, cli) {
13400
13637
  process3.stdout.write(`Setup wizard ready: ${matched_url}
13401
13638
  `);
13402
13639
  _openBrowser(matched_url);
13403
- process3.stdout.write("(Wizard runs in the background; close the tab or press Ctrl-C to stop.)\n");
13404
- return res.status ?? 0;
13640
+ process3.stdout.write(
13641
+ "(Wizard server keeps running in the background \u2014 finish the wizard in the browser tab; the next install run stops any stale server.)\n"
13642
+ );
13643
+ return 0;
13405
13644
  }
13406
13645
  function _openBrowser(url) {
13407
13646
  try {
@@ -13605,8 +13844,8 @@ function main2(argv) {
13605
13844
  const target_root = resolvePath(
13606
13845
  opts.custom_path || opts.project || process3.env["PROJECT_ROOT"] || process3.cwd()
13607
13846
  );
13608
- const minimal_package_root = path10.dirname(
13609
- path10.dirname(path10.dirname(_minimal_templates_root()))
13847
+ const minimal_package_root = path11.dirname(
13848
+ path11.dirname(path11.dirname(_minimal_templates_root()))
13610
13849
  );
13611
13850
  const validated_user_type = _validate_user_type(minimal_package_root, opts.user_type);
13612
13851
  return install_minimal(target_root, opts.force, validated_user_type);
@@ -13635,7 +13874,7 @@ function main2(argv) {
13635
13874
  return rc2;
13636
13875
  }
13637
13876
  const project_root = custom_path || resolvePath(opts.project || process3.env["PROJECT_ROOT"] || process3.cwd());
13638
- const is_first_run = !pathExists(path10.join(project_root, SETTINGS_FILE));
13877
+ const is_first_run = !pathExists(path11.join(project_root, SETTINGS_FILE));
13639
13878
  const rc = _main_project_install(opts, project_root, parsed_tools, is_first_run);
13640
13879
  if (rc === 0 && opts.interactive) {
13641
13880
  run_interactive_init(project_root, opts.force);
@@ -13686,16 +13925,16 @@ function _read_consumer_auto_switch(project_root) {
13686
13925
  return "suggest";
13687
13926
  }
13688
13927
  function finalize_claude_model_tiers(project_root) {
13689
- const claude_skills = path10.join(project_root, ".claude", "skills");
13690
- const augment_skills = path10.join(project_root, ".augment", "skills");
13928
+ const claude_skills = path11.join(project_root, ".claude", "skills");
13929
+ const augment_skills = path11.join(project_root, ".augment", "skills");
13691
13930
  if (!isDir(claude_skills) || !isDir(augment_skills)) return 0;
13692
13931
  if (_read_consumer_auto_switch(project_root) !== "auto") return 0;
13693
13932
  let rendered = 0;
13694
- const entries = fs12.readdirSync(claude_skills).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
13933
+ const entries = fs13.readdirSync(claude_skills).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
13695
13934
  for (const name of entries) {
13696
- const entry = path10.join(claude_skills, name);
13697
- const src_dir = path10.join(augment_skills, name);
13698
- const src_md = path10.join(src_dir, "SKILL.md");
13935
+ const entry = path11.join(claude_skills, name);
13936
+ const src_dir = path11.join(augment_skills, name);
13937
+ const src_md = path11.join(src_dir, "SKILL.md");
13699
13938
  let tier;
13700
13939
  try {
13701
13940
  tier = read_model_tier(src_md);
@@ -13704,22 +13943,22 @@ function finalize_claude_model_tiers(project_root) {
13704
13943
  }
13705
13944
  if (tier === null || !(tier in TIER_TO_CLAUDE_MODEL) || !isDir(src_dir)) continue;
13706
13945
  if (isSymlink(entry) || isFile(entry)) {
13707
- fs12.unlinkSync(entry);
13946
+ fs13.unlinkSync(entry);
13708
13947
  } else if (isDir(entry)) {
13709
- fs12.rmSync(entry, { recursive: true, force: true });
13948
+ fs13.rmSync(entry, { recursive: true, force: true });
13710
13949
  }
13711
13950
  mkdirp(entry);
13712
- const srcFiles = fs12.readdirSync(src_dir).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
13951
+ const srcFiles = fs13.readdirSync(src_dir).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
13713
13952
  for (const fname of srcFiles) {
13714
13953
  if (fname === "SKILL.md") {
13715
13954
  writeText(
13716
- path10.join(entry, "SKILL.md"),
13955
+ path11.join(entry, "SKILL.md"),
13717
13956
  render_native_model_md(readText(src_md), tier)
13718
13957
  );
13719
13958
  } else {
13720
- fs12.symlinkSync(
13721
- path10.join("../../../.augment/skills", name, fname),
13722
- path10.join(entry, fname)
13959
+ fs13.symlinkSync(
13960
+ path11.join("../../../.augment/skills", name, fname),
13961
+ path11.join(entry, fname)
13723
13962
  );
13724
13963
  }
13725
13964
  }
@@ -13737,7 +13976,7 @@ function _main_project_install(opts, project_root, parsed_tools, is_first_run) {
13737
13976
  let package_type;
13738
13977
  if (opts.package) {
13739
13978
  package_root = resolvePath(opts.package);
13740
- if (!pathExists(path10.join(package_root, "src", "config", "profiles", "minimal.ini"))) {
13979
+ if (!pathExists(path11.join(package_root, "src", "config", "profiles", "minimal.ini"))) {
13741
13980
  fail(`Invalid --package path (missing src/config/profiles/minimal.ini): ${package_root}`);
13742
13981
  }
13743
13982
  package_type = detect_package_type_for_project(project_root, package_root);
@@ -13865,9 +14104,9 @@ function _main_project_install(opts, project_root, parsed_tools, is_first_run) {
13865
14104
  function _resolvedArgv1() {
13866
14105
  if (process3.argv[1] === void 0) return void 0;
13867
14106
  try {
13868
- return fs12.realpathSync(path10.resolve(process3.argv[1]));
14107
+ return fs13.realpathSync(path11.resolve(process3.argv[1]));
13869
14108
  } catch {
13870
- return path10.resolve(process3.argv[1]);
14109
+ return path11.resolve(process3.argv[1]);
13871
14110
  }
13872
14111
  }
13873
14112
  var _argv1 = _resolvedArgv1();