@fitlab-ai/agent-infra 0.9.11 → 0.9.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (356) hide show
  1. package/README.md +13 -13
  2. package/README.zh-CN.md +13 -13
  3. package/dist/bin/internal-cli.js +29 -19
  4. package/dist/lib/agent-clients/adapters/codex-lifecycle/build-identity.js +71 -10
  5. package/dist/lib/agent-clients/next-steps.js +6 -1
  6. package/dist/lib/decide.js +3 -3
  7. package/dist/lib/defaults.json +4 -0
  8. package/dist/lib/git/workflow.js +43 -1
  9. package/dist/lib/init.js +1 -0
  10. package/dist/lib/internal/git-workflow.js +8 -1
  11. package/dist/lib/internal/platform-checks.js +3 -3
  12. package/dist/lib/internal/platform-comment.js +9 -9
  13. package/dist/lib/internal/platform-context.js +2 -2
  14. package/dist/lib/internal/platform-issue.js +8 -9
  15. package/dist/lib/internal/platform-pr-review.js +10 -10
  16. package/dist/lib/internal/platform-pr.js +68 -23
  17. package/dist/lib/internal/platform-release-notes.js +3 -3
  18. package/dist/lib/internal/pr-review-grade.js +11 -9
  19. package/dist/lib/internal/release-workflow.js +4 -4
  20. package/dist/lib/internal/sandbox-control.js +30 -4
  21. package/dist/lib/internal/task-activity.js +3 -3
  22. package/dist/lib/internal/task-artifact.js +76 -24
  23. package/dist/lib/internal/task-create.js +2 -2
  24. package/dist/lib/internal/task-delivery.js +59 -0
  25. package/dist/lib/internal/task-event.js +6 -3
  26. package/dist/lib/internal/task-finalization.js +2 -2
  27. package/dist/lib/internal/task-invalidation.js +60 -0
  28. package/dist/lib/internal/task-ledger.js +9 -6
  29. package/dist/lib/internal/task-lifecycle.js +2 -2
  30. package/dist/lib/internal/task-override.js +4 -4
  31. package/dist/lib/internal/task-review.js +3 -3
  32. package/dist/lib/internal/task-verify.js +6 -6
  33. package/dist/lib/internal/task-warning.js +3 -3
  34. package/dist/lib/platform/adapters.js +1 -3
  35. package/dist/lib/platform/change-request-git-evidence.js +27 -7
  36. package/dist/lib/platform/completion-backfill.js +6 -5
  37. package/dist/lib/platform/context.js +70 -130
  38. package/dist/lib/platform/github-client.js +8 -2
  39. package/dist/lib/platform/github-provider.js +903 -0
  40. package/dist/lib/platform/in-label-sync.js +143 -0
  41. package/dist/lib/platform/issue-comments.js +94 -41
  42. package/dist/lib/platform/issues.js +335 -189
  43. package/dist/lib/platform/metadata-labels.js +6 -2
  44. package/dist/lib/platform/none-provider.js +28 -0
  45. package/dist/lib/platform/pr-change-report.js +551 -0
  46. package/dist/lib/platform/pr-checks.js +124 -106
  47. package/dist/lib/platform/pr-review.js +88 -72
  48. package/dist/lib/platform/pr-summary.js +523 -49
  49. package/dist/lib/platform/provider-bridge.js +45 -0
  50. package/dist/lib/platform/provider-contract.d.ts +487 -0
  51. package/dist/lib/platform/provider-contract.js +95 -0
  52. package/dist/lib/platform/provider-loader.js +251 -0
  53. package/dist/lib/platform/provider-validation.js +504 -0
  54. package/dist/lib/platform/pull-request-metadata.js +8 -6
  55. package/dist/lib/platform/pull-requests.js +1050 -502
  56. package/dist/lib/platform/release-notes.js +78 -55
  57. package/dist/lib/platform/releases.js +79 -50
  58. package/dist/lib/platform/resource-identity.d.ts +26 -0
  59. package/dist/lib/platform/resource-identity.js +92 -0
  60. package/dist/lib/platform/task-identities.js +31 -0
  61. package/dist/lib/platform/verification-required.js +22 -12
  62. package/dist/lib/platform/verification-sync.js +118 -239
  63. package/dist/lib/pr-review/evidence-grading.js +30 -9
  64. package/dist/lib/run/index.js +63 -23
  65. package/dist/lib/sandbox/config.js +5 -0
  66. package/dist/lib/sandbox/control/client.js +96 -15
  67. package/dist/lib/sandbox/control/executor.js +3 -3
  68. package/dist/lib/sandbox/control/lifecycle.js +29 -7
  69. package/dist/lib/sandbox/control/protocol.js +77 -0
  70. package/dist/lib/sandbox/control/server.js +398 -25
  71. package/dist/lib/sandbox/control/state.js +204 -1
  72. package/dist/lib/server/process-state.js +2 -2
  73. package/dist/lib/server/protocol.js +38 -1
  74. package/dist/lib/task/activity-log.js +8 -1
  75. package/dist/lib/task/artifact-lifecycle.js +35 -7
  76. package/dist/lib/task/capabilities.js +239 -0
  77. package/dist/lib/task/commands/status.js +32 -0
  78. package/dist/lib/task/commit-intent.js +100 -0
  79. package/dist/lib/task/commit-operation.js +207 -102
  80. package/dist/lib/task/control-authority.js +8 -5
  81. package/dist/lib/task/create-service.js +8 -8
  82. package/dist/lib/task/create.js +33 -7
  83. package/dist/lib/task/current-contract.js +5 -1
  84. package/dist/lib/task/decision-details.js +3 -48
  85. package/dist/lib/task/delivery-target.js +97 -0
  86. package/dist/lib/task/delivery.js +153 -0
  87. package/dist/lib/task/events.js +297 -17
  88. package/dist/lib/task/finalization.js +37 -13
  89. package/dist/lib/task/human-override.js +61 -36
  90. package/dist/lib/task/invalidation-command.js +86 -0
  91. package/dist/lib/task/invalidation.js +260 -0
  92. package/dist/lib/task/ledger-intents.js +37 -0
  93. package/dist/lib/task/lifecycle.js +106 -9
  94. package/dist/lib/task/local-artifact-finalization.js +374 -0
  95. package/dist/lib/task/orchestration.js +100 -151
  96. package/dist/lib/task/pr-delivery-fact.js +183 -0
  97. package/dist/lib/task/review-finalization.js +4 -8
  98. package/dist/lib/task/review-fingerprint.js +32 -2
  99. package/dist/lib/task/rework-intent.js +138 -0
  100. package/dist/lib/task/skill-scope.js +23 -0
  101. package/dist/lib/task/task-execution-lock.js +27 -17
  102. package/dist/lib/task/verification-engine.js +89 -38
  103. package/dist/lib/task/verification-review.js +1 -1
  104. package/dist/lib/task/verification.js +3 -3
  105. package/dist/lib/task/workflow-warning-intents.js +1 -1
  106. package/dist/lib/task/write.js +11 -0
  107. package/dist/lib/update.js +9 -0
  108. package/dist/lib/version.js +11 -1
  109. package/dist/lifecycle-build-manifest.json +3 -3
  110. package/lib/agent-clients/adapters/codex-lifecycle/build-identity.ts +105 -10
  111. package/lib/agent-clients/adapters/codex-lifecycle/manifest-files.json +12 -1
  112. package/lib/agent-clients/next-steps.ts +6 -1
  113. package/lib/decide.ts +3 -3
  114. package/lib/defaults.json +4 -0
  115. package/lib/git/workflow.ts +38 -1
  116. package/lib/init.ts +4 -1
  117. package/lib/internal/git-workflow.ts +7 -1
  118. package/lib/internal/platform-checks.ts +3 -3
  119. package/lib/internal/platform-comment.ts +8 -8
  120. package/lib/internal/platform-context.ts +2 -2
  121. package/lib/internal/platform-issue.ts +7 -8
  122. package/lib/internal/platform-pr-review.ts +9 -9
  123. package/lib/internal/platform-pr.ts +53 -21
  124. package/lib/internal/platform-release-notes.ts +3 -3
  125. package/lib/internal/pr-review-grade.ts +10 -8
  126. package/lib/internal/release-workflow.ts +4 -4
  127. package/lib/internal/sandbox-control.ts +27 -3
  128. package/lib/internal/task-activity.ts +3 -3
  129. package/lib/internal/task-artifact.ts +65 -22
  130. package/lib/internal/task-create.ts +2 -2
  131. package/lib/internal/task-delivery.ts +53 -0
  132. package/lib/internal/task-event.ts +6 -3
  133. package/lib/internal/task-finalization.ts +3 -3
  134. package/lib/internal/task-invalidation.ts +39 -0
  135. package/lib/internal/task-ledger.ts +11 -8
  136. package/lib/internal/task-lifecycle.ts +2 -2
  137. package/lib/internal/task-override.ts +6 -6
  138. package/lib/internal/task-review.ts +3 -3
  139. package/lib/internal/task-verify.ts +6 -6
  140. package/lib/internal/task-warning.ts +3 -3
  141. package/lib/platform/adapters.ts +3 -2
  142. package/lib/platform/change-request-git-evidence.ts +36 -9
  143. package/lib/platform/completion-backfill.ts +9 -8
  144. package/lib/platform/context.ts +97 -134
  145. package/lib/platform/github-client.ts +10 -3
  146. package/lib/platform/github-provider.ts +910 -0
  147. package/lib/platform/in-label-sync.ts +208 -0
  148. package/lib/platform/issue-comments.ts +97 -47
  149. package/lib/platform/issues.ts +344 -174
  150. package/lib/platform/metadata-labels.ts +5 -2
  151. package/lib/platform/none-provider.ts +35 -0
  152. package/lib/platform/pr-change-report.ts +645 -0
  153. package/lib/platform/pr-checks.ts +129 -107
  154. package/lib/platform/pr-review.ts +88 -85
  155. package/lib/platform/pr-summary.ts +562 -52
  156. package/lib/platform/provider-bridge.ts +82 -0
  157. package/lib/platform/provider-contract.ts +536 -0
  158. package/lib/platform/provider-loader.ts +307 -0
  159. package/lib/platform/provider-validation.ts +529 -0
  160. package/lib/platform/pull-request-metadata.ts +10 -7
  161. package/lib/platform/pull-requests.ts +1126 -505
  162. package/lib/platform/release-notes.ts +76 -59
  163. package/lib/platform/releases.ts +77 -43
  164. package/lib/platform/resource-identity.ts +121 -0
  165. package/lib/platform/task-identities.ts +40 -0
  166. package/lib/platform/types.ts +4 -2
  167. package/lib/platform/verification-required.ts +21 -13
  168. package/lib/platform/verification-sync.ts +118 -293
  169. package/lib/pr-review/evidence-grading.ts +31 -11
  170. package/lib/run/index.ts +57 -22
  171. package/lib/sandbox/config.ts +7 -0
  172. package/lib/sandbox/control/client.ts +105 -15
  173. package/lib/sandbox/control/executor.ts +4 -4
  174. package/lib/sandbox/control/lifecycle.ts +30 -8
  175. package/lib/sandbox/control/protocol.ts +113 -0
  176. package/lib/sandbox/control/server.ts +431 -23
  177. package/lib/sandbox/control/state.ts +251 -1
  178. package/lib/server/process-state.ts +2 -2
  179. package/lib/server/protocol.ts +36 -1
  180. package/lib/task/activity-log.ts +8 -0
  181. package/lib/task/artifact-lifecycle.ts +34 -8
  182. package/lib/task/capabilities.ts +262 -0
  183. package/lib/task/commands/status.ts +38 -0
  184. package/lib/task/commit-intent.ts +137 -0
  185. package/lib/task/commit-operation.ts +186 -88
  186. package/lib/task/control-authority.ts +11 -8
  187. package/lib/task/create-service.ts +8 -8
  188. package/lib/task/create.ts +34 -9
  189. package/lib/task/current-contract.ts +6 -1
  190. package/lib/task/decision-details.ts +8 -64
  191. package/lib/task/delivery-target.ts +130 -0
  192. package/lib/task/delivery.ts +160 -0
  193. package/lib/task/events.ts +296 -16
  194. package/lib/task/finalization.ts +50 -14
  195. package/lib/task/human-override.ts +73 -46
  196. package/lib/task/invalidation-command.ts +86 -0
  197. package/lib/task/invalidation.ts +332 -0
  198. package/lib/task/ledger-intents.ts +35 -1
  199. package/lib/task/lifecycle.ts +93 -4
  200. package/lib/task/local-artifact-finalization.ts +563 -0
  201. package/lib/task/orchestration.ts +110 -146
  202. package/lib/task/pr-delivery-fact.ts +237 -0
  203. package/lib/task/review-finalization.ts +4 -14
  204. package/lib/task/review-fingerprint.ts +33 -2
  205. package/lib/task/rework-intent.ts +165 -0
  206. package/lib/task/skill-scope.ts +24 -0
  207. package/lib/task/task-execution-lock.ts +23 -14
  208. package/lib/task/verification-engine.ts +95 -43
  209. package/lib/task/verification-review.ts +2 -0
  210. package/lib/task/verification.ts +4 -4
  211. package/lib/task/workflow-warning-intents.ts +1 -1
  212. package/lib/task/write.ts +19 -0
  213. package/lib/update.ts +11 -1
  214. package/lib/version.ts +15 -1
  215. package/package.json +7 -1
  216. package/templates/.agents/rules/README.en.md +4 -2
  217. package/templates/.agents/rules/README.zh-CN.md +4 -2
  218. package/templates/.agents/rules/create-issue.en.md +11 -2
  219. package/templates/.agents/rules/create-issue.zh-CN.md +24 -2
  220. package/templates/.agents/rules/issue-pr-commands.en.md +4 -17
  221. package/templates/.agents/rules/issue-pr-commands.zh-CN.md +1 -1
  222. package/templates/.agents/rules/issue-sync.en.md +28 -5
  223. package/templates/.agents/rules/issue-sync.zh-CN.md +64 -5
  224. package/templates/.agents/rules/label-milestone-setup.en.md +15 -2
  225. package/templates/.agents/rules/label-milestone-setup.zh-CN.md +15 -2
  226. package/templates/.agents/rules/local-artifact-repair.en.md +53 -0
  227. package/templates/.agents/rules/local-artifact-repair.zh-CN.md +53 -0
  228. package/templates/.agents/rules/milestone-inference.en.md +12 -2
  229. package/templates/.agents/rules/milestone-inference.zh-CN.md +25 -3
  230. package/templates/.agents/rules/pr-sync.en.md +28 -13
  231. package/templates/.agents/rules/pr-sync.zh-CN.md +39 -5
  232. package/templates/.agents/rules/release-commands.en.md +42 -3
  233. package/templates/.agents/rules/release-commands.zh-CN.md +42 -3
  234. package/templates/.agents/rules/security-alerts.en.md +17 -2
  235. package/templates/.agents/rules/security-alerts.zh-CN.md +17 -2
  236. package/templates/.agents/rules/sync-content-generation.en.md +8 -0
  237. package/templates/.agents/rules/sync-content-generation.zh-CN.md +8 -0
  238. package/templates/.agents/rules/task-management.en.md +1 -1
  239. package/templates/.agents/rules/task-management.zh-CN.md +1 -1
  240. package/templates/.agents/rules/task-short-id.en.md +1 -4
  241. package/templates/.agents/rules/task-short-id.zh-CN.md +1 -3
  242. package/templates/.agents/scripts/security-alerts.github.sh +151 -0
  243. package/templates/.agents/scripts/security-alerts.sh +31 -0
  244. package/templates/.agents/skills/analyze-task/SKILL.en.md +14 -3
  245. package/templates/.agents/skills/analyze-task/SKILL.zh-CN.md +11 -3
  246. package/templates/.agents/skills/check-task/SKILL.en.md +16 -37
  247. package/templates/.agents/skills/check-task/SKILL.zh-CN.md +16 -37
  248. package/templates/.agents/skills/close-codescan/SKILL.en.md +2 -2
  249. package/templates/.agents/skills/close-codescan/SKILL.zh-CN.md +2 -2
  250. package/templates/.agents/skills/close-dependabot/SKILL.en.md +2 -2
  251. package/templates/.agents/skills/close-dependabot/SKILL.zh-CN.md +2 -2
  252. package/templates/.agents/skills/code-task/SKILL.en.md +32 -10
  253. package/templates/.agents/skills/code-task/SKILL.zh-CN.md +35 -13
  254. package/templates/.agents/skills/code-task/config/verify.en.json +1 -0
  255. package/templates/.agents/skills/code-task/config/verify.zh-CN.json +1 -0
  256. package/templates/.agents/skills/commit/SKILL.en.md +3 -3
  257. package/templates/.agents/skills/commit/SKILL.zh-CN.md +3 -3
  258. package/templates/.agents/skills/commit/config/verify.json +1 -1
  259. package/templates/.agents/skills/commit/reference/commit-orchestration.en.md +3 -3
  260. package/templates/.agents/skills/commit/reference/commit-orchestration.zh-CN.md +3 -3
  261. package/templates/.agents/skills/commit/reference/issue-metadata-sync.en.md +2 -0
  262. package/templates/.agents/skills/commit/reference/issue-metadata-sync.zh-CN.md +2 -0
  263. package/templates/.agents/skills/commit/reference/pr-summary-sync.en.md +4 -4
  264. package/templates/.agents/skills/commit/reference/pr-summary-sync.zh-CN.md +4 -4
  265. package/templates/.agents/skills/commit/reference/task-status-update.en.md +2 -2
  266. package/templates/.agents/skills/commit/reference/task-status-update.zh-CN.md +2 -2
  267. package/templates/.agents/skills/complete-manual-validation/SKILL.en.md +7 -4
  268. package/templates/.agents/skills/complete-manual-validation/SKILL.zh-CN.md +7 -4
  269. package/templates/.agents/skills/complete-manual-validation/config/verify.en.json +1 -1
  270. package/templates/.agents/skills/complete-manual-validation/config/verify.zh-CN.json +1 -1
  271. package/templates/.agents/skills/complete-manual-validation/reference/summary-update.en.md +5 -4
  272. package/templates/.agents/skills/complete-manual-validation/reference/summary-update.zh-CN.md +5 -4
  273. package/templates/.agents/skills/complete-task/SKILL.en.md +31 -13
  274. package/templates/.agents/skills/complete-task/SKILL.zh-CN.md +30 -13
  275. package/templates/.agents/skills/complete-task/reference/external-delivery.en.md +2 -2
  276. package/templates/.agents/skills/complete-task/reference/external-delivery.zh-CN.md +2 -2
  277. package/templates/.agents/skills/create-pr/SKILL.en.md +11 -10
  278. package/templates/.agents/skills/create-pr/SKILL.zh-CN.md +11 -11
  279. package/templates/.agents/skills/create-pr/config/verify.json +1 -0
  280. package/templates/.agents/skills/create-pr/reference/change-report.en.md +16 -4
  281. package/templates/.agents/skills/create-pr/reference/change-report.zh-CN.md +16 -4
  282. package/templates/.agents/skills/create-pr/reference/comment-publish.en.md +5 -3
  283. package/templates/.agents/skills/create-pr/reference/comment-publish.zh-CN.md +5 -3
  284. package/templates/.agents/skills/create-pr/reference/pr-body-template.en.md +1 -1
  285. package/templates/.agents/skills/create-pr/reference/pr-body-template.zh-CN.md +1 -1
  286. package/templates/.agents/skills/create-pr/scripts/change-report.mjs +3 -0
  287. package/templates/.agents/skills/create-task/SKILL.en.md +1 -0
  288. package/templates/.agents/skills/create-task/SKILL.zh-CN.md +1 -0
  289. package/templates/.agents/skills/import-codescan/SKILL.en.md +1 -1
  290. package/templates/.agents/skills/import-codescan/SKILL.zh-CN.md +1 -1
  291. package/templates/.agents/skills/import-dependabot/SKILL.en.md +1 -1
  292. package/templates/.agents/skills/import-dependabot/SKILL.zh-CN.md +1 -1
  293. package/templates/.agents/skills/init-labels/SKILL.en.md +9 -10
  294. package/templates/.agents/skills/init-labels/SKILL.zh-CN.md +9 -10
  295. package/templates/.agents/skills/init-labels/scripts/init-labels.github.sh +57 -1
  296. package/templates/.agents/skills/init-labels/scripts/init-labels.sh +27 -1
  297. package/templates/.agents/skills/init-milestones/SKILL.en.md +3 -5
  298. package/templates/.agents/skills/init-milestones/SKILL.zh-CN.md +3 -5
  299. package/templates/.agents/skills/plan-task/SKILL.en.md +14 -3
  300. package/templates/.agents/skills/plan-task/SKILL.zh-CN.md +11 -3
  301. package/templates/.agents/skills/review-analysis/SKILL.en.md +6 -5
  302. package/templates/.agents/skills/review-analysis/SKILL.zh-CN.md +6 -5
  303. package/templates/.agents/skills/review-analysis/reference/output-templates.en.md +18 -0
  304. package/templates/.agents/skills/review-analysis/reference/output-templates.zh-CN.md +18 -0
  305. package/templates/.agents/skills/review-code/SKILL.en.md +10 -9
  306. package/templates/.agents/skills/review-code/SKILL.zh-CN.md +10 -9
  307. package/templates/.agents/skills/review-code/reference/output-templates.en.md +19 -1
  308. package/templates/.agents/skills/review-code/reference/output-templates.zh-CN.md +19 -1
  309. package/templates/.agents/skills/review-code/reference/report-template.en.md +4 -2
  310. package/templates/.agents/skills/review-code/reference/report-template.zh-CN.md +4 -2
  311. package/templates/.agents/skills/review-plan/SKILL.en.md +6 -5
  312. package/templates/.agents/skills/review-plan/SKILL.zh-CN.md +6 -5
  313. package/templates/.agents/skills/review-plan/reference/output-templates.en.md +18 -0
  314. package/templates/.agents/skills/review-plan/reference/output-templates.zh-CN.md +18 -0
  315. package/templates/.agents/skills/review-pr/SKILL.en.md +1 -0
  316. package/templates/.agents/skills/review-pr/SKILL.zh-CN.md +1 -0
  317. package/templates/.agents/skills/review-pr/reference/evidence-grading.en.md +2 -2
  318. package/templates/.agents/skills/review-pr/reference/evidence-grading.zh-CN.md +2 -2
  319. package/templates/.agents/skills/run-manual-validation/SKILL.en.md +5 -2
  320. package/templates/.agents/skills/run-manual-validation/SKILL.zh-CN.md +5 -2
  321. package/templates/.agents/skills/run-task/SKILL.en.md +1 -1
  322. package/templates/.agents/skills/run-task/SKILL.zh-CN.md +1 -1
  323. package/templates/.agents/skills/update-agent-infra/scripts/sync-templates.js +4 -0
  324. package/templates/.agents/skills/watch-pr/SKILL.en.md +6 -6
  325. package/templates/.agents/skills/watch-pr/SKILL.zh-CN.md +6 -6
  326. package/templates/.agents/skills/watch-pr/reference/monitor-and-heal.en.md +6 -0
  327. package/templates/.agents/skills/watch-pr/reference/monitor-and-heal.zh-CN.md +6 -0
  328. package/templates/.agents/templates/task.en.md +23 -2
  329. package/templates/.agents/templates/task.zh-CN.md +23 -2
  330. package/templates/.agents/workflows/bug-fix.en.yaml +9 -8
  331. package/templates/.agents/workflows/bug-fix.zh-CN.yaml +9 -8
  332. package/templates/.agents/workflows/feature-development.en.yaml +9 -8
  333. package/templates/.agents/workflows/feature-development.zh-CN.yaml +9 -8
  334. package/templates/.agents/workflows/refactoring.en.yaml +9 -8
  335. package/templates/.agents/workflows/refactoring.zh-CN.yaml +9 -8
  336. package/templates/.github/workflows/pr-label.yml +7 -26
  337. package/templates/.agents/rules/create-issue.github.en.md +0 -14
  338. package/templates/.agents/rules/create-issue.github.zh-CN.md +0 -27
  339. package/templates/.agents/rules/issue-pr-commands.github.en.md +0 -34
  340. package/templates/.agents/rules/issue-pr-commands.github.zh-CN.md +0 -49
  341. package/templates/.agents/rules/issue-sync.github.en.md +0 -40
  342. package/templates/.agents/rules/issue-sync.github.zh-CN.md +0 -76
  343. package/templates/.agents/rules/label-milestone-setup.github.en.md +0 -60
  344. package/templates/.agents/rules/label-milestone-setup.github.zh-CN.md +0 -60
  345. package/templates/.agents/rules/milestone-inference.github.en.md +0 -15
  346. package/templates/.agents/rules/milestone-inference.github.zh-CN.md +0 -27
  347. package/templates/.agents/rules/pr-checks-commands.github.en.md +0 -18
  348. package/templates/.agents/rules/pr-checks-commands.github.zh-CN.md +0 -34
  349. package/templates/.agents/rules/pr-sync.github.en.md +0 -43
  350. package/templates/.agents/rules/pr-sync.github.zh-CN.md +0 -69
  351. package/templates/.agents/rules/release-commands.github.en.md +0 -44
  352. package/templates/.agents/rules/release-commands.github.zh-CN.md +0 -44
  353. package/templates/.agents/rules/security-alerts.github.en.md +0 -43
  354. package/templates/.agents/rules/security-alerts.github.zh-CN.md +0 -43
  355. /package/templates/.agents/rules/{issue-fields.github.en.md → issue-fields.en.md} +0 -0
  356. /package/templates/.agents/rules/{issue-fields.github.zh-CN.md → issue-fields.zh-CN.md} +0 -0
