@fitlab-ai/agent-infra 0.9.9 → 0.9.11

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 (309) hide show
  1. package/README.md +13 -3
  2. package/README.zh-CN.md +13 -3
  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 +17 -10
  8. package/dist/lib/agent-clients/adapters/codex-lifecycle/controller-context.js +11 -31
  9. package/dist/lib/agent-clients/adapters/codex-lifecycle/sandbox-controller.js +15 -33
  10. package/dist/lib/agent-clients/adapters/codex-sandbox.js +72 -11
  11. package/dist/lib/agent-clients/adapters/index.js +3 -1
  12. package/dist/lib/agent-clients/adapters/opencode-sandbox.js +0 -4
  13. package/dist/lib/agent-clients/adapters/traecli.js +65 -0
  14. package/dist/lib/agent-clients/config.js +14 -99
  15. package/dist/lib/agent-clients/reconcile.js +1 -11
  16. package/dist/lib/agent-clients/schema.js +5 -4
  17. package/dist/lib/agent-clients/tokens.js +7 -17
  18. package/dist/lib/agent-clients/types.js +2 -1
  19. package/dist/lib/decide.js +14 -30
  20. package/dist/lib/defaults.json +9 -0
  21. package/dist/lib/init.js +2 -2
  22. package/dist/lib/internal/codex-lifecycle.js +2 -2
  23. package/dist/lib/internal/codex-sandbox-controller.js +4 -3
  24. package/dist/lib/internal/release-workflow.js +0 -1
  25. package/dist/lib/internal/sandbox-control.js +2 -2
  26. package/dist/lib/internal/task-finalization.js +19 -9
  27. package/dist/lib/internal/task-ledger.js +8 -2
  28. package/dist/lib/internal/task-lifecycle.js +17 -93
  29. package/dist/lib/internal/task-orchestration.js +30 -216
  30. package/dist/lib/{task/commands/validate.js → internal/task-validate.js} +77 -43
  31. package/dist/lib/merge.js +205 -103
  32. package/dist/lib/process-data/normalize.js +2 -9
  33. package/dist/lib/run/host.js +46 -16
  34. package/dist/lib/run/tui.js +5 -2
  35. package/dist/lib/sandbox/agent-client-reconciler.js +4 -12
  36. package/dist/lib/sandbox/commands/create.js +3 -3
  37. package/dist/lib/sandbox/commands/enter.js +18 -4
  38. package/dist/lib/sandbox/config.js +3 -12
  39. package/dist/lib/sandbox/control/controller-registration.js +4 -2
  40. package/dist/lib/sandbox/control/executor.js +135 -40
  41. package/dist/lib/sandbox/control/lifecycle.js +29 -20
  42. package/dist/lib/sandbox/control/server.js +18 -16
  43. package/dist/lib/sandbox/mounts.js +3 -2
  44. package/dist/lib/sandbox/recovery.js +123 -22
  45. package/dist/lib/sandbox/workspace-identity.js +14 -0
  46. package/dist/lib/sandbox/workspace-view.js +8 -9
  47. package/dist/lib/self-update.js +278 -0
  48. package/dist/lib/server/protocol.js +5 -5
  49. package/dist/lib/task/activity-log.js +4 -1
  50. package/dist/lib/task/artifact-lifecycle.js +4 -2
  51. package/dist/lib/task/codex-orchestration.js +32 -35
  52. package/dist/lib/task/command-options.js +1 -3
  53. package/dist/lib/task/commands/cat.js +0 -5
  54. package/dist/lib/task/commands/decisions.js +76 -92
  55. package/dist/lib/task/commands/files.js +6 -6
  56. package/dist/lib/task/commands/grep.js +25 -61
  57. package/dist/lib/task/commands/issue-body.js +6 -6
  58. package/dist/lib/task/commands/log.js +25 -10
  59. package/dist/lib/task/commands/show.js +5 -6
  60. package/dist/lib/task/commands/status.js +8 -8
  61. package/dist/lib/task/commit-operation.js +21 -25
  62. package/dist/lib/task/commit-policy.js +1 -1
  63. package/dist/lib/task/control-authority.js +431 -0
  64. package/dist/lib/task/create.js +6 -1
  65. package/dist/lib/task/current-contract.js +35 -0
  66. package/dist/lib/task/decision-details.js +263 -0
  67. package/dist/lib/task/decision-intents.js +5 -2
  68. package/dist/lib/task/delegation-receipts.js +8 -7
  69. package/dist/lib/task/events.js +11 -5
  70. package/dist/lib/task/finalization.js +72 -46
  71. package/dist/lib/task/index.js +19 -29
  72. package/dist/lib/task/ledger-intents.js +8 -9
  73. package/dist/lib/task/ledger.js +13 -6
  74. package/dist/lib/task/lifecycle.js +16 -0
  75. package/dist/lib/task/orchestration.js +51 -14
  76. package/dist/lib/task/review-artifacts.js +31 -12
  77. package/dist/lib/task/review-finalization.js +19 -6
  78. package/dist/lib/task/verification-engine.js +38 -18
  79. package/dist/lib/task/verification-review.js +1 -1
  80. package/dist/lib/task/workspace-snapshot.js +5 -11
  81. package/dist/lib/task/write.js +11 -1
  82. package/dist/lib/update.js +6 -37
  83. package/dist/lib/version.js +5 -1
  84. package/dist/lifecycle-build-manifest.json +3 -3
  85. package/lib/agent-client.ts +0 -1
  86. package/lib/agent-clients/adapters/codex-lifecycle/build-identity.ts +25 -10
  87. package/lib/agent-clients/adapters/codex-lifecycle/controller-context.ts +16 -33
  88. package/lib/agent-clients/adapters/codex-lifecycle/sandbox-controller.ts +16 -35
  89. package/lib/agent-clients/adapters/codex-sandbox.ts +89 -14
  90. package/lib/agent-clients/adapters/index.ts +3 -1
  91. package/lib/agent-clients/adapters/opencode-sandbox.ts +0 -5
  92. package/lib/agent-clients/adapters/traecli.ts +66 -0
  93. package/lib/agent-clients/config.ts +14 -144
  94. package/lib/agent-clients/reconcile.ts +1 -12
  95. package/lib/agent-clients/schema.ts +5 -4
  96. package/lib/agent-clients/tokens.ts +7 -20
  97. package/lib/agent-clients/types.ts +2 -1
  98. package/lib/decide.ts +12 -22
  99. package/lib/defaults.json +9 -0
  100. package/lib/init.ts +2 -2
  101. package/lib/internal/codex-lifecycle.ts +2 -2
  102. package/lib/internal/codex-sandbox-controller.ts +4 -3
  103. package/lib/internal/release-workflow.ts +0 -1
  104. package/lib/internal/sandbox-control.ts +2 -2
  105. package/lib/internal/task-finalization.ts +27 -13
  106. package/lib/internal/task-ledger.ts +8 -2
  107. package/lib/internal/task-lifecycle.ts +33 -76
  108. package/lib/internal/task-orchestration.ts +33 -190
  109. package/lib/{task/commands/validate.ts → internal/task-validate.ts} +77 -41
  110. package/lib/merge.ts +236 -120
  111. package/lib/process-data/normalize.ts +2 -8
  112. package/lib/run/host.ts +63 -14
  113. package/lib/run/tui.ts +5 -3
  114. package/lib/sandbox/agent-client-reconciler.ts +5 -15
  115. package/lib/sandbox/commands/create.ts +4 -4
  116. package/lib/sandbox/commands/enter.ts +24 -4
  117. package/lib/sandbox/config.ts +2 -14
  118. package/lib/sandbox/control/container-identity.ts +2 -2
  119. package/lib/sandbox/control/controller-registration.ts +8 -3
  120. package/lib/sandbox/control/executor.ts +156 -53
  121. package/lib/sandbox/control/lifecycle.ts +34 -28
  122. package/lib/sandbox/control/protocol.ts +1 -3
  123. package/lib/sandbox/control/server.ts +15 -12
  124. package/lib/sandbox/control/state.ts +7 -7
  125. package/lib/sandbox/mounts.ts +4 -3
  126. package/lib/sandbox/recovery.ts +162 -34
  127. package/lib/sandbox/tools.ts +1 -1
  128. package/lib/sandbox/workspace-identity.ts +28 -0
  129. package/lib/sandbox/workspace-view.ts +14 -10
  130. package/lib/self-update.ts +341 -0
  131. package/lib/server/protocol.ts +5 -5
  132. package/lib/task/activity-log.ts +6 -1
  133. package/lib/task/artifact-lifecycle.ts +5 -3
  134. package/lib/task/codex-orchestration.ts +40 -45
  135. package/lib/task/command-options.ts +1 -2
  136. package/lib/task/commands/cat.ts +0 -4
  137. package/lib/task/commands/decisions.ts +80 -75
  138. package/lib/task/commands/files.ts +6 -6
  139. package/lib/task/commands/grep.ts +23 -51
  140. package/lib/task/commands/issue-body.ts +6 -6
  141. package/lib/task/commands/log.ts +22 -10
  142. package/lib/task/commands/show.ts +5 -6
  143. package/lib/task/commands/status.ts +8 -8
  144. package/lib/task/commit-operation.ts +25 -30
  145. package/lib/task/commit-policy.ts +1 -2
  146. package/lib/task/control-authority.ts +563 -0
  147. package/lib/task/create.ts +6 -1
  148. package/lib/task/current-contract.ts +49 -0
  149. package/lib/task/decision-details.ts +340 -0
  150. package/lib/task/decision-intents.ts +7 -2
  151. package/lib/task/delegation-receipts.ts +8 -6
  152. package/lib/task/events.ts +10 -5
  153. package/lib/task/finalization.ts +84 -42
  154. package/lib/task/index.ts +19 -28
  155. package/lib/task/ledger-intents.ts +6 -8
  156. package/lib/task/ledger.ts +17 -7
  157. package/lib/task/lifecycle.ts +20 -0
  158. package/lib/task/orchestration.ts +42 -16
  159. package/lib/task/review-artifacts.ts +53 -15
  160. package/lib/task/review-finalization.ts +33 -7
  161. package/lib/task/verification-engine.ts +33 -21
  162. package/lib/task/verification-review.ts +1 -1
  163. package/lib/task/workspace-snapshot.ts +4 -13
  164. package/lib/task/write.ts +20 -1
  165. package/lib/update.ts +6 -40
  166. package/lib/version.ts +6 -1
  167. package/package.json +1 -1
  168. package/templates/.agents/QUICKSTART.en.md +2 -3
  169. package/templates/.agents/QUICKSTART.zh-CN.md +2 -3
  170. package/templates/.agents/README.en.md +5 -3
  171. package/templates/.agents/README.zh-CN.md +5 -3
  172. package/templates/.agents/rules/README.en.md +1 -0
  173. package/templates/.agents/rules/README.zh-CN.md +1 -0
  174. package/templates/.agents/rules/compatibility-policy.en.md +40 -0
  175. package/templates/.agents/rules/compatibility-policy.zh-CN.md +40 -0
  176. package/templates/.agents/rules/create-issue.github.en.md +1 -1
  177. package/templates/.agents/rules/create-issue.github.zh-CN.md +1 -1
  178. package/templates/.agents/rules/human-decision-context.en.md +9 -7
  179. package/templates/.agents/rules/human-decision-context.zh-CN.md +9 -7
  180. package/templates/.agents/rules/issue-fields.github.en.md +1 -1
  181. package/templates/.agents/rules/issue-fields.github.zh-CN.md +1 -1
  182. package/templates/.agents/rules/issue-pr-commands.en.md +1 -1
  183. package/templates/.agents/rules/issue-pr-commands.github.en.md +1 -1
  184. package/templates/.agents/rules/issue-pr-commands.github.zh-CN.md +1 -1
  185. package/templates/.agents/rules/issue-pr-commands.zh-CN.md +1 -1
  186. package/templates/.agents/rules/issue-sync.github.en.md +1 -1
  187. package/templates/.agents/rules/issue-sync.github.zh-CN.md +2 -2
  188. package/templates/.agents/rules/lifecycle-orchestration.en.md +4 -4
  189. package/templates/.agents/rules/lifecycle-orchestration.zh-CN.md +4 -4
  190. package/templates/.agents/rules/milestone-inference.github.en.md +1 -1
  191. package/templates/.agents/rules/milestone-inference.github.zh-CN.md +1 -1
  192. package/templates/.agents/rules/next-step-output.en.md +3 -3
  193. package/templates/.agents/rules/next-step-output.zh-CN.md +3 -3
  194. package/templates/.agents/rules/no-mid-flow-questions.en.md +1 -1
  195. package/templates/.agents/rules/no-mid-flow-questions.zh-CN.md +1 -1
  196. package/templates/.agents/rules/pr-sync.en.md +2 -2
  197. package/templates/.agents/rules/pr-sync.github.en.md +3 -2
  198. package/templates/.agents/rules/pr-sync.github.zh-CN.md +3 -1
  199. package/templates/.agents/rules/pr-sync.zh-CN.md +2 -1
  200. package/templates/.agents/rules/release-commands.github.en.md +6 -0
  201. package/templates/.agents/rules/release-commands.github.zh-CN.md +6 -0
  202. package/templates/.agents/rules/review-handshake.en.md +1 -1
  203. package/templates/.agents/rules/review-handshake.zh-CN.md +1 -1
  204. package/templates/.agents/rules/review-method.en.md +1 -0
  205. package/templates/.agents/rules/review-method.zh-CN.md +1 -0
  206. package/templates/.agents/rules/task-management.en.md +1 -2
  207. package/templates/.agents/rules/task-management.zh-CN.md +1 -2
  208. package/templates/.agents/skills/analyze-task/SKILL.en.md +4 -3
  209. package/templates/.agents/skills/analyze-task/SKILL.zh-CN.md +4 -3
  210. package/templates/.agents/skills/block-task/SKILL.en.md +2 -2
  211. package/templates/.agents/skills/block-task/SKILL.zh-CN.md +2 -2
  212. package/templates/.agents/skills/cancel-task/SKILL.en.md +2 -2
  213. package/templates/.agents/skills/cancel-task/SKILL.zh-CN.md +2 -2
  214. package/templates/.agents/skills/check-task/SKILL.en.md +2 -2
  215. package/templates/.agents/skills/check-task/SKILL.zh-CN.md +2 -2
  216. package/templates/.agents/skills/close-codescan/SKILL.en.md +1 -1
  217. package/templates/.agents/skills/close-codescan/SKILL.zh-CN.md +1 -1
  218. package/templates/.agents/skills/close-dependabot/SKILL.en.md +1 -1
  219. package/templates/.agents/skills/close-dependabot/SKILL.zh-CN.md +1 -1
  220. package/templates/.agents/skills/code-task/SKILL.en.md +4 -3
  221. package/templates/.agents/skills/code-task/SKILL.zh-CN.md +5 -3
  222. package/templates/.agents/skills/commit/SKILL.en.md +27 -7
  223. package/templates/.agents/skills/commit/SKILL.zh-CN.md +3 -4
  224. package/templates/.agents/skills/complete-manual-validation/SKILL.en.md +5 -5
  225. package/templates/.agents/skills/complete-manual-validation/SKILL.zh-CN.md +5 -5
  226. package/templates/.agents/skills/complete-task/SKILL.en.md +3 -3
  227. package/templates/.agents/skills/complete-task/SKILL.zh-CN.md +3 -3
  228. package/templates/.agents/skills/create-pr/SKILL.en.md +15 -11
  229. package/templates/.agents/skills/create-pr/SKILL.zh-CN.md +15 -11
  230. package/templates/.agents/skills/create-pr/reference/change-report.en.md +46 -0
  231. package/templates/.agents/skills/create-pr/reference/change-report.zh-CN.md +46 -0
  232. package/templates/.agents/skills/create-pr/scripts/change-report.mjs +203 -0
  233. package/templates/.agents/skills/create-release-note/SKILL.en.md +5 -6
  234. package/templates/.agents/skills/create-release-note/SKILL.zh-CN.md +5 -6
  235. package/templates/.agents/skills/create-task/SKILL.en.md +1 -1
  236. package/templates/.agents/skills/create-task/SKILL.zh-CN.md +1 -1
  237. package/templates/.agents/skills/import-issue/SKILL.en.md +1 -1
  238. package/templates/.agents/skills/import-issue/SKILL.zh-CN.md +1 -1
  239. package/templates/.agents/skills/plan-task/SKILL.en.md +5 -4
  240. package/templates/.agents/skills/plan-task/SKILL.zh-CN.md +5 -4
  241. package/templates/.agents/skills/restore-task/SKILL.en.md +1 -1
  242. package/templates/.agents/skills/restore-task/SKILL.zh-CN.md +1 -1
  243. package/templates/.agents/skills/review-analysis/SKILL.en.md +5 -3
  244. package/templates/.agents/skills/review-analysis/SKILL.zh-CN.md +5 -3
  245. package/templates/.agents/skills/review-analysis/config/verify.en.json +1 -0
  246. package/templates/.agents/skills/review-analysis/config/verify.zh-CN.json +1 -0
  247. package/templates/.agents/skills/review-code/SKILL.en.md +5 -3
  248. package/templates/.agents/skills/review-code/SKILL.zh-CN.md +5 -3
  249. package/templates/.agents/skills/review-code/config/verify.en.json +1 -0
  250. package/templates/.agents/skills/review-code/config/verify.zh-CN.json +1 -0
  251. package/templates/.agents/skills/review-code/reference/migration-risks.en.md +9 -6
  252. package/templates/.agents/skills/review-code/reference/migration-risks.zh-CN.md +9 -6
  253. package/templates/.agents/skills/review-plan/SKILL.en.md +5 -3
  254. package/templates/.agents/skills/review-plan/SKILL.zh-CN.md +5 -3
  255. package/templates/.agents/skills/review-plan/config/verify.en.json +1 -0
  256. package/templates/.agents/skills/review-plan/config/verify.zh-CN.json +1 -0
  257. package/templates/.agents/skills/run-manual-validation/SKILL.en.md +7 -3
  258. package/templates/.agents/skills/run-manual-validation/SKILL.zh-CN.md +7 -3
  259. package/templates/.agents/skills/run-manual-validation/reference/discovery-and-execution.en.md +1 -1
  260. package/templates/.agents/skills/run-manual-validation/reference/discovery-and-execution.zh-CN.md +1 -1
  261. package/templates/.agents/skills/run-manual-validation/reference/report-template.en.md +2 -2
  262. package/templates/.agents/skills/run-manual-validation/reference/report-template.zh-CN.md +2 -2
  263. package/templates/.agents/skills/run-task/SKILL.en.md +6 -2
  264. package/templates/.agents/skills/run-task/SKILL.zh-CN.md +6 -2
  265. package/templates/.agents/skills/run-task/reference/host-validation.en.md +2 -2
  266. package/templates/.agents/skills/run-task/reference/host-validation.zh-CN.md +2 -2
  267. package/templates/.agents/skills/update-agent-infra/SKILL.en.md +2 -2
  268. package/templates/.agents/skills/update-agent-infra/SKILL.zh-CN.md +2 -2
  269. package/templates/.agents/skills/update-agent-infra/scripts/sync-templates.js +159 -104
  270. package/templates/.agents/skills/watch-pr/SKILL.en.md +2 -2
  271. package/templates/.agents/skills/watch-pr/SKILL.zh-CN.md +2 -2
  272. package/templates/.agents/templates/task.en.md +1 -1
  273. package/templates/.agents/templates/task.zh-CN.md +1 -1
  274. package/templates/.claude/commands/analyze-task.en.md +1 -1
  275. package/templates/.claude/commands/analyze-task.zh-CN.md +1 -1
  276. package/templates/.claude/commands/block-task.en.md +1 -1
  277. package/templates/.claude/commands/block-task.zh-CN.md +1 -1
  278. package/templates/.claude/commands/cancel-task.en.md +1 -1
  279. package/templates/.claude/commands/cancel-task.zh-CN.md +1 -1
  280. package/templates/.claude/commands/check-task.en.md +1 -1
  281. package/templates/.claude/commands/check-task.zh-CN.md +1 -1
  282. package/templates/.claude/commands/code-task.en.md +1 -1
  283. package/templates/.claude/commands/code-task.zh-CN.md +1 -1
  284. package/templates/.claude/commands/commit.en.md +1 -1
  285. package/templates/.claude/commands/commit.zh-CN.md +1 -1
  286. package/templates/.claude/commands/complete-manual-validation.en.md +1 -1
  287. package/templates/.claude/commands/complete-manual-validation.zh-CN.md +1 -1
  288. package/templates/.claude/commands/complete-task.en.md +1 -1
  289. package/templates/.claude/commands/complete-task.zh-CN.md +1 -1
  290. package/templates/.claude/commands/create-pr.en.md +1 -1
  291. package/templates/.claude/commands/create-pr.zh-CN.md +1 -1
  292. package/templates/.claude/commands/plan-task.en.md +1 -1
  293. package/templates/.claude/commands/plan-task.zh-CN.md +1 -1
  294. package/templates/.claude/commands/review-analysis.en.md +1 -1
  295. package/templates/.claude/commands/review-analysis.zh-CN.md +1 -1
  296. package/templates/.claude/commands/review-code.en.md +1 -1
  297. package/templates/.claude/commands/review-code.zh-CN.md +1 -1
  298. package/templates/.claude/commands/review-plan.en.md +1 -1
  299. package/templates/.claude/commands/review-plan.zh-CN.md +1 -1
  300. package/templates/.claude/commands/run-manual-validation.en.md +1 -1
  301. package/templates/.claude/commands/run-manual-validation.zh-CN.md +1 -1
  302. package/templates/.claude/commands/run-task.en.md +1 -1
  303. package/templates/.claude/commands/run-task.zh-CN.md +1 -1
  304. package/templates/.claude/commands/watch-pr.en.md +1 -1
  305. package/templates/.claude/commands/watch-pr.zh-CN.md +1 -1
  306. package/templates/.traecli/commands/update-agent-infra.en.md +7 -0
  307. package/templates/.traecli/commands/update-agent-infra.zh-CN.md +7 -0
  308. package/dist/lib/builtin-tuis.js +0 -40
  309. package/lib/builtin-tuis.ts +0 -56
