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
@@ -0,0 +1,42 @@
1
+ import type { AgentplaneConfig } from "@agentplaneorg/core";
2
+ import type { TaskData, TaskEvent } from "../../../backends/task-backend.js";
3
+ import type { CommandContext } from "../../shared/task-backend.js";
4
+ export declare function appendTaskEvent(task: TaskData, event: TaskEvent): TaskEvent[];
5
+ export declare function ensurePlanApprovedIfRequired(task: TaskData, config: AgentplaneConfig): void;
6
+ export declare function ensureVerificationSatisfiedIfRequired(task: TaskData, config: AgentplaneConfig): void;
7
+ export declare function isTransitionAllowed(current: string, next: string): boolean;
8
+ export declare function ensureStatusTransitionAllowed(opts: {
9
+ currentStatus: string;
10
+ nextStatus: string;
11
+ force: boolean;
12
+ }): void;
13
+ export declare function ensureCommentCommitAllowed(opts: {
14
+ enabled: boolean;
15
+ config: AgentplaneConfig;
16
+ action: string;
17
+ confirmed: boolean;
18
+ quiet: boolean;
19
+ statusFrom: string;
20
+ statusTo: string;
21
+ }): void;
22
+ export declare function requireStructuredComment(body: string, prefix: string, minChars: number): void;
23
+ export declare function readHeadCommit(cwd: string): Promise<{
24
+ hash: string;
25
+ message: string;
26
+ }>;
27
+ export declare function enforceStatusCommitPolicy(opts: {
28
+ policy: AgentplaneConfig["status_commit_policy"];
29
+ action: string;
30
+ confirmed: boolean;
31
+ quiet: boolean;
32
+ statusFrom: string;
33
+ statusTo: string;
34
+ }): void;
35
+ export declare function isMajorStatusCommitTransition(statusFrom: string, statusTo: string): boolean;
36
+ export declare function readCommitInfo(cwd: string, rev: string): Promise<{
37
+ hash: string;
38
+ message: string;
39
+ }>;
40
+ export declare function defaultCommitEmojiForStatus(status: string): string;
41
+ export declare function defaultCommitEmojiForAgentId(ctx: CommandContext, agentId: string): Promise<string>;
42
+ //# sourceMappingURL=transitions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transitions.d.ts","sourceRoot":"","sources":["../../../../src/commands/task/shared/transitions.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAM5D,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;AAC7E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAKnE,wBAAgB,eAAe,CAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,GAAG,SAAS,EAAE,CAW7E;AAED,wBAAgB,4BAA4B,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,gBAAgB,GAAG,IAAI,CAc3F;AAED,wBAAgB,qCAAqC,CACnD,IAAI,EAAE,QAAQ,EACd,MAAM,EAAE,gBAAgB,GACvB,IAAI,CAkBN;AAED,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAO1E;AAED,wBAAgB,6BAA6B,CAAC,IAAI,EAAE;IAClD,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,OAAO,CAAC;CAChB,GAAG,IAAI,CAUP;AAED,wBAAgB,0BAA0B,CAAC,IAAI,EAAE;IAC/C,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,gBAAgB,CAAC;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,OAAO,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;CAClB,GAAG,IAAI,CAmBP;AAED,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAgB7F;AAED,wBAAsB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,CAI5F;AAED,wBAAgB,yBAAyB,CAAC,IAAI,EAAE;IAC9C,MAAM,EAAE,gBAAgB,CAAC,sBAAsB,CAAC,CAAC;IACjD,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,OAAO,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;CAClB,GAAG,IAAI,CA8BP;AAUD,wBAAgB,6BAA6B,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAK3F;AAED,wBAAsB,cAAc,CAClC,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,GACV,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,CAI5C;AAED,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAMlE;AAED,wBAAsB,4BAA4B,CAChD,GAAG,EAAE,cAAc,EACnB,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,MAAM,CAAC,CAGjB"}
@@ -0,0 +1,175 @@
1
+ import { execFile } from "node:child_process";
2
+ import path from "node:path";
3
+ import { promisify } from "node:util";
4
+ import { warnMessage } from "../../../cli/output.js";
5
+ import { resolveCommitEmojiForAgent } from "../../../shared/agent-emoji.js";
6
+ import { CliError } from "../../../shared/errors.js";
7
+ import { parseGitLogHashSubject } from "../../../shared/git-log.js";
8
+ import { requiresVerificationByPrimary, toStringArray } from "./tags.js";
9
+ const execFileAsync = promisify(execFile);
10
+ export function appendTaskEvent(task, event) {
11
+ const existing = Array.isArray(task.events)
12
+ ? task.events.filter((entry) => !!entry &&
13
+ typeof entry.type === "string" &&
14
+ typeof entry.at === "string" &&
15
+ typeof entry.author === "string")
16
+ : [];
17
+ return [...existing, event];
18
+ }
19
+ export function ensurePlanApprovedIfRequired(task, config) {
20
+ if (config.agents?.approvals?.require_plan !== true)
21
+ return;
22
+ const state = task.plan_approval?.state ?? "missing";
23
+ if (state === "approved")
24
+ return;
25
+ throw new CliError({
26
+ exitCode: 3,
27
+ code: "E_VALIDATION",
28
+ message: `${task.id}: plan approval is required before work can proceed ` +
29
+ `(plan_approval.state=${JSON.stringify(state)}; use \`agentplane task plan approve ${task.id} --by <USER>\` ` +
30
+ "or set agents.approvals.require_plan=false).",
31
+ });
32
+ }
33
+ export function ensureVerificationSatisfiedIfRequired(task, config) {
34
+ if (config.agents?.approvals?.require_verify !== true)
35
+ return;
36
+ if (!requiresVerificationByPrimary(toStringArray(task.tags), config))
37
+ return;
38
+ const state = task.verification?.state ?? "missing";
39
+ if (state === "ok")
40
+ return;
41
+ const hint = `use \`agentplane verify ${task.id} --ok|--rework --by <ID> --note <TEXT>\` ` +
42
+ `or \`agentplane task verify ok|rework ${task.id} --by <ID> --note <TEXT>\``;
43
+ throw new CliError({
44
+ exitCode: 3,
45
+ code: "E_VALIDATION",
46
+ message: `${task.id}: verification result is required before integration/closure can proceed ` +
47
+ `(verification.state=${JSON.stringify(state)}; ${hint} or set agents.approvals.require_verify=false).`,
48
+ });
49
+ }
50
+ export function isTransitionAllowed(current, next) {
51
+ if (current === next)
52
+ return true;
53
+ if (current === "TODO")
54
+ return next === "DOING" || next === "BLOCKED";
55
+ if (current === "DOING")
56
+ return next === "DONE" || next === "BLOCKED";
57
+ if (current === "BLOCKED")
58
+ return next === "TODO" || next === "DOING";
59
+ if (current === "DONE")
60
+ return false;
61
+ return false;
62
+ }
63
+ export function ensureStatusTransitionAllowed(opts) {
64
+ if (opts.force)
65
+ return;
66
+ if (isTransitionAllowed(opts.currentStatus, opts.nextStatus))
67
+ return;
68
+ throw new CliError({
69
+ exitCode: 2,
70
+ code: "E_USAGE",
71
+ message: `Refusing status transition ${opts.currentStatus} -> ${opts.nextStatus} ` +
72
+ "(use --force to override)",
73
+ });
74
+ }
75
+ export function ensureCommentCommitAllowed(opts) {
76
+ if (!opts.enabled)
77
+ return;
78
+ if (opts.config.commit_automation === "finish_only") {
79
+ throw new CliError({
80
+ exitCode: 2,
81
+ code: "E_USAGE",
82
+ message: `${opts.action}: --commit-from-comment is disabled by commit_automation='finish_only' ` +
83
+ "(allowed only in finish).",
84
+ });
85
+ }
86
+ enforceStatusCommitPolicy({
87
+ policy: opts.config.status_commit_policy,
88
+ action: opts.action,
89
+ confirmed: opts.confirmed,
90
+ quiet: opts.quiet,
91
+ statusFrom: opts.statusFrom,
92
+ statusTo: opts.statusTo,
93
+ });
94
+ }
95
+ export function requireStructuredComment(body, prefix, minChars) {
96
+ const normalized = body.trim();
97
+ if (!normalized.toLowerCase().startsWith(prefix.toLowerCase())) {
98
+ throw new CliError({
99
+ exitCode: 2,
100
+ code: "E_USAGE",
101
+ message: `Comment body must start with ${prefix}`,
102
+ });
103
+ }
104
+ if (normalized.length < minChars) {
105
+ throw new CliError({
106
+ exitCode: 2,
107
+ code: "E_USAGE",
108
+ message: `Comment body must be at least ${minChars} characters`,
109
+ });
110
+ }
111
+ }
112
+ export async function readHeadCommit(cwd) {
113
+ const { stdout } = await execFileAsync("git", ["log", "-1", "--pretty=%H%x00%s"], { cwd });
114
+ const { hash, subject } = parseGitLogHashSubject(stdout);
115
+ return { hash, message: subject };
116
+ }
117
+ export function enforceStatusCommitPolicy(opts) {
118
+ if (!isMajorStatusCommitTransition(opts.statusFrom, opts.statusTo)) {
119
+ throw new CliError({
120
+ exitCode: 2,
121
+ code: "E_USAGE",
122
+ message: `${opts.action}: status/comment-driven commit is allowed only for major transitions ` +
123
+ `(got ${opts.statusFrom.toUpperCase()} -> ${opts.statusTo.toUpperCase()})`,
124
+ });
125
+ }
126
+ if (opts.policy === "off")
127
+ return;
128
+ if (opts.policy === "warn") {
129
+ if (!opts.quiet && !opts.confirmed) {
130
+ process.stderr.write(`${warnMessage(`${opts.action}: status/comment-driven commit requested; policy=warn (pass --confirm-status-commit to acknowledge)`)}\n`);
131
+ }
132
+ return;
133
+ }
134
+ if (opts.policy === "confirm" && !opts.confirmed) {
135
+ throw new CliError({
136
+ exitCode: 2,
137
+ code: "E_USAGE",
138
+ message: `${opts.action}: status/comment-driven commit blocked by status_commit_policy='confirm' ` +
139
+ "(pass --confirm-status-commit to proceed)",
140
+ });
141
+ }
142
+ }
143
+ const MAJOR_STATUS_COMMIT_TRANSITIONS = new Set([
144
+ "READY->DOING",
145
+ "TODO->DOING",
146
+ "DOING->BLOCKED",
147
+ "BLOCKED->DOING",
148
+ "DOING->DONE",
149
+ ]);
150
+ export function isMajorStatusCommitTransition(statusFrom, statusTo) {
151
+ const from = statusFrom.trim().toUpperCase();
152
+ const to = statusTo.trim().toUpperCase();
153
+ if (!from || !to)
154
+ return false;
155
+ return MAJOR_STATUS_COMMIT_TRANSITIONS.has(`${from}->${to}`);
156
+ }
157
+ export async function readCommitInfo(cwd, rev) {
158
+ const { stdout } = await execFileAsync("git", ["log", "-1", "--pretty=%H%x00%s", rev], { cwd });
159
+ const { hash, subject } = parseGitLogHashSubject(stdout);
160
+ return { hash, message: subject };
161
+ }
162
+ export function defaultCommitEmojiForStatus(status) {
163
+ const normalized = status.trim().toUpperCase();
164
+ if (normalized === "DOING")
165
+ return "🚧";
166
+ if (normalized === "DONE")
167
+ return "✅";
168
+ if (normalized === "BLOCKED")
169
+ return "⛔";
170
+ return "🧩";
171
+ }
172
+ export async function defaultCommitEmojiForAgentId(ctx, agentId) {
173
+ const agentsDir = path.join(ctx.resolvedProject.gitRoot, ctx.config.paths.agents_dir);
174
+ return await resolveCommitEmojiForAgent({ agentsDirAbs: agentsDir, agentId });
175
+ }
@@ -1,108 +1,7 @@
1
- import { execFile } from "node:child_process";
2
- import { type AgentplaneConfig } from "@agentplaneorg/core";
3
- import { type TaskBackend, type TaskData, type TaskEvent } from "../../backends/task-backend.js";
4
- import type { CommandContext } from "../shared/task-backend.js";
5
1
  export { dedupeStrings } from "../../shared/strings.js";
