@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
@@ -10,8 +10,8 @@ The platform adapter supplies authoritative Issue closing change requests across
10
10
 
11
11
  ## Authorization and Persistent Audit
12
12
 
13
- Only the current typed result's `mode=external`, `authorization`, and `selected` fields control the machine branch. `pr_status: created` is a compatibility shim for existing verifiers: it means a verifiable PR is bound, not that this task created it, and it cannot authorize lifecycle skipping by itself.
13
+ Only the current typed result's `mode=external`, `authorization`, and `selected` fields control the machine branch. Persistent `pr_delivery_fact` stores the verified binding and provenance; it does not say that the current invocation created the PR and cannot authorize lifecycle skipping by itself.
14
14
 
15
- A successful bind atomically writes PR fields and appends a `Bind External PR` Activity Log entry containing the authorization source, Issue, PR URL/number, base/head repository/ref/SHA, merge time, and merge commit. Replaying identical complete evidence is a no-op; an existing same-number binding without the signature adds it once; number or identity changes fail. The PR create path must never run.
15
+ A successful bind atomically writes `pr_delivery_fact` and appends a `Bind External PR` Activity Log entry containing the authorization source, Issue, PR URL/number, base/head repository/ref/SHA, merge time, and merge commit. Replaying identical complete evidence is a no-op; an existing same-number binding without the signature adds it once; number or identity changes fail. The PR create path must never run.
16
16
 
17
17
  External mode still passes identity, required-PR, local lifecycle, and terminal checks; review-ledger, manual-validation, post-review-commit, and platform-sync evidence is projected as warning/pending steps after lifecycle. Without a canonical review-code artifact, only existing verifier N/A rules apply. `--force` does not disable identity, local atomicity, or required-PR hard gates.
@@ -10,8 +10,8 @@ core 通过平台 adapter 读取 Issue 的权威 closing change requests,穷
10
10
 
11
11
  ## 授权与持久审计
12
12
 
13
- 当次调用只以 typed result 的 `mode=external`、`authorization` 和 `selected` 为机器分支依据。`pr_status: created` 只是现有 verifier 的兼容 shim,表示任务已绑定可验证的 PR;它既不表示 PR 由本任务创建,也不能单独授权跳过 lifecycle。
13
+ 当次调用只以 typed result 的 `mode=external`、`authorization` 和 `selected` 为机器分支依据。持久化 `pr_delivery_fact` 保存已验证绑定及 provenance;它不表示本次调用创建了 PR,也不能单独授权跳过 lifecycle。
14
14
 
15
- 成功绑定会原子写入 PR 字段并追加 `Bind External PR` Activity Log,记录授权来源、Issue、PR URL/编号、base/head repository/ref/SHA、合并时间和 merge commit。相同完整证据重试为 no-op;已有同号但缺审计签名时补写一次;编号或身份变化失败。不得调用 PR create 路径。
15
+ 成功绑定会原子写入 `pr_delivery_fact` 并追加 `Bind External PR` Activity Log,记录授权来源、Issue、PR URL/编号、base/head repository/ref/SHA、合并时间和 merge commit。相同完整证据重试为 no-op;已有同号但缺审计签名时补写一次;编号或身份变化失败。不得调用 PR create 路径。
16
16
 
17
17
  外部模式仍须通过身份、required-PR、本地生命周期与终态校验;review ledger、manual validation、post-review commit 和平台同步等外围证据在 lifecycle 后作为 warning/pending steps 投影。无 canonical review-code 时仅沿用 verifier 已定义的 N/A 规则;`--force` 不解除身份、本地原子性或 required-PR 硬门禁。
@@ -6,7 +6,7 @@ description: >
6
6
  ---
7
7
 
8
8
  # Create Pull Request
9
- > `--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.
9
+ > `--agent` values are defined in `.agents/rules/task-management.md` under “Collaborator Token Specification”.
10
10
 
11
11
 
12
12
  Create a Pull Request and, when task-related, sync the essential metadata and reviewer summary immediately.
@@ -19,7 +19,7 @@ Version stamp rule: when creating or updating `task.md` frontmatter, read `.agen
19
19
 
20
20
  ## Task Context Resolution
21
21
 
22
- > The entry point may omit the task ref and also accepts a legacy positional ref or `--task <ref>` / `-t <ref>`. Separate task scope from the full arguments while preserving every business operand, then call `agent-infra-internal task-context resolve {task-scope}` where `{task-scope}` is empty, one positional ref, or one task flag. Read only `taskId` from the structured result and bind `{task-id}` to that full `TASK-YYYYMMDD-HHMMSS` for downstream commands. Pass through resolution failures without scanning tasks locally.
22
+ > The entry point may omit the task ref; explicit task scope accepts only `--task <ref>` or `-t <ref>`, and positional task refs are not interpreted. Preserve every other business operand, then call `agent-infra-internal task-context resolve {task-scope}` where `{task-scope}` is empty or one task flag. Read only `taskId` from the structured result and bind `{task-id}` to the full `TASK-YYYYMMDD-HHMMSS` for downstream commands. Pass through resolution failures without scanning tasks locally.
23
23
 
24
24
  ## Step Start: started Marker
25
25
 
