@fitlab-ai/agent-infra 0.9.1 → 0.9.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -11
- package/README.zh-CN.md +24 -11
- package/bin/cli.ts +12 -0
- package/dist/bin/cli.js +14 -0
- package/dist/bin/internal-cli.js +30 -0
- package/dist/lib/agent-client.js +163 -0
- package/dist/lib/agent-clients/adapter.js +337 -0
- package/dist/lib/agent-clients/adapters/antigravity-cli.js +64 -0
- package/dist/lib/agent-clients/adapters/claude-code.js +71 -0
- package/dist/lib/agent-clients/adapters/codex-sandbox.js +210 -0
- package/dist/lib/agent-clients/adapters/codex.js +63 -0
- package/dist/lib/agent-clients/adapters/index.js +20 -0
- package/dist/lib/agent-clients/adapters/opencode.js +73 -0
- package/dist/lib/agent-clients/config.js +215 -0
- package/dist/lib/agent-clients/custom-tuis.js +99 -0
- package/dist/lib/agent-clients/invocation.js +9 -0
- package/dist/lib/agent-clients/next-steps.js +47 -0
- package/dist/lib/agent-clients/project-assets.js +45 -0
- package/dist/lib/agent-clients/reconcile.js +236 -0
- package/dist/lib/agent-clients/registry.js +78 -0
- package/dist/lib/agent-clients/schema.js +75 -0
- package/dist/lib/agent-clients/tokens.js +49 -0
- package/dist/lib/agent-clients/types.js +29 -0
- package/dist/lib/builtin-tuis.js +9 -14
- package/dist/lib/defaults.json +85 -73
- package/dist/lib/git/review-snapshot.js +25 -10
- package/dist/lib/git/reviewed-commit-equivalence.js +110 -0
- package/dist/lib/git/workflow.js +54 -1
- package/dist/lib/init.js +47 -91
- package/dist/lib/internal/agent-client.js +174 -0
- package/dist/lib/internal/git-workflow.js +7 -2
- package/dist/lib/internal/platform-checks.js +3 -3
- package/dist/lib/internal/platform-comment.js +29 -2
- package/dist/lib/internal/platform-issue.js +7 -0
- package/dist/lib/internal/platform-pr-review.js +132 -0
- package/dist/lib/internal/platform-pr.js +20 -2
- package/dist/lib/internal/platform-release-notes.js +52 -16
- package/dist/lib/internal/pr-review-grade.js +140 -0
- package/dist/lib/internal/release-workflow.js +82 -20
- package/dist/lib/internal/task-activity.js +73 -0
- package/dist/lib/internal/task-event.js +17 -1
- package/dist/lib/internal/task-lifecycle.js +7 -0
- package/dist/lib/internal/task-orchestration.js +196 -0
- package/dist/lib/internal/task-review.js +70 -0
- package/dist/lib/merge.js +2 -1
- package/dist/lib/platform/adapters.js +45 -1
- package/dist/lib/platform/change-request-git-evidence.js +113 -0
- package/dist/lib/platform/completion-backfill.js +122 -0
- package/dist/lib/platform/issue-comments.js +3 -2
- package/dist/lib/platform/merged-pr-equivalence.js +156 -16
- package/dist/lib/platform/pr-checks.js +101 -50
- package/dist/lib/platform/pr-review.js +166 -0
- package/dist/lib/platform/pull-requests.js +432 -7
- package/dist/lib/platform/release-notes.js +85 -3
- package/dist/lib/platform/releases.js +1 -1
- package/dist/lib/platform/verification-required.js +8 -10
- package/dist/lib/pr-review/evidence-grading.js +229 -0
- package/dist/lib/prompt.js +15 -3
- package/dist/lib/release/channels.js +4 -1
- package/dist/lib/release/workflow.js +4 -2
- package/dist/lib/remove-dir.js +25 -0
- package/dist/lib/run/tui.js +11 -7
- package/dist/lib/sandbox/agent-client-reconciler.js +234 -0
- package/dist/lib/sandbox/clipboard/linux.js +2 -1
- package/dist/lib/sandbox/commands/create.js +76 -200
- package/dist/lib/sandbox/commands/enter.js +17 -1
- package/dist/lib/sandbox/commands/prune.js +2 -2
- package/dist/lib/sandbox/commands/rm.js +3 -2
- package/dist/lib/sandbox/commands/show.js +1 -1
- package/dist/lib/sandbox/config.js +21 -4
- package/dist/lib/sandbox/constants.js +3 -0
- package/dist/lib/sandbox/dockerfile.js +2 -1
- package/dist/lib/sandbox/managed-fs.js +10 -5
- package/dist/lib/sandbox/recovery.js +52 -36
- package/dist/lib/sandbox/shell.js +1 -1
- package/dist/lib/sandbox/tool-types.js +8 -0
- package/dist/lib/sandbox/tools.js +2 -126
- package/dist/lib/task/activity-intent.js +101 -0
- package/dist/lib/task/artifact-lifecycle.js +3 -50
- package/dist/lib/task/commands/decisions.js +50 -20
- package/dist/lib/task/commands/log.js +15 -14
- package/dist/lib/task/delegation-receipts.js +128 -0
- package/dist/lib/task/events.js +146 -8
- package/dist/lib/task/finalization-artifacts.js +35 -0
- package/dist/lib/task/lifecycle-execution.js +46 -0
- package/dist/lib/task/orchestration.js +784 -0
- package/dist/lib/task/review-artifacts.js +143 -59
- package/dist/lib/task/review-finalization.js +186 -0
- package/dist/lib/task/review-fingerprint.js +4 -0
- package/dist/lib/task/task-execution-lock.js +231 -0
- package/dist/lib/task/verification-checks.js +2 -1
- package/dist/lib/task/verification-engine.js +372 -28
- package/dist/lib/task/verification-review.js +1 -1
- package/dist/lib/task/verification.js +5 -2
- package/dist/lib/task/workspace-snapshot.js +46 -0
- package/dist/lib/update.js +42 -161
- package/lib/agent-client.ts +214 -0
- package/lib/agent-clients/adapter.ts +534 -0
- package/lib/agent-clients/adapters/antigravity-cli.ts +65 -0
- package/lib/agent-clients/adapters/claude-code.ts +79 -0
- package/lib/agent-clients/adapters/codex-sandbox.ts +245 -0
- package/lib/agent-clients/adapters/codex.ts +67 -0
- package/lib/agent-clients/adapters/index.ts +27 -0
- package/lib/agent-clients/adapters/opencode.ts +75 -0
- package/lib/agent-clients/config.ts +323 -0
- package/lib/agent-clients/custom-tuis.ts +149 -0
- package/lib/agent-clients/invocation.ts +19 -0
- package/lib/agent-clients/next-steps.ts +85 -0
- package/lib/agent-clients/project-assets.ts +96 -0
- package/lib/agent-clients/reconcile.ts +325 -0
- package/lib/agent-clients/registry.ts +154 -0
- package/lib/agent-clients/schema.ts +80 -0
- package/lib/agent-clients/tokens.ts +53 -0
- package/lib/agent-clients/types.ts +92 -0
- package/lib/benchmark/schemas/v1.0.0/case-manifest.schema.json +120 -0
- package/lib/benchmark/schemas/v1.0.0/common.schema.json +109 -0
- package/lib/benchmark/schemas/v1.0.0/grader-result.schema.json +160 -0
- package/lib/benchmark/schemas/v1.0.0/run-manifest.schema.json +122 -0
- package/lib/benchmark/schemas/v1.0.0/subject.schema.json +227 -0
- package/lib/builtin-tuis.ts +16 -15
- package/lib/defaults.json +24 -12
- package/lib/git/review-snapshot.ts +39 -9
- package/lib/git/reviewed-commit-equivalence.ts +135 -0
- package/lib/git/workflow.ts +66 -2
- package/lib/init.ts +53 -121
- package/lib/internal/agent-client.ts +186 -0
- package/lib/internal/git-workflow.ts +6 -2
- package/lib/internal/platform-checks.ts +4 -4
- package/lib/internal/platform-comment.ts +17 -2
- package/lib/internal/platform-issue.ts +4 -0
- package/lib/internal/platform-pr-review.ts +104 -0
- package/lib/internal/platform-pr.ts +14 -1
- package/lib/internal/platform-release-notes.ts +59 -16
- package/lib/internal/pr-review-grade.ts +130 -0
- package/lib/internal/release-workflow.ts +79 -20
- package/lib/internal/task-activity.ts +55 -0
- package/lib/internal/task-event.ts +9 -1
- package/lib/internal/task-lifecycle.ts +4 -0
- package/lib/internal/task-orchestration.ts +171 -0
- package/lib/internal/task-review.ts +70 -0
- package/lib/merge.ts +2 -1
- package/lib/platform/adapters.ts +169 -3
- package/lib/platform/change-request-git-evidence.ts +159 -0
- package/lib/platform/completion-backfill.ts +134 -0
- package/lib/platform/issue-comments.ts +3 -2
- package/lib/platform/merged-pr-equivalence.ts +178 -19
- package/lib/platform/pr-checks.ts +121 -66
- package/lib/platform/pr-review.ts +201 -0
- package/lib/platform/pull-requests.ts +529 -27
- package/lib/platform/release-notes.ts +100 -4
- package/lib/platform/releases.ts +1 -1
- package/lib/platform/verification-required.ts +12 -10
- package/lib/pr-review/evidence-grading.ts +318 -0
- package/lib/prompt.ts +16 -3
- package/lib/release/channels.ts +4 -1
- package/lib/release/workflow.ts +4 -3
- package/lib/remove-dir.ts +28 -0
- package/lib/run/tui.ts +12 -5
- package/lib/sandbox/agent-client-reconciler.ts +378 -0
- package/lib/sandbox/clipboard/linux.ts +2 -1
- package/lib/sandbox/commands/create.ts +111 -212
- package/lib/sandbox/commands/enter.ts +23 -1
- package/lib/sandbox/commands/prune.ts +2 -2
- package/lib/sandbox/commands/rm.ts +3 -2
- package/lib/sandbox/commands/show.ts +1 -1
- package/lib/sandbox/config.ts +31 -4
- package/lib/sandbox/constants.ts +6 -0
- package/lib/sandbox/dockerfile.ts +2 -1
- package/lib/sandbox/managed-fs.ts +18 -5
- package/lib/sandbox/recovery.ts +98 -67
- package/lib/sandbox/shell.ts +1 -1
- package/lib/sandbox/tool-types.ts +143 -0
- package/lib/sandbox/tools.ts +5 -157
- package/lib/server/server.schema.json +2 -2
- package/lib/task/activity-intent.ts +128 -0
- package/lib/task/artifact-lifecycle.ts +3 -39
- package/lib/task/commands/decisions.ts +53 -20
- package/lib/task/commands/log.ts +15 -14
- package/lib/task/delegation-receipts.ts +199 -0
- package/lib/task/events.ts +164 -11
- package/lib/task/finalization-artifacts.ts +58 -0
- package/lib/task/lifecycle-execution.ts +106 -0
- package/lib/task/orchestration.ts +1022 -0
- package/lib/task/review-artifacts.ts +201 -69
- package/lib/task/review-finalization.ts +306 -0
- package/lib/task/review-fingerprint.ts +5 -0
- package/lib/task/task-execution-lock.ts +296 -0
- package/lib/task/verification-checks.ts +2 -1
- package/lib/task/verification-engine.ts +424 -28
- package/lib/task/verification-review.ts +1 -0
- package/lib/task/verification.ts +8 -3
- package/lib/task/workspace-snapshot.ts +57 -0
- package/lib/update.ts +48 -184
- package/package.json +4 -4
- package/templates/.agents/QUICKSTART.en.md +25 -8
- package/templates/.agents/QUICKSTART.zh-CN.md +25 -8
- package/templates/.agents/README.en.md +29 -25
- package/templates/.agents/README.zh-CN.md +29 -25
- package/templates/.agents/hooks/lifecycle-delegation.js +75 -0
- package/templates/.agents/rules/README.en.md +2 -0
- package/templates/.agents/rules/README.zh-CN.md +2 -0
- package/templates/.agents/rules/commit-and-pr.en.md +1 -0
- package/templates/.agents/rules/commit-and-pr.zh-CN.md +1 -0
- package/templates/.agents/rules/create-issue.github.en.md +4 -2
- package/templates/.agents/rules/create-issue.github.zh-CN.md +4 -2
- package/templates/.agents/rules/human-decision-context.en.md +14 -12
- package/templates/.agents/rules/human-decision-context.zh-CN.md +14 -12
- package/templates/.agents/rules/issue-fields.github.en.md +3 -1
- package/templates/.agents/rules/issue-fields.github.zh-CN.md +3 -1
- package/templates/.agents/rules/issue-pr-commands.en.md +5 -3
- package/templates/.agents/rules/issue-pr-commands.github.en.md +5 -3
- package/templates/.agents/rules/issue-pr-commands.github.zh-CN.md +5 -3
- package/templates/.agents/rules/issue-pr-commands.zh-CN.md +5 -3
- package/templates/.agents/rules/issue-sync.github.en.md +7 -3
- package/templates/.agents/rules/issue-sync.github.zh-CN.md +8 -4
- package/templates/.agents/rules/lifecycle-orchestration.en.md +24 -0
- package/templates/.agents/rules/lifecycle-orchestration.zh-CN.md +24 -0
- package/templates/.agents/rules/milestone-inference.github.en.md +4 -2
- package/templates/.agents/rules/milestone-inference.github.zh-CN.md +4 -2
- package/templates/.agents/rules/next-step-output.en.md +18 -0
- package/templates/.agents/rules/next-step-output.zh-CN.md +18 -0
- package/templates/.agents/rules/no-mid-flow-questions.en.md +19 -0
- package/templates/.agents/rules/no-mid-flow-questions.zh-CN.md +19 -0
- package/templates/.agents/rules/pr-checks-commands.en.md +3 -3
- package/templates/.agents/rules/pr-checks-commands.github.en.md +2 -2
- package/templates/.agents/rules/pr-checks-commands.github.zh-CN.md +2 -2
- package/templates/.agents/rules/pr-checks-commands.zh-CN.md +3 -3
- package/templates/.agents/rules/pr-sync.en.md +3 -1
- package/templates/.agents/rules/pr-sync.github.en.md +11 -1
- package/templates/.agents/rules/pr-sync.github.zh-CN.md +11 -1
- package/templates/.agents/rules/pr-sync.zh-CN.md +3 -1
- package/templates/.agents/rules/release-commands.en.md +1 -1
- package/templates/.agents/rules/release-commands.github.en.md +21 -5
- package/templates/.agents/rules/release-commands.github.zh-CN.md +21 -5
- package/templates/.agents/rules/release-commands.zh-CN.md +1 -1
- package/templates/.agents/rules/review-handshake.en.md +4 -4
- package/templates/.agents/rules/review-handshake.zh-CN.md +4 -4
- package/templates/.agents/rules/review-method.en.md +113 -0
- package/templates/.agents/rules/review-method.zh-CN.md +98 -0
- package/templates/.agents/rules/task-management.en.md +11 -0
- package/templates/.agents/rules/task-management.zh-CN.md +11 -0
- package/templates/.agents/skills/analyze-task/SKILL.en.md +15 -12
- package/templates/.agents/skills/analyze-task/SKILL.zh-CN.md +15 -12
- package/templates/.agents/skills/block-task/SKILL.en.md +11 -9
- package/templates/.agents/skills/block-task/SKILL.zh-CN.md +11 -9
- package/templates/.agents/skills/cancel-task/SKILL.en.md +10 -8
- package/templates/.agents/skills/cancel-task/SKILL.zh-CN.md +11 -9
- package/templates/.agents/skills/check-task/SKILL.en.md +16 -16
- package/templates/.agents/skills/check-task/SKILL.zh-CN.md +16 -16
- package/templates/.agents/skills/close-codescan/SKILL.en.md +7 -5
- package/templates/.agents/skills/close-codescan/SKILL.zh-CN.md +7 -5
- package/templates/.agents/skills/close-dependabot/SKILL.en.md +7 -5
- package/templates/.agents/skills/close-dependabot/SKILL.zh-CN.md +7 -5
- package/templates/.agents/skills/code-task/SKILL.en.md +10 -7
- package/templates/.agents/skills/code-task/SKILL.zh-CN.md +13 -10
- package/templates/.agents/skills/code-task/reference/fix-mode.en.md +14 -16
- package/templates/.agents/skills/code-task/reference/fix-mode.zh-CN.md +14 -16
- package/templates/.agents/skills/code-task/reference/output-template.en.md +3 -3
- package/templates/.agents/skills/code-task/reference/output-template.zh-CN.md +3 -3
- package/templates/.agents/skills/commit/SKILL.en.md +13 -1
- package/templates/.agents/skills/commit/SKILL.zh-CN.md +13 -1
- package/templates/.agents/skills/commit/reference/commit-message.en.md +1 -1
- package/templates/.agents/skills/commit/reference/commit-message.zh-CN.md +1 -1
- package/templates/.agents/skills/commit/reference/issue-metadata-sync.en.md +1 -1
- package/templates/.agents/skills/commit/reference/issue-metadata-sync.zh-CN.md +1 -1
- package/templates/.agents/skills/commit/reference/pr-summary-sync.en.md +1 -1
- package/templates/.agents/skills/commit/reference/pr-summary-sync.zh-CN.md +1 -1
- package/templates/.agents/skills/commit/reference/task-status-update.en.md +24 -28
- package/templates/.agents/skills/commit/reference/task-status-update.zh-CN.md +24 -28
- package/templates/.agents/skills/complete-manual-validation/SKILL.en.md +6 -4
- package/templates/.agents/skills/complete-manual-validation/SKILL.zh-CN.md +6 -4
- package/templates/.agents/skills/complete-manual-validation/reference/summary-update.en.md +1 -1
- package/templates/.agents/skills/complete-manual-validation/reference/summary-update.zh-CN.md +1 -1
- package/templates/.agents/skills/complete-task/SKILL.en.md +23 -8
- package/templates/.agents/skills/complete-task/SKILL.zh-CN.md +23 -8
- package/templates/.agents/skills/complete-task/config/verify.en.json +1 -0
- package/templates/.agents/skills/complete-task/config/verify.zh-CN.json +1 -0
- package/templates/.agents/skills/complete-task/reference/external-delivery.en.md +17 -0
- package/templates/.agents/skills/complete-task/reference/external-delivery.zh-CN.md +17 -0
- package/templates/.agents/skills/create-pr/SKILL.en.md +13 -11
- package/templates/.agents/skills/create-pr/SKILL.zh-CN.md +13 -11
- package/templates/.agents/skills/create-pr/reference/comment-publish.en.md +1 -1
- package/templates/.agents/skills/create-pr/reference/comment-publish.zh-CN.md +1 -1
- package/templates/.agents/skills/create-pr/reference/pr-body-template.en.md +3 -3
- package/templates/.agents/skills/create-pr/reference/pr-body-template.zh-CN.md +3 -3
- package/templates/.agents/skills/create-release-note/SKILL.en.md +17 -16
- package/templates/.agents/skills/create-release-note/SKILL.zh-CN.md +17 -16
- package/templates/.agents/skills/create-task/SKILL.en.md +16 -14
- package/templates/.agents/skills/create-task/SKILL.zh-CN.md +16 -14
- package/templates/.agents/skills/import-codescan/SKILL.en.md +5 -5
- package/templates/.agents/skills/import-codescan/SKILL.zh-CN.md +5 -5
- package/templates/.agents/skills/import-dependabot/SKILL.en.md +5 -5
- package/templates/.agents/skills/import-dependabot/SKILL.zh-CN.md +5 -5
- package/templates/.agents/skills/import-issue/SKILL.en.md +10 -8
- package/templates/.agents/skills/import-issue/SKILL.zh-CN.md +10 -8
- package/templates/.agents/skills/init-labels/SKILL.en.md +4 -4
- package/templates/.agents/skills/init-labels/SKILL.zh-CN.md +4 -4
- package/templates/.agents/skills/init-milestones/SKILL.en.md +4 -4
- package/templates/.agents/skills/init-milestones/SKILL.zh-CN.md +4 -4
- package/templates/.agents/skills/plan-task/SKILL.en.md +13 -10
- package/templates/.agents/skills/plan-task/SKILL.zh-CN.md +13 -10
- package/templates/.agents/skills/post-release/SKILL.en.md +2 -0
- package/templates/.agents/skills/post-release/SKILL.zh-CN.md +2 -0
- package/templates/.agents/skills/refine-title/SKILL.en.md +1 -1
- package/templates/.agents/skills/refine-title/SKILL.zh-CN.md +1 -1
- package/templates/.agents/skills/release/SKILL.en.md +16 -10
- package/templates/.agents/skills/release/SKILL.zh-CN.md +16 -10
- package/templates/.agents/skills/restore-task/SKILL.en.md +4 -1
- package/templates/.agents/skills/restore-task/SKILL.zh-CN.md +4 -1
- package/templates/.agents/skills/review-analysis/SKILL.en.md +18 -4
- package/templates/.agents/skills/review-analysis/SKILL.zh-CN.md +19 -5
- package/templates/.agents/skills/review-analysis/config/verify.en.json +6 -0
- package/templates/.agents/skills/review-analysis/config/verify.zh-CN.json +6 -0
- package/templates/.agents/skills/review-analysis/reference/output-templates.en.md +13 -15
- package/templates/.agents/skills/review-analysis/reference/output-templates.zh-CN.md +13 -15
- package/templates/.agents/skills/review-analysis/reference/report-template.en.md +51 -5
- package/templates/.agents/skills/review-analysis/reference/report-template.zh-CN.md +52 -6
- package/templates/.agents/skills/review-analysis/reference/review-criteria.en.md +25 -22
- package/templates/.agents/skills/review-analysis/reference/review-criteria.zh-CN.md +25 -22
- package/templates/.agents/skills/review-code/SKILL.en.md +35 -12
- package/templates/.agents/skills/review-code/SKILL.zh-CN.md +35 -12
- package/templates/.agents/skills/review-code/config/verify.en.json +7 -0
- package/templates/.agents/skills/review-code/config/verify.zh-CN.json +7 -0
- package/templates/.agents/skills/review-code/reference/concurrency-risks.en.md +25 -0
- package/templates/.agents/skills/review-code/reference/concurrency-risks.zh-CN.md +25 -0
- package/templates/.agents/skills/review-code/reference/cross-platform-risks.en.md +27 -0
- package/templates/.agents/skills/review-code/reference/cross-platform-risks.zh-CN.md +27 -0
- package/templates/.agents/skills/review-code/reference/documentation-antipatterns.en.md +13 -0
- package/templates/.agents/skills/review-code/reference/documentation-antipatterns.zh-CN.md +13 -0
- package/templates/.agents/skills/review-code/reference/migration-risks.en.md +25 -0
- package/templates/.agents/skills/review-code/reference/migration-risks.zh-CN.md +25 -0
- package/templates/.agents/skills/review-code/reference/output-templates.en.md +22 -24
- package/templates/.agents/skills/review-code/reference/output-templates.zh-CN.md +22 -24
- package/templates/.agents/skills/review-code/reference/report-template.en.md +54 -7
- package/templates/.agents/skills/review-code/reference/report-template.zh-CN.md +54 -7
- package/templates/.agents/skills/review-code/reference/review-criteria.en.md +29 -24
- package/templates/.agents/skills/review-code/reference/review-criteria.zh-CN.md +29 -24
- package/templates/.agents/skills/review-code/reference/security-risks.en.md +25 -0
- package/templates/.agents/skills/review-code/reference/security-risks.zh-CN.md +25 -0
- package/templates/.agents/skills/review-plan/SKILL.en.md +18 -4
- package/templates/.agents/skills/review-plan/SKILL.zh-CN.md +19 -5
- package/templates/.agents/skills/review-plan/config/verify.en.json +6 -0
- package/templates/.agents/skills/review-plan/config/verify.zh-CN.json +6 -0
- package/templates/.agents/skills/review-plan/reference/output-templates.en.md +13 -15
- package/templates/.agents/skills/review-plan/reference/output-templates.zh-CN.md +13 -15
- package/templates/.agents/skills/review-plan/reference/report-template.en.md +61 -5
- package/templates/.agents/skills/review-plan/reference/report-template.zh-CN.md +61 -5
- package/templates/.agents/skills/review-plan/reference/review-criteria.en.md +21 -24
- package/templates/.agents/skills/review-plan/reference/review-criteria.zh-CN.md +21 -24
- package/templates/.agents/skills/review-pr/SKILL.en.md +158 -0
- package/templates/.agents/skills/review-pr/SKILL.zh-CN.md +158 -0
- package/templates/.agents/skills/review-pr/config/verify.en.json +37 -0
- package/templates/.agents/skills/review-pr/config/verify.zh-CN.json +37 -0
- package/templates/.agents/skills/review-pr/reference/evidence-grading.en.md +65 -0
- package/templates/.agents/skills/review-pr/reference/evidence-grading.zh-CN.md +65 -0
- package/templates/.agents/skills/review-pr/reference/output-guidance.en.md +18 -0
- package/templates/.agents/skills/review-pr/reference/output-guidance.zh-CN.md +18 -0
- package/templates/.agents/skills/review-pr/reference/report-template.en.md +85 -0
- package/templates/.agents/skills/review-pr/reference/report-template.zh-CN.md +85 -0
- package/templates/.agents/skills/run-task/SKILL.en.md +22 -0
- package/templates/.agents/skills/run-task/SKILL.zh-CN.md +22 -0
- package/templates/.agents/skills/run-task/config/verify.en.json +10 -0
- package/templates/.agents/skills/run-task/config/verify.zh-CN.json +10 -0
- package/templates/.agents/skills/run-task/reference/host-validation.en.md +20 -0
- package/templates/.agents/skills/run-task/reference/host-validation.zh-CN.md +20 -0
- package/templates/.agents/skills/test/SKILL.en.md +4 -4
- package/templates/.agents/skills/test/SKILL.zh-CN.md +4 -4
- package/templates/.agents/skills/test-integration/SKILL.en.md +4 -4
- package/templates/.agents/skills/test-integration/SKILL.zh-CN.md +4 -4
- package/templates/.agents/skills/update-agent-infra/SKILL.en.md +5 -5
- package/templates/.agents/skills/update-agent-infra/SKILL.zh-CN.md +5 -5
- package/templates/.agents/skills/update-agent-infra/scripts/sync-templates.js +664 -246
- package/templates/.agents/skills/upgrade-dependency/SKILL.en.md +4 -4
- package/templates/.agents/skills/upgrade-dependency/SKILL.zh-CN.md +4 -4
- package/templates/.agents/skills/watch-pr/SKILL.en.md +21 -21
- package/templates/.agents/skills/watch-pr/SKILL.zh-CN.md +21 -21
- package/templates/.agents/skills/watch-pr/reference/monitor-and-heal.en.md +27 -6
- package/templates/.agents/skills/watch-pr/reference/monitor-and-heal.zh-CN.md +26 -5
- package/templates/.agents/templates/task.en.md +1 -1
- package/templates/.agents/templates/task.zh-CN.md +1 -1
- package/templates/.agents/workflows/bug-fix.en.yaml +3 -3
- package/templates/.agents/workflows/bug-fix.zh-CN.yaml +3 -3
- package/templates/.agents/workflows/code-review.en.yaml +1 -1
- package/templates/.agents/workflows/code-review.zh-CN.yaml +1 -1
- package/templates/.agents/workflows/feature-development.en.yaml +4 -4
- package/templates/.agents/workflows/feature-development.zh-CN.yaml +4 -4
- package/templates/.agents/workflows/refactoring.en.yaml +3 -3
- package/templates/.agents/workflows/refactoring.zh-CN.yaml +3 -3
- package/templates/.claude/agents/agent-infra-lifecycle-executor.en.md +6 -0
- package/templates/.claude/agents/agent-infra-lifecycle-executor.zh-CN.md +6 -0
- package/templates/.claude/agents/agent-infra-lifecycle-reviewer.en.md +6 -0
- package/templates/.claude/agents/agent-infra-lifecycle-reviewer.zh-CN.md +6 -0
- package/templates/.claude/commands/post-release.en.md +1 -0
- package/templates/.claude/commands/post-release.zh-CN.md +1 -0
- package/templates/.claude/commands/review-pr.en.md +8 -0
- package/templates/.claude/commands/review-pr.zh-CN.md +8 -0
- package/templates/.claude/commands/run-task.en.md +8 -0
- package/templates/.claude/commands/run-task.zh-CN.md +8 -0
- package/templates/.claude/settings.json +24 -0
- package/templates/.codex/agents/agent-infra-lifecycle-executor.en.toml +3 -0
- package/templates/.codex/agents/agent-infra-lifecycle-executor.zh-CN.toml +3 -0
- package/templates/.codex/agents/agent-infra-lifecycle-reviewer.en.toml +3 -0
- package/templates/.codex/agents/agent-infra-lifecycle-reviewer.zh-CN.toml +3 -0
- package/templates/.gemini/commands/_project_/review-pr.en.toml +10 -0
- package/templates/.gemini/commands/_project_/review-pr.zh-CN.toml +10 -0
- package/templates/.opencode/commands/post-release.en.md +2 -0
- package/templates/.opencode/commands/post-release.zh-CN.md +2 -0
- package/templates/.opencode/commands/review-pr.en.md +11 -0
- package/templates/.opencode/commands/review-pr.zh-CN.md +11 -0
- package/templates/.opencode/commands/run-task.en.md +11 -0
- package/templates/.opencode/commands/run-task.zh-CN.md +11 -0
- package/templates/.gemini/commands/_project_/analyze-task.en.toml +0 -10
- package/templates/.gemini/commands/_project_/analyze-task.zh-CN.toml +0 -10
- package/templates/.gemini/commands/_project_/archive-tasks.en.toml +0 -10
- package/templates/.gemini/commands/_project_/archive-tasks.zh-CN.toml +0 -10
- package/templates/.gemini/commands/_project_/block-task.en.toml +0 -10
- package/templates/.gemini/commands/_project_/block-task.zh-CN.toml +0 -10
- package/templates/.gemini/commands/_project_/cancel-task.en.toml +0 -10
- package/templates/.gemini/commands/_project_/cancel-task.zh-CN.toml +0 -10
- package/templates/.gemini/commands/_project_/check-task.en.toml +0 -10
- package/templates/.gemini/commands/_project_/check-task.zh-CN.toml +0 -10
- package/templates/.gemini/commands/_project_/close-codescan.en.toml +0 -8
- package/templates/.gemini/commands/_project_/close-codescan.zh-CN.toml +0 -8
- package/templates/.gemini/commands/_project_/close-dependabot.en.toml +0 -8
- package/templates/.gemini/commands/_project_/close-dependabot.zh-CN.toml +0 -8
- package/templates/.gemini/commands/_project_/code-task.en.toml +0 -10
- package/templates/.gemini/commands/_project_/code-task.zh-CN.toml +0 -10
- package/templates/.gemini/commands/_project_/commit.en.toml +0 -10
- package/templates/.gemini/commands/_project_/commit.zh-CN.toml +0 -10
- package/templates/.gemini/commands/_project_/complete-manual-validation.en.toml +0 -10
- package/templates/.gemini/commands/_project_/complete-manual-validation.zh-CN.toml +0 -10
- package/templates/.gemini/commands/_project_/complete-task.en.toml +0 -10
- package/templates/.gemini/commands/_project_/complete-task.zh-CN.toml +0 -10
- package/templates/.gemini/commands/_project_/create-pr.en.toml +0 -10
- package/templates/.gemini/commands/_project_/create-pr.zh-CN.toml +0 -10
- package/templates/.gemini/commands/_project_/create-release-note.en.toml +0 -8
- package/templates/.gemini/commands/_project_/create-release-note.zh-CN.toml +0 -8
- package/templates/.gemini/commands/_project_/create-task.en.toml +0 -8
- package/templates/.gemini/commands/_project_/create-task.zh-CN.toml +0 -8
- package/templates/.gemini/commands/_project_/import-codescan.en.toml +0 -8
- package/templates/.gemini/commands/_project_/import-codescan.zh-CN.toml +0 -8
- package/templates/.gemini/commands/_project_/import-dependabot.en.toml +0 -8
- package/templates/.gemini/commands/_project_/import-dependabot.zh-CN.toml +0 -8
- package/templates/.gemini/commands/_project_/import-issue.en.toml +0 -8
- package/templates/.gemini/commands/_project_/import-issue.zh-CN.toml +0 -8
- package/templates/.gemini/commands/_project_/init-labels.en.toml +0 -8
- package/templates/.gemini/commands/_project_/init-labels.zh-CN.toml +0 -8
- package/templates/.gemini/commands/_project_/init-milestones.en.toml +0 -10
- package/templates/.gemini/commands/_project_/init-milestones.zh-CN.toml +0 -10
- package/templates/.gemini/commands/_project_/plan-task.en.toml +0 -10
- package/templates/.gemini/commands/_project_/plan-task.zh-CN.toml +0 -10
- package/templates/.gemini/commands/_project_/post-release.en.toml +0 -6
- package/templates/.gemini/commands/_project_/post-release.zh-CN.toml +0 -6
- package/templates/.gemini/commands/_project_/refine-title.en.toml +0 -8
- package/templates/.gemini/commands/_project_/refine-title.zh-CN.toml +0 -8
- package/templates/.gemini/commands/_project_/release.en.toml +0 -8
- package/templates/.gemini/commands/_project_/release.zh-CN.toml +0 -8
- package/templates/.gemini/commands/_project_/restore-task.en.toml +0 -8
- package/templates/.gemini/commands/_project_/restore-task.zh-CN.toml +0 -8
- package/templates/.gemini/commands/_project_/review-analysis.en.toml +0 -10
- package/templates/.gemini/commands/_project_/review-analysis.zh-CN.toml +0 -10
- package/templates/.gemini/commands/_project_/review-code.en.toml +0 -10
- package/templates/.gemini/commands/_project_/review-code.zh-CN.toml +0 -10
- package/templates/.gemini/commands/_project_/review-plan.en.toml +0 -10
- package/templates/.gemini/commands/_project_/review-plan.zh-CN.toml +0 -10
- package/templates/.gemini/commands/_project_/test-integration.en.toml +0 -6
- package/templates/.gemini/commands/_project_/test-integration.zh-CN.toml +0 -6
- package/templates/.gemini/commands/_project_/test.en.toml +0 -6
- package/templates/.gemini/commands/_project_/test.zh-CN.toml +0 -6
- package/templates/.gemini/commands/_project_/update-agent-infra.en.toml +0 -6
- package/templates/.gemini/commands/_project_/update-agent-infra.zh-CN.toml +0 -6
- package/templates/.gemini/commands/_project_/upgrade-dependency.en.toml +0 -8
- package/templates/.gemini/commands/_project_/upgrade-dependency.zh-CN.toml +0 -8
- package/templates/.gemini/commands/_project_/watch-pr.en.toml +0 -10
- package/templates/.gemini/commands/_project_/watch-pr.zh-CN.toml +0 -10
- package/templates/.gemini/settings.json +0 -3
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import fs from 'node:fs';
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
|
|
4
|
+
import { normalizeAgentToken, AGENT_USAGE_HINT } from '../agent-clients/tokens.ts';
|
|
4
5
|
import {
|
|
5
6
|
bindPlatformPullRequest,
|
|
6
7
|
createPlatformPullRequest,
|
|
7
8
|
inspectPlatformPullRequest,
|
|
9
|
+
resolveExternalPullRequest,
|
|
8
10
|
syncPlatformPullRequest
|
|
9
11
|
} from '../platform/pull-requests.ts';
|
|
10
12
|
import type { PullRequestResult } from '../platform/pull-requests.ts';
|
|
@@ -12,6 +14,7 @@ import { summaryContext, syncPullRequestSummary } from '../platform/pr-summary.t
|
|
|
12
14
|
import type { PlatformResult } from '../platform/types.ts';
|
|
13
15
|
|
|
14
16
|
const USAGE = `Usage: agent-infra-internal platform-pr inspect <task-ref> [--cwd <path>]
|
|
17
|
+
agent-infra-internal platform-pr resolve-external <task-ref> --agent <agent> [--pr <N>] [--dry-run] [--cwd <path>]
|
|
15
18
|
agent-infra-internal platform-pr create <task-ref> --agent <agent> --base <branch> --head <branch> --title-file <path|-> --body-file <path|-> [--draft] [--dry-run] [--cwd <path>]
|
|
16
19
|
agent-infra-internal platform-pr bind <task-ref> --pr <N> --agent <agent> [--dry-run] [--cwd <path>]
|
|
17
20
|
agent-infra-internal platform-pr sync <task-ref> --agent <agent> [--metadata] [--closing-issue] [--dry-run] [--cwd <path>]
|
|
@@ -61,7 +64,7 @@ function readFile(value: string, cwd: string): string {
|
|
|
61
64
|
function platformPr(args: string[] = []): void {
|
|
62
65
|
if (args[0] === '--help' || args[0] === '-h') { process.stdout.write(USAGE); return; }
|
|
63
66
|
const operation = args[0];
|
|
64
|
-
if (!operation || !['inspect', 'create', 'bind', 'sync', 'summary-context', 'summary-sync'].includes(operation)) { fail('a valid operation is required'); return; }
|
|
67
|
+
if (!operation || !['inspect', 'resolve-external', 'create', 'bind', 'sync', 'summary-context', 'summary-sync'].includes(operation)) { fail('a valid operation is required'); return; }
|
|
65
68
|
const taskRef = args[1];
|
|
66
69
|
if (!taskRef || taskRef.startsWith('--')) { fail(`${operation} requires a task ref`); return; }
|
|
67
70
|
const parsed = parse(args, 2);
|
|
@@ -70,6 +73,7 @@ function platformPr(args: string[] = []): void {
|
|
|
70
73
|
const cwd = path.resolve(typeof values.cwd === 'string' ? values.cwd : process.cwd());
|
|
71
74
|
const allowed: Record<string, string[]> = {
|
|
72
75
|
inspect: ['cwd'],
|
|
76
|
+
'resolve-external': ['cwd', 'agent', 'pr', 'dryRun'],
|
|
73
77
|
create: ['cwd', 'agent', 'base', 'head', 'titleFile', 'bodyFile', 'draft', 'dryRun'],
|
|
74
78
|
bind: ['cwd', 'agent', 'pr', 'dryRun'],
|
|
75
79
|
sync: ['cwd', 'agent', 'metadata', 'closingIssue', 'dryRun'],
|
|
@@ -81,6 +85,15 @@ function platformPr(args: string[] = []): void {
|
|
|
81
85
|
if (operation === 'inspect') { finish(inspectPlatformPullRequest(taskRef, { cwd })); return; }
|
|
82
86
|
if (operation === 'summary-context') { finish(summaryContext(taskRef, { cwd })); return; }
|
|
83
87
|
if (typeof values.agent !== 'string' || !values.agent) { fail(`${operation} requires --agent`); return; }
|
|
88
|
+
const agent = normalizeAgentToken(values.agent);
|
|
89
|
+
if (!agent) { fail(`invalid --agent '${values.agent}': ${AGENT_USAGE_HINT}`); return; }
|
|
90
|
+
values.agent = agent;
|
|
91
|
+
if (operation === 'resolve-external') {
|
|
92
|
+
const pr = values.pr === undefined ? undefined : Number(values.pr);
|
|
93
|
+
if (pr !== undefined && (!Number.isInteger(pr) || pr <= 0)) { fail('resolve-external requires a positive --pr'); return; }
|
|
94
|
+
finish(resolveExternalPullRequest(taskRef, { cwd, agent: values.agent, pr, dryRun: values.dryRun === true }));
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
84
97
|
if (operation === 'bind') {
|
|
85
98
|
const pr = Number(values.pr);
|
|
86
99
|
if (!Number.isInteger(pr) || pr <= 0) { fail('bind requires a positive --pr'); return; }
|
|
@@ -1,11 +1,34 @@
|
|
|
1
1
|
import fs from 'node:fs';
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
|
|
4
|
-
import { publishReleaseNotes, releaseNoteContext } from '../platform/release-notes.ts';
|
|
4
|
+
import { publishReleaseNotes, releaseNoteContext, stageReleaseNotes } from '../platform/release-notes.ts';
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
type ParsedOptions = Readonly<{ values: ReadonlyMap<string, string>; switches: ReadonlySet<string> }>;
|
|
7
|
+
|
|
8
|
+
function parseOptions(
|
|
9
|
+
args: string[],
|
|
10
|
+
valueFlags: readonly string[],
|
|
11
|
+
switchFlags: readonly string[] = []
|
|
12
|
+
): ParsedOptions | null {
|
|
13
|
+
const values = new Map<string, string>();
|
|
14
|
+
const switches = new Set<string>();
|
|
15
|
+
for (let index = 0; index < args.length; index += 1) {
|
|
16
|
+
const flag = args[index]!;
|
|
17
|
+
if (values.has(flag) || switches.has(flag)) return null;
|
|
18
|
+
if (switchFlags.includes(flag)) {
|
|
19
|
+
switches.add(flag);
|
|
20
|
+
continue;
|
|
21
|
+
}
|
|
22
|
+
if (!valueFlags.includes(flag)) return null;
|
|
23
|
+
const value = args[++index];
|
|
24
|
+
if (!value || value.startsWith('--')) return null;
|
|
25
|
+
values.set(flag, value);
|
|
26
|
+
}
|
|
27
|
+
return { values, switches };
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function invalidInput(message: string) {
|
|
31
|
+
return { status: 'failed', changed: false, error: { code: 'RELEASE_NOTES_INPUT_INVALID', message, retryable: false } };
|
|
9
32
|
}
|
|
10
33
|
|
|
11
34
|
function finish(result: { status: string; [key: string]: unknown }): void {
|
|
@@ -15,21 +38,40 @@ function finish(result: { status: string; [key: string]: unknown }): void {
|
|
|
15
38
|
|
|
16
39
|
function platformReleaseNotes(args: string[] = []): void {
|
|
17
40
|
const [action, ...rest] = args;
|
|
18
|
-
const cwd = path.resolve(option(rest, '--cwd') || process.cwd());
|
|
19
41
|
if (action === 'context') {
|
|
20
|
-
const
|
|
42
|
+
const parsed = parseOptions(rest, ['--cwd', '--history-limit', '--from-tag', '--to-tag', '--branch']);
|
|
43
|
+
if (!parsed) return finish(invalidInput('invalid context options'));
|
|
44
|
+
const cwd = path.resolve(parsed.values.get('--cwd') || process.cwd());
|
|
45
|
+
const historyRaw = parsed.values.get('--history-limit') ?? null;
|
|
21
46
|
finish(releaseNoteContext({
|
|
22
|
-
fromTag:
|
|
23
|
-
toTag:
|
|
24
|
-
branch:
|
|
47
|
+
fromTag: parsed.values.get('--from-tag') || '',
|
|
48
|
+
toTag: parsed.values.get('--to-tag') || '',
|
|
49
|
+
branch: parsed.values.get('--branch') || '',
|
|
25
50
|
historyLimit: historyRaw === null ? undefined : Number(historyRaw)
|
|
26
51
|
}, { cwd }));
|
|
27
52
|
return;
|
|
28
53
|
}
|
|
54
|
+
if (action === 'stage') {
|
|
55
|
+
const parsed = parseOptions(rest, ['--cwd', '--notes-file']);
|
|
56
|
+
if (!parsed) return finish(invalidInput('invalid stage options'));
|
|
57
|
+
const notesFile = parsed.values.get('--notes-file');
|
|
58
|
+
if (!notesFile) return finish(invalidInput('notes-file is required'));
|
|
59
|
+
finish(stageReleaseNotes(
|
|
60
|
+
{ notesFile },
|
|
61
|
+
{ cwd: path.resolve(parsed.values.get('--cwd') || process.cwd()) }
|
|
62
|
+
));
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
29
65
|
if (action === 'publish') {
|
|
30
|
-
const
|
|
66
|
+
const parsed = parseOptions(
|
|
67
|
+
rest,
|
|
68
|
+
['--cwd', '--notes-file', '--tag', '--title', '--expected-sha256'],
|
|
69
|
+
['--dry-run']
|
|
70
|
+
);
|
|
71
|
+
if (!parsed) return finish(invalidInput('invalid publish options'));
|
|
72
|
+
const notesPath = parsed.values.get('--notes-file');
|
|
31
73
|
if (!notesPath) {
|
|
32
|
-
finish(
|
|
74
|
+
finish(invalidInput('notes-file is required'));
|
|
33
75
|
return;
|
|
34
76
|
}
|
|
35
77
|
let resolvedNotesPath = notesPath;
|
|
@@ -39,17 +81,18 @@ function platformReleaseNotes(args: string[] = []): void {
|
|
|
39
81
|
}
|
|
40
82
|
try {
|
|
41
83
|
finish(publishReleaseNotes({
|
|
42
|
-
tag:
|
|
43
|
-
title:
|
|
84
|
+
tag: parsed.values.get('--tag') || '',
|
|
85
|
+
title: parsed.values.get('--title') || parsed.values.get('--tag') || '',
|
|
44
86
|
notesFile: resolvedNotesPath,
|
|
45
|
-
|
|
46
|
-
|
|
87
|
+
expectedSha256: parsed.values.get('--expected-sha256') || '',
|
|
88
|
+
dryRun: parsed.switches.has('--dry-run')
|
|
89
|
+
}, { cwd: path.resolve(parsed.values.get('--cwd') || process.cwd()) }));
|
|
47
90
|
} finally {
|
|
48
91
|
if (notesPath === '-') fs.rmSync(resolvedNotesPath, { force: true });
|
|
49
92
|
}
|
|
50
93
|
return;
|
|
51
94
|
}
|
|
52
|
-
finish(
|
|
95
|
+
finish(invalidInput('Usage: platform-release-notes context|stage|publish'));
|
|
53
96
|
}
|
|
54
97
|
|
|
55
98
|
export { platformReleaseNotes };
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
collectHostCandidates,
|
|
6
|
+
decide,
|
|
7
|
+
deriveTaskIssueMatches,
|
|
8
|
+
extractClosingIssueNumbers,
|
|
9
|
+
resolveHostFromCandidates
|
|
10
|
+
} from '../pr-review/evidence-grading.ts';
|
|
11
|
+
import type { DecisionRecord, HostResolution } from '../pr-review/evidence-grading.ts';
|
|
12
|
+
import { inspectPlatformPullRequestByNumber } from '../platform/pull-requests.ts';
|
|
13
|
+
import { verifyInProcess } from '../task/verification-engine.ts';
|
|
14
|
+
|
|
15
|
+
const USAGE = `Usage: agent-infra-internal pr-review-grade decide --input-file <path|-> [--cwd <path>]
|
|
16
|
+
agent-infra-internal pr-review-grade resolve-host --pr <N> [--cwd <path>]
|
|
17
|
+
agent-infra-internal pr-review-grade verify-artifact --artifact-file <path> [--cwd <path>]
|
|
18
|
+
`;
|
|
19
|
+
|
|
20
|
+
function fail(message: string): void {
|
|
21
|
+
process.stdout.write(`${JSON.stringify({ status: 'failed', changed: false, error: { code: 'PR_REVIEW_GRADE_INVALID', message } })}\n`);
|
|
22
|
+
process.stderr.write(USAGE);
|
|
23
|
+
process.exitCode = 1;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function finish(result: unknown, exitCode = 0): void {
|
|
27
|
+
process.stdout.write(`${JSON.stringify(result)}\n`);
|
|
28
|
+
if (exitCode !== 0) process.exitCode = exitCode;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function parseFlags(args: string[], start: number): { values: Record<string, string | boolean>; error?: string } {
|
|
32
|
+
const values: Record<string, string | boolean> = {};
|
|
33
|
+
const seen = new Set<string>();
|
|
34
|
+
for (let index = start; index < args.length; index += 1) {
|
|
35
|
+
const flag = args[index]!;
|
|
36
|
+
if (!['--input-file', '--artifact-file', '--cwd', '--pr'].includes(flag)) {
|
|
37
|
+
return { values, error: `unknown option '${flag}'` };
|
|
38
|
+
}
|
|
39
|
+
if (seen.has(flag)) return { values, error: `duplicate option '${flag}'` };
|
|
40
|
+
seen.add(flag);
|
|
41
|
+
const value = args[++index];
|
|
42
|
+
if (value === undefined || value.startsWith('--')) return { values, error: `option '${flag}' requires a value` };
|
|
43
|
+
values[flag.slice(2).replace(/-([a-z])/g, (_, letter: string) => letter.toUpperCase())] = value;
|
|
44
|
+
}
|
|
45
|
+
return { values };
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function readInput(value: string, cwd: string): string {
|
|
49
|
+
return value === '-' ? fs.readFileSync(0, 'utf8') : fs.readFileSync(path.resolve(cwd, value), 'utf8');
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function prReviewGrade(args: string[] = []): void {
|
|
53
|
+
if (args[0] === '--help' || args[0] === '-h') { process.stdout.write(USAGE); return; }
|
|
54
|
+
const operation = args[0];
|
|
55
|
+
if (!operation || !['decide', 'resolve-host', 'verify-artifact'].includes(operation)) { fail('a valid operation is required'); return; }
|
|
56
|
+
const parsed = parseFlags(args, 1);
|
|
57
|
+
if (parsed.error) { fail(parsed.error); return; }
|
|
58
|
+
const values = parsed.values;
|
|
59
|
+
const cwd = path.resolve(typeof values.cwd === 'string' ? values.cwd : process.cwd());
|
|
60
|
+
const allowed: Record<string, string[]> = {
|
|
61
|
+
decide: ['cwd', 'inputFile'],
|
|
62
|
+
'resolve-host': ['cwd', 'pr'],
|
|
63
|
+
'verify-artifact': ['cwd', 'artifactFile']
|
|
64
|
+
};
|
|
65
|
+
const unexpected = Object.keys(values).find((key) => !allowed[operation]!.includes(key));
|
|
66
|
+
if (unexpected) { fail(`${operation} does not accept '--${unexpected}'`); return; }
|
|
67
|
+
|
|
68
|
+
if (operation === 'decide') {
|
|
69
|
+
if (typeof values.inputFile !== 'string') { fail('decide requires --input-file'); return; }
|
|
70
|
+
let input: unknown;
|
|
71
|
+
try {
|
|
72
|
+
input = JSON.parse(readInput(values.inputFile, cwd));
|
|
73
|
+
} catch (error) {
|
|
74
|
+
fail(`unable to read decide input: ${error instanceof Error ? error.message : String(error)}`);
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
try {
|
|
78
|
+
const record: DecisionRecord = decide(input as Parameters<typeof decide>[0]);
|
|
79
|
+
finish(record);
|
|
80
|
+
} catch (error) {
|
|
81
|
+
const code = error && typeof error === 'object' && 'code' in error ? String(error.code) : 'DECIDE_FAILED';
|
|
82
|
+
finish({ status: 'failed', changed: false, error: { code, message: error instanceof Error ? error.message : String(error) } }, 1);
|
|
83
|
+
}
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
if (operation === 'resolve-host') {
|
|
88
|
+
const pr = Number(values.pr);
|
|
89
|
+
if (!Number.isInteger(pr) || pr <= 0) { fail('resolve-host requires a positive --pr'); return; }
|
|
90
|
+
const inspected = inspectPlatformPullRequestByNumber(pr, { cwd });
|
|
91
|
+
if (!inspected.pullRequest) {
|
|
92
|
+
finish({
|
|
93
|
+
status: 'failed', changed: false, host: null, candidates: [], closingIssues: [],
|
|
94
|
+
error: inspected.error ?? { code: 'PR_INSPECTION_INVALID', message: 'unable to inspect the pull request', retryable: false }
|
|
95
|
+
}, inspected.status === 'blocked' ? 2 : 1);
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
const closingIssues = extractClosingIssueNumbers(inspected.pullRequest.body);
|
|
99
|
+
const candidates = collectHostCandidates({ prNumber: pr, closingIssues, workspaceRoot: cwd });
|
|
100
|
+
const host: HostResolution = resolveHostFromCandidates(candidates);
|
|
101
|
+
finish({
|
|
102
|
+
status: 'ok', changed: false,
|
|
103
|
+
pr: { number: pr, baseSha: inspected.pullRequest.base.sha, headSha: inspected.pullRequest.head.sha, state: inspected.pullRequest.state },
|
|
104
|
+
closingIssues, candidates, host,
|
|
105
|
+
taskIssueMatches: deriveTaskIssueMatches(host, closingIssues), error: null
|
|
106
|
+
});
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
if (typeof values.artifactFile !== 'string') { fail('verify-artifact requires --artifact-file'); return; }
|
|
111
|
+
const artifactPath = path.resolve(cwd, values.artifactFile);
|
|
112
|
+
let result: Record<string, unknown>;
|
|
113
|
+
try {
|
|
114
|
+
result = verifyInProcess({
|
|
115
|
+
mode: 'checks',
|
|
116
|
+
skillName: 'review-pr',
|
|
117
|
+
taskDir: path.dirname(artifactPath),
|
|
118
|
+
artifactFile: path.basename(artifactPath),
|
|
119
|
+
checks: ['artifact'],
|
|
120
|
+
repositoryRoot: cwd
|
|
121
|
+
}) as Record<string, unknown>;
|
|
122
|
+
} catch (error) {
|
|
123
|
+
finish({ status: 'failed', changed: false, error: { code: 'VERIFY_ARTIFACT_INVALID', message: error instanceof Error ? error.message : String(error) } }, 1);
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
const status = result.status as 'pass' | 'fail' | 'blocked';
|
|
127
|
+
finish(result, ({ pass: 0, fail: 1, blocked: 2 } as const)[status]);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export { prReviewGrade };
|
|
@@ -150,9 +150,57 @@ function runOptionalDemo(cwd: string, run: CommandRunner = command): DemoResult
|
|
|
150
150
|
return { status: 'recorded', reasonCode: null, message: null, outputPath };
|
|
151
151
|
}
|
|
152
152
|
|
|
153
|
-
function git(cwd: string, args: string[]): string | null {
|
|
154
|
-
const result =
|
|
155
|
-
|
|
153
|
+
function git(cwd: string, args: string[], run: CommandRunner = command, trim = true): string | null {
|
|
154
|
+
const result = run(cwd, 'git', args);
|
|
155
|
+
const stdout = String(result.stdout);
|
|
156
|
+
return result.status === 0 ? (trim ? stdout.trim() : stdout) : null;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
function inspectLocalReleaseFacts(cwd: string, version: string, run: CommandRunner = command) {
|
|
160
|
+
const tag = `v${version}`;
|
|
161
|
+
const head = git(cwd, ['rev-parse', 'HEAD'], run);
|
|
162
|
+
const tagCommit = git(cwd, ['rev-parse', '--verify', `${tag}^{commit}`], run);
|
|
163
|
+
const localTag = Boolean(tagCommit && tagCommit === head);
|
|
164
|
+
const localTagAncestor = Boolean(
|
|
165
|
+
tagCommit && head && !localTag
|
|
166
|
+
&& run(cwd, 'git', ['merge-base', '--is-ancestor', tagCommit, head]).status === 0
|
|
167
|
+
);
|
|
168
|
+
const localTagConflict = Boolean(tagCommit && !localTag && !localTagAncestor);
|
|
169
|
+
const postSubject = `chore: prepare next dev iteration after v${version}`;
|
|
170
|
+
const postLog = localTag || localTagAncestor
|
|
171
|
+
? git(cwd, ['log', '--format=%s', `${tag}..HEAD`], run) ?? ''
|
|
172
|
+
: '';
|
|
173
|
+
const postCommit = postLog.split('\n').some((subject) => subject === postSubject);
|
|
174
|
+
return { localTag, localTagAncestor, localTagConflict, postCommit };
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
function releaseSmokeStatus(workflows: Array<Record<string, unknown>>, version: string, tagCommit: string | null): ReleaseFacts['smoke'] {
|
|
178
|
+
const manualTitle = `Post-Release Smoke v${version}`;
|
|
179
|
+
const targets = workflows.filter((run) => {
|
|
180
|
+
if (String(run.workflowName || run.name) !== 'Post-Release Smoke') return false;
|
|
181
|
+
if (String(run.event) === 'workflow_run') return Boolean(tagCommit && String(run.headSha) === tagCommit);
|
|
182
|
+
return String(run.event) === 'workflow_dispatch' && String(run.displayTitle) === manualTitle;
|
|
183
|
+
}).sort((left, right) => {
|
|
184
|
+
const leftOrder = [Date.parse(String(left.createdAt || '')) || 0, Number(left.databaseId) || 0, Number(left.attempt) || 0];
|
|
185
|
+
const rightOrder = [Date.parse(String(right.createdAt || '')) || 0, Number(right.databaseId) || 0, Number(right.attempt) || 0];
|
|
186
|
+
for (let index = 0; index < leftOrder.length; index += 1) {
|
|
187
|
+
if (leftOrder[index] !== rightOrder[index]) return rightOrder[index]! - leftOrder[index]!;
|
|
188
|
+
}
|
|
189
|
+
return 0;
|
|
190
|
+
});
|
|
191
|
+
const latest = targets[0];
|
|
192
|
+
if (!latest) return null;
|
|
193
|
+
if (String(latest.status) !== 'completed') return 'pending';
|
|
194
|
+
return String(latest.conclusion) === 'success' ? 'success' : 'failed';
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
function inspectPostWorktree(cwd: string) {
|
|
198
|
+
const inspected = inspectGitWorkflow(cwd);
|
|
199
|
+
if (!inspected.snapshot) return inspected.error ?? { code: 'GIT_INSPECT_FAILED', message: 'Unable to inspect Git repository' };
|
|
200
|
+
if (inspected.snapshot.worktree.length || inspected.snapshot.staged.length) {
|
|
201
|
+
return { code: 'WORKTREE_DIRTY', message: 'Release post requires a clean worktree' };
|
|
202
|
+
}
|
|
203
|
+
return null;
|
|
156
204
|
}
|
|
157
205
|
|
|
158
206
|
async function inspectFacts(cwd: string, version: string): Promise<ReleaseFacts> {
|
|
@@ -162,6 +210,7 @@ async function inspectFacts(cwd: string, version: string): Promise<ReleaseFacts>
|
|
|
162
210
|
const branch = git(cwd, ['branch', '--show-current']) || '';
|
|
163
211
|
const head = git(cwd, ['rev-parse', 'HEAD']);
|
|
164
212
|
const localTagTarget = git(cwd, ['rev-parse', '--verify', `${tag}^{commit}`]);
|
|
213
|
+
const local = inspectLocalReleaseFacts(cwd, version);
|
|
165
214
|
const remoteBranch = branch ? git(cwd, ['ls-remote', '--heads', 'origin', branch]) : null;
|
|
166
215
|
const remoteTag = git(cwd, ['ls-remote', '--tags', 'origin', `refs/tags/${tag}`]);
|
|
167
216
|
const platform = inspectPlatformRelease(tag, { cwd });
|
|
@@ -169,24 +218,26 @@ async function inspectFacts(cwd: string, version: string): Promise<ReleaseFacts>
|
|
|
169
218
|
const formulaUrl = `https://raw.githubusercontent.com/${config.org}/homebrew-tap/main/Formula/${config.project}.rb`;
|
|
170
219
|
const homebrew = await inspectHomebrewChannel(formulaUrl, version);
|
|
171
220
|
const workflows = platform.workflows as Array<Record<string, unknown>>;
|
|
172
|
-
const
|
|
173
|
-
const smoke = smokeRun ? String(smokeRun.conclusion) === 'success' ? 'success' : String(smokeRun.status) === 'completed' ? 'failed' : 'pending' : null;
|
|
174
|
-
const postMessage = git(cwd, ['log', '-1', '--pretty=%s']) || '';
|
|
221
|
+
const smoke = releaseSmokeStatus(workflows, version, localTagTarget);
|
|
175
222
|
return {
|
|
176
|
-
|
|
177
|
-
localTagConflict: Boolean(localTagTarget && localTagTarget !== head),
|
|
223
|
+
...local,
|
|
178
224
|
remoteBranch: Boolean(remoteBranch && remoteBranch.split(/\s+/)[0] === head), remoteTag: Boolean(remoteTag),
|
|
179
225
|
githubRelease: platform.platform.type !== 'github'
|
|
180
226
|
? true
|
|
181
227
|
: platform.status === 'blocked' ? null : Boolean(platform.release?.published),
|
|
182
|
-
npm: npm.published, homebrew: homebrew.published, smoke
|
|
183
|
-
postCommit: postMessage.includes(`after v${version}`)
|
|
228
|
+
npm: npm.published, homebrew: homebrew.published, smoke
|
|
184
229
|
};
|
|
185
230
|
}
|
|
186
231
|
|
|
187
|
-
function
|
|
188
|
-
const
|
|
189
|
-
|
|
232
|
+
function parsePorcelainPath(record: string): string {
|
|
233
|
+
const match = /^.. (.+)$/.exec(record);
|
|
234
|
+
if (!match) throw new Error('Invalid git status --porcelain=v1 record');
|
|
235
|
+
return match[1]!;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
function changedPaths(cwd: string, run: CommandRunner = command): string[] {
|
|
239
|
+
const output = git(cwd, ['status', '--porcelain=v1'], run, false) || '';
|
|
240
|
+
return output.split(/\r?\n/).filter(Boolean).map(parsePorcelainPath).filter((value, index, all) => all.indexOf(value) === index);
|
|
190
241
|
}
|
|
191
242
|
|
|
192
243
|
function updateReleaseMetadata(cwd: string, version: string): void {
|
|
@@ -218,12 +269,11 @@ async function releaseWorkflow(args: string[] = []): Promise<void> {
|
|
|
218
269
|
}
|
|
219
270
|
const before = releaseSnapshot(version, await inspectFacts(cwd, version));
|
|
220
271
|
if (action === 'inspect') { process.stdout.write(`${JSON.stringify({ status: 'no-op', changed: false, snapshot: before, error: null })}\n`); return; }
|
|
272
|
+
if (before.facts.localTagConflict) {
|
|
273
|
+
process.stdout.write(`${JSON.stringify({ status: 'failed', changed: false, snapshot: before, error: { code: 'GIT_TAG_CONFLICT', message: `Tag v${version} is not reachable from HEAD` } })}\n`);
|
|
274
|
+
process.exitCode = 1; return;
|
|
275
|
+
}
|
|
221
276
|
if (action === 'prepare') {
|
|
222
|
-
if (before.facts.localTagConflict) {
|
|
223
|
-
process.stdout.write(`${JSON.stringify({ status: 'failed', changed: false, snapshot: before, error: { code: 'GIT_TAG_CONFLICT', message: `Tag v${version} does not point to HEAD` } })}\n`);
|
|
224
|
-
process.exitCode = 1;
|
|
225
|
-
return;
|
|
226
|
-
}
|
|
227
277
|
if (before.phase !== 'unprepared') {
|
|
228
278
|
const milestones = reconcileReleaseMilestones(version, { cwd });
|
|
229
279
|
process.stdout.write(`${JSON.stringify({ ...milestones, snapshot: before })}\n`);
|
|
@@ -254,16 +304,25 @@ async function releaseWorkflow(args: string[] = []): Promise<void> {
|
|
|
254
304
|
process.exitCode = failed ? 1 : blocked ? 2 : 0; return;
|
|
255
305
|
}
|
|
256
306
|
if (action === 'publish') {
|
|
257
|
-
if (!['prepared', 'partially-published'].includes(before.phase)) { process.stdout.write(`${JSON.stringify({ status: 'failed', changed: false, snapshot: before, error: { code: 'RELEASE_PHASE_INVALID', message: `Cannot publish from ${before.phase}` } })}\n`); process.exitCode = 1; return; }
|
|
307
|
+
if (!before.facts.localTag || !['prepared', 'partially-published'].includes(before.phase)) { process.stdout.write(`${JSON.stringify({ status: 'failed', changed: false, snapshot: before, error: { code: 'RELEASE_PHASE_INVALID', message: `Cannot publish from ${before.phase}` } })}\n`); process.exitCode = 1; return; }
|
|
258
308
|
const branch = git(cwd, ['branch', '--show-current']) || '';
|
|
259
309
|
const refs = [...(!before.facts.remoteBranch ? [branch] : []), ...(!before.facts.remoteTag ? [`refs/tags/v${version}`] : [])];
|
|
260
310
|
const result = pushGitRefs({ cwd, remote: 'origin', refs });
|
|
261
311
|
process.stdout.write(`${JSON.stringify({ ...result, snapshot: releaseSnapshot(version, await inspectFacts(cwd, version)) })}\n`); process.exitCode = result.status === 'failed' ? 1 : result.status === 'degraded' ? 2 : 0; return;
|
|
262
312
|
}
|
|
313
|
+
if (before.phase === 'complete') {
|
|
314
|
+
process.stdout.write(`${JSON.stringify({ status: 'no-op', changed: false, snapshot: before, error: null })}\n`);
|
|
315
|
+
return;
|
|
316
|
+
}
|
|
263
317
|
const channelsComplete = before.facts.githubRelease === true && before.facts.npm === true && before.facts.homebrew === true;
|
|
264
318
|
if (!['published', 'post-pending'].includes(before.phase) || !channelsComplete || before.facts.smoke !== 'success') {
|
|
265
319
|
process.stdout.write(`${JSON.stringify({ status: before.facts.smoke === 'failed' ? 'failed' : 'blocked', changed: false, snapshot: before, error: { code: 'RELEASE_CHANNELS_PENDING', message: 'Release channels or smoke workflow are not complete' } })}\n`); process.exitCode = before.facts.smoke === 'failed' ? 1 : 2; return;
|
|
266
320
|
}
|
|
321
|
+
const worktreeError = inspectPostWorktree(cwd);
|
|
322
|
+
if (worktreeError) {
|
|
323
|
+
process.stdout.write(`${JSON.stringify({ status: 'failed', changed: false, snapshot: before, error: worktreeError })}\n`);
|
|
324
|
+
process.exitCode = 1; return;
|
|
325
|
+
}
|
|
267
326
|
const built = command(cwd, 'npm', ['run', 'build']);
|
|
268
327
|
if (built.status !== 0) {
|
|
269
328
|
process.stdout.write(`${JSON.stringify({ status: 'failed', changed: true, snapshot: before, error: { code: 'RELEASE_POST_COMMAND_FAILED', message: String(built.stderr || built.stdout) } })}\n`);
|
|
@@ -284,5 +343,5 @@ async function releaseWorkflow(args: string[] = []): Promise<void> {
|
|
|
284
343
|
process.stdout.write(`${JSON.stringify({ ...pushed, demo, snapshot: releaseSnapshot(version, await inspectFacts(cwd, version)) })}\n`); process.exitCode = pushed.status === 'failed' ? 1 : pushed.status === 'degraded' ? 2 : 0;
|
|
285
344
|
}
|
|
286
345
|
|
|
287
|
-
export { computeDemoInputDigest, inspectFacts, releaseWorkflow, runOptionalDemo };
|
|
346
|
+
export { changedPaths, computeDemoInputDigest, inspectFacts, inspectLocalReleaseFacts, inspectPostWorktree, releaseSmokeStatus, releaseWorkflow, runOptionalDemo };
|
|
288
347
|
export type { CommandRunner, DemoResult };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { applyActivityAppendIntent } from '../task/activity-intent.ts';
|
|
2
|
+
import type { ActivityAppendIntent } from '../task/activity-intent.ts';
|
|
3
|
+
|
|
4
|
+
const USAGE = `Usage: agent-infra-internal task-activity <task-ref> append --step <step> --agent <agent> --note <note> [--artifact <canonical.md>] [--dry-run]
|
|
5
|
+
`;
|
|
6
|
+
const FLAGS: Record<string, string> = {
|
|
7
|
+
'--step': 'step',
|
|
8
|
+
'--agent': 'agent',
|
|
9
|
+
'--note': 'note',
|
|
10
|
+
'--artifact': 'artifact'
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
function usageFailure(message: string): void {
|
|
14
|
+
process.stdout.write(`${JSON.stringify({ status: 'failed', changed: false, error: { code: 'ACTIVITY_PAYLOAD_INVALID', message } })}\n`);
|
|
15
|
+
process.stderr.write(USAGE);
|
|
16
|
+
process.exitCode = 1;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function taskActivity(args: string[] = []): void {
|
|
20
|
+
if (args[0] === '--help' || args[0] === '-h') { process.stdout.write(USAGE); return; }
|
|
21
|
+
const [taskRef, kind] = args;
|
|
22
|
+
if (!taskRef || taskRef.startsWith('--') || !kind || kind !== 'append') {
|
|
23
|
+
usageFailure('task ref and the append intent are required');
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
const values: Record<string, unknown> = { kind, taskRef };
|
|
27
|
+
const seen = new Set<string>();
|
|
28
|
+
for (let index = 2; index < args.length; index += 1) {
|
|
29
|
+
const flag = args[index]!;
|
|
30
|
+
if (flag === '--dry-run') {
|
|
31
|
+
if (seen.has(flag)) { usageFailure(`duplicate option '${flag}'`); return; }
|
|
32
|
+
seen.add(flag);
|
|
33
|
+
values.dryRun = true;
|
|
34
|
+
continue;
|
|
35
|
+
}
|
|
36
|
+
const key = FLAGS[flag];
|
|
37
|
+
if (!key) { usageFailure(`unknown option '${flag}'`); return; }
|
|
38
|
+
if (seen.has(flag)) { usageFailure(`duplicate option '${flag}'`); return; }
|
|
39
|
+
const value = args[++index];
|
|
40
|
+
if (value === undefined || value.startsWith('--')) { usageFailure(`option '${flag}' requires a value`); return; }
|
|
41
|
+
seen.add(flag);
|
|
42
|
+
values[key] = value;
|
|
43
|
+
}
|
|
44
|
+
const allowed = new Set(['kind', 'taskRef', 'dryRun', 'step', 'agent', 'note', 'artifact']);
|
|
45
|
+
const unexpected = Object.keys(values).find((key) => !allowed.has(key));
|
|
46
|
+
if (unexpected) { usageFailure(`append does not accept '${unexpected}'`); return; }
|
|
47
|
+
for (const key of ['step', 'agent', 'note']) {
|
|
48
|
+
if (values[key] === undefined) { usageFailure(`append requires '${key}'`); return; }
|
|
49
|
+
}
|
|
50
|
+
const result = applyActivityAppendIntent(values as ActivityAppendIntent);
|
|
51
|
+
process.stdout.write(`${JSON.stringify(result)}\n`);
|
|
52
|
+
if (result.status === 'failed') process.exitCode = 1;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export { taskActivity };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { normalizeAgentToken, AGENT_USAGE_HINT } from '../agent-clients/tokens.ts';
|
|
1
2
|
import { applyTaskEvent, eventCatalog } from '../task/events.ts';
|
|
2
3
|
import type { TaskEventRequest, Verdict } from '../task/events.ts';
|
|
3
4
|
|
|
4
|
-
const USAGE = `Usage: agent-infra-internal task-event <N | TASK-id> <event> --agent <agent> [event options] [--dry-run]
|
|
5
|
+
const USAGE = `Usage: agent-infra-internal task-event <N | TASK-id> <event> --agent <agent> [event options] [--orchestrated] [--dry-run]
|
|
5
6
|
|
|
6
7
|
Apply one closed-set task lifecycle event and print a structured JSON result.
|
|
7
8
|
Events: ${eventCatalog.join(', ')}
|
|
@@ -29,6 +30,10 @@ function taskEvent(args: string[] = []): void {
|
|
|
29
30
|
const seen = new Set<string>();
|
|
30
31
|
for (let index = 2; index < args.length; index += 1) {
|
|
31
32
|
const flag = args[index]!;
|
|
33
|
+
if (flag === '--orchestrated') {
|
|
34
|
+
if (seen.has(flag)) { usageFailure(`duplicate option '${flag}'`); return; }
|
|
35
|
+
seen.add(flag); request.orchestrated = true; continue;
|
|
36
|
+
}
|
|
32
37
|
if (flag === '--dry-run') {
|
|
33
38
|
if (seen.has(flag)) { usageFailure(`duplicate option '${flag}'`); return; }
|
|
34
39
|
seen.add(flag); request.dryRun = true; continue;
|
|
@@ -43,6 +48,9 @@ function taskEvent(args: string[] = []): void {
|
|
|
43
48
|
else if (key === 'verdict') request.verdict = value as Verdict;
|
|
44
49
|
else (request as Record<string, unknown>)[key] = value;
|
|
45
50
|
}
|
|
51
|
+
const agent = normalizeAgentToken(String(request.agent ?? ''));
|
|
52
|
+
if (!agent) { usageFailure(`invalid --agent '${request.agent}': ${AGENT_USAGE_HINT}`); return; }
|
|
53
|
+
request.agent = agent;
|
|
46
54
|
const result = applyTaskEvent(request);
|
|
47
55
|
process.stdout.write(`${JSON.stringify(result)}\n`);
|
|
48
56
|
if (result.status === 'failed') process.exitCode = 1;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { normalizeAgentToken, AGENT_USAGE_HINT } from '../agent-clients/tokens.ts';
|
|
1
2
|
import { applyTaskLifecycle, lifecycleIntentCatalog } from '../task/lifecycle.ts';
|
|
2
3
|
import type { TaskLifecycleRequest } from '../task/lifecycle.ts';
|
|
3
4
|
|
|
@@ -33,6 +34,9 @@ function taskLifecycle(args: string[] = []): void {
|
|
|
33
34
|
seen.add(flag);
|
|
34
35
|
values[key] = key === 'alertNumber' || key === 'issueNumber' ? Number(value) : value;
|
|
35
36
|
}
|
|
37
|
+
const agent = normalizeAgentToken(String(values.agent ?? ''));
|
|
38
|
+
if (!agent) { usageFailure(`invalid --agent '${values.agent}': ${AGENT_USAGE_HINT}`); return; }
|
|
39
|
+
values.agent = agent;
|
|
36
40
|
const result = applyTaskLifecycle(values as TaskLifecycleRequest);
|
|
37
41
|
process.stdout.write(`${JSON.stringify(result)}\n`);
|
|
38
42
|
if (result.status === 'failed') process.exitCode = 1;
|