@@ -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
 
@@ -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.
@@ -78,19 +76,25 @@ If `{task-id}` is available and the related task provides `issue_number`, keep `
78
76
 
79
77
  Capture the `result` field from `platform-pr create` (`pr_created`, `pr_reused`, or `no_op`), then run `agent-infra-internal platform-pr sync {task-id} --agent {standard-agent-token} --metadata --closing-issue --result {primary-result}`. The core copies type / `in:` labels, assignee, and a specific milestone from the Issue and maintains the closing association. Permission-bound items degrade independently, and the Issue is never updated in reverse. After the PR identity is bound, metadata or summary sync failures produce `pr_created_with_warnings`, `pr_reused_with_warnings`, or `no_op_with_warnings` from that primary result, preserve the primary-action fact, and retry only unfinished sync steps.
80
78
 
81
- ### 7. Publish the Review Summary
79
+ ### 7. Generate the PR Code Change Report
80
+
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.
82
+
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.
84
+
85
+ ### 8. Publish the Review Summary
82
86
 
83
87
  Read the latest context artifacts when they exist: `plan.md` / `plan-r{N}.md`, `review-plan.md` / `review-plan-r{N}.md`, `code.md` / `code-r{N}.md`, and `review-code.md` / `review-code-r{N}.md`.
84
88
 
85
- Aggregate a reviewer-facing summary from those artifacts and maintain a single idempotent summary comment via the hidden marker. Pass the same `--result {primary-result}` to `summary-sync`; a sync substep must not infer whether the PR was created or reused.
89
+ Aggregate a reviewer-facing summary from those artifacts, append the `### PR Code Changes` section generated in step 7, and maintain a single idempotent summary comment via the hidden marker. Pass the same `--result {primary-result}` to `summary-sync`; a sync substep must not infer whether the PR was created or reused.
86
90
 
