@event4u/agent-config 3.3.0 → 4.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 (585) hide show
  1. package/.agent-src/README.md +2 -2
  2. package/.agent-src/commands/agent-handoff.md +31 -2
  3. package/.agent-src/commands/agent-status.md +5 -5
  4. package/.agent-src/commands/agents/audit.md +8 -8
  5. package/.agent-src/commands/agents/init.md +25 -1
  6. package/.agent-src/commands/agents/optimize.md +3 -3
  7. package/.agent-src/commands/agents/user.md +1 -1
  8. package/.agent-src/commands/agents.md +1 -1
  9. package/.agent-src/commands/analyze-reference-repo.md +1 -1
  10. package/.agent-src/commands/check-current-md.md +8 -8
  11. package/.agent-src/commands/{compress.md → condense.md} +55 -55
  12. package/.agent-src/commands/context/create.md +7 -4
  13. package/.agent-src/commands/context/refactor.md +3 -1
  14. package/.agent-src/commands/feature/dev.md +1 -1
  15. package/.agent-src/commands/feature/explore.md +1 -1
  16. package/.agent-src/commands/feature/plan.md +10 -8
  17. package/.agent-src/commands/feature/refactor.md +3 -1
  18. package/.agent-src/commands/feature/roadmap.md +7 -4
  19. package/.agent-src/commands/fix/portability.md +3 -3
  20. package/.agent-src/commands/fix/refs.md +4 -4
  21. package/.agent-src/commands/ghostwriter.md +2 -2
  22. package/.agent-src/commands/memory/learn-low-impact.md +3 -3
  23. package/.agent-src/commands/module/explore.md +34 -8
  24. package/.agent-src/commands/optimize/agents-dir.md +9 -7
  25. package/.agent-src/commands/optimize/augmentignore.md +2 -2
  26. package/.agent-src/commands/optimize/skills.md +9 -9
  27. package/.agent-src/commands/post-as.md +1 -1
  28. package/.agent-src/commands/project-analyze.md +2 -2
  29. package/.agent-src/commands/project-health.md +3 -2
  30. package/.agent-src/commands/research/deep.md +1 -1
  31. package/.agent-src/commands/research/report.md +1 -1
  32. package/.agent-src/commands/research.md +1 -1
  33. package/.agent-src/commands/roadmap/ai-council.md +1 -1
  34. package/.agent-src/commands/roadmap/create.md +9 -4
  35. package/.agent-src/commands/rule-compliance-audit.md +1 -1
  36. package/.agent-src/commands/upstream-contribute.md +14 -14
  37. package/.agent-src/commands/video/from-script.md +1 -1
  38. package/.agent-src/commands/video/scene.md +1 -1
  39. package/.agent-src/commands/video/stitch.md +1 -1
  40. package/.agent-src/commands/video/storyboard.md +1 -1
  41. package/.agent-src/commands/video.md +1 -1
  42. package/.agent-src/contexts/augment-infrastructure.md +1 -1
  43. package/.agent-src/contexts/authority/commit-mechanics.md +15 -0
  44. package/.agent-src/contexts/authority/kernel-rule-edits.md +3 -3
  45. package/.agent-src/contexts/authority/scope-mechanics.md +1 -1
  46. package/.agent-src/contexts/communication/rules-auto/augment-source-of-truth-mechanics.md +28 -28
  47. package/.agent-src/contexts/communication/rules-auto/skill-quality-mechanics.md +4 -4
  48. package/.agent-src/contexts/communication/rules-auto/think-before-action-mechanics.md +2 -2
  49. package/.agent-src/contexts/contracts/artifact-engagement-flow.md +6 -6
  50. package/.agent-src/contexts/contracts/command-suggestion-flow.md +3 -3
  51. package/.agent-src/contexts/contracts/emergency-triage-block.md +4 -4
  52. package/.agent-src/contexts/contracts/frugality-charter.md +3 -3
  53. package/.agent-src/contexts/documentation-hierarchy.md +14 -7
  54. package/.agent-src/contexts/execution/autonomy-examples.md +1 -1
  55. package/.agent-src/contexts/execution/cheap-question-mechanics.md +39 -2
  56. package/.agent-src/contexts/execution/roadmap-process-loop.md +28 -5
  57. package/.agent-src/contexts/override-system.md +5 -5
  58. package/.agent-src/ghostwriter/fictional-fixture-v1.md +1 -1
  59. package/.agent-src/personas/advisors/first-principles.md +1 -1
  60. package/.agent-src/personas/hollywood-director.md +1 -1
  61. package/.agent-src/rules/architecture.md +5 -1
  62. package/.agent-src/rules/augment-edit-discipline.md +5 -5
  63. package/.agent-src/rules/augment-source-of-truth.md +15 -15
  64. package/.agent-src/rules/commit-conventions.md +1 -1
  65. package/.agent-src/rules/commit-policy.md +10 -0
  66. package/.agent-src/rules/domain-adoption-policy.md +3 -3
  67. package/.agent-src/rules/fast-path-marker-visibility.md +3 -3
  68. package/.agent-src/rules/finance-safety-floor.md +1 -1
  69. package/.agent-src/rules/framework-neutrality-in-generic-skills.md +8 -8
  70. package/.agent-src/rules/git-history-discipline.md +1 -1
  71. package/.agent-src/rules/improve-before-implement.md +2 -2
  72. package/.agent-src/rules/language-and-tone.md +2 -2
  73. package/.agent-src/rules/media-governance-routing.md +5 -5
  74. package/.agent-src/rules/no-attribution-footers.md +1 -0
  75. package/.agent-src/rules/no-cheap-questions.md +3 -0
  76. package/.agent-src/rules/no-decorative-emojis-in-git-surfaces.md +111 -0
  77. package/.agent-src/rules/no-pr-progress-comments.md +118 -0
  78. package/.agent-src/rules/no-roadmap-references.md +3 -3
  79. package/.agent-src/rules/non-destructive-by-default.md +1 -1
  80. package/.agent-src/rules/persona-governance.md +3 -3
  81. package/.agent-src/rules/preservation-guard.md +15 -15
  82. package/.agent-src/rules/roadmap-ci-steps-policy.md +7 -3
  83. package/.agent-src/rules/rule-type-governance.md +1 -1
  84. package/.agent-src/rules/skill-quality.md +1 -1
  85. package/.agent-src/rules/{caveman-speak.md → telegraph-speak.md} +15 -15
  86. package/.agent-src/rules/token-optimizer-maintenance.md +6 -6
  87. package/.agent-src/skills/agent-docs-writing/SKILL.md +17 -11
  88. package/.agent-src/skills/agents-md-thin-root/SKILL.md +9 -9
  89. package/.agent-src/skills/check-refs/SKILL.md +2 -2
  90. package/.agent-src/skills/code-refactoring/SKILL.md +2 -2
  91. package/.agent-src/skills/command-writing/SKILL.md +19 -19
  92. package/.agent-src/skills/comp-banding/SKILL.md +1 -1
  93. package/.agent-src/skills/condense-memory/SKILL.md +131 -0
  94. package/.agent-src/skills/context-authoring/SKILL.md +2 -2
  95. package/.agent-src/skills/context-document/SKILL.md +5 -3
  96. package/.agent-src/skills/copilot-agents-optimization/SKILL.md +3 -3
  97. package/.agent-src/skills/description-assist/SKILL.md +2 -2
  98. package/.agent-src/skills/git-workflow/SKILL.md +1 -1
  99. package/.agent-src/skills/guideline-writing/SKILL.md +5 -5
  100. package/.agent-src/skills/learning-to-rule-or-skill/SKILL.md +4 -4
  101. package/.agent-src/skills/lint-skills/SKILL.md +3 -3
  102. package/.agent-src/skills/md-language-check/SKILL.md +2 -2
  103. package/.agent-src/skills/module-detect-on-the-fly/SKILL.md +138 -0
  104. package/.agent-src/skills/module-management/SKILL.md +166 -94
  105. package/.agent-src/skills/override-management/SKILL.md +1 -1
  106. package/.agent-src/skills/persona-writing/SKILL.md +5 -5
  107. package/.agent-src/skills/positioning-strategy/SKILL.md +1 -1
  108. package/.agent-src/skills/project-docs/SKILL.md +6 -4
  109. package/.agent-src/skills/readme-reviewer/SKILL.md +2 -2
  110. package/.agent-src/skills/roadmap-management/SKILL.md +13 -1
  111. package/.agent-src/skills/roadmap-writing/SKILL.md +4 -2
  112. package/.agent-src/skills/rule-refactor/SKILL.md +5 -5
  113. package/.agent-src/skills/rule-writing/SKILL.md +18 -18
  114. package/.agent-src/skills/script-writing/SKILL.md +1 -1
  115. package/.agent-src/skills/skill-improvement-pipeline/SKILL.md +6 -6
  116. package/.agent-src/skills/skill-management/SKILL.md +21 -21
  117. package/.agent-src/skills/skill-reviewer/SKILL.md +2 -2
  118. package/.agent-src/skills/skill-writing/SKILL.md +8 -8
  119. package/.agent-src/skills/skill-writing/evals/triggers.json +1 -1
  120. package/.agent-src/skills/token-optimizer/SKILL.md +4 -4
  121. package/.agent-src/skills/unit-economics-modeling/SKILL.md +1 -1
  122. package/.agent-src/skills/upstream-contribute/SKILL.md +17 -17
  123. package/.agent-src/templates/AGENTS.md +1 -0
  124. package/.agent-src/templates/agent-settings.md +24 -13
  125. package/.agent-src/templates/agents/agent-project-settings.example.yml +61 -2
  126. package/.agent-src/templates/command.md +5 -5
  127. package/.agent-src/templates/contexts.md +1 -1
  128. package/.agent-src/templates/copilot-instructions.md +8 -8
  129. package/.agent-src/templates/features.md +1 -1
  130. package/.agent-src/templates/hooks/pre-commit-frontmatter +2 -2
  131. package/.agent-src/templates/hooks/pre-commit-roadmap-progress +3 -3
  132. package/.agent-src/templates/persona.md +2 -2
  133. package/.agent-src/templates/roadmaps.md +1 -1
  134. package/.agent-src/templates/rule.md +13 -13
  135. package/.agent-src/templates/scripts/memory_lookup.py +1 -1
  136. package/.agent-src/templates/scripts/memory_status.py +2 -2
  137. package/.agent-src/templates/scripts/work_engine/_lib/agent_settings.py +195 -1
  138. package/.agent-src/templates/scripts/work_engine/orchestration.py +1 -1
  139. package/.agent-src/templates/skill-archive-note.md +5 -5
  140. package/.agent-src/templates/skill.md +1 -1
  141. package/.claude-plugin/marketplace.json +4 -4
  142. package/AGENTS.md +16 -17
  143. package/CHANGELOG.md +181 -3
  144. package/CONTRIBUTING.md +31 -12
  145. package/README.md +18 -10
  146. package/config/agent-settings.template.yml +22 -2
  147. package/config/discovery/unassigned-artefacts.yml +24 -24
  148. package/config/profiles/full.ini +1 -1
  149. package/dist/cli/agent-config.js +52 -3
  150. package/dist/cli/agent-config.js.map +1 -1
  151. package/dist/cli/commands/uiServe.js +9 -0
  152. package/dist/cli/commands/uiServe.js.map +1 -1
  153. package/dist/cli/registry.js +2 -1
  154. package/dist/cli/registry.js.map +1 -1
  155. package/dist/discovery/deprecation-report.md +1 -1
  156. package/dist/discovery/discovery-manifest.json +649 -606
  157. package/dist/discovery/discovery-manifest.json.sha256 +1 -1
  158. package/dist/discovery/discovery-manifest.summary.md +4 -4
  159. package/dist/discovery/orphan-report.md +1 -1
  160. package/dist/discovery/packs.json +439 -437
  161. package/dist/discovery/trust-report.md +5 -5
  162. package/dist/discovery/workspaces.json +450 -448
  163. package/dist/install/apply.js +238 -0
  164. package/dist/install/apply.js.map +1 -0
  165. package/dist/install/atomic.js +92 -0
  166. package/dist/install/atomic.js.map +1 -0
  167. package/dist/install/bridges/augment.js +20 -0
  168. package/dist/install/bridges/augment.js.map +1 -0
  169. package/dist/install/bridges/claude.js +44 -0
  170. package/dist/install/bridges/claude.js.map +1 -0
  171. package/dist/install/bridges/cline.js +69 -0
  172. package/dist/install/bridges/cline.js.map +1 -0
  173. package/dist/install/bridges/copilot.js +28 -0
  174. package/dist/install/bridges/copilot.js.map +1 -0
  175. package/dist/install/bridges/cursor.js +34 -0
  176. package/dist/install/bridges/cursor.js.map +1 -0
  177. package/dist/install/bridges/gemini.js +39 -0
  178. package/dist/install/bridges/gemini.js.map +1 -0
  179. package/dist/install/bridges/index.js +88 -0
  180. package/dist/install/bridges/index.js.map +1 -0
  181. package/dist/install/bridges/marker-content.js +153 -0
  182. package/dist/install/bridges/marker-content.js.map +1 -0
  183. package/dist/install/bridges/markers.js +42 -0
  184. package/dist/install/bridges/markers.js.map +1 -0
  185. package/dist/install/bridges/types.js +31 -0
  186. package/dist/install/bridges/types.js.map +1 -0
  187. package/dist/install/bridges/vscode.js +26 -0
  188. package/dist/install/bridges/vscode.js.map +1 -0
  189. package/dist/install/bridges/windsurf.js +35 -0
  190. package/dist/install/bridges/windsurf.js.map +1 -0
  191. package/dist/install/conflict.js +196 -0
  192. package/dist/install/conflict.js.map +1 -0
  193. package/dist/install/detect.js +218 -0
  194. package/dist/install/detect.js.map +1 -0
  195. package/dist/install/paths.js +82 -0
  196. package/dist/install/paths.js.map +1 -0
  197. package/dist/install/plan.js +157 -0
  198. package/dist/install/plan.js.map +1 -0
  199. package/dist/install/txlog.js +140 -0
  200. package/dist/install/txlog.js.map +1 -0
  201. package/dist/install/types.js +19 -0
  202. package/dist/install/types.js.map +1 -0
  203. package/dist/install/wizard-plan.js +184 -0
  204. package/dist/install/wizard-plan.js.map +1 -0
  205. package/dist/mcp/registry-manifest.json +4 -4
  206. package/dist/router.json +67 -19
  207. package/dist/server/app.js +6 -0
  208. package/dist/server/app.js.map +1 -1
  209. package/dist/server/routes/install.js +547 -0
  210. package/dist/server/routes/install.js.map +1 -0
  211. package/dist/server/routes/wizard.js +301 -6
  212. package/dist/server/routes/wizard.js.map +1 -1
  213. package/dist/server/routes/workspace.js +396 -0
  214. package/dist/server/routes/workspace.js.map +1 -0
  215. package/dist/server/schemas/settings.js +4 -3
  216. package/dist/server/schemas/settings.js.map +1 -1
  217. package/dist/ui/assets/index-BXZILUxe.css +1 -0
  218. package/dist/ui/assets/index-DLEuEW1V.js +35 -0
  219. package/dist/ui/assets/index-DLEuEW1V.js.map +1 -0
  220. package/dist/ui/index.html +2 -2
  221. package/docs/MIGRATION.md +1 -1
  222. package/docs/adrs/cost/0001-hard-stop-hook.md +1 -1
  223. package/docs/adrs/router/0001-three-tier-routing.md +4 -4
  224. package/docs/adrs/schema/0001-json-schema-frontmatter.md +1 -1
  225. package/docs/adrs/smoke/0001-per-tier-smoke-scripts.md +4 -4
  226. package/docs/adrs/{caveman → telegraph}/0001-default-off-until-bench.md +9 -9
  227. package/docs/adrs/telegraph/README.md +9 -0
  228. package/docs/architecture/augment-projection.md +4 -4
  229. package/docs/architecture/claude-bundle.md +1 -1
  230. package/docs/architecture/current-onboard-baseline.md +3 -3
  231. package/docs/architecture/multi-tool-projection.md +10 -10
  232. package/docs/architecture/source-projection.md +27 -27
  233. package/docs/architecture.md +19 -15
  234. package/docs/archive/CHANGELOG-pre-2.11.0.md +2 -2
  235. package/docs/archive/CHANGELOG-pre-2.15.0.md +3 -3
  236. package/docs/archive/CHANGELOG-pre-2.16.0.md +1 -1
  237. package/docs/archive/CHANGELOG-pre-2.2.0.md +70 -70
  238. package/docs/archive/CHANGELOG-pre-2.20.0.md +2 -2
  239. package/docs/archive/CHANGELOG-pre-2.25.0.md +15 -15
  240. package/docs/archive/CHANGELOG-pre-3.0.0.md +4 -4
  241. package/docs/archive/CHANGELOG-pre-3.1.0.md +2 -2
  242. package/docs/archive/CHANGELOG-pre-3.2.0.md +3 -3
  243. package/docs/benchmark.md +65 -0
  244. package/docs/benchmarks.md +16 -16
  245. package/docs/catalog.md +17 -15
  246. package/docs/contracts/CHANGELOG-conventions.md +1 -1
  247. package/docs/contracts/STABILITY.md +2 -2
  248. package/docs/contracts/adoption-signal-floor.md +110 -0
  249. package/docs/contracts/adr-chat-history-split.md +4 -4
  250. package/docs/contracts/adr-command-suggestion.md +4 -4
  251. package/docs/contracts/adr-gtm-context-spine.md +1 -1
  252. package/docs/contracts/adr-implement-ticket-runtime.md +4 -4
  253. package/docs/contracts/adr-install-user-type-axis.md +1 -1
  254. package/docs/contracts/adr-layout.md +2 -2
  255. package/docs/contracts/adr-product-ui-track.md +10 -10
  256. package/docs/contracts/adr-user-types-axis.md +3 -3
  257. package/docs/contracts/adr-wing4-context-spine.md +1 -1
  258. package/docs/contracts/agent-memory-contract.md +3 -3
  259. package/docs/contracts/agents-md-tech-stack.md +2 -2
  260. package/docs/contracts/ai-council-config.md +2 -2
  261. package/docs/contracts/at-rest-encryption.md +4 -0
  262. package/docs/contracts/audit-log-v1.md +1 -1
  263. package/docs/contracts/benchmark-ab-contract.md +101 -0
  264. package/docs/contracts/benchmark-corpus-spec.md +1 -1
  265. package/docs/contracts/branch-protection-policy.md +98 -0
  266. package/docs/contracts/ci-cost-budget.md +106 -0
  267. package/docs/contracts/ci-green-floor.md +141 -0
  268. package/docs/contracts/command-clusters.md +6 -6
  269. package/docs/contracts/command-surface-tiers.md +2 -2
  270. package/docs/contracts/command-taxonomy.md +2 -2
  271. package/docs/contracts/{compression-default-kill-criterion.md → condensation-default-kill-criterion.md} +29 -29
  272. package/docs/contracts/config-presets.md +1 -1
  273. package/docs/contracts/context-paths.md +3 -3
  274. package/docs/contracts/context-spine.md +1 -1
  275. package/docs/contracts/cost-summary-schema.md +12 -12
  276. package/docs/contracts/cross-wing-handoff.md +4 -4
  277. package/docs/contracts/daily-workspace.md +4 -0
  278. package/docs/contracts/decision-trace-v1.md +2 -2
  279. package/docs/contracts/discovery-manifest.md +4 -4
  280. package/docs/contracts/explain-modes.md +4 -0
  281. package/docs/contracts/file-ownership-matrix.json +3493 -3318
  282. package/docs/contracts/file-ownership-matrix.md +3 -3
  283. package/docs/contracts/frontmatter-contract.md +4 -4
  284. package/docs/contracts/ghostwriter-schema.md +3 -3
  285. package/docs/contracts/gui-wizard.md +1 -1
  286. package/docs/contracts/harness-expectations.md +123 -0
  287. package/docs/contracts/host-agent-protocol.md +4 -0
  288. package/docs/contracts/implement-ticket-flow.md +9 -9
  289. package/docs/contracts/install-scopes.md +77 -0
  290. package/docs/contracts/iron-law-overrides.txt +1 -1
  291. package/docs/contracts/kernel-membership.md +26 -26
  292. package/docs/contracts/linear-ai-rules-inclusion.md +1 -1
  293. package/docs/contracts/linter-structural-model.md +2 -2
  294. package/docs/contracts/load-context-budget-model.md +4 -4
  295. package/docs/contracts/load-context-schema.md +13 -13
  296. package/docs/contracts/local-analytics.md +4 -0
  297. package/docs/contracts/local-knowledge-ingestion.md +1 -1
  298. package/docs/contracts/mcp-cloud-scope.md +2 -2
  299. package/docs/contracts/mcp-phase-1-scope.md +3 -3
  300. package/docs/contracts/measurement-baseline.md +5 -5
  301. package/docs/contracts/mental-models.md +30 -30
  302. package/docs/contracts/multi-tool-projection-fidelity.md +4 -4
  303. package/docs/contracts/namespace.md +4 -4
  304. package/docs/contracts/orchestration-dsl-v1.md +7 -7
  305. package/docs/contracts/package-self-orientation.md +12 -12
  306. package/docs/contracts/persona-schema.md +6 -6
  307. package/docs/contracts/pilot/language-and-tone.md +1 -1
  308. package/docs/contracts/plain-language-surface.md +117 -0
  309. package/docs/contracts/profile-system.md +3 -3
  310. package/docs/contracts/release-pr-gating.md +103 -0
  311. package/docs/contracts/role-experience.md +3 -3
  312. package/docs/contracts/rule-classification.md +13 -13
  313. package/docs/contracts/rule-interactions.md +4 -4
  314. package/docs/contracts/rule-interactions.yml +30 -30
  315. package/docs/contracts/rule-priority-hierarchy.md +13 -13
  316. package/docs/contracts/rule-router.md +2 -2
  317. package/docs/contracts/safety-model.md +1 -1
  318. package/docs/contracts/skill-distribution-channels.md +61 -0
  319. package/docs/contracts/skill-domains.md +2 -2
  320. package/docs/contracts/smoke-contracts.md +5 -5
  321. package/docs/contracts/telegraph-telemetry.md +83 -0
  322. package/docs/contracts/trust-and-safety.md +5 -5
  323. package/docs/contracts/ui-stack-extension.md +7 -7
  324. package/docs/contracts/ui-track-flow.md +9 -9
  325. package/docs/contracts/user-type-schema.md +4 -4
  326. package/docs/contracts/workflow-packs.md +4 -4
  327. package/docs/contracts/workspace-documents.md +4 -0
  328. package/docs/customization.md +28 -8
  329. package/docs/decisions/ADR-001-kernel-swap-deferred.md +6 -6
  330. package/docs/decisions/ADR-002-kernel-bucket-overrides.md +11 -11
  331. package/docs/decisions/ADR-003-flat-cluster-subs-and-colon-syntax.md +2 -2
  332. package/docs/decisions/ADR-004-rule-governance-pruning.md +4 -4
  333. package/docs/decisions/ADR-005-subagent-worktrees.md +7 -7
  334. package/docs/decisions/ADR-011-domain-pack-readiness.md +6 -6
  335. package/docs/decisions/ADR-013-discovery-frontmatter-contract.md +3 -3
  336. package/docs/decisions/ADR-015-discovery-manifest-contract.md +3 -3
  337. package/docs/decisions/ADR-017-monorepo-physical-layout.md +10 -10
  338. package/docs/decisions/ADR-018-trust-and-safety-layer.md +6 -6
  339. package/docs/decisions/ADR-019-router-json-dist-location.md +2 -2
  340. package/docs/decisions/ADR-020-global-only-consumer-scope.md +2 -2
  341. package/docs/decisions/ADR-021-deployment-shape.md +1 -1
  342. package/docs/decisions/ADR-022-daily-workspace-decomposition.md +1 -1
  343. package/docs/decisions/ADR-027-changelog-machine-vs-manual.md +2 -2
  344. package/docs/decisions/ADR-028-root-layout.md +7 -7
  345. package/docs/decisions/ADR-029-multi-workspace-deferred.md +2 -2
  346. package/docs/decisions/ADR-rule-kernel-and-router.md +5 -5
  347. package/docs/deploy/team-deployment-posture.md +20 -0
  348. package/docs/development.md +17 -17
  349. package/docs/distribution/registries.md +32 -0
  350. package/docs/distribution/registry-submissions.md +85 -0
  351. package/docs/distribution/telemetry-schema.md +1 -1
  352. package/docs/getting-started-by-role.md +45 -3
  353. package/docs/getting-started.md +2 -2
  354. package/docs/guidelines/agent-infra/5w2h-analysis.md +3 -3
  355. package/docs/guidelines/agent-infra/ask-when-uncertain-demos.md +1 -1
  356. package/docs/guidelines/agent-infra/asking-and-brevity-examples.md +3 -3
  357. package/docs/guidelines/agent-infra/carve-out-predicates.md +3 -3
  358. package/docs/guidelines/agent-infra/critical-thinking.md +4 -4
  359. package/docs/guidelines/agent-infra/direct-answers-demos.md +1 -1
  360. package/docs/guidelines/agent-infra/first-principles.md +2 -2
  361. package/docs/guidelines/agent-infra/inversion-thinking.md +5 -5
  362. package/docs/guidelines/agent-infra/layered-settings.md +56 -2
  363. package/docs/guidelines/agent-infra/mental-models.md +3 -3
  364. package/docs/guidelines/agent-infra/roadmap-progress-mechanics.md +2 -2
  365. package/docs/guidelines/agent-infra/rule-type-governance.md +1 -1
  366. package/docs/guidelines/agent-infra/scqa-framework.md +5 -5
  367. package/docs/guidelines/agent-infra/self-improvement-pipeline.md +2 -2
  368. package/docs/guidelines/agent-infra/six-hats.md +3 -3
  369. package/docs/guidelines/agent-infra/skill-quality-checklist.md +5 -5
  370. package/docs/guidelines/agent-infra/systems-thinking.md +1 -1
  371. package/docs/guidelines/agent-infra/verify-before-complete-demos.md +1 -1
  372. package/docs/guidelines/augment-portability-patterns.md +4 -4
  373. package/docs/guidelines/cross-role-handoff.md +2 -2
  374. package/docs/guidelines/php/php-coding-patterns.md +1 -1
  375. package/docs/guidelines/prompt-templates.md +6 -6
  376. package/docs/maintainers/dev-mode.md +1 -1
  377. package/docs/mcp.md +1 -1
  378. package/docs/parity/bench.json +3 -3
  379. package/docs/parity/ruflo.md +2 -2
  380. package/docs/profiles.md +11 -11
  381. package/docs/quality.md +11 -11
  382. package/docs/safety.md +3 -3
  383. package/docs/setup/mcp-client-config.md +1 -1
  384. package/docs/setup/mcp-r2-bootstrap.md +1 -1
  385. package/docs/setup/mcp-server-docker.md +3 -3
  386. package/docs/setup/per-ide/windsurf.md +1 -1
  387. package/docs/skills-catalog.md +8 -7
  388. package/docs/troubleshooting.md +1 -1
  389. package/docs/walkthroughs/daily-workspace-a11y.md +87 -0
  390. package/llms.txt +7 -6
  391. package/package.json +1 -1
  392. package/scripts/__pycache__/validate_frontmatter.cpython-312.pyc +0 -0
  393. package/scripts/_archive/README.md +2 -2
  394. package/scripts/_archive/_backfill_skill_domains.py +3 -3
  395. package/scripts/_archive/_bootstrap_tier_frontmatter.py +3 -3
  396. package/scripts/_archive/_p43_bodies.py +10 -10
  397. package/scripts/_archive/{_p43_compress.py → _p43_condense.py} +5 -5
  398. package/scripts/_archive/_p4_migrate.py +7 -7
  399. package/scripts/_archive/_phase2_shim_helper.py +1 -1
  400. package/scripts/_archive/_pilot_council_question.py +5 -5
  401. package/scripts/_cli/explain_last/inputs.py +1 -1
  402. package/scripts/_lib/__pycache__/__init__.cpython-312.pyc +0 -0
  403. package/scripts/_lib/__pycache__/agent_src.cpython-312.pyc +0 -0
  404. package/scripts/_lib/agent_settings.py +195 -1
  405. package/scripts/_lib/agent_src.py +19 -19
  406. package/scripts/_lib/bench_ab_cache.py +162 -0
  407. package/scripts/_lib/bench_ab_scoring.py +209 -0
  408. package/scripts/_lib/{bench_caveman.py → bench_telegraph.py} +21 -21
  409. package/scripts/_lib/{bench_caveman_report.py → bench_telegraph_report.py} +21 -21
  410. package/scripts/_lib/claude_desktop_bundler.py +5 -5
  411. package/scripts/_lib/module_detection.py +223 -0
  412. package/scripts/_lib/scope_guard.sh +162 -0
  413. package/scripts/_phase4_bucket.py +3 -3
  414. package/scripts/_pilot_measure.py +4 -4
  415. package/scripts/_tmp_scan_framework_leakage.py +1 -1
  416. package/scripts/adoption_report.py +195 -0
  417. package/scripts/adoption_snapshot.py +219 -0
  418. package/scripts/adoption_status.py +166 -0
  419. package/scripts/ai-video/lib/parse-blueprint.sh +1 -1
  420. package/scripts/ai_council/advisors.py +5 -5
  421. package/scripts/ai_council/compile_corpus.py +1 -1
  422. package/scripts/ai_council/one_off_archive/2026-05/_one_off_budget_v2_audit.py +3 -3
  423. package/scripts/ai_council/one_off_archive/2026-05/_one_off_context_layer_v1_review.py +2 -2
  424. package/scripts/ai_council/one_off_archive/2026-05/_one_off_inject_quiet_flag.py +1 -1
  425. package/scripts/ai_council/one_off_archive/2026-05/_one_off_measure_v2.sh +1 -1
  426. package/scripts/ai_council/one_off_archive/2026-05/_one_off_measure_verbosity.sh +1 -1
  427. package/scripts/ai_council/one_off_archive/2026-05/_one_off_nondestructive_inline_audit.py +3 -3
  428. package/scripts/ai_council/one_off_archive/2026-05/_one_off_per_task.sh +1 -1
  429. package/scripts/ai_council/one_off_archive/2026-05/_one_off_phase6_trigger_jaccard.py +1 -1
  430. package/scripts/ai_council/one_off_archive/2026-05/_one_off_phase_2a_budget_rebalance.py +6 -6
  431. package/scripts/ai_council/one_off_archive/2026-05/_one_off_rebalancing_audit.py +1 -1
  432. package/scripts/ai_council/one_off_archive/2026-05/_one_off_tier_retrofit.py +6 -6
  433. package/scripts/annotate_discovery.py +13 -13
  434. package/scripts/apply_modules_config.py +290 -0
  435. package/scripts/audit_adr_coverage.py +2 -2
  436. package/scripts/audit_auto_rules.py +2 -2
  437. package/scripts/audit_cloud_compatibility.py +3 -3
  438. package/scripts/audit_command_surface.py +9 -9
  439. package/scripts/audit_likelihood.py +2 -2
  440. package/scripts/audit_user_type_axis.py +2 -2
  441. package/scripts/bench_ab_cache_dispatch.py +68 -0
  442. package/scripts/bench_ab_clone.py +170 -0
  443. package/scripts/bench_ab_diff.py +227 -0
  444. package/scripts/bench_ab_integrity.py +143 -0
  445. package/scripts/bench_ab_run.py +235 -0
  446. package/scripts/bench_ab_task_runner.py +369 -0
  447. package/scripts/bench_ab_tracka_run.py +202 -0
  448. package/scripts/{bench_compress_memory.py → bench_condense_memory.py} +16 -16
  449. package/scripts/bench_run.py +33 -33
  450. package/scripts/bench_runner.py +2 -2
  451. package/scripts/bootstrap.sh +99 -0
  452. package/scripts/build_cloud_bundle.py +6 -6
  453. package/scripts/build_discovery_manifest.py +7 -7
  454. package/scripts/build_linear_digest.py +3 -3
  455. package/scripts/build_rule_trigger_matrix.py +8 -8
  456. package/scripts/chat_history.py +5 -5
  457. package/scripts/check_always_budget.py +11 -5
  458. package/scripts/check_augment_description_cap.py +3 -3
  459. package/scripts/check_cluster_patterns.py +2 -2
  460. package/scripts/check_command_count_messaging.py +3 -3
  461. package/scripts/{check_compression.py → check_condensation.py} +34 -34
  462. package/scripts/{check_compressed_paths.py → check_condensed_paths.py} +8 -8
  463. package/scripts/check_context_paths.py +7 -7
  464. package/scripts/check_council_layout.py +2 -2
  465. package/scripts/check_council_references.py +9 -9
  466. package/scripts/check_iron_law_prominence.py +2 -2
  467. package/scripts/check_kernel_rule_bundle.py +2 -2
  468. package/scripts/check_module_management_neutral.py +149 -0
  469. package/scripts/check_no_roadmap_refs.py +9 -9
  470. package/scripts/check_portability.py +3 -3
  471. package/scripts/check_public_catalog_links.py +4 -4
  472. package/scripts/check_references.py +7 -6
  473. package/scripts/check_release_pr_shape.py +112 -0
  474. package/scripts/check_reply_consistency.py +3 -3
  475. package/scripts/check_safety_floor_untouched.py +1 -1
  476. package/scripts/check_template_pin_drift.py +5 -5
  477. package/scripts/check_token_optimizer_freshness.py +3 -3
  478. package/scripts/ci_status.py +301 -0
  479. package/scripts/ci_time_ratio.py +1 -1
  480. package/scripts/cleanup_other_scope.sh +146 -0
  481. package/scripts/compile_router.py +10 -10
  482. package/scripts/{compress.py → condense.py} +64 -64
  483. package/scripts/condense.sh +18 -0
  484. package/scripts/{compress_memory.py → condense_memory.py} +33 -33
  485. package/scripts/config/presets.py +2 -2
  486. package/scripts/config/profiles.py +1 -1
  487. package/scripts/cost_by_conversation.py +3 -3
  488. package/scripts/cost_summary.py +7 -7
  489. package/scripts/count_token_optimizer_usage.sh +1 -1
  490. package/scripts/gen_discovery_baseline.py +5 -5
  491. package/scripts/generate_index.py +6 -6
  492. package/scripts/generate_ownership_matrix.py +10 -10
  493. package/scripts/generate_pack_manifests.py +1 -1
  494. package/scripts/ghostwriter_fixture_allowlist.txt +1 -1
  495. package/scripts/install +3 -3
  496. package/scripts/install-hooks.sh +6 -6
  497. package/scripts/install.py +76 -11
  498. package/scripts/install.sh +187 -1
  499. package/scripts/inventory_frontmatter.py +2 -2
  500. package/scripts/iron_law_sha.py +3 -3
  501. package/scripts/lint_agents_layout.py +14 -7
  502. package/scripts/lint_agents_md.py +4 -4
  503. package/scripts/lint_archived_skills.py +3 -3
  504. package/scripts/lint_artefact_frontmatter.py +2 -2
  505. package/scripts/lint_bench_ab.py +172 -0
  506. package/scripts/lint_bench_corpus.py +1 -1
  507. package/scripts/lint_command_tiers.py +5 -5
  508. package/scripts/lint_context_spine_usage.py +1 -1
  509. package/scripts/lint_framework_leakage.py +7 -7
  510. package/scripts/lint_framework_leakage_allowlist.json +144 -84
  511. package/scripts/lint_ghostwriter_source.py +3 -3
  512. package/scripts/lint_handoffs.py +1 -1
  513. package/scripts/lint_load_context.py +11 -11
  514. package/scripts/lint_media_policy_linkage.py +5 -5
  515. package/scripts/lint_namespace.py +1 -1
  516. package/scripts/lint_no_new_atomic_commands.py +2 -2
  517. package/scripts/lint_orchestration_dsl.py +1 -1
  518. package/scripts/lint_pack_boundaries.py +2 -2
  519. package/scripts/lint_persona_governance.py +4 -4
  520. package/scripts/lint_role_experiences.py +237 -0
  521. package/scripts/lint_rule_interactions.py +2 -2
  522. package/scripts/lint_rule_tiers.py +1 -1
  523. package/scripts/lint_trust_coherence.py +2 -2
  524. package/scripts/mcp_registry_submit.sh +187 -0
  525. package/scripts/mcp_server/tools.py +1 -1
  526. package/scripts/measure_frugality_savings.py +10 -10
  527. package/scripts/measure_patterns.py +1 -1
  528. package/scripts/measure_projection_bytes.py +5 -5
  529. package/scripts/measure_rule_budget.py +3 -3
  530. package/scripts/measure_skill_reduction.py +1 -1
  531. package/scripts/memory_lookup.py +1 -1
  532. package/scripts/memory_status.py +2 -2
  533. package/scripts/migrate_command_suggestions.py +3 -3
  534. package/scripts/mine_session.py +1 -1
  535. package/scripts/move_artefact.py +3 -3
  536. package/scripts/new_skill.py +2 -2
  537. package/scripts/pack_mcp_content.py +9 -9
  538. package/scripts/plan_physical_move.py +6 -6
  539. package/scripts/print_required_checks.py +196 -0
  540. package/scripts/probe_skill_registration.py +413 -0
  541. package/scripts/propose_modules_config.py +145 -0
  542. package/scripts/prototype_lint_contradictions.py +1 -1
  543. package/scripts/recruit_preflight.sh +152 -0
  544. package/scripts/refine_ticket_detect.py +3 -3
  545. package/scripts/release.py +20 -0
  546. package/scripts/render_benchmark_md.py +308 -0
  547. package/scripts/roadmap_progress_hook.py +1 -1
  548. package/scripts/run_skill_evals.py +2 -2
  549. package/scripts/runtime_registry.py +4 -4
  550. package/scripts/schemas/command.schema.json +4 -4
  551. package/scripts/schemas/rule.schema.json +5 -5
  552. package/scripts/schemas/skill.schema.json +3 -3
  553. package/scripts/schemas/user-type.schema.json +1 -1
  554. package/scripts/score_skill_selection.py +1 -1
  555. package/scripts/skill_collision_clusters.py +2 -2
  556. package/scripts/skill_linter.py +81 -81
  557. package/scripts/skill_overlap.py +5 -5
  558. package/scripts/skill_tools/audit_persona_coverage.py +2 -2
  559. package/scripts/skill_tools/audit_user_type_coverage.py +2 -2
  560. package/scripts/skill_tools/run_block_d_eval.py +1 -1
  561. package/scripts/skill_tools/score_skill_relevance.py +1 -1
  562. package/scripts/skill_tools/suggest_skill_for_task.py +1 -1
  563. package/scripts/skill_trigger_eval.py +3 -3
  564. package/scripts/smoke/kernel.sh +7 -1
  565. package/scripts/smoke/router.sh +5 -5
  566. package/scripts/smoke/skills.sh +1 -1
  567. package/scripts/smoke_quickstart.py +1 -1
  568. package/scripts/snapshot_agent_outputs.py +3 -3
  569. package/scripts/spotcheck_thin_root.py +1 -1
  570. package/scripts/{caveman_stats.py → telegraph_stats.py} +18 -18
  571. package/scripts/update_counts.py +1 -1
  572. package/scripts/validate_decision_engine.py +1 -1
  573. package/scripts/validate_frontmatter.py +1 -1
  574. package/scripts/validate_safe_paths.py +3 -3
  575. package/scripts/{validate_caveman_carveouts.py → validate_telegraph_carveouts.py} +7 -7
  576. package/scripts/verify_roadmap_closure.py +6 -6
  577. package/templates/consumer-settings/ONBOARDING.md +41 -0
  578. package/.agent-src/commands/install-via-agent.md +0 -129
  579. package/.agent-src/skills/compress-memory/SKILL.md +0 -131
  580. package/dist/ui/assets/index-D-DY1ywI.js +0 -35
  581. package/dist/ui/assets/index-D-DY1ywI.js.map +0 -1
  582. package/dist/ui/assets/index-Dqfhmg-d.css +0 -1
  583. package/docs/adrs/caveman/README.md +0 -9
  584. package/docs/contracts/caveman-telemetry.md +0 -83
  585. package/scripts/compress.sh +0 -18
