@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
@@ -1,8 +1,10 @@
1
- # Issue 同步
1
+ # Issue 同步规则
2
+
3
+ > `--agent` 取值见 `.agents/rules/task-management.md`「合作者 token 规范」。
2
4
 
3
5
  ## Marker 注册表
4
6
 
5
- 以下隐藏标记是 Issue 同步的唯一权威注册表:
7
+ 以下 key 及格式是 Issue 评论身份的兼容契约;调用方只传 key/资源,不自行拼 marker。
6
8
 
7
9
  | Key | Marker |
8
10
  |---|---|
@@ -12,8 +14,63 @@
12
14
  | `summary` | `<!-- sync-issue:{task-id}:summary -->` |
13
15
  | `cancel` | `<!-- sync-issue:{task-id}:cancel -->` |
14
16
 
15
- Skill 正文应引用 marker key,具体 marker 字符串只保留在本规则或平台适配器默认值中。
17
+ `prSummary` 属于 `.agents/rules/pr-sync.md`,本规则不实现 PR 聚合。
18
+
19
+ `pr-review` 原文只通过 `artifact` / `artifactChunk` marker 同步为 Issue artifact 评论,不作为 `restore-task` 恢复来源;恢复仍只接受 Issue 编号并只读注册的 Issue marker,不新增 PR 来源。
20
+
21
+ ## 平台 intent
22
+
23
+ 平台 upstream、认证、capability、分页、marker 查找、幂等 create/update、分片、重试与错误分类由 typed platform core 统一处理:
24
+
25
+ ```bash
26
+ agent-infra-internal platform-context resolve [--cwd <path>]
27
+ agent-infra-internal platform-comment list --issue <N> [--cwd <path>]
28
+ agent-infra-internal platform-comment owner <task-ref>
29
+ agent-infra-internal platform-comment sync <task-ref> \
30
+ --kind task|artifact|summary|cancel --agent {standard-agent-token} \
31
+ [--artifact <canonical.md>] [--body-file <path|->] [--backfill]
32
+ ```
33
+
34
+ - `applied|no-op|degraded` → exit 0;`failed` → exit 1;`blocked` → exit 2。
35
+ - task 评论保持 `<details>` frontmatter 可逆格式;artifact 原文内联并在超过 profile 上限时使用 `artifactChunk`。
36
+ - 相同 intent 重放必须收敛为 `no-op`;重复 marker 返回 `COMMENT_MARKER_CONFLICT` 且不写入。
37
+ - 外部贡献者锁定统一使用 `platform-comment owner`;不同作者且无 triage 时返回 `COMMENT_OWNER_CONFLICT`。
38
+
39
+ ## 降级与告警
40
+
41
+ 平台结果不直接写 task.md。调用方在有关联任务时把关键失败映射为 workflow warning:
42
+
43
+ - capability 不足:`IMPORTANT / PERMISSION_DEGRADED`
44
+ - 评论同步永久失败:`ACTION_REQUIRED / COMMENT_SYNC_FAILED`
45
+ - 网络重试耗尽:`ACTION_REQUIRED / NETWORK_RETRY_EXHAUSTED`
46
+
47
+ 使用 `agent-infra-internal task-warning {task-id} add ...` 登记;不得手写 warning 表。
48
+
49
+ ```bash
50
+ agent-infra-internal task-warning {task-id} add \
51
+ --step issue-sync --severity {severity} --code {code} \
52
+ --target {target} --message {message} --action {action}
53
+ ```
54
+
55
+ ## Issue 元数据 intent
56
+
57
+ 所有 Issue 元数据写入统一使用:
58
+
59
+ ```bash
60
+ agent-infra-internal platform-issue inspect {task-id}
61
+ agent-infra-internal platform-issue create {task-id} --agent {standard-agent-token}
62
+ agent-infra-internal platform-issue bind {task-id} --issue {number} --agent {standard-agent-token}
63
+ agent-infra-internal platform-issue sync {task-id} --agent {standard-agent-token} {desired-state-flags}
64
+ ```
65
+
66
+ `sync` 支持 status/in labels、assignee、milestone、Issue Type、pinned fields、需求复选框与 Issue state。省略 flag 表示 preserve,`none` 表示显式清空。适配层统一处理集合差集、动态 schema、权限降级、dry-run、重试、错误分类与幂等重放;SKILL 不得拼装平台 CLI、GraphQL 或权限分支。
67
+
68
+ - `planned|applied|no-op|degraded` → exit 0
69
+ - `failed` → exit 1
70
+ - `blocked` → exit 2
71
+
72
+ status labels 始终至多一个;关闭后不保留 status label。`in:` labels 只从项目允许映射与仓库实际 labels 交集产生。需求复选框以 task.md 原文为身份,歧义时 fail closed。
16
73
 
17
- 当前代码平台未提供 Issue 适配器;`platform-issue` 返回结构化 no-op/degraded operations。
74
+ ## 补发
18
75
 
19
- 自定义平台会跳过 Issue 元数据、标签、里程碑、负责人和评论同步,除非你提供匹配的 `.{platform}.zh-CN.md` 规则模板和平台适配器。请继续正常写入本地任务产物。
76
+ complete-task 按 artifact catalog 时间线遍历本地已有产物:task 使用 `--kind task`,其余使用 `--kind artifact --artifact <file> --backfill`;最后用 `--kind summary --body-file <path>` 原地同步交付摘要。artifact backfill 在远端缺少 marker 时创建带“历史产物补发”提示的评论;已存在合法 marker 集合时保持原评论和分片不变并返回 `no-op`;marker 冲突仍失败。该判定由 core 完成,不由 Skill 扫描评论或拼标题。
@@ -1,5 +1,18 @@
1
1
  # Label and Milestone Setup