@@ -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` 表示网络或平台阻塞。
@@ -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 解析器。
@@ -49,7 +49,7 @@ The seven internal commands (`task-event` / `task-lifecycle` / `task-finalizatio
49
49
  - `review-plan`: update `current_step`, `updated_at`, `agent_infra_version`
50
50
  - `code-task`: update `current_step`, `updated_at`, `agent_infra_version`
51
51
  - `review-code`: update `current_step`, `updated_at`, `agent_infra_version`
52
- - `create-pr`: update `pr_number`, `updated_at`, `agent_infra_version`
52
+ - `create-pr`: update the verified `pr_delivery_fact`, `updated_at`, `agent_infra_version`
53
53
  - `commit`: update `updated_at`, `agent_infra_version`; update `current_step` when needed (see `commit/reference/task-status-update.md`)
54
54
  - `complete-task`: update `status`, `current_step`, `completed_at`, `updated_at`, `agent_infra_version`
55
55
  - `block-task`: update `status`, `blocked_at`, `updated_at`, `agent_infra_version`
@@ -49,7 +49,7 @@
49
49
  - `review-plan`:更新 `current_step`、`updated_at`、`agent_infra_version`
50
50
  - `code-task`:更新 `current_step`、`updated_at`、`agent_infra_version`
51
51
  - `review-code`:更新 `current_step`、`updated_at`、`agent_infra_version`