@@ -33,7 +33,7 @@ On a real `platform-pr create`, the typed core idempotently records `Create PR [
33
33
 
34
34
  Branch on the result:
35
35
  - absent / `"required"` -> continue to Step 1 below
36
- - `"disabled"` -> output the message below and **stop immediately**. Do not run any subsequent numbered step, do not trigger any PR-creation command, do not modify `pr_number` / `pr_status` in `task.md`, and do not publish a PR summary comment:
36
+ - `"disabled"` -> output the message below and **stop immediately**. Do not run any subsequent numbered step, do not trigger any PR-creation command, do not modify `pr_delivery_fact` in `task.md`, and do not publish a PR summary comment:
37
37
 
38
38
  Populate `{next-step-commands}` for this scenario by running `agent-infra-internal agent-client next-steps --skill complete-task --task-ref {task-ref}`.
39
39
 
@@ -45,9 +45,7 @@ No Pull Request is required; run instead:
45
45
 
46
46
  ### 1. Parse Command Arguments
47
47
 
48
- Identify arguments from the command input:
49
- - arguments matching `TASK-{yyyyMMdd-HHmmss}` -> `{task-id}`
50
- - remaining arguments -> `{target-branch}`
48
+ Parse the task scope first: an optional `--task <ref>` or `-t <ref>` selects `{task-id}`; a positional task ref is not interpreted. The remaining positional argument, when present, is `{target-branch}`.
51
49
 
52
50
  If `{task-id}` is provided, read `.agents/workspace/active/{task-id}/task.md` to load task metadata such as `issue_number` and `type`.
53
51
  If `{task-id}` is omitted, try to resolve it from the current session context; if it still cannot be determined, skip task-association logic in later steps.
@@ -66,7 +64,7 @@ Read the PR template through `.agents/rules/issue-pr-commands.md`, review recent
66
64
 
67
65
  ### 4. Check Remote Branch State
68
66
 
69
- Use `agent-infra-internal git-workflow inspect` for already-delivered upstream/remote facts. `create-pr` never performs the first push; a missing remote branch or a remote SHA that differs from local HEAD fails and points back to `commit`/push-only. Core rechecks the remote branch SHA before and immediately before bind, and requires exact repository/ref, base, and `head.sha` identity. A post-POST race never deletes the created PR or remote branch; the next retry recovers only by resource identity.
67
+ Run `agent-infra-internal task-delivery {task-id} deliver --agent {standard-agent-token}` to deliver the task branch through one core. The core handles first creation, same-SHA no-op, a known-last-delivered SHA update with `--force-with-lease`, and unknown drift fail-closed. After delivery it verifies the remote SHA again and continues only when it equals local `HEAD`. Optional `--remote` / `--base` values must match the task binding. Core still rechecks the remote branch SHA before and immediately before bind, and requires exact repository/ref, base, and `head.sha` identity. A post-POST race never deletes the created PR or remote branch; the next retry recovers only by resource identity.
70
68
 
71
69
  ### 5. Create or Recover the PR
72
70
 
@@ -80,9 +78,9 @@ Capture the `result` field from `platform-pr create` (`pr_created`, `pr_reused`,
80
78
 
81
79
  ### 7. Generate the PR Code Change Report
82
80
 
83
- After creating or uniquely reusing the PR, run `agent-infra-internal platform-pr inspect {task-id}` to obtain the authoritative base/head SHAs, then follow `reference/change-report.md` to classify the complete PR additions/deletions, renames, and potentially unnecessary changes. Read that reference before this step.
81
+ After creating or uniquely reusing the PR, run `agent-infra-internal platform-pr inspect {task-id}` to obtain the authoritative base/head SHAs, then follow `reference/change-report.md` to classify the complete PR line counts, Git blob byte sizes, renames, and potentially unnecessary changes. Read that reference before this step.
84
82
 
85
- The report is part of the reviewer summary below and must also appear in the final user response. Do not provide only a grand total or inspect only the last commit.
83
+ The report is part of the reviewer summary below and must also appear in the final user response. Do not provide only total lines, omit byte changes, or inspect only the last commit.
86
84
 
87
85
  ### 8. Publish the Review Summary
88
86
 
@@ -94,7 +92,7 @@ Aggregate a reviewer-facing summary from those artifacts, append the `### PR Cod
94
92
 
95
93
  ### 9. Confirm Task Status
96
94
 
97
- After a PR is created or uniquely recovered, `platform-pr create` atomically updates `pr_number`, `pr_status`, canonical time/version metadata, and the Create PR completion log through the task write core. The caller verifies the structured result and does not edit those fields again.
95
+ After a PR is created or uniquely recovered, `platform-pr create` atomically updates the verified `pr_delivery_fact`, canonical time/version metadata, and the Create PR completion log through the task write core. The caller verifies the structured result and does not edit the fact again.
98
96
 
99
97
  ### 10. Verification Gate
100
98
 
@@ -150,5 +148,5 @@ Next step (alternative) - Skip active monitoring and attempt completion:
150
148
  - Push rejected: suggest `git pull --rebase`
151
149
  - Existing PR found: show the current PR URL and stop
152
150
  - Inaccessible Issue metadata: skip inheritance and continue
153
- - PR creation failed with an associated `{task-id}`: run `agent-infra-internal task-warning {task-id} add --step create-pr --severity ACTION_REQUIRED --code PR_CREATE_FAILED --target pr --message "{reason}" --action "Fix push, permission, or platform issues and rerun create-pr"` to submit a structured warning intent, and do not write `pr_number`
151
+ - PR creation failed with an associated `{task-id}`: run `agent-infra-internal task-warning {task-id} add --step create-pr --severity ACTION_REQUIRED --code PR_CREATE_FAILED --target pr --message "{reason}" --action "Fix push, permission, or platform issues and rerun create-pr"` to submit a structured warning intent, and do not write an incomplete `pr_delivery_fact`
154
152
  - PR summary comment failed with an associated `{task-id}`: record a `COMMENT_SYNC_FAILED` warning per `.agents/rules/pr-sync.md`, without rolling back an already-created PR
