agentplane 0.3.10 → 0.3.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (228) hide show
  1. package/assets/policy/governance.md +3 -4
  2. package/assets/policy/incidents.md +19 -88
  3. package/assets/policy/workflow.branch_pr.md +1 -1
  4. package/assets/policy/workflow.direct.md +2 -2
  5. package/bin/agentplane.js +56 -1
  6. package/bin/runtime-watch.js +1 -0
  7. package/bin/stale-dist-policy.d.ts +1 -1
  8. package/bin/stale-dist-policy.js +13 -0
  9. package/dist/.build-manifest.json +219 -154
  10. package/dist/cli/bootstrap-guide.d.ts.map +1 -1
  11. package/dist/cli/bootstrap-guide.js +3 -2
  12. package/dist/cli/command-guide.d.ts.map +1 -1
  13. package/dist/cli/command-guide.js +2 -1
  14. package/dist/cli/command-invocations.d.ts.map +1 -1
  15. package/dist/cli/command-invocations.js +4 -1
  16. package/dist/cli/run-cli/command-catalog/project.d.ts +1 -1
  17. package/dist/cli/run-cli/command-catalog/project.d.ts.map +1 -1
  18. package/dist/cli/run-cli/command-catalog/project.js +3 -1
  19. package/dist/cli/run-cli/command-catalog/task.d.ts +1 -1
  20. package/dist/cli/run-cli/command-catalog/task.d.ts.map +1 -1
  21. package/dist/cli/run-cli/command-catalog/task.js +10 -0
  22. package/dist/cli/run-cli/command-catalog.d.ts +1 -1
  23. package/dist/cli/run-cli/command-catalog.d.ts.map +1 -1
  24. package/dist/cli/run-cli/commands/core/preflight.d.ts.map +1 -1
  25. package/dist/cli/run-cli/commands/core/preflight.js +44 -1
  26. package/dist/cli/run-cli.test-helpers.d.ts.map +1 -1
  27. package/dist/cli/run-cli.test-helpers.js +12 -0
  28. package/dist/commands/branch/cleanup-merged.d.ts +2 -0
  29. package/dist/commands/branch/cleanup-merged.d.ts.map +1 -1
  30. package/dist/commands/branch/cleanup-merged.js +132 -28
  31. package/dist/commands/branch/work-start.d.ts.map +1 -1
  32. package/dist/commands/branch/work-start.js +60 -1
  33. package/dist/commands/cleanup/merged.command.d.ts +2 -0
  34. package/dist/commands/cleanup/merged.command.d.ts.map +1 -1
  35. package/dist/commands/cleanup/merged.command.js +24 -0
  36. package/dist/commands/doctor/branch-pr.d.ts +4 -0
  37. package/dist/commands/doctor/branch-pr.d.ts.map +1 -0
  38. package/dist/commands/doctor/branch-pr.js +96 -0
  39. package/dist/commands/doctor/fixes.d.ts +5 -0
  40. package/dist/commands/doctor/fixes.d.ts.map +1 -1
  41. package/dist/commands/doctor/fixes.js +70 -0
  42. package/dist/commands/doctor.run.d.ts.map +1 -1
  43. package/dist/commands/doctor.run.js +6 -1
  44. package/dist/commands/finish.run.d.ts.map +1 -1
  45. package/dist/commands/finish.run.js +11 -0
  46. package/dist/commands/finish.spec.d.ts +11 -0
  47. package/dist/commands/finish.spec.d.ts.map +1 -1
  48. package/dist/commands/finish.spec.js +51 -0
  49. package/dist/commands/guard/impl/close-message.d.ts.map +1 -1
  50. package/dist/commands/guard/impl/close-message.js +23 -6
  51. package/dist/commands/guard/impl/commands.d.ts.map +1 -1
  52. package/dist/commands/guard/impl/commands.js +24 -2
  53. package/dist/commands/guard/impl/env.d.ts +1 -0
  54. package/dist/commands/guard/impl/env.d.ts.map +1 -1
  55. package/dist/commands/guard/impl/env.js +1 -0
  56. package/dist/commands/hooks/index.d.ts.map +1 -1
  57. package/dist/commands/hooks/index.js +98 -1
  58. package/dist/commands/incidents/collect.command.d.ts.map +1 -1
  59. package/dist/commands/incidents/collect.command.js +12 -7
  60. package/dist/commands/incidents/incidents.command.js +1 -1
  61. package/dist/commands/incidents/shared.d.ts +34 -0
  62. package/dist/commands/incidents/shared.d.ts.map +1 -1
  63. package/dist/commands/incidents/shared.js +166 -12
  64. package/dist/commands/pr/check.d.ts.map +1 -1
  65. package/dist/commands/pr/check.js +238 -135
  66. package/dist/commands/pr/close-superseded.d.ts +9 -0
  67. package/dist/commands/pr/close-superseded.d.ts.map +1 -0
  68. package/dist/commands/pr/close-superseded.js +129 -0
  69. package/dist/commands/pr/close.d.ts +11 -0
  70. package/dist/commands/pr/close.d.ts.map +1 -0
  71. package/dist/commands/pr/close.js +116 -0
  72. package/dist/commands/pr/index.d.ts +2 -0
  73. package/dist/commands/pr/index.d.ts.map +1 -1
  74. package/dist/commands/pr/index.js +2 -0
  75. package/dist/commands/pr/integrate/artifacts.d.ts +7 -0
  76. package/dist/commands/pr/integrate/artifacts.d.ts.map +1 -1
  77. package/dist/commands/pr/integrate/artifacts.js +66 -1
  78. package/dist/commands/pr/integrate/cmd.d.ts.map +1 -1
  79. package/dist/commands/pr/integrate/cmd.js +16 -0
  80. package/dist/commands/pr/integrate/internal/bootstrap-guidance.d.ts +8 -0
  81. package/dist/commands/pr/integrate/internal/bootstrap-guidance.d.ts.map +1 -0
  82. package/dist/commands/pr/integrate/internal/bootstrap-guidance.js +59 -0
  83. package/dist/commands/pr/integrate/internal/finalize.d.ts.map +1 -1
  84. package/dist/commands/pr/integrate/internal/finalize.js +40 -12
  85. package/dist/commands/pr/integrate/internal/merge.d.ts.map +1 -1
  86. package/dist/commands/pr/integrate/internal/merge.js +36 -13
  87. package/dist/commands/pr/integrate/internal/post-integrate-bootstrap.d.ts +13 -0
  88. package/dist/commands/pr/integrate/internal/post-integrate-bootstrap.d.ts.map +1 -0
  89. package/dist/commands/pr/integrate/internal/post-integrate-bootstrap.js +25 -0
  90. package/dist/commands/pr/integrate/internal/prepare.d.ts +3 -2
  91. package/dist/commands/pr/integrate/internal/prepare.d.ts.map +1 -1
  92. package/dist/commands/pr/integrate/internal/prepare.js +101 -38
  93. package/dist/commands/pr/internal/freshness.d.ts +20 -0
  94. package/dist/commands/pr/internal/freshness.d.ts.map +1 -0
  95. package/dist/commands/pr/internal/freshness.js +50 -0
  96. package/dist/commands/pr/internal/gh-api.d.ts +6 -0
  97. package/dist/commands/pr/internal/gh-api.d.ts.map +1 -0
  98. package/dist/commands/pr/internal/gh-api.js +80 -0
  99. package/dist/commands/pr/internal/pr-paths.d.ts +10 -0
  100. package/dist/commands/pr/internal/pr-paths.d.ts.map +1 -1
  101. package/dist/commands/pr/internal/pr-paths.js +10 -0
  102. package/dist/commands/pr/internal/review-template.d.ts.map +1 -1
  103. package/dist/commands/pr/internal/review-template.js +37 -4
  104. package/dist/commands/pr/internal/sync.d.ts +9 -0
  105. package/dist/commands/pr/internal/sync.d.ts.map +1 -1
  106. package/dist/commands/pr/internal/sync.js +462 -122
  107. package/dist/commands/pr/open.d.ts +1 -0
  108. package/dist/commands/pr/open.d.ts.map +1 -1
  109. package/dist/commands/pr/open.js +13 -2
  110. package/dist/commands/pr/pr.command.d.ts +15 -0
  111. package/dist/commands/pr/pr.command.d.ts.map +1 -1
  112. package/dist/commands/pr/pr.command.js +118 -2
  113. package/dist/commands/pr/update.d.ts.map +1 -1
  114. package/dist/commands/pr/update.js +59 -1
  115. package/dist/commands/release/apply.command.d.ts.map +1 -1
  116. package/dist/commands/release/apply.command.js +3 -17
  117. package/dist/commands/release/apply.preflight.d.ts.map +1 -1
  118. package/dist/commands/release/apply.preflight.js +1 -1
  119. package/dist/commands/shared/gh-transport.d.ts +16 -0
  120. package/dist/commands/shared/gh-transport.d.ts.map +1 -0
  121. package/dist/commands/shared/gh-transport.js +71 -0
  122. package/dist/commands/shared/git-diff.d.ts +3 -1
  123. package/dist/commands/shared/git-diff.d.ts.map +1 -1
  124. package/dist/commands/shared/git-diff.js +10 -2
  125. package/dist/commands/shared/git-ops.d.ts +1 -0
  126. package/dist/commands/shared/git-ops.d.ts.map +1 -1
  127. package/dist/commands/shared/git-ops.js +15 -0
  128. package/dist/commands/shared/git-worktree.d.ts +2 -0
  129. package/dist/commands/shared/git-worktree.d.ts.map +1 -1
  130. package/dist/commands/shared/git-worktree.js +22 -2
  131. package/dist/commands/shared/post-commit-pr-artifacts.d.ts +9 -0
  132. package/dist/commands/shared/post-commit-pr-artifacts.d.ts.map +1 -0
  133. package/dist/commands/shared/post-commit-pr-artifacts.js +22 -0
  134. package/dist/commands/shared/pr-meta.d.ts +20 -0
  135. package/dist/commands/shared/pr-meta.d.ts.map +1 -1
  136. package/dist/commands/shared/pr-meta.js +125 -0
  137. package/dist/commands/shared/task-backend.d.ts +7 -0
  138. package/dist/commands/shared/task-backend.d.ts.map +1 -1
  139. package/dist/commands/shared/task-backend.js +34 -22
  140. package/dist/commands/task/close-duplicate.d.ts.map +1 -1
  141. package/dist/commands/task/close-duplicate.js +34 -1
  142. package/dist/commands/task/derive.js +1 -1
  143. package/dist/commands/task/doc-template.d.ts.map +1 -1
  144. package/dist/commands/task/doc-template.js +7 -11
  145. package/dist/commands/task/findings-add.command.d.ts +20 -0
  146. package/dist/commands/task/findings-add.command.d.ts.map +1 -0
  147. package/dist/commands/task/findings-add.command.js +165 -0
  148. package/dist/commands/task/findings.command.d.ts +7 -0
  149. package/dist/commands/task/findings.command.d.ts.map +1 -0
  150. package/dist/commands/task/findings.command.js +20 -0
  151. package/dist/commands/task/findings.d.ts +63 -0
  152. package/dist/commands/task/findings.d.ts.map +1 -0
  153. package/dist/commands/task/findings.js +188 -0
  154. package/dist/commands/task/finish-shared.d.ts +1 -0
  155. package/dist/commands/task/finish-shared.d.ts.map +1 -1
  156. package/dist/commands/task/finish-shared.js +55 -1
  157. package/dist/commands/task/finish.d.ts +10 -0
  158. package/dist/commands/task/finish.d.ts.map +1 -1
  159. package/dist/commands/task/finish.js +125 -6
  160. package/dist/commands/task/hosted-close-pr.command.d.ts +11 -0
  161. package/dist/commands/task/hosted-close-pr.command.d.ts.map +1 -0
  162. package/dist/commands/task/hosted-close-pr.command.js +414 -0
  163. package/dist/commands/task/hosted-close.command.d.ts.map +1 -1
  164. package/dist/commands/task/hosted-close.command.js +49 -1
  165. package/dist/commands/task/hosted-merge-sync.d.ts +38 -0
  166. package/dist/commands/task/hosted-merge-sync.d.ts.map +1 -1
  167. package/dist/commands/task/hosted-merge-sync.js +249 -17
  168. package/dist/commands/task/index.d.ts +1 -0
  169. package/dist/commands/task/index.d.ts.map +1 -1
  170. package/dist/commands/task/index.js +1 -0
  171. package/dist/commands/task/new.d.ts +1 -0
  172. package/dist/commands/task/new.d.ts.map +1 -1
  173. package/dist/commands/task/new.js +71 -1
  174. package/dist/commands/task/new.spec.d.ts.map +1 -1
  175. package/dist/commands/task/new.spec.js +7 -0
  176. package/dist/commands/task/normalize.command.d.ts +2 -0
  177. package/dist/commands/task/normalize.command.d.ts.map +1 -1
  178. package/dist/commands/task/normalize.command.js +45 -0
  179. package/dist/commands/task/normalize.d.ts +2 -0
  180. package/dist/commands/task/normalize.d.ts.map +1 -1
  181. package/dist/commands/task/normalize.js +85 -8
  182. package/dist/commands/task/plan.d.ts.map +1 -1
  183. package/dist/commands/task/plan.js +7 -10
  184. package/dist/commands/task/shared/docs.d.ts +6 -0
  185. package/dist/commands/task/shared/docs.d.ts.map +1 -1
  186. package/dist/commands/task/shared/docs.js +14 -0
  187. package/dist/commands/task/shared/transitions.d.ts.map +1 -1
  188. package/dist/commands/task/shared/transitions.js +11 -1
  189. package/dist/commands/task/shared.d.ts +1 -1
  190. package/dist/commands/task/shared.d.ts.map +1 -1
  191. package/dist/commands/task/shared.js +1 -1
  192. package/dist/commands/task/start-ready.d.ts.map +1 -1
  193. package/dist/commands/task/start-ready.js +86 -0
  194. package/dist/commands/task/start.d.ts.map +1 -1
  195. package/dist/commands/task/start.js +7 -10
  196. package/dist/commands/task/task.command.d.ts.map +1 -1
  197. package/dist/commands/task/task.command.js +4 -0
  198. package/dist/commands/task/verify-command-shared.d.ts +19 -0
  199. package/dist/commands/task/verify-command-shared.d.ts.map +1 -1
  200. package/dist/commands/task/verify-command-shared.js +152 -1
  201. package/dist/commands/task/verify-ok.command.d.ts.map +1 -1
  202. package/dist/commands/task/verify-ok.command.js +15 -2
  203. package/dist/commands/task/verify-record.d.ts +36 -0
  204. package/dist/commands/task/verify-record.d.ts.map +1 -1
  205. package/dist/commands/task/verify-record.js +166 -11
  206. package/dist/commands/task/verify-rework.command.d.ts.map +1 -1
  207. package/dist/commands/task/verify-rework.command.js +15 -2
  208. package/dist/commands/task/verify-show.command.d.ts +1 -1
  209. package/dist/commands/task/verify-show.command.d.ts.map +1 -1
  210. package/dist/commands/task/verify-show.command.js +28 -1
  211. package/dist/commands/verify.run.d.ts.map +1 -1
  212. package/dist/commands/verify.run.js +12 -0
  213. package/dist/commands/verify.spec.d.ts +2 -6
  214. package/dist/commands/verify.spec.d.ts.map +1 -1
  215. package/dist/commands/verify.spec.js +30 -3
  216. package/dist/runtime/incidents/index.d.ts +1 -1
  217. package/dist/runtime/incidents/index.d.ts.map +1 -1
  218. package/dist/runtime/incidents/resolve.d.ts.map +1 -1
  219. package/dist/runtime/incidents/resolve.js +319 -73
  220. package/dist/runtime/incidents/types.d.ts +14 -2
  221. package/dist/runtime/incidents/types.d.ts.map +1 -1
  222. package/dist/shared/env.d.ts +1 -0
  223. package/dist/shared/env.d.ts.map +1 -1
  224. package/dist/shared/env.js +22 -1
  225. package/dist/shared/protected-paths.d.ts +1 -1
  226. package/dist/shared/protected-paths.d.ts.map +1 -1
  227. package/dist/shared/protected-paths.js +4 -0
  228. package/package.json +2 -2
