@mastra/factory 0.28.0-alpha.1 → 0.28.0-alpha.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (662) hide show
  1. package/README.md +363 -162
  2. package/dist/auth.d.ts.map +1 -1
  3. package/dist/auth.js +12 -6
  4. package/dist/auth.js.map +1 -1
  5. package/dist/boards/board-events.d.ts +23 -3
  6. package/dist/boards/board-events.d.ts.map +1 -1
  7. package/dist/boards/board-events.js +44 -7
  8. package/dist/boards/board-events.js.map +1 -1
  9. package/dist/boards/board-writes.d.ts +2 -2
  10. package/dist/boards/board-writes.d.ts.map +1 -1
  11. package/dist/boards/board-writes.js +23 -9
  12. package/dist/boards/board-writes.js.map +1 -1
  13. package/dist/boards/card-facts.d.ts +3 -1
  14. package/dist/boards/card-facts.d.ts.map +1 -1
  15. package/dist/boards/card-facts.js +30 -4
  16. package/dist/boards/card-facts.js.map +1 -1
  17. package/dist/boards/default-board.d.ts +7 -0
  18. package/dist/boards/default-board.d.ts.map +1 -0
  19. package/dist/boards/default-board.js +10 -0
  20. package/dist/boards/default-board.js.map +1 -0
  21. package/dist/boards/define-board.d.ts +40 -18
  22. package/dist/boards/define-board.d.ts.map +1 -1
  23. package/dist/boards/define-board.js +64 -42
  24. package/dist/boards/define-board.js.map +1 -1
  25. package/dist/boards/index.d.ts +6 -9
  26. package/dist/boards/index.d.ts.map +1 -1
  27. package/dist/boards/index.js +6 -20
  28. package/dist/boards/intake-routing.d.ts +29 -9
  29. package/dist/boards/intake-routing.d.ts.map +1 -1
  30. package/dist/boards/intake-routing.js +72 -20
  31. package/dist/boards/intake-routing.js.map +1 -1
  32. package/dist/boards/legacy-plan-role.d.ts.map +1 -1
  33. package/dist/boards/legacy-plan-role.js +7 -2
  34. package/dist/boards/legacy-plan-role.js.map +1 -1
  35. package/dist/boards/phase-automation.d.ts +7 -0
  36. package/dist/boards/phase-automation.d.ts.map +1 -1
  37. package/dist/boards/phase-automation.js +16 -5
  38. package/dist/boards/phase-automation.js.map +1 -1
  39. package/dist/boards/phase-runner.d.ts +18 -10
  40. package/dist/boards/phase-runner.d.ts.map +1 -1
  41. package/dist/boards/phase-runner.js +39 -34
  42. package/dist/boards/phase-runner.js.map +1 -1
  43. package/dist/boards/project-boards.d.ts +57 -11
  44. package/dist/boards/project-boards.d.ts.map +1 -1
  45. package/dist/boards/project-boards.js +161 -34
  46. package/dist/boards/project-boards.js.map +1 -1
  47. package/dist/boards/registry.d.ts +7 -1
  48. package/dist/boards/registry.d.ts.map +1 -1
  49. package/dist/boards/registry.js +19 -4
  50. package/dist/boards/registry.js.map +1 -1
  51. package/dist/boards/relocate.d.ts +1 -1
  52. package/dist/boards/relocate.d.ts.map +1 -1
  53. package/dist/boards/relocate.js +3 -2
  54. package/dist/boards/relocate.js.map +1 -1
  55. package/dist/boards/review.d.ts +5 -2
  56. package/dist/boards/review.d.ts.map +1 -1
  57. package/dist/boards/review.js +12 -11
  58. package/dist/boards/review.js.map +1 -1
  59. package/dist/boards/semantics.d.ts +160 -20
  60. package/dist/boards/semantics.d.ts.map +1 -1
  61. package/dist/boards/semantics.js +255 -23
  62. package/dist/boards/semantics.js.map +1 -1
  63. package/dist/boards/stored-board.d.ts +32 -18
  64. package/dist/boards/stored-board.d.ts.map +1 -1
  65. package/dist/boards/stored-board.js +31 -97
  66. package/dist/boards/stored-board.js.map +1 -1
  67. package/dist/boards/work-migrations.d.ts +43 -0
  68. package/dist/boards/work-migrations.d.ts.map +1 -0
  69. package/dist/boards/work-migrations.js +353 -0
  70. package/dist/boards/work-migrations.js.map +1 -0
  71. package/dist/boards/work-routes.d.ts +58 -0
  72. package/dist/boards/work-routes.d.ts.map +1 -0
  73. package/dist/boards/work-routes.js +270 -0
  74. package/dist/boards/work-routes.js.map +1 -0
  75. package/dist/boards/work-seeds.d.ts +9 -0
  76. package/dist/boards/work-seeds.d.ts.map +1 -0
  77. package/dist/boards/work-seeds.js +56 -0
  78. package/dist/boards/work-seeds.js.map +1 -0
  79. package/dist/boards/work.d.ts +8 -19
  80. package/dist/boards/work.d.ts.map +1 -1
  81. package/dist/boards/work.js +33 -281
  82. package/dist/boards/work.js.map +1 -1
  83. package/dist/capabilities/version-control.d.ts +6 -1
  84. package/dist/capabilities/version-control.d.ts.map +1 -1
  85. package/dist/environment/build-runner.d.ts.map +1 -1
  86. package/dist/environment/build-runner.js +2 -2
  87. package/dist/environment/build-runner.js.map +1 -1
  88. package/dist/environment/build-schedule.js +1 -1
  89. package/dist/environment/build-schedule.js.map +1 -1
  90. package/dist/environment/build-workflow.d.ts.map +1 -1
  91. package/dist/environment/build-workflow.js +6 -5
  92. package/dist/environment/build-workflow.js.map +1 -1
  93. package/dist/environment/build.d.ts +17 -4
  94. package/dist/environment/build.d.ts.map +1 -1
  95. package/dist/environment/build.js +35 -10
  96. package/dist/environment/build.js.map +1 -1
  97. package/dist/environment/heads.d.ts +1 -1
  98. package/dist/environment/heads.d.ts.map +1 -1
  99. package/dist/environment/heads.js +4 -1
  100. package/dist/environment/heads.js.map +1 -1
  101. package/dist/environment/repository-access.d.ts +13 -0
  102. package/dist/environment/repository-access.d.ts.map +1 -0
  103. package/dist/environment/repository-access.js +55 -0
  104. package/dist/environment/repository-access.js.map +1 -0
  105. package/dist/factory.d.ts +34 -7
  106. package/dist/factory.d.ts.map +1 -1
  107. package/dist/factory.js +161 -133
  108. package/dist/factory.js.map +1 -1
  109. package/dist/feed-events.d.ts +4 -4
  110. package/dist/feed-events.d.ts.map +1 -1
  111. package/dist/feed-events.js +6 -6
  112. package/dist/feed-events.js.map +1 -1
  113. package/dist/index.d.ts +7 -2
  114. package/dist/index.d.ts.map +1 -1
  115. package/dist/index.js +5 -3
  116. package/dist/integrations/base.d.ts +6 -13
  117. package/dist/integrations/base.d.ts.map +1 -1
  118. package/dist/integrations/closing-references.d.ts +15 -0
  119. package/dist/integrations/closing-references.d.ts.map +1 -0
  120. package/dist/integrations/closing-references.js +69 -0
  121. package/dist/integrations/closing-references.js.map +1 -0
  122. package/dist/integrations/github/default-rules.d.ts +15 -66
  123. package/dist/integrations/github/default-rules.d.ts.map +1 -1
  124. package/dist/integrations/github/default-rules.js +129 -73
  125. package/dist/integrations/github/default-rules.js.map +1 -1
  126. package/dist/integrations/github/integration.d.ts.map +1 -1
  127. package/dist/integrations/github/integration.js +7 -3
  128. package/dist/integrations/github/integration.js.map +1 -1
  129. package/dist/integrations/github/issue-reconciler.d.ts.map +1 -1
  130. package/dist/integrations/github/issue-reconciler.js +5 -3
  131. package/dist/integrations/github/issue-reconciler.js.map +1 -1
  132. package/dist/integrations/github/provenance.js +1 -1
  133. package/dist/integrations/github/provenance.js.map +1 -1
  134. package/dist/integrations/github/pull-request-source.d.ts +8 -0
  135. package/dist/integrations/github/pull-request-source.d.ts.map +1 -0
  136. package/dist/integrations/github/pull-request-source.js +17 -0
  137. package/dist/integrations/github/pull-request-source.js.map +1 -0
  138. package/dist/integrations/github/reconcile-worker.d.ts +5 -1
  139. package/dist/integrations/github/reconcile-worker.d.ts.map +1 -1
  140. package/dist/integrations/github/reconcile-worker.js +39 -6
  141. package/dist/integrations/github/reconcile-worker.js.map +1 -1
  142. package/dist/integrations/github/review-status-reporter.d.ts.map +1 -1
  143. package/dist/integrations/github/review-status-reporter.js +7 -3
  144. package/dist/integrations/github/review-status-reporter.js.map +1 -1
  145. package/dist/integrations/github/routes.d.ts +4 -3
  146. package/dist/integrations/github/routes.d.ts.map +1 -1
  147. package/dist/integrations/github/routes.js +10 -87
  148. package/dist/integrations/github/routes.js.map +1 -1
  149. package/dist/integrations/github/rules.d.ts +79 -7
  150. package/dist/integrations/github/rules.d.ts.map +1 -1
  151. package/dist/integrations/github/rules.js +426 -102
  152. package/dist/integrations/github/rules.js.map +1 -1
  153. package/dist/integrations/github/sandbox.d.ts +10 -2
  154. package/dist/integrations/github/sandbox.d.ts.map +1 -1
  155. package/dist/integrations/github/sandbox.js +20 -4
  156. package/dist/integrations/github/sandbox.js.map +1 -1
  157. package/dist/integrations/github/session-subscriptions.js +2 -2
  158. package/dist/integrations/github/session-subscriptions.js.map +1 -1
  159. package/dist/integrations/github/token-refresh.d.ts +2 -1
  160. package/dist/integrations/github/token-refresh.d.ts.map +1 -1
  161. package/dist/integrations/github/token-refresh.js.map +1 -1
  162. package/dist/integrations/gitlab/agent-tools.js +1 -1
  163. package/dist/integrations/gitlab/default-rules.d.ts +73 -31
  164. package/dist/integrations/gitlab/default-rules.d.ts.map +1 -1
  165. package/dist/integrations/gitlab/default-rules.js +106 -43
  166. package/dist/integrations/gitlab/default-rules.js.map +1 -1
  167. package/dist/integrations/gitlab/issue-reconciler.d.ts.map +1 -1
  168. package/dist/integrations/gitlab/issue-reconciler.js +2 -1
  169. package/dist/integrations/gitlab/issue-reconciler.js.map +1 -1
  170. package/dist/integrations/gitlab/merge-request-reconciler.d.ts.map +1 -1
  171. package/dist/integrations/gitlab/merge-request-reconciler.js +12 -5
  172. package/dist/integrations/gitlab/merge-request-reconciler.js.map +1 -1
  173. package/dist/integrations/gitlab/routes.d.ts.map +1 -1
  174. package/dist/integrations/gitlab/routes.js +1 -3
  175. package/dist/integrations/gitlab/routes.js.map +1 -1
  176. package/dist/integrations/gitlab/rules.d.ts +6 -1
  177. package/dist/integrations/gitlab/rules.d.ts.map +1 -1
  178. package/dist/integrations/gitlab/rules.js +119 -30
  179. package/dist/integrations/gitlab/rules.js.map +1 -1
  180. package/dist/integrations/gitlab/session-subscriptions.js +1 -1
  181. package/dist/integrations/incidentio/agent-tools.js +6 -6
  182. package/dist/integrations/incidentio/agent-tools.js.map +1 -1
  183. package/dist/integrations/incidentio/default-rules.d.ts.map +1 -1
  184. package/dist/integrations/incidentio/default-rules.js +3 -3
  185. package/dist/integrations/incidentio/default-rules.js.map +1 -1
  186. package/dist/integrations/incidentio/issue-reconciler.d.ts.map +1 -1
  187. package/dist/integrations/incidentio/issue-reconciler.js +2 -1
  188. package/dist/integrations/incidentio/issue-reconciler.js.map +1 -1
  189. package/dist/integrations/incidentio/routes.d.ts +2 -2
  190. package/dist/integrations/incidentio/routes.d.ts.map +1 -1
  191. package/dist/integrations/incidentio/routes.js +10 -13
  192. package/dist/integrations/incidentio/routes.js.map +1 -1
  193. package/dist/integrations/incidentio/rules.d.ts +4 -4
  194. package/dist/integrations/incidentio/rules.d.ts.map +1 -1
  195. package/dist/integrations/incidentio/rules.js +18 -14
  196. package/dist/integrations/incidentio/rules.js.map +1 -1
  197. package/dist/integrations/issue-reconciler.js +1 -1
  198. package/dist/integrations/issue-reconciler.js.map +1 -1
  199. package/dist/integrations/jira/agent-tools.js +1 -1
  200. package/dist/integrations/jira/binding-scope.d.ts +5 -6
  201. package/dist/integrations/jira/binding-scope.d.ts.map +1 -1
  202. package/dist/integrations/jira/binding-scope.js +9 -11
  203. package/dist/integrations/jira/binding-scope.js.map +1 -1
  204. package/dist/integrations/jira/default-rules.d.ts.map +1 -1
  205. package/dist/integrations/jira/default-rules.js +3 -3
  206. package/dist/integrations/jira/default-rules.js.map +1 -1
  207. package/dist/integrations/jira/issue-reconciler.d.ts.map +1 -1
  208. package/dist/integrations/jira/issue-reconciler.js +2 -1
  209. package/dist/integrations/jira/issue-reconciler.js.map +1 -1
  210. package/dist/integrations/jira/routes.d.ts.map +1 -1
  211. package/dist/integrations/jira/routes.js +3 -5
  212. package/dist/integrations/jira/routes.js.map +1 -1
  213. package/dist/integrations/jira/rules.d.ts +4 -4
  214. package/dist/integrations/jira/rules.d.ts.map +1 -1
  215. package/dist/integrations/jira/rules.js +18 -14
  216. package/dist/integrations/jira/rules.js.map +1 -1
  217. package/dist/integrations/linear/agent-tools.d.ts +9 -1
  218. package/dist/integrations/linear/agent-tools.d.ts.map +1 -1
  219. package/dist/integrations/linear/agent-tools.js +81 -3
  220. package/dist/integrations/linear/agent-tools.js.map +1 -1
  221. package/dist/integrations/linear/default-rules.d.ts.map +1 -1
  222. package/dist/integrations/linear/default-rules.js +3 -3
  223. package/dist/integrations/linear/default-rules.js.map +1 -1
  224. package/dist/integrations/linear/integration.d.ts +4 -1
  225. package/dist/integrations/linear/integration.d.ts.map +1 -1
  226. package/dist/integrations/linear/integration.js +21 -1
  227. package/dist/integrations/linear/integration.js.map +1 -1
  228. package/dist/integrations/linear/issue-reconciler.d.ts.map +1 -1
  229. package/dist/integrations/linear/issue-reconciler.js +2 -1
  230. package/dist/integrations/linear/issue-reconciler.js.map +1 -1
  231. package/dist/integrations/linear/routes.d.ts +2 -1
  232. package/dist/integrations/linear/routes.d.ts.map +1 -1
  233. package/dist/integrations/linear/routes.js +15 -17
  234. package/dist/integrations/linear/routes.js.map +1 -1
  235. package/dist/integrations/linear/rules.d.ts +4 -4
  236. package/dist/integrations/linear/rules.d.ts.map +1 -1
  237. package/dist/integrations/linear/rules.js +16 -15
  238. package/dist/integrations/linear/rules.js.map +1 -1
  239. package/dist/integrations/platform/connect/session-tools.d.ts +5 -0
  240. package/dist/integrations/platform/connect/session-tools.d.ts.map +1 -1
  241. package/dist/integrations/platform/connect/session-tools.js +5 -0
  242. package/dist/integrations/platform/connect/session-tools.js.map +1 -1
  243. package/dist/integrations/platform/github/event-worker.d.ts +4 -1
  244. package/dist/integrations/platform/github/event-worker.d.ts.map +1 -1
  245. package/dist/integrations/platform/github/event-worker.js +39 -3
  246. package/dist/integrations/platform/github/event-worker.js.map +1 -1
  247. package/dist/integrations/platform/github/integration.d.ts +8 -0
  248. package/dist/integrations/platform/github/integration.d.ts.map +1 -1
  249. package/dist/integrations/platform/github/integration.js +143 -93
  250. package/dist/integrations/platform/github/integration.js.map +1 -1
  251. package/dist/integrations/platform/jira/agent-tools.js +1 -1
  252. package/dist/integrations/platform/jira/routes.d.ts.map +1 -1
  253. package/dist/integrations/platform/jira/routes.js +3 -5
  254. package/dist/integrations/platform/jira/routes.js.map +1 -1
  255. package/dist/integrations/platform/linear/event-worker.d.ts +1 -1
  256. package/dist/integrations/platform/linear/event-worker.d.ts.map +1 -1
  257. package/dist/integrations/platform/linear/event-worker.js +1 -1
  258. package/dist/integrations/platform/linear/event-worker.js.map +1 -1
  259. package/dist/integrations/platform/linear/integration.d.ts +1 -1
  260. package/dist/integrations/platform/linear/integration.d.ts.map +1 -1
  261. package/dist/integrations/platform/linear/integration.js +6 -5
  262. package/dist/integrations/platform/linear/integration.js.map +1 -1
  263. package/dist/integrations/slack/chat-tools.js +1 -1
  264. package/dist/integrations/slack/integration.d.ts +0 -2
  265. package/dist/integrations/slack/integration.d.ts.map +1 -1
  266. package/dist/integrations/slack/integration.js +7 -9
  267. package/dist/integrations/slack/integration.js.map +1 -1
  268. package/dist/integrations/slack/reply-tool.js +1 -1
  269. package/dist/integrations/slack/run-error-card.js +1 -0
  270. package/dist/integrations/slack/run-error-card.js.map +1 -1
  271. package/dist/integrations/slack/share-file-tool.js +1 -1
  272. package/dist/integrations/slack/slack.d.ts +13 -22
  273. package/dist/integrations/slack/slack.d.ts.map +1 -1
  274. package/dist/integrations/slack/slack.js +22 -83
  275. package/dist/integrations/slack/slack.js.map +1 -1
  276. package/dist/links.d.ts +1 -2
  277. package/dist/links.d.ts.map +1 -1
  278. package/dist/links.js +4 -4
  279. package/dist/links.js.map +1 -1
  280. package/dist/mcp/routes.js +3 -3
  281. package/dist/mcp/routes.js.map +1 -1
  282. package/dist/provider-display-name.d.ts.map +1 -1
  283. package/dist/provider-display-name.js +1 -0
  284. package/dist/provider-display-name.js.map +1 -1
  285. package/dist/routes/attention-parked.d.ts +1 -0
  286. package/dist/routes/attention-parked.d.ts.map +1 -1
  287. package/dist/routes/attention-parked.js +2 -2
  288. package/dist/routes/attention-parked.js.map +1 -1
  289. package/dist/routes/attention-providers.d.ts +0 -25
  290. package/dist/routes/attention-providers.d.ts.map +1 -1
  291. package/dist/routes/attention-providers.js +2 -150
  292. package/dist/routes/attention-providers.js.map +1 -1
  293. package/dist/routes/attention.d.ts +0 -2
  294. package/dist/routes/attention.d.ts.map +1 -1
  295. package/dist/routes/attention.js +2 -13
  296. package/dist/routes/attention.js.map +1 -1
  297. package/dist/routes/automation-runs.d.ts +5 -1
  298. package/dist/routes/automation-runs.d.ts.map +1 -1
  299. package/dist/routes/automation-runs.js +15 -0
  300. package/dist/routes/automation-runs.js.map +1 -1
  301. package/dist/routes/board-snapshot.d.ts +21 -0
  302. package/dist/routes/board-snapshot.d.ts.map +1 -0
  303. package/dist/routes/board-snapshot.js +58 -0
  304. package/dist/routes/board-snapshot.js.map +1 -0
  305. package/dist/routes/boards.d.ts +2 -2
  306. package/dist/routes/boards.d.ts.map +1 -1
  307. package/dist/routes/boards.js +1 -17
  308. package/dist/routes/boards.js.map +1 -1
  309. package/dist/routes/config.d.ts +11 -1
  310. package/dist/routes/config.d.ts.map +1 -1
  311. package/dist/routes/config.js +120 -22
  312. package/dist/routes/config.js.map +1 -1
  313. package/dist/routes/contracts.d.ts +257 -51
  314. package/dist/routes/contracts.d.ts.map +1 -1
  315. package/dist/routes/contracts.js +131 -40
  316. package/dist/routes/contracts.js.map +1 -1
  317. package/dist/routes/feed-events.d.ts +15 -0
  318. package/dist/routes/feed-events.d.ts.map +1 -0
  319. package/dist/routes/feed-events.js +68 -0
  320. package/dist/routes/feed-events.js.map +1 -0
  321. package/dist/routes/fs.d.ts +4 -0
  322. package/dist/routes/fs.d.ts.map +1 -1
  323. package/dist/routes/fs.js +8 -4
  324. package/dist/routes/fs.js.map +1 -1
  325. package/dist/routes/intake-routes.d.ts.map +1 -1
  326. package/dist/routes/intake-routes.js +6 -1
  327. package/dist/routes/intake-routes.js.map +1 -1
  328. package/dist/routes/intake.d.ts +0 -23
  329. package/dist/routes/intake.d.ts.map +1 -1
  330. package/dist/routes/intake.js +13 -309
  331. package/dist/routes/intake.js.map +1 -1
  332. package/dist/routes/knowledge.js +1 -1
  333. package/dist/routes/mastra-gateway.d.ts +19 -0
  334. package/dist/routes/mastra-gateway.d.ts.map +1 -0
  335. package/dist/routes/mastra-gateway.js +120 -0
  336. package/dist/routes/mastra-gateway.js.map +1 -0
  337. package/dist/routes/projects.d.ts +1 -1
  338. package/dist/routes/projects.d.ts.map +1 -1
  339. package/dist/routes/projects.js +74 -58
  340. package/dist/routes/projects.js.map +1 -1
  341. package/dist/routes/provider-credentials.d.ts +6 -1
  342. package/dist/routes/provider-credentials.d.ts.map +1 -1
  343. package/dist/routes/provider-credentials.js +42 -7
  344. package/dist/routes/provider-credentials.js.map +1 -1
  345. package/dist/routes/route.d.ts +6 -0
  346. package/dist/routes/route.d.ts.map +1 -1
  347. package/dist/routes/route.js.map +1 -1
  348. package/dist/routes/running-packages.d.ts +13 -0
  349. package/dist/routes/running-packages.d.ts.map +1 -0
  350. package/dist/routes/running-packages.js +45 -0
  351. package/dist/routes/running-packages.js.map +1 -0
  352. package/dist/routes/sandbox-envs.d.ts +26 -0
  353. package/dist/routes/sandbox-envs.d.ts.map +1 -0
  354. package/dist/routes/sandbox-envs.js +180 -0
  355. package/dist/routes/sandbox-envs.js.map +1 -0
  356. package/dist/routes/session-access.d.ts.map +1 -1
  357. package/dist/routes/session-access.js +12 -3
  358. package/dist/routes/session-access.js.map +1 -1
  359. package/dist/routes/surface.d.ts +10 -8
  360. package/dist/routes/surface.d.ts.map +1 -1
  361. package/dist/routes/surface.js +105 -42
  362. package/dist/routes/surface.js.map +1 -1
  363. package/dist/routes/tenant-credentials.d.ts.map +1 -1
  364. package/dist/routes/tenant-credentials.js +5 -1
  365. package/dist/routes/tenant-credentials.js.map +1 -1
  366. package/dist/routes/work-items.d.ts +0 -3
  367. package/dist/routes/work-items.d.ts.map +1 -1
  368. package/dist/routes/work-items.js +94 -12
  369. package/dist/routes/work-items.js.map +1 -1
  370. package/dist/rules/binding-context.d.ts.map +1 -1
  371. package/dist/rules/binding-context.js +1 -0
  372. package/dist/rules/binding-context.js.map +1 -1
  373. package/dist/rules/dispatcher.d.ts +0 -9
  374. package/dist/rules/dispatcher.d.ts.map +1 -1
  375. package/dist/rules/dispatcher.js +362 -69
  376. package/dist/rules/dispatcher.js.map +1 -1
  377. package/dist/rules/event-rules.d.ts +33 -2
  378. package/dist/rules/event-rules.d.ts.map +1 -1
  379. package/dist/rules/event-rules.js +46 -11
  380. package/dist/rules/event-rules.js.map +1 -1
  381. package/dist/rules/index.d.ts +2 -4
  382. package/dist/rules/index.d.ts.map +1 -1
  383. package/dist/rules/index.js +2 -3
  384. package/dist/rules/phase-goal.d.ts +54 -0
  385. package/dist/rules/phase-goal.d.ts.map +1 -0
  386. package/dist/rules/phase-goal.js +70 -0
  387. package/dist/rules/phase-goal.js.map +1 -0
  388. package/dist/rules/phase-tools.d.ts +11 -0
  389. package/dist/rules/phase-tools.d.ts.map +1 -0
  390. package/dist/rules/phase-tools.js +19 -0
  391. package/dist/rules/phase-tools.js.map +1 -0
  392. package/dist/rules/processor.d.ts.map +1 -1
  393. package/dist/rules/processor.js +116 -15
  394. package/dist/rules/processor.js.map +1 -1
  395. package/dist/rules/review-source-tool.d.ts +4 -1
  396. package/dist/rules/review-source-tool.d.ts.map +1 -1
  397. package/dist/rules/review-source-tool.js +24 -4
  398. package/dist/rules/review-source-tool.js.map +1 -1
  399. package/dist/rules/rule-group.d.ts +1 -1
  400. package/dist/rules/rule-group.d.ts.map +1 -1
  401. package/dist/rules/rule-group.js +15 -6
  402. package/dist/rules/rule-group.js.map +1 -1
  403. package/dist/rules/start-coordinator.d.ts +5 -1
  404. package/dist/rules/start-coordinator.d.ts.map +1 -1
  405. package/dist/rules/start-coordinator.js +9 -3
  406. package/dist/rules/start-coordinator.js.map +1 -1
  407. package/dist/rules/tools.d.ts.map +1 -1
  408. package/dist/rules/tools.js +39 -28
  409. package/dist/rules/tools.js.map +1 -1
  410. package/dist/rules/transition-service.d.ts +4 -10
  411. package/dist/rules/transition-service.d.ts.map +1 -1
  412. package/dist/rules/transition-service.js +61 -55
  413. package/dist/rules/transition-service.js.map +1 -1
  414. package/dist/rules/types.d.ts +86 -36
  415. package/dist/rules/types.d.ts.map +1 -1
  416. package/dist/rules/types.js +5 -41
  417. package/dist/rules/types.js.map +1 -1
  418. package/dist/rules/validation.d.ts.map +1 -1
  419. package/dist/rules/validation.js +32 -2
  420. package/dist/rules/validation.js.map +1 -1
  421. package/dist/run-error.d.ts +1 -1
  422. package/dist/run-error.d.ts.map +1 -1
  423. package/dist/run-error.js +38 -5
  424. package/dist/run-error.js.map +1 -1
  425. package/dist/sandbox/sandbox-env-cache.d.ts +33 -0
  426. package/dist/sandbox/sandbox-env-cache.d.ts.map +1 -0
  427. package/dist/sandbox/sandbox-env-cache.js +140 -0
  428. package/dist/sandbox/sandbox-env-cache.js.map +1 -0
  429. package/dist/sandbox/sandbox-env.d.ts +77 -0
  430. package/dist/sandbox/sandbox-env.d.ts.map +1 -0
  431. package/dist/sandbox/sandbox-env.js +130 -0
  432. package/dist/sandbox/sandbox-env.js.map +1 -0
  433. package/dist/secret-encryption.d.ts +21 -0
  434. package/dist/secret-encryption.d.ts.map +1 -1
  435. package/dist/secret-encryption.js +31 -4
  436. package/dist/secret-encryption.js.map +1 -1
  437. package/dist/session/live-sessions.d.ts +11 -4
  438. package/dist/session/live-sessions.d.ts.map +1 -1
  439. package/dist/session/live-sessions.js +41 -10
  440. package/dist/session/live-sessions.js.map +1 -1
  441. package/dist/session/self-review-gate.d.ts +6 -4
  442. package/dist/session/self-review-gate.d.ts.map +1 -1
  443. package/dist/session/self-review-gate.js +9 -12
  444. package/dist/session/self-review-gate.js.map +1 -1
  445. package/dist/session/session-threads.d.ts +2 -3
  446. package/dist/session/session-threads.d.ts.map +1 -1
  447. package/dist/session/session-threads.js.map +1 -1
  448. package/dist/session/source-control-tools.d.ts +39 -13
  449. package/dist/session/source-control-tools.d.ts.map +1 -1
  450. package/dist/session/source-control-tools.js +55 -61
  451. package/dist/session/source-control-tools.js.map +1 -1
  452. package/dist/session/work-item-state-processor.d.ts +24 -0
  453. package/dist/session/work-item-state-processor.d.ts.map +1 -0
  454. package/dist/session/work-item-state-processor.js +275 -0
  455. package/dist/session/work-item-state-processor.js.map +1 -0
  456. package/dist/storage/domains/audit/actions.d.ts +2 -1
  457. package/dist/storage/domains/audit/actions.d.ts.map +1 -1
  458. package/dist/storage/domains/audit/actions.js +5 -4
  459. package/dist/storage/domains/audit/actions.js.map +1 -1
  460. package/dist/storage/domains/boards/base.d.ts +85 -32
  461. package/dist/storage/domains/boards/base.d.ts.map +1 -1
  462. package/dist/storage/domains/boards/base.js +120 -131
  463. package/dist/storage/domains/boards/base.js.map +1 -1
  464. package/dist/storage/domains/boards/schemas.d.ts.map +1 -1
  465. package/dist/storage/domains/boards/schemas.js +12 -0
  466. package/dist/storage/domains/boards/schemas.js.map +1 -1
  467. package/dist/storage/domains/channel-identity/base.d.ts +0 -4
  468. package/dist/storage/domains/channel-identity/base.d.ts.map +1 -1
  469. package/dist/storage/domains/channel-identity/base.js +0 -7
  470. package/dist/storage/domains/channel-identity/base.js.map +1 -1
  471. package/dist/storage/domains/intake/base.d.ts +5 -45
  472. package/dist/storage/domains/intake/base.d.ts.map +1 -1
  473. package/dist/storage/domains/intake/base.js +11 -89
  474. package/dist/storage/domains/intake/base.js.map +1 -1
  475. package/dist/storage/domains/projects/base.d.ts +17 -9
  476. package/dist/storage/domains/projects/base.d.ts.map +1 -1
  477. package/dist/storage/domains/projects/base.js +15 -7
  478. package/dist/storage/domains/projects/base.js.map +1 -1
  479. package/dist/storage/domains/sandbox-envs/base.d.ts +70 -0
  480. package/dist/storage/domains/sandbox-envs/base.d.ts.map +1 -0
  481. package/dist/storage/domains/sandbox-envs/base.js +227 -0
  482. package/dist/storage/domains/sandbox-envs/base.js.map +1 -0
  483. package/dist/storage/domains/work-items/base.d.ts +62 -22
  484. package/dist/storage/domains/work-items/base.d.ts.map +1 -1
  485. package/dist/storage/domains/work-items/base.js +231 -146
  486. package/dist/storage/domains/work-items/base.js.map +1 -1
  487. package/dist/storage/domains/work-items/board-version.d.ts +6 -2
  488. package/dist/storage/domains/work-items/board-version.d.ts.map +1 -1
  489. package/dist/storage/domains/work-items/board-version.js +20 -9
  490. package/dist/storage/domains/work-items/board-version.js.map +1 -1
  491. package/dist/storage/domains/work-items/cards.d.ts +28 -5
  492. package/dist/storage/domains/work-items/cards.d.ts.map +1 -1
  493. package/dist/storage/domains/work-items/cards.js +156 -23
  494. package/dist/storage/domains/work-items/cards.js.map +1 -1
  495. package/dist/storage/domains/work-items/legacy-review.d.ts +63 -0
  496. package/dist/storage/domains/work-items/legacy-review.d.ts.map +1 -0
  497. package/dist/storage/domains/work-items/legacy-review.js +109 -0
  498. package/dist/storage/domains/work-items/legacy-review.js.map +1 -0
  499. package/dist/storage/domains/work-items/metrics.d.ts +12 -4
  500. package/dist/storage/domains/work-items/metrics.d.ts.map +1 -1
  501. package/dist/storage/domains/work-items/metrics.js +14 -32
  502. package/dist/storage/domains/work-items/metrics.js.map +1 -1
  503. package/dist/storage/domains/work-items/work-item-schema.d.ts +4 -2
  504. package/dist/storage/domains/work-items/work-item-schema.d.ts.map +1 -1
  505. package/dist/storage/domains/work-items/work-item-schema.js +59 -26
  506. package/dist/storage/domains/work-items/work-item-schema.js.map +1 -1
  507. package/dist/tools/approval-tools.d.ts.map +1 -1
  508. package/dist/tools/approval-tools.js +28 -9
  509. package/dist/tools/approval-tools.js.map +1 -1
  510. package/dist/tools/index.d.ts +1 -1
  511. package/dist/tools/index.js +1 -1
  512. package/dist/tools/index.js.map +1 -1
  513. package/dist/tools/messaging-tools.d.ts +3 -0
  514. package/dist/tools/messaging-tools.d.ts.map +1 -1
  515. package/dist/tools/messaging-tools.js +2 -1
  516. package/dist/tools/messaging-tools.js.map +1 -1
  517. package/dist/tools/read-tools.d.ts +8 -4
  518. package/dist/tools/read-tools.d.ts.map +1 -1
  519. package/dist/tools/read-tools.js +86 -37
  520. package/dist/tools/read-tools.js.map +1 -1
  521. package/dist/tools/reports.d.ts +1 -0
  522. package/dist/tools/reports.d.ts.map +1 -1
  523. package/dist/tools/reports.js +2 -1
  524. package/dist/tools/reports.js.map +1 -1
  525. package/dist/tools/run-watch.d.ts +1 -1
  526. package/dist/tools/run-watch.d.ts.map +1 -1
  527. package/dist/tools/run-watch.js +1 -0
  528. package/dist/tools/run-watch.js.map +1 -1
  529. package/dist/tools/sandbox-tools.js +1 -1
  530. package/dist/tools/session-tools.js +1 -1
  531. package/dist/tools/sessions-state-processor.d.ts +2 -0
  532. package/dist/tools/sessions-state-processor.d.ts.map +1 -1
  533. package/dist/tools/sessions-state-processor.js +4 -2
  534. package/dist/tools/sessions-state-processor.js.map +1 -1
  535. package/dist/tools/side-sessions.d.ts +2 -0
  536. package/dist/tools/side-sessions.d.ts.map +1 -1
  537. package/dist/tools/side-sessions.js +2 -1
  538. package/dist/tools/side-sessions.js.map +1 -1
  539. package/dist/tools/work-item-tools.d.ts +0 -3
  540. package/dist/tools/work-item-tools.d.ts.map +1 -1
  541. package/dist/tools/work-item-tools.js +10 -20
  542. package/dist/tools/work-item-tools.js.map +1 -1
  543. package/dist/work-item-branch.d.ts +13 -0
  544. package/dist/work-item-branch.d.ts.map +1 -1
  545. package/dist/work-item-branch.js +16 -1
  546. package/dist/work-item-branch.js.map +1 -1
  547. package/dist/work-items/create-work-item.d.ts +6 -0
  548. package/dist/work-items/create-work-item.d.ts.map +1 -1
  549. package/dist/work-items/create-work-item.js +28 -3
  550. package/dist/work-items/create-work-item.js.map +1 -1
  551. package/dist/work-items/description-context.d.ts +5 -0
  552. package/dist/work-items/description-context.d.ts.map +1 -0
  553. package/dist/work-items/description-context.js +17 -0
  554. package/dist/work-items/description-context.js.map +1 -0
  555. package/dist/work-items/providers/base.d.ts +4 -1
  556. package/dist/work-items/providers/base.d.ts.map +1 -1
  557. package/dist/work-items/providers/base.js +6 -1
  558. package/dist/work-items/providers/base.js.map +1 -1
  559. package/dist/work-items/providers/github.d.ts.map +1 -1
  560. package/dist/work-items/providers/github.js +2 -1
  561. package/dist/work-items/providers/github.js.map +1 -1
  562. package/dist/work-items/providers/gitlab.d.ts.map +1 -1
  563. package/dist/work-items/providers/gitlab.js +2 -1
  564. package/dist/work-items/providers/gitlab.js.map +1 -1
  565. package/dist/work-items/providers/jira.d.ts.map +1 -1
  566. package/dist/work-items/providers/jira.js +3 -2
  567. package/dist/work-items/providers/jira.js.map +1 -1
  568. package/dist/work-items/providers/linear.d.ts.map +1 -1
  569. package/dist/work-items/providers/linear.js +3 -2
  570. package/dist/work-items/providers/linear.js.map +1 -1
  571. package/dist/work-items/providers/types.d.ts +6 -0
  572. package/dist/work-items/providers/types.d.ts.map +1 -1
  573. package/dist/work-items/related-cards.d.ts +21 -0
  574. package/dist/work-items/related-cards.d.ts.map +1 -0
  575. package/dist/work-items/related-cards.js +45 -0
  576. package/dist/work-items/related-cards.js.map +1 -0
  577. package/dist/work-items/split-migration.d.ts.map +1 -1
  578. package/dist/work-items/split-migration.js +8 -8
  579. package/dist/work-items/split-migration.js.map +1 -1
  580. package/dist/workspace.d.ts +3 -1
  581. package/dist/workspace.d.ts.map +1 -1
  582. package/dist/workspace.js +122 -45
  583. package/dist/workspace.js.map +1 -1
  584. package/factory-skills/configure-factory-rules/SKILL.md +13 -11
  585. package/factory-skills/factory-build/SKILL.md +64 -0
  586. package/factory-skills/factory-gitlab-rereview/SKILL.md +4 -4
  587. package/factory-skills/factory-gitlab-review/SKILL.md +6 -6
  588. package/factory-skills/factory-plan/SKILL.md +8 -10
  589. package/factory-skills/factory-rereview/SKILL.md +74 -28
  590. package/factory-skills/factory-review/SKILL.md +85 -29
  591. package/factory-skills/factory-self-review/SKILL.md +32 -13
  592. package/factory-skills/factory-triage/SKILL.md +36 -32
  593. package/package.json +12 -12
  594. package/dist/boards/index.js.map +0 -1
  595. package/dist/boards/pull-request-review.d.ts +0 -14
  596. package/dist/boards/pull-request-review.d.ts.map +0 -1
  597. package/dist/boards/pull-request-review.js +0 -81
  598. package/dist/boards/pull-request-review.js.map +0 -1
  599. package/dist/boards/work-tool-rules.d.ts +0 -8
  600. package/dist/boards/work-tool-rules.d.ts.map +0 -1
  601. package/dist/boards/work-tool-rules.js +0 -19
  602. package/dist/boards/work-tool-rules.js.map +0 -1
  603. package/dist/integrations/slack/emoji-shortcodes.generated.d.ts +0 -8
  604. package/dist/integrations/slack/emoji-shortcodes.generated.d.ts.map +0 -1
  605. package/dist/integrations/slack/emoji-shortcodes.generated.js +0 -1984
  606. package/dist/integrations/slack/emoji-shortcodes.generated.js.map +0 -1
  607. package/dist/integrations/slack/emoji.d.ts +0 -3
  608. package/dist/integrations/slack/emoji.d.ts.map +0 -1
  609. package/dist/integrations/slack/emoji.js +0 -11
  610. package/dist/integrations/slack/emoji.js.map +0 -1
  611. package/dist/integrations/slack/feed-publisher.d.ts +0 -26
  612. package/dist/integrations/slack/feed-publisher.d.ts.map +0 -1
  613. package/dist/integrations/slack/feed-publisher.js +0 -43
  614. package/dist/integrations/slack/feed-publisher.js.map +0 -1
  615. package/dist/routes/attention-activity.d.ts +0 -23
  616. package/dist/routes/attention-activity.d.ts.map +0 -1
  617. package/dist/routes/attention-activity.js +0 -154
  618. package/dist/routes/attention-activity.js.map +0 -1
  619. package/dist/rules/resolve.d.ts +0 -15
  620. package/dist/rules/resolve.d.ts.map +0 -1
  621. package/dist/rules/resolve.js +0 -22
  622. package/dist/rules/resolve.js.map +0 -1
  623. package/dist/storage/domains/comments/activity.d.ts +0 -40
  624. package/dist/storage/domains/comments/activity.d.ts.map +0 -1
  625. package/dist/storage/domains/comments/activity.js +0 -93
  626. package/dist/storage/domains/comments/activity.js.map +0 -1
  627. package/dist/storage/domains/comments/actor.d.ts +0 -51
  628. package/dist/storage/domains/comments/actor.d.ts.map +0 -1
  629. package/dist/storage/domains/comments/actor.js +0 -37
  630. package/dist/storage/domains/comments/actor.js.map +0 -1
  631. package/dist/storage/domains/comments/base.d.ts +0 -245
  632. package/dist/storage/domains/comments/base.d.ts.map +0 -1
  633. package/dist/storage/domains/comments/base.js +0 -539
  634. package/dist/storage/domains/comments/base.js.map +0 -1
  635. package/dist/storage/domains/comments/domain.d.ts +0 -135
  636. package/dist/storage/domains/comments/domain.d.ts.map +0 -1
  637. package/dist/storage/domains/comments/domain.js +0 -284
  638. package/dist/storage/domains/comments/domain.js.map +0 -1
  639. package/dist/storage/domains/comments/feed-context.d.ts +0 -22
  640. package/dist/storage/domains/comments/feed-context.d.ts.map +0 -1
  641. package/dist/storage/domains/comments/feed-context.js +0 -88
  642. package/dist/storage/domains/comments/feed-context.js.map +0 -1
  643. package/dist/storage/domains/comments/feed-sync.d.ts +0 -21
  644. package/dist/storage/domains/comments/feed-sync.d.ts.map +0 -1
  645. package/dist/storage/domains/comments/feed-sync.js +0 -1
  646. package/dist/storage/domains/comments/parse.d.ts +0 -23
  647. package/dist/storage/domains/comments/parse.d.ts.map +0 -1
  648. package/dist/storage/domains/comments/parse.js +0 -89
  649. package/dist/storage/domains/comments/parse.js.map +0 -1
  650. package/dist/storage/domains/comments/routes.d.ts +0 -24
  651. package/dist/storage/domains/comments/routes.d.ts.map +0 -1
  652. package/dist/storage/domains/comments/routes.js +0 -299
  653. package/dist/storage/domains/comments/routes.js.map +0 -1
  654. package/dist/storage/domains/comments/schema.d.ts +0 -5
  655. package/dist/storage/domains/comments/schema.d.ts.map +0 -1
  656. package/dist/storage/domains/comments/schema.js +0 -178
  657. package/dist/storage/domains/comments/schema.js.map +0 -1
  658. package/dist/storage/domains/comments/wire.d.ts +0 -40
  659. package/dist/storage/domains/comments/wire.d.ts.map +0 -1
  660. package/dist/storage/domains/comments/wire.js +0 -36
  661. package/dist/storage/domains/comments/wire.js.map +0 -1
  662. package/factory-skills/factory-complete-issue/SKILL.md +0 -24
