agentplane 0.3.15 → 0.3.16

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 (423) hide show
  1. package/assets/policy/incidents.md +7 -0
  2. package/bin/agentplane.js +1 -1
  3. package/bin/framework-dev-contract.js +1 -0
  4. package/dist/.build-manifest.json +506 -321
  5. package/dist/backends/task-backend/load.d.ts.map +1 -1
  6. package/dist/backends/task-backend/load.js +32 -19
  7. package/dist/backends/task-backend/local-backend-doc.d.ts.map +1 -1
  8. package/dist/backends/task-backend/local-backend-doc.js +1 -1
  9. package/dist/backends/task-backend/redmine/backend-runtime.d.ts +147 -0
  10. package/dist/backends/task-backend/redmine/backend-runtime.d.ts.map +1 -0
  11. package/dist/backends/task-backend/redmine/backend-runtime.js +258 -0
  12. package/dist/backends/task-backend/redmine/backend-sync/context.d.ts +44 -0
  13. package/dist/backends/task-backend/redmine/backend-sync/context.d.ts.map +1 -0
  14. package/dist/backends/task-backend/redmine/backend-sync/context.js +8 -0
  15. package/dist/backends/task-backend/redmine/backend-sync/ids.d.ts +6 -0
  16. package/dist/backends/task-backend/redmine/backend-sync/ids.d.ts.map +1 -0
  17. package/dist/backends/task-backend/redmine/backend-sync/ids.js +21 -0
  18. package/dist/backends/task-backend/redmine/backend-sync/migration.d.ts +4 -0
  19. package/dist/backends/task-backend/redmine/backend-sync/migration.d.ts.map +1 -0
  20. package/dist/backends/task-backend/redmine/backend-sync/migration.js +87 -0
  21. package/dist/backends/task-backend/redmine/backend-sync/status.d.ts +10 -0
  22. package/dist/backends/task-backend/redmine/backend-sync/status.d.ts.map +1 -0
  23. package/dist/backends/task-backend/redmine/backend-sync/status.js +78 -0
  24. package/dist/backends/task-backend/redmine/backend-sync/sync.d.ts +12 -0
  25. package/dist/backends/task-backend/redmine/backend-sync/sync.d.ts.map +1 -0
  26. package/dist/backends/task-backend/redmine/backend-sync/sync.js +82 -0
  27. package/dist/backends/task-backend/redmine/backend-sync/write.d.ts +5 -0
  28. package/dist/backends/task-backend/redmine/backend-sync/write.d.ts.map +1 -0
  29. package/dist/backends/task-backend/redmine/backend-sync/write.js +100 -0
  30. package/dist/backends/task-backend/redmine/backend-sync.d.ts +6 -66
  31. package/dist/backends/task-backend/redmine/backend-sync.d.ts.map +1 -1
  32. package/dist/backends/task-backend/redmine/backend-sync.js +5 -367
  33. package/dist/backends/task-backend/redmine-backend.d.ts +2 -33
  34. package/dist/backends/task-backend/redmine-backend.d.ts.map +1 -1
  35. package/dist/backends/task-backend/redmine-backend.js +26 -241
  36. package/dist/backends/task-backend/shared/errors.d.ts +12 -0
  37. package/dist/backends/task-backend/shared/errors.d.ts.map +1 -1
  38. package/dist/backends/task-backend/shared/errors.js +12 -0
  39. package/dist/cli/archive.d.ts.map +1 -1
  40. package/dist/cli/archive.js +3 -5
  41. package/dist/cli/error-map.d.ts +7 -1
  42. package/dist/cli/error-map.d.ts.map +1 -1
  43. package/dist/cli/error-map.js +231 -19
  44. package/dist/cli/exit-codes.d.ts +14 -2
  45. package/dist/cli/exit-codes.d.ts.map +1 -1
  46. package/dist/cli/exit-codes.js +24 -11
  47. package/dist/cli/output.d.ts +3 -0
  48. package/dist/cli/output.d.ts.map +1 -1
  49. package/dist/cli/output.js +25 -14
  50. package/dist/cli/prompts.d.ts.map +1 -1
  51. package/dist/cli/prompts.js +44 -0
  52. package/dist/cli/run-cli/command-catalog/core.d.ts.map +1 -1
  53. package/dist/cli/run-cli/command-catalog/core.js +34 -76
  54. package/dist/cli/run-cli/command-catalog/lifecycle.d.ts.map +1 -1
  55. package/dist/cli/run-cli/command-catalog/lifecycle.js +23 -26
  56. package/dist/cli/run-cli/command-catalog/project.d.ts.map +1 -1
  57. package/dist/cli/run-cli/command-catalog/project.js +39 -54
  58. package/dist/cli/run-cli/command-catalog/shared.d.ts +15 -3
  59. package/dist/cli/run-cli/command-catalog/shared.d.ts.map +1 -1
  60. package/dist/cli/run-cli/command-catalog/shared.js +19 -6
  61. package/dist/cli/run-cli/command-catalog/task.d.ts.map +1 -1
  62. package/dist/cli/run-cli/command-catalog/task.js +63 -57
  63. package/dist/cli/run-cli/command-loaders.d.ts +174 -0
  64. package/dist/cli/run-cli/command-loaders.d.ts.map +1 -0
  65. package/dist/cli/run-cli/command-loaders.js +128 -0
  66. package/dist/cli/run-cli/commands/init/model.d.ts +42 -0
  67. package/dist/cli/run-cli/commands/init/model.d.ts.map +1 -0
  68. package/dist/cli/run-cli/commands/init/orchestrate.d.ts +9 -0
  69. package/dist/cli/run-cli/commands/init/orchestrate.d.ts.map +1 -0
  70. package/dist/cli/run-cli/commands/init/orchestrate.js +321 -0
  71. package/dist/cli/run-cli/commands/init/parsers.d.ts +5 -0
  72. package/dist/cli/run-cli/commands/init/parsers.d.ts.map +1 -0
  73. package/dist/cli/run-cli/commands/init/parsers.js +36 -0
  74. package/dist/cli/run-cli/commands/init/presets.d.ts +15 -0
  75. package/dist/cli/run-cli/commands/init/presets.d.ts.map +1 -0
  76. package/dist/cli/run-cli/commands/init/presets.js +63 -0
  77. package/dist/cli/run-cli/commands/init/spec.d.ts +5 -0
  78. package/dist/cli/run-cli/commands/init/spec.d.ts.map +1 -0
  79. package/dist/cli/run-cli/commands/init/spec.js +212 -0
  80. package/dist/cli/run-cli/commands/init/write-config.d.ts +1 -0
  81. package/dist/cli/run-cli/commands/init/write-config.d.ts.map +1 -1
  82. package/dist/cli/run-cli/commands/init/write-config.js +1 -0
  83. package/dist/cli/run-cli/commands/init/write-gitignore.js +1 -1
  84. package/dist/cli/run-cli/commands/init.d.ts +1 -28
  85. package/dist/cli/run-cli/commands/init.d.ts.map +1 -1
  86. package/dist/cli/run-cli/commands/init.js +1 -596
  87. package/dist/cli/run-cli/update-warning.d.ts +1 -0
  88. package/dist/cli/run-cli/update-warning.d.ts.map +1 -1
  89. package/dist/cli/run-cli/update-warning.js +10 -2
  90. package/dist/cli/run-cli.d.ts.map +1 -1
  91. package/dist/cli/run-cli.js +1 -2
  92. package/dist/cli/spec/errors.d.ts +13 -1
  93. package/dist/cli/spec/errors.d.ts.map +1 -1
  94. package/dist/cli/spec/errors.js +14 -4
  95. package/dist/commands/backend.d.ts.map +1 -1
  96. package/dist/commands/backend.js +66 -118
  97. package/dist/commands/block.spec.js +1 -1
  98. package/dist/commands/branch/work-start.js +1 -1
  99. package/dist/commands/commit.spec.js +1 -1
  100. package/dist/commands/doctor/branch-pr.js +1 -1
  101. package/dist/commands/doctor/fixes.js +1 -1
  102. package/dist/commands/doctor/runtime.d.ts.map +1 -1
  103. package/dist/commands/doctor/runtime.js +2 -2
  104. package/dist/commands/doctor/workspace.js +1 -1
  105. package/dist/commands/finish.spec.js +1 -1
  106. package/dist/commands/guard/commit.command.js +1 -1
  107. package/dist/commands/guard/impl/clean.d.ts +6 -0
  108. package/dist/commands/guard/impl/clean.d.ts.map +1 -0
  109. package/dist/commands/guard/impl/clean.js +29 -0
  110. package/dist/commands/guard/impl/close-dirt.d.ts +6 -0
  111. package/dist/commands/guard/impl/close-dirt.d.ts.map +1 -0
  112. package/dist/commands/guard/impl/close-dirt.js +56 -0
  113. package/dist/commands/guard/impl/commands.d.ts +4 -36
  114. package/dist/commands/guard/impl/commands.d.ts.map +1 -1
  115. package/dist/commands/guard/impl/commands.js +4 -549
  116. package/dist/commands/guard/impl/comment-commit.js +1 -1
  117. package/dist/commands/guard/impl/commit-diagnostics.d.ts +4 -0
  118. package/dist/commands/guard/impl/commit-diagnostics.d.ts.map +1 -0
  119. package/dist/commands/guard/impl/commit-diagnostics.js +150 -0
  120. package/dist/commands/guard/impl/commit.d.ts +25 -0
  121. package/dist/commands/guard/impl/commit.d.ts.map +1 -0
  122. package/dist/commands/guard/impl/commit.js +366 -0
  123. package/dist/commands/guard/impl/guard-commit.d.ts +3 -0
  124. package/dist/commands/guard/impl/guard-commit.d.ts.map +1 -0
  125. package/dist/commands/guard/impl/guard-commit.js +21 -0
  126. package/dist/commands/guard/impl/policy.d.ts +1 -0
  127. package/dist/commands/guard/impl/policy.d.ts.map +1 -1
  128. package/dist/commands/guard/impl/policy.js +9 -2
  129. package/dist/commands/guard/impl/suggest.d.ts +6 -0
  130. package/dist/commands/guard/impl/suggest.d.ts.map +1 -0
  131. package/dist/commands/guard/impl/suggest.js +33 -0
  132. package/dist/commands/hooks/index.d.ts +3 -0
  133. package/dist/commands/hooks/index.d.ts.map +1 -1
  134. package/dist/commands/hooks/index.js +27 -10
  135. package/dist/commands/pr/integrate/cmd.js +1 -1
  136. package/dist/commands/pr/integrate/internal/prepare.js +1 -1
  137. package/dist/commands/pr/internal/auto-commit.d.ts.map +1 -1
  138. package/dist/commands/pr/internal/auto-commit.js +2 -5
  139. package/dist/commands/pr/internal/gh-api.d.ts.map +1 -1
  140. package/dist/commands/pr/internal/gh-api.js +15 -8
  141. package/dist/commands/pr/internal/sync-branch.d.ts +0 -1
  142. package/dist/commands/pr/internal/sync-branch.d.ts.map +1 -1
  143. package/dist/commands/pr/internal/sync-branch.js +2 -5
  144. package/dist/commands/pr/internal/sync.d.ts.map +1 -1
  145. package/dist/commands/pr/internal/sync.js +30 -0
  146. package/dist/commands/pr/open.d.ts.map +1 -1
  147. package/dist/commands/pr/open.js +98 -8
  148. package/dist/commands/recipes/impl/resolver.js +1 -1
  149. package/dist/commands/recipes/impl/version.js +1 -1
  150. package/dist/commands/release/apply.command.js +1 -1
  151. package/dist/commands/release/apply.mutation.d.ts +1 -0
  152. package/dist/commands/release/apply.mutation.d.ts.map +1 -1
  153. package/dist/commands/release/apply.mutation.js +4 -0
  154. package/dist/commands/release/apply.pipeline/finalize.d.ts +21 -0
  155. package/dist/commands/release/apply.pipeline/finalize.d.ts.map +1 -0
  156. package/dist/commands/release/apply.pipeline/finalize.js +80 -0
  157. package/dist/commands/release/apply.pipeline/mutation.d.ts +18 -0
  158. package/dist/commands/release/apply.pipeline/mutation.d.ts.map +1 -0
  159. package/dist/commands/release/apply.pipeline/mutation.js +78 -0
  160. package/dist/commands/release/apply.pipeline/preflight.d.ts +25 -0
  161. package/dist/commands/release/apply.pipeline/preflight.d.ts.map +1 -0
  162. package/dist/commands/release/apply.pipeline/preflight.js +69 -0
  163. package/dist/commands/release/apply.pipeline/shared.d.ts +2 -0
  164. package/dist/commands/release/apply.pipeline/shared.d.ts.map +1 -0
  165. package/dist/commands/release/apply.pipeline/shared.js +5 -0
  166. package/dist/commands/release/apply.pipeline/state.d.ts +25 -0
  167. package/dist/commands/release/apply.pipeline/state.d.ts.map +1 -0
  168. package/dist/commands/release/apply.pipeline/state.js +129 -0
  169. package/dist/commands/release/apply.pipeline.d.ts +1 -1
  170. package/dist/commands/release/apply.pipeline.d.ts.map +1 -1
  171. package/dist/commands/release/apply.pipeline.js +4 -347
  172. package/dist/commands/release/apply.preflight.d.ts +9 -6
  173. package/dist/commands/release/apply.preflight.d.ts.map +1 -1
  174. package/dist/commands/release/apply.preflight.js +71 -51
  175. package/dist/commands/runtime.command.d.ts +2 -2
  176. package/dist/commands/runtime.command.d.ts.map +1 -1
  177. package/dist/commands/runtime.command.js +2 -2
  178. package/dist/commands/scenario/impl/commands.d.ts.map +1 -1
  179. package/dist/commands/scenario/impl/commands.js +52 -39
  180. package/dist/commands/scenario/impl/report.d.ts.map +1 -1
  181. package/dist/commands/scenario/impl/report.js +4 -7
  182. package/dist/commands/shared/allow-prefix-policy.d.ts.map +1 -0
  183. package/dist/{shared → commands/shared}/allow-prefix-policy.js +1 -1
  184. package/dist/commands/shared/comment-format.d.ts.map +1 -0
  185. package/dist/commands/shared/diagnostics.d.ts.map +1 -0
  186. package/dist/commands/shared/git-context.d.ts +1 -27
  187. package/dist/commands/shared/git-context.d.ts.map +1 -1
  188. package/dist/commands/shared/git-context.js +1 -156
  189. package/dist/commands/shared/git-diff.d.ts +1 -10
  190. package/dist/commands/shared/git-diff.d.ts.map +1 -1
  191. package/dist/commands/shared/git-diff.js +1 -49
  192. package/dist/commands/shared/git-ops.d.ts +1 -14
  193. package/dist/commands/shared/git-ops.d.ts.map +1 -1
  194. package/dist/commands/shared/git-ops.js +20 -150
  195. package/dist/commands/shared/git-worktree.d.ts +1 -9
  196. package/dist/commands/shared/git-worktree.d.ts.map +1 -1
  197. package/dist/commands/shared/git-worktree.js +1 -68
  198. package/dist/commands/shared/git.d.ts +1 -3
  199. package/dist/commands/shared/git.d.ts.map +1 -1
  200. package/dist/commands/shared/git.js +1 -14
  201. package/dist/commands/shared/policy-deny.d.ts +1 -1
  202. package/dist/commands/shared/reconcile-check.js +1 -1
  203. package/dist/commands/shared/task-backend.d.ts.map +1 -1
  204. package/dist/commands/shared/task-backend.js +24 -2
  205. package/dist/commands/shared/task-store/intents.d.ts.map +1 -1
  206. package/dist/commands/shared/task-store/intents.js +1 -1
  207. package/dist/commands/start.spec.js +1 -1
  208. package/dist/commands/task/close-tail-state.d.ts +7 -0
  209. package/dist/commands/task/close-tail-state.d.ts.map +1 -0
  210. package/dist/commands/task/close-tail-state.js +18 -0
  211. package/dist/commands/task/derive.js +1 -1
  212. package/dist/commands/task/finish-close.d.ts +22 -0
  213. package/dist/commands/task/finish-close.d.ts.map +1 -0
  214. package/dist/commands/task/finish-close.js +119 -0
  215. package/dist/commands/task/finish-command.d.ts +3 -0
  216. package/dist/commands/task/finish-command.d.ts.map +1 -0
  217. package/dist/commands/task/finish-command.js +56 -0
  218. package/dist/commands/task/finish-execute.d.ts +8 -0
  219. package/dist/commands/task/finish-execute.d.ts.map +1 -0
  220. package/dist/commands/task/finish-execute.js +272 -0
  221. package/dist/commands/task/finish-findings.d.ts +20 -0
  222. package/dist/commands/task/finish-findings.d.ts.map +1 -0
  223. package/dist/commands/task/finish-findings.js +27 -0
  224. package/dist/commands/task/finish-plan.d.ts +7 -0
  225. package/dist/commands/task/finish-plan.d.ts.map +1 -0
  226. package/dist/commands/task/finish-plan.js +157 -0
  227. package/dist/commands/task/finish-types.d.ts +69 -0
  228. package/dist/commands/task/finish-types.d.ts.map +1 -0
  229. package/dist/commands/task/finish.d.ts +1 -42
  230. package/dist/commands/task/finish.d.ts.map +1 -1
  231. package/dist/commands/task/finish.js +1 -527
  232. package/dist/commands/task/hosted-close-pr.command.d.ts.map +1 -1
  233. package/dist/commands/task/hosted-close-pr.command.js +29 -4
  234. package/dist/commands/task/hosted-merge-sync/builders.d.ts +35 -0
  235. package/dist/commands/task/hosted-merge-sync/builders.d.ts.map +1 -0
  236. package/dist/commands/task/hosted-merge-sync/builders.js +148 -0
  237. package/dist/commands/task/hosted-merge-sync/github.d.ts +10 -0
  238. package/dist/commands/task/hosted-merge-sync/github.d.ts.map +1 -0
  239. package/dist/commands/task/hosted-merge-sync/github.js +113 -0
  240. package/dist/commands/task/hosted-merge-sync/local-branch.d.ts +12 -0
  241. package/dist/commands/task/hosted-merge-sync/local-branch.d.ts.map +1 -0
  242. package/dist/commands/task/hosted-merge-sync/local-branch.js +143 -0
  243. package/dist/commands/task/hosted-merge-sync/model.d.ts +47 -0
  244. package/dist/commands/task/hosted-merge-sync/model.d.ts.map +1 -0
  245. package/dist/commands/task/hosted-merge-sync/pr-meta.d.ts +12 -0
  246. package/dist/commands/task/hosted-merge-sync/pr-meta.d.ts.map +1 -0
  247. package/dist/commands/task/hosted-merge-sync/pr-meta.js +26 -0
  248. package/dist/commands/task/hosted-merge-sync.d.ts +5 -63
  249. package/dist/commands/task/hosted-merge-sync.d.ts.map +1 -1
  250. package/dist/commands/task/hosted-merge-sync.js +10 -444
  251. package/dist/commands/task/new.js +1 -1
  252. package/dist/commands/task/set-status.command.js +1 -1
  253. package/dist/commands/task/shared/direct-work-lock.d.ts.map +1 -0
  254. package/dist/commands/task/shared/git-log.d.ts.map +1 -0
  255. package/dist/commands/task/shared/transitions.d.ts +1 -1
  256. package/dist/commands/task/shared/transitions.d.ts.map +1 -1
  257. package/dist/commands/task/shared/transitions.js +4 -6
  258. package/dist/commands/upgrade/apply.js +1 -1
  259. package/dist/commands/workflow-playbook.command.d.ts.map +1 -1
  260. package/dist/commands/workflow-playbook.command.js +8 -7
  261. package/dist/harness/hooks-lifecycle.d.ts.map +1 -1
  262. package/dist/harness/hooks-lifecycle.js +11 -7
  263. package/dist/meta/release.d.ts.map +1 -1
  264. package/dist/meta/release.js +8 -4
  265. package/dist/policy/engine.d.ts +1 -1
  266. package/dist/policy/evaluate.d.ts +1 -1
  267. package/dist/policy/{types.d.ts → model.d.ts} +1 -1
  268. package/dist/policy/{types.d.ts.map → model.d.ts.map} +1 -1
  269. package/dist/policy/result.d.ts +1 -1
  270. package/dist/policy/rules/allowlist.d.ts +1 -1
  271. package/dist/policy/rules/branch-pr-base.d.ts +1 -1
  272. package/dist/policy/rules/clean-tree.d.ts +1 -1
  273. package/dist/policy/rules/commit-subject.d.ts +1 -1
  274. package/dist/policy/rules/protected-paths.d.ts +1 -1
  275. package/dist/runner/adapters/base.d.ts +42 -0
  276. package/dist/runner/adapters/base.d.ts.map +1 -0
  277. package/dist/runner/adapters/base.js +107 -0
  278. package/dist/runner/adapters/codex-preparation.d.ts +7 -0
  279. package/dist/runner/adapters/codex-preparation.d.ts.map +1 -0
  280. package/dist/runner/adapters/codex-preparation.js +86 -0
  281. package/dist/runner/adapters/codex.d.ts.map +1 -1
  282. package/dist/runner/adapters/codex.js +30 -175
  283. package/dist/runner/adapters/custom-preparation.d.ts +9 -0
  284. package/dist/runner/adapters/custom-preparation.d.ts.map +1 -0
  285. package/dist/runner/adapters/custom-preparation.js +191 -0
  286. package/dist/runner/adapters/custom.d.ts.map +1 -1
  287. package/dist/runner/adapters/custom.js +26 -279
  288. package/dist/runner/process-supervision/run.d.ts +30 -0
  289. package/dist/runner/process-supervision/run.d.ts.map +1 -0
  290. package/dist/runner/process-supervision/run.js +349 -0
  291. package/dist/runner/process-supervision/signals.d.ts +16 -0
  292. package/dist/runner/process-supervision/signals.d.ts.map +1 -0
  293. package/dist/runner/process-supervision/signals.js +85 -0
  294. package/dist/runner/process-supervision/state.d.ts +10 -0
  295. package/dist/runner/process-supervision/state.d.ts.map +1 -0
  296. package/dist/runner/process-supervision/state.js +42 -0
  297. package/dist/runner/process-supervision/streams.d.ts +6 -0
  298. package/dist/runner/process-supervision/streams.d.ts.map +1 -0
  299. package/dist/runner/process-supervision/streams.js +23 -0
  300. package/dist/runner/process-supervision.d.ts +5 -47
  301. package/dist/runner/process-supervision.d.ts.map +1 -1
  302. package/dist/runner/process-supervision.js +3 -490
  303. package/dist/runner/usecases/scenario-materialize-task.js +1 -1
  304. package/dist/runtime/approvals/index.d.ts +1 -1
  305. package/dist/runtime/approvals/{types.d.ts → model.d.ts} +1 -1
  306. package/dist/runtime/approvals/{types.d.ts.map → model.d.ts.map} +1 -1
  307. package/dist/runtime/approvals/runtime.d.ts +1 -1
  308. package/dist/runtime/behavior/index.d.ts +1 -1
  309. package/dist/runtime/behavior/{types.d.ts → model.d.ts} +1 -1
  310. package/dist/runtime/behavior/{types.d.ts.map → model.d.ts.map} +1 -1
  311. package/dist/runtime/behavior/resolve.d.ts +1 -1
  312. package/dist/runtime/capabilities/backend.d.ts +1 -1
  313. package/dist/runtime/capabilities/index.d.ts +1 -1
  314. package/dist/runtime/capabilities/{types.d.ts → model.d.ts} +1 -1
  315. package/dist/runtime/capabilities/{types.d.ts.map → model.d.ts.map} +1 -1
  316. package/dist/runtime/capabilities/model.js +1 -0
  317. package/dist/runtime/capabilities/recipe.d.ts +1 -1
  318. package/dist/runtime/capabilities/registry.d.ts +1 -1
  319. package/dist/runtime/capabilities/runner.d.ts +1 -1
  320. package/dist/runtime/execution-context.d.ts.map +1 -1
  321. package/dist/runtime/execution-context.js +16 -0
  322. package/dist/runtime/execution-profile/index.d.ts +1 -1
  323. package/dist/runtime/execution-profile/{types.d.ts → model.d.ts} +1 -1
  324. package/dist/runtime/execution-profile/{types.d.ts.map → model.d.ts.map} +1 -1
  325. package/dist/runtime/execution-profile/model.js +1 -0
  326. package/dist/runtime/execution-profile/resolve.d.ts +1 -1
  327. package/dist/runtime/explain/index.d.ts +1 -1
  328. package/dist/runtime/explain/{types.d.ts → model.d.ts} +1 -1
  329. package/dist/runtime/explain/{types.d.ts.map → model.d.ts.map} +1 -1
  330. package/dist/runtime/explain/model.js +1 -0
  331. package/dist/runtime/explain/resolve.d.ts +1 -1
  332. package/dist/runtime/protocol/index.d.ts +1 -1
  333. package/dist/runtime/protocol/index.js +1 -1
  334. package/dist/runtime/protocol/{types.d.ts → model.d.ts} +1 -1
  335. package/dist/runtime/protocol/{types.d.ts.map → model.d.ts.map} +1 -1
  336. package/dist/runtime/protocol/resolve.d.ts +1 -1
  337. package/dist/runtime/protocol/resolve.js +1 -1
  338. package/dist/runtime/shared/repo-cli-version.d.ts.map +1 -0
  339. package/dist/{shared → runtime/shared}/repo-cli-version.js +1 -1
  340. package/dist/runtime/shared/runtime-artifacts.d.ts.map +1 -0
  341. package/dist/{shared → runtime/shared}/runtime-source.d.ts +1 -1
  342. package/dist/runtime/shared/runtime-source.d.ts.map +1 -0
  343. package/dist/{shared → runtime/shared}/runtime-source.js +1 -1
  344. package/dist/runtime/shared/version-compare.d.ts.map +1 -0
  345. package/dist/runtime/task-intake/resolve.js +1 -1
  346. package/dist/shared/errors.d.ts +52 -2
  347. package/dist/shared/errors.d.ts.map +1 -1
  348. package/dist/shared/errors.js +66 -4
  349. package/dist/shared/trace-events.d.ts +13 -0
  350. package/dist/shared/trace-events.d.ts.map +1 -0
  351. package/dist/shared/trace-events.js +17 -0
  352. package/dist/{shared/task-doc-conflicts.d.ts → task-doc/conflicts.d.ts} +1 -1
  353. package/dist/task-doc/conflicts.d.ts.map +1 -0
  354. package/dist/{shared/task-doc-conflicts.js → task-doc/conflicts.js} +1 -1
  355. package/dist/{shared/task-doc-state.d.ts → task-doc/state.d.ts} +1 -1
  356. package/dist/task-doc/state.d.ts.map +1 -0
  357. package/package.json +8 -8
  358. package/dist/cli/run-cli/error-guidance.d.ts +0 -9
  359. package/dist/cli/run-cli/error-guidance.d.ts.map +0 -1
  360. package/dist/cli/run-cli/error-guidance.js +0 -210
  361. package/dist/cli/run-cli.test-helpers.d.ts +0 -2
  362. package/dist/cli/run-cli.test-helpers.d.ts.map +0 -1
  363. package/dist/cli/run-cli.test-helpers.js +0 -1
  364. package/dist/commands/recipes.test-helpers.d.ts +0 -202
  365. package/dist/commands/recipes.test-helpers.d.ts.map +0 -1
  366. package/dist/commands/recipes.test-helpers.js +0 -483
  367. package/dist/commands/release.test-helpers.d.ts +0 -38
  368. package/dist/commands/release.test-helpers.d.ts.map +0 -1
  369. package/dist/commands/release.test-helpers.js +0 -55
  370. package/dist/commands/task.test-helpers.d.ts +0 -13
  371. package/dist/commands/task.test-helpers.d.ts.map +0 -1
  372. package/dist/commands/task.test-helpers.js +0 -65
  373. package/dist/runner/test-helpers.d.ts +0 -30
  374. package/dist/runner/test-helpers.d.ts.map +0 -1
  375. package/dist/runner/test-helpers.js +0 -97
  376. package/dist/shared/agent-emoji.d.ts +0 -5
  377. package/dist/shared/agent-emoji.d.ts.map +0 -1
  378. package/dist/shared/agent-emoji.js +0 -51
  379. package/dist/shared/allow-prefix-policy.d.ts.map +0 -1
  380. package/dist/shared/comment-format.d.ts.map +0 -1
  381. package/dist/shared/diagnostics.d.ts.map +0 -1
  382. package/dist/shared/direct-work-lock.d.ts.map +0 -1
  383. package/dist/shared/git-log.d.ts.map +0 -1
  384. package/dist/shared/repo-cli-version.d.ts.map +0 -1
  385. package/dist/shared/runtime-artifacts.d.ts.map +0 -1
  386. package/dist/shared/runtime-source.d.ts.map +0 -1
  387. package/dist/shared/task-doc-conflicts.d.ts.map +0 -1
  388. package/dist/shared/task-doc-state.d.ts.map +0 -1
  389. package/dist/shared/version-compare.d.ts.map +0 -1
  390. package/dist/testing/cli-harness/recipe-archives.d.ts +0 -28
  391. package/dist/testing/cli-harness/recipe-archives.d.ts.map +0 -1
  392. package/dist/testing/cli-harness/recipe-archives.js +0 -374
  393. package/dist/testing/cli-harness/stdio.d.ts +0 -26
  394. package/dist/testing/cli-harness/stdio.d.ts.map +0 -1
  395. package/dist/testing/cli-harness/stdio.js +0 -84
  396. package/dist/testing/cli-harness.d.ts +0 -25
  397. package/dist/testing/cli-harness.d.ts.map +0 -1
  398. package/dist/testing/cli-harness.js +0 -313
  399. package/dist/testing/index.d.ts +0 -2
  400. package/dist/testing/index.d.ts.map +0 -1
  401. package/dist/testing/index.js +0 -1
  402. /package/dist/{policy/types.js → cli/run-cli/commands/init/model.js} +0 -0
  403. /package/dist/{shared → commands/shared}/allow-prefix-policy.d.ts +0 -0
  404. /package/dist/{shared → commands/shared}/comment-format.d.ts +0 -0
  405. /package/dist/{shared → commands/shared}/comment-format.js +0 -0
  406. /package/dist/{shared → commands/shared}/diagnostics.d.ts +0 -0
  407. /package/dist/{shared → commands/shared}/diagnostics.js +0 -0
  408. /package/dist/{runtime/approvals/types.js → commands/task/finish-types.js} +0 -0
  409. /package/dist/{runtime/behavior/types.js → commands/task/hosted-merge-sync/model.js} +0 -0
  410. /package/dist/{shared → commands/task/shared}/direct-work-lock.d.ts +0 -0
  411. /package/dist/{shared → commands/task/shared}/direct-work-lock.js +0 -0
  412. /package/dist/{shared → commands/task/shared}/git-log.d.ts +0 -0
  413. /package/dist/{shared → commands/task/shared}/git-log.js +0 -0
  414. /package/dist/{runtime/capabilities/types.js → policy/model.js} +0 -0
  415. /package/dist/runtime/{execution-profile/types.js → approvals/model.js} +0 -0
  416. /package/dist/runtime/{explain/types.js → behavior/model.js} +0 -0
  417. /package/dist/runtime/protocol/{types.js → model.js} +0 -0
  418. /package/dist/{shared → runtime/shared}/repo-cli-version.d.ts +0 -0
  419. /package/dist/{shared → runtime/shared}/runtime-artifacts.d.ts +0 -0
  420. /package/dist/{shared → runtime/shared}/runtime-artifacts.js +0 -0
  421. /package/dist/{shared → runtime/shared}/version-compare.d.ts +0 -0
  422. /package/dist/{shared → runtime/shared}/version-compare.js +0 -0
  423. /package/dist/{shared/task-doc-state.js → task-doc/state.js} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"hosted-merge-sync.d.ts","sourceRoot":"","sources":["../../../src/commands/task/hosted-merge-sync.ts"],"names":[],"mappings":"AAGA,OAAO,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AAO,CAAC;IAC/B,aAAa,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CAClC,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAuDjC;AAED,wBAAsB,+BAA+B,CAAC,IAAI,EAAE;IAC1D,GAAG,EAAE,cAAc,CAAC;IACpB,KAAK,EAAE,QAAQ,EAAE,CAAC;CACnB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAoBjC;AAED,wBAAsB,qBAAqB,CAAC,IAAI,EAAE;IAChD,GAAG,EAAE,cAAc,CAAC;IACpB,KAAK,EAAE,QAAQ,EAAE,CAAC;CACnB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAoDjC"}
