agentplane 0.3.13 → 0.3.15

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 (278) hide show
  1. package/assets/RUNNER.md +1 -1
  2. package/assets/agents/ORCHESTRATOR.json +1 -1
  3. package/assets/agents/SKILL_EXTRACTOR.json +31 -0
  4. package/assets/framework.manifest.json +7 -0
  5. package/assets/policy/incidents.md +5 -3
  6. package/assets/policy/workflow.branch_pr.md +10 -5
  7. package/dist/.build-manifest.json +280 -180
  8. package/dist/cli/output.d.ts +29 -0
  9. package/dist/cli/output.d.ts.map +1 -1
  10. package/dist/cli/output.js +33 -0
  11. package/dist/cli/run-cli/command-catalog/core.d.ts.map +1 -1
  12. package/dist/cli/run-cli/command-catalog/core.js +29 -87
  13. package/dist/cli/run-cli/command-catalog/lifecycle.d.ts.map +1 -1
  14. package/dist/cli/run-cli/command-catalog/lifecycle.js +4 -12
  15. package/dist/cli/run-cli/command-catalog/project.d.ts +1 -1
  16. package/dist/cli/run-cli/command-catalog/project.d.ts.map +1 -1
  17. package/dist/cli/run-cli/command-catalog/project.js +16 -38
  18. package/dist/cli/run-cli/command-catalog/shared.d.ts +9 -6
  19. package/dist/cli/run-cli/command-catalog/shared.d.ts.map +1 -1
  20. package/dist/cli/run-cli/command-catalog/shared.js +23 -6
  21. package/dist/cli/run-cli/command-catalog/task.d.ts.map +1 -1
  22. package/dist/cli/run-cli/command-catalog/task.js +6 -18
  23. package/dist/cli/run-cli/command-catalog.d.ts +1 -1
  24. package/dist/cli/run-cli/command-catalog.d.ts.map +1 -1
  25. package/dist/cli/run-cli/commands/init/recipes.d.ts.map +1 -1
  26. package/dist/cli/run-cli/commands/init/recipes.js +1 -0
  27. package/dist/cli/run-cli.js +1 -1
  28. package/dist/cli/run-cli.test-helpers.d.ts +1 -74
  29. package/dist/cli/run-cli.test-helpers.d.ts.map +1 -1
  30. package/dist/cli/run-cli.test-helpers.js +1 -769
  31. package/dist/commands/branch/cleanup-merged.d.ts.map +1 -1
  32. package/dist/commands/branch/cleanup-merged.js +5 -9
  33. package/dist/commands/branch/work-start.command.d.ts.map +1 -1
  34. package/dist/commands/branch/work-start.command.js +1 -0
  35. package/dist/commands/commit.spec.d.ts.map +1 -1
  36. package/dist/commands/commit.spec.js +2 -0
  37. package/dist/commands/doctor/branch-pr.d.ts +1 -1
  38. package/dist/commands/doctor/branch-pr.d.ts.map +1 -1
  39. package/dist/commands/doctor/branch-pr.js +5 -2
  40. package/dist/commands/guard/impl/commands.d.ts.map +1 -1
  41. package/dist/commands/guard/impl/commands.js +4 -1
  42. package/dist/commands/guard/impl/comment-commit.d.ts.map +1 -1
  43. package/dist/commands/guard/impl/comment-commit.js +2 -1
  44. package/dist/commands/guard/impl/env.d.ts +6 -0
  45. package/dist/commands/guard/impl/env.d.ts.map +1 -1
  46. package/dist/commands/guard/impl/env.js +41 -0
  47. package/dist/commands/pr/internal/auto-commit.d.ts.map +1 -1
  48. package/dist/commands/pr/internal/auto-commit.js +2 -1
  49. package/dist/commands/pr/internal/sync-branch.d.ts +36 -0
  50. package/dist/commands/pr/internal/sync-branch.d.ts.map +1 -0
  51. package/dist/commands/pr/internal/sync-branch.js +113 -0
  52. package/dist/commands/pr/internal/sync-github.d.ts +28 -0
  53. package/dist/commands/pr/internal/sync-github.d.ts.map +1 -0
  54. package/dist/commands/pr/internal/sync-github.js +178 -0
  55. package/dist/commands/pr/internal/sync-model.d.ts +36 -0
  56. package/dist/commands/pr/internal/sync-model.d.ts.map +1 -0
  57. package/dist/commands/pr/internal/sync-model.js +1 -0
  58. package/dist/commands/pr/internal/sync-open-step.d.ts +10 -0
  59. package/dist/commands/pr/internal/sync-open-step.d.ts.map +1 -0
  60. package/dist/commands/pr/internal/sync-open-step.js +128 -0
  61. package/dist/commands/pr/internal/sync-support.d.ts +7 -0
  62. package/dist/commands/pr/internal/sync-support.d.ts.map +1 -0
  63. package/dist/commands/pr/internal/sync-support.js +29 -0
  64. package/dist/commands/pr/internal/sync-update-step.d.ts +6 -0
  65. package/dist/commands/pr/internal/sync-update-step.d.ts.map +1 -0
  66. package/dist/commands/pr/internal/sync-update-step.js +68 -0
  67. package/dist/commands/pr/internal/sync.d.ts +2 -6
  68. package/dist/commands/pr/internal/sync.d.ts.map +1 -1
  69. package/dist/commands/pr/internal/sync.js +83 -529
  70. package/dist/commands/pr/open.d.ts.map +1 -1
  71. package/dist/commands/pr/open.js +25 -8
  72. package/dist/commands/pr/pr.command.d.ts.map +1 -1
  73. package/dist/commands/pr/pr.command.js +7 -2
  74. package/dist/commands/recipes/impl/apply.d.ts +1 -1
  75. package/dist/commands/recipes/impl/apply.d.ts.map +1 -1
  76. package/dist/commands/recipes/impl/apply.js +1 -2
  77. package/dist/commands/recipes/impl/commands/active.d.ts.map +1 -1
  78. package/dist/commands/recipes/impl/commands/active.js +6 -5
  79. package/dist/commands/recipes/impl/commands/add.d.ts +1 -0
  80. package/dist/commands/recipes/impl/commands/add.d.ts.map +1 -1
  81. package/dist/commands/recipes/impl/commands/add.js +32 -27
  82. package/dist/commands/recipes/impl/commands/detach.d.ts.map +1 -1
  83. package/dist/commands/recipes/impl/commands/detach.js +35 -21
  84. package/dist/commands/recipes/impl/commands/disable.d.ts.map +1 -1
  85. package/dist/commands/recipes/impl/commands/disable.js +5 -3
  86. package/dist/commands/recipes/impl/commands/enable.d.ts.map +1 -1
  87. package/dist/commands/recipes/impl/commands/enable.js +5 -3
  88. package/dist/commands/recipes/impl/commands/explain.d.ts.map +1 -1
  89. package/dist/commands/recipes/impl/commands/explain.js +57 -47
  90. package/dist/commands/recipes/impl/commands/info.d.ts.map +1 -1
  91. package/dist/commands/recipes/impl/commands/info.js +25 -21
  92. package/dist/commands/recipes/impl/commands/install.d.ts +1 -1
  93. package/dist/commands/recipes/impl/commands/install.d.ts.map +1 -1
  94. package/dist/commands/recipes/impl/commands/install.js +3 -13
  95. package/dist/commands/recipes/impl/commands/list-remote.d.ts.map +1 -1
  96. package/dist/commands/recipes/impl/commands/list-remote.js +2 -3
  97. package/dist/commands/recipes/impl/commands/list.d.ts.map +1 -1
  98. package/dist/commands/recipes/impl/commands/list.js +7 -6
  99. package/dist/commands/recipes/impl/commands/remove.d.ts.map +1 -1
  100. package/dist/commands/recipes/impl/commands/remove.js +12 -7
  101. package/dist/commands/recipes/impl/commands/update.d.ts.map +1 -1
  102. package/dist/commands/recipes/impl/commands/update.js +38 -24
  103. package/dist/commands/recipes/impl/index.d.ts +1 -1
  104. package/dist/commands/recipes/impl/index.d.ts.map +1 -1
  105. package/dist/commands/recipes/impl/installed-recipes.d.ts +1 -1
  106. package/dist/commands/recipes/impl/installed-recipes.d.ts.map +1 -1
  107. package/dist/commands/recipes/impl/installed-recipes.js +1 -2
  108. package/dist/commands/recipes/impl/mutation-transaction.d.ts +7 -0
  109. package/dist/commands/recipes/impl/mutation-transaction.d.ts.map +1 -0
  110. package/dist/commands/recipes/impl/mutation-transaction.js +47 -0
  111. package/dist/commands/recipes/impl/overlay-project.d.ts +19 -3
  112. package/dist/commands/recipes/impl/overlay-project.d.ts.map +1 -1
  113. package/dist/commands/recipes/impl/overlay-project.js +76 -38
  114. package/dist/commands/recipes/impl/paths.d.ts +0 -3
  115. package/dist/commands/recipes/impl/paths.d.ts.map +1 -1
  116. package/dist/commands/recipes/impl/paths.js +0 -3
  117. package/dist/commands/recipes/impl/project-installed-recipes.d.ts +4 -1
  118. package/dist/commands/recipes/impl/project-installed-recipes.d.ts.map +1 -1
  119. package/dist/commands/recipes/impl/project-installed-recipes.js +6 -4
  120. package/dist/commands/recipes/impl/project-recipe-state.d.ts +1 -1
  121. package/dist/commands/recipes/impl/project-recipe-state.d.ts.map +1 -1
  122. package/dist/commands/recipes/impl/project-registry.d.ts +5 -1
  123. package/dist/commands/recipes/impl/project-registry.d.ts.map +1 -1
  124. package/dist/commands/recipes/impl/project-registry.js +34 -14
  125. package/dist/commands/recipes/impl/resolver.d.ts +1 -1
  126. package/dist/commands/recipes/impl/resolver.d.ts.map +1 -1
  127. package/dist/commands/recipes/impl/resolver.js +1 -1
  128. package/dist/commands/recipes/impl/types.d.ts +1 -1
  129. package/dist/commands/recipes/impl/types.d.ts.map +1 -1
  130. package/dist/commands/recipes/impl/version.d.ts +5 -0
  131. package/dist/commands/recipes/impl/version.d.ts.map +1 -0
  132. package/dist/commands/recipes/impl/version.js +9 -0
  133. package/dist/commands/recipes.d.ts +5 -4
  134. package/dist/commands/recipes.d.ts.map +1 -1
  135. package/dist/commands/recipes.js +3 -3
  136. package/dist/commands/release/apply.command.d.ts +1 -1
  137. package/dist/commands/release/apply.command.d.ts.map +1 -1
  138. package/dist/commands/release/apply.command.js +15 -379
  139. package/dist/commands/release/apply.mutation.d.ts +1 -0
  140. package/dist/commands/release/apply.mutation.d.ts.map +1 -1
  141. package/dist/commands/release/apply.mutation.js +24 -1
  142. package/dist/commands/release/apply.pipeline.d.ts +22 -0
  143. package/dist/commands/release/apply.pipeline.d.ts.map +1 -0
  144. package/dist/commands/release/apply.pipeline.js +371 -0
  145. package/dist/commands/release/apply.preflight.d.ts +2 -0
  146. package/dist/commands/release/apply.preflight.d.ts.map +1 -1
  147. package/dist/commands/release/apply.preflight.js +13 -4
  148. package/dist/commands/release/apply.types.d.ts +27 -0
  149. package/dist/commands/release/apply.types.d.ts.map +1 -1
  150. package/dist/commands/release.test-helpers.d.ts +4 -0
  151. package/dist/commands/release.test-helpers.d.ts.map +1 -1
  152. package/dist/commands/release.test-helpers.js +7 -0
  153. package/dist/commands/shared/reconcile-check.d.ts.map +1 -1
  154. package/dist/commands/shared/reconcile-check.js +2 -2
  155. package/dist/commands/shared/task-backend.d.ts +6 -1
  156. package/dist/commands/shared/task-backend.d.ts.map +1 -1
  157. package/dist/commands/shared/task-backend.js +34 -2
  158. package/dist/commands/shared/task-mutation.d.ts.map +1 -1
  159. package/dist/commands/shared/task-mutation.js +4 -4
  160. package/dist/commands/shared/task-store/intents.d.ts +34 -0
  161. package/dist/commands/shared/task-store/intents.d.ts.map +1 -0
  162. package/dist/commands/shared/task-store/intents.js +265 -0
  163. package/dist/commands/shared/task-store/readme.d.ts +28 -0
  164. package/dist/commands/shared/task-store/readme.d.ts.map +1 -0
  165. package/dist/commands/shared/task-store/readme.js +125 -0
  166. package/dist/commands/shared/task-store/store.d.ts +26 -0
  167. package/dist/commands/shared/task-store/store.d.ts.map +1 -0
  168. package/dist/commands/shared/task-store/store.js +105 -0
  169. package/dist/commands/shared/task-store/types.d.ts +94 -0
  170. package/dist/commands/shared/task-store/types.d.ts.map +1 -0
  171. package/dist/commands/shared/task-store/types.js +1 -0
  172. package/dist/commands/shared/task-store.d.ts +3 -109
  173. package/dist/commands/shared/task-store.d.ts.map +1 -1
  174. package/dist/commands/shared/task-store.js +2 -493
  175. package/dist/commands/task/block.d.ts.map +1 -1
  176. package/dist/commands/task/block.js +7 -2
  177. package/dist/commands/task/comment.d.ts.map +1 -1
  178. package/dist/commands/task/comment.js +7 -2
  179. package/dist/commands/task/finish-shared.d.ts.map +1 -1
  180. package/dist/commands/task/finish-shared.js +3 -3
  181. package/dist/commands/task/finish.d.ts.map +1 -1
  182. package/dist/commands/task/finish.js +102 -15
  183. package/dist/commands/task/hosted-close.command.d.ts.map +1 -1
  184. package/dist/commands/task/hosted-close.command.js +23 -2
  185. package/dist/commands/task/hosted-merge-sync.d.ts.map +1 -1
  186. package/dist/commands/task/hosted-merge-sync.js +9 -4
  187. package/dist/commands/task/list.run.d.ts.map +1 -1
  188. package/dist/commands/task/list.run.js +14 -4
  189. package/dist/commands/task/new.command.d.ts.map +1 -1
  190. package/dist/commands/task/new.command.js +16 -2
  191. package/dist/commands/task/new.js +2 -2
  192. package/dist/commands/task/show.d.ts.map +1 -1
  193. package/dist/commands/task/show.js +3 -3
  194. package/dist/commands/task/update.d.ts.map +1 -1
  195. package/dist/commands/task/update.js +11 -3
  196. package/dist/runner/adapters/codex.d.ts.map +1 -1
  197. package/dist/runner/adapters/codex.js +3 -33
  198. package/dist/runner/adapters/custom.d.ts.map +1 -1
  199. package/dist/runner/adapters/custom.js +3 -30
  200. package/dist/runner/adapters/runtime-shared.d.ts +14 -0
  201. package/dist/runner/adapters/runtime-shared.d.ts.map +1 -0
  202. package/dist/runner/adapters/runtime-shared.js +36 -0
  203. package/dist/runner/context/base-prompt-sources.d.ts +30 -0
  204. package/dist/runner/context/base-prompt-sources.d.ts.map +1 -0
  205. package/dist/runner/context/base-prompt-sources.js +144 -0
  206. package/dist/runner/context/base-prompts.d.ts +3 -22
  207. package/dist/runner/context/base-prompts.d.ts.map +1 -1
  208. package/dist/runner/context/base-prompts.js +6 -450
  209. package/dist/runner/context/overlay-prompt-blocks.d.ts +7 -0
  210. package/dist/runner/context/overlay-prompt-blocks.d.ts.map +1 -0
  211. package/dist/runner/context/overlay-prompt-blocks.js +72 -0
  212. package/dist/runner/context/prompt-block-shared.d.ts +54 -0
  213. package/dist/runner/context/prompt-block-shared.d.ts.map +1 -0
  214. package/dist/runner/context/prompt-block-shared.js +106 -0
  215. package/dist/runner/context/recipe-context.d.ts +2 -1
  216. package/dist/runner/context/recipe-context.d.ts.map +1 -1
  217. package/dist/runner/context/recipe-context.js +2 -1
  218. package/dist/runner/context/recipe-prompt-blocks.d.ts +6 -0
  219. package/dist/runner/context/recipe-prompt-blocks.d.ts.map +1 -0
  220. package/dist/runner/context/recipe-prompt-blocks.js +143 -0
  221. package/dist/runner/usecases/scenario-materialize-task.js +2 -2
  222. package/dist/runner/usecases/task-run-inspect.js +2 -2
  223. package/dist/runner/usecases/task-run-lifecycle-shared.js +2 -2
  224. package/dist/runner/usecases/task-run.d.ts.map +1 -1
  225. package/dist/runner/usecases/task-run.js +4 -2
  226. package/dist/runtime/capabilities/recipe.d.ts +1 -1
  227. package/dist/runtime/capabilities/recipe.d.ts.map +1 -1
  228. package/dist/runtime/execution-context.d.ts +63 -0
  229. package/dist/runtime/execution-context.d.ts.map +1 -0
  230. package/dist/{usecases/context/resolve-context.js → runtime/execution-context.js} +23 -26
  231. package/dist/runtime/incidents/advice-strategy.d.ts +15 -0
  232. package/dist/runtime/incidents/advice-strategy.d.ts.map +1 -0
  233. package/dist/runtime/incidents/advice-strategy.js +54 -0
  234. package/dist/runtime/incidents/plan-strategy.d.ts +9 -0
  235. package/dist/runtime/incidents/plan-strategy.d.ts.map +1 -0
  236. package/dist/runtime/incidents/plan-strategy.js +205 -0
  237. package/dist/runtime/incidents/registry-strategy.d.ts +6 -0
  238. package/dist/runtime/incidents/registry-strategy.d.ts.map +1 -0
  239. package/dist/runtime/incidents/registry-strategy.js +280 -0
  240. package/dist/runtime/incidents/resolve.d.ts +3 -25
  241. package/dist/runtime/incidents/resolve.d.ts.map +1 -1
  242. package/dist/runtime/incidents/resolve.js +3 -683
  243. package/dist/runtime/incidents/shared.d.ts +34 -0
  244. package/dist/runtime/incidents/shared.d.ts.map +1 -0
  245. package/dist/runtime/incidents/shared.js +171 -0
  246. package/dist/testing/cli-harness/recipe-archives.d.ts +28 -0
  247. package/dist/testing/cli-harness/recipe-archives.d.ts.map +1 -0
  248. package/dist/testing/cli-harness/recipe-archives.js +374 -0
  249. package/dist/testing/cli-harness/stdio.d.ts +26 -0
  250. package/dist/testing/cli-harness/stdio.d.ts.map +1 -0
  251. package/dist/testing/cli-harness/stdio.js +84 -0
  252. package/dist/testing/cli-harness.d.ts +25 -0
  253. package/dist/testing/cli-harness.d.ts.map +1 -0
  254. package/dist/testing/cli-harness.js +313 -0
  255. package/dist/testing/index.d.ts +2 -0
  256. package/dist/testing/index.d.ts.map +1 -0
  257. package/dist/testing/index.js +1 -0
  258. package/package.json +7 -4
  259. package/dist/commands/recipes/impl/manifest.d.ts +0 -4
  260. package/dist/commands/recipes/impl/manifest.d.ts.map +0 -1
  261. package/dist/commands/recipes/impl/manifest.js +0 -7
  262. package/dist/commands/recipes/impl/normalize.d.ts +0 -8
  263. package/dist/commands/recipes/impl/normalize.d.ts.map +0 -1
  264. package/dist/commands/recipes/impl/normalize.js +0 -54
  265. package/dist/commands/recipes/impl/scenario.d.ts +0 -16
  266. package/dist/commands/recipes/impl/scenario.d.ts.map +0 -1
  267. package/dist/commands/recipes/impl/scenario.js +0 -262
  268. package/dist/recipes/bundled-recipes.d.ts +0 -17
  269. package/dist/recipes/bundled-recipes.d.ts.map +0 -1
  270. package/dist/recipes/bundled-recipes.js +0 -15
  271. package/dist/usecases/context/resolve-context.d.ts +0 -68
  272. package/dist/usecases/context/resolve-context.d.ts.map +0 -1
  273. package/dist/usecases/task/task-list-usecase.d.ts +0 -9
  274. package/dist/usecases/task/task-list-usecase.d.ts.map +0 -1
  275. package/dist/usecases/task/task-list-usecase.js +0 -17
  276. package/dist/usecases/task/task-new-usecase.d.ts +0 -9
  277. package/dist/usecases/task/task-new-usecase.d.ts.map +0 -1
  278. package/dist/usecases/task/task-new-usecase.js +0 -17
