agentplane 0.1.9 → 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 +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 +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/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
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { CommandHandler, CommandId, CommandSpec, MatchResult } from "./spec.js";
|
|
2
|
+
export declare class CommandRegistry {
|
|
3
|
+
private readonly entries;
|
|
4
|
+
register<TParsed>(spec: CommandSpec<TParsed>, handler: CommandHandler<TParsed>): void;
|
|
5
|
+
list(): readonly {
|
|
6
|
+
spec: CommandSpec;
|
|
7
|
+
handler: CommandHandler;
|
|
8
|
+
}[];
|
|
9
|
+
match(tokens: readonly string[]): MatchResult | null;
|
|
10
|
+
}
|
|
11
|
+
export declare function formatCommandId(id: CommandId): string;
|
|
12
|
+
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../src/cli/spec/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAIrF,qBAAa,eAAe;IAC1B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAIf;IAET,QAAQ,CAAC,OAAO,EAAE,IAAI,EAAE,WAAW,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,cAAc,CAAC,OAAO,CAAC;IAgB9E,IAAI,IAAI,SAAS;QAAE,IAAI,EAAE,WAAW,CAAC;QAAC,OAAO,EAAE,cAAc,CAAA;KAAE,EAAE;IAIjE,KAAK,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,GAAG,WAAW,GAAG,IAAI;CAoBrD;AAED,wBAAgB,eAAe,CAAC,EAAE,EAAE,SAAS,GAAG,MAAM,CAErD"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { CliError } from "../../shared/errors.js";
|
|
2
|
+
export class CommandRegistry {
|
|
3
|
+
entries = [];
|
|
4
|
+
register(spec, handler) {
|
|
5
|
+
const key = formatCommandId(spec.id);
|
|
6
|
+
if (this.entries.some((e) => formatCommandId(e.id) === key)) {
|
|
7
|
+
throw new CliError({
|
|
8
|
+
exitCode: 1,
|
|
9
|
+
code: "E_INTERNAL",
|
|
10
|
+
message: `Duplicate command id registered: ${key}`,
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
this.entries.push({
|
|
14
|
+
id: spec.id,
|
|
15
|
+
spec: spec,
|
|
16
|
+
handler: handler,
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
list() {
|
|
20
|
+
return this.entries;
|
|
21
|
+
}
|
|
22
|
+
match(tokens) {
|
|
23
|
+
// Longest-prefix match by id segments.
|
|
24
|
+
let best = null;
|
|
25
|
+
for (const e of this.entries) {
|
|
26
|
+
const id = e.id;
|
|
27
|
+
if (tokens.length < id.length)
|
|
28
|
+
continue;
|
|
29
|
+
let ok = true;
|
|
30
|
+
for (const [i, seg] of id.entries()) {
|
|
31
|
+
if (tokens[i] !== seg) {
|
|
32
|
+
ok = false;
|
|
33
|
+
break;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
if (!ok)
|
|
37
|
+
continue;
|
|
38
|
+
if (!best || id.length > best.consumed) {
|
|
39
|
+
best = { spec: e.spec, handler: e.handler, consumed: id.length };
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return best;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
export function formatCommandId(id) {
|
|
46
|
+
return id.join(" ");
|
|
47
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
export type CommandId = readonly string[];
|
|
2
|
+
export type ExampleSpec = {
|
|
3
|
+
cmd: string;
|
|
4
|
+
why?: string;
|
|
5
|
+
};
|
|
6
|
+
export type ArgSpec = {
|
|
7
|
+
name: string;
|
|
8
|
+
required: boolean;
|
|
9
|
+
variadic?: boolean;
|
|
10
|
+
valueHint?: string;
|
|
11
|
+
description?: string;
|
|
12
|
+
};
|
|
13
|
+
export type OptionBase = {
|
|
14
|
+
name: string;
|
|
15
|
+
short?: string;
|
|
16
|
+
description: string;
|
|
17
|
+
hidden?: boolean;
|
|
18
|
+
deprecated?: string;
|
|
19
|
+
};
|
|
20
|
+
export type BooleanOptionSpec = OptionBase & {
|
|
21
|
+
kind: "boolean";
|
|
22
|
+
default?: boolean;
|
|
23
|
+
};
|
|
24
|
+
export type StringOptionSpec = OptionBase & {
|
|
25
|
+
kind: "string";
|
|
26
|
+
valueHint: string;
|
|
27
|
+
required?: boolean;
|
|
28
|
+
repeatable?: boolean;
|
|
29
|
+
minCount?: number;
|
|
30
|
+
default?: string;
|
|
31
|
+
choices?: readonly string[];
|
|
32
|
+
pattern?: RegExp;
|
|
33
|
+
patternHint?: string;
|
|
34
|
+
coerce?: (raw: string) => unknown;
|
|
35
|
+
};
|
|
36
|
+
export type OptionSpec = BooleanOptionSpec | StringOptionSpec;
|
|
37
|
+
export type ParsedRaw = {
|
|
38
|
+
args: Record<string, string | string[] | undefined>;
|
|
39
|
+
opts: Record<string, unknown>;
|
|
40
|
+
extra: string[];
|
|
41
|
+
};
|
|
42
|
+
type BivariantCallback<T> = {
|
|
43
|
+
bivarianceHack(arg: T): void;
|
|
44
|
+
}["bivarianceHack"];
|
|
45
|
+
export type CommandSpec<TParsed = unknown> = {
|
|
46
|
+
id: CommandId;
|
|
47
|
+
group: string;
|
|
48
|
+
summary: string;
|
|
49
|
+
description?: string;
|
|
50
|
+
synopsis?: readonly string[];
|
|
51
|
+
args?: readonly ArgSpec[];
|
|
52
|
+
options?: readonly OptionSpec[];
|
|
53
|
+
examples?: readonly ExampleSpec[];
|
|
54
|
+
notes?: readonly string[];
|
|
55
|
+
validateRaw?: (raw: ParsedRaw) => void;
|
|
56
|
+
parse?: (raw: ParsedRaw) => TParsed;
|
|
57
|
+
validate?: BivariantCallback<TParsed>;
|
|
58
|
+
};
|
|
59
|
+
export type CommandCtx = {
|
|
60
|
+
cwd: string;
|
|
61
|
+
rootOverride?: string;
|
|
62
|
+
};
|
|
63
|
+
export type CommandHandler<TParsed = unknown> = (ctx: CommandCtx, parsed: TParsed) => Promise<number>;
|
|
64
|
+
export type MatchResult<TParsed = unknown> = {
|
|
65
|
+
spec: CommandSpec<TParsed>;
|
|
66
|
+
handler: CommandHandler<TParsed>;
|
|
67
|
+
consumed: number;
|
|
68
|
+
};
|
|
69
|
+
export type UsageErrorFactory = (opts: {
|
|
70
|
+
message: string;
|
|
71
|
+
spec?: CommandSpec;
|
|
72
|
+
context?: Record<string, unknown>;
|
|
73
|
+
cause?: unknown;
|
|
74
|
+
}) => unknown;
|
|
75
|
+
export {};
|
|
76
|
+
//# sourceMappingURL=spec.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spec.d.ts","sourceRoot":"","sources":["../../../src/cli/spec/spec.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAAG,SAAS,MAAM,EAAE,CAAC;AAE1C,MAAM,MAAM,WAAW,GAAG;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,OAAO,GAAG;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,UAAU,GAAG;IAC3C,IAAI,EAAE,SAAS,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,UAAU,GAAG;IAC1C,IAAI,EAAE,QAAQ,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG,iBAAiB,GAAG,gBAAgB,CAAC;AAE9D,MAAM,MAAM,SAAS,GAAG;IAEtB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC,CAAC;IACpD,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAE9B,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB,CAAC;AAKF,KAAK,iBAAiB,CAAC,CAAC,IAAI;IAAE,cAAc,CAAC,GAAG,EAAE,CAAC,GAAG,IAAI,CAAA;CAAE,CAAC,gBAAgB,CAAC,CAAC;AAE/E,MAAM,MAAM,WAAW,CAAC,OAAO,GAAG,OAAO,IAAI;IAC3C,EAAE,EAAE,SAAS,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IAGrB,QAAQ,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAE7B,IAAI,CAAC,EAAE,SAAS,OAAO,EAAE,CAAC;IAC1B,OAAO,CAAC,EAAE,SAAS,UAAU,EAAE,CAAC;IAChC,QAAQ,CAAC,EAAE,SAAS,WAAW,EAAE,CAAC;IAClC,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAG1B,WAAW,CAAC,EAAE,CAAC,GAAG,EAAE,SAAS,KAAK,IAAI,CAAC;IAEvC,KAAK,CAAC,EAAE,CAAC,GAAG,EAAE,SAAS,KAAK,OAAO,CAAC;IAEpC,QAAQ,CAAC,EAAE,iBAAiB,CAAC,OAAO,CAAC,CAAC;CACvC,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,cAAc,CAAC,OAAO,GAAG,OAAO,IAAI,CAC9C,GAAG,EAAE,UAAU,EACf,MAAM,EAAE,OAAO,KACZ,OAAO,CAAC,MAAM,CAAC,CAAC;AAErB,MAAM,MAAM,WAAW,CAAC,OAAO,GAAG,OAAO,IAAI;IAC3C,IAAI,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;IAC3B,OAAO,EAAE,cAAc,CAAC,OAAO,CAAC,CAAC;IACjC,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAGF,MAAM,MAAM,iBAAiB,GAAG,CAAC,IAAI,EAAE;IACrC,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,KAAK,OAAO,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"suggest.d.ts","sourceRoot":"","sources":["../../../src/cli/spec/suggest.ts"],"names":[],"mappings":"AA+BA,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,GAAG,IAAI,CActF"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
function levenshtein(a, b) {
|
|
2
|
+
if (a === b)
|
|
3
|
+
return 0;
|
|
4
|
+
if (!a)
|
|
5
|
+
return b.length;
|
|
6
|
+
if (!b)
|
|
7
|
+
return a.length;
|
|
8
|
+
// O(min(a,b)) memory.
|
|
9
|
+
const s = a;
|
|
10
|
+
const t = b;
|
|
11
|
+
const m = s.length;
|
|
12
|
+
const n = t.length;
|
|
13
|
+
let prev = Array.from({ length: n + 1 }, (_, j) => j);
|
|
14
|
+
let curr = Array.from({ length: n + 1 }, () => 0);
|
|
15
|
+
for (let i = 1; i <= m; i++) {
|
|
16
|
+
curr[0] = i;
|
|
17
|
+
const sc = s.codePointAt(i - 1) ?? 0;
|
|
18
|
+
for (let j = 1; j <= n; j++) {
|
|
19
|
+
const tc = t.codePointAt(j - 1) ?? 0;
|
|
20
|
+
const cost = sc === tc ? 0 : 1;
|
|
21
|
+
const del = prev[j] + 1;
|
|
22
|
+
const ins = curr[j - 1] + 1;
|
|
23
|
+
const sub = prev[j - 1] + cost;
|
|
24
|
+
curr[j] = Math.min(del, ins, sub);
|
|
25
|
+
}
|
|
26
|
+
[prev, curr] = [curr, prev];
|
|
27
|
+
}
|
|
28
|
+
return prev[n];
|
|
29
|
+
}
|
|
30
|
+
export function suggestOne(input, candidates) {
|
|
31
|
+
const trimmed = input.trim();
|
|
32
|
+
if (!trimmed)
|
|
33
|
+
return null;
|
|
34
|
+
let best = null;
|
|
35
|
+
for (const cand of candidates) {
|
|
36
|
+
const dist = levenshtein(trimmed, cand);
|
|
37
|
+
if (!best || dist < best.dist)
|
|
38
|
+
best = { cand, dist };
|
|
39
|
+
}
|
|
40
|
+
if (!best)
|
|
41
|
+
return null;
|
|
42
|
+
// Conservative threshold: avoid noisy suggestions.
|
|
43
|
+
const maxAllowed = Math.max(2, Math.floor(best.cand.length / 3));
|
|
44
|
+
return best.dist <= maxAllowed ? best.cand : null;
|
|
45
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { CommandCtx, CommandHandler, CommandSpec } from "../../cli/spec/spec.js";
|
|
2
|
+
import type { CommandContext } from "../shared/task-backend.js";
|
|
3
|
+
import { type BackendSyncParsed } from "../backend.js";
|
|
4
|
+
type BackendRootParsed = {
|
|
5
|
+
cmd: string[];
|
|
6
|
+
};
|
|
7
|
+
export declare const backendSpec: CommandSpec<BackendRootParsed>;
|
|
8
|
+
export declare const backendSyncSpec: CommandSpec<BackendSyncParsed>;
|
|
9
|
+
export declare function makeRunBackendHandler(getCtx: (cmd: string) => Promise<CommandContext>): CommandHandler<BackendRootParsed>;
|
|
10
|
+
export declare function makeRunBackendSyncHandler(getCtx: (cmd: string) => Promise<CommandContext>): (ctx: CommandCtx, p: BackendSyncParsed) => Promise<number>;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=sync.command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sync.command.d.ts","sourceRoot":"","sources":["../../../src/commands/backend/sync.command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAGtF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAwB,KAAK,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAE7E,KAAK,iBAAiB,GAAG;IAAE,GAAG,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC;AAE3C,eAAO,MAAM,WAAW,EAAE,WAAW,CAAC,iBAAiB,CAQtD,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,WAAW,CAAC,iBAAiB,CAuC1D,CAAC;AAEF,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,cAAc,CAAC,qCAgBrF;AAED,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,cAAc,CAAC,IAC1E,KAAK,UAAU,EAAE,GAAG,iBAAiB,KAAG,OAAO,CAAC,MAAM,CAAC,CAStE"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { usageError } from "../../cli/spec/errors.js";
|
|
2
|
+
import { suggestOne } from "../../cli/spec/suggest.js";
|
|
3
|
+
import { cmdBackendSyncParsed } from "../backend.js";
|
|
4
|
+
export const backendSpec = {
|
|
5
|
+
id: ["backend"],
|
|
6
|
+
group: "Backend",
|
|
7
|
+
summary: "Backend-related operations.",
|
|
8
|
+
description: "This is a command group. Use a subcommand such as `agentplane backend sync ...`.",
|
|
9
|
+
args: [{ name: "cmd", required: false, variadic: true, valueHint: "<cmd>" }],
|
|
10
|
+
examples: [{ cmd: "agentplane backend sync local --direction pull", why: "Sync the backend." }],
|
|
11
|
+
parse: (raw) => ({ cmd: (raw.args.cmd ?? []) }),
|
|
12
|
+
};
|
|
13
|
+
export const backendSyncSpec = {
|
|
14
|
+
id: ["backend", "sync"],
|
|
15
|
+
group: "Backend",
|
|
16
|
+
summary: "Sync the configured backend (push or pull).",
|
|
17
|
+
args: [{ name: "id", required: true, valueHint: "<id>", description: "Configured backend id." }],
|
|
18
|
+
options: [
|
|
19
|
+
{
|
|
20
|
+
kind: "string",
|
|
21
|
+
name: "direction",
|
|
22
|
+
valueHint: "<push|pull>",
|
|
23
|
+
choices: ["push", "pull"],
|
|
24
|
+
required: true,
|
|
25
|
+
description: "Sync direction.",
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
kind: "string",
|
|
29
|
+
name: "conflict",
|
|
30
|
+
valueHint: "<diff|prefer-local|prefer-remote|fail>",
|
|
31
|
+
choices: ["diff", "prefer-local", "prefer-remote", "fail"],
|
|
32
|
+
default: "diff",
|
|
33
|
+
description: "Conflict handling policy (default: diff).",
|
|
34
|
+
},
|
|
35
|
+
{ kind: "boolean", name: "yes", default: false, description: "Auto-approve network access." },
|
|
36
|
+
{ kind: "boolean", name: "quiet", default: false, description: "Reduce output noise." },
|
|
37
|
+
],
|
|
38
|
+
examples: [
|
|
39
|
+
{ cmd: "agentplane backend sync local --direction pull", why: "Pull from backend." },
|
|
40
|
+
{
|
|
41
|
+
cmd: "agentplane backend sync redmine --direction push --yes",
|
|
42
|
+
why: "Push to a networked backend with explicit approval.",
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
parse: (raw) => ({
|
|
46
|
+
backendId: String(raw.args.id),
|
|
47
|
+
direction: raw.opts.direction,
|
|
48
|
+
conflict: (raw.opts.conflict ?? "diff"),
|
|
49
|
+
yes: raw.opts.yes === true,
|
|
50
|
+
quiet: raw.opts.quiet === true,
|
|
51
|
+
}),
|
|
52
|
+
};
|
|
53
|
+
export function makeRunBackendHandler(getCtx) {
|
|
54
|
+
const handler = async (_ctx, p) => {
|
|
55
|
+
// Resolve context once for consistent error mapping and approval gating.
|
|
56
|
+
await getCtx("backend");
|
|
57
|
+
const input = p.cmd.join(" ");
|
|
58
|
+
const suggestion = suggestOne(input, ["sync"]);
|
|
59
|
+
const suffix = suggestion ? ` Did you mean: ${suggestion}?` : "";
|
|
60
|
+
const msg = p.cmd.length === 0 ? "Missing subcommand." : `Unknown subcommand: ${p.cmd[0]}.`;
|
|
61
|
+
throw usageError({
|
|
62
|
+
spec: backendSyncSpec,
|
|
63
|
+
message: `${msg}${suffix}`,
|
|
64
|
+
context: { command: "backend sync" },
|
|
65
|
+
});
|
|
66
|
+
};
|
|
67
|
+
return handler;
|
|
68
|
+
}
|
|
69
|
+
export function makeRunBackendSyncHandler(getCtx) {
|
|
70
|
+
return async (ctx, p) => {
|
|
71
|
+
const commandCtx = await getCtx("backend sync");
|
|
72
|
+
return await cmdBackendSyncParsed({
|
|
73
|
+
ctx: commandCtx,
|
|
74
|
+
cwd: ctx.cwd,
|
|
75
|
+
rootOverride: ctx.rootOverride,
|
|
76
|
+
flags: p,
|
|
77
|
+
});
|
|
78
|
+
};
|
|
79
|
+
}
|
|
@@ -1,15 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { type CommandContext } from "./shared/task-backend.js";
|
|
2
|
+
export type BackendSyncParsed = {
|
|
3
|
+
backendId: string;
|
|
4
|
+
direction: "push" | "pull";
|
|
5
|
+
conflict: "diff" | "prefer-local" | "prefer-remote" | "fail";
|
|
6
|
+
yes: boolean;
|
|
7
|
+
quiet: boolean;
|
|
8
|
+
};
|
|
9
|
+
export type SyncParsed = {
|
|
10
|
+
backendId: string | null;
|
|
11
|
+
direction: "push" | "pull";
|
|
12
|
+
conflict: "diff" | "prefer-local" | "prefer-remote" | "fail";
|
|
13
|
+
yes: boolean;
|
|
14
|
+
quiet: boolean;
|
|
15
|
+
};
|
|
16
|
+
export declare function cmdBackendSyncParsed(opts: {
|
|
17
|
+
ctx?: CommandContext;
|
|
6
18
|
cwd: string;
|
|
7
19
|
rootOverride?: string;
|
|
8
|
-
|
|
20
|
+
flags: BackendSyncParsed;
|
|
9
21
|
}): Promise<number>;
|
|
10
|
-
export declare function
|
|
22
|
+
export declare function cmdSyncParsed(opts: {
|
|
23
|
+
ctx?: CommandContext;
|
|
11
24
|
cwd: string;
|
|
12
25
|
rootOverride?: string;
|
|
13
|
-
|
|
26
|
+
flags: SyncParsed;
|
|
14
27
|
}): Promise<number>;
|
|
15
28
|
//# sourceMappingURL=backend.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"backend.d.ts","sourceRoot":"","sources":["../../src/commands/backend.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"backend.d.ts","sourceRoot":"","sources":["../../src/commands/backend.ts"],"names":[],"mappings":"AAGA,OAAO,EAAsB,KAAK,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAGnF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,GAAG,MAAM,CAAC;IAC3B,QAAQ,EAAE,MAAM,GAAG,cAAc,GAAG,eAAe,GAAG,MAAM,CAAC;IAC7D,GAAG,EAAE,OAAO,CAAC;IACb,KAAK,EAAE,OAAO,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACvB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,SAAS,EAAE,MAAM,GAAG,MAAM,CAAC;IAC3B,QAAQ,EAAE,MAAM,GAAG,cAAc,GAAG,eAAe,GAAG,MAAM,CAAC;IAC7D,GAAG,EAAE,OAAO,CAAC;IACb,KAAK,EAAE,OAAO,CAAC;CAChB,CAAC;AAEF,wBAAsB,oBAAoB,CAAC,IAAI,EAAE;IAC/C,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,iBAAiB,CAAC;CAC1B,GAAG,OAAO,CAAC,MAAM,CAAC,CAwClB;AAED,wBAAsB,aAAa,CAAC,IAAI,EAAE;IACxC,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,UAAU,CAAC;CACnB,GAAG,OAAO,CAAC,MAAM,CAAC,CAwClB"}
|
package/dist/commands/backend.js
CHANGED
|
@@ -1,157 +1,20 @@
|
|
|
1
|
-
import { backendNotSupportedMessage
|
|
1
|
+
import { backendNotSupportedMessage } from "../cli/output.js";
|
|
2
2
|
import { mapBackendError } from "../cli/error-map.js";
|
|
3
3
|
import { CliError } from "../shared/errors.js";
|
|
4
|
-
import {
|
|
4
|
+
import { loadCommandContext } from "./shared/task-backend.js";
|
|
5
5
|
import { ensureNetworkApproved } from "./shared/network-approval.js";
|
|
6
|
-
export
|
|
7
|
-
export const BACKEND_SYNC_USAGE_EXAMPLE = "agentplane backend sync local --direction pull";
|
|
8
|
-
export const SYNC_USAGE = "Usage: agentplane sync [<id>] [--direction <push|pull>] [--conflict <diff|prefer-local|prefer-remote|fail>] [--yes] [--quiet]";
|
|
9
|
-
export const SYNC_USAGE_EXAMPLE = "agentplane sync --direction push --yes";
|
|
10
|
-
function parseBackendSyncArgs(args) {
|
|
11
|
-
let backendId = "";
|
|
12
|
-
let direction = null;
|
|
13
|
-
let conflict = "diff";
|
|
14
|
-
let confirm = false;
|
|
15
|
-
let quiet = false;
|
|
16
|
-
for (let i = 0; i < args.length; i++) {
|
|
17
|
-
const arg = args[i];
|
|
18
|
-
if (!arg)
|
|
19
|
-
continue;
|
|
20
|
-
if (!arg.startsWith("--")) {
|
|
21
|
-
if (backendId) {
|
|
22
|
-
throw new CliError({
|
|
23
|
-
exitCode: 2,
|
|
24
|
-
code: "E_USAGE",
|
|
25
|
-
message: usageMessage(BACKEND_SYNC_USAGE, BACKEND_SYNC_USAGE_EXAMPLE),
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
backendId = arg;
|
|
29
|
-
continue;
|
|
30
|
-
}
|
|
31
|
-
if (arg === "--direction") {
|
|
32
|
-
const next = args[i + 1];
|
|
33
|
-
if (!next || (next !== "push" && next !== "pull")) {
|
|
34
|
-
throw new CliError({
|
|
35
|
-
exitCode: 2,
|
|
36
|
-
code: "E_USAGE",
|
|
37
|
-
message: usageMessage(BACKEND_SYNC_USAGE, BACKEND_SYNC_USAGE_EXAMPLE),
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
direction = next;
|
|
41
|
-
i++;
|
|
42
|
-
continue;
|
|
43
|
-
}
|
|
44
|
-
if (arg === "--conflict") {
|
|
45
|
-
const next = args[i + 1];
|
|
46
|
-
if (!next || !["diff", "prefer-local", "prefer-remote", "fail"].includes(next)) {
|
|
47
|
-
throw new CliError({
|
|
48
|
-
exitCode: 2,
|
|
49
|
-
code: "E_USAGE",
|
|
50
|
-
message: usageMessage(BACKEND_SYNC_USAGE, BACKEND_SYNC_USAGE_EXAMPLE),
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
conflict = next;
|
|
54
|
-
i++;
|
|
55
|
-
continue;
|
|
56
|
-
}
|
|
57
|
-
if (arg === "--yes") {
|
|
58
|
-
confirm = true;
|
|
59
|
-
continue;
|
|
60
|
-
}
|
|
61
|
-
if (arg === "--quiet") {
|
|
62
|
-
quiet = true;
|
|
63
|
-
continue;
|
|
64
|
-
}
|
|
65
|
-
throw new CliError({
|
|
66
|
-
exitCode: 2,
|
|
67
|
-
code: "E_USAGE",
|
|
68
|
-
message: usageMessage(BACKEND_SYNC_USAGE, BACKEND_SYNC_USAGE_EXAMPLE),
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
if (!backendId || !direction) {
|
|
72
|
-
throw new CliError({
|
|
73
|
-
exitCode: 2,
|
|
74
|
-
code: "E_USAGE",
|
|
75
|
-
message: usageMessage(BACKEND_SYNC_USAGE, BACKEND_SYNC_USAGE_EXAMPLE),
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
return { backendId, direction, conflict, confirm, quiet };
|
|
79
|
-
}
|
|
80
|
-
function parseSyncArgs(args) {
|
|
81
|
-
let backendId = null;
|
|
82
|
-
let direction = "push";
|
|
83
|
-
let conflict = "diff";
|
|
84
|
-
let confirm = false;
|
|
85
|
-
let quiet = false;
|
|
86
|
-
for (let i = 0; i < args.length; i++) {
|
|
87
|
-
const arg = args[i];
|
|
88
|
-
if (!arg)
|
|
89
|
-
continue;
|
|
90
|
-
if (!arg.startsWith("--")) {
|
|
91
|
-
if (backendId) {
|
|
92
|
-
throw new CliError({
|
|
93
|
-
exitCode: 2,
|
|
94
|
-
code: "E_USAGE",
|
|
95
|
-
message: usageMessage(SYNC_USAGE, SYNC_USAGE_EXAMPLE),
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
backendId = arg;
|
|
99
|
-
continue;
|
|
100
|
-
}
|
|
101
|
-
if (arg === "--direction") {
|
|
102
|
-
const next = args[i + 1];
|
|
103
|
-
if (!next || (next !== "push" && next !== "pull")) {
|
|
104
|
-
throw new CliError({
|
|
105
|
-
exitCode: 2,
|
|
106
|
-
code: "E_USAGE",
|
|
107
|
-
message: usageMessage(SYNC_USAGE, SYNC_USAGE_EXAMPLE),
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
direction = next;
|
|
111
|
-
i++;
|
|
112
|
-
continue;
|
|
113
|
-
}
|
|
114
|
-
if (arg === "--conflict") {
|
|
115
|
-
const next = args[i + 1];
|
|
116
|
-
if (!next || !["diff", "prefer-local", "prefer-remote", "fail"].includes(next)) {
|
|
117
|
-
throw new CliError({
|
|
118
|
-
exitCode: 2,
|
|
119
|
-
code: "E_USAGE",
|
|
120
|
-
message: usageMessage(SYNC_USAGE, SYNC_USAGE_EXAMPLE),
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
conflict = next;
|
|
124
|
-
i++;
|
|
125
|
-
continue;
|
|
126
|
-
}
|
|
127
|
-
if (arg === "--yes") {
|
|
128
|
-
confirm = true;
|
|
129
|
-
continue;
|
|
130
|
-
}
|
|
131
|
-
if (arg === "--quiet") {
|
|
132
|
-
quiet = true;
|
|
133
|
-
continue;
|
|
134
|
-
}
|
|
135
|
-
throw new CliError({
|
|
136
|
-
exitCode: 2,
|
|
137
|
-
code: "E_USAGE",
|
|
138
|
-
message: usageMessage(SYNC_USAGE, SYNC_USAGE_EXAMPLE),
|
|
139
|
-
});
|
|
140
|
-
}
|
|
141
|
-
return { backendId, direction, conflict, confirm, quiet };
|
|
142
|
-
}
|
|
143
|
-
export async function cmdBackendSync(opts) {
|
|
144
|
-
const flags = parseBackendSyncArgs(opts.args);
|
|
6
|
+
export async function cmdBackendSyncParsed(opts) {
|
|
145
7
|
try {
|
|
146
|
-
const
|
|
147
|
-
cwd: opts.cwd,
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
8
|
+
const ctx = opts.ctx ??
|
|
9
|
+
(await loadCommandContext({ cwd: opts.cwd, rootOverride: opts.rootOverride ?? null }));
|
|
10
|
+
const backend = ctx.taskBackend;
|
|
11
|
+
const backendId = ctx.backendId;
|
|
12
|
+
const config = ctx.config;
|
|
13
|
+
if (opts.flags.backendId && backendId && opts.flags.backendId !== backendId) {
|
|
151
14
|
throw new CliError({
|
|
152
15
|
exitCode: 2,
|
|
153
16
|
code: "E_USAGE",
|
|
154
|
-
message: `Configured backend is "${backendId}", not "${flags.backendId}"`,
|
|
17
|
+
message: `Configured backend is "${backendId}", not "${opts.flags.backendId}"`,
|
|
155
18
|
});
|
|
156
19
|
}
|
|
157
20
|
if (!backend.sync) {
|
|
@@ -164,15 +27,15 @@ export async function cmdBackendSync(opts) {
|
|
|
164
27
|
if (backendId !== "local") {
|
|
165
28
|
await ensureNetworkApproved({
|
|
166
29
|
config,
|
|
167
|
-
yes: flags.
|
|
30
|
+
yes: opts.flags.yes,
|
|
168
31
|
reason: `backend sync may access the network (backend: ${backendId})`,
|
|
169
32
|
});
|
|
170
33
|
}
|
|
171
34
|
await backend.sync({
|
|
172
|
-
direction: flags.direction,
|
|
173
|
-
conflict: flags.conflict,
|
|
174
|
-
quiet: flags.quiet,
|
|
175
|
-
confirm: flags.
|
|
35
|
+
direction: opts.flags.direction,
|
|
36
|
+
conflict: opts.flags.conflict,
|
|
37
|
+
quiet: opts.flags.quiet,
|
|
38
|
+
confirm: opts.flags.yes,
|
|
176
39
|
});
|
|
177
40
|
return 0;
|
|
178
41
|
}
|
|
@@ -182,18 +45,18 @@ export async function cmdBackendSync(opts) {
|
|
|
182
45
|
throw mapBackendError(err, { command: "backend sync", root: opts.rootOverride ?? null });
|
|
183
46
|
}
|
|
184
47
|
}
|
|
185
|
-
export async function
|
|
186
|
-
const flags = parseSyncArgs(opts.args);
|
|
48
|
+
export async function cmdSyncParsed(opts) {
|
|
187
49
|
try {
|
|
188
|
-
const
|
|
189
|
-
cwd: opts.cwd,
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
50
|
+
const ctx = opts.ctx ??
|
|
51
|
+
(await loadCommandContext({ cwd: opts.cwd, rootOverride: opts.rootOverride ?? null }));
|
|
52
|
+
const backend = ctx.taskBackend;
|
|
53
|
+
const backendId = ctx.backendId;
|
|
54
|
+
const config = ctx.config;
|
|
55
|
+
if (opts.flags.backendId && backendId && opts.flags.backendId !== backendId) {
|
|
193
56
|
throw new CliError({
|
|
194
57
|
exitCode: 2,
|
|
195
58
|
code: "E_USAGE",
|
|
196
|
-
message: `Configured backend is "${backendId}", not "${flags.backendId}"`,
|
|
59
|
+
message: `Configured backend is "${backendId}", not "${opts.flags.backendId}"`,
|
|
197
60
|
});
|
|
198
61
|
}
|
|
199
62
|
if (!backend.sync) {
|
|
@@ -206,15 +69,15 @@ export async function cmdSync(opts) {
|
|
|
206
69
|
if (backendId !== "local") {
|
|
207
70
|
await ensureNetworkApproved({
|
|
208
71
|
config,
|
|
209
|
-
yes: flags.
|
|
72
|
+
yes: opts.flags.yes,
|
|
210
73
|
reason: `sync may access the network (backend: ${backendId})`,
|
|
211
74
|
});
|
|
212
75
|
}
|
|
213
76
|
await backend.sync({
|
|
214
|
-
direction: flags.direction,
|
|
215
|
-
conflict: flags.conflict,
|
|
216
|
-
quiet: flags.quiet,
|
|
217
|
-
confirm: flags.
|
|
77
|
+
direction: opts.flags.direction,
|
|
78
|
+
conflict: opts.flags.conflict,
|
|
79
|
+
quiet: opts.flags.quiet,
|
|
80
|
+
confirm: opts.flags.yes,
|
|
218
81
|
});
|
|
219
82
|
return 0;
|
|
220
83
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { CommandCtx, CommandSpec } from "../cli/spec/spec.js";
|
|
2
|
+
import type { CommandContext } from "./shared/task-backend.js";
|
|
3
|
+
export type BlockParsed = {
|
|
4
|
+
taskId: string;
|
|
5
|
+
author: string;
|
|
6
|
+
body: string;
|
|
7
|
+
commitFromComment: boolean;
|
|
8
|
+
commitEmoji?: string;
|
|
9
|
+
commitAllow: string[];
|
|
10
|
+
commitAutoAllow: boolean;
|
|
11
|
+
commitAllowTasks: boolean;
|
|
12
|
+
commitRequireClean: boolean;
|
|
13
|
+
confirmStatusCommit: boolean;
|
|
14
|
+
force: boolean;
|
|
15
|
+
quiet: boolean;
|
|
16
|
+
};
|
|
17
|
+
export declare const blockSpec: CommandSpec<BlockParsed>;
|
|
18
|
+
export declare function makeRunBlockHandler(getCtx: (cmd: string) => Promise<CommandContext>): (ctx: CommandCtx, p: BlockParsed) => Promise<number>;
|
|
19
|
+
//# sourceMappingURL=block.command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"block.command.d.ts","sourceRoot":"","sources":["../../src/commands/block.command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEnE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAI/D,MAAM,MAAM,WAAW,GAAG;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,iBAAiB,EAAE,OAAO,CAAC;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,eAAe,EAAE,OAAO,CAAC;IACzB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,kBAAkB,EAAE,OAAO,CAAC;IAC5B,mBAAmB,EAAE,OAAO,CAAC;IAC7B,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,EAAE,OAAO,CAAC;CAChB,CAAC;AAQF,eAAO,MAAM,SAAS,EAAE,WAAW,CAAC,WAAW,CAmH9C,CAAC;AAEF,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,cAAc,CAAC,IACpE,KAAK,UAAU,EAAE,GAAG,WAAW,KAAG,OAAO,CAAC,MAAM,CAAC,CAmBhE"}
|