87
91
  > Canonical context, aggregation, and the `summary-sync` call live in `reference/comment-publish.md`, which points to `.agents/rules/pr-sync.md`. Read that reference before publishing.
88
92
 
89
- ### 8. Confirm Task Status
93
+ ### 9. Confirm Task Status
90
94
 
91
95
  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.
92
96
 
93
- ### 9. Verification Gate
97
+ ### 10. Verification Gate
94
98
 
95
99
  If this operation is associated with `{task-id}`, run the verification gate to confirm task metadata and sync state. If there is no task context, skip this step.
96
100
 
@@ -105,13 +109,13 @@ Handle the result as follows:
105
109
 
106
110
  Keep the gate output in your reply as fresh evidence. Do not claim completion without output from this run.
107
111
 
108
- ### 10. Inform User
112
+ ### 11. Inform User
109
113
 
110
114
  > Execute this step only after the verification gate passes.
111
115
 
112
116
  > Before rendering next steps, read `.agents/rules/next-step-output.md`, invoke the shared helper only for the selected scenario, and insert its stdout at `{next-step-commands}`.
113
117
 
114
- Explain the created PR URL, summarize metadata sync and summary-comment results, and recommend watching the PR's checks next (render `{task-ref}` as the short id `NN` per `.agents/rules/next-step-output.md`):
118
+ Explain the created PR URL, summarize metadata sync and summary-comment results, show the complete step 7 category table and necessity conclusion, and recommend watching the PR's checks next (render `{task-ref}` as the short id `NN` per `.agents/rules/next-step-output.md`):
115
119
 
