agentplane 0.3.2 → 0.3.3

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 (190) hide show
  1. package/assets/AGENTS.md +1 -1
  2. package/assets/agents/CODER.json +4 -3
  3. package/assets/agents/DOCS.json +1 -1
  4. package/assets/agents/INTEGRATOR.json +1 -1
  5. package/assets/agents/ORCHESTRATOR.json +1 -0
  6. package/assets/agents/PLANNER.json +1 -0
  7. package/assets/agents/TESTER.json +3 -1
  8. package/assets/policy/dod.code.md +2 -2
  9. package/assets/policy/dod.core.md +16 -2
  10. package/assets/policy/dod.docs.md +2 -2
  11. package/assets/policy/incidents.md +44 -1
  12. package/assets/policy/workflow.direct.md +8 -4
  13. package/bin/agentplane.js +59 -9
  14. package/bin/dist-guard.js +78 -10
  15. package/bin/runtime-context.d.ts +3 -0
  16. package/bin/runtime-context.js +13 -0
  17. package/bin/runtime-watch.d.ts +26 -0
  18. package/bin/runtime-watch.js +116 -0
  19. package/bin/stale-dist-policy.d.ts +6 -0
  20. package/bin/stale-dist-policy.js +44 -0
  21. package/dist/.build-manifest.json +2480 -5
  22. package/dist/backends/task-backend/local-backend.d.ts.map +1 -1
  23. package/dist/backends/task-backend/local-backend.js +9 -12
  24. package/dist/backends/task-backend/redmine-backend.d.ts.map +1 -1
  25. package/dist/backends/task-backend/redmine-backend.js +23 -18
  26. package/dist/backends/task-backend/shared/constants.d.ts +1 -0
  27. package/dist/backends/task-backend/shared/constants.d.ts.map +1 -1
  28. package/dist/backends/task-backend/shared/constants.js +1 -0
  29. package/dist/backends/task-backend/shared/doc.d.ts +1 -0
  30. package/dist/backends/task-backend/shared/doc.d.ts.map +1 -1
  31. package/dist/backends/task-backend/shared/doc.js +4 -1
  32. package/dist/backends/task-backend/shared/export.js +3 -3
  33. package/dist/cli/bootstrap-guide.d.ts +1 -3
  34. package/dist/cli/bootstrap-guide.d.ts.map +1 -1
  35. package/dist/cli/bootstrap-guide.js +13 -33
  36. package/dist/cli/command-guide.d.ts.map +1 -1
  37. package/dist/cli/command-guide.js +27 -34
  38. package/dist/cli/run-cli/catalog.d.ts +7 -0
  39. package/dist/cli/run-cli/catalog.d.ts.map +1 -0
  40. package/dist/cli/run-cli/catalog.js +22 -0
  41. package/dist/cli/run-cli/command-catalog.d.ts +1 -1
  42. package/dist/cli/run-cli/command-catalog.d.ts.map +1 -1
  43. package/dist/cli/run-cli/command-catalog.js +11 -0
  44. package/dist/cli/run-cli/commands/init/write-config.d.ts.map +1 -1
  45. package/dist/cli/run-cli/commands/init/write-config.js +2 -0
  46. package/dist/cli/run-cli/commands/init.js +5 -14
  47. package/dist/cli/run-cli/error-guidance.d.ts +9 -0
  48. package/dist/cli/run-cli/error-guidance.d.ts.map +1 -0
  49. package/dist/cli/run-cli/error-guidance.js +180 -0
  50. package/dist/cli/run-cli/globals.d.ts +22 -0
  51. package/dist/cli/run-cli/globals.d.ts.map +1 -0
  52. package/dist/cli/run-cli/globals.js +197 -0
  53. package/dist/cli/run-cli/update-warning.d.ts +6 -0
  54. package/dist/cli/run-cli/update-warning.d.ts.map +1 -0
  55. package/dist/cli/run-cli/update-warning.js +64 -0
  56. package/dist/cli/run-cli.d.ts.map +1 -1
  57. package/dist/cli/run-cli.js +5 -476
  58. package/dist/cli/spec/docs-render.d.ts.map +1 -1
  59. package/dist/cli/spec/docs-render.js +14 -1
  60. package/dist/commands/doctor/archive.d.ts +4 -0
  61. package/dist/commands/doctor/archive.d.ts.map +1 -0
  62. package/dist/commands/doctor/archive.js +211 -0
  63. package/dist/commands/doctor/fixes.d.ts +9 -0
  64. package/dist/commands/doctor/fixes.d.ts.map +1 -0
  65. package/dist/commands/doctor/fixes.js +40 -0
  66. package/dist/commands/doctor/layering.d.ts +2 -0
  67. package/dist/commands/doctor/layering.d.ts.map +1 -0
  68. package/dist/commands/doctor/layering.js +87 -0
  69. package/dist/commands/doctor/runtime.d.ts +4 -0
  70. package/dist/commands/doctor/runtime.d.ts.map +1 -0
  71. package/dist/commands/doctor/runtime.js +56 -0
  72. package/dist/commands/doctor/workflow.d.ts +6 -0
  73. package/dist/commands/doctor/workflow.d.ts.map +1 -0
  74. package/dist/commands/doctor/workflow.js +62 -0
  75. package/dist/commands/doctor/workspace.d.ts +2 -0
  76. package/dist/commands/doctor/workspace.d.ts.map +1 -0
  77. package/dist/commands/doctor/workspace.js +165 -0
  78. package/dist/commands/doctor.run.d.ts.map +1 -1
  79. package/dist/commands/doctor.run.js +16 -342
  80. package/dist/commands/doctor.spec.d.ts +1 -0
  81. package/dist/commands/doctor.spec.d.ts.map +1 -1
  82. package/dist/commands/doctor.spec.js +15 -1
  83. package/dist/commands/guard/impl/commands.d.ts.map +1 -1
  84. package/dist/commands/guard/impl/commands.js +19 -0
  85. package/dist/commands/release/apply.command.d.ts +2 -8
  86. package/dist/commands/release/apply.command.d.ts.map +1 -1
  87. package/dist/commands/release/apply.command.js +158 -387
  88. package/dist/commands/release/apply.mutation.d.ts +7 -0
  89. package/dist/commands/release/apply.mutation.d.ts.map +1 -0
  90. package/dist/commands/release/apply.mutation.js +107 -0
  91. package/dist/commands/release/apply.preflight.d.ts +25 -0
  92. package/dist/commands/release/apply.preflight.d.ts.map +1 -0
  93. package/dist/commands/release/apply.preflight.js +338 -0
  94. package/dist/commands/release/apply.reporting.d.ts +4 -0
  95. package/dist/commands/release/apply.reporting.d.ts.map +1 -0
  96. package/dist/commands/release/apply.reporting.js +24 -0
  97. package/dist/commands/release/apply.types.d.ts +46 -0
  98. package/dist/commands/release/apply.types.d.ts.map +1 -0
  99. package/dist/commands/release/apply.types.js +1 -0
  100. package/dist/commands/runtime.command.d.ts +28 -0
  101. package/dist/commands/runtime.command.d.ts.map +1 -0
  102. package/dist/commands/runtime.command.js +169 -0
  103. package/dist/commands/shared/task-store.d.ts.map +1 -1
  104. package/dist/commands/shared/task-store.js +7 -3
  105. package/dist/commands/task/add.d.ts.map +1 -1
  106. package/dist/commands/task/add.js +3 -33
  107. package/dist/commands/task/block.d.ts.map +1 -1
  108. package/dist/commands/task/block.js +2 -2
  109. package/dist/commands/task/close-duplicate.d.ts.map +1 -1
  110. package/dist/commands/task/close-duplicate.js +2 -2
  111. package/dist/commands/task/close-noop.d.ts.map +1 -1
  112. package/dist/commands/task/close-noop.js +2 -2
  113. package/dist/commands/task/comment.js +2 -2
  114. package/dist/commands/task/derive.d.ts.map +1 -1
  115. package/dist/commands/task/derive.js +3 -3
  116. package/dist/commands/task/doc-template.d.ts +10 -0
  117. package/dist/commands/task/doc-template.d.ts.map +1 -0
  118. package/dist/commands/task/doc-template.js +104 -0
  119. package/dist/commands/task/doc.d.ts.map +1 -1
  120. package/dist/commands/task/doc.js +36 -1
  121. package/dist/commands/task/finish.d.ts.map +1 -1
  122. package/dist/commands/task/finish.js +7 -4
  123. package/dist/commands/task/migrate-doc.command.d.ts.map +1 -1
  124. package/dist/commands/task/migrate-doc.command.js +5 -1
  125. package/dist/commands/task/migrate-doc.d.ts.map +1 -1
  126. package/dist/commands/task/migrate-doc.js +136 -2
  127. package/dist/commands/task/new.d.ts.map +1 -1
  128. package/dist/commands/task/new.js +4 -110
  129. package/dist/commands/task/new.spec.js +3 -3
  130. package/dist/commands/task/plan.d.ts.map +1 -1
  131. package/dist/commands/task/plan.js +5 -4
  132. package/dist/commands/task/scaffold.d.ts.map +1 -1
  133. package/dist/commands/task/scaffold.js +7 -52
  134. package/dist/commands/task/set-status.d.ts.map +1 -1
  135. package/dist/commands/task/set-status.js +2 -2
  136. package/dist/commands/task/shared/dependencies.d.ts +15 -0
  137. package/dist/commands/task/shared/dependencies.d.ts.map +1 -0
  138. package/dist/commands/task/shared/dependencies.js +143 -0
  139. package/dist/commands/task/shared/docs.d.ts +21 -0
  140. package/dist/commands/task/shared/docs.d.ts.map +1 -0
  141. package/dist/commands/task/shared/docs.js +121 -0
  142. package/dist/commands/task/shared/listing.d.ts +20 -0
  143. package/dist/commands/task/shared/listing.d.ts.map +1 -0
  144. package/dist/commands/task/shared/listing.js +127 -0
  145. package/dist/commands/task/shared/tags.d.ts +24 -0
  146. package/dist/commands/task/shared/tags.d.ts.map +1 -0
  147. package/dist/commands/task/shared/tags.js +177 -0
  148. package/dist/commands/task/shared/transitions.d.ts +42 -0
  149. package/dist/commands/task/shared/transitions.d.ts.map +1 -0
  150. package/dist/commands/task/shared/transitions.js +175 -0
  151. package/dist/commands/task/shared.d.ts +5 -106
  152. package/dist/commands/task/shared.d.ts.map +1 -1
  153. package/dist/commands/task/shared.js +5 -681
  154. package/dist/commands/task/start.d.ts.map +1 -1
  155. package/dist/commands/task/start.js +7 -5
  156. package/dist/commands/task/verify-record.d.ts.map +1 -1
  157. package/dist/commands/task/verify-record.js +9 -25
  158. package/dist/commands/task/verify-show.command.d.ts.map +1 -1
  159. package/dist/commands/task/verify-show.command.js +5 -1
  160. package/dist/commands/upgrade/apply.d.ts +44 -0
  161. package/dist/commands/upgrade/apply.d.ts.map +1 -0
  162. package/dist/commands/upgrade/apply.js +180 -0
  163. package/dist/commands/upgrade/report.d.ts +21 -0
  164. package/dist/commands/upgrade/report.d.ts.map +1 -0
  165. package/dist/commands/upgrade/report.js +81 -0
  166. package/dist/commands/upgrade/source.d.ts +35 -0
  167. package/dist/commands/upgrade/source.d.ts.map +1 -0
  168. package/dist/commands/upgrade/source.js +109 -0
  169. package/dist/commands/upgrade/types.d.ts +31 -0
  170. package/dist/commands/upgrade/types.d.ts.map +1 -0
  171. package/dist/commands/upgrade/types.js +1 -0
  172. package/dist/commands/upgrade.d.ts +1 -35
  173. package/dist/commands/upgrade.d.ts.map +1 -1
  174. package/dist/commands/upgrade.js +46 -331
  175. package/dist/shared/diagnostics.d.ts +23 -0
  176. package/dist/shared/diagnostics.d.ts.map +1 -0
  177. package/dist/shared/diagnostics.js +57 -0
  178. package/dist/shared/errors.d.ts +2 -0
  179. package/dist/shared/errors.d.ts.map +1 -1
  180. package/dist/shared/errors.js +2 -0
  181. package/dist/shared/repo-cli-version.d.ts +13 -0
  182. package/dist/shared/repo-cli-version.d.ts.map +1 -0
  183. package/dist/shared/repo-cli-version.js +63 -0
  184. package/dist/shared/runtime-source.d.ts +33 -0
  185. package/dist/shared/runtime-source.d.ts.map +1 -0
  186. package/dist/shared/runtime-source.js +156 -0
  187. package/dist/shared/version-compare.d.ts +7 -0
  188. package/dist/shared/version-compare.d.ts.map +1 -0
  189. package/dist/shared/version-compare.js +30 -0
  190. package/package.json +2 -2
