@fitlab-ai/agent-infra 0.9.10 → 0.9.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (375) hide show
  1. package/README.md +19 -9
  2. package/README.zh-CN.md +19 -9
  3. package/bin/cli.ts +17 -4
  4. package/dist/bin/cli.js +19 -4
  5. package/dist/bin/internal-cli.js +55 -4
  6. package/dist/lib/agent-client.js +0 -1
  7. package/dist/lib/agent-clients/adapters/codex-lifecycle/build-identity.js +71 -10
  8. package/dist/lib/agent-clients/adapters/opencode-sandbox.js +0 -4
  9. package/dist/lib/agent-clients/adapters/traecli.js +7 -8
  10. package/dist/lib/agent-clients/config.js +14 -99
  11. package/dist/lib/agent-clients/reconcile.js +1 -11
  12. package/dist/lib/agent-clients/schema.js +5 -4
  13. package/dist/lib/agent-clients/tokens.js +5 -15
  14. package/dist/lib/decide.js +14 -30
  15. package/dist/lib/defaults.json +8 -0
  16. package/dist/lib/git/workflow.js +43 -1
  17. package/dist/lib/init.js +3 -2
  18. package/dist/lib/internal/git-workflow.js +8 -1
  19. package/dist/lib/internal/platform-pr.js +8 -2
  20. package/dist/lib/internal/release-workflow.js +0 -1
  21. package/dist/lib/internal/task-delivery.js +59 -0
  22. package/dist/lib/internal/task-finalization.js +19 -9
  23. package/dist/lib/internal/task-ledger.js +8 -2
  24. package/dist/lib/internal/task-lifecycle.js +17 -93
  25. package/dist/lib/internal/task-orchestration.js +30 -216
  26. package/dist/lib/internal/task-validate.js +2 -1
  27. package/dist/lib/merge.js +205 -103
  28. package/dist/lib/platform/github-client.js +7 -1
  29. package/dist/lib/platform/pr-checks.js +8 -5
  30. package/dist/lib/platform/pr-summary.js +12 -8
  31. package/dist/lib/platform/pull-requests.js +393 -91
  32. package/dist/lib/platform/verification-required.js +13 -2
  33. package/dist/lib/platform/verification-sync.js +9 -4
  34. package/dist/lib/pr-review/evidence-grading.js +12 -4
  35. package/dist/lib/process-data/normalize.js +2 -9
  36. package/dist/lib/run/host.js +46 -16
  37. package/dist/lib/sandbox/agent-client-reconciler.js +4 -12
  38. package/dist/lib/sandbox/commands/create.js +3 -3
  39. package/dist/lib/sandbox/commands/enter.js +18 -4
  40. package/dist/lib/sandbox/config.js +8 -12
  41. package/dist/lib/sandbox/control/executor.js +131 -39
  42. package/dist/lib/sandbox/control/lifecycle.js +55 -24
  43. package/dist/lib/sandbox/control/server.js +18 -16
  44. package/dist/lib/sandbox/mounts.js +3 -2
  45. package/dist/lib/sandbox/recovery.js +123 -22
  46. package/dist/lib/sandbox/workspace-identity.js +14 -0
  47. package/dist/lib/sandbox/workspace-view.js +8 -9
  48. package/dist/lib/self-update.js +278 -0
  49. package/dist/lib/server/process-state.js +2 -2
  50. package/dist/lib/server/protocol.js +5 -5
  51. package/dist/lib/task/activity-log.js +4 -1
  52. package/dist/lib/task/artifact-lifecycle.js +6 -4
  53. package/dist/lib/task/codex-orchestration.js +1 -1
  54. package/dist/lib/task/command-options.js +1 -3
  55. package/dist/lib/task/commands/cat.js +0 -5
  56. package/dist/lib/task/commands/decisions.js +76 -92
  57. package/dist/lib/task/commands/files.js +6 -6
  58. package/dist/lib/task/commands/grep.js +25 -61
  59. package/dist/lib/task/commands/issue-body.js +6 -6
  60. package/dist/lib/task/commands/log.js +25 -10
  61. package/dist/lib/task/commands/show.js +5 -6
  62. package/dist/lib/task/commands/status.js +8 -8
  63. package/dist/lib/task/commit-intent.js +100 -0
  64. package/dist/lib/task/commit-operation.js +181 -91
  65. package/dist/lib/task/commit-policy.js +1 -1
  66. package/dist/lib/task/control-authority.js +431 -0
  67. package/dist/lib/task/create.js +39 -8
  68. package/dist/lib/task/current-contract.js +35 -0
  69. package/dist/lib/task/decision-details.js +218 -0
  70. package/dist/lib/task/decision-intents.js +5 -2
  71. package/dist/lib/task/delivery-target.js +97 -0
  72. package/dist/lib/task/delivery.js +153 -0
  73. package/dist/lib/task/events.js +11 -5
  74. package/dist/lib/task/human-override.js +5 -2
  75. package/dist/lib/task/index.js +19 -20
  76. package/dist/lib/task/ledger-intents.js +8 -9
  77. package/dist/lib/task/ledger.js +13 -6
  78. package/dist/lib/task/lifecycle.js +122 -9
  79. package/dist/lib/task/orchestration.js +105 -75
  80. package/dist/lib/task/pr-delivery-fact.js +182 -0
  81. package/dist/lib/task/review-artifacts.js +31 -12
  82. package/dist/lib/task/review-finalization.js +13 -4
  83. package/dist/lib/task/review-fingerprint.js +8 -0
  84. package/dist/lib/task/verification-engine.js +86 -39
  85. package/dist/lib/task/verification-review.js +2 -2
  86. package/dist/lib/task/workspace-snapshot.js +5 -11
  87. package/dist/lib/task/write.js +11 -1
  88. package/dist/lib/update.js +13 -35
  89. package/dist/lib/version.js +5 -1
  90. package/dist/lifecycle-build-manifest.json +3 -3
  91. package/lib/agent-client.ts +0 -1
  92. package/lib/agent-clients/adapters/codex-lifecycle/build-identity.ts +105 -10
  93. package/lib/agent-clients/adapters/codex-lifecycle/manifest-files.json +12 -1
  94. package/lib/agent-clients/adapters/opencode-sandbox.ts +0 -5
  95. package/lib/agent-clients/adapters/traecli.ts +7 -8
  96. package/lib/agent-clients/config.ts +14 -144
  97. package/lib/agent-clients/reconcile.ts +1 -12
  98. package/lib/agent-clients/schema.ts +5 -4
  99. package/lib/agent-clients/tokens.ts +5 -18
  100. package/lib/decide.ts +12 -22
  101. package/lib/defaults.json +8 -0
  102. package/lib/git/workflow.ts +38 -1
  103. package/lib/init.ts +5 -2
  104. package/lib/internal/git-workflow.ts +7 -1
  105. package/lib/internal/platform-pr.ts +8 -1
  106. package/lib/internal/release-workflow.ts +0 -1
  107. package/lib/internal/task-delivery.ts +53 -0
  108. package/lib/internal/task-finalization.ts +27 -13
  109. package/lib/internal/task-ledger.ts +8 -2
  110. package/lib/internal/task-lifecycle.ts +33 -76
  111. package/lib/internal/task-orchestration.ts +33 -190
  112. package/lib/internal/task-validate.ts +3 -2
  113. package/lib/merge.ts +236 -120
  114. package/lib/platform/github-client.ts +8 -1
  115. package/lib/platform/pr-checks.ts +7 -5
  116. package/lib/platform/pr-summary.ts +10 -7
  117. package/lib/platform/pull-requests.ts +425 -87
  118. package/lib/platform/verification-required.ts +12 -2
  119. package/lib/platform/verification-sync.ts +9 -4
  120. package/lib/pr-review/evidence-grading.ts +7 -4
  121. package/lib/process-data/normalize.ts +2 -8
  122. package/lib/run/host.ts +63 -14
  123. package/lib/sandbox/agent-client-reconciler.ts +5 -15
  124. package/lib/sandbox/commands/create.ts +4 -4
  125. package/lib/sandbox/commands/enter.ts +24 -4
  126. package/lib/sandbox/config.ts +9 -14
  127. package/lib/sandbox/control/container-identity.ts +2 -2
  128. package/lib/sandbox/control/executor.ts +148 -51
  129. package/lib/sandbox/control/lifecycle.ts +59 -31
  130. package/lib/sandbox/control/protocol.ts +1 -3
  131. package/lib/sandbox/control/server.ts +15 -12
  132. package/lib/sandbox/control/state.ts +7 -7
  133. package/lib/sandbox/mounts.ts +4 -3
  134. package/lib/sandbox/recovery.ts +162 -34
  135. package/lib/sandbox/tools.ts +1 -1
  136. package/lib/sandbox/workspace-identity.ts +28 -0
  137. package/lib/sandbox/workspace-view.ts +14 -10
  138. package/lib/self-update.ts +341 -0
  139. package/lib/server/process-state.ts +2 -2
  140. package/lib/server/protocol.ts +5 -5
  141. package/lib/task/activity-log.ts +6 -1
  142. package/lib/task/artifact-lifecycle.ts +7 -5
  143. package/lib/task/codex-orchestration.ts +2 -1
  144. package/lib/task/command-options.ts +1 -2
  145. package/lib/task/commands/cat.ts +0 -4
  146. package/lib/task/commands/decisions.ts +80 -75
  147. package/lib/task/commands/files.ts +6 -6
  148. package/lib/task/commands/grep.ts +23 -51
  149. package/lib/task/commands/issue-body.ts +6 -6
  150. package/lib/task/commands/log.ts +22 -10
  151. package/lib/task/commands/show.ts +5 -6
  152. package/lib/task/commands/status.ts +8 -8
  153. package/lib/task/commit-intent.ts +137 -0
  154. package/lib/task/commit-operation.ts +161 -79
  155. package/lib/task/commit-policy.ts +1 -2
  156. package/lib/task/control-authority.ts +563 -0
  157. package/lib/task/create.ts +40 -10
  158. package/lib/task/current-contract.ts +49 -0
  159. package/lib/task/decision-details.ts +280 -0
  160. package/lib/task/decision-intents.ts +7 -2
  161. package/lib/task/delivery-target.ts +130 -0
  162. package/lib/task/delivery.ts +160 -0
  163. package/lib/task/events.ts +10 -5
  164. package/lib/task/human-override.ts +5 -2
  165. package/lib/task/index.ts +19 -20
  166. package/lib/task/ledger-intents.ts +6 -8
  167. package/lib/task/ledger.ts +17 -7
  168. package/lib/task/lifecycle.ts +113 -4
  169. package/lib/task/orchestration.ts +102 -80
  170. package/lib/task/pr-delivery-fact.ts +254 -0
  171. package/lib/task/review-artifacts.ts +53 -15
  172. package/lib/task/review-finalization.ts +21 -5
  173. package/lib/task/review-fingerprint.ts +10 -0
  174. package/lib/task/verification-engine.ts +78 -46
  175. package/lib/task/verification-review.ts +3 -1
  176. package/lib/task/workspace-snapshot.ts +4 -13
  177. package/lib/task/write.ts +20 -1
  178. package/lib/update.ts +14 -38
  179. package/lib/version.ts +6 -1
  180. package/package.json +1 -1
  181. package/templates/.agents/README.en.md +5 -3
  182. package/templates/.agents/README.zh-CN.md +5 -3
  183. package/templates/.agents/rules/README.en.md +4 -2
  184. package/templates/.agents/rules/README.zh-CN.md +4 -2
  185. package/templates/.agents/rules/compatibility-policy.en.md +5 -4
  186. package/templates/.agents/rules/compatibility-policy.zh-CN.md +5 -4
  187. package/templates/.agents/rules/create-issue.en.md +11 -2
  188. package/templates/.agents/rules/create-issue.zh-CN.md +24 -2
  189. package/templates/.agents/rules/human-decision-context.en.md +9 -7
  190. package/templates/.agents/rules/human-decision-context.zh-CN.md +9 -7
  191. package/templates/.agents/rules/{issue-fields.github.en.md → issue-fields.en.md} +1 -1
  192. package/templates/.agents/rules/{issue-fields.github.zh-CN.md → issue-fields.zh-CN.md} +1 -1
  193. package/templates/.agents/rules/issue-pr-commands.en.md +5 -18
  194. package/templates/.agents/rules/issue-pr-commands.zh-CN.md +1 -1
  195. package/templates/.agents/rules/issue-sync.en.md +26 -5
  196. package/templates/.agents/rules/issue-sync.zh-CN.md +62 -5
  197. package/templates/.agents/rules/label-milestone-setup.en.md +15 -2
  198. package/templates/.agents/rules/label-milestone-setup.zh-CN.md +15 -2
  199. package/templates/.agents/rules/local-artifact-repair.en.md +46 -0
  200. package/templates/.agents/rules/local-artifact-repair.zh-CN.md +46 -0
  201. package/templates/.agents/rules/milestone-inference.en.md +12 -2
  202. package/templates/.agents/rules/milestone-inference.zh-CN.md +25 -3
  203. package/templates/.agents/rules/next-step-output.en.md +3 -3
  204. package/templates/.agents/rules/next-step-output.zh-CN.md +3 -3
  205. package/templates/.agents/rules/no-mid-flow-questions.en.md +1 -1
  206. package/templates/.agents/rules/no-mid-flow-questions.zh-CN.md +1 -1
  207. package/templates/.agents/rules/pr-sync.en.md +23 -14
  208. package/templates/.agents/rules/pr-sync.zh-CN.md +23 -2
  209. package/templates/.agents/rules/release-commands.en.md +42 -3
  210. package/templates/.agents/rules/release-commands.zh-CN.md +42 -3
  211. package/templates/.agents/rules/review-handshake.en.md +1 -1
  212. package/templates/.agents/rules/review-handshake.zh-CN.md +1 -1
  213. package/templates/.agents/rules/security-alerts.en.md +17 -2
  214. package/templates/.agents/rules/security-alerts.zh-CN.md +17 -2
  215. package/templates/.agents/rules/sync-content-generation.en.md +8 -0
  216. package/templates/.agents/rules/sync-content-generation.zh-CN.md +8 -0
  217. package/templates/.agents/rules/task-management.en.md +2 -3
  218. package/templates/.agents/rules/task-management.zh-CN.md +2 -3
  219. package/templates/.agents/scripts/security-alerts.github.sh +151 -0
  220. package/templates/.agents/scripts/security-alerts.sh +31 -0
  221. package/templates/.agents/skills/analyze-task/SKILL.en.md +4 -3
  222. package/templates/.agents/skills/analyze-task/SKILL.zh-CN.md +4 -3
  223. package/templates/.agents/skills/block-task/SKILL.en.md +2 -2
  224. package/templates/.agents/skills/block-task/SKILL.zh-CN.md +2 -2
  225. package/templates/.agents/skills/cancel-task/SKILL.en.md +2 -2
  226. package/templates/.agents/skills/cancel-task/SKILL.zh-CN.md +2 -2
  227. package/templates/.agents/skills/check-task/SKILL.en.md +2 -2
  228. package/templates/.agents/skills/check-task/SKILL.zh-CN.md +2 -2
  229. package/templates/.agents/skills/close-codescan/SKILL.en.md +3 -3
  230. package/templates/.agents/skills/close-codescan/SKILL.zh-CN.md +3 -3
  231. package/templates/.agents/skills/close-dependabot/SKILL.en.md +3 -3
  232. package/templates/.agents/skills/close-dependabot/SKILL.zh-CN.md +3 -3
  233. package/templates/.agents/skills/code-task/SKILL.en.md +8 -5
  234. package/templates/.agents/skills/code-task/SKILL.zh-CN.md +9 -6
  235. package/templates/.agents/skills/commit/SKILL.en.md +30 -10
  236. package/templates/.agents/skills/commit/SKILL.zh-CN.md +6 -7
  237. package/templates/.agents/skills/commit/config/verify.json +1 -1
  238. package/templates/.agents/skills/commit/reference/commit-orchestration.en.md +3 -3
  239. package/templates/.agents/skills/commit/reference/commit-orchestration.zh-CN.md +3 -3
  240. package/templates/.agents/skills/commit/reference/pr-summary-sync.en.md +1 -1
  241. package/templates/.agents/skills/commit/reference/pr-summary-sync.zh-CN.md +1 -1
  242. package/templates/.agents/skills/commit/reference/task-status-update.en.md +2 -2
  243. package/templates/.agents/skills/commit/reference/task-status-update.zh-CN.md +2 -2
  244. package/templates/.agents/skills/complete-manual-validation/SKILL.en.md +7 -6
  245. package/templates/.agents/skills/complete-manual-validation/SKILL.zh-CN.md +7 -6
  246. package/templates/.agents/skills/complete-manual-validation/config/verify.en.json +1 -1
  247. package/templates/.agents/skills/complete-manual-validation/config/verify.zh-CN.json +1 -1
  248. package/templates/.agents/skills/complete-manual-validation/reference/summary-update.en.md +1 -1
  249. package/templates/.agents/skills/complete-manual-validation/reference/summary-update.zh-CN.md +1 -1
  250. package/templates/.agents/skills/complete-task/SKILL.en.md +13 -13
  251. package/templates/.agents/skills/complete-task/SKILL.zh-CN.md +13 -13
  252. package/templates/.agents/skills/complete-task/reference/external-delivery.en.md +2 -2
  253. package/templates/.agents/skills/complete-task/reference/external-delivery.zh-CN.md +2 -2
  254. package/templates/.agents/skills/create-pr/SKILL.en.md +9 -11
  255. package/templates/.agents/skills/create-pr/SKILL.zh-CN.md +9 -11
  256. package/templates/.agents/skills/create-pr/reference/change-report.en.md +9 -4
  257. package/templates/.agents/skills/create-pr/reference/change-report.zh-CN.md +9 -4
  258. package/templates/.agents/skills/create-pr/scripts/change-report.mjs +203 -0
  259. package/templates/.agents/skills/create-release-note/SKILL.en.md +5 -6
  260. package/templates/.agents/skills/create-release-note/SKILL.zh-CN.md +5 -6
  261. package/templates/.agents/skills/create-task/SKILL.en.md +2 -1
  262. package/templates/.agents/skills/create-task/SKILL.zh-CN.md +2 -1
  263. package/templates/.agents/skills/import-codescan/SKILL.en.md +1 -1
  264. package/templates/.agents/skills/import-codescan/SKILL.zh-CN.md +1 -1
  265. package/templates/.agents/skills/import-dependabot/SKILL.en.md +1 -1
  266. package/templates/.agents/skills/import-dependabot/SKILL.zh-CN.md +1 -1
  267. package/templates/.agents/skills/import-issue/SKILL.en.md +1 -1
  268. package/templates/.agents/skills/import-issue/SKILL.zh-CN.md +1 -1
  269. package/templates/.agents/skills/init-labels/SKILL.en.md +9 -10
  270. package/templates/.agents/skills/init-labels/SKILL.zh-CN.md +9 -10
  271. package/templates/.agents/skills/init-labels/scripts/init-labels.github.sh +57 -1
  272. package/templates/.agents/skills/init-labels/scripts/init-labels.sh +27 -1
  273. package/templates/.agents/skills/init-milestones/SKILL.en.md +3 -5
  274. package/templates/.agents/skills/init-milestones/SKILL.zh-CN.md +3 -5
  275. package/templates/.agents/skills/plan-task/SKILL.en.md +4 -3
  276. package/templates/.agents/skills/plan-task/SKILL.zh-CN.md +4 -3
  277. package/templates/.agents/skills/restore-task/SKILL.en.md +1 -1
  278. package/templates/.agents/skills/restore-task/SKILL.zh-CN.md +1 -1
  279. package/templates/.agents/skills/review-analysis/SKILL.en.md +8 -5
  280. package/templates/.agents/skills/review-analysis/SKILL.zh-CN.md +8 -5
  281. package/templates/.agents/skills/review-analysis/config/verify.en.json +1 -0
  282. package/templates/.agents/skills/review-analysis/config/verify.zh-CN.json +1 -0
  283. package/templates/.agents/skills/review-analysis/reference/output-templates.en.md +18 -0
  284. package/templates/.agents/skills/review-analysis/reference/output-templates.zh-CN.md +18 -0
  285. package/templates/.agents/skills/review-code/SKILL.en.md +11 -8
  286. package/templates/.agents/skills/review-code/SKILL.zh-CN.md +11 -8
  287. package/templates/.agents/skills/review-code/config/verify.en.json +1 -0
  288. package/templates/.agents/skills/review-code/config/verify.zh-CN.json +1 -0
  289. package/templates/.agents/skills/review-code/reference/migration-risks.en.md +2 -1
  290. package/templates/.agents/skills/review-code/reference/migration-risks.zh-CN.md +2 -1
  291. package/templates/.agents/skills/review-code/reference/output-templates.en.md +19 -1
  292. package/templates/.agents/skills/review-code/reference/output-templates.zh-CN.md +19 -1
  293. package/templates/.agents/skills/review-code/reference/report-template.en.md +4 -2
  294. package/templates/.agents/skills/review-code/reference/report-template.zh-CN.md +4 -2
  295. package/templates/.agents/skills/review-plan/SKILL.en.md +8 -5
  296. package/templates/.agents/skills/review-plan/SKILL.zh-CN.md +8 -5
  297. package/templates/.agents/skills/review-plan/config/verify.en.json +1 -0
  298. package/templates/.agents/skills/review-plan/config/verify.zh-CN.json +1 -0
  299. package/templates/.agents/skills/review-plan/reference/output-templates.en.md +18 -0
  300. package/templates/.agents/skills/review-plan/reference/output-templates.zh-CN.md +18 -0
  301. package/templates/.agents/skills/review-pr/SKILL.en.md +1 -0
  302. package/templates/.agents/skills/review-pr/SKILL.zh-CN.md +1 -0
  303. package/templates/.agents/skills/review-pr/reference/evidence-grading.en.md +2 -2
  304. package/templates/.agents/skills/review-pr/reference/evidence-grading.zh-CN.md +2 -2
  305. package/templates/.agents/skills/run-manual-validation/SKILL.en.md +5 -0
  306. package/templates/.agents/skills/run-manual-validation/SKILL.zh-CN.md +5 -0
  307. package/templates/.agents/skills/run-task/SKILL.en.md +5 -1
  308. package/templates/.agents/skills/run-task/SKILL.zh-CN.md +5 -1
  309. package/templates/.agents/skills/update-agent-infra/SKILL.en.md +2 -2
  310. package/templates/.agents/skills/update-agent-infra/SKILL.zh-CN.md +2 -2
  311. package/templates/.agents/skills/update-agent-infra/scripts/sync-templates.js +144 -109
  312. package/templates/.agents/skills/watch-pr/SKILL.en.md +5 -5
  313. package/templates/.agents/skills/watch-pr/SKILL.zh-CN.md +5 -5
  314. package/templates/.agents/templates/task.en.md +6 -2
  315. package/templates/.agents/templates/task.zh-CN.md +6 -2
  316. package/templates/.agents/workflows/bug-fix.en.yaml +9 -8
  317. package/templates/.agents/workflows/bug-fix.zh-CN.yaml +9 -8
  318. package/templates/.agents/workflows/feature-development.en.yaml +9 -8
  319. package/templates/.agents/workflows/feature-development.zh-CN.yaml +9 -8
  320. package/templates/.agents/workflows/refactoring.en.yaml +9 -8
  321. package/templates/.agents/workflows/refactoring.zh-CN.yaml +9 -8
  322. package/templates/.claude/commands/analyze-task.en.md +1 -1
  323. package/templates/.claude/commands/analyze-task.zh-CN.md +1 -1
  324. package/templates/.claude/commands/block-task.en.md +1 -1
  325. package/templates/.claude/commands/block-task.zh-CN.md +1 -1
  326. package/templates/.claude/commands/cancel-task.en.md +1 -1
  327. package/templates/.claude/commands/cancel-task.zh-CN.md +1 -1
  328. package/templates/.claude/commands/check-task.en.md +1 -1
  329. package/templates/.claude/commands/check-task.zh-CN.md +1 -1
  330. package/templates/.claude/commands/code-task.en.md +1 -1
  331. package/templates/.claude/commands/code-task.zh-CN.md +1 -1
  332. package/templates/.claude/commands/commit.en.md +1 -1
  333. package/templates/.claude/commands/commit.zh-CN.md +1 -1
  334. package/templates/.claude/commands/complete-manual-validation.en.md +1 -1
  335. package/templates/.claude/commands/complete-manual-validation.zh-CN.md +1 -1
  336. package/templates/.claude/commands/complete-task.en.md +1 -1
  337. package/templates/.claude/commands/complete-task.zh-CN.md +1 -1
  338. package/templates/.claude/commands/create-pr.en.md +1 -1
  339. package/templates/.claude/commands/create-pr.zh-CN.md +1 -1
  340. package/templates/.claude/commands/plan-task.en.md +1 -1
  341. package/templates/.claude/commands/plan-task.zh-CN.md +1 -1
  342. package/templates/.claude/commands/review-analysis.en.md +1 -1
  343. package/templates/.claude/commands/review-analysis.zh-CN.md +1 -1
  344. package/templates/.claude/commands/review-code.en.md +1 -1
  345. package/templates/.claude/commands/review-code.zh-CN.md +1 -1
  346. package/templates/.claude/commands/review-plan.en.md +1 -1
  347. package/templates/.claude/commands/review-plan.zh-CN.md +1 -1
  348. package/templates/.claude/commands/run-manual-validation.en.md +1 -1
  349. package/templates/.claude/commands/run-manual-validation.zh-CN.md +1 -1
  350. package/templates/.claude/commands/run-task.en.md +1 -1
  351. package/templates/.claude/commands/run-task.zh-CN.md +1 -1
  352. package/templates/.claude/commands/watch-pr.en.md +1 -1
  353. package/templates/.claude/commands/watch-pr.zh-CN.md +1 -1
  354. package/templates/{.trae/skills → .traecli/commands}/update-agent-infra.en.md +0 -1
  355. package/templates/{.trae/skills → .traecli/commands}/update-agent-infra.zh-CN.md +0 -1
  356. package/dist/lib/builtin-tuis.js +0 -40
  357. package/lib/builtin-tuis.ts +0 -56
  358. package/templates/.agents/rules/create-issue.github.en.md +0 -14
  359. package/templates/.agents/rules/create-issue.github.zh-CN.md +0 -27
  360. package/templates/.agents/rules/issue-pr-commands.github.en.md +0 -34
  361. package/templates/.agents/rules/issue-pr-commands.github.zh-CN.md +0 -49
  362. package/templates/.agents/rules/issue-sync.github.en.md +0 -40
  363. package/templates/.agents/rules/issue-sync.github.zh-CN.md +0 -76
  364. package/templates/.agents/rules/label-milestone-setup.github.en.md +0 -60
  365. package/templates/.agents/rules/label-milestone-setup.github.zh-CN.md +0 -60
  366. package/templates/.agents/rules/milestone-inference.github.en.md +0 -15
  367. package/templates/.agents/rules/milestone-inference.github.zh-CN.md +0 -27
  368. package/templates/.agents/rules/pr-checks-commands.github.en.md +0 -18
  369. package/templates/.agents/rules/pr-checks-commands.github.zh-CN.md +0 -34
  370. package/templates/.agents/rules/pr-sync.github.en.md +0 -43
  371. package/templates/.agents/rules/pr-sync.github.zh-CN.md +0 -69
  372. package/templates/.agents/rules/release-commands.github.en.md +0 -38
  373. package/templates/.agents/rules/release-commands.github.zh-CN.md +0 -38
  374. package/templates/.agents/rules/security-alerts.github.en.md +0 -43
  375. package/templates/.agents/rules/security-alerts.github.zh-CN.md +0 -43