116
120
  Populate `{next-step-commands}` for this scenario by running `agent-infra-internal agent-client next-steps --skill watch-pr --task-ref {task-ref}`.
117
121
 
@@ -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
 
@@ -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}` 时,后续步骤中的任务关联逻辑跳过。
@@ -78,19 +76,25 @@ description: >
78
76
 
79
77
  记录 `platform-pr create` 结构化结果中的 `result`(`pr_created`、`pr_reused` 或 `no_op`),并调用 `agent-infra-internal platform-pr sync {task-id} --agent {standard-agent-token} --metadata --closing-issue --result {primary-result}`。core 从 Issue 复制 type / `in:` labels、assignee 和具体 milestone,并维护 Development 关联;逐项权限不足返回 degraded,不反向更新 Issue。PR 已成功绑定后,metadata/summary 同步失败只产生与 primary result 对应的 `pr_created_with_warnings`、`pr_reused_with_warnings` 或 `no_op_with_warnings`,保留主动作事实,重试只执行未完成的同步步骤。
80
78
 
81
- ### 7. 发布审查摘要
79
+ ### 7. 生成 PR 代码增减报告
80
+
81
+ 创建或唯一复用 PR 后,调用 `agent-infra-internal platform-pr inspect {task-id}` 取得权威 base/head SHA,并按 `reference/change-report.md` 统计完整 PR 的分类行数、Git blob 字节数、rename 与疑似不必要变化。执行本步骤前先读取该 reference。
82
+
83
+ 报告既是下方 reviewer 摘要的一部分,也必须出现在最终用户回复中;不得只给总行数、忽略字节变化或只统计最后一个 commit。
84
+
85
+ ### 8. 发布审查摘要
82
86
 
83
87
  读取最新的上下文产物:`plan.md` / `plan-r{N}.md`、`review-plan.md` / `review-plan-r{N}.md`、`code.md` / `code-r{N}.md`、`review-code.md` / `review-code-r{N}.md`(存在时)。
84
88
 
85
- 基于这些产物聚合 reviewer 摘要,并使用隐藏标记维护唯一且幂等的摘要评论。调用 `summary-sync` 时继续传递同一个 `--result {primary-result}`,不得根据同步子步骤猜测 PR 是创建还是复用。
89
+ 基于这些产物聚合 reviewer 摘要,并追加第 7 步生成的 `### PR 代码增减` 段落,再使用隐藏标记维护唯一且幂等的摘要评论。调用 `summary-sync` 时继续传递同一个 `--result {primary-result}`,不得根据同步子步骤猜测 PR 是创建还是复用。
86
90
 
