@fitlab-ai/agent-infra 0.9.2 → 0.9.4

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 (428) hide show
  1. package/README.md +12 -9
  2. package/README.zh-CN.md +12 -9
  3. package/bin/cli.ts +12 -0
  4. package/dist/bin/cli.js +14 -0
  5. package/dist/bin/internal-cli.js +134 -108
  6. package/dist/lib/agent-clients/adapter.js +137 -4
  7. package/dist/lib/agent-clients/adapters/antigravity-cli.js +64 -0
  8. package/dist/lib/{sandbox/credentials.js → agent-clients/adapters/claude-code-credentials.js} +4 -14
  9. package/dist/lib/agent-clients/adapters/claude-code-refresh.js +85 -0
  10. package/dist/lib/agent-clients/adapters/claude-code-sandbox.js +247 -0
  11. package/dist/lib/agent-clients/adapters/claude-code.js +27 -4
  12. package/dist/lib/agent-clients/adapters/codex.js +9 -0
  13. package/dist/lib/agent-clients/adapters/index.js +2 -2
  14. package/dist/lib/agent-clients/adapters/opencode-sandbox.js +108 -0
  15. package/dist/lib/agent-clients/adapters/opencode.js +24 -3
  16. package/dist/lib/agent-clients/adapters/runtimes/claude-code.dockerfile +65 -0
  17. package/dist/lib/agent-clients/config.js +42 -4
  18. package/dist/lib/agent-clients/next-steps.js +11 -2
  19. package/dist/lib/agent-clients/reconcile.js +2 -1
  20. package/dist/lib/agent-clients/registry.js +16 -2
  21. package/dist/lib/agent-clients/schema.js +18 -0
  22. package/dist/lib/agent-clients/tokens.js +49 -0
  23. package/dist/lib/agent-clients/types.js +1 -1
  24. package/dist/lib/defaults.json +1 -1
  25. package/dist/lib/git/workflow.js +54 -1
  26. package/dist/lib/internal/agent-client.js +61 -4
  27. package/dist/lib/internal/git-workflow.js +6 -1
  28. package/dist/lib/internal/platform-checks.js +3 -3
  29. package/dist/lib/internal/platform-comment.js +29 -2
  30. package/dist/lib/internal/platform-issue.js +7 -0
  31. package/dist/lib/internal/platform-pr-review.js +132 -0
  32. package/dist/lib/internal/platform-pr.js +20 -2
  33. package/dist/lib/internal/platform-release-notes.js +52 -16
  34. package/dist/lib/internal/pr-review-grade.js +140 -0
  35. package/dist/lib/internal/release-workflow.js +13 -6
  36. package/dist/lib/internal/sandbox-control.js +24 -0
  37. package/dist/lib/internal/task-activity.js +105 -0
  38. package/dist/lib/internal/task-event.js +17 -1
  39. package/dist/lib/internal/task-ledger.js +12 -3
  40. package/dist/lib/internal/task-lifecycle.js +26 -1
  41. package/dist/lib/internal/task-orchestration.js +167 -18
  42. package/dist/lib/internal/task-review.js +8 -3
  43. package/dist/lib/platform/adapters.js +8 -1
  44. package/dist/lib/platform/completion-backfill.js +122 -0
  45. package/dist/lib/platform/github-client.js +19 -2
  46. package/dist/lib/platform/issue-comments.js +3 -2
  47. package/dist/lib/platform/merged-pr-equivalence.js +115 -5
  48. package/dist/lib/platform/pr-checks.js +65 -42
  49. package/dist/lib/platform/pr-review.js +166 -0
  50. package/dist/lib/platform/pull-requests.js +371 -4
  51. package/dist/lib/platform/release-notes.js +85 -3
  52. package/dist/lib/platform/releases.js +13 -5
  53. package/dist/lib/pr-review/evidence-grading.js +229 -0
  54. package/dist/lib/process-data/index.js +239 -0
  55. package/dist/lib/process-data/normalize.js +198 -0
  56. package/dist/lib/process-data/privacy.js +33 -0
  57. package/dist/lib/process-data/reconcile.js +95 -0
  58. package/dist/lib/process-data/repair.js +58 -0
  59. package/dist/lib/process-data/sources.js +345 -0
  60. package/dist/lib/process-data/store.js +282 -0
  61. package/dist/lib/process-data/types.js +2 -0
  62. package/dist/lib/run/index.js +4 -3
  63. package/dist/lib/run/tui.js +10 -13
  64. package/dist/lib/sandbox/agent-client-reconciler.js +26 -2
  65. package/dist/lib/sandbox/capture.js +7 -2
  66. package/dist/lib/sandbox/commands/create.js +109 -248
  67. package/dist/lib/sandbox/commands/enter.js +15 -47
  68. package/dist/lib/sandbox/commands/list-running.js +16 -6
  69. package/dist/lib/sandbox/commands/ls.js +10 -6
  70. package/dist/lib/sandbox/commands/rebuild.js +4 -3
  71. package/dist/lib/sandbox/commands/refresh.js +4 -84
  72. package/dist/lib/sandbox/commands/rm.js +24 -3
  73. package/dist/lib/sandbox/commands/show.js +13 -4
  74. package/dist/lib/sandbox/commands/start.js +7 -4
  75. package/dist/lib/sandbox/config.js +2 -0
  76. package/dist/lib/sandbox/constants.js +6 -0
  77. package/dist/lib/sandbox/control/client.js +44 -0
  78. package/dist/lib/sandbox/control/protocol.js +35 -0
  79. package/dist/lib/sandbox/control/server.js +109 -0
  80. package/dist/lib/sandbox/dockerfile.js +36 -13
  81. package/dist/lib/sandbox/mounts.js +17 -4
  82. package/dist/lib/sandbox/recovery.js +128 -5
  83. package/dist/lib/sandbox/redaction.js +12 -0
  84. package/dist/lib/sandbox/runtimes/base.dockerfile +24 -74
  85. package/dist/lib/sandbox/workspace-identity.js +95 -0
  86. package/dist/lib/sandbox/workspace-view.js +103 -0
  87. package/dist/lib/task/activity-intent.js +307 -0
  88. package/dist/lib/task/artifact-lifecycle.js +2 -1
  89. package/dist/lib/task/commands/log.js +15 -14
  90. package/dist/lib/task/commit-finalization.js +267 -0
  91. package/dist/lib/task/commit-intent.js +165 -0
  92. package/dist/lib/task/decision-intents.js +31 -17
  93. package/dist/lib/task/delegation-receipts.js +25 -4
  94. package/dist/lib/task/events.js +67 -28
  95. package/dist/lib/task/finalization-artifacts.js +35 -0
  96. package/dist/lib/task/implementation-inputs.js +54 -7
  97. package/dist/lib/task/ledger-intents.js +35 -1
  98. package/dist/lib/task/lifecycle-execution.js +46 -0
  99. package/dist/lib/task/orchestration.js +753 -54
  100. package/dist/lib/task/resolve-ref.js +41 -1
  101. package/dist/lib/task/review-finalization.js +29 -9
  102. package/dist/lib/task/task-execution-lock.js +231 -0
  103. package/dist/lib/task/verification-checks.js +1 -1
  104. package/dist/lib/task/verification-engine.js +218 -2
  105. package/dist/lib/task/verification.js +4 -3
  106. package/dist/lib/task/workspace-snapshot.js +17 -5
  107. package/lib/agent-clients/adapter.ts +201 -4
  108. package/lib/agent-clients/adapters/antigravity-cli.ts +65 -0
  109. package/lib/{sandbox/credentials.ts → agent-clients/adapters/claude-code-credentials.ts} +3 -18
  110. package/lib/agent-clients/adapters/claude-code-refresh.ts +128 -0
  111. package/lib/agent-clients/adapters/claude-code-sandbox.ts +295 -0
  112. package/lib/agent-clients/adapters/claude-code.ts +31 -4
  113. package/lib/agent-clients/adapters/codex.ts +9 -0
  114. package/lib/agent-clients/adapters/index.ts +2 -2
  115. package/lib/agent-clients/adapters/opencode-sandbox.ts +136 -0
  116. package/lib/agent-clients/adapters/opencode.ts +27 -3
  117. package/lib/agent-clients/adapters/runtimes/claude-code.dockerfile +65 -0
  118. package/lib/agent-clients/config.ts +49 -4
  119. package/lib/agent-clients/next-steps.ts +15 -2
  120. package/lib/agent-clients/reconcile.ts +2 -1
  121. package/lib/agent-clients/registry.ts +19 -1
  122. package/lib/agent-clients/schema.ts +18 -0
  123. package/lib/agent-clients/tokens.ts +53 -0
  124. package/lib/agent-clients/types.ts +15 -1
  125. package/lib/defaults.json +1 -1
  126. package/lib/git/workflow.ts +66 -2
  127. package/lib/internal/agent-client.ts +59 -4
  128. package/lib/internal/git-workflow.ts +5 -1
  129. package/lib/internal/platform-checks.ts +4 -4
  130. package/lib/internal/platform-comment.ts +17 -2
  131. package/lib/internal/platform-issue.ts +4 -0
  132. package/lib/internal/platform-pr-review.ts +104 -0
  133. package/lib/internal/platform-pr.ts +14 -1
  134. package/lib/internal/platform-release-notes.ts +59 -16
  135. package/lib/internal/pr-review-grade.ts +130 -0
  136. package/lib/internal/release-workflow.ts +13 -6
  137. package/lib/internal/sandbox-control.ts +24 -0
  138. package/lib/internal/task-activity.ts +91 -0
  139. package/lib/internal/task-event.ts +9 -1
  140. package/lib/internal/task-ledger.ts +12 -3
  141. package/lib/internal/task-lifecycle.ts +26 -1
  142. package/lib/internal/task-orchestration.ts +123 -14
  143. package/lib/internal/task-review.ts +8 -3
  144. package/lib/platform/adapters.ts +29 -2
  145. package/lib/platform/completion-backfill.ts +134 -0
  146. package/lib/platform/github-client.ts +20 -2
  147. package/lib/platform/issue-comments.ts +3 -2
  148. package/lib/platform/merged-pr-equivalence.ts +127 -5
  149. package/lib/platform/pr-checks.ts +73 -46
  150. package/lib/platform/pr-review.ts +201 -0
  151. package/lib/platform/pull-requests.ts +444 -3
  152. package/lib/platform/release-notes.ts +100 -4
  153. package/lib/platform/releases.ts +16 -4
  154. package/lib/pr-review/evidence-grading.ts +318 -0
  155. package/lib/process-data/index.ts +224 -0
  156. package/lib/process-data/normalize.ts +202 -0
  157. package/lib/process-data/privacy.ts +41 -0
  158. package/lib/process-data/reconcile.ts +110 -0
  159. package/lib/process-data/repair.ts +64 -0
  160. package/lib/process-data/sources.ts +354 -0
  161. package/lib/process-data/store.ts +315 -0
  162. package/lib/process-data/types.ts +135 -0
  163. package/lib/run/index.ts +5 -3
  164. package/lib/run/tui.ts +14 -12
  165. package/lib/sandbox/agent-client-reconciler.ts +44 -2
  166. package/lib/sandbox/capture.ts +9 -2
  167. package/lib/sandbox/commands/create.ts +126 -280
  168. package/lib/sandbox/commands/enter.ts +13 -59
  169. package/lib/sandbox/commands/list-running.ts +23 -6
  170. package/lib/sandbox/commands/ls.ts +22 -6
  171. package/lib/sandbox/commands/rebuild.ts +4 -3
  172. package/lib/sandbox/commands/refresh.ts +4 -126
  173. package/lib/sandbox/commands/rm.ts +24 -3
  174. package/lib/sandbox/commands/show.ts +30 -4
  175. package/lib/sandbox/commands/start.ts +6 -4
  176. package/lib/sandbox/config.ts +4 -0
  177. package/lib/sandbox/constants.ts +8 -0
  178. package/lib/sandbox/control/client.ts +55 -0
  179. package/lib/sandbox/control/protocol.ts +75 -0
  180. package/lib/sandbox/control/server.ts +117 -0
  181. package/lib/sandbox/dockerfile.ts +66 -13
  182. package/lib/sandbox/mounts.ts +24 -4
  183. package/lib/sandbox/recovery.ts +163 -6
  184. package/lib/sandbox/redaction.ts +14 -0
  185. package/lib/sandbox/runtimes/base.dockerfile +24 -74
  186. package/lib/sandbox/tool-types.ts +16 -0
  187. package/lib/sandbox/workspace-identity.ts +123 -0
  188. package/lib/sandbox/workspace-view.ts +143 -0
  189. package/lib/server/server.schema.json +2 -2
  190. package/lib/task/activity-intent.ts +417 -0
  191. package/lib/task/artifact-lifecycle.ts +2 -1
  192. package/lib/task/commands/log.ts +15 -14
  193. package/lib/task/commit-finalization.ts +356 -0
  194. package/lib/task/commit-intent.ts +230 -0
  195. package/lib/task/decision-intents.ts +32 -12
  196. package/lib/task/delegation-receipts.ts +34 -5
  197. package/lib/task/events.ts +75 -30
  198. package/lib/task/finalization-artifacts.ts +58 -0
  199. package/lib/task/implementation-inputs.ts +62 -8
  200. package/lib/task/ledger-intents.ts +43 -3
  201. package/lib/task/lifecycle-execution.ts +106 -0
  202. package/lib/task/orchestration.ts +1019 -72
  203. package/lib/task/resolve-ref.ts +46 -1
  204. package/lib/task/review-finalization.ts +40 -9
  205. package/lib/task/task-execution-lock.ts +296 -0
  206. package/lib/task/verification-checks.ts +1 -1
  207. package/lib/task/verification-engine.ts +249 -2
  208. package/lib/task/verification.ts +5 -3
  209. package/lib/task/workspace-snapshot.ts +26 -5
  210. package/package.json +3 -3
  211. package/templates/.agents/QUICKSTART.en.md +25 -8
  212. package/templates/.agents/QUICKSTART.zh-CN.md +25 -8
  213. package/templates/.agents/README.en.md +10 -7
  214. package/templates/.agents/README.zh-CN.md +10 -7
  215. package/templates/.agents/hooks/lifecycle-delegation.js +15 -4
  216. package/templates/.agents/rules/README.en.md +1 -1
  217. package/templates/.agents/rules/README.zh-CN.md +1 -1
  218. package/templates/.agents/rules/create-issue.github.en.md +4 -2
  219. package/templates/.agents/rules/create-issue.github.zh-CN.md +4 -2
  220. package/templates/.agents/rules/human-decision-context.en.md +11 -2
  221. package/templates/.agents/rules/human-decision-context.zh-CN.md +11 -2
  222. package/templates/.agents/rules/issue-fields.github.en.md +3 -1
  223. package/templates/.agents/rules/issue-fields.github.zh-CN.md +3 -1
  224. package/templates/.agents/rules/issue-pr-commands.en.md +5 -3
  225. package/templates/.agents/rules/issue-pr-commands.github.en.md +5 -3
  226. package/templates/.agents/rules/issue-pr-commands.github.zh-CN.md +5 -3
  227. package/templates/.agents/rules/issue-pr-commands.zh-CN.md +5 -3
  228. package/templates/.agents/rules/issue-sync.github.en.md +7 -3
  229. package/templates/.agents/rules/issue-sync.github.zh-CN.md +8 -4
  230. package/templates/.agents/rules/lifecycle-orchestration.en.md +5 -2
  231. package/templates/.agents/rules/lifecycle-orchestration.zh-CN.md +5 -2
  232. package/templates/.agents/rules/milestone-inference.github.en.md +4 -2
  233. package/templates/.agents/rules/milestone-inference.github.zh-CN.md +4 -2
  234. package/templates/.agents/rules/next-step-output.en.md +3 -1
  235. package/templates/.agents/rules/next-step-output.zh-CN.md +3 -1
  236. package/templates/.agents/rules/no-mid-flow-questions.en.md +17 -0
  237. package/templates/.agents/rules/no-mid-flow-questions.zh-CN.md +17 -0
  238. package/templates/.agents/rules/pr-checks-commands.en.md +3 -3
  239. package/templates/.agents/rules/pr-checks-commands.github.en.md +2 -2
  240. package/templates/.agents/rules/pr-checks-commands.github.zh-CN.md +3 -3
  241. package/templates/.agents/rules/pr-checks-commands.zh-CN.md +3 -3
  242. package/templates/.agents/rules/pr-sync.en.md +3 -1
  243. package/templates/.agents/rules/pr-sync.github.en.md +11 -1
  244. package/templates/.agents/rules/pr-sync.github.zh-CN.md +11 -1
  245. package/templates/.agents/rules/pr-sync.zh-CN.md +3 -1
  246. package/templates/.agents/rules/release-commands.en.md +1 -1
  247. package/templates/.agents/rules/release-commands.github.en.md +12 -2
  248. package/templates/.agents/rules/release-commands.github.zh-CN.md +12 -2
  249. package/templates/.agents/rules/release-commands.zh-CN.md +1 -1
  250. package/templates/.agents/rules/review-handshake.zh-CN.md +1 -1
  251. package/templates/.agents/rules/task-management.en.md +13 -0
  252. package/templates/.agents/rules/task-management.zh-CN.md +13 -0
  253. package/templates/.agents/skills/analyze-task/SKILL.en.md +10 -7
  254. package/templates/.agents/skills/analyze-task/SKILL.zh-CN.md +10 -7
  255. package/templates/.agents/skills/block-task/SKILL.en.md +7 -5
  256. package/templates/.agents/skills/block-task/SKILL.zh-CN.md +7 -5
  257. package/templates/.agents/skills/cancel-task/SKILL.en.md +6 -4
  258. package/templates/.agents/skills/cancel-task/SKILL.zh-CN.md +6 -4
  259. package/templates/.agents/skills/close-codescan/SKILL.en.md +3 -1
  260. package/templates/.agents/skills/close-codescan/SKILL.zh-CN.md +3 -1
  261. package/templates/.agents/skills/close-dependabot/SKILL.en.md +3 -1
  262. package/templates/.agents/skills/close-dependabot/SKILL.zh-CN.md +3 -1
  263. package/templates/.agents/skills/code-task/SKILL.en.md +10 -7
  264. package/templates/.agents/skills/code-task/SKILL.zh-CN.md +12 -9
  265. package/templates/.agents/skills/commit/SKILL.en.md +23 -11
  266. package/templates/.agents/skills/commit/SKILL.zh-CN.md +29 -11
  267. package/templates/.agents/skills/commit/reference/commit-message.en.md +1 -1
  268. package/templates/.agents/skills/commit/reference/commit-message.zh-CN.md +1 -1
  269. package/templates/.agents/skills/commit/reference/commit-orchestration.en.md +49 -0
  270. package/templates/.agents/skills/commit/reference/commit-orchestration.zh-CN.md +55 -0
  271. package/templates/.agents/skills/commit/reference/issue-metadata-sync.en.md +1 -1
  272. package/templates/.agents/skills/commit/reference/issue-metadata-sync.zh-CN.md +1 -1
  273. package/templates/.agents/skills/commit/reference/pr-summary-sync.en.md +1 -1
  274. package/templates/.agents/skills/commit/reference/pr-summary-sync.zh-CN.md +1 -1
  275. package/templates/.agents/skills/commit/reference/task-status-update.en.md +4 -4
  276. package/templates/.agents/skills/commit/reference/task-status-update.zh-CN.md +4 -4
  277. package/templates/.agents/skills/complete-manual-validation/SKILL.en.md +6 -4
  278. package/templates/.agents/skills/complete-manual-validation/SKILL.zh-CN.md +6 -4
  279. package/templates/.agents/skills/complete-manual-validation/reference/summary-update.en.md +1 -1
  280. package/templates/.agents/skills/complete-manual-validation/reference/summary-update.zh-CN.md +1 -1
  281. package/templates/.agents/skills/complete-task/SKILL.en.md +22 -7
  282. package/templates/.agents/skills/complete-task/SKILL.zh-CN.md +22 -7
  283. package/templates/.agents/skills/complete-task/config/verify.en.json +1 -0
  284. package/templates/.agents/skills/complete-task/config/verify.zh-CN.json +1 -0
  285. package/templates/.agents/skills/complete-task/reference/external-delivery.en.md +17 -0
  286. package/templates/.agents/skills/complete-task/reference/external-delivery.zh-CN.md +17 -0
  287. package/templates/.agents/skills/create-pr/SKILL.en.md +7 -5
  288. package/templates/.agents/skills/create-pr/SKILL.zh-CN.md +7 -5
  289. package/templates/.agents/skills/create-pr/reference/comment-publish.en.md +1 -1
  290. package/templates/.agents/skills/create-pr/reference/comment-publish.zh-CN.md +1 -1
  291. package/templates/.agents/skills/create-release-note/SKILL.en.md +17 -16
  292. package/templates/.agents/skills/create-release-note/SKILL.zh-CN.md +17 -16
  293. package/templates/.agents/skills/create-task/SKILL.en.md +5 -3
  294. package/templates/.agents/skills/create-task/SKILL.zh-CN.md +5 -3
  295. package/templates/.agents/skills/create-task/reference/context-capture.en.md +34 -0
  296. package/templates/.agents/skills/create-task/reference/context-capture.zh-CN.md +34 -0
  297. package/templates/.agents/skills/import-issue/SKILL.en.md +5 -3
  298. package/templates/.agents/skills/import-issue/SKILL.zh-CN.md +5 -3
  299. package/templates/.agents/skills/plan-task/SKILL.en.md +8 -5
  300. package/templates/.agents/skills/plan-task/SKILL.zh-CN.md +8 -5
  301. package/templates/.agents/skills/post-release/SKILL.en.md +2 -0
  302. package/templates/.agents/skills/post-release/SKILL.zh-CN.md +2 -0
  303. package/templates/.agents/skills/release/SKILL.en.md +16 -10
  304. package/templates/.agents/skills/release/SKILL.zh-CN.md +16 -10
  305. package/templates/.agents/skills/restore-task/SKILL.en.md +4 -1
  306. package/templates/.agents/skills/restore-task/SKILL.zh-CN.md +4 -1
  307. package/templates/.agents/skills/review-analysis/SKILL.en.md +7 -4
  308. package/templates/.agents/skills/review-analysis/SKILL.zh-CN.md +7 -4
  309. package/templates/.agents/skills/review-code/SKILL.en.md +11 -8
  310. package/templates/.agents/skills/review-code/SKILL.zh-CN.md +11 -8
  311. package/templates/.agents/skills/review-code/reference/output-templates.en.md +1 -1
  312. package/templates/.agents/skills/review-code/reference/output-templates.zh-CN.md +1 -1
  313. package/templates/.agents/skills/review-plan/SKILL.en.md +7 -4
  314. package/templates/.agents/skills/review-plan/SKILL.zh-CN.md +7 -4
  315. package/templates/.agents/skills/review-pr/SKILL.en.md +186 -0
  316. package/templates/.agents/skills/review-pr/SKILL.zh-CN.md +186 -0
  317. package/templates/.agents/skills/review-pr/config/verify.en.json +37 -0
  318. package/templates/.agents/skills/review-pr/config/verify.zh-CN.json +37 -0
  319. package/templates/.agents/skills/review-pr/reference/evidence-grading.en.md +65 -0
  320. package/templates/.agents/skills/review-pr/reference/evidence-grading.zh-CN.md +65 -0
  321. package/templates/.agents/skills/review-pr/reference/output-guidance.en.md +18 -0
  322. package/templates/.agents/skills/review-pr/reference/output-guidance.zh-CN.md +18 -0
  323. package/templates/.agents/skills/review-pr/reference/report-template.en.md +85 -0
  324. package/templates/.agents/skills/review-pr/reference/report-template.zh-CN.md +85 -0
  325. package/templates/.agents/skills/run-task/SKILL.en.md +8 -8
  326. package/templates/.agents/skills/run-task/SKILL.zh-CN.md +8 -8
  327. package/templates/.agents/skills/run-task/config/verify.en.json +2 -1
  328. package/templates/.agents/skills/run-task/config/verify.zh-CN.json +2 -1
  329. package/templates/.agents/skills/run-task/reference/host-validation.en.md +20 -0
  330. package/templates/.agents/skills/run-task/reference/host-validation.zh-CN.md +20 -0
  331. package/templates/.agents/skills/update-agent-infra/scripts/sync-templates.js +98 -107
  332. package/templates/.agents/skills/watch-pr/SKILL.en.md +13 -13
  333. package/templates/.agents/skills/watch-pr/SKILL.zh-CN.md +13 -13
  334. package/templates/.agents/skills/watch-pr/reference/monitor-and-heal.en.md +27 -6
  335. package/templates/.agents/skills/watch-pr/reference/monitor-and-heal.zh-CN.md +26 -5
  336. package/templates/.agents/templates/task.en.md +2 -2
  337. package/templates/.agents/templates/task.zh-CN.md +2 -2
  338. package/templates/.agents/workflows/bug-fix.en.yaml +3 -3
  339. package/templates/.agents/workflows/bug-fix.zh-CN.yaml +3 -3
  340. package/templates/.agents/workflows/code-review.en.yaml +1 -1
  341. package/templates/.agents/workflows/code-review.zh-CN.yaml +1 -1
  342. package/templates/.agents/workflows/feature-development.en.yaml +4 -4
  343. package/templates/.agents/workflows/feature-development.zh-CN.yaml +4 -4
  344. package/templates/.agents/workflows/refactoring.en.yaml +3 -3
  345. package/templates/.agents/workflows/refactoring.zh-CN.yaml +3 -3
  346. package/templates/.claude/commands/post-release.en.md +1 -0
  347. package/templates/.claude/commands/post-release.zh-CN.md +1 -0
  348. package/templates/.claude/commands/review-pr.en.md +8 -0
  349. package/templates/.claude/commands/review-pr.zh-CN.md +8 -0
  350. package/templates/.claude/commands/watch-pr.en.md +1 -1
  351. package/templates/.claude/commands/watch-pr.zh-CN.md +1 -1
  352. package/templates/.claude/rules/tool-preferences.en.md +20 -0
  353. package/templates/.claude/rules/tool-preferences.zh-CN.md +20 -0
  354. package/templates/.opencode/commands/post-release.en.md +2 -0
  355. package/templates/.opencode/commands/post-release.zh-CN.md +2 -0
  356. package/templates/.opencode/commands/review-pr.en.md +11 -0
  357. package/templates/.opencode/commands/review-pr.zh-CN.md +11 -0
  358. package/templates/.opencode/commands/watch-pr.en.md +1 -1
  359. package/templates/.opencode/commands/watch-pr.zh-CN.md +1 -1
  360. package/dist/lib/agent-clients/adapters/gemini-cli.js +0 -64
  361. package/lib/agent-clients/adapters/gemini-cli.ts +0 -65
  362. package/templates/.gemini/commands/_project_/analyze-task.en.toml +0 -10
  363. package/templates/.gemini/commands/_project_/analyze-task.zh-CN.toml +0 -10
  364. package/templates/.gemini/commands/_project_/archive-tasks.en.toml +0 -10
  365. package/templates/.gemini/commands/_project_/archive-tasks.zh-CN.toml +0 -10
  366. package/templates/.gemini/commands/_project_/block-task.en.toml +0 -10
  367. package/templates/.gemini/commands/_project_/block-task.zh-CN.toml +0 -10
  368. package/templates/.gemini/commands/_project_/cancel-task.en.toml +0 -10
  369. package/templates/.gemini/commands/_project_/cancel-task.zh-CN.toml +0 -10
  370. package/templates/.gemini/commands/_project_/check-task.en.toml +0 -10
  371. package/templates/.gemini/commands/_project_/check-task.zh-CN.toml +0 -10
  372. package/templates/.gemini/commands/_project_/close-codescan.en.toml +0 -8
  373. package/templates/.gemini/commands/_project_/close-codescan.zh-CN.toml +0 -8
  374. package/templates/.gemini/commands/_project_/close-dependabot.en.toml +0 -8
  375. package/templates/.gemini/commands/_project_/close-dependabot.zh-CN.toml +0 -8
  376. package/templates/.gemini/commands/_project_/code-task.en.toml +0 -10
  377. package/templates/.gemini/commands/_project_/code-task.zh-CN.toml +0 -10
  378. package/templates/.gemini/commands/_project_/commit.en.toml +0 -10
  379. package/templates/.gemini/commands/_project_/commit.zh-CN.toml +0 -10
  380. package/templates/.gemini/commands/_project_/complete-manual-validation.en.toml +0 -10
  381. package/templates/.gemini/commands/_project_/complete-manual-validation.zh-CN.toml +0 -10
  382. package/templates/.gemini/commands/_project_/complete-task.en.toml +0 -10
  383. package/templates/.gemini/commands/_project_/complete-task.zh-CN.toml +0 -10
  384. package/templates/.gemini/commands/_project_/create-pr.en.toml +0 -10
  385. package/templates/.gemini/commands/_project_/create-pr.zh-CN.toml +0 -10
  386. package/templates/.gemini/commands/_project_/create-release-note.en.toml +0 -8
  387. package/templates/.gemini/commands/_project_/create-release-note.zh-CN.toml +0 -8
  388. package/templates/.gemini/commands/_project_/create-task.en.toml +0 -8
  389. package/templates/.gemini/commands/_project_/create-task.zh-CN.toml +0 -8
  390. package/templates/.gemini/commands/_project_/import-codescan.en.toml +0 -8
  391. package/templates/.gemini/commands/_project_/import-codescan.zh-CN.toml +0 -8
  392. package/templates/.gemini/commands/_project_/import-dependabot.en.toml +0 -8
  393. package/templates/.gemini/commands/_project_/import-dependabot.zh-CN.toml +0 -8
  394. package/templates/.gemini/commands/_project_/import-issue.en.toml +0 -8
  395. package/templates/.gemini/commands/_project_/import-issue.zh-CN.toml +0 -8
  396. package/templates/.gemini/commands/_project_/init-labels.en.toml +0 -8
  397. package/templates/.gemini/commands/_project_/init-labels.zh-CN.toml +0 -8
  398. package/templates/.gemini/commands/_project_/init-milestones.en.toml +0 -10
  399. package/templates/.gemini/commands/_project_/init-milestones.zh-CN.toml +0 -10
  400. package/templates/.gemini/commands/_project_/plan-task.en.toml +0 -10
  401. package/templates/.gemini/commands/_project_/plan-task.zh-CN.toml +0 -10
  402. package/templates/.gemini/commands/_project_/post-release.en.toml +0 -6
  403. package/templates/.gemini/commands/_project_/post-release.zh-CN.toml +0 -6
  404. package/templates/.gemini/commands/_project_/refine-title.en.toml +0 -8
  405. package/templates/.gemini/commands/_project_/refine-title.zh-CN.toml +0 -8
  406. package/templates/.gemini/commands/_project_/release.en.toml +0 -8
  407. package/templates/.gemini/commands/_project_/release.zh-CN.toml +0 -8
  408. package/templates/.gemini/commands/_project_/restore-task.en.toml +0 -8
  409. package/templates/.gemini/commands/_project_/restore-task.zh-CN.toml +0 -8
  410. package/templates/.gemini/commands/_project_/review-analysis.en.toml +0 -10
  411. package/templates/.gemini/commands/_project_/review-analysis.zh-CN.toml +0 -10
  412. package/templates/.gemini/commands/_project_/review-code.en.toml +0 -10
  413. package/templates/.gemini/commands/_project_/review-code.zh-CN.toml +0 -10
  414. package/templates/.gemini/commands/_project_/review-plan.en.toml +0 -10
  415. package/templates/.gemini/commands/_project_/review-plan.zh-CN.toml +0 -10
  416. package/templates/.gemini/commands/_project_/run-task.en.toml +0 -8
  417. package/templates/.gemini/commands/_project_/run-task.zh-CN.toml +0 -8
  418. package/templates/.gemini/commands/_project_/test-integration.en.toml +0 -6
  419. package/templates/.gemini/commands/_project_/test-integration.zh-CN.toml +0 -6
  420. package/templates/.gemini/commands/_project_/test.en.toml +0 -6
  421. package/templates/.gemini/commands/_project_/test.zh-CN.toml +0 -6
  422. package/templates/.gemini/commands/_project_/update-agent-infra.en.toml +0 -6
  423. package/templates/.gemini/commands/_project_/update-agent-infra.zh-CN.toml +0 -6
  424. package/templates/.gemini/commands/_project_/upgrade-dependency.en.toml +0 -8
  425. package/templates/.gemini/commands/_project_/upgrade-dependency.zh-CN.toml +0 -8
  426. package/templates/.gemini/commands/_project_/watch-pr.en.toml +0 -10
  427. package/templates/.gemini/commands/_project_/watch-pr.zh-CN.toml +0 -10
  428. package/templates/.gemini/settings.json +0 -3
