agentplane 0.3.12 → 0.3.14
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/RUNNER.md +1 -1
- package/assets/agents/ORCHESTRATOR.json +1 -1
- package/assets/agents/SKILL_EXTRACTOR.json +31 -0
- 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/framework.manifest.json +7 -0
- package/assets/policy/governance.md +4 -2
- package/assets/policy/incidents.md +4 -19
- package/assets/policy/workflow.branch_pr.md +10 -5
- package/assets/policy/workflow.release.md +5 -2
- package/dist/.build-manifest.json +409 -219
- package/dist/cli/exit-codes.d.ts.map +1 -1
- package/dist/cli/exit-codes.js +1 -0
- package/dist/cli/output.d.ts +29 -0
- package/dist/cli/output.d.ts.map +1 -1
- package/dist/cli/output.js +33 -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 +36 -78
- package/dist/cli/run-cli/command-catalog/lifecycle.d.ts.map +1 -1
- package/dist/cli/run-cli/command-catalog/lifecycle.js +4 -12
- 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 +27 -31
- package/dist/cli/run-cli/command-catalog/shared.d.ts +9 -6
- package/dist/cli/run-cli/command-catalog/shared.d.ts.map +1 -1
- package/dist/cli/run-cli/command-catalog/shared.js +23 -6
- package/dist/cli/run-cli/command-catalog/task.d.ts.map +1 -1
- package/dist/cli/run-cli/command-catalog/task.js +6 -18
- 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 +33 -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.js +1 -1
- package/dist/cli/run-cli.test-helpers.d.ts +1 -74
- package/dist/cli/run-cli.test-helpers.d.ts.map +1 -1
- package/dist/cli/run-cli.test-helpers.js +1 -766
- package/dist/commands/branch/cleanup-merged.d.ts.map +1 -1
- package/dist/commands/branch/cleanup-merged.js +5 -9
- package/dist/commands/branch/work-start.command.d.ts.map +1 -1
- package/dist/commands/branch/work-start.command.js +1 -0
- 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/commit.spec.d.ts.map +1 -1
- package/dist/commands/commit.spec.js +2 -0
- package/dist/commands/doctor/branch-pr.d.ts +1 -1
- package/dist/commands/doctor/branch-pr.d.ts.map +1 -1
- package/dist/commands/doctor/branch-pr.js +5 -2
- package/dist/commands/guard/impl/commands.d.ts.map +1 -1
- package/dist/commands/guard/impl/commands.js +4 -1
- package/dist/commands/guard/impl/comment-commit.d.ts.map +1 -1
- package/dist/commands/guard/impl/comment-commit.js +2 -1
- package/dist/commands/guard/impl/env.d.ts +6 -0
- package/dist/commands/guard/impl/env.d.ts.map +1 -1
- package/dist/commands/guard/impl/env.js +41 -0
- package/dist/commands/pr/integrate/cmd.d.ts.map +1 -1
- package/dist/commands/pr/integrate/cmd.js +81 -5
- package/dist/commands/pr/integrate/internal/prepare.d.ts.map +1 -1
- package/dist/commands/pr/integrate/internal/prepare.js +38 -7
- package/dist/commands/pr/internal/auto-commit.d.ts.map +1 -1
- package/dist/commands/pr/internal/auto-commit.js +13 -7
- package/dist/commands/pr/internal/sync-branch.d.ts +36 -0
- package/dist/commands/pr/internal/sync-branch.d.ts.map +1 -0
- package/dist/commands/pr/internal/sync-branch.js +113 -0
- package/dist/commands/pr/internal/sync-github.d.ts +28 -0
- package/dist/commands/pr/internal/sync-github.d.ts.map +1 -0
- package/dist/commands/pr/internal/sync-github.js +178 -0
- package/dist/commands/pr/internal/sync-model.d.ts +36 -0
- package/dist/commands/pr/internal/sync-model.d.ts.map +1 -0
- package/dist/commands/pr/internal/sync-model.js +1 -0
- package/dist/commands/pr/internal/sync-open-step.d.ts +10 -0
- package/dist/commands/pr/internal/sync-open-step.d.ts.map +1 -0
- package/dist/commands/pr/internal/sync-open-step.js +128 -0
- package/dist/commands/pr/internal/sync-support.d.ts +7 -0
- package/dist/commands/pr/internal/sync-support.d.ts.map +1 -0
- package/dist/commands/pr/internal/sync-support.js +29 -0
- package/dist/commands/pr/internal/sync-update-step.d.ts +6 -0
- package/dist/commands/pr/internal/sync-update-step.d.ts.map +1 -0
- package/dist/commands/pr/internal/sync-update-step.js +68 -0
- package/dist/commands/pr/internal/sync.d.ts +2 -6
- package/dist/commands/pr/internal/sync.d.ts.map +1 -1
- package/dist/commands/pr/internal/sync.js +83 -525
- package/dist/commands/pr/open.d.ts.map +1 -1
- package/dist/commands/pr/open.js +62 -7
- package/dist/commands/pr/pr.command.d.ts.map +1 -1
- package/dist/commands/pr/pr.command.js +7 -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 +1 -1
- package/dist/commands/recipes/impl/apply.d.ts.map +1 -1
- package/dist/commands/recipes/impl/apply.js +34 -16
- 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 +47 -0
- package/dist/commands/recipes/impl/commands/add.d.ts +8 -0
- package/dist/commands/recipes/impl/commands/add.d.ts.map +1 -0
- package/dist/commands/recipes/impl/commands/add.js +105 -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 +99 -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 +23 -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 +41 -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 +83 -36
- package/dist/commands/recipes/impl/commands/info.d.ts.map +1 -1
- package/dist/commands/recipes/impl/commands/info.js +39 -22
- package/dist/commands/recipes/impl/commands/install.d.ts +1 -1
- package/dist/commands/recipes/impl/commands/install.d.ts.map +1 -1
- package/dist/commands/recipes/impl/commands/install.js +35 -42
- package/dist/commands/recipes/impl/commands/list-remote.d.ts.map +1 -1
- package/dist/commands/recipes/impl/commands/list-remote.js +2 -3
- package/dist/commands/recipes/impl/commands/list.d.ts.map +1 -1
- package/dist/commands/recipes/impl/commands/list.js +13 -12
- package/dist/commands/recipes/impl/commands/remove.d.ts.map +1 -1
- package/dist/commands/recipes/impl/commands/remove.js +12 -2
- 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 +107 -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/index.d.ts +1 -1
- package/dist/commands/recipes/impl/index.d.ts.map +1 -1
- package/dist/commands/recipes/impl/installed-recipes.d.ts +1 -1
- package/dist/commands/recipes/impl/installed-recipes.d.ts.map +1 -1
- package/dist/commands/recipes/impl/installed-recipes.js +1 -2
- package/dist/commands/recipes/impl/mutation-transaction.d.ts +7 -0
- package/dist/commands/recipes/impl/mutation-transaction.d.ts.map +1 -0
- package/dist/commands/recipes/impl/mutation-transaction.js +47 -0
- package/dist/commands/recipes/impl/overlay-project.d.ts +48 -0
- package/dist/commands/recipes/impl/overlay-project.d.ts.map +1 -0
- package/dist/commands/recipes/impl/overlay-project.js +320 -0
- package/dist/commands/recipes/impl/paths.d.ts +17 -2
- package/dist/commands/recipes/impl/paths.d.ts.map +1 -1
- package/dist/commands/recipes/impl/paths.js +20 -5
- package/dist/commands/recipes/impl/project-installed-recipes.d.ts +5 -4
- package/dist/commands/recipes/impl/project-installed-recipes.d.ts.map +1 -1
- package/dist/commands/recipes/impl/project-installed-recipes.js +34 -76
- 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 +24 -0
- package/dist/commands/recipes/impl/project-registry.d.ts.map +1 -0
- package/dist/commands/recipes/impl/project-registry.js +124 -0
- package/dist/commands/recipes/impl/resolver.d.ts +1 -1
- package/dist/commands/recipes/impl/resolver.d.ts.map +1 -1
- package/dist/commands/recipes/impl/resolver.js +6 -4
- 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/impl/version.d.ts +5 -0
- package/dist/commands/recipes/impl/version.d.ts.map +1 -0
- package/dist/commands/recipes/impl/version.js +9 -0
- 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 +10 -6
- package/dist/commands/recipes.d.ts.map +1 -1
- package/dist/commands/recipes.js +8 -5
- 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 +1 -1
- package/dist/commands/release/apply.command.d.ts.map +1 -1
- package/dist/commands/release/apply.command.js +15 -379
- package/dist/commands/release/apply.mutation.d.ts +1 -0
- package/dist/commands/release/apply.mutation.d.ts.map +1 -1
- package/dist/commands/release/apply.mutation.js +24 -1
- package/dist/commands/release/apply.pipeline.d.ts +22 -0
- package/dist/commands/release/apply.pipeline.d.ts.map +1 -0
- package/dist/commands/release/apply.pipeline.js +371 -0
- package/dist/commands/release/apply.preflight.d.ts +2 -0
- package/dist/commands/release/apply.preflight.d.ts.map +1 -1
- package/dist/commands/release/apply.preflight.js +13 -4
- package/dist/commands/release/apply.types.d.ts +27 -0
- package/dist/commands/release/apply.types.d.ts.map +1 -1
- package/dist/commands/release.test-helpers.d.ts +4 -0
- package/dist/commands/release.test-helpers.d.ts.map +1 -1
- package/dist/commands/release.test-helpers.js +7 -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/reconcile-check.d.ts.map +1 -1
- package/dist/commands/shared/reconcile-check.js +2 -2
- package/dist/commands/shared/task-backend.d.ts +6 -1
- package/dist/commands/shared/task-backend.d.ts.map +1 -1
- package/dist/commands/shared/task-backend.js +34 -2
- 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-mutation.d.ts.map +1 -1
- package/dist/commands/shared/task-mutation.js +4 -4
- package/dist/commands/shared/task-store/intents.d.ts +34 -0
- package/dist/commands/shared/task-store/intents.d.ts.map +1 -0
- package/dist/commands/shared/task-store/intents.js +265 -0
- package/dist/commands/shared/task-store/readme.d.ts +28 -0
- package/dist/commands/shared/task-store/readme.d.ts.map +1 -0
- package/dist/commands/shared/task-store/readme.js +125 -0
- package/dist/commands/shared/task-store/store.d.ts +26 -0
- package/dist/commands/shared/task-store/store.d.ts.map +1 -0
- package/dist/commands/shared/task-store/store.js +105 -0
- package/dist/commands/shared/task-store/types.d.ts +94 -0
- package/dist/commands/shared/task-store/types.d.ts.map +1 -0
- package/dist/commands/shared/task-store/types.js +1 -0
- package/dist/commands/shared/task-store.d.ts +3 -109
- package/dist/commands/shared/task-store.d.ts.map +1 -1
- package/dist/commands/shared/task-store.js +2 -493
- package/dist/commands/task/block.d.ts.map +1 -1
- package/dist/commands/task/block.js +7 -2
- package/dist/commands/task/comment.d.ts.map +1 -1
- package/dist/commands/task/comment.js +7 -2
- package/dist/commands/task/finish-shared.d.ts.map +1 -1
- package/dist/commands/task/finish-shared.js +3 -3
- package/dist/commands/task/finish.d.ts.map +1 -1
- package/dist/commands/task/finish.js +102 -15
- 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-merge-sync.d.ts.map +1 -1
- package/dist/commands/task/hosted-merge-sync.js +9 -4
- package/dist/commands/task/list.run.d.ts.map +1 -1
- package/dist/commands/task/list.run.js +14 -4
- package/dist/commands/task/new.command.d.ts.map +1 -1
- package/dist/commands/task/new.command.js +16 -2
- package/dist/commands/task/new.js +2 -2
- package/dist/commands/task/show.d.ts.map +1 -1
- package/dist/commands/task/show.js +3 -3
- package/dist/commands/task/update.d.ts.map +1 -1
- package/dist/commands/task/update.js +11 -3
- package/dist/runner/adapters/codex.d.ts.map +1 -1
- package/dist/runner/adapters/codex.js +3 -33
- package/dist/runner/adapters/custom.d.ts.map +1 -1
- package/dist/runner/adapters/custom.js +3 -30
- package/dist/runner/adapters/runtime-shared.d.ts +14 -0
- package/dist/runner/adapters/runtime-shared.d.ts.map +1 -0
- package/dist/runner/adapters/runtime-shared.js +36 -0
- package/dist/runner/context/base-prompt-sources.d.ts +30 -0
- package/dist/runner/context/base-prompt-sources.d.ts.map +1 -0
- package/dist/runner/context/base-prompt-sources.js +144 -0
- package/dist/runner/context/base-prompts.d.ts +5 -23
- package/dist/runner/context/base-prompts.d.ts.map +1 -1
- package/dist/runner/context/base-prompts.js +10 -358
- package/dist/runner/context/overlay-prompt-blocks.d.ts +7 -0
- package/dist/runner/context/overlay-prompt-blocks.d.ts.map +1 -0
- package/dist/runner/context/overlay-prompt-blocks.js +72 -0
- package/dist/runner/context/prompt-block-shared.d.ts +54 -0
- package/dist/runner/context/prompt-block-shared.d.ts.map +1 -0
- package/dist/runner/context/prompt-block-shared.js +106 -0
- package/dist/runner/context/recipe-context.d.ts +2 -1
- package/dist/runner/context/recipe-context.d.ts.map +1 -1
- package/dist/runner/context/recipe-context.js +41 -8
- package/dist/runner/context/recipe-prompt-blocks.d.ts +6 -0
- package/dist/runner/context/recipe-prompt-blocks.d.ts.map +1 -0
- package/dist/runner/context/recipe-prompt-blocks.js +143 -0
- package/dist/runner/types.d.ts +4 -0
- package/dist/runner/types.d.ts.map +1 -1
- package/dist/runner/usecases/scenario-materialize-task.js +2 -2
- package/dist/runner/usecases/task-run-inspect.js +2 -2
- package/dist/runner/usecases/task-run-lifecycle-shared.js +2 -2
- package/dist/runner/usecases/task-run.d.ts.map +1 -1
- package/dist/runner/usecases/task-run.js +6 -3
- 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/runtime/execution-context.d.ts +63 -0
- package/dist/runtime/execution-context.d.ts.map +1 -0
- package/dist/{usecases/context/resolve-context.js → runtime/execution-context.js} +23 -26
- package/dist/runtime/incidents/advice-strategy.d.ts +15 -0
- package/dist/runtime/incidents/advice-strategy.d.ts.map +1 -0
- package/dist/runtime/incidents/advice-strategy.js +54 -0
- package/dist/runtime/incidents/plan-strategy.d.ts +9 -0
- package/dist/runtime/incidents/plan-strategy.d.ts.map +1 -0
- package/dist/runtime/incidents/plan-strategy.js +205 -0
- package/dist/runtime/incidents/registry-strategy.d.ts +6 -0
- package/dist/runtime/incidents/registry-strategy.d.ts.map +1 -0
- package/dist/runtime/incidents/registry-strategy.js +280 -0
- package/dist/runtime/incidents/resolve.d.ts +3 -25
- package/dist/runtime/incidents/resolve.d.ts.map +1 -1
- package/dist/runtime/incidents/resolve.js +3 -683
- package/dist/runtime/incidents/shared.d.ts +34 -0
- package/dist/runtime/incidents/shared.d.ts.map +1 -0
- package/dist/runtime/incidents/shared.js +171 -0
- 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/dist/testing/cli-harness/recipe-archives.d.ts +28 -0
- package/dist/testing/cli-harness/recipe-archives.d.ts.map +1 -0
- package/dist/testing/cli-harness/recipe-archives.js +374 -0
- package/dist/testing/cli-harness/stdio.d.ts +26 -0
- package/dist/testing/cli-harness/stdio.d.ts.map +1 -0
- package/dist/testing/cli-harness/stdio.js +84 -0
- package/dist/testing/cli-harness.d.ts +25 -0
- package/dist/testing/cli-harness.d.ts.map +1 -0
- package/dist/testing/cli-harness.js +313 -0
- package/dist/testing/index.d.ts +2 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +1 -0
- package/package.json +7 -3
- 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
- package/dist/commands/recipes/impl/manifest.d.ts +0 -4
- package/dist/commands/recipes/impl/manifest.d.ts.map +0 -1
- package/dist/commands/recipes/impl/manifest.js +0 -229
- package/dist/commands/recipes/impl/normalize.d.ts +0 -8
- package/dist/commands/recipes/impl/normalize.d.ts.map +0 -1
- package/dist/commands/recipes/impl/normalize.js +0 -54
- package/dist/commands/recipes/impl/scenario.d.ts +0 -16
- package/dist/commands/recipes/impl/scenario.d.ts.map +0 -1
- package/dist/commands/recipes/impl/scenario.js +0 -262
- package/dist/recipes/bundled-recipes.d.ts +0 -17
- package/dist/recipes/bundled-recipes.d.ts.map +0 -1
- package/dist/recipes/bundled-recipes.js +0 -15
- package/dist/usecases/context/resolve-context.d.ts +0 -68
- package/dist/usecases/context/resolve-context.d.ts.map +0 -1
- package/dist/usecases/task/task-list-usecase.d.ts +0 -9
- package/dist/usecases/task/task-list-usecase.d.ts.map +0 -1
- package/dist/usecases/task/task-list-usecase.js +0 -17
- package/dist/usecases/task/task-new-usecase.d.ts +0 -9
- package/dist/usecases/task/task-new-usecase.d.ts.map +0 -1
- package/dist/usecases/task/task-new-usecase.js +0 -17
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
import { execFile } from "node:child_process";
|
|
2
|
+
import { access, cp, mkdir, mkdtemp, readdir, rm, writeFile } from "node:fs/promises";
|
|
3
|
+
import os from "node:os";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
import { promisify } from "node:util";
|
|
6
|
+
import { afterAll, afterEach, beforeAll, beforeEach, vi } from "vitest";
|
|
7
|
+
import { defaultConfig } from "@agentplaneorg/core";
|
|
8
|
+
import { runCliSilent, silenceStdIO } from "./cli-harness/stdio.js";
|
|
9
|
+
export * from "./cli-harness/recipe-archives.js";
|
|
10
|
+
export * from "./cli-harness/stdio.js";
|
|
11
|
+
const execFileAsync = promisify(execFile);
|
|
12
|
+
let agentplaneHome = null;
|
|
13
|
+
const testRoots = new Set();
|
|
14
|
+
const originalAgentplaneHome = process.env.AGENTPLANE_HOME;
|
|
15
|
+
const originalNoUpdateCheck = process.env.AGENTPLANE_NO_UPDATE_CHECK;
|
|
16
|
+
const originalGitAuthorName = process.env.GIT_AUTHOR_NAME;
|
|
17
|
+
const originalGitAuthorEmail = process.env.GIT_AUTHOR_EMAIL;
|
|
18
|
+
const originalGitCommitterName = process.env.GIT_COMMITTER_NAME;
|
|
19
|
+
const originalGitCommitterEmail = process.env.GIT_COMMITTER_EMAIL;
|
|
20
|
+
const originalHookRunner = process.env.AGENTPLANE_HOOK_RUNNER;
|
|
21
|
+
let gitTemplateRoot = null;
|
|
22
|
+
let gitTemplatePromise = null;
|
|
23
|
+
async function ensureGitTemplateRoot() {
|
|
24
|
+
if (gitTemplateRoot)
|
|
25
|
+
return gitTemplateRoot;
|
|
26
|
+
gitTemplatePromise ??= (async () => {
|
|
27
|
+
const root = await mkdtemp(path.join(os.tmpdir(), "agentplane-git-template-"));
|
|
28
|
+
await execFileAsync("git", ["init", "-q"], { cwd: root, env: cleanGitEnv() });
|
|
29
|
+
// Tests must not rely on global git config. Configure author identity locally
|
|
30
|
+
// so any helper that creates commits works in CI.
|
|
31
|
+
await execFileAsync("git", ["config", "user.email", "agentplane-test@example.com"], {
|
|
32
|
+
cwd: root,
|
|
33
|
+
env: cleanGitEnv(),
|
|
34
|
+
});
|
|
35
|
+
await execFileAsync("git", ["config", "user.name", "agentplane-test"], {
|
|
36
|
+
cwd: root,
|
|
37
|
+
env: cleanGitEnv(),
|
|
38
|
+
});
|
|
39
|
+
return root;
|
|
40
|
+
})();
|
|
41
|
+
gitTemplateRoot = await gitTemplatePromise;
|
|
42
|
+
return gitTemplateRoot;
|
|
43
|
+
}
|
|
44
|
+
async function copyDirContents(src, dest) {
|
|
45
|
+
const entries = await readdir(src, { withFileTypes: true });
|
|
46
|
+
await Promise.all(entries.map((entry) => cp(path.join(src, entry.name), path.join(dest, entry.name), { recursive: true })));
|
|
47
|
+
}
|
|
48
|
+
export function registerAgentplaneHome() {
|
|
49
|
+
beforeAll(async () => {
|
|
50
|
+
agentplaneHome = await mkdtemp(path.join(os.tmpdir(), "agentplane-home-"));
|
|
51
|
+
process.env.AGENTPLANE_HOME = agentplaneHome;
|
|
52
|
+
process.env.AGENTPLANE_NO_UPDATE_CHECK = "1";
|
|
53
|
+
process.env.AGENTPLANE_HOOK_RUNNER ??= path.join(process.cwd(), "packages", "agentplane", "bin", "agentplane.js");
|
|
54
|
+
// Keep tests hermetic: never rely on global git config for commit authorship.
|
|
55
|
+
process.env.GIT_AUTHOR_NAME ??= "agentplane-test";
|
|
56
|
+
process.env.GIT_AUTHOR_EMAIL ??= "agentplane-test@example.com";
|
|
57
|
+
process.env.GIT_COMMITTER_NAME ??= "agentplane-test";
|
|
58
|
+
process.env.GIT_COMMITTER_EMAIL ??= "agentplane-test@example.com";
|
|
59
|
+
});
|
|
60
|
+
afterAll(async () => {
|
|
61
|
+
if (agentplaneHome) {
|
|
62
|
+
await rm(agentplaneHome, { recursive: true, force: true });
|
|
63
|
+
}
|
|
64
|
+
if (originalAgentplaneHome === undefined) {
|
|
65
|
+
delete process.env.AGENTPLANE_HOME;
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
process.env.AGENTPLANE_HOME = originalAgentplaneHome;
|
|
69
|
+
}
|
|
70
|
+
if (originalNoUpdateCheck === undefined) {
|
|
71
|
+
delete process.env.AGENTPLANE_NO_UPDATE_CHECK;
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
process.env.AGENTPLANE_NO_UPDATE_CHECK = originalNoUpdateCheck;
|
|
75
|
+
}
|
|
76
|
+
if (originalGitAuthorName === undefined)
|
|
77
|
+
delete process.env.GIT_AUTHOR_NAME;
|
|
78
|
+
else
|
|
79
|
+
process.env.GIT_AUTHOR_NAME = originalGitAuthorName;
|
|
80
|
+
if (originalGitAuthorEmail === undefined)
|
|
81
|
+
delete process.env.GIT_AUTHOR_EMAIL;
|
|
82
|
+
else
|
|
83
|
+
process.env.GIT_AUTHOR_EMAIL = originalGitAuthorEmail;
|
|
84
|
+
if (originalGitCommitterName === undefined)
|
|
85
|
+
delete process.env.GIT_COMMITTER_NAME;
|
|
86
|
+
else
|
|
87
|
+
process.env.GIT_COMMITTER_NAME = originalGitCommitterName;
|
|
88
|
+
if (originalGitCommitterEmail === undefined)
|
|
89
|
+
delete process.env.GIT_COMMITTER_EMAIL;
|
|
90
|
+
else
|
|
91
|
+
process.env.GIT_COMMITTER_EMAIL = originalGitCommitterEmail;
|
|
92
|
+
if (originalHookRunner === undefined)
|
|
93
|
+
delete process.env.AGENTPLANE_HOOK_RUNNER;
|
|
94
|
+
else
|
|
95
|
+
process.env.AGENTPLANE_HOOK_RUNNER = originalHookRunner;
|
|
96
|
+
});
|
|
97
|
+
afterEach(async () => {
|
|
98
|
+
const roots = [...testRoots];
|
|
99
|
+
testRoots.clear();
|
|
100
|
+
await Promise.all(roots.map(async (root) => {
|
|
101
|
+
await rm(path.join(root, ".agentplane", ".upgrade"), { recursive: true, force: true });
|
|
102
|
+
await rm(path.join(root, ".agentplane", ".release"), { recursive: true, force: true });
|
|
103
|
+
}));
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
export function installRunCliIntegrationHarness() {
|
|
107
|
+
registerAgentplaneHome();
|
|
108
|
+
let restoreStdIO = null;
|
|
109
|
+
beforeEach(() => {
|
|
110
|
+
restoreStdIO = silenceStdIO();
|
|
111
|
+
});
|
|
112
|
+
afterEach(() => {
|
|
113
|
+
restoreStdIO?.();
|
|
114
|
+
restoreStdIO = null;
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
export function getAgentplaneHome() {
|
|
118
|
+
return agentplaneHome;
|
|
119
|
+
}
|
|
120
|
+
export function stubTaskBackend(overrides = {}) {
|
|
121
|
+
return {
|
|
122
|
+
id: "local",
|
|
123
|
+
capabilities: {
|
|
124
|
+
canonical_source: "local",
|
|
125
|
+
projection: "canonical",
|
|
126
|
+
projection_read_mode: "fallback",
|
|
127
|
+
reads_from_projection_by_default: false,
|
|
128
|
+
writes_task_readmes: true,
|
|
129
|
+
supports_task_revisions: true,
|
|
130
|
+
supports_revision_guarded_writes: true,
|
|
131
|
+
may_access_network_on_read: false,
|
|
132
|
+
may_access_network_on_write: false,
|
|
133
|
+
supports_projection_refresh: false,
|
|
134
|
+
supports_push_sync: false,
|
|
135
|
+
supports_snapshot_export: false,
|
|
136
|
+
},
|
|
137
|
+
listTasks: vi.fn().mockResolvedValue([]),
|
|
138
|
+
getTask: vi.fn().mockResolvedValue(null),
|
|
139
|
+
writeTask: vi.fn().mockImplementation(() => Promise.resolve()),
|
|
140
|
+
...overrides,
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
export async function mkGitRepoRoot() {
|
|
144
|
+
const template = await ensureGitTemplateRoot();
|
|
145
|
+
const root = await mkdtemp(path.join(os.tmpdir(), "agentplane-cli-test-"));
|
|
146
|
+
await copyDirContents(template, root);
|
|
147
|
+
testRoots.add(root);
|
|
148
|
+
return root;
|
|
149
|
+
}
|
|
150
|
+
export async function mkTempDir() {
|
|
151
|
+
const root = await mkdtemp(path.join(os.tmpdir(), "agentplane-cli-test-"));
|
|
152
|
+
testRoots.add(root);
|
|
153
|
+
return root;
|
|
154
|
+
}
|
|
155
|
+
export async function writeDefaultConfig(root) {
|
|
156
|
+
const agentplaneDir = path.join(root, ".agentplane");
|
|
157
|
+
await mkdir(agentplaneDir, { recursive: true });
|
|
158
|
+
const configPath = path.join(agentplaneDir, "config.json");
|
|
159
|
+
await writeFile(configPath, JSON.stringify(defaultConfig(), null, 2), "utf8");
|
|
160
|
+
}
|
|
161
|
+
export async function writeAndConfigureRoot() {
|
|
162
|
+
const root = await mkGitRepoRoot();
|
|
163
|
+
await writeDefaultConfig(root);
|
|
164
|
+
return root;
|
|
165
|
+
}
|
|
166
|
+
export async function approveTaskPlan(root, taskId) {
|
|
167
|
+
await runCliSilent([
|
|
168
|
+
"task",
|
|
169
|
+
"plan",
|
|
170
|
+
"set",
|
|
171
|
+
taskId,
|
|
172
|
+
"--text",
|
|
173
|
+
"1) Do the work\n2) Verify the work",
|
|
174
|
+
"--updated-by",
|
|
175
|
+
"ORCHESTRATOR",
|
|
176
|
+
"--root",
|
|
177
|
+
root,
|
|
178
|
+
]);
|
|
179
|
+
await runCliSilent([
|
|
180
|
+
"task",
|
|
181
|
+
"plan",
|
|
182
|
+
"approve",
|
|
183
|
+
taskId,
|
|
184
|
+
"--by",
|
|
185
|
+
"USER",
|
|
186
|
+
"--note",
|
|
187
|
+
"OK",
|
|
188
|
+
"--root",
|
|
189
|
+
root,
|
|
190
|
+
]);
|
|
191
|
+
}
|
|
192
|
+
export async function recordVerificationOk(root, taskId) {
|
|
193
|
+
await runCliSilent([
|
|
194
|
+
"task",
|
|
195
|
+
"doc",
|
|
196
|
+
"set",
|
|
197
|
+
taskId,
|
|
198
|
+
"--section",
|
|
199
|
+
"Verify Steps",
|
|
200
|
+
"--text",
|
|
201
|
+
"Run verify for this task. Expected: verification records successfully.",
|
|
202
|
+
"--root",
|
|
203
|
+
root,
|
|
204
|
+
]);
|
|
205
|
+
await runCliSilent([
|
|
206
|
+
"verify",
|
|
207
|
+
taskId,
|
|
208
|
+
"--ok",
|
|
209
|
+
"--by",
|
|
210
|
+
"REVIEWER",
|
|
211
|
+
"--note",
|
|
212
|
+
"Ok to integrate",
|
|
213
|
+
"--quiet",
|
|
214
|
+
"--root",
|
|
215
|
+
root,
|
|
216
|
+
]);
|
|
217
|
+
}
|
|
218
|
+
export async function writeConfig(root, config) {
|
|
219
|
+
const agentplaneDir = path.join(root, ".agentplane");
|
|
220
|
+
await mkdir(agentplaneDir, { recursive: true });
|
|
221
|
+
const configPath = path.join(agentplaneDir, "config.json");
|
|
222
|
+
await writeFile(configPath, JSON.stringify(config, null, 2), "utf8");
|
|
223
|
+
}
|
|
224
|
+
export async function resetAgentplaneHomeRecipes() {
|
|
225
|
+
if (!agentplaneHome)
|
|
226
|
+
return;
|
|
227
|
+
await rm(path.join(agentplaneHome, "recipes-store"), { recursive: true, force: true });
|
|
228
|
+
await rm(path.join(agentplaneHome, "recipes.json"), { force: true });
|
|
229
|
+
await rm(path.join(agentplaneHome, "recipes-index.json"), { force: true });
|
|
230
|
+
}
|
|
231
|
+
export async function mkGitRepoRootWithBranch(branch) {
|
|
232
|
+
const root = await mkGitRepoRoot();
|
|
233
|
+
await execFileAsync("git", ["checkout", "-b", branch], { cwd: root, env: cleanGitEnv() });
|
|
234
|
+
return root;
|
|
235
|
+
}
|
|
236
|
+
export async function configureGitUser(root) {
|
|
237
|
+
await execFileAsync("git", ["config", "user.email", "test@example.com"], {
|
|
238
|
+
cwd: root,
|
|
239
|
+
env: cleanGitEnv(),
|
|
240
|
+
});
|
|
241
|
+
await execFileAsync("git", ["config", "user.name", "Test User"], {
|
|
242
|
+
cwd: root,
|
|
243
|
+
env: cleanGitEnv(),
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
export function cleanGitEnv() {
|
|
247
|
+
const env = { ...process.env };
|
|
248
|
+
delete env.GIT_DIR;
|
|
249
|
+
delete env.GIT_WORK_TREE;
|
|
250
|
+
delete env.GIT_COMMON_DIR;
|
|
251
|
+
delete env.GIT_INDEX_FILE;
|
|
252
|
+
delete env.GIT_OBJECT_DIRECTORY;
|
|
253
|
+
delete env.GIT_ALTERNATE_OBJECT_DIRECTORIES;
|
|
254
|
+
env.GIT_CONFIG_GLOBAL = "/dev/null";
|
|
255
|
+
env.GIT_CONFIG_SYSTEM = "/dev/null";
|
|
256
|
+
env.GIT_TERMINAL_PROMPT = "0";
|
|
257
|
+
env.GIT_AUTHOR_NAME = env.GIT_AUTHOR_NAME ?? "Agentplane Test";
|
|
258
|
+
env.GIT_AUTHOR_EMAIL = env.GIT_AUTHOR_EMAIL ?? "agentplane-test@example.com";
|
|
259
|
+
env.GIT_COMMITTER_NAME = env.GIT_COMMITTER_NAME ?? "Agentplane Test";
|
|
260
|
+
env.GIT_COMMITTER_EMAIL = env.GIT_COMMITTER_EMAIL ?? "agentplane-test@example.com";
|
|
261
|
+
return env;
|
|
262
|
+
}
|
|
263
|
+
export async function pathExists(filePath) {
|
|
264
|
+
try {
|
|
265
|
+
await access(filePath);
|
|
266
|
+
return true;
|
|
267
|
+
}
|
|
268
|
+
catch {
|
|
269
|
+
return false;
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
export async function gitBranchExists(root, branch) {
|
|
273
|
+
try {
|
|
274
|
+
await execFileAsync("git", ["show-ref", "--verify", "--quiet", `refs/heads/${branch}`], {
|
|
275
|
+
cwd: root,
|
|
276
|
+
env: cleanGitEnv(),
|
|
277
|
+
});
|
|
278
|
+
return true;
|
|
279
|
+
}
|
|
280
|
+
catch (err) {
|
|
281
|
+
const code = err?.code;
|
|
282
|
+
if (code === 1)
|
|
283
|
+
return false;
|
|
284
|
+
throw err;
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
export async function commitAll(root, message) {
|
|
288
|
+
await execFileAsync("git", ["add", "."], { cwd: root, env: cleanGitEnv() });
|
|
289
|
+
await execFileAsync("git", ["commit", "--no-verify", "-m", message], {
|
|
290
|
+
cwd: root,
|
|
291
|
+
env: cleanGitEnv(),
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
export async function commitPathsIfChanged(root, paths, message) {
|
|
295
|
+
await execFileAsync("git", ["add", "--", ...paths], { cwd: root, env: cleanGitEnv() });
|
|
296
|
+
const { stdout } = await execFileAsync("git", ["diff", "--cached", "--name-only", "--", ...paths], {
|
|
297
|
+
cwd: root,
|
|
298
|
+
env: cleanGitEnv(),
|
|
299
|
+
});
|
|
300
|
+
if (!stdout.trim())
|
|
301
|
+
return false;
|
|
302
|
+
await execFileAsync("git", ["commit", "--no-verify", "-m", message], {
|
|
303
|
+
cwd: root,
|
|
304
|
+
env: cleanGitEnv(),
|
|
305
|
+
});
|
|
306
|
+
return true;
|
|
307
|
+
}
|
|
308
|
+
export async function stageGitignoreIfPresent(root) {
|
|
309
|
+
const gitignorePath = path.join(root, ".gitignore");
|
|
310
|
+
if (!(await pathExists(gitignorePath)))
|
|
311
|
+
return;
|
|
312
|
+
await execFileAsync("git", ["add", ".gitignore"], { cwd: root, env: cleanGitEnv() });
|
|
313
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./cli-harness.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agentplane",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.14",
|
|
4
4
|
"description": "Agent Plane CLI for task workflows, recipes, and project automation.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agentplane",
|
|
@@ -35,6 +35,9 @@
|
|
|
35
35
|
"bin": {
|
|
36
36
|
"agentplane": "bin/agentplane.js"
|
|
37
37
|
},
|
|
38
|
+
"exports": {
|
|
39
|
+
"./internal/testing": "./dist/testing/index.js"
|
|
40
|
+
},
|
|
38
41
|
"files": [
|
|
39
42
|
"bin",
|
|
40
43
|
"dist",
|
|
@@ -48,14 +51,15 @@
|
|
|
48
51
|
},
|
|
49
52
|
"scripts": {
|
|
50
53
|
"clean": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true}); require('node:fs').rmSync('tsconfig.tsbuildinfo',{force:true});\"",
|
|
51
|
-
"build": "tsc -b && node ../../scripts/
|
|
54
|
+
"build": "tsc -b && node ../../scripts/manifest.mjs build .",
|
|
52
55
|
"typecheck": "tsc -b",
|
|
53
56
|
"prepare": "npm run build",
|
|
54
57
|
"prepack": "npm run clean && npm run build",
|
|
55
58
|
"prepublishOnly": "node ../../scripts/enforce-github-publish.mjs && npm run prepack"
|
|
56
59
|
},
|
|
57
60
|
"dependencies": {
|
|
58
|
-
"@agentplaneorg/core": "0.3.
|
|
61
|
+
"@agentplaneorg/core": "0.3.14",
|
|
62
|
+
"@agentplaneorg/recipes": "0.3.14",
|
|
59
63
|
"yauzl": "^2.10.0"
|
|
60
64
|
},
|
|
61
65
|
"devDependencies": {
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export type BundledRecipeInfo = {
|
|
2
|
-
id: string;
|
|
3
|
-
summary: string;
|
|
4
|
-
version: string;
|
|
5
|
-
};
|
|
6
|
-
export declare function listBundledRecipes(): BundledRecipeInfo[];
|
|
7
|
-
export declare function renderBundledRecipesHint(): string;
|
|
8
|
-
export declare function validateBundledRecipesSelection(recipes: string[]): void;
|
|
9
|
-
export declare function getBundledRecipeSourcePath(recipeId: string): string | null;
|
|
10
|
-
//# sourceMappingURL=recipes-bundled.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"recipes-bundled.d.ts","sourceRoot":"","sources":["../../src/cli/recipes-bundled.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,iBAAiB,GAAG;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAEjF,wBAAgB,kBAAkB,IAAI,iBAAiB,EAAE,CAMxD;AAED,wBAAgB,wBAAwB,IAAI,MAAM,CAMjD;AAED,wBAAgB,+BAA+B,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,CAevE;AAED,wBAAgB,0BAA0B,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAE1E"}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { BUNDLED_RECIPES_CATALOG, resolveBundledRecipeSourcePath, } from "../recipes/bundled-recipes.js";
|
|
2
|
-
import { CliError } from "../shared/errors.js";
|
|
3
|
-
export function listBundledRecipes() {
|
|
4
|
-
return BUNDLED_RECIPES_CATALOG.recipes.map((recipe) => ({
|
|
5
|
-
id: recipe.id,
|
|
6
|
-
summary: recipe.summary,
|
|
7
|
-
version: recipe.versions.at(-1)?.version ?? "unknown",
|
|
8
|
-
}));
|
|
9
|
-
}
|
|
10
|
-
export function renderBundledRecipesHint() {
|
|
11
|
-
const entries = listBundledRecipes();
|
|
12
|
-
if (entries.length === 0) {
|
|
13
|
-
return "Bundled recipes: none";
|
|
14
|
-
}
|
|
15
|
-
return `Bundled recipes: ${entries.map((entry) => entry.id).join(", ")}`;
|
|
16
|
-
}
|
|
17
|
-
export function validateBundledRecipesSelection(recipes) {
|
|
18
|
-
if (recipes.length === 0)
|
|
19
|
-
return;
|
|
20
|
-
const available = listBundledRecipes().map((entry) => entry.id);
|
|
21
|
-
if (available.length === 0) {
|
|
22
|
-
process.stdout.write(`${renderBundledRecipesHint()}\n`);
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
const missing = recipes.filter((recipe) => !available.includes(recipe));
|
|
26
|
-
if (missing.length > 0) {
|
|
27
|
-
throw new CliError({
|
|
28
|
-
exitCode: 2,
|
|
29
|
-
code: "E_USAGE",
|
|
30
|
-
message: `Unknown recipe id(s): ${missing.join(", ")}. ${renderBundledRecipesHint()}`,
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
export function getBundledRecipeSourcePath(recipeId) {
|
|
35
|
-
return resolveBundledRecipeSourcePath(recipeId);
|
|
36
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../../../src/commands/recipes/impl/manifest.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAGV,cAAc,EAKf,MAAM,YAAY,CAAC;AA0OpB,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,OAAO,GAAG,cAAc,CAsDnE;AAED,wBAAsB,kBAAkB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CAGtF"}
|
|
@@ -1,229 +0,0 @@
|
|
|
1
|
-
import { readFile } from "node:fs/promises";
|
|
2
|
-
import { invalidFieldMessage, requiredFieldMessage } from "../../../cli/output.js";
|
|
3
|
-
import { isRecord } from "../../../shared/guards.js";
|
|
4
|
-
import { dedupeStrings } from "../../../shared/strings.js";
|
|
5
|
-
import { normalizeAgentId, normalizeRecipeId, normalizeRecipeRelativePath, normalizeRecipeTags, normalizeScenarioId, normalizeSkillId, normalizeToolId, } from "./normalize.js";
|
|
6
|
-
function normalizeRequiredString(raw, field) {
|
|
7
|
-
if (typeof raw !== "string")
|
|
8
|
-
throw new Error(invalidFieldMessage(field, "string"));
|
|
9
|
-
const value = raw.trim();
|
|
10
|
-
if (!value)
|
|
11
|
-
throw new Error(requiredFieldMessage(field));
|
|
12
|
-
return value;
|
|
13
|
-
}
|
|
14
|
-
function normalizeOptionalString(raw, field) {
|
|
15
|
-
if (raw === undefined)
|
|
16
|
-
return undefined;
|
|
17
|
-
if (typeof raw !== "string")
|
|
18
|
-
throw new Error(invalidFieldMessage(field, "string"));
|
|
19
|
-
const value = raw.trim();
|
|
20
|
-
return value || undefined;
|
|
21
|
-
}
|
|
22
|
-
function normalizeStringList(raw, field, opts) {
|
|
23
|
-
if (!Array.isArray(raw))
|
|
24
|
-
throw new Error(invalidFieldMessage(field, "string[]"));
|
|
25
|
-
const values = raw.map((value) => {
|
|
26
|
-
if (typeof value !== "string")
|
|
27
|
-
throw new Error(invalidFieldMessage(field, "string[]"));
|
|
28
|
-
const trimmed = value.trim();
|
|
29
|
-
if (!trimmed)
|
|
30
|
-
throw new Error(invalidFieldMessage(field, "string[]"));
|
|
31
|
-
return trimmed;
|
|
32
|
-
});
|
|
33
|
-
const deduped = dedupeStrings(values);
|
|
34
|
-
if ((opts?.minLength ?? 0) > 0 && deduped.length < (opts?.minLength ?? 0)) {
|
|
35
|
-
throw new Error(invalidFieldMessage(field, `string[${opts?.minLength ?? 0}+]`));
|
|
36
|
-
}
|
|
37
|
-
return deduped;
|
|
38
|
-
}
|
|
39
|
-
function normalizeOptionalStringList(raw, field) {
|
|
40
|
-
if (raw === undefined)
|
|
41
|
-
return undefined;
|
|
42
|
-
return normalizeStringList(raw, field);
|
|
43
|
-
}
|
|
44
|
-
function normalizeNumber(raw, field) {
|
|
45
|
-
if (raw === undefined)
|
|
46
|
-
return undefined;
|
|
47
|
-
if (typeof raw !== "number" || Number.isNaN(raw)) {
|
|
48
|
-
throw new Error(invalidFieldMessage(field, "number"));
|
|
49
|
-
}
|
|
50
|
-
return raw;
|
|
51
|
-
}
|
|
52
|
-
function normalizeCompatibility(raw) {
|
|
53
|
-
if (raw === undefined)
|
|
54
|
-
return undefined;
|
|
55
|
-
if (!isRecord(raw))
|
|
56
|
-
throw new Error(invalidFieldMessage("manifest.compatibility", "object"));
|
|
57
|
-
return {
|
|
58
|
-
min_agentplane_version: normalizeOptionalString(raw.min_agentplane_version, "manifest.compatibility.min_agentplane_version"),
|
|
59
|
-
manifest_api_version: normalizeOptionalString(raw.manifest_api_version, "manifest.compatibility.manifest_api_version"),
|
|
60
|
-
scenario_api_version: normalizeOptionalString(raw.scenario_api_version, "manifest.compatibility.scenario_api_version"),
|
|
61
|
-
runtime_api_version: normalizeOptionalString(raw.runtime_api_version, "manifest.compatibility.runtime_api_version"),
|
|
62
|
-
platforms: normalizeOptionalStringList(raw.platforms, "manifest.compatibility.platforms"),
|
|
63
|
-
repo_types: normalizeOptionalStringList(raw.repo_types, "manifest.compatibility.repo_types"),
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
function normalizeRunProfile(raw, field) {
|
|
67
|
-
if (!isRecord(raw))
|
|
68
|
-
throw new Error(invalidFieldMessage(field, "object"));
|
|
69
|
-
return {
|
|
70
|
-
mode: normalizeRequiredString(raw.mode, `${field}.mode`),
|
|
71
|
-
sandbox: normalizeOptionalString(raw.sandbox, `${field}.sandbox`),
|
|
72
|
-
writes_artifacts_to: normalizeOptionalStringList(raw.writes_artifacts_to, `${field}.writes_artifacts_to`),
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
function normalizeSkills(raw) {
|
|
76
|
-
if (raw === undefined)
|
|
77
|
-
return undefined;
|
|
78
|
-
if (!Array.isArray(raw))
|
|
79
|
-
throw new Error(invalidFieldMessage("manifest.skills", "array"));
|
|
80
|
-
return raw.map((entry, index) => {
|
|
81
|
-
if (!isRecord(entry))
|
|
82
|
-
throw new Error(invalidFieldMessage(`manifest.skills[${index}]`, "object"));
|
|
83
|
-
return {
|
|
84
|
-
id: normalizeSkillId(normalizeRequiredString(entry.id, `manifest.skills[${index}].id`)),
|
|
85
|
-
summary: normalizeRequiredString(entry.summary, `manifest.skills[${index}].summary`),
|
|
86
|
-
kind: normalizeRequiredString(entry.kind, `manifest.skills[${index}].kind`),
|
|
87
|
-
file: normalizeRecipeRelativePath(`manifest.skills[${index}].file`, normalizeRequiredString(entry.file, `manifest.skills[${index}].file`)),
|
|
88
|
-
};
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
function normalizeTools(raw) {
|
|
92
|
-
if (raw === undefined)
|
|
93
|
-
return undefined;
|
|
94
|
-
if (!Array.isArray(raw))
|
|
95
|
-
throw new Error(invalidFieldMessage("manifest.tools", "array"));
|
|
96
|
-
return raw.map((entry, index) => {
|
|
97
|
-
if (!isRecord(entry))
|
|
98
|
-
throw new Error(invalidFieldMessage(`manifest.tools[${index}]`, "object"));
|
|
99
|
-
const runtime = normalizeRequiredString(entry.runtime, `manifest.tools[${index}].runtime`);
|
|
100
|
-
if (runtime !== "node" && runtime !== "bash") {
|
|
101
|
-
throw new Error(invalidFieldMessage(`manifest.tools[${index}].runtime`, '"node" | "bash"'));
|
|
102
|
-
}
|
|
103
|
-
return {
|
|
104
|
-
id: normalizeToolId(normalizeRequiredString(entry.id, `manifest.tools[${index}].id`)),
|
|
105
|
-
summary: normalizeRequiredString(entry.summary, `manifest.tools[${index}].summary`),
|
|
106
|
-
runtime,
|
|
107
|
-
entrypoint: normalizeRecipeRelativePath(`manifest.tools[${index}].entrypoint`, normalizeRequiredString(entry.entrypoint, `manifest.tools[${index}].entrypoint`)),
|
|
108
|
-
permissions: normalizeOptionalStringList(entry.permissions, `manifest.tools[${index}].permissions`),
|
|
109
|
-
timeout_ms: normalizeNumber(entry.timeout_ms, `manifest.tools[${index}].timeout_ms`),
|
|
110
|
-
cwd_policy: normalizeOptionalString(entry.cwd_policy, `manifest.tools[${index}].cwd_policy`),
|
|
111
|
-
};
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
function normalizeAgents(raw) {
|
|
115
|
-
if (raw === undefined)
|
|
116
|
-
return undefined;
|
|
117
|
-
if (!Array.isArray(raw))
|
|
118
|
-
throw new Error(invalidFieldMessage("manifest.agents", "array"));
|
|
119
|
-
return raw.map((entry, index) => {
|
|
120
|
-
if (!isRecord(entry))
|
|
121
|
-
throw new Error(invalidFieldMessage(`manifest.agents[${index}]`, "object"));
|
|
122
|
-
return {
|
|
123
|
-
id: normalizeAgentId(normalizeRequiredString(entry.id, `manifest.agents[${index}].id`)),
|
|
124
|
-
display_name: normalizeRequiredString(entry.display_name, `manifest.agents[${index}].display_name`),
|
|
125
|
-
role: normalizeRequiredString(entry.role, `manifest.agents[${index}].role`),
|
|
126
|
-
summary: normalizeRequiredString(entry.summary, `manifest.agents[${index}].summary`),
|
|
127
|
-
skills: normalizeOptionalStringList(entry.skills, `manifest.agents[${index}].skills`),
|
|
128
|
-
tools: normalizeOptionalStringList(entry.tools, `manifest.agents[${index}].tools`),
|
|
129
|
-
file: normalizeRecipeRelativePath(`manifest.agents[${index}].file`, normalizeRequiredString(entry.file, `manifest.agents[${index}].file`)),
|
|
130
|
-
};
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
function normalizeScenarios(raw) {
|
|
134
|
-
if (!Array.isArray(raw) || raw.length === 0) {
|
|
135
|
-
throw new Error(invalidFieldMessage("manifest.scenarios", "non-empty array"));
|
|
136
|
-
}
|
|
137
|
-
return raw.map((entry, index) => {
|
|
138
|
-
if (!isRecord(entry)) {
|
|
139
|
-
throw new Error(invalidFieldMessage(`manifest.scenarios[${index}]`, "object"));
|
|
140
|
-
}
|
|
141
|
-
return {
|
|
142
|
-
id: normalizeScenarioId(normalizeRequiredString(entry.id, `manifest.scenarios[${index}].id`)),
|
|
143
|
-
name: normalizeRequiredString(entry.name, `manifest.scenarios[${index}].name`),
|
|
144
|
-
summary: normalizeRequiredString(entry.summary, `manifest.scenarios[${index}].summary`),
|
|
145
|
-
description: normalizeOptionalString(entry.description, `manifest.scenarios[${index}].description`),
|
|
146
|
-
use_when: normalizeStringList(entry.use_when, `manifest.scenarios[${index}].use_when`, {
|
|
147
|
-
minLength: 1,
|
|
148
|
-
}),
|
|
149
|
-
avoid_when: normalizeOptionalStringList(entry.avoid_when, `manifest.scenarios[${index}].avoid_when`),
|
|
150
|
-
required_inputs: normalizeStringList(entry.required_inputs, `manifest.scenarios[${index}].required_inputs`),
|
|
151
|
-
outputs: normalizeStringList(entry.outputs, `manifest.scenarios[${index}].outputs`),
|
|
152
|
-
permissions: normalizeStringList(Array.isArray(entry.permissions) ? entry.permissions : [], `manifest.scenarios[${index}].permissions`),
|
|
153
|
-
artifacts: normalizeStringList(Array.isArray(entry.artifacts) ? entry.artifacts : [], `manifest.scenarios[${index}].artifacts`),
|
|
154
|
-
agents_involved: normalizeStringList(entry.agents_involved, `manifest.scenarios[${index}].agents_involved`, { minLength: 1 }),
|
|
155
|
-
skills_used: normalizeStringList(Array.isArray(entry.skills_used) ? entry.skills_used : [], `manifest.scenarios[${index}].skills_used`),
|
|
156
|
-
tools_used: normalizeStringList(Array.isArray(entry.tools_used) ? entry.tools_used : [], `manifest.scenarios[${index}].tools_used`),
|
|
157
|
-
run_profile: normalizeRunProfile(entry.run_profile, `manifest.scenarios[${index}].run_profile`),
|
|
158
|
-
file: normalizeRecipeRelativePath(`manifest.scenarios[${index}].file`, normalizeRequiredString(entry.file, `manifest.scenarios[${index}].file`)),
|
|
159
|
-
};
|
|
160
|
-
});
|
|
161
|
-
}
|
|
162
|
-
function assertUniqueIds(field, items) {
|
|
163
|
-
const seen = new Set();
|
|
164
|
-
for (const item of items) {
|
|
165
|
-
if (seen.has(item.id)) {
|
|
166
|
-
throw new Error(invalidFieldMessage(field, `unique ids (duplicate: ${item.id})`));
|
|
167
|
-
}
|
|
168
|
-
seen.add(item.id);
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
function assertKnownReferences(field, refs, known) {
|
|
172
|
-
if (!refs || refs.length === 0)
|
|
173
|
-
return;
|
|
174
|
-
const missing = refs.filter((ref) => !known.has(ref));
|
|
175
|
-
if (missing.length > 0) {
|
|
176
|
-
throw new Error(invalidFieldMessage(field, `known ids (missing: ${missing.join(", ")})`));
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
export function validateRecipeManifest(raw) {
|
|
180
|
-
if (!isRecord(raw))
|
|
181
|
-
throw new Error(invalidFieldMessage("manifest", "object"));
|
|
182
|
-
if (raw.schema_version !== "1")
|
|
183
|
-
throw new Error(invalidFieldMessage("manifest.schema_version", '"1"'));
|
|
184
|
-
const id = normalizeRecipeId(normalizeRequiredString(raw.id, "manifest.id"));
|
|
185
|
-
const version = normalizeRequiredString(raw.version, "manifest.version");
|
|
186
|
-
const tags = normalizeRecipeTags(raw.tags);
|
|
187
|
-
const compatibility = normalizeCompatibility(raw.compatibility);
|
|
188
|
-
const skills = normalizeSkills(raw.skills);
|
|
189
|
-
const tools = normalizeTools(raw.tools);
|
|
190
|
-
const agents = normalizeAgents(raw.agents);
|
|
191
|
-
const scenarios = normalizeScenarios(raw.scenarios);
|
|
192
|
-
if (skills)
|
|
193
|
-
assertUniqueIds("manifest.skills", skills);
|
|
194
|
-
if (tools)
|
|
195
|
-
assertUniqueIds("manifest.tools", tools);
|
|
196
|
-
if (agents)
|
|
197
|
-
assertUniqueIds("manifest.agents", agents);
|
|
198
|
-
assertUniqueIds("manifest.scenarios", scenarios);
|
|
199
|
-
const skillIds = new Set((skills ?? []).map((skill) => skill.id));
|
|
200
|
-
const toolIds = new Set((tools ?? []).map((tool) => tool.id));
|
|
201
|
-
const agentIds = new Set((agents ?? []).map((agent) => agent.id));
|
|
202
|
-
for (const [index, agent] of (agents ?? []).entries()) {
|
|
203
|
-
assertKnownReferences(`manifest.agents[${index}].skills`, agent.skills, skillIds);
|
|
204
|
-
assertKnownReferences(`manifest.agents[${index}].tools`, agent.tools, toolIds);
|
|
205
|
-
}
|
|
206
|
-
for (const [index, scenario] of scenarios.entries()) {
|
|
207
|
-
assertKnownReferences(`manifest.scenarios[${index}].agents_involved`, scenario.agents_involved, agentIds);
|
|
208
|
-
assertKnownReferences(`manifest.scenarios[${index}].skills_used`, scenario.skills_used, skillIds);
|
|
209
|
-
assertKnownReferences(`manifest.scenarios[${index}].tools_used`, scenario.tools_used, toolIds);
|
|
210
|
-
}
|
|
211
|
-
return {
|
|
212
|
-
schema_version: "1",
|
|
213
|
-
id,
|
|
214
|
-
version,
|
|
215
|
-
name: normalizeRequiredString(raw.name, "manifest.name"),
|
|
216
|
-
summary: normalizeRequiredString(raw.summary, "manifest.summary"),
|
|
217
|
-
description: normalizeRequiredString(raw.description, "manifest.description"),
|
|
218
|
-
tags: tags.length > 0 ? tags : undefined,
|
|
219
|
-
compatibility,
|
|
220
|
-
skills,
|
|
221
|
-
agents,
|
|
222
|
-
tools,
|
|
223
|
-
scenarios,
|
|
224
|
-
};
|
|
225
|
-
}
|
|
226
|
-
export async function readRecipeManifest(manifestPath) {
|
|
227
|
-
const raw = JSON.parse(await readFile(manifestPath, "utf8"));
|
|
228
|
-
return validateRecipeManifest(raw);
|
|
229
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export declare function normalizeRecipeId(value: string): string;
|
|
2
|
-
export declare function normalizeAgentId(value: string): string;
|
|
3
|
-
export declare function normalizeSkillId(value: string): string;
|
|
4
|
-
export declare function normalizeToolId(value: string): string;
|
|
5
|
-
export declare function normalizeScenarioId(value: string): string;
|
|
6
|
-
export declare function normalizeRecipeTags(value: unknown): string[];
|
|
7
|
-
export declare function normalizeRecipeRelativePath(field: string, value: string): string;
|
|
8
|
-
//# sourceMappingURL=normalize.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"normalize.d.ts","sourceRoot":"","sources":["../../../../src/commands/recipes/impl/normalize.ts"],"names":[],"mappings":"AAmBA,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEvD;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEtD;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEtD;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAErD;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEzD;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,EAAE,CAQ5D;AAED,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAWhF"}
|