52
- - `create-pr`:更新 `pr_number`、`updated_at`、`agent_infra_version`
52
+ - `create-pr`:通过 `pr_delivery_fact` writer 更新 PR 绑定事实、`updated_at`、`agent_infra_version`
53
53
  - `commit`:更新 `updated_at`、`agent_infra_version`;必要时更新 `current_step`(详见 `commit/reference/task-status-update.md`)
54
54
  - `complete-task`:更新 `status`、`current_step`、`completed_at`、`updated_at`、`agent_infra_version`
55
55
  - `block-task`:更新 `status`、`blocked_at`、`updated_at`、`agent_infra_version`
@@ -123,7 +123,4 @@ repair hint.
123
123
  ## Cross-TUI use
124
124
 
125
125
  Bare numeric `N` is safe in every shell and TUI without quoting:
126
- `ai sandbox exec 11 'npm test'`, `/review-analysis 11`.
127
-
128
- Starting with the next major version, migrate the old `#NN` form to `NN`;
129
- even a quoted value delivered intact to the CLI is rejected.
126
+ `ai sandbox exec 11 'npm test'`, `/review-analysis --task 11`.
@@ -97,6 +97,4 @@ fi
97
97
  ## 跨 TUI 使用
98
98
 
99
99
  裸数字 `N` 在所有 shell 与 TUI 中都安全无需引号:
100
- `ai sandbox exec 11 'npm test'`、`/review-analysis 11`。
101
-
102
- 从下一个大版本起,原 `#NN` 写法必须迁移为 `NN`;即使引用后完整传入 CLI 也会被拒绝。
100
+ `ai sandbox exec 11 'npm test'`、`/review-analysis --task 11`。
@@ -0,0 +1,151 @@
1
+ #!/bin/sh
2
+
3
+ set -e
4
+
5
+ operation="${1:-}"
6
+ shift || true
7
+ number=""
8
+ reason=""
9
+ comment_file=""
10
+
11
+ while [ "$#" -gt 0 ]; do
12
+ case "$1" in
13
+ --number)
14
+ number="${2:-}"
15
+ shift
16
+ ;;
17
+ --reason)
18
+ reason="${2:-}"
19
+ shift
20
+ ;;
21
+ --comment-file)
22
+ comment_file="${2:-}"
23
+ shift
24
+ ;;
25
+ *)
26
+ echo "Unknown option: $1" >&2
27
+ exit 2
28
+ ;;
29
+ esac
30
+ shift
31
+ done
32
+
33
+ emit_error() {
34
+ code="$1"
35
+ message="$2"
36
+ node - "$operation" "$code" "$message" <<'NODE'
37
+ const [operation, code, message] = process.argv.slice(2);
38
+ process.stdout.write(`${JSON.stringify({ status: "failed", operation, error: { code, message } })}\n`);
39
+ NODE
40
+ }
41
+
42
+ case "$operation" in
43
+ read-dependabot|dismiss-dependabot|read-codescan|dismiss-codescan) ;;
44
+ *)
45
+ emit_error "SECURITY_OPERATION_INVALID" "Unknown security alert operation."
46
+ exit 1
47
+ ;;
48
+ esac
49
+
50
+ case "$number" in
51
+ ''|*[!0-9]*)
52
+ emit_error "SECURITY_NUMBER_INVALID" "Alert number must be a positive integer."
53
+ exit 1
54
+ ;;
55
+ esac
56
+
57
+ if ! command -v gh >/dev/null 2>&1; then
58
+ emit_error "PLATFORM_CLI_MISSING" "The platform CLI is not installed."
59
+ exit 1
60
+ fi
61
+ if ! gh auth token >/dev/null 2>&1; then
62
+ emit_error "PLATFORM_NOT_AUTHENTICATED" "The platform CLI is not authenticated."
63
+ exit 1
64
+ fi
65
+ repo="$(gh repo view --json nameWithOwner --jq '.nameWithOwner')" || {
66
+ emit_error "PLATFORM_REPOSITORY_UNAVAILABLE" "Unable to access the current repository."
67
+ exit 1
68
+ }
69
+
70
+ case "$operation" in
71
+ *dependabot*) endpoint="repos/$repo/dependabot/alerts/$number" ;;
72
+ *codescan*) endpoint="repos/$repo/code-scanning/alerts/$number" ;;
73
+ esac
74
+
75
+ tmpdir="$(mktemp -d)"
76
+ trap 'rm -rf "$tmpdir"' EXIT HUP INT TERM
77
+
78
+ if [ "$operation" = "read-dependabot" ] || [ "$operation" = "read-codescan" ]; then
79
+ if ! gh api "$endpoint" > "$tmpdir/response.json" 2> "$tmpdir/error.txt"; then
80
+ emit_error "SECURITY_API_FAILED" "Unable to read the security alert."
81
+ exit 2
82
+ fi
83
+ else
84
+ if [ -z "$reason" ] || [ -z "$comment_file" ] || [ ! -f "$comment_file" ]; then
85
+ emit_error "SECURITY_DISMISS_INPUT_INVALID" "Dismissal reason and comment file are required."
86
+ exit 1
87
+ fi
88
+ if ! gh api "$endpoint" > "$tmpdir/current.json" 2> "$tmpdir/error.txt"; then
89
+ emit_error "SECURITY_API_FAILED" "Unable to read the security alert before dismissal."
90
+ exit 2
91
+ fi
92
+ state="$(node - "$tmpdir/current.json" <<'NODE'
93
+ const fs = require("node:fs");
94
+ try {
95
+ const alert = JSON.parse(fs.readFileSync(process.argv[2], "utf8"));
96
+ process.stdout.write(typeof alert.state === "string" ? alert.state : "invalid");
97
+ } catch {
98
+ process.stdout.write("invalid");
99
+ }
100
+ NODE
101
+ )"
102
+ case "$state" in
103
+ open) ;;
104
+ dismissed|fixed)
105
+ node - "$operation" "$tmpdir/current.json" <<'NODE'
106
+ const fs = require("node:fs");
107
+ const [operation, responsePath] = process.argv.slice(2);
108
+ const data = JSON.parse(fs.readFileSync(responsePath, "utf8"));
109
+ process.stdout.write(`${JSON.stringify({ status: "no-op", operation, data })}\n`);
110
+ NODE
111
+ exit 0
112
+ ;;
113
+ *)
114
+ emit_error "SECURITY_RESPONSE_INVALID" "The platform returned an alert without a valid state."
115
+ exit 1
116
+ ;;
117
+ esac
118
+ node - "$reason" "$comment_file" > "$tmpdir/payload.json" <<'NODE'
119
+ const fs = require("node:fs");
120
+ const [reason, commentFile] = process.argv.slice(2);
121
+ process.stdout.write(JSON.stringify({
122
+ state: "dismissed",
123
+ dismissed_reason: reason,
124
+ dismissed_comment: fs.readFileSync(commentFile, "utf8")
125
+ }));
126
+ NODE
127
+ if ! gh api --method PATCH "$endpoint" --input "$tmpdir/payload.json" > "$tmpdir/response.json" 2> "$tmpdir/error.txt"; then
128
+ emit_error "SECURITY_API_FAILED" "Unable to dismiss the security alert."
129
+ exit 2
130
+ fi
131
+ fi
132
+
133
+ node - "$operation" "$tmpdir/response.json" <<'NODE'
134
+ const fs = require("node:fs");
135
+ const [operation, responsePath] = process.argv.slice(2);
136
+ const raw = fs.readFileSync(responsePath, "utf8").trim();
137
+ let data = null;
138
+ if (raw) {
139
+ try {
140
+ data = JSON.parse(raw);
141
+ } catch {
142
+ process.stdout.write(`${JSON.stringify({
143
+ status: "failed",
144
+ operation,
145
+ error: { code: "SECURITY_RESPONSE_INVALID", message: "The platform returned invalid JSON." }
146
+ })}\n`);
147
+ process.exit(1);
148
+ }
149
+ }
150
+ process.stdout.write(`${JSON.stringify({ status: "applied", operation, data })}\n`);
151
+ NODE
@@ -0,0 +1,31 @@
1
+ #!/bin/sh
2
+
3
+ set -e
4
+
5
+ operation="${1:-}"
6
+
7
+ node - "$operation" <<'NODE'
8
+ const operation = process.argv[2] || "";
9
+ const known = new Set([
10
+ "read-dependabot",
11
+ "dismiss-dependabot",
12
+ "read-codescan",
13
+ "dismiss-codescan"
14
+ ]);
15
+ const payload = known.has(operation)
16
+ ? {
17
+ status: "degraded",
18
+ operation,
19
+ error: {
20
+ code: "PLATFORM_SECURITY_UNSUPPORTED",
21
+ message: "The current platform does not provide a security alert adapter."
22
+ }
23
+ }
24
+ : {
25
+ status: "failed",
26
+ operation,
27
+ error: { code: "SECURITY_OPERATION_INVALID", message: "Unknown security alert operation." }
28
+ };
29
+ process.stdout.write(`${JSON.stringify(payload)}\n`);
30
+ process.exit(known.has(operation) ? 0 : 1);
31
+ NODE
@@ -9,12 +9,13 @@ description: >
9
9
  # Analyze Task