87
91
  > canonical context、摘要聚合和 `summary-sync` 调用见 `reference/comment-publish.md`(其引用 `.agents/rules/pr-sync.md`)。发布摘要前先读取该 reference。
88
92
 
89
- ### 8. 确认任务状态
93
+ ### 9. 确认任务状态
90
94
 
91
95
  `platform-pr create` 在成功创建或恢复唯一远端身份后,通过任务写入内核原子更新 `pr_number`、`pr_status`、规范时间/版本和 Create PR 完成日志。调用方只核对结构化结果,不再次编辑这些字段。
92
96
 
93
- ### 9. 完成校验
97
+ ### 10. 完成校验
94
98
 
95
99
  如果本次操作关联了 `{task-id}`,运行完成校验,确认任务元数据和同步状态符合规范;如果没有任务上下文,跳过本步骤。
96
100
 
@@ -105,13 +109,13 @@ agent-infra-internal task-verify {task-id} create-pr.completed --format text
105
109
 
106
110
  将校验输出保留在回复中作为当次验证输出。没有当次校验输出,不得声明完成。
107
111
 
108
- ### 10. 告知用户
112
+ ### 11. 告知用户
109
113
 
110
114
  > 仅在校验通过后执行本步骤。
111
115
 
112
116
  > 渲染下一步前先读取 `.agents/rules/next-step-output.md`,仅为已选场景调用统一 helper,并将 stdout 填入 `{next-step-commands}`。
