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,549 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import { mapCoreError } from "../../../cli/error-map.js";
|
|
6
|
-
import { infoMessage, successMessage } from "../../../cli/output.js";
|
|
7
|
-
import { stripAnsi } from "../../../cli/shared/ansi.js";
|
|
8
|
-
import { withDiagnosticContext } from "../../../shared/diagnostics.js";
|
|
9
|
-
import { CliError } from "../../../shared/errors.js";
|
|
10
|
-
import { refreshBranchPrArtifactsAfterTaskCommit } from "../../shared/post-commit-pr-artifacts.js";
|
|
11
|
-
import { isTaskLocalAdvancePath } from "../../shared/task-local-freshness.js";
|
|
12
|
-
import { loadCommandContext } from "../../shared/task-backend.js";
|
|
13
|
-
import { loadTaskFromContext } from "../../shared/task-backend.js";
|
|
14
|
-
import { execFileAsync, gitEnv } from "../../shared/git.js";
|
|
15
|
-
import { ensureReconciledBeforeMutation } from "../../shared/reconcile-check.js";
|
|
16
|
-
import { stageAllowlist, suggestAllowPrefixes } from "./allow.js";
|
|
17
|
-
import { buildCloseCommitMessage, taskReadmePathForTask } from "./close-message.js";
|
|
18
|
-
import { buildGitCommitEnv, resolveCanonicalGitIdentity } from "./env.js";
|
|
19
|
-
import { guardCommitCheck } from "./policy.js";
|
|
20
|
-
const COMMIT_FAILURE_SIGNAL_PATTERNS = [
|
|
21
|
-
/Code style issues found/i,
|
|
22
|
-
/Run Prettier with --write/i,
|
|
23
|
-
/\bESLint\b/i,
|
|
24
|
-
/\b[0-9]+\s+problems?\b/i,
|
|
25
|
-
/\berror\b/i,
|
|
26
|
-
/\bfailed\b/i,
|
|
27
|
-
/✖/,
|
|
28
|
-
];
|
|
29
|
-
const FORMATTER_SIGNAL_PATTERNS = [
|
|
30
|
-
/Code style issues found/i,
|
|
31
|
-
/Run Prettier with --write/i,
|
|
32
|
-
];
|
|
33
|
-
const ESLINT_SIGNAL_PATTERNS = [/\bESLint\b/i, /\b[0-9]+\s+problems?\b/i];
|
|
34
|
-
async function resetRebuildableTaskIndexCache(ctx) {
|
|
35
|
-
const gitRoot = path.resolve(ctx.resolvedProject.gitRoot);
|
|
36
|
-
const workflowDirAbs = path.resolve(gitRoot, ctx.config.paths.workflow_dir);
|
|
37
|
-
const cachePath = path.resolve(resolveTaskIndexPath(workflowDirAbs));
|
|
38
|
-
const relativeCachePath = path.relative(gitRoot, cachePath);
|
|
39
|
-
if (!relativeCachePath || relativeCachePath.startsWith(".."))
|
|
40
|
-
return;
|
|
41
|
-
try {
|
|
42
|
-
await execFileAsync("git", ["ls-files", "--error-unmatch", "--", relativeCachePath], {
|
|
43
|
-
cwd: gitRoot,
|
|
44
|
-
env: gitEnv(),
|
|
45
|
-
});
|
|
46
|
-
const gitPath = relativeCachePath.split(path.sep).join("/");
|
|
47
|
-
const cacheBlob = await execFileAsync("git", ["show", `HEAD:${gitPath}`], {
|
|
48
|
-
cwd: gitRoot,
|
|
49
|
-
env: gitEnv(),
|
|
50
|
-
});
|
|
51
|
-
await mkdir(path.dirname(cachePath), { recursive: true });
|
|
52
|
-
await writeFile(cachePath, cacheBlob.stdout, "utf8");
|
|
53
|
-
await execFileAsync("git", ["restore", "--staged", "--", relativeCachePath], {
|
|
54
|
-
cwd: gitRoot,
|
|
55
|
-
env: gitEnv(),
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
catch {
|
|
59
|
-
// The task index is a rebuildable cache. If it is absent from HEAD here, remove it so
|
|
60
|
-
// deterministic close commits only see canonical task artifacts.
|
|
61
|
-
await rm(cachePath, { force: true });
|
|
62
|
-
}
|
|
63
|
-
ctx.git.invalidateStatus();
|
|
64
|
-
}
|
|
65
|
-
function readText(value) {
|
|
66
|
-
if (typeof value === "string")
|
|
67
|
-
return value;
|
|
68
|
-
if (Buffer.isBuffer(value))
|
|
69
|
-
return value.toString("utf8");
|
|
70
|
-
return "";
|
|
71
|
-
}
|
|
72
|
-
function summarizeOutput(raw) {
|
|
73
|
-
const lines = raw
|
|
74
|
-
.replaceAll("\r\n", "\n")
|
|
75
|
-
.split("\n")
|
|
76
|
-
.map((line) => stripAnsi(line).trimEnd())
|
|
77
|
-
.filter((line) => line.trim().length > 0)
|
|
78
|
-
.map((line) => (line.length > 180 ? `${line.slice(0, 180)} [truncated]` : line));
|
|
79
|
-
if (lines.length <= 12)
|
|
80
|
-
return lines;
|
|
81
|
-
const selected = new Set();
|
|
82
|
-
for (let index = 0; index < Math.min(6, lines.length); index += 1) {
|
|
83
|
-
selected.add(index);
|
|
84
|
-
}
|
|
85
|
-
for (let index = Math.max(lines.length - 6, 0); index < lines.length; index += 1) {
|
|
86
|
-
selected.add(index);
|
|
87
|
-
}
|
|
88
|
-
for (const [index, line] of lines.entries()) {
|
|
89
|
-
if (selected.has(index))
|
|
90
|
-
continue;
|
|
91
|
-
if (COMMIT_FAILURE_SIGNAL_PATTERNS.some((pattern) => pattern.test(line))) {
|
|
92
|
-
selected.add(index);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
const ordered = [...selected].toSorted((a, b) => a - b);
|
|
96
|
-
const summary = [];
|
|
97
|
-
let previous = -1;
|
|
98
|
-
for (const index of ordered) {
|
|
99
|
-
if (previous >= 0 && index - previous > 1) {
|
|
100
|
-
summary.push(`[${index - previous - 1} lines omitted]`);
|
|
101
|
-
}
|
|
102
|
-
summary.push(lines[index] ?? "");
|
|
103
|
-
previous = index;
|
|
104
|
-
}
|
|
105
|
-
return summary;
|
|
106
|
-
}
|
|
107
|
-
function detectCommitFailureSignal(output) {
|
|
108
|
-
if (FORMATTER_SIGNAL_PATTERNS.some((pattern) => pattern.test(output))) {
|
|
109
|
-
return "formatter";
|
|
110
|
-
}
|
|
111
|
-
if (ESLINT_SIGNAL_PATTERNS.some((pattern) => pattern.test(output))) {
|
|
112
|
-
return "eslint";
|
|
113
|
-
}
|
|
114
|
-
return null;
|
|
115
|
-
}
|
|
116
|
-
function taskArtifactRefreshCommitMessage(taskId) {
|
|
117
|
-
return `📝 ${extractTaskSuffix(taskId)} task: refresh PR artifacts`;
|
|
118
|
-
}
|
|
119
|
-
async function commitRefreshedTaskArtifacts(opts) {
|
|
120
|
-
const changedPaths = await opts.ctx.git.statusChangedPaths();
|
|
121
|
-
const taskArtifactPaths = changedPaths.filter((relPath) => isTaskLocalAdvancePath({
|
|
122
|
-
workflowDir: opts.ctx.config.paths.workflow_dir,
|
|
123
|
-
taskId: opts.taskId,
|
|
124
|
-
tasksPath: opts.ctx.config.paths.tasks_path,
|
|
125
|
-
relPath,
|
|
126
|
-
}));
|
|
127
|
-
if (taskArtifactPaths.length === 0)
|
|
128
|
-
return false;
|
|
129
|
-
await stageAllowlist({
|
|
130
|
-
ctx: opts.ctx,
|
|
131
|
-
allow: [],
|
|
132
|
-
allowTasks: true,
|
|
133
|
-
allowPolicy: false,
|
|
134
|
-
allowConfig: false,
|
|
135
|
-
allowHooks: false,
|
|
136
|
-
allowCI: false,
|
|
137
|
-
tasksPath: opts.ctx.config.paths.tasks_path,
|
|
138
|
-
workflowDir: opts.ctx.config.paths.workflow_dir,
|
|
139
|
-
taskId: opts.taskId,
|
|
140
|
-
allowTaskOnly: true,
|
|
141
|
-
emptyAllowMessage: "PR artifact refresh produced no task-local files to stage for the follow-up commit.",
|
|
142
|
-
noMatchMessage: "PR artifact refresh produced changes outside the active task artifact scope; inspect the working tree before retrying the commit flow.",
|
|
143
|
-
});
|
|
144
|
-
const message = taskArtifactRefreshCommitMessage(opts.taskId);
|
|
145
|
-
await guardCommitCheck({
|
|
146
|
-
ctx: opts.ctx,
|
|
147
|
-
cwd: opts.cwd,
|
|
148
|
-
rootOverride: opts.rootOverride,
|
|
149
|
-
baseBranchOverride: null,
|
|
150
|
-
taskId: opts.taskId,
|
|
151
|
-
message,
|
|
152
|
-
allow: [],
|
|
153
|
-
allowBase: false,
|
|
154
|
-
allowTasks: true,
|
|
155
|
-
allowPolicy: false,
|
|
156
|
-
allowConfig: false,
|
|
157
|
-
allowHooks: false,
|
|
158
|
-
allowCI: false,
|
|
159
|
-
requireClean: true,
|
|
160
|
-
quiet: opts.quiet,
|
|
161
|
-
});
|
|
162
|
-
const env = buildGitCommitEnv({
|
|
163
|
-
taskId: opts.taskId,
|
|
164
|
-
allowTasks: true,
|
|
165
|
-
allowBase: false,
|
|
166
|
-
allowPolicy: false,
|
|
167
|
-
allowConfig: false,
|
|
168
|
-
allowHooks: false,
|
|
169
|
-
allowCI: false,
|
|
170
|
-
gitIdentity: await resolveCanonicalGitIdentity(),
|
|
171
|
-
});
|
|
172
|
-
await opts.ctx.git.commit({ message, env });
|
|
173
|
-
return true;
|
|
174
|
-
}
|
|
175
|
-
function commitFailureDiagnostic(phase, output) {
|
|
176
|
-
const signal = detectCommitFailureSignal(output);
|
|
177
|
-
if (signal === "formatter") {
|
|
178
|
-
return {
|
|
179
|
-
state: phase === "close_commit"
|
|
180
|
-
? "git rejected the generated close commit"
|
|
181
|
-
: "git rejected the requested task-scoped commit",
|
|
182
|
-
likelyCause: phase === "close_commit"
|
|
183
|
-
? "a formatting check in the pre-commit path rejected the deterministic close commit after the task README was staged"
|
|
184
|
-
: "a formatting check in the pre-commit path rejected the staged task-scoped commit",
|
|
185
|
-
nextAction: {
|
|
186
|
-
command: "bun run format",
|
|
187
|
-
reason: "apply formatter fixes before retrying the commit flow",
|
|
188
|
-
reasonCode: "git_pre_commit_format",
|
|
189
|
-
},
|
|
190
|
-
};
|
|
191
|
-
}
|
|
192
|
-
if (signal === "eslint") {
|
|
193
|
-
return {
|
|
194
|
-
state: phase === "close_commit"
|
|
195
|
-
? "git rejected the generated close commit"
|
|
196
|
-
: "git rejected the requested task-scoped commit",
|
|
197
|
-
likelyCause: phase === "close_commit"
|
|
198
|
-
? "a lint check in the pre-commit path rejected the deterministic close commit after the task README was staged"
|
|
199
|
-
: "a lint check in the pre-commit path rejected the staged task-scoped commit",
|
|
200
|
-
nextAction: {
|
|
201
|
-
command: "bun run lint:core",
|
|
202
|
-
reason: "rerun lint and fix the reported error before retrying the commit flow",
|
|
203
|
-
reasonCode: "git_pre_commit_lint",
|
|
204
|
-
},
|
|
205
|
-
};
|
|
206
|
-
}
|
|
207
|
-
if (phase === "close_commit") {
|
|
208
|
-
return {
|
|
209
|
-
state: "git rejected the generated close commit",
|
|
210
|
-
likelyCause: "a hook or commit policy blocked the deterministic task close commit after the task README was staged",
|
|
211
|
-
nextAction: {
|
|
212
|
-
command: "git status --short --untracked-files=no",
|
|
213
|
-
reason: "inspect the staged close-commit payload before fixing the hook or policy failure",
|
|
214
|
-
reasonCode: "git_close_commit_blocked",
|
|
215
|
-
},
|
|
216
|
-
};
|
|
217
|
-
}
|
|
218
|
-
return {
|
|
219
|
-
state: "git rejected the requested task-scoped commit",
|
|
220
|
-
likelyCause: "a hook or commit policy blocked the staged changes after guard validation passed",
|
|
221
|
-
nextAction: {
|
|
222
|
-
command: "git status --short --untracked-files=no",
|
|
223
|
-
reason: "inspect the staged task-scoped payload before fixing the hook or policy failure",
|
|
224
|
-
reasonCode: "git_task_commit_blocked",
|
|
225
|
-
},
|
|
226
|
-
};
|
|
227
|
-
}
|
|
228
|
-
function hasExplicitCommitScope(opts) {
|
|
229
|
-
return (opts.allow.some((prefix) => prefix.trim().length > 0) ||
|
|
230
|
-
opts.allowTasks ||
|
|
231
|
-
opts.allowPolicy ||
|
|
232
|
-
opts.allowConfig ||
|
|
233
|
-
opts.allowHooks ||
|
|
234
|
-
opts.allowCI);
|
|
235
|
-
}
|
|
236
|
-
function asCommitFailure(err, phase) {
|
|
237
|
-
if (err instanceof Error) {
|
|
238
|
-
const e = err;
|
|
239
|
-
const cmd = typeof e.cmd === "string" ? e.cmd : "";
|
|
240
|
-
if (cmd.startsWith("git commit")) {
|
|
241
|
-
const output = [readText(e.stderr), readText(e.stdout)]
|
|
242
|
-
.filter((part) => part.length > 0)
|
|
243
|
-
.join("\n");
|
|
244
|
-
const summary = summarizeOutput(output);
|
|
245
|
-
const code = typeof e.code === "number" ? e.code : null;
|
|
246
|
-
const lines = ["git commit failed (hook or commit policy).", `command: ${cmd}`];
|
|
247
|
-
if (typeof code === "number") {
|
|
248
|
-
lines.push(`exit_code: ${code}`);
|
|
249
|
-
}
|
|
250
|
-
if (summary.length > 0)
|
|
251
|
-
lines.push("output_summary:");
|
|
252
|
-
lines.push(...summary.map((line) => ` ${line}`));
|
|
253
|
-
return new CliError({
|
|
254
|
-
exitCode: 5,
|
|
255
|
-
code: "E_GIT",
|
|
256
|
-
message: lines.join("\n"),
|
|
257
|
-
context: withDiagnosticContext({ command: "commit" }, commitFailureDiagnostic(phase, output)),
|
|
258
|
-
});
|
|
259
|
-
}
|
|
260
|
-
return null;
|
|
261
|
-
}
|
|
262
|
-
return null;
|
|
263
|
-
}
|
|
264
|
-
export async function cmdGuardClean(opts) {
|
|
265
|
-
try {
|
|
266
|
-
const ctx = await loadCommandContext({
|
|
267
|
-
cwd: opts.cwd,
|
|
268
|
-
rootOverride: opts.rootOverride ?? null,
|
|
269
|
-
});
|
|
270
|
-
const staged = await ctx.git.statusStagedPaths();
|
|
271
|
-
if (staged.length > 0) {
|
|
272
|
-
throw new CliError({
|
|
273
|
-
exitCode: 5,
|
|
274
|
-
code: "E_GIT",
|
|
275
|
-
message: "Staged files exist",
|
|
276
|
-
});
|
|
277
|
-
}
|
|
278
|
-
if (!opts.quiet) {
|
|
279
|
-
process.stdout.write(`${successMessage("index clean", undefined, "no staged files")}\n`);
|
|
280
|
-
}
|
|
281
|
-
return 0;
|
|
282
|
-
}
|
|
283
|
-
catch (err) {
|
|
284
|
-
if (err instanceof CliError)
|
|
285
|
-
throw err;
|
|
286
|
-
throw mapCoreError(err, { command: "guard clean", root: opts.rootOverride ?? null });
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
export async function cmdGuardSuggestAllow(opts) {
|
|
290
|
-
try {
|
|
291
|
-
const ctx = await loadCommandContext({
|
|
292
|
-
cwd: opts.cwd,
|
|
293
|
-
rootOverride: opts.rootOverride ?? null,
|
|
294
|
-
});
|
|
295
|
-
const staged = await ctx.git.statusStagedPaths();
|
|
296
|
-
if (staged.length === 0) {
|
|
297
|
-
throw new CliError({
|
|
298
|
-
exitCode: 2,
|
|
299
|
-
code: "E_USAGE",
|
|
300
|
-
message: "No staged files (git index empty)",
|
|
301
|
-
});
|
|
302
|
-
}
|
|
303
|
-
const prefixes = suggestAllowPrefixes(staged);
|
|
304
|
-
if (opts.format === "args") {
|
|
305
|
-
const args = prefixes.map((p) => `--allow ${p}`).join(" ");
|
|
306
|
-
process.stdout.write(`${args}\n`);
|
|
307
|
-
}
|
|
308
|
-
else {
|
|
309
|
-
for (const prefix of prefixes)
|
|
310
|
-
process.stdout.write(`${prefix}\n`);
|
|
311
|
-
}
|
|
312
|
-
return 0;
|
|
313
|
-
}
|
|
314
|
-
catch (err) {
|
|
315
|
-
throw mapCoreError(err, { command: "guard suggest-allow", root: opts.rootOverride ?? null });
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
export async function cmdGuardCommit(opts) {
|
|
319
|
-
try {
|
|
320
|
-
const ctx = opts.ctx ??
|
|
321
|
-
(await loadCommandContext({ cwd: opts.cwd, rootOverride: opts.rootOverride ?? null }));
|
|
322
|
-
await ensureReconciledBeforeMutation({ ctx, command: "guard commit" });
|
|
323
|
-
await guardCommitCheck({ ...opts, ctx });
|
|
324
|
-
if (!opts.quiet)
|
|
325
|
-
process.stdout.write("OK\n");
|
|
326
|
-
return 0;
|
|
327
|
-
}
|
|
328
|
-
catch (err) {
|
|
329
|
-
if (err instanceof CliError)
|
|
330
|
-
throw err;
|
|
331
|
-
throw mapCoreError(err, { command: "guard commit", root: opts.rootOverride ?? null });
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
export async function cmdCommit(opts) {
|
|
335
|
-
try {
|
|
336
|
-
const ctx = opts.ctx ??
|
|
337
|
-
(await loadCommandContext({ cwd: opts.cwd, rootOverride: opts.rootOverride ?? null }));
|
|
338
|
-
if (opts.close) {
|
|
339
|
-
if (!opts.closeCheckOnly) {
|
|
340
|
-
await ensureReconciledBeforeMutation({ ctx, command: "commit" });
|
|
341
|
-
await resetRebuildableTaskIndexCache(ctx);
|
|
342
|
-
}
|
|
343
|
-
// Make the close commit deterministic: start from a clean index unless --unstage-others is used.
|
|
344
|
-
let staged = await ctx.git.statusStagedPaths();
|
|
345
|
-
if (staged.length > 0 && opts.closeUnstageOthers) {
|
|
346
|
-
if (!opts.closeCheckOnly) {
|
|
347
|
-
await execFileAsync("git", ["restore", "--staged", "--", "."], {
|
|
348
|
-
cwd: ctx.resolvedProject.gitRoot,
|
|
349
|
-
env: gitEnv(),
|
|
350
|
-
});
|
|
351
|
-
}
|
|
352
|
-
staged = opts.closeCheckOnly ? staged : await ctx.git.statusStagedPaths();
|
|
353
|
-
}
|
|
354
|
-
if (staged.length > 0 && !opts.closeUnstageOthers) {
|
|
355
|
-
throw new CliError({
|
|
356
|
-
exitCode: 5,
|
|
357
|
-
code: "E_GIT",
|
|
358
|
-
message: "Staged files exist (close commit requires an empty index; rerun with --unstage-others to auto-unstage).",
|
|
359
|
-
context: withDiagnosticContext({ command: "commit" }, {
|
|
360
|
-
state: "close commit cannot run with a non-empty git index",
|
|
361
|
-
likelyCause: "deterministic close commits only stage the active task artifact scope, but other staged files are already in the index",
|
|
362
|
-
nextAction: {
|
|
363
|
-
command: "git restore --staged -- .",
|
|
364
|
-
reason: "clear the current index before rerunning the close commit flow",
|
|
365
|
-
reasonCode: "git_close_commit_dirty_index",
|
|
366
|
-
},
|
|
367
|
-
}),
|
|
368
|
-
});
|
|
369
|
-
}
|
|
370
|
-
const task = await loadTaskFromContext({ ctx, taskId: opts.taskId });
|
|
371
|
-
const msg = await buildCloseCommitMessage({ gitRoot: ctx.resolvedProject.gitRoot, task });
|
|
372
|
-
const readmeAbs = taskReadmePathForTask({
|
|
373
|
-
gitRoot: ctx.resolvedProject.gitRoot,
|
|
374
|
-
workflowDir: ctx.config.paths.workflow_dir,
|
|
375
|
-
taskId: opts.taskId,
|
|
376
|
-
});
|
|
377
|
-
const readmeRel = readmeAbs.startsWith(ctx.resolvedProject.gitRoot)
|
|
378
|
-
? readmeAbs.slice(ctx.resolvedProject.gitRoot.length + 1)
|
|
379
|
-
: readmeAbs;
|
|
380
|
-
if (opts.closeCheckOnly) {
|
|
381
|
-
if (!opts.quiet) {
|
|
382
|
-
const stagedCount = staged.length;
|
|
383
|
-
const suffix = stagedCount > 0 && opts.closeUnstageOthers
|
|
384
|
-
? `; would unstage ${stagedCount} path(s)`
|
|
385
|
-
: "";
|
|
386
|
-
process.stdout.write(`${successMessage("close preflight", opts.taskId, `subject=${msg.subject}${suffix}`)}\n`);
|
|
387
|
-
}
|
|
388
|
-
return 0;
|
|
389
|
-
}
|
|
390
|
-
if (opts.closeStageTaskArtifacts === true) {
|
|
391
|
-
if (opts.closeRefreshTaskArtifacts !== false) {
|
|
392
|
-
await refreshBranchPrArtifactsAfterTaskCommit({
|
|
393
|
-
ctx,
|
|
394
|
-
cwd: opts.cwd,
|
|
395
|
-
rootOverride: opts.rootOverride,
|
|
396
|
-
taskId: opts.taskId,
|
|
397
|
-
quiet: opts.quiet,
|
|
398
|
-
});
|
|
399
|
-
}
|
|
400
|
-
// Artifact refresh writes tracked task files on disk; invalidate the memoized
|
|
401
|
-
// porcelain snapshot so staging/cleanliness checks see the current task artifact state.
|
|
402
|
-
ctx.git.invalidateStatus();
|
|
403
|
-
}
|
|
404
|
-
await (opts.closeStageTaskArtifacts === true
|
|
405
|
-
? stageAllowlist({
|
|
406
|
-
ctx,
|
|
407
|
-
allow: [],
|
|
408
|
-
allowTasks: true,
|
|
409
|
-
allowPolicy: opts.allowPolicy,
|
|
410
|
-
tasksPath: ctx.config.paths.tasks_path,
|
|
411
|
-
workflowDir: ctx.config.paths.workflow_dir,
|
|
412
|
-
taskId: opts.taskId,
|
|
413
|
-
allowTaskOnly: true,
|
|
414
|
-
emptyAllowMessage: "No changed task artifacts to stage for the deterministic close commit.",
|
|
415
|
-
noMatchMessage: "No changed files matched the active task artifact scope for the deterministic close commit.",
|
|
416
|
-
})
|
|
417
|
-
: ctx.git.stage([readmeRel]));
|
|
418
|
-
// Close commits should not require manual --allow flags:
|
|
419
|
-
// the command stages only the active task artifact scope.
|
|
420
|
-
await guardCommitCheck({
|
|
421
|
-
ctx,
|
|
422
|
-
cwd: opts.cwd,
|
|
423
|
-
rootOverride: opts.rootOverride,
|
|
424
|
-
baseBranchOverride: opts.baseBranchOverride ?? null,
|
|
425
|
-
taskId: opts.taskId,
|
|
426
|
-
message: msg.subject,
|
|
427
|
-
allow: [],
|
|
428
|
-
allowBase: opts.allowBase,
|
|
429
|
-
allowTasks: true,
|
|
430
|
-
allowPolicy: opts.allowPolicy,
|
|
431
|
-
allowConfig: false,
|
|
432
|
-
allowHooks: false,
|
|
433
|
-
allowCI: false,
|
|
434
|
-
requireClean: true,
|
|
435
|
-
quiet: opts.quiet,
|
|
436
|
-
});
|
|
437
|
-
const env = buildGitCommitEnv({
|
|
438
|
-
taskId: opts.taskId,
|
|
439
|
-
allowTasks: true,
|
|
440
|
-
allowBase: opts.allowBase,
|
|
441
|
-
allowPolicy: opts.allowPolicy,
|
|
442
|
-
allowConfig: false,
|
|
443
|
-
allowHooks: false,
|
|
444
|
-
allowCI: false,
|
|
445
|
-
allowStaleDist: true,
|
|
446
|
-
gitIdentity: await resolveCanonicalGitIdentity(),
|
|
447
|
-
});
|
|
448
|
-
await ctx.git.commit({ message: msg.subject, body: msg.body, env });
|
|
449
|
-
if (!opts.quiet) {
|
|
450
|
-
const { hash, subject } = await ctx.git.headHashSubject();
|
|
451
|
-
process.stdout.write(`${successMessage("committed", `${hash?.slice(0, 12) ?? ""} ${subject ?? ""}`.trim())}\n`);
|
|
452
|
-
}
|
|
453
|
-
return 0;
|
|
454
|
-
}
|
|
455
|
-
if (opts.autoAllow) {
|
|
456
|
-
throw new CliError({
|
|
457
|
-
exitCode: 2,
|
|
458
|
-
code: "E_USAGE",
|
|
459
|
-
message: "--auto-allow is disabled; pass explicit --allow <path-prefix>.",
|
|
460
|
-
});
|
|
461
|
-
}
|
|
462
|
-
await ensureReconciledBeforeMutation({ ctx, command: "commit" });
|
|
463
|
-
let autoStaged = [];
|
|
464
|
-
const staged = await ctx.git.statusStagedPaths();
|
|
465
|
-
if (staged.length === 0) {
|
|
466
|
-
if (!hasExplicitCommitScope(opts)) {
|
|
467
|
-
throw new CliError({
|
|
468
|
-
exitCode: 2,
|
|
469
|
-
code: "E_USAGE",
|
|
470
|
-
message: "No staged files and no commit allowlist. Pass --allow <path-prefix>, use --allow-tasks for active task artifacts, or stage files manually.",
|
|
471
|
-
});
|
|
472
|
-
}
|
|
473
|
-
autoStaged = await stageAllowlist({
|
|
474
|
-
ctx,
|
|
475
|
-
allow: opts.allow,
|
|
476
|
-
allowTasks: opts.allowTasks,
|
|
477
|
-
allowPolicy: opts.allowPolicy,
|
|
478
|
-
allowConfig: opts.allowConfig,
|
|
479
|
-
allowHooks: opts.allowHooks,
|
|
480
|
-
allowCI: opts.allowCI,
|
|
481
|
-
tasksPath: ctx.config.paths.tasks_path,
|
|
482
|
-
workflowDir: ctx.config.paths.workflow_dir,
|
|
483
|
-
taskId: opts.taskId,
|
|
484
|
-
allowTaskOnly: true,
|
|
485
|
-
emptyAllowMessage: "No staged files and no commit allowlist. Pass --allow <path-prefix>, use --allow-tasks for active task artifacts, or stage files manually.",
|
|
486
|
-
noMatchMessage: "No changed files matched the commit allowlist (adjust --allow, protected allow flags, or --allow-tasks; otherwise stage files manually).",
|
|
487
|
-
});
|
|
488
|
-
if (!opts.quiet) {
|
|
489
|
-
process.stdout.write(`${infoMessage(`commit auto-staged ${autoStaged.length} path(s) from allowlist`)}\n`);
|
|
490
|
-
}
|
|
491
|
-
}
|
|
492
|
-
await guardCommitCheck({
|
|
493
|
-
ctx,
|
|
494
|
-
cwd: opts.cwd,
|
|
495
|
-
rootOverride: opts.rootOverride,
|
|
496
|
-
baseBranchOverride: opts.baseBranchOverride ?? null,
|
|
497
|
-
taskId: opts.taskId,
|
|
498
|
-
message: opts.message,
|
|
499
|
-
allow: opts.allow,
|
|
500
|
-
allowBase: opts.allowBase,
|
|
501
|
-
allowTasks: opts.allowTasks,
|
|
502
|
-
allowPolicy: opts.allowPolicy,
|
|
503
|
-
allowConfig: opts.allowConfig,
|
|
504
|
-
allowHooks: opts.allowHooks,
|
|
505
|
-
allowCI: opts.allowCI,
|
|
506
|
-
requireClean: opts.requireClean,
|
|
507
|
-
quiet: opts.quiet,
|
|
508
|
-
});
|
|
509
|
-
const env = buildGitCommitEnv({
|
|
510
|
-
taskId: opts.taskId,
|
|
511
|
-
allowTasks: opts.allowTasks,
|
|
512
|
-
allowBase: opts.allowBase,
|
|
513
|
-
allowPolicy: opts.allowPolicy,
|
|
514
|
-
allowConfig: opts.allowConfig,
|
|
515
|
-
allowHooks: opts.allowHooks,
|
|
516
|
-
allowCI: opts.allowCI,
|
|
517
|
-
gitIdentity: await resolveCanonicalGitIdentity(),
|
|
518
|
-
});
|
|
519
|
-
await ctx.git.commit({ message: opts.message, env });
|
|
520
|
-
await refreshBranchPrArtifactsAfterTaskCommit({
|
|
521
|
-
ctx,
|
|
522
|
-
cwd: opts.cwd,
|
|
523
|
-
rootOverride: opts.rootOverride,
|
|
524
|
-
taskId: opts.taskId,
|
|
525
|
-
quiet: opts.quiet,
|
|
526
|
-
});
|
|
527
|
-
ctx.git.invalidateStatus();
|
|
528
|
-
await commitRefreshedTaskArtifacts({
|
|
529
|
-
ctx,
|
|
530
|
-
cwd: opts.cwd,
|
|
531
|
-
rootOverride: opts.rootOverride,
|
|
532
|
-
taskId: opts.taskId,
|
|
533
|
-
quiet: opts.quiet,
|
|
534
|
-
});
|
|
535
|
-
if (!opts.quiet) {
|
|
536
|
-
const { hash, subject } = await ctx.git.headHashSubject();
|
|
537
|
-
process.stdout.write(`${successMessage("committed", `${hash?.slice(0, 12) ?? ""} ${subject ?? ""}`.trim(), autoStaged.length > 0 ? `staged=${autoStaged.join(", ")}` : undefined)}\n`);
|
|
538
|
-
}
|
|
539
|
-
return 0;
|
|
540
|
-
}
|
|
541
|
-
catch (err) {
|
|
542
|
-
if (err instanceof CliError)
|
|
543
|
-
throw err;
|
|
544
|
-
const commitFailure = asCommitFailure(err, opts.close ? "close_commit" : "task_commit");
|
|
545
|
-
if (commitFailure)
|
|
546
|
-
throw commitFailure;
|
|
547
|
-
throw mapCoreError(err, { command: "commit", root: opts.rootOverride ?? null });
|
|
548
|
-
}
|
|
549
|
-
}
|
|
1
|
+
export { cmdCommit } from "./commit.js";
|
|
2
|
+
export { cmdGuardClean } from "./clean.js";
|
|
3
|
+
export { cmdGuardCommit } from "./guard-commit.js";
|
|
4
|
+
export { cmdGuardSuggestAllow } from "./suggest.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { extractTaskSuffix } from "@agentplaneorg/core";
|
|
2
2
|
import { invalidValueMessage, successMessage } from "../../../cli/output.js";
|
|
3
3
|
import { CliError } from "../../../shared/errors.js";
|
|
4
|
-
import { formatCommentBodyForCommit, normalizeCommentBodyForCommit, } from "
|
|
4
|
+
import { formatCommentBodyForCommit, normalizeCommentBodyForCommit, } from "../../shared/comment-format.js";
|
|
5
5
|
import { loadCommandContext } from "../../shared/task-backend.js";
|
|
6
6
|
import { buildGitCommitEnv, resolveCanonicalGitIdentity } from "./env.js";
|
|
7
7
|
import { stageAllowlist } from "./allow.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commit-diagnostics.d.ts","sourceRoot":"","sources":["../../../../src/commands/guard/impl/commit-diagnostics.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAWrD,MAAM,MAAM,kBAAkB,GAAG,aAAa,GAAG,cAAc,CAAC;AAwIhE,wBAAgB,eAAe,CAAC,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,kBAAkB,GAAG,QAAQ,GAAG,IAAI,CAgCxF"}
|