agentplane 0.3.14 → 0.3.16
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/assets/policy/incidents.md +7 -0
- package/bin/agentplane.js +1 -1
- package/bin/framework-dev-contract.js +1 -0
- package/dist/.build-manifest.json +508 -323
- package/dist/backends/task-backend/load.d.ts.map +1 -1
- package/dist/backends/task-backend/load.js +32 -19
- package/dist/backends/task-backend/local-backend-doc.d.ts.map +1 -1
- package/dist/backends/task-backend/local-backend-doc.js +1 -1
- package/dist/backends/task-backend/redmine/backend-runtime.d.ts +147 -0
- package/dist/backends/task-backend/redmine/backend-runtime.d.ts.map +1 -0
- package/dist/backends/task-backend/redmine/backend-runtime.js +258 -0
- package/dist/backends/task-backend/redmine/backend-sync/context.d.ts +44 -0
- package/dist/backends/task-backend/redmine/backend-sync/context.d.ts.map +1 -0
- package/dist/backends/task-backend/redmine/backend-sync/context.js +8 -0
- package/dist/backends/task-backend/redmine/backend-sync/ids.d.ts +6 -0
- package/dist/backends/task-backend/redmine/backend-sync/ids.d.ts.map +1 -0
- package/dist/backends/task-backend/redmine/backend-sync/ids.js +21 -0
- package/dist/backends/task-backend/redmine/backend-sync/migration.d.ts +4 -0
- package/dist/backends/task-backend/redmine/backend-sync/migration.d.ts.map +1 -0
- package/dist/backends/task-backend/redmine/backend-sync/migration.js +87 -0
- package/dist/backends/task-backend/redmine/backend-sync/status.d.ts +10 -0
- package/dist/backends/task-backend/redmine/backend-sync/status.d.ts.map +1 -0
- package/dist/backends/task-backend/redmine/backend-sync/status.js +78 -0
- package/dist/backends/task-backend/redmine/backend-sync/sync.d.ts +12 -0
- package/dist/backends/task-backend/redmine/backend-sync/sync.d.ts.map +1 -0
- package/dist/backends/task-backend/redmine/backend-sync/sync.js +82 -0
- package/dist/backends/task-backend/redmine/backend-sync/write.d.ts +5 -0
- package/dist/backends/task-backend/redmine/backend-sync/write.d.ts.map +1 -0
- package/dist/backends/task-backend/redmine/backend-sync/write.js +100 -0
- package/dist/backends/task-backend/redmine/backend-sync.d.ts +6 -66
- package/dist/backends/task-backend/redmine/backend-sync.d.ts.map +1 -1
- package/dist/backends/task-backend/redmine/backend-sync.js +5 -367
- package/dist/backends/task-backend/redmine-backend.d.ts +2 -33
- package/dist/backends/task-backend/redmine-backend.d.ts.map +1 -1
- package/dist/backends/task-backend/redmine-backend.js +26 -241
- package/dist/backends/task-backend/shared/errors.d.ts +12 -0
- package/dist/backends/task-backend/shared/errors.d.ts.map +1 -1
- package/dist/backends/task-backend/shared/errors.js +12 -0
- package/dist/cli/archive.d.ts.map +1 -1
- package/dist/cli/archive.js +3 -5
- package/dist/cli/error-map.d.ts +7 -1
- package/dist/cli/error-map.d.ts.map +1 -1
- package/dist/cli/error-map.js +231 -19
- package/dist/cli/exit-codes.d.ts +14 -2
- package/dist/cli/exit-codes.d.ts.map +1 -1
- package/dist/cli/exit-codes.js +24 -11
- package/dist/cli/output.d.ts +3 -0
- package/dist/cli/output.d.ts.map +1 -1
- package/dist/cli/output.js +25 -14
- package/dist/cli/prompts.d.ts.map +1 -1
- package/dist/cli/prompts.js +44 -0
- package/dist/cli/run-cli/command-catalog/core.d.ts.map +1 -1
- package/dist/cli/run-cli/command-catalog/core.js +34 -76
- package/dist/cli/run-cli/command-catalog/lifecycle.d.ts.map +1 -1
- package/dist/cli/run-cli/command-catalog/lifecycle.js +23 -26
- package/dist/cli/run-cli/command-catalog/project.d.ts.map +1 -1
- package/dist/cli/run-cli/command-catalog/project.js +39 -54
- package/dist/cli/run-cli/command-catalog/shared.d.ts +15 -3
- package/dist/cli/run-cli/command-catalog/shared.d.ts.map +1 -1
- package/dist/cli/run-cli/command-catalog/shared.js +19 -6
- package/dist/cli/run-cli/command-catalog/task.d.ts.map +1 -1
- package/dist/cli/run-cli/command-catalog/task.js +63 -57
- package/dist/cli/run-cli/command-loaders.d.ts +174 -0
- package/dist/cli/run-cli/command-loaders.d.ts.map +1 -0
- package/dist/cli/run-cli/command-loaders.js +128 -0
- package/dist/cli/run-cli/commands/init/model.d.ts +42 -0
- package/dist/cli/run-cli/commands/init/model.d.ts.map +1 -0
- package/dist/cli/run-cli/commands/init/orchestrate.d.ts +9 -0
- package/dist/cli/run-cli/commands/init/orchestrate.d.ts.map +1 -0
- package/dist/cli/run-cli/commands/init/orchestrate.js +321 -0
- package/dist/cli/run-cli/commands/init/parsers.d.ts +5 -0
- package/dist/cli/run-cli/commands/init/parsers.d.ts.map +1 -0
- package/dist/cli/run-cli/commands/init/parsers.js +36 -0
- package/dist/cli/run-cli/commands/init/presets.d.ts +15 -0
- package/dist/cli/run-cli/commands/init/presets.d.ts.map +1 -0
- package/dist/cli/run-cli/commands/init/presets.js +63 -0
- package/dist/cli/run-cli/commands/init/spec.d.ts +5 -0
- package/dist/cli/run-cli/commands/init/spec.d.ts.map +1 -0
- package/dist/cli/run-cli/commands/init/spec.js +212 -0
- package/dist/cli/run-cli/commands/init/write-config.d.ts +1 -0
- package/dist/cli/run-cli/commands/init/write-config.d.ts.map +1 -1
- package/dist/cli/run-cli/commands/init/write-config.js +1 -0
- package/dist/cli/run-cli/commands/init/write-gitignore.js +1 -1
- package/dist/cli/run-cli/commands/init.d.ts +1 -28
- package/dist/cli/run-cli/commands/init.d.ts.map +1 -1
- package/dist/cli/run-cli/commands/init.js +1 -596
- package/dist/cli/run-cli/update-warning.d.ts +1 -0
- package/dist/cli/run-cli/update-warning.d.ts.map +1 -1
- package/dist/cli/run-cli/update-warning.js +10 -2
- package/dist/cli/run-cli.d.ts.map +1 -1
- package/dist/cli/run-cli.js +1 -2
- package/dist/cli/spec/errors.d.ts +13 -1
- package/dist/cli/spec/errors.d.ts.map +1 -1
- package/dist/cli/spec/errors.js +14 -4
- package/dist/commands/backend.d.ts.map +1 -1
- package/dist/commands/backend.js +66 -118
- package/dist/commands/block.spec.js +1 -1
- package/dist/commands/branch/work-start.js +1 -1
- package/dist/commands/commit.spec.js +1 -1
- package/dist/commands/doctor/branch-pr.js +1 -1
- package/dist/commands/doctor/fixes.js +1 -1
- package/dist/commands/doctor/runtime.d.ts.map +1 -1
- package/dist/commands/doctor/runtime.js +2 -2
- package/dist/commands/doctor/workspace.js +1 -1
- package/dist/commands/finish.spec.js +1 -1
- package/dist/commands/guard/commit.command.js +1 -1
- package/dist/commands/guard/impl/clean.d.ts +6 -0
- package/dist/commands/guard/impl/clean.d.ts.map +1 -0
- package/dist/commands/guard/impl/clean.js +29 -0
- package/dist/commands/guard/impl/close-dirt.d.ts +6 -0
- package/dist/commands/guard/impl/close-dirt.d.ts.map +1 -0
- package/dist/commands/guard/impl/close-dirt.js +56 -0
- package/dist/commands/guard/impl/commands.d.ts +4 -36
- package/dist/commands/guard/impl/commands.d.ts.map +1 -1
- package/dist/commands/guard/impl/commands.js +4 -549
- package/dist/commands/guard/impl/comment-commit.js +1 -1
- package/dist/commands/guard/impl/commit-diagnostics.d.ts +4 -0
- package/dist/commands/guard/impl/commit-diagnostics.d.ts.map +1 -0
- package/dist/commands/guard/impl/commit-diagnostics.js +150 -0
- package/dist/commands/guard/impl/commit.d.ts +25 -0
- package/dist/commands/guard/impl/commit.d.ts.map +1 -0
- package/dist/commands/guard/impl/commit.js +366 -0
- package/dist/commands/guard/impl/guard-commit.d.ts +3 -0
- package/dist/commands/guard/impl/guard-commit.d.ts.map +1 -0
- package/dist/commands/guard/impl/guard-commit.js +21 -0
- package/dist/commands/guard/impl/policy.d.ts +1 -0
- package/dist/commands/guard/impl/policy.d.ts.map +1 -1
- package/dist/commands/guard/impl/policy.js +9 -2
- package/dist/commands/guard/impl/suggest.d.ts +6 -0
- package/dist/commands/guard/impl/suggest.d.ts.map +1 -0
- package/dist/commands/guard/impl/suggest.js +33 -0
- package/dist/commands/hooks/index.d.ts +3 -0
- package/dist/commands/hooks/index.d.ts.map +1 -1
- package/dist/commands/hooks/index.js +27 -10
- package/dist/commands/pr/integrate/cmd.js +1 -1
- package/dist/commands/pr/integrate/internal/prepare.js +1 -1
- package/dist/commands/pr/internal/auto-commit.d.ts.map +1 -1
- package/dist/commands/pr/internal/auto-commit.js +2 -5
- package/dist/commands/pr/internal/gh-api.d.ts.map +1 -1
- package/dist/commands/pr/internal/gh-api.js +15 -8
- package/dist/commands/pr/internal/sync-branch.d.ts +0 -1
- package/dist/commands/pr/internal/sync-branch.d.ts.map +1 -1
- package/dist/commands/pr/internal/sync-branch.js +2 -5
- package/dist/commands/pr/internal/sync.d.ts.map +1 -1
- package/dist/commands/pr/internal/sync.js +30 -0
- package/dist/commands/pr/open.d.ts.map +1 -1
- package/dist/commands/pr/open.js +98 -8
- package/dist/commands/recipes/impl/resolver.js +1 -1
- package/dist/commands/recipes/impl/version.js +1 -1
- package/dist/commands/release/apply.command.js +1 -1
- package/dist/commands/release/apply.mutation.d.ts +1 -0
- package/dist/commands/release/apply.mutation.d.ts.map +1 -1
- package/dist/commands/release/apply.mutation.js +5 -1
- package/dist/commands/release/apply.pipeline/finalize.d.ts +21 -0
- package/dist/commands/release/apply.pipeline/finalize.d.ts.map +1 -0
- package/dist/commands/release/apply.pipeline/finalize.js +80 -0
- package/dist/commands/release/apply.pipeline/mutation.d.ts +18 -0
- package/dist/commands/release/apply.pipeline/mutation.d.ts.map +1 -0
- package/dist/commands/release/apply.pipeline/mutation.js +78 -0
- package/dist/commands/release/apply.pipeline/preflight.d.ts +25 -0
- package/dist/commands/release/apply.pipeline/preflight.d.ts.map +1 -0
- package/dist/commands/release/apply.pipeline/preflight.js +69 -0
- package/dist/commands/release/apply.pipeline/shared.d.ts +2 -0
- package/dist/commands/release/apply.pipeline/shared.d.ts.map +1 -0
- package/dist/commands/release/apply.pipeline/shared.js +5 -0
- package/dist/commands/release/apply.pipeline/state.d.ts +25 -0
- package/dist/commands/release/apply.pipeline/state.d.ts.map +1 -0
- package/dist/commands/release/apply.pipeline/state.js +129 -0
- package/dist/commands/release/apply.pipeline.d.ts +1 -1
- package/dist/commands/release/apply.pipeline.d.ts.map +1 -1
- package/dist/commands/release/apply.pipeline.js +4 -347
- package/dist/commands/release/apply.preflight.d.ts +9 -6
- package/dist/commands/release/apply.preflight.d.ts.map +1 -1
- package/dist/commands/release/apply.preflight.js +71 -51
- package/dist/commands/runtime.command.d.ts +2 -2
- package/dist/commands/runtime.command.d.ts.map +1 -1
- package/dist/commands/runtime.command.js +2 -2
- package/dist/commands/scenario/impl/commands.d.ts.map +1 -1
- package/dist/commands/scenario/impl/commands.js +52 -39
- package/dist/commands/scenario/impl/report.d.ts.map +1 -1
- package/dist/commands/scenario/impl/report.js +4 -7
- package/dist/commands/shared/allow-prefix-policy.d.ts.map +1 -0
- package/dist/{shared → commands/shared}/allow-prefix-policy.js +1 -1
- package/dist/commands/shared/comment-format.d.ts.map +1 -0
- package/dist/commands/shared/diagnostics.d.ts.map +1 -0
- package/dist/commands/shared/git-context.d.ts +1 -27
- package/dist/commands/shared/git-context.d.ts.map +1 -1
- package/dist/commands/shared/git-context.js +1 -156
- package/dist/commands/shared/git-diff.d.ts +1 -10
- package/dist/commands/shared/git-diff.d.ts.map +1 -1
- package/dist/commands/shared/git-diff.js +1 -49
- package/dist/commands/shared/git-ops.d.ts +1 -14
- package/dist/commands/shared/git-ops.d.ts.map +1 -1
- package/dist/commands/shared/git-ops.js +20 -150
- package/dist/commands/shared/git-worktree.d.ts +1 -9
- package/dist/commands/shared/git-worktree.d.ts.map +1 -1
- package/dist/commands/shared/git-worktree.js +1 -68
- package/dist/commands/shared/git.d.ts +1 -3
- package/dist/commands/shared/git.d.ts.map +1 -1
- package/dist/commands/shared/git.js +1 -14
- package/dist/commands/shared/policy-deny.d.ts +1 -1
- package/dist/commands/shared/reconcile-check.js +1 -1
- package/dist/commands/shared/task-backend.d.ts.map +1 -1
- package/dist/commands/shared/task-backend.js +24 -2
- package/dist/commands/shared/task-store/intents.d.ts.map +1 -1
- package/dist/commands/shared/task-store/intents.js +1 -1
- package/dist/commands/start.spec.js +1 -1
- package/dist/commands/task/close-tail-state.d.ts +7 -0
- package/dist/commands/task/close-tail-state.d.ts.map +1 -0
- package/dist/commands/task/close-tail-state.js +18 -0
- package/dist/commands/task/derive.js +1 -1
- package/dist/commands/task/finish-close.d.ts +22 -0
- package/dist/commands/task/finish-close.d.ts.map +1 -0
- package/dist/commands/task/finish-close.js +119 -0
- package/dist/commands/task/finish-command.d.ts +3 -0
- package/dist/commands/task/finish-command.d.ts.map +1 -0
- package/dist/commands/task/finish-command.js +56 -0
- package/dist/commands/task/finish-execute.d.ts +8 -0
- package/dist/commands/task/finish-execute.d.ts.map +1 -0
- package/dist/commands/task/finish-execute.js +272 -0
- package/dist/commands/task/finish-findings.d.ts +20 -0
- package/dist/commands/task/finish-findings.d.ts.map +1 -0
- package/dist/commands/task/finish-findings.js +27 -0
- package/dist/commands/task/finish-plan.d.ts +7 -0
- package/dist/commands/task/finish-plan.d.ts.map +1 -0
- package/dist/commands/task/finish-plan.js +157 -0
- package/dist/commands/task/finish-types.d.ts +69 -0
- package/dist/commands/task/finish-types.d.ts.map +1 -0
- package/dist/commands/task/finish.d.ts +1 -42
- package/dist/commands/task/finish.d.ts.map +1 -1
- package/dist/commands/task/finish.js +1 -527
- package/dist/commands/task/hosted-close-pr.command.d.ts.map +1 -1
- package/dist/commands/task/hosted-close-pr.command.js +29 -4
- package/dist/commands/task/hosted-close.command.d.ts.map +1 -1
- package/dist/commands/task/hosted-close.command.js +23 -2
- package/dist/commands/task/hosted-merge-sync/builders.d.ts +35 -0
- package/dist/commands/task/hosted-merge-sync/builders.d.ts.map +1 -0
- package/dist/commands/task/hosted-merge-sync/builders.js +148 -0
- package/dist/commands/task/hosted-merge-sync/github.d.ts +10 -0
- package/dist/commands/task/hosted-merge-sync/github.d.ts.map +1 -0
- package/dist/commands/task/hosted-merge-sync/github.js +113 -0
- package/dist/commands/task/hosted-merge-sync/local-branch.d.ts +12 -0
- package/dist/commands/task/hosted-merge-sync/local-branch.d.ts.map +1 -0
- package/dist/commands/task/hosted-merge-sync/local-branch.js +143 -0
- package/dist/commands/task/hosted-merge-sync/model.d.ts +47 -0
- package/dist/commands/task/hosted-merge-sync/model.d.ts.map +1 -0
- package/dist/commands/task/hosted-merge-sync/pr-meta.d.ts +12 -0
- package/dist/commands/task/hosted-merge-sync/pr-meta.d.ts.map +1 -0
- package/dist/commands/task/hosted-merge-sync/pr-meta.js +26 -0
- package/dist/commands/task/hosted-merge-sync.d.ts +5 -63
- package/dist/commands/task/hosted-merge-sync.d.ts.map +1 -1
- package/dist/commands/task/hosted-merge-sync.js +10 -444
- package/dist/commands/task/new.js +1 -1
- package/dist/commands/task/set-status.command.js +1 -1
- package/dist/commands/task/shared/direct-work-lock.d.ts.map +1 -0
- package/dist/commands/task/shared/git-log.d.ts.map +1 -0
- package/dist/commands/task/shared/transitions.d.ts +1 -1
- package/dist/commands/task/shared/transitions.d.ts.map +1 -1
- package/dist/commands/task/shared/transitions.js +4 -6
- package/dist/commands/upgrade/apply.js +1 -1
- package/dist/commands/workflow-playbook.command.d.ts.map +1 -1
- package/dist/commands/workflow-playbook.command.js +8 -7
- package/dist/harness/hooks-lifecycle.d.ts.map +1 -1
- package/dist/harness/hooks-lifecycle.js +11 -7
- package/dist/meta/release.d.ts.map +1 -1
- package/dist/meta/release.js +8 -4
- package/dist/policy/engine.d.ts +1 -1
- package/dist/policy/evaluate.d.ts +1 -1
- package/dist/policy/{types.d.ts → model.d.ts} +1 -1
- package/dist/policy/{types.d.ts.map → model.d.ts.map} +1 -1
- package/dist/policy/result.d.ts +1 -1
- package/dist/policy/rules/allowlist.d.ts +1 -1
- package/dist/policy/rules/branch-pr-base.d.ts +1 -1
- package/dist/policy/rules/clean-tree.d.ts +1 -1
- package/dist/policy/rules/commit-subject.d.ts +1 -1
- package/dist/policy/rules/protected-paths.d.ts +1 -1
- package/dist/runner/adapters/base.d.ts +42 -0
- package/dist/runner/adapters/base.d.ts.map +1 -0
- package/dist/runner/adapters/base.js +107 -0
- package/dist/runner/adapters/codex-preparation.d.ts +7 -0
- package/dist/runner/adapters/codex-preparation.d.ts.map +1 -0
- package/dist/runner/adapters/codex-preparation.js +86 -0
- package/dist/runner/adapters/codex.d.ts.map +1 -1
- package/dist/runner/adapters/codex.js +30 -175
- package/dist/runner/adapters/custom-preparation.d.ts +9 -0
- package/dist/runner/adapters/custom-preparation.d.ts.map +1 -0
- package/dist/runner/adapters/custom-preparation.js +191 -0
- package/dist/runner/adapters/custom.d.ts.map +1 -1
- package/dist/runner/adapters/custom.js +26 -279
- package/dist/runner/process-supervision/run.d.ts +30 -0
- package/dist/runner/process-supervision/run.d.ts.map +1 -0
- package/dist/runner/process-supervision/run.js +349 -0
- package/dist/runner/process-supervision/signals.d.ts +16 -0
- package/dist/runner/process-supervision/signals.d.ts.map +1 -0
- package/dist/runner/process-supervision/signals.js +85 -0
- package/dist/runner/process-supervision/state.d.ts +10 -0
- package/dist/runner/process-supervision/state.d.ts.map +1 -0
- package/dist/runner/process-supervision/state.js +42 -0
- package/dist/runner/process-supervision/streams.d.ts +6 -0
- package/dist/runner/process-supervision/streams.d.ts.map +1 -0
- package/dist/runner/process-supervision/streams.js +23 -0
- package/dist/runner/process-supervision.d.ts +5 -47
- package/dist/runner/process-supervision.d.ts.map +1 -1
- package/dist/runner/process-supervision.js +3 -490
- package/dist/runner/usecases/scenario-materialize-task.js +1 -1
- package/dist/runtime/approvals/index.d.ts +1 -1
- package/dist/runtime/approvals/{types.d.ts → model.d.ts} +1 -1
- package/dist/runtime/approvals/{types.d.ts.map → model.d.ts.map} +1 -1
- package/dist/runtime/approvals/runtime.d.ts +1 -1
- package/dist/runtime/behavior/index.d.ts +1 -1
- package/dist/runtime/behavior/{types.d.ts → model.d.ts} +1 -1
- package/dist/runtime/behavior/{types.d.ts.map → model.d.ts.map} +1 -1
- package/dist/runtime/behavior/resolve.d.ts +1 -1
- package/dist/runtime/capabilities/backend.d.ts +1 -1
- package/dist/runtime/capabilities/index.d.ts +1 -1
- package/dist/runtime/capabilities/{types.d.ts → model.d.ts} +1 -1
- package/dist/runtime/capabilities/{types.d.ts.map → model.d.ts.map} +1 -1
- package/dist/runtime/capabilities/model.js +1 -0
- package/dist/runtime/capabilities/recipe.d.ts +1 -1
- package/dist/runtime/capabilities/registry.d.ts +1 -1
- package/dist/runtime/capabilities/runner.d.ts +1 -1
- package/dist/runtime/execution-context.d.ts.map +1 -1
- package/dist/runtime/execution-context.js +16 -0
- package/dist/runtime/execution-profile/index.d.ts +1 -1
- package/dist/runtime/execution-profile/{types.d.ts → model.d.ts} +1 -1
- package/dist/runtime/execution-profile/{types.d.ts.map → model.d.ts.map} +1 -1
- package/dist/runtime/execution-profile/model.js +1 -0
- package/dist/runtime/execution-profile/resolve.d.ts +1 -1
- package/dist/runtime/explain/index.d.ts +1 -1
- package/dist/runtime/explain/{types.d.ts → model.d.ts} +1 -1
- package/dist/runtime/explain/{types.d.ts.map → model.d.ts.map} +1 -1
- package/dist/runtime/explain/model.js +1 -0
- package/dist/runtime/explain/resolve.d.ts +1 -1
- package/dist/runtime/protocol/index.d.ts +1 -1
- package/dist/runtime/protocol/index.js +1 -1
- package/dist/runtime/protocol/{types.d.ts → model.d.ts} +1 -1
- package/dist/runtime/protocol/{types.d.ts.map → model.d.ts.map} +1 -1
- package/dist/runtime/protocol/resolve.d.ts +1 -1
- package/dist/runtime/protocol/resolve.js +1 -1
- package/dist/runtime/shared/repo-cli-version.d.ts.map +1 -0
- package/dist/{shared → runtime/shared}/repo-cli-version.js +1 -1
- package/dist/runtime/shared/runtime-artifacts.d.ts.map +1 -0
- package/dist/{shared → runtime/shared}/runtime-source.d.ts +1 -1
- package/dist/runtime/shared/runtime-source.d.ts.map +1 -0
- package/dist/{shared → runtime/shared}/runtime-source.js +1 -1
- package/dist/runtime/shared/version-compare.d.ts.map +1 -0
- package/dist/runtime/task-intake/resolve.js +1 -1
- package/dist/shared/errors.d.ts +52 -2
- package/dist/shared/errors.d.ts.map +1 -1
- package/dist/shared/errors.js +66 -4
- package/dist/shared/trace-events.d.ts +13 -0
- package/dist/shared/trace-events.d.ts.map +1 -0
- package/dist/shared/trace-events.js +17 -0
- package/dist/{shared/task-doc-conflicts.d.ts → task-doc/conflicts.d.ts} +1 -1
- package/dist/task-doc/conflicts.d.ts.map +1 -0
- package/dist/{shared/task-doc-conflicts.js → task-doc/conflicts.js} +1 -1
- package/dist/{shared/task-doc-state.d.ts → task-doc/state.d.ts} +1 -1
- package/dist/task-doc/state.d.ts.map +1 -0
- package/package.json +8 -8
- package/dist/cli/run-cli/error-guidance.d.ts +0 -9
- package/dist/cli/run-cli/error-guidance.d.ts.map +0 -1
- package/dist/cli/run-cli/error-guidance.js +0 -210
- package/dist/cli/run-cli.test-helpers.d.ts +0 -2
- package/dist/cli/run-cli.test-helpers.d.ts.map +0 -1
- package/dist/cli/run-cli.test-helpers.js +0 -1
- package/dist/commands/recipes.test-helpers.d.ts +0 -202
- package/dist/commands/recipes.test-helpers.d.ts.map +0 -1
- package/dist/commands/recipes.test-helpers.js +0 -483
- package/dist/commands/release.test-helpers.d.ts +0 -38
- package/dist/commands/release.test-helpers.d.ts.map +0 -1
- package/dist/commands/release.test-helpers.js +0 -55
- package/dist/commands/task.test-helpers.d.ts +0 -13
- package/dist/commands/task.test-helpers.d.ts.map +0 -1
- package/dist/commands/task.test-helpers.js +0 -65
- package/dist/runner/test-helpers.d.ts +0 -30
- package/dist/runner/test-helpers.d.ts.map +0 -1
- package/dist/runner/test-helpers.js +0 -97
- package/dist/shared/agent-emoji.d.ts +0 -5
- package/dist/shared/agent-emoji.d.ts.map +0 -1
- package/dist/shared/agent-emoji.js +0 -51
- package/dist/shared/allow-prefix-policy.d.ts.map +0 -1
- package/dist/shared/comment-format.d.ts.map +0 -1
- package/dist/shared/diagnostics.d.ts.map +0 -1
- package/dist/shared/direct-work-lock.d.ts.map +0 -1
- package/dist/shared/git-log.d.ts.map +0 -1
- package/dist/shared/repo-cli-version.d.ts.map +0 -1
- package/dist/shared/runtime-artifacts.d.ts.map +0 -1
- package/dist/shared/runtime-source.d.ts.map +0 -1
- package/dist/shared/task-doc-conflicts.d.ts.map +0 -1
- package/dist/shared/task-doc-state.d.ts.map +0 -1
- package/dist/shared/version-compare.d.ts.map +0 -1
- package/dist/testing/cli-harness/recipe-archives.d.ts +0 -28
- package/dist/testing/cli-harness/recipe-archives.d.ts.map +0 -1
- package/dist/testing/cli-harness/recipe-archives.js +0 -374
- package/dist/testing/cli-harness/stdio.d.ts +0 -26
- package/dist/testing/cli-harness/stdio.d.ts.map +0 -1
- package/dist/testing/cli-harness/stdio.js +0 -84
- package/dist/testing/cli-harness.d.ts +0 -25
- package/dist/testing/cli-harness.d.ts.map +0 -1
- package/dist/testing/cli-harness.js +0 -313
- package/dist/testing/index.d.ts +0 -2
- package/dist/testing/index.d.ts.map +0 -1
- package/dist/testing/index.js +0 -1
- /package/dist/{policy/types.js → cli/run-cli/commands/init/model.js} +0 -0
- /package/dist/{shared → commands/shared}/allow-prefix-policy.d.ts +0 -0
- /package/dist/{shared → commands/shared}/comment-format.d.ts +0 -0
- /package/dist/{shared → commands/shared}/comment-format.js +0 -0
- /package/dist/{shared → commands/shared}/diagnostics.d.ts +0 -0
- /package/dist/{shared → commands/shared}/diagnostics.js +0 -0
- /package/dist/{runtime/approvals/types.js → commands/task/finish-types.js} +0 -0
- /package/dist/{runtime/behavior/types.js → commands/task/hosted-merge-sync/model.js} +0 -0
- /package/dist/{shared → commands/task/shared}/direct-work-lock.d.ts +0 -0
- /package/dist/{shared → commands/task/shared}/direct-work-lock.js +0 -0
- /package/dist/{shared → commands/task/shared}/git-log.d.ts +0 -0
- /package/dist/{shared → commands/task/shared}/git-log.js +0 -0
- /package/dist/{runtime/capabilities/types.js → policy/model.js} +0 -0
- /package/dist/runtime/{execution-profile/types.js → approvals/model.js} +0 -0
- /package/dist/runtime/{explain/types.js → behavior/model.js} +0 -0
- /package/dist/runtime/protocol/{types.js → model.js} +0 -0
- /package/dist/{shared → runtime/shared}/repo-cli-version.d.ts +0 -0
- /package/dist/{shared → runtime/shared}/runtime-artifacts.d.ts +0 -0
- /package/dist/{shared → runtime/shared}/runtime-artifacts.js +0 -0
- /package/dist/{shared → runtime/shared}/version-compare.d.ts +0 -0
- /package/dist/{shared → runtime/shared}/version-compare.js +0 -0
- /package/dist/{shared/task-doc-state.js → task-doc/state.js} +0 -0
|
@@ -1,43 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export declare function cmdFinish(opts: {
|
|
3
|
-
ctx?: CommandContext;
|
|
4
|
-
cwd: string;
|
|
5
|
-
rootOverride?: string;
|
|
6
|
-
taskIds: string[];
|
|
7
|
-
author: string;
|
|
8
|
-
body: string;
|
|
9
|
-
result?: string;
|
|
10
|
-
risk?: "low" | "med" | "high";
|
|
11
|
-
breaking: boolean;
|
|
12
|
-
commit?: string;
|
|
13
|
-
force: boolean;
|
|
14
|
-
yes?: boolean;
|
|
15
|
-
commitFromComment: boolean;
|
|
16
|
-
commitEmoji?: string;
|
|
17
|
-
commitAllow: string[];
|
|
18
|
-
commitAutoAllow: boolean;
|
|
19
|
-
commitAllowTasks: boolean;
|
|
20
|
-
commitRequireClean: boolean;
|
|
21
|
-
statusCommit: boolean;
|
|
22
|
-
statusCommitEmoji?: string;
|
|
23
|
-
statusCommitAllow: string[];
|
|
24
|
-
statusCommitAutoAllow: boolean;
|
|
25
|
-
statusCommitRequireClean: boolean;
|
|
26
|
-
confirmStatusCommit: boolean;
|
|
27
|
-
closeCommit?: boolean;
|
|
28
|
-
noCloseCommit?: boolean;
|
|
29
|
-
closeUnstageOthers?: boolean;
|
|
30
|
-
baseBranchOverride?: string;
|
|
31
|
-
observation?: string;
|
|
32
|
-
impact?: string;
|
|
33
|
-
resolution?: string;
|
|
34
|
-
localOnly?: boolean;
|
|
35
|
-
repoFixable?: boolean;
|
|
36
|
-
incidentScope?: string;
|
|
37
|
-
incidentTags?: string[];
|
|
38
|
-
incidentMatch?: string[];
|
|
39
|
-
incidentAdvice?: string;
|
|
40
|
-
incidentRule?: string;
|
|
41
|
-
quiet: boolean;
|
|
42
|
-
}): Promise<number>;
|
|
1
|
+
export { cmdFinish } from "./finish-command.js";
|
|
43
2
|
//# sourceMappingURL=finish.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"finish.d.ts","sourceRoot":"","sources":["../../../src/commands/task/finish.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"finish.d.ts","sourceRoot":"","sources":["../../../src/commands/task/finish.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -1,527 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { mapBackendError } from "../../cli/error-map.js";
|
|
3
|
-
import { exitCodeForError } from "../../cli/exit-codes.js";
|
|
4
|
-
import { infoMessage, invalidValueMessage, successMessage } from "../../cli/output.js";
|
|
5
|
-
import { CliError } from "../../shared/errors.js";
|
|
6
|
-
import { readFile, rm } from "node:fs/promises";
|
|
7
|
-
import path from "node:path";
|
|
8
|
-
import { ensureActionApproved } from "../shared/approval-requirements.js";
|
|
9
|
-
import { ensureReconciledBeforeMutation } from "../shared/reconcile-check.js";
|
|
10
|
-
import { execFileAsync, gitEnv } from "../shared/git.js";
|
|
11
|
-
import { gitBranchExists, gitCurrentBranch } from "../shared/git-ops.js";
|
|
12
|
-
import { backendUsesLocalTaskStore, loadCommandContext, } from "../shared/task-backend.js";
|
|
13
|
-
import { getTaskStore } from "../shared/task-store.js";
|
|
14
|
-
import { applyTaskMutation } from "../shared/task-mutation.js";
|
|
15
|
-
import { collectTaskIncidents, renderIncidentCollectionPlanOutcome } from "../incidents/shared.js";
|
|
16
|
-
import { createTaskCloseCommit, existingCommitInfo, loadTaskForFinish, writeFinishedTasks, } from "./finish-shared.js";
|
|
17
|
-
import { buildStructuredFindingMutationPlan } from "./findings.js";
|
|
18
|
-
import { defaultCommitEmojiForStatus, enforceStatusCommitPolicy, prepareTaskTransitionComment, readCommitInfo, requireStructuredComment, runTaskTransitionCommentCommit, } from "./shared.js";
|
|
19
|
-
async function clearDirectWorkLockIfMatches(opts) {
|
|
20
|
-
const lockPath = path.join(opts.agentplaneDir, "cache", "direct-work.json");
|
|
21
|
-
try {
|
|
22
|
-
const text = await readFile(lockPath, "utf8");
|
|
23
|
-
const parsed = JSON.parse(text);
|
|
24
|
-
const lockTaskId = parsed && typeof parsed.task_id === "string" ? parsed.task_id : null;
|
|
25
|
-
if (!lockTaskId)
|
|
26
|
-
return;
|
|
27
|
-
if (!opts.taskIds.includes(lockTaskId))
|
|
28
|
-
return;
|
|
29
|
-
await rm(lockPath, { force: true });
|
|
30
|
-
}
|
|
31
|
-
catch {
|
|
32
|
-
// best-effort
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
async function ensureFinishRunsOnBaseBranch(opts) {
|
|
36
|
-
if (opts.ctx.config.workflow_mode !== "branch_pr")
|
|
37
|
-
return;
|
|
38
|
-
const baseBranch = await resolveBaseBranch({
|
|
39
|
-
cwd: opts.cwd,
|
|
40
|
-
rootOverride: opts.rootOverride ?? null,
|
|
41
|
-
cliBaseOpt: opts.baseBranchOverride ?? null,
|
|
42
|
-
mode: opts.ctx.config.workflow_mode,
|
|
43
|
-
});
|
|
44
|
-
if (!baseBranch) {
|
|
45
|
-
throw new CliError({
|
|
46
|
-
exitCode: exitCodeForError("E_USAGE"),
|
|
47
|
-
code: "E_USAGE",
|
|
48
|
-
message: "Base branch could not be resolved (use `agentplane branch base set` or --base).",
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
const currentBranch = await gitCurrentBranch(opts.ctx.resolvedProject.gitRoot);
|
|
52
|
-
if (currentBranch === baseBranch)
|
|
53
|
-
return;
|
|
54
|
-
throw new CliError({
|
|
55
|
-
exitCode: exitCodeForError("E_GIT"),
|
|
56
|
-
code: "E_GIT",
|
|
57
|
-
message: `finish must run on base branch ${baseBranch} in branch_pr mode ` +
|
|
58
|
-
`(current: ${currentBranch}); integrate first or reconcile from the base checkout.`,
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
async function readHeadCommitHash(gitRoot) {
|
|
62
|
-
const { stdout } = await execFileAsync("git", ["rev-parse", "HEAD"], {
|
|
63
|
-
cwd: gitRoot,
|
|
64
|
-
env: gitEnv(),
|
|
65
|
-
});
|
|
66
|
-
const hash = stdout.trim();
|
|
67
|
-
if (!hash) {
|
|
68
|
-
throw new CliError({
|
|
69
|
-
exitCode: exitCodeForError("E_GIT"),
|
|
70
|
-
code: "E_GIT",
|
|
71
|
-
message: "Failed to resolve HEAD while preparing a branch_pr close tail.",
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
return hash;
|
|
75
|
-
}
|
|
76
|
-
function branchPrCloseBranchName(taskId, headCommitHash) {
|
|
77
|
-
return `task-close/${taskId}/${headCommitHash.slice(0, 12)}`;
|
|
78
|
-
}
|
|
79
|
-
async function materializeBranchPrCloseTail(opts) {
|
|
80
|
-
const gitRoot = opts.ctx.resolvedProject.gitRoot;
|
|
81
|
-
const baseBranch = await gitCurrentBranch(gitRoot);
|
|
82
|
-
const headCommitHash = await readHeadCommitHash(gitRoot);
|
|
83
|
-
const closeBranch = branchPrCloseBranchName(opts.taskId, headCommitHash);
|
|
84
|
-
const branchExists = await gitBranchExists(gitRoot, closeBranch);
|
|
85
|
-
await execFileAsync("git", branchExists ? ["checkout", closeBranch] : ["checkout", "-b", closeBranch], {
|
|
86
|
-
cwd: gitRoot,
|
|
87
|
-
env: gitEnv(),
|
|
88
|
-
});
|
|
89
|
-
let checkoutError = null;
|
|
90
|
-
try {
|
|
91
|
-
await createTaskCloseCommit({
|
|
92
|
-
ctx: opts.ctx,
|
|
93
|
-
cwd: opts.cwd,
|
|
94
|
-
rootOverride: opts.rootOverride,
|
|
95
|
-
taskId: opts.taskId,
|
|
96
|
-
baseBranchOverride: opts.baseBranchOverride,
|
|
97
|
-
quiet: opts.quiet,
|
|
98
|
-
closeUnstageOthers: opts.closeUnstageOthers,
|
|
99
|
-
allowPolicy: opts.allowPolicy,
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
finally {
|
|
103
|
-
try {
|
|
104
|
-
await execFileAsync("git", ["checkout", baseBranch], {
|
|
105
|
-
cwd: gitRoot,
|
|
106
|
-
env: gitEnv(),
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
catch (error) {
|
|
110
|
-
checkoutError = error;
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
if (checkoutError) {
|
|
114
|
-
throw new CliError({
|
|
115
|
-
exitCode: exitCodeForError("E_GIT"),
|
|
116
|
-
code: "E_GIT",
|
|
117
|
-
message: `Created ${closeBranch} but failed to return to ${baseBranch}; ` +
|
|
118
|
-
"inspect the local checkout before continuing.",
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
return closeBranch;
|
|
122
|
-
}
|
|
123
|
-
async function appendFinishStructuredFinding(opts) {
|
|
124
|
-
await applyTaskMutation({
|
|
125
|
-
ctx: opts.ctx,
|
|
126
|
-
taskId: opts.taskId,
|
|
127
|
-
build: (current) => {
|
|
128
|
-
const plan = buildStructuredFindingMutationPlan({
|
|
129
|
-
current,
|
|
130
|
-
config: opts.ctx.config,
|
|
131
|
-
observation: opts.finding.observation,
|
|
132
|
-
impact: opts.finding.impact,
|
|
133
|
-
resolution: opts.finding.resolution,
|
|
134
|
-
promote: !opts.finding.localOnly,
|
|
135
|
-
external: !opts.finding.localOnly,
|
|
136
|
-
fixability: opts.finding.repoFixable ? "repo-fixable" : null,
|
|
137
|
-
incidentScope: opts.finding.incidentScope,
|
|
138
|
-
incidentTags: opts.finding.incidentTags,
|
|
139
|
-
incidentMatch: opts.finding.incidentMatch,
|
|
140
|
-
incidentAdvice: opts.finding.incidentAdvice,
|
|
141
|
-
incidentRule: opts.finding.incidentRule,
|
|
142
|
-
updatedBy: opts.author,
|
|
143
|
-
});
|
|
144
|
-
return plan ? { intents: plan.intents } : null;
|
|
145
|
-
},
|
|
146
|
-
});
|
|
147
|
-
}
|
|
148
|
-
export async function cmdFinish(opts) {
|
|
149
|
-
try {
|
|
150
|
-
const ctx = opts.ctx ??
|
|
151
|
-
(await loadCommandContext({ cwd: opts.cwd, rootOverride: opts.rootOverride ?? null }));
|
|
152
|
-
await ensureReconciledBeforeMutation({ ctx, command: "finish" });
|
|
153
|
-
await ensureFinishRunsOnBaseBranch({
|
|
154
|
-
ctx,
|
|
155
|
-
cwd: opts.cwd,
|
|
156
|
-
rootOverride: opts.rootOverride,
|
|
157
|
-
baseBranchOverride: opts.baseBranchOverride,
|
|
158
|
-
});
|
|
159
|
-
if (opts.force) {
|
|
160
|
-
await ensureActionApproved({
|
|
161
|
-
action: "force_action",
|
|
162
|
-
config: ctx.config,
|
|
163
|
-
yes: opts.yes === true,
|
|
164
|
-
reason: "finish --force",
|
|
165
|
-
});
|
|
166
|
-
}
|
|
167
|
-
const { prefix, min_chars: minChars } = ctx.config.tasks.comments.verified;
|
|
168
|
-
requireStructuredComment(opts.body, prefix, minChars);
|
|
169
|
-
const statusCommitRequested = opts.statusCommit;
|
|
170
|
-
if ((opts.commitFromComment || statusCommitRequested) && opts.taskIds.length !== 1) {
|
|
171
|
-
throw new CliError({
|
|
172
|
-
exitCode: 2,
|
|
173
|
-
code: "E_USAGE",
|
|
174
|
-
message: "--commit-from-comment/--status-commit requires exactly one task id",
|
|
175
|
-
});
|
|
176
|
-
}
|
|
177
|
-
if (opts.commitFromComment && statusCommitRequested) {
|
|
178
|
-
throw new CliError({
|
|
179
|
-
exitCode: 2,
|
|
180
|
-
code: "E_USAGE",
|
|
181
|
-
message: "--commit-from-comment cannot be combined with --status-commit in finish; use one deterministic commit path.",
|
|
182
|
-
});
|
|
183
|
-
}
|
|
184
|
-
if ((opts.closeCommit || opts.noCloseCommit) && opts.taskIds.length !== 1) {
|
|
185
|
-
throw new CliError({
|
|
186
|
-
exitCode: 2,
|
|
187
|
-
code: "E_USAGE",
|
|
188
|
-
message: "--close-commit/--no-close-commit requires exactly one task id",
|
|
189
|
-
});
|
|
190
|
-
}
|
|
191
|
-
if (opts.closeCommit && opts.noCloseCommit) {
|
|
192
|
-
throw new CliError({
|
|
193
|
-
exitCode: 2,
|
|
194
|
-
code: "E_USAGE",
|
|
195
|
-
message: "--close-commit and --no-close-commit are mutually exclusive",
|
|
196
|
-
});
|
|
197
|
-
}
|
|
198
|
-
if ((opts.closeCommit || opts.noCloseCommit) && (opts.commitFromComment || opts.statusCommit)) {
|
|
199
|
-
throw new CliError({
|
|
200
|
-
exitCode: 2,
|
|
201
|
-
code: "E_USAGE",
|
|
202
|
-
message: "--close-commit/--no-close-commit cannot be combined with --commit-from-comment/--status-commit",
|
|
203
|
-
});
|
|
204
|
-
}
|
|
205
|
-
const primaryTaskId = opts.taskIds[0] ?? "";
|
|
206
|
-
if ((opts.commitFromComment || statusCommitRequested) && !primaryTaskId) {
|
|
207
|
-
throw new CliError({
|
|
208
|
-
exitCode: 2,
|
|
209
|
-
code: "E_USAGE",
|
|
210
|
-
message: "--commit-from-comment/--status-commit requires exactly one task id",
|
|
211
|
-
});
|
|
212
|
-
}
|
|
213
|
-
if (opts.commitAutoAllow) {
|
|
214
|
-
throw new CliError({
|
|
215
|
-
exitCode: 2,
|
|
216
|
-
code: "E_USAGE",
|
|
217
|
-
message: "--commit-auto-allow is disabled; pass explicit --commit-allow <path-prefix>.",
|
|
218
|
-
});
|
|
219
|
-
}
|
|
220
|
-
if (opts.statusCommitAutoAllow) {
|
|
221
|
-
throw new CliError({
|
|
222
|
-
exitCode: 2,
|
|
223
|
-
code: "E_USAGE",
|
|
224
|
-
message: "--status-commit-auto-allow is disabled; pass explicit --status-commit-allow <path-prefix>.",
|
|
225
|
-
});
|
|
226
|
-
}
|
|
227
|
-
if (opts.commitFromComment && opts.commitAllow.length === 0) {
|
|
228
|
-
throw new CliError({
|
|
229
|
-
exitCode: 2,
|
|
230
|
-
code: "E_USAGE",
|
|
231
|
-
message: "--commit-from-comment requires --commit-allow <path-prefix>",
|
|
232
|
-
});
|
|
233
|
-
}
|
|
234
|
-
if (statusCommitRequested && opts.statusCommitAllow.length === 0) {
|
|
235
|
-
throw new CliError({
|
|
236
|
-
exitCode: 2,
|
|
237
|
-
code: "E_USAGE",
|
|
238
|
-
message: "--status-commit requires --status-commit-allow <path-prefix>",
|
|
239
|
-
});
|
|
240
|
-
}
|
|
241
|
-
const useStore = backendUsesLocalTaskStore(ctx);
|
|
242
|
-
const store = useStore ? getTaskStore(ctx) : null;
|
|
243
|
-
const backendWritesTaskReadmes = ctx.taskBackend.capabilities.writes_task_readmes === true;
|
|
244
|
-
const defaultDirectCloseCommit = ctx.config.workflow_mode === "direct" &&
|
|
245
|
-
backendWritesTaskReadmes &&
|
|
246
|
-
opts.taskIds.length === 1 &&
|
|
247
|
-
!opts.commitFromComment &&
|
|
248
|
-
!statusCommitRequested;
|
|
249
|
-
const defaultBranchPrCloseCommit = ctx.config.workflow_mode === "branch_pr" &&
|
|
250
|
-
backendWritesTaskReadmes &&
|
|
251
|
-
opts.taskIds.length === 1 &&
|
|
252
|
-
!opts.commitFromComment &&
|
|
253
|
-
!statusCommitRequested;
|
|
254
|
-
const statusPathRequiresTrackedTaskCommit = backendWritesTaskReadmes &&
|
|
255
|
-
opts.taskIds.length === 1 &&
|
|
256
|
-
(opts.commitFromComment || statusCommitRequested);
|
|
257
|
-
const shouldCloseCommit = opts.closeCommit === true ||
|
|
258
|
-
statusPathRequiresTrackedTaskCommit ||
|
|
259
|
-
(defaultDirectCloseCommit && opts.noCloseCommit !== true) ||
|
|
260
|
-
(defaultBranchPrCloseCommit && opts.noCloseCommit !== true);
|
|
261
|
-
const metaTaskId = opts.taskIds.length === 1 ? (opts.taskIds[0] ?? "") : "";
|
|
262
|
-
const wantMeta = typeof opts.result === "string" || typeof opts.risk === "string" || opts.breaking === true;
|
|
263
|
-
const resultProvided = typeof opts.result === "string";
|
|
264
|
-
if (wantMeta && opts.taskIds.length !== 1) {
|
|
265
|
-
throw new CliError({
|
|
266
|
-
exitCode: 2,
|
|
267
|
-
code: "E_USAGE",
|
|
268
|
-
message: "--result/--risk/--breaking requires exactly one task id",
|
|
269
|
-
});
|
|
270
|
-
}
|
|
271
|
-
const resultSummary = typeof opts.result === "string" ? opts.result.trim() : "";
|
|
272
|
-
const riskLevel = opts.risk;
|
|
273
|
-
const breaking = opts.breaking === true;
|
|
274
|
-
const finishFinding = typeof opts.observation === "string" &&
|
|
275
|
-
typeof opts.impact === "string" &&
|
|
276
|
-
typeof opts.resolution === "string"
|
|
277
|
-
? {
|
|
278
|
-
observation: opts.observation,
|
|
279
|
-
impact: opts.impact,
|
|
280
|
-
resolution: opts.resolution,
|
|
281
|
-
localOnly: opts.localOnly === true,
|
|
282
|
-
repoFixable: opts.repoFixable === true,
|
|
283
|
-
incidentScope: opts.incidentScope,
|
|
284
|
-
incidentTags: opts.incidentTags ?? [],
|
|
285
|
-
incidentMatch: opts.incidentMatch ?? [],
|
|
286
|
-
incidentAdvice: opts.incidentAdvice,
|
|
287
|
-
incidentRule: opts.incidentRule,
|
|
288
|
-
}
|
|
289
|
-
: null;
|
|
290
|
-
if (finishFinding && opts.taskIds.length !== 1) {
|
|
291
|
-
throw new CliError({
|
|
292
|
-
exitCode: 2,
|
|
293
|
-
code: "E_USAGE",
|
|
294
|
-
message: "--observation/--impact/--resolution and incident finding options require exactly one task id",
|
|
295
|
-
});
|
|
296
|
-
}
|
|
297
|
-
if (finishFinding && primaryTaskId) {
|
|
298
|
-
await loadTaskForFinish({
|
|
299
|
-
ctx,
|
|
300
|
-
store,
|
|
301
|
-
useStore,
|
|
302
|
-
taskId: primaryTaskId,
|
|
303
|
-
taskCount: opts.taskIds.length,
|
|
304
|
-
metaTaskId,
|
|
305
|
-
resultProvided,
|
|
306
|
-
resultSummary,
|
|
307
|
-
force: opts.force,
|
|
308
|
-
capturePrimaryLifecycleMeta: false,
|
|
309
|
-
});
|
|
310
|
-
await appendFinishStructuredFinding({
|
|
311
|
-
ctx,
|
|
312
|
-
taskId: primaryTaskId,
|
|
313
|
-
author: opts.author,
|
|
314
|
-
finding: finishFinding,
|
|
315
|
-
});
|
|
316
|
-
}
|
|
317
|
-
let primaryStatusFrom = null;
|
|
318
|
-
let primaryTag = null;
|
|
319
|
-
const loadedTasks = [];
|
|
320
|
-
for (const taskId of opts.taskIds) {
|
|
321
|
-
const loaded = await loadTaskForFinish({
|
|
322
|
-
ctx,
|
|
323
|
-
store,
|
|
324
|
-
useStore,
|
|
325
|
-
taskId,
|
|
326
|
-
taskCount: opts.taskIds.length,
|
|
327
|
-
metaTaskId,
|
|
328
|
-
resultProvided,
|
|
329
|
-
resultSummary,
|
|
330
|
-
force: opts.force,
|
|
331
|
-
capturePrimaryLifecycleMeta: taskId === primaryTaskId,
|
|
332
|
-
});
|
|
333
|
-
loadedTasks.push(loaded.loaded);
|
|
334
|
-
if (taskId === primaryTaskId) {
|
|
335
|
-
primaryStatusFrom = loaded.primaryStatusFrom;
|
|
336
|
-
primaryTag = loaded.primaryTag;
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
for (const taskId of opts.taskIds) {
|
|
340
|
-
const loadedTask = loadedTasks.find((candidate) => candidate.taskId === taskId) ?? null;
|
|
341
|
-
await collectTaskIncidents({
|
|
342
|
-
ctx,
|
|
343
|
-
taskId,
|
|
344
|
-
task: loadedTask?.task ?? null,
|
|
345
|
-
write: false,
|
|
346
|
-
});
|
|
347
|
-
}
|
|
348
|
-
const tasksMissingCommit = loadedTasks
|
|
349
|
-
.filter(({ task }) => !existingCommitInfo(task))
|
|
350
|
-
.map(({ taskId }) => taskId);
|
|
351
|
-
if (!opts.commitFromComment && !opts.commit && tasksMissingCommit.length > 0) {
|
|
352
|
-
throw new CliError({
|
|
353
|
-
exitCode: 2,
|
|
354
|
-
code: "E_USAGE",
|
|
355
|
-
message: "finish requires --commit <hash> or existing task commit metadata on every task; implicit HEAD fallback was removed.",
|
|
356
|
-
});
|
|
357
|
-
}
|
|
358
|
-
if (opts.commitFromComment || statusCommitRequested) {
|
|
359
|
-
enforceStatusCommitPolicy({
|
|
360
|
-
policy: ctx.config.status_commit_policy,
|
|
361
|
-
action: "finish",
|
|
362
|
-
confirmed: opts.confirmStatusCommit,
|
|
363
|
-
quiet: opts.quiet,
|
|
364
|
-
statusFrom: primaryStatusFrom ?? "UNKNOWN",
|
|
365
|
-
statusTo: "DONE",
|
|
366
|
-
});
|
|
367
|
-
}
|
|
368
|
-
const gitRoot = ctx.resolvedProject.gitRoot;
|
|
369
|
-
let taskCommitInfo = opts.commit
|
|
370
|
-
? await readCommitInfo(gitRoot, opts.commit)
|
|
371
|
-
: null;
|
|
372
|
-
const preparedComment = opts.commitFromComment || statusCommitRequested
|
|
373
|
-
? prepareTaskTransitionComment({
|
|
374
|
-
body: opts.body,
|
|
375
|
-
enabled: true,
|
|
376
|
-
config: ctx.config,
|
|
377
|
-
})
|
|
378
|
-
: null;
|
|
379
|
-
if (opts.commitFromComment) {
|
|
380
|
-
if (typeof opts.commitEmoji === "string" && opts.commitEmoji.trim() !== "✅") {
|
|
381
|
-
throw new CliError({
|
|
382
|
-
exitCode: 2,
|
|
383
|
-
code: "E_USAGE",
|
|
384
|
-
message: invalidValueMessage("--commit-emoji", opts.commitEmoji, "✅ (finish commits must use a checkmark)"),
|
|
385
|
-
});
|
|
386
|
-
}
|
|
387
|
-
taskCommitInfo = await runTaskTransitionCommentCommit({
|
|
388
|
-
ctx,
|
|
389
|
-
cwd: opts.cwd,
|
|
390
|
-
rootOverride: opts.rootOverride,
|
|
391
|
-
taskId: primaryTaskId,
|
|
392
|
-
primaryTag: primaryTag ?? "meta",
|
|
393
|
-
author: opts.author,
|
|
394
|
-
statusFrom: primaryStatusFrom ?? undefined,
|
|
395
|
-
statusTo: "DONE",
|
|
396
|
-
commentBody: opts.body,
|
|
397
|
-
formattedComment: preparedComment?.formattedComment ?? null,
|
|
398
|
-
emoji: opts.commitEmoji ?? defaultCommitEmojiForStatus("DONE"),
|
|
399
|
-
allow: opts.commitAllow,
|
|
400
|
-
autoAllow: false,
|
|
401
|
-
allowTasks: opts.commitAllowTasks,
|
|
402
|
-
requireClean: opts.commitRequireClean,
|
|
403
|
-
quiet: opts.quiet,
|
|
404
|
-
progressMessage: "creating commit from verification comment",
|
|
405
|
-
resolveExecutorAgent: true,
|
|
406
|
-
});
|
|
407
|
-
}
|
|
408
|
-
if (statusCommitRequested) {
|
|
409
|
-
if (typeof opts.statusCommitEmoji === "string" && opts.statusCommitEmoji.trim() !== "✅") {
|
|
410
|
-
throw new CliError({
|
|
411
|
-
exitCode: 2,
|
|
412
|
-
code: "E_USAGE",
|
|
413
|
-
message: invalidValueMessage("--status-commit-emoji", opts.statusCommitEmoji, "✅ (finish commits must use a checkmark)"),
|
|
414
|
-
});
|
|
415
|
-
}
|
|
416
|
-
await runTaskTransitionCommentCommit({
|
|
417
|
-
ctx,
|
|
418
|
-
cwd: opts.cwd,
|
|
419
|
-
rootOverride: opts.rootOverride,
|
|
420
|
-
taskId: primaryTaskId,
|
|
421
|
-
primaryTag: primaryTag ?? "meta",
|
|
422
|
-
author: opts.author,
|
|
423
|
-
statusFrom: primaryStatusFrom ?? undefined,
|
|
424
|
-
statusTo: "DONE",
|
|
425
|
-
commentBody: opts.body,
|
|
426
|
-
formattedComment: preparedComment?.formattedComment ?? null,
|
|
427
|
-
emoji: opts.statusCommitEmoji ?? defaultCommitEmojiForStatus("DONE"),
|
|
428
|
-
allow: opts.statusCommitAllow,
|
|
429
|
-
autoAllow: false,
|
|
430
|
-
allowTasks: true,
|
|
431
|
-
requireClean: opts.statusCommitRequireClean,
|
|
432
|
-
quiet: opts.quiet,
|
|
433
|
-
progressMessage: "creating status commit",
|
|
434
|
-
resolveExecutorAgent: true,
|
|
435
|
-
});
|
|
436
|
-
}
|
|
437
|
-
await writeFinishedTasks({
|
|
438
|
-
ctx,
|
|
439
|
-
loadedTasks,
|
|
440
|
-
metaTaskId,
|
|
441
|
-
author: opts.author,
|
|
442
|
-
body: opts.body,
|
|
443
|
-
force: opts.force,
|
|
444
|
-
resultProvided,
|
|
445
|
-
resultSummary,
|
|
446
|
-
riskLevel,
|
|
447
|
-
breaking,
|
|
448
|
-
taskCommitInfo,
|
|
449
|
-
});
|
|
450
|
-
const incidentPlans = [];
|
|
451
|
-
const incidentRegistryPaths = [];
|
|
452
|
-
for (const taskId of opts.taskIds) {
|
|
453
|
-
const loadedTask = loadedTasks.find((candidate) => candidate.taskId === taskId) ?? null;
|
|
454
|
-
const collected = await collectTaskIncidents({
|
|
455
|
-
ctx,
|
|
456
|
-
taskId,
|
|
457
|
-
task: loadedTask?.task ?? null,
|
|
458
|
-
write: true,
|
|
459
|
-
});
|
|
460
|
-
incidentPlans.push(collected.plan);
|
|
461
|
-
incidentRegistryPaths.push(collected.registryPaths);
|
|
462
|
-
}
|
|
463
|
-
const promotedIncidents = incidentPlans.reduce((sum, plan) => sum + plan.promotable.length, 0);
|
|
464
|
-
// tasks.json is export-only; generated via `agentplane task export`.
|
|
465
|
-
if (shouldCloseCommit && primaryTaskId) {
|
|
466
|
-
if (!opts.quiet) {
|
|
467
|
-
process.stdout.write(`${infoMessage("task marked DONE; creating deterministic close commit")}\n`);
|
|
468
|
-
}
|
|
469
|
-
const closeUnstageOthers = opts.closeCommit === true && opts.closeUnstageOthers === true;
|
|
470
|
-
if (ctx.config.workflow_mode === "branch_pr") {
|
|
471
|
-
const closeBranch = await materializeBranchPrCloseTail({
|
|
472
|
-
ctx,
|
|
473
|
-
cwd: opts.cwd,
|
|
474
|
-
rootOverride: opts.rootOverride,
|
|
475
|
-
taskId: primaryTaskId,
|
|
476
|
-
baseBranchOverride: opts.baseBranchOverride,
|
|
477
|
-
quiet: opts.quiet,
|
|
478
|
-
closeUnstageOthers,
|
|
479
|
-
allowPolicy: promotedIncidents > 0,
|
|
480
|
-
});
|
|
481
|
-
if (!opts.quiet) {
|
|
482
|
-
process.stdout.write(`${infoMessage(`branch_pr close tail ready on ${closeBranch}; push that branch and open it with task hosted-close-pr if hosted automation does not create the closure PR for you.`)}\n`);
|
|
483
|
-
}
|
|
484
|
-
}
|
|
485
|
-
else {
|
|
486
|
-
await createTaskCloseCommit({
|
|
487
|
-
ctx,
|
|
488
|
-
cwd: opts.cwd,
|
|
489
|
-
rootOverride: opts.rootOverride,
|
|
490
|
-
taskId: primaryTaskId,
|
|
491
|
-
baseBranchOverride: opts.baseBranchOverride,
|
|
492
|
-
quiet: opts.quiet,
|
|
493
|
-
closeUnstageOthers,
|
|
494
|
-
allowPolicy: promotedIncidents > 0,
|
|
495
|
-
});
|
|
496
|
-
}
|
|
497
|
-
}
|
|
498
|
-
if (ctx.config.workflow_mode === "direct") {
|
|
499
|
-
await clearDirectWorkLockIfMatches({
|
|
500
|
-
agentplaneDir: ctx.resolvedProject.agentplaneDir,
|
|
501
|
-
taskIds: opts.taskIds,
|
|
502
|
-
});
|
|
503
|
-
}
|
|
504
|
-
if (!opts.quiet) {
|
|
505
|
-
const incidentPlan = incidentPlans[0] ?? {
|
|
506
|
-
candidates: [],
|
|
507
|
-
skipped: [],
|
|
508
|
-
promotable: [],
|
|
509
|
-
duplicates: [],
|
|
510
|
-
};
|
|
511
|
-
process.stdout.write(`${infoMessage(renderIncidentCollectionPlanOutcome(incidentPlan, {
|
|
512
|
-
wrote: promotedIncidents > 0,
|
|
513
|
-
context: "finish",
|
|
514
|
-
promotedIds: incidentPlan.promotable.map((item) => item.entry.id),
|
|
515
|
-
registryPaths: incidentRegistryPaths[0] ?? [],
|
|
516
|
-
taskId: opts.taskIds[0] ?? null,
|
|
517
|
-
}))}\n`);
|
|
518
|
-
process.stdout.write(`${successMessage("finished")}\n`);
|
|
519
|
-
}
|
|
520
|
-
return 0;
|
|
521
|
-
}
|
|
522
|
-
catch (err) {
|
|
523
|
-
if (err instanceof CliError)
|
|
524
|
-
throw err;
|
|
525
|
-
throw mapBackendError(err, { command: "finish", root: opts.rootOverride ?? null });
|
|
526
|
-
}
|
|
527
|
-
}
|
|
1
|
+
export { cmdFinish } from "./finish-command.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hosted-close-pr.command.d.ts","sourceRoot":"","sources":["../../../src/commands/task/hosted-close-pr.command.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAStE,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"hosted-close-pr.command.d.ts","sourceRoot":"","sources":["../../../src/commands/task/hosted-close-pr.command.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAStE,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,2BAA2B,CAAC;AASnC,KAAK,uBAAuB,GAAG;IAC7B,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CACrB,CAAC;AAgBF,eAAO,MAAM,qBAAqB,EAAE,WAAW,CAAC,uBAAuB,CAoEtE,CAAC;AA4cF,wBAAgB,+BAA+B,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,cAAc,CAAC,IAChF,KAAK,UAAU,EAAE,GAAG,uBAAuB,KAAG,OAAO,CAAC,MAAM,CAAC,CAsB5E"}
|
|
@@ -13,6 +13,7 @@ import { parsePrMeta } from "../shared/pr-meta.js";
|
|
|
13
13
|
import { resolveDefaultGithubRepo, runGhApiJson } from "../pr/internal/gh-api.js";
|
|
14
14
|
import { resolvePrPaths } from "../pr/internal/pr-paths.js";
|
|
15
15
|
import { resolveBaseBranch } from "@agentplaneorg/core";
|
|
16
|
+
import { taskCloseAlreadyRecordedOnBase } from "./close-tail-state.js";
|
|
16
17
|
export const taskHostedClosePrSpec = {
|
|
17
18
|
id: ["task", "hosted-close-pr"],
|
|
18
19
|
group: "Task",
|
|
@@ -143,7 +144,12 @@ async function resolveHostedCloseMergeRecordByCommit(opts) {
|
|
|
143
144
|
});
|
|
144
145
|
}
|
|
145
146
|
async function readHostedCloseState(opts) {
|
|
146
|
-
const task = await
|
|
147
|
+
const task = (await opts.ctx.taskBackend.getTask(opts.taskId)) ??
|
|
148
|
+
(await loadTaskFromContext({
|
|
149
|
+
ctx: opts.ctx,
|
|
150
|
+
taskId: opts.taskId,
|
|
151
|
+
preferBranchSnapshot: false,
|
|
152
|
+
}));
|
|
147
153
|
const taskBranch = await resolveTaskBranchFromContext({ ctx: opts.ctx, taskId: opts.taskId });
|
|
148
154
|
const { metaPath, config } = await resolvePrPaths({
|
|
149
155
|
ctx: opts.ctx,
|
|
@@ -311,8 +317,17 @@ async function openHostedClosePr(opts) {
|
|
|
311
317
|
});
|
|
312
318
|
let sourceBranch = meta?.branch?.trim() ?? taskBranch?.trim() ?? "";
|
|
313
319
|
let baseBranch = meta?.base?.trim() ?? defaultBaseBranch?.trim() ?? "";
|
|
314
|
-
|
|
315
|
-
|
|
320
|
+
const localMergeCommit = meta?.merge_commit?.trim() ?? task.commit?.hash?.trim() ?? "";
|
|
321
|
+
const canonicalCloseAlreadyPresent = meta?.status === "MERGED" &&
|
|
322
|
+
sourceBranch.length > 0 &&
|
|
323
|
+
localMergeCommit.length > 0 &&
|
|
324
|
+
String(task.status || "TODO").toUpperCase() === "DONE" &&
|
|
325
|
+
(task.commit?.hash?.trim() ?? "") === localMergeCommit;
|
|
326
|
+
if (canonicalCloseAlreadyPresent) {
|
|
327
|
+
output.info(`hosted-close-pr skipped: ${opts.taskId} is already closed on ${baseBranch || "the base branch"} for merge ${shortSha(localMergeCommit)}`);
|
|
328
|
+
return 0;
|
|
329
|
+
}
|
|
330
|
+
let mergedRecord = sourceBranch.length > 0 && (meta?.status !== "MERGED" || !localMergeCommit)
|
|
316
331
|
? await resolveHostedCloseMergeRecord({
|
|
317
332
|
gitRoot,
|
|
318
333
|
repo,
|
|
@@ -321,7 +336,6 @@ async function openHostedClosePr(opts) {
|
|
|
321
336
|
prNumber: typeof meta?.pr_number === "number" ? meta.pr_number : null,
|
|
322
337
|
})
|
|
323
338
|
: null;
|
|
324
|
-
const localMergeCommit = meta?.merge_commit?.trim() ?? task.commit?.hash?.trim() ?? "";
|
|
325
339
|
if (!mergedRecord && localMergeCommit) {
|
|
326
340
|
mergedRecord = await resolveHostedCloseMergeRecordByCommit({
|
|
327
341
|
gitRoot,
|
|
@@ -374,6 +388,17 @@ async function openHostedClosePr(opts) {
|
|
|
374
388
|
gitRoot,
|
|
375
389
|
branch: sourceBranch,
|
|
376
390
|
});
|
|
391
|
+
const alreadyClosedOnBase = await taskCloseAlreadyRecordedOnBase({
|
|
392
|
+
gitRoot,
|
|
393
|
+
workflowDir: opts.ctx.config.paths.workflow_dir,
|
|
394
|
+
taskId: opts.taskId,
|
|
395
|
+
baseBranch,
|
|
396
|
+
});
|
|
397
|
+
if (alreadyClosedOnBase) {
|
|
398
|
+
output.info(`hosted close already recorded on ${baseBranch}; no follow-up PR needed`);
|
|
399
|
+
output.success("task hosted-close-pr", opts.taskId, `hosted close already recorded on ${baseBranch}; skipped follow-up PR`);
|
|
400
|
+
return 0;
|
|
401
|
+
}
|
|
377
402
|
const owner = repo.split("/")[0]?.trim() ?? "";
|
|
378
403
|
const existingQuery = new URLSearchParams({
|
|
379
404
|
state: "open",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hosted-close.command.d.ts","sourceRoot":"","sources":["../../../src/commands/task/hosted-close.command.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAStE,OAAO,EAAuB,KAAK,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAOrF,MAAM,MAAM,qBAAqB,GAAG;IAClC,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,OAAO,CAAC;CAChB,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,WAAW,CAAC,qBAAqB,CAqClE,CAAC;
|
|
1
|
+
{"version":3,"file":"hosted-close.command.d.ts","sourceRoot":"","sources":["../../../src/commands/task/hosted-close.command.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAStE,OAAO,EAAuB,KAAK,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAOrF,MAAM,MAAM,qBAAqB,GAAG;IAClC,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,OAAO,CAAC;CAChB,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,WAAW,CAAC,qBAAqB,CAqClE,CAAC;AAyZF,wBAAgB,6BAA6B,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,cAAc,CAAC,IAC9E,KAAK,UAAU,EAAE,QAAQ,qBAAqB,KAAG,OAAO,CAAC,MAAM,CAAC,CA2B/E"}
|