@@ -6,7 +6,7 @@ description: >
6
6
  ---
7
7
 
8
8
  # 创建 Pull Request
9
- > `--agent` 取值见 `.agents/rules/task-management.md`「合作者 token 规范」:标准 AI 短名(`claude`/`codex`/`antigravity`/`opencode`/`cursor`)、长名归一化(`claude-code`→`claude`、`antigravity-cli`→`antigravity`)或人工例外 `human`。
9
+ > `--agent` 取值见 `.agents/rules/task-management.md`「合作者 token 规范」。
10
10
 
11
11
 
12
12
  创建 Pull Request,并在与任务关联时立即补齐核心元数据和 reviewer 摘要。
@@ -19,7 +19,7 @@ description: >
19
19
 
20
20
  ## 任务上下文解析
21
21
 
22
- > 入口允许省略 task ref,也接受旧位置 task ref 或 `--task <ref>` / `-t <ref>`。先从完整参数中分离 task scope 并原样保留其他业务操作数,再调用 `agent-infra-internal task-context resolve {task-scope}`;`{task-scope}` 为空、位置 ref 或 task flag 之一。只读取结构化结果的 `taskId`,后续把 `{task-id}` 绑定为该完整 `TASK-YYYYMMDD-HHMMSS`。解析失败时透传非零退出码,不自行扫描任务。
22
+ > 入口可省略 task ref;显式 task scope 仅接受 `--task <ref>` 或 `-t <ref>`,不再解释位置 task ref。保留其余业务操作数后调用 `agent-infra-internal task-context resolve {task-scope}`;`{task-scope}` 为空或 task flag 之一。只读取结构化结果的 `taskId`,后续把 `{task-id}` 绑定为完整 `TASK-YYYYMMDD-HHMMSS`。解析失败时透传非零退出码,不自行扫描任务。
23
23
 
24
24
  ## 步骤开始:started 标记
25
25
 
@@ -33,7 +33,7 @@ description: >
33
33
 
34
34
  按读取结果分支:
35
35
  - 缺省 / `"required"` → 继续到下方第 1 步
36
- - `"disabled"` → 输出以下消息后**立即停止**,不要执行任何后续编号步骤、不要触发任何 PR 创建命令、不要修改 `task.md` 的 `pr_number` / `pr_status`、不要发布 PR 摘要评论:
36
+ - `"disabled"` → 输出以下消息后**立即停止**,不要执行任何后续编号步骤、不要触发任何 PR 创建命令、不要修改 `task.md` 的 `pr_delivery_fact`、不要发布 PR 摘要评论:
37
37
 
38
38
  使用 `agent-infra-internal agent-client next-steps --skill complete-task --task-ref {task-ref}` 生成本场景的 `{next-step-commands}`。
39
39
 
@@ -45,9 +45,7 @@ description: >
45
45
 
46
46
  ### 1. 解析命令参数
47
47
 
48
- 从命令参数中识别:
49
- - 匹配 `TASK-{yyyyMMdd-HHmmss}` 格式的参数 -> `{task-id}`
50
- - 其余参数 -> `{target-branch}`
48
+ 先解析 task scope:可选的 `--task <ref>` 或 `-t <ref>` 绑定 `{task-id}`;位置 task ref 不再解释。剩余的可选位置参数绑定为 `{target-branch}`。
51
49
 
52
50
  如果提供了 `{task-id}`,读取 `.agents/workspace/active/{task-id}/task.md` 获取任务信息(例如 `issue_number`、`type` 等)。
53
51
  如果未提供,可从当前 session 上下文获取;仍无法确定 `{task-id}` 时,后续步骤中的任务关联逻辑跳过。
@@ -66,7 +64,7 @@ description: >
66
64
 
67
65
  ### 4. 检查远程分支状态
68
66
 
69
- 调用 `agent-infra-internal git-workflow inspect` 检查已交付的 upstream/remote branch;`create-pr` 不执行首次 push,远端 branch 缺失或 SHA 与本地 HEAD 不一致时直接失败并指向 `commit`/push-only。随后在 locate/create/bind 前后再次读取远端 branch SHA,并要求 PR 的精确 repository/ref、base 和 `head.sha` 全部匹配;POST 后的竞态不自动删除已创建 PR 或远端 branch,下一次只按资源身份恢复。
67
+ 调用 `agent-infra-internal task-delivery {task-id} deliver --agent {standard-agent-token}` 统一交付任务分支。该 core 负责首次创建、相同 SHA no-op、已知最近交付 SHA 的 `--force-with-lease` 更新和未知漂移 fail-closed;交付成功后再次复核远端 SHA,并只在远端 branch SHA 等于本地 `HEAD` 时继续。可选的 `--remote` / `--base` 必须与任务已绑定值一致。随后在 locate/create/bind 前后再次读取远端 branch SHA,并要求 PR 的精确 repository/ref、base 和 `head.sha` 全部匹配;POST 后的竞态不自动删除已创建 PR 或远端 branch,下一次只按资源身份恢复。
70
68
 
71
69
  ### 5. 创建或恢复 PR
72
70
 
@@ -80,9 +78,9 @@ description: >
80
78
 
81
79
  ### 7. 生成 PR 代码增减报告
82
80
 
