@fitlab-ai/agent-infra 0.9.11 → 0.9.13
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 +13 -13
- package/README.zh-CN.md +13 -13
- package/dist/bin/internal-cli.js +29 -19
- package/dist/lib/agent-clients/adapters/codex-lifecycle/build-identity.js +71 -10
- package/dist/lib/agent-clients/next-steps.js +6 -1
- package/dist/lib/decide.js +3 -3
- package/dist/lib/defaults.json +4 -0
- package/dist/lib/git/workflow.js +43 -1
- package/dist/lib/init.js +1 -0
- package/dist/lib/internal/git-workflow.js +8 -1
- package/dist/lib/internal/platform-checks.js +3 -3
- package/dist/lib/internal/platform-comment.js +9 -9
- package/dist/lib/internal/platform-context.js +2 -2
- package/dist/lib/internal/platform-issue.js +8 -9
- package/dist/lib/internal/platform-pr-review.js +10 -10
- package/dist/lib/internal/platform-pr.js +68 -23
- package/dist/lib/internal/platform-release-notes.js +3 -3
- package/dist/lib/internal/pr-review-grade.js +11 -9
- package/dist/lib/internal/release-workflow.js +4 -4
- package/dist/lib/internal/sandbox-control.js +30 -4
- package/dist/lib/internal/task-activity.js +3 -3
- package/dist/lib/internal/task-artifact.js +76 -24
- package/dist/lib/internal/task-create.js +2 -2
- package/dist/lib/internal/task-delivery.js +59 -0
- package/dist/lib/internal/task-event.js +6 -3
- package/dist/lib/internal/task-finalization.js +2 -2
- package/dist/lib/internal/task-invalidation.js +60 -0
- package/dist/lib/internal/task-ledger.js +9 -6
- package/dist/lib/internal/task-lifecycle.js +2 -2
- package/dist/lib/internal/task-override.js +4 -4
- package/dist/lib/internal/task-review.js +3 -3
- package/dist/lib/internal/task-verify.js +6 -6
- package/dist/lib/internal/task-warning.js +3 -3
- package/dist/lib/platform/adapters.js +1 -3
- package/dist/lib/platform/change-request-git-evidence.js +27 -7
- package/dist/lib/platform/completion-backfill.js +6 -5
- package/dist/lib/platform/context.js +70 -130
- package/dist/lib/platform/github-client.js +8 -2
- package/dist/lib/platform/github-provider.js +903 -0
- package/dist/lib/platform/in-label-sync.js +143 -0
- package/dist/lib/platform/issue-comments.js +94 -41
- package/dist/lib/platform/issues.js +335 -189
- package/dist/lib/platform/metadata-labels.js +6 -2
- package/dist/lib/platform/none-provider.js +28 -0
- package/dist/lib/platform/pr-change-report.js +551 -0
- package/dist/lib/platform/pr-checks.js +124 -106
- package/dist/lib/platform/pr-review.js +88 -72
- package/dist/lib/platform/pr-summary.js +523 -49
- package/dist/lib/platform/provider-bridge.js +45 -0
- package/dist/lib/platform/provider-contract.d.ts +487 -0
- package/dist/lib/platform/provider-contract.js +95 -0
- package/dist/lib/platform/provider-loader.js +251 -0
- package/dist/lib/platform/provider-validation.js +504 -0
- package/dist/lib/platform/pull-request-metadata.js +8 -6
- package/dist/lib/platform/pull-requests.js +1050 -502
- package/dist/lib/platform/release-notes.js +78 -55
- package/dist/lib/platform/releases.js +79 -50
- package/dist/lib/platform/resource-identity.d.ts +26 -0
- package/dist/lib/platform/resource-identity.js +92 -0
- package/dist/lib/platform/task-identities.js +31 -0
- package/dist/lib/platform/verification-required.js +22 -12
- package/dist/lib/platform/verification-sync.js +118 -239
- package/dist/lib/pr-review/evidence-grading.js +30 -9
- package/dist/lib/run/index.js +63 -23
- package/dist/lib/sandbox/config.js +5 -0
- package/dist/lib/sandbox/control/client.js +96 -15
- package/dist/lib/sandbox/control/executor.js +3 -3
- package/dist/lib/sandbox/control/lifecycle.js +29 -7
- package/dist/lib/sandbox/control/protocol.js +77 -0
- package/dist/lib/sandbox/control/server.js +398 -25
- package/dist/lib/sandbox/control/state.js +204 -1
- package/dist/lib/server/process-state.js +2 -2
- package/dist/lib/server/protocol.js +38 -1
- package/dist/lib/task/activity-log.js +8 -1
- package/dist/lib/task/artifact-lifecycle.js +35 -7
- package/dist/lib/task/capabilities.js +239 -0
- package/dist/lib/task/commands/status.js +32 -0
- package/dist/lib/task/commit-intent.js +100 -0
- package/dist/lib/task/commit-operation.js +207 -102
- package/dist/lib/task/control-authority.js +8 -5
- package/dist/lib/task/create-service.js +8 -8
- package/dist/lib/task/create.js +33 -7
- package/dist/lib/task/current-contract.js +5 -1
- package/dist/lib/task/decision-details.js +3 -48
- package/dist/lib/task/delivery-target.js +97 -0
- package/dist/lib/task/delivery.js +153 -0
- package/dist/lib/task/events.js +297 -17
- package/dist/lib/task/finalization.js +37 -13
- package/dist/lib/task/human-override.js +61 -36
- package/dist/lib/task/invalidation-command.js +86 -0
- package/dist/lib/task/invalidation.js +260 -0
- package/dist/lib/task/ledger-intents.js +37 -0
- package/dist/lib/task/lifecycle.js +106 -9
- package/dist/lib/task/local-artifact-finalization.js +374 -0
- package/dist/lib/task/orchestration.js +100 -151
- package/dist/lib/task/pr-delivery-fact.js +183 -0
- package/dist/lib/task/review-finalization.js +4 -8
- package/dist/lib/task/review-fingerprint.js +32 -2
- package/dist/lib/task/rework-intent.js +138 -0
- package/dist/lib/task/skill-scope.js +23 -0
- package/dist/lib/task/task-execution-lock.js +27 -17
- package/dist/lib/task/verification-engine.js +89 -38
- package/dist/lib/task/verification-review.js +1 -1
- package/dist/lib/task/verification.js +3 -3
- package/dist/lib/task/workflow-warning-intents.js +1 -1
- package/dist/lib/task/write.js +11 -0
- package/dist/lib/update.js +9 -0
- package/dist/lib/version.js +11 -1
- package/dist/lifecycle-build-manifest.json +3 -3
- 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/next-steps.ts +6 -1
- package/lib/decide.ts +3 -3
- package/lib/defaults.json +4 -0
- package/lib/git/workflow.ts +38 -1
- package/lib/init.ts +4 -1
- package/lib/internal/git-workflow.ts +7 -1
- package/lib/internal/platform-checks.ts +3 -3
- package/lib/internal/platform-comment.ts +8 -8
- package/lib/internal/platform-context.ts +2 -2
- package/lib/internal/platform-issue.ts +7 -8
- package/lib/internal/platform-pr-review.ts +9 -9
- package/lib/internal/platform-pr.ts +53 -21
- package/lib/internal/platform-release-notes.ts +3 -3
- package/lib/internal/pr-review-grade.ts +10 -8
- package/lib/internal/release-workflow.ts +4 -4
- package/lib/internal/sandbox-control.ts +27 -3
- package/lib/internal/task-activity.ts +3 -3
- package/lib/internal/task-artifact.ts +65 -22
- package/lib/internal/task-create.ts +2 -2
- package/lib/internal/task-delivery.ts +53 -0
- package/lib/internal/task-event.ts +6 -3
- package/lib/internal/task-finalization.ts +3 -3
- package/lib/internal/task-invalidation.ts +39 -0
- package/lib/internal/task-ledger.ts +11 -8
- package/lib/internal/task-lifecycle.ts +2 -2
- package/lib/internal/task-override.ts +6 -6
- package/lib/internal/task-review.ts +3 -3
- package/lib/internal/task-verify.ts +6 -6
- package/lib/internal/task-warning.ts +3 -3
- package/lib/platform/adapters.ts +3 -2
- package/lib/platform/change-request-git-evidence.ts +36 -9
- package/lib/platform/completion-backfill.ts +9 -8
- package/lib/platform/context.ts +97 -134
- package/lib/platform/github-client.ts +10 -3
- package/lib/platform/github-provider.ts +910 -0
- package/lib/platform/in-label-sync.ts +208 -0
- package/lib/platform/issue-comments.ts +97 -47
- package/lib/platform/issues.ts +344 -174
- package/lib/platform/metadata-labels.ts +5 -2
- package/lib/platform/none-provider.ts +35 -0
- package/lib/platform/pr-change-report.ts +645 -0
- package/lib/platform/pr-checks.ts +129 -107
- package/lib/platform/pr-review.ts +88 -85
- package/lib/platform/pr-summary.ts +562 -52
- package/lib/platform/provider-bridge.ts +82 -0
- package/lib/platform/provider-contract.ts +536 -0
- package/lib/platform/provider-loader.ts +307 -0
- package/lib/platform/provider-validation.ts +529 -0
- package/lib/platform/pull-request-metadata.ts +10 -7
- package/lib/platform/pull-requests.ts +1126 -505
- package/lib/platform/release-notes.ts +76 -59
- package/lib/platform/releases.ts +77 -43
- package/lib/platform/resource-identity.ts +121 -0
- package/lib/platform/task-identities.ts +40 -0
- package/lib/platform/types.ts +4 -2
- package/lib/platform/verification-required.ts +21 -13
- package/lib/platform/verification-sync.ts +118 -293
- package/lib/pr-review/evidence-grading.ts +31 -11
- package/lib/run/index.ts +57 -22
- package/lib/sandbox/config.ts +7 -0
- package/lib/sandbox/control/client.ts +105 -15
- package/lib/sandbox/control/executor.ts +4 -4
- package/lib/sandbox/control/lifecycle.ts +30 -8
- package/lib/sandbox/control/protocol.ts +113 -0
- package/lib/sandbox/control/server.ts +431 -23
- package/lib/sandbox/control/state.ts +251 -1
- package/lib/server/process-state.ts +2 -2
- package/lib/server/protocol.ts +36 -1
- package/lib/task/activity-log.ts +8 -0
- package/lib/task/artifact-lifecycle.ts +34 -8
- package/lib/task/capabilities.ts +262 -0
- package/lib/task/commands/status.ts +38 -0
- package/lib/task/commit-intent.ts +137 -0
- package/lib/task/commit-operation.ts +186 -88
- package/lib/task/control-authority.ts +11 -8
- package/lib/task/create-service.ts +8 -8
- package/lib/task/create.ts +34 -9
- package/lib/task/current-contract.ts +6 -1
- package/lib/task/decision-details.ts +8 -64
- package/lib/task/delivery-target.ts +130 -0
- package/lib/task/delivery.ts +160 -0
- package/lib/task/events.ts +296 -16
- package/lib/task/finalization.ts +50 -14
- package/lib/task/human-override.ts +73 -46
- package/lib/task/invalidation-command.ts +86 -0
- package/lib/task/invalidation.ts +332 -0
- package/lib/task/ledger-intents.ts +35 -1
- package/lib/task/lifecycle.ts +93 -4
- package/lib/task/local-artifact-finalization.ts +563 -0
- package/lib/task/orchestration.ts +110 -146
- package/lib/task/pr-delivery-fact.ts +237 -0
- package/lib/task/review-finalization.ts +4 -14
- package/lib/task/review-fingerprint.ts +33 -2
- package/lib/task/rework-intent.ts +165 -0
- package/lib/task/skill-scope.ts +24 -0
- package/lib/task/task-execution-lock.ts +23 -14
- package/lib/task/verification-engine.ts +95 -43
- package/lib/task/verification-review.ts +2 -0
- package/lib/task/verification.ts +4 -4
- package/lib/task/workflow-warning-intents.ts +1 -1
- package/lib/task/write.ts +19 -0
- package/lib/update.ts +11 -1
- package/lib/version.ts +15 -1
- package/package.json +7 -1
- package/templates/.agents/rules/README.en.md +4 -2
- package/templates/.agents/rules/README.zh-CN.md +4 -2
- 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/issue-pr-commands.en.md +4 -17
- package/templates/.agents/rules/issue-pr-commands.zh-CN.md +1 -1
- package/templates/.agents/rules/issue-sync.en.md +28 -5
- package/templates/.agents/rules/issue-sync.zh-CN.md +64 -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 +53 -0
- package/templates/.agents/rules/local-artifact-repair.zh-CN.md +53 -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/pr-sync.en.md +28 -13
- package/templates/.agents/rules/pr-sync.zh-CN.md +39 -5
- 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/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 +1 -1
- package/templates/.agents/rules/task-management.zh-CN.md +1 -1
- package/templates/.agents/rules/task-short-id.en.md +1 -4
- package/templates/.agents/rules/task-short-id.zh-CN.md +1 -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 +14 -3
- package/templates/.agents/skills/analyze-task/SKILL.zh-CN.md +11 -3
- package/templates/.agents/skills/check-task/SKILL.en.md +16 -37
- package/templates/.agents/skills/check-task/SKILL.zh-CN.md +16 -37
- package/templates/.agents/skills/close-codescan/SKILL.en.md +2 -2
- package/templates/.agents/skills/close-codescan/SKILL.zh-CN.md +2 -2
- package/templates/.agents/skills/close-dependabot/SKILL.en.md +2 -2
- package/templates/.agents/skills/close-dependabot/SKILL.zh-CN.md +2 -2
- package/templates/.agents/skills/code-task/SKILL.en.md +32 -10
- package/templates/.agents/skills/code-task/SKILL.zh-CN.md +35 -13
- package/templates/.agents/skills/code-task/config/verify.en.json +1 -0
- package/templates/.agents/skills/code-task/config/verify.zh-CN.json +1 -0
- package/templates/.agents/skills/commit/SKILL.en.md +3 -3
- package/templates/.agents/skills/commit/SKILL.zh-CN.md +3 -3
- 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/issue-metadata-sync.en.md +2 -0
- package/templates/.agents/skills/commit/reference/issue-metadata-sync.zh-CN.md +2 -0
- package/templates/.agents/skills/commit/reference/pr-summary-sync.en.md +4 -4
- package/templates/.agents/skills/commit/reference/pr-summary-sync.zh-CN.md +4 -4
- 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 -4
- package/templates/.agents/skills/complete-manual-validation/SKILL.zh-CN.md +7 -4
- 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 +5 -4
- package/templates/.agents/skills/complete-manual-validation/reference/summary-update.zh-CN.md +5 -4
- package/templates/.agents/skills/complete-task/SKILL.en.md +31 -13
- package/templates/.agents/skills/complete-task/SKILL.zh-CN.md +30 -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 +11 -10
- package/templates/.agents/skills/create-pr/SKILL.zh-CN.md +11 -11
- package/templates/.agents/skills/create-pr/config/verify.json +1 -0
- package/templates/.agents/skills/create-pr/reference/change-report.en.md +16 -4
- package/templates/.agents/skills/create-pr/reference/change-report.zh-CN.md +16 -4
- package/templates/.agents/skills/create-pr/reference/comment-publish.en.md +5 -3
- package/templates/.agents/skills/create-pr/reference/comment-publish.zh-CN.md +5 -3
- package/templates/.agents/skills/create-pr/reference/pr-body-template.en.md +1 -1
- package/templates/.agents/skills/create-pr/reference/pr-body-template.zh-CN.md +1 -1
- package/templates/.agents/skills/create-pr/scripts/change-report.mjs +3 -0
- package/templates/.agents/skills/create-task/SKILL.en.md +1 -0
- package/templates/.agents/skills/create-task/SKILL.zh-CN.md +1 -0
- 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/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 +14 -3
- package/templates/.agents/skills/plan-task/SKILL.zh-CN.md +11 -3
- package/templates/.agents/skills/review-analysis/SKILL.en.md +6 -5
- package/templates/.agents/skills/review-analysis/SKILL.zh-CN.md +6 -5
- 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 +10 -9
- package/templates/.agents/skills/review-code/SKILL.zh-CN.md +10 -9
- 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 +6 -5
- package/templates/.agents/skills/review-plan/SKILL.zh-CN.md +6 -5
- 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 -2
- package/templates/.agents/skills/run-manual-validation/SKILL.zh-CN.md +5 -2
- package/templates/.agents/skills/run-task/SKILL.en.md +1 -1
- package/templates/.agents/skills/run-task/SKILL.zh-CN.md +1 -1
- package/templates/.agents/skills/update-agent-infra/scripts/sync-templates.js +4 -0
- package/templates/.agents/skills/watch-pr/SKILL.en.md +6 -6
- package/templates/.agents/skills/watch-pr/SKILL.zh-CN.md +6 -6
- package/templates/.agents/skills/watch-pr/reference/monitor-and-heal.en.md +6 -0
- package/templates/.agents/skills/watch-pr/reference/monitor-and-heal.zh-CN.md +6 -0
- package/templates/.agents/templates/task.en.md +23 -2
- package/templates/.agents/templates/task.zh-CN.md +23 -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/.github/workflows/pr-label.yml +7 -26
- 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 -44
- package/templates/.agents/rules/release-commands.github.zh-CN.md +0 -44
- package/templates/.agents/rules/security-alerts.github.en.md +0 -43
- package/templates/.agents/rules/security-alerts.github.zh-CN.md +0 -43
- /package/templates/.agents/rules/{issue-fields.github.en.md → issue-fields.en.md} +0 -0
- /package/templates/.agents/rules/{issue-fields.github.zh-CN.md → issue-fields.zh-CN.md} +0 -0
|
@@ -3,7 +3,7 @@ import { normalizeAgentToken, AGENT_USAGE_HINT } from '../agent-clients/tokens.j
|
|
|
3
3
|
import { bindPlatformIssue, createPlatformIssue, inspectPlatformIssue, syncPlatformIssue } from '../platform/issues.js';
|
|
4
4
|
const USAGE = `Usage: agent-infra-internal platform-issue inspect <task-ref> [--cwd <path>]
|
|
5
5
|
agent-infra-internal platform-issue create <task-ref> --agent <agent> [--dry-run] [--cwd <path>]
|
|
6
|
-
agent-infra-internal platform-issue bind <task-ref> --issue <
|
|
6
|
+
agent-infra-internal platform-issue bind <task-ref> --issue <token> --agent <agent> [--dry-run] [--cwd <path>]
|
|
7
7
|
agent-infra-internal platform-issue sync <task-ref> --agent <agent> [--status <suffix|none>] [--assignees current|none] [--milestone initial|specific|none] [--issue-type] [--fields] [--requirements] [--in-labels from-diff|none] [--base <branch>] [--state open|closed] [--close-reason completed|not_planned] [--dry-run] [--cwd <path>]
|
|
8
8
|
`;
|
|
9
9
|
const BOOLEAN_FLAGS = new Set(['--dry-run', '--issue-type', '--fields', '--requirements']);
|
|
@@ -54,7 +54,7 @@ function oneOf(values, name, allowed) {
|
|
|
54
54
|
throw new Error(`--${name.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`)} must be one of ${allowed.join('|')}`);
|
|
55
55
|
return value;
|
|
56
56
|
}
|
|
57
|
-
function platformIssue(args = []) {
|
|
57
|
+
async function platformIssue(args = []) {
|
|
58
58
|
if (args[0] === '--help' || args[0] === '-h') {
|
|
59
59
|
process.stdout.write(USAGE);
|
|
60
60
|
return;
|
|
@@ -86,7 +86,7 @@ function platformIssue(args = []) {
|
|
|
86
86
|
return;
|
|
87
87
|
}
|
|
88
88
|
if (operation === 'inspect') {
|
|
89
|
-
finish(inspectPlatformIssue(taskRef, { cwd }));
|
|
89
|
+
finish(await inspectPlatformIssue(taskRef, { cwd }));
|
|
90
90
|
return;
|
|
91
91
|
}
|
|
92
92
|
if (typeof values.agent !== 'string' || !values.agent) {
|
|
@@ -100,16 +100,15 @@ function platformIssue(args = []) {
|
|
|
100
100
|
}
|
|
101
101
|
values.agent = agent;
|
|
102
102
|
if (operation === 'create') {
|
|
103
|
-
finish(createPlatformIssue(taskRef, { cwd, agent: values.agent, dryRun: values.dryRun === true }));
|
|
103
|
+
finish(await createPlatformIssue(taskRef, { cwd, agent: values.agent, dryRun: values.dryRun === true }));
|
|
104
104
|
return;
|
|
105
105
|
}
|
|
106
106
|
if (operation === 'bind') {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
fail('bind requires a positive --issue');
|
|
107
|
+
if (typeof values.issue !== 'string' || !values.issue) {
|
|
108
|
+
fail('bind requires --issue <token>');
|
|
110
109
|
return;
|
|
111
110
|
}
|
|
112
|
-
finish(bindPlatformIssue(taskRef, { cwd, agent: values.agent, issue, dryRun: values.dryRun === true }));
|
|
111
|
+
finish(await bindPlatformIssue(taskRef, { cwd, agent: values.agent, issue: values.issue, dryRun: values.dryRun === true }));
|
|
113
112
|
return;
|
|
114
113
|
}
|
|
115
114
|
try {
|
|
@@ -127,7 +126,7 @@ function platformIssue(args = []) {
|
|
|
127
126
|
const desiredKeys = ['status', 'assignees', 'milestone', 'issueType', 'fields', 'requirements', 'inLabels', 'state'];
|
|
128
127
|
if (!desiredKeys.some((name) => values[name] !== undefined))
|
|
129
128
|
throw new Error('sync requires at least one desired-state option');
|
|
130
|
-
finish(syncPlatformIssue(taskRef, {
|
|
129
|
+
finish(await syncPlatformIssue(taskRef, {
|
|
131
130
|
cwd, agent: values.agent, dryRun: values.dryRun === true,
|
|
132
131
|
status: typeof values.status === 'string' ? values.status : undefined,
|
|
133
132
|
assignees: assignees,
|
|
@@ -2,9 +2,9 @@ import fs from 'node:fs';
|
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import { inspectPlatformPullRequestByNumber } from '../platform/pull-requests.js';
|
|
4
4
|
import { listPrReviews, publishPrReview } from '../platform/pr-review.js';
|
|
5
|
-
const USAGE = `Usage: agent-infra-internal platform-pr-review inspect --pr <
|
|
6
|
-
agent-infra-internal platform-pr-review list --pr <
|
|
7
|
-
agent-infra-internal platform-pr-review publish --pr <
|
|
5
|
+
const USAGE = `Usage: agent-infra-internal platform-pr-review inspect --pr <token> [--cwd <path>]
|
|
6
|
+
agent-infra-internal platform-pr-review list --pr <token> [--cwd <path>]
|
|
7
|
+
agent-infra-internal platform-pr-review publish --pr <token> --scope <taskId|pr{N}> --round <N> --commit <sha> --event <COMMENT|APPROVE|REQUEST_CHANGES> --body-file <path|-> [--dry-run] [--cwd <path>]
|
|
8
8
|
`;
|
|
9
9
|
const BOOLEAN_FLAGS = new Set(['--dry-run']);
|
|
10
10
|
const VALUE_FLAGS = new Set(['--cwd', '--pr', '--scope', '--round', '--commit', '--event', '--body-file']);
|
|
@@ -47,7 +47,7 @@ function parse(args, start) {
|
|
|
47
47
|
function readBodyFile(value, cwd) {
|
|
48
48
|
return value === '-' ? fs.readFileSync(0, 'utf8') : fs.readFileSync(path.resolve(cwd, value), 'utf8');
|
|
49
49
|
}
|
|
50
|
-
function platformPrReview(args = []) {
|
|
50
|
+
async function platformPrReview(args = []) {
|
|
51
51
|
if (args[0] === '--help' || args[0] === '-h') {
|
|
52
52
|
process.stdout.write(USAGE);
|
|
53
53
|
return;
|
|
@@ -74,17 +74,17 @@ function platformPrReview(args = []) {
|
|
|
74
74
|
fail(`${operation} does not accept --${unexpected}`);
|
|
75
75
|
return;
|
|
76
76
|
}
|
|
77
|
-
const pr =
|
|
78
|
-
if (
|
|
79
|
-
fail(`${operation} requires
|
|
77
|
+
const pr = values.pr;
|
|
78
|
+
if (typeof pr !== 'string' || !pr) {
|
|
79
|
+
fail(`${operation} requires --pr <token>`);
|
|
80
80
|
return;
|
|
81
81
|
}
|
|
82
82
|
if (operation === 'inspect') {
|
|
83
|
-
finish(inspectPlatformPullRequestByNumber(pr, { cwd }));
|
|
83
|
+
finish(await inspectPlatformPullRequestByNumber(pr, { cwd }));
|
|
84
84
|
return;
|
|
85
85
|
}
|
|
86
86
|
if (operation === 'list') {
|
|
87
|
-
finish(listPrReviews(pr, { cwd }));
|
|
87
|
+
finish(await listPrReviews(pr, { cwd }));
|
|
88
88
|
return;
|
|
89
89
|
}
|
|
90
90
|
const scope = typeof values.scope === 'string' ? values.scope : '';
|
|
@@ -119,7 +119,7 @@ function platformPrReview(args = []) {
|
|
|
119
119
|
fail(`unable to read body file: ${error instanceof Error ? error.message : String(error)}`);
|
|
120
120
|
return;
|
|
121
121
|
}
|
|
122
|
-
finish(publishPrReview({
|
|
122
|
+
finish(await publishPrReview({
|
|
123
123
|
cwd,
|
|
124
124
|
prNumber: pr,
|
|
125
125
|
identity: { scope, round, commitSha: commit },
|
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
import fs from 'node:fs';
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import { normalizeAgentToken, AGENT_USAGE_HINT } from '../agent-clients/tokens.js';
|
|
4
|
-
import { bindPlatformPullRequest, createPlatformPullRequest, inspectPlatformPullRequest, resolveExternalPullRequest, syncPlatformPullRequest } from '../platform/pull-requests.js';
|
|
5
|
-
import { summaryContext, syncPullRequestSummary } from '../platform/pr-summary.js';
|
|
4
|
+
import { bindPlatformPullRequest, createPlatformPullRequest, inspectPlatformPullRequest, resolveExternalPullRequest, skipPlatformPullRequestFact, syncPlatformPullRequest, syncPlatformPullRequestInLabels } from '../platform/pull-requests.js';
|
|
5
|
+
import { reportWrite, summaryContext, syncPullRequestSummary } from '../platform/pr-summary.js';
|
|
6
6
|
const USAGE = `Usage: agent-infra-internal platform-pr inspect <task-ref> [--cwd <path>]
|
|
7
|
-
agent-infra-internal platform-pr resolve-external <task-ref> --agent <agent> [--pr <
|
|
7
|
+
agent-infra-internal platform-pr resolve-external <task-ref> --agent <agent> [--pr <token>] [--dry-run] [--cwd <path>]
|
|
8
8
|
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>]
|
|
9
|
-
agent-infra-internal platform-pr bind <task-ref> --pr <
|
|
9
|
+
agent-infra-internal platform-pr bind <task-ref> --pr <token> --agent <agent> [--dry-run] [--cwd <path>]
|
|
10
|
+
agent-infra-internal platform-pr skip <task-ref> --agent <agent> [--dry-run] [--cwd <path>]
|
|
10
11
|
agent-infra-internal platform-pr sync <task-ref> --agent <agent> [--metadata] [--closing-issue] --result <pr_created|pr_reused|no_op> [--dry-run] [--cwd <path>]
|
|
12
|
+
agent-infra-internal platform-pr sync-in-labels --pr <N> [--dry-run] [--cwd <path>]
|
|
11
13
|
agent-infra-internal platform-pr summary-context <task-ref> [--cwd <path>]
|
|
12
|
-
agent-infra-internal platform-pr
|
|
14
|
+
agent-infra-internal platform-pr change-report <task-ref> --agent <agent> --mechanical-file <path> --precheck-file <path> [--dry-run] [--cwd <path>]
|
|
15
|
+
agent-infra-internal platform-pr summary-sync <task-ref> --agent <agent> --body-file <path|-> --change-report-file <path> --result <pr_created|pr_reused|no_op> [--strict] [--dry-run] [--cwd <path>]
|
|
13
16
|
`;
|
|
14
|
-
const BOOLEAN_FLAGS = new Set(['--draft', '--dry-run', '--metadata', '--closing-issue']);
|
|
15
|
-
const VALUE_FLAGS = new Set(['--cwd', '--agent', '--base', '--head', '--title-file', '--body-file', '--pr', '--result']);
|
|
17
|
+
const BOOLEAN_FLAGS = new Set(['--draft', '--dry-run', '--metadata', '--closing-issue', '--strict']);
|
|
18
|
+
const VALUE_FLAGS = new Set(['--cwd', '--agent', '--base', '--head', '--title-file', '--body-file', '--change-report-file', '--mechanical-file', '--precheck-file', '--pr', '--result']);
|
|
16
19
|
function key(flag) {
|
|
17
20
|
return flag.slice(2).replace(/-([a-z])/g, (_, letter) => letter.toUpperCase());
|
|
18
21
|
}
|
|
@@ -52,16 +55,37 @@ function parse(args, start) {
|
|
|
52
55
|
function readFile(value, cwd) {
|
|
53
56
|
return value === '-' ? fs.readFileSync(0, 'utf8') : fs.readFileSync(path.resolve(cwd, value), 'utf8');
|
|
54
57
|
}
|
|
55
|
-
function platformPr(args = []) {
|
|
58
|
+
async function platformPr(args = []) {
|
|
56
59
|
if (args[0] === '--help' || args[0] === '-h') {
|
|
57
60
|
process.stdout.write(USAGE);
|
|
58
61
|
return;
|
|
59
62
|
}
|
|
60
63
|
const operation = args[0];
|
|
61
|
-
if (!operation || !['inspect', 'resolve-external', 'create', 'bind', 'sync', 'summary-context', 'summary-sync'].includes(operation)) {
|
|
64
|
+
if (!operation || !['inspect', 'resolve-external', 'create', 'bind', 'skip', 'sync', 'sync-in-labels', 'summary-context', 'change-report', 'summary-sync'].includes(operation)) {
|
|
62
65
|
fail('a valid operation is required');
|
|
63
66
|
return;
|
|
64
67
|
}
|
|
68
|
+
if (operation === 'sync-in-labels') {
|
|
69
|
+
const parsed = parse(args, 1);
|
|
70
|
+
if (parsed.error) {
|
|
71
|
+
fail(parsed.error);
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
const values = parsed.values;
|
|
75
|
+
const unexpected = Object.keys(values).find((name) => !['cwd', 'pr', 'dryRun'].includes(name));
|
|
76
|
+
if (unexpected) {
|
|
77
|
+
fail(`sync-in-labels does not accept --${unexpected}`);
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
const pr = Number(values.pr);
|
|
81
|
+
if (!Number.isInteger(pr) || pr <= 0) {
|
|
82
|
+
fail('sync-in-labels requires a positive --pr');
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
const cwd = path.resolve(typeof values.cwd === 'string' ? values.cwd : process.cwd());
|
|
86
|
+
finish(await syncPlatformPullRequestInLabels(pr, { cwd, dryRun: values.dryRun === true }));
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
65
89
|
const taskRef = args[1];
|
|
66
90
|
if (!taskRef || taskRef.startsWith('--')) {
|
|
67
91
|
fail(`${operation} requires a task ref`);
|
|
@@ -79,9 +103,12 @@ function platformPr(args = []) {
|
|
|
79
103
|
'resolve-external': ['cwd', 'agent', 'pr', 'dryRun'],
|
|
80
104
|
create: ['cwd', 'agent', 'base', 'head', 'titleFile', 'bodyFile', 'draft', 'dryRun'],
|
|
81
105
|
bind: ['cwd', 'agent', 'pr', 'dryRun'],
|
|
106
|
+
skip: ['cwd', 'agent', 'dryRun'],
|
|
82
107
|
sync: ['cwd', 'agent', 'metadata', 'closingIssue', 'result', 'dryRun'],
|
|
108
|
+
'sync-in-labels': ['cwd', 'pr', 'dryRun'],
|
|
83
109
|
'summary-context': ['cwd'],
|
|
84
|
-
'
|
|
110
|
+
'change-report': ['cwd', 'agent', 'mechanicalFile', 'precheckFile', 'dryRun'],
|
|
111
|
+
'summary-sync': ['cwd', 'agent', 'bodyFile', 'changeReportFile', 'result', 'dryRun', 'strict']
|
|
85
112
|
};
|
|
86
113
|
const unexpected = Object.keys(values).find((name) => !allowed[operation].includes(name));
|
|
87
114
|
if (unexpected) {
|
|
@@ -89,11 +116,11 @@ function platformPr(args = []) {
|
|
|
89
116
|
return;
|
|
90
117
|
}
|
|
91
118
|
if (operation === 'inspect') {
|
|
92
|
-
finish(inspectPlatformPullRequest(taskRef, { cwd }));
|
|
119
|
+
finish(await inspectPlatformPullRequest(taskRef, { cwd }));
|
|
93
120
|
return;
|
|
94
121
|
}
|
|
95
122
|
if (operation === 'summary-context') {
|
|
96
|
-
finish(summaryContext(taskRef, { cwd }));
|
|
123
|
+
finish(await summaryContext(taskRef, { cwd }));
|
|
97
124
|
return;
|
|
98
125
|
}
|
|
99
126
|
if (typeof values.agent !== 'string' || !values.agent) {
|
|
@@ -106,27 +133,41 @@ function platformPr(args = []) {
|
|
|
106
133
|
return;
|
|
107
134
|
}
|
|
108
135
|
values.agent = agent;
|
|
136
|
+
if (operation === 'change-report') {
|
|
137
|
+
if (typeof values.mechanicalFile !== 'string' || typeof values.precheckFile !== 'string') {
|
|
138
|
+
fail('change-report requires --mechanical-file and --precheck-file');
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
finish(await reportWrite(taskRef, {
|
|
142
|
+
cwd, agent: values.agent, mechanicalFile: values.mechanicalFile, precheckFile: values.precheckFile, dryRun: values.dryRun === true
|
|
143
|
+
}));
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
if (operation === 'skip') {
|
|
147
|
+
finish(await skipPlatformPullRequestFact(taskRef, { cwd, agent, dryRun: values.dryRun === true }));
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
109
150
|
const primaryResult = values.result === undefined ? undefined : values.result;
|
|
110
151
|
if (primaryResult !== undefined && !['pr_created', 'pr_reused', 'no_op'].includes(primaryResult)) {
|
|
111
152
|
fail('--result must be pr_created, pr_reused, or no_op');
|
|
112
153
|
return;
|
|
113
154
|
}
|
|
114
155
|
if (operation === 'resolve-external') {
|
|
115
|
-
const pr = values.pr === undefined ? undefined :
|
|
116
|
-
if (pr !== undefined && (
|
|
117
|
-
fail('resolve-external requires
|
|
156
|
+
const pr = values.pr === undefined ? undefined : values.pr;
|
|
157
|
+
if (pr !== undefined && (typeof pr !== 'string' || !pr)) {
|
|
158
|
+
fail('resolve-external requires --pr <token>');
|
|
118
159
|
return;
|
|
119
160
|
}
|
|
120
|
-
finish(resolveExternalPullRequest(taskRef, { cwd, agent: values.agent, pr, dryRun: values.dryRun === true }));
|
|
161
|
+
finish(await resolveExternalPullRequest(taskRef, { cwd, agent: values.agent, pr, dryRun: values.dryRun === true }));
|
|
121
162
|
return;
|
|
122
163
|
}
|
|
123
164
|
if (operation === 'bind') {
|
|
124
|
-
const pr =
|
|
125
|
-
if (
|
|
126
|
-
fail('bind requires
|
|
165
|
+
const pr = values.pr;
|
|
166
|
+
if (typeof pr !== 'string' || !pr) {
|
|
167
|
+
fail('bind requires --pr <token>');
|
|
127
168
|
return;
|
|
128
169
|
}
|
|
129
|
-
finish(bindPlatformPullRequest(taskRef, { cwd, agent: values.agent, pr, dryRun: values.dryRun === true }));
|
|
170
|
+
finish(await bindPlatformPullRequest(taskRef, { cwd, agent: values.agent, pr, dryRun: values.dryRun === true }));
|
|
130
171
|
return;
|
|
131
172
|
}
|
|
132
173
|
if (operation === 'sync') {
|
|
@@ -138,7 +179,7 @@ function platformPr(args = []) {
|
|
|
138
179
|
fail('sync requires --result pr_created, pr_reused, or no_op');
|
|
139
180
|
return;
|
|
140
181
|
}
|
|
141
|
-
finish(syncPlatformPullRequest(taskRef, { cwd, agent: values.agent, metadata: values.metadata === true, closingIssue: values.closingIssue === true, primaryResult: primaryResult, dryRun: values.dryRun === true }));
|
|
182
|
+
finish(await syncPlatformPullRequest(taskRef, { cwd, agent: values.agent, metadata: values.metadata === true, closingIssue: values.closingIssue === true, primaryResult: primaryResult, dryRun: values.dryRun === true }));
|
|
142
183
|
return;
|
|
143
184
|
}
|
|
144
185
|
if (operation === 'summary-sync') {
|
|
@@ -146,12 +187,16 @@ function platformPr(args = []) {
|
|
|
146
187
|
fail('summary-sync requires --body-file');
|
|
147
188
|
return;
|
|
148
189
|
}
|
|
190
|
+
if (typeof values.changeReportFile !== 'string') {
|
|
191
|
+
fail('summary-sync requires --change-report-file');
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
149
194
|
if (!primaryResult) {
|
|
150
195
|
fail('summary-sync requires --result pr_created, pr_reused, or no_op');
|
|
151
196
|
return;
|
|
152
197
|
}
|
|
153
198
|
try {
|
|
154
|
-
finish(syncPullRequestSummary(taskRef, { cwd, agent: values.agent, body: readFile(values.bodyFile, cwd), primaryResult: primaryResult, dryRun: values.dryRun === true }));
|
|
199
|
+
finish(await syncPullRequestSummary(taskRef, { cwd, agent: values.agent, body: readFile(values.bodyFile, cwd), changeReportFile: values.changeReportFile, primaryResult: primaryResult, dryRun: values.dryRun === true, strict: values.strict === true }));
|
|
155
200
|
}
|
|
156
201
|
catch (error) {
|
|
157
202
|
fail(`unable to read body file: ${error instanceof Error ? error.message : String(error)}`);
|
|
@@ -163,7 +208,7 @@ function platformPr(args = []) {
|
|
|
163
208
|
return;
|
|
164
209
|
}
|
|
165
210
|
try {
|
|
166
|
-
finish(createPlatformPullRequest(taskRef, {
|
|
211
|
+
finish(await createPlatformPullRequest(taskRef, {
|
|
167
212
|
cwd, agent: values.agent, base: values.base, head: values.head,
|
|
168
213
|
title: readFile(values.titleFile, cwd), body: readFile(values.bodyFile, cwd),
|
|
169
214
|
draft: values.draft === true, dryRun: values.dryRun === true
|
|
@@ -28,7 +28,7 @@ function finish(result) {
|
|
|
28
28
|
process.stdout.write(`${JSON.stringify(result)}\n`);
|
|
29
29
|
process.exitCode = result.status === 'blocked' ? 2 : result.status === 'failed' ? 1 : 0;
|
|
30
30
|
}
|
|
31
|
-
function platformReleaseNotes(args = []) {
|
|
31
|
+
async function platformReleaseNotes(args = []) {
|
|
32
32
|
const [action, ...rest] = args;
|
|
33
33
|
if (action === 'context') {
|
|
34
34
|
const parsed = parseOptions(rest, ['--cwd', '--history-limit', '--from-tag', '--to-tag', '--branch']);
|
|
@@ -36,7 +36,7 @@ function platformReleaseNotes(args = []) {
|
|
|
36
36
|
return finish(invalidInput('invalid context options'));
|
|
37
37
|
const cwd = path.resolve(parsed.values.get('--cwd') || process.cwd());
|
|
38
38
|
const historyRaw = parsed.values.get('--history-limit') ?? null;
|
|
39
|
-
finish(releaseNoteContext({
|
|
39
|
+
finish(await releaseNoteContext({
|
|
40
40
|
fromTag: parsed.values.get('--from-tag') || '',
|
|
41
41
|
toTag: parsed.values.get('--to-tag') || '',
|
|
42
42
|
branch: parsed.values.get('--branch') || '',
|
|
@@ -69,7 +69,7 @@ function platformReleaseNotes(args = []) {
|
|
|
69
69
|
fs.writeFileSync(resolvedNotesPath, fs.readFileSync(0));
|
|
70
70
|
}
|
|
71
71
|
try {
|
|
72
|
-
finish(publishReleaseNotes({
|
|
72
|
+
finish(await publishReleaseNotes({
|
|
73
73
|
tag: parsed.values.get('--tag') || '',
|
|
74
74
|
title: parsed.values.get('--title') || parsed.values.get('--tag') || '',
|
|
75
75
|
notesFile: resolvedNotesPath,
|
|
@@ -4,7 +4,7 @@ import { collectHostCandidates, decide, deriveTaskIssueMatches, extractClosingIs
|
|
|
4
4
|
import { inspectPlatformPullRequestByNumber } from '../platform/pull-requests.js';
|
|
5
5
|
import { verifyInProcess } from '../task/verification-engine.js';
|
|
6
6
|
const USAGE = `Usage: agent-infra-internal pr-review-grade decide --input-file <path|-> [--cwd <path>]
|
|
7
|
-
agent-infra-internal pr-review-grade resolve-host --pr <
|
|
7
|
+
agent-infra-internal pr-review-grade resolve-host --pr <token> [--cwd <path>]
|
|
8
8
|
agent-infra-internal pr-review-grade verify-artifact --artifact-file <path> [--cwd <path>]
|
|
9
9
|
`;
|
|
10
10
|
function fail(message) {
|
|
@@ -38,7 +38,7 @@ function parseFlags(args, start) {
|
|
|
38
38
|
function readInput(value, cwd) {
|
|
39
39
|
return value === '-' ? fs.readFileSync(0, 'utf8') : fs.readFileSync(path.resolve(cwd, value), 'utf8');
|
|
40
40
|
}
|
|
41
|
-
function prReviewGrade(args = []) {
|
|
41
|
+
async function prReviewGrade(args = []) {
|
|
42
42
|
if (args[0] === '--help' || args[0] === '-h') {
|
|
43
43
|
process.stdout.write(USAGE);
|
|
44
44
|
return;
|
|
@@ -89,12 +89,12 @@ function prReviewGrade(args = []) {
|
|
|
89
89
|
return;
|
|
90
90
|
}
|
|
91
91
|
if (operation === 'resolve-host') {
|
|
92
|
-
const pr =
|
|
93
|
-
if (!
|
|
94
|
-
fail('resolve-host requires
|
|
92
|
+
const pr = typeof values.pr === 'string' ? values.pr : '';
|
|
93
|
+
if (!pr) {
|
|
94
|
+
fail('resolve-host requires --pr <token>');
|
|
95
95
|
return;
|
|
96
96
|
}
|
|
97
|
-
const inspected = inspectPlatformPullRequestByNumber(pr, { cwd });
|
|
97
|
+
const inspected = await inspectPlatformPullRequestByNumber(pr, { cwd });
|
|
98
98
|
if (!inspected.pullRequest) {
|
|
99
99
|
finish({
|
|
100
100
|
status: 'failed', changed: false, host: null, candidates: [], closingIssues: [],
|
|
@@ -102,12 +102,14 @@ function prReviewGrade(args = []) {
|
|
|
102
102
|
}, inspected.status === 'blocked' ? 2 : 1);
|
|
103
103
|
return;
|
|
104
104
|
}
|
|
105
|
+
const prNumber = inspected.pullRequest.number;
|
|
106
|
+
const prIdentity = inspected.pullRequest.identity || { kind: 'number', value: prNumber };
|
|
105
107
|
const closingIssues = extractClosingIssueNumbers(inspected.pullRequest.body);
|
|
106
|
-
const candidates = collectHostCandidates({ prNumber
|
|
108
|
+
const candidates = collectHostCandidates({ prNumber, prIdentity, closingIssues, workspaceRoot: cwd });
|
|
107
109
|
const host = resolveHostFromCandidates(candidates);
|
|
108
110
|
finish({
|
|
109
111
|
status: 'ok', changed: false,
|
|
110
|
-
pr: { number:
|
|
112
|
+
pr: { number: prNumber, identity: prIdentity, baseSha: inspected.pullRequest.base.sha, headSha: inspected.pullRequest.head.sha, state: inspected.pullRequest.state },
|
|
111
113
|
closingIssues, candidates, host,
|
|
112
114
|
taskIssueMatches: deriveTaskIssueMatches(host, closingIssues), error: null
|
|
113
115
|
});
|
|
@@ -120,7 +122,7 @@ function prReviewGrade(args = []) {
|
|
|
120
122
|
const artifactPath = path.resolve(cwd, values.artifactFile);
|
|
121
123
|
let result;
|
|
122
124
|
try {
|
|
123
|
-
result = verifyInProcess({
|
|
125
|
+
result = await verifyInProcess({
|
|
124
126
|
mode: 'checks',
|
|
125
127
|
skillName: 'review-pr',
|
|
126
128
|
taskDir: path.dirname(artifactPath),
|
|
@@ -236,7 +236,7 @@ async function inspectFacts(cwd, version) {
|
|
|
236
236
|
const local = inspectLocalReleaseFacts(cwd, version);
|
|
237
237
|
const remoteBranch = branch ? git(cwd, ['ls-remote', '--heads', 'origin', branch]) : null;
|
|
238
238
|
const remoteTag = git(cwd, ['ls-remote', '--tags', 'origin', `refs/tags/${tag}`]);
|
|
239
|
-
const platform = inspectPlatformRelease(tag, { cwd });
|
|
239
|
+
const platform = await inspectPlatformRelease(tag, { cwd });
|
|
240
240
|
const npm = await inspectNpmChannel(pkg.name, version);
|
|
241
241
|
const formulaUrl = `https://raw.githubusercontent.com/${config.org}/homebrew-tap/main/Formula/${config.project}.rb`;
|
|
242
242
|
const homebrew = await inspectHomebrewChannel(formulaUrl, version);
|
|
@@ -247,7 +247,7 @@ async function inspectFacts(cwd, version) {
|
|
|
247
247
|
localTagAncestor: local.localTagAncestor,
|
|
248
248
|
localTagConflict: local.localTagConflict,
|
|
249
249
|
remoteBranch: Boolean(remoteBranch && remoteBranch.split(/\s+/)[0] === head), remoteTag: Boolean(remoteTag),
|
|
250
|
-
githubRelease: platform.
|
|
250
|
+
githubRelease: platform.error?.code === 'PLATFORM_CAPABILITY_UNSUPPORTED'
|
|
251
251
|
? true
|
|
252
252
|
: platform.status === 'blocked' ? null : Boolean(platform.release?.published),
|
|
253
253
|
npm: npm.published, homebrew: homebrew.published, smoke,
|
|
@@ -312,7 +312,7 @@ async function releaseWorkflow(args = []) {
|
|
|
312
312
|
}
|
|
313
313
|
if (action === 'prepare') {
|
|
314
314
|
if (before.phase !== 'unprepared') {
|
|
315
|
-
const milestones = reconcileReleaseMilestones(version, { cwd });
|
|
315
|
+
const milestones = await reconcileReleaseMilestones(version, { cwd });
|
|
316
316
|
process.stdout.write(`${JSON.stringify({ ...milestones, snapshot: before })}\n`);
|
|
317
317
|
process.exitCode = milestones.status === 'failed' ? 1 : milestones.status === 'blocked' ? 2 : 0;
|
|
318
318
|
return;
|
|
@@ -354,7 +354,7 @@ async function releaseWorkflow(args = []) {
|
|
|
354
354
|
return;
|
|
355
355
|
}
|
|
356
356
|
const tagged = command(cwd, 'git', ['tag', '-a', `v${version}`, '-m', `Release v${version}`]);
|
|
357
|
-
const milestones = tagged.status === 0 ? reconcileReleaseMilestones(version, { cwd }) : null;
|
|
357
|
+
const milestones = tagged.status === 0 ? await reconcileReleaseMilestones(version, { cwd }) : null;
|
|
358
358
|
const snapshot = releaseSnapshot(version, await inspectFacts(cwd, version));
|
|
359
359
|
const failed = tagged.status !== 0 || milestones?.status === 'failed';
|
|
360
360
|
const blocked = milestones?.status === 'blocked';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { requestSandboxControl, requestSandboxTaskFinalization, requestSandboxTaskControl, SandboxControlClientError } from '../sandbox/control/client.js';
|
|
1
|
+
import { recoverSandboxControl, requestSandboxControl, requestSandboxTaskFinalization, requestSandboxTaskControl, SandboxControlClientError } from '../sandbox/control/client.js';
|
|
2
2
|
import { normalizeAgentToken, AGENT_USAGE_HINT } from '../agent-clients/tokens.js';
|
|
3
3
|
import { serveSandboxControl } from '../sandbox/control/server.js';
|
|
4
4
|
import { runSandboxControlExecutor } from '../sandbox/control/executor.js';
|
|
@@ -23,6 +23,11 @@ function finalizationErrorStatus(error) {
|
|
|
23
23
|
return 'unknown';
|
|
24
24
|
return error.retryable ? 'blocked' : 'failed';
|
|
25
25
|
}
|
|
26
|
+
function writeClientError(error) {
|
|
27
|
+
process.stderr.write(`${error.detail.message}\n`);
|
|
28
|
+
if (error.requestId)
|
|
29
|
+
process.stderr.write(`SANDBOX_CONTROL_REQUEST_ID: ${error.requestId}\n`);
|
|
30
|
+
}
|
|
26
31
|
function sandboxFinalizationClient(args) {
|
|
27
32
|
if (args.length !== 4 || !args[0] || args[1] !== 'complete' || args[2] !== '--agent' || !args[3]) {
|
|
28
33
|
const error = { code: 'TASK_FINALIZATION_PAYLOAD_INVALID', message: 'task ref, complete intent, and --agent are required', retryable: false };
|
|
@@ -46,7 +51,7 @@ function sandboxFinalizationClient(args) {
|
|
|
46
51
|
if (!(error instanceof SandboxControlClientError))
|
|
47
52
|
throw error;
|
|
48
53
|
writeFinalizationEnvelope(finalizationErrorStatus(error.detail), error.accepted, error.detail);
|
|
49
|
-
|
|
54
|
+
writeClientError(error);
|
|
50
55
|
process.exitCode = error.detail.code === 'SANDBOX_CONTROL_RESULT_UNKNOWN' ? 1 : error.detail.retryable ? 2 : 1;
|
|
51
56
|
return;
|
|
52
57
|
}
|
|
@@ -95,6 +100,27 @@ async function sandboxControl(args) {
|
|
|
95
100
|
await runSandboxControlExecutor(request, nonce);
|
|
96
101
|
return;
|
|
97
102
|
}
|
|
103
|
+
if (operation === 'recover') {
|
|
104
|
+
if (rest.length !== 1 || !rest[0])
|
|
105
|
+
throw new Error('sandbox-control recover requires <request-id>');
|
|
106
|
+
let response;
|
|
107
|
+
try {
|
|
108
|
+
response = recoverSandboxControl(rest[0]);
|
|
109
|
+
}
|
|
110
|
+
catch (error) {
|
|
111
|
+
if (!(error instanceof SandboxControlClientError))
|
|
112
|
+
throw error;
|
|
113
|
+
writeClientError(error);
|
|
114
|
+
process.exitCode = error.detail.code === 'SANDBOX_CONTROL_RESULT_UNKNOWN' ? 1 : error.detail.retryable ? 75 : 1;
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
process.stdout.write(response.stdout);
|
|
118
|
+
process.stderr.write(response.stderr);
|
|
119
|
+
process.exitCode = response.phase === 'rejected'
|
|
120
|
+
? response.error?.retryable ? 75 : 1
|
|
121
|
+
: response.exitCode ?? 1;
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
98
124
|
if (operation === 'client') {
|
|
99
125
|
const [family = '', ...commandArgs] = rest;
|
|
100
126
|
if (family === 'task-finalization') {
|
|
@@ -117,7 +143,7 @@ async function sandboxControl(args) {
|
|
|
117
143
|
catch (error) {
|
|
118
144
|
if (!(error instanceof SandboxControlClientError))
|
|
119
145
|
throw error;
|
|
120
|
-
|
|
146
|
+
writeClientError(error);
|
|
121
147
|
process.exitCode = error.detail.retryable ? 75 : 1;
|
|
122
148
|
return;
|
|
123
149
|
}
|
|
@@ -132,7 +158,7 @@ async function sandboxControl(args) {
|
|
|
132
158
|
}
|
|
133
159
|
return;
|
|
134
160
|
}
|
|
135
|
-
throw new Error('Usage: agent-infra-internal sandbox-control serve --manifest <path> | execute --request <path> --nonce <nonce> | client <family> [args...]');
|
|
161
|
+
throw new Error('Usage: agent-infra-internal sandbox-control serve --manifest <path> | execute --request <path> --nonce <nonce> | client <family> [args...] | recover <request-id>');
|
|
136
162
|
}
|
|
137
163
|
export { sandboxControl };
|
|
138
164
|
//# sourceMappingURL=sandbox-control.js.map
|
|
@@ -32,7 +32,7 @@ function usageFailure(message) {
|
|
|
32
32
|
process.stderr.write(USAGE);
|
|
33
33
|
process.exitCode = 1;
|
|
34
34
|
}
|
|
35
|
-
function taskActivity(args = []) {
|
|
35
|
+
async function taskActivity(args = []) {
|
|
36
36
|
if (args[0] === '--help' || args[0] === '-h') {
|
|
37
37
|
process.stdout.write(USAGE);
|
|
38
38
|
return;
|
|
@@ -113,7 +113,7 @@ function taskActivity(args = []) {
|
|
|
113
113
|
let result;
|
|
114
114
|
let humanOverride = null;
|
|
115
115
|
try {
|
|
116
|
-
result = withTaskExecutionLock(resolved.repoRoot, resolved.taskId, `task-activity.${kind}`, () => {
|
|
116
|
+
result = await withTaskExecutionLock(resolved.repoRoot, resolved.taskId, `task-activity.${kind}`, async () => {
|
|
117
117
|
let current = applyPrReviewActivityIntent(values, { lockAlreadyHeld: true });
|
|
118
118
|
if (current.status !== 'failed' || !values.overrideTicket)
|
|
119
119
|
return current;
|
|
@@ -121,7 +121,7 @@ function taskActivity(args = []) {
|
|
|
121
121
|
usageFailure('override ticket requires target and scope');
|
|
122
122
|
return current;
|
|
123
123
|
}
|
|
124
|
-
const consumed = consumeHumanOverride({
|
|
124
|
+
const consumed = await consumeHumanOverride({
|
|
125
125
|
taskRef, ticketId: String(values.overrideTicket),
|
|
126
126
|
failureId: failureId('activity-intent', current.error?.code ?? 'TASK_STATE_MISMATCH'),
|
|
127
127
|
target: String(values.overrideTarget), scope: String(values.overrideScope)
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { resolveArtifactContext } from '../task/artifact-lifecycle.js';
|
|
2
|
-
|
|
2
|
+
import { finalizeLocalArtifact } from '../task/local-artifact-finalization.js';
|
|
3
|
+
import { resolveTaskRef } from '../task/resolve-ref.js';
|
|
4
|
+
import { loadVerificationConfig } from '../task/verification-config.js';
|
|
5
|
+
const USAGE = `Usage: agent-infra-internal task-artifact <N | TASK-id> inspect --family <family>\n agent-infra-internal task-artifact <N | TASK-id> finalize-local --family <analysis|plan|code> --artifact <artifact>\n\nInspect workflow artifact context or finalize a local analysis/plan/code artifact without changing task state.\n`;
|
|
3
6
|
function failUsage(message) {
|
|
4
7
|
process.stdout.write(`${JSON.stringify({ status: 'failed', changed: false, error: { code: 'ARTIFACT_PAYLOAD_INVALID', message } })}\n`);
|
|
5
8
|
process.stderr.write(USAGE);
|
|
@@ -14,15 +17,17 @@ function taskArtifact(args = []) {
|
|
|
14
17
|
failUsage('task ref and operation are required');
|
|
15
18
|
return;
|
|
16
19
|
}
|
|
17
|
-
|
|
18
|
-
|
|
20
|
+
const operation = args[1];
|
|
21
|
+
if (operation !== 'inspect' && operation !== 'finalize-local') {
|
|
22
|
+
failUsage(`unknown operation '${operation}'`);
|
|
19
23
|
return;
|
|
20
24
|
}
|
|
21
25
|
let family = '';
|
|
26
|
+
let artifact = '';
|
|
22
27
|
const seen = new Set();
|
|
23
28
|
for (let index = 2; index < args.length; index += 1) {
|
|
24
29
|
const flag = args[index];
|
|
25
|
-
if (flag !== '--family') {
|
|
30
|
+
if (flag !== '--family' && flag !== '--artifact') {
|
|
26
31
|
failUsage(`unknown option '${flag}'`);
|
|
27
32
|
return;
|
|
28
33
|
}
|
|
@@ -36,32 +41,79 @@ function taskArtifact(args = []) {
|
|
|
36
41
|
return;
|
|
37
42
|
}
|
|
38
43
|
seen.add(flag);
|
|
39
|
-
|
|
44
|
+
if (flag === '--family')
|
|
45
|
+
family = value;
|
|
46
|
+
else
|
|
47
|
+
artifact = value;
|
|
40
48
|
}
|
|
41
49
|
if (!family) {
|
|
42
50
|
failUsage("option '--family' is required");
|
|
43
51
|
return;
|
|
44
52
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
53
|
+
if (operation === 'inspect') {
|
|
54
|
+
if (artifact) {
|
|
55
|
+
failUsage("option '--artifact' is only valid for finalize-local");
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
const result = resolveArtifactContext(args[0], family);
|
|
59
|
+
const output = family === 'code' && result.codeMode ? {
|
|
60
|
+
...result,
|
|
61
|
+
mode: result.codeMode.mode,
|
|
62
|
+
code_max: result.codeMode.codeMax,
|
|
63
|
+
rev_max: result.codeMode.reviewMax,
|
|
64
|
+
verdict: result.codeMode.verdict,
|
|
65
|
+
next_round: result.next?.round ?? null,
|
|
66
|
+
next_artifact: result.next?.name ?? null,
|
|
67
|
+
review_artifact: result.codeMode.reviewArtifact,
|
|
68
|
+
implementation_input: result.codeMode.implementationInput,
|
|
69
|
+
decision_id: result.codeMode.decisionId,
|
|
70
|
+
decision_evidence: result.codeMode.decisionEvidence,
|
|
71
|
+
message: result.codeMode.message
|
|
72
|
+
} : result;
|
|
73
|
+
process.stdout.write(`${JSON.stringify(output)}\n`);
|
|
74
|
+
if (result.status === 'refused')
|
|
75
|
+
process.exitCode = 1;
|
|
76
|
+
else if (result.status === 'failed')
|
|
77
|
+
process.exitCode = 2;
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
const resolved = resolveTaskRef(args[0]);
|
|
81
|
+
const repositoryRoot = resolved.ok ? resolved.repoRoot : process.cwd();
|
|
82
|
+
if (!artifact) {
|
|
83
|
+
failUsage("option '--artifact' is required");
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
if (family !== 'analysis' && family !== 'plan' && family !== 'code') {
|
|
87
|
+
failUsage("finalize-local only supports 'analysis', 'plan', and 'code'");
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
const skillName = family === 'analysis' ? 'analyze-task' : family === 'plan' ? 'plan-task' : 'code-task';
|
|
91
|
+
let config = {};
|
|
92
|
+
try {
|
|
93
|
+
const loaded = loadVerificationConfig(repositoryRoot, skillName);
|
|
94
|
+
const artifactConfig = loaded.checks.artifact;
|
|
95
|
+
if (artifactConfig && typeof artifactConfig === 'object' && !Array.isArray(artifactConfig)) {
|
|
96
|
+
const sections = artifactConfig.required_sections;
|
|
97
|
+
const patterns = artifactConfig.required_patterns;
|
|
98
|
+
config = {
|
|
99
|
+
requiredSections: Array.isArray(sections) ? sections.filter((value) => typeof value === 'string') : undefined,
|
|
100
|
+
requiredPatterns: Array.isArray(patterns) ? patterns.filter((value) => typeof value === 'string') : undefined
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
catch {
|
|
105
|
+
// Isolated fixture repositories may not contain the project's verification config.
|
|
106
|
+
}
|
|
107
|
+
const result = finalizeLocalArtifact({
|
|
108
|
+
taskRef: args[0],
|
|
109
|
+
family: family,
|
|
110
|
+
artifact,
|
|
111
|
+
repoRoot: repositoryRoot,
|
|
112
|
+
...config
|
|
113
|
+
});
|
|
114
|
+
process.stdout.write(`${JSON.stringify(result)}\n`);
|
|
115
|
+
if (result.status === 'failed')
|
|
62
116
|
process.exitCode = 1;
|
|
63
|
-
else if (result.status === 'failed')
|
|
64
|
-
process.exitCode = 2;
|
|
65
117
|
}
|
|
66
118
|
export { taskArtifact };
|
|
67
119
|
//# sourceMappingURL=task-artifact.js.map
|