113
117
 
114
- 说明 PR URL、元数据同步结果、摘要评论结果,并推荐下一步进入 PR 监控(按 `.agents/rules/next-step-output.md` 把 `{task-ref}` 渲染为短号 `NN`):
118
+ 说明 PR URL、元数据同步结果、摘要评论结果,完整展示第 7 步的分类统计表与必要性结论,并推荐下一步进入 PR 监控(按 `.agents/rules/next-step-output.md` 把 `{task-ref}` 渲染为短号 `NN`):
115
119
 
116
120
  使用 `agent-infra-internal agent-client next-steps --skill watch-pr --task-ref {task-ref}` 生成本场景的 `{next-step-commands}`。
117
121
 
@@ -0,0 +1,46 @@
1
+ # PR Code Change Report
2
+
3
+ <!-- pr-change-report-contract
4
+ {"source":"platform-pr-inspect","diff":"three-dot-find-renames","metrics":["numstat-lines","git-blob-bytes"],"publish":["pr-summary","user-response"]}
5
+ -->
6
+
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.
8
+
9
+ ## Evidence Commands
10
+
11
+ ```bash
12
+ node .agents/skills/create-pr/scripts/change-report.mjs --base {base-sha} --head {head-sha}
13
+ git diff --find-renames --name-status {base-sha}...{head-sha}
14
+ git diff --find-renames --summary {base-sha}...{head-sha}
15
+ ```
16
+
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.
20
+
21
+ ## Classification and Reconciliation
22
+
23
+ Using the repository's actual structure, assign every file to exactly one closest category and omit categories that do not apply:
24
+
25
+ - Runtime code
26
+ - Tests and test support
27
+ - Skills, workflows, and collaboration rules
28
+ - Templates or generated mirrors
29
+ - Documentation
30
+ - Configuration, dependencies, and other files
31
+
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.
35
+
36
+ ## Required Analysis
37
+
38
+ Briefly explain:
39
+
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;
42
+ - which line changes are path moves, bilingual mirrors, or mechanical synchronization;
43
+ - whether any change cannot be traced directly to the PR goal and may be unnecessary; if none, state the evidence;
44
+ - when a test fixture is much larger than production changes, what risk it covers instead of judging it only by size.
45
+
46
+ Add the complete report as a `### PR Code Changes` section in the reviewer summary body. Preserve the same table and conclusion in the user-visible create-pr completion response. Do not create a second PR comment for this report.
@@ -0,0 +1,46 @@
1
+ # PR 代码增减报告
2
+
3
+ <!-- pr-change-report-contract
4
+ {"source":"platform-pr-inspect","diff":"three-dot-find-renames","metrics":["numstat-lines","git-blob-bytes"],"publish":["pr-summary","user-response"]}
5
+ -->
6
+
7
+ PR 创建或复用成功后,使用 `platform-pr inspect` 返回的权威 `base.sha` 与 `head.sha` 统计完整 PR 差异,不以最后一个 commit 或工作树状态代替。
8
+
9
+ ## 证据命令
10
+
11
+ ```bash
12
+ node .agents/skills/create-pr/scripts/change-report.mjs --base {base-sha} --head {head-sha}
13
+ git diff --find-renames --name-status {base-sha}...{head-sha}
14
+ git diff --find-renames --summary {base-sha}...{head-sha}
15
+ ```
16
+
17
+ 脚本在 merge base 与 head 之间同时计算 `numstat` 行数和 Git blob 的精确字节数。字节比字符具有稳定口径,也能覆盖二进制文件和同行内缩减;子模块不是 blob,按 0 字节贡献核算。新增文件的旧字节数为 0,删除文件的新字节数为 0,纯 rename 的净字节数为 0,copy 只计新增目标内容。
18
+
19
+ `numstat` 中的二进制文件计入文件数,但不虚构行数。rename/copy 依据脚本的逐文件记录、`name-status` 与 `summary` 单独说明,避免把移动误报为整文件重写。
20
+
21
+ ## 分类与核算
22
+
23
+ 结合仓库实际结构,把每个文件唯一归入以下最贴近的类别;不适用的类别省略:
24
+
25
+ - 运行时代码
26
+ - 测试与测试辅助设施
27
+ - Skill / workflow / 协作规则
28
+ - 模板或生成镜像
29
+ - 文档
30
+ - 配置、依赖与其他
31
+
32
+ 输出表格必须包含“部分、文件数、新增行、删除行、净增行、旧字节、新字节、净字节”,并有合计行。字节列表示本次变更涉及文件的 blob 内容体积,不表示整个仓库或工作树的磁盘占用。使用精确整数;可附加 KiB/MiB 便于阅读,但不能替代字节数。
33
+
34
+ 各类别的行数和字节数之和必须分别与脚本的 `totals` 一致。随后分别列出行数变化和绝对净字节变化最大的文件,并区分源码、测试、模板镜像和纯 rename。
35
+
36
+ ## 分析要求
37
+
38
+ 用简短结论回答:
39
+
40
+ - 增长主要集中在哪里,运行时代码与测试/文档/模板各占多少;
41
+ - 行数净变化与净字节变化是否给出不同结论,尤其指出同行内明显缩减或膨胀;
42
+ - 哪些行数只是路径迁移、双语镜像或机械同步;
43
+ - 是否存在与 PR 目标无法直接对应、疑似不必要的变化;若没有,明确说明判断依据;
44
+ - 若某个测试 fixture 明显大于生产改动,解释它覆盖的风险,而不是仅以行数评价。
45
+
46
+ 将完整报告以 `### PR 代码增减` 段落写入 reviewer 摘要正文,并在 create-pr 的用户可见完成回复中原样保留同一张统计表与结论。不要把报告另建成第二条 PR 评论。
@@ -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
@@ -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
  ## 行为边界 / 关键规则