83
- 创建或唯一复用 PR 后,调用 `agent-infra-internal platform-pr inspect {task-id}` 取得权威 base/head SHA,并按 `reference/change-report.md` 统计完整 PR 的分类增减、rename 与疑似不必要变化。执行本步骤前先读取该 reference。
81
+ 创建或唯一复用 PR 后,调用 `agent-infra-internal platform-pr inspect {task-id}` 取得权威 base/head SHA,并按 `reference/change-report.md` 统计完整 PR 的分类行数、Git blob 字节数、rename 与疑似不必要变化。执行本步骤前先读取该 reference。
84
82
 
85
- 报告既是下方 reviewer 摘要的一部分,也必须出现在最终用户回复中;不得只给总行数或只统计最后一个 commit。
83
+ 报告既是下方 reviewer 摘要的一部分,也必须出现在最终用户回复中;不得只给总行数、忽略字节变化或只统计最后一个 commit。
86
84
 
87
85
  ### 8. 发布审查摘要
88
86
 
@@ -94,7 +92,7 @@ description: >
94
92
 
95
93
  ### 9. 确认任务状态
96
94
 
97
- `platform-pr create` 在成功创建或恢复唯一远端身份后,通过任务写入内核原子更新 `pr_number`、`pr_status`、规范时间/版本和 Create PR 完成日志。调用方只核对结构化结果,不再次编辑这些字段。
95
+ `platform-pr create` 在成功创建或恢复唯一远端身份后,通过任务写入内核原子更新 verified `pr_delivery_fact`、规范时间/版本和 Create PR 完成日志。调用方只核对结构化结果,不再次编辑 fact。
98
96
 
99
97
  ### 10. 完成校验
100
98
 
@@ -151,5 +149,5 @@ agent-infra-internal task-verify {task-id} create-pr.completed --format text
151
149
  - 推送被拒绝:建议执行 `git pull --rebase`
152
150
  - 已存在 PR:直接输出当前 PR URL 并结束
153
151
  - 无法访问 Issue 元数据:跳过继承并继续
154
- - PR 创建失败且已关联 `{task-id}`:调用 `agent-infra-internal task-warning {task-id} add --step create-pr --severity ACTION_REQUIRED --code PR_CREATE_FAILED --target pr --message "{reason}" --action "修复推送、权限或平台问题后重跑 create-pr"` 提交结构化 warning 意图,不写 `pr_number`
152
+ - PR 创建失败且已关联 `{task-id}`:调用 `agent-infra-internal task-warning {task-id} add --step create-pr --severity ACTION_REQUIRED --code PR_CREATE_FAILED --target pr --message "{reason}" --action "修复推送、权限或平台问题后重跑 create-pr"` 提交结构化 warning 意图,不写不完整 `pr_delivery_fact`
155
153
  - PR 摘要评论失败且已关联 `{task-id}`:按 `.agents/rules/pr-sync.md` 记录 `COMMENT_SYNC_FAILED` 告警,不回滚已创建 PR
@@ -1,7 +1,7 @@
1
1
  # PR Code Change Report
2
2
 
3
3
  <!-- pr-change-report-contract
4
- {"version":1,"source":"platform-pr-inspect","diff":"three-dot-find-renames-numstat","publish":["pr-summary","user-response"]}
4
+ {"source":"platform-pr-inspect","diff":"three-dot-find-renames","metrics":["numstat-lines","git-blob-bytes"],"publish":["pr-summary","user-response"]}
5
5
  -->
6
6
 
7
7
  After a PR is created or uniquely reused, use the authoritative `base.sha` and `head.sha` returned by `platform-pr inspect` to measure the complete PR diff. Do not substitute the last commit or current worktree state.
@@ -9,12 +9,14 @@ After a PR is created or uniquely reused, use the authoritative `base.sha` and `
9
9
  ## Evidence Commands
10
10
 
11
11
  ```bash
12
- git diff --find-renames --numstat {base-sha}...{head-sha}
12
+ node .agents/skills/create-pr/scripts/change-report.mjs --base {base-sha} --head {head-sha}
13
13
  git diff --find-renames --name-status {base-sha}...{head-sha}
14
14
  git diff --find-renames --summary {base-sha}...{head-sha}