6
- export declare const execFileAsync: typeof execFile.__promisify__;
7
- export declare function nowIso(): string;
8
- export declare const VERIFY_STEPS_PLACEHOLDER = "<!-- TODO: FILL VERIFY STEPS -->";
9
- export declare function extractDocSection(doc: string, sectionName: string): string | null;
10
- export declare function isVerifyStepsFilled(sectionText: string | null): boolean;
11
- export declare function isDocSectionFilled(sectionText: string | null): boolean;
12
- export declare function ensureAgentFilledRequiredDocSections(opts: {
13
- task: Pick<TaskData, "id">;
14
- config: AgentplaneConfig;
15
- doc: string;
16
- action: string;
17
- }): void;
18
- export declare function normalizeDependsOnInput(value: string): string[];
19
- export declare function normalizeTaskStatus(value: string): string;
20
- export declare function toStringArray(value: unknown): string[];
21
- export declare function requiresVerify(tags: string[], requiredTags: string[]): boolean;
22
- export type PrimaryTagResolution = {
23
- primary: string;
24
- matched: string[];
25
- usedFallback: boolean;
26
- };
27
- export type TaskTagPolicy = {
28
- primaryAllowlist: string[];
29
- strictPrimary: boolean;
30
- fallbackPrimary: string;
31
- lockPrimaryOnUpdate: boolean;
32
- };
33
- export declare function readTaskTagPolicy(input: CommandContext | AgentplaneConfig): TaskTagPolicy;
34
- export declare function resolvePrimaryTagFromConfig(tags: string[], config: AgentplaneConfig): PrimaryTagResolution;
35
- export declare function requiresVerifyStepsByPrimary(tags: string[], config: AgentplaneConfig): boolean;
36
- export declare function requiresVerificationByPrimary(tags: string[], config: AgentplaneConfig): boolean;
37
- export declare function resolvePrimaryTag(tags: string[], ctx: CommandContext): PrimaryTagResolution;
38
- export declare function warnIfUnknownOwner(ctx: CommandContext, owner: string): Promise<void>;
39
- export declare function appendTaskEvent(task: TaskData, event: TaskEvent): TaskEvent[];
40
- export declare function ensurePlanApprovedIfRequired(task: TaskData, config: AgentplaneConfig): void;
41
- export declare function ensureVerificationSatisfiedIfRequired(task: TaskData, config: AgentplaneConfig): void;
42
- export type DependencyState = {
43
- dependsOn: string[];
44
- missing: string[];
45
- incomplete: string[];
46
- };
47
- export declare function ensureTaskDependsOnGraphIsAcyclic(opts: {
48
- backend: Pick<TaskBackend, "listTasks">;
49
- taskId: string;
50
- dependsOn: string[];
51
- }): Promise<void>;
52
- export declare function resolveTaskDependencyState(task: TaskData, backend: Pick<TaskBackend, "getTask" | "getTasks">): Promise<DependencyState>;
53
- export declare function buildDependencyState(tasks: TaskData[]): Map<string, DependencyState>;
54
- export declare function formatTaskLine(task: TaskData, depState?: DependencyState): string;
55
- export declare function isTransitionAllowed(current: string, next: string): boolean;
56
- export declare function ensureStatusTransitionAllowed(opts: {
57
- currentStatus: string;
58
- nextStatus: string;
59
- force: boolean;
60
- }): void;
61
- export declare function ensureCommentCommitAllowed(opts: {
62
- enabled: boolean;
63
- config: AgentplaneConfig;
64
- action: string;
65
- confirmed: boolean;
66
- quiet: boolean;
67
- statusFrom: string;
68
- statusTo: string;
69
- }): void;
70
- export declare function requireStructuredComment(body: string, prefix: string, minChars: number): void;
71
- export declare function readHeadCommit(cwd: string): Promise<{
72
- hash: string;
73
- message: string;
74
- }>;
75
- export declare function enforceStatusCommitPolicy(opts: {
76
- policy: AgentplaneConfig["status_commit_policy"];
77
- action: string;
78
- confirmed: boolean;
79
- quiet: boolean;
80
- statusFrom: string;
81
- statusTo: string;
82
- }): void;
83
- export declare function isMajorStatusCommitTransition(statusFrom: string, statusTo: string): boolean;
84
- export declare function readCommitInfo(cwd: string, rev: string): Promise<{
85
- hash: string;
86
- message: string;
87
- }>;
88
- export declare function defaultCommitEmojiForStatus(status: string): string;
89
- export declare function defaultCommitEmojiForAgentId(ctx: CommandContext, agentId: string): Promise<string>;
90
- export type TaskListFilters = {
91
- status: string[];
92
- owner: string[];
93
- tag: string[];
94
- limit?: number;
95
- quiet: boolean;
96
- strictRead?: boolean;
97
- };
98
- export declare function parseTaskListFilters(args: string[], opts?: {
99
- allowLimit?: boolean;
100
- }): TaskListFilters;
101
- export declare function handleTaskListWarnings(opts: {
102
- backend: {
103
- getLastListWarnings?: () => string[];
104
- };
105
- strictRead?: boolean;
106
- }): void;
107
- export declare function taskTextBlob(task: TaskData): string;
2
+ export { nowIso, normalizeTaskDocVersion, taskObservationSectionName, extractTaskObservationSection, VERIFY_STEPS_PLACEHOLDER, VERIFICATION_RESULTS_BEGIN, VERIFICATION_RESULTS_END, extractDocSection, isVerifyStepsFilled, isDocSectionFilled, ensureAgentFilledRequiredDocSections, normalizeVerificationSectionLayout, } from "./shared/docs.js";
3
+ export { normalizeDependsOnInput, normalizeTaskStatus, toStringArray, requiresVerify, type PrimaryTagResolution, type TaskTagPolicy, readTaskTagPolicy, resolvePrimaryTagFromConfig, requiresVerifyStepsByPrimary, requiresVerificationByPrimary, resolvePrimaryTag, warnIfUnknownOwner, } from "./shared/tags.js";
4
+ export { type DependencyState, ensureTaskDependsOnGraphIsAcyclic, resolveTaskDependencyState, buildDependencyState, formatTaskLine, } from "./shared/dependencies.js";
5
+ export { appendTaskEvent, ensurePlanApprovedIfRequired, ensureVerificationSatisfiedIfRequired, isTransitionAllowed, ensureStatusTransitionAllowed, ensureCommentCommitAllowed, requireStructuredComment, enforceStatusCommitPolicy, isMajorStatusCommitTransition, readHeadCommit, readCommitInfo, defaultCommitEmojiForStatus, defaultCommitEmojiForAgentId, } from "./shared/transitions.js";
6
+ export { type TaskListFilters, parseTaskListFilters, handleTaskListWarnings, taskTextBlob, } from "./shared/listing.js";
108
7
  //# sourceMappingURL=shared.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../../src/commands/task/shared.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAK9C,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAW5D,OAAO,EAAE,KAAK,WA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AAM,EAAE,CAAA;KAAE,CAAC;IAClD,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,GAAG,IAAI,CAcP;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,QAAQ,GAAG,MAAM,CAiBnD"}