@@ -0,0 +1,100 @@
1
+ import { createHash } from 'node:crypto';
2
+ import fs from 'node:fs';
3
+ import path from 'node:path';
4
+ function intentRoot(repoRoot) {
5
+ return path.join(repoRoot, '.agents', 'workspace', '.task-commit-intents');
6
+ }
7
+ function intentPath(repoRoot, taskId) {
8
+ return path.join(intentRoot(repoRoot), `${taskId}.json`);
9
+ }
10
+ function checkpointIntentDigest(identity) {
11
+ return createHash('sha256').update(JSON.stringify({
12
+ taskId: identity.taskId,
13
+ branch: identity.branch,
14
+ mode: identity.mode,
15
+ expectedHead: identity.expectedHead,
16
+ expectedTree: identity.expectedTree,
17
+ paths: [...identity.paths],
18
+ message: identity.message,
19
+ round: identity.round
20
+ })).digest('hex');
21
+ }
22
+ function isIntent(value) {
23
+ if (!value || typeof value !== 'object' || Array.isArray(value))
24
+ return false;
25
+ const intent = value;
26
+ return intent.version === 1
27
+ && typeof intent.taskId === 'string' && intent.taskId.length > 0
28
+ && typeof intent.branch === 'string' && intent.branch.length > 0
29
+ && intent.mode === 'local'
30
+ && typeof intent.expectedHead === 'string' && /^[a-f0-9]{40,64}$/.test(intent.expectedHead)
31
+ && typeof intent.expectedTree === 'string' && /^[a-f0-9]{40,64}$/.test(intent.expectedTree)
32
+ && Array.isArray(intent.paths) && intent.paths.every((item) => typeof item === 'string' && item.length > 0)
33
+ && typeof intent.message === 'string' && intent.message.length > 0
34
+ && Number.isSafeInteger(intent.round) && Number(intent.round) > 0
35
+ && typeof intent.digest === 'string' && /^[a-f0-9]{64}$/.test(intent.digest)
36
+ && ['prepared', 'committed', 'synced'].includes(String(intent.state))
37
+ && (intent.committedHead === null || (typeof intent.committedHead === 'string' && /^[a-f0-9]{40,64}$/.test(intent.committedHead)))
38
+ && typeof intent.createdAt === 'string' && intent.createdAt.length > 0
39
+ && typeof intent.updatedAt === 'string' && intent.updatedAt.length > 0
40
+ && intent.digest === checkpointIntentDigest(intent);
41
+ }
42
+ function readCheckpointIntent(repoRoot, taskId) {
43
+ const target = intentPath(repoRoot, taskId);
44
+ if (!fs.existsSync(target))
45
+ return null;
46
+ const value = JSON.parse(fs.readFileSync(target, 'utf8'));
47
+ if (!isIntent(value))
48
+ throw new Error('COMMIT_INTENT_INVALID: checkpoint intent schema is invalid');
49
+ return value;
50
+ }
51
+ function writeCheckpointIntent(repoRoot, value) {
52
+ if (!isIntent(value))
53
+ throw new Error('COMMIT_INTENT_INVALID: checkpoint intent schema is invalid');
54
+ const directory = intentRoot(repoRoot);
55
+ fs.mkdirSync(directory, { recursive: true, mode: 0o700 });
56
+ const target = intentPath(repoRoot, value.taskId);
57
+ const temporary = `${target}.${process.pid}.${Date.now()}.tmp`;
58
+ fs.writeFileSync(temporary, `${JSON.stringify(value)}\n`, { encoding: 'utf8', mode: 0o600, flag: 'wx' });
59
+ try {
60
+ fs.renameSync(temporary, target);
61
+ }
62
+ catch (error) {
63
+ try {
64
+ fs.unlinkSync(temporary);
65
+ }
66
+ catch { /* preserve primary error */ }
67
+ throw error;
68
+ }
69
+ }
70
+ function updateCheckpointIntent(value, patch) {
71
+ const next = { ...value, ...patch };
72
+ if (next.state === 'prepared' && next.committedHead !== null)
73
+ throw new Error('COMMIT_INTENT_INVALID: prepared intent cannot have a committed head');
74
+ if (next.state !== 'prepared' && !next.committedHead)
75
+ throw new Error('COMMIT_INTENT_INVALID: committed intent requires a committed head');
76
+ return next;
77
+ }
78
+ function removeCheckpointIntent(repoRoot, taskId) {
79
+ const target = intentPath(repoRoot, taskId);
80
+ try {
81
+ fs.unlinkSync(target);
82
+ }
83
+ catch (error) {
84
+ if (error.code !== 'ENOENT')
85
+ throw error;
86
+ }
87
+ }
88
+ function sameCheckpointIntent(left, right) {
89
+ return left.digest === checkpointIntentDigest(right)
90
+ && left.taskId === right.taskId
91
+ && left.branch === right.branch
92
+ && left.mode === right.mode
93
+ && left.expectedHead === right.expectedHead
94
+ && left.expectedTree === right.expectedTree
95
+ && left.message === right.message
96
+ && left.round === right.round
97
+ && JSON.stringify(left.paths) === JSON.stringify(right.paths);
98
+ }
99
+ export { checkpointIntentDigest, intentPath, intentRoot, isIntent, readCheckpointIntent, removeCheckpointIntent, sameCheckpointIntent, updateCheckpointIntent, writeCheckpointIntent };
100
+ //# sourceMappingURL=commit-intent.js.map
@@ -8,7 +8,7 @@ import { mergeOperationWarnings } from './operation-outcome.js';
8
8
  import { TaskExecutionLockError, withRepositoryMutationLock, withTaskExecutionLock } from './task-execution-lock.js';