@@ -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 编号。
@@ -7,7 +7,7 @@ description: >
7
7
  ---
8
8
 
9
9
  # Design Technical Plan
10
- > `--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.
10
+ > `--agent` values are defined in `.agents/rules/task-management.md` under “Collaborator Token Specification”.
11
11
 
12
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.
13
13
 
@@ -15,6 +15,7 @@ If the entry operands contain `--orchestrated`, bind `{execution-flag}` to `--or
15
15
 
16
16
  - This skill only outputs a technical plan document (`plan.md` or `plan-r{N}.md`) and does not modify any business code
17
17
  - This is a **mandatory human review checkpoint**; do not automatically proceed to implementation
18
+ - When the plan touches compatibility, migration, old formats, or old entry points, read `.agents/rules/compatibility-policy.md` first. Do not design adapters, shims, dual writes, or parallel state machines without passing its admission gate
18
19
  - After executing this skill, you **must** immediately update task status in task.md
19
20
 
20
21
  Version stamp rule: when creating or updating `task.md` frontmatter, read `.agents/rules/version-stamp.md` first and write or refresh `agent_infra_version`.
@@ -23,7 +24,7 @@ Version stamp rule: when creating or updating `task.md` frontmatter, read `.agen
23
24
 
24
25
  After loading workflow / skill / rules instructions, and before any task-state judgment or user-visible conclusion, run the state check first. Reading instruction files does not count as an external-state action or conclusion.
25
26
 
26
- Run these commands and paste the raw output into both the user-facing reply and this round's `## State Check` section:
27
+ Run these commands and paste the raw output into this round's `## State Check` section:
27
28
 
