@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.
Files changed (375) hide show
  1. package/README.md +19 -9
  2. package/README.zh-CN.md +19 -9
  3. package/bin/cli.ts +17 -4
  4. package/dist/bin/cli.js +19 -4
  5. package/dist/bin/internal-cli.js +55 -4
  6. package/dist/lib/agent-client.js +0 -1
  7. package/dist/lib/agent-clients/adapters/codex-lifecycle/build-identity.js +71 -10
  8. package/dist/lib/agent-clients/adapters/opencode-sandbox.js +0 -4
  9. package/dist/lib/agent-clients/adapters/traecli.js +7 -8
  10. package/dist/lib/agent-clients/config.js +14 -99
  11. package/dist/lib/agent-clients/reconcile.js +1 -11
  12. package/dist/lib/agent-clients/schema.js +5 -4
  13. package/dist/lib/agent-clients/tokens.js +5 -15
  14. package/dist/lib/decide.js +14 -30
  15. package/dist/lib/defaults.json +8 -0
  16. package/dist/lib/git/workflow.js +43 -1
  17. package/dist/lib/init.js +3 -2
  18. package/dist/lib/internal/git-workflow.js +8 -1
  19. package/dist/lib/internal/platform-pr.js +8 -2
  20. package/dist/lib/internal/release-workflow.js +0 -1
  21. package/dist/lib/internal/task-delivery.js +59 -0
  22. package/dist/lib/internal/task-finalization.js +19 -9
  23. package/dist/lib/internal/task-ledger.js +8 -2
  24. package/dist/lib/internal/task-lifecycle.js +17 -93
  25. package/dist/lib/internal/task-orchestration.js +30 -216
  26. package/dist/lib/internal/task-validate.js +2 -1
  27. package/dist/lib/merge.js +205 -103
  28. package/dist/lib/platform/github-client.js +7 -1
  29. package/dist/lib/platform/pr-checks.js +8 -5
  30. package/dist/lib/platform/pr-summary.js +12 -8
  31. package/dist/lib/platform/pull-requests.js +393 -91
  32. package/dist/lib/platform/verification-required.js +13 -2
  33. package/dist/lib/platform/verification-sync.js +9 -4
  34. package/dist/lib/pr-review/evidence-grading.js +12 -4
  35. package/dist/lib/process-data/normalize.js +2 -9
  36. package/dist/lib/run/host.js +46 -16
  37. package/dist/lib/sandbox/agent-client-reconciler.js +4 -12
  38. package/dist/lib/sandbox/commands/create.js +3 -3
  39. package/dist/lib/sandbox/commands/enter.js +18 -4
  40. package/dist/lib/sandbox/config.js +8 -12
  41. package/dist/lib/sandbox/control/executor.js +131 -39
  42. package/dist/lib/sandbox/control/lifecycle.js +55 -24
  43. package/dist/lib/sandbox/control/server.js +18 -16
  44. package/dist/lib/sandbox/mounts.js +3 -2
  45. package/dist/lib/sandbox/recovery.js +123 -22
  46. package/dist/lib/sandbox/workspace-identity.js +14 -0
  47. package/dist/lib/sandbox/workspace-view.js +8 -9
  48. package/dist/lib/self-update.js +278 -0
  49. package/dist/lib/server/process-state.js +2 -2
  50. package/dist/lib/server/protocol.js +5 -5
  51. package/dist/lib/task/activity-log.js +4 -1
  52. package/dist/lib/task/artifact-lifecycle.js +6 -4
  53. package/dist/lib/task/codex-orchestration.js +1 -1
  54. package/dist/lib/task/command-options.js +1 -3
  55. package/dist/lib/task/commands/cat.js +0 -5
  56. package/dist/lib/task/commands/decisions.js +76 -92
  57. package/dist/lib/task/commands/files.js +6 -6
  58. package/dist/lib/task/commands/grep.js +25 -61
  59. package/dist/lib/task/commands/issue-body.js +6 -6
  60. package/dist/lib/task/commands/log.js +25 -10
  61. package/dist/lib/task/commands/show.js +5 -6
  62. package/dist/lib/task/commands/status.js +8 -8
  63. package/dist/lib/task/commit-intent.js +100 -0
  64. package/dist/lib/task/commit-operation.js +181 -91
  65. package/dist/lib/task/commit-policy.js +1 -1
  66. package/dist/lib/task/control-authority.js +431 -0
  67. package/dist/lib/task/create.js +39 -8
  68. package/dist/lib/task/current-contract.js +35 -0
  69. package/dist/lib/task/decision-details.js +218 -0
  70. package/dist/lib/task/decision-intents.js +5 -2
  71. package/dist/lib/task/delivery-target.js +97 -0
  72. package/dist/lib/task/delivery.js +153 -0
  73. package/dist/lib/task/events.js +11 -5
  74. package/dist/lib/task/human-override.js +5 -2
  75. package/dist/lib/task/index.js +19 -20
  76. package/dist/lib/task/ledger-intents.js +8 -9
  77. package/dist/lib/task/ledger.js +13 -6
  78. package/dist/lib/task/lifecycle.js +122 -9
  79. package/dist/lib/task/orchestration.js +105 -75
  80. package/dist/lib/task/pr-delivery-fact.js +182 -0
  81. package/dist/lib/task/review-artifacts.js +31 -12
  82. package/dist/lib/task/review-finalization.js +13 -4
  83. package/dist/lib/task/review-fingerprint.js +8 -0
  84. package/dist/lib/task/verification-engine.js +86 -39
  85. package/dist/lib/task/verification-review.js +2 -2
  86. package/dist/lib/task/workspace-snapshot.js +5 -11
  87. package/dist/lib/task/write.js +11 -1
  88. package/dist/lib/update.js +13 -35
  89. package/dist/lib/version.js +5 -1
  90. package/dist/lifecycle-build-manifest.json +3 -3
  91. package/lib/agent-client.ts +0 -1
  92. package/lib/agent-clients/adapters/codex-lifecycle/build-identity.ts +105 -10
  93. package/lib/agent-clients/adapters/codex-lifecycle/manifest-files.json +12 -1
  94. package/lib/agent-clients/adapters/opencode-sandbox.ts +0 -5
  95. package/lib/agent-clients/adapters/traecli.ts +7 -8
  96. package/lib/agent-clients/config.ts +14 -144
  97. package/lib/agent-clients/reconcile.ts +1 -12
  98. package/lib/agent-clients/schema.ts +5 -4
  99. package/lib/agent-clients/tokens.ts +5 -18
  100. package/lib/decide.ts +12 -22
  101. package/lib/defaults.json +8 -0
  102. package/lib/git/workflow.ts +38 -1
  103. package/lib/init.ts +5 -2
  104. package/lib/internal/git-workflow.ts +7 -1
  105. package/lib/internal/platform-pr.ts +8 -1
  106. package/lib/internal/release-workflow.ts +0 -1
  107. package/lib/internal/task-delivery.ts +53 -0
  108. package/lib/internal/task-finalization.ts +27 -13
  109. package/lib/internal/task-ledger.ts +8 -2
  110. package/lib/internal/task-lifecycle.ts +33 -76
  111. package/lib/internal/task-orchestration.ts +33 -190
  112. package/lib/internal/task-validate.ts +3 -2
  113. package/lib/merge.ts +236 -120
  114. package/lib/platform/github-client.ts +8 -1
  115. package/lib/platform/pr-checks.ts +7 -5
  116. package/lib/platform/pr-summary.ts +10 -7
  117. package/lib/platform/pull-requests.ts +425 -87
  118. package/lib/platform/verification-required.ts +12 -2
  119. package/lib/platform/verification-sync.ts +9 -4
  120. package/lib/pr-review/evidence-grading.ts +7 -4
  121. package/lib/process-data/normalize.ts +2 -8
  122. package/lib/run/host.ts +63 -14
  123. package/lib/sandbox/agent-client-reconciler.ts +5 -15
  124. package/lib/sandbox/commands/create.ts +4 -4
  125. package/lib/sandbox/commands/enter.ts +24 -4
  126. package/lib/sandbox/config.ts +9 -14
  127. package/lib/sandbox/control/container-identity.ts +2 -2
  128. package/lib/sandbox/control/executor.ts +148 -51
  129. package/lib/sandbox/control/lifecycle.ts +59 -31
  130. package/lib/sandbox/control/protocol.ts +1 -3
  131. package/lib/sandbox/control/server.ts +15 -12
  132. package/lib/sandbox/control/state.ts +7 -7
  133. package/lib/sandbox/mounts.ts +4 -3
  134. package/lib/sandbox/recovery.ts +162 -34
  135. package/lib/sandbox/tools.ts +1 -1
  136. package/lib/sandbox/workspace-identity.ts +28 -0
  137. package/lib/sandbox/workspace-view.ts +14 -10
  138. package/lib/self-update.ts +341 -0
  139. package/lib/server/process-state.ts +2 -2
  140. package/lib/server/protocol.ts +5 -5
  141. package/lib/task/activity-log.ts +6 -1
  142. package/lib/task/artifact-lifecycle.ts +7 -5
  143. package/lib/task/codex-orchestration.ts +2 -1
  144. package/lib/task/command-options.ts +1 -2
  145. package/lib/task/commands/cat.ts +0 -4
  146. package/lib/task/commands/decisions.ts +80 -75
  147. package/lib/task/commands/files.ts +6 -6
  148. package/lib/task/commands/grep.ts +23 -51
  149. package/lib/task/commands/issue-body.ts +6 -6
  150. package/lib/task/commands/log.ts +22 -10
  151. package/lib/task/commands/show.ts +5 -6
  152. package/lib/task/commands/status.ts +8 -8
  153. package/lib/task/commit-intent.ts +137 -0
  154. package/lib/task/commit-operation.ts +161 -79
  155. package/lib/task/commit-policy.ts +1 -2
  156. package/lib/task/control-authority.ts +563 -0
  157. package/lib/task/create.ts +40 -10
  158. package/lib/task/current-contract.ts +49 -0
  159. package/lib/task/decision-details.ts +280 -0
  160. package/lib/task/decision-intents.ts +7 -2
  161. package/lib/task/delivery-target.ts +130 -0
  162. package/lib/task/delivery.ts +160 -0
  163. package/lib/task/events.ts +10 -5
  164. package/lib/task/human-override.ts +5 -2
  165. package/lib/task/index.ts +19 -20
  166. package/lib/task/ledger-intents.ts +6 -8
  167. package/lib/task/ledger.ts +17 -7
  168. package/lib/task/lifecycle.ts +113 -4
  169. package/lib/task/orchestration.ts +102 -80
  170. package/lib/task/pr-delivery-fact.ts +254 -0
  171. package/lib/task/review-artifacts.ts +53 -15
  172. package/lib/task/review-finalization.ts +21 -5
  173. package/lib/task/review-fingerprint.ts +10 -0
  174. package/lib/task/verification-engine.ts +78 -46
  175. package/lib/task/verification-review.ts +3 -1
  176. package/lib/task/workspace-snapshot.ts +4 -13
  177. package/lib/task/write.ts +20 -1
  178. package/lib/update.ts +14 -38
  179. package/lib/version.ts +6 -1
  180. package/package.json +1 -1
  181. package/templates/.agents/README.en.md +5 -3
  182. package/templates/.agents/README.zh-CN.md +5 -3
  183. package/templates/.agents/rules/README.en.md +4 -2
  184. package/templates/.agents/rules/README.zh-CN.md +4 -2
  185. package/templates/.agents/rules/compatibility-policy.en.md +5 -4
  186. package/templates/.agents/rules/compatibility-policy.zh-CN.md +5 -4
  187. package/templates/.agents/rules/create-issue.en.md +11 -2
  188. package/templates/.agents/rules/create-issue.zh-CN.md +24 -2
  189. package/templates/.agents/rules/human-decision-context.en.md +9 -7
  190. package/templates/.agents/rules/human-decision-context.zh-CN.md +9 -7
  191. package/templates/.agents/rules/{issue-fields.github.en.md → issue-fields.en.md} +1 -1
  192. package/templates/.agents/rules/{issue-fields.github.zh-CN.md → issue-fields.zh-CN.md} +1 -1
  193. package/templates/.agents/rules/issue-pr-commands.en.md +5 -18
  194. package/templates/.agents/rules/issue-pr-commands.zh-CN.md +1 -1
  195. package/templates/.agents/rules/issue-sync.en.md +26 -5
  196. package/templates/.agents/rules/issue-sync.zh-CN.md +62 -5
  197. package/templates/.agents/rules/label-milestone-setup.en.md +15 -2
  198. package/templates/.agents/rules/label-milestone-setup.zh-CN.md +15 -2
  199. package/templates/.agents/rules/local-artifact-repair.en.md +46 -0
  200. package/templates/.agents/rules/local-artifact-repair.zh-CN.md +46 -0
  201. package/templates/.agents/rules/milestone-inference.en.md +12 -2
  202. package/templates/.agents/rules/milestone-inference.zh-CN.md +25 -3
  203. package/templates/.agents/rules/next-step-output.en.md +3 -3
  204. package/templates/.agents/rules/next-step-output.zh-CN.md +3 -3
  205. package/templates/.agents/rules/no-mid-flow-questions.en.md +1 -1
  206. package/templates/.agents/rules/no-mid-flow-questions.zh-CN.md +1 -1
  207. package/templates/.agents/rules/pr-sync.en.md +23 -14
  208. package/templates/.agents/rules/pr-sync.zh-CN.md +23 -2
  209. package/templates/.agents/rules/release-commands.en.md +42 -3
  210. package/templates/.agents/rules/release-commands.zh-CN.md +42 -3
  211. package/templates/.agents/rules/review-handshake.en.md +1 -1
  212. package/templates/.agents/rules/review-handshake.zh-CN.md +1 -1
  213. package/templates/.agents/rules/security-alerts.en.md +17 -2
  214. package/templates/.agents/rules/security-alerts.zh-CN.md +17 -2
  215. package/templates/.agents/rules/sync-content-generation.en.md +8 -0
  216. package/templates/.agents/rules/sync-content-generation.zh-CN.md +8 -0
  217. package/templates/.agents/rules/task-management.en.md +2 -3
  218. package/templates/.agents/rules/task-management.zh-CN.md +2 -3
  219. package/templates/.agents/scripts/security-alerts.github.sh +151 -0
  220. package/templates/.agents/scripts/security-alerts.sh +31 -0
  221. package/templates/.agents/skills/analyze-task/SKILL.en.md +4 -3
  222. package/templates/.agents/skills/analyze-task/SKILL.zh-CN.md +4 -3
  223. package/templates/.agents/skills/block-task/SKILL.en.md +2 -2
  224. package/templates/.agents/skills/block-task/SKILL.zh-CN.md +2 -2
  225. package/templates/.agents/skills/cancel-task/SKILL.en.md +2 -2
  226. package/templates/.agents/skills/cancel-task/SKILL.zh-CN.md +2 -2
  227. package/templates/.agents/skills/check-task/SKILL.en.md +2 -2
  228. package/templates/.agents/skills/check-task/SKILL.zh-CN.md +2 -2
  229. package/templates/.agents/skills/close-codescan/SKILL.en.md +3 -3
  230. package/templates/.agents/skills/close-codescan/SKILL.zh-CN.md +3 -3
  231. package/templates/.agents/skills/close-dependabot/SKILL.en.md +3 -3
  232. package/templates/.agents/skills/close-dependabot/SKILL.zh-CN.md +3 -3
  233. package/templates/.agents/skills/code-task/SKILL.en.md +8 -5
  234. package/templates/.agents/skills/code-task/SKILL.zh-CN.md +9 -6
  235. package/templates/.agents/skills/commit/SKILL.en.md +30 -10
  236. package/templates/.agents/skills/commit/SKILL.zh-CN.md +6 -7
  237. package/templates/.agents/skills/commit/config/verify.json +1 -1
  238. package/templates/.agents/skills/commit/reference/commit-orchestration.en.md +3 -3
  239. package/templates/.agents/skills/commit/reference/commit-orchestration.zh-CN.md +3 -3
  240. package/templates/.agents/skills/commit/reference/pr-summary-sync.en.md +1 -1
  241. package/templates/.agents/skills/commit/reference/pr-summary-sync.zh-CN.md +1 -1
  242. package/templates/.agents/skills/commit/reference/task-status-update.en.md +2 -2
  243. package/templates/.agents/skills/commit/reference/task-status-update.zh-CN.md +2 -2
  244. package/templates/.agents/skills/complete-manual-validation/SKILL.en.md +7 -6
  245. package/templates/.agents/skills/complete-manual-validation/SKILL.zh-CN.md +7 -6
  246. package/templates/.agents/skills/complete-manual-validation/config/verify.en.json +1 -1
  247. package/templates/.agents/skills/complete-manual-validation/config/verify.zh-CN.json +1 -1
  248. package/templates/.agents/skills/complete-manual-validation/reference/summary-update.en.md +1 -1
  249. package/templates/.agents/skills/complete-manual-validation/reference/summary-update.zh-CN.md +1 -1
  250. package/templates/.agents/skills/complete-task/SKILL.en.md +13 -13
  251. package/templates/.agents/skills/complete-task/SKILL.zh-CN.md +13 -13
  252. package/templates/.agents/skills/complete-task/reference/external-delivery.en.md +2 -2
  253. package/templates/.agents/skills/complete-task/reference/external-delivery.zh-CN.md +2 -2
  254. package/templates/.agents/skills/create-pr/SKILL.en.md +9 -11
  255. package/templates/.agents/skills/create-pr/SKILL.zh-CN.md +9 -11
  256. package/templates/.agents/skills/create-pr/reference/change-report.en.md +9 -4
  257. package/templates/.agents/skills/create-pr/reference/change-report.zh-CN.md +9 -4
  258. package/templates/.agents/skills/create-pr/scripts/change-report.mjs +203 -0
  259. package/templates/.agents/skills/create-release-note/SKILL.en.md +5 -6
  260. package/templates/.agents/skills/create-release-note/SKILL.zh-CN.md +5 -6
  261. package/templates/.agents/skills/create-task/SKILL.en.md +2 -1
  262. package/templates/.agents/skills/create-task/SKILL.zh-CN.md +2 -1
  263. package/templates/.agents/skills/import-codescan/SKILL.en.md +1 -1
  264. package/templates/.agents/skills/import-codescan/SKILL.zh-CN.md +1 -1
  265. package/templates/.agents/skills/import-dependabot/SKILL.en.md +1 -1
  266. package/templates/.agents/skills/import-dependabot/SKILL.zh-CN.md +1 -1
  267. package/templates/.agents/skills/import-issue/SKILL.en.md +1 -1
  268. package/templates/.agents/skills/import-issue/SKILL.zh-CN.md +1 -1
  269. package/templates/.agents/skills/init-labels/SKILL.en.md +9 -10
  270. package/templates/.agents/skills/init-labels/SKILL.zh-CN.md +9 -10
  271. package/templates/.agents/skills/init-labels/scripts/init-labels.github.sh +57 -1
  272. package/templates/.agents/skills/init-labels/scripts/init-labels.sh +27 -1
  273. package/templates/.agents/skills/init-milestones/SKILL.en.md +3 -5
  274. package/templates/.agents/skills/init-milestones/SKILL.zh-CN.md +3 -5
  275. package/templates/.agents/skills/plan-task/SKILL.en.md +4 -3
  276. package/templates/.agents/skills/plan-task/SKILL.zh-CN.md +4 -3
  277. package/templates/.agents/skills/restore-task/SKILL.en.md +1 -1
  278. package/templates/.agents/skills/restore-task/SKILL.zh-CN.md +1 -1
  279. package/templates/.agents/skills/review-analysis/SKILL.en.md +8 -5
  280. package/templates/.agents/skills/review-analysis/SKILL.zh-CN.md +8 -5
  281. package/templates/.agents/skills/review-analysis/config/verify.en.json +1 -0
  282. package/templates/.agents/skills/review-analysis/config/verify.zh-CN.json +1 -0
  283. package/templates/.agents/skills/review-analysis/reference/output-templates.en.md +18 -0
  284. package/templates/.agents/skills/review-analysis/reference/output-templates.zh-CN.md +18 -0
  285. package/templates/.agents/skills/review-code/SKILL.en.md +11 -8
  286. package/templates/.agents/skills/review-code/SKILL.zh-CN.md +11 -8
  287. package/templates/.agents/skills/review-code/config/verify.en.json +1 -0
  288. package/templates/.agents/skills/review-code/config/verify.zh-CN.json +1 -0
  289. package/templates/.agents/skills/review-code/reference/migration-risks.en.md +2 -1
  290. package/templates/.agents/skills/review-code/reference/migration-risks.zh-CN.md +2 -1
  291. package/templates/.agents/skills/review-code/reference/output-templates.en.md +19 -1
  292. package/templates/.agents/skills/review-code/reference/output-templates.zh-CN.md +19 -1
  293. package/templates/.agents/skills/review-code/reference/report-template.en.md +4 -2
  294. package/templates/.agents/skills/review-code/reference/report-template.zh-CN.md +4 -2
  295. package/templates/.agents/skills/review-plan/SKILL.en.md +8 -5
  296. package/templates/.agents/skills/review-plan/SKILL.zh-CN.md +8 -5
  297. package/templates/.agents/skills/review-plan/config/verify.en.json +1 -0
  298. package/templates/.agents/skills/review-plan/config/verify.zh-CN.json +1 -0
  299. package/templates/.agents/skills/review-plan/reference/output-templates.en.md +18 -0
  300. package/templates/.agents/skills/review-plan/reference/output-templates.zh-CN.md +18 -0
  301. package/templates/.agents/skills/review-pr/SKILL.en.md +1 -0
  302. package/templates/.agents/skills/review-pr/SKILL.zh-CN.md +1 -0
  303. package/templates/.agents/skills/review-pr/reference/evidence-grading.en.md +2 -2
  304. package/templates/.agents/skills/review-pr/reference/evidence-grading.zh-CN.md +2 -2
  305. package/templates/.agents/skills/run-manual-validation/SKILL.en.md +5 -0
  306. package/templates/.agents/skills/run-manual-validation/SKILL.zh-CN.md +5 -0
  307. package/templates/.agents/skills/run-task/SKILL.en.md +5 -1
  308. package/templates/.agents/skills/run-task/SKILL.zh-CN.md +5 -1
  309. package/templates/.agents/skills/update-agent-infra/SKILL.en.md +2 -2
  310. package/templates/.agents/skills/update-agent-infra/SKILL.zh-CN.md +2 -2
  311. package/templates/.agents/skills/update-agent-infra/scripts/sync-templates.js +144 -109
  312. package/templates/.agents/skills/watch-pr/SKILL.en.md +5 -5
  313. package/templates/.agents/skills/watch-pr/SKILL.zh-CN.md +5 -5
  314. package/templates/.agents/templates/task.en.md +6 -2
  315. package/templates/.agents/templates/task.zh-CN.md +6 -2
  316. package/templates/.agents/workflows/bug-fix.en.yaml +9 -8
  317. package/templates/.agents/workflows/bug-fix.zh-CN.yaml +9 -8
  318. package/templates/.agents/workflows/feature-development.en.yaml +9 -8
  319. package/templates/.agents/workflows/feature-development.zh-CN.yaml +9 -8
  320. package/templates/.agents/workflows/refactoring.en.yaml +9 -8
  321. package/templates/.agents/workflows/refactoring.zh-CN.yaml +9 -8
  322. package/templates/.claude/commands/analyze-task.en.md +1 -1
  323. package/templates/.claude/commands/analyze-task.zh-CN.md +1 -1
  324. package/templates/.claude/commands/block-task.en.md +1 -1
  325. package/templates/.claude/commands/block-task.zh-CN.md +1 -1
  326. package/templates/.claude/commands/cancel-task.en.md +1 -1
  327. package/templates/.claude/commands/cancel-task.zh-CN.md +1 -1
  328. package/templates/.claude/commands/check-task.en.md +1 -1
  329. package/templates/.claude/commands/check-task.zh-CN.md +1 -1
  330. package/templates/.claude/commands/code-task.en.md +1 -1
  331. package/templates/.claude/commands/code-task.zh-CN.md +1 -1
  332. package/templates/.claude/commands/commit.en.md +1 -1
  333. package/templates/.claude/commands/commit.zh-CN.md +1 -1
  334. package/templates/.claude/commands/complete-manual-validation.en.md +1 -1
  335. package/templates/.claude/commands/complete-manual-validation.zh-CN.md +1 -1
  336. package/templates/.claude/commands/complete-task.en.md +1 -1
  337. package/templates/.claude/commands/complete-task.zh-CN.md +1 -1
  338. package/templates/.claude/commands/create-pr.en.md +1 -1
  339. package/templates/.claude/commands/create-pr.zh-CN.md +1 -1
  340. package/templates/.claude/commands/plan-task.en.md +1 -1
  341. package/templates/.claude/commands/plan-task.zh-CN.md +1 -1
  342. package/templates/.claude/commands/review-analysis.en.md +1 -1
  343. package/templates/.claude/commands/review-analysis.zh-CN.md +1 -1
  344. package/templates/.claude/commands/review-code.en.md +1 -1
  345. package/templates/.claude/commands/review-code.zh-CN.md +1 -1
  346. package/templates/.claude/commands/review-plan.en.md +1 -1
  347. package/templates/.claude/commands/review-plan.zh-CN.md +1 -1
  348. package/templates/.claude/commands/run-manual-validation.en.md +1 -1
  349. package/templates/.claude/commands/run-manual-validation.zh-CN.md +1 -1
  350. package/templates/.claude/commands/run-task.en.md +1 -1
  351. package/templates/.claude/commands/run-task.zh-CN.md +1 -1
  352. package/templates/.claude/commands/watch-pr.en.md +1 -1
  353. package/templates/.claude/commands/watch-pr.zh-CN.md +1 -1
  354. package/templates/{.trae/skills → .traecli/commands}/update-agent-infra.en.md +0 -1
  355. package/templates/{.trae/skills → .traecli/commands}/update-agent-infra.zh-CN.md +0 -1
  356. package/dist/lib/builtin-tuis.js +0 -40
  357. package/lib/builtin-tuis.ts +0 -56
  358. package/templates/.agents/rules/create-issue.github.en.md +0 -14
  359. package/templates/.agents/rules/create-issue.github.zh-CN.md +0 -27
  360. package/templates/.agents/rules/issue-pr-commands.github.en.md +0 -34
  361. package/templates/.agents/rules/issue-pr-commands.github.zh-CN.md +0 -49
  362. package/templates/.agents/rules/issue-sync.github.en.md +0 -40
  363. package/templates/.agents/rules/issue-sync.github.zh-CN.md +0 -76
  364. package/templates/.agents/rules/label-milestone-setup.github.en.md +0 -60
  365. package/templates/.agents/rules/label-milestone-setup.github.zh-CN.md +0 -60
  366. package/templates/.agents/rules/milestone-inference.github.en.md +0 -15
  367. package/templates/.agents/rules/milestone-inference.github.zh-CN.md +0 -27
  368. package/templates/.agents/rules/pr-checks-commands.github.en.md +0 -18
  369. package/templates/.agents/rules/pr-checks-commands.github.zh-CN.md +0 -34
  370. package/templates/.agents/rules/pr-sync.github.en.md +0 -43
  371. package/templates/.agents/rules/pr-sync.github.zh-CN.md +0 -69
  372. package/templates/.agents/rules/release-commands.github.en.md +0 -38
  373. package/templates/.agents/rules/release-commands.github.zh-CN.md +0 -38
  374. package/templates/.agents/rules/security-alerts.github.en.md +0 -43
  375. package/templates/.agents/rules/security-alerts.github.zh-CN.md +0 -43