2
2
 
3
- This code platform does not provide built-in label or milestone setup.
3
+ Read this rule before initializing labels or milestones, or before changing milestone metadata during release work.
4
4
 
5
- Initialization of remote labels and milestones is skipped for custom platforms unless you provide matching `.{platform}.en.md` rule templates and scripts. Local task workflow files remain usable without remote metadata setup.
5
+ ## Entry points
6
+
7
+ Use the shared scripts rather than composing provider commands in a skill:
8
+
9
+ ```text
10
+ bash .agents/skills/init-labels/scripts/init-labels.sh [--cleanup-stale-in]
11
+ bash .agents/skills/init-milestones/scripts/init-milestones.sh "$ARGUMENTS"
12
+ ```
13
+
14
+ `init-labels.sh` reads the repository's `labels.in` configuration, creates or updates the declared `in:` labels, and preserves unrelated labels. `--cleanup-stale-in` is destructive and may only be passed after explicit confirmation; it removes stale `in:` labels that are no longer declared.
15
+
16
+ `init-milestones.sh` owns milestone inference and the provider-specific write path. Callers must pass the requested arguments through unchanged and must not rebuild milestone discovery, ordering, branch ancestry, or write logic.
17
+
18
+ Both scripts return a stable status. A successful no-op is still success; a degraded result must be reported without claiming that remote metadata was changed. Failed or cancelled operations must not be reported as completed.
@@ -1,5 +1,18 @@
1
1
  # Label 和 Milestone 初始化
2
2
 
3
- 当前代码平台未内置标签或里程碑初始化支持。
3
+ 在初始化 label、milestone,或在发布工作中修改 milestone 元数据前,先阅读本规则。
4
4
 
