agentplane 0.3.12 → 0.3.14

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 (376) hide show
  1. package/assets/RUNNER.md +1 -1
  2. package/assets/agents/ORCHESTRATOR.json +1 -1
  3. package/assets/agents/SKILL_EXTRACTOR.json +31 -0
  4. package/assets/codex-plugin/assets/header.png +0 -0
  5. package/assets/codex-plugin/assets/icon.svg +1 -0
  6. package/assets/codex-plugin/assets/logo.svg +1 -0
  7. package/assets/codex-plugin/skills/agentplane/SKILL.md +35 -0
  8. package/assets/framework.manifest.json +7 -0
  9. package/assets/policy/governance.md +4 -2
  10. package/assets/policy/incidents.md +4 -19
  11. package/assets/policy/workflow.branch_pr.md +10 -5
  12. package/assets/policy/workflow.release.md +5 -2
  13. package/dist/.build-manifest.json +409 -219
  14. package/dist/cli/exit-codes.d.ts.map +1 -1
  15. package/dist/cli/exit-codes.js +1 -0
  16. package/dist/cli/output.d.ts +29 -0
  17. package/dist/cli/output.d.ts.map +1 -1
  18. package/dist/cli/output.js +33 -0
  19. package/dist/cli/reason-codes.d.ts +1 -1
  20. package/dist/cli/reason-codes.d.ts.map +1 -1
  21. package/dist/cli/reason-codes.js +12 -0
  22. package/dist/cli/run-cli/command-catalog/core.d.ts +1 -1
  23. package/dist/cli/run-cli/command-catalog/core.d.ts.map +1 -1
  24. package/dist/cli/run-cli/command-catalog/core.js +36 -78
  25. package/dist/cli/run-cli/command-catalog/lifecycle.d.ts.map +1 -1
  26. package/dist/cli/run-cli/command-catalog/lifecycle.js +4 -12
  27. package/dist/cli/run-cli/command-catalog/project.d.ts +1 -1
  28. package/dist/cli/run-cli/command-catalog/project.d.ts.map +1 -1
  29. package/dist/cli/run-cli/command-catalog/project.js +27 -31
  30. package/dist/cli/run-cli/command-catalog/shared.d.ts +9 -6
  31. package/dist/cli/run-cli/command-catalog/shared.d.ts.map +1 -1
  32. package/dist/cli/run-cli/command-catalog/shared.js +23 -6
  33. package/dist/cli/run-cli/command-catalog/task.d.ts.map +1 -1
  34. package/dist/cli/run-cli/command-catalog/task.js +6 -18
  35. package/dist/cli/run-cli/command-catalog.d.ts +1 -1
  36. package/dist/cli/run-cli/command-catalog.d.ts.map +1 -1
  37. package/dist/cli/run-cli/commands/codex.d.ts +14 -0
  38. package/dist/cli/run-cli/commands/codex.d.ts.map +1 -0
  39. package/dist/cli/run-cli/commands/codex.js +100 -0
  40. package/dist/cli/run-cli/commands/core.d.ts +1 -0
  41. package/dist/cli/run-cli/commands/core.d.ts.map +1 -1
  42. package/dist/cli/run-cli/commands/core.js +1 -0
  43. package/dist/cli/run-cli/commands/init/recipes.d.ts +9 -1
  44. package/dist/cli/run-cli/commands/init/recipes.d.ts.map +1 -1
  45. package/dist/cli/run-cli/commands/init/recipes.js +33 -22
  46. package/dist/cli/run-cli/commands/init.d.ts.map +1 -1
  47. package/dist/cli/run-cli/commands/init.js +26 -21
  48. package/dist/cli/run-cli/error-guidance.js +20 -0
  49. package/dist/cli/run-cli.js +1 -1
  50. package/dist/cli/run-cli.test-helpers.d.ts +1 -74
  51. package/dist/cli/run-cli.test-helpers.d.ts.map +1 -1
  52. package/dist/cli/run-cli.test-helpers.js +1 -766
  53. package/dist/commands/branch/cleanup-merged.d.ts.map +1 -1
  54. package/dist/commands/branch/cleanup-merged.js +5 -9
  55. package/dist/commands/branch/work-start.command.d.ts.map +1 -1
  56. package/dist/commands/branch/work-start.command.js +1 -0
  57. package/dist/commands/codex/plugin-install.d.ts +26 -0
  58. package/dist/commands/codex/plugin-install.d.ts.map +1 -0
  59. package/dist/commands/codex/plugin-install.js +209 -0
  60. package/dist/commands/commit.spec.d.ts.map +1 -1
  61. package/dist/commands/commit.spec.js +2 -0
  62. package/dist/commands/doctor/branch-pr.d.ts +1 -1
  63. package/dist/commands/doctor/branch-pr.d.ts.map +1 -1
  64. package/dist/commands/doctor/branch-pr.js +5 -2
  65. package/dist/commands/guard/impl/commands.d.ts.map +1 -1
  66. package/dist/commands/guard/impl/commands.js +4 -1
  67. package/dist/commands/guard/impl/comment-commit.d.ts.map +1 -1
  68. package/dist/commands/guard/impl/comment-commit.js +2 -1
  69. package/dist/commands/guard/impl/env.d.ts +6 -0
  70. package/dist/commands/guard/impl/env.d.ts.map +1 -1
  71. package/dist/commands/guard/impl/env.js +41 -0
  72. package/dist/commands/pr/integrate/cmd.d.ts.map +1 -1
  73. package/dist/commands/pr/integrate/cmd.js +81 -5
  74. package/dist/commands/pr/integrate/internal/prepare.d.ts.map +1 -1
  75. package/dist/commands/pr/integrate/internal/prepare.js +38 -7
  76. package/dist/commands/pr/internal/auto-commit.d.ts.map +1 -1
  77. package/dist/commands/pr/internal/auto-commit.js +13 -7
  78. package/dist/commands/pr/internal/sync-branch.d.ts +36 -0
  79. package/dist/commands/pr/internal/sync-branch.d.ts.map +1 -0
  80. package/dist/commands/pr/internal/sync-branch.js +113 -0
  81. package/dist/commands/pr/internal/sync-github.d.ts +28 -0
  82. package/dist/commands/pr/internal/sync-github.d.ts.map +1 -0
  83. package/dist/commands/pr/internal/sync-github.js +178 -0
  84. package/dist/commands/pr/internal/sync-model.d.ts +36 -0
  85. package/dist/commands/pr/internal/sync-model.d.ts.map +1 -0
  86. package/dist/commands/pr/internal/sync-model.js +1 -0
  87. package/dist/commands/pr/internal/sync-open-step.d.ts +10 -0
  88. package/dist/commands/pr/internal/sync-open-step.d.ts.map +1 -0
  89. package/dist/commands/pr/internal/sync-open-step.js +128 -0
  90. package/dist/commands/pr/internal/sync-support.d.ts +7 -0
  91. package/dist/commands/pr/internal/sync-support.d.ts.map +1 -0
  92. package/dist/commands/pr/internal/sync-support.js +29 -0
  93. package/dist/commands/pr/internal/sync-update-step.d.ts +6 -0
  94. package/dist/commands/pr/internal/sync-update-step.d.ts.map +1 -0
  95. package/dist/commands/pr/internal/sync-update-step.js +68 -0
  96. package/dist/commands/pr/internal/sync.d.ts +2 -6
  97. package/dist/commands/pr/internal/sync.d.ts.map +1 -1
  98. package/dist/commands/pr/internal/sync.js +83 -525
  99. package/dist/commands/pr/open.d.ts.map +1 -1
  100. package/dist/commands/pr/open.js +62 -7
  101. package/dist/commands/pr/pr.command.d.ts.map +1 -1
  102. package/dist/commands/pr/pr.command.js +7 -2
  103. package/dist/commands/recipes/active.command.d.ts +7 -0
  104. package/dist/commands/recipes/active.command.d.ts.map +1 -0
  105. package/dist/commands/recipes/active.command.js +12 -0
  106. package/dist/commands/recipes/add.command.d.ts +8 -0
  107. package/dist/commands/recipes/add.command.d.ts.map +1 -0
  108. package/dist/commands/recipes/add.command.js +33 -0
  109. package/dist/commands/recipes/detach.command.d.ts +7 -0
  110. package/dist/commands/recipes/detach.command.d.ts.map +1 -0
  111. package/dist/commands/recipes/detach.command.js +19 -0
  112. package/dist/commands/recipes/disable.command.d.ts +7 -0
  113. package/dist/commands/recipes/disable.command.d.ts.map +1 -0
  114. package/dist/commands/recipes/disable.command.js +10 -0
  115. package/dist/commands/recipes/enable.command.d.ts +7 -0
  116. package/dist/commands/recipes/enable.command.d.ts.map +1 -0
  117. package/dist/commands/recipes/enable.command.js +10 -0
  118. package/dist/commands/recipes/explain-active.command.d.ts +5 -0
  119. package/dist/commands/recipes/explain-active.command.d.ts.map +1 -0
  120. package/dist/commands/recipes/explain-active.command.js +11 -0
  121. package/dist/commands/recipes/explain.command.d.ts.map +1 -1
  122. package/dist/commands/recipes/explain.command.js +4 -2
  123. package/dist/commands/recipes/impl/apply.d.ts +1 -1
  124. package/dist/commands/recipes/impl/apply.d.ts.map +1 -1
  125. package/dist/commands/recipes/impl/apply.js +34 -16
  126. package/dist/commands/recipes/impl/commands/active.d.ts +6 -0
  127. package/dist/commands/recipes/impl/commands/active.d.ts.map +1 -0
  128. package/dist/commands/recipes/impl/commands/active.js +47 -0
  129. package/dist/commands/recipes/impl/commands/add.d.ts +8 -0
  130. package/dist/commands/recipes/impl/commands/add.d.ts.map +1 -0
  131. package/dist/commands/recipes/impl/commands/add.js +105 -0
  132. package/dist/commands/recipes/impl/commands/detach.d.ts +6 -0
  133. package/dist/commands/recipes/impl/commands/detach.d.ts.map +1 -0
  134. package/dist/commands/recipes/impl/commands/detach.js +99 -0
  135. package/dist/commands/recipes/impl/commands/disable.d.ts +6 -0
  136. package/dist/commands/recipes/impl/commands/disable.d.ts.map +1 -0
  137. package/dist/commands/recipes/impl/commands/disable.js +23 -0
  138. package/dist/commands/recipes/impl/commands/enable.d.ts +6 -0
  139. package/dist/commands/recipes/impl/commands/enable.d.ts.map +1 -0
  140. package/dist/commands/recipes/impl/commands/enable.js +41 -0
  141. package/dist/commands/recipes/impl/commands/explain-active.d.ts +5 -0
  142. package/dist/commands/recipes/impl/commands/explain-active.d.ts.map +1 -0
  143. package/dist/commands/recipes/impl/commands/explain-active.js +20 -0
  144. package/dist/commands/recipes/impl/commands/explain.d.ts.map +1 -1
  145. package/dist/commands/recipes/impl/commands/explain.js +83 -36
  146. package/dist/commands/recipes/impl/commands/info.d.ts.map +1 -1
  147. package/dist/commands/recipes/impl/commands/info.js +39 -22
  148. package/dist/commands/recipes/impl/commands/install.d.ts +1 -1
  149. package/dist/commands/recipes/impl/commands/install.d.ts.map +1 -1
  150. package/dist/commands/recipes/impl/commands/install.js +35 -42
  151. package/dist/commands/recipes/impl/commands/list-remote.d.ts.map +1 -1
  152. package/dist/commands/recipes/impl/commands/list-remote.js +2 -3
  153. package/dist/commands/recipes/impl/commands/list.d.ts.map +1 -1
  154. package/dist/commands/recipes/impl/commands/list.js +13 -12
  155. package/dist/commands/recipes/impl/commands/remove.d.ts.map +1 -1
  156. package/dist/commands/recipes/impl/commands/remove.js +12 -2
  157. package/dist/commands/recipes/impl/commands/update.d.ts +7 -0
  158. package/dist/commands/recipes/impl/commands/update.d.ts.map +1 -0
  159. package/dist/commands/recipes/impl/commands/update.js +107 -0
  160. package/dist/commands/recipes/impl/commands.d.ts +7 -0
  161. package/dist/commands/recipes/impl/commands.d.ts.map +1 -1
  162. package/dist/commands/recipes/impl/commands.js +7 -0
  163. package/dist/commands/recipes/impl/constants.d.ts +1 -14
  164. package/dist/commands/recipes/impl/constants.d.ts.map +1 -1
  165. package/dist/commands/recipes/impl/constants.js +1 -18
  166. package/dist/commands/recipes/impl/index.d.ts +1 -1
  167. package/dist/commands/recipes/impl/index.d.ts.map +1 -1
  168. package/dist/commands/recipes/impl/installed-recipes.d.ts +1 -1
  169. package/dist/commands/recipes/impl/installed-recipes.d.ts.map +1 -1
  170. package/dist/commands/recipes/impl/installed-recipes.js +1 -2
  171. package/dist/commands/recipes/impl/mutation-transaction.d.ts +7 -0
  172. package/dist/commands/recipes/impl/mutation-transaction.d.ts.map +1 -0
  173. package/dist/commands/recipes/impl/mutation-transaction.js +47 -0
  174. package/dist/commands/recipes/impl/overlay-project.d.ts +48 -0
  175. package/dist/commands/recipes/impl/overlay-project.d.ts.map +1 -0
  176. package/dist/commands/recipes/impl/overlay-project.js +320 -0
  177. package/dist/commands/recipes/impl/paths.d.ts +17 -2
  178. package/dist/commands/recipes/impl/paths.d.ts.map +1 -1
  179. package/dist/commands/recipes/impl/paths.js +20 -5
  180. package/dist/commands/recipes/impl/project-installed-recipes.d.ts +5 -4
  181. package/dist/commands/recipes/impl/project-installed-recipes.d.ts.map +1 -1
  182. package/dist/commands/recipes/impl/project-installed-recipes.js +34 -76
  183. package/dist/commands/recipes/impl/project-recipe-state.d.ts +18 -0
  184. package/dist/commands/recipes/impl/project-recipe-state.d.ts.map +1 -0
  185. package/dist/commands/recipes/impl/project-recipe-state.js +94 -0
  186. package/dist/commands/recipes/impl/project-registry.d.ts +24 -0
  187. package/dist/commands/recipes/impl/project-registry.d.ts.map +1 -0
  188. package/dist/commands/recipes/impl/project-registry.js +124 -0
  189. package/dist/commands/recipes/impl/resolver.d.ts +1 -1
  190. package/dist/commands/recipes/impl/resolver.d.ts.map +1 -1
  191. package/dist/commands/recipes/impl/resolver.js +6 -4
  192. package/dist/commands/recipes/impl/types.d.ts +1 -240
  193. package/dist/commands/recipes/impl/types.d.ts.map +1 -1
  194. package/dist/commands/recipes/impl/version.d.ts +5 -0
  195. package/dist/commands/recipes/impl/version.d.ts.map +1 -0
  196. package/dist/commands/recipes/impl/version.js +9 -0
  197. package/dist/commands/recipes/info.command.js +2 -2
  198. package/dist/commands/recipes/install.spec.js +4 -4
  199. package/dist/commands/recipes/list.command.js +4 -4
  200. package/dist/commands/recipes/remove.command.js +2 -2
  201. package/dist/commands/recipes/update.command.d.ts +8 -0
  202. package/dist/commands/recipes/update.command.d.ts.map +1 -0
  203. package/dist/commands/recipes/update.command.js +35 -0
  204. package/dist/commands/recipes.d.ts +10 -6
  205. package/dist/commands/recipes.d.ts.map +1 -1
  206. package/dist/commands/recipes.js +8 -5
  207. package/dist/commands/recipes.test-helpers.d.ts +3 -3
  208. package/dist/commands/recipes.test-helpers.d.ts.map +1 -1
  209. package/dist/commands/recipes.test-helpers.js +105 -15
  210. package/dist/commands/release/apply.command.d.ts +1 -1
  211. package/dist/commands/release/apply.command.d.ts.map +1 -1
  212. package/dist/commands/release/apply.command.js +15 -379
  213. package/dist/commands/release/apply.mutation.d.ts +1 -0
  214. package/dist/commands/release/apply.mutation.d.ts.map +1 -1
  215. package/dist/commands/release/apply.mutation.js +24 -1
  216. package/dist/commands/release/apply.pipeline.d.ts +22 -0
  217. package/dist/commands/release/apply.pipeline.d.ts.map +1 -0
  218. package/dist/commands/release/apply.pipeline.js +371 -0
  219. package/dist/commands/release/apply.preflight.d.ts +2 -0
  220. package/dist/commands/release/apply.preflight.d.ts.map +1 -1
  221. package/dist/commands/release/apply.preflight.js +13 -4
  222. package/dist/commands/release/apply.types.d.ts +27 -0
  223. package/dist/commands/release/apply.types.d.ts.map +1 -1
  224. package/dist/commands/release.test-helpers.d.ts +4 -0
  225. package/dist/commands/release.test-helpers.d.ts.map +1 -1
  226. package/dist/commands/release.test-helpers.js +7 -0
  227. package/dist/commands/scenario/execute.command.js +4 -4
  228. package/dist/commands/scenario/impl/commands.js +4 -4
  229. package/dist/commands/scenario/info.command.js +4 -4
  230. package/dist/commands/scenario/list.command.js +3 -3
  231. package/dist/commands/scenario/run.command.js +5 -5
  232. package/dist/commands/scenario/scenario.command.js +7 -7
  233. package/dist/commands/shared/reconcile-check.d.ts.map +1 -1
  234. package/dist/commands/shared/reconcile-check.js +2 -2
  235. package/dist/commands/shared/task-backend.d.ts +6 -1
  236. package/dist/commands/shared/task-backend.d.ts.map +1 -1
  237. package/dist/commands/shared/task-backend.js +34 -2
  238. package/dist/commands/shared/task-handoff.d.ts +2 -1
  239. package/dist/commands/shared/task-handoff.d.ts.map +1 -1
  240. package/dist/commands/shared/task-handoff.js +15 -0
  241. package/dist/commands/shared/task-mutation.d.ts.map +1 -1
  242. package/dist/commands/shared/task-mutation.js +4 -4
  243. package/dist/commands/shared/task-store/intents.d.ts +34 -0
  244. package/dist/commands/shared/task-store/intents.d.ts.map +1 -0
  245. package/dist/commands/shared/task-store/intents.js +265 -0
  246. package/dist/commands/shared/task-store/readme.d.ts +28 -0
  247. package/dist/commands/shared/task-store/readme.d.ts.map +1 -0
  248. package/dist/commands/shared/task-store/readme.js +125 -0
  249. package/dist/commands/shared/task-store/store.d.ts +26 -0
  250. package/dist/commands/shared/task-store/store.d.ts.map +1 -0
  251. package/dist/commands/shared/task-store/store.js +105 -0
  252. package/dist/commands/shared/task-store/types.d.ts +94 -0
  253. package/dist/commands/shared/task-store/types.d.ts.map +1 -0
  254. package/dist/commands/shared/task-store/types.js +1 -0
  255. package/dist/commands/shared/task-store.d.ts +3 -109
  256. package/dist/commands/shared/task-store.d.ts.map +1 -1
  257. package/dist/commands/shared/task-store.js +2 -493
  258. package/dist/commands/task/block.d.ts.map +1 -1
  259. package/dist/commands/task/block.js +7 -2
  260. package/dist/commands/task/comment.d.ts.map +1 -1
  261. package/dist/commands/task/comment.js +7 -2
  262. package/dist/commands/task/finish-shared.d.ts.map +1 -1
  263. package/dist/commands/task/finish-shared.js +3 -3
  264. package/dist/commands/task/finish.d.ts.map +1 -1
  265. package/dist/commands/task/finish.js +102 -15
  266. package/dist/commands/task/handoff-show.command.d.ts.map +1 -1
  267. package/dist/commands/task/handoff-show.command.js +24 -0
  268. package/dist/commands/task/hosted-merge-sync.d.ts.map +1 -1
  269. package/dist/commands/task/hosted-merge-sync.js +9 -4
  270. package/dist/commands/task/list.run.d.ts.map +1 -1
  271. package/dist/commands/task/list.run.js +14 -4
  272. package/dist/commands/task/new.command.d.ts.map +1 -1
  273. package/dist/commands/task/new.command.js +16 -2
  274. package/dist/commands/task/new.js +2 -2
  275. package/dist/commands/task/show.d.ts.map +1 -1
  276. package/dist/commands/task/show.js +3 -3
  277. package/dist/commands/task/update.d.ts.map +1 -1
  278. package/dist/commands/task/update.js +11 -3
  279. package/dist/runner/adapters/codex.d.ts.map +1 -1
  280. package/dist/runner/adapters/codex.js +3 -33
  281. package/dist/runner/adapters/custom.d.ts.map +1 -1
  282. package/dist/runner/adapters/custom.js +3 -30
  283. package/dist/runner/adapters/runtime-shared.d.ts +14 -0
  284. package/dist/runner/adapters/runtime-shared.d.ts.map +1 -0
  285. package/dist/runner/adapters/runtime-shared.js +36 -0
  286. package/dist/runner/context/base-prompt-sources.d.ts +30 -0
  287. package/dist/runner/context/base-prompt-sources.d.ts.map +1 -0
  288. package/dist/runner/context/base-prompt-sources.js +144 -0
  289. package/dist/runner/context/base-prompts.d.ts +5 -23
  290. package/dist/runner/context/base-prompts.d.ts.map +1 -1
  291. package/dist/runner/context/base-prompts.js +10 -358
  292. package/dist/runner/context/overlay-prompt-blocks.d.ts +7 -0
  293. package/dist/runner/context/overlay-prompt-blocks.d.ts.map +1 -0
  294. package/dist/runner/context/overlay-prompt-blocks.js +72 -0
  295. package/dist/runner/context/prompt-block-shared.d.ts +54 -0
  296. package/dist/runner/context/prompt-block-shared.d.ts.map +1 -0
  297. package/dist/runner/context/prompt-block-shared.js +106 -0
  298. package/dist/runner/context/recipe-context.d.ts +2 -1
  299. package/dist/runner/context/recipe-context.d.ts.map +1 -1
  300. package/dist/runner/context/recipe-context.js +41 -8
  301. package/dist/runner/context/recipe-prompt-blocks.d.ts +6 -0
  302. package/dist/runner/context/recipe-prompt-blocks.d.ts.map +1 -0
  303. package/dist/runner/context/recipe-prompt-blocks.js +143 -0
  304. package/dist/runner/types.d.ts +4 -0
  305. package/dist/runner/types.d.ts.map +1 -1
  306. package/dist/runner/usecases/scenario-materialize-task.js +2 -2
  307. package/dist/runner/usecases/task-run-inspect.js +2 -2
  308. package/dist/runner/usecases/task-run-lifecycle-shared.js +2 -2
  309. package/dist/runner/usecases/task-run.d.ts.map +1 -1
  310. package/dist/runner/usecases/task-run.js +6 -3
  311. package/dist/runtime/behavior/resolve.d.ts +2 -1
  312. package/dist/runtime/behavior/resolve.d.ts.map +1 -1
  313. package/dist/runtime/behavior/resolve.js +25 -5
  314. package/dist/runtime/behavior/types.d.ts +1 -0
  315. package/dist/runtime/behavior/types.d.ts.map +1 -1
  316. package/dist/runtime/capabilities/recipe.d.ts +2 -1
  317. package/dist/runtime/capabilities/recipe.d.ts.map +1 -1
  318. package/dist/runtime/capabilities/recipe.js +88 -28
  319. package/dist/runtime/execution-context.d.ts +63 -0
  320. package/dist/runtime/execution-context.d.ts.map +1 -0
  321. package/dist/{usecases/context/resolve-context.js → runtime/execution-context.js} +23 -26
  322. package/dist/runtime/incidents/advice-strategy.d.ts +15 -0
  323. package/dist/runtime/incidents/advice-strategy.d.ts.map +1 -0
  324. package/dist/runtime/incidents/advice-strategy.js +54 -0
  325. package/dist/runtime/incidents/plan-strategy.d.ts +9 -0
  326. package/dist/runtime/incidents/plan-strategy.d.ts.map +1 -0
  327. package/dist/runtime/incidents/plan-strategy.js +205 -0
  328. package/dist/runtime/incidents/registry-strategy.d.ts +6 -0
  329. package/dist/runtime/incidents/registry-strategy.d.ts.map +1 -0
  330. package/dist/runtime/incidents/registry-strategy.js +280 -0
  331. package/dist/runtime/incidents/resolve.d.ts +3 -25
  332. package/dist/runtime/incidents/resolve.d.ts.map +1 -1
  333. package/dist/runtime/incidents/resolve.js +3 -683
  334. package/dist/runtime/incidents/shared.d.ts +34 -0
  335. package/dist/runtime/incidents/shared.d.ts.map +1 -0
  336. package/dist/runtime/incidents/shared.js +171 -0
  337. package/dist/shared/errors.d.ts +1 -1
  338. package/dist/shared/errors.d.ts.map +1 -1
  339. package/dist/shared/runtime-source.d.ts.map +1 -1
  340. package/dist/shared/runtime-source.js +8 -3
  341. package/dist/testing/cli-harness/recipe-archives.d.ts +28 -0
  342. package/dist/testing/cli-harness/recipe-archives.d.ts.map +1 -0
  343. package/dist/testing/cli-harness/recipe-archives.js +374 -0
  344. package/dist/testing/cli-harness/stdio.d.ts +26 -0
  345. package/dist/testing/cli-harness/stdio.d.ts.map +1 -0
  346. package/dist/testing/cli-harness/stdio.js +84 -0
  347. package/dist/testing/cli-harness.d.ts +25 -0
  348. package/dist/testing/cli-harness.d.ts.map +1 -0
  349. package/dist/testing/cli-harness.js +313 -0
  350. package/dist/testing/index.d.ts +2 -0
  351. package/dist/testing/index.d.ts.map +1 -0
  352. package/dist/testing/index.js +1 -0
  353. package/package.json +7 -3
  354. package/dist/cli/recipes-bundled.d.ts +0 -10
  355. package/dist/cli/recipes-bundled.d.ts.map +0 -1
  356. package/dist/cli/recipes-bundled.js +0 -36
  357. package/dist/commands/recipes/impl/manifest.d.ts +0 -4
  358. package/dist/commands/recipes/impl/manifest.d.ts.map +0 -1
  359. package/dist/commands/recipes/impl/manifest.js +0 -229
  360. package/dist/commands/recipes/impl/normalize.d.ts +0 -8
  361. package/dist/commands/recipes/impl/normalize.d.ts.map +0 -1
  362. package/dist/commands/recipes/impl/normalize.js +0 -54
  363. package/dist/commands/recipes/impl/scenario.d.ts +0 -16
  364. package/dist/commands/recipes/impl/scenario.d.ts.map +0 -1
  365. package/dist/commands/recipes/impl/scenario.js +0 -262
  366. package/dist/recipes/bundled-recipes.d.ts +0 -17
  367. package/dist/recipes/bundled-recipes.d.ts.map +0 -1
  368. package/dist/recipes/bundled-recipes.js +0 -15
  369. package/dist/usecases/context/resolve-context.d.ts +0 -68
  370. package/dist/usecases/context/resolve-context.d.ts.map +0 -1
  371. package/dist/usecases/task/task-list-usecase.d.ts +0 -9
  372. package/dist/usecases/task/task-list-usecase.d.ts.map +0 -1
  373. package/dist/usecases/task/task-list-usecase.js +0 -17
  374. package/dist/usecases/task/task-new-usecase.d.ts +0 -9
  375. package/dist/usecases/task/task-new-usecase.d.ts.map +0 -1
  376. package/dist/usecases/task/task-new-usecase.js +0 -17