9
9
  import { appendActivityEntry, locateActivityLog } from './activity-log.js';
10
10
  import { captureTaskWriteMetadata, writeTask } from './write.js';
11
- import { commitOrchestrationStageCompletion, planOrchestrationStageCompletion } from './orchestration.js';
11
+ import { checkpointIntentDigest, readCheckpointIntent, removeCheckpointIntent, sameCheckpointIntent, updateCheckpointIntent, writeCheckpointIntent } from './commit-intent.js';
12
12
  const HEAD_REF = /^refs\/heads\/(.+)$/;
13
13
  function isCommitExecutionMode(value) {
14
14
  return value === 'direct' || value === 'orchestrated';
@@ -20,6 +20,13 @@ function gitText(repoRoot, args) {
20
20
  stdio: ['ignore', 'pipe', 'pipe']
21
21
  }).trim();
22
22
  }
23
+ function effectiveDelivery(input) {
24
+ if (input.delivery)
25
+ return input.delivery;
26
+ if (input.push)
27
+ return { mode: 'push', remote: input.push.remote, refs: input.push.refs };
28
+ return null;
29
+ }
23
30
  function canonicalRepositoryRoot(cwd) {
24
31
  return gitText(cwd, ['rev-parse', '--show-toplevel']);
25
32
  }
