pr-merge-queue 0.0.0-stage → 0.0.0

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 (331) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +125 -2
  3. package/dist/claim-pr/claim-pr.d.mts +45 -0
  4. package/dist/claim-pr/claim-pr.d.mts.map +1 -0
  5. package/dist/claim-pr/claim-pr.mjs +217 -0
  6. package/dist/claim-pr/claim-pr.mjs.map +1 -0
  7. package/dist/claim-pr/index.d.mts +2 -0
  8. package/dist/claim-pr/index.d.mts.map +1 -0
  9. package/dist/claim-pr/index.mjs +2 -0
  10. package/dist/claim-pr/index.mjs.map +1 -0
  11. package/dist/cmd/claim-pr.d.mts +3 -0
  12. package/dist/cmd/claim-pr.d.mts.map +1 -0
  13. package/dist/cmd/claim-pr.mjs +20 -0
  14. package/dist/cmd/claim-pr.mjs.map +1 -0
  15. package/dist/cmd/open-pr.d.mts +3 -0
  16. package/dist/cmd/open-pr.d.mts.map +1 -0
  17. package/dist/cmd/open-pr.mjs +20 -0
  18. package/dist/cmd/open-pr.mjs.map +1 -0
  19. package/dist/cmd/pr-report.d.mts +3 -0
  20. package/dist/cmd/pr-report.d.mts.map +1 -0
  21. package/dist/cmd/pr-report.mjs +20 -0
  22. package/dist/cmd/pr-report.mjs.map +1 -0
  23. package/dist/cmd/push-fixed-pr.d.mts +3 -0
  24. package/dist/cmd/push-fixed-pr.d.mts.map +1 -0
  25. package/dist/cmd/push-fixed-pr.mjs +20 -0
  26. package/dist/cmd/push-fixed-pr.mjs.map +1 -0
  27. package/dist/cmd/report-unowned-prs.d.mts +3 -0
  28. package/dist/cmd/report-unowned-prs.d.mts.map +1 -0
  29. package/dist/cmd/report-unowned-prs.mjs +20 -0
  30. package/dist/cmd/report-unowned-prs.mjs.map +1 -0
  31. package/dist/cmd/unblock-prs.d.mts +3 -0
  32. package/dist/cmd/unblock-prs.d.mts.map +1 -0
  33. package/dist/cmd/unblock-prs.mjs +19 -0
  34. package/dist/cmd/unblock-prs.mjs.map +1 -0
  35. package/dist/entry-point.d.mts +3 -0
  36. package/dist/entry-point.d.mts.map +1 -0
  37. package/dist/entry-point.mjs +3 -0
  38. package/dist/entry-point.mjs.map +1 -0
  39. package/dist/lib/cli-args.d.mts +27 -0
  40. package/dist/lib/cli-args.d.mts.map +1 -0
  41. package/dist/lib/cli-args.mjs +55 -0
  42. package/dist/lib/cli-args.mjs.map +1 -0
  43. package/dist/lib/github-api.d.mts +153 -0
  44. package/dist/lib/github-api.d.mts.map +1 -0
  45. package/dist/lib/github-api.mjs +291 -0
  46. package/dist/lib/github-api.mjs.map +1 -0
  47. package/dist/lib/index.d.mts +7 -0
  48. package/dist/lib/index.d.mts.map +1 -0
  49. package/dist/lib/index.mjs +7 -0
  50. package/dist/lib/index.mjs.map +1 -0
  51. package/dist/lib/json.d.mts +12 -0
  52. package/dist/lib/json.d.mts.map +1 -0
  53. package/dist/lib/json.mjs +28 -0
  54. package/dist/lib/json.mjs.map +1 -0
  55. package/dist/lib/log.d.mts +10 -0
  56. package/dist/lib/log.d.mts.map +1 -0
  57. package/dist/lib/log.mjs +13 -0
  58. package/dist/lib/log.mjs.map +1 -0
  59. package/dist/lib/shell.d.mts +18 -0
  60. package/dist/lib/shell.d.mts.map +1 -0
  61. package/dist/lib/shell.mjs +42 -0
  62. package/dist/lib/shell.mjs.map +1 -0
  63. package/dist/lib/time.d.mts +17 -0
  64. package/dist/lib/time.d.mts.map +1 -0
  65. package/dist/lib/time.mjs +35 -0
  66. package/dist/lib/time.mjs.map +1 -0
  67. package/dist/open-pr/github.d.mts +72 -0
  68. package/dist/open-pr/github.d.mts.map +1 -0
  69. package/dist/open-pr/github.mjs +249 -0
  70. package/dist/open-pr/github.mjs.map +1 -0
  71. package/dist/open-pr/index.d.mts +6 -0
  72. package/dist/open-pr/index.d.mts.map +1 -0
  73. package/dist/open-pr/index.mjs +6 -0
  74. package/dist/open-pr/index.mjs.map +1 -0
  75. package/dist/open-pr/main.d.mts +36 -0
  76. package/dist/open-pr/main.d.mts.map +1 -0
  77. package/dist/open-pr/main.mjs +204 -0
  78. package/dist/open-pr/main.mjs.map +1 -0
  79. package/dist/open-pr/options.d.mts +20 -0
  80. package/dist/open-pr/options.d.mts.map +1 -0
  81. package/dist/open-pr/options.mjs +66 -0
  82. package/dist/open-pr/options.mjs.map +1 -0
  83. package/dist/open-pr/steps.d.mts +23 -0
  84. package/dist/open-pr/steps.d.mts.map +1 -0
  85. package/dist/open-pr/steps.mjs +38 -0
  86. package/dist/open-pr/steps.mjs.map +1 -0
  87. package/dist/open-pr/types.d.mts +179 -0
  88. package/dist/open-pr/types.d.mts.map +1 -0
  89. package/dist/open-pr/types.mjs +20 -0
  90. package/dist/open-pr/types.mjs.map +1 -0
  91. package/dist/pr-report/github.d.mts +59 -0
  92. package/dist/pr-report/github.d.mts.map +1 -0
  93. package/dist/pr-report/github.mjs +561 -0
  94. package/dist/pr-report/github.mjs.map +1 -0
  95. package/dist/pr-report/index.d.mts +8 -0
  96. package/dist/pr-report/index.d.mts.map +1 -0
  97. package/dist/pr-report/index.mjs +8 -0
  98. package/dist/pr-report/index.mjs.map +1 -0
  99. package/dist/pr-report/linked-issues.d.mts +15 -0
  100. package/dist/pr-report/linked-issues.d.mts.map +1 -0
  101. package/dist/pr-report/linked-issues.mjs +39 -0
  102. package/dist/pr-report/linked-issues.mjs.map +1 -0
  103. package/dist/pr-report/main.d.mts +42 -0
  104. package/dist/pr-report/main.d.mts.map +1 -0
  105. package/dist/pr-report/main.mjs +163 -0
  106. package/dist/pr-report/main.mjs.map +1 -0
  107. package/dist/pr-report/options.d.mts +36 -0
  108. package/dist/pr-report/options.d.mts.map +1 -0
  109. package/dist/pr-report/options.mjs +90 -0
  110. package/dist/pr-report/options.mjs.map +1 -0
  111. package/dist/pr-report/queue.d.mts +28 -0
  112. package/dist/pr-report/queue.d.mts.map +1 -0
  113. package/dist/pr-report/queue.mjs +74 -0
  114. package/dist/pr-report/queue.mjs.map +1 -0
  115. package/dist/pr-report/render.d.mts +14 -0
  116. package/dist/pr-report/render.d.mts.map +1 -0
  117. package/dist/pr-report/render.mjs +318 -0
  118. package/dist/pr-report/render.mjs.map +1 -0
  119. package/dist/pr-report/repo-settings.d.mts +12 -0
  120. package/dist/pr-report/repo-settings.d.mts.map +1 -0
  121. package/dist/pr-report/repo-settings.mjs +22 -0
  122. package/dist/pr-report/repo-settings.mjs.map +1 -0
  123. package/dist/push-fixed-pr/index.d.mts +2 -0
  124. package/dist/push-fixed-pr/index.d.mts.map +1 -0
  125. package/dist/push-fixed-pr/index.mjs +2 -0
  126. package/dist/push-fixed-pr/index.mjs.map +1 -0
  127. package/dist/push-fixed-pr/push-fixed-pr.d.mts +54 -0
  128. package/dist/push-fixed-pr/push-fixed-pr.d.mts.map +1 -0
  129. package/dist/push-fixed-pr/push-fixed-pr.mjs +172 -0
  130. package/dist/push-fixed-pr/push-fixed-pr.mjs.map +1 -0
  131. package/dist/report-unowned-prs/index.d.mts +2 -0
  132. package/dist/report-unowned-prs/index.d.mts.map +1 -0
  133. package/dist/report-unowned-prs/index.mjs +2 -0
  134. package/dist/report-unowned-prs/index.mjs.map +1 -0
  135. package/dist/report-unowned-prs/report-unowned-prs.d.mts +49 -0
  136. package/dist/report-unowned-prs/report-unowned-prs.d.mts.map +1 -0
  137. package/dist/report-unowned-prs/report-unowned-prs.mjs +127 -0
  138. package/dist/report-unowned-prs/report-unowned-prs.mjs.map +1 -0
  139. package/dist/tsconfig.json +1 -0
  140. package/dist/unblock-prs/auto-fix.d.mts +45 -0
  141. package/dist/unblock-prs/auto-fix.d.mts.map +1 -0
  142. package/dist/unblock-prs/auto-fix.mjs +207 -0
  143. package/dist/unblock-prs/auto-fix.mjs.map +1 -0
  144. package/dist/unblock-prs/checks.d.mts +307 -0
  145. package/dist/unblock-prs/checks.d.mts.map +1 -0
  146. package/dist/unblock-prs/checks.mjs +372 -0
  147. package/dist/unblock-prs/checks.mjs.map +1 -0
  148. package/dist/unblock-prs/claims.d.mts +21 -0
  149. package/dist/unblock-prs/claims.d.mts.map +1 -0
  150. package/dist/unblock-prs/claims.mjs +23 -0
  151. package/dist/unblock-prs/claims.mjs.map +1 -0
  152. package/dist/unblock-prs/config.d.mts +487 -0
  153. package/dist/unblock-prs/config.d.mts.map +1 -0
  154. package/dist/unblock-prs/config.mjs +119 -0
  155. package/dist/unblock-prs/config.mjs.map +1 -0
  156. package/dist/unblock-prs/constants.d.mts +28 -0
  157. package/dist/unblock-prs/constants.d.mts.map +1 -0
  158. package/dist/unblock-prs/constants.mjs +28 -0
  159. package/dist/unblock-prs/constants.mjs.map +1 -0
  160. package/dist/unblock-prs/demotions.d.mts +42 -0
  161. package/dist/unblock-prs/demotions.d.mts.map +1 -0
  162. package/dist/unblock-prs/demotions.mjs +50 -0
  163. package/dist/unblock-prs/demotions.mjs.map +1 -0
  164. package/dist/unblock-prs/github.d.mts +739 -0
  165. package/dist/unblock-prs/github.d.mts.map +1 -0
  166. package/dist/unblock-prs/github.mjs +626 -0
  167. package/dist/unblock-prs/github.mjs.map +1 -0
  168. package/dist/unblock-prs/index.d.mts +25 -0
  169. package/dist/unblock-prs/index.d.mts.map +1 -0
  170. package/dist/unblock-prs/index.mjs +25 -0
  171. package/dist/unblock-prs/index.mjs.map +1 -0
  172. package/dist/unblock-prs/labels.d.mts +49 -0
  173. package/dist/unblock-prs/labels.d.mts.map +1 -0
  174. package/dist/unblock-prs/labels.mjs +49 -0
  175. package/dist/unblock-prs/labels.mjs.map +1 -0
  176. package/dist/unblock-prs/main.d.mts +179 -0
  177. package/dist/unblock-prs/main.d.mts.map +1 -0
  178. package/dist/unblock-prs/main.mjs +640 -0
  179. package/dist/unblock-prs/main.mjs.map +1 -0
  180. package/dist/unblock-prs/merge-after.d.mts +46 -0
  181. package/dist/unblock-prs/merge-after.d.mts.map +1 -0
  182. package/dist/unblock-prs/merge-after.mjs +65 -0
  183. package/dist/unblock-prs/merge-after.mjs.map +1 -0
  184. package/dist/unblock-prs/options.d.mts +35 -0
  185. package/dist/unblock-prs/options.d.mts.map +1 -0
  186. package/dist/unblock-prs/options.mjs +88 -0
  187. package/dist/unblock-prs/options.mjs.map +1 -0
  188. package/dist/unblock-prs/owner.d.mts +32 -0
  189. package/dist/unblock-prs/owner.d.mts.map +1 -0
  190. package/dist/unblock-prs/owner.mjs +63 -0
  191. package/dist/unblock-prs/owner.mjs.map +1 -0
  192. package/dist/unblock-prs/quiet.d.mts +21 -0
  193. package/dist/unblock-prs/quiet.d.mts.map +1 -0
  194. package/dist/unblock-prs/quiet.mjs +42 -0
  195. package/dist/unblock-prs/quiet.mjs.map +1 -0
  196. package/dist/unblock-prs/rebase.d.mts +120 -0
  197. package/dist/unblock-prs/rebase.d.mts.map +1 -0
  198. package/dist/unblock-prs/rebase.mjs +576 -0
  199. package/dist/unblock-prs/rebase.mjs.map +1 -0
  200. package/dist/unblock-prs/release.d.mts +62 -0
  201. package/dist/unblock-prs/release.d.mts.map +1 -0
  202. package/dist/unblock-prs/release.mjs +94 -0
  203. package/dist/unblock-prs/release.mjs.map +1 -0
  204. package/dist/unblock-prs/set-aside-comment.d.mts +20 -0
  205. package/dist/unblock-prs/set-aside-comment.d.mts.map +1 -0
  206. package/dist/unblock-prs/set-aside-comment.mjs +93 -0
  207. package/dist/unblock-prs/set-aside-comment.mjs.map +1 -0
  208. package/dist/unblock-prs/set-aside-detail.d.mts +41 -0
  209. package/dist/unblock-prs/set-aside-detail.d.mts.map +1 -0
  210. package/dist/unblock-prs/set-aside-detail.mjs +56 -0
  211. package/dist/unblock-prs/set-aside-detail.mjs.map +1 -0
  212. package/dist/unblock-prs/skips.d.mts +85 -0
  213. package/dist/unblock-prs/skips.d.mts.map +1 -0
  214. package/dist/unblock-prs/skips.mjs +141 -0
  215. package/dist/unblock-prs/skips.mjs.map +1 -0
  216. package/dist/unblock-prs/stack.d.mts +98 -0
  217. package/dist/unblock-prs/stack.d.mts.map +1 -0
  218. package/dist/unblock-prs/stack.mjs +141 -0
  219. package/dist/unblock-prs/stack.mjs.map +1 -0
  220. package/dist/unblock-prs/triage.d.mts +28 -0
  221. package/dist/unblock-prs/triage.d.mts.map +1 -0
  222. package/dist/unblock-prs/triage.mjs +396 -0
  223. package/dist/unblock-prs/triage.mjs.map +1 -0
  224. package/dist/unblock-prs/types.d.mts +793 -0
  225. package/dist/unblock-prs/types.d.mts.map +1 -0
  226. package/dist/unblock-prs/types.mjs +26 -0
  227. package/dist/unblock-prs/types.mjs.map +1 -0
  228. package/dist/unblock-prs/util.d.mts +23 -0
  229. package/dist/unblock-prs/util.d.mts.map +1 -0
  230. package/dist/unblock-prs/util.mjs +60 -0
  231. package/dist/unblock-prs/util.mjs.map +1 -0
  232. package/dist/unblock-prs/version-pr.d.mts +57 -0
  233. package/dist/unblock-prs/version-pr.d.mts.map +1 -0
  234. package/dist/unblock-prs/version-pr.mjs +79 -0
  235. package/dist/unblock-prs/version-pr.mjs.map +1 -0
  236. package/dist/unblock-prs/watch.d.mts +17 -0
  237. package/dist/unblock-prs/watch.d.mts.map +1 -0
  238. package/dist/unblock-prs/watch.mjs +128 -0
  239. package/dist/unblock-prs/watch.mjs.map +1 -0
  240. package/package.json +118 -3
  241. package/src/claim-pr/claim-pr.mts +380 -0
  242. package/src/claim-pr/claim-pr.test.mts +176 -0
  243. package/src/claim-pr/index.mts +1 -0
  244. package/src/cmd/claim-pr.mts +32 -0
  245. package/src/cmd/open-pr.mts +28 -0
  246. package/src/cmd/pr-report.mts +28 -0
  247. package/src/cmd/push-fixed-pr.mts +36 -0
  248. package/src/cmd/report-unowned-prs.mts +37 -0
  249. package/src/cmd/unblock-prs.mts +24 -0
  250. package/src/entry-point.mts +3 -0
  251. package/src/lib/cli-args.mts +86 -0
  252. package/src/lib/cli-args.test.mts +92 -0
  253. package/src/lib/github-api.mts +463 -0
  254. package/src/lib/github-api.test.mts +40 -0
  255. package/src/lib/index.mts +6 -0
  256. package/src/lib/json.mts +43 -0
  257. package/src/lib/json.test.mts +34 -0
  258. package/src/lib/log.mts +19 -0
  259. package/src/lib/log.test.mts +45 -0
  260. package/src/lib/shell.mts +52 -0
  261. package/src/lib/time.mts +49 -0
  262. package/src/open-pr/README.md +237 -0
  263. package/src/open-pr/github.mts +444 -0
  264. package/src/open-pr/index.mts +5 -0
  265. package/src/open-pr/main.mts +327 -0
  266. package/src/open-pr/options.mts +101 -0
  267. package/src/open-pr/options.test.mts +67 -0
  268. package/src/open-pr/steps.mts +57 -0
  269. package/src/open-pr/steps.test.mts +59 -0
  270. package/src/open-pr/types.mts +42 -0
  271. package/src/pr-report/README.md +244 -0
  272. package/src/pr-report/github.mts +911 -0
  273. package/src/pr-report/index.mts +7 -0
  274. package/src/pr-report/linked-issues.mts +51 -0
  275. package/src/pr-report/linked-issues.test.mts +65 -0
  276. package/src/pr-report/main.mts +257 -0
  277. package/src/pr-report/options.mts +140 -0
  278. package/src/pr-report/queue.mts +125 -0
  279. package/src/pr-report/render.mts +428 -0
  280. package/src/pr-report/render.test.mts +379 -0
  281. package/src/pr-report/repo-settings.mts +34 -0
  282. package/src/push-fixed-pr/index.mts +1 -0
  283. package/src/push-fixed-pr/push-fixed-pr.mts +276 -0
  284. package/src/push-fixed-pr/push-fixed-pr.test.mts +228 -0
  285. package/src/report-unowned-prs/index.mts +1 -0
  286. package/src/report-unowned-prs/report-unowned-prs.mts +190 -0
  287. package/src/report-unowned-prs/report-unowned-prs.test.mts +87 -0
  288. package/src/unblock-prs/README.md +1616 -0
  289. package/src/unblock-prs/auto-fix.mts +334 -0
  290. package/src/unblock-prs/auto-fix.test.mts +159 -0
  291. package/src/unblock-prs/checks.mts +538 -0
  292. package/src/unblock-prs/checks.test.mts +507 -0
  293. package/src/unblock-prs/claims.mts +33 -0
  294. package/src/unblock-prs/claims.test.mts +64 -0
  295. package/src/unblock-prs/config.mts +187 -0
  296. package/src/unblock-prs/config.schema.json +71 -0
  297. package/src/unblock-prs/config.test.mts +139 -0
  298. package/src/unblock-prs/constants.mts +33 -0
  299. package/src/unblock-prs/demotions.mts +73 -0
  300. package/src/unblock-prs/demotions.test.mts +100 -0
  301. package/src/unblock-prs/github.mts +1042 -0
  302. package/src/unblock-prs/github.test.mts +84 -0
  303. package/src/unblock-prs/index.mts +24 -0
  304. package/src/unblock-prs/labels.mts +70 -0
  305. package/src/unblock-prs/main.mts +1051 -0
  306. package/src/unblock-prs/merge-after.mts +117 -0
  307. package/src/unblock-prs/merge-after.test.mts +120 -0
  308. package/src/unblock-prs/options.mts +157 -0
  309. package/src/unblock-prs/owner.mts +91 -0
  310. package/src/unblock-prs/owner.test.mts +114 -0
  311. package/src/unblock-prs/quiet.mts +62 -0
  312. package/src/unblock-prs/quiet.test.mts +175 -0
  313. package/src/unblock-prs/rebase.mts +962 -0
  314. package/src/unblock-prs/release.mts +149 -0
  315. package/src/unblock-prs/release.test.mts +209 -0
  316. package/src/unblock-prs/set-aside-comment.mts +143 -0
  317. package/src/unblock-prs/set-aside-comment.test.mts +148 -0
  318. package/src/unblock-prs/set-aside-detail.mts +82 -0
  319. package/src/unblock-prs/set-aside-detail.test.mts +131 -0
  320. package/src/unblock-prs/skips.mts +215 -0
  321. package/src/unblock-prs/skips.test.mts +280 -0
  322. package/src/unblock-prs/stack.mts +220 -0
  323. package/src/unblock-prs/stack.test.mts +449 -0
  324. package/src/unblock-prs/triage.mts +669 -0
  325. package/src/unblock-prs/triage.test.mts +100 -0
  326. package/src/unblock-prs/types.mts +358 -0
  327. package/src/unblock-prs/util.mts +78 -0
  328. package/src/unblock-prs/util.test.mts +26 -0
  329. package/src/unblock-prs/version-pr.mts +112 -0
  330. package/src/unblock-prs/version-pr.test.mts +78 -0
  331. package/src/unblock-prs/watch.mts +219 -0
