@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
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"$id": "https://github.com/fitlab-ai/agent-infra/lib/benchmark/schemas/v1.0.0/subject.schema.json",
|
|
4
|
+
"title": "agent-infra benchmark subject",
|
|
5
|
+
"description": "The evaluated Agent configuration and its declared runtime conditions.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"additionalProperties": false,
|
|
8
|
+
"required": [
|
|
9
|
+
"contractVersion",
|
|
10
|
+
"subjectId",
|
|
11
|
+
"model",
|
|
12
|
+
"agentClient",
|
|
13
|
+
"executionMode",
|
|
14
|
+
"tools",
|
|
15
|
+
"permissions",
|
|
16
|
+
"networkPolicy"
|
|
17
|
+
],
|
|
18
|
+
"properties": {
|
|
19
|
+
"contractVersion": {
|
|
20
|
+
"$ref": "common.schema.json#/definitions/contractVersion"
|
|
21
|
+
},
|
|
22
|
+
"subjectId": {
|
|
23
|
+
"type": "string",
|
|
24
|
+
"minLength": 1
|
|
25
|
+
},
|
|
26
|
+
"model": {
|
|
27
|
+
"type": "object",
|
|
28
|
+
"additionalProperties": false,
|
|
29
|
+
"required": [
|
|
30
|
+
"provider",
|
|
31
|
+
"modelId"
|
|
32
|
+
],
|
|
33
|
+
"properties": {
|
|
34
|
+
"provider": {
|
|
35
|
+
"type": "string",
|
|
36
|
+
"minLength": 1
|
|
37
|
+
},
|
|
38
|
+
"modelId": {
|
|
39
|
+
"type": "string",
|
|
40
|
+
"minLength": 1
|
|
41
|
+
},
|
|
42
|
+
"version": {
|
|
43
|
+
"type": "string",
|
|
44
|
+
"minLength": 1
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
"agentClient": {
|
|
49
|
+
"type": "object",
|
|
50
|
+
"additionalProperties": false,
|
|
51
|
+
"required": [
|
|
52
|
+
"clientId",
|
|
53
|
+
"version"
|
|
54
|
+
],
|
|
55
|
+
"properties": {
|
|
56
|
+
"clientId": {
|
|
57
|
+
"type": "string",
|
|
58
|
+
"minLength": 1
|
|
59
|
+
},
|
|
60
|
+
"version": {
|
|
61
|
+
"type": "string",
|
|
62
|
+
"minLength": 1
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
"executionMode": {
|
|
67
|
+
"enum": [
|
|
68
|
+
"direct-repair",
|
|
69
|
+
"agent-infra-workflow",
|
|
70
|
+
"custom"
|
|
71
|
+
]
|
|
72
|
+
},
|
|
73
|
+
"workflowRef": {
|
|
74
|
+
"type": "string",
|
|
75
|
+
"minLength": 1
|
|
76
|
+
},
|
|
77
|
+
"tools": {
|
|
78
|
+
"type": "array",
|
|
79
|
+
"items": {
|
|
80
|
+
"type": "object",
|
|
81
|
+
"additionalProperties": false,
|
|
82
|
+
"required": [
|
|
83
|
+
"toolId",
|
|
84
|
+
"version"
|
|
85
|
+
],
|
|
86
|
+
"properties": {
|
|
87
|
+
"toolId": {
|
|
88
|
+
"type": "string",
|
|
89
|
+
"minLength": 1
|
|
90
|
+
},
|
|
91
|
+
"version": {
|
|
92
|
+
"type": "string",
|
|
93
|
+
"minLength": 1
|
|
94
|
+
},
|
|
95
|
+
"capabilities": {
|
|
96
|
+
"type": "array",
|
|
97
|
+
"items": {
|
|
98
|
+
"type": "string",
|
|
99
|
+
"minLength": 1
|
|
100
|
+
},
|
|
101
|
+
"uniqueItems": true
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
"permissions": {
|
|
107
|
+
"type": "object",
|
|
108
|
+
"additionalProperties": false,
|
|
109
|
+
"required": [
|
|
110
|
+
"filesystem",
|
|
111
|
+
"credentials"
|
|
112
|
+
],
|
|
113
|
+
"properties": {
|
|
114
|
+
"filesystem": {
|
|
115
|
+
"enum": [
|
|
116
|
+
"challenge-workspace-write",
|
|
117
|
+
"challenge-workspace-read-only",
|
|
118
|
+
"none"
|
|
119
|
+
]
|
|
120
|
+
},
|
|
121
|
+
"credentials": {
|
|
122
|
+
"enum": [
|
|
123
|
+
"none",
|
|
124
|
+
"scoped"
|
|
125
|
+
]
|
|
126
|
+
},
|
|
127
|
+
"commands": {
|
|
128
|
+
"type": "array",
|
|
129
|
+
"items": {
|
|
130
|
+
"type": "string",
|
|
131
|
+
"minLength": 1
|
|
132
|
+
},
|
|
133
|
+
"uniqueItems": true
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
"networkPolicy": {
|
|
138
|
+
"type": "object",
|
|
139
|
+
"additionalProperties": false,
|
|
140
|
+
"required": [
|
|
141
|
+
"mode"
|
|
142
|
+
],
|
|
143
|
+
"properties": {
|
|
144
|
+
"mode": {
|
|
145
|
+
"enum": [
|
|
146
|
+
"none",
|
|
147
|
+
"allowlist",
|
|
148
|
+
"unrestricted"
|
|
149
|
+
]
|
|
150
|
+
},
|
|
151
|
+
"allowlist": {
|
|
152
|
+
"type": "array",
|
|
153
|
+
"items": {
|
|
154
|
+
"type": "string",
|
|
155
|
+
"minLength": 1
|
|
156
|
+
},
|
|
157
|
+
"minItems": 1,
|
|
158
|
+
"uniqueItems": true
|
|
159
|
+
},
|
|
160
|
+
"enforcementEvidence": {
|
|
161
|
+
"type": "string",
|
|
162
|
+
"minLength": 1
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
"allOf": [
|
|
166
|
+
{
|
|
167
|
+
"if": {
|
|
168
|
+
"properties": {
|
|
169
|
+
"mode": {
|
|
170
|
+
"const": "allowlist"
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
"then": {
|
|
175
|
+
"required": [
|
|
176
|
+
"allowlist"
|
|
177
|
+
]
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
]
|
|
181
|
+
},
|
|
182
|
+
"budget": {
|
|
183
|
+
"type": "object",
|
|
184
|
+
"additionalProperties": false,
|
|
185
|
+
"properties": {
|
|
186
|
+
"timeLimitMs": {
|
|
187
|
+
"type": "integer",
|
|
188
|
+
"minimum": 1
|
|
189
|
+
},
|
|
190
|
+
"tokenLimit": {
|
|
191
|
+
"type": "integer",
|
|
192
|
+
"minimum": 1
|
|
193
|
+
},
|
|
194
|
+
"costLimit": {
|
|
195
|
+
"type": "number",
|
|
196
|
+
"minimum": 0
|
|
197
|
+
},
|
|
198
|
+
"costCurrency": {
|
|
199
|
+
"type": "string",
|
|
200
|
+
"minLength": 1
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
},
|
|
204
|
+
"extensions": {
|
|
205
|
+
"$ref": "common.schema.json#/definitions/extensions"
|
|
206
|
+
}
|
|
207
|
+
},
|
|
208
|
+
"allOf": [
|
|
209
|
+
{
|
|
210
|
+
"if": {
|
|
211
|
+
"properties": {
|
|
212
|
+
"executionMode": {
|
|
213
|
+
"enum": [
|
|
214
|
+
"agent-infra-workflow",
|
|
215
|
+
"custom"
|
|
216
|
+
]
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
},
|
|
220
|
+
"then": {
|
|
221
|
+
"required": [
|
|
222
|
+
"workflowRef"
|
|
223
|
+
]
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
]
|
|
227
|
+
}
|
package/lib/builtin-tuis.ts
CHANGED
|
@@ -1,22 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
type
|
|
1
|
+
import { AGENT_CLIENT_IDS, isAgentClientId } from './agent-clients/types.ts';
|
|
2
|
+
import type { AgentClientId } from './agent-clients/types.ts';
|
|
3
|
+
import { listAgentClientAdapters } from './agent-clients/registry.ts';
|
|
3
4
|
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
'codex': 'Codex',
|
|
7
|
-
'gemini-cli': 'Gemini CLI',
|
|
8
|
-
'opencode': 'OpenCode'
|
|
9
|
-
};
|
|
5
|
+
const BUILTIN_TUI_IDS = AGENT_CLIENT_IDS;
|
|
6
|
+
type BuiltinTUIId = AgentClientId;
|
|
10
7
|
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
8
|
+
const BUILTIN_TUI_DISPLAY = Object.fromEntries(
|
|
9
|
+
listAgentClientAdapters().map((adapter) => [adapter.id, adapter.displayName])
|
|
10
|
+
) as Record<BuiltinTUIId, string>;
|
|
11
|
+
|
|
12
|
+
const BUILTIN_TUI_OWNED_PATH_PREFIXES = Object.fromEntries(
|
|
13
|
+
listAgentClientAdapters().map((adapter) => [
|
|
14
|
+
adapter.id,
|
|
15
|
+
[...adapter.project.ownedPathPrefixes]
|
|
16
|
+
])
|
|
17
|
+
) as Record<BuiltinTUIId, string[]>;
|
|
17
18
|
|
|
18
19
|
function isBuiltinTUIId(value: unknown): value is BuiltinTUIId {
|
|
19
|
-
return
|
|
20
|
+
return isAgentClientId(value);
|
|
20
21
|
}
|
|
21
22
|
|
|
22
23
|
function resolveEnabledTUIs(value: unknown): Set<BuiltinTUIId> {
|
package/lib/defaults.json
CHANGED
|
@@ -2,17 +2,35 @@
|
|
|
2
2
|
"platform": {
|
|
3
3
|
"type": "github"
|
|
4
4
|
},
|
|
5
|
+
"agentClients": [
|
|
6
|
+
{
|
|
7
|
+
"id": "claude-code",
|
|
8
|
+
"enabled": true,
|
|
9
|
+
"installInSandbox": true
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"id": "codex",
|
|
13
|
+
"enabled": true,
|
|
14
|
+
"installInSandbox": true
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"id": "antigravity-cli",
|
|
18
|
+
"enabled": true,
|
|
19
|
+
"installInSandbox": true
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"id": "opencode",
|
|
23
|
+
"enabled": true,
|
|
24
|
+
"installInSandbox": true
|
|
25
|
+
}
|
|
26
|
+
],
|
|
5
27
|
"sandbox": {
|
|
6
28
|
"engine": null,
|
|
7
29
|
"runtimes": [
|
|
8
30
|
"node22"
|
|
9
31
|
],
|
|
10
32
|
"tools": [
|
|
11
|
-
"agent-infra"
|
|
12
|
-
"claude-code",
|
|
13
|
-
"codex",
|
|
14
|
-
"gemini-cli",
|
|
15
|
-
"opencode"
|
|
33
|
+
"agent-infra"
|
|
16
34
|
],
|
|
17
35
|
"refreshIntervalDays": 7,
|
|
18
36
|
"dockerfile": null,
|
|
@@ -39,16 +57,12 @@
|
|
|
39
57
|
".agents/templates/",
|
|
40
58
|
".agents/workflows/",
|
|
41
59
|
".agents/workspace/README.md",
|
|
42
|
-
".claude/commands/",
|
|
43
|
-
".codex/hooks.json",
|
|
44
|
-
".gemini/commands/",
|
|
45
60
|
".git-hooks/check-large-files.cjs",
|
|
46
61
|
".git-hooks/check-version-format.sh",
|
|
47
62
|
".github/scripts/",
|
|
48
63
|
".github/workflows/metadata-sync.yml",
|
|
49
64
|
".github/workflows/pr-label.yml",
|
|
50
|
-
".github/workflows/status-label.yml"
|
|
51
|
-
".opencode/commands/"
|
|
65
|
+
".github/workflows/status-label.yml"
|
|
52
66
|
],
|
|
53
67
|
"guardedManaged": [
|
|
54
68
|
".github/workflows/metadata-sync.yml",
|
|
@@ -67,8 +81,6 @@
|
|
|
67
81
|
".agents/skills/test-integration/SKILL.*",
|
|
68
82
|
".agents/skills/test/SKILL.*",
|
|
69
83
|
".agents/skills/upgrade-dependency/SKILL.*",
|
|
70
|
-
".claude/settings.json",
|
|
71
|
-
".gemini/settings.json",
|
|
72
84
|
".git-hooks/pre-commit",
|
|
73
85
|
".gitignore"
|
|
74
86
|
],
|
|
@@ -40,21 +40,51 @@ function projectStaged(repoRoot: string, baseline: string, globs: string[], env:
|
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
function
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
43
|
+
function projectSnapshot(
|
|
44
|
+
repoRoot: string,
|
|
45
|
+
mode: 'worktree' | 'staged',
|
|
46
|
+
baseline: string,
|
|
47
|
+
globs: string[]
|
|
48
|
+
) {
|
|
49
|
+
return withTemporaryIndex(repoRoot, baseline, (env) => {
|
|
50
|
+
if (mode === 'worktree') projectWorktree(repoRoot, baseline, globs, env);
|
|
51
|
+
else projectStaged(repoRoot, baseline, globs, env);
|
|
50
52
|
return {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
+
diff: execFileSync('git', ['diff', '--cached', '--binary', baseline, '--', ...globs], {
|
|
54
|
+
cwd: repoRoot,
|
|
55
|
+
encoding: 'buffer',
|
|
56
|
+
env
|
|
57
|
+
}),
|
|
53
58
|
tree: String(git(repoRoot, ['write-tree'], { env })).trim()
|
|
54
59
|
};
|
|
55
60
|
});
|
|
56
61
|
}
|
|
57
62
|
|
|
63
|
+
function snapshotReview(input: {
|
|
64
|
+
cwd: string;
|
|
65
|
+
mode: 'worktree' | 'staged';
|
|
66
|
+
baseline: string;
|
|
67
|
+
diffBase?: string;
|
|
68
|
+
globs: string[];
|
|
69
|
+
}) {
|
|
70
|
+
const repoRoot = String(git(input.cwd, ['rev-parse', '--show-toplevel'])).trim();
|
|
71
|
+
const resolvedBaseline = String(git(repoRoot, ['rev-parse', '--verify', `${input.baseline}^{commit}`])).trim();
|
|
72
|
+
const resolvedDiffBase = String(git(
|
|
73
|
+
repoRoot,
|
|
74
|
+
['rev-parse', '--verify', `${input.diffBase || resolvedBaseline}^{commit}`]
|
|
75
|
+
)).trim();
|
|
76
|
+
const reviewed = projectSnapshot(repoRoot, input.mode, resolvedBaseline, input.globs);
|
|
77
|
+
const fingerprintSource = resolvedDiffBase === resolvedBaseline
|
|
78
|
+
? reviewed.diff
|
|
79
|
+
: projectSnapshot(repoRoot, input.mode, resolvedDiffBase, input.globs).diff;
|
|
80
|
+
return {
|
|
81
|
+
baseline: resolvedBaseline,
|
|
82
|
+
diffBase: resolvedDiffBase,
|
|
83
|
+
fingerprint: `sha256:${crypto.createHash('sha256').update(fingerprintSource).digest('hex')}`,
|
|
84
|
+
tree: reviewed.tree
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
|
|
58
88
|
function compareReviewTrees(input: { cwd: string; expected: string; actual: string }) {
|
|
59
89
|
const repoRoot = String(git(input.cwd, ['rev-parse', '--show-toplevel'])).trim();
|
|
60
90
|
git(repoRoot, ['rev-parse', '--verify', `${input.expected}^{tree}`]);
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { execFileSync, spawnSync } from "node:child_process";
|
|
2
|
+
|
|
3
|
+
const SHA_PATTERN = /^[0-9a-f]{40}$/i;
|
|
4
|
+
|
|
5
|
+
type LocalReviewedCommitRelation =
|
|
6
|
+
| {
|
|
7
|
+
status: "local-equivalent";
|
|
8
|
+
reviewedHead: string;
|
|
9
|
+
rewrittenCommit: string;
|
|
10
|
+
}
|
|
11
|
+
| {
|
|
12
|
+
status: "failed" | "blocked";
|
|
13
|
+
code: string;
|
|
14
|
+
message: string;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
function git(cwd: string, args: string[]): string {
|
|
18
|
+
return execFileSync("git", args, { cwd, encoding: "utf8", maxBuffer: 32 * 1024 * 1024 });
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function commitExists(gitRoot: string, sha: string): boolean {
|
|
22
|
+
try {
|
|
23
|
+
git(gitRoot, ["cat-file", "-e", `${sha}^{commit}`]);
|
|
24
|
+
return true;
|
|
25
|
+
} catch {
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function isAncestor(gitRoot: string, ancestor: string, descendant: string): boolean | null {
|
|
31
|
+
const result = spawnSync("git", ["merge-base", "--is-ancestor", ancestor, descendant], {
|
|
32
|
+
cwd: gitRoot,
|
|
33
|
+
encoding: "utf8"
|
|
34
|
+
});
|
|
35
|
+
if (result.status === 0) return true;
|
|
36
|
+
if (result.status === 1) return false;
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export function resolveLocalReviewedCommitRelation(input: {
|
|
41
|
+
gitRoot: string;
|
|
42
|
+
localHead: string;
|
|
43
|
+
lastReviewedCommit: string;
|
|
44
|
+
rewrittenCommit: string;
|
|
45
|
+
pathspecs: string[];
|
|
46
|
+
}): LocalReviewedCommitRelation {
|
|
47
|
+
const { gitRoot, localHead, lastReviewedCommit, rewrittenCommit, pathspecs } = input;
|
|
48
|
+
const shas = [localHead, lastReviewedCommit, rewrittenCommit];
|
|
49
|
+
if (shas.some((sha) => !SHA_PATTERN.test(sha) || !commitExists(gitRoot, sha))) {
|
|
50
|
+
return {
|
|
51
|
+
status: "blocked",
|
|
52
|
+
code: "LOCAL_REWRITE_OBJECT_MISSING",
|
|
53
|
+
message: "Required local rewrite Git objects are unavailable"
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const ancestor = isAncestor(gitRoot, rewrittenCommit, localHead);
|
|
58
|
+
if (ancestor === false) {
|
|
59
|
+
return {
|
|
60
|
+
status: "failed",
|
|
61
|
+
code: "LOCAL_REWRITE_TOPOLOGY_INVALID",
|
|
62
|
+
message: "Local rewritten commit is not in the current HEAD history"
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
if (ancestor === null) {
|
|
66
|
+
return {
|
|
67
|
+
status: "blocked",
|
|
68
|
+
code: "LOCAL_REWRITE_GIT_EVIDENCE_UNAVAILABLE",
|
|
69
|
+
message: "Unable to verify local rewrite ancestry"
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
try {
|
|
74
|
+
const parents = git(gitRoot, ["rev-parse", `${rewrittenCommit}^@`])
|
|
75
|
+
.split(/\r?\n/)
|
|
76
|
+
.filter((line) => line.trim() !== "");
|
|
77
|
+
if (parents.length !== 1) {
|
|
78
|
+
return {
|
|
79
|
+
status: "failed",
|
|
80
|
+
code: "LOCAL_REWRITE_TOPOLOGY_INVALID",
|
|
81
|
+
message: "Local rewritten commit is not a single-parent commit"
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const reviewedTree = git(gitRoot, ["rev-parse", `${lastReviewedCommit}^{tree}`]).trim();
|
|
86
|
+
const rewrittenTree = git(gitRoot, ["rev-parse", `${rewrittenCommit}^{tree}`]).trim();
|
|
87
|
+
if (reviewedTree !== rewrittenTree) {
|
|
88
|
+
const protectedDiff = git(gitRoot, [
|
|
89
|
+
"diff",
|
|
90
|
+
"--no-renames",
|
|
91
|
+
"--binary",
|
|
92
|
+
"--full-index",
|
|
93
|
+
lastReviewedCommit,
|
|
94
|
+
rewrittenCommit,
|
|
95
|
+
"--",
|
|
96
|
+
...pathspecs
|
|
97
|
+
]);
|
|
98
|
+
if (protectedDiff !== "") {
|
|
99
|
+
return {
|
|
100
|
+
status: "failed",
|
|
101
|
+
code: "LOCAL_REWRITE_CONTENT_MISMATCH",
|
|
102
|
+
message: "Local rewritten commit differs from the reviewed protected content"
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
const postRewrite = git(gitRoot, [
|
|
108
|
+
"rev-list",
|
|
109
|
+
`${rewrittenCommit}..${localHead}`,
|
|
110
|
+
"--",
|
|
111
|
+
...pathspecs
|
|
112
|
+
]).trim();
|
|
113
|
+
if (postRewrite) {
|
|
114
|
+
return {
|
|
115
|
+
status: "failed",
|
|
116
|
+
code: "POST_LOCAL_REWRITE_CHANGES",
|
|
117
|
+
message: "Protected paths changed after the equivalent local rewrite"
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
} catch {
|
|
121
|
+
return {
|
|
122
|
+
status: "blocked",
|
|
123
|
+
code: "LOCAL_REWRITE_GIT_EVIDENCE_UNAVAILABLE",
|
|
124
|
+
message: "Unable to verify local rewrite topology or content"
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
return {
|
|
129
|
+
status: "local-equivalent",
|
|
130
|
+
reviewedHead: lastReviewedCommit,
|
|
131
|
+
rewrittenCommit
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export type { LocalReviewedCommitRelation };
|
package/lib/git/workflow.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { spawnSync } from 'node:child_process';
|
|
2
|
+
import fs from 'node:fs';
|
|
3
|
+
import path from 'node:path';
|
|
2
4
|
|
|
3
5
|
type CommandResult = { status: number | null; stdout: string; stderr: string };
|
|
4
6
|
type GitRunner = (args: readonly string[], cwd: string) => CommandResult;
|
|
@@ -18,6 +20,10 @@ function value(runner: GitRunner, cwd: string, args: readonly string[], trim = t
|
|
|
18
20
|
return result.status === 0 ? (trim ? result.stdout.trim() : result.stdout.replace(/\n$/, '')) : null;
|
|
19
21
|
}
|
|
20
22
|
|
|
23
|
+
function cleanMessage(message: string): string {
|
|
24
|
+
return message.replace(/(https?:\/\/)[^\s/@:]+(?::[^\s/@]*)?@/gi, '$1***@').trim();
|
|
25
|
+
}
|
|
26
|
+
|
|
21
27
|
function inspectGitWorkflow(cwd: string, runner: GitRunner = defaultRunner, remoteInput?: { remote: string; refs: readonly string[] }) {
|
|
22
28
|
const head = value(runner, cwd, ['rev-parse', 'HEAD']);
|
|
23
29
|
const branch = value(runner, cwd, ['branch', '--show-current']);
|
|
@@ -97,5 +103,63 @@ function pushGitRefs(input: { cwd: string; remote: string; refs: readonly string
|
|
|
97
103
|
return { status: failures === 0 ? 'applied' as const : failures === operations.length ? 'failed' as const : 'degraded' as const, changed: failures < operations.length, snapshot: inspectGitWorkflow(input.cwd, runner).snapshot, operations, error: failures ? { code: 'GIT_PUSH_PARTIAL', message: `${failures} ref push operation(s) failed` } : null };
|
|
98
104
|
}
|
|
99
105
|
|
|
100
|
-
|
|
101
|
-
|
|
106
|
+
type PushRebasedInput = {
|
|
107
|
+
cwd: string;
|
|
108
|
+
remote: string;
|
|
109
|
+
branch: string;
|
|
110
|
+
expectedOldHead: string;
|
|
111
|
+
newHead: string;
|
|
112
|
+
baseBranch: string;
|
|
113
|
+
expectedBaseHead: string;
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
function pushRebasedBranch(input: PushRebasedInput, runner: GitRunner = defaultRunner) {
|
|
117
|
+
const sha = /^[0-9a-f]{40}$/i;
|
|
118
|
+
const refName = /^(?!-)(?!.*\.\.)(?!.*(?:^|\/)\.)(?!.*[~^:?*\[\\\s])(?:[A-Za-z0-9._-]+\/)*[A-Za-z0-9._-]+$/;
|
|
119
|
+
if (!input.remote || !refName.test(input.remote) || !refName.test(input.branch) || !refName.test(input.baseBranch) ||
|
|
120
|
+
!sha.test(input.expectedOldHead) || !sha.test(input.newHead) || !sha.test(input.expectedBaseHead)) {
|
|
121
|
+
return { status: 'failed' as const, changed: false, snapshot: null, operations: [], error: { code: 'GIT_REBASED_INPUT_INVALID', message: 'Remote, branches, and full 40-character SHAs are required' } };
|
|
122
|
+
}
|
|
123
|
+
const snapshot = inspectGitWorkflow(input.cwd, runner).snapshot;
|
|
124
|
+
if (!snapshot) return { status: 'failed' as const, changed: false, snapshot: null, operations: [], error: { code: 'GIT_INSPECT_FAILED', message: 'Unable to inspect Git repository' } };
|
|
125
|
+
if (snapshot.branch !== input.branch || snapshot.head !== input.newHead) {
|
|
126
|
+
return { status: 'failed' as const, changed: false, snapshot, operations: [], error: { code: 'GIT_LOCAL_IDENTITY_MISMATCH', message: 'Current branch or HEAD does not match the rebased intent' } };
|
|
127
|
+
}
|
|
128
|
+
const rebasePaths = ['rebase-merge', 'rebase-apply']
|
|
129
|
+
.map((name) => value(runner, input.cwd, ['rev-parse', '--git-path', name]))
|
|
130
|
+
.filter((candidate): candidate is string => Boolean(candidate));
|
|
131
|
+
if (snapshot.worktree.length > 0 || snapshot.staged.length > 0 ||
|
|
132
|
+
run(runner, input.cwd, ['rev-parse', '-q', '--verify', 'REBASE_HEAD']).status === 0 ||
|
|
133
|
+
rebasePaths.some((candidate) => fs.existsSync(path.isAbsolute(candidate) ? candidate : path.join(input.cwd, candidate)))) {
|
|
134
|
+
return { status: 'failed' as const, changed: false, snapshot, operations: [], error: { code: 'GIT_LOCAL_STATE_UNSAFE', message: 'Working tree must be clean with no rebase in progress' } };
|
|
135
|
+
}
|
|
136
|
+
const remoteRef = `refs/heads/${input.branch}`;
|
|
137
|
+
const baseRef = `refs/heads/${input.baseBranch}`;
|
|
138
|
+
const remoteHead = value(runner, input.cwd, ['ls-remote', '--exit-code', input.remote, remoteRef])?.split(/\s+/)[0] ?? null;
|
|
139
|
+
if (remoteHead !== input.expectedOldHead) {
|
|
140
|
+
return { status: 'failed' as const, changed: false, snapshot, operations: [], error: { code: 'GIT_REMOTE_HEAD_MISMATCH', message: `Expected remote head ${input.expectedOldHead}, received ${remoteHead ?? 'unavailable'}` } };
|
|
141
|
+
}
|
|
142
|
+
const baseHead = value(runner, input.cwd, ['ls-remote', '--exit-code', input.remote, baseRef])?.split(/\s+/)[0] ?? null;
|
|
143
|
+
if (baseHead !== input.expectedBaseHead) {
|
|
144
|
+
return { status: 'failed' as const, changed: false, snapshot, operations: [], error: { code: 'GIT_REMOTE_BASE_MISMATCH', message: `Expected base head ${input.expectedBaseHead}, received ${baseHead ?? 'unavailable'}` } };
|
|
145
|
+
}
|
|
146
|
+
if (run(runner, input.cwd, ['merge-base', '--is-ancestor', input.expectedBaseHead, input.newHead]).status !== 0) {
|
|
147
|
+
return { status: 'failed' as const, changed: false, snapshot, operations: [], error: { code: 'GIT_REBASED_ANCESTOR_MISMATCH', message: 'Rebased head does not contain the expected base head' } };
|
|
148
|
+
}
|
|
149
|
+
const pushed = run(runner, input.cwd, [
|
|
150
|
+
'push', `--force-with-lease=${remoteRef}:${input.expectedOldHead}`,
|
|
151
|
+
input.remote, `${input.newHead}:${remoteRef}`
|
|
152
|
+
]);
|
|
153
|
+
if (pushed.status !== 0) {
|
|
154
|
+
const message = cleanMessage(pushed.stderr) || 'Rebased branch push was rejected';
|
|
155
|
+
return { status: 'failed' as const, changed: false, snapshot: inspectGitWorkflow(input.cwd, runner).snapshot, operations: [{ name: 'push-rebased', status: 'failed' as const, ref: input.branch, message }], error: { code: 'GIT_REBASED_PUSH_REJECTED', message } };
|
|
156
|
+
}
|
|
157
|
+
const verified = value(runner, input.cwd, ['ls-remote', '--exit-code', input.remote, remoteRef])?.split(/\s+/)[0] ?? null;
|
|
158
|
+
if (verified !== input.newHead) {
|
|
159
|
+
return { status: 'failed' as const, changed: true, snapshot: inspectGitWorkflow(input.cwd, runner).snapshot, operations: [{ name: 'push-rebased', status: 'failed' as const, ref: input.branch, message: 'Remote ref verification failed' }], error: { code: 'GIT_REBASED_VERIFY_FAILED', message: `Expected pushed head ${input.newHead}, received ${verified ?? 'unavailable'}` } };
|
|
160
|
+
}
|
|
161
|
+
return { status: 'applied' as const, changed: true, snapshot: inspectGitWorkflow(input.cwd, runner).snapshot, operations: [{ name: 'push-rebased', status: 'applied' as const, ref: input.branch }], error: null };
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
export { commitExplicitPaths, inspectGitWorkflow, pushGitRefs, pushRebasedBranch };
|
|
165
|
+
export type { CommandResult, GitRunner, PushRebasedInput };
|