@fitlab-ai/agent-infra 0.9.10 → 0.9.12
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 +19 -9
- package/README.zh-CN.md +19 -9
- package/bin/cli.ts +17 -4
- package/dist/bin/cli.js +19 -4
- package/dist/bin/internal-cli.js +55 -4
- package/dist/lib/agent-client.js +0 -1
- package/dist/lib/agent-clients/adapters/codex-lifecycle/build-identity.js +71 -10
- package/dist/lib/agent-clients/adapters/opencode-sandbox.js +0 -4
- package/dist/lib/agent-clients/adapters/traecli.js +7 -8
- package/dist/lib/agent-clients/config.js +14 -99
- package/dist/lib/agent-clients/reconcile.js +1 -11
- package/dist/lib/agent-clients/schema.js +5 -4
- package/dist/lib/agent-clients/tokens.js +5 -15
- package/dist/lib/decide.js +14 -30
- package/dist/lib/defaults.json +8 -0
- package/dist/lib/git/workflow.js +43 -1
- package/dist/lib/init.js +3 -2
- package/dist/lib/internal/git-workflow.js +8 -1
- package/dist/lib/internal/platform-pr.js +8 -2
- package/dist/lib/internal/release-workflow.js +0 -1
- package/dist/lib/internal/task-delivery.js +59 -0
- package/dist/lib/internal/task-finalization.js +19 -9
- package/dist/lib/internal/task-ledger.js +8 -2
- package/dist/lib/internal/task-lifecycle.js +17 -93
- package/dist/lib/internal/task-orchestration.js +30 -216
- package/dist/lib/internal/task-validate.js +2 -1
- package/dist/lib/merge.js +205 -103
- package/dist/lib/platform/github-client.js +7 -1
- package/dist/lib/platform/pr-checks.js +8 -5
- package/dist/lib/platform/pr-summary.js +12 -8
- package/dist/lib/platform/pull-requests.js +393 -91
- package/dist/lib/platform/verification-required.js +13 -2
- package/dist/lib/platform/verification-sync.js +9 -4
- package/dist/lib/pr-review/evidence-grading.js +12 -4
- package/dist/lib/process-data/normalize.js +2 -9
- package/dist/lib/run/host.js +46 -16
- package/dist/lib/sandbox/agent-client-reconciler.js +4 -12
- package/dist/lib/sandbox/commands/create.js +3 -3
- package/dist/lib/sandbox/commands/enter.js +18 -4
- package/dist/lib/sandbox/config.js +8 -12
- package/dist/lib/sandbox/control/executor.js +131 -39
- package/dist/lib/sandbox/control/lifecycle.js +55 -24
- package/dist/lib/sandbox/control/server.js +18 -16
- package/dist/lib/sandbox/mounts.js +3 -2
- package/dist/lib/sandbox/recovery.js +123 -22
- package/dist/lib/sandbox/workspace-identity.js +14 -0
- package/dist/lib/sandbox/workspace-view.js +8 -9
- package/dist/lib/self-update.js +278 -0
- package/dist/lib/server/process-state.js +2 -2
- package/dist/lib/server/protocol.js +5 -5
- package/dist/lib/task/activity-log.js +4 -1
- package/dist/lib/task/artifact-lifecycle.js +6 -4
- package/dist/lib/task/codex-orchestration.js +1 -1
- package/dist/lib/task/command-options.js +1 -3
- package/dist/lib/task/commands/cat.js +0 -5
- package/dist/lib/task/commands/decisions.js +76 -92
- package/dist/lib/task/commands/files.js +6 -6
- package/dist/lib/task/commands/grep.js +25 -61
- package/dist/lib/task/commands/issue-body.js +6 -6
- package/dist/lib/task/commands/log.js +25 -10
- package/dist/lib/task/commands/show.js +5 -6
- package/dist/lib/task/commands/status.js +8 -8
- package/dist/lib/task/commit-intent.js +100 -0
- package/dist/lib/task/commit-operation.js +181 -91
- package/dist/lib/task/commit-policy.js +1 -1
- package/dist/lib/task/control-authority.js +431 -0
- package/dist/lib/task/create.js +39 -8
- package/dist/lib/task/current-contract.js +35 -0
- package/dist/lib/task/decision-details.js +218 -0
- package/dist/lib/task/decision-intents.js +5 -2
- package/dist/lib/task/delivery-target.js +97 -0
- package/dist/lib/task/delivery.js +153 -0
- package/dist/lib/task/events.js +11 -5
- package/dist/lib/task/human-override.js +5 -2
- package/dist/lib/task/index.js +19 -20
- package/dist/lib/task/ledger-intents.js +8 -9
- package/dist/lib/task/ledger.js +13 -6
- package/dist/lib/task/lifecycle.js +122 -9
- package/dist/lib/task/orchestration.js +105 -75
- package/dist/lib/task/pr-delivery-fact.js +182 -0
- package/dist/lib/task/review-artifacts.js +31 -12
- package/dist/lib/task/review-finalization.js +13 -4
- package/dist/lib/task/review-fingerprint.js +8 -0
- package/dist/lib/task/verification-engine.js +86 -39
- package/dist/lib/task/verification-review.js +2 -2
- package/dist/lib/task/workspace-snapshot.js +5 -11
- package/dist/lib/task/write.js +11 -1
- package/dist/lib/update.js +13 -35
- package/dist/lib/version.js +5 -1
- package/dist/lifecycle-build-manifest.json +3 -3
- package/lib/agent-client.ts +0 -1
- package/lib/agent-clients/adapters/codex-lifecycle/build-identity.ts +105 -10
- package/lib/agent-clients/adapters/codex-lifecycle/manifest-files.json +12 -1
- package/lib/agent-clients/adapters/opencode-sandbox.ts +0 -5
- package/lib/agent-clients/adapters/traecli.ts +7 -8
- package/lib/agent-clients/config.ts +14 -144
- package/lib/agent-clients/reconcile.ts +1 -12
- package/lib/agent-clients/schema.ts +5 -4
- package/lib/agent-clients/tokens.ts +5 -18
- package/lib/decide.ts +12 -22
- package/lib/defaults.json +8 -0
- package/lib/git/workflow.ts +38 -1
- package/lib/init.ts +5 -2
- package/lib/internal/git-workflow.ts +7 -1
- package/lib/internal/platform-pr.ts +8 -1
- package/lib/internal/release-workflow.ts +0 -1
- package/lib/internal/task-delivery.ts +53 -0
- package/lib/internal/task-finalization.ts +27 -13
- package/lib/internal/task-ledger.ts +8 -2
- package/lib/internal/task-lifecycle.ts +33 -76
- package/lib/internal/task-orchestration.ts +33 -190
- package/lib/internal/task-validate.ts +3 -2
- package/lib/merge.ts +236 -120
- package/lib/platform/github-client.ts +8 -1
- package/lib/platform/pr-checks.ts +7 -5
- package/lib/platform/pr-summary.ts +10 -7
- package/lib/platform/pull-requests.ts +425 -87
- package/lib/platform/verification-required.ts +12 -2
- package/lib/platform/verification-sync.ts +9 -4
- package/lib/pr-review/evidence-grading.ts +7 -4
- package/lib/process-data/normalize.ts +2 -8
- package/lib/run/host.ts +63 -14
- package/lib/sandbox/agent-client-reconciler.ts +5 -15
- package/lib/sandbox/commands/create.ts +4 -4
- package/lib/sandbox/commands/enter.ts +24 -4
- package/lib/sandbox/config.ts +9 -14
- package/lib/sandbox/control/container-identity.ts +2 -2
- package/lib/sandbox/control/executor.ts +148 -51
- package/lib/sandbox/control/lifecycle.ts +59 -31
- package/lib/sandbox/control/protocol.ts +1 -3
- package/lib/sandbox/control/server.ts +15 -12
- package/lib/sandbox/control/state.ts +7 -7
- package/lib/sandbox/mounts.ts +4 -3
- package/lib/sandbox/recovery.ts +162 -34
- package/lib/sandbox/tools.ts +1 -1
- package/lib/sandbox/workspace-identity.ts +28 -0
- package/lib/sandbox/workspace-view.ts +14 -10
- package/lib/self-update.ts +341 -0
- package/lib/server/process-state.ts +2 -2
- package/lib/server/protocol.ts +5 -5
- package/lib/task/activity-log.ts +6 -1
- package/lib/task/artifact-lifecycle.ts +7 -5
- package/lib/task/codex-orchestration.ts +2 -1
- package/lib/task/command-options.ts +1 -2
- package/lib/task/commands/cat.ts +0 -4
- package/lib/task/commands/decisions.ts +80 -75
- package/lib/task/commands/files.ts +6 -6
- package/lib/task/commands/grep.ts +23 -51
- package/lib/task/commands/issue-body.ts +6 -6
- package/lib/task/commands/log.ts +22 -10
- package/lib/task/commands/show.ts +5 -6
- package/lib/task/commands/status.ts +8 -8
- package/lib/task/commit-intent.ts +137 -0
- package/lib/task/commit-operation.ts +161 -79
- package/lib/task/commit-policy.ts +1 -2
- package/lib/task/control-authority.ts +563 -0
- package/lib/task/create.ts +40 -10
- package/lib/task/current-contract.ts +49 -0
- package/lib/task/decision-details.ts +280 -0
- package/lib/task/decision-intents.ts +7 -2
- package/lib/task/delivery-target.ts +130 -0
- package/lib/task/delivery.ts +160 -0
- package/lib/task/events.ts +10 -5
- package/lib/task/human-override.ts +5 -2
- package/lib/task/index.ts +19 -20
- package/lib/task/ledger-intents.ts +6 -8
- package/lib/task/ledger.ts +17 -7
- package/lib/task/lifecycle.ts +113 -4
- package/lib/task/orchestration.ts +102 -80
- package/lib/task/pr-delivery-fact.ts +254 -0
- package/lib/task/review-artifacts.ts +53 -15
- package/lib/task/review-finalization.ts +21 -5
- package/lib/task/review-fingerprint.ts +10 -0
- package/lib/task/verification-engine.ts +78 -46
- package/lib/task/verification-review.ts +3 -1
- package/lib/task/workspace-snapshot.ts +4 -13
- package/lib/task/write.ts +20 -1
- package/lib/update.ts +14 -38
- package/lib/version.ts +6 -1
- package/package.json +1 -1
- package/templates/.agents/README.en.md +5 -3
- package/templates/.agents/README.zh-CN.md +5 -3
- package/templates/.agents/rules/README.en.md +4 -2
- package/templates/.agents/rules/README.zh-CN.md +4 -2
- package/templates/.agents/rules/compatibility-policy.en.md +5 -4
- package/templates/.agents/rules/compatibility-policy.zh-CN.md +5 -4
- package/templates/.agents/rules/create-issue.en.md +11 -2
- package/templates/.agents/rules/create-issue.zh-CN.md +24 -2
- package/templates/.agents/rules/human-decision-context.en.md +9 -7
- package/templates/.agents/rules/human-decision-context.zh-CN.md +9 -7
- package/templates/.agents/rules/{issue-fields.github.en.md → issue-fields.en.md} +1 -1
- package/templates/.agents/rules/{issue-fields.github.zh-CN.md → issue-fields.zh-CN.md} +1 -1
- package/templates/.agents/rules/issue-pr-commands.en.md +5 -18
- package/templates/.agents/rules/issue-pr-commands.zh-CN.md +1 -1
- package/templates/.agents/rules/issue-sync.en.md +26 -5
- package/templates/.agents/rules/issue-sync.zh-CN.md +62 -5
- package/templates/.agents/rules/label-milestone-setup.en.md +15 -2
- package/templates/.agents/rules/label-milestone-setup.zh-CN.md +15 -2
- package/templates/.agents/rules/local-artifact-repair.en.md +46 -0
- package/templates/.agents/rules/local-artifact-repair.zh-CN.md +46 -0
- package/templates/.agents/rules/milestone-inference.en.md +12 -2
- package/templates/.agents/rules/milestone-inference.zh-CN.md +25 -3
- package/templates/.agents/rules/next-step-output.en.md +3 -3
- package/templates/.agents/rules/next-step-output.zh-CN.md +3 -3
- package/templates/.agents/rules/no-mid-flow-questions.en.md +1 -1
- package/templates/.agents/rules/no-mid-flow-questions.zh-CN.md +1 -1
- package/templates/.agents/rules/pr-sync.en.md +23 -14
- package/templates/.agents/rules/pr-sync.zh-CN.md +23 -2
- package/templates/.agents/rules/release-commands.en.md +42 -3
- package/templates/.agents/rules/release-commands.zh-CN.md +42 -3
- package/templates/.agents/rules/review-handshake.en.md +1 -1
- package/templates/.agents/rules/review-handshake.zh-CN.md +1 -1
- package/templates/.agents/rules/security-alerts.en.md +17 -2
- package/templates/.agents/rules/security-alerts.zh-CN.md +17 -2
- package/templates/.agents/rules/sync-content-generation.en.md +8 -0
- package/templates/.agents/rules/sync-content-generation.zh-CN.md +8 -0
- package/templates/.agents/rules/task-management.en.md +2 -3
- package/templates/.agents/rules/task-management.zh-CN.md +2 -3
- package/templates/.agents/scripts/security-alerts.github.sh +151 -0
- package/templates/.agents/scripts/security-alerts.sh +31 -0
- package/templates/.agents/skills/analyze-task/SKILL.en.md +4 -3
- package/templates/.agents/skills/analyze-task/SKILL.zh-CN.md +4 -3
- package/templates/.agents/skills/block-task/SKILL.en.md +2 -2
- package/templates/.agents/skills/block-task/SKILL.zh-CN.md +2 -2
- package/templates/.agents/skills/cancel-task/SKILL.en.md +2 -2
- package/templates/.agents/skills/cancel-task/SKILL.zh-CN.md +2 -2
- package/templates/.agents/skills/check-task/SKILL.en.md +2 -2
- package/templates/.agents/skills/check-task/SKILL.zh-CN.md +2 -2
- package/templates/.agents/skills/close-codescan/SKILL.en.md +3 -3
- package/templates/.agents/skills/close-codescan/SKILL.zh-CN.md +3 -3
- package/templates/.agents/skills/close-dependabot/SKILL.en.md +3 -3
- package/templates/.agents/skills/close-dependabot/SKILL.zh-CN.md +3 -3
- package/templates/.agents/skills/code-task/SKILL.en.md +8 -5
- package/templates/.agents/skills/code-task/SKILL.zh-CN.md +9 -6
- package/templates/.agents/skills/commit/SKILL.en.md +30 -10
- package/templates/.agents/skills/commit/SKILL.zh-CN.md +6 -7
- package/templates/.agents/skills/commit/config/verify.json +1 -1
- package/templates/.agents/skills/commit/reference/commit-orchestration.en.md +3 -3
- package/templates/.agents/skills/commit/reference/commit-orchestration.zh-CN.md +3 -3
- 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 +2 -2
- package/templates/.agents/skills/commit/reference/task-status-update.zh-CN.md +2 -2
- package/templates/.agents/skills/complete-manual-validation/SKILL.en.md +7 -6
- package/templates/.agents/skills/complete-manual-validation/SKILL.zh-CN.md +7 -6
- package/templates/.agents/skills/complete-manual-validation/config/verify.en.json +1 -1
- package/templates/.agents/skills/complete-manual-validation/config/verify.zh-CN.json +1 -1
- 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 +13 -13
- package/templates/.agents/skills/complete-task/SKILL.zh-CN.md +13 -13
- package/templates/.agents/skills/complete-task/reference/external-delivery.en.md +2 -2
- package/templates/.agents/skills/complete-task/reference/external-delivery.zh-CN.md +2 -2
- package/templates/.agents/skills/create-pr/SKILL.en.md +9 -11
- package/templates/.agents/skills/create-pr/SKILL.zh-CN.md +9 -11
- package/templates/.agents/skills/create-pr/reference/change-report.en.md +9 -4
- package/templates/.agents/skills/create-pr/reference/change-report.zh-CN.md +9 -4
- package/templates/.agents/skills/create-pr/scripts/change-report.mjs +203 -0
- package/templates/.agents/skills/create-release-note/SKILL.en.md +5 -6
- package/templates/.agents/skills/create-release-note/SKILL.zh-CN.md +5 -6
- package/templates/.agents/skills/create-task/SKILL.en.md +2 -1
- package/templates/.agents/skills/create-task/SKILL.zh-CN.md +2 -1
- package/templates/.agents/skills/import-codescan/SKILL.en.md +1 -1
- package/templates/.agents/skills/import-codescan/SKILL.zh-CN.md +1 -1
- package/templates/.agents/skills/import-dependabot/SKILL.en.md +1 -1
- package/templates/.agents/skills/import-dependabot/SKILL.zh-CN.md +1 -1
- package/templates/.agents/skills/import-issue/SKILL.en.md +1 -1
- package/templates/.agents/skills/import-issue/SKILL.zh-CN.md +1 -1
- package/templates/.agents/skills/init-labels/SKILL.en.md +9 -10
- package/templates/.agents/skills/init-labels/SKILL.zh-CN.md +9 -10
- package/templates/.agents/skills/init-labels/scripts/init-labels.github.sh +57 -1
- package/templates/.agents/skills/init-labels/scripts/init-labels.sh +27 -1
- package/templates/.agents/skills/init-milestones/SKILL.en.md +3 -5
- package/templates/.agents/skills/init-milestones/SKILL.zh-CN.md +3 -5
- package/templates/.agents/skills/plan-task/SKILL.en.md +4 -3
- package/templates/.agents/skills/plan-task/SKILL.zh-CN.md +4 -3
- package/templates/.agents/skills/restore-task/SKILL.en.md +1 -1
- package/templates/.agents/skills/restore-task/SKILL.zh-CN.md +1 -1
- package/templates/.agents/skills/review-analysis/SKILL.en.md +8 -5
- package/templates/.agents/skills/review-analysis/SKILL.zh-CN.md +8 -5
- package/templates/.agents/skills/review-analysis/config/verify.en.json +1 -0
- package/templates/.agents/skills/review-analysis/config/verify.zh-CN.json +1 -0
- package/templates/.agents/skills/review-analysis/reference/output-templates.en.md +18 -0
- package/templates/.agents/skills/review-analysis/reference/output-templates.zh-CN.md +18 -0
- package/templates/.agents/skills/review-code/SKILL.en.md +11 -8
- package/templates/.agents/skills/review-code/SKILL.zh-CN.md +11 -8
- package/templates/.agents/skills/review-code/config/verify.en.json +1 -0
- package/templates/.agents/skills/review-code/config/verify.zh-CN.json +1 -0
- package/templates/.agents/skills/review-code/reference/migration-risks.en.md +2 -1
- package/templates/.agents/skills/review-code/reference/migration-risks.zh-CN.md +2 -1
- package/templates/.agents/skills/review-code/reference/output-templates.en.md +19 -1
- package/templates/.agents/skills/review-code/reference/output-templates.zh-CN.md +19 -1
- package/templates/.agents/skills/review-code/reference/report-template.en.md +4 -2
- package/templates/.agents/skills/review-code/reference/report-template.zh-CN.md +4 -2
- package/templates/.agents/skills/review-plan/SKILL.en.md +8 -5
- package/templates/.agents/skills/review-plan/SKILL.zh-CN.md +8 -5
- package/templates/.agents/skills/review-plan/config/verify.en.json +1 -0
- package/templates/.agents/skills/review-plan/config/verify.zh-CN.json +1 -0
- package/templates/.agents/skills/review-plan/reference/output-templates.en.md +18 -0
- package/templates/.agents/skills/review-plan/reference/output-templates.zh-CN.md +18 -0
- package/templates/.agents/skills/review-pr/SKILL.en.md +1 -0
- package/templates/.agents/skills/review-pr/SKILL.zh-CN.md +1 -0
- package/templates/.agents/skills/review-pr/reference/evidence-grading.en.md +2 -2
- package/templates/.agents/skills/review-pr/reference/evidence-grading.zh-CN.md +2 -2
- package/templates/.agents/skills/run-manual-validation/SKILL.en.md +5 -0
- package/templates/.agents/skills/run-manual-validation/SKILL.zh-CN.md +5 -0
- package/templates/.agents/skills/run-task/SKILL.en.md +5 -1
- package/templates/.agents/skills/run-task/SKILL.zh-CN.md +5 -1
- package/templates/.agents/skills/update-agent-infra/SKILL.en.md +2 -2
- package/templates/.agents/skills/update-agent-infra/SKILL.zh-CN.md +2 -2
- package/templates/.agents/skills/update-agent-infra/scripts/sync-templates.js +144 -109
- package/templates/.agents/skills/watch-pr/SKILL.en.md +5 -5
- package/templates/.agents/skills/watch-pr/SKILL.zh-CN.md +5 -5
- package/templates/.agents/templates/task.en.md +6 -2
- package/templates/.agents/templates/task.zh-CN.md +6 -2
- package/templates/.agents/workflows/bug-fix.en.yaml +9 -8
- package/templates/.agents/workflows/bug-fix.zh-CN.yaml +9 -8
- package/templates/.agents/workflows/feature-development.en.yaml +9 -8
- package/templates/.agents/workflows/feature-development.zh-CN.yaml +9 -8
- package/templates/.agents/workflows/refactoring.en.yaml +9 -8
- package/templates/.agents/workflows/refactoring.zh-CN.yaml +9 -8
- package/templates/.claude/commands/analyze-task.en.md +1 -1
- package/templates/.claude/commands/analyze-task.zh-CN.md +1 -1
- package/templates/.claude/commands/block-task.en.md +1 -1
- package/templates/.claude/commands/block-task.zh-CN.md +1 -1
- package/templates/.claude/commands/cancel-task.en.md +1 -1
- package/templates/.claude/commands/cancel-task.zh-CN.md +1 -1
- package/templates/.claude/commands/check-task.en.md +1 -1
- package/templates/.claude/commands/check-task.zh-CN.md +1 -1
- package/templates/.claude/commands/code-task.en.md +1 -1
- package/templates/.claude/commands/code-task.zh-CN.md +1 -1
- package/templates/.claude/commands/commit.en.md +1 -1
- package/templates/.claude/commands/commit.zh-CN.md +1 -1
- package/templates/.claude/commands/complete-manual-validation.en.md +1 -1
- package/templates/.claude/commands/complete-manual-validation.zh-CN.md +1 -1
- package/templates/.claude/commands/complete-task.en.md +1 -1
- package/templates/.claude/commands/complete-task.zh-CN.md +1 -1
- package/templates/.claude/commands/create-pr.en.md +1 -1
- package/templates/.claude/commands/create-pr.zh-CN.md +1 -1
- package/templates/.claude/commands/plan-task.en.md +1 -1
- package/templates/.claude/commands/plan-task.zh-CN.md +1 -1
- package/templates/.claude/commands/review-analysis.en.md +1 -1
- package/templates/.claude/commands/review-analysis.zh-CN.md +1 -1
- package/templates/.claude/commands/review-code.en.md +1 -1
- package/templates/.claude/commands/review-code.zh-CN.md +1 -1
- package/templates/.claude/commands/review-plan.en.md +1 -1
- package/templates/.claude/commands/review-plan.zh-CN.md +1 -1
- package/templates/.claude/commands/run-manual-validation.en.md +1 -1
- package/templates/.claude/commands/run-manual-validation.zh-CN.md +1 -1
- package/templates/.claude/commands/run-task.en.md +1 -1
- package/templates/.claude/commands/run-task.zh-CN.md +1 -1
- package/templates/.claude/commands/watch-pr.en.md +1 -1
- package/templates/.claude/commands/watch-pr.zh-CN.md +1 -1
- package/templates/{.trae/skills → .traecli/commands}/update-agent-infra.en.md +0 -1
- package/templates/{.trae/skills → .traecli/commands}/update-agent-infra.zh-CN.md +0 -1
- package/dist/lib/builtin-tuis.js +0 -40
- package/lib/builtin-tuis.ts +0 -56
- package/templates/.agents/rules/create-issue.github.en.md +0 -14
- package/templates/.agents/rules/create-issue.github.zh-CN.md +0 -27
- package/templates/.agents/rules/issue-pr-commands.github.en.md +0 -34
- package/templates/.agents/rules/issue-pr-commands.github.zh-CN.md +0 -49
- package/templates/.agents/rules/issue-sync.github.en.md +0 -40
- package/templates/.agents/rules/issue-sync.github.zh-CN.md +0 -76
- package/templates/.agents/rules/label-milestone-setup.github.en.md +0 -60
- package/templates/.agents/rules/label-milestone-setup.github.zh-CN.md +0 -60
- package/templates/.agents/rules/milestone-inference.github.en.md +0 -15
- package/templates/.agents/rules/milestone-inference.github.zh-CN.md +0 -27
- package/templates/.agents/rules/pr-checks-commands.github.en.md +0 -18
- package/templates/.agents/rules/pr-checks-commands.github.zh-CN.md +0 -34
- package/templates/.agents/rules/pr-sync.github.en.md +0 -43
- package/templates/.agents/rules/pr-sync.github.zh-CN.md +0 -69
- package/templates/.agents/rules/release-commands.github.en.md +0 -38
- package/templates/.agents/rules/release-commands.github.zh-CN.md +0 -38
- package/templates/.agents/rules/security-alerts.github.en.md +0 -43
- package/templates/.agents/rules/security-alerts.github.zh-CN.md +0 -43
|
@@ -10,8 +10,8 @@ The platform adapter supplies authoritative Issue closing change requests across
|
|
|
10
10
|
|
|
11
11
|
## Authorization and Persistent Audit
|
|
12
12
|
|
|
13
|
-
Only the current typed result's `mode=external`, `authorization`, and `selected` fields control the machine branch.
|
|
13
|
+
Only the current typed result's `mode=external`, `authorization`, and `selected` fields control the machine branch. Persistent `pr_delivery_fact` stores the verified binding and provenance; it does not say that the current invocation created the PR and cannot authorize lifecycle skipping by itself.
|
|
14
14
|
|
|
15
|
-
A successful bind atomically writes
|
|
15
|
+
A successful bind atomically writes `pr_delivery_fact` and appends a `Bind External PR` Activity Log entry containing the authorization source, Issue, PR URL/number, base/head repository/ref/SHA, merge time, and merge commit. Replaying identical complete evidence is a no-op; an existing same-number binding without the signature adds it once; number or identity changes fail. The PR create path must never run.
|
|
16
16
|
|
|
17
17
|
External mode still passes identity, required-PR, local lifecycle, and terminal checks; review-ledger, manual-validation, post-review-commit, and platform-sync evidence is projected as warning/pending steps after lifecycle. Without a canonical review-code artifact, only existing verifier N/A rules apply. `--force` does not disable identity, local atomicity, or required-PR hard gates.
|
|
@@ -10,8 +10,8 @@ core 通过平台 adapter 读取 Issue 的权威 closing change requests,穷
|
|
|
10
10
|
|
|
11
11
|
## 授权与持久审计
|
|
12
12
|
|
|
13
|
-
当次调用只以 typed result 的 `mode=external`、`authorization` 和 `selected`
|
|
13
|
+
当次调用只以 typed result 的 `mode=external`、`authorization` 和 `selected` 为机器分支依据。持久化 `pr_delivery_fact` 保存已验证绑定及 provenance;它不表示本次调用创建了 PR,也不能单独授权跳过 lifecycle。
|
|
14
14
|
|
|
15
|
-
成功绑定会原子写入
|
|
15
|
+
成功绑定会原子写入 `pr_delivery_fact` 并追加 `Bind External PR` Activity Log,记录授权来源、Issue、PR URL/编号、base/head repository/ref/SHA、合并时间和 merge commit。相同完整证据重试为 no-op;已有同号但缺审计签名时补写一次;编号或身份变化失败。不得调用 PR create 路径。
|
|
16
16
|
|
|
17
17
|
外部模式仍须通过身份、required-PR、本地生命周期与终态校验;review ledger、manual validation、post-review commit 和平台同步等外围证据在 lifecycle 后作为 warning/pending steps 投影。无 canonical review-code 时仅沿用 verifier 已定义的 N/A 规则;`--force` 不解除身份、本地原子性或 required-PR 硬门禁。
|
|
@@ -6,7 +6,7 @@ description: >
|
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# Create Pull Request
|
|
9
|
-
> `--agent` values
|
|
9
|
+
> `--agent` values are defined in `.agents/rules/task-management.md` under “Collaborator Token Specification”.
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
Create a Pull Request and, when task-related, sync the essential metadata and reviewer summary immediately.
|
|
@@ -19,7 +19,7 @@ Version stamp rule: when creating or updating `task.md` frontmatter, read `.agen
|
|
|
19
19
|
|
|
20
20
|
## Task Context Resolution
|
|
21
21
|
|
|
22
|
-
> The entry point may omit the task ref
|
|
22
|
+
> The entry point may omit the task ref; explicit task scope accepts only `--task <ref>` or `-t <ref>`, and positional task refs are not interpreted. Preserve every other business operand, then call `agent-infra-internal task-context resolve {task-scope}` where `{task-scope}` is empty or one task flag. Read only `taskId` from the structured result and bind `{task-id}` to the full `TASK-YYYYMMDD-HHMMSS` for downstream commands. Pass through resolution failures without scanning tasks locally.
|
|
23
23
|
|
|
24
24
|
## Step Start: started Marker
|
|
25
25
|
|
|
@@ -33,7 +33,7 @@ On a real `platform-pr create`, the typed core idempotently records `Create PR [
|
|
|
33
33
|
|
|
34
34
|
Branch on the result:
|
|
35
35
|
- absent / `"required"` -> continue to Step 1 below
|
|
36
|
-
- `"disabled"` -> output the message below and **stop immediately**. Do not run any subsequent numbered step, do not trigger any PR-creation command, do not modify `
|
|
36
|
+
- `"disabled"` -> output the message below and **stop immediately**. Do not run any subsequent numbered step, do not trigger any PR-creation command, do not modify `pr_delivery_fact` in `task.md`, and do not publish a PR summary comment:
|
|
37
37
|
|
|
38
38
|
Populate `{next-step-commands}` for this scenario by running `agent-infra-internal agent-client next-steps --skill complete-task --task-ref {task-ref}`.
|
|
39
39
|
|
|
@@ -45,9 +45,7 @@ No Pull Request is required; run instead:
|
|
|
45
45
|
|
|
46
46
|
### 1. Parse Command Arguments
|
|
47
47
|
|
|
48
|
-
|
|
49
|
-
- arguments matching `TASK-{yyyyMMdd-HHmmss}` -> `{task-id}`
|
|
50
|
-
- remaining arguments -> `{target-branch}`
|
|
48
|
+
Parse the task scope first: an optional `--task <ref>` or `-t <ref>` selects `{task-id}`; a positional task ref is not interpreted. The remaining positional argument, when present, is `{target-branch}`.
|
|
51
49
|
|
|
52
50
|
If `{task-id}` is provided, read `.agents/workspace/active/{task-id}/task.md` to load task metadata such as `issue_number` and `type`.
|
|
53
51
|
If `{task-id}` is omitted, try to resolve it from the current session context; if it still cannot be determined, skip task-association logic in later steps.
|
|
@@ -66,7 +64,7 @@ Read the PR template through `.agents/rules/issue-pr-commands.md`, review recent
|
|
|
66
64
|
|
|
67
65
|
### 4. Check Remote Branch State
|
|
68
66
|
|
|
69
|
-
|
|
67
|
+
Run `agent-infra-internal task-delivery {task-id} deliver --agent {standard-agent-token}` to deliver the task branch through one core. The core handles first creation, same-SHA no-op, a known-last-delivered SHA update with `--force-with-lease`, and unknown drift fail-closed. After delivery it verifies the remote SHA again and continues only when it equals local `HEAD`. Optional `--remote` / `--base` values must match the task binding. Core still rechecks the remote branch SHA before and immediately before bind, and requires exact repository/ref, base, and `head.sha` identity. A post-POST race never deletes the created PR or remote branch; the next retry recovers only by resource identity.
|
|
70
68
|
|
|
71
69
|
### 5. Create or Recover the PR
|
|
72
70
|
|
|
@@ -80,9 +78,9 @@ Capture the `result` field from `platform-pr create` (`pr_created`, `pr_reused`,
|
|
|
80
78
|
|
|
81
79
|
### 7. Generate the PR Code Change Report
|
|
82
80
|
|
|
83
|
-
After creating or uniquely reusing the PR, run `agent-infra-internal platform-pr inspect {task-id}` to obtain the authoritative base/head SHAs, then follow `reference/change-report.md` to classify the complete PR
|
|
81
|
+
After creating or uniquely reusing the PR, run `agent-infra-internal platform-pr inspect {task-id}` to obtain the authoritative base/head SHAs, then follow `reference/change-report.md` to classify the complete PR line counts, Git blob byte sizes, renames, and potentially unnecessary changes. Read that reference before this step.
|
|
84
82
|
|
|
85
|
-
The report is part of the reviewer summary below and must also appear in the final user response. Do not provide only
|
|
83
|
+
The report is part of the reviewer summary below and must also appear in the final user response. Do not provide only total lines, omit byte changes, or inspect only the last commit.
|
|
86
84
|
|
|
87
85
|
### 8. Publish the Review Summary
|
|
88
86
|
|
|
@@ -94,7 +92,7 @@ Aggregate a reviewer-facing summary from those artifacts, append the `### PR Cod
|
|
|
94
92
|
|
|
95
93
|
### 9. Confirm Task Status
|
|
96
94
|
|
|
97
|
-
After a PR is created or uniquely recovered, `platform-pr create` atomically updates
|
|
95
|
+
After a PR is created or uniquely recovered, `platform-pr create` atomically updates the verified `pr_delivery_fact`, canonical time/version metadata, and the Create PR completion log through the task write core. The caller verifies the structured result and does not edit the fact again.
|
|
98
96
|
|
|
99
97
|
### 10. Verification Gate
|
|
100
98
|
|
|
@@ -150,5 +148,5 @@ Next step (alternative) - Skip active monitoring and attempt completion:
|
|
|
150
148
|
- Push rejected: suggest `git pull --rebase`
|
|
151
149
|
- Existing PR found: show the current PR URL and stop
|
|
152
150
|
- Inaccessible Issue metadata: skip inheritance and continue
|
|
153
|
-
- PR creation failed with an associated `{task-id}`: run `agent-infra-internal task-warning {task-id} add --step create-pr --severity ACTION_REQUIRED --code PR_CREATE_FAILED --target pr --message "{reason}" --action "Fix push, permission, or platform issues and rerun create-pr"` to submit a structured warning intent, and do not write `
|
|
151
|
+
- PR creation failed with an associated `{task-id}`: run `agent-infra-internal task-warning {task-id} add --step create-pr --severity ACTION_REQUIRED --code PR_CREATE_FAILED --target pr --message "{reason}" --action "Fix push, permission, or platform issues and rerun create-pr"` to submit a structured warning intent, and do not write an incomplete `pr_delivery_fact`
|
|
154
152
|
- PR summary comment failed with an associated `{task-id}`: record a `COMMENT_SYNC_FAILED` warning per `.agents/rules/pr-sync.md`, without rolling back an already-created PR
|
|
@@ -6,7 +6,7 @@ description: >
|
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# 创建 Pull Request
|
|
9
|
-
> `--agent` 取值见 `.agents/rules/task-management.md`「合作者 token
|
|
9
|
+
> `--agent` 取值见 `.agents/rules/task-management.md`「合作者 token 规范」。
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
创建 Pull Request,并在与任务关联时立即补齐核心元数据和 reviewer 摘要。
|
|
@@ -19,7 +19,7 @@ description: >
|
|
|
19
19
|
|
|
20
20
|
## 任务上下文解析
|
|
21
21
|
|
|
22
|
-
>
|
|
22
|
+
> 入口可省略 task ref;显式 task scope 仅接受 `--task <ref>` 或 `-t <ref>`,不再解释位置 task ref。保留其余业务操作数后调用 `agent-infra-internal task-context resolve {task-scope}`;`{task-scope}` 为空或 task flag 之一。只读取结构化结果的 `taskId`,后续把 `{task-id}` 绑定为完整 `TASK-YYYYMMDD-HHMMSS`。解析失败时透传非零退出码,不自行扫描任务。
|
|
23
23
|
|
|
24
24
|
## 步骤开始:started 标记
|
|
25
25
|
|
|
@@ -33,7 +33,7 @@ description: >
|
|
|
33
33
|
|
|
34
34
|
按读取结果分支:
|
|
35
35
|
- 缺省 / `"required"` → 继续到下方第 1 步
|
|
36
|
-
- `"disabled"` → 输出以下消息后**立即停止**,不要执行任何后续编号步骤、不要触发任何 PR 创建命令、不要修改 `task.md` 的 `
|
|
36
|
+
- `"disabled"` → 输出以下消息后**立即停止**,不要执行任何后续编号步骤、不要触发任何 PR 创建命令、不要修改 `task.md` 的 `pr_delivery_fact`、不要发布 PR 摘要评论:
|
|
37
37
|
|
|
38
38
|
使用 `agent-infra-internal agent-client next-steps --skill complete-task --task-ref {task-ref}` 生成本场景的 `{next-step-commands}`。
|
|
39
39
|
|
|
@@ -45,9 +45,7 @@ description: >
|
|
|
45
45
|
|
|
46
46
|
### 1. 解析命令参数
|
|
47
47
|
|
|
48
|
-
|
|
49
|
-
- 匹配 `TASK-{yyyyMMdd-HHmmss}` 格式的参数 -> `{task-id}`
|
|
50
|
-
- 其余参数 -> `{target-branch}`
|
|
48
|
+
先解析 task scope:可选的 `--task <ref>` 或 `-t <ref>` 绑定 `{task-id}`;位置 task ref 不再解释。剩余的可选位置参数绑定为 `{target-branch}`。
|
|
51
49
|
|
|
52
50
|
如果提供了 `{task-id}`,读取 `.agents/workspace/active/{task-id}/task.md` 获取任务信息(例如 `issue_number`、`type` 等)。
|
|
53
51
|
如果未提供,可从当前 session 上下文获取;仍无法确定 `{task-id}` 时,后续步骤中的任务关联逻辑跳过。
|
|
@@ -66,7 +64,7 @@ description: >
|
|
|
66
64
|
|
|
67
65
|
### 4. 检查远程分支状态
|
|
68
66
|
|
|
69
|
-
调用 `agent-infra-internal
|
|
67
|
+
调用 `agent-infra-internal task-delivery {task-id} deliver --agent {standard-agent-token}` 统一交付任务分支。该 core 负责首次创建、相同 SHA no-op、已知最近交付 SHA 的 `--force-with-lease` 更新和未知漂移 fail-closed;交付成功后再次复核远端 SHA,并只在远端 branch SHA 等于本地 `HEAD` 时继续。可选的 `--remote` / `--base` 必须与任务已绑定值一致。随后在 locate/create/bind 前后再次读取远端 branch SHA,并要求 PR 的精确 repository/ref、base 和 `head.sha` 全部匹配;POST 后的竞态不自动删除已创建 PR 或远端 branch,下一次只按资源身份恢复。
|
|
70
68
|
|
|
71
69
|
### 5. 创建或恢复 PR
|
|
72
70
|
|
|
@@ -80,9 +78,9 @@ description: >
|
|
|
80
78
|
|
|
81
79
|
### 7. 生成 PR 代码增减报告
|
|
82
80
|
|
|
83
|
-
创建或唯一复用 PR 后,调用 `agent-infra-internal platform-pr inspect {task-id}` 取得权威 base/head SHA,并按 `reference/change-report.md` 统计完整 PR
|
|
81
|
+
创建或唯一复用 PR 后,调用 `agent-infra-internal platform-pr inspect {task-id}` 取得权威 base/head SHA,并按 `reference/change-report.md` 统计完整 PR 的分类行数、Git blob 字节数、rename 与疑似不必要变化。执行本步骤前先读取该 reference。
|
|
84
82
|
|
|
85
|
-
报告既是下方 reviewer
|
|
83
|
+
报告既是下方 reviewer 摘要的一部分,也必须出现在最终用户回复中;不得只给总行数、忽略字节变化或只统计最后一个 commit。
|
|
86
84
|
|
|
87
85
|
### 8. 发布审查摘要
|
|
88
86
|
|
|
@@ -94,7 +92,7 @@ description: >
|
|
|
94
92
|
|
|
95
93
|
### 9. 确认任务状态
|
|
96
94
|
|
|
97
|
-
`platform-pr create` 在成功创建或恢复唯一远端身份后,通过任务写入内核原子更新 `
|
|
95
|
+
`platform-pr create` 在成功创建或恢复唯一远端身份后,通过任务写入内核原子更新 verified `pr_delivery_fact`、规范时间/版本和 Create PR 完成日志。调用方只核对结构化结果,不再次编辑 fact。
|
|
98
96
|
|
|
99
97
|
### 10. 完成校验
|
|
100
98
|
|
|
@@ -151,5 +149,5 @@ agent-infra-internal task-verify {task-id} create-pr.completed --format text
|
|
|
151
149
|
- 推送被拒绝:建议执行 `git pull --rebase`
|
|
152
150
|
- 已存在 PR:直接输出当前 PR URL 并结束
|
|
153
151
|
- 无法访问 Issue 元数据:跳过继承并继续
|
|
154
|
-
- PR 创建失败且已关联 `{task-id}`:调用 `agent-infra-internal task-warning {task-id} add --step create-pr --severity ACTION_REQUIRED --code PR_CREATE_FAILED --target pr --message "{reason}" --action "修复推送、权限或平台问题后重跑 create-pr"` 提交结构化 warning
|
|
152
|
+
- PR 创建失败且已关联 `{task-id}`:调用 `agent-infra-internal task-warning {task-id} add --step create-pr --severity ACTION_REQUIRED --code PR_CREATE_FAILED --target pr --message "{reason}" --action "修复推送、权限或平台问题后重跑 create-pr"` 提交结构化 warning 意图,不写不完整 `pr_delivery_fact`
|
|
155
153
|
- PR 摘要评论失败且已关联 `{task-id}`:按 `.agents/rules/pr-sync.md` 记录 `COMMENT_SYNC_FAILED` 告警,不回滚已创建 PR
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# PR Code Change Report
|
|
2
2
|
|
|
3
3
|
<!-- pr-change-report-contract
|
|
4
|
-
{"
|
|
4
|
+
{"source":"platform-pr-inspect","diff":"three-dot-find-renames","metrics":["numstat-lines","git-blob-bytes"],"publish":["pr-summary","user-response"]}
|
|
5
5
|
-->
|
|
6
6
|
|
|
7
7
|
After a PR is created or uniquely reused, use the authoritative `base.sha` and `head.sha` returned by `platform-pr inspect` to measure the complete PR diff. Do not substitute the last commit or current worktree state.
|
|
@@ -9,12 +9,14 @@ After a PR is created or uniquely reused, use the authoritative `base.sha` and `
|
|
|
9
9
|
## Evidence Commands
|
|
10
10
|
|
|
11
11
|
```bash
|
|
12
|
-
|
|
12
|
+
node .agents/skills/create-pr/scripts/change-report.mjs --base {base-sha} --head {head-sha}
|
|
13
13
|
git diff --find-renames --name-status {base-sha}...{head-sha}
|
|
14
14
|
git diff --find-renames --summary {base-sha}...{head-sha}
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
The script calculates both `numstat` line counts and exact Git blob byte sizes between the merge base and head. Bytes provide a stable unit, cover binary files, and reveal same-line compaction; submodules are not blobs and contribute zero bytes. Added files have zero old bytes, deleted files have zero new bytes, pure renames have zero net bytes, and copies count only the new destination content.
|
|
18
|
+
|
|
19
|
+
Count binary files in the file total but do not invent line counts for `-` numstat values. Explain renames and copies from the script's per-file records, `name-status`, and `summary` so moves are not reported as full rewrites.
|
|
18
20
|
|
|
19
21
|
## Classification and Reconciliation
|
|
20
22
|
|
|
@@ -27,13 +29,16 @@ Using the repository's actual structure, assign every file to exactly one closes
|
|
|
27
29
|
- Documentation
|
|
28
30
|
- Configuration, dependencies, and other files
|
|
29
31
|
|
|
30
|
-
The table must contain component, file count,
|
|
32
|
+
The table must contain component, file count, added lines, deleted lines, net lines, old bytes, new bytes, and net bytes, followed by a total row. Byte columns describe the blob content size of files involved in this change, not disk usage for the entire repository or worktree. Use exact integers; optional KiB/MiB values may aid readability but must not replace byte counts.
|
|
33
|
+
|
|
34
|
+
Category line and byte totals must each reconcile exactly with the script's `totals`. Then list the largest files by line change and absolute net-byte change, distinguishing source, tests, template mirrors, and pure renames.
|
|
31
35
|
|
|
32
36
|
## Required Analysis
|
|
33
37
|
|
|
34
38
|
Briefly explain:
|
|
35
39
|
|
|
36
40
|
- where growth is concentrated and how runtime code compares with tests, docs, and templates;
|
|
41
|
+
- whether net line and net byte changes tell different stories, especially for substantial same-line compaction or expansion;
|
|
37
42
|
- which line changes are path moves, bilingual mirrors, or mechanical synchronization;
|
|
38
43
|
- whether any change cannot be traced directly to the PR goal and may be unnecessary; if none, state the evidence;
|
|
39
44
|
- when a test fixture is much larger than production changes, what risk it covers instead of judging it only by size.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# PR 代码增减报告
|
|
2
2
|
|
|
3
3
|
<!-- pr-change-report-contract
|
|
4
|
-
{"
|
|
4
|
+
{"source":"platform-pr-inspect","diff":"three-dot-find-renames","metrics":["numstat-lines","git-blob-bytes"],"publish":["pr-summary","user-response"]}
|
|
5
5
|
-->
|
|
6
6
|
|
|
7
7
|
PR 创建或复用成功后,使用 `platform-pr inspect` 返回的权威 `base.sha` 与 `head.sha` 统计完整 PR 差异,不以最后一个 commit 或工作树状态代替。
|
|
@@ -9,12 +9,14 @@ PR 创建或复用成功后,使用 `platform-pr inspect` 返回的权威 `base
|
|
|
9
9
|
## 证据命令
|
|
10
10
|
|
|
11
11
|
```bash
|
|
12
|
-
|
|
12
|
+
node .agents/skills/create-pr/scripts/change-report.mjs --base {base-sha} --head {head-sha}
|
|
13
13
|
git diff --find-renames --name-status {base-sha}...{head-sha}
|
|
14
14
|
git diff --find-renames --summary {base-sha}...{head-sha}
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
-
`numstat`
|
|
17
|
+
脚本在 merge base 与 head 之间同时计算 `numstat` 行数和 Git blob 的精确字节数。字节比字符具有稳定口径,也能覆盖二进制文件和同行内缩减;子模块不是 blob,按 0 字节贡献核算。新增文件的旧字节数为 0,删除文件的新字节数为 0,纯 rename 的净字节数为 0,copy 只计新增目标内容。
|
|
18
|
+
|
|
19
|
+
`numstat` 中的二进制文件计入文件数,但不虚构行数。rename/copy 依据脚本的逐文件记录、`name-status` 与 `summary` 单独说明,避免把移动误报为整文件重写。
|
|
18
20
|
|
|
19
21
|
## 分类与核算
|
|
20
22
|
|
|
@@ -27,13 +29,16 @@ git diff --find-renames --summary {base-sha}...{head-sha}
|
|
|
27
29
|
- 文档
|
|
28
30
|
- 配置、依赖与其他
|
|
29
31
|
|
|
30
|
-
|
|
32
|
+
输出表格必须包含“部分、文件数、新增行、删除行、净增行、旧字节、新字节、净字节”,并有合计行。字节列表示本次变更涉及文件的 blob 内容体积,不表示整个仓库或工作树的磁盘占用。使用精确整数;可附加 KiB/MiB 便于阅读,但不能替代字节数。
|
|
33
|
+
|
|
34
|
+
各类别的行数和字节数之和必须分别与脚本的 `totals` 一致。随后分别列出行数变化和绝对净字节变化最大的文件,并区分源码、测试、模板镜像和纯 rename。
|
|
31
35
|
|
|
32
36
|
## 分析要求
|
|
33
37
|
|
|
34
38
|
用简短结论回答:
|
|
35
39
|
|
|
36
40
|
- 增长主要集中在哪里,运行时代码与测试/文档/模板各占多少;
|
|
41
|
+
- 行数净变化与净字节变化是否给出不同结论,尤其指出同行内明显缩减或膨胀;
|
|
37
42
|
- 哪些行数只是路径迁移、双语镜像或机械同步;
|
|
38
43
|
- 是否存在与 PR 目标无法直接对应、疑似不必要的变化;若没有,明确说明判断依据;
|
|
39
44
|
- 若某个测试 fixture 明显大于生产改动,解释它覆盖的风险,而不是仅以行数评价。
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import { execFileSync } from "node:child_process";
|
|
2
|
+
|
|
3
|
+
function fail(message) {
|
|
4
|
+
process.stderr.write(`${message}\n`);
|
|
5
|
+
process.exit(1);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
function parseArgs(argv) {
|
|
9
|
+
const options = { cwd: process.cwd() };
|
|
10
|
+
|
|
11
|
+
for (let index = 0; index < argv.length; index += 1) {
|
|
12
|
+
const argument = argv[index];
|
|
13
|
+
const value = argv[index + 1];
|
|
14
|
+
|
|
15
|
+
if ((argument === "--base" || argument === "--head" || argument === "--cwd") && value) {
|
|
16
|
+
options[argument.slice(2)] = value;
|
|
17
|
+
index += 1;
|
|
18
|
+
continue;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
fail(`Unknown or incomplete argument: ${argument}`);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if (!options.base || !options.head) {
|
|
25
|
+
fail("Usage: change-report.mjs --base <sha> --head <sha> [--cwd <repository>]");
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return options;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function git(args, options, encoding = "utf8") {
|
|
32
|
+
return execFileSync("git", args, {
|
|
33
|
+
cwd: options.cwd,
|
|
34
|
+
encoding,
|
|
35
|
+
maxBuffer: 64 * 1024 * 1024
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function parseRawDiff(buffer) {
|
|
40
|
+
const tokens = buffer.toString("utf8").split("\0");
|
|
41
|
+
const files = [];
|
|
42
|
+
|
|
43
|
+
for (let index = 0; index < tokens.length && tokens[index];) {
|
|
44
|
+
const header = tokens[index++];
|
|
45
|
+
const [oldMode, newMode, oldOid, newOid, status] = header.slice(1).split(" ");
|
|
46
|
+
const firstPath = tokens[index++];
|
|
47
|
+
const hasPathPair = status.startsWith("R") || status.startsWith("C");
|
|
48
|
+
const secondPath = hasPathPair ? tokens[index++] : firstPath;
|
|
49
|
+
|
|
50
|
+
files.push({
|
|
51
|
+
status,
|
|
52
|
+
oldMode,
|
|
53
|
+
newMode,
|
|
54
|
+
oldOid,
|
|
55
|
+
newOid,
|
|
56
|
+
oldPath: status.startsWith("A") ? null : firstPath,
|
|
57
|
+
newPath: status.startsWith("D") ? null : secondPath
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return files;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function parseNumstat(buffer) {
|
|
65
|
+
const tokens = buffer.toString("utf8").split("\0");
|
|
66
|
+
const stats = new Map();
|
|
67
|
+
|
|
68
|
+
for (let index = 0; index < tokens.length && tokens[index];) {
|
|
69
|
+
const record = tokens[index++];
|
|
70
|
+
const firstTab = record.indexOf("\t");
|
|
71
|
+
const secondTab = record.indexOf("\t", firstTab + 1);
|
|
72
|
+
const additions = record.slice(0, firstTab);
|
|
73
|
+
const deletions = record.slice(firstTab + 1, secondTab);
|
|
74
|
+
const path = record.slice(secondTab + 1);
|
|
75
|
+
|
|
76
|
+
if (path) {
|
|
77
|
+
stats.set(`path:${path}`, { additions, deletions });
|
|
78
|
+
continue;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const oldPath = tokens[index++];
|
|
82
|
+
const newPath = tokens[index++];
|
|
83
|
+
stats.set(`pair:${oldPath}\0${newPath}`, { additions, deletions });
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return stats;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function objectSizes(files, options) {
|
|
90
|
+
const objectIds = new Set();
|
|
91
|
+
|
|
92
|
+
for (const file of files) {
|
|
93
|
+
if (file.oldMode !== "000000" && file.oldMode !== "160000" && !file.status.startsWith("C")) {
|
|
94
|
+
objectIds.add(file.oldOid);
|
|
95
|
+
}
|
|
96
|
+
if (file.newMode !== "000000" && file.newMode !== "160000") {
|
|
97
|
+
objectIds.add(file.newOid);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
if (objectIds.size === 0) return new Map();
|
|
102
|
+
|
|
103
|
+
const ids = [...objectIds];
|
|
104
|
+
const output = execFileSync(
|
|
105
|
+
"git",
|
|
106
|
+
["cat-file", "--batch-check=%(objectname) %(objecttype) %(objectsize)"],
|
|
107
|
+
{
|
|
108
|
+
cwd: options.cwd,
|
|
109
|
+
input: `${ids.join("\n")}\n`,
|
|
110
|
+
encoding: "utf8",
|
|
111
|
+
maxBuffer: 64 * 1024 * 1024
|
|
112
|
+
}
|
|
113
|
+
);
|
|
114
|
+
const sizes = new Map();
|
|
115
|
+
|
|
116
|
+
for (const line of output.trim().split("\n")) {
|
|
117
|
+
const [oid, type, size] = line.split(" ");
|
|
118
|
+
if (type === "blob") sizes.set(oid, Number(size));
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
return sizes;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
function numericLineCount(value) {
|
|
125
|
+
return value === "-" ? null : Number(value);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
function main() {
|
|
129
|
+
const options = parseArgs(process.argv.slice(2));
|
|
130
|
+
const mergeBase = git(["merge-base", options.base, options.head], options).trim();
|
|
131
|
+
const diffArgs = ["diff", "--no-ext-diff", "--find-renames", "-z", mergeBase, options.head];
|
|
132
|
+
const files = parseRawDiff(git([...diffArgs.slice(0, 2), "--raw", "--abbrev=64", ...diffArgs.slice(2)], options, null));
|
|
133
|
+
const numstat = parseNumstat(git([...diffArgs.slice(0, 2), "--numstat", ...diffArgs.slice(2)], options, null));
|
|
134
|
+
const sizes = objectSizes(files, options);
|
|
135
|
+
|
|
136
|
+
const reportFiles = files.map((file) => {
|
|
137
|
+
const key = file.status.startsWith("R") || file.status.startsWith("C")
|
|
138
|
+
? `pair:${file.oldPath}\0${file.newPath}`
|
|
139
|
+
: `path:${file.newPath || file.oldPath}`;
|
|
140
|
+
const lines = numstat.get(key);
|
|
141
|
+
if (!lines) fail(`Missing numstat record for ${file.newPath || file.oldPath}`);
|
|
142
|
+
|
|
143
|
+
const oldBytes = file.oldMode === "000000" || file.oldMode === "160000" || file.status.startsWith("C")
|
|
144
|
+
? 0
|
|
145
|
+
: sizes.get(file.oldOid);
|
|
146
|
+
const newBytes = file.newMode === "000000" || file.newMode === "160000"
|
|
147
|
+
? 0
|
|
148
|
+
: sizes.get(file.newOid);
|
|
149
|
+
if (oldBytes === undefined || newBytes === undefined) {
|
|
150
|
+
fail(`Unable to resolve blob size for ${file.newPath || file.oldPath}`);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
return {
|
|
154
|
+
status: file.status,
|
|
155
|
+
oldPath: file.oldPath,
|
|
156
|
+
newPath: file.newPath,
|
|
157
|
+
additions: numericLineCount(lines.additions),
|
|
158
|
+
deletions: numericLineCount(lines.deletions),
|
|
159
|
+
oldBytes,
|
|
160
|
+
newBytes,
|
|
161
|
+
netBytes: newBytes - oldBytes
|
|
162
|
+
};
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
const totals = reportFiles.reduce((result, file) => {
|
|
166
|
+
result.files += 1;
|
|
167
|
+
result.oldBytes += file.oldBytes;
|
|
168
|
+
result.newBytes += file.newBytes;
|
|
169
|
+
result.netBytes += file.netBytes;
|
|
170
|
+
if (file.additions === null || file.deletions === null) {
|
|
171
|
+
result.binaryFiles += 1;
|
|
172
|
+
} else {
|
|
173
|
+
result.textFiles += 1;
|
|
174
|
+
result.additions += file.additions;
|
|
175
|
+
result.deletions += file.deletions;
|
|
176
|
+
}
|
|
177
|
+
return result;
|
|
178
|
+
}, {
|
|
179
|
+
files: 0,
|
|
180
|
+
textFiles: 0,
|
|
181
|
+
binaryFiles: 0,
|
|
182
|
+
additions: 0,
|
|
183
|
+
deletions: 0,
|
|
184
|
+
oldBytes: 0,
|
|
185
|
+
newBytes: 0,
|
|
186
|
+
netBytes: 0
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
process.stdout.write(`${JSON.stringify({
|
|
190
|
+
version: 1,
|
|
191
|
+
base: options.base,
|
|
192
|
+
head: options.head,
|
|
193
|
+
mergeBase,
|
|
194
|
+
files: reportFiles,
|
|
195
|
+
totals
|
|
196
|
+
}, null, 2)}\n`);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
try {
|
|
200
|
+
main();
|
|
201
|
+
} catch (error) {
|
|
202
|
+
fail(error instanceof Error ? error.message : String(error));
|
|
203
|
+
}
|
|
@@ -109,13 +109,12 @@ If no historical release notes exist, use the following default Markdown format:
|
|
|
109
109
|
- Commit co-authors from the typed context's commit `authors`
|
|
110
110
|
- Issue reporters from typed `closingIssues[].author`
|
|
111
111
|
- **Contribution count**: `PR count + co-authored commit count` for the same identity, merged across both sources
|
|
112
|
-
-
|
|
113
|
-
- For `platform-user` or `platform-noreply`, use the lowercased `login`
|
|
114
|
-
-
|
|
115
|
-
-
|
|
116
|
-
- Merge all Name variants that map to the same login before counting and sorting; for example, `Claude` and `Claude Opus 4.6 (1M context)` should both collapse into `@claude`
|
|
112
|
+
- **`@login` mapping**: follow the identity safety boundary in `.agents/rules/release-commands.md`
|
|
113
|
+
- For `platform-user` or `platform-noreply` with a non-empty `login`, use the lowercased `login`
|
|
114
|
+
- Exclude `unresolved` identities from the contributor list; never infer a login from a name, email address, domain, brand, or same-named platform account
|
|
115
|
+
- Merge all Name variants carrying the same typed login before counting and sorting
|
|
117
116
|
- Preserve bot identities as-is, for example `dependabot[bot]`
|
|
118
|
-
-
|
|
117
|
+
- Do not add unresolved identity emails, placeholder mentions, or identity-verification TODOs to publishable notes
|
|
119
118
|
- **Sorting**: descending by contribution count, then lexicographically by login for ties
|
|
120
119
|
- **Deduplication**: use the final mapped `@login` as the key
|
|
121
120
|
- **Issue reporter rules**:
|
|
@@ -109,13 +109,12 @@ agent-infra-internal platform-release-notes context \
|
|
|
109
109
|
- Commit co-authors:来自步骤 3 typed context 的 commit `authors`
|
|
110
110
|
- Issue reporters:来自步骤 3 typed context 的 `closingIssues[].author`
|
|
111
111
|
- **贡献数定义**:`该人的 PR 数 + 该人作为 co-author 的 commit 数`(同一身份跨来源合并计数)
|
|
112
|
-
-
|
|
113
|
-
- `resolution` 为 `platform-user` 或 `platform-noreply`
|
|
114
|
-
-
|
|
115
|
-
-
|
|
116
|
-
- 同一 login 的所有 Name 变体都必须归并后再计数与排序;例如 `Claude` 与 `Claude Opus 4.6 (1M context)` 都映射到 `@claude` 时,应先合并为同一个贡献者
|
|
112
|
+
- **`@login` 映射**:遵循 `.agents/rules/release-commands.md` 的身份安全边界
|
|
113
|
+
- `resolution` 为 `platform-user` 或 `platform-noreply` 且 `login` 非空时,采用小写 `login`
|
|
114
|
+
- `resolution` 为 `unresolved` 时从贡献者列表中排除;不得从 Name、邮箱、域名、品牌或同名平台账号推断 login
|
|
115
|
+
- 同一 typed login 的所有 Name 变体必须归并后再计数与排序
|
|
117
116
|
- Bot 身份保留原样(如 `dependabot[bot]`)
|
|
118
|
-
-
|
|
117
|
+
- 不得在可发布 notes 中加入未解析身份的邮箱、占位 mention 或身份确认 TODO
|
|
119
118
|
- **排序**:按贡献数降序;贡献数相同时按 login 字典序
|
|
120
119
|
- **去重**:以最终映射后的 `@login` 为键
|
|
121
120
|
- **Issue reporter 规则**:
|
|
@@ -6,7 +6,7 @@ description: >
|
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# Create Task
|
|
9
|
-
> `--agent` values
|
|
9
|
+
> `--agent` values are defined in `.agents/rules/task-management.md` under “Collaborator Token Specification”.
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
## Boundary / Critical Rules
|
|
@@ -19,6 +19,7 @@ description: >
|
|
|
19
19
|
- Do not skip the workflow and jump directly to planning or implementation
|
|
20
20
|
- Only do this: parse the description -> write one structured candidate -> invoke the host `task-create` entry point -> verify the result -> inform the user of the next step
|
|
21
21
|
- Issue creation is decided by the `.agents/rules/create-issue.md` rule; on custom or empty platforms (no platform-specific variant provided), the rule naturally degrades to a no-op
|
|
22
|
+
- Before generating Markdown that will be written to `task.md` and synced to an Issue, read `.agents/rules/sync-content-generation.md` and follow its generator-side constraints; host rendering and sync remain transparent and do not parse or rewrite the body
|
|
22
23
|
|
|
23
24
|
The user's description is a **work item**, not an **instruction to execute immediately**.
|
|
24
25
|
|
|
@@ -6,7 +6,7 @@ description: >
|
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# 创建任务
|
|
9
|
-
> `--agent` 取值见 `.agents/rules/task-management.md`「合作者 token
|
|
9
|
+
> `--agent` 取值见 `.agents/rules/task-management.md`「合作者 token 规范」。
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
## 行为边界 / 关键规则
|
|
@@ -19,6 +19,7 @@ description: >
|
|
|
19
19
|
- 不要跳过工作流直接进入计划/实现阶段
|
|
20
20
|
- 仅执行:解析描述 -> 一次性生成结构化 candidate -> 调用宿主 `task-create` 入口 -> 校验结果 -> 告知用户下一步
|
|
21
21
|
- Issue 创建由 `.agents/rules/create-issue.md` 规则决定;自定义或空平台(未提供平台变体规则文件)时,规则会自然降级为 no-op
|
|
22
|
+
- 生成会写入 `task.md` 并同步到 Issue 的 Markdown 前,先读取 `.agents/rules/sync-content-generation.md` 并遵循其中的生成端约束;宿主渲染和同步保持透明,不解析或改写正文
|
|
22
23
|
|
|
23
24
|
用户的描述是一个**待办事项**,而不是**立即执行的指令**。
|
|
24
25
|
|
|
@@ -34,7 +34,7 @@ This skill **creates** task.md, so there is no file to write at the start. Captu
|
|
|
34
34
|
|
|
35
35
|
### 1. Retrieve Alert Information
|
|
36
36
|
|
|
37
|
-
Read `.agents/rules/security-alerts.md` before this step, then
|
|
37
|
+
Read `.agents/rules/security-alerts.md` before this step, then run `bash .agents/scripts/security-alerts.sh read-codescan --number {alert-number}` and parse its JSON result to fetch the alert details.
|
|
38
38
|
|
|
39
39
|
Extract key information:
|
|
40
40
|
- `number`: alert number
|
|
@@ -34,7 +34,7 @@ description: >
|
|
|
34
34
|
|
|
35
35
|
### 1. 获取告警信息
|
|
36
36
|
|
|
37
|
-
执行前先读取 `.agents/rules/security-alerts.md
|
|
37
|
+
执行前先读取 `.agents/rules/security-alerts.md`,然后运行 `bash .agents/scripts/security-alerts.sh read-codescan --number {alert-number}`,解析其 JSON 结果获取告警详情。
|
|
38
38
|
|
|
39
39
|
提取关键信息:
|
|
40
40
|
- `number`:告警编号
|
|
@@ -34,7 +34,7 @@ This skill **creates** task.md, so there is no file to write at the start. Captu
|
|
|
34
34
|
|
|
35
35
|
### 1. Retrieve Alert Information
|
|
36
36
|
|
|
37
|
-
Read `.agents/rules/security-alerts.md` before this step, then
|
|
37
|
+
Read `.agents/rules/security-alerts.md` before this step, then run `bash .agents/scripts/security-alerts.sh read-dependabot --number {alert-number}` and parse its JSON result to fetch the alert details.
|
|
38
38
|
|
|
39
39
|
Extract key information:
|
|
40
40
|
- `number`: alert number
|
|
@@ -34,7 +34,7 @@ description: >
|
|
|
34
34
|
|
|
35
35
|
### 1. 获取告警信息
|
|
36
36
|
|
|
37
|
-
执行前先读取 `.agents/rules/security-alerts.md
|
|
37
|
+
执行前先读取 `.agents/rules/security-alerts.md`,然后运行 `bash .agents/scripts/security-alerts.sh read-dependabot --number {alert-number}`,解析其 JSON 结果获取告警详情。
|
|
38
38
|
|
|
39
39
|
提取关键信息:
|
|
40
40
|
- `number`:告警编号
|
|
@@ -6,7 +6,7 @@ description: >
|
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# Import Issue
|
|
9
|
-
> `--agent` values
|
|
9
|
+
> `--agent` values are defined in `.agents/rules/task-management.md` under “Collaborator Token Specification”.
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
Import the specified Issue and create a task. Argument: issue number.
|
|
@@ -6,7 +6,7 @@ description: >
|
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# 导入 Issue
|
|
9
|
-
> `--agent` 取值见 `.agents/rules/task-management.md`「合作者 token
|
|
9
|
+
> `--agent` 取值见 `.agents/rules/task-management.md`「合作者 token 规范」。
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
导入指定的 Issue 并创建任务。参数:issue 编号。
|