@@ -0,0 +1,39 @@
1
+
2
+ import { outsideCodeFences } from 'pr-report-core';
3
+ import { Arr, Num, Result } from 'ts-data-forge';
4
+
5
+
6
+
7
+
8
+
9
+
10
+
11
+
12
+ const CLOSING_REFERENCE = /\b(?:close[sd]?|fix(?:e[sd])?|resolve[sd]?)\b[^\S\n]*:?[^\S\n]*(?:#(?<number>\d+)|https:\/\/github\.com\/(?<owner>[\w.-]+)\/(?<repo>[\w.-]+)\/issues\/(?<urlNumber>\d+))\b/giu;
13
+
14
+
15
+
16
+
17
+
18
+
19
+
20
+
21
+
22
+
23
+
24
+ export const parseClosingIssueRefs = (body, repo) => Arr.uniq(outsideCodeFences(body)
25
+ .matchAll(CLOSING_REFERENCE)
26
+ .flatMap((match) => {
27
+ const { number, owner, repo: name, urlNumber } = match.groups ?? {};
28
+ return number !== undefined
29
+ ? readNumber(number)
30
+ : owner === repo.owner && name === repo.name
31
+ ? readNumber(urlNumber ?? '')
32
+ : [];
33
+ })
34
+ .toArray());
35
+ const readNumber = (raw) => {
36
+ const parsed = Num.safeParseInt(raw);
37
+ return Result.isOk(parsed) ? [parsed.value] : [];
38
+ };
39
+ //# sourceMappingURL=linked-issues.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"linked-issues.mjs","sourceRoot":"","sources":["../../src/pr-report/linked-issues.mts"],"names":[],"mappings":"AAAA,qDAAqD;AAErD,OAAO,EAAE,iBAAiB,EAAgB,MAAM,gBAAgB,CAAC;AACjE,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEjD;;;;;;;GAOG;AACH,MAAM,iBAAiB,GACrB,+KAA+K,CAAC;AAElL;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CACnC,IAAY,EACZ,IAAa,EACM,EAAE,CACrB,GAAG,CAAC,IAAI,CACN,iBAAiB,CAAC,IAAI,CAAC;KACpB,QAAQ,CAAC,iBAAiB,CAAC;KAC3B,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;IACjB,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,KAAK,CAAC,MAAM,IAAI,EAAE,CAAC;IAEpE,OAAO,MAAM,KAAK,SAAS;QACzB,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC;QACpB,CAAC,CAAC,KAAK,KAAK,IAAI,CAAC,KAAK,IAAI,IAAI,KAAK,IAAI,CAAC,IAAI;YAC1C,CAAC,CAAC,UAAU,CAAC,SAAS,IAAI,EAAE,CAAC;YAC7B,CAAC,CAAC,EAAE,CAAC;AACX,CAAC,CAAC;KACD,OAAO,EAAE,CACb,CAAC;AAEJ,MAAM,UAAU,GAAG,CAAC,GAAW,EAAqB,EAAE;IACpD,MAAM,MAAM,GAAG,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;IAErC,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AACnD,CAAC,CAAC"}
@@ -0,0 +1,42 @@
1
+ import { Result } from 'ts-data-forge';
2
+ import type { Options } from './options.mjs';
3
+ /**
4
+ * Reports the state of every open pull request, in one page.
5
+ *
6
+ * What it answers, and why each part is here rather than a click away on
7
+ * GitHub:
8
+ *
9
+ * - **The merge order.** The `Merge-After:` trailers and the stacks — a pull
10
+ * request onto another's branch — describe a graph that the pull request
11
+ * list cannot show at all; a stack of four reads as four unrelated rows
12
+ * there. Drawn as a tree, the one at the top is the one to look at.
13
+ * - **The issues each pull request closes**, so that "what is this for" does
14
+ * not need the body opened.
15
+ * - **The labels**, because `skip-ci` and `merge-queued` are how this
16
+ * repository says "not yet" and "ready", and neither means anything until
17
+ * someone reads them.
18
+ * - **The verdict of the checks the ruleset requires**, which is not the same
19
+ * as the checks that ran: a required context with nothing reported sits as
20
+ * "Expected — waiting" forever, and a red aggregate does not name what
21
+ * failed. Both are said here by name.
22
+ * - **How far ahead and behind the branch is.** A branch behind its base runs
23
+ * nothing and merges nothing, and the pull request page states it only as
24
+ * a sentence, without the size of the gap. For a stacked pull request the
25
+ * base is the layer below, and behind it means the layer below has moved
26
+ * and this one has not been restacked onto it.
27
+ * - **What landed recently.** The one section that is not about the queue,
28
+ * and the first question a reader of a daily report has: did the thing I
29
+ * queued yesterday go in.
30
+ * - **What is open that is not a pull request** — the open issues, so that
31
+ * "what is there to do" does not need a second tab.
32
+ * - **In the JSON only, whether `unblock-prs` set each one aside, who has
33
+ * claimed it** (`pr-report-core`'s `queue-comments.mts`), **and who moves
34
+ * it next** (`owner`: `worker`, `skill`, `human` or `none`; `queue.mts`),
35
+ * which is how a session working the queue picks what to fix.
36
+ *
37
+ * It reads and prints. Nothing here labels, rebases, merges or comments —
38
+ * that is `unblock-prs`, and keeping the report incapable of it is what makes
39
+ * it safe to run anywhere, on a schedule, with a read-only token or none.
40
+ */
41
+ export declare const prReport: (options: Options) => Promise<Result<string, string>>;
42
+ //# sourceMappingURL=main.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"main.d.mts","sourceRoot":"","sources":["../../src/pr-report/main.mts"],"names":[],"mappings":"AAUA,OAAO,EAAO,MAAM,EAAE,MAAM,eAAe,CAAC;AAQ5C,OAAO,KAAK,EAAU,OAAO,EAAE,MAAM,eAAe,CAAC;AAKrD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,eAAO,MAAM,QAAQ,YACV,OAAO,KACf,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CA+FhC,CAAC"}
@@ -0,0 +1,163 @@
1
+ import { buildReport, } from 'pr-report-core';
2
+ import { Arr, Result } from 'ts-data-forge';
3
+ import { currentEpochMs, isoSeconds, resolveRepo, tokenFromEnv, } from '../lib/index.mjs';
4
+ import { createClient } from './github.mjs';
5
+ import { ownersOf } from './queue.mjs';
6
+ import { renderMarkdown, renderTerminal } from './render.mjs';
7
+ import { readRequiredContexts } from './repo-settings.mjs';
8
+
9
+
10
+
11
+
12
+
13
+
14
+
15
+
16
+
17
+
18
+
19
+
20
+
21
+
22
+
23
+
24
+
25
+
26
+
27
+
28
+
29
+
30
+
31
+
32
+
33
+
34
+
35
+
36
+
37
+
38
+
39
+
40
+
41
+
42
+
43
+
44
+
45
+
46
+ export const prReport = async (options) => {
47
+ const repo = await resolveRepo(options.repo);
48
+ if (Result.isErr(repo)) {
49
+ return repo;
50
+ }
51
+ const client = createClient(tokenFromEnv());
52
+ const defaultBranch = await client.defaultBranch(repo.value);
53
+ if (Result.isErr(defaultBranch)) {
54
+ return defaultBranch;
55
+ }
56
+ const required = await readRequiredContexts(client, repo.value, defaultBranch.value);
57
+ if (Result.isErr(required)) {
58
+ return required;
59
+ }
60
+ const facts = await client.facts(repo.value);
61
+ if (Result.isErr(facts)) {
62
+ return facts;
63
+ }
64
+
65
+
66
+
67
+
68
+ const merged = await client.merged(repo.value, options.mergedDays, options.mergedLimit);
69
+ if (Result.isErr(merged)) {
70
+ return merged;
71
+ }
72
+
73
+
74
+ const issues = await client.issues(repo.value, options.issuesLimit);
75
+ if (Result.isErr(issues)) {
76
+ return issues;
77
+ }
78
+
79
+
80
+
81
+ const issueDeclarations = await declarationsOf(client, repo.value, facts.value, issues.value);
82
+
83
+
84
+ const references = await client.references(repo.value, namedBeyond(facts.value, issues.value));
85
+
86
+
87
+ const queue = options.format === 'json'
88
+ ? await client.queueComments(repo.value, defaultBranch.value, facts.value)
89
+ : new Map();
90
+ const report = buildReport({
91
+ repo: repo.value,
92
+ defaultBranch: defaultBranch.value,
93
+ generatedAt: isoSeconds(currentEpochMs()),
94
+ required: required.value,
95
+ authenticated: client.authenticated,
96
+ pulls: facts.value,
97
+ merged: merged.value,
98
+ mergedWithinDays: options.mergedDays,
99
+ issues: issues.value,
100
+ issuesLimit: options.issuesLimit,
101
+ issueDeclarations,
102
+ references,
103
+ });
104
+ const owners = ownersOf(report, queue, defaultBranch.value, currentEpochMs());
105
+ return Result.ok(print(report, queue, owners, options.format));
106
+ };
107
+
108
+
109
+
110
+
111
+
112
+ const declarationsOf = async (client, repo, pulls, issues) => {
113
+ const listed = new Set(issues.map(({ number }) => number));
114
+ const beyond = Arr.uniq(pulls.flatMap(({ linkedIssues }) => linkedIssues
115
+ .filter(({ number, state }) => state !== 'closed' && !listed.has(number))
116
+ .map(({ number }) => number))).toSorted((a, b) => a - b);
117
+ const read = await client.issueBodies(repo, beyond);
118
+ const mut_startAfter = new Map(issues.map(({ number, startAfter }) => [number, startAfter]));
119
+ const mut_open = new Set(listed);
120
+ for (const [number, { open, startAfter }] of read) {
121
+ mut_startAfter.set(number, startAfter);
122
+ if (open) {
123
+ mut_open.add(number);
124
+ }
125
+ }
126
+ return { startAfter: mut_startAfter, open: mut_open };
127
+ };
128
+
129
+ const namedBeyond = (pulls, issues) => {
130
+ const known = new Set(pulls
131
+ .map(({ number }) => number)
132
+ .concat(issues.map(({ number }) => number)));
133
+ return Arr.uniq(issues.flatMap(({ startAfter }) => startAfter))
134
+ .filter((number) => !known.has(number))
135
+ .toSorted((a, b) => a - b);
136
+ };
137
+ const print = (report, queue, owners, format) => {
138
+ switch (format) {
139
+ case 'json':
140
+ return JSON.stringify(serializable(report, queue, owners), undefined, 2);
141
+ case 'markdown':
142
+ return renderMarkdown(report);
143
+ case 'terminal':
144
+ return renderTerminal(report);
145
+ }
146
+ };
147
+
148
+
149
+
150
+
151
+
152
+
153
+
154
+ const serializable = (report, queue, owners) => ({
155
+ ...report,
156
+ entries: report.entries.map((entry) => ({
157
+ ...entry,
158
+ reported: Object.fromEntries(entry.reported),
159
+ ...queue.get(entry.number),
160
+ owner: owners.get(entry.number),
161
+ })),
162
+ });
163
+ //# sourceMappingURL=main.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"main.mjs","sourceRoot":"","sources":["../../src/pr-report/main.mts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,GAQZ,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EACL,cAAc,EACd,UAAU,EACV,WAAW,EACX,YAAY,GACb,MAAM,kBAAk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,CAAC,CAAC;AAC/B,CAAC,CAAC;AAEF,MAAM,KAAK,GAAG,CACZ,MAAgB,EAChB,KAAyC,EACzC,MAAuC,EACvC,MAAc,EACN,EAAE;IACV,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,MAAM;YACT,OAAO,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC;QAE3E,KAAK,UAAU;YACb,OAAO,cAAc,CAAC,MAAM,CAAC,CAAC;QAEhC,KAAK,UAAU;YACb,OAAO,cAAc,CAAC,MAAM,CAAC,CAAC;IAClC,CAAC;AACH,CAAC,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,YAAY,GAAG,CACnB,MAAgB,EAChB,KAAyC,EACzC,MAAuC,EAC9B,EAAE,CACX,CAAC;IACC,GAAG,MAAM;IACT,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QACtC,GAAG,KAAK;QACR,QAAQ,EAAE,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,QAAQ,CAAC;QAC5C,GAAG,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC;QAC1B,KAAK,EAAE,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC;KAChC,CAAC,CAAC;CACJ,CAAU,CAAC"}
@@ -0,0 +1,36 @@
1
+ /** What the command line says, and how it is read. */
2
+ import { Result } from 'ts-data-forge';
3
+ export declare const FORMATS: readonly ['json', 'markdown', 'terminal'];
4
+ export type Format = (typeof FORMATS)[number];
5
+ export type Options = Readonly<{
6
+ format: Format;
7
+ /** `owner/name`; the repository this checkout is of when not given. */
8
+ repo: string | undefined;
9
+ /** How far back the "recently merged" section goes. */
10
+ mergedDays: number;
11
+ /** And how many of them it lists, whatever the window turns up. */
12
+ mergedLimit: number;
13
+ /** How many open issues it lists, most recently updated first. */
14
+ issuesLimit: number;
15
+ }>;
16
+ /**
17
+ * A week, so that a report read on a Monday still covers the Friday. Long
18
+ * enough to answer "what landed since I last looked" and short enough that
19
+ * the section stays a list rather than an archive.
20
+ */
21
+ export declare const DEFAULT_MERGED_DAYS = 7;
22
+ /**
23
+ * A cap as well as a window, and a matter of reading rather than of
24
+ * fitting. Twenty is more than enough to answer "did the thing I queued go in", which is what
25
+ * the section is for, and past that the section stops being a list and
26
+ * starts being an archive.
27
+ */
28
+ export declare const DEFAULT_MERGED_LIMIT = 20;
29
+ /**
30
+ * Enough to see what is open without the section becoming the report. The
31
+ * page asks for the same number.
32
+ */
33
+ export declare const DEFAULT_ISSUES_LIMIT = 30;
34
+ export declare const HELP: string;
35
+ export declare const parseOptions: (args: readonly string[]) => Result<Options | 'help', string>;
36
+ //# sourceMappingURL=options.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"options.d.mts","sourceRoot":"","sources":["../../src/pr-report/options.mts"],"names":[],"mappings":"AAAA,sDAAsD;AAEtD,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAGvC,eAAO,MAAM,OAAO,YAAI,MAAM,EAAE,UAAU,EAAE,UAAU,CAAU,CAAC;AAEjE,MAAM,MAAM,MAAM,GAAG,CAAC,OAAO,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC;AAE9C,MAAM,MAAM,OAAO,GAAG,QAAQ,CAAC;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,uEAAuE;IACvE,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,uDAAuD;IACvD,UAAU,EAAE,MAAM,CAAC;IACnB,mEAAmE;IACnE,WAAW,EAAE,MAAM,CAAC;IACpB,kEAAkE;IAClE,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,IAAI,CAAC;AAErC;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,KAAK,CAAC;AAEvC;;;GAGG;AACH,eAAO,MAAM,oBAAoB,KAAK,CAAC;AAEvC,eAAO,MAAM,IAAI,QAmBL,CAAC;AAEb,eAAO,MAAM,YAAY,SACjB,SAAS,MAAM,EAAE,KACtB,MAAM,CAAC,OAAO,GAAG,MAAM,EAAE,MAAM,CAgEjC,CAAC"}
@@ -0,0 +1,90 @@
1
+
2
+ import { Result } from 'ts-data-forge';
3
+ import { parseCommandArgs, positiveInteger } from '../lib/index.mjs';
4
+ export const FORMATS = ['json', 'markdown', 'terminal'];
5
+
6
+
7
+
8
+
9
+
10
+ export const DEFAULT_MERGED_DAYS = 7;
11
+
12
+
13
+
14
+
15
+
16
+
17
+ export const DEFAULT_MERGED_LIMIT = 20;
18
+
19
+
20
+
21
+
22
+ export const DEFAULT_ISSUES_LIMIT = 30;
23
+ export const HELP = [
24
+ 'Usage: pr-report [options]',
25
+ '',
26
+ 'Reports every open pull request: the order they declare with',
27
+ '`Merge-After:`, the issues they close, their labels, the verdict of the',
28
+ 'checks the ruleset requires, and how far each branch is from its base.',
29
+ '',
30
+ 'Options:',
31
+ ` --format <${FORMATS.join('|')}> how to print it (default terminal)`,
32
+ ' `json` is the whole report, bodies and all',
33
+ ' --repo <owner/name> which repository (default: this one)',
34
+ ` --merged-days <n> how far back "recently merged" goes (default ${DEFAULT_MERGED_DAYS})`,
35
+ ` --merged-limit <n> how many it lists at most (default ${DEFAULT_MERGED_LIMIT})`,
36
+ ` --issues-limit <n> how many open issues it lists (default ${DEFAULT_ISSUES_LIMIT})`,
37
+ ' -h, --help show this help',
38
+ '',
39
+ 'Reads GH_TOKEN or GITHUB_TOKEN when one is set. Without it the public API',
40
+ 'allows 60 requests an hour, which is about twenty pull requests, and the',
41
+ 'issue links are the ones the bodies declare rather than GitHub’s own list.',
42
+ ].join('\n');
43
+ export const parseOptions = (args) => {
44
+ const parsed = parseCommandArgs(args, {
45
+ format: { type: 'string' },
46
+ repo: { type: 'string' },
47
+ 'merged-days': { type: 'string' },
48
+ 'merged-limit': { type: 'string' },
49
+ 'issues-limit': { type: 'string' },
50
+ });
51
+ if (Result.isErr(parsed)) {
52
+ return parsed;
53
+ }
54
+ if (parsed.value === 'help') {
55
+ return Result.ok('help');
56
+ }
57
+ const values = parsed.value;
58
+ const format = values.format ?? 'terminal';
59
+ if (!isFormat(format)) {
60
+ return Result.err(`--format must be one of ${FORMATS.join(', ')}, got ${JSON.stringify(format)}`);
61
+ }
62
+ const mergedDays = positiveInteger('merged-days', values['merged-days'], DEFAULT_MERGED_DAYS);
63
+ if (Result.isErr(mergedDays)) {
64
+ return mergedDays;
65
+ }
66
+ const mergedLimit = positiveInteger('merged-limit', values['merged-limit'], DEFAULT_MERGED_LIMIT);
67
+ if (Result.isErr(mergedLimit)) {
68
+ return mergedLimit;
69
+ }
70
+ const issuesLimit = positiveInteger('issues-limit', values['issues-limit'], DEFAULT_ISSUES_LIMIT);
71
+ if (Result.isErr(issuesLimit)) {
72
+ return issuesLimit;
73
+ }
74
+ return Result.ok({
75
+ format,
76
+ repo: values.repo,
77
+ mergedDays: mergedDays.value,
78
+ mergedLimit: mergedLimit.value,
79
+ issuesLimit: issuesLimit.value,
80
+ });
81
+ };
82
+
83
+
84
+
85
+
86
+
87
+
88
+ const FORMAT_SET = new Set(FORMATS);
89
+ const isFormat = (value) => FORMAT_SET.has(value);
90
+ //# sourceMappingURL=options.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"options.mjs","sourceRoot":"","sources":["../../src/pr-report/options.mts"],"names":[],"mappings":"AAAA,sDAAsD;AAEtD,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAErE,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,MAAM,EAAE,UAAU,EAAE,UAAU,CAAU,CAAC;AAgBjE;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC;AAErC;;;;;GAK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ecidedEntries, type QueueComments, type QueueOwner, type RepoRef } from 'pr-report-core';
2
+ import { Result } from 'ts-data-forge';
3
+ /**
4
+ * Who moves each open pull request in the queue next (`pr-report-core`'s
5
+ * `queue-owner.mts`), from what `pr-report` reads.
6
+ *
7
+ * Every command a session runs on the queue decides through here — the
8
+ * `owner` in `pr-report --format json`, `claim-pr`, `push-fixed-pr`,
9
+ * `rebuild-pnpm-update` and `report-unowned-prs` — so none of them can come
10
+ * to a different answer from the others, and the worker asks the same
11
+ * function with the same facts read through `gh`.
12
+ */
13
+ export declare const ownersOf: (decided: DecidedEntries, queue: ReadonlyMap<number, QueueComments>, defaultBranch: string, nowEpochMs: number) => ReadonlyMap<number, QueueOwner>;
14
+ export type QueueState = Readonly<{
15
+ repo: RepoRef;
16
+ defaultBranch: string;
17
+ decided: DecidedEntries;
18
+ queue: ReadonlyMap<number, QueueComments>;
19
+ owners: ReadonlyMap<number, QueueOwner>;
20
+ }>;
21
+ /**
22
+ * Reads the open pull requests, this account's comments on them and the
23
+ * owner of each, for a command that acts on the queue. It needs a token
24
+ * whose account is the one `unblock-prs` writes as: without one no comment
25
+ * is trusted, and there is no owner to read.
26
+ */
27
+ export declare const readQueueState: (repoOption?: string) => Promise<Result<QueueState, string>>;
28
+ //# sourceMappingURL=queue.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"queue.d.mts","sourceRoot":"","sources":["../../src/pr-report/queue.mts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,UAAU,EACf,KAAK,OAAO,EACb,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAO,MAAM,EAAE,MAAM,eAAe,CAAC;AAK5C;;;;;;;;;GASG;AACH,eAAO,MAAM,QAAQ,YACV,cAAc,SAChB,WAAW,CAAC,MAAM,EAAE,aAAa,CAAC,iBAC1B,MAAM,cACT,MAAM,KACjB,WAAW,CAAC,MAAM,EAAE,UAAU,CAsB9B,CAAC;AAEJ,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC;IAChC,IAAI,EAAE,OAAO,CAAC;IACd,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,cAAc,CAAC;IACxB,KAAK,EAAE,WAAW,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IAC1C,MAAM,EAAE,WAAW,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;CACzC,CAAC,CAAC;AAEH;;;;;GAKG;AACH,eAAO,MAAM,cAAc,gBACZ,MAAM,KAClB,OAAO,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,CAwDpC,CAAC"}
@@ -0,0 +1,74 @@
1
+ import { buildEntries, queueOwnerOfEntry, } from 'pr-report-core';
2
+ import { Arr, Result } from 'ts-data-forge';
3
+ import { currentEpochMs, resolveRepo, tokenFromEnv } from '../lib/index.mjs';
4
+ import { createClient } from './github.mjs';
5
+ import { readRequiredContexts } from './repo-settings.mjs';
6
+
7
+
8
+
9
+
10
+
11
+
12
+
13
+
14
+
15
+
16
+ export const ownersOf = (decided, queue, defaultBranch, nowEpochMs) => new Map(Arr.generate(function* () {
17
+ for (const entry of decided.entries) {
18
+
19
+
20
+ const comments = queue.get(entry.number);
21
+ const owner = comments === undefined
22
+ ? undefined
23
+ : queueOwnerOfEntry(entry, comments, {
24
+ defaultBranch,
25
+ cycles: decided.cycles,
26
+ nowEpochMs,
27
+ });
28
+ if (owner !== undefined) {
29
+ yield [entry.number, owner];
30
+ }
31
+ }
32
+ }));
33
+
34
+
35
+
36
+
37
+
38
+
39
+ export const readQueueState = async (repoOption) => {
40
+ const repo = await resolveRepo(repoOption);
41
+ if (Result.isErr(repo)) {
42
+ return repo;
43
+ }
44
+ const client = createClient(tokenFromEnv());
45
+ if (!client.authenticated) {
46
+ return Result.err('no GH_TOKEN or GITHUB_TOKEN: the queue comments, and so the owners, cannot be read');
47
+ }
48
+ const defaultBranch = await client.defaultBranch(repo.value);
49
+ if (Result.isErr(defaultBranch)) {
50
+ return defaultBranch;
51
+ }
52
+ const required = await readRequiredContexts(client, repo.value, defaultBranch.value);
53
+ if (Result.isErr(required)) {
54
+ return required;
55
+ }
56
+ const facts = await client.facts(repo.value);
57
+ if (Result.isErr(facts)) {
58
+ return facts;
59
+ }
60
+ const queue = await client.queueComments(repo.value, defaultBranch.value, facts.value);
61
+ const decided = buildEntries({
62
+ required: required.value,
63
+ defaultBranch: defaultBranch.value,
64
+ pulls: facts.value,
65
+ });
66
+ return Result.ok({
67
+ repo: repo.value,
68
+ defaultBranch: defaultBranch.value,
69
+ decided,
70
+ queue,
71
+ owners: ownersOf(decided, queue, defaultBranch.value, currentEpochMs()),
72
+ });
73
+ };
74
+ //# sourceMappingURL=queue.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"queue.mjs","sourceRoot":"","sources":["../../src/pr-report/queue.mts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,iBAAiB,GAKlB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAC7E,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAE3D;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CACtB,OAAuB,EACvB,KAAyC,EACzC,aAAqB,EACrB,UAAkB,EACe,EAAE,CACnC,IAAI,GAAG,CACL,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC;IACpB,KAAK,MAAM,KAAK,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;QACpC,sEAAsE;QACtE,4DAA4D;QAC5D,MAAM,QAAQ,GAAG,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAEzC,MAAM,KAAK,GACT,QAA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AM,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC;QACxB,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,KAAK,GAAG,MAAM,MAAM,CAAC,aAAa,CACtC,IAAI,CAAC,KAAK,EACV,aAAa,CAAC,KAAK,EACnB,KAAK,CAAC,KAAK,CACZ,CAAC;IAEF,MAAM,OAAO,GAAG,YAAY,CAAC;QAC3B,QAAQ,EAAE,QAAQ,CAAC,KAAK;QACxB,aAAa,EAAE,aAAa,CAAC,KAAK;QAClC,KAAK,EAAE,KAAK,CAAC,KAAK;KACnB,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC,EAAE,CAAC;QACf,IAAI,EAAE,IAAI,CAAC,KAAK;QAChB,aAAa,EAAE,aAAa,CAAC,KAAK;QAClC,OAAO;QACP,KAAK;QACL,MAAM,EAAE,QAAQ,CAAC,OAAO,EAAE,KAAK,EAAE,aAAa,CAAC,KAAK,EAAE,cAAc,EAAE,CAAC;KACxE,CAAC,CAAC;AACL,CAAC,CAAC"}
@@ -0,0 +1,14 @@
1
+ /** The report as text: Markdown for GitHub and Claude, plain for a terminal. */
2
+ import { type PrReport } from 'pr-report-core';
3
+ /**
4
+ * The report as Markdown, for pasting into GitHub or a conversation with
5
+ * Claude.
6
+ *
7
+ * The merge order is a nested list rather than a table because the nesting
8
+ * *is* the information — a table would have to spell the tree back out in a
9
+ * column, and a reader would have to rebuild it.
10
+ */
11
+ export declare const renderMarkdown: (report: PrReport) => string;
12
+ /** The same report drawn with box characters, for a terminal. */
13
+ export declare const renderTerminal: (report: PrReport) => string;
14
+ //# sourceMappingURL=render.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"render.d.mts","sourceRoot":"","sources":["../../src/pr-report/render.mts"],"names":[],"mappings":"AAAA,gFAAgF;AAEhF,OAAO,EAIL,KAAK,QAAQ,EAKd,MAAM,gBAAgB,CAAC;AAiBxB;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc,WAAY,QAAQ,KAAG,MA8CjD,CAAC;AAEF,iEAAiE;AACjE,eAAO,MAAM,cAAc,WAAY,QAAQ,KAAG,MAwDjD,CAAC"}