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,21 @@
|
|
|
1
|
+
import { usageError } from "../../cli/spec/errors.js";
|
|
2
|
+
export const guardSpec = {
|
|
3
|
+
id: ["guard"],
|
|
4
|
+
group: "Guard",
|
|
5
|
+
summary: "Guard commands (commit checks, git hygiene, and allowlist helpers).",
|
|
6
|
+
synopsis: ["agentplane guard <command> [args] [options]"],
|
|
7
|
+
validateRaw: (raw) => {
|
|
8
|
+
if (raw.extra.length > 0) {
|
|
9
|
+
throw usageError({
|
|
10
|
+
spec: guardSpec,
|
|
11
|
+
message: `Unknown subcommand: ${raw.extra[0]}`,
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
throw usageError({ spec: guardSpec, message: "Missing subcommand." });
|
|
15
|
+
},
|
|
16
|
+
parse: () => ({}),
|
|
17
|
+
};
|
|
18
|
+
export const runGuard = () => {
|
|
19
|
+
// Unreachable (validateRaw always throws).
|
|
20
|
+
return Promise.resolve(2);
|
|
21
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type CommandContext } from "../../shared/task-backend.js";
|
|
2
|
+
export declare function suggestAllowPrefixes(paths: string[]): string[];
|
|
3
|
+
export declare function gitStatusChangedPaths(opts: {
|
|
4
|
+
cwd: string;
|
|
5
|
+
rootOverride?: string;
|
|
6
|
+
}): Promise<string[]>;
|
|
7
|
+
export declare function ensureGitClean(opts: {
|
|
8
|
+
ctx?: CommandContext;
|
|
9
|
+
cwd: string;
|
|
10
|
+
rootOverride?: string;
|
|
11
|
+
}): Promise<void>;
|
|
12
|
+
export declare function stageAllowlist(opts: {
|
|
13
|
+
ctx: CommandContext;
|
|
14
|
+
allow: string[];
|
|
15
|
+
allowTasks: boolean;
|
|
16
|
+
tasksPath: string;
|
|
17
|
+
}): Promise<string[]>;
|
|
18
|
+
//# sourceMappingURL=allow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"allow.d.ts","sourceRoot":"","sources":["../../../../src/commands/guard/impl/allow.ts"],"names":[],"mappings":"AAKA,OAAO,EAAsB,KAAK,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAEvF,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAS9D;AAED,wBAAsB,qBAAqB,CAAC,IAAI,EAAE;IAChD,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAOpB;AAED,wBAAsB,cAAc,CAAC,IAAI,EAAE;IACzC,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,GAAG,OAAO,CAAC,IAAI,CAAC,CAiBhB;AAED,wBAAsB,cAAc,CAAC,IAAI,EAAE;IACzC,GAAG,EAAE,cAAc,CAAC;IACpB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;CACnB,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAoCpB"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { resolveProject } from "@agentplaneorg/core";
|
|
2
|
+
import { gitPathIsUnderPrefix, normalizeGitPathPrefix } from "../../../shared/git-path.js";
|
|
3
|
+
import { CliError } from "../../../shared/errors.js";
|
|
4
|
+
import { GitContext } from "../../shared/git-context.js";
|
|
5
|
+
import { loadCommandContext } from "../../shared/task-backend.js";
|
|
6
|
+
export function suggestAllowPrefixes(paths) {
|
|
7
|
+
const out = new Set();
|
|
8
|
+
for (const filePath of paths) {
|
|
9
|
+
if (!filePath)
|
|
10
|
+
continue;
|
|
11
|
+
const idx = filePath.lastIndexOf("/");
|
|
12
|
+
if (idx <= 0)
|
|
13
|
+
out.add(filePath);
|
|
14
|
+
else
|
|
15
|
+
out.add(filePath.slice(0, idx));
|
|
16
|
+
}
|
|
17
|
+
return [...out].toSorted((a, b) => a.localeCompare(b));
|
|
18
|
+
}
|
|
19
|
+
export async function gitStatusChangedPaths(opts) {
|
|
20
|
+
const resolved = await resolveProject({
|
|
21
|
+
cwd: opts.cwd,
|
|
22
|
+
rootOverride: opts.rootOverride ?? null,
|
|
23
|
+
});
|
|
24
|
+
const git = new GitContext({ gitRoot: resolved.gitRoot });
|
|
25
|
+
return await git.statusChangedPaths();
|
|
26
|
+
}
|
|
27
|
+
export async function ensureGitClean(opts) {
|
|
28
|
+
const ctx = opts.ctx ??
|
|
29
|
+
(await loadCommandContext({ cwd: opts.cwd, rootOverride: opts.rootOverride ?? null }));
|
|
30
|
+
const staged = await ctx.git.statusStagedPaths();
|
|
31
|
+
if (staged.length > 0) {
|
|
32
|
+
throw new CliError({ exitCode: 5, code: "E_GIT", message: "Working tree has staged changes" });
|
|
33
|
+
}
|
|
34
|
+
// Policy-defined "clean" ignores untracked files.
|
|
35
|
+
const unstaged = await ctx.git.statusUnstagedTrackedPaths();
|
|
36
|
+
if (unstaged.length > 0) {
|
|
37
|
+
throw new CliError({
|
|
38
|
+
exitCode: 5,
|
|
39
|
+
code: "E_GIT",
|
|
40
|
+
message: "Working tree has unstaged changes",
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
export async function stageAllowlist(opts) {
|
|
45
|
+
const changed = await opts.ctx.git.statusChangedPaths();
|
|
46
|
+
if (changed.length === 0) {
|
|
47
|
+
throw new CliError({
|
|
48
|
+
exitCode: 2,
|
|
49
|
+
code: "E_USAGE",
|
|
50
|
+
message: "No changes to stage (working tree clean)",
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
const allow = opts.allow.map((prefix) => normalizeGitPathPrefix(prefix));
|
|
54
|
+
const denied = new Set();
|
|
55
|
+
if (!opts.allowTasks)
|
|
56
|
+
denied.add(opts.tasksPath);
|
|
57
|
+
const staged = [];
|
|
58
|
+
for (const filePath of changed) {
|
|
59
|
+
if (denied.has(filePath))
|
|
60
|
+
continue;
|
|
61
|
+
if (allow.some((prefix) => gitPathIsUnderPrefix(filePath, prefix))) {
|
|
62
|
+
staged.push(filePath);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
const unique = [...new Set(staged)].toSorted((a, b) => a.localeCompare(b));
|
|
66
|
+
if (unique.length === 0) {
|
|
67
|
+
throw new CliError({
|
|
68
|
+
exitCode: 2,
|
|
69
|
+
code: "E_USAGE",
|
|
70
|
+
message: "No changes matched allowed prefixes (use --commit-auto-allow or update --commit-allow)",
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
// `git add <pathspec>` is not reliable for staging deletes/renames across versions/configs.
|
|
74
|
+
// `-A -- <pathspec...>` makes the allowlist staging semantics deterministic.
|
|
75
|
+
await opts.ctx.git.stage(unique);
|
|
76
|
+
return unique;
|
|
77
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { TaskData } from "../../../backends/task-backend.js";
|
|
2
|
+
export type CloseCommitMessage = {
|
|
3
|
+
subject: string;
|
|
4
|
+
body: string;
|
|
5
|
+
};
|
|
6
|
+
export declare function buildCloseCommitMessage(opts: {
|
|
7
|
+
gitRoot: string;
|
|
8
|
+
task: TaskData;
|
|
9
|
+
keyFilesLimit?: number;
|
|
10
|
+
}): Promise<CloseCommitMessage>;
|
|
11
|
+
export declare function taskReadmePathForTask(opts: {
|
|
12
|
+
gitRoot: string;
|
|
13
|
+
workflowDir: string;
|
|
14
|
+
taskId: string;
|
|
15
|
+
}): string;
|
|
16
|
+
//# sourceMappingURL=close-message.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"close-message.d.ts","sourceRoot":"","sources":["../../../../src/commands/guard/impl/close-message.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAqHlE,MAAM,MAAM,kBAAkB,GAAG;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,wBAAsB,uBAAuB,CAAC,IAAI,EAAE;IAClD,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,QAAQ,CAAC;IACf,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAkD9B;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE;IAC1C,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;CAChB,GAAG,MAAM,CAET"}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { extractTaskSuffix } from "@agentplaneorg/core";
|
|
3
|
+
import { CliError } from "../../../shared/errors.js";
|
|
4
|
+
import { execFileAsync, gitEnv } from "../../shared/git.js";
|
|
5
|
+
function uniqSorted(values) {
|
|
6
|
+
return [...new Set(values)].toSorted((a, b) => a.localeCompare(b));
|
|
7
|
+
}
|
|
8
|
+
function uniqInOrder(values) {
|
|
9
|
+
const seen = new Set();
|
|
10
|
+
const out = [];
|
|
11
|
+
for (const v of values) {
|
|
12
|
+
if (seen.has(v))
|
|
13
|
+
continue;
|
|
14
|
+
seen.add(v);
|
|
15
|
+
out.push(v);
|
|
16
|
+
}
|
|
17
|
+
return out;
|
|
18
|
+
}
|
|
19
|
+
function isTaskArtifactPath(p) {
|
|
20
|
+
const norm = p.replaceAll("\\", "/");
|
|
21
|
+
return norm.startsWith(".agentplane/tasks/") || norm.startsWith("tasks/");
|
|
22
|
+
}
|
|
23
|
+
function normalizeResultFallback(title) {
|
|
24
|
+
const trimmed = title.trim().replaceAll(/\s+/g, " ");
|
|
25
|
+
return trimmed.length > 90 ? `${trimmed.slice(0, 87)}...` : trimmed;
|
|
26
|
+
}
|
|
27
|
+
function clampList(items, max) {
|
|
28
|
+
return items.slice(0, Math.max(0, Math.floor(max)));
|
|
29
|
+
}
|
|
30
|
+
async function gitNumstatForCommit(gitRoot, commit) {
|
|
31
|
+
const { stdout } = await execFileAsync("git", ["show", "--numstat", "--format=", commit], {
|
|
32
|
+
cwd: gitRoot,
|
|
33
|
+
env: gitEnv(),
|
|
34
|
+
encoding: "buffer",
|
|
35
|
+
maxBuffer: 10 * 1024 * 1024,
|
|
36
|
+
});
|
|
37
|
+
const text = Buffer.isBuffer(stdout) ? stdout.toString("utf8") : String(stdout);
|
|
38
|
+
const entries = [];
|
|
39
|
+
for (const line of text.split("\n")) {
|
|
40
|
+
const trimmed = line.trim();
|
|
41
|
+
if (!trimmed)
|
|
42
|
+
continue;
|
|
43
|
+
const parts = trimmed.split("\t");
|
|
44
|
+
if (parts.length < 3)
|
|
45
|
+
continue;
|
|
46
|
+
const [aRaw, dRaw, fileRaw] = parts;
|
|
47
|
+
const file = String(fileRaw ?? "").trim();
|
|
48
|
+
if (!file)
|
|
49
|
+
continue;
|
|
50
|
+
const added = aRaw === "-" ? 0 : Number(aRaw);
|
|
51
|
+
const deleted = dRaw === "-" ? 0 : Number(dRaw);
|
|
52
|
+
const churn = (Number.isFinite(added) ? added : 0) + (Number.isFinite(deleted) ? deleted : 0);
|
|
53
|
+
entries.push({
|
|
54
|
+
file,
|
|
55
|
+
added: Number.isFinite(added) ? added : 0,
|
|
56
|
+
deleted: Number.isFinite(deleted) ? deleted : 0,
|
|
57
|
+
churn,
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
return entries;
|
|
61
|
+
}
|
|
62
|
+
function pickKeyFiles(opts) {
|
|
63
|
+
const sorted = [...opts.entries].toSorted((a, b) => {
|
|
64
|
+
if (b.churn !== a.churn)
|
|
65
|
+
return b.churn - a.churn;
|
|
66
|
+
return a.file.localeCompare(b.file);
|
|
67
|
+
});
|
|
68
|
+
const filtered = sorted.map((e) => e.file).filter((f) => !isTaskArtifactPath(f));
|
|
69
|
+
// Preserve churn ordering while still being deterministic and duplicate-free.
|
|
70
|
+
return clampList(uniqInOrder(filtered), opts.limit);
|
|
71
|
+
}
|
|
72
|
+
function formatTagsForSubject(tags) {
|
|
73
|
+
const norm = uniqSorted(tags.map((t) => t.trim()).filter(Boolean));
|
|
74
|
+
const filtered = norm.filter((t) => t !== "spike");
|
|
75
|
+
const max = 4;
|
|
76
|
+
const shown = filtered.slice(0, max);
|
|
77
|
+
const extra = filtered.length - shown.length;
|
|
78
|
+
if (shown.length === 0)
|
|
79
|
+
return "";
|
|
80
|
+
const base = shown.join(",");
|
|
81
|
+
return extra > 0 ? `[${base},+${extra}]` : `[${base}]`;
|
|
82
|
+
}
|
|
83
|
+
function formatTagsForBody(tags) {
|
|
84
|
+
const norm = uniqSorted(tags.map((t) => t.trim()).filter(Boolean));
|
|
85
|
+
return norm.join(", ");
|
|
86
|
+
}
|
|
87
|
+
function normalizeOneLine(s, maxChars) {
|
|
88
|
+
const trimmed = s.trim().replaceAll(/\s+/g, " ");
|
|
89
|
+
if (!trimmed)
|
|
90
|
+
return "";
|
|
91
|
+
const max = Math.max(1, Math.floor(maxChars));
|
|
92
|
+
return trimmed.length > max ? `${trimmed.slice(0, Math.max(1, max - 3))}...` : trimmed;
|
|
93
|
+
}
|
|
94
|
+
function buildVerifySummary(task, isSpike) {
|
|
95
|
+
if (isSpike)
|
|
96
|
+
return "not required (spike)";
|
|
97
|
+
const state = task.verification?.state ?? "pending";
|
|
98
|
+
const note = typeof task.verification?.note === "string" ? task.verification.note : "";
|
|
99
|
+
if (state === "ok" && note.trim())
|
|
100
|
+
return normalizeOneLine(note, 120);
|
|
101
|
+
const cmds = Array.isArray(task.verify)
|
|
102
|
+
? task.verify.filter((c) => typeof c === "string" && c.trim())
|
|
103
|
+
: [];
|
|
104
|
+
if (cmds.length > 0)
|
|
105
|
+
return cmds.join("; ");
|
|
106
|
+
if (state === "ok")
|
|
107
|
+
return "ok (see task verification note)";
|
|
108
|
+
return String(state);
|
|
109
|
+
}
|
|
110
|
+
export async function buildCloseCommitMessage(opts) {
|
|
111
|
+
const task = opts.task;
|
|
112
|
+
const tags = Array.isArray(task.tags)
|
|
113
|
+
? task.tags.filter((t) => typeof t === "string")
|
|
114
|
+
: [];
|
|
115
|
+
const isSpike = tags.includes("spike");
|
|
116
|
+
if (String(task.status || "").toUpperCase() !== "DONE") {
|
|
117
|
+
throw new CliError({ exitCode: 2, code: "E_USAGE", message: `Task is not DONE: ${task.id}` });
|
|
118
|
+
}
|
|
119
|
+
const implCommit = task.commit?.hash?.trim() ?? "";
|
|
120
|
+
if (!implCommit) {
|
|
121
|
+
throw new CliError({
|
|
122
|
+
exitCode: 2,
|
|
123
|
+
code: "E_USAGE",
|
|
124
|
+
message: `Task is missing recorded commit metadata: ${task.id} (finish with --commit or set commit on the task).`,
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
const suffix = extractTaskSuffix(task.id);
|
|
128
|
+
const resultSummary = typeof task.result_summary === "string" ? task.result_summary.trim() : "";
|
|
129
|
+
const result = resultSummary
|
|
130
|
+
? normalizeResultFallback(resultSummary)
|
|
131
|
+
: `${normalizeResultFallback(task.title)} (no result_summary)`;
|
|
132
|
+
const tagBracket = formatTagsForSubject(tags);
|
|
133
|
+
const emoji = isSpike ? "🧪" : "✅";
|
|
134
|
+
// CommitPolicy requires scope to match: [a-z][a-z0-9_-]* (no punctuation like parentheses).
|
|
135
|
+
// Include the task id as part of the summary for scanability.
|
|
136
|
+
const subject = `${emoji} ${suffix} close: ${result} (${task.id})${tagBracket ? ` ${tagBracket}` : ""}`;
|
|
137
|
+
const verifySummary = buildVerifySummary(task, isSpike);
|
|
138
|
+
const entries = await gitNumstatForCommit(opts.gitRoot, implCommit);
|
|
139
|
+
const keyFiles = pickKeyFiles({ entries, limit: opts.keyFilesLimit ?? 5 });
|
|
140
|
+
const keyFilesText = keyFiles.length > 0 ? keyFiles.join(", ") : "(none)";
|
|
141
|
+
const notes = [];
|
|
142
|
+
if (task.breaking === true)
|
|
143
|
+
notes.push("breaking");
|
|
144
|
+
if (typeof task.risk_level === "string" && task.risk_level.trim())
|
|
145
|
+
notes.push(`risk=${task.risk_level.trim()}`);
|
|
146
|
+
const bodyLines = [
|
|
147
|
+
`Scope: ${formatTagsForBody(tags) || "(none)"}`,
|
|
148
|
+
`Verify: ${verifySummary}`,
|
|
149
|
+
`Key files: ${keyFilesText}`,
|
|
150
|
+
notes.length > 0 ? `Notes: ${notes.join("; ")}` : null,
|
|
151
|
+
].filter((l) => typeof l === "string");
|
|
152
|
+
return { subject, body: bodyLines.join("\n") };
|
|
153
|
+
}
|
|
154
|
+
export function taskReadmePathForTask(opts) {
|
|
155
|
+
return path.join(opts.gitRoot, opts.workflowDir, opts.taskId, "README.md");
|
|
156
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type CommandContext } from "../../shared/task-backend.js";
|
|
2
|
+
import { type GuardCommitOptions } from "./policy.js";
|
|
3
|
+
export declare function cmdGuardClean(opts: {
|
|
4
|
+
cwd: string;
|
|
5
|
+
rootOverride?: string;
|
|
6
|
+
quiet: boolean;
|
|
7
|
+
}): Promise<number>;
|
|
8
|
+
export declare function cmdGuardSuggestAllow(opts: {
|
|
9
|
+
cwd: string;
|
|
10
|
+
rootOverride?: string;
|
|
11
|
+
format: "lines" | "args";
|
|
12
|
+
}): Promise<number>;
|
|
13
|
+
export declare function cmdGuardCommit(opts: GuardCommitOptions): Promise<number>;
|
|
14
|
+
export declare function cmdCommit(opts: {
|
|
15
|
+
ctx?: CommandContext;
|
|
16
|
+
cwd: string;
|
|
17
|
+
rootOverride?: string;
|
|
18
|
+
taskId: string;
|
|
19
|
+
message: string;
|
|
20
|
+
close: boolean;
|
|
21
|
+
allow: string[];
|
|
22
|
+
autoAllow: boolean;
|
|
23
|
+
allowTasks: boolean;
|
|
24
|
+
allowBase: boolean;
|
|
25
|
+
allowPolicy: boolean;
|
|
26
|
+
allowConfig: boolean;
|
|
27
|
+
allowHooks: boolean;
|
|
28
|
+
allowCI: boolean;
|
|
29
|
+
requireClean: boolean;
|
|
30
|
+
quiet: boolean;
|
|
31
|
+
}): Promise<number>;
|
|
32
|
+
//# sourceMappingURL=commands.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../../../src/commands/guard/impl/commands.ts"],"names":[],"mappings":"AAGA,OAAO,EAAsB,KAAK,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAMvF,OAAO,EAAoB,KAAK,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAExE,wBAAsB,aAAa,CAAC,IAAI,EAAE;IACxC,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,OAAO,CAAC;CAChB,GAAG,OAAO,CAAC,MAAM,CAAC,CAsBlB;AAED,wBAAsB,oBAAoB,CAAC,IAAI,EAAE;IAC/C,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,OAAO,GAAG,MAAM,CAAC;CAC1B,GAAG,OAAO,CAAC,MAAM,CAAC,CAyBlB;AAED,wBAAsB,cAAc,CAAC,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC,CAS9E;AAED,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,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;IACnB,WAAW,EAAE,OAAO,CAAC;IACrB,WAAW,EAAE,OAAO,CAAC;IACrB,UAAU,EAAE,OAAO,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;IACjB,YAAY,EAAE,OAAO,CAAC;IACtB,KAAK,EAAE,OAAO,CAAC;CAChB,GAAG,OAAO,CAAC,MAAM,CAAC,CAgIlB"}
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import { mapCoreError } from "../../../cli/error-map.js";
|
|
2
|
+
import { successMessage } from "../../../cli/output.js";
|
|
3
|
+
import { CliError } from "../../../shared/errors.js";
|
|
4
|
+
import { loadCommandContext } from "../../shared/task-backend.js";
|
|
5
|
+
import { loadTaskFromContext } from "../../shared/task-backend.js";
|
|
6
|
+
import { suggestAllowPrefixes } from "./allow.js";
|
|
7
|
+
import { buildCloseCommitMessage, taskReadmePathForTask } from "./close-message.js";
|
|
8
|
+
import { buildGitCommitEnv } from "./env.js";
|
|
9
|
+
import { guardCommitCheck } from "./policy.js";
|
|
10
|
+
export async function cmdGuardClean(opts) {
|
|
11
|
+
try {
|
|
12
|
+
const ctx = await loadCommandContext({
|
|
13
|
+
cwd: opts.cwd,
|
|
14
|
+
rootOverride: opts.rootOverride ?? null,
|
|
15
|
+
});
|
|
16
|
+
const staged = await ctx.git.statusStagedPaths();
|
|
17
|
+
if (staged.length > 0) {
|
|
18
|
+
throw new CliError({
|
|
19
|
+
exitCode: 5,
|
|
20
|
+
code: "E_GIT",
|
|
21
|
+
message: "Staged files exist",
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
if (!opts.quiet) {
|
|
25
|
+
process.stdout.write(`${successMessage("index clean", undefined, "no staged files")}\n`);
|
|
26
|
+
}
|
|
27
|
+
return 0;
|
|
28
|
+
}
|
|
29
|
+
catch (err) {
|
|
30
|
+
if (err instanceof CliError)
|
|
31
|
+
throw err;
|
|
32
|
+
throw mapCoreError(err, { command: "guard clean", root: opts.rootOverride ?? null });
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
export async function cmdGuardSuggestAllow(opts) {
|
|
36
|
+
try {
|
|
37
|
+
const ctx = await loadCommandContext({
|
|
38
|
+
cwd: opts.cwd,
|
|
39
|
+
rootOverride: opts.rootOverride ?? null,
|
|
40
|
+
});
|
|
41
|
+
const staged = await ctx.git.statusStagedPaths();
|
|
42
|
+
if (staged.length === 0) {
|
|
43
|
+
throw new CliError({
|
|
44
|
+
exitCode: 2,
|
|
45
|
+
code: "E_USAGE",
|
|
46
|
+
message: "No staged files (git index empty)",
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
const prefixes = suggestAllowPrefixes(staged);
|
|
50
|
+
if (opts.format === "args") {
|
|
51
|
+
const args = prefixes.map((p) => `--allow ${p}`).join(" ");
|
|
52
|
+
process.stdout.write(`${args}\n`);
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
for (const prefix of prefixes)
|
|
56
|
+
process.stdout.write(`${prefix}\n`);
|
|
57
|
+
}
|
|
58
|
+
return 0;
|
|
59
|
+
}
|
|
60
|
+
catch (err) {
|
|
61
|
+
throw mapCoreError(err, { command: "guard suggest-allow", root: opts.rootOverride ?? null });
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
export async function cmdGuardCommit(opts) {
|
|
65
|
+
try {
|
|
66
|
+
await guardCommitCheck(opts);
|
|
67
|
+
if (!opts.quiet)
|
|
68
|
+
process.stdout.write("OK\n");
|
|
69
|
+
return 0;
|
|
70
|
+
}
|
|
71
|
+
catch (err) {
|
|
72
|
+
if (err instanceof CliError)
|
|
73
|
+
throw err;
|
|
74
|
+
throw mapCoreError(err, { command: "guard commit", root: opts.rootOverride ?? null });
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
export async function cmdCommit(opts) {
|
|
78
|
+
try {
|
|
79
|
+
if (opts.close) {
|
|
80
|
+
const ctx = opts.ctx ??
|
|
81
|
+
(await loadCommandContext({ cwd: opts.cwd, rootOverride: opts.rootOverride ?? null }));
|
|
82
|
+
// Make the close commit deterministic: require empty index, then stage only the task README.
|
|
83
|
+
const staged = await ctx.git.statusStagedPaths();
|
|
84
|
+
if (staged.length > 0) {
|
|
85
|
+
throw new CliError({
|
|
86
|
+
exitCode: 5,
|
|
87
|
+
code: "E_GIT",
|
|
88
|
+
message: "Staged files exist (close commit requires an empty index)",
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
const task = await loadTaskFromContext({ ctx, taskId: opts.taskId });
|
|
92
|
+
const msg = await buildCloseCommitMessage({ gitRoot: ctx.resolvedProject.gitRoot, task });
|
|
93
|
+
const readmeAbs = taskReadmePathForTask({
|
|
94
|
+
gitRoot: ctx.resolvedProject.gitRoot,
|
|
95
|
+
workflowDir: ctx.config.paths.workflow_dir,
|
|
96
|
+
taskId: opts.taskId,
|
|
97
|
+
});
|
|
98
|
+
const readmeRel = readmeAbs.startsWith(ctx.resolvedProject.gitRoot)
|
|
99
|
+
? readmeAbs.slice(ctx.resolvedProject.gitRoot.length + 1)
|
|
100
|
+
: readmeAbs;
|
|
101
|
+
await ctx.git.stage([readmeRel]);
|
|
102
|
+
// Close commits should not require manual --allow flags:
|
|
103
|
+
// the command stages exactly one task README under workflow_dir.
|
|
104
|
+
const allow = [ctx.config.paths.workflow_dir];
|
|
105
|
+
await guardCommitCheck({
|
|
106
|
+
ctx,
|
|
107
|
+
cwd: opts.cwd,
|
|
108
|
+
rootOverride: opts.rootOverride,
|
|
109
|
+
taskId: opts.taskId,
|
|
110
|
+
message: msg.subject,
|
|
111
|
+
allow,
|
|
112
|
+
allowBase: false,
|
|
113
|
+
allowTasks: true,
|
|
114
|
+
allowPolicy: false,
|
|
115
|
+
allowConfig: false,
|
|
116
|
+
allowHooks: false,
|
|
117
|
+
allowCI: false,
|
|
118
|
+
requireClean: true,
|
|
119
|
+
quiet: opts.quiet,
|
|
120
|
+
});
|
|
121
|
+
const env = buildGitCommitEnv({
|
|
122
|
+
taskId: opts.taskId,
|
|
123
|
+
allowTasks: true,
|
|
124
|
+
allowBase: false,
|
|
125
|
+
allowPolicy: false,
|
|
126
|
+
allowConfig: false,
|
|
127
|
+
allowHooks: false,
|
|
128
|
+
allowCI: false,
|
|
129
|
+
});
|
|
130
|
+
await ctx.git.commit({ message: msg.subject, body: msg.body, env });
|
|
131
|
+
if (!opts.quiet) {
|
|
132
|
+
const { hash, subject } = await ctx.git.headHashSubject();
|
|
133
|
+
process.stdout.write(`${successMessage("committed", `${hash?.slice(0, 12) ?? ""} ${subject ?? ""}`.trim())}\n`);
|
|
134
|
+
}
|
|
135
|
+
return 0;
|
|
136
|
+
}
|
|
137
|
+
let allow = opts.allow;
|
|
138
|
+
if (opts.autoAllow && allow.length === 0) {
|
|
139
|
+
const ctx = opts.ctx ??
|
|
140
|
+
(await loadCommandContext({ cwd: opts.cwd, rootOverride: opts.rootOverride ?? null }));
|
|
141
|
+
const staged = await ctx.git.statusStagedPaths();
|
|
142
|
+
const prefixes = suggestAllowPrefixes(staged);
|
|
143
|
+
if (prefixes.length === 0) {
|
|
144
|
+
throw new CliError({
|
|
145
|
+
exitCode: 5,
|
|
146
|
+
code: "E_GIT",
|
|
147
|
+
message: "No staged files (git index empty)",
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
allow = prefixes;
|
|
151
|
+
}
|
|
152
|
+
await guardCommitCheck({
|
|
153
|
+
ctx: opts.ctx,
|
|
154
|
+
cwd: opts.cwd,
|
|
155
|
+
rootOverride: opts.rootOverride,
|
|
156
|
+
taskId: opts.taskId,
|
|
157
|
+
message: opts.message,
|
|
158
|
+
allow,
|
|
159
|
+
allowBase: opts.allowBase,
|
|
160
|
+
allowTasks: opts.allowTasks,
|
|
161
|
+
allowPolicy: opts.allowPolicy,
|
|
162
|
+
allowConfig: opts.allowConfig,
|
|
163
|
+
allowHooks: opts.allowHooks,
|
|
164
|
+
allowCI: opts.allowCI,
|
|
165
|
+
requireClean: opts.requireClean,
|
|
166
|
+
quiet: opts.quiet,
|
|
167
|
+
});
|
|
168
|
+
const ctx = opts.ctx ??
|
|
169
|
+
(await loadCommandContext({ cwd: opts.cwd, rootOverride: opts.rootOverride ?? null }));
|
|
170
|
+
const env = buildGitCommitEnv({
|
|
171
|
+
taskId: opts.taskId,
|
|
172
|
+
allowTasks: opts.allowTasks,
|
|
173
|
+
allowBase: opts.allowBase,
|
|
174
|
+
allowPolicy: opts.allowPolicy,
|
|
175
|
+
allowConfig: opts.allowConfig,
|
|
176
|
+
allowHooks: opts.allowHooks,
|
|
177
|
+
allowCI: opts.allowCI,
|
|
178
|
+
});
|
|
179
|
+
await ctx.git.commit({ message: opts.message, env });
|
|
180
|
+
if (!opts.quiet) {
|
|
181
|
+
const { hash, subject } = await ctx.git.headHashSubject();
|
|
182
|
+
process.stdout.write(`${successMessage("committed", `${hash?.slice(0, 12) ?? ""} ${subject ?? ""}`.trim())}\n`);
|
|
183
|
+
}
|
|
184
|
+
return 0;
|
|
185
|
+
}
|
|
186
|
+
catch (err) {
|
|
187
|
+
if (err instanceof CliError)
|
|
188
|
+
throw err;
|
|
189
|
+
throw mapCoreError(err, { command: "commit", root: opts.rootOverride ?? null });
|
|
190
|
+
}
|
|
191
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type AgentplaneConfig } from "@agentplaneorg/core";
|
|
2
|
+
import { type CommandContext } from "../../shared/task-backend.js";
|
|
3
|
+
export declare function commitFromComment(opts: {
|
|
4
|
+
ctx?: CommandContext;
|
|
5
|
+
cwd: string;
|
|
6
|
+
rootOverride?: string;
|
|
7
|
+
taskId: string;
|
|
8
|
+
author?: string;
|
|
9
|
+
statusFrom?: string;
|
|
10
|
+
statusTo?: string;
|
|
11
|
+
commentBody: string;
|
|
12
|
+
formattedComment: string | null;
|
|
13
|
+
emoji: string;
|
|
14
|
+
allow: string[];
|
|
15
|
+
autoAllow: boolean;
|
|
16
|
+
allowTasks: boolean;
|
|
17
|
+
requireClean: boolean;
|
|
18
|
+
quiet: boolean;
|
|
19
|
+
config: AgentplaneConfig;
|
|
20
|
+
}): Promise<{
|
|
21
|
+
hash: string;
|
|
22
|
+
message: string;
|
|
23
|
+
staged: string[];
|
|
24
|
+
}>;
|
|
25
|
+
//# sourceMappingURL=comment-commit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"comment-commit.d.ts","sourceRoot":"","sources":["../../../../src/commands/guard/impl/comment-commit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAS/E,OAAO,EAAsB,KAAK,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAoEvF,wBAAsB,iBAAiB,CAAC,IAAI,EAAE;IAC5C,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;IACpB,YAAY,EAAE,OAAO,CAAC;IACtB,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,gBAAgB,CAAC;CAC1B,GAAG,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CA4F/D"}
|