package/lib/update.ts CHANGED
@@ -20,13 +20,12 @@ type UpdateConfig = {
20
20
  org: string;
21
21
  language: string;
22
22
  platform?: { type?: string };
23
- requiresPullRequest?: boolean; // legacy field; read-only, migrated to prFlow then removed
24
23
  prFlow?: 'required' | 'disabled';
25
24
  sandbox?: Record<string, unknown>;
26
25
  task?: { shortIdLength: number };
26
+ delivery?: { remote?: string; baseRef?: string };
27
27
  labels?: Record<string, unknown>;
28
28
  files?: Partial<FileRegistry>;
29
- tuis?: unknown;
30
29
  agentClients?: unknown;
31
30
  customTUIs?: unknown;
32
31
  };
@@ -35,6 +34,7 @@ type Defaults = {
35
34
  platform: { type: string };
36
35
  sandbox: Record<string, unknown>;
37
36
  task: { shortIdLength: number };
37
+ delivery: { remote: string; baseRef: string };
38
38
  labels: Record<string, unknown>;
39
39
  files: FileRegistry;
40
40
  };
@@ -46,28 +46,9 @@ const defaults = JSON.parse(
46
46
  const CONFIG_DIR = '.agents';
47
47
  const CONFIG_PATH = path.join(CONFIG_DIR, '.airc.json');
48
48
 
49
- // One-time migration of the legacy project-level PR switch to the three-state
50
- // `prFlow` preference. `true` (the old default / "PR flow on") maps to the
51
- // strong constraint `required`; `false` maps to `disabled`. A missing or
52
- // already-migrated config is left untouched (idempotent). Returns the new
53
- // prFlow value when a migration happened, otherwise null.
54
- function migratePrFlow(config: UpdateConfig): 'required' | 'disabled' | null {
55
- if (config.requiresPullRequest === true) {
56
- delete config.requiresPullRequest;
57
- config.prFlow = 'required';
58
- return 'required';
59
- }
60
- if (config.requiresPullRequest === false) {
61
- delete config.requiresPullRequest;
62
- config.prFlow = 'disabled';
63
- return 'disabled';
64
- }
65
- return null;
66
- }
67
-
68
- async function cmdUpdate(): Promise<void> {
49
+ async function cmdSync(): Promise<void> {
69
50
  console.log('');
70
- console.log(' ai update');
51
+ console.log(' ai sync');
71
52
  console.log(' ==================================');
72
53
  console.log('');
73
54
 
@@ -104,11 +85,12 @@ async function cmdUpdate(): Promise<void> {
104
85
  const sandboxAdded = !config.sandbox;
105
86
  const taskAdded = !config.task;
106
87
  const labelsAdded = !config.labels;
107
- const prFlowMigrated = migratePrFlow(config);
88
+ const deliveryAdded = !config.delivery;
108
89
  if (platformAdded) config.platform = structuredClone(defaults.platform);
109
90
  if (sandboxAdded) config.sandbox = structuredClone(defaults.sandbox);
110
91
  if (taskAdded) config.task = structuredClone(defaults.task);
111
92
  if (labelsAdded) config.labels = structuredClone(defaults.labels);
93
+ if (deliveryAdded) config.delivery = structuredClone(defaults.delivery);
112
94
 
113
95
  const workflowPlan = planAgentClientReconciliation({
114
96
  config: config as unknown as Record<string, unknown>,
@@ -119,7 +101,7 @@ async function cmdUpdate(): Promise<void> {
119
101
  language
120
102
  });
121
103
 
122
- info(`Updating seed files for: ${project}`);
104
+ info(`Syncing seed files for: ${project}`);
123
105
  console.log('');
124
106
 
125
107
  // update skill
@@ -137,12 +119,6 @@ async function cmdUpdate(): Promise<void> {
137
119
  replacements
138
120
  );
139
121
  ok('Updated .agents/scripts/lib/agent-infra-package.js');
140
- try {
141
- fs.unlinkSync(path.join('.agents', 'skills', 'update-agent-infra', 'scripts', 'sync-templates.cjs'));
142
- } catch {
143
- // Ignore missing legacy script from pre-ESM installs.
144
- }
145
-
146
122
  const added = {
147
123
  managed: workflowPlan.projectAssets.registry.managed.filter(
148
124
  (entry) => !currentRegistry.managed.includes(entry)
@@ -165,7 +141,7 @@ async function cmdUpdate(): Promise<void> {
165
141
  for (const entry of added.merged) {
166
142
  ok(` merged: ${entry}`);
167
143
  }
168
- } else if (platformAdded || sandboxAdded || taskAdded || labelsAdded || prFlowMigrated) {
144
+ } else if (platformAdded || sandboxAdded || taskAdded || labelsAdded) {
169
145
  if (platformAdded) {
170
146
  info(`Default platform config added to ${CONFIG_PATH}.`);
171
147
  }
@@ -178,8 +154,8 @@ async function cmdUpdate(): Promise<void> {
178
154
  if (labelsAdded) {
179
155
  info(`Default labels.in config added to ${CONFIG_PATH}.`);
180
156
  }
181
- if (prFlowMigrated) {
182
- info(`Migrated legacy requiresPullRequest to prFlow="${prFlowMigrated}" in ${CONFIG_PATH}.`);
157
+ if (deliveryAdded) {
158
+ info(`Default delivery target added to ${CONFIG_PATH}.`);
183
159
  }
184
160
  } else {
185
161
  info(`File registry changed in ${CONFIG_PATH}.`);
@@ -196,15 +172,15 @@ async function cmdUpdate(): Promise<void> {
196
172
  if (hasNewEntries && platformAdded) {
197
173
  info(`Default platform config added to ${CONFIG_PATH}.`);
198
174
  }
199
- if (hasNewEntries && prFlowMigrated) {
200
- info(`Migrated legacy requiresPullRequest to prFlow="${prFlowMigrated}" in ${CONFIG_PATH}.`);
175
+ if (hasNewEntries && deliveryAdded) {
176
+ info(`Default delivery target added to ${CONFIG_PATH}.`);
201
177
  }
202
178
  ok(`Updated ${CONFIG_PATH}`);
203
179
  }
204
180
 
205
181
  // done
206
182
  console.log('');
207
- ok('Seed files updated successfully!');
183
+ ok('Seed files synced successfully!');
208
184
  console.log('');
209
185
  if (workflowPlan.nextSteps.length === 0) {
210
186
  console.log(' No Agent Client project integration enabled.');
@@ -220,4 +196,4 @@ async function cmdUpdate(): Promise<void> {
220
196
  }
221
197
  }
222
198
 
223
- export { cmdUpdate };
199
+ export { cmdSync };
package/lib/version.ts CHANGED
@@ -11,5 +11,10 @@ if (!packageJsonUrl) {
11
11
 
12
12
  const { version } = JSON.parse(readFileSync(packageJsonUrl, 'utf8'));
13
13
  const VERSION = `v${version}`;
14
+ const AGENT_INFRA_VERSION_PATTERN = /^v\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/;
14
15
 
15
- export { VERSION };
16
+ function isValidAgentInfraVersion(value: unknown): value is string {
17
+ return typeof value === 'string' && AGENT_INFRA_VERSION_PATTERN.test(value);
18
+ }
19
+
20
+ export { VERSION, isValidAgentInfraVersion };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fitlab-ai/agent-infra",
3
- "version": "0.9.10",
3
+ "version": "0.9.12",
4
4
  "description": "Bootstrap tool for AI multi-tool collaboration infrastructure — works with Claude Code, Codex, Antigravity CLI, and OpenCode",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -124,7 +124,7 @@ To adapt agent-infra to a private code-hosting platform:
124
124
 
125
125
  1. Set `.agents/.airc.json` `platform.type` to a stable identifier such as `my-platform`.
126
126
  2. Copy the generated rule files in `.agents/rules/` and adapt them to your platform's CLI or API while keeping the runtime filenames unchanged.
127
- 3. Add the customized rule files to `.agents/.airc.json` `files.ejected` so future `agent-infra update` runs do not overwrite them.
127
+ 3. Add the customized rule files to `.agents/.airc.json` `files.ejected` so future `ai sync` runs do not overwrite them.
128
128
  4. If you maintain a fork of the template source, add matching `.{platform}.` template variants before adding that platform identifier to the sync logic.
129
129
  5. Validate the customized workflow on a test task before rolling it out broadly.
130
130
 
@@ -227,7 +227,7 @@ Ordinary `managed` files keep their overwrite semantics. A small set of platform
227
227
 
228
228
  ## Agent Client Configuration
229
229
 
230
- Use the top-level `.agents/.airc.json` `agentClients` array to configure all four built-in clients (`claude-code`, `codex`, `antigravity-cli`, `opencode`). Each canonical entry has three required fields and one optional orchestration policy:
230
+ Use the top-level `.agents/.airc.json` `agentClients` array to configure all five built-in clients (`claude-code`, `codex`, `antigravity-cli`, `opencode`, `traecli`). Each canonical entry has three required fields and one optional orchestration policy:
231
231
 
232
232
  | Field | Meaning |
233
233
  |-------|---------|
@@ -250,7 +250,9 @@ ai agent-client configure
250
250
 
251
251
  `enable` and `disable` only change `enabled`; `configure` edits both dimensions. `ai init` asks which clients to enable and preserves the displayed defaults when you press Enter. All clients default to `installInSandbox: true`.
252
252
 
253
- Legacy `tuis` and built-in client ids in `sandbox.tools` are migration inputs only. The next config-writing command converts them into the canonical `agentClients` array and removes the legacy fields. If canonical and legacy values conflict, the command stops without modifying files so the conflict can be resolved explicitly.
253
+ TraeCode CLI uses `.agents/skills/` as the canonical Skill source. agent-infra generates lightweight slash-command wrappers under `.traecli/commands/`; each wrapper reads the corresponding shared Skill and forwards `$ARGUMENTS` when that Skill declares arguments. It does not mirror Skill packages into `.trae/skills/`, which remains user-owned for intentional Trae-specific overrides.
254
+
255
+ `agentClients` is the sole source of truth for built-in client state. The top-level array must contain all five built-in clients in the fixed canonical order; `sandbox.tools` lists only non-client tools such as `agent-infra` and custom tools. A legacy `tuis` field or a built-in client id in `sandbox.tools` is rejected, and configuration is never rewritten automatically.
254
256
 
255
257
  ### Side effects of disabling an Agent Client
256
258
 
@@ -122,7 +122,7 @@
122
122
 
123
123
  1. 在 `.agents/.airc.json` 中把 `platform.type` 设为稳定标识,例如 `my-platform`。
124
124
  2. 以 `.agents/rules/` 下已生成的规则文件为起点,改写为你的平台 CLI 或 API 调用,同时保持运行时文件名不变。
125
- 3. 将这些自定义规则文件加入 `.agents/.airc.json` 的 `files.ejected`,避免后续执行 `agent-infra update` 时被覆盖。
125
+ 3. 将这些自定义规则文件加入 `.agents/.airc.json` 的 `files.ejected`,避免后续执行 `ai sync` 时被覆盖。
126
126
  4. 如果你维护的是模板源码分支或私有 fork,需要先补齐对应的 `.{platform}.` 模板变体,再把该平台标识加入模板同步逻辑。
127
127
  5. 在正式推广前,先用一个测试任务完整验证工作流和 gate 校验。
128
128
 
@@ -225,7 +225,7 @@ disable-model-invocation: true # 可选;由支持该能力的 TUI 适配器
225
225
 
226
226
  ## Agent Client 配置
227
227
 
228
- `.agents/.airc.json` 顶层 `agentClients` 数组用于配置全部四个内建客户端(`claude-code`、`codex`、`antigravity-cli`、`opencode`)。每个规范条目包含三个必填字段和一个可选编排策略:
228
+ `.agents/.airc.json` 顶层 `agentClients` 数组用于配置全部五个内建客户端(`claude-code`、`codex`、`antigravity-cli`、`opencode`、`traecli`)。每个规范条目包含三个必填字段和一个可选编排策略:
229
229
 
230
230
  | 字段 | 含义 |
231
231
  |------|------|
@@ -248,7 +248,9 @@ ai agent-client configure
248
248
 
249
249
  `enable` 和 `disable` 只修改 `enabled`;`configure` 同时编辑两个维度。`ai init` 会询问启用哪些客户端,直接回车会保留界面展示的默认值。所有客户端的 `installInSandbox` 默认均为 `true`。
250
250
 
251
- 旧 `tuis` 字段和 `sandbox.tools` 中的内建客户端 id 仅作为迁移输入。下一次写配置的命令会将其转换为规范 `agentClients` 数组并移除旧字段。若规范配置与旧配置冲突,命令会在修改文件前停止,要求显式解决冲突。
251
+ TraeCode CLI 以 `.agents/skills/` 作为 Skill 的唯一权威源。agent-infra 仅在 `.traecli/commands/` 下生成轻量 slash-command 包装文件;每个包装文件读取对应的共享 Skill,并在该 Skill 声明参数时转发 `$ARGUMENTS`。它不会把 Skill 包镜像到 `.trae/skills/`;该目录继续由用户所有,仅用于有意添加的 Trae 专属覆盖。
252
+
253
+ `agentClients` 是内建客户端状态的唯一配置来源。顶层数组必须按固定规范顺序包含全部五个内建客户端;`sandbox.tools` 只列出 `agent-infra` 和自定义工具等非客户端工具。旧 `tuis` 字段或 `sandbox.tools` 中的内建客户端 id 会被拒绝,配置不会被自动改写。
252
254
 
253
255
  ### 取消 Agent Client 的副作用
254
256
 
@@ -13,6 +13,7 @@ so you can quickly find "which ones to read" without opening each file.
13
13
  - [`version-stamp.md`](version-stamp.md) — How and when to stamp `agent_infra_version`.
14
14
  - [`debugging-guide.md`](debugging-guide.md) — Structured debugging flow: gather evidence → form hypothesis → verify hypothesis → fix the root cause; no blind patch-and-retry.
15
15
  - [`compatibility-policy.md`](compatibility-policy.md) — Compatibility by exception: admission evidence, implementation boundaries, exit conditions, and lifecycle review requirements.
16
+ - [`sync-content-generation.md`](sync-content-generation.md) — Producer-side Markdown constraints for task and lifecycle content synchronized to Issues.
16
17
 
17
18
  ## Issue / PR
18
19
 
@@ -29,11 +30,12 @@ so you can quickly find "which ones to read" without opening each file.
29
30
  - [`lifecycle-orchestration.md`](lifecycle-orchestration.md) — Fresh executor/reviewer, one-use receipt, pause/recovery, and safe endpoint rules for `run-task`.
30
31
  - [`review-handshake.md`](review-handshake.md) — Three-stage bidirectional review handshake: four-state disposition, symmetric evidence, disagreement ledger, convergence and post-review commit gate.
31
32
  - [`review-method.md`](review-method.md) — Shared three-stage review method: multi-pass review, risk lenses, traceability, and finding evidence.
33
+ - [`local-artifact-repair.md`](local-artifact-repair.md) — Model-per-case repair, mechanical safety gates, dynamic convergence, and result-output contract for failed review artifacts.
32
34
  - [`human-decision-context.md`](human-decision-context.md) — Self-contained context and canonical structure for new human-decision details.
33
35
  - [`task-short-id.md`](task-short-id.md) — Resolution, allocation and lifecycle of bare-number short ids.
34
36
  - [`milestone-inference.md`](milestone-inference.md) — Milestone inference for create-task / code-task / create-pr.
35
- - [`label-milestone-setup.md`](label-milestone-setup.md) — Platform commands to initialize labels / milestones.
36
- - [`security-alerts.md`](security-alerts.md) — Commands to import / close Dependabot and Code Scanning alerts.
37
+ - [`label-milestone-setup.md`](label-milestone-setup.md) — Shared entry points to initialize labels / milestones.
38
+ - [`security-alerts.md`](security-alerts.md) — Shared entry point to import / close dependency and code-scanning alerts.
37
39
 
38
40
  ## Commit & Release
39
41
 
@@ -12,6 +12,7 @@
12
12
  - [`version-stamp.md`](version-stamp.md) — `agent_infra_version` 版本戳的取值命令与写入时机。
13
13
  - [`debugging-guide.md`](debugging-guide.md) — 结构化调试流程:收集证据→形成假设→验证假设→修复根因,禁止盲目改代码重试。
14
14
  - [`compatibility-policy.md`](compatibility-policy.md) — 兼容性默认关闭:准入证据、实现边界、退出条件与生命周期审查要求。
15
+ - [`sync-content-generation.md`](sync-content-generation.md) — 同步到 Issue 的任务和生命周期 Markdown 生成约束。
15
16
 
16
17
  ## Issue / PR
17
18
 
@@ -28,11 +29,12 @@
28
29
  - [`lifecycle-orchestration.md`](lifecycle-orchestration.md) — `run-task` 的 fresh executor/reviewer、一次性 receipt、暂停恢复与安全终点规则。
29
30
  - [`review-handshake.md`](review-handshake.md) — 三阶段双向审查握手协议:四态处置、对称证据、分歧账本、收敛与 post-review commit 门禁。
30
31
  - [`review-method.md`](review-method.md) — 三阶段共享检视方法:多遍检视、风险镜头、追踪与 finding 证据契约。
32
+ - [`local-artifact-repair.md`](local-artifact-repair.md) — review artifact 失败后的模型逐例修复、机械安全门、动态收敛与结果输出契约。
31
33
  - [`human-decision-context.md`](human-decision-context.md) — 新建人工裁决详情的自足上下文与规范结构。
32
34
  - [`task-short-id.md`](task-short-id.md) — 裸数字任务短号的解析、分配与生命周期。
33
35
  - [`milestone-inference.md`](milestone-inference.md) — create-task / code-task / create-pr 的 milestone 推断。
34
- - [`label-milestone-setup.md`](label-milestone-setup.md) — 初始化 label / milestone 的平台命令集。
35
- - [`security-alerts.md`](security-alerts.md) — 导入 / 关闭 Dependabot 与 Code Scanning 告警的命令集。
36
+ - [`label-milestone-setup.md`](label-milestone-setup.md) — 初始化 label / milestone 的共享入口。
37
+ - [`security-alerts.md`](security-alerts.md) — 导入 / 关闭依赖与代码扫描告警的共享入口。
36
38
 
37
39
  ## 提交与发布
38
40
 
@@ -15,7 +15,7 @@ Add or extend compatibility only when the task or an existing public contract ex
15
15
  1. **Subject**: concrete consumers, released versions, or stored data still using the old contract.
16
16
  2. **Necessity**: why an atomic cutover, one-time conversion, or actionable failure is insufficient.
17
17
  3. **Window**: a version, date, or verifiable endpoint for the compatibility period.
18
- 4. **Exit**: removal conditions, ownership, and the code, tests, and documentation to delete.
18
+ 4. **Exit**: removal conditions and the code, tests, and documentation to delete.
19
19
 
20
20
  If any item is missing, compatibility is unauthorized scope expansion. Implement the current contract, fail closed with an actionable repair message for old input, or perform an explicit one-time conversion outside the main path.
21
21
 
@@ -23,6 +23,7 @@ If any item is missing, compatibility is unauthorized scope expansion. Implement
23
23
 
24
24
  - Keep one canonical write format and one source of truth. Do not dual-write, maintain shadow state, or try the new path before silently falling back to the old path.
25
25
  - Concentrate an approved conversion at one boundary and immediately enter the current model; business logic must not understand several historical versions.
26
+ - Mark temporarily retained compatibility at its single boundary with `TODO(compat): Remove ... once ...`, naming the removal target and a verifiable removal condition. The TODO stays co-located with the code; tasks and issues are optional scheduling aids, not compatibility facts or workflow gates.
26
27
  - Use warnings only when the primary action remains correct and the user can retry an ancillary operation. Never hide uncertainty about identity, authorization, data interpretation, or side-effect correctness.
27
28
  - When removing an old capability, remove its adapters, branches, fixtures, tests, and migration documentation together. Do not add negative tests that permanently remember deleted behavior.
28
29
  - Never guess the meaning of unknown state. Preserve it, stop writes, and provide rebuild or manual-repair guidance.
@@ -31,9 +32,9 @@ If any item is missing, compatibility is unauthorized scope expansion. Implement
31
32
 
32
33
  - **Analysis**: separate explicit compatibility requirements from model speculation and identify real consumers or stored data. State current-only when evidence is absent.
33
34
  - **Plan**: for approved compatibility, identify the boundary, single conversion point, window, and deletion plan. Do not present a compatibility layer as the default low-risk option.
34
- - **Implementation**: implement only the approved compatibility budget. Do not preserve an unapproved old branch “just in case.”
35
- - **Review**: verify the four admission items, single source of truth, and exit condition. Flag unauthorized compatibility, indefinite shims, dual writes, and runtime-path migrations as scope and maintainability problems.
35
+ - **Implementation**: implement only the approved compatibility budget, and add or move its `TODO(compat)` at the single compatibility boundary. Do not preserve an unapproved old branch “just in case.”
36
+ - **Review**: verify the four admission items, single source of truth, exit condition, and co-located `TODO(compat)`. Flag unauthorized compatibility, indefinite shims, dual writes, and runtime-path migrations as scope and maintainability problems.
36
37
 
37
38
  ## Existing Compatibility Logic
38
39
 
39
- During an ordinary task, record out-of-scope compatibility logic and its risk without deleting it. A dedicated simplification task should first inventory consumers and stored data, then process items in this order: remove now, warn then remove, retain temporarily.
40
+ During an ordinary task, when out-of-scope compatibility is found, only ensure that its single boundary has one `TODO(compat)` and record the location and risk. Do not delete the logic or duplicate the marker. A dedicated simplification task should first search those TODOs and inventory consumers and stored data, then process items in this order: remove now, warn then remove, retain temporarily.
@@ -15,7 +15,7 @@
15
15
  1. **对象**:仍在使用旧契约的具体消费者、已发布版本或存量数据。
16
16
  2. **必要性**:为何不能原子切换、一次性转换或直接失败并提示修复。
17
17
  3. **期限**:兼容窗口的版本、日期或可验证终点。
18
- 4. **退出**:删除条件、责任归属以及届时要删除的代码、测试和文档。
18
+ 4. **退出**:删除条件以及届时要删除的代码、测试和文档。
19
19
 
20
20
  缺少任一项时,兼容属于未经授权的范围扩张:按当前契约实现;遇到旧输入时失败关闭并提供可操作提示,或在主路径之外执行一次性显式转换。
21
21
 
@@ -23,6 +23,7 @@
23
23
 
24
24
  - 当前契约只有一个规范写入格式和一个事实源;禁止双写、影子状态和“先试新逻辑、失败再走旧逻辑”。
25
25
  - 兼容转换集中在单一边界,转换后立即进入当前模型;业务核心不得感知多个历史版本。
26
+ - 暂时保留的兼容逻辑必须在唯一兼容边界使用 `TODO(compat): Remove ... once ...` 标记要删除的对象和可验证删除条件。该 TODO 与代码同源;任务或 Issue 只用于可选排期,不作为兼容事实源或工作流门禁。
26
27
  - warning 只用于主动作仍然正确且用户可重试的外围问题,不能掩盖身份、授权、数据解释或副作用正确性的不确定。
27
28
  - 删除旧能力时同步删除专属 adapter、分支、fixture、测试和迁移文档;不要新增“已删除能力不存在”的反向断言。
28
29
  - 不为兼容而猜测未知状态。无法唯一解释时保留原数据、停止写入并给出重建或人工修复提示。
@@ -31,9 +32,9 @@
31
32
 
32
33
  - **分析**:区分用户明确兼容要求与模型自行推测;列出现存消费者和数据证据。没有证据时明确采用 current-only。
33
34
  - **方案**:为获准兼容标出边界、唯一转换点、窗口和删除计划;不得把兼容层当作低风险默认方案。
34
- - **实现**:只实现已批准的兼容预算。方案未授权的旧分支不得“顺手保留”。
35
- - **审查**:逐项核对四项准入证据、单一事实源和退出条件。未经授权的兼容、无期限 shim、双写或主路径迁移应作为范围与维护性问题提出。
35
+ - **实现**:只实现已批准的兼容预算,并在唯一兼容边界写入或随重构移动 `TODO(compat)`。方案未授权的旧分支不得“顺手保留”。
36
+ - **审查**:逐项核对四项准入证据、单一事实源、退出条件及就地 `TODO(compat)`。未经授权的兼容、无期限 shim、双写或主路径迁移应作为范围与维护性问题提出。
36
37
 
37
38
  ## 既有兼容逻辑
38
39
 
39
- 普通任务发现范围外的既有兼容逻辑时,记录位置和风险但不擅自删除。专门的简化任务应先建立消费者与存量数据视图,再按“可立即删除 → 先告警后删除 → 暂时保留”的顺序逐项处理。
40
+ 普通任务发现范围外的既有兼容逻辑时,只确保唯一边界存在 `TODO(compat)` 并记录位置和风险,不擅自删除,也不重复添加标记。专门的简化任务应先检索这些 TODO、建立消费者与存量数据视图,再按“可立即删除 → 先告警后删除 → 暂时保留”的顺序逐项处理。
@@ -1,5 +1,14 @@
1
1
  # Issue Creation
2
2
 
3
- This code platform does not provide an Issue adapter. `platform-issue create` returns a structured no-op/degraded result.
3
+ > `--agent` values are defined in `.agents/rules/task-management.md` under “Collaborator Token Specification”.
4
4
 
5
- `create-task` skips the cascade Issue creation step on this platform; the local `task.md` remains a valid artifact. If you later want to bind the task to an Issue, manually write `issue_number` into `task.md` and the subsequent skills (`commit` / `code-task` / `complete-task`, etc.) will pick up Issue metadata syncing through the existing cascade rules.
5
+ After `create-task` writes task.md, create and initialize the Issue through declarative internal intents:
6
+
7
+ ```bash
8
+ agent-infra-internal platform-issue create {task-id} --agent {standard-agent-token}
9
+ agent-infra-internal platform-issue sync {task-id} --agent {standard-agent-token} --status waiting-for-triage --assignees current --milestone initial --issue-type --fields
10
+ ```
11
+
12
+ 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.
13
+
14
+ `planned|applied|no-op|degraded` exit 0, `failed` exits 1, and `blocked` exits 2. Callers must not fall back to direct platform CLI or GraphQL orchestration.
@@ -1,5 +1,27 @@
1
1
  # Issue 创建
2
2
 
3
- 当前代码平台未提供 Issue 适配器;`platform-issue create` 返回结构化 no-op/degraded 结果。
3
+ > `--agent` 取值见 `.agents/rules/task-management.md`「合作者 token 规范」。
4
4
 
5
- `create-task` 在本平台上会跳过级联创建 Issue 步骤;本地 `task.md` 仍然是有效产物。如果将来需要把任务绑定到一个 Issue,可手动在 `task.md` 中写入 `issue_number`,后续技能(`commit` / `code-task` / `complete-task` 等)会按既有的级联同步规则自动接管 Issue 元数据更新。
5
+ 当 `create-task` 完成本地 `task.md` 落盘后,通过声明式内部命令创建 Issue:
6
+
7
+ ```bash
8
+ agent-infra-internal platform-issue create {task-id} --agent {standard-agent-token}
9
+ ```
10
+
11
+ 命令只从已落盘 task.md 读取身份、标题、类型、描述与需求,并复用 `ai task issue-body` 的确定性正文渲染。它负责模板选择、upstream/capability、已有绑定检查、非幂等 POST 边界、响应身份校验及通过任务写入内核回写 `issue_number`。
12
+
13
+ 创建后的初始元数据使用同一适配层同步:
14
+
15
+ ```bash
16
+ agent-infra-internal platform-issue sync {task-id} --agent {standard-agent-token} \
17
+ --status waiting-for-triage --assignees current --milestone initial --issue-type --fields
18
+ ```
19
+
20
+ ## 结果处理
21
+
22
+ - `planned|applied|no-op|degraded`:exit 0;调用方按 operations 继续评论同步。
23
+ - `failed`:exit 1;调用方登记 `ISSUE_CREATE_FAILED` warning,不伪造绑定。
24
+ - `blocked`:exit 2;认证、网络或创建 outcome 不确定,调用方保留远端 identity 证据并停止盲目重试。
25
+ - 已绑定有效 Issue 时只验证绑定并返回 no-op,绝不重复创建。
26
+
27
+ 自定义或空平台返回 no-op/degraded;调用方不得回退到直接平台 CLI 或 GraphQL 编排。
@@ -4,7 +4,7 @@ This rule governs every new `[needs-human-decision]` detail block produced by an
4
4
 
5
5
  ## Self-contained Context
6
6
 
7
- A maintainer must be able to understand the issue and choose without knowing the internal workflow or asking a model to reconstruct context. Start in plain language: explain why a decision is needed now, what must be chosen, which choice is recommended, and why. Then explain what the choice affects and what could go wrong if the wrong choice is made or no action is taken.
7
+ A maintainer must be able to understand the issue and choose without knowing the internal workflow or asking a model to reconstruct context. In a fixed order, explain in plain language what must be chosen, why a decision is needed now, what it affects, and what could go wrong if it is wrong or postponed. Then explain each option, followed by the recommendation and its reason.
8
8
 
9
9
  Provide at least two options with short names. For each option, explain what would actually be done, what would happen after choosing it, its benefits, and its trade-offs. Each decision must also include at least one everyday example or analogy that stays true to the real effects and helps the maintainer compare the options. Explain internal terms such as stage, severity, and evidence the first time they appear. IDs and evidence are for lookup and troubleshooting; they do not replace the plain-language explanation.
10
10
 
@@ -13,13 +13,10 @@ Provide at least two options with short names. For each option, explain what wou
13
13
  ```markdown
14
14
  ### {AN-N|PL-N|CD-N|HD-N}: {Title} [needs-human-decision]
15
15
 
16
- - **Why a decision is needed now**: {plain-language facts, constraints, and why work cannot simply continue}
17
16
  - **What needs a decision**: {the one choice that must be made}
18
- - **Recommended choice**: {Option A/B/...}
19
- - **Why this choice**: {reason based on benefits, trade-offs, and current constraints}
17
+ - **Why a decision is needed now**: {plain-language facts, constraints, and why work cannot simply continue}
20
18
  - **What this affects**: {affected behavior, files, users, or future practice}
21
19
  - **What could go wrong**: {problems caused by the wrong choice or no action}
22
- - **Everyday example or analogy**: {a familiar comparison that accurately reflects the real effects and helps compare the options}
23
20
 
24
21
  #### Option A: {Name}
25
22
 
@@ -27,6 +24,7 @@ Provide at least two options with short names. For each option, explain what wou
27
24
  - **What happens after choosing it**: {specific changes for users, behavior, or follow-up work}
28
25
  - **Benefits**: {what this option provides}
29
26
  - **Trade-offs**: {what this option costs and where it falls short}
27
+ - **Example or analogy**: {a plain-language example that shows this option's real effect}
30
28
 
31
29
  #### Option B: {Name}
32
30
 
@@ -34,9 +32,13 @@ Provide at least two options with short names. For each option, explain what wou
34
32
  - **What happens after choosing it**: {specific changes for users, behavior, or follow-up work}
35
33
  - **Benefits**: {what this option provides}
36
34
  - **Trade-offs**: {what this option costs and where it falls short}
35
+ - **Example or analogy**: {a plain-language example that shows this option's real effect}
36
+
37
+ - **Recommended choice**: {Option A/B/...}
38
+ - **Why this choice**: {reason based on benefits, trade-offs, and current constraints}
37
39
  ```
38
40
 
39
- Option C and supporting evidence may be added, but none of the information above may be omitted or collapsed into an incomparable one-line option list. An example or analogy helps understanding; it does not replace facts, concrete effects, or risks. One example that clearly compares the overall choice is enough, so do not mechanically repeat the same analogy under every option. The heading ID must match the task.md Review Disagreement Ledger row. Its evidence (the reference used to find the original explanation) must point to this stable heading anchor.
41
+ Option C and supporting evidence may be added, but none of the information above may be omitted or collapsed into an incomparable one-line option list. Every option needs its own example or analogy, and it does not replace facts, concrete effects, or risks. Put the recommendation and its reason after all options. The heading ID must match the task.md Review Disagreement Ledger row. Its evidence (the reference used to find the original explanation) must point to this stable heading anchor.
40
42
 
41
43
  ## Implementation Intent Declaration
42
44
 
@@ -44,4 +46,4 @@ For the code stage, the author must add `**Implementation required**: yes/no` af
44
46
 
45
47
  ## Decision Closure
46
48
 
47
- 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.
49
+ Use `ai task decisions [--task <ref> | -t <ref>] [--item <ordinal|ledger-id> | -i <ordinal|ledger-id>]` to inspect full context and `ai decide [--task <ref> | -t <ref>] (--item <ordinal|ledger-id> | -i <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.
@@ -4,7 +4,7 @@
4
4
 
5
5
  ## 自足性要求
6
6
 
7
- 详情必须让维护者不需要了解内部流程,也不需要再问模型,就能看懂并做选择。先用大白话说明为什么现在需要决定、具体要选什么、建议选哪个以及原因;再说明会影响什么、选错或暂不处理会怎样。
7
+ 详情必须让维护者不需要了解内部流程,也不需要再问模型,就能看懂并做选择。按固定顺序先用大白话说明要决定什么、为什么现在需要决定、会影响什么以及选错或暂不处理会怎样;再分别说明方案 A/B/...,最后给出建议选哪个及原因。
8
8
 
9
9
  每项至少提供两个有简短名称的方案,并分别写清实际会怎么做、选了以后会怎样、好处和代价。每项还必须提供至少一个贴近日常、且不歪曲事实的例子或类比,帮助维护者比较方案。第一次出现 stage、severity、evidence 等内部术语时,必须顺手解释它们的意思;ID 和 evidence 只用于后续查找和排查,不能代替问题说明。
10
10
 
@@ -13,13 +13,10 @@
13
13
  ```markdown
14
14
  ### {AN-N|PL-N|CD-N|HD-N}:{标题} [needs-human-decision]
15
15
 
16
- - **为什么现在要决定**:{用大白话说明已知情况、限制,以及为什么不能直接继续}
17
16
  - **要决定什么**:{本次只需要选定的一件事}
18
- - **建议选哪个**:{方案 A/B/...}
19
- - **为什么这样建议**:{结合好处、代价和现有限制说明原因}
17
+ - **为什么现在要决定**:{用大白话说明已知情况、限制,以及为什么不能直接继续}
20
18
  - **会影响什么**:{会受影响的功能、文件、用户或后续做法}
21
19
  - **如果选错或暂不处理**:{可能出现的问题}
22
- - **打个比方**:{用一个贴近日常且符合真实影响的例子或类比,帮助比较方案}
23
20
 
24
21
  #### 方案 A:{名称}
25
22
 
@@ -27,6 +24,7 @@
27
24
  - **选了以后会怎样**:{用户、功能或后续工作会发生什么具体变化}
28
25
  - **好处**:{选择该方案能得到什么}
29
26
  - **代价**:{选择该方案要付出什么、有哪些局限}
27
+ - **例子/类比**:{用大白话举一个能说明该方案实际效果的例子}
30
28
 
31
29
  #### 方案 B:{名称}
32
30
 
@@ -34,9 +32,13 @@
34
32
  - **选了以后会怎样**:{用户、功能或后续工作会发生什么具体变化}
35
33
  - **好处**:{选择该方案能得到什么}
36
34
  - **代价**:{选择该方案要付出什么、有哪些局限}
35
+ - **例子/类比**:{用大白话举一个能说明该方案实际效果的例子}
36
+
37
+ - **建议选哪个**:{方案 A/B/...}
38
+ - **为什么这样建议**:{结合好处、代价和现有限制说明原因}
37
39
  ```
38
40
 
39
- 可增加方案 C 或补充证据,但不得省略上述信息或把多个方案压缩为无法分别比较的一行。例子或类比用于帮助理解,不能替代事实、实际影响和风险说明;一个能清楚比较整体选择的例子即可,不必为每个方案机械重复同一类比。标题 ID 必须与 task.md `## 审查分歧账本` 行一致;evidence(用于定位原始说明的引用)必须指向该标题的稳定锚点。
41
+ 可增加方案 C 或补充证据,但不得省略上述信息或把多个方案压缩为无法分别比较的一行。每个方案都要有自己的例子或类比,且不能替代事实、实际影响和风险说明。建议和建议原因放在所有方案之后。标题 ID 必须与 task.md `## 审查分歧账本` 行一致;evidence(用于定位原始说明的引用)必须指向该标题的稳定锚点。
40
42
 
41
43
  ## 实现意图声明
42
44
 
@@ -44,4 +46,4 @@ code 阶段的提出者必须在详情块的方案说明后另写 `**是否需
44
46
 
45
47
  ## 裁决闭环
46
48
 
47
- 使用 `ai task decisions <task-ref> <序号|账本ID>` 查看完整详情,使用 `ai decide <task-ref> <序号|账本ID> <裁决内容>` 写入裁决。`ai decide` 负责把目标行更新为 `human-decided`、创建独立 `HDR-N` 记录、更新 evidence 与活动日志;不得手工模拟其中一部分写入。
49
+ 使用 `ai task decisions [--task <ref> | -t <ref>] [--item <序号|账本ID> | -i <序号|账本ID>]` 查看完整详情,使用 `ai decide [--task <ref> | -t <ref>] (--item <序号|账本ID> | -i <序号|账本ID>) <裁决内容>` 写入裁决。`ai decide` 负责把目标行更新为 `human-decided`、创建独立 `HDR-N` 记录、更新 evidence 与活动日志;不得手工模拟其中一部分写入。
@@ -1,6 +1,6 @@
1
1
  # Issue Fields
2
2
 
3
- > `--agent` values follow the "Collaborator Token Specification" in `.agents/rules/task-management.md`: standard AI short tokens (`claude`/`codex`/`antigravity`/`opencode`/`cursor`), long-name normalization (`claude-code`->`claude`, `antigravity-cli`->`antigravity`), or the `human` manual exception.
3
+ > `--agent` values are defined in `.agents/rules/task-management.md` under “Collaborator Token Specification”.
4
4
 
5
5
  Synchronize Issue Type and pinned fields through one intent:
6
6
 
@@ -1,6 +1,6 @@
1
1
  # Issue 字段
2
2
 
3
- > `--agent` 取值见 `.agents/rules/task-management.md`「合作者 token 规范」:标准 AI 短名(`claude`/`codex`/`antigravity`/`opencode`/`cursor`)、长名归一化(`claude-code`→`claude`、`antigravity-cli`→`antigravity`)或人工例外 `human`。
3
+ > `--agent` 取值见 `.agents/rules/task-management.md`「合作者 token 规范」。
4
4
 
5
5
  Issue Type 与 pinned fields 统一由 `platform-issue` intent 动态读取组织 schema 并同步:
6
6
 
@@ -1,6 +1,6 @@
1
1
  # PR Platform Intents
2
2
 
3
- > `--agent` values follow the "Collaborator Token Specification" in `.agents/rules/task-management.md`: standard AI short tokens (`claude`/`codex`/`antigravity`/`opencode`/`cursor`), long-name normalization (`claude-code`->`claude`, `antigravity-cli`->`antigravity`), or the `human` manual exception.
3
+ > `--agent` values are defined in `.agents/rules/task-management.md` under “Collaborator Token Specification”.
4
4
 
5
5
  PR lookup, creation, binding, and metadata synchronization go through typed internal intents. Skills decide branches and write titles/bodies; they do not assemble platform commands.
6
6
 
@@ -12,36 +12,23 @@ agent-infra-internal platform-pr inspect {task-id}
12
12
 
13
13
  ## Create or recover
14
14
 
15
- Write the title and body to files, then run:
16
-
17
15
  ```bash
18
16
  agent-infra-internal platform-pr create {task-id} \
19
17
  --agent {standard-agent-token} --base {target-branch} --head {current-branch} \
20
18
  --title-file {title-file} --body-file {body-file}
21
19
  ```
22
20
 
23
- The core performs exact upstream/head/base lookup first. One match is reused, zero creates, and multiple matches fail closed. Unknown create outcomes are reconciled by the same exact identity rather than retried blindly. `--dry-run` returns only the plan.
21
+ The core performs exact upstream/head/base lookup. One match is reused, zero creates, and multiple matches fail closed. Unknown create outcomes are reconciled by exact identity. `--dry-run` returns only the plan.
24
22
 
25
- ## Bind
23
+ ## Bind and synchronize
26
24
 
27
25
  ```bash
28
26
  agent-infra-internal platform-pr bind {task-id} --pr {pr-number} --agent {standard-agent-token}
29
- ```
30
-
31
- Conflicting bindings fail without changing `task.md`.
32
27
 
33
- ## Synchronize metadata
34
-
35
- ```bash
36
28
  agent-infra-internal platform-pr sync {task-id} \
37
29
  --agent {standard-agent-token} --metadata --closing-issue
38
30
  ```
39
31
 
40
- The core copies type / `in:` labels, assignee, a specific milestone, and the closing association from the linked Issue. Permission-bound operations report `skipped` under top-level `degraded`; the Issue is never updated in reverse.
41
-
42
- ## Status contract
32
+ Conflicting bindings do not change `task.md`. Metadata comes from the linked Issue, permission-bound items degrade independently, and an already-created PR is never rolled back.
43
33
 
44
- - `planned|applied|no-op|degraded`: exit 0.
45
- - `failed`: exit 1.
46
- - `blocked`: exit 2 for authentication, network, or unknown outcome.
47
- - Metadata or summary failures never roll back an already-created PR.
34
+ Statuses `planned|applied|no-op|degraded` exit 0, `failed` exits 1, and `blocked` exits 2.
@@ -1,6 +1,6 @@
1
1
  # PR 平台意图命令
2
2
 
3
- > `--agent` 取值见 `.agents/rules/task-management.md`「合作者 token 规范」:标准 AI 短名(`claude`/`codex`/`antigravity`/`opencode`/`cursor`)、长名归一化(`claude-code`→`claude`、`antigravity-cli`→`antigravity`)或人工例外 `human`。
3
+ > `--agent` 取值见 `.agents/rules/task-management.md`「合作者 token 规范」。
4
4
 
5
5
  PR 资源的定位、创建、绑定和元数据同步统一通过 typed internal intent;SKILL 只负责决定分支、标题、正文和调用时机,不直接拼装平台命令。
6
6
 
@@ -1,8 +1,8 @@
1
1
  # Issue Sync
2
2
 
3
- ## Marker Registry
3
+ > `--agent` values are defined in `.agents/rules/task-management.md` under “Collaborator Token Specification”.
4
4
 
5
- These hidden markers are the canonical registry for Issue synchronization:
5
+ ## Marker Registry
6
6
 
7
7
  | Key | Marker |
8
8
  |---|---|
@@ -12,8 +12,29 @@ These hidden markers are the canonical registry for Issue synchronization:
12
12
  | `summary` | `<!-- sync-issue:{task-id}:summary -->` |
13
13
  | `cancel` | `<!-- sync-issue:{task-id}:cancel -->` |
14
14
 
15
- Callers should refer to the marker key in skill prose and keep concrete marker strings in this rule or the platform adapter defaults.
15
+ `pr-review` content is synced only as an Issue artifact comment (via the `artifact` / `artifactChunk` markers) and is never a `restore-task` recovery source; restore still accepts only an Issue number and reads only registered Issue markers, with no PR source.
16
+
17
+ Comments use `platform-comment`; Issue resources use `platform-issue`:
18
+
19
+ ```bash
20
+ agent-infra-internal platform-issue inspect {task-id}
21
+ agent-infra-internal platform-issue create {task-id} --agent {standard-agent-token}
22
+ agent-infra-internal platform-issue bind {task-id} --issue {number} --agent {standard-agent-token}
23
+ agent-infra-internal platform-issue sync {task-id} --agent {standard-agent-token} {desired-state-flags}
24
+ ```
25
+
26
+ The core owns status/in labels, assignees, milestones, Issue Type, pinned fields, requirements, state, capabilities, dry-run, retries, errors, and idempotency. Omitted flags preserve values; `none` explicitly clears them. Status labels converge to at most one, and ambiguous requirement identity fails closed.
27
+
28
+ `planned|applied|no-op|degraded` exit 0; `failed` exits 1; `blocked` exits 2.
29
+
30
+ Map material degraded/failed/blocked results to workflow warnings through the structured intent; callers must not edit warning rows directly:
31
+
32
+ ```bash
33
+ agent-infra-internal task-warning {task-id} add \
34
+ --step issue-sync --severity {severity} --code {code} \
35
+ --target {target} --message {message} --action {action}
36
+ ```
16
37
 
17
- This code platform does not provide an Issue adapter. `platform-issue` returns structured no-op/degraded operations.
38
+ ## Backfill
18
39
 
19
- Issue metadata, labels, milestones, assignees, and comments are skipped for custom platforms unless you provide matching `.{platform}.en.md` rule templates and platform adapters. Continue writing local task artifacts normally.
40
+ During completion, artifact comments are replayed with `--kind artifact --artifact <file> --backfill`. If the remote Issue has no matching marker, the core creates a comment with a historical-backfill notice. If a valid base or chunk marker set already exists, the core returns `no-op` and preserves the existing bodies and chunks. Marker conflicts still fail without writes.