@@ -1,351 +1,13 @@
1
- import { readFile } from "node:fs/promises";
2
- import path from "node:path";
3
- import { normalizeTaskDocVersion, resolveBaseBranch } from "@agentplaneorg/core";
4
1
  import { CliError } from "../../shared/errors.js";
5
2
  import { writeJsonStableIfChanged } from "../../shared/write-if-changed.js";
6
- import { execFileAsync } from "../shared/git.js";
7
- import { withGhTransportRetry } from "../shared/gh-transport.js";
8
- import { parseTaskIdFromBranch } from "../shared/git-worktree.js";
9
- import { parsePrMeta } from "../shared/pr-meta.js";
10
3
  import { backendUsesLocalTaskStore } from "../shared/task-backend.js";
11
- import { ghEnv } from "../pr/internal/gh-api.js";
12
- import { appendTaskEvent } from "./shared.js";
13
- function normalizeMergedPr(value) {
14
- if (!value || typeof value !== "object" || Array.isArray(value))
15
- return null;
16
- const record = value;
17
- const number = typeof record.number === "number" ? record.number : null;
18
- if (!number || number <= 0)
19
- return null;
20
- const mergeCommit = record.mergeCommit &&
21
- typeof record.mergeCommit === "object" &&
22
- !Array.isArray(record.mergeCommit)
23
- ? {
24
- oid: typeof record.mergeCommit.oid === "string"
25
- ? String(record.mergeCommit.oid)
26
- : null,
27
- }
28
- : null;
29
- return {
30
- number,
31
- title: typeof record.title === "string" ? record.title : null,
32
- url: typeof record.url === "string" ? record.url : null,
33
- mergedAt: typeof record.mergedAt === "string" ? record.mergedAt : null,
34
- baseRefName: typeof record.baseRefName === "string" ? record.baseRefName : null,
35
- headRefName: typeof record.headRefName === "string" ? record.headRefName : null,
36
- headRefOid: typeof record.headRefOid === "string" ? record.headRefOid : null,
37
- mergeCommit,
38
- };
39
- }
40
- function normalizePullRequestLike(value) {
41
- if (!value || typeof value !== "object" || Array.isArray(value))
42
- return null;
43
- const record = value;
44
- if (record.merged !== true)
45
- return null;
46
- const number = typeof record.number === "number" ? record.number : null;
47
- const mergeCommitSha = typeof record.merge_commit_sha === "string" && record.merge_commit_sha.trim().length > 0
48
- ? record.merge_commit_sha.trim()
49
- : null;
50
- const head = record.head && typeof record.head === "object" && !Array.isArray(record.head)
51
- ? record.head
52
- : null;
53
- const base = record.base && typeof record.base === "object" && !Array.isArray(record.base)
54
- ? record.base
55
- : null;
56
- const headRefName = typeof head?.ref === "string" ? head.ref : null;
57
- const headRefOid = typeof head?.sha === "string" ? head.sha : null;
58
- const baseRefName = typeof base?.ref === "string" ? base.ref : null;
59
- if (!number || number <= 0 || !mergeCommitSha || !headRefName)
60
- return null;
61
- return {
62
- number,
63
- title: typeof record.title === "string" ? record.title : null,
64
- url: typeof record.html_url === "string" ? record.html_url : null,
65
- mergedAt: typeof record.merged_at === "string" ? record.merged_at : null,
66
- baseRefName,
67
- headRefName,
68
- headRefOid,
69
- mergeCommit: { oid: mergeCommitSha },
70
- };
71
- }
72
- function pickHostedMergedPr(records) {
73
- const merged = records
74
- .map((record) => normalizeMergedPr(record))
75
- .filter((record) => !!record && !!record.mergeCommit?.oid);
76
- if (merged.length === 0)
77
- return null;
78
- return (merged.toSorted((a, b) => {
79
- const left = a.mergedAt ?? "";
80
- const right = b.mergedAt ?? "";
81
- return right.localeCompare(left);
82
- })[0] ?? null);
83
- }
84
- export function resolveLocalMergedPrMeta(meta) {
85
- const branch = meta?.branch?.trim() ?? "";
86
- const mergeCommit = meta?.merge_commit?.trim() ?? "";
87
- if (meta?.status !== "MERGED" || !branch || !mergeCommit)
88
- return null;
89
- return {
90
- branch,
91
- base: meta.base ?? null,
92
- mergedAt: meta.merged_at ?? null,
93
- mergeCommit,
94
- headSha: meta.head_sha ?? null,
95
- };
96
- }
97
- export function resolveHostedMergeTargetFromEvent(opts) {
98
- if (!opts.event || typeof opts.event !== "object" || Array.isArray(opts.event))
99
- return null;
100
- const pullRequest = opts.event.pull_request;
101
- const mergedPr = normalizePullRequestLike(pullRequest);
102
- if (!mergedPr?.headRefName || !mergedPr.mergeCommit?.oid)
103
- return null;
104
- const taskId = parseTaskIdFromBranch(opts.branchPrefix, mergedPr.headRefName);
105
- if (!taskId)
106
- return null;
107
- return {
108
- taskId,
109
- branch: mergedPr.headRefName,
110
- mergedPr,
111
- };
112
- }
113
- export async function resolveHostedMergedPr(opts) {
114
- return await withGhTransportRetry(async () => {
115
- const { stdout } = await execFileAsync("gh", [
116
- "pr",
117
- "list",
118
- "--state",
119
- "merged",
120
- "--head",
121
- opts.branch,
122
- "--json",
123
- "number,title,url,mergedAt,baseRefName,headRefName,headRefOid,mergeCommit",
124
- ], {
125
- cwd: opts.cwd,
126
- env: ghEnv(),
127
- maxBuffer: 10 * 1024 * 1024,
128
- });
129
- const parsed = JSON.parse(stdout);
130
- return Array.isArray(parsed) ? pickHostedMergedPr(parsed) : null;
131
- }, {
132
- label: `looking up merged PR metadata for ${opts.branch}`,
133
- });
134
- }
135
- function buildSyncedPrMeta(opts) {
136
- const at = opts.mergedPr.mergedAt ?? new Date().toISOString();
137
- return {
138
- ...opts.meta,
139
- branch: opts.branch,
140
- status: "MERGED",
141
- base: opts.mergedPr.baseRefName ?? opts.meta.base,
142
- merge_strategy: opts.meta.merge_strategy,
143
- merged_at: opts.meta.merged_at ?? at,
144
- merge_commit: opts.mergedPr.mergeCommit?.oid ?? opts.meta.merge_commit,
145
- head_sha: opts.mergedPr.headRefOid ?? opts.meta.head_sha,
146
- updated_at: at,
147
- };
148
- }
149
- function buildSyncedTask(opts) {
150
- const at = opts.mergedPr.mergedAt ?? new Date().toISOString();
151
- const currentStatus = String(opts.task.status || "TODO").toUpperCase();
152
- const note = `Hosted PR #${opts.mergedPr.number} merged on GitHub main; ` +
153
- "task projection reconciled from hosted PR artifacts.";
154
- const statusEvent = {
155
- type: "status",
156
- at,
157
- author: "INTEGRATOR",
158
- from: currentStatus,
159
- to: "DONE",
160
- note,
161
- };
162
- const mergeHash = opts.mergedPr.mergeCommit?.oid ?? "";
163
- const mergeMessage = opts.mergedPr.title?.trim();
164
- return {
165
- ...opts.task,
166
- status: "DONE",
167
- result_summary: opts.task.result_summary ?? `Merged via PR #${opts.mergedPr.number}.`,
168
- commit: opts.task.commit?.hash?.trim()
169
- ? opts.task.commit
170
- : mergeHash
171
- ? {
172
- hash: mergeHash,
173
- message: (mergeMessage && mergeMessage.length > 0 ? mergeMessage : null) ??
174
- `Hosted PR #${opts.mergedPr.number} merged on GitHub main`,
175
- }
176
- : null,
177
- events: appendTaskEvent(opts.task, statusEvent),
178
- doc_version: normalizeTaskDocVersion(opts.task.doc_version),
179
- doc_updated_at: at,
180
- doc_updated_by: "INTEGRATOR",
181
- };
182
- }
183
- function needsHostedMergeSyncFromLocalMeta(opts) {
184
- const currentStatus = String(opts.task.status || "TODO").toUpperCase();
185
- const expectedCommit = opts.meta.mergeCommit;
186
- if (currentStatus !== "DONE")
187
- return true;
188
- if ((opts.task.commit?.hash ?? "") !== expectedCommit)
189
- return true;
190
- return false;
191
- }
192
- function buildLocallyMergedSyncedTask(opts) {
193
- const at = opts.meta.mergedAt ?? new Date().toISOString();
194
- const currentStatus = String(opts.task.status || "TODO").toUpperCase();
195
- const note = "Local PR metadata already marks the task branch as MERGED; " +
196
- "task projection reconciled without an additional GitHub lookup.";
197
- const statusEvent = {
198
- type: "status",
199
- at,
200
- author: "INTEGRATOR",
201
- from: currentStatus,
202
- to: "DONE",
203
- note,
204
- };
205
- return {
206
- ...opts.task,
207
- status: "DONE",
208
- result_summary: opts.task.result_summary ?? "Merged and reconciled from local PR metadata.",
209
- commit: opts.task.commit?.hash?.trim()
210
- ? opts.task.commit
211
- : {
212
- hash: opts.meta.mergeCommit,
213
- message: "Merged branch_pr task reconciled from local PR metadata",
214
- },
215
- events: appendTaskEvent(opts.task, statusEvent),
216
- doc_version: normalizeTaskDocVersion(opts.task.doc_version),
217
- doc_updated_at: at,
218
- doc_updated_by: "INTEGRATOR",
219
- };
220
- }
221
- function hasTaskVerificationForLocalSync(opts) {
222
- if (opts.task.verification?.state === "ok")
223
- return "task";
224
- if (opts.meta?.verify?.status === "pass")
225
- return "pr";
226
- return null;
227
- }
228
- async function gitRefExists(opts) {
229
- try {
230
- await execFileAsync("git", ["rev-parse", "--verify", "--quiet", opts.ref], {
231
- cwd: opts.cwd,
232
- env: process.env,
233
- });
234
- return true;
235
- }
236
- catch {
237
- return false;
238
- }
239
- }
240
- async function gitIsAncestor(opts) {
241
- try {
242
- await execFileAsync("git", ["merge-base", "--is-ancestor", opts.ancestor, opts.descendant], {
243
- cwd: opts.cwd,
244
- env: process.env,
245
- });
246
- return true;
247
- }
248
- catch (err) {
249
- const code = err?.code;
250
- if (code === 1)
251
- return false;
252
- throw err;
253
- }
254
- }
255
- async function resolveSyncBaseBranch(opts) {
256
- const fromMeta = opts.meta?.base?.trim() ?? "";
257
- if (fromMeta.length > 0)
258
- return fromMeta;
259
- return await resolveBaseBranch({
260
- cwd: opts.ctx.resolvedProject.gitRoot,
261
- rootOverride: opts.ctx.resolvedProject.gitRoot,
262
- cliBaseOpt: null,
263
- mode: opts.ctx.config.workflow_mode,
264
- });
265
- }
266
- function buildLocallySyncedTask(opts) {
267
- const at = new Date().toISOString();
268
- const currentStatus = String(opts.task.status || "TODO").toUpperCase();
269
- const note = `Local branch_pr reconciliation detected task commit ${opts.candidate.commitHash.slice(0, 12)} ` +
270
- `on base ${opts.candidate.base}; canonical task state normalized after shipment.`;
271
- const statusEvent = {
272
- type: "status",
273
- at,
274
- author: "INTEGRATOR",
275
- from: currentStatus,
276
- to: "DONE",
277
- note,
278
- };
279
- return {
280
- ...opts.task,
281
- status: "DONE",
282
- result_summary: opts.task.result_summary ??
283
- `Shipped on ${opts.candidate.base} and reconciled from local branch_pr state.`,
284
- commit: opts.task.commit?.hash?.trim()
285
- ? opts.task.commit
286
- : {
287
- hash: opts.candidate.commitHash,
288
- message: `Shipped on ${opts.candidate.base} before canonical task closure`,
289
- },
290
- events: appendTaskEvent(opts.task, statusEvent),
291
- doc_version: normalizeTaskDocVersion(opts.task.doc_version),
292
- doc_updated_at: at,
293
- doc_updated_by: "INTEGRATOR",
294
- };
295
- }
296
- function buildLocallySyncedPrMeta(opts) {
297
- const at = new Date().toISOString();
298
- return {
299
- ...opts.meta,
300
- branch: opts.candidate.branch,
301
- base: opts.candidate.base,
302
- status: "MERGED",
303
- merged_at: opts.meta.merged_at ?? at,
304
- merge_commit: opts.meta.merge_commit ?? opts.candidate.commitHash,
305
- head_sha: opts.meta.head_sha ?? opts.candidate.commitHash,
306
- updated_at: at,
307
- };
308
- }
309
- function isStackedBranchAliasDoneTask(opts) {
310
- const branchTaskId = parseTaskIdFromBranch("task", opts.branch);
311
- if (!branchTaskId || branchTaskId === opts.task.id)
312
- return false;
313
- const summary = opts.task.result_summary?.trim().toLowerCase() ?? "";
314
- if (!summary.includes("stacked branch_pr merge rooted at"))
315
- return false;
316
- return summary.includes(branchTaskId.toLowerCase());
317
- }
318
- async function readPrMetaIfPresent(opts) {
319
- const metaPath = path.join(opts.ctx.resolvedProject.gitRoot, opts.ctx.config.paths.workflow_dir, opts.taskId, "pr", "meta.json");
320
- try {
321
- const raw = await readFile(metaPath, "utf8");
322
- return { meta: parsePrMeta(raw, opts.taskId), metaPath };
323
- }
324
- catch {
325
- return null;
326
- }
327
- }
328
- function needsHostedMergeSync(opts) {
329
- const currentStatus = String(opts.task.status || "TODO").toUpperCase();
330
- const expectedCommit = opts.mergedPr.mergeCommit?.oid ?? "";
331
- const expectedBase = opts.mergedPr.baseRefName ?? opts.meta.base ?? "";
332
- const expectedHeadSha = opts.mergedPr.headRefOid ?? opts.meta.head_sha ?? "";
333
- if (currentStatus !== "DONE")
334
- return true;
335
- if ((opts.task.commit?.hash ?? "") !== expectedCommit)
336
- return true;
337
- if (opts.meta.status !== "MERGED")
338
- return true;
339
- if ((opts.meta.merge_commit ?? "") !== expectedCommit)
340
- return true;
341
- if ((opts.meta.branch ?? "") !== opts.branch)
342
- return true;
343
- if ((opts.meta.base ?? "") !== expectedBase)
344
- return true;
345
- if (opts.meta.head_sha?.trim() !== expectedHeadSha)
346
- return true;
347
- return false;
348
- }
4
+ import { buildLocallyMergedSyncedTask, buildLocallySyncedPrMeta, buildLocallySyncedTask, buildSyncedPrMeta, buildSyncedTask, needsHostedMergeSync, needsHostedMergeSyncFromLocalMeta, } from "./hosted-merge-sync/builders.js";
5
+ import { resolveHostedMergedPr } from "./hosted-merge-sync/github.js";
6
+ import { findLocallyShippedBranchPrTasks } from "./hosted-merge-sync/local-branch.js";
7
+ import { readPrMetaIfPresent, resolveLocalMergedPrMeta } from "./hosted-merge-sync/pr-meta.js";
8
+ export { findDoneBranchPrTasksWithOpenPrArtifacts, findLocallyShippedBranchPrTasks, } from "./hosted-merge-sync/local-branch.js";
9
+ export { resolveHostedMergedPr, resolveHostedMergeTargetFromEvent, } from "./hosted-merge-sync/github.js";
10
+ export { resolveLocalMergedPrMeta } from "./hosted-merge-sync/pr-meta.js";
349
11
  export async function syncHostedMergedTask(opts) {
350
12
  if (!backendUsesLocalTaskStore(opts.ctx) || opts.ctx.config.workflow_mode !== "branch_pr") {
351
13
  return { tasks: opts.tasks, synced: 0 };
@@ -393,101 +55,6 @@ export async function syncHostedMergedTask(opts) {
393
55
  synced: 1,
394
56
  };
395
57
  }
396
- export async function findLocallyShippedBranchPrTasks(opts) {
397
- if (!backendUsesLocalTaskStore(opts.ctx) || opts.ctx.config.workflow_mode !== "branch_pr") {
398
- return [];
399
- }
400
- const matches = [];
401
- for (const task of opts.tasks) {
402
- const currentStatus = String(task.status || "TODO").toUpperCase();
403
- const prMetaRecord = await readPrMetaIfPresent({ ctx: opts.ctx, taskId: task.id });
404
- const meta = prMetaRecord?.meta ?? null;
405
- const branch = meta?.branch?.trim() ?? "";
406
- if (!branch)
407
- continue;
408
- const verificationSource = hasTaskVerificationForLocalSync({
409
- task,
410
- meta,
411
- });
412
- const commitHash = task.commit?.hash?.trim() ?? meta?.merge_commit?.trim() ?? meta?.head_sha?.trim() ?? "";
413
- if (!commitHash)
414
- continue;
415
- const base = await resolveSyncBaseBranch({
416
- ctx: opts.ctx,
417
- meta,
418
- });
419
- if (!base)
420
- continue;
421
- if (!(await gitRefExists({ cwd: opts.ctx.resolvedProject.gitRoot, ref: base })))
422
- continue;
423
- if (!(await gitIsAncestor({
424
- cwd: opts.ctx.resolvedProject.gitRoot,
425
- ancestor: commitHash,
426
- descendant: base,
427
- }))) {
428
- continue;
429
- }
430
- const metaNeedsSync = Boolean(meta && meta.status !== "MERGED");
431
- const taskNeedsSync = currentStatus !== "DONE" && verificationSource !== null;
432
- if (!taskNeedsSync && !metaNeedsSync)
433
- continue;
434
- if (!taskNeedsSync && currentStatus !== "DONE")
435
- continue;
436
- matches.push({
437
- taskId: task.id,
438
- branch,
439
- base,
440
- commitHash,
441
- verificationSource,
442
- metaPath: prMetaRecord?.metaPath ?? null,
443
- meta,
444
- taskStatus: currentStatus,
445
- });
446
- }
447
- return matches;
448
- }
449
- export async function findDoneBranchPrTasksWithOpenPrArtifacts(opts) {
450
- if (!backendUsesLocalTaskStore(opts.ctx) || opts.ctx.config.workflow_mode !== "branch_pr") {
451
- return [];
452
- }
453
- const matches = [];
454
- for (const task of opts.tasks) {
455
- const currentStatus = String(task.status || "TODO").toUpperCase();
456
- if (currentStatus !== "DONE")
457
- continue;
458
- const prMetaRecord = await readPrMetaIfPresent({ ctx: opts.ctx, taskId: task.id });
459
- const meta = prMetaRecord?.meta ?? null;
460
- if (!meta || meta.status === "MERGED")
461
- continue;
462
- const branch = meta.branch?.trim() ?? "";
463
- if (!branch)
464
- continue;
465
- const branchStillExists = (await gitRefExists({ cwd: opts.ctx.resolvedProject.gitRoot, ref: branch })) ||
466
- (await gitRefExists({ cwd: opts.ctx.resolvedProject.gitRoot, ref: `origin/${branch}` }));
467
- if (!branchStillExists)
468
- continue;
469
- if (isStackedBranchAliasDoneTask({ task, branch }))
470
- continue;
471
- // Missing implementation commits are handled by a dedicated doctor check, and duplicate/no-op
472
- // tasks should not also surface as stale mergeable PR drift just because meta.head_sha exists.
473
- const commitHash = task.commit?.hash?.trim() ?? "";
474
- if (!commitHash)
475
- continue;
476
- const base = await resolveSyncBaseBranch({
477
- ctx: opts.ctx,
478
- meta,
479
- });
480
- if (!base)
481
- continue;
482
- matches.push({
483
- taskId: task.id,
484
- branch,
485
- base,
486
- commitHash,
487
- });
488
- }
489
- return matches;
490
- }
491
58
  export async function syncLocallyShippedBranchPrTasks(opts) {
492
59
  const matches = await findLocallyShippedBranchPrTasks(opts);
493
60
  if (matches.length === 0)
@@ -527,10 +94,9 @@ export async function syncHostedMergedTasks(opts) {
527
94
  }
528
95
  const localMergedMeta = resolveLocalMergedPrMeta(prMetaRecord.meta);
529
96
  if (localMergedMeta) {
530
- nextTasks.push(needsHostedMergeSyncFromLocalMeta({ task, meta: localMergedMeta })
531
- ? buildLocallyMergedSyncedTask({ task, meta: localMergedMeta })
532
- : task);
533
- if (needsHostedMergeSyncFromLocalMeta({ task, meta: localMergedMeta }))
97
+ const needsSync = needsHostedMergeSyncFromLocalMeta({ task, meta: localMergedMeta });
98
+ nextTasks.push(needsSync ? buildLocallyMergedSyncedTask({ task, meta: localMergedMeta }) : task);
99
+ if (needsSync)
534
100
  synced += 1;
535
101
  continue;
536
102
  }
@@ -4,7 +4,7 @@ import { backendNotSupportedMessage, warnMessage } from "../../cli/output.js";
4
4
  import { createClarificationContract, createTaskGraphDraft, createTaskIntakeContext, materializeTaskGraphDraft, } from "../../runtime/task-intake/index.js";
5
5
  import { makeReadOnlyExecutionContext } from "../../runtime/execution-context.js";
6
6
  import { CliError } from "../../shared/errors.js";
7
- import { buildTaskDocState } from "../../shared/task-doc-state.js";
7
+ import { buildTaskDocState } from "../../task-doc/state.js";
8
8
  import { loadCommandContext } from "../shared/task-backend.js";
9
9
  import { ensureTaskDependsOnGraphIsAcyclic, nowIso, requiresVerifyStepsByPrimary, resolvePrimaryTag, warnIfUnknownOwner, } from "./shared.js";
10
10
  import { buildDefaultVerifyStepsSection, defaultTaskDocV3, TASK_DOC_VERSION_V3, } from "./doc-template.js";
@@ -1,6 +1,6 @@
1
1
  import { usageError } from "../../cli/spec/errors.js";
2
2
  import { toStringList } from "../../cli/spec/parse-utils.js";
3
- import { findRepoWideAllowPrefixes, repoWideAllowPrefixMessage, } from "../../shared/allow-prefix-policy.js";
3
+ import { findRepoWideAllowPrefixes, repoWideAllowPrefixMessage, } from "../shared/allow-prefix-policy.js";
4
4
  import { cmdTaskSetStatus } from "./set-status.js";
5
5
  export const taskSetStatusSpec = {
6
6
  id: ["task", "set-status"],
@@ -0,0 +1 @@
1
+ {"version":3,"file":"direct-work-lock.d.ts","sourceRoot":"","sources":["../../../../src/commands/task/shared/direct-work-lock.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,cAAc,GAAG;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,wBAAgB,kBAAkB,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAEhE;AAED,wBAAsB,kBAAkB,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC,CAkB9F"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"git-log.d.ts","sourceRoot":"","sources":["../../../../src/commands/task/shared/git-log.ts"],"names":[],"mappings":"AAAA,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAYxF"}
@@ -1,4 +1,4 @@
1
- import type { AgentplaneConfig } from "@agentplaneorg/core";
1
+ import { type AgentplaneConfig } from "@agentplaneorg/core";
2
2
  import type { TaskData, TaskEvent } from "../../../backends/task-backend.js";
3
3
  import type { CommandContext } from "../../shared/task-backend.js";
4
4
  export declare function appendTaskEvent(task: TaskData, event: TaskEvent): TaskEvent[];
@@ -1 +1 @@
1
- {"version":3,"file":"transitions.d.ts","sourceRoot":"","sources":["../../../../src/commands/task/shared/transitions.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAO5D,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;AAG7E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAKnE,wBAAgB,eAAe,CAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,GAAG,SAAS,EAAE,CAW7E;AAED,wBAAgB,4BAA4B,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,gBAAgB,GAAG,IAAI,CAc3F;AAED,wBAAgB,qCAAqC,CACnD,IAAI,EAAE,QAAQ,EACd,MAAM,EAAE,gBAAgB,GACvB,IAAI,CAmBN;AAED,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAO1E;AAED,wBAAgB,6BAA6B,CAAC,IAAI,EAAE;IAClD,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,OAAO,CAAC;CAChB,GAAG,IAAI,CAUP;AAED,wBAAgB,0BAA0B,CAAC,IAAI,EAAE;IAC/C,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,gBAAgB,CAAC;IACzB,MAAM,EAAE,MAAM,CAA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AAG,IAAI,CAKP;AAED,wBAAgB,gCAAgC,CAAC,IAAI,EAAE;IACrD,MAAM,EAAE,gBAAgB,CAAC,sBAAsB,CAAC,CAAC;IACjD,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,OAAO,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;CAClB,GAAG,MAAM,GAAG,IAAI,CA2BhB;AAUD,wBAAgB,6BAA6B,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAK3F;AAED,wBAAsB,cAAc,CAClC,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,GACV,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,CAI5C;AAED,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAMlE"}
@@ -1,14 +1,12 @@
1
- import { execFile } from "node:child_process";
2
- import { promisify } from "node:util";
1
+ import { execFileAsync } from "@agentplaneorg/core";
3
2
  import { infoMessage, warnMessage } from "../../../cli/output.js";
4
- import { formatCommentBodyForCommit } from "../../../shared/comment-format.js";
5
- import { readDirectWorkLock } from "../../../shared/direct-work-lock.js";
3
+ import { formatCommentBodyForCommit } from "../../shared/comment-format.js";
4
+ import { readDirectWorkLock } from "./direct-work-lock.js";
6
5
  import { CliError } from "../../../shared/errors.js";
7
- import { parseGitLogHashSubject } from "../../../shared/git-log.js";
6
+ import { parseGitLogHashSubject } from "./git-log.js";
8
7
  import { commitFromComment } from "../../guard/index.js";
9
8
  import { refreshBranchPrArtifactsAfterTaskCommit } from "../../shared/post-commit-pr-artifacts.js";
10
9
  import { requiresVerificationByPrimary, toStringArray } from "./tags.js";
11
- const execFileAsync = promisify(execFile);
12
10
  export function appendTaskEvent(task, event) {
13
11
  const existing = Array.isArray(task.events)
14
12
  ? task.events.filter((entry) => !!entry &&
@@ -3,7 +3,7 @@ import path from "node:path";
3
3
  import { saveConfig, setByDottedKey } from "@agentplaneorg/core";
4
4
  import { backupPath, fileExists } from "../../cli/fs-utils.js";
5
5
  import { exitCodeForError } from "../../cli/exit-codes.js";
6
- import { withDiagnosticContext } from "../../shared/diagnostics.js";
6
+ import { withDiagnosticContext } from "../shared/diagnostics.js";
7
7
  import { CliError } from "../../shared/errors.js";
8
8
  import { protectedPathKindForFile } from "../../shared/protected-paths.js";
9
9
  import { execFileAsync, gitEnv } from "../shared/git.js";
@@ -1 +1 @@
1
- {"version":3,"file":"workflow-playbook.command.d.ts","sourceRoot":"","sources":["../../src/commands/workflow-playbook.command.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAoC5E,KAAK,sBAAsB,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AA0JpD,eAAO,MAAM,iBAAiB,EAAE,WAAW,CAAC,sBAAsB,CAMjE,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,WAAW,CAAC,sBAAsB,CAMhE,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,WAAW,CAAC,sBAAsB,CAMhE,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,cAAc,CAAC,sBAAsB,CAEnE,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,cAAc,CAAC,sBAAsB,CAElE,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,cAAc,CAAC,sBAAsB,CAElE,CAAC"}
1
+ {"version":3,"file":"workflow-playbook.command.d.ts","sourceRoot":"","sources":["../../src/commands/workflow-playbook.command.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAkC5E,KAAK,sBAAsB,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AA8JpD,eAAO,MAAM,iBAAiB,EAAE,WAAW,CAAC,sBAAsB,CAMjE,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,WAAW,CAAC,sBAAsB,CAMhE,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,WAAW,CAAC,sBAAsB,CAMhE,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,cAAc,CAAC,sBAAsB,CAEnE,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,cAAc,CAAC,sBAAsB,CAElE,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,cAAc,CAAC,sBAAsB,CAElE,CAAC"}
@@ -1,11 +1,8 @@
1
- import { execFile } from "node:child_process";
2
1
  import { mkdir } from "node:fs/promises";
3
2
  import path from "node:path";
4
3
  import { fileURLToPath } from "node:url";
5
- import { promisify } from "node:util";
6
- import { atomicWriteFile, resolveProject } from "@agentplaneorg/core";
4
+ import { atomicWriteFile, resolveProject, runProcess } from "@agentplaneorg/core";
7
5
  import { mapCoreError } from "../cli/error-map.js";
8
- const execFileAsync = promisify(execFile);
9
6
  const AGENTPLANE_BIN = fileURLToPath(new URL("../../bin/agentplane.js", import.meta.url));
10
7
  const MAX_LOG_CHARS = 8000;
11
8
  function truncate(text) {
@@ -63,7 +60,9 @@ async function runWorkflowPlaybookCommand(opts) {
63
60
  let stdout = "";
64
61
  let stderr = "";
65
62
  try {
66
- const result = await execFileAsync(command, args, {
63
+ const result = await runProcess({
64
+ command,
65
+ args,
67
66
  cwd: opts.repoRoot,
68
67
  env: {
69
68
  ...process.env,
@@ -71,9 +70,11 @@ async function runWorkflowPlaybookCommand(opts) {
71
70
  },
72
71
  encoding: "utf8",
73
72
  maxBuffer: 10 * 1024 * 1024,
73
+ reject: false,
74
74
  });
75
- stdout = String(result.stdout ?? "");
76
- stderr = String(result.stderr ?? "");
75
+ exitCode = result.exitCode;
76
+ stdout = String(result.stdout);
77
+ stderr = String(result.stderr);
77
78
  }
78
79
  catch (err) {
79
80
  const failed = err;
@@ -1 +1 @@
1
- {"version":3,"file":"hooks-lifecycle.d.ts","sourceRoot":"","sources":["../../src/harness/hooks-lifecycle.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,QAAQ,GAAG,cAAc,GAAG,YAAY,GAAG,WAAW,GAAG,eAAe,CAAC;AAErF,MAAM,MAAM,UAAU,GAAG;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACvB,EAAE,EAAE,OAAO,CAAC;IACZ,IAAI,EAAE,QAAQ,CAAC;IACf,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,wBAAsB,gBAAgB,CAAC,IAAI,EAAE;IAC3C,IAAI,EAAE,QAAQ,CAAC;IACf,MAAM,EAAE,UAAU,CAAC;IACnB,GAAG,EAAE,MAAM,CAAC;CACb,GAAG,OAAO,CAAC,UAAU,CAAC,CAyDtB;AAED,wBAAsB,iBAAiB,CAAC,IAAI,EAAE;IAC5C,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC,CAAC;IAC7C,KAAK,EAAE,QAAQ,EAAE,CAAC;CACnB,GAAG,OAAO,CAAC;IAAE,EAAE,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,UAAU,EAAE,CAAA;CAAE,CAAC,CAclD"}
1
+ {"version":3,"file":"hooks-lifecycle.d.ts","sourceRoot":"","sources":["../../src/harness/hooks-lifecycle.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,QAAQ,GAAG,cAAc,GAAG,YAAY,GAAG,WAAW,GAAG,eAAe,CAAC;AAErF,MAAM,MAAM,UAAU,GAAG;IACvB,OAAO,CAAC,EAAE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