@@ -1,8 +1,8 @@
1
1
  import "../../boards/index.js";
2
- import { isPullRequestCard, pullRequestReviewPhase, reviewsPullRequest } from "../../boards/semantics.js";
3
- import { hasRecordedVerdict } from "../../boards/pull-request-review.js";
2
+ import { hasRecordedVerdict, isPullRequestCard, newestOpenPullRequestNumber, pullRequestSources, reviewedPullRequest, reviewsPullRequest } from "../../boards/semantics.js";
4
3
  import { requestsChangesVerdict } from "../../review-verdict.js";
5
- import { closedByRoutes, recordExplicitRuleOverrides } from "../../rules/event-rules.js";
4
+ import { closedByRoutes, pullRequestMoveByRoutes, recordExplicitRuleOverrides, routedOnly, unreviewedPullRequestCard } from "../../rules/event-rules.js";
5
+ import { isRepositoryPullRequest } from "./pull-request-source.js";
6
6
  import { isFactoryApproveVerdict } from "./stale-reviews.js";
7
7
  // src/integrations/github/default-rules.ts
8
8
  function trustedGithubActor(context) {
@@ -11,16 +11,41 @@ function trustedGithubActor(context) {
11
11
  function githubActorLogin(context) {
12
12
  return context.actor.type === "github" ? context.actor.login : void 0;
13
13
  }
14
- /** The Work card whose session authored the pull request, as opposed to the PR's own card. */
14
+ /**
15
+ * The card whose session authored the pull request, as opposed to the PR's own card, on a board
16
+ * that reviews pull requests.
17
+ */
15
18
  function authoringCard(context) {
16
- return context.board === "work" && context.item !== void 0 && !isPullRequestCard(context.item);
19
+ return context.flow?.pullRequestReview !== void 0 && context.item !== void 0 && !isPullRequestCard(context.item);
20
+ }
21
+ /** Whether the card sits in `selfReview` with an approve verdict on the head its pull request opened with. */
22
+ function selfReviewApprovedHead(context, selfReview) {
23
+ const { item, pullRequest } = context;
24
+ const metadata = item?.metadata;
25
+ const approvedHead = metadata?.selfReviewedHeadSha;
26
+ return item?.stages.length === 1 && item.stages[0] === selfReview && metadata?.selfReviewVerdict === "approve" && typeof approvedHead === "string" && pullRequest?.headSha !== void 0 && approvedHead.toLowerCase() === pullRequest.headSha;
27
+ }
28
+ /** Whether the card sits in its board's pull request review phase, alone. */
29
+ function inPullRequestReview(context) {
30
+ const phase = context.flow?.pullRequestReview;
31
+ return phase !== void 0 && context.item?.stages.length === 1 && context.item.stages[0] === phase;
32
+ }
33
+ /** Whether the rule's card carries the event's pull request as one of its sources, attached to its issue. */
34
+ function attachedPullRequest(context) {
35
+ const { item, pullRequest } = context;
36
+ if (!item || !pullRequest || isPullRequestCard(item)) return false;
37
+ return pullRequestSources(item).some((source) => isEventPullRequest(context, source));
17
38
  }
18
- /** The board holding the PR's own card: Work for new cards, Review for cards filed before PRs moved to Work. */
19
- function pullRequestCardBoard(context) {
20
- return context.board === "review" ? "review" : "work";
39
+ /** Whether a source row is the event's pull request: the same number in the same repository. */
40
+ function isEventPullRequest(context, source) {
41
+ return context.pullRequest !== void 0 && isRepositoryPullRequest(source, context.repository.id, context.repository.fullName, context.pullRequest.number);
21
42
  }
22
- function pullRequestCardNoun(context) {
23
- return context.board === "review" ? "Review card" : "pull request card";
43
+ /** Whether the card's PR review covers the event's pull request: its own, or the attached one it reviews. */
44
+ function reviewsThisPullRequest(context) {
45
+ if (!context.item || !context.pullRequest || !reviewsPullRequest(context)) return false;
46
+ if (isPullRequestCard(context.item)) return true;
47
+ const reviewed = reviewedPullRequest(context.item);
48
+ return reviewed !== void 0 && isEventPullRequest(context, reviewed);
24
49
  }
25
50
  function createdAfterFactory(createdAt, factoryCreatedAt) {
26
51
  if (!createdAt) return false;
@@ -40,16 +65,16 @@ function githubSourceKey(context, source, itemNumber) {
40
65
  return `github:${context.repository.id}:${source === "github-issue" ? "issue" : "pull-request"}:${itemNumber}`;
41
66
  }
42
67
  function issueOpened(context) {
43
- if (!context.issue) return;
68
+ if (!context.issue || !context.intake) return;
44
69
  return {
45
70
  type: "upsertLinkedWorkItem",
46
71
  idempotencyKey: `${context.ingress.id}:issue-intake`,
47
- board: context.intake?.board ?? "work",
72
+ board: context.intake.board,
48
73
  source: "github-issue",
49
74
  sourceKey: githubSourceKey(context, "github-issue", context.issue.number),
50
75
  title: context.issue.title,
51
76
  url: context.issue.url,
52
- stage: context.intake?.initialPhase ?? "intake",
77
+ stage: context.intake.initialPhase,
53
78
  metadata: {
54
79
  githubRepositoryId: context.repository.id,
55
80
  githubIssueNumber: context.issue.number,
@@ -76,17 +101,20 @@ function issueClosed(context) {
76
101
  message: { text: `GitHub issue #${context.issue.number} was closed${context.issue.stateReason ? ` (${context.issue.stateReason})` : ""}; this ${closure.boardTitle} card was moved to ${target.title}.` }
77
102
  });
78
103
  }
79
- function materializePullRequestIntake(context, { idempotencyKey, autoStartCandidate, stage = "intake" }) {
80
- if (!context.pullRequest) return;
104
+ function materializePullRequestIntake(context, { idempotencyKey, autoStartCandidate }) {
105
+ const { intake } = context;
106
+ if (!context.pullRequest || !intake) return;
107
+ const home = context.pullRequestHome;
81
108
  return {
82
109
  type: "upsertLinkedWorkItem",
83
110
  idempotencyKey,
84
- board: "work",
111
+ board: intake.board,
85
112
  source: "github-pr",
86
113
  sourceKey: githubSourceKey(context, "github-pr", context.pullRequest.number),
87
114
  title: context.pullRequest.title,
88
115
  url: context.pullRequest.url,
89
- stage,
116
+ stage: intake.initialPhase,
117
+ ...home ? home.reason === "closes" ? { closesIssue: { workItemId: home.workItemId } } : { attachTo: { workItemId: home.workItemId } } : {},
90
118
  metadata: {
91
119
  githubRepositoryId: context.repository.id,
92
120
  githubPullRequestNumber: context.pullRequest.number,
@@ -110,14 +138,16 @@ function pullRequestOpened(context) {
110
138
  if (!context.pullRequest) return;
111
139
  if (context.item && context.pullRequestIntake !== true) {
112
140
  if (!authoringCard(context) || context.pullRequest.state !== "open") return;
113
- if (!context.item.stages.includes("execute")) return;
141
+ const { build, selfReview, pullRequestReview } = context.flow ?? {};
142
+ if (!context.board || !build || !pullRequestReview) return;
143
+ if (!context.item.stages.includes(build) && !(selfReview && selfReviewApprovedHead(context, selfReview))) return;
144
+ if (attachedPullRequest(context) && !context.pullRequest.factoryAuthored) return;
114
145
  if (!trustedGithubActor(context) && !context.pullRequest.factoryAuthored) return;
115
- return {
116
- type: "transition",
146
+ return pullRequestMoveByRoutes("pull_request.opened", {
117
147
  idempotencyKey: `${context.ingress.id}:out-for-review`,
118
- board: "work",
119
- stage: "review"
120
- };
148
+ board: context.board,
149
+ stage: pullRequestReview
150
+ });
121
151
  }
122
152
  const autoStartCandidate = (trustedGithubActor(context) || context.pullRequest.factoryAuthored) && createdAfterFactory(context.pullRequest.createdAt, context.factory.createdAt);
123
153
  return materializePullRequestIntake(context, {
@@ -126,39 +156,49 @@ function pullRequestOpened(context) {
126
156
  });
127
157
  }
128
158
  function pullRequestMerged(context) {
129
- if (!context.item || !context.pullRequest?.merged) return;
130
- if (reviewsPullRequest(context)) return {
131
- type: "transition",
159
+ if (!context.item || !context.board || !context.pullRequest?.merged) return;
160
+ if (unreviewedPullRequestCard(context)) return routedOnly(context, "pull_request.merged");
161
+ const done = context.boardClosure?.completed ?? context.flow?.completed;
162
+ if (!done) return;
163
+ if (isPullRequestCard(context.item) && reviewsPullRequest(context)) return pullRequestMoveByRoutes("pull_request.merged", {
132
164
  idempotencyKey: `${context.ingress.id}:pull-request-merged`,
133
- board: pullRequestCardBoard(context),
134
- stage: "done",
135
- message: { text: `Pull request #${context.pullRequest.number} merged; this ${pullRequestCardNoun(context)} was moved to Done. No further review is needed unless follow-up work was requested.` }
136
- };
137
- if (context.board !== "work") return;
138
- const openPullRequestNumber = context.item.metadata?.openPullRequestNumber;
139
- if (typeof openPullRequestNumber === "number" && openPullRequestNumber !== context.pullRequest.number) return {
140
- type: "sendMessage",
141
- idempotencyKey: `${context.ingress.id}:work-merged`,
142
- role: "work",
143
- message: `Pull request #${context.pullRequest.number} merged. Pull request #${openPullRequestNumber} is still open, so this Work card stays in Review until it merges.`
144
- };
145
- return {
146
- type: "transition",
165
+ board: context.board,
166
+ stage: done.phase,
167
+ message: { text: `Pull request #${context.pullRequest.number} merged; this pull request card was moved to ${done.title}. No further review is needed unless follow-up work was requested.` }
168
+ });
169
+ if (!authoringCard(context)) return;
170
+ const recorded = context.item.metadata?.openPullRequestNumber;
171
+ const openPullRequestNumber = typeof recorded === "number" ? recorded : newestOpenPullRequestNumber(context.item, context.pullRequest.number);
172
+ if (typeof openPullRequestNumber === "number" && openPullRequestNumber !== context.pullRequest.number) {
173
+ const role = context.flow?.buildRole;
174
+ if (!role) return;
175
+ return {
176
+ type: "sendMessage",
177
+ idempotencyKey: `${context.ingress.id}:work-merged`,
178
+ role,
179
+ message: `Pull request #${context.pullRequest.number} merged. Pull request #${openPullRequestNumber} is still open, so this card stays where it is until it merges.`
180
+ };
181
+ }
182
+ return pullRequestMoveByRoutes("pull_request.merged", {
147
183
  idempotencyKey: `${context.ingress.id}:work-merged`,
148
- board: "work",
149
- stage: "done",
150
- message: { text: `Pull request #${context.pullRequest.number} merged; this Work card was moved to Done.` }
151
- };
184
+ board: context.board,
185
+ stage: done.phase,
186
+ message: { text: `Pull request #${context.pullRequest.number} merged; this card was moved to ${done.title}.` }
187
+ });
152
188
  }
153
189
  function addressReviewFeedback(context) {
154
190
  if (!context.item || !context.pullRequest || !context.review) return;
155
- if (!authoringCard(context)) return;
191
+ const role = context.flow?.buildRole;
192
+ if (!authoringCard(context) || !role) return;
193
+ if (attachedPullRequest(context) && !context.pullRequest.factoryAuthored) return;
156
194
  if (context.pullRequest.state !== "open" || context.pullRequest.merged) return;
157
- if (context.review.state.toLowerCase() !== "changes_requested") return;
195
+ const state = context.review.state.toLowerCase();
196
+ const factoryVerdict = state === "commented" && context.actor.type === "github" && context.actor.factoryAuthored && context.pullRequest.factoryAuthored && requestsChangesVerdict(context.review.body);
197
+ if (state !== "changes_requested" && !factoryVerdict) return;
158
198
  return {
159
199
  type: "sendMessage",
160
200
  idempotencyKey: `${context.ingress.id}:address-review-feedback`,
161
- role: "work",
201
+ role,
162
202
  priority: "high",
163
203
  message: `Changes were requested on pull request #${context.pullRequest.number} (${context.review.url}). Read the review comments on this PR, address the ones you agree with, and push the fixes to the PR branch. Reply on GitHub to anything you are deliberately not changing, explaining why.`
164
204
  };
@@ -189,27 +229,42 @@ function pullRequestReviewSubmitted(context) {
189
229
  function addressPullRequestComment(context) {
190
230
  if (context.reviewCommand) return reReviewRequestedPullRequest(context);
191
231
  if (!context.item || !context.pullRequest || !context.issueComment) return;
192
- if (!authoringCard(context)) return;
232
+ const role = context.flow?.buildRole;
233
+ if (!authoringCard(context) || !role) return;
234
+ if (attachedPullRequest(context) && !context.pullRequest.factoryAuthored) return;
193
235
  if (context.pullRequest.state !== "open" || context.pullRequest.merged) return;
194
236
  if (context.actor.type === "github" && context.actor.factoryAuthored && !requestsChangesVerdict(context.issueComment.body)) return;
195
237
  return {
196
238
  type: "sendMessage",
197
239
  idempotencyKey: `${context.ingress.id}:address-pull-request-comment`,
198
- role: "work",
240
+ role,
199
241
  priority: "high",
200
242
  message: `${context.issueComment.author ?? "Someone"} commented on pull request #${context.pullRequest.number} (${context.issueComment.url ?? context.pullRequest.url}). Read the comment, address it if you agree, and push the fixes to the PR branch. Reply on GitHub to anything you are deliberately not changing, explaining why.`
201
243
  };
202
244
  }
203
245
  function pullRequestClosed(context) {
204
- if (!context.item || !context.pullRequest || context.pullRequest.merged) return;
246
+ if (!context.item || !context.board || !context.pullRequest || context.pullRequest.merged) return;
247
+ if (unreviewedPullRequestCard(context)) return routedOnly(context, "pull_request.closed");
205
248
  if (!reviewsPullRequest(context)) return;
206
- return {
207
- type: "transition",
249
+ if (!isPullRequestCard(context.item)) {
250
+ const initialPhase = context.flow?.initialPhase;
251
+ if (!initialPhase || !attachedPullRequest(context) || !inPullRequestReview(context)) return;
252
+ if (newestOpenPullRequestNumber(context.item, context.pullRequest.number) !== null) return;
253
+ return pullRequestMoveByRoutes("pull_request.closed", {
254
+ idempotencyKey: `${context.ingress.id}:pull-request-closed`,
255
+ board: context.board,
256
+ stage: initialPhase,
257
+ message: { text: `Pull request #${context.pullRequest.number} was closed without merging; this card was moved back to ${initialPhase}.` }
258
+ });
259
+ }
260
+ const canceled = context.boardClosure?.canceled ?? context.flow?.canceled;
261
+ if (!canceled) return;
262
+ return pullRequestMoveByRoutes("pull_request.closed", {
208
263
  idempotencyKey: `${context.ingress.id}:pull-request-closed`,
209
- board: pullRequestCardBoard(context),
210
- stage: "canceled",
211
- message: { text: `Pull request #${context.pullRequest.number} was closed without merging; this ${pullRequestCardNoun(context)} was moved to Canceled.` }
212
- };
264
+ board: context.board,
265
+ stage: canceled.phase,
266
+ message: { text: `Pull request #${context.pullRequest.number} was closed without merging; this pull request card was moved to ${canceled.title}.` }
267
+ });
213
268
  }
214
269
  function reReviewRequestedPullRequest(context) {
215
270
  const factoryReviewEntry = context.reviewRequest?.factoryReviewer || context.reviewCommand !== void 0;
@@ -219,34 +274,35 @@ function reReviewRequestedPullRequest(context) {
219
274
  if (context.actor.type === "github" && context.actor.factoryAuthored) return;
220
275
  if (!context.item) return materializePullRequestIntake(context, {
221
276
  idempotencyKey: `${context.ingress.id}:pull-request-review-requested-intake`,
222
- autoStartCandidate: true,
223
- stage: "pr-review"
277
+ autoStartCandidate: true
224
278
  });
225
- const stage = pullRequestReviewPhase(context.board);
226
- const reviewing = context.item.stages.length === 1 && context.item.stages[0] === stage;
279
+ const stage = context.flow?.pullRequestReview;
280
+ if (!context.board || !stage) return;
281
+ const reviewing = inPullRequestReview(context);
282
+ if (reviewing && !reviewsThisPullRequest(context)) return;
227
283
  if (reviewing && !hasRecordedVerdict(context.item)) return;
228
- return {
229
- type: "transition",
284
+ return pullRequestMoveByRoutes("pull_request.review_requested", {
230
285
  idempotencyKey: `${context.ingress.id}:re-review-requested`,
231
- board: pullRequestCardBoard(context),
286
+ board: context.board,
232
287
  stage,
233
288
  ...reviewing ? { reenter: true } : {}
234
- };
289
+ });
235
290
  }
236
291
  function reReviewUpdatedPullRequest(context) {
237
- if (!context.item || !reviewsPullRequest(context)) return;
292
+ if (!context.item || !context.board || !reviewsPullRequest(context)) return;
238
293
  if (!context.pullRequest || context.pullRequest.state !== "open" || context.pullRequest.merged) return;
239
- if (context.item.stages.some((stage) => stage === "intake")) return;
294
+ const stage = context.flow?.pullRequestReview;
295
+ if (!stage) return;
296
+ const reviewing = inPullRequestReview(context);
297
+ if (!isPullRequestCard(context.item) && !(reviewing && reviewsThisPullRequest(context))) return;
298
+ if (context.phase?.kind === "resting") return;
240
299
  if (!trustedGithubActor(context) && !context.pullRequest.factoryAuthored) return;
241
- const stage = pullRequestReviewPhase(context.board);
242
- const alreadyReviewing = context.item.stages.some((current) => current === stage);
243
- return {
244
- type: "transition",
300
+ return pullRequestMoveByRoutes("pull_request.synchronized", {
245
301
  idempotencyKey: `${context.ingress.id}:re-review-updated`,
246
- board: pullRequestCardBoard(context),
302
+ board: context.board,
247
303
  stage,
248
- ...alreadyReviewing ? { reenter: true } : {}
249
- };
304
+ ...reviewing ? { reenter: true } : {}
305
+ });
250
306
  }
251
307
  const defaultGithubRules = Object.freeze({
252
308
  issueOpened,
@@ -1 +1 @@
1
- {"version":3,"file":"default-rules.js","names":[],"sources":["../../../src/integrations/github/default-rules.ts"],"sourcesContent":["import { isPullRequestCard, pullRequestReviewPhase, reviewsPullRequest } from '../../boards/index.js';\nimport { hasRecordedVerdict } from '../../boards/pull-request-review.js';\nimport { requestsChangesVerdict } from '../../review-verdict.js';\nimport { closedByRoutes, recordExplicitRuleOverrides } from '../../rules/event-rules.js';\nimport type { FactoryGithubEventName, FactoryGithubRuleContext, FactoryRuleHandler } from '../../rules/types.js';\nimport { isFactoryApproveVerdict } from './stale-reviews.js';\n\nexport type GithubRuleOverrides = Partial<\n Record<FactoryGithubEventName, FactoryRuleHandler<FactoryGithubRuleContext> | null | undefined>\n>;\nexport type GithubEventRules = Readonly<\n Record<FactoryGithubEventName, FactoryRuleHandler<FactoryGithubRuleContext> | null>\n>;\n\nfunction trustedGithubActor(context: Pick<FactoryGithubRuleContext, 'actor'>): boolean {\n return context.actor.type === 'github' && context.actor.trusted;\n}\n\nfunction githubActorLogin(context: Pick<FactoryGithubRuleContext, 'actor'>): string | undefined {\n return context.actor.type === 'github' ? context.actor.login : undefined;\n}\n\n/** The Work card whose session authored the pull request, as opposed to the PR's own card. */\nfunction authoringCard(context: FactoryGithubRuleContext): boolean {\n return context.board === 'work' && context.item !== undefined && !isPullRequestCard(context.item);\n}\n\n/** The board holding the PR's own card: Work for new cards, Review for cards filed before PRs moved to Work. */\nfunction pullRequestCardBoard(context: FactoryGithubRuleContext): 'work' | 'review' {\n return context.board === 'review' ? 'review' : 'work';\n}\n\nfunction pullRequestCardNoun(context: FactoryGithubRuleContext): string {\n return context.board === 'review' ? 'Review card' : 'pull request card';\n}\n\nfunction createdAfterFactory(createdAt: string | undefined, factoryCreatedAt: string): boolean {\n if (!createdAt) return false;\n const sourceCreatedAt = Date.parse(createdAt);\n const projectCreatedAt = Date.parse(factoryCreatedAt);\n return Number.isFinite(sourceCreatedAt) && Number.isFinite(projectCreatedAt) && sourceCreatedAt > projectCreatedAt;\n}\n\n/**\n * Issue and pull request numbers repeat across repositories, so new cards are\n * keyed by repository. A card this repository already owns keeps its key —\n * including canonical `github-issue:N` / `github-pr:N` keys from before\n * scoping — but only when it is the same kind of source: pull request intake\n * runs with the authoring issue as `context.item`.\n */\nfunction githubSourceKey(\n context: FactoryGithubRuleContext,\n source: 'github-issue' | 'github-pr',\n itemNumber: number,\n): string {\n if (context.item?.source === source && context.item.sourceKey) return context.item.sourceKey;\n return `github:${context.repository.id}:${source === 'github-issue' ? 'issue' : 'pull-request'}:${itemNumber}`;\n}\n\nfunction issueOpened(context: FactoryGithubRuleContext) {\n if (!context.issue) return;\n // Everything arrives on the routed board's initial phase (Work › Intake when\n // no label route selects another board). Trust/timing stamps remain available\n // to custom board rules.\n return {\n type: 'upsertLinkedWorkItem',\n idempotencyKey: `${context.ingress.id}:issue-intake`,\n board: context.intake?.board ?? 'work',\n source: 'github-issue',\n sourceKey: githubSourceKey(context, 'github-issue', context.issue.number),\n title: context.issue.title,\n url: context.issue.url,\n stage: context.intake?.initialPhase ?? 'intake',\n metadata: {\n githubRepositoryId: context.repository.id,\n githubIssueNumber: context.issue.number,\n ...(context.issue.createdAt ? { sourceCreatedAt: context.issue.createdAt } : {}),\n ...(context.issue.author || githubActorLogin(context)\n ? { author: context.issue.author ?? githubActorLogin(context) }\n : {}),\n state: context.issue.state ?? 'open',\n authorTrusted: trustedGithubActor(context),\n autoStartCandidate:\n trustedGithubActor(context) && createdAfterFactory(context.issue.createdAt, context.factory.createdAt),\n assignees: context.issue.assignees ?? [],\n labels: context.issue.labels ?? [],\n },\n } as const;\n}\n\nfunction issueClosed(context: FactoryGithubRuleContext) {\n if (!context.item || context.item.source !== 'github-issue' || !context.issue) return;\n // The project's intake routes decide where a closed source sends the card. The board's\n // `sourceClosed` mapping applies only when no route on the board handles closes; without\n // one the close goes to the routes alone (see `routeEventDecision`).\n const closure = context.boardClosure;\n if (!context.board || !closure || closure.itemTerminal) return;\n // Issue closure is a repository fact, not third-party input — no actor trust\n // gate. `not_planned` (and `duplicate`) means abandoned, everything else is\n // completed work.\n const canceled = context.issue.stateReason === 'not_planned' || context.issue.stateReason === 'duplicate';\n const target = canceled ? closure.canceled : closure.completed;\n return closedByRoutes(canceled, {\n idempotencyKey: `${context.ingress.id}:issue-closed`,\n board: context.board,\n stage: target.phase,\n message: {\n text:\n `GitHub issue #${context.issue.number} was closed` +\n `${context.issue.stateReason ? ` (${context.issue.stateReason})` : ''}; ` +\n `this ${closure.boardTitle} card was moved to ${target.title}.`,\n },\n });\n}\n\nfunction materializePullRequestIntake(\n context: FactoryGithubRuleContext,\n {\n idempotencyKey,\n autoStartCandidate,\n stage = 'intake',\n }: { idempotencyKey: string; autoStartCandidate: boolean; stage?: 'intake' | 'pr-review' },\n) {\n if (!context.pullRequest) return;\n return {\n type: 'upsertLinkedWorkItem',\n idempotencyKey,\n board: 'work',\n source: 'github-pr',\n sourceKey: githubSourceKey(context, 'github-pr', context.pullRequest.number),\n title: context.pullRequest.title,\n url: context.pullRequest.url,\n stage,\n metadata: {\n githubRepositoryId: context.repository.id,\n githubPullRequestNumber: context.pullRequest.number,\n ...(context.pullRequest.createdAt ? { sourceCreatedAt: context.pullRequest.createdAt } : {}),\n factoryAuthored: context.pullRequest.factoryAuthored,\n authorTrusted: trustedGithubActor(context),\n autoStartCandidate,\n state: context.pullRequest.state,\n draft: context.pullRequest.draft,\n merged: context.pullRequest.merged,\n assignees: context.pullRequest.assignees ?? [],\n requestedReviewers: context.pullRequest.requestedReviewers ?? [],\n labels: context.pullRequest.labels ?? [],\n headBranch: context.pullRequest.headBranch,\n baseBranch: context.pullRequest.baseBranch,\n ...(context.pullRequest.author ? { author: context.pullRequest.author } : {}),\n },\n } as const;\n}\n\nfunction pullRequestOpened(context: FactoryGithubRuleContext) {\n if (!context.pullRequest) return;\n // Opening a pull request is evaluated once per card it concerns. This rule\n // files the pull request's own card, which is the arrival — the\n // evaluation carrying `pullRequestIntake` — so the authoring Work item's own\n // evaluation only moves it out for review: Building means \"no pull request\n // yet\", Review means one is open. The card rests there through every round of\n // feedback — the builder is woken in place — until the merge closes it.\n if (context.item && context.pullRequestIntake !== true) {\n if (!authoringCard(context) || context.pullRequest.state !== 'open') return;\n if (!context.item.stages.includes('execute')) return;\n // Resolution can match a Work item by branch alone, so a fork's pull\n // request must not be able to move it: same bar as auto-starting a review.\n if (!trustedGithubActor(context) && !context.pullRequest.factoryAuthored) return;\n return {\n type: 'transition',\n idempotencyKey: `${context.ingress.id}:out-for-review`,\n board: 'work',\n stage: 'review',\n } as const;\n }\n // A GitHub App bot is never a collaborator, so Factory's own PRs score\n // untrusted; their authorship is the trust signal.\n const autoStartCandidate =\n (trustedGithubActor(context) || context.pullRequest.factoryAuthored) &&\n createdAfterFactory(context.pullRequest.createdAt, context.factory.createdAt);\n return materializePullRequestIntake(context, {\n idempotencyKey: `${context.ingress.id}:pull-request-intake`,\n autoStartCandidate,\n });\n}\n\nfunction pullRequestMerged(context: FactoryGithubRuleContext) {\n if (!context.item || !context.pullRequest?.merged) return;\n if (reviewsPullRequest(context)) {\n // The event is bound to the PR's own card: a merged PR is finished\n // review work, so always move the card to Done. The message only reaches\n // an active session (if any) — cards without one just move, instead of\n // failing retries against a binding that never existed.\n return {\n type: 'transition',\n idempotencyKey: `${context.ingress.id}:pull-request-merged`,\n board: pullRequestCardBoard(context),\n stage: 'done',\n message: {\n text:\n `Pull request #${context.pullRequest.number} merged; this ${pullRequestCardNoun(context)} was moved to Done. ` +\n 'No further review is needed unless follow-up work was requested.',\n },\n } as const;\n }\n // Custom boards define their own lifecycle and cannot accept a transition\n // targeting the built-in Work board. Let their custom rules handle the merge.\n if (context.board !== 'work') return;\n // Provenance bound the event to the originating Work item instead: the merge\n // is what finishes the work, so it closes the Work card alongside the PR's own card —\n // unless the card has since opened another pull request, which is still out.\n const openPullRequestNumber = context.item.metadata?.openPullRequestNumber;\n if (typeof openPullRequestNumber === 'number' && openPullRequestNumber !== context.pullRequest.number) {\n return {\n type: 'sendMessage',\n idempotencyKey: `${context.ingress.id}:work-merged`,\n role: 'work',\n message:\n `Pull request #${context.pullRequest.number} merged. Pull request #${openPullRequestNumber} is still open, ` +\n 'so this Work card stays in Review until it merges.',\n } as const;\n }\n return {\n type: 'transition',\n idempotencyKey: `${context.ingress.id}:work-merged`,\n board: 'work',\n stage: 'done',\n message: { text: `Pull request #${context.pullRequest.number} merged; this Work card was moved to Done.` },\n } as const;\n}\n\nfunction addressReviewFeedback(context: FactoryGithubRuleContext) {\n if (!context.item || !context.pullRequest || !context.review) return;\n // Only the Work item that authored the PR can act on the feedback. Provenance\n // binds the event there; the PR's own card seeing its posted review must not\n // react to it (that would loop the reviewer against itself).\n if (!authoringCard(context)) return;\n // A closed or merged pull request has no branch left to push fixes to.\n if (context.pullRequest.state !== 'open' || context.pullRequest.merged) return;\n // `approved` needs no work, and `commented` (a review body with no verdict)\n // is how a reviewer leaves notes without blocking — only a verdict that asks\n // for changes should pull the author back in.\n if (context.review.state.toLowerCase() !== 'changes_requested') return;\n // The authoring thread is already subscribed to this PR (`gh pr create`\n // subscribes automatically), so it can read the individual line comments\n // from its own notification inbox — the message only has to wake it and\n // point at the review.\n return {\n type: 'sendMessage',\n idempotencyKey: `${context.ingress.id}:address-review-feedback`,\n role: 'work',\n priority: 'high',\n message:\n `Changes were requested on pull request #${context.pullRequest.number} (${context.review.url}). ` +\n 'Read the review comments on this PR, address the ones you agree with, and push the fixes to the PR branch. ' +\n 'Reply on GitHub to anything you are deliberately not changing, explaining why.',\n } as const;\n}\n\n/**\n * A Factory approval does not clear a change request left by a different\n * Factory identity (an earlier reviewer token, say), so GitHub would keep the\n * pull request blocked. Ask the dispatcher to dismiss those superseded reviews.\n */\nfunction dismissStaleFactoryReviews(context: FactoryGithubRuleContext) {\n const { pullRequest, review, repository } = context;\n if (!pullRequest || !review || !review.author || !repository.installationId) return;\n if (review.state.toLowerCase() !== 'approved' || !isFactoryApproveVerdict(review.body)) return;\n if (!pullRequest.factoryAuthored || pullRequest.state !== 'open' || pullRequest.merged) return;\n return {\n type: 'dismissStaleReviews',\n idempotencyKey: `${context.ingress.id}:dismiss-stale-reviews`,\n installationId: repository.installationId,\n repository: repository.fullName,\n pullRequestNumber: pullRequest.number,\n approvingReviewId: String(review.id),\n approvingAuthor: review.author,\n } as const;\n}\n\nfunction pullRequestReviewSubmitted(context: FactoryGithubRuleContext) {\n return addressReviewFeedback(context) ?? dismissStaleFactoryReviews(context);\n}\n\nfunction addressPullRequestComment(context: FactoryGithubRuleContext) {\n // A validated Factory mention is a review-entry request, not feedback for the\n // authoring Work session. Invalid or unrecognized comments retain the normal\n // feedback route below.\n if (context.reviewCommand) return reReviewRequestedPullRequest(context);\n if (!context.item || !context.pullRequest || !context.issueComment) return;\n // Provenance binds the comment to the Work item that authored the PR — the\n // only session that can act on it. The PR's own card must not react to\n // comments on the PR it is reviewing.\n if (!authoringCard(context)) return;\n if (context.pullRequest.state !== 'open' || context.pullRequest.merged) return;\n // `factoryAuthored` is one bit for the whole Factory, so Factory's own\n // comments are indistinguishable between roles — waking on all of them would\n // let the Work agent's own progress comments wake itself in a loop. The one\n // exception is the review verdict the Review run had to post as a comment\n // because GitHub refused a self-review: that is the handoff, and it only ever\n // asks for changes once per review, so it cannot sustain a loop.\n if (\n context.actor.type === 'github' &&\n context.actor.factoryAuthored &&\n !requestsChangesVerdict(context.issueComment.body)\n ) {\n return;\n }\n return {\n type: 'sendMessage',\n idempotencyKey: `${context.ingress.id}:address-pull-request-comment`,\n role: 'work',\n priority: 'high',\n message:\n `${context.issueComment.author ?? 'Someone'} commented on pull request #${context.pullRequest.number} ` +\n `(${context.issueComment.url ?? context.pullRequest.url}). Read the comment, address it if you agree, and push ` +\n 'the fixes to the PR branch. Reply on GitHub to anything you are deliberately not changing, explaining why.',\n } as const;\n}\n\nfunction pullRequestClosed(context: FactoryGithubRuleContext) {\n if (!context.item || !context.pullRequest || context.pullRequest.merged) return;\n if (!reviewsPullRequest(context)) return;\n // A PR closed without merging is abandoned review work: clear the card off\n // the board instead of leaving it in Reviewing forever.\n return {\n type: 'transition',\n idempotencyKey: `${context.ingress.id}:pull-request-closed`,\n board: pullRequestCardBoard(context),\n stage: 'canceled',\n message: {\n text:\n `Pull request #${context.pullRequest.number} was closed without merging; ` +\n `this ${pullRequestCardNoun(context)} was moved to Canceled.`,\n },\n } as const;\n}\n\nfunction reReviewRequestedPullRequest(context: FactoryGithubRuleContext) {\n // GitHub reviewer requests and Factory's exact mention command are both\n // explicit requests to enter the same Review lifecycle.\n const factoryReviewEntry = context.reviewRequest?.factoryReviewer || context.reviewCommand !== undefined;\n if ((context.item && !reviewsPullRequest(context)) || !factoryReviewEntry) return;\n if (!context.pullRequest || context.pullRequest.state !== 'open' || context.pullRequest.merged) return;\n // Trusted (write/admin) requesters only: creating or re-entering review checks\n // out and executes PR code, the same bar pullRequestOpened applies to auto-review.\n if (!trustedGithubActor(context)) return;\n if (context.actor.type === 'github' && context.actor.factoryAuthored) return;\n if (!context.item) {\n // On this path the actor is the *requester*, so the materialized\n // `authorTrusted` stamp records their trust (always true past the gate\n // above), not the PR author's: a trusted maintainer requesting a Factory\n // review vouches for the PR.\n return materializePullRequestIntake(context, {\n idempotencyKey: `${context.ingress.id}:pull-request-review-requested-intake`,\n autoStartCandidate: true,\n stage: 'pr-review',\n });\n }\n // Already in Reviewing with no verdict yet: a pass is pending or running.\n // Once a verdict is recorded the card rests in Reviewing, so a fresh request\n // re-enters the stage to start another pass.\n const stage = pullRequestReviewPhase(context.board);\n const reviewing = context.item.stages.length === 1 && context.item.stages[0] === stage;\n if (reviewing && !hasRecordedVerdict(context.item)) return;\n return {\n type: 'transition',\n idempotencyKey: `${context.ingress.id}:re-review-requested`,\n board: pullRequestCardBoard(context),\n stage,\n ...(reviewing ? { reenter: true } : {}),\n } as const;\n}\n\nfunction reReviewUpdatedPullRequest(context: FactoryGithubRuleContext) {\n if (!context.item || !reviewsPullRequest(context)) return;\n if (!context.pullRequest || context.pullRequest.state !== 'open' || context.pullRequest.merged) return;\n // Intake has not started a review pass yet, so a push there is just more of\n // the code the first pass will read. A push to a card sitting in Reviewing is\n // different: it invalidates whatever that pass is reading, so re-enter the\n // stage to supersede it. `reviewPullRequest` cancels the stale run and picks\n // the right skill for the entry it sees.\n if (context.item.stages.some(stage => stage === 'intake')) return;\n // A fork's author controls its head branch, so an untrusted push must not be\n // able to start review passes on demand; a maintainer can still request one.\n if (!trustedGithubActor(context) && !context.pullRequest.factoryAuthored) return;\n const stage = pullRequestReviewPhase(context.board);\n const alreadyReviewing = context.item.stages.some(current => current === stage);\n return {\n type: 'transition',\n idempotencyKey: `${context.ingress.id}:re-review-updated`,\n board: pullRequestCardBoard(context),\n stage,\n // Re-entry is the point when the card is already Reviewing: the stage's\n // entry rule is what cancels the superseded pass and starts one on the code\n // that just landed.\n ...(alreadyReviewing ? { reenter: true } : {}),\n } as const;\n}\n\nexport const defaultGithubRules = Object.freeze({\n issueOpened: issueOpened,\n // Triage runs once, when a person moves the card into Triage or starts the run; later edits and\n // comments on the issue don't run it again.\n issueEdited: null,\n issueClosed: issueClosed,\n issueReopened: null,\n issueCommentCreated: null,\n issueCommentEdited: null,\n issueCommentDeleted: null,\n pullRequestOpened: pullRequestOpened,\n pullRequestUpdated: reReviewUpdatedPullRequest,\n pullRequestCommentCreated: addressPullRequestComment,\n pullRequestReviewRequested: reReviewRequestedPullRequest,\n pullRequestReviewSubmitted: pullRequestReviewSubmitted,\n pullRequestMerged: pullRequestMerged,\n pullRequestClosed: pullRequestClosed,\n} satisfies GithubEventRules);\n\nexport function resolveGithubRules(overrides?: GithubRuleOverrides): GithubEventRules {\n if (overrides !== undefined && (overrides === null || typeof overrides !== 'object' || Array.isArray(overrides))) {\n throw new Error('GitHub rules must be an object.');\n }\n const rules: Record<string, FactoryRuleHandler<FactoryGithubRuleContext> | null> = { ...defaultGithubRules };\n for (const key of Reflect.ownKeys(overrides ?? {})) {\n if (typeof key !== 'string' || !Object.hasOwn(defaultGithubRules, key)) {\n throw new Error(`Unknown GitHub rule event: ${String(key)}.`);\n }\n const handler = overrides?.[key as FactoryGithubEventName];\n if (handler !== undefined && handler !== null && typeof handler !== 'function') {\n throw new Error(`GitHub rule ${key} must be a function, null, or undefined.`);\n }\n if (handler !== undefined) rules[key] = handler;\n }\n return recordExplicitRuleOverrides(Object.freeze(rules) as GithubEventRules, overrides);\n}\n"],"mappings":";;;;;;;AAcA,SAAS,mBAAmB,SAA2D;CACrF,OAAO,QAAQ,MAAM,SAAS,YAAY,QAAQ,MAAM;AAC1D;AAEA,SAAS,iBAAiB,SAAsE;CAC9F,OAAO,QAAQ,MAAM,SAAS,WAAW,QAAQ,MAAM,QAAQ,KAAA;AACjE;;AAGA,SAAS,cAAc,SAA4C;CACjE,OAAO,QAAQ,UAAU,UAAU,QAAQ,SAAS,KAAA,KAAa,CAAC,kBAAkB,QAAQ,IAAI;AAClG;;AAGA,SAAS,qBAAqB,SAAsD;CAClF,OAAO,QAAQ,UAAU,WAAW,WAAW;AACjD;AAEA,SAAS,oBAAoB,SAA2C;CACtE,OAAO,QAAQ,UAAU,WAAW,gBAAgB;AACtD;AAEA,SAAS,oBAAoB,WAA+B,kBAAmC;CAC7F,IAAI,CAAC,WAAW,OAAO;CACvB,MAAM,kBAAkB,KAAK,MAAM,SAAS;CAC5C,MAAM,mBAAmB,KAAK,MAAM,gBAAgB;CACpD,OAAO,OAAO,SAAS,eAAe,KAAK,OAAO,SAAS,gBAAgB,KAAK,kBAAkB;AACpG;;;;;;;;AASA,SAAS,gBACP,SACA,QACA,YACQ;CACR,IAAI,QAAQ,MAAM,WAAW,UAAU,QAAQ,KAAK,WAAW,OAAO,QAAQ,KAAK;CACnF,OAAO,UAA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E,MAAM,IAAI,MAAM,eAAe,IAAI,yCAAyC;EAE9E,IAAI,YAAY,KAAA,GAAW,MAAM,OAAO;CAC1C;CACA,OAAO,4BAA4B,OAAO,OAAO,KAAK,GAAuB,SAAS;AACxF"}
1
+ {"version":3,"file":"default-rules.js","names":[],"sources":["../../../src/integrations/github/default-rules.ts"],"sourcesContent":["import {\n isPullRequestCard,\n newestOpenPullRequestNumber,\n pullRequestSourceNumber,\n pullRequestSources,\n reviewedPullRequest,\n reviewsPullRequest,\n} from '../../boards/index.js';\nimport { hasRecordedVerdict } from '../../boards/semantics.js';\nimport { requestsChangesVerdict } from '../../review-verdict.js';\nimport {\n closedByRoutes,\n pullRequestMoveByRoutes,\n recordExplicitRuleOverrides,\n routedOnly,\n unreviewedPullRequestCard,\n} from '../../rules/event-rules.js';\nimport type { FactoryGithubEventName, FactoryGithubRuleContext, FactoryRuleHandler } from '../../rules/types.js';\nimport type { WorkItemSourceRow } from '../../storage/domains/work-items/work-item-schema.js';\nimport { isRepositoryPullRequest } from './pull-request-source.js';\nimport { isFactoryApproveVerdict } from './stale-reviews.js';\n\nexport type GithubRuleOverrides = Partial<\n Record<FactoryGithubEventName, FactoryRuleHandler<FactoryGithubRuleContext> | null | undefined>\n>;\nexport type GithubEventRules = Readonly<\n Record<FactoryGithubEventName, FactoryRuleHandler<FactoryGithubRuleContext> | null>\n>;\n\nfunction trustedGithubActor(context: Pick<FactoryGithubRuleContext, 'actor'>): boolean {\n return context.actor.type === 'github' && context.actor.trusted;\n}\n\nfunction githubActorLogin(context: Pick<FactoryGithubRuleContext, 'actor'>): string | undefined {\n return context.actor.type === 'github' ? context.actor.login : undefined;\n}\n\n/**\n * The card whose session authored the pull request, as opposed to the PR's own card, on a board\n * that reviews pull requests.\n */\nfunction authoringCard(context: FactoryGithubRuleContext): boolean {\n return (\n context.flow?.pullRequestReview !== undefined && context.item !== undefined && !isPullRequestCard(context.item)\n );\n}\n\n/** Whether the card sits in `selfReview` with an approve verdict on the head its pull request opened with. */\nfunction selfReviewApprovedHead(context: FactoryGithubRuleContext, selfReview: string): boolean {\n const { item, pullRequest } = context;\n const metadata = item?.metadata;\n const approvedHead = metadata?.selfReviewedHeadSha;\n return (\n item?.stages.length === 1 &&\n item.stages[0] === selfReview &&\n metadata?.selfReviewVerdict === 'approve' &&\n typeof approvedHead === 'string' &&\n pullRequest?.headSha !== undefined &&\n approvedHead.toLowerCase() === pullRequest.headSha\n );\n}\n\n/** Whether the card sits in its board's pull request review phase, alone. */\nfunction inPullRequestReview(context: FactoryGithubRuleContext): boolean {\n const phase = context.flow?.pullRequestReview;\n return phase !== undefined && context.item?.stages.length === 1 && context.item.stages[0] === phase;\n}\n\n/** Whether the rule's card carries the event's pull request as one of its sources, attached to its issue. */\nfunction attachedPullRequest(context: FactoryGithubRuleContext): boolean {\n const { item, pullRequest } = context;\n if (!item || !pullRequest || isPullRequestCard(item)) return false;\n return pullRequestSources(item).some(source => isEventPullRequest(context, source));\n}\n\n/** Whether a source row is the event's pull request: the same number in the same repository. */\nfunction isEventPullRequest(context: FactoryGithubRuleContext, source: WorkItemSourceRow): boolean {\n return (\n context.pullRequest !== undefined &&\n isRepositoryPullRequest(source, context.repository.id, context.repository.fullName, context.pullRequest.number)\n );\n}\n\n/** Whether the card's PR review covers the event's pull request: its own, or the attached one it reviews. */\nfunction reviewsThisPullRequest(context: FactoryGithubRuleContext): boolean {\n if (!context.item || !context.pullRequest || !reviewsPullRequest(context)) return false;\n if (isPullRequestCard(context.item)) return true;\n const reviewed = reviewedPullRequest(context.item);\n return reviewed !== undefined && isEventPullRequest(context, reviewed);\n}\n\nfunction createdAfterFactory(createdAt: string | undefined, factoryCreatedAt: string): boolean {\n if (!createdAt) return false;\n const sourceCreatedAt = Date.parse(createdAt);\n const projectCreatedAt = Date.parse(factoryCreatedAt);\n return Number.isFinite(sourceCreatedAt) && Number.isFinite(projectCreatedAt) && sourceCreatedAt > projectCreatedAt;\n}\n\n/**\n * Issue and pull request numbers repeat across repositories, so new cards are\n * keyed by repository. A card this repository already owns keeps its key —\n * including canonical `github-issue:N` / `github-pr:N` keys from before\n * scoping — but only when it is the same kind of source: pull request intake\n * runs with the authoring issue as `context.item`.\n */\nfunction githubSourceKey(\n context: FactoryGithubRuleContext,\n source: 'github-issue' | 'github-pr',\n itemNumber: number,\n): string {\n if (context.item?.source === source && context.item.sourceKey) return context.item.sourceKey;\n return `github:${context.repository.id}:${source === 'github-issue' ? 'issue' : 'pull-request'}:${itemNumber}`;\n}\n\nfunction issueOpened(context: FactoryGithubRuleContext) {\n if (!context.issue || !context.intake) return;\n // Everything arrives on the default board's initial phase; the project's intake routes place\n // the card from there. Trust/timing stamps remain available to custom board rules.\n return {\n type: 'upsertLinkedWorkItem',\n idempotencyKey: `${context.ingress.id}:issue-intake`,\n board: context.intake.board,\n source: 'github-issue',\n sourceKey: githubSourceKey(context, 'github-issue', context.issue.number),\n title: context.issue.title,\n url: context.issue.url,\n stage: context.intake.initialPhase,\n metadata: {\n githubRepositoryId: context.repository.id,\n githubIssueNumber: context.issue.number,\n ...(context.issue.createdAt ? { sourceCreatedAt: context.issue.createdAt } : {}),\n ...(context.issue.author || githubActorLogin(context)\n ? { author: context.issue.author ?? githubActorLogin(context) }\n : {}),\n state: context.issue.state ?? 'open',\n authorTrusted: trustedGithubActor(context),\n autoStartCandidate:\n trustedGithubActor(context) && createdAfterFactory(context.issue.createdAt, context.factory.createdAt),\n assignees: context.issue.assignees ?? [],\n labels: context.issue.labels ?? [],\n },\n } as const;\n}\n\nfunction issueClosed(context: FactoryGithubRuleContext) {\n if (!context.item || context.item.source !== 'github-issue' || !context.issue) return;\n // The project's intake routes decide where a closed source sends the card. The board's\n // `sourceClosed` mapping applies only when no route on the board handles closes; without\n // one the close goes to the routes alone (see `routeEventDecision`).\n const closure = context.boardClosure;\n if (!context.board || !closure || closure.itemTerminal) return;\n // Issue closure is a repository fact, not third-party input — no actor trust\n // gate. `not_planned` (and `duplicate`) means abandoned, everything else is\n // completed work.\n const canceled = context.issue.stateReason === 'not_planned' || context.issue.stateReason === 'duplicate';\n const target = canceled ? closure.canceled : closure.completed;\n return closedByRoutes(canceled, {\n idempotencyKey: `${context.ingress.id}:issue-closed`,\n board: context.board,\n stage: target.phase,\n message: {\n text:\n `GitHub issue #${context.issue.number} was closed` +\n `${context.issue.stateReason ? ` (${context.issue.stateReason})` : ''}; ` +\n `this ${closure.boardTitle} card was moved to ${target.title}.`,\n },\n });\n}\n\nfunction materializePullRequestIntake(\n context: FactoryGithubRuleContext,\n { idempotencyKey, autoStartCandidate }: { idempotencyKey: string; autoStartCandidate: boolean },\n) {\n const { intake } = context;\n if (!context.pullRequest || !intake) return;\n const home = context.pullRequestHome;\n return {\n type: 'upsertLinkedWorkItem',\n idempotencyKey,\n board: intake.board,\n source: 'github-pr',\n sourceKey: githubSourceKey(context, 'github-pr', context.pullRequest.number),\n title: context.pullRequest.title,\n url: context.pullRequest.url,\n stage: intake.initialPhase,\n // A pull request for a card already on the board is filed on that card; the authoring card's\n // own evaluation moves it. For one that closes an issue on the board, the project's intake\n // routes decide whether it joins that card.\n ...(home\n ? home.reason === 'closes'\n ? { closesIssue: { workItemId: home.workItemId } }\n : { attachTo: { workItemId: home.workItemId } }\n : {}),\n metadata: {\n githubRepositoryId: context.repository.id,\n githubPullRequestNumber: context.pullRequest.number,\n ...(context.pullRequest.createdAt ? { sourceCreatedAt: context.pullRequest.createdAt } : {}),\n factoryAuthored: context.pullRequest.factoryAuthored,\n authorTrusted: trustedGithubActor(context),\n autoStartCandidate,\n state: context.pullRequest.state,\n draft: context.pullRequest.draft,\n merged: context.pullRequest.merged,\n assignees: context.pullRequest.assignees ?? [],\n requestedReviewers: context.pullRequest.requestedReviewers ?? [],\n labels: context.pullRequest.labels ?? [],\n headBranch: context.pullRequest.headBranch,\n baseBranch: context.pullRequest.baseBranch,\n ...(context.pullRequest.author ? { author: context.pullRequest.author } : {}),\n },\n } as const;\n}\n\nfunction pullRequestOpened(context: FactoryGithubRuleContext) {\n if (!context.pullRequest) return;\n // Opening a pull request is evaluated once per card it concerns. This rule\n // files the pull request's own card, which is the arrival — the\n // evaluation carrying `pullRequestIntake` — so the authoring card's own\n // evaluation only moves it out for review: from its build phase (a board\n // without self-review, or a pull request opened before self-review ran), or\n // from self-review once it approved the very head the pull request opens\n // with. Opening the pull request writes it onto the card, so the agent's own\n // move at its pre-PR revision always loses that race; the event moves the\n // card instead. It rests in the board's pull request review phase through\n // every round of feedback — the builder is woken in place — until the merge\n // closes it.\n if (context.item && context.pullRequestIntake !== true) {\n if (!authoringCard(context) || context.pullRequest.state !== 'open') return;\n const { build, selfReview, pullRequestReview } = context.flow ?? {};\n if (!context.board || !build || !pullRequestReview) return;\n if (!context.item.stages.includes(build) && !(selfReview && selfReviewApprovedHead(context, selfReview))) return;\n // Someone else's pull request attached to the issue does not mean this card's build is out.\n if (attachedPullRequest(context) && !context.pullRequest.factoryAuthored) return;\n // Resolution can match a card by branch alone, so a fork's pull\n // request must not be able to move it: same bar as auto-starting a review.\n if (!trustedGithubActor(context) && !context.pullRequest.factoryAuthored) return;\n return pullRequestMoveByRoutes('pull_request.opened', {\n idempotencyKey: `${context.ingress.id}:out-for-review`,\n board: context.board,\n stage: pullRequestReview,\n });\n }\n // A GitHub App bot is never a collaborator, so Factory's own PRs score\n // untrusted; their authorship is the trust signal.\n const autoStartCandidate =\n (trustedGithubActor(context) || context.pullRequest.factoryAuthored) &&\n createdAfterFactory(context.pullRequest.createdAt, context.factory.createdAt);\n return materializePullRequestIntake(context, {\n idempotencyKey: `${context.ingress.id}:pull-request-intake`,\n autoStartCandidate,\n });\n}\n\nfunction pullRequestMerged(context: FactoryGithubRuleContext) {\n if (!context.item || !context.board || !context.pullRequest?.merged) return;\n if (unreviewedPullRequestCard(context)) return routedOnly(context, 'pull_request.merged');\n const done = context.boardClosure?.completed ?? context.flow?.completed;\n if (!done) return;\n if (isPullRequestCard(context.item) && reviewsPullRequest(context)) {\n // The event is bound to the PR's own card: a merged PR is finished\n // review work, so always move the card to its board's completed phase. The\n // message only reaches an active session (if any) — cards without one just\n // move, instead of failing retries against a binding that never existed.\n return pullRequestMoveByRoutes('pull_request.merged', {\n idempotencyKey: `${context.ingress.id}:pull-request-merged`,\n board: context.board,\n stage: done.phase,\n message: {\n text:\n `Pull request #${context.pullRequest.number} merged; this pull request card was moved to ${done.title}. ` +\n 'No further review is needed unless follow-up work was requested.',\n },\n });\n }\n if (!authoringCard(context)) return;\n // Provenance bound the event to the card that authored the pull request instead: the merge\n // is what finishes the work, so it closes that card alongside the PR's own card —\n // unless the card has since opened another pull request, which is still out.\n // A card carrying several pull requests waits for the one it has out, else for any still open.\n const recorded = context.item.metadata?.openPullRequestNumber;\n const openPullRequestNumber =\n typeof recorded === 'number'\n ? recorded\n : newestOpenPullRequestNumber(context.item, context.pullRequest.number);\n if (typeof openPullRequestNumber === 'number' && openPullRequestNumber !== context.pullRequest.number) {\n const role = context.flow?.buildRole;\n if (!role) return;\n return {\n type: 'sendMessage',\n idempotencyKey: `${context.ingress.id}:work-merged`,\n role,\n message:\n `Pull request #${context.pullRequest.number} merged. Pull request #${openPullRequestNumber} is still open, ` +\n 'so this card stays where it is until it merges.',\n } as const;\n }\n return pullRequestMoveByRoutes('pull_request.merged', {\n idempotencyKey: `${context.ingress.id}:work-merged`,\n board: context.board,\n stage: done.phase,\n message: { text: `Pull request #${context.pullRequest.number} merged; this card was moved to ${done.title}.` },\n });\n}\n\nfunction addressReviewFeedback(context: FactoryGithubRuleContext) {\n if (!context.item || !context.pullRequest || !context.review) return;\n // Only the card that authored the PR can act on the feedback. Provenance\n // binds the event there; the PR's own card seeing its posted review must not\n // react to it (that would loop the reviewer against itself).\n const role = context.flow?.buildRole;\n if (!authoringCard(context) || !role) return;\n // Someone else's pull request attached to the issue is not the builder's to fix.\n if (attachedPullRequest(context) && !context.pullRequest.factoryAuthored) return;\n // A closed or merged pull request has no branch left to push fixes to.\n if (context.pullRequest.state !== 'open' || context.pullRequest.merged) return;\n // `approved` needs no work, and `commented` is how a reviewer leaves notes\n // without blocking — only a verdict that asks for changes should pull the\n // author back in. GitHub will not let Factory's app request changes on a pull\n // request it authored, so there Factory's own `commented` review carries the\n // verdict on its first line instead; that one counts too.\n const state = context.review.state.toLowerCase();\n const factoryVerdict =\n state === 'commented' &&\n context.actor.type === 'github' &&\n context.actor.factoryAuthored &&\n context.pullRequest.factoryAuthored &&\n requestsChangesVerdict(context.review.body);\n if (state !== 'changes_requested' && !factoryVerdict) return;\n // The authoring thread is already subscribed to this PR (`gh pr create`\n // subscribes automatically), so it can read the individual line comments\n // from its own notification inbox — the message only has to wake it and\n // point at the review.\n return {\n type: 'sendMessage',\n idempotencyKey: `${context.ingress.id}:address-review-feedback`,\n role,\n priority: 'high',\n message:\n `Changes were requested on pull request #${context.pullRequest.number} (${context.review.url}). ` +\n 'Read the review comments on this PR, address the ones you agree with, and push the fixes to the PR branch. ' +\n 'Reply on GitHub to anything you are deliberately not changing, explaining why.',\n } as const;\n}\n\n/**\n * A Factory approval does not clear a change request left by a different\n * Factory identity (an earlier reviewer token, say), so GitHub would keep the\n * pull request blocked. Ask the dispatcher to dismiss those superseded reviews.\n */\nfunction dismissStaleFactoryReviews(context: FactoryGithubRuleContext) {\n const { pullRequest, review, repository } = context;\n if (!pullRequest || !review || !review.author || !repository.installationId) return;\n if (review.state.toLowerCase() !== 'approved' || !isFactoryApproveVerdict(review.body)) return;\n if (!pullRequest.factoryAuthored || pullRequest.state !== 'open' || pullRequest.merged) return;\n return {\n type: 'dismissStaleReviews',\n idempotencyKey: `${context.ingress.id}:dismiss-stale-reviews`,\n installationId: repository.installationId,\n repository: repository.fullName,\n pullRequestNumber: pullRequest.number,\n approvingReviewId: String(review.id),\n approvingAuthor: review.author,\n } as const;\n}\n\nfunction pullRequestReviewSubmitted(context: FactoryGithubRuleContext) {\n return addressReviewFeedback(context) ?? dismissStaleFactoryReviews(context);\n}\n\nfunction addressPullRequestComment(context: FactoryGithubRuleContext) {\n // A validated Factory mention is a review-entry request, not feedback for the\n // authoring session. Invalid or unrecognized comments retain the normal\n // feedback route below.\n if (context.reviewCommand) return reReviewRequestedPullRequest(context);\n if (!context.item || !context.pullRequest || !context.issueComment) return;\n // Provenance binds the comment to the card that authored the PR — the\n // only session that can act on it. The PR's own card must not react to\n // comments on the PR it is reviewing.\n const role = context.flow?.buildRole;\n if (!authoringCard(context) || !role) return;\n if (attachedPullRequest(context) && !context.pullRequest.factoryAuthored) return;\n if (context.pullRequest.state !== 'open' || context.pullRequest.merged) return;\n // `factoryAuthored` is one bit for the whole Factory, so Factory's own\n // comments are indistinguishable between roles — waking on all of them would\n // let the builder's own progress comments wake itself in a loop. The one\n // exception is the review verdict the Review run had to post as a comment\n // because GitHub refused a self-review: that is the handoff, and it only ever\n // asks for changes once per review, so it cannot sustain a loop.\n if (\n context.actor.type === 'github' &&\n context.actor.factoryAuthored &&\n !requestsChangesVerdict(context.issueComment.body)\n ) {\n return;\n }\n return {\n type: 'sendMessage',\n idempotencyKey: `${context.ingress.id}:address-pull-request-comment`,\n role,\n priority: 'high',\n message:\n `${context.issueComment.author ?? 'Someone'} commented on pull request #${context.pullRequest.number} ` +\n `(${context.issueComment.url ?? context.pullRequest.url}). Read the comment, address it if you agree, and push ` +\n 'the fixes to the PR branch. Reply on GitHub to anything you are deliberately not changing, explaining why.',\n } as const;\n}\n\nfunction pullRequestClosed(context: FactoryGithubRuleContext) {\n if (!context.item || !context.board || !context.pullRequest || context.pullRequest.merged) return;\n if (unreviewedPullRequestCard(context)) return routedOnly(context, 'pull_request.closed');\n if (!reviewsPullRequest(context)) return;\n if (!isPullRequestCard(context.item)) {\n // An issue card waiting in pull request review on its last open pull request goes back to\n // where its board's cards rest; the issue is still open, and another pull request keeps the\n // review going.\n const initialPhase = context.flow?.initialPhase;\n if (!initialPhase || !attachedPullRequest(context) || !inPullRequestReview(context)) return;\n if (newestOpenPullRequestNumber(context.item, context.pullRequest.number) !== null) return;\n return pullRequestMoveByRoutes('pull_request.closed', {\n idempotencyKey: `${context.ingress.id}:pull-request-closed`,\n board: context.board,\n stage: initialPhase,\n message: {\n text: `Pull request #${context.pullRequest.number} was closed without merging; this card was moved back to ${initialPhase}.`,\n },\n });\n }\n // A PR closed without merging is abandoned review work: clear the card off\n // the board instead of leaving it in review forever.\n const canceled = context.boardClosure?.canceled ?? context.flow?.canceled;\n if (!canceled) return;\n return pullRequestMoveByRoutes('pull_request.closed', {\n idempotencyKey: `${context.ingress.id}:pull-request-closed`,\n board: context.board,\n stage: canceled.phase,\n message: {\n text:\n `Pull request #${context.pullRequest.number} was closed without merging; ` +\n `this pull request card was moved to ${canceled.title}.`,\n },\n });\n}\n\nfunction reReviewRequestedPullRequest(context: FactoryGithubRuleContext) {\n // GitHub reviewer requests and Factory's exact mention command are both\n // explicit requests to enter the same Review lifecycle.\n const factoryReviewEntry = context.reviewRequest?.factoryReviewer || context.reviewCommand !== undefined;\n if ((context.item && !reviewsPullRequest(context)) || !factoryReviewEntry) return;\n if (!context.pullRequest || context.pullRequest.state !== 'open' || context.pullRequest.merged) return;\n // Trusted (write/admin) requesters only: creating or re-entering review checks\n // out and executes PR code, the same bar pullRequestOpened applies to auto-review.\n if (!trustedGithubActor(context)) return;\n if (context.actor.type === 'github' && context.actor.factoryAuthored) return;\n if (!context.item) {\n // On this path the actor is the *requester*, so the materialized\n // `authorTrusted` stamp records their trust (always true past the gate\n // above), not the PR author's: a trusted maintainer requesting a Factory\n // review vouches for the PR, so the project's pull request route sends it to review.\n return materializePullRequestIntake(context, {\n idempotencyKey: `${context.ingress.id}:pull-request-review-requested-intake`,\n autoStartCandidate: true,\n });\n }\n // Already in review with no verdict yet: a pass is pending or running.\n // Once a verdict is recorded the card rests in review, so a fresh request\n // re-enters the phase to start another pass.\n const stage = context.flow?.pullRequestReview;\n if (!context.board || !stage) return;\n const reviewing = inPullRequestReview(context);\n // On an issue card the pass reviews one pull request at a time; a request for another\n // waits until that one is reviewed or settled.\n if (reviewing && !reviewsThisPullRequest(context)) return;\n if (reviewing && !hasRecordedVerdict(context.item)) return;\n return pullRequestMoveByRoutes('pull_request.review_requested', {\n idempotencyKey: `${context.ingress.id}:re-review-requested`,\n board: context.board,\n stage,\n ...(reviewing ? { reenter: true } : {}),\n });\n}\n\nfunction reReviewUpdatedPullRequest(context: FactoryGithubRuleContext) {\n if (!context.item || !context.board || !reviewsPullRequest(context)) return;\n if (!context.pullRequest || context.pullRequest.state !== 'open' || context.pullRequest.merged) return;\n const stage = context.flow?.pullRequestReview;\n if (!stage) return;\n const reviewing = inPullRequestReview(context);\n // An issue card re-reviews only while its PR review covers this pull request: a push to the\n // builder's own pull request while it builds or self-reviews is the build, not a review cue.\n if (!isPullRequestCard(context.item) && !(reviewing && reviewsThisPullRequest(context))) return;\n // A resting card has not started a review pass yet, so a push there is just\n // more of the code the first pass will read. A push to a card sitting in\n // review is different: it invalidates whatever that pass is reading, so\n // re-enter the phase to supersede it. The phase runner cancels the stale run\n // and the review skill picks the right skill for the entry it sees.\n if (context.phase?.kind === 'resting') return;\n // A fork's author controls its head branch, so an untrusted push must not be\n // able to start review passes on demand; a maintainer can still request one.\n if (!trustedGithubActor(context) && !context.pullRequest.factoryAuthored) return;\n return pullRequestMoveByRoutes('pull_request.synchronized', {\n idempotencyKey: `${context.ingress.id}:re-review-updated`,\n board: context.board,\n stage,\n // Re-entry is the point when the card is already in review: the phase's\n // entry rule is what cancels the superseded pass and starts one on the code\n // that just landed.\n ...(reviewing ? { reenter: true } : {}),\n });\n}\n\nexport const defaultGithubRules = Object.freeze({\n issueOpened: issueOpened,\n // Triage runs once, when a person moves the card into Triage or starts the run; later edits and\n // comments on the issue don't run it again.\n issueEdited: null,\n issueClosed: issueClosed,\n issueReopened: null,\n issueCommentCreated: null,\n issueCommentEdited: null,\n issueCommentDeleted: null,\n pullRequestOpened: pullRequestOpened,\n pullRequestUpdated: reReviewUpdatedPullRequest,\n pullRequestCommentCreated: addressPullRequestComment,\n pullRequestReviewRequested: reReviewRequestedPullRequest,\n pullRequestReviewSubmitted: pullRequestReviewSubmitted,\n pullRequestMerged: pullRequestMerged,\n pullRequestClosed: pullRequestClosed,\n} satisfies GithubEventRules);\n\nexport function resolveGithubRules(overrides?: GithubRuleOverrides): GithubEventRules {\n if (overrides !== undefined && (overrides === null || typeof overrides !== 'object' || Array.isArray(overrides))) {\n throw new Error('GitHub rules must be an object.');\n }\n const rules: Record<string, FactoryRuleHandler<FactoryGithubRuleContext> | null> = { ...defaultGithubRules };\n for (const key of Reflect.ownKeys(overrides ?? {})) {\n if (typeof key !== 'string' || !Object.hasOwn(defaultGithubRules, key)) {\n throw new Error(`Unknown GitHub rule event: ${String(key)}.`);\n }\n const handler = overrides?.[key as FactoryGithubEventName];\n if (handler !== undefined && handler !== null && typeof handler !== 'function') {\n throw new Error(`GitHub rule ${key} must be a function, null, or undefined.`);\n }\n if (handler !== undefined) rules[key] = handler;\n }\n return recordExplicitRuleOverrides(Object.freeze(rules) as GithubEventRules, overrides);\n}\n"],"mappings":";;;;;;;AA6BA,SAAS,mBAAmB,SAA2D;CACrF,OAAO,QAAQ,MAAM,SAAS,YAAY,QAAQ,MAAM;AAC1D;AAEA,SAAS,iBAAiB,SAAsE;CAC9F,OAAO,QAAQ,MAAM,SAAS,WAAW,QAAQ,MAAM,QAAQ,KAAA;AACjE;;;;;AAMA,SAAS,cAAc,SAA4C;CACjE,OACE,QAAQ,MAAM,sBAAsB,KAAA,KAAa,QAAQ,SAAS,KAAA,KAAa,CAAC,kBAAkB,QAAQ,IAAI;AAElH;;AAGA,SAAS,uBAAuB,SAAmC,YAA6B;CAC9F,MAAM,EAAE,MAAM,gBAAgB;CAC9B,MAAM,WAAW,MAAM;CACvB,MAAM,eAAe,UAAU;CAC/B,OACE,MAAM,OAAO,WAAW,KACxB,KAAK,OAAO,OAAO,cACnB,UAAU,sBAAsB,aAChC,OAAO,iBAAiB,YACxB,aAAa,YAAY,KAAA,KACzB,aAAa,YAAY,MAAM,YAAY;AAE/C;;AAGA,SAAS,oBAAo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nB,MAAM,EAAE,MAAM,CAAC;KAChB,GAAG,OAAO,CAAC,yBAAyB,GAAG,SAAS,CAAC,CAyBjD;IAED;;;;OAIG;IACG,eAAe,CAAC,KAAK,EAAE;QAC3B,cAAc,EAAE,MAAM,CAAC;QACvB,UAAU,EAAE,MAAM,CAAC;QACnB,MAAM,EAAE,MAAM,CAAC;KAChB,GAAG,OAAO,CAAC,mBAAmB,GAAG,SAAS,CAAC,CA2B3C;IAED;;;OAGG;IACG,mBAAmB,CAAC,KAAK,EAAE;QAC/B,cAAc,EAAE,MAAM,CAAC;QACvB,UAAU,EAAE,MAAM,CAAC;KACpB,GAAG,OAAO,CAAC,KAAK,CAAC,mBAAmB,GAAG;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC,CAgC3D;IAED;;;OAGG;IACG,0BAA0B,CAAC,KAAK,EAAE,8BAA8B,GAAG,OAAO,CAAC,+BAA+B,CAAC,CAoChH;IAED,YAAY,CAAC,EAAE,cAAc,EAAE,EAAE;QAAE,cAAc,EAAE,cAAc,CAAA;KAAE,GAAG,gBAAgB,CAErF;IAEK,gBAAgB,CAAC,EACrB,WAAW,EACX,cAAc,GACf,EAAE,UAAU,CAAC,WAAW,CAAC,kBAAkB,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAIpF;IAED,sEAAsE;IACtE,WAAW,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAKrC;CACF"}
1
+ {"version":3,"file":"integration.d.ts","sourceRoot":"","sources":["../../../src/integrations/github/integration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD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7 +3,7 @@ import { attachGithubIssueReconciler } from "./issue-reconciler.js";
3
3
  import { GithubReconcileWorker } from "./reconcile-worker.js";
4
4
  import { reconcileInterval, reconciliationEnabled } from "./reconciliation-config.js";
5
5
  import { buildGithubRoutes, ingestLinkedRepositoryBacklog } from "./routes.js";
6
- import { attachGithubReconciler, attachGithubRules } from "./rules.js";
6
+ import { attachGithubPullRequestDiscovery, attachGithubReconciler, attachGithubRules, openPullRequestLister } from "./rules.js";
7
7
  import { createGithubSubscriptionTools, parseCreatedPullRequest, subscribeCurrentSessionToPullRequest } from "./session-subscriptions.js";
8
8
  import { settleOrAbort } from "./settle-or-abort.js";
9
9
  import { createAppAuth } from "@octokit/auth-app";
@@ -1112,17 +1112,21 @@ var GithubIntegration = class {
1112
1112
  const issueEnabled = reconciliationEnabled(process.env.MASTRACODE_GITHUB_ISSUE_RECONCILE_ENABLED, process.env.MASTRACODE_GITHUB_RECONCILE_ENABLED);
1113
1113
  if (!pullRequestEnabled && !issueEnabled) return [];
1114
1114
  const reconcile = pullRequestEnabled ? attachGithubReconciler(this, ctx, (input) => this.fetchPullRequestState(input)) : void 0;
1115
+ const discover = pullRequestEnabled ? attachGithubPullRequestDiscovery(this, ctx, openPullRequestLister(this.versionControl)) : void 0;
1115
1116
  const issues = issueEnabled ? attachGithubIssueReconciler(this, ctx, (input) => this.fetchIssueState(input), (input) => this.listOpenIssueStates(input)) : void 0;
1116
- if (!reconcile && !issues) return [];
1117
+ if (!reconcile && !issues && !discover) return [];
1117
1118
  const legacyInterval = reconcileInterval(process.env.MASTRACODE_GITHUB_RECONCILE_INTERVAL_MS);
1118
1119
  const intervalMs = reconcileInterval(process.env.MASTRACODE_GITHUB_PR_RECONCILE_INTERVAL_MS) ?? legacyInterval;
1119
1120
  const issueIntervalMs = reconcileInterval(process.env.MASTRACODE_GITHUB_ISSUE_RECONCILE_INTERVAL_MS) ?? legacyInterval;
1121
+ const discoveryIntervalMs = reconcileInterval(process.env.MASTRACODE_GITHUB_PR_DISCOVERY_INTERVAL_MS);
1120
1122
  return [new GithubReconcileWorker({
1121
1123
  ...reconcile ? { reconcile } : {},
1122
1124
  ...issues ? { reconcileIssues: issues } : {},
1125
+ ...discover ? { discover } : {},
1123
1126
  sourceControl: ctx.storage.sourceControl,
1124
1127
  ...intervalMs ? { intervalMs } : {},
1125
- ...issueIntervalMs ? { issueIntervalMs } : {}
1128
+ ...issueIntervalMs ? { issueIntervalMs } : {},
1129
+ ...discoveryIntervalMs ? { discoveryIntervalMs } : {}
1126
1130
  })];
1127
1131
  }
1128
1132
  /**