@event4u/agent-config 14.9.0 → 14.11.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 (426) hide show
  1. package/.augment-plugin/marketplace.json +3 -3
  2. package/.augment-plugin/plugin.json +1 -1
  3. package/.claude-plugin/marketplace.json +1 -1
  4. package/CHANGELOG.md +384 -0
  5. package/README.md +1 -1
  6. package/dist/agent-src/commands/design.md +88 -0
  7. package/dist/agent-src/commands/project/analyze.md +47 -0
  8. package/dist/agent-src/commands/review/changes.md +67 -6
  9. package/dist/agent-src/commands/roadmap/create.md +49 -0
  10. package/dist/agent-src/commands/roadmap/next.md +27 -11
  11. package/dist/agent-src/commands/roadmap/process-full.md +14 -0
  12. package/dist/agent-src/commands/video/from-script.md +60 -3
  13. package/dist/agent-src/commands/video/stitch.md +14 -0
  14. package/dist/agent-src/contexts/communication/rules-auto/guidelines-mechanics.md +1 -0
  15. package/dist/agent-src/contexts/execution/roadmap-process-loop.md +154 -2
  16. package/dist/agent-src/rules/active-remediation.md +3 -3
  17. package/dist/agent-src/rules/code-provenance.md +2 -2
  18. package/dist/agent-src/rules/context-hygiene.md +13 -33
  19. package/dist/agent-src/rules/council-availability.md +2 -2
  20. package/dist/agent-src/rules/decision-revisit-gate.md +3 -1
  21. package/dist/agent-src/rules/design-fidelity.md +18 -0
  22. package/dist/agent-src/rules/design-review-after-ui-write.md +2 -2
  23. package/dist/agent-src/rules/evaluator-independence.md +56 -44
  24. package/dist/agent-src/rules/fix-what-you-see.md +9 -1
  25. package/dist/agent-src/rules/framework-neutrality-in-generic-skills.md +1 -1
  26. package/dist/agent-src/rules/minimal-safe-diff.md +14 -20
  27. package/dist/agent-src/rules/missing-skill-recovery.md +13 -1
  28. package/dist/agent-src/rules/playbook-precedence.md +105 -0
  29. package/dist/agent-src/rules/recurring-criticism.md +3 -1
  30. package/dist/agent-src/rules/roadmap-progress-sync.md +14 -13
  31. package/dist/agent-src/rules/scale-discipline.md +24 -0
  32. package/dist/agent-src/rules/security-sensitive-stop.md +2 -2
  33. package/dist/agent-src/rules/settings-ask-protocol.md +2 -2
  34. package/dist/agent-src/rules/ui-audit-gate.md +27 -15
  35. package/dist/agent-src/rules/untrusted-input-defense.md +2 -2
  36. package/dist/agent-src/skills/accessibility-auditor/SKILL.md +19 -0
  37. package/dist/agent-src/skills/adr-create/SKILL.md +7 -0
  38. package/dist/agent-src/skills/agents-md-thin-root/SKILL.md +33 -0
  39. package/dist/agent-src/skills/ai-council/references/advanced-modes.md +17 -3
  40. package/dist/agent-src/skills/ai-council/references/output-and-synthesis.md +31 -0
  41. package/dist/agent-src/skills/ai-council/references/procedure.md +19 -0
  42. package/dist/agent-src/skills/alerting-doctrine/SKILL.md +225 -0
  43. package/dist/agent-src/skills/alerting-doctrine/evals/triggers.json +17 -0
  44. package/dist/agent-src/skills/async-python-patterns/SKILL.md +1 -1
  45. package/dist/agent-src/skills/authz-review/SKILL.md +0 -1
  46. package/dist/agent-src/skills/blast-radius-analyzer/SKILL.md +32 -0
  47. package/dist/agent-src/skills/brand/SKILL.md +3 -0
  48. package/dist/agent-src/skills/brand-asset-generation/SKILL.md +3 -0
  49. package/dist/agent-src/skills/brand-audit/SKILL.md +3 -0
  50. package/dist/agent-src/skills/brand-identity/SKILL.md +3 -0
  51. package/dist/agent-src/skills/brand-strategy/SKILL.md +3 -0
  52. package/dist/agent-src/skills/brand-to-tokens/SKILL.md +3 -0
  53. package/dist/agent-src/skills/check-refs/SKILL.md +3 -0
  54. package/dist/agent-src/skills/code-refactoring/SKILL.md +1 -1
  55. package/dist/agent-src/skills/code-review/SKILL.md +11 -0
  56. package/dist/agent-src/skills/command-routing/SKILL.md +6 -0
  57. package/dist/agent-src/skills/condense-memory/SKILL.md +4 -1
  58. package/dist/agent-src/skills/context-authoring/SKILL.md +1 -1
  59. package/dist/agent-src/skills/conventional-commits-writing/SKILL.md +4 -1
  60. package/dist/agent-src/skills/copilot-agents-optimization/SKILL.md +10 -0
  61. package/dist/agent-src/skills/corpus-grounding/SKILL.md +3 -0
  62. package/dist/agent-src/skills/design-intelligence/SKILL.md +3 -0
  63. package/dist/agent-src/skills/design-intelligence/data/landing.csv +36 -35
  64. package/dist/agent-src/skills/design-intelligence/data/stacks/threejs.csv +1 -0
  65. package/dist/agent-src/skills/design-review/SKILL.md +80 -2
  66. package/dist/agent-src/skills/design-review/references/verification-automation.md +41 -0
  67. package/dist/agent-src/skills/design-system-capture/SKILL.md +35 -40
  68. package/dist/agent-src/skills/design-system-capture/references/import-procedure.md +50 -0
  69. package/dist/agent-src/skills/design-tokens/SKILL.md +3 -0
  70. package/dist/agent-src/skills/design-variations/SKILL.md +3 -0
  71. package/dist/agent-src/skills/developer-like-execution/SKILL.md +3 -0
  72. package/dist/agent-src/skills/discovery-interview/SKILL.md +1 -1
  73. package/dist/agent-src/skills/doc-coauthoring/SKILL.md +1 -1
  74. package/dist/agent-src/skills/docx-authoring/SKILL.md +1 -1
  75. package/dist/agent-src/skills/editorial-calendar/SKILL.md +1 -1
  76. package/dist/agent-src/skills/estimate-ticket/SKILL.md +3 -0
  77. package/dist/agent-src/skills/existing-ui-audit/SKILL.md +20 -3
  78. package/dist/agent-src/skills/fe-design/SKILL.md +74 -41
  79. package/dist/agent-src/skills/fe-design/evals/triggers.json +65 -53
  80. package/dist/agent-src/skills/fe-design/references/craft-floor.md +52 -0
  81. package/dist/agent-src/skills/fe-design/references/source-led-port.md +36 -0
  82. package/dist/agent-src/skills/file-editor/SKILL.md +5 -0
  83. package/dist/agent-src/skills/finishing-a-development-branch/SKILL.md +2 -2
  84. package/dist/agent-src/skills/git-workflow/SKILL.md +3 -0
  85. package/dist/agent-src/skills/github-ci/SKILL.md +1 -1
  86. package/dist/agent-src/skills/html-deck/SKILL.md +3 -0
  87. package/dist/agent-src/skills/iconography/SKILL.md +3 -0
  88. package/dist/agent-src/skills/image-editing/SKILL.md +3 -0
  89. package/dist/agent-src/skills/image-generation/SKILL.md +3 -0
  90. package/dist/agent-src/skills/image-provider-routing/SKILL.md +3 -0
  91. package/dist/agent-src/skills/incident-commander/SKILL.md +10 -0
  92. package/dist/agent-src/skills/js-library-packaging/SKILL.md +173 -0
  93. package/dist/agent-src/skills/js-library-packaging/evals/triggers.json +17 -0
  94. package/dist/agent-src/skills/js-library-packaging/scripts/check_package_surface.ts +270 -0
  95. package/dist/agent-src/skills/judge-artifact-completeness/SKILL.md +1 -1
  96. package/dist/agent-src/skills/judge-injection-defense/SKILL.md +1 -1
  97. package/dist/agent-src/skills/laravel-migration/SKILL.md +3 -0
  98. package/dist/agent-src/skills/laravel-validation/SKILL.md +1 -1
  99. package/dist/agent-src/skills/learning-to-rule-or-skill/SKILL.md +3 -0
  100. package/dist/agent-src/skills/legal-intake-triage/SKILL.md +1 -1
  101. package/dist/agent-src/skills/legal-practice-profile/SKILL.md +1 -1
  102. package/dist/agent-src/skills/lint-skills/SKILL.md +3 -0
  103. package/dist/agent-src/skills/llm-provider-knowledge/SKILL.md +3 -0
  104. package/dist/agent-src/skills/logging-monitoring/SKILL.md +234 -51
  105. package/dist/agent-src/skills/logo-generation/SKILL.md +3 -0
  106. package/dist/agent-src/skills/md-language-check/SKILL.md +3 -0
  107. package/dist/agent-src/skills/messaging-architecture/SKILL.md +1 -1
  108. package/dist/agent-src/skills/migration-architect/SKILL.md +1 -1
  109. package/dist/agent-src/skills/module-detect-on-the-fly/SKILL.md +1 -1
  110. package/dist/agent-src/skills/module-management/SKILL.md +1 -1
  111. package/dist/agent-src/skills/monorepo-workspace/SKILL.md +149 -0
  112. package/dist/agent-src/skills/monorepo-workspace/evals/triggers.json +17 -0
  113. package/dist/agent-src/skills/motion-choreographer/SKILL.md +7 -1
  114. package/dist/agent-src/skills/multi-tenancy/SKILL.md +4 -0
  115. package/dist/agent-src/skills/onboarding-program/SKILL.md +1 -1
  116. package/dist/agent-src/skills/operational-readiness/SKILL.md +184 -0
  117. package/dist/agent-src/skills/operational-readiness/evals/triggers.json +17 -0
  118. package/dist/agent-src/skills/override-management/SKILL.md +3 -0
  119. package/dist/agent-src/skills/perf-feedback-craft/SKILL.md +1 -1
  120. package/dist/agent-src/skills/persona-improvement/SKILL.md +3 -0
  121. package/dist/agent-src/skills/pest-testing/SKILL.md +3 -0
  122. package/dist/agent-src/skills/playbook-authoring/SKILL.md +162 -0
  123. package/dist/agent-src/skills/playwright-testing/SKILL.md +3 -0
  124. package/dist/agent-src/skills/privacy-review/SKILL.md +3 -0
  125. package/dist/agent-src/skills/prompt-engineering-image/SKILL.md +3 -0
  126. package/dist/agent-src/skills/prompt-optimizer/SKILL.md +1 -1
  127. package/dist/agent-src/skills/quality-tools/SKILL.md +5 -0
  128. package/dist/agent-src/skills/react-shadcn-ui/SKILL.md +52 -21
  129. package/dist/agent-src/skills/readme-reviewer/SKILL.md +3 -0
  130. package/dist/agent-src/skills/readme-writing/SKILL.md +3 -0
  131. package/dist/agent-src/skills/readme-writing-package/SKILL.md +3 -0
  132. package/dist/agent-src/skills/receiving-code-review/SKILL.md +3 -3
  133. package/dist/agent-src/skills/refine-prompt/SKILL.md +3 -0
  134. package/dist/agent-src/skills/refine-ticket/SKILL.md +3 -0
  135. package/dist/agent-src/skills/requesting-code-review/SKILL.md +2 -2
  136. package/dist/agent-src/skills/review-routing/SKILL.md +2 -2
  137. package/dist/agent-src/skills/roadmap-writing/SKILL.md +23 -41
  138. package/dist/agent-src/skills/roadmap-writing/references/follow-up-roadmap-shape.md +47 -0
  139. package/dist/agent-src/skills/rtk-output-filtering/SKILL.md +22 -6
  140. package/dist/agent-src/skills/runway-cognition/SKILL.md +3 -0
  141. package/dist/agent-src/skills/scene-expander/SKILL.md +1 -1
  142. package/dist/agent-src/skills/scene-expander/scene-blueprint.schema.yaml +26 -0
  143. package/dist/agent-src/skills/secrets-management/SKILL.md +5 -1
  144. package/dist/agent-src/skills/server-hardening/SKILL.md +159 -0
  145. package/dist/agent-src/skills/server-hardening/evals/triggers.json +17 -0
  146. package/dist/agent-src/skills/skill-improvement-pipeline/SKILL.md +3 -0
  147. package/dist/agent-src/skills/skill-management/SKILL.md +3 -0
  148. package/dist/agent-src/skills/skill-reviewer/SKILL.md +3 -0
  149. package/dist/agent-src/skills/skill-writing/SKILL.md +6 -0
  150. package/dist/agent-src/skills/spreadsheet-authoring/SKILL.md +3 -0
  151. package/dist/agent-src/skills/storybook-workshop/SKILL.md +194 -0
  152. package/dist/agent-src/skills/storybook-workshop/evals/triggers.json +17 -0
  153. package/dist/agent-src/skills/storybook-workshop/scripts/story_contrast_floor.ts +134 -0
  154. package/dist/agent-src/skills/subagent-orchestration/SKILL.md +1 -1
  155. package/dist/agent-src/skills/subagent-orchestration/prompts/README.md +25 -0
  156. package/dist/agent-src/skills/supply-chain-intake/SKILL.md +12 -0
  157. package/dist/agent-src/skills/systematic-debugging/SKILL.md +1 -1
  158. package/dist/agent-src/skills/terraform/SKILL.md +3 -0
  159. package/dist/agent-src/skills/test-driven-development/SKILL.md +1 -1
  160. package/dist/agent-src/skills/threat-modeling/SKILL.md +0 -3
  161. package/dist/agent-src/skills/token-optimizer/SKILL.md +3 -0
  162. package/dist/agent-src/skills/typography-system/SKILL.md +3 -0
  163. package/dist/agent-src/skills/ui-component-architect/SKILL.md +9 -1
  164. package/dist/agent-src/skills/upstream-contribute/SKILL.md +3 -0
  165. package/dist/agent-src/skills/using-git-worktrees/SKILL.md +1 -1
  166. package/dist/agent-src/skills/validate-feature-fit/SKILL.md +3 -0
  167. package/dist/agent-src/skills/verify-completion-evidence/SKILL.md +2 -2
  168. package/dist/agent-src/skills/wireframe/SKILL.md +3 -0
  169. package/dist/agent-src/skills/wireframe/references/story-beat-ledger.schema.json +115 -0
  170. package/dist/agent-src/skills/workspace-link/SKILL.md +131 -0
  171. package/dist/agent-src/skills/workspace-link/evals/triggers.json +17 -0
  172. package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
  173. package/dist/agent-src/templates/playbook.md +75 -0
  174. package/dist/agent-src/templates/roadmaps.md +37 -0
  175. package/dist/agent-src/templates/scripts/check_playbook_invokes.ts +231 -0
  176. package/dist/agent-src/templates/scripts/work_engine/directives/ui/apply.ts +24 -0
  177. package/dist/agent-src/templates/scripts/work_engine/directives/ui/polish.ts +2 -0
  178. package/dist/agent-src/templates/scripts/work_engine/directives/ui/review.ts +216 -0
  179. package/dist/agent-src/templates/scripts/work_engine/directives/ui/scaffold.ts +159 -0
  180. package/dist/agent-src/templates/scripts/work_engine/directives/ui/stack_bundles.ts +73 -4
  181. package/dist/agent-src/templates/scripts/work_engine/stack/detect.ts +325 -40
  182. package/dist/cli/commands/uiAudit.js +221 -0
  183. package/dist/cli/commands/uiAudit.js.map +1 -0
  184. package/dist/cli/commands/uiRender.js +206 -0
  185. package/dist/cli/commands/uiRender.js.map +1 -0
  186. package/dist/cli/main.js +22 -1
  187. package/dist/cli/main.js.map +1 -1
  188. package/dist/cli/mcp/content.js +64 -1
  189. package/dist/cli/mcp/content.js.map +1 -1
  190. package/dist/cli/mcp/dispatch.js +175 -10
  191. package/dist/cli/mcp/dispatch.js.map +1 -1
  192. package/dist/cli/registry.js +3 -0
  193. package/dist/cli/registry.js.map +1 -1
  194. package/dist/cli-delegate/{chunk-H4VIVD4C.js → chunk-236PNQZK.js} +413 -391
  195. package/dist/cli-delegate/{chunk-G23AT6GD.js → chunk-DMSZHXZS.js} +57 -1
  196. package/dist/cli-delegate/{chunk-77GR3VD4.js → chunk-FF7WAFMR.js} +58 -3
  197. package/dist/cli-delegate/{chunk-PLSG6UL5.js → chunk-K4FFODTS.js} +341 -204
  198. package/dist/cli-delegate/{chunk-YM4GZDJG.js → chunk-L43NCYPB.js} +5 -0
  199. package/dist/cli-delegate/{chunk-B2ERU2VA.js → chunk-WOKWX5PL.js} +1 -1
  200. package/dist/cli-delegate/cmd_brand_status.js +8 -6
  201. package/dist/cli-delegate/cmd_conformance.js +3 -3
  202. package/dist/cli-delegate/cmd_doctor.js +3 -3
  203. package/dist/cli-delegate/cmd_export.js +4 -4
  204. package/dist/cli-delegate/cmd_handoff.js +1 -1
  205. package/dist/cli-delegate/cmd_preflight.js +2 -2
  206. package/dist/cli-delegate/cmd_prune.js +4 -4
  207. package/dist/cli-delegate/cmd_session_recycle.js +70 -9
  208. package/dist/cli-delegate/cmd_settings_migrate.js +4 -4
  209. package/dist/cli-delegate/cmd_settings_set.js +1 -1
  210. package/dist/cli-delegate/cmd_sync.js +4 -4
  211. package/dist/cli-delegate/cmd_uninstall.js +4 -4
  212. package/dist/cli-delegate/cmd_validate.js +4 -4
  213. package/dist/discovery/deprecation-report.md +1 -1
  214. package/dist/discovery/discovery-manifest.json +380 -145
  215. package/dist/discovery/discovery-manifest.json.sha256 +1 -1
  216. package/dist/discovery/discovery-manifest.summary.md +4 -4
  217. package/dist/discovery/dormancy-report.md +1 -1
  218. package/dist/discovery/orphan-report.md +1 -1
  219. package/dist/discovery/packs.json +18 -8
  220. package/dist/discovery/trust-report.md +3 -3
  221. package/dist/discovery/workspaces.json +16 -6
  222. package/dist/hooks/dispatch.js +2337 -1436
  223. package/dist/install/install.mjs +795 -708
  224. package/dist/mcp/registry-manifest.json +3 -3
  225. package/dist/mcp/server.json +2 -2
  226. package/dist/mcp/server.mjs +1685 -1250
  227. package/dist/router.json +1 -1
  228. package/dist/scripts/_lib/lean_projection_mode.js +40 -0
  229. package/dist/scripts/_lib/lean_projection_mode.js.map +1 -0
  230. package/dist/scripts/_lib/scoped_projection.js +84 -0
  231. package/dist/scripts/_lib/scoped_projection.js.map +1 -1
  232. package/dist/scripts/_lib/ui_surface.js +89 -0
  233. package/dist/scripts/_lib/ui_surface.js.map +1 -0
  234. package/dist/scripts/condense.js +6 -10
  235. package/dist/scripts/condense.js.map +1 -1
  236. package/dist/scripts/project_thin_rules.js +40 -2
  237. package/dist/scripts/project_thin_rules.js.map +1 -1
  238. package/dist/server/schemas/settings.js +3 -0
  239. package/dist/server/schemas/settings.js.map +1 -1
  240. package/dist/shared/skillRanking.js +159 -0
  241. package/dist/shared/skillRanking.js.map +1 -0
  242. package/docs/contracts/provider-lifecycle.md +47 -18
  243. package/docs/contracts/settings-classes.md +14 -4
  244. package/docs/guidelines/agent-infra/context-hygiene-mechanics.md +49 -0
  245. package/docs/guidelines/agent-infra/evaluator-independence-mechanics.md +92 -0
  246. package/docs/guidelines/agent-infra/minimal-safe-diff-mechanics.md +45 -1
  247. package/docs/guidelines/agent-infra/roadmap-deferred-resolution-provenance.md +54 -0
  248. package/docs/guidelines/design-antipatterns.md +4 -2
  249. package/docs/guidelines/design-asset-discipline.md +38 -0
  250. package/docs/guidelines/design-fidelity-mechanics.md +45 -29
  251. package/docs/guidelines/design-handover-extraction.md +35 -5
  252. package/docs/guidelines/design-modes.md +41 -1
  253. package/docs/guidelines/monorepo-antipatterns.md +141 -0
  254. package/llms.txt +50 -39
  255. package/package.json +1 -1
  256. package/src/agent-src/templates/scripts/check_playbook_invokes.ts +231 -0
  257. package/src/agent-src/templates/scripts/work_engine/directives/ui/apply.ts +24 -0
  258. package/src/agent-src/templates/scripts/work_engine/directives/ui/polish.ts +2 -0
  259. package/src/agent-src/templates/scripts/work_engine/directives/ui/review.ts +216 -0
  260. package/src/agent-src/templates/scripts/work_engine/directives/ui/scaffold.ts +159 -0
  261. package/src/agent-src/templates/scripts/work_engine/directives/ui/stack_bundles.ts +73 -4
  262. package/src/agent-src/templates/scripts/work_engine/stack/detect.ts +325 -40
  263. package/src/config/agent-settings.template.yml +28 -0
  264. package/src/config/assurance-capability-registry.json +223 -0
  265. package/src/config/assurance-threshold-budget.json +65 -0
  266. package/src/config/ci-local-parity.yml +14 -0
  267. package/src/config/discovery/unassigned-artefacts.yml +2 -0
  268. package/src/config/dispatch-economy-metrics.json +4 -2
  269. package/src/config/evaluator-budgets.json +14 -14
  270. package/src/config/gate-coverage.yml +227 -8
  271. package/src/config/gate-violation-baselines.json +76 -72
  272. package/src/config/hook-latency-budget.json +1 -0
  273. package/src/config/hook-token-budget.json +137 -125
  274. package/src/config/pack-size-budget.json +4 -2
  275. package/src/config/preamble-payload-budget.json +71 -67
  276. package/src/config/quorum-attendance-budget.json +12 -4
  277. package/src/config/rule-activation-census.json +7 -3
  278. package/src/config/rule-enforcement-baseline.json +0 -1
  279. package/src/config/rule-stub-ceilings.json +112 -91
  280. package/src/scripts/_cli/cmd_doctor.ts +15 -16
  281. package/src/scripts/_cli/doctor_install_mode.ts +49 -0
  282. package/src/scripts/_cli/doctor_overrides.ts +154 -0
  283. package/src/scripts/_dispatch.bash +17 -0
  284. package/src/scripts/_lib/as_of.ts +412 -0
  285. package/src/scripts/_lib/exec_evidence.ts +7 -0
  286. package/src/scripts/_lib/hook_settings.ts +33 -0
  287. package/src/scripts/_lib/host_listing_model.ts +192 -0
  288. package/src/scripts/_lib/lean_projection_mode.ts +44 -0
  289. package/src/scripts/_lib/mcp_bridge.ts +199 -0
  290. package/src/scripts/_lib/review_independence.ts +62 -10
  291. package/src/scripts/_lib/rule_injection.ts +239 -0
  292. package/src/scripts/_lib/run_checkpoint.ts +54 -1
  293. package/src/scripts/_lib/scoped_projection.ts +96 -0
  294. package/src/scripts/_lib/session_register.ts +44 -2
  295. package/src/scripts/_lib/skill_catalogue.ts +38 -2
  296. package/src/scripts/_lib/transcript_reads.ts +207 -0
  297. package/src/scripts/_lib/ui_authority.test.ts +251 -0
  298. package/src/scripts/_lib/ui_authority.ts +343 -0
  299. package/src/scripts/ai-video/adapters/fal.sh +8 -3
  300. package/src/scripts/ai-video/adapters/gemini-veo.sh +10 -0
  301. package/src/scripts/ai-video/adapters/higgsfield.sh +10 -2
  302. package/src/scripts/ai-video/adapters/kling.sh +10 -0
  303. package/src/scripts/ai-video/adapters/sora.sh +10 -0
  304. package/src/scripts/ai-video/lib/calibrate-cost.sh +145 -0
  305. package/src/scripts/ai-video/lib/model-capabilities/README.md +53 -7
  306. package/src/scripts/ai-video/lib/model-capabilities/comfyui.json +15 -3
  307. package/src/scripts/ai-video/lib/model-capabilities/fal.json +36 -6
  308. package/src/scripts/ai-video/lib/model-capabilities/gemini-veo.json +23 -0
  309. package/src/scripts/ai-video/lib/model-capabilities/higgsfield.json +23 -0
  310. package/src/scripts/ai-video/lib/model-capabilities/kling.json +23 -0
  311. package/src/scripts/ai-video/lib/model-capabilities/musetalk.json +8 -2
  312. package/src/scripts/ai-video/lib/model-capabilities/replicate.json +36 -6
  313. package/src/scripts/ai-video/lib/model-capabilities/sora.json +45 -0
  314. package/src/scripts/ai-video/lib/model-capabilities/syncso.json +8 -2
  315. package/src/scripts/ai-video/lib/parse-blueprint.sh +52 -5
  316. package/src/scripts/ai-video/lib/resume-scan.sh +92 -3
  317. package/src/scripts/ai-video/lib/seam-plan.sh +212 -0
  318. package/src/scripts/ai-video/smoke-trace.sh +450 -2
  319. package/src/scripts/ai-video/stitch.sh +191 -10
  320. package/src/scripts/ai-video/test-pipeline.sh +84 -6
  321. package/src/scripts/ai_council/cli_agency_bounds.ts +139 -0
  322. package/src/scripts/ai_council/cli_least_agency_canary.ts +347 -0
  323. package/src/scripts/ai_council/clients.ts +3 -2
  324. package/src/scripts/ai_council/consensus.ts +63 -6
  325. package/src/scripts/ai_council/events_log.ts +46 -1
  326. package/src/scripts/ai_council/orchestrator.ts +103 -108
  327. package/src/scripts/ai_council/orchestrator_results.ts +166 -0
  328. package/src/scripts/ai_council/prompts.ts +12 -5
  329. package/src/scripts/ai_council/quorum.ts +82 -1
  330. package/src/scripts/ai_council/quorum_wiring.ts +82 -5
  331. package/src/scripts/ai_council/seating.ts +211 -0
  332. package/src/scripts/ai_council/stance_tally.ts +22 -0
  333. package/src/scripts/bench_hook_latency.ts +62 -0
  334. package/src/scripts/build_proof.ts +12 -1
  335. package/src/scripts/capture_skill_catalogue.ts +21 -0
  336. package/src/scripts/check_always_budget.ts +2 -1
  337. package/src/scripts/check_augmentignore.ts +2 -1
  338. package/src/scripts/check_beta_review_markers.ts +2 -1
  339. package/src/scripts/check_composite_arming.ts +364 -0
  340. package/src/scripts/check_corpus_staleness.ts +2 -1
  341. package/src/scripts/check_council_pin_staleness.ts +3 -1
  342. package/src/scripts/check_enforcement_coverage.ts +116 -3
  343. package/src/scripts/check_enforcement_denominator.ts +365 -0
  344. package/src/scripts/check_gate_coverage.ts +2 -1
  345. package/src/scripts/check_hook_bundle_freshness.ts +13 -1
  346. package/src/scripts/check_knowledge_cards.ts +2 -1
  347. package/src/scripts/check_knowledge_pages.ts +3 -2
  348. package/src/scripts/check_memory.ts +2 -1
  349. package/src/scripts/check_no_automerge_key.ts +287 -0
  350. package/src/scripts/check_pack_conformance_fixture.ts +565 -0
  351. package/src/scripts/check_pack_passport_reconciliation.ts +274 -0
  352. package/src/scripts/check_proposal.ts +2 -1
  353. package/src/scripts/check_reach_staleness.ts +2 -1
  354. package/src/scripts/check_release_adjacent_health.ts +2 -1
  355. package/src/scripts/check_release_pr_shape.ts +5 -0
  356. package/src/scripts/check_review_schema.ts +34 -1
  357. package/src/scripts/check_roadmap_trackable.ts +48 -3
  358. package/src/scripts/check_source_size_budget.ts +2 -1
  359. package/src/scripts/check_standing_payload_delta.ts +505 -0
  360. package/src/scripts/check_trigger_evals.ts +2 -1
  361. package/src/scripts/classify_change_risk.ts +281 -0
  362. package/src/scripts/compute_skill_tiers.ts +186 -0
  363. package/src/scripts/condense.ts +8 -13
  364. package/src/scripts/council_attendance_metrics.ts +183 -0
  365. package/src/scripts/council_cli.ts +10 -8
  366. package/src/scripts/council_parse_rate.ts +116 -0
  367. package/src/scripts/derive_playbooks.ts +406 -0
  368. package/src/scripts/design_slop_rules.test.ts +7 -0
  369. package/src/scripts/design_slop_rules.ts +56 -2
  370. package/src/scripts/dispatch_r2_reviewer.ts +16 -0
  371. package/src/scripts/frontend_corpus_hash.ts +116 -0
  372. package/src/scripts/generate_pack_manifests.ts +78 -0
  373. package/src/scripts/grade_target_readiness.ts +478 -0
  374. package/src/scripts/hook_manifest.json +1 -1
  375. package/src/scripts/hook_manifest.yaml +97 -16
  376. package/src/scripts/hooks/concern_registry.ts +4 -0
  377. package/src/scripts/hooks/design_pass_hook.ts +356 -0
  378. package/src/scripts/hooks/rtk_wrap_hook.ts +30 -7
  379. package/src/scripts/hooks/rule_inject_hook.ts +318 -0
  380. package/src/scripts/hot_context_hook.ts +74 -7
  381. package/src/scripts/install.ts +40 -89
  382. package/src/scripts/lint_adapter_tier.ts +663 -0
  383. package/src/scripts/lint_archived_skills.ts +93 -0
  384. package/src/scripts/lint_budget_ownership.ts +2 -1
  385. package/src/scripts/lint_deterministic_time.ts +470 -0
  386. package/src/scripts/lint_framework_leakage.ts +5 -0
  387. package/src/scripts/lint_handoffs.ts +525 -1
  388. package/src/scripts/lint_judge_prompt_expectation.ts +155 -0
  389. package/src/scripts/lint_marketplace.ts +88 -0
  390. package/src/scripts/lint_media_policy_linkage.ts +140 -1
  391. package/src/scripts/lint_one_off_age.ts +6 -1
  392. package/src/scripts/lint_override_kernel_guard.ts +87 -5
  393. package/src/scripts/lint_roadmap_complexity.ts +56 -0
  394. package/src/scripts/lint_rule_enforcement_declaration.ts +24 -7
  395. package/src/scripts/lint_rule_norm_pin.ts +321 -0
  396. package/src/scripts/lint_spawn_payload.ts +42 -5
  397. package/src/scripts/lint_symptom_intake.ts +2 -1
  398. package/src/scripts/mcp_parity_smoke.ts +30 -4
  399. package/src/scripts/mcp_render.ts +66 -1
  400. package/src/scripts/mcp_tool_fingerprint.ts +241 -0
  401. package/src/scripts/measure_risk_class_drift.ts +140 -0
  402. package/src/scripts/measure_skill_ranker_baseline.ts +212 -0
  403. package/src/scripts/media/lib/adapter-common.sh +211 -1
  404. package/src/scripts/media/lib/adapter-contract.md +74 -6
  405. package/src/scripts/model_rule_injection.ts +907 -0
  406. package/src/scripts/project_thin_rules.ts +45 -2
  407. package/src/scripts/release.ts +66 -860
  408. package/src/scripts/release_drill.ts +59 -3
  409. package/src/scripts/release_env.ts +298 -0
  410. package/src/scripts/release_publication.ts +720 -0
  411. package/src/scripts/roadmap_context.ts +778 -0
  412. package/src/scripts/schemas/fidelity-measurement-sheet.schema.json +169 -0
  413. package/src/scripts/schemas/pack.schema.json +62 -4
  414. package/src/scripts/schemas/rule.schema.json +24 -2
  415. package/src/scripts/schemas/skill.schema.json +41 -2
  416. package/src/scripts/schemas/ui-authority.schema.json +114 -0
  417. package/src/scripts/session_register_hook.ts +29 -3
  418. package/src/scripts/sessions_cli.ts +67 -3
  419. package/src/scripts/skill_tools/score_skill_relevance.ts +36 -53
  420. package/src/scripts/tighten_skill_descriptions.ts +264 -0
  421. package/src/scripts/token_sink_report.ts +239 -0
  422. package/src/scripts/trigger_coverage.ts +122 -3
  423. package/src/scripts/update_counts.ts +7 -3
  424. package/src/scripts/validate_frontmatter.ts +66 -0
  425. package/src/server/schemas/settings.ts +5 -0
  426. package/src/shared/skillRanking.ts +183 -0
