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
@@ -1,12 +1,21 @@
1
1
  import { readFile } from "node:fs/promises";
2
2
  import path from "node:path";
3
3
  import { mapBackendError, mapCoreError } from "../../cli/error-map.js";
4
- import { backendNotSupportedMessage, successMessage } from "../../cli/output.js";
4
+ import { backendNotSupportedMessage, infoMessage, successMessage } from "../../cli/output.js";
5
5
  import { CliError } from "../../shared/errors.js";
6
+ import { writeJsonStableIfChanged } from "../../shared/write-if-changed.js";
7
+ import { collectTaskIncidents, inspectTaskIncidents, renderIncidentCollectionPlanOutcome, } from "../incidents/shared.js";
6
8
  import { ensureReconciledBeforeMutation } from "../shared/reconcile-check.js";
7
9
  import { loadCommandContext } from "../shared/task-backend.js";
8
10
  import { applyTaskMutation } from "../shared/task-mutation.js";
9
- import { decodeEscapedTaskTextNewlines, executeTaskVerificationTransitionRequest, nowIso, } from "./shared.js";
11
+ import { ensurePrArtifactsSynced } from "../pr/internal/sync.js";
12
+ import { resolvePrPaths } from "../pr/internal/pr-paths.js";
13
+ import { buildVerifiedPrMeta, parsePrMeta } from "../shared/pr-meta.js";
14
+ import { buildStructuredFindingMutationPlan } from "./findings.js";
15
+ import { assertVerifyStepsFilled, decodeEscapedTaskTextNewlines, executeTaskVerificationTransitionRequest, extractDocSection, nowIso, } from "./shared.js";
16
+ function normalizeFileBackedVerifyNote(raw) {
17
+ return decodeEscapedTaskTextNewlines(raw).replaceAll(/\s+/gu, " ").trim();
18
+ }
10
19
  async function recordVerificationResult(opts) {
11
20
  const ctx = opts.ctx ??
12
21
  (await loadCommandContext({ cwd: opts.cwd, rootOverride: opts.rootOverride ?? null }));
@@ -26,6 +35,14 @@ async function recordVerificationResult(opts) {
26
35
  ctx,
27
36
  taskId: opts.taskId,
28
37
  build: async (current) => {
38
+ const doc = (typeof current.doc === "string" ? current.doc : "") ||
39
+ (await backend.getTaskDoc(current.id));
40
+ assertVerifyStepsFilled({
41
+ taskId: current.id,
42
+ sectionText: extractDocSection(doc, "Verify Steps"),
43
+ action: "record verification",
44
+ guidance: "fill it before running `agentplane verify ...`",
45
+ });
29
46
  const execution = executeTaskVerificationTransitionRequest({
30
47
  task: current,
31
48
  at,
@@ -33,27 +50,119 @@ async function recordVerificationResult(opts) {
33
50
  note: opts.note,
34
51
  state: opts.state,
35
52
  details: opts.details ?? null,
36
- doc: (typeof current.doc === "string" ? current.doc : "") ||
37
- (await backend.getTaskDoc(current.id)),
53
+ doc,
38
54
  requiredSections: config.tasks.doc.required_sections,
39
55
  });
40
- return { intents: execution.intents };
56
+ const intents = [...execution.intents];
57
+ if (opts.finding) {
58
+ const findingPlan = buildStructuredFindingMutationPlan({
59
+ current,
60
+ config,
61
+ observation: opts.finding.observation,
62
+ impact: opts.finding.impact,
63
+ resolution: opts.finding.resolution,
64
+ promote: !opts.finding.localOnly,
65
+ external: !opts.finding.localOnly,
66
+ fixability: opts.finding.repoFixable ? "repo-fixable" : null,
67
+ incidentScope: opts.finding.incidentScope,
68
+ incidentTags: opts.finding.incidentTags ?? [],
69
+ incidentMatch: opts.finding.incidentMatch ?? [],
70
+ incidentAdvice: opts.finding.incidentAdvice,
71
+ incidentRule: opts.finding.incidentRule,
72
+ });
73
+ if (findingPlan)
74
+ intents.push(...findingPlan.intents);
75
+ }
76
+ return { intents };
41
77
  },
42
78
  });
79
+ if (config.workflow_mode === "branch_pr") {
80
+ const syncResult = await ensurePrArtifactsSynced({
81
+ ctx,
82
+ cwd: opts.cwd,
83
+ rootOverride: opts.rootOverride,
84
+ taskId: opts.taskId,
85
+ author: opts.by,
86
+ });
87
+ if (syncResult) {
88
+ const { metaPath } = await resolvePrPaths({
89
+ ctx,
90
+ cwd: opts.cwd,
91
+ rootOverride: opts.rootOverride,
92
+ taskId: opts.taskId,
93
+ });
94
+ const meta = parsePrMeta(await readFile(metaPath, "utf8"), opts.taskId);
95
+ await writeJsonStableIfChanged(metaPath, buildVerifiedPrMeta({
96
+ meta,
97
+ at,
98
+ state: opts.state === "ok" ? "pass" : "fail",
99
+ }));
100
+ }
101
+ }
102
+ let incidentSummary = null;
103
+ if (opts.collectIncidents === true) {
104
+ const collected = await collectTaskIncidents({
105
+ ctx,
106
+ taskId: opts.taskId,
107
+ write: true,
108
+ });
109
+ incidentSummary = renderIncidentCollectionPlanOutcome(collected.plan, {
110
+ wrote: collected.wrote,
111
+ context: "collect",
112
+ promotedIds: collected.plan.promotable.map((item) => item.entry.id),
113
+ registryPaths: collected.registryPaths,
114
+ taskId: opts.taskId,
115
+ });
116
+ }
117
+ else if (config.workflow_mode === "branch_pr") {
118
+ const inspected = await inspectTaskIncidents({
119
+ ctx,
120
+ taskId: opts.taskId,
121
+ });
122
+ incidentSummary = renderIncidentCollectionPlanOutcome(inspected.plan, {
123
+ wrote: false,
124
+ context: "verify",
125
+ taskId: opts.taskId,
126
+ });
127
+ }
43
128
  if (!opts.quiet) {
129
+ const findingState = opts.finding
130
+ ? opts.finding.localOnly
131
+ ? "task-local"
132
+ : "incident-candidate"
133
+ : null;
44
134
  const readmePath = path.join(resolved.gitRoot, config.paths.workflow_dir, opts.taskId, "README.md");
45
135
  const relReadmePath = path.relative(resolved.gitRoot, readmePath);
46
- process.stdout.write(`${successMessage("verified", opts.taskId, `state=${opts.state} readme=${relReadmePath}`)}\n`);
136
+ const extra = findingState ? ` finding=${findingState}` : "";
137
+ process.stdout.write(`${successMessage("verified", opts.taskId, `state=${opts.state} readme=${relReadmePath}${extra}`)}\n`);
138
+ if (incidentSummary && config.workflow_mode === "branch_pr") {
139
+ process.stdout.write(`${infoMessage(incidentSummary)}\n`);
140
+ }
47
141
  }
48
142
  }
