@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
package/README.md
CHANGED
|
@@ -55,10 +55,10 @@ Once initialized, open the project in your AI TUI and install the latest skills:
|
|
|
55
55
|
|
|
56
56
|
```bash
|
|
57
57
|
/import-issue 42 # AI reads the issue, creates a task, extracts requirements
|
|
58
|
-
/analyze-task <task-id> # AI scans the codebase, finds the root cause, writes analysis.md
|
|
59
|
-
/review-analysis <task-id> # An isolated reviewer checks the analysis
|
|
60
|
-
/plan-task <task-id> # AI proposes a fix plan
|
|
61
|
-
/review-plan <task-id> # A fresh isolated reviewer checks the plan
|
|
58
|
+
/analyze-task --task <task-id> # AI scans the codebase, finds the root cause, writes analysis.md
|
|
59
|
+
/review-analysis --task <task-id> # An isolated reviewer checks the analysis
|
|
60
|
+
/plan-task --task <task-id> # AI proposes a fix plan
|
|
61
|
+
/review-plan --task <task-id> # A fresh isolated reviewer checks the plan
|
|
62
62
|
```
|
|
63
63
|
|
|
64
64
|
> **You review the plan and reply in natural language:**
|
|
@@ -71,12 +71,12 @@ Just fix it at the application layer in LoginService.
|
|
|
71
71
|
> AI re-runs `/plan-task` to update the plan accordingly and confirms.
|
|
72
72
|
|
|
73
73
|
```bash
|
|
74
|
-
/code-task <task-id> # AI writes the fix,
|
|
75
|
-
/review-code <task-id> # A fresh isolated reviewer reports one minor finding
|
|
76
|
-
/code-task <task-id> # AI fixes the minor issue
|
|
77
|
-
/
|
|
78
|
-
/create-pr <task-id> #
|
|
79
|
-
/complete-task <task-id> # task archived
|
|
74
|
+
/code-task --task <task-id> # AI writes the fix, tests it, and creates a local checkpoint commit
|
|
75
|
+
/review-code --task <task-id> # A fresh isolated reviewer reports one minor finding
|
|
76
|
+
/code-task --task <task-id> # AI fixes the minor issue, re-validates, and creates a new checkpoint
|
|
77
|
+
/review-code --task <task-id> # The reviewer approves the current checkpoint
|
|
78
|
+
/create-pr --task <task-id> # The reviewed branch is published to its task-bound target; PR links issue #42
|
|
79
|
+
/complete-task --task <task-id> # task archived
|
|
80
80
|
```
|
|
81
81
|
|
|
82
82
|
**11 commands. 1 natural-language correction. From issue to merged PR.** That is the entire SOP — programming can have a standard operating procedure too.
|
|
@@ -189,10 +189,10 @@ The most-used lifecycle commands, in delivery order. The command prefix varies b
|
|
|
189
189
|
| `run-task` | Resume the lifecycle with fresh isolated executors/reviewers when the selected client exposes verified actual model/effort evidence; Codex now has an experimental Hooks + App Server evidence channel, but orchestration remains disabled until that channel is connected to delegation receipts |
|
|
190
190
|
| `analyze-task` → `review-analysis` | Capture scope and risks, then review the analysis |
|
|
191
191
|
| `plan-task` → `review-plan` | Design the approach, then review the plan |
|
|
192
|
-
| `code-task` → `review-code` | Implement and test, then
|
|
193
|
-
| `
|
|
192
|
+
| `code-task` → `review-code` | Implement and test; `code-task` creates a local checkpoint, then a structured review checks that checkpoint |
|
|
193
|
+
| `create-pr` → `complete-task` | Publish the approved checkpoint to the task-bound target branch, then archive after merge and final gates |
|
|
194
194
|
|
|
195
|
-
Start with one atomic role policy, for example: `$run-task 42 --executor-model <id> --executor-reasoning-effort <value> --reviewer-model <id> --reviewer-reasoning-effort <value>`. Both roles may use the same model. With no explicit policy, `run-task` reads the current Agent Client's optional `agentClients[].orchestration`; if neither source is complete, it shows the host model-selection guidance before creating any run. Re-entry uses the persisted run policy. Finish or clear active runs before upgrading agent-infra; unsupported disk state fails closed without rewriting.
|
|
195
|
+
Start with one atomic role policy, for example: `$run-task --task 42 --executor-model <id> --executor-reasoning-effort <value> --reviewer-model <id> --reviewer-reasoning-effort <value>`. Both roles may use the same model. With no explicit policy, `run-task` reads the current Agent Client's optional `agentClients[].orchestration`; if neither source is complete, it shows the host model-selection guidance before creating any run. Re-entry uses the persisted run policy. Finish or clear active runs before upgrading agent-infra; unsupported disk state fails closed without rewriting.
|
|
196
196
|
|
|
197
197
|
See the full catalog — task status, release, security, and project-maintenance skills — in [Built-in AI Skills](./docs/en/skills.md).
|
|
198
198
|
|
package/README.zh-CN.md
CHANGED
|
@@ -54,10 +54,10 @@ agent-infra 的目标就是把这层共享基础设施标准化。它为所有
|
|
|
54
54
|
|
|
55
55
|
```bash
|
|
56
56
|
/import-issue 42 # AI 读取 Issue,创建任务,提取需求
|
|
57
|
-
/analyze-task <task-id> # AI 扫描代码库,定位根因,输出 analysis.md
|
|
58
|
-
/review-analysis <task-id> # 隔离 reviewer 审查分析产物
|
|
59
|
-
/plan-task <task-id> # AI 提出修复方案
|
|
60
|
-
/review-plan <task-id> # fresh 隔离 reviewer 审查方案
|
|
57
|
+
/analyze-task --task <task-id> # AI 扫描代码库,定位根因,输出 analysis.md
|
|
58
|
+
/review-analysis --task <task-id> # 隔离 reviewer 审查分析产物
|
|
59
|
+
/plan-task --task <task-id> # AI 提出修复方案
|
|
60
|
+
/review-plan --task <task-id> # fresh 隔离 reviewer 审查方案
|
|
61
61
|
```
|
|
62
62
|
|
|
63
63
|
> **你审查方案后用自然语言回复:**
|
|
@@ -70,12 +70,12 @@ agent-infra 的目标就是把这层共享基础设施标准化。它为所有
|
|
|
70
70
|
> AI 按你的要求重跑 `/plan-task` 更新方案并确认。
|
|
71
71
|
|
|
72
72
|
```bash
|
|
73
|
-
/code-task <task-id> # AI
|
|
74
|
-
/review-code <task-id> # fresh 隔离 reviewer 报告一个次要问题
|
|
75
|
-
/code-task <task-id> # AI
|
|
76
|
-
/
|
|
77
|
-
/create-pr <task-id> # PR
|
|
78
|
-
/complete-task <task-id> # 任务归档
|
|
73
|
+
/code-task --task <task-id> # AI 编写修复代码、测试,并创建本地 checkpoint commit
|
|
74
|
+
/review-code --task <task-id> # fresh 隔离 reviewer 报告一个次要问题
|
|
75
|
+
/code-task --task <task-id> # AI 修复次要问题、重新验证,并创建新的 checkpoint
|
|
76
|
+
/review-code --task <task-id> # reviewer 审查并通过当前 checkpoint
|
|
77
|
+
/create-pr --task <task-id> # 将已审查分支发布到任务绑定目标分支;PR 自动关联 Issue #42
|
|
78
|
+
/complete-task --task <task-id> # 任务归档
|
|
79
79
|
```
|
|
80
80
|
|
|
81
81
|
**11 条命令,1 次自然语言纠正,从 Issue 到合并 PR。** 这就是完整的 SOP —— 编程也可以有标准作业流程。
|
|
@@ -188,10 +188,10 @@ ai agent-client configure
|
|
|
188
188
|
| `run-task` | 当所选客户端能提供已验证的 actual model/effort 证据时,用 fresh 隔离 executor/reviewer 续跑生命周期;Codex 现已具备实验性的 Hooks + App Server 证据通道,但在该通道接入 delegation receipt 前仍不会启用 orchestration |
|
|
189
189
|
| `analyze-task` → `review-analysis` | 明确范围与风险,再审查分析 |
|
|
190
190
|
| `plan-task` → `review-plan` | 设计实现路径,再审查方案 |
|
|
191
|
-
| `code-task` → `review-code` |
|
|
192
|
-
| `
|
|
191
|
+
| `code-task` → `review-code` | 实现并测试;`code-task` 创建本地 checkpoint,再由结构化审查检视该 checkpoint |
|
|
192
|
+
| `create-pr` → `complete-task` | 将已通过审查的 checkpoint 发布到任务绑定目标分支,并在合并和最终门禁通过后归档 |
|
|
193
193
|
|
|
194
|
-
启动时可提供原子角色策略,例如:`$run-task 42 --executor-model <id> --executor-reasoning-effort <值> --reviewer-model <id> --reviewer-reasoning-effort <值>`。两个角色可以使用同一模型。完全没有显式策略时,`run-task` 读取当前 Agent Client 可选的 `agentClients[].orchestration`;两个来源都不完整时,会在创建任何 run 前展示宿主模型选择指引。重入使用已持久化的 run 策略。升级 agent-infra 前必须完成或清空 active run;不受支持的磁盘状态会失败关闭且不改写。
|
|
194
|
+
启动时可提供原子角色策略,例如:`$run-task --task 42 --executor-model <id> --executor-reasoning-effort <值> --reviewer-model <id> --reviewer-reasoning-effort <值>`。两个角色可以使用同一模型。完全没有显式策略时,`run-task` 读取当前 Agent Client 可选的 `agentClients[].orchestration`;两个来源都不完整时,会在创建任何 run 前展示宿主模型选择指引。重入使用已持久化的 run 策略。升级 agent-infra 前必须完成或清空 active run;不受支持的磁盘状态会失败关闭且不改写。
|
|
195
195
|
|
|
196
196
|
完整清单(任务状态、发布、安全、项目维护等 skill)见 [内置 AI Skills](./docs/zh-CN/skills.md)。
|
|
197
197
|
|
package/dist/bin/internal-cli.js
CHANGED
|
@@ -45,12 +45,12 @@ if (taskControlCommand) {
|
|
|
45
45
|
}
|
|
46
46
|
case 'task-lifecycle': {
|
|
47
47
|
const { taskLifecycle } = await import('../lib/internal/task-lifecycle.js');
|
|
48
|
-
taskLifecycle(process.argv.slice(3));
|
|
48
|
+
await taskLifecycle(process.argv.slice(3));
|
|
49
49
|
break;
|
|
50
50
|
}
|
|
51
51
|
case 'task-finalization': {
|
|
52
52
|
const { taskFinalization } = await import('../lib/internal/task-finalization.js');
|
|
53
|
-
taskFinalization(process.argv.slice(3));
|
|
53
|
+
await taskFinalization(process.argv.slice(3));
|
|
54
54
|
break;
|
|
55
55
|
}
|
|
56
56
|
}
|
|
@@ -60,7 +60,7 @@ else
|
|
|
60
60
|
switch (command) {
|
|
61
61
|
case 'task-create': {
|
|
62
62
|
const { taskCreate } = await import('../lib/internal/task-create.js');
|
|
63
|
-
taskCreate(process.argv.slice(3));
|
|
63
|
+
await taskCreate(process.argv.slice(3));
|
|
64
64
|
break;
|
|
65
65
|
}
|
|
66
66
|
case 'sandbox-control': {
|
|
@@ -88,6 +88,11 @@ else
|
|
|
88
88
|
gitWorkflow(process.argv.slice(3));
|
|
89
89
|
break;
|
|
90
90
|
}
|
|
91
|
+
case 'task-delivery': {
|
|
92
|
+
const { taskDelivery } = await import('../lib/internal/task-delivery.js');
|
|
93
|
+
taskDelivery(process.argv.slice(3));
|
|
94
|
+
break;
|
|
95
|
+
}
|
|
91
96
|
case 'release-workflow': {
|
|
92
97
|
const { releaseWorkflow } = await import('../lib/internal/release-workflow.js');
|
|
93
98
|
await releaseWorkflow(process.argv.slice(3));
|
|
@@ -95,37 +100,37 @@ else
|
|
|
95
100
|
}
|
|
96
101
|
case 'platform-release-notes': {
|
|
97
102
|
const { platformReleaseNotes } = await import('../lib/internal/platform-release-notes.js');
|
|
98
|
-
platformReleaseNotes(process.argv.slice(3));
|
|
103
|
+
await platformReleaseNotes(process.argv.slice(3));
|
|
99
104
|
break;
|
|
100
105
|
}
|
|
101
106
|
case 'platform-context': {
|
|
102
107
|
const { platformContext } = await import('../lib/internal/platform-context.js');
|
|
103
|
-
platformContext(process.argv.slice(3));
|
|
108
|
+
await platformContext(process.argv.slice(3));
|
|
104
109
|
break;
|
|
105
110
|
}
|
|
106
111
|
case 'platform-comment': {
|
|
107
112
|
const { platformComment } = await import('../lib/internal/platform-comment.js');
|
|
108
|
-
platformComment(process.argv.slice(3));
|
|
113
|
+
await platformComment(process.argv.slice(3));
|
|
109
114
|
break;
|
|
110
115
|
}
|
|
111
116
|
case 'platform-issue': {
|
|
112
117
|
const { platformIssue } = await import('../lib/internal/platform-issue.js');
|
|
113
|
-
platformIssue(process.argv.slice(3));
|
|
118
|
+
await platformIssue(process.argv.slice(3));
|
|
114
119
|
break;
|
|
115
120
|
}
|
|
116
121
|
case 'platform-pr': {
|
|
117
122
|
const { platformPr } = await import('../lib/internal/platform-pr.js');
|
|
118
|
-
platformPr(process.argv.slice(3));
|
|
123
|
+
await platformPr(process.argv.slice(3));
|
|
119
124
|
break;
|
|
120
125
|
}
|
|
121
126
|
case 'platform-pr-review': {
|
|
122
127
|
const { platformPrReview } = await import('../lib/internal/platform-pr-review.js');
|
|
123
|
-
platformPrReview(process.argv.slice(3));
|
|
128
|
+
await platformPrReview(process.argv.slice(3));
|
|
124
129
|
break;
|
|
125
130
|
}
|
|
126
131
|
case 'pr-review-grade': {
|
|
127
132
|
const { prReviewGrade } = await import('../lib/internal/pr-review-grade.js');
|
|
128
|
-
prReviewGrade(process.argv.slice(3));
|
|
133
|
+
await prReviewGrade(process.argv.slice(3));
|
|
129
134
|
break;
|
|
130
135
|
}
|
|
131
136
|
case 'platform-checks': {
|
|
@@ -140,17 +145,17 @@ else
|
|
|
140
145
|
}
|
|
141
146
|
case 'task-ledger': {
|
|
142
147
|
const { taskLedger } = await import('../lib/internal/task-ledger.js');
|
|
143
|
-
taskLedger(process.argv.slice(3));
|
|
148
|
+
await taskLedger(process.argv.slice(3));
|
|
144
149
|
break;
|
|
145
150
|
}
|
|
146
151
|
case 'task-warning': {
|
|
147
152
|
const { taskWarning } = await import('../lib/internal/task-warning.js');
|
|
148
|
-
taskWarning(process.argv.slice(3));
|
|
153
|
+
await taskWarning(process.argv.slice(3));
|
|
149
154
|
break;
|
|
150
155
|
}
|
|
151
156
|
case 'task-activity': {
|
|
152
157
|
const { taskActivity } = await import('../lib/internal/task-activity.js');
|
|
153
|
-
taskActivity(process.argv.slice(3));
|
|
158
|
+
await taskActivity(process.argv.slice(3));
|
|
154
159
|
break;
|
|
155
160
|
}
|
|
156
161
|
case 'task-artifact': {
|
|
@@ -165,27 +170,32 @@ else
|
|
|
165
170
|
}
|
|
166
171
|
case 'task-review': {
|
|
167
172
|
const { taskReview } = await import('../lib/internal/task-review.js');
|
|
168
|
-
taskReview(process.argv.slice(3));
|
|
173
|
+
await taskReview(process.argv.slice(3));
|
|
169
174
|
break;
|
|
170
175
|
}
|
|
171
176
|
case 'task-event': {
|
|
172
177
|
const { taskEvent } = await import('../lib/internal/task-event.js');
|
|
173
|
-
taskEvent(process.argv.slice(3));
|
|
178
|
+
await taskEvent(process.argv.slice(3));
|
|
179
|
+
break;
|
|
180
|
+
}
|
|
181
|
+
case 'task-invalidation': {
|
|
182
|
+
const { taskInvalidation } = await import('../lib/internal/task-invalidation.js');
|
|
183
|
+
taskInvalidation(process.argv.slice(3));
|
|
174
184
|
break;
|
|
175
185
|
}
|
|
176
186
|
case 'task-lifecycle': {
|
|
177
187
|
const { taskLifecycle } = await import('../lib/internal/task-lifecycle.js');
|
|
178
|
-
taskLifecycle(process.argv.slice(3));
|
|
188
|
+
await taskLifecycle(process.argv.slice(3));
|
|
179
189
|
break;
|
|
180
190
|
}
|
|
181
191
|
case 'task-finalization': {
|
|
182
192
|
const { taskFinalization } = await import('../lib/internal/task-finalization.js');
|
|
183
|
-
taskFinalization(process.argv.slice(3));
|
|
193
|
+
await taskFinalization(process.argv.slice(3));
|
|
184
194
|
break;
|
|
185
195
|
}
|
|
186
196
|
case 'task-override': {
|
|
187
197
|
const { taskOverride } = await import('../lib/internal/task-override.js');
|
|
188
|
-
taskOverride(process.argv.slice(3));
|
|
198
|
+
await taskOverride(process.argv.slice(3));
|
|
189
199
|
break;
|
|
190
200
|
}
|
|
191
201
|
case 'task-short-id': {
|
|
@@ -200,7 +210,7 @@ else
|
|
|
200
210
|
}
|
|
201
211
|
case 'task-verify': {
|
|
202
212
|
const { taskVerify } = await import('../lib/internal/task-verify.js');
|
|
203
|
-
taskVerify(process.argv.slice(3));
|
|
213
|
+
await taskVerify(process.argv.slice(3));
|
|
204
214
|
break;
|
|
205
215
|
}
|
|
206
216
|
case 'task-validate': {
|
|
@@ -16,20 +16,63 @@ function isLifecycleProtocolVersion(value) {
|
|
|
16
16
|
function normalizeRelativePath(value) {
|
|
17
17
|
return value.replaceAll('\\', '/');
|
|
18
18
|
}
|
|
19
|
+
function isSafeLifecyclePath(value) {
|
|
20
|
+
return exactText(value)
|
|
21
|
+
&& value === normalizeRelativePath(value)
|
|
22
|
+
&& !path.isAbsolute(value)
|
|
23
|
+
&& !/^[A-Za-z]:[\\/]/u.test(value)
|
|
24
|
+
&& !value.split('/').includes('..');
|
|
25
|
+
}
|
|
26
|
+
function isLifecycleLauncherLine(value) {
|
|
27
|
+
return typeof value === 'string'
|
|
28
|
+
&& value.length > 1
|
|
29
|
+
&& value.slice(0, -1).trim() === value.slice(0, -1)
|
|
30
|
+
&& value.startsWith('#!')
|
|
31
|
+
&& value.endsWith('\n')
|
|
32
|
+
&& value.indexOf('\n') === value.length - 1
|
|
33
|
+
&& !value.includes('\r');
|
|
34
|
+
}
|
|
35
|
+
function readLifecycleLauncherShebang(value, executableFiles) {
|
|
36
|
+
if (!value || typeof value !== 'object' || Array.isArray(value)) {
|
|
37
|
+
throw new Error('Lifecycle manifest launcher shebang policy is invalid');
|
|
38
|
+
}
|
|
39
|
+
const policy = value;
|
|
40
|
+
if (!isSafeLifecyclePath(policy.sourceFile)
|
|
41
|
+
|| !isSafeLifecyclePath(policy.compiledFile)
|
|
42
|
+
|| !isLifecycleLauncherLine(policy.canonicalLine)
|
|
43
|
+
|| !Array.isArray(policy.acceptedLines)
|
|
44
|
+
|| !policy.acceptedLines.every(isLifecycleLauncherLine)
|
|
45
|
+
|| new Set(policy.acceptedLines).size !== policy.acceptedLines.length
|
|
46
|
+
|| !policy.acceptedLines.includes(policy.canonicalLine)
|
|
47
|
+
|| !executableFiles.includes(policy.sourceFile)
|
|
48
|
+
|| policy.compiledFile !== normalizeRelativePath(path.join('dist', policy.sourceFile.endsWith('.ts')
|
|
49
|
+
? policy.sourceFile.replace(/\.ts$/u, '.js')
|
|
50
|
+
: policy.sourceFile))) {
|
|
51
|
+
throw new Error('Lifecycle manifest launcher shebang policy is invalid');
|
|
52
|
+
}
|
|
53
|
+
return Object.freeze({
|
|
54
|
+
sourceFile: policy.sourceFile,
|
|
55
|
+
compiledFile: policy.compiledFile,
|
|
56
|
+
canonicalLine: policy.canonicalLine,
|
|
57
|
+
acceptedLines: Object.freeze([...policy.acceptedLines])
|
|
58
|
+
});
|
|
59
|
+
}
|
|
19
60
|
function readLifecycleManifestFiles(packageRoot) {
|
|
20
61
|
const file = path.join(packageRoot, 'lib', 'agent-clients', 'adapters', 'codex-lifecycle', 'manifest-files.json');
|
|
21
62
|
const value = JSON.parse(fs.readFileSync(file, 'utf8'));
|
|
22
63
|
if (!Array.isArray(value.executableFiles)
|
|
23
64
|
|| !Array.isArray(value.contractFiles)
|
|
24
|
-
|| !value.executableFiles.every(
|
|
25
|
-
|| !value.contractFiles.every(
|
|
65
|
+
|| !value.executableFiles.every(isSafeLifecyclePath)
|
|
66
|
+
|| !value.contractFiles.every(isSafeLifecyclePath)
|
|
26
67
|
|| new Set(value.executableFiles).size !== value.executableFiles.length
|
|
27
68
|
|| new Set(value.contractFiles).size !== value.contractFiles.length) {
|
|
28
69
|
throw new Error('Lifecycle manifest file list is invalid');
|
|
29
70
|
}
|
|
71
|
+
const executableFiles = Object.freeze([...value.executableFiles]);
|
|
30
72
|
return Object.freeze({
|
|
31
|
-
executableFiles
|
|
32
|
-
contractFiles: Object.freeze([...value.contractFiles])
|
|
73
|
+
executableFiles,
|
|
74
|
+
contractFiles: Object.freeze([...value.contractFiles]),
|
|
75
|
+
launcherShebang: readLifecycleLauncherShebang(value.launcherShebang, executableFiles)
|
|
33
76
|
});
|
|
34
77
|
}
|
|
35
78
|
function executablePackageRoot() {
|
|
@@ -47,7 +90,22 @@ function executablePackageRoot() {
|
|
|
47
90
|
current = parent;
|
|
48
91
|
}
|
|
49
92
|
}
|
|
50
|
-
function
|
|
93
|
+
function normalizeLifecycleLauncherBytes(relative, content, policy) {
|
|
94
|
+
const normalized = normalizeRelativePath(relative);
|
|
95
|
+
if (normalized !== policy.sourceFile && normalized !== policy.compiledFile)
|
|
96
|
+
return content;
|
|
97
|
+
const lineEnd = content.indexOf(0x0a);
|
|
98
|
+
if (lineEnd < 0)
|
|
99
|
+
return content;
|
|
100
|
+
const firstLine = content.subarray(0, lineEnd + 1);
|
|
101
|
+
if (!policy.acceptedLines.some((line) => Buffer.from(line).equals(firstLine)))
|
|
102
|
+
return content;
|
|
103
|
+
return Buffer.concat([
|
|
104
|
+
Buffer.from(policy.canonicalLine),
|
|
105
|
+
content.subarray(lineEnd + 1)
|
|
106
|
+
]);
|
|
107
|
+
}
|
|
108
|
+
function hashFiles(root, files, launcherShebang) {
|
|
51
109
|
const hash = crypto.createHash('sha256');
|
|
52
110
|
for (const relative of [...new Set(files.map(normalizeRelativePath))].sort()) {
|
|
53
111
|
if (path.isAbsolute(relative) || relative.split(/[\\/]/u).includes('..')) {
|
|
@@ -60,7 +118,10 @@ function hashFiles(root, files) {
|
|
|
60
118
|
}
|
|
61
119
|
hash.update(relative);
|
|
62
120
|
hash.update('\0');
|
|
63
|
-
|
|
121
|
+
const content = fs.readFileSync(file);
|
|
122
|
+
hash.update(launcherShebang
|
|
123
|
+
? normalizeLifecycleLauncherBytes(relative, content, launcherShebang)
|
|
124
|
+
: content);
|
|
64
125
|
hash.update('\0');
|
|
65
126
|
}
|
|
66
127
|
return hash.digest('hex');
|
|
@@ -107,7 +168,7 @@ function computeLifecycleBuildIdentity(repoRoot, options = {}) {
|
|
|
107
168
|
throw new Error('Lifecycle package version is invalid');
|
|
108
169
|
let internalExecutableBuildHash;
|
|
109
170
|
if (options.executableFiles) {
|
|
110
|
-
internalExecutableBuildHash = hashFiles(repoRoot, options.executableFiles);
|
|
171
|
+
internalExecutableBuildHash = hashFiles(repoRoot, options.executableFiles, defaults.launcherShebang);
|
|
111
172
|
}
|
|
112
173
|
else {
|
|
113
174
|
const manifestFile = path.join(executableRoot, 'dist', 'lifecycle-build-manifest.json');
|
|
@@ -121,17 +182,17 @@ function computeLifecycleBuildIdentity(repoRoot, options = {}) {
|
|
|
121
182
|
}
|
|
122
183
|
if (fileURLToPath(import.meta.url).split(path.sep).includes('dist')) {
|
|
123
184
|
const compiledFiles = defaults.executableFiles.map((file) => file.endsWith('.ts') ? path.join('dist', file.replace(/\.ts$/u, '.js')) : file);
|
|
124
|
-
if (hashFiles(executableRoot, resolveLifecycleExecutableFiles(executableRoot, compiledFiles)) !== manifest.internalExecutableBuildHash) {
|
|
185
|
+
if (hashFiles(executableRoot, resolveLifecycleExecutableFiles(executableRoot, compiledFiles), defaults.launcherShebang) !== manifest.internalExecutableBuildHash) {
|
|
125
186
|
throw new Error('Lifecycle compiled executable build does not match its manifest');
|
|
126
187
|
}
|
|
127
188
|
}
|
|
128
|
-
else if (hashFiles(executableRoot, resolveLifecycleExecutableFiles(executableRoot, defaults.executableFiles)) !== manifest.sourceInputHash) {
|
|
189
|
+
else if (hashFiles(executableRoot, resolveLifecycleExecutableFiles(executableRoot, defaults.executableFiles), defaults.launcherShebang) !== manifest.sourceInputHash) {
|
|
129
190
|
throw new Error('Lifecycle executable build manifest is stale or invalid');
|
|
130
191
|
}
|
|
131
192
|
internalExecutableBuildHash = manifest.internalExecutableBuildHash;
|
|
132
193
|
}
|
|
133
194
|
else
|
|
134
|
-
internalExecutableBuildHash = hashFiles(executableRoot, resolveLifecycleExecutableFiles(executableRoot, defaults.executableFiles));
|
|
195
|
+
internalExecutableBuildHash = hashFiles(executableRoot, resolveLifecycleExecutableFiles(executableRoot, defaults.executableFiles), defaults.launcherShebang);
|
|
135
196
|
}
|
|
136
197
|
return Object.freeze({
|
|
137
198
|
protocolVersion: LIFECYCLE_PROTOCOL_VERSION,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { listEnabledAgentClientAdapters } from './registry.js';
|
|
2
2
|
import { renderAgentClientInvocation } from './invocation.js';
|
|
3
3
|
import semver from 'semver';
|
|
4
|
+
import { isTaskScopeSkill } from '../task/skill-scope.js';
|
|
4
5
|
const SAFE_NAME = /^[a-zA-Z0-9][a-zA-Z0-9._-]*$/;
|
|
5
6
|
const SAFE_TASK_REF = /^(?:\d+|TASK-\d{8}-\d{6})$/;
|
|
6
7
|
function requireSafeName(value, field) {
|
|
@@ -19,7 +20,11 @@ function renderNextStepCommands(input) {
|
|
|
19
20
|
throw new Error('Invalid version');
|
|
20
21
|
}
|
|
21
22
|
const args = [
|
|
22
|
-
...(input.taskRef === undefined
|
|
23
|
+
...(input.taskRef === undefined
|
|
24
|
+
? []
|
|
25
|
+
: isTaskScopeSkill(input.skillName)
|
|
26
|
+
? ['--task', input.taskRef]
|
|
27
|
+
: [input.taskRef]),
|
|
23
28
|
...(input.version === undefined ? [] : [input.version])
|
|
24
29
|
];
|
|
25
30
|
const builtins = listEnabledAgentClientAdapters(input.state).map((adapter) => Object.freeze({
|
package/dist/lib/decide.js
CHANGED
|
@@ -94,13 +94,13 @@ export async function decide(args, options = {}) {
|
|
|
94
94
|
metadataProvider: () => ({ timestamp: now, agentInfraVersion: options.version ?? VERSION })
|
|
95
95
|
};
|
|
96
96
|
let result;
|
|
97
|
-
const execute = () => {
|
|
97
|
+
const execute = async () => {
|
|
98
98
|
let current = applyHumanDecision(request, writeOptions);
|
|
99
99
|
if (current.status !== 'failed' || !parsedDecision.overrideTicket)
|
|
100
100
|
return current;
|
|
101
101
|
if (!parsedDecision.overrideTarget || !parsedDecision.overrideScope)
|
|
102
102
|
throw new Error('override ticket requires --override-target and --override-scope');
|
|
103
|
-
const consumed = consumeHumanOverride({
|
|
103
|
+
const consumed = await consumeHumanOverride({
|
|
104
104
|
taskRef: resolved.taskId,
|
|
105
105
|
ticketId: parsedDecision.overrideTicket,
|
|
106
106
|
failureId: failureId('decision-intent', current.error?.code ?? 'TASK_STATE_MISMATCH'),
|
|
@@ -120,7 +120,7 @@ export async function decide(args, options = {}) {
|
|
|
120
120
|
throw new Error(consumed.error.message);
|
|
121
121
|
return current;
|
|
122
122
|
};
|
|
123
|
-
result = withTaskExecutionLock(resolved.repoRoot, resolved.taskId, 'task-decision', execute);
|
|
123
|
+
result = await withTaskExecutionLock(resolved.repoRoot, resolved.taskId, 'task-decision', execute);
|
|
124
124
|
if (result.error)
|
|
125
125
|
throw new Error(result.error.message);
|
|
126
126
|
return 0;
|
package/dist/lib/defaults.json
CHANGED
package/dist/lib/git/workflow.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { spawnSync } from 'node:child_process';
|
|
2
2
|
import fs from 'node:fs';
|
|
3
|
+
import os from 'node:os';
|
|
3
4
|
import path from 'node:path';
|
|
4
5
|
const defaultRunner = (args, cwd) => {
|
|
5
6
|
const result = spawnSync('git', [...args], { cwd, encoding: 'utf8' });
|
|
@@ -108,6 +109,47 @@ function commitExplicitPaths(input, runner = defaultRunner) {
|
|
|
108
109
|
return { status: 'failed', changed: false, snapshot: after.snapshot, operations: [{ name: 'commit', status: 'failed', message: commit.stderr.trim() }], error: { code: 'GIT_COMMIT_FAILED', message: commit.stderr.trim() } };
|
|
109
110
|
return { status: 'applied', changed: true, snapshot: after.snapshot, operations: [{ name: 'stage', status: 'applied' }, { name: 'commit', status: 'applied' }], error: null };
|
|
110
111
|
}
|
|
112
|
+
function previewCommitTree(input) {
|
|
113
|
+
const invalid = validatePaths(input.paths);
|
|
114
|
+
if (invalid)
|
|
115
|
+
return { status: 'failed', tree: null, error: { code: 'GIT_COMMIT_INPUT_INVALID', message: invalid } };
|
|
116
|
+
const before = inspectGitWorkflow(input.cwd);
|
|
117
|
+
if (!before.snapshot)
|
|
118
|
+
return { status: 'failed', tree: null, error: { code: 'GIT_INSPECT_FAILED', message: 'Unable to inspect Git repository' } };
|
|
119
|
+
if (before.snapshot.head !== input.expectedHead) {
|
|
120
|
+
return { status: 'failed', tree: null, error: { code: 'GIT_HEAD_MISMATCH', message: `Expected HEAD ${input.expectedHead}, received ${before.snapshot.head}` } };
|
|
121
|
+
}
|
|
122
|
+
const selected = new Set(input.paths);
|
|
123
|
+
const unrelatedStaged = before.snapshot.staged.filter((candidate) => !selected.has(candidate));
|
|
124
|
+
if (unrelatedStaged.length > 0) {
|
|
125
|
+
return { status: 'failed', tree: null, error: { code: 'GIT_STAGED_SCOPE_MISMATCH', message: `Unrelated staged paths: ${unrelatedStaged.join(', ')}` } };
|
|
126
|
+
}
|
|
127
|
+
const temporaryDirectory = fs.mkdtempSync(path.join(os.tmpdir(), 'agent-infra-preview-index-'));
|
|
128
|
+
const indexFile = path.join(temporaryDirectory, 'index');
|
|
129
|
+
const temporaryRunner = (args, cwd) => {
|
|
130
|
+
const result = spawnSync('git', [...args], {
|
|
131
|
+
cwd,
|
|
132
|
+
env: { ...process.env, GIT_INDEX_FILE: indexFile },
|
|
133
|
+
encoding: 'utf8'
|
|
134
|
+
});
|
|
135
|
+
return { status: result.status, stdout: result.stdout ?? '', stderr: result.stderr ?? '' };
|
|
136
|
+
};
|
|
137
|
+
try {
|
|
138
|
+
const read = run(temporaryRunner, input.cwd, ['read-tree', input.expectedHead]);
|
|
139
|
+
if (read.status !== 0)
|
|
140
|
+
return { status: 'failed', tree: null, error: { code: 'GIT_PREVIEW_FAILED', message: read.stderr.trim() || 'Unable to prepare a temporary Git index' } };
|
|
141
|
+
const stage = run(temporaryRunner, input.cwd, ['add', '-A', '--', ...input.paths]);
|
|
142
|
+
if (stage.status !== 0)
|
|
143
|
+
return { status: 'failed', tree: null, error: { code: 'GIT_PREVIEW_FAILED', message: stage.stderr.trim() || 'Unable to stage the requested paths in a temporary index' } };
|
|
144
|
+
const tree = value(temporaryRunner, input.cwd, ['write-tree']);
|
|
145
|
+
if (!tree)
|
|
146
|
+
return { status: 'failed', tree: null, error: { code: 'GIT_PREVIEW_FAILED', message: 'Unable to write the temporary Git tree' } };
|
|
147
|
+
return { status: 'planned', tree, error: null };
|
|
148
|
+
}
|
|
149
|
+
finally {
|
|
150
|
+
fs.rmSync(temporaryDirectory, { recursive: true, force: true });
|
|
151
|
+
}
|
|
152
|
+
}
|
|
111
153
|
function pushGitRefs(input, runner = defaultRunner) {
|
|
112
154
|
if (!input.remote || input.refs.length === 0)
|
|
113
155
|
return { status: 'failed', changed: false, snapshot: inspectGitWorkflow(input.cwd, runner).snapshot, operations: [], error: { code: 'GIT_PUSH_INPUT_INVALID', message: 'Remote and refs are required' } };
|
|
@@ -185,5 +227,5 @@ function pushRebasedBranch(input, runner = defaultRunner) {
|
|
|
185
227
|
}
|
|
186
228
|
return { status: 'applied', changed: true, snapshot: inspectGitWorkflow(input.cwd, runner).snapshot, operations: [{ name: 'push-rebased', status: 'applied', ref: input.branch }], error: null };
|
|
187
229
|
}
|
|
188
|
-
export { commitExplicitPaths, inspectGitWorkflow, pushGitRefs, pushRebasedBranch };
|
|
230
|
+
export { commitExplicitPaths, inspectGitWorkflow, previewCommitTree, pushGitRefs, pushRebasedBranch };
|
|
189
231
|
//# sourceMappingURL=workflow.js.map
|
package/dist/lib/init.js
CHANGED
|
@@ -175,6 +175,7 @@ async function cmdInit() {
|
|
|
175
175
|
templateVersion: VERSION,
|
|
176
176
|
sandbox: structuredClone(defaults.sandbox),
|
|
177
177
|
task: structuredClone(defaults.task),
|
|
178
|
+
delivery: structuredClone(defaults.delivery),
|
|
178
179
|
labels: structuredClone(defaults.labels),
|
|
179
180
|
files: { managed: [], merged: [], ejected: [] },
|
|
180
181
|
agentClients: serializeAgentClients(defaultState)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import fs from 'node:fs';
|
|
2
|
-
import { inspectGitWorkflow, pushRebasedBranch } from '../git/workflow.js';
|
|
2
|
+
import { inspectGitWorkflow, previewCommitTree, pushRebasedBranch } from '../git/workflow.js';
|
|
3
3
|
import { compareReviewTrees, snapshotReview } from '../git/review-snapshot.js';
|
|
4
4
|
import { resolvePostReviewGlobs } from '../task/review-fingerprint.js';
|
|
5
5
|
import { executeCommitOperation } from '../task/commit-operation.js';
|
|
@@ -26,6 +26,13 @@ function gitWorkflow(args = []) {
|
|
|
26
26
|
const input = inputIndex >= 0 && rest[inputIndex + 1] ? JSON.parse(fs.readFileSync(rest[inputIndex + 1], 'utf8')) : null;
|
|
27
27
|
result = input ? pushRebasedBranch({ cwd: cwd ?? process.cwd(), ...input }) : { status: 'failed', changed: false, error: { code: 'GIT_INPUT_REQUIRED', message: '--input JSON file is required' } };
|
|
28
28
|
}
|
|
29
|
+
else if (action === 'preview-tree') {
|
|
30
|
+
const inputIndex = rest.indexOf('--input');
|
|
31
|
+
const input = inputIndex >= 0 && rest[inputIndex + 1] ? JSON.parse(fs.readFileSync(rest[inputIndex + 1], 'utf8')) : null;
|
|
32
|
+
result = input
|
|
33
|
+
? previewCommitTree({ cwd: cwd ?? process.cwd(), paths: input.paths, expectedHead: input.expectedHead })
|
|
34
|
+
: { status: 'failed', changed: false, error: { code: 'GIT_INPUT_REQUIRED', message: '--input JSON file is required' } };
|
|
35
|
+
}
|
|
29
36
|
else if (action === 'snapshot' || action === 'compare-trees') {
|
|
30
37
|
const inputIndex = rest.indexOf('--input');
|
|
31
38
|
const input = inputIndex >= 0 && rest[inputIndex + 1] ? JSON.parse(fs.readFileSync(rest[inputIndex + 1], 'utf8')) : null;
|
|
@@ -76,7 +76,7 @@ async function platformChecks(args = []) {
|
|
|
76
76
|
return;
|
|
77
77
|
}
|
|
78
78
|
if (operation === 'inspect') {
|
|
79
|
-
finish(inspectPullRequestReadiness(taskRef, { cwd }));
|
|
79
|
+
finish(await inspectPullRequestReadiness(taskRef, { cwd }));
|
|
80
80
|
return;
|
|
81
81
|
}
|
|
82
82
|
if (operation === 'resolve-run') {
|
|
@@ -84,7 +84,7 @@ async function platformChecks(args = []) {
|
|
|
84
84
|
fail('resolve-run requires --check-name');
|
|
85
85
|
return;
|
|
86
86
|
}
|
|
87
|
-
finish(resolvePlatformCheckRun(taskRef, { cwd, checkName: values.checkName, detailsUrl: values.detailsUrl }));
|
|
87
|
+
finish(await resolvePlatformCheckRun(taskRef, { cwd, checkName: values.checkName, detailsUrl: values.detailsUrl }));
|
|
88
88
|
return;
|
|
89
89
|
}
|
|
90
90
|
if (operation === 'logs') {
|
|
@@ -94,7 +94,7 @@ async function platformChecks(args = []) {
|
|
|
94
94
|
fail('logs requires a positive --run and optional positive --job');
|
|
95
95
|
return;
|
|
96
96
|
}
|
|
97
|
-
finish(fetchPlatformCheckLogs(taskRef, { cwd, run, job: job || undefined }));
|
|
97
|
+
finish(await fetchPlatformCheckLogs(taskRef, { cwd, run, job: job || undefined }));
|
|
98
98
|
return;
|
|
99
99
|
}
|
|
100
100
|
const intervalSeconds = positive(values.intervalSeconds);
|
|
@@ -3,7 +3,7 @@ import path from 'node:path';
|
|
|
3
3
|
import { normalizeAgentToken, AGENT_USAGE_HINT } from '../agent-clients/tokens.js';
|
|
4
4
|
import { checkPlatformCommentOwner, listPlatformComments, syncPlatformComment } from '../platform/issue-comments.js';
|
|
5
5
|
import { backfillCompletionComments } from '../platform/completion-backfill.js';
|
|
6
|
-
const USAGE = `Usage: agent-infra-internal platform-comment list --issue <
|
|
6
|
+
const USAGE = `Usage: agent-infra-internal platform-comment list --issue <token> [--cwd <path>]
|
|
7
7
|
agent-infra-internal platform-comment owner <task-ref> [--cwd <path>]
|
|
8
8
|
agent-infra-internal platform-comment backfill <task-ref> --agent <agent> [--cwd <path>]
|
|
9
9
|
agent-infra-internal platform-comment sync <task-ref> --kind <kind> --agent <agent> [--artifact <file>] [--body-file <path|->] [--status-label <label>] [--backfill] [--cwd <path>]
|
|
@@ -47,7 +47,7 @@ function readBodyFile(value, cwd) {
|
|
|
47
47
|
return fs.readFileSync(0, 'utf8');
|
|
48
48
|
return fs.readFileSync(path.resolve(cwd, value), 'utf8');
|
|
49
49
|
}
|
|
50
|
-
function platformComment(args = []) {
|
|
50
|
+
async function platformComment(args = []) {
|
|
51
51
|
if (args[0] === '--help' || args[0] === '-h') {
|
|
52
52
|
process.stdout.write(USAGE);
|
|
53
53
|
return;
|
|
@@ -70,9 +70,9 @@ function platformComment(args = []) {
|
|
|
70
70
|
}
|
|
71
71
|
const cwd = path.resolve(typeof parsed.values.cwd === 'string' ? parsed.values.cwd : process.cwd());
|
|
72
72
|
if (operation === 'list') {
|
|
73
|
-
const issue =
|
|
74
|
-
if (
|
|
75
|
-
fail('list requires
|
|
73
|
+
const issue = parsed.values.issue;
|
|
74
|
+
if (typeof issue !== 'string' || !issue) {
|
|
75
|
+
fail('list requires --issue <token>');
|
|
76
76
|
return;
|
|
77
77
|
}
|
|
78
78
|
const unexpected = Object.keys(parsed.values).find((key) => !['issue', 'cwd'].includes(key));
|
|
@@ -80,7 +80,7 @@ function platformComment(args = []) {
|
|
|
80
80
|
fail(`list does not accept '--${unexpected}'`);
|
|
81
81
|
return;
|
|
82
82
|
}
|
|
83
|
-
finish(listPlatformComments(issue, cwd));
|
|
83
|
+
finish(await listPlatformComments(issue, cwd));
|
|
84
84
|
return;
|
|
85
85
|
}
|
|
86
86
|
if (operation === 'owner') {
|
|
@@ -89,7 +89,7 @@ function platformComment(args = []) {
|
|
|
89
89
|
fail(`owner does not accept '--${unexpected}'`);
|
|
90
90
|
return;
|
|
91
91
|
}
|
|
92
|
-
finish(checkPlatformCommentOwner(taskRef, { cwd }));
|
|
92
|
+
finish(await checkPlatformCommentOwner(taskRef, { cwd }));
|
|
93
93
|
return;
|
|
94
94
|
}
|
|
95
95
|
if (operation === 'backfill') {
|
|
@@ -108,7 +108,7 @@ function platformComment(args = []) {
|
|
|
108
108
|
fail(`invalid --agent '${agent}': ${AGENT_USAGE_HINT}`);
|
|
109
109
|
return;
|
|
110
110
|
}
|
|
111
|
-
finish(backfillCompletionComments(taskRef, { cwd, agent: normalizedAgent }));
|
|
111
|
+
finish(await backfillCompletionComments(taskRef, { cwd, agent: normalizedAgent }));
|
|
112
112
|
return;
|
|
113
113
|
}
|
|
114
114
|
const kind = parsed.values.kind;
|
|
@@ -143,7 +143,7 @@ function platformComment(args = []) {
|
|
|
143
143
|
fail(`unable to read body file: ${error instanceof Error ? error.message : String(error)}`);
|
|
144
144
|
return;
|
|
145
145
|
}
|
|
146
|
-
finish(syncPlatformComment(taskRef, {
|
|
146
|
+
finish(await syncPlatformComment(taskRef, {
|
|
147
147
|
kind: kind,
|
|
148
148
|
agent: normalizedAgent,
|
|
149
149
|
artifact: typeof parsed.values.artifact === 'string' ? parsed.values.artifact : undefined,
|
|
@@ -6,7 +6,7 @@ function fail(message) {
|
|
|
6
6
|
process.stderr.write(USAGE);
|
|
7
7
|
process.exitCode = 1;
|
|
8
8
|
}
|
|
9
|
-
function platformContext(args = []) {
|
|
9
|
+
async function platformContext(args = []) {
|
|
10
10
|
if (args[0] === '--help' || args[0] === '-h') {
|
|
11
11
|
process.stdout.write(USAGE);
|
|
12
12
|
return;
|
|
@@ -35,7 +35,7 @@ function platformContext(args = []) {
|
|
|
35
35
|
seen.add(flag);
|
|
36
36
|
cwd = path.resolve(value);
|
|
37
37
|
}
|
|
38
|
-
const result = resolvePlatformContext({ cwd });
|
|
38
|
+
const result = await resolvePlatformContext({ cwd });
|
|
39
39
|
process.stdout.write(`${JSON.stringify(result)}\n`);
|
|
40
40
|
if (result.status === 'failed')
|
|
41
41
|
process.exitCode = 1;
|