agentplane 0.3.10 → 0.3.12

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 (271) hide show
  1. package/assets/AGENTS.md +2 -2
  2. package/assets/agents/CODER.json +4 -0
  3. package/assets/agents/CREATOR.json +1 -0
  4. package/assets/agents/DOCS.json +2 -1
  5. package/assets/agents/INTEGRATOR.json +2 -1
  6. package/assets/agents/ORCHESTRATOR.json +2 -0
  7. package/assets/agents/PLANNER.json +3 -1
  8. package/assets/agents/REVIEWER.json +1 -0
  9. package/assets/agents/TESTER.json +2 -2
  10. package/assets/agents/UPDATER.json +1 -0
  11. package/assets/agents/UPGRADER.json +1 -1
  12. package/assets/policy/governance.md +3 -4
  13. package/assets/policy/incidents.md +20 -88
  14. package/assets/policy/workflow.branch_pr.md +1 -1
  15. package/assets/policy/workflow.direct.md +2 -2
  16. package/bin/agentplane.js +114 -4
  17. package/bin/runtime-watch.js +1 -0
  18. package/bin/stale-dist-policy.d.ts +1 -1
  19. package/bin/stale-dist-policy.js +19 -1
  20. package/dist/.build-manifest.json +251 -166
  21. package/dist/cli/bootstrap-guide.d.ts.map +1 -1
  22. package/dist/cli/bootstrap-guide.js +3 -2
  23. package/dist/cli/command-guide.d.ts.map +1 -1
  24. package/dist/cli/command-guide.js +2 -1
  25. package/dist/cli/command-invocations.d.ts.map +1 -1
  26. package/dist/cli/command-invocations.js +4 -1
  27. package/dist/cli/run-cli/command-catalog/core.d.ts +1 -1
  28. package/dist/cli/run-cli/command-catalog/core.d.ts.map +1 -1
  29. package/dist/cli/run-cli/command-catalog/core.js +6 -1
  30. package/dist/cli/run-cli/command-catalog/project.d.ts +1 -1
  31. package/dist/cli/run-cli/command-catalog/project.d.ts.map +1 -1
  32. package/dist/cli/run-cli/command-catalog/project.js +3 -1
  33. package/dist/cli/run-cli/command-catalog/task.d.ts +1 -1
  34. package/dist/cli/run-cli/command-catalog/task.d.ts.map +1 -1
  35. package/dist/cli/run-cli/command-catalog/task.js +10 -0
  36. package/dist/cli/run-cli/command-catalog.d.ts +1 -1
  37. package/dist/cli/run-cli/command-catalog.d.ts.map +1 -1
  38. package/dist/cli/run-cli/commands/core/preflight.d.ts.map +1 -1
  39. package/dist/cli/run-cli/commands/core/preflight.js +44 -1
  40. package/dist/cli/run-cli.test-helpers.d.ts +1 -0
  41. package/dist/cli/run-cli.test-helpers.d.ts.map +1 -1
  42. package/dist/cli/run-cli.test-helpers.js +26 -0
  43. package/dist/commands/branch/cleanup-merged.d.ts +3 -0
  44. package/dist/commands/branch/cleanup-merged.d.ts.map +1 -1
  45. package/dist/commands/branch/cleanup-merged.js +149 -36
  46. package/dist/commands/branch/work-start.d.ts.map +1 -1
  47. package/dist/commands/branch/work-start.js +137 -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 +1 -0
  67. package/dist/commands/guard/impl/commands.d.ts.map +1 -1
  68. package/dist/commands/guard/impl/commands.js +94 -2
  69. package/dist/commands/guard/impl/env.d.ts +1 -0
  70. package/dist/commands/guard/impl/env.d.ts.map +1 -1
  71. package/dist/commands/guard/impl/env.js +1 -0
  72. package/dist/commands/hooks/index.d.ts +1 -1
  73. package/dist/commands/hooks/index.d.ts.map +1 -1
  74. package/dist/commands/hooks/index.js +139 -6
  75. package/dist/commands/incidents/collect.command.d.ts.map +1 -1
  76. package/dist/commands/incidents/collect.command.js +12 -7
  77. package/dist/commands/incidents/incidents.command.js +1 -1
  78. package/dist/commands/incidents/shared.d.ts +34 -0
  79. package/dist/commands/incidents/shared.d.ts.map +1 -1
  80. package/dist/commands/incidents/shared.js +166 -12
  81. package/dist/commands/pr/check.d.ts.map +1 -1
  82. package/dist/commands/pr/check.js +241 -135
  83. package/dist/commands/pr/close-superseded.d.ts +9 -0
  84. package/dist/commands/pr/close-superseded.d.ts.map +1 -0
  85. package/dist/commands/pr/close-superseded.js +129 -0
  86. package/dist/commands/pr/close.d.ts +11 -0
  87. package/dist/commands/pr/close.d.ts.map +1 -0
  88. package/dist/commands/pr/close.js +116 -0
  89. package/dist/commands/pr/index.d.ts +2 -0
  90. package/dist/commands/pr/index.d.ts.map +1 -1
  91. package/dist/commands/pr/index.js +2 -0
  92. package/dist/commands/pr/integrate/artifacts.d.ts +7 -0
  93. package/dist/commands/pr/integrate/artifacts.d.ts.map +1 -1
  94. package/dist/commands/pr/integrate/artifacts.js +66 -1
  95. package/dist/commands/pr/integrate/cmd.d.ts.map +1 -1
  96. package/dist/commands/pr/integrate/cmd.js +43 -2
  97. package/dist/commands/pr/integrate/internal/bootstrap-guidance.d.ts +8 -0
  98. package/dist/commands/pr/integrate/internal/bootstrap-guidance.d.ts.map +1 -0
  99. package/dist/commands/pr/integrate/internal/bootstrap-guidance.js +59 -0
  100. package/dist/commands/pr/integrate/internal/cleanup.d.ts +1 -11
  101. package/dist/commands/pr/integrate/internal/cleanup.d.ts.map +1 -1
  102. package/dist/commands/pr/integrate/internal/cleanup.js +1 -46
  103. package/dist/commands/pr/integrate/internal/finalize.d.ts.map +1 -1
  104. package/dist/commands/pr/integrate/internal/finalize.js +43 -12
  105. package/dist/commands/pr/integrate/internal/github-protection.d.ts +5 -0
  106. package/dist/commands/pr/integrate/internal/github-protection.d.ts.map +1 -0
  107. package/dist/commands/pr/integrate/internal/github-protection.js +13 -0
  108. package/dist/commands/pr/integrate/internal/merge.d.ts.map +1 -1
  109. package/dist/commands/pr/integrate/internal/merge.js +36 -13
  110. package/dist/commands/pr/integrate/internal/post-integrate-bootstrap.d.ts +13 -0
  111. package/dist/commands/pr/integrate/internal/post-integrate-bootstrap.d.ts.map +1 -0
  112. package/dist/commands/pr/integrate/internal/post-integrate-bootstrap.js +25 -0
  113. package/dist/commands/pr/integrate/internal/pre-integrate-bootstrap.d.ts +15 -0
  114. package/dist/commands/pr/integrate/internal/pre-integrate-bootstrap.d.ts.map +1 -0
  115. package/dist/commands/pr/integrate/internal/pre-integrate-bootstrap.js +35 -0
  116. package/dist/commands/pr/integrate/internal/prepare.d.ts +4 -2
  117. package/dist/commands/pr/integrate/internal/prepare.d.ts.map +1 -1
  118. package/dist/commands/pr/integrate/internal/prepare.js +109 -38
  119. package/dist/commands/pr/internal/auto-commit.d.ts +7 -0
  120. package/dist/commands/pr/internal/auto-commit.d.ts.map +1 -0
  121. package/dist/commands/pr/internal/auto-commit.js +64 -0
  122. package/dist/commands/pr/internal/freshness.d.ts +21 -0
  123. package/dist/commands/pr/internal/freshness.d.ts.map +1 -0
  124. package/dist/commands/pr/internal/freshness.js +52 -0
  125. package/dist/commands/pr/internal/gh-api.d.ts +6 -0
  126. package/dist/commands/pr/internal/gh-api.d.ts.map +1 -0
  127. package/dist/commands/pr/internal/gh-api.js +80 -0
  128. package/dist/commands/pr/internal/pr-paths.d.ts +10 -0
  129. package/dist/commands/pr/internal/pr-paths.d.ts.map +1 -1
  130. package/dist/commands/pr/internal/pr-paths.js +10 -0
  131. package/dist/commands/pr/internal/review-template.d.ts.map +1 -1
  132. package/dist/commands/pr/internal/review-template.js +37 -4
  133. package/dist/commands/pr/internal/sync.d.ts +9 -0
  134. package/dist/commands/pr/internal/sync.d.ts.map +1 -1
  135. package/dist/commands/pr/internal/sync.js +531 -124
  136. package/dist/commands/pr/open.d.ts +1 -0
  137. package/dist/commands/pr/open.d.ts.map +1 -1
  138. package/dist/commands/pr/open.js +24 -2
  139. package/dist/commands/pr/pr.command.d.ts +15 -0
  140. package/dist/commands/pr/pr.command.d.ts.map +1 -1
  141. package/dist/commands/pr/pr.command.js +118 -2
  142. package/dist/commands/pr/update.d.ts.map +1 -1
  143. package/dist/commands/pr/update.js +71 -2
  144. package/dist/commands/release/apply.command.d.ts +3 -1
  145. package/dist/commands/release/apply.command.d.ts.map +1 -1
  146. package/dist/commands/release/apply.command.js +356 -34
  147. package/dist/commands/release/apply.mutation.d.ts.map +1 -1
  148. package/dist/commands/release/apply.mutation.js +1 -0
  149. package/dist/commands/release/apply.preflight.d.ts.map +1 -1
  150. package/dist/commands/release/apply.preflight.js +1 -1
  151. package/dist/commands/release/apply.reporting.d.ts +1 -0
  152. package/dist/commands/release/apply.reporting.d.ts.map +1 -1
  153. package/dist/commands/release/apply.reporting.js +12 -8
  154. package/dist/commands/release/apply.types.d.ts +13 -0
  155. package/dist/commands/release/apply.types.d.ts.map +1 -1
  156. package/dist/commands/release/plan.command.d.ts.map +1 -1
  157. package/dist/commands/release/plan.command.js +48 -0
  158. package/dist/commands/shared/gh-transport.d.ts +16 -0
  159. package/dist/commands/shared/gh-transport.d.ts.map +1 -0
  160. package/dist/commands/shared/gh-transport.js +71 -0
  161. package/dist/commands/shared/git-diff.d.ts +3 -1
  162. package/dist/commands/shared/git-diff.d.ts.map +1 -1
  163. package/dist/commands/shared/git-diff.js +10 -2
  164. package/dist/commands/shared/git-ops.d.ts +1 -0
  165. package/dist/commands/shared/git-ops.d.ts.map +1 -1
  166. package/dist/commands/shared/git-ops.js +15 -0
  167. package/dist/commands/shared/git-worktree.d.ts +2 -0
  168. package/dist/commands/shared/git-worktree.d.ts.map +1 -1
  169. package/dist/commands/shared/git-worktree.js +22 -2
  170. package/dist/commands/shared/merged-branch-cleanup.d.ts +12 -0
  171. package/dist/commands/shared/merged-branch-cleanup.d.ts.map +1 -0
  172. package/dist/commands/shared/merged-branch-cleanup.js +46 -0
  173. package/dist/commands/shared/post-commit-pr-artifacts.d.ts +9 -0
  174. package/dist/commands/shared/post-commit-pr-artifacts.d.ts.map +1 -0
  175. package/dist/commands/shared/post-commit-pr-artifacts.js +57 -0
  176. package/dist/commands/shared/pr-meta.d.ts +20 -0
  177. package/dist/commands/shared/pr-meta.d.ts.map +1 -1
  178. package/dist/commands/shared/pr-meta.js +125 -0
  179. package/dist/commands/shared/task-backend.d.ts +7 -0
  180. package/dist/commands/shared/task-backend.d.ts.map +1 -1
  181. package/dist/commands/shared/task-backend.js +71 -27
  182. package/dist/commands/shared/task-local-freshness.d.ts +2 -0
  183. package/dist/commands/shared/task-local-freshness.d.ts.map +1 -1
  184. package/dist/commands/shared/task-local-freshness.js +7 -1
  185. package/dist/commands/task/close-duplicate.d.ts.map +1 -1
  186. package/dist/commands/task/close-duplicate.js +34 -1
  187. package/dist/commands/task/derive.js +1 -1
  188. package/dist/commands/task/doc-template.d.ts.map +1 -1
  189. package/dist/commands/task/doc-template.js +7 -11
  190. package/dist/commands/task/findings-add.command.d.ts +20 -0
  191. package/dist/commands/task/findings-add.command.d.ts.map +1 -0
  192. package/dist/commands/task/findings-add.command.js +165 -0
  193. package/dist/commands/task/findings.command.d.ts +7 -0
  194. package/dist/commands/task/findings.command.d.ts.map +1 -0
  195. package/dist/commands/task/findings.command.js +20 -0
  196. package/dist/commands/task/findings.d.ts +63 -0
  197. package/dist/commands/task/findings.d.ts.map +1 -0
  198. package/dist/commands/task/findings.js +188 -0
  199. package/dist/commands/task/finish-shared.d.ts +2 -0
  200. package/dist/commands/task/finish-shared.d.ts.map +1 -1
  201. package/dist/commands/task/finish-shared.js +56 -1
  202. package/dist/commands/task/finish.d.ts +10 -0
  203. package/dist/commands/task/finish.d.ts.map +1 -1
  204. package/dist/commands/task/finish.js +125 -6
  205. package/dist/commands/task/hosted-close-pr.command.d.ts +11 -0
  206. package/dist/commands/task/hosted-close-pr.command.d.ts.map +1 -0
  207. package/dist/commands/task/hosted-close-pr.command.js +449 -0
  208. package/dist/commands/task/hosted-close.command.d.ts.map +1 -1
  209. package/dist/commands/task/hosted-close.command.js +234 -19
  210. package/dist/commands/task/hosted-merge-sync.d.ts +41 -0
  211. package/dist/commands/task/hosted-merge-sync.d.ts.map +1 -1
  212. package/dist/commands/task/hosted-merge-sync.js +291 -17
  213. package/dist/commands/task/index.d.ts +1 -0
  214. package/dist/commands/task/index.d.ts.map +1 -1
  215. package/dist/commands/task/index.js +1 -0
  216. package/dist/commands/task/new.d.ts +1 -0
  217. package/dist/commands/task/new.d.ts.map +1 -1
  218. package/dist/commands/task/new.js +71 -1
  219. package/dist/commands/task/new.spec.d.ts.map +1 -1
  220. package/dist/commands/task/new.spec.js +7 -0
  221. package/dist/commands/task/normalize.command.d.ts +2 -0
  222. package/dist/commands/task/normalize.command.d.ts.map +1 -1
  223. package/dist/commands/task/normalize.command.js +45 -0
  224. package/dist/commands/task/normalize.d.ts +2 -0
  225. package/dist/commands/task/normalize.d.ts.map +1 -1
  226. package/dist/commands/task/normalize.js +85 -8
  227. package/dist/commands/task/plan.d.ts.map +1 -1
  228. package/dist/commands/task/plan.js +7 -10
  229. package/dist/commands/task/shared/docs.d.ts +6 -0
  230. package/dist/commands/task/shared/docs.d.ts.map +1 -1
  231. package/dist/commands/task/shared/docs.js +14 -0
  232. package/dist/commands/task/shared/transitions.d.ts.map +1 -1
  233. package/dist/commands/task/shared/transitions.js +11 -1
  234. package/dist/commands/task/shared.d.ts +1 -1
  235. package/dist/commands/task/shared.d.ts.map +1 -1
  236. package/dist/commands/task/shared.js +1 -1
  237. package/dist/commands/task/start.d.ts.map +1 -1
  238. package/dist/commands/task/start.js +7 -10
  239. package/dist/commands/task/task.command.d.ts.map +1 -1
  240. package/dist/commands/task/task.command.js +4 -0
  241. package/dist/commands/task/verify-command-shared.d.ts +19 -0
  242. package/dist/commands/task/verify-command-shared.d.ts.map +1 -1
  243. package/dist/commands/task/verify-command-shared.js +152 -1
  244. package/dist/commands/task/verify-ok.command.d.ts.map +1 -1
  245. package/dist/commands/task/verify-ok.command.js +15 -2
  246. package/dist/commands/task/verify-record.d.ts +36 -0
  247. package/dist/commands/task/verify-record.d.ts.map +1 -1
  248. package/dist/commands/task/verify-record.js +166 -11
  249. package/dist/commands/task/verify-rework.command.d.ts.map +1 -1
  250. package/dist/commands/task/verify-rework.command.js +15 -2
  251. package/dist/commands/task/verify-show.command.d.ts +1 -1
  252. package/dist/commands/task/verify-show.command.d.ts.map +1 -1
  253. package/dist/commands/task/verify-show.command.js +28 -1
  254. package/dist/commands/verify.run.d.ts.map +1 -1
  255. package/dist/commands/verify.run.js +12 -0
  256. package/dist/commands/verify.spec.d.ts +2 -6
  257. package/dist/commands/verify.spec.d.ts.map +1 -1
  258. package/dist/commands/verify.spec.js +30 -3
  259. package/dist/runtime/incidents/index.d.ts +1 -1
  260. package/dist/runtime/incidents/index.d.ts.map +1 -1
  261. package/dist/runtime/incidents/resolve.d.ts.map +1 -1
  262. package/dist/runtime/incidents/resolve.js +319 -73
  263. package/dist/runtime/incidents/types.d.ts +14 -2
  264. package/dist/runtime/incidents/types.d.ts.map +1 -1
  265. package/dist/shared/env.d.ts +1 -0
  266. package/dist/shared/env.d.ts.map +1 -1
  267. package/dist/shared/env.js +22 -1
  268. package/dist/shared/protected-paths.d.ts +1 -1
  269. package/dist/shared/protected-paths.d.ts.map +1 -1
  270. package/dist/shared/protected-paths.js +4 -0
  271. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"bootstrap-guide.d.ts","sourceRoot":"","sources":["../../src/cli/bootstrap-guide.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,wBAAwB,4CAA4C,CAAC;AAClF,eAAO,MAAM,+BAA+B,0BAA0B,CA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M,kBAAkB,EAAE,SAAS,gBAAgB,EAgDhD,CAAC;AAEX,wBAAgB,4BAA4B,IAAI,MAAM,CAErD;AAED,wBAAgB,2BAA2B,CAAC,QAAQ,EAAE,SAAS,gBAAgB,EAAE,GAAG,MAAM,EAAE,CAiB3F;AAMD,wBAAgB,kBAAkB,IAAI,MAAM,CA2B3C"}