5
- 自定义平台会跳过远端标签和里程碑初始化,除非你提供匹配的 `.{platform}.zh-CN.md` 规则模板和脚本。即使没有远端元数据初始化,本地任务工作流文件仍可使用。
5
+ ## 入口
6
+
7
+ SKILL 应调用共享脚本,不得自行拼装 provider 命令:
8
+
9
+ ```text
10
+ bash .agents/skills/init-labels/scripts/init-labels.sh [--cleanup-stale-in]
11
+ bash .agents/skills/init-milestones/scripts/init-milestones.sh "$ARGUMENTS"
12
+ ```
13
+
14
+ `init-labels.sh` 读取仓库的 `labels.in` 配置,创建或更新声明的 `in:` label,并保留无关 label。`--cleanup-stale-in` 具有破坏性,只有在得到明确确认后才能传入;它会删除不再声明的过期 `in:` label。
15
+
16
+ `init-milestones.sh` 负责 milestone 推断和 provider 写入路径。调用方应原样传递请求参数,不得重新实现 milestone 发现、排序、分支祖先判断或写入逻辑。
17
+
18
+ 两个脚本都返回稳定状态。成功的 no-op 仍算成功;degraded 结果必须如实报告,不能声称远端元数据已变更。失败或取消的操作不得报告为已完成。
@@ -0,0 +1,46 @@
1
+ # General Rule - Model-Driven Local Artifact Repair
2
+
3
+ This rule applies only when `review-analysis`, `review-plan`, or `review-code` handles a finalizer failure for **the same controlled review artifact**. It does not apply to `task.md`, the ledger, receipts, source code, Git, platform resources, or lifecycle state.
4
+
5
+ ## Authorization Boundary
6
+
7
+ - The finalizer only reads facts, validates state, normalizes successful results, and performs atomic writes. It does not maintain a recoverable-error allowlist, infer repairability, or choose report content to delete.
8
+ - The initial finalizer call is not counted as a repair attempt. Editing is allowed only after the mechanical safety gates pass and the model explicitly determines that the current problem can be solved by a minimal, explainable artifact change.
9
+ - The model may edit only the one ordinary review artifact declared by the current review skill, and the file must be inside the current task directory. It must not edit `task.md`, the review disagreement ledger, receipts, source code, other reports, or remote resources.
10
+ - `changed=false`, an error code, or a format shape is diagnostic evidence, not automatic authorization. The model must judge each case using the complete diagnostic, artifact content, and context.
11
+
12
+ ## Non-bypassable Mechanical Safety Gates
13
+
14
+ Before every model edit, confirm that:
15
+
16
+ 1. the finalizer returned a failure and no artifact operation was committed;
17
+ 2. the task, stage, artifact, review round, identity, and provenance still match;
18
+ 3. the target is an ordinary file inside the current task directory, with no concurrency conflict, permission error, I/O uncertainty, or target replacement;
19
+ 4. the change does not alter human-decision semantics, decision-detail or ledger identity, and does not involve task state, receipts, Git, platform, or any other external side effect. A known and verifiable pending human decision may remain when the model proves the edit is unrelated to that decision.
20
+
21
+ If any condition fails, stop immediately without invoking a model edit. The model cannot bypass these gates.
22
+
23
+ ## Dynamic Convergence Loop
24
+
25
+ 1. Run the initial finalizer with the fixed task, stage, artifact, and orchestrated intent.
26
+ 2. On success, use that complete result for the existing completion gates; do not rescan the ledger or write summary fields manually.
27
+ 3. On failure with the safety gates passed, let the model read the structured diagnostic, current artifact, and required context, then decide whether to repair or stop. It must explain the scope and reason for the proposed change.
28
+ 4. If the model continues, perform one minimal edit to the artifact. Increment `repairAttempts` only when the file bytes actually change, then rerun the same finalizer intent completely.
29
+ 5. Re-run every safety check after each retry. A new, independent problem still limited to the same artifact may be offered to the model for another decision; the previous repairability decision must not be reused automatically.
30
+ 6. Stop immediately when the model cannot establish safety or identifies an environment, permission, concurrency, identity, provenance, unknown-state, uncertain human-decision semantics/details, or other non-local problem. A known human decision is not itself a stop condition.
31
+ 7. Stop when the diagnostic or artifact fingerprint repeats, no byte-level progress occurs, or the model cannot propose a verifiable minimal change.
32
+ 8. Allow at most 8 actual artifact edits per skill invocation as an emergency circuit breaker. This cap only prevents infinite loops and resource exhaustion; it is not a normal business stop condition and does not mean that at most eight problems may be repaired. Preserve the final structured diagnostic when the cap is reached.
33
+
34
+ The repair count exists only in the in-memory context of the current skill invocation. Do not write it to `task.md`, the ledger, or a public receipt. Do not create different normal budgets by error code, skill, or problem type.
35
+
36
+ ## Completion Events and User Output
37
+
38
+ - After the final complete finalizer result succeeds, publish the review completed event using that same result's provenance, ledger state, verdict, and counts. Generate cross-stage next-step commands only when `stageStatus.canAdvance=true` and the verdict is Approved; when `canAdvance=false`, still record the result and route to same-stage revision/review.
39
+ - On failure, model stop, lack of progress, repeated diagnostics, or the emergency cap, do not publish a completed event, advance the lifecycle, generate cross-stage commands, or fabricate an approval.
40
+ - Stopping advancement does not discard review results. User output must show the artifact path, the last safely readable summary/findings, actual `repairAttempts`, the last structured diagnostic, and the stop reason.
41
+ - If the summary cannot be safely parsed, show only the artifact path and the raw structured diagnostic; do not infer counts or add a conclusion, and state that lifecycle advancement stopped while the artifact remains available.
42
+ - A stop path may only suggest rerunning the current review skill or handling the issue manually. It must not invoke cross-stage helpers such as `code-task` or `complete-task`.
43
+
44
+ ## Lifecycle Isolation
45
+
46
+ `complete-task`, alert closing, task restoration, and other task-lifecycle/task-finalization entry points involve task state, receipts, remote results, or archival side effects and do not consume this rule. They retain their own hard-stop, same-intent retry, and unknown-state semantics.
@@ -0,0 +1,46 @@
1
+ # 通用规则 - 模型驱动的本地产物修复
2
+
3
+ 本规则只适用于 `review-analysis`、`review-plan`、`review-code` 在 finalizer 失败后处理**同一个受控 review artifact** 的场景。它不适用于 task.md、账本、receipt、源码、Git、平台资源或生命周期状态。
4
+
5
+ ## 授权边界
6
+
7
+ - finalizer 只负责读取事实、校验状态、规范化成功结果和原子写入;它不维护可修复错误码白名单,不推断 repairability,也不自动选择要删除的报告内容。
8
+ - 首次 finalizer 调用不计入修复次数。只有在机械安全门通过后,模型明确判断当前问题能通过最小、可解释的 artifact 修改解决时,才允许编辑。
9
+ - 模型只能修改当前 review skill 声明的一个普通 review artifact,且该文件必须位于当前 task 目录。不得修改 task.md、审查分歧账本、receipt、源码、其他报告或远端资源。
10
+ - `changed=false`、错误码或某个格式形状只是诊断事实,不是自动批准。模型必须结合完整诊断、artifact 内容和上下文逐例判断。
11
+
12
+ ## 不可绕过的机械安全门
13
+
14
+ 在每次模型编辑前确认:
15
+
16
+ 1. finalizer 返回失败,且没有已提交的 artifact operation;
17
+ 2. 任务、stage、artifact、review round、身份和 provenance 仍然一致;
18
+ 3. 目标是当前 task 目录内的普通文件,没有并发冲突、权限错误、I/O 不确定性或目标被替换;
19
+ 4. 不改变人工裁决语义、裁决详情或账本身份,也不涉及任务状态、receipt、Git、平台或其他外部副作用;已知且可核验的 pending 人工裁决可以保留,但模型必须证明本次修改与该裁决无关。
20
+
21
+ 任一条件不满足,立即停止,不调用模型编辑。安全门不能被模型的语义判断绕过。
22
+
23
+ ## 动态收敛循环
24
+
25
+ 1. 使用固定的 task、stage、artifact 和 orchestrated intent 执行首次 finalizer。
26
+ 2. 成功时使用这一次完整结果进入既有完成前门禁;不得重新扫描账本或手工补写摘要。
27
+ 3. 失败且安全门通过时,模型读取结构化诊断、当前 artifact 和必要上下文,决定继续修复或停止,并说明修改范围和理由。
28
+ 4. 模型选择继续时,只做一次最小 artifact 编辑。只有文件字节实际发生变化,才增加一次 `repairAttempts`,然后完整重跑同一个 finalizer intent。
29
+ 5. 每次重跑都重新执行全部安全校验。修复后出现新的、独立且仍局限于该 artifact 的问题,可以再次交给模型判断;不能沿用上一次“可修复”的结论。
30
+ 6. 模型无法证明下一步安全,或判断问题属于环境、权限、并发、身份、provenance、状态未知、人工裁决语义/详情不确定或其他非本地问题时,立即停止。已知人工裁决本身不是停止条件。
31
+ 7. 诊断重复、artifact 指纹重复、没有实际字节进展或模型没有提出可验证的最小修改时,立即停止。
32
+ 8. 每次 skill invocation 最多允许 8 次实际 artifact 修改作为紧急熔断。该上限只防止死循环和资源失控,不是正常业务停止条件,也不表示最多只能修复 8 个问题。达到上限时保留最后结构化诊断并停止。
33
+
34
+ 修复次数只存在于当前 skill invocation 的内存上下文,不写入 task.md、ledger 或公共 receipt。不得按错误码、技能或问题类型设置不同的正常预算。
35
+
36
+ ## 完成事件与用户输出
37
+
38
+ - 最终一次完整 finalizer 成功后,必须使用同一次返回的 provenance、账本状态、verdict 和计数发布 review completed 事件;`stageStatus.canAdvance=true` 且结论为 Approved 时才可生成跨阶段 next-step 命令,`canAdvance=false` 时仍须登记结果并路由到同阶段修订/复审。
39
+ - 失败、模型停止、无进展、诊断重复或紧急熔断时,不发布 completed 事件,不推进生命周期,不生成跨阶段命令,也不伪造通过结论。
40
+ - 停止推进不等于丢弃审查结果。用户输出必须展示 artifact 路径、已安全读取的最后有效 summary/findings、实际 `repairAttempts`、最后结构化诊断和停止原因。
41
+ - summary 无法安全解析时,只展示 artifact 路径和原始结构化诊断,不推算计数、不补写结论,并明确生命周期推进已停止但产物仍可查看。
42
+ - 停止路径只提示重新运行当前 review skill 或进行人工处理;不能调用 `code-task`、`complete-task` 等跨阶段 helper。
43
+
44
+ ## 生命周期隔离
45
+
46
+ `complete-task`、告警关闭、恢复任务和其他 task-lifecycle/task-finalization 入口涉及任务状态、receipt、远端结果或归档副作用,不消费本规则。它们继续使用各自的硬失败、同一 intent 重试和状态未知语义。
@@ -1,5 +1,15 @@
1
1
  # Milestone Inference