15
15
  ```
16
16
 
17
- Count binary files in the file total but do not invent line counts for `-` numstat values. Explain renames and copies from `name-status` and `summary` separately so moves are not reported as full rewrites.
17
+ The script calculates both `numstat` line counts and exact Git blob byte sizes between the merge base and head. Bytes provide a stable unit, cover binary files, and reveal same-line compaction; submodules are not blobs and contribute zero bytes. Added files have zero old bytes, deleted files have zero new bytes, pure renames have zero net bytes, and copies count only the new destination content.
18
+
19
+ Count binary files in the file total but do not invent line counts for `-` numstat values. Explain renames and copies from the script's per-file records, `name-status`, and `summary` so moves are not reported as full rewrites.
18
20
 
19
21
  ## Classification and Reconciliation
20
22
 
@@ -27,13 +29,16 @@ Using the repository's actual structure, assign every file to exactly one closes
27
29
  - Documentation
28
30
  - Configuration, dependencies, and other files
29
31
 
30
- The table must contain component, file count, additions, deletions, and net change, followed by a total row. Category totals must reconcile exactly with the complete numstat total. Then list the largest changed files and distinguish source, tests, template mirrors, and pure renames.
32
+ The table must contain component, file count, added lines, deleted lines, net lines, old bytes, new bytes, and net bytes, followed by a total row. Byte columns describe the blob content size of files involved in this change, not disk usage for the entire repository or worktree. Use exact integers; optional KiB/MiB values may aid readability but must not replace byte counts.
33
+
34
+ Category line and byte totals must each reconcile exactly with the script's `totals`. Then list the largest files by line change and absolute net-byte change, distinguishing source, tests, template mirrors, and pure renames.
31
35
 
32
36
  ## Required Analysis
33
37
 
34
38
  Briefly explain:
35
39
 
36
40
  - where growth is concentrated and how runtime code compares with tests, docs, and templates;
41
+ - whether net line and net byte changes tell different stories, especially for substantial same-line compaction or expansion;
37
42
  - which line changes are path moves, bilingual mirrors, or mechanical synchronization;
38
43
  - whether any change cannot be traced directly to the PR goal and may be unnecessary; if none, state the evidence;
39
44
  - when a test fixture is much larger than production changes, what risk it covers instead of judging it only by size.
@@ -1,7 +1,7 @@
1
1
  # PR 代码增减报告
2
2
 
3
3
  <!-- pr-change-report-contract
4
- {"version":1,"source":"platform-pr-inspect","diff":"three-dot-find-renames-numstat","publish":["pr-summary","user-response"]}
4
+ {"source":"platform-pr-inspect","diff":"three-dot-find-renames","metrics":["numstat-lines","git-blob-bytes"],"publish":["pr-summary","user-response"]}
5
5
  -->
6
6
 
7
7
  PR 创建或复用成功后,使用 `platform-pr inspect` 返回的权威 `base.sha` 与 `head.sha` 统计完整 PR 差异,不以最后一个 commit 或工作树状态代替。
@@ -9,12 +9,14 @@ PR 创建或复用成功后,使用 `platform-pr inspect` 返回的权威 `base
9
9
  ## 证据命令
10
10
 
11
11
  ```bash
12
- git diff --find-renames --numstat {base-sha}...{head-sha}
12
+ node .agents/skills/create-pr/scripts/change-report.mjs --base {base-sha} --head {head-sha}
13
13
  git diff --find-renames --name-status {base-sha}...{head-sha}
14
14
  git diff --find-renames --summary {base-sha}...{head-sha}
15
15
  ```
16
16
 
17
- `numstat` 中的二进制文件计入文件数,但不虚构行数。rename/copy 依据 `name-status` 与 `summary` 单独说明,避免把移动误报为整文件重写。
17
+ 脚本在 merge base 与 head 之间同时计算 `numstat` 行数和 Git blob 的精确字节数。字节比字符具有稳定口径,也能覆盖二进制文件和同行内缩减;子模块不是 blob,按 0 字节贡献核算。新增文件的旧字节数为 0,删除文件的新字节数为 0,纯 rename 的净字节数为 0,copy 只计新增目标内容。
18
+
19
+ `numstat` 中的二进制文件计入文件数,但不虚构行数。rename/copy 依据脚本的逐文件记录、`name-status` 与 `summary` 单独说明,避免把移动误报为整文件重写。
18
20
 
19
21
  ## 分类与核算
20
22
 
@@ -27,13 +29,16 @@ git diff --find-renames --summary {base-sha}...{head-sha}
27
29
  - 文档
28
30
  - 配置、依赖与其他
29
31
 
30
- 输出表格必须包含“部分、文件数、新增、删除、净增”,并有合计行。各类别之和必须与完整 `numstat` 总计一致。随后列出增减最大的文件,并区分源码、测试、模板镜像和纯 rename。
32
+ 输出表格必须包含“部分、文件数、新增行、删除行、净增行、旧字节、新字节、净字节”,并有合计行。字节列表示本次变更涉及文件的 blob 内容体积,不表示整个仓库或工作树的磁盘占用。使用精确整数;可附加 KiB/MiB 便于阅读,但不能替代字节数。
33
+
34
+ 各类别的行数和字节数之和必须分别与脚本的 `totals` 一致。随后分别列出行数变化和绝对净字节变化最大的文件,并区分源码、测试、模板镜像和纯 rename。
31
35
 
32
36
  ## 分析要求
33
37
 
34
38
  用简短结论回答:
35
39
 
36
40
  - 增长主要集中在哪里,运行时代码与测试/文档/模板各占多少;
41
+ - 行数净变化与净字节变化是否给出不同结论,尤其指出同行内明显缩减或膨胀;
37
42
  - 哪些行数只是路径迁移、双语镜像或机械同步;
38
43
  - 是否存在与 PR 目标无法直接对应、疑似不必要的变化;若没有,明确说明判断依据;
39
44
  - 若某个测试 fixture 明显大于生产改动,解释它覆盖的风险,而不是仅以行数评价。