10
10
  > `--agent` values are defined in `.agents/rules/task-management.md` under “Collaborator Token Specification”.
11
11
 
12
- If the entry operands contain `--orchestrated`, bind `{execution-flag}` to `--orchestrated` and forward it unchanged to the completed event; otherwise bind it to an empty value. Never infer it from `orchestration.json`, environment variables, or prior artifacts.
12
+ If the entry operands contain `--orchestrated`, bind `{execution-flag}` to `--orchestrated` and forward it unchanged to the completed event; otherwise bind it to an empty value. Never infer it from `orchestration.json`, environment variables, or prior artifacts. Lifecycle events also require explicit trigger data: use `{trigger-initiator}=orchestrator` for orchestration and `model` otherwise; `{request-id}` is a stable single-line identifier for this task and artifact round, and `{reason-code}` is `user-request`, `new-requirement`, or `upstream-fact-doubt`. Reuse the same values for started and completed.
13
13
 
14
14
  ## Boundary / Critical Rules
15
15
 
16
16
  - This skill only outputs a requirements analysis document (`analysis.md` or `analysis-r{N}.md`) and does not modify any business code
17
17
  - Base the analysis strictly on the existing task input, requirements, context, and source information in `task.md`
18
+ - Before generating task or lifecycle Markdown that will be synchronized to an Issue, read `.agents/rules/sync-content-generation.md` and apply its producer-side constraints; the sync path does not parse or rewrite the body
18
19
  - When old behavior, data, schemas, or callers are involved, read `.agents/rules/compatibility-policy.md` first. State current-only when admission evidence is absent; do not turn speculation into a requirement