2
2
 
3
- This code platform does not provide milestone inference; `platform-issue sync --milestone ...` 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
- Milestone narrowing and reuse are skipped for custom platforms unless you provide matching `.{platform}.en.md` rule templates. Do not block task progress when no platform-specific milestone implementation is available.
5
+ Milestones narrow through declarative Issue intents:
6
+
7
+ ```bash
8
+ # create/import phase
9
+ agent-infra-internal platform-issue sync {task-id} --agent {standard-agent-token} --milestone initial
10
+
11
+ # code phase
12
+ agent-infra-internal platform-issue sync {task-id} --agent {standard-agent-token} --milestone specific
13
+ ```
14
+
15
+ `initial` prefers a valid task milestone, otherwise the lowest open `X.Y.x`, then `General Backlog`. `specific` narrows a release line to the highest open patch version using main/release-line ancestry. Missing facts or triage permission preserve the remote value and return skipped/degraded. `create-pr` reuses the Issue milestone in the 09/10 PR adapter.
@@ -1,5 +1,27 @@
1
- # Milestone 推断
1
+ # Milestone 推断规则
2
2
 
3
- 当前代码平台未提供里程碑推断;`platform-issue sync --milestone ...` 返回结构化 no-op/degraded 结果。
3
+ > `--agent` 取值见 `.agents/rules/task-management.md`「合作者 token 规范」。
4
4
 
5
- 自定义平台会跳过里程碑收窄和复用逻辑,除非你提供匹配的 `.{platform}.zh-CN.md` 规则模板。没有平台专属里程碑实现时,不要阻塞任务推进。
5
+ Milestone 继续按生命周期逐步收窄,但候选读取、分支判断、权限降级和写入统一由 `platform-issue` 处理。
6
+
7
+ ## 阶段 1:创建或导入
8
+
9
+ ```bash
10
+ agent-infra-internal platform-issue sync {task-id} --agent {standard-agent-token} --milestone initial
11
+ ```
12
+
13
+ 优先使用 task.md 中存在且有效的显式 milestone;否则从 open milestones 选择最低 `X.Y.x` 版本线,最后回退 `General Backlog`。`triage=false` 或外部事实不足时保持远端值并返回 skipped/degraded。
14
+
15
+ ## 阶段 2:`code-task`
16
+
17
+ ```bash
18
+ agent-infra-internal platform-issue sync {task-id} --agent {standard-agent-token} --milestone specific
19
+ ```
20
+
21
+ 版本线收窄规则保持不变:主干模式在当前版本线取最高 patch;多版本分支模式依据 release-line/main 祖先关系选择版本线。无法可靠判断时保持原值。完成门禁仍拒绝 `X.Y.x`。
22
+
23
+ ## 阶段 3:`create-pr`
24
+
25
+ PR 只复用关联 Issue 的具体 milestone;该 PR 资源写入属于 09/10,不在 `platform-issue` 中实现。
26
+
27
+ 调用方不得重新实现 milestone 列表、排序、分支祖先或平台写入逻辑。
@@ -110,11 +110,11 @@ This section is a **third standalone rule, co-equal with the two above**, used o
110
110
  …(one entry per status=needs-human-decision row of this stage in task.md `## 审查分歧账本`)
111
111
 
112
112
  View details:
113
- - All pending decisions: ai task decisions {task-ref}
114
- - A single item's full background/options/impact/recommendation: ai task decisions {task-ref} <ordinal|ledger-id>
113
+ - All pending decisions: ai task decisions --task {task-ref}
114
+ - A single item's full background/options/impact/recommendation: ai task decisions --task {task-ref} --item <ordinal|ledger-id>
115
115
 
