@fitlab-ai/agent-infra 0.9.1 → 0.9.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -11
- package/README.zh-CN.md +24 -11
- package/bin/cli.ts +12 -0
- package/dist/bin/cli.js +14 -0
- package/dist/bin/internal-cli.js +30 -0
- package/dist/lib/agent-client.js +163 -0
- package/dist/lib/agent-clients/adapter.js +337 -0
- package/dist/lib/agent-clients/adapters/antigravity-cli.js +64 -0
- package/dist/lib/agent-clients/adapters/claude-code.js +71 -0
- package/dist/lib/agent-clients/adapters/codex-sandbox.js +210 -0
- package/dist/lib/agent-clients/adapters/codex.js +63 -0
- package/dist/lib/agent-clients/adapters/index.js +20 -0
- package/dist/lib/agent-clients/adapters/opencode.js +73 -0
- package/dist/lib/agent-clients/config.js +215 -0
- package/dist/lib/agent-clients/custom-tuis.js +99 -0
- package/dist/lib/agent-clients/invocation.js +9 -0
- package/dist/lib/agent-clients/next-steps.js +47 -0
- package/dist/lib/agent-clients/project-assets.js +45 -0
- package/dist/lib/agent-clients/reconcile.js +236 -0
- package/dist/lib/agent-clients/registry.js +78 -0
- package/dist/lib/agent-clients/schema.js +75 -0
- package/dist/lib/agent-clients/tokens.js +49 -0
- package/dist/lib/agent-clients/types.js +29 -0
- package/dist/lib/builtin-tuis.js +9 -14
- package/dist/lib/defaults.json +85 -73
- package/dist/lib/git/review-snapshot.js +25 -10
- package/dist/lib/git/reviewed-commit-equivalence.js +110 -0
- package/dist/lib/git/workflow.js +54 -1
- package/dist/lib/init.js +47 -91
- package/dist/lib/internal/agent-client.js +174 -0
- package/dist/lib/internal/git-workflow.js +7 -2
- package/dist/lib/internal/platform-checks.js +3 -3
- package/dist/lib/internal/platform-comment.js +29 -2
- package/dist/lib/internal/platform-issue.js +7 -0
- package/dist/lib/internal/platform-pr-review.js +132 -0
- package/dist/lib/internal/platform-pr.js +20 -2
- package/dist/lib/internal/platform-release-notes.js +52 -16
- package/dist/lib/internal/pr-review-grade.js +140 -0
- package/dist/lib/internal/release-workflow.js +82 -20
- package/dist/lib/internal/task-activity.js +73 -0
- package/dist/lib/internal/task-event.js +17 -1
- package/dist/lib/internal/task-lifecycle.js +7 -0
- package/dist/lib/internal/task-orchestration.js +196 -0
- package/dist/lib/internal/task-review.js +70 -0
- package/dist/lib/merge.js +2 -1
- package/dist/lib/platform/adapters.js +45 -1
- package/dist/lib/platform/change-request-git-evidence.js +113 -0
- package/dist/lib/platform/completion-backfill.js +122 -0
- package/dist/lib/platform/issue-comments.js +3 -2
- package/dist/lib/platform/merged-pr-equivalence.js +156 -16
- package/dist/lib/platform/pr-checks.js +101 -50
- package/dist/lib/platform/pr-review.js +166 -0
- package/dist/lib/platform/pull-requests.js +432 -7
- package/dist/lib/platform/release-notes.js +85 -3
- package/dist/lib/platform/releases.js +1 -1
- package/dist/lib/platform/verification-required.js +8 -10
- package/dist/lib/pr-review/evidence-grading.js +229 -0
- package/dist/lib/prompt.js +15 -3
- package/dist/lib/release/channels.js +4 -1
- package/dist/lib/release/workflow.js +4 -2
- package/dist/lib/remove-dir.js +25 -0
- package/dist/lib/run/tui.js +11 -7
- package/dist/lib/sandbox/agent-client-reconciler.js +234 -0
- package/dist/lib/sandbox/clipboard/linux.js +2 -1
- package/dist/lib/sandbox/commands/create.js +76 -200
- package/dist/lib/sandbox/commands/enter.js +17 -1
- package/dist/lib/sandbox/commands/prune.js +2 -2
- package/dist/lib/sandbox/commands/rm.js +3 -2
- package/dist/lib/sandbox/commands/show.js +1 -1
- package/dist/lib/sandbox/config.js +21 -4
- package/dist/lib/sandbox/constants.js +3 -0
- package/dist/lib/sandbox/dockerfile.js +2 -1
- package/dist/lib/sandbox/managed-fs.js +10 -5
- package/dist/lib/sandbox/recovery.js +52 -36
- package/dist/lib/sandbox/shell.js +1 -1
- package/dist/lib/sandbox/tool-types.js +8 -0
- package/dist/lib/sandbox/tools.js +2 -126
- package/dist/lib/task/activity-intent.js +101 -0
- package/dist/lib/task/artifact-lifecycle.js +3 -50
- package/dist/lib/task/commands/decisions.js +50 -20
- package/dist/lib/task/commands/log.js +15 -14
- package/dist/lib/task/delegation-receipts.js +128 -0
- package/dist/lib/task/events.js +146 -8
- package/dist/lib/task/finalization-artifacts.js +35 -0
- package/dist/lib/task/lifecycle-execution.js +46 -0
- package/dist/lib/task/orchestration.js +784 -0
- package/dist/lib/task/review-artifacts.js +143 -59
- package/dist/lib/task/review-finalization.js +186 -0
- package/dist/lib/task/review-fingerprint.js +4 -0
- package/dist/lib/task/task-execution-lock.js +231 -0
- package/dist/lib/task/verification-checks.js +2 -1
- package/dist/lib/task/verification-engine.js +372 -28
- package/dist/lib/task/verification-review.js +1 -1
- package/dist/lib/task/verification.js +5 -2
- package/dist/lib/task/workspace-snapshot.js +46 -0
- package/dist/lib/update.js +42 -161
- package/lib/agent-client.ts +214 -0
- package/lib/agent-clients/adapter.ts +534 -0
- package/lib/agent-clients/adapters/antigravity-cli.ts +65 -0
- package/lib/agent-clients/adapters/claude-code.ts +79 -0
- package/lib/agent-clients/adapters/codex-sandbox.ts +245 -0
- package/lib/agent-clients/adapters/codex.ts +67 -0
- package/lib/agent-clients/adapters/index.ts +27 -0
- package/lib/agent-clients/adapters/opencode.ts +75 -0
- package/lib/agent-clients/config.ts +323 -0
- package/lib/agent-clients/custom-tuis.ts +149 -0
- package/lib/agent-clients/invocation.ts +19 -0
- package/lib/agent-clients/next-steps.ts +85 -0
- package/lib/agent-clients/project-assets.ts +96 -0
- package/lib/agent-clients/reconcile.ts +325 -0
- package/lib/agent-clients/registry.ts +154 -0
- package/lib/agent-clients/schema.ts +80 -0
- package/lib/agent-clients/tokens.ts +53 -0
- package/lib/agent-clients/types.ts +92 -0
- package/lib/benchmark/schemas/v1.0.0/case-manifest.schema.json +120 -0
- package/lib/benchmark/schemas/v1.0.0/common.schema.json +109 -0
- package/lib/benchmark/schemas/v1.0.0/grader-result.schema.json +160 -0
- package/lib/benchmark/schemas/v1.0.0/run-manifest.schema.json +122 -0
- package/lib/benchmark/schemas/v1.0.0/subject.schema.json +227 -0
- package/lib/builtin-tuis.ts +16 -15
- package/lib/defaults.json +24 -12
- package/lib/git/review-snapshot.ts +39 -9
- package/lib/git/reviewed-commit-equivalence.ts +135 -0
- package/lib/git/workflow.ts +66 -2
- package/lib/init.ts +53 -121
- package/lib/internal/agent-client.ts +186 -0
- package/lib/internal/git-workflow.ts +6 -2
- package/lib/internal/platform-checks.ts +4 -4
- package/lib/internal/platform-comment.ts +17 -2
- package/lib/internal/platform-issue.ts +4 -0
- package/lib/internal/platform-pr-review.ts +104 -0
- package/lib/internal/platform-pr.ts +14 -1
- package/lib/internal/platform-release-notes.ts +59 -16
- package/lib/internal/pr-review-grade.ts +130 -0
- package/lib/internal/release-workflow.ts +79 -20
- package/lib/internal/task-activity.ts +55 -0
- package/lib/internal/task-event.ts +9 -1
- package/lib/internal/task-lifecycle.ts +4 -0
- package/lib/internal/task-orchestration.ts +171 -0
- package/lib/internal/task-review.ts +70 -0
- package/lib/merge.ts +2 -1
- package/lib/platform/adapters.ts +169 -3
- package/lib/platform/change-request-git-evidence.ts +159 -0
- package/lib/platform/completion-backfill.ts +134 -0
- package/lib/platform/issue-comments.ts +3 -2
- package/lib/platform/merged-pr-equivalence.ts +178 -19
- package/lib/platform/pr-checks.ts +121 -66
- package/lib/platform/pr-review.ts +201 -0
- package/lib/platform/pull-requests.ts +529 -27
- package/lib/platform/release-notes.ts +100 -4
- package/lib/platform/releases.ts +1 -1
- package/lib/platform/verification-required.ts +12 -10
- package/lib/pr-review/evidence-grading.ts +318 -0
- package/lib/prompt.ts +16 -3
- package/lib/release/channels.ts +4 -1
- package/lib/release/workflow.ts +4 -3
- package/lib/remove-dir.ts +28 -0
- package/lib/run/tui.ts +12 -5
- package/lib/sandbox/agent-client-reconciler.ts +378 -0
- package/lib/sandbox/clipboard/linux.ts +2 -1
- package/lib/sandbox/commands/create.ts +111 -212
- package/lib/sandbox/commands/enter.ts +23 -1
- package/lib/sandbox/commands/prune.ts +2 -2
- package/lib/sandbox/commands/rm.ts +3 -2
- package/lib/sandbox/commands/show.ts +1 -1
- package/lib/sandbox/config.ts +31 -4
- package/lib/sandbox/constants.ts +6 -0
- package/lib/sandbox/dockerfile.ts +2 -1
- package/lib/sandbox/managed-fs.ts +18 -5
- package/lib/sandbox/recovery.ts +98 -67
- package/lib/sandbox/shell.ts +1 -1
- package/lib/sandbox/tool-types.ts +143 -0
- package/lib/sandbox/tools.ts +5 -157
- package/lib/server/server.schema.json +2 -2
- package/lib/task/activity-intent.ts +128 -0
- package/lib/task/artifact-lifecycle.ts +3 -39
- package/lib/task/commands/decisions.ts +53 -20
- package/lib/task/commands/log.ts +15 -14
- package/lib/task/delegation-receipts.ts +199 -0
- package/lib/task/events.ts +164 -11
- package/lib/task/finalization-artifacts.ts +58 -0
- package/lib/task/lifecycle-execution.ts +106 -0
- package/lib/task/orchestration.ts +1022 -0
- package/lib/task/review-artifacts.ts +201 -69
- package/lib/task/review-finalization.ts +306 -0
- package/lib/task/review-fingerprint.ts +5 -0
- package/lib/task/task-execution-lock.ts +296 -0
- package/lib/task/verification-checks.ts +2 -1
- package/lib/task/verification-engine.ts +424 -28
- package/lib/task/verification-review.ts +1 -0
- package/lib/task/verification.ts +8 -3
- package/lib/task/workspace-snapshot.ts +57 -0
- package/lib/update.ts +48 -184
- package/package.json +4 -4
- package/templates/.agents/QUICKSTART.en.md +25 -8
- package/templates/.agents/QUICKSTART.zh-CN.md +25 -8
- package/templates/.agents/README.en.md +29 -25
- package/templates/.agents/README.zh-CN.md +29 -25
- package/templates/.agents/hooks/lifecycle-delegation.js +75 -0
- package/templates/.agents/rules/README.en.md +2 -0
- package/templates/.agents/rules/README.zh-CN.md +2 -0
- package/templates/.agents/rules/commit-and-pr.en.md +1 -0
- package/templates/.agents/rules/commit-and-pr.zh-CN.md +1 -0
- package/templates/.agents/rules/create-issue.github.en.md +4 -2
- package/templates/.agents/rules/create-issue.github.zh-CN.md +4 -2
- package/templates/.agents/rules/human-decision-context.en.md +14 -12
- package/templates/.agents/rules/human-decision-context.zh-CN.md +14 -12
- package/templates/.agents/rules/issue-fields.github.en.md +3 -1
- package/templates/.agents/rules/issue-fields.github.zh-CN.md +3 -1
- package/templates/.agents/rules/issue-pr-commands.en.md +5 -3
- package/templates/.agents/rules/issue-pr-commands.github.en.md +5 -3
- package/templates/.agents/rules/issue-pr-commands.github.zh-CN.md +5 -3
- package/templates/.agents/rules/issue-pr-commands.zh-CN.md +5 -3
- package/templates/.agents/rules/issue-sync.github.en.md +7 -3
- package/templates/.agents/rules/issue-sync.github.zh-CN.md +8 -4
- package/templates/.agents/rules/lifecycle-orchestration.en.md +24 -0
- package/templates/.agents/rules/lifecycle-orchestration.zh-CN.md +24 -0
- package/templates/.agents/rules/milestone-inference.github.en.md +4 -2
- package/templates/.agents/rules/milestone-inference.github.zh-CN.md +4 -2
- package/templates/.agents/rules/next-step-output.en.md +18 -0
- package/templates/.agents/rules/next-step-output.zh-CN.md +18 -0
- package/templates/.agents/rules/no-mid-flow-questions.en.md +19 -0
- package/templates/.agents/rules/no-mid-flow-questions.zh-CN.md +19 -0
- package/templates/.agents/rules/pr-checks-commands.en.md +3 -3
- package/templates/.agents/rules/pr-checks-commands.github.en.md +2 -2
- package/templates/.agents/rules/pr-checks-commands.github.zh-CN.md +2 -2
- package/templates/.agents/rules/pr-checks-commands.zh-CN.md +3 -3
- package/templates/.agents/rules/pr-sync.en.md +3 -1
- package/templates/.agents/rules/pr-sync.github.en.md +11 -1
- package/templates/.agents/rules/pr-sync.github.zh-CN.md +11 -1
- package/templates/.agents/rules/pr-sync.zh-CN.md +3 -1
- package/templates/.agents/rules/release-commands.en.md +1 -1
- package/templates/.agents/rules/release-commands.github.en.md +21 -5
- package/templates/.agents/rules/release-commands.github.zh-CN.md +21 -5
- package/templates/.agents/rules/release-commands.zh-CN.md +1 -1
- package/templates/.agents/rules/review-handshake.en.md +4 -4
- package/templates/.agents/rules/review-handshake.zh-CN.md +4 -4
- package/templates/.agents/rules/review-method.en.md +113 -0
- package/templates/.agents/rules/review-method.zh-CN.md +98 -0
- package/templates/.agents/rules/task-management.en.md +11 -0
- package/templates/.agents/rules/task-management.zh-CN.md +11 -0
- package/templates/.agents/skills/analyze-task/SKILL.en.md +15 -12
- package/templates/.agents/skills/analyze-task/SKILL.zh-CN.md +15 -12
- package/templates/.agents/skills/block-task/SKILL.en.md +11 -9
- package/templates/.agents/skills/block-task/SKILL.zh-CN.md +11 -9
- package/templates/.agents/skills/cancel-task/SKILL.en.md +10 -8
- package/templates/.agents/skills/cancel-task/SKILL.zh-CN.md +11 -9
- package/templates/.agents/skills/check-task/SKILL.en.md +16 -16
- package/templates/.agents/skills/check-task/SKILL.zh-CN.md +16 -16
- package/templates/.agents/skills/close-codescan/SKILL.en.md +7 -5
- package/templates/.agents/skills/close-codescan/SKILL.zh-CN.md +7 -5
- package/templates/.agents/skills/close-dependabot/SKILL.en.md +7 -5
- package/templates/.agents/skills/close-dependabot/SKILL.zh-CN.md +7 -5
- package/templates/.agents/skills/code-task/SKILL.en.md +10 -7
- package/templates/.agents/skills/code-task/SKILL.zh-CN.md +13 -10
- package/templates/.agents/skills/code-task/reference/fix-mode.en.md +14 -16
- package/templates/.agents/skills/code-task/reference/fix-mode.zh-CN.md +14 -16
- package/templates/.agents/skills/code-task/reference/output-template.en.md +3 -3
- package/templates/.agents/skills/code-task/reference/output-template.zh-CN.md +3 -3
- package/templates/.agents/skills/commit/SKILL.en.md +13 -1
- package/templates/.agents/skills/commit/SKILL.zh-CN.md +13 -1
- package/templates/.agents/skills/commit/reference/commit-message.en.md +1 -1
- package/templates/.agents/skills/commit/reference/commit-message.zh-CN.md +1 -1
- package/templates/.agents/skills/commit/reference/issue-metadata-sync.en.md +1 -1
- package/templates/.agents/skills/commit/reference/issue-metadata-sync.zh-CN.md +1 -1
- package/templates/.agents/skills/commit/reference/pr-summary-sync.en.md +1 -1
- package/templates/.agents/skills/commit/reference/pr-summary-sync.zh-CN.md +1 -1
- package/templates/.agents/skills/commit/reference/task-status-update.en.md +24 -28
- package/templates/.agents/skills/commit/reference/task-status-update.zh-CN.md +24 -28
- package/templates/.agents/skills/complete-manual-validation/SKILL.en.md +6 -4
- package/templates/.agents/skills/complete-manual-validation/SKILL.zh-CN.md +6 -4
- package/templates/.agents/skills/complete-manual-validation/reference/summary-update.en.md +1 -1
- package/templates/.agents/skills/complete-manual-validation/reference/summary-update.zh-CN.md +1 -1
- package/templates/.agents/skills/complete-task/SKILL.en.md +23 -8
- package/templates/.agents/skills/complete-task/SKILL.zh-CN.md +23 -8
- package/templates/.agents/skills/complete-task/config/verify.en.json +1 -0
- package/templates/.agents/skills/complete-task/config/verify.zh-CN.json +1 -0
- package/templates/.agents/skills/complete-task/reference/external-delivery.en.md +17 -0
- package/templates/.agents/skills/complete-task/reference/external-delivery.zh-CN.md +17 -0
- package/templates/.agents/skills/create-pr/SKILL.en.md +13 -11
- package/templates/.agents/skills/create-pr/SKILL.zh-CN.md +13 -11
- package/templates/.agents/skills/create-pr/reference/comment-publish.en.md +1 -1
- package/templates/.agents/skills/create-pr/reference/comment-publish.zh-CN.md +1 -1
- package/templates/.agents/skills/create-pr/reference/pr-body-template.en.md +3 -3
- package/templates/.agents/skills/create-pr/reference/pr-body-template.zh-CN.md +3 -3
- package/templates/.agents/skills/create-release-note/SKILL.en.md +17 -16
- package/templates/.agents/skills/create-release-note/SKILL.zh-CN.md +17 -16
- package/templates/.agents/skills/create-task/SKILL.en.md +16 -14
- package/templates/.agents/skills/create-task/SKILL.zh-CN.md +16 -14
- package/templates/.agents/skills/import-codescan/SKILL.en.md +5 -5
- package/templates/.agents/skills/import-codescan/SKILL.zh-CN.md +5 -5
- package/templates/.agents/skills/import-dependabot/SKILL.en.md +5 -5
- package/templates/.agents/skills/import-dependabot/SKILL.zh-CN.md +5 -5
- package/templates/.agents/skills/import-issue/SKILL.en.md +10 -8
- package/templates/.agents/skills/import-issue/SKILL.zh-CN.md +10 -8
- package/templates/.agents/skills/init-labels/SKILL.en.md +4 -4
- package/templates/.agents/skills/init-labels/SKILL.zh-CN.md +4 -4
- package/templates/.agents/skills/init-milestones/SKILL.en.md +4 -4
- package/templates/.agents/skills/init-milestones/SKILL.zh-CN.md +4 -4
- package/templates/.agents/skills/plan-task/SKILL.en.md +13 -10
- package/templates/.agents/skills/plan-task/SKILL.zh-CN.md +13 -10
- package/templates/.agents/skills/post-release/SKILL.en.md +2 -0
- package/templates/.agents/skills/post-release/SKILL.zh-CN.md +2 -0
- package/templates/.agents/skills/refine-title/SKILL.en.md +1 -1
- package/templates/.agents/skills/refine-title/SKILL.zh-CN.md +1 -1
- package/templates/.agents/skills/release/SKILL.en.md +16 -10
- package/templates/.agents/skills/release/SKILL.zh-CN.md +16 -10
- package/templates/.agents/skills/restore-task/SKILL.en.md +4 -1
- package/templates/.agents/skills/restore-task/SKILL.zh-CN.md +4 -1
- package/templates/.agents/skills/review-analysis/SKILL.en.md +18 -4
- package/templates/.agents/skills/review-analysis/SKILL.zh-CN.md +19 -5
- package/templates/.agents/skills/review-analysis/config/verify.en.json +6 -0
- package/templates/.agents/skills/review-analysis/config/verify.zh-CN.json +6 -0
- package/templates/.agents/skills/review-analysis/reference/output-templates.en.md +13 -15
- package/templates/.agents/skills/review-analysis/reference/output-templates.zh-CN.md +13 -15
- package/templates/.agents/skills/review-analysis/reference/report-template.en.md +51 -5
- package/templates/.agents/skills/review-analysis/reference/report-template.zh-CN.md +52 -6
- package/templates/.agents/skills/review-analysis/reference/review-criteria.en.md +25 -22
- package/templates/.agents/skills/review-analysis/reference/review-criteria.zh-CN.md +25 -22
- package/templates/.agents/skills/review-code/SKILL.en.md +35 -12
- package/templates/.agents/skills/review-code/SKILL.zh-CN.md +35 -12
- package/templates/.agents/skills/review-code/config/verify.en.json +7 -0
- package/templates/.agents/skills/review-code/config/verify.zh-CN.json +7 -0
- package/templates/.agents/skills/review-code/reference/concurrency-risks.en.md +25 -0
- package/templates/.agents/skills/review-code/reference/concurrency-risks.zh-CN.md +25 -0
- package/templates/.agents/skills/review-code/reference/cross-platform-risks.en.md +27 -0
- package/templates/.agents/skills/review-code/reference/cross-platform-risks.zh-CN.md +27 -0
- package/templates/.agents/skills/review-code/reference/documentation-antipatterns.en.md +13 -0
- package/templates/.agents/skills/review-code/reference/documentation-antipatterns.zh-CN.md +13 -0
- package/templates/.agents/skills/review-code/reference/migration-risks.en.md +25 -0
- package/templates/.agents/skills/review-code/reference/migration-risks.zh-CN.md +25 -0
- package/templates/.agents/skills/review-code/reference/output-templates.en.md +22 -24
- package/templates/.agents/skills/review-code/reference/output-templates.zh-CN.md +22 -24
- package/templates/.agents/skills/review-code/reference/report-template.en.md +54 -7
- package/templates/.agents/skills/review-code/reference/report-template.zh-CN.md +54 -7
- package/templates/.agents/skills/review-code/reference/review-criteria.en.md +29 -24
- package/templates/.agents/skills/review-code/reference/review-criteria.zh-CN.md +29 -24
- package/templates/.agents/skills/review-code/reference/security-risks.en.md +25 -0
- package/templates/.agents/skills/review-code/reference/security-risks.zh-CN.md +25 -0
- package/templates/.agents/skills/review-plan/SKILL.en.md +18 -4
- package/templates/.agents/skills/review-plan/SKILL.zh-CN.md +19 -5
- package/templates/.agents/skills/review-plan/config/verify.en.json +6 -0
- package/templates/.agents/skills/review-plan/config/verify.zh-CN.json +6 -0
- package/templates/.agents/skills/review-plan/reference/output-templates.en.md +13 -15
- package/templates/.agents/skills/review-plan/reference/output-templates.zh-CN.md +13 -15
- package/templates/.agents/skills/review-plan/reference/report-template.en.md +61 -5
- package/templates/.agents/skills/review-plan/reference/report-template.zh-CN.md +61 -5
- package/templates/.agents/skills/review-plan/reference/review-criteria.en.md +21 -24
- package/templates/.agents/skills/review-plan/reference/review-criteria.zh-CN.md +21 -24
- package/templates/.agents/skills/review-pr/SKILL.en.md +158 -0
- package/templates/.agents/skills/review-pr/SKILL.zh-CN.md +158 -0
- package/templates/.agents/skills/review-pr/config/verify.en.json +37 -0
- package/templates/.agents/skills/review-pr/config/verify.zh-CN.json +37 -0
- package/templates/.agents/skills/review-pr/reference/evidence-grading.en.md +65 -0
- package/templates/.agents/skills/review-pr/reference/evidence-grading.zh-CN.md +65 -0
- package/templates/.agents/skills/review-pr/reference/output-guidance.en.md +18 -0
- package/templates/.agents/skills/review-pr/reference/output-guidance.zh-CN.md +18 -0
- package/templates/.agents/skills/review-pr/reference/report-template.en.md +85 -0
- package/templates/.agents/skills/review-pr/reference/report-template.zh-CN.md +85 -0
- package/templates/.agents/skills/run-task/SKILL.en.md +22 -0
- package/templates/.agents/skills/run-task/SKILL.zh-CN.md +22 -0
- package/templates/.agents/skills/run-task/config/verify.en.json +10 -0
- package/templates/.agents/skills/run-task/config/verify.zh-CN.json +10 -0
- package/templates/.agents/skills/run-task/reference/host-validation.en.md +20 -0
- package/templates/.agents/skills/run-task/reference/host-validation.zh-CN.md +20 -0
- package/templates/.agents/skills/test/SKILL.en.md +4 -4
- package/templates/.agents/skills/test/SKILL.zh-CN.md +4 -4
- package/templates/.agents/skills/test-integration/SKILL.en.md +4 -4
- package/templates/.agents/skills/test-integration/SKILL.zh-CN.md +4 -4
- package/templates/.agents/skills/update-agent-infra/SKILL.en.md +5 -5
- package/templates/.agents/skills/update-agent-infra/SKILL.zh-CN.md +5 -5
- package/templates/.agents/skills/update-agent-infra/scripts/sync-templates.js +664 -246
- package/templates/.agents/skills/upgrade-dependency/SKILL.en.md +4 -4
- package/templates/.agents/skills/upgrade-dependency/SKILL.zh-CN.md +4 -4
- package/templates/.agents/skills/watch-pr/SKILL.en.md +21 -21
- package/templates/.agents/skills/watch-pr/SKILL.zh-CN.md +21 -21
- package/templates/.agents/skills/watch-pr/reference/monitor-and-heal.en.md +27 -6
- package/templates/.agents/skills/watch-pr/reference/monitor-and-heal.zh-CN.md +26 -5
- package/templates/.agents/templates/task.en.md +1 -1
- package/templates/.agents/templates/task.zh-CN.md +1 -1
- package/templates/.agents/workflows/bug-fix.en.yaml +3 -3
- package/templates/.agents/workflows/bug-fix.zh-CN.yaml +3 -3
- package/templates/.agents/workflows/code-review.en.yaml +1 -1
- package/templates/.agents/workflows/code-review.zh-CN.yaml +1 -1
- package/templates/.agents/workflows/feature-development.en.yaml +4 -4
- package/templates/.agents/workflows/feature-development.zh-CN.yaml +4 -4
- package/templates/.agents/workflows/refactoring.en.yaml +3 -3
- package/templates/.agents/workflows/refactoring.zh-CN.yaml +3 -3
- package/templates/.claude/agents/agent-infra-lifecycle-executor.en.md +6 -0
- package/templates/.claude/agents/agent-infra-lifecycle-executor.zh-CN.md +6 -0
- package/templates/.claude/agents/agent-infra-lifecycle-reviewer.en.md +6 -0
- package/templates/.claude/agents/agent-infra-lifecycle-reviewer.zh-CN.md +6 -0
- package/templates/.claude/commands/post-release.en.md +1 -0
- package/templates/.claude/commands/post-release.zh-CN.md +1 -0
- package/templates/.claude/commands/review-pr.en.md +8 -0
- package/templates/.claude/commands/review-pr.zh-CN.md +8 -0
- package/templates/.claude/commands/run-task.en.md +8 -0
- package/templates/.claude/commands/run-task.zh-CN.md +8 -0
- package/templates/.claude/settings.json +24 -0
- package/templates/.codex/agents/agent-infra-lifecycle-executor.en.toml +3 -0
- package/templates/.codex/agents/agent-infra-lifecycle-executor.zh-CN.toml +3 -0
- package/templates/.codex/agents/agent-infra-lifecycle-reviewer.en.toml +3 -0
- package/templates/.codex/agents/agent-infra-lifecycle-reviewer.zh-CN.toml +3 -0
- package/templates/.gemini/commands/_project_/review-pr.en.toml +10 -0
- package/templates/.gemini/commands/_project_/review-pr.zh-CN.toml +10 -0
- package/templates/.opencode/commands/post-release.en.md +2 -0
- package/templates/.opencode/commands/post-release.zh-CN.md +2 -0
- package/templates/.opencode/commands/review-pr.en.md +11 -0
- package/templates/.opencode/commands/review-pr.zh-CN.md +11 -0
- package/templates/.opencode/commands/run-task.en.md +11 -0
- package/templates/.opencode/commands/run-task.zh-CN.md +11 -0
- package/templates/.gemini/commands/_project_/analyze-task.en.toml +0 -10
- package/templates/.gemini/commands/_project_/analyze-task.zh-CN.toml +0 -10
- package/templates/.gemini/commands/_project_/archive-tasks.en.toml +0 -10
- package/templates/.gemini/commands/_project_/archive-tasks.zh-CN.toml +0 -10
- package/templates/.gemini/commands/_project_/block-task.en.toml +0 -10
- package/templates/.gemini/commands/_project_/block-task.zh-CN.toml +0 -10
- package/templates/.gemini/commands/_project_/cancel-task.en.toml +0 -10
- package/templates/.gemini/commands/_project_/cancel-task.zh-CN.toml +0 -10
- package/templates/.gemini/commands/_project_/check-task.en.toml +0 -10
- package/templates/.gemini/commands/_project_/check-task.zh-CN.toml +0 -10
- package/templates/.gemini/commands/_project_/close-codescan.en.toml +0 -8
- package/templates/.gemini/commands/_project_/close-codescan.zh-CN.toml +0 -8
- package/templates/.gemini/commands/_project_/close-dependabot.en.toml +0 -8
- package/templates/.gemini/commands/_project_/close-dependabot.zh-CN.toml +0 -8
- package/templates/.gemini/commands/_project_/code-task.en.toml +0 -10
- package/templates/.gemini/commands/_project_/code-task.zh-CN.toml +0 -10
- package/templates/.gemini/commands/_project_/commit.en.toml +0 -10
- package/templates/.gemini/commands/_project_/commit.zh-CN.toml +0 -10
- package/templates/.gemini/commands/_project_/complete-manual-validation.en.toml +0 -10
- package/templates/.gemini/commands/_project_/complete-manual-validation.zh-CN.toml +0 -10
- package/templates/.gemini/commands/_project_/complete-task.en.toml +0 -10
- package/templates/.gemini/commands/_project_/complete-task.zh-CN.toml +0 -10
- package/templates/.gemini/commands/_project_/create-pr.en.toml +0 -10
- package/templates/.gemini/commands/_project_/create-pr.zh-CN.toml +0 -10
- package/templates/.gemini/commands/_project_/create-release-note.en.toml +0 -8
- package/templates/.gemini/commands/_project_/create-release-note.zh-CN.toml +0 -8
- package/templates/.gemini/commands/_project_/create-task.en.toml +0 -8
- package/templates/.gemini/commands/_project_/create-task.zh-CN.toml +0 -8
- package/templates/.gemini/commands/_project_/import-codescan.en.toml +0 -8
- package/templates/.gemini/commands/_project_/import-codescan.zh-CN.toml +0 -8
- package/templates/.gemini/commands/_project_/import-dependabot.en.toml +0 -8
- package/templates/.gemini/commands/_project_/import-dependabot.zh-CN.toml +0 -8
- package/templates/.gemini/commands/_project_/import-issue.en.toml +0 -8
- package/templates/.gemini/commands/_project_/import-issue.zh-CN.toml +0 -8
- package/templates/.gemini/commands/_project_/init-labels.en.toml +0 -8
- package/templates/.gemini/commands/_project_/init-labels.zh-CN.toml +0 -8
- package/templates/.gemini/commands/_project_/init-milestones.en.toml +0 -10
- package/templates/.gemini/commands/_project_/init-milestones.zh-CN.toml +0 -10
- package/templates/.gemini/commands/_project_/plan-task.en.toml +0 -10
- package/templates/.gemini/commands/_project_/plan-task.zh-CN.toml +0 -10
- package/templates/.gemini/commands/_project_/post-release.en.toml +0 -6
- package/templates/.gemini/commands/_project_/post-release.zh-CN.toml +0 -6
- package/templates/.gemini/commands/_project_/refine-title.en.toml +0 -8
- package/templates/.gemini/commands/_project_/refine-title.zh-CN.toml +0 -8
- package/templates/.gemini/commands/_project_/release.en.toml +0 -8
- package/templates/.gemini/commands/_project_/release.zh-CN.toml +0 -8
- package/templates/.gemini/commands/_project_/restore-task.en.toml +0 -8
- package/templates/.gemini/commands/_project_/restore-task.zh-CN.toml +0 -8
- package/templates/.gemini/commands/_project_/review-analysis.en.toml +0 -10
- package/templates/.gemini/commands/_project_/review-analysis.zh-CN.toml +0 -10
- package/templates/.gemini/commands/_project_/review-code.en.toml +0 -10
- package/templates/.gemini/commands/_project_/review-code.zh-CN.toml +0 -10
- package/templates/.gemini/commands/_project_/review-plan.en.toml +0 -10
- package/templates/.gemini/commands/_project_/review-plan.zh-CN.toml +0 -10
- package/templates/.gemini/commands/_project_/test-integration.en.toml +0 -6
- package/templates/.gemini/commands/_project_/test-integration.zh-CN.toml +0 -6
- package/templates/.gemini/commands/_project_/test.en.toml +0 -6
- package/templates/.gemini/commands/_project_/test.zh-CN.toml +0 -6
- package/templates/.gemini/commands/_project_/update-agent-infra.en.toml +0 -6
- package/templates/.gemini/commands/_project_/update-agent-infra.zh-CN.toml +0 -6
- package/templates/.gemini/commands/_project_/upgrade-dependency.en.toml +0 -8
- package/templates/.gemini/commands/_project_/upgrade-dependency.zh-CN.toml +0 -8
- package/templates/.gemini/commands/_project_/watch-pr.en.toml +0 -10
- package/templates/.gemini/commands/_project_/watch-pr.zh-CN.toml +0 -10
- package/templates/.gemini/settings.json +0 -3
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const LOCAL_VERIFICATION_CHECKS = [
|
|
2
|
-
'task-meta', 'artifact', 'implementation-input', 'activity-log', 'completion-checklist'
|
|
2
|
+
'task-meta', 'artifact', 'implementation-input', 'activity-log', 'completion-checklist',
|
|
3
|
+
'orchestration-state', 'orchestration-evidence'
|
|
3
4
|
];
|
|
4
5
|
function isLocalVerificationCheck(value) {
|
|
5
6
|
return LOCAL_VERIFICATION_CHECKS.includes(value);
|
|
@@ -4,13 +4,16 @@ import path from "node:path";
|
|
|
4
4
|
import process from "node:process";
|
|
5
5
|
import { execFileSync } from "node:child_process";
|
|
6
6
|
import { fileURLToPath } from "node:url";
|
|
7
|
-
import { extractReviewBaseline, extractReviewDiffFingerprint, extractReviewedSnapshotTree, findAuthoritativeReviewCodeArtifact, loadPostReviewConfig, parseReviewVerdict, resolvePostReviewGlobs } from "./verification-review.js";
|
|
7
|
+
import { extractReviewBaseline, extractReviewDiffBase, extractReviewDiffFingerprint, extractReviewedSnapshotTree, findAuthoritativeReviewCodeArtifact, loadPostReviewConfig, parseReviewVerdict, resolvePostReviewGlobs } from "./verification-review.js";
|
|
8
8
|
import { check as checkPlatformSync } from "../platform/verification-sync.js";
|
|
9
9
|
import { check as checkRequiredChecks } from "../platform/verification-required.js";
|
|
10
10
|
import { inspectPlatformPullRequest } from "../platform/pull-requests.js";
|
|
11
|
+
import { resolveMaterializedReviewedHeadRelation } from "../platform/change-request-git-evidence.js";
|
|
11
12
|
import { resolveReviewedHeadRelation } from "../platform/merged-pr-equivalence.js";
|
|
13
|
+
import { resolveLocalReviewedCommitRelation } from "../git/reviewed-commit-equivalence.js";
|
|
12
14
|
import { parseTypedTaskFrontmatter } from "./frontmatter.js";
|
|
13
|
-
import { parseLedger } from "./ledger.js";
|
|
15
|
+
import { parseLedger, summarizeLedgerStage, validateLedgerRows } from "./ledger.js";
|
|
16
|
+
import { equalCounts, parseReviewSummary } from "./review-artifacts.js";
|
|
14
17
|
import { loadVerificationConfig } from "./verification-config.js";
|
|
15
18
|
import { snapshotReview } from "../git/review-snapshot.js";
|
|
16
19
|
const TASK_ENUMS = {
|
|
@@ -93,10 +96,18 @@ function runCheck(type, context, shared) {
|
|
|
93
96
|
return checkCompletionChecklist(context);
|
|
94
97
|
case "review-ledger":
|
|
95
98
|
return checkReviewLedger(context);
|
|
99
|
+
case "manual-validation":
|
|
100
|
+
return checkManualValidation(context);
|
|
101
|
+
case "review-summary":
|
|
102
|
+
return checkReviewSummary(context);
|
|
96
103
|
case "review-fact":
|
|
97
104
|
return checkReviewFact(context);
|
|
98
105
|
case "post-review-commit":
|
|
99
106
|
return checkPostReviewCommit(context);
|
|
107
|
+
case "orchestration-state":
|
|
108
|
+
return checkOrchestrationState(context);
|
|
109
|
+
case "orchestration-evidence":
|
|
110
|
+
return checkOrchestrationEvidence(context);
|
|
100
111
|
default: {
|
|
101
112
|
const adapter = PLATFORM_ADAPTERS[type];
|
|
102
113
|
if (!adapter) {
|
|
@@ -109,6 +120,191 @@ function runCheck(type, context, shared) {
|
|
|
109
120
|
}
|
|
110
121
|
}
|
|
111
122
|
}
|
|
123
|
+
function isFailClosedLegacyPause(run) {
|
|
124
|
+
if (run.schemaVersion !== 1
|
|
125
|
+
|| run.status !== 'paused'
|
|
126
|
+
|| run.pause?.recoverable !== false
|
|
127
|
+
|| !exactText(run.pause?.message)
|
|
128
|
+
|| !Array.isArray(run.receipts)) {
|
|
129
|
+
return false;
|
|
130
|
+
}
|
|
131
|
+
if (run.pause.code === 'ORCHESTRATION_HISTORICAL_EFFORT_UNVERIFIED') {
|
|
132
|
+
return run.receipts.length > 0 && run.pendingDelegation === null;
|
|
133
|
+
}
|
|
134
|
+
if (run.pause.code === 'ORCHESTRATION_DELEGATION_BUSY') {
|
|
135
|
+
return run.pendingDelegation != null && run.pendingDelegation.status !== 'sealed';
|
|
136
|
+
}
|
|
137
|
+
return false;
|
|
138
|
+
}
|
|
139
|
+
function checkOrchestrationState({ taskDir }) {
|
|
140
|
+
const file = path.join(taskDir, 'orchestration.json');
|
|
141
|
+
const stat = safeStat(file);
|
|
142
|
+
if (!stat?.isFile())
|
|
143
|
+
return failResult('orchestration-state', 'orchestration.json is missing');
|
|
144
|
+
let run;
|
|
145
|
+
try {
|
|
146
|
+
run = JSON.parse(fs.readFileSync(file, 'utf8'));
|
|
147
|
+
}
|
|
148
|
+
catch (error) {
|
|
149
|
+
return failResult('orchestration-state', `Invalid orchestration.json: ${String(error)}`);
|
|
150
|
+
}
|
|
151
|
+
if (isFailClosedLegacyPause(run)) {
|
|
152
|
+
return passResult('orchestration-state', 'Legacy orchestration run is safely paused');
|
|
153
|
+
}
|
|
154
|
+
if (run.schemaVersion !== 2 || !['paused', 'completed'].includes(run.status)) {
|
|
155
|
+
return failResult('orchestration-state', `Expected paused or completed run, received '${run.status}'`);
|
|
156
|
+
}
|
|
157
|
+
if (run.status === 'paused' && (!run.pause?.code || !run.pause?.message)) {
|
|
158
|
+
return failResult('orchestration-state', 'Paused run requires a stable pause code and message');
|
|
159
|
+
}
|
|
160
|
+
if (run.status === 'completed') {
|
|
161
|
+
if (run.completionEvidence != null) {
|
|
162
|
+
const evidenceError = validateCleanCompletionEvidence(run);
|
|
163
|
+
if (evidenceError)
|
|
164
|
+
return failResult('orchestration-state', evidenceError);
|
|
165
|
+
}
|
|
166
|
+
else if (run.pendingDelegation !== null || !run.commitAuthorization?.consumedAt) {
|
|
167
|
+
return failResult('orchestration-state', 'Completed run must consume commit authorization and clear pending delegation');
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
else if (run.completionEvidence != null) {
|
|
171
|
+
return failResult('orchestration-state', 'Clean completion evidence requires a completed run');
|
|
172
|
+
}
|
|
173
|
+
else if (run.pendingDelegation?.status === 'sealed') {
|
|
174
|
+
return failResult('orchestration-state', 'Paused run has a sealed delegation that could still advance');
|
|
175
|
+
}
|
|
176
|
+
return passResult('orchestration-state', `Orchestration run is safely ${run.status}`);
|
|
177
|
+
}
|
|
178
|
+
function exactText(value) {
|
|
179
|
+
return typeof value === 'string' && value.length > 0 && value.trim() === value;
|
|
180
|
+
}
|
|
181
|
+
function validateCleanCompletionEvidence(run) {
|
|
182
|
+
const evidence = run.completionEvidence;
|
|
183
|
+
const shaPattern = /^[0-9a-f]{40}$/i;
|
|
184
|
+
if (evidence?.kind !== 'reviewed-head-clean'
|
|
185
|
+
|| !exactText(evidence.observedAt)
|
|
186
|
+
|| Number.isNaN(Date.parse(evidence.observedAt))
|
|
187
|
+
|| !shaPattern.test(evidence.head)
|
|
188
|
+
|| !shaPattern.test(evidence.headTree)
|
|
189
|
+
|| !shaPattern.test(evidence.worktreeTree)
|
|
190
|
+
|| !shaPattern.test(evidence.lastReviewedCommit)
|
|
191
|
+
|| !Number.isInteger(evidence.prNumber)
|
|
192
|
+
|| evidence.prNumber <= 0
|
|
193
|
+
|| !shaPattern.test(evidence.prHead)) {
|
|
194
|
+
return 'Clean completion evidence has an invalid structure';
|
|
195
|
+
}
|
|
196
|
+
if (evidence.head !== evidence.lastReviewedCommit
|
|
197
|
+
|| evidence.head !== evidence.prHead
|
|
198
|
+
|| evidence.headTree !== evidence.worktreeTree) {
|
|
199
|
+
return 'Clean completion evidence does not bind matching commit and tree identities';
|
|
200
|
+
}
|
|
201
|
+
if (run.status !== 'completed'
|
|
202
|
+
|| run.pendingDelegation !== null
|
|
203
|
+
|| run.commitAuthorization?.issuedAt !== null
|
|
204
|
+
|| run.commitAuthorization?.consumedAt !== null
|
|
205
|
+
|| !Array.isArray(run.receipts)
|
|
206
|
+
|| run.receipts.some((receipt) => receipt.stage === 'commit')) {
|
|
207
|
+
return 'Clean completion evidence conflicts with commit delegation state';
|
|
208
|
+
}
|
|
209
|
+
return null;
|
|
210
|
+
}
|
|
211
|
+
function checkOrchestrationEvidence({ taskDir }) {
|
|
212
|
+
const file = path.join(taskDir, 'orchestration.json');
|
|
213
|
+
const stat = safeStat(file);
|
|
214
|
+
if (!stat?.isFile())
|
|
215
|
+
return failResult('orchestration-evidence', 'orchestration.json is missing');
|
|
216
|
+
let run;
|
|
217
|
+
try {
|
|
218
|
+
run = JSON.parse(fs.readFileSync(file, 'utf8'));
|
|
219
|
+
}
|
|
220
|
+
catch (error) {
|
|
221
|
+
return failResult('orchestration-evidence', `Invalid orchestration.json: ${String(error)}`);
|
|
222
|
+
}
|
|
223
|
+
if (isFailClosedLegacyPause(run)) {
|
|
224
|
+
return passResult('orchestration-evidence', 'Legacy orchestration evidence is preserved in a fail-closed pause');
|
|
225
|
+
}
|
|
226
|
+
const policy = run.modelPolicy;
|
|
227
|
+
if (!policy
|
|
228
|
+
|| !exactText(policy.executor?.model)
|
|
229
|
+
|| !exactText(policy.executor?.reasoningEffort)
|
|
230
|
+
|| !exactText(policy.reviewer?.model)
|
|
231
|
+
|| !exactText(policy.reviewer?.reasoningEffort)) {
|
|
232
|
+
return failResult('orchestration-evidence', 'Run model policy requires exact executor and reviewer model and effort');
|
|
233
|
+
}
|
|
234
|
+
if (!run.modelPolicySource
|
|
235
|
+
|| !['explicit', 'project-config'].includes(run.modelPolicySource.kind)
|
|
236
|
+
|| !exactText(run.modelPolicySource.client)
|
|
237
|
+
|| !exactText(run.modelPolicySource.resolvedAt)
|
|
238
|
+
|| !Array.isArray(run.recoveryHistory)) {
|
|
239
|
+
return failResult('orchestration-evidence', 'Run model policy source or recovery history is invalid');
|
|
240
|
+
}
|
|
241
|
+
for (const recovery of run.recoveryHistory) {
|
|
242
|
+
if (recovery.code !== 'MODEL_POLICY_SUPPLEMENTED'
|
|
243
|
+
|| recovery.previousSchemaVersion !== 1
|
|
244
|
+
|| recovery.receiptCount !== 0
|
|
245
|
+
|| recovery.pendingDelegation !== false
|
|
246
|
+
|| !exactText(recovery.recoveredAt)
|
|
247
|
+
|| !recovery.policySource) {
|
|
248
|
+
return failResult('orchestration-evidence', 'Run recovery history contains invalid provenance');
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
if (!Array.isArray(run.receipts)) {
|
|
252
|
+
return failResult('orchestration-evidence', 'Run receipts must be an array');
|
|
253
|
+
}
|
|
254
|
+
if (run.completionEvidence != null) {
|
|
255
|
+
const evidenceError = validateCleanCompletionEvidence(run);
|
|
256
|
+
if (evidenceError)
|
|
257
|
+
return failResult('orchestration-evidence', evidenceError);
|
|
258
|
+
}
|
|
259
|
+
else if (run.status === 'completed' && (run.receipts.length === 0
|
|
260
|
+
|| run.receipts.at(-1)?.stage !== 'commit'
|
|
261
|
+
|| run.receipts.at(-1)?.status !== 'consumed')) {
|
|
262
|
+
return failResult('orchestration-evidence', 'Completed run requires a final consumed commit receipt');
|
|
263
|
+
}
|
|
264
|
+
if (run.pendingDelegation && !['prepared', 'activated', 'stage-completed'].includes(run.pendingDelegation.status)) {
|
|
265
|
+
return failResult('orchestration-evidence', `Pending receipt has unsafe status '${run.pendingDelegation.status}'`);
|
|
266
|
+
}
|
|
267
|
+
const receipts = [...run.receipts, ...(run.pendingDelegation ? [run.pendingDelegation] : [])];
|
|
268
|
+
for (const receipt of receipts) {
|
|
269
|
+
const expectedPolicy = policy[receipt.role];
|
|
270
|
+
if (!expectedPolicy || receipt.requestedModel !== expectedPolicy.model) {
|
|
271
|
+
return failResult('orchestration-evidence', `Receipt '${receipt.id ?? '(unknown)'}' requested model does not match its role policy`);
|
|
272
|
+
}
|
|
273
|
+
if (receipt.requestedReasoningEffort !== expectedPolicy.reasoningEffort) {
|
|
274
|
+
return failResult('orchestration-evidence', `Receipt '${receipt.id ?? '(unknown)'}' requested reasoning effort does not match its role policy`);
|
|
275
|
+
}
|
|
276
|
+
const activated = ['activated', 'stage-completed', 'sealed', 'consumed'].includes(receipt.status);
|
|
277
|
+
if (activated) {
|
|
278
|
+
if (!exactText(receipt.actualModel)) {
|
|
279
|
+
return failResult('orchestration-evidence', `Receipt '${receipt.id ?? '(unknown)'}' has no host-observed actual model`);
|
|
280
|
+
}
|
|
281
|
+
if (!exactText(receipt.actualReasoningEffort)) {
|
|
282
|
+
return failResult('orchestration-evidence', `Receipt '${receipt.id ?? '(unknown)'}' has no host-observed actual reasoning effort`);
|
|
283
|
+
}
|
|
284
|
+
if (!exactText(receipt.parentId) || !exactText(receipt.childId) || receipt.parentId === receipt.childId || receipt.spawnMode !== 'fresh') {
|
|
285
|
+
return failResult('orchestration-evidence', `Receipt '${receipt.id ?? '(unknown)'}' has invalid fresh delegation identity`);
|
|
286
|
+
}
|
|
287
|
+
if (receipt.actualModel !== receipt.requestedModel && !exactText(receipt.modelFallbackReason)) {
|
|
288
|
+
return failResult('orchestration-evidence', `Receipt '${receipt.id ?? '(unknown)'}' model fallback is not justified`);
|
|
289
|
+
}
|
|
290
|
+
if (receipt.actualModel === receipt.requestedModel && receipt.modelFallbackReason !== null) {
|
|
291
|
+
return failResult('orchestration-evidence', `Receipt '${receipt.id ?? '(unknown)'}' has an unrelated model fallback reason`);
|
|
292
|
+
}
|
|
293
|
+
if (receipt.actualReasoningEffort !== receipt.requestedReasoningEffort
|
|
294
|
+
&& !exactText(receipt.reasoningEffortFallbackReason)) {
|
|
295
|
+
return failResult('orchestration-evidence', `Receipt '${receipt.id ?? '(unknown)'}' reasoning-effort fallback is not justified`);
|
|
296
|
+
}
|
|
297
|
+
if (receipt.actualReasoningEffort === receipt.requestedReasoningEffort
|
|
298
|
+
&& receipt.reasoningEffortFallbackReason !== null) {
|
|
299
|
+
return failResult('orchestration-evidence', `Receipt '${receipt.id ?? '(unknown)'}' has an unrelated reasoning-effort fallback reason`);
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
if (run.receipts.some((receipt) => receipt.status !== 'consumed')) {
|
|
304
|
+
return failResult('orchestration-evidence', 'Historical receipts must be consumed');
|
|
305
|
+
}
|
|
306
|
+
return passResult('orchestration-evidence', 'Persisted orchestration model and delegation evidence is internally consistent');
|
|
307
|
+
}
|
|
112
308
|
// === Check Functions ===
|
|
113
309
|
function checkTaskMeta({ taskDir, config }) {
|
|
114
310
|
const task = loadTask(taskDir);
|
|
@@ -239,6 +435,40 @@ function checkArtifact({ taskDir, config, artifactFile }) {
|
|
|
239
435
|
}
|
|
240
436
|
return passResult("artifact", `${path.basename(artifactPath)} passed (${requiredSections.length} sections)`);
|
|
241
437
|
}
|
|
438
|
+
function checkReviewSummary({ taskDir, config, artifactFile }) {
|
|
439
|
+
const stage = String(config.stage || "");
|
|
440
|
+
if (!["analysis", "plan", "code"].includes(stage)) {
|
|
441
|
+
return failResult("review-summary", `Invalid review stage '${stage}'`);
|
|
442
|
+
}
|
|
443
|
+
const resolvedArtifact = resolveArtifactPath(taskDir, "", artifactFile);
|
|
444
|
+
if (!resolvedArtifact.ok || !safeStat(resolvedArtifact.path)?.isFile()) {
|
|
445
|
+
return failResult("review-summary", resolvedArtifact.message || "Review artifact is missing");
|
|
446
|
+
}
|
|
447
|
+
const parsed = parseReviewSummary(fs.readFileSync(resolvedArtifact.path, "utf8"));
|
|
448
|
+
if (!parsed.ok)
|
|
449
|
+
return failResult("review-summary", `${parsed.code}: ${parsed.message}`);
|
|
450
|
+
if (!parsed.summary.counts) {
|
|
451
|
+
return failResult("review-summary", "Review summary finding counts are not finalized");
|
|
452
|
+
}
|
|
453
|
+
const task = loadTask(taskDir);
|
|
454
|
+
if (!task.ok)
|
|
455
|
+
return failResult("review-summary", task.message);
|
|
456
|
+
let rows;
|
|
457
|
+
try {
|
|
458
|
+
rows = parseLedger(task.content);
|
|
459
|
+
}
|
|
460
|
+
catch (error) {
|
|
461
|
+
return failResult("review-summary", `Invalid disagreement ledger: ${String(error)}`);
|
|
462
|
+
}
|
|
463
|
+
const invalid = validateLedgerRows(rows);
|
|
464
|
+
if (invalid)
|
|
465
|
+
return failResult("review-summary", `${invalid.code}: ${invalid.message}`);
|
|
466
|
+
const expected = summarizeLedgerStage(rows, stage).unresolvedFindingCounts;
|
|
467
|
+
if (!equalCounts(parsed.summary.counts, expected)) {
|
|
468
|
+
return failResult("review-summary", `Review summary counts ${JSON.stringify(parsed.summary.counts)} do not match ledger ${JSON.stringify(expected)}`);
|
|
469
|
+
}
|
|
470
|
+
return passResult("review-summary", `${path.basename(resolvedArtifact.path)} finding counts match the ${stage} ledger`);
|
|
471
|
+
}
|
|
242
472
|
function checkImplementationInput({ taskDir, artifactFile }) {
|
|
243
473
|
const task = loadTask(taskDir);
|
|
244
474
|
if (!task.ok)
|
|
@@ -555,6 +785,61 @@ function checkReviewLedger({ taskDir, config }) {
|
|
|
555
785
|
const scopeLabel = stageScope ? ` for stages [${stageScope.join(", ")}]` : "";
|
|
556
786
|
return passResult("review-ledger", `Disagreement ledger clean (${inScopeCount} in-scope entries terminal${scopeLabel})`);
|
|
557
787
|
}
|
|
788
|
+
function checkManualValidation({ taskDir }) {
|
|
789
|
+
// 1. Latest review-code artifact; none -> pass (no review, check not applicable).
|
|
790
|
+
const review = findAuthoritativeReviewCodeArtifact(taskDir);
|
|
791
|
+
if (!review.ok) {
|
|
792
|
+
return passResult("manual-validation", "No review-code artifact; manual validation not applicable");
|
|
793
|
+
}
|
|
794
|
+
// 2. Parse the numeric manual-validation count; unparseable/null -> fail closed
|
|
795
|
+
// (review-code.completed already enforces a numeric count on the normal path).
|
|
796
|
+
const parsed = parseReviewSummary(fs.readFileSync(review.path, "utf8"));
|
|
797
|
+
if (!parsed.ok || parsed.summary.manualValidation === null) {
|
|
798
|
+
return failResult("manual-validation", "Latest review-code has no numeric manual-validation count");
|
|
799
|
+
}
|
|
800
|
+
// 3. Count 0 -> pass (no pending items to cover).
|
|
801
|
+
if (parsed.summary.manualValidation === 0) {
|
|
802
|
+
return passResult("manual-validation", "No pending manual validation items");
|
|
803
|
+
}
|
|
804
|
+
// 4. Highest-round manual-validation artifact; none -> fail (items pending,
|
|
805
|
+
// run complete-manual-validation first). A falsy artifactFile goes through
|
|
806
|
+
// pattern parsing; resolveArtifactPath only returns { ok, path }.
|
|
807
|
+
const resolved = resolveArtifactPath(taskDir, "manual-validation.md|manual-validation-r{N}.md", "");
|
|
808
|
+
if (!resolved.ok) {
|
|
809
|
+
return failResult("manual-validation", `${parsed.summary.manualValidation} manual validation item(s) pending: run /complete-manual-validation`);
|
|
810
|
+
}
|
|
811
|
+
// 5. The Activity Log must record the matching completion entry; the file name
|
|
812
|
+
// is derived with path.basename (resolveArtifactPath does not return fileName).
|
|
813
|
+
const artifactName = path.basename(resolved.path);
|
|
814
|
+
const task = loadTask(taskDir);
|
|
815
|
+
if (!task.ok)
|
|
816
|
+
return failResult("manual-validation", task.message);
|
|
817
|
+
const log = getSectionContent(task.content, ["活动日志", "Activity Log"]);
|
|
818
|
+
const completed = new RegExp(`\\*\\*Complete Manual Validation\\*\\*[\\s\\S]*?Manual validation passed → ${escapeRegExp(artifactName)};`);
|
|
819
|
+
if (!completed.test(log)) {
|
|
820
|
+
return failResult("manual-validation", `Manual validation artifact exists but completion is not recorded for ${artifactName}: re-run /complete-manual-validation`);
|
|
821
|
+
}
|
|
822
|
+
// 6. Timing correlation (PL-3 fix, PL-4 corrected): the completion entry must
|
|
823
|
+
// sit AFTER the latest review-code round's completion entry in the
|
|
824
|
+
// append-only Activity Log. indexOf is a literal search, so the artifactName
|
|
825
|
+
// must NOT be passed through escapeRegExp here (that escapes '.' to '\.',
|
|
826
|
+
// which indexOf never matches). Not reusing completed.exec().index: exec
|
|
827
|
+
// anchors to the first '**Complete Manual Validation**' heading, which can
|
|
828
|
+
// belong to an earlier round's entry and misorder the standard path.
|
|
829
|
+
const reviewDoneIndex = log.indexOf(`**Review Code (Round ${review.round})** by `);
|
|
830
|
+
const completedIndex = log.indexOf(`Manual validation passed → ${artifactName};`);
|
|
831
|
+
if (reviewDoneIndex === -1) {
|
|
832
|
+
// The latest review-code round's completion entry is missing entirely (abnormal
|
|
833
|
+
// state, e.g. a restored/historical task without a review-code.completed record).
|
|
834
|
+
// Re-running complete-manual-validation cannot restore it, so the remediation
|
|
835
|
+
// targets the review record itself. Fail closed either way.
|
|
836
|
+
return failResult("manual-validation", `Latest review-code (round ${review.round}) completion entry is missing from the Activity Log (abnormal state): re-run review-code or restore the completion record`);
|
|
837
|
+
}
|
|
838
|
+
if (completedIndex < reviewDoneIndex) {
|
|
839
|
+
return failResult("manual-validation", `Latest review-code (round ${review.round}) came after the manual validation completion recorded for ${artifactName}: re-run /complete-manual-validation to cover new pending items`);
|
|
840
|
+
}
|
|
841
|
+
return passResult("manual-validation", `Manual validation completed → ${artifactName}`);
|
|
842
|
+
}
|
|
558
843
|
function checkPostReviewCommit({ taskDir, config }) {
|
|
559
844
|
const reviewArtifact = findAuthoritativeReviewCodeArtifact(taskDir);
|
|
560
845
|
if (!reviewArtifact.ok) {
|
|
@@ -568,8 +853,42 @@ function checkPostReviewCommit({ taskDir, config }) {
|
|
|
568
853
|
return blockedResult("post-review-commit", "git unavailable or task directory is not inside a git repository");
|
|
569
854
|
}
|
|
570
855
|
const task = loadTask(taskDir);
|
|
571
|
-
|
|
856
|
+
if (!task.ok)
|
|
857
|
+
return failResult("post-review-commit", task.message);
|
|
572
858
|
const lastReviewedCommit = task.ok ? (task.metadata.last_reviewed_commit || "").trim() : "";
|
|
859
|
+
const globs = resolvePostReviewGlobs(config, loadPostReviewConfig(repoRoot));
|
|
860
|
+
const hasPullRequest = Number(task.metadata.pr_number) > 0;
|
|
861
|
+
let inspected = null;
|
|
862
|
+
if (hasPullRequest) {
|
|
863
|
+
inspected = inspectPlatformPullRequest(task.metadata.id, { cwd: gitRoot });
|
|
864
|
+
if (!inspected.pullRequest) {
|
|
865
|
+
const message = inspected.error?.message || "PR merge snapshot is unavailable";
|
|
866
|
+
const code = inspected.error?.code || "PR_INSPECTION_INVALID";
|
|
867
|
+
return inspected.status === "blocked"
|
|
868
|
+
? blockedResult("post-review-commit", message, code)
|
|
869
|
+
: failResult("post-review-commit", message, code);
|
|
870
|
+
}
|
|
871
|
+
if (inspected.pullRequest.state === "closed" &&
|
|
872
|
+
inspected.pullRequest.mergedAt &&
|
|
873
|
+
inspected.pullRequest.mergeCommitSha) {
|
|
874
|
+
const relation = resolveMaterializedReviewedHeadRelation({
|
|
875
|
+
cwd: gitRoot,
|
|
876
|
+
platformType: inspected.platform.type,
|
|
877
|
+
lastReviewedCommit,
|
|
878
|
+
pullRequest: inspected.pullRequest
|
|
879
|
+
});
|
|
880
|
+
if (relation.status === "merged-equivalent") {
|
|
881
|
+
return passResult("post-review-commit", `Reviewed PR head is content-equivalent to squash merge ${relation.mergeCommit.slice(0, 8)} on target ${relation.comparisonHead.slice(0, 8)}`);
|
|
882
|
+
}
|
|
883
|
+
if (relation.status === "blocked") {
|
|
884
|
+
return blockedResult("post-review-commit", relation.message, relation.code);
|
|
885
|
+
}
|
|
886
|
+
if (relation.status === "strict") {
|
|
887
|
+
return failResult("post-review-commit", "Merged PR evidence did not establish squash merge equivalence", "PR_MERGE_IDENTITY_INVALID");
|
|
888
|
+
}
|
|
889
|
+
return failResult("post-review-commit", relation.message, relation.code);
|
|
890
|
+
}
|
|
891
|
+
}
|
|
573
892
|
const baselineSource = resolvePostReviewBaseline({
|
|
574
893
|
gitRoot,
|
|
575
894
|
lastReviewedCommit,
|
|
@@ -579,7 +898,6 @@ function checkPostReviewCommit({ taskDir, config }) {
|
|
|
579
898
|
return baselineSource.result;
|
|
580
899
|
}
|
|
581
900
|
const sha = baselineSource.sha;
|
|
582
|
-
const globs = resolvePostReviewGlobs(config, loadPostReviewConfig(repoRoot));
|
|
583
901
|
let commits;
|
|
584
902
|
try {
|
|
585
903
|
const out = execFileSync("git", ["-C", gitRoot, "rev-list", `${sha}..HEAD`, "--", ...globs], { encoding: "utf8" });
|
|
@@ -591,45 +909,62 @@ function checkPostReviewCommit({ taskDir, config }) {
|
|
|
591
909
|
if (commits.length === 0) {
|
|
592
910
|
return passResult("post-review-commit", `No post-review commits to code/rule paths since ${sha.slice(0, 8)}`);
|
|
593
911
|
}
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
}
|
|
912
|
+
let localHead = "";
|
|
913
|
+
try {
|
|
914
|
+
localHead = execFileSync("git", ["-C", gitRoot, "rev-parse", "HEAD"], { encoding: "utf8" }).trim();
|
|
915
|
+
}
|
|
916
|
+
catch {
|
|
917
|
+
return blockedResult("post-review-commit", "Unable to resolve the local HEAD");
|
|
918
|
+
}
|
|
919
|
+
if (hasPullRequest) {
|
|
920
|
+
if (inspected?.pullRequest) {
|
|
604
921
|
const relation = resolveReviewedHeadRelation({
|
|
605
922
|
gitRoot,
|
|
606
|
-
localHead,
|
|
923
|
+
comparisonHead: localHead,
|
|
607
924
|
lastReviewedCommit: sha,
|
|
608
|
-
pullRequest: inspected.pullRequest
|
|
609
|
-
pathspecs: globs
|
|
925
|
+
pullRequest: inspected.pullRequest
|
|
610
926
|
});
|
|
611
927
|
if (relation.status === "merged-equivalent") {
|
|
612
928
|
return passResult("post-review-commit", `Reviewed PR head is content-equivalent to squash merge ${relation.mergeCommit.slice(0, 8)}`);
|
|
613
929
|
}
|
|
614
930
|
if (relation.status === "blocked") {
|
|
615
|
-
return blockedResult("post-review-commit", relation.message);
|
|
931
|
+
return blockedResult("post-review-commit", relation.message, relation.code);
|
|
616
932
|
}
|
|
617
933
|
}
|
|
618
|
-
|
|
619
|
-
|
|
934
|
+
}
|
|
935
|
+
else if (commits.length === 1) {
|
|
936
|
+
const relation = resolveLocalReviewedCommitRelation({
|
|
937
|
+
gitRoot,
|
|
938
|
+
localHead,
|
|
939
|
+
lastReviewedCommit: sha,
|
|
940
|
+
rewrittenCommit: commits[0],
|
|
941
|
+
pathspecs: globs
|
|
942
|
+
});
|
|
943
|
+
if (relation.status === "local-equivalent") {
|
|
944
|
+
return passResult("post-review-commit", `Reviewed commit is content-equivalent to local rewrite ${relation.rewrittenCommit.slice(0, 8)}`);
|
|
945
|
+
}
|
|
946
|
+
if (relation.status === "blocked") {
|
|
947
|
+
return blockedResult("post-review-commit", relation.message);
|
|
620
948
|
}
|
|
621
949
|
}
|
|
622
|
-
|
|
950
|
+
const exemption = resolvePostReviewExemption(task.content);
|
|
951
|
+
if (!exemption.ok)
|
|
952
|
+
return failResult("post-review-commit", exemption.message);
|
|
953
|
+
if (exemption.exempt) {
|
|
954
|
+
return passResult("post-review-commit", `${commits.length} post-review commit(s) covered by a human-decided exemption`);
|
|
955
|
+
}
|
|
956
|
+
return failResult("post-review-commit", `${commits.length} commit(s) to code/rule paths after reviewed commit ${sha.slice(0, 8)}; re-run review-code or record a human-decided exemption`);
|
|
957
|
+
}
|
|
958
|
+
function resolvePostReviewExemption(content) {
|
|
623
959
|
try {
|
|
624
|
-
|
|
960
|
+
return {
|
|
961
|
+
ok: true,
|
|
962
|
+
exempt: parseLedger(content).some((row) => row.stage === POST_REVIEW_COMMIT_STAGE && row.status === "human-decided")
|
|
963
|
+
};
|
|
625
964
|
}
|
|
626
965
|
catch {
|
|
627
|
-
return
|
|
966
|
+
return { ok: false, message: "Invalid disagreement ledger" };
|
|
628
967
|
}
|
|
629
|
-
if (exempt) {
|
|
630
|
-
return passResult("post-review-commit", `${commits.length} post-review commit(s) covered by a human-decided exemption`);
|
|
631
|
-
}
|
|
632
|
-
return failResult("post-review-commit", `${commits.length} commit(s) to code/rule paths after reviewed commit ${sha.slice(0, 8)}; re-run review-code or record a human-decided exemption`);
|
|
633
968
|
}
|
|
634
969
|
function checkReviewFact({ taskDir, artifactFile }) {
|
|
635
970
|
const resolvedArtifact = resolveArtifactPath(taskDir, "review-code.md|review-code-r{N}.md", artifactFile);
|
|
@@ -643,6 +978,7 @@ function checkReviewFact({ taskDir, artifactFile }) {
|
|
|
643
978
|
const content = fs.readFileSync(resolvedArtifact.path, "utf8");
|
|
644
979
|
const verdict = parseReviewVerdict(content);
|
|
645
980
|
const reviewBaseline = extractReviewBaseline(content);
|
|
981
|
+
const reviewDiffBase = extractReviewDiffBase(content);
|
|
646
982
|
const reviewedFingerprint = extractReviewDiffFingerprint(content);
|
|
647
983
|
const reviewedTree = extractReviewedSnapshotTree(content);
|
|
648
984
|
if (!["通过", "需要修改", "拒绝", "Approved", "Changes Requested", "Rejected"].includes(verdict)) {
|
|
@@ -651,10 +987,12 @@ function checkReviewFact({ taskDir, artifactFile }) {
|
|
|
651
987
|
let gitRoot;
|
|
652
988
|
let head;
|
|
653
989
|
let baseline;
|
|
990
|
+
let diffBase;
|
|
654
991
|
try {
|
|
655
992
|
gitRoot = execFileSync("git", ["-C", taskDir, "rev-parse", "--show-toplevel"], { encoding: "utf8" }).trim();
|
|
656
993
|
head = execFileSync("git", ["-C", gitRoot, "rev-parse", "HEAD"], { encoding: "utf8" }).trim();
|
|
657
994
|
baseline = execFileSync("git", ["-C", gitRoot, "rev-parse", `${reviewBaseline}^{commit}`], { encoding: "utf8" }).trim();
|
|
995
|
+
diffBase = execFileSync("git", ["-C", gitRoot, "rev-parse", `${reviewDiffBase || reviewBaseline}^{commit}`], { encoding: "utf8" }).trim();
|
|
658
996
|
}
|
|
659
997
|
catch {
|
|
660
998
|
return blockedResult("review-fact", `Unable to resolve review baseline '${reviewBaseline}' in the task repository; re-run review-code`);
|
|
@@ -664,7 +1002,13 @@ function checkReviewFact({ taskDir, artifactFile }) {
|
|
|
664
1002
|
}
|
|
665
1003
|
let actualSnapshot;
|
|
666
1004
|
try {
|
|
667
|
-
actualSnapshot = snapshotReview({
|
|
1005
|
+
actualSnapshot = snapshotReview({
|
|
1006
|
+
cwd: gitRoot,
|
|
1007
|
+
mode: "worktree",
|
|
1008
|
+
baseline,
|
|
1009
|
+
diffBase,
|
|
1010
|
+
globs: resolvePostReviewGlobs({}, loadPostReviewConfig(repoRoot))
|
|
1011
|
+
});
|
|
668
1012
|
}
|
|
669
1013
|
catch {
|
|
670
1014
|
return blockedResult("review-fact", `Unable to recompute reviewed diff fingerprint from baseline ${baseline.slice(0, 8)}; re-run review-code`);
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { extractReviewBaseline, extractReviewDiffFingerprint, extractReviewedSnapshotTree, findAuthoritativeReviewCodeArtifact, loadPostReviewConfig, parseReviewVerdict, resolvePostReviewGlobs } from './review-fingerprint.js';
|
|
1
|
+
export { extractReviewBaseline, extractReviewDiffBase, extractReviewDiffFingerprint, extractReviewedSnapshotTree, findAuthoritativeReviewCodeArtifact, loadPostReviewConfig, parseReviewVerdict, resolvePostReviewGlobs } from './review-fingerprint.js';
|
|
2
2
|
export { parseLedger, summarizeLedgerStage, validateLedgerRows } from './ledger.js';
|
|
3
3
|
//# sourceMappingURL=verification-review.js.map
|
|
@@ -19,14 +19,17 @@ const VERIFICATION_CATALOG = {
|
|
|
19
19
|
'block-task.completed': gate('block-task', 'blocked'),
|
|
20
20
|
'cancel-task.completed': gate('cancel-task', 'completed'),
|
|
21
21
|
'commit.completed': gate('commit', 'active'),
|
|
22
|
-
'complete-task.preflight': { skill: 'complete-task', expectedState: 'active', mode: 'checks', checks: ['review-ledger', 'post-review-commit', 'platform-sync-preflight'] },
|
|
22
|
+
'complete-task.preflight': { skill: 'complete-task', expectedState: 'active', mode: 'checks', checks: ['review-ledger', 'manual-validation', 'post-review-commit', 'platform-sync-preflight'] },
|
|
23
23
|
'complete-task.completed': gate('complete-task', 'completed'),
|
|
24
24
|
'create-pr.completed': gate('create-pr', 'active'),
|
|
25
25
|
'create-task.completed': gate('create-task', 'active'),
|
|
26
26
|
'import-codescan.completed': gate('import-codescan', 'active'),
|
|
27
27
|
'import-dependabot.completed': gate('import-dependabot', 'active'),
|
|
28
28
|
'import-issue.completed': gate('import-issue', 'active'),
|
|
29
|
-
'watch-pr.completed': gate('watch-pr', 'active')
|
|
29
|
+
'watch-pr.completed': gate('watch-pr', 'active'),
|
|
30
|
+
'review-pr.completed': gate('review-pr', 'active', 'pr-review'),
|
|
31
|
+
'run-task.paused': { skill: 'run-task', expectedState: 'active', mode: 'checks', checks: ['orchestration-state', 'orchestration-evidence'] },
|
|
32
|
+
'run-task.completed': { skill: 'run-task', expectedState: 'active', mode: 'checks', checks: ['orchestration-state', 'orchestration-evidence'] }
|
|
30
33
|
};
|
|
31
34
|
function failure(request, code, message, extra = {}) {
|
|
32
35
|
return {
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import os from 'node:os';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { spawnSync } from 'node:child_process';
|
|
5
|
+
function git(repoRoot, indexFile, args) {
|
|
6
|
+
const env = indexFile ? { ...process.env, GIT_INDEX_FILE: indexFile } : process.env;
|
|
7
|
+
const result = spawnSync('git', args, { cwd: repoRoot, env, encoding: 'utf8' });
|
|
8
|
+
if (result.status !== 0) {
|
|
9
|
+
throw new Error(String(result.stderr || result.stdout || `git ${args[0]} failed`).trim());
|
|
10
|
+
}
|
|
11
|
+
return result.stdout;
|
|
12
|
+
}
|
|
13
|
+
function captureWorktreeTree(repoRoot, forcedPath) {
|
|
14
|
+
const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'agent-infra-orchestration-index-'));
|
|
15
|
+
const indexFile = path.join(tempDir, 'index');
|
|
16
|
+
try {
|
|
17
|
+
git(repoRoot, indexFile, ['read-tree', 'HEAD']);
|
|
18
|
+
git(repoRoot, indexFile, ['add', '-A', '--', ':/']);
|
|
19
|
+
if (forcedPath && fs.existsSync(path.join(repoRoot, forcedPath))) {
|
|
20
|
+
git(repoRoot, indexFile, ['add', '-f', '--', forcedPath]);
|
|
21
|
+
}
|
|
22
|
+
return git(repoRoot, indexFile, ['write-tree']).trim();
|
|
23
|
+
}
|
|
24
|
+
finally {
|
|
25
|
+
fs.rmSync(tempDir, { recursive: true, force: true });
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
function captureWorkspaceSnapshot(repoRoot, taskId) {
|
|
29
|
+
const workspaceRelative = taskId
|
|
30
|
+
? `.agents/workspace/active/${taskId}`
|
|
31
|
+
: '.agents/workspace/active';
|
|
32
|
+
return captureWorktreeTree(repoRoot, workspaceRelative);
|
|
33
|
+
}
|
|
34
|
+
function captureRepositorySnapshot(repoRoot) {
|
|
35
|
+
return {
|
|
36
|
+
head: git(repoRoot, null, ['rev-parse', 'HEAD']).trim(),
|
|
37
|
+
headTree: git(repoRoot, null, ['rev-parse', 'HEAD^{tree}']).trim(),
|
|
38
|
+
worktreeTree: captureWorktreeTree(repoRoot, null)
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
function diffWorkspaceSnapshots(repoRoot, before, after) {
|
|
42
|
+
const output = git(repoRoot, null, ['diff', '--name-only', '-z', before, after]);
|
|
43
|
+
return output.split('\0').filter(Boolean);
|
|
44
|
+
}
|
|
45
|
+
export { captureRepositorySnapshot, captureWorkspaceSnapshot, diffWorkspaceSnapshots };
|
|
46
|
+
//# sourceMappingURL=workspace-snapshot.js.map
|