agentplane 0.3.2 → 0.3.4

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 (205) hide show
  1. package/assets/AGENTS.md +4 -4
  2. package/assets/agents/CODER.json +14 -10
  3. package/assets/agents/CREATOR.json +8 -6
  4. package/assets/agents/DOCS.json +9 -6
  5. package/assets/agents/INTEGRATOR.json +9 -6
  6. package/assets/agents/ORCHESTRATOR.json +8 -6
  7. package/assets/agents/PLANNER.json +8 -5
  8. package/assets/agents/REDMINE.json +6 -3
  9. package/assets/agents/REVIEWER.json +8 -6
  10. package/assets/agents/TESTER.json +8 -4
  11. package/assets/agents/UPDATER.json +6 -4
  12. package/assets/agents/UPGRADER.json +7 -6
  13. package/assets/policy/dod.code.md +2 -2
  14. package/assets/policy/dod.core.md +16 -2
  15. package/assets/policy/dod.docs.md +2 -2
  16. package/assets/policy/incidents.md +44 -1
  17. package/assets/policy/workflow.direct.md +8 -4
  18. package/bin/agentplane.js +59 -9
  19. package/bin/dist-guard.js +78 -10
  20. package/bin/runtime-context.d.ts +3 -0
  21. package/bin/runtime-context.js +13 -0
  22. package/bin/runtime-watch.d.ts +26 -0
  23. package/bin/runtime-watch.js +116 -0
  24. package/bin/stale-dist-policy.d.ts +6 -0
  25. package/bin/stale-dist-policy.js +44 -0
  26. package/dist/.build-manifest.json +2485 -5
  27. package/dist/backends/task-backend/local-backend.d.ts.map +1 -1
  28. package/dist/backends/task-backend/local-backend.js +9 -12
  29. package/dist/backends/task-backend/redmine-backend.d.ts.map +1 -1
  30. package/dist/backends/task-backend/redmine-backend.js +23 -18
  31. package/dist/backends/task-backend/shared/constants.d.ts +1 -0
  32. package/dist/backends/task-backend/shared/constants.d.ts.map +1 -1
  33. package/dist/backends/task-backend/shared/constants.js +1 -0
  34. package/dist/backends/task-backend/shared/doc.d.ts +1 -0
  35. package/dist/backends/task-backend/shared/doc.d.ts.map +1 -1
  36. package/dist/backends/task-backend/shared/doc.js +4 -1
  37. package/dist/backends/task-backend/shared/export.js +3 -3
  38. package/dist/cli/bootstrap-guide.d.ts +2 -3
  39. package/dist/cli/bootstrap-guide.d.ts.map +1 -1
  40. package/dist/cli/bootstrap-guide.js +16 -35
  41. package/dist/cli/command-guide.d.ts +14 -1
  42. package/dist/cli/command-guide.d.ts.map +1 -1
  43. package/dist/cli/command-guide.js +71 -47
  44. package/dist/cli/run-cli/catalog.d.ts +7 -0
  45. package/dist/cli/run-cli/catalog.d.ts.map +1 -0
  46. package/dist/cli/run-cli/catalog.js +22 -0
  47. package/dist/cli/run-cli/command-catalog.d.ts +1 -1
  48. package/dist/cli/run-cli/command-catalog.d.ts.map +1 -1
  49. package/dist/cli/run-cli/command-catalog.js +11 -0
  50. package/dist/cli/run-cli/commands/core.d.ts.map +1 -1
  51. package/dist/cli/run-cli/commands/core.js +37 -29
  52. package/dist/cli/run-cli/commands/init/write-config.d.ts.map +1 -1
  53. package/dist/cli/run-cli/commands/init/write-config.js +2 -0
  54. package/dist/cli/run-cli/commands/init/write-workflow.d.ts.map +1 -1
  55. package/dist/cli/run-cli/commands/init/write-workflow.js +6 -55
  56. package/dist/cli/run-cli/commands/init.js +5 -14
  57. package/dist/cli/run-cli/error-guidance.d.ts +9 -0
  58. package/dist/cli/run-cli/error-guidance.d.ts.map +1 -0
  59. package/dist/cli/run-cli/error-guidance.js +180 -0
  60. package/dist/cli/run-cli/globals.d.ts +22 -0
  61. package/dist/cli/run-cli/globals.d.ts.map +1 -0
  62. package/dist/cli/run-cli/globals.js +197 -0
  63. package/dist/cli/run-cli/update-warning.d.ts +6 -0
  64. package/dist/cli/run-cli/update-warning.d.ts.map +1 -0
  65. package/dist/cli/run-cli/update-warning.js +64 -0
  66. package/dist/cli/run-cli.d.ts.map +1 -1
  67. package/dist/cli/run-cli.js +5 -476
  68. package/dist/cli/spec/docs-render.d.ts.map +1 -1
  69. package/dist/cli/spec/docs-render.js +14 -1
  70. package/dist/commands/doctor/archive.d.ts +4 -0
  71. package/dist/commands/doctor/archive.d.ts.map +1 -0
  72. package/dist/commands/doctor/archive.js +211 -0
  73. package/dist/commands/doctor/fixes.d.ts +9 -0
  74. package/dist/commands/doctor/fixes.d.ts.map +1 -0
  75. package/dist/commands/doctor/fixes.js +40 -0
  76. package/dist/commands/doctor/layering.d.ts +2 -0
  77. package/dist/commands/doctor/layering.d.ts.map +1 -0
  78. package/dist/commands/doctor/layering.js +87 -0
  79. package/dist/commands/doctor/runtime.d.ts +4 -0
  80. package/dist/commands/doctor/runtime.d.ts.map +1 -0
  81. package/dist/commands/doctor/runtime.js +56 -0
  82. package/dist/commands/doctor/workflow.d.ts +6 -0
  83. package/dist/commands/doctor/workflow.d.ts.map +1 -0
  84. package/dist/commands/doctor/workflow.js +62 -0
  85. package/dist/commands/doctor/workspace.d.ts +2 -0
  86. package/dist/commands/doctor/workspace.d.ts.map +1 -0
  87. package/dist/commands/doctor/workspace.js +165 -0
  88. package/dist/commands/doctor.run.d.ts.map +1 -1
  89. package/dist/commands/doctor.run.js +16 -342
  90. package/dist/commands/doctor.spec.d.ts +1 -0
  91. package/dist/commands/doctor.spec.d.ts.map +1 -1
  92. package/dist/commands/doctor.spec.js +15 -1
  93. package/dist/commands/guard/impl/commands.d.ts.map +1 -1
  94. package/dist/commands/guard/impl/commands.js +19 -0
  95. package/dist/commands/release/apply.command.d.ts +2 -8
  96. package/dist/commands/release/apply.command.d.ts.map +1 -1
  97. package/dist/commands/release/apply.command.js +158 -387
  98. package/dist/commands/release/apply.mutation.d.ts +7 -0
  99. package/dist/commands/release/apply.mutation.d.ts.map +1 -0
  100. package/dist/commands/release/apply.mutation.js +107 -0
  101. package/dist/commands/release/apply.preflight.d.ts +25 -0
  102. package/dist/commands/release/apply.preflight.d.ts.map +1 -0
  103. package/dist/commands/release/apply.preflight.js +338 -0
  104. package/dist/commands/release/apply.reporting.d.ts +4 -0
  105. package/dist/commands/release/apply.reporting.d.ts.map +1 -0
  106. package/dist/commands/release/apply.reporting.js +24 -0
  107. package/dist/commands/release/apply.types.d.ts +46 -0
  108. package/dist/commands/release/apply.types.d.ts.map +1 -0
  109. package/dist/commands/release/apply.types.js +1 -0
  110. package/dist/commands/runtime.command.d.ts +28 -0
  111. package/dist/commands/runtime.command.d.ts.map +1 -0
  112. package/dist/commands/runtime.command.js +169 -0
  113. package/dist/commands/shared/task-store.d.ts.map +1 -1
  114. package/dist/commands/shared/task-store.js +7 -3
  115. package/dist/commands/task/add.d.ts.map +1 -1
  116. package/dist/commands/task/add.js +3 -33
  117. package/dist/commands/task/block.d.ts.map +1 -1
  118. package/dist/commands/task/block.js +2 -2
  119. package/dist/commands/task/close-duplicate.d.ts.map +1 -1
  120. package/dist/commands/task/close-duplicate.js +2 -2
  121. package/dist/commands/task/close-noop.d.ts.map +1 -1
  122. package/dist/commands/task/close-noop.js +2 -2
  123. package/dist/commands/task/comment.js +2 -2
  124. package/dist/commands/task/derive.d.ts.map +1 -1
  125. package/dist/commands/task/derive.js +3 -3
  126. package/dist/commands/task/doc-template.d.ts +10 -0
  127. package/dist/commands/task/doc-template.d.ts.map +1 -0
  128. package/dist/commands/task/doc-template.js +104 -0
  129. package/dist/commands/task/doc.d.ts.map +1 -1
  130. package/dist/commands/task/doc.js +36 -1
  131. package/dist/commands/task/finish.d.ts.map +1 -1
  132. package/dist/commands/task/finish.js +7 -4
  133. package/dist/commands/task/migrate-doc.command.d.ts.map +1 -1
  134. package/dist/commands/task/migrate-doc.command.js +5 -1
  135. package/dist/commands/task/migrate-doc.d.ts.map +1 -1
  136. package/dist/commands/task/migrate-doc.js +136 -2
  137. package/dist/commands/task/new.d.ts.map +1 -1
  138. package/dist/commands/task/new.js +4 -110
  139. package/dist/commands/task/new.spec.js +3 -3
  140. package/dist/commands/task/plan.d.ts.map +1 -1
  141. package/dist/commands/task/plan.js +5 -4
  142. package/dist/commands/task/scaffold.d.ts.map +1 -1
  143. package/dist/commands/task/scaffold.js +7 -52
  144. package/dist/commands/task/set-status.d.ts.map +1 -1
  145. package/dist/commands/task/set-status.js +2 -2
  146. package/dist/commands/task/shared/dependencies.d.ts +15 -0
  147. package/dist/commands/task/shared/dependencies.d.ts.map +1 -0
  148. package/dist/commands/task/shared/dependencies.js +143 -0
  149. package/dist/commands/task/shared/docs.d.ts +21 -0
  150. package/dist/commands/task/shared/docs.d.ts.map +1 -0
  151. package/dist/commands/task/shared/docs.js +121 -0
  152. package/dist/commands/task/shared/listing.d.ts +20 -0
  153. package/dist/commands/task/shared/listing.d.ts.map +1 -0
  154. package/dist/commands/task/shared/listing.js +127 -0
  155. package/dist/commands/task/shared/tags.d.ts +24 -0
  156. package/dist/commands/task/shared/tags.d.ts.map +1 -0
  157. package/dist/commands/task/shared/tags.js +177 -0
  158. package/dist/commands/task/shared/transitions.d.ts +42 -0
  159. package/dist/commands/task/shared/transitions.d.ts.map +1 -0
  160. package/dist/commands/task/shared/transitions.js +175 -0
  161. package/dist/commands/task/shared.d.ts +5 -106
  162. package/dist/commands/task/shared.d.ts.map +1 -1
  163. package/dist/commands/task/shared.js +5 -681
  164. package/dist/commands/task/start.d.ts.map +1 -1
  165. package/dist/commands/task/start.js +7 -5
  166. package/dist/commands/task/verify-record.d.ts.map +1 -1
  167. package/dist/commands/task/verify-record.js +9 -25
  168. package/dist/commands/task/verify-show.command.d.ts.map +1 -1
  169. package/dist/commands/task/verify-show.command.js +5 -1
  170. package/dist/commands/upgrade/apply.d.ts +44 -0
  171. package/dist/commands/upgrade/apply.d.ts.map +1 -0
  172. package/dist/commands/upgrade/apply.js +180 -0
  173. package/dist/commands/upgrade/report.d.ts +21 -0
  174. package/dist/commands/upgrade/report.d.ts.map +1 -0
  175. package/dist/commands/upgrade/report.js +81 -0
  176. package/dist/commands/upgrade/source.d.ts +35 -0
  177. package/dist/commands/upgrade/source.d.ts.map +1 -0
  178. package/dist/commands/upgrade/source.js +109 -0
  179. package/dist/commands/upgrade/types.d.ts +31 -0
  180. package/dist/commands/upgrade/types.d.ts.map +1 -0
  181. package/dist/commands/upgrade/types.js +1 -0
  182. package/dist/commands/upgrade.d.ts +1 -35
  183. package/dist/commands/upgrade.d.ts.map +1 -1
  184. package/dist/commands/upgrade.js +68 -332
  185. package/dist/commands/workflow-build.command.d.ts.map +1 -1
  186. package/dist/commands/workflow-build.command.js +9 -15
  187. package/dist/shared/diagnostics.d.ts +23 -0
  188. package/dist/shared/diagnostics.d.ts.map +1 -0
  189. package/dist/shared/diagnostics.js +57 -0
  190. package/dist/shared/errors.d.ts +2 -0
  191. package/dist/shared/errors.d.ts.map +1 -1
  192. package/dist/shared/errors.js +2 -0
  193. package/dist/shared/repo-cli-version.d.ts +13 -0
  194. package/dist/shared/repo-cli-version.d.ts.map +1 -0
  195. package/dist/shared/repo-cli-version.js +63 -0
  196. package/dist/shared/runtime-source.d.ts +33 -0
  197. package/dist/shared/runtime-source.d.ts.map +1 -0
  198. package/dist/shared/runtime-source.js +156 -0
  199. package/dist/shared/version-compare.d.ts +7 -0
  200. package/dist/shared/version-compare.d.ts.map +1 -0
  201. package/dist/shared/version-compare.js +30 -0
  202. package/dist/shared/workflow-artifacts.d.ts +37 -0
  203. package/dist/shared/workflow-artifacts.d.ts.map +1 -0
  204. package/dist/shared/workflow-artifacts.js +97 -0
  205. package/package.json +2 -2
