@event4u/agent-config 16.0.0 → 16.1.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 (246) 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 +297 -137
  5. package/CONTRIBUTING.md +9 -0
  6. package/README.md +2 -2
  7. package/dist/agent-src/commands/analyze/inbox.md +26 -0
  8. package/dist/agent-src/commands/analyze/roadmap-repos.md +27 -0
  9. package/dist/agent-src/commands/challenge-me/closure.md +178 -0
  10. package/dist/agent-src/commands/challenge-me.md +9 -2
  11. package/dist/agent-src/commands/council/default.md +25 -5
  12. package/dist/agent-src/commands/feature/plan.md +28 -1
  13. package/dist/agent-src/commands/feature/roadmap.md +28 -1
  14. package/dist/agent-src/commands/implement-ticket.md +27 -0
  15. package/dist/agent-src/commands/jira-ticket.md +27 -0
  16. package/dist/agent-src/commands/pr/create.md +29 -0
  17. package/dist/agent-src/commands/pr/merge.md +60 -9
  18. package/dist/agent-src/commands/roadmap/ai-council.md +7 -1
  19. package/dist/agent-src/commands/roadmap/create.md +74 -27
  20. package/dist/agent-src/commands/roadmap/materialize.md +27 -0
  21. package/dist/agent-src/commands/roadmap/process-full.md +123 -18
  22. package/dist/agent-src/commands/team.md +22 -0
  23. package/dist/agent-src/contexts/authority/scope-growth-ownership.md +80 -0
  24. package/dist/agent-src/contexts/communication/rules-auto/user-interaction-mechanics.md +47 -0
  25. package/dist/agent-src/contexts/execution/auto-orchestration-activation.md +44 -3
  26. package/dist/agent-src/contexts/execution/autonomy-mechanics.md +15 -15
  27. package/dist/agent-src/contexts/execution/decision-closure-execution.md +93 -0
  28. package/dist/agent-src/contexts/execution/fix-loop-ladder.md +108 -0
  29. package/dist/agent-src/contexts/execution/plan-confidence-gate.md +4 -2
  30. package/dist/agent-src/contexts/execution/roadmap-process-loop.md +75 -6
  31. package/dist/agent-src/guidelines/agent-infra/active-remediation-mechanics.md +57 -0
  32. package/dist/agent-src/guidelines/agent-infra/evaluator-independence-mechanics.md +102 -0
  33. package/dist/agent-src/guidelines/design-fidelity-routing.md +29 -0
  34. package/dist/agent-src/rules/autonomous-execution.md +15 -8
  35. package/dist/agent-src/rules/delegation-policy.md +23 -45
  36. package/dist/agent-src/rules/design-fidelity.md +32 -37
  37. package/dist/agent-src/rules/evaluator-independence.md +43 -49
  38. package/dist/agent-src/rules/test-first.md +41 -0
  39. package/dist/agent-src/skills/accessibility-auditor/data/manifest.json +3 -3
  40. package/dist/agent-src/skills/ai-council/SKILL.md +11 -3
  41. package/dist/agent-src/skills/api-design/data/manifest.json +3 -3
  42. package/dist/agent-src/skills/database/data/manifest.json +4 -4
  43. package/dist/agent-src/skills/database/data/query-tuning.csv +3 -3
  44. package/dist/agent-src/skills/design-review/SKILL.md +50 -0
  45. package/dist/agent-src/skills/existing-ui-audit/SKILL.md +14 -4
  46. package/dist/agent-src/skills/experiment-loop/SKILL.md +31 -1
  47. package/dist/agent-src/skills/roadmap-writing/SKILL.md +1 -1
  48. package/dist/agent-src/skills/storybook-workshop/SKILL.md +42 -3
  49. package/dist/agent-src/skills/threat-modeling/SKILL.md +9 -4
  50. package/dist/agent-src/skills/threat-modeling/data/manifest.json +4 -4
  51. package/dist/agent-src/skills/verify-repair-loop/SKILL.md +37 -3
  52. package/dist/agent-src/templates/agent-settings.md +1 -1
  53. package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
  54. package/dist/agent-src/templates/roadmaps.md +188 -0
  55. package/dist/agent-src/templates/scripts/work_engine/directives/backend/_self_fix.ts +62 -2
  56. package/dist/agent-src/templates/scripts/work_engine/directives/backend/test.ts +1 -0
  57. package/dist/agent-src/templates/scripts/work_engine/directives/backend/verify.ts +1 -0
  58. package/dist/cli-delegate/check_update_banner.js +40 -2
  59. package/dist/cli-delegate/chunk-4E2W63DA.js +335 -0
  60. package/dist/cli-delegate/chunk-5R7HOLAF.js +99 -0
  61. package/dist/cli-delegate/{chunk-IVBPRCQO.js → chunk-6KFEC3G7.js} +1 -1
  62. package/dist/cli-delegate/{chunk-2TAQ2K4V.js → chunk-6KM6ORRY.js} +55 -386
  63. package/dist/cli-delegate/{chunk-2XY7ILBT.js → chunk-FC75PGJE.js} +42 -2
  64. package/dist/cli-delegate/{chunk-GYC3VRYN.js → chunk-FXYUYU4N.js} +57 -13
  65. package/dist/cli-delegate/{chunk-55ACLDUE.js → chunk-GJCBB2UG.js} +168 -10
  66. package/dist/cli-delegate/{chunk-AK6HODNQ.js → chunk-HDVVGPQW.js} +873 -539
  67. package/dist/cli-delegate/{chunk-H32DGUJH.js → chunk-P6ZHP5W2.js} +1 -1
  68. package/dist/cli-delegate/{chunk-57PN4GYJ.js → chunk-RGNIWTEA.js} +1 -1
  69. package/dist/cli-delegate/chunk-ROYYTEZU.js +39 -0
  70. package/dist/cli-delegate/{chunk-3FKR64R5.js → chunk-UNCRJBT3.js} +31 -7
  71. package/dist/cli-delegate/{chunk-2DK2VJWG.js → chunk-WGXTVKCQ.js} +20 -6
  72. package/dist/cli-delegate/chunk-YDPILCOL.js +152 -0
  73. package/dist/cli-delegate/cmd_analyze_session.js +1 -1
  74. package/dist/cli-delegate/cmd_brand_status.js +1 -1
  75. package/dist/cli-delegate/cmd_conformance.js +90 -56
  76. package/dist/cli-delegate/cmd_doctor.js +7 -5
  77. package/dist/cli-delegate/cmd_explain.js +2 -2
  78. package/dist/cli-delegate/cmd_export.js +9 -7
  79. package/dist/cli-delegate/cmd_fleet.js +4 -2
  80. package/dist/cli-delegate/cmd_handoff.js +4 -4
  81. package/dist/cli-delegate/cmd_mcp_available.js +1 -1
  82. package/dist/cli-delegate/cmd_migrate.js +2 -2
  83. package/dist/cli-delegate/cmd_packs_active.js +2 -2
  84. package/dist/cli-delegate/cmd_preflight.js +4 -2
  85. package/dist/cli-delegate/cmd_prune.js +10 -8
  86. package/dist/cli-delegate/cmd_route_audit.js +2 -2
  87. package/dist/cli-delegate/cmd_route_explain.js +1 -1
  88. package/dist/cli-delegate/cmd_session_recycle.js +2 -2
  89. package/dist/cli-delegate/cmd_settings_get.js +28 -2
  90. package/dist/cli-delegate/cmd_settings_migrate.js +9 -7
  91. package/dist/cli-delegate/cmd_settings_set.js +1 -1
  92. package/dist/cli-delegate/cmd_sync.js +10 -8
  93. package/dist/cli-delegate/cmd_uninstall.js +16 -13
  94. package/dist/cli-delegate/cmd_update.js +1 -1
  95. package/dist/cli-delegate/cmd_upgrade.js +1 -1
  96. package/dist/cli-delegate/cmd_validate.js +12 -10
  97. package/dist/cli-delegate/cmd_versions.js +1 -1
  98. package/dist/discovery/deprecation-report.md +1 -1
  99. package/dist/discovery/discovery-manifest.json +85 -38
  100. package/dist/discovery/discovery-manifest.json.sha256 +1 -1
  101. package/dist/discovery/discovery-manifest.summary.md +4 -4
  102. package/dist/discovery/dormancy-report.md +1 -1
  103. package/dist/discovery/orphan-report.md +1 -1
  104. package/dist/discovery/packs.json +10 -8
  105. package/dist/discovery/trust-report.md +3 -3
  106. package/dist/discovery/workspaces.json +8 -6
  107. package/dist/hooks/dispatch.js +1832 -1007
  108. package/dist/install/claudeRuleRewrite.js +14 -3
  109. package/dist/install/conflict.js +60 -10
  110. package/dist/install/conflictTracker.js +218 -0
  111. package/dist/install/fsPrimitives.js +54 -0
  112. package/dist/install/install.mjs +2007 -1481
  113. package/dist/install/manifestFiles.js +259 -0
  114. package/dist/install/preflight.js +14 -2
  115. package/dist/install/preserve.js +157 -0
  116. package/dist/install/recordedOwnership.js +132 -0
  117. package/dist/install/txlog.js +11 -2
  118. package/dist/mcp/registry-manifest.json +3 -3
  119. package/dist/mcp/server.json +2 -2
  120. package/dist/mcp/server.mjs +398 -39
  121. package/dist/router.json +1 -1
  122. package/dist/scripts/_lib/agent_settings.js +3 -2
  123. package/dist/scripts/_lib/fs_atomic.js +167 -0
  124. package/dist/scripts/_lib/installed_tools.js +460 -0
  125. package/dist/scripts/_lib/lean_projection_mode.js +3 -2
  126. package/dist/scripts/_lib/settings_renamed_keys.js +78 -0
  127. package/dist/server/routes/install.js +8 -0
  128. package/dist/server/routes/wizard.js +9 -3
  129. package/dist/server/schemas/settings.js +17 -5
  130. package/dist/shared/missionExecution.js +97 -0
  131. package/dist/ui/assets/{index-D0jaCRPM.js → index-DH1xc62v.js} +17 -17
  132. package/dist/ui/index.html +1 -1
  133. package/docs/MIGRATION.md +103 -0
  134. package/docs/contracts/settings-classes.md +26 -7
  135. package/docs/guidelines/agent-infra/active-remediation-mechanics.md +57 -0
  136. package/docs/guidelines/agent-infra/evaluator-independence-mechanics.md +102 -0
  137. package/docs/guidelines/design-fidelity-routing.md +29 -0
  138. package/package.json +1 -1
  139. package/src/agent-src/templates/scripts/work_engine/directives/backend/_self_fix.ts +62 -2
  140. package/src/agent-src/templates/scripts/work_engine/directives/backend/test.ts +1 -0
  141. package/src/agent-src/templates/scripts/work_engine/directives/backend/verify.ts +1 -0
  142. package/src/config/agent-settings.template.yml +139 -27
  143. package/src/config/auto-rule-budget.json +16 -0
  144. package/src/config/ci-local-parity.yml +18 -5
  145. package/src/config/continuity-surface.json +21 -0
  146. package/src/config/gate-coverage.yml +146 -13
  147. package/src/config/gate-violation-baselines.json +6 -6
  148. package/src/config/hook-token-budget.json +2 -0
  149. package/src/config/loop-surfaces.yaml +215 -0
  150. package/src/config/platform-anchor.json +3 -2
  151. package/src/config/release-gate-locality.yml +11 -0
  152. package/src/config/routing-coverage-seed.json +18 -4
  153. package/src/config/rule-enforcement-baseline.json +0 -1
  154. package/src/install/claudeRuleRewrite.ts +16 -2
  155. package/src/install/conflict.ts +65 -9
  156. package/src/install/conflictTracker.ts +299 -0
  157. package/src/install/fsPrimitives.ts +54 -0
  158. package/src/install/manifestFiles.ts +312 -0
  159. package/src/install/preflight.ts +16 -2
  160. package/src/install/preserve.ts +205 -0
  161. package/src/install/recordedOwnership.ts +149 -0
  162. package/src/install/txlog.ts +11 -2
  163. package/src/install/types.ts +19 -4
  164. package/src/scripts/_cli/cmd_conformance.ts +88 -15
  165. package/src/scripts/_cli/cmd_doctor.ts +4 -3
  166. package/src/scripts/_cli/cmd_route_explain.ts +9 -2
  167. package/src/scripts/_cli/cmd_settings_get.ts +44 -0
  168. package/src/scripts/_cli/doctor_execution.ts +90 -0
  169. package/src/scripts/_lib/activation_payload.ts +247 -0
  170. package/src/scripts/_lib/agent_settings.ts +4 -2
  171. package/src/scripts/_lib/authority_path.ts +102 -0
  172. package/src/scripts/_lib/cascade_base.ts +94 -0
  173. package/src/scripts/_lib/changelog_eras.ts +7 -2
  174. package/src/scripts/_lib/continuation_ladder.ts +149 -2
  175. package/src/scripts/_lib/council_transport.ts +129 -0
  176. package/src/scripts/_lib/delivery_ready.ts +112 -0
  177. package/src/scripts/_lib/forge_protection.ts +267 -0
  178. package/src/scripts/_lib/hook_platform_keys.ts +27 -0
  179. package/src/scripts/_lib/json_python_parity.ts +127 -0
  180. package/src/scripts/_lib/lean_projection_mode.ts +14 -3
  181. package/src/scripts/_lib/loop_surfaces.ts +382 -0
  182. package/src/scripts/_lib/mission_record.ts +190 -0
  183. package/src/scripts/_lib/obligation_frequency.ts +217 -0
  184. package/src/scripts/_lib/obligations.ts +402 -0
  185. package/src/scripts/_lib/orchestration_record.ts +11 -20
  186. package/src/scripts/_lib/release_highlights.ts +199 -10
  187. package/src/scripts/_lib/release_holds.ts +493 -0
  188. package/src/scripts/_lib/release_migration_gate.ts +184 -0
  189. package/src/scripts/_lib/rides_along.ts +102 -0
  190. package/src/scripts/_lib/settings_renamed_keys.ts +82 -0
  191. package/src/scripts/_lib/test_delta.ts +166 -0
  192. package/src/scripts/_lib/test_provenance.ts +171 -0
  193. package/src/scripts/_lib/typed_op_grant.ts +246 -0
  194. package/src/scripts/_lib/typed_op_watch.ts +185 -0
  195. package/src/scripts/ai_council/config.ts +8 -11
  196. package/src/scripts/ai_council/fallback_config.ts +5 -3
  197. package/src/scripts/ai_council/ownership_classes.ts +118 -0
  198. package/src/scripts/ask_block_census.ts +285 -15
  199. package/src/scripts/check_enforcement_matrix.ts +624 -0
  200. package/src/scripts/check_gate_reachability.ts +173 -10
  201. package/src/scripts/check_generator_sync.ts +954 -0
  202. package/src/scripts/check_preamble_payload_budget.ts +75 -2
  203. package/src/scripts/check_release_highlights.ts +33 -1
  204. package/src/scripts/check_release_holds.ts +567 -0
  205. package/src/scripts/check_rule_projection_integrity.ts +22 -12
  206. package/src/scripts/check_test_delta.ts +294 -0
  207. package/src/scripts/check_test_weakening.ts +299 -0
  208. package/src/scripts/closure_scan.ts +333 -0
  209. package/src/scripts/compile_hook_manifest.ts +43 -3
  210. package/src/scripts/council_record_shape.ts +209 -0
  211. package/src/scripts/hook_manifest.json +1 -1
  212. package/src/scripts/hook_manifest.yaml +88 -9
  213. package/src/scripts/hooks/concern_registry.ts +4 -0
  214. package/src/scripts/hooks/design_pass_hook.ts +128 -3
  215. package/src/scripts/hooks/evidence_independence.ts +96 -0
  216. package/src/scripts/hooks/memory_recall_hook.ts +540 -0
  217. package/src/scripts/hooks/obligation_settle_hook.ts +182 -0
  218. package/src/scripts/hooks/rule_inject_hook.ts +49 -1
  219. package/src/scripts/hooks/run_continuation_hook.ts +17 -20
  220. package/src/scripts/hooks_doctor.ts +85 -0
  221. package/src/scripts/hooks_status.ts +19 -0
  222. package/src/scripts/install.ts +106 -206
  223. package/src/scripts/janitor.ts +7 -0
  224. package/src/scripts/lint_decision_classes.ts +464 -0
  225. package/src/scripts/lint_hook_manifest.ts +11 -0
  226. package/src/scripts/lint_major_migration_sections.ts +450 -0
  227. package/src/scripts/lint_plan_risk_register.ts +47 -3
  228. package/src/scripts/lint_roadmap_blockers.ts +61 -0
  229. package/src/scripts/lint_roadmap_producers.ts +202 -0
  230. package/src/scripts/measure_rule_budget.ts +101 -5
  231. package/src/scripts/new_roadmap.ts +37 -0
  232. package/src/scripts/orchestration_record.ts +0 -5
  233. package/src/scripts/release.ts +14 -98
  234. package/src/scripts/release_drill.ts +267 -1
  235. package/src/scripts/release_publication.ts +51 -0
  236. package/src/scripts/report_enforcement_drift.ts +566 -0
  237. package/src/scripts/report_host_injection_effect.ts +3 -11
  238. package/src/scripts/report_standing_payload_by_host.ts +26 -152
  239. package/src/scripts/schemas/agent-settings.schema.json +23 -0
  240. package/src/scripts/schemas/command.schema.json +4 -0
  241. package/src/scripts/scope_growth.ts +219 -0
  242. package/src/scripts/trigger_eval_grandfather.json +0 -1
  243. package/src/scripts/ui_conformance_probe.ts +622 -0
  244. package/src/server/schemas/settings.ts +31 -7
  245. package/src/shared/missionExecution.ts +126 -0
  246. package/dist/cli-delegate/chunk-523HCFYO.js +0 -90
@@ -2,35 +2,37 @@ import { createRequire as __acCreateRequire } from 'node:module'; const require
2
2
  import {
3
3
  ZodFirstPartyTypeKind,
4
4
  settingsSchema
5
- } from "./chunk-3FKR64R5.js";
5
+ } from "./chunk-UNCRJBT3.js";
6
6
  import {
7
7
  main
8
- } from "./chunk-IVBPRCQO.js";
8
+ } from "./chunk-6KFEC3G7.js";
9
9
  import {
10
10
  RULE_SOURCE_REL
11
11
  } from "./chunk-WOKWX5PL.js";
12
+ import {
13
+ classifyOwnership,
14
+ recordedHashesForRoot
15
+ } from "./chunk-YDPILCOL.js";
16
+ import {
17
+ appendTxLog
18
+ } from "./chunk-5R7HOLAF.js";
12
19
  import {
13
20
  SCOPE_DETECT_AI_DIRS,
14
21
  SCOPE_DETECT_MANIFESTS
15
22
  } from "./chunk-A4QJ6ENT.js";