@@ -40,7 +40,7 @@ const DEFAULTS = {
40
40
  "installInSandbox": true
41
41
  },
42
42
  {
43
- "id": "gemini-cli",
43
+ "id": "antigravity-cli",
44
44
  "enabled": true,
45
45
  "installInSandbox": true
46
46
  },
@@ -124,12 +124,19 @@ const AGENT_CLIENT_MANIFEST = [
124
124
  ],
125
125
  "managed": [
126
126
  ".claude/commands/",
127
- ".claude/agents/"
127
+ ".claude/agents/",
128
+ ".claude/rules/"
128
129
  ],
129
130
  "merged": [
130
131
  ".claude/settings.json"
131
132
  ],
132
- "ejected": []
133
+ "ejected": [],
134
+ "customCommand": {
135
+ "target": ".claude/commands/${skillName}.md",
136
+ "frontmatter": {},
137
+ "includeUsage": true,
138
+ "inheritDisableModelInvocation": true
139
+ }
133
140
  },
134
141
  {
135
142
  "id": "codex",
@@ -146,18 +153,12 @@ const AGENT_CLIENT_MANIFEST = [
146
153
  "ejected": []
147
154
  },
148
155
  {
149
- "id": "gemini-cli",
150
- "displayName": "Gemini CLI",
151
- "invocation": "/${projectName}:${skillName}",
152
- "ownedPathPrefixes": [
153
- ".gemini/"
154
- ],
155
- "managed": [
156
- ".gemini/commands/"
157
- ],
158
- "merged": [
159
- ".gemini/settings.json"
160
- ],
156
+ "id": "antigravity-cli",
157
+ "displayName": "Antigravity CLI",
158
+ "invocation": "/${skillName}",
159
+ "ownedPathPrefixes": [],
160
+ "managed": [],
161
+ "merged": [],
161
162
  "ejected": []
162
163
  },
163
164
  {
@@ -171,7 +172,15 @@ const AGENT_CLIENT_MANIFEST = [
171
172
  ".opencode/commands/"
172
173
  ],
173
174
  "merged": [],
174
- "ejected": []
175
+ "ejected": [],
176
+ "customCommand": {
177
+ "target": ".opencode/commands/${skillName}.md",
178
+ "frontmatter": {
179
+ "agent": "general",
180
+ "subtask": false
181
+ },
182
+ "argumentsToken": "$ARGUMENTS"
183
+ }
175
184
  }
176
185
  ];
