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,244 @@
1
+ # `pr-report`
2
+
3
+ `pnpm run pr-report` — the state of every open pull request, in one page.
4
+
5
+ - [日本語](#日本語)
6
+ - [English](#english)
7
+
8
+ The conventions this reads are `CLAUDE.md`'s: "CI" and the `Merge-After:`
9
+ trailer described in `../unblock-prs/README.md`. This file
10
+ describes what the script does with them.
11
+
12
+ ## 日本語
13
+
14
+ ### 何をするスクリプトか
15
+
16
+ open な PR を1件ずつ調べ、**読むだけ**でレポートを出力します。ラベル操作・
17
+ rebase・マージ・コメントは一切しません(それは `unblock-prs` の仕事です)。読む
18
+ だけなので、スケジュール実行でも、read-only トークンでも、トークン無しでも安全に
19
+ 動きます。
20
+
21
+ 出力に載るのは、GitHub の PR 一覧では1画面で分からないものだけです。
22
+
23
+ - **マージ順** — `Merge-After:` トレーラと stack(base が別の open な PR の
24
+ ブランチである PR は、その PR の上に積まれた層)が宣言するのはグラフですが、
25
+ PR 一覧では4本の stack が無関係な4行に見えます。木として描けば、上にあるもの
26
+ が次に見るものです。積まれた PR には `stacked on #N` と出します。閉じる issue
27
+ の `Start-After:` から引き継いだ順序(`docs/issue-start-after.md`)も同じ木に
28
+ 入り、`after #N (Start-After)` と出します。名指された開いた issue を誰も閉じて
29
+ いなければ、何も止めずに `#N (issue) not done` と出します。そのために、一覧に
30
+ 無い閉じる issue を1件につき1リクエスト読みます。
31
+ - **閉じる issue** — body を開かずに「これは何のための PR か」が分かるように。
32
+ - **ラベル** — `skip-ci` と `merge-queued` はこのリポジトリの「まだ」と「準備
33
+ 完了」そのものです。
34
+ - **auto-merge** — ラベルは依頼、auto-merge は機構です。`unblock-prs` は
35
+ `merge-queued` の PR を pick したときに auto-merge を張るので、張られていない
36
+ のはキューで順番を待つ PR の普通の状態です。張られているときだけ
37
+ `auto-merge` と出します(順番が来た、という news なので)。
38
+ - **ruleset が要求する context の判定** — 「走ったチェック」とは別物です。何も
39
+ 報告していない required context は永久に "Expected — waiting" のまま出ますし、
40
+ 赤い aggregate は何が落ちたかを名乗りません。どちらも名指しで出します。
41
+ - **base との ahead / behind** — behind な branch は何も走らず何もマージされま
42
+ せん。PR ページはそれを文章で言うだけで、差の大きさは言いません。積まれた PR
43
+ の base は下の層なので、behind は「下の層が動いたのに積み直されていない」と
44
+ いう意味です。
45
+ - **直近マージされた PR** — キューの話ではない節で、日次レポートの読者が
46
+ 最初に持つ疑問(昨日キューに入れたものは入ったのか)に答えます。
47
+ - **open な issue** — 更新の新しい順に最大 30 件。「やることは何か」を別タブ
48
+ 無しで答えるためです。件数が上限に達したときは見出しに `+` を付けます。
49
+ それぞれに着手状態(`ready`、`waiting`、`needs a look`、`in progress`、
50
+ `on a Start-After cycle`。制約なしは書きません)と、`Start-After:` が名指す
51
+ ものの状態(`after #N (open)` など)を出します(`docs/issue-start-after.md`)。
52
+ 名指したものが一覧にも open な PR にも無ければ、1件につき1リクエスト読みます。
53
+ GitHub の issue の依存関係(blocked by)も `Start-After:` と同じに読み、依存が
54
+ ある issue だけ1リクエスト足します。
55
+ 本文に `Merge-After:` があれば、issue では読まないことを書き間違いとして示します。
56
+
57
+ ### 実行
58
+
59
+ ```bash
60
+ pnpm run pr-report # 端末向け(既定)
61
+ pnpm run pr-report -- --format markdown # GitHub / Claude 向け
62
+ pnpm run pr-report -- --format json # 他のツールに渡す(body 込みの全体)
63
+ pnpm run pr-report -- --repo owner/name # 別のリポジトリ
64
+ pnpm run pr-report -- --merged-days 3 # 「直近マージ」の遡る日数
65
+ pnpm run pr-report -- --merged-limit 5 # その最大件数
66
+ pnpm run pr-report -- --issues-limit 10 # open な issue の最大件数
67
+ ```
68
+
69
+ `--merged-days`(既定 7)と `--merged-limit`(既定 20)は日数と件数の両方から
70
+ 掛かります。上限は「入らないから」ではなく「読めなくなるから」で、20件を超えた
71
+ あたりからこのセクションは一覧ではなく履歴になります。
72
+
73
+ ### トークン
74
+
75
+ `GH_TOKEN` か `GITHUB_TOKEN` があれば(この順に)使い、無ければ無認証で読みます。mono は
76
+ public なので無認証でも動き、1回のレポートは匿名の 60 requests/hour に収まりま
77
+ す(PR 1本あたり約3リクエスト = 20本程度まで。issue 一覧は全体で1リクエスト)。
78
+
79
+ トークンがあると変わるのは2点だけです。レート制限が 5000/hour になることと、
80
+ 閉じる issue を GraphQL の `closingIssuesReferences`(サイドバーで手動リンクした
81
+ ものを含む、GitHub 自身のリスト)から読むこと。無認証のときは body の
82
+ `Closes #12` 等のキーワードから読むので、手動リンクは見えません。その旨はレポート
83
+ の末尾に自分で書きます。
84
+
85
+ ### 判定の決まりごと
86
+
87
+ - **required context の一覧は `repo-settings/rulesets/main.json` から読みます。**
88
+ ruleset を返す API は admin トークンを要求しますし、そのファイルが desired
89
+ state だからです。ただし root のファイルは `pnpm run repo-settings:apply` を
90
+ 実行するまで GitHub には効かないので、適用前に足した context は全 PR で
91
+ missing として出ます — レポートがそう言うのは正しい挙動です。
92
+ - **`skipped` は合格として数えますが、`skipped` として報告します。** gated job は
93
+ `skip-ci` のときと workflow が読まない diff のときに skip し、GitHub はそれを
94
+ 満たされたものとして扱うので、判定では合格に数えます。`passed` に畳み込まない
95
+ のは、畳み込んでいたために CI が落ちている PR が ✅ に見えた(#2031)からです。
96
+ - **head commit で何かがまだ動いていれば `pending` です。** 必須 context だけで
97
+ なく、その commit の全 check run を見ます。aggregate は `if: always()` で、
98
+ 待っている job が終わるまで新しいラウンドの run が作られないので、「必須
99
+ context が全部報告済み」はラウンドの途中でも成り立ち、その報告は一つ前の
100
+ ラウンドのものです。#2031 では `skip-ci` を外した直後、前のラウンドの
101
+ `skipped` だけが残っていて、2分後に `failure` になりました。
102
+ - **`skip-ci` は `paused`** という独立の判定にしています。ラベルが付いている間、
103
+ 見えている赤はラベルが付く前のもの — 典型的には `labeled` run に取り消された
104
+ `opened` run の残骸 — なので、`failing` と呼ぶとキューに入った PR が全部壊れて
105
+ 見えます。名前は `stale red:` として残します。
106
+ - **`no-skip-ci-label` は check run ではなく commit status** です。両方の
107
+ エンドポイントを読むのはそのためで、片方だけだと全ての labelled な PR を
108
+ 止めている context が missing に見えます。同名の check run と commit status
109
+ が両方ある場合は、**厳しい方**を採ります — GitHub は「both must pass」と
110
+ 規定しているので、緑の status が同名の赤い check run を覆い隠すことは
111
+ ありません。
112
+ - **同名の check run が複数あるときは、id が最大の check suite のものを採ります**
113
+ — 一番新しく始まった run でも、一番新しく終わった run でもありません。GitHub
114
+ がそう解決するからです。1回の push が作る suite は全て同じ秒に作られるので、
115
+ どれが大きい id を得るかは運で、取り消された `opened` run の suite が勝つと、
116
+ 後から緑になった方があっても**その赤が実際にマージを止めます**。
117
+ `started_at` で並べ替えると、止まっている PR を緑と報告することになります。
118
+
119
+ ### 限界
120
+
121
+ - 1ページ(100件)しか読みません。それを超えたら数えるのをやめて失敗します。
122
+ 半分を全体として報告しないためです。
123
+ - 手動リンクの issue はトークン無しでは見えません(上記)。
124
+ - cycle は描かずに名指しで報告します。cycle の members は木に出てきません。
125
+
126
+ ### 出力先
127
+
128
+ スクリプトは stdout に出すだけです。Claude の routine や `/unblock-prs` が同じ
129
+ コマンドを実行して結果を読みます。`--format json` の各 entry には、
130
+ `unblock-prs` の見送りの comment と、それを直すセッションの claim が何を言って
131
+ いるか(`setAside` / `claim`、無ければ省略)も載ります。信用するのはトークンの
132
+ アカウントが書いた comment だけなので、トークンが無ければ載りません
133
+ (`../unblock-prs/README.md`)。キューにある PR には、次に動かす
134
+ 担当者(`owner`: `worker` / `skill` / `human` / `none`)も載ります。決めるのは
135
+ `pr-report-core` の `queueOwner` で、worker も `claim-pr` / `push-fixed-pr` /
136
+ `report-unowned-prs` も `queue.mts` を通して同じ値を読みます。comment が読め
137
+ なかった PR には載りません。
138
+
139
+ **GitHub Pull Requests Manager**
140
+ (<https://noshiro-pf.github.io/mono/pr-manager/>, `apps/pr-manager-app`)はこの
141
+ スクリプトの出力を読みません。ページは GitHub の GraphQL API を毎回自分で読み、
142
+ 判定(必須 context の verdict、`Merge-After:` の木、件数)はこのスクリプトと同じ
143
+ `libs/pr-report-core` で下します。REST と GraphQL の2つの読み方があるのは、
144
+ Claude Code セッションのプロキシが GraphQL を拒否するためで、このスクリプトは
145
+ そこでも動くよう REST のままです。
146
+
147
+ ## English
148
+
149
+ `pnpm run pr-report` reads every open pull request and prints a report. It
150
+ writes nothing — no labels, no rebases, no merges, no comments — which is what
151
+ makes it safe to run on a schedule, with a read-only token or none.
152
+
153
+ It reports what the pull request list cannot show in one screen: the merge
154
+ order declared by the `Merge-After:` trailers and by the stacks — a pull
155
+ request onto another's branch is a layer on it, marked `stacked on #N` — and
156
+ inherited from the `Start-After:` of the issues each closes, marked
157
+ `after #N (Start-After)` (`docs/issue-start-after.md`; one request for each
158
+ closing issue the open list does not cover, and an open issue named that
159
+ nobody is closing is `#N (issue) not done`, holding nothing), drawn as a
160
+ tree, the issues each
161
+ pull request closes, its labels, the verdict of the contexts the ruleset
162
+ requires (named, including the ones that have reported nothing at all), how
163
+ far the branch is ahead of and behind its base (for a stacked one, behind the
164
+ layer below means that layer moved and this one was not restacked), and — the
165
+ two sections that are not about the queue — what merged recently and which
166
+ issues are open (the most recently updated thirty, `--issues-limit`, with a `+`
167
+ on a full list). Each issue says how it stands for being started — `ready`,
168
+ `waiting`, `needs a look`, `in progress` or `on a Start-After cycle`, and
169
+ nothing when it is free — and where each thing its `Start-After:` names
170
+ stands, as `after #N (open)` (`docs/issue-start-after.md`; one request for
171
+ each named number that is neither listed nor an open pull request). GitHub's
172
+ issue dependencies ("blocked by") count as `Start-After:` does, at one more
173
+ request for each issue that has any. A
174
+ `Merge-After:` in an issue's body is pointed out as the slip it is: an issue
175
+ does not read it.
176
+
177
+ Auto-merge is reported only when it is armed. The label is the request and
178
+ auto-merge is the mechanism, which `unblock-prs` arms when it picks a queued
179
+ pull request, so one not yet armed is the ordinary state of the queue and
180
+ `auto-merge` on an entry means its turn has come.
181
+
182
+ ```bash
183
+ pnpm run pr-report # for a terminal (the default)
184
+ pnpm run pr-report -- --format markdown # for GitHub or Claude
185
+ pnpm run pr-report -- --format json # for another tool
186
+ pnpm run pr-report -- --repo owner/name # a different repository
187
+ pnpm run pr-report -- --merged-days 3 # how far back "recently merged" goes
188
+ pnpm run pr-report -- --merged-limit 5 # and how many it lists
189
+ pnpm run pr-report -- --issues-limit 10 # how many open issues it lists
190
+ ```
191
+
192
+ The merged section is bounded twice, by days (7) and by count (20). The cap is
193
+ about reading rather than about fitting: past twenty the section stops being
194
+ a list and starts being an archive.
195
+
196
+ `GH_TOKEN` or `GITHUB_TOKEN`, in that order, is used when set. Without one the public API
197
+ allows 60 requests an hour — about twenty pull requests at roughly three
198
+ requests each, which one report a day fits inside — and the issue links are
199
+ the ones the bodies declare with a closing keyword rather than GitHub's own
200
+ list, which only GraphQL serves. The report says so at the bottom when it ran
201
+ that way.
202
+
203
+ Five rules decide the verdicts. `skipped` is counted as met, because GitHub
204
+ counts it so, but reported as `skipped` rather than folded into `passed`.
205
+ Anything still running on the head commit, required or not, keeps the verdict
206
+ `pending`: an aggregate has no run in a new round until the jobs it waits on
207
+ finish, so "every required context has reported" is true halfway through a
208
+ round, out of the round before. Together those two are what showed #2031 a
209
+ tick two minutes before its CI failed. `skip-ci` is its own verdict, `paused`, because while the label is on
210
+ the red a reader sees is the cancelled `opened` run rather than news — it is
211
+ still listed, as `stale red:`. `no-skip-ci-label` is a commit status, not a
212
+ check run, so both endpoints are read. And where one name has reported more
213
+ than once, the run in the check suite with the greatest id is the answer,
214
+ which is how GitHub resolves it — not the newest run, which would call a pull
215
+ request green that a stale red is holding.
216
+
217
+ The required contexts come from `repo-settings/rulesets/main.json` rather than
218
+ from the API, which wants an admin token. A context added there and not yet
219
+ applied with `pnpm run repo-settings:apply` is reported as missing on every
220
+ pull request, which is a fair thing for a report to say.
221
+
222
+ It reads one page of a hundred pull requests and fails rather than reporting a
223
+ part of them as the whole. Pull requests on a `Merge-After` cycle are named in
224
+ their own section instead of being drawn, since there is no position in a
225
+ merge order to draw them at.
226
+
227
+ The script only prints. A Claude routine and `/unblock-prs` run the same
228
+ command and read what it prints. Each entry of `--format json` also carries
229
+ what `unblock-prs`'s set-aside comment and a fixing session's claim say
230
+ (`setAside` / `claim`, absent when there is none). Only comments the token's
231
+ own account wrote are trusted, so without a token neither is there
232
+ (`../unblock-prs/README.md`). A pull request in the queue also
233
+ carries who moves it next (`owner`: `worker`, `skill`, `human` or `none`),
234
+ decided by `pr-report-core`'s `queueOwner`, which the worker, `claim-pr`,
235
+ `push-fixed-pr` and `report-unowned-prs` read through `queue.mts` too. It is
236
+ absent on one whose comments could not be read.
237
+
238
+ The **GitHub Pull Requests Manager** page
239
+ (<https://noshiro-pf.github.io/mono/pr-manager/>, `apps/pr-manager-app`) does
240
+ not read this output. It reads GitHub's GraphQL API itself on every read, and
241
+ reaches its verdicts, merge order and counts through the same
242
+ `libs/pr-report-core` this script uses. There are two ways of reading because
243
+ a Claude Code session's proxy refuses GraphQL, and this script stays on REST
244
+ so that it runs there too.