19
20
  - After executing this skill, you **must** immediately update task status in task.md
20
21
 
@@ -40,7 +41,7 @@ Before the state check is complete, do not make external-state assertions such a
40
41
 
41
42
  ## Step Start: Declare the started Event
42
43
 
43
- After resolving the artifact context and before this round's first artifact action, run `agent-infra-internal task-event {task-id} analyze.started --agent {standard-agent-token}` and verify the returned `artifactContext`.
44
+ After resolving the artifact context and before this round's first artifact action, run `agent-infra-internal task-event {task-id} analyze.started --agent {standard-agent-token} --initiator {trigger-initiator} --request-id {request-id} --reason-code {reason-code}` and verify the returned `artifactContext`.
44
45
 
45
46
  ## Steps
46
47
 
@@ -202,7 +203,17 @@ Update `.agents/workspace/active/{task-id}/task.md`:
202
203
  - Overwrite the `priority` field in frontmatter with the new value
203
204
  - Append a `## Priority Re-estimate` section to this round's analysis artifact `{analysis-artifact}`, recording: `priority {old} → {new} (rationale: {short basis grounded in this analysis})`
204
205
  If the re-estimated value matches the current value, skip it: do not write the `## Priority Re-estimate` section. The Flow A sync that follows reads the possibly updated frontmatter and propagates the new value to the Issue automatically.
205
- After the business fields are updated, run `agent-infra-internal task-event {task-id} analyze.completed --agent {standard-agent-token} --artifact {analysis-artifact} {execution-flag}` so the core atomically records the link, stage, agent, metadata, and Activity Log.
206
+ After writing the local artifact, run the pre-completion gate:
207
+
208
+ ```bash
209
+ agent-infra-internal task-artifact {task-id} finalize-local --family analysis --artifact {analysis-artifact}
210
+ ```
211
+
212
+ - On `status=passed`, save that result's `artifactSha256` and `semanticDigest`; the finalizer has recorded the matching one-shot local provenance intent.
213
+ - On `status=failed` with `repairable=true`, apply only the diagnostic's `replace-line` operation once, then rerun the same command completely; count an attempt only after bytes change, up to 8 attempts.
214
+ - The first repairable failure's `semanticDigest` is retained as the baseline; a retried `status=passed` result must match it. On baseline mismatch, any other failure, no progress, or a repeated diagnostic, stop without publishing a completed event.
215
+
216
+ Use the digests from that same `status=passed` result in `agent-infra-internal task-event {task-id} analyze.completed --agent {standard-agent-token} --initiator {trigger-initiator} --request-id {request-id} --reason-code {reason-code} --artifact {analysis-artifact} --artifact-sha256 {artifact-sha256} --semantic-digest {semantic-digest} {execution-flag}` so the core records the link, stage, agent, metadata, and Activity Log atomically.
206
217
  - {YYYY-MM-DD HH:mm:ss±HH:MM} — **Analyze Task (Round {N})** by {agent} — Analysis completed → {analysis-artifact}
207
218
  ```
208
219
 
@@ -9,12 +9,13 @@ description: >
9
9
  # 分析任务
10
10
  > `--agent` 取值见 `.agents/rules/task-management.md`「合作者 token 规范」。
11
11
 
12
- 若入口业务操作数包含 `--orchestrated`,绑定 `{execution-flag}` = `--orchestrated` 并原样转发给 completed 事件;否则绑定为空。不得从 `orchestration.json`、环境变量或历史产物推断该标记。
12
+ 若入口业务操作数包含 `--orchestrated`,绑定 `{execution-flag}` = `--orchestrated` 并原样转发给 completed 事件;否则绑定为空。不得从 `orchestration.json`、环境变量或历史产物推断该标记。生命周期事件还必须携带显式触发信息:编排调用使用 `{trigger-initiator}=orchestrator`,否则使用 `model`;`{request-id}` 是本任务与本轮产物的稳定单行标识,`{reason-code}` 使用 `user-request`、`new-requirement` 或 `upstream-fact-doubt`;started 与 completed 使用同一组值。
13
13
 
14
14
  ## 行为边界 / 关键规则
15
15
 
16
16
  - 本技能仅产出需求分析文档(`analysis.md` 或 `analysis-r{N}.md`)—— 不修改任何业务代码
17
17
  - 严格基于 `task.md` 中已有的任务输入、需求、上下文和来源信息展开分析
18
+ - 生成会同步到 Issue 的任务或生命周期 Markdown 前,先读取 `.agents/rules/sync-content-generation.md` 并遵循其中的生成端约束;同步端不解析或改写正文
18
19
  - 涉及旧行为、旧数据、旧 schema 或旧调用方时,先读取 `.agents/rules/compatibility-policy.md`;没有兼容准入证据时明确采用 current-only,不把推测写成需求
19
20
  - 执行本技能后,你**必须**立即更新 task.md 中的任务状态
20
21
 
@@ -43,7 +44,7 @@ agent-infra-internal task-snapshot {task-id} --format text
43
44
  确认前置条件和轮次后、本轮第一个产出动作之前执行:
44
45
 
45
46
  ```bash
46
- agent-infra-internal task-event {task-id} analyze.started --agent {standard-agent-token}
47
+ agent-infra-internal task-event {task-id} analyze.started --agent {standard-agent-token} --initiator {trigger-initiator} --request-id {request-id} --reason-code {reason-code}
47
48
  ```
48
49
 
49
50
  ## 执行步骤
@@ -203,7 +204,14 @@ agent-infra-internal task-event {task-id} analyze.started --agent {standard-agen
203
204
  - 用新值覆盖 frontmatter 的 `priority` 字段
204
205
  - 在本轮分析产物 `{analysis-artifact}` 中追加 `## 优先级重估` 段,记录一条:`priority {old} → {new} (rationale: {基于本轮分析的简短依据})`
205
206
  若重估值与当前值一致,跳过:不写入 `## 优先级重估` 段。后续 Flow A 同步会读取可能更新过的 frontmatter,并自动把新值同步到 Issue。
206
- - 完成业务内容更新后执行 `agent-infra-internal task-event {task-id} analyze.completed --agent {standard-agent-token} --artifact {analysis-artifact} {execution-flag}`,由核心原子登记链接、阶段、代理、时间、版本和 Activity Log。
207
+ - 完成本地产物后,先执行本地完成前门禁:
208
+ ```bash
209
+ agent-infra-internal task-artifact {task-id} finalize-local --family analysis --artifact {analysis-artifact}
210
+ ```
211
+ - `status=passed`:保存本次返回的 `artifactSha256` 和 `semanticDigest`;finalizer 已记录对应的一次性本地 provenance intent。
212
+ - `status=failed` 且 `repairable=true`:仅按诊断中的 `replace-line` 操作做一次最小修改,然后完整重跑同一命令;实际字节发生变化才计一次 `repairAttempts`,最多 8 次。
213
+ - 首次可修复失败的 `semanticDigest` 由 finalizer 保留为基线;重试后的 `status=passed` 必须匹配该基线。基线不匹配、其他失败、无进展或重复诊断:停止,不发布 completed 事件。
214
+ - 使用同一次 `status=passed` 返回的摘要执行 `agent-infra-internal task-event {task-id} analyze.completed --agent {standard-agent-token} --initiator {trigger-initiator} --request-id {request-id} --reason-code {reason-code} --artifact {analysis-artifact} --artifact-sha256 {artifact-sha256} --semantic-digest {semantic-digest} {execution-flag}`,由核心登记链接、阶段、代理、时间、版本和 Activity Log。
207
215
 