@@ -1 +1 @@
1
- {"version":3,"file":"cleanup-merged.d.ts","sourceRoot":"","sources":["../../../src/commands/branch/cleanup-merged.ts"],"names":[],"mappings":"AAqBA,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,2BAA2B,CAAC;AAgInC,wBAAsB,gBAAgB,CAAC,IAAI,EAAE;IAC3C,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,OAAO,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,oBAAoB,EAAE,OAAO,CAAC;IAC9B,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,EAAE,OAAO,CAAC;IACf,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B,GAAG,OAAO,CAAC,MAAM,CAAC,CA8JlB"}
1
+ {"version":3,"file":"cleanup-merged.d.ts","sourceRoot":"","sources":["../../../src/commands/branch/cleanup-merged.ts"],"names":[],"mappings":"AAsBA,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,2BAA2B,CAAC;AAgInC,wBAAsB,gBAAgB,CAAC,IAAI,EAAE;IAC3C,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,OAAO,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,oBAAoB,EAAE,OAAO,CAAC;IAC9B,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,EAAE,OAAO,CAAC;IACf,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B,GAAG,OAAO,CAAC,MAAM,CAAC,CAyJlB"}
@@ -8,6 +8,7 @@ import { ensureGitClean } from "../guard/index.js";
8
8
  import { execFileAsync, gitEnv } from "../shared/git.js";