116
116
  To resolve:
117
- - ai decide {task-ref} <ordinal|ledger-id> <decision and rationale>
117
+ - ai decide --task {task-ref} --item <ordinal|ledger-id> <decision and rationale>
118
118
 
119
119
  This command atomically creates the `HDR-N` ruling record, flips the target ledger row to `human-decided`, and updates evidence and the activity log; do not manually edit only part of the transaction.
120
120
 
@@ -110,11 +110,11 @@ Completed at: YYYY-MM-DD HH:mm:ss
110
110
  …(task.md `## 审查分歧账本` 中本阶段每个 status=needs-human-decision 行一条)
111
111
 
112
112
  查看详情:
113
- - 全部待裁决项:ai task decisions {task-ref}
114
- - 单项完整背景/选项/影响/建议:ai task decisions {task-ref} <序号|账本ID>
113
+ - 全部待裁决项:ai task decisions --task {task-ref}
114
+ - 单项完整背景/选项/影响/建议:ai task decisions --task {task-ref} --item <序号|账本ID>
115
115
 
116
116
  完成裁决:
117
- - ai decide {task-ref} <序号|账本ID> <裁决内容与理由>
117
+ - ai decide --task {task-ref} --item <序号|账本ID> <裁决内容与理由>
118
118
 
119
119
  该命令原子写入 `HDR-N` 裁定记录、把目标账本行翻为 `human-decided`、更新 evidence 与活动日志;不要手工只修改其中一部分。
120
120
 
@@ -85,7 +85,7 @@ Use these checks together:
85
85
  - **Small-impact exemption**: if it is only a local, reversible, low-cost execution detail, record it under `## Assumptions` instead of upgrading it to a human ruling.
86
86
  - **Fallback**: when unsure whether it is key, treat it as key; `review-*` must check whether the executor missed any `[needs-human-decision]` markings that should have been upgraded.
87
87
 
88
- > Use `ai task decisions <task-ref>` to view all pending decisions of a task and their detail blocks.
88
+ > Use `ai task decisions [--task <ref> | -t <ref>]` to view all pending decisions of a task and their detail blocks.
89
89
 
90
90
  ## Human Review Checkpoint Semantics
91
91
 
@@ -85,7 +85,7 @@
85
85
  - **小影响豁免**:若它只是局部、可逆、低成本的执行细节,写入 `## 假设` 即可,不升级为人工裁决。
86
86
  - **兜底**:无法判断是否关键时按关键处理;`review-*` 需要复核执行方是否漏标应升级的 `[needs-human-decision]`。
87
87
 
88
- > 用户可用 `ai task decisions <task-ref>` 查看某任务全部待裁决项及其详情块。
88
+ > 用户可用 `ai task decisions [--task <ref> | -t <ref>]` 查看某任务全部待裁决项及其详情块。
89
89
 
90
90
  ## 人工审查检查点语义
91
91
 
@@ -1,31 +1,40 @@
1
1
  # PR Summary Synchronization
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
- The model writes the semantic reviewer summary. Typed core owns canonical artifact selection, the marker, current HEAD, paginated comment lookup, and create/update/no-op reconciliation.
5
+ The model writes the semantic reviewer summary. Typed core owns canonical artifact selection, marker/HEAD wrapping, paginated comment lookup, and reconciliation.
6
6
 
7
- ## Inputs
7
+ ## Three-Layer Isolation
8
8
 
9
- ```bash
10
- agent-infra-internal platform-pr summary-context {task-id}
11
- ```
12
-
13
- Use only the returned latest canonical `plan*`, `review-plan*`, `code*`, `review-code*`, and `manual-validation*` for lifecycle claims. The summary covers scope, tests, review history, and exactly one manual-validation state. It also includes a `### PR Code Changes` section based on authoritative base/head facts from `platform-pr inspect` and the complete `git diff --find-renames --numstat base...head`, with reconciled runtime, test, skill/rule, template, documentation, and other categories plus rename, mechanical-mirror, and unnecessary-change analysis.
14
-
15
- ## Publish
9
+ - `sync-pr:{task-id}:summary` (`platform-pr summary-sync`) is an updatable reviewer summary; it is neither a process copy nor a formal Review.
10
+ - The full `pr-review*` process copy lives in the Issue artifact comment (`platform-comment sync --kind artifact`) and is restored by `restore-task` under its Issue-only contract.
11
+ - A formal PR Review (`platform-pr-review publish`) is the only formal conclusion carrier published to the PR, bound to the reviewed head SHA, and includes conclusion, findings, receipt, and the Issue artifact link.
16
12
 
17
- Write only the summary body to a file, without marker or SHA:
13
+ The three never cross: a regular PR comment does not carry the full process copy; an Issue artifact comment is not treated as a formal Review; a summary is not presented as a formal Review.
18
14
 
19
15
  ```bash
16
+ agent-infra-internal platform-pr summary-context {task-id}
17
+
20
18
  agent-infra-internal platform-pr summary-sync {task-id} \
21
19
  --agent {standard-agent-token} --body-file {summary-body-file}
22
20
  ```
23
21
 
24
- The core wraps `<!-- sync-pr:{task-id}:summary -->` and current `<!-- last-commit: ... -->`, then creates, updates in place, or returns no-op. Duplicate markers fail deterministically. Callers never assemble shell/heredoc comment commands.
22
+ Use only canonical inputs returned by the context command. Write the plain body without marker or SHA. The core owns `<!-- sync-pr:{task-id}:summary -->`, current `<!-- last-commit: ... -->`, create/update/no-op behavior, and duplicate-marker conflicts. Summary failure never rolls back a PR or commit.
25
23
 
