agentplane 0.3.7 → 0.3.8

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 (625) hide show
  1. package/assets/AGENTS.md +11 -1
  2. package/assets/RUNNER.md +17 -0
  3. package/bin/agentplane.js +16 -7
  4. package/bin/framework-dev-contract.d.ts +6 -0
  5. package/bin/framework-dev-contract.js +13 -0
  6. package/bin/stale-dist-policy.js +6 -1
  7. package/dist/.build-manifest.json +694 -339
  8. package/dist/adapters/task-backend/task-backend-adapter.d.ts +3 -1
  9. package/dist/adapters/task-backend/task-backend-adapter.d.ts.map +1 -1
  10. package/dist/adapters/task-backend/task-backend-adapter.js +13 -0
  11. package/dist/backends/task-backend/local-backend-doc.d.ts +5 -0
  12. package/dist/backends/task-backend/local-backend-doc.d.ts.map +1 -0
  13. package/dist/backends/task-backend/local-backend-doc.js +98 -0
  14. package/dist/backends/task-backend/local-backend-read.d.ts +7 -0
  15. package/dist/backends/task-backend/local-backend-read.d.ts.map +1 -0
  16. package/dist/backends/task-backend/local-backend-read.js +186 -0
  17. package/dist/backends/task-backend/local-backend-state.d.ts +17 -0
  18. package/dist/backends/task-backend/local-backend-state.d.ts.map +1 -0
  19. package/dist/backends/task-backend/local-backend-state.js +50 -0
  20. package/dist/backends/task-backend/local-backend-write.d.ts +15 -0
  21. package/dist/backends/task-backend/local-backend-write.d.ts.map +1 -0
  22. package/dist/backends/task-backend/local-backend-write.js +254 -0
  23. package/dist/backends/task-backend/local-backend.d.ts +4 -2
  24. package/dist/backends/task-backend/local-backend.d.ts.map +1 -1
  25. package/dist/backends/task-backend/local-backend.js +26 -403
  26. package/dist/backends/task-backend/redmine/backend-cache-doc.d.ts +40 -0
  27. package/dist/backends/task-backend/redmine/backend-cache-doc.d.ts.map +1 -0
  28. package/dist/backends/task-backend/redmine/backend-cache-doc.js +178 -0
  29. package/dist/backends/task-backend/redmine/backend-report.d.ts +10 -0
  30. package/dist/backends/task-backend/redmine/backend-report.d.ts.map +1 -0
  31. package/dist/backends/task-backend/redmine/backend-report.js +43 -0
  32. package/dist/backends/task-backend/redmine/backend-sync.d.ts +67 -0
  33. package/dist/backends/task-backend/redmine/backend-sync.d.ts.map +1 -0
  34. package/dist/backends/task-backend/redmine/backend-sync.js +367 -0
  35. package/dist/backends/task-backend/redmine/mapping.d.ts +2 -1
  36. package/dist/backends/task-backend/redmine/mapping.d.ts.map +1 -1
  37. package/dist/backends/task-backend/redmine/mapping.js +12 -2
  38. package/dist/backends/task-backend/redmine/parse.d.ts +2 -1
  39. package/dist/backends/task-backend/redmine/parse.d.ts.map +1 -1
  40. package/dist/backends/task-backend/redmine/parse.js +5 -3
  41. package/dist/backends/task-backend/redmine/state.d.ts +2 -0
  42. package/dist/backends/task-backend/redmine/state.d.ts.map +1 -1
  43. package/dist/backends/task-backend/redmine/state.js +15 -1
  44. package/dist/backends/task-backend/redmine-backend.d.ts +5 -2
  45. package/dist/backends/task-backend/redmine-backend.d.ts.map +1 -1
  46. package/dist/backends/task-backend/redmine-backend.js +88 -536
  47. package/dist/backends/task-backend/shared/constants.d.ts +2 -1
  48. package/dist/backends/task-backend/shared/constants.d.ts.map +1 -1
  49. package/dist/backends/task-backend/shared/doc.d.ts.map +1 -1
  50. package/dist/backends/task-backend/shared/doc.js +25 -39
  51. package/dist/backends/task-backend/shared/export.d.ts +2 -9
  52. package/dist/backends/task-backend/shared/export.d.ts.map +1 -1
  53. package/dist/backends/task-backend/shared/export.js +73 -8
  54. package/dist/backends/task-backend/shared/normalize.d.ts +5 -1
  55. package/dist/backends/task-backend/shared/normalize.d.ts.map +1 -1
  56. package/dist/backends/task-backend/shared/normalize.js +166 -0
  57. package/dist/backends/task-backend/shared/record.d.ts +1 -1
  58. package/dist/backends/task-backend/shared/record.d.ts.map +1 -1
  59. package/dist/backends/task-backend/shared/record.js +7 -2
  60. package/dist/backends/task-backend/shared/types.d.ts +38 -36
  61. package/dist/backends/task-backend/shared/types.d.ts.map +1 -1
  62. package/dist/backends/task-backend/shared.d.ts +2 -2
  63. package/dist/backends/task-backend/shared.d.ts.map +1 -1
  64. package/dist/backends/task-backend/shared.js +1 -1
  65. package/dist/backends/task-backend.d.ts +1 -1
  66. package/dist/backends/task-backend.d.ts.map +1 -1
  67. package/dist/backends/task-backend.js +1 -1
  68. package/dist/backends/task-index.d.ts +2 -2
  69. package/dist/backends/task-index.d.ts.map +1 -1
  70. package/dist/backends/task-index.js +9 -6
  71. package/dist/cli/bootstrap-guide.d.ts +2 -2
  72. package/dist/cli/bootstrap-guide.d.ts.map +1 -1
  73. package/dist/cli/bootstrap-guide.js +10 -10
  74. package/dist/cli/command-guide.d.ts.map +1 -1
  75. package/dist/cli/command-guide.js +11 -9
  76. package/dist/cli/command-invocations.d.ts +4 -0
  77. package/dist/cli/command-invocations.d.ts.map +1 -0
  78. package/dist/cli/command-invocations.js +35 -0
  79. package/dist/cli/command-snippets.d.ts +12 -8
  80. package/dist/cli/command-snippets.d.ts.map +1 -1
  81. package/dist/cli/command-snippets.js +14 -8
  82. package/dist/cli/exit-codes.d.ts.map +1 -1
  83. package/dist/cli/exit-codes.js +1 -0
  84. package/dist/cli/group-command.d.ts +18 -0
  85. package/dist/cli/group-command.d.ts.map +1 -0
  86. package/dist/cli/group-command.js +45 -0
  87. package/dist/cli/output.d.ts +29 -0
  88. package/dist/cli/output.d.ts.map +1 -1
  89. package/dist/cli/output.js +76 -0
  90. package/dist/cli/prompts.d.ts.map +1 -1
  91. package/dist/cli/prompts.js +5 -1
  92. package/dist/cli/run-cli/command-catalog/core.d.ts.map +1 -1
  93. package/dist/cli/run-cli/command-catalog/core.js +38 -29
  94. package/dist/cli/run-cli/command-catalog/lifecycle.d.ts.map +1 -1
  95. package/dist/cli/run-cli/command-catalog/lifecycle.js +9 -6
  96. package/dist/cli/run-cli/command-catalog/project.d.ts +1 -1
  97. package/dist/cli/run-cli/command-catalog/project.d.ts.map +1 -1
  98. package/dist/cli/run-cli/command-catalog/project.js +8 -6
  99. package/dist/cli/run-cli/command-catalog/shared.d.ts +12 -3
  100. package/dist/cli/run-cli/command-catalog/shared.d.ts.map +1 -1
  101. package/dist/cli/run-cli/command-catalog/shared.js +6 -3
  102. package/dist/cli/run-cli/command-catalog/task.d.ts +1 -1
  103. package/dist/cli/run-cli/command-catalog/task.d.ts.map +1 -1
  104. package/dist/cli/run-cli/command-catalog/task.js +46 -11
  105. package/dist/cli/run-cli/command-catalog.d.ts +11 -1
  106. package/dist/cli/run-cli/command-catalog.d.ts.map +1 -1
  107. package/dist/cli/run-cli/command-catalog.js +29 -0
  108. package/dist/cli/run-cli/commands/config.d.ts.map +1 -1
  109. package/dist/cli/run-cli/commands/config.js +52 -6
  110. package/dist/cli/run-cli/commands/core/agent-profiles.d.ts +34 -0
  111. package/dist/cli/run-cli/commands/core/agent-profiles.d.ts.map +1 -0
  112. package/dist/cli/run-cli/commands/core/agent-profiles.js +97 -0
  113. package/dist/cli/run-cli/commands/core/agents.d.ts +7 -0
  114. package/dist/cli/run-cli/commands/core/agents.d.ts.map +1 -0
  115. package/dist/cli/run-cli/commands/core/agents.js +97 -0
  116. package/dist/cli/run-cli/commands/core/preflight.d.ts +10 -0
  117. package/dist/cli/run-cli/commands/core/preflight.d.ts.map +1 -0
  118. package/dist/cli/run-cli/commands/core/preflight.js +286 -0
  119. package/dist/cli/run-cli/commands/core/quickstart.d.ts +8 -0
  120. package/dist/cli/run-cli/commands/core/quickstart.d.ts.map +1 -0
  121. package/dist/cli/run-cli/commands/core/quickstart.js +43 -0
  122. package/dist/cli/run-cli/commands/core/role.d.ts +9 -0
  123. package/dist/cli/run-cli/commands/core/role.d.ts.map +1 -0
  124. package/dist/cli/run-cli/commands/core/role.js +128 -0
  125. package/dist/cli/run-cli/commands/core.d.ts +4 -24
  126. package/dist/cli/run-cli/commands/core.d.ts.map +1 -1
  127. package/dist/cli/run-cli/commands/core.js +4 -630
  128. package/dist/cli/run-cli/error-guidance.js +10 -0
  129. package/dist/cli/run-cli/globals.d.ts +5 -2
  130. package/dist/cli/run-cli/globals.d.ts.map +1 -1
  131. package/dist/cli/run-cli/globals.js +82 -86
  132. package/dist/cli/run-cli.d.ts.map +1 -1
  133. package/dist/cli/run-cli.js +137 -100
  134. package/dist/cli/run-cli.test-helpers.d.ts +21 -0
  135. package/dist/cli/run-cli.test-helpers.d.ts.map +1 -1
  136. package/dist/cli/run-cli.test-helpers.js +88 -4
  137. package/dist/cli/spec/help.d.ts +10 -2
  138. package/dist/cli/spec/help.d.ts.map +1 -1
  139. package/dist/cli/spec/help.js +7 -5
  140. package/dist/cli/spec/registry.d.ts +27 -1
  141. package/dist/cli/spec/registry.d.ts.map +1 -1
  142. package/dist/cli/spec/registry.js +98 -25
  143. package/dist/commands/backend/sync.command.d.ts +3 -5
  144. package/dist/commands/backend/sync.command.d.ts.map +1 -1
  145. package/dist/commands/backend/sync.command.js +9 -12
  146. package/dist/commands/backend.d.ts.map +1 -1
  147. package/dist/commands/backend.js +8 -7
  148. package/dist/commands/branch/base.command.d.ts +2 -3
  149. package/dist/commands/branch/base.command.d.ts.map +1 -1
  150. package/dist/commands/branch/base.command.js +8 -12
  151. package/dist/commands/branch/base.d.ts.map +1 -1
  152. package/dist/commands/branch/base.js +11 -7
  153. package/dist/commands/branch/cleanup-merged.d.ts.map +1 -1
  154. package/dist/commands/branch/cleanup-merged.js +9 -8
  155. package/dist/commands/branch/remove.d.ts.map +1 -1
  156. package/dist/commands/branch/remove.js +4 -3
  157. package/dist/commands/branch/status.d.ts.map +1 -1
  158. package/dist/commands/branch/status.js +4 -3
  159. package/dist/commands/branch/work-start.d.ts.map +1 -1
  160. package/dist/commands/branch/work-start.js +48 -5
  161. package/dist/commands/cleanup/merged.command.d.ts +2 -3
  162. package/dist/commands/cleanup/merged.command.d.ts.map +1 -1
  163. package/dist/commands/cleanup/merged.command.js +8 -12
  164. package/dist/commands/docs/cli.command.js +2 -2
  165. package/dist/commands/doctor/runtime.js +1 -1
  166. package/dist/commands/doctor/workflow.d.ts.map +1 -1
  167. package/dist/commands/doctor/workflow.js +10 -1
  168. package/dist/commands/finish.spec.d.ts.map +1 -1
  169. package/dist/commands/finish.spec.js +7 -0
  170. package/dist/commands/guard/guard.command.d.ts +3 -3
  171. package/dist/commands/guard/guard.command.d.ts.map +1 -1
  172. package/dist/commands/guard/guard.command.js +9 -14
  173. package/dist/commands/guard/impl/commands.d.ts +2 -0
  174. package/dist/commands/guard/impl/commands.d.ts.map +1 -1
  175. package/dist/commands/guard/impl/commands.js +55 -7
  176. package/dist/commands/guard/impl/policy.d.ts +1 -0
  177. package/dist/commands/guard/impl/policy.d.ts.map +1 -1
  178. package/dist/commands/guard/impl/policy.js +9 -6
  179. package/dist/commands/hooks/hooks.command.d.ts +3 -3
  180. package/dist/commands/hooks/hooks.command.d.ts.map +1 -1
  181. package/dist/commands/hooks/hooks.command.js +9 -11
  182. package/dist/commands/pr/check.d.ts.map +1 -1
  183. package/dist/commands/pr/check.js +90 -18
  184. package/dist/commands/pr/integrate/cmd.d.ts.map +1 -1
  185. package/dist/commands/pr/integrate/cmd.js +31 -3
  186. package/dist/commands/pr/integrate/internal/cleanup.d.ts +12 -0
  187. package/dist/commands/pr/integrate/internal/cleanup.d.ts.map +1 -0
  188. package/dist/commands/pr/integrate/internal/cleanup.js +46 -0
  189. package/dist/commands/pr/integrate/internal/finalize.d.ts +4 -0
  190. package/dist/commands/pr/integrate/internal/finalize.d.ts.map +1 -1
  191. package/dist/commands/pr/integrate/internal/finalize.js +34 -40
  192. package/dist/commands/pr/integrate/internal/merge.d.ts +6 -0
  193. package/dist/commands/pr/integrate/internal/merge.d.ts.map +1 -1
  194. package/dist/commands/pr/integrate/internal/merge.js +92 -0
  195. package/dist/commands/pr/integrate/internal/prepare.d.ts +1 -0
  196. package/dist/commands/pr/integrate/internal/prepare.d.ts.map +1 -1
  197. package/dist/commands/pr/integrate/internal/prepare.js +1 -0
  198. package/dist/commands/pr/integrate/verify.d.ts.map +1 -1
  199. package/dist/commands/pr/integrate/verify.js +4 -3
  200. package/dist/commands/pr/note.d.ts.map +1 -1
  201. package/dist/commands/pr/note.js +3 -2
  202. package/dist/commands/pr/open.d.ts.map +1 -1
  203. package/dist/commands/pr/open.js +9 -12
  204. package/dist/commands/pr/pr.command.d.ts +3 -4
  205. package/dist/commands/pr/pr.command.d.ts.map +1 -1
  206. package/dist/commands/pr/pr.command.js +6 -11
  207. package/dist/commands/pr/update.d.ts.map +1 -1
  208. package/dist/commands/pr/update.js +5 -10
  209. package/dist/commands/recipes/cache.command.d.ts +3 -4
  210. package/dist/commands/recipes/cache.command.d.ts.map +1 -1
  211. package/dist/commands/recipes/cache.command.js +8 -26
  212. package/dist/commands/recipes/impl/apply.d.ts +1 -1
  213. package/dist/commands/recipes/impl/apply.d.ts.map +1 -1
  214. package/dist/commands/recipes/impl/apply.js +1 -1
  215. package/dist/commands/recipes/impl/commands/explain.js +1 -1
  216. package/dist/commands/recipes/impl/commands/install.d.ts.map +1 -1
  217. package/dist/commands/recipes/impl/commands/install.js +1 -2
  218. package/dist/commands/recipes/impl/installed-recipes.d.ts +1 -1
  219. package/dist/commands/recipes/impl/installed-recipes.d.ts.map +1 -1
  220. package/dist/commands/recipes/impl/installed-recipes.js +1 -2
  221. package/dist/commands/recipes/impl/manifest.d.ts.map +1 -1
  222. package/dist/commands/recipes/impl/manifest.js +0 -10
  223. package/dist/commands/recipes/impl/project-installed-recipes.d.ts +1 -1
  224. package/dist/commands/recipes/impl/project-installed-recipes.d.ts.map +1 -1
  225. package/dist/commands/recipes/impl/project-installed-recipes.js +1 -2
  226. package/dist/commands/recipes/impl/resolver.d.ts +1 -1
  227. package/dist/commands/recipes/impl/resolver.d.ts.map +1 -1
  228. package/dist/commands/recipes/impl/resolver.js +26 -16
  229. package/dist/commands/recipes/impl/scenario.d.ts.map +1 -1
  230. package/dist/commands/recipes/impl/scenario.js +80 -0
  231. package/dist/commands/recipes/impl/types.d.ts +27 -13
  232. package/dist/commands/recipes/impl/types.d.ts.map +1 -1
  233. package/dist/commands/recipes/recipes.command.d.ts +3 -4
  234. package/dist/commands/recipes/recipes.command.d.ts.map +1 -1
  235. package/dist/commands/recipes/recipes.command.js +8 -34
  236. package/dist/commands/recipes.d.ts +4 -4
  237. package/dist/commands/recipes.d.ts.map +1 -1
  238. package/dist/commands/recipes.js +3 -3
  239. package/dist/commands/recipes.test-helpers.d.ts +17 -0
  240. package/dist/commands/recipes.test-helpers.d.ts.map +1 -1
  241. package/dist/commands/recipes.test-helpers.js +56 -2
  242. package/dist/commands/release/apply.command.d.ts.map +1 -1
  243. package/dist/commands/release/apply.command.js +77 -56
  244. package/dist/commands/release/plan.command.d.ts.map +1 -1
  245. package/dist/commands/release/plan.command.js +7 -3
  246. package/dist/commands/release/release.command.d.ts +3 -3
  247. package/dist/commands/release/release.command.d.ts.map +1 -1
  248. package/dist/commands/release/release.command.js +9 -11
  249. package/dist/commands/release.test-helpers.d.ts +20 -0
  250. package/dist/commands/release.test-helpers.d.ts.map +1 -0
  251. package/dist/commands/release.test-helpers.js +37 -0
  252. package/dist/commands/runtime.command.d.ts +7 -7
  253. package/dist/commands/runtime.command.d.ts.map +1 -1
  254. package/dist/commands/runtime.command.js +29 -33
  255. package/dist/commands/scenario/execute.command.d.ts +8 -0
  256. package/dist/commands/scenario/execute.command.d.ts.map +1 -0
  257. package/dist/commands/scenario/execute.command.js +117 -0
  258. package/dist/commands/scenario/impl/commands.d.ts.map +1 -1
  259. package/dist/commands/scenario/impl/commands.js +45 -32
  260. package/dist/commands/scenario/run.command.js +2 -2
  261. package/dist/commands/scenario/scenario.command.d.ts +3 -4
  262. package/dist/commands/scenario/scenario.command.d.ts.map +1 -1
  263. package/dist/commands/scenario/scenario.command.js +8 -26
  264. package/dist/commands/shared/git-context.d.ts +1 -0
  265. package/dist/commands/shared/git-context.d.ts.map +1 -1
  266. package/dist/commands/shared/git-context.js +4 -2
  267. package/dist/commands/shared/git-ops.d.ts +1 -0
  268. package/dist/commands/shared/git-ops.d.ts.map +1 -1
  269. package/dist/commands/shared/git-ops.js +13 -0
  270. package/dist/commands/shared/operator-pipeline.d.ts +10 -0
  271. package/dist/commands/shared/operator-pipeline.d.ts.map +1 -0
  272. package/dist/commands/shared/operator-pipeline.js +16 -0
  273. package/dist/commands/shared/pr-meta.d.ts +32 -12
  274. package/dist/commands/shared/pr-meta.d.ts.map +1 -1
  275. package/dist/commands/shared/pr-meta.js +49 -14
  276. package/dist/commands/shared/reconcile-check.d.ts.map +1 -1
  277. package/dist/commands/shared/reconcile-check.js +28 -3
  278. package/dist/commands/shared/task-backend.d.ts +10 -6
  279. package/dist/commands/shared/task-backend.d.ts.map +1 -1
  280. package/dist/commands/shared/task-backend.js +99 -25
  281. package/dist/commands/shared/task-handoff.d.ts +64 -0
  282. package/dist/commands/shared/task-handoff.d.ts.map +1 -0
  283. package/dist/commands/shared/task-handoff.js +151 -0
  284. package/dist/commands/shared/task-mutation.d.ts +36 -0
  285. package/dist/commands/shared/task-mutation.d.ts.map +1 -0
  286. package/dist/commands/shared/task-mutation.js +67 -0
  287. package/dist/commands/shared/task-store.d.ts +5 -1
  288. package/dist/commands/shared/task-store.d.ts.map +1 -1
  289. package/dist/commands/shared/task-store.js +72 -92
  290. package/dist/commands/task/add.d.ts.map +1 -1
  291. package/dist/commands/task/add.js +41 -39
  292. package/dist/commands/task/block.d.ts.map +1 -1
  293. package/dist/commands/task/block.js +31 -110
  294. package/dist/commands/task/close-duplicate.d.ts.map +1 -1
  295. package/dist/commands/task/close-duplicate.js +0 -7
  296. package/dist/commands/task/close-noop.d.ts.map +1 -1
  297. package/dist/commands/task/close-noop.js +0 -21
  298. package/dist/commands/task/close-shared.d.ts +0 -2
  299. package/dist/commands/task/close-shared.d.ts.map +1 -1
  300. package/dist/commands/task/close-shared.js +25 -55
  301. package/dist/commands/task/comment.d.ts.map +1 -1
  302. package/dist/commands/task/comment.js +48 -37
  303. package/dist/commands/task/derive.d.ts.map +1 -1
  304. package/dist/commands/task/derive.js +14 -7
  305. package/dist/commands/task/doc.command.d.ts.map +1 -1
  306. package/dist/commands/task/doc.command.js +7 -6
  307. package/dist/commands/task/doc.d.ts.map +1 -1
  308. package/dist/commands/task/doc.js +58 -62
  309. package/dist/commands/task/finish-shared.d.ts +60 -0
  310. package/dist/commands/task/finish-shared.d.ts.map +1 -0
  311. package/dist/commands/task/finish-shared.js +181 -0
  312. package/dist/commands/task/finish.d.ts +1 -0
  313. package/dist/commands/task/finish.d.ts.map +1 -1
  314. package/dist/commands/task/finish.js +79 -210
  315. package/dist/commands/task/handoff-record.command.d.ts +17 -0
  316. package/dist/commands/task/handoff-record.command.d.ts.map +1 -0
  317. package/dist/commands/task/handoff-record.command.js +140 -0
  318. package/dist/commands/task/handoff-show.command.d.ts +8 -0
  319. package/dist/commands/task/handoff-show.command.d.ts.map +1 -0
  320. package/dist/commands/task/handoff-show.command.js +77 -0
  321. package/dist/commands/task/handoff.command.d.ts +7 -0
  322. package/dist/commands/task/handoff.command.d.ts.map +1 -0
  323. package/dist/commands/task/handoff.command.js +21 -0
  324. package/dist/commands/task/handoff.shared.d.ts +39 -0
  325. package/dist/commands/task/handoff.shared.d.ts.map +1 -0
  326. package/dist/commands/task/handoff.shared.js +134 -0
  327. package/dist/commands/task/hosted-close.command.d.ts +9 -0
  328. package/dist/commands/task/hosted-close.command.d.ts.map +1 -0
  329. package/dist/commands/task/hosted-close.command.js +190 -0
  330. package/dist/commands/task/hosted-merge-sync.d.ts +40 -0
  331. package/dist/commands/task/hosted-merge-sync.d.ts.map +1 -0
  332. package/dist/commands/task/hosted-merge-sync.js +277 -0
  333. package/dist/commands/task/list.d.ts.map +1 -1
  334. package/dist/commands/task/list.js +7 -24
  335. package/dist/commands/task/new.d.ts.map +1 -1
  336. package/dist/commands/task/new.js +26 -6
  337. package/dist/commands/task/next.d.ts.map +1 -1
  338. package/dist/commands/task/next.js +10 -28
  339. package/dist/commands/task/normalize.command.d.ts +1 -0
  340. package/dist/commands/task/normalize.command.d.ts.map +1 -1
  341. package/dist/commands/task/normalize.command.js +12 -0
  342. package/dist/commands/task/normalize.d.ts +1 -0
  343. package/dist/commands/task/normalize.d.ts.map +1 -1
  344. package/dist/commands/task/normalize.js +21 -9
  345. package/dist/commands/task/plan.command.d.ts +3 -4
  346. package/dist/commands/task/plan.command.d.ts.map +1 -1
  347. package/dist/commands/task/plan.command.js +6 -12
  348. package/dist/commands/task/plan.d.ts.map +1 -1
  349. package/dist/commands/task/plan.js +96 -103
  350. package/dist/commands/task/reclaim.command.d.ts +11 -0
  351. package/dist/commands/task/reclaim.command.d.ts.map +1 -0
  352. package/dist/commands/task/reclaim.command.js +102 -0
  353. package/dist/commands/task/resume-context.command.d.ts +9 -0
  354. package/dist/commands/task/resume-context.command.d.ts.map +1 -0
  355. package/dist/commands/task/resume-context.command.js +60 -0
  356. package/dist/commands/task/run-cancel.command.d.ts +6 -0
  357. package/dist/commands/task/run-cancel.command.d.ts.map +1 -0
  358. package/dist/commands/task/run-cancel.command.js +45 -0
  359. package/dist/commands/task/run-cancel.spec.d.ts +7 -0
  360. package/dist/commands/task/run-cancel.spec.d.ts.map +1 -0
  361. package/dist/commands/task/run-cancel.spec.js +20 -0
  362. package/dist/commands/task/run-resume.command.d.ts +6 -0
  363. package/dist/commands/task/run-resume.command.d.ts.map +1 -0
  364. package/dist/commands/task/run-resume.command.js +55 -0
  365. package/dist/commands/task/run-resume.spec.d.ts +7 -0
  366. package/dist/commands/task/run-resume.spec.d.ts.map +1 -0
  367. package/dist/commands/task/run-resume.spec.js +20 -0
  368. package/dist/commands/task/run-retry.command.d.ts +6 -0
  369. package/dist/commands/task/run-retry.command.d.ts.map +1 -0
  370. package/dist/commands/task/run-retry.command.js +56 -0
  371. package/dist/commands/task/run-retry.spec.d.ts +7 -0
  372. package/dist/commands/task/run-retry.spec.d.ts.map +1 -0
  373. package/dist/commands/task/run-retry.spec.js +20 -0
  374. package/dist/commands/task/run-show.command.d.ts +6 -0
  375. package/dist/commands/task/run-show.command.d.ts.map +1 -0
  376. package/dist/commands/task/run-show.command.js +133 -0
  377. package/dist/commands/task/run-show.spec.d.ts +8 -0
  378. package/dist/commands/task/run-show.spec.d.ts.map +1 -0
  379. package/dist/commands/task/run-show.spec.js +44 -0
  380. package/dist/commands/task/run-tail.command.d.ts +6 -0
  381. package/dist/commands/task/run-tail.command.d.ts.map +1 -0
  382. package/dist/commands/task/run-tail.command.js +26 -0
  383. package/dist/commands/task/run-tail.spec.d.ts +8 -0
  384. package/dist/commands/task/run-tail.spec.d.ts.map +1 -0
  385. package/dist/commands/task/run-tail.spec.js +51 -0
  386. package/dist/commands/task/run-trace.command.d.ts +6 -0
  387. package/dist/commands/task/run-trace.command.d.ts.map +1 -0
  388. package/dist/commands/task/run-trace.command.js +25 -0
  389. package/dist/commands/task/run-trace.spec.d.ts +7 -0
  390. package/dist/commands/task/run-trace.spec.d.ts.map +1 -0
  391. package/dist/commands/task/run-trace.spec.js +31 -0
  392. package/dist/commands/task/run.command.d.ts +6 -0
  393. package/dist/commands/task/run.command.d.ts.map +1 -0
  394. package/dist/commands/task/run.command.js +74 -0
  395. package/dist/commands/task/run.spec.d.ts +7 -0
  396. package/dist/commands/task/run.spec.d.ts.map +1 -0
  397. package/dist/commands/task/run.spec.js +26 -0
  398. package/dist/commands/task/scaffold.d.ts.map +1 -1
  399. package/dist/commands/task/scaffold.js +4 -2
  400. package/dist/commands/task/scrub.d.ts.map +1 -1
  401. package/dist/commands/task/scrub.js +27 -24
  402. package/dist/commands/task/search.d.ts.map +1 -1
  403. package/dist/commands/task/search.js +21 -31
  404. package/dist/commands/task/set-status.d.ts.map +1 -1
  405. package/dist/commands/task/set-status.js +36 -152
  406. package/dist/commands/task/shared/dependencies.d.ts +4 -4
  407. package/dist/commands/task/shared/dependencies.d.ts.map +1 -1
  408. package/dist/commands/task/shared/dependencies.js +10 -2
  409. package/dist/commands/task/shared/docs.d.ts +6 -1
  410. package/dist/commands/task/shared/docs.d.ts.map +1 -1
  411. package/dist/commands/task/shared/docs.js +13 -0
  412. package/dist/commands/task/shared/listing.d.ts +16 -2
  413. package/dist/commands/task/shared/listing.d.ts.map +1 -1
  414. package/dist/commands/task/shared/listing.js +56 -0
  415. package/dist/commands/task/shared/transition-command.d.ts +15 -0
  416. package/dist/commands/task/shared/transition-command.d.ts.map +1 -0
  417. package/dist/commands/task/shared/transition-command.js +43 -0
  418. package/dist/commands/task/shared/transitions.d.ts +39 -0
  419. package/dist/commands/task/shared/transitions.d.ts.map +1 -1
  420. package/dist/commands/task/shared/transitions.js +62 -1
  421. package/dist/commands/task/shared/workflow-transition-service.d.ts +75 -0
  422. package/dist/commands/task/shared/workflow-transition-service.d.ts.map +1 -0
  423. package/dist/commands/task/shared/workflow-transition-service.js +226 -0
  424. package/dist/commands/task/shared.d.ts +5 -3
  425. package/dist/commands/task/shared.d.ts.map +1 -1
  426. package/dist/commands/task/shared.js +5 -3
  427. package/dist/commands/task/show.d.ts.map +1 -1
  428. package/dist/commands/task/show.js +37 -3
  429. package/dist/commands/task/start.d.ts.map +1 -1
  430. package/dist/commands/task/start.js +33 -119
  431. package/dist/commands/task/task.command.d.ts +3 -4
  432. package/dist/commands/task/task.command.d.ts.map +1 -1
  433. package/dist/commands/task/task.command.js +22 -37
  434. package/dist/commands/task/verify-record.d.ts.map +1 -1
  435. package/dist/commands/task/verify-record.js +16 -141
  436. package/dist/commands/task/verify.command.d.ts.map +1 -1
  437. package/dist/commands/task/verify.command.js +7 -6
  438. package/dist/commands/task.test-helpers.d.ts +13 -0
  439. package/dist/commands/task.test-helpers.d.ts.map +1 -0
  440. package/dist/commands/task.test-helpers.js +65 -0
  441. package/dist/commands/upgrade/materialize.d.ts +28 -0
  442. package/dist/commands/upgrade/materialize.d.ts.map +1 -0
  443. package/dist/commands/upgrade/materialize.js +154 -0
  444. package/dist/commands/upgrade/plan.d.ts +18 -0
  445. package/dist/commands/upgrade/plan.d.ts.map +1 -0
  446. package/dist/commands/upgrade/plan.js +219 -0
  447. package/dist/commands/upgrade/policy.d.ts +24 -0
  448. package/dist/commands/upgrade/policy.d.ts.map +1 -0
  449. package/dist/commands/upgrade/policy.js +182 -0
  450. package/dist/commands/upgrade/report.d.ts.map +1 -1
  451. package/dist/commands/upgrade/report.js +7 -5
  452. package/dist/commands/upgrade.d.ts.map +1 -1
  453. package/dist/commands/upgrade.js +154 -642
  454. package/dist/commands/workflow.command.d.ts +3 -4
  455. package/dist/commands/workflow.command.d.ts.map +1 -1
  456. package/dist/commands/workflow.command.js +8 -25
  457. package/dist/ports/task-backend-port.d.ts +3 -1
  458. package/dist/ports/task-backend-port.d.ts.map +1 -1
  459. package/dist/runner/adapters/codex.d.ts +9 -0
  460. package/dist/runner/adapters/codex.d.ts.map +1 -0
  461. package/dist/runner/adapters/codex.js +414 -0
  462. package/dist/runner/adapters/custom.d.ts +12 -0
  463. package/dist/runner/adapters/custom.d.ts.map +1 -0
  464. package/dist/runner/adapters/custom.js +512 -0
  465. package/dist/runner/adapters/index.d.ts +8 -0
  466. package/dist/runner/adapters/index.d.ts.map +1 -0
  467. package/dist/runner/adapters/index.js +15 -0
  468. package/dist/runner/adapters/recipe-run-profile.d.ts +8 -0
  469. package/dist/runner/adapters/recipe-run-profile.d.ts.map +1 -0
  470. package/dist/runner/adapters/recipe-run-profile.js +53 -0
  471. package/dist/runner/adapters/shared.d.ts +45 -0
  472. package/dist/runner/adapters/shared.d.ts.map +1 -0
  473. package/dist/runner/adapters/shared.js +58 -0
  474. package/dist/runner/artifacts.d.ts +31 -0
  475. package/dist/runner/artifacts.d.ts.map +1 -0
  476. package/dist/runner/artifacts.js +153 -0
  477. package/dist/runner/codex-approval-probe.d.ts +23 -0
  478. package/dist/runner/codex-approval-probe.d.ts.map +1 -0
  479. package/dist/runner/codex-approval-probe.js +55 -0
  480. package/dist/runner/codex-smoke.d.ts +11 -0
  481. package/dist/runner/codex-smoke.d.ts.map +1 -0
  482. package/dist/runner/codex-smoke.js +45 -0
  483. package/dist/runner/config.d.ts +6 -0
  484. package/dist/runner/config.d.ts.map +1 -0
  485. package/dist/runner/config.js +15 -0
  486. package/dist/runner/context/base-prompts.d.ts +10 -0
  487. package/dist/runner/context/base-prompts.d.ts.map +1 -0
  488. package/dist/runner/context/base-prompts.js +255 -0
  489. package/dist/runner/context/recipe-context.d.ts +17 -0
  490. package/dist/runner/context/recipe-context.d.ts.map +1 -0
  491. package/dist/runner/context/recipe-context.js +48 -0
  492. package/dist/runner/context/task-context.d.ts +24 -0
  493. package/dist/runner/context/task-context.d.ts.map +1 -0
  494. package/dist/runner/context/task-context.js +266 -0
  495. package/dist/runner/index.d.ts +12 -0
  496. package/dist/runner/index.d.ts.map +1 -0
  497. package/dist/runner/index.js +11 -0
  498. package/dist/runner/policy-decision.d.ts +12 -0
  499. package/dist/runner/policy-decision.d.ts.map +1 -0
  500. package/dist/runner/policy-decision.js +89 -0
  501. package/dist/runner/policy-display.d.ts +4 -0
  502. package/dist/runner/policy-display.d.ts.map +1 -0
  503. package/dist/runner/policy-display.js +41 -0
  504. package/dist/runner/process-supervision.d.ts +48 -0
  505. package/dist/runner/process-supervision.d.ts.map +1 -0
  506. package/dist/runner/process-supervision.js +490 -0
  507. package/dist/runner/result-manifest-policy.d.ts +9 -0
  508. package/dist/runner/result-manifest-policy.d.ts.map +1 -0
  509. package/dist/runner/result-manifest-policy.js +96 -0
  510. package/dist/runner/result-manifest.d.ts +30 -0
  511. package/dist/runner/result-manifest.d.ts.map +1 -0
  512. package/dist/runner/result-manifest.js +322 -0
  513. package/dist/runner/run-id.d.ts +2 -0
  514. package/dist/runner/run-id.d.ts.map +1 -0
  515. package/dist/runner/run-id.js +3 -0
  516. package/dist/runner/run-repository.d.ts +51 -0
  517. package/dist/runner/run-repository.d.ts.map +1 -0
  518. package/dist/runner/run-repository.js +222 -0
  519. package/dist/runner/task-run-paths.d.ts +19 -0
  520. package/dist/runner/task-run-paths.d.ts.map +1 -0
  521. package/dist/runner/task-run-paths.js +25 -0
  522. package/dist/runner/task-state.d.ts +9 -0
  523. package/dist/runner/task-state.d.ts.map +1 -0
  524. package/dist/runner/task-state.js +354 -0
  525. package/dist/runner/test-helpers.d.ts +30 -0
  526. package/dist/runner/test-helpers.d.ts.map +1 -0
  527. package/dist/runner/test-helpers.js +97 -0
  528. package/dist/runner/trace-artifacts.d.ts +14 -0
  529. package/dist/runner/trace-artifacts.d.ts.map +1 -0
  530. package/dist/runner/trace-artifacts.js +80 -0
  531. package/dist/runner/trace.d.ts +10 -0
  532. package/dist/runner/trace.d.ts.map +1 -0
  533. package/dist/runner/trace.js +37 -0
  534. package/dist/runner/types.d.ts +317 -0
  535. package/dist/runner/types.d.ts.map +1 -0
  536. package/dist/runner/types.js +3 -0
  537. package/dist/runner/usecases/scenario-materialize-task.d.ts +29 -0
  538. package/dist/runner/usecases/scenario-materialize-task.d.ts.map +1 -0
  539. package/dist/runner/usecases/scenario-materialize-task.js +151 -0
  540. package/dist/runner/usecases/task-run-inspect.d.ts +41 -0
  541. package/dist/runner/usecases/task-run-inspect.d.ts.map +1 -0
  542. package/dist/runner/usecases/task-run-inspect.js +74 -0
  543. package/dist/runner/usecases/task-run-lifecycle-cancel.d.ts +10 -0
  544. package/dist/runner/usecases/task-run-lifecycle-cancel.d.ts.map +1 -0
  545. package/dist/runner/usecases/task-run-lifecycle-cancel.js +172 -0
  546. package/dist/runner/usecases/task-run-lifecycle-replay.d.ts +18 -0
  547. package/dist/runner/usecases/task-run-lifecycle-replay.d.ts.map +1 -0
  548. package/dist/runner/usecases/task-run-lifecycle-replay.js +128 -0
  549. package/dist/runner/usecases/task-run-lifecycle-shared.d.ts +45 -0
  550. package/dist/runner/usecases/task-run-lifecycle-shared.d.ts.map +1 -0
  551. package/dist/runner/usecases/task-run-lifecycle-shared.js +172 -0
  552. package/dist/runner/usecases/task-run-lifecycle.d.ts +4 -0
  553. package/dist/runner/usecases/task-run-lifecycle.d.ts.map +1 -0
  554. package/dist/runner/usecases/task-run-lifecycle.js +2 -0
  555. package/dist/runner/usecases/task-run.d.ts +32 -0
  556. package/dist/runner/usecases/task-run.d.ts.map +1 -0
  557. package/dist/runner/usecases/task-run.js +278 -0
  558. package/dist/shared/agent-emoji.d.ts.map +1 -1
  559. package/dist/shared/agent-emoji.js +1 -0
  560. package/dist/shared/errors.d.ts +1 -1
  561. package/dist/shared/errors.d.ts.map +1 -1
  562. package/dist/shared/guards.d.ts.map +1 -1
  563. package/dist/shared/guards.js +1 -0
  564. package/dist/shared/repo-cli-version.d.ts.map +1 -1
  565. package/dist/shared/repo-cli-version.js +7 -5
  566. package/dist/shared/task-doc-conflicts.d.ts +12 -0
  567. package/dist/shared/task-doc-conflicts.d.ts.map +1 -0
  568. package/dist/shared/task-doc-conflicts.js +40 -0
  569. package/dist/shared/task-doc-state.d.ts +10 -0
  570. package/dist/shared/task-doc-state.d.ts.map +1 -0
  571. package/dist/shared/task-doc-state.js +15 -0
  572. package/dist/test-helpers/fs.d.ts +2 -0
  573. package/dist/test-helpers/fs.d.ts.map +1 -0
  574. package/dist/test-helpers/fs.js +9 -0
  575. package/dist/usecases/context/resolve-context.d.ts +2 -0
  576. package/dist/usecases/context/resolve-context.d.ts.map +1 -1
  577. package/dist/usecases/context/resolve-context.js +4 -1
  578. package/dist/usecases/task/task-list-usecase.d.ts.map +1 -1
  579. package/dist/usecases/task/task-list-usecase.js +2 -8
  580. package/dist/workflow-runtime/fix.d.ts +9 -1
  581. package/dist/workflow-runtime/fix.d.ts.map +1 -1
  582. package/dist/workflow-runtime/fix.js +9 -1
  583. package/package.json +3 -2
  584. package/dist/backends/task-backend.test-helpers.d.ts +0 -4
  585. package/dist/backends/task-backend.test-helpers.d.ts.map +0 -1
  586. package/dist/backends/task-backend.test-helpers.js +0 -33
  587. package/dist/cli/run-cli/catalog.d.ts +0 -7
  588. package/dist/cli/run-cli/catalog.d.ts.map +0 -1
  589. package/dist/cli/run-cli/catalog.js +0 -22
  590. package/dist/cli/run-cli.core.pr-flow.test-helpers.d.ts +0 -3
  591. package/dist/cli/run-cli.core.pr-flow.test-helpers.d.ts.map +0 -1
  592. package/dist/cli/run-cli.core.pr-flow.test-helpers.js +0 -41
  593. package/dist/cli/run-cli.core.tasks.test-helpers.d.ts +0 -2
  594. package/dist/cli/run-cli.core.tasks.test-helpers.d.ts.map +0 -1
  595. package/dist/cli/run-cli.core.tasks.test-helpers.js +0 -6
  596. package/dist/commands/block.command.d.ts +0 -4
  597. package/dist/commands/block.command.d.ts.map +0 -1
  598. package/dist/commands/block.command.js +0 -2
  599. package/dist/commands/doctor.command.d.ts +0 -3
  600. package/dist/commands/doctor.command.d.ts.map +0 -1
  601. package/dist/commands/doctor.command.js +0 -2
  602. package/dist/commands/finish.command.d.ts +0 -4
  603. package/dist/commands/finish.command.d.ts.map +0 -1
  604. package/dist/commands/finish.command.js +0 -2
  605. package/dist/commands/recipes/install.command.d.ts +0 -3
  606. package/dist/commands/recipes/install.command.d.ts.map +0 -1
  607. package/dist/commands/recipes/install.command.js +0 -2
  608. package/dist/commands/start.command.d.ts +0 -4
  609. package/dist/commands/start.command.d.ts.map +0 -1
  610. package/dist/commands/start.command.js +0 -2
  611. package/dist/commands/task/list.command.d.ts +0 -4
  612. package/dist/commands/task/list.command.d.ts.map +0 -1
  613. package/dist/commands/task/list.command.js +0 -2
  614. package/dist/commands/task/next.command.d.ts +0 -4
  615. package/dist/commands/task/next.command.d.ts.map +0 -1
  616. package/dist/commands/task/next.command.js +0 -2
  617. package/dist/commands/task/search.command.d.ts +0 -4
  618. package/dist/commands/task/search.command.d.ts.map +0 -1
  619. package/dist/commands/task/search.command.js +0 -2
  620. package/dist/commands/task/show.command.d.ts +0 -4
  621. package/dist/commands/task/show.command.d.ts.map +0 -1
  622. package/dist/commands/task/show.command.js +0 -2
  623. package/dist/commands/verify.command.d.ts +0 -4
  624. package/dist/commands/verify.command.d.ts.map +0 -1
  625. package/dist/commands/verify.command.js +0 -2