@@ -58,11 +58,12 @@ export const BOOTSTRAP_SECTIONS = [
58
58
  },
59
59
  {
60
60
  heading: "3. Verification and incident reuse",
61
- summary: "Reuse historical incident advice only through targeted lookup, and validate promotable external incident candidates before `finish`.",
61
+ summary: "Reuse historical incident advice only through targeted lookup, and validate promotable resolved external findings before `finish`.",
62
62
  commands: BOOTSTRAP_VERIFICATION_COMMANDS,
63
63
  notes: [
64
64
  "Use `agentplane incidents advise <task-id>` after `start-ready` when analogous scope or tags might have prior external failure modes.",
65
- "Use `agentplane incidents collect <task-id> --check` before `finish` when task `Findings` contains reusable external `incident-candidate` blocks.",
65
+ 'Use `agentplane task findings add <task-id> --observation "..." --impact "..." --resolution "..."` to append reusable structured Findings blocks without replacing the whole README; promotion is the default unless you pass `--local-only`.',
66
+ "Use `agentplane incidents collect <task-id> --check` before `finish` when task `Findings` contains reusable external `Observation` / `Impact` / `Resolution` blocks. Plain prose in `Findings` stays task-local and does not update `.agentplane/policy/incidents.md`.",
66
67
  "Keep repository-fixable defects task-local; only external or process incidents belong in `.agentplane/policy/incidents.md`.",
67
68
  ],
68
69
  },
