agentplane 0.1.8 → 0.2.0
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/README.md +4 -4
- package/assets/AGENTS.md +294 -72
- package/assets/agents/CODER.json +1 -0
- package/assets/agents/INTEGRATOR.json +1 -0
- package/assets/agents/ORCHESTRATOR.json +1 -0
- package/assets/agents/PLANNER.json +1 -0
- package/assets/agents/TESTER.json +1 -0
- package/dist/backends/task-backend/load.d.ts +13 -0
- package/dist/backends/task-backend/load.d.ts.map +1 -0
- package/dist/backends/task-backend/load.js +58 -0
- package/dist/backends/task-backend/local-backend.d.ts +28 -0
- package/dist/backends/task-backend/local-backend.d.ts.map +1 -0
- package/dist/backends/task-backend/local-backend.js +335 -0
- package/dist/backends/task-backend/redmine/client.d.ts +8 -0
- package/dist/backends/task-backend/redmine/client.d.ts.map +1 -0
- package/dist/backends/task-backend/redmine/client.js +60 -0
- package/dist/backends/task-backend/redmine/comments.d.ts +12 -0
- package/dist/backends/task-backend/redmine/comments.d.ts.map +1 -0
- package/dist/backends/task-backend/redmine/comments.js +54 -0
- package/dist/backends/task-backend/redmine/fields.d.ts +9 -0
- package/dist/backends/task-backend/redmine/fields.d.ts.map +1 -0
- package/dist/backends/task-backend/redmine/fields.js +38 -0
- package/dist/backends/task-backend/redmine/mapping.d.ts +20 -0
- package/dist/backends/task-backend/redmine/mapping.d.ts.map +1 -0
- package/dist/backends/task-backend/redmine/mapping.js +114 -0
- package/dist/backends/task-backend/redmine/parse.d.ts +3 -0
- package/dist/backends/task-backend/redmine/parse.d.ts.map +1 -0
- package/dist/backends/task-backend/redmine/parse.js +27 -0
- package/dist/backends/task-backend/redmine/remote.d.ts +19 -0
- package/dist/backends/task-backend/redmine/remote.d.ts.map +1 -0
- package/dist/backends/task-backend/redmine/remote.js +82 -0
- package/dist/backends/task-backend/redmine-backend.d.ts +80 -0
- package/dist/backends/task-backend/redmine-backend.d.ts.map +1 -0
- package/dist/backends/task-backend/redmine-backend.js +505 -0
- package/dist/backends/task-backend/shared/concurrency.d.ts +3 -0
- package/dist/backends/task-backend/shared/concurrency.d.ts.map +1 -0
- package/dist/backends/task-backend/shared/concurrency.js +21 -0
- package/dist/backends/task-backend/shared/constants.d.ts +4 -0
- package/dist/backends/task-backend/shared/constants.d.ts.map +1 -0
- package/dist/backends/task-backend/shared/constants.js +4 -0
- package/dist/backends/task-backend/shared/doc.d.ts +11 -0
- package/dist/backends/task-backend/shared/doc.d.ts.map +1 -0
- package/dist/backends/task-backend/shared/doc.js +78 -0
- package/dist/backends/task-backend/shared/errors.d.ts +10 -0
- package/dist/backends/task-backend/shared/errors.d.ts.map +1 -0
- package/dist/backends/task-backend/shared/errors.js +18 -0
- package/dist/backends/task-backend/shared/events.d.ts +3 -0
- package/dist/backends/task-backend/shared/events.d.ts.map +1 -0
- package/dist/backends/task-backend/shared/events.js +29 -0
- package/dist/backends/task-backend/shared/export.d.ts +15 -0
- package/dist/backends/task-backend/shared/export.d.ts.map +1 -0
- package/dist/backends/task-backend/shared/export.js +60 -0
- package/dist/backends/task-backend/shared/id.d.ts +13 -0
- package/dist/backends/task-backend/shared/id.d.ts.map +1 -0
- package/dist/backends/task-backend/shared/id.js +17 -0
- package/dist/backends/task-backend/shared/normalize.d.ts +8 -0
- package/dist/backends/task-backend/shared/normalize.d.ts.map +1 -0
- package/dist/backends/task-backend/shared/normalize.js +54 -0
- package/dist/backends/task-backend/shared/record.d.ts +4 -0
- package/dist/backends/task-backend/shared/record.d.ts.map +1 -0
- package/dist/backends/task-backend/shared/record.js +53 -0
- package/dist/backends/task-backend/shared/strings.d.ts +4 -0
- package/dist/backends/task-backend/shared/strings.d.ts.map +1 -0
- package/dist/backends/task-backend/shared/strings.js +21 -0
- package/dist/backends/task-backend/shared/types.d.ts +84 -0
- package/dist/backends/task-backend/shared/types.d.ts.map +1 -0
- package/dist/backends/task-backend/shared/types.js +1 -0
- package/dist/backends/task-backend/shared.d.ts +11 -0
- package/dist/backends/task-backend/shared.d.ts.map +1 -0
- package/dist/backends/task-backend/shared.js +9 -0
- package/dist/backends/task-backend.d.ts +4 -192
- package/dist/backends/task-backend.d.ts.map +1 -1
- package/dist/backends/task-backend.js +4 -1329
- package/dist/backends/task-index.js +2 -2
- package/dist/cli/archive.d.ts +0 -2
- package/dist/cli/archive.d.ts.map +1 -1
- package/dist/cli/archive.js +1 -2
- package/dist/cli/command-guide.d.ts.map +1 -1
- package/dist/cli/command-guide.js +28 -12
- package/dist/cli/parse/lifecycle.d.ts +64 -0
- package/dist/cli/parse/lifecycle.d.ts.map +1 -0
- package/dist/cli/parse/lifecycle.js +280 -0
- package/dist/cli/run-cli/command-catalog.d.ts +16 -0
- package/dist/cli/run-cli/command-catalog.d.ts.map +1 -0
- package/dist/cli/run-cli/command-catalog.js +204 -0
- package/dist/cli/run-cli/commands/config.d.ts +20 -0
- package/dist/cli/run-cli/commands/config.d.ts.map +1 -0
- package/dist/cli/run-cli/commands/config.js +130 -0
- package/dist/cli/run-cli/commands/core.d.ts +14 -0
- package/dist/cli/run-cli/commands/core.d.ts.map +1 -0
- package/dist/cli/run-cli/commands/core.js +144 -0
- package/dist/cli/run-cli/commands/ide.d.ts +13 -0
- package/dist/cli/run-cli/commands/ide.d.ts.map +1 -0
- package/dist/cli/run-cli/commands/ide.js +67 -0
- package/dist/cli/run-cli/commands/init/base-branch.d.ts +9 -0
- package/dist/cli/run-cli/commands/init/base-branch.d.ts.map +1 -0
- package/dist/cli/run-cli/commands/init/base-branch.js +11 -0
- package/dist/cli/run-cli/commands/init/conflicts.d.ts +11 -0
- package/dist/cli/run-cli/commands/init/conflicts.d.ts.map +1 -0
- package/dist/cli/run-cli/commands/init/conflicts.js +42 -0
- package/dist/cli/run-cli/commands/init/git.d.ts +8 -0
- package/dist/cli/run-cli/commands/init/git.d.ts.map +1 -0
- package/dist/cli/run-cli/commands/init/git.js +12 -0
- package/dist/cli/run-cli/commands/init/ide-sync.d.ts +9 -0
- package/dist/cli/run-cli/commands/init/ide-sync.d.ts.map +1 -0
- package/dist/cli/run-cli/commands/init/ide-sync.js +18 -0
- package/dist/cli/run-cli/commands/init/recipes.d.ts +2 -0
- package/dist/cli/run-cli/commands/init/recipes.d.ts.map +1 -0
- package/dist/cli/run-cli/commands/init/recipes.js +11 -0
- package/dist/cli/run-cli/commands/init/write-agents.d.ts +11 -0
- package/dist/cli/run-cli/commands/init/write-agents.d.ts.map +1 -0
- package/dist/cli/run-cli/commands/init/write-agents.js +30 -0
- package/dist/cli/run-cli/commands/init/write-config.d.ts +15 -0
- package/dist/cli/run-cli/commands/init/write-config.d.ts.map +1 -0
- package/dist/cli/run-cli/commands/init/write-config.js +45 -0
- package/dist/cli/run-cli/commands/init.d.ts +21 -0
- package/dist/cli/run-cli/commands/init.d.ts.map +1 -0
- package/dist/cli/run-cli/commands/init.js +332 -0
- package/dist/cli/run-cli/registry.run.d.ts +4 -0
- package/dist/cli/run-cli/registry.run.d.ts.map +1 -0
- package/dist/cli/run-cli/registry.run.js +19 -0
- package/dist/cli/run-cli.d.ts.map +1 -1
- package/dist/cli/run-cli.js +182 -2408
- package/dist/cli/spec/docs-render.d.ts +3 -0
- package/dist/cli/spec/docs-render.d.ts.map +1 -0
- package/dist/cli/spec/docs-render.js +118 -0
- package/dist/cli/spec/errors.d.ts +9 -0
- package/dist/cli/spec/errors.d.ts.map +1 -0
- package/dist/cli/spec/errors.js +18 -0
- package/dist/cli/spec/help-render.d.ts +43 -0
- package/dist/cli/spec/help-render.d.ts.map +1 -0
- package/dist/cli/spec/help-render.js +185 -0
- package/dist/cli/spec/help.d.ts +10 -0
- package/dist/cli/spec/help.d.ts.map +1 -0
- package/dist/cli/spec/help.js +64 -0
- package/dist/cli/spec/parse.d.ts +8 -0
- package/dist/cli/spec/parse.d.ts.map +1 -0
- package/dist/cli/spec/parse.js +188 -0
- package/dist/cli/spec/registry.d.ts +12 -0
- package/dist/cli/spec/registry.d.ts.map +1 -0
- package/dist/cli/spec/registry.js +47 -0
- package/dist/cli/spec/spec.d.ts +76 -0
- package/dist/cli/spec/spec.d.ts.map +1 -0
- package/dist/cli/spec/spec.js +1 -0
- package/dist/cli/spec/suggest.d.ts +2 -0
- package/dist/cli/spec/suggest.d.ts.map +1 -0
- package/dist/cli/spec/suggest.js +45 -0
- package/dist/commands/backend/sync.command.d.ts +12 -0
- package/dist/commands/backend/sync.command.d.ts.map +1 -0
- package/dist/commands/backend/sync.command.js +79 -0
- package/dist/commands/backend.d.ts +21 -8
- package/dist/commands/backend.d.ts.map +1 -1
- package/dist/commands/backend.js +28 -165
- package/dist/commands/block.command.d.ts +19 -0
- package/dist/commands/block.command.d.ts.map +1 -0
- package/dist/commands/block.command.js +143 -0
- package/dist/commands/branch/base.command.d.ts +20 -0
- package/dist/commands/branch/base.command.d.ts.map +1 -0
- package/dist/commands/branch/base.command.js +110 -0
- package/dist/commands/branch/base.d.ts +19 -0
- package/dist/commands/branch/base.d.ts.map +1 -0
- package/dist/commands/branch/base.js +114 -0
- package/dist/commands/branch/cleanup-merged.d.ts +11 -0
- package/dist/commands/branch/cleanup-merged.d.ts.map +1 -0
- package/dist/commands/branch/cleanup-merged.js +141 -0
- package/dist/commands/branch/index.d.ts +6 -59
- package/dist/commands/branch/index.d.ts.map +1 -1
- package/dist/commands/branch/index.js +6 -513
- package/dist/commands/branch/internal/archive-pr.d.ts +2 -0
- package/dist/commands/branch/internal/archive-pr.d.ts.map +1 -0
- package/dist/commands/branch/internal/archive-pr.js +17 -0
- package/dist/commands/branch/internal/work-validate.d.ts +3 -0
- package/dist/commands/branch/internal/work-validate.d.ts.map +1 -0
- package/dist/commands/branch/internal/work-validate.js +27 -0
- package/dist/commands/branch/remove.command.d.ts +10 -0
- package/dist/commands/branch/remove.command.d.ts.map +1 -0
- package/dist/commands/branch/remove.command.js +63 -0
- package/dist/commands/branch/remove.d.ts +9 -0
- package/dist/commands/branch/remove.d.ts.map +1 -0
- package/dist/commands/branch/remove.js +65 -0
- package/dist/commands/branch/status.command.d.ts +8 -0
- package/dist/commands/branch/status.command.d.ts.map +1 -0
- package/dist/commands/branch/status.command.js +36 -0
- package/dist/commands/branch/status.d.ts +7 -0
- package/dist/commands/branch/status.d.ts.map +1 -0
- package/dist/commands/branch/status.js +60 -0
- package/dist/commands/branch/work-start.command.d.ts +11 -0
- package/dist/commands/branch/work-start.command.d.ts.map +1 -0
- package/dist/commands/branch/work-start.command.js +80 -0
- package/dist/commands/branch/work-start.d.ts +11 -0
- package/dist/commands/branch/work-start.d.ts.map +1 -0
- package/dist/commands/branch/work-start.js +120 -0
- package/dist/commands/cleanup/merged.command.d.ts +17 -0
- package/dist/commands/cleanup/merged.command.d.ts.map +1 -0
- package/dist/commands/cleanup/merged.command.js +75 -0
- package/dist/commands/commit.command.d.ts +6 -0
- package/dist/commands/commit.command.d.ts.map +1 -0
- package/dist/commands/commit.command.js +24 -0
- package/dist/commands/commit.spec.d.ts +18 -0
- package/dist/commands/commit.spec.d.ts.map +1 -0
- package/dist/commands/commit.spec.js +119 -0
- package/dist/commands/docs/cli.command.d.ts +9 -0
- package/dist/commands/docs/cli.command.d.ts.map +1 -0
- package/dist/commands/docs/cli.command.js +51 -0
- package/dist/commands/finish.command.d.ts +28 -0
- package/dist/commands/finish.command.d.ts.map +1 -0
- package/dist/commands/finish.command.js +237 -0
- package/dist/commands/guard/clean.command.d.ts +7 -0
- package/dist/commands/guard/clean.command.d.ts.map +1 -0
- package/dist/commands/guard/clean.command.js +14 -0
- package/dist/commands/guard/commit.command.d.ts +19 -0
- package/dist/commands/guard/commit.command.d.ts.map +1 -0
- package/dist/commands/guard/commit.command.js +132 -0
- package/dist/commands/guard/guard.command.d.ts +5 -0
- package/dist/commands/guard/guard.command.d.ts.map +1 -0
- package/dist/commands/guard/guard.command.js +21 -0
- package/dist/commands/guard/impl/allow.d.ts +18 -0
- package/dist/commands/guard/impl/allow.d.ts.map +1 -0
- package/dist/commands/guard/impl/allow.js +77 -0
- package/dist/commands/guard/impl/close-message.d.ts +16 -0
- package/dist/commands/guard/impl/close-message.d.ts.map +1 -0
- package/dist/commands/guard/impl/close-message.js +156 -0
- package/dist/commands/guard/impl/commands.d.ts +32 -0
- package/dist/commands/guard/impl/commands.d.ts.map +1 -0
- package/dist/commands/guard/impl/commands.js +191 -0
- package/dist/commands/guard/impl/comment-commit.d.ts +25 -0
- package/dist/commands/guard/impl/comment-commit.d.ts.map +1 -0
- package/dist/commands/guard/impl/comment-commit.js +137 -0
- package/dist/commands/guard/impl/env.d.ts +10 -0
- package/dist/commands/guard/impl/env.d.ts.map +1 -0
- package/dist/commands/guard/impl/env.js +12 -0
- package/dist/commands/guard/impl/policy.d.ts +19 -0
- package/dist/commands/guard/impl/policy.d.ts.map +1 -0
- package/dist/commands/guard/impl/policy.js +46 -0
- package/dist/commands/guard/index.d.ts +4 -66
- package/dist/commands/guard/index.d.ts.map +1 -1
- package/dist/commands/guard/index.js +4 -367
- package/dist/commands/guard/suggest-allow.command.d.ts +7 -0
- package/dist/commands/guard/suggest-allow.command.d.ts.map +1 -0
- package/dist/commands/guard/suggest-allow.command.js +28 -0
- package/dist/commands/hooks/hooks.command.d.ts +5 -0
- package/dist/commands/hooks/hooks.command.d.ts.map +1 -0
- package/dist/commands/hooks/hooks.command.js +18 -0
- package/dist/commands/hooks/index.d.ts.map +1 -1
- package/dist/commands/hooks/index.js +42 -77
- package/dist/commands/hooks/install.command.d.ts +7 -0
- package/dist/commands/hooks/install.command.d.ts.map +1 -0
- package/dist/commands/hooks/install.command.js +14 -0
- package/dist/commands/hooks/run.command.d.ts +9 -0
- package/dist/commands/hooks/run.command.d.ts.map +1 -0
- package/dist/commands/hooks/run.command.js +39 -0
- package/dist/commands/hooks/uninstall.command.d.ts +7 -0
- package/dist/commands/hooks/uninstall.command.d.ts.map +1 -0
- package/dist/commands/hooks/uninstall.command.js +16 -0
- package/dist/commands/integrate.command.d.ts +14 -0
- package/dist/commands/integrate.command.d.ts.map +1 -0
- package/dist/commands/integrate.command.js +61 -0
- package/dist/commands/pr/check.d.ts +8 -0
- package/dist/commands/pr/check.d.ts.map +1 -0
- package/dist/commands/pr/check.js +78 -0
- package/dist/commands/pr/index.d.ts +5 -45
- package/dist/commands/pr/index.d.ts.map +1 -1
- package/dist/commands/pr/index.js +5 -857
- package/dist/commands/pr/integrate/artifacts.d.ts +14 -0
- package/dist/commands/pr/integrate/artifacts.d.ts.map +1 -0
- package/dist/commands/pr/integrate/artifacts.js +45 -0
- package/dist/commands/pr/integrate/cmd.d.ts +14 -0
- package/dist/commands/pr/integrate/cmd.d.ts.map +1 -0
- package/dist/commands/pr/integrate/cmd.js +150 -0
- package/dist/commands/pr/integrate/internal/finalize.d.ts +25 -0
- package/dist/commands/pr/integrate/internal/finalize.d.ts.map +1 -0
- package/dist/commands/pr/integrate/internal/finalize.js +86 -0
- package/dist/commands/pr/integrate/internal/merge.d.ts +40 -0
- package/dist/commands/pr/integrate/internal/merge.d.ts.map +1 -0
- package/dist/commands/pr/integrate/internal/merge.js +138 -0
- package/dist/commands/pr/integrate/internal/prepare.d.ts +33 -0
- package/dist/commands/pr/integrate/internal/prepare.d.ts.map +1 -0
- package/dist/commands/pr/integrate/internal/prepare.js +142 -0
- package/dist/commands/pr/integrate/internal/worktree.d.ts +14 -0
- package/dist/commands/pr/integrate/internal/worktree.d.ts.map +1 -0
- package/dist/commands/pr/integrate/internal/worktree.js +51 -0
- package/dist/commands/pr/integrate/verify.d.ts +22 -0
- package/dist/commands/pr/integrate/verify.d.ts.map +1 -0
- package/dist/commands/pr/integrate/verify.js +60 -0
- package/dist/commands/pr/integrate.d.ts +2 -0
- package/dist/commands/pr/integrate.d.ts.map +1 -0
- package/dist/commands/pr/integrate.js +1 -0
- package/dist/commands/pr/internal/pr-paths.d.ts +29 -0
- package/dist/commands/pr/internal/pr-paths.d.ts.map +1 -0
- package/dist/commands/pr/internal/pr-paths.js +38 -0
- package/dist/commands/pr/internal/review-template.d.ts +9 -0
- package/dist/commands/pr/internal/review-template.d.ts.map +1 -0
- package/dist/commands/pr/internal/review-template.js +62 -0
- package/dist/commands/pr/note.d.ts +10 -0
- package/dist/commands/pr/note.d.ts.map +1 -0
- package/dist/commands/pr/note.js +50 -0
- package/dist/commands/pr/open.d.ts +10 -0
- package/dist/commands/pr/open.d.ts.map +1 -0
- package/dist/commands/pr/open.js +80 -0
- package/dist/commands/pr/pr.command.d.ts +33 -0
- package/dist/commands/pr/pr.command.d.ts.map +1 -0
- package/dist/commands/pr/pr.command.js +172 -0
- package/dist/commands/pr/update.d.ts +8 -0
- package/dist/commands/pr/update.d.ts.map +1 -0
- package/dist/commands/pr/update.js +103 -0
- package/dist/commands/ready.command.d.ts +8 -0
- package/dist/commands/ready.command.d.ts.map +1 -0
- package/dist/commands/ready.command.js +28 -0
- package/dist/commands/recipes/cache-prune.command.d.ts +6 -0
- package/dist/commands/recipes/cache-prune.command.d.ts.map +1 -0
- package/dist/commands/recipes/cache-prune.command.js +30 -0
- package/dist/commands/recipes/cache.command.d.ts +6 -0
- package/dist/commands/recipes/cache.command.d.ts.map +1 -0
- package/dist/commands/recipes/cache.command.js +37 -0
- package/dist/commands/recipes/explain.command.d.ts +7 -0
- package/dist/commands/recipes/explain.command.d.ts.map +1 -0
- package/dist/commands/recipes/explain.command.js +10 -0
- package/dist/commands/recipes/impl/apply.d.ts +16 -0
- package/dist/commands/recipes/impl/apply.d.ts.map +1 -0
- package/dist/commands/recipes/impl/apply.js +97 -0
- package/dist/commands/recipes/impl/archive.d.ts +2 -0
- package/dist/commands/recipes/impl/archive.d.ts.map +1 -0
- package/dist/commands/recipes/impl/archive.js +19 -0
- package/dist/commands/recipes/impl/commands/cache-prune.d.ts +7 -0
- package/dist/commands/recipes/impl/commands/cache-prune.d.ts.map +1 -0
- package/dist/commands/recipes/impl/commands/cache-prune.js +94 -0
- package/dist/commands/recipes/impl/commands/explain.d.ts +6 -0
- package/dist/commands/recipes/impl/commands/explain.d.ts.map +1 -0
- package/dist/commands/recipes/impl/commands/explain.js +88 -0
- package/dist/commands/recipes/impl/commands/info.d.ts +6 -0
- package/dist/commands/recipes/impl/commands/info.d.ts.map +1 -0
- package/dist/commands/recipes/impl/commands/info.js +58 -0
- package/dist/commands/recipes/impl/commands/install.d.ts +11 -0
- package/dist/commands/recipes/impl/commands/install.d.ts.map +1 -0
- package/dist/commands/recipes/impl/commands/install.js +212 -0
- package/dist/commands/recipes/impl/commands/list-remote.d.ts +7 -0
- package/dist/commands/recipes/impl/commands/list-remote.d.ts.map +1 -0
- package/dist/commands/recipes/impl/commands/list-remote.js +53 -0
- package/dist/commands/recipes/impl/commands/list.d.ts +7 -0
- package/dist/commands/recipes/impl/commands/list.d.ts.map +1 -0
- package/dist/commands/recipes/impl/commands/list.js +38 -0
- package/dist/commands/recipes/impl/commands/remove.d.ts +6 -0
- package/dist/commands/recipes/impl/commands/remove.d.ts.map +1 -0
- package/dist/commands/recipes/impl/commands/remove.js +35 -0
- package/dist/commands/recipes/impl/commands.d.ts +8 -0
- package/dist/commands/recipes/impl/commands.d.ts.map +1 -0
- package/dist/commands/recipes/impl/commands.js +7 -0
- package/dist/commands/recipes/impl/constants.d.ts +13 -0
- package/dist/commands/recipes/impl/constants.d.ts.map +1 -0
- package/dist/commands/recipes/impl/constants.js +16 -0
- package/dist/commands/recipes/impl/format.d.ts +2 -0
- package/dist/commands/recipes/impl/format.d.ts.map +1 -0
- package/dist/commands/recipes/impl/format.js +9 -0
- package/dist/commands/recipes/impl/index.d.ts +12 -0
- package/dist/commands/recipes/impl/index.d.ts.map +1 -0
- package/dist/commands/recipes/impl/index.js +150 -0
- package/dist/commands/recipes/impl/installed-recipes.d.ts +4 -0
- package/dist/commands/recipes/impl/installed-recipes.d.ts.map +1 -0
- package/dist/commands/recipes/impl/installed-recipes.js +58 -0
- package/dist/commands/recipes/impl/manifest.d.ts +4 -0
- package/dist/commands/recipes/impl/manifest.d.ts.map +1 -0
- package/dist/commands/recipes/impl/manifest.js +43 -0
- package/dist/commands/recipes/impl/normalize.d.ts +5 -0
- package/dist/commands/recipes/impl/normalize.d.ts.map +1 -0
- package/dist/commands/recipes/impl/normalize.js +50 -0
- package/dist/commands/recipes/impl/paths.d.ts +13 -0
- package/dist/commands/recipes/impl/paths.d.ts.map +1 -0
- package/dist/commands/recipes/impl/paths.js +27 -0
- package/dist/commands/recipes/impl/project.d.ts +8 -0
- package/dist/commands/recipes/impl/project.d.ts.map +1 -0
- package/dist/commands/recipes/impl/project.js +23 -0
- package/dist/commands/recipes/impl/scenario.d.ts +16 -0
- package/dist/commands/recipes/impl/scenario.d.ts.map +1 -0
- package/dist/commands/recipes/impl/scenario.js +128 -0
- package/dist/commands/recipes/impl/types.d.ts +107 -0
- package/dist/commands/recipes/impl/types.d.ts.map +1 -0
- package/dist/commands/recipes/impl/types.js +1 -0
- package/dist/commands/recipes/info.command.d.ts +7 -0
- package/dist/commands/recipes/info.command.d.ts.map +1 -0
- package/dist/commands/recipes/info.command.js +10 -0
- package/dist/commands/recipes/install.command.d.ts +12 -0
- package/dist/commands/recipes/install.command.d.ts.map +1 -0
- package/dist/commands/recipes/install.command.js +161 -0
- package/dist/commands/recipes/list-remote.command.d.ts +6 -0
- package/dist/commands/recipes/list-remote.command.d.ts.map +1 -0
- package/dist/commands/recipes/list-remote.command.js +46 -0
- package/dist/commands/recipes/list.command.d.ts +6 -0
- package/dist/commands/recipes/list.command.d.ts.map +1 -0
- package/dist/commands/recipes/list.command.js +39 -0
- package/dist/commands/recipes/recipes.command.d.ts +6 -0
- package/dist/commands/recipes/recipes.command.d.ts.map +1 -0
- package/dist/commands/recipes/recipes.command.js +45 -0
- package/dist/commands/recipes/remove.command.d.ts +7 -0
- package/dist/commands/recipes/remove.command.d.ts.map +1 -0
- package/dist/commands/recipes/remove.command.js +10 -0
- package/dist/commands/recipes.d.ts +7 -12
- package/dist/commands/recipes.d.ts.map +1 -1
- package/dist/commands/recipes.js +6 -1963
- package/dist/commands/scenario/impl/commands.d.ts +19 -0
- package/dist/commands/scenario/impl/commands.d.ts.map +1 -0
- package/dist/commands/scenario/impl/commands.js +336 -0
- package/dist/commands/scenario/impl/report.d.ts +30 -0
- package/dist/commands/scenario/impl/report.d.ts.map +1 -0
- package/dist/commands/scenario/impl/report.js +99 -0
- package/dist/commands/scenario/info.command.d.ts +8 -0
- package/dist/commands/scenario/info.command.d.ts.map +1 -0
- package/dist/commands/scenario/info.command.js +27 -0
- package/dist/commands/scenario/list.command.d.ts +5 -0
- package/dist/commands/scenario/list.command.d.ts.map +1 -0
- package/dist/commands/scenario/list.command.js +9 -0
- package/dist/commands/scenario/run.command.d.ts +8 -0
- package/dist/commands/scenario/run.command.d.ts.map +1 -0
- package/dist/commands/scenario/run.command.js +27 -0
- package/dist/commands/scenario/scenario.command.d.ts +6 -0
- package/dist/commands/scenario/scenario.command.d.ts.map +1 -0
- package/dist/commands/scenario/scenario.command.js +37 -0
- package/dist/commands/scenario.d.ts +2 -0
- package/dist/commands/scenario.d.ts.map +1 -0
- package/dist/commands/scenario.js +1 -0
- package/dist/commands/shared/git-context.d.ts +23 -0
- package/dist/commands/shared/git-context.d.ts.map +1 -0
- package/dist/commands/shared/git-context.js +140 -0
- package/dist/commands/shared/policy-deny.d.ts +3 -0
- package/dist/commands/shared/policy-deny.d.ts.map +1 -0
- package/dist/commands/shared/policy-deny.js +12 -0
- package/dist/commands/shared/task-backend.d.ts +31 -3
- package/dist/commands/shared/task-backend.d.ts.map +1 -1
- package/dist/commands/shared/task-backend.js +42 -5
- package/dist/commands/shared/task-store.d.ts +16 -0
- package/dist/commands/shared/task-store.d.ts.map +1 -0
- package/dist/commands/shared/task-store.js +142 -0
- package/dist/commands/start.command.d.ts +19 -0
- package/dist/commands/start.command.d.ts.map +1 -0
- package/dist/commands/start.command.js +143 -0
- package/dist/commands/sync.command.d.ts +6 -0
- package/dist/commands/sync.command.d.ts.map +1 -0
- package/dist/commands/sync.command.js +57 -0
- package/dist/commands/task/add.command.d.ts +18 -0
- package/dist/commands/task/add.command.d.ts.map +1 -0
- package/dist/commands/task/add.command.js +157 -0
- package/dist/commands/task/add.d.ts +13 -3
- package/dist/commands/task/add.d.ts.map +1 -1
- package/dist/commands/task/add.js +21 -126
- package/dist/commands/task/block.d.ts +2 -2
- package/dist/commands/task/block.d.ts.map +1 -1
- package/dist/commands/task/block.js +31 -21
- package/dist/commands/task/comment.command.d.ts +10 -0
- package/dist/commands/task/comment.command.d.ts.map +1 -0
- package/dist/commands/task/comment.command.js +57 -0
- package/dist/commands/task/comment.d.ts +2 -0
- package/dist/commands/task/comment.d.ts.map +1 -1
- package/dist/commands/task/comment.js +19 -9
- package/dist/commands/task/derive.command.d.ts +13 -0
- package/dist/commands/task/derive.command.d.ts.map +1 -0
- package/dist/commands/task/derive.command.js +94 -0
- package/dist/commands/task/derive.d.ts +13 -0
- package/dist/commands/task/derive.d.ts.map +1 -0
- package/dist/commands/task/derive.js +71 -0
- package/dist/commands/task/doc-set.command.d.ts +12 -0
- package/dist/commands/task/doc-set.command.d.ts.map +1 -0
- package/dist/commands/task/doc-set.command.js +82 -0
- package/dist/commands/task/doc-show.command.d.ts +10 -0
- package/dist/commands/task/doc-show.command.d.ts.map +1 -0
- package/dist/commands/task/doc-show.command.js +54 -0
- package/dist/commands/task/doc.command.d.ts +7 -0
- package/dist/commands/task/doc.command.d.ts.map +1 -0
- package/dist/commands/task/doc.command.js +22 -0
- package/dist/commands/task/doc.d.ts +9 -6
- package/dist/commands/task/doc.d.ts.map +1 -1
- package/dist/commands/task/doc.js +61 -113
- package/dist/commands/task/export.command.d.ts +6 -0
- package/dist/commands/task/export.command.d.ts.map +1 -0
- package/dist/commands/task/export.command.js +17 -0
- package/dist/commands/task/export.d.ts +2 -0
- package/dist/commands/task/export.d.ts.map +1 -1
- package/dist/commands/task/export.js +7 -9
- package/dist/commands/task/finish.d.ts +5 -4
- package/dist/commands/task/finish.d.ts.map +1 -1
- package/dist/commands/task/finish.js +80 -37
- package/dist/commands/task/index.d.ts +14 -13
- package/dist/commands/task/index.d.ts.map +1 -1
- package/dist/commands/task/index.js +13 -13
- package/dist/commands/task/lint.command.d.ts +5 -0
- package/dist/commands/task/lint.command.d.ts.map +1 -0
- package/dist/commands/task/lint.command.js +11 -0
- package/dist/commands/task/list.command.d.ts +9 -0
- package/dist/commands/task/list.command.d.ts.map +1 -0
- package/dist/commands/task/list.command.js +68 -0
- package/dist/commands/task/list.d.ts +6 -2
- package/dist/commands/task/list.d.ts.map +1 -1
- package/dist/commands/task/list.js +12 -15
- package/dist/commands/task/migrate-doc.command.d.ts +9 -0
- package/dist/commands/task/migrate-doc.command.d.ts.map +1 -0
- package/dist/commands/task/migrate-doc.command.js +65 -0
- package/dist/commands/task/migrate-doc.d.ts +3 -3
- package/dist/commands/task/migrate-doc.d.ts.map +1 -1
- package/dist/commands/task/migrate-doc.js +40 -47
- package/dist/commands/task/migrate.command.d.ts +10 -0
- package/dist/commands/task/migrate.command.d.ts.map +1 -0
- package/dist/commands/task/migrate.command.js +50 -0
- package/dist/commands/task/migrate.d.ts +5 -1
- package/dist/commands/task/migrate.d.ts.map +1 -1
- package/dist/commands/task/migrate.js +10 -44
- package/dist/commands/task/new.command.d.ts +6 -0
- package/dist/commands/task/new.command.d.ts.map +1 -0
- package/dist/commands/task/new.command.js +13 -0
- package/dist/commands/task/new.d.ts +13 -4
- package/dist/commands/task/new.d.ts.map +1 -1
- package/dist/commands/task/new.js +30 -92
- package/dist/commands/task/new.spec.d.ts +4 -0
- package/dist/commands/task/new.spec.d.ts.map +1 -0
- package/dist/commands/task/new.spec.js +79 -0
- package/dist/commands/task/next.command.d.ts +9 -0
- package/dist/commands/task/next.command.d.ts.map +1 -0
- package/dist/commands/task/next.command.js +89 -0
- package/dist/commands/task/next.d.ts +4 -1
- package/dist/commands/task/next.d.ts.map +1 -1
- package/dist/commands/task/next.js +15 -16
- package/dist/commands/task/normalize.command.d.ts +9 -0
- package/dist/commands/task/normalize.command.d.ts.map +1 -0
- package/dist/commands/task/normalize.command.js +39 -0
- package/dist/commands/task/normalize.d.ts +4 -1
- package/dist/commands/task/normalize.d.ts.map +1 -1
- package/dist/commands/task/normalize.js +18 -31
- package/dist/commands/task/plan-approve.command.d.ts +10 -0
- package/dist/commands/task/plan-approve.command.d.ts.map +1 -0
- package/dist/commands/task/plan-approve.command.js +54 -0
- package/dist/commands/task/plan-reject.command.d.ts +10 -0
- package/dist/commands/task/plan-reject.command.d.ts.map +1 -0
- package/dist/commands/task/plan-reject.command.js +59 -0
- package/dist/commands/task/plan-set.command.d.ts +11 -0
- package/dist/commands/task/plan-set.command.d.ts.map +1 -0
- package/dist/commands/task/plan-set.command.js +76 -0
- package/dist/commands/task/plan.d.ts +23 -10
- package/dist/commands/task/plan.d.ts.map +1 -1
- package/dist/commands/task/plan.js +182 -177
- package/dist/commands/task/ready.d.ts +2 -0
- package/dist/commands/task/ready.d.ts.map +1 -1
- package/dist/commands/task/ready.js +4 -6
- package/dist/commands/task/scaffold.command.d.ts +12 -0
- package/dist/commands/task/scaffold.command.d.ts.map +1 -0
- package/dist/commands/task/scaffold.command.js +73 -0
- package/dist/commands/task/scaffold.d.ts +7 -3
- package/dist/commands/task/scaffold.d.ts.map +1 -1
- package/dist/commands/task/scaffold.js +57 -67
- package/dist/commands/task/scrub.command.d.ts +11 -0
- package/dist/commands/task/scrub.command.d.ts.map +1 -0
- package/dist/commands/task/scrub.command.js +72 -0
- package/dist/commands/task/scrub.d.ts +6 -3
- package/dist/commands/task/scrub.d.ts.map +1 -1
- package/dist/commands/task/scrub.js +12 -68
- package/dist/commands/task/search.command.d.ts +11 -0
- package/dist/commands/task/search.command.d.ts.map +1 -0
- package/dist/commands/task/search.command.js +101 -0
- package/dist/commands/task/search.d.ts +5 -1
- package/dist/commands/task/search.d.ts.map +1 -1
- package/dist/commands/task/search.js +14 -23
- package/dist/commands/task/set-status.command.d.ts +21 -0
- package/dist/commands/task/set-status.command.d.ts.map +1 -0
- package/dist/commands/task/set-status.command.js +171 -0
- package/dist/commands/task/set-status.d.ts +2 -0
- package/dist/commands/task/set-status.d.ts.map +1 -1
- package/dist/commands/task/set-status.js +32 -12
- package/dist/commands/task/shared.d.ts +8 -2
- package/dist/commands/task/shared.d.ts.map +1 -1
- package/dist/commands/task/shared.js +68 -28
- package/dist/commands/task/show.command.d.ts +8 -0
- package/dist/commands/task/show.command.d.ts.map +1 -0
- package/dist/commands/task/show.command.js +19 -0
- package/dist/commands/task/show.d.ts +2 -0
- package/dist/commands/task/show.d.ts.map +1 -1
- package/dist/commands/task/show.js +5 -7
- package/dist/commands/task/start.d.ts +2 -2
- package/dist/commands/task/start.d.ts.map +1 -1
- package/dist/commands/task/start.js +66 -23
- package/dist/commands/task/update.command.d.ts +18 -0
- package/dist/commands/task/update.command.d.ts.map +1 -0
- package/dist/commands/task/update.command.js +141 -0
- package/dist/commands/task/update.d.ts +13 -3
- package/dist/commands/task/update.d.ts.map +1 -1
- package/dist/commands/task/update.js +31 -122
- package/dist/commands/task/verify-ok.command.d.ts +13 -0
- package/dist/commands/task/verify-ok.command.d.ts.map +1 -0
- package/dist/commands/task/verify-ok.command.js +83 -0
- package/dist/commands/task/verify-record.d.ts +30 -8
- package/dist/commands/task/verify-record.d.ts.map +1 -1
- package/dist/commands/task/verify-record.js +114 -117
- package/dist/commands/task/verify-rework.command.d.ts +13 -0
- package/dist/commands/task/verify-rework.command.d.ts.map +1 -0
- package/dist/commands/task/verify-rework.command.js +83 -0
- package/dist/commands/task/verify-show.command.d.ts +9 -0
- package/dist/commands/task/verify-show.command.d.ts.map +1 -0
- package/dist/commands/task/verify-show.command.js +38 -0
- package/dist/commands/task/verify.command.d.ts +7 -0
- package/dist/commands/task/verify.command.d.ts.map +1 -0
- package/dist/commands/task/verify.command.js +20 -0
- package/dist/commands/upgrade.command.d.ts +6 -0
- package/dist/commands/upgrade.command.d.ts.map +1 -0
- package/dist/commands/upgrade.command.js +104 -0
- package/dist/commands/upgrade.d.ts +13 -2
- package/dist/commands/upgrade.d.ts.map +1 -1
- package/dist/commands/upgrade.js +12 -80
- package/dist/commands/verify.command.d.ts +16 -0
- package/dist/commands/verify.command.d.ts.map +1 -0
- package/dist/commands/verify.command.js +113 -0
- package/dist/commands/workflow.d.ts +4 -6
- package/dist/commands/workflow.d.ts.map +1 -1
- package/dist/commands/workflow.js +4 -7
- package/dist/meta/release.d.ts +2 -0
- package/dist/meta/release.d.ts.map +1 -0
- package/dist/meta/release.js +50 -0
- package/dist/policy/evaluate.d.ts +3 -0
- package/dist/policy/evaluate.d.ts.map +1 -0
- package/dist/policy/evaluate.js +27 -0
- package/dist/policy/result.d.ts +7 -0
- package/dist/policy/result.d.ts.map +1 -0
- package/dist/policy/result.js +21 -0
- package/dist/policy/rules/allowlist.d.ts +3 -0
- package/dist/policy/rules/allowlist.d.ts.map +1 -0
- package/dist/policy/rules/allowlist.js +30 -0
- package/dist/policy/rules/branch-pr-base.d.ts +3 -0
- package/dist/policy/rules/branch-pr-base.d.ts.map +1 -0
- package/dist/policy/rules/branch-pr-base.js +43 -0
- package/dist/policy/rules/clean-tree.d.ts +3 -0
- package/dist/policy/rules/clean-tree.d.ts.map +1 -0
- package/dist/policy/rules/clean-tree.js +19 -0
- package/dist/policy/rules/commit-subject.d.ts +3 -0
- package/dist/policy/rules/commit-subject.d.ts.map +1 -0
- package/dist/policy/rules/commit-subject.js +33 -0
- package/dist/policy/rules/protected-paths.d.ts +3 -0
- package/dist/policy/rules/protected-paths.d.ts.map +1 -0
- package/dist/policy/rules/protected-paths.js +53 -0
- package/dist/policy/types.d.ts +38 -0
- package/dist/policy/types.d.ts.map +1 -0
- package/dist/policy/types.js +1 -0
- package/dist/shared/git-log.d.ts +5 -0
- package/dist/shared/git-log.d.ts.map +1 -0
- package/dist/shared/git-log.js +14 -0
- package/dist/shared/git-path.d.ts +3 -0
- package/dist/shared/git-path.d.ts.map +1 -0
- package/dist/shared/git-path.js +30 -0
- package/dist/shared/guards.d.ts +2 -0
- package/dist/shared/guards.d.ts.map +1 -0
- package/dist/shared/guards.js +3 -0
- package/dist/shared/protected-paths.d.ts +12 -0
- package/dist/shared/protected-paths.d.ts.map +1 -0
- package/dist/shared/protected-paths.js +51 -0
- package/dist/shared/strings.d.ts +2 -0
- package/dist/shared/strings.d.ts.map +1 -0
- package/dist/shared/strings.js +14 -0
- package/dist/shared/write-if-changed.d.ts +3 -0
- package/dist/shared/write-if-changed.d.ts.map +1 -0
- package/dist/shared/write-if-changed.js +25 -0
- package/package.json +2 -2
- package/dist/cli/help.d.ts +0 -2
- package/dist/cli/help.d.ts.map +0 -1
- package/dist/cli/help.js +0 -127
- package/dist/commands/task/verify.d.ts +0 -2
- package/dist/commands/task/verify.d.ts.map +0 -1
- package/dist/commands/task/verify.js +0 -1
|
@@ -1,513 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import { successMessage, unknownEntityMessage, usageMessage, workflowModeMessage, } from "../../cli/output.js";
|
|
8
|
-
import { CliError } from "../../shared/errors.js";
|
|
9
|
-
import { ensureGitClean } from "../guard/index.js";
|
|
10
|
-
import { execFileAsync, gitEnv } from "../shared/git.js";
|
|
11
|
-
import { gitAheadBehind, gitDiffNames } from "../shared/git-diff.js";
|
|
12
|
-
import { gitBranchExists, gitCurrentBranch } from "../shared/git-ops.js";
|
|
13
|
-
import { findWorktreeForBranch, gitListTaskBranches, parseTaskIdFromBranch, } from "../shared/git-worktree.js";
|
|
14
|
-
import { isPathWithin, resolvePathFallback } from "../shared/path.js";
|
|
15
|
-
import { loadBackendTask } from "../shared/task-backend.js";
|
|
16
|
-
import { ensurePlanApprovedIfRequired } from "../task/shared.js";
|
|
17
|
-
export { gitInitRepo, resolveInitBaseBranch, promptInitBaseBranch, ensureInitCommit, } from "../shared/git-ops.js";
|
|
18
|
-
export const BRANCH_BASE_USAGE = "Usage: agentplane branch base get|set|clear|explain [<name>|--current]";
|
|
19
|
-
export const BRANCH_BASE_USAGE_EXAMPLE = "agentplane branch base set --current";
|
|
20
|
-
export const BRANCH_STATUS_USAGE = "Usage: agentplane branch status [--branch <name>] [--base <name>]";
|
|
21
|
-
export const BRANCH_STATUS_USAGE_EXAMPLE = "agentplane branch status --base main";
|
|
22
|
-
export const BRANCH_REMOVE_USAGE = "Usage: agentplane branch remove [--branch <name>] [--worktree <path>] [--force] [--quiet]";
|
|
23
|
-
export const BRANCH_REMOVE_USAGE_EXAMPLE = "agentplane branch remove --branch task/20260203-F1Q8AB --worktree .agentplane/worktrees/task";
|
|
24
|
-
export const WORK_START_USAGE = "Usage: agentplane work start <task-id> --agent <id> --slug <slug> [--worktree]";
|
|
25
|
-
export const WORK_START_USAGE_EXAMPLE = "agentplane work start 202602030608-F1Q8AB --agent CODER --slug cli --worktree";
|
|
26
|
-
export const CLEANUP_MERGED_USAGE = "Usage: agentplane cleanup merged [--base <name>] [--yes] [--archive] [--quiet]";
|
|
27
|
-
export const CLEANUP_MERGED_USAGE_EXAMPLE = "agentplane cleanup merged --yes";
|
|
28
|
-
function validateWorkSlug(slug) {
|
|
29
|
-
const trimmed = slug.trim();
|
|
30
|
-
if (!trimmed) {
|
|
31
|
-
throw new CliError({
|
|
32
|
-
exitCode: 2,
|
|
33
|
-
code: "E_USAGE",
|
|
34
|
-
message: usageMessage(WORK_START_USAGE, WORK_START_USAGE_EXAMPLE),
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
if (!/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(trimmed)) {
|
|
38
|
-
throw new CliError({
|
|
39
|
-
exitCode: 2,
|
|
40
|
-
code: "E_USAGE",
|
|
41
|
-
message: "Slug must be lowercase kebab-case (a-z, 0-9, hyphen)",
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
function validateWorkAgent(agent) {
|
|
46
|
-
const trimmed = agent.trim();
|
|
47
|
-
if (!trimmed) {
|
|
48
|
-
throw new CliError({
|
|
49
|
-
exitCode: 2,
|
|
50
|
-
code: "E_USAGE",
|
|
51
|
-
message: usageMessage(WORK_START_USAGE, WORK_START_USAGE_EXAMPLE),
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
if (!/^[A-Z0-9_]+$/.test(trimmed)) {
|
|
55
|
-
throw new CliError({
|
|
56
|
-
exitCode: 2,
|
|
57
|
-
code: "E_USAGE",
|
|
58
|
-
message: "Agent id must be uppercase letters, numbers, or underscores",
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
async function archivePrArtifacts(taskDir) {
|
|
63
|
-
const prDir = path.join(taskDir, "pr");
|
|
64
|
-
if (!(await fileExists(prDir)))
|
|
65
|
-
return null;
|
|
66
|
-
const archiveRoot = path.join(taskDir, "pr-archive");
|
|
67
|
-
await mkdir(archiveRoot, { recursive: true });
|
|
68
|
-
const stamp = new Date().toISOString().replaceAll(/[:.]/g, "");
|
|
69
|
-
let dest = path.join(archiveRoot, stamp);
|
|
70
|
-
if (await fileExists(dest)) {
|
|
71
|
-
dest = path.join(archiveRoot, `${stamp}-${Math.random().toString(36).slice(2, 8)}`);
|
|
72
|
-
}
|
|
73
|
-
await rename(prDir, dest);
|
|
74
|
-
return dest;
|
|
75
|
-
}
|
|
76
|
-
export async function cmdWorkStart(opts) {
|
|
77
|
-
try {
|
|
78
|
-
validateWorkAgent(opts.agent);
|
|
79
|
-
validateWorkSlug(opts.slug);
|
|
80
|
-
const resolved = await resolveProject({
|
|
81
|
-
cwd: opts.cwd,
|
|
82
|
-
rootOverride: opts.rootOverride ?? null,
|
|
83
|
-
});
|
|
84
|
-
const loaded = await loadConfig(resolved.agentplaneDir);
|
|
85
|
-
const mode = loaded.config.workflow_mode;
|
|
86
|
-
if (mode === "branch_pr" && !opts.worktree) {
|
|
87
|
-
throw new CliError({
|
|
88
|
-
exitCode: 2,
|
|
89
|
-
code: "E_USAGE",
|
|
90
|
-
message: usageMessage(WORK_START_USAGE, WORK_START_USAGE_EXAMPLE),
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
const { task } = await loadBackendTask({
|
|
94
|
-
cwd: opts.cwd,
|
|
95
|
-
rootOverride: opts.rootOverride,
|
|
96
|
-
taskId: opts.taskId,
|
|
97
|
-
});
|
|
98
|
-
ensurePlanApprovedIfRequired(task, loaded.config);
|
|
99
|
-
const currentBranch = await gitCurrentBranch(resolved.gitRoot);
|
|
100
|
-
let baseRef = currentBranch;
|
|
101
|
-
if (mode === "branch_pr") {
|
|
102
|
-
const baseBranch = await resolveBaseBranch({
|
|
103
|
-
cwd: opts.cwd,
|
|
104
|
-
rootOverride: opts.rootOverride ?? null,
|
|
105
|
-
cliBaseOpt: null,
|
|
106
|
-
mode,
|
|
107
|
-
});
|
|
108
|
-
if (!baseBranch) {
|
|
109
|
-
throw new CliError({
|
|
110
|
-
exitCode: 2,
|
|
111
|
-
code: "E_USAGE",
|
|
112
|
-
message: "Base branch could not be resolved (use `agentplane branch base set`).",
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
if (currentBranch !== baseBranch) {
|
|
116
|
-
throw new CliError({
|
|
117
|
-
exitCode: 5,
|
|
118
|
-
code: "E_GIT",
|
|
119
|
-
message: `work start must be run on base branch ${baseBranch} (current: ${currentBranch})`,
|
|
120
|
-
});
|
|
121
|
-
}
|
|
122
|
-
baseRef = baseBranch;
|
|
123
|
-
}
|
|
124
|
-
const prefix = loaded.config.branch.task_prefix;
|
|
125
|
-
const branchName = `${prefix}/${opts.taskId}/${opts.slug.trim()}`;
|
|
126
|
-
const branchExists = await gitBranchExists(resolved.gitRoot, branchName);
|
|
127
|
-
let worktreePath = "";
|
|
128
|
-
if (opts.worktree) {
|
|
129
|
-
const worktreesDir = path.resolve(resolved.gitRoot, loaded.config.paths.worktrees_dir);
|
|
130
|
-
if (!isPathWithin(resolved.gitRoot, worktreesDir)) {
|
|
131
|
-
throw new CliError({
|
|
132
|
-
exitCode: 5,
|
|
133
|
-
code: "E_GIT",
|
|
134
|
-
message: `worktrees_dir must be inside the repo: ${worktreesDir}`,
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
worktreePath = path.join(worktreesDir, `${opts.taskId}-${opts.slug.trim()}`);
|
|
138
|
-
if (await fileExists(worktreePath)) {
|
|
139
|
-
throw new CliError({
|
|
140
|
-
exitCode: 5,
|
|
141
|
-
code: "E_GIT",
|
|
142
|
-
message: `Worktree path already exists: ${worktreePath}`,
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
await mkdir(worktreesDir, { recursive: true });
|
|
146
|
-
const worktreeArgs = branchExists
|
|
147
|
-
? ["worktree", "add", worktreePath, branchName]
|
|
148
|
-
: ["worktree", "add", "-b", branchName, worktreePath, baseRef];
|
|
149
|
-
await execFileAsync("git", worktreeArgs, { cwd: resolved.gitRoot, env: gitEnv() });
|
|
150
|
-
}
|
|
151
|
-
else {
|
|
152
|
-
if (branchExists) {
|
|
153
|
-
if (currentBranch !== branchName) {
|
|
154
|
-
await execFileAsync("git", ["checkout", "-q", branchName], {
|
|
155
|
-
cwd: resolved.gitRoot,
|
|
156
|
-
env: gitEnv(),
|
|
157
|
-
});
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
else {
|
|
161
|
-
await execFileAsync("git", ["checkout", "-q", "-b", branchName, baseRef], {
|
|
162
|
-
cwd: resolved.gitRoot,
|
|
163
|
-
env: gitEnv(),
|
|
164
|
-
});
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
process.stdout.write(`${successMessage("work start", branchName, opts.worktree ? `worktree=${path.relative(resolved.gitRoot, worktreePath)}` : "")}\n`);
|
|
168
|
-
return 0;
|
|
169
|
-
}
|
|
170
|
-
catch (err) {
|
|
171
|
-
if (err instanceof CliError)
|
|
172
|
-
throw err;
|
|
173
|
-
throw mapBackendError(err, { command: "work start", root: opts.rootOverride ?? null });
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
export async function cmdCleanupMerged(opts) {
|
|
177
|
-
try {
|
|
178
|
-
const resolved = await resolveProject({
|
|
179
|
-
cwd: opts.cwd,
|
|
180
|
-
rootOverride: opts.rootOverride ?? null,
|
|
181
|
-
});
|
|
182
|
-
const loaded = await loadConfig(resolved.agentplaneDir);
|
|
183
|
-
if (loaded.config.workflow_mode !== "branch_pr") {
|
|
184
|
-
throw new CliError({
|
|
185
|
-
exitCode: 2,
|
|
186
|
-
code: "E_USAGE",
|
|
187
|
-
message: workflowModeMessage(loaded.config.workflow_mode, "branch_pr"),
|
|
188
|
-
});
|
|
189
|
-
}
|
|
190
|
-
await ensureGitClean({ cwd: opts.cwd, rootOverride: opts.rootOverride });
|
|
191
|
-
const baseBranch = await resolveBaseBranch({
|
|
192
|
-
cwd: opts.cwd,
|
|
193
|
-
rootOverride: opts.rootOverride ?? null,
|
|
194
|
-
cliBaseOpt: opts.base ?? null,
|
|
195
|
-
mode: loaded.config.workflow_mode,
|
|
196
|
-
});
|
|
197
|
-
if (!baseBranch) {
|
|
198
|
-
throw new CliError({
|
|
199
|
-
exitCode: 2,
|
|
200
|
-
code: "E_USAGE",
|
|
201
|
-
message: usageMessage(CLEANUP_MERGED_USAGE, CLEANUP_MERGED_USAGE_EXAMPLE),
|
|
202
|
-
});
|
|
203
|
-
}
|
|
204
|
-
if (!(await gitBranchExists(resolved.gitRoot, baseBranch))) {
|
|
205
|
-
throw new CliError({
|
|
206
|
-
exitCode: 5,
|
|
207
|
-
code: "E_GIT",
|
|
208
|
-
message: unknownEntityMessage("base branch", baseBranch),
|
|
209
|
-
});
|
|
210
|
-
}
|
|
211
|
-
const currentBranch = await gitCurrentBranch(resolved.gitRoot);
|
|
212
|
-
if (currentBranch !== baseBranch) {
|
|
213
|
-
throw new CliError({
|
|
214
|
-
exitCode: 5,
|
|
215
|
-
code: "E_GIT",
|
|
216
|
-
message: `cleanup merged must run on base branch ${baseBranch} (current: ${currentBranch})`,
|
|
217
|
-
});
|
|
218
|
-
}
|
|
219
|
-
const repoRoot = await resolvePathFallback(resolved.gitRoot);
|
|
220
|
-
const { backend } = await loadTaskBackend({
|
|
221
|
-
cwd: opts.cwd,
|
|
222
|
-
rootOverride: opts.rootOverride ?? null,
|
|
223
|
-
});
|
|
224
|
-
const tasks = await backend.listTasks();
|
|
225
|
-
const tasksById = new Map(tasks.map((task) => [task.id, task]));
|
|
226
|
-
const prefix = loaded.config.branch.task_prefix;
|
|
227
|
-
const branches = await gitListTaskBranches(resolved.gitRoot, prefix);
|
|
228
|
-
const candidates = [];
|
|
229
|
-
for (const branch of branches) {
|
|
230
|
-
if (branch === baseBranch)
|
|
231
|
-
continue;
|
|
232
|
-
const taskId = parseTaskIdFromBranch(prefix, branch);
|
|
233
|
-
if (!taskId)
|
|
234
|
-
continue;
|
|
235
|
-
const task = tasksById.get(taskId);
|
|
236
|
-
if (!task)
|
|
237
|
-
continue;
|
|
238
|
-
const status = String(task.status || "").toUpperCase();
|
|
239
|
-
if (status !== "DONE")
|
|
240
|
-
continue;
|
|
241
|
-
const diff = await gitDiffNames(resolved.gitRoot, baseBranch, branch);
|
|
242
|
-
if (diff.length > 0)
|
|
243
|
-
continue;
|
|
244
|
-
const worktreePath = await findWorktreeForBranch(resolved.gitRoot, branch);
|
|
245
|
-
candidates.push({ taskId, branch, worktreePath });
|
|
246
|
-
}
|
|
247
|
-
const sortedCandidates = candidates.toSorted((a, b) => a.taskId.localeCompare(b.taskId));
|
|
248
|
-
if (!opts.quiet) {
|
|
249
|
-
const archiveLabel = opts.archive ? " archive=on" : "";
|
|
250
|
-
process.stdout.write(`cleanup merged (base=${baseBranch}${archiveLabel})\n`);
|
|
251
|
-
if (sortedCandidates.length === 0) {
|
|
252
|
-
process.stdout.write("no candidates\n");
|
|
253
|
-
return 0;
|
|
254
|
-
}
|
|
255
|
-
for (const item of sortedCandidates) {
|
|
256
|
-
process.stdout.write(`- ${item.taskId}: branch=${item.branch} worktree=${item.worktreePath ?? "-"}\n`);
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
if (!opts.yes) {
|
|
260
|
-
if (!opts.quiet) {
|
|
261
|
-
process.stdout.write("Re-run with --yes to delete these branches/worktrees.\n");
|
|
262
|
-
}
|
|
263
|
-
return 0;
|
|
264
|
-
}
|
|
265
|
-
for (const item of sortedCandidates) {
|
|
266
|
-
const worktreePath = item.worktreePath ? await resolvePathFallback(item.worktreePath) : null;
|
|
267
|
-
if (worktreePath) {
|
|
268
|
-
if (!isPathWithin(repoRoot, worktreePath)) {
|
|
269
|
-
throw new CliError({
|
|
270
|
-
exitCode: 5,
|
|
271
|
-
code: "E_GIT",
|
|
272
|
-
message: `Refusing to remove worktree outside repo: ${worktreePath}`,
|
|
273
|
-
});
|
|
274
|
-
}
|
|
275
|
-
if (worktreePath === repoRoot) {
|
|
276
|
-
throw new CliError({
|
|
277
|
-
exitCode: 5,
|
|
278
|
-
code: "E_GIT",
|
|
279
|
-
message: "Refusing to remove the current worktree",
|
|
280
|
-
});
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
if (opts.archive) {
|
|
284
|
-
const taskDir = path.join(resolved.gitRoot, loaded.config.paths.workflow_dir, item.taskId);
|
|
285
|
-
await archivePrArtifacts(taskDir);
|
|
286
|
-
}
|
|
287
|
-
if (worktreePath) {
|
|
288
|
-
await execFileAsync("git", ["worktree", "remove", "--force", worktreePath], {
|
|
289
|
-
cwd: resolved.gitRoot,
|
|
290
|
-
env: gitEnv(),
|
|
291
|
-
});
|
|
292
|
-
}
|
|
293
|
-
await execFileAsync("git", ["branch", "-D", item.branch], {
|
|
294
|
-
cwd: resolved.gitRoot,
|
|
295
|
-
env: gitEnv(),
|
|
296
|
-
});
|
|
297
|
-
}
|
|
298
|
-
if (!opts.quiet) {
|
|
299
|
-
process.stdout.write(`${successMessage("cleanup merged", undefined, `deleted=${candidates.length}`)}\n`);
|
|
300
|
-
}
|
|
301
|
-
return 0;
|
|
302
|
-
}
|
|
303
|
-
catch (err) {
|
|
304
|
-
if (err instanceof CliError)
|
|
305
|
-
throw err;
|
|
306
|
-
throw mapBackendError(err, { command: "cleanup merged", root: opts.rootOverride ?? null });
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
export async function cmdBranchBaseGet(opts) {
|
|
310
|
-
try {
|
|
311
|
-
const value = await getBaseBranch({ cwd: opts.cwd, rootOverride: opts.rootOverride ?? null });
|
|
312
|
-
process.stdout.write(`${value}\n`);
|
|
313
|
-
return 0;
|
|
314
|
-
}
|
|
315
|
-
catch (err) {
|
|
316
|
-
throw mapCoreError(err, { command: "branch base get", root: opts.rootOverride ?? null });
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
export async function cmdBranchBaseSet(opts) {
|
|
320
|
-
const trimmed = (opts.value ?? "").trim();
|
|
321
|
-
if (trimmed.length === 0 && !opts.useCurrent) {
|
|
322
|
-
throw new CliError({
|
|
323
|
-
exitCode: 2,
|
|
324
|
-
code: "E_USAGE",
|
|
325
|
-
message: usageMessage(BRANCH_BASE_USAGE, BRANCH_BASE_USAGE_EXAMPLE),
|
|
326
|
-
});
|
|
327
|
-
}
|
|
328
|
-
try {
|
|
329
|
-
let nextValue = trimmed;
|
|
330
|
-
if (opts.useCurrent) {
|
|
331
|
-
const resolved = await resolveProject({
|
|
332
|
-
cwd: opts.cwd,
|
|
333
|
-
rootOverride: opts.rootOverride ?? null,
|
|
334
|
-
});
|
|
335
|
-
nextValue = await gitCurrentBranch(resolved.gitRoot);
|
|
336
|
-
}
|
|
337
|
-
const value = await setPinnedBaseBranch({
|
|
338
|
-
cwd: opts.cwd,
|
|
339
|
-
rootOverride: opts.rootOverride ?? null,
|
|
340
|
-
value: nextValue,
|
|
341
|
-
});
|
|
342
|
-
process.stdout.write(`${value}\n`);
|
|
343
|
-
return 0;
|
|
344
|
-
}
|
|
345
|
-
catch (err) {
|
|
346
|
-
throw mapCoreError(err, { command: "branch base set", root: opts.rootOverride ?? null });
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
export async function cmdBranchBaseClear(opts) {
|
|
350
|
-
try {
|
|
351
|
-
const cleared = await clearPinnedBaseBranch({
|
|
352
|
-
cwd: opts.cwd,
|
|
353
|
-
rootOverride: opts.rootOverride ?? null,
|
|
354
|
-
});
|
|
355
|
-
process.stdout.write(`${cleared ? "cleared" : "no-op"}\n`);
|
|
356
|
-
return 0;
|
|
357
|
-
}
|
|
358
|
-
catch (err) {
|
|
359
|
-
throw mapCoreError(err, { command: "branch base clear", root: opts.rootOverride ?? null });
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
export async function cmdBranchBaseExplain(opts) {
|
|
363
|
-
try {
|
|
364
|
-
const resolved = await resolveProject({
|
|
365
|
-
cwd: opts.cwd,
|
|
366
|
-
rootOverride: opts.rootOverride ?? null,
|
|
367
|
-
});
|
|
368
|
-
const loaded = await loadConfig(resolved.agentplaneDir);
|
|
369
|
-
let current = null;
|
|
370
|
-
try {
|
|
371
|
-
current = await gitCurrentBranch(resolved.gitRoot);
|
|
372
|
-
}
|
|
373
|
-
catch {
|
|
374
|
-
current = null;
|
|
375
|
-
}
|
|
376
|
-
const pinned = await getPinnedBaseBranch({
|
|
377
|
-
cwd: opts.cwd,
|
|
378
|
-
rootOverride: opts.rootOverride ?? null,
|
|
379
|
-
});
|
|
380
|
-
const effective = await resolveBaseBranch({
|
|
381
|
-
cwd: opts.cwd,
|
|
382
|
-
rootOverride: opts.rootOverride ?? null,
|
|
383
|
-
cliBaseOpt: null,
|
|
384
|
-
mode: loaded.config.workflow_mode,
|
|
385
|
-
});
|
|
386
|
-
const warnings = [];
|
|
387
|
-
if (pinned && !(await gitBranchExists(resolved.gitRoot, pinned))) {
|
|
388
|
-
warnings.push(`Pinned base branch not found: ${pinned}`);
|
|
389
|
-
}
|
|
390
|
-
if (effective && !(await gitBranchExists(resolved.gitRoot, effective))) {
|
|
391
|
-
warnings.push(`Effective base branch not found: ${effective}`);
|
|
392
|
-
}
|
|
393
|
-
process.stdout.write(`current_branch=${current ?? "-"}\n`);
|
|
394
|
-
process.stdout.write(`pinned_base=${pinned ?? "-"}\n`);
|
|
395
|
-
process.stdout.write(`effective_base=${effective ?? "-"}\n`);
|
|
396
|
-
if (warnings.length > 0) {
|
|
397
|
-
for (const warning of warnings) {
|
|
398
|
-
process.stdout.write(`warning=${warning}\n`);
|
|
399
|
-
}
|
|
400
|
-
}
|
|
401
|
-
return 0;
|
|
402
|
-
}
|
|
403
|
-
catch (err) {
|
|
404
|
-
throw mapCoreError(err, { command: "branch base explain", root: opts.rootOverride ?? null });
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
|
-
export async function cmdBranchStatus(opts) {
|
|
408
|
-
try {
|
|
409
|
-
const resolved = await resolveProject({
|
|
410
|
-
cwd: opts.cwd,
|
|
411
|
-
rootOverride: opts.rootOverride ?? null,
|
|
412
|
-
});
|
|
413
|
-
const loaded = await loadConfig(resolved.agentplaneDir);
|
|
414
|
-
const branch = (opts.branch ?? (await gitCurrentBranch(resolved.gitRoot))).trim();
|
|
415
|
-
const base = await resolveBaseBranch({
|
|
416
|
-
cwd: opts.cwd,
|
|
417
|
-
rootOverride: opts.rootOverride ?? null,
|
|
418
|
-
cliBaseOpt: opts.base ?? null,
|
|
419
|
-
mode: loaded.config.workflow_mode,
|
|
420
|
-
});
|
|
421
|
-
if (!branch || !base) {
|
|
422
|
-
throw new CliError({
|
|
423
|
-
exitCode: 2,
|
|
424
|
-
code: "E_USAGE",
|
|
425
|
-
message: usageMessage(BRANCH_STATUS_USAGE, BRANCH_STATUS_USAGE_EXAMPLE),
|
|
426
|
-
});
|
|
427
|
-
}
|
|
428
|
-
if (!(await gitBranchExists(resolved.gitRoot, branch))) {
|
|
429
|
-
throw new CliError({
|
|
430
|
-
exitCode: 2,
|
|
431
|
-
code: "E_USAGE",
|
|
432
|
-
message: unknownEntityMessage("branch", branch),
|
|
433
|
-
});
|
|
434
|
-
}
|
|
435
|
-
if (!(await gitBranchExists(resolved.gitRoot, base))) {
|
|
436
|
-
throw new CliError({
|
|
437
|
-
exitCode: 2,
|
|
438
|
-
code: "E_USAGE",
|
|
439
|
-
message: unknownEntityMessage("base branch", base),
|
|
440
|
-
});
|
|
441
|
-
}
|
|
442
|
-
const taskId = parseTaskIdFromBranch(loaded.config.branch.task_prefix, branch);
|
|
443
|
-
const worktree = await findWorktreeForBranch(resolved.gitRoot, branch);
|
|
444
|
-
const { ahead, behind } = await gitAheadBehind(resolved.gitRoot, base, branch);
|
|
445
|
-
process.stdout.write(`branch=${branch} base=${base} ahead=${ahead} behind=${behind} task_id=${taskId ?? "-"}\n`);
|
|
446
|
-
if (worktree) {
|
|
447
|
-
process.stdout.write(`worktree=${worktree}\n`);
|
|
448
|
-
}
|
|
449
|
-
return 0;
|
|
450
|
-
}
|
|
451
|
-
catch (err) {
|
|
452
|
-
if (err instanceof CliError)
|
|
453
|
-
throw err;
|
|
454
|
-
throw mapCoreError(err, { command: "branch status", root: opts.rootOverride ?? null });
|
|
455
|
-
}
|
|
456
|
-
}
|
|
457
|
-
export async function cmdBranchRemove(opts) {
|
|
458
|
-
const branch = (opts.branch ?? "").trim();
|
|
459
|
-
const worktree = (opts.worktree ?? "").trim();
|
|
460
|
-
if (!branch && !worktree) {
|
|
461
|
-
throw new CliError({
|
|
462
|
-
exitCode: 2,
|
|
463
|
-
code: "E_USAGE",
|
|
464
|
-
message: usageMessage(BRANCH_REMOVE_USAGE, BRANCH_REMOVE_USAGE_EXAMPLE),
|
|
465
|
-
});
|
|
466
|
-
}
|
|
467
|
-
try {
|
|
468
|
-
const resolved = await resolveProject({
|
|
469
|
-
cwd: opts.cwd,
|
|
470
|
-
rootOverride: opts.rootOverride ?? null,
|
|
471
|
-
});
|
|
472
|
-
const loaded = await loadConfig(resolved.agentplaneDir);
|
|
473
|
-
if (worktree) {
|
|
474
|
-
const worktreePath = path.isAbsolute(worktree)
|
|
475
|
-
? await resolvePathFallback(worktree)
|
|
476
|
-
: await resolvePathFallback(path.join(resolved.gitRoot, worktree));
|
|
477
|
-
const worktreesRoot = path.resolve(resolved.gitRoot, loaded.config.paths.worktrees_dir);
|
|
478
|
-
if (!isPathWithin(worktreesRoot, worktreePath)) {
|
|
479
|
-
throw new CliError({
|
|
480
|
-
exitCode: 2,
|
|
481
|
-
code: "E_USAGE",
|
|
482
|
-
message: `Refusing to remove worktree outside ${worktreesRoot}: ${worktreePath}`,
|
|
483
|
-
});
|
|
484
|
-
}
|
|
485
|
-
await execFileAsync("git", ["worktree", "remove", ...(opts.force ? ["--force"] : []), worktreePath], { cwd: resolved.gitRoot, env: gitEnv() });
|
|
486
|
-
if (!opts.quiet) {
|
|
487
|
-
process.stdout.write(`${successMessage("removed worktree", worktreePath)}\n`);
|
|
488
|
-
}
|
|
489
|
-
}
|
|
490
|
-
if (branch) {
|
|
491
|
-
if (!(await gitBranchExists(resolved.gitRoot, branch))) {
|
|
492
|
-
throw new CliError({
|
|
493
|
-
exitCode: 2,
|
|
494
|
-
code: "E_USAGE",
|
|
495
|
-
message: unknownEntityMessage("branch", branch),
|
|
496
|
-
});
|
|
497
|
-
}
|
|
498
|
-
await execFileAsync("git", ["branch", opts.force ? "-D" : "-d", branch], {
|
|
499
|
-
cwd: resolved.gitRoot,
|
|
500
|
-
env: gitEnv(),
|
|
501
|
-
});
|
|
502
|
-
if (!opts.quiet) {
|
|
503
|
-
process.stdout.write(`${successMessage("removed branch", branch)}\n`);
|
|
504
|
-
}
|
|
505
|
-
}
|
|
506
|
-
return 0;
|
|
507
|
-
}
|
|
508
|
-
catch (err) {
|
|
509
|
-
if (err instanceof CliError)
|
|
510
|
-
throw err;
|
|
511
|
-
throw mapCoreError(err, { command: "branch remove", root: opts.rootOverride ?? null });
|
|
512
|
-
}
|
|
513
|
-
}
|
|
1
|
+
export { ensureInitCommit, gitInitRepo, promptInitBaseBranch, resolveInitBaseBranch, } from "../shared/git-ops.js";
|
|
2
|
+
export { cmdBranchBaseClear, cmdBranchBaseExplain, cmdBranchBaseGet, cmdBranchBaseSet, } from "./base.js";
|
|
3
|
+
export { cmdBranchRemove } from "./remove.js";
|
|
4
|
+
export { cmdBranchStatus } from "./status.js";
|
|
5
|
+
export { cmdCleanupMerged } from "./cleanup-merged.js";
|
|
6
|
+
export { cmdWorkStart } from "./work-start.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"archive-pr.d.ts","sourceRoot":"","sources":["../../../../src/commands/branch/internal/archive-pr.ts"],"names":[],"mappings":"AAKA,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAYhF"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { mkdir, rename } from "node:fs/promises";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { fileExists } from "../../../cli/fs-utils.js";
|
|
4
|
+
export async function archivePrArtifacts(taskDir) {
|
|
5
|
+
const prDir = path.join(taskDir, "pr");
|
|
6
|
+
if (!(await fileExists(prDir)))
|
|
7
|
+
return null;
|
|
8
|
+
const archiveRoot = path.join(taskDir, "pr-archive");
|
|
9
|
+
await mkdir(archiveRoot, { recursive: true });
|
|
10
|
+
const stamp = new Date().toISOString().replaceAll(/[:.]/g, "");
|
|
11
|
+
let dest = path.join(archiveRoot, stamp);
|
|
12
|
+
if (await fileExists(dest)) {
|
|
13
|
+
dest = path.join(archiveRoot, `${stamp}-${Math.random().toString(36).slice(2, 8)}`);
|
|
14
|
+
}
|
|
15
|
+
await rename(prDir, dest);
|
|
16
|
+
return dest;
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"work-validate.d.ts","sourceRoot":"","sources":["../../../../src/commands/branch/internal/work-validate.ts"],"names":[],"mappings":"AAEA,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAYnD;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAYrD"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { CliError } from "../../../shared/errors.js";
|
|
2
|
+
export function validateWorkSlug(slug) {
|
|
3
|
+
const trimmed = slug.trim();
|
|
4
|
+
if (!trimmed) {
|
|
5
|
+
throw new CliError({ exitCode: 2, code: "E_USAGE", message: "Invalid value for --slug." });
|
|
6
|
+
}
|
|
7
|
+
if (!/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(trimmed)) {
|
|
8
|
+
throw new CliError({
|
|
9
|
+
exitCode: 2,
|
|
10
|
+
code: "E_USAGE",
|
|
11
|
+
message: "Slug must be lowercase kebab-case (a-z, 0-9, hyphen).",
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
export function validateWorkAgent(agent) {
|
|
16
|
+
const trimmed = agent.trim();
|
|
17
|
+
if (!trimmed) {
|
|
18
|
+
throw new CliError({ exitCode: 2, code: "E_USAGE", message: "Invalid value for --agent." });
|
|
19
|
+
}
|
|
20
|
+
if (!/^[A-Z0-9_]+$/.test(trimmed)) {
|
|
21
|
+
throw new CliError({
|
|
22
|
+
exitCode: 2,
|
|
23
|
+
code: "E_USAGE",
|
|
24
|
+
message: "Agent id must be uppercase letters, numbers, or underscores.",
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { CommandHandler, CommandSpec } from "../../cli/spec/spec.js";
|
|
2
|
+
export type BranchRemoveParsed = {
|
|
3
|
+
branch: string | null;
|
|
4
|
+
worktree: string | null;
|
|
5
|
+
force: boolean;
|
|
6
|
+
quiet: boolean;
|
|
7
|
+
};
|
|
8
|
+
export declare const branchRemoveSpec: CommandSpec<BranchRemoveParsed>;
|
|
9
|
+
export declare const runBranchRemove: CommandHandler<BranchRemoveParsed>;
|
|
10
|
+
//# sourceMappingURL=remove.command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remove.command.d.ts","sourceRoot":"","sources":["../../../src/commands/branch/remove.command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAK1E,MAAM,MAAM,kBAAkB,GAAG;IAC/B,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,EAAE,OAAO,CAAC;CAChB,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,WAAW,CAAC,kBAAkB,CAkD5D,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,cAAc,CAAC,kBAAkB,CAS9D,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { usageError } from "../../cli/spec/errors.js";
|
|
2
|
+
import { cmdBranchRemove } from "./index.js";
|
|
3
|
+
export const branchRemoveSpec = {
|
|
4
|
+
id: ["branch", "remove"],
|
|
5
|
+
group: "Branch",
|
|
6
|
+
summary: "Remove a task branch and/or its worktree.",
|
|
7
|
+
options: [
|
|
8
|
+
{
|
|
9
|
+
kind: "string",
|
|
10
|
+
name: "branch",
|
|
11
|
+
valueHint: "<name>",
|
|
12
|
+
description: "Branch name to delete.",
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
kind: "string",
|
|
16
|
+
name: "worktree",
|
|
17
|
+
valueHint: "<path>",
|
|
18
|
+
description: "Worktree path to remove (relative to repo root or absolute).",
|
|
19
|
+
},
|
|
20
|
+
{ kind: "boolean", name: "force", default: false, description: "Force deletion." },
|
|
21
|
+
{ kind: "boolean", name: "quiet", default: false, description: "Reduce output noise." },
|
|
22
|
+
],
|
|
23
|
+
examples: [
|
|
24
|
+
{
|
|
25
|
+
cmd: "agentplane branch remove --branch task/202602030608-F1Q8AB/cli",
|
|
26
|
+
why: "Delete a branch.",
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
cmd: "agentplane branch remove --worktree .agentplane/worktrees/202602030608-F1Q8AB-cli",
|
|
30
|
+
why: "Remove a worktree.",
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
cmd: "agentplane branch remove --branch task/202602030608-F1Q8AB/cli --worktree .agentplane/worktrees/202602030608-F1Q8AB-cli --force",
|
|
34
|
+
why: "Force-remove both worktree and branch.",
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
validateRaw: (raw) => {
|
|
38
|
+
const branch = typeof raw.opts.branch === "string" ? raw.opts.branch.trim() : "";
|
|
39
|
+
const worktree = typeof raw.opts.worktree === "string" ? raw.opts.worktree.trim() : "";
|
|
40
|
+
if (!branch && !worktree) {
|
|
41
|
+
throw usageError({
|
|
42
|
+
spec: branchRemoveSpec,
|
|
43
|
+
message: "Missing required option: provide --branch and/or --worktree.",
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
parse: (raw) => ({
|
|
48
|
+
branch: typeof raw.opts.branch === "string" ? raw.opts.branch : null,
|
|
49
|
+
worktree: typeof raw.opts.worktree === "string" ? raw.opts.worktree : null,
|
|
50
|
+
force: raw.opts.force === true,
|
|
51
|
+
quiet: raw.opts.quiet === true,
|
|
52
|
+
}),
|
|
53
|
+
};
|
|
54
|
+
export const runBranchRemove = async (ctx, p) => {
|
|
55
|
+
return await cmdBranchRemove({
|
|
56
|
+
cwd: ctx.cwd,
|
|
57
|
+
rootOverride: ctx.rootOverride,
|
|
58
|
+
branch: p.branch ?? undefined,
|
|
59
|
+
worktree: p.worktree ?? undefined,
|
|
60
|
+
force: p.force,
|
|
61
|
+
quiet: p.quiet,
|
|
62
|
+
});
|
|
63
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remove.d.ts","sourceRoot":"","sources":["../../../src/commands/branch/remove.ts"],"names":[],"mappings":"AAWA,wBAAsB,eAAe,CAAC,IAAI,EAAE;IAC1C,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,EAAE,OAAO,CAAC;CAChB,GAAG,OAAO,CAAC,MAAM,CAAC,CA4DlB"}
|