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.
- package/assets/AGENTS.md +2 -2
- package/assets/RUNNER.md +1 -1
- package/assets/agents/CODER.json +4 -0
- package/assets/agents/CREATOR.json +1 -0
- package/assets/agents/DOCS.json +2 -1
- package/assets/agents/INTEGRATOR.json +2 -1
- package/assets/agents/ORCHESTRATOR.json +3 -1
- package/assets/agents/PLANNER.json +3 -1
- package/assets/agents/REVIEWER.json +1 -0
- package/assets/agents/TESTER.json +2 -2
- package/assets/agents/UPDATER.json +1 -0
- package/assets/agents/UPGRADER.json +1 -1
- package/assets/codex-plugin/assets/header.png +0 -0
- package/assets/codex-plugin/assets/icon.svg +1 -0
- package/assets/codex-plugin/assets/logo.svg +1 -0
- package/assets/codex-plugin/skills/agentplane/SKILL.md +35 -0
- package/assets/policy/governance.md +4 -2
- package/assets/policy/incidents.md +3 -19
- package/assets/policy/workflow.release.md +5 -2
- package/bin/agentplane.js +58 -3
- package/bin/stale-dist-policy.js +6 -1
- package/dist/.build-manifest.json +271 -161
- package/dist/cli/exit-codes.d.ts.map +1 -1
- package/dist/cli/exit-codes.js +1 -0
- package/dist/cli/reason-codes.d.ts +1 -1
- package/dist/cli/reason-codes.d.ts.map +1 -1
- package/dist/cli/reason-codes.js +12 -0
- package/dist/cli/run-cli/command-catalog/core.d.ts +1 -1
- package/dist/cli/run-cli/command-catalog/core.d.ts.map +1 -1
- package/dist/cli/run-cli/command-catalog/core.js +22 -1
- package/dist/cli/run-cli/command-catalog/project.d.ts +1 -1
- package/dist/cli/run-cli/command-catalog/project.d.ts.map +1 -1
- package/dist/cli/run-cli/command-catalog/project.js +21 -3
- package/dist/cli/run-cli/command-catalog.d.ts +1 -1
- package/dist/cli/run-cli/command-catalog.d.ts.map +1 -1
- package/dist/cli/run-cli/commands/codex.d.ts +14 -0
- package/dist/cli/run-cli/commands/codex.d.ts.map +1 -0
- package/dist/cli/run-cli/commands/codex.js +100 -0
- package/dist/cli/run-cli/commands/core.d.ts +1 -0
- package/dist/cli/run-cli/commands/core.d.ts.map +1 -1
- package/dist/cli/run-cli/commands/core.js +1 -0
- package/dist/cli/run-cli/commands/init/recipes.d.ts +9 -1
- package/dist/cli/run-cli/commands/init/recipes.d.ts.map +1 -1
- package/dist/cli/run-cli/commands/init/recipes.js +32 -22
- package/dist/cli/run-cli/commands/init.d.ts.map +1 -1
- package/dist/cli/run-cli/commands/init.js +26 -21
- package/dist/cli/run-cli/error-guidance.js +20 -0
- package/dist/cli/run-cli.test-helpers.d.ts +1 -0
- package/dist/cli/run-cli.test-helpers.d.ts.map +1 -1
- package/dist/cli/run-cli.test-helpers.js +36 -19
- package/dist/commands/branch/cleanup-merged.d.ts +1 -0
- package/dist/commands/branch/cleanup-merged.d.ts.map +1 -1
- package/dist/commands/branch/cleanup-merged.js +18 -9
- package/dist/commands/branch/work-start.d.ts.map +1 -1
- package/dist/commands/branch/work-start.js +82 -5
- package/dist/commands/codex/plugin-install.d.ts +26 -0
- package/dist/commands/codex/plugin-install.d.ts.map +1 -0
- package/dist/commands/codex/plugin-install.js +209 -0
- package/dist/commands/doctor/branch-pr.js +2 -2
- package/dist/commands/guard/impl/commands.d.ts +1 -0
- package/dist/commands/guard/impl/commands.d.ts.map +1 -1
- package/dist/commands/guard/impl/commands.js +78 -8
- package/dist/commands/hooks/index.d.ts +1 -1
- package/dist/commands/hooks/index.d.ts.map +1 -1
- package/dist/commands/hooks/index.js +48 -12
- package/dist/commands/pr/check.d.ts.map +1 -1
- package/dist/commands/pr/check.js +3 -0
- package/dist/commands/pr/integrate/cmd.d.ts.map +1 -1
- package/dist/commands/pr/integrate/cmd.js +103 -2
- package/dist/commands/pr/integrate/internal/cleanup.d.ts +1 -11
- package/dist/commands/pr/integrate/internal/cleanup.d.ts.map +1 -1
- package/dist/commands/pr/integrate/internal/cleanup.js +1 -46
- package/dist/commands/pr/integrate/internal/finalize.d.ts.map +1 -1
- package/dist/commands/pr/integrate/internal/finalize.js +3 -0
- package/dist/commands/pr/integrate/internal/github-protection.d.ts +5 -0
- package/dist/commands/pr/integrate/internal/github-protection.d.ts.map +1 -0
- package/dist/commands/pr/integrate/internal/github-protection.js +13 -0
- package/dist/commands/pr/integrate/internal/pre-integrate-bootstrap.d.ts +15 -0
- package/dist/commands/pr/integrate/internal/pre-integrate-bootstrap.d.ts.map +1 -0
- package/dist/commands/pr/integrate/internal/pre-integrate-bootstrap.js +35 -0
- package/dist/commands/pr/integrate/internal/prepare.d.ts +1 -0
- package/dist/commands/pr/integrate/internal/prepare.d.ts.map +1 -1
- package/dist/commands/pr/integrate/internal/prepare.js +46 -7
- package/dist/commands/pr/internal/auto-commit.d.ts +7 -0
- package/dist/commands/pr/internal/auto-commit.d.ts.map +1 -0
- package/dist/commands/pr/internal/auto-commit.js +69 -0
- package/dist/commands/pr/internal/freshness.d.ts +1 -0
- package/dist/commands/pr/internal/freshness.d.ts.map +1 -1
- package/dist/commands/pr/internal/freshness.js +2 -0
- package/dist/commands/pr/internal/sync.d.ts.map +1 -1
- package/dist/commands/pr/internal/sync.js +98 -27
- package/dist/commands/pr/open.d.ts.map +1 -1
- package/dist/commands/pr/open.js +52 -3
- package/dist/commands/pr/update.d.ts.map +1 -1
- package/dist/commands/pr/update.js +13 -2
- package/dist/commands/recipes/active.command.d.ts +7 -0
- package/dist/commands/recipes/active.command.d.ts.map +1 -0
- package/dist/commands/recipes/active.command.js +12 -0
- package/dist/commands/recipes/add.command.d.ts +8 -0
- package/dist/commands/recipes/add.command.d.ts.map +1 -0
- package/dist/commands/recipes/add.command.js +33 -0
- package/dist/commands/recipes/detach.command.d.ts +7 -0
- package/dist/commands/recipes/detach.command.d.ts.map +1 -0
- package/dist/commands/recipes/detach.command.js +19 -0
- package/dist/commands/recipes/disable.command.d.ts +7 -0
- package/dist/commands/recipes/disable.command.d.ts.map +1 -0
- package/dist/commands/recipes/disable.command.js +10 -0
- package/dist/commands/recipes/enable.command.d.ts +7 -0
- package/dist/commands/recipes/enable.command.d.ts.map +1 -0
- package/dist/commands/recipes/enable.command.js +10 -0
- package/dist/commands/recipes/explain-active.command.d.ts +5 -0
- package/dist/commands/recipes/explain-active.command.d.ts.map +1 -0
- package/dist/commands/recipes/explain-active.command.js +11 -0
- package/dist/commands/recipes/explain.command.d.ts.map +1 -1
- package/dist/commands/recipes/explain.command.js +4 -2
- package/dist/commands/recipes/impl/apply.d.ts.map +1 -1
- package/dist/commands/recipes/impl/apply.js +33 -14
- package/dist/commands/recipes/impl/commands/active.d.ts +6 -0
- package/dist/commands/recipes/impl/commands/active.d.ts.map +1 -0
- package/dist/commands/recipes/impl/commands/active.js +46 -0
- package/dist/commands/recipes/impl/commands/add.d.ts +7 -0
- package/dist/commands/recipes/impl/commands/add.d.ts.map +1 -0
- package/dist/commands/recipes/impl/commands/add.js +100 -0
- package/dist/commands/recipes/impl/commands/detach.d.ts +6 -0
- package/dist/commands/recipes/impl/commands/detach.d.ts.map +1 -0
- package/dist/commands/recipes/impl/commands/detach.js +85 -0
- package/dist/commands/recipes/impl/commands/disable.d.ts +6 -0
- package/dist/commands/recipes/impl/commands/disable.d.ts.map +1 -0
- package/dist/commands/recipes/impl/commands/disable.js +21 -0
- package/dist/commands/recipes/impl/commands/enable.d.ts +6 -0
- package/dist/commands/recipes/impl/commands/enable.d.ts.map +1 -0
- package/dist/commands/recipes/impl/commands/enable.js +39 -0
- package/dist/commands/recipes/impl/commands/explain-active.d.ts +5 -0
- package/dist/commands/recipes/impl/commands/explain-active.d.ts.map +1 -0
- package/dist/commands/recipes/impl/commands/explain-active.js +20 -0
- package/dist/commands/recipes/impl/commands/explain.d.ts.map +1 -1
- package/dist/commands/recipes/impl/commands/explain.js +40 -3
- package/dist/commands/recipes/impl/commands/info.d.ts.map +1 -1
- package/dist/commands/recipes/impl/commands/info.js +21 -8
- package/dist/commands/recipes/impl/commands/install.d.ts.map +1 -1
- package/dist/commands/recipes/impl/commands/install.js +32 -29
- package/dist/commands/recipes/impl/commands/list.d.ts.map +1 -1
- package/dist/commands/recipes/impl/commands/list.js +11 -11
- package/dist/commands/recipes/impl/commands/remove.d.ts.map +1 -1
- package/dist/commands/recipes/impl/commands/remove.js +5 -0
- package/dist/commands/recipes/impl/commands/update.d.ts +7 -0
- package/dist/commands/recipes/impl/commands/update.d.ts.map +1 -0
- package/dist/commands/recipes/impl/commands/update.js +93 -0
- package/dist/commands/recipes/impl/commands.d.ts +7 -0
- package/dist/commands/recipes/impl/commands.d.ts.map +1 -1
- package/dist/commands/recipes/impl/commands.js +7 -0
- package/dist/commands/recipes/impl/constants.d.ts +1 -14
- package/dist/commands/recipes/impl/constants.d.ts.map +1 -1
- package/dist/commands/recipes/impl/constants.js +1 -18
- package/dist/commands/recipes/impl/manifest.d.ts +2 -2
- package/dist/commands/recipes/impl/manifest.d.ts.map +1 -1
- package/dist/commands/recipes/impl/manifest.js +4 -226
- package/dist/commands/recipes/impl/overlay-project.d.ts +32 -0
- package/dist/commands/recipes/impl/overlay-project.d.ts.map +1 -0
- package/dist/commands/recipes/impl/overlay-project.js +282 -0
- package/dist/commands/recipes/impl/paths.d.ts +20 -2
- package/dist/commands/recipes/impl/paths.d.ts.map +1 -1
- package/dist/commands/recipes/impl/paths.js +23 -5
- package/dist/commands/recipes/impl/project-installed-recipes.d.ts +2 -4
- package/dist/commands/recipes/impl/project-installed-recipes.d.ts.map +1 -1
- package/dist/commands/recipes/impl/project-installed-recipes.js +30 -74
- package/dist/commands/recipes/impl/project-recipe-state.d.ts +18 -0
- package/dist/commands/recipes/impl/project-recipe-state.d.ts.map +1 -0
- package/dist/commands/recipes/impl/project-recipe-state.js +94 -0
- package/dist/commands/recipes/impl/project-registry.d.ts +20 -0
- package/dist/commands/recipes/impl/project-registry.d.ts.map +1 -0
- package/dist/commands/recipes/impl/project-registry.js +104 -0
- package/dist/commands/recipes/impl/resolver.d.ts.map +1 -1
- package/dist/commands/recipes/impl/resolver.js +5 -3
- package/dist/commands/recipes/impl/types.d.ts +1 -240
- package/dist/commands/recipes/impl/types.d.ts.map +1 -1
- package/dist/commands/recipes/info.command.js +2 -2
- package/dist/commands/recipes/install.spec.js +4 -4
- package/dist/commands/recipes/list.command.js +4 -4
- package/dist/commands/recipes/remove.command.js +2 -2
- package/dist/commands/recipes/update.command.d.ts +8 -0
- package/dist/commands/recipes/update.command.d.ts.map +1 -0
- package/dist/commands/recipes/update.command.js +35 -0
- package/dist/commands/recipes.d.ts +7 -4
- package/dist/commands/recipes.d.ts.map +1 -1
- package/dist/commands/recipes.js +6 -3
- package/dist/commands/recipes.test-helpers.d.ts +3 -3
- package/dist/commands/recipes.test-helpers.d.ts.map +1 -1
- package/dist/commands/recipes.test-helpers.js +105 -15
- package/dist/commands/release/apply.command.d.ts +3 -1
- package/dist/commands/release/apply.command.d.ts.map +1 -1
- package/dist/commands/release/apply.command.js +354 -18
- package/dist/commands/release/apply.mutation.d.ts.map +1 -1
- package/dist/commands/release/apply.mutation.js +1 -0
- package/dist/commands/release/apply.reporting.d.ts +1 -0
- package/dist/commands/release/apply.reporting.d.ts.map +1 -1
- package/dist/commands/release/apply.reporting.js +12 -8
- package/dist/commands/release/apply.types.d.ts +13 -0
- package/dist/commands/release/apply.types.d.ts.map +1 -1
- package/dist/commands/release/plan.command.d.ts.map +1 -1
- package/dist/commands/release/plan.command.js +48 -0
- package/dist/commands/scenario/execute.command.js +4 -4
- package/dist/commands/scenario/impl/commands.js +4 -4
- package/dist/commands/scenario/info.command.js +4 -4
- package/dist/commands/scenario/list.command.js +3 -3
- package/dist/commands/scenario/run.command.js +5 -5
- package/dist/commands/scenario/scenario.command.js +7 -7
- package/dist/commands/shared/merged-branch-cleanup.d.ts +12 -0
- package/dist/commands/shared/merged-branch-cleanup.d.ts.map +1 -0
- package/dist/commands/shared/merged-branch-cleanup.js +46 -0
- package/dist/commands/shared/post-commit-pr-artifacts.d.ts.map +1 -1
- package/dist/commands/shared/post-commit-pr-artifacts.js +35 -0
- package/dist/commands/shared/task-backend.d.ts.map +1 -1
- package/dist/commands/shared/task-backend.js +37 -5
- package/dist/commands/shared/task-handoff.d.ts +2 -1
- package/dist/commands/shared/task-handoff.d.ts.map +1 -1
- package/dist/commands/shared/task-handoff.js +15 -0
- package/dist/commands/shared/task-local-freshness.d.ts +2 -0
- package/dist/commands/shared/task-local-freshness.d.ts.map +1 -1
- package/dist/commands/shared/task-local-freshness.js +7 -1
- package/dist/commands/task/finish-shared.d.ts +1 -0
- package/dist/commands/task/finish-shared.d.ts.map +1 -1
- package/dist/commands/task/finish-shared.js +1 -0
- package/dist/commands/task/handoff-show.command.d.ts.map +1 -1
- package/dist/commands/task/handoff-show.command.js +24 -0
- package/dist/commands/task/hosted-close-pr.command.d.ts.map +1 -1
- package/dist/commands/task/hosted-close-pr.command.js +35 -0
- package/dist/commands/task/hosted-close.command.d.ts.map +1 -1
- package/dist/commands/task/hosted-close.command.js +185 -18
- package/dist/commands/task/hosted-merge-sync.d.ts +4 -1
- package/dist/commands/task/hosted-merge-sync.d.ts.map +1 -1
- package/dist/commands/task/hosted-merge-sync.js +52 -10
- package/dist/commands/task/start-ready.d.ts.map +1 -1
- package/dist/commands/task/start-ready.js +0 -86
- package/dist/runner/context/base-prompts.d.ts +2 -1
- package/dist/runner/context/base-prompts.d.ts.map +1 -1
- package/dist/runner/context/base-prompts.js +109 -13
- package/dist/runner/context/recipe-context.d.ts.map +1 -1
- package/dist/runner/context/recipe-context.js +40 -8
- package/dist/runner/types.d.ts +4 -0
- package/dist/runner/types.d.ts.map +1 -1
- package/dist/runner/usecases/task-run.d.ts.map +1 -1
- package/dist/runner/usecases/task-run.js +2 -1
- package/dist/runtime/behavior/resolve.d.ts +2 -1
- package/dist/runtime/behavior/resolve.d.ts.map +1 -1
- package/dist/runtime/behavior/resolve.js +25 -5
- package/dist/runtime/behavior/types.d.ts +1 -0
- package/dist/runtime/behavior/types.d.ts.map +1 -1
- package/dist/runtime/capabilities/recipe.d.ts +2 -1
- package/dist/runtime/capabilities/recipe.d.ts.map +1 -1
- package/dist/runtime/capabilities/recipe.js +88 -28
- package/dist/shared/errors.d.ts +1 -1
- package/dist/shared/errors.d.ts.map +1 -1
- package/dist/shared/runtime-source.d.ts.map +1 -1
- package/dist/shared/runtime-source.js +8 -3
- package/package.json +3 -2
- package/dist/cli/recipes-bundled.d.ts +0 -10
- package/dist/cli/recipes-bundled.d.ts.map +0 -1
- 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
|
-
|
|
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.
|
|
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.
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
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.
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
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
|
-
|
|
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.
|
|
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.
|
|
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.
|
|
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)))
|
|
@@ -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;
|
|
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
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
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
|
-
|
|
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":"
|
|
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
|
|
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
|
-
|
|
92
|
-
|
|
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
|
-
|
|
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-
|
|
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}`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../../../src/commands/guard/impl/commands.ts"],"names":[],"mappings":"
|
|
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"}
|