@@ -1,493 +1,2 @@
1
- import { readFile, stat } from "node:fs/promises";
2
- import path from "node:path";
3
- import { applyTaskDocMutations, docChanged, extractTaskDoc, mergeTaskDoc, normalizeTaskDocVersion, parseTaskReadme, renderTaskReadme, taskDocToSectionMap, } from "@agentplaneorg/core";
4
- import { LocalBackend, taskRecordToData, } from "../../backends/task-backend.js";
5
- import { exitCodeForError } from "../../cli/exit-codes.js";
6
- import { CliError } from "../../shared/errors.js";
7
- import { assertExpectedTaskDoc, assertExpectedTaskSection, } from "../../shared/task-doc-conflicts.js";
8
- import { writeTextIfChanged } from "../../shared/write-if-changed.js";
9
- import { resolveDocUpdatedBy, taskDataToFrontmatter } from "./task-backend.js";
10
- export function setTaskFieldsIntent(task) {
11
- return { kind: "set-task-fields", task };
12
- }
13
- export function appendTaskCommentsIntent(comments) {
14
- return { kind: "append-comments", comments };
15
- }
16
- export function appendTaskCommentIntent(comment) {
17
- return appendTaskCommentsIntent([comment]);
18
- }
19
- export function appendTaskEventsIntent(events) {
20
- return { kind: "append-events", events };
21
- }
22
- export function appendTaskEventIntent(event) {
23
- return appendTaskEventsIntent([event]);
24
- }
25
- export function replaceTaskDocIntent(opts) {
26
- return { kind: "replace-doc", ...opts };
27
- }
28
- export function setTaskSectionIntent(opts) {
29
- return { kind: "set-section", ...opts };
30
- }
31
- export function touchTaskDocMetaIntent(opts = {}) {
32
- return { kind: "touch-doc-meta", ...opts };
33
- }
34
- function taskReadmePath(ctx, taskId) {
35
- return path.join(ctx.resolvedProject.gitRoot, ctx.config.paths.workflow_dir, taskId, "README.md");
36
- }
37
- function normalizeTaskRevision(value, fallback = 1) {
38
- return Number.isInteger(value) && Number(value) > 0 ? Number(value) : fallback;
39
- }
40
- function readStoredTaskRevision(value) {
41
- return Number.isInteger(value) && Number(value) > 0 ? Number(value) : null;
42
- }
43
- function normalizeComments(task) {
44
- return Array.isArray(task.comments)
45
- ? task.comments.filter((item) => !!item && typeof item.author === "string" && typeof item.body === "string")
46
- : [];
47
- }
48
- function normalizeEvents(task) {
49
- return Array.isArray(task.events)
50
- ? task.events.filter((item) => !!item &&
51
- typeof item.type === "string" &&
52
- typeof item.at === "string" &&
53
- typeof item.author === "string")
54
- : [];
55
- }
56
- function isConcurrentReadmeChangeError(err) {
57
- return (err instanceof CliError &&
58
- err.code === "E_IO" &&
59
- err.message.startsWith("Task README changed concurrently:"));
60
- }
61
- function throwTaskRevisionConflict(opts) {
62
- throw new CliError({
63
- exitCode: exitCodeForError("E_VALIDATION"),
64
- code: "E_VALIDATION",
65
- message: `Task revision changed concurrently: ${opts.taskId} ` +
66
- `(expected revision ${opts.expectedRevision}, current revision ${opts.currentRevision})`,
67
- context: {
68
- task_id: opts.taskId,
69
- expected_revision: opts.expectedRevision,
70
- current_revision: opts.currentRevision,
71
- reason_code: "task_revision_conflict",
72
- },
73
- });
74
- }
75
- function applyDocMutationsToState(docState, mutations, opts) {
76
- const applied = applyTaskDocMutations(docState, mutations, {
77
- now: opts.docUpdatedAt,
78
- });
79
- return {
80
- ...docState,
81
- doc: applied.doc,
82
- sections: applied.sections,
83
- doc_version: applied.doc_version,
84
- doc_updated_at: applied.doc_updated_at,
85
- doc_updated_by: applied.doc_updated_by,
86
- };
87
- }
88
- function normalizeTaskStoreIntents(intents) {
89
- if (!intents)
90
- return [];
91
- if (Array.isArray(intents)) {
92
- return intents.filter((intent) => intent != null);
93
- }
94
- return [intents];
95
- }
96
- function patchToIntents(patch) {
97
- if (!patch)
98
- return [];
99
- const intents = [];
100
- if (patch.task) {
101
- intents.push(setTaskFieldsIntent(patch.task));
102
- }
103
- if (patch.appendComments && patch.appendComments.length > 0) {
104
- intents.push(appendTaskCommentsIntent(patch.appendComments));
105
- }
106
- if (patch.appendEvents && patch.appendEvents.length > 0) {
107
- intents.push(appendTaskEventsIntent(patch.appendEvents));
108
- }
109
- if (patch.doc) {
110
- intents.push(patch.doc.kind === "replace-doc"
111
- ? replaceTaskDocIntent({
112
- doc: patch.doc.doc,
113
- expectedCurrentDoc: patch.doc.expectedCurrentDoc,
114
- })
115
- : setTaskSectionIntent({
116
- section: patch.doc.section,
117
- text: patch.doc.text,
118
- requiredSections: patch.doc.requiredSections,
119
- expectedCurrentText: patch.doc.expectedCurrentText,
120
- }));
121
- }
122
- if (patch.docMeta && (patch.doc !== undefined || patch.docMeta.touch === true)) {
123
- intents.push(touchTaskDocMetaIntent({
124
- updatedBy: patch.docMeta.updatedBy,
125
- version: patch.docMeta.version,
126
- }));
127
- }
128
- return intents;
129
- }
130
- export function taskStorePatchFromIntents(intents) {
131
- const normalized = normalizeTaskStoreIntents(intents);
132
- if (normalized.length === 0)
133
- return null;
134
- const patch = {};
135
- for (const intent of normalized) {
136
- switch (intent.kind) {
137
- case "set-task-fields": {
138
- patch.task = patch.task ? { ...patch.task, ...intent.task } : { ...intent.task };
139
- break;
140
- }
141
- case "append-comments": {
142
- if (intent.comments.length > 0) {
143
- patch.appendComments = [...(patch.appendComments ?? []), ...intent.comments];
144
- }
145
- break;
146
- }
147
- case "append-events": {
148
- if (intent.events.length > 0) {
149
- patch.appendEvents = [...(patch.appendEvents ?? []), ...intent.events];
150
- }
151
- break;
152
- }
153
- case "replace-doc": {
154
- const docPatch = {
155
- kind: "replace-doc",
156
- doc: intent.doc,
157
- };
158
- if (intent.expectedCurrentDoc === undefined) {
159
- patch.doc = docPatch;
160
- break;
161
- }
162
- docPatch.expectedCurrentDoc = intent.expectedCurrentDoc;
163
- patch.doc = docPatch;
164
- break;
165
- }
166
- case "set-section": {
167
- const sectionPatch = {
168
- kind: "set-section",
169
- section: intent.section,
170
- text: intent.text,
171
- requiredSections: [...intent.requiredSections],
172
- };
173
- if (intent.expectedCurrentText === undefined) {
174
- patch.doc = sectionPatch;
175
- break;
176
- }
177
- sectionPatch.expectedCurrentText = intent.expectedCurrentText;
178
- patch.doc = sectionPatch;
179
- break;
180
- }
181
- case "touch-doc-meta": {
182
- patch.docMeta = {
183
- touch: true,
184
- updatedBy: intent.updatedBy ?? patch.docMeta?.updatedBy,
185
- version: intent.version ?? patch.docMeta?.version,
186
- };
187
- break;
188
- }
189
- }
190
- }
191
- return patch;
192
- }
193
- export async function mutateTaskStore(store, taskId, builder, opts = {}) {
194
- if (typeof store.mutate === "function") {
195
- return await store.mutate(taskId, builder, opts);
196
- }
197
- return await store.patch(taskId, async (current) => taskStorePatchFromIntents(await builder(current)), opts);
198
- }
199
- export function applyTaskStoreIntentsToTask(task, intents, opts = {}) {
200
- const normalizedIntents = normalizeTaskStoreIntents(intents);
201
- if (normalizedIntents.length === 0)
202
- return { ...task };
203
- const current = task;
204
- const next = { ...current };
205
- let docState = {
206
- comments: next.comments ?? null,
207
- doc: String(next.doc ?? ""),
208
- doc_updated_by: next.doc_updated_by,
209
- doc_version: normalizeTaskDocVersion(opts.currentDocVersion ?? task.doc_version),
210
- owner: next.owner,
211
- sections: next.sections ?? null,
212
- };
213
- let touchDoc = false;
214
- for (const intent of normalizedIntents) {
215
- switch (intent.kind) {
216
- case "set-task-fields": {
217
- Object.assign(next, intent.task);
218
- docState = {
219
- ...docState,
220
- doc_updated_by: next.doc_updated_by,
221
- doc_version: normalizeTaskDocVersion(next.doc_version ?? docState.doc_version),
222
- owner: next.owner,
223
- };
224
- break;
225
- }
226
- case "append-comments": {
227
- if (intent.comments.length > 0) {
228
- next.comments = [...normalizeComments(next), ...intent.comments];
229
- docState = { ...docState, comments: next.comments };
230
- }
231
- break;
232
- }
233
- case "append-events": {
234
- if (intent.events.length > 0) {
235
- next.events = [...normalizeEvents(next), ...intent.events];
236
- }
237
- break;
238
- }
239
- case "replace-doc": {
240
- if (intent.expectedCurrentDoc !== undefined) {
241
- assertExpectedTaskDoc({
242
- taskId: current.id,
243
- currentDoc: docState.doc,
244
- expectedDoc: intent.expectedCurrentDoc,
245
- });
246
- }
247
- docState = applyDocMutationsToState(docState, [{ kind: "replace-doc", doc: intent.doc }], {
248
- docUpdatedAt: opts.docUpdatedAt,
249
- });
250
- touchDoc = true;
251
- break;
252
- }
253
- case "set-section": {
254
- if (intent.expectedCurrentText !== undefined) {
255
- assertExpectedTaskSection({
256
- taskId: current.id,
257
- currentDoc: docState.doc,
258
- section: intent.section,
259
- expectedText: intent.expectedCurrentText,
260
- });
261
- }
262
- docState = applyDocMutationsToState(docState, [
263
- {
264
- kind: "set-section",
265
- section: intent.section,
266
- text: intent.text,
267
- requiredSections: intent.requiredSections,
268
- },
269
- ], { docUpdatedAt: opts.docUpdatedAt });
270
- touchDoc = true;
271
- break;
272
- }
273
- case "touch-doc-meta": {
274
- docState = applyDocMutationsToState(docState, [
275
- {
276
- kind: "touch-doc-meta",
277
- updatedBy: intent.updatedBy,
278
- version: intent.version,
279
- },
280
- ], { docUpdatedAt: opts.docUpdatedAt });
281
- touchDoc = true;
282
- break;
283
- }
284
- }
285
- }
286
- if (touchDoc) {
287
- next.doc = docState.doc;
288
- next.sections = docState.sections ?? taskDocToSectionMap(docState.doc);
289
- next.doc_version = docState.doc_version;
290
- next.doc_updated_at = docState.doc_updated_at;
291
- next.doc_updated_by = docState.doc_updated_by;
292
- }
293
- return next;
294
- }
295
- function applyTaskStoreIntents(entry, intents) {
296
- return applyTaskStoreIntentsToTask(entry.task, intents, {
297
- currentDocVersion: normalizeTaskDocVersion(entry.parsed.frontmatter.doc_version),
298
- });
299
- }
300
- async function readTaskReadmeCached(opts) {
301
- const readmePath = taskReadmePath(opts.ctx, opts.taskId);
302
- let text;
303
- let st;
304
- try {
305
- st = await stat(readmePath);
306
- text = await readFile(readmePath, "utf8");
307
- }
308
- catch (err) {
309
- const code = err?.code;
310
- if (code === "ENOENT") {
311
- throw new CliError({
312
- exitCode: 4,
313
- code: "E_IO",
314
- message: `ENOENT: no such file or directory, open '${readmePath}'`,
315
- });
316
- }
317
- throw err;
318
- }
319
- const parsed = parseTaskReadme(text);
320
- const task = taskRecordToData({
321
- id: opts.taskId,
322
- frontmatter: parsed.frontmatter,
323
- body: parsed.body,
324
- readmePath,
325
- });
326
- return { task, readmePath, mtimeMs: st.mtimeMs, parsed, rawText: text };
327
- }
328
- async function ensureUnchangedOnDisk(opts) {
329
- const st = await stat(opts.readmePath);
330
- if (st.mtimeMs !== opts.expectedMtimeMs) {
331
- throw new CliError({
332
- exitCode: exitCodeForError("E_IO"),
333
- code: "E_IO",
334
- message: `Task README changed concurrently: ${opts.readmePath}`,
335
- });
336
- }
337
- }
338
- async function didReadmeChangeOnDisk(opts) {
339
- try {
340
- const st = await stat(opts.readmePath);
341
- return st.mtimeMs !== opts.expectedMtimeMs;
342
- }
343
- catch (err) {
344
- const code = err?.code;
345
- if (code === "ENOENT")
346
- return true;
347
- throw err;
348
- }
349
- }
350
- export class TaskStore {
351
- ctx;
352
- cache = new Map();
353
- constructor(ctx) {
354
- this.ctx = ctx;
355
- }
356
- async get(taskId) {
357
- const entry = await this.getCached(taskId);
358
- return entry.task;
359
- }
360
- async getCached(taskId) {
361
- const key = taskId.trim();
362
- if (!key) {
363
- throw new CliError({
364
- exitCode: exitCodeForError("E_USAGE"),
365
- code: "E_USAGE",
366
- message: "task id is required",
367
- });
368
- }
369
- const existing = this.cache.get(key);
370
- if (existing)
371
- return await existing;
372
- const load = (async () => {
373
- // For now, TaskStore does file-based caching. Non-file backends can still rely on
374
- // backend.getTask/writeTask elsewhere, but lifecycle/status commands in this repo
375
- // operate on the local task README files.
376
- return await readTaskReadmeCached({ ctx: this.ctx, taskId: key });
377
- })();
378
- this.cache.set(key, load);
379
- return await load;
380
- }
381
- async update(taskId, updater, opts = {}) {
382
- return await this.runWithRetry(taskId, opts, async (entry) => {
383
- return await updater({ ...entry.task });
384
- });
385
- }
386
- async patch(taskId, builder, opts = {}) {
387
- return await this.mutate(taskId, async (current) => patchToIntents(await builder(current)), opts);
388
- }
389
- async mutate(taskId, builder, opts = {}) {
390
- return await this.runWithRetry(taskId, opts, async (entry) => {
391
- const intents = normalizeTaskStoreIntents(await builder({ ...entry.task }));
392
- return applyTaskStoreIntents(entry, intents);
393
- });
394
- }
395
- async runWithRetry(taskId, opts, computeNext) {
396
- for (let attempt = 0; attempt < 2; attempt++) {
397
- const entry = await this.getCached(taskId);
398
- if (opts.expectedRevision !== undefined) {
399
- const expectedRevision = normalizeTaskRevision(opts.expectedRevision);
400
- const currentRevision = normalizeTaskRevision(entry.task.revision);
401
- if (currentRevision !== expectedRevision) {
402
- throwTaskRevisionConflict({ taskId, expectedRevision, currentRevision });
403
- }
404
- }
405
- let next;
406
- try {
407
- next = await computeNext(entry);
408
- }
409
- catch (err) {
410
- if (attempt === 0 &&
411
- err instanceof CliError &&
412
- err.code === "E_VALIDATION" &&
413
- (await didReadmeChangeOnDisk({
414
- readmePath: entry.readmePath,
415
- expectedMtimeMs: entry.mtimeMs,
416
- }))) {
417
- this.cache.delete(taskId);
418
- continue;
419
- }
420
- throw err;
421
- }
422
- try {
423
- return await this.writeNextTask(taskId, entry, next);
424
- }
425
- catch (err) {
426
- if (attempt === 0 && isConcurrentReadmeChangeError(err)) {
427
- // Refresh cache and retry once.
428
- this.cache.delete(taskId);
429
- continue;
430
- }
431
- throw err;
432
- }
433
- }
434
- // Unreachable, but keeps TS happy.
435
- const task = await this.get(taskId);
436
- return { changed: false, task };
437
- }
438
- async writeNextTask(taskId, entry, next) {
439
- // Start from existing frontmatter to preserve any unknown keys.
440
- const frontmatter = { ...entry.parsed.frontmatter, ...taskDataToFrontmatter(next) };
441
- let body = entry.parsed.body ?? "";
442
- const existingDoc = extractTaskDoc(body);
443
- const now = new Date().toISOString();
444
- const currentDocVersion = normalizeTaskDocVersion(entry.parsed.frontmatter.doc_version);
445
- const requestedDocVersion = normalizeTaskDocVersion(next.doc_version, currentDocVersion);
446
- if (next.doc !== undefined) {
447
- const nextDoc = String(next.doc ?? "");
448
- body = mergeTaskDoc(body, nextDoc);
449
- if (docChanged(existingDoc, nextDoc) || !frontmatter.doc_updated_at) {
450
- frontmatter.doc_version = requestedDocVersion;
451
- frontmatter.doc_updated_at = now;
452
- frontmatter.doc_updated_by = resolveDocUpdatedBy(next);
453
- }
454
- }
455
- frontmatter.doc_version = normalizeTaskDocVersion(frontmatter.doc_version, requestedDocVersion);
456
- if (typeof frontmatter.doc_updated_at !== "string" ||
457
- frontmatter.doc_updated_at.trim() === "") {
458
- frontmatter.doc_updated_at = now;
459
- }
460
- if (typeof frontmatter.doc_updated_by !== "string" ||
461
- frontmatter.doc_updated_by.trim() === "") {
462
- frontmatter.doc_updated_by = resolveDocUpdatedBy(next);
463
- }
464
- const storedRevision = readStoredTaskRevision(entry.parsed.frontmatter.revision);
465
- frontmatter.revision = storedRevision ?? 1;
466
- let nextText = renderTaskReadme(frontmatter, body);
467
- nextText = nextText.endsWith("\n") ? nextText : `${nextText}\n`;
468
- if (storedRevision !== null && nextText !== entry.rawText) {
469
- frontmatter.revision = storedRevision + 1;
470
- nextText = renderTaskReadme(frontmatter, body);
471
- nextText = nextText.endsWith("\n") ? nextText : `${nextText}\n`;
472
- }
473
- await ensureUnchangedOnDisk({
474
- readmePath: entry.readmePath,
475
- expectedMtimeMs: entry.mtimeMs,
476
- });
477
- const changed = await writeTextIfChanged(entry.readmePath, nextText);
478
- // Refresh cache with latest content on disk.
479
- this.cache.set(taskId, (async () => {
480
- return await readTaskReadmeCached({ ctx: this.ctx, taskId });
481
- })());
482
- const updated = await this.get(taskId);
483
- return { changed, task: updated };
484
- }
485
- }
486
- export function getTaskStore(ctx) {
487
- const memo = ctx.memo;
488
- memo.taskStore ??= new TaskStore(ctx);
489
- return memo.taskStore;
490
- }
491
- export function backendIsLocalFileBackend(ctx) {
492
- return ctx.taskBackend instanceof LocalBackend;
493
- }
1
+ export { appendTaskCommentIntent, appendTaskCommentsIntent, appendTaskEventIntent, appendTaskEventsIntent, applyTaskStoreIntentsToTask, mutateTaskStore, replaceTaskDocIntent, setTaskFieldsIntent, setTaskSectionIntent, taskStorePatchFromIntents, touchTaskDocMetaIntent, } from "./task-store/intents.js";
2
+ export { TaskStore, backendIsLocalFileBackend, getTaskStore } from "./task-store/store.js";
@@ -1 +1 @@
1
- {"version":3,"file":"block.d.ts","sourceRoot":"","sources":["../../../src/commands/task/block.ts"],"names":[],"mappings":"AAKA,OAAO,EAAsB,KAAK,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAWpF,wBAAsB,QAAQ,CAAC,IAAI,EAAE;IACnC,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,IAAI,EAAE,MAAM,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;IACf,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,OAAO,CAAC;CAChB,GAAG,OAAO,CAAC,MAAM,CAAC,CAgFlB"}
1
+ {"version":3,"file":"block.d.ts","sourceRoot":"","sources":["../../../src/commands/task/block.ts"],"names":[],"mappings":"AAKA,OAAO,EAAsB,KAAK,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAapF,wBAAsB,QAAQ,CAAC,IAAI,EAAE;IACnC,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,IAAI,EAAE,MAAM,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;IACf,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,OAAO,CAAC;CAChB,GAAG,OAAO,CAAC,MAAM,CAAC,CAoFlB"}
@@ -1,9 +1,10 @@
1
1
  import { mapBackendError } from "../../cli/error-map.js";