@@ -0,0 +1,203 @@
1
+ import { execFileSync } from "node:child_process";
2
+
3
+ function fail(message) {
4
+ process.stderr.write(`${message}\n`);
5
+ process.exit(1);
6
+ }
7
+
8
+ function parseArgs(argv) {
9
+ const options = { cwd: process.cwd() };
10
+
11
+ for (let index = 0; index < argv.length; index += 1) {
12
+ const argument = argv[index];
13
+ const value = argv[index + 1];
14
+
15
+ if ((argument === "--base" || argument === "--head" || argument === "--cwd") && value) {
16
+ options[argument.slice(2)] = value;
17
+ index += 1;
18
+ continue;
19
+ }
20
+
21
+ fail(`Unknown or incomplete argument: ${argument}`);
22
+ }
23
+
24
+ if (!options.base || !options.head) {
25
+ fail("Usage: change-report.mjs --base <sha> --head <sha> [--cwd <repository>]");
26
+ }
27
+
28
+ return options;
29
+ }
30
+
31
+ function git(args, options, encoding = "utf8") {
32
+ return execFileSync("git", args, {
33
+ cwd: options.cwd,
34
+ encoding,
35
+ maxBuffer: 64 * 1024 * 1024
36
+ });
37
+ }
38
+
39
+ function parseRawDiff(buffer) {
40
+ const tokens = buffer.toString("utf8").split("\0");
41
+ const files = [];
42
+
43
+ for (let index = 0; index < tokens.length && tokens[index];) {
44
+ const header = tokens[index++];
45
+ const [oldMode, newMode, oldOid, newOid, status] = header.slice(1).split(" ");
46
+ const firstPath = tokens[index++];
47
+ const hasPathPair = status.startsWith("R") || status.startsWith("C");
48
+ const secondPath = hasPathPair ? tokens[index++] : firstPath;
49
+
50
+ files.push({
51
+ status,
52
+ oldMode,
53
+ newMode,
54
+ oldOid,
55
+ newOid,
56
+ oldPath: status.startsWith("A") ? null : firstPath,
57
+ newPath: status.startsWith("D") ? null : secondPath
58
+ });
59
+ }
60
+
61
+ return files;
62
+ }
63
+
64
+ function parseNumstat(buffer) {
65
+ const tokens = buffer.toString("utf8").split("\0");
66
+ const stats = new Map();
67
+
68
+ for (let index = 0; index < tokens.length && tokens[index];) {
69
+ const record = tokens[index++];
70
+ const firstTab = record.indexOf("\t");
71
+ const secondTab = record.indexOf("\t", firstTab + 1);
72
+ const additions = record.slice(0, firstTab);
73
+ const deletions = record.slice(firstTab + 1, secondTab);
74
+ const path = record.slice(secondTab + 1);
75
+
76
+ if (path) {
77
+ stats.set(`path:${path}`, { additions, deletions });
78
+ continue;
79
+ }
80
+
81
+ const oldPath = tokens[index++];
82
+ const newPath = tokens[index++];
83
+ stats.set(`pair:${oldPath}\0${newPath}`, { additions, deletions });
84
+ }
85
+
86
+ return stats;
87
+ }
88
+
89
+ function objectSizes(files, options) {
90
+ const objectIds = new Set();
91
+
92
+ for (const file of files) {
93
+ if (file.oldMode !== "000000" && file.oldMode !== "160000" && !file.status.startsWith("C")) {
94
+ objectIds.add(file.oldOid);
95
+ }
96
+ if (file.newMode !== "000000" && file.newMode !== "160000") {
97
+ objectIds.add(file.newOid);
98
+ }
99
+ }
100
+
101
+ if (objectIds.size === 0) return new Map();
102
+
103
+ const ids = [...objectIds];
104
+ const output = execFileSync(
105
+ "git",
106
+ ["cat-file", "--batch-check=%(objectname) %(objecttype) %(objectsize)"],
107
+ {
108
+ cwd: options.cwd,
109
+ input: `${ids.join("\n")}\n`,
110
+ encoding: "utf8",
111
+ maxBuffer: 64 * 1024 * 1024
112
+ }
113
+ );
114
+ const sizes = new Map();
115
+
116
+ for (const line of output.trim().split("\n")) {
117
+ const [oid, type, size] = line.split(" ");
118
+ if (type === "blob") sizes.set(oid, Number(size));
119
+ }
120
+
121
+ return sizes;
122
+ }
123
+
124
+ function numericLineCount(value) {
125
+ return value === "-" ? null : Number(value);
126
+ }
127
+
128
+ function main() {
129
+ const options = parseArgs(process.argv.slice(2));
130
+ const mergeBase = git(["merge-base", options.base, options.head], options).trim();
131
+ const diffArgs = ["diff", "--no-ext-diff", "--find-renames", "-z", mergeBase, options.head];
132
+ const files = parseRawDiff(git([...diffArgs.slice(0, 2), "--raw", "--abbrev=64", ...diffArgs.slice(2)], options, null));
133
+ const numstat = parseNumstat(git([...diffArgs.slice(0, 2), "--numstat", ...diffArgs.slice(2)], options, null));
134
+ const sizes = objectSizes(files, options);
135
+
136
+ const reportFiles = files.map((file) => {
137
+ const key = file.status.startsWith("R") || file.status.startsWith("C")
138
+ ? `pair:${file.oldPath}\0${file.newPath}`
139
+ : `path:${file.newPath || file.oldPath}`;
140
+ const lines = numstat.get(key);
141
+ if (!lines) fail(`Missing numstat record for ${file.newPath || file.oldPath}`);
142
+
143
+ const oldBytes = file.oldMode === "000000" || file.oldMode === "160000" || file.status.startsWith("C")
144
+ ? 0
145
+ : sizes.get(file.oldOid);
146
+ const newBytes = file.newMode === "000000" || file.newMode === "160000"
147
+ ? 0
148
+ : sizes.get(file.newOid);
149
+ if (oldBytes === undefined || newBytes === undefined) {
150
+ fail(`Unable to resolve blob size for ${file.newPath || file.oldPath}`);
151
+ }
152
+
153
+ return {
154
+ status: file.status,
155
+ oldPath: file.oldPath,
156
+ newPath: file.newPath,
157
+ additions: numericLineCount(lines.additions),
158
+ deletions: numericLineCount(lines.deletions),
159
+ oldBytes,
160
+ newBytes,
161
+ netBytes: newBytes - oldBytes
162
+ };
163
+ });
164
+
165
+ const totals = reportFiles.reduce((result, file) => {
166
+ result.files += 1;
167
+ result.oldBytes += file.oldBytes;
168
+ result.newBytes += file.newBytes;
169
+ result.netBytes += file.netBytes;
170
+ if (file.additions === null || file.deletions === null) {
171
+ result.binaryFiles += 1;
172
+ } else {
173
+ result.textFiles += 1;
174
+ result.additions += file.additions;
175
+ result.deletions += file.deletions;
176
+ }
177
+ return result;
178
+ }, {
179
+ files: 0,
180
+ textFiles: 0,
181
+ binaryFiles: 0,
182
+ additions: 0,
183
+ deletions: 0,
184
+ oldBytes: 0,
185
+ newBytes: 0,
186
+ netBytes: 0
187
+ });
188
+
189
+ process.stdout.write(`${JSON.stringify({
190
+ version: 1,
191
+ base: options.base,
192
+ head: options.head,
193
+ mergeBase,
194
+ files: reportFiles,
195
+ totals
196
+ }, null, 2)}\n`);
197
+ }
198
+
199
+ try {
200
+ main();
201
+ } catch (error) {
202
+ fail(error instanceof Error ? error.message : String(error));
203
+ }
@@ -109,13 +109,12 @@ If no historical release notes exist, use the following default Markdown format:
109
109
  - Commit co-authors from the typed context's commit `authors`
