agentplane 0.3.11 → 0.3.13

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 (259) hide show
  1. package/assets/AGENTS.md +2 -2
  2. package/assets/RUNNER.md +1 -1
  3. package/assets/agents/CODER.json +4 -0
  4. package/assets/agents/CREATOR.json +1 -0
  5. package/assets/agents/DOCS.json +2 -1
  6. package/assets/agents/INTEGRATOR.json +2 -1
  7. package/assets/agents/ORCHESTRATOR.json +3 -1
  8. package/assets/agents/PLANNER.json +3 -1
  9. package/assets/agents/REVIEWER.json +1 -0
  10. package/assets/agents/TESTER.json +2 -2
  11. package/assets/agents/UPDATER.json +1 -0
  12. package/assets/agents/UPGRADER.json +1 -1
  13. package/assets/codex-plugin/assets/header.png +0 -0
  14. package/assets/codex-plugin/assets/icon.svg +1 -0
  15. package/assets/codex-plugin/assets/logo.svg +1 -0
  16. package/assets/codex-plugin/skills/agentplane/SKILL.md +35 -0
  17. package/assets/policy/governance.md +4 -2
  18. package/assets/policy/incidents.md +3 -19
  19. package/assets/policy/workflow.release.md +5 -2
  20. package/bin/agentplane.js +58 -3
  21. package/bin/stale-dist-policy.js +6 -1
  22. package/dist/.build-manifest.json +271 -161
  23. package/dist/cli/exit-codes.d.ts.map +1 -1
  24. package/dist/cli/exit-codes.js +1 -0
  25. package/dist/cli/reason-codes.d.ts +1 -1
  26. package/dist/cli/reason-codes.d.ts.map +1 -1
  27. package/dist/cli/reason-codes.js +12 -0
  28. package/dist/cli/run-cli/command-catalog/core.d.ts +1 -1
  29. package/dist/cli/run-cli/command-catalog/core.d.ts.map +1 -1
  30. package/dist/cli/run-cli/command-catalog/core.js +22 -1
  31. package/dist/cli/run-cli/command-catalog/project.d.ts +1 -1
  32. package/dist/cli/run-cli/command-catalog/project.d.ts.map +1 -1
  33. package/dist/cli/run-cli/command-catalog/project.js +21 -3
  34. package/dist/cli/run-cli/command-catalog.d.ts +1 -1
  35. package/dist/cli/run-cli/command-catalog.d.ts.map +1 -1
  36. package/dist/cli/run-cli/commands/codex.d.ts +14 -0
  37. package/dist/cli/run-cli/commands/codex.d.ts.map +1 -0
  38. package/dist/cli/run-cli/commands/codex.js +100 -0
  39. package/dist/cli/run-cli/commands/core.d.ts +1 -0
  40. package/dist/cli/run-cli/commands/core.d.ts.map +1 -1
  41. package/dist/cli/run-cli/commands/core.js +1 -0
  42. package/dist/cli/run-cli/commands/init/recipes.d.ts +9 -1
  43. package/dist/cli/run-cli/commands/init/recipes.d.ts.map +1 -1
  44. package/dist/cli/run-cli/commands/init/recipes.js +32 -22
  45. package/dist/cli/run-cli/commands/init.d.ts.map +1 -1
  46. package/dist/cli/run-cli/commands/init.js +26 -21
  47. package/dist/cli/run-cli/error-guidance.js +20 -0
  48. package/dist/cli/run-cli.test-helpers.d.ts +1 -0
  49. package/dist/cli/run-cli.test-helpers.d.ts.map +1 -1
  50. package/dist/cli/run-cli.test-helpers.js +36 -19
  51. package/dist/commands/branch/cleanup-merged.d.ts +1 -0
  52. package/dist/commands/branch/cleanup-merged.d.ts.map +1 -1
  53. package/dist/commands/branch/cleanup-merged.js +18 -9
  54. package/dist/commands/branch/work-start.d.ts.map +1 -1
  55. package/dist/commands/branch/work-start.js +82 -5
  56. package/dist/commands/codex/plugin-install.d.ts +26 -0
  57. package/dist/commands/codex/plugin-install.d.ts.map +1 -0
  58. package/dist/commands/codex/plugin-install.js +209 -0
  59. package/dist/commands/doctor/branch-pr.js +2 -2
  60. package/dist/commands/guard/impl/commands.d.ts +1 -0
  61. package/dist/commands/guard/impl/commands.d.ts.map +1 -1
  62. package/dist/commands/guard/impl/commands.js +78 -8
  63. package/dist/commands/hooks/index.d.ts +1 -1
  64. package/dist/commands/hooks/index.d.ts.map +1 -1
  65. package/dist/commands/hooks/index.js +48 -12
  66. package/dist/commands/pr/check.d.ts.map +1 -1
  67. package/dist/commands/pr/check.js +3 -0
  68. package/dist/commands/pr/integrate/cmd.d.ts.map +1 -1
  69. package/dist/commands/pr/integrate/cmd.js +103 -2
  70. package/dist/commands/pr/integrate/internal/cleanup.d.ts +1 -11
  71. package/dist/commands/pr/integrate/internal/cleanup.d.ts.map +1 -1
  72. package/dist/commands/pr/integrate/internal/cleanup.js +1 -46
  73. package/dist/commands/pr/integrate/internal/finalize.d.ts.map +1 -1
  74. package/dist/commands/pr/integrate/internal/finalize.js +3 -0
  75. package/dist/commands/pr/integrate/internal/github-protection.d.ts +5 -0
  76. package/dist/commands/pr/integrate/internal/github-protection.d.ts.map +1 -0
  77. package/dist/commands/pr/integrate/internal/github-protection.js +13 -0
  78. package/dist/commands/pr/integrate/internal/pre-integrate-bootstrap.d.ts +15 -0
  79. package/dist/commands/pr/integrate/internal/pre-integrate-bootstrap.d.ts.map +1 -0
  80. package/dist/commands/pr/integrate/internal/pre-integrate-bootstrap.js +35 -0
  81. package/dist/commands/pr/integrate/internal/prepare.d.ts +1 -0
  82. package/dist/commands/pr/integrate/internal/prepare.d.ts.map +1 -1
  83. package/dist/commands/pr/integrate/internal/prepare.js +46 -7
  84. package/dist/commands/pr/internal/auto-commit.d.ts +7 -0
  85. package/dist/commands/pr/internal/auto-commit.d.ts.map +1 -0
  86. package/dist/commands/pr/internal/auto-commit.js +69 -0
  87. package/dist/commands/pr/internal/freshness.d.ts +1 -0
  88. package/dist/commands/pr/internal/freshness.d.ts.map +1 -1
  89. package/dist/commands/pr/internal/freshness.js +2 -0
  90. package/dist/commands/pr/internal/sync.d.ts.map +1 -1
  91. package/dist/commands/pr/internal/sync.js +98 -27
  92. package/dist/commands/pr/open.d.ts.map +1 -1
  93. package/dist/commands/pr/open.js +52 -3
  94. package/dist/commands/pr/update.d.ts.map +1 -1
  95. package/dist/commands/pr/update.js +13 -2
  96. package/dist/commands/recipes/active.command.d.ts +7 -0
  97. package/dist/commands/recipes/active.command.d.ts.map +1 -0
  98. package/dist/commands/recipes/active.command.js +12 -0
  99. package/dist/commands/recipes/add.command.d.ts +8 -0
  100. package/dist/commands/recipes/add.command.d.ts.map +1 -0
  101. package/dist/commands/recipes/add.command.js +33 -0
  102. package/dist/commands/recipes/detach.command.d.ts +7 -0
  103. package/dist/commands/recipes/detach.command.d.ts.map +1 -0
  104. package/dist/commands/recipes/detach.command.js +19 -0
  105. package/dist/commands/recipes/disable.command.d.ts +7 -0
  106. package/dist/commands/recipes/disable.command.d.ts.map +1 -0
  107. package/dist/commands/recipes/disable.command.js +10 -0
  108. package/dist/commands/recipes/enable.command.d.ts +7 -0
  109. package/dist/commands/recipes/enable.command.d.ts.map +1 -0
  110. package/dist/commands/recipes/enable.command.js +10 -0
  111. package/dist/commands/recipes/explain-active.command.d.ts +5 -0
  112. package/dist/commands/recipes/explain-active.command.d.ts.map +1 -0
  113. package/dist/commands/recipes/explain-active.command.js +11 -0
  114. package/dist/commands/recipes/explain.command.d.ts.map +1 -1
  115. package/dist/commands/recipes/explain.command.js +4 -2
  116. package/dist/commands/recipes/impl/apply.d.ts.map +1 -1
  117. package/dist/commands/recipes/impl/apply.js +33 -14
  118. package/dist/commands/recipes/impl/commands/active.d.ts +6 -0
  119. package/dist/commands/recipes/impl/commands/active.d.ts.map +1 -0
  120. package/dist/commands/recipes/impl/commands/active.js +46 -0
  121. package/dist/commands/recipes/impl/commands/add.d.ts +7 -0
  122. package/dist/commands/recipes/impl/commands/add.d.ts.map +1 -0
  123. package/dist/commands/recipes/impl/commands/add.js +100 -0
  124. package/dist/commands/recipes/impl/commands/detach.d.ts +6 -0
  125. package/dist/commands/recipes/impl/commands/detach.d.ts.map +1 -0
  126. package/dist/commands/recipes/impl/commands/detach.js +85 -0
  127. package/dist/commands/recipes/impl/commands/disable.d.ts +6 -0
  128. package/dist/commands/recipes/impl/commands/disable.d.ts.map +1 -0
  129. package/dist/commands/recipes/impl/commands/disable.js +21 -0
  130. package/dist/commands/recipes/impl/commands/enable.d.ts +6 -0
  131. package/dist/commands/recipes/impl/commands/enable.d.ts.map +1 -0
  132. package/dist/commands/recipes/impl/commands/enable.js +39 -0
  133. package/dist/commands/recipes/impl/commands/explain-active.d.ts +5 -0
  134. package/dist/commands/recipes/impl/commands/explain-active.d.ts.map +1 -0
  135. package/dist/commands/recipes/impl/commands/explain-active.js +20 -0
  136. package/dist/commands/recipes/impl/commands/explain.d.ts.map +1 -1
  137. package/dist/commands/recipes/impl/commands/explain.js +40 -3
  138. package/dist/commands/recipes/impl/commands/info.d.ts.map +1 -1
  139. package/dist/commands/recipes/impl/commands/info.js +21 -8
  140. package/dist/commands/recipes/impl/commands/install.d.ts.map +1 -1
  141. package/dist/commands/recipes/impl/commands/install.js +32 -29
  142. package/dist/commands/recipes/impl/commands/list.d.ts.map +1 -1
  143. package/dist/commands/recipes/impl/commands/list.js +11 -11
  144. package/dist/commands/recipes/impl/commands/remove.d.ts.map +1 -1
  145. package/dist/commands/recipes/impl/commands/remove.js +5 -0
  146. package/dist/commands/recipes/impl/commands/update.d.ts +7 -0
  147. package/dist/commands/recipes/impl/commands/update.d.ts.map +1 -0
  148. package/dist/commands/recipes/impl/commands/update.js +93 -0
  149. package/dist/commands/recipes/impl/commands.d.ts +7 -0
  150. package/dist/commands/recipes/impl/commands.d.ts.map +1 -1
  151. package/dist/commands/recipes/impl/commands.js +7 -0
  152. package/dist/commands/recipes/impl/constants.d.ts +1 -14
  153. package/dist/commands/recipes/impl/constants.d.ts.map +1 -1
  154. package/dist/commands/recipes/impl/constants.js +1 -18
  155. package/dist/commands/recipes/impl/manifest.d.ts +2 -2
  156. package/dist/commands/recipes/impl/manifest.d.ts.map +1 -1
  157. package/dist/commands/recipes/impl/manifest.js +4 -226
  158. package/dist/commands/recipes/impl/overlay-project.d.ts +32 -0
  159. package/dist/commands/recipes/impl/overlay-project.d.ts.map +1 -0
  160. package/dist/commands/recipes/impl/overlay-project.js +282 -0
  161. package/dist/commands/recipes/impl/paths.d.ts +20 -2
  162. package/dist/commands/recipes/impl/paths.d.ts.map +1 -1
  163. package/dist/commands/recipes/impl/paths.js +23 -5
  164. package/dist/commands/recipes/impl/project-installed-recipes.d.ts +2 -4
  165. package/dist/commands/recipes/impl/project-installed-recipes.d.ts.map +1 -1
  166. package/dist/commands/recipes/impl/project-installed-recipes.js +30 -74
  167. package/dist/commands/recipes/impl/project-recipe-state.d.ts +18 -0
  168. package/dist/commands/recipes/impl/project-recipe-state.d.ts.map +1 -0
  169. package/dist/commands/recipes/impl/project-recipe-state.js +94 -0
  170. package/dist/commands/recipes/impl/project-registry.d.ts +20 -0
  171. package/dist/commands/recipes/impl/project-registry.d.ts.map +1 -0
  172. package/dist/commands/recipes/impl/project-registry.js +104 -0
  173. package/dist/commands/recipes/impl/resolver.d.ts.map +1 -1
  174. package/dist/commands/recipes/impl/resolver.js +5 -3
  175. package/dist/commands/recipes/impl/types.d.ts +1 -240
  176. package/dist/commands/recipes/impl/types.d.ts.map +1 -1
  177. package/dist/commands/recipes/info.command.js +2 -2
  178. package/dist/commands/recipes/install.spec.js +4 -4
  179. package/dist/commands/recipes/list.command.js +4 -4
  180. package/dist/commands/recipes/remove.command.js +2 -2
  181. package/dist/commands/recipes/update.command.d.ts +8 -0
  182. package/dist/commands/recipes/update.command.d.ts.map +1 -0
  183. package/dist/commands/recipes/update.command.js +35 -0
  184. package/dist/commands/recipes.d.ts +7 -4
  185. package/dist/commands/recipes.d.ts.map +1 -1
  186. package/dist/commands/recipes.js +6 -3
  187. package/dist/commands/recipes.test-helpers.d.ts +3 -3
  188. package/dist/commands/recipes.test-helpers.d.ts.map +1 -1
  189. package/dist/commands/recipes.test-helpers.js +105 -15
  190. package/dist/commands/release/apply.command.d.ts +3 -1
  191. package/dist/commands/release/apply.command.d.ts.map +1 -1
  192. package/dist/commands/release/apply.command.js +354 -18
  193. package/dist/commands/release/apply.mutation.d.ts.map +1 -1
  194. package/dist/commands/release/apply.mutation.js +1 -0
  195. package/dist/commands/release/apply.reporting.d.ts +1 -0
  196. package/dist/commands/release/apply.reporting.d.ts.map +1 -1
  197. package/dist/commands/release/apply.reporting.js +12 -8
  198. package/dist/commands/release/apply.types.d.ts +13 -0
  199. package/dist/commands/release/apply.types.d.ts.map +1 -1
  200. package/dist/commands/release/plan.command.d.ts.map +1 -1
  201. package/dist/commands/release/plan.command.js +48 -0
  202. package/dist/commands/scenario/execute.command.js +4 -4
  203. package/dist/commands/scenario/impl/commands.js +4 -4
  204. package/dist/commands/scenario/info.command.js +4 -4
  205. package/dist/commands/scenario/list.command.js +3 -3
  206. package/dist/commands/scenario/run.command.js +5 -5
  207. package/dist/commands/scenario/scenario.command.js +7 -7
  208. package/dist/commands/shared/merged-branch-cleanup.d.ts +12 -0
  209. package/dist/commands/shared/merged-branch-cleanup.d.ts.map +1 -0
  210. package/dist/commands/shared/merged-branch-cleanup.js +46 -0
  211. package/dist/commands/shared/post-commit-pr-artifacts.d.ts.map +1 -1
  212. package/dist/commands/shared/post-commit-pr-artifacts.js +35 -0
  213. package/dist/commands/shared/task-backend.d.ts.map +1 -1
  214. package/dist/commands/shared/task-backend.js +37 -5
  215. package/dist/commands/shared/task-handoff.d.ts +2 -1
  216. package/dist/commands/shared/task-handoff.d.ts.map +1 -1
  217. package/dist/commands/shared/task-handoff.js +15 -0
  218. package/dist/commands/shared/task-local-freshness.d.ts +2 -0
  219. package/dist/commands/shared/task-local-freshness.d.ts.map +1 -1
  220. package/dist/commands/shared/task-local-freshness.js +7 -1
  221. package/dist/commands/task/finish-shared.d.ts +1 -0
  222. package/dist/commands/task/finish-shared.d.ts.map +1 -1
  223. package/dist/commands/task/finish-shared.js +1 -0
  224. package/dist/commands/task/handoff-show.command.d.ts.map +1 -1
  225. package/dist/commands/task/handoff-show.command.js +24 -0
  226. package/dist/commands/task/hosted-close-pr.command.d.ts.map +1 -1
  227. package/dist/commands/task/hosted-close-pr.command.js +35 -0
  228. package/dist/commands/task/hosted-close.command.d.ts.map +1 -1
  229. package/dist/commands/task/hosted-close.command.js +185 -18
  230. package/dist/commands/task/hosted-merge-sync.d.ts +4 -1
  231. package/dist/commands/task/hosted-merge-sync.d.ts.map +1 -1
  232. package/dist/commands/task/hosted-merge-sync.js +52 -10
  233. package/dist/commands/task/start-ready.d.ts.map +1 -1
  234. package/dist/commands/task/start-ready.js +0 -86
  235. package/dist/runner/context/base-prompts.d.ts +2 -1
  236. package/dist/runner/context/base-prompts.d.ts.map +1 -1
  237. package/dist/runner/context/base-prompts.js +109 -13
  238. package/dist/runner/context/recipe-context.d.ts.map +1 -1
  239. package/dist/runner/context/recipe-context.js +40 -8
  240. package/dist/runner/types.d.ts +4 -0
  241. package/dist/runner/types.d.ts.map +1 -1
  242. package/dist/runner/usecases/task-run.d.ts.map +1 -1
  243. package/dist/runner/usecases/task-run.js +2 -1
  244. package/dist/runtime/behavior/resolve.d.ts +2 -1
  245. package/dist/runtime/behavior/resolve.d.ts.map +1 -1
  246. package/dist/runtime/behavior/resolve.js +25 -5
  247. package/dist/runtime/behavior/types.d.ts +1 -0
  248. package/dist/runtime/behavior/types.d.ts.map +1 -1
  249. package/dist/runtime/capabilities/recipe.d.ts +2 -1
  250. package/dist/runtime/capabilities/recipe.d.ts.map +1 -1
  251. package/dist/runtime/capabilities/recipe.js +88 -28
  252. package/dist/shared/errors.d.ts +1 -1
  253. package/dist/shared/errors.d.ts.map +1 -1
  254. package/dist/shared/runtime-source.d.ts.map +1 -1
  255. package/dist/shared/runtime-source.js +8 -3
  256. package/package.json +3 -2
  257. package/dist/cli/recipes-bundled.d.ts +0 -10
  258. package/dist/cli/recipes-bundled.d.ts.map +0 -1
  259. package/dist/cli/recipes-bundled.js +0 -36