1
+ {"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../../src/commands/task/shared.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAExD,OAAO,EACL,MAAM,EACN,uBAAuB,EACvB,0BAA0B,EAC1B,6BAA6B,EAC7B,wBAAwB,EACxB,0BAA0B,EAC1B,wBAAwB,EACxB,iBAAiB,EACjB,mBAAmB,EACnB,kBAAkB,EAClB,oCAAoC,EACpC,kCAAkC,GACnC,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,uBAAuB,EACvB,mBAAmB,EACnB,aAAa,EACb,cAAc,EACd,KAAK,oBAAoB,EACzB,KAAK,aAAa,EAClB,iBAAiB,EACjB,2BAA2B,EAC3B,4BAA4B,EAC5B,6BAA6B,EAC7B,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,KAAK,eAAe,EACpB,iCAAiC,EACjC,0BAA0B,EAC1B,oBAAoB,EACpB,cAAc,GACf,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,eAAe,EACf,4BAA4B,EAC5B,qCAAqC,EACrC,mBAAmB,EACnB,6BAA6B,EAC7B,0BAA0B,EAC1B,wBAAwB,EACxB,yBAAyB,EACzB,6BAA6B,EAC7B,cAAc,EACd,cAAc,EACd,2BAA2B,EAC3B,4BAA4B,GAC7B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,KAAK,eAAe,EACpB,oBAAoB,EACpB,sBAAsB,EACtB,YAAY,GACb,MAAM,qBAAqB,CAAC"}