16
23
  import {
17
- ScopeMismatchError,
18
24
  build_claude_hook_matrix,
19
25
  ensure_managed_hooks,
20
26
  expected_deploy_files,
21
27
  is_ancestor,
22
28
  load_inventory,
23
- manifest_path,
24
29
  printResiduals,
25
30
  probeHostCapabilities,
26
- read_manifest,
27
31
  reap_stale,
28
32
  reap_tagged_orphans,
29
33
  record_deploy,
30
- save_inventory,
31
- upsert_tool,
32
- write_manifest
33
- } from "./chunk-2TAQ2K4V.js";
34
+ save_inventory
35
+ } from "./chunk-6KM6ORRY.js";
34
36
  import {
35
37
  check_version,
36
38
  classify_mismatch,
@@ -53,13 +55,20 @@ import {
53
55
  ruleFileArrives,
54
56
  ruleScopeFromSettings
55
57
  } from "./chunk-DMSZHXZS.js";
58
+ import {
59
+ ScopeMismatchError,
60
+ manifest_path,
61
+ read_manifest,
62
+ upsert_tool,
63
+ write_manifest
64
+ } from "./chunk-4E2W63DA.js";
56
65
  import {
57
66
  require_dist
58
67
  } from "./chunk-OY53J6II.js";
59
68
  import {
60
69
  find_project_root_with_anchor,
61
70
  load_agent_settings
62
- } from "./chunk-2XY7ILBT.js";
71
+ } from "./chunk-FC75PGJE.js";
63
72
  import {
64
73
  event4u_root,
65
74
  legacy_xdg_root,
@@ -273,13 +282,104 @@ function subtract_pointers(doc, entries) {
273
282
 
274
283
  // src/scripts/install.ts
275
284
  import { spawn, spawnSync } from "node:child_process";
276
- import * as crypto3 from "node:crypto";
277
- import * as fs12 from "node:fs";
285
+ import * as crypto5 from "node:crypto";
286
+ import * as fs14 from "node:fs";
278
287
  import * as os3 from "node:os";
279
- import * as path10 from "node:path";
288
+ import * as path12 from "node:path";
280
289
  import process2 from "node:process";
281
290
  import { fileURLToPath as fileURLToPath2, pathToFileURL } from "node:url";
282
291
 
292
+ // src/scripts/_lib/json_python_parity.ts
293
+ function jsonStrNoAscii(s) {
294
+ let out = '"';
295
+ for (const ch of s) {
296
+ const code = ch.codePointAt(0);
297
+ switch (ch) {
298
+ case '"':
299
+ out += '\\"';
300
+ break;
301
+ case "\\":
302
+ out += "\\\\";
303
+ break;
304
+ case "\n":
305
+ out += "\\n";
306
+ break;
307
+ case "\r":
308
+ out += "\\r";
309
+ break;
310
+ case " ":
311
+ out += "\\t";
312
+ break;
313
+ case "\b":
314
+ out += "\\b";
315
+ break;
316
+ case "\f":
317
+ out += "\\f";
318
+ break;
319
+ default:
320
+ if (code < 32) {
321
+ out += "\\u" + code.toString(16).padStart(4, "0");
322
+ } else {
323
+ out += ch;
324
+ }
325
+ }
326
+ }
327
+ return out + '"';
328
+ }
329
+ function _jsonScalar(value) {
330
+ if (value === null || value === void 0) return "null";
331
+ if (typeof value === "boolean") return value ? "true" : "false";
332
+ if (typeof value === "number") {
333
+ if (!Number.isFinite(value)) {
334
+ if (Number.isNaN(value)) return "NaN";
335
+ return value > 0 ? "Infinity" : "-Infinity";
336
+ }
337
+ return String(value);
338
+ }
339
+ if (typeof value === "string") return jsonStrNoAscii(value);
340
+ return null;
341
+ }
342
+ function _dumpIndent(value, indent, depth) {
343
+ const scalar = _jsonScalar(value);
344
+ if (scalar !== null) return scalar;
345
+ const pad = " ".repeat(indent * (depth + 1));
346
+ const closePad = " ".repeat(indent * depth);
347
+ if (Array.isArray(value)) {
348
+ if (value.length === 0) return "[]";
349
+ const items = value.map((v) => pad + _dumpIndent(v, indent, depth + 1));
350
+ return `[
351
+ ${items.join(",\n")}
352
+ ${closePad}]`;
353
+ }
354
+ if (typeof value === "object" && value !== null) {
355
+ const obj = value;
356
+ const keys = Object.keys(obj);
357
+ if (keys.length === 0) return "{}";
358
+ const items = keys.map(
359
+ (k) => `${pad}${jsonStrNoAscii(k)}: ${_dumpIndent(obj[k], indent, depth + 1)}`
360
+ );
361
+ return `{
362
+ ${items.join(",\n")}
363
+ ${closePad}}`;
364
+ }
365
+ return jsonStrNoAscii(String(value));
366
+ }
367
+ function jsonDumpsIndent(value, indent) {
368
+ return _dumpIndent(value, indent, 0);
369
+ }
370
+ function jsonDumpsCompact(value) {
371
+ const scalar = _jsonScalar(value);
372
+ if (scalar !== null) return scalar;
373
+ if (Array.isArray(value)) {
374
+ return "[" + value.map((v) => jsonDumpsCompact(v)).join(",") + "]";
375
+ }
376
+ if (typeof value === "object" && value !== null) {
377
+ const obj = value;
378
+ return "{" + Object.keys(obj).map((k) => `${jsonStrNoAscii(k)}:${jsonDumpsCompact(obj[k])}`).join(",") + "}";
379
+ }
380
+ return jsonStrNoAscii(String(value));
381
+ }
382
+
283
383
  // src/scripts/_lib/claude_builtin_names.ts
284
384
  var _CURRENT = [
285
385
  "add-dir",
@@ -519,9 +619,329 @@ function applyTieredPrune(deployResults, packageRoot, pruneBy) {
519
619
  };
520
620
  }
521
621
 
522
- // src/scripts/_lib/rule_layer_overlap.ts
622
+ // src/install/conflictTracker.ts
623
+ import * as crypto2 from "node:crypto";
624
+ import * as fs3 from "node:fs";
625
+ import * as path3 from "node:path";
626
+
627
+ // src/install/fsPrimitives.ts
628
+ import * as crypto from "node:crypto";
523
629
  import * as fs2 from "node:fs";
524
630
  import * as path2 from "node:path";
631
+ function resolvePath(p) {
632
+ try {
633
+ return fs2.realpathSync(path2.resolve(p));
634
+ } catch {
635
+ return path2.resolve(p);
636
+ }
637
+ }
638
+ function pathExists(p) {
639
+ try {
640
+ fs2.statSync(p);
641
+ return true;
642
+ } catch {
643
+ return false;
644
+ }
645
+ }
646
+ function mkdirp(p) {
647
+ fs2.mkdirSync(p, { recursive: true });
648
+ }
649
+ function sha256OfFile(p) {
650
+ let data;
651
+ try {
652
+ data = fs2.readFileSync(p);
653
+ } catch {
654
+ return null;
655
+ }
656
+ return crypto.createHash("sha256").update(data).digest("hex");
657
+ }
658
+
659
+ // src/install/preserve.ts
660
+ var SIDECAR_SUFFIX = ".agent-config.new";
661
+ var EXIT_COMPLETED_WITH_CONFLICTS = 3;
662
+ function decideDeployWrite(inputs) {
663
+ if (!inputs.exists) return "write";
664
+ if (inputs.force) return "write";
665
+ const ownership = classifyOwnership(inputs.recordedSha256, inputs.onDiskSha256);
666
+ return ownership === "recorded-modified" ? "preserve" : "write";
667
+ }
668
+ function sidecarPathFor(target) {
669
+ return `${target}${SIDECAR_SUFFIX}`;
670
+ }
671
+ function preservedFileMessage(target, sidecar) {
672
+ return `Preserved user-modified ${target}. Package content was written to ${sidecar}; the active installation is not current. Review and merge it, or rerun with --force to replace the managed file.`;
673
+ }
674
+ function conflictSummaryMessage(count) {
675
+ const noun = count === 1 ? "file" : "files";
676
+ return `Completed with conflicts: ${count} user-modified ${noun} preserved. Package content is staged alongside as *${SIDECAR_SUFFIX}; the active installation is not current until you merge it, or rerun with --force to replace the managed ${noun}.`;
677
+ }
678
+ function foreignSidecarMessage(target, sidecar) {
679
+ return `Refusing to replace ${sidecar}: it already exists with different content and this install cannot show it wrote it. Package content for ${target} was NOT staged. Move or delete that file and re-run, or rerun with --force to replace the managed file instead.`;
680
+ }
681
+
682
+ // src/install/conflictTracker.ts
683
+ function createConflictTracker(host) {
684
+ const conflictState = {
685
+ root: null,
686
+ recorded: null,
687
+ preserved: [],
688
+ staged: /* @__PURE__ */ new Map()
689
+ };
690
+ function recordedHashFor(target) {
691
+ if (conflictState.root === null) return void 0;
692
+ conflictState.recorded ??= recordedHashesForRoot(conflictState.root);
693
+ const plain = path3.resolve(target);
694
+ if (conflictState.recorded.has(plain)) return conflictState.recorded.get(plain);
695
+ const real = resolvePath(target);
696
+ return real === plain ? void 0 : conflictState.recorded.get(real);
697
+ }
698
+ function stageInto(target, sidecar, produce) {
699
+ mkdirp(path3.dirname(sidecar));
700
+ const tmp = path3.join(
701
+ path3.dirname(sidecar),
702
+ `.${path3.basename(sidecar)}.${process.pid}.${crypto2.randomBytes(6).toString("hex")}${path3.extname(target)}`
703
+ );
704
+ const discard = () => {
705
+ try {
706
+ fs3.unlinkSync(tmp);
707
+ } catch {
708
+ }
709
+ };
710
+ let candidate;
711
+ try {
712
+ produce(tmp);
713
+ candidate = sha256OfFile(tmp);
714
+ } catch (exc) {
715
+ discard();
716
+ host.fail(
717
+ `Could not stage package content for ${target} at ${sidecar}: ${String(exc)}. Nothing was written; the managed file is unchanged.`
718
+ );
719
+ }
720
+ if (pathExists(sidecar)) {
721
+ const onDisk = sha256OfFile(sidecar);
722
+ if (onDisk !== null && onDisk === candidate) {
723
+ discard();
724
+ conflictState.staged.set(sidecar, onDisk);
725
+ return;
726
+ }
727
+ if (onDisk === null || onDisk !== recordedHashFor(sidecar)) {
728
+ discard();
729
+ host.fail(foreignSidecarMessage(target, sidecar));
730
+ }
731
+ }
732
+ try {
733
+ fs3.renameSync(tmp, sidecar);
734
+ } catch (exc) {
735
+ discard();
736
+ host.fail(
737
+ `Could not stage package content for ${target} at ${sidecar}: ${String(exc)}. Nothing was written; the managed file is unchanged.`
738
+ );
739
+ }
740
+ conflictState.staged.set(sidecar, candidate);
741
+ host.logWrite(sidecar);
742
+ }
743
+ function record(target, sidecar) {
744
+ if (conflictState.preserved.includes(target)) return;
745
+ conflictState.preserved.push(target);
746
+ host.warn(preservedFileMessage(target, sidecar));
747
+ }
748
+ return {
749
+ conflictState,
750
+ begin(root) {
751
+ conflictState.root = root;
752
+ conflictState.recorded = null;
753
+ conflictState.preserved = [];
754
+ conflictState.staged = /* @__PURE__ */ new Map();
755
+ },
756
+ /**
757
+ * The on-disk digest is computed HERE rather than carried from the
758
+ * plan: this runs immediately before the caller copies over `target`,
759
+ * so a file edited between planning and writing is still classified
760
+ * from the bytes that are actually about to be destroyed.
761
+ */
762
+ resolve(target, force) {
763
+ const exists = pathExists(target);
764
+ return decideDeployWrite({
765
+ exists,
766
+ recordedSha256: exists ? recordedHashFor(target) : void 0,
767
+ onDiskSha256: exists ? sha256OfFile(target) : null,
768
+ force
769
+ });
770
+ },
771
+ /**
772
+ * Stage the package content beside a preserved target.
773
+ *
774
+ * The staged bytes are what the installer WOULD have written — the
775
+ * package file plus its install-time tag — so merging the sidecar by
776
+ * hand yields a file that matches the digest this run records and still
777
+ * carries the ownership evidence the reaper reads.
778
+ */
779
+ preserve(target, source, packageRoot) {
780
+ const sidecar = sidecarPathFor(target);
781
+ stageInto(target, sidecar, (tmp) => {
782
+ fs3.copyFileSync(source, tmp);
783
+ host.tagDeployed(tmp, source, packageRoot);
784
+ });
785
+ record(target, sidecar);
786
+ },
787
+ /**
788
+ * The same, for a managed file the installer GENERATES rather than
789
+ * copies (the Claude Desktop marker).
790
+ *
791
+ * Those writers are recorded in the manifest with a digest, so they are
792
+ * in the class the ruling covers, and one of them wrote unconditionally
793
+ * — ignoring even `--force` — because the tracker was wired only into
794
+ * the copy loop.
795
+ */
796
+ preserveContent(target, content) {
797
+ const sidecar = sidecarPathFor(target);
798
+ stageInto(target, sidecar, (tmp) => fs3.writeFileSync(tmp, content, "utf-8"));
799
+ record(target, sidecar);
800
+ },
801
+ /**
802
+ * Runs before the installer's terminal NDJSON frame so that frame can
803
+ * carry the count. A failing run keeps its own code — a conflict never
804
+ * masks a failure.
805
+ */
806
+ finalizeRc(rc) {
807
+ const count = conflictState.preserved.length;
808
+ if (count === 0) return rc;
809
+ host.emitProgress({ type: "conflicts", count, paths: [...conflictState.preserved] });
810
+ host.warn(conflictSummaryMessage(count));
811
+ return rc === 0 ? EXIT_COMPLETED_WITH_CONFLICTS : rc;
812
+ }
813
+ };
814
+ }
815
+
816
+ // src/install/manifestFiles.ts
817
+ var YAML = __toESM(require_dist(), 1);
818
+ import { existsSync as existsSync2, readFileSync as readFileSync3 } from "node:fs";
819
+ import { homedir } from "node:os";
820
+ import { isAbsolute, join as join3, resolve as resolve3 } from "node:path";
821
+ function fileEntry(p, kind, hashContent) {
822
+ return { path: p, kind, sha256: hashContent ? sha256OfFile(p) : null };
823
+ }
824
+ function filesByToolFromDeploy(deployResults) {
825
+ const out = {};
826
+ for (const toolId of Object.keys(deployResults)) {
827
+ const [, , status, paths] = deployResults[toolId];
828
+ if (status === "deployed") {
829
+ out[toolId] = paths.map((p) => fileEntry(p, "deployed", true));
830
+ } else if (status === "marker") {
831
+ out[toolId] = paths.map((p) => fileEntry(p, "marker", true));
832
+ } else {
833
+ out[toolId] = null;
834
+ }
835
+ }
836
+ return out;
837
+ }
838
+ function filesByToolFromBridges(tools, projectRoot, scope, bridgeMarker) {
839
+ const out = {};
840
+ for (const toolId of [...tools].sort()) {
841
+ const marker = bridgeMarker(toolId, scope);
842
+ if (!marker) continue;
843
+ const markerPath = isAbsolute(marker) ? marker : join3(projectRoot, marker);
844
+ out[toolId] = [fileEntry(markerPath, "bridge", false)];
845
+ }
846
+ return out;
847
+ }
848
+ function expanduser(p) {
849
+ if (p === "~") return homedir();
850
+ if (p.startsWith("~/") || process.platform === "win32" && p.startsWith("~\\")) {
851
+ return join3(homedir(), p.slice(2));
852
+ }
853
+ return p;
854
+ }
855
+ function resolveRecorded(raw, projectRoot) {
856
+ const expanded = expanduser(raw);
857
+ return isAbsolute(expanded) ? resolve3(expanded) : resolve3(projectRoot, expanded);
858
+ }
859
+ function readRecordedByTool(manifestPath, projectRoot) {
860
+ const out = /* @__PURE__ */ new Map();
861
+ if (!existsSync2(manifestPath)) return out;
862
+ let doc;
863
+ try {
864
+ doc = YAML.parse(readFileSync3(manifestPath, "utf8"));
865
+ } catch {
866
+ return out;
867
+ }
868
+ if (doc === null || typeof doc !== "object" || Array.isArray(doc)) return out;
869
+ const tools = doc["tools"];
870
+ if (!Array.isArray(tools)) return out;
871
+ for (const tool of tools) {
872
+ if (tool === null || typeof tool !== "object" || Array.isArray(tool)) continue;
873
+ const rec = tool;
874
+ const name = rec["name"];
875
+ if (typeof name !== "string" || name.length === 0) continue;
876
+ const files = [];
877
+ const rawFiles = rec["files"];
878
+ if (Array.isArray(rawFiles)) {
879
+ for (const entry of rawFiles) {
880
+ if (entry === null || typeof entry !== "object" || Array.isArray(entry)) continue;
881
+ const raw = entry["path"];
882
+ if (typeof raw !== "string" || raw.length === 0) continue;
883
+ files.push({
884
+ entry,
885
+ resolved: resolveRecorded(raw, projectRoot)
886
+ });
887
+ }
888
+ }
889
+ const rawMerged = rec["merged_keys"];
890
+ const mergedKeys = Array.isArray(rawMerged) ? rawMerged : [];
891
+ out.set(name, { files, mergedKeys });
892
+ }
893
+ return out;
894
+ }
895
+ function hydrateRecordedInventories(entries, prior) {
896
+ for (const entry of entries) {
897
+ const name = entry["name"];
898
+ if (typeof name !== "string") continue;
899
+ const recorded = prior.get(name);
900
+ if (recorded === void 0) continue;
901
+ if (Array.isArray(entry["files"]) && entry["files"].length === 0) {
902
+ entry["files"] = recorded.files.map((f) => f.entry);
903
+ }
904
+ if (Array.isArray(entry["merged_keys"]) && entry["merged_keys"].length === 0) {
905
+ entry["merged_keys"] = [...recorded.mergedKeys];
906
+ }
907
+ }
908
+ return entries;
909
+ }
910
+ function reconcileToolFiles(fresh, prior, preserved) {
911
+ if (fresh === null || fresh === void 0) {
912
+ return prior === void 0 ? null : prior.files.map((f) => f.entry);
913
+ }
914
+ if (prior === void 0 || preserved.size === 0) return [...fresh];
915
+ const seen = /* @__PURE__ */ new Set();
916
+ for (const entry of fresh) {
917
+ const raw = entry["path"];
918
+ if (typeof raw === "string") seen.add(resolve3(expanduser(raw)));
919
+ }
920
+ const out = [...fresh];
921
+ for (const file of prior.files) {
922
+ const staged = preserved.get(file.resolved);
923
+ if (staged === void 0 || seen.has(file.resolved)) continue;
924
+ out.push(staged.sha256 === null ? file.entry : { ...file.entry, sha256: staged.sha256 });
925
+ if (staged.sidecar !== null) out.push(staged.sidecar);
926
+ }
927
+ return out;
928
+ }
929
+ function preservedIndex(preservedTargets, staged) {
930
+ const out = /* @__PURE__ */ new Map();
931
+ for (const target of preservedTargets) {
932
+ const sidecar = sidecarPathFor(target);
933
+ const sha = staged.get(sidecar) ?? null;
934
+ out.set(resolve3(target), {
935
+ sha256: sha,
936
+ sidecar: sha === null ? null : { path: sidecar, kind: "sidecar", sha256: sha }
937
+ });
938
+ }
939
+ return out;
940
+ }
941
+
942
+ // src/scripts/_lib/rule_layer_overlap.ts
943
+ import * as fs4 from "node:fs";
944
+ import * as path4 from "node:path";
525
945
  var INSTALLER_PROVENANCE_KEYS = ["package", "source_path"];
526
946
  function stripProvenance(text) {
527
947
  const lines = text.split("\n");
@@ -575,14 +995,14 @@ function compareLayers(global_layer, project_layer) {
575
995
  function readRuleLayer(dir) {
576
996
  let names;
577
997
  try {
578
- names = fs2.readdirSync(dir);
998
+ names = fs4.readdirSync(dir);
579
999
  } catch {
580
1000
  return null;
581
1001
  }
582
1002
  const files = /* @__PURE__ */ new Map();
583
1003
  for (const name of names.filter((n) => n.endsWith(".md")).sort()) {
584
1004
  try {
585
- files.set(name, fs2.readFileSync(path2.join(dir, name), "utf-8"));
1005
+ files.set(name, fs4.readFileSync(path4.join(dir, name), "utf-8"));
586
1006
  } catch {
587
1007
  continue;
588
1008
  }
@@ -590,7 +1010,7 @@ function readRuleLayer(dir) {
590
1010
  return { dir, files };
591
1011
  }
592
1012
  function claudeMdExcludesGlob(dir) {
593
- return `${path2.resolve(dir).replace(/\/+$/, "")}/**`;
1013
+ return `${path4.resolve(dir).replace(/\/+$/, "")}/**`;
594
1014
  }
595
1015
  function mergeClaudeMdExcludes(existing, entry) {
596
1016
  if (!Array.isArray(existing)) return [entry];
@@ -620,26 +1040,26 @@ function decideLayerAction(report, choice, global_dir, project_dir) {
620
1040
 
621
1041
  // src/scripts/_lib/install_drift.ts
622
1042
  var import_yaml = __toESM(require_dist(), 1);
623
- import * as crypto from "node:crypto";
624
- import * as fs3 from "node:fs";
1043
+ import * as crypto3 from "node:crypto";
1044
+ import * as fs5 from "node:fs";
625
1045
  import * as os from "node:os";
626
- import * as path3 from "node:path";
627
- function expanduser(p) {
1046
+ import * as path5 from "node:path";
1047
+ function expanduser2(p) {
628
1048
  if (p === "~") {
629
1049
  return os.homedir();
630
1050
  }
631
1051
  if (p.startsWith("~/") || process.platform === "win32" && p.startsWith("~\\")) {
632
- return path3.join(os.homedir(), p.slice(2));
1052
+ return path5.join(os.homedir(), p.slice(2));
633
1053
  }
634
1054
  return p;
635
1055
  }
636
1056
  function resolve_entry_path(project_root, raw) {
637
- const p = expanduser(raw);
638
- return path3.isAbsolute(p) ? p : path3.join(project_root, p);
1057
+ const p = expanduser2(raw);
1058
+ return path5.isAbsolute(p) ? p : path5.join(project_root, p);
639
1059
  }
640
1060
  function sha256_of_file(p) {
641
1061
  try {
642
- return crypto.createHash("sha256").update(fs3.readFileSync(p)).digest("hex");
1062
+ return crypto3.createHash("sha256").update(fs5.readFileSync(p)).digest("hex");
643
1063
  } catch {
644
1064
  return null;
645
1065
  }
@@ -648,7 +1068,7 @@ function collect_drift(project_root, env) {
648
1068
  const target = manifest_path(project_root, env);
649
1069
  let text;
650
1070
  try {
651
- text = fs3.readFileSync(target, "utf-8");
1071
+ text = fs5.readFileSync(target, "utf-8");
652
1072
  } catch {
653
1073
  return null;
654
1074
  }
@@ -693,7 +1113,7 @@ function collect_drift(project_root, env) {
693
1113
  continue;
694
1114
  }
695
1115
  const resolved = resolve_entry_path(project_root, raw_path);
696
- if (!fs3.existsSync(resolved)) {
1116
+ if (!fs5.existsSync(resolved)) {
697
1117
  out.push({
698
1118
  tool_id,
699
1119
  path: resolved,
@@ -746,15 +1166,15 @@ function format_drift_report(entries) {
746
1166
  }
747
1167
 
748
1168
  // src/scripts/_lib/skill_catalogue.ts
749
- import * as fs4 from "node:fs";
750
- import * as path4 from "node:path";
1169
+ import * as fs6 from "node:fs";
1170
+ import * as path6 from "node:path";
751
1171
  var PROJECT_CATALOGUE_ROOTS = ["src/skills", ".claude/skills"];
752
1172
  var HOST_CATALOGUE_ROOT = ".claude/skills";
753
1173
  var DEFAULT_CATALOGUE_ROOTS = [
754
1174
  ...PROJECT_CATALOGUE_ROOTS,
755
1175
  `~/${HOST_CATALOGUE_ROOT}`
756
1176
  ];
757
- var OBSERVATION_LOG = path4.join(
1177
+ var OBSERVATION_LOG = path6.join(
758
1178
  "agents",
759
1179
  "evidence",
760
1180
  "metrics",
@@ -798,9 +1218,9 @@ function descriptionOf(frontmatter) {
798
1218
  return "";
799
1219
  }
800
1220
  function readProjectedCatalogue(root) {
801
- const names = fs4.readdirSync(root).filter((n) => fs4.existsSync(path4.join(root, n, "SKILL.md"))).sort();
1221
+ const names = fs6.readdirSync(root).filter((n) => fs6.existsSync(path6.join(root, n, "SKILL.md"))).sort();
802
1222
  return names.map((name, index) => {
803
- const content = fs4.readFileSync(path4.join(root, name, "SKILL.md"), "utf-8");
1223
+ const content = fs6.readFileSync(path6.join(root, name, "SKILL.md"), "utf-8");
804
1224
  const frontmatter = frontmatterOf(content);
805
1225
  const description = descriptionOf(frontmatter);
806
1226
  return {
@@ -817,12 +1237,12 @@ function truncationModeOf(record) {
817
1237
  return record.truncation_mode ?? "per-entry";
818
1238
  }
819
1239
  function markdownFilesUnder(root) {
820
- if (!fs4.existsSync(root)) return [];
1240
+ if (!fs6.existsSync(root)) return [];
821
1241
  const out = [];
822
1242
  const walk = (dir) => {
823
- for (const entry of fs4.readdirSync(dir, { withFileTypes: true })) {
824
- const full = path4.join(dir, entry.name);
825
- if (fs4.statSync(full).isDirectory()) walk(full);
1243
+ for (const entry of fs6.readdirSync(dir, { withFileTypes: true })) {
1244
+ const full = path6.join(dir, entry.name);
1245
+ if (fs6.statSync(full).isDirectory()) walk(full);
826
1246
  else if (entry.name.endsWith(".md")) out.push(full);
827
1247
  }
828
1248
  };
@@ -830,9 +1250,9 @@ function markdownFilesUnder(root) {
830
1250
  return out;
831
1251
  }
832
1252
  function measureCatalogueVolume(host, root) {
833
- const skillsRoot = path4.join(root, "skills");
834
- const skills = fs4.existsSync(skillsRoot) ? readProjectedCatalogue(skillsRoot) : [];
835
- const commandEntries = markdownFilesUnder(path4.join(root, "commands")).length;
1253
+ const skillsRoot = path6.join(root, "skills");
1254
+ const skills = fs6.existsSync(skillsRoot) ? readProjectedCatalogue(skillsRoot) : [];
1255
+ const commandEntries = markdownFilesUnder(path6.join(root, "commands")).length;
836
1256
  return {
837
1257
  host,
838
1258
  root,
@@ -910,9 +1330,9 @@ function migrationPromptLines(host, eligibility, settingsPath) {
910
1330
  ];
911
1331
  }
912
1332
  function readObservationLog(logPath) {
913
- if (!fs4.existsSync(logPath)) return [];
1333
+ if (!fs6.existsSync(logPath)) return [];
914
1334
  const out = [];
915
- for (const line of fs4.readFileSync(logPath, "utf-8").split("\n")) {
1335
+ for (const line of fs6.readFileSync(logPath, "utf-8").split("\n")) {
916
1336
  const trimmed = line.trim();
917
1337
  if (trimmed.length === 0) continue;
918
1338
  try {
@@ -952,9 +1372,9 @@ function isInteractiveSession(probe) {
952
1372
  }
953
1373
 
954
1374
  // src/scripts/_lib/claude_desktop_bundler.ts
955
- import * as crypto2 from "node:crypto";
956
- import * as fs5 from "node:fs";
957
- import * as path5 from "node:path";
1375
+ import * as crypto4 from "node:crypto";
1376
+ import * as fs7 from "node:fs";
1377
+ import * as path7 from "node:path";
958
1378
 
959
1379
  // src/scripts/_lib/zip_min.ts
960
1380
  import * as zlib from "node:zlib";
@@ -1061,7 +1481,7 @@ function _is_excluded(rel_parts) {
1061
1481
  }
1062
1482
  function _is_dir(p) {
1063
1483
  try {
1064
- return fs5.statSync(p).isDirectory();
1484
+ return fs7.statSync(p).isDirectory();
1065
1485
  } catch {
1066
1486
  return false;
1067
1487
  }
@@ -1073,12 +1493,12 @@ function _compare_rel_parts(a, b) {
1073
1493
  }
1074
1494
  function _walk_skill_files(skill_dir) {
1075
1495
  const out = [];
1076
- const resolved = fs5.realpathSync(skill_dir);
1496
+ const resolved = fs7.realpathSync(skill_dir);
1077
1497
  const walk = (root, relRoot) => {
1078
1498
  const dirNames = [];
1079
1499
  const fileNames = [];
1080
- for (const dirent of fs5.readdirSync(root, { withFileTypes: true })) {
1081
- const full = path5.join(root, dirent.name);
1500
+ for (const dirent of fs7.readdirSync(root, { withFileTypes: true })) {
1501
+ const full = path7.join(root, dirent.name);
1082
1502
  const isDir2 = dirent.isDirectory() || dirent.isSymbolicLink() && _is_dir(full);
1083
1503
  if (isDir2) {
1084
1504
  dirNames.push(dirent.name);
@@ -1091,13 +1511,13 @@ function _walk_skill_files(skill_dir) {
1091
1511
  if (_is_excluded(rel_parts)) {
1092
1512
  continue;
1093
1513
  }
1094
- out.push([path5.join(root, fname), rel_parts]);
1514
+ out.push([path7.join(root, fname), rel_parts]);
1095
1515
  }
1096
1516
  for (const dname of dirNames) {
1097
1517
  if (_is_excluded([dname])) {
1098
1518
  continue;
1099
1519
  }
1100
- walk(path5.join(root, dname), [...relRoot, dname]);
1520
+ walk(path7.join(root, dname), [...relRoot, dname]);
1101
1521
  }
1102
1522
  };
1103
1523
  walk(resolved, []);
@@ -1105,58 +1525,58 @@ function _walk_skill_files(skill_dir) {
1105
1525
  return out;
1106
1526
  }
1107
1527
  function _manifest_digest(files) {
1108
- const h = crypto2.createHash("sha256");
1528
+ const h = crypto4.createHash("sha256");
1109
1529
  for (const [abs_path, rel_parts] of files) {
1110
1530
  const rel = rel_parts.join("/");
1111
1531
  h.update(Buffer.from(rel, "utf-8"));
1112
1532
  h.update(Buffer.from([0]));
1113
- h.update(crypto2.createHash("sha256").update(fs5.readFileSync(abs_path)).digest());
1533
+ h.update(crypto4.createHash("sha256").update(fs7.readFileSync(abs_path)).digest());
1114
1534
  h.update(Buffer.from([0]));
1115
1535
  }
1116
1536
  return h.digest("hex");
1117
1537
  }
1118
1538
  function _atomic_write_zip(zip_path, files) {
1119
- fs5.mkdirSync(path5.dirname(zip_path), { recursive: true });
1120
- const stem = path5.basename(zip_path, path5.extname(zip_path));
1121
- const tmp_path = path5.join(
1122
- path5.dirname(zip_path),
1123
- `.${stem}.${crypto2.randomBytes(6).toString("hex")}.zip.tmp`
1539
+ fs7.mkdirSync(path7.dirname(zip_path), { recursive: true });
1540
+ const stem = path7.basename(zip_path, path7.extname(zip_path));
1541
+ const tmp_path = path7.join(
1542
+ path7.dirname(zip_path),
1543
+ `.${stem}.${crypto4.randomBytes(6).toString("hex")}.zip.tmp`
1124
1544
  );
1125
1545
  try {
1126
1546
  const entries = files.map(([abs_path, rel_parts]) => ({
1127
1547
  name: rel_parts.join("/"),
1128
- data: fs5.readFileSync(abs_path)
1548
+ data: fs7.readFileSync(abs_path)
1129
1549
  }));
1130
- fs5.writeFileSync(tmp_path, zip_write_sync(entries));
1131
- fs5.renameSync(tmp_path, zip_path);
1550
+ fs7.writeFileSync(tmp_path, zip_write_sync(entries));
1551
+ fs7.renameSync(tmp_path, zip_path);
1132
1552
  } finally {
1133
- if (fs5.existsSync(tmp_path)) {
1134
- fs5.unlinkSync(tmp_path);
1553
+ if (fs7.existsSync(tmp_path)) {
1554
+ fs7.unlinkSync(tmp_path);
1135
1555
  }
1136
1556
  }
1137
1557
  }
1138
1558
  function _write_if_changed(dest_dir, slug, files, force, written) {
1139
1559
  const digest = _manifest_digest(files);
1140
- const zip_path = path5.join(dest_dir, `${slug}.zip`);
1141
- const digest_path = path5.join(dest_dir, `${slug}.sha256`);
1142
- const recorded = fs5.existsSync(digest_path) ? fs5.readFileSync(digest_path, "utf-8").trim() : "";
1143
- if (!force && recorded === digest && fs5.existsSync(zip_path)) {
1560
+ const zip_path = path7.join(dest_dir, `${slug}.zip`);
1561
+ const digest_path = path7.join(dest_dir, `${slug}.sha256`);
1562
+ const recorded = fs7.existsSync(digest_path) ? fs7.readFileSync(digest_path, "utf-8").trim() : "";
1563
+ if (!force && recorded === digest && fs7.existsSync(zip_path)) {
1144
1564
  return;
1145
1565
  }
1146
1566
  _atomic_write_zip(zip_path, files);
1147
- fs5.writeFileSync(digest_path, digest + "\n", "utf-8");
1567
+ fs7.writeFileSync(digest_path, digest + "\n", "utf-8");
1148
1568
  written.push(zip_path);
1149
1569
  }
1150
1570
  function build_skill_bundles(package_root, dest_dir, force = false, curation = null) {
1151
- const skills_root = path5.join(package_root, "dist/agent-src", "skills");
1571
+ const skills_root = path7.join(package_root, "dist/agent-src", "skills");
1152
1572
  if (!_is_dir(skills_root)) {
1153
1573
  return [];
1154
1574
  }
1155
- fs5.mkdirSync(dest_dir, { recursive: true });
1575
+ fs7.mkdirSync(dest_dir, { recursive: true });
1156
1576
  const written = [];
1157
- for (const name of fs5.readdirSync(skills_root).sort()) {
1158
- const entry = path5.join(skills_root, name);
1159
- const isSymlink2 = fs5.lstatSync(entry).isSymbolicLink();
1577
+ for (const name of fs7.readdirSync(skills_root).sort()) {
1578
+ const entry = path7.join(skills_root, name);
1579
+ const isSymlink2 = fs7.lstatSync(entry).isSymbolicLink();
1160
1580
  if (!(_is_dir(entry) || isSymlink2)) {
1161
1581
  continue;
1162
1582
  }
@@ -1164,8 +1584,8 @@ function build_skill_bundles(package_root, dest_dir, force = false, curation = n
1164
1584
  if (curation !== null && !curation.includes(skill_name)) {
1165
1585
  continue;
1166
1586
  }
1167
- const skill_md = path5.join(entry, "SKILL.md");
1168
- if (!fs5.existsSync(skill_md)) {
1587
+ const skill_md = path7.join(entry, "SKILL.md");
1588
+ if (!fs7.existsSync(skill_md)) {
1169
1589
  continue;
1170
1590
  }
1171
1591
  const files = _walk_skill_files(entry);
@@ -1177,15 +1597,15 @@ function build_skill_bundles(package_root, dest_dir, force = false, curation = n
1177
1597
  return written;
1178
1598
  }
1179
1599
  function _command_slug(source_file, commands_root) {
1180
- const rel = path5.relative(commands_root, source_file);
1181
- const noExt = rel.slice(0, rel.length - path5.extname(rel).length);
1182
- return noExt.split(path5.sep).join("-");
1600
+ const rel = path7.relative(commands_root, source_file);
1601
+ const noExt = rel.slice(0, rel.length - path7.extname(rel).length);
1602
+ return noExt.split(path7.sep).join("-");
1183
1603
  }
1184
1604
  function _iter_command_files(commands_root) {
1185
1605
  const found = [];
1186
1606
  const walk = (dir) => {
1187
- for (const dirent of fs5.readdirSync(dir, { withFileTypes: true })) {
1188
- const full = path5.join(dir, dirent.name);
1607
+ for (const dirent of fs7.readdirSync(dir, { withFileTypes: true })) {
1608
+ const full = path7.join(dir, dirent.name);
1189
1609
  if (dirent.isDirectory() || dirent.isSymbolicLink() && _is_dir(full)) {
1190
1610
  walk(full);
1191
1611
  } else if (dirent.name.endsWith(".md")) {
@@ -1195,21 +1615,21 @@ function _iter_command_files(commands_root) {
1195
1615
  };
1196
1616
  walk(commands_root);
1197
1617
  found.sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
1198
- return found.filter((source_file) => path5.basename(source_file) !== "AGENTS.md");
1618
+ return found.filter((source_file) => path7.basename(source_file) !== "AGENTS.md");
1199
1619
  }
1200
1620
  function build_command_bundles(package_root, dest_dir, force = false, curation = null) {
1201
- const commands_root = path5.join(package_root, "dist/agent-src", "commands");
1621
+ const commands_root = path7.join(package_root, "dist/agent-src", "commands");
1202
1622
  if (!_is_dir(commands_root)) {
1203
1623
  return [];
1204
1624
  }
1205
- const skills_root = path5.join(package_root, "dist/agent-src", "skills");
1625
+ const skills_root = path7.join(package_root, "dist/agent-src", "skills");
1206
1626
  let skill_names = /* @__PURE__ */ new Set();
1207
1627
  if (_is_dir(skills_root)) {
1208
1628
  skill_names = new Set(
1209
- fs5.readdirSync(skills_root).filter((name) => _is_dir(path5.join(skills_root, name)))
1629
+ fs7.readdirSync(skills_root).filter((name) => _is_dir(path7.join(skills_root, name)))
1210
1630
  );
1211
1631
  }
1212
- fs5.mkdirSync(dest_dir, { recursive: true });
1632
+ fs7.mkdirSync(dest_dir, { recursive: true });
1213
1633
  const written = [];
1214
1634
  for (const source_file of _iter_command_files(commands_root)) {
1215
1635
  const slug = _command_slug(source_file, commands_root);
@@ -1219,7 +1639,7 @@ function build_command_bundles(package_root, dest_dir, force = false, curation =
1219
1639
  if (curation !== null && !curation.includes(slug)) {
1220
1640
  continue;
1221
1641
  }
1222
- const files = [[fs5.realpathSync(source_file), ["SKILL.md"]]];
1642
+ const files = [[fs7.realpathSync(source_file), ["SKILL.md"]]];
1223
1643
  _write_if_changed(dest_dir, slug, files, force, written);
1224
1644
  }
1225
1645
  return written;
@@ -1227,15 +1647,15 @@ function build_command_bundles(package_root, dest_dir, force = false, curation =
1227
1647
 
1228
1648
  // src/scripts/hooks/host_lowering.ts
1229
1649
  var import_yaml2 = __toESM(require_dist(), 1);
1230
- import * as fs6 from "node:fs";
1231
- import * as path6 from "node:path";
1650
+ import * as fs8 from "node:fs";
1651
+ import * as path8 from "node:path";
1232
1652
  import { fileURLToPath } from "node:url";
1233
1653
  var _IN_BUNDLE = true;
1234
- var _REPO_ROOT = path6.resolve(
1235
- path6.dirname(fileURLToPath(import.meta.url)),
1654
+ var _REPO_ROOT = path8.resolve(
1655
+ path8.dirname(fileURLToPath(import.meta.url)),
1236
1656
  ..._IN_BUNDLE ? ["..", ".."] : ["..", "..", ".."]
1237
1657
  );
1238
- var HOST_LOWERING_PATH = path6.join(_REPO_ROOT, "src", "scripts", "hooks", "host_lowering.yaml");
1658
+ var HOST_LOWERING_PATH = path8.join(_REPO_ROOT, "src", "scripts", "hooks", "host_lowering.yaml");
1239
1659
  var DEFAULT_SURFACE = "any";
1240
1660
  function _asString(v) {
1241
1661
  if (v === null || v === void 0) return null;
@@ -1301,7 +1721,7 @@ function _parse(text) {
1301
1721
  }
1302
1722
  var _cache = null;
1303
1723
  function loadHostLowering() {
1304
- if (_cache === null) _cache = _parse(fs6.readFileSync(HOST_LOWERING_PATH, "utf-8"));
1724
+ if (_cache === null) _cache = _parse(fs8.readFileSync(HOST_LOWERING_PATH, "utf-8"));
1305
1725
  return _cache;
1306
1726
  }
1307
1727
  function surfaceRow(host, surface = DEFAULT_SURFACE, table = loadHostLowering()) {
@@ -1320,26 +1740,26 @@ function hostBindings(host, table = loadHostLowering()) {
1320
1740
  }
1321
1741
 
1322
1742
  // src/install/partitionEligibility.ts
1323
- import * as fs8 from "node:fs";
1743
+ import * as fs10 from "node:fs";
1324
1744
  import * as os2 from "node:os";
1325
1745
 
1326
1746
  // src/install/hostLayerFingerprint.ts
1327
- import { createHash as createHash4 } from "node:crypto";
1328
- import * as fs7 from "node:fs";
1329
- import * as path7 from "node:path";
1747
+ import { createHash as createHash5 } from "node:crypto";
1748
+ import * as fs9 from "node:fs";
1749
+ import * as path9 from "node:path";
1330
1750
  var FINGERPRINT_SCHEMA = 1;
1331
1751
  function collectFiles(dir) {
1332
1752
  const out = [];
1333
1753
  const walk = (d) => {
1334
1754
  let entries;
1335
1755
  try {
1336
- entries = fs7.readdirSync(d, { withFileTypes: true });
1756
+ entries = fs9.readdirSync(d, { withFileTypes: true });
1337
1757
  } catch {
1338
1758
  return;
1339
1759
  }
1340
1760
  const sorted = [...entries].sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0);
1341
1761
  for (const e of sorted) {
1342
- const p = path7.join(d, e.name);
1762
+ const p = path9.join(d, e.name);
1343
1763
  if (e.isDirectory()) {
1344
1764
  walk(p);
1345
1765
  } else if (e.isFile()) {
@@ -1351,15 +1771,15 @@ function collectFiles(dir) {
1351
1771
  return out.sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
1352
1772
  }
1353
1773
  function fingerprintLayers(layers) {
1354
- const h = createHash4("sha256");
1774
+ const h = createHash5("sha256");
1355
1775
  h.update(`v${FINGERPRINT_SCHEMA}\0`);
1356
1776
  for (const layer of layers) {
1357
1777
  h.update(`layer:${layer.label}\0`);
1358
1778
  for (const file of collectFiles(layer.root)) {
1359
- h.update(path7.relative(layer.root, file));
1779
+ h.update(path9.relative(layer.root, file));
1360
1780
  h.update("\0");
1361
1781
  try {
1362
- h.update(fs7.readFileSync(file));
1782
+ h.update(fs9.readFileSync(file));
1363
1783
  } catch {
1364
1784
  h.update("\0unreadable\0");
1365
1785
  }
@@ -1369,11 +1789,11 @@ function fingerprintLayers(layers) {
1369
1789
  return h.digest("hex");
1370
1790
  }
1371
1791
  function hostLayerInputs(userHome) {
1372
- const claude = path7.join(userHome, ".claude");
1792
+ const claude = path9.join(userHome, ".claude");
1373
1793
  return [
1374
- { label: "rules", root: path7.join(claude, "rules") },
1375
- { label: "skills", root: path7.join(claude, "skills") },
1376
- { label: "commands", root: path7.join(claude, "commands") }
1794
+ { label: "rules", root: path9.join(claude, "rules") },
1795
+ { label: "skills", root: path9.join(claude, "skills") },
1796
+ { label: "commands", root: path9.join(claude, "commands") }
1377
1797
  ];
1378
1798
  }
1379
1799
 
@@ -1382,7 +1802,7 @@ var MAINTAINER_WORKSPACE = "agent-config-maintainer";
1382
1802
  function isExclusivelyPackageOnly(source_path) {
1383
1803
  let meta;
1384
1804
  try {
1385
- [meta] = parseFrontmatter(fs8.readFileSync(source_path, "utf-8"));
1805
+ [meta] = parseFrontmatter(fs10.readFileSync(source_path, "utf-8"));
1386
1806
  } catch {
1387
1807
  return false;
1388
1808
  }
@@ -1413,8 +1833,8 @@ function stampHostLayerFingerprint(installedVersion, tools, lockfilePath, skip2,
1413
1833
  }
1414
1834
 
1415
1835
  // src/install/claudeRuleRewrite.ts
1416
- import * as fs9 from "node:fs";
1417
- import * as path8 from "node:path";
1836
+ import * as fs11 from "node:fs";
1837
+ import * as path10 from "node:path";
1418
1838
 
1419
1839
  // src/install/claudePathsPlan.ts
1420
1840
  function derive_trigger_globs(meta) {
@@ -1516,8 +1936,8 @@ function _withPreservedKeys(rendered, original) {
1516
1936
  }
1517
1937
  return ["---", ...keep, "---", "", rendered].join("\n");
1518
1938
  }
1519
- function rewriteAndReport(rulesDir, quiet, info2, warn2, wrappers) {
1520
- const result = rewriteClaudeRules(rulesDir);
1939
+ function rewriteAndReport(rulesDir, quiet, info2, warn2, wrappers, preserved = /* @__PURE__ */ new Set()) {
1940
+ const result = rewriteClaudeRules(rulesDir, preserved);
1521
1941
  if (wrappers && !quiet) {
1522
1942
  if (wrappers.wrapped.length > 0) {
1523
1943
  info2(
@@ -1566,26 +1986,27 @@ function renderClaudeRule(sourceText) {
1566
1986
  lines.push(pyRstrip(body) + "\n");
1567
1987
  return { text: lines.join("\n"), globs: plan.globs, dropped: plan.dropped };
1568
1988
  }
1569
- function rewriteClaudeRules(rulesDir) {
1989
+ function rewriteClaudeRules(rulesDir, preserved = /* @__PURE__ */ new Set()) {
1570
1990
  const result = { rewritten: 0, scoped: [], dropped: [], failed: [] };
1571
1991
  let entries;
1572
1992
  try {
1573
- entries = fs9.readdirSync(rulesDir);
1993
+ entries = fs11.readdirSync(rulesDir);
1574
1994
  } catch {
1575
1995
  return result;
1576
1996
  }
1577
1997
  for (const name of entries.filter((n) => n.endsWith(".md")).sort()) {
1578
- const full = path8.join(rulesDir, name);
1998
+ const full = path10.join(rulesDir, name);
1999
+ if (preserved.has(path10.resolve(full))) continue;
1579
2000
  let stat;
1580
2001
  try {
1581
- stat = fs9.lstatSync(full);
2002
+ stat = fs11.lstatSync(full);
1582
2003
  } catch {
1583
2004
  continue;
1584
2005
  }
1585
2006
  if (!stat.isFile() || stat.isSymbolicLink()) continue;
1586
2007
  let text;
1587
2008
  try {
1588
- text = fs9.readFileSync(full, "utf-8");
2009
+ text = fs11.readFileSync(full, "utf-8");
1589
2010
  } catch {
1590
2011
  continue;
1591
2012
  }
@@ -1595,7 +2016,7 @@ function rewriteClaudeRules(rulesDir) {
1595
2016
  const withOwnership = _withPreservedKeys(rendered.text, text);
1596
2017
  if (withOwnership !== text) {
1597
2018
  try {
1598
- fs9.writeFileSync(full, withOwnership, "utf-8");
2019
+ fs11.writeFileSync(full, withOwnership, "utf-8");
1599
2020
  } catch (e) {
1600
2021
  result.failed.push({
1601
2022
  rule: name.slice(0, -3),
@@ -2969,8 +3390,8 @@ var zodToJsonSchema = (schema, options) => {
2969
3390
  };
2970
3391
 
2971
3392
  // src/scripts/_lib/module_detection.ts
2972
- import * as fs10 from "node:fs";
2973
- import * as path9 from "node:path";
3393
+ import * as fs12 from "node:fs";
3394
+ import * as path11 from "node:path";
2974
3395
  var _SKIP_DIRS = /* @__PURE__ */ new Set([".module-template", ".example"]);
2975
3396
  var _RULES = [
2976
3397
  ["app/Modules", "laravel-hmvc", "App\\Modules\\{ModuleName}"],
@@ -2984,14 +3405,14 @@ var _RULES = [
2984
3405
  ];
2985
3406
  function _isDir(p) {
2986
3407
  try {
2987
- return fs10.statSync(p).isDirectory();
3408
+ return fs12.statSync(p).isDirectory();
2988
3409
  } catch {
2989
3410
  return false;
2990
3411
  }
2991
3412
  }
2992
3413
  function _isFile(p) {
2993
3414
  try {
2994
- return fs10.statSync(p).isFile();
3415
+ return fs12.statSync(p).isFile();
2995
3416
  } catch {
2996
3417
  return false;
2997
3418
  }
@@ -3005,13 +3426,13 @@ function _isUpperChar(ch) {
3005
3426
  function _list_module_subdirs(root) {
3006
3427
  let entries;
3007
3428
  try {
3008
- entries = fs10.readdirSync(root).sort();
3429
+ entries = fs12.readdirSync(root).sort();
3009
3430
  } catch {
3010
3431
  return [];
3011
3432
  }
3012
3433
  const out = [];
3013
3434
  for (const name of entries) {
3014
- if (!_isDir(path9.join(root, name))) {
3435
+ if (!_isDir(path11.join(root, name))) {
3015
3436
  continue;
3016
3437
  }
3017
3438
  if (name.startsWith(".")) {
@@ -3033,11 +3454,11 @@ function _score_confidence(stack, root, subdirs) {
3033
3454
  return capitalized.length > 0 ? "high" : "medium";
3034
3455
  }
3035
3456
  if (stack === "node-monorepo") {
3036
- const withPkgJson = subdirs.filter((name) => _isFile(path9.join(root, name, "package.json")));
3457
+ const withPkgJson = subdirs.filter((name) => _isFile(path11.join(root, name, "package.json")));
3037
3458
  return withPkgJson.length > 0 ? "high" : "medium";
3038
3459
  }
3039
3460
  if (stack === "python-src") {
3040
- const withInit = subdirs.filter((name) => _isFile(path9.join(root, name, "__init__.py")));
3461
+ const withInit = subdirs.filter((name) => _isFile(path11.join(root, name, "__init__.py")));
3041
3462
  return withInit.length > 0 ? "high" : "medium";
3042
3463
  }
3043
3464
  if (stack === "go-internal") {
@@ -3049,7 +3470,7 @@ function detect_module_roots(project_root) {
3049
3470
  const high = [];
3050
3471
  const medium = [];
3051
3472
  for (const [rel_path, stack, namespace_template] of _RULES) {
3052
- const abs_path = path9.join(project_root, rel_path);
3473
+ const abs_path = path11.join(project_root, rel_path);
3053
3474
  if (!_isDir(abs_path)) {
3054
3475
  continue;
3055
3476
  }
@@ -3071,7 +3492,7 @@ function detect_module_roots(project_root) {
3071
3492
  }
3072
3493
 
3073
3494
  // src/scripts/_lib/model_tier.ts
3074
- import fs11 from "node:fs";
3495
+ import fs13 from "node:fs";
3075
3496
  var TIER_TO_CLAUDE_MODEL = {
3076
3497
  frontier: "fable",
3077
3498
  high: "opus",
@@ -3080,8 +3501,8 @@ var TIER_TO_CLAUDE_MODEL = {
3080
3501
  };
3081
3502
  var MODEL_TIER_RE = /^model_tier:\s*"?([a-z]+)"?\s*$/m;
3082
3503
  function read_model_tier(skill_md) {
3083
- if (!fs11.existsSync(skill_md)) return null;
3084
- const text = fs11.readFileSync(skill_md).toString("utf-8");
3504
+ if (!fs13.existsSync(skill_md)) return null;
3505
+ const text = fs13.readFileSync(skill_md).toString("utf-8");
3085
3506
  if (!text.startsWith("---\n")) return null;
3086
3507
  const end = text.indexOf("\n---\n", 4);
3087
3508
  if (end === -1) return null;
@@ -3096,6 +3517,30 @@ function render_native_model_md(text, tier) {
3096
3517
  return text.replace(MODEL_TIER_RE, `model: ${model}`);
3097
3518
  }
3098
3519
 
3520
+ // src/install/paths.ts
3521
+ import { homedir as homedir4, tmpdir } from "node:os";
3522
+ import { join as join12 } from "node:path";
3523
+ var INSTALL_ROOT_SUBPATH = ".event4u/agent-config";
3524
+ var INSTALL_LOG_FILENAME = "install-log.jsonl";
3525
+ function resolveHome(home) {
3526
+ if (home && home.length > 0) {
3527
+ return home;
3528
+ }
3529
+ const fromOs = homedir4();
3530
+ if (!fromOs) {
3531
+ throw new Error(
3532
+ "Cannot resolve home directory \u2014 both $HOME (POSIX) and $USERPROFILE (Windows) are unset."
3533
+ );
3534
+ }
3535
+ return fromOs;
3536
+ }
3537
+ function getInstallRoot(home) {
3538
+ return join12(resolveHome(home), INSTALL_ROOT_SUBPATH);
3539
+ }
3540
+ function getLogPath(home) {
3541
+ return join12(getInstallRoot(home), INSTALL_LOG_FILENAME);
3542
+ }
3543
+
3099
3544
  // src/scripts/install.ts
3100
3545
  var _HERE = fileURLToPath2(import.meta.url);
3101
3546
  var SystemExitError = class extends Error {
@@ -3112,62 +3557,44 @@ var ArgparseExit = class extends Error {
3112
3557
  }
3113
3558
  code;
3114
3559
  };
3115
- function expanduser2(p) {
3560
+ function expanduser3(p) {
3116
3561
  if (p === "~") return os3.homedir();
3117
3562
  if (p.startsWith("~/") || p.startsWith("~\\")) {
3118
- return path10.join(os3.homedir(), p.slice(2));
3563
+ return path12.join(os3.homedir(), p.slice(2));
3119
3564
  }
3120
3565
  return p;
3121
3566
  }
3122
- function resolvePath(p) {
3123
- try {
3124
- return fs12.realpathSync(path10.resolve(p));
3125
- } catch {
3126
- return path10.resolve(p);
3127
- }
3128
- }
3129
3567
  function isFile(p) {
3130
3568
  try {
3131
- return fs12.statSync(p).isFile();
3569
+ return fs14.statSync(p).isFile();
3132
3570
  } catch {
3133
3571
  return false;
3134
3572
  }
3135
3573
  }
3136
3574
  function isDir(p) {
3137
3575
  try {
3138
- return fs12.statSync(p).isDirectory();
3139
- } catch {
3140
- return false;
3141
- }
3142
- }
3143
- function pathExists(p) {
3144
- try {
3145
- fs12.statSync(p);
3146
- return true;
3576
+ return fs14.statSync(p).isDirectory();
3147
3577
  } catch {
3148
3578
  return false;
3149
3579
  }
3150
3580
  }
3151
3581
  function isSymlink(p) {
3152
3582
  try {
3153
- return fs12.lstatSync(p).isSymbolicLink();
3583
+ return fs14.lstatSync(p).isSymbolicLink();
3154
3584
  } catch {
3155
3585
  return false;
3156
3586
  }
3157
3587
  }
3158
3588
  function readText(p) {
3159
- return fs12.readFileSync(p, "utf-8");
3589
+ return fs14.readFileSync(p, "utf-8");
3160
3590
  }
3161
3591
  function writeText(p, content) {
3162
- fs12.writeFileSync(p, content, "utf-8");
3163
- }
3164
- function mkdirp(p) {
3165
- fs12.mkdirSync(p, { recursive: true });
3592
+ fs14.writeFileSync(p, content, "utf-8");
3166
3593
  }
3167
3594
  function sortedGlobStems(directory, suffix) {
3168
3595
  let entries;
3169
3596
  try {
3170
- entries = fs12.readdirSync(directory);
3597
+ entries = fs14.readdirSync(directory);
3171
3598
  } catch {
3172
3599
  return [];
3173
3600
  }
@@ -3187,43 +3614,34 @@ function sortedGlobStems(directory, suffix) {
3187
3614
  function countZips(directory) {
3188
3615
  if (!isDir(directory)) return 0;
3189
3616
  let n = 0;
3190
- for (const name of fs12.readdirSync(directory)) {
3617
+ for (const name of fs14.readdirSync(directory)) {
3191
3618
  if (name.endsWith(".zip")) n += 1;
3192
3619
  }
3193
3620
  return n;
3194
3621
  }
3195
- function sha256OfFile(p) {
3196
- let data;
3197
- try {
3198
- data = fs12.readFileSync(p);
3199
- } catch {
3200
- return null;
3201
- }
3202
- return crypto3.createHash("sha256").update(data).digest("hex");
3203
- }
3204
3622
  function atomicWrite0644(target, body, prefix) {
3205
- const dir = path10.dirname(target);
3206
- const tmpName = path10.join(
3623
+ const dir = path12.dirname(target);
3624
+ const tmpName = path12.join(
3207
3625
  dir,
3208
- `${prefix}${process2.pid}.${crypto3.randomBytes(6).toString("hex")}.yml.tmp`
3626
+ `${prefix}${process2.pid}.${crypto5.randomBytes(6).toString("hex")}.yml.tmp`
3209
3627
  );
3210
3628
  let fd = null;
3211
3629
  try {
3212
- fd = fs12.openSync(tmpName, "wx", 420);
3213
- fs12.writeFileSync(fd, body, "utf-8");
3214
- fs12.closeSync(fd);
3630
+ fd = fs14.openSync(tmpName, "wx", 420);
3631
+ fs14.writeFileSync(fd, body, "utf-8");
3632
+ fs14.closeSync(fd);
3215
3633
  fd = null;
3216
- fs12.chmodSync(tmpName, 420);
3217
- fs12.renameSync(tmpName, target);
3634
+ fs14.chmodSync(tmpName, 420);
3635
+ fs14.renameSync(tmpName, target);
3218
3636
  } catch (err) {
3219
3637
  if (fd !== null) {
3220
3638
  try {
3221
- fs12.closeSync(fd);
3639
+ fs14.closeSync(fd);
3222
3640
  } catch {
3223
3641
  }
3224
3642
  }
3225
3643
  try {
3226
- fs12.unlinkSync(tmpName);
3644
+ fs14.unlinkSync(tmpName);
3227
3645
  } catch {
3228
3646
  }
3229
3647
  throw err;
@@ -3234,104 +3652,15 @@ function utcStamp(now) {
3234
3652
  const pad = (n, w = 2) => String(n).padStart(w, "0");
3235
3653
  return `${d.getUTCFullYear()}-${pad(d.getUTCMonth() + 1)}-${pad(d.getUTCDate())}T${pad(d.getUTCHours())}:${pad(d.getUTCMinutes())}:${pad(d.getUTCSeconds())}Z`;
3236
3654
  }
3237
- function _jsonStrNoAscii(s) {
3238
- let out = '"';
3239
- for (const ch of s) {
3240
- const code = ch.codePointAt(0);
3241
- switch (ch) {
3242
- case '"':
3243
- out += '\\"';
3244
- break;
3245
- case "\\":
3246
- out += "\\\\";
3247
- break;
3248
- case "\n":
3249
- out += "\\n";
3250
- break;
3251
- case "\r":
3252
- out += "\\r";
3253
- break;
3254
- case " ":
3255
- out += "\\t";
3256
- break;
3257
- case "\b":
3258
- out += "\\b";
3259
- break;
3260
- case "\f":
3261
- out += "\\f";
3262
- break;
3263
- default:
3264
- if (code < 32) {
3265
- out += "\\u" + code.toString(16).padStart(4, "0");
3266
- } else {
3267
- out += ch;
3268
- }
3269
- }
3270
- }
3271
- return out + '"';
3272
- }
3273
- function _jsonScalar(value) {
3274
- if (value === null || value === void 0) return "null";
3275
- if (typeof value === "boolean") return value ? "true" : "false";
3276
- if (typeof value === "number") {
3277
- if (!Number.isFinite(value)) {
3278
- if (Number.isNaN(value)) return "NaN";
3279
- return value > 0 ? "Infinity" : "-Infinity";
3280
- }
3281
- return String(value);
3282
- }
3283
- if (typeof value === "string") return _jsonStrNoAscii(value);
3284
- return null;
3285
- }
3286
- function _dumpIndent(value, indent, depth) {
3287
- const scalar = _jsonScalar(value);
3288
- if (scalar !== null) return scalar;
3289
- const pad = " ".repeat(indent * (depth + 1));
3290
- const closePad = " ".repeat(indent * depth);
3291
- if (Array.isArray(value)) {
3292
- if (value.length === 0) return "[]";
3293
- const items = value.map((v) => pad + _dumpIndent(v, indent, depth + 1));
3294
- return `[
3295
- ${items.join(",\n")}
3296
- ${closePad}]`;
3297
- }
3298
- if (typeof value === "object" && value !== null) {
3299
- const obj = value;
3300
- const keys = Object.keys(obj);
3301
- if (keys.length === 0) return "{}";
3302
- const items = keys.map(
3303
- (k) => `${pad}${_jsonStrNoAscii(k)}: ${_dumpIndent(obj[k], indent, depth + 1)}`
3304
- );
3305
- return `{
3306
- ${items.join(",\n")}
3307
- ${closePad}}`;
3308
- }
3309
- return _jsonStrNoAscii(String(value));
3310
- }
3311
- function jsonDumpsIndent(value, indent) {
3312
- return _dumpIndent(value, indent, 0);
3313
- }
3314
- function jsonDumpsCompact(value) {
3315
- const scalar = _jsonScalar(value);
3316
- if (scalar !== null) return scalar;
3317
- if (Array.isArray(value)) {
3318
- return "[" + value.map((v) => jsonDumpsCompact(v)).join(",") + "]";
3319
- }
3320
- if (typeof value === "object" && value !== null) {
3321
- const obj = value;
3322
- return "{" + Object.keys(obj).map((k) => `${_jsonStrNoAscii(k)}:${jsonDumpsCompact(obj[k])}`).join(",") + "}";
3323
- }
3324
- return _jsonStrNoAscii(String(value));
3325
- }
3326
3655
  function yamlSafeLoad(text) {
3327
- let YAML;
3656
+ let YAML2;
3328
3657
  try {
3329
- YAML = require_dist();
3658
+ YAML2 = require_dist();
3330
3659
  } catch {
3331
3660
  return null;
3332
3661
  }
3333
3662
  try {
3334
- const data = YAML.parse(text, { version: "1.1" });
3663
+ const data = YAML2.parse(text, { version: "1.1" });
3335
3664
  return data;
3336
3665
  } catch {
3337
3666
  return void 0;
@@ -3347,12 +3676,12 @@ var LEGACY_SETTINGS_FILE = ".agent-settings";
3347
3676
  var LEGACY_BACKUP_FILE = ".agent-settings.backup.key-value";
3348
3677
  var SETTINGS_SUBDIR = ["agents", "settings"];
3349
3678
  function _canonical_settings_target(project_root) {
3350
- return path10.join(project_root, ...SETTINGS_SUBDIR, SETTINGS_FILE);
3679
+ return path12.join(project_root, ...SETTINGS_SUBDIR, SETTINGS_FILE);
3351
3680
  }
3352
3681
  function _resolve_settings_read(project_root) {
3353
3682
  const canonical = _canonical_settings_target(project_root);
3354
3683
  if (pathExists(canonical)) return canonical;
3355
- const legacy = path10.join(project_root, SETTINGS_FILE);
3684
+ const legacy = path12.join(project_root, SETTINGS_FILE);
3356
3685
  if (pathExists(legacy)) return legacy;
3357
3686
  return canonical;
3358
3687
  }
@@ -3387,6 +3716,8 @@ function _emit_progress_terminal(rc) {
3387
3716
  if (!state.PROGRESS_NDJSON) return;
3388
3717
  if (rc === 0) {
3389
3718
  _emit_progress({ type: "done" });
3719
+ } else if (rc === EXIT_COMPLETED_WITH_CONFLICTS) {
3720
+ _emit_progress({ type: "done", conflicts: tracker.conflictState.preserved.length });
3390
3721
  } else {
3391
3722
  _emit_progress({ type: "error", code: "E_INSTALL", exitCode: rc });
3392
3723
  }
@@ -3416,9 +3747,9 @@ function fail(msg) {
3416
3747
  throw new SystemExitError(1);
3417
3748
  }
3418
3749
  function detect_package_root(project_root) {
3419
- const npm_path = path10.join(project_root, "node_modules", "@event4u", "agent-config");
3750
+ const npm_path = path12.join(project_root, "node_modules", "@event4u", "agent-config");
3420
3751
  if (isDir(npm_path)) return resolvePath(npm_path);
3421
- if (pathExists(path10.join(project_root, "src", "config", "profiles", "minimal.ini"))) {
3752
+ if (pathExists(path12.join(project_root, "src", "config", "profiles", "minimal.ini"))) {
3422
3753
  return project_root;
3423
3754
  }
3424
3755
  fail(
@@ -3426,12 +3757,12 @@ function detect_package_root(project_root) {
3426
3757
  );
3427
3758
  }
3428
3759
  function detect_package_type(package_root) {
3429
- if (package_root.split(path10.sep).includes("node_modules")) return "npm";
3760
+ if (package_root.split(path12.sep).includes("node_modules")) return "npm";
3430
3761
  return "local";
3431
3762
  }
3432
3763
  function detect_package_type_for_project(project_root, package_root) {
3433
3764
  const npm_path = resolvePath(
3434
- path10.join(project_root, "node_modules", "@event4u", "agent-config")
3765
+ path12.join(project_root, "node_modules", "@event4u", "agent-config")
3435
3766
  );
3436
3767
  const package_resolved = resolvePath(package_root);
3437
3768
  if (package_resolved === npm_path) return "npm";
@@ -3444,14 +3775,18 @@ function _is_interactive() {
3444
3775
  return false;
3445
3776
  }
3446
3777
  }
3447
- function _resolve_file_conflict(_target, _force_hint) {
3448
- return "write";
3449
- }
3778
+ var tracker = createConflictTracker({
3779
+ warn,
3780
+ fail,
3781
+ logWrite: (target) => _log_tx_entry("write", target),
3782
+ emitProgress: (frame) => _emit_progress(frame),
3783
+ tagDeployed: (target, source, package_root) => _inject_package_tag(target, source, package_root)
3784
+ });
3450
3785
  function ensure_directory(p) {
3451
3786
  mkdirp(p);
3452
3787
  }
3453
3788
  function write_file(p, content) {
3454
- ensure_directory(path10.dirname(p));
3789
+ ensure_directory(path12.dirname(p));
3455
3790
  writeText(p, content);
3456
3791
  }
3457
3792
  function read_json_file(p) {
@@ -3622,7 +3957,7 @@ function _append_unknown_legacy(rendered, legacy_values, unknown_keys) {
3622
3957
  return rendered + "\n" + suffix;
3623
3958
  }
3624
3959
  function _migrate_legacy_if_present(project_root, template_body) {
3625
- const legacy_target = path10.join(project_root, LEGACY_SETTINGS_FILE);
3960
+ const legacy_target = path12.join(project_root, LEGACY_SETTINGS_FILE);
3626
3961
  if (!isFile(legacy_target)) return null;
3627
3962
  const legacy_text = readText(legacy_target);
3628
3963
  const [values, unknown] = _parse_legacy_settings(legacy_text);
@@ -3637,9 +3972,9 @@ function _migrate_legacy_if_present(project_root, template_body) {
3637
3972
  }
3638
3973
  }
3639
3974
  rendered = _append_unknown_legacy(rendered, values, unknown);
3640
- const backup_target = path10.join(project_root, LEGACY_BACKUP_FILE);
3975
+ const backup_target = path12.join(project_root, LEGACY_BACKUP_FILE);
3641
3976
  writeText(backup_target, legacy_text);
3642
- fs12.unlinkSync(legacy_target);
3977
+ fs14.unlinkSync(legacy_target);
3643
3978
  info(`Migrated legacy ${LEGACY_SETTINGS_FILE} \u2192 ${SETTINGS_FILE}`);
3644
3979
  info(`Backup saved to ${LEGACY_BACKUP_FILE}`);
3645
3980
  if (unknown.length > 0) {
@@ -3674,7 +4009,7 @@ function _render_template(template, profile_values) {
3674
4009
  return body;
3675
4010
  }
3676
4011
  function _load_valid_user_types(package_root) {
3677
- const directory = path10.join(package_root, USER_TYPES_DIR);
4012
+ const directory = path12.join(package_root, USER_TYPES_DIR);
3678
4013
  if (!isDir(directory)) return [];
3679
4014
  return sortedGlobStems(directory, ".yml");
3680
4015
  }
@@ -3731,8 +4066,8 @@ function splitlinesKeepends(text) {
3731
4066
  }
3732
4067
  function ensure_agent_settings(project_root, package_root, profile, force, user_type = "", packs = null) {
3733
4068
  const target = _canonical_settings_target(project_root);
3734
- const profile_source = path10.join(package_root, "src", "config", "profiles", `${profile}.ini`);
3735
- const template_source = path10.join(package_root, "src", "config", "agent-settings.template.yml");
4069
+ const profile_source = path12.join(package_root, "src", "config", "profiles", `${profile}.ini`);
4070
+ const template_source = path12.join(package_root, "src", "config", "agent-settings.template.yml");
3736
4071
  if (!pathExists(profile_source)) fail(`Missing profile preset: ${profile_source}`);
3737
4072
  if (!pathExists(template_source)) fail(`Missing settings template: ${template_source}`);
3738
4073
  const template = readText(template_source);
@@ -3746,21 +4081,21 @@ function ensure_agent_settings(project_root, package_root, profile, force, user_
3746
4081
  if (profile_values["rule_loading_tier"] !== profile) {
3747
4082
  const got = "rule_loading_tier" in profile_values ? `'${profile_values["rule_loading_tier"]}'` : "None";
3748
4083
  fail(
3749
- `Profile preset ${path10.basename(profile_source)} has rule_loading_tier=${got} but --profile=${profile}`
4084
+ `Profile preset ${path12.basename(profile_source)} has rule_loading_tier=${got} but --profile=${profile}`
3750
4085
  );
3751
4086
  }
3752
4087
  profile_values["user_type"] = _validate_user_type(package_root, user_type);
3753
4088
  let template_body = _render_template(template, profile_values);
3754
4089
  template_body = _inject_packs(template_body, packs ?? []);
3755
- const legacy_root = path10.join(project_root, SETTINGS_FILE);
4090
+ const legacy_root = path12.join(project_root, SETTINGS_FILE);
3756
4091
  if (isFile(legacy_root) && !pathExists(target)) {
3757
- mkdirp(path10.dirname(target));
4092
+ mkdirp(path12.dirname(target));
3758
4093
  writeText(target, readText(legacy_root));
3759
- fs12.unlinkSync(legacy_root);
4094
+ fs14.unlinkSync(legacy_root);
3760
4095
  success(`Migrated ${SETTINGS_FILE} \u2192 agents/settings/${SETTINGS_FILE} (ADR-038)`);
3761
4096
  return;
3762
4097
  }
3763
- const legacy_target = path10.join(project_root, LEGACY_SETTINGS_FILE);
4098
+ const legacy_target = path12.join(project_root, LEGACY_SETTINGS_FILE);
3764
4099
  if (isFile(legacy_target) && pathExists(target)) {
3765
4100
  warn(
3766
4101
  `Both ${SETTINGS_FILE} and legacy ${LEGACY_SETTINGS_FILE} exist. Skipping migration to avoid overwriting ${SETTINGS_FILE}. Delete one of them manually and re-run.`
@@ -3777,7 +4112,7 @@ function ensure_agent_settings(project_root, package_root, profile, force, user_
3777
4112
  skip(`${SETTINGS_FILE} already exists`);
3778
4113
  return;
3779
4114
  }
3780
- mkdirp(path10.dirname(target));
4115
+ mkdirp(path12.dirname(target));
3781
4116
  write_file(target, template_body);
3782
4117
  const user_type_value = profile_values["user_type"] ?? "";
3783
4118
  const suffix = user_type_value ? `, user_type=${user_type_value}` : "";
@@ -3790,7 +4125,7 @@ function ensure_vscode_bridge(project_root, package_type, force) {
3790
4125
  const plugin_path = plugin_paths[package_type] ?? "./plugin/agent-config";
3791
4126
  const bridge = { "chat.pluginLocations": { [plugin_path]: true } };
3792
4127
  return merge_json_file(
3793
- path10.join(project_root, ".vscode", "settings.json"),
4128
+ path12.join(project_root, ".vscode", "settings.json"),
3794
4129
  bridge,
3795
4130
  force,
3796
4131
  ".vscode/settings.json"
@@ -3799,14 +4134,14 @@ function ensure_vscode_bridge(project_root, package_type, force) {
3799
4134
  function ensure_augment_bridge(project_root, force) {
3800
4135
  const bridge = { enabledPlugins: { "agent-config@event4u": true } };
3801
4136
  return merge_json_file(
3802
- path10.join(project_root, ".augment", "settings.json"),
4137
+ path12.join(project_root, ".augment", "settings.json"),
3803
4138
  bridge,
3804
4139
  force,
3805
4140
  ".augment/settings.json"
3806
4141
  );
3807
4142
  }
3808
- var AUGMENT_USER_DIR = path10.join(os3.homedir(), ".augment");
3809
- var AUGMENT_USER_HOOKS_DIR = path10.join(AUGMENT_USER_DIR, "hooks");
4143
+ var AUGMENT_USER_DIR = path12.join(os3.homedir(), ".augment");
4144
+ var AUGMENT_USER_HOOKS_DIR = path12.join(AUGMENT_USER_DIR, "hooks");
3810
4145
  var AUGMENT_DISPATCHER_TRAMPOLINE = "augment-dispatcher.sh";
3811
4146
  var AUGMENT_LEGACY_TRAMPOLINES = [
3812
4147
  "augment-chat-history.sh",
@@ -3815,29 +4150,29 @@ var AUGMENT_LEGACY_TRAMPOLINES = [
3815
4150
  "augment-context-hygiene.sh"
3816
4151
  ];
3817
4152
  function _deploy_augment_trampoline(package_root, name, force) {
3818
- const src = path10.join(package_root, "scripts", "hooks", name);
4153
+ const src = path12.join(package_root, "scripts", "hooks", name);
3819
4154
  if (!pathExists(src)) {
3820
4155
  skip(`augment trampoline missing in package: ${src}`);
3821
4156
  return null;
3822
4157
  }
3823
4158
  mkdirp(AUGMENT_USER_HOOKS_DIR);
3824
- const dst = path10.join(AUGMENT_USER_HOOKS_DIR, name);
4159
+ const dst = path12.join(AUGMENT_USER_HOOKS_DIR, name);
3825
4160
  const src_text = readText(src);
3826
4161
  if (pathExists(dst) && readText(dst) === src_text && !force) {
3827
4162
  skip(`~/.augment/hooks/${name} already up to date`);
3828
4163
  } else {
3829
4164
  writeText(dst, src_text);
3830
- fs12.chmodSync(dst, 493);
4165
+ fs14.chmodSync(dst, 493);
3831
4166
  success(`~/.augment/hooks/${name} installed`);
3832
4167
  }
3833
4168
  return dst;
3834
4169
  }
3835
4170
  function _remove_legacy_augment_trampolines() {
3836
4171
  for (const name of AUGMENT_LEGACY_TRAMPOLINES) {
3837
- const legacy = path10.join(AUGMENT_USER_HOOKS_DIR, name);
4172
+ const legacy = path12.join(AUGMENT_USER_HOOKS_DIR, name);
3838
4173
  try {
3839
4174
  if (isFile(legacy)) {
3840
- fs12.unlinkSync(legacy);
4175
+ fs14.unlinkSync(legacy);
3841
4176
  skip(`removed legacy ~/.augment/hooks/${name}`);
3842
4177
  }
3843
4178
  } catch (err) {
@@ -3857,7 +4192,7 @@ function ensure_augment_user_hooks(package_root, force) {
3857
4192
  }
3858
4193
  const settings_patch = { hooks: per_event };
3859
4194
  return merge_json_file(
3860
- path10.join(AUGMENT_USER_DIR, "settings.json"),
4195
+ path12.join(AUGMENT_USER_DIR, "settings.json"),
3861
4196
  settings_patch,
3862
4197
  force,
3863
4198
  "~/.augment/settings.json"
@@ -3882,7 +4217,7 @@ function _heal_legacy_claude_plugin_ids(p) {
3882
4217
  return removed;
3883
4218
  }
3884
4219
  function ensure_claude_bridge(project_root, force) {
3885
- const target = path10.join(project_root, ".claude", "settings.json");
4220
+ const target = path12.join(project_root, ".claude", "settings.json");
3886
4221
  const healed = _heal_legacy_claude_plugin_ids(target);
3887
4222
  for (const pid of healed) {
3888
4223
  success(`.claude/settings.json: removed stale plugin id \`${pid}\``);
@@ -3902,29 +4237,29 @@ function ensure_cursor_bridge(project_root, force) {
3902
4237
  }
3903
4238
  const bridge = { version: 1, hooks };
3904
4239
  return merge_json_file(
3905
- path10.join(project_root, ".cursor", "hooks.json"),
4240
+ path12.join(project_root, ".cursor", "hooks.json"),
3906
4241
  bridge,
3907
4242
  force,
3908
4243
  ".cursor/hooks.json"
3909
4244
  );
3910
4245
  }
3911
- var CURSOR_USER_DIR = path10.join(os3.homedir(), ".cursor");
3912
- var CURSOR_USER_HOOKS_DIR = path10.join(CURSOR_USER_DIR, "hooks");
4246
+ var CURSOR_USER_DIR = path12.join(os3.homedir(), ".cursor");
4247
+ var CURSOR_USER_HOOKS_DIR = path12.join(CURSOR_USER_DIR, "hooks");
3913
4248
  var CURSOR_DISPATCHER_TRAMPOLINE = "cursor-dispatcher.sh";
3914
4249
  function ensure_cursor_user_hooks(package_root, force) {
3915
- const src = path10.join(package_root, "scripts", "hooks", CURSOR_DISPATCHER_TRAMPOLINE);
4250
+ const src = path12.join(package_root, "scripts", "hooks", CURSOR_DISPATCHER_TRAMPOLINE);
3916
4251
  if (!pathExists(src)) {
3917
4252
  skip(`cursor trampoline missing in package: ${src}`);
3918
4253
  return [];
3919
4254
  }
3920
4255
  mkdirp(CURSOR_USER_HOOKS_DIR);
3921
- const dst = path10.join(CURSOR_USER_HOOKS_DIR, CURSOR_DISPATCHER_TRAMPOLINE);
4256
+ const dst = path12.join(CURSOR_USER_HOOKS_DIR, CURSOR_DISPATCHER_TRAMPOLINE);
3922
4257
  const src_text = readText(src);
3923
4258
  if (pathExists(dst) && readText(dst) === src_text && !force) {
3924
4259
  skip(`~/.cursor/hooks/${CURSOR_DISPATCHER_TRAMPOLINE} already up to date`);
3925
4260
  } else {
3926
4261
  writeText(dst, src_text);
3927
- fs12.chmodSync(dst, 493);
4262
+ fs14.chmodSync(dst, 493);
3928
4263
  success(`~/.cursor/hooks/${CURSOR_DISPATCHER_TRAMPOLINE} installed`);
3929
4264
  }
3930
4265
  const hooks = {};
@@ -3933,7 +4268,7 @@ function ensure_cursor_user_hooks(package_root, force) {
3933
4268
  }
3934
4269
  const settings_patch = { version: 1, hooks };
3935
4270
  return merge_json_file(
3936
- path10.join(CURSOR_USER_DIR, "hooks.json"),
4271
+ path12.join(CURSOR_USER_DIR, "hooks.json"),
3937
4272
  settings_patch,
3938
4273
  force,
3939
4274
  "~/.cursor/hooks.json"
@@ -3968,12 +4303,12 @@ exit 0
3968
4303
  `;
3969
4304
  }
3970
4305
  function ensure_cline_bridge(project_root, force) {
3971
- const hooks_dir = path10.join(project_root, ".clinerules", "hooks");
4306
+ const hooks_dir = path12.join(project_root, ".clinerules", "hooks");
3972
4307
  mkdirp(hooks_dir);
3973
4308
  const workspace_quoted = shlexQuote(resolvePath(project_root));
3974
4309
  let written = 0;
3975
4310
  for (const { slot, native } of hostBindings("cline")) {
3976
- const target = path10.join(hooks_dir, native);
4311
+ const target = path12.join(hooks_dir, native);
3977
4312
  const body = clineProjectHookBody(native, slot, workspace_quoted);
3978
4313
  if (pathExists(target) && readText(target) === body && !force) {
3979
4314
  continue;
@@ -3983,7 +4318,7 @@ function ensure_cline_bridge(project_root, force) {
3983
4318
  continue;
3984
4319
  }
3985
4320
  writeText(target, body);
3986
- fs12.chmodSync(target, 493);
4321
+ fs14.chmodSync(target, 493);
3987
4322
  written += 1;
3988
4323
  }
3989
4324
  if (written) {
@@ -3992,27 +4327,27 @@ function ensure_cline_bridge(project_root, force) {
3992
4327
  skip(".clinerules/hooks/ already up to date");
3993
4328
  }
3994
4329
  }
3995
- var CLINE_USER_DIR = path10.join(os3.homedir(), "Documents", "Cline", "Hooks");
4330
+ var CLINE_USER_DIR = path12.join(os3.homedir(), "Documents", "Cline", "Hooks");
3996
4331
  var CLINE_DISPATCHER_TRAMPOLINE = "cline-dispatcher.sh";
3997
4332
  function ensure_cline_user_hooks(package_root, force) {
3998
- const src = path10.join(package_root, "scripts", "hooks", CLINE_DISPATCHER_TRAMPOLINE);
4333
+ const src = path12.join(package_root, "scripts", "hooks", CLINE_DISPATCHER_TRAMPOLINE);
3999
4334
  if (!pathExists(src)) {
4000
4335
  skip(`cline trampoline missing in package: ${src}`);
4001
4336
  return;
4002
4337
  }
4003
4338
  mkdirp(CLINE_USER_DIR);
4004
- const trampoline = path10.join(CLINE_USER_DIR, CLINE_DISPATCHER_TRAMPOLINE);
4339
+ const trampoline = path12.join(CLINE_USER_DIR, CLINE_DISPATCHER_TRAMPOLINE);
4005
4340
  const src_text = readText(src);
4006
4341
  if (pathExists(trampoline) && readText(trampoline) === src_text && !force) {
4007
4342
  skip(`~/Documents/Cline/Hooks/${CLINE_DISPATCHER_TRAMPOLINE} already up to date`);
4008
4343
  } else {
4009
4344
  writeText(trampoline, src_text);
4010
- fs12.chmodSync(trampoline, 493);
4345
+ fs14.chmodSync(trampoline, 493);
4011
4346
  success(`~/Documents/Cline/Hooks/${CLINE_DISPATCHER_TRAMPOLINE} installed`);
4012
4347
  }
4013
4348
  const trampoline_quoted = shlexQuote(trampoline);
4014
4349
  for (const { slot, native } of hostBindings("cline")) {
4015
- const wrapper = path10.join(CLINE_USER_DIR, native);
4350
+ const wrapper = path12.join(CLINE_USER_DIR, native);
4016
4351
  const body = `#!/usr/bin/env bash
4017
4352
  # Generated by event4u/agent-config \u2014 DO NOT EDIT.
4018
4353
  # User-scope Cline hook for ${native} \u2192 agent-config ${slot}.
@@ -4022,7 +4357,7 @@ exec ${trampoline_quoted} ${slot} ${native}
4022
4357
  continue;
4023
4358
  }
4024
4359
  writeText(wrapper, body);
4025
- fs12.chmodSync(wrapper, 493);
4360
+ fs14.chmodSync(wrapper, 493);
4026
4361
  }
4027
4362
  }
4028
4363
  function _windsurf_dispatch_command(ac_event, native) {
@@ -4038,29 +4373,29 @@ function ensure_windsurf_bridge(project_root, force) {
4038
4373
  }
4039
4374
  const bridge = { hooks };
4040
4375
  return merge_json_file(
4041
- path10.join(project_root, ".windsurf", "hooks.json"),
4376
+ path12.join(project_root, ".windsurf", "hooks.json"),
4042
4377
  bridge,
4043
4378
  force,
4044
4379
  ".windsurf/hooks.json"
4045
4380
  );
4046
4381
  }
4047
- var WINDSURF_USER_DIR = path10.join(os3.homedir(), ".codeium", "windsurf");
4048
- var WINDSURF_USER_HOOKS_DIR = path10.join(WINDSURF_USER_DIR, "hooks");
4382
+ var WINDSURF_USER_DIR = path12.join(os3.homedir(), ".codeium", "windsurf");
4383
+ var WINDSURF_USER_HOOKS_DIR = path12.join(WINDSURF_USER_DIR, "hooks");
4049
4384
  var WINDSURF_DISPATCHER_TRAMPOLINE = "windsurf-dispatcher.sh";
4050
4385
  function ensure_windsurf_user_hooks(package_root, force) {
4051
- const src = path10.join(package_root, "scripts", "hooks", WINDSURF_DISPATCHER_TRAMPOLINE);
4386
+ const src = path12.join(package_root, "scripts", "hooks", WINDSURF_DISPATCHER_TRAMPOLINE);
4052
4387
  if (!pathExists(src)) {
4053
4388
  skip(`windsurf trampoline missing in package: ${src}`);
4054
4389
  return [];
4055
4390
  }
4056
4391
  mkdirp(WINDSURF_USER_HOOKS_DIR);
4057
- const dst = path10.join(WINDSURF_USER_HOOKS_DIR, WINDSURF_DISPATCHER_TRAMPOLINE);
4392
+ const dst = path12.join(WINDSURF_USER_HOOKS_DIR, WINDSURF_DISPATCHER_TRAMPOLINE);
4058
4393
  const src_text = readText(src);
4059
4394
  if (pathExists(dst) && readText(dst) === src_text && !force) {
4060
4395
  skip(`~/.codeium/windsurf/hooks/${WINDSURF_DISPATCHER_TRAMPOLINE} already up to date`);
4061
4396
  } else {
4062
4397
  writeText(dst, src_text);
4063
- fs12.chmodSync(dst, 493);
4398
+ fs14.chmodSync(dst, 493);
4064
4399
  success(`~/.codeium/windsurf/hooks/${WINDSURF_DISPATCHER_TRAMPOLINE} installed`);
4065
4400
  }
4066
4401
  const hooks = {};
@@ -4072,7 +4407,7 @@ function ensure_windsurf_user_hooks(package_root, force) {
4072
4407
  }
4073
4408
  const settings_patch = { hooks };
4074
4409
  return merge_json_file(
4075
- path10.join(WINDSURF_USER_DIR, "hooks.json"),
4410
+ path12.join(WINDSURF_USER_DIR, "hooks.json"),
4076
4411
  settings_patch,
4077
4412
  force,
4078
4413
  "~/.codeium/windsurf/hooks.json"
@@ -4094,43 +4429,43 @@ function _gemini_hooks_dict(command_factory) {
4094
4429
  function ensure_gemini_bridge(project_root, force) {
4095
4430
  const bridge = { hooks: _gemini_hooks_dict(_gemini_dispatch_command) };
4096
4431
  return merge_json_file(
4097
- path10.join(project_root, ".gemini", "settings.json"),
4432
+ path12.join(project_root, ".gemini", "settings.json"),
4098
4433
  bridge,
4099
4434
  force,
4100
4435
  ".gemini/settings.json"
4101
4436
  );
4102
4437
  }
4103
- var GEMINI_USER_DIR = path10.join(os3.homedir(), ".gemini");
4104
- var GEMINI_USER_HOOKS_DIR = path10.join(GEMINI_USER_DIR, "hooks");
4438
+ var GEMINI_USER_DIR = path12.join(os3.homedir(), ".gemini");
4439
+ var GEMINI_USER_HOOKS_DIR = path12.join(GEMINI_USER_DIR, "hooks");
4105
4440
  var GEMINI_DISPATCHER_TRAMPOLINE = "gemini-dispatcher.sh";
4106
4441
  function ensure_gemini_user_hooks(package_root, force) {
4107
- const src = path10.join(package_root, "scripts", "hooks", GEMINI_DISPATCHER_TRAMPOLINE);
4442
+ const src = path12.join(package_root, "scripts", "hooks", GEMINI_DISPATCHER_TRAMPOLINE);
4108
4443
  if (!pathExists(src)) {
4109
4444
  skip(`gemini trampoline missing in package: ${src}`);
4110
4445
  return [];
4111
4446
  }
4112
4447
  mkdirp(GEMINI_USER_HOOKS_DIR);
4113
- const dst = path10.join(GEMINI_USER_HOOKS_DIR, GEMINI_DISPATCHER_TRAMPOLINE);
4448
+ const dst = path12.join(GEMINI_USER_HOOKS_DIR, GEMINI_DISPATCHER_TRAMPOLINE);
4114
4449
  const src_text = readText(src);
4115
4450
  if (pathExists(dst) && readText(dst) === src_text && !force) {
4116
4451
  skip(`~/.gemini/hooks/${GEMINI_DISPATCHER_TRAMPOLINE} already up to date`);
4117
4452
  } else {
4118
4453
  writeText(dst, src_text);
4119
- fs12.chmodSync(dst, 493);
4454
+ fs14.chmodSync(dst, 493);
4120
4455
  success(`~/.gemini/hooks/${GEMINI_DISPATCHER_TRAMPOLINE} installed`);
4121
4456
  }
4122
4457
  const settings_patch = {
4123
4458
  hooks: _gemini_hooks_dict((ac_event, native) => `${dst} ${ac_event} ${native}`)
4124
4459
  };
4125
4460
  return merge_json_file(
4126
- path10.join(GEMINI_USER_DIR, "settings.json"),
4461
+ path12.join(GEMINI_USER_DIR, "settings.json"),
4127
4462
  settings_patch,
4128
4463
  force,
4129
4464
  "~/.gemini/settings.json"
4130
4465
  );
4131
4466
  }
4132
4467
  function ensure_copilot_bridge(project_root, force) {
4133
- const target = path10.join(project_root, ".github", "plugin", "marketplace.json");
4468
+ const target = path12.join(project_root, ".github", "plugin", "marketplace.json");
4134
4469
  const bridge = {
4135
4470
  marketplace: {
4136
4471
  name: "event4u-agent-marketplace",
@@ -4173,7 +4508,7 @@ See \`docs/setup/per-ide/roocode.md\` for the full activation guide.
4173
4508
  Run \`./agent-config --help\` for available commands.
4174
4509
  `;
4175
4510
  function ensure_roocode_bridge(project_root, force) {
4176
- const target = path10.join(project_root, ".roo", "rules", "agent-config.md");
4511
+ const target = path12.join(project_root, ".roo", "rules", "agent-config.md");
4177
4512
  if (pathExists(target) && !force) {
4178
4513
  skip(".roo/rules/agent-config.md already exists");
4179
4514
  return;
@@ -4195,7 +4530,7 @@ To wire Claude Desktop to this project's rules, run:
4195
4530
  Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
4196
4531
  `;
4197
4532
  function ensure_claude_desktop_bridge(project_root, force) {
4198
- const target = path10.join(project_root, ".claude-desktop", "agent-config.md");
4533
+ const target = path12.join(project_root, ".claude-desktop", "agent-config.md");
4199
4534
  if (pathExists(target) && !force) {
4200
4535
  skip(".claude-desktop/agent-config.md already exists");
4201
4536
  return;
@@ -4220,7 +4555,7 @@ Or pass \`--read .aider/agent-config.md\` on the command line.
4220
4555
  Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
4221
4556
  `;
4222
4557
  function ensure_aider_bridge(project_root, force) {
4223
- const target = path10.join(project_root, ".aider", "agent-config.md");
4558
+ const target = path12.join(project_root, ".aider", "agent-config.md");
4224
4559
  if (pathExists(target) && !force) {
4225
4560
  skip(".aider/agent-config.md already exists");
4226
4561
  return;
@@ -4239,7 +4574,7 @@ developers where the rules and skills live.
4239
4574
  Canonical rule and skill source: \`.augment/\` (see project \`AGENTS.md\`).
4240
4575
  `;
4241
4576
  function ensure_codex_bridge(project_root, force) {
4242
- const target = path10.join(project_root, ".codex", "agent-config.md");
4577
+ const target = path12.join(project_root, ".codex", "agent-config.md");
4243
4578
  if (pathExists(target) && !force) {
4244
4579
  skip(".codex/agent-config.md already exists");
4245
4580
  return;
@@ -4257,7 +4592,7 @@ rules per session. The canonical rule and skill source lives under
4257
4592
  orientation).
4258
4593
  `;
4259
4594
  function ensure_continue_bridge(project_root, force) {
4260
- const target = path10.join(project_root, ".continue", "rules", "agent-config.md");
4595
+ const target = path12.join(project_root, ".continue", "rules", "agent-config.md");
4261
4596
  if (pathExists(target) && !force) {
4262
4597
  skip(".continue/rules/agent-config.md already exists");
4263
4598
  return;
@@ -4288,7 +4623,7 @@ orientation).
4288
4623
  See \`docs/setup/per-ide/kilocode.md\` for the full activation guide.
4289
4624
  `;
4290
4625
  function ensure_kilocode_bridge(project_root, force) {
4291
- const target = path10.join(project_root, ".kilocode", "rules", "agent-config.md");
4626
+ const target = path12.join(project_root, ".kilocode", "rules", "agent-config.md");
4292
4627
  if (pathExists(target) && !force) {
4293
4628
  skip(".kilocode/rules/agent-config.md already exists");
4294
4629
  return;
@@ -4315,7 +4650,7 @@ canonical source (or symlink it):
4315
4650
  Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
4316
4651
  `;
4317
4652
  function ensure_zed_bridge(project_root, force) {
4318
- const target = path10.join(project_root, ".zed", "agent-config.md");
4653
+ const target = path12.join(project_root, ".zed", "agent-config.md");
4319
4654
  if (pathExists(target) && !force) {
4320
4655
  skip(".zed/agent-config.md already exists");
4321
4656
  return;
@@ -4336,7 +4671,7 @@ rules into your JetBrains profile.
4336
4671
  Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
4337
4672
  `;
4338
4673
  function ensure_jetbrains_bridge(project_root, force) {
4339
- const target = path10.join(project_root, ".jetbrains", "agent-config.md");
4674
+ const target = path12.join(project_root, ".jetbrains", "agent-config.md");
4340
4675
  if (pathExists(target) && !force) {
4341
4676
  skip(".jetbrains/agent-config.md already exists");
4342
4677
  return;
@@ -4367,7 +4702,7 @@ session. The canonical rule and skill source lives under \`.augment/\`
4367
4702
  See \`docs/setup/per-ide/kiro.md\` for the full activation guide.
4368
4703
  `;
4369
4704
  function ensure_kiro_bridge(project_root, force) {
4370
- const target = path10.join(project_root, ".kiro", "steering", "agent-config.md");
4705
+ const target = path12.join(project_root, ".kiro", "steering", "agent-config.md");
4371
4706
  if (pathExists(target) && !force) {
4372
4707
  skip(".kiro/steering/agent-config.md already exists");
4373
4708
  return;
@@ -4404,35 +4739,35 @@ var SMOKE_BRIDGE_PATHS = {
4404
4739
  };
4405
4740
  function dirHasEntries(p) {
4406
4741
  try {
4407
- return fs12.readdirSync(p).length > 0;
4742
+ return fs14.readdirSync(p).length > 0;
4408
4743
  } catch {
4409
4744
  return false;
4410
4745
  }
4411
4746
  }
4412
4747
  function _resolve_tsx_invocation(scriptPath, scriptArgs) {
4413
4748
  const binName = process2.platform === "win32" ? "tsx.cmd" : "tsx";
4414
- let dir = path10.dirname(scriptPath);
4749
+ let dir = path12.dirname(scriptPath);
4415
4750
  for (; ; ) {
4416
- const candidate = path10.join(dir, "node_modules", ".bin", binName);
4751
+ const candidate = path12.join(dir, "node_modules", ".bin", binName);
4417
4752
  if (isFile(candidate)) {
4418
4753
  return { command: candidate, args: [scriptPath, ...scriptArgs] };
4419
4754
  }
4420
- const parent = path10.dirname(dir);
4755
+ const parent = path12.dirname(dir);
4421
4756
  if (parent === dir) break;
4422
4757
  dir = parent;
4423
4758
  }
4424
4759
  return { command: "npx", args: ["tsx", scriptPath, ...scriptArgs] };
4425
4760
  }
4426
4761
  function _smoke_test_hooks(project_root, package_root) {
4427
- const dispatcher = path10.join(package_root, "scripts", "hooks", "dispatch_hook.ts");
4428
- const manifest = path10.join(package_root, "scripts", "hook_manifest.yaml");
4762
+ const dispatcher = path12.join(package_root, "scripts", "hooks", "dispatch_hook.ts");
4763
+ const manifest = path12.join(package_root, "scripts", "hook_manifest.yaml");
4429
4764
  if (!isFile(dispatcher) || !isFile(manifest)) return 0;
4430
4765
  const failed = [];
4431
4766
  const skipped = [];
4432
4767
  const passed = [];
4433
4768
  for (const [platform, native] of smokeProbeEvents()) {
4434
4769
  const rel_bridge = SMOKE_BRIDGE_PATHS[platform] ?? "";
4435
- const bridge_path = rel_bridge ? path10.join(project_root, rel_bridge) : null;
4770
+ const bridge_path = rel_bridge ? path12.join(project_root, rel_bridge) : null;
4436
4771
  const bridge_present = Boolean(
4437
4772
  bridge_path && (isFile(bridge_path) || isDir(bridge_path) && dirHasEntries(bridge_path))
4438
4773
  );
@@ -4632,9 +4967,9 @@ To remove this marker, delete this file.
4632
4967
  `;
4633
4968
  }
4634
4969
  var _CLAUDE_DESKTOP_BUNDLES_SUBPATH = "claude-desktop/bundles";
4635
- var GLOBAL_ROOT = path10.join(os3.homedir(), ".event4u", "agent-config");
4636
- var GLOBAL_USER_SETTINGS_PATH = path10.join(GLOBAL_ROOT, ".agent-user.yml");
4637
- var GLOBAL_AGENT_SETTINGS_PATH = path10.join(GLOBAL_ROOT, ".agent-settings.yml");
4970
+ var GLOBAL_ROOT = path12.join(os3.homedir(), ".event4u", "agent-config");
4971
+ var GLOBAL_USER_SETTINGS_PATH = path12.join(GLOBAL_ROOT, ".agent-user.yml");
4972
+ var GLOBAL_AGENT_SETTINGS_PATH = path12.join(GLOBAL_ROOT, ".agent-settings.yml");
4638
4973
  function _bridge_marker(tool_id, scope) {
4639
4974
  if (scope === "global") return USER_SCOPE_PATHS[tool_id] ?? "";
4640
4975
  return PROJECT_BRIDGE_MARKERS[tool_id] ?? "";
@@ -4683,7 +5018,7 @@ function _load_yaml_doc(p) {
4683
5018
  return _isPlainObject(data) ? data : {};
4684
5019
  }
4685
5020
  function _load_default_settings(package_root) {
4686
- const template_source = path10.join(package_root, "src", "config", "agent-settings.template.yml");
5021
+ const template_source = path12.join(package_root, "src", "config", "agent-settings.template.yml");
4687
5022
  if (!pathExists(template_source)) return {};
4688
5023
  let text;
4689
5024
  try {
@@ -4697,11 +5032,11 @@ function _load_default_settings(package_root) {
4697
5032
  }
4698
5033
  var RULE_LAYER_CHOICES = ["global", "project", "both-acknowledged"];
4699
5034
  function _suppress_rule_layer(project_root, suppress_dir) {
4700
- const target = path10.join(project_root, ".claude", "settings.local.json");
5035
+ const target = path12.join(project_root, ".claude", "settings.local.json");
4701
5036
  const existing = pathExists(target) ? read_json_file(target) : {};
4702
5037
  let real_dir = suppress_dir;
4703
5038
  try {
4704
- real_dir = fs12.realpathSync(suppress_dir);
5039
+ real_dir = fs14.realpathSync(suppress_dir);
4705
5040
  } catch {
4706
5041
  real_dir = suppress_dir;
4707
5042
  }
@@ -4712,8 +5047,8 @@ function _suppress_rule_layer(project_root, suppress_dir) {
4712
5047
  success(`.claude/settings.local.json: claudeMdExcludes += ${entry}`);
4713
5048
  }
4714
5049
  function _gate_rule_layer_overlap(project_root, layer, dry_run) {
4715
- const global_dir = path10.join(os3.homedir(), ".claude", "rules");
4716
- const project_dir = path10.join(project_root, ".claude", "rules");
5050
+ const global_dir = path12.join(os3.homedir(), ".claude", "rules");
5051
+ const project_dir = path12.join(project_root, ".claude", "rules");
4717
5052
  const g = readRuleLayer(global_dir);
4718
5053
  const p = readRuleLayer(project_dir);
4719
5054
  if (g === null || p === null) return true;
@@ -4784,7 +5119,7 @@ function _run_scope_prompt(opts, reason, custom_path) {
4784
5119
  fail("Custom-path prompt aborted (EOF on stdin)");
4785
5120
  }
4786
5121
  if (!raw) fail("Custom-path prompt requires a non-empty path");
4787
- cp = resolvePath(expanduser2(raw));
5122
+ cp = resolvePath(expanduser3(raw));
4788
5123
  opts.custom_path = cp;
4789
5124
  }
4790
5125
  if (!state.QUIET) info(`Custom destination: ${cp}`);
@@ -4801,9 +5136,9 @@ function detect_scope(cwd) {
4801
5136
  if (pathExists(_resolve_settings_read(cwd))) {
4802
5137
  return ["project", `existing ${SETTINGS_FILE}`];
4803
5138
  }
4804
- const has_manifest = SCOPE_DETECT_MANIFESTS.find((m) => pathExists(path10.join(cwd, m))) ?? null;
4805
- const has_ai_dir = SCOPE_DETECT_AI_DIRS.find((d) => isDir(path10.join(cwd, d))) ?? null;
4806
- const has_ai_file = SCOPE_DETECT_AI_FILES.find((f) => pathExists(path10.join(cwd, f))) ?? null;
5139
+ const has_manifest = SCOPE_DETECT_MANIFESTS.find((m) => pathExists(path12.join(cwd, m))) ?? null;
5140
+ const has_ai_dir = SCOPE_DETECT_AI_DIRS.find((d) => isDir(path12.join(cwd, d))) ?? null;
5141
+ const has_ai_file = SCOPE_DETECT_AI_FILES.find((f) => pathExists(path12.join(cwd, f))) ?? null;
4807
5142
  if (has_manifest && (has_ai_dir || has_ai_file)) {
4808
5143
  const marker = has_ai_dir || has_ai_file;
4809
5144
  return ["prompt", `manifest (${has_manifest}) + AI-tool config (${marker})`];
@@ -4824,7 +5159,7 @@ function readLineSyncRaw(promptText) {
4824
5159
  for (; ; ) {
4825
5160
  let n;
4826
5161
  try {
4827
- n = fs12.readSync(0, buf, 0, 1, null);
5162
+ n = fs14.readSync(0, buf, 0, 1, null);
4828
5163
  } catch (err) {
4829
5164
  const code = err.code;
4830
5165
  if (code === "EAGAIN") {
@@ -4869,52 +5204,20 @@ function prompt_scope_choice(reason) {
4869
5204
  }
4870
5205
  fail("Scope prompt aborted (3 invalid replies); pass --scope=project|global to override");
4871
5206
  }
4872
- function _sha256_of_file(p) {
4873
- return sha256OfFile(p);
4874
- }
4875
- function _file_entry(p, kind, hash_content) {
4876
- return {
4877
- path: p,
4878
- kind,
4879
- sha256: hash_content ? _sha256_of_file(p) : null
4880
- };
4881
- }
4882
- function _files_by_tool_from_deploy(deploy_results) {
4883
- const out = {};
4884
- for (const tool_id of Object.keys(deploy_results)) {
4885
- const [, , status, paths] = deploy_results[tool_id];
4886
- if (status === "deployed") {
4887
- out[tool_id] = paths.map((p) => _file_entry(p, "deployed", true));
4888
- } else if (status === "marker") {
4889
- out[tool_id] = paths.map((p) => _file_entry(p, "marker", true));
4890
- } else {
4891
- out[tool_id] = [];
4892
- }
4893
- }
4894
- return out;
4895
- }
4896
- function _files_by_tool_from_bridges(tools, project_root, scope) {
4897
- const out = {};
4898
- for (const tool_id of [...tools].sort()) {
4899
- const marker = _bridge_marker(tool_id, scope);
4900
- if (!marker) continue;
4901
- let marker_path = marker;
4902
- if (!path10.isAbsolute(marker_path)) {
4903
- marker_path = path10.join(project_root, marker_path);
4904
- }
4905
- out[tool_id] = [_file_entry(marker_path, "bridge", false)];
4906
- }
4907
- return out;
4908
- }
4909
5207
  function _update_installed_tools_manifest(project_root, tools, scope, force, files_by_tool = null, merged_keys_by_tool = null) {
4910
5208
  const target = manifest_path(project_root);
4911
5209
  const existing = read_manifest(target) ?? {};
4912
- let entries = Array.isArray(existing["tools"]) ? [...existing["tools"]] : [];
5210
+ const prior = readRecordedByTool(target, project_root);
5211
+ const preserved = preservedIndex(tracker.conflictState.preserved, tracker.conflictState.staged);
5212
+ let entries = hydrateRecordedInventories(
5213
+ Array.isArray(existing["tools"]) ? [...existing["tools"]] : [],
5214
+ prior
5215
+ );
4913
5216
  const version = current_package_version();
4914
5217
  for (const tool_id of [...tools].sort()) {
4915
5218
  const marker = _bridge_marker(tool_id, scope);
4916
5219
  if (!marker) continue;
4917
- const files = files_by_tool ? files_by_tool[tool_id] ?? null : null;
5220
+ const files = reconcileToolFiles(files_by_tool?.[tool_id], prior.get(tool_id), preserved);
4918
5221
  const merged_keys = merged_keys_by_tool ? merged_keys_by_tool[tool_id] ?? null : null;
4919
5222
  try {
4920
5223
  entries = upsert_tool(entries, {
@@ -4939,26 +5242,26 @@ function _update_installed_tools_manifest(project_root, tools, scope, force, fil
4939
5242
  }
4940
5243
  write_manifest(target, version, entries);
4941
5244
  if (!state.QUIET) {
4942
- const rel = isRelativeTo(target, project_root) ? path10.relative(project_root, target) : target;
5245
+ const rel = isRelativeTo(target, project_root) ? path12.relative(project_root, target) : target;
4943
5246
  info(`Manifest updated: ${rel}`);
4944
5247
  }
4945
5248
  return 0;
4946
5249
  }
4947
5250
  function isRelativeTo(child, parent) {
4948
- const rel = path10.relative(parent, child);
4949
- return rel === "" || !rel.startsWith("..") && !path10.isAbsolute(rel);
5251
+ const rel = path12.relative(parent, child);
5252
+ return rel === "" || !rel.startsWith("..") && !path12.isAbsolute(rel);
4950
5253
  }
4951
5254
  function _resolve_package_root_for_global() {
4952
5255
  const here = resolvePath(_HERE);
4953
- const candidate = path10.dirname(path10.dirname(path10.dirname(here)));
4954
- if (!pathExists(path10.join(candidate, "src", "config", "profiles", "minimal.ini"))) {
5256
+ const candidate = path12.dirname(path12.dirname(path12.dirname(here)));
5257
+ if (!pathExists(path12.join(candidate, "src", "config", "profiles", "minimal.ini"))) {
4955
5258
  fail(
4956
5259
  `Could not locate agent-config package root from ${here}. Expected src/config/profiles/minimal.ini at the parent directory.`
4957
5260
  );
4958
5261
  }
4959
5262
  return candidate;
4960
5263
  }
4961
- var CONSUMER_BRIDGE_MARKER_RELPATH = path10.join("agents", ".event4u-bridge.yml");
5264
+ var CONSUMER_BRIDGE_MARKER_RELPATH = path12.join("agents", ".event4u-bridge.yml");
4962
5265
  var MIGRATE_LEGACY_YAML_FILES = [".agent-settings.yml", ".agent-user.yml"];
4963
5266
  var MIGRATE_LEGACY_TOOL_DIRS = [".augment", ".claude", ".cursor"];
4964
5267
  var AGENT_CONFIG_PACKAGE_NAME = "@event4u/agent-config";
@@ -4966,7 +5269,7 @@ function _is_agent_config_source_repo(project_root) {
4966
5269
  if (process2.env["AGENT_CONFIG_CONSUMER_MODE"] === "1") {
4967
5270
  return [false, "consumer-mode-override"];
4968
5271
  }
4969
- const pkg_json = path10.join(project_root, "package.json");
5272
+ const pkg_json = path12.join(project_root, "package.json");
4970
5273
  if (isFile(pkg_json)) {
4971
5274
  let data = {};
4972
5275
  try {
@@ -4978,13 +5281,13 @@ function _is_agent_config_source_repo(project_root) {
4978
5281
  return [true, "package.json:name"];
4979
5282
  }
4980
5283
  }
4981
- if (isDir(path10.join(project_root, ".agent-src.uncondensed"))) {
5284
+ if (isDir(path12.join(project_root, ".agent-src.uncondensed"))) {
4982
5285
  return [true, ".agent-src.uncondensed/"];
4983
5286
  }
4984
- const packages_dir = path10.join(project_root, "packages");
5287
+ const packages_dir = path12.join(project_root, "packages");
4985
5288
  if (isDir(packages_dir)) {
4986
- for (const child of fs12.readdirSync(packages_dir)) {
4987
- if (isDir(path10.join(packages_dir, child, ".agent-src.uncondensed"))) {
5289
+ for (const child of fs14.readdirSync(packages_dir)) {
5290
+ if (isDir(path12.join(packages_dir, child, ".agent-src.uncondensed"))) {
4988
5291
  return [true, `packages/${child}/.agent-src.uncondensed/`];
4989
5292
  }
4990
5293
  }
@@ -5002,17 +5305,17 @@ function _detect_legacy_for_migration(project_root) {
5002
5305
  }
5003
5306
  return [];
5004
5307
  }
5005
- if (isFile(path10.join(project_root, INSTALL_MODE_MARKER_REL))) return [];
5308
+ if (isFile(path12.join(project_root, INSTALL_MODE_MARKER_REL))) return [];
5006
5309
  const found = [];
5007
5310
  for (const name of MIGRATE_LEGACY_YAML_FILES) {
5008
- if (isFile(path10.join(project_root, name))) {
5311
+ if (isFile(path12.join(project_root, name))) {
5009
5312
  found.push(name);
5010
- } else if (isFile(path10.join(project_root, "settings", name))) {
5313
+ } else if (isFile(path12.join(project_root, "settings", name))) {
5011
5314
  found.push(`settings/${name}`);
5012
5315
  }
5013
5316
  }
5014
5317
  for (const name of MIGRATE_LEGACY_TOOL_DIRS) {
5015
- const p = path10.join(project_root, name);
5318
+ const p = path12.join(project_root, name);
5016
5319
  if (isDir(p) && !isSymlink(p)) {
5017
5320
  found.push(`${name}/`);
5018
5321
  }
@@ -5024,7 +5327,7 @@ function _prompt_migrate_to_global(project_root, artefacts) {
5024
5327
  process2.stdout.write("\n");
5025
5328
  warn("Legacy project-local artefacts detected \u2014 pre-ADR-020 layout:");
5026
5329
  for (const rel of artefacts) {
5027
- info(` ${path10.join(project_root, rel)}`);
5330
+ info(` ${path12.join(project_root, rel)}`);
5028
5331
  }
5029
5332
  info("The unified `agent-config migrate` sweeps these in one pass.");
5030
5333
  info("The wizard recreates fresh config afterwards.");
@@ -5055,20 +5358,20 @@ function _run_migrate_to_global(project_root) {
5055
5358
  function _format_global_root_for_marker(global_root) {
5056
5359
  const home = resolvePath(os3.homedir());
5057
5360
  const resolved = resolvePath(global_root);
5058
- const rel = path10.relative(home, resolved);
5059
- if (rel === "" || rel.startsWith("..") || path10.isAbsolute(rel)) {
5361
+ const rel = path12.relative(home, resolved);
5362
+ if (rel === "" || rel.startsWith("..") || path12.isAbsolute(rel)) {
5060
5363
  return global_root;
5061
5364
  }
5062
- return `~/${rel.split(path10.sep).join("/")}`;
5365
+ return `~/${rel.split(path12.sep).join("/")}`;
5063
5366
  }
5064
5367
  function _remove_legacy_consumer_bridge_marker(project_root, env = null) {
5065
5368
  const env_map = env ?? process2.env;
5066
5369
  if (env_map["AGENT_CONFIG_DEV_MODE"] === "1") return null;
5067
- if (isDir(path10.join(project_root, ".agent-src.uncondensed"))) return null;
5068
- const target = path10.join(project_root, CONSUMER_BRIDGE_MARKER_RELPATH);
5370
+ if (isDir(path12.join(project_root, ".agent-src.uncondensed"))) return null;
5371
+ const target = path12.join(project_root, CONSUMER_BRIDGE_MARKER_RELPATH);
5069
5372
  if (!isFile(target)) return null;
5070
5373
  try {
5071
- fs12.rmSync(target);
5374
+ fs14.rmSync(target);
5072
5375
  } catch {
5073
5376
  return null;
5074
5377
  }
@@ -5082,7 +5385,7 @@ var PROJECT_ANCHOR_TOOLS = {
5082
5385
  function _write_per_tool_project_anchors(project_root, tools, env = null, now = null) {
5083
5386
  const env_map = env ?? process2.env;
5084
5387
  if (env_map["AGENT_CONFIG_DEV_MODE"] === "1") return [];
5085
- if (isDir(path10.join(project_root, ".agent-src.uncondensed"))) return [];
5388
+ if (isDir(path12.join(project_root, ".agent-src.uncondensed"))) return [];
5086
5389
  const global_root_str = _format_global_root_for_marker(
5087
5390
  event4u_root(env_map)
5088
5391
  );
@@ -5091,8 +5394,8 @@ function _write_per_tool_project_anchors(project_root, tools, env = null, now =
5091
5394
  for (const tool_id of Object.keys(PROJECT_ANCHOR_TOOLS).sort()) {
5092
5395
  const rel_path = PROJECT_ANCHOR_TOOLS[tool_id];
5093
5396
  if (!tools.has(tool_id)) continue;
5094
- const target = path10.join(project_root, rel_path);
5095
- mkdirp(path10.dirname(target));
5397
+ const target = path12.join(project_root, rel_path);
5398
+ mkdirp(path12.dirname(target));
5096
5399
  const body = `# event4u/agent-config \u2014 per-tool project anchor (auto-written).
5097
5400
  # Spec: docs/contracts/consumer-bridge.md \xA7 Per-tool anchor strategy.
5098
5401
  # Tool: ${tool_id}. Resolves the global install directly \u2014 no
@@ -5110,7 +5413,7 @@ installed_at: ${stamp}
5110
5413
  }
5111
5414
  var PACKAGE_TAG_ID = "event4u/agent-config";
5112
5415
  function _inject_package_tag(target, source, package_root) {
5113
- if (path10.extname(target) !== ".md") return;
5416
+ if (path12.extname(target) !== ".md") return;
5114
5417
  let text;
5115
5418
  try {
5116
5419
  text = readText(target);
@@ -5138,8 +5441,8 @@ function _inject_package_tag(target, source, package_root) {
5138
5441
  resolved_src = source;
5139
5442
  }
5140
5443
  if (package_root !== null) {
5141
- const rel = path10.relative(resolvePath(package_root), resolved_src);
5142
- if (rel !== "" && !rel.startsWith("..") && !path10.isAbsolute(rel)) {
5444
+ const rel = path12.relative(resolvePath(package_root), resolved_src);
5445
+ if (rel !== "" && !rel.startsWith("..") && !path12.isAbsolute(rel)) {
5143
5446
  source_value = rel;
5144
5447
  } else {
5145
5448
  source_value = resolved_src;
@@ -5174,12 +5477,23 @@ function _escapes_package_root(resolved, package_root) {
5174
5477
  if (package_root === null) return false;
5175
5478
  let root;
5176
5479
  try {
5177
- root = fs12.realpathSync(package_root);
5480
+ root = fs14.realpathSync(package_root);
5178
5481
  } catch {
5179
5482
  return false;
5180
5483
  }
5181
5484
  return !is_ancestor(root, resolved);
5182
5485
  }
5486
+ function _log_tx_entry(kind, target) {
5487
+ try {
5488
+ appendTxLog(getLogPath(), {
5489
+ ts: (/* @__PURE__ */ new Date()).toISOString(),
5490
+ kind,
5491
+ path: target,
5492
+ sha256: kind === "write" ? sha256OfFile(target) : null
5493
+ });
5494
+ } catch {
5495
+ }
5496
+ }
5183
5497
  function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null, file_filter = null) {
5184
5498
  let written = 0;
5185
5499
  let skipped = 0;
@@ -5189,7 +5503,7 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
5189
5503
  if (file_filter !== null && !file_filter(src)) return [0, 0, written_paths];
5190
5504
  let resolved_src = src;
5191
5505
  try {
5192
- resolved_src = fs12.realpathSync(src);
5506
+ resolved_src = fs14.realpathSync(src);
5193
5507
  } catch {
5194
5508
  resolved_src = src;
5195
5509
  }
@@ -5197,22 +5511,27 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
5197
5511
  warn(`refused: ${src} dereferences outside the package root \u2014 not copied`);
5198
5512
  return [0, 0, written_paths];
5199
5513
  }
5200
- mkdirp(path10.dirname(dest));
5201
- const decision = _resolve_file_conflict(dest, force);
5202
- if (decision === "skip") return [0, 1, written_paths];
5203
- fs12.copyFileSync(src, dest);
5514
+ mkdirp(path12.dirname(dest));
5515
+ const decision = tracker.resolve(dest, force);
5516
+ if (decision === "preserve") {
5517
+ tracker.preserve(dest, resolved_src, package_root);
5518
+ _log_tx_entry("skip", dest);
5519
+ return [0, 1, written_paths];
5520
+ }
5521
+ fs14.copyFileSync(src, dest);
5204
5522
  _inject_package_tag(dest, src, package_root);
5523
+ _log_tx_entry("write", dest);
5205
5524
  written_paths.push(dest);
5206
5525
  return [1, 0, written_paths];
5207
5526
  }
5208
5527
  mkdirp(dest);
5209
5528
  const walk = (node) => {
5210
5529
  const acc = [];
5211
- const names = fs12.readdirSync(node).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
5530
+ const names = fs14.readdirSync(node).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
5212
5531
  for (const name of names) {
5213
- const entry = path10.join(node, name);
5532
+ const entry = path12.join(node, name);
5214
5533
  acc.push(entry);
5215
- const lst = fs12.lstatSync(entry);
5534
+ const lst = fs14.lstatSync(entry);
5216
5535
  if (lst.isDirectory() && !lst.isSymbolicLink()) {
5217
5536
  acc.push(...walk(entry));
5218
5537
  }
@@ -5220,9 +5539,9 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
5220
5539
  return acc;
5221
5540
  };
5222
5541
  for (const entry of walk(src)) {
5223
- const rel = path10.relative(src, entry);
5224
- const target = path10.join(dest, rel);
5225
- const lst = fs12.lstatSync(entry);
5542
+ const rel = path12.relative(src, entry);
5543
+ const target = path12.join(dest, rel);
5544
+ const lst = fs14.lstatSync(entry);
5226
5545
  if (lst.isDirectory() && !lst.isSymbolicLink()) {
5227
5546
  mkdirp(target);
5228
5547
  continue;
@@ -5230,8 +5549,8 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
5230
5549
  let resolvedIsDir = false;
5231
5550
  let resolved = entry;
5232
5551
  try {
5233
- resolved = fs12.realpathSync(entry);
5234
- resolvedIsDir = fs12.statSync(entry).isDirectory();
5552
+ resolved = fs14.realpathSync(entry);
5553
+ resolvedIsDir = fs14.statSync(entry).isDirectory();
5235
5554
  } catch {
5236
5555
  resolvedIsDir = false;
5237
5556
  }
@@ -5256,14 +5575,17 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
5256
5575
  if (file_filter !== null && !file_filter(entry)) {
5257
5576
  continue;
5258
5577
  }
5259
- const decision = _resolve_file_conflict(target, force);
5260
- if (decision === "skip") {
5578
+ const decision = tracker.resolve(target, force);
5579
+ if (decision === "preserve") {
5580
+ tracker.preserve(target, resolved, package_root);
5261
5581
  skipped += 1;
5582
+ _log_tx_entry("skip", target);
5262
5583
  continue;
5263
5584
  }
5264
- mkdirp(path10.dirname(target));
5265
- fs12.copyFileSync(resolved, target);
5585
+ mkdirp(path12.dirname(target));
5586
+ fs14.copyFileSync(resolved, target);
5266
5587
  _inject_package_tag(target, resolved, package_root);
5588
+ _log_tx_entry("write", target);
5267
5589
  written += 1;
5268
5590
  written_paths.push(target);
5269
5591
  }
@@ -5272,12 +5594,17 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
5272
5594
  function _claude_desktop_bundles_dir() {
5273
5595
  return write_target(_CLAUDE_DESKTOP_BUNDLES_SUBPATH);
5274
5596
  }
5275
- function _write_claude_desktop_marker(_force, lockfile_path2, bundles_dir, bundle_count) {
5276
- const anchor = expanduser2(USER_SCOPE_PATHS["claude-desktop"]);
5277
- const target = path10.join(anchor, "agent-config.md");
5597
+ function _write_claude_desktop_marker(force, lockfile_path2, bundles_dir, bundle_count) {
5598
+ const anchor = expanduser3(USER_SCOPE_PATHS["claude-desktop"]);
5599
+ const target = path12.join(anchor, "agent-config.md");
5278
5600
  mkdirp(anchor);
5279
5601
  const body = claudeDesktopMarkerBody(lockfile_path2, anchor, bundles_dir, bundle_count);
5602
+ if (tracker.resolve(target, force) === "preserve") {
5603
+ tracker.preserveContent(target, body);
5604
+ return [0, 1, []];
5605
+ }
5280
5606
  writeText(target, body);
5607
+ _log_tx_entry("write", target);
5281
5608
  return [1, 0, [target]];
5282
5609
  }
5283
5610
  function _deploy_claude_desktop(force, package_root, lockfile_path2) {
@@ -5298,23 +5625,23 @@ function _apply_claude_flat_command_wrappers(anchor, package_root, current_files
5298
5625
  const wrapped = [];
5299
5626
  const collisions = [];
5300
5627
  const reserved = [];
5301
- const commands_dir = path10.join(anchor, "commands");
5628
+ const commands_dir = path12.join(anchor, "commands");
5302
5629
  let flat_entries = [];
5303
5630
  try {
5304
- flat_entries = fs12.readdirSync(commands_dir).filter((f) => f.endsWith(".md"));
5631
+ flat_entries = fs14.readdirSync(commands_dir).filter((f) => f.endsWith(".md"));
5305
5632
  } catch {
5306
5633
  }
5307
5634
  for (const fname of flat_entries.sort()) {
5308
5635
  const slug = fname.slice(0, -".md".length);
5309
5636
  if (!is_claude_builtin_name(slug)) continue;
5310
- fs12.rmSync(path10.join(commands_dir, fname), { force: true });
5637
+ fs14.rmSync(path12.join(commands_dir, fname), { force: true });
5311
5638
  current_files.delete(`commands/${fname}`);
5312
5639
  reserved.push(slug);
5313
5640
  }
5314
5641
  const eligible = new Set(_CLAUDE_FLAT_WRAPPER_EXTRA);
5315
5642
  try {
5316
5643
  const manifest = JSON.parse(
5317
- fs12.readFileSync(path10.join(package_root, "dist", "discovery", "discovery-manifest.json"), "utf8")
5644
+ fs14.readFileSync(path12.join(package_root, "dist", "discovery", "discovery-manifest.json"), "utf8")
5318
5645
  );
5319
5646
  for (const a of manifest.artefacts ?? []) {
5320
5647
  if (a.category !== "command" || typeof a.slug !== "string") continue;
@@ -5325,22 +5652,22 @@ function _apply_claude_flat_command_wrappers(anchor, package_root, current_files
5325
5652
  }
5326
5653
  for (const slug of [...eligible].sort()) {
5327
5654
  const flat_rel = `commands/${slug}.md`;
5328
- const flat_abs = path10.join(anchor, "commands", `${slug}.md`);
5329
- if (!fs12.existsSync(flat_abs)) continue;
5330
- const skill_dir = path10.join(anchor, "skills", slug);
5331
- if (fs12.existsSync(skill_dir)) {
5655
+ const flat_abs = path12.join(anchor, "commands", `${slug}.md`);
5656
+ if (!fs14.existsSync(flat_abs)) continue;
5657
+ const skill_dir = path12.join(anchor, "skills", slug);
5658
+ if (fs14.existsSync(skill_dir)) {
5332
5659
  collisions.push(slug);
5333
5660
  continue;
5334
5661
  }
5335
- let body = fs12.readFileSync(flat_abs, "utf8");
5662
+ let body = fs14.readFileSync(flat_abs, "utf8");
5336
5663
  if (body.startsWith("---\n") && !/^name:/m.test(body.split("\n---")[0] ?? "")) {
5337
5664
  body = body.replace("---\n", `---
5338
5665
  name: ${slug}
5339
5666
  `);
5340
5667
  }
5341
- fs12.mkdirSync(skill_dir, { recursive: true });
5342
- fs12.writeFileSync(path10.join(skill_dir, "SKILL.md"), body, "utf8");
5343
- fs12.rmSync(flat_abs, { force: true });
5668
+ fs14.mkdirSync(skill_dir, { recursive: true });
5669
+ fs14.writeFileSync(path12.join(skill_dir, "SKILL.md"), body, "utf8");
5670
+ fs14.rmSync(flat_abs, { force: true });
5344
5671
  current_files.delete(flat_rel);
5345
5672
  current_files.add(`skills/${slug}/SKILL.md`);
5346
5673
  wrapped.push(slug);
@@ -5366,14 +5693,14 @@ function _deploy_global_content(tools, force, package_root, lockfile_path2) {
5366
5693
  results[tool_id] = [0, 0, "unsupported", []];
5367
5694
  continue;
5368
5695
  }
5369
- const anchor = expanduser2(anchor_raw);
5696
+ const anchor = expanduser3(anchor_raw);
5370
5697
  let written_total = 0;
5371
5698
  let skipped_total = 0;
5372
5699
  const written_paths = [];
5373
5700
  let current_files = /* @__PURE__ */ new Set();
5374
5701
  for (const [src_rel, dest_sub] of plan) {
5375
- const src = path10.join(package_root, src_rel);
5376
- const dest = dest_sub ? path10.join(anchor, dest_sub) : anchor;
5702
+ const src = path12.join(package_root, src_rel);
5703
+ const dest = dest_sub ? path12.join(anchor, dest_sub) : anchor;
5377
5704
  const rule_filter = _rule_filter_for_source(src_rel, rule_scope);
5378
5705
  const [w, s, paths] = _copy_dir_dereferencing_symlinks(
5379
5706
  src,
@@ -5397,11 +5724,12 @@ function _deploy_global_content(tools, force, package_root, lockfile_path2) {
5397
5724
  if (tool_id === "claude-code") {
5398
5725
  const res = _apply_claude_flat_command_wrappers(anchor, package_root, current_files);
5399
5726
  rewriteAndReport(
5400
- path10.join(anchor, "rules"),
5727
+ path12.join(anchor, "rules"),
5401
5728
  state.QUIET,
5402
5729
  info,
5403
5730
  warn,
5404
- res
5731
+ res,
5732
+ new Set(tracker.conflictState.preserved.map((p) => path12.resolve(p)))
5405
5733
  );
5406
5734
  }
5407
5735
  const missing_targets = _verify_deploy_targets(anchor, plan);
@@ -5444,10 +5772,10 @@ function _deploy_global_content(tools, force, package_root, lockfile_path2) {
5444
5772
  results[tool_id] = [written_total, skipped_total, "deployed", written_paths];
5445
5773
  if (tool_id === "claude-code") {
5446
5774
  try {
5447
- const manifest = path10.join(package_root, "src", "scripts", "hook_manifest.yaml");
5775
+ const manifest = path12.join(package_root, "src", "scripts", "hook_manifest.yaml");
5448
5776
  const matrix = build_claude_hook_matrix(manifest);
5449
5777
  const res = ensure_managed_hooks(
5450
- path10.join(anchor, "settings.json"),
5778
+ path12.join(anchor, "settings.json"),
5451
5779
  matrix
5452
5780
  );
5453
5781
  if (!state.QUIET) {
@@ -5481,10 +5809,10 @@ function _preview_global_reap(tools, package_root) {
5481
5809
  if (plan === void 0) continue;
5482
5810
  const anchor_raw = USER_SCOPE_PATHS[tool_id];
5483
5811
  if (!anchor_raw) continue;
5484
- const anchor = expanduser2(anchor_raw);
5812
+ const anchor = expanduser3(anchor_raw);
5485
5813
  let current_files = /* @__PURE__ */ new Set();
5486
5814
  for (const [src_rel, dest_sub] of plan) {
5487
- const src = path10.join(package_root, src_rel);
5815
+ const src = path12.join(package_root, src_rel);
5488
5816
  current_files = setUnion(
5489
5817
  current_files,
5490
5818
  expected_deploy_files(
@@ -5518,14 +5846,14 @@ function _preview_global_reap(tools, package_root) {
5518
5846
  function _verify_deploy_targets(anchor, plan) {
5519
5847
  const missing = [];
5520
5848
  for (const [, dest_sub] of plan) {
5521
- const target = dest_sub ? path10.join(anchor, dest_sub) : anchor;
5849
+ const target = dest_sub ? path12.join(anchor, dest_sub) : anchor;
5522
5850
  const label = dest_sub || ".";
5523
5851
  if (!isDir(target)) {
5524
5852
  missing.push(label);
5525
5853
  continue;
5526
5854
  }
5527
5855
  try {
5528
- const entries = fs12.readdirSync(target);
5856
+ const entries = fs14.readdirSync(target);
5529
5857
  if (entries.length === 0) missing.push(label);
5530
5858
  } catch {
5531
5859
  missing.push(label);
@@ -5543,9 +5871,9 @@ function _resolve_global_settings_doc() {
5543
5871
  }
5544
5872
  function _resolve_global_settings_path() {
5545
5873
  const root = event4u_root();
5546
- const canonical = path10.join(root, "settings", SETTINGS_FILE);
5874
+ const canonical = path12.join(root, "settings", SETTINGS_FILE);
5547
5875
  if (pathExists(canonical)) return canonical;
5548
- const legacy = path10.join(root, SETTINGS_FILE);
5876
+ const legacy = path12.join(root, SETTINGS_FILE);
5549
5877
  if (pathExists(legacy)) return legacy;
5550
5878
  return null;
5551
5879
  }
@@ -5656,7 +5984,7 @@ function install_global(tools, force, project_root = null, core_only = false) {
5656
5984
  info(` schema_version=1, agent_config_version=${installed_version}`);
5657
5985
  info(` tools=${merged_tools.join(",")}`);
5658
5986
  }
5659
- if (project_root !== null && pathExists(_resolve_settings_read(project_root)) && !isDir(path10.join(project_root, ".agent-src.uncondensed"))) {
5987
+ if (project_root !== null && pathExists(_resolve_settings_read(project_root)) && !isDir(path12.join(project_root, ".agent-src.uncondensed"))) {
5660
5988
  const drift = collect_drift(project_root);
5661
5989
  if (!state.QUIET) {
5662
5990
  process2.stdout.write("\n");
@@ -5770,19 +6098,19 @@ function install_global(tools, force, project_root = null, core_only = false) {
5770
6098
  }
5771
6099
  }
5772
6100
  }
5773
- if (project_root !== null && pathExists(_resolve_settings_read(project_root)) && !isDir(path10.join(project_root, ".agent-src.uncondensed"))) {
5774
- const files_by_tool = _files_by_tool_from_deploy(deploy_results);
6101
+ if (project_root !== null && pathExists(_resolve_settings_read(project_root)) && !isDir(path12.join(project_root, ".agent-src.uncondensed"))) {
6102
+ const files_by_tool = filesByToolFromDeploy(deploy_results);
5775
6103
  const rc = _update_installed_tools_manifest(project_root, tools, "global", force, files_by_tool);
5776
6104
  if (rc !== 0) return rc;
5777
6105
  const removed_marker = _remove_legacy_consumer_bridge_marker(project_root);
5778
6106
  if (removed_marker !== null && !state.QUIET) {
5779
- const rel = isRelativeTo(removed_marker, project_root) ? path10.relative(project_root, removed_marker) : removed_marker;
6107
+ const rel = isRelativeTo(removed_marker, project_root) ? path12.relative(project_root, removed_marker) : removed_marker;
5780
6108
  info(`Removed legacy bridge marker: ${rel}`);
5781
6109
  }
5782
6110
  const anchor_paths = _write_per_tool_project_anchors(project_root, tools);
5783
6111
  if (anchor_paths.length > 0 && !state.QUIET) {
5784
6112
  for (const p of anchor_paths) {
5785
- const rel = isRelativeTo(p, project_root) ? path10.relative(project_root, p) : p;
6113
+ const rel = isRelativeTo(p, project_root) ? path12.relative(project_root, p) : p;
5786
6114
  info(`Project anchor written: ${rel}`);
5787
6115
  }
5788
6116
  }
@@ -5818,8 +6146,8 @@ function install_global(tools, force, project_root = null, core_only = false) {
5818
6146
  }
5819
6147
  function _catalogue_truncation_warnings(deploy_results, project_root) {
5820
6148
  const log_candidates = [
5821
- path10.join(event4u_root(), "state", "skill-catalogue.jsonl"),
5822
- ...project_root ? [path10.join(project_root, OBSERVATION_LOG)] : []
6149
+ path12.join(event4u_root(), "state", "skill-catalogue.jsonl"),
6150
+ ...project_root ? [path12.join(project_root, OBSERVATION_LOG)] : []
5823
6151
  ];
5824
6152
  const records = log_candidates.flatMap((p) => readObservationLog(p));
5825
6153
  if (records.length === 0) return [];
@@ -5833,7 +6161,7 @@ function _catalogue_truncation_warnings(deploy_results, project_root) {
5833
6161
  if (limit === void 0) continue;
5834
6162
  const anchor_raw = USER_SCOPE_PATHS[tool_id];
5835
6163
  if (!anchor_raw) continue;
5836
- const volume = measureCatalogueVolume(tool_id, expanduser2(anchor_raw));
6164
+ const volume = measureCatalogueVolume(tool_id, expanduser3(anchor_raw));
5837
6165
  const warning = catalogueLimitWarning(volume, limit);
5838
6166
  if (warning !== null) lines.push(warning);
5839
6167
  }
@@ -5842,19 +6170,19 @@ function _catalogue_truncation_warnings(deploy_results, project_root) {
5842
6170
  function _scoped_migration_notice(deploy_results, project_root, package_root, probe) {
5843
6171
  if (!isInteractiveSession(probe)) return [];
5844
6172
  const log_candidates = [
5845
- path10.join(event4u_root(), "state", "skill-catalogue.jsonl"),
5846
- ...project_root ? [path10.join(project_root, OBSERVATION_LOG)] : []
6173
+ path12.join(event4u_root(), "state", "skill-catalogue.jsonl"),
6174
+ ...project_root ? [path12.join(project_root, OBSERVATION_LOG)] : []
5847
6175
  ];
5848
6176
  const limits = knownHostLimits(log_candidates.flatMap((p) => readObservationLog(p)));
5849
6177
  if (limits.size === 0) return [];
5850
6178
  const resolved = _resolve_scoped_projection(package_root);
5851
- const settings_path = _resolve_global_settings_path() ?? path10.join(event4u_root(), "settings", SETTINGS_FILE);
6179
+ const settings_path = _resolve_global_settings_path() ?? path12.join(event4u_root(), "settings", SETTINGS_FILE);
5852
6180
  for (const tool_id of Object.keys(deploy_results).sort()) {
5853
6181
  const [, , status] = deploy_results[tool_id];
5854
6182
  if (status !== "deployed") continue;
5855
6183
  const anchor_raw = USER_SCOPE_PATHS[tool_id];
5856
6184
  if (!anchor_raw) continue;
5857
- const volume = measureCatalogueVolume(tool_id, expanduser2(anchor_raw));
6185
+ const volume = measureCatalogueVolume(tool_id, expanduser3(anchor_raw));
5858
6186
  const eligibility = migrationEligibility(
5859
6187
  tool_id,
5860
6188
  resolved.mode,
@@ -5867,8 +6195,8 @@ function _scoped_migration_notice(deploy_results, project_root, package_root, pr
5867
6195
  }
5868
6196
  return [];
5869
6197
  }
5870
- var SETTINGS_SURFACE_REL = path10.join("state", "settings-surface.json");
5871
- var SETTINGS_DELTA_REL = path10.join("state", "settings-delta.json");
6198
+ var SETTINGS_SURFACE_REL = path12.join("state", "settings-surface.json");
6199
+ var SETTINGS_DELTA_REL = path12.join("state", "settings-delta.json");
5872
6200
  function _current_settings_surface(version) {
5873
6201
  const jsonSchema = zodToJsonSchema(settingsSchema, {
5874
6202
  name: "AgentSettings",
@@ -5879,20 +6207,20 @@ function _current_settings_surface(version) {
5879
6207
  }
5880
6208
  function _write_settings_surface_snapshot(installed_version) {
5881
6209
  const root = event4u_root();
5882
- const surface_path = path10.join(root, SETTINGS_SURFACE_REL);
5883
- const delta_path = path10.join(root, SETTINGS_DELTA_REL);
6210
+ const surface_path = path12.join(root, SETTINGS_SURFACE_REL);
6211
+ const delta_path = path12.join(root, SETTINGS_DELTA_REL);
5884
6212
  const next = _current_settings_surface(installed_version);
5885
6213
  let previous = null;
5886
6214
  try {
5887
- const parsed = JSON.parse(fs12.readFileSync(surface_path, "utf8"));
6215
+ const parsed = JSON.parse(fs14.readFileSync(surface_path, "utf8"));
5888
6216
  if (parsed !== null && typeof parsed === "object" && parsed.entries !== void 0) previous = parsed;
5889
6217
  } catch {
5890
6218
  }
5891
6219
  if (previous !== null && previous.version !== next.version) {
5892
6220
  const delta = computeSurfaceDelta(previous, next);
5893
6221
  if (delta.changes.length > 0) {
5894
- fs12.mkdirSync(path10.dirname(delta_path), { recursive: true, mode: 448 });
5895
- fs12.writeFileSync(delta_path, `${JSON.stringify(delta, null, 2)}
6222
+ fs14.mkdirSync(path12.dirname(delta_path), { recursive: true, mode: 448 });
6223
+ fs14.writeFileSync(delta_path, `${JSON.stringify(delta, null, 2)}
5896
6224
  `, { mode: 384 });
5897
6225
  if (!state.QUIET) {
5898
6226
  const counts = {};
@@ -5904,8 +6232,8 @@ function _write_settings_surface_snapshot(installed_version) {
5904
6232
  }
5905
6233
  }
5906
6234
  }
5907
- fs12.mkdirSync(path10.dirname(surface_path), { recursive: true, mode: 448 });
5908
- fs12.writeFileSync(surface_path, `${JSON.stringify(next, null, 2)}
6235
+ fs14.mkdirSync(path12.dirname(surface_path), { recursive: true, mode: 448 });
6236
+ fs14.writeFileSync(surface_path, `${JSON.stringify(next, null, 2)}
5909
6237
  `, { mode: 384 });
5910
6238
  }
5911
6239
  function arrayStrEqual(a, b) {
@@ -6125,13 +6453,13 @@ function _minimal_templates_root() {
6125
6453
  const chain = [start];
6126
6454
  let cur = start;
6127
6455
  for (; ; ) {
6128
- const parent = path10.dirname(cur);
6456
+ const parent = path12.dirname(cur);
6129
6457
  if (parent === cur) break;
6130
6458
  chain.push(parent);
6131
6459
  cur = parent;
6132
6460
  }
6133
6461
  for (const ancestor of chain) {
6134
- const candidate = path10.join(ancestor, "src", "templates", "minimal");
6462
+ const candidate = path12.join(ancestor, "src", "templates", "minimal");
6135
6463
  if (isDir(candidate)) return candidate;
6136
6464
  }
6137
6465
  fail("Could not locate src/templates/minimal/ \u2014 package install is corrupt.");
@@ -6139,9 +6467,9 @@ function _minimal_templates_root() {
6139
6467
  var INSTALL_MODE_MARKER_REL = "agents/.agent-state/install-mode.txt";
6140
6468
  function _write_install_mode_marker(project_root, mode) {
6141
6469
  if (mode !== "minimal" && mode !== "full") return;
6142
- const marker = path10.join(project_root, INSTALL_MODE_MARKER_REL);
6470
+ const marker = path12.join(project_root, INSTALL_MODE_MARKER_REL);
6143
6471
  try {
6144
- mkdirp(path10.dirname(marker));
6472
+ mkdirp(path12.dirname(marker));
6145
6473
  writeText(marker, `${mode}
6146
6474
  `);
6147
6475
  } catch {
@@ -6150,7 +6478,7 @@ function _write_install_mode_marker(project_root, mode) {
6150
6478
  function install_minimal(target_root_in, force, user_type = "") {
6151
6479
  let target_root = resolvePath(target_root_in);
6152
6480
  mkdirp(target_root);
6153
- const parent = path10.dirname(target_root);
6481
+ const parent = path12.dirname(target_root);
6154
6482
  if (parent !== target_root) {
6155
6483
  const existing = find_project_root_with_anchor(parent);
6156
6484
  if (existing !== null && existing[0] !== target_root) {
@@ -6161,21 +6489,21 @@ function install_minimal(target_root_in, force, user_type = "") {
6161
6489
  }
6162
6490
  }
6163
6491
  const templates = _minimal_templates_root();
6164
- const settings_src = path10.join(templates, SETTINGS_FILE);
6165
- const overrides_gitkeep_src = path10.join(templates, "overrides-gitkeep");
6166
- const overrides_readme_src = path10.join(templates, "agents-overrides-readme.md");
6492
+ const settings_src = path12.join(templates, SETTINGS_FILE);
6493
+ const overrides_gitkeep_src = path12.join(templates, "overrides-gitkeep");
6494
+ const overrides_readme_src = path12.join(templates, "agents-overrides-readme.md");
6167
6495
  if (!isFile(settings_src)) fail(`Bundled minimal settings template missing under ${templates}`);
6168
6496
  if (!isFile(overrides_gitkeep_src) || !isFile(overrides_readme_src)) {
6169
6497
  fail(`Bundled overrides scaffold templates missing under ${templates}`);
6170
6498
  }
6171
6499
  info(`Minimal init \u2192 ${target_root}`);
6172
- const overrides_root = path10.join(target_root, "agents", "overrides");
6500
+ const overrides_root = path12.join(target_root, "agents", "overrides");
6173
6501
  mkdirp(overrides_root);
6174
6502
  const gitkeep_body = readText(overrides_gitkeep_src);
6175
6503
  for (const sub of ["rules", "skills", "commands"]) {
6176
- const sub_dir = path10.join(overrides_root, sub);
6504
+ const sub_dir = path12.join(overrides_root, sub);
6177
6505
  mkdirp(sub_dir);
6178
- const gitkeep_dst = path10.join(sub_dir, ".gitkeep");
6506
+ const gitkeep_dst = path12.join(sub_dir, ".gitkeep");
6179
6507
  if (pathExists(gitkeep_dst) && !force) {
6180
6508
  skip(`agents/overrides/${sub}/.gitkeep already exists (use --force to overwrite)`);
6181
6509
  } else {
@@ -6183,7 +6511,7 @@ function install_minimal(target_root_in, force, user_type = "") {
6183
6511
  success(`Wrote agents/overrides/${sub}/.gitkeep`);
6184
6512
  }
6185
6513
  }
6186
- const readme_dst = path10.join(overrides_root, "README.md");
6514
+ const readme_dst = path12.join(overrides_root, "README.md");
6187
6515
  if (pathExists(readme_dst) && !force) {
6188
6516
  skip("agents/overrides/README.md already exists (use --force to overwrite)");
6189
6517
  } else {
@@ -6201,14 +6529,14 @@ function install_minimal(target_root_in, force, user_type = "") {
6201
6529
  personal:
6202
6530
  user_type: ${user_type}
6203
6531
  `;
6204
- mkdirp(path10.dirname(settings_dst));
6532
+ mkdirp(path12.dirname(settings_dst));
6205
6533
  writeText(settings_dst, body);
6206
6534
  success(`Wrote ${SETTINGS_FILE} (user_type=${user_type})`);
6207
6535
  }
6208
6536
  }
6209
6537
  const removed_marker = _remove_legacy_consumer_bridge_marker(target_root);
6210
6538
  if (removed_marker !== null) {
6211
- const rel = isRelativeTo(removed_marker, target_root) ? path10.relative(target_root, removed_marker) : removed_marker;
6539
+ const rel = isRelativeTo(removed_marker, target_root) ? path12.relative(target_root, removed_marker) : removed_marker;
6212
6540
  success(`Removed legacy bridge marker: ${rel}`);
6213
6541
  }
6214
6542
  _write_install_mode_marker(target_root, "minimal");
@@ -6282,7 +6610,7 @@ function run_interactive_init(project_root, force) {
6282
6610
  );
6283
6611
  return 0;
6284
6612
  }
6285
- const target = path10.join(project_root, _LOCAL_CONFIG_FILE);
6613
+ const target = path12.join(project_root, _LOCAL_CONFIG_FILE);
6286
6614
  if (pathExists(target) && !force) {
6287
6615
  warn(
6288
6616
  `${_LOCAL_CONFIG_FILE} already exists; re-run with --force to overwrite. Skipping interactive init.`
@@ -6309,7 +6637,7 @@ function run_interactive_init(project_root, force) {
6309
6637
  warn(`Could not write ${target}: ${String(exc)}`);
6310
6638
  return 1;
6311
6639
  }
6312
- success(`Wrote ${path10.relative(project_root, target)} (${user_type} / ${stack} / ${verbosity})`);
6640
+ success(`Wrote ${path12.relative(project_root, target)} (${user_type} / ${stack} / ${verbosity})`);
6313
6641
  return 0;
6314
6642
  }
6315
6643
  var _WIZARD_READY_RE = /^WIZARD_READY (http:\/\/(?:127\.0\.0\.1|localhost):\d+\/\S*)\r?$/;
@@ -6327,12 +6655,12 @@ function _wizard_should_launch(opts) {
6327
6655
  return [true, ""];
6328
6656
  }
6329
6657
  function _wizard_cli_dist(_project_root) {
6330
- const package_root = path10.dirname(path10.dirname(path10.dirname(resolvePath(_HERE))));
6331
- const cli = path10.join(package_root, "dist", "cli", "agent-config.js");
6658
+ const package_root = path12.dirname(path12.dirname(path12.dirname(resolvePath(_HERE))));
6659
+ const cli = path12.join(package_root, "dist", "cli", "agent-config.js");
6332
6660
  return pathExists(cli) ? cli : null;
6333
6661
  }
6334
6662
  function _server_info_path() {
6335
- return path10.join(os3.homedir(), ".event4u", "agent-config", "local-server.json");
6663
+ return path12.join(os3.homedir(), ".event4u", "agent-config", "local-server.json");
6336
6664
  }
6337
6665
  function _pid_is_agent_config(pid) {
6338
6666
  let res;
@@ -6349,7 +6677,7 @@ function _pid_is_agent_config(pid) {
6349
6677
  }
6350
6678
  function unlinkMissingOk(p) {
6351
6679
  try {
6352
- fs12.unlinkSync(p);
6680
+ fs14.unlinkSync(p);
6353
6681
  } catch {
6354
6682
  }
6355
6683
  }
@@ -6427,14 +6755,14 @@ function _wizard_spawn(project_root, pass_project_root = true) {
6427
6755
  }
6428
6756
  function _wizard_run_sync(cmd, env, cli) {
6429
6757
  const total = _WIZARD_TIMEOUTS.reduce((a, b) => a + b, 0);
6430
- const log_path = path10.join(
6758
+ const log_path = path12.join(
6431
6759
  os3.tmpdir(),
6432
6760
  `agent-config-wizard-${process2.pid}-${Date.now()}.log`
6433
6761
  );
6434
6762
  let child;
6435
6763
  let log_fd = null;
6436
6764
  try {
6437
- log_fd = fs12.openSync(log_path, "w");
6765
+ log_fd = fs14.openSync(log_path, "w");
6438
6766
  child = spawn(cmd[0], cmd.slice(1), {
6439
6767
  env,
6440
6768
  detached: true,
@@ -6452,7 +6780,7 @@ function _wizard_run_sync(cmd, env, cli) {
6452
6780
  } finally {
6453
6781
  if (log_fd !== null) {
6454
6782
  try {
6455
- fs12.closeSync(log_fd);
6783
+ fs14.closeSync(log_fd);
6456
6784
  } catch {
6457
6785
  }
6458
6786
  }
@@ -6702,8 +7030,8 @@ function main2(argv) {
6702
7030
  const target_root = resolvePath(
6703
7031
  opts.custom_path || opts.project || process2.env["PROJECT_ROOT"] || process2.cwd()
6704
7032
  );
6705
- const minimal_package_root = path10.dirname(
6706
- path10.dirname(path10.dirname(_minimal_templates_root()))
7033
+ const minimal_package_root = path12.dirname(
7034
+ path12.dirname(path12.dirname(_minimal_templates_root()))
6707
7035
  );
6708
7036
  const validated_user_type = _validate_user_type(minimal_package_root, opts.user_type);
6709
7037
  return install_minimal(target_root, opts.force, validated_user_type);
@@ -6727,19 +7055,25 @@ function main2(argv) {
6727
7055
  const rc3 = _run_migrate_to_global(detect_root);
6728
7056
  if (rc3 !== 0) return rc3;
6729
7057
  }
6730
- const rc2 = install_global(parsed_tools, opts.force, detect_root, opts.core_only);
7058
+ tracker.begin(detect_root);
7059
+ const rc2 = tracker.finalizeRc(
7060
+ install_global(parsed_tools, opts.force, detect_root, opts.core_only)
7061
+ );
6731
7062
  _emit_progress_terminal(rc2);
6732
- if (rc2 === 0 && wizard_handoff) {
6733
- return _wizard_spawn(detect_root, false);
7063
+ if ((rc2 === 0 || rc2 === EXIT_COMPLETED_WITH_CONFLICTS) && wizard_handoff) {
7064
+ const wizard_rc = _wizard_spawn(detect_root, false);
7065
+ return wizard_rc === 0 ? rc2 : wizard_rc;
6734
7066
  }
6735
7067
  return rc2;
6736
7068
  }
6737
7069
  const project_root = custom_path || resolvePath(opts.project || process2.env["PROJECT_ROOT"] || process2.cwd());
6738
- const is_first_run = !pathExists(path10.join(project_root, SETTINGS_FILE));
6739
- const rc = _main_project_install(opts, project_root, parsed_tools, is_first_run);
7070
+ const is_first_run = !pathExists(path12.join(project_root, SETTINGS_FILE));
7071
+ tracker.begin(project_root);
7072
+ let rc = _main_project_install(opts, project_root, parsed_tools, is_first_run);
6740
7073
  if (rc === 0 && opts.interactive) {
6741
7074
  run_interactive_init(project_root, opts.force);
6742
7075
  }
7076
+ rc = tracker.finalizeRc(rc);
6743
7077
  _emit_progress_terminal(rc);
6744
7078
  return rc;
6745
7079
  }
@@ -6799,16 +7133,16 @@ function _team_setup_hint_line(project_root) {
6799
7133
  return " \u2022 Claude Code team mode (optional cross-model review via the official codex plugin): run `agent-config doctor --check team` for setup status.";
6800
7134
  }
6801
7135
  function finalize_claude_model_tiers(project_root) {
6802
- const claude_skills = path10.join(project_root, ".claude", "skills");
6803
- const augment_skills = path10.join(project_root, ".augment", "skills");
7136
+ const claude_skills = path12.join(project_root, ".claude", "skills");
7137
+ const augment_skills = path12.join(project_root, ".augment", "skills");
6804
7138
  if (!isDir(claude_skills) || !isDir(augment_skills)) return 0;
6805
7139
  if (_read_consumer_auto_switch(project_root) !== "auto") return 0;
6806
7140
  let rendered = 0;
6807
- const entries = fs12.readdirSync(claude_skills).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
7141
+ const entries = fs14.readdirSync(claude_skills).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
6808
7142
  for (const name of entries) {
6809
- const entry = path10.join(claude_skills, name);
6810
- const src_dir = path10.join(augment_skills, name);
6811
- const src_md = path10.join(src_dir, "SKILL.md");
7143
+ const entry = path12.join(claude_skills, name);
7144
+ const src_dir = path12.join(augment_skills, name);
7145
+ const src_md = path12.join(src_dir, "SKILL.md");
6812
7146
  let tier;
6813
7147
  try {
6814
7148
  tier = read_model_tier(src_md);
@@ -6817,22 +7151,22 @@ function finalize_claude_model_tiers(project_root) {
6817
7151
  }
6818
7152
  if (tier === null || !(tier in TIER_TO_CLAUDE_MODEL) || !isDir(src_dir)) continue;
6819
7153
  if (isSymlink(entry) || isFile(entry)) {
6820
- fs12.unlinkSync(entry);
7154
+ fs14.unlinkSync(entry);
6821
7155
  } else if (isDir(entry)) {
6822
- fs12.rmSync(entry, { recursive: true, force: true });
7156
+ fs14.rmSync(entry, { recursive: true, force: true });
6823
7157
  }
6824
7158
  mkdirp(entry);
6825
- const srcFiles = fs12.readdirSync(src_dir).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
7159
+ const srcFiles = fs14.readdirSync(src_dir).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
6826
7160
  for (const fname of srcFiles) {
6827
7161
  if (fname === "SKILL.md") {
6828
7162
  writeText(
6829
- path10.join(entry, "SKILL.md"),
7163
+ path12.join(entry, "SKILL.md"),
6830
7164
  render_native_model_md(readText(src_md), tier)
6831
7165
  );
6832
7166
  } else {
6833
- fs12.symlinkSync(
6834
- path10.join("../../../.augment/skills", name, fname),
6835
- path10.join(entry, fname)
7167
+ fs14.symlinkSync(
7168
+ path12.join("../../../.augment/skills", name, fname),
7169
+ path12.join(entry, fname)
6836
7170
  );
6837
7171
  }
6838
7172
  }
@@ -6850,7 +7184,7 @@ function _main_project_install(opts, project_root, parsed_tools, is_first_run) {
6850
7184
  let package_type;
6851
7185
  if (opts.package) {
6852
7186
  package_root = resolvePath(opts.package);
6853
- if (!pathExists(path10.join(package_root, "src", "config", "profiles", "minimal.ini"))) {
7187
+ if (!pathExists(path12.join(package_root, "src", "config", "profiles", "minimal.ini"))) {
6854
7188
  fail(`Invalid --package path (missing src/config/profiles/minimal.ini): ${package_root}`);
6855
7189
  }
6856
7190
  package_type = detect_package_type_for_project(project_root, package_root);
@@ -6936,7 +7270,7 @@ function _main_project_install(opts, project_root, parsed_tools, is_first_run) {
6936
7270
  _smoke_test_hooks(project_root, package_root);
6937
7271
  }
6938
7272
  if (!opts.skip_bridges) {
6939
- const files_by_tool = _files_by_tool_from_bridges(parsed_tools, project_root, "project");
7273
+ const files_by_tool = filesByToolFromBridges(parsed_tools, project_root, "project", _bridge_marker);
6940
7274
  const rc = _update_installed_tools_manifest(
6941
7275
  project_root,
6942
7276
  parsed_tools,
@@ -6993,9 +7327,9 @@ function _main_project_install(opts, project_root, parsed_tools, is_first_run) {
6993
7327
  function _resolvedArgv1() {
6994
7328
  if (process2.argv[1] === void 0) return void 0;
6995
7329
  try {
6996
- return fs12.realpathSync(path10.resolve(process2.argv[1]));
7330
+ return fs14.realpathSync(path12.resolve(process2.argv[1]));
6997
7331
  } catch {
6998
- return path10.resolve(process2.argv[1]);
7332
+ return path12.resolve(process2.argv[1]);
6999
7333
  }
7000
7334
  }
7001
7335
  var _argv1 = _resolvedArgv1();