agentplane 0.2.24 → 0.2.26

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 (187) hide show
  1. package/bin/agentplane.js +91 -54
  2. package/dist/.build-manifest.json +11 -0
  3. package/dist/backends/task-backend/local-backend.d.ts +2 -0
  4. package/dist/backends/task-backend/local-backend.d.ts.map +1 -1
  5. package/dist/backends/task-backend/local-backend.js +12 -1
  6. package/dist/backends/task-backend/redmine/mapping.d.ts.map +1 -1
  7. package/dist/backends/task-backend/redmine/mapping.js +26 -1
  8. package/dist/backends/task-backend/redmine-backend.d.ts +4 -0
  9. package/dist/backends/task-backend/redmine-backend.d.ts.map +1 -1
  10. package/dist/backends/task-backend/redmine-backend.js +92 -9
  11. package/dist/backends/task-backend/shared/types.d.ts +1 -0
  12. package/dist/backends/task-backend/shared/types.d.ts.map +1 -1
  13. package/dist/backends/task-index.d.ts.map +1 -1
  14. package/dist/backends/task-index.js +8 -1
  15. package/dist/cli/command-guide.d.ts.map +1 -1
  16. package/dist/cli/command-guide.js +21 -8
  17. package/dist/cli/command-snippets.d.ts +24 -0
  18. package/dist/cli/command-snippets.d.ts.map +1 -0
  19. package/dist/cli/command-snippets.js +23 -0
  20. package/dist/cli/reason-codes.d.ts +9 -0
  21. package/dist/cli/reason-codes.d.ts.map +1 -0
  22. package/dist/cli/reason-codes.js +79 -0
  23. package/dist/cli/recipes-bundled.d.ts +1 -0
  24. package/dist/cli/recipes-bundled.d.ts.map +1 -1
  25. package/dist/cli/recipes-bundled.js +4 -1
  26. package/dist/cli/run-cli/command-catalog.d.ts +1 -1
  27. package/dist/cli/run-cli/command-catalog.d.ts.map +1 -1
  28. package/dist/cli/run-cli/command-catalog.js +40 -1
  29. package/dist/cli/run-cli/commands/config.d.ts +5 -0
  30. package/dist/cli/run-cli/commands/config.d.ts.map +1 -1
  31. package/dist/cli/run-cli/commands/config.js +86 -1
  32. package/dist/cli/run-cli/commands/core.d.ts.map +1 -1
  33. package/dist/cli/run-cli/commands/core.js +55 -0
  34. package/dist/cli/run-cli/commands/init/recipes.d.ts +5 -1
  35. package/dist/cli/run-cli/commands/init/recipes.d.ts.map +1 -1
  36. package/dist/cli/run-cli/commands/init/recipes.js +24 -4
  37. package/dist/cli/run-cli/commands/init/write-workflow.d.ts +7 -0
  38. package/dist/cli/run-cli/commands/init/write-workflow.d.ts.map +1 -0
  39. package/dist/cli/run-cli/commands/init/write-workflow.js +52 -0
  40. package/dist/cli/run-cli/commands/init.d.ts +2 -1
  41. package/dist/cli/run-cli/commands/init.d.ts.map +1 -1
  42. package/dist/cli/run-cli/commands/init.js +104 -54
  43. package/dist/cli/run-cli.d.ts.map +1 -1
  44. package/dist/cli/run-cli.js +70 -1
  45. package/dist/commands/backend/sync.command.d.ts.map +1 -1
  46. package/dist/commands/backend/sync.command.js +7 -6
  47. package/dist/commands/backend.d.ts.map +1 -1
  48. package/dist/commands/backend.js +2 -0
  49. package/dist/commands/block.spec.d.ts.map +1 -1
  50. package/dist/commands/block.spec.js +23 -2
  51. package/dist/commands/commit.spec.d.ts.map +1 -1
  52. package/dist/commands/commit.spec.js +18 -6
  53. package/dist/commands/doctor.run.d.ts.map +1 -1
  54. package/dist/commands/doctor.run.js +96 -10
  55. package/dist/commands/finish.spec.d.ts.map +1 -1
  56. package/dist/commands/finish.spec.js +53 -4
  57. package/dist/commands/guard/commit.command.d.ts.map +1 -1
  58. package/dist/commands/guard/commit.command.js +26 -20
  59. package/dist/commands/guard/impl/allow.d.ts.map +1 -1
  60. package/dist/commands/guard/impl/allow.js +8 -1
  61. package/dist/commands/guard/impl/commands.d.ts.map +1 -1
  62. package/dist/commands/guard/impl/commands.js +19 -21
  63. package/dist/commands/guard/impl/comment-commit.d.ts.map +1 -1
  64. package/dist/commands/guard/impl/comment-commit.js +8 -17
  65. package/dist/commands/recipes/impl/commands/install.d.ts.map +1 -1
  66. package/dist/commands/recipes/impl/commands/install.js +36 -13
  67. package/dist/commands/recipes/impl/scenario.d.ts.map +1 -1
  68. package/dist/commands/recipes/impl/scenario.js +25 -0
  69. package/dist/commands/recipes/impl/types.d.ts +4 -0
  70. package/dist/commands/recipes/impl/types.d.ts.map +1 -1
  71. package/dist/commands/scenario/impl/commands.d.ts.map +1 -1
  72. package/dist/commands/scenario/impl/commands.js +74 -3
  73. package/dist/commands/scenario/impl/report.d.ts +8 -0
  74. package/dist/commands/scenario/impl/report.d.ts.map +1 -1
  75. package/dist/commands/scenario/impl/report.js +1 -0
  76. package/dist/commands/shared/reconcile-check.d.ts +7 -0
  77. package/dist/commands/shared/reconcile-check.d.ts.map +1 -0
  78. package/dist/commands/shared/reconcile-check.js +60 -0
  79. package/dist/commands/start.spec.d.ts.map +1 -1
  80. package/dist/commands/start.spec.js +23 -2
  81. package/dist/commands/sync.command.d.ts.map +1 -1
  82. package/dist/commands/sync.command.js +9 -2
  83. package/dist/commands/task/finish.d.ts.map +1 -1
  84. package/dist/commands/task/finish.js +34 -10
  85. package/dist/commands/task/list.d.ts.map +1 -1
  86. package/dist/commands/task/list.js +2 -1
  87. package/dist/commands/task/list.spec.d.ts.map +1 -1
  88. package/dist/commands/task/list.spec.js +7 -0
  89. package/dist/commands/task/next.d.ts.map +1 -1
  90. package/dist/commands/task/next.js +2 -1
  91. package/dist/commands/task/next.spec.d.ts.map +1 -1
  92. package/dist/commands/task/next.spec.js +7 -0
  93. package/dist/commands/task/search.d.ts.map +1 -1
  94. package/dist/commands/task/search.js +2 -1
  95. package/dist/commands/task/search.spec.d.ts.map +1 -1
  96. package/dist/commands/task/search.spec.js +7 -0
  97. package/dist/commands/task/set-status.command.d.ts.map +1 -1
  98. package/dist/commands/task/set-status.command.js +22 -2
  99. package/dist/commands/task/shared.d.ts +7 -0
  100. package/dist/commands/task/shared.d.ts.map +1 -1
  101. package/dist/commands/task/shared.js +21 -1
  102. package/dist/commands/task/verify-record.d.ts.map +1 -1
  103. package/dist/commands/task/verify-record.js +2 -0
  104. package/dist/commands/workflow-build.command.d.ts +8 -0
  105. package/dist/commands/workflow-build.command.d.ts.map +1 -0
  106. package/dist/commands/workflow-build.command.js +96 -0
  107. package/dist/commands/workflow-playbook.command.d.ts +10 -0
  108. package/dist/commands/workflow-playbook.command.d.ts.map +1 -0
  109. package/dist/commands/workflow-playbook.command.js +174 -0
  110. package/dist/commands/workflow-restore.command.d.ts +5 -0
  111. package/dist/commands/workflow-restore.command.d.ts.map +1 -0
  112. package/dist/commands/workflow-restore.command.js +30 -0
  113. package/dist/commands/workflow.command.d.ts +6 -0
  114. package/dist/commands/workflow.command.d.ts.map +1 -0
  115. package/dist/commands/workflow.command.js +36 -0
  116. package/dist/harness/dynamic-tool-contract.d.ts +29 -0
  117. package/dist/harness/dynamic-tool-contract.d.ts.map +1 -0
  118. package/dist/harness/dynamic-tool-contract.js +86 -0
  119. package/dist/harness/hooks-lifecycle.d.ts +27 -0
  120. package/dist/harness/hooks-lifecycle.d.ts.map +1 -0
  121. package/dist/harness/hooks-lifecycle.js +67 -0
  122. package/dist/harness/index.d.ts +9 -0
  123. package/dist/harness/index.d.ts.map +1 -0
  124. package/dist/harness/index.js +8 -0
  125. package/dist/harness/reconcile.d.ts +37 -0
  126. package/dist/harness/reconcile.d.ts.map +1 -0
  127. package/dist/harness/reconcile.js +42 -0
  128. package/dist/harness/retry-policy.d.ts +31 -0
  129. package/dist/harness/retry-policy.d.ts.map +1 -0
  130. package/dist/harness/retry-policy.js +33 -0
  131. package/dist/harness/scheduler.d.ts +18 -0
  132. package/dist/harness/scheduler.d.ts.map +1 -0
  133. package/dist/harness/scheduler.js +55 -0
  134. package/dist/harness/state-machine.d.ts +17 -0
  135. package/dist/harness/state-machine.d.ts.map +1 -0
  136. package/dist/harness/state-machine.js +70 -0
  137. package/dist/harness/token-accounting.d.ts +19 -0
  138. package/dist/harness/token-accounting.d.ts.map +1 -0
  139. package/dist/harness/token-accounting.js +77 -0
  140. package/dist/harness/workspace-safety.d.ts +14 -0
  141. package/dist/harness/workspace-safety.d.ts.map +1 -0
  142. package/dist/harness/workspace-safety.js +62 -0
  143. package/dist/policy/rules/allowlist.d.ts.map +1 -1
  144. package/dist/policy/rules/allowlist.js +9 -0
  145. package/dist/recipes/bundled-recipes.d.ts +4 -0
  146. package/dist/recipes/bundled-recipes.d.ts.map +1 -1
  147. package/dist/recipes/bundled-recipes.js +11 -0
  148. package/dist/shared/allow-prefix-policy.d.ts +3 -0
  149. package/dist/shared/allow-prefix-policy.d.ts.map +1 -0
  150. package/dist/shared/allow-prefix-policy.js +8 -0
  151. package/dist/shared/errors.d.ts +6 -0
  152. package/dist/shared/errors.d.ts.map +1 -1
  153. package/dist/shared/errors.js +1 -0
  154. package/dist/workflow-runtime/build.d.ts +4 -0
  155. package/dist/workflow-runtime/build.d.ts.map +1 -0
  156. package/dist/workflow-runtime/build.js +114 -0
  157. package/dist/workflow-runtime/enforcement.d.ts +3 -0
  158. package/dist/workflow-runtime/enforcement.d.ts.map +1 -0
  159. package/dist/workflow-runtime/enforcement.js +10 -0
  160. package/dist/workflow-runtime/file-ops.d.ts +11 -0
  161. package/dist/workflow-runtime/file-ops.d.ts.map +1 -0
  162. package/dist/workflow-runtime/file-ops.js +248 -0
  163. package/dist/workflow-runtime/fix.d.ts +9 -0
  164. package/dist/workflow-runtime/fix.d.ts.map +1 -0
  165. package/dist/workflow-runtime/fix.js +107 -0
  166. package/dist/workflow-runtime/index.d.ts +11 -0
  167. package/dist/workflow-runtime/index.d.ts.map +1 -0
  168. package/dist/workflow-runtime/index.js +10 -0
  169. package/dist/workflow-runtime/markdown.d.ts +10 -0
  170. package/dist/workflow-runtime/markdown.d.ts.map +1 -0
  171. package/dist/workflow-runtime/markdown.js +147 -0
  172. package/dist/workflow-runtime/observability.d.ts +12 -0
  173. package/dist/workflow-runtime/observability.d.ts.map +1 -0
  174. package/dist/workflow-runtime/observability.js +14 -0
  175. package/dist/workflow-runtime/paths.d.ts +3 -0
  176. package/dist/workflow-runtime/paths.d.ts.map +1 -0
  177. package/dist/workflow-runtime/paths.js +11 -0
  178. package/dist/workflow-runtime/template.d.ts +7 -0
  179. package/dist/workflow-runtime/template.d.ts.map +1 -0
  180. package/dist/workflow-runtime/template.js +94 -0
  181. package/dist/workflow-runtime/types.d.ts +68 -0
  182. package/dist/workflow-runtime/types.d.ts.map +1 -0
  183. package/dist/workflow-runtime/types.js +1 -0
  184. package/dist/workflow-runtime/validate.d.ts +8 -0
  185. package/dist/workflow-runtime/validate.d.ts.map +1 -0
  186. package/dist/workflow-runtime/validate.js +331 -0
  187. package/package.json +3 -3
