@fitlab-ai/agent-infra 0.9.10 → 0.9.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -9
- package/README.zh-CN.md +19 -9
- package/bin/cli.ts +17 -4
- package/dist/bin/cli.js +19 -4
- package/dist/bin/internal-cli.js +55 -4
- package/dist/lib/agent-client.js +0 -1
- package/dist/lib/agent-clients/adapters/codex-lifecycle/build-identity.js +71 -10
- package/dist/lib/agent-clients/adapters/opencode-sandbox.js +0 -4
- package/dist/lib/agent-clients/adapters/traecli.js +7 -8
- package/dist/lib/agent-clients/config.js +14 -99
- package/dist/lib/agent-clients/reconcile.js +1 -11
- package/dist/lib/agent-clients/schema.js +5 -4
- package/dist/lib/agent-clients/tokens.js +5 -15
- package/dist/lib/decide.js +14 -30
- package/dist/lib/defaults.json +8 -0
- package/dist/lib/git/workflow.js +43 -1
- package/dist/lib/init.js +3 -2
- package/dist/lib/internal/git-workflow.js +8 -1
- package/dist/lib/internal/platform-pr.js +8 -2
- package/dist/lib/internal/release-workflow.js +0 -1
- package/dist/lib/internal/task-delivery.js +59 -0
- package/dist/lib/internal/task-finalization.js +19 -9
- package/dist/lib/internal/task-ledger.js +8 -2
- package/dist/lib/internal/task-lifecycle.js +17 -93
- package/dist/lib/internal/task-orchestration.js +30 -216
- package/dist/lib/internal/task-validate.js +2 -1
- package/dist/lib/merge.js +205 -103
- package/dist/lib/platform/github-client.js +7 -1
- package/dist/lib/platform/pr-checks.js +8 -5
- package/dist/lib/platform/pr-summary.js +12 -8
- package/dist/lib/platform/pull-requests.js +393 -91
- package/dist/lib/platform/verification-required.js +13 -2
- package/dist/lib/platform/verification-sync.js +9 -4
- package/dist/lib/pr-review/evidence-grading.js +12 -4
- package/dist/lib/process-data/normalize.js +2 -9
- package/dist/lib/run/host.js +46 -16
- package/dist/lib/sandbox/agent-client-reconciler.js +4 -12
- package/dist/lib/sandbox/commands/create.js +3 -3
- package/dist/lib/sandbox/commands/enter.js +18 -4
- package/dist/lib/sandbox/config.js +8 -12
- package/dist/lib/sandbox/control/executor.js +131 -39
- package/dist/lib/sandbox/control/lifecycle.js +55 -24
- package/dist/lib/sandbox/control/server.js +18 -16
- package/dist/lib/sandbox/mounts.js +3 -2
- package/dist/lib/sandbox/recovery.js +123 -22
- package/dist/lib/sandbox/workspace-identity.js +14 -0
- package/dist/lib/sandbox/workspace-view.js +8 -9
- package/dist/lib/self-update.js +278 -0
- package/dist/lib/server/process-state.js +2 -2
- package/dist/lib/server/protocol.js +5 -5
- package/dist/lib/task/activity-log.js +4 -1
- package/dist/lib/task/artifact-lifecycle.js +6 -4
- package/dist/lib/task/codex-orchestration.js +1 -1
- package/dist/lib/task/command-options.js +1 -3
- package/dist/lib/task/commands/cat.js +0 -5
- package/dist/lib/task/commands/decisions.js +76 -92
- package/dist/lib/task/commands/files.js +6 -6
- package/dist/lib/task/commands/grep.js +25 -61
- package/dist/lib/task/commands/issue-body.js +6 -6
- package/dist/lib/task/commands/log.js +25 -10
- package/dist/lib/task/commands/show.js +5 -6
- package/dist/lib/task/commands/status.js +8 -8
- package/dist/lib/task/commit-intent.js +100 -0
- package/dist/lib/task/commit-operation.js +181 -91
- package/dist/lib/task/commit-policy.js +1 -1
- package/dist/lib/task/control-authority.js +431 -0
- package/dist/lib/task/create.js +39 -8
- package/dist/lib/task/current-contract.js +35 -0
- package/dist/lib/task/decision-details.js +218 -0
- package/dist/lib/task/decision-intents.js +5 -2
- package/dist/lib/task/delivery-target.js +97 -0
- package/dist/lib/task/delivery.js +153 -0
- package/dist/lib/task/events.js +11 -5
- package/dist/lib/task/human-override.js +5 -2
- package/dist/lib/task/index.js +19 -20
- package/dist/lib/task/ledger-intents.js +8 -9
- package/dist/lib/task/ledger.js +13 -6
- package/dist/lib/task/lifecycle.js +122 -9
- package/dist/lib/task/orchestration.js +105 -75
- package/dist/lib/task/pr-delivery-fact.js +182 -0
- package/dist/lib/task/review-artifacts.js +31 -12
- package/dist/lib/task/review-finalization.js +13 -4
- package/dist/lib/task/review-fingerprint.js +8 -0
- package/dist/lib/task/verification-engine.js +86 -39
- package/dist/lib/task/verification-review.js +2 -2
- package/dist/lib/task/workspace-snapshot.js +5 -11
- package/dist/lib/task/write.js +11 -1
- package/dist/lib/update.js +13 -35
- package/dist/lib/version.js +5 -1
- package/dist/lifecycle-build-manifest.json +3 -3
- package/lib/agent-client.ts +0 -1
- package/lib/agent-clients/adapters/codex-lifecycle/build-identity.ts +105 -10
- package/lib/agent-clients/adapters/codex-lifecycle/manifest-files.json +12 -1
- package/lib/agent-clients/adapters/opencode-sandbox.ts +0 -5
- package/lib/agent-clients/adapters/traecli.ts +7 -8
- package/lib/agent-clients/config.ts +14 -144
- package/lib/agent-clients/reconcile.ts +1 -12
- package/lib/agent-clients/schema.ts +5 -4
- package/lib/agent-clients/tokens.ts +5 -18
- package/lib/decide.ts +12 -22
- package/lib/defaults.json +8 -0
- package/lib/git/workflow.ts +38 -1
- package/lib/init.ts +5 -2
- package/lib/internal/git-workflow.ts +7 -1
- package/lib/internal/platform-pr.ts +8 -1
- package/lib/internal/release-workflow.ts +0 -1
- package/lib/internal/task-delivery.ts +53 -0
- package/lib/internal/task-finalization.ts +27 -13
- package/lib/internal/task-ledger.ts +8 -2
- package/lib/internal/task-lifecycle.ts +33 -76
- package/lib/internal/task-orchestration.ts +33 -190
- package/lib/internal/task-validate.ts +3 -2
- package/lib/merge.ts +236 -120
- package/lib/platform/github-client.ts +8 -1
- package/lib/platform/pr-checks.ts +7 -5
- package/lib/platform/pr-summary.ts +10 -7
- package/lib/platform/pull-requests.ts +425 -87
- package/lib/platform/verification-required.ts +12 -2
- package/lib/platform/verification-sync.ts +9 -4
- package/lib/pr-review/evidence-grading.ts +7 -4
- package/lib/process-data/normalize.ts +2 -8
- package/lib/run/host.ts +63 -14
- package/lib/sandbox/agent-client-reconciler.ts +5 -15
- package/lib/sandbox/commands/create.ts +4 -4
- package/lib/sandbox/commands/enter.ts +24 -4
- package/lib/sandbox/config.ts +9 -14
- package/lib/sandbox/control/container-identity.ts +2 -2
- package/lib/sandbox/control/executor.ts +148 -51
- package/lib/sandbox/control/lifecycle.ts +59 -31
- package/lib/sandbox/control/protocol.ts +1 -3
- package/lib/sandbox/control/server.ts +15 -12
- package/lib/sandbox/control/state.ts +7 -7
- package/lib/sandbox/mounts.ts +4 -3
- package/lib/sandbox/recovery.ts +162 -34
- package/lib/sandbox/tools.ts +1 -1
- package/lib/sandbox/workspace-identity.ts +28 -0
- package/lib/sandbox/workspace-view.ts +14 -10
- package/lib/self-update.ts +341 -0
- package/lib/server/process-state.ts +2 -2
- package/lib/server/protocol.ts +5 -5
- package/lib/task/activity-log.ts +6 -1
- package/lib/task/artifact-lifecycle.ts +7 -5
- package/lib/task/codex-orchestration.ts +2 -1
- package/lib/task/command-options.ts +1 -2
- package/lib/task/commands/cat.ts +0 -4
- package/lib/task/commands/decisions.ts +80 -75
- package/lib/task/commands/files.ts +6 -6
- package/lib/task/commands/grep.ts +23 -51
- package/lib/task/commands/issue-body.ts +6 -6
- package/lib/task/commands/log.ts +22 -10
- package/lib/task/commands/show.ts +5 -6
- package/lib/task/commands/status.ts +8 -8
- package/lib/task/commit-intent.ts +137 -0
- package/lib/task/commit-operation.ts +161 -79
- package/lib/task/commit-policy.ts +1 -2
- package/lib/task/control-authority.ts +563 -0
- package/lib/task/create.ts +40 -10
- package/lib/task/current-contract.ts +49 -0
- package/lib/task/decision-details.ts +280 -0
- package/lib/task/decision-intents.ts +7 -2
- package/lib/task/delivery-target.ts +130 -0
- package/lib/task/delivery.ts +160 -0
- package/lib/task/events.ts +10 -5
- package/lib/task/human-override.ts +5 -2
- package/lib/task/index.ts +19 -20
- package/lib/task/ledger-intents.ts +6 -8
- package/lib/task/ledger.ts +17 -7
- package/lib/task/lifecycle.ts +113 -4
- package/lib/task/orchestration.ts +102 -80
- package/lib/task/pr-delivery-fact.ts +254 -0
- package/lib/task/review-artifacts.ts +53 -15
- package/lib/task/review-finalization.ts +21 -5
- package/lib/task/review-fingerprint.ts +10 -0
- package/lib/task/verification-engine.ts +78 -46
- package/lib/task/verification-review.ts +3 -1
- package/lib/task/workspace-snapshot.ts +4 -13
- package/lib/task/write.ts +20 -1
- package/lib/update.ts +14 -38
- package/lib/version.ts +6 -1
- package/package.json +1 -1
- package/templates/.agents/README.en.md +5 -3
- package/templates/.agents/README.zh-CN.md +5 -3
- package/templates/.agents/rules/README.en.md +4 -2
- package/templates/.agents/rules/README.zh-CN.md +4 -2
- package/templates/.agents/rules/compatibility-policy.en.md +5 -4
- package/templates/.agents/rules/compatibility-policy.zh-CN.md +5 -4
- package/templates/.agents/rules/create-issue.en.md +11 -2
- package/templates/.agents/rules/create-issue.zh-CN.md +24 -2
- package/templates/.agents/rules/human-decision-context.en.md +9 -7
- package/templates/.agents/rules/human-decision-context.zh-CN.md +9 -7
- package/templates/.agents/rules/{issue-fields.github.en.md → issue-fields.en.md} +1 -1
- package/templates/.agents/rules/{issue-fields.github.zh-CN.md → issue-fields.zh-CN.md} +1 -1
- package/templates/.agents/rules/issue-pr-commands.en.md +5 -18
- package/templates/.agents/rules/issue-pr-commands.zh-CN.md +1 -1
- package/templates/.agents/rules/issue-sync.en.md +26 -5
- package/templates/.agents/rules/issue-sync.zh-CN.md +62 -5
- package/templates/.agents/rules/label-milestone-setup.en.md +15 -2
- package/templates/.agents/rules/label-milestone-setup.zh-CN.md +15 -2
- package/templates/.agents/rules/local-artifact-repair.en.md +46 -0
- package/templates/.agents/rules/local-artifact-repair.zh-CN.md +46 -0
- package/templates/.agents/rules/milestone-inference.en.md +12 -2
- package/templates/.agents/rules/milestone-inference.zh-CN.md +25 -3
- package/templates/.agents/rules/next-step-output.en.md +3 -3
- package/templates/.agents/rules/next-step-output.zh-CN.md +3 -3
- package/templates/.agents/rules/no-mid-flow-questions.en.md +1 -1
- package/templates/.agents/rules/no-mid-flow-questions.zh-CN.md +1 -1
- package/templates/.agents/rules/pr-sync.en.md +23 -14
- package/templates/.agents/rules/pr-sync.zh-CN.md +23 -2
- package/templates/.agents/rules/release-commands.en.md +42 -3
- package/templates/.agents/rules/release-commands.zh-CN.md +42 -3
- package/templates/.agents/rules/review-handshake.en.md +1 -1
- package/templates/.agents/rules/review-handshake.zh-CN.md +1 -1
- package/templates/.agents/rules/security-alerts.en.md +17 -2
- package/templates/.agents/rules/security-alerts.zh-CN.md +17 -2
- package/templates/.agents/rules/sync-content-generation.en.md +8 -0
- package/templates/.agents/rules/sync-content-generation.zh-CN.md +8 -0
- package/templates/.agents/rules/task-management.en.md +2 -3
- package/templates/.agents/rules/task-management.zh-CN.md +2 -3
- package/templates/.agents/scripts/security-alerts.github.sh +151 -0
- package/templates/.agents/scripts/security-alerts.sh +31 -0
- package/templates/.agents/skills/analyze-task/SKILL.en.md +4 -3
- package/templates/.agents/skills/analyze-task/SKILL.zh-CN.md +4 -3
- package/templates/.agents/skills/block-task/SKILL.en.md +2 -2
- package/templates/.agents/skills/block-task/SKILL.zh-CN.md +2 -2
- package/templates/.agents/skills/cancel-task/SKILL.en.md +2 -2
- package/templates/.agents/skills/cancel-task/SKILL.zh-CN.md +2 -2
- package/templates/.agents/skills/check-task/SKILL.en.md +2 -2
- package/templates/.agents/skills/check-task/SKILL.zh-CN.md +2 -2
- package/templates/.agents/skills/close-codescan/SKILL.en.md +3 -3
- package/templates/.agents/skills/close-codescan/SKILL.zh-CN.md +3 -3
- package/templates/.agents/skills/close-dependabot/SKILL.en.md +3 -3
- package/templates/.agents/skills/close-dependabot/SKILL.zh-CN.md +3 -3
- package/templates/.agents/skills/code-task/SKILL.en.md +8 -5
- package/templates/.agents/skills/code-task/SKILL.zh-CN.md +9 -6
- package/templates/.agents/skills/commit/SKILL.en.md +30 -10
- package/templates/.agents/skills/commit/SKILL.zh-CN.md +6 -7
- package/templates/.agents/skills/commit/config/verify.json +1 -1
- package/templates/.agents/skills/commit/reference/commit-orchestration.en.md +3 -3
- package/templates/.agents/skills/commit/reference/commit-orchestration.zh-CN.md +3 -3
- package/templates/.agents/skills/commit/reference/pr-summary-sync.en.md +1 -1
- package/templates/.agents/skills/commit/reference/pr-summary-sync.zh-CN.md +1 -1
- package/templates/.agents/skills/commit/reference/task-status-update.en.md +2 -2
- package/templates/.agents/skills/commit/reference/task-status-update.zh-CN.md +2 -2
- package/templates/.agents/skills/complete-manual-validation/SKILL.en.md +7 -6
- package/templates/.agents/skills/complete-manual-validation/SKILL.zh-CN.md +7 -6
- package/templates/.agents/skills/complete-manual-validation/config/verify.en.json +1 -1
- package/templates/.agents/skills/complete-manual-validation/config/verify.zh-CN.json +1 -1
- package/templates/.agents/skills/complete-manual-validation/reference/summary-update.en.md +1 -1
- package/templates/.agents/skills/complete-manual-validation/reference/summary-update.zh-CN.md +1 -1
- package/templates/.agents/skills/complete-task/SKILL.en.md +13 -13
- package/templates/.agents/skills/complete-task/SKILL.zh-CN.md +13 -13
- package/templates/.agents/skills/complete-task/reference/external-delivery.en.md +2 -2
- package/templates/.agents/skills/complete-task/reference/external-delivery.zh-CN.md +2 -2
- package/templates/.agents/skills/create-pr/SKILL.en.md +9 -11
- package/templates/.agents/skills/create-pr/SKILL.zh-CN.md +9 -11
- package/templates/.agents/skills/create-pr/reference/change-report.en.md +9 -4
- package/templates/.agents/skills/create-pr/reference/change-report.zh-CN.md +9 -4
- package/templates/.agents/skills/create-pr/scripts/change-report.mjs +203 -0
- package/templates/.agents/skills/create-release-note/SKILL.en.md +5 -6
- package/templates/.agents/skills/create-release-note/SKILL.zh-CN.md +5 -6
- package/templates/.agents/skills/create-task/SKILL.en.md +2 -1
- package/templates/.agents/skills/create-task/SKILL.zh-CN.md +2 -1
- package/templates/.agents/skills/import-codescan/SKILL.en.md +1 -1
- package/templates/.agents/skills/import-codescan/SKILL.zh-CN.md +1 -1
- package/templates/.agents/skills/import-dependabot/SKILL.en.md +1 -1
- package/templates/.agents/skills/import-dependabot/SKILL.zh-CN.md +1 -1
- package/templates/.agents/skills/import-issue/SKILL.en.md +1 -1
- package/templates/.agents/skills/import-issue/SKILL.zh-CN.md +1 -1
- package/templates/.agents/skills/init-labels/SKILL.en.md +9 -10
- package/templates/.agents/skills/init-labels/SKILL.zh-CN.md +9 -10
- package/templates/.agents/skills/init-labels/scripts/init-labels.github.sh +57 -1
- package/templates/.agents/skills/init-labels/scripts/init-labels.sh +27 -1
- package/templates/.agents/skills/init-milestones/SKILL.en.md +3 -5
- package/templates/.agents/skills/init-milestones/SKILL.zh-CN.md +3 -5
- package/templates/.agents/skills/plan-task/SKILL.en.md +4 -3
- package/templates/.agents/skills/plan-task/SKILL.zh-CN.md +4 -3
- package/templates/.agents/skills/restore-task/SKILL.en.md +1 -1
- package/templates/.agents/skills/restore-task/SKILL.zh-CN.md +1 -1
- package/templates/.agents/skills/review-analysis/SKILL.en.md +8 -5
- package/templates/.agents/skills/review-analysis/SKILL.zh-CN.md +8 -5
- package/templates/.agents/skills/review-analysis/config/verify.en.json +1 -0
- package/templates/.agents/skills/review-analysis/config/verify.zh-CN.json +1 -0
- package/templates/.agents/skills/review-analysis/reference/output-templates.en.md +18 -0
- package/templates/.agents/skills/review-analysis/reference/output-templates.zh-CN.md +18 -0
- package/templates/.agents/skills/review-code/SKILL.en.md +11 -8
- package/templates/.agents/skills/review-code/SKILL.zh-CN.md +11 -8
- package/templates/.agents/skills/review-code/config/verify.en.json +1 -0
- package/templates/.agents/skills/review-code/config/verify.zh-CN.json +1 -0
- package/templates/.agents/skills/review-code/reference/migration-risks.en.md +2 -1
- package/templates/.agents/skills/review-code/reference/migration-risks.zh-CN.md +2 -1
- package/templates/.agents/skills/review-code/reference/output-templates.en.md +19 -1
- package/templates/.agents/skills/review-code/reference/output-templates.zh-CN.md +19 -1
- package/templates/.agents/skills/review-code/reference/report-template.en.md +4 -2
- package/templates/.agents/skills/review-code/reference/report-template.zh-CN.md +4 -2
- package/templates/.agents/skills/review-plan/SKILL.en.md +8 -5
- package/templates/.agents/skills/review-plan/SKILL.zh-CN.md +8 -5
- package/templates/.agents/skills/review-plan/config/verify.en.json +1 -0
- package/templates/.agents/skills/review-plan/config/verify.zh-CN.json +1 -0
- package/templates/.agents/skills/review-plan/reference/output-templates.en.md +18 -0
- package/templates/.agents/skills/review-plan/reference/output-templates.zh-CN.md +18 -0
- package/templates/.agents/skills/review-pr/SKILL.en.md +1 -0
- package/templates/.agents/skills/review-pr/SKILL.zh-CN.md +1 -0
- package/templates/.agents/skills/review-pr/reference/evidence-grading.en.md +2 -2
- package/templates/.agents/skills/review-pr/reference/evidence-grading.zh-CN.md +2 -2
- package/templates/.agents/skills/run-manual-validation/SKILL.en.md +5 -0
- package/templates/.agents/skills/run-manual-validation/SKILL.zh-CN.md +5 -0
- package/templates/.agents/skills/run-task/SKILL.en.md +5 -1
- package/templates/.agents/skills/run-task/SKILL.zh-CN.md +5 -1
- package/templates/.agents/skills/update-agent-infra/SKILL.en.md +2 -2
- package/templates/.agents/skills/update-agent-infra/SKILL.zh-CN.md +2 -2
- package/templates/.agents/skills/update-agent-infra/scripts/sync-templates.js +144 -109
- package/templates/.agents/skills/watch-pr/SKILL.en.md +5 -5
- package/templates/.agents/skills/watch-pr/SKILL.zh-CN.md +5 -5
- package/templates/.agents/templates/task.en.md +6 -2
- package/templates/.agents/templates/task.zh-CN.md +6 -2
- package/templates/.agents/workflows/bug-fix.en.yaml +9 -8
- package/templates/.agents/workflows/bug-fix.zh-CN.yaml +9 -8
- package/templates/.agents/workflows/feature-development.en.yaml +9 -8
- package/templates/.agents/workflows/feature-development.zh-CN.yaml +9 -8
- package/templates/.agents/workflows/refactoring.en.yaml +9 -8
- package/templates/.agents/workflows/refactoring.zh-CN.yaml +9 -8
- package/templates/.claude/commands/analyze-task.en.md +1 -1
- package/templates/.claude/commands/analyze-task.zh-CN.md +1 -1
- package/templates/.claude/commands/block-task.en.md +1 -1
- package/templates/.claude/commands/block-task.zh-CN.md +1 -1
- package/templates/.claude/commands/cancel-task.en.md +1 -1
- package/templates/.claude/commands/cancel-task.zh-CN.md +1 -1
- package/templates/.claude/commands/check-task.en.md +1 -1
- package/templates/.claude/commands/check-task.zh-CN.md +1 -1
- package/templates/.claude/commands/code-task.en.md +1 -1
- package/templates/.claude/commands/code-task.zh-CN.md +1 -1
- package/templates/.claude/commands/commit.en.md +1 -1
- package/templates/.claude/commands/commit.zh-CN.md +1 -1
- package/templates/.claude/commands/complete-manual-validation.en.md +1 -1
- package/templates/.claude/commands/complete-manual-validation.zh-CN.md +1 -1
- package/templates/.claude/commands/complete-task.en.md +1 -1
- package/templates/.claude/commands/complete-task.zh-CN.md +1 -1
- package/templates/.claude/commands/create-pr.en.md +1 -1
- package/templates/.claude/commands/create-pr.zh-CN.md +1 -1
- package/templates/.claude/commands/plan-task.en.md +1 -1
- package/templates/.claude/commands/plan-task.zh-CN.md +1 -1
- package/templates/.claude/commands/review-analysis.en.md +1 -1
- package/templates/.claude/commands/review-analysis.zh-CN.md +1 -1
- package/templates/.claude/commands/review-code.en.md +1 -1
- package/templates/.claude/commands/review-code.zh-CN.md +1 -1
- package/templates/.claude/commands/review-plan.en.md +1 -1
- package/templates/.claude/commands/review-plan.zh-CN.md +1 -1
- package/templates/.claude/commands/run-manual-validation.en.md +1 -1
- package/templates/.claude/commands/run-manual-validation.zh-CN.md +1 -1
- package/templates/.claude/commands/run-task.en.md +1 -1
- package/templates/.claude/commands/run-task.zh-CN.md +1 -1
- package/templates/.claude/commands/watch-pr.en.md +1 -1
- package/templates/.claude/commands/watch-pr.zh-CN.md +1 -1
- package/templates/{.trae/skills → .traecli/commands}/update-agent-infra.en.md +0 -1
- package/templates/{.trae/skills → .traecli/commands}/update-agent-infra.zh-CN.md +0 -1
- package/dist/lib/builtin-tuis.js +0 -40
- package/lib/builtin-tuis.ts +0 -56
- package/templates/.agents/rules/create-issue.github.en.md +0 -14
- package/templates/.agents/rules/create-issue.github.zh-CN.md +0 -27
- package/templates/.agents/rules/issue-pr-commands.github.en.md +0 -34
- package/templates/.agents/rules/issue-pr-commands.github.zh-CN.md +0 -49
- package/templates/.agents/rules/issue-sync.github.en.md +0 -40
- package/templates/.agents/rules/issue-sync.github.zh-CN.md +0 -76
- package/templates/.agents/rules/label-milestone-setup.github.en.md +0 -60
- package/templates/.agents/rules/label-milestone-setup.github.zh-CN.md +0 -60
- package/templates/.agents/rules/milestone-inference.github.en.md +0 -15
- package/templates/.agents/rules/milestone-inference.github.zh-CN.md +0 -27
- package/templates/.agents/rules/pr-checks-commands.github.en.md +0 -18
- package/templates/.agents/rules/pr-checks-commands.github.zh-CN.md +0 -34
- package/templates/.agents/rules/pr-sync.github.en.md +0 -43
- package/templates/.agents/rules/pr-sync.github.zh-CN.md +0 -69
- package/templates/.agents/rules/release-commands.github.en.md +0 -38
- package/templates/.agents/rules/release-commands.github.zh-CN.md +0 -38
- package/templates/.agents/rules/security-alerts.github.en.md +0 -43
- package/templates/.agents/rules/security-alerts.github.zh-CN.md +0 -43
|
@@ -3,20 +3,19 @@ import path from 'node:path';
|
|
|
3
3
|
import { formatTable } from '../../table.ts';
|
|
4
4
|
import { parseTaskScope } from '../command-options.ts';
|
|
5
5
|
import { resolveTaskContext } from '../resolve-ref.ts';
|
|
6
|
-
import { isReviewStage,
|
|
6
|
+
import { isReviewStage, parseLedgerDocument, type LedgerRow, type ReviewStage } from '../ledger.ts';
|
|
7
7
|
import { listDecisionItems, selectDecisionItem } from '../decision-items.ts';
|
|
8
|
-
import {
|
|
8
|
+
import { normalizeDecisionDetailForDisplay, parseDecisionEvidence, resolveDecisionDetail } from '../decision-details.ts';
|
|
9
9
|
|
|
10
10
|
const USAGE = `Usage: ai task decisions [--task <ref> | -t <ref>] [--item <selector> | -i <selector>] [options]
|
|
11
|
-
ai task decisions <ref> [selector] [options]
|
|
12
11
|
|
|
13
12
|
Shows what still needs a maintainer's decision. Without a selector, it lists
|
|
14
13
|
the choices. With a selector, it shows the explanation and how to respond.
|
|
15
14
|
Read-only.
|
|
16
15
|
|
|
17
|
-
Omit
|
|
18
|
-
<ref>
|
|
19
|
-
|
|
16
|
+
Omit the scope Resolve the unique active task for the current branch.
|
|
17
|
+
--task/-t <ref> Select a task explicitly.
|
|
18
|
+
--item/-i <s> Ordinal (1-based) or ledger id (e.g. 'PL-3') to show one item's detail.
|
|
20
19
|
|
|
21
20
|
Options:
|
|
22
21
|
-i, --item <s> Select an item when task scope is implicit or flag-based.
|
|
@@ -56,9 +55,8 @@ function parseArgs(args: string[]): ParsedArgs | null {
|
|
|
56
55
|
if (out.item !== undefined) { fail("duplicate option '--item'"); return null; }
|
|
57
56
|
out.item = v; i += 1;
|
|
58
57
|
} else if (a.startsWith('--item=')) {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
if (out.item === '') { fail('--item requires a value'); return null; }
|
|
58
|
+
fail("--item=... is not supported; use --item <selector> or -i <selector>");
|
|
59
|
+
return null;
|
|
62
60
|
} else if (a === '--stage') {
|
|
63
61
|
const v = args[i + 1];
|
|
64
62
|
if (v === undefined) {
|
|
@@ -89,47 +87,30 @@ function parseArgs(args: string[]): ParsedArgs | null {
|
|
|
89
87
|
return out;
|
|
90
88
|
}
|
|
91
89
|
|
|
92
|
-
//
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
return m ? Number.parseInt(m[1]!, 10) : 1;
|
|
101
|
-
}
|
|
90
|
+
// Locate the canonical detail block named by the row's current evidence. Historical
|
|
91
|
+
// artifacts are intentionally not searched: an evidence reference is a precise
|
|
92
|
+
// provenance pointer, not a best-effort hint.
|
|
93
|
+
type DetailLookup =
|
|
94
|
+
| { status: 'found'; content: string }
|
|
95
|
+
| { status: 'missing'; reason: string }
|
|
96
|
+
| { status: 'ambiguous'; reason: string }
|
|
97
|
+
| { status: 'invalid'; reason: string };
|
|
102
98
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
if (hinted) {
|
|
110
|
-
const p = path.join(taskDir, hinted);
|
|
111
|
-
if (fs.existsSync(p)) {
|
|
112
|
-
const block = extractSubSection(fs.readFileSync(p, 'utf8'), row.id);
|
|
113
|
-
if (block) return block;
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
let best = '';
|
|
117
|
-
let bestRound = -1;
|
|
118
|
-
let entries: string[];
|
|
99
|
+
function findDetailBlock(row: LedgerRow, taskDir: string): DetailLookup {
|
|
100
|
+
const evidence = parseDecisionEvidence(row.evidence);
|
|
101
|
+
if (!evidence.ok) return { status: 'invalid', reason: `invalid evidence '${row.evidence}'` };
|
|
102
|
+
const artifactPath = path.join(taskDir, evidence.artifact);
|
|
103
|
+
if (!fs.existsSync(artifactPath)) return { status: 'missing', reason: `artifact '${evidence.artifact}' is missing` };
|
|
104
|
+
let artifactContent: string;
|
|
119
105
|
try {
|
|
120
|
-
|
|
106
|
+
artifactContent = fs.readFileSync(artifactPath, 'utf8');
|
|
121
107
|
} catch {
|
|
122
|
-
return '';
|
|
123
|
-
}
|
|
124
|
-
for (const file of entries) {
|
|
125
|
-
if (!/^(analysis|plan|code)(-r\d+)?\.md$/.test(file)) continue;
|
|
126
|
-
const block = extractSubSection(fs.readFileSync(path.join(taskDir, file), 'utf8'), row.id);
|
|
127
|
-
if (block && roundOf(file) > bestRound) {
|
|
128
|
-
best = block;
|
|
129
|
-
bestRound = roundOf(file);
|
|
130
|
-
}
|
|
108
|
+
return { status: 'missing', reason: `artifact '${evidence.artifact}' cannot be read` };
|
|
131
109
|
}
|
|
132
|
-
|
|
110
|
+
const resolved = resolveDecisionDetail(artifactContent, row.id, evidence.anchor);
|
|
111
|
+
if (resolved.status === 'found') return { status: 'found', content: normalizeDecisionDetailForDisplay(resolved.block) };
|
|
112
|
+
if (resolved.status === 'ambiguous') return { status: 'ambiguous', reason: resolved.reason };
|
|
113
|
+
return { status: 'missing', reason: resolved.reason };
|
|
133
114
|
}
|
|
134
115
|
|
|
135
116
|
// Pull the `## 人工裁决` record lines that mention this ledger id, so a decided item
|
|
@@ -149,9 +130,9 @@ function findDecisionRecord(id: string, content: string): string[] {
|
|
|
149
130
|
}
|
|
150
131
|
|
|
151
132
|
function titleOf(row: LedgerRow, taskDir: string): string {
|
|
152
|
-
const
|
|
153
|
-
if (
|
|
154
|
-
const title =
|
|
133
|
+
const detail = findDetailBlock(row, taskDir);
|
|
134
|
+
if (detail.status === 'found') {
|
|
135
|
+
const title = detail.content
|
|
155
136
|
.split('\n')[0]!
|
|
156
137
|
.replace(/^###\s+/, '')
|
|
157
138
|
.replace(/\s*\[needs-human-decision\]\s*$/, '')
|
|
@@ -165,7 +146,7 @@ function trackingOf(row: LedgerRow): string {
|
|
|
165
146
|
return `stage=${row.stage} · severity=${row.severity} · status=${row.status} · evidence=${row.evidence}`;
|
|
166
147
|
}
|
|
167
148
|
|
|
168
|
-
function renderList(rows: LedgerRow[], format: string, taskDir: string): void {
|
|
149
|
+
function renderList(rows: LedgerRow[], format: string, taskDir: string, taskId: string): void {
|
|
169
150
|
if (rows.length === 0) {
|
|
170
151
|
process.stdout.write('No pending decisions.\n');
|
|
171
152
|
return;
|
|
@@ -184,10 +165,10 @@ function renderList(rows: LedgerRow[], format: string, taskDir: string): void {
|
|
|
184
165
|
`| ${sep.join(' | ')} |`,
|
|
185
166
|
...data.map((row) => `| ${row.join(' | ')} |`)
|
|
186
167
|
];
|
|
187
|
-
process.stdout.write(`${md.join('\n')}\n\nView one item: ai task decisions
|
|
168
|
+
process.stdout.write(`${md.join('\n')}\n\nView one item: ai task decisions --task ${taskId} --item <ordinal|ledger-id>\n`);
|
|
188
169
|
return;
|
|
189
170
|
}
|
|
190
|
-
process.stdout.write(`${formatTable(headers, data).join('\n')}\n\nView one item: ai task decisions
|
|
171
|
+
process.stdout.write(`${formatTable(headers, data).join('\n')}\n\nView one item: ai task decisions --task ${taskId} --item <ordinal|ledger-id>\n`);
|
|
191
172
|
}
|
|
192
173
|
|
|
193
174
|
function renderTracking(row: LedgerRow, format: string): string[] {
|
|
@@ -214,7 +195,8 @@ function renderDetail(
|
|
|
214
195
|
selector: string,
|
|
215
196
|
format: string,
|
|
216
197
|
taskDir: string,
|
|
217
|
-
content: string
|
|
198
|
+
content: string,
|
|
199
|
+
taskId: string
|
|
218
200
|
): void {
|
|
219
201
|
const selected = selectDecisionItem(rows, selector);
|
|
220
202
|
if (!selected.ok) {
|
|
@@ -222,21 +204,23 @@ function renderDetail(
|
|
|
222
204
|
return;
|
|
223
205
|
}
|
|
224
206
|
const r = selected.row;
|
|
225
|
-
const
|
|
226
|
-
|
|
207
|
+
const detail = findDetailBlock(r, taskDir);
|
|
208
|
+
if (detail.status === 'invalid' || detail.status === 'ambiguous') {
|
|
209
|
+
fail(`cannot resolve ${r.id}: ${detail.reason}`);
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
const block = detail.status === 'found' ? detail.content : '';
|
|
213
|
+
const title = block
|
|
214
|
+
? block.split('\n')[0]!.replace(/^###\s+/, '').replace(/\s*\[needs-human-decision\]\s*$/, '').trim()
|
|
215
|
+
.replace(new RegExp(`^${r.id}\\s*[::]\\s*`, 'i'), '').trim()
|
|
216
|
+
: '(explanation unavailable)';
|
|
227
217
|
const lines: string[] = [];
|
|
228
218
|
const decided = r.status === 'human-decided';
|
|
229
219
|
if (format === 'markdown') {
|
|
230
220
|
lines.push(`## ${decided ? 'Decision already recorded' : 'Decision needed'}: ${title}`, '');
|
|
231
|
-
if (!decided) {
|
|
232
|
-
lines.push('**How to record your choice**', `\`ai decide <task-ref> ${r.id} <your choice and rationale>\``, '');
|
|
233
|
-
}
|
|
234
221
|
lines.push('**Original context**', '');
|
|
235
222
|
} else {
|
|
236
223
|
lines.push(`${decided ? 'Decision already recorded' : 'Decision needed'}: ${title}`, '');
|
|
237
|
-
if (!decided) {
|
|
238
|
-
lines.push('How to record your choice:', `ai decide <task-ref> ${r.id} <your choice and rationale>`, '');
|
|
239
|
-
}
|
|
240
224
|
lines.push('Original context:');
|
|
241
225
|
}
|
|
242
226
|
if (block) {
|
|
@@ -252,6 +236,14 @@ function renderDetail(
|
|
|
252
236
|
lines.push('', format === 'markdown' ? '**Recorded choice**' : 'Recorded choice:');
|
|
253
237
|
lines.push(...(record.length ? record : ['No separate ruling record was found.']));
|
|
254
238
|
}
|
|
239
|
+
if (!decided) {
|
|
240
|
+
lines.push('');
|
|
241
|
+
if (format === 'markdown') {
|
|
242
|
+
lines.push('**How to record your choice**', `\`ai decide --task ${taskId} --item ${r.id} <your choice and rationale>\``);
|
|
243
|
+
} else {
|
|
244
|
+
lines.push('How to record your choice:', `ai decide --task ${taskId} --item ${r.id} <your choice and rationale>`);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
255
247
|
lines.push('', ...renderTracking(r, format));
|
|
256
248
|
process.stdout.write(`${lines.join('\n')}\n`);
|
|
257
249
|
}
|
|
@@ -274,16 +266,11 @@ function decisions(args: string[] = []): void {
|
|
|
274
266
|
return;
|
|
275
267
|
}
|
|
276
268
|
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
if (parsed.
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
if (parsed.positionals.length > 0) { fail('positional task ref/selector cannot be combined with --task'); return; }
|
|
283
|
-
} else {
|
|
284
|
-
if (parsed.positionals.length > 2) { fail('too many positional arguments'); return; }
|
|
285
|
-
taskRef = parsed.positionals[0];
|
|
286
|
-
selector = parsed.positionals[1];
|
|
269
|
+
const taskRef = scope.taskRef;
|
|
270
|
+
const selector = parsed.item;
|
|
271
|
+
if (parsed.positionals.length > 0) {
|
|
272
|
+
fail('positional task ref/selector is not supported; use --task <ref> or -t <ref>, and --item <selector> or -i <selector>');
|
|
273
|
+
return;
|
|
287
274
|
}
|
|
288
275
|
const resolved = resolveTaskContext(taskRef);
|
|
289
276
|
if (!resolved.ok) {
|
|
@@ -291,16 +278,34 @@ function decisions(args: string[] = []): void {
|
|
|
291
278
|
return;
|
|
292
279
|
}
|
|
293
280
|
|
|
294
|
-
|
|
295
|
-
|
|
281
|
+
let content: string;
|
|
282
|
+
let ledger;
|
|
283
|
+
try {
|
|
284
|
+
content = fs.readFileSync(resolved.taskMdPath, 'utf8');
|
|
285
|
+
ledger = parseLedgerDocument(content);
|
|
286
|
+
} catch (error) {
|
|
287
|
+
fail(`ledger unavailable [LEDGER_DOCUMENT_INVALID]: ${error instanceof Error ? error.message : String(error)}`);
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
if (!ledger.present) {
|
|
291
|
+
fail('ledger unavailable [LEDGER_SECTION_MISSING]: review disagreement ledger section is missing');
|
|
292
|
+
return;
|
|
293
|
+
}
|
|
294
|
+
const rows = listDecisionItems(ledger.rows as LedgerRow[], {
|
|
296
295
|
includeDecided: parsed.all,
|
|
297
296
|
stage: parsed.stage as ReviewStage | undefined
|
|
298
297
|
});
|
|
299
298
|
|
|
300
299
|
if (selector === undefined) {
|
|
301
|
-
renderList(rows, parsed.format, resolved.taskDir);
|
|
300
|
+
renderList(rows, parsed.format, resolved.taskDir, resolved.taskId);
|
|
302
301
|
} else {
|
|
303
|
-
|
|
302
|
+
const selectionRows = /^[A-Za-z]+-\d+$/.test(selector)
|
|
303
|
+
? listDecisionItems(ledger.rows as LedgerRow[], {
|
|
304
|
+
includeDecided: true,
|
|
305
|
+
stage: parsed.stage as ReviewStage | undefined
|
|
306
|
+
})
|
|
307
|
+
: rows;
|
|
308
|
+
renderDetail(selectionRows, selector, parsed.format, resolved.taskDir, content, resolved.taskId);
|
|
304
309
|
}
|
|
305
310
|
}
|
|
306
311
|
|
|
@@ -3,11 +3,11 @@ import { parseTaskScope } from '../command-options.ts';
|
|
|
3
3
|
import { resolveTaskContext } from '../resolve-ref.ts';
|
|
4
4
|
import { enumerateArtifacts } from '../artifacts.ts';
|
|
5
5
|
|
|
6
|
-
const USAGE = `Usage: ai task files [
|
|
6
|
+
const USAGE = `Usage: ai task files [--task <ref> | -t <ref>]
|
|
7
7
|
|
|
8
8
|
Lists the artifacts in a task directory with stable numbers.
|
|
9
|
-
Omit
|
|
10
|
-
<ref>
|
|
9
|
+
Omit the scope Resolve the unique active task for the current branch.
|
|
10
|
+
--task/-t <ref> Bare numeric short id, or a full TASK-YYYYMMDD-HHMMSS id.
|
|
11
11
|
|
|
12
12
|
Columns: # (artifact number, usable with 'ai task cat') / NAME / SIZE (bytes) / MTIME
|
|
13
13
|
`;
|
|
@@ -35,10 +35,10 @@ function files(args: string[] = []): void {
|
|
|
35
35
|
try { scope = parseTaskScope(args); } catch (error) {
|
|
36
36
|
process.stderr.write(`ai task files: ${error instanceof Error ? error.message : String(error)}\n`); process.exitCode = 1; return;
|
|
37
37
|
}
|
|
38
|
-
if (scope.positionals.length >
|
|
39
|
-
process.stderr.write('ai task files: task ref
|
|
38
|
+
if (scope.positionals.length > 0) {
|
|
39
|
+
process.stderr.write('ai task files: positional task ref is not supported; use --task <ref> or -t <ref>\n'); process.exitCode = 1; return;
|
|
40
40
|
}
|
|
41
|
-
const resolved = resolveTaskContext(scope.taskRef
|
|
41
|
+
const resolved = resolveTaskContext(scope.taskRef);
|
|
42
42
|
if (!resolved.ok) {
|
|
43
43
|
process.stderr.write(`ai task files: ${resolved.message}\n`);
|
|
44
44
|
process.exitCode = 1;
|
|
@@ -1,25 +1,20 @@
|
|
|
1
1
|
import fs from 'node:fs';
|
|
2
2
|
import path from 'node:path';
|
|
3
|
-
import { resolveTaskContext, resolveTaskRef
|
|
3
|
+
import { resolveTaskContext, resolveTaskRef } from '../resolve-ref.ts';
|
|
4
4
|
import { enumerateArtifacts, resolveArtifact } from '../artifacts.ts';
|
|
5
5
|
import { loadShortIdByTaskId } from '../short-id.ts';
|
|
6
6
|
|
|
7
|
-
const USAGE = `Usage: ai task grep <
|
|
8
|
-
ai task grep <pattern> (--current | --task <ref> | -t <ref>) [artifact | N]
|
|
7
|
+
const USAGE = `Usage: ai task grep [--current | --task <ref> | -t <ref>] <pattern> [artifact | N]
|
|
9
8
|
|
|
10
9
|
Literal (non-regex) line search across task artifacts.
|
|
11
10
|
<pattern> Literal substring to match (NOT a regex). Case-sensitive by default.
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
(a TASK-id ref can also resolve an archived task).
|
|
16
|
-
[artifact | N] Only valid with <ref>. Artifact filename (with or without '.md')
|
|
11
|
+
--current Limit search to the unique active task for the current branch.
|
|
12
|
+
-t, --task <ref> Limit search to an explicit task (bare short id or TASK-id).
|
|
13
|
+
[artifact | N] Artifact filename (with or without '.md')
|
|
17
14
|
or the number from 'ai task files'. Narrows to a single artifact.
|
|
18
15
|
|
|
19
16
|
Options:
|
|
20
17
|
-i, --ignore-case Case-insensitive matching.
|
|
21
|
-
--current Limit search to the current task context.
|
|
22
|
-
-t, --task <ref> Limit search to an explicit task.
|
|
23
18
|
-- Treat the rest as positional (use for patterns starting with '-').
|
|
24
19
|
|
|
25
20
|
Output: '{taskId} [#short] {fileStem}:{line}: {matched-line}' (short id only for active tasks).
|
|
@@ -85,9 +80,7 @@ function grep(args: string[] = []): void {
|
|
|
85
80
|
continue;
|
|
86
81
|
}
|
|
87
82
|
if (!optsEnded && a.startsWith('--task=')) {
|
|
88
|
-
|
|
89
|
-
taskRef = a.slice('--task='.length);
|
|
90
|
-
if (taskRef === '') { process.stderr.write('ai task grep: --task requires a value\n'); process.exitCode = 1; return; }
|
|
83
|
+
process.stderr.write('ai task grep: --task=... is not supported; use --task <ref> or -t <ref>\n'); process.exitCode = 1; return;
|
|
91
84
|
continue;
|
|
92
85
|
}
|
|
93
86
|
if (!optsEnded && a.startsWith('-') && a !== '-') {
|
|
@@ -106,61 +99,40 @@ function grep(args: string[] = []): void {
|
|
|
106
99
|
if (current && taskRef !== undefined) {
|
|
107
100
|
process.stderr.write('ai task grep: --current and --task are mutually exclusive\n'); process.exitCode = 1; return;
|
|
108
101
|
}
|
|
109
|
-
if (positional.length >
|
|
102
|
+
if (positional.length > 2) {
|
|
110
103
|
process.stderr.write('ai task grep: too many arguments\n');
|
|
111
104
|
process.exitCode = 1;
|
|
112
105
|
return;
|
|
113
106
|
}
|
|
114
107
|
|
|
115
|
-
|
|
116
|
-
if (current || taskRef !== undefined) {
|
|
117
|
-
artifactOrN = ref;
|
|
118
|
-
ref = taskRef;
|
|
119
|
-
}
|
|
108
|
+
const [pattern, artifactOrN] = positional;
|
|
120
109
|
const matcher = makeMatcher(pattern!, ignoreCase);
|
|
121
110
|
const chunks: string[] = [];
|
|
122
111
|
const emit = (line: string) => chunks.push(line);
|
|
123
112
|
let total = 0;
|
|
124
113
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
114
|
+
const resolved = current || taskRef === undefined
|
|
115
|
+
? resolveTaskContext()
|
|
116
|
+
: resolveTaskRef(taskRef);
|
|
117
|
+
if (!resolved.ok) {
|
|
118
|
+
process.stderr.write(`ai task grep: ${resolved.message}\n`);
|
|
119
|
+
process.exitCode = 1;
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
const shortToken = loadShortIdByTaskId(resolved.repoRoot).get(resolved.taskId);
|
|
123
|
+
if (artifactOrN !== undefined) {
|
|
124
|
+
let artifactPath: string;
|
|
128
125
|
try {
|
|
129
|
-
|
|
126
|
+
artifactPath = resolveArtifact(resolved.taskDir, artifactOrN);
|
|
130
127
|
} catch (e) {
|
|
131
128
|
process.stderr.write(`ai task grep: ${(e as Error).message}\n`);
|
|
132
129
|
process.exitCode = 1;
|
|
133
130
|
return;
|
|
134
131
|
}
|
|
135
|
-
|
|
136
|
-
for (const { taskId, taskDir } of enumerateTaskDirs(repoRoot)) {
|
|
137
|
-
const shortToken = shortMap.get(taskId);
|
|
138
|
-
for (const a of enumerateArtifacts(taskDir)) {
|
|
139
|
-
total += scanArtifact(taskId, shortToken, a.path, matcher, emit);
|
|
140
|
-
}
|
|
141
|
-
}
|
|
132
|
+
total += scanArtifact(resolved.taskId, shortToken, artifactPath, matcher, emit);
|
|
142
133
|
} else {
|
|
143
|
-
const
|
|
144
|
-
|
|
145
|
-
process.stderr.write(`ai task grep: ${resolved.message}\n`);
|
|
146
|
-
process.exitCode = 1;
|
|
147
|
-
return;
|
|
148
|
-
}
|
|
149
|
-
const shortToken = loadShortIdByTaskId(resolved.repoRoot).get(resolved.taskId);
|
|
150
|
-
if (artifactOrN !== undefined) {
|
|
151
|
-
let artifactPath: string;
|
|
152
|
-
try {
|
|
153
|
-
artifactPath = resolveArtifact(resolved.taskDir, artifactOrN);
|
|
154
|
-
} catch (e) {
|
|
155
|
-
process.stderr.write(`ai task grep: ${(e as Error).message}\n`);
|
|
156
|
-
process.exitCode = 1;
|
|
157
|
-
return;
|
|
158
|
-
}
|
|
159
|
-
total += scanArtifact(resolved.taskId, shortToken, artifactPath, matcher, emit);
|
|
160
|
-
} else {
|
|
161
|
-
for (const a of enumerateArtifacts(resolved.taskDir)) {
|
|
162
|
-
total += scanArtifact(resolved.taskId, shortToken, a.path, matcher, emit);
|
|
163
|
-
}
|
|
134
|
+
for (const a of enumerateArtifacts(resolved.taskDir)) {
|
|
135
|
+
total += scanArtifact(resolved.taskId, shortToken, a.path, matcher, emit);
|
|
164
136
|
}
|
|
165
137
|
}
|
|
166
138
|
|
|
@@ -6,11 +6,11 @@ import { extractSection, findSectionHeading } from '../sections.ts';
|
|
|
6
6
|
import { renderTemplateBody, PLACEHOLDER } from '../issue-form.ts';
|
|
7
7
|
import type { TaskFields } from '../issue-form.ts';
|
|
8
8
|
|
|
9
|
-
const USAGE = `Usage: ai task issue-body [
|
|
9
|
+
const USAGE = `Usage: ai task issue-body [--task <ref> | -t <ref>] [--template <path>]
|
|
10
10
|
|
|
11
11
|
Print a deterministic Issue body extracted from a task's task.md.
|
|
12
|
-
Omit
|
|
13
|
-
<ref>
|
|
12
|
+
Omit the scope Resolve the unique active task for the current branch.
|
|
13
|
+
--task/-t <ref> Bare numeric short id, or a full TASK-YYYYMMDD-HHMMSS id.
|
|
14
14
|
--template <path> Render the final body for the given GitHub Issue Form (scenario A);
|
|
15
15
|
without it, print the default '任务输入 + 描述 + 需求' body (scenario B).
|
|
16
16
|
|
|
@@ -71,10 +71,10 @@ function issueBody(args: string[] = []): void {
|
|
|
71
71
|
try { scope = parseTaskScope(scopeArgs); } catch (error) {
|
|
72
72
|
process.stderr.write(`ai task issue-body: ${error instanceof Error ? error.message : String(error)}\n`); process.exitCode = 1; return;
|
|
73
73
|
}
|
|
74
|
-
if (scope.positionals.length >
|
|
75
|
-
process.stderr.write('ai task issue-body: task ref
|
|
74
|
+
if (scope.positionals.length > 0) {
|
|
75
|
+
process.stderr.write('ai task issue-body: positional task ref is not supported; use --task <ref> or -t <ref>\n'); process.exitCode = 1; return;
|
|
76
76
|
}
|
|
77
|
-
const resolved = resolveTaskContext(scope.taskRef
|
|
77
|
+
const resolved = resolveTaskContext(scope.taskRef);
|
|
78
78
|
if (!resolved.ok) {
|
|
79
79
|
process.stderr.write(`ai task issue-body: ${resolved.message}\n`);
|
|
80
80
|
process.exitCode = 1;
|
package/lib/task/commands/log.ts
CHANGED
|
@@ -3,16 +3,16 @@ import { classifyAgent } from '../../agent-clients/tokens.ts';
|
|
|
3
3
|
import { formatTable } from '../../table.ts';
|
|
4
4
|
import { parseTaskScope } from '../command-options.ts';
|
|
5
5
|
import { resolveTaskContext } from '../resolve-ref.ts';
|
|
6
|
-
import { isReviewStage,
|
|
6
|
+
import { LEDGER_SECTION_MISSING_CODE, LEDGER_SECTION_MISSING_MESSAGE, isReviewStage, parseLedgerDocument, type LedgerRow, type ReviewStage } from '../ledger.ts';
|
|
7
7
|
import { parseActivityLog, pairEntries } from '../activity-log.ts';
|
|
8
8
|
|
|
9
|
-
const USAGE = `Usage: ai task log [
|
|
9
|
+
const USAGE = `Usage: ai task log [--task <ref> | -t <ref>]
|
|
10
10
|
|
|
11
11
|
Renders a task's activity log as a per-step status table. A step's start and
|
|
12
12
|
completion are paired onto one row: STARTED holds the start time, DONE the
|
|
13
13
|
completion time (or '(in progress)' while still running).
|
|
14
|
-
Omit
|
|
15
|
-
<ref>
|
|
14
|
+
Omit the scope Resolve the unique active task for the current branch.
|
|
15
|
+
--task/-t <ref> Bare numeric short id, or a full TASK-YYYYMMDD-HHMMSS id.
|
|
16
16
|
|
|
17
17
|
Columns: # (row) / STEP / AGENT / STARTED / DONE / NOTE
|
|
18
18
|
A human-executed step shows AGENT as 'human' and, when it has no start marker,
|
|
@@ -92,8 +92,8 @@ function isHumanCountField(field: string): boolean {
|
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
// A step is human-executed when its agent token is not a known AI token.
|
|
95
|
-
// Known long names
|
|
96
|
-
//
|
|
95
|
+
// Known long names classify as AI; empty or unknown tokens classify as non-AI
|
|
96
|
+
// (human).
|
|
97
97
|
export function isHumanAgent(agent: string): boolean {
|
|
98
98
|
return classifyAgent(agent).status !== 'ai';
|
|
99
99
|
}
|
|
@@ -122,10 +122,10 @@ function log(args: string[] = []): void {
|
|
|
122
122
|
try { scope = parseTaskScope(args); } catch (error) {
|
|
123
123
|
process.stderr.write(`ai task log: ${error instanceof Error ? error.message : String(error)}\n`); process.exitCode = 1; return;
|
|
124
124
|
}
|
|
125
|
-
if (scope.positionals.length >
|
|
126
|
-
process.stderr.write('ai task log: task ref
|
|
125
|
+
if (scope.positionals.length > 0) {
|
|
126
|
+
process.stderr.write('ai task log: positional task ref is not supported; use --task <ref> or -t <ref>\n'); process.exitCode = 1; return;
|
|
127
127
|
}
|
|
128
|
-
const resolved = resolveTaskContext(scope.taskRef
|
|
128
|
+
const resolved = resolveTaskContext(scope.taskRef);
|
|
129
129
|
if (!resolved.ok) {
|
|
130
130
|
process.stderr.write(`ai task log: ${resolved.message}\n`);
|
|
131
131
|
process.exitCode = 1;
|
|
@@ -146,7 +146,15 @@ function log(args: string[] = []): void {
|
|
|
146
146
|
return;
|
|
147
147
|
}
|
|
148
148
|
const steps = pairEntries(entries);
|
|
149
|
-
|
|
149
|
+
let humanDecisionCounts = new Map<ReviewStage, number>();
|
|
150
|
+
let ledgerDiagnostic: string | null = null;
|
|
151
|
+
try {
|
|
152
|
+
const ledger = parseLedgerDocument(content);
|
|
153
|
+
if (ledger.present) humanDecisionCounts = countHumanDecisionsByStage(ledger.rows as LedgerRow[]);
|
|
154
|
+
else ledgerDiagnostic = `${LEDGER_SECTION_MISSING_CODE}: ${LEDGER_SECTION_MISSING_MESSAGE}`;
|
|
155
|
+
} catch (error) {
|
|
156
|
+
ledgerDiagnostic = `LEDGER_DOCUMENT_INVALID: ${error instanceof Error ? error.message : String(error)}`;
|
|
157
|
+
}
|
|
150
158
|
const rows = steps.map((s, idx) => {
|
|
151
159
|
const stage = reviewStageForStep(s.step);
|
|
152
160
|
const note = stage
|
|
@@ -161,6 +169,10 @@ function log(args: string[] = []): void {
|
|
|
161
169
|
for (const line of formatTable(TABLE_HEADERS, rows, { zebra: Boolean(process.stdout.isTTY) })) {
|
|
162
170
|
process.stdout.write(`${line}\n`);
|
|
163
171
|
}
|
|
172
|
+
if (ledgerDiagnostic) {
|
|
173
|
+
process.stdout.write(`Ledger: unavailable [${ledgerDiagnostic}]\n`);
|
|
174
|
+
process.exitCode = 1;
|
|
175
|
+
}
|
|
164
176
|
process.stdout.write(`Total: ${steps.length} steps\n`);
|
|
165
177
|
}
|
|
166
178
|
|
|
@@ -2,12 +2,11 @@ import fs from 'node:fs';
|
|
|
2
2
|
import { parseTaskScope } from '../command-options.ts';
|
|
3
3
|
import { resolveTaskContext } from '../resolve-ref.ts';
|
|
4
4
|
|
|
5
|
-
const USAGE = `Usage: ai task show [
|
|
5
|
+
const USAGE = `Usage: ai task show [--task <ref> | -t <ref>]
|
|
6
6
|
|
|
7
7
|
Prints the task.md content for the matching task.
|
|
8
8
|
Omit the ref Resolve the unique active task for the current branch.
|
|
9
|
-
|
|
10
|
-
TASK-YYYYMMDD-HHMMSS Locates a task in active / blocked / completed / archive.
|
|
9
|
+
--task/-t <ref> Bare numeric short id, or a full TASK-YYYYMMDD-HHMMSS id.
|
|
11
10
|
`;
|
|
12
11
|
|
|
13
12
|
function show(args: string[] = []): void {
|
|
@@ -20,10 +19,10 @@ function show(args: string[] = []): void {
|
|
|
20
19
|
process.stderr.write(`ai task show: ${error instanceof Error ? error.message : String(error)}\n`);
|
|
21
20
|
process.exitCode = 1; return;
|
|
22
21
|
}
|
|
23
|
-
if (scope.positionals.length >
|
|
24
|
-
process.stderr.write('ai task show: task ref
|
|
22
|
+
if (scope.positionals.length > 0) {
|
|
23
|
+
process.stderr.write('ai task show: positional task ref is not supported; use --task <ref> or -t <ref>\n'); process.exitCode = 1; return;
|
|
25
24
|
}
|
|
26
|
-
const resolved = resolveTaskContext(scope.taskRef
|
|
25
|
+
const resolved = resolveTaskContext(scope.taskRef);
|
|
27
26
|
if (!resolved.ok) {
|
|
28
27
|
process.stderr.write(`ai task show: ${resolved.message}\n`);
|
|
29
28
|
process.exitCode = 1;
|
|
@@ -8,17 +8,17 @@ import { enumerateArtifacts, type Artifact } from '../artifacts.ts';
|
|
|
8
8
|
import { parseTaskFrontmatter, extractTitle, type Frontmatter } from '../frontmatter.ts';
|
|
9
9
|
import { loadShortIdByTaskId } from '../short-id.ts';
|
|
10
10
|
import { getOpenWorkflowWarnings, formatWorkflowWarningSummary, type WorkflowWarning } from '../workflow-warnings.ts';
|
|
11
|
-
import { parseActivityLog, pairEntries } from '../activity-log.ts';
|
|
11
|
+
import { parseActivityLog, pairEntries, startedBackedRows } from '../activity-log.ts';
|
|
12
12
|
import { readRun, type OrchestrationRun } from '../orchestration.ts';
|
|
13
13
|
import type { DelegationReceipt } from '../delegation-receipts.ts';
|
|
14
14
|
import { statusCard, type DisplayMessage } from '../../server/display.ts';
|
|
15
15
|
|
|
16
|
-
const USAGE = `Usage: ai task status [
|
|
16
|
+
const USAGE = `Usage: ai task status [--task <ref> | -t <ref>]
|
|
17
17
|
|
|
18
18
|
Prints an aggregated "health check" view for a task: header, metadata,
|
|
19
19
|
artifacts, workflow/runtime execution state, and git branch state.
|
|
20
|
-
Omit
|
|
21
|
-
<ref>
|
|
20
|
+
Omit the scope Resolve the unique active task for the current branch.
|
|
21
|
+
--task/-t <ref> Bare numeric short id, or a full TASK-YYYYMMDD-HHMMSS id.
|
|
22
22
|
|
|
23
23
|
Git rows are best-effort: a failed git call degrades that row to '-' without
|
|
24
24
|
failing the command.
|
|
@@ -186,7 +186,7 @@ function collectWorkflow(content: string, now: Date = new Date()): WorkflowInfo
|
|
|
186
186
|
return { state: 'unknown', step: DASH, agent: DASH, startedAt: DASH, doneAt: DASH, stale: DASH };
|
|
187
187
|
}
|
|
188
188
|
|
|
189
|
-
const rows = pairEntries(parsed.entries);
|
|
189
|
+
const rows = startedBackedRows(pairEntries(parsed.entries));
|
|
190
190
|
const latest = rows.at(-1);
|
|
191
191
|
if (!latest) {
|
|
192
192
|
return { state: 'unknown', step: DASH, agent: DASH, startedAt: DASH, doneAt: DASH, stale: DASH };
|
|
@@ -577,10 +577,10 @@ function status(args: string[] = []): void {
|
|
|
577
577
|
let model: StatusModel;
|
|
578
578
|
try {
|
|
579
579
|
const scope = parseTaskScope(args);
|
|
580
|
-
if (scope.positionals.length >
|
|
581
|
-
throw new Error('task ref
|
|
580
|
+
if (scope.positionals.length > 0) {
|
|
581
|
+
throw new Error('positional task ref is not supported; use --task <ref> or -t <ref>');
|
|
582
582
|
}
|
|
583
|
-
const resolved = resolveTaskContext(scope.taskRef
|
|
583
|
+
const resolved = resolveTaskContext(scope.taskRef);
|
|
584
584
|
if (!resolved.ok) throw new Error(resolved.message);
|
|
585
585
|
model = buildFromResolved({
|
|
586
586
|
taskId: resolved.taskId, taskDir: resolved.taskDir, taskMdPath: resolved.taskMdPath,
|