agentplane 0.1.9 → 0.2.1
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 +281 -70
- 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 -204
- package/dist/backends/task-backend.d.ts.map +1 -1
- package/dist/backends/task-backend.js +4 -1366
- 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 +25 -8
- 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 -2463
- 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 -87
- package/dist/commands/guard/index.d.ts.map +1 -1
- package/dist/commands/guard/index.js +4 -481
- 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 +36 -81
- 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 -81
- package/dist/commands/recipes.d.ts.map +1 -1
- package/dist/commands/recipes.js +6 -1457
- 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 +1 -6
- package/dist/commands/scenario.d.ts.map +1 -1
- package/dist/commands/scenario.js +1 -501
- 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 +17 -5
- package/dist/commands/shared/task-backend.d.ts.map +1 -1
- package/dist/commands/shared/task-backend.js +34 -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 +13 -9
- 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 +10 -7
- 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 +50 -17
- 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 +14 -8
- package/dist/commands/task/shared.d.ts +5 -0
- package/dist/commands/task/shared.d.ts.map +1 -1
- package/dist/commands/task/shared.js +50 -0
- 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 +48 -11
- 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 +107 -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 +19 -2
- package/dist/commands/upgrade.d.ts.map +1 -1
- package/dist/commands/upgrade.js +281 -85
- 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/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 +3 -3
- 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
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { readFile } from "node:fs/promises";
|
|
3
|
+
import { resolveBaseBranch } from "@agentplaneorg/core";
|
|
4
|
+
import { fileExists } from "../../../../cli/fs-utils.js";
|
|
5
|
+
import { unknownEntityMessage, workflowModeMessage } from "../../../../cli/output.js";
|
|
6
|
+
import { CliError } from "../../../../shared/errors.js";
|
|
7
|
+
import { ensureGitClean } from "../../../guard/index.js";
|
|
8
|
+
import { gitDiffNames, gitShowFile, toGitPath } from "../../../shared/git-diff.js";
|
|
9
|
+
import { gitBranchExists, gitCurrentBranch, gitRevParse } from "../../../shared/git-ops.js";
|
|
10
|
+
import { loadBackendTask, loadCommandContext, } from "../../../shared/task-backend.js";
|
|
11
|
+
import { ensurePlanApprovedIfRequired, ensureVerificationSatisfiedIfRequired, } from "../../../task/shared.js";
|
|
12
|
+
import { resolvePrPaths } from "../../internal/pr-paths.js";
|
|
13
|
+
import { readAndValidatePrArtifacts } from "../artifacts.js";
|
|
14
|
+
import { computeVerifyState } from "../verify.js";
|
|
15
|
+
import { parsePrMeta } from "../../../shared/pr-meta.js";
|
|
16
|
+
export async function prepareIntegrate(opts) {
|
|
17
|
+
const ctx = opts.ctx ??
|
|
18
|
+
(await loadCommandContext({ cwd: opts.cwd, rootOverride: opts.rootOverride ?? null }));
|
|
19
|
+
const { task } = await loadBackendTask({
|
|
20
|
+
ctx,
|
|
21
|
+
cwd: opts.cwd,
|
|
22
|
+
rootOverride: opts.rootOverride,
|
|
23
|
+
taskId: opts.taskId,
|
|
24
|
+
});
|
|
25
|
+
const resolved = ctx.resolvedProject;
|
|
26
|
+
const loadedConfig = ctx.config;
|
|
27
|
+
if (loadedConfig.workflow_mode !== "branch_pr") {
|
|
28
|
+
throw new CliError({
|
|
29
|
+
exitCode: 2,
|
|
30
|
+
code: "E_USAGE",
|
|
31
|
+
message: workflowModeMessage(loadedConfig.workflow_mode, "branch_pr"),
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
ensurePlanApprovedIfRequired(task, loadedConfig);
|
|
35
|
+
ensureVerificationSatisfiedIfRequired(task, loadedConfig);
|
|
36
|
+
await ensureGitClean({ cwd: opts.cwd, rootOverride: opts.rootOverride });
|
|
37
|
+
if (opts.base?.trim().length === 0) {
|
|
38
|
+
throw new CliError({ exitCode: 2, code: "E_USAGE", message: "Invalid value for --base." });
|
|
39
|
+
}
|
|
40
|
+
const baseBranch = await resolveBaseBranch({
|
|
41
|
+
cwd: opts.cwd,
|
|
42
|
+
rootOverride: opts.rootOverride ?? null,
|
|
43
|
+
cliBaseOpt: opts.base ?? null,
|
|
44
|
+
mode: loadedConfig.workflow_mode,
|
|
45
|
+
});
|
|
46
|
+
if (!baseBranch) {
|
|
47
|
+
throw new CliError({
|
|
48
|
+
exitCode: 2,
|
|
49
|
+
code: "E_USAGE",
|
|
50
|
+
message: "Base branch could not be resolved (use `agentplane branch base set` or --base).",
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
const currentBranch = await gitCurrentBranch(resolved.gitRoot);
|
|
54
|
+
if (currentBranch !== baseBranch) {
|
|
55
|
+
throw new CliError({
|
|
56
|
+
exitCode: 5,
|
|
57
|
+
code: "E_GIT",
|
|
58
|
+
message: `integrate must run on base branch ${baseBranch} (current: ${currentBranch})`,
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
const { prDir, metaPath, diffstatPath, verifyLogPath } = await resolvePrPaths({
|
|
62
|
+
ctx,
|
|
63
|
+
cwd: opts.cwd,
|
|
64
|
+
rootOverride: opts.rootOverride,
|
|
65
|
+
taskId: opts.taskId,
|
|
66
|
+
});
|
|
67
|
+
let meta = null;
|
|
68
|
+
let branch = (opts.branch ?? "").trim();
|
|
69
|
+
if (await fileExists(metaPath)) {
|
|
70
|
+
meta = parsePrMeta(await readFile(metaPath, "utf8"), task.id);
|
|
71
|
+
if (!branch)
|
|
72
|
+
branch = (meta.branch ?? "").trim();
|
|
73
|
+
}
|
|
74
|
+
if (!branch) {
|
|
75
|
+
throw new CliError({
|
|
76
|
+
exitCode: 2,
|
|
77
|
+
code: "E_USAGE",
|
|
78
|
+
message: "Branch could not be resolved (use --branch or run `agentplane pr open`).",
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
if (!(await gitBranchExists(resolved.gitRoot, branch))) {
|
|
82
|
+
throw new CliError({
|
|
83
|
+
exitCode: 2,
|
|
84
|
+
code: "E_USAGE",
|
|
85
|
+
message: unknownEntityMessage("branch", branch),
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
const metaSource = meta ??
|
|
89
|
+
parsePrMeta(await gitShowFile(resolved.gitRoot, branch, toGitPath(path.relative(resolved.gitRoot, metaPath))), task.id);
|
|
90
|
+
const baseCandidate = opts.base ?? metaSource.base ?? baseBranch;
|
|
91
|
+
const base = typeof baseCandidate === "string" && baseCandidate.trim().length > 0
|
|
92
|
+
? baseCandidate.trim()
|
|
93
|
+
: baseBranch;
|
|
94
|
+
const { verifyLogText: verifyLogTextMaybe } = await readAndValidatePrArtifacts({
|
|
95
|
+
ctx,
|
|
96
|
+
resolved,
|
|
97
|
+
prDir,
|
|
98
|
+
metaPath,
|
|
99
|
+
branch,
|
|
100
|
+
taskId: task.id,
|
|
101
|
+
});
|
|
102
|
+
// readAndValidatePrArtifacts() throws if verify.log is missing; keep this non-null downstream.
|
|
103
|
+
const verifyLogText = verifyLogTextMaybe;
|
|
104
|
+
const changedPaths = await gitDiffNames(resolved.gitRoot, base, branch);
|
|
105
|
+
const tasksPath = loadedConfig.paths.tasks_path;
|
|
106
|
+
if (changedPaths.includes(tasksPath)) {
|
|
107
|
+
throw new CliError({
|
|
108
|
+
exitCode: 5,
|
|
109
|
+
code: "E_GIT",
|
|
110
|
+
message: `Branch ${branch} modifies ${tasksPath} (single-writer violation)`,
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
const branchHeadSha = await gitRevParse(resolved.gitRoot, [branch]);
|
|
114
|
+
const initialVerifyState = computeVerifyState({
|
|
115
|
+
rawVerify: task.verify,
|
|
116
|
+
metaLastVerifiedSha: metaSource?.last_verified_sha ?? null,
|
|
117
|
+
verifyLogText,
|
|
118
|
+
branchHeadSha,
|
|
119
|
+
runVerify: opts.runVerify,
|
|
120
|
+
});
|
|
121
|
+
return {
|
|
122
|
+
ctx,
|
|
123
|
+
resolved,
|
|
124
|
+
loadedConfig,
|
|
125
|
+
task,
|
|
126
|
+
baseBranch,
|
|
127
|
+
currentBranch,
|
|
128
|
+
prDir,
|
|
129
|
+
metaPath,
|
|
130
|
+
diffstatPath,
|
|
131
|
+
verifyLogPath,
|
|
132
|
+
meta,
|
|
133
|
+
metaSource,
|
|
134
|
+
branch,
|
|
135
|
+
base,
|
|
136
|
+
verifyLogText,
|
|
137
|
+
branchHeadSha,
|
|
138
|
+
verifyCommands: initialVerifyState.verifyCommands,
|
|
139
|
+
alreadyVerifiedSha: initialVerifyState.alreadyVerifiedSha,
|
|
140
|
+
shouldRunVerify: initialVerifyState.shouldRunVerify,
|
|
141
|
+
};
|
|
142
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type IntegrateWorktree = {
|
|
2
|
+
worktreePath: string | null;
|
|
3
|
+
tempWorktreePath: string | null;
|
|
4
|
+
createdTempWorktree: boolean;
|
|
5
|
+
};
|
|
6
|
+
export declare function resolveWorktreeForIntegrate(opts: {
|
|
7
|
+
gitRoot: string;
|
|
8
|
+
worktreesDirRel: string;
|
|
9
|
+
branch: string;
|
|
10
|
+
taskId: string;
|
|
11
|
+
mergeStrategy: "squash" | "merge" | "rebase";
|
|
12
|
+
shouldRunVerify: boolean;
|
|
13
|
+
}): Promise<IntegrateWorktree>;
|
|
14
|
+
//# sourceMappingURL=worktree.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worktree.d.ts","sourceRoot":"","sources":["../../../../../src/commands/pr/integrate/internal/worktree.ts"],"names":[],"mappings":"AASA,MAAM,MAAM,iBAAiB,GAAG;IAC9B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,mBAAmB,EAAE,OAAO,CAAC;CAC9B,CAAC;AAEF,wBAAsB,2BAA2B,CAAC,IAAI,EAAE;IACtD,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,QAAQ,GAAG,OAAO,GAAG,QAAQ,CAAC;IAC7C,eAAe,EAAE,OAAO,CAAC;CAC1B,GAAG,OAAO,CAAC,iBAAiB,CAAC,CA6C7B"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { mkdir } from "node:fs/promises";
|
|
3
|
+
import { fileExists } from "../../../../cli/fs-utils.js";
|
|
4
|
+
import { CliError } from "../../../../shared/errors.js";
|
|
5
|
+
import { execFileAsync, gitEnv } from "../../../shared/git.js";
|
|
6
|
+
import { findWorktreeForBranch } from "../../../shared/git-worktree.js";
|
|
7
|
+
import { isPathWithin } from "../../../shared/path.js";
|
|
8
|
+
export async function resolveWorktreeForIntegrate(opts) {
|
|
9
|
+
let tempWorktreePath = null;
|
|
10
|
+
let createdTempWorktree = false;
|
|
11
|
+
let worktreePath = await findWorktreeForBranch(opts.gitRoot, opts.branch);
|
|
12
|
+
if (opts.mergeStrategy === "rebase" && !worktreePath) {
|
|
13
|
+
throw new CliError({
|
|
14
|
+
exitCode: 2,
|
|
15
|
+
code: "E_USAGE",
|
|
16
|
+
message: "rebase strategy requires an existing worktree for the task branch",
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
if (opts.shouldRunVerify && !worktreePath) {
|
|
20
|
+
const worktreesDir = path.resolve(opts.gitRoot, opts.worktreesDirRel);
|
|
21
|
+
if (!isPathWithin(opts.gitRoot, worktreesDir)) {
|
|
22
|
+
throw new CliError({
|
|
23
|
+
exitCode: 5,
|
|
24
|
+
code: "E_GIT",
|
|
25
|
+
message: `worktrees_dir must be inside the repo: ${worktreesDir}`,
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
tempWorktreePath = path.join(worktreesDir, `_integrate_tmp_${opts.taskId}`);
|
|
29
|
+
const tempExists = await fileExists(tempWorktreePath);
|
|
30
|
+
if (tempExists) {
|
|
31
|
+
const registered = await findWorktreeForBranch(opts.gitRoot, opts.branch);
|
|
32
|
+
if (!registered) {
|
|
33
|
+
throw new CliError({
|
|
34
|
+
exitCode: 5,
|
|
35
|
+
code: "E_GIT",
|
|
36
|
+
message: `Temp worktree path exists but is not registered: ${tempWorktreePath}`,
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
await mkdir(worktreesDir, { recursive: true });
|
|
42
|
+
await execFileAsync("git", ["worktree", "add", tempWorktreePath, opts.branch], {
|
|
43
|
+
cwd: opts.gitRoot,
|
|
44
|
+
env: gitEnv(),
|
|
45
|
+
});
|
|
46
|
+
createdTempWorktree = true;
|
|
47
|
+
}
|
|
48
|
+
worktreePath = tempWorktreePath;
|
|
49
|
+
}
|
|
50
|
+
return { worktreePath, tempWorktreePath, createdTempWorktree };
|
|
51
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export declare function computeVerifyState(opts: {
|
|
2
|
+
rawVerify: unknown;
|
|
3
|
+
metaLastVerifiedSha: unknown;
|
|
4
|
+
verifyLogText: string | null;
|
|
5
|
+
branchHeadSha: string;
|
|
6
|
+
runVerify: boolean;
|
|
7
|
+
}): {
|
|
8
|
+
verifyCommands: string[];
|
|
9
|
+
alreadyVerifiedSha: string | null;
|
|
10
|
+
shouldRunVerify: boolean;
|
|
11
|
+
};
|
|
12
|
+
export declare function runVerifyCommands(opts: {
|
|
13
|
+
commands: string[];
|
|
14
|
+
worktreePath: string;
|
|
15
|
+
branchHeadSha: string;
|
|
16
|
+
quiet: boolean;
|
|
17
|
+
taskId: string;
|
|
18
|
+
}): Promise<{
|
|
19
|
+
header: string;
|
|
20
|
+
content: string;
|
|
21
|
+
}[]>;
|
|
22
|
+
//# sourceMappingURL=verify.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verify.d.ts","sourceRoot":"","sources":["../../../../src/commands/pr/integrate/verify.ts"],"names":[],"mappings":"AAaA,wBAAgB,kBAAkB,CAAC,IAAI,EAAE;IACvC,SAAS,EAAE,OAAO,CAAC;IACnB,mBAAmB,EAAE,OAAO,CAAC;IAC7B,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,OAAO,CAAC;CACpB,GAAG;IACF,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,eAAe,EAAE,OAAO,CAAC;CAC1B,CAgBA;AAED,wBAAsB,iBAAiB,CAAC,IAAI,EAAE;IAC5C,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB,GAAG,OAAO,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,EAAE,CAAC,CA+BjD"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { extractLastVerifiedSha, runShellCommand } from "../../shared/pr-meta.js";
|
|
2
|
+
import { successMessage } from "../../../cli/output.js";
|
|
3
|
+
import { CliError } from "../../../shared/errors.js";
|
|
4
|
+
function normalizeVerifyCommands(rawVerify) {
|
|
5
|
+
return Array.isArray(rawVerify)
|
|
6
|
+
? rawVerify
|
|
7
|
+
.filter((item) => typeof item === "string")
|
|
8
|
+
.map((item) => item.trim())
|
|
9
|
+
.filter(Boolean)
|
|
10
|
+
: [];
|
|
11
|
+
}
|
|
12
|
+
export function computeVerifyState(opts) {
|
|
13
|
+
const verifyCommands = normalizeVerifyCommands(opts.rawVerify);
|
|
14
|
+
let alreadyVerifiedSha = null;
|
|
15
|
+
if (verifyCommands.length > 0) {
|
|
16
|
+
const metaVerified = typeof opts.metaLastVerifiedSha === "string" ? opts.metaLastVerifiedSha : null;
|
|
17
|
+
if (metaVerified && metaVerified === opts.branchHeadSha) {
|
|
18
|
+
alreadyVerifiedSha = opts.branchHeadSha;
|
|
19
|
+
}
|
|
20
|
+
else if (opts.verifyLogText) {
|
|
21
|
+
const logSha = extractLastVerifiedSha(opts.verifyLogText);
|
|
22
|
+
if (logSha && logSha === opts.branchHeadSha)
|
|
23
|
+
alreadyVerifiedSha = logSha;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
const shouldRunVerify = opts.runVerify || (verifyCommands.length > 0 && alreadyVerifiedSha === null);
|
|
27
|
+
return { verifyCommands, alreadyVerifiedSha, shouldRunVerify };
|
|
28
|
+
}
|
|
29
|
+
export async function runVerifyCommands(opts) {
|
|
30
|
+
const verifyEntries = [];
|
|
31
|
+
for (const command of opts.commands) {
|
|
32
|
+
if (!opts.quiet) {
|
|
33
|
+
process.stdout.write(`$ ${command}\n`);
|
|
34
|
+
}
|
|
35
|
+
const timestamp = new Date().toISOString();
|
|
36
|
+
const result = await runShellCommand(command, opts.worktreePath);
|
|
37
|
+
const shaPrefix = opts.branchHeadSha ? `sha=${opts.branchHeadSha} ` : "";
|
|
38
|
+
verifyEntries.push({
|
|
39
|
+
header: `[${timestamp}] ${shaPrefix}$ ${command}`.trimEnd(),
|
|
40
|
+
content: result.output,
|
|
41
|
+
});
|
|
42
|
+
if (result.code !== 0) {
|
|
43
|
+
throw new CliError({
|
|
44
|
+
exitCode: result.code || 1,
|
|
45
|
+
code: "E_IO",
|
|
46
|
+
message: `Verify command failed: ${command}`,
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
if (opts.branchHeadSha) {
|
|
51
|
+
verifyEntries.push({
|
|
52
|
+
header: `[${new Date().toISOString()}] ✅ verified_sha=${opts.branchHeadSha}`,
|
|
53
|
+
content: "",
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
if (!opts.quiet) {
|
|
57
|
+
process.stdout.write(`${successMessage("verify passed", opts.taskId)}\n`);
|
|
58
|
+
}
|
|
59
|
+
return verifyEntries;
|
|
60
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"integrate.d.ts","sourceRoot":"","sources":["../../../src/commands/pr/integrate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { cmdIntegrate } from "./integrate/cmd.js";
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type AgentplaneConfig } from "@agentplaneorg/core";
|
|
2
|
+
import type { CommandContext } from "../../shared/task-backend.js";
|
|
3
|
+
export type ResolvedPrPaths = {
|
|
4
|
+
resolved: {
|
|
5
|
+
gitRoot: string;
|
|
6
|
+
agentplaneDir: string;
|
|
7
|
+
};
|
|
8
|
+
config: AgentplaneConfig;
|
|
9
|
+
prDir: string;
|
|
10
|
+
metaPath: string;
|
|
11
|
+
diffstatPath: string;
|
|
12
|
+
verifyLogPath: string;
|
|
13
|
+
reviewPath: string;
|
|
14
|
+
};
|
|
15
|
+
export declare function resolvePrPaths(opts: {
|
|
16
|
+
ctx?: CommandContext;
|
|
17
|
+
cwd: string;
|
|
18
|
+
rootOverride?: string;
|
|
19
|
+
taskId: string;
|
|
20
|
+
}): Promise<ResolvedPrPaths>;
|
|
21
|
+
export declare function readPrArtifact(opts: {
|
|
22
|
+
resolved: {
|
|
23
|
+
gitRoot: string;
|
|
24
|
+
};
|
|
25
|
+
prDir: string;
|
|
26
|
+
fileName: string;
|
|
27
|
+
branch: string;
|
|
28
|
+
}): Promise<string | null>;
|
|
29
|
+
//# sourceMappingURL=pr-paths.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pr-paths.d.ts","sourceRoot":"","sources":["../../../../src/commands/pr/internal/pr-paths.ts"],"names":[],"mappings":"AAGA,OAAO,EAA8B,KAAK,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAIxF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAEnE,MAAM,MAAM,eAAe,GAAG;IAC5B,QAAQ,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,aAAa,EAAE,MAAM,CAAA;KAAE,CAAC;IACrD,MAAM,EAAE,gBAAgB,CAAC;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,wBAAsB,cAAc,CAAC,IAAI,EAAE;IACzC,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;CAChB,GAAG,OAAO,CAAC,eAAe,CAAC,CAoB3B;AAED,wBAAsB,cAAc,CAAC,IAAI,EAAE;IACzC,QAAQ,EAAE;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;CAChB,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAWzB"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { readFile } from "node:fs/promises";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { loadConfig, resolveProject } from "@agentplaneorg/core";
|
|
4
|
+
import { fileExists } from "../../../cli/fs-utils.js";
|
|
5
|
+
import { gitShowFile, toGitPath } from "../../shared/git-diff.js";
|
|
6
|
+
export async function resolvePrPaths(opts) {
|
|
7
|
+
const resolved = opts.ctx?.resolvedProject ??
|
|
8
|
+
(await resolveProject({ cwd: opts.cwd, rootOverride: opts.rootOverride ?? null }));
|
|
9
|
+
let config = opts.ctx?.config;
|
|
10
|
+
if (!config) {
|
|
11
|
+
const loaded = await loadConfig(resolved.agentplaneDir);
|
|
12
|
+
config = loaded.config;
|
|
13
|
+
}
|
|
14
|
+
const taskDir = path.join(resolved.gitRoot, config.paths.workflow_dir, opts.taskId);
|
|
15
|
+
const prDir = path.join(taskDir, "pr");
|
|
16
|
+
return {
|
|
17
|
+
resolved,
|
|
18
|
+
config,
|
|
19
|
+
prDir,
|
|
20
|
+
metaPath: path.join(prDir, "meta.json"),
|
|
21
|
+
diffstatPath: path.join(prDir, "diffstat.txt"),
|
|
22
|
+
verifyLogPath: path.join(prDir, "verify.log"),
|
|
23
|
+
reviewPath: path.join(prDir, "review.md"),
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export async function readPrArtifact(opts) {
|
|
27
|
+
const filePath = path.join(opts.prDir, opts.fileName);
|
|
28
|
+
if (await fileExists(filePath)) {
|
|
29
|
+
return await readFile(filePath, "utf8");
|
|
30
|
+
}
|
|
31
|
+
const rel = toGitPath(path.relative(opts.resolved.gitRoot, filePath));
|
|
32
|
+
try {
|
|
33
|
+
return await gitShowFile(opts.resolved.gitRoot, opts.branch, rel);
|
|
34
|
+
}
|
|
35
|
+
catch {
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare function renderPrReviewTemplate(opts: {
|
|
2
|
+
author: string;
|
|
3
|
+
createdAt: string;
|
|
4
|
+
branch: string;
|
|
5
|
+
}): string;
|
|
6
|
+
export declare function updateAutoSummaryBlock(text: string, summary: string): string;
|
|
7
|
+
export declare function appendHandoffNote(review: string, note: string): string;
|
|
8
|
+
export declare function validateReviewContents(review: string, errors: string[]): void;
|
|
9
|
+
//# sourceMappingURL=review-template.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"review-template.d.ts","sourceRoot":"","sources":["../../../../src/commands/pr/internal/review-template.ts"],"names":[],"mappings":"AAAA,wBAAgB,sBAAsB,CAAC,IAAI,EAAE;IAC3C,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;CAChB,GAAG,MAAM,CA0BT;AAED,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAW5E;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAQtE;AAED,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,CAW7E"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
export function renderPrReviewTemplate(opts) {
|
|
2
|
+
return [
|
|
3
|
+
"# PR Review",
|
|
4
|
+
"",
|
|
5
|
+
`Opened by ${opts.author} on ${opts.createdAt}`,
|
|
6
|
+
`Branch: ${opts.branch}`,
|
|
7
|
+
"",
|
|
8
|
+
"## Summary",
|
|
9
|
+
"",
|
|
10
|
+
"- ",
|
|
11
|
+
"",
|
|
12
|
+
"## Checklist",
|
|
13
|
+
"",
|
|
14
|
+
"- [ ] Tests added/updated",
|
|
15
|
+
"- [ ] Lint/format passes",
|
|
16
|
+
"- [ ] Verify passed",
|
|
17
|
+
"- [ ] Docs updated (if needed)",
|
|
18
|
+
"",
|
|
19
|
+
"## Handoff Notes",
|
|
20
|
+
"",
|
|
21
|
+
"<!-- Add review notes here. -->",
|
|
22
|
+
"",
|
|
23
|
+
"<!-- BEGIN AUTO SUMMARY -->",
|
|
24
|
+
"<!-- END AUTO SUMMARY -->",
|
|
25
|
+
"",
|
|
26
|
+
].join("\n");
|
|
27
|
+
}
|
|
28
|
+
export function updateAutoSummaryBlock(text, summary) {
|
|
29
|
+
const start = "<!-- BEGIN AUTO SUMMARY -->";
|
|
30
|
+
const end = "<!-- END AUTO SUMMARY -->";
|
|
31
|
+
const startIdx = text.indexOf(start);
|
|
32
|
+
const endIdx = text.indexOf(end);
|
|
33
|
+
if (startIdx === -1 || endIdx === -1 || endIdx < startIdx) {
|
|
34
|
+
return `${text.trimEnd()}\n\n${start}\n${summary}\n${end}\n`;
|
|
35
|
+
}
|
|
36
|
+
const before = text.slice(0, startIdx + start.length);
|
|
37
|
+
const after = text.slice(endIdx);
|
|
38
|
+
return `${before}\n${summary}\n${after}`;
|
|
39
|
+
}
|
|
40
|
+
export function appendHandoffNote(review, note) {
|
|
41
|
+
const marker = "## Handoff Notes";
|
|
42
|
+
const idx = review.indexOf(marker);
|
|
43
|
+
if (idx === -1)
|
|
44
|
+
return `${review.trimEnd()}\n\n${marker}\n\n- ${note}\n`;
|
|
45
|
+
const head = review.slice(0, idx + marker.length);
|
|
46
|
+
const tail = review.slice(idx + marker.length);
|
|
47
|
+
const trimmedTail = tail.startsWith("\n") ? tail.slice(1) : tail;
|
|
48
|
+
return `${head}\n\n- ${note}\n${trimmedTail}`;
|
|
49
|
+
}
|
|
50
|
+
export function validateReviewContents(review, errors) {
|
|
51
|
+
const requiredSections = ["## Summary", "## Checklist", "## Handoff Notes"];
|
|
52
|
+
for (const section of requiredSections) {
|
|
53
|
+
if (!review.includes(section))
|
|
54
|
+
errors.push(`Missing section: ${section}`);
|
|
55
|
+
}
|
|
56
|
+
if (!review.includes("<!-- BEGIN AUTO SUMMARY -->")) {
|
|
57
|
+
errors.push("Missing auto summary start marker");
|
|
58
|
+
}
|
|
59
|
+
if (!review.includes("<!-- END AUTO SUMMARY -->")) {
|
|
60
|
+
errors.push("Missing auto summary end marker");
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type CommandContext } from "../shared/task-backend.js";
|
|
2
|
+
export declare function cmdPrNote(opts: {
|
|
3
|
+
ctx?: CommandContext;
|
|
4
|
+
cwd: string;
|
|
5
|
+
rootOverride?: string;
|
|
6
|
+
taskId: string;
|
|
7
|
+
author: string;
|
|
8
|
+
body: string;
|
|
9
|
+
}): Promise<number>;
|
|
10
|
+
//# sourceMappingURL=note.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"note.d.ts","sourceRoot":"","sources":["../../../src/commands/pr/note.ts"],"names":[],"mappings":"AASA,OAAO,EAAsB,KAAK,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAKpF,wBAAsB,SAAS,CAAC,IAAI,EAAE;IACpC,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd,GAAG,OAAO,CAAC,MAAM,CAAC,CA0ClB"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { readFile } from "node:fs/promises";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { atomicWriteFile } from "@agentplaneorg/core";
|
|
4
|
+
import { mapCoreError } from "../../cli/error-map.js";
|
|
5
|
+
import { fileExists } from "../../cli/fs-utils.js";
|
|
6
|
+
import { successMessage, workflowModeMessage } from "../../cli/output.js";
|
|
7
|
+
import { CliError } from "../../shared/errors.js";
|
|
8
|
+
import { loadCommandContext } from "../shared/task-backend.js";
|
|
9
|
+
import { resolvePrPaths } from "./internal/pr-paths.js";
|
|
10
|
+
import { appendHandoffNote } from "./internal/review-template.js";
|
|
11
|
+
export async function cmdPrNote(opts) {
|
|
12
|
+
try {
|
|
13
|
+
const author = opts.author.trim();
|
|
14
|
+
const body = opts.body.trim();
|
|
15
|
+
if (!author) {
|
|
16
|
+
throw new CliError({ exitCode: 2, code: "E_USAGE", message: "Invalid value for --author." });
|
|
17
|
+
}
|
|
18
|
+
if (!body) {
|
|
19
|
+
throw new CliError({ exitCode: 2, code: "E_USAGE", message: "Invalid value for --body." });
|
|
20
|
+
}
|
|
21
|
+
const ctx = opts.ctx ??
|
|
22
|
+
(await loadCommandContext({ cwd: opts.cwd, rootOverride: opts.rootOverride ?? null }));
|
|
23
|
+
const { config, reviewPath, resolved } = await resolvePrPaths({ ...opts, ctx });
|
|
24
|
+
if (config.workflow_mode !== "branch_pr") {
|
|
25
|
+
throw new CliError({
|
|
26
|
+
exitCode: 2,
|
|
27
|
+
code: "E_USAGE",
|
|
28
|
+
message: workflowModeMessage(config.workflow_mode, "branch_pr"),
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
if (!(await fileExists(reviewPath))) {
|
|
32
|
+
const relReviewPath = path.relative(resolved.gitRoot, reviewPath);
|
|
33
|
+
throw new CliError({
|
|
34
|
+
exitCode: 3,
|
|
35
|
+
code: "E_VALIDATION",
|
|
36
|
+
message: `Missing ${relReviewPath} (run \`agentplane pr open\`)`,
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
const review = await readFile(reviewPath, "utf8");
|
|
40
|
+
const updated = appendHandoffNote(review, `${author}: ${body}`);
|
|
41
|
+
await atomicWriteFile(reviewPath, updated, "utf8");
|
|
42
|
+
process.stdout.write(`${successMessage("pr note", opts.taskId)}\n`);
|
|
43
|
+
return 0;
|
|
44
|
+
}
|
|
45
|
+
catch (err) {
|
|
46
|
+
if (err instanceof CliError)
|
|
47
|
+
throw err;
|
|
48
|
+
throw mapCoreError(err, { command: "pr note", root: opts.rootOverride ?? null });
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type CommandContext } from "../shared/task-backend.js";
|
|
2
|
+
export declare function cmdPrOpen(opts: {
|
|
3
|
+
ctx?: CommandContext;
|
|
4
|
+
cwd: string;
|
|
5
|
+
rootOverride?: string;
|
|
6
|
+
taskId: string;
|
|
7
|
+
author: string;
|
|
8
|
+
branch?: string;
|
|
9
|
+
}): Promise<number>;
|
|
10
|
+
//# sourceMappingURL=open.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"open.d.ts","sourceRoot":"","sources":["../../../src/commands/pr/open.ts"],"names":[],"mappings":"AAYA,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,2BAA2B,CAAC;AASnC,wBAAsB,SAAS,CAAC,IAAI,EAAE;IACpC,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,GAAG,OAAO,CAAC,MAAM,CAAC,CAsElB"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { mkdir, readFile } from "node:fs/promises";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { atomicWriteFile } from "@agentplaneorg/core";
|
|
4
|
+
import { mapBackendError } from "../../cli/error-map.js";
|
|
5
|
+
import { fileExists } from "../../cli/fs-utils.js";
|
|
6
|
+
import { successMessage, workflowModeMessage } from "../../cli/output.js";
|
|
7
|
+
import { CliError } from "../../shared/errors.js";
|
|
8
|
+
import { writeJsonStableIfChanged, writeTextIfChanged } from "../../shared/write-if-changed.js";
|
|
9
|
+
import { gitCurrentBranch } from "../shared/git-ops.js";
|
|
10
|
+
import { parsePrMeta } from "../shared/pr-meta.js";
|
|
11
|
+
import { loadBackendTask, loadCommandContext, } from "../shared/task-backend.js";
|
|
12
|
+
import { resolvePrPaths } from "./internal/pr-paths.js";
|
|
13
|
+
import { renderPrReviewTemplate } from "./internal/review-template.js";
|
|
14
|
+
function nowIso() {
|
|
15
|
+
return new Date().toISOString();
|
|
16
|
+
}
|
|
17
|
+
export async function cmdPrOpen(opts) {
|
|
18
|
+
try {
|
|
19
|
+
const author = opts.author.trim();
|
|
20
|
+
if (!author) {
|
|
21
|
+
throw new CliError({ exitCode: 2, code: "E_USAGE", message: "Invalid value for --author." });
|
|
22
|
+
}
|
|
23
|
+
const ctx = opts.ctx ??
|
|
24
|
+
(await loadCommandContext({ cwd: opts.cwd, rootOverride: opts.rootOverride ?? null }));
|
|
25
|
+
const { task } = await loadBackendTask({
|
|
26
|
+
ctx,
|
|
27
|
+
cwd: opts.cwd,
|
|
28
|
+
rootOverride: opts.rootOverride,
|
|
29
|
+
taskId: opts.taskId,
|
|
30
|
+
});
|
|
31
|
+
const { resolved, config, prDir, metaPath, diffstatPath, verifyLogPath, reviewPath } = await resolvePrPaths({ ...opts, ctx });
|
|
32
|
+
if (config.workflow_mode !== "branch_pr") {
|
|
33
|
+
throw new CliError({
|
|
34
|
+
exitCode: 2,
|
|
35
|
+
code: "E_USAGE",
|
|
36
|
+
message: workflowModeMessage(config.workflow_mode, "branch_pr"),
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
const branch = (opts.branch ?? (await gitCurrentBranch(resolved.gitRoot))).trim();
|
|
40
|
+
if (!branch) {
|
|
41
|
+
throw new CliError({
|
|
42
|
+
exitCode: 2,
|
|
43
|
+
code: "E_USAGE",
|
|
44
|
+
message: "Branch could not be resolved (use --branch).",
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
await mkdir(prDir, { recursive: true });
|
|
48
|
+
const now = nowIso();
|
|
49
|
+
let meta = null;
|
|
50
|
+
if (await fileExists(metaPath)) {
|
|
51
|
+
const raw = await readFile(metaPath, "utf8");
|
|
52
|
+
meta = parsePrMeta(raw, task.id);
|
|
53
|
+
}
|
|
54
|
+
const createdAt = meta?.created_at ?? now;
|
|
55
|
+
const nextMeta = {
|
|
56
|
+
schema_version: 1,
|
|
57
|
+
task_id: task.id,
|
|
58
|
+
branch,
|
|
59
|
+
created_at: createdAt,
|
|
60
|
+
updated_at: now,
|
|
61
|
+
last_verified_sha: meta?.last_verified_sha ?? null,
|
|
62
|
+
last_verified_at: meta?.last_verified_at ?? null,
|
|
63
|
+
verify: meta?.verify ?? { status: "skipped" },
|
|
64
|
+
};
|
|
65
|
+
await writeJsonStableIfChanged(metaPath, nextMeta);
|
|
66
|
+
await writeTextIfChanged(diffstatPath, "");
|
|
67
|
+
await writeTextIfChanged(verifyLogPath, "");
|
|
68
|
+
if (!(await fileExists(reviewPath))) {
|
|
69
|
+
const review = renderPrReviewTemplate({ author, createdAt, branch });
|
|
70
|
+
await atomicWriteFile(reviewPath, review, "utf8");
|
|
71
|
+
}
|
|
72
|
+
process.stdout.write(`${successMessage("pr open", path.relative(resolved.gitRoot, prDir))}\n`);
|
|
73
|
+
return 0;
|
|
74
|
+
}
|
|
75
|
+
catch (err) {
|
|
76
|
+
if (err instanceof CliError)
|
|
77
|
+
throw err;
|
|
78
|
+
throw mapBackendError(err, { command: "pr open", root: opts.rootOverride ?? null });
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { CommandCtx, CommandHandler, CommandSpec } from "../../cli/spec/spec.js";
|
|
2
|
+
import type { CommandContext } from "../shared/task-backend.js";
|
|
3
|
+
type PrGroupParsed = {
|
|
4
|
+
cmd: string[];
|
|
5
|
+
};
|
|
6
|
+
export declare const prSpec: CommandSpec<PrGroupParsed>;
|
|
7
|
+
export type PrOpenParsed = {
|
|
8
|
+
taskId: string;
|
|
9
|
+
author: string;
|
|
10
|
+
branch: string | null;
|
|
11
|
+
};
|
|
12
|
+
export declare const prOpenSpec: CommandSpec<PrOpenParsed>;
|
|
13
|
+
export type PrUpdateParsed = {
|
|
14
|
+
taskId: string;
|
|
15
|
+
};
|
|
16
|
+
export declare const prUpdateSpec: CommandSpec<PrUpdateParsed>;
|
|
17
|
+
export type PrCheckParsed = {
|
|
18
|
+
taskId: string;
|
|
19
|
+
};
|
|
20
|
+
export declare const prCheckSpec: CommandSpec<PrCheckParsed>;
|
|
21
|
+
export type PrNoteParsed = {
|
|
22
|
+
taskId: string;
|
|
23
|
+
author: string;
|
|
24
|
+
body: string;
|
|
25
|
+
};
|
|
26
|
+
export declare const prNoteSpec: CommandSpec<PrNoteParsed>;
|
|
27
|
+
export declare function makeRunPrHandler(getCtx: (cmd: string) => Promise<CommandContext>): CommandHandler<PrGroupParsed>;
|
|
28
|
+
export declare function makeRunPrOpenHandler(getCtx: (cmd: string) => Promise<CommandContext>): (ctx: CommandCtx, p: PrOpenParsed) => Promise<number>;
|
|
29
|
+
export declare function makeRunPrUpdateHandler(getCtx: (cmd: string) => Promise<CommandContext>): (ctx: CommandCtx, p: PrUpdateParsed) => Promise<number>;
|
|
30
|
+
export declare function makeRunPrCheckHandler(getCtx: (cmd: string) => Promise<CommandContext>): (ctx: CommandCtx, p: PrCheckParsed) => Promise<number>;
|
|
31
|
+
export declare function makeRunPrNoteHandler(getCtx: (cmd: string) => Promise<CommandContext>): (ctx: CommandCtx, p: PrNoteParsed) => Promise<number>;
|
|
32
|
+
export {};
|
|
33
|
+
//# sourceMappingURL=pr.command.d.ts.map
|