49
143
  async function resolveVerifyRecordInput(opts) {
50
144
  const by = String(opts.by ?? "").trim();
51
- const note = String(opts.note ?? "").trim();
52
- if (!by || !note) {
145
+ const inlineNote = String(opts.note ?? "").trim();
146
+ const noteFile = typeof opts.noteFile === "string" ? opts.noteFile.trim() : "";
147
+ if (!by) {
53
148
  throw new CliError({
54
149
  exitCode: 2,
55
150
  code: "E_USAGE",
56
- message: "Missing required inputs: --by and --note.",
151
+ message: "Missing required input: --by.",
152
+ });
153
+ }
154
+ if (!inlineNote && !noteFile) {
155
+ throw new CliError({
156
+ exitCode: 2,
157
+ code: "E_USAGE",
158
+ message: "Provide exactly one of --note or --note-file.",
159
+ });
160
+ }
161
+ if (inlineNote && noteFile) {
162
+ throw new CliError({
163
+ exitCode: 2,
164
+ code: "E_USAGE",
165
+ message: "Options --note and --note-file are mutually exclusive.",
57
166
  });
58
167
  }
59
168
  if (typeof opts.details === "string" && typeof opts.file === "string") {
@@ -63,6 +172,22 @@ async function resolveVerifyRecordInput(opts) {
63
172
  message: "Options --details and --file are mutually exclusive.",
64
173
  });
65
174
  }
175
+ let note = inlineNote;
176
+ if (noteFile) {
177
+ try {
178
+ note = normalizeFileBackedVerifyNote(await readFile(path.resolve(opts.cwd, noteFile), "utf8"));
179
+ }
180
+ catch (err) {
181
+ throw mapCoreError(err, { command: opts.command, filePath: noteFile });
182
+ }
183
+ }
184
+ if (!note) {
185
+ throw new CliError({
186
+ exitCode: 2,
187
+ code: "E_USAGE",
188
+ message: "Verification note cannot be empty after normalization.",
189
+ });
190
+ }
66
191
  let details = typeof opts.details === "string" ? opts.details : null;
67
192
  if (typeof opts.file === "string") {
68
193
  try {
@@ -89,6 +214,8 @@ async function executeVerifyRecordCommand(opts) {
89
214
  by: input.by,
90
215
  note: input.note,
91
216
  details: input.details,
217
+ finding: opts.finding,
218
+ collectIncidents: opts.collectIncidents,
92
219
  quiet: opts.quiet,
93
220
  });
94
221
  return 0;
@@ -100,15 +227,70 @@ async function executeVerifyRecordCommand(opts) {
100
227
  }
101
228
  }
102
229
  export async function cmdTaskVerifyOk(opts) {
103
- return await executeVerifyRecordCommand({ ...opts, state: "ok", command: "task verify ok" });
230
+ return await executeVerifyRecordCommand({
231
+ ...opts,
232
+ state: "ok",
233
+ command: "task verify ok",
234
+ finding: typeof opts.observation === "string" &&
235
+ typeof opts.impact === "string" &&
236
+ typeof opts.resolution === "string"
237
+ ? {
238
+ observation: opts.observation,
239
+ impact: opts.impact,
240
+ resolution: opts.resolution,
241
+ localOnly: opts.localOnly === true,
242
+ repoFixable: opts.repoFixable === true,
243
+ incidentScope: opts.incidentScope,
244
+ incidentTags: opts.incidentTags ?? [],
245
+ incidentMatch: opts.incidentMatch ?? [],
246
+ incidentAdvice: opts.incidentAdvice,
247
+ incidentRule: opts.incidentRule,
248
+ }
249
+ : null,
250
+ });
104
251
  }
105
252
  export async function cmdTaskVerifyRework(opts) {
106
253
  return await executeVerifyRecordCommand({
107
254
  ...opts,
108
255
  state: "needs_rework",
109
256
  command: "task verify rework",
257
+ finding: typeof opts.observation === "string" &&
258
+ typeof opts.impact === "string" &&
259
+ typeof opts.resolution === "string"
260
+ ? {
261
+ observation: opts.observation,
262
+ impact: opts.impact,
263
+ resolution: opts.resolution,
264
+ localOnly: opts.localOnly === true,
265
+ repoFixable: opts.repoFixable === true,
266
+ incidentScope: opts.incidentScope,
267
+ incidentTags: opts.incidentTags ?? [],
268
+ incidentMatch: opts.incidentMatch ?? [],
269
+ incidentAdvice: opts.incidentAdvice,
270
+ incidentRule: opts.incidentRule,
271
+ }
272
+ : null,
110
273
  });
111
274
  }
112
275
  export async function cmdVerifyParsed(opts) {
113
- return await executeVerifyRecordCommand({ ...opts, command: "verify" });
276
+ return await executeVerifyRecordCommand({
277
+ ...opts,
278
+ command: "verify",
279
+ finding: typeof opts.observation === "string" &&
280
+ typeof opts.impact === "string" &&
281
+ typeof opts.resolution === "string"
282
+ ? {
283
+ observation: opts.observation,
284
+ impact: opts.impact,
285
+ resolution: opts.resolution,
286
+ localOnly: opts.localOnly === true,
287
+ repoFixable: opts.repoFixable === true,
288
+ incidentScope: opts.incidentScope,
289
+ incidentTags: opts.incidentTags ?? [],
290
+ incidentMatch: opts.incidentMatch ?? [],
291
+ incidentAdvice: opts.incidentAdvice,
292
+ incidentRule: opts.incidentRule,
293
+ }
294
+ : null,
295
+ });
114
296
  }
@@ -1 +1 @@
1
- {"version":3,"file":"verify-rework.command.d.ts","sourceRoot":"","sources":["../../../src/commands/task/verify-rework.command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACtE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAGhE,OAAO,EAKL,KAAK,kBAAkB,EACxB,MAAM,4BAA4B,CAAC;AAEpC,MAAM,MAAM,sBAAsB,GAAG,kBAAkB,GAAG;IACxD,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,WAAW,CAAC,sBAAsB,CAwBpE,CAAC;AAEF,wBAAgB,8BAA8B,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,cAAc,CAAC,IAC/E,KAAK,UAAU,EAAE,GAAG,sBAAsB,KAAG,OAAO,CAAC,MAAM,CAAC,CAa3E"}
1
+ {"version":3,"file":"verify-rework.command.d.ts","sourceRoot":"","sources":["../../../src/commands/task/verify-rework.command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACtE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAGhE,OAAO,EAOL,KAAK,kBAAkB,EACxB,MAAM,4BAA4B,CAAC;AAEpC,MAAM,MAAM,sBAAsB,GAAG,kBAAkB,GAAG;IACxD,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,WAAW,CAAC,sBAAsB,CAyBpE,CAAC;AAEF,wBAAgB,8BAA8B,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,cAAc,CAAC,IAC/E,KAAK,UAAU,EAAE,GAAG,sBAAsB,KAAG,OAAO,CAAC,MAAM,CAAC,CAyB3E"}
@@ -1,5 +1,5 @@
1
1
  import { cmdTaskVerifyRework } from "./verify-record.js";
2
- import { parseVerifyCommonOptions, validateVerifyDetailsFileExclusive, validateVerifyNonEmptyInput, verifyCommonOptions, } from "./verify-command-shared.js";
2
+ import { parseVerifyCommonOptions, validateVerifyDetailsFileExclusive, validateVerifyFindingSource, validateVerifyNonEmptyInput, validateVerifyNoteSource, verifyCommonOptions, } from "./verify-command-shared.js";
3
3
  export const taskVerifyReworkSpec = {
4
4
  id: ["task", "verify", "rework"],
5
5
  group: "Task",
@@ -17,7 +17,8 @@ export const taskVerifyReworkSpec = {
17
17
  message: "Provide at most one of --details or --file.",
18
18
  });
19
19
  validateVerifyNonEmptyInput(raw, taskVerifyReworkSpec, "by");
20
- validateVerifyNonEmptyInput(raw, taskVerifyReworkSpec, "note");
20
+ validateVerifyNoteSource(raw, taskVerifyReworkSpec);
21
+ validateVerifyFindingSource(raw, taskVerifyReworkSpec);
21
22
  },
22
23
  parse: (raw) => ({
23
24
  taskId: String(raw.args["task-id"]),
@@ -33,9 +34,21 @@ export function makeRunTaskVerifyReworkHandler(getCtx) {
33
34
  taskId: p.taskId,
34
35
  by: p.by,
35
36
  note: p.note,
37
+ noteFile: p.noteFile,
36
38
  details: p.details,
37
39
  file: p.file,
40
+ collectIncidents: p.collectIncidents,
38
41
  quiet: p.quiet,
42
+ observation: p.observation,
43
+ impact: p.impact,
44
+ resolution: p.resolution,
45
+ localOnly: p.localOnly,
46
+ repoFixable: p.repoFixable,
47
+ incidentScope: p.incidentScope,
48
+ incidentTags: p.incidentTags,
49
+ incidentMatch: p.incidentMatch,
50
+ incidentAdvice: p.incidentAdvice,
51
+ incidentRule: p.incidentRule,
39
52
  });
40
53
  };
41
54
  }
@@ -1,5 +1,5 @@
1
1
  import type { CommandCtx, CommandSpec } from "../../cli/spec/spec.js";
2
- import type { CommandContext } from "../shared/task-backend.js";
2
+ import { type CommandContext } from "../shared/task-backend.js";
3
3
  export type TaskVerifyShowParsed = {
4
4
  taskId: string;
5
5
  quiet: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"verify-show.command.d.ts","sourceRoot":"","sources":["../../../src/commands/task/verify-show.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,oBAAoB,GAAG;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,OAAO,CAAC;CAChB,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,WAAW,CAAC,oBAAoB,CA6BhE,CAAC;AAEF,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,cAAc,CAAC,IAC7E,KAAK,UAAU,EAAE,GAAG,oBAAoB,KAAG,OAAO,CAAC,MAAM,CAAC,CAUzE"}
1
+ {"version":3,"file":"verify-show.command.d.ts","sourceRoot":"","sources":["../../../src/commands/task/verify-show.command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAGtE,OAAO,EAAuB,KAAK,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAKrF,MAAM,MAAM,oBAAoB,GAAG;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,OAAO,CAAC;CAChB,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,WAAW,CAAC,oBAAoB,CA6BhE,CAAC;AAEF,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,cAAc,CAAC,IAC7E,KAAK,UAAU,EAAE,GAAG,oBAAoB,KAAG,OAAO,CAAC,MAAM,CAAC,CAkCzE"}
@@ -1,4 +1,8 @@
1
+ import { backendNotSupportedMessage } from "../../cli/output.js";
2
+ import { CliError } from "../../shared/errors.js";
3
+ import { loadTaskFromContext } from "../shared/task-backend.js";
1
4
  import { cmdTaskDocShow } from "./doc.js";
5
+ import { assertVerifyStepsFilled, extractDocSection, isVerifyStepsFilled } from "./shared.js";
2
6
  export const taskVerifyShowSpec = {
3
7
  id: ["task", "verify-show"],
4
8
  group: "Task",
@@ -30,8 +34,31 @@ export const taskVerifyShowSpec = {
30
34
  };
31
35
  export function makeRunTaskVerifyShowHandler(getCtx) {
32
36
  return async (ctx, p) => {
37
+ const commandCtx = await getCtx("task verify-show");
38
+ const backend = commandCtx.taskBackend;
39
+ if (!backend.getTaskDoc) {
40
+ throw new CliError({
41
+ exitCode: 2,
42
+ code: "E_USAGE",
43
+ message: backendNotSupportedMessage("task docs"),
44
+ });
45
+ }
46
+ const task = await loadTaskFromContext({ ctx: commandCtx, taskId: p.taskId });
47
+ const doc = typeof task.doc === "string" ? task.doc : ((await backend.getTaskDoc(p.taskId)) ?? "");
48
+ const verifySteps = extractDocSection(doc, "Verify Steps");
49
+ if (!p.quiet) {
50
+ assertVerifyStepsFilled({
51
+ taskId: p.taskId,
52
+ sectionText: verifySteps,
53
+ action: "show Verify Steps",
54
+ guidance: "fill it before verification",
55
+ });
56
+ }
57
+ else if (!isVerifyStepsFilled(verifySteps)) {
58
+ return 0;
59
+ }
33
60
  return await cmdTaskDocShow({
34
- ctx: await getCtx("task verify-show"),
61
+ ctx: commandCtx,
35
62
  cwd: ctx.cwd,
36
63
  rootOverride: ctx.rootOverride,
37
64
  taskId: p.taskId,
@@ -1 +1 @@
1
- {"version":3,"file":"upgrade.d.ts","sourceRoot":"","sources":["../../src/commands/upgrade.ts"],"names":[],"mappings":"AAgCA,MAAM,MAAM,YAAY,GAAG;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,IAAI,EAAE,OAAO,GAAG,MAAM,CAAC;IACvB,MAAM,EAAE,OAAO,CAAC;IAChB,YAAY,EAAE,OAAO,CAAC;IACtB,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,OAAO,CAAC;IAChB,eAAe,EAAE,OAAO,CAAC;IACzB,GAAG,EAAE,OAAO,CAAC;CACd,CAAC;AAIF,wBAAsB,gBAAgB,CAAC,IAAI,EAAE;IAC3C,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,YAAY,CAAC;CACrB,GAAG,OAAO,CAAC,MAAM,CAAC,CAoQlB;AAED,OAAO,EACL,kCAAkC,EAClC,qBAAqB,EACrB,iCAAiC,GAClC,MAAM,qBAAqB,CAAC"}
1
+ {"version":3,"file":"upgrade.d.ts","sourceRoot":"","sources":["../../src/commands/upgrade.ts"],"names":[],"mappings":"AAgCA,MAAM,MAAM,YAAY,GAAG;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,IAAI,EAAE,OAAO,GAAG,MAAM,CAAC;IACvB,MAAM,EAAE,OAAO,CAAC;IAChB,YAAY,EAAE,OAAO,CAAC;IACtB,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,OAAO,CAAC;IAChB,eAAe,EAAE,OAAO,CAAC;IACzB,GAAG,EAAE,OAAO,CAAC;CACd,CAAC;AAIF,wBAAsB,gBAAgB,CAAC,IAAI,EAAE;IAC3C,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,YAAY,CAAC;CACrB,GAAG,OAAO,CAAC,MAAM,CAAC,CAyQlB;AAED,OAAO,EACL,kCAAkC,EAClC,qBAAqB,EACrB,iCAAiC,GAClC,MAAM,qBAAqB,CAAC"}
@@ -62,7 +62,12 @@ export async function cmdUpgradeParsed(opts) {
62
62
  const ensureApproved = async (reason) => {
63
63
  if (networkApproved)
64
64
  return;
65
- await ensureNetworkApproved({ config: loaded.config, yes: flags.yes, reason });
65
+ await ensureNetworkApproved({
66
+ action: "upgrade_apply",
67
+ config: loaded.config,
68
+ yes: flags.yes,
69
+ reason,
70
+ });
66
71
  networkApproved = true;
67
72
  };
68
73
  const hasBundle = Boolean(flags.bundle);
@@ -1 +1 @@
1
- {"version":3,"file":"verify.run.d.ts","sourceRoot":"","sources":["../../src/commands/verify.run.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAG/D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAErD,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,cAAc,CAAC,IACrE,KAAK,UAAU,EAAE,GAAG,YAAY,KAAG,OAAO,CAAC,MAAM,CAAC,CAcjE"}
1
+ {"version":3,"file":"verify.run.d.ts","sourceRoot":"","sources":["../../src/commands/verify.run.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAG/D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAErD,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,cAAc,CAAC,IACrE,KAAK,UAAU,EAAE,GAAG,YAAY,KAAG,OAAO,CAAC,MAAM,CAAC,CA0BjE"}
@@ -9,8 +9,20 @@ export function makeRunVerifyHandler(getCtx) {
9
9
  state: p.state,
10
10
  by: p.by,
11
11
  note: p.note,
12
+ noteFile: p.noteFile,
12
13
  details: p.details,
13
14
  file: p.file,
15
+ collectIncidents: p.collectIncidents,
16
+ observation: p.observation,
17
+ impact: p.impact,
18
+ resolution: p.resolution,
19
+ localOnly: p.localOnly,
20
+ repoFixable: p.repoFixable,
21
+ incidentScope: p.incidentScope,
22
+ incidentTags: p.incidentTags,
23
+ incidentMatch: p.incidentMatch,
24
+ incidentAdvice: p.incidentAdvice,
25
+ incidentRule: p.incidentRule,
14
26
  quiet: p.quiet,
15
27
  });
16
28
  };
@@ -1,13 +1,9 @@
1
1
  import type { CommandSpec } from "../cli/spec/spec.js";
2
+ import { type VerifyCommonParsed } from "./task/verify-command-shared.js";
2
3
  type VerifyState = "ok" | "needs_rework";
3
- export type VerifyParsed = {
4
+ export type VerifyParsed = VerifyCommonParsed & {
4
5
  taskId: string;
5
6
  state: VerifyState;
6
- by: string;
7
- note: string;
8
- details?: string;
9
- file?: string;
10
- quiet: boolean;
11
7
  };
12
8
  export declare const verifySpec: CommandSpec<VerifyParsed>;
13
9
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"verify.spec.d.ts","sourceRoot":"","sources":["../../src/commands/verify.spec.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAOvD,KAAK,WAAW,GAAG,IAAI,GAAG,cAAc,CAAC;AAEzC,MAAM,MAAM,YAAY,GAAG;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,WAAW,CAAC;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,OAAO,CAAC;CAChB,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,WAAW,CAAC,YAAY,CAoFhD,CAAC"}
1
+ {"version":3,"file":"verify.spec.d.ts","sourceRoot":"","sources":["../../src/commands/verify.spec.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEvD,OAAO,EACL,KAAK,kBAAkB,EAOxB,MAAM,iCAAiC,CAAC;AAEzC,KAAK,WAAW,GAAG,IAAI,GAAG,cAAc,CAAC;AAEzC,MAAM,MAAM,YAAY,GAAG,kBAAkB,GAAG;IAC9C,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,WAAW,CAAC;CACpB,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,WAAW,CAAC,YAAY,CAiHhD,CAAC"}
@@ -1,9 +1,9 @@
1
1
  import { usageError } from "../cli/spec/errors.js";
2
- import { parseVerifyCommonOptions, validateVerifyDetailsFileExclusive, } from "./task/verify-command-shared.js";
2
+ import { parseVerifyCommonOptions, validateVerifyDetailsFileExclusive, validateVerifyFindingSource, validateVerifyNonEmptyInput, validateVerifyNoteSource, verifyFindingOptions, } from "./task/verify-command-shared.js";
3
3
  export const verifySpec = {
4
4
  id: ["verify"],
5
5
  group: "Lifecycle",
6
- summary: "Record a verification outcome for a task (record-only; does not execute commands).",
6
+ summary: "Record a verification outcome for a task; incident candidates stay task-local unless collected explicitly.",
7
7
  args: [
8
8
  {
9
9
  name: "task-id",
@@ -36,9 +36,14 @@ export const verifySpec = {
36
36
  kind: "string",
37
37
  name: "note",
38
38
  valueHint: "<text>",
39
- required: true,
40
39
  description: "Short note describing the verification outcome.",
41
40
  },
41
+ {
42
+ kind: "string",
43
+ name: "note-file",
44
+ valueHint: "<path>",
45
+ description: "Read the verification note from a file path (mutually exclusive with --note).",
46
+ },
42
47
  {
43
48
  kind: "string",
44
49
  name: "details",
@@ -51,17 +56,36 @@ export const verifySpec = {
51
56
  valueHint: "<path>",
52
57
  description: "Read details from a file path (mutually exclusive with --details).",
53
58
  },
59
+ {
60
+ kind: "boolean",
61
+ name: "collect-incidents",
62
+ default: false,
63
+ description: "After recording verification, collect promotable findings into incidents.md immediately.",
64
+ },
54
65
  { kind: "boolean", name: "quiet", default: false, description: "Suppress output." },
66
+ ...verifyFindingOptions,
55
67
  ],
56
68
  examples: [
57
69
  {
58
70
  cmd: 'agentplane verify 202602030608-F1Q8AB --ok --by REVIEWER --note "Looks good" --quiet',
59
71
  why: "Record an OK verification outcome.",
60
72
  },
73
+ {
74
+ cmd: "agentplane verify 202602030608-F1Q8AB --ok --by REVIEWER --note-file ./verify-note.txt",
75
+ why: "Record an OK verification outcome using a file-backed note.",
76
+ },
61
77
  {
62
78
  cmd: 'agentplane verify 202602030608-F1Q8AB --rework --by REVIEWER --note "Needs changes" --details "Missing tests"',
63
79
  why: "Record a needs-rework outcome with details.",
64
80
  },
81
+ {
82
+ cmd: 'agentplane verify 202602030608-F1Q8AB --ok --by REVIEWER --note "Looks good" --observation "Repeated recovery was manual." --impact "Operators needed a second command." --resolution "Append structured findings during verify."',
83
+ why: "Record verification and append a promotable structured finding in one command.",
84
+ },
85
+ {
86
+ cmd: 'agentplane verify 202602030608-F1Q8AB --ok --by REVIEWER --note "Looks good" --collect-incidents',
87
+ why: "Record verification and collect promotable findings into incidents.md immediately.",
88
+ },
65
89
  ],
66
90
  validateRaw: (raw) => {
67
91
  const ok = raw.opts.ok === true;
@@ -74,6 +98,9 @@ export const verifySpec = {
74
98
  });
75
99
  }
76
100
  validateVerifyDetailsFileExclusive(raw, verifySpec, { command: "verify" });
101
+ validateVerifyNonEmptyInput(raw, verifySpec, "by");
102
+ validateVerifyNoteSource(raw, verifySpec, { command: "verify" });
103
+ validateVerifyFindingSource(raw, verifySpec, { command: "verify" });
77
104
  },
78
105
  parse: (raw) => {
79
106
  const ok = raw.opts.ok === true;
@@ -1,7 +1,9 @@
1
1
  import type { AgentplaneConfig } from "@agentplaneorg/core";
2
+ import { type PolicyActionDescriptor } from "./taxonomy.js";
2
3
  import type { PolicyAction, PolicyContext, PolicyProblem } from "./types.js";
3
4
  export type PolicyDecision = {
4
5
  ok: boolean;
6
+ action: PolicyActionDescriptor;
5
7
  violations: PolicyViolation[];
6
8
  };
7
9
  export type PolicyViolation = {
@@ -10,7 +12,7 @@ export type PolicyViolation = {
10
12
  exitCode: number;
11
13
  message: string;
12
14
  };
13
- export type ActionId = PolicyAction | "task_list" | "task_new" | "upgrade_apply" | "doctor_fix" | (string & {});
15
+ export type ActionId = PolicyAction | (string & {});
14
16
  export type PolicyEngineContext = Omit<PolicyContext, "action"> & {
15
17
  action: ActionId;
16
18
  config: AgentplaneConfig;
@@ -1 +1 @@
1
- {"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../../src/policy/engine.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAG5D,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,aAAa,EAAgB,MAAM,YAAY,CAAC;AAE3F,MAAM,MAAM,cAAc,GAAG;IAC3B,EAAE,EAAE,OAAO,CAAC;IACZ,UAAU,EAAE,eAAe,EAAE,CAAC;CAC/B,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,EAAE,OAAO,GAAG,SAAS,CAAC;IAC3B,IAAI,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,QAAQ,GAChB,YAAY,GACZ,WAAW,GACX,UAAU,GACV,eAAe,GACf,YAAY,GACZ,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;AAElB,MAAM,MAAM,mBAAmB,GAAG,IAAI,CAAC,aAAa,EAAE,QAAQ,CAAC,GAAG;IAChE,MAAM,EAAE,QAAQ,CAAC;IACjB,MAAM,EAAE,gBAAgB,CAAC;CAC1B,CAAC;AAkBF,qBAAa,YAAY;IACvB,QAAQ,CAAC,GAAG,EAAE,mBAAmB,GAAG,cAAc;CAkBnD"}
1
+ {"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../../src/policy/engine.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAG5D,OAAO,EAAiC,KAAK,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAC3F,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,aAAa,EAAgB,MAAM,YAAY,CAAC;AAE3F,MAAM,MAAM,cAAc,GAAG;IAC3B,EAAE,EAAE,OAAO,CAAC;IACZ,MAAM,EAAE,sBAAsB,CAAC;IAC/B,UAAU,EAAE,eAAe,EAAE,CAAC;CAC/B,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,EAAE,OAAO,GAAG,SAAS,CAAC;IAC3B,IAAI,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,QAAQ,GAAG,YAAY,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;AAEpD,MAAM,MAAM,mBAAmB,GAAG,IAAI,CAAC,aAAa,EAAE,QAAQ,CAAC,GAAG;IAChE,MAAM,EAAE,QAAQ,CAAC;IACjB,MAAM,EAAE,gBAAgB,CAAC;CAC1B,CAAC;AAkBF,qBAAa,YAAY;IACvB,QAAQ,CAAC,GAAG,EAAE,mBAAmB,GAAG,cAAc;CAcnD"}
@@ -1,4 +1,5 @@
1
1
  import { evaluatePolicy } from "./evaluate.js";
2
+ import { resolvePolicyActionDescriptor } from "./taxonomy.js";
2
3
  function toViolations(result) {
3
4
  const out = [];
4
5
  for (const err of result.errors) {
@@ -17,16 +18,14 @@ function toViolations(result) {
17
18
  export class PolicyEngine {
18
19
  evaluate(ctx) {
19
20
  const action = ctx.action;
21
+ const descriptor = resolvePolicyActionDescriptor(action);
20
22
  // Delegate existing policy actions to the current rule engine.
21
- if (action === "guard_commit" ||
22
- action === "commit" ||
23
- action === "hook_pre_commit" ||
24
- action === "hook_commit_msg") {
23
+ if (descriptor.enforcement === "git_rules") {
25
24
  const result = evaluatePolicy(ctx);
26
- return { ok: result.ok, violations: toViolations(result) };
25
+ return { ok: result.ok, action: descriptor, violations: toViolations(result) };
27
26
  }
28
27
  // Default: no-op. Usecases should still call into the engine so we can harden
29
28
  // policy coverage incrementally without duplicating checks across commands.
30
- return { ok: true, violations: [] };
29
+ return { ok: true, action: descriptor, violations: [] };
31
30
  }
32
31
  }
@@ -0,0 +1,17 @@
1
+ export type KnownPolicyActionId = "guard_commit" | "commit" | "hook_pre_commit" | "hook_commit_msg" | "network_access" | "force_action" | "policy_write" | "config_write" | "dangerous_fs" | "git_push" | "task_list" | "task_new" | "task_mutation" | "task_status_transition" | "task_start" | "task_block" | "task_set_status" | "task_finish" | "task_plan_set" | "task_plan_approve" | "task_verify" | "task_run" | "scenario_execute" | "recipe_install" | "recipe_list_remote" | "backend_sync" | "backend_migrate_canonical_state" | "backend_inspect" | "upgrade_apply" | "release_apply" | "doctor_fix";
2
+ export type PolicyActionId = KnownPolicyActionId | (string & {});
3
+ export type PolicyActionFamily = "git" | "task" | "runner" | "recipe" | "backend" | "release" | "upgrade" | "workflow" | "network" | "policy" | "config" | "filesystem" | "diagnostics" | "custom";
4
+ export type PolicyApprovalKind = "network_access" | "force_action" | "policy_write" | "config_write" | "dangerous_fs" | "git_push";
5
+ export type PolicyActionDescriptor = {
6
+ id: PolicyActionId;
7
+ family: PolicyActionFamily;
8
+ summary: string;
9
+ mutates_state: boolean;
10
+ risky: boolean;
11
+ destructive: boolean;
12
+ approval: PolicyApprovalKind | null;
13
+ enforcement: "git_rules" | "approval_only" | "none";
14
+ source: "builtin" | "custom";
15
+ };
16
+ export declare function resolvePolicyActionDescriptor(action: PolicyActionId): PolicyActionDescriptor;
17
+ //# sourceMappingURL=taxonomy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"taxonomy.d.ts","sourceRoot":"","sources":["../../src/policy/taxonomy.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,mBAAmB,GAC3B,cAAc,GACd,QAAQ,GACR,iBAAiB,GACjB,iBAAiB,GACjB,gBAAgB,GAChB,cAAc,GACd,cAAc,GACd,cAAc,GACd,cAAc,GACd,UAAU,GACV,WAAW,GACX,UAAU,GACV,eAAe,GACf,wBAAwB,GACxB,YAAY,GACZ,YAAY,GACZ,iBAAiB,GACjB,aAAa,GACb,eAAe,GACf,mBAAmB,GACnB,aAAa,GACb,UAAU,GACV,kBAAkB,GAClB,gBAAgB,GAChB,oBAAoB,GACpB,cAAc,GACd,iCAAiC,GACjC,iBAAiB,GACjB,eAAe,GACf,eAAe,GACf,YAAY,CAAC;AAEjB,MAAM,MAAM,cAAc,GAAG,mBAAmB,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;AAEjE,MAAM,MAAM,kBAAkB,GAC1B,KAAK,GACL,MAAM,GACN,QAAQ,GACR,QAAQ,GACR,SAAS,GACT,SAAS,GACT,SAAS,GACT,UAAU,GACV,SAAS,GACT,QAAQ,GACR,QAAQ,GACR,YAAY,GACZ,aAAa,GACb,QAAQ,CAAC;AAEb,MAAM,MAAM,kBAAkB,GAC1B,gBAAgB,GAChB,cAAc,GACd,cAAc,GACd,cAAc,GACd,cAAc,GACd,UAAU,CAAC;AAEf,MAAM,MAAM,sBAAsB,GAAG;IACnC,EAAE,EAAE,cAAc,CAAC;IACnB,MAAM,EAAE,kBAAkB,CAAC;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,OAAO,CAAC;IACvB,KAAK,EAAE,OAAO,CAAC;IACf,WAAW,EAAE,OAAO,CAAC;IACrB,QAAQ,EAAE,kBAAkB,GAAG,IAAI,CAAC;IACpC,WAAW,EAAE,WAAW,GAAG,eAAe,GAAG,MAAM,CAAC;IACpD,MAAM,EAAE,SAAS,GAAG,QAAQ,CAAC;CAC9B,CAAC;AA8RF,wBAAgB,6BAA6B,CAAC,MAAM,EAAE,cAAc,GAAG,sBAAsB,CAoB5F"}