26
- `create-pr` does not roll back the PR on summary failure; `commit` records a warning without rolling back; manual validation refreshes after its canonical artifact is written.
24
+ The canonical comment envelope produced by the core is:
25
+
26
+ ```markdown
27
+ <!-- sync-pr:{task-id}:summary -->
28
+ <!-- last-commit: {git-head-sha} -->
29
+ ## Review Summary
30
+ {manual-validation-section}
31
+ ### Key Technical Decisions
32
+ ### Review History
33
+ ### Test Results
34
+ ### PR Code Changes
35
+ ```
27
36
 
28
- For a linked task, the caller records a structured warning:
37
+ Canonical inputs include `manual-validation.md`. The manual-validation section is one of `### ✅ Manual Validation Passed`, `### ⚠️ Manual Verification Required`, or `### ✅ No Manual Verification Needed`; `complete-manual-validation` refreshes the same summary in place. The PR code-change section uses authoritative base/head facts from `platform-pr inspect` and the complete `git diff --find-renames --numstat base...head`, reconciles runtime, test, skill/rule, template, documentation, and other categories, and explains renames, mechanical mirrors, and potentially unnecessary changes.
29
38
 
30
39
  ```bash
31
40
  agent-infra-internal task-warning {task-id} add --step {step} --severity WARNING \
@@ -1,16 +1,24 @@
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 摘要的语义聚合由模型完成;canonical 产物选择、marker、当前 HEAD、分页评论查找和 create/update/no-op 由 typed core 负责。
6
6
 
7
+ ## 三层隔离
8
+
9
+ - `sync-pr:{task-id}:summary`(`platform-pr summary-sync`)是可更新的 reviewer 摘要,不是过程原文,也不是正式 Review。
10
+ - `pr-review*` 完整过程原文在 Issue artifact 评论(`platform-comment sync --kind artifact`),由 `restore-task` 按 Issue-only 契约恢复。
11
+ - 正式 PR Review(`platform-pr-review publish`)是唯一发布到 PR 的正式结论载体,绑定被审 head SHA,含结论、finding、receipt 与 Issue artifact 链接。
12
+
13
+ 三者不串用:PR 普通评论不承载完整过程原文;Issue artifact 评论不当作正式 Review;摘要不冒充正式 Review。
14
+
7
15
  ## 聚合输入
8
16
 
9
17
  ```bash
10
18
  agent-infra-internal platform-pr summary-context {task-id}
