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":"task-backend.d.ts","sourceRoot":"","sources":["../../../src/commands/shared/task-backend.ts"],"names":[],"mappings":"AACA,OAAO,EAOL,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACrB,MAAM,qBAAqB,CAAC;AAE7B,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I,CAAC,CA2E3B;AAED,wBAAsB,eAAe,CAAC,IAAI,EAAE;IAC1C,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,MAAM,EAAE,MAAM,CAAC;CAChB,GAAG,OAAO,CAAC;IACV,OAAO,EAAE,cAAc,CAAC,aAAa,CAAC,CAAC;IACvC,SAAS,EAAE,MAAM,CAAC;IAClB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,QAAQ,EAAE,cAAc,CAAC,iBAAiB,CAAC,CAAC;IAC5C,MAAM,EAAE,cAAc,CAAC,QAAQ,CAAC,CAAC;IACjC,IAAI,EAAE,QAAQ,CAAC;CAChB,CAAC,CAaD;AAED,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,IAAI,CAAC,WAAW,EAAE,WAAW,GAAG,YAAY,CAAC,EACtD,KAAK,EAAE,SAAS,QAAQ,EAAE,GACzB,OAAO,CAAC,IAAI,CAAC,CASf;AAED,wBAAsB,qBAAqB,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC,CAgBvF;AAED,wBAAsB,kBAAkB,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,CAQ3F;AAED,wBAAsB,4BAA4B,CAAC,IAAI,EAAE;IACvD,GAAG,EAAE,cAAc,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;CACpB,GAAG,OAAO,CAAC,IAAI,CAAC,CAchB"}
@@ -1,10 +1,11 @@
1
+ import { readFile } from "node:fs/promises";
1
2
  import path from "node:path";
2
3
  import { resolveTaskDocUpdatedBy, parseTaskReadme, taskDocToSectionMap, validateTaskReadmeFrontmatter, withTaskReadmeFrontmatterDefaults, } from "@agentplaneorg/core";
3
4
  import { CliError } from "../../shared/errors.js";
4
5
  import { loadTaskBackend, taskRecordToData, toTaskSummary, } from "../../backends/task-backend.js";
5
6
  import { gitShowFile, toGitPath } from "./git-diff.js";
6
7
  import { GitContext } from "./git-context.js";
7
- import { gitListTaskBranches, parseTaskIdFromBranch } from "./git-worktree.js";
8
+ import { findWorktreeForBranch, gitListTaskBranches, parseTaskIdFromBranch, } from "./git-worktree.js";
8
9
  function normalizeDocUpdatedBy(value) {
9
10
  const trimmed = value?.trim() ?? "";
10
11
  if (!trimmed)
@@ -79,39 +80,97 @@ export async function loadCommandContext(opts) {
79
80
  };
80
81
  }