208
216
  如果 task.md 中存在有效的 `issue_number`,执行以下同步操作(任一失败则跳过并继续):
209
217
  - 调用 `agent-infra-internal platform-issue sync {task-id} --agent {standard-agent-token} --status pending-design-work --fields`
@@ -11,7 +11,7 @@ description: >
11
11
  ## Boundary / Critical Rules
12
12
 
13
13
  - This skill is **read-only** -- do not modify any files
14
- - Mechanical facts (frontmatter metadata, artifact grouping, git/platform state, and locating the task across the active, blocked, and completed directories) are delegated to the deterministic `ai task status` command. This skill only adds the semantic layer the CLI cannot produce: workflow-stage interpretation, review-verdict parsing, and the next-step recommendation.
14
+ - Mechanical facts (frontmatter metadata, artifact grouping, git/platform state, and locating the task across the active, blocked, and completed directories) are delegated to the deterministic `ai task status` command. This skill only adds the semantic layer the CLI cannot produce: workflow-stage interpretation and review-verdict parsing; the next action comes directly from the CLI's canonical recommendation.
15
15
 
16
16
  ## Task Context Resolution
17
17
 
@@ -45,7 +45,7 @@ This is the semantic layer the CLI does not produce. Using the `Artifacts` group
45
45
  - `[pending]` - not started yet
46
46
  - `[blocked]` - blocked
47
47
  - `[skipped]` - skipped
48
- - For the latest review artifact of each stage (`review-analysis`, `review-plan`, `review-code`), read the report body and parse its conclusion: the overall verdict (Approved / Changes Requested / Rejected) and the blocker / major / minor counts. The CLI does not parse review bodies, so this reading is required to choose the next action in step 3.
48
+ - For the latest review artifact of each stage (`review-analysis`, `review-plan`, `review-code`), read the report body and parse its conclusion: the overall verdict (Approved / Changes Requested / Rejected) and the blocker / major / minor counts. Use these conclusions only to explain stage status; do not recompute the next action from them.
49
49
 
50
50
  Present the workflow progress as an overlay on top of the CLI output, marking the latest round and the parsed review verdict, for example:
51
51
 
@@ -57,41 +57,20 @@ Workflow progress:
57
57
  [pending] Plan Review
58
58
  ```
59
59
 
60
- ### 3. Recommend Next Action
61
-
62
- Recommend the appropriate next skill based on the current workflow state.
63
-
64
- > **⚠️ CONDITION CHECK — you must choose the single matching row in the table below based on `status`, `current_step`, the latest artifacts, and the latest review result:**
65
- >
66
- > - `status = blocked` -> choose "Task Blocked"
67
- > - `status = completed` -> choose "Task Completed"
68
- > - `current_step = requirement-analysis` and the latest analysis artifact is complete -> choose "Analysis Complete"
69
- > - `current_step = requirement-analysis-review` and the latest analysis review artifact is approved -> choose "Analysis Review Passed"
70
- > - `current_step = requirement-analysis-review` and the latest analysis review artifact exists but is not approved or has findings -> choose "Analysis Review Has Issues"
71
- > - `current_step = technical-design` and the latest plan artifact is complete -> choose "Plan Complete"
72
- > - `current_step = technical-design-review` and the latest plan review artifact is approved -> choose "Plan Review Passed"
73
- > - `current_step = technical-design-review` and the latest plan review artifact exists but is not approved or has findings -> choose "Plan Review Has Issues"
74
- > - The latest code artifact exists and there is still no latest code review artifact -> choose "Code Complete"
75
- > - `current_step = code-review` and the latest code review artifact exists, the verdict is `Approved`, and `Blocker = 0`, `Major = 0`, `Minor = 0` -> choose "Code Review Passed"
76
- > - `current_step = code-review` and the latest code review artifact exists, but any `Blocker`, `Major`, or `Minor` issue remains, or the verdict is not a clean approval -> choose "Code Review Has Issues"
77
- >
78
- > **Important: if the latest review report contains any issue at all, do not use the corresponding review-passed row. Use the corresponding has-issues row instead.**
79
- >
80
- > Before rendering the final output, read `.agents/rules/next-step-output.md`. After selecting an actionable row, invoke `agent-infra-internal agent-client next-steps --skill {next-skill} [--task-ref {task-ref}]` exactly once and render stdout verbatim as `{next-step-commands}`. Do not invoke the helper for `Task Blocked` or `Task Completed`. Append the `Completed at` trailing line last.
81
-
82
- | Current State | next skill | task ref |
83
- |----------------------------|-------------------|----------|
84
- | Analysis Complete | `review-analysis` | required |
85
- | Analysis Review Passed | `plan-task` | required |
86
- | Analysis Review Has Issues | `analyze-task` | required |
87
- | Plan Complete | `review-plan` | required |
88
- | Plan Review Passed | `code-task` | required |
89
- | Plan Review Has Issues | `plan-task` | required |
90
- | Code Complete | `review-code` | required |
91
- | Code Review Passed | `commit` | omitted |
92
- | Code Review Has Issues | `code-task` | required |
93
- | Task Blocked | — | — |
94
- | Task Completed | — | — |
60
+ ### 3. Display the canonical recommendation
61
+
62
+ Read only `Recommendation.action` from the `ai task status --task {task-id}` output and use it as the sole source of the next action. Do not recompute an action from `current_step`, the latest files, review prose, or the Activity Log.
63
+
64
+ When the action is non-empty, perform only this literal action-to-skill conversion, then invoke the shared helper once:
65
+
66
+ | Recommendation.action | next skill |
67
+ |-----------------------|------------|
68
+ | `analysis` | `analyze-task` |
69
+ | `plan` | `plan-task` |
70
+ | `code` | `code-task` |
71
+ | any other action | same-named skill |
72
+
73
+ When the action is empty, do not invoke the helper; state that no next skill is currently recommended. Before rendering the final output, read `.agents/rules/next-step-output.md`; invoke `agent-infra-internal agent-client next-steps --skill {next-skill} --task-ref {task-ref}` and render stdout verbatim as `{next-step-commands}`. Append the `Completed at` trailing line last.
95
74
 
96
75
  ## Notes
97
76
 
@@ -11,7 +11,7 @@ description: >
11
11
  ## 行为边界 / 关键规则
12
12
 
13
13
  - 本技能是**只读**操作 —— 不修改任何文件
14
- - 机械数据(frontmatter 元数据、产物分组、Git/Platform 状态,以及跨 active、blocked、completed 三目录定位任务)一律委托给确定性的 `ai task status` 命令。本技能只负责 CLI 无法产出的语义层:工作流阶段解读、审查结论解析、下一步建议。
14
+ - 机械数据(frontmatter 元数据、产物分组、Git/Platform 状态,以及跨 active、blocked、completed 三目录定位任务)一律委托给确定性的 `ai task status` 命令。本技能只负责 CLI 无法产出的语义层:工作流阶段解读和审查结论解析;下一步 action 直接使用 CLI 的 canonical recommendation。
15
15
 
16
16
  ## 任务上下文解析
17
17
 
@@ -45,7 +45,7 @@ ai task status --task {task-id}
45
45
  - `[pending]` - 尚未开始
46
46
  - `[blocked]` - 被阻塞
47
47
  - `[skipped]` - 已跳过
48
- - 对各阶段最新的审查产物(`review-analysis`、`review-plan`、`review-code`),读取报告正文并解析结论:总体结论(通过 / 需要修改 / 拒绝)与阻塞项 / 主要问题 / 次要问题计数。CLI 不解析审查正文,因此这一步是步骤 3 选择下一步操作的必要输入。
48
+ - 对各阶段最新的审查产物(`review-analysis`、`review-plan`、`review-code`),读取报告正文并解析结论:总体结论(通过 / 需要修改 / 拒绝)与阻塞项 / 主要问题 / 次要问题计数。这些结论只用于阶段状态展示和解释,不得用于重算下一步 action。
49
49
 
50
50
  把工作流进度作为 CLI 输出之上的叠加层呈现,标注最新轮次与解析出的审查结论,例如:
51
51
 
@@ -57,41 +57,20 @@ ai task status --task {task-id}
57
57
  [pending] 技术方案审查
58
58
  ```