@@ -0,0 +1,238 @@
1
+ /**
2
+ * Apply orchestrator \u2014 Phase A4 (atomic writes + transaction log).
3
+ *
4
+ * Consumes an {@link InstallPlan} produced by `plan.ts:buildInstallPlan`
5
+ * and walks every {@link FileEntry}, copying source bytes into the
6
+ * declared target with {@link atomicWriteFile}. Each successful write
7
+ * appends one {@link TxLogEntry} (kind=`write`) to the transaction log
8
+ * so a recovery pass on next boot can reverse-apply on crash.
9
+ *
10
+ * Pure orchestration:
11
+ * - No path recomputation (the plan is the source of truth).
12
+ * - No re-walking of the source tree.
13
+ * - SHA-256 idempotency: skip an entry whose target already exists
14
+ * with matching bytes, unless `force=true` flips the policy.
15
+ *
16
+ * Progress is surfaced via the optional `onProgress` callback so the
17
+ * Fastify SSE adapter (Phase B1) can stream per-file events to the
18
+ * Preact wizard.
19
+ */
20
+ import { existsSync, readFileSync } from 'node:fs';
21
+ import { atomicWriteFile } from './atomic.js';
22
+ import { isJsonTarget, mergeJsonContent, parseJsonLenient, resolveFileConflict, } from './conflict.js';
23
+ import { sha256File } from './plan.js';
24
+ import { appendTxLog } from './txlog.js';
25
+ /**
26
+ * Execute an {@link InstallPlan}.
27
+ *
28
+ * One pass through every entry. Writes are atomic (write-to-temp +
29
+ * rename); the txlog records each success so recovery can reverse-apply.
30
+ *
31
+ * Returns {@link ApplyResult} aggregating per-file outcomes. Never
32
+ * throws on individual file errors \u2014 errors land in
33
+ * {@link ApplyResult.errors} so the wizard can render a partial-success
34
+ * screen rather than crashing the install.
35
+ */
36
+ export function applyPlan(inputs) {
37
+ const { plan, sourceByTarget, logPath, onProgress, resolutions } = inputs;
38
+ const all = flattenEntries(plan);
39
+ const acc = newAccumulator();
40
+ let index = 0;
41
+ for (const entry of all) {
42
+ index += 1;
43
+ processEntry(entry, plan, sourceByTarget, logPath, acc, index, all.length, onProgress, resolutions);
44
+ }
45
+ return { target: plan.target, ...acc };
46
+ }
47
+ /**
48
+ * Async streaming variant — yields the event loop between entries so an
49
+ * {@link AbortSignal} fired by a disconnecting SSE client can stop the
50
+ * loop. Each entry still executes synchronously (atomic write + txlog
51
+ * append) so a mid-write abort is impossible; aborts land between
52
+ * entries and append a single `abort` marker before resolving.
53
+ *
54
+ * Council Finding #24: SSE handlers must wire `req.on("close")` to an
55
+ * `AbortController` and pass the signal here so half-applied installs
56
+ * surface a clean partial result instead of a zombie loop.
57
+ */
58
+ export async function applyPlanStreaming(inputs) {
59
+ const { plan, sourceByTarget, logPath, onProgress, signal, resolutions } = inputs;
60
+ const all = flattenEntries(plan);
61
+ const acc = newAccumulator();
62
+ let index = 0;
63
+ for (const entry of all) {
64
+ if (signal?.aborted === true) {
65
+ appendTxLog(logPath, {
66
+ ts: new Date().toISOString(),
67
+ kind: 'abort',
68
+ path: entry.path,
69
+ sha256: null,
70
+ note: 'client disconnect',
71
+ });
72
+ break;
73
+ }
74
+ index += 1;
75
+ processEntry(entry, plan, sourceByTarget, logPath, acc, index, all.length, onProgress, resolutions);
76
+ // Yield to the event loop so the abort signal can fire and any
77
+ // SSE write buffers can drain before the next entry.
78
+ await new Promise((resolve) => setImmediate(resolve));
79
+ }
80
+ return { target: plan.target, ...acc };
81
+ }
82
+ function newAccumulator() {
83
+ return { written: [], skipped: [], conflicts: [], errors: [] };
84
+ }
85
+ function flattenEntries(plan) {
86
+ const all = [];
87
+ for (const entries of Object.values(plan.filesByTool)) {
88
+ for (const e of entries)
89
+ all.push(e);
90
+ }
91
+ return all;
92
+ }
93
+ /**
94
+ * Process one {@link FileEntry} — resolve conflict, write or skip, append
95
+ * txlog, push to accumulator, emit progress.
96
+ *
97
+ * Shared by sync {@link applyPlan} and async {@link applyPlanStreaming}
98
+ * so the conflict matrix lives in one place.
99
+ */
100
+ function processEntry(entry, plan, sourceByTarget, logPath, acc, index, total, onProgress, resolutions) {
101
+ try {
102
+ if (entry.kind === 'bridge') {
103
+ // Bridges are pointers we don't own bytes-for-bytes — skip
104
+ // them at the apply layer; bridge generators (A6) produce
105
+ // them via their own writer pass.
106
+ acc.skipped.push(entry);
107
+ onProgress?.({ file: entry, written: index, total, status: 'skipped' });
108
+ return;
109
+ }
110
+ const source = sourceByTarget.get(entry.path);
111
+ if (source === undefined) {
112
+ acc.errors.push({
113
+ path: entry.path,
114
+ code: 'E_PLAN_MISSING_SOURCE',
115
+ message: 'no source mapping for target path',
116
+ });
117
+ onProgress?.({
118
+ file: entry,
119
+ written: index,
120
+ total,
121
+ status: 'error',
122
+ error: { code: 'E_PLAN_MISSING_SOURCE', message: 'no source mapping' },
123
+ });
124
+ return;
125
+ }
126
+ const idempotent = isIdempotent(entry, plan);
127
+ const exists = existsSync(entry.path);
128
+ const outcome = resolveFileConflict({
129
+ targetPath: entry.path,
130
+ idempotent,
131
+ exists,
132
+ policy: plan.policy,
133
+ });
134
+ if (outcome === 'skip') {
135
+ acc.skipped.push(entry);
136
+ onProgress?.({ file: entry, written: index, total, status: 'skipped' });
137
+ return;
138
+ }
139
+ if (outcome === 'surface') {
140
+ // Phase B3 — the wizard may have pre-resolved this conflict
141
+ // before the apply call. The `resolutions` map is keyed by
142
+ // absolute target path. Missing keys → unresolved conflict
143
+ // (acc.conflicts) so the wizard surfaces them again. An
144
+ // explicit `skip` resolution → acc.skipped: the user decided
145
+ // to leave the file alone, that is a settled outcome.
146
+ const resolution = resolutions?.get(entry.path);
147
+ if (resolution === undefined) {
148
+ acc.conflicts.push(entry);
149
+ onProgress?.({ file: entry, written: index, total, status: 'conflict' });
150
+ return;
151
+ }
152
+ if (resolution === 'skip') {
153
+ acc.skipped.push(entry);
154
+ onProgress?.({ file: entry, written: index, total, status: 'skipped' });
155
+ return;
156
+ }
157
+ const data = readFileSync(source);
158
+ const payload = resolution === 'merge' && isJsonTarget(entry) && exists
159
+ ? mergeJsonPayload(entry.path, data)
160
+ : data;
161
+ atomicWriteFile(entry.path, payload);
162
+ appendTxLog(logPath, {
163
+ ts: new Date().toISOString(),
164
+ kind: 'write',
165
+ path: entry.path,
166
+ sha256: entry.sha256,
167
+ });
168
+ acc.written.push(entry);
169
+ onProgress?.({ file: entry, written: index, total, status: 'written' });
170
+ return;
171
+ }
172
+ const data = readFileSync(source);
173
+ const payload = isJsonTarget(entry) && exists ? mergeJsonPayload(entry.path, data) : data;
174
+ atomicWriteFile(entry.path, payload);
175
+ appendTxLog(logPath, {
176
+ ts: new Date().toISOString(),
177
+ kind: 'write',
178
+ path: entry.path,
179
+ sha256: entry.sha256,
180
+ });
181
+ acc.written.push(entry);
182
+ onProgress?.({ file: entry, written: index, total, status: 'written' });
183
+ }
184
+ catch (err) {
185
+ const message = err instanceof Error ? err.message : String(err);
186
+ const code = errorCode(err);
187
+ acc.errors.push({ path: entry.path, code, message });
188
+ onProgress?.({
189
+ file: entry,
190
+ written: index,
191
+ total,
192
+ status: 'error',
193
+ error: { code, message },
194
+ });
195
+ }
196
+ }
197
+ /**
198
+ * True when the target already matches the planned bytes (no write needed).
199
+ *
200
+ * `policy.force` flips this off \u2014 `--force-overwrite` writes regardless.
201
+ */
202
+ function isIdempotent(entry, plan) {
203
+ if (plan.policy.force)
204
+ return false;
205
+ if (entry.sha256 === null)
206
+ return false;
207
+ if (!existsSync(entry.path))
208
+ return false;
209
+ return sha256File(entry.path) === entry.sha256;
210
+ }
211
+ /**
212
+ * Read the existing JSON target, deep-merge with the planned payload,
213
+ * and return the canonical 4-space-indented bytes.
214
+ *
215
+ * Falls back to the raw planned payload when the existing file is
216
+ * corrupt or non-object — matches the Python `read_json_file` lenient
217
+ * contract so a truncated upstream config does not abort the install.
218
+ */
219
+ function mergeJsonPayload(targetPath, planned) {
220
+ const existingText = readFileSync(targetPath, 'utf8');
221
+ const existing = parseJsonLenient(existingText);
222
+ const overlay = parseJsonLenient(planned.toString('utf8'));
223
+ const merged = mergeJsonContent(existing, overlay);
224
+ return Buffer.from(merged, 'utf8');
225
+ }
226
+ function errorCode(err) {
227
+ if (err !== null && typeof err === 'object' && 'code' in err) {
228
+ const c = err.code;
229
+ if (typeof c === 'string') {
230
+ if (c === 'ENOSPC')
231
+ return 'E_DISK_FULL';
232
+ if (c === 'EACCES' || c === 'EPERM')
233
+ return 'E_PERM';
234
+ }
235
+ }
236
+ return 'E_WRITE';
237
+ }
238
+ //# sourceMappingURL=apply.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apply.js","sourceRoot":"","sources":["../../src/install/apply.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEnD,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EACH,YAAY,EACZ,gBAAgB,EAChB,gBAAgB,EAChB,mBAAmB,GACtB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAyDzC;;;;;;;;;;GAUG;AACH,MAAM,UAAU,SAAS,CAAC,MAAmB;IACzC,MAAM,EAAE,IAAI,EAAE,cAAc,EAAE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,GAAG,MAAM,CAAC;IAC1E,MAAM,GAAG,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC;IACjC,MAAM,GAAG,GAAG,cAAc,EAAE,CAAC;IAE7B,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,KAAK,MAAM,KAAK,IAAI,GAAG,EAAE,CAAC;QACtB,K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K,CAAC;IAC1C,OAAO,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,KAAK,CAAC,MAAM,CAAC;AACnD,CAAC;AAED;;;;;;;GAOG;AACH,SAAS,gBAAgB,CAAC,UAAkB,EAAE,OAAe;IACzD,MAAM,YAAY,GAAG,YAAY,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;IACtD,MAAM,QAAQ,GAAG,gBAAgB,CAAC,YAAY,CAAC,CAAC;IAChD,MAAM,OAAO,GAAG,gBAAgB,CAAC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;IAC3D,MAAM,MAAM,GAAG,gBAAgB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IACnD,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AACvC,CAAC;AAED,SAAS,SAAS,CAAC,GAAY;IAC3B,IAAI,GAAG,KAAK,IAAI,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,MAAM,IAAI,GAAG,EAAE,CAAC;QAC3D,MAAM,CAAC,GAAI,GAAyB,CAAC,IAAI,CAAC;QAC1C,IAAI,OAAO,CAAC,KAAK,QAAQ,EAAE,CAAC;YACxB,IAAI,CAAC,KAAK,QAAQ;gBAAE,OAAO,aAAa,CAAC;YACzC,IAAI,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,OAAO;gBAAE,OAAO,QAAQ,CAAC;QACzD,CAAC;IACL,CAAC;IACD,OAAO,SAAS,CAAC;AACrB,CAAC"}
@@ -0,0 +1,92 @@
1
+ /**
2
+ * Atomic file writer — Phase A4 primitive.
3
+ *
4
+ * 1:1 port of the `tempfile.mkstemp` + `os.replace` pattern used across
5
+ * `scripts/install.py` (see `_write_consumer_bridge_marker` ~line 3036).
6
+ *
7
+ * Contract:
8
+ * 1. Open a sibling `.tmp.<rand>` file in the destination directory
9
+ * so the rename below is a same-filesystem operation (POSIX rename
10
+ * atomicity guarantee).
11
+ * 2. Write the payload, `fsync` to durable storage.
12
+ * 3. `rename()` to the final target — atomic on POSIX and Windows
13
+ * (Node's `fs.renameSync` maps to `MoveFileExA` with REPLACE).
14
+ * 4. On any failure between (1) and (3), unlink the temp file so we
15
+ * do not leak `.tmp.*` siblings.
16
+ *
17
+ * Sync API on purpose — the apply phase is fundamentally sequential
18
+ * (transaction-log ordering matters) and async I/O would add a real
19
+ * cost without any throughput win on the workloads we hit (≤ a few
20
+ * thousand small files per install).
21
+ */
22
+ import { closeSync, fsyncSync, mkdirSync, openSync, readFileSync, renameSync, unlinkSync, writeSync, } from 'node:fs';
23
+ import { dirname, join } from 'node:path';
24
+ /**
25
+ * Write `data` to `target` atomically.
26
+ *
27
+ * Throws on any I/O failure — the caller (apply phase) catches and
28
+ * surfaces an `E_DISK_FULL` / `E_PERM` SSE error frame (Phase B1).
29
+ *
30
+ * Parent directory is created with `recursive: true` so callers do not
31
+ * have to pre-mkdir each subtree.
32
+ */
33
+ export function atomicWriteFile(target, data, options = {}) {
34
+ const mode = options.mode ?? 0o644;
35
+ const parent = dirname(target);
36
+ mkdirSync(parent, { recursive: true });
37
+ const tmp = join(parent, `.tmp.${process.pid}.${randSuffix()}`);
38
+ let fd = null;
39
+ try {
40
+ fd = openSync(tmp, 'w', mode);
41
+ const buf = typeof data === 'string' ? Buffer.from(data, 'utf8') : data;
42
+ writeSync(fd, buf, 0, buf.length, 0);
43
+ fsyncSync(fd);
44
+ closeSync(fd);
45
+ fd = null;
46
+ renameSync(tmp, target);
47
+ }
48
+ catch (err) {
49
+ if (fd !== null) {
50
+ try {
51
+ closeSync(fd);
52
+ }
53
+ catch {
54
+ /* swallow — outer error wins */
55
+ }
56
+ }
57
+ try {
58
+ unlinkSync(tmp);
59
+ }
60
+ catch {
61
+ /* file may not exist yet — swallow */
62
+ }
63
+ throw err;
64
+ }
65
+ }
66
+ /**
67
+ * Append `line` to `target` atomically (read-modify-write).
68
+ *
69
+ * Wraps {@link atomicWriteFile} after a read of the current contents.
70
+ * Used by the transaction-log writer (`txlog.ts`) to grow the JSONL
71
+ * file one entry at a time without leaving a half-written line on
72
+ * crash. Newline is enforced — caller passes the bare payload.
73
+ */
74
+ export function atomicAppendLine(target, line) {
75
+ let existing = '';
76
+ try {
77
+ existing = readFileSync(target, 'utf8');
78
+ }
79
+ catch {
80
+ existing = '';
81
+ }
82
+ const sep = existing.length > 0 && !existing.endsWith('\n') ? '\n' : '';
83
+ atomicWriteFile(target, `${existing}${sep}${line}\n`);
84
+ }
85
+ function randSuffix() {
86
+ // 12 hex chars — sufficient to avoid collisions under concurrent
87
+ // installs (we do not run them in production, but tests do).
88
+ return Math.floor(Math.random() * 0xffffffffffff)
89
+ .toString(16)
90
+ .padStart(12, '0');
91
+ }
92
+ //# sourceMappingURL=atomic.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"atomic.js","sourceRoot":"","sources":["../../src/install/atomic.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EACH,SAAS,EACT,SAAS,EACT,SAAS,EACT,QAAQ,EACR,YAAY,EACZ,UAAU,EACV,UAAU,EACV,SAAS,GACZ,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAQ1C;;;;;;;;GAQG;AACH,MAAM,UAAU,eAAe,CAC3B,MAAc,EACd,IAAqB,EACrB,UAA8B,EAAE;IAEhC,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,IAAI,KAAK,CAAC;IACnC,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC/B,SAAS,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAEvC,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,EAAE,QAAQ,OAAO,CAAC,GAAG,IAAI,UAAU,EAAE,EAAE,CAAC,CAAC;IAChE,IAAI,EAAE,GAAkB,IAAI,CAAC;IAC7B,IAAI,C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,CAAC;IACxE,eAAe,CAAC,MAAM,EAAE,GAAG,QAAQ,GAAG,GAAG,GAAG,IAAI,IAAI,CAAC,CAAC;AAC1D,CAAC;AAED,SAAS,UAAU;IACf,iEAAiE;IACjE,6DAA6D;IAC7D,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,cAAc,CAAC;SAC5C,QAAQ,CAAC,EAAE,CAAC;SACZ,QAAQ,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC;AAC3B,CAAC"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Augment bridge — `.augment/settings.json` plugin enablement.
3
+ *
4
+ * Augment lifecycle hooks live at user scope (~/.augment/settings.json,
5
+ * see https://docs.augmentcode.com/cli/hooks). Project-scope settings
6
+ * carry plugin enablement only — the bridge writes a minimal JSON
7
+ * payload deep-merged with any existing user content.
8
+ *
9
+ * Mirror of `scripts/install.py:ensure_augment_bridge` (lines 888–892).
10
+ */
11
+ import { join } from 'node:path';
12
+ /** Builder for the Augment project-scope bridge. */
13
+ export const buildAugmentBridge = (ctx) => ({
14
+ kind: 'json',
15
+ toolId: 'augment',
16
+ target: join(ctx.projectRoot, '.augment', 'settings.json'),
17
+ payload: { enabledPlugins: { 'agent-config@event4u': true } },
18
+ label: '.augment/settings.json',
19
+ });
20
+ //# sourceMappingURL=augment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"augment.js","sourceRoot":"","sources":["../../../src/install/bridges/augment.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAIjC,oDAAoD;AACpD,MAAM,CAAC,MAAM,kBAAkB,GAAkB,CAAC,GAAG,EAAoB,EAAE,CAAC,CAAC;IACzE,IAAI,EAAE,MAAM;IACZ,MAAM,EAAE,SAAS;IACjB,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,WAAW,EAAE,UAAU,EAAE,eAAe,CAAC;IAC1D,OAAO,EAAE,EAAE,cAAc,EAAE,EAAE,sBAAsB,EAAE,IAAI,EAAE,EAAE;IAC7D,KAAK,EAAE,wBAAwB;CAClC,CAAC,CAAC"}
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Claude Code bridge — `.claude/settings.json` plugin + hooks.
3
+ *
4
+ * Each Claude Code lifecycle event is wired to a single
5
+ * `./agent-config dispatch:hook` invocation. The dispatcher reads
6
+ * `scripts/hook_manifest.yaml` at runtime and runs the resolved concern
7
+ * chain. Idempotent: deep-merge replaces hook arrays rather than
8
+ * appending duplicates on rerun.
9
+ *
10
+ * Mirror of `scripts/install.py:ensure_claude_bridge` (lines 1042–1066).
11
+ */
12
+ import { join } from 'node:path';
13
+ import { dispatchCommand, } from './types.js';
14
+ /** Native event names per https://docs.claude.com/en/docs/claude-code/hooks. */
15
+ export const CLAUDE_BINDINGS = [
16
+ ['session_start', 'SessionStart'],
17
+ ['session_end', 'SessionEnd'],
18
+ ['stop', 'Stop'],
19
+ ['user_prompt_submit', 'UserPromptSubmit'],
20
+ ['post_tool_use', 'PostToolUse'],
21
+ ];
22
+ function dispatchBlock(acEvent, native) {
23
+ return {
24
+ hooks: [{ type: 'command', command: dispatchCommand('claude', acEvent, native) }],
25
+ };
26
+ }
27
+ /** Builder for the Claude Code project-scope bridge. */
28
+ export const buildClaudeBridge = (ctx) => {
29
+ const perEvent = {};
30
+ for (const [acEvent, native] of CLAUDE_BINDINGS) {
31
+ (perEvent[native] ??= []).push(dispatchBlock(acEvent, native));
32
+ }
33
+ return {
34
+ kind: 'json',
35
+ toolId: 'claude',
36
+ target: join(ctx.projectRoot, '.claude', 'settings.json'),
37
+ payload: {
38
+ enabledPlugins: { 'agent-conf@event4u': true },
39
+ hooks: perEvent,
40
+ },
41
+ label: '.claude/settings.json',
42
+ };
43
+ };
44
+ //# sourceMappingURL=claude.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claude.js","sourceRoot":"","sources":["../../../src/install/bridges/claude.ts"],"names":[],"mapp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* Cline bridge — `.clinerules/hooks/<NativeEvent>` per-event scripts.
3
+ *
4
+ * Phase 7.6 (docs/contracts/hook-architecture-v1.md): Cline project
5
+ * hooks are individual executable scripts named exactly after the hook
6
+ * (no extension). One script per (ac_event, native_event) binding.
7
+ *
8
+ * The script reads stdin (Cline's payload), forwards it into
9
+ * `./agent-config dispatch:hook`, then emits the empty JSON envelope
10
+ * Cline expects (`{}` = no cancel, no context modification). `cd
11
+ * "$WORKSPACE_ROOT"` is intentional — guards against cline#8073-class
12
+ * shifts in cwd handling.
13
+ *
14
+ * Mirror of `scripts/install.py:ensure_cline_bridge` (lines 1181–1254).
15
+ */
16
+ import { join, resolve } from 'node:path';
17
+ export const CLINE_BINDINGS = [
18
+ ['session_start', 'TaskStart'],
19
+ ['session_start', 'TaskResume'],
20
+ ['session_end', 'TaskComplete'],
21
+ ['stop', 'TaskCancel'],
22
+ ['user_prompt_submit', 'UserPromptSubmit'],
23
+ ['post_tool_use', 'PostToolUse'],
24
+ ];
25
+ /**
26
+ * POSIX shell single-quote: wraps the value in `'…'` and escapes any
27
+ * internal single quotes via the standard `'\''` sequence. Matches
28
+ * Python's `shlex.quote` for the inputs the bridge actually uses
29
+ * (filesystem paths).
30
+ */
31
+ export function shellQuote(value) {
32
+ return `'${value.replace(/'/g, "'\\''")}'`;
33
+ }
34
+ function buildBody(acEvent, nativeEvent, workspaceQuoted) {
35
+ return `#!/usr/bin/env bash
36
+ # Generated by event4u/agent-config — DO NOT EDIT.
37
+ # Project-scope Cline hook for ${nativeEvent} → agent-config ${acEvent}.
38
+ # Phase 7.6 (docs/contracts/hook-architecture-v1.md).
39
+ set -u
40
+ EVENT_DATA="$(cat)"
41
+ WORKSPACE_ROOT=${workspaceQuoted}
42
+ cd "$WORKSPACE_ROOT" 2>/dev/null || { printf '%s\\n' '{}'; exit 0; }
43
+ if [ ! -x ./agent-config ]; then
44
+ printf '%s\\n' '{}'
45
+ exit 0
46
+ fi
47
+ printf '%s' "$EVENT_DATA" \\
48
+ | ./agent-config dispatch:hook \\
49
+ --platform cline \\
50
+ --event ${acEvent} \\
51
+ --native-event ${nativeEvent} \\
52
+ >/dev/null 2>&1 || true
53
+ printf '%s\\n' '{}'
54
+ exit 0
55
+ `;
56
+ }
57
+ /** Builder for the Cline project-scope bridge (one script per binding). */
58
+ export const buildClineBridge = (ctx) => {
59
+ const workspaceQuoted = shellQuote(resolve(ctx.projectRoot));
60
+ return CLINE_BINDINGS.map(([acEvent, native]) => ({
61
+ kind: 'script',
62
+ toolId: 'cline',
63
+ target: join(ctx.projectRoot, '.clinerules', 'hooks', native),
64
+ content: buildBody(acEvent, native, workspaceQuoted),
65
+ mode: 0o755,
66
+ label: `.clinerules/hooks/${native}`,
67
+ }));
68
+ };
69
+ //# sourceMappingURL=cline.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cline.js","sourceRoot":"","sources":["../../../src/install/bridges/cline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAI1C,MAAM,CAAC,MAAM,cAAc,GAA8C;IACrE,CAAC,eAAe,EAAO,WAAW,CAAC;IACnC,CAAC,eAAe,EAAO,YAAY,CAAC;IACpC,CAAC,aAAa,EAAS,cAAc,CAAC;IACtC,CAAC,MAAM,EAAgB,YAAY,CAAC;IACpC,CAAC,oBAAoB,EAAE,kBAAkB,CAAC;IAC1C,CAAC,eAAe,EAAO,aAAa,CAAC;CACxC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CAAC,KAAa;IACpC,OAAO,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC;AAC/C,CAAC;AAED,SAAS,SAAS,CAAC,OAAgB,EAAE,WAAmB,EAAE,eAAuB;IAC7E,OAAO;;iCAEsB,WAAW,mBAAmB,OAAO;;;;iBAIrD,eAAe;;;;;;;;;kBASd,OAAO;yBACA,WAAW;;;;CAInC,CAAC;AACF,CAAC;AAED,2EAA2E;AAC3E,MAAM,CAAC,MAAM,gBAAgB,GAAkB,CAAC,GAAG,EAAiC,EAAE;IAClF,MAAM,eAAe,GAAG,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC;IAC7D,OAAO,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,EAAE,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC;QAC9C,IAAI,EAAE,QAAiB;QACvB,MAAM,EAAE,OAAO;QACf,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,WAAW,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,CAAC;QAC7D,OAAO,EAAE,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,eAAe,CAAC;QACpD,IAAI,EAAE,KAAK;QACX,KAAK,EAAE,qBAAqB,MAAM,EAAE;KACvC,CAAC,CAAC,CAAC;AACR,CAAC,CAAC"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Copilot bridge — `.github/plugin/marketplace.json` plugin registration.
3
+ *
4
+ * Declares the agent-config plugin in GitHub's plugin marketplace
5
+ * format so Copilot-aware tooling can resolve it from the repo.
6
+ *
7
+ * Mirror of `scripts/install.py:ensure_copilot_bridge` (lines 1532–1552).
8
+ */
9
+ import { join } from 'node:path';
10
+ /** Builder for the Copilot project-scope bridge. */
11
+ export const buildCopilotBridge = (ctx) => ({
12
+ kind: 'json',
13
+ toolId: 'copilot',
14
+ target: join(ctx.projectRoot, '.github', 'plugin', 'marketplace.json'),
15
+ payload: {
16
+ marketplace: {
17
+ name: 'event4u-agent-marketplace',
18
+ plugins: [
19
+ {
20
+ id: 'agent-config@event4u',
21
+ repository: 'https://github.com/event4u-app/agent-config',
22
+ },
23
+ ],
24
+ },
25
+ },
26
+ label: '.github/plugin/marketplace.json',
27
+ });
28
+ //# sourceMappingURL=copilot.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"copilot.js","sourceRoot":"","sources":["../../../src/install/bridges/copilot.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAIjC,oDAAoD;AACpD,MAAM,CAAC,MAAM,kBAAkB,GAAkB,CAAC,GAAG,EAAoB,EAAE,CAAC,CAAC;IACzE,IAAI,EAAE,MAAM;IACZ,MAAM,EAAE,SAAS;IACjB,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,kBAAkB,CAAC;IACtE,OAAO,EAAE;QACL,WAAW,EAAE;YACT,IAAI,EAAE,2BAA2B;YACjC,OAAO,EAAE;gBACL;oBACI,EAAE,EAAE,sBAAsB;oBAC1B,UAAU,EAAE,6CAA6C;iBAC5D;aACJ;SACJ;KACJ;IACD,KAAK,EAAE,iCAAiC;CAC3C,CAAC,CAAC"}
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Cursor bridge — `.cursor/hooks.json` project-scope hooks.
3
+ *
4
+ * Native event names per https://cursor.com/docs/reference/third-party-hooks
5
+ * (camelCase). UserPromptSubmit lives at `beforeSubmitPrompt`. Project
6
+ * hooks fire with the project as cwd, so no trampoline is needed at
7
+ * this scope.
8
+ *
9
+ * Mirror of `scripts/install.py:ensure_cursor_bridge` (lines 1098–1118).
10
+ */
11
+ import { join } from 'node:path';
12
+ import { dispatchCommand, } from './types.js';
13
+ export const CURSOR_BINDINGS = [
14
+ ['session_start', 'sessionStart'],
15
+ ['session_end', 'sessionEnd'],
16
+ ['stop', 'stop'],
17
+ ['user_prompt_submit', 'beforeSubmitPrompt'],
18
+ ['post_tool_use', 'postToolUse'],
19
+ ];
20
+ /** Builder for the Cursor project-scope bridge. */
21
+ export const buildCursorBridge = (ctx) => {
22
+ const hooks = {};
23
+ for (const [acEvent, native] of CURSOR_BINDINGS) {
24
+ (hooks[native] ??= []).push({ command: dispatchCommand('cursor', acEvent, native) });
25
+ }
26
+ return {
27
+ kind: 'json',
28
+ toolId: 'cursor',
29
+ target: join(ctx.projectRoot, '.cursor', 'hooks.json'),
30
+ payload: { version: 1, hooks },
31
+ label: '.cursor/hooks.json',
32
+ };
33
+ };
34
+ //# sourceMappingURL=cursor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cursor.js","sourceRoot":"","sources":["../../../src/install/bridges/cursor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAGjC,OAAO,EAGH,eAAe,GAElB,MAAM,YAAY,CAAC;AAEpB,MAAM,CAAC,MAAM,eAAe,GAA8C;IACtE,CAAC,eAAe,EAAO,cAAc,CAAC;IACtC,CAAC,aAAa,EAAS,YAAY,CAAC;IACpC,CAAC,MAAM,EAAgB,MAAM,CAAC;IAC9B,CAAC,oBAAoB,EAAE,oBAAoB,CAAC;IAC5C,CAAC,eAAe,EAAO,aAAa,CAAC;CACxC,CAAC;AAEF,mDAAmD;AACnD,MAAM,CAAC,MAAM,iBAAiB,GAAkB,CAAC,GAAG,EAAoB,EAAE;IACtE,MAAM,KAAK,GAAiC,EAAE,CAAC;IAC/C,KAAK,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,IAAI,eAAe,EAAE,CAAC;QAC9C,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,eAAe,CAAC,QAAQ,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC;IACzF,CAAC;IACD,OAAO;QACH,IAAI,EAAE,MAAM;QACZ,MAAM,EAAE,QAAQ;QAChB,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,WAAW,EAAE,SAAS,EAAE,YAAY,CAAC;QACtD,OAAO,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE;QAC9B,KAAK,EAAE,oBAAoB;KAC9B,CAAC;AACN,CAAC,CAAC"}
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Gemini CLI bridge — `.gemini/settings.json` project-scope hooks.
3
+ *
4
+ * Gemini's hook payload is a nested
5
+ * `{event: [{matcher, hooks: [{type, command}]}]}` structure. Lifecycle
6
+ * matchers are empty strings; tool events use a regex matcher
7
+ * (`AfterTool` matches all tools with `.*`).
8
+ *
9
+ * Native event names per geminicli.com/docs/hooks/reference/ (PascalCase).
10
+ *
11
+ * Mirror of `scripts/install.py:ensure_gemini_bridge` (lines 1428–1479).
12
+ */
13
+ import { join } from 'node:path';
14
+ import { dispatchCommand, } from './types.js';
15
+ export const GEMINI_BINDINGS = [
16
+ ['session_start', 'SessionStart', ''],
17
+ ['session_end', 'SessionEnd', ''],
18
+ ['stop', 'AfterAgent', ''],
19
+ ['user_prompt_submit', 'BeforeAgent', ''],
20
+ ['post_tool_use', 'AfterTool', '.*'],
21
+ ];
22
+ /** Builder for the Gemini CLI project-scope bridge. */
23
+ export const buildGeminiBridge = (ctx) => {
24
+ const hooks = {};
25
+ for (const [acEvent, native, matcher] of GEMINI_BINDINGS) {
26
+ (hooks[native] ??= []).push({
27
+ matcher,
28
+ hooks: [{ type: 'command', command: dispatchCommand('gemini', acEvent, native) }],
29
+ });
30
+ }
31
+ return {
32
+ kind: 'json',
33
+ toolId: 'gemini',
34
+ target: join(ctx.projectRoot, '.gemini', 'settings.json'),
35
+ payload: { hooks },
36
+ label: '.gemini/settings.json',
37
+ };
38
+ };
39
+ //# sourceMappingURL=gemini.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gemini.js","sourceRoot":"","sources":["../../../src/install/bridges/gemini.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAGjC,OAAO,EAGH,eAAe,GAElB,MAAM,YAAY,CAAC;AAEpB,MAAM,CAAC,MAAM,eAAe,GAAsD;IAC9E,CAAC,eAAe,EAAO,cAAc,EAAE,EAAE,CAAC;IAC1C,CA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