@@ -0,0 +1,40 @@
1
+ import type { TaskData } from "../../backends/task-backend.js";
2
+ import type { CommandContext } from "../shared/task-backend.js";
3
+ export type HostedMergedPr = {
4
+ number: number;
5
+ title?: string | null;
6
+ url?: string | null;
7
+ mergedAt?: string | null;
8
+ baseRefName?: string | null;
9
+ headRefName?: string | null;
10
+ headRefOid?: string | null;
11
+ mergeCommit?: {
12
+ oid?: string | null;
13
+ } | null;
14
+ };
15
+ export type HostedMergeTarget = {
16
+ taskId: string;
17
+ branch: string;
18
+ mergedPr: HostedMergedPr;
19
+ };
20
+ type HostedMergeSyncResult = {
21
+ tasks: TaskData[];
22
+ synced: number;
23
+ };
24
+ export declare function resolveHostedMergeTargetFromEvent(opts: {
25
+ event: unknown;
26
+ branchPrefix: string;
27
+ }): HostedMergeTarget | null;
28
+ export declare function syncHostedMergedTask(opts: {
29
+ ctx: CommandContext;
30
+ tasks: TaskData[];
31
+ target: HostedMergeTarget;
32
+ missingTask?: "noop" | "error";
33
+ missingPrMeta?: "noop" | "error";
34
+ }): Promise<HostedMergeSyncResult>;
35
+ export declare function syncHostedMergedTasks(opts: {
36
+ ctx: CommandContext;
37
+ tasks: TaskData[];
38
+ }): Promise<HostedMergeSyncResult>;
39
+ export {};
40
+ //# sourceMappingURL=hosted-merge-sync.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hosted-merge-sync.d.ts","sourceRoot":"","sources":["../../../src/commands/task/hosted-merge-sync.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAM/D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAGhE,MAAM,MAAM,cAAc,GAAG;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,WAAW,CAAC,EAAE;QAAE,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,GAAG,IAAI,CAAC;CAC9C,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,cAAc,CAAC;CAC1B,CAAC;AAEF,KAAK,qBAAqB,GAAG;IAC3B,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AA6EF,wBAAgB,iCAAiC,CAAC,IAAI,EAAE;IACtD,KAAK,EAAE,OAAO,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;CACtB,GAAG,iBAAiB,GAAG,IAAI,CAY3B;AA2HD,wBAAsB,oBAAoB,CAAC,IAAI,EAAE;IAC/C,GAAG,EAAE,cAAc,CAAC;IACpB,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB,MAAM,EAAE,iBAAiB,CAAC;IAC1B,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAC/B,aAAa,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CAClC,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAuDjC;AAED,wBAAsB,qBAAqB,CAAC,IAAI,EAAE;IAChD,GAAG,EAAE,cAAc,CAAC;IACpB,KAAK,EAAE,QAAQ,EAAE,CAAC;CACnB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CA0CjC"}
@@ -0,0 +1,277 @@
1
+ import { readFile } from "node:fs/promises";
2
+ import path from "node:path";
3
+ import { normalizeTaskDocVersion } from "@agentplaneorg/core";
4
+ import { CliError } from "../../shared/errors.js";
5
+ import { writeJsonStableIfChanged } from "../../shared/write-if-changed.js";
6
+ import { execFileAsync } from "../shared/git.js";
7
+ import { parseTaskIdFromBranch } from "../shared/git-worktree.js";
8
+ import { parsePrMeta } from "../shared/pr-meta.js";
9
+ import { appendTaskEvent } from "./shared.js";
10
+ function normalizeMergedPr(value) {
11
+ if (!value || typeof value !== "object" || Array.isArray(value))
12
+ return null;
13
+ const record = value;
14
+ const number = typeof record.number === "number" ? record.number : null;
15
+ if (!number || number <= 0)
16
+ return null;
17
+ const mergeCommit = record.mergeCommit &&
18
+ typeof record.mergeCommit === "object" &&
19
+ !Array.isArray(record.mergeCommit)
20
+ ? {
21
+ oid: typeof record.mergeCommit.oid === "string"
22
+ ? String(record.mergeCommit.oid)
23
+ : null,
24
+ }
25
+ : null;
26
+ return {
27
+ number,
28
+ title: typeof record.title === "string" ? record.title : null,
29
+ url: typeof record.url === "string" ? record.url : null,
30
+ mergedAt: typeof record.mergedAt === "string" ? record.mergedAt : null,
31
+ baseRefName: typeof record.baseRefName === "string" ? record.baseRefName : null,
32
+ headRefName: typeof record.headRefName === "string" ? record.headRefName : null,
33
+ headRefOid: typeof record.headRefOid === "string" ? record.headRefOid : null,
34
+ mergeCommit,
35
+ };
36
+ }
37
+ function normalizePullRequestLike(value) {
38
+ if (!value || typeof value !== "object" || Array.isArray(value))
39
+ return null;
40
+ const record = value;
41
+ if (record.merged !== true)
42
+ return null;
43
+ const number = typeof record.number === "number" ? record.number : null;
44
+ const mergeCommitSha = typeof record.merge_commit_sha === "string" && record.merge_commit_sha.trim().length > 0
45
+ ? record.merge_commit_sha.trim()
46
+ : null;
47
+ const head = record.head && typeof record.head === "object" && !Array.isArray(record.head)
48
+ ? record.head
49
+ : null;
50
+ const base = record.base && typeof record.base === "object" && !Array.isArray(record.base)
51
+ ? record.base
52
+ : null;
53
+ const headRefName = typeof head?.ref === "string" ? head.ref : null;
54
+ const headRefOid = typeof head?.sha === "string" ? head.sha : null;
55
+ const baseRefName = typeof base?.ref === "string" ? base.ref : null;
56
+ if (!number || number <= 0 || !mergeCommitSha || !headRefName)
57
+ return null;
58
+ return {
59
+ number,
60
+ title: typeof record.title === "string" ? record.title : null,
61
+ url: typeof record.html_url === "string" ? record.html_url : null,
62
+ mergedAt: typeof record.merged_at === "string" ? record.merged_at : null,
63
+ baseRefName,
64
+ headRefName,
65
+ headRefOid,
66
+ mergeCommit: { oid: mergeCommitSha },
67
+ };
68
+ }
69
+ function pickHostedMergedPr(records) {
70
+ const merged = records
71
+ .map((record) => normalizeMergedPr(record))
72
+ .filter((record) => !!record && !!record.mergeCommit?.oid);
73
+ if (merged.length === 0)
74
+ return null;
75
+ return (merged.toSorted((a, b) => {
76
+ const left = a.mergedAt ?? "";
77
+ const right = b.mergedAt ?? "";
78
+ return right.localeCompare(left);
79
+ })[0] ?? null);
80
+ }
81
+ export function resolveHostedMergeTargetFromEvent(opts) {
82
+ if (!opts.event || typeof opts.event !== "object" || Array.isArray(opts.event))
83
+ return null;
84
+ const pullRequest = opts.event.pull_request;
85
+ const mergedPr = normalizePullRequestLike(pullRequest);
86
+ if (!mergedPr?.headRefName || !mergedPr.mergeCommit?.oid)
87
+ return null;
88
+ const taskId = parseTaskIdFromBranch(opts.branchPrefix, mergedPr.headRefName);
89
+ if (!taskId)
90
+ return null;
91
+ return {
92
+ taskId,
93
+ branch: mergedPr.headRefName,
94
+ mergedPr,
95
+ };
96
+ }
97
+ async function resolveHostedMergedPr(opts) {
98
+ const { stdout } = await execFileAsync("gh", [
99
+ "pr",
100
+ "list",
101
+ "--state",
102
+ "merged",
103
+ "--head",
104
+ opts.branch,
105
+ "--json",
106
+ "number,title,url,mergedAt,baseRefName,headRefName,headRefOid,mergeCommit",
107
+ ], {
108
+ cwd: opts.cwd,
109
+ env: process.env,
110
+ maxBuffer: 10 * 1024 * 1024,
111
+ });
112
+ const parsed = JSON.parse(stdout);
113
+ return Array.isArray(parsed) ? pickHostedMergedPr(parsed) : null;
114
+ }
115
+ function buildSyncedPrMeta(opts) {
116
+ const at = opts.mergedPr.mergedAt ?? new Date().toISOString();
117
+ return {
118
+ ...opts.meta,
119
+ branch: opts.branch,
120
+ status: "MERGED",
121
+ base: opts.mergedPr.baseRefName ?? opts.meta.base,
122
+ merge_strategy: opts.meta.merge_strategy,
123
+ merged_at: opts.meta.merged_at ?? at,
124
+ merge_commit: opts.mergedPr.mergeCommit?.oid ?? opts.meta.merge_commit,
125
+ head_sha: opts.mergedPr.headRefOid ?? opts.meta.head_sha,
126
+ updated_at: at,
127
+ };
128
+ }
129
+ function buildSyncedTask(opts) {
130
+ const at = opts.mergedPr.mergedAt ?? new Date().toISOString();
131
+ const currentStatus = String(opts.task.status || "TODO").toUpperCase();
132
+ const note = `Hosted PR #${opts.mergedPr.number} merged on GitHub main; ` +
133
+ "task projection reconciled from hosted PR artifacts.";
134
+ const statusEvent = {
135
+ type: "status",
136
+ at,
137
+ author: "INTEGRATOR",
138
+ from: currentStatus,
139
+ to: "DONE",
140
+ note,
141
+ };
142
+ const mergeHash = opts.mergedPr.mergeCommit?.oid ?? "";
143
+ const mergeMessage = opts.mergedPr.title?.trim();
144
+ return {
145
+ ...opts.task,
146
+ status: "DONE",
147
+ result_summary: opts.task.result_summary ?? `Merged via PR #${opts.mergedPr.number}.`,
148
+ commit: opts.task.commit?.hash?.trim()
149
+ ? opts.task.commit
150
+ : mergeHash
151
+ ? {
152
+ hash: mergeHash,
153
+ message: (mergeMessage && mergeMessage.length > 0 ? mergeMessage : null) ??
154
+ `Hosted PR #${opts.mergedPr.number} merged on GitHub main`,
155
+ }
156
+ : null,
157
+ events: appendTaskEvent(opts.task, statusEvent),
158
+ doc_version: normalizeTaskDocVersion(opts.task.doc_version),
159
+ doc_updated_at: at,
160
+ doc_updated_by: "INTEGRATOR",
161
+ };
162
+ }
163
+ async function readPrMetaIfPresent(opts) {
164
+ const metaPath = path.join(opts.ctx.resolvedProject.gitRoot, opts.ctx.config.paths.workflow_dir, opts.taskId, "pr", "meta.json");
165
+ try {
166
+ const raw = await readFile(metaPath, "utf8");
167
+ return { meta: parsePrMeta(raw, opts.taskId), metaPath };
168
+ }
169
+ catch {
170
+ return null;
171
+ }
172
+ }
173
+ function needsHostedMergeSync(opts) {
174
+ const currentStatus = String(opts.task.status || "TODO").toUpperCase();
175
+ const expectedCommit = opts.mergedPr.mergeCommit?.oid ?? "";
176
+ const expectedBase = opts.mergedPr.baseRefName ?? opts.meta.base ?? "";
177
+ const expectedHeadSha = opts.mergedPr.headRefOid ?? opts.meta.head_sha ?? "";
178
+ if (currentStatus !== "DONE")
179
+ return true;
180
+ if ((opts.task.commit?.hash ?? "") !== expectedCommit)
181
+ return true;
182
+ if (opts.meta.status !== "MERGED")
183
+ return true;
184
+ if ((opts.meta.merge_commit ?? "") !== expectedCommit)
185
+ return true;
186
+ if ((opts.meta.branch ?? "") !== opts.branch)
187
+ return true;
188
+ if ((opts.meta.base ?? "") !== expectedBase)
189
+ return true;
190
+ if (opts.meta.head_sha?.trim() !== expectedHeadSha)
191
+ return true;
192
+ return false;
193
+ }
194
+ export async function syncHostedMergedTask(opts) {
195
+ if (opts.ctx.backendId !== "local" || opts.ctx.config.workflow_mode !== "branch_pr") {
196
+ return { tasks: opts.tasks, synced: 0 };
197
+ }
198
+ const task = opts.tasks.find((entry) => entry.id === opts.target.taskId);
199
+ if (!task) {
200
+ if (opts.missingTask === "error") {
201
+ throw new CliError({
202
+ exitCode: 3,
203
+ code: "E_VALIDATION",
204
+ message: `Hosted task closure could not find task artifact: ${opts.target.taskId}`,
205
+ });
206
+ }
207
+ return { tasks: opts.tasks, synced: 0 };
208
+ }
209
+ const prMetaRecord = await readPrMetaIfPresent({ ctx: opts.ctx, taskId: opts.target.taskId });
210
+ if (!prMetaRecord) {
211
+ if (opts.missingPrMeta === "error") {
212
+ throw new CliError({
213
+ exitCode: 3,
214
+ code: "E_VALIDATION",
215
+ message: `Hosted task closure could not find pr/meta.json for ${opts.target.taskId}`,
216
+ });
217
+ }
218
+ return { tasks: opts.tasks, synced: 0 };
219
+ }
220
+ if (!needsHostedMergeSync({
221
+ task,
222
+ meta: prMetaRecord.meta,
223
+ mergedPr: opts.target.mergedPr,
224
+ branch: opts.target.branch,
225
+ })) {
226
+ return { tasks: opts.tasks, synced: 0 };
227
+ }
228
+ const nextMeta = buildSyncedPrMeta({
229
+ meta: prMetaRecord.meta,
230
+ mergedPr: opts.target.mergedPr,
231
+ branch: opts.target.branch,
232
+ });
233
+ await writeJsonStableIfChanged(prMetaRecord.metaPath, nextMeta);
234
+ return {
235
+ tasks: opts.tasks.map((entry) => entry.id === opts.target.taskId
236
+ ? buildSyncedTask({ task: entry, mergedPr: opts.target.mergedPr })
237
+ : entry),
238
+ synced: 1,
239
+ };
240
+ }
241
+ export async function syncHostedMergedTasks(opts) {
242
+ if (opts.ctx.backendId !== "local" || opts.ctx.config.workflow_mode !== "branch_pr") {
243
+ return { tasks: opts.tasks, synced: 0 };
244
+ }
245
+ const nextTasks = [];
246
+ let synced = 0;
247
+ for (const task of opts.tasks) {
248
+ const prMetaRecord = await readPrMetaIfPresent({ ctx: opts.ctx, taskId: task.id });
249
+ if (!prMetaRecord) {
250
+ nextTasks.push(task);
251
+ continue;
252
+ }
253
+ const branch = prMetaRecord.meta.branch?.trim() ?? "";
254
+ if (!branch) {
255
+ nextTasks.push(task);
256
+ continue;
257
+ }
258
+ const mergedPr = await resolveHostedMergedPr({
259
+ cwd: opts.ctx.resolvedProject.gitRoot,
260
+ branch,
261
+ });
262
+ if (!mergedPr?.mergeCommit?.oid) {
263
+ nextTasks.push(task);
264
+ continue;
265
+ }
266
+ const syncedTask = await syncHostedMergedTask({
267
+ ctx: opts.ctx,
268
+ tasks: [task],
269
+ target: { taskId: task.id, branch, mergedPr },
270
+ missingTask: "noop",
271
+ missingPrMeta: "noop",
272
+ });
273
+ nextTasks.push(syncedTask.tasks[0] ?? task);
274
+ synced += syncedTask.synced;
275
+ }
276
+ return { tasks: nextTasks, synced };
277
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/commands/task/list.ts"],"names":[],"mappings":"AACA,OAAO,EAAqC,KAAK,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAEnG,OAAO,EAML,KAAK,eAAe,EACrB,MAAM,aAAa,CAAC;AAErB,wBAAsB,sBAAsB,CAAC,IAAI,EAAE;IACjD,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,eAAe,CAAC;CAC1B,GAAG,OAAO,CAAC,MAAM,CAAC,CA6ClB;AAED,wBAAsB,WAAW,CAAC,IAAI,EAAE;IACtC,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,eAAe,CAAC;CAC1B,GAAG,OAAO,CAAC,MAAM,CAAC,CAElB"}
1
+ {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/commands/task/list.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAIL,KAAK,eAAe,EACrB,MAAM,aAAa,CAAC;AAErB,wBAAsB,sBAAsB,CAAC,IAAI,EAAE;IACjD,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,eAAe,CAAC;CAC1B,GAAG,OAAO,CAAC,MAAM,CAAC,CA4BlB;AAED,wBAAsB,WAAW,CAAC,IAAI,EAAE;IACtC,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,eAAe,CAAC;CAC1B,GAAG,OAAO,CAAC,MAAM,CAAC,CAElB"}
@@ -1,40 +1,23 @@
1
1
  import { mapBackendError } from "../../cli/error-map.js";
2
- import { listTasksMemo, loadCommandContext } from "../shared/task-backend.js";
3
- import { buildDependencyState, dedupeStrings, formatTaskLine, handleTaskListWarnings, toStringArray, } from "./shared.js";
2
+ import { listTaskSummariesMemo, loadCommandContext, } from "../shared/task-backend.js";
3
+ import { formatTaskLine, handleTaskListWarnings, queryTaskProjection, } from "./shared.js";
4
4
  export async function cmdTaskListWithFilters(opts) {
5
5
  try {
6
6
  const ctx = opts.ctx ??
7
7
  (await loadCommandContext({ cwd: opts.cwd, rootOverride: opts.rootOverride ?? null }));
8
- const tasks = await listTasksMemo(ctx);
8
+ const tasks = await listTaskSummariesMemo(ctx);
9
9
  handleTaskListWarnings({ backend: ctx.taskBackend, strictRead: opts.filters.strictRead });
10
- const depState = buildDependencyState(tasks);
11
- let filtered = tasks;
12
- if (opts.filters.status.length > 0) {
13
- const wanted = new Set(opts.filters.status.map((s) => s.trim().toUpperCase()));
14
- filtered = filtered.filter((task) => wanted.has(String(task.status || "TODO").toUpperCase()));
15
- }
16
- if (opts.filters.owner.length > 0) {
17
- const wanted = new Set(opts.filters.owner.map((o) => o.trim().toUpperCase()));
18
- filtered = filtered.filter((task) => wanted.has(String(task.owner || "").toUpperCase()));
19
- }
20
- if (opts.filters.tag.length > 0) {
21
- const wanted = new Set(opts.filters.tag.map((t) => t.trim()).filter(Boolean));
22
- filtered = filtered.filter((task) => {
23
- const tags = dedupeStrings(toStringArray(task.tags));
24
- return tags.some((tag) => wanted.has(tag));
25
- });
26
- }
27
- const sorted = filtered.toSorted((a, b) => a.id.localeCompare(b.id));
28
- for (const task of sorted) {
10
+ const { depState, items } = queryTaskProjection({ tasks, filters: opts.filters });
11
+ for (const task of items) {
29
12
  process.stdout.write(`${formatTaskLine(task, depState.get(task.id))}\n`);
30
13
  }
31
14
  if (!opts.filters.quiet) {
32
15
  const counts = {};
33
- for (const task of sorted) {
16
+ for (const task of items) {
34
17
  const status = String(task.status || "TODO").toUpperCase();
35
18
  counts[status] = (counts[status] ?? 0) + 1;
36
19
  }
37
- const total = sorted.length;
20
+ const total = items.length;
38
21
  const summary = Object.keys(counts)
39
22
  .toSorted()
40
23
  .map((key) => `${key}=${counts[key]}`)
@@ -1 +1 @@
1
- {"version":3,"file":"new.d.ts","sourceRoot":"","sources":["../../../src/commands/task/new.ts"],"names":[],"mappings":"AAMA,OAAO,EAAsB,KAAK,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAcpF,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,KAAK,GAAG,QAAQ,GAAG,KAAK,GAAG,MAAM,CAAC;IAC5C,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;AAmDF,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,aAAa,CAAC;CACvB,GAAG,OAAO,CAAC,MAAM,CAAC,CAmFlB"}
1
+ {"version":3,"file":"new.d.ts","sourceRoot":"","sources":["../../../src/commands/task/new.ts"],"names":[],"mappings":"AAOA,OAAO,EAAsB,KAAK,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAcpF,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,KAAK,GAAG,QAAQ,GAAG,KAAK,GAAG,MAAM,CAAC;IAC5C,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;AAmDF,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,aAAa,CAAC;CACvB,GAAG,OAAO,CAAC,MAAM,CAAC,CAsGlB"}
@@ -1,7 +1,8 @@
1
- import { setMarkdownSection, taskDocToSectionMap } from "@agentplaneorg/core";
1
+ import { setMarkdownSection } from "@agentplaneorg/core";
2
2
  import { mapBackendError } from "../../cli/error-map.js";
3
3
  import { backendNotSupportedMessage, warnMessage } from "../../cli/output.js";
4
4
  import { CliError } from "../../shared/errors.js";
5
+ import { buildTaskDocState } from "../../shared/task-doc-state.js";
5
6
  import { loadCommandContext } from "../shared/task-backend.js";
6
7
  import { ensureTaskDependsOnGraphIsAcyclic, nowIso, requiresVerifyStepsByPrimary, resolvePrimaryTag, warnIfUnknownOwner, } from "./shared.js";
7
8
  import { buildDefaultVerifyStepsSection, defaultTaskDocV3, TASK_DOC_VERSION_V3, } from "./doc-template.js";
@@ -66,6 +67,13 @@ export async function runTaskNewParsed(opts) {
66
67
  });
67
68
  }
68
69
  const taskId = await ctx.taskBackend.generateTaskId({ length: suffixLength, attempts: 1000 });
70
+ const docState = buildTaskDocState({
71
+ doc: defaultTaskDocV3({ title: p.title, description: p.description }),
72
+ owner: p.owner,
73
+ updatedBy: p.owner,
74
+ version: TASK_DOC_VERSION_V3,
75
+ updatedAt: nowIso(),
76
+ });
69
77
  const task = {
70
78
  id: taskId,
71
79
  title: p.title,
@@ -74,15 +82,16 @@ export async function runTaskNewParsed(opts) {
74
82
  priority: p.priority,
75
83
  owner: p.owner,
76
84
  revision: 1,
85
+ origin: { system: "manual" },
77
86
  tags: p.tags,
78
87
  depends_on: p.dependsOn,
79
88
  verify: p.verify,
80
89
  comments: [],
81
- doc_version: TASK_DOC_VERSION_V3,
82
- doc_updated_at: nowIso(),
83
- doc_updated_by: p.owner,
90
+ doc_version: docState.doc_version,
91
+ doc_updated_at: docState.doc_updated_at,
92
+ doc_updated_by: docState.doc_updated_by,
84
93
  id_source: "generated",
85
- doc: defaultTaskDocV3({ title: p.title, description: p.description }),
94
+ doc: docState.doc,
86
95
  };
87
96
  const spikeTag = (ctx.config.tasks.verify.spike_tag ?? "spike").trim().toLowerCase();
88
97
  const primary = resolvePrimaryTag(p.tags, ctx);
@@ -108,7 +117,18 @@ export async function runTaskNewParsed(opts) {
108
117
  if (hasSpike && hasImplementationTags) {
109
118
  process.stderr.write(`${warnMessage("spike is combined with a primary tag that requires verify steps; consider splitting spike vs implementation tasks")}\n`);
110
119
  }
111
- task.sections = taskDocToSectionMap(task.doc ?? "");
120
+ const normalizedDoc = buildTaskDocState({
121
+ doc: task.doc ?? "",
122
+ owner: p.owner,
123
+ updatedBy: task.doc_updated_by,
124
+ version: TASK_DOC_VERSION_V3,
125
+ updatedAt: task.doc_updated_at,
126
+ });
127
+ task.doc = normalizedDoc.doc;
128
+ task.sections = normalizedDoc.sections;
129
+ task.doc_version = normalizedDoc.doc_version;
130
+ task.doc_updated_at = normalizedDoc.doc_updated_at;
131
+ task.doc_updated_by = normalizedDoc.doc_updated_by;
112
132
  await ctx.taskBackend.writeTask(task);
113
133
  process.stdout.write(`${taskId}\n`);
114
134
  return 0;
@@ -1 +1 @@
1
- {"version":3,"file":"next.d.ts","sourceRoot":"","sources":["../../../src/commands/task/next.ts"],"names":[],"mappings":"AACA,OAAO,EAAsB,KAAK,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAEpF,OAAO,EAML,KAAK,eAAe,EACrB,MAAM,aAAa,CAAC;AAErB,wBAAsB,WAAW,CAAC,IAAI,EAAE;IACtC,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,eAAe,CAAC;CAC1B,GAAG,OAAO,CAAC,MAAM,CAAC,CA6ClB"}
1
+ {"version":3,"file":"next.d.ts","sourceRoot":"","sources":["../../../src/commands/task/next.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAIL,KAAK,eAAe,EACrB,MAAM,aAAa,CAAC;AAErB,wBAAsB,WAAW,CAAC,IAAI,EAAE;IACtC,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,eAAe,CAAC;CAC1B,GAAG,OAAO,CAAC,MAAM,CAAC,CAuBlB"}
@@ -1,41 +1,23 @@
1
1
  import { mapBackendError } from "../../cli/error-map.js";
2
- import { loadCommandContext } from "../shared/task-backend.js";
3
- import { buildDependencyState, dedupeStrings, formatTaskLine, handleTaskListWarnings, toStringArray, } from "./shared.js";
2
+ import { listTaskSummariesMemo, loadCommandContext, } from "../shared/task-backend.js";
3
+ import { formatTaskLine, handleTaskListWarnings, queryTaskProjection, } from "./shared.js";
4
4
  export async function cmdTaskNext(opts) {
5
5
  try {
6
6
  const ctx = opts.ctx ??
7
7
  (await loadCommandContext({ cwd: opts.cwd, rootOverride: opts.rootOverride ?? null }));
8
- const tasks = await ctx.taskBackend.listTasks();
8
+ const tasks = await listTaskSummariesMemo(ctx);
9
9
  handleTaskListWarnings({ backend: ctx.taskBackend, strictRead: opts.filters.strictRead });
10
- const depState = buildDependencyState(tasks);
11
- const statuses = opts.filters.status.length > 0
12
- ? new Set(opts.filters.status.map((s) => s.trim().toUpperCase()))
13
- : new Set(["TODO"]);
14
- let filtered = tasks.filter((task) => statuses.has(String(task.status || "TODO").toUpperCase()));
15
- if (opts.filters.owner.length > 0) {
16
- const wanted = new Set(opts.filters.owner.map((o) => o.trim().toUpperCase()));
17
- filtered = filtered.filter((task) => wanted.has(String(task.owner || "").toUpperCase()));
18
- }
19
- if (opts.filters.tag.length > 0) {
20
- const wanted = new Set(opts.filters.tag.map((t) => t.trim()).filter(Boolean));
21
- filtered = filtered.filter((task) => {
22
- const tags = dedupeStrings(toStringArray(task.tags));
23
- return tags.some((tag) => wanted.has(tag));
24
- });
25
- }
26
- const sorted = filtered.toSorted((a, b) => a.id.localeCompare(b.id));
27
- const ready = sorted.filter((task) => {
28
- const dep = depState.get(task.id);
29
- return !dep || (dep.missing.length === 0 && dep.incomplete.length === 0);
10
+ const { depState, filtered, items } = queryTaskProjection({
11
+ tasks,
12
+ filters: opts.filters,
13
+ defaultStatuses: ["TODO"],
14
+ readyOnly: true,
30
15
  });
31
- const limited = opts.filters.limit !== undefined && opts.filters.limit >= 0
32
- ? ready.slice(0, opts.filters.limit)
33
- : ready;
34
- for (const task of limited) {
16
+ for (const task of items) {
35
17
  process.stdout.write(`${formatTaskLine(task, depState.get(task.id))}\n`);
36
18
  }
37
19
  if (!opts.filters.quiet) {
38
- process.stdout.write(`Ready: ${limited.length} / ${filtered.length}\n`);
20
+ process.stdout.write(`Ready: ${items.length} / ${filtered.length}\n`);
39
21
  }
40
22
  return 0;
41
23
  }
@@ -4,6 +4,7 @@ export type TaskNormalizeParsed = {
4
4
  quiet: boolean;
5
5
  force: boolean;
6
6
  yes: boolean;
7
+ syncHostedMerges: boolean;
7
8
  };
8
9
  export declare const taskNormalizeSpec: CommandSpec<TaskNormalizeParsed>;
9
10
  export declare function makeRunTaskNormalizeHandler(getCtx: (cmd: string) => Promise<CommandContext>): (ctx: CommandCtx, p: TaskNormalizeParsed) => Promise<number>;
@@ -1 +1 @@
1
- {"version":3,"file":"normalize.command.d.ts","sourceRoot":"","sources":["../../../src/commands/task/normalize.command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACtE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAIhE,MAAM,MAAM,mBAAmB,GAAG;IAChC,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,EAAE,OAAO,CAAC;IACf,GAAG,EAAE,OAAO,CAAC;CACd,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,WAAW,CAAC,mBAAmB,CAiC9D,CAAC;AAEF,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,cAAc,CAAC,IAC5E,KAAK,UAAU,EAAE,GAAG,mBAAmB,KAAG,OAAO,CAAC,MAAM,CAAC,CAUxE"}
1
+ {"version":3,"file":"normalize.command.d.ts","sourceRoot":"","sources":["../../../src/commands/task/normalize.command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACtE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAIhE,MAAM,MAAM,mBAAmB,GAAG;IAChC,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,EAAE,OAAO,CAAC;IACf,GAAG,EAAE,OAAO,CAAC;IACb,gBAAgB,EAAE,OAAO,CAAC;CAC3B,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,WAAW,CAAC,mBAAmB,CA6C9D,CAAC;AAEF,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,cAAc,CAAC,IAC5E,KAAK,UAAU,EAAE,GAAG,mBAAmB,KAAG,OAAO,CAAC,MAAM,CAAC,CAWxE"}
@@ -22,15 +22,26 @@ export const taskNormalizeSpec = {
22
22
  default: false,
23
23
  description: "Auto-approve force-action approval checks when required.",
24
24
  },
25
+ {
26
+ kind: "boolean",
27
+ name: "sync-hosted-merges",
28
+ default: false,
29
+ description: "Query GitHub for merged hosted PRs referenced by local PR artifacts and reconcile stale branch_pr task state before normalization.",
30
+ },
25
31
  ],
26
32
  examples: [
27
33
  { cmd: "agentplane task normalize", why: "Normalize tasks and print a short summary." },
28
34
  { cmd: "agentplane task normalize --quiet", why: "Normalize tasks without printing output." },
35
+ {
36
+ cmd: "agentplane task normalize --sync-hosted-merges",
37
+ why: "Reconcile stale branch_pr task state from hosted PR merges, then normalize the local projection.",
38
+ },
29
39
  ],
30
40
  parse: (raw) => ({
31
41
  quiet: raw.opts.quiet === true,
32
42
  force: raw.opts.force === true,
33
43
  yes: raw.opts.yes === true,
44
+ syncHostedMerges: raw.opts["sync-hosted-merges"] === true,
34
45
  }),
35
46
  };
36
47
  export function makeRunTaskNormalizeHandler(getCtx) {
@@ -42,6 +53,7 @@ export function makeRunTaskNormalizeHandler(getCtx) {
42
53
  quiet: p.quiet,
43
54
  force: p.force,
44
55
  yes: p.yes,
56
+ syncHostedMerges: p.syncHostedMerges,
45
57
  });
46
58
  };
47
59
  }
@@ -6,5 +6,6 @@ export declare function cmdTaskNormalize(opts: {
6
6
  quiet: boolean;
7
7
  force: boolean;
8
8
  yes?: boolean;
9
+ syncHostedMerges?: boolean;
9
10
  }): Promise<number>;
10
11
  //# sourceMappingURL=normalize.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"normalize.d.ts","sourceRoot":"","sources":["../../../src/commands/task/normalize.ts"],"names":[],"mappings":"AAGA,OAAO,EAAsB,KAAK,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAEpF,wBAAsB,gBAAgB,CAAC,IAAI,EAAE;IAC3C,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,EAAE,OAAO,CAAC;IACf,GAAG,CAAC,EAAE,OAAO,CAAC;CACf,GAAG,OAAO,CAAC,MAAM,CAAC,CAsClB"}
1
+ {"version":3,"file":"normalize.d.ts","sourceRoot":"","sources":["../../../src/commands/task/normalize.ts"],"names":[],"mappings":"AAGA,OAAO,EAAsB,KAAK,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAIpF,wBAAsB,gBAAgB,CAAC,IAAI,EAAE;IAC3C,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,EAAE,OAAO,CAAC;IACf,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B,GAAG,OAAO,CAAC,MAAM,CAAC,CAqDlB"}
@@ -2,6 +2,8 @@ import { mapBackendError } from "../../cli/error-map.js";
2
2
  import { successMessage } from "../../cli/output.js";
3
3
  import { ensureActionApproved } from "../shared/approval-requirements.js";
4
4
  import { loadCommandContext } from "../shared/task-backend.js";
5
+ import { applyTaskCollectionMutation } from "../shared/task-mutation.js";
6
+ import { syncHostedMergedTasks } from "./hosted-merge-sync.js";
5
7
  export async function cmdTaskNormalize(opts) {
6
8
  try {
7
9
  const ctx = opts.ctx ??
@@ -14,22 +16,32 @@ export async function cmdTaskNormalize(opts) {
14
16
  reason: "task normalize --force",
15
17
  });
16
18
  }
17
- if (ctx.taskBackend.normalizeTasks) {
19
+ if (ctx.taskBackend.normalizeTasks && opts.syncHostedMerges !== true) {
18
20
  const result = await ctx.taskBackend.normalizeTasks();
19
21
  if (!opts.quiet) {
20
22
  process.stdout.write(`${successMessage("normalized tasks", undefined, `scanned=${result.scanned} changed=${result.changed}`)}\n`);
21
23
  }
22
24
  return 0;
23
25
  }
24
- const tasks = await ctx.taskBackend.listTasks();
25
- await (ctx.taskBackend.writeTasks
26
- ? ctx.taskBackend.writeTasks(tasks)
27
- : (async () => {
28
- for (const task of tasks)
29
- await ctx.taskBackend.writeTask(task);
30
- })());
26
+ let syncedHostedMerges = 0;
27
+ const { result, tasksToWrite } = await applyTaskCollectionMutation({
28
+ ctx,
29
+ build: async (tasks) => {
30
+ let nextTasks = tasks;
31
+ if (opts.syncHostedMerges === true) {
32
+ const synced = await syncHostedMergedTasks({ ctx, tasks });
33
+ nextTasks = synced.tasks;
34
+ syncedHostedMerges = synced.synced;
35
+ }
36
+ return {
37
+ result: null,
38
+ tasksToWrite: nextTasks,
39
+ };
40
+ },
41
+ });
42
+ void result;
31
43
  if (!opts.quiet) {
32
- process.stdout.write(`${successMessage("normalized tasks", undefined, `count=${tasks.length}`)}\n`);
44
+ process.stdout.write(`${successMessage("normalized tasks", undefined, `count=${tasksToWrite.length}${opts.syncHostedMerges === true ? ` synced_hosted_merges=${syncedHostedMerges}` : ""}`)}\n`);
33
45
  }
34
46
  return 0;
35
47
  }
@@ -1,8 +1,7 @@
1
1
  import type { CommandHandler, CommandSpec } from "../../cli/spec/spec.js";
2
- type TaskPlanGroupParsed = {
3
- cmd: string[];
4
- };
2
+ import { type GroupCommandParsed } from "../../cli/group-command.js";
3
+ type TaskPlanGroupParsed = GroupCommandParsed;
5
4
  export declare const taskPlanSpec: CommandSpec<TaskPlanGroupParsed>;
6
- export declare const runTaskPlan: CommandHandler<TaskPlanGroupParsed>;
5
+ export declare const runTaskPlan: CommandHandler<GroupCommandParsed>;
7
6
  export {};
8
7
  //# sourceMappingURL=plan.command.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"plan.command.d.ts","sourceRoot":"","sources":["../../../src/commands/task/plan.command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAc,cAAc,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAItF,KAAK,mBAAmB,GAAG;IAAE,GAAG,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC;AAI7C,eAAO,MAAM,YAAY,EAAE,WAAW,CAAC,mBAAmB,CAqBzD,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,cAAc,CAAC,mBAAmB,CAW3D,CAAC"}
1
+ {"version":3,"file":"plan.command.d.ts","sourceRoot":"","sources":["../../../src/commands/task/plan.command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAc,cAAc,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACtF,OAAO,EAIL,KAAK,kBAAkB,EACxB,MAAM,4BAA4B,CAAC;AACpC,KAAK,mBAAmB,GAAG,kBAAkB,CAAC;AAE9C,eAAO,MAAM,YAAY,EAAE,WAAW,CAAC,mBAAmB,CAqBzD,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,cAAc,CAAC,kBAAkB,CAO1D,CAAC"}