177
186
  const CUSTOM_TUI_CONTRACT = {
@@ -276,10 +285,11 @@ function normalizeAgentClientConfig(cfg) {
276
285
  }
277
286
  const keys = Object.keys(candidate);
278
287
  if (
279
- keys.length !== 3
288
+ (keys.length !== 3 && keys.length !== 4)
280
289
  || !own(candidate, 'id')
281
290
  || !own(candidate, 'enabled')
282
291
  || !own(candidate, 'installInSandbox')
292
+ || (keys.length === 4 && !own(candidate, 'orchestration'))
283
293
  ) {
284
294
  return failure('INVALID_AGENT_CLIENTS', entryPath);
285
295
  }
@@ -290,9 +300,32 @@ function normalizeAgentClientConfig(cfg) {
290
300
  if (typeof candidate.enabled !== 'boolean' || typeof candidate.installInSandbox !== 'boolean') {
291
301
  return failure('INVALID_AGENT_CLIENTS', entryPath);
292
302
  }
303
+ let orchestration;
304
+ if (own(candidate, 'orchestration')) {
305
+ const policy = candidate.orchestration;
306
+ const exact = (value) => typeof value === 'string' && value.length > 0 && value.trim() === value;
307
+ const validRole = (role) => role
308
+ && typeof role === 'object'
309
+ && !Array.isArray(role)
310
+ && Object.keys(role).length === 2
311
+ && exact(role.model)
312
+ && exact(role.reasoningEffort);
313
+ if (
314
+ !policy
315
+ || typeof policy !== 'object'
316
+ || Array.isArray(policy)
317
+ || Object.keys(policy).length !== 2
318
+ || !validRole(policy.executor)
319
+ || !validRole(policy.reviewer)
320
+ ) {
321
+ return failure('INVALID_AGENT_CLIENTS', `${entryPath}.orchestration`);
322
+ }
323
+ orchestration = structuredClone(policy);
324
+ }
293
325
  entries.set(candidate.id, {
294
326
  enabled: candidate.enabled,
295
- installInSandbox: candidate.installInSandbox
327
+ installInSandbox: candidate.installInSandbox,
328
+ ...(orchestration ? { orchestration } : {})
296
329
  });
297
330
  }
298
331
  if (BUILTIN_TUI_IDS.some((id) => !entries.has(id))) {
@@ -547,16 +580,12 @@ function detectCustomSkills(projectRoot, templateSkillNames) {
547
580
  .sort((left, right) => left.dirName.localeCompare(right.dirName));
548
581
  }
549
582
 
550
- function isCustomProtected(targetPath, customSkills, project, customTUICommandTargets) {
583
+ function isCustomProtected(targetPath, customSkills, customCommandTargets) {
551
584
  const normalized = norm(targetPath);
552
585
 
553
586
  return customSkills.some(({ dirName }) => (
554
- normalized.startsWith(`.agents/skills/${dirName}/`) ||
555
- normalized === `.claude/commands/${dirName}.md` ||
556
- normalized === `.opencode/commands/${dirName}.md` ||
557
- normalized === '.gemini/commands/' + project + '/' + dirName + '.toml' ||
558
- customTUICommandTargets.has(normalized)
559
- ));
587
+ normalized.startsWith(`.agents/skills/${dirName}/`)
588
+ )) || customCommandTargets.has(normalized);
560
589
  }
561
590
 
562
591
  function recordCustomTUISkipped(report, entry) {
@@ -763,77 +792,37 @@ function formatYamlMetadata(key, value) {
763
792
  return [`${key}: |-`, ...value.split('\n').map((line) => ` ${line}`)];
764
793
  }
765
794
 
766
- function formatTomlMetadata(key, value) {
767
- if (!value.includes('\n')) {
768
- return `${key} = ${JSON.stringify(value)}`;
769
- }
770
-
771
- const lines = value.split('\n').map((line) => JSON.stringify(line).slice(1, -1));
772
- return `${key} = """${lines.join('\n')}"""`;
795
+ function formatYamlScalarMetadata(key, value) {
796
+ if (typeof value === 'boolean') return [`${key}: ${String(value)}`];
797
+ if (/^[A-Za-z0-9_-]+$/.test(value)) return [`${key}: ${value}`];
798
+ return formatYamlMetadata(key, value);
773
799
  }
774
800
 
775
- function generateClaudeCommand(skill, lang) {
801
+ function generateAgentClientCommand(skill, lang, descriptor) {
776
802
  const isZhCN = lang === 'zh-CN';
777
- const lines = ['---', ...formatYamlMetadata('description', skill.description)];
803
+ const lines = [
804
+ '---',
805
+ ...formatYamlMetadata('description', skill.description),
806
+ ...Object.entries(descriptor.frontmatter).flatMap(([key, value]) =>
807
+ formatYamlScalarMetadata(key, value)
808
+ )
809
+ ];
778
810
 
779
- if (skill.args) {
780
- lines.push(`usage: ${JSON.stringify(`/${skill.dirName} ${skill.args}`)}`);
811
+ if (descriptor.includeUsage && skill.args) {
812
+ lines.push(`usage: ${JSON.stringify(`${descriptor.invocation} ${skill.args}`)}`);
781
813
  }
782
-
783
- if (skill.disableModelInvocation) {
814
+ if (descriptor.inheritDisableModelInvocation && skill.disableModelInvocation) {
784
815
  lines.push('disable-model-invocation: true');
785
816
  }
786
817
 
787
818
  lines.push('---', '');
788
- lines.push(
789
- isZhCN
790
- ? `读取并执行 \`.agents/skills/${skill.dirName}/SKILL.md\` 中的 ${skill.dirName} 技能。`
791
- : `Read and execute the ${skill.dirName} skill from \`.agents/skills/${skill.dirName}/SKILL.md\`.`
792
- );
793
- lines.push('');
794
- lines.push(isZhCN ? '严格按照技能中定义的所有步骤执行。' : 'Follow all steps defined in the skill exactly.');
795
-
796
- return `${lines.join('\n')}\n`;
797
- }
798
819
 
799
- function generateGeminiCommand(skill, lang) {
800
- const isZhCN = lang === 'zh-CN';
801
- const promptLines = [];
802
-
803
- if (skill.args) {
804
- promptLines.push(isZhCN ? '参数:{{args}}' : 'Arguments: {{args}}');
805
- promptLines.push('');
806
- }
807
-
808
- promptLines.push(
809
- isZhCN
810
- ? `读取并执行 \`.agents/skills/${skill.dirName}/SKILL.md\` 中的 ${skill.dirName} 技能。`
811
- : `Read and execute the ${skill.dirName} skill from \`.agents/skills/${skill.dirName}/SKILL.md\`.`
812
- );
813
- promptLines.push('');
814
- promptLines.push(isZhCN ? '严格按照技能中定义的所有步骤执行。' : 'Follow all steps defined in the skill exactly.');
815
-
816
- return [
817
- formatTomlMetadata('description', skill.description),
818
- 'prompt = """',
819
- ...promptLines,
820
- '"""'
821
- ].join('\n') + '\n';
822
- }
823
-
824
- function generateOpenCodeCommand(skill, lang) {
825
- const isZhCN = lang === 'zh-CN';
826
- const lines = [
827
- '---',
828
- ...formatYamlMetadata('description', skill.description),
829
- 'agent: general',
830
- 'subtask: false',
831
- '---',
832
- ''
833
- ];
834
-
835
- if (skill.args) {
836
- lines.push(isZhCN ? '参数:$ARGUMENTS' : 'Arguments: $ARGUMENTS');
820
+ if (skill.args && descriptor.argumentsToken) {
821
+ lines.push(
822
+ isZhCN
823
+ ? `参数:${descriptor.argumentsToken}`
824
+ : `Arguments: ${descriptor.argumentsToken}`
825
+ );
837
826
  lines.push('');
838
827
  }
839
828
 
@@ -1046,6 +1035,15 @@ function buildCustomTUICommandTargets(projectRoot, customSkills, customTUIs, tem
1046
1035
  return targets;
1047
1036
  }
1048
1037
 
1038
+ function buildBuiltinCustomCommandTargets(customSkills, enabledTUIs) {
1039
+ return new Set(AGENT_CLIENT_MANIFEST.flatMap((adapter) => {
1040
+ if (!enabledTUIs.has(adapter.id) || !adapter.customCommand) return [];
1041
+ return customSkills.map((skill) =>
1042
+ adapter.customCommand.target.replaceAll('${skillName}', skill.dirName)
1043
+ );
1044
+ }));
1045
+ }
1046
+
1049
1047
  function learnAndGenerateCommands(projectRoot, customSkills, tool, templateSkillNames, report) {
1050
1048
  const ref = findCustomTUIReference(projectRoot, tool, templateSkillNames, report, true);
1051
1049
  if (!ref) return;
@@ -1069,7 +1067,6 @@ function learnAndGenerateCommands(projectRoot, customSkills, tool, templateSkill
1069
1067
  function generateCustomCommands(
1070
1068
  projectRoot,
1071
1069
  customSkills,
1072
- project,
1073
1070
  lang,
1074
1071
  report,
1075
1072
  customTUIs,
@@ -1078,24 +1075,15 @@ function generateCustomCommands(
1078
1075
  managedWriter
1079
1076
  ) {
1080
1077
  for (const skill of customSkills) {
1081
- if (enabledTUIs.has('claude-code')) {
1082
- managedWriter(
1083
- `.claude/commands/${skill.dirName}.md`,
1084
- generateClaudeCommand(skill, lang),
1085
- report.custom.commands
1086
- );
1087
- }
1088
- if (enabledTUIs.has('gemini-cli')) {
1089
- managedWriter(
1090
- '.gemini/commands/' + project + '/' + skill.dirName + '.toml',
1091
- generateGeminiCommand(skill, lang),
1092
- report.custom.commands
1093
- );
1094
- }
1095
- if (enabledTUIs.has('opencode')) {
1078
+ for (const adapter of AGENT_CLIENT_MANIFEST) {
1079
+ if (!enabledTUIs.has(adapter.id) || !adapter.customCommand) continue;
1080
+ const descriptor = {
1081
+ ...adapter.customCommand,
1082
+ invocation: adapter.invocation.replaceAll('${skillName}', skill.dirName)
1083
+ };
1096
1084
  managedWriter(
1097
- `.opencode/commands/${skill.dirName}.md`,
1098
- generateOpenCodeCommand(skill, lang),
1085
+ adapter.customCommand.target.replaceAll('${skillName}', skill.dirName),
1086
+ generateAgentClientCommand(skill, lang, descriptor),
1099
1087
  report.custom.commands
1100
1088
  );
1101
1089
  }
@@ -1358,6 +1346,10 @@ function syncTemplates(projectRoot, templateRootOverride) {
1358
1346
  customTUIs,
1359
1347
  templateSkillNames
1360
1348
  );
1349
+ const customCommandTargets = new Set([
1350
+ ...buildBuiltinCustomCommandTargets(protectedCustomSkills, enabledTUIs),
1351
+ ...customTUICommandTargets
1352
+ ]);
1361
1353
 
1362
1354
  for (const category of ['managed', 'merged', 'ejected']) {
1363
1355
  const before = currentRegistry[category];
@@ -1570,7 +1562,7 @@ function syncTemplates(projectRoot, templateRootOverride) {
1570
1562
  const protectedByEjection = ejected.some((pattern) =>
1571
1563
  assetMatches(pattern, target) || globMatch(pattern, target)
1572
1564
  );
1573
- const protectedByCustom = customTUICommandTargets.has(target);
1565
+ const protectedByCustom = customCommandTargets.has(target);
1574
1566
 
1575
1567
  if (protectedByEjection || protectedByCustom || (sourceRoot && sourceRoot !== templateRoot)) {
1576
1568
  report.managed.protected.push({
@@ -1699,7 +1691,7 @@ function syncTemplates(projectRoot, templateRootOverride) {
1699
1691
  for (const projFile of projFiles) {
1700
1692
  if (expectedTargets.has(projFile)) continue;
1701
1693
  if (projFile === configPathRel) continue;
1702
- if (isCustomProtected(projFile, protectedCustomSkills, project, customTUICommandTargets)) continue;
1694
+ if (isCustomProtected(projFile, protectedCustomSkills, customCommandTargets)) continue;
1703
1695
  if (matchesAny(projFile, merged) || matchesAny(projFile, ejected)) continue;
1704
1696
  if (assetPlan.enabledManaged.includes(entry)) {
1705
1697
  const baseline = trustedBaseline(managedBaselines[projFile]);
@@ -1741,7 +1733,6 @@ function syncTemplates(projectRoot, templateRootOverride) {
1741
1733
  generateCustomCommands(
1742
1734
  projectRoot,
1743
1735
  customSkills,
1744
- project,
1745
1736
  lang,
1746
1737
  report,
1747
1738
  customTUIs,
@@ -1,17 +1,17 @@
1
1
  ---
2
2
  name: watch-pr
3
3
  description: >
4
- Watch a PR's required checks and self-heal on failure.
5
- Use when you need to monitor a PR's required checks and auto-recover on failure.
4
+ Watch PR readiness and self-heal any check failure or merge conflict.
5
+ Use when a PR must be monitored until checks pass and it is explicitly mergeable.
6
6
  ---
7
7
 
8
8
  # Watch Pull Request
9
9
 
10
- After `create-pr`, continuously watch the PR's required CI checks: when everything is green, guide toward merge; when a required check fails, pull the logs, fix and push locally, then re-poll; when the fix attempt limit is reached or the failure is non-code / unlocatable, stop and ask the user for help. Platform-specific commands live in `.agents/rules/pr-checks-commands.md`; this skill body stays platform-agnostic.
10
+ After `create-pr`, continuously watch all checks and mergeability for the same PR head. Only all passed checks plus explicit mergeability may reach success; check failures use the existing repair path, conflicts use constrained rebase healing, and unknown or unsafe states fail closed.
11
11
 
12
12
  ## Behavior Boundaries / Key Rules
13
13
 
14
- - Only watch + self-heal the current PR's required checks; make no changes unrelated to the failing check.
14
+ - Only self-heal the current PR's full check set and text merge conflicts; do not add approval or repository-rule readiness dimensions.
15
15
  - Self-heal publishes through Git workflow intents, but **affected tests must pass first**; the attempt cap and code-layer authorization remain unchanged.
16
16
  - The help exit is "produce-then-stop": end this round, output the blocker explanation, and wait for the user to trigger the next step — **never** ask mid-flow.
17
17
  - Bare numbers / `NN` / `TASK-id` arguments are always resolved as task short ids (see `.agents/rules/task-short-id.md`); a PR number is passed only via `--pr <number>` / a PR URL / omission (current branch), never reusing the bare-number syntax.
@@ -44,21 +44,21 @@ Resolve the target PR number `{pr#}` and an optional `{task-id}` via these deter
44
44
  - Scenario C (`--pr <number>` or a PR URL): use that PR number directly as `{pr#}`; then determine `{task-id}` via "Reverse-lookup task".
45
45
  - Reverse-lookup task (scenarios A / C): use task context/query capabilities to find the unique active task bound to `{pr#}`. If none exists, stop and request binding first; the typed checks intent does not create a second taskless state machine.
46
46
 
47
- ### 2. Watch Required Checks
47
+ ### 2. Watch PR Readiness
48
48
 
49
49
  Before running this step, read `reference/monitor-and-heal.md` and `.agents/rules/pr-checks-commands.md`.
50
50
 
51
- Initialize the in-memory list `repairCommits=[]` for this run. Run `agent-infra-internal platform-checks watch {task-id} --interval-seconds 30 --deadline-seconds 1800`, then route its structured `checks.state` to the all-green, failure, or pending path.
51
+ Initialize `repairCommits=[]` and `rebaseAttempts=0`. Run `agent-infra-internal platform-checks watch {task-id} --interval-seconds 30 --deadline-seconds 1800`, then route only by `readiness.state`: `ready` to step 7, `conflicting|checks-failed` to step 3, and `pending|timed-out|cancelled` to step 4.
52
52
 
53
- ### 3. Failure Self-Heal Loop
53
+ ### 3. Self-Heal Loop
54
54
 
55
55
  Before running this step, read the "Self-Heal Decision Tree" of `reference/monitor-and-heal.md` and "Resolve a Failing Run id and Pull Logs" of `.agents/rules/pr-checks-commands.md`.
56
56
 
57
- For a locatable code-layer failure, make the minimum fix and run relevant tests. Then call `git-workflow commit` and `git-workflow push`; append only a remotely verified SHA to `repairCommits`.
57
+ For `checks-failed`, minimally fix a locatable code-layer failure, test, and publish through the existing commit/push intents. For `conflicting`, follow the reference's same-repository, clean-tree, head/base identity, rebase, full-test, and `git-workflow push-rebased` exact-lease flow, capped at two attempts. Append only remotely verified SHAs, then watch the new head again; any failed safety check goes to step 4.
58
58
 
59
59
  ### 4. Help Exit (Produce-Then-Stop)
60
60
 
61
- When self-heal hits the cap, the failure is non-code, the run id is unlocatable, or step 2 times out while pending, stop this round and summarize for the user: the blocker, the fixes attempted (including each fix commit), and the relevant failing job and run/log links (report shape in the "Help report template" of `reference/monitor-and-heal.md`). Do **not** render a next-step command; wait for the user. Then, on the task-anchored path, run steps 5/6 to record this round's outcome.
61
+ When healing hits a cap, a check failure is non-code/unlocatable, readiness stays unknown, or rebase, tests, remote identity, or exact lease cannot close safely, stop and report the PR head/base, conflict paths, remote facts, tests, and attempts using the reference template. Do **not** render a next-step command. Then run steps 5/6 on the task-anchored path.
62
62
 
63
63
  ### 5. Update Task State
64
64
 
@@ -77,7 +77,7 @@ Update `.agents/workspace/active/{task-id}/task.md`:
77
77
  - **Do not change** `pr_status` (keep `created`) or `current_step`
78
78
  - **Append** to `## Activity Log` (do not overwrite prior entries; `{N}` = number of existing Watch PR entries for this task + 1):
79
79
  ```
80
- - {YYYY-MM-DD HH:mm:ss±HH:MM} — **Watch PR (Round {N})** by {agent} — {green: all required checks green, repair commits: {k} [{SHA summary}] / blocked: blocked: {summary}}
80
+ - {YYYY-MM-DD HH:mm:ss±HH:MM} — **Watch PR (Round {N})** by {agent} — {success: PR ready, repair commits: {k} [{SHA summary}] / blocked: blocked: {summary}}
81
81
  ```
82
82
 
83
83
  ### 6. Verification Gate
@@ -104,7 +104,7 @@ Keep the gate output in your reply as the verification evidence. Without current
104
104
  > 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}`.
105
105
 
106
106
  Output per scenario:
107
- - "All green" + task-anchored: state that all required checks passed, then render exactly one exit based on whether this run created repair commits (`{task-ref}` becomes the short id):
107
+ - `ready` + task-anchored: state that all checks passed and the current head is explicitly mergeable, then render exactly one exit based on whether this run created repair commits (`{task-ref}` becomes the short id):
108
108
 
109
109
  `repairCommits.length == 0`:
110
110
 
@@ -129,8 +129,8 @@ Populate `{next-step-commands}` for this scenario by running `agent-infra-intern
129
129
  ## Completion Checklist
130
130
 
131
131
  - [ ] Resolved the target PR (and any task context)
132
- - [ ] Completed required-checks watching with an all-green / blocked conclusion
133
- - [ ] Self-heal limited to locatable code-layer failures, with local tests passing before push and within the fix cap
132
+ - [ ] Completed readiness watching; success requires passed checks and explicit mergeability
133
+ - [ ] Check/rebase healing passed local tests and its safety intent within the attempt cap
134
134
  - [ ] Task-anchored path: updated task.md and appended the Watch PR Activity Log entry
135
135
  - [ ] Task-anchored path: verification gate passed
136
136
  - [ ] Rendered the selected next-step commands through the shared helper
@@ -1,17 +1,17 @@
1
1
  ---
2
2
  name: watch-pr
3
3
  description: >
4
- 监控 PR 的 required checks 并在失败时自愈。
5
- 当需要监控 PR 的 required checks 并在失败时自愈时使用。
4
+ 监控 PR readiness,并在任一 check 失败或合并冲突时自愈。
5
+ 当需要持续监控 PR 直到门禁通过且明确可合入时使用。
6
6
  ---
7
7
 
8
8
  # 监控 Pull Request
9
9
 
10
- 在 `create-pr` 之后持续监控 PR 的 required CI checks:全绿则引导合入,required check 失败则自动拉日志、本地修复并推送、重新轮询;达修复上限或属非代码层/不可定位失败则停止并向用户求助。平台专属命令集中在 `.agents/rules/pr-checks-commands.md`,本技能正文保持平台无关。
10
+ 在 `create-pr` 之后持续监控同一 PR head 的全部 checks 与 mergeability。只有全部 checks 通过且平台明确可合入才进入成功出口;check 失败走既有修复,合并冲突走受限 rebase 自愈,未知或无法安全闭环时 fail-closed。
11
11
 
12
12
  ## 行为边界 / 关键规则
13
13
 
14
- - 仅监控 + 自愈当前 PR 的 required checks;不做与失败 check 无关的改动。
14
+ - 仅监控 + 自愈当前 PR 的全部 checks 与文本合并冲突;不扩展到审批或其他仓库规则。
15
15
  - 自愈通过 Git workflow intent 发布修复,但**发布前必须本地跑通相关测试**;修复上限与代码层分类授权不变。
16
16
  - 求助出口是「产出后停止」语义:停止本轮、输出阻塞说明、等待用户主动触发,**不**中途提问。
17
17
  - 裸数字 / `NN` / `TASK-id` 入参一律按任务短号解析(见 `.agents/rules/task-short-id.md`);PR 号只走 `--pr <number>` / PR URL / 省略(当前分支),不复用裸数字语法。
@@ -44,21 +44,21 @@ description: >
44
44
  - 场景 C(`--pr <number>` 或 PR URL):直接取该 PR 号为 `{pr#}`;随后按「反查任务」确定 `{task-id}`。
45
45
  - 反查任务(场景 A / C):通过任务上下文/任务查询取得与 `{pr#}` 唯一绑定的 active task。未命中时停止并提示先绑定 PR;typed checks intent 不建立第二套无任务状态机。
46
46
 
47
- ### 2. 监控 required checks
47
+ ### 2. 监控 PR readiness
48
48
 
49
49
  执行此步骤前,先读取 `reference/monitor-and-heal.md` 与 `.agents/rules/pr-checks-commands.md`。
50
50
 
51
- 进入本轮时初始化内存列表 `repairCommits=[]`。调用 `agent-infra-internal platform-checks watch {task-id} --interval-seconds 30 --deadline-seconds 1800`,按结构化 `checks.state` 分为「全绿」/「失败」/「挂起」,分别进入步骤 7、步骤 3 或步骤 4。
51
+ 进入本轮时初始化 `repairCommits=[]` 与 `rebaseAttempts=0`。调用 `agent-infra-internal platform-checks watch {task-id} --interval-seconds 30 --deadline-seconds 1800`,只按结构化 `readiness.state` 分流:`ready` 进入步骤 7,`conflicting` 或 `checks-failed` 进入步骤 3,`pending|timed-out|cancelled` 进入步骤 4。
52
52
 
53
- ### 3. 失败自愈循环
53
+ ### 3. 自愈循环
54
54
 
55
55
  执行此步骤前,先读取 `reference/monitor-and-heal.md` 的「自愈决策树」与 `.agents/rules/pr-checks-commands.md` 的「解析失败 run id 并拉日志」。
56
56
 
57
- 只对可定位代码层失败最小修复并测试;通过后依次调用 `git-workflow commit` 与 `git-workflow push`,仅记录远端复核成功的 SHA。达硬上限或 run 不可定位时转步骤 4。
57
+ `checks-failed` 只对可定位代码层失败做最小修复和测试,再用既有 commit/push intent 发布。`conflicting` 严格执行 reference 的同仓库、干净工作树、head/base 身份、rebase、完整测试与 `git-workflow push-rebased` 精确 lease 流程;上限 2 次。仅记录远端复核成功的 SHA,随后重新监控新 head;任一安全检查失败转步骤 4。
58
58
 
59
59
  ### 4. 求助出口(产出后停止)
60
60
 
61
- 当自愈达上限、失败属非代码层、run id 不可定位、或步骤 2 挂起超时时,停止本轮并向用户汇总:阻塞原因、已尝试的修复(含每次修复 commit)、相关失败 job 与 run/log 链接(报告结构见 `reference/monitor-and-heal.md` 的「求助报告模板」)。**不**渲染下一步命令,等待用户裁定。随后在任务锚定路径下执行步骤 5/6 记录本轮结果。
61
+ 当自愈达上限、失败属非代码层、run id 不可定位、readiness 未知/超时,或 rebase、测试、远端身份、精确 lease 任一无法闭环时,停止本轮并按 reference 汇总 PR head/base、冲突文件、远端事实、测试与尝试记录。**不**渲染下一步命令。随后在任务锚定路径下执行步骤 5/6。
62
62
 
63
63
  ### 5. 更新任务状态
64
64
 
@@ -77,7 +77,7 @@ date "+%Y-%m-%d %H:%M:%S%z" | sed 's/\([+-][0-9][0-9]\)\([0-9][0-9]\)$/\1:\2/'
77
77
  - **不改** `pr_status`(保持 `created`)与 `current_step`
78
78
  - **追加**到 `## 活动日志`(不要覆盖之前的记录;`{N}` = 本任务已有 Watch PR 条目数 + 1):
79
79
  ```
80
- - {YYYY-MM-DD HH:mm:ss±HH:MM} — **Watch PR (Round {N})** by {agent} — {全绿:all required checks green, repair commits: {k} [{sha 摘要}] / 阻塞:blocked: {简述}}
80
+ - {YYYY-MM-DD HH:mm:ss±HH:MM} — **Watch PR (Round {N})** by {agent} — {成功:PR ready, repair commits: {k} [{sha 摘要}] / 阻塞:blocked: {简述}}
81
81
  ```
82
82
 
83
83
  ### 6. 完成校验
@@ -104,7 +104,7 @@ agent-infra-internal task-verify {task-id} watch-pr.completed --format text
104
104
  > 渲染下一步前先读取 `.agents/rules/next-step-output.md`,仅为已选场景调用统一 helper,并将 stdout 填入 `{next-step-commands}`。
105
105
 
106
106
  按场景输出:
107
- - 「全绿」+ 任务锚定:说明所有 required checks 已通过,并只按本轮是否产生修复 commit 渲染一个出口(`{task-ref}` 替换为短号):
107
+ - `ready` + 任务锚定:说明全部 checks 已通过且当前 head 明确可合入,并只按本轮是否产生修复 commit 渲染一个出口(`{task-ref}` 替换为短号):
108
108
 
109
109
  `repairCommits.length == 0`:
110
110
 
@@ -129,8 +129,8 @@ agent-infra-internal task-verify {task-id} watch-pr.completed --format text
129
129
  ## 完成检查清单
130
130
 
131
131
  - [ ] 解析出目标 PR(及可能的任务上下文)
132
- - [ ] 完成 required checks 监控,得到全绿 / 阻塞结论
133
- - [ ] 自愈仅限可定位的代码层失败,且推送前本地测试通过、未超修复上限
132
+ - [ ] 完成 readiness 监控,只有 checks 通过且明确可合入才得到成功结论
133
+ - [ ] check / rebase 自愈均通过本地测试和对应安全 intent,且未超修复上限
134
134
  - [ ] 任务锚定路径:更新了 task.md 并追加 Watch PR 的 Activity Log
135
135
  - [ ] 任务锚定路径:完成校验通过
136
136
  - [ ] 已通过统一 helper 渲染已选场景的下一步命令
@@ -2,13 +2,14 @@
2
2
 
3
3
  Platform-agnostic decision logic for `watch-pr` steps 2/3/4. The concrete platform commands (watch, resolve a failing run, pull logs, read the PR number) live in `.agents/rules/pr-checks-commands.md`; this file only describes platform-independent classification and decisions.
4
4
 
5
- ## Outcome Classification
5
+ ## Readiness Classification
6
6
 
7
- After running the watch command from `.agents/rules/pr-checks-commands.md`, classify by its exit code into three buckets:
7
+ After the watch command, route by structured `readiness.state`:
8
8
 
9
- - All required checks passed → "all green" (SKILL step 7 green exit).
10
- - At least one failed / errored → "failure" (SKILL step 3 self-heal).
11
- - Still pending or the overall time cap was reached → "pending" (SKILL step 4 help exit).
9
+ - `ready`: all checks passed and the same head is explicitly mergeable → SKILL step 7.
10
+ - `checks-failed`: a check failed or was cancelled → CI healing in SKILL step 3.
11
+ - `conflicting`: the platform explicitly reports a head/base conflict → rebase healing in SKILL step 3.
12
+ - `pending|timed-out|cancelled`: no reliable success fact exists → SKILL step 4.
12
13
 
13
14
  ## Self-Heal Decision Tree
14
15
 
@@ -34,6 +35,23 @@ For each failing check, decide "self-heal" vs "ask for help" in this order:
34
35
  - Append the fix commit SHA to this run's `repairCommits`, increment the fix count, and return to SKILL step 2. When checks turn green, an empty list routes to `complete-task`; a non-empty list routes to `review-code`.
35
36
  - Never make unrelated "drive-by" optimizations; never loosen / skip the failing assertion to "make it green".
36
37
 
38
+ ## Merge-Conflict Healing
39
+
40
+ ```text
41
+ # conflict-heal-contract
42
+ strategy: rebase
43
+ remote-update: exact-lease
44
+ unsafe: help
45
+ ```
46
+
47
+ 1. Continue only when the PR, head, and base repositories match; the current branch equals the head ref; local HEAD equals the snapshot head SHA; and the worktree/index are clean.
48
+ 2. Select a remote that exactly matches the PR repository, fetch the base ref, record the full `expectedBaseHead`, and confirm the remote head still equals the full old SHA.
49
+ 3. Run `git rebase <expectedBaseHead>`. Handle only Git-reported text unmerged paths. If resolution is unsafe, run `git rebase --abort`, record paths and both SHAs, and use help.
50
+ 4. After rebase, run the project `test` skill's full validation. Never push a failing result.
51
+ 5. Write remote, branch, full `expectedOldHead`, `newHead`, baseBranch, and full `expectedBaseHead` to a temporary intent outside the repository; call `agent-infra-internal git-workflow push-rebased --input {intent.json}`.
52
+ 6. Core verifies clean state, branch/HEAD, remote head/base, ancestry, exact `--force-with-lease`, and the post-push SHA. Never fall back to generic force; refresh the PR snapshot or use help.
53
+ 7. On success, append the new SHA to `repairCommits`, increment `rebaseAttempts`, and watch the new head. Cap at two attempts; a final ready state with repairs routes only to `review-code`.
54
+
37
55
  ## Help Report Template
38
56
 
39
57
  When entering the help exit, output the following fixed structure to the user (not written to any artifact file):
@@ -41,7 +59,10 @@ When entering the help exit, output the following fixed structure to the user (n
41
59
  ```
42
60
  PR #{pr#} monitoring is blocked; manual intervention needed.
43
61
 
44
- Blocker: {non-code layer / fix cap reached / run unlocatable / poll timeout}
62
+ Blocker: {non-code layer / cap reached / run unlocatable / readiness unknown / unsafe rebase or update}
63
+ PR head/base: {repository/ref/SHA}
64
+ Conflict and remote facts: {paths / expected and actual head/base / rebase abort state}
65
+ Validation: {command and failure summary, or why it did not run}
45
66
  Failing check: {name} (workflow: {workflow})
46
67
  Failing run / logs: {run/job link}
47
68
  Fixes attempted ({k} total):
@@ -2,13 +2,14 @@
2
2
 
3
3
  `watch-pr` 步骤 2/3/4 的平台无关判定逻辑。具体平台命令(监控、解析失败 run、拉日志、读取 PR 号)见 `.agents/rules/pr-checks-commands.md`;本文件只描述与平台无关的分类与决策。
4
4
 
5
- ## 结果分类
5
+ ## Readiness 分类
6
6
 
7
7
  按 `.agents/rules/pr-checks-commands.md` 的监控命令执行后,依其退出码归为三类:
8
8
 
9
- - 全部 required checks 通过 → 「全绿」(SKILL 步骤 7 全绿出口)。
10
- - 至少一个失败 / 出错 → 「失败」(SKILL 步骤 3 自愈)。
11
- - 仍有 pending 或达到总时长上限 → 「挂起」(SKILL 步骤 4 求助)。
9
+ - `ready`:同一 head 的全部 checks 通过且平台明确可合入 → SKILL 步骤 7。
10
+ - `checks-failed`:至少一个 check 失败或取消 → SKILL 步骤 3 的 CI 自愈。
11
+ - `conflicting`:平台明确当前 head 与 base 冲突 → SKILL 步骤 3 的 rebase 自愈。
12
+ - `pending|timed-out|cancelled`:mergeability/checks 未形成可靠成功事实 → SKILL 步骤 4。
12
13
 
13
14
  ## 自愈决策树
14
15
 
@@ -34,6 +35,23 @@ unknown: help
34
35
  - 将本次修复的 commit SHA 追加到当前运行的 `repairCommits`,修复计数 +1,回到 SKILL 步骤 2 重新监控;全绿时列表为空走 `complete-task`,非空走 `review-code`。
35
36
  - 绝不执行与失败无关的「顺手优化」;不放宽 / 跳过失败的断言来「修绿」。
36
37
 
38
+ ## 合并冲突自愈
39
+
40
+ ```text
41
+ # conflict-heal-contract
42
+ strategy: rebase
43
+ remote-update: exact-lease
44
+ unsafe: help
45
+ ```
46
+
47
+ 1. 仅当 PR、head 与 base repository 完全相同,当前分支等于 head ref,本地 HEAD 等于快照 head SHA,且工作树/暂存区干净时继续;否则求助。
48
+ 2. 找到与 PR repository 精确匹配的 remote,抓取 base ref,记录完整 `expectedBaseHead`,并确认远端 head 仍等于完整旧 SHA。
49
+ 3. 执行 `git rebase <expectedBaseHead>`。只处理 Git 报告的文本 unmerged paths;无法可靠解决时 `git rebase --abort`,记录冲突路径和双方 SHA 后求助。
50
+ 4. rebase 完成后运行项目 `test` skill 的完整验证。失败时不推送。
51
+ 5. 把 remote、branch、完整 `expectedOldHead`、`newHead`、baseBranch 和完整 `expectedBaseHead` 写入仓库外的临时 intent JSON,调用 `agent-infra-internal git-workflow push-rebased --input {intent.json}`。
52
+ 6. core 会复核干净状态、分支/HEAD、远端 head/base、ancestor、精确 `--force-with-lease` 与推送后远端 SHA。任一失败不得改用普通 force;重新取 PR 快照或求助。
53
+ 7. 推送成功后把新 SHA 加入 `repairCommits`,`rebaseAttempts += 1`,重新监控新 head。上限 2 次;最终 ready 且列表非空时只进入 `review-code` 出口。
54
+
37
55
  ## 求助报告模板
38
56
 
39
57
  进入求助出口时,向用户输出以下固定结构(不写入产物文件):
@@ -41,7 +59,10 @@ unknown: help
41
59
  ```
42
60
  PR #{pr#} 监控阻塞,需人工介入。
43
61
 
44
- 阻塞原因:{非代码层 / 达修复上限 / run 不可定位 / 轮询超时}
62
+ 阻塞原因:{非代码层 / 达修复上限 / run 不可定位 / readiness 未知 / rebase 或安全更新失败}
63
+ PR head/base:{repository/ref/SHA}
64
+ 冲突与远端事实:{conflict paths / expected 与 actual head/base / rebase abort 状态}
65
+ 验证:{命令与失败摘要;未运行则说明原因}
45
66
  失败 check:{name}(workflow:{workflow})
46
67
  失败 run / 日志:{run/job 链接}
47
68
  已尝试的修复(共 {k} 次):
@@ -12,7 +12,7 @@ effort: # Optional Issue field: High | Medium | Low
12
12
  start_date: # Optional Issue field for Feature: YYYY-MM-DD
13
13
  target_date: # Optional Issue field for Feature: YYYY-MM-DD
14
14
  current_step: requirement-analysis # requirement-analysis | requirement-analysis-review | technical-design | technical-design-review | code | code-review | completed
15
- assigned_to: # claude | codex | gemini | opencode | human
15
+ assigned_to: # claude | codex | antigravity | opencode | human
16
16
  pr_status: pending # PR status: pending (default) | created (PR created) | skipped (explicitly skipped)
17
17
  ---
18
18
 
@@ -80,7 +80,7 @@ pr_status: pending # PR status: pending (default) | created (PR crea
80
80
 
81
81
  ## Human Rulings
82
82
 
83
- <!-- Use ai decide <task-ref> <ordinal|ledger-id> [--needs-implementation true|false] <decision> for needs-human-decision rulings; code-stage rulings must explicitly declare whether implementation is required. -->
83
+ <!-- Use ai decide <task-ref> <ordinal|ledger-id> [--needs-implementation true|false] <decision> for needs-human-decision rulings; upstream AI predeclares implementation intent for new code decisions, while the explicit option remains for legacy tasks or consistency checks. -->
84
84
 
85
85
  ## Implementation Inputs
86
86
 
@@ -12,7 +12,7 @@ effort: # 可选 Issue 字段:High | Medium | Low
12
12
  start_date: # Feature 可选 Issue 字段:YYYY-MM-DD
13
13
  target_date: # Feature 可选 Issue 字段:YYYY-MM-DD
14
14
  current_step: requirement-analysis # requirement-analysis | requirement-analysis-review | technical-design | technical-design-review | code | code-review | completed
15
- assigned_to: # claude | codex | gemini | opencode | human
15
+ assigned_to: # claude | codex | antigravity | opencode | human
16
16
  pr_status: pending # PR 状态:pending(默认)| created(已创建 PR)| skipped(显式跳过)
17
17
  ---
18
18
 
@@ -80,7 +80,7 @@ pr_status: pending # PR 状态:pending(默认)| created(已
80
80
 
81
81
  ## 人工裁决
82
82
 
83
- <!-- 使用 ai decide <task-ref> <序号|账本ID> [--needs-implementation true|false] <裁决内容> 写入 needs-human-decision 裁定;code 阶段必须显式声明是否需要实现。 -->
83
+ <!-- 使用 ai decide <task-ref> <序号|账本ID> [--needs-implementation true|false] <裁决内容> 写入 needs-human-decision 裁定;新建 code 裁决的实现意图由上游 AI 预先声明,显式参数仅用于历史任务兼容或一致性复核。 -->
84
84
 
85
85
  ## 实现输入
86
86