@fitlab-ai/agent-infra 0.8.4 → 0.9.0
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/bin/cli.ts +2 -2
- package/dist/bin/cli.js +2 -2
- package/dist/bin/internal-cli.js +98 -0
- package/dist/lib/decide.js +81 -90
- package/dist/lib/defaults.json +9 -0
- package/dist/lib/git/review-snapshot.js +79 -0
- package/dist/lib/git/workflow.js +101 -0
- package/dist/lib/init.js +5 -0
- package/dist/lib/internal/git-workflow.js +42 -0
- package/dist/lib/internal/platform-checks.js +119 -0
- package/dist/lib/internal/platform-comment.js +129 -0
- package/dist/lib/internal/platform-context.js +46 -0
- package/dist/lib/internal/platform-issue.js +142 -0
- package/dist/lib/internal/platform-pr.js +146 -0
- package/dist/lib/internal/release-workflow.js +217 -0
- package/dist/lib/internal/task-artifact.js +67 -0
- package/dist/lib/internal/task-context.js +43 -0
- package/dist/lib/internal/task-event.js +70 -0
- package/dist/lib/internal/task-ledger.js +114 -0
- package/dist/lib/internal/task-lifecycle.js +58 -0
- package/dist/lib/internal/task-short-id.js +83 -0
- package/dist/lib/internal/task-snapshot.js +47 -0
- package/dist/lib/internal/task-verify.js +50 -0
- package/dist/lib/internal/task-warning.js +74 -0
- package/dist/lib/platform/adapters.js +14 -0
- package/dist/lib/platform/context.js +146 -0
- package/dist/lib/platform/github-client.js +124 -0
- package/dist/lib/platform/issue-comments.js +409 -0
- package/dist/lib/platform/issue-metadata.js +183 -0
- package/dist/lib/platform/issues.js +617 -0
- package/dist/lib/platform/metadata-labels.js +28 -0
- package/dist/lib/platform/pr-checks.js +216 -0
- package/dist/lib/platform/pr-summary.js +88 -0
- package/dist/lib/platform/pull-request-metadata.js +38 -0
- package/dist/lib/platform/pull-requests.js +338 -0
- package/dist/lib/platform/releases.js +82 -0
- package/dist/lib/platform/types.js +22 -0
- package/dist/lib/platform/verification-required.js +78 -0
- package/dist/lib/platform/verification-sync.js +1014 -0
- package/dist/lib/platform/verification.js +6 -0
- package/dist/lib/release/channels.js +31 -0
- package/dist/lib/release/workflow.js +32 -0
- package/dist/lib/render.js +3 -2
- package/dist/lib/run/index.js +24 -7
- package/dist/lib/sandbox/capture.js +25 -3
- package/dist/lib/sandbox/commands/create.js +66 -26
- package/dist/lib/sandbox/commands/enter.js +34 -11
- package/dist/lib/sandbox/commands/list-running.js +10 -8
- package/dist/lib/sandbox/commands/show.js +2 -2
- package/dist/lib/sandbox/commands/start.js +53 -15
- package/dist/lib/sandbox/engine.js +33 -3
- package/dist/lib/sandbox/engines/colima.js +2 -2
- package/dist/lib/sandbox/index.js +6 -6
- package/dist/lib/sandbox/mounts.js +36 -0
- package/dist/lib/sandbox/recovery.js +562 -0
- package/dist/lib/sandbox/runtimes/base.dockerfile +4 -0
- package/dist/lib/sandbox/task-resolver.js +5 -1
- package/dist/lib/sandbox/tools.js +19 -0
- package/dist/lib/server/daemon.js +9 -0
- package/dist/lib/server/process-control.js +66 -73
- package/dist/lib/server/process-state.js +168 -0
- package/dist/lib/server/protocol.js +5 -5
- package/dist/lib/task/activity-log.js +61 -0
- package/dist/lib/task/artifact-lifecycle.js +427 -0
- package/dist/lib/task/command-options.js +30 -0
- package/dist/lib/task/commands/cat.js +36 -6
- package/dist/lib/task/commands/decisions.js +80 -46
- package/dist/lib/task/commands/files.js +21 -7
- package/dist/lib/task/commands/grep.js +55 -7
- package/dist/lib/task/commands/issue-body.js +23 -14
- package/dist/lib/task/commands/log.js +27 -70
- package/dist/lib/task/commands/show.js +20 -7
- package/dist/lib/task/commands/status.js +18 -8
- package/dist/lib/task/decision-intents.js +154 -0
- package/dist/lib/task/decision-items.js +53 -0
- package/dist/lib/task/events.js +318 -0
- package/dist/lib/task/frontmatter.js +159 -1
- package/dist/lib/task/implementation-inputs.js +117 -0
- package/dist/lib/task/index.js +12 -9
- package/dist/lib/task/issue-form.js +19 -6
- package/dist/lib/task/ledger-intents.js +185 -0
- package/dist/lib/task/ledger.js +65 -35
- package/dist/lib/task/lifecycle.js +484 -0
- package/dist/lib/task/resolve-ref.js +152 -32
- package/dist/lib/task/review-artifacts.js +101 -0
- package/dist/lib/task/review-fingerprint.js +46 -0
- package/dist/lib/task/sections.js +358 -4
- package/dist/lib/task/short-id.js +292 -7
- package/dist/lib/task/snapshot.js +95 -0
- package/dist/lib/task/verification-checks.js +8 -0
- package/dist/lib/task/verification-config.js +14 -0
- package/dist/lib/task/verification-engine.js +906 -0
- package/dist/lib/task/verification-review.js +3 -0
- package/dist/lib/task/verification-types.js +2 -0
- package/dist/lib/task/verification.js +113 -0
- package/dist/lib/task/workflow-warning-intents.js +131 -0
- package/dist/lib/task/workflow-warnings.js +10 -78
- package/dist/lib/task/write.js +241 -0
- package/dist/lib/update.js +2 -0
- package/lib/decide.ts +57 -97
- package/lib/defaults.json +9 -0
- package/lib/git/review-snapshot.ts +73 -0
- package/lib/git/workflow.ts +101 -0
- package/lib/init.ts +9 -0
- package/lib/internal/git-workflow.ts +37 -0
- package/lib/internal/platform-checks.ts +101 -0
- package/lib/internal/platform-comment.ts +99 -0
- package/lib/internal/platform-context.ts +33 -0
- package/lib/internal/platform-issue.ts +116 -0
- package/lib/internal/platform-pr.ts +119 -0
- package/lib/internal/release-workflow.ts +186 -0
- package/lib/internal/task-artifact.ts +47 -0
- package/lib/internal/task-context.ts +35 -0
- package/lib/internal/task-event.ts +51 -0
- package/lib/internal/task-ledger.ts +86 -0
- package/lib/internal/task-lifecycle.ts +41 -0
- package/lib/internal/task-short-id.ts +55 -0
- package/lib/internal/task-snapshot.ts +32 -0
- package/lib/internal/task-verify.ts +33 -0
- package/lib/internal/task-warning.ts +50 -0
- package/lib/platform/adapters.ts +30 -0
- package/lib/platform/context.ts +164 -0
- package/lib/platform/github-client.ts +146 -0
- package/lib/platform/issue-comments.ts +479 -0
- package/lib/platform/issue-metadata.ts +250 -0
- package/lib/platform/issues.ts +691 -0
- package/lib/platform/metadata-labels.ts +33 -0
- package/lib/platform/pr-checks.ts +246 -0
- package/lib/platform/pr-summary.ts +90 -0
- package/lib/platform/pull-request-metadata.ts +69 -0
- package/lib/platform/pull-requests.ts +380 -0
- package/lib/platform/releases.ts +71 -0
- package/lib/platform/types.ts +74 -0
- package/lib/platform/verification-required.ts +83 -0
- package/{templates/.agents/scripts/platform-adapters/platform-sync.github.js → lib/platform/verification-sync.ts} +221 -363
- package/lib/platform/verification.ts +11 -0
- package/lib/release/channels.ts +30 -0
- package/lib/release/workflow.ts +31 -0
- package/lib/render.ts +3 -2
- package/lib/run/index.ts +25 -7
- package/lib/sandbox/capture.ts +29 -3
- package/lib/sandbox/commands/create.ts +75 -28
- package/lib/sandbox/commands/enter.ts +38 -11
- package/lib/sandbox/commands/list-running.ts +10 -8
- package/lib/sandbox/commands/show.ts +2 -2
- package/lib/sandbox/commands/start.ts +50 -16
- package/lib/sandbox/engine.ts +37 -3
- package/lib/sandbox/engines/colima.ts +2 -2
- package/lib/sandbox/index.ts +6 -6
- package/lib/sandbox/mounts.ts +55 -0
- package/lib/sandbox/recovery.ts +828 -0
- package/lib/sandbox/runtimes/base.dockerfile +4 -0
- package/lib/sandbox/task-resolver.ts +5 -1
- package/lib/sandbox/tools.ts +31 -0
- package/lib/server/daemon.ts +9 -0
- package/lib/server/process-control.ts +70 -71
- package/lib/server/process-state.ts +183 -0
- package/lib/server/protocol.ts +5 -5
- package/lib/task/activity-log.ts +62 -0
- package/lib/task/artifact-lifecycle.ts +484 -0
- package/lib/task/command-options.ts +32 -0
- package/lib/task/commands/cat.ts +22 -9
- package/lib/task/commands/decisions.ts +49 -47
- package/lib/task/commands/files.ts +14 -6
- package/lib/task/commands/grep.ts +34 -7
- package/lib/task/commands/issue-body.ts +16 -16
- package/lib/task/commands/log.ts +17 -70
- package/lib/task/commands/show.ts +14 -6
- package/lib/task/commands/status.ts +17 -7
- package/lib/task/decision-intents.ts +163 -0
- package/lib/task/decision-items.ts +64 -0
- package/lib/task/events.ts +320 -0
- package/lib/task/frontmatter.ts +202 -2
- package/lib/task/implementation-inputs.ts +137 -0
- package/lib/task/index.ts +12 -9
- package/lib/task/issue-form.ts +20 -6
- package/lib/task/ledger-intents.ts +201 -0
- package/lib/task/ledger.ts +77 -31
- package/lib/task/lifecycle.ts +458 -0
- package/lib/task/resolve-ref.ts +197 -36
- package/{templates/.agents/scripts/lib/review-artifacts.js → lib/task/review-artifacts.ts} +11 -12
- package/{templates/.agents/scripts/lib/post-review-commit.js → lib/task/review-fingerprint.ts} +20 -10
- package/lib/task/sections.ts +486 -4
- package/lib/task/short-id.ts +403 -9
- package/lib/task/snapshot.ts +143 -0
- package/lib/task/verification-checks.ts +9 -0
- package/lib/task/verification-config.ts +20 -0
- package/{templates/.agents/scripts/validate-artifact.js → lib/task/verification-engine.ts} +257 -451
- package/lib/task/verification-review.ts +9 -0
- package/lib/task/verification-types.ts +29 -0
- package/lib/task/verification.ts +156 -0
- package/lib/task/workflow-warning-intents.ts +142 -0
- package/lib/task/workflow-warnings.ts +10 -78
- package/lib/task/write.ts +468 -0
- package/lib/update.ts +6 -0
- package/package.json +5 -2
- package/templates/.agents/README.en.md +6 -3
- package/templates/.agents/README.zh-CN.md +6 -3
- package/templates/.agents/rules/README.en.md +6 -5
- package/templates/.agents/rules/README.zh-CN.md +6 -5
- package/templates/.agents/rules/create-issue.en.md +1 -1
- package/templates/.agents/rules/create-issue.github.en.md +5 -184
- package/templates/.agents/rules/create-issue.github.zh-CN.md +12 -178
- package/templates/.agents/rules/create-issue.zh-CN.md +1 -1
- package/templates/.agents/rules/human-decision-context.en.md +36 -0
- package/templates/.agents/rules/human-decision-context.zh-CN.md +36 -0
- package/templates/.agents/rules/issue-fields.github.en.md +4 -148
- package/templates/.agents/rules/issue-fields.github.zh-CN.md +9 -144
- package/templates/.agents/rules/issue-pr-commands.en.md +43 -3
- package/templates/.agents/rules/issue-pr-commands.github.en.md +15 -220
- package/templates/.agents/rules/issue-pr-commands.github.zh-CN.md +23 -213
- package/templates/.agents/rules/issue-pr-commands.zh-CN.md +45 -3
- package/templates/.agents/rules/issue-sync.en.md +1 -1
- package/templates/.agents/rules/issue-sync.github.en.md +14 -301
- package/templates/.agents/rules/issue-sync.github.zh-CN.md +36 -287
- package/templates/.agents/rules/issue-sync.zh-CN.md +1 -1
- package/templates/.agents/rules/milestone-inference.en.md +1 -1
- package/templates/.agents/rules/milestone-inference.github.en.md +7 -119
- package/templates/.agents/rules/milestone-inference.github.zh-CN.md +8 -108
- package/templates/.agents/rules/milestone-inference.zh-CN.md +1 -1
- package/templates/.agents/rules/next-step-output.en.md +12 -11
- package/templates/.agents/rules/next-step-output.zh-CN.md +12 -11
- package/templates/.agents/rules/no-mid-flow-questions.en.md +3 -3
- package/templates/.agents/rules/no-mid-flow-questions.zh-CN.md +3 -3
- package/templates/.agents/rules/pr-checks-commands.en.md +16 -3
- package/templates/.agents/rules/pr-checks-commands.github.en.md +10 -54
- package/templates/.agents/rules/pr-checks-commands.github.zh-CN.md +19 -47
- package/templates/.agents/rules/pr-checks-commands.zh-CN.md +30 -3
- package/templates/.agents/rules/pr-sync.en.md +30 -3
- package/templates/.agents/rules/pr-sync.github.en.md +12 -115
- package/templates/.agents/rules/pr-sync.github.zh-CN.md +26 -104
- package/templates/.agents/rules/pr-sync.zh-CN.md +43 -3
- package/templates/.agents/rules/review-handshake.en.md +13 -9
- package/templates/.agents/rules/review-handshake.zh-CN.md +13 -9
- package/templates/.agents/rules/task-management.en.md +11 -2
- package/templates/.agents/rules/task-management.zh-CN.md +11 -3
- package/templates/.agents/rules/task-short-id.en.md +25 -29
- package/templates/.agents/rules/task-short-id.zh-CN.md +20 -23
- package/templates/.agents/scripts/lib/agent-infra-package.js +141 -0
- package/templates/.agents/scripts/task-short-id.js +71 -533
- package/templates/.agents/skills/analyze-task/SKILL.en.md +22 -55
- package/templates/.agents/skills/analyze-task/SKILL.zh-CN.md +26 -59
- package/templates/.agents/skills/analyze-task/config/verify.en.json +1 -3
- package/templates/.agents/skills/analyze-task/config/verify.zh-CN.json +1 -3
- package/templates/.agents/skills/block-task/SKILL.en.md +21 -47
- package/templates/.agents/skills/block-task/SKILL.zh-CN.md +23 -47
- package/templates/.agents/skills/block-task/config/verify.json +1 -2
- package/templates/.agents/skills/cancel-task/SKILL.en.md +16 -45
- package/templates/.agents/skills/cancel-task/SKILL.zh-CN.md +16 -45
- package/templates/.agents/skills/cancel-task/config/verify.json +1 -2
- package/templates/.agents/skills/check-task/SKILL.en.md +6 -3
- package/templates/.agents/skills/check-task/SKILL.zh-CN.md +6 -3
- package/templates/.agents/skills/close-codescan/SKILL.en.md +6 -24
- package/templates/.agents/skills/close-codescan/SKILL.zh-CN.md +6 -24
- package/templates/.agents/skills/close-dependabot/SKILL.en.md +6 -24
- package/templates/.agents/skills/close-dependabot/SKILL.zh-CN.md +6 -24
- package/templates/.agents/skills/code-task/SKILL.en.md +22 -35
- package/templates/.agents/skills/code-task/SKILL.zh-CN.md +28 -44
- package/templates/.agents/skills/code-task/config/verify.en.json +3 -3
- package/templates/.agents/skills/code-task/config/verify.zh-CN.json +3 -3
- package/templates/.agents/skills/code-task/reference/dual-mode.en.md +13 -9
- package/templates/.agents/skills/code-task/reference/dual-mode.zh-CN.md +13 -9
- package/templates/.agents/skills/code-task/reference/fix-mode.en.md +1 -1
- package/templates/.agents/skills/code-task/reference/fix-mode.zh-CN.md +1 -1
- package/templates/.agents/skills/code-task/reference/report-template.en.md +11 -1
- package/templates/.agents/skills/code-task/reference/report-template.zh-CN.md +11 -1
- package/templates/.agents/skills/commit/SKILL.en.md +18 -14
- package/templates/.agents/skills/commit/SKILL.zh-CN.md +18 -14
- package/templates/.agents/skills/commit/config/verify.json +1 -2
- package/templates/.agents/skills/commit/reference/commit-message.en.md +1 -11
- package/templates/.agents/skills/commit/reference/commit-message.zh-CN.md +1 -11
- package/templates/.agents/skills/commit/reference/issue-metadata-sync.en.md +4 -8
- package/templates/.agents/skills/commit/reference/issue-metadata-sync.zh-CN.md +4 -8
- package/templates/.agents/skills/commit/reference/pr-summary-sync.en.md +6 -18
- package/templates/.agents/skills/commit/reference/pr-summary-sync.zh-CN.md +5 -17
- package/templates/.agents/skills/commit/reference/task-status-update.en.md +42 -2
- package/templates/.agents/skills/commit/reference/task-status-update.zh-CN.md +42 -2
- package/templates/.agents/skills/complete-manual-validation/SKILL.en.md +13 -36
- package/templates/.agents/skills/complete-manual-validation/SKILL.zh-CN.md +13 -36
- package/templates/.agents/skills/complete-manual-validation/config/verify.en.json +1 -3
- package/templates/.agents/skills/complete-manual-validation/config/verify.zh-CN.json +1 -3
- package/templates/.agents/skills/complete-manual-validation/reference/summary-update.en.md +10 -54
- package/templates/.agents/skills/complete-manual-validation/reference/summary-update.zh-CN.md +10 -79
- package/templates/.agents/skills/complete-task/SKILL.en.md +59 -63
- package/templates/.agents/skills/complete-task/SKILL.zh-CN.md +59 -63
- package/templates/.agents/skills/complete-task/config/verify.en.json +11 -6
- package/templates/.agents/skills/complete-task/config/verify.zh-CN.json +11 -6
- package/templates/.agents/skills/create-pr/SKILL.en.md +19 -44
- package/templates/.agents/skills/create-pr/SKILL.zh-CN.md +19 -43
- package/templates/.agents/skills/create-pr/config/verify.json +1 -2
- package/templates/.agents/skills/create-pr/reference/comment-publish.en.md +8 -12
- package/templates/.agents/skills/create-pr/reference/comment-publish.zh-CN.md +7 -11
- package/templates/.agents/skills/create-task/SKILL.en.md +12 -13
- package/templates/.agents/skills/create-task/SKILL.zh-CN.md +12 -13
- package/templates/.agents/skills/create-task/config/verify.json +1 -2
- package/templates/.agents/skills/import-codescan/SKILL.en.md +2 -2
- package/templates/.agents/skills/import-codescan/SKILL.zh-CN.md +2 -2
- package/templates/.agents/skills/import-codescan/config/verify.json +1 -2
- package/templates/.agents/skills/import-dependabot/SKILL.en.md +2 -2
- package/templates/.agents/skills/import-dependabot/SKILL.zh-CN.md +2 -2
- package/templates/.agents/skills/import-dependabot/config/verify.json +1 -2
- package/templates/.agents/skills/import-issue/SKILL.en.md +9 -13
- package/templates/.agents/skills/import-issue/SKILL.zh-CN.md +10 -14
- package/templates/.agents/skills/import-issue/config/verify.json +1 -2
- package/templates/.agents/skills/init-milestones/SKILL.en.md +2 -2
- package/templates/.agents/skills/init-milestones/SKILL.zh-CN.md +2 -2
- package/templates/.agents/skills/init-milestones/scripts/init-milestones.github.sh +5 -4
- package/templates/.agents/skills/plan-task/SKILL.en.md +17 -42
- package/templates/.agents/skills/plan-task/SKILL.zh-CN.md +22 -49
- package/templates/.agents/skills/plan-task/config/verify.en.json +1 -3
- package/templates/.agents/skills/plan-task/config/verify.zh-CN.json +1 -3
- package/templates/.agents/skills/post-release/SKILL.en.md +11 -81
- package/templates/.agents/skills/post-release/SKILL.zh-CN.md +8 -78
- package/templates/.agents/skills/refine-title/SKILL.en.md +1 -1
- package/templates/.agents/skills/refine-title/SKILL.zh-CN.md +1 -1
- package/templates/.agents/skills/release/SKILL.en.md +16 -163
- package/templates/.agents/skills/release/SKILL.zh-CN.md +15 -162
- package/templates/.agents/skills/restore-task/SKILL.en.md +11 -29
- package/templates/.agents/skills/restore-task/SKILL.zh-CN.md +11 -29
- package/templates/.agents/skills/restore-task/config/verify.json +1 -2
- package/templates/.agents/skills/review-analysis/SKILL.en.md +13 -25
- package/templates/.agents/skills/review-analysis/SKILL.zh-CN.md +13 -33
- package/templates/.agents/skills/review-analysis/config/verify.en.json +3 -4
- package/templates/.agents/skills/review-analysis/config/verify.zh-CN.json +3 -4
- package/templates/.agents/skills/review-analysis/reference/output-templates.en.md +9 -12
- package/templates/.agents/skills/review-analysis/reference/output-templates.zh-CN.md +9 -12
- package/templates/.agents/skills/review-analysis/reference/report-template.en.md +9 -2
- package/templates/.agents/skills/review-analysis/reference/report-template.zh-CN.md +9 -2
- package/templates/.agents/skills/review-analysis/reference/review-criteria.en.md +7 -0
- package/templates/.agents/skills/review-analysis/reference/review-criteria.zh-CN.md +7 -0
- package/templates/.agents/skills/review-code/SKILL.en.md +22 -36
- package/templates/.agents/skills/review-code/SKILL.zh-CN.md +23 -41
- package/templates/.agents/skills/review-code/config/verify.en.json +5 -5
- package/templates/.agents/skills/review-code/config/verify.zh-CN.json +5 -5
- package/templates/.agents/skills/review-code/reference/output-templates.en.md +56 -18
- package/templates/.agents/skills/review-code/reference/output-templates.zh-CN.md +56 -18
- package/templates/.agents/skills/review-code/reference/report-template.en.md +12 -4
- package/templates/.agents/skills/review-code/reference/report-template.zh-CN.md +12 -4
- package/templates/.agents/skills/review-code/reference/review-criteria.en.md +7 -0
- package/templates/.agents/skills/review-code/reference/review-criteria.zh-CN.md +7 -0
- package/templates/.agents/skills/review-plan/SKILL.en.md +13 -25
- package/templates/.agents/skills/review-plan/SKILL.zh-CN.md +13 -33
- package/templates/.agents/skills/review-plan/config/verify.en.json +3 -4
- package/templates/.agents/skills/review-plan/config/verify.zh-CN.json +3 -4
- package/templates/.agents/skills/review-plan/reference/output-templates.en.md +9 -12
- package/templates/.agents/skills/review-plan/reference/output-templates.zh-CN.md +9 -12
- package/templates/.agents/skills/review-plan/reference/report-template.en.md +9 -2
- package/templates/.agents/skills/review-plan/reference/report-template.zh-CN.md +9 -2
- package/templates/.agents/skills/review-plan/reference/review-criteria.en.md +7 -0
- package/templates/.agents/skills/review-plan/reference/review-criteria.zh-CN.md +7 -0
- package/templates/.agents/skills/update-agent-infra/SKILL.en.md +6 -3
- package/templates/.agents/skills/update-agent-infra/SKILL.zh-CN.md +6 -3
- package/templates/.agents/skills/update-agent-infra/scripts/sync-templates.js +177 -151
- package/templates/.agents/skills/watch-pr/SKILL.en.md +24 -14
- package/templates/.agents/skills/watch-pr/SKILL.zh-CN.md +25 -15
- package/templates/.agents/skills/watch-pr/config/verify.json +1 -2
- package/templates/.agents/skills/watch-pr/reference/monitor-and-heal.en.md +2 -2
- package/templates/.agents/skills/watch-pr/reference/monitor-and-heal.zh-CN.md +2 -2
- package/templates/.agents/templates/task.en.md +6 -1
- package/templates/.agents/templates/task.zh-CN.md +6 -1
- 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 -0
- package/templates/.claude/commands/commit.zh-CN.md +1 -0
- 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/watch-pr.en.md +1 -1
- package/templates/.claude/commands/watch-pr.zh-CN.md +1 -1
- package/templates/.gemini/commands/_project_/analyze-task.en.toml +2 -0
- package/templates/.gemini/commands/_project_/analyze-task.zh-CN.toml +2 -0
- package/templates/.gemini/commands/_project_/block-task.en.toml +2 -0
- package/templates/.gemini/commands/_project_/block-task.zh-CN.toml +2 -0
- package/templates/.gemini/commands/_project_/cancel-task.en.toml +2 -0
- package/templates/.gemini/commands/_project_/cancel-task.zh-CN.toml +2 -0
- package/templates/.gemini/commands/_project_/check-task.en.toml +2 -0
- package/templates/.gemini/commands/_project_/check-task.zh-CN.toml +2 -0
- package/templates/.gemini/commands/_project_/code-task.en.toml +2 -0
- package/templates/.gemini/commands/_project_/code-task.zh-CN.toml +2 -0
- package/templates/.gemini/commands/_project_/commit.en.toml +4 -0
- package/templates/.gemini/commands/_project_/commit.zh-CN.toml +4 -0
- package/templates/.gemini/commands/_project_/complete-manual-validation.en.toml +2 -0
- package/templates/.gemini/commands/_project_/complete-manual-validation.zh-CN.toml +2 -0
- package/templates/.gemini/commands/_project_/complete-task.en.toml +2 -0
- package/templates/.gemini/commands/_project_/complete-task.zh-CN.toml +2 -0
- package/templates/.gemini/commands/_project_/create-pr.en.toml +2 -0
- package/templates/.gemini/commands/_project_/create-pr.zh-CN.toml +2 -0
- package/templates/.gemini/commands/_project_/plan-task.en.toml +2 -0
- package/templates/.gemini/commands/_project_/plan-task.zh-CN.toml +2 -0
- package/templates/.gemini/commands/_project_/review-analysis.en.toml +2 -0
- package/templates/.gemini/commands/_project_/review-analysis.zh-CN.toml +2 -0
- package/templates/.gemini/commands/_project_/review-code.en.toml +2 -0
- package/templates/.gemini/commands/_project_/review-code.zh-CN.toml +2 -0
- package/templates/.gemini/commands/_project_/review-plan.en.toml +2 -0
- package/templates/.gemini/commands/_project_/review-plan.zh-CN.toml +2 -0
- package/templates/.gemini/commands/_project_/watch-pr.en.toml +2 -0
- package/templates/.gemini/commands/_project_/watch-pr.zh-CN.toml +2 -0
- package/templates/.git-hooks/check-large-files.cjs +92 -0
- package/templates/.git-hooks/check-version-format.sh +5 -1
- package/templates/.git-hooks/pre-commit +1 -0
- package/templates/.opencode/commands/analyze-task.en.md +1 -1
- package/templates/.opencode/commands/analyze-task.zh-CN.md +1 -1
- package/templates/.opencode/commands/check-task.en.md +1 -1
- package/templates/.opencode/commands/check-task.zh-CN.md +1 -1
- package/templates/.opencode/commands/code-task.en.md +1 -1
- package/templates/.opencode/commands/code-task.zh-CN.md +1 -1
- package/templates/.opencode/commands/commit.en.md +2 -0
- package/templates/.opencode/commands/commit.zh-CN.md +2 -0
- package/templates/.opencode/commands/complete-task.en.md +1 -1
- package/templates/.opencode/commands/complete-task.zh-CN.md +1 -1
- package/templates/.opencode/commands/plan-task.en.md +1 -1
- package/templates/.opencode/commands/plan-task.zh-CN.md +1 -1
- package/templates/.opencode/commands/review-analysis.en.md +1 -1
- package/templates/.opencode/commands/review-analysis.zh-CN.md +1 -1
- package/templates/.opencode/commands/review-code.en.md +1 -1
- package/templates/.opencode/commands/review-code.zh-CN.md +1 -1
- package/templates/.opencode/commands/review-plan.en.md +1 -1
- package/templates/.opencode/commands/review-plan.zh-CN.md +1 -1
- package/templates/.agents/scripts/platform-adapters/platform-sync.js +0 -13
- package/templates/.agents/scripts/review-diff-fingerprint.js +0 -99
- package/templates/.agents/scripts/workflow-warnings.js +0 -290
- package/templates/.agents/skills/code-task/scripts/detect-mode.js +0 -257
- package/templates/.agents/skills/release/scripts/manage-milestones.github.sh +0 -80
- package/templates/.agents/skills/release/scripts/manage-milestones.sh +0 -6
|
@@ -1,191 +1,12 @@
|
|
|
1
1
|
# Issue Creation
|
|
2
2
|
|
|
3
|
-
After `create-task` writes
|
|
4
|
-
|
|
5
|
-
## Boundary
|
|
6
|
-
|
|
7
|
-
- Issue title and body must come from `task.md` only
|
|
8
|
-
- Do not read `analysis.md`, `review-analysis.md`, `plan.md`, `review-plan.md`, `code.md`, or any review-code artifact
|
|
9
|
-
- Persistent outputs are limited to the remote Issue and the `issue_number` written back to `task.md`
|
|
10
|
-
- If Issue creation fails, do not roll back `task.md`; the current task remains valid for the workflow, and the user can later manually fill `issue_number` so other skills' cascade sync takes over
|
|
11
|
-
|
|
12
|
-
## Steps
|
|
13
|
-
|
|
14
|
-
### 1. Verify Prerequisites
|
|
15
|
-
|
|
16
|
-
- `.agents/workspace/active/{task-id}/task.md` must exist
|
|
17
|
-
- Read `.agents/rules/issue-pr-commands.md` first and run its authentication and platform detection commands to confirm `gh auth status` and the current repository are usable
|
|
18
|
-
- Read `.agents/rules/issue-sync.md` first and complete `upstream_repo`, `has_triage`, and `has_push` detection; reuse these variables for every later `gh issue` and repo-level `gh api` call
|
|
19
|
-
- If `task.md` already has a non-empty, non-`N/A` `issue_number`, halt the cascade immediately: return "Task already linked to Issue #{n}, skipping creation" to `create-task` and let it decide how to continue
|
|
20
|
-
|
|
21
|
-
### 2. Extract Task Information
|
|
22
|
-
|
|
23
|
-
Pull the following from `task.md`:
|
|
24
|
-
|
|
25
|
-
- Task title (the first `# ` heading, stripped of `任务:` / `Task:` prefixes) — used to build the Issue title
|
|
26
|
-
- frontmatter fields `type` and (optionally) `milestone`
|
|
27
|
-
|
|
28
|
-
> The Issue **body** is not extracted by hand here. It is generated deterministically in §3 by the `ai task issue-body` command from the `## 描述` / `## 需求` sections; callers must not assemble it themselves.
|
|
29
|
-
|
|
30
|
-
Build the Issue title:
|
|
31
|
-
|
|
32
|
-
| task.md `type` | Conventional Commits type |
|
|
33
|
-
|---|---|
|
|
34
|
-
| `feature` | `feat` |
|
|
35
|
-
| `bugfix`, `bug` | `fix` |
|
|
36
|
-
| `refactor`, `refactoring` | `refactor` |
|
|
37
|
-
| `docs`, `documentation` | `docs` |
|
|
38
|
-
| `chore`, `task`, others | `chore` |
|
|
39
|
-
|
|
40
|
-
Scope inference: read known module names from `.agents/.airc.json`'s `labels.in` field, then semantically match them against the task title and description; omit `scope` when there is no clear hit. Final title: `{cc_type}({scope}): {task_title}` or `{cc_type}: {task_title}` (preserve the task title verbatim — do not translate or rewrite).
|
|
41
|
-
|
|
42
|
-
### 3. Build the Issue Body
|
|
43
|
-
|
|
44
|
-
> **Mechanization boundary (mandatory)**: the Issue body is always produced deterministically by the `ai task issue-body` command; callers only pass the command's stdout to `gh issue create` via `--body-file` and must **not** assemble, rewrite, or truncate the body themselves. The command emits only the task title / `## 描述` / `## 需求` content; every other task.md scaffolding section never enters the body.
|
|
45
|
-
|
|
46
|
-
Issue Form detection: follow the "Issue Template Detection" section in `.agents/rules/issue-pr-commands.md` to scan `.github/ISSUE_TEMPLATE/*.yml` (excluding `config.yml`).
|
|
47
|
-
|
|
48
|
-
#### Scenario A: A matching template was detected
|
|
49
|
-
|
|
50
|
-
Pick the form whose `name` (or filename) best matches the task type (e.g., a task with `type: bugfix` prefers a form whose name contains `bug`); if no match, fall back to a generic form like `other.yml`; if none, take the first form in the directory.
|
|
51
|
-
|
|
52
|
-
Once the form file `{form-path}` is chosen, let the command render the final body from that Issue Form and write it to the body file `{body-file}` for §5:
|
|
53
|
-
|
|
54
|
-
```bash
|
|
55
|
-
ai task issue-body {task-id} --template "{form-path}" > "{body-file}"
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
The command skips `markdown` / `dropdown` / `checkboxes` fields and, for `input` / `textarea` fields, uses `attributes.label` as the heading and deterministically fills the task title / description / requirements by field `id`, writing `N/A` for fields with no reliable source (the field mapping table is the single source of truth inside the command and is not restated here). When the command exits non-zero (missing file / invalid YAML / no `body`), regenerate `{body-file}` with the Scenario B command instead.
|
|
59
|
-
|
|
60
|
-
#### Scenario B: No template, or template parsing failed
|
|
61
|
-
|
|
62
|
-
Let the command emit the default body (only `## 描述` + `## 需求`, checkbox text preserved verbatim, missing sections filled with `N/A`) into `{body-file}`:
|
|
63
|
-
|
|
64
|
-
```bash
|
|
65
|
-
ai task issue-body {task-id} > "{body-file}"
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
#### Red line: never use the entire task.md as the body
|
|
69
|
-
|
|
70
|
-
In both Scenario A and B, the body may only come from `ai task issue-body` stdout and contains **only the description + requirements content** (Scenario A is the equivalent content mapped onto template fields).
|
|
71
|
-
|
|
72
|
-
Wrong example (❌ forbidden): pasting the entire task.md — including scaffolding sections such as `## 分析` / `## 设计` / `## 实现备注` / `## 审查反馈` / `## 审查分歧账本` / `## 人工裁决` / `## 活动日志` / `## 完成检查清单` and `#XXX` placeholders — directly as the Issue body. Those sections only go to the `sync-issue:{task-id}:task` comment, never the body.
|
|
73
|
-
|
|
74
|
-
### 4. Resolve labels / Issue Type / milestone
|
|
75
|
-
|
|
76
|
-
#### labels (rough pass)
|
|
77
|
-
|
|
78
|
-
- Call `gh api "repos/$upstream_repo/labels?per_page=100" --jq '.[].name'` to fetch the actual labels in the repo (cache as a set)
|
|
79
|
-
- Pick the "expected type label" using the mapping below, keeping only those that exist in the repo set:
|
|
80
|
-
|
|
81
|
-
| task.md `type` | label |
|
|
82
|
-
|---|---|
|
|
83
|
-
| `bug`, `bugfix` | `type: bug` |
|
|
84
|
-
| `feature` | `type: feature` |
|
|
85
|
-
| `enhancement` | `type: enhancement` |
|
|
86
|
-
| `docs`, `documentation` | `type: documentation` |
|
|
87
|
-
| `dependency-upgrade` | `type: dependency-upgrade` |
|
|
88
|
-
| `task`, `chore` | `type: task` |
|
|
89
|
-
| `refactor`, `refactoring` | `type: enhancement` |
|
|
90
|
-
| others | skip |
|
|
91
|
-
|
|
92
|
-
- `in:` labels (rough pass — when in doubt, leave it out): semantically match the task title and description against module names from `labels.in`; explicit mention or strong implication → add `in: {module}`; vague or uncertain → skip. `in:` labels also require the label to actually exist in the repo.
|
|
93
|
-
|
|
94
|
-
If the final label set is empty, omit the `--label` argument.
|
|
95
|
-
|
|
96
|
-
#### Issue Type fallback
|
|
97
|
-
|
|
98
|
-
| task.md `type` | Issue Type |
|
|
99
|
-
|---|---|
|
|
100
|
-
| `bug`, `bugfix` | `Bug` |
|
|
101
|
-
| `feature`, `enhancement` | `Feature` |
|
|
102
|
-
| `task`, `documentation`, `dependency-upgrade`, `chore`, `docs`, `refactor`, `refactoring`, others | `Task` |
|
|
103
|
-
|
|
104
|
-
When applying the Issue Type, follow the "Set Issue Type" command in `.agents/rules/issue-pr-commands.md`; only when the owner type is `Organization`, first call `gh api orgs/{owner}/issue-types` to list the org's actually available Types, and only set the inferred value when it is present in that list. User repositories, failed owner type probes, and failed writes are non-blocking.
|
|
105
|
-
|
|
106
|
-
#### milestone
|
|
107
|
-
|
|
108
|
-
**Mandatory; do not skip.** This section expands `.agents/rules/milestone-inference.md` Phase 1 in place and keeps the same semantics; do not treat it as optional inference.
|
|
109
|
-
|
|
110
|
-
Select the milestone using these numbered steps, with priority strictly aligned to Phase 1:
|
|
111
|
-
|
|
112
|
-
1. If `has_triage=false`: omit `--milestone` immediately and skip this section.
|
|
113
|
-
2. List all open milestones in the repository:
|
|
114
|
-
```bash
|
|
115
|
-
gh api "repos/$upstream_repo/milestones?state=open&per_page=100" \
|
|
116
|
-
--jq '.[].title'
|
|
117
|
-
```
|
|
118
|
-
3. If task.md frontmatter explicitly provides a `milestone` field and that value appears in the step 2 list: use that value directly as `{milestone-arg}` and skip steps 4 / 5.
|
|
119
|
-
4. Filter the step 2 result with `^[0-9]+\.[0-9]+\.x$`.
|
|
120
|
-
- Non-empty: sort by major and minor numerically, then choose the smallest release line as `{milestone-arg}`.
|
|
121
|
-
5. If step 4 has no candidates: fall back to `General Backlog`.
|
|
122
|
-
- `General Backlog` exists in the step 2 result: use that milestone.
|
|
123
|
-
- `General Backlog` does not exist: omit `--milestone` only in this case.
|
|
124
|
-
6. If the step 2 `gh api` call fails (network / authentication error): handle it as "no candidates" and continue to step 5.
|
|
125
|
-
|
|
126
|
-
When a milestone is selected, pass the release line (or `General Backlog` or the explicit task.md value) as `{milestone-arg}` to the `gh issue create` command in step 5; keep the expansion rule at the end of §5 unchanged.
|
|
127
|
-
|
|
128
|
-
### 5. Call the GitHub CLI to Create the Issue
|
|
129
|
-
|
|
130
|
-
Run the "Create Issue" command from `.agents/rules/issue-pr-commands.md`; always use the `{body-file}` produced in §3, overriding the generic command's `--body`:
|
|
3
|
+
After `create-task` writes task.md, create and initialize the Issue through declarative internal intents:
|
|
131
4
|
|
|
132
5
|
```bash
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
--body-file "{body-file}" \
|
|
136
|
-
--assignee @me \
|
|
137
|
-
{label-args} \
|
|
138
|
-
{milestone-arg}
|
|
6
|
+
agent-infra-internal platform-issue create {task-id} --agent {agent}
|
|
7
|
+
agent-infra-internal platform-issue sync {task-id} --agent {agent} --status waiting-for-triage --assignees current --milestone initial --issue-type --fields
|
|
139
8
|
```
|
|
140
9
|
|
|
141
|
-
|
|
142
|
-
- `{label-args}` is expanded from the result of §4 into multiple `--label "..."`; if empty, omit the entire argument
|
|
143
|
-
- `{milestone-arg}` is only expanded to `--milestone "..."` when `has_triage=true` and milestone is non-empty; otherwise omit
|
|
144
|
-
- `--assignee @me` requires no permission probe; on failure, skip silently
|
|
145
|
-
|
|
146
|
-
Permission downgrade follows `.agents/rules/issue-sync.md`: `has_triage=false` skips label / milestone settings; `has_push=false` skips Issue Type setting; the rest continues.
|
|
147
|
-
|
|
148
|
-
After success, parse the Issue number from the output (match only the `https://.../issues/(\d+)` URL form; do not use a loose regex). If parsing fails, halt the cascade and propagate the error back to `create-task`.
|
|
149
|
-
|
|
150
|
-
### 6. Set Issue Type (Optional)
|
|
151
|
-
|
|
152
|
-
Execute only when `has_push=true`, the owner type is `Organization`, and the Issue Type inferred in §4 is in the org's actually available list:
|
|
153
|
-
|
|
154
|
-
```bash
|
|
155
|
-
gh api "repos/$upstream_repo/issues/{issue-number}" -X PATCH \
|
|
156
|
-
-f type="{issue-type}" --silent
|
|
157
|
-
```
|
|
158
|
-
|
|
159
|
-
Failure is non-blocking.
|
|
160
|
-
|
|
161
|
-
### 7. Set Issue Fields (Optional)
|
|
162
|
-
|
|
163
|
-
If `has_push=true`, read `.agents/rules/issue-fields.md` and follow Flow A to write any applicable non-empty `priority`, `effort`, `start_date`, and `target_date` values from `task.md`.
|
|
164
|
-
|
|
165
|
-
Field write failures are non-blocking.
|
|
166
|
-
|
|
167
|
-
### 8. Write Back task.md
|
|
168
|
-
|
|
169
|
-
Update task.md:
|
|
170
|
-
|
|
171
|
-
- Write `issue_number: {n}` into the frontmatter (replace if it exists; append at the end of the frontmatter otherwise)
|
|
172
|
-
- Update `updated_at` to the current time (command: `date "+%Y-%m-%d %H:%M:%S%z" | sed 's/\([+-][0-9][0-9]\)\([0-9][0-9]\)$/\1:\2/'`)
|
|
173
|
-
|
|
174
|
-
> Do NOT append an Activity Log entry here. The Issue creation event is already captured by the GitHub Issue itself and by the frontmatter `issue_number` field; the Activity Log only records the single `create-task` skill execution anchor (`Create Task`), written by the caller SKILL step 3.
|
|
175
|
-
|
|
176
|
-
### 9. Return the Result
|
|
177
|
-
|
|
178
|
-
Hand the following back to the caller `create-task`:
|
|
179
|
-
|
|
180
|
-
- Issue number `{n}`
|
|
181
|
-
- Issue URL (prefer the URL printed by `gh issue create`; fall back to `https://github.com/$upstream_repo/issues/{n}`)
|
|
182
|
-
- The labels / milestone / Issue Type that were actually applied
|
|
183
|
-
|
|
184
|
-
`create-task` uses these to pick the "Scenario A: Issue created" output branch and continue with task comment sync and status label setup.
|
|
185
|
-
|
|
186
|
-
## Error Handling
|
|
10
|
+
The core reads only persisted task identity, title, type, description, and requirements, and reuses deterministic `ai task issue-body` rendering. It owns template selection, upstream/capabilities, duplicate prevention, POST outcome boundaries, response validation, and atomic `issue_number` binding.
|
|
187
11
|
|
|
188
|
-
-
|
|
189
|
-
- Network timeout / DNS failure: `{code: "NETWORK", message}`
|
|
190
|
-
- Template parsing failure, Issue number parsing failure, other anomalies: `{code: "VALIDATION", message}`
|
|
191
|
-
- All failures keep task.md untouched; `create-task` must record the structured error in `## Workflow Warnings` (`severity=ACTION_REQUIRED`, `code=ISSUE_CREATE_FAILED`, `target=issue`) before taking the "Scenario C: failure fallback" output branch and prompting the user to retry manually or fill `issue_number` later
|
|
12
|
+
`planned|applied|no-op|degraded` exit 0, `failed` exits 1, and `blocked` exits 2. Callers must not fall back to direct `gh issue` or GraphQL orchestration.
|
|
@@ -1,191 +1,25 @@
|
|
|
1
1
|
# Issue 创建
|
|
2
2
|
|
|
3
|
-
当 `create-task` 完成本地 `task.md`
|
|
4
|
-
|
|
5
|
-
## 行为边界
|
|
6
|
-
|
|
7
|
-
- Issue 标题和正文只能来自 `task.md`
|
|
8
|
-
- 不读取 `analysis.md`、`review-analysis.md`、`plan.md`、`review-plan.md`、`code.md` 或代码审查产物
|
|
9
|
-
- 持久产物只有:远端 Issue + `task.md` 中回写的 `issue_number`
|
|
10
|
-
- Issue 创建失败时不回滚 `task.md`;当前 task 仍可继续后续工作流,未来可由用户手动写入 `issue_number`,让其它技能的级联同步接管
|
|
11
|
-
|
|
12
|
-
## 执行步骤
|
|
13
|
-
|
|
14
|
-
### 1. 验证前置条件
|
|
15
|
-
|
|
16
|
-
- `.agents/workspace/active/{task-id}/task.md` 必须存在
|
|
17
|
-
- 先读取 `.agents/rules/issue-pr-commands.md`,按其中的认证与平台检测命令验证 `gh auth status` 和当前仓库可用
|
|
18
|
-
- 先读取 `.agents/rules/issue-sync.md`,完成 `upstream_repo`、`has_triage`、`has_push` 检测;后续所有 `gh issue` 与 repo 级 `gh api` 调用都复用这些变量
|
|
19
|
-
- 如果 `task.md` 中 `issue_number` 已存在且既不为空也不为 `N/A`,立即停止级联:返回"任务已绑定 Issue #{n},跳过创建"信息给 `create-task`,由调用方决定如何继续
|
|
20
|
-
|
|
21
|
-
### 2. 提取任务信息
|
|
22
|
-
|
|
23
|
-
从 `task.md` 提取以下字段:
|
|
24
|
-
|
|
25
|
-
- 任务标题(首个 `# ` 标题,去掉 `任务:` / `Task:` 前缀)—— 用于构造 Issue 标题
|
|
26
|
-
- frontmatter 中的 `type` 与(可选的)`milestone`
|
|
27
|
-
|
|
28
|
-
> Issue **正文**不在此处手工提取。正文由 §3 调用 `ai task issue-body` 命令从 `## 描述` / `## 需求` 段确定性生成,调用方不得自行拼装。
|
|
29
|
-
|
|
30
|
-
构造 Issue 标题:
|
|
31
|
-
|
|
32
|
-
| task.md `type` | Conventional Commits type |
|
|
33
|
-
|---|---|
|
|
34
|
-
| `feature` | `feat` |
|
|
35
|
-
| `bugfix`, `bug` | `fix` |
|
|
36
|
-
| `refactor`, `refactoring` | `refactor` |
|
|
37
|
-
| `docs`, `documentation` | `docs` |
|
|
38
|
-
| `chore`, `task` 或其它 | `chore` |
|
|
39
|
-
|
|
40
|
-
scope 推断:从 `.agents/.airc.json` 的 `labels.in` 字段读取已知模块名,再与任务标题/描述做语义匹配;没有清晰命中时省略 scope。最终标题:`{cc_type}({scope}): {task_title}` 或 `{cc_type}: {task_title}`(任务标题保留原文,不要翻译或改写)。
|
|
41
|
-
|
|
42
|
-
### 3. 构建 Issue 正文
|
|
43
|
-
|
|
44
|
-
> **机械化边界(必须遵守)**:Issue 正文一律由 `ai task issue-body` 命令确定性生成;调用方只把命令 stdout 作为 `gh issue create` 的 `--body-file` 传入,**不得**自行拼装、改写或截断正文。命令只输出 task 标题 / `## 描述` / `## 需求` 对应内容,task.md 其余脚手架段落永不进入 body。
|
|
45
|
-
|
|
46
|
-
Issue 模板检测:按 `.agents/rules/issue-pr-commands.md` 的 "Issue 模板检测" 规则扫描 `.github/ISSUE_TEMPLATE/*.yml`(排除 `config.yml`)。
|
|
47
|
-
|
|
48
|
-
#### 场景 A:检测到匹配模板
|
|
49
|
-
|
|
50
|
-
按模板顶层 `name` 与任务类型挑选最匹配的 form(如任务 `type: bugfix` 优先选名称含 `bug` 的模板);找不到匹配时,回退到通用 form(如 `other.yml`),仍找不到时取目录中第一个 form。
|
|
51
|
-
|
|
52
|
-
确定模板文件 `{form-path}` 后,由命令按该 Issue Form 渲染最终正文,并写入正文文件 `{body-file}` 供 §5 使用:
|
|
53
|
-
|
|
54
|
-
```bash
|
|
55
|
-
ai task issue-body {task-id} --template "{form-path}" > "{body-file}"
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
命令跳过 `markdown` / `dropdown` / `checkboxes` 字段,对 `input` / `textarea` 字段以 `attributes.label` 作标题、按字段 `id` 确定性填入 task 标题 / 描述 / 需求,无可靠映射源的字段填 `N/A`(字段映射表是命令内的单一真源,不在本规则重述)。命令退出码非 0(文件缺失 / 非法 YAML / 无 `body`)时,改用场景 B 命令重新生成 `{body-file}`。
|
|
59
|
-
|
|
60
|
-
#### 场景 B:无模板或解析失败
|
|
61
|
-
|
|
62
|
-
由命令输出默认正文(仅 `## 描述` + `## 需求`,复选框逐字保留,缺失段落填 `N/A`),写入 `{body-file}`:
|
|
63
|
-
|
|
64
|
-
```bash
|
|
65
|
-
ai task issue-body {task-id} > "{body-file}"
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
#### 红线:禁止把整份 task.md 当 body
|
|
69
|
-
|
|
70
|
-
无论场景 A / B,body 只能来自 `ai task issue-body` 的 stdout,**只含 描述 + 需求两段内容**(场景 A 为按模板字段映射后的等价内容)。
|
|
71
|
-
|
|
72
|
-
错误示范(❌ 禁止):把含 `## 分析` / `## 设计` / `## 实现备注` / `## 审查反馈` / `## 审查分歧账本` / `## 人工裁决` / `## 活动日志` / `## 完成检查清单` 等脚手架段落、以及 `#XXX` 占位的整份 task.md 直接作为 Issue body。这些段落只走 `sync-issue:{task-id}:task` 评论,绝不进 body。
|
|
73
|
-
|
|
74
|
-
### 4. 解析 labels / Issue Type / milestone
|
|
75
|
-
|
|
76
|
-
#### labels(粗选)
|
|
77
|
-
|
|
78
|
-
- 调用 `gh api "repos/$upstream_repo/labels?per_page=100" --jq '.[].name'` 获取仓库实际存在的 label 列表(缓存为 set)
|
|
79
|
-
- 按以下映射挑出"应有的 type label",仅保留仓库 set 中实际存在的:
|
|
80
|
-
|
|
81
|
-
| task.md `type` | label |
|
|
82
|
-
|---|---|
|
|
83
|
-
| `bug`, `bugfix` | `type: bug` |
|
|
84
|
-
| `feature` | `type: feature` |
|
|
85
|
-
| `enhancement` | `type: enhancement` |
|
|
86
|
-
| `docs`, `documentation` | `type: documentation` |
|
|
87
|
-
| `dependency-upgrade` | `type: dependency-upgrade` |
|
|
88
|
-
| `task`, `chore` | `type: task` |
|
|
89
|
-
| `refactor`, `refactoring` | `type: enhancement` |
|
|
90
|
-
| 其它 | 跳过 |
|
|
91
|
-
|
|
92
|
-
- `in:` label(粗选,宁缺毋滥):根据任务标题与描述对 `labels.in` 中的模块名做语义匹配;明确提及或强烈暗示 → 添加 `in: {module}`;模糊或不确定 → 不添加。`in:` label 同样要求仓库实际存在。
|
|
93
|
-
|
|
94
|
-
最终 label 集合若为空,省略 `--label` 参数。
|
|
95
|
-
|
|
96
|
-
#### Issue Type fallback
|
|
97
|
-
|
|
98
|
-
| task.md `type` | Issue Type |
|
|
99
|
-
|---|---|
|
|
100
|
-
| `bug`, `bugfix` | `Bug` |
|
|
101
|
-
| `feature`, `enhancement` | `Feature` |
|
|
102
|
-
| `task`, `documentation`, `dependency-upgrade`, `chore`, `docs`, `refactor`, `refactoring` 及其它 | `Task` |
|
|
103
|
-
|
|
104
|
-
实际设置时按 `.agents/rules/issue-pr-commands.md` 的 "设置 Issue Type" 命令;仅当 owner type 为 `Organization` 时,先调 `gh api orgs/{owner}/issue-types` 列出 org 实际可用的 Type,并且仅当推断值在列表中时才设置;个人仓库、owner type 探测失败或设置失败都不阻断流程。
|
|
105
|
-
|
|
106
|
-
#### milestone
|
|
107
|
-
|
|
108
|
-
**必须执行,不得跳过**。本节是 `.agents/rules/milestone-inference.md` 阶段 1 的就地展开,语义与之对齐;不要把它当成"可选推断"。
|
|
109
|
-
|
|
110
|
-
按以下编号步骤选取 milestone(优先级与阶段 1 严格一致):
|
|
111
|
-
|
|
112
|
-
1. 如果 `has_triage=false`:直接省略 `--milestone`,跳过本节。
|
|
113
|
-
2. 列出仓库 open 状态的全部 milestone:
|
|
114
|
-
```bash
|
|
115
|
-
gh api "repos/$upstream_repo/milestones?state=open&per_page=100" \
|
|
116
|
-
--jq '.[].title'
|
|
117
|
-
```
|
|
118
|
-
3. 如果 `task.md` frontmatter 显式给出 `milestone` 字段,且该值出现在步骤 2 列表中:直接使用该值作为 `{milestone-arg}`,跳过步骤 4 / 5。
|
|
119
|
-
4. 用正则 `^[0-9]+\.[0-9]+\.x$` 过滤步骤 2 结果。
|
|
120
|
-
- 非空:按 major、minor 数值升序排序,取最小的版本线作为 `{milestone-arg}`。
|
|
121
|
-
5. 步骤 4 候选为空:尝试回退到 `General Backlog`。
|
|
122
|
-
- 步骤 2 结果中存在 `General Backlog`:使用该 milestone。
|
|
123
|
-
- 不存在 `General Backlog`:仅在此情况下省略 `--milestone`。
|
|
124
|
-
6. 步骤 2 的 `gh api` 调用失败(网络 / 认证错误):按"无候选"处理,落到步骤 5。
|
|
125
|
-
|
|
126
|
-
设置成功时把版本线(或 `General Backlog` 或 task.md 显式值)作为 `{milestone-arg}` 带入步骤 5 的 `gh issue create` 命令;§5 末尾的展开规则保持不变。
|
|
127
|
-
|
|
128
|
-
### 5. 调用 GitHub CLI 创建 Issue
|
|
129
|
-
|
|
130
|
-
按 `.agents/rules/issue-pr-commands.md` 中的 "创建 Issue" 命令执行;正文统一用 §3 生成的 `{body-file}`,覆盖通用命令的 `--body`:
|
|
3
|
+
当 `create-task` 完成本地 `task.md` 落盘后,通过声明式内部命令创建 Issue:
|
|
131
4
|
|
|
132
5
|
```bash
|
|
133
|
-
|
|
134
|
-
--title "{title}" \
|
|
135
|
-
--body-file "{body-file}" \
|
|
136
|
-
--assignee @me \
|
|
137
|
-
{label-args} \
|
|
138
|
-
{milestone-arg}
|
|
6
|
+
agent-infra-internal platform-issue create {task-id} --agent {agent}
|
|
139
7
|
```
|
|
140
8
|
|
|
141
|
-
|
|
142
|
-
- `{label-args}` 由 §4 计算结果展开为多个 `--label "..."`;为空则整体省略
|
|
143
|
-
- `{milestone-arg}` 仅当 `has_triage=true` 且 milestone 非空时展开为 `--milestone "..."`;否则整体省略
|
|
144
|
-
- `--assignee @me` 不做权限预判,失败时静默跳过
|
|
145
|
-
|
|
146
|
-
权限降级规则按 `.agents/rules/issue-sync.md`:`has_triage=false` 时跳过 label / milestone 设置;`has_push=false` 时跳过 Issue Type 设置;其余流程继续。
|
|
147
|
-
|
|
148
|
-
创建成功后从输出中解析 Issue 编号(仅匹配 `https://.../issues/(\d+)` URL 形式,不要使用宽松正则);解析失败时停止级联并把错误传回 `create-task`。
|
|
149
|
-
|
|
150
|
-
### 6. 设置 Issue Type(可选)
|
|
9
|
+
命令只从已落盘 task.md 读取身份、标题、类型、描述与需求,并复用 `ai task issue-body` 的确定性正文渲染。它负责模板选择、upstream/capability、已有绑定检查、非幂等 POST 边界、响应身份校验及通过任务写入内核回写 `issue_number`。
|
|
151
10
|
|
|
152
|
-
|
|
11
|
+
创建后的初始元数据使用同一适配层同步:
|
|
153
12
|
|
|
154
13
|
```bash
|
|
155
|
-
|
|
156
|
-
-
|
|
14
|
+
agent-infra-internal platform-issue sync {task-id} --agent {agent} \
|
|
15
|
+
--status waiting-for-triage --assignees current --milestone initial --issue-type --fields
|
|
157
16
|
```
|
|
158
17
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
### 7. 设置 Issue 字段(可选)
|
|
162
|
-
|
|
163
|
-
如果 `has_push=true`,读取 `.agents/rules/issue-fields.md`,按流程 A 写入 `task.md` 中适用且非空的 `priority`、`effort`、`start_date` 和 `target_date`。
|
|
164
|
-
|
|
165
|
-
字段写入失败不阻断流程。
|
|
166
|
-
|
|
167
|
-
### 8. 回写 task.md
|
|
168
|
-
|
|
169
|
-
更新 task.md:
|
|
170
|
-
|
|
171
|
-
- 把 `issue_number: {n}` 写入 frontmatter(已存在则替换;不存在则在 frontmatter 末尾追加)
|
|
172
|
-
- 更新 `updated_at` 为当前时间(命令:`date "+%Y-%m-%d %H:%M:%S%z" | sed 's/\([+-][0-9][0-9]\)\([0-9][0-9]\)$/\1:\2/'`)
|
|
173
|
-
|
|
174
|
-
> 不要在此追加 Activity Log 条目。Issue 创建事件已由 GitHub Issue 自身和 frontmatter `issue_number` 承载;Activity Log 仅记录 `create-task` skill 一次执行的整体锚点(`Create Task`),由调用方 SKILL 步骤 3 写入。
|
|
175
|
-
|
|
176
|
-
### 9. 返回结果
|
|
177
|
-
|
|
178
|
-
把以下信息回传给调用方 `create-task`:
|
|
179
|
-
|
|
180
|
-
- Issue 编号 `{n}`
|
|
181
|
-
- Issue URL(首选 `gh issue create` 输出中的 URL;缺失时拼 `https://github.com/$upstream_repo/issues/{n}`)
|
|
182
|
-
- 实际应用的 labels / milestone / Issue Type
|
|
183
|
-
|
|
184
|
-
`create-task` 据此选择"场景 A:已创建 Issue"输出分支并继续执行后续 task 评论同步与 status label 设置。
|
|
18
|
+
## 结果处理
|
|
185
19
|
|
|
186
|
-
|
|
20
|
+
- `planned|applied|no-op|degraded`:exit 0;调用方按 operations 继续评论同步。
|
|
21
|
+
- `failed`:exit 1;调用方登记 `ISSUE_CREATE_FAILED` warning,不伪造绑定。
|
|
22
|
+
- `blocked`:exit 2;认证、网络或创建 outcome 不确定,调用方保留远端 identity 证据并停止盲目重试。
|
|
23
|
+
- 已绑定有效 Issue 时只验证绑定并返回 no-op,绝不重复创建。
|
|
187
24
|
|
|
188
|
-
-
|
|
189
|
-
- 网络超时 / DNS 失败:`{code: "NETWORK", message}`
|
|
190
|
-
- 模板解析失败、Issue 编号解析失败、其它异常:`{code: "VALIDATION", message}`
|
|
191
|
-
- 任意失败均不回滚 task.md;`create-task` 必须把结构化错误写入 `## 工作流告警`(`severity=ACTION_REQUIRED`,`code=ISSUE_CREATE_FAILED`,`target=issue`),再走"场景 C 失败兜底"输出,提示用户手动重试或在事后写入 `issue_number`
|
|
25
|
+
自定义或空平台返回 no-op/degraded;调用方不得回退到直接 `gh issue` 或 GraphQL 编排。
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# Issue 创建
|
|
2
2
|
|
|
3
|
-
当前代码平台未提供 Issue
|
|
3
|
+
当前代码平台未提供 Issue 适配器;`platform-issue create` 返回结构化 no-op/degraded 结果。
|
|
4
4
|
|
|
5
5
|
`create-task` 在本平台上会跳过级联创建 Issue 步骤;本地 `task.md` 仍然是有效产物。如果将来需要把任务绑定到一个 Issue,可手动在 `task.md` 中写入 `issue_number`,后续技能(`commit` / `code-task` / `complete-task` 等)会按既有的级联同步规则自动接管 Issue 元数据更新。
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Human Decision Context Contract
|
|
2
|
+
|
|
3
|
+
This rule governs every new `[needs-human-decision]` detail block produced by analyze, plan, code, and their three review workflows. Historical details do not need migration.
|
|
4
|
+
|
|
5
|
+
## Self-contained Context
|
|
6
|
+
|
|
7
|
+
A maintainer must be able to decide without asking a model to reconstruct context. Every item must state its background, decision objective, impact scope, risks, recommended option, and recommendation rationale. It must provide at least two options, each with both benefits and costs.
|
|
8
|
+
|
|
9
|
+
## Canonical Structure
|
|
10
|
+
|
|
11
|
+
```markdown
|
|
12
|
+
### {AN-N|PL-N|CD-N|HD-N}: {Title} [needs-human-decision]
|
|
13
|
+
|
|
14
|
+
- **Background**: {facts, constraints, and why a decision is needed}
|
|
15
|
+
- **Decision Objective**: {the single choice that must be made}
|
|
16
|
+
- **Impact Scope**: {affected behavior, files, users, or precedent}
|
|
17
|
+
- **Risks**: {risks of the wrong choice, delay, or no decision}
|
|
18
|
+
- **Recommended Option**: {Option A/B/...}
|
|
19
|
+
- **Recommendation Rationale**: {reason based on benefits, costs, and constraints}
|
|
20
|
+
|
|
21
|
+
#### Option A: {Name}
|
|
22
|
+
|
|
23
|
+
- **Benefits**: {benefits of this option}
|
|
24
|
+
- **Costs**: {costs and limitations of this option}
|
|
25
|
+
|
|
26
|
+
#### Option B: {Name}
|
|
27
|
+
|
|
28
|
+
- **Benefits**: {benefits of this option}
|
|
29
|
+
- **Costs**: {costs and limitations of this option}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Option C and supporting evidence may be added, but none of the fields above may be omitted or collapsed into an incomparable one-line option list. The heading ID must match the task.md Review Disagreement Ledger row, whose evidence must point to this stable heading anchor.
|
|
33
|
+
|
|
34
|
+
## Decision Closure
|
|
35
|
+
|
|
36
|
+
Use `ai task decisions <task-ref> <ordinal|ledger-id>` to inspect full context and `ai decide <task-ref> <ordinal|ledger-id> <decision>` to record the ruling. `ai decide` updates the row to `human-decided`, creates an independent `HDR-N` record, and updates evidence and the activity log; do not manually imitate only part of that transaction.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# 人工裁决上下文契约
|
|
2
|
+
|
|
3
|
+
本规则约束 analyze、plan、code 及三类 review 工作流中新建的所有 `[needs-human-decision]` 详情块。历史详情无需迁移。
|
|
4
|
+
|
|
5
|
+
## 自足性要求
|
|
6
|
+
|
|
7
|
+
详情必须让维护者无需模型二次推理即可理解并裁决。每项必须明确说明背景、裁决目标、影响范围、风险、推荐方案与推荐理由,并至少提供两个可选方案;每个方案都必须同时列出收益和代价。
|
|
8
|
+
|
|
9
|
+
## 规范结构
|
|
10
|
+
|
|
11
|
+
```markdown
|
|
12
|
+
### {AN-N|PL-N|CD-N|HD-N}:{标题} [needs-human-decision]
|
|
13
|
+
|
|
14
|
+
- **背景**:{为何需要裁决;已知事实与约束}
|
|
15
|
+
- **裁决目标**:{本次必须确定的唯一选择}
|
|
16
|
+
- **影响范围**:{受影响的功能、文件、用户或后续先例}
|
|
17
|
+
- **风险**:{错误选择、延期或不裁决的风险}
|
|
18
|
+
- **推荐方案**:{方案 A/B/...}
|
|
19
|
+
- **推荐理由**:{基于收益、代价和约束的理由}
|
|
20
|
+
|
|
21
|
+
#### 方案 A:{名称}
|
|
22
|
+
|
|
23
|
+
- **收益**:{选择该方案的收益}
|
|
24
|
+
- **代价**:{选择该方案的成本与局限}
|
|
25
|
+
|
|
26
|
+
#### 方案 B:{名称}
|
|
27
|
+
|
|
28
|
+
- **收益**:{选择该方案的收益}
|
|
29
|
+
- **代价**:{选择该方案的成本与局限}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
可增加方案 C 或补充证据,但不得省略上述字段或把多个方案压缩为无法分别比较的一行。标题 ID 必须与 task.md `## 审查分歧账本` 行一致,evidence 必须指向该标题的稳定锚点。
|
|
33
|
+
|
|
34
|
+
## 裁决闭环
|
|
35
|
+
|
|
36
|
+
使用 `ai task decisions <task-ref> <序号|账本ID>` 查看完整详情,使用 `ai decide <task-ref> <序号|账本ID> <裁决内容>` 写入裁决。`ai decide` 负责把目标行更新为 `human-decided`、创建独立 `HDR-N` 记录、更新 evidence 与活动日志;不得手工模拟其中一部分写入。
|
|
@@ -1,155 +1,11 @@
|
|
|
1
1
|
# Issue Fields
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
## Boundary
|
|
6
|
-
|
|
7
|
-
- Use this rule only after `upstream_repo`, `has_push`, and the Issue number are known.
|
|
8
|
-
- If `has_push=false`, skip direct field writes and continue.
|
|
9
|
-
- Fetch the organization's current Issue Type schema before each write; do not hard-code the field set.
|
|
10
|
-
- Missing, empty, or unresolvable values are skipped. Field writes are best-effort and must not block the workflow.
|
|
11
|
-
|
|
12
|
-
## Supported Task Frontmatter
|
|
13
|
-
|
|
14
|
-
All fields are optional:
|
|
15
|
-
|
|
16
|
-
| task.md field | Issue field | Value format |
|
|
17
|
-
|---|---|---|
|
|
18
|
-
| `priority` | `Priority` | `Urgent`, `High`, `Medium`, or `Low` |
|
|
19
|
-
| `effort` | `Effort` | `High`, `Medium`, or `Low` |
|
|
20
|
-
| `start_date` | `Start date` | `YYYY-MM-DD` |
|
|
21
|
-
| `target_date` | `Target date` | `YYYY-MM-DD` |
|
|
22
|
-
|
|
23
|
-
Localized option input may be normalized before writing:
|
|
24
|
-
|
|
25
|
-
| Input | Stored option |
|
|
26
|
-
|---|---|
|
|
27
|
-
| `紧急` | `Urgent` |
|
|
28
|
-
| `高` | `High` |
|
|
29
|
-
| `中` | `Medium` |
|
|
30
|
-
| `低` | `Low` |
|
|
31
|
-
|
|
32
|
-
AI agents may infer `priority` and `effort` from the title and description when creating or refining tasks. Date fields are factual, not estimated: `start_date` is written by the analyze stage (the analysis start date) and `target_date` by the complete stage (the completion date). Human edits in `task.md` take precedence.
|
|
33
|
-
|
|
34
|
-
## GraphQL Reference
|
|
35
|
-
|
|
36
|
-
Read Issue Type pinned fields:
|
|
37
|
-
|
|
38
|
-
```graphql
|
|
39
|
-
query($owner:String!){
|
|
40
|
-
organization(login:$owner){ issueTypes(first:20){ nodes{
|
|
41
|
-
id name
|
|
42
|
-
pinnedFields{
|
|
43
|
-
__typename
|
|
44
|
-
... on IssueFieldSingleSelect{ id name options{ id name } }
|
|
45
|
-
... on IssueFieldDate{ id name }
|
|
46
|
-
... on IssueFieldText{ id name }
|
|
47
|
-
... on IssueFieldNumber{ id name }
|
|
48
|
-
}
|
|
49
|
-
} } }
|
|
50
|
-
}
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
Read one Issue's current type and field values:
|
|
54
|
-
|
|
55
|
-
```graphql
|
|
56
|
-
query($owner:String!,$name:String!,$number:Int!){
|
|
57
|
-
repository(owner:$owner,name:$name){ issue(number:$number){
|
|
58
|
-
id
|
|
59
|
-
issueType{ name pinnedFields{
|
|
60
|
-
__typename
|
|
61
|
-
... on IssueFieldSingleSelect{ id name options{ id name } }
|
|
62
|
-
... on IssueFieldDate{ id name }
|
|
63
|
-
... on IssueFieldText{ id name }
|
|
64
|
-
... on IssueFieldNumber{ id name }
|
|
65
|
-
} }
|
|
66
|
-
issueFieldValues(first:50){ nodes{
|
|
67
|
-
__typename
|
|
68
|
-
... on IssueFieldSingleSelectValue{ name optionId field{ ... on IssueFieldSingleSelect{ name } } }
|
|
69
|
-
... on IssueFieldDateValue{ value field{ ... on IssueFieldDate{ name } } }
|
|
70
|
-
... on IssueFieldTextValue{ value field{ ... on IssueFieldText{ name } } }
|
|
71
|
-
... on IssueFieldNumberValue{ value field{ ... on IssueFieldNumber{ name } } }
|
|
72
|
-
} }
|
|
73
|
-
} }
|
|
74
|
-
}
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
Write or clear fields and update Issue Type:
|
|
78
|
-
|
|
79
|
-
```graphql
|
|
80
|
-
mutation($issueId:ID!,$issueFields:[IssueFieldCreateOrUpdateInput!]!){
|
|
81
|
-
setIssueFieldValue(input:{issueId:$issueId,issueFields:$issueFields}){ issue{ id } }
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
mutation($issueId:ID!,$issueTypeId:ID){
|
|
85
|
-
updateIssueIssueType(input:{issueId:$issueId,issueTypeId:$issueTypeId}){ issue{ id } }
|
|
86
|
-
}
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
`IssueFieldCreateOrUpdateInput` supports `fieldId`, `singleSelectOptionId`, `dateValue`, `textValue`, `numberValue`, and `delete`.
|
|
90
|
-
|
|
91
|
-
Minimal command shells:
|
|
3
|
+
Synchronize Issue Type and pinned fields through one intent:
|
|
92
4
|
|
|
93
5
|
```bash
|
|
94
|
-
|
|
95
|
-
-f query='query($owner:String!){organization(login:$owner){issueTypes(first:20){nodes{id name pinnedFields{__typename ... on IssueFieldSingleSelect{id name options{id name}} ... on IssueFieldDate{id name} ... on IssueFieldText{id name} ... on IssueFieldNumber{id name}}}}}}' \
|
|
96
|
-
-F owner="{owner}"
|
|
97
|
-
|
|
98
|
-
gh api graphql \
|
|
99
|
-
-f query='query($owner:String!,$name:String!,$number:Int!){repository(owner:$owner,name:$name){issue(number:$number){id issueType{name pinnedFields{__typename ... on IssueFieldSingleSelect{id name options{id name}} ... on IssueFieldDate{id name} ... on IssueFieldText{id name} ... on IssueFieldNumber{id name}}} issueFieldValues(first:50){nodes{__typename ... on IssueFieldSingleSelectValue{name optionId field{... on IssueFieldSingleSelect{name}}} ... on IssueFieldDateValue{value field{... on IssueFieldDate{name}}} ... on IssueFieldTextValue{value field{... on IssueFieldText{name}}} ... on IssueFieldNumberValue{value field{... on IssueFieldNumber{name}}}}}}}}' \
|
|
100
|
-
-F owner="{owner}" -F name="{repo}" -F number="{issue-number}"
|
|
101
|
-
|
|
102
|
-
gh api graphql --input - <<'JSON'
|
|
103
|
-
{
|
|
104
|
-
"query": "mutation($issueId:ID!,$issueFields:[IssueFieldCreateOrUpdateInput!]!){setIssueFieldValue(input:{issueId:$issueId,issueFields:$issueFields}){issue{id}}}",
|
|
105
|
-
"variables": {
|
|
106
|
-
"issueId": "{issue-id}",
|
|
107
|
-
"issueFields": [
|
|
108
|
-
{ "fieldId": "{field-id}", "singleSelectOptionId": "{option-id}" },
|
|
109
|
-
{ "fieldId": "{date-field-id}", "dateValue": "YYYY-MM-DD" },
|
|
110
|
-
{ "fieldId": "{old-field-id}", "delete": true }
|
|
111
|
-
]
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
JSON
|
|
115
|
-
|
|
116
|
-
gh api graphql --input - <<'JSON'
|
|
117
|
-
{
|
|
118
|
-
"query": "mutation($issueId:ID!,$issueTypeId:ID){updateIssueIssueType(input:{issueId:$issueId,issueTypeId:$issueTypeId}){issue{id}}}",
|
|
119
|
-
"variables": {
|
|
120
|
-
"issueId": "{issue-id}",
|
|
121
|
-
"issueTypeId": "{issue-type-id}"
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
JSON
|
|
6
|
+
agent-infra-internal platform-issue sync {task-id} --agent {agent} --issue-type --fields
|
|
125
7
|
```
|
|
126
8
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
## Flow A: Write Fields After Issue Creation
|
|
130
|
-
|
|
131
|
-
1. Stop if `has_push` is not `true`.
|
|
132
|
-
2. Resolve `{owner}` from `$upstream_repo` and query `organization.issueTypes`.
|
|
133
|
-
3. Select the target Issue Type's `pinnedFields`.
|
|
134
|
-
4. Read non-empty `priority`, `effort`, `start_date`, and `target_date` values from `task.md`.
|
|
135
|
-
5. For each value:
|
|
136
|
-
- Skip it when the target type does not pin a same-name field.
|
|
137
|
-
- For single-select fields, normalize localized input and match the option by name.
|
|
138
|
-
- For date fields, write only `YYYY-MM-DD` values.
|
|
139
|
-
6. Submit one `setIssueFieldValue` mutation with all resolved inputs. If no input remains, skip.
|
|
140
|
-
|
|
141
|
-
## Flow B: Set Type And Migrate Fields
|
|
142
|
-
|
|
143
|
-
Use this flow whenever an existing Issue Type is changed.
|
|
144
|
-
|
|
145
|
-
1. Stop if `has_push` is not `true`.
|
|
146
|
-
2. Read the Issue id, current Issue Type, pinned fields, and current field values.
|
|
147
|
-
3. Query the organization Issue Type list and resolve the target Issue Type id.
|
|
148
|
-
4. Run `updateIssueIssueType` with the target Issue Type id.
|
|
149
|
-
5. Resolve the target type's pinned fields.
|
|
150
|
-
6. For each old field value:
|
|
151
|
-
- If the target type has a same-name field, write the value again. For single-select values, resolve the target option id by option name.
|
|
152
|
-
- If the target type does not have a same-name field, send `{ fieldId, delete: true }` for the old field.
|
|
153
|
-
7. Submit one `setIssueFieldValue` mutation with all migration inputs. Empty migrations are skipped.
|
|
9
|
+
Supported task.md mappings are `priority` → `Priority`, `effort` → `Effort`, `start_date` → `Start date`, and `target_date` → `Target date`. The core normalizes localized priority/effort options and validates `YYYY-MM-DD` dates.
|
|
154
10
|
|
|
155
|
-
|
|
11
|
+
The adapter reads the organization's current schema on every run and never hardcodes Type, field, or option IDs. When Type changes it migrates same-name values and deletes values unsupported by the target Type. Personal repositories or `push=false` skip only Type/field operations.
|