agentplane 0.1.8 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/assets/AGENTS.md +294 -72
- package/assets/agents/CODER.json +1 -0
- package/assets/agents/INTEGRATOR.json +1 -0
- package/assets/agents/ORCHESTRATOR.json +1 -0
- package/assets/agents/PLANNER.json +1 -0
- package/assets/agents/TESTER.json +1 -0
- package/dist/backends/task-backend/load.d.ts +13 -0
- package/dist/backends/task-backend/load.d.ts.map +1 -0
- package/dist/backends/task-backend/load.js +58 -0
- package/dist/backends/task-backend/local-backend.d.ts +28 -0
- package/dist/backends/task-backend/local-backend.d.ts.map +1 -0
- package/dist/backends/task-backend/local-backend.js +335 -0
- package/dist/backends/task-backend/redmine/client.d.ts +8 -0
- package/dist/backends/task-backend/redmine/client.d.ts.map +1 -0
- package/dist/backends/task-backend/redmine/client.js +60 -0
- package/dist/backends/task-backend/redmine/comments.d.ts +12 -0
- package/dist/backends/task-backend/redmine/comments.d.ts.map +1 -0
- package/dist/backends/task-backend/redmine/comments.js +54 -0
- package/dist/backends/task-backend/redmine/fields.d.ts +9 -0
- package/dist/backends/task-backend/redmine/fields.d.ts.map +1 -0
- package/dist/backends/task-backend/redmine/fields.js +38 -0
- package/dist/backends/task-backend/redmine/mapping.d.ts +20 -0
- package/dist/backends/task-backend/redmine/mapping.d.ts.map +1 -0
- package/dist/backends/task-backend/redmine/mapping.js +114 -0
- package/dist/backends/task-backend/redmine/parse.d.ts +3 -0
- package/dist/backends/task-backend/redmine/parse.d.ts.map +1 -0
- package/dist/backends/task-backend/redmine/parse.js +27 -0
- package/dist/backends/task-backend/redmine/remote.d.ts +19 -0
- package/dist/backends/task-backend/redmine/remote.d.ts.map +1 -0
- package/dist/backends/task-backend/redmine/remote.js +82 -0
- package/dist/backends/task-backend/redmine-backend.d.ts +80 -0
- package/dist/backends/task-backend/redmine-backend.d.ts.map +1 -0
- package/dist/backends/task-backend/redmine-backend.js +505 -0
- package/dist/backends/task-backend/shared/concurrency.d.ts +3 -0
- package/dist/backends/task-backend/shared/concurrency.d.ts.map +1 -0
- package/dist/backends/task-backend/shared/concurrency.js +21 -0
- package/dist/backends/task-backend/shared/constants.d.ts +4 -0
- package/dist/backends/task-backend/shared/constants.d.ts.map +1 -0
- package/dist/backends/task-backend/shared/constants.js +4 -0
- package/dist/backends/task-backend/shared/doc.d.ts +11 -0
- package/dist/backends/task-backend/shared/doc.d.ts.map +1 -0
- package/dist/backends/task-backend/shared/doc.js +78 -0
- package/dist/backends/task-backend/shared/errors.d.ts +10 -0
- package/dist/backends/task-backend/shared/errors.d.ts.map +1 -0
- package/dist/backends/task-backend/shared/errors.js +18 -0
- package/dist/backends/task-backend/shared/events.d.ts +3 -0
- package/dist/backends/task-backend/shared/events.d.ts.map +1 -0
- package/dist/backends/task-backend/shared/events.js +29 -0
- package/dist/backends/task-backend/shared/export.d.ts +15 -0
- package/dist/backends/task-backend/shared/export.d.ts.map +1 -0
- package/dist/backends/task-backend/shared/export.js +60 -0
- package/dist/backends/task-backend/shared/id.d.ts +13 -0
- package/dist/backends/task-backend/shared/id.d.ts.map +1 -0
- package/dist/backends/task-backend/shared/id.js +17 -0
- package/dist/backends/task-backend/shared/normalize.d.ts +8 -0
- package/dist/backends/task-backend/shared/normalize.d.ts.map +1 -0
- package/dist/backends/task-backend/shared/normalize.js +54 -0
- package/dist/backends/task-backend/shared/record.d.ts +4 -0
- package/dist/backends/task-backend/shared/record.d.ts.map +1 -0
- package/dist/backends/task-backend/shared/record.js +53 -0
- package/dist/backends/task-backend/shared/strings.d.ts +4 -0
- package/dist/backends/task-backend/shared/strings.d.ts.map +1 -0
- package/dist/backends/task-backend/shared/strings.js +21 -0
- package/dist/backends/task-backend/shared/types.d.ts +84 -0
- package/dist/backends/task-backend/shared/types.d.ts.map +1 -0
- package/dist/backends/task-backend/shared/types.js +1 -0
- package/dist/backends/task-backend/shared.d.ts +11 -0
- package/dist/backends/task-backend/shared.d.ts.map +1 -0
- package/dist/backends/task-backend/shared.js +9 -0
- package/dist/backends/task-backend.d.ts +4 -192
- package/dist/backends/task-backend.d.ts.map +1 -1
- package/dist/backends/task-backend.js +4 -1329
- package/dist/backends/task-index.js +2 -2
- package/dist/cli/archive.d.ts +0 -2
- package/dist/cli/archive.d.ts.map +1 -1
- package/dist/cli/archive.js +1 -2
- package/dist/cli/command-guide.d.ts.map +1 -1
- package/dist/cli/command-guide.js +28 -12
- package/dist/cli/parse/lifecycle.d.ts +64 -0
- package/dist/cli/parse/lifecycle.d.ts.map +1 -0
- package/dist/cli/parse/lifecycle.js +280 -0
- package/dist/cli/run-cli/command-catalog.d.ts +16 -0
- package/dist/cli/run-cli/command-catalog.d.ts.map +1 -0
- package/dist/cli/run-cli/command-catalog.js +204 -0
- package/dist/cli/run-cli/commands/config.d.ts +20 -0
- package/dist/cli/run-cli/commands/config.d.ts.map +1 -0
- package/dist/cli/run-cli/commands/config.js +130 -0
- package/dist/cli/run-cli/commands/core.d.ts +14 -0
- package/dist/cli/run-cli/commands/core.d.ts.map +1 -0
- package/dist/cli/run-cli/commands/core.js +144 -0
- package/dist/cli/run-cli/commands/ide.d.ts +13 -0
- package/dist/cli/run-cli/commands/ide.d.ts.map +1 -0
- package/dist/cli/run-cli/commands/ide.js +67 -0
- package/dist/cli/run-cli/commands/init/base-branch.d.ts +9 -0
- package/dist/cli/run-cli/commands/init/base-branch.d.ts.map +1 -0
- package/dist/cli/run-cli/commands/init/base-branch.js +11 -0
- package/dist/cli/run-cli/commands/init/conflicts.d.ts +11 -0
- package/dist/cli/run-cli/commands/init/conflicts.d.ts.map +1 -0
- package/dist/cli/run-cli/commands/init/conflicts.js +42 -0
- package/dist/cli/run-cli/commands/init/git.d.ts +8 -0
- package/dist/cli/run-cli/commands/init/git.d.ts.map +1 -0
- package/dist/cli/run-cli/commands/init/git.js +12 -0
- package/dist/cli/run-cli/commands/init/ide-sync.d.ts +9 -0
- package/dist/cli/run-cli/commands/init/ide-sync.d.ts.map +1 -0
- package/dist/cli/run-cli/commands/init/ide-sync.js +18 -0
- package/dist/cli/run-cli/commands/init/recipes.d.ts +2 -0
- package/dist/cli/run-cli/commands/init/recipes.d.ts.map +1 -0
- package/dist/cli/run-cli/commands/init/recipes.js +11 -0
- package/dist/cli/run-cli/commands/init/write-agents.d.ts +11 -0
- package/dist/cli/run-cli/commands/init/write-agents.d.ts.map +1 -0
- package/dist/cli/run-cli/commands/init/write-agents.js +30 -0
- package/dist/cli/run-cli/commands/init/write-config.d.ts +15 -0
- package/dist/cli/run-cli/commands/init/write-config.d.ts.map +1 -0
- package/dist/cli/run-cli/commands/init/write-config.js +45 -0
- package/dist/cli/run-cli/commands/init.d.ts +21 -0
- package/dist/cli/run-cli/commands/init.d.ts.map +1 -0
- package/dist/cli/run-cli/commands/init.js +332 -0
- package/dist/cli/run-cli/registry.run.d.ts +4 -0
- package/dist/cli/run-cli/registry.run.d.ts.map +1 -0
- package/dist/cli/run-cli/registry.run.js +19 -0
- package/dist/cli/run-cli.d.ts.map +1 -1
- package/dist/cli/run-cli.js +182 -2408
- package/dist/cli/spec/docs-render.d.ts +3 -0
- package/dist/cli/spec/docs-render.d.ts.map +1 -0
- package/dist/cli/spec/docs-render.js +118 -0
- package/dist/cli/spec/errors.d.ts +9 -0
- package/dist/cli/spec/errors.d.ts.map +1 -0
- package/dist/cli/spec/errors.js +18 -0
- package/dist/cli/spec/help-render.d.ts +43 -0
- package/dist/cli/spec/help-render.d.ts.map +1 -0
- package/dist/cli/spec/help-render.js +185 -0
- package/dist/cli/spec/help.d.ts +10 -0
- package/dist/cli/spec/help.d.ts.map +1 -0
- package/dist/cli/spec/help.js +64 -0
- package/dist/cli/spec/parse.d.ts +8 -0
- package/dist/cli/spec/parse.d.ts.map +1 -0
- package/dist/cli/spec/parse.js +188 -0
- package/dist/cli/spec/registry.d.ts +12 -0
- package/dist/cli/spec/registry.d.ts.map +1 -0
- package/dist/cli/spec/registry.js +47 -0
- package/dist/cli/spec/spec.d.ts +76 -0
- package/dist/cli/spec/spec.d.ts.map +1 -0
- package/dist/cli/spec/spec.js +1 -0
- package/dist/cli/spec/suggest.d.ts +2 -0
- package/dist/cli/spec/suggest.d.ts.map +1 -0
- package/dist/cli/spec/suggest.js +45 -0
- package/dist/commands/backend/sync.command.d.ts +12 -0
- package/dist/commands/backend/sync.command.d.ts.map +1 -0
- package/dist/commands/backend/sync.command.js +79 -0
- package/dist/commands/backend.d.ts +21 -8
- package/dist/commands/backend.d.ts.map +1 -1
- package/dist/commands/backend.js +28 -165
- package/dist/commands/block.command.d.ts +19 -0
- package/dist/commands/block.command.d.ts.map +1 -0
- package/dist/commands/block.command.js +143 -0
- package/dist/commands/branch/base.command.d.ts +20 -0
- package/dist/commands/branch/base.command.d.ts.map +1 -0
- package/dist/commands/branch/base.command.js +110 -0
- package/dist/commands/branch/base.d.ts +19 -0
- package/dist/commands/branch/base.d.ts.map +1 -0
- package/dist/commands/branch/base.js +114 -0
- package/dist/commands/branch/cleanup-merged.d.ts +11 -0
- package/dist/commands/branch/cleanup-merged.d.ts.map +1 -0
- package/dist/commands/branch/cleanup-merged.js +141 -0
- package/dist/commands/branch/index.d.ts +6 -59
- package/dist/commands/branch/index.d.ts.map +1 -1
- package/dist/commands/branch/index.js +6 -513
- package/dist/commands/branch/internal/archive-pr.d.ts +2 -0
- package/dist/commands/branch/internal/archive-pr.d.ts.map +1 -0
- package/dist/commands/branch/internal/archive-pr.js +17 -0
- package/dist/commands/branch/internal/work-validate.d.ts +3 -0
- package/dist/commands/branch/internal/work-validate.d.ts.map +1 -0
- package/dist/commands/branch/internal/work-validate.js +27 -0
- package/dist/commands/branch/remove.command.d.ts +10 -0
- package/dist/commands/branch/remove.command.d.ts.map +1 -0
- package/dist/commands/branch/remove.command.js +63 -0
- package/dist/commands/branch/remove.d.ts +9 -0
- package/dist/commands/branch/remove.d.ts.map +1 -0
- package/dist/commands/branch/remove.js +65 -0
- package/dist/commands/branch/status.command.d.ts +8 -0
- package/dist/commands/branch/status.command.d.ts.map +1 -0
- package/dist/commands/branch/status.command.js +36 -0
- package/dist/commands/branch/status.d.ts +7 -0
- package/dist/commands/branch/status.d.ts.map +1 -0
- package/dist/commands/branch/status.js +60 -0
- package/dist/commands/branch/work-start.command.d.ts +11 -0
- package/dist/commands/branch/work-start.command.d.ts.map +1 -0
- package/dist/commands/branch/work-start.command.js +80 -0
- package/dist/commands/branch/work-start.d.ts +11 -0
- package/dist/commands/branch/work-start.d.ts.map +1 -0
- package/dist/commands/branch/work-start.js +120 -0
- package/dist/commands/cleanup/merged.command.d.ts +17 -0
- package/dist/commands/cleanup/merged.command.d.ts.map +1 -0
- package/dist/commands/cleanup/merged.command.js +75 -0
- package/dist/commands/commit.command.d.ts +6 -0
- package/dist/commands/commit.command.d.ts.map +1 -0
- package/dist/commands/commit.command.js +24 -0
- package/dist/commands/commit.spec.d.ts +18 -0
- package/dist/commands/commit.spec.d.ts.map +1 -0
- package/dist/commands/commit.spec.js +119 -0
- package/dist/commands/docs/cli.command.d.ts +9 -0
- package/dist/commands/docs/cli.command.d.ts.map +1 -0
- package/dist/commands/docs/cli.command.js +51 -0
- package/dist/commands/finish.command.d.ts +28 -0
- package/dist/commands/finish.command.d.ts.map +1 -0
- package/dist/commands/finish.command.js +237 -0
- package/dist/commands/guard/clean.command.d.ts +7 -0
- package/dist/commands/guard/clean.command.d.ts.map +1 -0
- package/dist/commands/guard/clean.command.js +14 -0
- package/dist/commands/guard/commit.command.d.ts +19 -0
- package/dist/commands/guard/commit.command.d.ts.map +1 -0
- package/dist/commands/guard/commit.command.js +132 -0
- package/dist/commands/guard/guard.command.d.ts +5 -0
- package/dist/commands/guard/guard.command.d.ts.map +1 -0
- package/dist/commands/guard/guard.command.js +21 -0
- package/dist/commands/guard/impl/allow.d.ts +18 -0
- package/dist/commands/guard/impl/allow.d.ts.map +1 -0
- package/dist/commands/guard/impl/allow.js +77 -0
- package/dist/commands/guard/impl/close-message.d.ts +16 -0
- package/dist/commands/guard/impl/close-message.d.ts.map +1 -0
- package/dist/commands/guard/impl/close-message.js +156 -0
- package/dist/commands/guard/impl/commands.d.ts +32 -0
- package/dist/commands/guard/impl/commands.d.ts.map +1 -0
- package/dist/commands/guard/impl/commands.js +191 -0
- package/dist/commands/guard/impl/comment-commit.d.ts +25 -0
- package/dist/commands/guard/impl/comment-commit.d.ts.map +1 -0
- package/dist/commands/guard/impl/comment-commit.js +137 -0
- package/dist/commands/guard/impl/env.d.ts +10 -0
- package/dist/commands/guard/impl/env.d.ts.map +1 -0
- package/dist/commands/guard/impl/env.js +12 -0
- package/dist/commands/guard/impl/policy.d.ts +19 -0
- package/dist/commands/guard/impl/policy.d.ts.map +1 -0
- package/dist/commands/guard/impl/policy.js +46 -0
- package/dist/commands/guard/index.d.ts +4 -66
- package/dist/commands/guard/index.d.ts.map +1 -1
- package/dist/commands/guard/index.js +4 -367
- package/dist/commands/guard/suggest-allow.command.d.ts +7 -0
- package/dist/commands/guard/suggest-allow.command.d.ts.map +1 -0
- package/dist/commands/guard/suggest-allow.command.js +28 -0
- package/dist/commands/hooks/hooks.command.d.ts +5 -0
- package/dist/commands/hooks/hooks.command.d.ts.map +1 -0
- package/dist/commands/hooks/hooks.command.js +18 -0
- package/dist/commands/hooks/index.d.ts.map +1 -1
- package/dist/commands/hooks/index.js +42 -77
- package/dist/commands/hooks/install.command.d.ts +7 -0
- package/dist/commands/hooks/install.command.d.ts.map +1 -0
- package/dist/commands/hooks/install.command.js +14 -0
- package/dist/commands/hooks/run.command.d.ts +9 -0
- package/dist/commands/hooks/run.command.d.ts.map +1 -0
- package/dist/commands/hooks/run.command.js +39 -0
- package/dist/commands/hooks/uninstall.command.d.ts +7 -0
- package/dist/commands/hooks/uninstall.command.d.ts.map +1 -0
- package/dist/commands/hooks/uninstall.command.js +16 -0
- package/dist/commands/integrate.command.d.ts +14 -0
- package/dist/commands/integrate.command.d.ts.map +1 -0
- package/dist/commands/integrate.command.js +61 -0
- package/dist/commands/pr/check.d.ts +8 -0
- package/dist/commands/pr/check.d.ts.map +1 -0
- package/dist/commands/pr/check.js +78 -0
- package/dist/commands/pr/index.d.ts +5 -45
- package/dist/commands/pr/index.d.ts.map +1 -1
- package/dist/commands/pr/index.js +5 -857
- package/dist/commands/pr/integrate/artifacts.d.ts +14 -0
- package/dist/commands/pr/integrate/artifacts.d.ts.map +1 -0
- package/dist/commands/pr/integrate/artifacts.js +45 -0
- package/dist/commands/pr/integrate/cmd.d.ts +14 -0
- package/dist/commands/pr/integrate/cmd.d.ts.map +1 -0
- package/dist/commands/pr/integrate/cmd.js +150 -0
- package/dist/commands/pr/integrate/internal/finalize.d.ts +25 -0
- package/dist/commands/pr/integrate/internal/finalize.d.ts.map +1 -0
- package/dist/commands/pr/integrate/internal/finalize.js +86 -0
- package/dist/commands/pr/integrate/internal/merge.d.ts +40 -0
- package/dist/commands/pr/integrate/internal/merge.d.ts.map +1 -0
- package/dist/commands/pr/integrate/internal/merge.js +138 -0
- package/dist/commands/pr/integrate/internal/prepare.d.ts +33 -0
- package/dist/commands/pr/integrate/internal/prepare.d.ts.map +1 -0
- package/dist/commands/pr/integrate/internal/prepare.js +142 -0
- package/dist/commands/pr/integrate/internal/worktree.d.ts +14 -0
- package/dist/commands/pr/integrate/internal/worktree.d.ts.map +1 -0
- package/dist/commands/pr/integrate/internal/worktree.js +51 -0
- package/dist/commands/pr/integrate/verify.d.ts +22 -0
- package/dist/commands/pr/integrate/verify.d.ts.map +1 -0
- package/dist/commands/pr/integrate/verify.js +60 -0
- package/dist/commands/pr/integrate.d.ts +2 -0
- package/dist/commands/pr/integrate.d.ts.map +1 -0
- package/dist/commands/pr/integrate.js +1 -0
- package/dist/commands/pr/internal/pr-paths.d.ts +29 -0
- package/dist/commands/pr/internal/pr-paths.d.ts.map +1 -0
- package/dist/commands/pr/internal/pr-paths.js +38 -0
- package/dist/commands/pr/internal/review-template.d.ts +9 -0
- package/dist/commands/pr/internal/review-template.d.ts.map +1 -0
- package/dist/commands/pr/internal/review-template.js +62 -0
- package/dist/commands/pr/note.d.ts +10 -0
- package/dist/commands/pr/note.d.ts.map +1 -0
- package/dist/commands/pr/note.js +50 -0
- package/dist/commands/pr/open.d.ts +10 -0
- package/dist/commands/pr/open.d.ts.map +1 -0
- package/dist/commands/pr/open.js +80 -0
- package/dist/commands/pr/pr.command.d.ts +33 -0
- package/dist/commands/pr/pr.command.d.ts.map +1 -0
- package/dist/commands/pr/pr.command.js +172 -0
- package/dist/commands/pr/update.d.ts +8 -0
- package/dist/commands/pr/update.d.ts.map +1 -0
- package/dist/commands/pr/update.js +103 -0
- package/dist/commands/ready.command.d.ts +8 -0
- package/dist/commands/ready.command.d.ts.map +1 -0
- package/dist/commands/ready.command.js +28 -0
- package/dist/commands/recipes/cache-prune.command.d.ts +6 -0
- package/dist/commands/recipes/cache-prune.command.d.ts.map +1 -0
- package/dist/commands/recipes/cache-prune.command.js +30 -0
- package/dist/commands/recipes/cache.command.d.ts +6 -0
- package/dist/commands/recipes/cache.command.d.ts.map +1 -0
- package/dist/commands/recipes/cache.command.js +37 -0
- package/dist/commands/recipes/explain.command.d.ts +7 -0
- package/dist/commands/recipes/explain.command.d.ts.map +1 -0
- package/dist/commands/recipes/explain.command.js +10 -0
- package/dist/commands/recipes/impl/apply.d.ts +16 -0
- package/dist/commands/recipes/impl/apply.d.ts.map +1 -0
- package/dist/commands/recipes/impl/apply.js +97 -0
- package/dist/commands/recipes/impl/archive.d.ts +2 -0
- package/dist/commands/recipes/impl/archive.d.ts.map +1 -0
- package/dist/commands/recipes/impl/archive.js +19 -0
- package/dist/commands/recipes/impl/commands/cache-prune.d.ts +7 -0
- package/dist/commands/recipes/impl/commands/cache-prune.d.ts.map +1 -0
- package/dist/commands/recipes/impl/commands/cache-prune.js +94 -0
- package/dist/commands/recipes/impl/commands/explain.d.ts +6 -0
- package/dist/commands/recipes/impl/commands/explain.d.ts.map +1 -0
- package/dist/commands/recipes/impl/commands/explain.js +88 -0
- package/dist/commands/recipes/impl/commands/info.d.ts +6 -0
- package/dist/commands/recipes/impl/commands/info.d.ts.map +1 -0
- package/dist/commands/recipes/impl/commands/info.js +58 -0
- package/dist/commands/recipes/impl/commands/install.d.ts +11 -0
- package/dist/commands/recipes/impl/commands/install.d.ts.map +1 -0
- package/dist/commands/recipes/impl/commands/install.js +212 -0
- package/dist/commands/recipes/impl/commands/list-remote.d.ts +7 -0
- package/dist/commands/recipes/impl/commands/list-remote.d.ts.map +1 -0
- package/dist/commands/recipes/impl/commands/list-remote.js +53 -0
- package/dist/commands/recipes/impl/commands/list.d.ts +7 -0
- package/dist/commands/recipes/impl/commands/list.d.ts.map +1 -0
- package/dist/commands/recipes/impl/commands/list.js +38 -0
- package/dist/commands/recipes/impl/commands/remove.d.ts +6 -0
- package/dist/commands/recipes/impl/commands/remove.d.ts.map +1 -0
- package/dist/commands/recipes/impl/commands/remove.js +35 -0
- package/dist/commands/recipes/impl/commands.d.ts +8 -0
- package/dist/commands/recipes/impl/commands.d.ts.map +1 -0
- package/dist/commands/recipes/impl/commands.js +7 -0
- package/dist/commands/recipes/impl/constants.d.ts +13 -0
- package/dist/commands/recipes/impl/constants.d.ts.map +1 -0
- package/dist/commands/recipes/impl/constants.js +16 -0
- package/dist/commands/recipes/impl/format.d.ts +2 -0
- package/dist/commands/recipes/impl/format.d.ts.map +1 -0
- package/dist/commands/recipes/impl/format.js +9 -0
- package/dist/commands/recipes/impl/index.d.ts +12 -0
- package/dist/commands/recipes/impl/index.d.ts.map +1 -0
- package/dist/commands/recipes/impl/index.js +150 -0
- package/dist/commands/recipes/impl/installed-recipes.d.ts +4 -0
- package/dist/commands/recipes/impl/installed-recipes.d.ts.map +1 -0
- package/dist/commands/recipes/impl/installed-recipes.js +58 -0
- package/dist/commands/recipes/impl/manifest.d.ts +4 -0
- package/dist/commands/recipes/impl/manifest.d.ts.map +1 -0
- package/dist/commands/recipes/impl/manifest.js +43 -0
- package/dist/commands/recipes/impl/normalize.d.ts +5 -0
- package/dist/commands/recipes/impl/normalize.d.ts.map +1 -0
- package/dist/commands/recipes/impl/normalize.js +50 -0
- package/dist/commands/recipes/impl/paths.d.ts +13 -0
- package/dist/commands/recipes/impl/paths.d.ts.map +1 -0
- package/dist/commands/recipes/impl/paths.js +27 -0
- package/dist/commands/recipes/impl/project.d.ts +8 -0
- package/dist/commands/recipes/impl/project.d.ts.map +1 -0
- package/dist/commands/recipes/impl/project.js +23 -0
- package/dist/commands/recipes/impl/scenario.d.ts +16 -0
- package/dist/commands/recipes/impl/scenario.d.ts.map +1 -0
- package/dist/commands/recipes/impl/scenario.js +128 -0
- package/dist/commands/recipes/impl/types.d.ts +107 -0
- package/dist/commands/recipes/impl/types.d.ts.map +1 -0
- package/dist/commands/recipes/impl/types.js +1 -0
- package/dist/commands/recipes/info.command.d.ts +7 -0
- package/dist/commands/recipes/info.command.d.ts.map +1 -0
- package/dist/commands/recipes/info.command.js +10 -0
- package/dist/commands/recipes/install.command.d.ts +12 -0
- package/dist/commands/recipes/install.command.d.ts.map +1 -0
- package/dist/commands/recipes/install.command.js +161 -0
- package/dist/commands/recipes/list-remote.command.d.ts +6 -0
- package/dist/commands/recipes/list-remote.command.d.ts.map +1 -0
- package/dist/commands/recipes/list-remote.command.js +46 -0
- package/dist/commands/recipes/list.command.d.ts +6 -0
- package/dist/commands/recipes/list.command.d.ts.map +1 -0
- package/dist/commands/recipes/list.command.js +39 -0
- package/dist/commands/recipes/recipes.command.d.ts +6 -0
- package/dist/commands/recipes/recipes.command.d.ts.map +1 -0
- package/dist/commands/recipes/recipes.command.js +45 -0
- package/dist/commands/recipes/remove.command.d.ts +7 -0
- package/dist/commands/recipes/remove.command.d.ts.map +1 -0
- package/dist/commands/recipes/remove.command.js +10 -0
- package/dist/commands/recipes.d.ts +7 -12
- package/dist/commands/recipes.d.ts.map +1 -1
- package/dist/commands/recipes.js +6 -1963
- package/dist/commands/scenario/impl/commands.d.ts +19 -0
- package/dist/commands/scenario/impl/commands.d.ts.map +1 -0
- package/dist/commands/scenario/impl/commands.js +336 -0
- package/dist/commands/scenario/impl/report.d.ts +30 -0
- package/dist/commands/scenario/impl/report.d.ts.map +1 -0
- package/dist/commands/scenario/impl/report.js +99 -0
- package/dist/commands/scenario/info.command.d.ts +8 -0
- package/dist/commands/scenario/info.command.d.ts.map +1 -0
- package/dist/commands/scenario/info.command.js +27 -0
- package/dist/commands/scenario/list.command.d.ts +5 -0
- package/dist/commands/scenario/list.command.d.ts.map +1 -0
- package/dist/commands/scenario/list.command.js +9 -0
- package/dist/commands/scenario/run.command.d.ts +8 -0
- package/dist/commands/scenario/run.command.d.ts.map +1 -0
- package/dist/commands/scenario/run.command.js +27 -0
- package/dist/commands/scenario/scenario.command.d.ts +6 -0
- package/dist/commands/scenario/scenario.command.d.ts.map +1 -0
- package/dist/commands/scenario/scenario.command.js +37 -0
- package/dist/commands/scenario.d.ts +2 -0
- package/dist/commands/scenario.d.ts.map +1 -0
- package/dist/commands/scenario.js +1 -0
- package/dist/commands/shared/git-context.d.ts +23 -0
- package/dist/commands/shared/git-context.d.ts.map +1 -0
- package/dist/commands/shared/git-context.js +140 -0
- package/dist/commands/shared/policy-deny.d.ts +3 -0
- package/dist/commands/shared/policy-deny.d.ts.map +1 -0
- package/dist/commands/shared/policy-deny.js +12 -0
- package/dist/commands/shared/task-backend.d.ts +31 -3
- package/dist/commands/shared/task-backend.d.ts.map +1 -1
- package/dist/commands/shared/task-backend.js +42 -5
- package/dist/commands/shared/task-store.d.ts +16 -0
- package/dist/commands/shared/task-store.d.ts.map +1 -0
- package/dist/commands/shared/task-store.js +142 -0
- package/dist/commands/start.command.d.ts +19 -0
- package/dist/commands/start.command.d.ts.map +1 -0
- package/dist/commands/start.command.js +143 -0
- package/dist/commands/sync.command.d.ts +6 -0
- package/dist/commands/sync.command.d.ts.map +1 -0
- package/dist/commands/sync.command.js +57 -0
- package/dist/commands/task/add.command.d.ts +18 -0
- package/dist/commands/task/add.command.d.ts.map +1 -0
- package/dist/commands/task/add.command.js +157 -0
- package/dist/commands/task/add.d.ts +13 -3
- package/dist/commands/task/add.d.ts.map +1 -1
- package/dist/commands/task/add.js +21 -126
- package/dist/commands/task/block.d.ts +2 -2
- package/dist/commands/task/block.d.ts.map +1 -1
- package/dist/commands/task/block.js +31 -21
- package/dist/commands/task/comment.command.d.ts +10 -0
- package/dist/commands/task/comment.command.d.ts.map +1 -0
- package/dist/commands/task/comment.command.js +57 -0
- package/dist/commands/task/comment.d.ts +2 -0
- package/dist/commands/task/comment.d.ts.map +1 -1
- package/dist/commands/task/comment.js +19 -9
- package/dist/commands/task/derive.command.d.ts +13 -0
- package/dist/commands/task/derive.command.d.ts.map +1 -0
- package/dist/commands/task/derive.command.js +94 -0
- package/dist/commands/task/derive.d.ts +13 -0
- package/dist/commands/task/derive.d.ts.map +1 -0
- package/dist/commands/task/derive.js +71 -0
- package/dist/commands/task/doc-set.command.d.ts +12 -0
- package/dist/commands/task/doc-set.command.d.ts.map +1 -0
- package/dist/commands/task/doc-set.command.js +82 -0
- package/dist/commands/task/doc-show.command.d.ts +10 -0
- package/dist/commands/task/doc-show.command.d.ts.map +1 -0
- package/dist/commands/task/doc-show.command.js +54 -0
- package/dist/commands/task/doc.command.d.ts +7 -0
- package/dist/commands/task/doc.command.d.ts.map +1 -0
- package/dist/commands/task/doc.command.js +22 -0
- package/dist/commands/task/doc.d.ts +9 -6
- package/dist/commands/task/doc.d.ts.map +1 -1
- package/dist/commands/task/doc.js +61 -113
- package/dist/commands/task/export.command.d.ts +6 -0
- package/dist/commands/task/export.command.d.ts.map +1 -0
- package/dist/commands/task/export.command.js +17 -0
- package/dist/commands/task/export.d.ts +2 -0
- package/dist/commands/task/export.d.ts.map +1 -1
- package/dist/commands/task/export.js +7 -9
- package/dist/commands/task/finish.d.ts +5 -4
- package/dist/commands/task/finish.d.ts.map +1 -1
- package/dist/commands/task/finish.js +80 -37
- package/dist/commands/task/index.d.ts +14 -13
- package/dist/commands/task/index.d.ts.map +1 -1
- package/dist/commands/task/index.js +13 -13
- package/dist/commands/task/lint.command.d.ts +5 -0
- package/dist/commands/task/lint.command.d.ts.map +1 -0
- package/dist/commands/task/lint.command.js +11 -0
- package/dist/commands/task/list.command.d.ts +9 -0
- package/dist/commands/task/list.command.d.ts.map +1 -0
- package/dist/commands/task/list.command.js +68 -0
- package/dist/commands/task/list.d.ts +6 -2
- package/dist/commands/task/list.d.ts.map +1 -1
- package/dist/commands/task/list.js +12 -15
- package/dist/commands/task/migrate-doc.command.d.ts +9 -0
- package/dist/commands/task/migrate-doc.command.d.ts.map +1 -0
- package/dist/commands/task/migrate-doc.command.js +65 -0
- package/dist/commands/task/migrate-doc.d.ts +3 -3
- package/dist/commands/task/migrate-doc.d.ts.map +1 -1
- package/dist/commands/task/migrate-doc.js +40 -47
- package/dist/commands/task/migrate.command.d.ts +10 -0
- package/dist/commands/task/migrate.command.d.ts.map +1 -0
- package/dist/commands/task/migrate.command.js +50 -0
- package/dist/commands/task/migrate.d.ts +5 -1
- package/dist/commands/task/migrate.d.ts.map +1 -1
- package/dist/commands/task/migrate.js +10 -44
- package/dist/commands/task/new.command.d.ts +6 -0
- package/dist/commands/task/new.command.d.ts.map +1 -0
- package/dist/commands/task/new.command.js +13 -0
- package/dist/commands/task/new.d.ts +13 -4
- package/dist/commands/task/new.d.ts.map +1 -1
- package/dist/commands/task/new.js +30 -92
- package/dist/commands/task/new.spec.d.ts +4 -0
- package/dist/commands/task/new.spec.d.ts.map +1 -0
- package/dist/commands/task/new.spec.js +79 -0
- package/dist/commands/task/next.command.d.ts +9 -0
- package/dist/commands/task/next.command.d.ts.map +1 -0
- package/dist/commands/task/next.command.js +89 -0
- package/dist/commands/task/next.d.ts +4 -1
- package/dist/commands/task/next.d.ts.map +1 -1
- package/dist/commands/task/next.js +15 -16
- package/dist/commands/task/normalize.command.d.ts +9 -0
- package/dist/commands/task/normalize.command.d.ts.map +1 -0
- package/dist/commands/task/normalize.command.js +39 -0
- package/dist/commands/task/normalize.d.ts +4 -1
- package/dist/commands/task/normalize.d.ts.map +1 -1
- package/dist/commands/task/normalize.js +18 -31
- package/dist/commands/task/plan-approve.command.d.ts +10 -0
- package/dist/commands/task/plan-approve.command.d.ts.map +1 -0
- package/dist/commands/task/plan-approve.command.js +54 -0
- package/dist/commands/task/plan-reject.command.d.ts +10 -0
- package/dist/commands/task/plan-reject.command.d.ts.map +1 -0
- package/dist/commands/task/plan-reject.command.js +59 -0
- package/dist/commands/task/plan-set.command.d.ts +11 -0
- package/dist/commands/task/plan-set.command.d.ts.map +1 -0
- package/dist/commands/task/plan-set.command.js +76 -0
- package/dist/commands/task/plan.d.ts +23 -10
- package/dist/commands/task/plan.d.ts.map +1 -1
- package/dist/commands/task/plan.js +182 -177
- package/dist/commands/task/ready.d.ts +2 -0
- package/dist/commands/task/ready.d.ts.map +1 -1
- package/dist/commands/task/ready.js +4 -6
- package/dist/commands/task/scaffold.command.d.ts +12 -0
- package/dist/commands/task/scaffold.command.d.ts.map +1 -0
- package/dist/commands/task/scaffold.command.js +73 -0
- package/dist/commands/task/scaffold.d.ts +7 -3
- package/dist/commands/task/scaffold.d.ts.map +1 -1
- package/dist/commands/task/scaffold.js +57 -67
- package/dist/commands/task/scrub.command.d.ts +11 -0
- package/dist/commands/task/scrub.command.d.ts.map +1 -0
- package/dist/commands/task/scrub.command.js +72 -0
- package/dist/commands/task/scrub.d.ts +6 -3
- package/dist/commands/task/scrub.d.ts.map +1 -1
- package/dist/commands/task/scrub.js +12 -68
- package/dist/commands/task/search.command.d.ts +11 -0
- package/dist/commands/task/search.command.d.ts.map +1 -0
- package/dist/commands/task/search.command.js +101 -0
- package/dist/commands/task/search.d.ts +5 -1
- package/dist/commands/task/search.d.ts.map +1 -1
- package/dist/commands/task/search.js +14 -23
- package/dist/commands/task/set-status.command.d.ts +21 -0
- package/dist/commands/task/set-status.command.d.ts.map +1 -0
- package/dist/commands/task/set-status.command.js +171 -0
- package/dist/commands/task/set-status.d.ts +2 -0
- package/dist/commands/task/set-status.d.ts.map +1 -1
- package/dist/commands/task/set-status.js +32 -12
- package/dist/commands/task/shared.d.ts +8 -2
- package/dist/commands/task/shared.d.ts.map +1 -1
- package/dist/commands/task/shared.js +68 -28
- package/dist/commands/task/show.command.d.ts +8 -0
- package/dist/commands/task/show.command.d.ts.map +1 -0
- package/dist/commands/task/show.command.js +19 -0
- package/dist/commands/task/show.d.ts +2 -0
- package/dist/commands/task/show.d.ts.map +1 -1
- package/dist/commands/task/show.js +5 -7
- package/dist/commands/task/start.d.ts +2 -2
- package/dist/commands/task/start.d.ts.map +1 -1
- package/dist/commands/task/start.js +66 -23
- package/dist/commands/task/update.command.d.ts +18 -0
- package/dist/commands/task/update.command.d.ts.map +1 -0
- package/dist/commands/task/update.command.js +141 -0
- package/dist/commands/task/update.d.ts +13 -3
- package/dist/commands/task/update.d.ts.map +1 -1
- package/dist/commands/task/update.js +31 -122
- package/dist/commands/task/verify-ok.command.d.ts +13 -0
- package/dist/commands/task/verify-ok.command.d.ts.map +1 -0
- package/dist/commands/task/verify-ok.command.js +83 -0
- package/dist/commands/task/verify-record.d.ts +30 -8
- package/dist/commands/task/verify-record.d.ts.map +1 -1
- package/dist/commands/task/verify-record.js +114 -117
- package/dist/commands/task/verify-rework.command.d.ts +13 -0
- package/dist/commands/task/verify-rework.command.d.ts.map +1 -0
- package/dist/commands/task/verify-rework.command.js +83 -0
- package/dist/commands/task/verify-show.command.d.ts +9 -0
- package/dist/commands/task/verify-show.command.d.ts.map +1 -0
- package/dist/commands/task/verify-show.command.js +38 -0
- package/dist/commands/task/verify.command.d.ts +7 -0
- package/dist/commands/task/verify.command.d.ts.map +1 -0
- package/dist/commands/task/verify.command.js +20 -0
- package/dist/commands/upgrade.command.d.ts +6 -0
- package/dist/commands/upgrade.command.d.ts.map +1 -0
- package/dist/commands/upgrade.command.js +104 -0
- package/dist/commands/upgrade.d.ts +13 -2
- package/dist/commands/upgrade.d.ts.map +1 -1
- package/dist/commands/upgrade.js +12 -80
- package/dist/commands/verify.command.d.ts +16 -0
- package/dist/commands/verify.command.d.ts.map +1 -0
- package/dist/commands/verify.command.js +113 -0
- package/dist/commands/workflow.d.ts +4 -6
- package/dist/commands/workflow.d.ts.map +1 -1
- package/dist/commands/workflow.js +4 -7
- package/dist/meta/release.d.ts +2 -0
- package/dist/meta/release.d.ts.map +1 -0
- package/dist/meta/release.js +50 -0
- package/dist/policy/evaluate.d.ts +3 -0
- package/dist/policy/evaluate.d.ts.map +1 -0
- package/dist/policy/evaluate.js +27 -0
- package/dist/policy/result.d.ts +7 -0
- package/dist/policy/result.d.ts.map +1 -0
- package/dist/policy/result.js +21 -0
- package/dist/policy/rules/allowlist.d.ts +3 -0
- package/dist/policy/rules/allowlist.d.ts.map +1 -0
- package/dist/policy/rules/allowlist.js +30 -0
- package/dist/policy/rules/branch-pr-base.d.ts +3 -0
- package/dist/policy/rules/branch-pr-base.d.ts.map +1 -0
- package/dist/policy/rules/branch-pr-base.js +43 -0
- package/dist/policy/rules/clean-tree.d.ts +3 -0
- package/dist/policy/rules/clean-tree.d.ts.map +1 -0
- package/dist/policy/rules/clean-tree.js +19 -0
- package/dist/policy/rules/commit-subject.d.ts +3 -0
- package/dist/policy/rules/commit-subject.d.ts.map +1 -0
- package/dist/policy/rules/commit-subject.js +33 -0
- package/dist/policy/rules/protected-paths.d.ts +3 -0
- package/dist/policy/rules/protected-paths.d.ts.map +1 -0
- package/dist/policy/rules/protected-paths.js +53 -0
- package/dist/policy/types.d.ts +38 -0
- package/dist/policy/types.d.ts.map +1 -0
- package/dist/policy/types.js +1 -0
- package/dist/shared/git-log.d.ts +5 -0
- package/dist/shared/git-log.d.ts.map +1 -0
- package/dist/shared/git-log.js +14 -0
- package/dist/shared/git-path.d.ts +3 -0
- package/dist/shared/git-path.d.ts.map +1 -0
- package/dist/shared/git-path.js +30 -0
- package/dist/shared/guards.d.ts +2 -0
- package/dist/shared/guards.d.ts.map +1 -0
- package/dist/shared/guards.js +3 -0
- package/dist/shared/protected-paths.d.ts +12 -0
- package/dist/shared/protected-paths.d.ts.map +1 -0
- package/dist/shared/protected-paths.js +51 -0
- package/dist/shared/strings.d.ts +2 -0
- package/dist/shared/strings.d.ts.map +1 -0
- package/dist/shared/strings.js +14 -0
- package/dist/shared/write-if-changed.d.ts +3 -0
- package/dist/shared/write-if-changed.d.ts.map +1 -0
- package/dist/shared/write-if-changed.js +25 -0
- package/package.json +2 -2
- package/dist/cli/help.d.ts +0 -2
- package/dist/cli/help.d.ts.map +0 -1
- package/dist/cli/help.js +0 -127
- package/dist/commands/task/verify.d.ts +0 -2
- package/dist/commands/task/verify.d.ts.map +0 -1
- package/dist/commands/task/verify.js +0 -1
|
@@ -1,367 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import { formatCommentBodyForCommit } from "../../shared/comment-format.js";
|
|
6
|
-
import { execFileAsync } from "../shared/git.js";
|
|
7
|
-
function pathIsUnder(candidate, prefix) {
|
|
8
|
-
if (prefix === "." || prefix === "")
|
|
9
|
-
return true;
|
|
10
|
-
if (candidate === prefix)
|
|
11
|
-
return true;
|
|
12
|
-
return candidate.startsWith(`${prefix}/`);
|
|
13
|
-
}
|
|
14
|
-
function normalizeAllowPrefix(prefix) {
|
|
15
|
-
return prefix.replace(/\/+$/, "");
|
|
16
|
-
}
|
|
17
|
-
export function suggestAllowPrefixes(paths) {
|
|
18
|
-
const out = new Set();
|
|
19
|
-
for (const filePath of paths) {
|
|
20
|
-
if (!filePath)
|
|
21
|
-
continue;
|
|
22
|
-
const idx = filePath.lastIndexOf("/");
|
|
23
|
-
if (idx <= 0)
|
|
24
|
-
out.add(filePath);
|
|
25
|
-
else
|
|
26
|
-
out.add(filePath.slice(0, idx));
|
|
27
|
-
}
|
|
28
|
-
return [...out].toSorted((a, b) => a.localeCompare(b));
|
|
29
|
-
}
|
|
30
|
-
export const GUARD_COMMIT_USAGE = "Usage: agentplane guard commit <task-id> -m <message> --allow <path> [--allow <path>...] [--auto-allow] [--allow-tasks] [--require-clean] [--quiet]";
|
|
31
|
-
export const GUARD_COMMIT_USAGE_EXAMPLE = 'agentplane guard commit 202602030608-F1Q8AB -m "✨ F1Q8AB update" --allow packages/agentplane';
|
|
32
|
-
export const COMMIT_USAGE = "Usage: agentplane commit <task-id> -m <message>";
|
|
33
|
-
export const COMMIT_USAGE_EXAMPLE = 'agentplane commit 202602030608-F1Q8AB -m "✨ F1Q8AB update"';
|
|
34
|
-
async function guardCommitCheck(opts) {
|
|
35
|
-
const resolved = await resolveProject({
|
|
36
|
-
cwd: opts.cwd,
|
|
37
|
-
rootOverride: opts.rootOverride ?? null,
|
|
38
|
-
});
|
|
39
|
-
const loaded = await loadConfig(resolved.agentplaneDir);
|
|
40
|
-
const policy = validateCommitSubject({
|
|
41
|
-
subject: opts.message,
|
|
42
|
-
taskId: opts.taskId,
|
|
43
|
-
genericTokens: loaded.config.commit.generic_tokens,
|
|
44
|
-
});
|
|
45
|
-
if (!policy.ok) {
|
|
46
|
-
throw new CliError({ exitCode: 5, code: "E_GIT", message: policy.errors.join("\n") });
|
|
47
|
-
}
|
|
48
|
-
const staged = await getStagedFiles({ cwd: opts.cwd, rootOverride: opts.rootOverride ?? null });
|
|
49
|
-
if (staged.length === 0) {
|
|
50
|
-
throw new CliError({
|
|
51
|
-
exitCode: 5,
|
|
52
|
-
code: "E_GIT",
|
|
53
|
-
message: "No staged files (git index empty)",
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
if (opts.allow.length === 0) {
|
|
57
|
-
throw new CliError({
|
|
58
|
-
exitCode: 5,
|
|
59
|
-
code: "E_GIT",
|
|
60
|
-
message: "Provide at least one --allow <path> prefix",
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
const allow = opts.allow.map((prefix) => normalizeAllowPrefix(prefix));
|
|
64
|
-
const denied = new Set();
|
|
65
|
-
if (!opts.allowTasks)
|
|
66
|
-
denied.add(".agentplane/tasks.json");
|
|
67
|
-
if (opts.requireClean) {
|
|
68
|
-
const unstaged = await getUnstagedFiles({
|
|
69
|
-
cwd: opts.cwd,
|
|
70
|
-
rootOverride: opts.rootOverride ?? null,
|
|
71
|
-
});
|
|
72
|
-
if (unstaged.length > 0) {
|
|
73
|
-
throw new CliError({ exitCode: 5, code: "E_GIT", message: "Working tree is dirty" });
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
for (const filePath of staged) {
|
|
77
|
-
if (denied.has(filePath)) {
|
|
78
|
-
throw new CliError({
|
|
79
|
-
exitCode: 5,
|
|
80
|
-
code: "E_GIT",
|
|
81
|
-
message: `Staged file is forbidden by default: ${filePath} (use --allow-tasks to override)`,
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
if (!allow.some((prefix) => pathIsUnder(filePath, prefix))) {
|
|
85
|
-
throw new CliError({
|
|
86
|
-
exitCode: 5,
|
|
87
|
-
code: "E_GIT",
|
|
88
|
-
message: `Staged file is outside allowlist: ${filePath}`,
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
export async function gitStatusChangedPaths(opts) {
|
|
94
|
-
const resolved = await resolveProject({
|
|
95
|
-
cwd: opts.cwd,
|
|
96
|
-
rootOverride: opts.rootOverride ?? null,
|
|
97
|
-
});
|
|
98
|
-
const { stdout } = await execFileAsync("git", ["status", "--porcelain", "-uall"], {
|
|
99
|
-
cwd: resolved.gitRoot,
|
|
100
|
-
});
|
|
101
|
-
const files = [];
|
|
102
|
-
for (const line of stdout.split("\n")) {
|
|
103
|
-
const trimmed = line.trim();
|
|
104
|
-
if (!trimmed)
|
|
105
|
-
continue;
|
|
106
|
-
const filePart = trimmed.slice(2).trim();
|
|
107
|
-
if (!filePart)
|
|
108
|
-
continue;
|
|
109
|
-
const name = filePart.includes("->") ? filePart.split("->").at(-1)?.trim() : filePart;
|
|
110
|
-
if (name)
|
|
111
|
-
files.push(name);
|
|
112
|
-
}
|
|
113
|
-
return files;
|
|
114
|
-
}
|
|
115
|
-
export async function ensureGitClean(opts) {
|
|
116
|
-
const staged = await getStagedFiles({ cwd: opts.cwd, rootOverride: opts.rootOverride ?? null });
|
|
117
|
-
if (staged.length > 0) {
|
|
118
|
-
throw new CliError({ exitCode: 5, code: "E_GIT", message: "Working tree has staged changes" });
|
|
119
|
-
}
|
|
120
|
-
const unstaged = await getUnstagedFiles({
|
|
121
|
-
cwd: opts.cwd,
|
|
122
|
-
rootOverride: opts.rootOverride ?? null,
|
|
123
|
-
});
|
|
124
|
-
if (unstaged.length > 0) {
|
|
125
|
-
throw new CliError({
|
|
126
|
-
exitCode: 5,
|
|
127
|
-
code: "E_GIT",
|
|
128
|
-
message: "Working tree has unstaged changes",
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
async function stageAllowlist(opts) {
|
|
133
|
-
const resolved = await resolveProject({
|
|
134
|
-
cwd: opts.cwd,
|
|
135
|
-
rootOverride: opts.rootOverride ?? null,
|
|
136
|
-
});
|
|
137
|
-
const changed = await gitStatusChangedPaths({ cwd: opts.cwd, rootOverride: opts.rootOverride });
|
|
138
|
-
if (changed.length === 0) {
|
|
139
|
-
throw new CliError({
|
|
140
|
-
exitCode: 2,
|
|
141
|
-
code: "E_USAGE",
|
|
142
|
-
message: "No changes to stage (working tree clean)",
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
const allow = opts.allow.map((prefix) => normalizeAllowPrefix(prefix.trim().replace(/^\.?\//, "")));
|
|
146
|
-
const denied = new Set();
|
|
147
|
-
if (!opts.allowTasks)
|
|
148
|
-
denied.add(".agentplane/tasks.json");
|
|
149
|
-
const staged = [];
|
|
150
|
-
for (const filePath of changed) {
|
|
151
|
-
if (denied.has(filePath))
|
|
152
|
-
continue;
|
|
153
|
-
if (allow.some((prefix) => pathIsUnder(filePath, prefix))) {
|
|
154
|
-
staged.push(filePath);
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
const unique = [...new Set(staged)].toSorted((a, b) => a.localeCompare(b));
|
|
158
|
-
if (unique.length === 0) {
|
|
159
|
-
throw new CliError({
|
|
160
|
-
exitCode: 2,
|
|
161
|
-
code: "E_USAGE",
|
|
162
|
-
message: "No changes matched allowed prefixes (use --commit-auto-allow or update --commit-allow)",
|
|
163
|
-
});
|
|
164
|
-
}
|
|
165
|
-
await execFileAsync("git", ["add", "--", ...unique], { cwd: resolved.gitRoot });
|
|
166
|
-
return unique;
|
|
167
|
-
}
|
|
168
|
-
function deriveCommitMessageFromComment(opts) {
|
|
169
|
-
const summary = (opts.formattedComment ?? formatCommentBodyForCommit(opts.body, opts.config))
|
|
170
|
-
.trim()
|
|
171
|
-
.replaceAll(/\s+/g, " ");
|
|
172
|
-
if (!summary) {
|
|
173
|
-
throw new CliError({
|
|
174
|
-
exitCode: 2,
|
|
175
|
-
code: "E_USAGE",
|
|
176
|
-
message: "Comment body is required to build a commit message from the task comment",
|
|
177
|
-
});
|
|
178
|
-
}
|
|
179
|
-
const prefix = opts.emoji.trim();
|
|
180
|
-
if (!prefix) {
|
|
181
|
-
throw new CliError({
|
|
182
|
-
exitCode: 2,
|
|
183
|
-
code: "E_USAGE",
|
|
184
|
-
message: "Emoji prefix is required when deriving commit messages from task comments",
|
|
185
|
-
});
|
|
186
|
-
}
|
|
187
|
-
const suffix = extractTaskSuffix(opts.taskId);
|
|
188
|
-
if (!suffix) {
|
|
189
|
-
throw new CliError({
|
|
190
|
-
exitCode: 2,
|
|
191
|
-
code: "E_USAGE",
|
|
192
|
-
message: invalidValueMessage("task id", opts.taskId, "valid task id"),
|
|
193
|
-
});
|
|
194
|
-
}
|
|
195
|
-
return `${prefix} ${suffix} ${summary}`;
|
|
196
|
-
}
|
|
197
|
-
export async function commitFromComment(opts) {
|
|
198
|
-
let allowPrefixes = opts.allow.map((prefix) => prefix.trim()).filter(Boolean);
|
|
199
|
-
if (opts.autoAllow && allowPrefixes.length === 0) {
|
|
200
|
-
const changed = await gitStatusChangedPaths({ cwd: opts.cwd, rootOverride: opts.rootOverride });
|
|
201
|
-
allowPrefixes = suggestAllowPrefixes(changed);
|
|
202
|
-
}
|
|
203
|
-
if (allowPrefixes.length === 0) {
|
|
204
|
-
throw new CliError({
|
|
205
|
-
exitCode: 2,
|
|
206
|
-
code: "E_USAGE",
|
|
207
|
-
message: "Provide at least one --commit-allow prefix or enable --commit-auto-allow",
|
|
208
|
-
});
|
|
209
|
-
}
|
|
210
|
-
const staged = await stageAllowlist({
|
|
211
|
-
cwd: opts.cwd,
|
|
212
|
-
rootOverride: opts.rootOverride,
|
|
213
|
-
allow: allowPrefixes,
|
|
214
|
-
allowTasks: opts.allowTasks,
|
|
215
|
-
});
|
|
216
|
-
const message = deriveCommitMessageFromComment({
|
|
217
|
-
taskId: opts.taskId,
|
|
218
|
-
body: opts.commentBody,
|
|
219
|
-
emoji: opts.emoji,
|
|
220
|
-
formattedComment: opts.formattedComment,
|
|
221
|
-
config: opts.config,
|
|
222
|
-
});
|
|
223
|
-
await guardCommitCheck({
|
|
224
|
-
cwd: opts.cwd,
|
|
225
|
-
rootOverride: opts.rootOverride,
|
|
226
|
-
taskId: opts.taskId,
|
|
227
|
-
message,
|
|
228
|
-
allow: allowPrefixes,
|
|
229
|
-
allowTasks: opts.allowTasks,
|
|
230
|
-
requireClean: opts.requireClean,
|
|
231
|
-
quiet: opts.quiet,
|
|
232
|
-
});
|
|
233
|
-
const resolved = await resolveProject({
|
|
234
|
-
cwd: opts.cwd,
|
|
235
|
-
rootOverride: opts.rootOverride ?? null,
|
|
236
|
-
});
|
|
237
|
-
const env = {
|
|
238
|
-
...process.env,
|
|
239
|
-
AGENTPLANE_TASK_ID: opts.taskId,
|
|
240
|
-
AGENTPLANE_ALLOW_TASKS: opts.allowTasks ? "1" : "0",
|
|
241
|
-
AGENTPLANE_ALLOW_BASE: opts.allowTasks ? "1" : "0",
|
|
242
|
-
};
|
|
243
|
-
await execFileAsync("git", ["commit", "-m", message], { cwd: resolved.gitRoot, env });
|
|
244
|
-
const { stdout } = await execFileAsync("git", ["log", "-1", "--pretty=%H:%s"], {
|
|
245
|
-
cwd: resolved.gitRoot,
|
|
246
|
-
});
|
|
247
|
-
const trimmed = stdout.trim();
|
|
248
|
-
const [hash, subject] = trimmed.split(":", 2);
|
|
249
|
-
if (!opts.quiet) {
|
|
250
|
-
process.stdout.write(`${successMessage("committed", `${hash?.slice(0, 12) ?? ""} ${subject ?? ""}`.trim(), `staged=${staged.join(", ")}`)}\n`);
|
|
251
|
-
}
|
|
252
|
-
return { hash: hash ?? "", message: subject ?? "", staged };
|
|
253
|
-
}
|
|
254
|
-
export async function cmdGuardClean(opts) {
|
|
255
|
-
try {
|
|
256
|
-
const staged = await getStagedFiles({ cwd: opts.cwd, rootOverride: opts.rootOverride ?? null });
|
|
257
|
-
if (staged.length > 0) {
|
|
258
|
-
throw new CliError({
|
|
259
|
-
exitCode: 5,
|
|
260
|
-
code: "E_GIT",
|
|
261
|
-
message: "Staged files exist",
|
|
262
|
-
});
|
|
263
|
-
}
|
|
264
|
-
if (!opts.quiet) {
|
|
265
|
-
process.stdout.write(`${successMessage("index clean", undefined, "no staged files")}\n`);
|
|
266
|
-
}
|
|
267
|
-
return 0;
|
|
268
|
-
}
|
|
269
|
-
catch (err) {
|
|
270
|
-
if (err instanceof CliError)
|
|
271
|
-
throw err;
|
|
272
|
-
throw mapCoreError(err, { command: "guard clean", root: opts.rootOverride ?? null });
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
export async function cmdGuardSuggestAllow(opts) {
|
|
276
|
-
try {
|
|
277
|
-
const staged = await getStagedFiles({ cwd: opts.cwd, rootOverride: opts.rootOverride ?? null });
|
|
278
|
-
if (staged.length === 0) {
|
|
279
|
-
throw new CliError({
|
|
280
|
-
exitCode: 2,
|
|
281
|
-
code: "E_USAGE",
|
|
282
|
-
message: "No staged files (git index empty)",
|
|
283
|
-
});
|
|
284
|
-
}
|
|
285
|
-
const prefixes = suggestAllowPrefixes(staged);
|
|
286
|
-
if (opts.format === "args") {
|
|
287
|
-
const args = prefixes.map((p) => `--allow ${p}`).join(" ");
|
|
288
|
-
process.stdout.write(`${args}\n`);
|
|
289
|
-
}
|
|
290
|
-
else {
|
|
291
|
-
for (const prefix of prefixes)
|
|
292
|
-
process.stdout.write(`${prefix}\n`);
|
|
293
|
-
}
|
|
294
|
-
return 0;
|
|
295
|
-
}
|
|
296
|
-
catch (err) {
|
|
297
|
-
throw mapCoreError(err, { command: "guard suggest-allow", root: opts.rootOverride ?? null });
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
export async function cmdGuardCommit(opts) {
|
|
301
|
-
try {
|
|
302
|
-
await guardCommitCheck(opts);
|
|
303
|
-
if (!opts.quiet)
|
|
304
|
-
process.stdout.write("OK\n");
|
|
305
|
-
return 0;
|
|
306
|
-
}
|
|
307
|
-
catch (err) {
|
|
308
|
-
if (err instanceof CliError)
|
|
309
|
-
throw err;
|
|
310
|
-
throw mapCoreError(err, { command: "guard commit", root: opts.rootOverride ?? null });
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
export async function cmdCommit(opts) {
|
|
314
|
-
try {
|
|
315
|
-
let allow = opts.allow;
|
|
316
|
-
if (opts.autoAllow && allow.length === 0) {
|
|
317
|
-
const staged = await getStagedFiles({
|
|
318
|
-
cwd: opts.cwd,
|
|
319
|
-
rootOverride: opts.rootOverride ?? null,
|
|
320
|
-
});
|
|
321
|
-
const prefixes = suggestAllowPrefixes(staged);
|
|
322
|
-
if (prefixes.length === 0) {
|
|
323
|
-
throw new CliError({
|
|
324
|
-
exitCode: 5,
|
|
325
|
-
code: "E_GIT",
|
|
326
|
-
message: "No staged files (git index empty)",
|
|
327
|
-
});
|
|
328
|
-
}
|
|
329
|
-
allow = prefixes;
|
|
330
|
-
}
|
|
331
|
-
await guardCommitCheck({
|
|
332
|
-
cwd: opts.cwd,
|
|
333
|
-
rootOverride: opts.rootOverride,
|
|
334
|
-
taskId: opts.taskId,
|
|
335
|
-
message: opts.message,
|
|
336
|
-
allow,
|
|
337
|
-
allowTasks: opts.allowTasks,
|
|
338
|
-
requireClean: opts.requireClean,
|
|
339
|
-
quiet: opts.quiet,
|
|
340
|
-
});
|
|
341
|
-
const resolved = await resolveProject({
|
|
342
|
-
cwd: opts.cwd,
|
|
343
|
-
rootOverride: opts.rootOverride ?? null,
|
|
344
|
-
});
|
|
345
|
-
const env = {
|
|
346
|
-
...process.env,
|
|
347
|
-
AGENTPLANE_TASK_ID: opts.taskId,
|
|
348
|
-
AGENTPLANE_ALLOW_TASKS: opts.allowTasks ? "1" : "0",
|
|
349
|
-
AGENTPLANE_ALLOW_BASE: opts.allowBase ? "1" : "0",
|
|
350
|
-
};
|
|
351
|
-
await execFileAsync("git", ["commit", "-m", opts.message], { cwd: resolved.gitRoot, env });
|
|
352
|
-
if (!opts.quiet) {
|
|
353
|
-
const { stdout } = await execFileAsync("git", ["log", "-1", "--pretty=%H:%s"], {
|
|
354
|
-
cwd: resolved.gitRoot,
|
|
355
|
-
});
|
|
356
|
-
const trimmed = stdout.trim();
|
|
357
|
-
const [hash, subject] = trimmed.split(":", 2);
|
|
358
|
-
process.stdout.write(`${successMessage("committed", `${hash?.slice(0, 12) ?? ""} ${subject ?? ""}`.trim())}\n`);
|
|
359
|
-
}
|
|
360
|
-
return 0;
|
|
361
|
-
}
|
|
362
|
-
catch (err) {
|
|
363
|
-
if (err instanceof CliError)
|
|
364
|
-
throw err;
|
|
365
|
-
throw mapCoreError(err, { command: "commit", root: opts.rootOverride ?? null });
|
|
366
|
-
}
|
|
367
|
-
}
|
|
1
|
+
export { buildGitCommitEnv } from "./impl/env.js";
|
|
2
|
+
export { ensureGitClean, gitStatusChangedPaths, suggestAllowPrefixes } from "./impl/allow.js";
|
|
3
|
+
export { commitFromComment } from "./impl/comment-commit.js";
|
|
4
|
+
export { cmdCommit, cmdGuardClean, cmdGuardCommit, cmdGuardSuggestAllow } from "./impl/commands.js";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { CommandHandler, CommandSpec } from "../../cli/spec/spec.js";
|
|
2
|
+
export type GuardSuggestAllowParsed = {
|
|
3
|
+
format: "lines" | "args";
|
|
4
|
+
};
|
|
5
|
+
export declare const guardSuggestAllowSpec: CommandSpec<GuardSuggestAllowParsed>;
|
|
6
|
+
export declare const runGuardSuggestAllow: CommandHandler<GuardSuggestAllowParsed>;
|
|
7
|
+
//# sourceMappingURL=suggest-allow.command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"suggest-allow.command.d.ts","sourceRoot":"","sources":["../../../src/commands/guard/suggest-allow.command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAG1E,MAAM,MAAM,uBAAuB,GAAG;IAAE,MAAM,EAAE,OAAO,GAAG,MAAM,CAAA;CAAE,CAAC;AAEnE,eAAO,MAAM,qBAAqB,EAAE,WAAW,CAAC,uBAAuB,CAmBtE,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,cAAc,CAAC,uBAAuB,CAMxE,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { cmdGuardSuggestAllow } from "./index.js";
|
|
2
|
+
export const guardSuggestAllowSpec = {
|
|
3
|
+
id: ["guard", "suggest-allow"],
|
|
4
|
+
group: "Guard",
|
|
5
|
+
summary: "Suggest minimal --allow prefixes based on staged files.",
|
|
6
|
+
options: [
|
|
7
|
+
{
|
|
8
|
+
kind: "string",
|
|
9
|
+
name: "format",
|
|
10
|
+
valueHint: "<lines|args>",
|
|
11
|
+
choices: ["lines", "args"],
|
|
12
|
+
default: "lines",
|
|
13
|
+
description: "Output format (default: lines).",
|
|
14
|
+
},
|
|
15
|
+
],
|
|
16
|
+
examples: [
|
|
17
|
+
{ cmd: "agentplane guard suggest-allow", why: "Print prefixes, one per line." },
|
|
18
|
+
{ cmd: "agentplane guard suggest-allow --format args", why: "Print as --allow ... args." },
|
|
19
|
+
],
|
|
20
|
+
parse: (raw) => ({ format: (raw.opts.format ?? "lines") }),
|
|
21
|
+
};
|
|
22
|
+
export const runGuardSuggestAllow = async (ctx, p) => {
|
|
23
|
+
return await cmdGuardSuggestAllow({
|
|
24
|
+
cwd: ctx.cwd,
|
|
25
|
+
rootOverride: ctx.rootOverride,
|
|
26
|
+
format: p.format,
|
|
27
|
+
});
|
|
28
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { CommandHandler, CommandSpec } from "../../cli/spec/spec.js";
|
|
2
|
+
export type HooksGroupParsed = Record<string, never>;
|
|
3
|
+
export declare const hooksSpec: CommandSpec<HooksGroupParsed>;
|
|
4
|
+
export declare const runHooks: CommandHandler<HooksGroupParsed>;
|
|
5
|
+
//# sourceMappingURL=hooks.command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hooks.command.d.ts","sourceRoot":"","sources":["../../../src/commands/hooks/hooks.command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAG1E,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AAErD,eAAO,MAAM,SAAS,EAAE,WAAW,CAAC,gBAAgB,CAYnD,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,cAAc,CAAC,gBAAgB,CAGrD,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { usageError } from "../../cli/spec/errors.js";
|
|
2
|
+
export const hooksSpec = {
|
|
3
|
+
id: ["hooks"],
|
|
4
|
+
group: "Hooks",
|
|
5
|
+
summary: "Manage and run git hooks installed by agentplane.",
|
|
6
|
+
synopsis: ["agentplane hooks <command> [args] [options]"],
|
|
7
|
+
validateRaw: (raw) => {
|
|
8
|
+
if (raw.extra.length > 0) {
|
|
9
|
+
throw usageError({ spec: hooksSpec, message: `Unknown subcommand: ${raw.extra[0]}` });
|
|
10
|
+
}
|
|
11
|
+
throw usageError({ spec: hooksSpec, message: "Missing subcommand." });
|
|
12
|
+
},
|
|
13
|
+
parse: () => ({}),
|
|
14
|
+
};
|
|
15
|
+
export const runHooks = () => {
|
|
16
|
+
// Unreachable (validateRaw always throws).
|
|
17
|
+
return Promise.resolve(2);
|
|
18
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/hooks/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/hooks/index.ts"],"names":[],"mappings":"AAgBA,eAAO,MAAM,UAAU,mDAAoD,CAAC;AAgG5E,wBAAsB,eAAe,CAAC,IAAI,EAAE;IAC1C,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,OAAO,CAAC;CAChB,GAAG,OAAO,CAAC,MAAM,CAAC,CAmClB;AAED,wBAAsB,iBAAiB,CAAC,IAAI,EAAE;IAC5C,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,OAAO,CAAC;CAChB,GAAG,OAAO,CAAC,MAAM,CAAC,CA4BlB;AAED,wBAAsB,WAAW,CAAC,IAAI,EAAE;IACtC,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,IAAI,EAAE,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC;IAClC,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB,GAAG,OAAO,CAAC,MAAM,CAAC,CA2FlB"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { chmod, mkdir, readFile, rm, writeFile } from "node:fs/promises";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { getStagedFiles, loadConfig, resolveBaseBranch, resolveProject } from "@agentplaneorg/core";
|
|
4
|
-
import {
|
|
4
|
+
import { evaluatePolicy } from "../../policy/evaluate.js";
|
|
5
5
|
import { mapBackendError, mapCoreError } from "../../cli/error-map.js";
|
|
6
6
|
import { fileExists } from "../../cli/fs-utils.js";
|
|
7
7
|
import { infoMessage, successMessage } from "../../cli/output.js";
|
|
8
8
|
import { CliError } from "../../shared/errors.js";
|
|
9
|
+
import { throwIfPolicyDenied } from "../shared/policy-deny.js";
|
|
9
10
|
import { gitCurrentBranch, gitRevParse } from "../shared/git-ops.js";
|
|
10
11
|
import { isPathWithin } from "../shared/path.js";
|
|
11
12
|
const HOOK_MARKER = "agentplane-hook";
|
|
@@ -96,10 +97,6 @@ function readCommitSubject(message) {
|
|
|
96
97
|
}
|
|
97
98
|
return "";
|
|
98
99
|
}
|
|
99
|
-
function subjectHasSuffix(subject, suffixes) {
|
|
100
|
-
const lowered = subject.toLowerCase();
|
|
101
|
-
return suffixes.some((suffix) => suffix && lowered.includes(suffix.toLowerCase()));
|
|
102
|
-
}
|
|
103
100
|
export async function cmdHooksInstall(opts) {
|
|
104
101
|
try {
|
|
105
102
|
const resolved = await resolveProject({
|
|
@@ -180,45 +177,20 @@ export async function cmdHooksRun(opts) {
|
|
|
180
177
|
}
|
|
181
178
|
const raw = await readFile(messagePath, "utf8");
|
|
182
179
|
const subject = readCommitSubject(raw);
|
|
183
|
-
|
|
184
|
-
throw new CliError({
|
|
185
|
-
exitCode: 5,
|
|
186
|
-
code: "E_GIT",
|
|
187
|
-
message: "Commit message subject is empty",
|
|
188
|
-
});
|
|
189
|
-
}
|
|
190
|
-
const taskId = (process.env.AGENTPLANE_TASK_ID ?? "").trim();
|
|
191
|
-
if (taskId) {
|
|
192
|
-
const suffix = taskId.split("-").at(-1) ?? "";
|
|
193
|
-
if (!subject.includes(taskId) && (suffix.length === 0 || !subject.includes(suffix))) {
|
|
194
|
-
throw new CliError({
|
|
195
|
-
exitCode: 5,
|
|
196
|
-
code: "E_GIT",
|
|
197
|
-
message: "Commit subject must include task id or suffix",
|
|
198
|
-
});
|
|
199
|
-
}
|
|
200
|
-
return 0;
|
|
201
|
-
}
|
|
202
|
-
const { backend } = await loadTaskBackend({
|
|
180
|
+
const resolved = await resolveProject({
|
|
203
181
|
cwd: opts.cwd,
|
|
204
182
|
rootOverride: opts.rootOverride ?? null,
|
|
205
183
|
});
|
|
206
|
-
const
|
|
207
|
-
const
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
throw new CliError({
|
|
217
|
-
exitCode: 5,
|
|
218
|
-
code: "E_GIT",
|
|
219
|
-
message: "Commit subject must mention a task suffix",
|
|
220
|
-
});
|
|
221
|
-
}
|
|
184
|
+
const loaded = await loadConfig(resolved.agentplaneDir);
|
|
185
|
+
const taskId = (process.env.AGENTPLANE_TASK_ID ?? "").trim();
|
|
186
|
+
const res = evaluatePolicy({
|
|
187
|
+
action: "hook_commit_msg",
|
|
188
|
+
config: loaded.config,
|
|
189
|
+
taskId,
|
|
190
|
+
git: { stagedPaths: [] },
|
|
191
|
+
commit: { subject },
|
|
192
|
+
});
|
|
193
|
+
throwIfPolicyDenied(res);
|
|
222
194
|
return 0;
|
|
223
195
|
}
|
|
224
196
|
if (opts.hook === "pre-commit") {
|
|
@@ -230,51 +202,44 @@ export async function cmdHooksRun(opts) {
|
|
|
230
202
|
return 0;
|
|
231
203
|
const allowTasks = (process.env.AGENTPLANE_ALLOW_TASKS ?? "").trim() === "1";
|
|
232
204
|
const allowBase = (process.env.AGENTPLANE_ALLOW_BASE ?? "").trim() === "1";
|
|
205
|
+
const allowPolicy = (process.env.AGENTPLANE_ALLOW_POLICY ?? "").trim() === "1";
|
|
206
|
+
const allowConfig = (process.env.AGENTPLANE_ALLOW_CONFIG ?? "").trim() === "1";
|
|
207
|
+
const allowHooks = (process.env.AGENTPLANE_ALLOW_HOOKS ?? "").trim() === "1";
|
|
208
|
+
const allowCI = (process.env.AGENTPLANE_ALLOW_CI ?? "").trim() === "1";
|
|
233
209
|
const resolved = await resolveProject({
|
|
234
210
|
cwd: opts.cwd,
|
|
235
211
|
rootOverride: opts.rootOverride ?? null,
|
|
236
212
|
});
|
|
237
213
|
const loaded = await loadConfig(resolved.agentplaneDir);
|
|
238
|
-
const
|
|
239
|
-
const
|
|
240
|
-
|
|
241
|
-
if (tasksStaged && !allowTasks) {
|
|
242
|
-
throw new CliError({
|
|
243
|
-
exitCode: 5,
|
|
244
|
-
code: "E_GIT",
|
|
245
|
-
message: `${tasksPath} is protected by agentplane hooks (set AGENTPLANE_ALLOW_TASKS=1 to override)`,
|
|
246
|
-
});
|
|
247
|
-
}
|
|
248
|
-
if (loaded.config.workflow_mode === "branch_pr") {
|
|
249
|
-
const baseBranch = await resolveBaseBranch({
|
|
214
|
+
const inBranchPr = loaded.config.workflow_mode === "branch_pr";
|
|
215
|
+
const baseBranch = inBranchPr
|
|
216
|
+
? await resolveBaseBranch({
|
|
250
217
|
cwd: opts.cwd,
|
|
251
218
|
rootOverride: opts.rootOverride ?? null,
|
|
252
219
|
cliBaseOpt: null,
|
|
253
220
|
mode: loaded.config.workflow_mode,
|
|
254
|
-
})
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
}
|
|
277
|
-
}
|
|
221
|
+
})
|
|
222
|
+
: null;
|
|
223
|
+
const currentBranch = inBranchPr ? await gitCurrentBranch(resolved.gitRoot) : undefined;
|
|
224
|
+
const res = evaluatePolicy({
|
|
225
|
+
action: "hook_pre_commit",
|
|
226
|
+
config: loaded.config,
|
|
227
|
+
taskId: (process.env.AGENTPLANE_TASK_ID ?? "").trim(),
|
|
228
|
+
git: {
|
|
229
|
+
stagedPaths: staged,
|
|
230
|
+
currentBranch,
|
|
231
|
+
baseBranch,
|
|
232
|
+
},
|
|
233
|
+
allow: {
|
|
234
|
+
allowTasks,
|
|
235
|
+
allowBase,
|
|
236
|
+
allowPolicy,
|
|
237
|
+
allowConfig,
|
|
238
|
+
allowHooks,
|
|
239
|
+
allowCI,
|
|
240
|
+
},
|
|
241
|
+
});
|
|
242
|
+
throwIfPolicyDenied(res);
|
|
278
243
|
return 0;
|
|
279
244
|
}
|
|
280
245
|
return 0;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { CommandHandler, CommandSpec } from "../../cli/spec/spec.js";
|
|
2
|
+
export type HooksInstallParsed = {
|
|
3
|
+
quiet: boolean;
|
|
4
|
+
};
|
|
5
|
+
export declare const hooksInstallSpec: CommandSpec<HooksInstallParsed>;
|
|
6
|
+
export declare const runHooksInstall: CommandHandler<HooksInstallParsed>;
|
|
7
|
+
//# sourceMappingURL=install.command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"install.command.d.ts","sourceRoot":"","sources":["../../../src/commands/hooks/install.command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAI1E,MAAM,MAAM,kBAAkB,GAAG;IAAE,KAAK,EAAE,OAAO,CAAA;CAAE,CAAC;AAEpD,eAAO,MAAM,gBAAgB,EAAE,WAAW,CAAC,kBAAkB,CAS5D,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,cAAc,CAAC,kBAAkB,CAE9D,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { cmdHooksInstall } from "./index.js";
|
|
2
|
+
export const hooksInstallSpec = {
|
|
3
|
+
id: ["hooks", "install"],
|
|
4
|
+
group: "Hooks",
|
|
5
|
+
summary: "Install managed git hooks and the agentplane shim.",
|
|
6
|
+
options: [
|
|
7
|
+
{ kind: "boolean", name: "quiet", default: false, description: "Reduce output noise." },
|
|
8
|
+
],
|
|
9
|
+
examples: [{ cmd: "agentplane hooks install", why: "Install hooks into .git/hooks/." }],
|
|
10
|
+
parse: (raw) => ({ quiet: raw.opts.quiet === true }),
|
|
11
|
+
};
|
|
12
|
+
export const runHooksInstall = async (ctx, p) => {
|
|
13
|
+
return await cmdHooksInstall({ cwd: ctx.cwd, rootOverride: ctx.rootOverride, quiet: p.quiet });
|
|
14
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { CommandHandler, CommandSpec } from "../../cli/spec/spec.js";
|
|
2
|
+
import { HOOK_NAMES } from "./index.js";
|
|
3
|
+
export type HooksRunParsed = {
|
|
4
|
+
hook: (typeof HOOK_NAMES)[number];
|
|
5
|
+
args: string[];
|
|
6
|
+
};
|
|
7
|
+
export declare const hooksRunSpec: CommandSpec<HooksRunParsed>;
|
|
8
|
+
export declare const runHooksRun: CommandHandler<HooksRunParsed>;
|
|
9
|
+
//# sourceMappingURL=run.command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run.command.d.ts","sourceRoot":"","sources":["../../../src/commands/hooks/run.command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAG1E,OAAO,EAAE,UAAU,EAAe,MAAM,YAAY,CAAC;AAErD,MAAM,MAAM,cAAc,GAAG;IAAE,IAAI,EAAE,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC;IAAC,IAAI,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC;AAEnF,eAAO,MAAM,YAAY,EAAE,WAAW,CAAC,cAAc,CA4BpD,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,cAAc,CAAC,cAAc,CAOtD,CAAC"}
|