2
- import { successMessage } from "../../cli/output.js";
2
+ import { createCliEmitter, emitCommandResult } from "../../cli/output.js";
3
3
  import { CliError } from "../../shared/errors.js";
4
4
  import { ensureActionApproved } from "../shared/approval-requirements.js";
5
5
  import { loadCommandContext } from "../shared/task-backend.js";
6
6
  import { applyTaskStatusTransitionCommand, defaultCommitEmojiForStatus, nowIso, prepareTaskTransitionComment, requireStructuredComment, runTaskTransitionCommentCommit, } from "./shared.js";
7
+ const output = createCliEmitter();
7
8
  export async function cmdBlock(opts) {
8
9
  try {
9
10
  const ctx = opts.ctx ??
@@ -71,7 +72,11 @@ export async function cmdBlock(opts) {
71
72
  }
72
73
  if (!opts.quiet) {
73
74
  const suffix = commitInfo ? ` (commit=${commitInfo.hash.slice(0, 12)})` : "";
74
- process.stdout.write(`${successMessage("blocked", `${opts.taskId}${suffix}`)}\n`);
75
+ emitCommandResult(output, {
76
+ kind: "success",
77
+ action: "blocked",
78
+ target: `${opts.taskId}${suffix}`,
79
+ });
75
80
  }
76
81
  return 0;
77
82
  }
@@ -1 +1 @@
1
- {"version":3,"file":"comment.d.ts","sourceRoot":"","sources":["../../../src/commands/task/comment.ts"],"names":[],"mappings":"AAIA,OAAO,EAAsB,KAAK,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAqDpF,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,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd,GAAG,OAAO,CAAC,MAAM,CAAC,CAsBlB"}
1
+ {"version":3,"file":"comment.d.ts","sourceRoot":"","sources":["../../../src/commands/task/comment.ts"],"names":[],"mappings":"AAIA,OAAO,EAAsB,KAAK,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAuDpF,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,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd,GAAG,OAAO,CAAC,MAAM,CAAC,CA0BlB"}
@@ -1,9 +1,10 @@
1
1
  import { mapBackendError } from "../../cli/error-map.js";
2
- import { successMessage } from "../../cli/output.js";
2
+ import { createCliEmitter, emitCommandResult } from "../../cli/output.js";
3
3
  import { loadCommandContext } from "../shared/task-backend.js";
4
4
  import { applyTaskMutation } from "../shared/task-mutation.js";
5
5
  import { appendTaskCommentIntent, appendTaskEventIntent, touchTaskDocMetaIntent, } from "../shared/task-store.js";
6
6
  import { appendTaskEvent, normalizeTaskDocVersion, nowIso } from "./shared.js";
7
+ const output = createCliEmitter();
7
8
  function buildCommentMutation(opts) {
8
9
  return {
9
10
  intents: [
@@ -54,7 +55,11 @@ export async function cmdTaskComment(opts) {
54
55
  body: opts.body,
55
56
  }),
56
57
  });
57
- process.stdout.write(`${successMessage("commented", opts.taskId)}\n`);
58
+ emitCommandResult(output, {
59
+ kind: "success",
60
+ action: "commented",
61
+ target: opts.taskId,
62
+ });
58
63
  return 0;
59
64
  }