@@ -1 +1 @@
1
- {"version":3,"file":"command-guide.d.ts","sourceRoot":"","sources":["../../src/cli/command-guide.ts"],"names":[],"mappings":"AAQA,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3B,O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AAgB,gBAAgB,IAAI,MAAM,CAqCzC"}
@@ -20,6 +20,7 @@ const ROLE_GUIDES = [
20
20
  SHARED_STARTUP_NOTE,
21
21
  '- Create executable tasks with `agentplane task new --title "..." --description "..." --priority med --owner <ROLE> --tag <tag>`.',
22
22
  '- Fill docs with `agentplane task doc set <task-id> --section <name> --text "..."` and set plan text with `agentplane task plan set <task-id> --text "..." --updated-by <ROLE>`.',
23
+ '- Append reusable incident-ready Findings via `agentplane task findings add <task-id> --observation "..." --impact "..." --resolution "..."`; promotion is the default unless `--local-only` is set.',
23
24
  "- Approve plan only after required sections and Verify Steps are ready.",
24
25
  ],
25
26
  },
@@ -48,7 +49,7 @@ const ROLE_GUIDES = [
48
49
  role: "DOCS",
49
50
  lines: [
50
51
  SHARED_STARTUP_NOTE,
51
- '- Keep task docs and user docs aligned with runtime behavior via `agentplane task doc set <task-id> --section <name> --text "..."`.',
52
+ '- Keep task docs and user docs aligned with runtime behavior via `agentplane task doc set <task-id> --section <name> --text "..."`; use `task findings add` for append-only incident-ready Findings blocks.',
52
53
  "- For implementation tasks, verify generated/help surfaces after changing CLI-facing text.",
53
54
  "- The docs site may expand CLI behavior, but installed runtime guidance must stay self-contained and must not depend on repo-only docs paths.",
54
55
  ],
@@ -1 +1 @@
1
- {"version":3,"file":"command-invocations.d.ts","sourceRoot":"","sources":["../../src/cli/command-invocations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AA+BhD,wBAAgB,6BAA6B,CAAC,EAAE,EAAE,SAAS,GAAG,MAAM,GAAG,IAAI,CAE1E;AAED,wBAAgB,iCAAiC,CAAC,EAAE,EAAE,SAAS,GAAG,MAAM,CAMvE"}
1
+ {"version":3,"file":"command-invocations.d.ts","sourceRoot":"","sources":["../../src/cli/command-invocations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAkChD,wBAAgB,6BAA6B,CAAC,EAAE,EAAE,SAAS,GAAG,MAAM,GAAG,IAAI,CAE1E;AAED,wBAAgB,iCAAiC,CAAC,EAAE,EAAE,SAAS,GAAG,MAAM,CAMvE"}
@@ -20,7 +20,10 @@ const COMMAND_INVOCATIONS = new Map([
20
20
  ["task show", "agentplane task show <task-id>"],
21
21
  ["task start-ready", 'agentplane task start-ready <task-id> --author <ROLE> --body "Start: ..."'],
22
22
  ["task verify-show", "agentplane task verify-show <task-id>"],
23
- ["verify", 'agentplane verify <task-id> --ok|--rework --by <ROLE> --note "..."'],
23
+ [
24
+ "verify",
25
+ 'agentplane verify <task-id> --ok|--rework --by <ROLE> --note "..." [--observation "..." --impact "..." --resolution "..."] [--local-only]',
26
+ ],
24
27
  ]);
25
28
  function formatCommandId(id) {
26
29
  return id.join(" ");
@@ -1,3 +1,3 @@
1
1
  import { type CommandEntry } from "./shared.js";
2
- export declare const CORE_COMMANDS: readonly [CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry];
2
+ export declare const CORE_COMMANDS: readonly [CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry];
3
3
  //# sourceMappingURL=core.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../../../src/cli/run-cli/command-catalog/core.ts"],"names":[],"mappings":"AAgCA,OAAO,EAAS,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AAEvD,eAAO,MAAM,aAAa,qYAiOkB,CAAC"}
1
+ {"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../../../src/cli/run-cli/command-catalog/core.ts"],"names":[],"mappings":"AAgCA,OAAO,EAAS,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AAEvD,eAAO,MAAM,aAAa,mZA0OkB,CAAC"}
@@ -8,7 +8,7 @@ import { workflowRestoreSpec } from "../../../commands/workflow-restore.command.
8
8
  import { incidentsAdviseSpec } from "../../../commands/incidents/advise.command.js";
9
9
  import { incidentsCollectSpec } from "../../../commands/incidents/collect.command.js";
10
10
  import { incidentsSpec } from "../../../commands/incidents/incidents.command.js";
11
- import { releaseApplySpec } from "../../../commands/release/apply.command.js";
11
+ import { releaseApplySpec, releaseCandidateSpec } from "../../../commands/release/apply.command.js";
12
12
  import { releasePlanSpec } from "../../../commands/release/plan.command.js";
13
13
  import { releaseSpec } from "../../../commands/release/release.command.js";
14
14
  import { configSetSpec, configShowSpec, modeGetSpec, modeSetSpec, profileSetSpec, } from "../commands/config.js";
@@ -47,6 +47,11 @@ export const CORE_COMMANDS = [
47
47
  needsLoadedConfig: false,
48
48
  needsTaskContext: false,
49
49
  }),
50
+ entry(releaseCandidateSpec, () => import("../../../commands/release/apply.command.js").then((m) => m.runReleaseCandidate), {
51
+ needsProject: true,
52
+ needsLoadedConfig: false,
53
+ needsTaskContext: false,
54
+ }),
50
55
  entry(quickstartSpec, () => import("../commands/core/quickstart.js").then((m) => m.runQuickstart), {
51
56
  needsProject: false,
52
57
  needsLoadedConfig: false,
@@ -1,3 +1,3 @@
1
1
  import { type CommandEntry } from "./shared.js";
2
- export declare const PROJECT_COMMANDS: readonly [CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry];
2
+ export declare const PROJECT_COMMANDS: readonly [CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry];
3
3
  //# sourceMappingURL=project.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"project.d.ts","sourceRoot":"","sources":["../../../../src/cli/run-cli/command-catalog/project.ts"],"names":[],"mappings":"AAwCA,OAAO,EAAS,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AAEvD,eAAO,MAAM,gBAAgB,ydAsJe,CAAC"}
1
+ {"version":3,"file":"project.d.ts","sourceRoot":"","sources":["../../../../src/cli/run-cli/command-catalog/project.ts"],"names":[],"mappings":"AA0CA,OAAO,EAAS,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AAEvD,eAAO,MAAM,gBAAgB,qfA8Je,CAAC"}
@@ -5,7 +5,7 @@ import { branchRemoveSpec } from "../../../commands/branch/remove.command.js";
5
5
  import { branchStatusSpec } from "../../../commands/branch/status.command.js";
6
6
  import { workStartSpec } from "../../../commands/branch/work-start.command.js";
7
7
  import { integrateSpec } from "../../../commands/integrate.command.js";
8
- import { prCheckSpec, prNoteSpec, prOpenSpec, prSpec, prUpdateSpec, } from "../../../commands/pr/pr.command.js";
8
+ import { prCheckSpec, prCloseSpec, prCloseSupersededSpec, prNoteSpec, prOpenSpec, prSpec, prUpdateSpec, } from "../../../commands/pr/pr.command.js";
9
9
  import { recipesCachePruneSpec } from "../../../commands/recipes/cache-prune.command.js";
10
10
  import { recipesCacheSpec } from "../../../commands/recipes/cache.command.js";
11
11
  import { recipesExplainSpec } from "../../../commands/recipes/explain.command.js";
@@ -77,6 +77,8 @@ export const PROJECT_COMMANDS = [
77
77
  entry(prOpenSpec, (deps) => import("../../../commands/pr/pr.command.js").then((m) => m.makeRunPrOpenHandler(deps.getCtx))),
78
78
  entry(prUpdateSpec, (deps) => import("../../../commands/pr/pr.command.js").then((m) => m.makeRunPrUpdateHandler(deps.getCtx))),
79
79
  entry(prCheckSpec, (deps) => import("../../../commands/pr/pr.command.js").then((m) => m.makeRunPrCheckHandler(deps.getCtx))),
80
+ entry(prCloseSpec, (deps) => import("../../../commands/pr/pr.command.js").then((m) => m.makeRunPrCloseHandler(deps.getCtx))),
81
+ entry(prCloseSupersededSpec, (deps) => import("../../../commands/pr/pr.command.js").then((m) => m.makeRunPrCloseSupersededHandler(deps.getCtx))),
80
82
  entry(prNoteSpec, (deps) => import("../../../commands/pr/pr.command.js").then((m) => m.makeRunPrNoteHandler(deps.getCtx))),
81
83
  entry(integrateSpec, (deps) => import("../../../commands/integrate.command.js").then((m) => m.makeRunIntegrateHandler(deps.getCtx))),
82
84
  ];
@@ -1,3 +1,3 @@
1
1
  import { type CommandEntry } from "./shared.js";
2
- export declare const TASK_COMMANDS: readonly [CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry];
2
+ export declare const TASK_COMMANDS: readonly [CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry];
3
3
  //# sourceMappingURL=task.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"task.d.ts","sourceRoot":"","sources":["../../../../src/cli/run-cli/command-catalog/task.ts"],"names":[],"mappings":"AAgDA,OAAO,EAAS,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AAEvD,eAAO,MAAM,aAAa,+oBAoPkB,CAAC"}
1
+ {"version":3,"file":"task.d.ts","sourceRoot":"","sources":["../../../../src/cli/run-cli/command-catalog/task.ts"],"names":[],"mappings":"AAmDA,OAAO,EAAS,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AAEvD,eAAO,MAAM,aAAa,yrBAuQkB,CAAC"}
@@ -3,6 +3,8 @@ import { taskCloseDuplicateSpec } from "../../../commands/task/close-duplicate.c
3
3
  import { taskCloseNoopSpec } from "../../../commands/task/close-noop.command.js";
4
4
  import { taskCommentSpec } from "../../../commands/task/comment.command.js";
5
5
  import { taskDeriveSpec } from "../../../commands/task/derive.command.js";
6
+ import { taskFindingsAddSpec } from "../../../commands/task/findings-add.command.js";
7
+ import { taskFindingsSpec } from "../../../commands/task/findings.command.js";
6
8
  import { taskDocSetSpec } from "../../../commands/task/doc-set.command.js";
7
9
  import { taskDocShowSpec } from "../../../commands/task/doc-show.command.js";
8
10
  import { taskDocSpec } from "../../../commands/task/doc.command.js";
@@ -11,6 +13,7 @@ import { taskHandoffRecordSpec } from "../../../commands/task/handoff-record.com
11
13
  import { taskHandoffShowSpec } from "../../../commands/task/handoff-show.command.js";
12
14
  import { taskHandoffSpec } from "../../../commands/task/handoff.command.js";
13
15
  import { taskHostedCloseSpec } from "../../../commands/task/hosted-close.command.js";
16
+ import { taskHostedClosePrSpec } from "../../../commands/task/hosted-close-pr.command.js";
14
17
  import { taskLintSpec } from "../../../commands/task/lint.command.js";
15
18
  import { taskListSpec } from "../../../commands/task/list.spec.js";
16
19
  import { taskMigrateDocSpec } from "../../../commands/task/migrate-doc.command.js";
@@ -60,6 +63,7 @@ export const TASK_COMMANDS = [
60
63
  entry(taskHandoffRecordSpec, () => import("../../../commands/task/handoff-record.command.js").then((m) => m.runTaskHandoffRecord)),
61
64
  entry(taskHandoffShowSpec, () => import("../../../commands/task/handoff-show.command.js").then((m) => m.runTaskHandoffShow)),
62
65
  entry(taskHostedCloseSpec, (deps) => import("../../../commands/task/hosted-close.command.js").then((m) => m.makeRunTaskHostedCloseHandler(deps.getCtx))),
66
+ entry(taskHostedClosePrSpec, (deps) => import("../../../commands/task/hosted-close-pr.command.js").then((m) => m.makeRunTaskHostedClosePrHandler(deps.getCtx))),
63
67
  entry(taskListSpec, (deps) => import("../../../commands/task/list.run.js").then((m) => m.makeRunTaskListHandler(deps.getCtx)), { invocation: requireCanonicalCommandInvocation(["task", "list"]) }),
64
68
  entry(taskNextSpec, (deps) => import("../../../commands/task/next.run.js").then((m) => m.makeRunTaskNextHandler(deps.getCtx))),
65
69
  entry(taskSearchSpec, (deps) => import("../../../commands/task/search.run.js").then((m) => m.makeRunTaskSearchHandler(deps.getCtx))),
@@ -84,6 +88,12 @@ export const TASK_COMMANDS = [
84
88
  entry(taskUpdateSpec, (deps) => import("../../../commands/task/update.command.js").then((m) => m.makeRunTaskUpdateHandler(deps.getCtx))),
85
89
  entry(taskCommentSpec, (deps) => import("../../../commands/task/comment.command.js").then((m) => m.makeRunTaskCommentHandler(deps.getCtx))),
86
90
  entry(taskSetStatusSpec, (deps) => import("../../../commands/task/set-status.command.js").then((m) => m.makeRunTaskSetStatusHandler(deps.getCtx))),
91
+ entry(taskFindingsSpec, () => import("../../../commands/task/findings.command.js").then((m) => m.runTaskFindings), {
92
+ needsProject: false,
93
+ needsLoadedConfig: false,
94
+ needsTaskContext: false,
95
+ }),
96
+ entry(taskFindingsAddSpec, (deps) => import("../../../commands/task/findings-add.command.js").then((m) => m.makeRunTaskFindingsAddHandler(deps.getCtx))),
87
97
  entry(taskDocSpec, () => import("../../../commands/task/doc.command.js").then((m) => m.runTaskDoc), {
88
98
  needsProject: false,
89
99
  needsLoadedConfig: false,
@@ -1,7 +1,7 @@
1
1
  import type { CommandId } from "../spec/spec.js";
2
2
  import type { CommandEntry } from "./command-catalog/shared.js";
3
3
  export type { CommandEntry, RunDeps } from "./command-catalog/shared.js";
4
- export declare const COMMANDS: readonly [CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry];
4
+ export declare const COMMANDS: readonly [CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry];
5
5
  export type CatalogMatch = {
6
6
  entry: (typeof COMMANDS)[number];
7
7
  consumed: number;
@@ -1 +1 @@
1
- {"version":3,"file":"command-catalog.d.ts","sourceRoot":"","sources":["../../../src/cli/run-cli/command-catalog.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAOhE,YAAY,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAEzE,eAAO,MAAM,QAAQ,qsDAKuB,CAAC;AAE7C,MAAM,MAAM,YAAY,GAAG;IAAE,KAAK,EAAE,CAAC,OAAO,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC;AAYlF,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,GAAG,YAAY,GAAG,IAAI,CAGlF;AAED,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,SAAS,GAAG,YAAY,GAAG,IAAI,CAEnE;AAED,wBAAgB,4BAA4B,CAAC,QAAQ,GAAE,SAAc,GAAG,SAAS,YAAY,EAAE,CAE9F;AAED,wBAAgB,0BAA0B,CAAC,QAAQ,GAAE,SAAc,GAAG,SAAS,MAAM,EAAE,CAEtF;AAED,wBAAgB,oBAAoB,CAAC,EAAE,EAAE,SAAS,GAAG,MAAM,CAM1D"}
1
+ {"version":3,"file":"command-catalog.d.ts","sourceRoot":"","sources":["../../../src/cli/run-cli/command-catalog.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAOhE,YAAY,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAEzE,eAAO,MAAM,QAAQ,yxDAKuB,CAAC;AAE7C,MAAM,MAAM,YAAY,GAAG;IAAE,KAAK,EAAE,CAAC,OAAO,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC;AAYlF,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,GAAG,YAAY,GAAG,IAAI,CAGlF;AAED,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,SAAS,GAAG,YAAY,GAAG,IAAI,CAEnE;AAED,wBAAgB,4BAA4B,CAAC,QAAQ,GAAE,SAAc,GAAG,SAAS,YAAY,EAAE,CAE9F;AAED,wBAAgB,0BAA0B,CAAC,QAAQ,GAAE,SAAc,GAAG,SAAS,MAAM,EAAE,CAEtF;AAED,wBAAgB,oBAAoB,CAAC,EAAE,EAAE,SAAS,GAAG,MAAM,CAM1D"}
@@ -1 +1 @@
1
- {"version":3,"file":"preflight.d.ts","sourceRoot":"","sources":["../../../../../src/cli/run-cli/commands/core/preflight.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAMzE,KAAK,aAAa,GAAG,OAAO,GAAG,MAAM,CAAC;AACtC,KAAK,eAAe,GAAG;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,aAAa,CAAA;CAAE,CAAC;AAyO9D,eAAO,MAAM,aAAa,EAAE,WAAW,CAAC,eAAe,CAuCtD,CAAC;AAoDF,eAAO,MAAM,YAAY,EAAE,cAAc,CAAC,eAAe,CAOxD,CAAC"}
1
+ {"version":3,"file":"preflight.d.ts","sourceRoot":"","sources":["../../../../../src/cli/run-cli/commands/core/preflight.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAMzE,KAAK,aAAa,GAAG,OAAO,GAAG,MAAM,CAAC;AACtC,KAAK,eAAe,GAAG;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,aAAa,CAAA;CAAE,CAAC;AA8R9D,eAAO,MAAM,aAAa,EAAE,WAAW,CAAC,eAAe,CAuCtD,CAAC;AAqDF,eAAO,MAAM,YAAY,EAAE,cAAc,CAAC,eAAe,CAOxD,CAAC"}
@@ -43,6 +43,30 @@ function inferApprovals(config) {
43
43
  require_network: approvals.require_network,
44
44
  };
45
45
  }
46
+ function normalizeRepoPath(value) {
47
+ return value.replaceAll("\\", "/");
48
+ }
49
+ function detectTaskArtifactDrift(opts) {
50
+ const workflowDir = normalizeRepoPath(opts.workflowDir).replace(/\/+$/, "");
51
+ const prefix = `${workflowDir}/`;
52
+ const matched = opts.changedPaths
53
+ .map((value) => normalizeRepoPath(value))
54
+ .filter((value) => value.startsWith(prefix))
55
+ .toSorted((a, b) => a.localeCompare(b));
56
+ const taskIds = new Set();
57
+ for (const matchedPath of matched) {
58
+ const relative = matchedPath.slice(prefix.length);
59
+ const [taskId] = relative.split("/", 1);
60
+ if (taskId && taskId !== "." && taskId !== "..") {
61
+ taskIds.add(taskId);
62
+ }
63
+ }
64
+ return {
65
+ present: matched.length > 0,
66
+ task_ids: [...taskIds].toSorted((a, b) => a.localeCompare(b)),
67
+ paths: matched,
68
+ };
69
+ }
46
70
  async function buildPreflightReport(opts) {
47
71
  const nextActions = [];
48
72
  const harnessHealthReasons = [];
@@ -145,6 +169,11 @@ async function buildPreflightReport(opts) {
145
169
  ok: false,
146
170
  error: "project not resolved",
147
171
  };
172
+ let taskArtifactDrift = {
173
+ present: false,
174
+ task_ids: [],
175
+ paths: [],
176
+ };
148
177
  let branch = {
149
178
  ok: false,
150
179
  error: "project not resolved",
@@ -152,10 +181,15 @@ async function buildPreflightReport(opts) {
152
181
  if (resolved) {
153
182
  try {
154
183
  const git = new GitContext({ gitRoot: resolved.gitRoot });
155
- const [staged, unstagedTracked] = await Promise.all([
184
+ const [changed, staged, unstagedTracked] = await Promise.all([
185
+ git.statusChangedPaths(),
156
186
  git.statusStagedPaths(),
157
187
  git.statusUnstagedTrackedPaths(),
158
188
  ]);
189
+ taskArtifactDrift = detectTaskArtifactDrift({
190
+ changedPaths: changed,
191
+ workflowDir: config?.paths.workflow_dir ?? ".agentplane/tasks",
192
+ });
159
193
  workingTree = { ok: true, value: staged.length === 0 && unstagedTracked.length === 0 };
160
194
  if (!workingTree.value) {
161
195
  harnessHealthReasons.push("working_tree_dirty");
@@ -164,6 +198,13 @@ async function buildPreflightReport(opts) {
164
198
  reason: "tracked changes detected",
165
199
  });
166
200
  }
201
+ if (taskArtifactDrift.present) {
202
+ harnessHealthReasons.push("task_artifact_drift");
203
+ nextActions.push({
204
+ command: `git status --short --untracked-files=all -- ${config?.paths.workflow_dir ?? ".agentplane/tasks"}`,
205
+ reason: `task artifact drift detected for ${taskArtifactDrift.task_ids.join(", ")}`,
206
+ });
207
+ }
167
208
  }
168
209
  catch (err) {
169
210
  const message = compactError(err);
@@ -189,6 +230,7 @@ async function buildPreflightReport(opts) {
189
230
  workflow_loaded: workflowLoaded,
190
231
  task_list_loaded: taskListLoaded,
191
232
  working_tree_clean_tracked: workingTree,
233
+ task_artifact_drift: taskArtifactDrift,
192
234
  current_branch: branch,
193
235
  workflow_mode: inferWorkflowMode(config),
194
236
  approvals: inferApprovals(config),
@@ -258,6 +300,7 @@ async function cmdPreflight(opts) {
258
300
  `- workflow loaded: ${probeYesNo(report.workflow_loaded)}`,
259
301
  `- task list loaded: ${probeYesNo(report.task_list_loaded)}`,
260
302
  `- working tree clean (tracked-only): ${probeValueOrUnknown(report.working_tree_clean_tracked)}`,
303
+ `- task artifact drift: ${report.task_artifact_drift.present ? report.task_artifact_drift.task_ids.join(", ") : "none"}`,
261
304
  `- current git branch: ${probeValueOrUnknown(report.current_branch)}`,
262
305
  `- workflow_mode: ${report.workflow_mode}`,
263
306
  `- harness engeneering health: ${report.harness_health.status}`,
@@ -70,5 +70,6 @@ export declare function cleanGitEnv(): NodeJS.ProcessEnv;
70
70
  export declare function pathExists(filePath: string): Promise<boolean>;
71
71
  export declare function gitBranchExists(root: string, branch: string): Promise<boolean>;
72
72
  export declare function commitAll(root: string, message: string): Promise<void>;
73
+ export declare function commitPathsIfChanged(root: string, paths: string[], message: string): Promise<boolean>;
73
74
  export declare function stageGitignoreIfPresent(root: string): Promise<void>;
74
75
  //# sourceMappingURL=run-cli.test-helpers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"run-cli.test-helpers.d.ts","sourceRoot":"","sources":["../../src/cli/run-cli.test-helpers.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAsD/D,wBAAgB,sBAAsB,IAAI,IAAI,CAuD7C;AAED,wBAAgB,+BAA+B,IAAI,IAAI,CAYtD;AAED,wBAAgB,iBAAiB,IAAI,MAAM,GAAG,IAAI,CAEjD;AAED,wBAAgB,YAAY;;;;EAgC3B;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC9B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,EAAE,CAAC,EAAE,OAAO,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB,CAAC;AAEF,wBAAgB,gBAAgB,CAAC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AAM,CAAC,UAAU,CAgB/C;AAED,wBAAsB,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAOnE;AAED,wBAAsB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAYpF;AAED,wBAAsB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAM5E;AAED,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EAAE,EACf,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,OAAO,CAAC,CAgBlB;AAED,wBAAsB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAIzE"}
@@ -274,6 +274,18 @@ export async function approveTaskPlan(root, taskId) {
274
274
  ]);
275
275
  }
276
276
  export async function recordVerificationOk(root, taskId) {
277
+ await runCliSilent([
278
+ "task",
279
+ "doc",
280
+ "set",
281
+ taskId,
282
+ "--section",
283
+ "Verify Steps",
284
+ "--text",
285
+ "Run verify for this task. Expected: verification records successfully.",
286
+ "--root",
287
+ root,
288
+ ]);
277
289
  await runCliSilent([
278
290
  "verify",
279
291
  taskId,
@@ -732,6 +744,20 @@ export async function commitAll(root, message) {
732
744
  env: cleanGitEnv(),
733
745
  });
734
746
  }
747
+ export async function commitPathsIfChanged(root, paths, message) {
748
+ await execFileAsync("git", ["add", "--", ...paths], { cwd: root, env: cleanGitEnv() });
749
+ const { stdout } = await execFileAsync("git", ["diff", "--cached", "--name-only", "--", ...paths], {
750
+ cwd: root,
751
+ env: cleanGitEnv(),
752
+ });
753
+ if (!stdout.trim())
754
+ return false;
755
+ await execFileAsync("git", ["commit", "--no-verify", "-m", message], {
756
+ cwd: root,
757
+ env: cleanGitEnv(),
758
+ });
759
+ return true;
760
+ }
735
761
  export async function stageGitignoreIfPresent(root) {
736
762
  const gitignorePath = path.join(root, ".gitignore");
737
763
  if (!(await pathExists(gitignorePath)))
@@ -6,6 +6,9 @@ export declare function cmdCleanupMerged(opts: {
6
6
  base?: string;
7
7
  yes: boolean;
8
8
  archive: boolean;
9
+ deleteRemoteBranches: boolean;
10
+ fetch: boolean;
9
11
  quiet: boolean;
12
+ skipUnsafeWorktrees?: boolean;
10
13
  }): Promise<number>;
11
14
  //# sourceMappingURL=cleanup-merged.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cleanup-merged.d.ts","sourceRoot":"","sources":["../../../src/commands/branch/cleanup-merged.ts"],"names":[],"mappings":"AAiBA,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,2BAA2B,CAAC;AAKnC,wBAAsB,gBAAgB,CAAC,IAAI,EAAE;IAC3C,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,OAAO,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,OAAO,CAAC;CAChB,GAAG,OAAO,CAAC,MAAM,CAAC,CAsIlB"}
1
+ {"version":3,"file":"cleanup-merged.d.ts","sourceRoot":"","sources":["../../../src/commands/branch/cleanup-merged.ts"],"names":[],"mappings":"AAqBA,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,2BAA2B,CAAC;AAgInC,wBAAsB,gBAAgB,CAAC,IAAI,EAAE;IAC3C,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,OAAO,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,oBAAoB,EAAE,OAAO,CAAC;IAC9B,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,EAAE,OAAO,CAAC;IACf,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B,GAAG,OAAO,CAAC,MAAM,CAAC,CA8JlB"}
@@ -1,3 +1,4 @@
1
+ import { readFile } from "node:fs/promises";
1
2
  import path from "node:path";
2
3
  import { resolveBaseBranch } from "@agentplaneorg/core";
3
4
  import { mapBackendError } from "../../cli/error-map.js";
@@ -6,12 +7,109 @@ import { CliError } from "../../shared/errors.js";
6
7
  import { ensureGitClean } from "../guard/index.js";
7
8
  import { execFileAsync, gitEnv } from "../shared/git.js";
8
9
  import { gitDiffNames } from "../shared/git-diff.js";
9
- import { gitBranchExists, gitCurrentBranch } from "../shared/git-ops.js";
10
- import { findWorktreeForBranch, gitListTaskBranches, parseTaskIdFromBranch, } from "../shared/git-worktree.js";
10
+ import { gitBranchExists, gitCurrentBranch, gitIsAncestor } from "../shared/git-ops.js";
11
+ import { findWorktreeForBranch, gitListBranchesByPrefixes, parseTaskIdFromCloseBranch, parseTaskIdFromBranch, } from "../shared/git-worktree.js";
11
12
  import { isPathWithin, resolvePathFallback } from "../shared/path.js";
12
- import { listTaskProjection, loadCommandContext, } from "../shared/task-backend.js";
13
+ import { parsePrMeta } from "../shared/pr-meta.js";
14
+ import { loadTaskFromContext, loadCommandContext, } from "../shared/task-backend.js";
13
15
  import { archivePrArtifacts } from "./internal/archive-pr.js";
14
16
  const output = createCliEmitter();
17
+ function resolveCleanupBranchTaskId(opts) {
18
+ const taskId = parseTaskIdFromBranch(opts.prefix, opts.branch);
19
+ if (taskId)
20
+ return { taskId, kind: "task" };
21
+ const closeTaskId = parseTaskIdFromCloseBranch(opts.branch);
22
+ if (closeTaskId)
23
+ return { taskId: closeTaskId, kind: "task-close" };
24
+ return null;
25
+ }
26
+ async function readCleanupPrMetaIfPresent(opts) {
27
+ const metaPath = path.join(opts.gitRoot, opts.workflowDir, opts.taskId, "pr", "meta.json");
28
+ try {
29
+ const raw = await readFile(metaPath, "utf8");
30
+ return parsePrMeta(raw, opts.taskId);
31
+ }
32
+ catch {
33
+ return null;
34
+ }
35
+ }
36
+ async function taskLifecycleIsOnBase(opts) {
37
+ const taskCommitHash = opts.task.commit?.hash?.trim() ?? "";
38
+ if (taskCommitHash && (await gitIsAncestor(opts.gitRoot, taskCommitHash, opts.baseBranch))) {
39
+ return true;
40
+ }
41
+ const meta = await readCleanupPrMetaIfPresent({
42
+ gitRoot: opts.gitRoot,
43
+ workflowDir: opts.workflowDir,
44
+ taskId: opts.taskId,
45
+ });
46
+ const mergeCommit = meta?.status === "MERGED" ? (meta.merge_commit?.trim() ?? "") : "";
47
+ return (mergeCommit.length > 0 && (await gitIsAncestor(opts.gitRoot, mergeCommit, opts.baseBranch)));
48
+ }
49
+ async function resolveCleanupCandidates(opts) {
50
+ const prefix = opts.ctx.config.branch.task_prefix;
51
+ const branches = await gitListBranchesByPrefixes(opts.gitRoot, [prefix, "task-close"]);
52
+ const taskCache = new Map();
53
+ const candidates = [];
54
+ for (const branch of branches) {
55
+ if (branch === opts.baseBranch)
56
+ continue;
57
+ const target = resolveCleanupBranchTaskId({ branch, prefix });
58
+ if (!target)
59
+ continue;
60
+ let task = taskCache.get(target.taskId) ?? null;
61
+ if (!taskCache.has(target.taskId)) {
62
+ try {
63
+ task = await loadTaskFromContext({ ctx: opts.ctx, taskId: target.taskId });
64
+ }
65
+ catch {
66
+ task = null;
67
+ }
68
+ taskCache.set(target.taskId, task);
69
+ }
70
+ if (!task)
71
+ continue;
72
+ const status = String(task.status || "").toUpperCase();
73
+ if (status !== "DONE")
74
+ continue;
75
+ const diff = await gitDiffNames(opts.gitRoot, opts.baseBranch, branch);
76
+ const lifecycleOnBase = await taskLifecycleIsOnBase({
77
+ gitRoot: opts.gitRoot,
78
+ workflowDir: opts.workflowDir,
79
+ baseBranch: opts.baseBranch,
80
+ task,
81
+ taskId: target.taskId,
82
+ });
83
+ if (diff.length > 0 && !lifecycleOnBase)
84
+ continue;
85
+ const worktreePath = await findWorktreeForBranch(opts.gitRoot, branch);
86
+ candidates.push({ taskId: target.taskId, branch, worktreePath });
87
+ }
88
+ return candidates;
89
+ }
90
+ function isMissingRemoteBranchDelete(error) {
91
+ const stdout = String(error?.stdout ?? "");
92
+ const stderr = String(error?.stderr ?? "");
93
+ const text = `${stdout}\n${stderr}`;
94
+ return (text.includes("remote ref does not exist") ||
95
+ text.includes("unable to delete") ||
96
+ text.includes("remote reference is not a full refname"));
97
+ }
98
+ async function deleteRemoteBranchIfPresent(gitRoot, branch) {
99
+ try {
100
+ await execFileAsync("git", ["push", "origin", "--delete", branch], {
101
+ cwd: gitRoot,
102
+ env: gitEnv(),
103
+ });
104
+ return true;
105
+ }
106
+ catch (error) {
107
+ if (isMissingRemoteBranchDelete(error)) {
108
+ return false;
109
+ }
110
+ throw error;
111
+ }
112
+ }
15
113
  export async function cmdCleanupMerged(opts) {
16
114
  try {
17
115
  const ctx = opts.ctx ??
@@ -26,6 +124,12 @@ export async function cmdCleanupMerged(opts) {
26
124
  });
27
125
  }
28
126
  await ensureGitClean({ cwd: opts.cwd, rootOverride: opts.rootOverride });
127
+ if (opts.fetch) {
128
+ await execFileAsync("git", ["fetch", "--prune", "origin"], {
129
+ cwd: resolved.gitRoot,
130
+ env: gitEnv(),
131
+ });
132
+ }
29
133
  const baseBranch = await resolveBaseBranch({
30
134
  cwd: opts.cwd,
31
135
  rootOverride: opts.rootOverride ?? null,
@@ -55,33 +159,18 @@ export async function cmdCleanupMerged(opts) {
55
159
  });
56
160
  }
57
161
  const repoRoot = await resolvePathFallback(resolved.gitRoot);
58
- const tasks = (await listTaskProjection(ctx)) ?? [];
59
- const tasksById = new Map(tasks.map((task) => [task.id, task]));
60
- const prefix = config.branch.task_prefix;
61
- const branches = await gitListTaskBranches(resolved.gitRoot, prefix);
62
- const candidates = [];
63
- for (const branch of branches) {
64
- if (branch === baseBranch)
65
- continue;
66
- const taskId = parseTaskIdFromBranch(prefix, branch);
67
- if (!taskId)
68
- continue;
69
- const task = tasksById.get(taskId);
70
- if (!task)
71
- continue;
72
- const status = String(task.status || "").toUpperCase();
73
- if (status !== "DONE")
74
- continue;
75
- const diff = await gitDiffNames(resolved.gitRoot, baseBranch, branch);
76
- if (diff.length > 0)
77
- continue;
78
- const worktreePath = await findWorktreeForBranch(resolved.gitRoot, branch);
79
- candidates.push({ taskId, branch, worktreePath });
80
- }
162
+ const candidates = await resolveCleanupCandidates({
163
+ ctx,
164
+ gitRoot: resolved.gitRoot,
165
+ workflowDir: config.paths.workflow_dir,
166
+ baseBranch,
167
+ });
81
168
  const sortedCandidates = candidates.toSorted((a, b) => a.taskId.localeCompare(b.taskId));
82
169
  if (!opts.quiet) {
83
170
  const archiveLabel = opts.archive ? " archive=on" : "";
84
- output.line(`cleanup merged (base=${baseBranch}${archiveLabel})`);
171
+ const fetchLabel = opts.fetch ? " fetch=on" : "";
172
+ const remoteLabel = opts.deleteRemoteBranches ? " remote=delete" : "";
173
+ output.line(`cleanup merged (base=${baseBranch}${archiveLabel}${fetchLabel}${remoteLabel})`);
85
174
  if (sortedCandidates.length === 0) {
86
175
  output.line("no candidates");
87
176
  return 0;
@@ -96,17 +185,26 @@ export async function cmdCleanupMerged(opts) {
96
185
  }
97
186
  return 0;
98
187
  }
188
+ const skipUnsafeWorktrees = opts.skipUnsafeWorktrees === true;
189
+ let deletedRemoteBranches = 0;
190
+ let skippedUnsafe = 0;
99
191
  for (const item of sortedCandidates) {
100
192
  const worktreePath = item.worktreePath ? await resolvePathFallback(item.worktreePath) : null;
101
193
  if (worktreePath) {
102
- if (!isPathWithin(repoRoot, worktreePath)) {
103
- throw new CliError({
104
- exitCode: 5,
105
- code: "E_GIT",
106
- message: `Refusing to remove worktree outside repo: ${worktreePath}`,
107
- });
108
- }
109
- if (worktreePath === repoRoot) {
194
+ const outsideRepo = !isPathWithin(repoRoot, worktreePath);
195
+ const currentWorktree = worktreePath === repoRoot;
196
+ if (outsideRepo || currentWorktree) {
197
+ if (skipUnsafeWorktrees) {
198
+ skippedUnsafe += 1;
199
+ continue;
200
+ }
201
+ if (outsideRepo) {
202
+ throw new CliError({
203
+ exitCode: 5,
204
+ code: "E_GIT",
205
+ message: `Refusing to remove worktree outside repo: ${worktreePath}`,
206
+ });
207
+ }
110
208
  throw new CliError({
111
209
  exitCode: 5,
112
210
  code: "E_GIT",
@@ -128,9 +226,24 @@ export async function cmdCleanupMerged(opts) {
128
226
  cwd: resolved.gitRoot,
129
227
  env: gitEnv(),
130
228
  });
229
+ if (opts.deleteRemoteBranches) {
230
+ deletedRemoteBranches += (await deleteRemoteBranchIfPresent(resolved.gitRoot, item.branch))
231
+ ? 1
232
+ : 0;
233
+ }
234
+ }
235
+ if (opts.deleteRemoteBranches) {
236
+ await execFileAsync("git", ["fetch", "--prune", "origin"], {
237
+ cwd: resolved.gitRoot,
238
+ env: gitEnv(),
239
+ });
131
240
  }
132
241
  if (!opts.quiet) {
133
- output.success("cleanup merged", undefined, `deleted=${candidates.length}`);
242
+ const remoteDetail = opts.deleteRemoteBranches
243
+ ? ` remote_deleted=${deletedRemoteBranches}`
244
+ : "";
245
+ const skippedDetail = skipUnsafeWorktrees ? ` skipped_unsafe=${skippedUnsafe}` : "";
246
+ output.success("cleanup merged", undefined, `deleted=${candidates.length - skippedUnsafe}${remoteDetail}${skippedDetail}`);
134
247
  }
135
248
  return 0;
136
249
  }