81
82
  export async function loadTaskFromContext(opts) {
82
- const task = await opts.ctx.taskBackend.getTask(opts.taskId);
83
- if (task)
84
- return task;
85
83
  const tasksDir = path.join(opts.ctx.resolvedProject.gitRoot, opts.ctx.config.paths.workflow_dir);
86
84
  const readmePath = path.join(tasksDir, opts.taskId, "README.md");
87
- const branchFallback = await loadTaskFromBranchSnapshot({
85
+ const branchFallback = () => loadTaskFromBranchSnapshot({
88
86
  ctx: opts.ctx,
89
87
  taskId: opts.taskId,
90
88
  readmePath,
89
+ branch: opts.branchSnapshotBranch ?? null,
91
90
  });
92
- if (branchFallback)
93
- return branchFallback;
91
+ if (opts.preferBranchSnapshot) {
92
+ const preferredBranchTask = await branchFallback();
93
+ if (preferredBranchTask)
94
+ return preferredBranchTask;
95
+ }
96
+ const task = await opts.ctx.taskBackend.getTask(opts.taskId);
97
+ if (task)
98
+ return task;
99
+ const fallbackTask = await branchFallback();
100
+ if (fallbackTask)
101
+ return fallbackTask;
94
102
  throw new CliError({
95
103
  exitCode: 4,
96
104
  code: "E_IO",
97
105
  message: `ENOENT: no such file or directory, open '${readmePath}'`,
98
106
  });
99
107
  }
108
+ export async function resolveTaskBranchFromContext(opts) {
109
+ if (opts.ctx.backendId !== "local") {
110
+ return null;
111
+ }
112
+ const prefix = opts.ctx.config.branch.task_prefix;
113
+ const branches = await gitListTaskBranches(opts.ctx.resolvedProject.gitRoot, prefix);
114
+ const matches = branches.filter((branch) => parseTaskIdFromBranch(prefix, branch) === opts.taskId);
115
+ if (matches.length === 1)
116
+ return matches[0] ?? null;
117
+ if (matches.length > 1) {
118
+ throw new CliError({
119
+ exitCode: 3,
120
+ code: "E_VALIDATION",
121
+ message: `Multiple task branches match ${opts.taskId}: ${matches.join(", ")}`,
122
+ });
123
+ }
124
+ return null;
125
+ }
100
126
  export async function loadTaskFromBranchSnapshot(opts) {
101
127
  if (opts.ctx.backendId !== "local") {
102
128
  return null;
103
129
  }
104
- const branch = await resolveSingleTaskBranch(opts.ctx, opts.taskId);
130
+ const branch = typeof opts.branch === "string" && opts.branch.trim().length > 0
131
+ ? opts.branch.trim()
132
+ : await resolveTaskBranchFromContext({ ctx: opts.ctx, taskId: opts.taskId });
105
133
  if (!branch)
106
134
  return null;
135
+ const liveWorktreePath = await findWorktreeForBranch(opts.ctx.resolvedProject.gitRoot, branch);
136
+ if (liveWorktreePath) {
137
+ const liveReadmePath = path.join(liveWorktreePath, path.relative(opts.ctx.resolvedProject.gitRoot, opts.readmePath));
138
+ try {
139
+ const liveText = await readFile(liveReadmePath, "utf8");
140
+ const parsed = parseTaskReadme(liveText);
141
+ const frontmatter = validateTaskReadmeFrontmatter(withTaskReadmeFrontmatterDefaults({
142
+ ...parsed.frontmatter,
143
+ id: typeof parsed.frontmatter.id === "string" && parsed.frontmatter.id.trim().length > 0
144
+ ? parsed.frontmatter.id
145
+ : opts.taskId,
146
+ }));
147
+ return taskRecordToData({
148
+ id: opts.taskId,
149
+ frontmatter: frontmatter,
150
+ body: parsed.body,
151
+ readmePath: opts.readmePath,
152
+ });
153
+ }
154
+ catch {
155
+ // Fall back to the committed branch snapshot when the live worktree lacks the README.
156
+ }
157
+ }
107
158
  const relReadmePath = toGitPath(path.relative(opts.ctx.resolvedProject.gitRoot, opts.readmePath));
159
+ const refsToTry = [branch, branch.startsWith("origin/") ? null : `origin/${branch}`].filter((ref) => Boolean(ref && ref.trim().length > 0));
108
160
  let text = "";
109
- try {
110
- text = await gitShowFile(opts.ctx.resolvedProject.gitRoot, branch, relReadmePath);
161
+ let loaded = false;
162
+ for (const ref of refsToTry) {
163
+ try {
164
+ text = await gitShowFile(opts.ctx.resolvedProject.gitRoot, ref, relReadmePath);
165
+ loaded = true;
166
+ break;
167
+ }
168
+ catch {
169
+ // Try the next candidate ref.
170
+ }
111
171
  }
112
- catch {
172
+ if (!loaded)
113
173
  return null;
114
- }
115
174
  const parsed = parseTaskReadme(text);
116
175
  const frontmatter = validateTaskReadmeFrontmatter(withTaskReadmeFrontmatterDefaults({
117
176
  ...parsed.frontmatter,
@@ -126,21 +185,6 @@ export async function loadTaskFromBranchSnapshot(opts) {
126
185
  readmePath: opts.readmePath,
127
186
  });
128
187
  }
129
- async function resolveSingleTaskBranch(ctx, taskId) {
130
- const prefix = ctx.config.branch.task_prefix;
131
- const branches = await gitListTaskBranches(ctx.resolvedProject.gitRoot, prefix);
132
- const matches = branches.filter((branch) => parseTaskIdFromBranch(prefix, branch) === taskId);
133
- if (matches.length === 1)
134
- return matches[0] ?? null;
135
- if (matches.length > 1) {
136
- throw new CliError({
137
- exitCode: 3,
138
- code: "E_VALIDATION",
139
- message: `Multiple task branches match ${taskId}: ${matches.join(", ")}`,
140
- });
141
- }
142
- return null;
143
- }
144
188
  export async function loadBackendTask(opts) {
145
189
  const ctx = opts.ctx ??
146
190
  (await loadCommandContext({ cwd: opts.cwd, rootOverride: opts.rootOverride ?? null }));
@@ -1,12 +1,14 @@
1
1
  export declare function isTaskLocalAdvancePath(opts: {
2
2
  workflowDir: string;
3
3
  taskId: string;
4
+ tasksPath?: string;
4
5
  relPath: string;
5
6
  }): boolean;
6
7
  export declare function isTaskLocalOnlyAdvance(opts: {
7
8
  gitRoot: string;
8
9
  workflowDir: string;
9
10
  taskId: string;
11
+ tasksPath?: string;
10
12
  fromRef: string | null;
11
13
  toRef: string;
12
14
  }): Promise<boolean>;
@@ -1 +1 @@
1
- {"version":3,"file":"task-local-freshness.d.ts","sourceRoot":"","sources":["../../../src/commands/shared/task-local-freshness.ts"],"names":[],"mappings":"AAQA,wBAAgB,sBAAsB,CAAC,IAAI,EAAE;IAC3C,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACjB,GAAG,OAAO,CAEV;AAED,wBAAsB,sBAAsB,CAAC,IAAI,EAAE;IACjD,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;CACf,GAAG,OAAO,CAAC,OAAO,CAAC,CAenB"}
1
+ {"version":3,"file":"task-local-freshness.d.ts","sourceRoot":"","sources":["../../../src/commands/shared/task-local-freshness.ts"],"names":[],"mappings":"AAQA,wBAAgB,sBAAsB,CAAC,IAAI,EAAE;IAC3C,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;CACjB,GAAG,OAAO,CAOV;AAED,wBAAsB,sBAAsB,CAAC,IAAI,EAAE;IACjD,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;CACf,GAAG,OAAO,CAAC,OAAO,CAAC,CAgBnB"}
@@ -4,7 +4,12 @@ function taskRootPrefix(workflowDir, taskId) {
4
4
  return `${toGitPath(path.join(workflowDir, taskId))}/`;
5
5
  }
6
6
  export function isTaskLocalAdvancePath(opts) {
7
- return opts.relPath.startsWith(taskRootPrefix(opts.workflowDir, opts.taskId));
7
+ const normalizedRelPath = toGitPath(opts.relPath);
8
+ if (normalizedRelPath.startsWith(taskRootPrefix(opts.workflowDir, opts.taskId))) {
9
+ return true;
10
+ }
11
+ const normalizedTasksPath = opts.tasksPath ? toGitPath(opts.tasksPath) : null;
12
+ return normalizedTasksPath !== null && normalizedRelPath === normalizedTasksPath;
8
13
  }
9
14
  export async function isTaskLocalOnlyAdvance(opts) {
10
15
  if (!opts.fromRef || opts.fromRef === opts.toRef) {
@@ -15,6 +20,7 @@ export async function isTaskLocalOnlyAdvance(opts) {
15
20
  changedPaths.every((relPath) => isTaskLocalAdvancePath({
16
21
  workflowDir: opts.workflowDir,
17
22
  taskId: opts.taskId,
23
+ tasksPath: opts.tasksPath,
18
24
  relPath,
19
25
  })));
20
26
  }
@@ -1 +1 @@
1
- {"version":3,"file":"close-duplicate.d.ts","sourceRoot":"","sources":["../../../src/commands/task/close-duplicate.ts"],"names":[],"mappings":"AAGA,OAAO,EAAuB,KAAK,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAGrF,wBAAsB,qBAAqB,CAAC,IAAI,EAAE;IAChD,GAAG,EAAE,cAAc,CAAC;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,OAAO,CAAC;IACf,GAAG,EAAE,OAAO,CAAC;IACb,KAAK,EAAE,OAAO,CAAC;CAChB,GAAG,OAAO,CAAC,MAAM,CAAC,CAoDlB"}
1
+ {"version":3,"file":"close-duplicate.d.ts","sourceRoot":"","sources":["../../../src/commands/task/close-duplicate.ts"],"names":[],"mappings":"AAUA,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,2BAA2B,CAAC;AAgDnC,wBAAsB,qBAAqB,CAAC,IAAI,EAAE;IAChD,GAAG,EAAE,cAAc,CAAC;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,OAAO,CAAC;IACf,GAAG,EAAE,OAAO,CAAC;IACb,KAAK,EAAE,OAAO,CAAC;CAChB,GAAG,OAAO,CAAC,MAAM,CAAC,CAqDlB"}
@@ -1,8 +1,40 @@
1
+ import { mkdir, readFile } from "node:fs/promises";
2
+ import path from "node:path";
3
+ import { renderTaskReadme } from "@agentplaneorg/core";
1
4
  import { mapBackendError } from "../../cli/error-map.js";
5
+ import { fileExists } from "../../cli/fs-utils.js";
2
6
  import { CliError } from "../../shared/errors.js";
7
+ import { writeTextIfChanged } from "../../shared/write-if-changed.js";
3
8
  import { ensureActionApproved } from "../shared/approval-requirements.js";
4
- import { loadTaskFromContext } from "../shared/task-backend.js";
9
+ import { loadTaskFromContext, taskDataToFrontmatter, } from "../shared/task-backend.js";
10
+ import { listWorktrees, parseTaskIdFromBranch } from "../shared/git-worktree.js";
5
11
  import { recordVerifiedNoopClosure } from "./close-shared.js";
12
+ async function ensureLocalTaskReadmeHydrated(opts) {
13
+ const workflowDir = opts.ctx.config.paths.workflow_dir;
14
+ const targetReadmePath = path.join(opts.ctx.resolvedProject.gitRoot, workflowDir, opts.taskId, "README.md");
15
+ if (await fileExists(targetReadmePath))
16
+ return;
17
+ const worktrees = await listWorktrees(opts.ctx.resolvedProject.gitRoot).catch(() => []);
18
+ const matchingTaskWorktrees = worktrees.filter((entry) => typeof entry.branch === "string" &&
19
+ parseTaskIdFromBranch(opts.ctx.config.branch.task_prefix, entry.branch) === opts.taskId);
20
+ if (matchingTaskWorktrees.length === 1) {
21
+ const sourceReadmePath = path.join(matchingTaskWorktrees[0].path, workflowDir, opts.taskId, "README.md");
22
+ if (await fileExists(sourceReadmePath)) {
23
+ const text = await readFile(sourceReadmePath, "utf8");
24
+ await mkdir(path.dirname(targetReadmePath), { recursive: true });
25
+ await writeTextIfChanged(targetReadmePath, text);
26
+ return;
27
+ }
28
+ }
29
+ const task = await loadTaskFromContext({
30
+ ctx: opts.ctx,
31
+ taskId: opts.taskId,
32
+ preferBranchSnapshot: true,
33
+ });
34
+ const rendered = renderTaskReadme(taskDataToFrontmatter(task), task.doc ?? "");
35
+ await mkdir(path.dirname(targetReadmePath), { recursive: true });
36
+ await writeTextIfChanged(targetReadmePath, rendered);
37
+ }
6
38
  export async function cmdTaskCloseDuplicate(opts) {
7
39
  try {
8
40
  const sourceId = opts.taskId.trim();
@@ -30,6 +62,7 @@ export async function cmdTaskCloseDuplicate(opts) {
30
62
  });
31
63
  }
32
64
  const canonical = await loadTaskFromContext({ ctx: opts.ctx, taskId: duplicateOf });
65
+ await ensureLocalTaskReadmeHydrated({ ctx: opts.ctx, taskId: sourceId });
33
66
  const reason = opts.note?.trim();
34
67
  const canonicalTitle = canonical.title?.trim() ? ` (${canonical.title.trim()})` : "";
35
68
  const baseBody = `Verified: ${sourceId} is a bookkeeping duplicate of ${duplicateOf}${canonicalTitle}; ` +
@@ -61,7 +61,7 @@ export async function cmdTaskDerive(opts) {
61
61
  primary: primary.primary,
62
62
  verifyCommands: opts.verify,
63
63
  }));
64
- process.stderr.write(`${warnMessage("task requires Verify Steps by primary tag; seeded a default ## Verify Steps section in README (review and refine before approval/start)")}\n`);
64
+ process.stderr.write(`${warnMessage("task requires Verify Steps by primary tag; seeded a concrete ## Verify Steps section in README (refine it only if the task needs stricter acceptance coverage)")}\n`);
65
65
  }
66
66
  const hasSpike = opts.tags.some((tag) => tag.trim().toLowerCase() === spikeTag);
67
67
  if (hasSpike && requiresVerifySteps) {
@@ -1 +1 @@
1
- {"version":3,"file":"doc-template.d.ts","sourceRoot":"","sources":["../../../src/commands/task/doc-template.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,mBAAmB,IAAI,CAAC;AA2DrC,wBAAgB,gBAAgB,CAAC,IAAI,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAkCrF;AAED,wBAAgB,8BAA8B,CAAC,IAAI,EAAE;IACnD,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,MAAM,EAAE,CAAC;CAC1B,GAAG,MAAM,CA2BT"}
1
+ {"version":3,"file":"doc-template.d.ts","sourceRoot":"","sources":["../../../src/commands/task/doc-template.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,mBAAmB,IAAI,CAAC;AAyDrC,wBAAgB,gBAAgB,CAAC,IAAI,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAsCrF;AAED,wBAAgB,8BAA8B,CAAC,IAAI,EAAE;IACnD,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,MAAM,EAAE,CAAC;CAC1B,GAAG,MAAM,CAyBT"}
@@ -31,13 +31,11 @@ function buildDefaultPlan(opts) {
31
31
  "3. Finalize task findings and finish with traceable commit metadata.",
32
32
  ].join("\n");
33
33
  }
34
- function buildDefaultVerifyStepsTemplate() {
34
+ function buildDefaultVerifyStepsTemplate(opts) {
35
35
  return [
36
- "<!-- TODO: REPLACE WITH TASK-SPECIFIC ACCEPTANCE STEPS -->",
37
- "",
38
- "1. <Action>. Expected: <observable result>.",
39
- "2. <Action>. Expected: <observable result>.",
40
- "3. <Action>. Expected: <observable result>.",
36
+ `1. Review the requested outcome for "${opts.title}". Expected: the visible result matches ## Summary and stays inside approved scope.`,
37
+ "2. Run the most relevant validation step for this task. Expected: it succeeds without unexpected regressions in touched behavior.",
38
+ "3. Compare the final result against ## Scope and record any residual follow-up in ## Findings. Expected: open edges are explicit rather than implicit.",
41
39
  ].join("\n");
42
40
  }
43
41
  function buildDefaultVerificationTemplate() {
@@ -69,7 +67,7 @@ export function defaultTaskDocV3(opts) {
69
67
  body = setMarkdownSection(body, "Summary", buildDefaultSummary({ title: opts.title, description: opts.description }));
70
68
  body = setMarkdownSection(body, "Scope", buildDefaultScope({ title: opts.title, description: opts.description }));
71
69
  body = setMarkdownSection(body, "Plan", buildDefaultPlan({ title: opts.title }));
72
- body = setMarkdownSection(body, "Verify Steps", buildDefaultVerifyStepsTemplate());
70
+ body = setMarkdownSection(body, "Verify Steps", buildDefaultVerifyStepsTemplate({ title: opts.title }));
73
71
  body = setMarkdownSection(body, "Verification", buildDefaultVerificationTemplate());
74
72
  body = setMarkdownSection(body, "Rollback Plan", buildDefaultRollbackPlan());
75
73
  body = setMarkdownSection(body, "Findings", "");
@@ -85,10 +83,8 @@ export function buildDefaultVerifyStepsSection(opts) {
85
83
  ];
86
84
  if (commandSteps.length === 0) {
87
85
  return [
88
- "<!-- TODO: REPLACE WITH TASK-SPECIFIC ACCEPTANCE STEPS -->",
89
- "",
90
- "1. Review the changed artifact or behavior. Expected: the requested outcome is visible and matches the approved scope.",
91
- "2. Run the most relevant validation step for this task. Expected: it succeeds without unexpected regressions in touched scope.",
86
+ `1. Review the changed artifact or behavior for the \`${opts.primary}\` task. Expected: the requested outcome is visible and matches the approved scope.`,
87
+ `2. Run the most relevant validation step for the \`${opts.primary}\` task. Expected: it succeeds without unexpected regressions in touched scope.`,
92
88
  "3. Compare the final result against the task summary and scope. Expected: any remaining follow-up is explicit in ## Findings.",
93
89
  ].join("\n");
94
90
  }
@@ -0,0 +1,20 @@
1
+ import type { CommandCtx, CommandSpec } from "../../cli/spec/spec.js";
2
+ import type { CommandContext } from "../shared/task-backend.js";
3
+ export type TaskFindingsAddParsed = {
4
+ taskId: string;
5
+ observation: string;
6
+ impact: string;
7
+ resolution: string;
8
+ promote: boolean;
9
+ external: boolean;
10
+ fixability: "external" | "repo-fixable" | null;
11
+ incidentScope?: string;
12
+ incidentTags: string[];
13
+ incidentMatch: string[];
14
+ incidentAdvice?: string;
15
+ incidentRule?: string;
16
+ updatedBy?: string;
17
+ };
18
+ export declare const taskFindingsAddSpec: CommandSpec<TaskFindingsAddParsed>;
19
+ export declare function makeRunTaskFindingsAddHandler(getCtx: (cmd: string) => Promise<CommandContext>): (ctx: CommandCtx, p: TaskFindingsAddParsed) => Promise<number>;
20
+ //# sourceMappingURL=findings-add.command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"findings-add.command.d.ts","sourceRoot":"","sources":["../../../src/commands/task/findings-add.command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAEtE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAIhE,MAAM,MAAM,qBAAqB,GAAG;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,EAAE,UAAU,GAAG,cAAc,GAAG,IAAI,CAAC;IAC/C,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,WAAW,CAAC,qBAAqB,CAqJlE,CAAC;AAEF,wBAAgB,6BAA6B,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,cAAc,CAAC,IAC9E,KAAK,UAAU,EAAE,GAAG,qBAAqB,KAAG,OAAO,CAAC,MAAM,CAAC,CAoB1E"}
@@ -0,0 +1,165 @@
1
+ import { usageError } from "../../cli/spec/errors.js";
2
+ import { cmdTaskFindingsAdd } from "./findings.js";
3
+ export const taskFindingsAddSpec = {
4
+ id: ["task", "findings", "add"],
5
+ group: "Task",
6
+ summary: "Append a structured Findings/Notes block; incident promotion is default unless --local-only.",
7
+ synopsis: [
8
+ "agentplane task findings add <task-id> --observation <text> --impact <text> --resolution <text> [--local-only] [--repo-fixable] [--incident-scope <text>] [--incident-tag <tag>] [--incident-match <term>] [--incident-advice <text>] [--incident-rule <text>] [--updated-by <id>]",
9
+ ],
10
+ args: [{ name: "task-id", required: true, valueHint: "<task-id>" }],
11
+ options: [
12
+ {
13
+ kind: "string",
14
+ name: "observation",
15
+ valueHint: "<text>",
16
+ description: "Required. Observation field.",
17
+ },
18
+ { kind: "string", name: "impact", valueHint: "<text>", description: "Required. Impact field." },
19
+ {
20
+ kind: "string",
21
+ name: "resolution",
22
+ valueHint: "<text>",
23
+ description: "Required. Resolution field.",
24
+ },
25
+ {
26
+ kind: "boolean",
27
+ name: "promote",
28
+ description: "Compatibility flag. Promotion is the default unless `--local-only` is set.",
29
+ },
30
+ {
31
+ kind: "boolean",
32
+ name: "external",
33
+ description: "Compatibility flag. External incident metadata is the default unless `--local-only` is set.",
34
+ },
35
+ {
36
+ kind: "boolean",
37
+ name: "repo-fixable",
38
+ description: "Mark the structured finding as repo-fixable so it can promote into incidents.md.",
39
+ },
40
+ {
41
+ kind: "boolean",
42
+ name: "local-only",
43
+ default: false,
44
+ description: "Keep the entry task-local only; omit `Promotion: incident-candidate` and any explicit fixability marker.",
45
+ },
46
+ {
47
+ kind: "string",
48
+ name: "incident-scope",
49
+ valueHint: "<text>",
50
+ description: "Optional. IncidentScope override.",
51
+ },
52
+ {
53
+ kind: "string",
54
+ name: "incident-tag",
55
+ valueHint: "<tag>",
56
+ repeatable: true,
57
+ description: "Repeatable. IncidentTags entry.",
58
+ },
59
+ {
60
+ kind: "string",
61
+ name: "incident-match",
62
+ valueHint: "<term>",
63
+ repeatable: true,
64
+ description: "Repeatable. IncidentMatch entry.",
65
+ },
66
+ {
67
+ kind: "string",
68
+ name: "incident-advice",
69
+ valueHint: "<text>",
70
+ description: "Optional. IncidentAdvice field.",
71
+ },
72
+ {
73
+ kind: "string",
74
+ name: "incident-rule",
75
+ valueHint: "<text>",
76
+ description: "Optional. IncidentRule field.",
77
+ },
78
+ {
79
+ kind: "string",
80
+ name: "updated-by",
81
+ valueHint: "<id>",
82
+ description: "Optional. Override doc_updated_by metadata (must be non-empty).",
83
+ },
84
+ ],
85
+ examples: [
86
+ {
87
+ cmd: 'agentplane task findings add 202602030608-F1Q8AB --observation "GitHub API EOF retries were manual." --impact "Operators repeated the reconcile loop." --resolution "Switch the retry path to REST polling." --incident-scope "GitHub PR reconciliation" --incident-tag workflow --incident-tag github',
88
+ why: "Append a promotable external incident candidate without hand-editing the README or remembering hidden flags.",
89
+ },
90
+ {
91
+ cmd: 'agentplane task findings add 202602030608-F1Q8AB --observation "One manual follow-up remains." --impact "Task notes should stay local." --resolution "Track it in Findings only." --local-only',
92
+ why: "Keep an observation task-local when it should not feed incidents collection.",
93
+ },
94
+ ],
95
+ validateRaw: (raw) => {
96
+ for (const key of ["observation", "impact", "resolution"]) {
97
+ const value = raw.opts[key];
98
+ if (typeof value !== "string" || value.trim() === "") {
99
+ throw usageError({
100
+ spec: taskFindingsAddSpec,
101
+ message: `Missing required option: --${key}.`,
102
+ });
103
+ }
104
+ }
105
+ const updatedBy = raw.opts["updated-by"];
106
+ if (typeof updatedBy === "string" && updatedBy.trim() === "") {
107
+ throw usageError({ spec: taskFindingsAddSpec, message: "--updated-by must be non-empty." });
108
+ }
109
+ if (raw.opts["local-only"] === true &&
110
+ (raw.opts.promote === true || raw.opts.external === true || raw.opts["repo-fixable"] === true)) {
111
+ throw usageError({
112
+ spec: taskFindingsAddSpec,
113
+ message: "--local-only cannot be combined with --promote, --external, or --repo-fixable.",
114
+ });
115
+ }
116
+ if (raw.opts.external === true && raw.opts["repo-fixable"] === true) {
117
+ throw usageError({
118
+ spec: taskFindingsAddSpec,
119
+ message: "--external and --repo-fixable are mutually exclusive.",
120
+ });
121
+ }
122
+ },
123
+ parse: (raw) => {
124
+ const localOnly = raw.opts["local-only"] === true;
125
+ const repoFixable = raw.opts["repo-fixable"] === true;
126
+ const fixability = localOnly ? null : repoFixable ? "repo-fixable" : "external";
127
+ return {
128
+ taskId: String(raw.args["task-id"]),
129
+ observation: String(raw.opts.observation),
130
+ impact: String(raw.opts.impact),
131
+ resolution: String(raw.opts.resolution),
132
+ promote: !localOnly,
133
+ external: !localOnly,
134
+ fixability,
135
+ incidentScope: typeof raw.opts["incident-scope"] === "string" ? raw.opts["incident-scope"] : undefined,
136
+ incidentTags: raw.opts["incident-tag"] ?? [],
137
+ incidentMatch: raw.opts["incident-match"] ?? [],
138
+ incidentAdvice: typeof raw.opts["incident-advice"] === "string" ? raw.opts["incident-advice"] : undefined,
139
+ incidentRule: typeof raw.opts["incident-rule"] === "string" ? raw.opts["incident-rule"] : undefined,
140
+ updatedBy: typeof raw.opts["updated-by"] === "string" ? raw.opts["updated-by"] : undefined,
141
+ };
142
+ },
143
+ };
144
+ export function makeRunTaskFindingsAddHandler(getCtx) {
145
+ return async (ctx, p) => {
146
+ return await cmdTaskFindingsAdd({
147
+ ctx: await getCtx("task findings add"),
148
+ cwd: ctx.cwd,
149
+ rootOverride: ctx.rootOverride,
150
+ taskId: p.taskId,
151
+ observation: p.observation,
152
+ impact: p.impact,
153
+ resolution: p.resolution,
154
+ promote: p.promote,
155
+ external: p.external,
156
+ fixability: p.fixability === "repo-fixable" ? "repo-fixable" : null,
157
+ incidentScope: p.incidentScope,
158
+ incidentTags: p.incidentTags,
159
+ incidentMatch: p.incidentMatch,
160
+ incidentAdvice: p.incidentAdvice,
161
+ incidentRule: p.incidentRule,
162
+ updatedBy: p.updatedBy,
163
+ });
164
+ };
165
+ }
@@ -0,0 +1,7 @@
1
+ import type { CommandCtx, CommandSpec } from "../../cli/spec/spec.js";
2
+ export type TaskFindingsParsed = {
3
+ subcommand?: string;
4
+ };
5
+ export declare const taskFindingsSpec: CommandSpec<TaskFindingsParsed>;
6
+ export declare function runTaskFindings(_ctx: CommandCtx, p: TaskFindingsParsed): Promise<number>;
7
+ //# sourceMappingURL=findings.command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"findings.command.d.ts","sourceRoot":"","sources":["../../../src/commands/task/findings.command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAGtE,MAAM,MAAM,kBAAkB,GAAG;IAC/B,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,WAAW,CAAC,kBAAkB,CAY5D,CAAC;AAEF,wBAAsB,eAAe,CAAC,IAAI,EAAE,UAAU,EAAE,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC,CAM9F"}
@@ -0,0 +1,20 @@
1
+ import { loadDirectSubcommandNames, throwGroupCommandUsage } from "../../cli/group-command.js";
2
+ export const taskFindingsSpec = {
3
+ id: ["task", "findings"],
4
+ group: "Task",
5
+ summary: "Structured Findings/Notes commands (incident promotion is default unless --local-only).",
6
+ synopsis: [
7
+ "agentplane task findings add <task-id> --observation <text> --impact <text> --resolution <text> [--local-only] [--incident-scope <text>] [--incident-tag <tag>] [--incident-match <term>] [--incident-advice <text>] [--incident-rule <text>] [--updated-by <id>]",
8
+ ],
9
+ args: [{ name: "subcommand", required: false, valueHint: "<add>" }],
10
+ parse: (raw) => ({
11
+ subcommand: typeof raw.args.subcommand === "string" ? raw.args.subcommand : undefined,
12
+ }),
13
+ };
14
+ export async function runTaskFindings(_ctx, p) {
15
+ throwGroupCommandUsage({
16
+ spec: taskFindingsSpec,
17
+ cmd: p.subcommand ? [p.subcommand] : [],
18
+ subcommands: await loadDirectSubcommandNames(["task", "findings"]),
19
+ });
20
+ }
@@ -0,0 +1,63 @@
1
+ import { type AgentplaneConfig } from "@agentplaneorg/core";
2
+ import type { TaskData } from "../../backends/task-backend.js";
3
+ import { type CommandContext } from "../shared/task-backend.js";
4
+ import { type TaskStoreIntent } from "../shared/task-store.js";
5
+ export declare function renderStructuredFindingBlock(opts: {
6
+ observation: string;
7
+ impact: string;
8
+ resolution: string;
9
+ promote: boolean;
10
+ external: boolean;
11
+ fixability?: "repo-fixable" | null;
12
+ incidentScope?: string;
13
+ incidentTags: readonly string[];
14
+ incidentMatch: readonly string[];
15
+ incidentAdvice?: string;
16
+ incidentRule?: string;
17
+ }): string;
18
+ export type StructuredFindingMutationPlan = {
19
+ targetSection: string;
20
+ expectedCurrentText: string | null;
21
+ intents: readonly TaskStoreIntent[];
22
+ };
23
+ export declare function buildStructuredFindingMutationPlan(opts: {
24
+ current: TaskData;
25
+ config: AgentplaneConfig;
26
+ observation: string;
27
+ impact: string;
28
+ resolution: string;
29
+ promote: boolean;
30
+ external: boolean;
31
+ fixability?: "repo-fixable" | null;
32
+ incidentScope?: string;
33
+ incidentTags: readonly string[];
34
+ incidentMatch: readonly string[];
35
+ incidentAdvice?: string;
36
+ incidentRule?: string;
37
+ updatedBy?: string;
38
+ }): StructuredFindingMutationPlan | null;
39
+ export declare function renderFindingsAddRegistryNote(opts: {
40
+ promote: boolean;
41
+ external: boolean;
42
+ taskId: string;
43
+ branchPr?: boolean;
44
+ }): string;
45
+ export declare function cmdTaskFindingsAdd(opts: {
46
+ ctx?: CommandContext;
47
+ cwd: string;
48
+ rootOverride?: string;
49
+ taskId: string;
50
+ observation: string;
51
+ impact: string;
52
+ resolution: string;
53
+ promote: boolean;
54
+ external: boolean;
55
+ fixability?: "repo-fixable" | null;
56
+ incidentScope?: string;
57
+ incidentTags: string[];
58
+ incidentMatch: string[];
59
+ incidentAdvice?: string;
60
+ incidentRule?: string;
61
+ updatedBy?: string;
62
+ }): Promise<number>;
63
+ //# sourceMappingURL=findings.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"findings.d.ts","sourceRoot":"","sources":["../../../src/commands/task/findings.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,gBAAgB,EACtB,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