60
65
  catch (err) {
@@ -1 +1 @@
1
- {"version":3,"file":"finish-shared.d.ts","sourceRoot":"","sources":["../../../src/commands/task/finish-shared.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAG/D,OAAO,EAAuB,KAAK,cAAc,EAAE,MAAM,2BAA2B,CAAC;AACrF,OAAO,EAA6B,YAAY,EAAmB,MAAM,yBAAyB,CAAC;AAWnG,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,QAAQ,CAAC;CAChB,CAAC;AA0CF,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,QAAQ,GAAG,kBAAkB,GAAG,IAAI,CAK5E;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE;IACxC,IAAI,EAAE,QAAQ,CAAC;IACf,MAAM,EAAE,cAAc,CAAC,QAAQ,CAAC,CAAC;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,OAAO,CAAC;IACpB,cAAc,EAAE,OAAO,CAAC;IACxB,aAAa,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,OAAO,CAAC;CAChB,GAAG,IAAI,CAyCP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aneorg/core";
2
2
  import { CliError } from "../../shared/errors.js";
3
3
  import { cmdCommit } from "../guard/index.js";
4
- import { loadTaskFromContext } from "../shared/task-backend.js";
5
- import { backendIsLocalFileBackend, getTaskStore, mutateTaskStore } from "../shared/task-store.js";
4
+ import { backendUsesLocalTaskStore, loadTaskFromContext, } from "../shared/task-backend.js";
5
+ import { getTaskStore, mutateTaskStore } from "../shared/task-store.js";
6
6
  import { ensureAgentFilledRequiredDocSections, executeTaskStatusTransitionRequest, ensureVerificationSatisfiedIfRequired, nowIso, resolvePrimaryTag, toStringArray, } from "./shared.js";
7
7
  function normalizeCommentBody(value) {
8
8
  return typeof value === "string" ? value.trim() : "";
@@ -144,7 +144,7 @@ export async function loadTaskForFinish(opts) {
144
144
  };
145
145
  }
146
146
  export async function writeFinishedTasks(opts) {
147
- const useStore = backendIsLocalFileBackend(opts.ctx);
147
+ const useStore = backendUsesLocalTaskStore(opts.ctx);
148
148
  const store = useStore ? getTaskStore(opts.ctx) : null;
149
149
  const taskCount = opts.loadedTasks.length;
150
150
  for (const loaded of opts.loadedTasks) {
@@ -1 +1 @@
1
- {"version":3,"file":"finish.d.ts","sourceRoot":"","sources":["../../../src/commands/task/finish.ts"],"names":[],"mappings":"AAYA,OAAO,EAAsB,KAAK,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAsHpF,wBAAsB,SAAS,CAAC,IAAI,EAAE;IACpC,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,KAAK,GAAG,KAAK,GAAG,MAAM,CAAC;IAC9B,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAA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