11
19
  ```
12
20
 
13
- 只使用返回的 canonical latest `plan*`、`review-plan*`、`code*`、`review-code*`、`manual-validation*`。模型据此生成 reviewer 摘要正文,至少包含:
21
+ 只使用返回的 canonical latest `plan*`、`review-plan*`、`code*`、`review-code*`、`manual-validation*`(包括 `manual-validation.md`)。模型据此生成 reviewer 摘要正文,至少包含:
14
22
 
15
23
  - 变更摘要与实现范围
16
24
  - 测试结果
@@ -20,6 +28,19 @@ agent-infra-internal platform-pr summary-context {task-id}
20
28
 
21
29
  保留人工校验项时,每条写明校验内容、定位和只能人工完成的原因。
22
30
 
31
+ core 最终包装出的 canonical 评论结构为:
32
+
33
+ ```markdown
34
+ <!-- sync-pr:{task-id}:summary -->
35
+ <!-- last-commit: {git-head-sha} -->
36
+ ## 审查摘要
37
+ {manual-validation-section}
38
+ ### 关键技术决策
39
+ ### 审查历程
40
+ ### 测试结果
41
+ ### PR 代码增减
42
+ ```
43
+
23
44
  ## 发布
24
45
 
25
46
  把聚合后的纯正文写入 `{summary-body-file}`,不要自行添加 marker 或 commit SHA:
@@ -1,5 +1,44 @@
1
- # Release Commands
1
+ # Release Platform Commands
2
2
 
3
- This code platform does not provide a release-note adapter.
3
+ Release-note platform operations use a typed internal intent. Callers consume structured JSON and do not interpret platform commands, raw fields, identity email rules, or authentication errors.
4
4
 
5
- Local `agent-infra-internal platform-release-notes stage --notes-file "{notes-file}"` still normalizes an external file and returns its digest. Use `context` to receive a structured `PLATFORM_RELEASE_NOTES_UNSUPPORTED` no-op and do not probe another platform client. Publish with `--expected-sha256` remains a no-op until an adapter is provided.
5
+ ## Collect Release-note Context
6
+
7
+ ```bash
8
+ agent-infra-internal platform-release-notes context \
9
+ --from-tag "v{prev-version}" \
10
+ --to-tag "v{version}" \
11
+ --branch "{branch}" \
12
+ --history-limit 3
13
+ ```
14
+
15
+ The result contains `history`, `pullRequests`, `closingIssues`, and commit `authors` with normalized `login` / `resolution` values. `status: no-op` with error code `PLATFORM_RELEASE_NOTES_UNSUPPORTED` means the current platform does not support remote release-note operations.
16
+
17
+ ### Identity Safety Boundary
18
+
19
+ - Render an identity as `@login` only when `resolution` is `platform-user` or `platform-noreply` and `login` is non-empty.
20
+ - Exclude `resolution: unresolved` identities from the release-note contributor list. Never infer a login from a name, email address, domain, brand, or same-named platform account, and never substitute a guessed personal or organization account.
21
+ - Do not publish unresolved identity emails or identity-verification TODOs in Release notes. Record any required investigation outside the release workflow without creating a platform mention.
22
+
23
+ ## Stage Release Notes
24
+
25
+ ```bash
26
+ agent-infra-internal platform-release-notes stage \
27
+ --notes-file "{notes-file}"
28
+ ```
29
+
30
+ The command accepts only an external regular file, normalizes it atomically, and returns SHA-256 for its exact bytes.
31
+
32
+ ## Publish Release Notes
33
+
34
+ Call this only after user confirmation:
35
+
36
+ ```bash
37
+ agent-infra-internal platform-release-notes publish \
38
+ --tag "v{version}" \
39
+ --title "v{version}" \
40
+ --notes-file "{notes-file}" \
41
+ --expected-sha256 "{preview-sha256}"
42
+ ```
43
+
44
+ The command recomputes the digest before platform access and performs no platform write on mismatch. On a match it updates an existing Release or creates it when missing; `--dry-run` returns only the planned operation. Exit code `0` means success, `1` means a stable failure, and `2` means a network or platform block.
@@ -1,5 +1,44 @@
1
- # Release 命令
1
+ # Release 平台命令
2
2
 
3
- 当前代码平台未提供发布说明 adapter。
3
+ 发布说明平台操作统一使用 typed internal intent。调用方只解释结构化 JSON,不解析平台命令、原始字段、身份邮箱规则或认证错误。
4
4
 
5
- 本地 `agent-infra-internal platform-release-notes stage --notes-file "{notes-file}"` 仍可规范化工作树外文件并返回摘要。调用 `context` 会返回结构化的 `PLATFORM_RELEASE_NOTES_UNSUPPORTED` no-op,不得探测其他平台 client;提供 adapter 前,带 `--expected-sha256` 的 publish 同样保持 no-op。
5
+ ## 收集发布说明上下文
6
+
7
+ ```bash
8
+ agent-infra-internal platform-release-notes context \
9
+ --from-tag "v{prev-version}" \
10
+ --to-tag "v{version}" \
11
+ --branch "{branch}" \
12
+ --history-limit 3
13
+ ```
14
+
15
+ 结果包含 `history`、`pullRequests`、`closingIssues` 和带规范化 `login` / `resolution` 的 commit `authors`。`status: no-op` 且错误码为 `PLATFORM_RELEASE_NOTES_UNSUPPORTED` 表示当前平台不支持远端发布说明能力。
16
+
17
+ ### 身份安全边界
18
+
19
+ - 只有 `resolution` 为 `platform-user` 或 `platform-noreply` 且 `login` 非空的身份可以渲染为 `@login`。
20
+ - `resolution: unresolved` 的身份不得进入发布说明的贡献者列表;不得从 Name、邮箱、域名、品牌或同名平台账号推断 login,也不得替换成推测的个人或组织账号。
21
+ - 不得把未解析身份的邮箱或身份确认 TODO 写入可发布的 Release notes。需要调查时仅在发布流程外记录,不得产生平台 mention。
22
+
23
+ ## Stage Release notes
24
+
25
+ ```bash
26
+ agent-infra-internal platform-release-notes stage \
27
+ --notes-file "{notes-file}"
28
+ ```
29
+
30
+ 命令只接受工作树外普通文件,原子规范化并返回精确 bytes 的 SHA-256。
31
+
32
+ ## 发布 Release notes
33
+
34
+ 用户确认后调用:
35
+
36
+ ```bash
37
+ agent-infra-internal platform-release-notes publish \
38
+ --tag "v{version}" \
39
+ --title "v{version}" \
40
+ --notes-file "{notes-file}" \
41
+ --expected-sha256 "{preview-sha256}"
42
+ ```
43
+
44
+ 命令在平台访问前复算摘要,不匹配时零写入;匹配时更新已有 Release,缺失时创建。`--dry-run` 只返回 planned operation。退出码为 `0` 时成功,`1` 表示稳定失败,`2` 表示网络或平台阻塞。
@@ -82,7 +82,7 @@ When an executor judges an item to be a key design decision that needs human rul
82
82
  - `severity` is always `decision`.
83
83
  - `status` starts as `needs-human-decision`, so the existing gate blocks it.
84
84
  - `evidence` points to the stable anchor `<artifact>#HD-N` (e.g. `plan-r2.md#HD-1`), not a drift-prone line number.
85
- - A human records the ruling with `ai decide <task-ref> <ordinal|ledger-id> <decision>`; the command flips the target row to `human-decided` and points `evidence` to an independent `HDR-N` ruling record.
85
+ - A human records the ruling with `ai decide [--task <ref> | -t <ref>] (--item <ordinal|ledger-id> | -i <ordinal|ledger-id>) <decision>`; the command flips the target row to `human-decided` and points `evidence` to an independent `HDR-N` ruling record.
86
86
 
87
87
  > Viewing, deciding, and typed verification share the `lib/task/ledger.ts` domain semantics; no second parser is maintained.
88
88
 
@@ -82,7 +82,7 @@
82
82
  - `severity` 固定填 `decision`。
83
83
  - `status` 初始填 `needs-human-decision`,因此会被现有 gate 阻塞。
84
84
  - `evidence` 指向稳定锚点 `<artifact>#HD-N`(如 `plan-r2.md#HD-1`),不依赖易漂移的行号。