@@ -117,17 +117,17 @@ var require_visit = __commonJS({
117
117
  visit.BREAK = BREAK;
118
118
  visit.SKIP = SKIP;
119
119
  visit.REMOVE = REMOVE;
120
- function visit_(key, node, visitor, path19) {
121
- const ctrl = callVisitor(key, node, visitor, path19);
120
+ function visit_(key, node, visitor, path20) {
121
+ const ctrl = callVisitor(key, node, visitor, path20);
122
122
  if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
123
- replaceNode(key, path19, ctrl);
124
- return visit_(key, ctrl, visitor, path19);
123
+ replaceNode(key, path20, ctrl);
124
+ return visit_(key, ctrl, visitor, path20);
125
125
  }
126
126
  if (typeof ctrl !== "symbol") {
127
127
  if (identity.isCollection(node)) {
128
- path19 = Object.freeze(path19.concat(node));
128
+ path20 = Object.freeze(path20.concat(node));
129
129
  for (let i = 0; i < node.items.length; ++i) {
130
- const ci = visit_(i, node.items[i], visitor, path19);
130
+ const ci = visit_(i, node.items[i], visitor, path20);
131
131
  if (typeof ci === "number")
132
132
  i = ci - 1;
133
133
  else if (ci === BREAK)
@@ -138,13 +138,13 @@ var require_visit = __commonJS({
138
138
  }
139
139
  }
140
140
  } else if (identity.isPair(node)) {
141
- path19 = Object.freeze(path19.concat(node));
142
- const ck = visit_("key", node.key, visitor, path19);
141
+ path20 = Object.freeze(path20.concat(node));
142
+ const ck = visit_("key", node.key, visitor, path20);
143
143
  if (ck === BREAK)
144
144
  return BREAK;
145
145
  else if (ck === REMOVE)
146
146
  node.key = null;
147
- const cv = visit_("value", node.value, visitor, path19);
147
+ const cv = visit_("value", node.value, visitor, path20);
148
148
  if (cv === BREAK)
149
149
  return BREAK;
150
150
  else if (cv === REMOVE)
@@ -165,17 +165,17 @@ var require_visit = __commonJS({
165
165
  visitAsync.BREAK = BREAK;
166
166
  visitAsync.SKIP = SKIP;
167
167
  visitAsync.REMOVE = REMOVE;
168
- async function visitAsync_(key, node, visitor, path19) {
169
- const ctrl = await callVisitor(key, node, visitor, path19);
168
+ async function visitAsync_(key, node, visitor, path20) {
169
+ const ctrl = await callVisitor(key, node, visitor, path20);
170
170
  if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
171
- replaceNode(key, path19, ctrl);
172
- return visitAsync_(key, ctrl, visitor, path19);
171
+ replaceNode(key, path20, ctrl);
172
+ return visitAsync_(key, ctrl, visitor, path20);
173
173
  }
174
174
  if (typeof ctrl !== "symbol") {
175
175
  if (identity.isCollection(node)) {
176
- path19 = Object.freeze(path19.concat(node));
176
+ path20 = Object.freeze(path20.concat(node));
177
177
  for (let i = 0; i < node.items.length; ++i) {
178
- const ci = await visitAsync_(i, node.items[i], visitor, path19);
178
+ const ci = await visitAsync_(i, node.items[i], visitor, path20);
179
179
  if (typeof ci === "number")
180
180
  i = ci - 1;
181
181
  else if (ci === BREAK)
@@ -186,13 +186,13 @@ var require_visit = __commonJS({
186
186
  }
187
187
  }
188
188
  } else if (identity.isPair(node)) {
189
- path19 = Object.freeze(path19.concat(node));
190
- const ck = await visitAsync_("key", node.key, visitor, path19);
189
+ path20 = Object.freeze(path20.concat(node));
190
+ const ck = await visitAsync_("key", node.key, visitor, path20);
191
191
  if (ck === BREAK)
192
192
  return BREAK;
193
193
  else if (ck === REMOVE)
194
194
  node.key = null;
195
- const cv = await visitAsync_("value", node.value, visitor, path19);
195
+ const cv = await visitAsync_("value", node.value, visitor, path20);
196
196
  if (cv === BREAK)
197
197
  return BREAK;
198
198
  else if (cv === REMOVE)
@@ -219,23 +219,23 @@ var require_visit = __commonJS({
219
219
  }
220
220
  return visitor;
221
221
  }
222
- function callVisitor(key, node, visitor, path19) {
222
+ function callVisitor(key, node, visitor, path20) {
223
223
  if (typeof visitor === "function")
224
- return visitor(key, node, path19);
224
+ return visitor(key, node, path20);
225
225
  if (identity.isMap(node))
226
- return visitor.Map?.(key, node, path19);
226
+ return visitor.Map?.(key, node, path20);
227
227
  if (identity.isSeq(node))
228
- return visitor.Seq?.(key, node, path19);
228
+ return visitor.Seq?.(key, node, path20);
229
229
  if (identity.isPair(node))
230
- return visitor.Pair?.(key, node, path19);
230
+ return visitor.Pair?.(key, node, path20);
231
231
  if (identity.isScalar(node))
232
- return visitor.Scalar?.(key, node, path19);
232
+ return visitor.Scalar?.(key, node, path20);
233
233
  if (identity.isAlias(node))
234
- return visitor.Alias?.(key, node, path19);
234
+ return visitor.Alias?.(key, node, path20);
235
235
  return void 0;
236
236
  }
237
- function replaceNode(key, path19, node) {
238
- const parent = path19[path19.length - 1];
237
+ function replaceNode(key, path20, node) {
238
+ const parent = path20[path20.length - 1];
239
239
  if (identity.isCollection(parent)) {
240
240
  parent.items[key] = node;
241
241
  } else if (identity.isPair(parent)) {
@@ -845,10 +845,10 @@ var require_Collection = __commonJS({
845
845
  var createNode = require_createNode();
846
846
  var identity = require_identity();
847
847
  var Node = require_Node();
848
- function collectionFromPath(schema, path19, value) {
848
+ function collectionFromPath(schema, path20, value) {
849
849
  let v = value;
850
- for (let i = path19.length - 1; i >= 0; --i) {
851
- const k = path19[i];
850
+ for (let i = path20.length - 1; i >= 0; --i) {
851
+ const k = path20[i];
852
852
  if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
853
853
  const a = [];
854
854
  a[k] = v;
@@ -867,7 +867,7 @@ var require_Collection = __commonJS({
867
867
  sourceObjects: /* @__PURE__ */ new Map()
868
868
  });
869
869
  }
870
- var isEmptyPath = (path19) => path19 == null || typeof path19 === "object" && !!path19[Symbol.iterator]().next().done;
870
+ var isEmptyPath = (path20) => path20 == null || typeof path20 === "object" && !!path20[Symbol.iterator]().next().done;
871
871
  var Collection = class extends Node.NodeBase {
872
872
  constructor(type, schema) {
873
873
  super(type);
@@ -897,11 +897,11 @@ var require_Collection = __commonJS({
897
897
  * be a Pair instance or a `{ key, value }` object, which may not have a key
898
898
  * that already exists in the map.
899
899
  */
900
- addIn(path19, value) {
901
- if (isEmptyPath(path19))
900
+ addIn(path20, value) {
901
+ if (isEmptyPath(path20))
902
902
  this.add(value);
903
903
  else {
904
- const [key, ...rest] = path19;
904
+ const [key, ...rest] = path20;
905
905
  const node = this.get(key, true);
906
906
  if (identity.isCollection(node))
907
907
  node.addIn(rest, value);
@@ -915,8 +915,8 @@ var require_Collection = __commonJS({
915
915
  * Removes a value from the collection.
916
916
  * @returns `true` if the item was found and removed.
917
917
  */
918
- deleteIn(path19) {
919
- const [key, ...rest] = path19;
918
+ deleteIn(path20) {
919
+ const [key, ...rest] = path20;
920
920
  if (rest.length === 0)
921
921
  return this.delete(key);
922
922
  const node = this.get(key, true);
@@ -930,8 +930,8 @@ var require_Collection = __commonJS({
930
930
  * scalar values from their surrounding node; to disable set `keepScalar` to
931
931
  * `true` (collections are always returned intact).
932
932
  */
933
- getIn(path19, keepScalar) {
934
- const [key, ...rest] = path19;
933
+ getIn(path20, keepScalar) {
934
+ const [key, ...rest] = path20;
935
935
  const node = this.get(key, true);
936
936
  if (rest.length === 0)
937
937
  return !keepScalar && identity.isScalar(node) ? node.value : node;
@@ -949,8 +949,8 @@ var require_Collection = __commonJS({
949
949
  /**
950
950
  * Checks if the collection includes a value with the key `key`.
951
951
  */
952
- hasIn(path19) {
953
- const [key, ...rest] = path19;
952
+ hasIn(path20) {
953
+ const [key, ...rest] = path20;
954
954
  if (rest.length === 0)
955
955
  return this.has(key);
956
956
  const node = this.get(key, true);
@@ -960,8 +960,8 @@ var require_Collection = __commonJS({
960
960
  * Sets a value in this collection. For `!!set`, `value` needs to be a
961
961
  * boolean to add/remove the item from the set.
962
962
  */
963
- setIn(path19, value) {
964
- const [key, ...rest] = path19;
963
+ setIn(path20, value) {
964
+ const [key, ...rest] = path20;
965
965
  if (rest.length === 0) {
966
966
  this.set(key, value);
967
967
  } else {
@@ -3476,9 +3476,9 @@ var require_Document = __commonJS({
3476
3476
  this.contents.add(value);
3477
3477
  }
3478
3478
  /** Adds a value to the document. */
3479
- addIn(path19, value) {
3479
+ addIn(path20, value) {
3480
3480
  if (assertCollection(this.contents))
3481
- this.contents.addIn(path19, value);
3481
+ this.contents.addIn(path20, value);
3482
3482
  }
3483
3483
  /**
3484
3484
  * Create a new `Alias` node, ensuring that the target `node` has the required anchor.
@@ -3553,14 +3553,14 @@ var require_Document = __commonJS({
3553
3553
  * Removes a value from the document.
3554
3554
  * @returns `true` if the item was found and removed.
3555
3555
  */
3556
- deleteIn(path19) {
3557
- if (Collection.isEmptyPath(path19)) {
3556
+ deleteIn(path20) {
3557
+ if (Collection.isEmptyPath(path20)) {
3558
3558
  if (this.contents == null)
3559
3559
  return false;
3560
3560
  this.contents = null;
3561
3561
  return true;
3562
3562
  }
3563
- return assertCollection(this.contents) ? this.contents.deleteIn(path19) : false;
3563
+ return assertCollection(this.contents) ? this.contents.deleteIn(path20) : false;
3564
3564
  }
3565
3565
  /**
3566
3566
  * Returns item at `key`, or `undefined` if not found. By default unwraps
@@ -3575,10 +3575,10 @@ var require_Document = __commonJS({
3575
3575
  * scalar values from their surrounding node; to disable set `keepScalar` to
3576
3576
  * `true` (collections are always returned intact).
3577
3577
  */
3578
- getIn(path19, keepScalar) {
3579
- if (Collection.isEmptyPath(path19))
3578
+ getIn(path20, keepScalar) {
3579
+ if (Collection.isEmptyPath(path20))
3580
3580
  return !keepScalar && identity.isScalar(this.contents) ? this.contents.value : this.contents;
3581
- return identity.isCollection(this.contents) ? this.contents.getIn(path19, keepScalar) : void 0;
3581
+ return identity.isCollection(this.contents) ? this.contents.getIn(path20, keepScalar) : void 0;
3582
3582
  }
3583
3583
  /**
3584
3584
  * Checks if the document includes a value with the key `key`.
@@ -3589,10 +3589,10 @@ var require_Document = __commonJS({
3589
3589
  /**
3590
3590
  * Checks if the document includes a value at `path`.
3591
3591
  */
3592
- hasIn(path19) {
3593
- if (Collection.isEmptyPath(path19))
3592
+ hasIn(path20) {
3593
+ if (Collection.isEmptyPath(path20))
3594
3594
  return this.contents !== void 0;
3595
- return identity.isCollection(this.contents) ? this.contents.hasIn(path19) : false;
3595
+ return identity.isCollection(this.contents) ? this.contents.hasIn(path20) : false;
3596
3596
  }
3597
3597
  /**
3598
3598
  * Sets a value in this document. For `!!set`, `value` needs to be a
@@ -3609,13 +3609,13 @@ var require_Document = __commonJS({
3609
3609
  * Sets a value in this document. For `!!set`, `value` needs to be a
3610
3610
  * boolean to add/remove the item from the set.
3611
3611
  */
3612
- setIn(path19, value) {
3613
- if (Collection.isEmptyPath(path19)) {
3612
+ setIn(path20, value) {
3613
+ if (Collection.isEmptyPath(path20)) {
3614
3614
  this.contents = value;
3615
3615
  } else if (this.contents == null) {
3616
- this.contents = Collection.collectionFromPath(this.schema, Array.from(path19), value);
3616
+ this.contents = Collection.collectionFromPath(this.schema, Array.from(path20), value);
3617
3617
  } else if (assertCollection(this.contents)) {
3618
- this.contents.setIn(path19, value);
3618
+ this.contents.setIn(path20, value);
3619
3619
  }
3620
3620
  }
3621
3621
  /**
@@ -4001,10 +4001,10 @@ var require_resolve_block_map = __commonJS({
4001
4001
  let offset = bm.offset;
4002
4002
  let commentEnd = null;
4003
4003
  for (const collItem of bm.items) {
4004
- const { start, key, sep: sep5, value } = collItem;
4004
+ const { start, key, sep: sep6, value } = collItem;
4005
4005
  const keyProps = resolveProps.resolveProps(start, {
4006
4006
  indicator: "explicit-key-ind",
4007
- next: key ?? sep5?.[0],
4007
+ next: key ?? sep6?.[0],
4008
4008
  offset,
4009
4009
  onError,
4010
4010
  parentIndent: bm.indent,
@@ -4018,7 +4018,7 @@ var require_resolve_block_map = __commonJS({
4018
4018
  else if ("indent" in key && key.indent !== bm.indent)
4019
4019
  onError(offset, "BAD_INDENT", startColMsg);
4020
4020
  }
4021
- if (!keyProps.anchor && !keyProps.tag && !sep5) {
4021
+ if (!keyProps.anchor && !keyProps.tag && !sep6) {
4022
4022
  commentEnd = keyProps.end;
4023
4023
  if (keyProps.comment) {
4024
4024
  if (map.comment)
@@ -4042,7 +4042,7 @@ var require_resolve_block_map = __commonJS({
4042
4042
  ctx.atKey = false;
4043
4043
  if (utilMapIncludes.mapIncludes(ctx, map.items, keyNode))
4044
4044
  onError(keyStart, "DUPLICATE_KEY", "Map keys must be unique");
4045
- const valueProps = resolveProps.resolveProps(sep5 ?? [], {
4045
+ const valueProps = resolveProps.resolveProps(sep6 ?? [], {
4046
4046
  indicator: "map-value-ind",
4047
4047
  next: value,
4048
4048
  offset: keyNode.range[2],
@@ -4058,7 +4058,7 @@ var require_resolve_block_map = __commonJS({
4058
4058
  if (ctx.options.strict && keyProps.start < valueProps.found.offset - 1024)
4059
4059
  onError(keyNode.range, "KEY_OVER_1024_CHARS", "The : indicator must be at most 1024 chars after the start of an implicit block mapping key");
4060
4060
  }
4061
- const valueNode = value ? composeNode(ctx, value, valueProps, onError) : composeEmptyNode(ctx, offset, sep5, null, valueProps, onError);
4061
+ const valueNode = value ? composeNode(ctx, value, valueProps, onError) : composeEmptyNode(ctx, offset, sep6, null, valueProps, onError);
4062
4062
  if (ctx.schema.compat)
4063
4063
  utilFlowIndentCheck.flowIndentCheck(bm.indent, value, onError);
4064
4064
  offset = valueNode.range[2];
@@ -4149,7 +4149,7 @@ var require_resolve_end = __commonJS({
4149
4149
  let comment = "";
4150
4150
  if (end) {
4151
4151
  let hasSpace = false;
4152
- let sep5 = "";
4152
+ let sep6 = "";
4153
4153
  for (const token of end) {
4154
4154
  const { source, type } = token;
4155
4155
  switch (type) {
@@ -4163,13 +4163,13 @@ var require_resolve_end = __commonJS({
4163
4163
  if (!comment)
4164
4164
  comment = cb;
4165
4165
  else
4166
- comment += sep5 + cb;
4167
- sep5 = "";
4166
+ comment += sep6 + cb;
4167
+ sep6 = "";
4168
4168
  break;
4169
4169
  }
4170
4170
  case "newline":
4171
4171
  if (comment)
4172
- sep5 += source;
4172
+ sep6 += source;
4173
4173
  hasSpace = true;
4174
4174
  break;
4175
4175
  default:
@@ -4212,18 +4212,18 @@ var require_resolve_flow_collection = __commonJS({
4212
4212
  let offset = fc.offset + fc.start.source.length;
4213
4213
  for (let i = 0; i < fc.items.length; ++i) {
4214
4214
  const collItem = fc.items[i];
4215
- const { start, key, sep: sep5, value } = collItem;
4215
+ const { start, key, sep: sep6, value } = collItem;
4216
4216
  const props = resolveProps.resolveProps(start, {
4217
4217
  flow: fcName,
4218
4218
  indicator: "explicit-key-ind",
4219
- next: key ?? sep5?.[0],
4219
+ next: key ?? sep6?.[0],
4220
4220
  offset,
4221
4221
  onError,
4222
4222
  parentIndent: fc.indent,
4223
4223
  startOnNewline: false
4224
4224
  });
4225
4225
  if (!props.found) {
4226
- if (!props.anchor && !props.tag && !sep5 && !value) {
4226
+ if (!props.anchor && !props.tag && !sep6 && !value) {
4227
4227
  if (i === 0 && props.comma)
4228
4228
  onError(props.comma, "UNEXPECTED_TOKEN", `Unexpected , in ${fcName}`);
4229
4229
  else if (i < fc.items.length - 1)
@@ -4277,8 +4277,8 @@ var require_resolve_flow_collection = __commonJS({
4277
4277
  }
4278
4278
  }
4279
4279
  }
4280
- if (!isMap && !sep5 && !props.found) {
4281
- const valueNode = value ? composeNode(ctx, value, props, onError) : composeEmptyNode(ctx, props.end, sep5, null, props, onError);
4280
+ if (!isMap && !sep6 && !props.found) {
4281
+ const valueNode = value ? composeNode(ctx, value, props, onError) : composeEmptyNode(ctx, props.end, sep6, null, props, onError);
4282
4282
  coll.items.push(valueNode);
4283
4283
  offset = valueNode.range[2];
4284
4284
  if (isBlock(value))
@@ -4290,7 +4290,7 @@ var require_resolve_flow_collection = __commonJS({
4290
4290
  if (isBlock(key))
4291
4291
  onError(keyNode.range, "BLOCK_IN_FLOW", blockMsg);
4292
4292
  ctx.atKey = false;
4293
- const valueProps = resolveProps.resolveProps(sep5 ?? [], {
4293
+ const valueProps = resolveProps.resolveProps(sep6 ?? [], {
4294
4294
  flow: fcName,
4295
4295
  indicator: "map-value-ind",
4296
4296
  next: value,
@@ -4301,8 +4301,8 @@ var require_resolve_flow_collection = __commonJS({
4301
4301
  });
4302
4302
  if (valueProps.found) {
4303
4303
  if (!isMap && !props.found && ctx.options.strict) {
4304
- if (sep5)
4305
- for (const st of sep5) {
4304
+ if (sep6)
4305
+ for (const st of sep6) {
4306
4306
  if (st === valueProps.found)
4307
4307
  break;
4308
4308
  if (st.type === "newline") {
@@ -4319,7 +4319,7 @@ var require_resolve_flow_collection = __commonJS({
4319
4319
  else
4320
4320
  onError(valueProps.start, "MISSING_CHAR", `Missing , or : between ${fcName} items`);
4321
4321
  }
4322
- const valueNode = value ? composeNode(ctx, value, valueProps, onError) : valueProps.found ? composeEmptyNode(ctx, valueProps.end, sep5, null, valueProps, onError) : null;
4322
+ const valueNode = value ? composeNode(ctx, value, valueProps, onError) : valueProps.found ? composeEmptyNode(ctx, valueProps.end, sep6, null, valueProps, onError) : null;
4323
4323
  if (valueNode) {
4324
4324
  if (isBlock(value))
4325
4325
  onError(valueNode.range, "BLOCK_IN_FLOW", blockMsg);
@@ -4499,7 +4499,7 @@ var require_resolve_block_scalar = __commonJS({
4499
4499
  chompStart = i + 1;
4500
4500
  }
4501
4501
  let value = "";
4502
- let sep5 = "";
4502
+ let sep6 = "";
4503
4503
  let prevMoreIndented = false;
4504
4504
  for (let i = 0; i < contentStart; ++i)
4505
4505
  value += lines[i][0].slice(trimIndent) + "\n";
@@ -4516,24 +4516,24 @@ var require_resolve_block_scalar = __commonJS({
4516
4516
  indent = "";
4517
4517
  }
4518
4518
  if (type === Scalar.Scalar.BLOCK_LITERAL) {
4519
- value += sep5 + indent.slice(trimIndent) + content;
4520
- sep5 = "\n";
4519
+ value += sep6 + indent.slice(trimIndent) + content;
4520
+ sep6 = "\n";
4521
4521
  } else if (indent.length > trimIndent || content[0] === " ") {
4522
- if (sep5 === " ")
4523
- sep5 = "\n";
4524
- else if (!prevMoreIndented && sep5 === "\n")
4525
- sep5 = "\n\n";
4526
- value += sep5 + indent.slice(trimIndent) + content;
4527
- sep5 = "\n";
4522
+ if (sep6 === " ")
4523
+ sep6 = "\n";
4524
+ else if (!prevMoreIndented && sep6 === "\n")
4525
+ sep6 = "\n\n";
4526
+ value += sep6 + indent.slice(trimIndent) + content;
4527
+ sep6 = "\n";
4528
4528
  prevMoreIndented = true;
4529
4529
  } else if (content === "") {
4530
- if (sep5 === "\n")
4530
+ if (sep6 === "\n")
4531
4531
  value += "\n";
4532
4532
  else
4533
- sep5 = "\n";
4533
+ sep6 = "\n";
4534
4534
  } else {
4535
- value += sep5 + content;
4536
- sep5 = " ";
4535
+ value += sep6 + content;
4536
+ sep6 = " ";
4537
4537
  prevMoreIndented = false;
4538
4538
  }
4539
4539
  }
@@ -4715,25 +4715,25 @@ var require_resolve_flow_scalar = __commonJS({
4715
4715
  if (!match)
4716
4716
  return source;
4717
4717
  let res = match[1];
4718
- let sep5 = " ";
4718
+ let sep6 = " ";
4719
4719
  let pos = first.lastIndex;
4720
4720
  line.lastIndex = pos;
4721
4721
  while (match = line.exec(source)) {
4722
4722
  if (match[1] === "") {
4723
- if (sep5 === "\n")
4724
- res += sep5;
4723
+ if (sep6 === "\n")
4724
+ res += sep6;
4725
4725
  else
4726
- sep5 = "\n";
4726
+ sep6 = "\n";
4727
4727
  } else {
4728
- res += sep5 + match[1];
4729
- sep5 = " ";
4728
+ res += sep6 + match[1];
4729
+ sep6 = " ";
4730
4730
  }
4731
4731
  pos = line.lastIndex;
4732
4732
  }
4733
4733
  const last = /[ \t]*(.*)/sy;
4734
4734
  last.lastIndex = pos;
4735
4735
  match = last.exec(source);
4736
- return res + sep5 + (match?.[1] ?? "");
4736
+ return res + sep6 + (match?.[1] ?? "");
4737
4737
  }
4738
4738
  function doubleQuotedValue(source, onError) {
4739
4739
  let res = "";
@@ -5543,14 +5543,14 @@ var require_cst_stringify = __commonJS({
5543
5543
  }
5544
5544
  }
5545
5545
  }
5546
- function stringifyItem({ start, key, sep: sep5, value }) {
5546
+ function stringifyItem({ start, key, sep: sep6, value }) {
5547
5547
  let res = "";
5548
5548
  for (const st of start)
5549
5549
  res += st.source;
5550
5550
  if (key)
5551
5551
  res += stringifyToken(key);
5552
- if (sep5)
5553
- for (const st of sep5)
5552
+ if (sep6)
5553
+ for (const st of sep6)
5554
5554
  res += st.source;
5555
5555
  if (value)
5556
5556
  res += stringifyToken(value);
@@ -5575,9 +5575,9 @@ var require_cst_visit = __commonJS({
5575
5575
  visit.BREAK = BREAK;
5576
5576
  visit.SKIP = SKIP;
5577
5577
  visit.REMOVE = REMOVE;
5578
- visit.itemAtPath = (cst, path19) => {
5578
+ visit.itemAtPath = (cst, path20) => {
5579
5579
  let item = cst;
5580
- for (const [field, index] of path19) {
5580
+ for (const [field, index] of path20) {
5581
5581
  const tok = item?.[field];
5582
5582
  if (tok && "items" in tok) {
5583
5583
  item = tok.items[index];
@@ -5586,23 +5586,23 @@ var require_cst_visit = __commonJS({
5586
5586
  }
5587
5587
  return item;
5588
5588
  };
5589
- visit.parentCollection = (cst, path19) => {
5590
- const parent = visit.itemAtPath(cst, path19.slice(0, -1));
5591
- const field = path19[path19.length - 1][0];
5589
+ visit.parentCollection = (cst, path20) => {
5590
+ const parent = visit.itemAtPath(cst, path20.slice(0, -1));
5591
+ const field = path20[path20.length - 1][0];
5592
5592
  const coll = parent?.[field];
5593
5593
  if (coll && "items" in coll)
5594
5594
  return coll;
5595
5595
  throw new Error("Parent collection not found");
5596
5596
  };
5597
- function _visit(path19, item, visitor) {
5598
- let ctrl = visitor(item, path19);
5597
+ function _visit(path20, item, visitor) {
5598
+ let ctrl = visitor(item, path20);
5599
5599
  if (typeof ctrl === "symbol")
5600
5600
  return ctrl;
5601
5601
  for (const field of ["key", "value"]) {
5602
5602
  const token = item[field];
5603
5603
  if (token && "items" in token) {
5604
5604
  for (let i = 0; i < token.items.length; ++i) {
5605
- const ci = _visit(Object.freeze(path19.concat([[field, i]])), token.items[i], visitor);
5605
+ const ci = _visit(Object.freeze(path20.concat([[field, i]])), token.items[i], visitor);
5606
5606
  if (typeof ci === "number")
5607
5607
  i = ci - 1;
5608
5608
  else if (ci === BREAK)
@@ -5613,10 +5613,10 @@ var require_cst_visit = __commonJS({
5613
5613
  }
5614
5614
  }
5615
5615
  if (typeof ctrl === "function" && field === "key")
5616
- ctrl = ctrl(item, path19);
5616
+ ctrl = ctrl(item, path20);
5617
5617
  }
5618
5618
  }
5619
- return typeof ctrl === "function" ? ctrl(item, path19) : ctrl;
5619
+ return typeof ctrl === "function" ? ctrl(item, path20) : ctrl;
5620
5620
  }
5621
5621
  exports.visit = visit;
5622
5622
  }
@@ -6717,18 +6717,18 @@ var require_parser = __commonJS({
6717
6717
  if (this.type === "map-value-ind") {
6718
6718
  const prev = getPrevProps(this.peek(2));
6719
6719
  const start = getFirstKeyStartProps(prev);
6720
- let sep5;
6720
+ let sep6;
6721
6721
  if (scalar.end) {
6722
- sep5 = scalar.end;
6723
- sep5.push(this.sourceToken);
6722
+ sep6 = scalar.end;
6723
+ sep6.push(this.sourceToken);
6724
6724
  delete scalar.end;
6725
6725
  } else
6726
- sep5 = [this.sourceToken];
6726
+ sep6 = [this.sourceToken];
6727
6727
  const map = {
6728
6728
  type: "block-map",
6729
6729
  offset: scalar.offset,
6730
6730
  indent: scalar.indent,
6731
- items: [{ start, key: scalar, sep: sep5 }]
6731
+ items: [{ start, key: scalar, sep: sep6 }]
6732
6732
  };
6733
6733
  this.onKeyLine = true;
6734
6734
  this.stack[this.stack.length - 1] = map;
@@ -6881,15 +6881,15 @@ var require_parser = __commonJS({
6881
6881
  } else if (isFlowToken(it.key) && !includesToken(it.sep, "newline")) {
6882
6882
  const start2 = getFirstKeyStartProps(it.start);
6883
6883
  const key = it.key;
6884
- const sep5 = it.sep;
6885
- sep5.push(this.sourceToken);
6884
+ const sep6 = it.sep;
6885
+ sep6.push(this.sourceToken);
6886
6886
  delete it.key;
6887
6887
  delete it.sep;
6888
6888
  this.stack.push({
6889
6889
  type: "block-map",
6890
6890
  offset: this.offset,
6891
6891
  indent: this.indent,
6892
- items: [{ start: start2, key, sep: sep5 }]
6892
+ items: [{ start: start2, key, sep: sep6 }]
6893
6893
  });
6894
6894
  } else if (start.length > 0) {
6895
6895
  it.sep = it.sep.concat(start, this.sourceToken);
@@ -6918,14 +6918,14 @@ var require_parser = __commonJS({
6918
6918
  case "scalar":
6919
6919
  case "single-quoted-scalar":
6920
6920
  case "double-quoted-scalar": {
6921
- const fs22 = this.flowScalar(this.type);
6921
+ const fs23 = this.flowScalar(this.type);
6922
6922
  if (atNextItem || it.value) {
6923
- map.items.push({ start, key: fs22, sep: [] });
6923
+ map.items.push({ start, key: fs23, sep: [] });
6924
6924
  this.onKeyLine = true;
6925
6925
  } else if (it.sep) {
6926
- this.stack.push(fs22);
6926
+ this.stack.push(fs23);
6927
6927
  } else {
6928
- Object.assign(it, { key: fs22, sep: [] });
6928
+ Object.assign(it, { key: fs23, sep: [] });
6929
6929
  this.onKeyLine = true;
6930
6930
  }
6931
6931
  return;
@@ -7053,13 +7053,13 @@ var require_parser = __commonJS({
7053
7053
  case "scalar":
7054
7054
  case "single-quoted-scalar":
7055
7055
  case "double-quoted-scalar": {
7056
- const fs22 = this.flowScalar(this.type);
7056
+ const fs23 = this.flowScalar(this.type);
7057
7057
  if (!it || it.value)
7058
- fc.items.push({ start: [], key: fs22, sep: [] });
7058
+ fc.items.push({ start: [], key: fs23, sep: [] });
7059
7059
  else if (it.sep)
7060
- this.stack.push(fs22);
7060
+ this.stack.push(fs23);
7061
7061
  else
7062
- Object.assign(it, { key: fs22, sep: [] });
7062
+ Object.assign(it, { key: fs23, sep: [] });
7063
7063
  return;
7064
7064
  }
7065
7065
  case "flow-map-end":
@@ -7083,13 +7083,13 @@ var require_parser = __commonJS({
7083
7083
  const prev = getPrevProps(parent);
7084
7084
  const start = getFirstKeyStartProps(prev);
7085
7085
  fixFlowSeqItems(fc);
7086
- const sep5 = fc.end.splice(1, fc.end.length);
7087
- sep5.push(this.sourceToken);
7086
+ const sep6 = fc.end.splice(1, fc.end.length);
7087
+ sep6.push(this.sourceToken);
7088
7088
  const map = {
7089
7089
  type: "block-map",
7090
7090
  offset: fc.offset,
7091
7091
  indent: fc.indent,
7092
- items: [{ start, key: fc, sep: sep5 }]
7092
+ items: [{ start, key: fc, sep: sep6 }]
7093
7093
  };
7094
7094
  this.onKeyLine = true;
7095
7095
  this.stack[this.stack.length - 1] = map;
@@ -7370,9 +7370,9 @@ var require_dist = __commonJS({
7370
7370
  // src/scripts/install.ts
7371
7371
  import { spawn, spawnSync as spawnSync2 } from "node:child_process";
7372
7372
  import * as crypto3 from "node:crypto";
7373
- import * as fs21 from "node:fs";
7373
+ import * as fs22 from "node:fs";
7374
7374
  import * as os8 from "node:os";
7375
- import * as path18 from "node:path";
7375
+ import * as path19 from "node:path";
7376
7376
  import process3 from "node:process";
7377
7377
  import { fileURLToPath as fileURLToPath5, pathToFileURL as pathToFileURL2 } from "node:url";
7378
7378
 
@@ -7873,8 +7873,8 @@ function lockfile_write_path(env) {
7873
7873
  }
7874
7874
  return write_target("installed.lock", { env: env ?? null });
7875
7875
  }
7876
- function read_lockfile(path19) {
7877
- const target = path19 ?? lockfile_path();
7876
+ function read_lockfile(path20) {
7877
+ const target = path20 ?? lockfile_path();
7878
7878
  let text;
7879
7879
  try {
7880
7880
  text = fs2.readFileSync(target, { encoding: "utf-8" });
@@ -8127,21 +8127,78 @@ function current_package_version(repo_root) {
8127
8127
  return _find_package_version_upward(here) ?? "0.0.0";
8128
8128
  }
8129
8129
 
8130
+ // src/scripts/_lib/mcp_bridge.ts
8131
+ import * as fs3 from "node:fs";
8132
+ import * as path3 from "node:path";
8133
+ var MCP_SERVER_KEY = "agent-config";
8134
+ var MCP_BRIDGE_ENTRY = {
8135
+ mcpServers: {
8136
+ [MCP_SERVER_KEY]: {
8137
+ command: "npx",
8138
+ args: ["-y", "@event4u/agent-config", "mcp-server"]
8139
+ }
8140
+ }
8141
+ };
8142
+ function makeEnsureMcpBridge(mergeJsonFile) {
8143
+ return (projectRoot, force) => mergeJsonFile(path3.join(projectRoot, ".mcp.json"), MCP_BRIDGE_ENTRY, force, ".mcp.json");
8144
+ }
8145
+ function projectionModeOf(raw) {
8146
+ return raw === "scoped" ? "scoped" : raw === "tiered" ? "tiered" : "legacy-all";
8147
+ }
8148
+ function resolveTierB(packageRoot) {
8149
+ const p = path3.join(packageRoot, "agents", "runtime", "state", "skill-tiers.json");
8150
+ if (!fs3.existsSync(p)) return null;
8151
+ try {
8152
+ const parsed = JSON.parse(fs3.readFileSync(p, "utf-8"));
8153
+ if (!Array.isArray(parsed.tier_b)) return null;
8154
+ return new Set(parsed.tier_b.filter((n) => typeof n === "string"));
8155
+ } catch {
8156
+ return null;
8157
+ }
8158
+ }
8159
+ function tierBPrunePredicate(tierB) {
8160
+ return (mdPath) => tierB.has(path3.basename(path3.dirname(mdPath)));
8161
+ }
8162
+ function tierBAdvisory(packageRoot) {
8163
+ const tierB = resolveTierB(packageRoot);
8164
+ if (tierB === null || tierB.size === 0) return null;
8165
+ return `\u2139\uFE0F ${tierB.size} skill(s) are predicted to reach the model WITHOUT their description on a default 200k window.
8166
+ Two levers, neither applied for you:
8167
+ \u2022 raise \`skillListingBudgetFraction\` in your Claude Code settings \u2014 restores descriptions at a token cost (100% delivery of this catalogue measures ~13,003 tok)
8168
+ \u2022 or set \`projection.mode: tiered\` to withhold them from the catalogue and reach them via the MCP server instead (opt-in, still unproven \u2014 see docs/mcp-server.md)`;
8169
+ }
8170
+ function applyTieredPrune(deployResults, packageRoot, pruneBy) {
8171
+ const tierB = resolveTierB(packageRoot);
8172
+ if (tierB === null || tierB.size === 0) {
8173
+ return {
8174
+ deployResults,
8175
+ level: "warn",
8176
+ message: "projection.mode: tiered but no skill-tier split exists (agents/runtime/state/skill-tiers.json) \u2014 shipping the full surface. Compute one with `./scripts-run src/scripts/compute_skill_tiers` first."
8177
+ };
8178
+ }
8179
+ const [pruned, adjusted] = pruneBy(deployResults, tierBPrunePredicate(tierB));
8180
+ return {
8181
+ deployResults: adjusted,
8182
+ level: "info",
8183
+ message: `\u{1F9F9} Tiered install: pruned ${pruned} Tier-B skill artefact(s) \u2014 still reachable via the MCP server's suggest_skill_for_task / read_skill. Set projection.mode: legacy-all to restore the full surface.`
8184
+ };
8185
+ }
8186
+
8130
8187
  // src/scripts/_lib/scoped_projection.ts
8131
- import * as fs4 from "node:fs";
8188
+ import * as fs5 from "node:fs";
8132
8189
  import { createRequire } from "node:module";
8133
- import * as path4 from "node:path";
8190
+ import * as path5 from "node:path";
8134
8191
 
8135
8192
  // src/scripts/_lib/surface_tiers.ts
8136
- import * as fs3 from "node:fs";
8137
- import * as path3 from "node:path";
8193
+ import * as fs4 from "node:fs";
8194
+ import * as path4 from "node:path";
8138
8195
  var _LAB_FALLBACK = /* @__PURE__ */ new Set(["ai-video", "ai-image", "fun"]);
8139
8196
  function load_lab_pack_ids(repo_root) {
8140
- const vocab = path3.join(repo_root, "src", "config", "discovery", "packs.yml");
8197
+ const vocab = path4.join(repo_root, "src", "config", "discovery", "packs.yml");
8141
8198
  const ids = /* @__PURE__ */ new Set();
8142
8199
  try {
8143
8200
  const YAML3 = require_dist();
8144
- const data = YAML3.parse(fs3.readFileSync(vocab, "utf-8"), { version: "1.1" });
8201
+ const data = YAML3.parse(fs4.readFileSync(vocab, "utf-8"), { version: "1.1" });
8145
8202
  for (const entry of data ?? []) {
8146
8203
  if (entry && typeof entry === "object" && !Array.isArray(entry)) {
8147
8204
  const rec = entry;
@@ -8161,7 +8218,7 @@ function load_lab_pack_ids(repo_root) {
8161
8218
  function frontmatter_packs(md_path) {
8162
8219
  let text;
8163
8220
  try {
8164
- text = fs3.readFileSync(md_path, "utf-8");
8221
+ text = fs4.readFileSync(md_path, "utf-8");
8165
8222
  } catch {
8166
8223
  return /* @__PURE__ */ new Set();
8167
8224
  }
@@ -8244,10 +8301,10 @@ function yamlSafeLoad(text) {
8244
8301
  return null;
8245
8302
  }
8246
8303
  }
8247
- var PACKS_YML_REL = path4.join("src", "config", "discovery", "packs.yml");
8304
+ var PACKS_YML_REL = path5.join("src", "config", "discovery", "packs.yml");
8248
8305
  function load_packs_registry(package_root) {
8249
- const vocab_path = path4.join(package_root, PACKS_YML_REL);
8250
- const data = yamlSafeLoad(fs4.readFileSync(vocab_path, "utf-8"));
8306
+ const vocab_path = path5.join(package_root, PACKS_YML_REL);
8307
+ const data = yamlSafeLoad(fs5.readFileSync(vocab_path, "utf-8"));
8251
8308
  if (!Array.isArray(data)) {
8252
8309
  throw new Error(`packs.yml did not parse to a list: ${vocab_path}`);
8253
8310
  }
@@ -8318,12 +8375,67 @@ function resolve_rule_pack_scope(raw, package_root, runtime_active_packs = []) {
8318
8375
  }
8319
8376
  return null;
8320
8377
  }
8378
+ function prune_modules_by(deploy_results, is_pruned) {
8379
+ let pruned = 0;
8380
+ const adjusted = {};
8381
+ for (const tool_id of Object.keys(deploy_results)) {
8382
+ const [written, skipped, status, paths] = deploy_results[tool_id];
8383
+ const pruned_skill_dirs = /* @__PURE__ */ new Set();
8384
+ for (const p of paths) {
8385
+ const parts = p.split(path5.sep);
8386
+ if (parts.includes("skills")) {
8387
+ const i = parts.indexOf("skills");
8388
+ if (i + 1 < parts.length) {
8389
+ const skill_root = parts.slice(0, i + 2).join(path5.sep);
8390
+ if (!pruned_skill_dirs.has(skill_root)) {
8391
+ const skillmd = path5.join(skill_root, "SKILL.md");
8392
+ if (fs5.existsSync(skillmd) && is_pruned(skillmd)) {
8393
+ pruned_skill_dirs.add(skill_root);
8394
+ }
8395
+ }
8396
+ }
8397
+ }
8398
+ }
8399
+ const keep = [];
8400
+ const delete_files = [];
8401
+ for (const p of paths) {
8402
+ const parts = p.split(path5.sep);
8403
+ let is_target = false;
8404
+ if (parts.includes("skills")) {
8405
+ const i = parts.indexOf("skills");
8406
+ if (i + 1 < parts.length && pruned_skill_dirs.has(parts.slice(0, i + 2).join(path5.sep))) {
8407
+ is_target = true;
8408
+ }
8409
+ } else if (parts.includes("commands") && path5.extname(p) === ".md" && is_pruned(p)) {
8410
+ is_target = true;
8411
+ }
8412
+ (is_target ? delete_files : keep).push(p);
8413
+ }
8414
+ for (const d of pruned_skill_dirs) {
8415
+ fs5.rmSync(d, { recursive: true, force: true });
8416
+ }
8417
+ for (const p of delete_files) {
8418
+ if (p.split(path5.sep).includes("commands") && fs5.existsSync(p)) {
8419
+ try {
8420
+ fs5.unlinkSync(p);
8421
+ } catch {
8422
+ }
8423
+ }
8424
+ }
8425
+ pruned += delete_files.length;
8426
+ adjusted[tool_id] = [Math.max(0, written - delete_files.length), skipped, status, keep];
8427
+ }
8428
+ return [pruned, adjusted];
8429
+ }
8430
+ function prune_lab_modules(deploy_results, lab_ids) {
8431
+ return prune_modules_by(deploy_results, (p) => is_lab_artefact(p, lab_ids));
8432
+ }
8321
8433
 
8322
8434
  // src/scripts/_lib/global_deploy_inventory.ts
8323
8435
  import { randomBytes as randomBytes2 } from "node:crypto";
8324
- import * as fs5 from "node:fs";
8436
+ import * as fs6 from "node:fs";
8325
8437
  import * as os3 from "node:os";
8326
- import * as path5 from "node:path";
8438
+ import * as path6 from "node:path";
8327
8439
  var SCHEMA_VERSION2 = 1;
8328
8440
  var INVENTORY_BASENAME = "deployed-files.json";
8329
8441
  var INVENTORY_ENV = "AGENT_CONFIG_DEPLOY_INVENTORY";
@@ -8332,22 +8444,22 @@ function expanduser3(p) {
8332
8444
  return os3.homedir();
8333
8445
  }
8334
8446
  if (p.startsWith("~/") || process.platform === "win32" && p.startsWith("~\\")) {
8335
- return path5.join(os3.homedir(), p.slice(2));
8447
+ return path6.join(os3.homedir(), p.slice(2));
8336
8448
  }
8337
8449
  return p;
8338
8450
  }
8339
8451
  function resolve_path(p) {
8340
8452
  try {
8341
- return fs5.realpathSync(p);
8453
+ return fs6.realpathSync(p);
8342
8454
  } catch {
8343
- const abs = path5.resolve(p);
8344
- const parts = abs.split(path5.sep);
8455
+ const abs = path6.resolve(p);
8456
+ const parts = abs.split(path6.sep);
8345
8457
  for (let i = parts.length; i > 0; i -= 1) {
8346
- const prefix = parts.slice(0, i).join(path5.sep) || path5.sep;
8458
+ const prefix = parts.slice(0, i).join(path6.sep) || path6.sep;
8347
8459
  try {
8348
- const real = fs5.realpathSync(prefix);
8460
+ const real = fs6.realpathSync(prefix);
8349
8461
  const rest = parts.slice(i);
8350
- return rest.length > 0 ? path5.join(real, ...rest) : real;
8462
+ return rest.length > 0 ? path6.join(real, ...rest) : real;
8351
8463
  } catch {
8352
8464
  continue;
8353
8465
  }
@@ -8357,7 +8469,7 @@ function resolve_path(p) {
8357
8469
  }
8358
8470
  function path_exists(p) {
8359
8471
  try {
8360
- fs5.statSync(p);
8472
+ fs6.statSync(p);
8361
8473
  return true;
8362
8474
  } catch {
8363
8475
  return false;
@@ -8375,7 +8487,7 @@ function load_inventory(p) {
8375
8487
  const target = p ?? inventory_path();
8376
8488
  let data;
8377
8489
  try {
8378
- data = JSON.parse(fs5.readFileSync(target, { encoding: "utf-8" }));
8490
+ data = JSON.parse(fs6.readFileSync(target, { encoding: "utf-8" }));
8379
8491
  } catch {
8380
8492
  return { schema_version: SCHEMA_VERSION2, tools: {} };
8381
8493
  }
@@ -8386,15 +8498,15 @@ function load_inventory(p) {
8386
8498
  }
8387
8499
  function save_inventory(data, p) {
8388
8500
  const target = p ?? inventory_path();
8389
- fs5.mkdirSync(path5.dirname(target), { recursive: true });
8501
+ fs6.mkdirSync(path6.dirname(target), { recursive: true });
8390
8502
  const payload = json_dumps_sorted(data, 2) + "\n";
8391
- const parent = path5.dirname(target);
8503
+ const parent = path6.dirname(target);
8392
8504
  let fd = null;
8393
8505
  let tmp_name = "";
8394
8506
  for (let attempt = 0; attempt < 32; attempt += 1) {
8395
- tmp_name = path5.join(parent, `${path5.basename(target)}.${randomBytes2(6).toString("hex")}`);
8507
+ tmp_name = path6.join(parent, `${path6.basename(target)}.${randomBytes2(6).toString("hex")}`);
8396
8508
  try {
8397
- fd = fs5.openSync(tmp_name, "wx", 384);
8509
+ fd = fs6.openSync(tmp_name, "wx", 384);
8398
8510
  break;
8399
8511
  } catch (err) {
8400
8512
  if (err.code === "EEXIST") {
@@ -8407,16 +8519,16 @@ function save_inventory(data, p) {
8407
8519
  throw new Error("save_inventory: could not create a unique temp file");
8408
8520
  }
8409
8521
  try {
8410
- fs5.writeFileSync(fd, payload, { encoding: "utf-8" });
8411
- fs5.closeSync(fd);
8412
- fs5.renameSync(tmp_name, target);
8522
+ fs6.writeFileSync(fd, payload, { encoding: "utf-8" });
8523
+ fs6.closeSync(fd);
8524
+ fs6.renameSync(tmp_name, target);
8413
8525
  } catch (err) {
8414
8526
  try {
8415
- fs5.closeSync(fd);
8527
+ fs6.closeSync(fd);
8416
8528
  } catch {
8417
8529
  }
8418
8530
  try {
8419
- fs5.unlinkSync(tmp_name);
8531
+ fs6.unlinkSync(tmp_name);
8420
8532
  } catch {
8421
8533
  }
8422
8534
  throw err;
@@ -8475,7 +8587,7 @@ function expected_deploy_files(src, dest_rel, file_filter = null) {
8475
8587
  const out = /* @__PURE__ */ new Set();
8476
8588
  let src_stat;
8477
8589
  try {
8478
- src_stat = fs5.statSync(src);
8590
+ src_stat = fs6.statSync(src);
8479
8591
  } catch {
8480
8592
  return out;
8481
8593
  }
@@ -8487,23 +8599,23 @@ function expected_deploy_files(src, dest_rel, file_filter = null) {
8487
8599
  return out;
8488
8600
  }
8489
8601
  const _walk = (node, prefix) => {
8490
- const entries = fs5.readdirSync(node).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
8602
+ const entries = fs6.readdirSync(node).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
8491
8603
  for (const name of entries) {
8492
- const entry = path5.join(node, name);
8604
+ const entry = path6.join(node, name);
8493
8605
  const rel = join_rel(prefix, name);
8494
- const lst = fs5.lstatSync(entry);
8606
+ const lst = fs6.lstatSync(entry);
8495
8607
  if (lst.isDirectory() && !lst.isSymbolicLink()) {
8496
8608
  _walk(entry, rel);
8497
8609
  continue;
8498
8610
  }
8499
8611
  let resolved_is_dir = false;
8500
8612
  try {
8501
- resolved_is_dir = fs5.statSync(entry).isDirectory();
8613
+ resolved_is_dir = fs6.statSync(entry).isDirectory();
8502
8614
  } catch {
8503
8615
  resolved_is_dir = false;
8504
8616
  }
8505
8617
  if (resolved_is_dir) {
8506
- _walk(fs5.realpathSync(entry), rel);
8618
+ _walk(fs6.realpathSync(entry), rel);
8507
8619
  continue;
8508
8620
  }
8509
8621
  if (file_filter !== null && !file_filter(entry)) {
@@ -8516,13 +8628,13 @@ function expected_deploy_files(src, dest_rel, file_filter = null) {
8516
8628
  return out;
8517
8629
  }
8518
8630
  function join_rel(prefix, name) {
8519
- return prefix ? path5.join(prefix, name) : name;
8631
+ return prefix ? path6.join(prefix, name) : name;
8520
8632
  }
8521
8633
  function as_posix(p) {
8522
8634
  if (p === "") {
8523
8635
  return ".";
8524
8636
  }
8525
- return p.split(path5.sep).join("/");
8637
+ return p.split(path6.sep).join("/");
8526
8638
  }
8527
8639
  function reap_stale(tool_id, anchor, current_files, inventory, dry_run = false) {
8528
8640
  const tools = inventory["tools"] ?? {};
@@ -8547,15 +8659,15 @@ function reap_stale(tool_id, anchor, current_files, inventory, dry_run = false)
8547
8659
  if (typeof rel !== "string" || !rel || rel.startsWith("/") || rel.startsWith("..")) {
8548
8660
  continue;
8549
8661
  }
8550
- const target = path5.join(anchor_resolved, rel);
8662
+ const target = path6.join(anchor_resolved, rel);
8551
8663
  try {
8552
- relative_to(resolve_path(path5.dirname(target)), anchor_resolved);
8664
+ relative_to(resolve_path(path6.dirname(target)), anchor_resolved);
8553
8665
  } catch {
8554
8666
  continue;
8555
8667
  }
8556
8668
  let lst = null;
8557
8669
  try {
8558
- lst = fs5.lstatSync(target);
8670
+ lst = fs6.lstatSync(target);
8559
8671
  } catch {
8560
8672
  lst = null;
8561
8673
  }
@@ -8569,12 +8681,12 @@ function reap_stale(tool_id, anchor, current_files, inventory, dry_run = false)
8569
8681
  continue;
8570
8682
  }
8571
8683
  try {
8572
- fs5.unlinkSync(target);
8684
+ fs6.unlinkSync(target);
8573
8685
  } catch {
8574
8686
  continue;
8575
8687
  }
8576
8688
  deleted.push(target);
8577
- prune_candidates.add(path5.dirname(target));
8689
+ prune_candidates.add(path6.dirname(target));
8578
8690
  }
8579
8691
  prune_empty_dirs(prune_candidates, anchor_resolved);
8580
8692
  return deleted;
@@ -8585,10 +8697,10 @@ function reap_tagged_orphans(anchor, dest_subs, current_files, package_tag, dry_
8585
8697
  const prune_candidates = /* @__PURE__ */ new Set();
8586
8698
  const needle = `package: ${package_tag}`;
8587
8699
  for (const dest_sub of dest_subs) {
8588
- const root = dest_sub ? path5.join(anchor_resolved, dest_sub) : anchor_resolved;
8700
+ const root = dest_sub ? path6.join(anchor_resolved, dest_sub) : anchor_resolved;
8589
8701
  let root_stat;
8590
8702
  try {
8591
- root_stat = fs5.statSync(root);
8703
+ root_stat = fs6.statSync(root);
8592
8704
  } catch {
8593
8705
  continue;
8594
8706
  }
@@ -8598,7 +8710,7 @@ function reap_tagged_orphans(anchor, dest_subs, current_files, package_tag, dry_
8598
8710
  for (const md of rglob_md(root)) {
8599
8711
  let md_lst;
8600
8712
  try {
8601
- md_lst = fs5.lstatSync(md);
8713
+ md_lst = fs6.lstatSync(md);
8602
8714
  } catch {
8603
8715
  continue;
8604
8716
  }
@@ -8610,13 +8722,13 @@ function reap_tagged_orphans(anchor, dest_subs, current_files, package_tag, dry_
8610
8722
  continue;
8611
8723
  }
8612
8724
  try {
8613
- relative_to(resolve_path(path5.dirname(md)), anchor_resolved);
8725
+ relative_to(resolve_path(path6.dirname(md)), anchor_resolved);
8614
8726
  } catch {
8615
8727
  continue;
8616
8728
  }
8617
8729
  let head;
8618
8730
  try {
8619
- head = fs5.readFileSync(md, { encoding: "utf-8" });
8731
+ head = fs6.readFileSync(md, { encoding: "utf-8" });
8620
8732
  } catch {
8621
8733
  continue;
8622
8734
  }
@@ -8634,12 +8746,12 @@ function reap_tagged_orphans(anchor, dest_subs, current_files, package_tag, dry_
8634
8746
  continue;
8635
8747
  }
8636
8748
  try {
8637
- fs5.unlinkSync(md);
8749
+ fs6.unlinkSync(md);
8638
8750
  } catch {
8639
8751
  continue;
8640
8752
  }
8641
8753
  deleted.push(md);
8642
- prune_candidates.add(path5.dirname(md));
8754
+ prune_candidates.add(path6.dirname(md));
8643
8755
  }
8644
8756
  }
8645
8757
  prune_empty_dirs(prune_candidates, anchor_resolved);
@@ -8659,51 +8771,51 @@ function record_deploy(tool_id, anchor, current_files, inventory) {
8659
8771
  }
8660
8772
  function prune_empty_dirs(prune_candidates, anchor_resolved) {
8661
8773
  const ordered = [...prune_candidates].sort(
8662
- (a, b) => b.split(path5.sep).length - a.split(path5.sep).length
8774
+ (a, b) => b.split(path6.sep).length - a.split(path6.sep).length
8663
8775
  );
8664
8776
  for (const start of ordered) {
8665
8777
  let node = start;
8666
8778
  while (node !== anchor_resolved && is_ancestor(anchor_resolved, node)) {
8667
8779
  try {
8668
- fs5.rmdirSync(node);
8780
+ fs6.rmdirSync(node);
8669
8781
  } catch {
8670
8782
  break;
8671
8783
  }
8672
- node = path5.dirname(node);
8784
+ node = path6.dirname(node);
8673
8785
  }
8674
8786
  }
8675
8787
  }
8676
8788
  function is_ancestor(anchor, node) {
8677
- const rel = path5.relative(anchor, node);
8678
- return rel !== "" && !rel.startsWith("..") && !path5.isAbsolute(rel);
8789
+ const rel = path6.relative(anchor, node);
8790
+ return rel !== "" && !rel.startsWith("..") && !path6.isAbsolute(rel);
8679
8791
  }
8680
8792
  function relative_to(child, parent) {
8681
8793
  if (child === parent) {
8682
8794
  return "";
8683
8795
  }
8684
- const rel = path5.relative(parent, child);
8685
- if (rel.startsWith("..") || path5.isAbsolute(rel)) {
8796
+ const rel = path6.relative(parent, child);
8797
+ if (rel.startsWith("..") || path6.isAbsolute(rel)) {
8686
8798
  throw new Error(`'${child}' is not in the subpath of '${parent}'`);
8687
8799
  }
8688
8800
  return rel;
8689
8801
  }
8690
8802
  function relative_to_posix(child, parent) {
8691
- return path5.relative(parent, child).split(path5.sep).join("/");
8803
+ return path6.relative(parent, child).split(path6.sep).join("/");
8692
8804
  }
8693
8805
  function rglob_md(root) {
8694
8806
  const out = [];
8695
8807
  const walk = (dir) => {
8696
8808
  let names;
8697
8809
  try {
8698
- names = fs5.readdirSync(dir).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
8810
+ names = fs6.readdirSync(dir).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
8699
8811
  } catch {
8700
8812
  return;
8701
8813
  }
8702
8814
  for (const name of names) {
8703
- const full = path5.join(dir, name);
8815
+ const full = path6.join(dir, name);
8704
8816
  let lst;
8705
8817
  try {
8706
- lst = fs5.lstatSync(full);
8818
+ lst = fs6.lstatSync(full);
8707
8819
  } catch {
8708
8820
  continue;
8709
8821
  }
@@ -8744,8 +8856,8 @@ function splitlines2(text) {
8744
8856
  }
8745
8857
 
8746
8858
  // src/scripts/_lib/rule_layer_overlap.ts
8747
- import * as fs6 from "node:fs";
8748
- import * as path6 from "node:path";
8859
+ import * as fs7 from "node:fs";
8860
+ import * as path7 from "node:path";
8749
8861
  var INSTALLER_PROVENANCE_KEYS = ["package", "source_path"];
8750
8862
  function stripProvenance(text) {
8751
8863
  const lines = text.split("\n");
@@ -8799,14 +8911,14 @@ function compareLayers(global_layer, project_layer) {
8799
8911
  function readRuleLayer(dir) {
8800
8912
  let names;
8801
8913
  try {
8802
- names = fs6.readdirSync(dir);
8914
+ names = fs7.readdirSync(dir);
8803
8915
  } catch {
8804
8916
  return null;
8805
8917
  }
8806
8918
  const files = /* @__PURE__ */ new Map();
8807
8919
  for (const name of names.filter((n) => n.endsWith(".md")).sort()) {
8808
8920
  try {
8809
- files.set(name, fs6.readFileSync(path6.join(dir, name), "utf-8"));
8921
+ files.set(name, fs7.readFileSync(path7.join(dir, name), "utf-8"));
8810
8922
  } catch {
8811
8923
  continue;
8812
8924
  }
@@ -8814,7 +8926,7 @@ function readRuleLayer(dir) {
8814
8926
  return { dir, files };
8815
8927
  }
8816
8928
  function claudeMdExcludesGlob(dir) {
8817
- return `${path6.resolve(dir).replace(/\/+$/, "")}/**`;
8929
+ return `${path7.resolve(dir).replace(/\/+$/, "")}/**`;
8818
8930
  }
8819
8931
  function mergeClaudeMdExcludes(existing, entry) {
8820
8932
  if (!Array.isArray(existing)) return [entry];
@@ -8843,13 +8955,13 @@ function decideLayerAction(report, choice, global_dir, project_dir) {
8843
8955
  }
8844
8956
 
8845
8957
  // src/scripts/_lib/installed_tools.ts
8846
- import * as fs8 from "node:fs";
8958
+ import * as fs9 from "node:fs";
8847
8959
  import * as os4 from "node:os";
8848
8960
  import * as fsPath from "node:path";
8849
8961
 
8850
8962
  // src/scripts/_lib/fs_atomic.ts
8851
- import fs7 from "node:fs";
8852
- import path7 from "node:path";
8963
+ import fs8 from "node:fs";
8964
+ import path8 from "node:path";
8853
8965
  import { randomBytes as randomBytes3 } from "node:crypto";
8854
8966
  function _normalize_encoding(encoding) {
8855
8967
  const compact = encoding.toLowerCase().replace(/[-_\s]/g, "");
@@ -8865,9 +8977,9 @@ function _normalize_encoding(encoding) {
8865
8977
  }
8866
8978
  function write_atomic(p, data, options = {}) {
8867
8979
  const encoding = options.encoding ?? "utf-8";
8868
- const target = path7.normalize(p);
8869
- const parent = path7.dirname(target);
8870
- fs7.mkdirSync(parent, { recursive: true });
8980
+ const target = path8.normalize(p);
8981
+ const parent = path8.dirname(target);
8982
+ fs8.mkdirSync(parent, { recursive: true });
8871
8983
  let payload;
8872
8984
  if (typeof data === "string") {
8873
8985
  payload = Buffer.from(data, _normalize_encoding(encoding));
@@ -8881,12 +8993,12 @@ function write_atomic(p, data, options = {}) {
8881
8993
  let fd = null;
8882
8994
  let tmp_path = "";
8883
8995
  for (let attempt = 0; attempt < 32; attempt += 1) {
8884
- tmp_path = path7.join(
8996
+ tmp_path = path8.join(
8885
8997
  parent,
8886
- `.${path7.basename(target)}.tmp.${randomBytes3(6).toString("hex")}`
8998
+ `.${path8.basename(target)}.tmp.${randomBytes3(6).toString("hex")}`
8887
8999
  );
8888
9000
  try {
8889
- fd = fs7.openSync(tmp_path, "wx", 384);
9001
+ fd = fs8.openSync(tmp_path, "wx", 384);
8890
9002
  break;
8891
9003
  } catch (err) {
8892
9004
  if (err.code === "EEXIST") continue;
@@ -8900,24 +9012,24 @@ function write_atomic(p, data, options = {}) {
8900
9012
  try {
8901
9013
  let offset = 0;
8902
9014
  while (offset < payload.length) {
8903
- offset += fs7.writeSync(fd, payload, offset, payload.length - offset);
9015
+ offset += fs8.writeSync(fd, payload, offset, payload.length - offset);
8904
9016
  }
8905
9017
  try {
8906
- fs7.fsyncSync(fd);
9018
+ fs8.fsyncSync(fd);
8907
9019
  } catch {
8908
9020
  }
8909
- fs7.closeSync(fd);
9021
+ fs8.closeSync(fd);
8910
9022
  closed = true;
8911
- fs7.renameSync(tmp_path, target);
9023
+ fs8.renameSync(tmp_path, target);
8912
9024
  } catch (err) {
8913
9025
  if (!closed) {
8914
9026
  try {
8915
- fs7.closeSync(fd);
9027
+ fs8.closeSync(fd);
8916
9028
  } catch {
8917
9029
  }
8918
9030
  }
8919
9031
  try {
8920
- fs7.unlinkSync(tmp_path);
9032
+ fs8.unlinkSync(tmp_path);
8921
9033
  } catch {
8922
9034
  }
8923
9035
  throw err;
@@ -8928,17 +9040,17 @@ function write_atomic(p, data, options = {}) {
8928
9040
  function _fsync_dir(directory) {
8929
9041
  let dir_fd;
8930
9042
  try {
8931
- dir_fd = fs7.openSync(directory, fs7.constants.O_RDONLY);
9043
+ dir_fd = fs8.openSync(directory, fs8.constants.O_RDONLY);
8932
9044
  } catch {
8933
9045
  return;
8934
9046
  }
8935
9047
  try {
8936
9048
  try {
8937
- fs7.fsyncSync(dir_fd);
9049
+ fs8.fsyncSync(dir_fd);
8938
9050
  } catch {
8939
9051
  }
8940
9052
  } finally {
8941
- fs7.closeSync(dir_fd);
9053
+ fs8.closeSync(dir_fd);
8942
9054
  }
8943
9055
  }
8944
9056
 
@@ -8967,18 +9079,18 @@ function manifest_path(project_root, env) {
8967
9079
  var _TOP_KEY_RE = /^([A-Za-z_][A-Za-z0-9_]*)\s*:\s*"?([^"\n]*?)"?\s*$/;
8968
9080
  var _LIST_DASH_RE = /^\s*-\s*(.+?)\s*$/;
8969
9081
  var _INDENT_KEY_RE = /^\s+([A-Za-z_][A-Za-z0-9_]*)\s*:\s*"?([^"\n]*?)"?\s*$/;
8970
- function read_manifest(path19) {
9082
+ function read_manifest(path20) {
8971
9083
  let text;
8972
9084
  try {
8973
- text = require_read_text(path19);
9085
+ text = require_read_text(path20);
8974
9086
  } catch {
8975
9087
  return null;
8976
9088
  }
8977
9089
  const data = _parse_manual(text);
8978
9090
  return _normalise_v2_shape(data);
8979
9091
  }
8980
- function require_read_text(path19) {
8981
- return fs8.readFileSync(path19, { encoding: "utf-8" });
9092
+ function require_read_text(path20) {
9093
+ return fs9.readFileSync(path20, { encoding: "utf-8" });
8982
9094
  }
8983
9095
  function _normalise_v2_shape(data) {
8984
9096
  if (data["tools"] === void 0 || data["tools"] === null) {
@@ -9159,9 +9271,9 @@ function stable_sort(items, key) {
9159
9271
  return a.index - b.index;
9160
9272
  }).map((entry) => entry.item);
9161
9273
  }
9162
- function write_manifest(path19, version, tools, options = {}) {
9274
+ function write_manifest(path20, version, tools, options = {}) {
9163
9275
  const rendered = _render2(version, tools, { deploy_roots: options.deploy_roots ?? null });
9164
- return write_atomic(path19, rendered);
9276
+ return write_atomic(path20, rendered);
9165
9277
  }
9166
9278
  var ScopeMismatchError = class extends Error {
9167
9279
  name_;
@@ -9252,25 +9364,25 @@ function _today() {
9252
9364
  // src/scripts/_lib/install_drift.ts
9253
9365
  var import_yaml = __toESM(require_dist(), 1);
9254
9366
  import * as crypto from "node:crypto";
9255
- import * as fs9 from "node:fs";
9367
+ import * as fs10 from "node:fs";
9256
9368
  import * as os5 from "node:os";
9257
- import * as path8 from "node:path";
9369
+ import * as path9 from "node:path";
9258
9370
  function expanduser5(p) {
9259
9371
  if (p === "~") {
9260
9372
  return os5.homedir();
9261
9373
  }
9262
9374
  if (p.startsWith("~/") || process.platform === "win32" && p.startsWith("~\\")) {
9263
- return path8.join(os5.homedir(), p.slice(2));
9375
+ return path9.join(os5.homedir(), p.slice(2));
9264
9376
  }
9265
9377
  return p;
9266
9378
  }
9267
9379
  function resolve_entry_path(project_root, raw) {
9268
9380
  const p = expanduser5(raw);
9269
- return path8.isAbsolute(p) ? p : path8.join(project_root, p);
9381
+ return path9.isAbsolute(p) ? p : path9.join(project_root, p);
9270
9382
  }
9271
9383
  function sha256_of_file(p) {
9272
9384
  try {
9273
- return crypto.createHash("sha256").update(fs9.readFileSync(p)).digest("hex");
9385
+ return crypto.createHash("sha256").update(fs10.readFileSync(p)).digest("hex");
9274
9386
  } catch {
9275
9387
  return null;
9276
9388
  }
@@ -9279,7 +9391,7 @@ function collect_drift(project_root, env) {
9279
9391
  const target = manifest_path(project_root, env);
9280
9392
  let text;
9281
9393
  try {
9282
- text = fs9.readFileSync(target, "utf-8");
9394
+ text = fs10.readFileSync(target, "utf-8");
9283
9395
  } catch {
9284
9396
  return null;
9285
9397
  }
@@ -9324,7 +9436,7 @@ function collect_drift(project_root, env) {
9324
9436
  continue;
9325
9437
  }
9326
9438
  const resolved = resolve_entry_path(project_root, raw_path);
9327
- if (!fs9.existsSync(resolved)) {
9439
+ if (!fs10.existsSync(resolved)) {
9328
9440
  out.push({
9329
9441
  tool_id,
9330
9442
  path: resolved,
@@ -9377,9 +9489,9 @@ function format_drift_report(entries) {
9377
9489
  }
9378
9490
 
9379
9491
  // src/scripts/_lib/skill_catalogue.ts
9380
- import * as fs10 from "node:fs";
9381
- import * as path9 from "node:path";
9382
- var OBSERVATION_LOG = path9.join(
9492
+ import * as fs11 from "node:fs";
9493
+ import * as path10 from "node:path";
9494
+ var OBSERVATION_LOG = path10.join(
9383
9495
  "agents",
9384
9496
  "evidence",
9385
9497
  "metrics",
@@ -9423,9 +9535,9 @@ function descriptionOf(frontmatter) {
9423
9535
  return "";
9424
9536
  }
9425
9537
  function readProjectedCatalogue(root) {
9426
- const names = fs10.readdirSync(root).filter((n) => fs10.existsSync(path9.join(root, n, "SKILL.md"))).sort();
9538
+ const names = fs11.readdirSync(root).filter((n) => fs11.existsSync(path10.join(root, n, "SKILL.md"))).sort();
9427
9539
  return names.map((name, index) => {
9428
- const content = fs10.readFileSync(path9.join(root, name, "SKILL.md"), "utf-8");
9540
+ const content = fs11.readFileSync(path10.join(root, name, "SKILL.md"), "utf-8");
9429
9541
  const frontmatter = frontmatterOf(content);
9430
9542
  const description = descriptionOf(frontmatter);
9431
9543
  return {
@@ -9442,12 +9554,12 @@ function truncationModeOf(record) {
9442
9554
  return record.truncation_mode ?? "per-entry";
9443
9555
  }
9444
9556
  function markdownFilesUnder(root) {
9445
- if (!fs10.existsSync(root)) return [];
9557
+ if (!fs11.existsSync(root)) return [];
9446
9558
  const out = [];
9447
9559
  const walk = (dir) => {
9448
- for (const entry of fs10.readdirSync(dir, { withFileTypes: true })) {
9449
- const full = path9.join(dir, entry.name);
9450
- if (fs10.statSync(full).isDirectory()) walk(full);
9560
+ for (const entry of fs11.readdirSync(dir, { withFileTypes: true })) {
9561
+ const full = path10.join(dir, entry.name);
9562
+ if (fs11.statSync(full).isDirectory()) walk(full);
9451
9563
  else if (entry.name.endsWith(".md")) out.push(full);
9452
9564
  }
9453
9565
  };
@@ -9455,9 +9567,9 @@ function markdownFilesUnder(root) {
9455
9567
  return out;
9456
9568
  }
9457
9569
  function measureCatalogueVolume(host, root) {
9458
- const skillsRoot = path9.join(root, "skills");
9459
- const skills = fs10.existsSync(skillsRoot) ? readProjectedCatalogue(skillsRoot) : [];
9460
- const commandEntries = markdownFilesUnder(path9.join(root, "commands")).length;
9570
+ const skillsRoot = path10.join(root, "skills");
9571
+ const skills = fs11.existsSync(skillsRoot) ? readProjectedCatalogue(skillsRoot) : [];
9572
+ const commandEntries = markdownFilesUnder(path10.join(root, "commands")).length;
9461
9573
  return {
9462
9574
  host,
9463
9575
  root,
@@ -9501,6 +9613,7 @@ function catalogueLimitWarning(volume, limit) {
9501
9613
  }
9502
9614
  function migrationEligibility(host, resolvedMode, currentSkillCount, limits) {
9503
9615
  if (resolvedMode === "scoped") return { eligible: false, reason: "already-scoped" };
9616
+ if (resolvedMode === "tiered") return { eligible: false, reason: "already-tiered" };
9504
9617
  const limit = limits.get(host);
9505
9618
  if (limit === void 0) return { eligible: false, reason: "no-observation-for-host" };
9506
9619
  if (limit.projectedSkills === null) return { eligible: false, reason: "observation-not-comparable" };
@@ -9534,9 +9647,9 @@ function migrationPromptLines(host, eligibility, settingsPath) {
9534
9647
  ];
9535
9648
  }
9536
9649
  function readObservationLog(logPath) {
9537
- if (!fs10.existsSync(logPath)) return [];
9650
+ if (!fs11.existsSync(logPath)) return [];
9538
9651
  const out = [];
9539
- for (const line of fs10.readFileSync(logPath, "utf-8").split("\n")) {
9652
+ for (const line of fs11.readFileSync(logPath, "utf-8").split("\n")) {
9540
9653
  const trimmed = line.trim();
9541
9654
  if (trimmed.length === 0) continue;
9542
9655
  try {
@@ -9577,8 +9690,8 @@ function isInteractiveSession(probe) {
9577
9690
 
9578
9691
  // src/scripts/_lib/claude_desktop_bundler.ts
9579
9692
  import * as crypto2 from "node:crypto";
9580
- import * as fs11 from "node:fs";
9581
- import * as path10 from "node:path";
9693
+ import * as fs12 from "node:fs";
9694
+ import * as path11 from "node:path";
9582
9695
 
9583
9696
  // src/scripts/_lib/zip_min.ts
9584
9697
  import * as zlib from "node:zlib";
@@ -9685,7 +9798,7 @@ function _is_excluded(rel_parts) {
9685
9798
  }
9686
9799
  function _is_dir(p) {
9687
9800
  try {
9688
- return fs11.statSync(p).isDirectory();
9801
+ return fs12.statSync(p).isDirectory();
9689
9802
  } catch {
9690
9803
  return false;
9691
9804
  }
@@ -9697,12 +9810,12 @@ function _compare_rel_parts(a, b) {
9697
9810
  }
9698
9811
  function _walk_skill_files(skill_dir) {
9699
9812
  const out = [];
9700
- const resolved = fs11.realpathSync(skill_dir);
9813
+ const resolved = fs12.realpathSync(skill_dir);
9701
9814
  const walk = (root, relRoot) => {
9702
9815
  const dirNames = [];
9703
9816
  const fileNames = [];
9704
- for (const dirent of fs11.readdirSync(root, { withFileTypes: true })) {
9705
- const full = path10.join(root, dirent.name);
9817
+ for (const dirent of fs12.readdirSync(root, { withFileTypes: true })) {
9818
+ const full = path11.join(root, dirent.name);
9706
9819
  const isDir2 = dirent.isDirectory() || dirent.isSymbolicLink() && _is_dir(full);
9707
9820
  if (isDir2) {
9708
9821
  dirNames.push(dirent.name);
@@ -9715,13 +9828,13 @@ function _walk_skill_files(skill_dir) {
9715
9828
  if (_is_excluded(rel_parts)) {
9716
9829
  continue;
9717
9830
  }
9718
- out.push([path10.join(root, fname), rel_parts]);
9831
+ out.push([path11.join(root, fname), rel_parts]);
9719
9832
  }
9720
9833
  for (const dname of dirNames) {
9721
9834
  if (_is_excluded([dname])) {
9722
9835
  continue;
9723
9836
  }
9724
- walk(path10.join(root, dname), [...relRoot, dname]);
9837
+ walk(path11.join(root, dname), [...relRoot, dname]);
9725
9838
  }
9726
9839
  };
9727
9840
  walk(resolved, []);
@@ -9734,53 +9847,53 @@ function _manifest_digest(files) {
9734
9847
  const rel = rel_parts.join("/");
9735
9848
  h.update(Buffer.from(rel, "utf-8"));
9736
9849
  h.update(Buffer.from([0]));
9737
- h.update(crypto2.createHash("sha256").update(fs11.readFileSync(abs_path)).digest());
9850
+ h.update(crypto2.createHash("sha256").update(fs12.readFileSync(abs_path)).digest());
9738
9851
  h.update(Buffer.from([0]));
9739
9852
  }
9740
9853
  return h.digest("hex");
9741
9854
  }
9742
9855
  function _atomic_write_zip(zip_path, files) {
9743
- fs11.mkdirSync(path10.dirname(zip_path), { recursive: true });
9744
- const stem = path10.basename(zip_path, path10.extname(zip_path));
9745
- const tmp_path = path10.join(
9746
- path10.dirname(zip_path),
9856
+ fs12.mkdirSync(path11.dirname(zip_path), { recursive: true });
9857
+ const stem = path11.basename(zip_path, path11.extname(zip_path));
9858
+ const tmp_path = path11.join(
9859
+ path11.dirname(zip_path),
9747
9860
  `.${stem}.${crypto2.randomBytes(6).toString("hex")}.zip.tmp`
9748
9861
  );
9749
9862
  try {
9750
9863
  const entries = files.map(([abs_path, rel_parts]) => ({
9751
9864
  name: rel_parts.join("/"),
9752
- data: fs11.readFileSync(abs_path)
9865
+ data: fs12.readFileSync(abs_path)
9753
9866
  }));
9754
- fs11.writeFileSync(tmp_path, zip_write_sync(entries));
9755
- fs11.renameSync(tmp_path, zip_path);
9867
+ fs12.writeFileSync(tmp_path, zip_write_sync(entries));
9868
+ fs12.renameSync(tmp_path, zip_path);
9756
9869
  } finally {
9757
- if (fs11.existsSync(tmp_path)) {
9758
- fs11.unlinkSync(tmp_path);
9870
+ if (fs12.existsSync(tmp_path)) {
9871
+ fs12.unlinkSync(tmp_path);
9759
9872
  }
9760
9873
  }
9761
9874
  }
9762
9875
  function _write_if_changed(dest_dir, slug, files, force, written) {
9763
9876
  const digest = _manifest_digest(files);
9764
- const zip_path = path10.join(dest_dir, `${slug}.zip`);
9765
- const digest_path = path10.join(dest_dir, `${slug}.sha256`);
9766
- const recorded = fs11.existsSync(digest_path) ? fs11.readFileSync(digest_path, "utf-8").trim() : "";
9767
- if (!force && recorded === digest && fs11.existsSync(zip_path)) {
9877
+ const zip_path = path11.join(dest_dir, `${slug}.zip`);
9878
+ const digest_path = path11.join(dest_dir, `${slug}.sha256`);
9879
+ const recorded = fs12.existsSync(digest_path) ? fs12.readFileSync(digest_path, "utf-8").trim() : "";
9880
+ if (!force && recorded === digest && fs12.existsSync(zip_path)) {
9768
9881
  return;
9769
9882
  }
9770
9883
  _atomic_write_zip(zip_path, files);
9771
- fs11.writeFileSync(digest_path, digest + "\n", "utf-8");
9884
+ fs12.writeFileSync(digest_path, digest + "\n", "utf-8");
9772
9885
  written.push(zip_path);
9773
9886
  }
9774
9887
  function build_skill_bundles(package_root, dest_dir, force = false, curation = null) {
9775
- const skills_root = path10.join(package_root, "dist/agent-src", "skills");
9888
+ const skills_root = path11.join(package_root, "dist/agent-src", "skills");
9776
9889
  if (!_is_dir(skills_root)) {
9777
9890
  return [];
9778
9891
  }
9779
- fs11.mkdirSync(dest_dir, { recursive: true });
9892
+ fs12.mkdirSync(dest_dir, { recursive: true });
9780
9893
  const written = [];
9781
- for (const name of fs11.readdirSync(skills_root).sort()) {
9782
- const entry = path10.join(skills_root, name);
9783
- const isSymlink2 = fs11.lstatSync(entry).isSymbolicLink();
9894
+ for (const name of fs12.readdirSync(skills_root).sort()) {
9895
+ const entry = path11.join(skills_root, name);
9896
+ const isSymlink2 = fs12.lstatSync(entry).isSymbolicLink();
9784
9897
  if (!(_is_dir(entry) || isSymlink2)) {
9785
9898
  continue;
9786
9899
  }
@@ -9788,8 +9901,8 @@ function build_skill_bundles(package_root, dest_dir, force = false, curation = n
9788
9901
  if (curation !== null && !curation.includes(skill_name)) {
9789
9902
  continue;
9790
9903
  }
9791
- const skill_md = path10.join(entry, "SKILL.md");
9792
- if (!fs11.existsSync(skill_md)) {
9904
+ const skill_md = path11.join(entry, "SKILL.md");
9905
+ if (!fs12.existsSync(skill_md)) {
9793
9906
  continue;
9794
9907
  }
9795
9908
  const files = _walk_skill_files(entry);
@@ -9801,15 +9914,15 @@ function build_skill_bundles(package_root, dest_dir, force = false, curation = n
9801
9914
  return written;
9802
9915
  }
9803
9916
  function _command_slug(source_file, commands_root) {
9804
- const rel = path10.relative(commands_root, source_file);
9805
- const noExt = rel.slice(0, rel.length - path10.extname(rel).length);
9806
- return noExt.split(path10.sep).join("-");
9917
+ const rel = path11.relative(commands_root, source_file);
9918
+ const noExt = rel.slice(0, rel.length - path11.extname(rel).length);
9919
+ return noExt.split(path11.sep).join("-");
9807
9920
  }
9808
9921
  function _iter_command_files(commands_root) {
9809
9922
  const found = [];
9810
9923
  const walk = (dir) => {
9811
- for (const dirent of fs11.readdirSync(dir, { withFileTypes: true })) {
9812
- const full = path10.join(dir, dirent.name);
9924
+ for (const dirent of fs12.readdirSync(dir, { withFileTypes: true })) {
9925
+ const full = path11.join(dir, dirent.name);
9813
9926
  if (dirent.isDirectory() || dirent.isSymbolicLink() && _is_dir(full)) {
9814
9927
  walk(full);
9815
9928
  } else if (dirent.name.endsWith(".md")) {
@@ -9819,21 +9932,21 @@ function _iter_command_files(commands_root) {
9819
9932
  };
9820
9933
  walk(commands_root);
9821
9934
  found.sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
9822
- return found.filter((source_file) => path10.basename(source_file) !== "AGENTS.md");
9935
+ return found.filter((source_file) => path11.basename(source_file) !== "AGENTS.md");
9823
9936
  }
9824
9937
  function build_command_bundles(package_root, dest_dir, force = false, curation = null) {
9825
- const commands_root = path10.join(package_root, "dist/agent-src", "commands");
9938
+ const commands_root = path11.join(package_root, "dist/agent-src", "commands");
9826
9939
  if (!_is_dir(commands_root)) {
9827
9940
  return [];
9828
9941
  }
9829
- const skills_root = path10.join(package_root, "dist/agent-src", "skills");
9942
+ const skills_root = path11.join(package_root, "dist/agent-src", "skills");
9830
9943
  let skill_names = /* @__PURE__ */ new Set();
9831
9944
  if (_is_dir(skills_root)) {
9832
9945
  skill_names = new Set(
9833
- fs11.readdirSync(skills_root).filter((name) => _is_dir(path10.join(skills_root, name)))
9946
+ fs12.readdirSync(skills_root).filter((name) => _is_dir(path11.join(skills_root, name)))
9834
9947
  );
9835
9948
  }
9836
- fs11.mkdirSync(dest_dir, { recursive: true });
9949
+ fs12.mkdirSync(dest_dir, { recursive: true });
9837
9950
  const written = [];
9838
9951
  for (const source_file of _iter_command_files(commands_root)) {
9839
9952
  const slug = _command_slug(source_file, commands_root);
@@ -9843,7 +9956,7 @@ function build_command_bundles(package_root, dest_dir, force = false, curation =
9843
9956
  if (curation !== null && !curation.includes(slug)) {
9844
9957
  continue;
9845
9958
  }
9846
- const files = [[fs11.realpathSync(source_file), ["SKILL.md"]]];
9959
+ const files = [[fs12.realpathSync(source_file), ["SKILL.md"]]];
9847
9960
  _write_if_changed(dest_dir, slug, files, force, written);
9848
9961
  }
9849
9962
  return written;
@@ -9851,8 +9964,8 @@ function build_command_bundles(package_root, dest_dir, force = false, curation =
9851
9964
 
9852
9965
  // src/scripts/_lib/claude_settings_hooks.ts
9853
9966
  var YAML = __toESM(require_dist(), 1);
9854
- import * as fs12 from "node:fs";
9855
- import * as path11 from "node:path";
9967
+ import * as fs13 from "node:fs";
9968
+ import * as path12 from "node:path";
9856
9969
 
9857
9970
  // src/install/atomic.ts
9858
9971
  import {
@@ -9860,17 +9973,17 @@ import {
9860
9973
  fsyncSync,
9861
9974
  mkdirSync as mkdirSync5,
9862
9975
  openSync as openSync3,
9863
- readFileSync as readFileSync10,
9976
+ readFileSync as readFileSync11,
9864
9977
  renameSync as renameSync5,
9865
- unlinkSync as unlinkSync4,
9978
+ unlinkSync as unlinkSync5,
9866
9979
  writeSync
9867
9980
  } from "node:fs";
9868
- import { dirname as dirname4, join as join11 } from "node:path";
9981
+ import { dirname as dirname5, join as join12 } from "node:path";
9869
9982
  function atomicWriteFile(target, data, options = {}) {
9870
9983
  const mode = options.mode ?? 420;
9871
- const parent = dirname4(target);
9984
+ const parent = dirname5(target);
9872
9985
  mkdirSync5(parent, { recursive: true });
9873
- const tmp = join11(parent, `.tmp.${process.pid}.${randSuffix()}`);
9986
+ const tmp = join12(parent, `.tmp.${process.pid}.${randSuffix()}`);
9874
9987
  let fd = null;
9875
9988
  try {
9876
9989
  fd = openSync3(tmp, "w", mode);
@@ -9888,7 +10001,7 @@ function atomicWriteFile(target, data, options = {}) {
9888
10001
  }
9889
10002
  }
9890
10003
  try {
9891
- unlinkSync4(tmp);
10004
+ unlinkSync5(tmp);
9892
10005
  } catch {
9893
10006
  }
9894
10007
  throw err;
@@ -9920,7 +10033,7 @@ var SettingsLockError = class extends Error {
9920
10033
  }
9921
10034
  };
9922
10035
  function build_claude_hook_matrix(manifest_path2) {
9923
- const raw = fs12.readFileSync(manifest_path2, "utf8");
10036
+ const raw = fs13.readFileSync(manifest_path2, "utf8");
9924
10037
  const manifest = _yaml_parse(raw) ?? {};
9925
10038
  const hook_spec = manifest["schema_version"] ?? 1;
9926
10039
  const platforms = manifest["platforms"] ?? {};
@@ -9950,8 +10063,8 @@ function _is_managed_group(group) {
9950
10063
  );
9951
10064
  }
9952
10065
  function _read_settings(settings_path) {
9953
- if (!fs12.existsSync(settings_path)) return {};
9954
- const raw = fs12.readFileSync(settings_path, "utf8");
10066
+ if (!fs13.existsSync(settings_path)) return {};
10067
+ const raw = fs13.readFileSync(settings_path, "utf8");
9955
10068
  if (raw.trim() === "") return {};
9956
10069
  let parsed;
9957
10070
  try {
@@ -9966,18 +10079,18 @@ function _read_settings(settings_path) {
9966
10079
  }
9967
10080
  function _with_lock(settings_path, fn) {
9968
10081
  const lockPath = settings_path + ".agent-config.lock";
9969
- fs12.mkdirSync(path11.dirname(lockPath), { recursive: true });
10082
+ fs13.mkdirSync(path12.dirname(lockPath), { recursive: true });
9970
10083
  let fd;
9971
10084
  try {
9972
- fd = fs12.openSync(lockPath, "wx");
10085
+ fd = fs13.openSync(lockPath, "wx");
9973
10086
  } catch {
9974
10087
  throw new SettingsLockError(lockPath);
9975
10088
  }
9976
10089
  try {
9977
10090
  return fn();
9978
10091
  } finally {
9979
- fs12.closeSync(fd);
9980
- fs12.rmSync(lockPath, { force: true });
10092
+ fs13.closeSync(fd);
10093
+ fs13.rmSync(lockPath, { force: true });
9981
10094
  }
9982
10095
  }
9983
10096
  function ensure_managed_hooks(settings_path, matrix) {
@@ -10008,9 +10121,9 @@ function ensure_managed_hooks(settings_path, matrix) {
10008
10121
 
10009
10122
  // src/scripts/_lib/agent_settings.ts
10010
10123
  import { createRequire as createRequire2 } from "node:module";
10011
- import * as fs13 from "node:fs";
10124
+ import * as fs14 from "node:fs";
10012
10125
  import * as os6 from "node:os";
10013
- import * as path12 from "node:path";
10126
+ import * as path13 from "node:path";
10014
10127
  import { fileURLToPath as fileURLToPath2 } from "node:url";
10015
10128
 
10016
10129
  // src/shared/settingsCarveOut.ts
@@ -10108,10 +10221,10 @@ var DEFAULT_PROJECT_FILE = ".agent-settings.yml";
10108
10221
  var LOCAL_PROJECT_FILE = ".agent-settings.local.yml";
10109
10222
  var LOCAL_PROJECT_SUBDIR = ["agents", "settings"];
10110
10223
  function _local_settings_path(project_root) {
10111
- return path12.join(project_root, ...LOCAL_PROJECT_SUBDIR, LOCAL_PROJECT_FILE);
10224
+ return path13.join(project_root, ...LOCAL_PROJECT_SUBDIR, LOCAL_PROJECT_FILE);
10112
10225
  }
10113
10226
  function _canonical_settings_path(project_root) {
10114
- return path12.join(project_root, ...LOCAL_PROJECT_SUBDIR, DEFAULT_PROJECT_FILE);
10227
+ return path13.join(project_root, ...LOCAL_PROJECT_SUBDIR, DEFAULT_PROJECT_FILE);
10115
10228
  }
10116
10229
  var USER_GLOBAL_FILENAME = "agent-settings.yml";
10117
10230
  function DEFAULT_USER_GLOBAL_FILE() {
@@ -10165,10 +10278,10 @@ var MERGEABLE_KEYS = [
10165
10278
  "knowledge.global_sharing.freshness.hypothesis_after_days",
10166
10279
  "knowledge.global_sharing.freshness.stale_after_days"
10167
10280
  ];
10168
- var TEMPLATE_RELATIVE = path12.join("src", "config", "agent-settings.template.yml");
10169
- var _PACKAGE_ROOT = path12.resolve(path12.dirname(fileURLToPath2(import.meta.url)), "..", "..", "..");
10281
+ var TEMPLATE_RELATIVE = path13.join("src", "config", "agent-settings.template.yml");
10282
+ var _PACKAGE_ROOT = path13.resolve(path13.dirname(fileURLToPath2(import.meta.url)), "..", "..", "..");
10170
10283
  function default_template_path() {
10171
- return path12.join(_PACKAGE_ROOT, TEMPLATE_RELATIVE);
10284
+ return path13.join(_PACKAGE_ROOT, TEMPLATE_RELATIVE);
10172
10285
  }
10173
10286
  function _is_placeholder(value) {
10174
10287
  return typeof value === "string" && /^__[A-Z0-9_]+__$/.test(value);
@@ -10219,8 +10332,8 @@ var _AGENTS_DIR_MARKERS = [
10219
10332
  var _LEGACY_ANCHOR_ENV = "AGENT_CONFIG_LEGACY_ANCHOR";
10220
10333
  function _exists(p) {
10221
10334
  try {
10222
- fs13.lstatSync(p);
10223
- fs13.statSync(p);
10335
+ fs14.lstatSync(p);
10336
+ fs14.statSync(p);
10224
10337
  return true;
10225
10338
  } catch {
10226
10339
  return false;
@@ -10228,22 +10341,22 @@ function _exists(p) {
10228
10341
  }
10229
10342
  function _is_dir2(p) {
10230
10343
  try {
10231
- return fs13.statSync(p).isDirectory();
10344
+ return fs14.statSync(p).isDirectory();
10232
10345
  } catch {
10233
10346
  return false;
10234
10347
  }
10235
10348
  }
10236
10349
  function _is_file(p) {
10237
10350
  try {
10238
- return fs13.statSync(p).isFile();
10351
+ return fs14.statSync(p).isFile();
10239
10352
  } catch {
10240
10353
  return false;
10241
10354
  }
10242
10355
  }
10243
10356
  function _resolve(p) {
10244
- const absolute = path12.resolve(p);
10357
+ const absolute = path13.resolve(p);
10245
10358
  try {
10246
- return fs13.realpathSync(absolute);
10359
+ return fs14.realpathSync(absolute);
10247
10360
  } catch {
10248
10361
  return absolute;
10249
10362
  }
@@ -10253,7 +10366,7 @@ function _ancestor_chain(start) {
10253
10366
  let cursor = start;
10254
10367
  for (; ; ) {
10255
10368
  chain.push(cursor);
10256
- const parent = path12.dirname(cursor);
10369
+ const parent = path13.dirname(cursor);
10257
10370
  if (parent === cursor) {
10258
10371
  break;
10259
10372
  }
@@ -10262,15 +10375,15 @@ function _ancestor_chain(start) {
10262
10375
  return chain;
10263
10376
  }
10264
10377
  function _boundary_anchor_at(dir) {
10265
- const agents_dir = path12.join(dir, "agents");
10378
+ const agents_dir = path13.join(dir, "agents");
10266
10379
  if (_is_dir2(agents_dir)) {
10267
10380
  for (const marker of _AGENTS_DIR_MARKERS) {
10268
- if (_exists(path12.join(agents_dir, marker))) {
10381
+ if (_exists(path13.join(agents_dir, marker))) {
10269
10382
  return ANCHOR_AGENTS_DIR;
10270
10383
  }
10271
10384
  }
10272
10385
  }
10273
- if (_exists(path12.join(dir, ".git"))) {
10386
+ if (_exists(path13.join(dir, ".git"))) {
10274
10387
  return ANCHOR_GIT;
10275
10388
  }
10276
10389
  return null;
@@ -10281,7 +10394,7 @@ function find_project_root_with_anchor(start) {
10281
10394
  const chain = _ancestor_chain(current);
10282
10395
  if (legacy) {
10283
10396
  for (const candidate of chain) {
10284
- if (_exists(path12.join(candidate, ".git"))) {
10397
+ if (_exists(path13.join(candidate, ".git"))) {
10285
10398
  return [candidate, ANCHOR_GIT];
10286
10399
  }
10287
10400
  }
@@ -10295,7 +10408,7 @@ function find_project_root_with_anchor(start) {
10295
10408
  }
10296
10409
  let outermost = null;
10297
10410
  for (const candidate of chain) {
10298
- if (_exists(path12.join(candidate, DEFAULT_PROJECT_FILE))) {
10411
+ if (_exists(path13.join(candidate, DEFAULT_PROJECT_FILE))) {
10299
10412
  outermost = candidate;
10300
10413
  }
10301
10414
  }
@@ -10339,7 +10452,7 @@ function _expanduser(p) {
10339
10452
  return os6.homedir();
10340
10453
  }
10341
10454
  if (p.startsWith("~/") || process.platform === "win32" && p.startsWith("~\\")) {
10342
- return path12.join(os6.homedir(), p.slice(2));
10455
+ return path13.join(os6.homedir(), p.slice(2));
10343
10456
  }
10344
10457
  return p;
10345
10458
  }
@@ -10368,13 +10481,13 @@ function resolve_project_root(arg, options = {}) {
10368
10481
  function _resolve_cascade_paths(cwd, project_path) {
10369
10482
  if (cwd === null) {
10370
10483
  const legacy = project_path ? project_path : DEFAULT_PROJECT_FILE;
10371
- const parent = path12.dirname(legacy);
10484
+ const parent = path13.dirname(legacy);
10372
10485
  return [legacy, _canonical_settings_path(parent), _local_settings_path(parent)];
10373
10486
  }
10374
10487
  const root = find_project_root(cwd);
10375
10488
  if (root === null) {
10376
10489
  const legacy = project_path ? project_path : DEFAULT_PROJECT_FILE;
10377
- const parent = path12.dirname(legacy);
10490
+ const parent = path13.dirname(legacy);
10378
10491
  return [legacy, _canonical_settings_path(parent), _local_settings_path(parent)];
10379
10492
  }
10380
10493
  const cwd_resolved = _resolve(cwd);
@@ -10385,7 +10498,7 @@ function _resolve_cascade_paths(cwd, project_path) {
10385
10498
  if (cursor === root) {
10386
10499
  break;
10387
10500
  }
10388
- const parent = path12.dirname(cursor);
10501
+ const parent = path13.dirname(cursor);
10389
10502
  if (parent === cursor) {
10390
10503
  break;
10391
10504
  }
@@ -10393,7 +10506,7 @@ function _resolve_cascade_paths(cwd, project_path) {
10393
10506
  }
10394
10507
  chain.reverse();
10395
10508
  return [
10396
- ...chain.map((d) => path12.join(d, DEFAULT_PROJECT_FILE)),
10509
+ ...chain.map((d) => path13.join(d, DEFAULT_PROJECT_FILE)),
10397
10510
  _canonical_settings_path(root),
10398
10511
  _local_settings_path(root)
10399
10512
  ];
@@ -10480,7 +10593,7 @@ function _read_yaml(p) {
10480
10593
  }
10481
10594
  let data;
10482
10595
  try {
10483
- const text = fs13.readFileSync(p, "utf-8");
10596
+ const text = fs14.readFileSync(p, "utf-8");
10484
10597
  data = YAML3.parse(text, { version: "1.1" });
10485
10598
  if (data === null || data === void 0) {
10486
10599
  data = {};
@@ -10580,11 +10693,11 @@ function _is_plain_dict(value) {
10580
10693
  }
10581
10694
 
10582
10695
  // src/install/rule_scope.ts
10583
- import * as path13 from "node:path";
10696
+ import * as path14 from "node:path";
10584
10697
 
10585
10698
  // src/install/ruleInScope.ts
10586
10699
  var YAML2 = __toESM(require_dist(), 1);
10587
- import * as fs14 from "node:fs";
10700
+ import * as fs15 from "node:fs";
10588
10701
  function parseYaml2(text) {
10589
10702
  try {
10590
10703
  const data = YAML2.parse(text, { version: "1.1" });
@@ -10622,7 +10735,7 @@ function rule_in_scope(source_path, scope, pack_scope = null, role_scope = null)
10622
10735
  if (scope === null && pack_scope === null && role_scope === null) {
10623
10736
  return true;
10624
10737
  }
10625
- const [meta] = parseFrontmatter(fs14.readFileSync(source_path, "utf-8"));
10738
+ const [meta] = parseFrontmatter(fs15.readFileSync(source_path, "utf-8"));
10626
10739
  if (meta["type"] === "always" || meta["alwaysApply"] === true) {
10627
10740
  return true;
10628
10741
  }
@@ -10673,34 +10786,34 @@ function ruleFileArrives(sourcePath, scope) {
10673
10786
  if (!sourcePath.endsWith(".md")) {
10674
10787
  return true;
10675
10788
  }
10676
- const basename6 = path13.basename(sourcePath);
10677
- if (COMPAT_ALWAYS_EXCLUDED.includes(basename6)) {
10789
+ const basename7 = path14.basename(sourcePath);
10790
+ if (COMPAT_ALWAYS_EXCLUDED.includes(basename7)) {
10678
10791
  return false;
10679
10792
  }
10680
10793
  return rule_in_scope(sourcePath, scope.workspaces, scope.packs, scope.roles ?? null);
10681
10794
  }
10682
10795
 
10683
10796
  // src/install/partitionEligibility.ts
10684
- import * as fs16 from "node:fs";
10797
+ import * as fs17 from "node:fs";
10685
10798
  import * as os7 from "node:os";
10686
10799
 
10687
10800
  // src/install/hostLayerFingerprint.ts
10688
10801
  import { createHash as createHash4 } from "node:crypto";
10689
- import * as fs15 from "node:fs";
10690
- import * as path14 from "node:path";
10802
+ import * as fs16 from "node:fs";
10803
+ import * as path15 from "node:path";
10691
10804
  var FINGERPRINT_SCHEMA = 1;
10692
10805
  function collectFiles(dir) {
10693
10806
  const out = [];
10694
10807
  const walk = (d) => {
10695
10808
  let entries;
10696
10809
  try {
10697
- entries = fs15.readdirSync(d, { withFileTypes: true });
10810
+ entries = fs16.readdirSync(d, { withFileTypes: true });
10698
10811
  } catch {
10699
10812
  return;
10700
10813
  }
10701
10814
  const sorted = [...entries].sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0);
10702
10815
  for (const e of sorted) {
10703
- const p = path14.join(d, e.name);
10816
+ const p = path15.join(d, e.name);
10704
10817
  if (e.isDirectory()) {
10705
10818
  walk(p);
10706
10819
  } else if (e.isFile()) {
@@ -10717,10 +10830,10 @@ function fingerprintLayers(layers) {
10717
10830
  for (const layer of layers) {
10718
10831
  h.update(`layer:${layer.label}\0`);
10719
10832
  for (const file of collectFiles(layer.root)) {
10720
- h.update(path14.relative(layer.root, file));
10833
+ h.update(path15.relative(layer.root, file));
10721
10834
  h.update("\0");
10722
10835
  try {
10723
- h.update(fs15.readFileSync(file));
10836
+ h.update(fs16.readFileSync(file));
10724
10837
  } catch {
10725
10838
  h.update("\0unreadable\0");
10726
10839
  }
@@ -10730,11 +10843,11 @@ function fingerprintLayers(layers) {
10730
10843
  return h.digest("hex");
10731
10844
  }
10732
10845
  function hostLayerInputs(userHome) {
10733
- const claude = path14.join(userHome, ".claude");
10846
+ const claude = path15.join(userHome, ".claude");
10734
10847
  return [
10735
- { label: "rules", root: path14.join(claude, "rules") },
10736
- { label: "skills", root: path14.join(claude, "skills") },
10737
- { label: "commands", root: path14.join(claude, "commands") }
10848
+ { label: "rules", root: path15.join(claude, "rules") },
10849
+ { label: "skills", root: path15.join(claude, "skills") },
10850
+ { label: "commands", root: path15.join(claude, "commands") }
10738
10851
  ];
10739
10852
  }
10740
10853
 
@@ -10743,7 +10856,7 @@ var MAINTAINER_WORKSPACE = "agent-config-maintainer";
10743
10856
  function isExclusivelyPackageOnly(source_path) {
10744
10857
  let meta;
10745
10858
  try {
10746
- [meta] = parseFrontmatter(fs16.readFileSync(source_path, "utf-8"));
10859
+ [meta] = parseFrontmatter(fs17.readFileSync(source_path, "utf-8"));
10747
10860
  } catch {
10748
10861
  return false;
10749
10862
  }
@@ -11324,8 +11437,8 @@ function getErrorMap() {
11324
11437
 
11325
11438
  // node_modules/zod/v3/helpers/parseUtil.js
11326
11439
  var makeIssue = (params) => {
11327
- const { data, path: path19, errorMaps, issueData } = params;
11328
- const fullPath = [...path19, ...issueData.path || []];
11440
+ const { data, path: path20, errorMaps, issueData } = params;
11441
+ const fullPath = [...path20, ...issueData.path || []];
11329
11442
  const fullIssue = {
11330
11443
  ...issueData,
11331
11444
  path: fullPath
@@ -11441,11 +11554,11 @@ var errorUtil;
11441
11554
 
11442
11555
  // node_modules/zod/v3/types.js
11443
11556
  var ParseInputLazyPath = class {
11444
- constructor(parent, value, path19, key) {
11557
+ constructor(parent, value, path20, key) {
11445
11558
  this._cachedPath = [];
11446
11559
  this.parent = parent;
11447
11560
  this.data = value;
11448
- this._path = path19;
11561
+ this._path = path20;
11449
11562
  this._key = key;
11450
11563
  }
11451
11564
  get path() {
@@ -15378,6 +15491,11 @@ var settingsSchema = external_exports.object({
15378
15491
  "PreToolUse anti-slop nudge (road-to-anti-slop-detector Phase 3). Default off. When on, runs the lint_design_slop registry against about-to-be-written UI content and WARNS (never blocks) on P0/P1 aesthetic tells (side-stripe, gradient-text, magic z-index, \u2026). Flags are rebuttable via DESIGN.md / design-slop-disable. Anti-loop: a file::rule signature surfaced 3x goes silent. Host-limited convenience layer; the universal gate is the lint_design_slop linter/CI."
15379
15492
  )
15380
15493
  }).default({}),
15494
+ design_pass: external_exports.object({
15495
+ enabled: external_exports.boolean().default(false).describe(
15496
+ "PostToolUse + stop design pass (road-to-frontend-power E1.1/E1.2/E1.3). Default off. One concern on two slots: on post_tool_use a write to a UI surface delivers the design findings as context and never blocks; on stop the same pass runs over every UI file touched this session, deduped against what the post pass surfaced, and a P0 objective floor (contrast, font size, heading skip, focus) blocks with a continuation. P1-P3 never block. post_tool_use rather than pre_tool_use for two measured reasons: pre_tool_use is declared by three hosts and honoured by one while post_tool_use is declared by six, and _lib/ui_surface.ts is a path predicate, so a pre-write gate cannot fire on the first write of a new surface. A pass that could not fully run reports verification: degraded with a reason rather than passing silently. Does not replace design_slop: two design keys is the honest state until the tiering experiment has a number."
15497
+ )
15498
+ }).default({}),
15381
15499
  ui_route_nudge: external_exports.object({
15382
15500
  enabled: external_exports.boolean().default(false).describe(
15383
15501
  "PreToolUse UI-route nudge (road-to-frontend-skill-application Phase 4). Default off. When on, a Write/Edit to a UI surface with no design consultation latched this session WARNS (never blocks) naming the route \u2014 run existing-ui-audit, then the fe-design loop. A read or search touching fe-design / existing-ui-audit / design-review / design-intelligence latches consultation and silences it for the session. Anti-loop: at most 2 nudges per session. It does not read the rules: the UI-surface decision comes from _lib/ui_surface.ts and no code parses rule frontmatter, so this runs parallel to the two UI rules rather than consuming their triggers, and a test keeps the sets from drifting. It is a nudge, so their enforced_by: none stays accurate."
@@ -16723,8 +16841,8 @@ var zodToJsonSchema = (schema, options) => {
16723
16841
  };
16724
16842
 
16725
16843
  // src/scripts/_lib/module_detection.ts
16726
- import * as fs17 from "node:fs";
16727
- import * as path15 from "node:path";
16844
+ import * as fs18 from "node:fs";
16845
+ import * as path16 from "node:path";
16728
16846
  var _SKIP_DIRS = /* @__PURE__ */ new Set([".module-template", ".example"]);
16729
16847
  var _RULES = [
16730
16848
  ["app/Modules", "laravel-hmvc", "App\\Modules\\{ModuleName}"],
@@ -16738,14 +16856,14 @@ var _RULES = [
16738
16856
  ];
16739
16857
  function _isDir(p) {
16740
16858
  try {
16741
- return fs17.statSync(p).isDirectory();
16859
+ return fs18.statSync(p).isDirectory();
16742
16860
  } catch {
16743
16861
  return false;
16744
16862
  }
16745
16863
  }
16746
16864
  function _isFile(p) {
16747
16865
  try {
16748
- return fs17.statSync(p).isFile();
16866
+ return fs18.statSync(p).isFile();
16749
16867
  } catch {
16750
16868
  return false;
16751
16869
  }
@@ -16759,13 +16877,13 @@ function _isUpperChar(ch) {
16759
16877
  function _list_module_subdirs(root) {
16760
16878
  let entries;
16761
16879
  try {
16762
- entries = fs17.readdirSync(root).sort();
16880
+ entries = fs18.readdirSync(root).sort();
16763
16881
  } catch {
16764
16882
  return [];
16765
16883
  }
16766
16884
  const out = [];
16767
16885
  for (const name of entries) {
16768
- if (!_isDir(path15.join(root, name))) {
16886
+ if (!_isDir(path16.join(root, name))) {
16769
16887
  continue;
16770
16888
  }
16771
16889
  if (name.startsWith(".")) {
@@ -16787,11 +16905,11 @@ function _score_confidence(stack, root, subdirs) {
16787
16905
  return capitalized.length > 0 ? "high" : "medium";
16788
16906
  }
16789
16907
  if (stack === "node-monorepo") {
16790
- const withPkgJson = subdirs.filter((name) => _isFile(path15.join(root, name, "package.json")));
16908
+ const withPkgJson = subdirs.filter((name) => _isFile(path16.join(root, name, "package.json")));
16791
16909
  return withPkgJson.length > 0 ? "high" : "medium";
16792
16910
  }
16793
16911
  if (stack === "python-src") {
16794
- const withInit = subdirs.filter((name) => _isFile(path15.join(root, name, "__init__.py")));
16912
+ const withInit = subdirs.filter((name) => _isFile(path16.join(root, name, "__init__.py")));
16795
16913
  return withInit.length > 0 ? "high" : "medium";
16796
16914
  }
16797
16915
  if (stack === "go-internal") {
@@ -16803,7 +16921,7 @@ function detect_module_roots(project_root) {
16803
16921
  const high = [];
16804
16922
  const medium = [];
16805
16923
  for (const [rel_path, stack, namespace_template] of _RULES) {
16806
- const abs_path = path15.join(project_root, rel_path);
16924
+ const abs_path = path16.join(project_root, rel_path);
16807
16925
  if (!_isDir(abs_path)) {
16808
16926
  continue;
16809
16927
  }
@@ -16825,7 +16943,7 @@ function detect_module_roots(project_root) {
16825
16943
  }
16826
16944
 
16827
16945
  // src/scripts/_lib/model_tier.ts
16828
- import fs18 from "node:fs";
16946
+ import fs19 from "node:fs";
16829
16947
  var TIER_TO_CLAUDE_MODEL = {
16830
16948
  frontier: "fable",
16831
16949
  high: "opus",
@@ -16834,8 +16952,8 @@ var TIER_TO_CLAUDE_MODEL = {
16834
16952
  };
16835
16953
  var MODEL_TIER_RE = /^model_tier:\s*"?([a-z]+)"?\s*$/m;
16836
16954
  function read_model_tier(skill_md) {
16837
- if (!fs18.existsSync(skill_md)) return null;
16838
- const text = fs18.readFileSync(skill_md).toString("utf-8");
16955
+ if (!fs19.existsSync(skill_md)) return null;
16956
+ const text = fs19.readFileSync(skill_md).toString("utf-8");
16839
16957
  if (!text.startsWith("---\n")) return null;
16840
16958
  const end = text.indexOf("\n---\n", 4);
16841
16959
  if (end === -1) return null;
@@ -16852,39 +16970,39 @@ function render_native_model_md(text, tier) {
16852
16970
 
16853
16971
  // src/scripts/_cli/cmd_migrate.ts
16854
16972
  import { spawnSync } from "node:child_process";
16855
- import * as fs20 from "node:fs";
16856
- import * as path17 from "node:path";
16973
+ import * as fs21 from "node:fs";
16974
+ import * as path18 from "node:path";
16857
16975
  import process2 from "node:process";
16858
16976
  import { fileURLToPath as fileURLToPath4, pathToFileURL } from "node:url";
16859
16977
 
16860
16978
  // src/scripts/_lib/package_root.ts
16861
- import * as fs19 from "node:fs";
16862
- import * as path16 from "node:path";
16979
+ import * as fs20 from "node:fs";
16980
+ import * as path17 from "node:path";
16863
16981
  import { fileURLToPath as fileURLToPath3 } from "node:url";
16864
16982
  var PACKAGE_NAME = "@event4u/agent-config";
16865
16983
  var MAX_ASCENT = 16;
16866
16984
  function resolvePackageRoot(fromUrlOrPath, legacyHops = 3) {
16867
16985
  const start = fromUrlOrPath.startsWith("file:") ? fileURLToPath3(fromUrlOrPath) : fromUrlOrPath;
16868
- const startDir = path16.dirname(start);
16986
+ const startDir = path17.dirname(start);
16869
16987
  let dir = startDir;
16870
16988
  for (let i = 0; i < MAX_ASCENT; i++) {
16871
- const manifest = path16.join(dir, "package.json");
16872
- if (fs19.existsSync(manifest)) {
16989
+ const manifest = path17.join(dir, "package.json");
16990
+ if (fs20.existsSync(manifest)) {
16873
16991
  try {
16874
- const parsed = JSON.parse(fs19.readFileSync(manifest, "utf8"));
16992
+ const parsed = JSON.parse(fs20.readFileSync(manifest, "utf8"));
16875
16993
  if (parsed.name === PACKAGE_NAME) {
16876
16994
  return dir;
16877
16995
  }
16878
16996
  } catch {
16879
16997
  }
16880
16998
  }
16881
- const parent = path16.dirname(dir);
16999
+ const parent = path17.dirname(dir);
16882
17000
  if (parent === dir) {
16883
17001
  break;
16884
17002
  }
16885
17003
  dir = parent;
16886
17004
  }
16887
- return path16.resolve(startDir, ...Array.from({ length: legacyHops }, () => ".."));
17005
+ return path17.resolve(startDir, ...Array.from({ length: legacyHops }, () => ".."));
16888
17006
  }
16889
17007
 
16890
17008
  // src/scripts/_cli/cmd_migrate.ts
@@ -16905,7 +17023,7 @@ var LEGACY_SETTINGS_FILES = [".agent-settings.yml", ".agent-user.yml"];
16905
17023
  var LEGACY_STATE_FILENAME = ".implement-ticket-state.json";
16906
17024
  var LEGACY_STATE_V1_FILENAME = ".work-state.json";
16907
17025
  var LEGACY_AGENT_CONFIG_SHELL = "agent-config";
16908
- var _HERE_DIR = path17.dirname(fileURLToPath4(import.meta.url));
17026
+ var _HERE_DIR = path18.dirname(fileURLToPath4(import.meta.url));
16909
17027
  var ArgparseExit = class extends Error {
16910
17028
  code;
16911
17029
  constructor(code) {
@@ -17004,38 +17122,38 @@ function _jsonDumpsIndentAscii(value, indent) {
17004
17122
  }
17005
17123
  function _isFile2(p) {
17006
17124
  try {
17007
- return fs20.statSync(p).isFile();
17125
+ return fs21.statSync(p).isFile();
17008
17126
  } catch {
17009
17127
  return false;
17010
17128
  }
17011
17129
  }
17012
17130
  function _isDir2(p) {
17013
17131
  try {
17014
- return fs20.statSync(p).isDirectory();
17132
+ return fs21.statSync(p).isDirectory();
17015
17133
  } catch {
17016
17134
  return false;
17017
17135
  }
17018
17136
  }
17019
17137
  function _isSymlink(p) {
17020
17138
  try {
17021
- return fs20.lstatSync(p).isSymbolicLink();
17139
+ return fs21.lstatSync(p).isSymbolicLink();
17022
17140
  } catch {
17023
17141
  return false;
17024
17142
  }
17025
17143
  }
17026
17144
  function _exists2(p) {
17027
17145
  try {
17028
- fs20.lstatSync(p);
17146
+ fs21.lstatSync(p);
17029
17147
  return true;
17030
17148
  } catch {
17031
17149
  return false;
17032
17150
  }
17033
17151
  }
17034
17152
  function _readText(p) {
17035
- return fs20.readFileSync(p, { encoding: "utf-8" });
17153
+ return fs21.readFileSync(p, { encoding: "utf-8" });
17036
17154
  }
17037
17155
  function _writeText(p, text) {
17038
- fs20.writeFileSync(p, text, { encoding: "utf-8" });
17156
+ fs21.writeFileSync(p, text, { encoding: "utf-8" });
17039
17157
  }
17040
17158
  function _jsonLoadFile(p) {
17041
17159
  return JSON.parse(_readText(p));
@@ -17091,7 +17209,7 @@ function _classify_symlink(link) {
17091
17209
  }
17092
17210
  let target;
17093
17211
  try {
17094
- target = fs20.readlinkSync(link);
17212
+ target = fs21.readlinkSync(link);
17095
17213
  } catch {
17096
17214
  return null;
17097
17215
  }
@@ -17102,16 +17220,16 @@ function _classify_symlink(link) {
17102
17220
  return "user";
17103
17221
  }
17104
17222
  function _detect_legacy_state(project) {
17105
- return _isFile2(path17.join(project, LEGACY_STATE_FILENAME));
17223
+ return _isFile2(path18.join(project, LEGACY_STATE_FILENAME));
17106
17224
  }
17107
17225
  function _detect_legacy_settings(project) {
17108
17226
  const found = [];
17109
17227
  for (const name of LEGACY_SETTINGS_FILES) {
17110
- const flat = path17.join(project, name);
17228
+ const flat = path18.join(project, name);
17111
17229
  if (_isFile2(flat)) {
17112
17230
  found.push(flat);
17113
17231
  }
17114
- const typed = path17.join(project, "settings", name);
17232
+ const typed = path18.join(project, "settings", name);
17115
17233
  if (_isFile2(typed)) {
17116
17234
  found.push(typed);
17117
17235
  }
@@ -17119,25 +17237,25 @@ function _detect_legacy_settings(project) {
17119
17237
  return found;
17120
17238
  }
17121
17239
  function _detect_empty_shell(project) {
17122
- const shell = path17.join(project, LEGACY_AGENT_CONFIG_SHELL);
17240
+ const shell = path18.join(project, LEGACY_AGENT_CONFIG_SHELL);
17123
17241
  if (!_isDir2(shell) || _isSymlink(shell)) {
17124
17242
  return false;
17125
17243
  }
17126
17244
  try {
17127
- return fs20.readdirSync(shell).length === 0;
17245
+ return fs21.readdirSync(shell).length === 0;
17128
17246
  } catch {
17129
17247
  return false;
17130
17248
  }
17131
17249
  }
17132
17250
  function _detect_already_migrated(project) {
17133
- if (_detect_npm(path17.join(project, "package.json"))) {
17251
+ if (_detect_npm(path18.join(project, "package.json"))) {
17134
17252
  return false;
17135
17253
  }
17136
- if (_detect_composer(path17.join(project, "composer.json"))) {
17254
+ if (_detect_composer(path18.join(project, "composer.json"))) {
17137
17255
  return false;
17138
17256
  }
17139
17257
  for (const name of MANAGED_SYMLINKS) {
17140
- if (_classify_symlink(path17.join(project, name)) === "legacy") {
17258
+ if (_classify_symlink(path18.join(project, name)) === "legacy") {
17141
17259
  return false;
17142
17260
  }
17143
17261
  }
@@ -17208,11 +17326,11 @@ function _purge_legacy_symlinks(project) {
17208
17326
  const removed = [];
17209
17327
  const preserved = [];
17210
17328
  for (const name of MANAGED_SYMLINKS) {
17211
- const link = path17.join(project, name);
17329
+ const link = path18.join(project, name);
17212
17330
  const kind = _classify_symlink(link);
17213
17331
  if (kind === "legacy") {
17214
17332
  try {
17215
- fs20.unlinkSync(link);
17333
+ fs21.unlinkSync(link);
17216
17334
  removed.push(name);
17217
17335
  } catch {
17218
17336
  preserved.push(name);
@@ -17224,14 +17342,14 @@ function _purge_legacy_symlinks(project) {
17224
17342
  return [removed, preserved];
17225
17343
  }
17226
17344
  function _migrate_state_file(project) {
17227
- const source = path17.join(project, LEGACY_STATE_FILENAME);
17345
+ const source = path18.join(project, LEGACY_STATE_FILENAME);
17228
17346
  if (!_isFile2(source)) {
17229
17347
  return null;
17230
17348
  }
17231
- const target = path17.join(project, LEGACY_STATE_V1_FILENAME);
17349
+ const target = path18.join(project, LEGACY_STATE_V1_FILENAME);
17232
17350
  if (_exists2(target)) {
17233
17351
  try {
17234
- fs20.unlinkSync(source);
17352
+ fs21.unlinkSync(source);
17235
17353
  return `removed stale ${LEGACY_STATE_FILENAME} (v1 already present)`;
17236
17354
  } catch {
17237
17355
  return null;
@@ -17246,7 +17364,7 @@ function _migrate_state_file(project) {
17246
17364
  }
17247
17365
  function _load_state_migrator() {
17248
17366
  const pkg_root = resolvePackageRoot(import.meta.url);
17249
- const rel = path17.join(
17367
+ const rel = path18.join(
17250
17368
  "agent-src",
17251
17369
  "templates",
17252
17370
  "scripts",
@@ -17254,8 +17372,8 @@ function _load_state_migrator() {
17254
17372
  "migration",
17255
17373
  "v0_to_v1.ts"
17256
17374
  );
17257
- const driver = [path17.join(pkg_root, "dist", rel), path17.join(pkg_root, "src", rel)].find(
17258
- (p) => fs20.existsSync(p)
17375
+ const driver = [path18.join(pkg_root, "dist", rel), path18.join(pkg_root, "src", rel)].find(
17376
+ (p) => fs21.existsSync(p)
17259
17377
  ) ?? null;
17260
17378
  if (driver === null) {
17261
17379
  return null;
@@ -17263,12 +17381,12 @@ function _load_state_migrator() {
17263
17381
  const binName = process2.platform === "win32" ? "tsx.cmd" : "tsx";
17264
17382
  let tsxBin = null;
17265
17383
  for (let dir = pkg_root; ; ) {
17266
- const cand = path17.join(dir, "node_modules", ".bin", binName);
17267
- if (fs20.existsSync(cand)) {
17384
+ const cand = path18.join(dir, "node_modules", ".bin", binName);
17385
+ if (fs21.existsSync(cand)) {
17268
17386
  tsxBin = cand;
17269
17387
  break;
17270
17388
  }
17271
- const parent = path17.dirname(dir);
17389
+ const parent = path18.dirname(dir);
17272
17390
  if (parent === dir) break;
17273
17391
  dir = parent;
17274
17392
  }
@@ -17295,17 +17413,17 @@ function _delete_legacy_settings(project) {
17295
17413
  const removed = [];
17296
17414
  for (const p of _detect_legacy_settings(project)) {
17297
17415
  try {
17298
- fs20.unlinkSync(p);
17299
- removed.push(path17.relative(project, p));
17416
+ fs21.unlinkSync(p);
17417
+ removed.push(path18.relative(project, p));
17300
17418
  } catch {
17301
17419
  continue;
17302
17420
  }
17303
17421
  }
17304
- const settings_dir = path17.join(project, "settings");
17422
+ const settings_dir = path18.join(project, "settings");
17305
17423
  if (_isDir2(settings_dir) && !_isSymlink(settings_dir)) {
17306
17424
  try {
17307
- if (fs20.readdirSync(settings_dir).length === 0) {
17308
- fs20.rmdirSync(settings_dir);
17425
+ if (fs21.readdirSync(settings_dir).length === 0) {
17426
+ fs21.rmdirSync(settings_dir);
17309
17427
  removed.push("settings/");
17310
17428
  }
17311
17429
  } catch {
@@ -17314,12 +17432,12 @@ function _delete_legacy_settings(project) {
17314
17432
  return removed;
17315
17433
  }
17316
17434
  function _remove_empty_shell(project) {
17317
- const shell = path17.join(project, LEGACY_AGENT_CONFIG_SHELL);
17435
+ const shell = path18.join(project, LEGACY_AGENT_CONFIG_SHELL);
17318
17436
  if (!_detect_empty_shell(project)) {
17319
17437
  return false;
17320
17438
  }
17321
17439
  try {
17322
- fs20.rmdirSync(shell);
17440
+ fs21.rmdirSync(shell);
17323
17441
  } catch {
17324
17442
  return false;
17325
17443
  }
@@ -17329,7 +17447,7 @@ function _reEscape(s) {
17329
17447
  return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
17330
17448
  }
17331
17449
  function _update_gitignore(project) {
17332
- const gitignore = path17.join(project, ".gitignore");
17450
+ const gitignore = path18.join(project, ".gitignore");
17333
17451
  const block = `${GITIGNORE_BLOCK_START}
17334
17452
  ${GITIGNORE_NEW_BODY}${GITIGNORE_BLOCK_END}
17335
17453
  `;
@@ -17360,16 +17478,16 @@ ${GITIGNORE_NEW_BODY}${GITIGNORE_BLOCK_END}
17360
17478
  }
17361
17479
  function _build_plan(project) {
17362
17480
  return {
17363
- npm: _detect_npm(path17.join(project, "package.json")),
17364
- composer: _detect_composer(path17.join(project, "composer.json")),
17481
+ npm: _detect_npm(path18.join(project, "package.json")),
17482
+ composer: _detect_composer(path18.join(project, "composer.json")),
17365
17483
  symlinks_legacy: MANAGED_SYMLINKS.filter(
17366
- (name) => _classify_symlink(path17.join(project, name)) === "legacy"
17484
+ (name) => _classify_symlink(path18.join(project, name)) === "legacy"
17367
17485
  ),
17368
17486
  symlinks_user: MANAGED_SYMLINKS.filter(
17369
- (name) => _classify_symlink(path17.join(project, name)) === "user"
17487
+ (name) => _classify_symlink(path18.join(project, name)) === "user"
17370
17488
  ),
17371
- state_file: _isFile2(path17.join(project, LEGACY_STATE_FILENAME)),
17372
- settings_files: _detect_legacy_settings(project).map((p) => path17.relative(project, p)),
17489
+ state_file: _isFile2(path18.join(project, LEGACY_STATE_FILENAME)),
17490
+ settings_files: _detect_legacy_settings(project).map((p) => path18.relative(project, p)),
17373
17491
  empty_shell: _detect_empty_shell(project)
17374
17492
  };
17375
17493
  }
@@ -17433,10 +17551,10 @@ function _warn_on_major_mismatch(from_major, plan, out) {
17433
17551
  }
17434
17552
  function _apply(project, out, err) {
17435
17553
  const summary = [];
17436
- if (_strip_npm_entry(path17.join(project, "package.json"))) {
17554
+ if (_strip_npm_entry(path18.join(project, "package.json"))) {
17437
17555
  summary.push(`removed ${PACKAGE_NAME_NPM} from package.json`);
17438
17556
  }
17439
- if (_strip_composer_entry(path17.join(project, "composer.json"))) {
17557
+ if (_strip_composer_entry(path18.join(project, "composer.json"))) {
17440
17558
  summary.push(`removed ${PACKAGE_NAME_COMPOSER} from composer.json`);
17441
17559
  }
17442
17560
  const [removed_links, preserved_links] = _purge_legacy_symlinks(project);
@@ -17563,17 +17681,17 @@ function _isCliEntry() {
17563
17681
  return false;
17564
17682
  }
17565
17683
  if (typeof __AGENT_CONFIG_CLI_DELEGATE__ !== "undefined" && __AGENT_CONFIG_CLI_DELEGATE__) {
17566
- if (path17.basename(process2.argv[1], ".js") === "cmd_migrate") {
17684
+ if (path18.basename(process2.argv[1], ".js") === "cmd_migrate") {
17567
17685
  return true;
17568
17686
  }
17569
17687
  }
17570
- const argvUrl = pathToFileURL(path17.resolve(process2.argv[1])).href;
17688
+ const argvUrl = pathToFileURL(path18.resolve(process2.argv[1])).href;
17571
17689
  if (import.meta.url === argvUrl) {
17572
17690
  return true;
17573
17691
  }
17574
17692
  try {
17575
- const here = fs20.realpathSync(fileURLToPath4(import.meta.url));
17576
- const argv = fs20.realpathSync(path17.resolve(process2.argv[1]));
17693
+ const here = fs21.realpathSync(fileURLToPath4(import.meta.url));
17694
+ const argv = fs21.realpathSync(path18.resolve(process2.argv[1]));
17577
17695
  return here === argv;
17578
17696
  } catch {
17579
17697
  return false;
@@ -17610,34 +17728,34 @@ var ArgparseExit2 = class extends Error {
17610
17728
  function expanduser6(p) {
17611
17729
  if (p === "~") return os8.homedir();
17612
17730
  if (p.startsWith("~/") || p.startsWith("~\\")) {
17613
- return path18.join(os8.homedir(), p.slice(2));
17731
+ return path19.join(os8.homedir(), p.slice(2));
17614
17732
  }
17615
17733
  return p;
17616
17734
  }
17617
17735
  function resolvePath(p) {
17618
17736
  try {
17619
- return fs21.realpathSync(path18.resolve(p));
17737
+ return fs22.realpathSync(path19.resolve(p));
17620
17738
  } catch {
17621
- return path18.resolve(p);
17739
+ return path19.resolve(p);
17622
17740
  }
17623
17741
  }
17624
17742
  function isFile(p) {
17625
17743
  try {
17626
- return fs21.statSync(p).isFile();
17744
+ return fs22.statSync(p).isFile();
17627
17745
  } catch {
17628
17746
  return false;
17629
17747
  }
17630
17748
  }
17631
17749
  function isDir(p) {
17632
17750
  try {
17633
- return fs21.statSync(p).isDirectory();
17751
+ return fs22.statSync(p).isDirectory();
17634
17752
  } catch {
17635
17753
  return false;
17636
17754
  }
17637
17755
  }
17638
17756
  function pathExists(p) {
17639
17757
  try {
17640
- fs21.statSync(p);
17758
+ fs22.statSync(p);
17641
17759
  return true;
17642
17760
  } catch {
17643
17761
  return false;
@@ -17645,24 +17763,24 @@ function pathExists(p) {
17645
17763
  }
17646
17764
  function isSymlink(p) {
17647
17765
  try {
17648
- return fs21.lstatSync(p).isSymbolicLink();
17766
+ return fs22.lstatSync(p).isSymbolicLink();
17649
17767
  } catch {
17650
17768
  return false;
17651
17769
  }
17652
17770
  }
17653
17771
  function readText(p) {
17654
- return fs21.readFileSync(p, "utf-8");
17772
+ return fs22.readFileSync(p, "utf-8");
17655
17773
  }
17656
17774
  function writeText(p, content) {
17657
- fs21.writeFileSync(p, content, "utf-8");
17775
+ fs22.writeFileSync(p, content, "utf-8");
17658
17776
  }
17659
17777
  function mkdirp(p) {
17660
- fs21.mkdirSync(p, { recursive: true });
17778
+ fs22.mkdirSync(p, { recursive: true });
17661
17779
  }
17662
17780
  function sortedGlobStems(directory, suffix) {
17663
17781
  let entries;
17664
17782
  try {
17665
- entries = fs21.readdirSync(directory);
17783
+ entries = fs22.readdirSync(directory);
17666
17784
  } catch {
17667
17785
  return [];
17668
17786
  }
@@ -17682,7 +17800,7 @@ function sortedGlobStems(directory, suffix) {
17682
17800
  function countZips(directory) {
17683
17801
  if (!isDir(directory)) return 0;
17684
17802
  let n = 0;
17685
- for (const name of fs21.readdirSync(directory)) {
17803
+ for (const name of fs22.readdirSync(directory)) {
17686
17804
  if (name.endsWith(".zip")) n += 1;
17687
17805
  }
17688
17806
  return n;
@@ -17690,35 +17808,35 @@ function countZips(directory) {
17690
17808
  function sha256OfFile(p) {
17691
17809
  let data;
17692
17810
  try {
17693
- data = fs21.readFileSync(p);
17811
+ data = fs22.readFileSync(p);
17694
17812
  } catch {
17695
17813
  return null;
17696
17814
  }
17697
17815
  return crypto3.createHash("sha256").update(data).digest("hex");
17698
17816
  }
17699
17817
  function atomicWrite0644(target, body, prefix) {
17700
- const dir = path18.dirname(target);
17701
- const tmpName = path18.join(
17818
+ const dir = path19.dirname(target);
17819
+ const tmpName = path19.join(
17702
17820
  dir,
17703
17821
  `${prefix}${process3.pid}.${crypto3.randomBytes(6).toString("hex")}.yml.tmp`
17704
17822
  );
17705
17823
  let fd = null;
17706
17824
  try {
17707
- fd = fs21.openSync(tmpName, "wx", 420);
17708
- fs21.writeFileSync(fd, body, "utf-8");
17709
- fs21.closeSync(fd);
17825
+ fd = fs22.openSync(tmpName, "wx", 420);
17826
+ fs22.writeFileSync(fd, body, "utf-8");
17827
+ fs22.closeSync(fd);
17710
17828
  fd = null;
17711
- fs21.chmodSync(tmpName, 420);
17712
- fs21.renameSync(tmpName, target);
17829
+ fs22.chmodSync(tmpName, 420);
17830
+ fs22.renameSync(tmpName, target);
17713
17831
  } catch (err) {
17714
17832
  if (fd !== null) {
17715
17833
  try {
17716
- fs21.closeSync(fd);
17834
+ fs22.closeSync(fd);
17717
17835
  } catch {
17718
17836
  }
17719
17837
  }
17720
17838
  try {
17721
- fs21.unlinkSync(tmpName);
17839
+ fs22.unlinkSync(tmpName);
17722
17840
  } catch {
17723
17841
  }
17724
17842
  throw err;
@@ -17842,12 +17960,12 @@ var LEGACY_SETTINGS_FILE = ".agent-settings";
17842
17960
  var LEGACY_BACKUP_FILE = ".agent-settings.backup.key-value";
17843
17961
  var SETTINGS_SUBDIR = ["agents", "settings"];
17844
17962
  function _canonical_settings_target(project_root) {
17845
- return path18.join(project_root, ...SETTINGS_SUBDIR, SETTINGS_FILE);
17963
+ return path19.join(project_root, ...SETTINGS_SUBDIR, SETTINGS_FILE);
17846
17964
  }
17847
17965
  function _resolve_settings_read(project_root) {
17848
17966
  const canonical = _canonical_settings_target(project_root);
17849
17967
  if (pathExists(canonical)) return canonical;
17850
- const legacy = path18.join(project_root, SETTINGS_FILE);
17968
+ const legacy = path19.join(project_root, SETTINGS_FILE);
17851
17969
  if (pathExists(legacy)) return legacy;
17852
17970
  return canonical;
17853
17971
  }
@@ -17911,9 +18029,9 @@ function fail(msg) {
17911
18029
  throw new SystemExitError(1);
17912
18030
  }
17913
18031
  function detect_package_root(project_root) {
17914
- const npm_path = path18.join(project_root, "node_modules", "@event4u", "agent-config");
18032
+ const npm_path = path19.join(project_root, "node_modules", "@event4u", "agent-config");
17915
18033
  if (isDir(npm_path)) return resolvePath(npm_path);
17916
- if (pathExists(path18.join(project_root, "src", "config", "profiles", "minimal.ini"))) {
18034
+ if (pathExists(path19.join(project_root, "src", "config", "profiles", "minimal.ini"))) {
17917
18035
  return project_root;
17918
18036
  }
17919
18037
  fail(
@@ -17921,12 +18039,12 @@ function detect_package_root(project_root) {
17921
18039
  );
17922
18040
  }
17923
18041
  function detect_package_type(package_root) {
17924
- if (package_root.split(path18.sep).includes("node_modules")) return "npm";
18042
+ if (package_root.split(path19.sep).includes("node_modules")) return "npm";
17925
18043
  return "local";
17926
18044
  }
17927
18045
  function detect_package_type_for_project(project_root, package_root) {
17928
18046
  const npm_path = resolvePath(
17929
- path18.join(project_root, "node_modules", "@event4u", "agent-config")
18047
+ path19.join(project_root, "node_modules", "@event4u", "agent-config")
17930
18048
  );
17931
18049
  const package_resolved = resolvePath(package_root);
17932
18050
  if (package_resolved === npm_path) return "npm";
@@ -17946,7 +18064,7 @@ function ensure_directory(p) {
17946
18064
  mkdirp(p);
17947
18065
  }
17948
18066
  function write_file(p, content) {
17949
- ensure_directory(path18.dirname(p));
18067
+ ensure_directory(path19.dirname(p));
17950
18068
  writeText(p, content);
17951
18069
  }
17952
18070
  function read_json_file(p) {
@@ -18117,7 +18235,7 @@ function _append_unknown_legacy(rendered, legacy_values, unknown_keys) {
18117
18235
  return rendered + "\n" + suffix;
18118
18236
  }
18119
18237
  function _migrate_legacy_if_present(project_root, template_body) {
18120
- const legacy_target = path18.join(project_root, LEGACY_SETTINGS_FILE);
18238
+ const legacy_target = path19.join(project_root, LEGACY_SETTINGS_FILE);
18121
18239
  if (!isFile(legacy_target)) return null;
18122
18240
  const legacy_text = readText(legacy_target);
18123
18241
  const [values, unknown] = _parse_legacy_settings(legacy_text);
@@ -18132,9 +18250,9 @@ function _migrate_legacy_if_present(project_root, template_body) {
18132
18250
  }
18133
18251
  }
18134
18252
  rendered = _append_unknown_legacy(rendered, values, unknown);
18135
- const backup_target = path18.join(project_root, LEGACY_BACKUP_FILE);
18253
+ const backup_target = path19.join(project_root, LEGACY_BACKUP_FILE);
18136
18254
  writeText(backup_target, legacy_text);
18137
- fs21.unlinkSync(legacy_target);
18255
+ fs22.unlinkSync(legacy_target);
18138
18256
  info(`Migrated legacy ${LEGACY_SETTINGS_FILE} \u2192 ${SETTINGS_FILE}`);
18139
18257
  info(`Backup saved to ${LEGACY_BACKUP_FILE}`);
18140
18258
  if (unknown.length > 0) {
@@ -18169,7 +18287,7 @@ function _render_template(template, profile_values) {
18169
18287
  return body;
18170
18288
  }
18171
18289
  function _load_valid_user_types(package_root) {
18172
- const directory = path18.join(package_root, USER_TYPES_DIR);
18290
+ const directory = path19.join(package_root, USER_TYPES_DIR);
18173
18291
  if (!isDir(directory)) return [];
18174
18292
  return sortedGlobStems(directory, ".yml");
18175
18293
  }
@@ -18226,8 +18344,8 @@ function splitlinesKeepends(text) {
18226
18344
  }
18227
18345
  function ensure_agent_settings(project_root, package_root, profile, force, user_type = "", packs = null) {
18228
18346
  const target = _canonical_settings_target(project_root);
18229
- const profile_source = path18.join(package_root, "src", "config", "profiles", `${profile}.ini`);
18230
- const template_source = path18.join(package_root, "src", "config", "agent-settings.template.yml");
18347
+ const profile_source = path19.join(package_root, "src", "config", "profiles", `${profile}.ini`);
18348
+ const template_source = path19.join(package_root, "src", "config", "agent-settings.template.yml");
18231
18349
  if (!pathExists(profile_source)) fail(`Missing profile preset: ${profile_source}`);
18232
18350
  if (!pathExists(template_source)) fail(`Missing settings template: ${template_source}`);
18233
18351
  const template = readText(template_source);
@@ -18241,21 +18359,21 @@ function ensure_agent_settings(project_root, package_root, profile, force, user_
18241
18359
  if (profile_values["rule_loading_tier"] !== profile) {
18242
18360
  const got = "rule_loading_tier" in profile_values ? `'${profile_values["rule_loading_tier"]}'` : "None";
18243
18361
  fail(
18244
- `Profile preset ${path18.basename(profile_source)} has rule_loading_tier=${got} but --profile=${profile}`
18362
+ `Profile preset ${path19.basename(profile_source)} has rule_loading_tier=${got} but --profile=${profile}`
18245
18363
  );
18246
18364
  }
18247
18365
  profile_values["user_type"] = _validate_user_type(package_root, user_type);
18248
18366
  let template_body = _render_template(template, profile_values);
18249
18367
  template_body = _inject_packs(template_body, packs ?? []);
18250
- const legacy_root = path18.join(project_root, SETTINGS_FILE);
18368
+ const legacy_root = path19.join(project_root, SETTINGS_FILE);
18251
18369
  if (isFile(legacy_root) && !pathExists(target)) {
18252
- mkdirp(path18.dirname(target));
18370
+ mkdirp(path19.dirname(target));
18253
18371
  writeText(target, readText(legacy_root));
18254
- fs21.unlinkSync(legacy_root);
18372
+ fs22.unlinkSync(legacy_root);
18255
18373
  success(`Migrated ${SETTINGS_FILE} \u2192 agents/settings/${SETTINGS_FILE} (ADR-038)`);
18256
18374
  return;
18257
18375
  }
18258
- const legacy_target = path18.join(project_root, LEGACY_SETTINGS_FILE);
18376
+ const legacy_target = path19.join(project_root, LEGACY_SETTINGS_FILE);
18259
18377
  if (isFile(legacy_target) && pathExists(target)) {
18260
18378
  warn(
18261
18379
  `Both ${SETTINGS_FILE} and legacy ${LEGACY_SETTINGS_FILE} exist. Skipping migration to avoid overwriting ${SETTINGS_FILE}. Delete one of them manually and re-run.`
@@ -18272,7 +18390,7 @@ function ensure_agent_settings(project_root, package_root, profile, force, user_
18272
18390
  skip(`${SETTINGS_FILE} already exists`);
18273
18391
  return;
18274
18392
  }
18275
- mkdirp(path18.dirname(target));
18393
+ mkdirp(path19.dirname(target));
18276
18394
  write_file(target, template_body);
18277
18395
  const user_type_value = profile_values["user_type"] ?? "";
18278
18396
  const suffix = user_type_value ? `, user_type=${user_type_value}` : "";
@@ -18285,7 +18403,7 @@ function ensure_vscode_bridge(project_root, package_type, force) {
18285
18403
  const plugin_path = plugin_paths[package_type] ?? "./plugin/agent-config";
18286
18404
  const bridge = { "chat.pluginLocations": { [plugin_path]: true } };
18287
18405
  return merge_json_file(
18288
- path18.join(project_root, ".vscode", "settings.json"),
18406
+ path19.join(project_root, ".vscode", "settings.json"),
18289
18407
  bridge,
18290
18408
  force,
18291
18409
  ".vscode/settings.json"
@@ -18294,14 +18412,14 @@ function ensure_vscode_bridge(project_root, package_type, force) {
18294
18412
  function ensure_augment_bridge(project_root, force) {
18295
18413
  const bridge = { enabledPlugins: { "agent-config@event4u": true } };
18296
18414
  return merge_json_file(
18297
- path18.join(project_root, ".augment", "settings.json"),
18415
+ path19.join(project_root, ".augment", "settings.json"),
18298
18416
  bridge,
18299
18417
  force,
18300
18418
  ".augment/settings.json"
18301
18419
  );
18302
18420
  }
18303
- var AUGMENT_USER_DIR = path18.join(os8.homedir(), ".augment");
18304
- var AUGMENT_USER_HOOKS_DIR = path18.join(AUGMENT_USER_DIR, "hooks");
18421
+ var AUGMENT_USER_DIR = path19.join(os8.homedir(), ".augment");
18422
+ var AUGMENT_USER_HOOKS_DIR = path19.join(AUGMENT_USER_DIR, "hooks");
18305
18423
  var AUGMENT_DISPATCHER_TRAMPOLINE = "augment-dispatcher.sh";
18306
18424
  var AUGMENT_LEGACY_TRAMPOLINES = [
18307
18425
  "augment-chat-history.sh",
@@ -18317,29 +18435,29 @@ var AUGMENT_DISPATCHER_BINDINGS = [
18317
18435
  ["post_tool_use", "PostToolUse"]
18318
18436
  ];
18319
18437
  function _deploy_augment_trampoline(package_root, name, force) {
18320
- const src = path18.join(package_root, "scripts", "hooks", name);
18438
+ const src = path19.join(package_root, "scripts", "hooks", name);
18321
18439
  if (!pathExists(src)) {
18322
18440
  skip(`augment trampoline missing in package: ${src}`);
18323
18441
  return null;
18324
18442
  }
18325
18443
  mkdirp(AUGMENT_USER_HOOKS_DIR);
18326
- const dst = path18.join(AUGMENT_USER_HOOKS_DIR, name);
18444
+ const dst = path19.join(AUGMENT_USER_HOOKS_DIR, name);
18327
18445
  const src_text = readText(src);
18328
18446
  if (pathExists(dst) && readText(dst) === src_text && !force) {
18329
18447
  skip(`~/.augment/hooks/${name} already up to date`);
18330
18448
  } else {
18331
18449
  writeText(dst, src_text);
18332
- fs21.chmodSync(dst, 493);
18450
+ fs22.chmodSync(dst, 493);
18333
18451
  success(`~/.augment/hooks/${name} installed`);
18334
18452
  }
18335
18453
  return dst;
18336
18454
  }
18337
18455
  function _remove_legacy_augment_trampolines() {
18338
18456
  for (const name of AUGMENT_LEGACY_TRAMPOLINES) {
18339
- const legacy = path18.join(AUGMENT_USER_HOOKS_DIR, name);
18457
+ const legacy = path19.join(AUGMENT_USER_HOOKS_DIR, name);
18340
18458
  try {
18341
18459
  if (isFile(legacy)) {
18342
- fs21.unlinkSync(legacy);
18460
+ fs22.unlinkSync(legacy);
18343
18461
  skip(`removed legacy ~/.augment/hooks/${name}`);
18344
18462
  }
18345
18463
  } catch (err) {
@@ -18359,7 +18477,7 @@ function ensure_augment_user_hooks(package_root, force) {
18359
18477
  }
18360
18478
  const settings_patch = { hooks: per_event };
18361
18479
  return merge_json_file(
18362
- path18.join(AUGMENT_USER_DIR, "settings.json"),
18480
+ path19.join(AUGMENT_USER_DIR, "settings.json"),
18363
18481
  settings_patch,
18364
18482
  force,
18365
18483
  "~/.augment/settings.json"
@@ -18384,7 +18502,7 @@ function _heal_legacy_claude_plugin_ids(p) {
18384
18502
  return removed;
18385
18503
  }
18386
18504
  function ensure_claude_bridge(project_root, force) {
18387
- const target = path18.join(project_root, ".claude", "settings.json");
18505
+ const target = path19.join(project_root, ".claude", "settings.json");
18388
18506
  const healed = _heal_legacy_claude_plugin_ids(target);
18389
18507
  for (const pid of healed) {
18390
18508
  success(`.claude/settings.json: removed stale plugin id \`${pid}\``);
@@ -18392,6 +18510,10 @@ function ensure_claude_bridge(project_root, force) {
18392
18510
  const bridge = { enabledPlugins: { [CLAUDE_PLUGIN_ID]: true } };
18393
18511
  return merge_json_file(target, bridge, force || healed.length > 0, ".claude/settings.json");
18394
18512
  }
18513
+ var ensure_mcp_bridge = makeEnsureMcpBridge(merge_json_file);
18514
+ var _resolve_tier_b = resolveTierB;
18515
+ var _tier_b_advisory = tierBAdvisory;
18516
+ var _prune_tier_b_modules = (dr, tier_b) => _prune_modules_by(dr, tierBPrunePredicate(tier_b));
18395
18517
  var CURSOR_DISPATCHER_BINDINGS = [
18396
18518
  ["session_start", "sessionStart"],
18397
18519
  ["session_end", "sessionEnd"],
@@ -18409,29 +18531,29 @@ function ensure_cursor_bridge(project_root, force) {
18409
18531
  }
18410
18532
  const bridge = { version: 1, hooks };
18411
18533
  return merge_json_file(
18412
- path18.join(project_root, ".cursor", "hooks.json"),
18534
+ path19.join(project_root, ".cursor", "hooks.json"),
18413
18535
  bridge,
18414
18536
  force,
18415
18537
  ".cursor/hooks.json"
18416
18538
  );
18417
18539
  }
18418
- var CURSOR_USER_DIR = path18.join(os8.homedir(), ".cursor");
18419
- var CURSOR_USER_HOOKS_DIR = path18.join(CURSOR_USER_DIR, "hooks");
18540
+ var CURSOR_USER_DIR = path19.join(os8.homedir(), ".cursor");
18541
+ var CURSOR_USER_HOOKS_DIR = path19.join(CURSOR_USER_DIR, "hooks");
18420
18542
  var CURSOR_DISPATCHER_TRAMPOLINE = "cursor-dispatcher.sh";
18421
18543
  function ensure_cursor_user_hooks(package_root, force) {
18422
- const src = path18.join(package_root, "scripts", "hooks", CURSOR_DISPATCHER_TRAMPOLINE);
18544
+ const src = path19.join(package_root, "scripts", "hooks", CURSOR_DISPATCHER_TRAMPOLINE);
18423
18545
  if (!pathExists(src)) {
18424
18546
  skip(`cursor trampoline missing in package: ${src}`);
18425
18547
  return [];
18426
18548
  }
18427
18549
  mkdirp(CURSOR_USER_HOOKS_DIR);
18428
- const dst = path18.join(CURSOR_USER_HOOKS_DIR, CURSOR_DISPATCHER_TRAMPOLINE);
18550
+ const dst = path19.join(CURSOR_USER_HOOKS_DIR, CURSOR_DISPATCHER_TRAMPOLINE);
18429
18551
  const src_text = readText(src);
18430
18552
  if (pathExists(dst) && readText(dst) === src_text && !force) {
18431
18553
  skip(`~/.cursor/hooks/${CURSOR_DISPATCHER_TRAMPOLINE} already up to date`);
18432
18554
  } else {
18433
18555
  writeText(dst, src_text);
18434
- fs21.chmodSync(dst, 493);
18556
+ fs22.chmodSync(dst, 493);
18435
18557
  success(`~/.cursor/hooks/${CURSOR_DISPATCHER_TRAMPOLINE} installed`);
18436
18558
  }
18437
18559
  const hooks = {};
@@ -18440,7 +18562,7 @@ function ensure_cursor_user_hooks(package_root, force) {
18440
18562
  }
18441
18563
  const settings_patch = { version: 1, hooks };
18442
18564
  return merge_json_file(
18443
- path18.join(CURSOR_USER_DIR, "hooks.json"),
18565
+ path19.join(CURSOR_USER_DIR, "hooks.json"),
18444
18566
  settings_patch,
18445
18567
  force,
18446
18568
  "~/.cursor/hooks.json"
@@ -18483,12 +18605,12 @@ exit 0
18483
18605
  `;
18484
18606
  }
18485
18607
  function ensure_cline_bridge(project_root, force) {
18486
- const hooks_dir = path18.join(project_root, ".clinerules", "hooks");
18608
+ const hooks_dir = path19.join(project_root, ".clinerules", "hooks");
18487
18609
  mkdirp(hooks_dir);
18488
18610
  const workspace_quoted = shlexQuote(resolvePath(project_root));
18489
18611
  let written = 0;
18490
18612
  for (const [ac_event, native_event] of CLINE_DISPATCHER_BINDINGS) {
18491
- const target = path18.join(hooks_dir, native_event);
18613
+ const target = path19.join(hooks_dir, native_event);
18492
18614
  const body = clineProjectHookBody(native_event, ac_event, workspace_quoted);
18493
18615
  if (pathExists(target) && readText(target) === body && !force) {
18494
18616
  continue;
@@ -18498,7 +18620,7 @@ function ensure_cline_bridge(project_root, force) {
18498
18620
  continue;
18499
18621
  }
18500
18622
  writeText(target, body);
18501
- fs21.chmodSync(target, 493);
18623
+ fs22.chmodSync(target, 493);
18502
18624
  written += 1;
18503
18625
  }
18504
18626
  if (written) {
@@ -18507,27 +18629,27 @@ function ensure_cline_bridge(project_root, force) {
18507
18629
  skip(".clinerules/hooks/ already up to date");
18508
18630
  }
18509
18631
  }
18510
- var CLINE_USER_DIR = path18.join(os8.homedir(), "Documents", "Cline", "Hooks");
18632
+ var CLINE_USER_DIR = path19.join(os8.homedir(), "Documents", "Cline", "Hooks");
18511
18633
  var CLINE_DISPATCHER_TRAMPOLINE = "cline-dispatcher.sh";
18512
18634
  function ensure_cline_user_hooks(package_root, force) {
18513
- const src = path18.join(package_root, "scripts", "hooks", CLINE_DISPATCHER_TRAMPOLINE);
18635
+ const src = path19.join(package_root, "scripts", "hooks", CLINE_DISPATCHER_TRAMPOLINE);
18514
18636
  if (!pathExists(src)) {
18515
18637
  skip(`cline trampoline missing in package: ${src}`);
18516
18638
  return;
18517
18639
  }
18518
18640
  mkdirp(CLINE_USER_DIR);
18519
- const trampoline = path18.join(CLINE_USER_DIR, CLINE_DISPATCHER_TRAMPOLINE);
18641
+ const trampoline = path19.join(CLINE_USER_DIR, CLINE_DISPATCHER_TRAMPOLINE);
18520
18642
  const src_text = readText(src);
18521
18643
  if (pathExists(trampoline) && readText(trampoline) === src_text && !force) {
18522
18644
  skip(`~/Documents/Cline/Hooks/${CLINE_DISPATCHER_TRAMPOLINE} already up to date`);
18523
18645
  } else {
18524
18646
  writeText(trampoline, src_text);
18525
- fs21.chmodSync(trampoline, 493);
18647
+ fs22.chmodSync(trampoline, 493);
18526
18648
  success(`~/Documents/Cline/Hooks/${CLINE_DISPATCHER_TRAMPOLINE} installed`);
18527
18649
  }
18528
18650
  const trampoline_quoted = shlexQuote(trampoline);
18529
18651
  for (const [ac_event, native_event] of CLINE_DISPATCHER_BINDINGS) {
18530
- const wrapper = path18.join(CLINE_USER_DIR, native_event);
18652
+ const wrapper = path19.join(CLINE_USER_DIR, native_event);
18531
18653
  const body = `#!/usr/bin/env bash
18532
18654
  # Generated by event4u/agent-config install.py \u2014 DO NOT EDIT.
18533
18655
  # User-scope Cline hook for ${native_event} \u2192 agent-config ${ac_event}.
@@ -18537,7 +18659,7 @@ exec ${trampoline_quoted} ${ac_event} ${native_event}
18537
18659
  continue;
18538
18660
  }
18539
18661
  writeText(wrapper, body);
18540
- fs21.chmodSync(wrapper, 493);
18662
+ fs22.chmodSync(wrapper, 493);
18541
18663
  }
18542
18664
  }
18543
18665
  var WINDSURF_DISPATCHER_BINDINGS = [
@@ -18558,29 +18680,29 @@ function ensure_windsurf_bridge(project_root, force) {
18558
18680
  }
18559
18681
  const bridge = { hooks };
18560
18682
  return merge_json_file(
18561
- path18.join(project_root, ".windsurf", "hooks.json"),
18683
+ path19.join(project_root, ".windsurf", "hooks.json"),
18562
18684
  bridge,
18563
18685
  force,
18564
18686
  ".windsurf/hooks.json"
18565
18687
  );
18566
18688
  }
18567
- var WINDSURF_USER_DIR = path18.join(os8.homedir(), ".codeium", "windsurf");
18568
- var WINDSURF_USER_HOOKS_DIR = path18.join(WINDSURF_USER_DIR, "hooks");
18689
+ var WINDSURF_USER_DIR = path19.join(os8.homedir(), ".codeium", "windsurf");
18690
+ var WINDSURF_USER_HOOKS_DIR = path19.join(WINDSURF_USER_DIR, "hooks");
18569
18691
  var WINDSURF_DISPATCHER_TRAMPOLINE = "windsurf-dispatcher.sh";
18570
18692
  function ensure_windsurf_user_hooks(package_root, force) {
18571
- const src = path18.join(package_root, "scripts", "hooks", WINDSURF_DISPATCHER_TRAMPOLINE);
18693
+ const src = path19.join(package_root, "scripts", "hooks", WINDSURF_DISPATCHER_TRAMPOLINE);
18572
18694
  if (!pathExists(src)) {
18573
18695
  skip(`windsurf trampoline missing in package: ${src}`);
18574
18696
  return [];
18575
18697
  }
18576
18698
  mkdirp(WINDSURF_USER_HOOKS_DIR);
18577
- const dst = path18.join(WINDSURF_USER_HOOKS_DIR, WINDSURF_DISPATCHER_TRAMPOLINE);
18699
+ const dst = path19.join(WINDSURF_USER_HOOKS_DIR, WINDSURF_DISPATCHER_TRAMPOLINE);
18578
18700
  const src_text = readText(src);
18579
18701
  if (pathExists(dst) && readText(dst) === src_text && !force) {
18580
18702
  skip(`~/.codeium/windsurf/hooks/${WINDSURF_DISPATCHER_TRAMPOLINE} already up to date`);
18581
18703
  } else {
18582
18704
  writeText(dst, src_text);
18583
- fs21.chmodSync(dst, 493);
18705
+ fs22.chmodSync(dst, 493);
18584
18706
  success(`~/.codeium/windsurf/hooks/${WINDSURF_DISPATCHER_TRAMPOLINE} installed`);
18585
18707
  }
18586
18708
  const hooks = {};
@@ -18592,7 +18714,7 @@ function ensure_windsurf_user_hooks(package_root, force) {
18592
18714
  }
18593
18715
  const settings_patch = { hooks };
18594
18716
  return merge_json_file(
18595
- path18.join(WINDSURF_USER_DIR, "hooks.json"),
18717
+ path19.join(WINDSURF_USER_DIR, "hooks.json"),
18596
18718
  settings_patch,
18597
18719
  force,
18598
18720
  "~/.codeium/windsurf/hooks.json"
@@ -18621,43 +18743,43 @@ function _gemini_hooks_dict(command_factory) {
18621
18743
  function ensure_gemini_bridge(project_root, force) {
18622
18744
  const bridge = { hooks: _gemini_hooks_dict(_gemini_dispatch_command) };
18623
18745
  return merge_json_file(
18624
- path18.join(project_root, ".gemini", "settings.json"),
18746
+ path19.join(project_root, ".gemini", "settings.json"),
18625
18747
  bridge,
18626
18748
  force,
18627
18749
  ".gemini/settings.json"
18628
18750
  );
18629
18751
  }
18630
- var GEMINI_USER_DIR = path18.join(os8.homedir(), ".gemini");
18631
- var GEMINI_USER_HOOKS_DIR = path18.join(GEMINI_USER_DIR, "hooks");
18752
+ var GEMINI_USER_DIR = path19.join(os8.homedir(), ".gemini");
18753
+ var GEMINI_USER_HOOKS_DIR = path19.join(GEMINI_USER_DIR, "hooks");
18632
18754
  var GEMINI_DISPATCHER_TRAMPOLINE = "gemini-dispatcher.sh";
18633
18755
  function ensure_gemini_user_hooks(package_root, force) {
18634
- const src = path18.join(package_root, "scripts", "hooks", GEMINI_DISPATCHER_TRAMPOLINE);
18756
+ const src = path19.join(package_root, "scripts", "hooks", GEMINI_DISPATCHER_TRAMPOLINE);
18635
18757
  if (!pathExists(src)) {
18636
18758
  skip(`gemini trampoline missing in package: ${src}`);
18637
18759
  return [];
18638
18760
  }
18639
18761
  mkdirp(GEMINI_USER_HOOKS_DIR);
18640
- const dst = path18.join(GEMINI_USER_HOOKS_DIR, GEMINI_DISPATCHER_TRAMPOLINE);
18762
+ const dst = path19.join(GEMINI_USER_HOOKS_DIR, GEMINI_DISPATCHER_TRAMPOLINE);
18641
18763
  const src_text = readText(src);
18642
18764
  if (pathExists(dst) && readText(dst) === src_text && !force) {
18643
18765
  skip(`~/.gemini/hooks/${GEMINI_DISPATCHER_TRAMPOLINE} already up to date`);
18644
18766
  } else {
18645
18767
  writeText(dst, src_text);
18646
- fs21.chmodSync(dst, 493);
18768
+ fs22.chmodSync(dst, 493);
18647
18769
  success(`~/.gemini/hooks/${GEMINI_DISPATCHER_TRAMPOLINE} installed`);
18648
18770
  }
18649
18771
  const settings_patch = {
18650
18772
  hooks: _gemini_hooks_dict((ac_event, native) => `${dst} ${ac_event} ${native}`)
18651
18773
  };
18652
18774
  return merge_json_file(
18653
- path18.join(GEMINI_USER_DIR, "settings.json"),
18775
+ path19.join(GEMINI_USER_DIR, "settings.json"),
18654
18776
  settings_patch,
18655
18777
  force,
18656
18778
  "~/.gemini/settings.json"
18657
18779
  );
18658
18780
  }
18659
18781
  function ensure_copilot_bridge(project_root, force) {
18660
- const target = path18.join(project_root, ".github", "plugin", "marketplace.json");
18782
+ const target = path19.join(project_root, ".github", "plugin", "marketplace.json");
18661
18783
  const bridge = {
18662
18784
  marketplace: {
18663
18785
  name: "event4u-agent-marketplace",
@@ -18700,7 +18822,7 @@ See \`docs/setup/per-ide/roocode.md\` for the full activation guide.
18700
18822
  Run \`./agent-config --help\` for available commands.
18701
18823
  `;
18702
18824
  function ensure_roocode_bridge(project_root, force) {
18703
- const target = path18.join(project_root, ".roo", "rules", "agent-config.md");
18825
+ const target = path19.join(project_root, ".roo", "rules", "agent-config.md");
18704
18826
  if (pathExists(target) && !force) {
18705
18827
  skip(".roo/rules/agent-config.md already exists");
18706
18828
  return;
@@ -18722,7 +18844,7 @@ To wire Claude Desktop to this project's rules, run:
18722
18844
  Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
18723
18845
  `;
18724
18846
  function ensure_claude_desktop_bridge(project_root, force) {
18725
- const target = path18.join(project_root, ".claude-desktop", "agent-config.md");
18847
+ const target = path19.join(project_root, ".claude-desktop", "agent-config.md");
18726
18848
  if (pathExists(target) && !force) {
18727
18849
  skip(".claude-desktop/agent-config.md already exists");
18728
18850
  return;
@@ -18747,7 +18869,7 @@ Or pass \`--read .aider/agent-config.md\` on the command line.
18747
18869
  Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
18748
18870
  `;
18749
18871
  function ensure_aider_bridge(project_root, force) {
18750
- const target = path18.join(project_root, ".aider", "agent-config.md");
18872
+ const target = path19.join(project_root, ".aider", "agent-config.md");
18751
18873
  if (pathExists(target) && !force) {
18752
18874
  skip(".aider/agent-config.md already exists");
18753
18875
  return;
@@ -18766,7 +18888,7 @@ developers where the rules and skills live.
18766
18888
  Canonical rule and skill source: \`.augment/\` (see project \`AGENTS.md\`).
18767
18889
  `;
18768
18890
  function ensure_codex_bridge(project_root, force) {
18769
- const target = path18.join(project_root, ".codex", "agent-config.md");
18891
+ const target = path19.join(project_root, ".codex", "agent-config.md");
18770
18892
  if (pathExists(target) && !force) {
18771
18893
  skip(".codex/agent-config.md already exists");
18772
18894
  return;
@@ -18784,7 +18906,7 @@ rules per session. The canonical rule and skill source lives under
18784
18906
  orientation).
18785
18907
  `;
18786
18908
  function ensure_continue_bridge(project_root, force) {
18787
- const target = path18.join(project_root, ".continue", "rules", "agent-config.md");
18909
+ const target = path19.join(project_root, ".continue", "rules", "agent-config.md");
18788
18910
  if (pathExists(target) && !force) {
18789
18911
  skip(".continue/rules/agent-config.md already exists");
18790
18912
  return;
@@ -18815,7 +18937,7 @@ orientation).
18815
18937
  See \`docs/setup/per-ide/kilocode.md\` for the full activation guide.
18816
18938
  `;
18817
18939
  function ensure_kilocode_bridge(project_root, force) {
18818
- const target = path18.join(project_root, ".kilocode", "rules", "agent-config.md");
18940
+ const target = path19.join(project_root, ".kilocode", "rules", "agent-config.md");
18819
18941
  if (pathExists(target) && !force) {
18820
18942
  skip(".kilocode/rules/agent-config.md already exists");
18821
18943
  return;
@@ -18842,7 +18964,7 @@ canonical source (or symlink it):
18842
18964
  Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
18843
18965
  `;
18844
18966
  function ensure_zed_bridge(project_root, force) {
18845
- const target = path18.join(project_root, ".zed", "agent-config.md");
18967
+ const target = path19.join(project_root, ".zed", "agent-config.md");
18846
18968
  if (pathExists(target) && !force) {
18847
18969
  skip(".zed/agent-config.md already exists");
18848
18970
  return;
@@ -18863,7 +18985,7 @@ rules into your JetBrains profile.
18863
18985
  Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
18864
18986
  `;
18865
18987
  function ensure_jetbrains_bridge(project_root, force) {
18866
- const target = path18.join(project_root, ".jetbrains", "agent-config.md");
18988
+ const target = path19.join(project_root, ".jetbrains", "agent-config.md");
18867
18989
  if (pathExists(target) && !force) {
18868
18990
  skip(".jetbrains/agent-config.md already exists");
18869
18991
  return;
@@ -18894,7 +19016,7 @@ session. The canonical rule and skill source lives under \`.augment/\`
18894
19016
  See \`docs/setup/per-ide/kiro.md\` for the full activation guide.
18895
19017
  `;
18896
19018
  function ensure_kiro_bridge(project_root, force) {
18897
- const target = path18.join(project_root, ".kiro", "steering", "agent-config.md");
19019
+ const target = path19.join(project_root, ".kiro", "steering", "agent-config.md");
18898
19020
  if (pathExists(target) && !force) {
18899
19021
  skip(".kiro/steering/agent-config.md already exists");
18900
19022
  return;
@@ -18920,35 +19042,35 @@ var SMOKE_BRIDGE_PATHS = {
18920
19042
  };
18921
19043
  function dirHasEntries(p) {
18922
19044
  try {
18923
- return fs21.readdirSync(p).length > 0;
19045
+ return fs22.readdirSync(p).length > 0;
18924
19046
  } catch {
18925
19047
  return false;
18926
19048
  }
18927
19049
  }
18928
19050
  function _resolve_tsx_invocation(scriptPath, scriptArgs) {
18929
19051
  const binName = process3.platform === "win32" ? "tsx.cmd" : "tsx";
18930
- let dir = path18.dirname(scriptPath);
19052
+ let dir = path19.dirname(scriptPath);
18931
19053
  for (; ; ) {
18932
- const candidate = path18.join(dir, "node_modules", ".bin", binName);
19054
+ const candidate = path19.join(dir, "node_modules", ".bin", binName);
18933
19055
  if (isFile(candidate)) {
18934
19056
  return { command: candidate, args: [scriptPath, ...scriptArgs] };
18935
19057
  }
18936
- const parent = path18.dirname(dir);
19058
+ const parent = path19.dirname(dir);
18937
19059
  if (parent === dir) break;
18938
19060
  dir = parent;
18939
19061
  }
18940
19062
  return { command: "npx", args: ["tsx", scriptPath, ...scriptArgs] };
18941
19063
  }
18942
19064
  function _smoke_test_hooks(project_root, package_root) {
18943
- const dispatcher = path18.join(package_root, "scripts", "hooks", "dispatch_hook.ts");
18944
- const manifest = path18.join(package_root, "scripts", "hook_manifest.yaml");
19065
+ const dispatcher = path19.join(package_root, "scripts", "hooks", "dispatch_hook.ts");
19066
+ const manifest = path19.join(package_root, "scripts", "hook_manifest.yaml");
18945
19067
  if (!isFile(dispatcher) || !isFile(manifest)) return 0;
18946
19068
  const failed = [];
18947
19069
  const skipped = [];
18948
19070
  const passed = [];
18949
19071
  for (const [platform, native] of SMOKE_PROBE_EVENTS) {
18950
19072
  const rel_bridge = SMOKE_BRIDGE_PATHS[platform] ?? "";
18951
- const bridge_path = rel_bridge ? path18.join(project_root, rel_bridge) : null;
19073
+ const bridge_path = rel_bridge ? path19.join(project_root, rel_bridge) : null;
18952
19074
  const bridge_present = Boolean(
18953
19075
  bridge_path && (isFile(bridge_path) || isDir(bridge_path) && dirHasEntries(bridge_path))
18954
19076
  );
@@ -19148,9 +19270,9 @@ To remove this marker, delete this file.
19148
19270
  `;
19149
19271
  }
19150
19272
  var _CLAUDE_DESKTOP_BUNDLES_SUBPATH = "claude-desktop/bundles";
19151
- var GLOBAL_ROOT = path18.join(os8.homedir(), ".event4u", "agent-config");
19152
- var GLOBAL_USER_SETTINGS_PATH = path18.join(GLOBAL_ROOT, ".agent-user.yml");
19153
- var GLOBAL_AGENT_SETTINGS_PATH = path18.join(GLOBAL_ROOT, ".agent-settings.yml");
19273
+ var GLOBAL_ROOT = path19.join(os8.homedir(), ".event4u", "agent-config");
19274
+ var GLOBAL_USER_SETTINGS_PATH = path19.join(GLOBAL_ROOT, ".agent-user.yml");
19275
+ var GLOBAL_AGENT_SETTINGS_PATH = path19.join(GLOBAL_ROOT, ".agent-settings.yml");
19154
19276
  function _bridge_marker(tool_id, scope) {
19155
19277
  if (scope === "global") return USER_SCOPE_PATHS[tool_id] ?? "";
19156
19278
  return PROJECT_BRIDGE_MARKERS[tool_id] ?? "";
@@ -19199,7 +19321,7 @@ function _load_yaml_doc(p) {
19199
19321
  return _isPlainObject2(data) ? data : {};
19200
19322
  }
19201
19323
  function _load_default_settings(package_root) {
19202
- const template_source = path18.join(package_root, "src", "config", "agent-settings.template.yml");
19324
+ const template_source = path19.join(package_root, "src", "config", "agent-settings.template.yml");
19203
19325
  if (!pathExists(template_source)) return {};
19204
19326
  let text;
19205
19327
  try {
@@ -19213,11 +19335,11 @@ function _load_default_settings(package_root) {
19213
19335
  }
19214
19336
  var RULE_LAYER_CHOICES = ["global", "project", "both-acknowledged"];
19215
19337
  function _suppress_rule_layer(project_root, suppress_dir) {
19216
- const target = path18.join(project_root, ".claude", "settings.local.json");
19338
+ const target = path19.join(project_root, ".claude", "settings.local.json");
19217
19339
  const existing = pathExists(target) ? read_json_file(target) : {};
19218
19340
  let real_dir = suppress_dir;
19219
19341
  try {
19220
- real_dir = fs21.realpathSync(suppress_dir);
19342
+ real_dir = fs22.realpathSync(suppress_dir);
19221
19343
  } catch {
19222
19344
  real_dir = suppress_dir;
19223
19345
  }
@@ -19228,8 +19350,8 @@ function _suppress_rule_layer(project_root, suppress_dir) {
19228
19350
  success(`.claude/settings.local.json: claudeMdExcludes += ${entry}`);
19229
19351
  }
19230
19352
  function _gate_rule_layer_overlap(project_root, layer, dry_run) {
19231
- const global_dir = path18.join(os8.homedir(), ".claude", "rules");
19232
- const project_dir = path18.join(project_root, ".claude", "rules");
19353
+ const global_dir = path19.join(os8.homedir(), ".claude", "rules");
19354
+ const project_dir = path19.join(project_root, ".claude", "rules");
19233
19355
  const g = readRuleLayer(global_dir);
19234
19356
  const p = readRuleLayer(project_dir);
19235
19357
  if (g === null || p === null) return true;
@@ -19339,9 +19461,9 @@ function detect_scope(cwd) {
19339
19461
  if (pathExists(_resolve_settings_read(cwd))) {
19340
19462
  return ["project", `existing ${SETTINGS_FILE}`];
19341
19463
  }
19342
- const has_manifest = SCOPE_DETECT_MANIFESTS.find((m) => pathExists(path18.join(cwd, m))) ?? null;
19343
- const has_ai_dir = SCOPE_DETECT_AI_DIRS.find((d) => isDir(path18.join(cwd, d))) ?? null;
19344
- const has_ai_file = SCOPE_DETECT_AI_FILES.find((f) => pathExists(path18.join(cwd, f))) ?? null;
19464
+ const has_manifest = SCOPE_DETECT_MANIFESTS.find((m) => pathExists(path19.join(cwd, m))) ?? null;
19465
+ const has_ai_dir = SCOPE_DETECT_AI_DIRS.find((d) => isDir(path19.join(cwd, d))) ?? null;
19466
+ const has_ai_file = SCOPE_DETECT_AI_FILES.find((f) => pathExists(path19.join(cwd, f))) ?? null;
19345
19467
  if (has_manifest && (has_ai_dir || has_ai_file)) {
19346
19468
  const marker = has_ai_dir || has_ai_file;
19347
19469
  return ["prompt", `manifest (${has_manifest}) + AI-tool config (${marker})`];
@@ -19362,7 +19484,7 @@ function readLineSyncRaw(promptText) {
19362
19484
  for (; ; ) {
19363
19485
  let n;
19364
19486
  try {
19365
- n = fs21.readSync(0, buf, 0, 1, null);
19487
+ n = fs22.readSync(0, buf, 0, 1, null);
19366
19488
  } catch (err) {
19367
19489
  const code = err.code;
19368
19490
  if (code === "EAGAIN") {
@@ -19437,8 +19559,8 @@ function _files_by_tool_from_bridges(tools, project_root, scope) {
19437
19559
  const marker = _bridge_marker(tool_id, scope);
19438
19560
  if (!marker) continue;
19439
19561
  let marker_path = marker;
19440
- if (!path18.isAbsolute(marker_path)) {
19441
- marker_path = path18.join(project_root, marker_path);
19562
+ if (!path19.isAbsolute(marker_path)) {
19563
+ marker_path = path19.join(project_root, marker_path);
19442
19564
  }
19443
19565
  out[tool_id] = [_file_entry(marker_path, "bridge", false)];
19444
19566
  }
@@ -19477,26 +19599,26 @@ function _update_installed_tools_manifest(project_root, tools, scope, force, fil
19477
19599
  }
19478
19600
  write_manifest(target, version, entries);
19479
19601
  if (!state.QUIET) {
19480
- const rel = isRelativeTo(target, project_root) ? path18.relative(project_root, target) : target;
19602
+ const rel = isRelativeTo(target, project_root) ? path19.relative(project_root, target) : target;
19481
19603
  info(`Manifest updated: ${rel}`);
19482
19604
  }
19483
19605
  return 0;
19484
19606
  }
19485
19607
  function isRelativeTo(child, parent) {
19486
- const rel = path18.relative(parent, child);
19487
- return rel === "" || !rel.startsWith("..") && !path18.isAbsolute(rel);
19608
+ const rel = path19.relative(parent, child);
19609
+ return rel === "" || !rel.startsWith("..") && !path19.isAbsolute(rel);
19488
19610
  }
19489
19611
  function _resolve_package_root_for_global() {
19490
19612
  const here = resolvePath(_HERE2);
19491
- const candidate = path18.dirname(path18.dirname(path18.dirname(here)));
19492
- if (!pathExists(path18.join(candidate, "src", "config", "profiles", "minimal.ini"))) {
19613
+ const candidate = path19.dirname(path19.dirname(path19.dirname(here)));
19614
+ if (!pathExists(path19.join(candidate, "src", "config", "profiles", "minimal.ini"))) {
19493
19615
  fail(
19494
19616
  `Could not locate agent-config package root from ${here}. Expected src/config/profiles/minimal.ini at the parent directory.`
19495
19617
  );
19496
19618
  }
19497
19619
  return candidate;
19498
19620
  }
19499
- var CONSUMER_BRIDGE_MARKER_RELPATH = path18.join("agents", ".event4u-bridge.yml");
19621
+ var CONSUMER_BRIDGE_MARKER_RELPATH = path19.join("agents", ".event4u-bridge.yml");
19500
19622
  var MIGRATE_LEGACY_YAML_FILES = [".agent-settings.yml", ".agent-user.yml"];
19501
19623
  var MIGRATE_LEGACY_TOOL_DIRS = [".augment", ".claude", ".cursor"];
19502
19624
  var AGENT_CONFIG_PACKAGE_NAME = "@event4u/agent-config";
@@ -19504,7 +19626,7 @@ function _is_agent_config_source_repo(project_root) {
19504
19626
  if (process3.env["AGENT_CONFIG_CONSUMER_MODE"] === "1") {
19505
19627
  return [false, "consumer-mode-override"];
19506
19628
  }
19507
- const pkg_json = path18.join(project_root, "package.json");
19629
+ const pkg_json = path19.join(project_root, "package.json");
19508
19630
  if (isFile(pkg_json)) {
19509
19631
  let data = {};
19510
19632
  try {
@@ -19516,18 +19638,18 @@ function _is_agent_config_source_repo(project_root) {
19516
19638
  return [true, "package.json:name"];
19517
19639
  }
19518
19640
  }
19519
- if (isDir(path18.join(project_root, ".agent-src.uncondensed"))) {
19641
+ if (isDir(path19.join(project_root, ".agent-src.uncondensed"))) {
19520
19642
  return [true, ".agent-src.uncondensed/"];
19521
19643
  }
19522
- const packages_dir = path18.join(project_root, "packages");
19644
+ const packages_dir = path19.join(project_root, "packages");
19523
19645
  if (isDir(packages_dir)) {
19524
- for (const child of fs21.readdirSync(packages_dir)) {
19525
- if (isDir(path18.join(packages_dir, child, ".agent-src.uncondensed"))) {
19646
+ for (const child of fs22.readdirSync(packages_dir)) {
19647
+ if (isDir(path19.join(packages_dir, child, ".agent-src.uncondensed"))) {
19526
19648
  return [true, `packages/${child}/.agent-src.uncondensed/`];
19527
19649
  }
19528
19650
  }
19529
19651
  }
19530
- const installer_self = path18.join(project_root, "scripts", "install.py");
19652
+ const installer_self = path19.join(project_root, "scripts", "install.py");
19531
19653
  try {
19532
19654
  if (isFile(installer_self) && resolvePath(installer_self) === resolvePath(_HERE2)) {
19533
19655
  return [true, "src/scripts/install.py (self)"];
@@ -19547,17 +19669,17 @@ function _detect_legacy_for_migration(project_root) {
19547
19669
  }
19548
19670
  return [];
19549
19671
  }
19550
- if (isFile(path18.join(project_root, INSTALL_MODE_MARKER_REL))) return [];
19672
+ if (isFile(path19.join(project_root, INSTALL_MODE_MARKER_REL))) return [];
19551
19673
  const found = [];
19552
19674
  for (const name of MIGRATE_LEGACY_YAML_FILES) {
19553
- if (isFile(path18.join(project_root, name))) {
19675
+ if (isFile(path19.join(project_root, name))) {
19554
19676
  found.push(name);
19555
- } else if (isFile(path18.join(project_root, "settings", name))) {
19677
+ } else if (isFile(path19.join(project_root, "settings", name))) {
19556
19678
  found.push(`settings/${name}`);
19557
19679
  }
19558
19680
  }
19559
19681
  for (const name of MIGRATE_LEGACY_TOOL_DIRS) {
19560
- const p = path18.join(project_root, name);
19682
+ const p = path19.join(project_root, name);
19561
19683
  if (isDir(p) && !isSymlink(p)) {
19562
19684
  found.push(`${name}/`);
19563
19685
  }
@@ -19569,7 +19691,7 @@ function _prompt_migrate_to_global(project_root, artefacts) {
19569
19691
  process3.stdout.write("\n");
19570
19692
  warn("Legacy project-local artefacts detected \u2014 pre-ADR-020 layout:");
19571
19693
  for (const rel of artefacts) {
19572
- info(` ${path18.join(project_root, rel)}`);
19694
+ info(` ${path19.join(project_root, rel)}`);
19573
19695
  }
19574
19696
  info("The unified `agent-config migrate` sweeps these in one pass.");
19575
19697
  info("The wizard recreates fresh config afterwards.");
@@ -19600,20 +19722,20 @@ function _run_migrate_to_global(project_root) {
19600
19722
  function _format_global_root_for_marker(global_root) {
19601
19723
  const home = resolvePath(os8.homedir());
19602
19724
  const resolved = resolvePath(global_root);
19603
- const rel = path18.relative(home, resolved);
19604
- if (rel === "" || rel.startsWith("..") || path18.isAbsolute(rel)) {
19725
+ const rel = path19.relative(home, resolved);
19726
+ if (rel === "" || rel.startsWith("..") || path19.isAbsolute(rel)) {
19605
19727
  return global_root;
19606
19728
  }
19607
- return `~/${rel.split(path18.sep).join("/")}`;
19729
+ return `~/${rel.split(path19.sep).join("/")}`;
19608
19730
  }
19609
19731
  function _remove_legacy_consumer_bridge_marker(project_root, env = null) {
19610
19732
  const env_map = env ?? process3.env;
19611
19733
  if (env_map["AGENT_CONFIG_DEV_MODE"] === "1") return null;
19612
- if (isDir(path18.join(project_root, ".agent-src.uncondensed"))) return null;
19613
- const target = path18.join(project_root, CONSUMER_BRIDGE_MARKER_RELPATH);
19734
+ if (isDir(path19.join(project_root, ".agent-src.uncondensed"))) return null;
19735
+ const target = path19.join(project_root, CONSUMER_BRIDGE_MARKER_RELPATH);
19614
19736
  if (!isFile(target)) return null;
19615
19737
  try {
19616
- fs21.rmSync(target);
19738
+ fs22.rmSync(target);
19617
19739
  } catch {
19618
19740
  return null;
19619
19741
  }
@@ -19627,7 +19749,7 @@ var PROJECT_ANCHOR_TOOLS = {
19627
19749
  function _write_per_tool_project_anchors(project_root, tools, env = null, now = null) {
19628
19750
  const env_map = env ?? process3.env;
19629
19751
  if (env_map["AGENT_CONFIG_DEV_MODE"] === "1") return [];
19630
- if (isDir(path18.join(project_root, ".agent-src.uncondensed"))) return [];
19752
+ if (isDir(path19.join(project_root, ".agent-src.uncondensed"))) return [];
19631
19753
  const global_root_str = _format_global_root_for_marker(
19632
19754
  event4u_root(env_map)
19633
19755
  );
@@ -19636,8 +19758,8 @@ function _write_per_tool_project_anchors(project_root, tools, env = null, now =
19636
19758
  for (const tool_id of Object.keys(PROJECT_ANCHOR_TOOLS).sort()) {
19637
19759
  const rel_path = PROJECT_ANCHOR_TOOLS[tool_id];
19638
19760
  if (!tools.has(tool_id)) continue;
19639
- const target = path18.join(project_root, rel_path);
19640
- mkdirp(path18.dirname(target));
19761
+ const target = path19.join(project_root, rel_path);
19762
+ mkdirp(path19.dirname(target));
19641
19763
  const body = `# event4u/agent-config \u2014 per-tool project anchor (auto-written).
19642
19764
  # Spec: docs/contracts/consumer-bridge.md \xA7 Per-tool anchor strategy.
19643
19765
  # Tool: ${tool_id}. Resolves the global install directly \u2014 no
@@ -19655,7 +19777,7 @@ installed_at: ${stamp}
19655
19777
  }
19656
19778
  var PACKAGE_TAG_ID = "event4u/agent-config";
19657
19779
  function _inject_package_tag(target, source, package_root) {
19658
- if (path18.extname(target) !== ".md") return;
19780
+ if (path19.extname(target) !== ".md") return;
19659
19781
  let text;
19660
19782
  try {
19661
19783
  text = readText(target);
@@ -19683,8 +19805,8 @@ function _inject_package_tag(target, source, package_root) {
19683
19805
  resolved_src = source;
19684
19806
  }
19685
19807
  if (package_root !== null) {
19686
- const rel = path18.relative(resolvePath(package_root), resolved_src);
19687
- if (rel !== "" && !rel.startsWith("..") && !path18.isAbsolute(rel)) {
19808
+ const rel = path19.relative(resolvePath(package_root), resolved_src);
19809
+ if (rel !== "" && !rel.startsWith("..") && !path19.isAbsolute(rel)) {
19688
19810
  source_value = rel;
19689
19811
  } else {
19690
19812
  source_value = resolved_src;
@@ -19719,7 +19841,7 @@ function _escapes_package_root(resolved, package_root) {
19719
19841
  if (package_root === null) return false;
19720
19842
  let root;
19721
19843
  try {
19722
- root = fs21.realpathSync(package_root);
19844
+ root = fs22.realpathSync(package_root);
19723
19845
  } catch {
19724
19846
  return false;
19725
19847
  }
@@ -19734,7 +19856,7 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
19734
19856
  if (file_filter !== null && !file_filter(src)) return [0, 0, written_paths];
19735
19857
  let resolved_src = src;
19736
19858
  try {
19737
- resolved_src = fs21.realpathSync(src);
19859
+ resolved_src = fs22.realpathSync(src);
19738
19860
  } catch {
19739
19861
  resolved_src = src;
19740
19862
  }
@@ -19742,10 +19864,10 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
19742
19864
  warn(`refused: ${src} dereferences outside the package root \u2014 not copied`);
19743
19865
  return [0, 0, written_paths];
19744
19866
  }
19745
- mkdirp(path18.dirname(dest));
19867
+ mkdirp(path19.dirname(dest));
19746
19868
  const decision = _resolve_file_conflict(dest, force);
19747
19869
  if (decision === "skip") return [0, 1, written_paths];
19748
- fs21.copyFileSync(src, dest);
19870
+ fs22.copyFileSync(src, dest);
19749
19871
  _inject_package_tag(dest, src, package_root);
19750
19872
  written_paths.push(dest);
19751
19873
  return [1, 0, written_paths];
@@ -19753,11 +19875,11 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
19753
19875
  mkdirp(dest);
19754
19876
  const walk = (node) => {
19755
19877
  const acc = [];
19756
- const names = fs21.readdirSync(node).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
19878
+ const names = fs22.readdirSync(node).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
19757
19879
  for (const name of names) {
19758
- const entry = path18.join(node, name);
19880
+ const entry = path19.join(node, name);
19759
19881
  acc.push(entry);
19760
- const lst = fs21.lstatSync(entry);
19882
+ const lst = fs22.lstatSync(entry);
19761
19883
  if (lst.isDirectory() && !lst.isSymbolicLink()) {
19762
19884
  acc.push(...walk(entry));
19763
19885
  }
@@ -19765,9 +19887,9 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
19765
19887
  return acc;
19766
19888
  };
19767
19889
  for (const entry of walk(src)) {
19768
- const rel = path18.relative(src, entry);
19769
- const target = path18.join(dest, rel);
19770
- const lst = fs21.lstatSync(entry);
19890
+ const rel = path19.relative(src, entry);
19891
+ const target = path19.join(dest, rel);
19892
+ const lst = fs22.lstatSync(entry);
19771
19893
  if (lst.isDirectory() && !lst.isSymbolicLink()) {
19772
19894
  mkdirp(target);
19773
19895
  continue;
@@ -19775,8 +19897,8 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
19775
19897
  let resolvedIsDir = false;
19776
19898
  let resolved = entry;
19777
19899
  try {
19778
- resolved = fs21.realpathSync(entry);
19779
- resolvedIsDir = fs21.statSync(entry).isDirectory();
19900
+ resolved = fs22.realpathSync(entry);
19901
+ resolvedIsDir = fs22.statSync(entry).isDirectory();
19780
19902
  } catch {
19781
19903
  resolvedIsDir = false;
19782
19904
  }
@@ -19806,8 +19928,8 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
19806
19928
  skipped += 1;
19807
19929
  continue;
19808
19930
  }
19809
- mkdirp(path18.dirname(target));
19810
- fs21.copyFileSync(resolved, target);
19931
+ mkdirp(path19.dirname(target));
19932
+ fs22.copyFileSync(resolved, target);
19811
19933
  _inject_package_tag(target, resolved, package_root);
19812
19934
  written += 1;
19813
19935
  written_paths.push(target);
@@ -19819,7 +19941,7 @@ function _claude_desktop_bundles_dir() {
19819
19941
  }
19820
19942
  function _write_claude_desktop_marker(_force, lockfile_path2, bundles_dir, bundle_count) {
19821
19943
  const anchor = expanduser6(USER_SCOPE_PATHS["claude-desktop"]);
19822
- const target = path18.join(anchor, "agent-config.md");
19944
+ const target = path19.join(anchor, "agent-config.md");
19823
19945
  mkdirp(anchor);
19824
19946
  const body = claudeDesktopMarkerBody(lockfile_path2, anchor, bundles_dir, bundle_count);
19825
19947
  writeText(target, body);
@@ -19843,23 +19965,23 @@ function _apply_claude_flat_command_wrappers(anchor, package_root, current_files
19843
19965
  const wrapped = [];
19844
19966
  const collisions = [];
19845
19967
  const reserved = [];
19846
- const commands_dir = path18.join(anchor, "commands");
19968
+ const commands_dir = path19.join(anchor, "commands");
19847
19969
  let flat_entries = [];
19848
19970
  try {
19849
- flat_entries = fs21.readdirSync(commands_dir).filter((f) => f.endsWith(".md"));
19971
+ flat_entries = fs22.readdirSync(commands_dir).filter((f) => f.endsWith(".md"));
19850
19972
  } catch {
19851
19973
  }
19852
19974
  for (const fname of flat_entries.sort()) {
19853
19975
  const slug = fname.slice(0, -".md".length);
19854
19976
  if (!is_claude_builtin_name(slug)) continue;
19855
- fs21.rmSync(path18.join(commands_dir, fname), { force: true });
19977
+ fs22.rmSync(path19.join(commands_dir, fname), { force: true });
19856
19978
  current_files.delete(`commands/${fname}`);
19857
19979
  reserved.push(slug);
19858
19980
  }
19859
19981
  const eligible = new Set(_CLAUDE_FLAT_WRAPPER_EXTRA);
19860
19982
  try {
19861
19983
  const manifest = JSON.parse(
19862
- fs21.readFileSync(path18.join(package_root, "dist", "discovery", "discovery-manifest.json"), "utf8")
19984
+ fs22.readFileSync(path19.join(package_root, "dist", "discovery", "discovery-manifest.json"), "utf8")
19863
19985
  );
19864
19986
  for (const a of manifest.artefacts ?? []) {
19865
19987
  if (a.category !== "command" || typeof a.slug !== "string") continue;
@@ -19870,22 +19992,22 @@ function _apply_claude_flat_command_wrappers(anchor, package_root, current_files
19870
19992
  }
19871
19993
  for (const slug of [...eligible].sort()) {
19872
19994
  const flat_rel = `commands/${slug}.md`;
19873
- const flat_abs = path18.join(anchor, "commands", `${slug}.md`);
19874
- if (!fs21.existsSync(flat_abs)) continue;
19875
- const skill_dir = path18.join(anchor, "skills", slug);
19876
- if (fs21.existsSync(skill_dir)) {
19995
+ const flat_abs = path19.join(anchor, "commands", `${slug}.md`);
19996
+ if (!fs22.existsSync(flat_abs)) continue;
19997
+ const skill_dir = path19.join(anchor, "skills", slug);
19998
+ if (fs22.existsSync(skill_dir)) {
19877
19999
  collisions.push(slug);
19878
20000
  continue;
19879
20001
  }
19880
- let body = fs21.readFileSync(flat_abs, "utf8");
20002
+ let body = fs22.readFileSync(flat_abs, "utf8");
19881
20003
  if (body.startsWith("---\n") && !/^name:/m.test(body.split("\n---")[0] ?? "")) {
19882
20004
  body = body.replace("---\n", `---
19883
20005
  name: ${slug}
19884
20006
  `);
19885
20007
  }
19886
- fs21.mkdirSync(skill_dir, { recursive: true });
19887
- fs21.writeFileSync(path18.join(skill_dir, "SKILL.md"), body, "utf8");
19888
- fs21.rmSync(flat_abs, { force: true });
20008
+ fs22.mkdirSync(skill_dir, { recursive: true });
20009
+ fs22.writeFileSync(path19.join(skill_dir, "SKILL.md"), body, "utf8");
20010
+ fs22.rmSync(flat_abs, { force: true });
19889
20011
  current_files.delete(flat_rel);
19890
20012
  current_files.add(`skills/${slug}/SKILL.md`);
19891
20013
  wrapped.push(slug);
@@ -19917,8 +20039,8 @@ function _deploy_global_content(tools, force, package_root, lockfile_path2) {
19917
20039
  const written_paths = [];
19918
20040
  let current_files = /* @__PURE__ */ new Set();
19919
20041
  for (const [src_rel, dest_sub] of plan) {
19920
- const src = path18.join(package_root, src_rel);
19921
- const dest = dest_sub ? path18.join(anchor, dest_sub) : anchor;
20042
+ const src = path19.join(package_root, src_rel);
20043
+ const dest = dest_sub ? path19.join(anchor, dest_sub) : anchor;
19922
20044
  const rule_filter = _rule_filter_for_source(src_rel, rule_scope);
19923
20045
  const [w, s, paths] = _copy_dir_dereferencing_symlinks(
19924
20046
  src,
@@ -19992,10 +20114,10 @@ function _deploy_global_content(tools, force, package_root, lockfile_path2) {
19992
20114
  results[tool_id] = [written_total, skipped_total, "deployed", written_paths];
19993
20115
  if (tool_id === "claude-code") {
19994
20116
  try {
19995
- const manifest = path18.join(package_root, "src", "scripts", "hook_manifest.yaml");
20117
+ const manifest = path19.join(package_root, "src", "scripts", "hook_manifest.yaml");
19996
20118
  const matrix = build_claude_hook_matrix(manifest);
19997
20119
  const res = ensure_managed_hooks(
19998
- path18.join(anchor, "settings.json"),
20120
+ path19.join(anchor, "settings.json"),
19999
20121
  matrix
20000
20122
  );
20001
20123
  if (!state.QUIET) {
@@ -20032,7 +20154,7 @@ function _preview_global_reap(tools, package_root) {
20032
20154
  const anchor = expanduser6(anchor_raw);
20033
20155
  let current_files = /* @__PURE__ */ new Set();
20034
20156
  for (const [src_rel, dest_sub] of plan) {
20035
- const src = path18.join(package_root, src_rel);
20157
+ const src = path19.join(package_root, src_rel);
20036
20158
  current_files = setUnion(
20037
20159
  current_files,
20038
20160
  expected_deploy_files(
@@ -20066,14 +20188,14 @@ function _preview_global_reap(tools, package_root) {
20066
20188
  function _verify_deploy_targets(anchor, plan) {
20067
20189
  const missing = [];
20068
20190
  for (const [, dest_sub] of plan) {
20069
- const target = dest_sub ? path18.join(anchor, dest_sub) : anchor;
20191
+ const target = dest_sub ? path19.join(anchor, dest_sub) : anchor;
20070
20192
  const label = dest_sub || ".";
20071
20193
  if (!isDir(target)) {
20072
20194
  missing.push(label);
20073
20195
  continue;
20074
20196
  }
20075
20197
  try {
20076
- const entries = fs21.readdirSync(target);
20198
+ const entries = fs22.readdirSync(target);
20077
20199
  if (entries.length === 0) missing.push(label);
20078
20200
  } catch {
20079
20201
  missing.push(label);
@@ -20081,61 +20203,8 @@ function _verify_deploy_targets(anchor, plan) {
20081
20203
  }
20082
20204
  return missing;
20083
20205
  }
20084
- function _prune_modules_by(deploy_results, is_pruned) {
20085
- let pruned = 0;
20086
- const adjusted = {};
20087
- for (const tool_id of Object.keys(deploy_results)) {
20088
- const [written, skipped, status, paths] = deploy_results[tool_id];
20089
- const pruned_skill_dirs = /* @__PURE__ */ new Set();
20090
- for (const p of paths) {
20091
- const parts = p.split(path18.sep);
20092
- if (parts.includes("skills")) {
20093
- const i = parts.indexOf("skills");
20094
- if (i + 1 < parts.length) {
20095
- const skill_root = parts.slice(0, i + 2).join(path18.sep);
20096
- if (!pruned_skill_dirs.has(skill_root)) {
20097
- const skillmd = path18.join(skill_root, "SKILL.md");
20098
- if (pathExists(skillmd) && is_pruned(skillmd)) {
20099
- pruned_skill_dirs.add(skill_root);
20100
- }
20101
- }
20102
- }
20103
- }
20104
- }
20105
- const keep = [];
20106
- const delete_files = [];
20107
- for (const p of paths) {
20108
- const parts = p.split(path18.sep);
20109
- let is_target = false;
20110
- if (parts.includes("skills")) {
20111
- const i = parts.indexOf("skills");
20112
- if (i + 1 < parts.length && pruned_skill_dirs.has(parts.slice(0, i + 2).join(path18.sep))) {
20113
- is_target = true;
20114
- }
20115
- } else if (parts.includes("commands") && path18.extname(p) === ".md" && is_pruned(p)) {
20116
- is_target = true;
20117
- }
20118
- (is_target ? delete_files : keep).push(p);
20119
- }
20120
- for (const d of pruned_skill_dirs) {
20121
- fs21.rmSync(d, { recursive: true, force: true });
20122
- }
20123
- for (const p of delete_files) {
20124
- if (p.split(path18.sep).includes("commands") && pathExists(p)) {
20125
- try {
20126
- fs21.unlinkSync(p);
20127
- } catch {
20128
- }
20129
- }
20130
- }
20131
- pruned += delete_files.length;
20132
- adjusted[tool_id] = [Math.max(0, written - delete_files.length), skipped, status, keep];
20133
- }
20134
- return [pruned, adjusted];
20135
- }
20136
- function _prune_lab_modules(deploy_results, lab_ids) {
20137
- return _prune_modules_by(deploy_results, (p) => is_lab_artefact(p, lab_ids));
20138
- }
20206
+ var _prune_modules_by = prune_modules_by;
20207
+ var _prune_lab_modules = prune_lab_modules;
20139
20208
  var _load_packs_registry = load_packs_registry;
20140
20209
  var _compute_active_pack_ids = compute_active_pack_ids;
20141
20210
  function _resolve_global_settings_doc() {
@@ -20144,16 +20213,16 @@ function _resolve_global_settings_doc() {
20144
20213
  }
20145
20214
  function _resolve_global_settings_path() {
20146
20215
  const root = event4u_root();
20147
- const canonical = path18.join(root, "settings", SETTINGS_FILE);
20216
+ const canonical = path19.join(root, "settings", SETTINGS_FILE);
20148
20217
  if (pathExists(canonical)) return canonical;
20149
- const legacy = path18.join(root, SETTINGS_FILE);
20218
+ const legacy = path19.join(root, SETTINGS_FILE);
20150
20219
  if (pathExists(legacy)) return legacy;
20151
20220
  return null;
20152
20221
  }
20153
20222
  function _resolve_scoped_projection(package_root) {
20154
20223
  const doc = _resolve_global_settings_doc() ?? _load_default_settings(package_root);
20155
20224
  const projection = _isPlainObject2(doc["projection"]) ? doc["projection"] : {};
20156
- const mode = projection["mode"] === "scoped" ? "scoped" : "legacy-all";
20225
+ const mode = projectionModeOf(projection["mode"]);
20157
20226
  const runtime = _isPlainObject2(doc["runtime"]) ? doc["runtime"] : {};
20158
20227
  const active_packs_raw = runtime["active_packs"];
20159
20228
  const active_packs = Array.isArray(active_packs_raw) ? active_packs_raw.filter((v) => typeof v === "string") : [];
@@ -20257,7 +20326,7 @@ function install_global(tools, force, project_root = null, core_only = false) {
20257
20326
  info(` schema_version=1, agent_config_version=${installed_version}`);
20258
20327
  info(` tools=${merged_tools.join(",")}`);
20259
20328
  }
20260
- if (project_root !== null && pathExists(_resolve_settings_read(project_root)) && !isDir(path18.join(project_root, ".agent-src.uncondensed"))) {
20329
+ if (project_root !== null && pathExists(_resolve_settings_read(project_root)) && !isDir(path19.join(project_root, ".agent-src.uncondensed"))) {
20261
20330
  const drift = collect_drift(project_root);
20262
20331
  if (!state.QUIET) {
20263
20332
  process3.stdout.write("\n");
@@ -20280,6 +20349,13 @@ function install_global(tools, force, project_root = null, core_only = false) {
20280
20349
  }
20281
20350
  try {
20282
20351
  const { mode, active_packs } = _resolve_scoped_projection(package_root);
20352
+ if (mode === "tiered") {
20353
+ const outcome = applyTieredPrune(deploy_results, package_root, _prune_modules_by);
20354
+ deploy_results = outcome.deployResults;
20355
+ if (!state.QUIET && outcome.message !== null) {
20356
+ (outcome.level === "warn" ? warn : info)(outcome.message);
20357
+ }
20358
+ }
20283
20359
  if (mode === "scoped") {
20284
20360
  const packs_registry = _load_packs_registry(package_root);
20285
20361
  const active_ids = _compute_active_pack_ids(packs_registry, active_packs);
@@ -20364,19 +20440,19 @@ function install_global(tools, force, project_root = null, core_only = false) {
20364
20440
  }
20365
20441
  }
20366
20442
  }
20367
- if (project_root !== null && pathExists(_resolve_settings_read(project_root)) && !isDir(path18.join(project_root, ".agent-src.uncondensed"))) {
20443
+ if (project_root !== null && pathExists(_resolve_settings_read(project_root)) && !isDir(path19.join(project_root, ".agent-src.uncondensed"))) {
20368
20444
  const files_by_tool = _files_by_tool_from_deploy(deploy_results);
20369
20445
  const rc = _update_installed_tools_manifest(project_root, tools, "global", force, files_by_tool);
20370
20446
  if (rc !== 0) return rc;
20371
20447
  const removed_marker = _remove_legacy_consumer_bridge_marker(project_root);
20372
20448
  if (removed_marker !== null && !state.QUIET) {
20373
- const rel = isRelativeTo(removed_marker, project_root) ? path18.relative(project_root, removed_marker) : removed_marker;
20449
+ const rel = isRelativeTo(removed_marker, project_root) ? path19.relative(project_root, removed_marker) : removed_marker;
20374
20450
  info(`Removed legacy bridge marker: ${rel}`);
20375
20451
  }
20376
20452
  const anchor_paths = _write_per_tool_project_anchors(project_root, tools);
20377
20453
  if (anchor_paths.length > 0 && !state.QUIET) {
20378
20454
  for (const p of anchor_paths) {
20379
- const rel = isRelativeTo(p, project_root) ? path18.relative(project_root, p) : p;
20455
+ const rel = isRelativeTo(p, project_root) ? path19.relative(project_root, p) : p;
20380
20456
  info(`Project anchor written: ${rel}`);
20381
20457
  }
20382
20458
  }
@@ -20412,8 +20488,8 @@ function install_global(tools, force, project_root = null, core_only = false) {
20412
20488
  }
20413
20489
  function _catalogue_truncation_warnings(deploy_results, project_root) {
20414
20490
  const log_candidates = [
20415
- path18.join(event4u_root(), "state", "skill-catalogue.jsonl"),
20416
- ...project_root ? [path18.join(project_root, OBSERVATION_LOG)] : []
20491
+ path19.join(event4u_root(), "state", "skill-catalogue.jsonl"),
20492
+ ...project_root ? [path19.join(project_root, OBSERVATION_LOG)] : []
20417
20493
  ];
20418
20494
  const records = log_candidates.flatMap((p) => readObservationLog(p));
20419
20495
  if (records.length === 0) return [];
@@ -20436,13 +20512,13 @@ function _catalogue_truncation_warnings(deploy_results, project_root) {
20436
20512
  function _scoped_migration_notice(deploy_results, project_root, package_root, probe) {
20437
20513
  if (!isInteractiveSession(probe)) return [];
20438
20514
  const log_candidates = [
20439
- path18.join(event4u_root(), "state", "skill-catalogue.jsonl"),
20440
- ...project_root ? [path18.join(project_root, OBSERVATION_LOG)] : []
20515
+ path19.join(event4u_root(), "state", "skill-catalogue.jsonl"),
20516
+ ...project_root ? [path19.join(project_root, OBSERVATION_LOG)] : []
20441
20517
  ];
20442
20518
  const limits = knownHostLimits(log_candidates.flatMap((p) => readObservationLog(p)));
20443
20519
  if (limits.size === 0) return [];
20444
20520
  const resolved = _resolve_scoped_projection(package_root);
20445
- const settings_path = _resolve_global_settings_path() ?? path18.join(event4u_root(), "settings", SETTINGS_FILE);
20521
+ const settings_path = _resolve_global_settings_path() ?? path19.join(event4u_root(), "settings", SETTINGS_FILE);
20446
20522
  for (const tool_id of Object.keys(deploy_results).sort()) {
20447
20523
  const [, , status] = deploy_results[tool_id];
20448
20524
  if (status !== "deployed") continue;
@@ -20461,8 +20537,8 @@ function _scoped_migration_notice(deploy_results, project_root, package_root, pr
20461
20537
  }
20462
20538
  return [];
20463
20539
  }
20464
- var SETTINGS_SURFACE_REL = path18.join("state", "settings-surface.json");
20465
- var SETTINGS_DELTA_REL = path18.join("state", "settings-delta.json");
20540
+ var SETTINGS_SURFACE_REL = path19.join("state", "settings-surface.json");
20541
+ var SETTINGS_DELTA_REL = path19.join("state", "settings-delta.json");
20466
20542
  function _current_settings_surface(version) {
20467
20543
  const jsonSchema = zodToJsonSchema(settingsSchema, {
20468
20544
  name: "AgentSettings",
@@ -20473,20 +20549,20 @@ function _current_settings_surface(version) {
20473
20549
  }
20474
20550
  function _write_settings_surface_snapshot(installed_version) {
20475
20551
  const root = event4u_root();
20476
- const surface_path = path18.join(root, SETTINGS_SURFACE_REL);
20477
- const delta_path = path18.join(root, SETTINGS_DELTA_REL);
20552
+ const surface_path = path19.join(root, SETTINGS_SURFACE_REL);
20553
+ const delta_path = path19.join(root, SETTINGS_DELTA_REL);
20478
20554
  const next = _current_settings_surface(installed_version);
20479
20555
  let previous = null;
20480
20556
  try {
20481
- const parsed = JSON.parse(fs21.readFileSync(surface_path, "utf8"));
20557
+ const parsed = JSON.parse(fs22.readFileSync(surface_path, "utf8"));
20482
20558
  if (parsed !== null && typeof parsed === "object" && parsed.entries !== void 0) previous = parsed;
20483
20559
  } catch {
20484
20560
  }
20485
20561
  if (previous !== null && previous.version !== next.version) {
20486
20562
  const delta = computeSurfaceDelta(previous, next);
20487
20563
  if (delta.changes.length > 0) {
20488
- fs21.mkdirSync(path18.dirname(delta_path), { recursive: true, mode: 448 });
20489
- fs21.writeFileSync(delta_path, `${JSON.stringify(delta, null, 2)}
20564
+ fs22.mkdirSync(path19.dirname(delta_path), { recursive: true, mode: 448 });
20565
+ fs22.writeFileSync(delta_path, `${JSON.stringify(delta, null, 2)}
20490
20566
  `, { mode: 384 });
20491
20567
  if (!state.QUIET) {
20492
20568
  const counts = {};
@@ -20498,8 +20574,8 @@ function _write_settings_surface_snapshot(installed_version) {
20498
20574
  }
20499
20575
  }
20500
20576
  }
20501
- fs21.mkdirSync(path18.dirname(surface_path), { recursive: true, mode: 448 });
20502
- fs21.writeFileSync(surface_path, `${JSON.stringify(next, null, 2)}
20577
+ fs22.mkdirSync(path19.dirname(surface_path), { recursive: true, mode: 448 });
20578
+ fs22.writeFileSync(surface_path, `${JSON.stringify(next, null, 2)}
20503
20579
  `, { mode: 384 });
20504
20580
  }
20505
20581
  function arrayStrEqual(a, b) {
@@ -20719,13 +20795,13 @@ function _minimal_templates_root() {
20719
20795
  const chain = [start];
20720
20796
  let cur = start;
20721
20797
  for (; ; ) {
20722
- const parent = path18.dirname(cur);
20798
+ const parent = path19.dirname(cur);
20723
20799
  if (parent === cur) break;
20724
20800
  chain.push(parent);
20725
20801
  cur = parent;
20726
20802
  }
20727
20803
  for (const ancestor of chain) {
20728
- const candidate = path18.join(ancestor, "src", "templates", "minimal");
20804
+ const candidate = path19.join(ancestor, "src", "templates", "minimal");
20729
20805
  if (isDir(candidate)) return candidate;
20730
20806
  }
20731
20807
  fail("Could not locate src/templates/minimal/ \u2014 package install is corrupt.");
@@ -20733,9 +20809,9 @@ function _minimal_templates_root() {
20733
20809
  var INSTALL_MODE_MARKER_REL = "agents/.agent-state/install-mode.txt";
20734
20810
  function _write_install_mode_marker(project_root, mode) {
20735
20811
  if (mode !== "minimal" && mode !== "full") return;
20736
- const marker = path18.join(project_root, INSTALL_MODE_MARKER_REL);
20812
+ const marker = path19.join(project_root, INSTALL_MODE_MARKER_REL);
20737
20813
  try {
20738
- mkdirp(path18.dirname(marker));
20814
+ mkdirp(path19.dirname(marker));
20739
20815
  writeText(marker, `${mode}
20740
20816
  `);
20741
20817
  } catch {
@@ -20744,7 +20820,7 @@ function _write_install_mode_marker(project_root, mode) {
20744
20820
  function install_minimal(target_root_in, force, user_type = "") {
20745
20821
  let target_root = resolvePath(target_root_in);
20746
20822
  mkdirp(target_root);
20747
- const parent = path18.dirname(target_root);
20823
+ const parent = path19.dirname(target_root);
20748
20824
  if (parent !== target_root) {
20749
20825
  const existing = find_project_root_with_anchor(parent);
20750
20826
  if (existing !== null && existing[0] !== target_root) {
@@ -20755,21 +20831,21 @@ function install_minimal(target_root_in, force, user_type = "") {
20755
20831
  }
20756
20832
  }
20757
20833
  const templates = _minimal_templates_root();
20758
- const settings_src = path18.join(templates, SETTINGS_FILE);
20759
- const overrides_gitkeep_src = path18.join(templates, "overrides-gitkeep");
20760
- const overrides_readme_src = path18.join(templates, "agents-overrides-readme.md");
20834
+ const settings_src = path19.join(templates, SETTINGS_FILE);
20835
+ const overrides_gitkeep_src = path19.join(templates, "overrides-gitkeep");
20836
+ const overrides_readme_src = path19.join(templates, "agents-overrides-readme.md");
20761
20837
  if (!isFile(settings_src)) fail(`Bundled minimal settings template missing under ${templates}`);
20762
20838
  if (!isFile(overrides_gitkeep_src) || !isFile(overrides_readme_src)) {
20763
20839
  fail(`Bundled overrides scaffold templates missing under ${templates}`);
20764
20840
  }
20765
20841
  info(`Minimal init \u2192 ${target_root}`);
20766
- const overrides_root = path18.join(target_root, "agents", "overrides");
20842
+ const overrides_root = path19.join(target_root, "agents", "overrides");
20767
20843
  mkdirp(overrides_root);
20768
20844
  const gitkeep_body = readText(overrides_gitkeep_src);
20769
20845
  for (const sub of ["rules", "skills", "commands"]) {
20770
- const sub_dir = path18.join(overrides_root, sub);
20846
+ const sub_dir = path19.join(overrides_root, sub);
20771
20847
  mkdirp(sub_dir);
20772
- const gitkeep_dst = path18.join(sub_dir, ".gitkeep");
20848
+ const gitkeep_dst = path19.join(sub_dir, ".gitkeep");
20773
20849
  if (pathExists(gitkeep_dst) && !force) {
20774
20850
  skip(`agents/overrides/${sub}/.gitkeep already exists (use --force to overwrite)`);
20775
20851
  } else {
@@ -20777,7 +20853,7 @@ function install_minimal(target_root_in, force, user_type = "") {
20777
20853
  success(`Wrote agents/overrides/${sub}/.gitkeep`);
20778
20854
  }
20779
20855
  }
20780
- const readme_dst = path18.join(overrides_root, "README.md");
20856
+ const readme_dst = path19.join(overrides_root, "README.md");
20781
20857
  if (pathExists(readme_dst) && !force) {
20782
20858
  skip("agents/overrides/README.md already exists (use --force to overwrite)");
20783
20859
  } else {
@@ -20795,14 +20871,14 @@ function install_minimal(target_root_in, force, user_type = "") {
20795
20871
  personal:
20796
20872
  user_type: ${user_type}
20797
20873
  `;
20798
- mkdirp(path18.dirname(settings_dst));
20874
+ mkdirp(path19.dirname(settings_dst));
20799
20875
  writeText(settings_dst, body);
20800
20876
  success(`Wrote ${SETTINGS_FILE} (user_type=${user_type})`);
20801
20877
  }
20802
20878
  }
20803
20879
  const removed_marker = _remove_legacy_consumer_bridge_marker(target_root);
20804
20880
  if (removed_marker !== null) {
20805
- const rel = isRelativeTo(removed_marker, target_root) ? path18.relative(target_root, removed_marker) : removed_marker;
20881
+ const rel = isRelativeTo(removed_marker, target_root) ? path19.relative(target_root, removed_marker) : removed_marker;
20806
20882
  success(`Removed legacy bridge marker: ${rel}`);
20807
20883
  }
20808
20884
  _write_install_mode_marker(target_root, "minimal");
@@ -20876,7 +20952,7 @@ function run_interactive_init(project_root, force) {
20876
20952
  );
20877
20953
  return 0;
20878
20954
  }
20879
- const target = path18.join(project_root, _LOCAL_CONFIG_FILE);
20955
+ const target = path19.join(project_root, _LOCAL_CONFIG_FILE);
20880
20956
  if (pathExists(target) && !force) {
20881
20957
  warn(
20882
20958
  `${_LOCAL_CONFIG_FILE} already exists; re-run with --force to overwrite. Skipping interactive init.`
@@ -20903,7 +20979,7 @@ function run_interactive_init(project_root, force) {
20903
20979
  warn(`Could not write ${target}: ${String(exc)}`);
20904
20980
  return 1;
20905
20981
  }
20906
- success(`Wrote ${path18.relative(project_root, target)} (${user_type} / ${stack} / ${verbosity})`);
20982
+ success(`Wrote ${path19.relative(project_root, target)} (${user_type} / ${stack} / ${verbosity})`);
20907
20983
  return 0;
20908
20984
  }
20909
20985
  var _WIZARD_READY_RE = /^WIZARD_READY (http:\/\/(?:127\.0\.0\.1|localhost):\d+\/\S*)\r?$/;
@@ -20921,12 +20997,12 @@ function _wizard_should_launch(opts) {
20921
20997
  return [true, ""];
20922
20998
  }
20923
20999
  function _wizard_cli_dist(_project_root) {
20924
- const package_root = path18.dirname(path18.dirname(path18.dirname(resolvePath(_HERE2))));
20925
- const cli = path18.join(package_root, "dist", "cli", "agent-config.js");
21000
+ const package_root = path19.dirname(path19.dirname(path19.dirname(resolvePath(_HERE2))));
21001
+ const cli = path19.join(package_root, "dist", "cli", "agent-config.js");
20926
21002
  return pathExists(cli) ? cli : null;
20927
21003
  }
20928
21004
  function _server_info_path() {
20929
- return path18.join(os8.homedir(), ".event4u", "agent-config", "local-server.json");
21005
+ return path19.join(os8.homedir(), ".event4u", "agent-config", "local-server.json");
20930
21006
  }
20931
21007
  function _pid_is_agent_config(pid) {
20932
21008
  let res;
@@ -20943,7 +21019,7 @@ function _pid_is_agent_config(pid) {
20943
21019
  }
20944
21020
  function unlinkMissingOk(p) {
20945
21021
  try {
20946
- fs21.unlinkSync(p);
21022
+ fs22.unlinkSync(p);
20947
21023
  } catch {
20948
21024
  }
20949
21025
  }
@@ -21021,14 +21097,14 @@ function _wizard_spawn(project_root, pass_project_root = true) {
21021
21097
  }
21022
21098
  function _wizard_run_sync(cmd, env, cli) {
21023
21099
  const total = _WIZARD_TIMEOUTS.reduce((a, b) => a + b, 0);
21024
- const log_path = path18.join(
21100
+ const log_path = path19.join(
21025
21101
  os8.tmpdir(),
21026
21102
  `agent-config-wizard-${process3.pid}-${Date.now()}.log`
21027
21103
  );
21028
21104
  let child;
21029
21105
  let log_fd = null;
21030
21106
  try {
21031
- log_fd = fs21.openSync(log_path, "w");
21107
+ log_fd = fs22.openSync(log_path, "w");
21032
21108
  child = spawn(cmd[0], cmd.slice(1), {
21033
21109
  env,
21034
21110
  detached: true,
@@ -21046,7 +21122,7 @@ function _wizard_run_sync(cmd, env, cli) {
21046
21122
  } finally {
21047
21123
  if (log_fd !== null) {
21048
21124
  try {
21049
- fs21.closeSync(log_fd);
21125
+ fs22.closeSync(log_fd);
21050
21126
  } catch {
21051
21127
  }
21052
21128
  }
@@ -21296,8 +21372,8 @@ function main2(argv) {
21296
21372
  const target_root = resolvePath(
21297
21373
  opts.custom_path || opts.project || process3.env["PROJECT_ROOT"] || process3.cwd()
21298
21374
  );
21299
- const minimal_package_root = path18.dirname(
21300
- path18.dirname(path18.dirname(_minimal_templates_root()))
21375
+ const minimal_package_root = path19.dirname(
21376
+ path19.dirname(path19.dirname(_minimal_templates_root()))
21301
21377
  );
21302
21378
  const validated_user_type = _validate_user_type(minimal_package_root, opts.user_type);
21303
21379
  return install_minimal(target_root, opts.force, validated_user_type);
@@ -21329,7 +21405,7 @@ function main2(argv) {
21329
21405
  return rc2;
21330
21406
  }
21331
21407
  const project_root = custom_path || resolvePath(opts.project || process3.env["PROJECT_ROOT"] || process3.cwd());
21332
- const is_first_run = !pathExists(path18.join(project_root, SETTINGS_FILE));
21408
+ const is_first_run = !pathExists(path19.join(project_root, SETTINGS_FILE));
21333
21409
  const rc = _main_project_install(opts, project_root, parsed_tools, is_first_run);
21334
21410
  if (rc === 0 && opts.interactive) {
21335
21411
  run_interactive_init(project_root, opts.force);
@@ -21393,16 +21469,16 @@ function _team_setup_hint_line(project_root) {
21393
21469
  return " \u2022 Claude Code team mode (optional cross-model review via the official codex plugin): run `agent-config doctor --check team` for setup status.";
21394
21470
  }
21395
21471
  function finalize_claude_model_tiers(project_root) {
21396
- const claude_skills = path18.join(project_root, ".claude", "skills");
21397
- const augment_skills = path18.join(project_root, ".augment", "skills");
21472
+ const claude_skills = path19.join(project_root, ".claude", "skills");
21473
+ const augment_skills = path19.join(project_root, ".augment", "skills");
21398
21474
  if (!isDir(claude_skills) || !isDir(augment_skills)) return 0;
21399
21475
  if (_read_consumer_auto_switch(project_root) !== "auto") return 0;
21400
21476
  let rendered = 0;
21401
- const entries = fs21.readdirSync(claude_skills).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
21477
+ const entries = fs22.readdirSync(claude_skills).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
21402
21478
  for (const name of entries) {
21403
- const entry = path18.join(claude_skills, name);
21404
- const src_dir = path18.join(augment_skills, name);
21405
- const src_md = path18.join(src_dir, "SKILL.md");
21479
+ const entry = path19.join(claude_skills, name);
21480
+ const src_dir = path19.join(augment_skills, name);
21481
+ const src_md = path19.join(src_dir, "SKILL.md");
21406
21482
  let tier;
21407
21483
  try {
21408
21484
  tier = read_model_tier(src_md);
@@ -21411,22 +21487,22 @@ function finalize_claude_model_tiers(project_root) {
21411
21487
  }
21412
21488
  if (tier === null || !(tier in TIER_TO_CLAUDE_MODEL) || !isDir(src_dir)) continue;
21413
21489
  if (isSymlink(entry) || isFile(entry)) {
21414
- fs21.unlinkSync(entry);
21490
+ fs22.unlinkSync(entry);
21415
21491
  } else if (isDir(entry)) {
21416
- fs21.rmSync(entry, { recursive: true, force: true });
21492
+ fs22.rmSync(entry, { recursive: true, force: true });
21417
21493
  }
21418
21494
  mkdirp(entry);
21419
- const srcFiles = fs21.readdirSync(src_dir).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
21495
+ const srcFiles = fs22.readdirSync(src_dir).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
21420
21496
  for (const fname of srcFiles) {
21421
21497
  if (fname === "SKILL.md") {
21422
21498
  writeText(
21423
- path18.join(entry, "SKILL.md"),
21499
+ path19.join(entry, "SKILL.md"),
21424
21500
  render_native_model_md(readText(src_md), tier)
21425
21501
  );
21426
21502
  } else {
21427
- fs21.symlinkSync(
21428
- path18.join("../../../.augment/skills", name, fname),
21429
- path18.join(entry, fname)
21503
+ fs22.symlinkSync(
21504
+ path19.join("../../../.augment/skills", name, fname),
21505
+ path19.join(entry, fname)
21430
21506
  );
21431
21507
  }
21432
21508
  }
@@ -21444,7 +21520,7 @@ function _main_project_install(opts, project_root, parsed_tools, is_first_run) {
21444
21520
  let package_type;
21445
21521
  if (opts.package) {
21446
21522
  package_root = resolvePath(opts.package);
21447
- if (!pathExists(path18.join(package_root, "src", "config", "profiles", "minimal.ini"))) {
21523
+ if (!pathExists(path19.join(package_root, "src", "config", "profiles", "minimal.ini"))) {
21448
21524
  fail(`Invalid --package path (missing src/config/profiles/minimal.ini): ${package_root}`);
21449
21525
  }
21450
21526
  package_type = detect_package_type_for_project(project_root, package_root);
@@ -21472,7 +21548,10 @@ function _main_project_install(opts, project_root, parsed_tools, is_first_run) {
21472
21548
  ...ensure_augment_bridge(project_root, opts.force)
21473
21549
  ];
21474
21550
  if (_is_tool_enabled(tools, "claude-code")) {
21475
- merged_keys_by_tool["claude-code"] = ensure_claude_bridge(project_root, opts.force);
21551
+ merged_keys_by_tool["claude-code"] = [
21552
+ ...ensure_claude_bridge(project_root, opts.force),
21553
+ ...ensure_mcp_bridge(project_root, opts.force)
21554
+ ];
21476
21555
  }
21477
21556
  if (_is_tool_enabled(tools, "cursor")) {
21478
21557
  merged_keys_by_tool["cursor"] = ensure_cursor_bridge(project_root, opts.force);
@@ -21495,6 +21574,10 @@ function _main_project_install(opts, project_root, parsed_tools, is_first_run) {
21495
21574
  if (_is_tool_enabled(tools, "jetbrains")) ensure_jetbrains_bridge(project_root, opts.force);
21496
21575
  if (_is_tool_enabled(tools, "kiro")) ensure_kiro_bridge(project_root, opts.force);
21497
21576
  }
21577
+ const tier_advisory = _tier_b_advisory(package_root);
21578
+ if (tier_advisory !== null && !state.QUIET) {
21579
+ info(tier_advisory);
21580
+ }
21498
21581
  if (opts.augment_user_hooks) {
21499
21582
  (merged_keys_by_tool["augment"] ??= []).push(...ensure_augment_user_hooks(package_root, opts.force));
21500
21583
  }
@@ -21581,9 +21664,9 @@ function _main_project_install(opts, project_root, parsed_tools, is_first_run) {
21581
21664
  function _resolvedArgv1() {
21582
21665
  if (process3.argv[1] === void 0) return void 0;
21583
21666
  try {
21584
- return fs21.realpathSync(path18.resolve(process3.argv[1]));
21667
+ return fs22.realpathSync(path19.resolve(process3.argv[1]));
21585
21668
  } catch {
21586
- return path18.resolve(process3.argv[1]);
21669
+ return path19.resolve(process3.argv[1]);
21587
21670
  }
21588
21671
  }
21589
21672
  var _argv1 = _resolvedArgv1();
@@ -21652,6 +21735,7 @@ export {
21652
21735
  _prune_lab_modules,
21653
21736
  _prune_modules_by,
21654
21737
  _prune_scoped_modules,
21738
+ _prune_tier_b_modules,
21655
21739
  _render_template,
21656
21740
  _replace_template_value,
21657
21741
  _replace_template_value_raw,
@@ -21660,9 +21744,11 @@ export {
21660
21744
  _resolve_scope,
21661
21745
  _resolve_scoped_projection,
21662
21746
  _resolve_settings_read,
21747
+ _resolve_tier_b,
21663
21748
  _rule_filter_for_source,
21664
21749
  _scoped_migration_notice,
21665
21750
  _team_setup_hint_line,
21751
+ _tier_b_advisory,
21666
21752
  _tools_was_all,
21667
21753
  _validate_scope,
21668
21754
  _verify_deploy_targets,
@@ -21676,6 +21762,7 @@ export {
21676
21762
  ensure_cline_bridge,
21677
21763
  ensure_cursor_bridge,
21678
21764
  ensure_gemini_bridge,
21765
+ ensure_mcp_bridge,
21679
21766
  ensure_windsurf_bridge,
21680
21767
  finalize_claude_model_tiers,
21681
21768
  jsonDumpsCompact,