agentplane 0.3.9 → 0.3.11

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 (404) hide show
  1. package/assets/AGENTS.md +4 -2
  2. package/assets/agents/CODER.json +1 -1
  3. package/assets/policy/dod.core.md +1 -1
  4. package/assets/policy/governance.md +5 -3
  5. package/assets/policy/incidents.md +19 -77
  6. package/assets/policy/workflow.branch_pr.md +2 -0
  7. package/assets/policy/workflow.direct.md +3 -1
  8. package/bin/agentplane.js +56 -1
  9. package/bin/runtime-watch.js +1 -0
  10. package/bin/stale-dist-policy.d.ts +1 -1
  11. package/bin/stale-dist-policy.js +13 -0
  12. package/dist/.build-manifest.json +462 -202
  13. package/dist/cli/bootstrap-guide.d.ts +1 -0
  14. package/dist/cli/bootstrap-guide.d.ts.map +1 -1
  15. package/dist/cli/bootstrap-guide.js +20 -1
  16. package/dist/cli/command-guide.d.ts.map +1 -1
  17. package/dist/cli/command-guide.js +2 -1
  18. package/dist/cli/command-invocations.d.ts.map +1 -1
  19. package/dist/cli/command-invocations.js +6 -1
  20. package/dist/cli/command-snippets.d.ts +2 -0
  21. package/dist/cli/command-snippets.d.ts.map +1 -1
  22. package/dist/cli/command-snippets.js +2 -0
  23. package/dist/cli/run-cli/command-catalog/core.d.ts +1 -1
  24. package/dist/cli/run-cli/command-catalog/core.d.ts.map +1 -1
  25. package/dist/cli/run-cli/command-catalog/core.js +10 -0
  26. package/dist/cli/run-cli/command-catalog/project.d.ts +1 -1
  27. package/dist/cli/run-cli/command-catalog/project.d.ts.map +1 -1
  28. package/dist/cli/run-cli/command-catalog/project.js +3 -1
  29. package/dist/cli/run-cli/command-catalog/task.d.ts +1 -1
  30. package/dist/cli/run-cli/command-catalog/task.d.ts.map +1 -1
  31. package/dist/cli/run-cli/command-catalog/task.js +10 -0
  32. package/dist/cli/run-cli/command-catalog.d.ts +1 -1
  33. package/dist/cli/run-cli/command-catalog.d.ts.map +1 -1
  34. package/dist/cli/run-cli/commands/config.d.ts.map +1 -1
  35. package/dist/cli/run-cli/commands/config.js +13 -0
  36. package/dist/cli/run-cli/commands/core/preflight.d.ts.map +1 -1
  37. package/dist/cli/run-cli/commands/core/preflight.js +44 -1
  38. package/dist/cli/run-cli.js +2 -2
  39. package/dist/cli/run-cli.test-helpers.d.ts.map +1 -1
  40. package/dist/cli/run-cli.test-helpers.js +12 -0
  41. package/dist/commands/backend.d.ts.map +1 -1
  42. package/dist/commands/backend.js +4 -0
  43. package/dist/commands/branch/cleanup-merged.d.ts +2 -0
  44. package/dist/commands/branch/cleanup-merged.d.ts.map +1 -1
  45. package/dist/commands/branch/cleanup-merged.js +132 -28
  46. package/dist/commands/branch/work-start.d.ts.map +1 -1
  47. package/dist/commands/branch/work-start.js +60 -1
  48. package/dist/commands/cleanup/merged.command.d.ts +2 -0
  49. package/dist/commands/cleanup/merged.command.d.ts.map +1 -1
  50. package/dist/commands/cleanup/merged.command.js +24 -0
  51. package/dist/commands/doctor/branch-pr.d.ts +4 -0
  52. package/dist/commands/doctor/branch-pr.d.ts.map +1 -0
  53. package/dist/commands/doctor/branch-pr.js +96 -0
  54. package/dist/commands/doctor/fixes.d.ts +5 -0
  55. package/dist/commands/doctor/fixes.d.ts.map +1 -1
  56. package/dist/commands/doctor/fixes.js +70 -0
  57. package/dist/commands/doctor.run.d.ts.map +1 -1
  58. package/dist/commands/doctor.run.js +6 -1
  59. package/dist/commands/finish.run.d.ts.map +1 -1
  60. package/dist/commands/finish.run.js +11 -0
  61. package/dist/commands/finish.spec.d.ts +11 -0
  62. package/dist/commands/finish.spec.d.ts.map +1 -1
  63. package/dist/commands/finish.spec.js +51 -0
  64. package/dist/commands/guard/impl/close-message.d.ts.map +1 -1
  65. package/dist/commands/guard/impl/close-message.js +23 -6
  66. package/dist/commands/guard/impl/commands.d.ts.map +1 -1
  67. package/dist/commands/guard/impl/commands.js +24 -2
  68. package/dist/commands/guard/impl/env.d.ts +1 -0
  69. package/dist/commands/guard/impl/env.d.ts.map +1 -1
  70. package/dist/commands/guard/impl/env.js +1 -0
  71. package/dist/commands/hooks/index.d.ts.map +1 -1
  72. package/dist/commands/hooks/index.js +98 -1
  73. package/dist/commands/incidents/advise.command.d.ts +15 -0
  74. package/dist/commands/incidents/advise.command.d.ts.map +1 -0
  75. package/dist/commands/incidents/advise.command.js +139 -0
  76. package/dist/commands/incidents/collect.command.d.ts +11 -0
  77. package/dist/commands/incidents/collect.command.d.ts.map +1 -0
  78. package/dist/commands/incidents/collect.command.js +72 -0
  79. package/dist/commands/incidents/incidents.command.d.ts +5 -0
  80. package/dist/commands/incidents/incidents.command.d.ts.map +1 -0
  81. package/dist/commands/incidents/incidents.command.js +21 -0
  82. package/dist/commands/incidents/shared.d.ts +76 -0
  83. package/dist/commands/incidents/shared.d.ts.map +1 -0
  84. package/dist/commands/incidents/shared.js +261 -0
  85. package/dist/commands/pr/check.d.ts.map +1 -1
  86. package/dist/commands/pr/check.js +249 -75
  87. package/dist/commands/pr/close-superseded.d.ts +9 -0
  88. package/dist/commands/pr/close-superseded.d.ts.map +1 -0
  89. package/dist/commands/pr/close-superseded.js +129 -0
  90. package/dist/commands/pr/close.d.ts +11 -0
  91. package/dist/commands/pr/close.d.ts.map +1 -0
  92. package/dist/commands/pr/close.js +116 -0
  93. package/dist/commands/pr/index.d.ts +2 -0
  94. package/dist/commands/pr/index.d.ts.map +1 -1
  95. package/dist/commands/pr/index.js +2 -0
  96. package/dist/commands/pr/integrate/artifacts.d.ts +7 -0
  97. package/dist/commands/pr/integrate/artifacts.d.ts.map +1 -1
  98. package/dist/commands/pr/integrate/artifacts.js +66 -1
  99. package/dist/commands/pr/integrate/cmd.d.ts.map +1 -1
  100. package/dist/commands/pr/integrate/cmd.js +20 -0
  101. package/dist/commands/pr/integrate/internal/bootstrap-guidance.d.ts +8 -0
  102. package/dist/commands/pr/integrate/internal/bootstrap-guidance.d.ts.map +1 -0
  103. package/dist/commands/pr/integrate/internal/bootstrap-guidance.js +59 -0
  104. package/dist/commands/pr/integrate/internal/finalize.d.ts.map +1 -1
  105. package/dist/commands/pr/integrate/internal/finalize.js +40 -12
  106. package/dist/commands/pr/integrate/internal/merge.d.ts +4 -0
  107. package/dist/commands/pr/integrate/internal/merge.d.ts.map +1 -1
  108. package/dist/commands/pr/integrate/internal/merge.js +59 -15
  109. package/dist/commands/pr/integrate/internal/post-integrate-bootstrap.d.ts +13 -0
  110. package/dist/commands/pr/integrate/internal/post-integrate-bootstrap.d.ts.map +1 -0
  111. package/dist/commands/pr/integrate/internal/post-integrate-bootstrap.js +25 -0
  112. package/dist/commands/pr/integrate/internal/prepare.d.ts +3 -2
  113. package/dist/commands/pr/integrate/internal/prepare.d.ts.map +1 -1
  114. package/dist/commands/pr/integrate/internal/prepare.js +107 -19
  115. package/dist/commands/pr/internal/freshness.d.ts +20 -0
  116. package/dist/commands/pr/internal/freshness.d.ts.map +1 -0
  117. package/dist/commands/pr/internal/freshness.js +50 -0
  118. package/dist/commands/pr/internal/gh-api.d.ts +6 -0
  119. package/dist/commands/pr/internal/gh-api.d.ts.map +1 -0
  120. package/dist/commands/pr/internal/gh-api.js +80 -0
  121. package/dist/commands/pr/internal/note-store.d.ts +18 -0
  122. package/dist/commands/pr/internal/note-store.d.ts.map +1 -0
  123. package/dist/commands/pr/internal/note-store.js +66 -0
  124. package/dist/commands/pr/internal/pr-paths.d.ts +13 -0
  125. package/dist/commands/pr/internal/pr-paths.d.ts.map +1 -1
  126. package/dist/commands/pr/internal/pr-paths.js +13 -0
  127. package/dist/commands/pr/internal/review-template.d.ts +24 -4
  128. package/dist/commands/pr/internal/review-template.d.ts.map +1 -1
  129. package/dist/commands/pr/internal/review-template.js +221 -33
  130. package/dist/commands/pr/internal/sync.d.ts +41 -0
  131. package/dist/commands/pr/internal/sync.d.ts.map +1 -0
  132. package/dist/commands/pr/internal/sync.js +598 -0
  133. package/dist/commands/pr/note.d.ts.map +1 -1
  134. package/dist/commands/pr/note.js +37 -4
  135. package/dist/commands/pr/open.d.ts +1 -0
  136. package/dist/commands/pr/open.d.ts.map +1 -1
  137. package/dist/commands/pr/open.js +18 -54
  138. package/dist/commands/pr/pr.command.d.ts +15 -0
  139. package/dist/commands/pr/pr.command.d.ts.map +1 -1
  140. package/dist/commands/pr/pr.command.js +124 -5
  141. package/dist/commands/pr/update.d.ts.map +1 -1
  142. package/dist/commands/pr/update.js +58 -74
  143. package/dist/commands/recipes/impl/commands/cache-prune.d.ts.map +1 -1
  144. package/dist/commands/recipes/impl/commands/cache-prune.js +14 -0
  145. package/dist/commands/recipes/impl/commands/install.js +1 -1
  146. package/dist/commands/recipes/impl/commands/list-remote.d.ts.map +1 -1
  147. package/dist/commands/recipes/impl/commands/list-remote.js +1 -0
  148. package/dist/commands/recipes/impl/commands/remove.d.ts.map +1 -1
  149. package/dist/commands/recipes/impl/commands/remove.js +9 -1
  150. package/dist/commands/release/apply.command.d.ts.map +1 -1
  151. package/dist/commands/release/apply.command.js +12 -17
  152. package/dist/commands/release/apply.preflight.d.ts.map +1 -1
  153. package/dist/commands/release/apply.preflight.js +1 -1
  154. package/dist/commands/shared/approval-requirements.d.ts +5 -7
  155. package/dist/commands/shared/approval-requirements.d.ts.map +1 -1
  156. package/dist/commands/shared/approval-requirements.js +3 -73
  157. package/dist/commands/shared/gh-transport.d.ts +16 -0
  158. package/dist/commands/shared/gh-transport.d.ts.map +1 -0
  159. package/dist/commands/shared/gh-transport.js +71 -0
  160. package/dist/commands/shared/git-diff.d.ts +3 -1
  161. package/dist/commands/shared/git-diff.d.ts.map +1 -1
  162. package/dist/commands/shared/git-diff.js +10 -2
  163. package/dist/commands/shared/git-ops.d.ts +1 -0
  164. package/dist/commands/shared/git-ops.d.ts.map +1 -1
  165. package/dist/commands/shared/git-ops.js +15 -0
  166. package/dist/commands/shared/git-worktree.d.ts +2 -0
  167. package/dist/commands/shared/git-worktree.d.ts.map +1 -1
  168. package/dist/commands/shared/git-worktree.js +22 -2
  169. package/dist/commands/shared/network-approval.d.ts +2 -0
  170. package/dist/commands/shared/network-approval.d.ts.map +1 -1
  171. package/dist/commands/shared/network-approval.js +1 -1
  172. package/dist/commands/shared/post-commit-pr-artifacts.d.ts +9 -0
  173. package/dist/commands/shared/post-commit-pr-artifacts.d.ts.map +1 -0
  174. package/dist/commands/shared/post-commit-pr-artifacts.js +22 -0
  175. package/dist/commands/shared/pr-meta.d.ts +29 -0
  176. package/dist/commands/shared/pr-meta.d.ts.map +1 -1
  177. package/dist/commands/shared/pr-meta.js +152 -3
  178. package/dist/commands/shared/task-backend.d.ts +9 -0
  179. package/dist/commands/shared/task-backend.d.ts.map +1 -1
  180. package/dist/commands/shared/task-backend.js +34 -22
  181. package/dist/commands/shared/task-local-freshness.d.ts +13 -0
  182. package/dist/commands/shared/task-local-freshness.d.ts.map +1 -0
  183. package/dist/commands/shared/task-local-freshness.js +20 -0
  184. package/dist/commands/shared/task-mutation.d.ts +2 -0
  185. package/dist/commands/shared/task-mutation.d.ts.map +1 -1
  186. package/dist/commands/shared/task-mutation.js +7 -0
  187. package/dist/commands/task/block.d.ts.map +1 -1
  188. package/dist/commands/task/block.js +1 -0
  189. package/dist/commands/task/close-duplicate.d.ts.map +1 -1
  190. package/dist/commands/task/close-duplicate.js +34 -1
  191. package/dist/commands/task/close-shared.d.ts.map +1 -1
  192. package/dist/commands/task/close-shared.js +1 -0
  193. package/dist/commands/task/derive.js +1 -1
  194. package/dist/commands/task/doc-template.d.ts.map +1 -1
  195. package/dist/commands/task/doc-template.js +7 -11
  196. package/dist/commands/task/findings-add.command.d.ts +20 -0
  197. package/dist/commands/task/findings-add.command.d.ts.map +1 -0
  198. package/dist/commands/task/findings-add.command.js +165 -0
  199. package/dist/commands/task/findings.command.d.ts +7 -0
  200. package/dist/commands/task/findings.command.d.ts.map +1 -0
  201. package/dist/commands/task/findings.command.js +20 -0
  202. package/dist/commands/task/findings.d.ts +63 -0
  203. package/dist/commands/task/findings.d.ts.map +1 -0
  204. package/dist/commands/task/findings.js +188 -0
  205. package/dist/commands/task/finish-shared.d.ts +1 -0
  206. package/dist/commands/task/finish-shared.d.ts.map +1 -1
  207. package/dist/commands/task/finish-shared.js +60 -3
  208. package/dist/commands/task/finish.d.ts +10 -0
  209. package/dist/commands/task/finish.d.ts.map +1 -1
  210. package/dist/commands/task/finish.js +143 -0
  211. package/dist/commands/task/hosted-close-pr.command.d.ts +11 -0
  212. package/dist/commands/task/hosted-close-pr.command.d.ts.map +1 -0
  213. package/dist/commands/task/hosted-close-pr.command.js +414 -0
  214. package/dist/commands/task/hosted-close.command.d.ts.map +1 -1
  215. package/dist/commands/task/hosted-close.command.js +49 -1
  216. package/dist/commands/task/hosted-merge-sync.d.ts +38 -0
  217. package/dist/commands/task/hosted-merge-sync.d.ts.map +1 -1
  218. package/dist/commands/task/hosted-merge-sync.js +249 -17
  219. package/dist/commands/task/index.d.ts +1 -0
  220. package/dist/commands/task/index.d.ts.map +1 -1
  221. package/dist/commands/task/index.js +1 -0
  222. package/dist/commands/task/new.d.ts +1 -0
  223. package/dist/commands/task/new.d.ts.map +1 -1
  224. package/dist/commands/task/new.js +140 -30
  225. package/dist/commands/task/new.spec.d.ts.map +1 -1
  226. package/dist/commands/task/new.spec.js +7 -0
  227. package/dist/commands/task/normalize.command.d.ts +2 -0
  228. package/dist/commands/task/normalize.command.d.ts.map +1 -1
  229. package/dist/commands/task/normalize.command.js +45 -0
  230. package/dist/commands/task/normalize.d.ts +2 -0
  231. package/dist/commands/task/normalize.d.ts.map +1 -1
  232. package/dist/commands/task/normalize.js +85 -8
  233. package/dist/commands/task/plan.d.ts.map +1 -1
  234. package/dist/commands/task/plan.js +7 -10
  235. package/dist/commands/task/set-status.d.ts.map +1 -1
  236. package/dist/commands/task/set-status.js +1 -0
  237. package/dist/commands/task/shared/docs.d.ts +6 -0
  238. package/dist/commands/task/shared/docs.d.ts.map +1 -1
  239. package/dist/commands/task/shared/docs.js +14 -0
  240. package/dist/commands/task/shared/transition-command.d.ts +2 -0
  241. package/dist/commands/task/shared/transition-command.d.ts.map +1 -1
  242. package/dist/commands/task/shared/transition-command.js +1 -0
  243. package/dist/commands/task/shared/transitions.d.ts.map +1 -1
  244. package/dist/commands/task/shared/transitions.js +11 -1
  245. package/dist/commands/task/shared.d.ts +1 -1
  246. package/dist/commands/task/shared.d.ts.map +1 -1
  247. package/dist/commands/task/shared.js +1 -1
  248. package/dist/commands/task/start-ready.d.ts.map +1 -1
  249. package/dist/commands/task/start-ready.js +98 -1
  250. package/dist/commands/task/start.d.ts.map +1 -1
  251. package/dist/commands/task/start.js +18 -10
  252. package/dist/commands/task/task.command.d.ts.map +1 -1
  253. package/dist/commands/task/task.command.js +4 -0
  254. package/dist/commands/task/verify-command-shared.d.ts +19 -0
  255. package/dist/commands/task/verify-command-shared.d.ts.map +1 -1
  256. package/dist/commands/task/verify-command-shared.js +152 -1
  257. package/dist/commands/task/verify-ok.command.d.ts.map +1 -1
  258. package/dist/commands/task/verify-ok.command.js +15 -2
  259. package/dist/commands/task/verify-record.d.ts +36 -0
  260. package/dist/commands/task/verify-record.d.ts.map +1 -1
  261. package/dist/commands/task/verify-record.js +193 -11
  262. package/dist/commands/task/verify-rework.command.d.ts.map +1 -1
  263. package/dist/commands/task/verify-rework.command.js +15 -2
  264. package/dist/commands/task/verify-show.command.d.ts +1 -1
  265. package/dist/commands/task/verify-show.command.d.ts.map +1 -1
  266. package/dist/commands/task/verify-show.command.js +28 -1
  267. package/dist/commands/upgrade.d.ts.map +1 -1
  268. package/dist/commands/upgrade.js +6 -1
  269. package/dist/commands/verify.run.d.ts.map +1 -1
  270. package/dist/commands/verify.run.js +12 -0
  271. package/dist/commands/verify.spec.d.ts +2 -6
  272. package/dist/commands/verify.spec.d.ts.map +1 -1
  273. package/dist/commands/verify.spec.js +30 -3
  274. package/dist/policy/engine.d.ts +3 -1
  275. package/dist/policy/engine.d.ts.map +1 -1
  276. package/dist/policy/engine.js +5 -6
  277. package/dist/policy/taxonomy.d.ts +17 -0
  278. package/dist/policy/taxonomy.d.ts.map +1 -0
  279. package/dist/policy/taxonomy.js +302 -0
  280. package/dist/policy/types.d.ts +2 -1
  281. package/dist/policy/types.d.ts.map +1 -1
  282. package/dist/runner/artifacts.d.ts.map +1 -1
  283. package/dist/runner/artifacts.js +2 -0
  284. package/dist/runner/context/base-prompts.d.ts +25 -0
  285. package/dist/runner/context/base-prompts.d.ts.map +1 -1
  286. package/dist/runner/context/base-prompts.js +182 -54
  287. package/dist/runner/context/recipe-context.d.ts.map +1 -1
  288. package/dist/runner/context/recipe-context.js +5 -0
  289. package/dist/runner/types.d.ts +12 -0
  290. package/dist/runner/types.d.ts.map +1 -1
  291. package/dist/runner/usecases/scenario-materialize-task.d.ts.map +1 -1
  292. package/dist/runner/usecases/scenario-materialize-task.js +81 -11
  293. package/dist/runner/usecases/task-run-inspect.d.ts.map +1 -1
  294. package/dist/runner/usecases/task-run-inspect.js +9 -7
  295. package/dist/runner/usecases/task-run-lifecycle-shared.d.ts.map +1 -1
  296. package/dist/runner/usecases/task-run-lifecycle-shared.js +8 -6
  297. package/dist/runner/usecases/task-run.d.ts.map +1 -1
  298. package/dist/runner/usecases/task-run.js +59 -12
  299. package/dist/runtime/approvals/index.d.ts +3 -0
  300. package/dist/runtime/approvals/index.d.ts.map +1 -0
  301. package/dist/runtime/approvals/index.js +1 -0
  302. package/dist/runtime/approvals/runtime.d.ts +12 -0
  303. package/dist/runtime/approvals/runtime.d.ts.map +1 -0
  304. package/dist/runtime/approvals/runtime.js +154 -0
  305. package/dist/runtime/approvals/types.d.ts +31 -0
  306. package/dist/runtime/approvals/types.d.ts.map +1 -0
  307. package/dist/runtime/approvals/types.js +1 -0
  308. package/dist/runtime/behavior/index.d.ts +3 -0
  309. package/dist/runtime/behavior/index.d.ts.map +1 -0
  310. package/dist/runtime/behavior/index.js +1 -0
  311. package/dist/runtime/behavior/resolve.d.ts +7 -0
  312. package/dist/runtime/behavior/resolve.d.ts.map +1 -0
  313. package/dist/runtime/behavior/resolve.js +66 -0
  314. package/dist/runtime/behavior/types.d.ts +25 -0
  315. package/dist/runtime/behavior/types.d.ts.map +1 -0
  316. package/dist/runtime/behavior/types.js +1 -0
  317. package/dist/runtime/capabilities/backend.d.ts +7 -0
  318. package/dist/runtime/capabilities/backend.d.ts.map +1 -0
  319. package/dist/runtime/capabilities/backend.js +104 -0
  320. package/dist/runtime/capabilities/index.d.ts +6 -0
  321. package/dist/runtime/capabilities/index.d.ts.map +1 -0
  322. package/dist/runtime/capabilities/index.js +4 -0
  323. package/dist/runtime/capabilities/recipe.d.ts +10 -0
  324. package/dist/runtime/capabilities/recipe.d.ts.map +1 -0
  325. package/dist/runtime/capabilities/recipe.js +123 -0
  326. package/dist/runtime/capabilities/registry.d.ts +6 -0
  327. package/dist/runtime/capabilities/registry.d.ts.map +1 -0
  328. package/dist/runtime/capabilities/registry.js +69 -0
  329. package/dist/runtime/capabilities/runner.d.ts +8 -0
  330. package/dist/runtime/capabilities/runner.d.ts.map +1 -0
  331. package/dist/runtime/capabilities/runner.js +73 -0
  332. package/dist/runtime/capabilities/types.d.ts +28 -0
  333. package/dist/runtime/capabilities/types.d.ts.map +1 -0
  334. package/dist/runtime/capabilities/types.js +1 -0
  335. package/dist/runtime/execution-profile/index.d.ts +3 -0
  336. package/dist/runtime/execution-profile/index.d.ts.map +1 -0
  337. package/dist/runtime/execution-profile/index.js +1 -0
  338. package/dist/runtime/execution-profile/resolve.d.ts +9 -0
  339. package/dist/runtime/execution-profile/resolve.d.ts.map +1 -0
  340. package/dist/runtime/execution-profile/resolve.js +80 -0
  341. package/dist/runtime/execution-profile/types.d.ts +27 -0
  342. package/dist/runtime/execution-profile/types.d.ts.map +1 -0
  343. package/dist/runtime/execution-profile/types.js +1 -0
  344. package/dist/runtime/explain/index.d.ts +3 -0
  345. package/dist/runtime/explain/index.d.ts.map +1 -0
  346. package/dist/runtime/explain/index.js +1 -0
  347. package/dist/runtime/explain/resolve.d.ts +14 -0
  348. package/dist/runtime/explain/resolve.d.ts.map +1 -0
  349. package/dist/runtime/explain/resolve.js +50 -0
  350. package/dist/runtime/explain/types.d.ts +28 -0
  351. package/dist/runtime/explain/types.d.ts.map +1 -0
  352. package/dist/runtime/explain/types.js +1 -0
  353. package/dist/runtime/harness/index.d.ts +4 -0
  354. package/dist/runtime/harness/index.d.ts.map +1 -0
  355. package/dist/runtime/harness/index.js +2 -0
  356. package/dist/runtime/harness/resolve-from-command-context.d.ts +4 -0
  357. package/dist/runtime/harness/resolve-from-command-context.d.ts.map +1 -0
  358. package/dist/runtime/harness/resolve-from-command-context.js +11 -0
  359. package/dist/runtime/harness/resolve.d.ts +13 -0
  360. package/dist/runtime/harness/resolve.d.ts.map +1 -0
  361. package/dist/runtime/harness/resolve.js +146 -0
  362. package/dist/runtime/harness/types.d.ts +65 -0
  363. package/dist/runtime/harness/types.d.ts.map +1 -0
  364. package/dist/runtime/harness/types.js +1 -0
  365. package/dist/runtime/incidents/index.d.ts +3 -0
  366. package/dist/runtime/incidents/index.d.ts.map +1 -0
  367. package/dist/runtime/incidents/index.js +1 -0
  368. package/dist/runtime/incidents/resolve.d.ts +26 -0
  369. package/dist/runtime/incidents/resolve.d.ts.map +1 -0
  370. package/dist/runtime/incidents/resolve.js +683 -0
  371. package/dist/runtime/incidents/types.d.ts +84 -0
  372. package/dist/runtime/incidents/types.d.ts.map +1 -0
  373. package/dist/runtime/incidents/types.js +1 -0
  374. package/dist/runtime/protocol/index.d.ts +3 -0
  375. package/dist/runtime/protocol/index.d.ts.map +1 -0
  376. package/dist/runtime/protocol/index.js +2 -0
  377. package/dist/runtime/protocol/resolve.d.ts +16 -0
  378. package/dist/runtime/protocol/resolve.d.ts.map +1 -0
  379. package/dist/runtime/protocol/resolve.js +36 -0
  380. package/dist/runtime/protocol/types.d.ts +36 -0
  381. package/dist/runtime/protocol/types.d.ts.map +1 -0
  382. package/dist/runtime/protocol/types.js +1 -0
  383. package/dist/runtime/task-intake/index.d.ts +3 -0
  384. package/dist/runtime/task-intake/index.d.ts.map +1 -0
  385. package/dist/runtime/task-intake/index.js +1 -0
  386. package/dist/runtime/task-intake/resolve.d.ts +48 -0
  387. package/dist/runtime/task-intake/resolve.d.ts.map +1 -0
  388. package/dist/runtime/task-intake/resolve.js +316 -0
  389. package/dist/runtime/task-intake/types.d.ts +117 -0
  390. package/dist/runtime/task-intake/types.d.ts.map +1 -0
  391. package/dist/runtime/task-intake/types.js +1 -0
  392. package/dist/shared/env.d.ts +1 -0
  393. package/dist/shared/env.d.ts.map +1 -1
  394. package/dist/shared/env.js +22 -1
  395. package/dist/shared/protected-paths.d.ts +4 -0
  396. package/dist/shared/protected-paths.d.ts.map +1 -1
  397. package/dist/shared/protected-paths.js +8 -4
  398. package/dist/usecases/context/resolve-context.d.ts +55 -6
  399. package/dist/usecases/context/resolve-context.d.ts.map +1 -1
  400. package/dist/usecases/context/resolve-context.js +96 -6
  401. package/dist/usecases/task/task-list-usecase.d.ts.map +1 -1
  402. package/dist/usecases/task/task-list-usecase.js +8 -2
  403. package/dist/usecases/task/task-new-usecase.js +4 -4
  404. package/package.json +2 -2