85
- - 人工使用 `ai decide <task-ref> <序号|账本ID> <裁决内容>` 记录裁定;命令把目标行翻为 `human-decided`,并让 `evidence` 指向独立 `HDR-N` 裁定记录。
85
+ - 人工使用 `ai decide [--task <ref> | -t <ref>] (--item <序号|账本ID> | -i <序号|账本ID>) <裁决内容>` 记录裁定;命令把目标行翻为 `human-decided`,并让 `evidence` 指向独立 `HDR-N` 裁定记录。
86
86
 
87
87
  > 查看、裁决与 typed verification 共用 `lib/task/ledger.ts` 的领域语义,不维护第二 parser。
88
88
 
@@ -1,5 +1,20 @@
1
1
  # Security Alerts
2
2
 
3
- This code platform does not provide built-in security alert integration.
3
+ Read this rule before importing or dismissing dependency or code-scanning alerts.
4
4
 
5
- Code scanning and dependency alert import or close actions are skipped for custom platforms unless you provide matching `.{platform}.en.md` rule templates and adapters. Track security work through local task artifacts or a platform-specific integration.
5
+ ## Shared entry point
6
+
7
+ All callers use the shared security script and parse its single JSON result:
8
+
9
+ ```text
10
+ bash .agents/scripts/security-alerts.sh read-dependabot --number {number}
11
+ bash .agents/scripts/security-alerts.sh dismiss-dependabot --number {number} --reason {api-reason} --comment-file {file}
12
+ bash .agents/scripts/security-alerts.sh read-codescan --number {number}
13
+ bash .agents/scripts/security-alerts.sh dismiss-codescan --number {number} --reason {api-reason} --comment-file {file}
14
+ ```
15
+
16
+ The result contains `status`, `operation`, and either `data` or `error.code` plus `error.message`. The status is one of `applied`, `no-op`, `degraded`, or `failed`. Diagnostics belong on stderr; stdout must contain exactly one JSON object.
17
+
18
+ Read the current alert before any dismiss operation. A dismiss reason must use the provider API reason value, and the generated task or Issue comment must be passed through `--comment-file`.
19
+
20
+ Do not invoke a provider CLI directly from a SKILL. A degraded or failed result must be reported accurately, and cancelled or failed operations must not be recorded as successful.
@@ -1,5 +1,20 @@
1
1
  # 安全告警
2
2
 
3
- 当前代码平台未内置安全告警集成。
3
+ 在导入或关闭依赖告警、代码扫描告警前,先阅读本规则。
4
4
 
5
- 自定义平台会跳过代码扫描和依赖告警的导入或关闭操作,除非你提供匹配的 `.{platform}.zh-CN.md` 规则模板和适配器。请通过本地任务产物或平台专属集成跟踪安全工作。
5
+ ## 共享入口
6
+
7
+ 所有调用方都使用共享安全脚本,并解析其单个 JSON 结果:
8
+
9
+ ```text
10
+ bash .agents/scripts/security-alerts.sh read-dependabot --number {number}
11
+ bash .agents/scripts/security-alerts.sh dismiss-dependabot --number {number} --reason {api-reason} --comment-file {file}
12
+ bash .agents/scripts/security-alerts.sh read-codescan --number {number}
13
+ bash .agents/scripts/security-alerts.sh dismiss-codescan --number {number} --reason {api-reason} --comment-file {file}
14
+ ```
15
+
16
+ 结果包含 `status`、`operation`,以及 `data` 或 `error.code` 与 `error.message`。`status` 只能是 `applied`、`no-op`、`degraded` 或 `failed`。诊断信息写入 stderr;stdout 必须只包含一个 JSON 对象。
17
+
18
+ 任何关闭操作前都必须先读取当前告警。关闭原因必须使用 provider API 的 reason 值,生成的任务或 Issue 评论必须通过 `--comment-file` 传入。
19
+
20
+ SKILL 不得直接调用 provider CLI。degraded 或 failed 结果必须如实报告,取消或失败的操作不得记录为成功。
@@ -0,0 +1,8 @@
1
+ # Synchronized Content Generation Rules
2
+
3
+ This rule applies to controlled generators that write `task.md` or lifecycle artifacts which are synchronized to an Issue. It constrains model output only; it does not parse, rewrite, or block hand-written or external content.
4
+
5
+ - Render local, workspace, and temporary task-file references as inline code, such as `analysis.md` or `/workspace/file.md`; do not write them as Markdown links.
6
+ - Render non-user-semantic `@` text, such as `@2x`, as inline code; preserve real user mentions, `@` inside email addresses, and fixed release-log formats according to their meaning.
7
+ - Formal Issue, PR, commit, and external links may remain Markdown links.
8
+ - When uncertain, keep ordinary text and do not guess a link target; do not introduce a runtime Markdown parser for this purpose.
@@ -0,0 +1,8 @@
1
+ # 同步内容生成规则
2
+
3
+ 本规则适用于会写入 `task.md` 或生命周期产物并同步到 Issue 的受控生成端。它只约束模型生成,不解析、改写或阻断手写和外部正文。
4
+
5
+ - 本地、工作区和临时任务文件引用使用行内代码文本,例如 `analysis.md`、`/workspace/file.md`;不要把它们写成 Markdown 链接。
6
+ - 非用户语义的 `@` 文本(例如 `@2x`)使用行内代码文本;真实用户 mention、邮箱地址中的 `@` 和固定发布格式按语义保留。
7
+ - 正式的 Issue、PR、commit 和外部链接可以保持 Markdown 链接。
8
+ - 不确定时保留普通文本,不猜测链接目标;不要为此引入运行时 Markdown 解析器。