110
110
  - Issue reporters from typed `closingIssues[].author`
111
111
  - **Contribution count**: `PR count + co-authored commit count` for the same identity, merged across both sources
112
- - **Name -> `@login` mapping**:
113
- - For `platform-user` or `platform-noreply`, use the lowercased `login`
114
- - Only for `unresolved`, use the Name heuristic: take the first token before a space and lowercase it
115
- - If the login already appears in the PR author list, merge counts into that login so `Claude` and `@claude` do not become separate entries
116
- - Merge all Name variants that map to the same login before counting and sorting; for example, `Claude` and `Claude Opus 4.6 (1M context)` should both collapse into `@claude`
112
+ - **`@login` mapping**: follow the identity safety boundary in `.agents/rules/release-commands.md`
113
+ - For `platform-user` or `platform-noreply` with a non-empty `login`, use the lowercased `login`
114
+ - Exclude `unresolved` identities from the contributor list; never infer a login from a name, email address, domain, brand, or same-named platform account
115
+ - Merge all Name variants carrying the same typed login before counting and sorting
117
116
  - Preserve bot identities as-is, for example `dependabot[bot]`
118
- - If the login still cannot be determined reliably, output `@{lowercased first Name token}` and append `<!-- TODO(reviewer): confirm platform login for {original Name <email>} -->` below the `Contributors` section
117
+ - Do not add unresolved identity emails, placeholder mentions, or identity-verification TODOs to publishable notes
119
118
  - **Sorting**: descending by contribution count, then lexicographically by login for ties
120
119
  - **Deduplication**: use the final mapped `@login` as the key
121
120
  - **Issue reporter rules**:
@@ -109,13 +109,12 @@ agent-infra-internal platform-release-notes context \
109
109
  - Commit co-authors:来自步骤 3 typed context 的 commit `authors`
110
110
  - Issue reporters:来自步骤 3 typed context 的 `closingIssues[].author`
111
111
  - **贡献数定义**:`该人的 PR 数 + 该人作为 co-author 的 commit 数`(同一身份跨来源合并计数)
112
- - **Name → `@login` 映射**:
113
- - `resolution` 为 `platform-user` 或 `platform-noreply` 时直接采用小写 `login`
114
- - 仅当 `resolution` 为 `unresolved` 时按 Name 启发式:取首个空格前的 token 并转为小写
115
- - 已出现在 PR author 列表中的 login,必须按该 login 合并计数,避免把 `Claude` 和 `@claude` 拆成两个条目
116
- - 同一 login 的所有 Name 变体都必须归并后再计数与排序;例如 `Claude` 与 `Claude Opus 4.6 (1M context)` 都映射到 `@claude` 时,应先合并为同一个贡献者
112
+ - **`@login` 映射**:遵循 `.agents/rules/release-commands.md` 的身份安全边界
113
+ - `resolution` 为 `platform-user` 或 `platform-noreply` 且 `login` 非空时,采用小写 `login`
114
+ - `resolution` 为 `unresolved` 时从贡献者列表中排除;不得从 Name、邮箱、域名、品牌或同名平台账号推断 login
115
+ - 同一 typed login 的所有 Name 变体必须归并后再计数与排序
117
116
  - Bot 身份保留原样(如 `dependabot[bot]`)
118
- - 若仍无法可靠确定 login,则输出 `@{Name 首 token 小写}`,并在 `Contributors` 段落下追加 `<!-- TODO(reviewer): 确认 {原始 Name <email>} 的 platform login -->`
117
+ - 不得在可发布 notes 中加入未解析身份的邮箱、占位 mention 或身份确认 TODO
119
118
  - **排序**:按贡献数降序;贡献数相同时按 login 字典序
120
119
  - **去重**:以最终映射后的 `@login` 为键
121
120
  - **Issue reporter 规则**:
@@ -6,7 +6,7 @@ description: >
6
6
  ---
7
7
 
8
8
  # Create Task