28
29
  ```bash
29
30
  agent-infra-internal task-snapshot {task-id} --format text
@@ -33,7 +34,7 @@ Before the state check is complete, do not make external-state assertions such a
33
34
 
34
35
  ## Task Context Resolution
35
36
 
36
- > 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.
37
+ > 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.
37
38
 
38
39
  > Resolve the task reference, then confirm that the task is in a state or directory supported by this skill and that `task.md` exists; if it cannot be located, handle it as a missing task and stop.
39
40
 
@@ -75,7 +76,7 @@ Use it to understand:
75
76
 
76
77
  - Read the relevant source files identified in the analysis
77
78
  - Understand the current architecture and patterns
78
- - Identify constraints (backward compatibility, performance, etc.)
79
+ - Identify explicit constraints, including evidenced and approved compatibility or performance requirements; do not infer a compatibility promise
79
80
  - Consider edge cases and failure scenarios
80
81
 
81
82
  ### 5. Design the Technical Plan
@@ -7,7 +7,7 @@ description: >
7
7
  ---
8
8
 
9
9
  # 设计技术方案
10
- > `--agent` 取值见 `.agents/rules/task-management.md`「合作者 token 规范」:标准 AI 短名(`claude`/`codex`/`antigravity`/`opencode`/`cursor`)、长名归一化(`claude-code`→`claude`、`antigravity-cli`→`antigravity`)或人工例外 `human`。
10
+ > `--agent` 取值见 `.agents/rules/task-management.md`「合作者 token 规范」。
11
11
 
12
12
  若入口业务操作数包含 `--orchestrated`,绑定 `{execution-flag}` = `--orchestrated` 并原样转发给 completed 事件;否则绑定为空。不得从 `orchestration.json`、环境变量或历史产物推断该标记。
13
13
 
@@ -15,6 +15,7 @@ description: >
15
15
 
16
16
  - 本技能仅产出技术方案文档(`plan.md` 或 `plan-r{N}.md`)—— 不修改任何业务代码
17
17
  - 这是一个**强制性的人工审查检查点** —— 不要自动进入实现阶段
18
+ - 方案涉及兼容、迁移、旧格式或旧入口时,先读取 `.agents/rules/compatibility-policy.md`;未通过准入门槛时不得设计 adapter、shim、双写或并行状态机
18
19
  - 执行本技能后,你**必须**立即更新 task.md 中的任务状态
19
20
 
20
21
  版本戳规则:创建或更新 `task.md` frontmatter 时,先读取 `.agents/rules/version-stamp.md`,并写入或刷新 `agent_infra_version`。
@@ -23,7 +24,7 @@ description: >
23
24
 
24
25
  在加载 workflow / skill / rules 指令之后、做任何任务状态判断或用户可见结论之前,必须先执行状态核对。指令类文件读取不算对外动作或结论。
25
26
 
26
- 运行以下命令,并把原文粘贴到回复正文和本轮产物的 `## 状态核对` 段:
27
+ 运行以下命令,并把原文粘贴到本轮产物的 `## 状态核对` 段:
27
28
 
28
29
  ```bash
29
30
  agent-infra-internal task-snapshot {task-id} --format text
@@ -33,7 +34,7 @@ agent-infra-internal task-snapshot {task-id} --format text
33
34
 
34
35
  ## 任务上下文解析
35
36
 
36
- > 入口允许省略 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`。解析失败时透传非零退出码,不自行扫描任务。
37
+ > 入口可省略 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`。解析失败时透传非零退出码,不自行扫描任务。
37
38
 
38
39
  > 解析任务引用,并确认任务位于本技能支持的状态或目录且存在 `task.md`;无法定位时按未找到任务处理并停止。
39
40
 
@@ -76,7 +77,7 @@ agent-infra-internal task-event {task-id} plan.started --agent {standard-agent-t
76
77
 
77
78
  - 阅读分析中识别的相关源码文件
78
79
  - 理解当前架构和模式
79
- - 识别约束条件(向后兼容性、性能等)
80
+ - 识别明确约束(包括有证据且已获准的兼容性、性能等),不自行推导兼容承诺
80
81
  - 考虑边界情况和错误场景
81
82
 
82
83
  ### 5. 设计技术方案
@@ -6,7 +6,7 @@ description: >
6
6
  ---
7
7
 
8
8
  # Restore 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
  Restore local task workspace files from platform Issue comments that contain sync markers.