@@ -1,13 +1,82 @@
1
1
  import { usageError } from "../../cli/spec/errors.js";
2
+ export const verifyFindingOptions = [
3
+ {
4
+ kind: "string",
5
+ name: "observation",
6
+ valueHint: "<text>",
7
+ description: "Structured finding observation to append with the verification.",
8
+ },
9
+ {
10
+ kind: "string",
11
+ name: "impact",
12
+ valueHint: "<text>",
13
+ description: "Structured finding impact to append with the verification.",
14
+ },
15
+ {
16
+ kind: "string",
17
+ name: "resolution",
18
+ valueHint: "<text>",
19
+ description: "Structured finding resolution to append with the verification.",
20
+ },
21
+ {
22
+ kind: "boolean",
23
+ name: "local-only",
24
+ default: false,
25
+ description: "Keep the finding task-local; omit incident-candidate promotion.",
26
+ },
27
+ {
28
+ kind: "boolean",
29
+ name: "repo-fixable",
30
+ default: false,
31
+ description: "Mark the structured finding as repo-fixable so incidents collect can promote it.",
32
+ },
33
+ {
34
+ kind: "string",
35
+ name: "incident-scope",
36
+ valueHint: "<text>",
37
+ description: "Optional incident scope for the appended finding.",
38
+ },
39
+ {
40
+ kind: "string",
41
+ name: "incident-tag",
42
+ valueHint: "<tag>",
43
+ repeatable: true,
44
+ description: "Repeatable incident tag for the appended finding.",
45
+ },
46
+ {
47
+ kind: "string",
48
+ name: "incident-match",
49
+ valueHint: "<term>",
50
+ repeatable: true,
51
+ description: "Repeatable incident match term for the appended finding.",
52
+ },
53
+ {
54
+ kind: "string",
55
+ name: "incident-advice",
56
+ valueHint: "<text>",
57
+ description: "Optional operator advice for the appended finding.",
58
+ },
59
+ {
60
+ kind: "string",
61
+ name: "incident-rule",
62
+ valueHint: "<text>",
63
+ description: "Optional incident rule for the appended finding.",
64
+ },
65
+ ];
2
66
  export const verifyCommonOptions = [
3
67
  { kind: "string", name: "by", valueHint: "<id>", required: true, description: "Verifier id." },
4
68
  {
5
69
  kind: "string",
6
70
  name: "note",
7
71
  valueHint: "<text>",
8
- required: true,
9
72
  description: "Short verification note.",
10
73
  },
74
+ {
75
+ kind: "string",
76
+ name: "note-file",
77
+ valueHint: "<path>",
78
+ description: "Read the verification note from a file path (mutually exclusive with --note).",
79
+ },
11
80
  {
12
81
  kind: "string",
13
82
  name: "details",
@@ -26,6 +95,13 @@ export const verifyCommonOptions = [
26
95
  default: false,
27
96
  description: "Suppress normal output (still prints errors).",
28
97
  },
98
+ {
99
+ kind: "boolean",
100
+ name: "collect-incidents",
101
+ default: false,
102
+ description: "After recording verification, collect promotable findings into incidents.md immediately.",
103
+ },
104
+ ...verifyFindingOptions,
29
105
  ];
30
106
  export function validateVerifyDetailsFileExclusive(raw, spec, opts) {
31
107
  if (typeof raw.opts.details === "string" && typeof raw.opts.file === "string") {
@@ -42,12 +118,87 @@ export function validateVerifyNonEmptyInput(raw, spec, name) {
42
118
  throw usageError({ spec, message: `Invalid value for --${name}: empty.` });
43
119
  }
44
120
  }
121
+ export function validateVerifyNoteSource(raw, spec, opts) {
122
+ const inlineNote = raw.opts.note;
123
+ const noteFile = raw.opts["note-file"];
124
+ if (typeof inlineNote === "string" && typeof noteFile === "string") {
125
+ throw usageError({
126
+ spec,
127
+ command: opts?.command,
128
+ message: "Options --note and --note-file are mutually exclusive.",
129
+ });
130
+ }
131
+ if (typeof noteFile === "string" && noteFile.trim().length === 0) {
132
+ throw usageError({
133
+ spec,
134
+ command: opts?.command,
135
+ message: "Invalid value for --note-file: empty.",
136
+ });
137
+ }
138
+ if (typeof inlineNote === "string" && inlineNote.trim().length === 0) {
139
+ throw usageError({
140
+ spec,
141
+ command: opts?.command,
142
+ message: "Invalid value for --note: empty.",
143
+ });
144
+ }
145
+ if (typeof inlineNote !== "string" && typeof noteFile !== "string") {
146
+ throw usageError({
147
+ spec,
148
+ command: opts?.command,
149
+ message: "Provide exactly one of --note or --note-file.",
150
+ });
151
+ }
152
+ }
153
+ export function validateVerifyFindingSource(raw, spec, opts) {
154
+ const hasFindingField = [
155
+ raw.opts.observation,
156
+ raw.opts.impact,
157
+ raw.opts.resolution,
158
+ raw.opts["incident-scope"],
159
+ raw.opts["incident-advice"],
160
+ raw.opts["incident-rule"],
161
+ ].some((value) => typeof value === "string" && value.trim().length > 0);
162
+ const hasFindingCollections = Array.isArray(raw.opts["incident-tag"]) && raw.opts["incident-tag"].length > 0
163
+ ? true
164
+ : Array.isArray(raw.opts["incident-match"]) && raw.opts["incident-match"].length > 0;
165
+ const hasFindingToggle = raw.opts["local-only"] === true || raw.opts["repo-fixable"] === true;
166
+ if (!hasFindingField && !hasFindingCollections && !hasFindingToggle)
167
+ return;
168
+ const observation = raw.opts.observation;
169
+ const impact = raw.opts.impact;
170
+ const resolution = raw.opts.resolution;
171
+ if (typeof observation !== "string" ||
172
+ observation.trim().length === 0 ||
173
+ typeof impact !== "string" ||
174
+ impact.trim().length === 0 ||
175
+ typeof resolution !== "string" ||
176
+ resolution.trim().length === 0) {
177
+ throw usageError({
178
+ spec,
179
+ command: opts?.command,
180
+ message: "Provide --observation, --impact, and --resolution together when appending a structured finding.",
181
+ });
182
+ }
183
+ }
45
184
  export function parseVerifyCommonOptions(raw) {
46
185
  return {
47
186
  by: typeof raw.opts.by === "string" ? raw.opts.by : "",
48
187
  note: typeof raw.opts.note === "string" ? raw.opts.note : "",
188
+ noteFile: typeof raw.opts["note-file"] === "string" ? raw.opts["note-file"] : undefined,
49
189
  details: typeof raw.opts.details === "string" ? raw.opts.details : undefined,
50
190
  file: typeof raw.opts.file === "string" ? raw.opts.file : undefined,
51
191
  quiet: raw.opts.quiet === true,
192
+ collectIncidents: raw.opts["collect-incidents"] === true,
193
+ observation: typeof raw.opts.observation === "string" ? raw.opts.observation : undefined,
194
+ impact: typeof raw.opts.impact === "string" ? raw.opts.impact : undefined,
195
+ resolution: typeof raw.opts.resolution === "string" ? raw.opts.resolution : undefined,
196
+ localOnly: raw.opts["local-only"] === true,
197
+ repoFixable: raw.opts["repo-fixable"] === true,
198
+ incidentScope: typeof raw.opts["incident-scope"] === "string" ? raw.opts["incident-scope"] : undefined,
199
+ incidentTags: raw.opts["incident-tag"] ?? [],
200
+ incidentMatch: raw.opts["incident-match"] ?? [],
201
+ incidentAdvice: typeof raw.opts["incident-advice"] === "string" ? raw.opts["incident-advice"] : undefined,
202
+ incidentRule: typeof raw.opts["incident-rule"] === "string" ? raw.opts["incident-rule"] : undefined,
52
203
  };
53
204
  }
@@ -1 +1 @@
1
- {"version":3,"file":"verify-ok.command.d.ts","sourceRoot":"","sources":["../../../src/commands/task/verify-ok.command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACtE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAGhE,OAAO,EAKL,KAAK,kBAAkB,EACxB,MAAM,4BAA4B,CAAC;AAEpC,MAAM,MAAM,kBAAkB,GAAG,kBAAkB,GAAG;IACpD,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,WAAW,CAAC,kBAAkB,CAuB5D,CAAC;AAEF,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,cAAc,CAAC,IAC3E,KAAK,UAAU,EAAE,GAAG,kBAAkB,KAAG,OAAO,CAAC,MAAM,CAAC,CAavE"}
1
+ {"version":3,"file":"verify-ok.command.d.ts","sourceRoot":"","sources":["../../../src/commands/task/verify-ok.command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACtE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAGhE,OAAO,EAOL,KAAK,kBAAkB,EACxB,MAAM,4BAA4B,CAAC;AAEpC,MAAM,MAAM,kBAAkB,GAAG,kBAAkB,GAAG;IACpD,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,WAAW,CAAC,kBAAkB,CAwB5D,CAAC;AAEF,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,cAAc,CAAC,IAC3E,KAAK,UAAU,EAAE,GAAG,kBAAkB,KAAG,OAAO,CAAC,MAAM,CAAC,CAyBvE"}
@@ -1,5 +1,5 @@
1
1
  import { cmdTaskVerifyOk } from "./verify-record.js";
2
- import { parseVerifyCommonOptions, validateVerifyDetailsFileExclusive, validateVerifyNonEmptyInput, verifyCommonOptions, } from "./verify-command-shared.js";
2
+ import { parseVerifyCommonOptions, validateVerifyDetailsFileExclusive, validateVerifyFindingSource, validateVerifyNonEmptyInput, validateVerifyNoteSource, verifyCommonOptions, } from "./verify-command-shared.js";
3
3
  export const taskVerifyOkSpec = {
4
4
  id: ["task", "verify", "ok"],
5
5
  group: "Task",
@@ -17,7 +17,8 @@ export const taskVerifyOkSpec = {
17
17
  message: "Provide at most one of --details or --file.",
18
18
  });
19
19
  validateVerifyNonEmptyInput(raw, taskVerifyOkSpec, "by");
20
- validateVerifyNonEmptyInput(raw, taskVerifyOkSpec, "note");
20
+ validateVerifyNoteSource(raw, taskVerifyOkSpec);
21
+ validateVerifyFindingSource(raw, taskVerifyOkSpec);
21
22
  },
22
23
  parse: (raw) => ({
23
24
  taskId: String(raw.args["task-id"]),
@@ -33,9 +34,21 @@ export function makeRunTaskVerifyOkHandler(getCtx) {
33
34
  taskId: p.taskId,
34
35
  by: p.by,
35
36
  note: p.note,
37
+ noteFile: p.noteFile,
36
38
  details: p.details,
37
39
  file: p.file,
40
+ collectIncidents: p.collectIncidents,
38
41
  quiet: p.quiet,
42
+ observation: p.observation,
43
+ impact: p.impact,
44
+ resolution: p.resolution,
45
+ localOnly: p.localOnly,
46
+ repoFixable: p.repoFixable,
47
+ incidentScope: p.incidentScope,
48
+ incidentTags: p.incidentTags,
49
+ incidentMatch: p.incidentMatch,
50
+ incidentAdvice: p.incidentAdvice,
51
+ incidentRule: p.incidentRule,
39
52
  });
40
53
  };
41
54
  }
@@ -7,8 +7,20 @@ export declare function cmdTaskVerifyOk(opts: {
7
7
  taskId: string;
8
8
  by: string;
9
9
  note: string;
10
+ noteFile?: string;
10
11
  details?: string;
11
12
  file?: string;
13
+ collectIncidents?: boolean;
14
+ observation?: string;
15
+ impact?: string;
16
+ resolution?: string;
17
+ localOnly: boolean;
18
+ repoFixable: boolean;
19
+ incidentScope?: string;
20
+ incidentTags: string[];
21
+ incidentMatch: string[];
22
+ incidentAdvice?: string;
23
+ incidentRule?: string;
12
24
  quiet: boolean;
13
25
  }): Promise<number>;
14
26
  export declare function cmdTaskVerifyRework(opts: {
@@ -18,8 +30,20 @@ export declare function cmdTaskVerifyRework(opts: {
18
30
  taskId: string;
19
31
  by: string;
20
32
  note: string;
33
+ noteFile?: string;
21
34
  details?: string;
22
35
  file?: string;
36
+ collectIncidents?: boolean;
37
+ observation?: string;
38
+ impact?: string;
39
+ resolution?: string;
40
+ localOnly?: boolean;
41
+ repoFixable?: boolean;
42
+ incidentScope?: string;
43
+ incidentTags?: string[];
44
+ incidentMatch?: string[];
45
+ incidentAdvice?: string;
46
+ incidentRule?: string;
23
47
  quiet: boolean;
24
48
  }): Promise<number>;
25
49
  export declare function cmdVerifyParsed(opts: {
@@ -30,8 +54,20 @@ export declare function cmdVerifyParsed(opts: {
30
54
  state: VerifyState;
31
55
  by: string;
32
56
  note: string;
57
+ noteFile?: string;
33
58
  details?: string;
34
59
  file?: string;
60
+ collectIncidents?: boolean;
61
+ observation?: string;
62
+ impact?: string;
63
+ resolution?: string;
64
+ localOnly?: boolean;
65
+ repoFixable?: boolean;
66
+ incidentScope?: string;
67
+ incidentTags?: string[];
68
+ incidentMatch?: string[];
69
+ incidentAdvice?: string;
70
+ incidentRule?: string;
35
71
  quiet: boolean;
36
72
  }): Promise<number>;
37
73
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"verify-record.d.ts","sourceRoot":"","sources":["../../../src/commands/task/verify-record.ts"],"names":[],"mappings":"AAQA,OAAO,EAAsB,KAAK,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAYpF,KAAK,WAAW,GAAG,IAAI,GAAG,cAAc,CAAC;AA0KzC,wBAAsB,eAAe,CAAC,IAAI,EAAE;IAC1C,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,OAAO,CAAC;CAChB,GAAG,OAAO,CAAC,MAAM,CAAC,CAElB;AAED,wBAAsB,mBAAmB,CAAC,IAAI,EAAE;IAC9C,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,OAAO,CAAC;CAChB,GAAG,OAAO,CAAC,MAAM,CAAC,CAMlB;AAED,wBAAsB,eAAe,CAAC,IAAI,EAAE;IAC1C,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,WAAW,CAAC;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,OAAO,CAAC;CAChB,GAAG,OAAO,CAAC,MAAM,CAAC,CAElB"}
1
+ {"version":3,"file":"verify-record.d.ts","sourceRoot":"","sources":["../../../src/commands/task/verify-record.ts"],"names":[],"mappings":"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"}
@@ -1,16 +1,21 @@
1
1
  import { readFile } from "node:fs/promises";
2
2
  import path from "node:path";
3
3
  import { mapBackendError, mapCoreError } from "../../cli/error-map.js";
4
- import { backendNotSupportedMessage, successMessage } from "../../cli/output.js";
4
+ import { backendNotSupportedMessage, infoMessage, successMessage } from "../../cli/output.js";
5
5
  import { CliError } from "../../shared/errors.js";
6
6
  import { writeJsonStableIfChanged } from "../../shared/write-if-changed.js";
7
+ import { collectTaskIncidents, inspectTaskIncidents, renderIncidentCollectionPlanOutcome, } from "../incidents/shared.js";
7
8
  import { ensureReconciledBeforeMutation } from "../shared/reconcile-check.js";
8
9
  import { loadCommandContext } from "../shared/task-backend.js";
9
10
  import { applyTaskMutation } from "../shared/task-mutation.js";
10
11
  import { ensurePrArtifactsSynced } from "../pr/internal/sync.js";
11
12
  import { resolvePrPaths } from "../pr/internal/pr-paths.js";
12
13
  import { buildVerifiedPrMeta, parsePrMeta } from "../shared/pr-meta.js";
13
- import { decodeEscapedTaskTextNewlines, executeTaskVerificationTransitionRequest, nowIso, } from "./shared.js";
14
+ import { buildStructuredFindingMutationPlan } from "./findings.js";
15
+ import { assertVerifyStepsFilled, decodeEscapedTaskTextNewlines, executeTaskVerificationTransitionRequest, extractDocSection, nowIso, } from "./shared.js";
16
+ function normalizeFileBackedVerifyNote(raw) {
17
+ return decodeEscapedTaskTextNewlines(raw).replaceAll(/\s+/gu, " ").trim();
18
+ }
14
19
  async function recordVerificationResult(opts) {
15
20
  const ctx = opts.ctx ??
16
21
  (await loadCommandContext({ cwd: opts.cwd, rootOverride: opts.rootOverride ?? null }));
@@ -30,6 +35,14 @@ async function recordVerificationResult(opts) {
30
35
  ctx,
31
36
  taskId: opts.taskId,
32
37
  build: async (current) => {
38
+ const doc = (typeof current.doc === "string" ? current.doc : "") ||
39
+ (await backend.getTaskDoc(current.id));
40
+ assertVerifyStepsFilled({
41
+ taskId: current.id,
42
+ sectionText: extractDocSection(doc, "Verify Steps"),
43
+ action: "record verification",
44
+ guidance: "fill it before running `agentplane verify ...`",
45
+ });
33
46
  const execution = executeTaskVerificationTransitionRequest({
34
47
  task: current,
35
48
  at,
@@ -37,11 +50,30 @@ async function recordVerificationResult(opts) {
37
50
  note: opts.note,
38
51
  state: opts.state,
39
52
  details: opts.details ?? null,
40
- doc: (typeof current.doc === "string" ? current.doc : "") ||
41
- (await backend.getTaskDoc(current.id)),
53
+ doc,
42
54
  requiredSections: config.tasks.doc.required_sections,
43
55
  });
44
- return { intents: execution.intents };
56
+ const intents = [...execution.intents];
57
+ if (opts.finding) {
58
+ const findingPlan = buildStructuredFindingMutationPlan({
59
+ current,
60
+ config,
61
+ observation: opts.finding.observation,
62
+ impact: opts.finding.impact,
63
+ resolution: opts.finding.resolution,
64
+ promote: !opts.finding.localOnly,
65
+ external: !opts.finding.localOnly,
66
+ fixability: opts.finding.repoFixable ? "repo-fixable" : null,
67
+ incidentScope: opts.finding.incidentScope,
68
+ incidentTags: opts.finding.incidentTags ?? [],
69
+ incidentMatch: opts.finding.incidentMatch ?? [],
70
+ incidentAdvice: opts.finding.incidentAdvice,
71
+ incidentRule: opts.finding.incidentRule,
72
+ });
73
+ if (findingPlan)
74
+ intents.push(...findingPlan.intents);
75
+ }
76
+ return { intents };
45
77
  },
46
78
  });
47
79
  if (config.workflow_mode === "branch_pr") {
@@ -67,20 +99,70 @@ async function recordVerificationResult(opts) {
67
99
  }));
68
100
  }
69
101
  }
102
+ let incidentSummary = null;
103
+ if (opts.collectIncidents === true) {
104
+ const collected = await collectTaskIncidents({
105
+ ctx,
106
+ taskId: opts.taskId,
107
+ write: true,
108
+ });
109
+ incidentSummary = renderIncidentCollectionPlanOutcome(collected.plan, {
110
+ wrote: collected.wrote,
111
+ context: "collect",
112
+ promotedIds: collected.plan.promotable.map((item) => item.entry.id),
113
+ registryPaths: collected.registryPaths,
114
+ taskId: opts.taskId,
115
+ });
116
+ }
117
+ else if (config.workflow_mode === "branch_pr") {
118
+ const inspected = await inspectTaskIncidents({
119
+ ctx,
120
+ taskId: opts.taskId,
121
+ });
122
+ incidentSummary = renderIncidentCollectionPlanOutcome(inspected.plan, {
123
+ wrote: false,
124
+ context: "verify",
125
+ taskId: opts.taskId,
126
+ });
127
+ }
70
128
  if (!opts.quiet) {
129
+ const findingState = opts.finding
130
+ ? opts.finding.localOnly
131
+ ? "task-local"
132
+ : "incident-candidate"
133
+ : null;
71
134
  const readmePath = path.join(resolved.gitRoot, config.paths.workflow_dir, opts.taskId, "README.md");
72
135
  const relReadmePath = path.relative(resolved.gitRoot, readmePath);
73
- process.stdout.write(`${successMessage("verified", opts.taskId, `state=${opts.state} readme=${relReadmePath}`)}\n`);
136
+ const extra = findingState ? ` finding=${findingState}` : "";
137
+ process.stdout.write(`${successMessage("verified", opts.taskId, `state=${opts.state} readme=${relReadmePath}${extra}`)}\n`);
138
+ if (incidentSummary && config.workflow_mode === "branch_pr") {
139
+ process.stdout.write(`${infoMessage(incidentSummary)}\n`);
140
+ }
74
141
  }
75
142
  }
76
143
  async function resolveVerifyRecordInput(opts) {
77
144
  const by = String(opts.by ?? "").trim();
78
- const note = String(opts.note ?? "").trim();
79
- if (!by || !note) {
145
+ const inlineNote = String(opts.note ?? "").trim();
146
+ const noteFile = typeof opts.noteFile === "string" ? opts.noteFile.trim() : "";
147
+ if (!by) {
148
+ throw new CliError({
149
+ exitCode: 2,
150
+ code: "E_USAGE",
151
+ message: "Missing required input: --by.",
152
+ });
153
+ }
154
+ if (!inlineNote && !noteFile) {
80
155
  throw new CliError({
81
156
  exitCode: 2,
82
157
  code: "E_USAGE",
83
- message: "Missing required inputs: --by and --note.",
158
+ message: "Provide exactly one of --note or --note-file.",
159
+ });
160
+ }
161
+ if (inlineNote && noteFile) {
162
+ throw new CliError({
163
+ exitCode: 2,
164
+ code: "E_USAGE",
165
+ message: "Options --note and --note-file are mutually exclusive.",
84
166
  });
85
167
  }
86
168
  if (typeof opts.details === "string" && typeof opts.file === "string") {
@@ -90,6 +172,22 @@ async function resolveVerifyRecordInput(opts) {
90
172
  message: "Options --details and --file are mutually exclusive.",
91
173
  });
92
174
  }
175
+ let note = inlineNote;
176
+ if (noteFile) {
177
+ try {
178
+ note = normalizeFileBackedVerifyNote(await readFile(path.resolve(opts.cwd, noteFile), "utf8"));
179
+ }
180
+ catch (err) {
181
+ throw mapCoreError(err, { command: opts.command, filePath: noteFile });
182
+ }
183
+ }
184
+ if (!note) {
185
+ throw new CliError({
186
+ exitCode: 2,
187
+ code: "E_USAGE",
188
+ message: "Verification note cannot be empty after normalization.",
189
+ });
190
+ }
93
191
  let details = typeof opts.details === "string" ? opts.details : null;
94
192
  if (typeof opts.file === "string") {
95
193
  try {
@@ -116,6 +214,8 @@ async function executeVerifyRecordCommand(opts) {
116
214
  by: input.by,
117
215
  note: input.note,
118
216
  details: input.details,
217
+ finding: opts.finding,
218
+ collectIncidents: opts.collectIncidents,
119
219
  quiet: opts.quiet,
120
220
  });
121
221
  return 0;
@@ -127,15 +227,70 @@ async function executeVerifyRecordCommand(opts) {
127
227
  }
128
228
  }
129
229
  export async function cmdTaskVerifyOk(opts) {
130
- return await executeVerifyRecordCommand({ ...opts, state: "ok", command: "task verify ok" });
230
+ return await executeVerifyRecordCommand({
231
+ ...opts,
232
+ state: "ok",
233
+ command: "task verify ok",
234
+ finding: typeof opts.observation === "string" &&
235
+ typeof opts.impact === "string" &&
236
+ typeof opts.resolution === "string"
237
+ ? {
238
+ observation: opts.observation,
239
+ impact: opts.impact,
240
+ resolution: opts.resolution,
241
+ localOnly: opts.localOnly === true,
242
+ repoFixable: opts.repoFixable === true,
243
+ incidentScope: opts.incidentScope,
244
+ incidentTags: opts.incidentTags ?? [],
245
+ incidentMatch: opts.incidentMatch ?? [],
246
+ incidentAdvice: opts.incidentAdvice,
247
+ incidentRule: opts.incidentRule,
248
+ }
249
+ : null,
250
+ });
131
251
  }
132
252
  export async function cmdTaskVerifyRework(opts) {
133
253
  return await executeVerifyRecordCommand({
134
254
  ...opts,
135
255
  state: "needs_rework",
136
256
  command: "task verify rework",
257
+ finding: typeof opts.observation === "string" &&
258
+ typeof opts.impact === "string" &&
259
+ typeof opts.resolution === "string"
260
+ ? {
261
+ observation: opts.observation,
262
+ impact: opts.impact,
263
+ resolution: opts.resolution,
264
+ localOnly: opts.localOnly === true,
265
+ repoFixable: opts.repoFixable === true,
266
+ incidentScope: opts.incidentScope,
267
+ incidentTags: opts.incidentTags ?? [],
268
+ incidentMatch: opts.incidentMatch ?? [],
269
+ incidentAdvice: opts.incidentAdvice,
270
+ incidentRule: opts.incidentRule,
271
+ }
272
+ : null,
137
273
  });
138
274
  }
139
275
  export async function cmdVerifyParsed(opts) {
140
- return await executeVerifyRecordCommand({ ...opts, command: "verify" });
276
+ return await executeVerifyRecordCommand({
277
+ ...opts,
278
+ command: "verify",
279
+ finding: typeof opts.observation === "string" &&
280
+ typeof opts.impact === "string" &&
281
+ typeof opts.resolution === "string"
282
+ ? {
283
+ observation: opts.observation,
284
+ impact: opts.impact,
285
+ resolution: opts.resolution,
286
+ localOnly: opts.localOnly === true,
287
+ repoFixable: opts.repoFixable === true,
288
+ incidentScope: opts.incidentScope,
289
+ incidentTags: opts.incidentTags ?? [],
290
+ incidentMatch: opts.incidentMatch ?? [],
291
+ incidentAdvice: opts.incidentAdvice,
292
+ incidentRule: opts.incidentRule,
293
+ }
294
+ : null,
295
+ });
141
296
  }
@@ -1 +1 @@
1
- {"version":3,"file":"verify-rework.command.d.ts","sourceRoot":"","sources":["../../../src/commands/task/verify-rework.command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACtE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAGhE,OAAO,EAKL,KAAK,kBAAkB,EACxB,MAAM,4BAA4B,CAAC;AAEpC,MAAM,MAAM,sBAAsB,GAAG,kBAAkB,GAAG;IACxD,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,WAAW,CAAC,sBAAsB,CAwBpE,CAAC;AAEF,wBAAgB,8BAA8B,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,cAAc,CAAC,IAC/E,KAAK,UAAU,EAAE,GAAG,sBAAsB,KAAG,OAAO,CAAC,MAAM,CAAC,CAa3E"}
1
+ {"version":3,"file":"verify-rework.command.d.ts","sourceRoot":"","sources":["../../../src/commands/task/verify-rework.command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACtE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAGhE,OAAO,EAOL,KAAK,kBAAkB,EACxB,MAAM,4BAA4B,CAAC;AAEpC,MAAM,MAAM,sBAAsB,GAAG,kBAAkB,GAAG;IACxD,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,WAAW,CAAC,sBAAsB,CAyBpE,CAAC;AAEF,wBAAgB,8BAA8B,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,cAAc,CAAC,IAC/E,KAAK,UAAU,EAAE,GAAG,sBAAsB,KAAG,OAAO,CAAC,MAAM,CAAC,CAyB3E"}
@@ -1,5 +1,5 @@
1
1
  import { cmdTaskVerifyRework } from "./verify-record.js";
2
- import { parseVerifyCommonOptions, validateVerifyDetailsFileExclusive, validateVerifyNonEmptyInput, verifyCommonOptions, } from "./verify-command-shared.js";
2
+ import { parseVerifyCommonOptions, validateVerifyDetailsFileExclusive, validateVerifyFindingSource, validateVerifyNonEmptyInput, validateVerifyNoteSource, verifyCommonOptions, } from "./verify-command-shared.js";
3
3
  export const taskVerifyReworkSpec = {
4
4
  id: ["task", "verify", "rework"],
5
5
  group: "Task",
@@ -17,7 +17,8 @@ export const taskVerifyReworkSpec = {
17
17
  message: "Provide at most one of --details or --file.",
18
18
  });
19
19
  validateVerifyNonEmptyInput(raw, taskVerifyReworkSpec, "by");
20
- validateVerifyNonEmptyInput(raw, taskVerifyReworkSpec, "note");
20
+ validateVerifyNoteSource(raw, taskVerifyReworkSpec);
21
+ validateVerifyFindingSource(raw, taskVerifyReworkSpec);
21
22
  },
22
23
  parse: (raw) => ({
23
24
  taskId: String(raw.args["task-id"]),
@@ -33,9 +34,21 @@ export function makeRunTaskVerifyReworkHandler(getCtx) {
33
34
  taskId: p.taskId,
34
35
  by: p.by,
35
36
  note: p.note,
37
+ noteFile: p.noteFile,
36
38
  details: p.details,
37
39
  file: p.file,
40
+ collectIncidents: p.collectIncidents,
38
41
  quiet: p.quiet,
42
+ observation: p.observation,
43
+ impact: p.impact,
44
+ resolution: p.resolution,
45
+ localOnly: p.localOnly,
46
+ repoFixable: p.repoFixable,
47
+ incidentScope: p.incidentScope,
48
+ incidentTags: p.incidentTags,
49
+ incidentMatch: p.incidentMatch,
50
+ incidentAdvice: p.incidentAdvice,
51
+ incidentRule: p.incidentRule,
39
52
  });
40
53
  };
41
54
  }
@@ -1,5 +1,5 @@
1
1
  import type { CommandCtx, CommandSpec } from "../../cli/spec/spec.js";
2
- import type { CommandContext } from "../shared/task-backend.js";
2
+ import { type CommandContext } from "../shared/task-backend.js";
3
3
  export type TaskVerifyShowParsed = {
4
4
  taskId: string;
5
5
  quiet: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"verify-show.command.d.ts","sourceRoot":"","sources":["../../../src/commands/task/verify-show.command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACtE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAIhE,MAAM,MAAM,oBAAoB,GAAG;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,OAAO,CAAC;CAChB,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,WAAW,CAAC,oBAAoB,CA6BhE,CAAC;AAEF,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,cAAc,CAAC,IAC7E,KAAK,UAAU,EAAE,GAAG,oBAAoB,KAAG,OAAO,CAAC,MAAM,CAAC,CAUzE"}
1
+ {"version":3,"file":"verify-show.command.d.ts","sourceRoot":"","sources":["../../../src/commands/task/verify-show.command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAGtE,OAAO,EAAuB,KAAK,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAKrF,MAAM,MAAM,oBAAoB,GAAG;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,OAAO,CAAC;CAChB,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,WAAW,CAAC,oBAAoB,CA6BhE,CAAC;AAEF,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,cAAc,CAAC,IAC7E,KAAK,UAAU,EAAE,GAAG,oBAAoB,KAAG,OAAO,CAAC,MAAM,CAAC,CAkCzE"}
@@ -1,4 +1,8 @@
1
+ import { backendNotSupportedMessage } from "../../cli/output.js";
2
+ import { CliError } from "../../shared/errors.js";
3
+ import { loadTaskFromContext } from "../shared/task-backend.js";
1
4
  import { cmdTaskDocShow } from "./doc.js";
5
+ import { assertVerifyStepsFilled, extractDocSection, isVerifyStepsFilled } from "./shared.js";
2
6
  export const taskVerifyShowSpec = {
3
7
  id: ["task", "verify-show"],
4
8
  group: "Task",
@@ -30,8 +34,31 @@ export const taskVerifyShowSpec = {
30
34
  };
31
35
  export function makeRunTaskVerifyShowHandler(getCtx) {
32
36
  return async (ctx, p) => {
37
+ const commandCtx = await getCtx("task verify-show");
38
+ const backend = commandCtx.taskBackend;
39
+ if (!backend.getTaskDoc) {
40
+ throw new CliError({
41
+ exitCode: 2,
42
+ code: "E_USAGE",
43
+ message: backendNotSupportedMessage("task docs"),
44
+ });
45
+ }
46
+ const task = await loadTaskFromContext({ ctx: commandCtx, taskId: p.taskId });
47
+ const doc = typeof task.doc === "string" ? task.doc : ((await backend.getTaskDoc(p.taskId)) ?? "");
48
+ const verifySteps = extractDocSection(doc, "Verify Steps");
49
+ if (!p.quiet) {
50
+ assertVerifyStepsFilled({
51
+ taskId: p.taskId,
52
+ sectionText: verifySteps,
53
+ action: "show Verify Steps",
54
+ guidance: "fill it before verification",
55
+ });
56
+ }
57
+ else if (!isVerifyStepsFilled(verifySteps)) {
58
+ return 0;
59
+ }
33
60
  return await cmdTaskDocShow({
34
- ctx: await getCtx("task verify-show"),
61
+ ctx: commandCtx,
35
62
  cwd: ctx.cwd,
36
63
  rootOverride: ctx.rootOverride,
37
64
  taskId: p.taskId,
@@ -1 +1 @@
1
- {"version":3,"file":"verify.run.d.ts","sourceRoot":"","sources":["../../src/commands/verify.run.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAG/D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAErD,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,cAAc,CAAC,IACrE,KAAK,UAAU,EAAE,GAAG,YAAY,KAAG,OAAO,CAAC,MAAM,CAAC,CAcjE"}
1
+ {"version":3,"file":"verify.run.d.ts","sourceRoot":"","sources":["../../src/commands/verify.run.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAG/D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAErD,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,cAAc,CAAC,IACrE,KAAK,UAAU,EAAE,GAAG,YAAY,KAAG,OAAO,CAAC,MAAM,CAAC,CA0BjE"}