9
- > `--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.
9
+ > `--agent` values are defined in `.agents/rules/task-management.md` under “Collaborator Token Specification”.
10
10
 
11
11
 
12
12
  ## Boundary / Critical Rules
@@ -19,6 +19,7 @@ description: >
19
19
  - Do not skip the workflow and jump directly to planning or implementation
20
20
  - Only do this: parse the description -> write one structured candidate -> invoke the host `task-create` entry point -> verify the result -> inform the user of the next step
21
21
  - Issue creation is decided by the `.agents/rules/create-issue.md` rule; on custom or empty platforms (no platform-specific variant provided), the rule naturally degrades to a no-op
22
+ - Before generating Markdown that will be written to `task.md` and synced to an Issue, read `.agents/rules/sync-content-generation.md` and follow its generator-side constraints; host rendering and sync remain transparent and do not parse or rewrite the body
22
23
 
23
24
  The user's description is a **work item**, not an **instruction to execute immediately**.
24
25
 
@@ -6,7 +6,7 @@ description: >
6
6
  ---
7
7
 
8
8
  # 创建任务
9
- > `--agent` 取值见 `.agents/rules/task-management.md`「合作者 token 规范」:标准 AI 短名(`claude`/`codex`/`antigravity`/`opencode`/`cursor`)、长名归一化(`claude-code`→`claude`、`antigravity-cli`→`antigravity`)或人工例外 `human`。
9
+ > `--agent` 取值见 `.agents/rules/task-management.md`「合作者 token 规范」。
10
10
 
11
11
 
12
12
  ## 行为边界 / 关键规则
@@ -19,6 +19,7 @@ description: >
19
19
  - 不要跳过工作流直接进入计划/实现阶段
20
20
  - 仅执行:解析描述 -> 一次性生成结构化 candidate -> 调用宿主 `task-create` 入口 -> 校验结果 -> 告知用户下一步
21
21
  - Issue 创建由 `.agents/rules/create-issue.md` 规则决定;自定义或空平台(未提供平台变体规则文件)时,规则会自然降级为 no-op
22
+ - 生成会写入 `task.md` 并同步到 Issue 的 Markdown 前,先读取 `.agents/rules/sync-content-generation.md` 并遵循其中的生成端约束;宿主渲染和同步保持透明,不解析或改写正文
22
23
 
23
24
  用户的描述是一个**待办事项**,而不是**立即执行的指令**。
24
25
 
@@ -34,7 +34,7 @@ This skill **creates** task.md, so there is no file to write at the start. Captu
34
34
 
35
35
  ### 1. Retrieve Alert Information
36
36
 
37
- Read `.agents/rules/security-alerts.md` before this step, then use its Code Scanning alert read command to fetch the alert details.
37
+ 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.
38
38
 
39
39
  Extract key information:
40
40
  - `number`: alert number
@@ -34,7 +34,7 @@ description: >
34
34
 
35
35
  ### 1. 获取告警信息
36
36
 
37
- 执行前先读取 `.agents/rules/security-alerts.md`,并按其中的 Code Scanning 告警读取命令获取告警详情。
37
+ 执行前先读取 `.agents/rules/security-alerts.md`,然后运行 `bash .agents/scripts/security-alerts.sh read-codescan --number {alert-number}`,解析其 JSON 结果获取告警详情。
38
38
 
39
39
  提取关键信息:
40
40
  - `number`:告警编号
@@ -34,7 +34,7 @@ This skill **creates** task.md, so there is no file to write at the start. Captu
34
34
 
35
35
  ### 1. Retrieve Alert Information
36
36
 
37
- Read `.agents/rules/security-alerts.md` before this step, then use its Dependabot alert read command to fetch the alert details.
37
+ Read `.agents/rules/security-alerts.md` before this step, then run `bash .agents/scripts/security-alerts.sh read-dependabot --number {alert-number}` and parse its JSON result to fetch the alert details.
38
38
 
39
39
  Extract key information:
40
40
  - `number`: alert number
@@ -34,7 +34,7 @@ description: >
34
34
 
35
35
  ### 1. 获取告警信息
36
36
 
37
- 执行前先读取 `.agents/rules/security-alerts.md`,并按其中的 Dependabot 告警读取命令获取告警详情。
37
+ 执行前先读取 `.agents/rules/security-alerts.md`,然后运行 `bash .agents/scripts/security-alerts.sh read-dependabot --number {alert-number}`,解析其 JSON 结果获取告警详情。
38
38
 
39
39
  提取关键信息:
40
40
  - `number`:告警编号
@@ -6,7 +6,7 @@ description: >
6
6
  ---
7
7
 
8
8
  # Import Issue
9
- > `--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.
9
+ > `--agent` values are defined in `.agents/rules/task-management.md` under “Collaborator Token Specification”.
10
10
 
11
11
 
12
12
  Import the specified Issue and create a task. Argument: issue number.
@@ -6,7 +6,7 @@ description: >
6
6
  ---
7
7
 
8
8
  # 导入 Issue
9
- > `--agent` 取值见 `.agents/rules/task-management.md`「合作者 token 规范」:标准 AI 短名(`claude`/`codex`/`antigravity`/`opencode`/`cursor`)、长名归一化(`claude-code`→`claude`、`antigravity-cli`→`antigravity`)或人工例外 `human`。
9
+ > `--agent` 取值见 `.agents/rules/task-management.md`「合作者 token 规范」。
10
10
 
11
11
 
12
12
  导入指定的 Issue 并创建任务。参数:issue 编号。