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
@@ -308,7 +308,7 @@ export async function writeConfig(root, config) {
308
308
  export async function resetAgentplaneHomeRecipes() {
309
309
  if (!agentplaneHome)
310
310
  return;
311
- await rm(path.join(agentplaneHome, "recipes"), { recursive: true, force: true });
311
+ await rm(path.join(agentplaneHome, "recipes-store"), { recursive: true, force: true });
312
312
  await rm(path.join(agentplaneHome, "recipes.json"), { force: true });
313
313
  await rm(path.join(agentplaneHome, "recipes-index.json"), { force: true });
314
314
  }
@@ -349,8 +349,7 @@ export async function createRecipeArchive(opts) {
349
349
  {
350
350
  id: "RECIPE_SKILL",
351
351
  summary: "Recipe analysis skill",
352
- kind: "agent-skill",
353
- file: "skills/analysis.json",
352
+ file: "skills/analysis.md",
354
353
  },
355
354
  ],
356
355
  agents: [
@@ -361,7 +360,7 @@ export async function createRecipeArchive(opts) {
361
360
  summary: "Recipe agent",
362
361
  skills: ["RECIPE_SKILL"],
363
362
  tools: ["RECIPE_TOOL"],
364
- file: "agents/recipe.json",
363
+ file: "agents/recipe.md",
365
364
  },
366
365
  ],
367
366
  tools: [
@@ -395,18 +394,23 @@ export async function createRecipeArchive(opts) {
395
394
  await writeFile(path.join(recipeDir, "manifest.json"), JSON.stringify(manifest, null, 2), "utf8");
396
395
  const agentsDir = path.join(recipeDir, "agents");
397
396
  await mkdir(agentsDir, { recursive: true });
398
- await writeFile(path.join(agentsDir, "recipe.json"), JSON.stringify({
399
- id: "RECIPE_AGENT",
400
- role: "Recipe agent",
401
- description: "Example agent installed from a recipe.",
402
- }, null, 2), "utf8");
397
+ await writeFile(path.join(agentsDir, "recipe.md"), [
398
+ "# Recipe Agent",
399
+ "",
400
+ "Role: executor",
401
+ "",
402
+ "Instructions:",
403
+ "- Use recipe local policy.",
404
+ "- Materialize the declared scenario artifacts.",
405
+ ].join("\n"), "utf8");
403
406
  const skillsDir = path.join(recipeDir, "skills");
404
407
  await mkdir(skillsDir, { recursive: true });
405
- await writeFile(path.join(skillsDir, "analysis.json"), JSON.stringify({
406
- id: "RECIPE_SKILL",
407
- summary: "Recipe analysis skill",
408
- kind: "agent-skill",
409
- }, null, 2), "utf8");
408
+ await writeFile(path.join(skillsDir, "analysis.md"), [
409
+ "# Recipe Skill",
410
+ "",
411
+ "- Inspect the generated bundle before acting.",
412
+ "- Keep recipe-owned artifacts inside the declared output paths.",
413
+ ].join("\n"), "utf8");
410
414
  const toolsDir = path.join(recipeDir, "tools");
411
415
  await mkdir(toolsDir, { recursive: true });
412
416
  await writeFile(path.join(toolsDir, "run.js"), [
@@ -496,8 +500,7 @@ export async function createUnsafeRecipeArchive(opts) {
496
500
  {
497
501
  id: "RECIPE_SKILL",
498
502
  summary: "Recipe skill",
499
- kind: "agent-skill",
500
- file: "skills/recipe.json",
503
+ file: "skills/recipe.md",
501
504
  },
502
505
  ],
503
506
  agents: [
@@ -508,7 +511,7 @@ export async function createUnsafeRecipeArchive(opts) {
508
511
  summary: "Recipe agent",
509
512
  skills: ["RECIPE_SKILL"],
510
513
  tools: ["RECIPE_TOOL"],
511
- file: "agents/recipe.json",
514
+ file: "agents/recipe.md",
512
515
  },
513
516
  ],
514
517
  tools: [
@@ -535,10 +538,10 @@ export async function createUnsafeRecipeArchive(opts) {
535
538
  await writeFile(path.join(recipeDir, "manifest.json"), JSON.stringify(manifest, null, 2), "utf8");
536
539
  const agentsDir = path.join(recipeDir, "agents");
537
540
  await mkdir(agentsDir, { recursive: true });
538
- await writeFile(path.join(agentsDir, "recipe.json"), JSON.stringify({ id: "RECIPE_AGENT", role: "Recipe agent" }, null, 2), "utf8");
541
+ await writeFile(path.join(agentsDir, "recipe.md"), "# Recipe Agent\n\nFollow the unsafe archive validation path.\n", "utf8");
539
542
  const skillsDir = path.join(recipeDir, "skills");
540
543
  await mkdir(skillsDir, { recursive: true });
541
- await writeFile(path.join(skillsDir, "recipe.json"), JSON.stringify({ id: "RECIPE_SKILL" }), "utf8");
544
+ await writeFile(path.join(skillsDir, "recipe.md"), "# Recipe Skill\n\nInspect archive contents before materialization.\n", "utf8");
542
545
  const toolsDir = path.join(recipeDir, "tools");
543
546
  await mkdir(toolsDir, { recursive: true });
544
547
  await writeFile(path.join(toolsDir, "run.sh"), "#!/usr/bin/env bash\n", "utf8");
@@ -744,6 +747,20 @@ export async function commitAll(root, message) {
744
747
  env: cleanGitEnv(),
745
748
  });
746
749
  }
750
+ export async function commitPathsIfChanged(root, paths, message) {
751
+ await execFileAsync("git", ["add", "--", ...paths], { cwd: root, env: cleanGitEnv() });
752
+ const { stdout } = await execFileAsync("git", ["diff", "--cached", "--name-only", "--", ...paths], {
753
+ cwd: root,
754
+ env: cleanGitEnv(),
755
+ });
756
+ if (!stdout.trim())
757
+ return false;
758
+ await execFileAsync("git", ["commit", "--no-verify", "-m", message], {
759
+ cwd: root,
760
+ env: cleanGitEnv(),
761
+ });
762
+ return true;
763
+ }
747
764
  export async function stageGitignoreIfPresent(root) {
748
765
  const gitignorePath = path.join(root, ".gitignore");
749
766
  if (!(await pathExists(gitignorePath)))
@@ -9,5 +9,6 @@ export declare function cmdCleanupMerged(opts: {
9
9
  deleteRemoteBranches: boolean;
10
10
  fetch: boolean;
11
11
  quiet: boolean;
12
+ skipUnsafeWorktrees?: boolean;
12
13
  }): Promise<number>;
13
14
  //# sourceMappingURL=cleanup-merged.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cleanup-merged.d.ts","sourceRoot":"","sources":["../../../src/commands/branch/cleanup-merged.ts"],"names":[],"mappings":"AAqBA,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,2BAA2B,CAAC;AAgInC,wBAAsB,gBAAgB,CAAC,IAAI,EAAE;IAC3C,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,OAAO,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,oBAAoB,EAAE,OAAO,CAAC;IAC9B,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,EAAE,OAAO,CAAC;CAChB,GAAG,OAAO,CAAC,MAAM,CAAC,CAiJlB"}
1
+ {"version":3,"file":"cleanup-merged.d.ts","sourceRoot":"","sources":["../../../src/commands/branch/cleanup-merged.ts"],"names":[],"mappings":"AAqBA,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,2BAA2B,CAAC;AAgInC,wBAAsB,gBAAgB,CAAC,IAAI,EAAE;IAC3C,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,OAAO,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,oBAAoB,EAAE,OAAO,CAAC;IAC9B,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,EAAE,OAAO,CAAC;IACf,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B,GAAG,OAAO,CAAC,MAAM,CAAC,CA8JlB"}
@@ -185,18 +185,26 @@ export async function cmdCleanupMerged(opts) {
185
185
  }
186
186
  return 0;
187
187
  }
188
+ const skipUnsafeWorktrees = opts.skipUnsafeWorktrees === true;
188
189
  let deletedRemoteBranches = 0;
190
+ let skippedUnsafe = 0;
189
191
  for (const item of sortedCandidates) {
190
192
  const worktreePath = item.worktreePath ? await resolvePathFallback(item.worktreePath) : null;
191
193
  if (worktreePath) {
192
- if (!isPathWithin(repoRoot, worktreePath)) {
193
- throw new CliError({
194
- exitCode: 5,
195
- code: "E_GIT",
196
- message: `Refusing to remove worktree outside repo: ${worktreePath}`,
197
- });
198
- }
199
- if (worktreePath === repoRoot) {
194
+ const outsideRepo = !isPathWithin(repoRoot, worktreePath);
195
+ const currentWorktree = worktreePath === repoRoot;
196
+ if (outsideRepo || currentWorktree) {
197
+ if (skipUnsafeWorktrees) {
198
+ skippedUnsafe += 1;
199
+ continue;
200
+ }
201
+ if (outsideRepo) {
202
+ throw new CliError({
203
+ exitCode: 5,
204
+ code: "E_GIT",
205
+ message: `Refusing to remove worktree outside repo: ${worktreePath}`,
206
+ });
207
+ }
200
208
  throw new CliError({
201
209
  exitCode: 5,
202
210
  code: "E_GIT",
@@ -234,7 +242,8 @@ export async function cmdCleanupMerged(opts) {
234
242
  const remoteDetail = opts.deleteRemoteBranches
235
243
  ? ` remote_deleted=${deletedRemoteBranches}`
236
244
  : "";
237
- output.success("cleanup merged", undefined, `deleted=${candidates.length}${remoteDetail}`);
245
+ const skippedDetail = skipUnsafeWorktrees ? ` skipped_unsafe=${skippedUnsafe}` : "";
246
+ output.success("cleanup merged", undefined, `deleted=${candidates.length - skippedUnsafe}${remoteDetail}${skippedDetail}`);
238
247
  }
239
248
  return 0;
240
249
  }
@@ -1 +1 @@
1
- {"version":3,"file":"work-start.d.ts","sourceRoot":"","sources":["../../../src/commands/branch/work-start.ts"],"names":[],"mappings":"AAeA,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,2BAA2B,CAAC;AAkMnC,wBAAsB,YAAY,CAAC,IAAI,EAAE;IACvC,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,OAAO,CAAC;CACnB,GAAG,OAAO,CAAC,MAAM,CAAC,CA6JlB"}
1
+ {"version":3,"file":"work-start.d.ts","sourceRoot":"","sources":["../../../src/commands/branch/work-start.ts"],"names":[],"mappings":"AA0BA,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,2BAA2B,CAAC;AAsRnC,wBAAsB,YAAY,CAAC,IAAI,EAAE;IACvC,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,OAAO,CAAC;CACnB,GAAG,OAAO,CAAC,MAAM,CAAC,CA+JlB"}
@@ -1,4 +1,4 @@
1
- import { copyFile, cp, mkdir, readFile, readdir, symlink, writeFile } from "node:fs/promises";
1
+ import { chmod, copyFile, cp, mkdir, readFile, readdir, rm, symlink, writeFile, } from "node:fs/promises";
2
2
  import path from "node:path";
3
3
  import { resolveBaseBranch } from "@agentplaneorg/core";
4
4
  import { LocalBackend } from "../../backends/task-backend.js";
@@ -11,9 +11,40 @@ import { execFileAsync, gitEnv } from "../shared/git.js";
11
11
  import { gitAheadBehind } from "../shared/git-diff.js";
12
12
  import { gitBranchExists, gitBranchUpstream, gitCurrentBranch } from "../shared/git-ops.js";
13
13
  import { isPathWithin } from "../shared/path.js";
14
+ import { resolveRuntimeSourceInfo } from "../../shared/runtime-source.js";
14
15
  import { loadBackendTask, loadCommandContext, } from "../shared/task-backend.js";
16
+ function isPresentString(value) {
17
+ return value !== null;
18
+ }
15
19
  import { ensurePlanApprovedIfRequired } from "../task/shared.js";
16
20
  import { validateWorkAgent, validateWorkSlug } from "./internal/work-validate.js";
21
+ const HOOK_SHIM_MARKER = "agentplane-hook-shim";
22
+ function repoLocalHookShimText() {
23
+ return [
24
+ "#!/usr/bin/env sh",
25
+ `# ${HOOK_SHIM_MARKER} (do not edit)`,
26
+ "set -e",
27
+ 'SCRIPT_DIR="$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)"',
28
+ 'REPO_ROOT="$(dirname "$(dirname "$SCRIPT_DIR")")"',
29
+ 'LOCAL_BIN="$REPO_ROOT/packages/agentplane/bin/agentplane.js"',
30
+ 'if command -v node >/dev/null 2>&1 && [ -f "$LOCAL_BIN" ]; then',
31
+ ' exec node "$LOCAL_BIN" "$@"',
32
+ "fi",
33
+ 'ENV_BIN="${AGENTPLANE_HOOK_RUNNER:-}"',
34
+ 'if [ -n "$ENV_BIN" ] && command -v node >/dev/null 2>&1 && [ -f "$ENV_BIN" ]; then',
35
+ ' exec node "$ENV_BIN" "$@"',
36
+ "fi",
37
+ "if command -v agentplane >/dev/null 2>&1; then",
38
+ ' exec agentplane "$@"',
39
+ "fi",
40
+ "if command -v npx >/dev/null 2>&1; then",
41
+ ' exec npx --yes agentplane "$@"',
42
+ "fi",
43
+ 'echo "agentplane shim: runner not found (need env runner, repo-local source, agentplane in PATH, or node+npx)." >&2',
44
+ " exit 127",
45
+ "",
46
+ ].join("\n");
47
+ }
17
48
  function directWorkLockPath(agentplaneDir) {
18
49
  // Intentionally under cache/ so it stays out of git by default.
19
50
  return path.join(agentplaneDir, "cache", "direct-work.json");
@@ -54,16 +85,35 @@ async function materializeLocalBackendReadmesForWorktree(opts) {
54
85
  for (const entry of entries) {
55
86
  if (!entry.isDirectory())
56
87
  continue;
88
+ const sourceTaskRoot = path.join(sourceRoot, entry.name);
57
89
  const sourceReadme = path.join(sourceRoot, entry.name, "README.md");
58
90
  if (!(await fileExists(sourceReadme)))
59
91
  continue;
60
92
  const targetReadme = path.join(targetRoot, entry.name, "README.md");
61
93
  await mkdir(path.dirname(targetReadme), { recursive: true });
62
94
  await copyFile(sourceReadme, targetReadme);
95
+ if (entry.name !== opts.taskId)
96
+ continue;
97
+ // Hand off ownership of the active task README to the task worktree so
98
+ // later merges cannot collide with a stale untracked copy on the base checkout.
99
+ await rm(sourceReadme, { force: true });
100
+ const remainingEntries = await readdir(sourceTaskRoot).catch(() => []);
101
+ if (remainingEntries.length === 0) {
102
+ await rm(sourceTaskRoot, { recursive: true, force: true });
103
+ }
63
104
  }
64
105
  }
65
106
  async function materializeRepoLocalDistForWorktree(opts) {
66
- const sourceRoots = [path.resolve(opts.repoRoot), path.resolve(process.cwd())];
107
+ const runtimeSource = resolveRuntimeSourceInfo({ cwd: process.cwd() });
108
+ const sourceRoots = [
109
+ ...new Set([
110
+ path.resolve(opts.repoRoot),
111
+ path.resolve(process.cwd()),
112
+ runtimeSource.agentplane.packageRoot
113
+ ? path.resolve(runtimeSource.agentplane.packageRoot, "..", "..")
114
+ : null,
115
+ ].filter((value) => isPresentString(value))),
116
+ ];
67
117
  const copyTargets = [
68
118
  ["packages/core/dist", "packages/core/dist"],
69
119
  ["packages/agentplane/dist", "packages/agentplane/dist"],
@@ -88,8 +138,15 @@ async function materializeRepoLocalDistForWorktree(opts) {
88
138
  }
89
139
  }
90
140
  async function linkDirectoryIntoWorktree(opts) {
91
- const sourcePath = path.join(opts.repoRoot, opts.relativePath);
92
- if (!(await fileExists(sourcePath)))
141
+ let sourcePath = "";
142
+ for (const sourceRoot of opts.sourceRoots) {
143
+ const candidate = path.join(sourceRoot, opts.relativePath);
144
+ if (await fileExists(candidate)) {
145
+ sourcePath = candidate;
146
+ break;
147
+ }
148
+ }
149
+ if (!sourcePath)
93
150
  return false;
94
151
  const targetPath = path.join(opts.worktreePath, opts.relativePath);
95
152
  if (await fileExists(targetPath))
@@ -99,6 +156,16 @@ async function linkDirectoryIntoWorktree(opts) {
99
156
  return true;
100
157
  }
101
158
  async function materializeRepoLocalInstallLayoutForWorktree(opts) {
159
+ const runtimeSource = resolveRuntimeSourceInfo({ cwd: process.cwd() });
160
+ const sourceRoots = [
161
+ ...new Set([
162
+ path.resolve(opts.repoRoot),
163
+ path.resolve(process.cwd()),
164
+ runtimeSource.agentplane.packageRoot
165
+ ? path.resolve(runtimeSource.agentplane.packageRoot, "..", "..")
166
+ : null,
167
+ ].filter((value) => isPresentString(value))),
168
+ ];
102
169
  const linkTargets = [
103
170
  "node_modules",
104
171
  path.join("packages", "core", "node_modules"),
@@ -107,12 +174,20 @@ async function materializeRepoLocalInstallLayoutForWorktree(opts) {
107
174
  ];
108
175
  for (const relativePath of linkTargets) {
109
176
  await linkDirectoryIntoWorktree({
110
- repoRoot: opts.repoRoot,
177
+ sourceRoots,
111
178
  worktreePath: opts.worktreePath,
112
179
  relativePath,
113
180
  });
114
181
  }
115
182
  }
183
+ async function materializeHookShimForWorktree(worktreePath) {
184
+ const shimPath = path.join(worktreePath, ".agentplane", "bin", "agentplane");
185
+ if (await fileExists(shimPath))
186
+ return;
187
+ await mkdir(path.dirname(shimPath), { recursive: true });
188
+ await writeFile(shimPath, repoLocalHookShimText(), "utf8");
189
+ await chmod(shimPath, 0o755);
190
+ }
116
191
  async function ensureGitClean(gitRoot) {
117
192
  const { stdout } = await execFileAsync("git", ["status", "--porcelain"], {
118
193
  cwd: gitRoot,
@@ -278,6 +353,7 @@ export async function cmdWorkStart(opts) {
278
353
  backend: ctx.taskBackend,
279
354
  repoRoot: resolved.gitRoot,
280
355
  worktreePath,
356
+ taskId: opts.taskId,
281
357
  });
282
358
  await materializeRepoLocalDistForWorktree({
283
359
  repoRoot: resolved.gitRoot,
@@ -287,6 +363,7 @@ export async function cmdWorkStart(opts) {
287
363
  repoRoot: resolved.gitRoot,
288
364
  worktreePath,
289
365
  });
366
+ await materializeHookShimForWorktree(worktreePath);
290
367
  }
291
368
  else {
292
369
  if (branchExists) {
@@ -0,0 +1,26 @@
1
+ export declare const AGENTPLANE_CODEX_HOME_ENV = "AGENTPLANE_CODEX_HOME";
2
+ export type CodexPluginInstallScope = "user" | "repo";
3
+ export type CodexPluginInstallResult = {
4
+ scope: CodexPluginInstallScope;
5
+ installRoot: string;
6
+ pluginRoot: string;
7
+ manifestPath: string;
8
+ marketplacePath: string;
9
+ copiedAssets: string[];
10
+ };
11
+ type JsonObject = Record<string, unknown>;
12
+ export declare function buildCodexPluginManifest(version?: string): JsonObject;
13
+ export declare function resolveCodexInstallRoot(opts: {
14
+ scope: CodexPluginInstallScope;
15
+ repoRoot?: string;
16
+ env?: NodeJS.ProcessEnv;
17
+ }): string;
18
+ export declare function resolveCodexPluginRoot(installRoot: string): string;
19
+ export declare function resolveCodexMarketplacePath(installRoot: string): string;
20
+ export declare function installBundledCodexPlugin(opts: {
21
+ scope: CodexPluginInstallScope;
22
+ installRoot: string;
23
+ version?: string;
24
+ }): Promise<CodexPluginInstallResult>;
25
+ export {};
26
+ //# sourceMappingURL=plugin-install.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin-install.d.ts","sourceRoot":"","sources":["../../../src/commands/codex/plugin-install.ts"],"names":[],"mappings":"AAoCA,eAAO,MAAM,yBAAyB,0BAA0B,CAAC;AAEjE,MAAM,MAAM,uBAAuB,GAAG,MAAM,GAAG,MAAM,CAAC;AAEtD,MAAM,MAAM,wBAAwB,GAAG;IACrC,KAAK,EAAE,uBAAuB,CAAC;IAC/B,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB,CAAC;AAEF,KAAK,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAwG1C,wBAAgB,wBAAwB,CAAC,OAAO,SAAe,GAAG,UAAU,CA8B3E;AAED,wBAAgB,uBAAuB,CAAC,IAAI,EAAE;IAC5C,KAAK,EAAE,uBAAuB,CAAC;IAC/B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;CACzB,GAAG,MAAM,CAiBT;AAED,wBAAgB,sBAAsB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAElE;AAED,wBAAgB,2BAA2B,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAEvE;AAED,wBAAsB,yBAAyB,CAAC,IAAI,EAAE;IACpD,KAAK,EAAE,uBAAuB,CAAC;IAC/B,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,GAAG,OAAO,CAAC,wBAAwB,CAAC,CAyCpC"}
@@ -0,0 +1,209 @@
1
+ import { copyFile, mkdir, readFile } from "node:fs/promises";
2
+ import os from "node:os";
3
+ import path from "node:path";
4
+ import { fileURLToPath } from "node:url";
5
+ import { CliError } from "../../shared/errors.js";
6
+ import { getVersion } from "../../meta/version.js";
7
+ import { writeJsonStableIfChanged, writeTextIfChanged } from "../../shared/write-if-changed.js";
8
+ const PLUGIN_NAME = "agentplane";
9
+ const DEFAULT_MARKETPLACE_NAME = "agentplane-local-marketplace";
10
+ const DEFAULT_MARKETPLACE_DISPLAY_NAME = "AgentPlane Local Plugins";
11
+ const ASSET_ROOT_URL = new URL("../../../assets/codex-plugin/", import.meta.url);
12
+ const TEXT_ASSETS = [
13
+ {
14
+ source: new URL("skills/agentplane/SKILL.md", ASSET_ROOT_URL),
15
+ relativePath: "skills/agentplane/SKILL.md",
16
+ },
17
+ ];
18
+ const BINARY_ASSETS = [
19
+ {
20
+ source: new URL("assets/icon.svg", ASSET_ROOT_URL),
21
+ relativePath: "assets/icon.svg",
22
+ },
23
+ {
24
+ source: new URL("assets/logo.svg", ASSET_ROOT_URL),
25
+ relativePath: "assets/logo.svg",
26
+ },
27
+ {
28
+ source: new URL("assets/header.png", ASSET_ROOT_URL),
29
+ relativePath: "assets/header.png",
30
+ },
31
+ ];
32
+ export const AGENTPLANE_CODEX_HOME_ENV = "AGENTPLANE_CODEX_HOME";
33
+ function isJsonObject(value) {
34
+ return typeof value === "object" && value !== null && !Array.isArray(value);
35
+ }
36
+ function invalidMarketplaceError(message) {
37
+ return new CliError({
38
+ exitCode: 3,
39
+ code: "E_VALIDATION",
40
+ message,
41
+ });
42
+ }
43
+ async function readTextIfExists(filePath) {
44
+ try {
45
+ return await readFile(filePath, "utf8");
46
+ }
47
+ catch (err) {
48
+ const code = err?.code;
49
+ if (code === "ENOENT")
50
+ return null;
51
+ throw err;
52
+ }
53
+ }
54
+ function defaultMarketplaceDocument() {
55
+ return {
56
+ name: DEFAULT_MARKETPLACE_NAME,
57
+ interface: {
58
+ displayName: DEFAULT_MARKETPLACE_DISPLAY_NAME,
59
+ },
60
+ plugins: [],
61
+ };
62
+ }
63
+ function parseMarketplaceDocument(text) {
64
+ if (text === null)
65
+ return defaultMarketplaceDocument();
66
+ let parsed;
67
+ try {
68
+ parsed = JSON.parse(text);
69
+ }
70
+ catch (err) {
71
+ throw invalidMarketplaceError(`Invalid Codex marketplace JSON: ${err instanceof Error ? err.message : "unknown parse error"}`);
72
+ }
73
+ if (!isJsonObject(parsed)) {
74
+ throw invalidMarketplaceError("Invalid Codex marketplace JSON: expected a top-level object.");
75
+ }
76
+ if ("plugins" in parsed && !Array.isArray(parsed.plugins)) {
77
+ throw invalidMarketplaceError("Invalid Codex marketplace JSON: `plugins` must be an array.");
78
+ }
79
+ if ("interface" in parsed && parsed.interface !== undefined && !isJsonObject(parsed.interface)) {
80
+ throw invalidMarketplaceError("Invalid Codex marketplace JSON: `interface` must be an object when present.");
81
+ }
82
+ return parsed;
83
+ }
84
+ function marketplaceEntry() {
85
+ return {
86
+ name: PLUGIN_NAME,
87
+ source: {
88
+ source: "local",
89
+ path: `./plugins/${PLUGIN_NAME}`,
90
+ },
91
+ policy: {
92
+ installation: "AVAILABLE",
93
+ authentication: "ON_INSTALL",
94
+ },
95
+ category: "Productivity",
96
+ };
97
+ }
98
+ function upsertMarketplaceDocument(text) {
99
+ const document = parseMarketplaceDocument(text);
100
+ const interfaceObject = isJsonObject(document.interface) ? { ...document.interface } : {};
101
+ if (typeof document.name !== "string" || document.name.trim().length === 0) {
102
+ document.name = DEFAULT_MARKETPLACE_NAME;
103
+ }
104
+ if (typeof interfaceObject.displayName !== "string" ||
105
+ interfaceObject.displayName.trim().length === 0) {
106
+ interfaceObject.displayName = DEFAULT_MARKETPLACE_DISPLAY_NAME;
107
+ }
108
+ const plugins = Array.isArray(document.plugins) ? document.plugins : [];
109
+ const nextEntry = marketplaceEntry();
110
+ const existingIndex = plugins.findIndex((entry) => isJsonObject(entry) && entry.name === PLUGIN_NAME);
111
+ if (existingIndex === -1) {
112
+ plugins.push(nextEntry);
113
+ }
114
+ else {
115
+ plugins.splice(existingIndex, 1, nextEntry);
116
+ }
117
+ return {
118
+ ...document,
119
+ interface: interfaceObject,
120
+ plugins,
121
+ };
122
+ }
123
+ export function buildCodexPluginManifest(version = getVersion()) {
124
+ return {
125
+ name: PLUGIN_NAME,
126
+ version,
127
+ description: "Bundle AgentPlane workflow guidance for the Codex plugins UI.",
128
+ homepage: "https://github.com/basilisk-labs/agentplane",
129
+ repository: "https://github.com/basilisk-labs/agentplane",
130
+ license: "MIT",
131
+ keywords: ["agentplane", "codex", "workflow", "tasks", "git"],
132
+ skills: "./skills/",
133
+ interface: {
134
+ displayName: "AgentPlane",
135
+ shortDescription: "Governed git-native workflow guidance for Codex",
136
+ longDescription: "Install AgentPlane into Codex through a local marketplace and give Codex explicit task, planning, verification, and branch_pr workflow guidance.",
137
+ developerName: "basilisk-labs",
138
+ category: "Productivity",
139
+ capabilities: ["Read", "Write"],
140
+ websiteURL: "https://github.com/basilisk-labs/agentplane",
141
+ defaultPrompt: [
142
+ "Use AgentPlane to initialize a governed workflow in this repository.",
143
+ "Use AgentPlane to create a task, approve the plan, and start work in branch_pr mode.",
144
+ "Use AgentPlane to verify the active task and record evidence before finish.",
145
+ ],
146
+ brandColor: "#111827",
147
+ composerIcon: "./assets/icon.svg",
148
+ logo: "./assets/logo.svg",
149
+ screenshots: ["./assets/header.png"],
150
+ },
151
+ };
152
+ }
153
+ export function resolveCodexInstallRoot(opts) {
154
+ if (opts.scope === "repo") {
155
+ const repoRoot = opts.repoRoot?.trim();
156
+ if (!repoRoot) {
157
+ throw new CliError({
158
+ exitCode: 2,
159
+ code: "E_USAGE",
160
+ message: "Repo scope requires a resolved repository root.",
161
+ });
162
+ }
163
+ return path.resolve(repoRoot);
164
+ }
165
+ const env = opts.env ?? process.env;
166
+ const overridden = env[AGENTPLANE_CODEX_HOME_ENV]?.trim();
167
+ if (overridden)
168
+ return path.resolve(overridden);
169
+ return os.homedir();
170
+ }
171
+ export function resolveCodexPluginRoot(installRoot) {
172
+ return path.join(installRoot, "plugins", PLUGIN_NAME);
173
+ }
174
+ export function resolveCodexMarketplacePath(installRoot) {
175
+ return path.join(installRoot, ".agents", "plugins", "marketplace.json");
176
+ }
177
+ export async function installBundledCodexPlugin(opts) {
178
+ const installRoot = path.resolve(opts.installRoot);
179
+ const pluginRoot = resolveCodexPluginRoot(installRoot);
180
+ const manifestPath = path.join(pluginRoot, ".codex-plugin", "plugin.json");
181
+ const marketplacePath = resolveCodexMarketplacePath(installRoot);
182
+ await mkdir(path.dirname(manifestPath), { recursive: true });
183
+ await mkdir(path.dirname(marketplacePath), { recursive: true });
184
+ await writeJsonStableIfChanged(manifestPath, buildCodexPluginManifest(opts.version ?? getVersion()));
185
+ const copiedAssets = [];
186
+ for (const asset of TEXT_ASSETS) {
187
+ const targetPath = path.join(pluginRoot, asset.relativePath);
188
+ await mkdir(path.dirname(targetPath), { recursive: true });
189
+ const contents = await readFile(asset.source, "utf8");
190
+ await writeTextIfChanged(targetPath, contents);
191
+ copiedAssets.push(targetPath);
192
+ }
193
+ for (const asset of BINARY_ASSETS) {
194
+ const targetPath = path.join(pluginRoot, asset.relativePath);
195
+ await mkdir(path.dirname(targetPath), { recursive: true });
196
+ await copyFile(fileURLToPath(asset.source), targetPath);
197
+ copiedAssets.push(targetPath);
198
+ }
199
+ const nextMarketplace = upsertMarketplaceDocument(await readTextIfExists(marketplacePath));
200
+ await writeJsonStableIfChanged(marketplacePath, nextMarketplace);
201
+ return {
202
+ scope: opts.scope,
203
+ installRoot,
204
+ pluginRoot,
205
+ manifestPath,
206
+ marketplacePath,
207
+ copiedAssets,
208
+ };
209
+ }
@@ -56,8 +56,8 @@ export async function checkBranchPrDoneTaskOpenPrDrift(ctx) {
56
56
  state: "DONE branch_pr tasks still have open or unmerged PR artifacts",
57
57
  likelyCause: "the task was marked DONE, but its branch_pr PR artifacts were never reconciled to MERGED and the task branch still exists",
58
58
  nextAction: {
59
- command: "agentplane task normalize --sync-hosted-merges --task-id <task-id>",
60
- reason: "reconcile the shipped task's branch_pr PR artifacts to MERGED without scanning unrelated task history",
59
+ command: "agentplane task normalize --sync-branch-pr-state --task-id <task-id>",
60
+ reason: "reconcile the shipped task's local branch_pr state and PR artifacts to MERGED without scanning unrelated task history",
61
61
  },
62
62
  details: [
63
63
  `Affected tasks: ${matches.length}`,
@@ -32,5 +32,6 @@ export declare function cmdCommit(opts: {
32
32
  closeUnstageOthers: boolean;
33
33
  closeCheckOnly: boolean;
34
34
  closeStageTaskArtifacts?: boolean;
35
+ closeRefreshTaskArtifacts?: boolean;
35
36
  }): Promise<number>;
36
37
  //# sourceMappingURL=commands.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../../../src/commands/guard/impl/commands.ts"],"names":[],"mappings":"AAUA,OAAO,EAAsB,KAAK,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAQvF,OAAO,EAAoB,KAAK,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAsOxE,wBAAsB,aAAa,CAAC,IAAI,EAAE;IACxC,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,OAAO,CAAC;CAChB,GAAG,OAAO,CAAC,MAAM,CAAC,CAsBlB;AAED,wBAAsB,oBAAoB,CAAC,IAAI,EAAE;IAC/C,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,OAAO,GAAG,MAAM,CAAC;CAC1B,GAAG,OAAO,CAAC,MAAM,CAAC,CAyBlB;AAED,wBAAsB,cAAc,CAAC,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC,CAa9E;AAED,wBAAsB,SAAS,CAAC,IAAI,EAAE;IACpC,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,kBAAkB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;IACnB,WAAW,EAAE,OAAO,CAAC;IACrB,WAAW,EAAE,OAAO,CAAC;IACrB,UAAU,EAAE,OAAO,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;IACjB,YAAY,EAAE,OAAO,CAAC;IACtB,KAAK,EAAE,OAAO,CAAC;IACf,kBAAkB,EAAE,OAAO,CAAC;IAC5B,cAAc,EAAE,OAAO,CAAC;IACxB,uBAAuB,CAAC,EAAE,OAAO,CAAC;CACnC,GAAG,OAAO,CAAC,MAAM,CAAC,CA4OlB"}
1
+ {"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../../../src/commands/guard/impl/commands.ts"],"names":[],"mappings":"AAaA,OAAO,EAAsB,KAAK,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAQvF,OAAO,EAAoB,KAAK,kBAAkB,EAAE,MAAM,aAAa,CAAC;AA8SxE,wBAAsB,aAAa,CAAC,IAAI,EAAE;IACxC,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,OAAO,CAAC;CAChB,GAAG,OAAO,CAAC,MAAM,CAAC,CAsBlB;AAED,wBAAsB,oBAAoB,CAAC,IAAI,EAAE;IAC/C,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,OAAO,GAAG,MAAM,CAAC;CAC1B,GAAG,OAAO,CAAC,MAAM,CAAC,CAyBlB;AAED,wBAAsB,cAAc,CAAC,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC,CAa9E;AAED,wBAAsB,SAAS,CAAC,IAAI,EAAE;IACpC,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,kBAAkB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;IACnB,WAAW,EAAE,OAAO,CAAC;IACrB,WAAW,EAAE,OAAO,CAAC;IACrB,UAAU,EAAE,OAAO,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;IACjB,YAAY,EAAE,OAAO,CAAC;IACtB,KAAK,EAAE,OAAO,CAAC;IACf,kBAAkB,EAAE,OAAO,CAAC;IAC5B,cAAc,EAAE,OAAO,CAAC;IACxB,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,yBAAyB,CAAC,EAAE,OAAO,CAAC;CACrC,GAAG,OAAO,CAAC,MAAM,CAAC,CAsPlB"}