@@ -1,4 +1,4 @@
1
- import { mkdir, mkdtemp, rm } from "node:fs/promises";
1
+ import { cp, mkdir, mkdtemp, rm } from "node:fs/promises";
2
2
  import os from "node:os";
3
3
  import path from "node:path";
4
4
  import { defaultConfig, loadConfig } from "@agentplaneorg/core";
@@ -8,6 +8,7 @@ import { mapCoreError } from "../../../../cli/error-map.js";
8
8
  import { exitCodeForError } from "../../../../cli/exit-codes.js";
9
9
  import { fileExists, getPathKind } from "../../../../cli/fs-utils.js";
10
10
  import { downloadToFile } from "../../../../cli/http.js";
11
+ import { getBundledRecipeEntry, resolveBundledRecipeSourcePath, } from "../../../../recipes/bundled-recipes.js";
11
12
  import { CliError } from "../../../../shared/errors.js";
12
13
  import { ensureNetworkApproved } from "../../../shared/network-approval.js";
13
14
  import { resolvePathFallback } from "../../../shared/path.js";
@@ -86,7 +87,7 @@ export async function cmdRecipeInstall(opts) {
86
87
  const filename = path.basename(url.pathname) || "recipe.tar.gz";
87
88
  const target = path.join(tempRoot, filename);
88
89
  await downloadToFile(latest.url, target);
89
- return target;
90
+ return { kind: "archive", path: target };
90
91
  }