@@ -1,23 +1,14 @@
1
1
  import { COMMAND_SNIPPETS } from "./command-snippets.js";
2
- import { AGENT_BOOTSTRAP_DOC_PATH, BOOTSTRAP_SECTIONS, renderBootstrapReferenceLine, } from "./bootstrap-guide.js";
3
- function renderBootstrapOverview() {
4
- const lines = [];
5
- for (const section of BOOTSTRAP_SECTIONS) {
6
- lines.push(`## ${section.heading}`, "", section.summary, "");
7
- for (const command of section.commands) {
8
- lines.push(`- \`${command}\``);
9
- }
10
- lines.push("");
11
- }
12
- if (lines.at(-1) === "")
13
- lines.pop();
14
- return lines;
2
+ import { BOOTSTRAP_PREFLIGHT_COMMANDS, BOOTSTRAP_TASK_PREP_COMMANDS } from "./bootstrap-guide.js";
3
+ const SHARED_STARTUP_NOTE = `- Shared startup path: \`${COMMAND_SNIPPETS.core.quickstart}\` is the canonical installed bootstrap; use \`${COMMAND_SNIPPETS.core.role}\` only for role-specific deltas.`;
4
+ function renderQuickstartCommandBlock(commands) {
5
+ return ["```bash", ...commands, "```"];
15
6
  }
16
7
  const ROLE_GUIDES = [
17
8
  {
18
9
  role: "ORCHESTRATOR",
19
10
  lines: [
20
- `- Shared bootstrap path: \`${COMMAND_SNIPPETS.core.quickstart}\` -> \`${AGENT_BOOTSTRAP_DOC_PATH}\`.`,
11
+ SHARED_STARTUP_NOTE,
21
12
  "- Owns preflight, plan summaries, approvals, and scope checkpoints.",
22
13
  "- Does not create non-executable tasks or bypass lifecycle guardrails.",
23
14
  ],
@@ -25,7 +16,7 @@ const ROLE_GUIDES = [
25
16
  {
26
17
  role: "PLANNER",
27
18
  lines: [
28
- `- Shared bootstrap path: \`${COMMAND_SNIPPETS.core.quickstart}\` -> \`${AGENT_BOOTSTRAP_DOC_PATH}\`.`,
19
+ SHARED_STARTUP_NOTE,
29
20
  '- Create executable tasks with `agentplane task new --title "..." --description "..." --priority med --owner <ROLE> --tag <tag>`.',
30
21
  '- Fill docs with `agentplane task doc set <task-id> --section <name> --text "..."` and set plan text with `agentplane task plan set <task-id> --text "..." --updated-by <ROLE>`.',
31
22
  "- Approve plan only after required sections and Verify Steps are ready.",
@@ -34,34 +25,37 @@ const ROLE_GUIDES = [
34
25
  {
35
26
  role: "CODER",
36
27
  lines: [
37
- `- Shared bootstrap path: \`${COMMAND_SNIPPETS.core.quickstart}\` -> \`${AGENT_BOOTSTRAP_DOC_PATH}\`.`,
28
+ SHARED_STARTUP_NOTE,
38
29
  "- direct: stay in the current checkout; branch_pr: start a task branch/worktree first.",
39
30
  `- Start deterministically with \`${COMMAND_SNIPPETS.core.startTask}\` after plan approval.`,
40
31
  '- Treat `agentplane task verify-show <task-id>` as the verification contract, then record `agentplane verify <task-id> --ok|--rework --by <ROLE> --note "..."`.',
41
32
  `- Preferred direct close path: \`${COMMAND_SNIPPETS.core.finishTask}\` with \`--result "..." \`; add \`--no-close-commit\` only for explicit manual close handling.`,
33
+ "- For manual close or allowlist detail, use `agentplane help finish` and `agentplane help commit` on demand.",
42
34
  ],
43
35
  },
44
36
  {
45
37
  role: "TESTER",
46
38
  lines: [
47
- `- Shared bootstrap path: \`${COMMAND_SNIPPETS.core.quickstart}\` -> \`${AGENT_BOOTSTRAP_DOC_PATH}\`.`,
39
+ SHARED_STARTUP_NOTE,
48
40
  "- Start only after plan approval and explicit Verify Steps exist.",
49
41
  '- Use `agentplane task verify-show <task-id>` before running checks, then record `agentplane verify <task-id> --ok|--rework --by <ROLE> --note "..."`.',
50
42
  `- In direct mode, close with \`${COMMAND_SNIPPETS.core.finishTask}\` plus \`--result "..." \` when you own final verification.`,
43
+ "- For mixed-state recovery or runtime ambiguity, use `agentplane doctor` and `agentplane runtime explain` instead of relying on the short quickstart screen.",
51
44
  ],
52
45
  },
53
46
  {
54
47
  role: "DOCS",
55
48
  lines: [
56
- `- Shared bootstrap path: \`${COMMAND_SNIPPETS.core.quickstart}\` -> \`${AGENT_BOOTSTRAP_DOC_PATH}\`.`,
49
+ SHARED_STARTUP_NOTE,
57
50
  '- Keep task docs and user docs aligned with runtime behavior via `agentplane task doc set <task-id> --section <name> --text "..."`.',
58
51
  "- For implementation tasks, verify generated/help surfaces after changing CLI-facing text.",
52
+ "- The docs site may expand CLI behavior, but installed runtime guidance must stay self-contained and must not depend on repo-only docs paths.",
59
53
  ],
60
54
  },
61
55
  {
62
56
  role: "REVIEWER",
63
57
  lines: [
64
- `- Shared bootstrap path: \`${COMMAND_SNIPPETS.core.quickstart}\` -> \`${AGENT_BOOTSTRAP_DOC_PATH}\`.`,
58
+ SHARED_STARTUP_NOTE,
65
59
  "- Review artifacts with `agentplane task show <task-id>` and `agentplane pr check <task-id>` when relevant.",
66
60
  "- Focus on regressions, lifecycle drift, and missing verification evidence.",
67
61
  ],
@@ -69,15 +63,16 @@ const ROLE_GUIDES = [
69
63
  {
70
64
  role: "INTEGRATOR",
71
65
  lines: [
72
- `- Shared bootstrap path: \`${COMMAND_SNIPPETS.core.quickstart}\` -> \`${AGENT_BOOTSTRAP_DOC_PATH}\`.`,
66
+ SHARED_STARTUP_NOTE,
73
67
  '- branch_pr: `agentplane pr check <task-id>` -> `agentplane integrate <task-id> --branch task/<task-id>/<slug> --merge-strategy squash --run-verify` -> `agentplane finish <task-id> --commit <git-rev> --author INTEGRATOR --body "Verified: ..." --result "..." --close-commit`.',
74
68
  `- direct: the task owner normally closes with \`${COMMAND_SNIPPETS.core.finishTask}\` plus \`--result "..." \`.`,
69
+ "- For branch-level flags and branch/base diagnostics, use `agentplane help work start`, `agentplane help integrate`, and `agentplane help branch base`.",
75
70
  ],
76
71
  },
77
72
  {
78
73
  role: "CREATOR",
79
74
  lines: [
80
- `- Shared bootstrap path: \`${COMMAND_SNIPPETS.core.quickstart}\` -> \`${AGENT_BOOTSTRAP_DOC_PATH}\`.`,
75
+ SHARED_STARTUP_NOTE,
81
76
  `- Use \`${COMMAND_SNIPPETS.core.startTask}\` only when the new-agent creation task is approved and ready.`,
82
77
  "- Keep commits scoped to the created agent artifacts and task docs.",
83
78
  ],
@@ -85,7 +80,7 @@ const ROLE_GUIDES = [
85
80
  {
86
81
  role: "REDMINE",
87
82
  lines: [
88
- `- Shared bootstrap path: \`${COMMAND_SNIPPETS.core.quickstart}\` -> \`${AGENT_BOOTSTRAP_DOC_PATH}\`.`,
83
+ SHARED_STARTUP_NOTE,
89
84
  `- Sync explicitly with \`${COMMAND_SNIPPETS.sync.pullRedmineExplicit}\` / \`${COMMAND_SNIPPETS.sync.pushRedmineExplicitWithYes}\`.`,
90
85
  "- After sync, follow the same task/bootstrap lifecycle as local backends.",
91
86
  ],
@@ -93,7 +88,7 @@ const ROLE_GUIDES = [
93
88
  {
94
89
  role: "UPDATER",
95
90
  lines: [
96
- `- Shared bootstrap path: \`${COMMAND_SNIPPETS.core.quickstart}\` -> \`${AGENT_BOOTSTRAP_DOC_PATH}\`.`,
91
+ SHARED_STARTUP_NOTE,
97
92
  "- Read-only role: inspect state, do not mutate task or workflow artifacts.",
98
93
  ],
99
94
  },
@@ -101,52 +96,81 @@ const ROLE_GUIDES = [
101
96
  export function listRoles() {
102
97
  return ROLE_GUIDES.map((guide) => guide.role);
103
98
  }
104
- export function renderRole(roleRaw) {
99
+ export function getRoleSupplementLines(roleRaw) {
105
100
  const trimmed = roleRaw.trim();
106
101
  if (!trimmed)
107
102
  return null;
108
103
  const normalized = trimmed.toUpperCase();
109
104
  const guide = ROLE_GUIDES.find((entry) => entry.role.toUpperCase() === normalized);
110
- if (!guide)
105
+ return guide ? guide.lines : null;
106
+ }
107
+ function renderRoleList(title, items) {
108
+ return items && items.length > 0 ? ["", `${title}:`, ...items.map((item) => `- ${item}`)] : [];
109
+ }
110
+ export function renderRole(roleRaw, opts = {}) {
111
+ const trimmed = roleRaw.trim();
112
+ if (!trimmed)
111
113
  return null;
112
- return [`### ${guide.role}`, ...guide.lines].join("\n").trimEnd();
114
+ const normalized = trimmed.toUpperCase();
115
+ const supplementLines = getRoleSupplementLines(normalized);
116
+ const profile = opts.profile ?? null;
117
+ if (!supplementLines && !profile)
118
+ return null;
119
+ const heading = (typeof profile?.id === "string" && profile.id.trim()) || normalized;
120
+ const role = typeof profile?.role === "string" ? profile.role.trim() : "";
121
+ const description = typeof profile?.description === "string" ? profile.description.trim() : "";
122
+ const lines = [
123
+ `### ${heading}`,
124
+ ...(role ? [`Role: ${role}`] : []),
125
+ ...(description ? [`Description: ${description}`] : []),
126
+ ...renderRoleList("Inputs", profile?.inputs),
127
+ ...renderRoleList("Outputs", profile?.outputs),
128
+ ...renderRoleList("Permissions", profile?.permissions),
129
+ ...renderRoleList("Workflow", profile?.workflow),
130
+ ...(supplementLines ? ["", "CLI/runtime notes:", ...supplementLines] : []),
131
+ ...(profile?.filename
132
+ ? [
133
+ "",
134
+ `Source: .agentplane/agents/${profile.filename} (role-specific content); policy gateway files still have higher priority.`,
135
+ ]
136
+ : []),
137
+ ];
138
+ return lines.join("\n").trimEnd();
113
139
  }
114
140
  export function renderQuickstart() {
115
141
  return [
116
142
  "# agentplane quickstart",
117
143
  "",
118
- "The policy gateway file (AGENTS.md or CLAUDE.md) is the source of truth for workflow/process policy. CLI syntax lives in quickstart and `agentplane role <ROLE>`.",
144
+ "The policy gateway file (AGENTS.md or CLAUDE.md) is the source of truth for workflow/process policy.",
145
+ "Keep this first screen short: use it for startup only, then go deeper with `agentplane role <ROLE>` or `agentplane help <command>`.",
119
146
  "Do not edit `.agentplane/tasks.json` by hand.",
120
147
  "If the repository is not initialized yet, stop and run `agentplane init` first.",
121
148
  "",
122
- renderBootstrapReferenceLine(),
123
- "",
124
- ...renderBootstrapOverview(),
149
+ `Canonical installed startup surface: \`${COMMAND_SNIPPETS.core.quickstart}\`.`,
125
150
  "",
126
- "## Role-specific deltas",
151
+ "## First screen",
127
152
  "",
128
- `- Use \`${COMMAND_SNIPPETS.core.role}\` for role-specific constraints after you understand the shared bootstrap path.`,
129
- "- Role output should add deltas, not replace the canonical bootstrap flow.",
153
+ "Run preflight:",
130
154
  "",
131
- "## Branch workflow extras",
155
+ ...renderQuickstartCommandBlock(BOOTSTRAP_PREFLIGHT_COMMANDS),
132
156
  "",
133
- "- `agentplane work start <task-id> --agent <ROLE> --slug <slug> --worktree`",
134
- "- `agentplane pr open <task-id>` / `agentplane pr update <task-id>` / `agentplane pr check <task-id>`",
135
- "- `agentplane integrate <task-id> --branch task/<task-id>/<slug> --run-verify`",
157
+ "Default direct route:",
136
158
  "",
137
- "## More guidance",
159
+ `- Task setup: \`${BOOTSTRAP_TASK_PREP_COMMANDS[0]}\` -> \`${BOOTSTRAP_TASK_PREP_COMMANDS[1]}\` -> \`${BOOTSTRAP_TASK_PREP_COMMANDS[2]}\`.`,
160
+ `- Execution: \`${COMMAND_SNIPPETS.core.startTask}\` -> \`agentplane task verify-show <task-id>\` -> \`${COMMAND_SNIPPETS.core.verifyTask}\` -> \`${COMMAND_SNIPPETS.core.finishTask}\` with \`--result "..." \`.`,
161
+ "- In `direct`, `finish` creates the deterministic close commit by default.",
138
162
  "",
139
- "- `agentplane help <command>` for command-level flags and examples.",
140
- `- \`${COMMAND_SNIPPETS.core.role}\` for role-specific deltas.`,
141
- `- \`${AGENT_BOOTSTRAP_DOC_PATH}\` for the canonical startup path in repository docs.`,
163
+ "## Go deeper",
142
164
  "",
143
- "## Commit message format",
165
+ `- \`${COMMAND_SNIPPETS.core.role}\` for role-specific deltas and mode-specific ownership rules.`,
166
+ "- `agentplane help <command>` for flags, examples, and exceptional/manual flows.",
167
+ "- Keep installed runtime guidance self-contained; do not depend on repo-only docs files.",
168
+ "- If you need the docs site, treat it as a public reference surface rather than a required local file.",
144
169
  "",
145
- "Use: `<emoji> <suffix> <scope>: <summary>`.",
170
+ "## Non-default",
146
171
  "",
147
- "Notes:",
148
- "- `suffix` is the task ID segment after the last dash.",
149
- "- When using comment-driven flags, the subject is auto-built as `<emoji> <suffix> <primary>: <status>` and only for major transitions (TODO->DOING, DOING->BLOCKED, BLOCKED->DOING, DOING->DONE).",
150
- "- Comment-driven commit bodies are structured: `Task`, `Primary`, `Status`, `Comment`.",
172
+ "- `branch_pr`: use `agentplane help work start`, `agentplane help pr`, and `agentplane help integrate`.",
173
+ "- Recovery/mixed state: use `agentplane doctor`, `agentplane upgrade`, and `agentplane runtime explain`.",
174
+ "- Manual close or allowlist details belong in command-specific help, not on this first screen.",
151
175
  ].join("\n");
152
176
  }
@@ -0,0 +1,7 @@
1
+ import { COMMANDS } from "./command-catalog.js";
2
+ export type CatalogMatch = {
3
+ entry: (typeof COMMANDS)[number];
4
+ consumed: number;
5
+ };
6
+ export declare function matchCommandCatalog(tokens: readonly string[]): CatalogMatch | null;
7
+ //# sourceMappingURL=catalog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../../src/cli/run-cli/catalog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAEhD,MAAM,MAAM,YAAY,GAAG;IAAE,KAAK,EAAE,CAAC,OAAO,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC;AAElF,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,GAAG,YAAY,GAAG,IAAI,CAkBlF"}
@@ -0,0 +1,22 @@
1
+ import { COMMANDS } from "./command-catalog.js";
2
+ export function matchCommandCatalog(tokens) {
3
+ let best = null;
4
+ for (const entry of COMMANDS) {
5
+ const id = entry.spec.id;
6
+ if (tokens.length < id.length)
7
+ continue;
8
+ let ok = true;
9
+ for (const [i, seg] of id.entries()) {
10
+ if (tokens[i] !== seg) {
11
+ ok = false;
12
+ break;
13
+ }
14
+ }
15
+ if (!ok)
16
+ continue;
17
+ if (!best || id.length > best.consumed) {
18
+ best = { entry, consumed: id.length };
19
+ }
20
+ }
21
+ return best;
22
+ }
@@ -15,5 +15,5 @@ export type CommandEntry = {
15
15
  needsConfig: boolean;
16
16
  needsTaskContext: boolean;
17
17
  };
18
- export declare const COMMANDS: readonly [CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry];
18
+ export declare const COMMANDS: readonly [CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry, CommandEntry];
19
19
  //# sourceMappingURL=command-catalog.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"command-catalog.d.ts","sourceRoot":"","sources":["../../../src/cli/run-cli/command-catalog.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAkHvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AAC5E,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEzE,MAAM,MAAM,OAAO,GAAG;IACpB,MAAM,EAAE,CAAC,sBAAsB,EAAE,MAAM,KAAK,OAAO,CAAC,cAAc,CAAC,CAAC;IACpE,kBAAkB,EAAE,CAAC,sBAAsB,EAAE,MAAM,KAAK,OAAO,CAAC,eAAe,CAAC,CAAC;IACjF,eAAe,EAAE,CAAC,sBAAsB,EAAE,MAAM,KAAK,OAAO,CAAC,YAAY,CAAC,CAAC;IAC3E,kBAAkB,EAAE,MAAM,SAAS,QAAQ,EAAE,CAAC;CAC/C,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;IAC3B,IAAI,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,OAAO,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;IAC1D,YAAY,EAAE,OAAO,CAAC;IACtB,WAAW,EAAE,OAAO,CAAC;IACrB,gBAAgB,EAAE,OAAO,CAAC;CAC3B,CAAC;AAgBF,eAAO,MAAM,QAAQ,m4CA+hBuB,CAAC"}
1
+ {"version":3,"file":"command-catalog.d.ts","sourceRoot":"","sources":["../../../src/cli/run-cli/command-catalog.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAmHvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AAC5E,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEzE,MAAM,MAAM,OAAO,GAAG;IACpB,MAAM,EAAE,CAAC,sBAAsB,EAAE,MAAM,KAAK,OAAO,CAAC,cAAc,CAAC,CAAC;IACpE,kBAAkB,EAAE,CAAC,sBAAsB,EAAE,MAAM,KAAK,OAAO,CAAC,eAAe,CAAC,CAAC;IACjF,eAAe,EAAE,CAAC,sBAAsB,EAAE,MAAM,KAAK,OAAO,CAAC,YAAY,CAAC,CAAC;IAC3E,kBAAkB,EAAE,MAAM,SAAS,QAAQ,EAAE,CAAC;CAC/C,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;IAC3B,IAAI,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,OAAO,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;IAC1D,YAAY,EAAE,OAAO,CAAC;IACtB,WAAW,EAAE,OAAO,CAAC;IACrB,gBAAgB,EAAE,OAAO,CAAC;CAC3B,CAAC;AAgBF,eAAO,MAAM,QAAQ,+5CA6iBuB,CAAC"}
@@ -67,6 +67,7 @@ import { workflowBuildSpec } from "../../commands/workflow-build.command.js";
67
67
  import { workflowRestoreSpec } from "../../commands/workflow-restore.command.js";
68
68
  import { workflowDebugSpec, workflowLandSpec, workflowSyncSpec, } from "../../commands/workflow-playbook.command.js";
69
69
  import { docsCliSpec } from "../../commands/docs/cli.command.js";
70
+ import { runtimeExplainSpec, runtimeSpec } from "../../commands/runtime.command.js";
70
71
  import { hooksSpec } from "../../commands/hooks/hooks.command.js";
71
72
  import { hooksInstallSpec } from "../../commands/hooks/install.command.js";
72
73
  import { hooksUninstallSpec } from "../../commands/hooks/uninstall.command.js";
@@ -124,6 +125,16 @@ export const COMMANDS = [
124
125
  needsConfig: false,
125
126
  needsTaskContext: false,
126
127
  }),
128
+ entry(runtimeSpec, () => import("../../commands/runtime.command.js").then((m) => m.runRuntime), {
129
+ needsProject: false,
130
+ needsConfig: false,
131
+ needsTaskContext: false,
132
+ }),
133
+ entry(runtimeExplainSpec, () => import("../../commands/runtime.command.js").then((m) => m.runRuntimeExplain), {
134
+ needsProject: false,
135
+ needsConfig: false,
136
+ needsTaskContext: false,
137
+ }),
127
138
  entry(roleSpec, () => import("./commands/core.js").then((m) => m.runRole), {
128
139
  needsProject: false,
129
140
  needsConfig: false,
@@ -1 +1 @@
1
- {"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../../../src/cli/run-cli/commands/core.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAOtE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAIrD,KAAK,gBAAgB,GAAG;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,CAAC;AAE1C,eAAO,MAAM,cAAc,EAAE,WAAW,CAAC,gBAAgB,CAcxD,CAAC;AA6BF,eAAO,MAAM,aAAa,EAAE,cAAc,CAAC,gBAAgB,CAE1D,CAAC;AAEF,KAAK,aAAa,GAAG,OAAO,GAAG,MAAM,CAAC;AACtC,KAAK,eAAe,GAAG;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,aAAa,CAAA;CAAE,CAAC;AAkP9D,eAAO,MAAM,aAAa,EAAE,WAAW,CAAC,eAAe,CAuCtD,CAAC;AAiDF,eAAO,MAAM,YAAY,EAAE,cAAc,CAAC,eAAe,CAExD,CAAC;AAEF,KAAK,UAAU,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,OAAO,CAAA;CAAE,CAAC;AAElD,eAAO,MAAM,QAAQ,EAAE,WAAW,CAAC,UAAU,CAe5C,CAAC;AAoOF,eAAO,MAAM,OAAO,EAAE,cAAc,CAAC,UAAU,CAE9C,CAAC;AAEF,KAAK,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AAE1C,eAAO,MAAM,UAAU,EAAE,WAAW,CAAC,YAAY,CAMhD,CAAC;AAEF,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,OAAO,GAAG,cAAc,CAAC,YAAY,CAAC,CA0FhF"}
1
+ {"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../../../src/cli/run-cli/commands/core.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAatE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAIrD,KAAK,gBAAgB,GAAG;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,CAAC;AAE1C,eAAO,MAAM,cAAc,EAAE,WAAW,CAAC,gBAAgB,CAcxD,CAAC;AA6BF,eAAO,MAAM,aAAa,EAAE,cAAc,CAAC,gBAAgB,CAE1D,CAAC;AAEF,KAAK,aAAa,GAAG,OAAO,GAAG,MAAM,CAAC;AACtC,KAAK,eAAe,GAAG;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,aAAa,CAAA;CAAE,CAAC;AAkP9D,eAAO,MAAM,aAAa,EAAE,WAAW,CAAC,eAAe,CAuCtD,CAAC;AAiDF,eAAO,MAAM,YAAY,EAAE,cAAc,CAAC,eAAe,CAExD,CAAC;AAEF,KAAK,UAAU,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,OAAO,CAAA;CAAE,CAAC;AAElD,eAAO,MAAM,QAAQ,EAAE,WAAW,CAAC,UAAU,CAe5C,CAAC;AA4OF,eAAO,MAAM,OAAO,EAAE,cAAc,CAAC,UAAU,CAE9C,CAAC;AAEF,KAAK,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AAE1C,eAAO,MAAM,UAAU,EAAE,WAAW,CAAC,YAAY,CAMhD,CAAC;AAEF,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,OAAO,GAAG,cAAc,CAAC,YAAY,CAAC,CA0FhF"}
@@ -8,7 +8,7 @@ import { fileExists } from "../../fs-utils.js";
8
8
  import { CliError } from "../../../shared/errors.js";
9
9
  import { dedupeStrings } from "../../../shared/strings.js";
10
10
  import { usageError } from "../../spec/errors.js";
11
- import { listRoles, renderQuickstart, renderRole } from "../../command-guide.js";
11
+ import { getRoleSupplementLines, listRoles, renderQuickstart, renderRole, } from "../../command-guide.js";
12
12
  import { isWorkflowEnforcementDisabled, validateWorkflowAtPath, workflowEnforcementEnvHint, } from "../../../workflow-runtime/index.js";
13
13
  import { toStringList } from "../../spec/parse-utils.js";
14
14
  import { wrapCommand } from "./wrap-command.js";
@@ -420,7 +420,7 @@ async function readAgentProfile(opts) {
420
420
  const raw = parseAgentProfileJson(filePath, await readFile(filePath, "utf8"));
421
421
  return { agentplaneDir: listing.agentplaneDir, filename, profile: raw };
422
422
  }
423
- function renderAgentProfileBlock(opts) {
423
+ function toRoleProfileGuide(opts) {
424
424
  const id = (typeof opts.profile.id === "string" ? opts.profile.id : "").trim() || opts.roleId;
425
425
  const role = (typeof opts.profile.role === "string" ? opts.profile.role : "").trim();
426
426
  const description = (typeof opts.profile.description === "string" ? opts.profile.description : "").trim();
@@ -428,18 +428,16 @@ function renderAgentProfileBlock(opts) {
428
428
  const outputs = toStringList(opts.profile.outputs);
429
429
  const permissions = toStringList(opts.profile.permissions);
430
430
  const workflow = toStringList(opts.profile.workflow);
431
- const lines = [
432
- `### ${id}`,
433
- ...(role ? [`Role: ${role}`] : []),
434
- ...(description ? [`Description: ${description}`] : []),
435
- ...(inputs.length > 0 ? ["", "Inputs:", ...inputs.map((s) => `- ${s}`)] : []),
436
- ...(outputs.length > 0 ? ["", "Outputs:", ...outputs.map((s) => `- ${s}`)] : []),
437
- ...(permissions.length > 0 ? ["", "Permissions:", ...permissions.map((s) => `- ${s}`)] : []),
438
- ...(workflow.length > 0 ? ["", "Workflow:", ...workflow.map((s) => `- ${s}`)] : []),
439
- "",
440
- `Source: .agentplane/agents/${opts.filename} (lower priority; see policy gateway file AGENTS.md or CLAUDE.md)`,
441
- ];
442
- return lines.join("\n").trimEnd();
431
+ return {
432
+ filename: opts.filename,
433
+ id,
434
+ role,
435
+ description,
436
+ inputs,
437
+ outputs,
438
+ permissions,
439
+ workflow,
440
+ };
443
441
  }
444
442
  async function cmdRole(opts) {
445
443
  return wrapCommand({ command: "role", rootOverride: opts.rootOverride }, async () => {
@@ -452,12 +450,19 @@ async function cmdRole(opts) {
452
450
  });
453
451
  }
454
452
  const normalizedRole = normalizeRoleId(roleRaw);
455
- const guide = renderRole(normalizedRole);
456
453
  const agentProfile = await readAgentProfile({
457
454
  cwd: opts.cwd,
458
455
  rootOverride: opts.rootOverride,
459
456
  roleId: normalizedRole,
460
457
  });
458
+ const normalizedProfile = agentProfile
459
+ ? toRoleProfileGuide({
460
+ filename: agentProfile.filename,
461
+ roleId: normalizedRole,
462
+ profile: agentProfile.profile,
463
+ })
464
+ : null;
465
+ const guide = renderRole(normalizedRole, { profile: normalizedProfile });
461
466
  if (!guide && !agentProfile) {
462
467
  const builtin = listRoles();
463
468
  const agentIds = await listAgentProfileIds({
@@ -477,11 +482,15 @@ async function cmdRole(opts) {
477
482
  if (opts.json) {
478
483
  const payload = {
479
484
  role: normalizedRole,
480
- builtin_guide: guide
485
+ guide: guide
481
486
  .split("\n")
482
487
  .map((line) => line.trim())
483
488
  .filter((line) => line.length > 0),
484
489
  };
490
+ const supplementLines = getRoleSupplementLines(normalizedRole);
491
+ if (supplementLines) {
492
+ payload.builtin_guide = supplementLines;
493
+ }
485
494
  if (agentProfile) {
486
495
  payload.agent_profile = {
487
496
  filename: agentProfile.filename,
@@ -492,14 +501,6 @@ async function cmdRole(opts) {
492
501
  return 0;
493
502
  }
494
503
  process.stdout.write(`${guide}\n`);
495
- if (agentProfile) {
496
- const block = renderAgentProfileBlock({
497
- filename: agentProfile.filename,
498
- roleId: normalizedRole,
499
- profile: agentProfile.profile,
500
- });
501
- process.stdout.write(`\n## Agent profile\n\n${block}\n`);
502
- }
503
504
  return 0;
504
505
  }
505
506
  if (!agentProfile) {
@@ -510,14 +511,21 @@ async function cmdRole(opts) {
510
511
  message: `Unknown role: ${roleRaw}.`,
511
512
  });
512
513
  }
513
- const block = renderAgentProfileBlock({
514
- filename: agentProfile.filename,
515
- roleId: normalizedRole,
516
- profile: agentProfile.profile,
517
- });
514
+ const block = renderRole(normalizedRole, { profile: normalizedProfile });
515
+ if (!block) {
516
+ throw usageError({
517
+ spec: roleSpec,
518
+ command: "role",
519
+ message: `Unknown role: ${roleRaw}.`,
520
+ });
521
+ }
518
522
  if (opts.json) {
519
523
  process.stdout.write(`${JSON.stringify({
520
524
  role: normalizedRole,
525
+ guide: block
526
+ .split("\n")
527
+ .map((line) => line.trim())
528
+ .filter((line) => line.length > 0),
521
529
  agent_profile: {
522
530
  filename: agentProfile.filename,
523
531
  profile: agentProfile.profile,
@@ -1 +1 @@
1
- {"version":3,"file":"write-config.d.ts","sourceRoot":"","sources":["../../../../../src/cli/run-cli/commands/init/write-config.ts"],"names":[],"mappings":"AAOA,MAAM,MAAM,mBAAmB,GAAG;IAChC,OAAO,EAAE,cAAc,GAAG,UAAU,GAAG,YAAY,CAAC;IACpD,gBAAgB,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;IAC5C,WAAW,EAAE;QACX,SAAS,EAAE,MAAM,CAAC;QAClB,cAAc,EAAE,MAAM,CAAC;QACvB,YAAY,EAAE,MAAM,CAAC;KACtB,CAAC;IACF,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,kBAAkB,EAAE,MAAM,EAAE,CAAC;IAC7B,yCAAyC,EAAE,MAAM,EAAE,CAAC;CACrD,CAAC;AAEF,wBAAsB,oBAAoB,CACxC,aAAa,EAAE,MAAM,EACrB,OAAO,EAAE,OAAO,GAAG,SAAS,GAC3B,OAAO,CAAC,IAAI,CAAC,CAOf;AAED,wBAAsB,eAAe,CAAC,IAAI,EAAE;IAC1C,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,QAAQ,GAAG,WAAW,CAAC;IACjC,oBAAoB,EAAE,MAAM,CAAC;IAC7B,mBAAmB,EAAE,OAAO,CAAC;IAC7B,sBAAsB,EAAE,OAAO,CAAC;IAChC,qBAAqB,EAAE,OAAO,CAAC;IAC/B,SAAS,EAAE,mBAAmB,CAAC;CAChC,GAAG,OAAO,CAAC,IAAI,CAAC,CAyBhB;AAED,wBAAsB,iBAAiB,CAAC,IAAI,EAAE;IAC5C,OAAO,EAAE,OAAO,GAAG,SAAS,CAAC;IAC7B,WAAW,EAAE,MAAM,CAAC;CACrB,GAAG,OAAO,CAAC,IAAI,CAAC,CAgBhB"}
1
+ {"version":3,"file":"write-config.d.ts","sourceRoot":"","sources":["../../../../../src/cli/run-cli/commands/init/write-config.ts"],"names":[],"mappings":"AAQA,MAAM,MAAM,mBAAmB,GAAG;IAChC,OAAO,EAAE,cAAc,GAAG,UAAU,GAAG,YAAY,CAAC;IACpD,gBAAgB,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;IAC5C,WAAW,EAAE;QACX,SAAS,EAAE,MAAM,CAAC;QAClB,cAAc,EAAE,MAAM,CAAC;QACvB,YAAY,EAAE,MAAM,CAAC;KACtB,CAAC;IACF,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,kBAAkB,EAAE,MAAM,EAAE,CAAC;IAC7B,yCAAyC,EAAE,MAAM,EAAE,CAAC;CACrD,CAAC;AAEF,wBAAsB,oBAAoB,CACxC,aAAa,EAAE,MAAM,EACrB,OAAO,EAAE,OAAO,GAAG,SAAS,GAC3B,OAAO,CAAC,IAAI,CAAC,CAOf;AAED,wBAAsB,eAAe,CAAC,IAAI,EAAE;IAC1C,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,QAAQ,GAAG,WAAW,CAAC;IACjC,oBAAoB,EAAE,MAAM,CAAC;IAC7B,mBAAmB,EAAE,OAAO,CAAC;IAC7B,sBAAsB,EAAE,OAAO,CAAC;IAChC,qBAAqB,EAAE,OAAO,CAAC;IAC/B,SAAS,EAAE,mBAAmB,CAAC;CAChC,GAAG,OAAO,CAAC,IAAI,CAAC,CA0BhB;AAED,wBAAsB,iBAAiB,CAAC,IAAI,EAAE;IAC5C,OAAO,EAAE,OAAO,GAAG,SAAS,CAAC;IAC7B,WAAW,EAAE,MAAM,CAAC;CACrB,GAAG,OAAO,CAAC,IAAI,CAAC,CAgBhB"}
@@ -2,6 +2,7 @@ import { mkdir } from "node:fs/promises";
2
2
  import path from "node:path";
3
3
  import { defaultConfig, saveConfig, setByDottedKey } from "@agentplaneorg/core";
4
4
  import { writeJsonStableIfChanged } from "../../../../shared/write-if-changed.js";
5
+ import { getVersion } from "../../../../meta/version.js";
5
6
  export async function ensureAgentplaneDirs(agentplaneDir, backend) {
6
7
  await mkdir(agentplaneDir, { recursive: true });
7
8
  await mkdir(path.join(agentplaneDir, "tasks"), { recursive: true });
@@ -21,6 +22,7 @@ export async function writeInitConfig(opts) {
21
22
  setByDottedKey(rawConfig, "agents.approvals.require_plan", String(opts.requirePlanApproval));
22
23
  setByDottedKey(rawConfig, "agents.approvals.require_network", String(opts.requireNetworkApproval));
23
24
  setByDottedKey(rawConfig, "agents.approvals.require_verify", String(opts.requireVerifyApproval));
25
+ setByDottedKey(rawConfig, "framework.cli.expected_version", getVersion());
24
26
  setByDottedKey(rawConfig, "execution", JSON.stringify(opts.execution));
25
27
  await saveConfig(opts.agentplaneDir, rawConfig);
26
28
  }
@@ -1 +1 @@
1
- {"version":3,"file":"write-workflow.d.ts","sourceRoot":"","sources":["../../../../../src/cli/run-cli/commands/init/write-workflow.ts"],"names":[],"mappings":"AASA,wBAAsB,kBAAkB,CAAC,IAAI,EAAE;IAC7C,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,QAAQ,GAAG,WAAW,CAAC;IACrC,SAAS,EAAE;QACT,mBAAmB,EAAE,OAAO,CAAC;QAC7B,qBAAqB,EAAE,OAAO,CAAC;QAC/B,sBAAsB,EAAE,OAAO,CAAC;KACjC,CAAC;CACH,GAAG,OAAO,CAAC;IAAE,YAAY,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CA2DtC"}
1
+ {"version":3,"file":"write-workflow.d.ts","sourceRoot":"","sources":["../../../../../src/cli/run-cli/commands/init/write-workflow.ts"],"names":[],"mappings":"AAEA,wBAAsB,kBAAkB,CAAC,IAAI,EAAE;IAC7C,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,QAAQ,GAAG,WAAW,CAAC;IACrC,SAAS,EAAE;QACT,mBAAmB,EAAE,OAAO,CAAC;QAC7B,qBAAqB,EAAE,OAAO,CAAC;QAC/B,sBAAsB,EAAE,OAAO,CAAC;KACjC,CAAC;CACH,GAAG,OAAO,CAAC;IAAE,YAAY,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CAOtC"}
@@ -1,58 +1,9 @@
1
- import { CliError } from "../../../../shared/errors.js";
2
- import { DEFAULT_WORKFLOW_TEMPLATE, buildWorkflowFromTemplates, diagnosticsSummary, publishWorkflowCandidate, resolveWorkflowPaths, } from "../../../../workflow-runtime/index.js";
1
+ import { ensureWorkflowArtifacts } from "../../../../shared/workflow-artifacts.js";
3
2
  export async function ensureInitWorkflow(opts) {
4
- const built = buildWorkflowFromTemplates({
5
- baseTemplate: DEFAULT_WORKFLOW_TEMPLATE,
6
- runtimeContext: {
7
- workflow: {
8
- mode: opts.workflowMode,
9
- version: 1,
10
- approvals: {
11
- require_plan: opts.approvals.requirePlanApproval,
12
- require_verify: opts.approvals.requireVerifyApproval,
13
- require_network: opts.approvals.requireNetworkApproval,
14
- },
15
- },
16
- runtime: {
17
- repo_name: opts.gitRoot.split(/[/\\\\]/).findLast((segment) => segment.length > 0) ?? "repo",
18
- repo_root: opts.gitRoot,
19
- timestamp: new Date().toISOString(),
20
- },
21
- },
3
+ const ensured = await ensureWorkflowArtifacts({
4
+ gitRoot: opts.gitRoot,
5
+ workflowMode: opts.workflowMode,
6
+ approvals: opts.approvals,
22
7
  });
23
- if (built.diagnostics.some((d) => d.severity === "ERROR")) {
24
- throw new CliError({
25
- exitCode: 3,
26
- code: "E_VALIDATION",
27
- message: `Failed to generate WORKFLOW.md: ${diagnosticsSummary(built.diagnostics)}`,
28
- context: {
29
- diagnostics: built.diagnostics.map((d) => ({
30
- severity: d.severity,
31
- code: d.code,
32
- path: d.path,
33
- message: d.message,
34
- })),
35
- },
36
- });
37
- }
38
- const published = await publishWorkflowCandidate(opts.gitRoot, built.text);
39
- if (!published.ok) {
40
- throw new CliError({
41
- exitCode: 3,
42
- code: "E_VALIDATION",
43
- message: `Failed to publish WORKFLOW.md: ${diagnosticsSummary(published.diagnostics)}`,
44
- context: {
45
- diagnostics: published.diagnostics.map((d) => ({
46
- severity: d.severity,
47
- code: d.code,
48
- path: d.path,
49
- message: d.message,
50
- })),
51
- },
52
- });
53
- }
54
- const workflowPaths = resolveWorkflowPaths(opts.gitRoot);
55
- return {
56
- installPaths: [workflowPaths.workflowPath, workflowPaths.lastKnownGoodPath],
57
- };
8
+ return { installPaths: ensured.installPaths };
58
9
  }
@@ -220,8 +220,8 @@ export const initSpec = {
220
220
  why: "Non-interactive setup with flexible defaults.",
221
221
  },
222
222
  {
223
- cmd: "agentplane init --workflow direct --backend local --hooks true --require-plan-approval true --require-network-approval true --require-verify-approval true --yes",
224
- why: "Non-interactive setup with explicit policy flags.",
223
+ cmd: "agentplane init --workflow direct --backend local --hooks true --require-network-approval true --yes",
224
+ why: "Non-interactive setup with profile defaults plus an explicit network-approval override.",
225
225
  },
226
226
  {
227
227
  cmd: "agentplane init --force --yes",
@@ -318,14 +318,11 @@ async function cmdInit(opts) {
318
318
  const isInteractive = process.stdin.isTTY && !flags.yes;
319
319
  if (!process.stdin.isTTY &&
320
320
  !flags.yes &&
321
- (!flags.workflow ||
322
- flags.requirePlanApproval === undefined ||
323
- flags.requireNetworkApproval === undefined ||
324
- flags.requireVerifyApproval === undefined)) {
321
+ (!flags.workflow || flags.requireNetworkApproval === undefined)) {
325
322
  throw usageError({
326
323
  spec: initSpec,
327
324
  command: "init",
328
- message: "Non-interactive init requires --yes or explicit values for: --workflow, --require-plan-approval, --require-network-approval, --require-verify-approval.",
325
+ message: "Non-interactive init requires --yes or explicit values for: --workflow, --require-network-approval.",
329
326
  });
330
327
  }
331
328
  if (isInteractive) {
@@ -406,16 +403,10 @@ async function cmdInit(opts) {
406
403
  if (flags.strictUnsafeConfirm === undefined) {
407
404
  strictUnsafeConfirm = await askYesNo("Require strict explicit confirmation for extra unsafe actions?", strictUnsafeConfirm);
408
405
  }
409
- process.stdout.write(renderInitSection("Approvals", "Control whether plan/network/verification actions require explicit approval by default."));
410
- if (flags.requirePlanApproval === undefined) {
411
- requirePlanApproval = await askYesNo("Require plan approval before work starts?", requirePlanApproval);
412
- }
406
+ process.stdout.write(renderInitSection("Network Approval", "Control whether network actions require explicit approval by default. Plan and verification approvals follow the selected setup profile unless you override them with explicit flags."));
413
407
  if (flags.requireNetworkApproval === undefined) {
414
408
  requireNetworkApproval = await askYesNo("Require explicit approval for network actions?", requireNetworkApproval);
415
409
  }
416
- if (flags.requireVerifyApproval === undefined) {
417
- requireVerifyApproval = await askYesNo("Require explicit approval before recording verification?", requireVerifyApproval);
418
- }
419
410
  process.stdout.write(renderInitSection("Recipes", "Optional: install recipe packs now (comma-separated IDs) or choose none."));
420
411
  if (!flags.recipes) {
421
412
  process.stdout.write(`${renderBundledRecipesHint()}\n`);
@@ -0,0 +1,9 @@
1
+ import type { CliError } from "../../shared/errors.js";
2
+ export type NextAction = {
3
+ command: string;
4
+ reason: string;
5
+ reasonCode?: string;
6
+ };
7
+ export declare function writeError(err: CliError, jsonErrors: boolean): void;
8
+ export declare function resolveAgentplaneHome(): string;
9
+ //# sourceMappingURL=error-guidance.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error-guidance.d.ts","sourceRoot":"","sources":["../../../src/cli/run-cli/error-guidance.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAGvD,MAAM,MAAM,UAAU,GAAG;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AASF,wBAAgB,UAAU,CAAC,GAAG,EAAE,QAAQ,EAAE,UAAU,EAAE,OAAO,GAAG,IAAI,CA4CnE;AAID,wBAAgB,qBAAqB,IAAI,MAAM,CAI9C"}