@@ -10,14 +10,14 @@ import { cmdTaskStartReady } from "../task/start-ready.js";
10
10
  import { CliError } from "../../shared/errors.js";
11
11
  const output = createCliEmitter();
12
12
  export const scenarioExecuteSpec = {
13
- id: ["scenario", "execute"],
14
- group: "Scenario",
13
+ id: ["recipes", "scenario", "execute"],
14
+ group: "Recipes",
15
15
  summary: "Materialize a recipe-backed task and execute it through the shared runner flow.",
16
16
  description: "Resolves a recipe scenario, materializes a task from its explicit task_template, and executes the shared runner with recipe context bundled alongside the created task.",
17
17
  args: [{ name: "id", required: true, valueHint: "<recipe:scenario>" }],
18
18
  examples: [
19
19
  {
20
- cmd: "agentplane scenario execute viewer:demo",
20
+ cmd: "agentplane recipes scenario execute viewer:demo",
21
21
  why: "Create a task from the scenario template and execute it through the configured runner.",
22
22
  },
23
23
  ],
@@ -27,7 +27,7 @@ export const scenarioExecuteSpec = {
27
27
  if (!recipeId || !scenarioId) {
28
28
  throw usageError({
29
29
  spec: scenarioExecuteSpec,
30
- command: "scenario execute",
30
+ command: "recipes scenario execute",
31
31
  message: `Invalid scenario id: ${id} (expected: <recipe:scenario>)`,
32
32
  });
33
33
  }
@@ -187,7 +187,7 @@ export async function cmdScenarioListParsed(opts) {
187
187
  catch (err) {
188
188
  if (err instanceof CliError)
189
189
  throw err;
190
- throw mapCoreError(err, { command: "scenario list", root: opts.rootOverride ?? null });
190
+ throw mapCoreError(err, { command: "recipes scenario list", root: opts.rootOverride ?? null });
191
191
  }
192
192
  }
193
193
  export async function cmdScenarioInfoParsed(opts) {
@@ -225,7 +225,7 @@ export async function cmdScenarioInfoParsed(opts) {
225
225
  catch (err) {
226
226
  if (err instanceof CliError)
227
227
  throw err;
228
- throw mapCoreError(err, { command: "scenario info", root: opts.rootOverride ?? null });
228
+ throw mapCoreError(err, { command: "recipes scenario info", root: opts.rootOverride ?? null });
229
229
  }
230
230
  }
231
231
  export async function executeRecipeTool(opts) {
@@ -297,13 +297,13 @@ export async function cmdScenarioRunParsed(opts) {
297
297
  ...validationChecks,
298
298
  ]);
299
299
  output.line("Status: preview only; no task created and no runner executed.");
300
- output.line(`Next: use \`agentplane scenario execute ${selection.recipe_id}:${selection.scenario_id}\` ` +
300
+ output.line(`Next: use \`agentplane recipes scenario execute ${selection.recipe_id}:${selection.scenario_id}\` ` +
301
301
  "to materialize and run this scenario.");
302
302
  return 0;
303
303
  }
304
304
  catch (err) {
305
305
  if (err instanceof CliError)
306
306
  throw err;
307
- throw mapCoreError(err, { command: "scenario run", root: opts.rootOverride ?? null });
307
+ throw mapCoreError(err, { command: "recipes scenario run", root: opts.rootOverride ?? null });
308
308
  }
309
309
  }
@@ -1,13 +1,13 @@
1
1
  import { usageError } from "../../cli/spec/errors.js";
2
2
  import { cmdScenarioInfoParsed } from "../scenario.js";
3
3
  export const scenarioInfoSpec = {
4
- id: ["scenario", "info"],
5
- group: "Scenario",
4
+ id: ["recipes", "scenario", "info"],
5
+ group: "Recipes",
6
6
  summary: "Show manifest-backed scenario details and normalized run profile.",
7
7
  args: [{ name: "id", required: true, valueHint: "<recipe:scenario>" }],
8
8
  examples: [
9
9
  {
10
- cmd: "agentplane scenario info viewer:demo",
10
+ cmd: "agentplane recipes scenario info viewer:demo",
11
11
  why: "Inspect resolver-backed scenario metadata before execution.",
12
12
  },
13
13
  ],
@@ -17,7 +17,7 @@ export const scenarioInfoSpec = {
17
17
  if (!recipeId || !scenarioId) {
18
18
  throw usageError({
19
19
  spec: scenarioInfoSpec,
20
- command: "scenario info",
20
+ command: "recipes scenario info",
21
21
  message: `Invalid scenario id: ${id} (expected: <recipe:scenario>)`,
22
22
  });
23
23
  }
@@ -1,9 +1,9 @@
1
1
  import { cmdScenarioListParsed } from "../scenario.js";
2
2
  export const scenarioListSpec = {
3
- id: ["scenario", "list"],
4
- group: "Scenario",
3
+ id: ["recipes", "scenario", "list"],
4
+ group: "Recipes",
5
5
  summary: "List resolver-backed scenario descriptors from installed recipes.",
6
6
  parse: () => ({}),
7
- examples: [{ cmd: "agentplane scenario list", why: "List available recipe scenarios." }],
7
+ examples: [{ cmd: "agentplane recipes scenario list", why: "List available recipe scenarios." }],
8
8
  };
9
9
  export const runScenarioList = (ctx) => cmdScenarioListParsed({ cwd: ctx.cwd, rootOverride: ctx.rootOverride });
@@ -1,14 +1,14 @@
1
1
  import { usageError } from "../../cli/spec/errors.js";
2
2
  import { cmdScenarioRunParsed } from "../scenario.js";
3
3
  export const scenarioRunSpec = {
4
- id: ["scenario", "run"],
5
- group: "Scenario",
4
+ id: ["recipes", "scenario", "run"],
5
+ group: "Recipes",
6
6
  summary: "Preview a validated scenario plan without creating a task or running a runner.",
7
7
  args: [{ name: "id", required: true, valueHint: "<recipe:scenario>" }],
8
8
  examples: [
9
9
  {
10
- cmd: "agentplane scenario run viewer:demo",
11
- why: "Validate a scenario and inspect the preview plan before `scenario execute`.",
10
+ cmd: "agentplane recipes scenario run viewer:demo",
11
+ why: "Validate a scenario and inspect the preview plan before `recipes scenario execute`.",
12
12
  },
13
13
  ],
14
14
  parse: (raw) => {
@@ -17,7 +17,7 @@ export const scenarioRunSpec = {
17
17
  if (!recipeId || !scenarioId) {
18
18
  throw usageError({
19
19
  spec: scenarioRunSpec,
20
- command: "scenario run",
20
+ command: "recipes scenario run",
21
21
  message: `Invalid scenario id: ${id} (expected: <recipe:scenario>)`,
22
22
  });
23
23
  }
@@ -1,9 +1,9 @@
1
1
  import { loadDirectSubcommandNames, parseGroupCommand, throwGroupCommandUsage, } from "../../cli/group-command.js";
2
2
  export const scenarioSpec = {
3
- id: ["scenario"],
4
- group: "Scenario",
3
+ id: ["recipes", "scenario"],
4
+ group: "Recipes",
5
5
  summary: "Recipe scenario commands.",
6
- synopsis: ["agentplane scenario <subcommand> [options]"],
6
+ synopsis: ["agentplane recipes scenario <subcommand> [options]"],
7
7
  args: [{ name: "subcommand", required: false, variadic: true, valueHint: "<subcommand>" }],
8
8
  parse: (raw) => parseGroupCommand(raw, "subcommand"),
9
9
  };
@@ -11,9 +11,9 @@ export const runScenario = async (_ctx, p) => {
11
11
  throwGroupCommandUsage({
12
12
  spec: scenarioSpec,
13
13
  cmd: p.cmd,
14
- subcommands: await loadDirectSubcommandNames(["scenario"]),
15
- command: "scenario",
16
- missingMessage: "Missing scenario subcommand.",
17
- unknownMessage: (subcommand) => `Unknown scenario subcommand: ${subcommand}.`,
14
+ subcommands: await loadDirectSubcommandNames(["recipes", "scenario"]),
15
+ command: "recipes scenario",
16
+ missingMessage: "Missing recipes scenario subcommand.",
17
+ unknownMessage: (subcommand) => `Unknown recipes scenario subcommand: ${subcommand}.`,
18
18
  });
19
19
  };
@@ -0,0 +1,12 @@
1
+ export type MergedBranchCleanupResult = {
2
+ removedBranch: boolean;
3
+ removedWorktree: boolean;
4
+ worktreePath: string | null;
5
+ skippedReason: "outside_repo" | "current_worktree" | null;
6
+ };
7
+ export declare function cleanupMergedLocalBranch(opts: {
8
+ gitRoot: string;
9
+ branch: string;
10
+ worktreePathHint?: string | null;
11
+ }): Promise<MergedBranchCleanupResult>;
12
+ //# sourceMappingURL=merged-branch-cleanup.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"merged-branch-cleanup.d.ts","sourceRoot":"","sources":["../../../src/commands/shared/merged-branch-cleanup.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,yBAAyB,GAAG;IACtC,aAAa,EAAE,OAAO,CAAC;IACvB,eAAe,EAAE,OAAO,CAAC;IACzB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,aAAa,EAAE,cAAc,GAAG,kBAAkB,GAAG,IAAI,CAAC;CAC3D,CAAC;AAEF,wBAAsB,wBAAwB,CAAC,IAAI,EAAE;IACnD,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAClC,GAAG,OAAO,CAAC,yBAAyB,CAAC,CA4CrC"}
@@ -0,0 +1,46 @@
1
+ import { execFileAsync, gitEnv } from "./git.js";
2
+ import { gitBranchExists } from "./git-ops.js";
3
+ import { findWorktreeForBranch } from "./git-worktree.js";
4
+ import { isPathWithin, resolvePathFallback } from "./path.js";
5
+ export async function cleanupMergedLocalBranch(opts) {
6
+ const repoRoot = await resolvePathFallback(opts.gitRoot);
7
+ const discoveredWorktree = await findWorktreeForBranch(opts.gitRoot, opts.branch);
8
+ const rawWorktreePath = discoveredWorktree ?? opts.worktreePathHint ?? null;
9
+ const worktreePath = rawWorktreePath ? await resolvePathFallback(rawWorktreePath) : null;
10
+ if (worktreePath) {
11
+ if (!isPathWithin(repoRoot, worktreePath)) {
12
+ return {
13
+ removedBranch: false,
14
+ removedWorktree: false,
15
+ worktreePath,
16
+ skippedReason: "outside_repo",
17
+ };
18
+ }
19
+ if (worktreePath === repoRoot) {
20
+ return {
21
+ removedBranch: false,
22
+ removedWorktree: false,
23
+ worktreePath,
24
+ skippedReason: "current_worktree",
25
+ };
26
+ }
27
+ await execFileAsync("git", ["worktree", "remove", "--force", worktreePath], {
28
+ cwd: opts.gitRoot,
29
+ env: gitEnv(),
30
+ });
31
+ }
32
+ let removedBranch = false;
33
+ if (await gitBranchExists(opts.gitRoot, opts.branch)) {
34
+ await execFileAsync("git", ["branch", "-D", opts.branch], {
35
+ cwd: opts.gitRoot,
36
+ env: gitEnv(),
37
+ });
38
+ removedBranch = true;
39
+ }
40
+ return {
41
+ removedBranch,
42
+ removedWorktree: Boolean(worktreePath),
43
+ worktreePath,
44
+ skippedReason: null,
45
+ };
46
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"post-commit-pr-artifacts.d.ts","sourceRoot":"","sources":["../../../src/commands/shared/post-commit-pr-artifacts.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAGhE,wBAAsB,uCAAuC,CAAC,IAAI,EAAE;IAClE,GAAG,EAAE,cAAc,CAAC;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,OAAO,CAAC;CAChB,GAAG,OAAO,CAAC,IAAI,CAAC,CAoBhB"}
1
+ {"version":3,"file":"post-commit-pr-artifacts.d.ts","sourceRoot":"","sources":["../../../src/commands/shared/post-commit-pr-artifacts.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AA2BhE,wBAAsB,uCAAuC,CAAC,IAAI,EAAE;IAClE,GAAG,EAAE,cAAc,CAAC;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,OAAO,CAAC;CAChB,GAAG,OAAO,CAAC,IAAI,CAAC,CAmChB"}
@@ -1,10 +1,45 @@
1
1
  import { warnMessage } from "../../cli/output.js";
2
2
  import { normalizeGhTransportError } from "../shared/gh-transport.js";
3
+ import { execFileAsync, gitEnv } from "../shared/git.js";
3
4
  import { ensurePrArtifactsSynced } from "../pr/internal/sync.js";
5
+ import { isTaskLocalOnlyAdvance } from "./task-local-freshness.js";
6
+ function isUnknownRevisionError(err) {
7
+ const message = err instanceof Error ? err.message : String(err);
8
+ return (/unknown revision or path not in the working tree/i.test(message) ||
9
+ /bad revision/i.test(message) ||
10
+ /ambiguous argument/i.test(message));
11
+ }
12
+ async function resolveHeadParent(gitRoot) {
13
+ try {
14
+ const { stdout } = await execFileAsync("git", ["rev-parse", "HEAD^"], {
15
+ cwd: gitRoot,
16
+ env: gitEnv(),
17
+ });
18
+ const parent = stdout.trim();
19
+ return parent.length > 0 ? parent : null;
20
+ }
21
+ catch (err) {
22
+ if (!isUnknownRevisionError(err))
23
+ throw err;
24
+ return null;
25
+ }
26
+ }
4
27
  export async function refreshBranchPrArtifactsAfterTaskCommit(opts) {
5
28
  if (opts.ctx.config.workflow_mode !== "branch_pr")
6
29
  return;
7
30
  try {
31
+ const gitRoot = opts.ctx.resolvedProject.gitRoot;
32
+ const headParent = await resolveHeadParent(gitRoot);
33
+ if (await isTaskLocalOnlyAdvance({
34
+ gitRoot,
35
+ workflowDir: opts.ctx.config.paths.workflow_dir,
36
+ tasksPath: opts.ctx.config.paths.tasks_path,
37
+ taskId: opts.taskId,
38
+ fromRef: headParent,
39
+ toRef: "HEAD",
40
+ })) {
41
+ return;
42
+ }
8
43
  await ensurePrArtifactsSynced({
9
44
  ctx: opts.ctx,
10
45
  cwd: opts.cw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CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,CAQ3F;AAED,wBAAsB,4BAA4B,CAAC,IAAI,EAAE;IACvD,GAAG,EAAE,cAAc,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;CACpB,GAAG,OAAO,CAAC,IAAI,CAAC,CAchB"}
@@ -1,10 +1,11 @@
1
+ import { readFile } from "node:fs/promises";
1
2
  import path from "node:path";
2
3
  import { resolveTaskDocUpdatedBy, parseTaskReadme, taskDocToSectionMap, validateTaskReadmeFrontmatter, withTaskReadmeFrontmatterDefaults, } from "@agentplaneorg/core";
3
4
  import { CliError } from "../../shared/errors.js";
4
5
  import { loadTaskBackend, taskRecordToData, toTaskSummary, } from "../../backends/task-backend.js";
5
6
  import { gitShowFile, toGitPath } from "./git-diff.js";
6
7
  import { GitContext } from "./git-context.js";
7
- import { gitListTaskBranches, parseTaskIdFromBranch } from "./git-worktree.js";
8
+ import { findWorktreeForBranch, gitListTaskBranches, parseTaskIdFromBranch, } from "./git-worktree.js";
8
9
  function normalizeDocUpdatedBy(value) {
9
10
  const trimmed = value?.trim() ?? "";
10
11
  if (!trimmed)
@@ -131,14 +132,45 @@ export async function loadTaskFromBranchSnapshot(opts) {
131
132
  : await resolveTaskBranchFromContext({ ctx: opts.ctx, taskId: opts.taskId });
132
133
  if (!branch)
133
134
  return null;
135
+ const liveWorktreePath = await findWorktreeForBranch(opts.ctx.resolvedProject.gitRoot, branch);
136
+ if (liveWorktreePath) {
137
+ const liveReadmePath = path.join(liveWorktreePath, path.relative(opts.ctx.resolvedProject.gitRoot, opts.readmePath));
138
+ try {
139
+ const liveText = await readFile(liveReadmePath, "utf8");
140
+ const parsed = parseTaskReadme(liveText);
141
+ const frontmatter = validateTaskReadmeFrontmatter(withTaskReadmeFrontmatterDefaults({
142
+ ...parsed.frontmatter,
143
+ id: typeof parsed.frontmatter.id === "string" && parsed.frontmatter.id.trim().length > 0
144
+ ? parsed.frontmatter.id
145
+ : opts.taskId,
146
+ }));
147
+ return taskRecordToData({
148
+ id: opts.taskId,
149
+ frontmatter: frontmatter,
150
+ body: parsed.body,
151
+ readmePath: opts.readmePath,
152
+ });
153
+ }
154
+ catch {
155
+ // Fall back to the committed branch snapshot when the live worktree lacks the README.
156
+ }
157
+ }
134
158
  const relReadmePath = toGitPath(path.relative(opts.ctx.resolvedProject.gitRoot, opts.readmePath));
159
+ const refsToTry = [branch, branch.startsWith("origin/") ? null : `origin/${branch}`].filter((ref) => Boolean(ref && ref.trim().length > 0));
135
160
  let text = "";
136
- try {
137
- text = await gitShowFile(opts.ctx.resolvedProject.gitRoot, branch, relReadmePath);
161
+ let loaded = false;
162
+ for (const ref of refsToTry) {
163
+ try {
164
+ text = await gitShowFile(opts.ctx.resolvedProject.gitRoot, ref, relReadmePath);
165
+ loaded = true;
166
+ break;
167
+ }
168
+ catch {
169
+ // Try the next candidate ref.
170
+ }
138
171
  }
139
- catch {
172
+ if (!loaded)
140
173
  return null;
141
- }
142
174
  const parsed = parseTaskReadme(text);
143
175
  const frontmatter = validateTaskReadmeFrontmatter(withTaskReadmeFrontmatterDefaults({
144
176
  ...parsed.frontmatter,
@@ -1,4 +1,4 @@
1
- import { type TaskHandoff, type TaskHandoffRunnerNextAction, type TaskHandoffRunnerState } from "@agentplaneorg/core";
1
+ import { type TaskHandoff, type TaskHandoffRoute, type TaskHandoffRunnerNextAction, type TaskHandoffRunnerState } from "@agentplaneorg/core";
2
2
  import type { CommandContext } from "./task-backend.js";
3
3
  export type TaskHandoffArtifact = TaskHandoff;
4
4
  export type TaskHandoffRunnerHint = TaskHandoffRunnerState;
@@ -46,6 +46,7 @@ export declare function buildTaskHandoffArtifact(opts: {
46
46
  workspace_root?: string | null;
47
47
  pr_branch?: string | null;
48
48
  runner?: TaskHandoffRunnerHint | undefined;
49
+ route?: TaskHandoffRoute | undefined;
49
50
  next_actions?: string[] | undefined;
50
51
  risks?: string[] | undefined;
51
52
  open_questions?: string[] | undef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GAAG,SAAS,CAAC;IACtC,cAAc,CAAC,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;CACvC,GAAG,mBAAmB,CAqBtB;AAED,wBAAgB,uBAAuB,CAAC,IAAI,EAAE;IAC5C,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB,GAAG;IACF,WAAW,EAAE,2BAA2B,CAAC;IACzC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B,CA8CA"}
@@ -14,6 +14,20 @@ function normalizeStringList(values) {
14
14
  const normalized = values.map((value) => value.trim()).filter((value) => value.length > 0);
15
15
  return normalized.length > 0 ? normalized : undefined;
16
16
  }
17
+ function normalizeRoute(route) {
18
+ if (!route)
19
+ return undefined;
20
+ return {
21
+ kind: route.kind,
22
+ status: route.status ?? undefined,
23
+ local_mutation: route.local_mutation ?? undefined,
24
+ finalize_via: route.finalize_via ?? undefined,
25
+ pr_number: typeof route.pr_number === "number" && route.pr_number > 0 ? route.pr_number : null,
26
+ pr_url: trimOrNull(route.pr_url) ?? undefined,
27
+ handoff_show_command: trimOrNull(route.handoff_show_command) ?? undefined,
28
+ base_pull_command: trimOrNull(route.base_pull_command) ?? undefined,
29
+ };
30
+ }
17
31
  export function resolveTaskHandoffPaths(opts) {
18
32
  const handoff_dir = path.join(opts.git_root, opts.workflow_dir, opts.task_id, "handoff");
19
33
  return {
@@ -96,6 +110,7 @@ export function buildTaskHandoffArtifact(opts) {
96
110
  workspace_root: trimOrNull(opts.workspace_root),
97
111
  pr_branch: trimOrNull(opts.pr_branch),
98
112
  runner: opts.runner,
113
+ route: normalizeRoute(opts.route),
99
114
  next_actions: normalizeStringList(opts.next_actions),
100
115
  risks: normalizeStringList(opts.risks),
101
116
  open_questions: normalizeStringList(opts.open_questions),
@@ -1,12 +1,14 @@
1
1
  export declare function isTaskLocalAdvancePath(opts: {
2
2
  workflowDir: string;
3
3
  taskId: string;
4
+ tasksPath?: string;
4
5
  relPath: string;
5
6
  }): boolean;
6
7
  export declare function isTaskLocalOnlyAdvance(opts: {
7
8
  gitRoot: string;
8
9
  workflowDir: string;
9
10
  taskId: string;
11
+ tasksPath?: string;
10
12
  fromRef: string | null;
11
13
  toRef: string;
12
14
  }): Promise<boolean>;
@@ -1 +1 @@
1
- {"version":3,"file":"task-local-freshness.d.ts","sourceRoot":"","sources":["../../../src/commands/shared/task-local-freshness.ts"],"names":[],"mappings":"AAQA,wBAAgB,sBAAsB,CAAC,IAAI,EAAE;IAC3C,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACjB,GAAG,OAAO,CAEV;AAED,wBAAsB,sBAAsB,CAAC,IAAI,EAAE;IACjD,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;CACf,GAAG,OAAO,CAAC,OAAO,CAAC,CAenB"}
1
+ {"version":3,"file":"task-local-freshness.d.ts","sourceRoot":"","sources":["../../../src/commands/shared/task-local-freshness.ts"],"names":[],"mappings":"AAQA,wBAAgB,sBAAsB,CAAC,IAAI,EAAE;IAC3C,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;CACjB,GAAG,OAAO,CAOV;AAED,wBAAsB,sBAAsB,CAAC,IAAI,EAAE;IACjD,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;CACf,GAAG,OAAO,CAAC,OAAO,CAAC,CAgBnB"}
@@ -4,7 +4,12 @@ function taskRootPrefix(workflowDir, taskId) {
4
4
  return `${toGitPath(path.join(workflowDir, taskId))}/`;
5
5
  }
6
6
  export function isTaskLocalAdvancePath(opts) {
7
- return opts.relPath.startsWith(taskRootPrefix(opts.workflowDir, opts.taskId));
7
+ const normalizedRelPath = toGitPath(opts.relPath);
8
+ if (normalizedRelPath.startsWith(taskRootPrefix(opts.workflowDir, opts.taskId))) {
9
+ return true;
10
+ }
11
+ const normalizedTasksPath = opts.tasksPath ? toGitPath(opts.tasksPath) : null;
12
+ return normalizedTasksPath !== null && normalizedRelPath === normalizedTasksPath;
8
13
  }
9
14
  export async function isTaskLocalOnlyAdvance(opts) {
10
15
  if (!opts.fromRef || opts.fromRef === opts.toRef) {
@@ -15,6 +20,7 @@ export async function isTaskLocalOnlyAdvance(opts) {
15
20
  changedPaths.every((relPath) => isTaskLocalAdvancePath({
16
21
  workflowDir: opts.workflowDir,
17
22
  taskId: opts.taskId,
23
+ tasksPath: opts.tasksPath,
18
24
  relPath,
19
25
  })));
20
26
  }
@@ -57,5 +57,6 @@ export declare function createTaskCloseCommit(opts: {
57
57
  quiet: boolean;
58
58
  closeUnstageOthers?: boolean;
59
59
  allowPolicy?: boolean;
60
+ closeRefreshTaskArtifacts?: boolean;
60
61
  }): Promise<void>;
61
62
  //# sourceMappingURL=finish-shared.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"finish-shared.d.ts","sourceRoot":"","sources":["../../../src/commands/task/finish-shared.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAG/D,OAAO,EAAuB,KAAK,cAAc,EAAE,MAAM,2BAA2B,CAAC;AACrF,OAAO,EAA6B,YAAY,EAAmB,MAAM,yB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AC;IACnC,QAAQ,EAAE,OAAO,CAAC;IAClB,cAAc,EAAE,kBAAkB,GAAG,IAAI,CAAC;CAC3C,GAAG,OAAO,CAAC,IAAI,CAAC,CAuEhB;AAED,wBAAsB,qBAAqB,CAAC,IAAI,EAAE;IAChD,GAAG,EAAE,cAAc,CAAC;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,KAAK,EAAE,OAAO,CAAC;IACf,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,yBAAyB,CAAC,EAAE,OAAO,CAAC;CACrC,GAAG,OAAO,CAAC,IAAI,CAAC,CAwBhB"}
@@ -234,5 +234,6 @@ export async function createTaskCloseCommit(opts) {
234
234
  closeUnstageOthers: opts.closeUnstageOthers === true,
235
235
  closeCheckOnly: false,
236
236
  closeStageTaskArtifacts: opts.ctx.config.workflow_mode === "branch_pr",
237
+ closeRefreshTaskArtifacts: opts.closeRefreshTaskArtifacts,
237
238
  });
238
239
  }
@@ -1 +1 @@
1
- {"version":3,"file":"handoff-show.command.d.ts","sourceRoot":"","sources":["../../../src/commands/task/handoff-show.command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAOtE,MAAM,MAAM,qBAAqB,GAAG;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,OAAO,CAAC;CACf,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,WAAW,CAAC,qBAAqB,CAiBlE,CAAC;AAIF,eAAO,MAAM,kBAAkB,GAAU,KAAK,UAAU,EAAE,QAAQ,qBAAqB,oBAsDtF,CAAC"}
1
+ {"version":3,"file":"handoff-show.command.d.ts","sourceRoot":"","sources":["../../../src/commands/task/handoff-show.command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAOtE,MAAM,MAAM,qBAAqB,GAAG;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,OAAO,CAAC;CACf,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,WAAW,CAAC,qBAAqB,CAiBlE,CAAC;AAIF,eAAO,MAAM,kBAAkB,GAAU,KAAK,UAAU,EAAE,QAAQ,qBAAqB,oBA2EtF,CAAC"}
@@ -52,6 +52,30 @@ export const runTaskHandoffShow = async (ctx, parsed) => {
52
52
  entries.push({ label: "head_sha", value: handoff.head_sha });
53
53
  if (handoff.pr_branch)
54
54
  entries.push({ label: "pr_branch", value: handoff.pr_branch });
55
+ if (handoff.route?.kind)
56
+ entries.push({ label: "route_kind", value: handoff.route.kind });
57
+ if (handoff.route?.status)
58
+ entries.push({ label: "route_status", value: handoff.route.status });
59
+ if (handoff.route?.local_mutation) {
60
+ entries.push({ label: "route_local_mutation", value: handoff.route.local_mutation });
61
+ }
62
+ if (handoff.route?.finalize_via) {
63
+ entries.push({ label: "route_finalize_via", value: handoff.route.finalize_via });
64
+ }
65
+ if (typeof handoff.route?.pr_number === "number") {
66
+ entries.push({ label: "route_pr_number", value: String(handoff.route.pr_number) });
67
+ }
68
+ if (handoff.route?.pr_url)
69
+ entries.push({ label: "route_pr_url", value: handoff.route.pr_url });
70
+ if (handoff.route?.handoff_show_command) {
71
+ entries.push({
72
+ label: "route_handoff_show_command",
73
+ value: handoff.route.handoff_show_command,
74
+ });
75
+ }
76
+ if (handoff.route?.base_pull_command) {
77
+ entries.push({ label: "route_base_pull_command", value: handoff.route.base_pull_command });
78
+ }
55
79
  if (handoff.runner?.run_id) {
56
80
  entries.push({ label: "run_id", value: handoff.runner.run_id }, { label: "runner_status", value: handoff.runner.status ?? "unknown" }, { label: "runner_next_action", value: handoff.runner.next_action ?? "none" });
57
81
  if (handoff.runner.next_command) {
@@ -1 +1 @@
1
- {"version":3,"file":"hosted-close-pr.command.d.ts","sourceRoot":"","sources":["../../../src/commands/task/hosted-close-pr.command.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAQtE,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,2BAA2B,CAAC;AAQnC,KAAK,uBAAuB,GAAG;IAC7B,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CACrB,CAAC;AAgBF,eAAO,MAAM,qBAAqB,EAAE,WAAW,CAAC,uBAAuB,CAoEtE,CAAC;AAmYF,wBAAgB,+BAA+B,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,cAAc,CAAC,IAChF,KAAK,UAAU,EAAE,GAAG,uBAAuB,KAAG,OAAO,CAAC,MAAM,CAAC,CAsB5E"}
1
+ {"version":3,"file":"hosted-close-pr.command.d.ts","sourceRoot":"","sources":["../../../src/commands/task/hosted-close-pr.command.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAStE,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,2BAA2B,CAAC;AAQnC,KAAK,uBAAuB,GAAG;IAC7B,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CACrB,CAAC;AAgBF,eAAO,MAAM,qBAAqB,EAAE,WAAW,CAAC,uBAAuB,CAoEtE,CAAC;AA4aF,wBAAgB,+BAA+B,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,cAAc,CAAC,IAChF,KAAK,UAAU,EAAE,GAAG,uBAAuB,KAAG,OAAO,CAAC,MAAM,CAAC,CAsB5E"}
@@ -6,6 +6,7 @@ import { exitCodeForError } from "../../cli/exit-codes.js";
6
6
  import { fileExists } from "../../cli/fs-utils.js";
7
7
  import { CliError } from "../../shared/errors.js";
8
8
  import { execFileAsync, gitEnv } from "../shared/git.js";
9
+ import { cleanupMergedLocalBranch } from "../shared/merged-branch-cleanup.js";
9
10
  import { loadTaskFromContext, resolveTaskBranchFromContext, } from "../shared/task-backend.js";
10
11
  import { parseTaskIdFromCloseBranch } from "../shared/git-worktree.js";
11
12
  import { parsePrMeta } from "../shared/pr-meta.js";
@@ -263,6 +264,35 @@ function normalizeGithubPrLink(prNumber, prUrl, verb) {
263
264
  ? `${verb} GitHub PR #${prNumber}: ${prUrl.trim()}`
264
265
  : `${verb} GitHub PR #${prNumber}`;
265
266
  }
267
+ async function maybeCleanupMergedTaskBranch(opts) {
268
+ try {
269
+ const cleanup = await cleanupMergedLocalBranch({
270
+ gitRoot: opts.gitRoot,
271
+ branch: opts.branch,
272
+ });
273
+ if (!cleanup.removedBranch && !cleanup.removedWorktree) {
274
+ if (cleanup.skippedReason === "current_worktree") {
275
+ opts.output.info(`local merged branch cleanup skipped: ${opts.branch} is the current checkout`);
276
+ }
277
+ else if (cleanup.skippedReason === "outside_repo") {
278
+ opts.output.info(`local merged branch cleanup skipped: ${opts.branch} is attached to a worktree outside the current checkout root`);
279
+ }
280
+ return;
281
+ }
282
+ const details = [];
283
+ if (cleanup.removedWorktree && cleanup.worktreePath) {
284
+ details.push(`removed worktree ${cleanup.worktreePath}`);
285
+ }
286
+ if (cleanup.removedBranch) {
287
+ details.push(`deleted branch ${opts.branch}`);
288
+ }
289
+ opts.output.info(`local merged branch cleanup: ${details.join("; ")}`);
290
+ }
291
+ catch (error) {
292
+ const message = error instanceof Error ? error.message : String(error);
293
+ opts.output.warn(`local merged branch cleanup failed for ${opts.branch}: ${message}`);
294
+ }
295
+ }
266
296
  async function openHostedClosePr(opts) {
267
297
  const output = createCliEmitter();
268
298
  const { meta, task, taskBranch } = await readHostedCloseState({
@@ -339,6 +369,11 @@ async function openHostedClosePr(opts) {
339
369
  explicitBranch: opts.branch ?? null,
340
370
  mergeCommit,
341
371
  });
372
+ await maybeCleanupMergedTaskBranch({
373
+ output,
374
+ gitRoot,
375
+ branch: sourceBranch,
376
+ });
342
377
  const owner = repo.split("/")[0]?.trim() ?? "";
343
378
  const existingQuery = new URLSearchParams({
344
379
  state: "open",
@@ -1 +1 @@
1
- {"version":3,"file":"hosted-close.command.d.ts","sourceRoot":"","sources":["../../../src/commands/task/hosted-close.command.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAStE,OAAO,EAAuB,KAAK,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAMrF,MAAM,MAAM,qBAAqB,GAAG;IAClC,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,OAAO,CAAC;CAChB,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,WAAW,CAAC,qBAAqB,CAqClE,CAAC;AAwMF,wBAAgB,6BAA6B,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,cAAc,CAAC,IAC9E,KAAK,UAAU,EAAE,QAAQ,qBAAqB,KAAG,OAAO,CAAC,MAAM,CAAC,CA2B/E"}
1
+ {"version":3,"file":"hosted-close.command.d.ts","sourceRoot":"","sources":["../../../src/commands/task/hosted-close.command.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAStE,OAAO,EAAuB,KAAK,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAOrF,MAAM,MAAM,qBAAqB,GAAG;IAClC,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,OAAO,CAAC;CAChB,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,WAAW,CAAC,qBAAqB,CAqClE,CAAC;AAmYF,wBAAgB,6BAA6B,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,cAAc,CAAC,IAC9E,KAAK,UAAU,EAAE,QAAQ,qBAAqB,KAAG,OAAO,CAAC,MAAM,CAAC,CA2B/E"}