@@ -7,6 +7,7 @@ import { withDiagnosticContext } from "../../shared/diagnostics.js";
7
7
  import { CliError } from "../../shared/errors.js";
8
8
  import { execFileAsync, gitEnv } from "../shared/git.js";
9
9
  import { GitContext } from "../shared/git-context.js";
10
+ import { ensureActionApproved } from "../shared/approval-requirements.js";
10
11
  import { ensureNetworkApproved } from "../shared/network-approval.js";
11
12
  import { runOperatorPipeline } from "../shared/operator-pipeline.js";
12
13
  import { cleanHookEnv, maybePersistExpectedCliVersion, maybeRefreshGeneratedReference, maybeUpdateBunLockfile, replaceAgentplanePackageMetadata, replacePackageVersionInFile, } from "./apply.mutation.js";
@@ -84,11 +85,19 @@ async function ensureReleasePlanMatchesRepoState(opts) {
84
85
  async function runPushPreflight(opts) {
85
86
  const loaded = await loadConfig(opts.agentplaneDir);
86
87
  await ensureNetworkApproved({
88
+ action: "release_apply",
87
89
  config: loaded.config,
88
90
  yes: opts.yes,
89
91
  reason: "release apply --push validates npm version availability and pushes over network",
90
92
  interactive: Boolean(process.stdin.isTTY),
91
93
  });
94
+ await ensureActionApproved({
95
+ action: "git_push",
96
+ config: loaded.config,
97
+ yes: opts.yes,
98
+ reason: `release apply --push will push HEAD and ${opts.nextTag} to ${opts.remote}`,
99
+ interactive: Boolean(process.stdin.isTTY),
100
+ });
92
101
  await ensureRemoteExists(opts.gitRoot, opts.remote);
93
102
  await ensureRemoteTagDoesNotExist(opts.gitRoot, opts.remote, opts.nextTag);
94
103
  await ensureNpmVersionsAvailable(opts.gitRoot, opts.nextVersion);
@@ -183,8 +192,8 @@ export const releaseApplySpec = {
183
192
  kind: "boolean",
184
193
  name: "push",
185
194
  default: false,
186
- description: "Mandatory for real releases: push commit and tag so GitHub publish workflow can publish to npm " +
187
- "(requires --yes). Local tests can skip with AGENTPLANE_RELEASE_DRY_RUN=1.",
195
+ description: "Optional direct-push mode: push the release commit and tag immediately " +
196
+ "(requires --yes). Leave this off when publishing happens later from a protected branch workflow.",
188
197
  },
189
198
  {
190
199
  kind: "string",
@@ -208,13 +217,6 @@ export const releaseApplySpec = {
208
217
  };
209
218
  },
210
219
  validate: (p) => {
211
- if (!p.push && process.env.AGENTPLANE_RELEASE_DRY_RUN !== "1") {
212
- throw usageError({
213
- spec: releaseApplySpec,
214
- command: "release apply",
215
- message: "Release publish is mandatory. Run `agentplane release apply --push --yes`.",
216
- });
217
- }
218
220
  if (p.push && p.yes !== true) {
219
221
  throw usageError({
220
222
  spec: releaseApplySpec,
@@ -233,7 +235,7 @@ export const releaseApplySpec = {
233
235
  examples: [
234
236
  {
235
237
  cmd: "agentplane release apply",
236
- why: "Apply the latest release plan (expects docs/releases/vX.Y.Z.md to exist).",
238
+ why: "Apply the latest release plan locally (expects docs/releases/vX.Y.Z.md to exist).",
237
239
  },
238
240
  {
239
241
  cmd: "agentplane release apply --plan .agentplane/.release/plan/<runId>",
@@ -246,13 +248,6 @@ export const releaseApplySpec = {
246
248
  ],
247
249
  };
248
250
  export const runReleaseApply = async (ctx, flags) => {
249
- if (!flags.push && process.env.AGENTPLANE_RELEASE_DRY_RUN !== "1") {
250
- throw usageError({
251
- spec: releaseApplySpec,
252
- command: "release apply",
253
- message: "Release publish is mandatory. Run `agentplane release apply --push --yes`.",
254
- });
255
- }
256
251
  return await runOperatorPipeline({
257
252
  init: async () => {
258
253
  const resolved = await resolveProject({
@@ -1 +1 @@
1
- {"version":3,"file":"apply.preflight.d.ts","sourceRoot":"","sources":["../../../src/commands/release/apply.preflight.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAEvE,wBAAsB,UAAU,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAO5D;AAED,wBAAsB,YAAY,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAE3D;AAaD,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,OAAO,GAAG,kBAAkB,CAuBjE;AAED,wBAAsB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAiBxE;AAED,wBAAsB,kBAAkB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAW7E;AAED,wBAAsB,yBAAyB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAgBpF;AAED,wBAAsB,oBAAoB,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAwB/F;AAED,wBAAsB,sBAAsB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAiC3E;AAED,wBAAsB,qBAAqB,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA6BvF;AAED,wBAAsB,kBAAkB,C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Cause: "the release flow needs to create one deterministic version-bump commit and tag, but tracked edits already exist in the workspace",
141
141
  nextAction: {
142
142
  command: "git status --short --untracked-files=no",
143
- reason: "inspect or clear tracked changes before rerunning `agentplane release apply --push --yes`",
143
+ reason: "inspect or clear tracked changes before rerunning `agentplane release apply`",
144
144
  reasonCode: "release_dirty_tree",
145
145
  },
146
146
  }),
@@ -1,15 +1,13 @@
1
1
  import type { AgentplaneConfig } from "@agentplaneorg/core";
2
- export type ApprovalAction = "network_access" | "force_action" | "policy_write" | "config_write" | "dangerous_fs" | "git_push";
3
- export type ApprovalRequirement = {
4
- required: boolean;
5
- reason: string;
6
- };
2
+ import type { PolicyActionId, PolicyApprovalKind } from "../../policy/taxonomy.js";
3
+ import { type ApprovalRequirement } from "../../runtime/approvals/index.js";
4
+ export type ApprovalAction = PolicyApprovalKind;
7
5
  export declare function getApprovalRequirements(opts: {
8
6
  config: AgentplaneConfig;
9
- action: ApprovalAction;
7
+ action: PolicyActionId;
10
8
  }): ApprovalRequirement;
11
9
  export declare function ensureActionApproved(opts: {
12
- action: ApprovalAction;
10
+ action: PolicyActionId;
13
11
  config: AgentplaneConfig;
14
12
  yes: boolean;
15
13
  reason: string;
@@ -1 +1 @@
1
- {"version":3,"file":"approval-requirements.d.ts","sourceRoot":"","sources":["../../../src/commands/shared/approval-requirements.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAK5D,MAAM,MAAM,cAAc,GACtB,gBAAgB,GAChB,cAAc,GACd,cAAc,GACd,cAAc,GACd,cAAc,GACd,UAAU,CAAC;AAEf,MAAM,MAAM,mBAAmB,GAAG;IAChC,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAmCF,wBAAgB,uBAAuB,CAAC,IAAI,EAAE;IAC5C,MAAM,EAAE,gBAAgB,CAAC;IACzB,MAAM,EAAE,cAAc,CAAC;CACxB,GAAG,mBAAmB,CAkCtB;AAED,wBAAsB,oBAAoB,CAAC,IAAI,EAAE;IAC/C,MAAM,EAAE,cAAc,CAAC;IACvB,MAAM,EAAE,gBAAgB,CAAC;IACzB,GAAG,EAAE,OAAO,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,GAAG,OAAO,CAAC,IAAI,CAAC,CAsBhB"}
1
+ {"version":3,"file":"approval-requirements.d.ts","sourceRoot":"","sources":["../../../src/commands/shared/approval-requirements.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAE5D,OAAO,KAAK,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AACnF,OAAO,EAAyB,KAAK,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAEnG,MAAM,MAAM,cAAc,GAAG,kBAAkB,CAAC;AAEhD,wBAAgB,uBAAuB,CAAC,IAAI,EAAE;IAC5C,MAAM,EAAE,gBAAgB,CAAC;IACzB,MAAM,EAAE,cAAc,CAAC;CACxB,GAAG,mBAAmB,CAEtB;AAED,wBAAsB,oBAAoB,CAAC,IAAI,EAAE;IAC/C,MAAM,EAAE,cAAc,CAAC;IACvB,MAAM,EAAE,gBAAgB,CAAC;IACzB,GAAG,EAAE,OAAO,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,GAAG,OAAO,CAAC,IAAI,CAAC,CAEhB"}
@@ -1,77 +1,7 @@
1
- import { promptYesNo } from "../../cli/prompts.js";
2
- import { CliError } from "../../shared/errors.js";
3
- function resolveEffectiveApprovals(config) {
4
- const approvals = config.agents?.approvals;
5
- const base = {
6
- require_plan: approvals?.require_plan === true,
7
- require_network: approvals?.require_network === true,
8
- require_verify: approvals?.require_verify === true,
9
- // Backward-compatible with older @agentplaneorg/core typings where require_force is absent.
10
- require_force: approvals?.require_force === true,
11
- };
12
- if (config.execution.profile === "conservative") {
13
- return {
14
- ...base,
15
- require_network: true,
16
- require_force: true,
17
- };
18
- }
19
- return base;
20
- }
1
+ import { createApprovalRuntime } from "../../runtime/approvals/index.js";
21
2
  export function getApprovalRequirements(opts) {
22
- const effectiveApprovals = resolveEffectiveApprovals(opts.config);
23
- switch (opts.action) {
24
- case "network_access": {
25
- const required = effectiveApprovals.require_network === true;
26
- return {
27
- required,
28
- reason: "Network access requires explicit approval",
29
- };
30
- }
31
- case "force_action": {
32
- return {
33
- required: effectiveApprovals.require_force === true,
34
- reason: "Force action requires explicit approval",
35
- };
36
- }
37
- case "policy_write": {
38
- return { required: false, reason: "Policy writes require explicit approval" };
39
- }
40
- case "config_write": {
41
- return { required: false, reason: "Config writes require explicit approval" };
42
- }
43
- case "dangerous_fs": {
44
- return { required: false, reason: "Potentially dangerous file operations require approval" };
45
- }
46
- case "git_push": {
47
- return { required: false, reason: "Git push requires explicit approval" };
48
- }
49
- default: {
50
- const exhaustive = opts.action;
51
- return exhaustive;
52
- }
53
- }
3
+ return createApprovalRuntime({ config: opts.config }).resolve({ action: opts.action });
54
4
  }
55
5
  export async function ensureActionApproved(opts) {
56
- const req = getApprovalRequirements({ config: opts.config, action: opts.action });
57
- if (!req.required)
58
- return;
59
- if (opts.yes)
60
- return;
61
- const interactive = opts.interactive ?? Boolean(process.stdin.isTTY);
62
- if (!interactive) {
63
- throw new CliError({
64
- exitCode: 3,
65
- code: "E_VALIDATION",
66
- message: `${req.reason} (pass --yes): ${opts.reason}`,
67
- });
68
- }
69
- const approved = await promptYesNo(`Allow ${opts.action}? ${opts.reason}`, false);
70
- if (!approved) {
71
- throw new CliError({
72
- exitCode: 3,
73
- code: "E_VALIDATION",
74
- message: `${req.reason} denied: ${opts.reason}`,
75
- });
76
- }
6
+ await createApprovalRuntime({ config: opts.config }).ensure(opts);
77
7
  }
@@ -0,0 +1,16 @@
1
+ export declare const GH_LOOKUP_MAX_ATTEMPTS = 3;
2
+ export declare const GH_LOOKUP_BASE_DELAY_MS = 250;
3
+ export declare function normalizeGhTransportError(err: unknown): string;
4
+ export declare function isTransientGhTransportError(err: unknown): boolean;
5
+ export declare function withGhTransportRetry<T>(operation: () => Promise<T>, opts: {
6
+ label: string;
7
+ maxAttempts?: number;
8
+ baseDelayMs?: number;
9
+ onRetry?: (ctx: {
10
+ attempt: number;
11
+ maxAttempts: number;
12
+ error: unknown;
13
+ label: string;
14
+ }) => void;
15
+ }): Promise<T>;
16
+ //# sourceMappingURL=gh-transport.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gh-transport.d.ts","sourceRoot":"","sources":["../../../src/commands/shared/gh-transport.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,sBAAsB,IAAI,CAAC;AACxC,eAAO,MAAM,uBAAuB,MAAM,CAAC;AA8B3C,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CAU9D;AAED,wBAAgB,2BAA2B,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAIjE;AAOD,wBAAsB,oBAAoB,CAAC,CAAC,EAC1C,SAAS,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EAC3B,IAAI,EAAE;IACJ,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE;QACd,OAAO,EAAE,MAAM,CAAC;QAChB,WAAW,EAAE,MAAM,CAAC;QACpB,KAAK,EAAE,OAAO,CAAC;QACf,KAAK,EAAE,MAAM,CAAC;KACf,KAAK,IAAI,CAAC;CACZ,GACA,OAAO,CAAC,CAAC,CAAC,CAiBZ"}
@@ -0,0 +1,71 @@
1
+ export const GH_LOOKUP_MAX_ATTEMPTS = 3;
2
+ export const GH_LOOKUP_BASE_DELAY_MS = 250;
3
+ const GH_TRANSIENT_ERROR_PATTERNS = [
4
+ /eof\b/i,
5
+ /tls handshake timeout/i,
6
+ /ssl_error_syscall/i,
7
+ /connection reset by peer/i,
8
+ /\beconnreset\b/i,
9
+ /\betimedout\b/i,
10
+ /socket hang up/i,
11
+ /temporary failure in name resolution/i,
12
+ /network is unreachable/i,
13
+ /server closed the connection/i,
14
+ ];
15
+ const GH_PERMANENT_ERROR_PATTERNS = [
16
+ /authentication required/i,
17
+ /not logged into github/i,
18
+ /could not resolve to a pull request/i,
19
+ /graphql: field/i,
20
+ /bad credentials/i,
21
+ /permission denied/i,
22
+ /\b404\b/i,
23
+ /\b422\b/i,
24
+ /\b403\b/i,
25
+ /\b401\b/i,
26
+ /unknown command/i,
27
+ /usage:/i,
28
+ ];
29
+ export function normalizeGhTransportError(err) {
30
+ if (err instanceof Error) {
31
+ const parts = [err.name, err.message];
32
+ const stderr = err.stderr;
33
+ const stdout = err.stdout;
34
+ if (typeof stderr === "string" && stderr.trim())
35
+ parts.push(stderr);
36
+ if (typeof stdout === "string" && stdout.trim())
37
+ parts.push(stdout);
38
+ return parts.filter((part) => part.trim().length > 0).join("\n");
39
+ }
40
+ return String(err);
41
+ }
42
+ export function isTransientGhTransportError(err) {
43
+ const text = normalizeGhTransportError(err);
44
+ if (GH_PERMANENT_ERROR_PATTERNS.some((pattern) => pattern.test(text)))
45
+ return false;
46
+ return GH_TRANSIENT_ERROR_PATTERNS.some((pattern) => pattern.test(text));
47
+ }
48
+ async function sleep(ms) {
49
+ if (ms <= 0)
50
+ return;
51
+ await new Promise((resolve) => setTimeout(resolve, ms));
52
+ }
53
+ export async function withGhTransportRetry(operation, opts) {
54
+ const maxAttempts = opts.maxAttempts ?? GH_LOOKUP_MAX_ATTEMPTS;
55
+ const baseDelayMs = opts.baseDelayMs ?? GH_LOOKUP_BASE_DELAY_MS;
56
+ let lastError = null;
57
+ for (let attempt = 1; attempt <= maxAttempts; attempt += 1) {
58
+ try {
59
+ return await operation();
60
+ }
61
+ catch (error) {
62
+ lastError = error;
63
+ if (!isTransientGhTransportError(error) || attempt === maxAttempts) {
64
+ throw error;
65
+ }
66
+ opts.onRetry?.({ attempt, maxAttempts, error, label: opts.label });
67
+ await sleep(baseDelayMs * attempt);
68
+ }
69
+ }
70
+ throw lastError instanceof Error ? lastError : new Error(String(lastError));
71
+ }
@@ -1,7 +1,9 @@
1
1
  export declare function toGitPath(filePath: string): string;
2
2
  export declare function gitShowFile(cwd: string, ref: string, relPath: string): Promise<string>;
3
3
  export declare function gitDiffNames(cwd: string, base: string, branch: string): Promise<string[]>;
4
- export declare function gitDiffStat(cwd: string, base: string, branch: string): Promise<string>;
4
+ export declare function gitDiffStat(cwd: string, base: string, branch: string, opts?: {
5
+ excludePaths?: string[];
6
+ }): Promise<string>;
5
7
  export declare function gitAheadBehind(cwd: string, base: string, branch: string): Promise<{
6
8
  ahead: number;
7
9
  behind: number;
@@ -1 +1 @@
1
- {"version":3,"file":"git-diff.d.ts","sourceRoot":"","sources":["../../../src/commands/shared/git-diff.ts"],"names":[],"mappings":"AAIA,wBAAgB,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAElD;AAED,wBAAsB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAM5F;AAED,wBAAsB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAS/F;AAED,wBAAsB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAM5F;AAED,wBAAsB,cAAc,CAClC,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,GACb,OAAO,CAAC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAa5C"}
1
+ {"version":3,"file":"git-diff.d.ts","sourceRoot":"","sources":["../../../src/commands/shared/git-diff.ts"],"names":[],"mappings":"AAIA,wBAAgB,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAElD;AAED,wBAAsB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAM5F;AAED,wBAAsB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAS/F;AAED,wBAAsB,WAAW,CAC/B,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,IAAI,CAAC,EAAE;IAAE,YAAY,CAAC,EAAE,MAAM,EAAE,CAAA;CAAE,GACjC,OAAO,CAAC,MAAM,CAAC,CAcjB;AAED,wBAAsB,cAAc,CAClC,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,GACb,OAAO,CAAC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAa5C"}
@@ -20,8 +20,16 @@ export async function gitDiffNames(cwd, base, branch) {
20
20
  .map((line) => line.trim())
21
21
  .filter((line) => line.length > 0);
22
22
  }
23
- export async function gitDiffStat(cwd, base, branch) {
24
- const { stdout } = await execFileAsync("git", ["diff", "--stat", `${base}...${branch}`], {
23
+ export async function gitDiffStat(cwd, base, branch, opts) {
24
+ const args = ["diff", "--stat", `${base}...${branch}`];
25
+ const excludePaths = (opts?.excludePaths ?? [])
26
+ .map((relPath) => relPath.trim())
27
+ .filter((relPath) => relPath.length > 0)
28
+ .map((relPath) => `:(exclude)${toGitPath(relPath)}`);
29
+ if (excludePaths.length > 0) {
30
+ args.push("--", ".", ...excludePaths);
31
+ }
32
+ const { stdout } = await execFileAsync("git", args, {
25
33
  cwd,
26
34
  env: gitEnv(),
27
35
  });
@@ -1,6 +1,7 @@
1
1
  export declare function gitRevParse(cwd: string, args: string[]): Promise<string>;
2
2
  export declare function gitCurrentBranch(cwd: string): Promise<string>;
3
3
  export declare function gitBranchExists(cwd: string, branch: string): Promise<boolean>;
4
+ export declare function gitIsAncestor(cwd: string, maybeAncestor: string, descendant: string): Promise<boolean>;
4
5
  export declare function gitBranchUpstream(cwd: string, branch: string): Promise<string | null>;
5
6
  export declare function gitListBranches(cwd: string): Promise<string[]>;
6
7
  export declare function gitStagedPaths(cwd: string): Promise<string[]>;
@@ -1 +1 @@
1
- {"version":3,"file":"git-ops.d.ts","sourceRoot":"","sources":["../../../src/commands/shared/git-ops.ts"],"names":[],"mappings":"AAMA,wBAAsB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAK9E;AAED,wBAAsB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAwBnE;AAED,wBAAsB,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAYnF;AAED,wBAAsB,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAe3F;AAED,wBAAsB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CASpE;AAED,wBAAsB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CASnE;AAED,wBAAsB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAG7E;AAED,wBAAsB,SAAS,CAC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S,EAAE,OAAO,CAAC;CACpB,GAAG,OAAO,CAAC,IAAI,CAAC,CAwBhB"}
@@ -52,6 +52,21 @@ export async function gitBranchExists(cwd, branch) {
52
52
  throw err;
53
53
  }
54
54
  }
55
+ export async function gitIsAncestor(cwd, maybeAncestor, descendant) {
56
+ try {
57
+ await execFileAsync("git", ["merge-base", "--is-ancestor", maybeAncestor, descendant], {
58
+ cwd,
59
+ env: gitEnv(),
60
+ });
61
+ return true;
62
+ }
63
+ catch (err) {
64
+ const code = err?.code;
65
+ if (code === 1)
66
+ return false;
67
+ throw err;
68
+ }
69
+ }
55
70
  export async function gitBranchUpstream(cwd, branch) {
56
71
  try {
57
72
  const { stdout } = await execFileAsync("git", ["for-each-ref", "--format=%(upstream:short)", `refs/heads/${branch}`], {
@@ -4,5 +4,7 @@ export declare function listWorktrees(cwd: string): Promise<{
4
4
  }[]>;
5
5
  export declare function findWorktreeForBranch(cwd: string, branch: string): Promise<string | null>;
6
6
  export declare function parseTaskIdFromBranch(prefix: string, branch: string): string | null;
7
+ export declare function parseTaskIdFromCloseBranch(branch: string): string | null;
8
+ export declare function gitListBranchesByPrefixes(cwd: string, prefixes: string[]): Promise<string[]>;
7
9
  export declare function gitListTaskBranches(cwd: string, prefix: string): Promise<string[]>;
8
10
  //# sourceMappingURL=git-worktree.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"git-worktree.d.ts","sourceRoot":"","sources":["../../../src/commands/shared/git-worktree.ts"],"names":[],"mappings":"AAEA,wBAAsB,aAAa,CACjC,GAAG,EAAE,MAAM,GACV,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,EAAE,CAAC,CAoBpD;AAED,wBAAsB,qBAAqB,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAQ/F;AAMD,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAMnF;AAED,wBAAsB,mBAAmB,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAUxF"}
1
+ {"version":3,"file":"git-worktree.d.ts","sourceRoot":"","sources":["../../../src/commands/shared/git-worktree.ts"],"names":[],"mappings":"AAEA,wBAAsB,aAAa,CACjC,GAAG,EAAE,MAAM,GACV,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,EAAE,CAAC,CAoBpD;AAED,wBAAsB,qBAAqB,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAQ/F;AAMD,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAMnF;AAED,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAMxE;AAED,wBAAsB,yBAAyB,CAC7C,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,MAAM,EAAE,GACjB,OAAO,CAAC,MAAM,EAAE,CAAC,CAkBnB;AAED,wBAAsB,mBAAmB,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAExF"}
@@ -39,10 +39,30 @@ export function parseTaskIdFromBranch(prefix, branch) {
39
39
  const taskId = rest.split("/", 1)[0];
40
40
  return taskId ? taskId.trim() : null;
41
41
  }
42
- export async function gitListTaskBranches(cwd, prefix) {
43
- const { stdout } = await execFileAsync("git", ["for-each-ref", "--format=%(refname:short)", `refs/heads/${prefix}`], { cwd, env: gitEnv() });
42
+ export function parseTaskIdFromCloseBranch(branch) {
43
+ const normalized = stripBranchRef(branch);
44
+ if (!normalized.startsWith("task-close/"))
45
+ return null;
46
+ const rest = normalized.slice("task-close/".length);
47
+ const taskId = rest.split("/", 1)[0];
48
+ return taskId ? taskId.trim() : null;
49
+ }
50
+ export async function gitListBranchesByPrefixes(cwd, prefixes) {
51
+ const patterns = prefixes
52
+ .map((prefix) => prefix.trim())
53
+ .filter((prefix) => prefix.length > 0)
54
+ .map((prefix) => `refs/heads/${prefix}`);
55
+ if (patterns.length === 0)
56
+ return [];
57
+ const { stdout } = await execFileAsync("git", ["for-each-ref", "--format=%(refname:short)", ...patterns], {
58
+ cwd,
59
+ env: gitEnv(),
60
+ });
44
61
  return stdout
45
62
  .split("\n")
46
63
  .map((line) => line.trim())
47
64
  .filter((line) => line.length > 0);
48
65
  }
66
+ export async function gitListTaskBranches(cwd, prefix) {
67
+ return await gitListBranchesByPrefixes(cwd, [prefix]);
68
+ }
@@ -1,5 +1,7 @@
1
1
  import type { AgentplaneConfig } from "@agentplaneorg/core";
2
+ import type { PolicyActionId } from "../../policy/taxonomy.js";
2
3
  export declare function ensureNetworkApproved(opts: {
4
+ action?: PolicyActionId;
3
5
  config: AgentplaneConfig;
4
6
  yes: boolean;
5
7
  reason: string;
@@ -1 +1 @@
1
- {"version":3,"file":"network-approval.d.ts","sourceRoot":"","sources":["../../../src/commands/shared/network-approval.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAI5D,wBAAsB,qBAAqB,CAAC,IAAI,EAAE;IAChD,MAAM,EAAE,gBAAgB,CAAC;IACzB,GAAG,EAAE,OAAO,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,GAAG,OAAO,CAAC,IAAI,CAAC,CAQhB"}
1
+ {"version":3,"file":"network-approval.d.ts","sourceRoot":"","sources":["../../../src/commands/shared/network-approval.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAE5D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAG/D,wBAAsB,qBAAqB,CAAC,IAAI,EAAE;IAChD,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,MAAM,EAAE,gBAAgB,CAAC;IACzB,GAAG,EAAE,OAAO,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,GAAG,OAAO,CAAC,IAAI,CAAC,CAQhB"}
@@ -1,7 +1,7 @@
1
1
  import { ensureActionApproved } from "./approval-requirements.js";
2
2
  export async function ensureNetworkApproved(opts) {
3
3
  await ensureActionApproved({
4
- action: "network_access",
4
+ action: opts.action ?? "network_access",
5
5
  config: opts.config,
6
6
  yes: opts.yes,
7
7
  reason: opts.reason,
@@ -0,0 +1,9 @@
1
+ import type { CommandContext } from "../shared/task-backend.js";
2
+ export declare function refreshBranchPrArtifactsAfterTaskCommit(opts: {
3
+ ctx: CommandContext;
4
+ cwd: string;
5
+ rootOverride?: string;
6
+ taskId: string;
7
+ quiet: boolean;
8
+ }): Promise<void>;
9
+ //# sourceMappingURL=post-commit-pr-artifacts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"post-commit-pr-artifacts.d.ts","sourceRoot":"","sources":["../../../src/commands/shared/post-commit-pr-artifacts.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAGhE,wBAAsB,uCAAuC,CAAC,IAAI,EAAE;IAClE,GAAG,EAAE,cAAc,CAAC;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,OAAO,CAAC;CAChB,GAAG,OAAO,CAAC,IAAI,CAAC,CAoBhB"}
@@ -0,0 +1,22 @@
1
+ import { warnMessage } from "../../cli/output.js";
2
+ import { normalizeGhTransportError } from "../shared/gh-transport.js";
3
+ import { ensurePrArtifactsSynced } from "../pr/internal/sync.js";
4
+ export async function refreshBranchPrArtifactsAfterTaskCommit(opts) {
5
+ if (opts.ctx.config.workflow_mode !== "branch_pr")
6
+ return;
7
+ try {
8
+ await ensurePrArtifactsSynced({
9
+ ctx: opts.ctx,
10
+ cwd: opts.cwd,
11
+ rootOverride: opts.rootOverride,
12
+ taskId: opts.taskId,
13
+ });
14
+ }
15
+ catch (err) {
16
+ if (opts.quiet)
17
+ return;
18
+ const detail = normalizeGhTransportError(err).trim();
19
+ const suffix = detail ? ` (${detail})` : "";
20
+ process.stderr.write(`${warnMessage(`task commit succeeded but PR artifacts refresh failed for ${opts.taskId}; run \`agentplane pr update ${opts.taskId}\`${suffix}`)}\n`);
21
+ }
22
+ }
@@ -1,5 +1,14 @@
1
1
  import { type TaskPrMeta } from "@agentplaneorg/core";
2
2
  export type PrMeta = TaskPrMeta;
3
+ export type ObservedGithubPrState = {
4
+ prNumber: number;
5
+ prUrl: string | null;
6
+ status: "OPEN" | "CLOSED" | "MERGED";
7
+ mergedAt?: string | null;
8
+ mergeCommit?: string | null;
9
+ base?: string | null;
10
+ headSha?: string | null;
11
+ };
3
12
  export type PrArtifactTextState = {
4
13
  diffstatText: string | null;
5
14
  verifyLogText: string | null;
@@ -13,11 +22,30 @@ export declare function buildOpenedPrMeta(opts: {
13
22
  branch: string;
14
23
  at: string;
15
24
  previousMeta: PrMeta | null;
25
+ base?: string | null;
26
+ headSha?: string | null;
16
27
  }): PrMeta;
17
28
  export declare function buildUpdatedPrMeta(opts: {
18
29
  meta: PrMeta;
19
30
  branch: string;
20
31
  at: string;
32
+ base?: string | null;
33
+ headSha?: string | null;
34
+ }): PrMeta;
35
+ export declare function resolvePrArtifactHeadSha(opts: {
36
+ previousHeadSha?: string | null;
37
+ currentHeadSha?: string | null;
38
+ preservePrevious: boolean;
39
+ }): string | undefined;
40
+ export declare function buildObservedGithubPrMeta(opts: {
41
+ meta: PrMeta;
42
+ observed: ObservedGithubPrState;
43
+ at: string;
44
+ }): PrMeta;
45
+ export declare function buildVerifiedPrMeta(opts: {
46
+ meta: PrMeta;
47
+ at: string;
48
+ state: "pass" | "fail";
21
49
  }): PrMeta;
22
50
  export declare function buildIntegratedPrMeta(opts: {
23
51
  meta: PrMeta;
@@ -37,6 +65,7 @@ export type ShellInvocation = {
37
65
  };
38
66
  export declare function resolveShellInvocation(command: string): ShellInvocation;
39
67
  export declare function parsePrMeta(raw: string, taskId: string): PrMeta;
68
+ export declare function parsePrMetaForwardCompatible(raw: string, taskId: string): PrMeta;
40
69
  export declare function extractLastVerifiedSha(logText: string): string | null;
41
70
  export declare function appendVerifyLog(logPath: string, header: string, content: string): Promise<void>;
42
71
  export declare function runShellCommand(command: string, cwd: string): Promise<{
@@ -1 +1 @@
1
- {"version":3,"file":"pr-meta.d.ts","sourceRoot":"","sources":["../../../src/commands/shared/pr-meta.ts"],"names":[],"mappings":"AAIA,OAAO,EAAsB,KAAK,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAI1E,MAAM,MAAM,MAAM,GAAG,UAAU,CAAC;AAChC,MAAM,MAAM,mBAAmB,GAAG;IAChC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,mBAAmB,GAAG;IAClD,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAOF,wBAAgB,iBAAiB,CAAC,IAAI,EAAE;IACtC,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,EAAE,EAAE,MAAM,CAAC;IACX,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B,GAAG,MAAM,CAYT;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;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