agentplane 0.3.15 → 0.3.17
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 +641 -351
- 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 +5 -0
- package/dist/backends/task-backend/redmine/backend-runtime.d.ts.map +1 -0
- package/dist/backends/task-backend/redmine/backend-runtime.js +4 -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/mapping.js +1 -1
- package/dist/backends/task-backend/redmine/runtime-context.d.ts +98 -0
- package/dist/backends/task-backend/redmine/runtime-context.d.ts.map +1 -0
- package/dist/backends/task-backend/redmine/runtime-context.js +57 -0
- package/dist/backends/task-backend/redmine/runtime-methods.d.ts +33 -0
- package/dist/backends/task-backend/redmine/runtime-methods.d.ts.map +1 -0
- package/dist/backends/task-backend/redmine/runtime-methods.js +86 -0
- package/dist/backends/task-backend/redmine/runtime-operations.d.ts +19 -0
- package/dist/backends/task-backend/redmine/runtime-operations.d.ts.map +1 -0
- package/dist/backends/task-backend/redmine/runtime-operations.js +83 -0
- package/dist/backends/task-backend/redmine/runtime-state.d.ts +10 -0
- package/dist/backends/task-backend/redmine/runtime-state.d.ts.map +1 -0
- package/dist/backends/task-backend/redmine/runtime-state.js +45 -0
- 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/constants.d.ts +1 -1
- package/dist/backends/task-backend/shared/constants.d.ts.map +1 -1
- package/dist/backends/task-backend/shared/constants.js +1 -1
- 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/backends/task-index.d.ts +0 -4
- package/dist/backends/task-index.d.ts.map +1 -1
- package/dist/backends/task-index.js +0 -33
- 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 +25 -11
- package/dist/cli/http.d.ts.map +1 -1
- package/dist/cli/http.js +34 -15
- 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 +170 -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 +18 -1
- package/dist/cli/spec/errors.d.ts.map +1 -1
- package/dist/cli/spec/errors.js +27 -4
- package/dist/cli/spec/parse.d.ts.map +1 -1
- package/dist/cli/spec/parse.js +8 -1
- 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.d.ts.map +1 -1
- package/dist/commands/branch/work-start.direct.d.ts +13 -0
- package/dist/commands/branch/work-start.direct.d.ts.map +1 -0
- package/dist/commands/branch/work-start.direct.js +75 -0
- package/dist/commands/branch/work-start.git.d.ts +3 -0
- package/dist/commands/branch/work-start.git.d.ts.map +1 -0
- package/dist/commands/branch/work-start.git.js +19 -0
- package/dist/commands/branch/work-start.hook-shim.d.ts +2 -0
- package/dist/commands/branch/work-start.hook-shim.d.ts.map +1 -0
- package/dist/commands/branch/work-start.hook-shim.js +38 -0
- package/dist/commands/branch/work-start.js +6 -235
- package/dist/commands/branch/work-start.materialize.d.ts +16 -0
- package/dist/commands/branch/work-start.materialize.d.ts.map +1 -0
- package/dist/commands/branch/work-start.materialize.js +110 -0
- package/dist/commands/commit.spec.js +1 -1
- package/dist/commands/doctor/branch-pr.js +1 -1
- package/dist/commands/doctor/fixes.d.ts +0 -5
- package/dist/commands/doctor/fixes.d.ts.map +1 -1
- package/dist/commands/doctor/fixes.js +1 -71
- package/dist/commands/doctor/runtime.d.ts.map +1 -1
- package/dist/commands/doctor/runtime.js +2 -2
- package/dist/commands/doctor/workflow.d.ts.map +1 -1
- package/dist/commands/doctor/workflow.js +2 -23
- package/dist/commands/doctor/workspace.js +1 -1
- package/dist/commands/doctor.run.d.ts.map +1 -1
- package/dist/commands/doctor.run.js +1 -3
- 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 +4 -17
- package/dist/commands/hooks/index.d.ts.map +1 -1
- package/dist/commands/hooks/index.js +4 -415
- package/dist/commands/hooks/install.d.ts +11 -0
- package/dist/commands/hooks/install.d.ts.map +1 -0
- package/dist/commands/hooks/install.js +136 -0
- package/dist/commands/hooks/run.commit-msg.d.ts +3 -0
- package/dist/commands/hooks/run.commit-msg.d.ts.map +1 -0
- package/dist/commands/hooks/run.commit-msg.js +67 -0
- package/dist/commands/hooks/run.d.ts +9 -0
- package/dist/commands/hooks/run.d.ts.map +1 -0
- package/dist/commands/hooks/run.js +45 -0
- package/dist/commands/hooks/run.post-merge.d.ts +3 -0
- package/dist/commands/hooks/run.post-merge.d.ts.map +1 -0
- package/dist/commands/hooks/run.post-merge.js +44 -0
- package/dist/commands/hooks/run.pre-commit.d.ts +3 -0
- package/dist/commands/hooks/run.pre-commit.d.ts.map +1 -0
- package/dist/commands/hooks/run.pre-commit.js +48 -0
- package/dist/commands/hooks/run.pre-push.d.ts +6 -0
- package/dist/commands/hooks/run.pre-push.d.ts.map +1 -0
- package/dist/commands/hooks/run.pre-push.js +88 -0
- package/dist/commands/hooks/shared.d.ts +7 -0
- package/dist/commands/hooks/shared.d.ts.map +1 -0
- package/dist/commands/hooks/shared.js +41 -0
- 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/index.d.ts.map +1 -1
- package/dist/commands/recipes/impl/index.js +13 -3
- 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 +4 -0
- 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 +2 -7
- package/dist/commands/task/hosted-close-pr.command.d.ts.map +1 -1
- package/dist/commands/task/hosted-close-pr.command.js +9 -348
- package/dist/commands/task/hosted-close-pr.execute.d.ts +3 -0
- package/dist/commands/task/hosted-close-pr.execute.d.ts.map +1 -0
- package/dist/commands/task/hosted-close-pr.execute.js +135 -0
- package/dist/commands/task/hosted-close-pr.postcheck.d.ts +3 -0
- package/dist/commands/task/hosted-close-pr.postcheck.d.ts.map +1 -0
- package/dist/commands/task/hosted-close-pr.postcheck.js +13 -0
- package/dist/commands/task/hosted-close-pr.precheck.d.ts +4 -0
- package/dist/commands/task/hosted-close-pr.precheck.d.ts.map +1 -0
- package/dist/commands/task/hosted-close-pr.precheck.js +288 -0
- package/dist/commands/task/hosted-close-pr.report.d.ts +4 -0
- package/dist/commands/task/hosted-close-pr.report.d.ts.map +1 -0
- package/dist/commands/task/hosted-close-pr.report.js +42 -0
- package/dist/commands/task/hosted-close-pr.types.d.ts +75 -0
- package/dist/commands/task/hosted-close-pr.types.d.ts.map +1 -0
- 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/upgrade/materialize.d.ts.map +1 -1
- package/dist/commands/upgrade/materialize.js +0 -7
- package/dist/commands/upgrade/source.d.ts +0 -1
- package/dist/commands/upgrade/source.d.ts.map +1 -1
- package/dist/commands/upgrade/source.js +1 -9
- 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/context/base-prompts.d.ts.map +1 -1
- package/dist/runner/context/base-prompts.js +4 -0
- package/dist/runner/context/project-skill-prompt-blocks.d.ts +5 -0
- package/dist/runner/context/project-skill-prompt-blocks.d.ts.map +1 -0
- package/dist/runner/context/project-skill-prompt-blocks.js +57 -0
- 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 +351 -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/model.js +1 -0
- 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 +56 -3
- package/dist/shared/errors.d.ts.map +1 -1
- package/dist/shared/errors.js +72 -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/workflow-artifacts.d.ts.map +1 -1
- package/dist/shared/workflow-artifacts.js +1 -8
- 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/dist/workflow-runtime/file-ops.d.ts.map +1 -1
- package/dist/workflow-runtime/file-ops.js +1 -20
- package/dist/workflow-runtime/paths.d.ts.map +1 -1
- package/dist/workflow-runtime/paths.js +0 -1
- package/dist/workflow-runtime/types.d.ts +0 -1
- package/dist/workflow-runtime/types.d.ts.map +1 -1
- 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-close-pr.types.js} +0 -0
- /package/dist/{runtime/capabilities/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/execution-profile/types.js → policy/model.js} +0 -0
- /package/dist/runtime/{explain/types.js → approvals/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
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { resolveBaseBranch } from "@agentplaneorg/core";
|
|
2
|
+
import { readFile, rm } from "node:fs/promises";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { exitCodeForError } from "../../cli/exit-codes.js";
|
|
5
|
+
import { CliError } from "../../shared/errors.js";
|
|
6
|
+
import { execFileAsync, gitEnv } from "../shared/git.js";
|
|
7
|
+
import { gitBranchExists, gitCurrentBranch } from "../shared/git-ops.js";
|
|
8
|
+
import { taskCloseAlreadyRecordedOnBase } from "./close-tail-state.js";
|
|
9
|
+
import { createTaskCloseCommit } from "./finish-shared.js";
|
|
10
|
+
export async function clearDirectWorkLockIfMatches(opts) {
|
|
11
|
+
const lockPath = path.join(opts.agentplaneDir, "cache", "direct-work.json");
|
|
12
|
+
try {
|
|
13
|
+
const text = await readFile(lockPath, "utf8");
|
|
14
|
+
const parsed = JSON.parse(text);
|
|
15
|
+
const lockTaskId = parsed && typeof parsed.task_id === "string" ? parsed.task_id : null;
|
|
16
|
+
if (!lockTaskId)
|
|
17
|
+
return;
|
|
18
|
+
if (!opts.taskIds.includes(lockTaskId))
|
|
19
|
+
return;
|
|
20
|
+
await rm(lockPath, { force: true });
|
|
21
|
+
}
|
|
22
|
+
catch {
|
|
23
|
+
// best-effort
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
export async function ensureFinishRunsOnBaseBranch(opts) {
|
|
27
|
+
if (opts.ctx.config.workflow_mode !== "branch_pr")
|
|
28
|
+
return;
|
|
29
|
+
const baseBranch = await resolveBaseBranch({
|
|
30
|
+
cwd: opts.cwd,
|
|
31
|
+
rootOverride: opts.rootOverride ?? null,
|
|
32
|
+
cliBaseOpt: opts.baseBranchOverride ?? null,
|
|
33
|
+
mode: opts.ctx.config.workflow_mode,
|
|
34
|
+
});
|
|
35
|
+
if (!baseBranch) {
|
|
36
|
+
throw new CliError({
|
|
37
|
+
exitCode: exitCodeForError("E_USAGE"),
|
|
38
|
+
code: "E_USAGE",
|
|
39
|
+
message: "Base branch could not be resolved (use `agentplane branch base set` or --base).",
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
const currentBranch = await gitCurrentBranch(opts.ctx.resolvedProject.gitRoot);
|
|
43
|
+
if (currentBranch === baseBranch)
|
|
44
|
+
return;
|
|
45
|
+
throw new CliError({
|
|
46
|
+
exitCode: exitCodeForError("E_GIT"),
|
|
47
|
+
code: "E_GIT",
|
|
48
|
+
message: `finish must run on base branch ${baseBranch} in branch_pr mode ` +
|
|
49
|
+
`(current: ${currentBranch}); integrate first or reconcile from the base checkout.`,
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
async function readHeadCommitHash(gitRoot) {
|
|
53
|
+
const { stdout } = await execFileAsync("git", ["rev-parse", "HEAD"], {
|
|
54
|
+
cwd: gitRoot,
|
|
55
|
+
env: gitEnv(),
|
|
56
|
+
});
|
|
57
|
+
const hash = stdout.trim();
|
|
58
|
+
if (!hash) {
|
|
59
|
+
throw new CliError({
|
|
60
|
+
exitCode: exitCodeForError("E_GIT"),
|
|
61
|
+
code: "E_GIT",
|
|
62
|
+
message: "Failed to resolve HEAD while preparing a branch_pr close tail.",
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
return hash;
|
|
66
|
+
}
|
|
67
|
+
function branchPrCloseBranchName(taskId, headCommitHash) {
|
|
68
|
+
return `task-close/${taskId}/${headCommitHash.slice(0, 12)}`;
|
|
69
|
+
}
|
|
70
|
+
export async function materializeBranchPrCloseTail(opts) {
|
|
71
|
+
const gitRoot = opts.ctx.resolvedProject.gitRoot;
|
|
72
|
+
const baseBranch = await gitCurrentBranch(gitRoot);
|
|
73
|
+
const alreadyClosedOnBase = await taskCloseAlreadyRecordedOnBase({
|
|
74
|
+
gitRoot,
|
|
75
|
+
workflowDir: opts.ctx.config.paths.workflow_dir,
|
|
76
|
+
taskId: opts.taskId,
|
|
77
|
+
baseBranch,
|
|
78
|
+
});
|
|
79
|
+
if (alreadyClosedOnBase) {
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
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], { cwd: gitRoot, env: gitEnv() });
|
|
86
|
+
let checkoutError = null;
|
|
87
|
+
try {
|
|
88
|
+
await createTaskCloseCommit({
|
|
89
|
+
ctx: opts.ctx,
|
|
90
|
+
cwd: opts.cwd,
|
|
91
|
+
rootOverride: opts.rootOverride,
|
|
92
|
+
taskId: opts.taskId,
|
|
93
|
+
baseBranchOverride: opts.baseBranchOverride,
|
|
94
|
+
quiet: opts.quiet,
|
|
95
|
+
closeUnstageOthers: opts.closeUnstageOthers,
|
|
96
|
+
allowPolicy: opts.allowPolicy,
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
finally {
|
|
100
|
+
try {
|
|
101
|
+
await execFileAsync("git", ["checkout", baseBranch], {
|
|
102
|
+
cwd: gitRoot,
|
|
103
|
+
env: gitEnv(),
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
catch (error) {
|
|
107
|
+
checkoutError = error;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
if (checkoutError) {
|
|
111
|
+
throw new CliError({
|
|
112
|
+
exitCode: exitCodeForError("E_GIT"),
|
|
113
|
+
code: "E_GIT",
|
|
114
|
+
message: `Created ${closeBranch} but failed to return to ${baseBranch}; ` +
|
|
115
|
+
"inspect the local checkout before continuing.",
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
return closeBranch;
|
|
119
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"finish-command.d.ts","sourceRoot":"","sources":["../../../src/commands/task/finish-command.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEvD,wBAAsB,SAAS,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,CA8CvE"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { mapBackendError } from "../../cli/error-map.js";
|
|
2
|
+
import { CliError } from "../../shared/errors.js";
|
|
3
|
+
import { emitTraceEvent } from "../../shared/trace-events.js";
|
|
4
|
+
import { ensureActionApproved } from "../shared/approval-requirements.js";
|
|
5
|
+
import { ensureReconciledBeforeMutation } from "../shared/reconcile-check.js";
|
|
6
|
+
import { loadCommandContext } from "../shared/task-backend.js";
|
|
7
|
+
import { ensureFinishRunsOnBaseBranch } from "./finish-close.js";
|
|
8
|
+
import { executeFinishPlan } from "./finish-execute.js";
|
|
9
|
+
import { resolveFinishExecutionPlan } from "./finish-plan.js";
|
|
10
|
+
export async function cmdFinish(options) {
|
|
11
|
+
try {
|
|
12
|
+
const ctx = options.ctx ??
|
|
13
|
+
(await loadCommandContext({ cwd: options.cwd, rootOverride: options.rootOverride ?? null }));
|
|
14
|
+
emitTraceEvent({
|
|
15
|
+
component: "task-finish",
|
|
16
|
+
event: "finish_started",
|
|
17
|
+
details: { task_count: options.taskIds.length, backend: ctx.backendId },
|
|
18
|
+
});
|
|
19
|
+
await ensureReconciledBeforeMutation({ ctx, command: "finish" });
|
|
20
|
+
await ensureFinishRunsOnBaseBranch({
|
|
21
|
+
ctx,
|
|
22
|
+
cwd: options.cwd,
|
|
23
|
+
rootOverride: options.rootOverride,
|
|
24
|
+
baseBranchOverride: options.baseBranchOverride,
|
|
25
|
+
});
|
|
26
|
+
if (options.force) {
|
|
27
|
+
await ensureActionApproved({
|
|
28
|
+
action: "force_action",
|
|
29
|
+
config: ctx.config,
|
|
30
|
+
yes: options.yes === true,
|
|
31
|
+
reason: "finish --force",
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
const plan = resolveFinishExecutionPlan({ ctx, options });
|
|
35
|
+
const code = await executeFinishPlan({ ctx, options, plan });
|
|
36
|
+
emitTraceEvent({
|
|
37
|
+
component: "task-finish",
|
|
38
|
+
event: "finish_completed",
|
|
39
|
+
details: { task_count: options.taskIds.length, exit_code: code },
|
|
40
|
+
});
|
|
41
|
+
return code;
|
|
42
|
+
}
|
|
43
|
+
catch (err) {
|
|
44
|
+
emitTraceEvent({
|
|
45
|
+
component: "task-finish",
|
|
46
|
+
event: "finish_failed",
|
|
47
|
+
details: {
|
|
48
|
+
task_count: options.taskIds.length,
|
|
49
|
+
error: err instanceof Error ? err.name : "UnknownError",
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
if (err instanceof CliError)
|
|
53
|
+
throw err;
|
|
54
|
+
throw mapBackendError(err, { command: "finish", root: options.rootOverride ?? null });
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { CommandContext } from "../shared/task-backend.js";
|
|
2
|
+
import type { FinishExecutionPlan, FinishOptions } from "./finish-types.js";
|
|
3
|
+
export declare function executeFinishPlan(opts: {
|
|
4
|
+
ctx: CommandContext;
|
|
5
|
+
options: FinishOptions;
|
|
6
|
+
plan: FinishExecutionPlan;
|
|
7
|
+
}): Promise<number>;
|
|
8
|
+
//# sourceMappingURL=finish-execute.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"finish-execute.d.ts","sourceRoot":"","sources":["../../../src/commands/task/finish-execute.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAmBhE,OAAO,KAAK,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAE5E,wBAAsB,iBAAiB,CAAC,IAAI,EAAE;IAC5C,GAAG,EAAE,cAAc,CAAC;IACpB,OAAO,EAAE,aAAa,CAAC;IACvB,IAAI,EAAE,mBAAmB,CAAC;CAC3B,GAAG,OAAO,CAAC,MAAM,CAAC,CAuGlB"}
|
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
import { invalidValueMessage } from "../../cli/output.js";
|
|
2
|
+
import { CliError } from "../../shared/errors.js";
|
|
3
|
+
import { collectTaskIncidents, renderIncidentCollectionPlanOutcome } from "../incidents/shared.js";
|
|
4
|
+
import { createTaskCloseCommit, existingCommitInfo, loadTaskForFinish, writeFinishedTasks, } from "./finish-shared.js";
|
|
5
|
+
import { clearDirectWorkLockIfMatches, materializeBranchPrCloseTail } from "./finish-close.js";
|
|
6
|
+
import { appendFinishStructuredFinding } from "./finish-findings.js";
|
|
7
|
+
import { defaultCommitEmojiForStatus, enforceStatusCommitPolicy, prepareTaskTransitionComment, readCommitInfo, runTaskTransitionCommentCommit, } from "./shared.js";
|
|
8
|
+
export async function executeFinishPlan(opts) {
|
|
9
|
+
const { ctx, options, plan } = opts;
|
|
10
|
+
await appendStructuredFindingIfNeeded({ ctx, options, plan });
|
|
11
|
+
const loadedState = await loadFinishTasks({ ctx, options, plan });
|
|
12
|
+
await collectIncidentsForLoadedTasks({
|
|
13
|
+
ctx,
|
|
14
|
+
taskIds: options.taskIds,
|
|
15
|
+
loadedTasks: loadedState.loadedTasks,
|
|
16
|
+
write: false,
|
|
17
|
+
});
|
|
18
|
+
const tasksMissingCommit = loadedState.loadedTasks
|
|
19
|
+
.filter(({ task }) => !existingCommitInfo(task))
|
|
20
|
+
.map(({ taskId }) => taskId);
|
|
21
|
+
if (!options.commitFromComment && !options.commit && tasksMissingCommit.length > 0) {
|
|
22
|
+
throw new CliError({
|
|
23
|
+
exitCode: 2,
|
|
24
|
+
code: "E_USAGE",
|
|
25
|
+
message: "finish requires --commit <hash> or existing task commit metadata on every task; implicit HEAD fallback was removed.",
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
if (options.commitFromComment || plan.statusCommitRequested) {
|
|
29
|
+
enforceStatusCommitPolicy({
|
|
30
|
+
policy: ctx.config.status_commit_policy,
|
|
31
|
+
action: "finish",
|
|
32
|
+
confirmed: options.confirmStatusCommit,
|
|
33
|
+
quiet: options.quiet,
|
|
34
|
+
statusFrom: loadedState.primaryStatusFrom ?? "UNKNOWN",
|
|
35
|
+
statusTo: "DONE",
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
const taskCommitInfo = await resolveTaskCommitInfo({
|
|
39
|
+
ctx,
|
|
40
|
+
options,
|
|
41
|
+
plan,
|
|
42
|
+
primaryStatusFrom: loadedState.primaryStatusFrom,
|
|
43
|
+
primaryTag: loadedState.primaryTag,
|
|
44
|
+
});
|
|
45
|
+
await writeFinishedTasks({
|
|
46
|
+
ctx,
|
|
47
|
+
loadedTasks: loadedState.loadedTasks,
|
|
48
|
+
metaTaskId: plan.metaTaskId,
|
|
49
|
+
author: options.author,
|
|
50
|
+
body: options.body,
|
|
51
|
+
force: options.force,
|
|
52
|
+
resultProvided: plan.resultProvided,
|
|
53
|
+
resultSummary: plan.resultSummary,
|
|
54
|
+
riskLevel: plan.riskLevel,
|
|
55
|
+
breaking: plan.breaking,
|
|
56
|
+
taskCommitInfo,
|
|
57
|
+
});
|
|
58
|
+
const incidentOutcome = await collectIncidentsForLoadedTasks({
|
|
59
|
+
ctx,
|
|
60
|
+
taskIds: options.taskIds,
|
|
61
|
+
loadedTasks: loadedState.loadedTasks,
|
|
62
|
+
write: true,
|
|
63
|
+
});
|
|
64
|
+
const promotedIncidents = incidentOutcome.plans.reduce((sum, candidate) => sum + candidate.promotable.length, 0);
|
|
65
|
+
await finalizeCloseTail({
|
|
66
|
+
ctx,
|
|
67
|
+
options,
|
|
68
|
+
plan,
|
|
69
|
+
primaryTaskId: plan.primaryTaskId,
|
|
70
|
+
promotedIncidents,
|
|
71
|
+
});
|
|
72
|
+
if (ctx.config.workflow_mode === "direct") {
|
|
73
|
+
await clearDirectWorkLockIfMatches({
|
|
74
|
+
agentplaneDir: ctx.resolvedProject.agentplaneDir,
|
|
75
|
+
taskIds: options.taskIds,
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
if (!options.quiet) {
|
|
79
|
+
const incidentPlan = incidentOutcome.plans[0] ?? {
|
|
80
|
+
candidates: [],
|
|
81
|
+
skipped: [],
|
|
82
|
+
promotable: [],
|
|
83
|
+
duplicates: [],
|
|
84
|
+
};
|
|
85
|
+
process.stdout.write(`${renderIncidentCollectionPlanOutcome(incidentPlan, {
|
|
86
|
+
wrote: promotedIncidents > 0,
|
|
87
|
+
context: "finish",
|
|
88
|
+
promotedIds: incidentPlan.promotable.map((item) => item.entry.id),
|
|
89
|
+
registryPaths: incidentOutcome.registryPaths[0] ?? [],
|
|
90
|
+
taskId: options.taskIds[0] ?? null,
|
|
91
|
+
})}\n`);
|
|
92
|
+
process.stdout.write("finished\n");
|
|
93
|
+
}
|
|
94
|
+
return 0;
|
|
95
|
+
}
|
|
96
|
+
async function appendStructuredFindingIfNeeded(opts) {
|
|
97
|
+
const { ctx, options, plan } = opts;
|
|
98
|
+
if (!plan.finishFinding || !plan.primaryTaskId)
|
|
99
|
+
return;
|
|
100
|
+
await loadTaskForFinish({
|
|
101
|
+
ctx,
|
|
102
|
+
store: plan.store,
|
|
103
|
+
useStore: plan.useStore,
|
|
104
|
+
taskId: plan.primaryTaskId,
|
|
105
|
+
taskCount: options.taskIds.length,
|
|
106
|
+
metaTaskId: plan.metaTaskId,
|
|
107
|
+
resultProvided: plan.resultProvided,
|
|
108
|
+
resultSummary: plan.resultSummary,
|
|
109
|
+
force: options.force,
|
|
110
|
+
capturePrimaryLifecycleMeta: false,
|
|
111
|
+
});
|
|
112
|
+
await appendFinishStructuredFinding({
|
|
113
|
+
ctx,
|
|
114
|
+
taskId: plan.primaryTaskId,
|
|
115
|
+
author: options.author,
|
|
116
|
+
finding: plan.finishFinding,
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
async function loadFinishTasks(opts) {
|
|
120
|
+
const { ctx, options, plan } = opts;
|
|
121
|
+
let primaryStatusFrom = null;
|
|
122
|
+
let primaryTag = null;
|
|
123
|
+
const loadedTasks = [];
|
|
124
|
+
for (const taskId of options.taskIds) {
|
|
125
|
+
const loaded = await loadTaskForFinish({
|
|
126
|
+
ctx,
|
|
127
|
+
store: plan.store,
|
|
128
|
+
useStore: plan.useStore,
|
|
129
|
+
taskId,
|
|
130
|
+
taskCount: options.taskIds.length,
|
|
131
|
+
metaTaskId: plan.metaTaskId,
|
|
132
|
+
resultProvided: plan.resultProvided,
|
|
133
|
+
resultSummary: plan.resultSummary,
|
|
134
|
+
force: options.force,
|
|
135
|
+
capturePrimaryLifecycleMeta: taskId === plan.primaryTaskId,
|
|
136
|
+
});
|
|
137
|
+
loadedTasks.push(loaded.loaded);
|
|
138
|
+
if (taskId === plan.primaryTaskId) {
|
|
139
|
+
primaryStatusFrom = loaded.primaryStatusFrom;
|
|
140
|
+
primaryTag = loaded.primaryTag;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
return { loadedTasks, primaryStatusFrom, primaryTag };
|
|
144
|
+
}
|
|
145
|
+
async function collectIncidentsForLoadedTasks(opts) {
|
|
146
|
+
const plans = [];
|
|
147
|
+
const registryPaths = [];
|
|
148
|
+
for (const taskId of opts.taskIds) {
|
|
149
|
+
const loadedTask = opts.loadedTasks.find((candidate) => candidate.taskId === taskId) ?? null;
|
|
150
|
+
const collected = await collectTaskIncidents({
|
|
151
|
+
ctx: opts.ctx,
|
|
152
|
+
taskId,
|
|
153
|
+
task: loadedTask?.task ?? null,
|
|
154
|
+
write: opts.write,
|
|
155
|
+
});
|
|
156
|
+
plans.push(collected.plan);
|
|
157
|
+
registryPaths.push(collected.registryPaths);
|
|
158
|
+
}
|
|
159
|
+
return { plans, registryPaths };
|
|
160
|
+
}
|
|
161
|
+
async function resolveTaskCommitInfo(opts) {
|
|
162
|
+
const { ctx, options, plan, primaryStatusFrom, primaryTag } = opts;
|
|
163
|
+
let taskCommitInfo = options.commit
|
|
164
|
+
? await readCommitInfo(ctx.resolvedProject.gitRoot, options.commit)
|
|
165
|
+
: null;
|
|
166
|
+
const preparedComment = options.commitFromComment || plan.statusCommitRequested
|
|
167
|
+
? prepareTaskTransitionComment({
|
|
168
|
+
body: options.body,
|
|
169
|
+
enabled: true,
|
|
170
|
+
config: ctx.config,
|
|
171
|
+
})
|
|
172
|
+
: null;
|
|
173
|
+
if (options.commitFromComment) {
|
|
174
|
+
if (typeof options.commitEmoji === "string" && options.commitEmoji.trim() !== "✅") {
|
|
175
|
+
throw new CliError({
|
|
176
|
+
exitCode: 2,
|
|
177
|
+
code: "E_USAGE",
|
|
178
|
+
message: invalidValueMessage("--commit-emoji", options.commitEmoji, "✅ (finish commits must use a checkmark)"),
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
taskCommitInfo = await runTaskTransitionCommentCommit({
|
|
182
|
+
ctx,
|
|
183
|
+
cwd: options.cwd,
|
|
184
|
+
rootOverride: options.rootOverride,
|
|
185
|
+
taskId: plan.primaryTaskId,
|
|
186
|
+
primaryTag: primaryTag ?? "meta",
|
|
187
|
+
author: options.author,
|
|
188
|
+
statusFrom: primaryStatusFrom ?? undefined,
|
|
189
|
+
statusTo: "DONE",
|
|
190
|
+
commentBody: options.body,
|
|
191
|
+
formattedComment: preparedComment?.formattedComment ?? null,
|
|
192
|
+
emoji: options.commitEmoji ?? defaultCommitEmojiForStatus("DONE"),
|
|
193
|
+
allow: options.commitAllow,
|
|
194
|
+
autoAllow: false,
|
|
195
|
+
allowTasks: options.commitAllowTasks,
|
|
196
|
+
requireClean: options.commitRequireClean,
|
|
197
|
+
quiet: options.quiet,
|
|
198
|
+
progressMessage: "creating commit from verification comment",
|
|
199
|
+
resolveExecutorAgent: true,
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
if (plan.statusCommitRequested) {
|
|
203
|
+
if (typeof options.statusCommitEmoji === "string" &&
|
|
204
|
+
options.statusCommitEmoji.trim() !== "✅") {
|
|
205
|
+
throw new CliError({
|
|
206
|
+
exitCode: 2,
|
|
207
|
+
code: "E_USAGE",
|
|
208
|
+
message: invalidValueMessage("--status-commit-emoji", options.statusCommitEmoji, "✅ (finish commits must use a checkmark)"),
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
await runTaskTransitionCommentCommit({
|
|
212
|
+
ctx,
|
|
213
|
+
cwd: options.cwd,
|
|
214
|
+
rootOverride: options.rootOverride,
|
|
215
|
+
taskId: plan.primaryTaskId,
|
|
216
|
+
primaryTag: primaryTag ?? "meta",
|
|
217
|
+
author: options.author,
|
|
218
|
+
statusFrom: primaryStatusFrom ?? undefined,
|
|
219
|
+
statusTo: "DONE",
|
|
220
|
+
commentBody: options.body,
|
|
221
|
+
formattedComment: preparedComment?.formattedComment ?? null,
|
|
222
|
+
emoji: options.statusCommitEmoji ?? defaultCommitEmojiForStatus("DONE"),
|
|
223
|
+
allow: options.statusCommitAllow,
|
|
224
|
+
autoAllow: false,
|
|
225
|
+
allowTasks: true,
|
|
226
|
+
requireClean: options.statusCommitRequireClean,
|
|
227
|
+
quiet: options.quiet,
|
|
228
|
+
progressMessage: "creating status commit",
|
|
229
|
+
resolveExecutorAgent: true,
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
return taskCommitInfo;
|
|
233
|
+
}
|
|
234
|
+
async function finalizeCloseTail(opts) {
|
|
235
|
+
const { ctx, options, plan, primaryTaskId, promotedIncidents } = opts;
|
|
236
|
+
if (!plan.shouldCloseCommit || !primaryTaskId)
|
|
237
|
+
return;
|
|
238
|
+
if (!options.quiet) {
|
|
239
|
+
process.stdout.write("task marked DONE; creating deterministic close commit\n");
|
|
240
|
+
}
|
|
241
|
+
const closeUnstageOthers = options.closeCommit === true && options.closeUnstageOthers === true;
|
|
242
|
+
if (ctx.config.workflow_mode === "branch_pr") {
|
|
243
|
+
const closeBranch = await materializeBranchPrCloseTail({
|
|
244
|
+
ctx,
|
|
245
|
+
cwd: options.cwd,
|
|
246
|
+
rootOverride: options.rootOverride,
|
|
247
|
+
taskId: primaryTaskId,
|
|
248
|
+
baseBranchOverride: options.baseBranchOverride,
|
|
249
|
+
quiet: options.quiet,
|
|
250
|
+
closeUnstageOthers,
|
|
251
|
+
allowPolicy: promotedIncidents > 0,
|
|
252
|
+
});
|
|
253
|
+
if (options.quiet)
|
|
254
|
+
return;
|
|
255
|
+
if (closeBranch) {
|
|
256
|
+
process.stdout.write(`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`);
|
|
257
|
+
return;
|
|
258
|
+
}
|
|
259
|
+
process.stdout.write("branch_pr close tail already exists on base; skipping local task-close branch materialization.\n");
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
262
|
+
await createTaskCloseCommit({
|
|
263
|
+
ctx,
|
|
264
|
+
cwd: options.cwd,
|
|
265
|
+
rootOverride: options.rootOverride,
|
|
266
|
+
taskId: primaryTaskId,
|
|
267
|
+
baseBranchOverride: options.baseBranchOverride,
|
|
268
|
+
quiet: options.quiet,
|
|
269
|
+
closeUnstageOthers,
|
|
270
|
+
allowPolicy: promotedIncidents > 0,
|
|
271
|
+
});
|
|
272
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { CommandContext } from "../shared/task-backend.js";
|
|
2
|
+
export type FinishStructuredFindingInput = {
|
|
3
|
+
observation: string;
|
|
4
|
+
impact: string;
|
|
5
|
+
resolution: string;
|
|
6
|
+
localOnly: boolean;
|
|
7
|
+
repoFixable: boolean;
|
|
8
|
+
incidentScope?: string;
|
|
9
|
+
incidentTags: string[];
|
|
10
|
+
incidentMatch: string[];
|
|
11
|
+
incidentAdvice?: string;
|
|
12
|
+
incidentRule?: string;
|
|
13
|
+
};
|
|
14
|
+
export declare function appendFinishStructuredFinding(opts: {
|
|
15
|
+
ctx: CommandContext;
|
|
16
|
+
taskId: string;
|
|
17
|
+
author: string;
|
|
18
|
+
finding: FinishStructuredFindingInput;
|
|
19
|
+
}): Promise<void>;
|
|
20
|
+
//# sourceMappingURL=finish-findings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"finish-findings.d.ts","sourceRoot":"","sources":["../../../src/commands/task/finish-findings.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAIhE,MAAM,MAAM,4BAA4B,GAAG;IACzC,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,OAAO,CAAC;IACnB,WAAW,EAAE,OAAO,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,wBAAsB,6BAA6B,CAAC,IAAI,EAAE;IACxD,GAAG,EAAE,cAAc,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,4BAA4B,CAAC;CACvC,GAAG,OAAO,CAAC,IAAI,CAAC,CAwBhB"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { applyTaskMutation } from "../shared/task-mutation.js";
|
|
2
|
+
import { buildStructuredFindingMutationPlan } from "./findings.js";
|
|
3
|
+
export async function appendFinishStructuredFinding(opts) {
|
|
4
|
+
await applyTaskMutation({
|
|
5
|
+
ctx: opts.ctx,
|
|
6
|
+
taskId: opts.taskId,
|
|
7
|
+
build: (current) => {
|
|
8
|
+
const plan = buildStructuredFindingMutationPlan({
|
|
9
|
+
current,
|
|
10
|
+
config: opts.ctx.config,
|
|
11
|
+
observation: opts.finding.observation,
|
|
12
|
+
impact: opts.finding.impact,
|
|
13
|
+
resolution: opts.finding.resolution,
|
|
14
|
+
promote: !opts.finding.localOnly,
|
|
15
|
+
external: !opts.finding.localOnly,
|
|
16
|
+
fixability: opts.finding.repoFixable ? "repo-fixable" : null,
|
|
17
|
+
incidentScope: opts.finding.incidentScope,
|
|
18
|
+
incidentTags: opts.finding.incidentTags,
|
|
19
|
+
incidentMatch: opts.finding.incidentMatch,
|
|
20
|
+
incidentAdvice: opts.finding.incidentAdvice,
|
|
21
|
+
incidentRule: opts.finding.incidentRule,
|
|
22
|
+
updatedBy: opts.author,
|
|
23
|
+
});
|
|
24
|
+
return plan ? { intents: plan.intents } : null;
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type CommandContext } from "../shared/task-backend.js";
|
|
2
|
+
import type { FinishExecutionPlan, FinishOptions } from "./finish-types.js";
|
|
3
|
+
export declare function resolveFinishExecutionPlan(opts: {
|
|
4
|
+
ctx: CommandContext;
|
|
5
|
+
options: FinishOptions;
|
|
6
|
+
}): FinishExecutionPlan;
|
|
7
|
+
//# sourceMappingURL=finish-plan.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"finish-plan.d.ts","sourceRoot":"","sources":["../../../src/commands/task/finish-plan.ts"],"names":[],"mappings":"AAEA,OAAO,EAA6B,KAAK,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAI3F,OAAO,KAAK,EACV,mBAAmB,EACnB,aAAa,EAEd,MAAM,mBAAmB,CAAC;AAE3B,wBAAgB,0BAA0B,CAAC,IAAI,EAAE;IAC/C,GAAG,EAAE,cAAc,CAAC;IACpB,OAAO,EAAE,aAAa,CAAC;CACxB,GAAG,mBAAmB,CAqJtB"}
|