59
59
 
60
- ### 3. 建议下一步操作
61
-
62
- 根据当前工作流状态,建议合适的下一个技能:
63
-
64
- > **⚠️ 条件判断 — 你必须先根据 `status`、`current_step`、最新产物和最新审查结果,选择下表中唯一匹配的一行:**
65
- >
66
- > - `status = blocked` → 选择「任务被阻塞」
67
- > - `status = completed` → 选择「任务已完成」
68
- > - `current_step = requirement-analysis` 且最新分析产物已完成 → 选择「分析完成」
69
- > - `current_step = requirement-analysis-review` 且最新需求分析审查产物通过 → 选择「需求分析审查通过」
70
- > - `current_step = requirement-analysis-review` 且最新需求分析审查产物存在但未通过或有问题 → 选择「需求分析审查有问题」
71
- > - `current_step = technical-design` 且最新计划产物已完成 → 选择「计划完成」
72
- > - `current_step = technical-design-review` 且最新技术方案审查产物通过 → 选择「技术方案审查通过」
73
- > - `current_step = technical-design-review` 且最新技术方案审查产物存在但未通过或有问题 → 选择「技术方案审查有问题」
74
- > - 最新实现产物已存在,且尚无最新审查产物 → 选择「实现完成」
75
- > - `current_step = code-review` 且最新代码审查产物存在,且结论为 `Approved`,同时 `Blocker = 0`、`Major = 0`、`Minor = 0` → 选择「代码审查通过」
76
- > - `current_step = code-review` 且最新代码审查产物存在,但仍有任何 `Blocker`、`Major` 或 `Minor` 问题,或结论不是无问题通过 → 选择「代码审查有问题」
77
- >
78
- > **特别注意:只要最新审查报告中存在任何问题,就不能使用对应「审查通过」行。必须改用对应「审查有问题」行。**
79
- >
80
- > 渲染最终输出前先读取 `.agents/rules/next-step-output.md`。选中可执行行后只调用一次 `agent-infra-internal agent-client next-steps --skill {next-skill} [--task-ref {task-ref}]`,将 stdout 原样输出为 `{next-step-commands}`;`任务被阻塞` 与 `任务已完成` 不调用 helper。最后追加 `Completed at` 收尾行。
81
-
82
- | 当前状态 | next skill | task ref |
83
- |--------------------|-------------------|----------|
84
- | 分析完成 | `review-analysis` | required |
85
- | 需求分析审查通过 | `plan-task` | required |
86
- | 需求分析审查有问题 | `analyze-task` | required |
87
- | 计划完成 | `review-plan` | required |
88
- | 技术方案审查通过 | `code-task` | required |
89
- | 技术方案审查有问题 | `plan-task` | required |
90
- | 实现完成 | `review-code` | required |
91
- | 代码审查通过 | `commit` | omitted |
92
- | 代码审查有问题 | `code-task` | required |
93
- | 任务被阻塞 | — | — |
94
- | 任务已完成 | — | — |
60
+ ### 3. 展示 canonical recommendation
61
+
62
+ 只读取 `ai task status --task {task-id}` 输出中的 `Recommendation.action`,将其作为唯一下一步来源。不要根据 `current_step`、目录中的最新产物、审查正文或 Activity Log 再计算 action。
63
+
64
+ 当 action 非空时,仅做以下 action 到 skill 的字面转换,然后调用一次统一 helper:
65
+
66
+ | Recommendation.action | next skill |
67
+ |-----------------------|------------|
68
+ | `analysis` | `analyze-task` |
69
+ | `plan` | `plan-task` |
70
+ | `code` | `code-task` |
71
+ | 其他 action | 同名 skill |
72
+
73
+ `action` 为空时不调用 helper,只说明当前没有可推荐的下一技能。渲染最终输出前先读取 `.agents/rules/next-step-output.md`;helper 命令为 `agent-infra-internal agent-client next-steps --skill {next-skill} --task-ref {task-ref}`,stdout 原样作为 `{next-step-commands}` 下一步命令。最后追加 `Completed at` 收尾行。
95
74
 
96
75
  ## 注意事项
97
76
 
@@ -23,7 +23,7 @@ The skill still owns the security-alert API. When a related task exists, Step 7
23
23
 
24
24
  ### 1. Retrieve Alert Information
25
25
 
26
- Read `.agents/rules/security-alerts.md` before this step, then use its Code Scanning alert read command to fetch the alert details.
26
+ Read `.agents/rules/security-alerts.md` before this step, then run `bash .agents/scripts/security-alerts.sh read-codescan --number {alert-number}` and parse its JSON result to fetch the alert details.
27
27
 
28
28
  Verify that the alert is in the `open` state. If it is already dismissed or fixed, inform the user and exit.
29
29
 
@@ -71,7 +71,7 @@ Confirm? (y/N)
71
71
 
72
72
  ### 6. Execute the Dismissal
73
73
 
74
- Dismiss the alert by following the Code Scanning dismiss command in `.agents/rules/security-alerts.md`, passing the mapped `{api-reason}` and the user's explanation.
74
+ Write the user's explanation to `{comment-file}`, then run `bash .agents/scripts/security-alerts.sh dismiss-codescan --number {alert-number} --reason {api-reason} --comment-file {comment-file}`. Parse the JSON result and continue only when the dismissal is `applied` or `no-op`.
75
75
 
76
76
  **API reason mapping** (per the Code Scanning API):
77
77
  - False Positive -> `false positive`
@@ -23,7 +23,7 @@ description: >
23
23
 
24
24
  ### 1. 获取告警信息
25
25
 
26
- 执行前先读取 `.agents/rules/security-alerts.md`,并按其中的 Code Scanning 告警读取命令获取告警详情。
26
+ 执行前先读取 `.agents/rules/security-alerts.md`,然后运行 `bash .agents/scripts/security-alerts.sh read-codescan --number {alert-number}`,解析其 JSON 结果获取告警详情。
27
27
 
28
28
  验证告警处于 `open` 状态。如果已被关闭/修复,告知用户并退出。
29
29
 
@@ -71,7 +71,7 @@ Code Scanning 告警 #{alert-number}
71
71
 
72
72
  ### 6. 执行关闭
73
73
 
74
- 按 `.agents/rules/security-alerts.md` 中的 Code Scanning 告警关闭命令执行关闭操作,并传入映射后的 `{api-reason}` 与用户说明。
74
+ 将用户说明写入 `{comment-file}`,然后运行 `bash .agents/scripts/security-alerts.sh dismiss-codescan --number {alert-number} --reason {api-reason} --comment-file {comment-file}`。解析 JSON 结果,仅当关闭状态为 `applied` 或 `no-op` 时继续。
75
75
 
76
76
  **API reason 映射**(按 Code Scanning API):
77
77
  - 误报 -> `false positive`