91
92
  const resolved = path.resolve(opts.cwd, latest.url);
92
93
  if (!(await fileExists(resolved))) {
@@ -96,11 +97,19 @@ export async function cmdRecipeInstall(opts) {
96
97
  message: `Recipe archive not found: ${latest.url}`,
97
98
  });
98
99
  }
99
- return resolved;
100
+ return { kind: "archive", path: resolved };
100
101
  };
101
102
  const resolveSourcePath = async (source) => {
102
- if (source.type === "name")
103
+ if (source.type === "name") {
104
+ const bundledPath = resolveBundledRecipeSourcePath(source.value);
105
+ if (bundledPath && (await fileExists(path.join(bundledPath, "manifest.json")))) {
106
+ const bundledEntry = getBundledRecipeEntry(source.value);
107
+ const bundledVersion = bundledEntry?.versions.at(-1)?.version ?? "unknown";
108
+ sourceLabel = `bundled:${source.value}@${bundledVersion}`;
109
+ return { kind: "directory", path: bundledPath };
110
+ }
103
111
  return await resolveFromIndex(source.value);
112
+ }
104
113
  if (source.type === "url") {
105
114
  await ensureApproved("recipes install downloads a recipe archive");
106
115
  const url = new URL(source.value);
@@ -108,7 +117,7 @@ export async function cmdRecipeInstall(opts) {
108
117
  const target = path.join(tempRoot, filename);
109
118
  sourceLabel = source.value;
110
119
  await downloadToFile(source.value, target);
111
- return target;
120
+ return { kind: "archive", path: target };
112
121
  }
113
122
  if (source.type === "path") {
114
123
  const candidate = await resolvePathFallback(source.value);
@@ -119,8 +128,13 @@ export async function cmdRecipeInstall(opts) {
119
128
  message: `Recipe archive not found: ${source.value}`,
120
129
  });
121
130
  }
131
+ const kind = await getPathKind(candidate);
132
+ if (kind === "dir") {
133
+ sourceLabel = candidate;
134
+ return { kind: "directory", path: candidate };
135
+ }
122
136
  sourceLabel = candidate;
123
- return candidate;
137
+ return { kind: "archive", path: candidate };
124
138
  }
125
139
  if (isHttpUrl(source.value)) {
126
140
  return await resolveSourcePath({ type: "url", value: source.value });
@@ -131,10 +145,11 @@ export async function cmdRecipeInstall(opts) {
131
145
  }
132
146
  return await resolveSourcePath({ type: "name", value: source.value });
133
147
  };
134
- const sourcePath = await resolveSourcePath(opts.source);
148
+ const sourceInput = await resolveSourcePath(opts.source);
149
+ const sourcePath = sourceInput.path;
135
150
  if (!sourceLabel)
136
151
  sourceLabel = opts.source.value;