@@ -82,12 +89,13 @@ function boundTask(input, taskId, taskDir, taskMdPath, repoRoot, state) {
82
89
  function validateCommon(input, branch) {
83
90
  if (!input.message.trim())
84
91
  return { code: 'GIT_COMMIT_INPUT_INVALID', message: 'Commit message is required' };
85
- if (input.paths.length === 0 && !input.push)
86
- return { code: 'GIT_COMMIT_INPUT_INVALID', message: 'At least one explicit path is required unless this is a push-only retry' };
87
92
  if (!/^[a-f0-9]{40,64}$/.test(input.expectedHead))
88
93
  return { code: 'GIT_HEAD_EXPECTATION_REQUIRED', message: 'A valid expected HEAD is required' };
89
94
  if (!/^[a-f0-9]{40,64}$/.test(input.expectedTree))
90
95
  return { code: 'GIT_TREE_EXPECTATION_REQUIRED', message: 'A valid expected tree is required' };
96
+ const delivery = effectiveDelivery(input);
97
+ if (!delivery)
98
+ return { code: 'GIT_PUSH_INPUT_INVALID', message: 'Commit delivery requires a delivery policy' };
91
99
  if (input.paths.some((candidate) => !candidate || candidate.startsWith('/') || candidate.split(/[\\/]/).includes('..'))) {
92
100
  return { code: 'GIT_COMMIT_INPUT_INVALID', message: 'Commit paths must stay inside the repository' };
93
101
  }
@@ -96,40 +104,16 @@ function validateCommon(input, branch) {
96
104
  }
97
105
  if (branch !== null && branch === '')
98
106
  return { code: 'GIT_BRANCH_INVALID', message: 'A named branch is required' };
99
- if (input.push) {
100
- if (!input.push.remote || input.push.refs.length !== 1)
107
+ if (delivery.mode === 'push') {
108
+ if (!delivery.remote || delivery.refs.length !== 1)
101
109
  return { code: 'GIT_PUSH_INPUT_INVALID', message: 'Push requires one remote and one ref' };
102
- const ref = input.push.refs[0] ?? '';
110
+ const ref = delivery.refs[0] ?? '';
103
111
  if (!HEAD_REF.test(ref) || HEAD_REF.exec(ref)?.[1] !== branch) {
104
112
  return { code: 'GIT_PUSH_INPUT_INVALID', message: 'Push ref must be the current full heads ref' };
105
113
  }
106
114
  }
107
115
  return null;
108
116
  }
109
- function validateOrchestrated(input, task) {
110
- if (!input.agent)
111
- return { error: { code: 'ORCHESTRATION_PROVENANCE_MISMATCH', message: 'orchestrated commit requires an agent' } };
112
- const planned = planOrchestrationStageCompletion(task.taskId, {
113
- stage: 'commit',
114
- round: 1,
115
- artifact: 'commit',
116
- role: 'executor',
117
- agent: input.agent
118
- }, { repoRoot: task.repoRoot });
119
- const run = planned.result.run;
120
- if (!planned.plan
121
- || !run
122
- || run.status !== 'running'
123
- || !run.commitAuthorization.issuedAt
124
- || run.commitAuthorization.consumedAt)
125
- return {
126
- error: {
127
- code: planned.result.error?.code ?? 'ORCHESTRATION_PROVENANCE_MISMATCH',
128
- message: planned.result.error?.message ?? 'orchestrated commit requires one matching activated commit delegation'
129
- }
130
- };
131
- return { plan: planned.plan };
132
- }
133
117
  function syncTaskCommit(input, task, committedHead) {
134
118
  let content;
135
119
  try {
@@ -148,7 +132,10 @@ function syncTaskCommit(input, task, committedHead) {
148
132
  heading: activity.heading,
149
133
  body: appendActivityEntry(activity, { time: metadata.timestamp, step: 'Commit', agent: input.agent, note: commitNote })
150
134
  });
151
- const frontmatter = { assigned_to: input.agent };
135
+ const frontmatter = {
136
+ assigned_to: input.agent,
137
+ checkpoint_commit: committedHead
138
+ };
152
139
  mutations.push({ kind: 'frontmatter', set: frontmatter });
153
140
  if (mutations.length === 0)
154
141
  return null;
@@ -165,10 +152,44 @@ function syncTaskCommit(input, task, committedHead) {
165
152
  return warning('TASK_STATUS_SYNC_FAILED', error instanceof Error ? error.message : String(error), true, 'task', task.taskId, 'ACTION_REQUIRED');
166
153
  }
167
154
  }
155
+ function checkpointChildMatches(task, intent, head) {
156
+ try {
157
+ const parent = gitText(task.repoRoot, ['rev-parse', `${head}^`]);
158
+ const tree = gitText(task.repoRoot, ['rev-parse', `${head}^{tree}`]);
159
+ const message = gitText(task.repoRoot, ['show', '-s', '--format=%s', head]);
160
+ const changed = gitText(task.repoRoot, ['diff-tree', '--no-commit-id', '--name-only', '-r', head]).split('\n').filter(Boolean).sort();
161
+ return parent === intent.expectedHead
162
+ && tree === intent.expectedTree
163
+ && message === intent.message
164
+ && JSON.stringify(changed) === JSON.stringify([...intent.paths].sort());
165
+ }
166
+ catch {
167
+ return false;
168
+ }
169
+ }
170
+ function checkpointIdentity(input, task, delivery) {
171
+ if (delivery.mode !== 'local')
172
+ throw new Error('checkpoint identity requires local delivery');
173
+ return {
174
+ taskId: task.taskId,
175
+ branch: task.branch,
176
+ mode: 'local',
177
+ expectedHead: input.expectedHead,
178
+ expectedTree: input.expectedTree,
179
+ paths: [...input.paths],
180
+ message: input.message,
181
+ round: input.round ?? 1
182
+ };
183
+ }
184
+ function checkpointTimestamp() {
185
+ return new Date().toISOString();
186
+ }
168
187
  function executeUnlocked(input, task, mode) {
169
188
  const inspected = inspectGitWorkflow(input.cwd);
170
189
  if (!inspected.snapshot)
171
190
  return failure(input, mode, task?.taskId ?? null, 'GIT_INSPECT_FAILED', 'Unable to inspect Git repository');
191
+ if (mode === 'orchestrated')
192
+ return failure(input, mode, task?.taskId ?? null, 'ORCHESTRATED_COMMIT_REMOVED', 'Orchestrated commit is no longer a lifecycle stage; use local checkpoint delivery from code-task', 'blocked', inspected.snapshot);
172
193
  const branch = inspected.snapshot.branch;
173
194
  const commonError = validateCommon(input, branch);
174
195
  if (commonError)
@@ -179,60 +200,131 @@ function executeUnlocked(input, task, mode) {
179
200
  return failure(input, mode, task.taskId, 'GIT_BRANCH_MISMATCH', `Task branch '${task.branch}' does not match current branch '${branch}'`, 'blocked', inspected.snapshot);
180
201
  if (task && !input.agent)
181
202
  return failure(input, mode, task.taskId, 'COMMIT_AGENT_REQUIRED', 'task-bound commit requires an agent', 'blocked', inspected.snapshot);
182
- const orchestrationValidation = mode === 'orchestrated'
183
- ? (task
184
- ? validateOrchestrated(input, task)
185
- : { error: { code: 'ORCHESTRATION_TASK_REQUIRED', message: 'orchestrated commit requires a task context' } })
186
- : null;
187
- if (orchestrationValidation && 'error' in orchestrationValidation) {
188
- const error = orchestrationValidation.error;
189
- return failure(input, mode, task?.taskId ?? null, error.code, error.message, 'blocked', inspected.snapshot);
190
- }
191
- const orchestrationCompletion = orchestrationValidation && 'plan' in orchestrationValidation
192
- ? orchestrationValidation.plan
193
- : null;
194
- const committed = input.paths.length === 0
203
+ const delivery = effectiveDelivery(input);
204
+ if (delivery.mode === 'local' && !task)
205
+ return failure(input, mode, null, 'CHECKPOINT_TASK_REQUIRED', 'local checkpoint delivery requires a task context', 'blocked', inspected.snapshot);
206
+ let pendingIntent = null;
207
+ let checkpointCommittedHead = null;
208
+ const committed = delivery.mode === 'local'
195
209
  ? (() => {
196
- if (inspected.snapshot.worktree.length > 0 || inspected.snapshot.staged.length > 0)
210
+ const identity = checkpointIdentity(input, task, delivery);
211
+ try {
212
+ pendingIntent = readCheckpointIntent(task.repoRoot, task.taskId);
213
+ }
214
+ catch (error) {
197
215
  return {
198
- status: 'failed',
199
- changed: false,
200
- snapshot: inspected.snapshot,
201
- operations: [],
202
- error: { code: 'GIT_COMMIT_INPUT_INVALID', message: 'Push-only retry requires a clean working tree' }
216
+ status: 'failed', changed: false, snapshot: inspected.snapshot, operations: [],
217
+ error: { code: 'COMMIT_INTENT_INVALID', message: error instanceof Error ? error.message : String(error) }
203
218
  };
204
- if (inspected.snapshot.head !== input.expectedHead)
219
+ }
220
+ if (pendingIntent && !sameCheckpointIntent(pendingIntent, identity))
205
221
  return {
206
- status: 'failed',
207
- changed: false,
208
- snapshot: inspected.snapshot,
209
- operations: [],
210
- error: { code: 'GIT_HEAD_MISMATCH', message: `Expected HEAD ${input.expectedHead}, received ${inspected.snapshot.head}` }
222
+ status: 'failed', changed: false, snapshot: inspected.snapshot, operations: [],
223
+ error: { code: 'COMMIT_INTENT_CONFLICT', message: 'A different checkpoint intent is still pending for this task' }
211
224
  };
212
- const currentTree = gitText(input.cwd, ['rev-parse', 'HEAD^{tree}']);
213
- if (currentTree !== input.expectedTree)
225
+ if (!pendingIntent) {
226
+ const timestamp = checkpointTimestamp();
227
+ pendingIntent = {
228
+ version: 1, ...identity, digest: checkpointIntentDigest(identity), state: 'prepared',
229
+ committedHead: null, createdAt: timestamp, updatedAt: timestamp
230
+ };
231
+ try {
232
+ writeCheckpointIntent(task.repoRoot, pendingIntent);
233
+ }
234
+ catch (error) {
235
+ return {
236
+ status: 'failed', changed: false, snapshot: inspected.snapshot, operations: [],
237
+ error: { code: 'COMMIT_INTENT_WRITE_FAILED', message: error instanceof Error ? error.message : String(error) }
238
+ };
239
+ }
240
+ }
241
+ if (pendingIntent.state !== 'prepared') {
242
+ checkpointCommittedHead = pendingIntent.committedHead;
214
243
  return {
215
- status: 'failed',
244
+ status: 'no-op', changed: false, snapshot: inspected.snapshot,
245
+ operations: [{ name: 'commit', status: 'no-op' }], error: null
246
+ };
247
+ }
248
+ if (inspected.snapshot.head !== identity.expectedHead && !checkpointChildMatches(task, pendingIntent, inspected.snapshot.head))
249
+ return {
250
+ status: 'failed', changed: false, snapshot: inspected.snapshot, operations: [],
251
+ error: { code: 'COMMIT_INTENT_HEAD_CONFLICT', message: 'Current HEAD does not match the pending checkpoint intent' }
252
+ };
253
+ if (inspected.snapshot.head !== identity.expectedHead) {
254
+ checkpointCommittedHead = inspected.snapshot.head;
255
+ pendingIntent = updateCheckpointIntent(pendingIntent, {
256
+ state: 'committed', committedHead: checkpointCommittedHead, updatedAt: checkpointTimestamp()
257
+ });
258
+ writeCheckpointIntent(task.repoRoot, pendingIntent);
259
+ return {
260
+ status: 'no-op', changed: false, snapshot: inspected.snapshot,
261
+ operations: [{ name: 'commit', status: 'no-op' }], error: null
262
+ };
263
+ }
264
+ if (input.paths.length === 0)
265
+ return {
266
+ status: 'failed', changed: false, snapshot: inspected.snapshot, operations: [],
267
+ error: { code: 'GIT_COMMIT_INPUT_INVALID', message: 'Local checkpoint requires explicit paths' }
268
+ };
269
+ const created = commitExplicitPaths({
270
+ cwd: input.cwd, paths: input.paths, message: input.message,
271
+ expectedHead: identity.expectedHead, expectedTree: identity.expectedTree
272
+ });
273
+ if (created.status === 'applied' && created.snapshot?.head) {
274
+ checkpointCommittedHead = created.snapshot.head;
275
+ pendingIntent = updateCheckpointIntent(pendingIntent, {
276
+ state: 'committed', committedHead: checkpointCommittedHead, updatedAt: checkpointTimestamp()
277
+ });
278
+ writeCheckpointIntent(task.repoRoot, pendingIntent);
279
+ }
280
+ else if (created.status === 'no-op') {
281
+ removeCheckpointIntent(task.repoRoot, task.taskId);
282
+ pendingIntent = null;
283
+ }
284
+ return created;
285
+ })()
286
+ : input.paths.length === 0
287
+ ? (() => {
288
+ if (inspected.snapshot.worktree.length > 0 || inspected.snapshot.staged.length > 0)
289
+ return {
290
+ status: 'failed',
291
+ changed: false,
292
+ snapshot: inspected.snapshot,
293
+ operations: [],
294
+ error: { code: 'GIT_COMMIT_INPUT_INVALID', message: 'Push-only retry requires a clean working tree' }
295
+ };
296
+ if (inspected.snapshot.head !== input.expectedHead)
297
+ return {
298
+ status: 'failed',
299
+ changed: false,
300
+ snapshot: inspected.snapshot,
301
+ operations: [],
302
+ error: { code: 'GIT_HEAD_MISMATCH', message: `Expected HEAD ${input.expectedHead}, received ${inspected.snapshot.head}` }
303
+ };
304
+ const currentTree = gitText(input.cwd, ['rev-parse', 'HEAD^{tree}']);
305
+ if (currentTree !== input.expectedTree)
306
+ return {
307
+ status: 'failed',
308
+ changed: false,
309
+ snapshot: inspected.snapshot,
310
+ operations: [],
311
+ error: { code: 'GIT_TREE_MISMATCH', message: `Expected current tree ${input.expectedTree}, received ${currentTree}` }
312
+ };
313
+ return {
314
+ status: 'no-op',
216
315
  changed: false,
217
316
  snapshot: inspected.snapshot,
218
- operations: [],
219
- error: { code: 'GIT_TREE_MISMATCH', message: `Expected current tree ${input.expectedTree}, received ${currentTree}` }
317
+ operations: [{ name: 'commit', status: 'no-op' }],
318
+ error: null
220
319
  };
221
- return {
222
- status: 'no-op',
223
- changed: false,
224
- snapshot: inspected.snapshot,
225
- operations: [{ name: 'commit', status: 'no-op' }],
226
- error: null
227
- };
228
- })()
229
- : commitExplicitPaths({
230
- cwd: input.cwd,
231
- paths: input.paths,
232
- message: input.message,
233
- expectedHead: input.expectedHead,
234
- expectedTree: input.expectedTree
235
- });
320
+ })()
321
+ : commitExplicitPaths({
322
+ cwd: input.cwd,
323
+ paths: input.paths,
324
+ message: input.message,
325
+ expectedHead: input.expectedHead,
326
+ expectedTree: input.expectedTree
327
+ });
236
328
  if (committed.status === 'failed')
237
329
  return {
238
330
  ...committed,
@@ -243,27 +335,17 @@ function executeUnlocked(input, task, mode) {
243
335
  snapshot: committed.snapshot
244
336
  };
245
337
  const warnings = [];
246
- if (orchestrationCompletion) {
247
- try {
248
- commitOrchestrationStageCompletion(orchestrationCompletion);
249
- }
250
- catch (error) {
251
- warnings.push(warning('ORCHESTRATION_COMPLETION_FAILED', error instanceof Error ? error.message : String(error), true, 'orchestration', task?.taskId ?? 'orchestration', 'ACTION_REQUIRED'));
252
- }
253
- }
254
338
  let status = committed.status;
255
339
  let result = committed.status === 'applied' ? 'committed' : 'no_op';
256
- if (input.push) {
257
- const target = `${input.push.remote}:${input.push.refs[0]}`;
258
- const decision = commitPushDecision({ branch, automatic: input.push.automatic }, target);
340
+ if (delivery.mode === 'push') {
341
+ const target = `${delivery.remote}:${delivery.refs[0]}`;
342
+ const decision = commitPushDecision({ branch }, target);
259
343
  if (!decision.shouldPush) {
260
344
  warnings.push(decision.warning);
261
345
  }
262
346
  else {
263
347
  const pushed = pushGitRefs({
264
- cwd: input.cwd,
265
- remote: input.push.remote,
266
- refs: input.push.refs,
348
+ cwd: input.cwd, remote: delivery.remote, refs: delivery.refs,
267
349
  expectedSha: committed.snapshot?.head ?? gitText(input.cwd, ['rev-parse', 'HEAD'])
268
350
  });
269
351
  if (pushed.status !== 'applied')
@@ -275,12 +357,20 @@ function executeUnlocked(input, task, mode) {
275
357
  result = 'committed_with_warnings';
276
358
  }
277
359
  if (task && (committed.status === 'applied' || committed.status === 'no-op')) {
278
- const taskWarning = syncTaskCommit(input, task, committed.snapshot?.head ?? gitText(task.repoRoot, ['rev-parse', 'HEAD']));
360
+ const committedHead = checkpointCommittedHead ?? committed.snapshot?.head ?? gitText(task.repoRoot, ['rev-parse', 'HEAD']);
361
+ const taskWarning = syncTaskCommit(input, task, committedHead);
279
362
  if (taskWarning) {
280
363
  warnings.push(taskWarning);
281
364
  status = 'applied';
282
365
  result = 'committed_with_warnings';
283
366
  }
367
+ if (delivery.mode === 'local' && !taskWarning && pendingIntent && checkpointCommittedHead) {
368
+ const synced = updateCheckpointIntent(pendingIntent, {
369
+ state: 'synced', committedHead: checkpointCommittedHead, updatedAt: checkpointTimestamp()
370
+ });
371
+ writeCheckpointIntent(task.repoRoot, synced);
372
+ removeCheckpointIntent(task.repoRoot, task.taskId);
373
+ }
284
374
  }
285
375
  return {
286
376
  status,
@@ -1,6 +1,6 @@
1
1
  function commitPushDecision(policy, target) {
2
2
  const branch = policy.branch.trim();
3
- if (policy.automatic && (branch === 'main' || branch === 'master'))
3
+ if (branch === 'main' || branch === 'master')
4
4
  return {
5
5
  shouldPush: false,
6
6
  warning: {