@@ -11,7 +11,7 @@ function normalizeTaskIdsArg(raw) {
11
11
  export const taskMigrateDocSpec = {
12
12
  id: ["task", "migrate-doc"],
13
13
  group: "Task",
14
- summary: "Migrate task README docs to the current template/metadata format.",
14
+ summary: "Migrate legacy task README docs to the current README v3 template/metadata format.",
15
15
  args: [{ name: "task-id", required: false, variadic: true, valueHint: "<task-id>" }],
16
16
  options: [
17
17
  { kind: "boolean", name: "all", default: false, description: "Migrate all task READMEs." },
@@ -29,6 +29,10 @@ export const taskMigrateDocSpec = {
29
29
  why: "Migrate specific task READMEs.",
30
30
  },
31
31
  ],
32
+ notes: [
33
+ "Use this after framework upgrade when doctor reports active legacy README v2 tasks or an active v2/v3 mixed state.",
34
+ "This command upgrades task-local docs; it does not replace framework-managed files such as AGENTS.md or .agentplane/policy/**.",
35
+ ],
32
36
  validateRaw: (raw) => {
33
37
  const all = raw.opts.all === true;
34
38
  const taskIds = normalizeTaskIdsArg(raw);
@@ -1 +1 @@
1
- {"version":3,"file":"migrate-doc.d.ts","sourceRoot":"","sources":["../../../src/commands/task/migrate-doc.ts"],"names":[],"mappings":"AAmIA,wBAAsB,iBAAiB,CAAC,IAAI,EAAE;IAC5C,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,GAAG,EAAE,OAAO,CAAC;IACb,KAAK,EAAE,OAAO,CAAC;IACf,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,GAAG,OAAO,CAAC,MAAM,CAAC,CAwClB"}
1
+ {"version":3,"file":"migrate-doc.d.ts","sourceRoot":"","sources":["../../../src/commands/task/migrate-doc.ts"],"names":[],"mappings":"AAkSA,wBAAsB,iBAAiB,CAAC,IAAI,EAAE;IAC5C,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,GAAG,EAAE,OAAO,CAAC;IACb,KAAK,EAAE,OAAO,CAAC;IACf,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,GAAG,OAAO,CAAC,MAAM,CAAC,CAwClB"}
@@ -1,14 +1,128 @@
1
1
  import { readdir, readFile } from "node:fs/promises";
2
2
  import path from "node:path";
3
- import { atomicWriteFile, ensureDocSections, extractTaskDoc, loadConfig, mergeTaskDoc, normalizeTaskDoc, parseTaskReadme, renderTaskReadme, resolveProject, } from "@agentplaneorg/core";
3
+ import { atomicWriteFile, ensureDocSections, extractTaskDoc, loadConfig, mergeTaskDoc, normalizeTaskDoc, parseTaskReadme, renderTaskReadme, resolveProject, setMarkdownSection, } from "@agentplaneorg/core";
4
4
  import { mapCoreError } from "../../cli/error-map.js";
5
5
  import { exitCodeForError } from "../../cli/exit-codes.js";
6
6
  import { fileExists, getPathKind } from "../../cli/fs-utils.js";
7
7
  import { successMessage } from "../../cli/output.js";
8
8
  import { CliError } from "../../shared/errors.js";
9
+ import { extractDocSection, extractTaskObservationSection, normalizeTaskDocVersion, normalizeVerificationSectionLayout, } from "./shared/docs.js";
10
+ import { defaultTaskDocV3 } from "./doc-template.js";
11
+ const V3_CANONICAL_ORDER = [
12
+ "Summary",
13
+ "Context",
14
+ "Scope",
15
+ "Plan",
16
+ "Verify Steps",
17
+ "Verification",
18
+ "Rollback Plan",
19
+ "Findings",
20
+ ];
21
+ const HUMAN_TEXT_SECTIONS = new Set(["summary", "context", "scope", "plan", "findings", "notes"]);
9
22
  function isRecord(value) {
10
23
  return Boolean(value) && typeof value === "object" && !Array.isArray(value);
11
24
  }
25
+ function normalizeSectionKey(section) {
26
+ return section.trim().replaceAll(/\s+/g, " ").toLowerCase();
27
+ }
28
+ function parseMarkdownSections(doc) {
29
+ const lines = doc.replaceAll("\r\n", "\n").split("\n");
30
+ const sections = [];
31
+ let current = null;
32
+ for (const line of lines) {
33
+ const match = /^##\s+(.*)$/.exec(line.trim());
34
+ if (match) {
35
+ if (current) {
36
+ current.text = current.text.trimEnd();
37
+ sections.push(current);
38
+ }
39
+ current = { title: (match[1] ?? "").trim(), text: "" };
40
+ continue;
41
+ }
42
+ if (current) {
43
+ current.text = current.text.length > 0 ? `${current.text}\n${line}` : line;
44
+ }
45
+ }
46
+ if (current) {
47
+ current.text = current.text.trimEnd();
48
+ sections.push(current);
49
+ }
50
+ return sections;
51
+ }
52
+ function renderMarkdownSections(sections) {
53
+ return sections
54
+ .map((section) => {
55
+ const text = section.text.trimEnd();
56
+ return text ? `## ${section.title}\n\n${text}` : `## ${section.title}\n`;
57
+ })
58
+ .join("\n\n")
59
+ .trimEnd();
60
+ }
61
+ function normalizeLiteralNewlinesInHumanSection(title, text) {
62
+ if (!HUMAN_TEXT_SECTIONS.has(normalizeSectionKey(title)))
63
+ return text.trimEnd();
64
+ let next = text.replaceAll("\r\n", "\n");
65
+ const escapedDoubleNewline = next.includes(String.raw `\n\n`) || next.includes(String.raw `\r\n\r\n`);
66
+ const escapedNewlineMatches = next.match(/\\n/g) ?? [];
67
+ if (escapedDoubleNewline || escapedNewlineMatches.length >= 2) {
68
+ next = next.replaceAll(String.raw `\r\n`, "\n").replaceAll(String.raw `\n`, "\n");
69
+ }
70
+ return next.trimEnd();
71
+ }
72
+ function firstSectionText(sections, title) {
73
+ const target = normalizeSectionKey(title);
74
+ return sections.find((section) => normalizeSectionKey(section.title) === target)?.text ?? null;
75
+ }
76
+ function mergeObservationText(doc, version) {
77
+ const preferred = extractTaskObservationSection(doc, version)?.trim() ?? "";
78
+ const notes = extractDocSection(doc, "Notes")?.trim() ?? "";
79
+ const findings = extractDocSection(doc, "Findings")?.trim() ?? "";
80
+ const out = [];
81
+ for (const candidate of [preferred, findings, notes]) {
82
+ if (!candidate)
83
+ continue;
84
+ if (out.includes(candidate))
85
+ continue;
86
+ out.push(candidate);
87
+ }
88
+ return out.join("\n\n").trim();
89
+ }
90
+ function migrateDocToV3(opts) {
91
+ const currentSections = parseMarkdownSections(opts.doc);
92
+ const defaultSections = parseMarkdownSections(defaultTaskDocV3({ title: opts.title, description: opts.description }));
93
+ const emitted = new Set();
94
+ const nextSections = [];
95
+ const observationText = mergeObservationText(opts.doc, 2);
96
+ for (const title of V3_CANONICAL_ORDER) {
97
+ const key = normalizeSectionKey(title);
98
+ const currentText = firstSectionText(currentSections, title);
99
+ const defaultText = firstSectionText(defaultSections, title) ?? "";
100
+ let nextText = currentText ?? defaultText;
101
+ if (title === "Context" && !(currentText ?? "").trim())
102
+ continue;
103
+ if (title === "Verification") {
104
+ nextText = normalizeVerificationSectionLayout(currentText ?? defaultText, 3);
105
+ }
106
+ if (title === "Findings") {
107
+ nextText = observationText || defaultText;
108
+ }
109
+ if (nextText === null)
110
+ continue;
111
+ nextText = normalizeLiteralNewlinesInHumanSection(title, nextText);
112
+ nextSections.push({ title, text: nextText.trimEnd() });
113
+ emitted.add(key);
114
+ if (title === "Findings")
115
+ emitted.add("notes");
116
+ }
117
+ for (const section of currentSections) {
118
+ const key = normalizeSectionKey(section.title);
119
+ if (emitted.has(key))
120
+ continue;
121
+ nextSections.push({ title: section.title, text: section.text.trimEnd() });
122
+ emitted.add(key);
123
+ }
124
+ return renderMarkdownSections(nextSections);
125
+ }
12
126
  function ensurePlanApprovalFrontmatter(frontmatter) {
13
127
  const raw = frontmatter.plan_approval;
14
128
  if (isRecord(raw) && typeof raw.state === "string")
@@ -74,7 +188,27 @@ async function migrateTaskReadmeDoc(opts) {
74
188
  const required = opts.config.tasks.doc.required_sections;
75
189
  const extracted = extractTaskDoc(parsed.body);
76
190
  const baseDoc = extracted || parsed.body;
77
- const nextDoc = normalizeTaskDoc(ensureDocSections(baseDoc, required));
191
+ let nextDoc = normalizeTaskDoc(ensureDocSections(baseDoc, required));
192
+ const docVersion = normalizeTaskDocVersion(frontmatter.doc_version);
193
+ if (docVersion === 2) {
194
+ frontmatter.doc_version = 3;
195
+ nextDoc = migrateDocToV3({
196
+ title: typeof frontmatter.title === "string" ? frontmatter.title : "",
197
+ description: typeof frontmatter.description === "string" ? frontmatter.description : "",
198
+ doc: nextDoc,
199
+ });
200
+ }
201
+ else {
202
+ const verificationSection = extractDocSection(nextDoc, "Verification");
203
+ const normalizedVerification = normalizeVerificationSectionLayout(verificationSection, docVersion);
204
+ nextDoc = setMarkdownSection(nextDoc, "Verification", normalizedVerification);
205
+ for (const sectionTitle of ["Summary", "Context", "Scope", "Plan", "Findings", "Notes"]) {
206
+ const sectionText = extractDocSection(nextDoc, sectionTitle);
207
+ if (sectionText == null)
208
+ continue;
209
+ nextDoc = setMarkdownSection(nextDoc, sectionTitle, normalizeLiteralNewlinesInHumanSection(sectionTitle, sectionText));
210
+ }
211
+ }
78
212
  const nextBody = extracted ? mergeTaskDoc(parsed.body, nextDoc) : nextDoc;
79
213
  const rendered = renderTaskReadme(frontmatter, nextBody);
80
214
  const next = rendered.endsWith("\n") ? rendered : `${rendered}\n`;
@@ -1 +1 @@
1
- {"version":3,"file":"new.d.ts","sourceRoot":"","sources":["../../../src/commands/task/new.ts"],"names":[],"mappings":"AAMA,OAAO,EAAsB,KAAK,cAAc,EAAE,MAAM,2BAA2B,CAAC;AASpF,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,KAAK,GAAG,QAAQ,GAAG,KAAK,GAAG,MAAM,CAAC;IAC5C,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;AA6LF,wBAAsB,gBAAgB,CAAC,IAAI,EAAE;IAC3C,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,aAAa,CAAC;CACvB,GAAG,OAAO,CAAC,MAAM,CAAC,CAoFlB"}
1
+ {"version":3,"file":"new.d.ts","sourceRoot":"","sources":["../../../src/commands/task/new.ts"],"names":[],"mappings":"AAMA,OAAO,EAAsB,KAAK,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAcpF,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,KAAK,GAAG,QAAQ,GAAG,KAAK,GAAG,MAAM,CAAC;IAC5C,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;AAmDF,wBAAsB,gBAAgB,CAAC,IAAI,EAAE;IAC3C,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,aAAa,CAAC;CACvB,GAAG,OAAO,CAAC,MAAM,CAAC,CAgFlB"}
@@ -1,9 +1,10 @@
1
- import { ensureDocSections, setMarkdownSection } from "@agentplaneorg/core";
1
+ import { setMarkdownSection } from "@agentplaneorg/core";
2
2
  import { mapBackendError } from "../../cli/error-map.js";
3
3
  import { backendNotSupportedMessage, warnMessage } from "../../cli/output.js";
4
4
  import { CliError } from "../../shared/errors.js";
5
5
  import { loadCommandContext } from "../shared/task-backend.js";
6
6
  import { ensureTaskDependsOnGraphIsAcyclic, nowIso, requiresVerifyStepsByPrimary, resolvePrimaryTag, warnIfUnknownOwner, } from "./shared.js";
7
+ import { buildDefaultVerifyStepsSection, defaultTaskDocV3, TASK_DOC_VERSION_V3, } from "./doc-template.js";
7
8
  function dedupeTrimmed(values) {
8
9
  const seen = new Set();
9
10
  const out = [];
@@ -51,109 +52,6 @@ function sanitizeTaskNewParsed(p) {
51
52
  const verify = dedupeTrimmed(p.verify);
52
53
  return { ...p, title, description, owner, tags, dependsOn, verify };
53
54
  }
54
- function insertMarkdownSectionBefore(opts) {
55
- const normalized = opts.body.replaceAll("\r\n", "\n");
56
- if (normalized.includes(`## ${opts.section}`)) {
57
- return setMarkdownSection(normalized, opts.section, opts.text);
58
- }
59
- const lines = normalized.split("\n");
60
- const beforeHeading = `## ${opts.beforeSection}`;
61
- const beforeIdx = lines.findIndex((line) => line.trim() === beforeHeading);
62
- if (beforeIdx === -1)
63
- return setMarkdownSection(normalized, opts.section, opts.text);
64
- const textLines = opts.text.replaceAll("\r\n", "\n").split("\n");
65
- const sectionLines = [`## ${opts.section}`, "", ...textLines, "", ""];
66
- const out = [...lines.slice(0, beforeIdx), ...sectionLines, ...lines.slice(beforeIdx)];
67
- return `${out.join("\n").trimEnd()}\n`;
68
- }
69
- function buildDefaultSummary(opts) {
70
- return `${opts.title}\n\n${opts.description}`;
71
- }
72
- function buildDefaultScope(opts) {
73
- return [
74
- `- In scope: ${opts.description}.`,
75
- `- Out of scope: unrelated refactors not required for "${opts.title}".`,
76
- ].join("\n");
77
- }
78
- function buildDefaultPlan(opts) {
79
- return [
80
- `1. Implement the change for "${opts.title}".`,
81
- "2. Run required checks and capture verification evidence.",
82
- "3. Finalize task notes and finish with traceable commit metadata.",
83
- ].join("\n");
84
- }
85
- function buildDefaultRisks() {
86
- return [
87
- "- Risk: hidden regressions in touched paths.",
88
- "- Mitigation: run required checks before finish and record evidence.",
89
- ].join("\n");
90
- }
91
- function buildDefaultRollbackPlan() {
92
- return [
93
- "- Revert task-related commit(s).",
94
- "- Re-run required checks to confirm rollback safety.",
95
- ].join("\n");
96
- }
97
- function defaultTaskDoc(opts) {
98
- const verifyStepsTemplate = [
99
- "<!-- TODO: FILL VERIFY STEPS -->",
100
- "",
101
- "### Scope",
102
- "",
103
- "",
104
- "### Checks",
105
- "",
106
- "",
107
- "### Evidence / Commands",
108
- "",
109
- "",
110
- "### Pass criteria",
111
- "",
112
- "",
113
- ].join("\n");
114
- const verificationTemplate = [
115
- "### Plan",
116
- "",
117
- "",
118
- "### Results",
119
- "",
120
- "",
121
- "<!-- BEGIN VERIFICATION RESULTS -->",
122
- "<!-- END VERIFICATION RESULTS -->",
123
- ].join("\n");
124
- const baseDoc = ensureDocSections("", opts.requiredSections);
125
- const withVerifySteps = insertMarkdownSectionBefore({
126
- body: baseDoc,
127
- section: "Verify Steps",
128
- text: verifyStepsTemplate,
129
- beforeSection: "Verification",
130
- });
131
- const withVerification = setMarkdownSection(withVerifySteps, "Verification", verificationTemplate);
132
- const withSummary = setMarkdownSection(withVerification, "Summary", buildDefaultSummary({ title: opts.title, description: opts.description }));
133
- const withScope = setMarkdownSection(withSummary, "Scope", buildDefaultScope({ title: opts.title, description: opts.description }));
134
- const withPlan = setMarkdownSection(withScope, "Plan", buildDefaultPlan({ title: opts.title }));
135
- const withRisks = setMarkdownSection(withPlan, "Risks", buildDefaultRisks());
136
- return setMarkdownSection(withRisks, "Rollback Plan", buildDefaultRollbackPlan());
137
- }
138
- function buildDefaultVerifyStepsSection(opts) {
139
- const checks = opts.verifyCommands.length > 0
140
- ? opts.verifyCommands.map((command) => `- \`${command}\``).join("\n")
141
- : "- Add explicit checks/commands for this task before approval.";
142
- return [
143
- "### Scope",
144
- `- Primary tag: \`${opts.primary}\``,
145
- "",
146
- "### Checks",
147
- checks,
148
- "",
149
- "### Evidence / Commands",
150
- "- Record executed commands and key outputs.",
151
- "",
152
- "### Pass criteria",
153
- "- Steps are reproducible and produce expected results.",
154
- "",
155
- ].join("\n");
156
- }
157
55
  export async function runTaskNewParsed(opts) {
158
56
  const p = sanitizeTaskNewParsed(opts.parsed);
159
57
  try {
@@ -179,15 +77,11 @@ export async function runTaskNewParsed(opts) {
179
77
  depends_on: p.dependsOn,
180
78
  verify: p.verify,
181
79
  comments: [],
182
- doc_version: 2,
80
+ doc_version: TASK_DOC_VERSION_V3,
183
81
  doc_updated_at: nowIso(),
184
82
  doc_updated_by: p.owner,
185
83
  id_source: "generated",
186
- doc: defaultTaskDoc({
187
- requiredSections: ctx.config.tasks.doc.required_sections,
188
- title: p.title,
189
- description: p.description,
190
- }),
84
+ doc: defaultTaskDocV3({ title: p.title, description: p.description }),
191
85
  };
192
86
  const spikeTag = (ctx.config.tasks.verify.spike_tag ?? "spike").trim().toLowerCase();
193
87
  const primary = resolvePrimaryTag(p.tags, ctx);
@@ -3,7 +3,7 @@ export const taskNewSpec = {
3
3
  id: ["task", "new"],
4
4
  group: "Task",
5
5
  summary: "Create a new task (prints the generated task id).",
6
- description: "Creates a TODO task with doc_version=2, seeds standard README sections, and writes it via the configured task backend.",
6
+ description: "Creates a TODO task with doc_version=3, seeds the README v3 section layout, and writes it via the configured task backend.",
7
7
  options: [
8
8
  {
9
9
  kind: "string",
@@ -65,8 +65,8 @@ export const taskNewSpec = {
65
65
  },
66
66
  ],
67
67
  notes: [
68
- "Task README scaffolding is applied automatically during creation.",
69
- "For verify-required primary tags, this command seeds a default ## Verify Steps section in README.",
68
+ "Task creation defaults to doc_version=3 and seeds the README v3 section contract automatically.",
69
+ "For verify-required primary tags, this command seeds a default ## Verify Steps acceptance contract in README.",
70
70
  ],
71
71
  parse: (raw) => ({
72
72
  title: raw.opts.title,
@@ -1 +1 @@
1
- {"version":3,"file":"plan.d.ts","sourceRoot":"","sources":["../../../src/commands/task/plan.ts"],"names":[],"mappings":"AASA,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,2BAA2B,CAAC;AAoDnC,wBAAsB,cAAc,CAAC,IAAI,EAAE;IACzC,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GAAG,OAAO,CAAC,MAAM,CAAC,CA6ElB;AAED,wBAAsB,kBAAkB,CAAC,IAAI,EAAE;IAC7C,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,CAAC,EAAE,MAAM,CAAC;CACf,GAAG,OAAO,CAAC,MAAM,CAAC,CAsFlB;AAED,wBAAsB,iBAAiB,CAAC,IAAI,EAAE;IAC5C,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;CACd,GAAG,OAAO,CAAC,MAAM,CAAC,CAuDlB"}
1
+ {"version":3,"file":"plan.d.ts","sourceRoot":"","sources":["../../../src/commands/task/plan.ts"],"names":[],"mappings":"AASA,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,2BAA2B,CAAC;AAuDnC,wBAAsB,cAAc,CAAC,IAAI,EAAE;IACzC,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GAAG,OAAO,CAAC,MAAM,CAAC,CA6ElB;AAED,wBAAsB,kBAAkB,CAAC,IAAI,EAAE;IAC7C,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,CAAC,EAAE,MAAM,CAAC;CACf,GAAG,OAAO,CAAC,MAAM,CAAC,CA4FlB;AAED,wBAAsB,iBAAiB,CAAC,IAAI,EAAE;IAC5C,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;CACd,GAAG,OAAO,CAAC,MAAM,CAAC,CAuDlB"}
@@ -6,7 +6,7 @@ import { backendNotSupportedMessage } from "../../cli/output.js";
6
6
  import { CliError } from "../../shared/errors.js";
7
7
  import { loadCommandContext, loadTaskFromContext, } from "../shared/task-backend.js";
8
8
  import { backendIsLocalFileBackend, getTaskStore } from "../shared/task-store.js";
9
- import { ensureAgentFilledRequiredDocSections, extractDocSection, isVerifyStepsFilled, nowIso, requiresVerifyStepsByPrimary, toStringArray, } from "./shared.js";
9
+ import { ensureAgentFilledRequiredDocSections, extractDocSection, extractTaskObservationSection, isVerifyStepsFilled, nowIso, normalizeTaskDocVersion, taskObservationSectionName, requiresVerifyStepsByPrimary, toStringArray, } from "./shared.js";
10
10
  async function loadPlanTask(opts) {
11
11
  const ctx = opts.ctx ??
12
12
  (await loadCommandContext({ cwd: opts.cwd, rootOverride: opts.rootOverride ?? null }));
@@ -153,12 +153,13 @@ export async function cmdTaskPlanApprove(opts) {
153
153
  }
154
154
  }
155
155
  if (isSpike) {
156
- const notes = extractDocSection(baseDoc, "Notes");
157
- if (!notes || notes.trim().length === 0) {
156
+ const observationSection = taskObservationSectionName(normalizeTaskDocVersion(task.doc_version));
157
+ const observation = extractTaskObservationSection(baseDoc, normalizeTaskDocVersion(task.doc_version));
158
+ if (!observation || observation.trim().length === 0) {
158
159
  throw new CliError({
159
160
  exitCode: 3,
160
161
  code: "E_VALIDATION",
161
- message: `${task.id}: cannot approve plan for spike: ## Notes section is missing or empty ` +
162
+ message: `${task.id}: cannot approve plan for spike: ## ${observationSection} section is missing or empty ` +
162
163
  "(include Findings/Decision/Next Steps)",
163
164
  });
164
165
  }
@@ -1 +1 @@
1
- {"version":3,"file":"scaffold.d.ts","sourceRoot":"","sources":["../../../src/commands/task/scaffold.ts"],"names":[],"mappings":"AAcA,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,2BAA2B,CAAC;AA8BnC,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,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,OAAO,CAAC;IACf,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,OAAO,CAAC;CAChB,GAAG,OAAO,CAAC,MAAM,CAAC,CAuHlB"}
1
+ {"version":3,"file":"scaffold.d.ts","sourceRoot":"","sources":["../../../src/commands/task/scaffold.ts"],"names":[],"mappings":"AASA,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,2BAA2B,CAAC;AAMnC,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,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,OAAO,CAAC;IACf,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,OAAO,CAAC;CAChB,GAAG,OAAO,CAAC,MAAM,CAAC,CA0FlB"}
@@ -1,6 +1,6 @@
1
1
  import { mkdir, readFile } from "node:fs/promises";
2
2
  import path from "node:path";
3
- import { ensureDocSections, renderTaskReadme, setMarkdownSection, taskReadmePath, } from "@agentplaneorg/core";
3
+ import { renderTaskReadme, taskReadmePath } from "@agentplaneorg/core";
4
4
  import { mapBackendError } from "../../cli/error-map.js";
5
5
  import { successMessage, unknownEntityMessage } from "../../cli/output.js";
6
6
  import { CliError } from "../../shared/errors.js";
@@ -8,23 +8,7 @@ import { loadCommandContext, taskDataToFrontmatter, } from "../shared/task-backe
8
8
  import { writeTextIfChanged } from "../../shared/write-if-changed.js";
9
9
  import { nowIso } from "./shared.js";
10
10
  import { ensureActionApproved } from "../shared/approval-requirements.js";
11
- function insertMarkdownSectionBefore(opts) {
12
- const normalized = opts.body.replaceAll("\r\n", "\n");
13
- if (normalized.includes(`## ${opts.section}`)) {
14
- return setMarkdownSection(normalized, opts.section, opts.text);
15
- }
16
- const lines = normalized.split("\n");
17
- const beforeHeading = `## ${opts.beforeSection}`;
18
- const beforeIdx = lines.findIndex((line) => line.trim() === beforeHeading);
19
- if (beforeIdx === -1) {
20
- // Fallback: append at the end if we can't find the insertion anchor.
21
- return setMarkdownSection(normalized, opts.section, opts.text);
22
- }
23
- const textLines = opts.text.replaceAll("\r\n", "\n").split("\n");
24
- const sectionLines = [`## ${opts.section}`, "", ...textLines, "", ""];
25
- const out = [...lines.slice(0, beforeIdx), ...sectionLines, ...lines.slice(beforeIdx)];
26
- return `${out.join("\n").trimEnd()}\n`;
27
- }
11
+ import { defaultTaskDocV3, TASK_DOC_VERSION_V3 } from "./doc-template.js";
28
12
  export async function cmdTaskScaffold(opts) {
29
13
  try {
30
14
  const ctx = opts.ctx ??
@@ -79,7 +63,7 @@ export async function cmdTaskScaffold(opts) {
79
63
  tags: [],
80
64
  verify: [],
81
65
  comments: [],
82
- doc_version: 2,
66
+ doc_version: TASK_DOC_VERSION_V3,
83
67
  doc_updated_at: nowIso(),
84
68
  doc_updated_by: "UNKNOWN",
85
69
  };
@@ -90,41 +74,12 @@ export async function cmdTaskScaffold(opts) {
90
74
  baseTask.doc_updated_by.trim().toLowerCase() === "agentplane") {
91
75
  baseTask.doc_updated_by = baseTask.owner?.trim() ? baseTask.owner : "UNKNOWN";
92
76
  }
77
+ baseTask.doc_version = TASK_DOC_VERSION_V3;
93
78
  const frontmatter = taskDataToFrontmatter(baseTask);
94
- const verifyStepsTemplate = [
95
- "<!-- TODO: FILL VERIFY STEPS -->",
96
- "",
97
- "### Scope",
98
- "",
99
- "",
100
- "### Checks",
101
- "",
102
- "",
103
- "### Evidence / Commands",
104
- "",
105
- "",
106
- "### Pass criteria",
107
- "",
108
- "",
109
- ].join("\n");
110
- const verificationTemplate = [
111
- "### Plan",
112
- "",
113
- "",
114
- "### Results",
115
- "",
116
- "",
117
- "<!-- BEGIN VERIFICATION RESULTS -->",
118
- "<!-- END VERIFICATION RESULTS -->",
119
- ].join("\n");
120
- const baseDoc = ensureDocSections("", config.tasks.doc.required_sections);
121
- const withVerifySteps = insertMarkdownSectionBefore({
122
- body: baseDoc,
123
- section: "Verify Steps",
124
- text: verifyStepsTemplate,
125
- beforeSection: "Verification",
79
+ const body = defaultTaskDocV3({
80
+ title: baseTask.title,
81
+ description: baseTask.description ?? "",
126
82
  });
127
- const body = setMarkdownSection(withVerifySteps, "Verification", verificationTemplate);
128
83
  const text = renderTaskReadme(frontmatter, body);
129
84
  await mkdir(path.dirname(readmePath), { recursive: true });
130
85
  await writeTextIfChanged(readmePath, text.endsWith("\n") ? text : `${text}\n`);
@@ -1 +1 @@
1
- {"version":3,"file":"set-status.d.ts","sourceRoot":"","sources":["../../../src/commands/task/set-status.ts"],"names":[],"mappings":"AAQA,OAAO,EAIL,KAAK,cAAc,EACpB,MAAM,2BAA2B,CAAC;AAgBnC,wBAAsB,gBAAgB,CAAC,IAAI,EAAE;IAC3C,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,OAAO,CAAC;IACf,GAAG,EAAE,OAAO,CAAC;IACb,iBAAiB,EAAE,OAAO,CAAC;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,eAAe,EAAE,OAAO,CAAC;IACzB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,kBAAkB,EAAE,OAAO,CAAC;IAC5B,mBAAmB,EAAE,OAAO,CAAC;IAC7B,KAAK,EAAE,OAAO,CAAC;CAChB,GAAG,OAAO,CAAC,MAAM,CAAC,CAwJlB"}
1
+ {"version":3,"file":"set-status.d.ts","sourceRoot":"","sources":["../../../src/commands/task/set-status.ts"],"names":[],"mappings":"AAQA,OAAO,EAIL,KAAK,cAAc,EACpB,MAAM,2BAA2B,CAAC;AAiBnC,wBAAsB,gBAAgB,CAAC,IAAI,EAAE;IAC3C,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,OAAO,CAAC;IACf,GAAG,EAAE,OAAO,CAAC;IACb,iBAAiB,EAAE,OAAO,CAAC;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,eAAe,EAAE,OAAO,CAAC;IACzB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,kBAAkB,EAAE,OAAO,CAAC;IAC5B,mBAAmB,EAAE,OAAO,CAAC;IAC7B,KAAK,EAAE,OAAO,CAAC;CAChB,GAAG,OAAO,CAAC,MAAM,CAAC,CAwJlB"}
@@ -6,7 +6,7 @@ import { commitFromComment } from "../guard/index.js";
6
6
  import { ensureActionApproved } from "../shared/approval-requirements.js";
7
7
  import { loadCommandContext, loadTaskFromContext, resolveDocUpdatedBy, } from "../shared/task-backend.js";
8
8
  import { backendIsLocalFileBackend, getTaskStore } from "../shared/task-store.js";
9
- import { appendTaskEvent, defaultCommitEmojiForStatus, ensureCommentCommitAllowed, ensureStatusTransitionAllowed, normalizeTaskStatus, nowIso, readCommitInfo, resolveTaskDependencyState, resolvePrimaryTag, toStringArray, } from "./shared.js";
9
+ import { appendTaskEvent, defaultCommitEmojiForStatus, ensureCommentCommitAllowed, ensureStatusTransitionAllowed, normalizeTaskDocVersion, normalizeTaskStatus, nowIso, readCommitInfo, resolveTaskDependencyState, resolvePrimaryTag, toStringArray, } from "./shared.js";
10
10
  export async function cmdTaskSetStatus(opts) {
11
11
  const nextStatus = normalizeTaskStatus(opts.status);
12
12
  if (nextStatus === "DONE" && !opts.force) {
@@ -99,7 +99,7 @@ export async function cmdTaskSetStatus(opts) {
99
99
  to: nextStatus,
100
100
  note: commentBody,
101
101
  }),
102
- doc_version: 2,
102
+ doc_version: normalizeTaskDocVersion(task.doc_version),
103
103
  doc_updated_at: at,
104
104
  doc_updated_by: eventAuthor,
105
105
  };
@@ -0,0 +1,15 @@
1
+ import type { TaskBackend, TaskData } from "../../../backends/task-backend.js";
2
+ export type DependencyState = {
3
+ dependsOn: string[];
4
+ missing: string[];
5
+ incomplete: string[];
6
+ };
7
+ export declare function ensureTaskDependsOnGraphIsAcyclic(opts: {
8
+ backend: Pick<TaskBackend, "listTasks">;
9
+ taskId: string;
10
+ dependsOn: string[];
11
+ }): Promise<void>;
12
+ export declare function resolveTaskDependencyState(task: TaskData, backend: Pick<TaskBackend, "getTask" | "getTasks">): Promise<DependencyState>;
13
+ export declare function buildDependencyState(tasks: TaskData[]): Map<string, DependencyState>;
14
+ export declare function formatTaskLine(task: TaskData, depState?: DependencyState): string;
15
+ //# sourceMappingURL=dependencies.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dependencies.d.ts","sourceRoot":"","sources":["../../../../src/commands/task/shared/dependencies.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAK/E,MAAM,MAAM,eAAe,GAAG;IAC5B,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AAkCF,wBAAsB,iCAAiC,CAAC,IAAI,EAAE;IAC5D,OAAO,EAAE,IAAI,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;IACxC,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB,GAAG,OAAO,CAAC,IAAI,CAAC,CA2BhB;AAED,wBAAsB,0BAA0B,CAC9C,IAAI,EAAE,QAAQ,EACd,OAAO,EAAE,IAAI,CAAC,WAAW,EAAE,SAAS,GAAG,UAAU,CAAC,GACjD,OAAO,CAAC,eAAe,CAAC,CAuB1B;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,QAAQ,EAAE,GAAG,GAAG,CAAC,MAAM,EAAE,eAAe,CAAC,CAqBpF;AAgBD,wBAAgB,cAAc,CAAC,IAAI,EAAE,QAAQ,EAAE,QAAQ,CAAC,EAAE,eAAe,GAAG,MAAM,CAejF"}