137
- const actualSha = expectedSha ? await sha256File(sourcePath) : "";
152
+ const actualSha = expectedSha && sourceInput.kind === "archive" ? await sha256File(sourcePath) : "";
138
153
  if (expectedSha && actualSha !== expectedSha) {
139
154
  throw new CliError({
140
155
  exitCode: 3,
@@ -142,11 +157,19 @@ export async function cmdRecipeInstall(opts) {
142
157
  message: `Recipe checksum mismatch for ${sourceLabel}`,
143
158
  });
144
159
  }
145
- await extractArchive({
146
- archivePath: sourcePath,
147
- destDir: tempRoot,
148
- });
149
- const recipeRoot = await resolveRecipeRoot(tempRoot);
160
+ let recipeRoot;
161
+ if (sourceInput.kind === "archive") {
162
+ await extractArchive({
163
+ archivePath: sourcePath,
164
+ destDir: tempRoot,
165
+ });
166
+ recipeRoot = await resolveRecipeRoot(tempRoot);
167
+ }
168
+ else {
169
+ const stagedRecipeRoot = path.join(tempRoot, "recipe");
170
+ await cp(sourcePath, stagedRecipeRoot, { recursive: true });
171
+ recipeRoot = stagedRecipeRoot;
172
+ }
150
173
  const manifest = await readRecipeManifest(path.join(recipeRoot, "manifest.json"));
151
174
  const resolvedTags = manifest.tags && manifest.tags.length > 0 ? manifest.tags : normalizeRecipeTags(indexTags);
152
175
  const manifestWithTags = resolvedTags.length > 0 ? { ...manifest, tags: resolvedTags } : manifest;
@@ -1 +1 @@
1
- {"version":3,"file":"scenario.d.ts","sourceRoot":"","sources":["../../../../src/commands/recipes/impl/scenario.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,cAAc,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AA4B3F,wBAAsB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAG1F;AAED,wBAAsB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;IACjE,cAAc,EAAE,CAAC,CAAC;IAClB,SAAS,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CAC/C,CAAC,CAeD;AAED,wBAAsB,4BAA4B,CAChD,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,cAAc,GACvB,OAAO,CAAC,oBAAoB,EAAE,CAAC,CA+CjC;AAED,wBAAgB,yBAAyB,CACvC,GAAG,EAAE,OAAO,EACZ,UAAU,EAAE,MAAM,GACjB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,EAAE,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,CAyB/D"}
1
+ {"version":3,"file":"scenario.d.ts","sourceRoot":"","sources":["../../../../src/commands/recipes/impl/scenario.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,cAAc,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAwD3F,wBAAsB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAG1F;AAED,wBAAsB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;IACjE,cAAc,EAAE,CAAC,CAAC;IAClB,SAAS,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CAC/C,CAAC,CAeD;AAED,wBAAsB,4BAA4B,CAChD,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,cAAc,GACvB,OAAO,CAAC,oBAAoB,EAAE,CAAC,CA+CjC;AAED,wBAAgB,yBAAyB,CACvC,GAAG,EAAE,OAAO,EACZ,UAAU,EAAE,MAAM,GACjB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,EAAE,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,CAyB/D"}
@@ -5,6 +5,30 @@ import { invalidFieldMessage, requiredFieldMessage } from "../../../cli/output.j
5
5
  import { isRecord } from "../../../shared/guards.js";
6
6
  import { RECIPES_SCENARIOS_DIR_NAME, RECIPES_SCENARIOS_INDEX_NAME } from "./constants.js";
7
7
  import { normalizeScenarioId } from "./normalize.js";
8
+ function normalizeScenarioEvidence(raw, sourcePath) {
9
+ if (raw === undefined)
10
+ return undefined;
11
+ if (!isRecord(raw)) {
12
+ throw new Error(invalidFieldMessage("scenario.evidence", "object", sourcePath));
13
+ }
14
+ const required = raw.required === true;
15
+ let files = [];
16
+ if (raw.files !== undefined) {
17
+ if (!Array.isArray(raw.files)) {
18
+ throw new Error(invalidFieldMessage("scenario.evidence.files", "string[]", sourcePath));
19
+ }
20
+ files = raw.files
21
+ .map((value) => (typeof value === "string" ? value.trim() : ""))
22
+ .filter(Boolean);
23
+ if (files.length !== raw.files.length) {
24
+ throw new Error(invalidFieldMessage("scenario.evidence.files", "string[]", sourcePath));
25
+ }
26
+ }
27
+ if (required && files.length === 0) {
28
+ files = ["evidence.json"];
29
+ }
30
+ return { required, files };
31
+ }
8
32
  function validateScenarioDefinition(raw, sourcePath) {
9
33
  if (!isRecord(raw))
10
34
  throw new Error(invalidFieldMessage("scenario", "object", sourcePath));
@@ -31,6 +55,7 @@ function validateScenarioDefinition(raw, sourcePath) {
31
55
  goal,
32
56
  inputs: raw.inputs,
33
57
  outputs: raw.outputs,
58
+ evidence: normalizeScenarioEvidence(raw.evidence, sourcePath),
34
59
  steps: raw.steps,
35
60
  };
36
61
  }
@@ -45,6 +45,10 @@ export type ScenarioDefinition = {
45
45
  goal: string;
46
46
  inputs: unknown;
47
47
  outputs: unknown;
48
+ evidence?: {
49
+ required: boolean;
50
+ files: string[];
51
+ };
48
52
  steps: unknown[];
49
53
  };
50
54
  export type RecipeScenarioDetail = {
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/commands/recipes/impl/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,cAAc,GAAG;IAC3B,cAAc,EAAE,GAAG,CAAC;IACpB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,IAA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MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC7B,GAAG,OAAO,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CA2ChE;AAkCD,wBAAsB,oBAAoB,CAAC,IAAI,EAAE;IAC/C,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC,CAAC;CACvD,GAAG,OAAO,CAAC,MAAM,CAAC,CAiQlB"}
@@ -125,6 +125,12 @@ export async function cmdScenarioInfoParsed(opts) {
125
125
  process.stdout.write(`Goal: ${scenario.goal}\n`);
126
126
  process.stdout.write(`Inputs: ${JSON.stringify(scenario.inputs, null, 2)}\n`);
127
127
  process.stdout.write(`Outputs: ${JSON.stringify(scenario.outputs, null, 2)}\n`);
128
+ if (scenario.evidence?.required) {
129
+ process.stdout.write(`Evidence: required (${normalizeExpectedEvidenceFiles(scenario.evidence.files).join(", ")})\n`);
130
+ }
131
+ else if (scenario.evidence?.files && scenario.evidence.files.length > 0) {
132
+ process.stdout.write(`Evidence: optional (${scenario.evidence.files.join(", ")})\n`);
133
+ }
128
134
  process.stdout.write("Steps:\n");
129
135
  let stepIndex = 1;
130
136
  for (const step of scenario.steps) {
@@ -185,6 +191,33 @@ export async function executeRecipeTool(opts) {
185
191
  function sanitizeRunId(value) {
186
192
  return value.replaceAll(/[^a-zA-Z0-9._-]/g, "_");
187
193
  }
194
+ function normalizeExpectedEvidenceFiles(raw) {
195
+ if (!raw || raw.length === 0)
196
+ return ["evidence.json"];
197
+ const unique = [];
198
+ for (const value of raw) {
199
+ const file = value.trim();
200
+ if (!file)
201
+ continue;
202
+ if (unique.includes(file))
203
+ continue;
204
+ unique.push(file);
205
+ }
206
+ return unique.length > 0 ? unique : ["evidence.json"];
207
+ }
208
+ async function collectStepEvidenceFiles(stepDir, expectedFiles) {
209
+ const present = [];
210
+ const missing = [];
211
+ for (const file of expectedFiles) {
212
+ if (await fileExists(path.join(stepDir, file))) {
213
+ present.push(file);
214
+ }
215
+ else {
216
+ missing.push(file);
217
+ }
218
+ }
219
+ return { present, missing };
220
+ }
188
221
  export async function cmdScenarioRunParsed(opts) {
189
222
  const resolved = opts.resolved ??
190
223
  (await resolveProject({
@@ -241,6 +274,13 @@ export async function cmdScenarioRunParsed(opts) {
241
274
  .replaceAll(".", "-")}-${sanitizeRunId(scenarioId)}`;
242
275
  const runDir = path.join(runsRoot, runId);
243
276
  await mkdir(runDir, { recursive: true });
277
+ const evidenceRequired = scenario.evidence?.required === true;
278
+ const expectedEvidenceFiles = evidenceRequired
279
+ ? normalizeExpectedEvidenceFiles(scenario.evidence?.files)
280
+ : normalizeExpectedEvidenceFiles(scenario.evidence?.files && scenario.evidence.files.length > 0
281
+ ? scenario.evidence.files
282
+ : undefined);
283
+ const missingEvidenceSteps = [];
244
284
  const stepsMeta = [];
245
285
  const stepsReport = [];
246
286
  for (let index = 0; index < scenario.steps.length; index++) {
@@ -299,6 +339,11 @@ export async function cmdScenarioRunParsed(opts) {
299
339
  const durationMs = Date.now() - startedAt;
300
340
  await atomicWriteFile(path.join(stepDir, "stdout.log"), result.stdout, "utf8");
301
341
  await atomicWriteFile(path.join(stepDir, "stderr.log"), result.stderr, "utf8");
342
+ const stepEvidence = await collectStepEvidenceFiles(stepDir, expectedEvidenceFiles);
343
+ const missingRequiredEvidence = evidenceRequired ? stepEvidence.missing : [];
344
+ if (missingRequiredEvidence.length > 0) {
345
+ missingEvidenceSteps.push(index + 1);
346
+ }
302
347
  stepsMeta.push({
303
348
  tool: step.tool,
304
349
  runtime,
@@ -313,10 +358,12 @@ export async function cmdScenarioRunParsed(opts) {
313
358
  entrypoint,
314
359
  args: redactArgs(step.args),
315
360
  env_keys: stepEnvKeys,
361
+ evidence_files: stepEvidence.present,
362
+ missing_evidence_files: missingRequiredEvidence.length > 0 ? missingRequiredEvidence : undefined,
316
363
  exit_code: result.exitCode,
317
364
  duration_ms: durationMs,
318
365
  });
319
- if (result.exitCode !== 0) {
366
+ if (result.exitCode !== 0 || missingRequiredEvidence.length > 0) {
320
367
  const gitSummary = await getGitDiffSummary(resolved.gitRoot);
321
368
  await writeScenarioReport({
322
369
  runDir,
@@ -326,18 +373,32 @@ export async function cmdScenarioRunParsed(opts) {
326
373
  startedAt: runStartedAt,
327
374
  status: "failed",
328
375
  steps: stepsReport,
376
+ evidence: {
377
+ required: evidenceRequired,
378
+ expected_files: expectedEvidenceFiles,
379
+ missing_steps: missingEvidenceSteps,
380
+ },
329
381
  gitSummary,
330
382
  });
331
383
  await atomicWriteFile(path.join(runDir, "meta.json"), `${JSON.stringify({
332
384
  recipe: recipeId,
333
385
  scenario: scenarioId,
334
386
  run_id: runId,
387
+ evidence: {
388
+ required: evidenceRequired,
389
+ expected_files: expectedEvidenceFiles,
390
+ missing_steps: missingEvidenceSteps,
391
+ },
335
392
  steps: stepsMeta,
336
393
  }, null, 2)}\n`, "utf8");
394
+ const reason = missingRequiredEvidence.length > 0
395
+ ? `Scenario step missing required evidence: ${step.tool} (${missingRequiredEvidence.join(", ")})`
396
+ : `Scenario step failed: ${step.tool}`;
397
+ const stepExitCode = result.exitCode === 0 ? 1 : result.exitCode;
337
398
  throw new CliError({
338
- exitCode: result.exitCode,
399
+ exitCode: stepExitCode,
339
400
  code: "E_INTERNAL",
340
- message: `Scenario step failed: ${step.tool}`,
401
+ message: reason,
341
402
  });
342
403
  }
343
404
  }
@@ -350,12 +411,22 @@ export async function cmdScenarioRunParsed(opts) {
350
411
  startedAt: runStartedAt,
351
412
  status: "success",
352
413
  steps: stepsReport,
414
+ evidence: {
415
+ required: evidenceRequired,
416
+ expected_files: expectedEvidenceFiles,
417
+ missing_steps: missingEvidenceSteps,
418
+ },
353
419
  gitSummary,
354
420
  });
355
421
  await atomicWriteFile(path.join(runDir, "meta.json"), `${JSON.stringify({
356
422
  recipe: recipeId,
357
423
  scenario: scenarioId,
358
424
  run_id: runId,
425
+ evidence: {
426
+ required: evidenceRequired,
427
+ expected_files: expectedEvidenceFiles,
428
+ missing_steps: missingEvidenceSteps,
429
+ },
359
430
  steps: stepsMeta,
360
431
  }, null, 2)}\n`, "utf8");
361
432
  process.stdout.write(`Run artifacts: ${path.relative(resolved.gitRoot, runDir)}\n`);
@@ -10,9 +10,16 @@ export type ScenarioRunReportStep = {
10
10
  entrypoint: string;
11
11
  args: string[];
12
12
  env_keys: string[];
13
+ evidence_files: string[];
14
+ missing_evidence_files?: string[];
13
15
  exit_code: number;
14
16
  duration_ms: number;
15
17
  };
18
+ type ScenarioRunEvidenceSummary = {
19
+ required: boolean;
20
+ expected_files: string[];
21
+ missing_steps: number[];
22
+ };
16
23
  export declare function redactArgs(args: string[]): string[];
17
24
  export declare function getGitDiffSummary(cwd: string): Promise<ScenarioRunGitSummary | undefined>;
18
25
  export declare function collectScenarioEnvKeys(stepEnv: Record<string, string> | undefined): string[];
@@ -24,6 +31,7 @@ export declare function writeScenarioReport(opts: {
24
31
  startedAt: string;
25
32
  status: "success" | "failed";
26
33
  steps: ScenarioRunReportStep[];
34
+ evidence: ScenarioRunEvidenceSummary;
27
35
  gitSummary?: ScenarioRunGitSummary;
28
36
  }): Promise<void>;
29
37
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"report.d.ts","sourceRoot":"","sources":["../../../../src/commands/scenario/impl/report.ts"],"names":[],"mappings":"AAYA,KAAK,qBAAqB,GAAG;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;C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opts.status,
95
95
  steps: opts.steps,
96
+ evidence: opts.evidence,
96
97
  git: opts.gitSummary,
97
98
  };
98
99
  await atomicWriteFile(path.join(opts.runDir, SCENARIO_REPORT_NAME), `${JSON.stringify(report, null, 2)}\n`, "utf8");
@@ -0,0 +1,7 @@
1
+ import { type CommandContext } from "./task-backend.js";
2
+ export declare function ensureReconciledBeforeMutation(opts: {
3
+ ctx: CommandContext;
4
+ command: string;
5
+ strictTaskScan?: boolean;
6
+ }): Promise<void>;
7
+ //# sourceMappingURL=reconcile-check.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reconcile-check.d.ts","sourceRoot":"","sources":["../../../src/commands/shared/reconcile-check.ts"],"names":[],"mappings":"AAEA,OAAO,EAAiB,KAAK,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAgBvE,wBAAsB,8BAA8B,CAAC,IAAI,EAAE;IACzD,GAAG,EAAE,cAAc,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,GAAG,OAAO,CAAC,IAAI,CAAC,CA4ChB"}
@@ -0,0 +1,60 @@
1
+ import { exitCodeForError } from "../../cli/exit-codes.js";
2
+ import { CliError } from "../../shared/errors.js";
3
+ import { listTasksMemo } from "./task-backend.js";
4
+ function compactError(err) {
5
+ if (err instanceof Error) {
6
+ const text = err.message.trim();
7
+ return text.length > 0 ? text : err.name;
8
+ }
9
+ return String(err);
10
+ }
11
+ function summarizeWarnings(warnings) {
12
+ const preview = warnings.slice(0, 3).join("; ");
13
+ const suffix = warnings.length > 3 ? `; +${warnings.length - 3} more` : "";
14
+ return `skipped ${warnings.length} task files during scan (${preview}${suffix})`;
15
+ }
16
+ export async function ensureReconciledBeforeMutation(opts) {
17
+ try {
18
+ await opts.ctx.git.statusChangedPaths();
19
+ }
20
+ catch (err) {
21
+ throw new CliError({
22
+ exitCode: exitCodeForError("E_GIT"),
23
+ code: "E_GIT",
24
+ message: `reconcile check failed: cannot inspect git status (${compactError(err)})`,
25
+ context: {
26
+ command: opts.command,
27
+ reason_code: "reconcile_git_state_unreadable",
28
+ },
29
+ });
30
+ }
31
+ if (opts.strictTaskScan === false)
32
+ return;
33
+ try {
34
+ await listTasksMemo(opts.ctx);
35
+ }
36
+ catch (err) {
37
+ throw new CliError({
38
+ exitCode: exitCodeForError("E_VALIDATION"),
39
+ code: "E_VALIDATION",
40
+ message: `reconcile check failed: task scan error (${compactError(err)})`,
41
+ context: {
42
+ command: opts.command,
43
+ reason_code: "reconcile_task_scan_failed",
44
+ },
45
+ });
46
+ }
47
+ const warnings = opts.ctx.taskBackend.getLastListWarnings?.() ?? [];
48
+ if (warnings.length === 0)
49
+ return;
50
+ throw new CliError({
51
+ exitCode: exitCodeForError("E_VALIDATION"),
52
+ code: "E_VALIDATION",
53
+ message: `reconcile check failed: ${summarizeWarnings(warnings)}`,
54
+ context: {
55
+ command: opts.command,
56
+ reason_code: "reconcile_task_scan_incomplete",
57
+ warning_count: warnings.length,
58
+ },
59
+ });
60
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"start.spec.d.ts","sourceRoot":"","sources":["../../src/commands/start.spec.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAKvD,MAAM,MAAM,WAAW,GAAG;IACxB,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,EAAE,OAAO,CAAC;IACb,KAAK,EAAE,OAAO,CAAC;CAChB,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,WAAW,CAAC,WAAW,CA0H9C,CAAC"}
1
+ {"version":3,"file":"start.spec.d.ts","sourceRoot":"","sources":["../../src/commands/start.spec.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AASvD,MAAM,MAAM,WAAW,GAAG;IACxB,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,EAAE,OAAO,CAAC;IACb,KAAK,EAAE,OAAO,CAAC;CAChB,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,WAAW,CAAC,WAAW,CA8I9C,CAAC"}
@@ -1,4 +1,5 @@
1
1
  import { usageError } from "../cli/spec/errors.js";
2
+ import { findRepoWideAllowPrefixes, repoWideAllowPrefixMessage, } from "../shared/allow-prefix-policy.js";
2
3
  import { toStringList } from "../cli/spec/parse-utils.js";
3
4
  export const startSpec = {
4
5
  id: ["start"],
@@ -44,13 +45,14 @@ export const startSpec = {
44
45
  name: "commit-allow",
45
46
  valueHint: "<path-prefix>",
46
47
  repeatable: true,
47
- description: "Repeatable. Allowlist path prefixes to stage for the status commit (used with --commit-from-comment).",
48
+ description: "Repeatable. Allowlist path prefixes to stage for the status commit (used with --commit-from-comment). Use minimal prefixes; '.' is rejected.",
48
49
  },
49
50
  {
50
51
  kind: "boolean",
51
52
  name: "commit-auto-allow",
52
53
  default: false,
53
- description: "Auto-allow inferred allowlist paths if none are provided (used with --commit-from-comment).",
54
+ description: "Deprecated. Disabled for safety; pass explicit --commit-allow prefixes.",
55
+ deprecated: "disabled",
54
56
  },
55
57
  {
56
58
  kind: "boolean",
@@ -99,10 +101,29 @@ export const startSpec = {
99
101
  validateRaw: (raw) => {
100
102
  const author = typeof raw.opts.author === "string" ? raw.opts.author.trim() : "";
101
103
  const body = typeof raw.opts.body === "string" ? raw.opts.body.trim() : "";
104
+ const commitAllow = toStringList(raw.opts["commit-allow"]);
102
105
  if (!author)
103
106
  throw usageError({ spec: startSpec, message: "Invalid value for --author: empty." });
104
107
  if (!body)
105
108
  throw usageError({ spec: startSpec, message: "Invalid value for --body: empty." });
109
+ if (findRepoWideAllowPrefixes(commitAllow).length > 0) {
110
+ throw usageError({
111
+ spec: startSpec,
112
+ message: repoWideAllowPrefixMessage("--commit-allow"),
113
+ });
114
+ }
115
+ if (raw.opts["commit-auto-allow"] === true) {
116
+ throw usageError({
117
+ spec: startSpec,
118
+ message: "--commit-auto-allow is disabled; pass explicit --commit-allow <path-prefix>.",
119
+ });
120
+ }
121
+ if (raw.opts["commit-from-comment"] === true && commitAllow.length === 0) {
122
+ throw usageError({
123
+ spec: startSpec,
124
+ message: "--commit-from-comment requires --commit-allow <path-prefix> (tip: `agentplane guard suggest-allow --format args`).",
125
+ });
126
+ }
106
127
  },
107
128
  parse: (raw) => ({
108
129
  taskId: typeof raw.args["task-id"] === "string" ? raw.args["task-id"] : "",
@@ -1 +1 @@
1
- {"version":3,"file":"sync.command.d.ts","sourceRoot":"","sources":["../../src/commands/sync.command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAiB,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AAE9D,eAAO,MAAM,QAAQ,EAAE,WAAW,CAAC,UAAU,CA6C5C,CAAC;AAEF,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,cAAc,CAAC,IACnE,KAAK,UAAU,EAAE,GAAG,UAAU,KAAG,OAAO,CAAC,MAAM,CAAC,CAS/D"}
1
+ {"version":3,"file":"sync.command.d.ts","sourceRoot":"","sources":["../../src/commands/sync.command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEnE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAiB,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AAE9D,eAAO,MAAM,QAAQ,EAAE,WAAW,CAAC,UAAU,CAmD5C,CAAC;AAEF,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,cAAc,CAAC,IACnE,KAAK,UAAU,EAAE,GAAG,UAAU,KAAG,OAAO,CAAC,MAAM,CAAC,CAS/D"}
@@ -1,3 +1,4 @@
1
+ import { COMMAND_SNIPPETS } from "../cli/command-snippets.js";
1
2
  import { cmdSyncParsed } from "./backend.js";
2
3
  export const syncSpec = {
3
4
  id: ["sync"],
@@ -33,8 +34,14 @@ export const syncSpec = {
33
34
  { kind: "boolean", name: "quiet", default: false, description: "Reduce output noise." },
34
35
  ],
35
36
  examples: [
36
- { cmd: "agentplane sync --direction pull", why: "Pull from backend (configured backend id)." },
37
- { cmd: "agentplane sync redmine --direction push --yes", why: "Push to redmine backend." },
37
+ {
38
+ cmd: COMMAND_SNIPPETS.sync.pullConfigured,
39
+ why: "Pull from backend (configured backend id).",
40
+ },
41
+ {
42
+ cmd: COMMAND_SNIPPETS.sync.pushRedmineExplicitWithYes,
43
+ why: "Push to redmine backend.",
44
+ },
38
45
  ],
39
46
  parse: (raw) => ({
40
47
  backendId: raw.args.id ? String(raw.args.id) : null,
@@ -1 +1 @@
1
- {"version":3,"file":"finish.d.ts","sourceRoot":"","sources":["../../../src/commands/task/finish.ts"],"names":[],"mappings":"AAUA,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,2BAA2B,CAAC;AAmCnC,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,KAAK,EAAE,OAAO,CAAC;IACf,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,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,YAAY,EAAE,OAAO,CAAC;IACtB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,qBAAqB,EAAE,OAAO,CAAC;IAC/B,wBAAwB,EAAE,OAAO,CAAC;IAClC,mBAAmB,EAAE,OAAO,CAAC;IAC7B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,KAAK,EAAE,OAAO,CAAC;CAChB,GAAG,OAAO,CAAC,MAAM,CAAC,CAqUlB"}
1
+ {"version":3,"file":"finish.d.ts","sourceRoot":"","sources":["../../../src/commands/task/finish.ts"],"names":[],"mappings":"AAWA,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,2BAA2B,CAAC;AAmCnC,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,KAAK,EAAE,OAAO,CAAC;IACf,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,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,YAAY,EAAE,OAAO,CAAC;IACtB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,qBAAqB,EAAE,OAAO,CAAC;IAC/B,wBAAwB,EAAE,OAAO,CAAC;IAClC,mBAAmB,EAAE,OAAO,CAAC;IAC7B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,KAAK,EAAE,OAAO,CAAC;CAChB,GAAG,OAAO,CAAC,MAAM,CAAC,CA4VlB"}
@@ -6,6 +6,7 @@ import { readFile, rm } from "node:fs/promises";
6
6
  import path from "node:path";
7
7
  import { buildGitCommitEnv, cmdCommit, commitFromComment } from "../guard/index.js";
8
8
  import { ensureActionApproved } from "../shared/approval-requirements.js";
9
+ import { ensureReconciledBeforeMutation } from "../shared/reconcile-check.js";
9
10
  import { loadCommandContext, loadTaskFromContext, } from "../shared/task-backend.js";
10
11
  import { backendIsLocalFileBackend, getTaskStore } from "../shared/task-store.js";
11
12
  import { readDirectWorkLock } from "../../shared/direct-work-lock.js";
@@ -30,6 +31,7 @@ export async function cmdFinish(opts) {
30
31
  try {
31
32
  const ctx = opts.ctx ??
32
33
  (await loadCommandContext({ cwd: opts.cwd, rootOverride: opts.rootOverride ?? null }));
34
+ await ensureReconciledBeforeMutation({ ctx, command: "finish" });
33
35
  if (opts.force) {
34
36
  await ensureActionApproved({
35
37
  action: "force_action",
@@ -40,13 +42,7 @@ export async function cmdFinish(opts) {
40
42
  }
41
43
  const { prefix, min_chars: minChars } = ctx.config.tasks.comments.verified;
42
44
  requireStructuredComment(opts.body, prefix, minChars);
43
- const autoStatusCommit = (ctx.config.finish_auto_status_commit === true ||
44
- ctx.config.commit_automation === "finish_only") &&
45
- !opts.commitFromComment &&
46
- !opts.statusCommit &&
47
- opts.closeCommit !== true &&
48
- opts.taskIds.length === 1;
49
- const statusCommitRequested = opts.statusCommit || autoStatusCommit;
45
+ const statusCommitRequested = opts.statusCommit;
50
46
  if ((opts.commitFromComment || statusCommitRequested) && opts.taskIds.length !== 1) {
51
47
  throw new CliError({
52
48
  exitCode: 2,
@@ -76,6 +72,34 @@ export async function cmdFinish(opts) {
76
72
  message: "--commit-from-comment/--status-commit requires exactly one task id",
77
73
  });
78
74
  }
75
+ if (opts.commitAutoAllow) {
76
+ throw new CliError({
77
+ exitCode: 2,
78
+ code: "E_USAGE",
79
+ message: "--commit-auto-allow is disabled; pass explicit --commit-allow <path-prefix>.",
80
+ });
81
+ }
82
+ if (opts.statusCommitAutoAllow) {
83
+ throw new CliError({
84
+ exitCode: 2,
85
+ code: "E_USAGE",
86
+ message: "--status-commit-auto-allow is disabled; pass explicit --status-commit-allow <path-prefix>.",
87
+ });
88
+ }
89
+ if (opts.commitFromComment && opts.commitAllow.length === 0) {
90
+ throw new CliError({
91
+ exitCode: 2,
92
+ code: "E_USAGE",
93
+ message: "--commit-from-comment requires --commit-allow <path-prefix>",
94
+ });
95
+ }
96
+ if (statusCommitRequested && opts.statusCommitAllow.length === 0) {
97
+ throw new CliError({
98
+ exitCode: 2,
99
+ code: "E_USAGE",
100
+ message: "--status-commit requires --status-commit-allow <path-prefix>",
101
+ });
102
+ }
79
103
  const gitRoot = ctx.resolvedProject.gitRoot;
80
104
  const commitInfo = opts.commit
81
105
  ? await readCommitInfo(gitRoot, opts.commit)
@@ -168,7 +192,7 @@ export async function cmdFinish(opts) {
168
192
  enforceStatusCommitPolicy({
169
193
  policy: ctx.config.status_commit_policy,
170
194
  action: "finish",
171
- confirmed: opts.confirmStatusCommit || autoStatusCommit,
195
+ confirmed: opts.confirmStatusCommit,
172
196
  quiet: opts.quiet,
173
197
  statusFrom: primaryStatusFrom ?? "UNKNOWN",
174
198
  statusTo: "DONE",
@@ -208,7 +232,7 @@ export async function cmdFinish(opts) {
208
232
  formattedComment: formatCommentBodyForCommit(opts.body, ctx.config),
209
233
  emoji: opts.commitEmoji ?? defaultCommitEmojiForStatus("DONE"),
210
234
  allow: opts.commitAllow,
211
- autoAllow: opts.commitAutoAllow || opts.commitAllow.length === 0,
235
+ autoAllow: false,
212
236
  allowTasks: opts.commitAllowTasks,
213
237
  requireClean: opts.commitRequireClean,
214
238
  quiet: opts.quiet,
@@ -269,7 +293,7 @@ export async function cmdFinish(opts) {
269
293
  formattedComment: formatCommentBodyForCommit(opts.body, ctx.config),
270
294
  emoji: opts.statusCommitEmoji ?? defaultCommitEmojiForStatus("DONE"),
271
295
  allow: opts.statusCommitAllow,
272
- autoAllow: opts.statusCommitAutoAllow || opts.statusCommitAllow.length === 0,
296
+ autoAllow: false,
273
297
  allowTasks: true,
274
298
  requireClean: opts.statusCommitRequireClean,
275
299
  quiet: opts.quiet,
@@ -1 +1 @@
1
- {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/commands/task/list.ts"],"names":[],"mappings":"AACA,OAAO,EAAqC,KAAK,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAEnG,OAAO,EAKL,KAAK,eAAe,EACrB,MAAM,aAAa,CAAC;AAErB,wBAAsB,sBAAsB,CAAC,IAAI,EAAE;IACjD,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,eAAe,CAAC;CAC1B,GAAG,OAAO,CAAC,MAAM,CAAC,CA4ClB;AAED,wBAAsB,WAAW,CAAC,IAAI,EAAE;IACtC,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,eAAe,CAAC;CAC1B,GAAG,OAAO,CAAC,MAAM,CAAC,CAElB"}
1
+ {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/commands/task/list.ts"],"names":[],"mappings":"AACA,OAAO,EAAqC,KAAK,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAEnG,OAAO,EAML,KAAK,eAAe,EACrB,MAAM,aAAa,CAAC;AAErB,wBAAsB,sBAAsB,CAAC,IAAI,EAAE;IACjD,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,eAAe,CAAC;CAC1B,GAAG,OAAO,CAAC,MAAM,CAAC,CA6ClB;AAED,wBAAsB,WAAW,CAAC,IAAI,EAAE;IACtC,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,eAAe,CAAC;CAC1B,GAAG,OAAO,CAAC,MAAM,CAAC,CAElB"}