agentplane 0.3.9 → 0.3.11
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/AGENTS.md +4 -2
- package/assets/agents/CODER.json +1 -1
- package/assets/policy/dod.core.md +1 -1
- package/assets/policy/governance.md +5 -3
- package/assets/policy/incidents.md +19 -77
- package/assets/policy/workflow.branch_pr.md +2 -0
- package/assets/policy/workflow.direct.md +3 -1
- package/bin/agentplane.js +56 -1
- package/bin/runtime-watch.js +1 -0
- package/bin/stale-dist-policy.d.ts +1 -1
- package/bin/stale-dist-policy.js +13 -0
- package/dist/.build-manifest.json +462 -202
- package/dist/cli/bootstrap-guide.d.ts +1 -0
- package/dist/cli/bootstrap-guide.d.ts.map +1 -1
- package/dist/cli/bootstrap-guide.js +20 -1
- package/dist/cli/command-guide.d.ts.map +1 -1
- package/dist/cli/command-guide.js +2 -1
- package/dist/cli/command-invocations.d.ts.map +1 -1
- package/dist/cli/command-invocations.js +6 -1
- package/dist/cli/command-snippets.d.ts +2 -0
- package/dist/cli/command-snippets.d.ts.map +1 -1
- package/dist/cli/command-snippets.js +2 -0
- package/dist/cli/run-cli/command-catalog/core.d.ts +1 -1
- package/dist/cli/run-cli/command-catalog/core.d.ts.map +1 -1
- package/dist/cli/run-cli/command-catalog/core.js +10 -0
- package/dist/cli/run-cli/command-catalog/project.d.ts +1 -1
- package/dist/cli/run-cli/command-catalog/project.d.ts.map +1 -1
- package/dist/cli/run-cli/command-catalog/project.js +3 -1
- package/dist/cli/run-cli/command-catalog/task.d.ts +1 -1
- package/dist/cli/run-cli/command-catalog/task.d.ts.map +1 -1
- package/dist/cli/run-cli/command-catalog/task.js +10 -0
- package/dist/cli/run-cli/command-catalog.d.ts +1 -1
- package/dist/cli/run-cli/command-catalog.d.ts.map +1 -1
- package/dist/cli/run-cli/commands/config.d.ts.map +1 -1
- package/dist/cli/run-cli/commands/config.js +13 -0
- package/dist/cli/run-cli/commands/core/preflight.d.ts.map +1 -1
- package/dist/cli/run-cli/commands/core/preflight.js +44 -1
- package/dist/cli/run-cli.js +2 -2
- package/dist/cli/run-cli.test-helpers.d.ts.map +1 -1
- package/dist/cli/run-cli.test-helpers.js +12 -0
- package/dist/commands/backend.d.ts.map +1 -1
- package/dist/commands/backend.js +4 -0
- package/dist/commands/branch/cleanup-merged.d.ts +2 -0
- package/dist/commands/branch/cleanup-merged.d.ts.map +1 -1
- package/dist/commands/branch/cleanup-merged.js +132 -28
- package/dist/commands/branch/work-start.d.ts.map +1 -1
- package/dist/commands/branch/work-start.js +60 -1
- package/dist/commands/cleanup/merged.command.d.ts +2 -0
- package/dist/commands/cleanup/merged.command.d.ts.map +1 -1
- package/dist/commands/cleanup/merged.command.js +24 -0
- package/dist/commands/doctor/branch-pr.d.ts +4 -0
- package/dist/commands/doctor/branch-pr.d.ts.map +1 -0
- package/dist/commands/doctor/branch-pr.js +96 -0
- package/dist/commands/doctor/fixes.d.ts +5 -0
- package/dist/commands/doctor/fixes.d.ts.map +1 -1
- package/dist/commands/doctor/fixes.js +70 -0
- package/dist/commands/doctor.run.d.ts.map +1 -1
- package/dist/commands/doctor.run.js +6 -1
- package/dist/commands/finish.run.d.ts.map +1 -1
- package/dist/commands/finish.run.js +11 -0
- package/dist/commands/finish.spec.d.ts +11 -0
- package/dist/commands/finish.spec.d.ts.map +1 -1
- package/dist/commands/finish.spec.js +51 -0
- package/dist/commands/guard/impl/close-message.d.ts.map +1 -1
- package/dist/commands/guard/impl/close-message.js +23 -6
- package/dist/commands/guard/impl/commands.d.ts.map +1 -1
- package/dist/commands/guard/impl/commands.js +24 -2
- package/dist/commands/guard/impl/env.d.ts +1 -0
- package/dist/commands/guard/impl/env.d.ts.map +1 -1
- package/dist/commands/guard/impl/env.js +1 -0
- package/dist/commands/hooks/index.d.ts.map +1 -1
- package/dist/commands/hooks/index.js +98 -1
- package/dist/commands/incidents/advise.command.d.ts +15 -0
- package/dist/commands/incidents/advise.command.d.ts.map +1 -0
- package/dist/commands/incidents/advise.command.js +139 -0
- package/dist/commands/incidents/collect.command.d.ts +11 -0
- package/dist/commands/incidents/collect.command.d.ts.map +1 -0
- package/dist/commands/incidents/collect.command.js +72 -0
- package/dist/commands/incidents/incidents.command.d.ts +5 -0
- package/dist/commands/incidents/incidents.command.d.ts.map +1 -0
- package/dist/commands/incidents/incidents.command.js +21 -0
- package/dist/commands/incidents/shared.d.ts +76 -0
- package/dist/commands/incidents/shared.d.ts.map +1 -0
- package/dist/commands/incidents/shared.js +261 -0
- package/dist/commands/pr/check.d.ts.map +1 -1
- package/dist/commands/pr/check.js +249 -75
- package/dist/commands/pr/close-superseded.d.ts +9 -0
- package/dist/commands/pr/close-superseded.d.ts.map +1 -0
- package/dist/commands/pr/close-superseded.js +129 -0
- package/dist/commands/pr/close.d.ts +11 -0
- package/dist/commands/pr/close.d.ts.map +1 -0
- package/dist/commands/pr/close.js +116 -0
- package/dist/commands/pr/index.d.ts +2 -0
- package/dist/commands/pr/index.d.ts.map +1 -1
- package/dist/commands/pr/index.js +2 -0
- package/dist/commands/pr/integrate/artifacts.d.ts +7 -0
- package/dist/commands/pr/integrate/artifacts.d.ts.map +1 -1
- package/dist/commands/pr/integrate/artifacts.js +66 -1
- package/dist/commands/pr/integrate/cmd.d.ts.map +1 -1
- package/dist/commands/pr/integrate/cmd.js +20 -0
- package/dist/commands/pr/integrate/internal/bootstrap-guidance.d.ts +8 -0
- package/dist/commands/pr/integrate/internal/bootstrap-guidance.d.ts.map +1 -0
- package/dist/commands/pr/integrate/internal/bootstrap-guidance.js +59 -0
- package/dist/commands/pr/integrate/internal/finalize.d.ts.map +1 -1
- package/dist/commands/pr/integrate/internal/finalize.js +40 -12
- package/dist/commands/pr/integrate/internal/merge.d.ts +4 -0
- package/dist/commands/pr/integrate/internal/merge.d.ts.map +1 -1
- package/dist/commands/pr/integrate/internal/merge.js +59 -15
- package/dist/commands/pr/integrate/internal/post-integrate-bootstrap.d.ts +13 -0
- package/dist/commands/pr/integrate/internal/post-integrate-bootstrap.d.ts.map +1 -0
- package/dist/commands/pr/integrate/internal/post-integrate-bootstrap.js +25 -0
- package/dist/commands/pr/integrate/internal/prepare.d.ts +3 -2
- package/dist/commands/pr/integrate/internal/prepare.d.ts.map +1 -1
- package/dist/commands/pr/integrate/internal/prepare.js +107 -19
- package/dist/commands/pr/internal/freshness.d.ts +20 -0
- package/dist/commands/pr/internal/freshness.d.ts.map +1 -0
- package/dist/commands/pr/internal/freshness.js +50 -0
- package/dist/commands/pr/internal/gh-api.d.ts +6 -0
- package/dist/commands/pr/internal/gh-api.d.ts.map +1 -0
- package/dist/commands/pr/internal/gh-api.js +80 -0
- package/dist/commands/pr/internal/note-store.d.ts +18 -0
- package/dist/commands/pr/internal/note-store.d.ts.map +1 -0
- package/dist/commands/pr/internal/note-store.js +66 -0
- package/dist/commands/pr/internal/pr-paths.d.ts +13 -0
- package/dist/commands/pr/internal/pr-paths.d.ts.map +1 -1
- package/dist/commands/pr/internal/pr-paths.js +13 -0
- package/dist/commands/pr/internal/review-template.d.ts +24 -4
- package/dist/commands/pr/internal/review-template.d.ts.map +1 -1
- package/dist/commands/pr/internal/review-template.js +221 -33
- package/dist/commands/pr/internal/sync.d.ts +41 -0
- package/dist/commands/pr/internal/sync.d.ts.map +1 -0
- package/dist/commands/pr/internal/sync.js +598 -0
- package/dist/commands/pr/note.d.ts.map +1 -1
- package/dist/commands/pr/note.js +37 -4
- package/dist/commands/pr/open.d.ts +1 -0
- package/dist/commands/pr/open.d.ts.map +1 -1
- package/dist/commands/pr/open.js +18 -54
- package/dist/commands/pr/pr.command.d.ts +15 -0
- package/dist/commands/pr/pr.command.d.ts.map +1 -1
- package/dist/commands/pr/pr.command.js +124 -5
- package/dist/commands/pr/update.d.ts.map +1 -1
- package/dist/commands/pr/update.js +58 -74
- package/dist/commands/recipes/impl/commands/cache-prune.d.ts.map +1 -1
- package/dist/commands/recipes/impl/commands/cache-prune.js +14 -0
- package/dist/commands/recipes/impl/commands/install.js +1 -1
- package/dist/commands/recipes/impl/commands/list-remote.d.ts.map +1 -1
- package/dist/commands/recipes/impl/commands/list-remote.js +1 -0
- package/dist/commands/recipes/impl/commands/remove.d.ts.map +1 -1
- package/dist/commands/recipes/impl/commands/remove.js +9 -1
- package/dist/commands/release/apply.command.d.ts.map +1 -1
- package/dist/commands/release/apply.command.js +12 -17
- package/dist/commands/release/apply.preflight.d.ts.map +1 -1
- package/dist/commands/release/apply.preflight.js +1 -1
- package/dist/commands/shared/approval-requirements.d.ts +5 -7
- package/dist/commands/shared/approval-requirements.d.ts.map +1 -1
- package/dist/commands/shared/approval-requirements.js +3 -73
- package/dist/commands/shared/gh-transport.d.ts +16 -0
- package/dist/commands/shared/gh-transport.d.ts.map +1 -0
- package/dist/commands/shared/gh-transport.js +71 -0
- package/dist/commands/shared/git-diff.d.ts +3 -1
- package/dist/commands/shared/git-diff.d.ts.map +1 -1
- package/dist/commands/shared/git-diff.js +10 -2
- package/dist/commands/shared/git-ops.d.ts +1 -0
- package/dist/commands/shared/git-ops.d.ts.map +1 -1
- package/dist/commands/shared/git-ops.js +15 -0
- package/dist/commands/shared/git-worktree.d.ts +2 -0
- package/dist/commands/shared/git-worktree.d.ts.map +1 -1
- package/dist/commands/shared/git-worktree.js +22 -2
- package/dist/commands/shared/network-approval.d.ts +2 -0
- package/dist/commands/shared/network-approval.d.ts.map +1 -1
- package/dist/commands/shared/network-approval.js +1 -1
- package/dist/commands/shared/post-commit-pr-artifacts.d.ts +9 -0
- package/dist/commands/shared/post-commit-pr-artifacts.d.ts.map +1 -0
- package/dist/commands/shared/post-commit-pr-artifacts.js +22 -0
- package/dist/commands/shared/pr-meta.d.ts +29 -0
- package/dist/commands/shared/pr-meta.d.ts.map +1 -1
- package/dist/commands/shared/pr-meta.js +152 -3
- package/dist/commands/shared/task-backend.d.ts +9 -0
- package/dist/commands/shared/task-backend.d.ts.map +1 -1
- package/dist/commands/shared/task-backend.js +34 -22
- package/dist/commands/shared/task-local-freshness.d.ts +13 -0
- package/dist/commands/shared/task-local-freshness.d.ts.map +1 -0
- package/dist/commands/shared/task-local-freshness.js +20 -0
- package/dist/commands/shared/task-mutation.d.ts +2 -0
- package/dist/commands/shared/task-mutation.d.ts.map +1 -1
- package/dist/commands/shared/task-mutation.js +7 -0
- package/dist/commands/task/block.d.ts.map +1 -1
- package/dist/commands/task/block.js +1 -0
- package/dist/commands/task/close-duplicate.d.ts.map +1 -1
- package/dist/commands/task/close-duplicate.js +34 -1
- package/dist/commands/task/close-shared.d.ts.map +1 -1
- package/dist/commands/task/close-shared.js +1 -0
- package/dist/commands/task/derive.js +1 -1
- package/dist/commands/task/doc-template.d.ts.map +1 -1
- package/dist/commands/task/doc-template.js +7 -11
- package/dist/commands/task/findings-add.command.d.ts +20 -0
- package/dist/commands/task/findings-add.command.d.ts.map +1 -0
- package/dist/commands/task/findings-add.command.js +165 -0
- package/dist/commands/task/findings.command.d.ts +7 -0
- package/dist/commands/task/findings.command.d.ts.map +1 -0
- package/dist/commands/task/findings.command.js +20 -0
- package/dist/commands/task/findings.d.ts +63 -0
- package/dist/commands/task/findings.d.ts.map +1 -0
- package/dist/commands/task/findings.js +188 -0
- package/dist/commands/task/finish-shared.d.ts +1 -0
- package/dist/commands/task/finish-shared.d.ts.map +1 -1
- package/dist/commands/task/finish-shared.js +60 -3
- package/dist/commands/task/finish.d.ts +10 -0
- package/dist/commands/task/finish.d.ts.map +1 -1
- package/dist/commands/task/finish.js +143 -0
- package/dist/commands/task/hosted-close-pr.command.d.ts +11 -0
- package/dist/commands/task/hosted-close-pr.command.d.ts.map +1 -0
- package/dist/commands/task/hosted-close-pr.command.js +414 -0
- package/dist/commands/task/hosted-close.command.d.ts.map +1 -1
- package/dist/commands/task/hosted-close.command.js +49 -1
- package/dist/commands/task/hosted-merge-sync.d.ts +38 -0
- package/dist/commands/task/hosted-merge-sync.d.ts.map +1 -1
- package/dist/commands/task/hosted-merge-sync.js +249 -17
- package/dist/commands/task/index.d.ts +1 -0
- package/dist/commands/task/index.d.ts.map +1 -1
- package/dist/commands/task/index.js +1 -0
- package/dist/commands/task/new.d.ts +1 -0
- package/dist/commands/task/new.d.ts.map +1 -1
- package/dist/commands/task/new.js +140 -30
- package/dist/commands/task/new.spec.d.ts.map +1 -1
- package/dist/commands/task/new.spec.js +7 -0
- package/dist/commands/task/normalize.command.d.ts +2 -0
- package/dist/commands/task/normalize.command.d.ts.map +1 -1
- package/dist/commands/task/normalize.command.js +45 -0
- package/dist/commands/task/normalize.d.ts +2 -0
- package/dist/commands/task/normalize.d.ts.map +1 -1
- package/dist/commands/task/normalize.js +85 -8
- package/dist/commands/task/plan.d.ts.map +1 -1
- package/dist/commands/task/plan.js +7 -10
- package/dist/commands/task/set-status.d.ts.map +1 -1
- package/dist/commands/task/set-status.js +1 -0
- package/dist/commands/task/shared/docs.d.ts +6 -0
- package/dist/commands/task/shared/docs.d.ts.map +1 -1
- package/dist/commands/task/shared/docs.js +14 -0
- package/dist/commands/task/shared/transition-command.d.ts +2 -0
- package/dist/commands/task/shared/transition-command.d.ts.map +1 -1
- package/dist/commands/task/shared/transition-command.js +1 -0
- package/dist/commands/task/shared/transitions.d.ts.map +1 -1
- package/dist/commands/task/shared/transitions.js +11 -1
- package/dist/commands/task/shared.d.ts +1 -1
- package/dist/commands/task/shared.d.ts.map +1 -1
- package/dist/commands/task/shared.js +1 -1
- package/dist/commands/task/start-ready.d.ts.map +1 -1
- package/dist/commands/task/start-ready.js +98 -1
- package/dist/commands/task/start.d.ts.map +1 -1
- package/dist/commands/task/start.js +18 -10
- package/dist/commands/task/task.command.d.ts.map +1 -1
- package/dist/commands/task/task.command.js +4 -0
- package/dist/commands/task/verify-command-shared.d.ts +19 -0
- package/dist/commands/task/verify-command-shared.d.ts.map +1 -1
- package/dist/commands/task/verify-command-shared.js +152 -1
- package/dist/commands/task/verify-ok.command.d.ts.map +1 -1
- package/dist/commands/task/verify-ok.command.js +15 -2
- package/dist/commands/task/verify-record.d.ts +36 -0
- package/dist/commands/task/verify-record.d.ts.map +1 -1
- package/dist/commands/task/verify-record.js +193 -11
- package/dist/commands/task/verify-rework.command.d.ts.map +1 -1
- package/dist/commands/task/verify-rework.command.js +15 -2
- package/dist/commands/task/verify-show.command.d.ts +1 -1
- package/dist/commands/task/verify-show.command.d.ts.map +1 -1
- package/dist/commands/task/verify-show.command.js +28 -1
- package/dist/commands/upgrade.d.ts.map +1 -1
- package/dist/commands/upgrade.js +6 -1
- package/dist/commands/verify.run.d.ts.map +1 -1
- package/dist/commands/verify.run.js +12 -0
- package/dist/commands/verify.spec.d.ts +2 -6
- package/dist/commands/verify.spec.d.ts.map +1 -1
- package/dist/commands/verify.spec.js +30 -3
- package/dist/policy/engine.d.ts +3 -1
- package/dist/policy/engine.d.ts.map +1 -1
- package/dist/policy/engine.js +5 -6
- package/dist/policy/taxonomy.d.ts +17 -0
- package/dist/policy/taxonomy.d.ts.map +1 -0
- package/dist/policy/taxonomy.js +302 -0
- package/dist/policy/types.d.ts +2 -1
- package/dist/policy/types.d.ts.map +1 -1
- package/dist/runner/artifacts.d.ts.map +1 -1
- package/dist/runner/artifacts.js +2 -0
- package/dist/runner/context/base-prompts.d.ts +25 -0
- package/dist/runner/context/base-prompts.d.ts.map +1 -1
- package/dist/runner/context/base-prompts.js +182 -54
- package/dist/runner/context/recipe-context.d.ts.map +1 -1
- package/dist/runner/context/recipe-context.js +5 -0
- package/dist/runner/types.d.ts +12 -0
- package/dist/runner/types.d.ts.map +1 -1
- package/dist/runner/usecases/scenario-materialize-task.d.ts.map +1 -1
- package/dist/runner/usecases/scenario-materialize-task.js +81 -11
- package/dist/runner/usecases/task-run-inspect.d.ts.map +1 -1
- package/dist/runner/usecases/task-run-inspect.js +9 -7
- package/dist/runner/usecases/task-run-lifecycle-shared.d.ts.map +1 -1
- package/dist/runner/usecases/task-run-lifecycle-shared.js +8 -6
- package/dist/runner/usecases/task-run.d.ts.map +1 -1
- package/dist/runner/usecases/task-run.js +59 -12
- package/dist/runtime/approvals/index.d.ts +3 -0
- package/dist/runtime/approvals/index.d.ts.map +1 -0
- package/dist/runtime/approvals/index.js +1 -0
- package/dist/runtime/approvals/runtime.d.ts +12 -0
- package/dist/runtime/approvals/runtime.d.ts.map +1 -0
- package/dist/runtime/approvals/runtime.js +154 -0
- package/dist/runtime/approvals/types.d.ts +31 -0
- package/dist/runtime/approvals/types.d.ts.map +1 -0
- package/dist/runtime/approvals/types.js +1 -0
- package/dist/runtime/behavior/index.d.ts +3 -0
- package/dist/runtime/behavior/index.d.ts.map +1 -0
- package/dist/runtime/behavior/index.js +1 -0
- package/dist/runtime/behavior/resolve.d.ts +7 -0
- package/dist/runtime/behavior/resolve.d.ts.map +1 -0
- package/dist/runtime/behavior/resolve.js +66 -0
- package/dist/runtime/behavior/types.d.ts +25 -0
- package/dist/runtime/behavior/types.d.ts.map +1 -0
- package/dist/runtime/behavior/types.js +1 -0
- package/dist/runtime/capabilities/backend.d.ts +7 -0
- package/dist/runtime/capabilities/backend.d.ts.map +1 -0
- package/dist/runtime/capabilities/backend.js +104 -0
- package/dist/runtime/capabilities/index.d.ts +6 -0
- package/dist/runtime/capabilities/index.d.ts.map +1 -0
- package/dist/runtime/capabilities/index.js +4 -0
- package/dist/runtime/capabilities/recipe.d.ts +10 -0
- package/dist/runtime/capabilities/recipe.d.ts.map +1 -0
- package/dist/runtime/capabilities/recipe.js +123 -0
- package/dist/runtime/capabilities/registry.d.ts +6 -0
- package/dist/runtime/capabilities/registry.d.ts.map +1 -0
- package/dist/runtime/capabilities/registry.js +69 -0
- package/dist/runtime/capabilities/runner.d.ts +8 -0
- package/dist/runtime/capabilities/runner.d.ts.map +1 -0
- package/dist/runtime/capabilities/runner.js +73 -0
- package/dist/runtime/capabilities/types.d.ts +28 -0
- package/dist/runtime/capabilities/types.d.ts.map +1 -0
- package/dist/runtime/capabilities/types.js +1 -0
- package/dist/runtime/execution-profile/index.d.ts +3 -0
- package/dist/runtime/execution-profile/index.d.ts.map +1 -0
- package/dist/runtime/execution-profile/index.js +1 -0
- package/dist/runtime/execution-profile/resolve.d.ts +9 -0
- package/dist/runtime/execution-profile/resolve.d.ts.map +1 -0
- package/dist/runtime/execution-profile/resolve.js +80 -0
- package/dist/runtime/execution-profile/types.d.ts +27 -0
- package/dist/runtime/execution-profile/types.d.ts.map +1 -0
- package/dist/runtime/execution-profile/types.js +1 -0
- package/dist/runtime/explain/index.d.ts +3 -0
- package/dist/runtime/explain/index.d.ts.map +1 -0
- package/dist/runtime/explain/index.js +1 -0
- package/dist/runtime/explain/resolve.d.ts +14 -0
- package/dist/runtime/explain/resolve.d.ts.map +1 -0
- package/dist/runtime/explain/resolve.js +50 -0
- package/dist/runtime/explain/types.d.ts +28 -0
- package/dist/runtime/explain/types.d.ts.map +1 -0
- package/dist/runtime/explain/types.js +1 -0
- package/dist/runtime/harness/index.d.ts +4 -0
- package/dist/runtime/harness/index.d.ts.map +1 -0
- package/dist/runtime/harness/index.js +2 -0
- package/dist/runtime/harness/resolve-from-command-context.d.ts +4 -0
- package/dist/runtime/harness/resolve-from-command-context.d.ts.map +1 -0
- package/dist/runtime/harness/resolve-from-command-context.js +11 -0
- package/dist/runtime/harness/resolve.d.ts +13 -0
- package/dist/runtime/harness/resolve.d.ts.map +1 -0
- package/dist/runtime/harness/resolve.js +146 -0
- package/dist/runtime/harness/types.d.ts +65 -0
- package/dist/runtime/harness/types.d.ts.map +1 -0
- package/dist/runtime/harness/types.js +1 -0
- package/dist/runtime/incidents/index.d.ts +3 -0
- package/dist/runtime/incidents/index.d.ts.map +1 -0
- package/dist/runtime/incidents/index.js +1 -0
- package/dist/runtime/incidents/resolve.d.ts +26 -0
- package/dist/runtime/incidents/resolve.d.ts.map +1 -0
- package/dist/runtime/incidents/resolve.js +683 -0
- package/dist/runtime/incidents/types.d.ts +84 -0
- package/dist/runtime/incidents/types.d.ts.map +1 -0
- package/dist/runtime/incidents/types.js +1 -0
- package/dist/runtime/protocol/index.d.ts +3 -0
- package/dist/runtime/protocol/index.d.ts.map +1 -0
- package/dist/runtime/protocol/index.js +2 -0
- package/dist/runtime/protocol/resolve.d.ts +16 -0
- package/dist/runtime/protocol/resolve.d.ts.map +1 -0
- package/dist/runtime/protocol/resolve.js +36 -0
- package/dist/runtime/protocol/types.d.ts +36 -0
- package/dist/runtime/protocol/types.d.ts.map +1 -0
- package/dist/runtime/protocol/types.js +1 -0
- package/dist/runtime/task-intake/index.d.ts +3 -0
- package/dist/runtime/task-intake/index.d.ts.map +1 -0
- package/dist/runtime/task-intake/index.js +1 -0
- package/dist/runtime/task-intake/resolve.d.ts +48 -0
- package/dist/runtime/task-intake/resolve.d.ts.map +1 -0
- package/dist/runtime/task-intake/resolve.js +316 -0
- package/dist/runtime/task-intake/types.d.ts +117 -0
- package/dist/runtime/task-intake/types.d.ts.map +1 -0
- package/dist/runtime/task-intake/types.js +1 -0
- package/dist/shared/env.d.ts +1 -0
- package/dist/shared/env.d.ts.map +1 -1
- package/dist/shared/env.js +22 -1
- package/dist/shared/protected-paths.d.ts +4 -0
- package/dist/shared/protected-paths.d.ts.map +1 -1
- package/dist/shared/protected-paths.js +8 -4
- package/dist/usecases/context/resolve-context.d.ts +55 -6
- package/dist/usecases/context/resolve-context.d.ts.map +1 -1
- package/dist/usecases/context/resolve-context.js +96 -6
- package/dist/usecases/task/task-list-usecase.d.ts.map +1 -1
- package/dist/usecases/task/task-list-usecase.js +8 -2
- package/dist/usecases/task/task-new-usecase.js +4 -4
- package/package.json +2 -2
|
@@ -6,23 +6,20 @@ import { exitCodeForError } from "../../../../cli/exit-codes.js";
|
|
|
6
6
|
import { unknownEntityMessage, workflowModeMessage } from "../../../../cli/output.js";
|
|
7
7
|
import { CliError } from "../../../../shared/errors.js";
|
|
8
8
|
import { ensureGitClean } from "../../../guard/index.js";
|
|
9
|
-
import { gitDiffNames
|
|
9
|
+
import { gitDiffNames } from "../../../shared/git-diff.js";
|
|
10
10
|
import { gitBranchExists, gitCurrentBranch, gitRevParse } from "../../../shared/git-ops.js";
|
|
11
|
-
import {
|
|
11
|
+
import { findWorktreeForBranch } from "../../../shared/git-worktree.js";
|
|
12
|
+
import { loadCommandContext, loadTaskFromContext, resolveTaskBranchFromContext, } from "../../../shared/task-backend.js";
|
|
12
13
|
import { ensurePlanApprovedIfRequired, ensureVerificationSatisfiedIfRequired, } from "../../../task/shared.js";
|
|
13
|
-
import { resolvePrPaths } from "../../internal/pr-paths.js";
|
|
14
|
-
import {
|
|
14
|
+
import { readPrArtifact, resolvePrPaths } from "../../internal/pr-paths.js";
|
|
15
|
+
import { ensurePrArtifactsSynced } from "../../internal/sync.js";
|
|
16
|
+
import { readAndValidatePrArtifacts, ensureCommittedPrArtifactsOnBranch } from "../artifacts.js";
|
|
15
17
|
import { computeVerifyState } from "../verify.js";
|
|
16
|
-
import {
|
|
18
|
+
import { parsePrMetaForwardCompatible } from "../../../shared/pr-meta.js";
|
|
19
|
+
import { assessPrArtifactFreshness } from "../../internal/freshness.js";
|
|
17
20
|
export async function prepareIntegrate(opts) {
|
|
18
21
|
const ctx = opts.ctx ??
|
|
19
22
|
(await loadCommandContext({ cwd: opts.cwd, rootOverride: opts.rootOverride ?? null }));
|
|
20
|
-
const { task } = await loadBackendTask({
|
|
21
|
-
ctx,
|
|
22
|
-
cwd: opts.cwd,
|
|
23
|
-
rootOverride: opts.rootOverride,
|
|
24
|
-
taskId: opts.taskId,
|
|
25
|
-
});
|
|
26
23
|
const resolved = ctx.resolvedProject;
|
|
27
24
|
const loadedConfig = ctx.config;
|
|
28
25
|
if (loadedConfig.workflow_mode !== "branch_pr") {
|
|
@@ -32,8 +29,6 @@ export async function prepareIntegrate(opts) {
|
|
|
32
29
|
message: workflowModeMessage(loadedConfig.workflow_mode, "branch_pr"),
|
|
33
30
|
});
|
|
34
31
|
}
|
|
35
|
-
ensurePlanApprovedIfRequired(task, loadedConfig);
|
|
36
|
-
ensureVerificationSatisfiedIfRequired(task, loadedConfig);
|
|
37
32
|
await ensureGitClean({ cwd: opts.cwd, rootOverride: opts.rootOverride });
|
|
38
33
|
if (opts.base?.trim().length === 0) {
|
|
39
34
|
throw new CliError({
|
|
@@ -72,10 +67,16 @@ export async function prepareIntegrate(opts) {
|
|
|
72
67
|
let meta = null;
|
|
73
68
|
let branch = (opts.branch ?? "").trim();
|
|
74
69
|
if (await fileExists(metaPath)) {
|
|
75
|
-
meta =
|
|
70
|
+
meta = parsePrMetaForwardCompatible(await readFile(metaPath, "utf8"), opts.taskId);
|
|
76
71
|
if (!branch)
|
|
77
72
|
branch = (meta.branch ?? "").trim();
|
|
78
73
|
}
|
|
74
|
+
if (!branch) {
|
|
75
|
+
const inferredBranch = await resolveTaskBranchFromContext({ ctx, taskId: opts.taskId });
|
|
76
|
+
if (inferredBranch) {
|
|
77
|
+
branch = inferredBranch;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
79
80
|
if (!branch) {
|
|
80
81
|
throw new CliError({
|
|
81
82
|
exitCode: 2,
|
|
@@ -90,8 +91,27 @@ export async function prepareIntegrate(opts) {
|
|
|
90
91
|
message: unknownEntityMessage("branch", branch),
|
|
91
92
|
});
|
|
92
93
|
}
|
|
93
|
-
|
|
94
|
-
|
|
94
|
+
await ensureCommittedPrArtifactsOnBranch({
|
|
95
|
+
resolved,
|
|
96
|
+
prDir,
|
|
97
|
+
branch,
|
|
98
|
+
});
|
|
99
|
+
const worktreePath = await findWorktreeForBranch(resolved.gitRoot, branch);
|
|
100
|
+
const metaText = await readPrArtifact({
|
|
101
|
+
resolved,
|
|
102
|
+
prDir,
|
|
103
|
+
fileName: "meta.json",
|
|
104
|
+
branch,
|
|
105
|
+
worktreePath,
|
|
106
|
+
});
|
|
107
|
+
if (!metaText) {
|
|
108
|
+
throw new CliError({
|
|
109
|
+
exitCode: 4,
|
|
110
|
+
code: "E_IO",
|
|
111
|
+
message: `PR artifacts missing: ${path.relative(resolved.gitRoot, metaPath)} (run \`agentplane pr open\`)`,
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
let metaSource = parsePrMetaForwardCompatible(metaText, opts.taskId);
|
|
95
115
|
const baseCandidate = opts.base ?? metaSource.base ?? baseBranch;
|
|
96
116
|
const base = typeof baseCandidate === "string" && baseCandidate.trim().length > 0
|
|
97
117
|
? baseCandidate.trim()
|
|
@@ -102,10 +122,16 @@ export async function prepareIntegrate(opts) {
|
|
|
102
122
|
prDir,
|
|
103
123
|
metaPath,
|
|
104
124
|
branch,
|
|
105
|
-
taskId:
|
|
125
|
+
taskId: opts.taskId,
|
|
106
126
|
});
|
|
107
127
|
// readAndValidatePrArtifacts() throws if verify.log is missing; keep this non-null downstream.
|
|
108
|
-
|
|
128
|
+
let verifyLogText = verifyLogTextMaybe;
|
|
129
|
+
const task = await loadTaskFromContext({
|
|
130
|
+
ctx,
|
|
131
|
+
taskId: opts.taskId,
|
|
132
|
+
preferBranchSnapshot: true,
|
|
133
|
+
branchSnapshotBranch: branch,
|
|
134
|
+
});
|
|
109
135
|
const changedPaths = await gitDiffNames(resolved.gitRoot, base, branch);
|
|
110
136
|
const tasksPath = loadedConfig.paths.tasks_path;
|
|
111
137
|
if (changedPaths.includes(tasksPath)) {
|
|
@@ -116,9 +142,71 @@ export async function prepareIntegrate(opts) {
|
|
|
116
142
|
});
|
|
117
143
|
}
|
|
118
144
|
const branchHeadSha = await gitRevParse(resolved.gitRoot, [branch]);
|
|
145
|
+
let freshness = await assessPrArtifactFreshness({
|
|
146
|
+
gitRoot: resolved.gitRoot,
|
|
147
|
+
workflowDir: loadedConfig.paths.workflow_dir,
|
|
148
|
+
taskId: opts.taskId,
|
|
149
|
+
branchHeadSha,
|
|
150
|
+
metaHeadSha: metaSource.head_sha ?? null,
|
|
151
|
+
metaLastVerifiedSha: metaSource.last_verified_sha ?? null,
|
|
152
|
+
metaVerifyStatus: metaSource.verify?.status ?? null,
|
|
153
|
+
taskVerificationState: task.verification?.state ?? null,
|
|
154
|
+
verifyLogText,
|
|
155
|
+
requiresVerify: Boolean(task.verify && task.verify.length > 0),
|
|
156
|
+
});
|
|
157
|
+
if (!freshness.reviewFresh && worktreePath) {
|
|
158
|
+
await ensurePrArtifactsSynced({
|
|
159
|
+
cwd: worktreePath,
|
|
160
|
+
taskId: opts.taskId,
|
|
161
|
+
branch,
|
|
162
|
+
});
|
|
163
|
+
const repairedMetaText = await readPrArtifact({
|
|
164
|
+
resolved,
|
|
165
|
+
prDir,
|
|
166
|
+
fileName: "meta.json",
|
|
167
|
+
branch,
|
|
168
|
+
worktreePath,
|
|
169
|
+
});
|
|
170
|
+
if (repairedMetaText) {
|
|
171
|
+
const repairedMetaSource = parsePrMetaForwardCompatible(repairedMetaText, opts.taskId);
|
|
172
|
+
const repairedArtifacts = await readAndValidatePrArtifacts({
|
|
173
|
+
ctx,
|
|
174
|
+
resolved,
|
|
175
|
+
prDir,
|
|
176
|
+
metaPath,
|
|
177
|
+
branch,
|
|
178
|
+
taskId: opts.taskId,
|
|
179
|
+
});
|
|
180
|
+
verifyLogText = repairedArtifacts.verifyLogText ?? verifyLogText;
|
|
181
|
+
freshness = await assessPrArtifactFreshness({
|
|
182
|
+
gitRoot: resolved.gitRoot,
|
|
183
|
+
workflowDir: loadedConfig.paths.workflow_dir,
|
|
184
|
+
taskId: opts.taskId,
|
|
185
|
+
branchHeadSha,
|
|
186
|
+
metaHeadSha: repairedMetaSource.head_sha ?? null,
|
|
187
|
+
metaLastVerifiedSha: repairedMetaSource.last_verified_sha ?? null,
|
|
188
|
+
metaVerifyStatus: repairedMetaSource.verify?.status ?? null,
|
|
189
|
+
taskVerificationState: task.verification?.state ?? null,
|
|
190
|
+
verifyLogText,
|
|
191
|
+
requiresVerify: Boolean(task.verify && task.verify.length > 0),
|
|
192
|
+
});
|
|
193
|
+
meta = repairedMetaSource;
|
|
194
|
+
metaSource = repairedMetaSource;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
if (!freshness.reviewFresh) {
|
|
198
|
+
throw new CliError({
|
|
199
|
+
exitCode: exitCodeForError("E_VALIDATION"),
|
|
200
|
+
code: "E_VALIDATION",
|
|
201
|
+
message: `PR artifacts stale for ${opts.taskId}: meta.head_sha=${metaSource.head_sha ?? "<missing>"} ` +
|
|
202
|
+
`current_head=${branchHeadSha} (refresh the task branch artifacts before integrate)`,
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
ensurePlanApprovedIfRequired(task, loadedConfig);
|
|
206
|
+
ensureVerificationSatisfiedIfRequired(task, loadedConfig);
|
|
119
207
|
const initialVerifyState = computeVerifyState({
|
|
120
208
|
rawVerify: task.verify,
|
|
121
|
-
metaLastVerifiedSha:
|
|
209
|
+
metaLastVerifiedSha: freshness.effectiveVerifiedSha,
|
|
122
210
|
verifyLogText,
|
|
123
211
|
branchHeadSha,
|
|
124
212
|
runVerify: opts.runVerify,
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export type PrArtifactFreshness = {
|
|
2
|
+
reviewFresh: boolean;
|
|
3
|
+
verifyFresh: boolean;
|
|
4
|
+
verifySatisfied: boolean;
|
|
5
|
+
verifyLogSha: string | null;
|
|
6
|
+
effectiveVerifiedSha: string | null;
|
|
7
|
+
};
|
|
8
|
+
export declare function assessPrArtifactFreshness(opts: {
|
|
9
|
+
gitRoot: string;
|
|
10
|
+
workflowDir: string;
|
|
11
|
+
taskId: string;
|
|
12
|
+
branchHeadSha: string;
|
|
13
|
+
metaHeadSha: unknown;
|
|
14
|
+
metaLastVerifiedSha: unknown;
|
|
15
|
+
metaVerifyStatus: unknown;
|
|
16
|
+
taskVerificationState: unknown;
|
|
17
|
+
verifyLogText: string | null;
|
|
18
|
+
requiresVerify: boolean;
|
|
19
|
+
}): Promise<PrArtifactFreshness>;
|
|
20
|
+
//# sourceMappingURL=freshness.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"freshness.d.ts","sourceRoot":"","sources":["../../../../src/commands/pr/internal/freshness.ts"],"names":[],"mappings":"AASA,MAAM,MAAM,mBAAmB,GAAG;IAChC,WAAW,EAAE,OAAO,CAAC;IACrB,WAAW,EAAE,OAAO,CAAC;IACrB,eAAe,EAAE,OAAO,CAAC;IACzB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,oBAAoB,EAAE,MAAM,GAAG,IAAI,CAAC;CACrC,CAAC;AAEF,wBAAsB,yBAAyB,CAAC,IAAI,EAAE;IACpD,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,OAAO,CAAC;IACrB,mBAAmB,EAAE,OAAO,CAAC;IAC7B,gBAAgB,EAAE,OAAO,CAAC;IAC1B,qBAAqB,EAAE,OAAO,CAAC;IAC/B,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,cAAc,EAAE,OAAO,CAAC;CACzB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAgD/B"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { extractLastVerifiedSha } from "../../shared/pr-meta.js";
|
|
2
|
+
import { isTaskLocalOnlyAdvance } from "../../shared/task-local-freshness.js";
|
|
3
|
+
function normalizeSha(value) {
|
|
4
|
+
if (typeof value !== "string")
|
|
5
|
+
return null;
|
|
6
|
+
const trimmed = value.trim();
|
|
7
|
+
return trimmed.length > 0 ? trimmed : null;
|
|
8
|
+
}
|
|
9
|
+
export async function assessPrArtifactFreshness(opts) {
|
|
10
|
+
const metaHeadSha = normalizeSha(opts.metaHeadSha);
|
|
11
|
+
const metaLastVerifiedSha = normalizeSha(opts.metaLastVerifiedSha);
|
|
12
|
+
const verifyLogSha = normalizeSha(extractLastVerifiedSha(opts.verifyLogText ?? ""));
|
|
13
|
+
const metaVerifyPassed = opts.metaVerifyStatus === "pass";
|
|
14
|
+
const reviewFresh = metaHeadSha === opts.branchHeadSha ||
|
|
15
|
+
(await isTaskLocalOnlyAdvance({
|
|
16
|
+
gitRoot: opts.gitRoot,
|
|
17
|
+
workflowDir: opts.workflowDir,
|
|
18
|
+
taskId: opts.taskId,
|
|
19
|
+
fromRef: metaHeadSha,
|
|
20
|
+
toRef: opts.branchHeadSha,
|
|
21
|
+
}));
|
|
22
|
+
if (!opts.requiresVerify) {
|
|
23
|
+
return {
|
|
24
|
+
reviewFresh,
|
|
25
|
+
verifyFresh: true,
|
|
26
|
+
verifySatisfied: true,
|
|
27
|
+
verifyLogSha,
|
|
28
|
+
effectiveVerifiedSha: null,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
const verifiedFromMeta = metaVerifyPassed &&
|
|
32
|
+
(metaLastVerifiedSha === opts.branchHeadSha ||
|
|
33
|
+
(await isTaskLocalOnlyAdvance({
|
|
34
|
+
gitRoot: opts.gitRoot,
|
|
35
|
+
workflowDir: opts.workflowDir,
|
|
36
|
+
taskId: opts.taskId,
|
|
37
|
+
fromRef: metaLastVerifiedSha,
|
|
38
|
+
toRef: opts.branchHeadSha,
|
|
39
|
+
})));
|
|
40
|
+
const verifiedFromLog = verifyLogSha === opts.branchHeadSha;
|
|
41
|
+
const verifiedFromTaskState = opts.taskVerificationState === "ok" && reviewFresh && metaLastVerifiedSha === null;
|
|
42
|
+
const verifySatisfied = verifiedFromMeta || verifiedFromLog || verifiedFromTaskState;
|
|
43
|
+
return {
|
|
44
|
+
reviewFresh,
|
|
45
|
+
verifyFresh: verifySatisfied,
|
|
46
|
+
verifySatisfied,
|
|
47
|
+
verifyLogSha,
|
|
48
|
+
effectiveVerifiedSha: verifySatisfied ? opts.branchHeadSha : metaLastVerifiedSha,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare function ghEnv(): NodeJS.ProcessEnv;
|
|
2
|
+
export declare function resolveDefaultGithubRepo(cwd: string): Promise<string>;
|
|
3
|
+
export declare function runGhApiJson<T>(cwd: string, args: string[]): Promise<T>;
|
|
4
|
+
export declare function runGhApiNoOutput(cwd: string, args: string[]): Promise<void>;
|
|
5
|
+
export declare function isGhNotFound(err: unknown): boolean;
|
|
6
|
+
//# sourceMappingURL=gh-api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gh-api.d.ts","sourceRoot":"","sources":["../../../../src/commands/pr/internal/gh-api.ts"],"names":[],"mappings":"AAqBA,wBAAgB,KAAK,IAAI,MAAM,CAAC,UAAU,CAiBzC;AAED,wBAAsB,wBAAwB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAe3E;AAED,wBAAsB,YAAY,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,CAAC,CAAC,CAa7E;AAED,wBAAsB,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAYjF;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAElD"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { execFile } from "node:child_process";
|
|
2
|
+
import { promisify } from "node:util";
|
|
3
|
+
import { exitCodeForError } from "../../../cli/exit-codes.js";
|
|
4
|
+
import { CliError } from "../../../shared/errors.js";
|
|
5
|
+
import { isDotEnvLoadedKey } from "../../../shared/env.js";
|
|
6
|
+
import { gitEnv } from "../../shared/git.js";
|
|
7
|
+
import { normalizeGhTransportError, withGhTransportRetry } from "../../shared/gh-transport.js";
|
|
8
|
+
const execFileAsyncRaw = promisify(execFile);
|
|
9
|
+
function parseGithubRepoFromRemoteUrl(remoteUrl) {
|
|
10
|
+
const trimmed = remoteUrl.trim();
|
|
11
|
+
if (!trimmed)
|
|
12
|
+
return null;
|
|
13
|
+
const httpsMatch = /^https?:\/\/github\.com\/([^/]+)\/([^/]+?)(?:\.git)?\/?$/.exec(trimmed);
|
|
14
|
+
if (httpsMatch)
|
|
15
|
+
return `${httpsMatch[1]}/${httpsMatch[2]}`;
|
|
16
|
+
const sshMatch = /^git@github\.com:([^/]+)\/([^/]+?)(?:\.git)?$/.exec(trimmed);
|
|
17
|
+
if (sshMatch)
|
|
18
|
+
return `${sshMatch[1]}/${sshMatch[2]}`;
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
export function ghEnv() {
|
|
22
|
+
const env = gitEnv();
|
|
23
|
+
// Preserve explicit shell/CI auth, but do not let repo-local `.env` tokens override
|
|
24
|
+
// a valid gh keyring session for nested CLI invocations.
|
|
25
|
+
if (isDotEnvLoadedKey("GH_TOKEN"))
|
|
26
|
+
delete env.GH_TOKEN;
|
|
27
|
+
if (isDotEnvLoadedKey("GITHUB_TOKEN"))
|
|
28
|
+
delete env.GITHUB_TOKEN;
|
|
29
|
+
if (typeof process.env.GH_TOKEN === "string" && !isDotEnvLoadedKey("GH_TOKEN")) {
|
|
30
|
+
env.GH_TOKEN = process.env.GH_TOKEN;
|
|
31
|
+
}
|
|
32
|
+
if (typeof process.env.GITHUB_TOKEN === "string" && !isDotEnvLoadedKey("GITHUB_TOKEN")) {
|
|
33
|
+
env.GITHUB_TOKEN = process.env.GITHUB_TOKEN;
|
|
34
|
+
}
|
|
35
|
+
if (typeof process.env.GH_CONFIG_DIR === "string")
|
|
36
|
+
env.GH_CONFIG_DIR = process.env.GH_CONFIG_DIR;
|
|
37
|
+
if (typeof process.env.XDG_CONFIG_HOME === "string")
|
|
38
|
+
env.XDG_CONFIG_HOME = process.env.XDG_CONFIG_HOME;
|
|
39
|
+
if (typeof process.env.HOME === "string")
|
|
40
|
+
env.HOME = process.env.HOME;
|
|
41
|
+
return env;
|
|
42
|
+
}
|
|
43
|
+
export async function resolveDefaultGithubRepo(cwd) {
|
|
44
|
+
const { stdout } = await execFileAsyncRaw("git", ["remote", "get-url", "origin"], {
|
|
45
|
+
cwd,
|
|
46
|
+
env: gitEnv(),
|
|
47
|
+
maxBuffer: 10 * 1024 * 1024,
|
|
48
|
+
});
|
|
49
|
+
const repo = parseGithubRepoFromRemoteUrl(stdout);
|
|
50
|
+
if (!repo) {
|
|
51
|
+
throw new CliError({
|
|
52
|
+
exitCode: exitCodeForError("E_VALIDATION"),
|
|
53
|
+
code: "E_VALIDATION",
|
|
54
|
+
message: "Could not derive GitHub owner/repo from git remote origin.",
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
return repo;
|
|
58
|
+
}
|
|
59
|
+
export async function runGhApiJson(cwd, args) {
|
|
60
|
+
const { stdout } = await withGhTransportRetry(() => execFileAsyncRaw("gh", ["api", ...args], {
|
|
61
|
+
cwd,
|
|
62
|
+
env: ghEnv(),
|
|
63
|
+
maxBuffer: 10 * 1024 * 1024,
|
|
64
|
+
}), {
|
|
65
|
+
label: `running gh api ${args[0] ?? ""}`,
|
|
66
|
+
});
|
|
67
|
+
return JSON.parse(stdout);
|
|
68
|
+
}
|
|
69
|
+
export async function runGhApiNoOutput(cwd, args) {
|
|
70
|
+
await withGhTransportRetry(() => execFileAsyncRaw("gh", ["api", ...args], {
|
|
71
|
+
cwd,
|
|
72
|
+
env: ghEnv(),
|
|
73
|
+
maxBuffer: 10 * 1024 * 1024,
|
|
74
|
+
}), {
|
|
75
|
+
label: `running gh api ${args[0] ?? ""}`,
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
export function isGhNotFound(err) {
|
|
79
|
+
return /\b404\b/.test(normalizeGhTransportError(err));
|
|
80
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export type PrHandoffNote = {
|
|
2
|
+
schema_version: 1;
|
|
3
|
+
created_at: string;
|
|
4
|
+
author: string;
|
|
5
|
+
body: string;
|
|
6
|
+
};
|
|
7
|
+
export declare function buildPrHandoffNote(opts: {
|
|
8
|
+
createdAt: string;
|
|
9
|
+
author: string;
|
|
10
|
+
body: string;
|
|
11
|
+
}): PrHandoffNote;
|
|
12
|
+
export declare function parsePrHandoffNotes(raw: string): PrHandoffNote[];
|
|
13
|
+
export declare function readPrHandoffNotes(notesPath: string): Promise<PrHandoffNote[]>;
|
|
14
|
+
export declare function appendPrHandoffNote(opts: {
|
|
15
|
+
notesPath: string;
|
|
16
|
+
note: PrHandoffNote;
|
|
17
|
+
}): Promise<void>;
|
|
18
|
+
//# sourceMappingURL=note-store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"note-store.d.ts","sourceRoot":"","sources":["../../../../src/commands/pr/internal/note-store.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,aAAa,GAAG;IAC1B,cAAc,EAAE,CAAC,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAaF,wBAAgB,kBAAkB,CAAC,IAAI,EAAE;IACvC,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd,GAAG,aAAa,CAOhB;AAED,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,aAAa,EAAE,CA2BhE;AAED,wBAAsB,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC,CAQpF;AAED,wBAAsB,mBAAmB,CAAC,IAAI,EAAE;IAC9C,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,aAAa,CAAC;CACrB,GAAG,OAAO,CAAC,IAAI,CAAC,CAGhB"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { appendFile, mkdir, readFile } from "node:fs/promises";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
function invalidNote(index, message) {
|
|
4
|
+
return new Error(`Invalid pr/notes.jsonl entry ${index + 1}: ${message}`);
|
|
5
|
+
}
|
|
6
|
+
function trimRequired(value, field, index) {
|
|
7
|
+
if (typeof value !== "string")
|
|
8
|
+
throw invalidNote(index, `${field} must be a string`);
|
|
9
|
+
const trimmed = value.trim();
|
|
10
|
+
if (!trimmed)
|
|
11
|
+
throw invalidNote(index, `${field} must not be empty`);
|
|
12
|
+
return trimmed;
|
|
13
|
+
}
|
|
14
|
+
export function buildPrHandoffNote(opts) {
|
|
15
|
+
return {
|
|
16
|
+
schema_version: 1,
|
|
17
|
+
created_at: opts.createdAt,
|
|
18
|
+
author: opts.author.trim(),
|
|
19
|
+
body: opts.body.trim(),
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
export function parsePrHandoffNotes(raw) {
|
|
23
|
+
if (!raw.trim())
|
|
24
|
+
return [];
|
|
25
|
+
return raw
|
|
26
|
+
.split(/\r?\n/)
|
|
27
|
+
.filter((line) => line.trim().length > 0)
|
|
28
|
+
.map((line, index) => {
|
|
29
|
+
let parsed;
|
|
30
|
+
try {
|
|
31
|
+
parsed = JSON.parse(line);
|
|
32
|
+
}
|
|
33
|
+
catch (err) {
|
|
34
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
35
|
+
throw invalidNote(index, `invalid JSON (${message})`);
|
|
36
|
+
}
|
|
37
|
+
const record = parsed;
|
|
38
|
+
if (!record || typeof record !== "object") {
|
|
39
|
+
throw invalidNote(index, "entry must be an object");
|
|
40
|
+
}
|
|
41
|
+
if ((record.schema_version ?? 1) !== 1) {
|
|
42
|
+
throw invalidNote(index, "unsupported schema_version");
|
|
43
|
+
}
|
|
44
|
+
return {
|
|
45
|
+
schema_version: 1,
|
|
46
|
+
created_at: trimRequired(record.created_at, "created_at", index),
|
|
47
|
+
author: trimRequired(record.author, "author", index),
|
|
48
|
+
body: trimRequired(record.body, "body", index),
|
|
49
|
+
};
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
export async function readPrHandoffNotes(notesPath) {
|
|
53
|
+
try {
|
|
54
|
+
return parsePrHandoffNotes(await readFile(notesPath, "utf8"));
|
|
55
|
+
}
|
|
56
|
+
catch (err) {
|
|
57
|
+
const code = err?.code;
|
|
58
|
+
if (code === "ENOENT")
|
|
59
|
+
return [];
|
|
60
|
+
throw err;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
export async function appendPrHandoffNote(opts) {
|
|
64
|
+
await mkdir(path.dirname(opts.notesPath), { recursive: true });
|
|
65
|
+
await appendFile(opts.notesPath, `${JSON.stringify(opts.note)}\n`, "utf8");
|
|
66
|
+
}
|
|
@@ -9,8 +9,11 @@ export type ResolvedPrPaths = {
|
|
|
9
9
|
prDir: string;
|
|
10
10
|
metaPath: string;
|
|
11
11
|
diffstatPath: string;
|
|
12
|
+
notesPath: string;
|
|
12
13
|
verifyLogPath: string;
|
|
13
14
|
reviewPath: string;
|
|
15
|
+
githubTitlePath: string;
|
|
16
|
+
githubBodyPath: string;
|
|
14
17
|
};
|
|
15
18
|
export declare function resolvePrPaths(opts: {
|
|
16
19
|
ctx?: CommandContext;
|
|
@@ -25,5 +28,15 @@ export declare function readPrArtifact(opts: {
|
|
|
25
28
|
prDir: string;
|
|
26
29
|
fileName: string;
|
|
27
30
|
branch: string;
|
|
31
|
+
worktreePath?: string | null;
|
|
32
|
+
}): Promise<string | null>;
|
|
33
|
+
export declare function readPrArtifactFromBranch(opts: {
|
|
34
|
+
resolved: {
|
|
35
|
+
gitRoot: string;
|
|
36
|
+
};
|
|
37
|
+
prDir: string;
|
|
38
|
+
fileName: string;
|
|
39
|
+
branch: string;
|
|
40
|
+
worktreePath?: string | null;
|
|
28
41
|
}): Promise<string | null>;
|
|
29
42
|
//# sourceMappingURL=pr-paths.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pr-paths.d.ts","sourceRoot":"","sources":["../../../../src/commands/pr/internal/pr-paths.ts"],"names":[],"mappings":"AAGA,OAAO,EAA8B,KAAK,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAIxF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAEnE,MAAM,MAAM,eAAe,GAAG;IAC5B,QAAQ,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,aAAa,EAAE,MAAM,CAAA;KAAE,CAAC;IACrD,MAAM,EAAE,gBAAgB,CAAC;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"pr-paths.d.ts","sourceRoot":"","sources":["../../../../src/commands/pr/internal/pr-paths.ts"],"names":[],"mappings":"AAGA,OAAO,EAA8B,KAAK,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAIxF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAEnE,MAAM,MAAM,eAAe,GAAG;IAC5B,QAAQ,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,aAAa,EAAE,MAAM,CAAA;KAAE,CAAC;IACrD,MAAM,EAAE,gBAAgB,CAAC;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,wBAAsB,cAAc,CAAC,IAAI,EAAE;IACzC,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;CAChB,GAAG,OAAO,CAAC,eAAe,CAAC,CAuB3B;AAED,wBAAsB,cAAc,CAAC,IAAI,EAAE;IACzC,QAAQ,EAAE;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAMzB;AAED,wBAAsB,wBAAwB,CAAC,IAAI,EAAE;IACnD,QAAQ,EAAE;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAiBzB"}
|
|
@@ -19,8 +19,11 @@ export async function resolvePrPaths(opts) {
|
|
|
19
19
|
prDir,
|
|
20
20
|
metaPath: path.join(prDir, "meta.json"),
|
|
21
21
|
diffstatPath: path.join(prDir, "diffstat.txt"),
|
|
22
|
+
notesPath: path.join(prDir, "notes.jsonl"),
|
|
22
23
|
verifyLogPath: path.join(prDir, "verify.log"),
|
|
23
24
|
reviewPath: path.join(prDir, "review.md"),
|
|
25
|
+
githubTitlePath: path.join(prDir, "github-title.txt"),
|
|
26
|
+
githubBodyPath: path.join(prDir, "github-body.md"),
|
|
24
27
|
};
|
|
25
28
|
}
|
|
26
29
|
export async function readPrArtifact(opts) {
|
|
@@ -28,6 +31,16 @@ export async function readPrArtifact(opts) {
|
|
|
28
31
|
if (await fileExists(filePath)) {
|
|
29
32
|
return await readFile(filePath, "utf8");
|
|
30
33
|
}
|
|
34
|
+
return await readPrArtifactFromBranch(opts);
|
|
35
|
+
}
|
|
36
|
+
export async function readPrArtifactFromBranch(opts) {
|
|
37
|
+
const filePath = path.join(opts.prDir, opts.fileName);
|
|
38
|
+
if (opts.worktreePath) {
|
|
39
|
+
const worktreeFilePath = path.join(opts.worktreePath, path.relative(opts.resolved.gitRoot, filePath));
|
|
40
|
+
if (await fileExists(worktreeFilePath)) {
|
|
41
|
+
return await readFile(worktreeFilePath, "utf8");
|
|
42
|
+
}
|
|
43
|
+
}
|
|
31
44
|
const rel = toGitPath(path.relative(opts.resolved.gitRoot, filePath));
|
|
32
45
|
try {
|
|
33
46
|
return await gitShowFile(opts.resolved.gitRoot, opts.branch, rel);
|
|
@@ -1,9 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import type { TaskData } from "../../../backends/task-backend.js";
|
|
2
|
+
import type { PrHandoffNote } from "./note-store.js";
|
|
3
|
+
export declare function buildGithubPrTitle(task: TaskData): string;
|
|
4
|
+
export declare function renderPrAutoSummary(opts: {
|
|
5
|
+
updatedAt: string;
|
|
4
6
|
branch: string;
|
|
7
|
+
headSha: string | null;
|
|
8
|
+
diffstat: string;
|
|
5
9
|
}): string;
|
|
6
10
|
export declare function updateAutoSummaryBlock(text: string, summary: string): string;
|
|
7
|
-
export declare function
|
|
11
|
+
export declare function extractAutoSummaryBlock(text: string): string | null;
|
|
12
|
+
export declare function renderPrHandoffNotes(notes: PrHandoffNote[]): string[];
|
|
13
|
+
export declare function updateHandoffNotesBlock(text: string, notes: PrHandoffNote[]): string;
|
|
14
|
+
export declare function renderPrReviewDocument(opts: {
|
|
15
|
+
task: TaskData;
|
|
16
|
+
author?: string;
|
|
17
|
+
createdAt: string;
|
|
18
|
+
branch: string;
|
|
19
|
+
handoffNotes?: PrHandoffNote[];
|
|
20
|
+
autoSummary: string;
|
|
21
|
+
}): string;
|
|
22
|
+
export declare function renderGithubPrBody(opts: {
|
|
23
|
+
task: TaskData;
|
|
24
|
+
handoffNotes?: PrHandoffNote[];
|
|
25
|
+
autoSummary: string;
|
|
26
|
+
}): string;
|
|
8
27
|
export declare function validateReviewContents(review: string, errors: string[]): void;
|
|
28
|
+
export declare function validateGithubPrBodyContents(body: string, errors: string[]): void;
|
|
9
29
|
//# sourceMappingURL=review-template.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"review-template.d.ts","sourceRoot":"","sources":["../../../../src/commands/pr/internal/review-template.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"review-template.d.ts","sourceRoot":"","sources":["../../../../src/commands/pr/internal/review-template.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAClE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAoJrD,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,QAAQ,GAAG,MAAM,CAKzD;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE;IACxC,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;CAClB,GAAG,MAAM,CAeT;AAED,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAS5E;AAED,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAKnE;AAMD,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,aAAa,EAAE,GAAG,MAAM,EAAE,CAOrE;AAED,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,GAAG,MAAM,CAgBpF;AAED,wBAAgB,sBAAsB,CAAC,IAAI,EAAE;IAC3C,IAAI,EAAE,QAAQ,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,aAAa,EAAE,CAAC;IAC/B,WAAW,EAAE,MAAM,CAAC;CACrB,GAAG,MAAM,CAgBT;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE;IACvC,IAAI,EAAE,QAAQ,CAAC;IACf,YAAY,CAAC,EAAE,aAAa,EAAE,CAAC;IAC/B,WAAW,EAAE,MAAM,CAAC;CACrB,GAAG,MAAM,CAST;AAED,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,CAiB7E;AAED,wBAAgB,4BAA4B,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,CAajF"}
|