9
9
  import { gitDiffNames } from "../shared/git-diff.js";
10
10
  import { gitBranchExists, gitCurrentBranch, gitIsAncestor } from "../shared/git-ops.js";
11
+ import { cleanupMergedLocalBranch } from "../shared/merged-branch-cleanup.js";
11
12
  import { findWorktreeForBranch, gitListBranchesByPrefixes, parseTaskIdFromCloseBranch, parseTaskIdFromBranch, } from "../shared/git-worktree.js";
12
13
  import { isPathWithin, resolvePathFallback } from "../shared/path.js";
13
14
  import { parsePrMeta } from "../shared/pr-meta.js";
@@ -216,15 +217,10 @@ export async function cmdCleanupMerged(opts) {
216
217
  const taskDir = path.join(resolved.gitRoot, config.paths.workflow_dir, item.taskId);
217
218
  await archivePrArtifacts(taskDir);
218
219
  }
219
- if (worktreePath) {
220
- await execFileAsync("git", ["worktree", "remove", "--force", worktreePath], {
221
- cwd: resolved.gitRoot,
222
- env: gitEnv(),
223
- });
224
- }
225
- await execFileAsync("git", ["branch", "-D", item.branch], {
226
- cwd: resolved.gitRoot,
227
- env: gitEnv(),
220
+ await cleanupMergedLocalBranch({
221
+ gitRoot: resolved.gitRoot,
222
+ branch: item.branch,
223
+ worktreePathHint: worktreePath,
228
224
  });
229
225
  if (opts.deleteRemoteBranches) {
230
226
  deletedRemoteBranches += (await deleteRemoteBranchIfPresent(resolved.gitRoot, item.branch))
@@ -1 +1 @@
1
- {"version":3,"file":"work-start.command.d.ts","sourceRoot":"","sources":["../../../src/commands/branch/work-start.command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAc,MAAM,wBAAwB,CAAC;AAGtF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAGhE,MAAM,MAAM,eAAe,GAAG;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,WAAW,CAAC,eAAe,CAkDtD,CAAC;AAEF,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,CAAC,sBAAsB,EAAE,MAAM,KAAK,OAAO,CAAC,cAAc,CAAC,GAClE,cAAc,CAAC,eAAe,CAAC,CA4BjC"}
1
+ {"version":3,"file":"work-start.command.d.ts","sourceRoot":"","sources":["../../../src/commands/branch/work-start.command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAc,MAAM,wBAAwB,CAAC;AAGtF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAGhE,MAAM,MAAM,eAAe,GAAG;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,WAAW,CAAC,eAAe,CAmDtD,CAAC;AAEF,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,CAAC,sBAAsB,EAAE,MAAM,KAAK,OAAO,CAAC,cAAc,CAAC,GAClE,cAAc,CAAC,eAAe,CAAC,CA4BjC"}
@@ -42,6 +42,7 @@ export const workStartSpec = {
42
42
  notes: [
43
43
  "When workflow_mode=direct, agentplane does not create task branches; it records a single active task for the workspace.",
44
44
  "When workflow_mode=branch_pr, --worktree is required and the command must be run on the base branch.",
45
+ "After branch_pr work starts, run owner-scoped task commands from the created worktree so task README/PR artifacts stay attached to one checkout.",
45
46
  ],
46
47
  parse: (raw) => ({
47
48
  taskId: raw.args["task-id"],
@@ -0,0 +1,26 @@
1
+ export declare const AGENTPLANE_CODEX_HOME_ENV = "AGENTPLANE_CODEX_HOME";
2
+ export type CodexPluginInstallScope = "user" | "repo";
3
+ export type CodexPluginInstallResult = {
4
+ scope: CodexPluginInstallScope;
5
+ installRoot: string;
6
+ pluginRoot: string;
7
+ manifestPath: string;
8
+ marketplacePath: string;
9
+ copiedAssets: string[];
10
+ };
11
+ type JsonObject = Record<string, unknown>;
12
+ export declare function buildCodexPluginManifest(version?: string): JsonObject;
13
+ export declare function resolveCodexInstallRoot(opts: {
14
+ scope: CodexPluginInstallScope;
15
+ repoRoot?: string;
16
+ env?: NodeJS.ProcessEnv;
17
+ }): string;
18
+ export declare function resolveCodexPluginRoot(installRoot: string): string;
19
+ export declare function resolveCodexMarketplacePath(installRoot: string): string;
20
+ export declare function installBundledCodexPlugin(opts: {
21
+ scope: CodexPluginInstallScope;
22
+ installRoot: string;
23
+ version?: string;
24
+ }): Promise<CodexPluginInstallResult>;
25
+ export {};
26
+ //# sourceMappingURL=plugin-install.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin-install.d.ts","sourceRoot":"","sources":["../../../src/commands/codex/plugin-install.ts"],"names":[],"mappings":"AAoCA,eAAO,MAAM,yBAAyB,0BAA0B,CAAC;AAEjE,MAAM,MAAM,uBAAuB,GAAG,MAAM,GAAG,MAAM,CAAC;AAEtD,MAAM,MAAM,wBAAwB,GAAG;IACrC,KAAK,EAAE,uBAAuB,CAAC;IAC/B,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB,CAAC;AAEF,KAAK,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAwG1C,wBAAgB,wBAAwB,CAAC,OAAO,SAAe,GAAG,UAAU,CA8B3E;AAED,wBAAgB,uBAAuB,CAAC,IAAI,EAAE;IAC5C,KAAK,EAAE,uBAAuB,CAAC;IAC/B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;CACzB,GAAG,MAAM,CAiBT;AAED,wBAAgB,sBAAsB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAElE;AAED,wBAAgB,2BAA2B,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAEvE;AAED,wBAAsB,yBAAyB,CAAC,IAAI,EAAE;IACpD,KAAK,EAAE,uBAAuB,CAAC;IAC/B,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,GAAG,OAAO,CAAC,wBAAwB,CAAC,CAyCpC"}
@@ -0,0 +1,209 @@
1
+ import { copyFile, mkdir, readFile } from "node:fs/promises";
2
+ import os from "node:os";
3
+ import path from "node:path";
4
+ import { fileURLToPath } from "node:url";
5
+ import { CliError } from "../../shared/errors.js";
6
+ import { getVersion } from "../../meta/version.js";
7
+ import { writeJsonStableIfChanged, writeTextIfChanged } from "../../shared/write-if-changed.js";
8
+ const PLUGIN_NAME = "agentplane";
9
+ const DEFAULT_MARKETPLACE_NAME = "agentplane-local-marketplace";
10
+ const DEFAULT_MARKETPLACE_DISPLAY_NAME = "AgentPlane Local Plugins";
11
+ const ASSET_ROOT_URL = new URL("../../../assets/codex-plugin/", import.meta.url);
12
+ const TEXT_ASSETS = [
13
+ {
14
+ source: new URL("skills/agentplane/SKILL.md", ASSET_ROOT_URL),
15
+ relativePath: "skills/agentplane/SKILL.md",
16
+ },
17
+ ];
18
+ const BINARY_ASSETS = [
19
+ {
20
+ source: new URL("assets/icon.svg", ASSET_ROOT_URL),
21
+ relativePath: "assets/icon.svg",
22
+ },
23
+ {
24
+ source: new URL("assets/logo.svg", ASSET_ROOT_URL),
25
+ relativePath: "assets/logo.svg",
26
+ },
27
+ {
28
+ source: new URL("assets/header.png", ASSET_ROOT_URL),
29
+ relativePath: "assets/header.png",
30
+ },
31
+ ];
32
+ export const AGENTPLANE_CODEX_HOME_ENV = "AGENTPLANE_CODEX_HOME";
33
+ function isJsonObject(value) {
34
+ return typeof value === "object" && value !== null && !Array.isArray(value);
35
+ }
36
+ function invalidMarketplaceError(message) {
37
+ return new CliError({
38
+ exitCode: 3,
39
+ code: "E_VALIDATION",
40
+ message,
41
+ });
42
+ }
43
+ async function readTextIfExists(filePath) {
44
+ try {
45
+ return await readFile(filePath, "utf8");
46
+ }
47
+ catch (err) {
48
+ const code = err?.code;
49
+ if (code === "ENOENT")
50
+ return null;
51
+ throw err;
52
+ }
53
+ }
54
+ function defaultMarketplaceDocument() {
55
+ return {
56
+ name: DEFAULT_MARKETPLACE_NAME,
57
+ interface: {
58
+ displayName: DEFAULT_MARKETPLACE_DISPLAY_NAME,
59
+ },
60
+ plugins: [],
61
+ };
62
+ }
63
+ function parseMarketplaceDocument(text) {
64
+ if (text === null)
65
+ return defaultMarketplaceDocument();
66
+ let parsed;
67
+ try {
68
+ parsed = JSON.parse(text);
69
+ }
70
+ catch (err) {
71
+ throw invalidMarketplaceError(`Invalid Codex marketplace JSON: ${err instanceof Error ? err.message : "unknown parse error"}`);
72
+ }
73
+ if (!isJsonObject(parsed)) {
74
+ throw invalidMarketplaceError("Invalid Codex marketplace JSON: expected a top-level object.");
75
+ }
76
+ if ("plugins" in parsed && !Array.isArray(parsed.plugins)) {
77
+ throw invalidMarketplaceError("Invalid Codex marketplace JSON: `plugins` must be an array.");
78
+ }
79
+ if ("interface" in parsed && parsed.interface !== undefined && !isJsonObject(parsed.interface)) {
80
+ throw invalidMarketplaceError("Invalid Codex marketplace JSON: `interface` must be an object when present.");
81
+ }
82
+ return parsed;
83
+ }
84
+ function marketplaceEntry() {
85
+ return {
86
+ name: PLUGIN_NAME,
87
+ source: {
88
+ source: "local",
89
+ path: `./plugins/${PLUGIN_NAME}`,
90
+ },
91
+ policy: {
92
+ installation: "AVAILABLE",
93
+ authentication: "ON_INSTALL",
94
+ },
95
+ category: "Productivity",
96
+ };
97
+ }
98
+ function upsertMarketplaceDocument(text) {
99
+ const document = parseMarketplaceDocument(text);
100
+ const interfaceObject = isJsonObject(document.interface) ? { ...document.interface } : {};
101
+ if (typeof document.name !== "string" || document.name.trim().length === 0) {
102
+ document.name = DEFAULT_MARKETPLACE_NAME;
103
+ }
104
+ if (typeof interfaceObject.displayName !== "string" ||
105
+ interfaceObject.displayName.trim().length === 0) {
106
+ interfaceObject.displayName = DEFAULT_MARKETPLACE_DISPLAY_NAME;
107
+ }
108
+ const plugins = Array.isArray(document.plugins) ? document.plugins : [];
109
+ const nextEntry = marketplaceEntry();
110
+ const existingIndex = plugins.findIndex((entry) => isJsonObject(entry) && entry.name === PLUGIN_NAME);
111
+ if (existingIndex === -1) {
112
+ plugins.push(nextEntry);
113
+ }
114
+ else {
115
+ plugins.splice(existingIndex, 1, nextEntry);
116
+ }
117
+ return {
118
+ ...document,
119
+ interface: interfaceObject,
120
+ plugins,
121
+ };
122
+ }
123
+ export function buildCodexPluginManifest(version = getVersion()) {
124
+ return {
125
+ name: PLUGIN_NAME,
126
+ version,
127
+ description: "Bundle AgentPlane workflow guidance for the Codex plugins UI.",
128
+ homepage: "https://github.com/basilisk-labs/agentplane",
129
+ repository: "https://github.com/basilisk-labs/agentplane",
130
+ license: "MIT",
131
+ keywords: ["agentplane", "codex", "workflow", "tasks", "git"],
132
+ skills: "./skills/",
133
+ interface: {
134
+ displayName: "AgentPlane",
135
+ shortDescription: "Governed git-native workflow guidance for Codex",
136
+ longDescription: "Install AgentPlane into Codex through a local marketplace and give Codex explicit task, planning, verification, and branch_pr workflow guidance.",
137
+ developerName: "basilisk-labs",
138
+ category: "Productivity",
139
+ capabilities: ["Read", "Write"],
140
+ websiteURL: "https://github.com/basilisk-labs/agentplane",
141
+ defaultPrompt: [
142
+ "Use AgentPlane to initialize a governed workflow in this repository.",
143
+ "Use AgentPlane to create a task, approve the plan, and start work in branch_pr mode.",
144
+ "Use AgentPlane to verify the active task and record evidence before finish.",
145
+ ],
146
+ brandColor: "#111827",
147
+ composerIcon: "./assets/icon.svg",
148
+ logo: "./assets/logo.svg",
149
+ screenshots: ["./assets/header.png"],
150
+ },
151
+ };
152
+ }
153
+ export function resolveCodexInstallRoot(opts) {
154
+ if (opts.scope === "repo") {
155
+ const repoRoot = opts.repoRoot?.trim();
156
+ if (!repoRoot) {
157
+ throw new CliError({
158
+ exitCode: 2,
159
+ code: "E_USAGE",
160
+ message: "Repo scope requires a resolved repository root.",
161
+ });
162
+ }
163
+ return path.resolve(repoRoot);
164
+ }
165
+ const env = opts.env ?? process.env;
166
+ const overridden = env[AGENTPLANE_CODEX_HOME_ENV]?.trim();
167
+ if (overridden)
168
+ return path.resolve(overridden);
169
+ return os.homedir();
170
+ }
171
+ export function resolveCodexPluginRoot(installRoot) {
172
+ return path.join(installRoot, "plugins", PLUGIN_NAME);
173
+ }
174
+ export function resolveCodexMarketplacePath(installRoot) {
175
+ return path.join(installRoot, ".agents", "plugins", "marketplace.json");
176
+ }
177
+ export async function installBundledCodexPlugin(opts) {
178
+ const installRoot = path.resolve(opts.installRoot);
179
+ const pluginRoot = resolveCodexPluginRoot(installRoot);
180
+ const manifestPath = path.join(pluginRoot, ".codex-plugin", "plugin.json");
181
+ const marketplacePath = resolveCodexMarketplacePath(installRoot);
182
+ await mkdir(path.dirname(manifestPath), { recursive: true });
183
+ await mkdir(path.dirname(marketplacePath), { recursive: true });
184
+ await writeJsonStableIfChanged(manifestPath, buildCodexPluginManifest(opts.version ?? getVersion()));
185
+ const copiedAssets = [];
186
+ for (const asset of TEXT_ASSETS) {
187
+ const targetPath = path.join(pluginRoot, asset.relativePath);
188
+ await mkdir(path.dirname(targetPath), { recursive: true });
189
+ const contents = await readFile(asset.source, "utf8");
190
+ await writeTextIfChanged(targetPath, contents);
191
+ copiedAssets.push(targetPath);
192
+ }
193
+ for (const asset of BINARY_ASSETS) {
194
+ const targetPath = path.join(pluginRoot, asset.relativePath);
195
+ await mkdir(path.dirname(targetPath), { recursive: true });
196
+ await copyFile(fileURLToPath(asset.source), targetPath);
197
+ copiedAssets.push(targetPath);
198
+ }
199
+ const nextMarketplace = upsertMarketplaceDocument(await readTextIfExists(marketplacePath));
200
+ await writeJsonStableIfChanged(marketplacePath, nextMarketplace);
201
+ return {
202
+ scope: opts.scope,
203
+ installRoot,
204
+ pluginRoot,
205
+ manifestPath,
206
+ marketplacePath,
207
+ copiedAssets,
208
+ };
209
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"commit.spec.d.ts","sourceRoot":"","sources":["../../src/commands/commit.spec.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAOvD,MAAM,MAAM,YAAY,GAAG;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;IACnB,WAAW,EAAE,OAAO,CAAC;IACrB,WAAW,EAAE,OAAO,CAAC;IACrB,UAAU,EAAE,OAAO,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;IACjB,YAAY,EAAE,OAAO,CAAC;IACtB,KAAK,EAAE,OAAO,CAAC;IACf,kBAAkB,EAAE,OAAO,CAAC;IAC5B,cAAc,EAAE,OAAO,CAAC;CACzB,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,WAAW,CAAC,YAAY,CAwLhD,CAAC"}
1
+ {"version":3,"file":"commit.spec.d.ts","sourceRoot":"","sources":["../../src/commands/commit.spec.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAOvD,MAAM,MAAM,YAAY,GAAG;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;IACnB,WAAW,EAAE,OAAO,CAAC;IACrB,WAAW,EAAE,OAAO,CAAC;IACrB,UAAU,EAAE,OAAO,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;IACjB,YAAY,EAAE,OAAO,CAAC;IACtB,KAAK,EAAE,OAAO,CAAC;IACf,kBAAkB,EAAE,OAAO,CAAC;IAC5B,cAAc,EAAE,OAAO,CAAC;CACzB,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,WAAW,CAAC,YAAY,CA0LhD,CAAC"}
@@ -104,6 +104,8 @@ export const commitSpec = {
104
104
  },
105
105
  ],
106
106
  notes: [
107
+ "Repository-managed task commits use the canonical subject format `<emoji> <suffix> <scope>: <summary>`; non-task commits use `<emoji> <scope>: <summary>`.",
108
+ "Repository-managed commit paths resolve author/committer identity from global git `user.name` and `user.email` before falling back to ambient git env.",
107
109
  "Protected path-scoped overrides can stand alone without a duplicate explicit prefix: `--allow-tasks`, `--allow-policy`, `--allow-config`, `--allow-hooks`, and `--allow-ci` each admit their own path family.",
108
110
  "Top-level `agentplane commit` can auto-stage those protected path scopes when the git index starts empty.",
109
111
  "`--allow-base` is different: it only overrides base-branch protection and never selects file paths by itself.",
@@ -1,4 +1,4 @@
1
- import type { CommandContext } from "../shared/task-backend.js";
1
+ import { type CommandContext } from "../shared/task-backend.js";
2
2
  export declare function checkBranchPrShippedTaskDrift(ctx?: CommandContext): Promise<string[]>;
3
3
  export declare function checkBranchPrDoneTaskOpenPrDrift(ctx?: CommandContext): Promise<string[]>;
4
4
  //# sourceMappingURL=branch-pr.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"branch-pr.d.ts","sourceRoot":"","sources":["../../../src/commands/doctor/branch-pr.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAMhE,wBAAsB,6BAA6B,CAAC,GAAG,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAuC3F;AAED,wBAAsB,gCAAgC,CAAC,GAAG,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAkC9F"}
1
+ {"version":3,"file":"branch-pr.d.ts","sourceRoot":"","sources":["../../../src/commands/doctor/branch-pr.ts"],"names":[],"mappings":"AAKA,OAAO,EAA6B,KAAK,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAM3F,wBAAsB,6BAA6B,CAAC,GAAG,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAyC3F;AAED,wBAAsB,gCAAgC,CAAC,GAAG,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAoC9F"}
@@ -1,10 +1,12 @@
1
1
  import { readFile } from "node:fs/promises";
2
2
  import path from "node:path";
3
3
  import { renderDiagnosticFinding } from "../../shared/diagnostics.js";
4
+ import { backendUsesLocalTaskStore } from "../shared/task-backend.js";
4
5
  import { findDoneBranchPrTasksWithOpenPrArtifacts, findLocallyShippedBranchPrTasks, } from "../task/hosted-merge-sync.js";
5
6
  export async function checkBranchPrShippedTaskDrift(ctx) {
6
- if (ctx?.backendId !== "local" || ctx.config.workflow_mode !== "branch_pr")
7
+ if (!ctx || !backendUsesLocalTaskStore(ctx) || ctx.config.workflow_mode !== "branch_pr") {
7
8
  return [];
9
+ }
8
10
  let tasks = [];
9
11
  try {
10
12
  tasks = await ctx.taskBackend.listTasks();
@@ -38,8 +40,9 @@ export async function checkBranchPrShippedTaskDrift(ctx) {
38
40
  ];
39
41
  }
40
42
  export async function checkBranchPrDoneTaskOpenPrDrift(ctx) {
41
- if (ctx?.backendId !== "local" || ctx.config.workflow_mode !== "branch_pr")
43
+ if (!ctx || !backendUsesLocalTaskStore(ctx) || ctx.config.workflow_mode !== "branch_pr") {
42
44
  return [];
45
+ }
43
46
  const tasks = await readDoneTaskSnapshot(ctx);
44
47
  if (tasks.length === 0)
45
48
  return [];
@@ -1 +1 @@
1
- {"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../../../src/commands/guard/impl/commands.ts"],"names":[],"mappings":"AAaA,OAAO,EAAsB,KAAK,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAQvF,OAAO,EAAoB,KAAK,kBAAkB,EAAE,MAAM,aAAa,CAAC;AA8SxE,wBAAsB,aAAa,CAAC,IAAI,EAAE;IACxC,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,OAAO,CAAC;CAChB,GAAG,OAAO,CAAC,MAAM,CAAC,CAsBlB;AAED,wBAAsB,oBAAoB,CAAC,IAAI,EAAE;IAC/C,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,OAAO,GAAG,MAAM,CAAC;CAC1B,GAAG,OAAO,CAAC,MAAM,CAAC,CAyBlB;AAED,wBAAsB,cAAc,CAAC,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC,CAa9E;AAED,wBAAsB,SAAS,CAAC,IAAI,EAAE;IACpC,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,kBAAkB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;IACnB,WAAW,EAAE,OAAO,CAAC;IACrB,WAAW,EAAE,OAAO,CAAC;IACrB,UAAU,EAAE,OAAO,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;IACjB,YAAY,EAAE,OAAO,CAAC;IACtB,KAAK,EAAE,OAAO,CAAC;IACf,kBAAkB,EAAE,OAAO,CAAC;IAC5B,cAAc,EAAE,OAAO,CAAC;IACxB,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,yBAAyB,CAAC,EAAE,OAAO,CAAC;CACrC,GAAG,OAAO,CAAC,MAAM,CAAC,CAsPlB"}
1
+ {"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../../../src/commands/guard/impl/commands.ts"],"names":[],"mappings":"AAaA,OAAO,EAAsB,KAAK,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAQvF,OAAO,EAAoB,KAAK,kBAAkB,EAAE,MAAM,aAAa,CAAC;AA+SxE,wBAAsB,aAAa,CAAC,IAAI,EAAE;IACxC,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,OAAO,CAAC;CAChB,GAAG,OAAO,CAAC,MAAM,CAAC,CAsBlB;AAED,wBAAsB,oBAAoB,CAAC,IAAI,EAAE;IAC/C,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,OAAO,GAAG,MAAM,CAAC;CAC1B,GAAG,OAAO,CAAC,MAAM,CAAC,CAyBlB;AAED,wBAAsB,cAAc,CAAC,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC,CAa9E;AAED,wBAAsB,SAAS,CAAC,IAAI,EAAE;IACpC,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,kBAAkB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;IACnB,WAAW,EAAE,OAAO,CAAC;IACrB,WAAW,EAAE,OAAO,CAAC;IACrB,UAAU,EAAE,OAAO,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;IACjB,YAAY,EAAE,OAAO,CAAC;IACtB,KAAK,EAAE,OAAO,CAAC;IACf,kBAAkB,EAAE,OAAO,CAAC;IAC5B,cAAc,EAAE,OAAO,CAAC;IACxB,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,yBAAyB,CAAC,EAAE,OAAO,CAAC;CACrC,GAAG,OAAO,CAAC,MAAM,CAAC,CAwPlB"}
@@ -15,7 +15,7 @@ import { execFileAsync, gitEnv } from "../../shared/git.js";
15
15
  import { ensureReconciledBeforeMutation } from "../../shared/reconcile-check.js";
16
16
  import { stageAllowlist, suggestAllowPrefixes } from "./allow.js";
17
17
  import { buildCloseCommitMessage, taskReadmePathForTask } from "./close-message.js";
18
- import { buildGitCommitEnv } from "./env.js";
18
+ import { buildGitCommitEnv, resolveCanonicalGitIdentity } from "./env.js";
19
19
  import { guardCommitCheck } from "./policy.js";
20
20
  const COMMIT_FAILURE_SIGNAL_PATTERNS = [
21
21
  /Code style issues found/i,
@@ -167,6 +167,7 @@ async function commitRefreshedTaskArtifacts(opts) {
167
167
  allowConfig: false,
168
168
  allowHooks: false,
169
169
  allowCI: false,
170
+ gitIdentity: await resolveCanonicalGitIdentity(),
170
171
  });
171
172
  await opts.ctx.git.commit({ message, env });
172
173
  return true;
@@ -442,6 +443,7 @@ export async function cmdCommit(opts) {
442
443
  allowHooks: false,
443
444
  allowCI: false,
444
445
  allowStaleDist: true,
446
+ gitIdentity: await resolveCanonicalGitIdentity(),
445
447
  });
446
448
  await ctx.git.commit({ message: msg.subject, body: msg.body, env });
447
449
  if (!opts.quiet) {
@@ -512,6 +514,7 @@ export async function cmdCommit(opts) {
512
514
  allowConfig: opts.allowConfig,
513
515
  allowHooks: opts.allowHooks,
514
516
  allowCI: opts.allowCI,
517
+ gitIdentity: await resolveCanonicalGitIdentity(),
515
518
  });
516
519
  await ctx.git.commit({ message: opts.message, env });
517
520
  await refreshBranchPrArtifactsAfterTaskCommit({
@@ -1 +1 @@
1
- {"version":3,"file":"comment-commit.d.ts","sourceRoot":"","sources":["../../../../src/commands/guard/impl/comment-commit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAQ/E,OAAO,EAAsB,KAAK,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAiEvF,wBAAsB,iBAAiB,CAAC,IAAI,EAAE;IAC5C,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;IACpB,YAAY,EAAE,OAAO,CAAC;IACtB,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,gBAAgB,CAAC;CAC1B,GAAG,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CA2F/D"}
1
+ {"version":3,"file":"comment-commit.d.ts","sourceRoot":"","sources":["../../../../src/commands/guard/impl/comment-commit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAQ/E,OAAO,EAAsB,KAAK,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAiEvF,wBAAsB,iBAAiB,CAAC,IAAI,EAAE;IAC5C,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;IACpB,YAAY,EAAE,OAAO,CAAC;IACtB,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,gBAAgB,CAAC;CAC1B,GAAG,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CA4F/D"}
@@ -3,7 +3,7 @@ import { invalidValueMessage, successMessage } from "../../../cli/output.js";
3
3
  import { CliError } from "../../../shared/errors.js";
4
4
  import { formatCommentBodyForCommit, normalizeCommentBodyForCommit, } from "../../../shared/comment-format.js";
5
5
  import { loadCommandContext } from "../../shared/task-backend.js";
6
- import { buildGitCommitEnv } from "./env.js";
6
+ import { buildGitCommitEnv, resolveCanonicalGitIdentity } from "./env.js";
7
7
  import { stageAllowlist } from "./allow.js";
8
8
  import { guardCommitCheck } from "./policy.js";
9
9
  function deriveCommitMessageFromComment(opts) {
@@ -116,6 +116,7 @@ export async function commitFromComment(opts) {
116
116
  allowConfig: false,
117
117
  allowHooks: false,
118
118
  allowCI: false,
119
+ gitIdentity: await resolveCanonicalGitIdentity(),
119
120
  });
120
121
  await ctx.git.commit({ message, body, env });
121
122
  const { hash, subject } = await ctx.git.headHashSubject();
@@ -1,3 +1,8 @@
1
+ export type CanonicalGitIdentity = {
2
+ name: string;
3
+ email: string;
4
+ };
5
+ export declare function resolveCanonicalGitIdentity(): Promise<CanonicalGitIdentity | null>;
1
6
  export declare function buildGitCommitEnv(opts: {
2
7
  taskId: string;
3
8
  agentId?: string;
@@ -9,5 +14,6 @@ export declare function buildGitCommitEnv(opts: {
9
14
  allowHooks: boolean;
10
15
  allowCI: boolean;
11
16
  allowStaleDist?: boolean;
17
+ gitIdentity?: CanonicalGitIdentity | null;
12
18
  }): NodeJS.ProcessEnv;
13
19
  //# sourceMappingURL=env.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../../../../src/commands/guard/impl/env.ts"],"names":[],"mappings":"AAAA,wBAAgB,iBAAiB,CAAC,IAAI,EAAE;IACtC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;IACnB,WAAW,EAAE,OAAO,CAAC;IACrB,WAAW,EAAE,OAAO,CAAC;IACrB,UAAU,EAAE,OAAO,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;IACjB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,GAAG,MAAM,CAAC,UAAU,CAcpB"}
1
+ {"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../../../../src/commands/guard/impl/env.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,oBAAoB,GAAG;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAiBF,wBAAsB,2BAA2B,IAAI,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC,CAkBxF;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE;IACtC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;IACnB,WAAW,EAAE,OAAO,CAAC;IACrB,WAAW,EAAE,OAAO,CAAC;IACrB,UAAU,EAAE,OAAO,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;IACjB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,WAAW,CAAC,EAAE,oBAAoB,GAAG,IAAI,CAAC;CAC3C,GAAG,MAAM,CAAC,UAAU,CAsBpB"}
@@ -1,6 +1,47 @@
1
+ import { execFileAsync } from "../../shared/git.js";
2
+ let canonicalGitIdentityPromise = null;
3
+ async function readGitConfigValue(key) {
4
+ try {
5
+ const { stdout } = await execFileAsync("git", ["config", "--global", "--get", key], {
6
+ cwd: process.cwd(),
7
+ env: process.env,
8
+ });
9
+ const trimmed = stdout.trim();
10
+ return trimmed.length > 0 ? trimmed : null;
11
+ }
12
+ catch {
13
+ return null;
14
+ }
15
+ }
16
+ export async function resolveCanonicalGitIdentity() {
17
+ canonicalGitIdentityPromise ??= (async () => {
18
+ const globalName = await readGitConfigValue("user.name");
19
+ const globalEmail = await readGitConfigValue("user.email");
20
+ const name = globalName ??
21
+ process.env.GIT_AUTHOR_NAME?.trim() ??
22
+ process.env.GIT_COMMITTER_NAME?.trim() ??
23
+ null;
24
+ const email = globalEmail ??
25
+ process.env.GIT_AUTHOR_EMAIL?.trim() ??
26
+ process.env.GIT_COMMITTER_EMAIL?.trim() ??
27
+ null;
28
+ if (!name || !email)
29
+ return null;
30
+ return { name, email };
31
+ })();
32
+ return await canonicalGitIdentityPromise;
33
+ }
1
34
  export function buildGitCommitEnv(opts) {
2
35
  return {
3
36
  ...process.env,
37
+ ...(opts.gitIdentity
38
+ ? {
39
+ GIT_AUTHOR_NAME: opts.gitIdentity.name,
40
+ GIT_AUTHOR_EMAIL: opts.gitIdentity.email,
41
+ GIT_COMMITTER_NAME: opts.gitIdentity.name,
42
+ GIT_COMMITTER_EMAIL: opts.gitIdentity.email,
43
+ }
44
+ : null),
4
45
  AGENTPLANE_TASK_ID: opts.taskId,
5
46
  ...(opts.agentId ? { AGENTPLANE_AGENT_ID: opts.agentId } : null),
6
47
  ...(opts.statusTo ? { AGENTPLANE_STATUS_TO: opts.statusTo } : null),
@@ -1 +1 @@
1
- {"version":3,"file":"cmd.d.ts","sourceRoot":"","sources":["../../../../src/commands/pr/integrate/cmd.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAUnE,wBAAsB,YAAY,CAAC,IAAI,EAAE;IACvC,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,QAAQ,GAAG,OAAO,GAAG,QAAQ,CAAC;IAC7C,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,EAAE,OAAO,CAAC;IAChB,KAAK,EAAE,OAAO,CAAC;CAChB,GAAG,OAAO,CAAC,MAAM,CAAC,CA+OlB"}
1
+ {"version":3,"file":"cmd.d.ts","sourceRoot":"","sources":["../../../../src/commands/pr/integrate/cmd.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AA0EnE,wBAAsB,YAAY,CAAC,IAAI,EAAE;IACvC,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,QAAQ,GAAG,OAAO,GAAG,QAAQ,CAAC;IAC7C,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,EAAE,OAAO,CAAC;IAChB,KAAK,EAAE,OAAO,CAAC;CAChB,GAAG,OAAO,CAAC,MAAM,CAAC,CA6QlB"}
@@ -2,11 +2,13 @@ import path from "node:path";
2
2
  import { mapBackendError } from "../../../cli/error-map.js";
3
3
  import { exitCodeForError } from "../../../cli/exit-codes.js";
4
4
  import { createCliEmitter } from "../../../cli/output.js";
5
+ import { withDiagnosticContext } from "../../../shared/diagnostics.js";
5
6
  import { CliError } from "../../../shared/errors.js";
6
7
  import { cleanupIntegratedBranch } from "./internal/cleanup.js";
7
8
  import { renderPostIntegrateBootstrapFailureGuidance, renderPostIntegrateBootstrapGuidance, shouldRecommendPostIntegrateBootstrap, } from "./internal/bootstrap-guidance.js";
8
9
  import { execFileAsync, gitEnv } from "../../shared/git.js";
9
10
  import { gitRevParse } from "../../shared/git-ops.js";
11
+ import { buildTaskHandoffArtifact, resolveTaskHandoffPaths, writeTaskHandoff, } from "../../shared/task-handoff.js";
10
12
  import { finalizeIntegrate } from "./internal/finalize.js";
11
13
  import { runMergeCommit, runRebaseFastForward, runSquashMerge } from "./internal/merge.js";
12
14
  import { maybeRunPreIntegrateBootstrap } from "./internal/pre-integrate-bootstrap.js";
@@ -14,6 +16,54 @@ import { maybeRunPostIntegrateBootstrap } from "./internal/post-integrate-bootst
14
16
  import { prepareIntegrate } from "./internal/prepare.js";
15
17
  import { resolveWorktreeForIntegrate } from "./internal/worktree.js";
16
18
  import { runVerifyCommands } from "./verify.js";
19
+ async function recordProtectedBaseIntegrateHandoff(opts) {
20
+ const paths = resolveTaskHandoffPaths({
21
+ git_root: opts.ctx.resolvedProject.gitRoot,
22
+ workflow_dir: opts.ctx.config.paths.workflow_dir,
23
+ task_id: opts.taskId,
24
+ });
25
+ const handoffShowCommand = `agentplane task handoff show ${opts.taskId}`;
26
+ const prLabel = typeof opts.prNumber === "number" && opts.prNumber > 0
27
+ ? `GitHub PR #${opts.prNumber}`
28
+ : `the GitHub PR for branch ${opts.branch}`;
29
+ const prUrl = opts.prUrl?.trim() ?? "";
30
+ const prMetaPath = path.join(opts.ctx.config.paths.workflow_dir, opts.taskId, "pr", "meta.json");
31
+ const taskReadmePath = path.join(opts.ctx.config.paths.workflow_dir, opts.taskId, "README.md");
32
+ await writeTaskHandoff({
33
+ paths,
34
+ handoff: buildTaskHandoffArtifact({
35
+ task_id: opts.taskId,
36
+ created_at: new Date().toISOString(),
37
+ from_role: "INTEGRATOR",
38
+ reason: `Protected base ${opts.base} requires GitHub pull-request merges.`,
39
+ note: prUrl.length > 0
40
+ ? `Merge ${prLabel}: ${prUrl}. After GitHub merge, wait for Task Hosted Close, then pull ${opts.base}.`
41
+ : `Merge ${prLabel} on GitHub. After GitHub merge, wait for Task Hosted Close, then pull ${opts.base}.`,
42
+ branch: opts.branch,
43
+ base_branch: opts.base,
44
+ head_sha: opts.branchHeadSha,
45
+ workspace_root: opts.ctx.resolvedProject.gitRoot,
46
+ pr_branch: opts.branch,
47
+ route: {
48
+ kind: "protected_base_integrate",
49
+ status: "awaiting_github_merge",
50
+ local_mutation: "not_performed",
51
+ finalize_via: "github_pr_merge_then_hosted_close",
52
+ pr_number: opts.prNumber,
53
+ pr_url: prUrl.length > 0 ? prUrl : null,
54
+ handoff_show_command: handoffShowCommand,
55
+ base_pull_command: "git pull --ff-only",
56
+ },
57
+ next_actions: [
58
+ handoffShowCommand,
59
+ prUrl.length > 0 ? `Merge ${prLabel}: ${prUrl}` : `Merge ${prLabel} on GitHub`,
60
+ `Wait for Task Hosted Close to finish`,
61
+ `git pull --ff-only`,
62
+ ],
63
+ evidence_paths: [taskReadmePath, prMetaPath],
64
+ }),
65
+ });
66
+ }
17
67
  export async function cmdIntegrate(opts) {
18
68
  let tempWorktreePath = null;
19
69
  let createdTempWorktree = false;
@@ -41,14 +91,40 @@ export async function cmdIntegrate(opts) {
41
91
  return 0;
42
92
  }
43
93
  if (protectedBaseRequiresPrMerge) {
44
- const prHint = typeof metaSource.pr_number === "number" && metaSource.pr_number > 0
45
- ? `GitHub PR #${metaSource.pr_number}`
46
- : `the GitHub PR for branch ${branch}`;
94
+ const prNumber = typeof metaSource.pr_number === "number" && metaSource.pr_number > 0
95
+ ? metaSource.pr_number
96
+ : null;
97
+ const prUrl = typeof metaSource.pr_url === "string" ? metaSource.pr_url : null;
98
+ const prHint = prNumber === null ? `the GitHub PR for branch ${branch}` : `GitHub PR #${prNumber}`;
99
+ await recordProtectedBaseIntegrateHandoff({
100
+ ctx: prepared.ctx,
101
+ taskId: task.id,
102
+ branch,
103
+ base,
104
+ branchHeadSha,
105
+ prNumber,
106
+ prUrl,
107
+ });
47
108
  throw new CliError({
48
- exitCode: exitCodeForError("E_GIT"),
49
- code: "E_GIT",
109
+ exitCode: exitCodeForError("E_HANDOFF"),
110
+ code: "E_HANDOFF",
50
111
  message: `Base branch ${base} requires GitHub pull-request merges; integrate will not mutate it locally. ` +
51
112
  `Merge ${prHint} on GitHub, let Task Hosted Close finish the closure tail, then pull ${base}.`,
113
+ context: withDiagnosticContext({
114
+ task_id: task.id,
115
+ branch,
116
+ base_branch: base,
117
+ reason_code: "protected_base_integrate_handoff",
118
+ }, {
119
+ state: `protected-base integrate routed to GitHub merge handoff for ${task.id}`,
120
+ likelyCause: `base branch ${base} is protected by a GitHub pull-request merge policy, so local integrate must stop before mutating ${base}`,
121
+ hint: "Inspect the persisted handoff artifact for the canonical finalize route, then merge the PR on GitHub and let Task Hosted Close finish the close tail.",
122
+ nextAction: {
123
+ command: `agentplane task handoff show ${task.id}`,
124
+ reason: "inspect the persisted protected-base finalize route before continuing",
125
+ reasonCode: "protected_base_integrate_handoff",
126
+ },
127
+ }),
52
128
  });
53
129
  }
54
130
  const wt = await resolveWorktreeForIntegrate({
@@ -1 +1 @@
1
- {"version":3,"file":"prepare.d.ts","sourceRoot":"","sources":["../../../../../src/commands/pr/integrate/internal/prepare.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sCAAsC,CAAC;AAUrE,OAAO,EAIL,KAAK,cAAc,EACpB,MAAM,iCAAiC,CAAC;AAWzC,OAAO,EAAgC,KAAK,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAIvF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,GAAG,EAAE,cAAc,CAAC;IACpB,QAAQ,EAAE,cAAc,CAAC,iBAAiB,CAAC,CAAC;IAC5C,YAAY,EAAE,cAAc,CAAC,QAAQ,CAAC,CAAC;IACvC,IAAI,EAAE,QAAQ,CAAC;IAEf,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,4BAA4B,EAAE,OAAO,CAAC;IAEtC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IAEtB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IAEb,aAAa,EAAE,MAAM,CAAC;IAEtB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,eAAe,EAAE,OAAO,CAAC;CAC1B,CAAC;AAEF,wBAAsB,gBAAgB,CAAC,IAAI,EAAE;IAC3C,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,OAAO,CAAC;CACpB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAgP7B"}
1
+ {"version":3,"file":"prepare.d.ts","sourceRoot":"","sources":["../../../../../src/commands/pr/integrate/internal/prepare.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sCAAsC,CAAC;AAWrE,OAAO,EAIL,KAAK,cAAc,EACpB,MAAM,iCAAiC,CAAC;AAWzC,OAAO,EAAgC,KAAK,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAIvF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,GAAG,EAAE,cAAc,CAAC;IACpB,QAAQ,EAAE,cAAc,CAAC,iBAAiB,CAAC,CAAC;IAC5C,YAAY,EAAE,cAAc,CAAC,QAAQ,CAAC,CAAC;IACvC,IAAI,EAAE,QAAQ,CAAC;IAEf,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,4BAA4B,EAAE,OAAO,CAAC;IAEtC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IAEtB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IAEb,aAAa,EAAE,MAAM,CAAC;IAEtB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,eAAe,EAAE,OAAO,CAAC;CAC1B,CAAC;AAEF,wBAAsB,gBAAgB,CAAC,IAAI,EAAE;IAC3C,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,OAAO,CAAC;CACpB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAqR7B"}