@moberg_hr/work-tree 2.10.0 → 2.11.1

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 (290) hide show
  1. package/dist/{account-QSNXX5YV.js → account-QZH4MA42.js} +21 -21
  2. package/dist/{add-repo-YZ32MLZG.js → add-repo-CAQSJPLG.js} +17 -17
  3. package/dist/{answer-Y4T5X446.js → answer-3QIKCVON.js} +12 -12
  4. package/dist/{attach-XPYWYHDP.js → attach-GR3AD4D7.js} +19 -19
  5. package/dist/bin.js +5 -5
  6. package/dist/{block-JVAGG5QA.js → block-JFZ5RDO3.js} +15 -16
  7. package/dist/{block-JVAGG5QA.js.map → block-JFZ5RDO3.js.map} +1 -1
  8. package/dist/{broadcast-FATIANHX.js → broadcast-WW6DBVZ3.js} +10 -10
  9. package/dist/{catchup-OTI2KZG5.js → catchup-RMYAFVK3.js} +15 -15
  10. package/dist/{chunk-VV3NFLLP.js → chunk-26YZYL77.js} +3 -3
  11. package/dist/{chunk-UP2JTDBI.js → chunk-32VFZGPR.js} +3 -3
  12. package/dist/{chunk-ZRATYLBB.js → chunk-33XSEAHO.js} +2 -2
  13. package/dist/{chunk-E67DOUVU.js → chunk-3OAW37JA.js} +107 -18
  14. package/dist/chunk-3OAW37JA.js.map +1 -0
  15. package/dist/{chunk-27LWL6QE.js → chunk-3SBQIJQS.js} +468 -14
  16. package/dist/chunk-3SBQIJQS.js.map +1 -0
  17. package/dist/{chunk-MM7344RC.js → chunk-4CNBSPNL.js} +2 -2
  18. package/dist/{chunk-RHDZPV6C.js → chunk-4EL7FVQQ.js} +2 -2
  19. package/dist/{chunk-FMLE2WSN.js → chunk-4IRPL6XA.js} +2 -2
  20. package/dist/{chunk-BNKVENDF.js → chunk-4NUWTGAP.js} +5 -5
  21. package/dist/{chunk-46XSWHCQ.js → chunk-5E44Z6IL.js} +5 -4
  22. package/dist/chunk-5E44Z6IL.js.map +1 -0
  23. package/dist/{chunk-KL4YYV37.js → chunk-5FBRQW2F.js} +4 -4
  24. package/dist/{chunk-TKWUSJNQ.js → chunk-5LW5OJHH.js} +7 -9
  25. package/dist/{chunk-TKWUSJNQ.js.map → chunk-5LW5OJHH.js.map} +1 -1
  26. package/dist/{chunk-JNCKZ3OF.js → chunk-63FTAMDO.js} +4 -4
  27. package/dist/{chunk-WKOJ7NXD.js → chunk-6RMB3I3V.js} +4 -4
  28. package/dist/{chunk-6J6U7JXN.js → chunk-6YZBMC35.js} +3 -3
  29. package/dist/{chunk-3BSFVKMK.js → chunk-7DUGVGUZ.js} +2 -2
  30. package/dist/{chunk-IOHK45WE.js → chunk-7OFVXQSM.js} +2 -2
  31. package/dist/{chunk-34E2LA3M.js → chunk-A6N4FF4K.js} +5 -5
  32. package/dist/{chunk-IFQOOCT7.js → chunk-AOWYAOAX.js} +46 -24
  33. package/dist/chunk-AOWYAOAX.js.map +1 -0
  34. package/dist/{chunk-V4U5RGEG.js → chunk-BDPRYJL3.js} +3 -3
  35. package/dist/chunk-BDPRYJL3.js.map +1 -0
  36. package/dist/{chunk-4TTYEMOY.js → chunk-BM36OYVS.js} +14 -7
  37. package/dist/chunk-BM36OYVS.js.map +1 -0
  38. package/dist/{chunk-66VPQOVZ.js → chunk-C7CDET5W.js} +13 -10
  39. package/dist/chunk-C7CDET5W.js.map +1 -0
  40. package/dist/{chunk-RCGFHJM7.js → chunk-CBCOVIXZ.js} +2 -2
  41. package/dist/{chunk-ZXHMC7UO.js → chunk-D2J3AD6L.js} +3 -5
  42. package/dist/chunk-D2J3AD6L.js.map +1 -0
  43. package/dist/{chunk-ICXUTMGH.js → chunk-DGVCN7HB.js} +2 -2
  44. package/dist/{chunk-B5WDN63X.js → chunk-DMGNJ73M.js} +2 -2
  45. package/dist/{chunk-LZZCJAJQ.js → chunk-DTUKXBAR.js} +7 -7
  46. package/dist/{chunk-FKM67CZZ.js → chunk-FEL7UMIO.js} +7 -9
  47. package/dist/{chunk-FKM67CZZ.js.map → chunk-FEL7UMIO.js.map} +1 -1
  48. package/dist/chunk-FGPXMAYU.js +25 -0
  49. package/dist/chunk-FGPXMAYU.js.map +1 -0
  50. package/dist/{chunk-2K5TDJ7M.js → chunk-FI2HURCM.js} +5 -5
  51. package/dist/{chunk-2HHIDWHH.js → chunk-FJQT7OWV.js} +7 -7
  52. package/dist/{chunk-LKESANVD.js → chunk-FNA27U2B.js} +2 -2
  53. package/dist/{chunk-6YMLYU5G.js → chunk-FZJ472VJ.js} +7 -7
  54. package/dist/{chunk-ADIN3DTD.js → chunk-GG4VKPAX.js} +2 -2
  55. package/dist/{chunk-V7GCYL6A.js → chunk-GOK6JBB2.js} +6 -6
  56. package/dist/{chunk-IKX3B26P.js → chunk-GZYXCMJH.js} +4 -4
  57. package/dist/{chunk-VFH4SU3M.js → chunk-HRBAXQXF.js} +9 -9
  58. package/dist/{chunk-2VRZVUM7.js → chunk-ISE5VJP2.js} +6 -6
  59. package/dist/{chunk-OCMNBOPX.js → chunk-JVHHSKBJ.js} +2 -2
  60. package/dist/{chunk-3S6L437Q.js → chunk-K3H4EQHV.js} +4 -4
  61. package/dist/{chunk-KDO7D46L.js → chunk-KJRUC2QY.js} +3 -3
  62. package/dist/{chunk-Z6ZMWFNV.js → chunk-LA3X5A3U.js} +6 -8
  63. package/dist/{chunk-Z6ZMWFNV.js.map → chunk-LA3X5A3U.js.map} +1 -1
  64. package/dist/{chunk-PSUJZUYX.js → chunk-LM2T5OR3.js} +3 -2
  65. package/dist/{chunk-UBOKRHNV.js → chunk-MKJH2D4V.js} +2 -2
  66. package/dist/{chunk-NWOCQVSL.js → chunk-MR7XFKTK.js} +7 -7
  67. package/dist/{chunk-Z7I6DQAR.js → chunk-N4W34U3I.js} +42 -9
  68. package/dist/chunk-N4W34U3I.js.map +1 -0
  69. package/dist/{chunk-PCNNW63Z.js → chunk-NFWSJFYY.js} +2 -2
  70. package/dist/{chunk-TIG7NHVO.js → chunk-NKIZLEO2.js} +21 -9
  71. package/dist/chunk-NKIZLEO2.js.map +1 -0
  72. package/dist/{chunk-353ZINJ2.js → chunk-NXN7B3BE.js} +3 -3
  73. package/dist/{chunk-3XG23PLG.js → chunk-O36SFV5G.js} +13 -3
  74. package/dist/{chunk-3XG23PLG.js.map → chunk-O36SFV5G.js.map} +1 -1
  75. package/dist/{chunk-2MAZV5KS.js → chunk-O5ZJY5BT.js} +16 -3
  76. package/dist/chunk-O5ZJY5BT.js.map +1 -0
  77. package/dist/{chunk-WY7QZ2P7.js → chunk-O6UWELSS.js} +2 -2
  78. package/dist/{chunk-WVV54JP3.js → chunk-OAP7XYNK.js} +53 -53
  79. package/dist/{chunk-AHI2WVWP.js → chunk-OYLUYJTY.js} +8 -8
  80. package/dist/{chunk-PHGVVFTF.js → chunk-PJGAPVK4.js} +108 -133
  81. package/dist/chunk-PJGAPVK4.js.map +1 -0
  82. package/dist/{chunk-RJUMLWXP.js → chunk-PTYM27VH.js} +114 -18
  83. package/dist/chunk-PTYM27VH.js.map +1 -0
  84. package/dist/{chunk-Y7T73SAP.js → chunk-RUYTU2WJ.js} +7 -3
  85. package/dist/chunk-RUYTU2WJ.js.map +1 -0
  86. package/dist/{chunk-5R5JEQW7.js → chunk-SFMIDVB7.js} +17 -12
  87. package/dist/chunk-SFMIDVB7.js.map +1 -0
  88. package/dist/{chunk-GZGJQKQT.js → chunk-SKRVI3Z4.js} +2 -2
  89. package/dist/{chunk-E7WPTSHQ.js → chunk-UJ2GAHAZ.js} +11 -11
  90. package/dist/{chunk-4O4VQQEA.js → chunk-VJ5XMYXE.js} +3 -3
  91. package/dist/{chunk-IDQVTWLX.js → chunk-VRTOALU3.js} +5 -5
  92. package/dist/chunk-WAIFKHD6.js +9 -0
  93. package/dist/{chunk-LJKF73JB.js → chunk-WDL6ANZ3.js} +3 -3
  94. package/dist/{chunk-F3PEUOTP.js → chunk-WGKU5PPI.js} +2 -2
  95. package/dist/{chunk-JVBIWU7S.js → chunk-X5RHYVXY.js} +3 -3
  96. package/dist/{chunk-RQFHA5BM.js → chunk-YKQLHFY4.js} +43 -8
  97. package/dist/chunk-YKQLHFY4.js.map +1 -0
  98. package/dist/{chunk-FSQJOZS4.js → chunk-ZI7XN4VD.js} +9 -9
  99. package/dist/{cleanup-M5TY4FQS.js → cleanup-OMYTNUP4.js} +35 -35
  100. package/dist/{cli-446A536X.js → cli-G7EUXIPW.js} +5 -5
  101. package/dist/{command-hook-installer-7Q7UD7AU.js → command-hook-installer-GMQ4IVDE.js} +3 -3
  102. package/dist/{config-JLORGUXN.js → config-YO5QGP3B.js} +11 -11
  103. package/dist/{diff-4O5HXNZ7.js → diff-LIG47TN7.js} +12 -12
  104. package/dist/{digest-IAAZXJCC.js → digest-FMSWN4A6.js} +11 -11
  105. package/dist/{fork-ULJYPEKY.js → fork-A7U7AM4M.js} +32 -32
  106. package/dist/{history-JFZF22M7.js → history-NMHRGJ76.js} +9 -9
  107. package/dist/{hook-UYOIQVJ7.js → hook-NDETZUEC.js} +17 -17
  108. package/dist/{hydrate-DROI4RJ7.js → hydrate-ZTKYATH3.js} +10 -10
  109. package/dist/{init-FF75CQM7.js → init-MMJF5ZVJ.js} +16 -16
  110. package/dist/{install-skills-XSAHNBYD.js → install-skills-KS6N4U6L.js} +8 -8
  111. package/dist/install-skills-bin.js +7 -7
  112. package/dist/{list-5FEHBP6N.js → list-Z77M43EU.js} +9 -9
  113. package/dist/{move-422L6PPI.js → move-YQIYXSFQ.js} +20 -20
  114. package/dist/{note-AAXPD5VA.js → note-C5SVIML6.js} +13 -13
  115. package/dist/{overlaps-WPNUYOFF.js → overlaps-ARNCAXUT.js} +16 -16
  116. package/dist/{pin-QXPF23BB.js → pin-D4J3XXDU.js} +13 -13
  117. package/dist/{pr-QLGXPKPQ.js → pr-VMDNT4T7.js} +24 -24
  118. package/dist/{prune-GRHKRRVT.js → prune-XKMNAY7O.js} +33 -33
  119. package/dist/{pty-host-XDDXA4SL.js → pty-host-FVXJRFSL.js} +59 -21
  120. package/dist/pty-host-FVXJRFSL.js.map +1 -0
  121. package/dist/{read-YWKD2DGP.js → read-PWWKV66E.js} +12 -12
  122. package/dist/{recent-SI5BDVVH.js → recent-C4ZH75KK.js} +17 -17
  123. package/dist/{remove-RXXCHY44.js → remove-QFZ4YGVH.js} +32 -32
  124. package/dist/{restart-CPNDEXU6.js → restart-NZ2QYWA4.js} +12 -12
  125. package/dist/{resume-BLP4TTJK.js → resume-PRMBJOOG.js} +17 -17
  126. package/dist/{review-now-ADWZPELT.js → review-now-HHQIBVUS.js} +5 -5
  127. package/dist/{run-JFCDJ3EV.js → run-LUXAB6F5.js} +9 -9
  128. package/dist/{screen-LBOPAUXV.js → screen-PJJEEXVP.js} +12 -12
  129. package/dist/{search-AMEGRH24.js → search-4HW2HAPD.js} +9 -9
  130. package/dist/{section-73Z34PVE.js → section-PWWC2XPV.js} +13 -13
  131. package/dist/{send-IZBSEET5.js → send-JZMFXJ2B.js} +13 -13
  132. package/dist/{sessions-WVQ2U2W4.js → sessions-KQOSJ3OP.js} +28 -28
  133. package/dist/{snooze-7IBHY5MY.js → snooze-ZMYLNEVQ.js} +12 -12
  134. package/dist/{start-AU62TW6M.js → start-L2S4FTDD.js} +12 -12
  135. package/dist/{state-IZV7DAPL.js → state-BR43ONIH.js} +15 -6
  136. package/dist/state-BR43ONIH.js.map +1 -0
  137. package/dist/{status-Z7OMNYZX.js → status-N4WDRKZP.js} +14 -14
  138. package/dist/{statusline-VJFY7ZAB.js → statusline-WKKYCH7O.js} +5 -5
  139. package/dist/{statusline-hook-JA7MNE5H.js → statusline-hook-K7KPN2H6.js} +3 -3
  140. package/dist/{stop-PWNXSFBD.js → stop-IMXPEISI.js} +12 -12
  141. package/dist/{sync-2BTZVDDG.js → sync-5Q5FLL2B.js} +33 -33
  142. package/dist/{time-CTCIAXIY.js → time-ZK7RLSJI.js} +14 -14
  143. package/dist/{time-actions-UYBOXET6.js → time-actions-YOXF5WC7.js} +5 -5
  144. package/dist/{timesheet-BUFQ34FC.js → timesheet-73FNOA42.js} +16 -16
  145. package/dist/{todo-2R7VID57.js → todo-TALKJYK6.js} +5 -5
  146. package/dist/{tree-LQDPAXQA.js → tree-S2TMFTUZ.js} +32 -33
  147. package/dist/{tree-LQDPAXQA.js.map → tree-S2TMFTUZ.js.map} +1 -1
  148. package/dist/{update-2IYJHY7H.js → update-WZJ7B3QA.js} +19 -19
  149. package/dist/{usage-IR5GNF4R.js → usage-LQVXS6YO.js} +11 -11
  150. package/dist/{version-ONEI52TI.js → version-TVT6GSRF.js} +5 -5
  151. package/dist/{wait-6DH34L53.js → wait-AQGROBL7.js} +13 -13
  152. package/dist/wd-bin.js +4 -4
  153. package/dist/web/assets/PtyView-Bx7qpA8Y.js +96 -0
  154. package/dist/web/assets/PtyView-Bx7qpA8Y.js.map +1 -0
  155. package/dist/web/assets/index-CpqiTeqj.css +1 -0
  156. package/dist/web/assets/index-CxSvivCX.js +126 -0
  157. package/dist/web/assets/index-CxSvivCX.js.map +1 -0
  158. package/dist/web/index.html +2 -2
  159. package/dist/{web-RIHGV7YY.js → web-AKDU7HMP.js} +3735 -2713
  160. package/dist/web-AKDU7HMP.js.map +1 -0
  161. package/npm-shrinkwrap.json +2 -2
  162. package/package.json +1 -1
  163. package/dist/chunk-27LWL6QE.js.map +0 -1
  164. package/dist/chunk-2MAZV5KS.js.map +0 -1
  165. package/dist/chunk-46XSWHCQ.js.map +0 -1
  166. package/dist/chunk-4TTYEMOY.js.map +0 -1
  167. package/dist/chunk-5R5JEQW7.js.map +0 -1
  168. package/dist/chunk-66VPQOVZ.js.map +0 -1
  169. package/dist/chunk-7S2NQRWL.js +0 -9
  170. package/dist/chunk-AQP6SCCJ.js +0 -66
  171. package/dist/chunk-AQP6SCCJ.js.map +0 -1
  172. package/dist/chunk-E67DOUVU.js.map +0 -1
  173. package/dist/chunk-IFQOOCT7.js.map +0 -1
  174. package/dist/chunk-L22AWXWA.js +0 -29
  175. package/dist/chunk-L22AWXWA.js.map +0 -1
  176. package/dist/chunk-PHGVVFTF.js.map +0 -1
  177. package/dist/chunk-RJUMLWXP.js.map +0 -1
  178. package/dist/chunk-RQFHA5BM.js.map +0 -1
  179. package/dist/chunk-TIG7NHVO.js.map +0 -1
  180. package/dist/chunk-V4U5RGEG.js.map +0 -1
  181. package/dist/chunk-Y7T73SAP.js.map +0 -1
  182. package/dist/chunk-Z7I6DQAR.js.map +0 -1
  183. package/dist/chunk-ZXHMC7UO.js.map +0 -1
  184. package/dist/pty-host-XDDXA4SL.js.map +0 -1
  185. package/dist/state-IZV7DAPL.js.map +0 -1
  186. package/dist/web/assets/PtyView-kBcAOwHr.js +0 -96
  187. package/dist/web/assets/PtyView-kBcAOwHr.js.map +0 -1
  188. package/dist/web/assets/index-BgfR3N99.js +0 -124
  189. package/dist/web/assets/index-BgfR3N99.js.map +0 -1
  190. package/dist/web/assets/index-CKpHjII8.css +0 -1
  191. package/dist/web-RIHGV7YY.js.map +0 -1
  192. /package/dist/{account-QSNXX5YV.js.map → account-QZH4MA42.js.map} +0 -0
  193. /package/dist/{add-repo-YZ32MLZG.js.map → add-repo-CAQSJPLG.js.map} +0 -0
  194. /package/dist/{answer-Y4T5X446.js.map → answer-3QIKCVON.js.map} +0 -0
  195. /package/dist/{attach-XPYWYHDP.js.map → attach-GR3AD4D7.js.map} +0 -0
  196. /package/dist/{broadcast-FATIANHX.js.map → broadcast-WW6DBVZ3.js.map} +0 -0
  197. /package/dist/{catchup-OTI2KZG5.js.map → catchup-RMYAFVK3.js.map} +0 -0
  198. /package/dist/{chunk-VV3NFLLP.js.map → chunk-26YZYL77.js.map} +0 -0
  199. /package/dist/{chunk-UP2JTDBI.js.map → chunk-32VFZGPR.js.map} +0 -0
  200. /package/dist/{chunk-ZRATYLBB.js.map → chunk-33XSEAHO.js.map} +0 -0
  201. /package/dist/{chunk-MM7344RC.js.map → chunk-4CNBSPNL.js.map} +0 -0
  202. /package/dist/{chunk-RHDZPV6C.js.map → chunk-4EL7FVQQ.js.map} +0 -0
  203. /package/dist/{chunk-FMLE2WSN.js.map → chunk-4IRPL6XA.js.map} +0 -0
  204. /package/dist/{chunk-BNKVENDF.js.map → chunk-4NUWTGAP.js.map} +0 -0
  205. /package/dist/{chunk-KL4YYV37.js.map → chunk-5FBRQW2F.js.map} +0 -0
  206. /package/dist/{chunk-JNCKZ3OF.js.map → chunk-63FTAMDO.js.map} +0 -0
  207. /package/dist/{chunk-WKOJ7NXD.js.map → chunk-6RMB3I3V.js.map} +0 -0
  208. /package/dist/{chunk-6J6U7JXN.js.map → chunk-6YZBMC35.js.map} +0 -0
  209. /package/dist/{chunk-3BSFVKMK.js.map → chunk-7DUGVGUZ.js.map} +0 -0
  210. /package/dist/{chunk-IOHK45WE.js.map → chunk-7OFVXQSM.js.map} +0 -0
  211. /package/dist/{chunk-34E2LA3M.js.map → chunk-A6N4FF4K.js.map} +0 -0
  212. /package/dist/{chunk-RCGFHJM7.js.map → chunk-CBCOVIXZ.js.map} +0 -0
  213. /package/dist/{chunk-ICXUTMGH.js.map → chunk-DGVCN7HB.js.map} +0 -0
  214. /package/dist/{chunk-B5WDN63X.js.map → chunk-DMGNJ73M.js.map} +0 -0
  215. /package/dist/{chunk-LZZCJAJQ.js.map → chunk-DTUKXBAR.js.map} +0 -0
  216. /package/dist/{chunk-2K5TDJ7M.js.map → chunk-FI2HURCM.js.map} +0 -0
  217. /package/dist/{chunk-2HHIDWHH.js.map → chunk-FJQT7OWV.js.map} +0 -0
  218. /package/dist/{chunk-LKESANVD.js.map → chunk-FNA27U2B.js.map} +0 -0
  219. /package/dist/{chunk-6YMLYU5G.js.map → chunk-FZJ472VJ.js.map} +0 -0
  220. /package/dist/{chunk-ADIN3DTD.js.map → chunk-GG4VKPAX.js.map} +0 -0
  221. /package/dist/{chunk-V7GCYL6A.js.map → chunk-GOK6JBB2.js.map} +0 -0
  222. /package/dist/{chunk-IKX3B26P.js.map → chunk-GZYXCMJH.js.map} +0 -0
  223. /package/dist/{chunk-VFH4SU3M.js.map → chunk-HRBAXQXF.js.map} +0 -0
  224. /package/dist/{chunk-2VRZVUM7.js.map → chunk-ISE5VJP2.js.map} +0 -0
  225. /package/dist/{chunk-OCMNBOPX.js.map → chunk-JVHHSKBJ.js.map} +0 -0
  226. /package/dist/{chunk-3S6L437Q.js.map → chunk-K3H4EQHV.js.map} +0 -0
  227. /package/dist/{chunk-KDO7D46L.js.map → chunk-KJRUC2QY.js.map} +0 -0
  228. /package/dist/{chunk-PSUJZUYX.js.map → chunk-LM2T5OR3.js.map} +0 -0
  229. /package/dist/{chunk-UBOKRHNV.js.map → chunk-MKJH2D4V.js.map} +0 -0
  230. /package/dist/{chunk-NWOCQVSL.js.map → chunk-MR7XFKTK.js.map} +0 -0
  231. /package/dist/{chunk-PCNNW63Z.js.map → chunk-NFWSJFYY.js.map} +0 -0
  232. /package/dist/{chunk-353ZINJ2.js.map → chunk-NXN7B3BE.js.map} +0 -0
  233. /package/dist/{chunk-WY7QZ2P7.js.map → chunk-O6UWELSS.js.map} +0 -0
  234. /package/dist/{chunk-WVV54JP3.js.map → chunk-OAP7XYNK.js.map} +0 -0
  235. /package/dist/{chunk-AHI2WVWP.js.map → chunk-OYLUYJTY.js.map} +0 -0
  236. /package/dist/{chunk-GZGJQKQT.js.map → chunk-SKRVI3Z4.js.map} +0 -0
  237. /package/dist/{chunk-E7WPTSHQ.js.map → chunk-UJ2GAHAZ.js.map} +0 -0
  238. /package/dist/{chunk-4O4VQQEA.js.map → chunk-VJ5XMYXE.js.map} +0 -0
  239. /package/dist/{chunk-IDQVTWLX.js.map → chunk-VRTOALU3.js.map} +0 -0
  240. /package/dist/{chunk-7S2NQRWL.js.map → chunk-WAIFKHD6.js.map} +0 -0
  241. /package/dist/{chunk-LJKF73JB.js.map → chunk-WDL6ANZ3.js.map} +0 -0
  242. /package/dist/{chunk-F3PEUOTP.js.map → chunk-WGKU5PPI.js.map} +0 -0
  243. /package/dist/{chunk-JVBIWU7S.js.map → chunk-X5RHYVXY.js.map} +0 -0
  244. /package/dist/{chunk-FSQJOZS4.js.map → chunk-ZI7XN4VD.js.map} +0 -0
  245. /package/dist/{cleanup-M5TY4FQS.js.map → cleanup-OMYTNUP4.js.map} +0 -0
  246. /package/dist/{cli-446A536X.js.map → cli-G7EUXIPW.js.map} +0 -0
  247. /package/dist/{command-hook-installer-7Q7UD7AU.js.map → command-hook-installer-GMQ4IVDE.js.map} +0 -0
  248. /package/dist/{config-JLORGUXN.js.map → config-YO5QGP3B.js.map} +0 -0
  249. /package/dist/{diff-4O5HXNZ7.js.map → diff-LIG47TN7.js.map} +0 -0
  250. /package/dist/{digest-IAAZXJCC.js.map → digest-FMSWN4A6.js.map} +0 -0
  251. /package/dist/{fork-ULJYPEKY.js.map → fork-A7U7AM4M.js.map} +0 -0
  252. /package/dist/{history-JFZF22M7.js.map → history-NMHRGJ76.js.map} +0 -0
  253. /package/dist/{hook-UYOIQVJ7.js.map → hook-NDETZUEC.js.map} +0 -0
  254. /package/dist/{hydrate-DROI4RJ7.js.map → hydrate-ZTKYATH3.js.map} +0 -0
  255. /package/dist/{init-FF75CQM7.js.map → init-MMJF5ZVJ.js.map} +0 -0
  256. /package/dist/{install-skills-XSAHNBYD.js.map → install-skills-KS6N4U6L.js.map} +0 -0
  257. /package/dist/{list-5FEHBP6N.js.map → list-Z77M43EU.js.map} +0 -0
  258. /package/dist/{move-422L6PPI.js.map → move-YQIYXSFQ.js.map} +0 -0
  259. /package/dist/{note-AAXPD5VA.js.map → note-C5SVIML6.js.map} +0 -0
  260. /package/dist/{overlaps-WPNUYOFF.js.map → overlaps-ARNCAXUT.js.map} +0 -0
  261. /package/dist/{pin-QXPF23BB.js.map → pin-D4J3XXDU.js.map} +0 -0
  262. /package/dist/{pr-QLGXPKPQ.js.map → pr-VMDNT4T7.js.map} +0 -0
  263. /package/dist/{prune-GRHKRRVT.js.map → prune-XKMNAY7O.js.map} +0 -0
  264. /package/dist/{read-YWKD2DGP.js.map → read-PWWKV66E.js.map} +0 -0
  265. /package/dist/{recent-SI5BDVVH.js.map → recent-C4ZH75KK.js.map} +0 -0
  266. /package/dist/{remove-RXXCHY44.js.map → remove-QFZ4YGVH.js.map} +0 -0
  267. /package/dist/{restart-CPNDEXU6.js.map → restart-NZ2QYWA4.js.map} +0 -0
  268. /package/dist/{resume-BLP4TTJK.js.map → resume-PRMBJOOG.js.map} +0 -0
  269. /package/dist/{review-now-ADWZPELT.js.map → review-now-HHQIBVUS.js.map} +0 -0
  270. /package/dist/{run-JFCDJ3EV.js.map → run-LUXAB6F5.js.map} +0 -0
  271. /package/dist/{screen-LBOPAUXV.js.map → screen-PJJEEXVP.js.map} +0 -0
  272. /package/dist/{search-AMEGRH24.js.map → search-4HW2HAPD.js.map} +0 -0
  273. /package/dist/{section-73Z34PVE.js.map → section-PWWC2XPV.js.map} +0 -0
  274. /package/dist/{send-IZBSEET5.js.map → send-JZMFXJ2B.js.map} +0 -0
  275. /package/dist/{sessions-WVQ2U2W4.js.map → sessions-KQOSJ3OP.js.map} +0 -0
  276. /package/dist/{snooze-7IBHY5MY.js.map → snooze-ZMYLNEVQ.js.map} +0 -0
  277. /package/dist/{start-AU62TW6M.js.map → start-L2S4FTDD.js.map} +0 -0
  278. /package/dist/{status-Z7OMNYZX.js.map → status-N4WDRKZP.js.map} +0 -0
  279. /package/dist/{statusline-VJFY7ZAB.js.map → statusline-WKKYCH7O.js.map} +0 -0
  280. /package/dist/{statusline-hook-JA7MNE5H.js.map → statusline-hook-K7KPN2H6.js.map} +0 -0
  281. /package/dist/{stop-PWNXSFBD.js.map → stop-IMXPEISI.js.map} +0 -0
  282. /package/dist/{sync-2BTZVDDG.js.map → sync-5Q5FLL2B.js.map} +0 -0
  283. /package/dist/{time-CTCIAXIY.js.map → time-ZK7RLSJI.js.map} +0 -0
  284. /package/dist/{time-actions-UYBOXET6.js.map → time-actions-YOXF5WC7.js.map} +0 -0
  285. /package/dist/{timesheet-BUFQ34FC.js.map → timesheet-73FNOA42.js.map} +0 -0
  286. /package/dist/{todo-2R7VID57.js.map → todo-TALKJYK6.js.map} +0 -0
  287. /package/dist/{update-2IYJHY7H.js.map → update-WZJ7B3QA.js.map} +0 -0
  288. /package/dist/{usage-IR5GNF4R.js.map → usage-LQVXS6YO.js.map} +0 -0
  289. /package/dist/{version-ONEI52TI.js.map → version-TVT6GSRF.js.map} +0 -0
  290. /package/dist/{wait-6DH34L53.js.map → wait-AQGROBL7.js.map} +0 -0
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/core/diff/diff-scope.ts","../src/core/platform/web-static.ts","../src/server/local-origin.ts","../src/server/local-server.ts","../src/server/spa-handler.ts","../src/server/diff-server.ts","../src/core/diff/file-context.ts","../src/core/comments/comment-schemas.ts"],"sourcesContent":["import fs from 'node:fs';\nimport path from 'node:path';\nimport { git } from '../git/git.js';\nimport { loadHistory, type WorktreeSession } from '../sessions/history.js';\nimport type { RepoSpec } from './repo-spec.js';\nimport { report } from '../platform/report.js';\n\nexport interface DiffScope {\n isGroup: boolean;\n session: WorktreeSession | null;\n /** Repos to diff (1 for single, N for group). */\n repos: { name: string; root: string }[];\n /** Name of the repo whose subtree the user is in (initial active tab). */\n activeRepoName: string | null;\n}\n\nexport interface ResolvedBase {\n base: string;\n source: 'arg' | 'session' | 'auto-detected' | 'default';\n}\n\nfunction normPath(p: string): string {\n return path.resolve(p).replace(/\\\\/g, '/').toLowerCase();\n}\n\n/**\n * Like {@link normPath} but resolves to the OS-canonical real path.\n * `git rev-parse --show-toplevel` returns the realpath (e.g. macOS `/var` →\n * `/private/var`, and on Windows the long-form name), so comparing it to a\n * stored session path must canonicalize both sides the same way.\n *\n * Uses `realpathSync.native`: the plain `realpathSync` does NOT expand Windows\n * 8.3 short names (`SAMDEV~1` → `SamDev`), so a session path under a\n * short-name parent would never match git's long-form toplevel. `.native`\n * resolves both 8.3 and symlinks. Falls back to {@link normPath} for paths\n * that don't exist (e.g. unit-test fixtures).\n */\nfunction realNorm(p: string): string {\n try {\n return normPath(fs.realpathSync.native(p));\n } catch {\n return normPath(p);\n }\n}\n\n/**\n * Resolve what scope to diff based on cwd. Handles single-repo worktrees,\n * group worktrees (cwd at group root or anywhere inside a sub-repo), and\n * \"random\" git repos not managed by `work`.\n */\nexport function resolveScope(cwd: string): DiffScope | null {\n const normCwd = normPath(cwd);\n const sessions = loadHistory();\n\n // cwd's own git worktree root. Used to reject session-path matches that are\n // really a *parent* repo: linked worktrees often live physically inside\n // another repo (e.g. `<repo>/.claude/worktrees/<branch>`), so a naive prefix\n // match collapses every nested worktree onto the parent's scope — they'd\n // share one daemon and show each other's diff.\n const top = git(['rev-parse', '--show-toplevel'], cwd);\n const toplevel = top.exitCode === 0 && top.stdout ? top.stdout : null;\n const realTop = toplevel ? realNorm(toplevel) : null;\n\n // 1. cwd is at or inside one of a session's repo paths.\n for (const s of sessions) {\n for (const p of s.paths) {\n const np = normPath(p);\n if (normCwd === np || normCwd.startsWith(np + '/')) {\n // Only honour the match if this session path is cwd's actual worktree\n // root. When cwd is in a nested worktree, its toplevel is deeper than\n // `np` — skip so we resolve the real (nested) worktree below.\n if (realTop && realNorm(p) !== realTop) continue;\n if (s.isGroup) {\n return {\n isGroup: true,\n session: s,\n repos: s.paths.map((rp) => ({ name: path.basename(rp), root: rp })),\n activeRepoName: path.basename(p),\n };\n }\n return {\n isGroup: false,\n session: s,\n repos: [{ name: path.basename(p), root: p }],\n activeRepoName: path.basename(p),\n };\n }\n }\n }\n\n // 2. cwd is at the group root (parent of all of a group's repo paths).\n for (const s of sessions) {\n if (!s.isGroup || s.paths.length === 0) continue;\n const parents = s.paths.map((p) => normPath(path.dirname(p)));\n const groupRoot = parents[0];\n if (!parents.every((par) => par === groupRoot)) continue;\n if (normCwd === groupRoot || normCwd.startsWith(groupRoot + '/')) {\n return {\n isGroup: true,\n session: s,\n repos: s.paths.map((rp) => ({ name: path.basename(rp), root: rp })),\n activeRepoName: null,\n };\n }\n }\n\n // 3. Fall back to git rev-parse for repos not managed by `work`.\n if (!toplevel) return null;\n return {\n isGroup: false,\n session: null,\n repos: [{ name: path.basename(toplevel), root: toplevel }],\n activeRepoName: path.basename(toplevel),\n };\n}\n\n/**\n * Find any plausible parent branch — same candidate list as\n * `detectParentBranch`, but DOESN'T require the parent to have commits\n * past HEAD. Returns the candidate with the most-recent merge-base (or\n * null only if no candidates exist at all).\n *\n * Used by the static renderer and the diff server's `?base=branch`\n * route to decide whether to offer the \"Since branch\" tab. `detectParentBranch`\n * skips parents where merge-base == HEAD (correct for the CLI's \"show\n * me what I added past parent\" semantic — empty diff), but the toggle\n * should still appear in that case so the user can confirm \"no, there's\n * nothing committed yet\".\n */\nexport function findAnyParentBranch(cwd: string): string | null {\n return findParent(cwd, false);\n}\n\n/** Walk candidate base branches and pick the one with the most recent merge-base. */\nexport function detectParentBranch(cwd: string): string | null {\n return findParent(cwd, true);\n}\n\nconst PARENT_CANDIDATES = ['main', 'master', 'dev', 'develop'].flatMap((name) => [name, `origin/${name}`]);\n\nfunction findParent(cwd: string, requireAheadOfParent: boolean): string | null {\n const currentResult = git(['rev-parse', '--abbrev-ref', 'HEAD'], cwd);\n const currentBranch = currentResult.exitCode === 0 ? currentResult.stdout : '';\n\n const candidates = PARENT_CANDIDATES;\n\n let best: { ref: string; sha: string; time: number } | null = null;\n let fresh: boolean | undefined;\n\n for (const ref of candidates) {\n if (ref === currentBranch) continue;\n const exists = git(['rev-parse', '--verify', '--quiet', ref], cwd);\n if (exists.exitCode !== 0 || !exists.stdout) continue;\n\n const mb = git(['merge-base', ref, 'HEAD'], cwd);\n if (mb.exitCode !== 0 || !mb.stdout) continue;\n\n // Skip parents where the merge-base IS HEAD only when the caller\n // asked us to (CLI \"show me what I added\" semantics): a `dev` that\n // already contains this branch's commits isn't where it came from. When\n // called for the toggle UI, we want to surface the parent even though\n // the diff will be empty. A branch with no commits of its own yet is\n // the exception: there every parent it was made from contains HEAD, and\n // skipping them picked an older mainline — a branch just made from dev\n // showed all of dev's commits since main.\n if (requireAheadOfParent) {\n const headSha = git(['rev-parse', 'HEAD'], cwd).stdout;\n if (mb.stdout === headSha && !(fresh ??= stillAtCreation(cwd, currentBranch, headSha))) continue;\n }\n\n const timeResult = git(['show', '-s', '--format=%ct', mb.stdout], cwd);\n if (timeResult.exitCode !== 0) continue;\n const time = Number(timeResult.stdout);\n if (!Number.isFinite(time)) continue;\n\n // A tie in time (commits made in the same second): the later of the two, the one the other is an ancestor of.\n const later =\n !!best &&\n time === best.time &&\n mb.stdout !== best.sha &&\n git(['merge-base', '--is-ancestor', best.sha, mb.stdout], cwd).exitCode === 0;\n if (!best || time > best.time || later) {\n best = { ref, sha: mb.stdout, time };\n }\n }\n\n return best?.ref ?? null;\n}\n\n/**\n * The branch has no commits of its own: it was made here from HEAD or a\n * mainline (its reflog's oldest entry, \"branch: Created from dev\") and HEAD is\n * still that commit. One made from its own `origin/<branch>` (a PR, someone's\n * branch) or at a commit (Restore) carries commits that are its own, though\n * they weren't made here. No reflog (expired, a detached HEAD) says no.\n */\nfunction stillAtCreation(cwd: string, branch: string, headSha: string): boolean {\n if (!branch || branch === 'HEAD') return false;\n const log = git(['reflog', 'show', '--format=%H %gs', `refs/heads/${branch}`, '--'], cwd);\n if (log.exitCode !== 0 || !log.stdout) return false;\n const lines = log.stdout.split('\\n').filter(Boolean);\n const m = /^(\\S+) branch: Created from (\\S+)$/.exec(lines[lines.length - 1] ?? '');\n if (!m || m[1] !== headSha) return false;\n const from = m[2].replace(/^refs\\/(heads|remotes)\\//, '');\n return from === 'HEAD' || PARENT_CANDIDATES.includes(from);\n}\n\n/**\n * A recorded base, as fresh as this clone has it: the branch or its\n * `origin/` copy, whichever shares the later commit with HEAD (the local one\n * is pulled only when a worktree is made from it, so it falls behind a branch\n * that merged origin's since). Null when neither exists (deleted since).\n */\nfunction recordedBase(cwd: string, name: string): { ref: string; mb: string } | null {\n const refs = name.startsWith('origin/') ? [name] : [name, `origin/${name}`];\n let best: { ref: string; mb: string } | null = null;\n for (const ref of refs) {\n if (git(['rev-parse', '--verify', '--quiet', ref], cwd).exitCode !== 0) continue;\n const mb = git(['merge-base', ref, 'HEAD'], cwd);\n if (mb.exitCode !== 0 || !mb.stdout) continue;\n if (!best || (mb.stdout !== best.mb && git(['merge-base', '--is-ancestor', best.mb, mb.stdout], cwd).exitCode === 0)) {\n best = { ref, mb: mb.stdout };\n }\n }\n return best;\n}\n\nexport function resolveBase(scope: DiffScope, argv: { base?: string; branch?: boolean }): ResolvedBase {\n if (argv.base) return { base: argv.base, source: 'arg' };\n\n if (argv.branch) {\n if (scope.session?.baseBranch) {\n return { base: scope.session.baseBranch, source: 'session' };\n }\n const primaryRoot = scope.repos.find((r) => r.name === scope.activeRepoName)?.root ?? scope.repos[0].root;\n const detected = detectParentBranch(primaryRoot);\n if (detected) return { base: detected, source: 'auto-detected' };\n\n report('error', 'Could not determine a parent branch for this worktree.');\n report('detail', 'Pass one explicitly: diff <ref>');\n process.exit(1);\n }\n\n return { base: 'HEAD', source: 'default' };\n}\n\n/**\n * Compute per-repo merge-base when comparing against a non-HEAD ref.\n *\n * `perRepoBase` (keyed by repo root) overrides `base` for individual repos —\n * used by group worktrees forked with different bases per repo\n * (`work tree --base backend=dev --base frontend=feat/x`). A repo without an\n * override falls back to the shared `base`.\n */\nexport function buildRepoSpecs(scope: DiffScope, base: string, perRepoBase?: Record<string, string>): RepoSpec[] {\n return scope.repos.map((r) => {\n const repoBase = perRepoBase?.[r.root] ?? base;\n let diffArg = repoBase;\n if (repoBase !== 'HEAD') {\n const mb = git(['merge-base', repoBase, 'HEAD'], r.root);\n if (mb.exitCode === 0 && mb.stdout) diffArg = mb.stdout;\n }\n return { name: r.name, root: r.root, diffArg };\n });\n}\n\nexport interface ResolvedRepoDiff {\n /** The git ref the diff was computed against. `HEAD` for uncommitted,\n * the resolved parent (e.g. `origin/main`) for branch mode. */\n resolvedBase: string;\n /** The actual argument passed to `git diff` — typically the merge-base\n * sha for branch mode, or `HEAD` for uncommitted. */\n diffArg: string;\n}\n\n/**\n * Resolve the diff target for a single repo. Centralises the\n * \"find-parent → merge-base → fall back to HEAD\" dance that previously\n * lived in three places (scope-routes, web-server, the static renderer).\n *\n * For `base === 'uncommitted'` this is trivially `HEAD`. For\n * `base === 'branch'` it prefers an explicit `sessionBaseBranch` (the\n * value the user recorded with `work tree --base`), falling back to\n * `findAnyParentBranch` (so the toggle stays available even when the\n * branch has no commits past parent yet — diff just renders empty).\n */\nexport function resolveRepoDiff(root: string, base: 'uncommitted' | 'branch', sessionBaseBranch?: string | null): ResolvedRepoDiff {\n if (base === 'uncommitted') {\n return { resolvedBase: 'HEAD', diffArg: 'HEAD' };\n }\n // Prefer a parent we're actually *ahead of* (`detectParentBranch` skips\n // candidates whose merge-base is HEAD, e.g. a `dev` that already contains\n // this branch — unless the branch has no commits yet, when the one it was\n // made from is right). `findAnyParentBranch` would pick the most-recent merge-base\n // even when it's HEAD — yielding a useless 0-commit \"since branch\" diff.\n // Fall back to it only so the toggle still resolves to *something*.\n // A recorded base wins, at its freshest; one that's gone (merged and deleted) leaves it to detection.\n const recorded = sessionBaseBranch ? recordedBase(root, sessionBaseBranch) : null;\n if (recorded) return { resolvedBase: recorded.ref, diffArg: recorded.mb };\n const parent = detectParentBranch(root) ?? findAnyParentBranch(root);\n if (!parent) return { resolvedBase: 'HEAD', diffArg: 'HEAD' };\n let diffArg = 'HEAD';\n const mb = git(['merge-base', parent, 'HEAD'], root);\n if (mb.exitCode === 0 && mb.stdout) diffArg = mb.stdout;\n return { resolvedBase: parent, diffArg };\n}\n\n/**\n * Look up the recorded fork point for a worktree path from session history.\n * Prefers the per-repo base (`baseBranches`) for that exact path, falling\n * back to the session's representative `baseBranch`. Returns undefined when\n * the path isn't a known worktree — callers then auto-detect.\n *\n * Used by the scope diff route, which only carries repo paths (no session),\n * so a `wd` forked with `--base feat/x` still diffs against `feat/x` even\n * though auto-detection wouldn't find a non-mainline parent.\n */\nexport function sessionBaseForPath(root: string): string | undefined {\n const norm = normPath(root);\n for (const s of loadHistory()) {\n for (const p of s.paths) {\n if (normPath(p) === norm) {\n return s.baseBranches?.[p] ?? s.baseBranch;\n }\n }\n }\n return undefined;\n}\n","import fs from 'node:fs';\nimport { packageRoot } from './package-root.js';\nimport http from 'node:http';\nimport path from 'node:path';\nimport { fileURLToPath } from 'node:url';\n\nconst MIME: Record<string, string> = {\n '.html': 'text/html; charset=utf-8',\n '.js': 'application/javascript; charset=utf-8',\n '.mjs': 'application/javascript; charset=utf-8',\n '.css': 'text/css; charset=utf-8',\n '.json': 'application/json; charset=utf-8',\n '.svg': 'image/svg+xml',\n '.ico': 'image/x-icon',\n '.map': 'application/json; charset=utf-8',\n};\n\n/** Resolve the directory shipped by the Vite build. */\nexport function resolveWebRoot(): string | null {\n const entryDir = path.dirname(process.argv[1] ?? '');\n const moduleDir = path.dirname(fileURLToPath(import.meta.url));\n const candidates = [\n path.join(entryDir, 'web'),\n // bundled: this module is inlined into dist/<bin>.js, so dist/web is a\n // sibling of the bundle. Works even when argv[1] is an npm bin symlink\n // (which is not realpath'd, so the entryDir candidate above misses).\n path.join(moduleDir, 'web'),\n // dev/tsx: the package's dist/web (wherever under src/ this module sits).\n ...(packageRoot() ? [path.join(packageRoot()!, 'dist', 'web')] : []),\n ];\n for (const c of candidates) {\n if (fs.existsSync(path.join(c, 'index.html'))) return c;\n }\n return null;\n}\n\n/**\n * Serve a static file under `root`. Returns true if it served a file. Does\n * NOT do SPA fallback — caller decides whether to re-try with /index.html\n * on miss.\n */\nexport function serveStatic(root: string, urlPath: string, res: http.ServerResponse): boolean {\n const clean = urlPath.split('?')[0];\n const requested = clean === '/' ? '/index.html' : clean;\n const filePath = path.join(root, requested);\n const norm = path.normalize(filePath);\n const base = path.normalize(root);\n if (norm !== base && !norm.startsWith(base + path.sep)) return false;\n let stat: fs.Stats;\n try {\n stat = fs.statSync(norm);\n } catch {\n return false;\n }\n if (!stat.isFile()) return false;\n const ext = path.extname(norm).toLowerCase();\n res.writeHead(200, {\n 'Content-Type': MIME[ext] ?? 'application/octet-stream',\n 'Cache-Control': 'no-cache',\n });\n fs.createReadStream(norm).pipe(res);\n return true;\n}\n\n/** Convenience: serve the file if it exists, else fall back to index.html. */\nexport function serveStaticOrShell(root: string, urlPath: string, res: http.ServerResponse): boolean {\n if (serveStatic(root, urlPath, res)) return true;\n if (serveStatic(root, '/index.html', res)) return true;\n return false;\n}\n","/**\n * Who may talk to our localhost servers (work web / wd / comment server).\n *\n * Binding to 127.0.0.1 keeps the network out, and the Host check stops DNS\n * rebinding — but neither stops a web page you have open from making YOUR\n * browser send requests to 127.0.0.1:<port> (cross-site request forgery).\n * The port is predictable and session ids are guessable, and the terminal\n * WebSocket types straight into Claude — so every request that changes\n * something, and every WebSocket upgrade, must come from our own origin.\n *\n * Rules:\n * - Host must be 127.0.0.1:<port> or localhost:<port> (DNS rebinding).\n * - A browser marking the request `Sec-Fetch-Site: cross-site` (or\n * `same-site`: another localhost port) is refused,\n * except a top-level page load (GET/HEAD, `Sec-Fetch-Mode: navigate`,\n * `Sec-Fetch-Dest: document`): clicking a dashboard or diff link in\n * GitHub, Jira or Slack must open it. The opening site can't read the\n * response and a GET changes nothing; frames stay refused, so no other\n * page can embed the dashboard.\n * - Mutating requests (anything but GET/HEAD/OPTIONS) and WebSocket\n * upgrades: `Origin` must be absent (non-browser callers — the Claude\n * hooks, `wd`, the CLI — send none) or exactly our own origin. Browsers\n * always send Origin on cross-origin POSTs and on every WebSocket, and a\n * page can't forge it. `Origin: null` (sandboxed frames, file://) is\n * refused.\n */\n\nexport function allowedHost(host: string | undefined, port: number): boolean {\n return host === `127.0.0.1:${port}` || host === `localhost:${port}`;\n}\n\nexport function allowedOrigin(origin: string | undefined, port: number): boolean {\n if (origin === undefined || origin === '') return true;\n return origin === `http://127.0.0.1:${port}` || origin === `http://localhost:${port}`;\n}\n\nconst SAFE_METHODS = new Set(['GET', 'HEAD', 'OPTIONS']);\n\nexport interface RequestFacts {\n method: string;\n host?: string;\n origin?: string;\n secFetchSite?: string;\n secFetchMode?: string;\n secFetchDest?: string;\n /** A WebSocket upgrade — always checked like a mutating request. */\n upgrade?: boolean;\n}\n\n/** Null when allowed, else a short reason (for the 403 body / logs). */\nexport function refuseReason(req: RequestFacts, port: number): string | null {\n if (!allowedHost(req.host, port)) return 'bad host';\n const mutating = req.upgrade || !SAFE_METHODS.has(req.method.toUpperCase());\n const pageLoad =\n !req.upgrade &&\n ['GET', 'HEAD'].includes(req.method.toUpperCase()) &&\n req.secFetchMode === 'navigate' &&\n req.secFetchDest === 'document';\n // same-site = another localhost port (your dev servers, say): the\n // dashboard itself is always same-origin, so treat it like cross-site.\n if ((req.secFetchSite === 'cross-site' || req.secFetchSite === 'same-site') && !pageLoad) return 'cross-site request';\n if (mutating && !allowedOrigin(req.origin, port)) return 'foreign origin';\n return null;\n}\n","import { report } from '../core/platform/report.js';\nimport { Hono } from 'hono';\nimport { serve, type ServerType } from '@hono/node-server';\nimport { refuseReason } from './local-origin.js';\n\n// The one way to start a local HTTP server (work web, wd, the comment\n// server, the demo): 127.0.0.1 only, random port, behind the Host/Origin\n// guard. Its own module so a server that needs no git/fs — the demo — can\n// use it without importing the diff server.\n\nexport interface DiffServerHandle {\n url: string;\n port: number;\n stop(): Promise<void>;\n}\n\n/** Start a Hono app on a random port; resolve when it's listening. The\n * raw Node server is exposed via `httpServer` so callers can attach\n * WebSocket upgrade handlers (the terminal bridge).\n *\n * Installs a guard (core/local-origin.ts): Host must be ours (DNS\n * rebinding), and mutating requests must not come from another origin\n * (cross-site request forgery from any page open in the browser). The SPA\n * is served same-origin, and Node callers send no Origin, so both pass.\n */\nexport function launch(app: Hono): Promise<DiffServerHandle & { httpServer: ServerType }> {\n return new Promise((resolve) => {\n // Captured before serve() resolves; first guarded request runs after\n // this is set because serve() doesn't accept connections until it's\n // bound, and bind precedes the info-callback.\n let listenPort = 0;\n const guard = new Hono();\n guard.use('*', async (c, next) => {\n // Host (DNS rebinding) + Origin / Sec-Fetch-Site (cross-site request\n // forgery from any page open in the browser) — see local-origin.ts.\n const reason = refuseReason(\n {\n method: c.req.method,\n host: c.req.header('host'),\n origin: c.req.header('origin'),\n secFetchSite: c.req.header('sec-fetch-site'),\n secFetchMode: c.req.header('sec-fetch-mode'),\n secFetchDest: c.req.header('sec-fetch-dest'),\n },\n listenPort,\n );\n if (reason) return c.text(`Forbidden (${reason})`, 403);\n await next();\n });\n guard.route('/', app);\n\n const server: ServerType = serve({ fetch: guard.fetch, port: 0, hostname: '127.0.0.1' }, (info) => {\n listenPort = info.port;\n const url = `http://127.0.0.1:${info.port}/`;\n report('detail', `[server] listening at ${url}`);\n resolve({\n url,\n port: info.port,\n httpServer: server,\n stop: () =>\n new Promise<void>((res) => {\n server.close(() => res());\n }),\n });\n });\n });\n}\n","import fs from 'node:fs';\nimport path from 'node:path';\nimport type { Context } from 'hono';\n\nconst MIME: Record<string, string> = {\n '.html': 'text/html; charset=utf-8',\n '.js': 'application/javascript; charset=utf-8',\n '.mjs': 'application/javascript; charset=utf-8',\n '.css': 'text/css; charset=utf-8',\n '.json': 'application/json; charset=utf-8',\n '.svg': 'image/svg+xml',\n '.ico': 'image/x-icon',\n '.map': 'application/json; charset=utf-8',\n};\n\nfunction readFile(root: string, relPath: string): { body: Buffer; ext: string } | null {\n const clean = relPath.split('?')[0];\n const requested = clean === '/' ? '/index.html' : clean;\n const filePath = path.join(root, requested);\n const norm = path.normalize(filePath);\n if (!norm.startsWith(path.normalize(root))) return null;\n let stat: fs.Stats;\n try {\n stat = fs.statSync(norm);\n } catch {\n return null;\n }\n if (!stat.isFile()) return null;\n const ext = path.extname(norm).toLowerCase();\n return { body: fs.readFileSync(norm), ext };\n}\n\n/**\n * Hono handler for the bundled SPA. Tries to serve the requested file; if it\n * doesn't exist, falls back to index.html so client-side routing works on\n * deep links. Skips /api/* paths entirely (those should be handled by\n * earlier routes; if we reach here it's a 404).\n */\nexport function serveSpa(c: Context, webRoot: string): Response {\n const url = new URL(c.req.url);\n if (url.pathname.startsWith('/api/')) {\n return c.json({ error: 'not found' }, 404);\n }\n const hit = readFile(webRoot, url.pathname) ?? readFile(webRoot, '/index.html');\n if (!hit) return c.json({ error: 'not found' }, 404);\n return new Response(new Uint8Array(hit.body), {\n status: 200,\n headers: {\n 'Content-Type': MIME[hit.ext] ?? 'application/octet-stream',\n 'Cache-Control': 'no-cache',\n },\n });\n}\n","import { launch, type DiffServerHandle } from './local-server.js';\n\nexport { launch, type DiffServerHandle } from './local-server.js';\nimport { Hono, type Context } from 'hono';\nimport { streamSSE } from 'hono/streaming';\nimport { computeDiff } from '../core/diff/diff-pipeline.js';\nimport { readContextLines } from '../core/diff/file-context.js';\nimport { createFsWatcher } from '../core/platform/fs-watcher.js';\nimport { resolveRepoDiff } from '../core/diff/diff-scope.js';\nimport { git } from '../core/git/git.js';\nimport { resolveWebRoot } from '../core/platform/web-static.js';\nimport { serveSpa } from './spa-handler.js';\nimport type { RepoSpec } from '../core/diff/repo-spec.js';\n\nexport interface DiffServerOptions {\n /** Repos this server scopes to. */\n repos: RepoSpec[];\n /** Short human-readable label for /api/context. */\n scopeLabel: string;\n /** Optional session baseBranch (the value captured at `work tree --base`).\n * When set, the `?base=branch` route uses it instead of auto-detection,\n * so the diff matches what the user actually declared. */\n sessionBaseBranch?: string;\n /** Per-repo fork points keyed by repo root. Overrides `sessionBaseBranch`\n * for individual repos in a group forked with different bases per repo. */\n sessionBaseBranches?: Record<string, string>;\n /** Debounce for fs.watch events before broadcasting diff-changed. */\n watchDebounceMs?: number;\n /** When true, /api/context advertises readOnly=true and the SPA hides\n * the comment UI. Default false. */\n readOnly?: boolean;\n /** Called once the base app is built so feature apps (e.g. comments) can\n * mount themselves and emit events via the SSE hub. */\n attachRoutes?: (api: DiffServerApi) => void;\n}\n\n/** A typed SSE event broadcast to every connected client. */\nexport interface SseEvent {\n event: string;\n data: unknown;\n}\n\nexport interface DiffServerApi {\n /** Mount a Hono sub-app at the given path prefix. */\n route(prefix: string, app: Hono): void;\n /** Broadcast on the shared SSE hub. Fan-out is one-shot per client. */\n broadcast(event: string, data: unknown): void;\n}\n\n/**\n * The shared local HTTP server used by both `wd` (read-only) and `wd -c`\n * (comments). Owns the fs watcher, the SSE hub, and the three routes every\n * mode needs: GET /api/context, GET /api/diff, GET /events. Comment routes\n * register themselves via `attachRoutes`.\n */\nexport async function startDiffServer(opts: DiffServerOptions): Promise<DiffServerHandle> {\n const webRoot = resolveWebRoot();\n if (!webRoot) {\n throw new Error('Could not find dist/web/. Run `npm run build` first.');\n }\n\n const sseListeners = new Set<(e: SseEvent) => void>();\n const watcher = createFsWatcher({\n roots: opts.repos.map((r) => r.root),\n debounceMs: opts.watchDebounceMs,\n onChange: () => broadcast('diff-changed', { ts: Date.now() }),\n });\n\n function broadcast(event: string, data: unknown): void {\n const payload: SseEvent = { event, data };\n for (const cb of sseListeners) cb(payload);\n }\n\n const app = new Hono();\n // No CORS headers and no OPTIONS preflight handler — the SPA is served\n // same-origin so its requests don't trigger preflight. The Host guard in\n // `launch` rejects cross-origin requests before they reach any handler.\n\n app.get('/api/context', (c) => {\n // Current branch of the primary repo, for the \"<branch> vs <base>\" title.\n const primaryRoot = opts.repos[0]?.root;\n let headBranch: string | undefined;\n if (primaryRoot) {\n const head = git(['rev-parse', '--abbrev-ref', 'HEAD'], primaryRoot);\n if (head.exitCode === 0 && head.stdout && head.stdout !== 'HEAD') {\n headBranch = head.stdout;\n }\n }\n return c.json({\n mode: 'review',\n scopeLabel: opts.scopeLabel,\n repos: opts.repos.map((r) => ({ name: r.name })),\n readOnly: !!opts.readOnly,\n headBranch,\n });\n });\n\n app.get('/api/diff', (c) => {\n const base = c.req.query('base') === 'branch' ? 'branch' : 'uncommitted';\n try {\n // For 'uncommitted' we honour the configured `diffArg` (typically\n // HEAD) so single-repo callers preserve whatever ref they\n // configured. For 'branch' we delegate to `resolveRepoDiff` per\n // repo — each one resolves its own parent and merge-base. The\n // top-level `resolvedBase` is the primary repo's value (matches\n // scope-routes and web-server behavior for the badge label).\n const resolved = opts.repos.map((r) =>\n base === 'uncommitted'\n ? { resolvedBase: 'HEAD', diffArg: r.diffArg }\n : resolveRepoDiff(r.root, 'branch', opts.sessionBaseBranches?.[r.root] ?? opts.sessionBaseBranch),\n );\n const repos = opts.repos.map((r, i) => ({\n name: r.name,\n root: r.root,\n resolvedBase: resolved[i].resolvedBase,\n files: computeDiff({ root: r.root, diffArg: resolved[i].diffArg }),\n }));\n const resolvedBase = resolved[0]?.resolvedBase ?? 'HEAD';\n return c.json({ repos, base, resolvedBase });\n } catch (err) {\n return c.json({ error: (err as Error).message }, 500);\n }\n });\n\n // Reveal unchanged context lines around a hunk (\"expand lines\"). Maps the\n // SPA's repo name back to its RepoSpec root; single-repo scopes (the\n // common standalone case) skip the lookup.\n app.get('/api/file-lines', (c) => {\n const repoName = c.req.query('repo') ?? '';\n const relPath = c.req.query('path') ?? '';\n const start = Number(c.req.query('start'));\n const end = Number(c.req.query('end'));\n const ref = c.req.query('ref') || undefined;\n if (!relPath || !Number.isInteger(start) || !Number.isInteger(end)) {\n return c.json({ error: 'bad path/start/end' }, 400);\n }\n const root = opts.repos.length === 1 ? opts.repos[0].root : opts.repos.find((r) => r.name === repoName)?.root;\n if (!root) return c.json({ error: 'unknown repo' }, 404);\n const result = readContextLines({ root, relPath, start, end, ref });\n if (!result) return c.json({ error: 'cannot read file' }, 400);\n return c.json(result);\n });\n\n app.get('/events', (c) =>\n streamSSE(c, async (stream) => {\n const listener = (e: SseEvent) => {\n stream.writeSSE({ event: e.event, data: JSON.stringify(e.data) }).catch(() => {\n /* client gone */\n });\n };\n sseListeners.add(listener);\n await stream.writeSSE({ event: 'connected', data: '' });\n // Keep the stream open until the client disconnects.\n await new Promise<void>((resolve) => {\n stream.onAbort(() => {\n sseListeners.delete(listener);\n resolve();\n });\n });\n }),\n );\n\n // attachRoutes can mount Hono sub-apps with their own routes.\n if (opts.attachRoutes) {\n opts.attachRoutes({\n route: (prefix, sub) => app.route(prefix, sub),\n broadcast,\n });\n }\n\n // SPA fallback for the bundled web assets.\n app.get('*', (c: Context) => serveSpa(c, webRoot));\n\n // Wrap the handle so server shutdown also tears down our chokidar watcher.\n // Without this the watcher keeps Node's event loop open after `stop()` —\n // a real test/teardown leak (vitest hangs after a suite that exercises\n // the server) and a wasteful long-running ghost in dev.\n const handle = await launch(app);\n const baseStop = handle.stop;\n return {\n ...handle,\n stop: async () => {\n try {\n watcher.stop();\n } catch {\n /* */\n }\n await baseStop();\n },\n };\n}\n","import fs from 'node:fs';\nimport path from 'node:path';\nimport spawn from '../platform/spawn.js';\nimport { isInsideRoot } from './diff-pipeline.js';\n\nexport interface ContextLinesOptions {\n /** Git toplevel (repo root) the file lives under. */\n root: string;\n /** Repo-relative path of the file. */\n relPath: string;\n /** 1-based inclusive first line to return. */\n start: number;\n /** 1-based inclusive last line to return. */\n end: number;\n /** When omitted or `'working'`, read the working-tree file. Otherwise the\n * content comes from `git show <ref>:<relPath>` — used when the diff's\n * \"new\" side is a committed snapshot (checkpoint range) rather than the\n * live tree. */\n ref?: string;\n}\n\nexport interface ContextLinesResult {\n /** The requested slice. Shorter than `end - start + 1` when the file ends\n * before `end`. */\n lines: string[];\n /** Echoed 1-based first line of `lines` (clamped to >= 1). */\n start: number;\n /** Total line count of the file at this ref. */\n totalLines: number;\n /** True when `end` reached (or passed) the last line — there is nothing\n * further below to expand. */\n eof: boolean;\n}\n\n/**\n * Read a contiguous range of lines from a file so the diff viewer can\n * reveal the unchanged context around hunks (\"expand lines\" in GitHub's\n * UI). The expandable region is, by definition, identical on both diff\n * sides, so a single read of the appropriate side is enough — the caller\n * maps the old line numbers via the constant gap offset.\n *\n * Path safety mirrors `readMarkdownContent` in diff-pipeline: the textual\n * `relPath` is rejected if it escapes `root`, and the working-tree read is\n * symlink-canonicalised so a `notes.md -> /etc/passwd` symlink can't\n * exfiltrate an out-of-tree file into the payload.\n *\n * Returns `null` when the path is rejected or the content can't be read\n * (missing file, unknown ref, binary). Callers surface that as a 404/400.\n */\nexport function readContextLines(opts: ContextLinesOptions): ContextLinesResult | null {\n const { root, relPath, ref } = opts;\n if (!relPath || !isInsideRoot(root, relPath)) return null;\n\n const start = Math.max(1, Math.floor(opts.start));\n const end = Math.max(start, Math.floor(opts.end));\n\n const content = !ref || ref === 'working' ? readWorkingTree(root, relPath) : readAtRef(root, ref, relPath);\n if (content === null) return null;\n\n // Split on either line ending; drop the trailing empty element a final\n // newline produces so `totalLines` matches the line count git/editors\n // report. Matches how `parseGitDiff` strips line endings from hunk text,\n // so revealed context lines render identically to diff context lines.\n const all = content.split(/\\r?\\n/);\n if (all.length > 0 && all[all.length - 1] === '') all.pop();\n\n const totalLines = all.length;\n // start past EOF → empty slice, eof true.\n const slice = all.slice(start - 1, end);\n return {\n lines: slice,\n start,\n totalLines,\n eof: end >= totalLines,\n };\n}\n\n/** Symlink-safe working-tree read. Returns null on any failure. */\nfunction readWorkingTree(root: string, relPath: string): string | null {\n try {\n const absPath = path.join(root, relPath);\n const realRoot = fs.realpathSync(path.resolve(root));\n const realPath = fs.realpathSync(absPath);\n const sep = path.sep;\n if (realPath !== realRoot && !realPath.startsWith(realRoot + sep)) {\n return null;\n }\n return fs.readFileSync(absPath, 'utf-8');\n } catch {\n return null;\n }\n}\n\n/**\n * A ref we may hand to `git show`: a commit id, or a plain ref name. It\n * comes from a query string, and `git show` takes options — a ref of\n * `--output=/some/file` would make it WRITE a file. So nothing that starts\n * with `-`, and only characters refs actually use.\n */\nexport function isSafeRef(ref: string): boolean {\n return /^[A-Za-z0-9_][A-Za-z0-9._/~^@{}+-]{0,199}$/.test(ref) && !ref.includes('..');\n}\n\n/** `git show <ref>:<relPath>`. Uses cross-spawn directly (not the trimming\n * `git()` helper) so trailing newlines survive. Returns null on failure\n * (including a ref that isn't safe to pass — see isSafeRef). */\nfunction readAtRef(root: string, ref: string, relPath: string): string | null {\n if (!isSafeRef(ref)) return null;\n const r = spawn.sync('git', ['show', '--end-of-options', `${ref}:${relPath}`], {\n cwd: root,\n encoding: 'utf-8',\n maxBuffer: 64 * 1024 * 1024,\n windowsHide: true,\n });\n if (r.status === 0 && typeof r.stdout === 'string') return r.stdout;\n return null;\n}\n","/**\n * Shared zod schemas for the comment HTTP surface. Kept separate from\n * `comment-types.ts` because the SPA imports `comment-types.ts` for the\n * type-only exports and pulling zod into the SPA bundle is wasteful —\n * the schemas are server-side validation only.\n */\n\nimport { z } from 'zod';\n\nexport const commentInputSchema = z.object({\n repo: z.string().optional(),\n file: z.string().optional(),\n line: z.number().int().optional(),\n side: z.enum(['left', 'right', 'general', 'file']).optional(),\n body: z.string().min(1),\n status: z.enum(['published', 'draft']).optional(),\n lineContent: z.string().optional(),\n parentId: z.string().optional(),\n author: z.enum(['user', 'claude']).optional(),\n});\n\nexport const submitReviewSchema = z.object({\n summary: z.string().optional(),\n});\n\nexport const resolveSchema = z.object({\n resolved: z.boolean(),\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ;AACf,OAAO,UAAU;AAoBjB,SAAS,SAAS,GAAmB;AACnC,SAAO,KAAK,QAAQ,CAAC,EAAE,QAAQ,OAAO,GAAG,EAAE,YAAY;AACzD;AAcA,SAAS,SAAS,GAAmB;AACnC,MAAI;AACF,WAAO,SAAS,GAAG,aAAa,OAAO,CAAC,CAAC;AAAA,EAC3C,QAAQ;AACN,WAAO,SAAS,CAAC;AAAA,EACnB;AACF;AAOO,SAAS,aAAa,KAA+B;AAC1D,QAAM,UAAU,SAAS,GAAG;AAC5B,QAAM,WAAW,YAAY;AAO7B,QAAM,MAAM,IAAI,CAAC,aAAa,iBAAiB,GAAG,GAAG;AACrD,QAAM,WAAW,IAAI,aAAa,KAAK,IAAI,SAAS,IAAI,SAAS;AACjE,QAAM,UAAU,WAAW,SAAS,QAAQ,IAAI;AAGhD,aAAW,KAAK,UAAU;AACxB,eAAW,KAAK,EAAE,OAAO;AACvB,YAAM,KAAK,SAAS,CAAC;AACrB,UAAI,YAAY,MAAM,QAAQ,WAAW,KAAK,GAAG,GAAG;AAIlD,YAAI,WAAW,SAAS,CAAC,MAAM,QAAS;AACxC,YAAI,EAAE,S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C,UAAU,EAAE,QAAQ;AACtB,CAAC;","names":["fs","path","path","fs","fs","path","Hono","fs","path","path","fs","Hono"]}
@@ -1,29 +0,0 @@
1
- #!/usr/bin/env node
2
- import {
3
- parseAzurePrUrl,
4
- parseGithubPrUrl
5
- } from "./chunk-PHGVVFTF.js";
6
-
7
- // src/core/hosts/links.ts
8
- var PARSERS = [
9
- { host: "github", parse: parseGithubPrUrl },
10
- {
11
- host: "azure",
12
- parse: (t) => {
13
- const l = parseAzurePrUrl(t);
14
- return l ? { repoId: l.repoId, number: l.number, url: l.url, label: l.label } : null;
15
- }
16
- }
17
- ];
18
- function parsePrLink(text) {
19
- for (const p of PARSERS) {
20
- const link = p.parse(text);
21
- if (link) return { ...link, host: p.host };
22
- }
23
- return null;
24
- }
25
-
26
- export {
27
- parsePrLink
28
- };
29
- //# sourceMappingURL=chunk-L22AWXWA.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/core/hosts/links.ts"],"sourcesContent":["import { GITHUB_THREAD_ID, parseGithubPrUrl } from './github/origin.js';\nimport { AZURE_THREAD_ID, parseAzurePrUrl } from './azure/origin.js';\nimport { DEFAULT_HOST } from './commands.js';\nimport type { PrLink } from './types.js';\n\n/**\n * Pull request links of the built-in hosts, read without the registry (which\n * reads git config from disk): pure, so the SPA, the demo and the pure\n * modules (`pr-ref.ts`, `blocks.ts`) share it. A host registered at run time\n * (a test's fake) is read by the registry's `hostOfPrUrl` instead.\n */\nconst PARSERS: Array<{ host: string; parse: (text: string) => PrLink | null }> = [\n { host: 'github', parse: parseGithubPrUrl },\n {\n host: 'azure',\n parse: (t) => {\n const l = parseAzurePrUrl(t);\n return l ? { repoId: l.repoId, number: l.number, url: l.url, label: l.label } : null;\n },\n },\n];\n\n/** A pull request link of a built-in host, read, with the host's id; null for anything else. */\nexport function parsePrLink(text: string): (PrLink & { host: string }) | null {\n for (const p of PARSERS) {\n const link = p.parse(text);\n if (link) return { ...link, host: p.host };\n }\n return null;\n}\n\nconst THREAD_IDS: Array<{ host: string; re: RegExp }> = [\n { host: 'github', re: GITHUB_THREAD_ID },\n { host: 'azure', re: AZURE_THREAD_ID },\n];\n\n/** The built-in host a review-thread id is shaped for (the UI names it); the default host's for anything else. */\nexport function threadHostId(id: string): string {\n return THREAD_IDS.find((t) => t.re.test(id))?.host ?? DEFAULT_HOST;\n}\n"],"mappings":";;;;;;;AAWA,IAAM,UAA2E;AAAA,EAC/E,EAAE,MAAM,UAAU,OAAO,iBAAiB;AAAA,EAC1C;AAAA,IACE,MAAM;AAAA,IACN,OAAO,CAAC,MAAM;AACZ,YAAM,IAAI,gBAAgB,CAAC;AAC3B,aAAO,IAAI,EAAE,QAAQ,EAAE,QAAQ,QAAQ,EAAE,QAAQ,KAAK,EAAE,KAAK,OAAO,EAAE,MAAM,IAAI;AAAA,IAClF;AAAA,EACF;AACF;AAGO,SAAS,YAAY,MAAkD;AAC5E,aAAW,KAAK,SAAS;AACvB,UAAM,OAAO,EAAE,MAAM,IAAI;AACzB,QAAI,KAAM,QAAO,EAAE,GAAG,MAAM,MAAM,EAAE,KAAK;AAAA,EAC3C;AACA,SAAO;AACT;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/core/hosts/origin-hostname.ts","../src/core/hosts/github/adapter.ts","../src/core/hosts/github/origin.ts","../src/core/hosts/github/pr-list.ts","../src/core/hosts/github/server.ts","../src/core/hosts/github/pr-ops.ts","../src/core/hosts/submit-doubt.ts","../src/core/hosts/discussion.ts","../src/core/hosts/github/review.ts","../src/core/hosts/github/threads.ts","../src/core/hosts/azure/adapter.ts","../src/core/hosts/azure/origin.ts","../src/core/hosts/azure/map.ts","../src/core/hosts/index.ts"],"sourcesContent":["/**\n * An origin URL's hostname, lower case (https, ssh://, and scp-like `git@host:path`); null when it has none.\n * Pure and import-free: the registry reads `gitHosts` by it, and a host's adapter which server to ask\n * (GitHub's: a GitHub Enterprise origin's `gh api --hostname`).\n */\nexport function originHostname(origin: string): string | null {\n const s = origin.trim();\n const url = /^[a-z][a-z0-9+.-]*:\\/\\/(?:[^@/]*@)?([^/:]+)/i.exec(s);\n if (url) return url[1].toLowerCase();\n const scp = /^(?:[^@/]+@)?([^/:]+):(?!\\/\\/)/.exec(s);\n return scp ? scp[1].toLowerCase() : null;\n}\n","import os from 'node:os';\nimport type { GitHost } from '../types.js';\nimport { githubCommands } from './commands.js';\nimport { githubRepoId, onGithub, parseGithubPrUrl } from './origin.js';\nimport { defaultPrListDeps, githubPrList } from './pr-list.js';\nimport {\n githubCreatePr,\n githubMergedPr,\n githubMergePr,\n githubOpenPrs,\n githubPrByNumber,\n githubPrForBranch,\n githubPrState,\n githubSubmitReview,\n} from './pr-ops.js';\nimport { githubDiscussion, githubReviewFeedback, githubViewer } from './review.js';\nimport { GITHUB_THREAD_ID } from './origin.js';\nimport { githubThreadLive, githubThreadNow, githubThreadReply, githubThreadResolve, githubThreadResolved } from './threads.js';\n\n/**\n * GitHub, through the `gh` CLI and the user's own `gh auth login`. The only\n * place outside core/hosts/github/ that knows `gh` is nowhere: everything\n * reaches it through this adapter (tests/architecture/hosts.test.ts).\n */\nexport const github: GitHost = {\n id: 'github',\n name: 'GitHub',\n cli: {\n cmd: 'gh',\n label: 'GitHub CLI',\n checkArgs: ['auth', 'status'],\n missing: 'Optional: install gh to see your pull requests, CI and review comments.',\n failing: 'Optional: run `gh auth login` so work can see your pull requests.',\n },\n matches: onGithub,\n repoId: githubRepoId,\n parsePrUrl: parseGithubPrUrl,\n prRef: (n) => `refs/pull/${n}/head`,\n\n // One search for every repo, then gh pr list per repo elsewhere; the real runner is its own execFile with timeouts.\n list: async (repos, run) => githubPrList(Object.fromEntries(repos.map((r) => [r.alias, r.path])), defaultPrListDeps(run)),\n viewer: githubViewer,\n prForBranch: githubPrForBranch,\n prByNumber: githubPrByNumber,\n prState: (run, url) => githubPrState(run, url, os.tmpdir()),\n createPr: githubCreatePr,\n mergePr: githubMergePr,\n mergedPr: githubMergedPr,\n openPrs: githubOpenPrs,\n submitReview: githubSubmitReview,\n reviewFeedback: (run, cwd, n) => githubReviewFeedback(run, cwd, n),\n discussion: (run, cwd, n) => githubDiscussion(run, cwd, n),\n\n threads: {\n isId: (id) => GITHUB_THREAD_ID.test(id),\n now: githubThreadNow,\n live: githubThreadLive,\n isResolved: githubThreadResolved,\n reply: githubThreadReply,\n resolve: githubThreadResolve,\n },\n\n // gh's words when GitHub's API limit is spent (\"API rate limit already exceeded\", \"secondary rate limit\").\n rateLimited: (text) => /rate limit/i.test(text),\n // A squash or merge commit GitHub wrote itself, not your work of that day.\n hostCommit: (email) => email.toLowerCase() === 'noreply@github.com',\n commands: githubCommands,\n};\n","import type { PrLink } from '../types.js';\n\n/**\n * GitHub origins and pull request links. Pure and import-free (types only):\n * the SPA reads PR links with it too (`core/hosts/links.ts`).\n */\n\n/** GitHub review-thread node ids. Checked before a thread id reaches gh or the database. */\nexport const GITHUB_THREAD_ID = /^PRRT_[A-Za-z0-9_-]{4,120}$/;\n\n/** An origin on github.com (https, ssh or git@ form). */\nexport function onGithub(origin: string): boolean {\n return /(^|[@/.])github\\.com[:/]/i.test(origin);\n}\n\n/** `owner/name` (lower case) of an origin on github.com; null for another host. */\nexport function githubRepoId(origin: string): string | null {\n if (!onGithub(origin)) return null;\n const m = /[:/]([^/:]+)\\/([^/]+?)(?:\\.git)?\\/?$/.exec(origin.trim());\n return m ? `${m[1]}/${m[2]}`.toLowerCase() : null;\n}\n\n/** A GitHub pull request link (`https://github.com/owner/repo/pull/123`, any tail, scheme optional); null for anything else. */\nexport function parseGithubPrUrl(text: string): PrLink | null {\n const m = /^(?:https?:\\/\\/)?(?:www\\.)?github\\.com\\/([\\w.-]+)\\/([\\w.-]+)\\/pull\\/(\\d+)(?:[/?#].*)?$/i.exec(text.trim());\n if (!m) return null;\n const number = Number(m[3]);\n return {\n repoId: `${m[1]}/${m[2]}`.toLowerCase(),\n number,\n url: `https://github.com/${m[1]}/${m[2]}/pull/${number}`,\n label: `${m[2]}#${number}`,\n };\n}\n","import { execFile } from 'node:child_process';\nimport { explainNotOnPath, programPath } from '../../platform/program-path.js';\nimport { originUrl, ownerRepo, readGitConfig } from '../../worktree/repo-scan.js';\nimport type { PullRequestInfo } from '../../pr/pr-types.js';\nimport { defaultRunner, type CommandRunner } from '../../platform/command-runner.js';\nimport { githubServerArgs } from './server.js';\n\n/**\n * GitHub's PR list: one GraphQL search for every repo on github.com (your\n * open PRs, and those asking your review by name), and `gh pr list` per repo\n * for the rest (GitHub Enterprise, or every repo when the search fails).\n * Reached only through the adapter (`github.list`); core/pr/pr.ts asks each repo's host.\n */\n\n/** Runs a command and gives its stdout; rejects when it fails. */\nexport type ListExec = (cmd: string, args: string[], cwd: string, timeout: number) => Promise<string>;\n\nfunction execAsync(cmd: string, args: string[], cwd: string, timeout: number): Promise<string> {\n return new Promise((resolve, reject) => {\n // `windowsHide: true` prevents a console window from flashing on\n // Windows whenever the PRs pane refreshes. Without it, opening\n // the PRs pane in `work web` triggers a visible terminal popup\n // for every configured repo's `gh pr list` invocation.\n execFile(programPath(cmd), args, { cwd, encoding: 'utf-8', timeout, windowsHide: true }, (err, stdout) => {\n if (err) reject(explainNotOnPath(err));\n else resolve(stdout ?? '');\n });\n });\n}\n\n/** The fields of `gh pr list --json …` this reads; all optional — it is someone else's output. */\ninterface GhPr {\n number?: number;\n title?: string;\n headRefName?: string;\n url?: string;\n isDraft?: boolean;\n mergeable?: string;\n reviewDecision?: string;\n author?: { login?: string } | null;\n isCrossRepository?: boolean;\n statusCheckRollup?: Array<{ conclusion?: string | null; status?: string | null }> | null;\n reviews?: Array<{ author?: { login?: string } | null; state?: string }> | null;\n reviewRequests?: Array<{ login?: string } | null> | null;\n}\n\n/** `gh pr list --json …` output as work's PR rows: checks, review, yours or not, conflicts, review asked of you. Pure. */\nexport function parsePrJson(stdout: string, repoAlias: string, currentUser: string): PullRequestInfo[] {\n const parsed = JSON.parse(stdout) as unknown;\n const prs: GhPr[] = Array.isArray(parsed) ? (parsed as GhPr[]) : [];\n return prs.map((pr) => toPrInfo(pr, repoAlias, currentUser));\n}\n\n/** One PR as work's row. */\nfunction toPrInfo(pr: GhPr, repoAlias: string, currentUser: string): PullRequestInfo {\n {\n let checksStatus: PullRequestInfo['checksStatus'] = 'NONE';\n const checks = pr.statusCheckRollup ?? [];\n if (checks.length > 0) {\n const hasFailure = checks.some((c) => c.conclusion === 'FAILURE' || c.conclusion === 'TIMED_OUT' || c.conclusion === 'CANCELLED');\n const hasPending = checks.some((c) => c.status === 'IN_PROGRESS' || c.status === 'QUEUED' || c.status === 'PENDING');\n if (hasFailure) checksStatus = 'FAILURE';\n else if (hasPending) checksStatus = 'PENDING';\n else checksStatus = 'SUCCESS';\n }\n\n let reviewDecision: PullRequestInfo['reviewDecision'] = 'NONE';\n if (pr.reviewDecision === 'APPROVED') reviewDecision = 'APPROVED';\n else if (pr.reviewDecision === 'CHANGES_REQUESTED') reviewDecision = 'CHANGES_REQUESTED';\n else if (pr.reviewDecision === 'REVIEW_REQUIRED') reviewDecision = 'REVIEW_REQUIRED';\n\n // Check current user's latest review state\n let myReview: PullRequestInfo['myReview'] = 'NONE';\n if (currentUser) {\n const reviews = pr.reviews ?? [];\n for (let i = reviews.length - 1; i >= 0; i--) {\n if (reviews[i].author?.login?.toLowerCase() === currentUser.toLowerCase()) {\n const state = reviews[i].state;\n if (state === 'APPROVED') myReview = 'APPROVED';\n else if (state === 'CHANGES_REQUESTED') myReview = 'CHANGES_REQUESTED';\n else if (state === 'COMMENTED') myReview = 'COMMENTED';\n break;\n }\n }\n }\n\n return {\n number: pr.number ?? 0,\n title: pr.title ?? '',\n branch: pr.headRefName ?? '',\n url: pr.url ?? '',\n isDraft: pr.isDraft ?? false,\n checksStatus,\n reviewDecision,\n myReview,\n isMine: currentUser ? pr.author?.login?.toLowerCase() === currentUser.toLowerCase() : false,\n conflicting: pr.mergeable === 'CONFLICTING',\n reviewRequested: !!currentUser && (pr.reviewRequests ?? []).some((r) => r?.login?.toLowerCase() === currentUser.toLowerCase()),\n repoAlias,\n // Only when who you are is known: isMine is false for all of them otherwise, and your own would read \"by @you\".\n ...(currentUser && pr.author?.login ? { author: pr.author.login } : {}),\n fork: pr.isCrossRepository === true,\n };\n }\n}\n\n/**\n * Your open PRs and the ones asking for your review, across every GitHub\n * repo, in ONE GraphQL call (about one API point). The list used to be a\n * `gh pr list` per enrolled repo every two minutes: 27 calls for 27 repos.\n * Start shows only these two kinds anyway.\n */\nexport const PR_SEARCH_QUERY = `query($mine: String!, $asked: String!) {\n viewer { login }\n mine: search(query: $mine, type: ISSUE, first: 100) { issueCount nodes { ...pr } }\n asked: search(query: $asked, type: ISSUE, first: 100) { issueCount nodes { ...pr } }\n}\nfragment pr on PullRequest {\n number title url isDraft headRefName mergeable reviewDecision isCrossRepository\n author { login }\n repository { nameWithOwner }\n commits(last: 1) { nodes { commit { statusCheckRollup { state } } } }\n reviewRequests(first: 20) { nodes { requestedReviewer { ... on User { login } } } }\n latestReviews(first: 20) { nodes { author { login } state } }\n}`;\n\n/** The search's two queries: open PRs by you, and open PRs asking you by name. */\nexport const PR_SEARCH_VARS = {\n mine: 'is:pr is:open archived:false author:@me',\n asked: 'is:pr is:open archived:false review-requested:@me',\n};\n\ninterface SearchNode extends Omit<GhPr, 'statusCheckRollup' | 'reviews' | 'reviewRequests'> {\n repository?: { nameWithOwner?: string } | null;\n commits?: { nodes?: Array<{ commit?: { statusCheckRollup?: { state?: string } | null } | null } | null> | null } | null;\n reviewRequests?: { nodes?: Array<{ requestedReviewer?: { login?: string } | null } | null> | null } | null;\n latestReviews?: { nodes?: Array<{ author?: { login?: string } | null; state?: string } | null> | null } | null;\n}\n\n/** A check rollup's one word, in the shape `gh pr list` gives (so one conversion reads both). */\nfunction rollupAsChecks(state: string | undefined): GhPr['statusCheckRollup'] {\n if (state === 'FAILURE' || state === 'ERROR') return [{ conclusion: 'FAILURE', status: 'COMPLETED' }];\n if (state === 'PENDING' || state === 'EXPECTED') return [{ conclusion: null, status: 'PENDING' }];\n if (state === 'SUCCESS') return [{ conclusion: 'SUCCESS', status: 'COMPLETED' }];\n return [];\n}\n\n/**\n * The search's answer as work's PR rows, each under the alias (or aliases)\n * enrolled for its repository; PRs of repos you haven't enrolled are left\n * out, as before. `incomplete` when a search found more than it returned. Pure.\n */\nexport function parsePrSearch(\n stdout: string,\n aliasesOf: (nameWithOwner: string) => string[],\n): { prs: PullRequestInfo[]; incomplete: boolean } {\n const data = (JSON.parse(stdout) as { data?: Record<string, unknown> } | null)?.data ?? {};\n const user = ((data.viewer as { login?: string } | undefined)?.login ?? '').trim();\n const seen = new Set<string>();\n const prs: PullRequestInfo[] = [];\n let incomplete = false;\n for (const key of ['mine', 'asked']) {\n const result = data[key] as { issueCount?: number; nodes?: Array<SearchNode | null> } | undefined;\n const nodes = (result?.nodes ?? []).filter((n): n is SearchNode => !!n && typeof n.number === 'number');\n if ((result?.issueCount ?? 0) > nodes.length) incomplete = true;\n for (const n of nodes) {\n const pr: GhPr = {\n ...n,\n statusCheckRollup: rollupAsChecks(n.commits?.nodes?.[0]?.commit?.statusCheckRollup?.state),\n reviews: (n.latestReviews?.nodes ?? []).filter((r) => !!r),\n reviewRequests: (n.reviewRequests?.nodes ?? []).map((r) => r?.requestedReviewer ?? null),\n };\n for (const alias of aliasesOf(n.repository?.nameWithOwner ?? '')) {\n const id = `${alias}#${n.number}`;\n if (seen.has(id)) continue;\n seen.add(id);\n prs.push(toPrInfo(pr, alias, user));\n }\n }\n }\n return { prs, incomplete };\n}\n\n/** parsePrSearch, or null for an answer that isn't JSON. */\nfunction readSearch(stdout: string, aliasesOf: (nameWithOwner: string) => string[]): ReturnType<typeof parsePrSearch> | null {\n try {\n return parsePrSearch(stdout, aliasesOf);\n } catch {\n return null;\n }\n}\n\n/** `owner/name` (lowercase) of a repo's origin on github.com, from its `.git/config` text; null for another host or no origin. Pure. */\nexport function githubRepoOf(configText: string): string | null {\n const url = originUrl(configText);\n if (!url || !/(^|[@/.])github\\.com[:/]/i.test(url)) return null;\n return ownerRepo(url)?.toLowerCase() ?? null;\n}\n\n/**\n * Fetch open PRs for a repo using `gh` CLI (async, non-blocking).\n */\nconst PR_LIST_LIMIT = 100;\n\n/** Open PRs for a repo; null when gh couldn't say (missing, offline, not a GitHub repo). */\nasync function fetchPullRequests(\n exec: ListExec,\n repoPath: string,\n repoAlias: string,\n currentUser: string,\n): Promise<PullRequestInfo[] | null> {\n try {\n const stdout = await exec(\n 'gh',\n [\n 'pr',\n 'list',\n '--state',\n 'open',\n '--json',\n 'number,title,headRefName,url,isDraft,statusCheckRollup,reviewDecision,reviews,reviewRequests,mergeable,author,isCrossRepository',\n '--limit',\n String(PR_LIST_LIMIT),\n ],\n repoPath,\n 15000,\n );\n if (!stdout) return [];\n return parsePrJson(stdout, repoAlias, currentUser);\n } catch {\n return null;\n }\n}\n\n/**\n * Fetch PRs for all configured repos (async, non-blocking).\n * Runs all repo fetches in parallel.\n * Returns a map from branch name → array of PRs across repos.\n */\nasync function getCurrentUser(exec: ListExec, cwd: string, server: string[]): Promise<string> {\n try {\n const stdout = await exec('gh', ['api', 'user', '--jq', '.login', ...server], cwd, 5000);\n return stdout.trim();\n } catch {\n return '';\n }\n}\n\n/** What fetchAllPullRequests reaches outside (tests pass fakes). */\nexport interface PrListDeps {\n /** `gh api graphql` with the search: its stdout, or null when gh couldn't. */\n search: () => Promise<string | null>;\n /** One repo the old way (`gh pr list` there): not on github.com, or the search failed. */\n listRepo: (repoPath: string, alias: string) => Promise<PullRequestInfo[] | null>;\n /** A repo's `.git/config` text, or null. */\n gitConfig: (repoPath: string) => string | null;\n}\n\n/**\n * The list's real stand-ins. `run`: the real runner (GitHub's own execFile, with tighter timeouts than\n * the runner's minute), or any other — a test's — used as given (a failed run rejects, as execFile does).\n */\nexport function defaultPrListDeps(run: CommandRunner = defaultRunner): PrListDeps {\n const exec: ListExec =\n run === defaultRunner\n ? execAsync\n : async (cmd, args, cwd) => {\n const r = await run(cmd, args, cwd);\n if (r.code !== 0) throw new Error(r.stderr || `${cmd} failed`);\n return r.stdout;\n };\n // Who you are on each server (`gh api` asks github.com unless told): a GitHub Enterprise repo's list is matched\n // against your login there. A repo whose server isn't known has no \"mine\".\n const users = new Map<string, Promise<string>>();\n const userFor = async (repoPath: string): Promise<string> => {\n const server = await githubServerArgs(run, repoPath);\n if (!server.ok) return '';\n const key = server.args.join(' ');\n let p = users.get(key);\n if (!p) users.set(key, (p = getCurrentUser(exec, repoPath, server.args)));\n return p;\n };\n return {\n search: async () => {\n try {\n return await exec(\n 'gh',\n ['api', 'graphql', '-f', `query=${PR_SEARCH_QUERY}`, '-f', `mine=${PR_SEARCH_VARS.mine}`, '-f', `asked=${PR_SEARCH_VARS.asked}`],\n process.cwd(),\n 20000,\n );\n } catch {\n return null;\n }\n },\n listRepo: async (repoPath, alias) => fetchPullRequests(exec, repoPath, alias, await userFor(repoPath)),\n gitConfig: readGitConfig,\n };\n}\n\n/**\n * The PRs of these repos as GitHub has them (yours, and those asking your\n * review): the search for the ones on github.com, the per-repo list for the\n * rest, or for all of them when the search fails. `incomplete`: repos whose\n * list may be missing PRs (gh failed, or a list hit its limit).\n */\nexport async function githubPrList(\n repos: Record<string, string>,\n deps: PrListDeps = defaultPrListDeps(),\n): Promise<{ prs: PullRequestInfo[]; incomplete: string[] }> {\n const entries = Object.entries(repos);\n const onGithub = new Map<string, string[]>(); // owner/name → its aliases\n const elsewhere: Array<[string, string]> = [];\n for (const [alias, repoPath] of entries) {\n const text = deps.gitConfig(repoPath);\n const gh = text ? githubRepoOf(text) : null;\n if (gh) onGithub.set(gh, [...(onGithub.get(gh) ?? []), alias]);\n else elsewhere.push([alias, repoPath]);\n }\n\n const results: Array<PullRequestInfo[] | null> = [];\n const incomplete: string[] = [];\n if (onGithub.size) {\n const out = await deps.search();\n const parsed = out ? readSearch(out, (repo) => onGithub.get(repo.toLowerCase()) ?? []) : null;\n if (parsed) {\n results.push(parsed.prs);\n if (parsed.incomplete) incomplete.push(...[...onGithub.values()].flat());\n } else {\n // gh can't search (an old gh, no network): the old way, repo by repo.\n const asked = new Set(elsewhere.map(([a]) => a));\n for (const [alias, repoPath] of entries) if (!asked.has(alias)) elsewhere.push([alias, repoPath]);\n }\n }\n const listed = await Promise.all(elsewhere.map(([alias, repoPath]) => deps.listRepo(repoPath, alias)));\n results.push(...listed);\n // Repos whose list may be missing PRs: gh failed, or it hit the limit.\n incomplete.push(...elsewhere.filter((_, i) => listed[i] === null || listed[i]!.length >= PR_LIST_LIMIT).map(([alias]) => alias));\n\n return { prs: results.flatMap((r) => r ?? []), incomplete };\n}\n","import type { CommandRunner } from '../../platform/command-runner.js';\nimport { originUrl, readGitConfig } from '../../worktree/repo-scan.js';\nimport { originHostname } from '../origin-hostname.js';\nimport { onGithub } from './origin.js';\n\n/**\n * Which GitHub server a repo is on, for every `gh api` call made in it. `gh pr …` and `gh repo …` follow the\n * repo (gh reads its remotes, SSH aliases through `~/.ssh/config`), but `gh api` asks github.com unless told\n * `--hostname`, whatever repo it runs in: a GitHub Enterprise repo's review read, thread replies and review\n * would go to github.com (or fail there), and who you are would be github.com's login.\n *\n * The server is asked of gh, never guessed from the name's shape (a dotted SSH alias of github.com,\n * `git@github.com-work:`, is no server; a dotless GitHub Enterprise host, `ghe`, is one):\n * `gh repo view --json url` in the repo — gh resolves the remote only to a host it's signed in to, so an\n * answer names a server gh can ask. An origin that names github.com isn't asked. Cached per repo folder and\n * origin; a failed lookup for `FAILED_LOOKUP_MS`, so a sweep doesn't ask again each time.\n */\n\n/** `[]` on github.com, `['--hostname', <server>]` elsewhere; or why the server isn't known (nothing is asked then). */\nexport type ServerArgs = { ok: true; args: string[] } | { ok: false; error: string };\n\n/** How long a lookup that failed stands before gh is asked again. */\nexport const FAILED_LOOKUP_MS = 5 * 60_000;\n\nconst HOSTNAME = /^[a-z0-9][a-z0-9.-]*$/;\n\ninterface Known {\n value: ServerArgs;\n /** Asked again after this (ms); Infinity for an answer. */\n until: number;\n}\nconst known = new Map<string, Known>();\nconst asking = new Map<string, Promise<ServerArgs>>();\n\n/** Forget every lookup (tests). */\nexport function clearGithubServers(): void {\n known.clear();\n asking.clear();\n}\n\nexport interface ServerDeps {\n readConfig?: (repoPath: string) => string | null;\n now?: () => number;\n}\n\n/** The server gh resolves for the repo at `cwd`: what every `gh api` there is given. */\nexport async function githubServerArgs(run: CommandRunner, cwd: string, deps: ServerDeps = {}): Promise<ServerArgs> {\n const text = (deps.readConfig ?? readGitConfig)(cwd);\n const origin = text ? originUrl(text) : null;\n // No repo or no origin (a temp folder, a group's root): gh api's own default, as gh pr would have none either.\n if (!origin || onGithub(origin)) return { ok: true, args: [] };\n const now = deps.now ?? Date.now;\n const key = `${cwd}\\n${origin}`;\n const was = known.get(key);\n if (was && now() < was.until) return was.value;\n const inflight = asking.get(key);\n if (inflight) return inflight;\n const p = lookUp(run, cwd, origin)\n .then((value) => {\n known.set(key, { value, until: value.ok ? Infinity : now() + FAILED_LOOKUP_MS });\n return value;\n })\n .finally(() => asking.delete(key));\n asking.set(key, p);\n return p;\n}\n\nasync function lookUp(run: CommandRunner, cwd: string, origin: string): Promise<ServerArgs> {\n const r = await run('gh', ['repo', 'view', '--json', 'url', '--jq', '.url'], cwd).catch(() => null);\n const url = r?.code === 0 ? r.stdout.trim() : '';\n const server = url ? originHostname(url) : null;\n if (!server || !HOSTNAME.test(server)) {\n const why = r?.stderr.trim().split('\\n')[0] || 'gh gave no answer';\n return { ok: false, error: `couldn't tell which GitHub server ${originHostname(origin) ?? origin} is (${why})` };\n }\n return { ok: true, args: server === 'github.com' ? [] : ['--hostname', server] };\n}\n\n/** `gh api <args>` on the repo's own server; a failed run (code 1, the reason in stderr) when it isn't known. */\nexport async function ghApi(run: CommandRunner, cwd: string, args: string[], deps?: ServerDeps) {\n const server = await githubServerArgs(run, cwd, deps);\n if (!server.ok) return { code: 1, stdout: '', stderr: server.error, serverUnknown: true as const };\n return run('gh', ['api', ...args, ...server.args], cwd);\n}\n","import fs from 'node:fs';\nimport os from 'node:os';\nimport path from 'node:path';\nimport type { ChecksState, FailingCheck, MergeMethod, ShipPr } from '../../api-types.js';\nimport { RUN_TIMED_OUT, type CommandRunner } from '../../platform/command-runner.js';\nimport type { HostResult, OpenPr, PrForStart, PrLookup, SubmitReviewResult } from '../types.js';\nimport { refusedClearly } from '../submit-doubt.js';\nimport { ghApi } from './server.js';\n\n/**\n * GitHub's PR operations through `gh` (argv only): a branch's PR (Ship and\n * the PR watch), a PR by number (Start from a PR), its state (Blocked by),\n * open, merge with the head guard, and the merged PR of a gone branch\n * (branch tidy). Moved from ship.ts, pr-start.ts, branch-tidy.ts and\n * web-server.ts; the parsing is unchanged.\n */\n\nexport interface CheckRollupItem {\n status?: string | null;\n conclusion?: string | null;\n state?: string | null;\n /** Check runs carry name + detailsUrl; commit statuses context + targetUrl. */\n name?: string | null;\n context?: string | null;\n detailsUrl?: string | null;\n targetUrl?: string | null;\n}\n\nconst FAILED = ['FAILURE', 'ERROR', 'CANCELLED', 'TIMED_OUT', 'ACTION_REQUIRED', 'STARTUP_FAILURE'];\n\n/** The failed checks in a rollup, named, with their links. */\nexport function failingFromRollup(rollup: CheckRollupItem[] | null | undefined): FailingCheck[] {\n return (rollup ?? [])\n .filter((c) => FAILED.includes((c.conclusion ?? c.state ?? '').toUpperCase()))\n .map((c) => {\n const url = c.detailsUrl ?? c.targetUrl ?? undefined;\n return { name: c.name ?? c.context ?? 'check', ...(url ? { url } : {}) };\n });\n}\n\n/** Collapse gh's statusCheckRollup (check runs + commit statuses). */\nexport function checksFromRollup(rollup: CheckRollupItem[] | null | undefined): ChecksState {\n if (!rollup || rollup.length === 0) return 'none';\n let pending = false;\n for (const c of rollup) {\n const v = (c.conclusion ?? c.state ?? '').toUpperCase();\n if (FAILED.includes(v)) {\n return 'fail';\n }\n const status = (c.status ?? '').toUpperCase();\n if (!v || v === 'PENDING' || v === 'EXPECTED' || (status && status !== 'COMPLETED')) pending = true;\n }\n return pending ? 'pending' : 'pass';\n}\n\n/** First line of a CLI's error output. */\nexport const oneLineErr = (s: string) => s.trim().split('\\n')[0] ?? '';\n\n/**\n * The line of gh's error output that says why: the one about GitHub's API limit wherever it is (gh may warn\n * first, and the limit is what the watch and the blockers' sweep rest on), else the first.\n */\nexport const reasonLine = (s: string) =>\n s\n .split('\\n')\n .map((l) => l.trim())\n .find((l) => /rate limit/i.test(l)) ?? oneLineErr(s);\n\n/** `gh pr view <branch>`: the branch's PR as work's ShipPr, none, or why gh couldn't say. */\nexport async function githubPrForBranch(run: CommandRunner, cwd: string, branch: string): Promise<PrLookup> {\n const view = await run(\n 'gh',\n [\n 'pr',\n 'view',\n branch,\n '--json',\n 'number,url,state,isDraft,mergeStateStatus,headRefOid,mergedAt,updatedAt,statusCheckRollup,reviewDecision,author,baseRefName',\n ],\n cwd,\n );\n if (view.code === 0) {\n try {\n const j = JSON.parse(view.stdout) as {\n number: number;\n url: string;\n state: ShipPr['state'];\n isDraft: boolean;\n mergeStateStatus?: string;\n headRefOid: string;\n mergedAt?: string | null;\n updatedAt?: string;\n statusCheckRollup?: CheckRollupItem[];\n reviewDecision?: string | null;\n author?: { login?: string } | null;\n baseRefName?: string;\n };\n const pr: ShipPr = {\n number: j.number,\n url: j.url,\n state: j.state,\n isDraft: j.isDraft,\n mergeStateStatus: j.mergeStateStatus ?? 'UNKNOWN',\n checks: checksFromRollup(j.statusCheckRollup),\n headSha: j.headRefOid,\n ...(j.mergedAt ? { mergedAt: j.mergedAt } : {}),\n ...(j.updatedAt ? { updatedAt: j.updatedAt } : {}),\n ...(typeof j.reviewDecision === 'string' ? { reviewDecision: j.reviewDecision } : {}),\n // gh pr view names an app `app/dependabot`; the search API, `dependabot`.\n ...(j.author?.login ? { author: j.author.login.replace(/^app\\//, '') } : {}),\n ...(j.baseRefName ? { baseBranch: j.baseRefName } : {}),\n ...(checksFromRollup(j.statusCheckRollup) === 'fail' ? { failing: failingFromRollup(j.statusCheckRollup) } : {}),\n };\n return { kind: 'pr', pr };\n } catch {\n return { kind: 'error', error: 'could not read `gh pr view` output' };\n }\n }\n if (view.code === 127) return { kind: 'error', error: 'GitHub CLI (gh) not found — install it to open and merge PRs' };\n if (/no pull requests found/i.test(view.stderr)) return { kind: 'none' };\n return { kind: 'error', error: reasonLine(view.stderr) || 'gh pr view failed' };\n}\n\n/** `gh pr create --fill`: the new PR's link when gh printed one. */\nexport async function githubCreatePr(\n run: CommandRunner,\n cwd: string,\n branch: string,\n opts: { draft: boolean },\n): Promise<HostResult<{ url?: string }>> {\n const args = ['pr', 'create', '--fill', '--head', branch];\n if (opts.draft) args.push('--draft');\n const res = await run('gh', args, cwd);\n if (res.code !== 0) return { ok: false, error: oneLineErr(res.stderr) || 'gh pr create failed' };\n const url = res.stdout\n .trim()\n .split(/\\s+/)\n .find((t) => t.startsWith('http'));\n return { ok: true, ...(url ? { url } : {}) };\n}\n\n/** `gh pr merge --match-head-commit`: GitHub refuses when the PR moved past the commit you were shown. */\nexport async function githubMergePr(\n run: CommandRunner,\n cwd: string,\n number: number,\n method: MergeMethod,\n headSha: string,\n): Promise<HostResult> {\n const res = await run('gh', ['pr', 'merge', String(number), `--${method}`, '--match-head-commit', headSha], cwd);\n return res.code === 0 ? { ok: true } : { ok: false, error: oneLineErr(res.stderr) || 'gh pr merge failed' };\n}\n\n/** The fields of `gh pr view --json …` this reads; all optional — it is someone else's output. */\ninterface GhPrView {\n number?: number;\n title?: string;\n url?: string;\n headRefName?: string;\n headRefOid?: string;\n baseRefName?: string;\n state?: string;\n isCrossRepository?: boolean;\n author?: { login?: string } | null;\n headRepositoryOwner?: { login?: string } | null;\n}\n\n/** `gh pr view <n> --repo owner/name`: a PR to start a session on. */\nexport async function githubPrByNumber(\n run: CommandRunner,\n cwd: string,\n repoId: string,\n number: number,\n): Promise<HostResult<{ pr: PrForStart }>> {\n const view = await run(\n 'gh',\n [\n 'pr',\n 'view',\n String(number),\n '--repo',\n repoId,\n '--json',\n 'number,title,url,headRefName,headRefOid,baseRefName,state,isCrossRepository,author,headRepositoryOwner',\n ],\n cwd,\n );\n if (view.code === 127) return { ok: false, error: 'GitHub CLI (gh) not found: install it to start from a PR.' };\n if (view.code !== 0) return { ok: false, error: `PR #${number} in ${repoId}: ${oneLineErr(view.stderr) || 'gh pr view failed'}` };\n let pr: GhPrView;\n try {\n pr = JSON.parse(view.stdout) as GhPrView;\n } catch {\n return { ok: false, error: \"Couldn't read what gh said about the PR.\" };\n }\n return {\n ok: true,\n pr: {\n number: pr.number ?? number,\n title: pr.title ?? '',\n url: pr.url ?? '',\n branch: pr.headRefName ?? '',\n ...(pr.headRefOid ? { headSha: pr.headRefOid } : {}),\n base: pr.baseRefName ?? '',\n author: (pr.author?.login ?? '').replace(/^app\\//, ''),\n state: pr.state ?? 'OPEN',\n ...(pr.isCrossRepository ? { fork: { owner: pr.headRepositoryOwner?.login ?? 'a fork' } } : {}),\n },\n };\n}\n\n/** `gh pr view <url> --json state`: what a \"blocked by\" PR is now. */\nexport async function githubPrState(\n run: CommandRunner,\n url: string,\n cwd: string,\n): Promise<HostResult<{ state: 'OPEN' | 'MERGED' | 'CLOSED' }>> {\n const r = await run('gh', ['pr', 'view', url, '--json', 'state', '-q', '.state'], cwd);\n if (r.code !== 0) return { ok: false, error: reasonLine(r.stderr) || 'gh pr view failed' };\n const st = r.stdout.trim();\n return st === 'OPEN' || st === 'MERGED' || st === 'CLOSED' ? { ok: true, state: st } : { ok: false, error: `gh said ${st || 'nothing'}` };\n}\n\n/**\n * A gone branch's MERGED PR whose head is exactly `tip` (a squash merge git\n * can't see): its number; null when there's none; undefined when gh couldn't say.\n */\nexport async function githubMergedPr(run: CommandRunner, cwd: string, branch: string, tip: string): Promise<number | null | undefined> {\n const pr = await run('gh', ['pr', 'list', '--state', 'merged', '--head', branch, '--json', 'number,headRefOid', '--limit', '5'], cwd);\n if (pr.code !== 0) return undefined;\n try {\n const list = JSON.parse(pr.stdout) as Array<{ number: number; headRefOid: string }>;\n return list.find((p) => p.headRefOid === tip)?.number ?? null;\n } catch {\n return undefined; // not JSON: not certain, not offered\n }\n}\n\n/** How many open PRs one listing asks for; a list that long may have stopped short (`more`). */\nexport const OPEN_PR_LIMIT = 100;\n\n/** `gh pr list --state open`: every open PR of the repo, for the review queue. */\nexport async function githubOpenPrs(run: CommandRunner, cwd: string): Promise<HostResult<{ prs: OpenPr[]; more?: boolean }>> {\n const r = await run(\n 'gh',\n [\n 'pr',\n 'list',\n '--state',\n 'open',\n '--limit',\n String(OPEN_PR_LIMIT),\n '--json',\n 'number,title,url,headRefName,headRefOid,baseRefName,author,isDraft,additions,deletions,reviewRequests,isCrossRepository,updatedAt',\n ],\n cwd,\n );\n if (r.code === 127) return { ok: false, error: 'GitHub CLI (gh) not found' };\n if (r.code !== 0) return { ok: false, error: oneLineErr(r.stderr) || 'gh pr list failed' };\n let list: unknown;\n try {\n list = JSON.parse(r.stdout);\n } catch {\n return { ok: false, error: \"couldn't read what gh said\" };\n }\n if (!Array.isArray(list)) return { ok: false, error: \"couldn't read what gh said\" };\n const prs = list.flatMap((x): OpenPr[] => {\n const o = (x ?? {}) as Record<string, unknown>;\n if (typeof o.number !== 'number' || typeof o.headRefOid !== 'string') return [];\n const login = (v: unknown) =>\n v && typeof v === 'object' && typeof (v as { login?: unknown }).login === 'string' ? (v as { login: string }).login : '';\n return [\n {\n number: o.number,\n title: typeof o.title === 'string' ? o.title : '',\n url: typeof o.url === 'string' ? o.url : '',\n branch: typeof o.headRefName === 'string' ? o.headRefName : '',\n headSha: o.headRefOid,\n base: typeof o.baseRefName === 'string' ? o.baseRefName : '',\n author: login(o.author).replace(/^app\\//, ''),\n isDraft: o.isDraft === true,\n additions: typeof o.additions === 'number' ? o.additions : 0,\n deletions: typeof o.deletions === 'number' ? o.deletions : 0,\n requested: Array.isArray(o.reviewRequests) ? o.reviewRequests.map(login).filter(Boolean) : [],\n ...(o.isCrossRepository === true ? { fork: true as const } : {}),\n ...(typeof o.updatedAt === 'string' && o.updatedAt ? { updatedAt: o.updatedAt } : {}),\n },\n ];\n });\n return { ok: true, prs, ...(list.length >= OPEN_PR_LIMIT ? { more: true } : {}) };\n}\n\nconst GITHUB_EVENT = { comment: 'COMMENT', approve: 'APPROVE', 'request-changes': 'REQUEST_CHANGES' } as const;\n\n/** One review with its line comments (`gh api …/pulls/<n>/reviews --input` on the repo's server; gh fills owner and repo from the cwd). */\nexport async function githubSubmitReview(\n run: CommandRunner,\n cwd: string,\n number: number,\n review: {\n commitId: string;\n event: keyof typeof GITHUB_EVENT;\n body: string;\n comments: Array<{ path: string; line: number; body: string }>;\n },\n): Promise<SubmitReviewResult> {\n const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'work-gh-'));\n try {\n const file = path.join(dir, 'review.json');\n fs.writeFileSync(\n file,\n JSON.stringify({\n commit_id: review.commitId,\n event: GITHUB_EVENT[review.event],\n body: review.body,\n comments: review.comments.map((c) => ({ path: c.path, line: c.line, side: 'RIGHT', body: c.body })),\n }),\n );\n const r = await ghApi(run, cwd, ['--method', 'POST', `repos/{owner}/{repo}/pulls/${number}/reviews`, '--input', file]);\n // Which server the repo is on wasn't known: nothing was asked, so nothing went out.\n if ('serverUnknown' in r) return { ok: false, error: r.stderr };\n // One call makes the whole review, or none of it — unless it failed without a clear refusal (timed out, a 5xx, a\n // dropped connection): then GitHub may have made it.\n if (r.code !== 0) {\n const error = oneLineErr(r.stderr) || (r.code === RUN_TIMED_OUT ? 'gh timed out' : 'gh could not submit the review');\n return refusedClearly(r.code, r.stderr, GH_REFUSAL)\n ? { ok: false, error }\n : { ok: false, error, inDoubt: { comments: review.comments.map((_, i) => i), summary: !!review.body.trim() } };\n }\n try {\n const url = (JSON.parse(r.stdout) as { html_url?: unknown }).html_url;\n return { ok: true, ...(typeof url === 'string' ? { url } : {}) };\n } catch {\n return { ok: true };\n }\n } finally {\n // Tidying the temp folder never turns a call that went through into a failure (a retry would post it again).\n try {\n fs.rmSync(dir, { recursive: true, force: true });\n } catch {\n /* a leftover temp file; the OS clears its temp folder */\n }\n }\n}\n\n/** gh's own words for a request it never made, or GitHub refused: signed out, no such repo. */\nconst GH_REFUSAL = /gh auth login|not logged in|authentication required|Could not resolve to a Repository/i;\n","import { RUN_TIMED_OUT } from '../platform/command-runner.js';\n\n/**\n * PURE — whether a host call that failed may still have been carried out. A review submit in your name must never go\n * out twice, so only a clear refusal counts as \"nothing went out\": the CLI isn't there, the run was refused before it\n * started, the host answered with a 4xx status (a validation error, not signed in, not allowed, not found, too many\n * requests), or the host's own words for a refusal (`refusal`, each adapter's). Anything else — a timeout, a 5xx, a\n * dropped connection, an error with no status — may have gone through: it's in doubt, for the user to look and say.\n */\n\n/** A 4xx status as gh and az print it: `(HTTP 422)`, `HTTP 404`, `status code 400`, `(400)`, or its reason phrase. */\nconst CLIENT_ERROR =\n /\\bHTTP[ /:]*4\\d\\d\\b|\\bstatus(?: code)?:? 4\\d\\d\\b|\\(4\\d\\d\\)|\\b(?:Bad Request|Unauthorized|Forbidden|Not Found|Conflict|Unprocessable Entity|Validation Failed|Too Many Requests)\\b/i;\n\n/** The run never started: work's own refusal (a batch file given special characters, a route value refused). */\nconst NOT_STARTED = /^refused: |: refused: /;\n\nexport function refusedClearly(code: number, stderr: string, refusal?: RegExp): boolean {\n if (code === 0 || code === RUN_TIMED_OUT) return false;\n if (code === 127) return true; // the CLI isn't installed: nothing was asked\n if (NOT_STARTED.test(stderr.trim())) return true;\n if (CLIENT_ERROR.test(stderr)) return true;\n return !!refusal && refusal.test(stderr);\n}\n","import type { PrDiscussionReviewWire } from '../api-types.js';\n\n/**\n * PURE — what every host's `discussion` read keeps of a PR's existing\n * discussion (#64): a comment's text cut at a length (a review can paste a\n * log; the rest is on the host), at most so many comments a thread. Each\n * adapter reads its own API into `PrDiscussion` (types.ts) with these.\n */\n\n/** The most of one comment kept. */\nexport const MAX_DISCUSSION_BODY = 4000;\n/** The most comments kept of one thread (its first ones: the point, then the answers). */\nexport const MAX_THREAD_COMMENTS = 50;\n\n/** A comment's text, cut at `MAX_DISCUSSION_BODY` with a note that the rest is on the host. */\nexport function discussionBody(body: unknown): string {\n const text = typeof body === 'string' ? body : '';\n return text.length > MAX_DISCUSSION_BODY ? `${text.slice(0, MAX_DISCUSSION_BODY)}\\n\\n… (cut: the rest is on the host)` : text;\n}\n\n/** GitHub's review states in work's words; null for one that isn't a verdict anyone sees (PENDING: a draft). */\nexport function reviewStateOf(state: unknown): PrDiscussionReviewWire['state'] | null {\n switch (typeof state === 'string' ? state.toUpperCase() : '') {\n case 'APPROVED':\n return 'approved';\n case 'CHANGES_REQUESTED':\n return 'changes-requested';\n case 'COMMENTED':\n return 'commented';\n case 'DISMISSED':\n return 'dismissed';\n default:\n return null;\n }\n}\n","import type { CommandRunner } from '../../platform/command-runner.js';\nimport { threadCode, type ReviewComment, type ReviewFeedback } from '../../pr/review-types.js';\nimport { ghApi, type ServerDeps } from './server.js';\nimport type { PrDiscussionCommentWire, PrDiscussionReviewWire, PrDiscussionThreadWire } from '../../api-types.js';\nimport type { HostResult, PrDiscussion } from '../types.js';\nimport { discussionBody, MAX_THREAD_COMMENTS, reviewStateOf } from '../discussion.js';\nimport { reasonLine } from './pr-ops.js';\n\n/**\n * GitHub's review feedback: one `gh api graphql` call per PR fetches its\n * review threads (with GitHub's resolved flag), review summaries and\n * conversation comments, plus who you are. Moved from core/pr/pr-review.ts,\n * which re-exports what tests import.\n */\n\nconst QUERY = `query($owner: String!, $name: String!, $number: Int!) {\n viewer { login }\n repository(owner: $owner, name: $name) {\n pullRequest(number: $number) {\n reviewThreads(first: 100) {\n nodes {\n id isResolved isOutdated path line originalStartLine originalLine\n head: comments(first: 1) { nodes { diffHunk } }\n comments(last: 20) { nodes { id author { login } authorAssociation body url createdAt } }\n }\n }\n reviews(last: 30) { nodes { id state author { login } authorAssociation body url submittedAt } }\n comments(last: 50) { nodes { id author { login } authorAssociation body url createdAt } }\n }\n }\n}`;\n\ntype Node = {\n id: string;\n author?: { login?: string } | null;\n authorAssociation?: string;\n body?: string;\n url?: string;\n createdAt?: string;\n submittedAt?: string;\n};\nconst comment = (n: Node): ReviewComment => ({\n id: n.id,\n author: n.author?.login ?? 'ghost',\n association: n.authorAssociation ?? 'NONE',\n body: n.body ?? '',\n url: n.url ?? '',\n createdAt: n.createdAt ?? n.submittedAt ?? '',\n});\n\n/** Parse `gh api graphql` output (exported for tests). */\nexport function parseReviewFeedback(stdout: string): ReviewFeedback | null {\n try {\n const j = JSON.parse(stdout) as {\n data?: {\n viewer?: { login?: string };\n repository?: {\n pullRequest?: {\n reviewThreads?: {\n nodes?: Array<{\n id: string;\n isResolved: boolean;\n isOutdated?: boolean;\n path?: string | null;\n line?: number | null;\n originalStartLine?: number | null;\n originalLine?: number | null;\n head?: { nodes?: Array<{ diffHunk?: string | null }> };\n comments?: { nodes?: Node[] };\n }>;\n };\n reviews?: { nodes?: Array<Node & { state?: string }> };\n comments?: { nodes?: Node[] };\n } | null;\n } | null;\n };\n };\n const pr = j.data?.repository?.pullRequest;\n // Who you are tells your words from a reviewer's: without it the lookup failed (callers\n // keep the last count), it isn't \"no threads\".\n if (!pr || !j.data?.viewer?.login) return null;\n return {\n viewer: j.data.viewer.login,\n threads: (pr.reviewThreads?.nodes ?? []).map((t) => ({\n id: t.id,\n isResolved: !!t.isResolved,\n isOutdated: !!t.isOutdated,\n path: t.path ?? null,\n line: t.line ?? null,\n code: threadCode(t.head?.nodes?.[0]?.diffHunk, t.originalStartLine, t.originalLine, !!t.isOutdated),\n comments: (t.comments?.nodes ?? []).map(comment),\n })),\n reviews: (pr.reviews?.nodes ?? []).map((r) => ({ ...comment(r), state: r.state ?? 'COMMENTED' })),\n comments: (pr.comments?.nodes ?? []).map(comment),\n };\n } catch {\n return null;\n }\n}\n\n/**\n * The login gh is signed in as on the server of the repo at `cwd` (`gh api user` on that server: on a GitHub\n * Enterprise one you are someone else); null when gh can't say, or which server it is isn't known.\n */\nexport async function githubViewer(run: CommandRunner, cwd: string, deps?: ServerDeps): Promise<string | null> {\n const r = await ghApi(run, cwd, ['user', '--jq', '.login'], deps).catch(() => null);\n const login = r?.code === 0 ? r.stdout.trim() : '';\n return login || null;\n}\n\nexport async function githubReviewFeedback(\n run: CommandRunner,\n repoPath: string,\n prNumber: number,\n deps?: ServerDeps,\n): Promise<ReviewFeedback | null> {\n // gh fills {owner}/{repo} from the repository in the cwd; the server is the repo's own (its viewer is who you are there).\n const res = await ghApi(\n run,\n repoPath,\n ['graphql', '-F', 'owner={owner}', '-F', 'name={repo}', '-F', `number=${prNumber}`, '-f', `query=${QUERY}`],\n deps,\n );\n return res.code === 0 ? parseReviewFeedback(res.stdout) : null;\n}\n\n/**\n * A PR's whole discussion, read only (the Reviews tab, #64): every review thread with its side, place, outdated and\n * resolved flags and its comments; the submitted reviews (not a pending one: your own draft); the conversation\n * comments; and the PR's `updatedAt`, which decides when it's read again.\n */\nconst DISCUSSION_QUERY = `query($owner: String!, $name: String!, $number: Int!) {\n repository(owner: $owner, name: $name) {\n pullRequest(number: $number) {\n updatedAt\n reviewThreads(first: 100) {\n pageInfo { hasNextPage }\n nodes {\n id isResolved isOutdated path line originalLine diffSide\n comments(first: ${MAX_THREAD_COMMENTS}) { totalCount nodes { author { login } authorAssociation body url createdAt } }\n }\n }\n reviews(last: 50) { pageInfo { hasPreviousPage } nodes { state author { login } authorAssociation body url submittedAt } }\n comments(last: 100) { pageInfo { hasPreviousPage } nodes { author { login } authorAssociation body url createdAt } }\n }\n }\n}`;\n\ntype DNode = {\n author?: { login?: unknown } | null;\n authorAssociation?: unknown;\n body?: unknown;\n url?: unknown;\n createdAt?: unknown;\n submittedAt?: unknown;\n state?: unknown;\n};\nconst dstr = (v: unknown) => (typeof v === 'string' ? v : '');\nconst dcomment = (n: DNode): PrDiscussionCommentWire => {\n const association = dstr(n.authorAssociation);\n const url = dstr(n.url);\n return {\n // gh names an app `app/dependabot` in some answers; a deleted account is GitHub's \"ghost\".\n author: dstr(n.author?.login).replace(/^app\\//, '') || 'ghost',\n ...(association ? { association } : {}),\n body: discussionBody(n.body),\n at: dstr(n.createdAt) || dstr(n.submittedAt),\n ...(url ? { url } : {}),\n };\n};\n\n/** Parse the discussion query's answer (exported for tests); null when it isn't one. */\nexport function parseGithubDiscussion(stdout: string): PrDiscussion | null {\n let j: unknown;\n try {\n j = JSON.parse(stdout);\n } catch {\n return null;\n }\n type Page<T> = { pageInfo?: { hasNextPage?: unknown; hasPreviousPage?: unknown }; nodes?: Array<T | null> };\n const pr = (\n j as {\n data?: {\n repository?: {\n pullRequest?: {\n updatedAt?: unknown;\n reviewThreads?: Page<{\n id?: unknown;\n isResolved?: unknown;\n isOutdated?: unknown;\n path?: unknown;\n line?: unknown;\n originalLine?: unknown;\n diffSide?: unknown;\n comments?: { totalCount?: unknown; nodes?: Array<DNode | null> };\n }>;\n reviews?: Page<DNode>;\n comments?: Page<DNode>;\n } | null;\n } | null;\n };\n } | null\n )?.data?.repository?.pullRequest;\n if (!pr || typeof pr !== 'object') return null;\n const num = (v: unknown) => (typeof v === 'number' && Number.isSafeInteger(v) ? v : null);\n const threads = (pr.reviewThreads?.nodes ?? []).flatMap((t): PrDiscussionThreadWire[] => {\n if (!t || typeof t.id !== 'string') return [];\n const comments = (t.comments?.nodes ?? []).flatMap((c) => (c ? [dcomment(c)] : []));\n if (!comments.length) return [];\n const original = num(t.originalLine);\n return [\n {\n id: t.id,\n path: dstr(t.path) || null,\n line: num(t.line),\n ...(original !== null ? { originalLine: original } : {}),\n side: t.diffSide === 'LEFT' ? 'left' : 'right',\n outdated: t.isOutdated === true,\n resolved: t.isResolved === true,\n ...(comments[0].url ? { url: comments[0].url } : {}),\n comments,\n },\n ];\n });\n const reviews = (pr.reviews?.nodes ?? []).flatMap((r): PrDiscussionReviewWire[] => {\n const state = r ? reviewStateOf(r.state) : null;\n return r && state ? [{ ...dcomment(r), state }] : [];\n });\n const comments = (pr.comments?.nodes ?? []).flatMap((c) => (c ? [dcomment(c)] : []));\n const more =\n pr.reviewThreads?.pageInfo?.hasNextPage === true ||\n pr.reviews?.pageInfo?.hasPreviousPage === true ||\n pr.comments?.pageInfo?.hasPreviousPage === true ||\n (pr.reviewThreads?.nodes ?? []).some((t) => typeof t?.comments?.totalCount === 'number' && t.comments.totalCount > MAX_THREAD_COMMENTS);\n const updatedAt = dstr(pr.updatedAt);\n return { ...(updatedAt ? { updatedAt } : {}), threads, reviews, comments, ...(more ? { more: true as const } : {}) };\n}\n\n/** `gh api graphql` on the repo's own server (`ghApi`; gh fills owner and repo from the cwd): a read, never a mutation. */\nexport async function githubDiscussion(\n run: CommandRunner,\n repoPath: string,\n prNumber: number,\n deps?: ServerDeps,\n): Promise<HostResult<{ discussion: PrDiscussion }>> {\n const res = await ghApi(\n run,\n repoPath,\n ['graphql', '-F', 'owner={owner}', '-F', 'name={repo}', '-F', `number=${prNumber}`, '-f', `query=${DISCUSSION_QUERY}`],\n deps,\n );\n if (res.code === 127) return { ok: false, error: 'GitHub CLI (gh) not found' };\n if (res.code !== 0) return { ok: false, error: reasonLine(res.stderr) || \"gh couldn't read the PR's discussion\" };\n const discussion = parseGithubDiscussion(res.stdout);\n return discussion ? { ok: true, discussion } : { ok: false, error: \"couldn't read what gh said about the PR's discussion\" };\n}\n","import { json } from '../../platform/db.js';\nimport type { CommandRunner } from '../../platform/command-runner.js';\nimport type { HostResult, LiveThread, ThreadNow } from '../types.js';\nimport { ghApi } from './server.js';\n\n/**\n * GitHub's review threads through `gh api graphql` (-f: raw strings, never\n * @file or number parsing; argv only). Thread ids are GitHub's global node\n * ids (`PRRT_…`) on the server of the repo in the cwd (`ghApi`), so any of\n * the session's repos on that server works as the cwd. Moved\n * from core/pr/pr-replies.ts; the queries and their reading are unchanged.\n */\n\nexport { GITHUB_THREAD_ID } from './origin.js';\n\nconst ADD_REPLY = `mutation($threadId: ID!, $body: String!) {\n addPullRequestReviewThreadReply(input: { pullRequestReviewThreadId: $threadId, body: $body }) { comment { url } }\n}`;\nconst RESOLVE = `mutation($threadId: ID!) { resolveReviewThread(input: { threadId: $threadId }) { thread { isResolved } } }`;\n/** The thread as it is now, and who you are: the last check before a reply goes out. */\nconst THREAD_NOW = `query($threadId: ID!) {\n viewer { login }\n node(id: $threadId) { ... on PullRequestReviewThread { isResolved comments(last: 1) { nodes { author { login } } } } }\n}`;\n/** A thread as GitHub has it now, with its pull request: what a draft can be made from when work's last check hasn't it. */\nconst THREAD_LIVE = `query($threadId: ID!) {\n viewer { login }\n node(id: $threadId) { ... on PullRequestReviewThread {\n isResolved isOutdated path line originalStartLine originalLine\n first: comments(first: 1) { nodes { author { login } body url diffHunk } }\n last: comments(last: 1) { nodes { author { login } url } }\n pullRequest { number url headRefName repository { nameWithOwner } }\n } }\n}`;\nconst THREAD_RESOLVED = `query($threadId: ID!) { node(id: $threadId) { ... on PullRequestReviewThread { isResolved } } }`;\n\n/** On the server of the repo at `cwd` (`ghApi`): a thread id is that server's, and so is who you are. */\nconst graphql = (run: CommandRunner, cwd: string, query: string, vars: Record<string, string>) =>\n ghApi(run, cwd, ['graphql', '-f', `query=${query}`, ...Object.entries(vars).flatMap(([k, v]) => ['-f', `${k}=${v}`])]);\n\nexport async function githubThreadNow(run: CommandRunner, cwd: string, id: string): Promise<HostResult<{ thread: ThreadNow }>> {\n const r = await graphql(run, cwd, THREAD_NOW, { threadId: id });\n if (r.code !== 0) return { ok: false, error: `couldn't read the thread on GitHub first: ${r.stderr.trim() || 'gh failed'}` };\n const j = json.parse(r.stdout) as {\n data?: {\n viewer?: { login?: unknown };\n node?: { isResolved?: unknown; comments?: { nodes?: Array<{ author?: { login?: unknown } | null } | null> } } | null;\n };\n } | null;\n const me = j?.data?.viewer?.login;\n const node = j?.data?.node;\n if (typeof me !== 'string' || !me || !node) return { ok: false, error: \"couldn't read the thread on GitHub first\" };\n const last = node.comments?.nodes?.at(-1)?.author?.login;\n return { ok: true, thread: { viewer: me, resolved: node.isResolved === true, lastAuthor: typeof last === 'string' ? last : null } };\n}\n\nexport async function githubThreadLive(run: CommandRunner, cwd: string, id: string): Promise<HostResult<{ thread: LiveThread }>> {\n const r = await graphql(run, cwd, THREAD_LIVE, { threadId: id });\n if (r.code !== 0) return { ok: false, error: `couldn't read the thread on GitHub: ${r.stderr.trim() || 'gh failed'}` };\n type Who = { author?: { login?: unknown } | null; body?: unknown; url?: unknown; diffHunk?: unknown } | null;\n const j = json.parse(r.stdout) as {\n data?: {\n viewer?: { login?: unknown };\n node?: {\n isResolved?: unknown;\n isOutdated?: unknown;\n path?: unknown;\n line?: unknown;\n originalStartLine?: unknown;\n originalLine?: unknown;\n first?: { nodes?: Who[] };\n last?: { nodes?: Who[] };\n pullRequest?: { number?: unknown; url?: unknown; headRefName?: unknown; repository?: { nameWithOwner?: unknown } };\n } | null;\n };\n } | null;\n const me = j?.data?.viewer?.login;\n const t = j?.data?.node;\n const pr = t?.pullRequest;\n if (typeof me !== 'string' || !me || !t || !pr || typeof pr.number !== 'number')\n return { ok: false, error: `${id} isn't a review thread GitHub knows` };\n const str = (v: unknown) => (typeof v === 'string' ? v : '');\n const num = (v: unknown) => (typeof v === 'number' ? v : null);\n const first = t.first?.nodes?.[0];\n const last = t.last?.nodes?.at(-1);\n return {\n ok: true,\n thread: {\n viewer: me,\n resolved: t.isResolved === true,\n outdated: t.isOutdated === true,\n path: str(t.path) || null,\n line: num(t.line),\n originalStartLine: num(t.originalStartLine),\n originalLine: num(t.originalLine),\n first: first\n ? { author: str(first.author?.login), body: str(first.body), url: str(first.url), diffHunk: str(first.diffHunk) || null }\n : null,\n last: last ? { author: str(last.author?.login), url: str(last.url) } : null,\n pr: {\n number: pr.number,\n url: str(pr.url),\n headBranch: str(pr.headRefName),\n repoId: str(pr.repository?.nameWithOwner).toLowerCase(),\n },\n },\n };\n}\n\nexport async function githubThreadResolved(run: CommandRunner, cwd: string, id: string): Promise<boolean | null> {\n const res = await graphql(run, cwd, THREAD_RESOLVED, { threadId: id });\n if (res.code !== 0) return null;\n const j = json.parse(res.stdout) as { data?: { node?: { isResolved?: unknown } | null } } | null;\n const v = j?.data?.node?.isResolved;\n return typeof v === 'boolean' ? v : null;\n}\n\nexport async function githubThreadReply(run: CommandRunner, cwd: string, id: string, body: string): Promise<HostResult<{ url?: string }>> {\n const add = await graphql(run, cwd, ADD_REPLY, { threadId: id, body });\n if (add.code !== 0) return { ok: false, error: add.stderr.trim() || 'gh could not post the reply' };\n const parsed = json.parse(add.stdout) as { data?: { addPullRequestReviewThreadReply?: { comment?: { url?: unknown } } } } | null;\n const got = parsed?.data?.addPullRequestReviewThreadReply?.comment?.url;\n return { ok: true, ...(typeof got === 'string' ? { url: got } : {}) };\n}\n\nexport async function githubThreadResolve(run: CommandRunner, cwd: string, id: string): Promise<boolean> {\n const r = await graphql(run, cwd, RESOLVE, { threadId: id });\n return r.code === 0;\n}\n","import fs from 'node:fs';\nimport os from 'node:os';\nimport path from 'node:path';\nimport { RUN_TIMED_OUT, type CommandRunner } from '../../platform/command-runner.js';\nimport { originUrl, readGitConfig } from '../../worktree/repo-scan.js';\nimport type { GitHost, SubmitReviewResult } from '../types.js';\nimport { refusedClearly } from '../submit-doubt.js';\nimport type { PullRequestInfo } from '../../pr/pr-types.js';\nimport { azureCommands } from './commands.js';\nimport {\n AZURE_THREAD_ID,\n azureRepoId,\n azureThreadRepoId,\n onAzure,\n parseAzureOrigin,\n parseAzurePrUrl,\n parseAzureThreadId,\n type AzureRepo,\n} from './origin.js';\nimport {\n discussionOf,\n feedbackOf,\n openPrOf,\n pickPr,\n prForStartOf,\n prInfoOf,\n prState,\n prWebUrl,\n RESOLVED_THREAD,\n shipPrOf,\n type AzPolicy,\n type AzPr,\n type AzIteration,\n type AzThread,\n} from './map.js';\n\nconst lower = (s: string | undefined | null) => (s ?? '').toLowerCase();\n\n/**\n * Azure DevOps, through the `az` CLI with the azure-devops extension and the\n * user's own `az login` (#65). Argv only, never a shell string. Nothing is\n * stored: no token in config. What `az repos` has no command for (threads,\n * their comments, a merge that checks the head) goes through\n * `az devops invoke`, Azure DevOps' REST API as the signed-in user.\n */\n\nconst API = '7.1';\n\n/** Azure DevOps' words for \"slow down\": TF400733 (\"request was blocked\"), or HTTP 429. */\nconst THROTTLED = /TF400733|\\b429\\b|Too Many Requests|rate limit/i;\n\n/**\n * The line of az's error output that says why: the throttling one wherever it is (the PR watch rests on it), else\n * the first that isn't one of az's WARNING lines (an extension or upgrade notice comes first), else the first.\n */\nexport function azReason(stderr: string): string {\n const lines = stderr\n .split(/\\r?\\n/)\n .map((l) => l.trim())\n .filter(Boolean);\n return lines.find((l) => THROTTLED.test(l)) ?? lines.find((l) => !/^WARNING:/i.test(l)) ?? lines[0] ?? '';\n}\n\n/**\n * What az said: its value, or why not. `uncertain`: no clear refusal — it timed out, a server error, a dropped\n * connection, or it exited 0 with an answer that couldn't be read — so what it was asked may have happened (a\n * write's caller holds it in doubt; a read's ignores it).\n */\ntype AzResult<T> = { ok: true; value: T } | { ok: false; error: string; uncertain?: boolean };\n\n/**\n * Azure DevOps' own words for a request it refused, beyond a 4xx status: not signed in, no permission (TF400813,\n * TF401027/8, VS403xxx), no such repository (TF401019), a PR that can't be changed (TF401181), a policy that refused it.\n */\nconst AZ_REFUSAL = /az login|az devops login|Before you can run Azure DevOps commands|TF400813|TF40102[78]|TF401019|TF401181|VS403\\d{3}/i;\n\n/** `az … --output json`, parsed; an error with its first line when az fails or says something that isn't JSON. */\nasync function az<T>(run: CommandRunner, cwd: string, args: string[]): Promise<AzResult<T>> {\n const r = await run('az', [...args, '--output', 'json'], cwd);\n if (r.code === 127) return { ok: false, error: 'Azure CLI (az) not found — install it and the azure-devops extension' };\n if (r.code === RUN_TIMED_OUT) return { ok: false, error: azReason(r.stderr) || 'az timed out', uncertain: true };\n if (r.code !== 0)\n return {\n ok: false,\n error: azReason(r.stderr) || `az ${args.slice(0, 3).join(' ')} failed`,\n ...(refusedClearly(r.code, r.stderr, AZ_REFUSAL) ? {} : { uncertain: true }),\n };\n try {\n return { ok: true, value: JSON.parse(r.stdout || 'null') as T };\n } catch {\n // It said it did it, in words that couldn't be read: a write may well have happened.\n return { ok: false, error: \"couldn't read what az said\", uncertain: true };\n }\n}\n\n/** The repo at `cwd`, from its origin; null when it isn't on Azure DevOps. */\nfunction repoAt(cwd: string): AzureRepo | null {\n const text = readGitConfig(cwd);\n const origin = text ? originUrl(text) : null;\n return origin ? parseAzureOrigin(origin) : null;\n}\n\nconst where = (r: AzureRepo) => ['--org', r.orgUrl, '--project', r.project, '--repository', r.repo];\n\n/**\n * A route parameter's value as `az devops invoke` takes it (`name=value`, put into the URL's path): only names\n * Azure DevOps allows and numbers, never `/ ? # % = &` or a control character — refused rather than relying on\n * how az encodes it.\n */\nexport const routeValueOk = (v: string | number): boolean =>\n typeof v === 'number' ? Number.isSafeInteger(v) && v >= 0 : /^[^/\\\\?#%=&\\x00-\\x1f\\x7f]{1,128}$/.test(v) && v.trim() === v;\n\n/** A REST call through `az devops invoke` (a body goes through a temp file: argv only, free text never on it). */\nasync function invoke<T>(\n run: CommandRunner,\n cwd: string,\n r: Pick<AzureRepo, 'orgUrl' | 'project' | 'repo'>,\n resource: string,\n route: Record<string, string | number>,\n method: 'GET' | 'POST' | 'PATCH' = 'GET',\n body?: unknown,\n): Promise<AzResult<T>> {\n const values = Object.entries({ project: r.project, repositoryId: r.repo, ...route });\n const bad = values.find(([, v]) => !routeValueOk(v));\n if (bad) return { ok: false, error: `refused: ${bad[0]} isn't a name Azure DevOps has` };\n const params = values.map(([k, v]) => `${k}=${v}`);\n let dir: string | null = null;\n const args = [\n 'devops',\n 'invoke',\n '--org',\n r.orgUrl,\n '--area',\n 'git',\n '--resource',\n resource,\n '--route-parameters',\n ...params,\n '--http-method',\n method,\n '--api-version',\n API,\n ];\n try {\n if (body !== undefined) {\n dir = fs.mkdtempSync(path.join(os.tmpdir(), 'work-az-'));\n const file = path.join(dir, 'body.json');\n fs.writeFileSync(file, JSON.stringify(body));\n args.push('--in-file', file);\n }\n return await az<T>(run, cwd, args);\n } finally {\n // Tidying the temp folder never turns a call that went through into a failure (a retry would send it again).\n if (dir)\n try {\n fs.rmSync(dir, { recursive: true, force: true });\n } catch {\n /* a leftover temp file; the OS clears its temp folder */\n }\n }\n}\n\n/** Who `az` is signed in as (its user name: the e-mail Azure DevOps names people by). */\nasync function viewer(run: CommandRunner, cwd: string): Promise<string | null> {\n const r = await az<{ user?: { name?: string } }>(run, cwd, ['account', 'show']);\n return r.ok && r.value?.user?.name ? r.value.user.name : null;\n}\n\n/** A PR's policy evaluations; an error when az can't say — never \"no policies\", which would read as clean. */\nasync function policies(run: CommandRunner, cwd: string, r: AzureRepo, id: number): Promise<AzResult<AzPolicy[]>> {\n const p = await az<AzPolicy[]>(run, cwd, ['repos', 'pr', 'policy', 'list', '--id', String(id), '--org', r.orgUrl]);\n if (!p.ok) return p;\n return Array.isArray(p.value) ? { ok: true, value: p.value } : { ok: false, error: \"couldn't read what az said about the PR's policies\" };\n}\n\n/** The PR's iteration (push) whose source commit is `commitId`: where a review comment is anchored. */\nasync function iterationAt(run: CommandRunner, cwd: string, r: AzureRepo, number: number, commitId: string): Promise<AzResult<number>> {\n const got = await invoke<{ value?: AzIteration[] }>(run, cwd, r, 'pullRequestIterations', { pullRequestId: number });\n if (!got.ok) return got;\n const its = (got.value?.value ?? []).filter((i) => typeof i?.id === 'number' && i.sourceRefCommit?.commitId === commitId);\n const id = its.at(-1)?.id;\n return typeof id === 'number'\n ? { ok: true, value: id }\n : { ok: false, error: `the PR has no push at ${commitId.slice(0, 8)} (it moved since the review was prepared)` };\n}\n\n/** How many open PRs one listing asks for; a list that long may have stopped short (`more`). */\nconst OPEN_PR_LIMIT = 100;\n\n/** A review comment: a new thread on a line of the PR's new side. */\nasync function postThread(\n run: CommandRunner,\n cwd: string,\n r: AzureRepo,\n number: number,\n c: { path: string; line: number; body: string },\n iteration: number,\n): Promise<AzResult<AzThread>> {\n return invoke<AzThread>(run, cwd, r, 'pullRequestThreads', { pullRequestId: number }, 'POST', {\n comments: [{ parentCommentId: 0, content: c.body, commentType: 1 }],\n status: 'active',\n threadContext: { filePath: `/${c.path}`, rightFileStart: { line: c.line, offset: 1 }, rightFileEnd: { line: c.line, offset: 1 } },\n // At the push the review read (its lines are that commit's), not whatever the PR is at now.\n pullRequestThreadContext: { iterationContext: { firstComparingIteration: iteration, secondComparingIteration: iteration } },\n });\n}\n\nconst MERGE_STRATEGY = { squash: 'squash', merge: 'noFastForward', rebase: 'rebase' } as const;\n\nexport const azure: GitHost = {\n id: 'azure',\n name: 'Azure DevOps',\n cli: {\n cmd: 'az',\n label: 'Azure CLI (azure-devops)',\n checkArgs: ['account', 'show'],\n requires: [\n {\n args: ['extension', 'show', '--name', 'azure-devops'],\n failing:\n \"Optional: add the Azure CLI's azure-devops extension (az extension add --name azure-devops) to see the pull requests of your Azure DevOps repos.\",\n },\n ],\n missing:\n 'Optional: install the Azure CLI and its azure-devops extension (az extension add --name azure-devops) to see the pull requests of your Azure DevOps repos.',\n failing: 'Optional: run `az login` so work can see your Azure DevOps pull requests.',\n },\n matches: onAzure,\n repoId: azureRepoId,\n parsePrUrl: (t) => {\n const l = parseAzurePrUrl(t);\n return l ? { repoId: l.repoId, number: l.number, url: l.url, label: l.label } : null;\n },\n // The PR merged into its target (its first parent); its second parent is the PR's head, where a review reads and comments.\n prRef: (n) => `refs/pull/${n}/merge`,\n prRefIsMerge: true,\n\n async list(repos, run) {\n const prs: PullRequestInfo[] = [];\n const incomplete: string[] = [];\n let me: string | null | undefined;\n for (const repo of repos) {\n const r = repo.origin ? parseAzureOrigin(repo.origin) : null;\n if (!r) {\n incomplete.push(repo.alias);\n continue;\n }\n me ??= await viewer(run, repo.path);\n // Who you are unknown: yours and those asking you can't be told apart, so the repo's list is incomplete, never empty.\n if (!me) {\n me = undefined;\n incomplete.push(repo.alias);\n continue;\n }\n const list = await az<AzPr[]>(run, repo.path, ['repos', 'pr', 'list', ...where(r), '--status', 'active', '--top', '100']);\n if (!list.ok || !Array.isArray(list.value)) {\n incomplete.push(repo.alias);\n continue;\n }\n for (const pr of list.value) {\n const row = prInfoOf(r, repo.alias, pr, me);\n // The dashboard lists yours and those asking you (as on GitHub).\n if (row && (row.isMine || row.reviewRequested)) prs.push(row);\n }\n if (list.value.length >= 100) incomplete.push(repo.alias);\n }\n return { prs, incomplete };\n },\n viewer,\n\n async prForBranch(run, cwd, branch) {\n const r = repoAt(cwd);\n if (!r) return { kind: 'error', error: \"this repo's origin isn't an Azure DevOps one\" };\n const list = await az<AzPr[]>(run, cwd, [\n 'repos',\n 'pr',\n 'list',\n ...where(r),\n '--source-branch',\n branch,\n '--status',\n 'all',\n '--top',\n '10',\n ]);\n if (!list.ok) return { kind: 'error', error: list.error };\n const pr = pickPr(Array.isArray(list.value) ? list.value : []);\n if (!pr) return { kind: 'none' };\n const pol: AzResult<AzPolicy[]> = pr.status === 'active' ? await policies(run, cwd, r, pr.pullRequestId!) : { ok: true, value: [] };\n if (!pol.ok) return { kind: 'error', error: pol.error };\n const ship = shipPrOf(r, pr, pol.value);\n return ship ? { kind: 'pr', pr: ship } : { kind: 'error', error: \"couldn't read what az said about the PR\" };\n },\n\n async prByNumber(run, cwd, repoId, number) {\n const r = repoAt(cwd);\n if (!r || `${r.org}/${r.project}/${r.repo}`.toLowerCase() !== repoId)\n return { ok: false, error: `PR #${number}: its repo isn't this folder's` };\n const shown = await az<AzPr>(run, cwd, ['repos', 'pr', 'show', '--id', String(number), '--org', r.orgUrl]);\n if (!shown.ok) return { ok: false, error: `PR #${number} in ${r.repo}: ${shown.error}` };\n // PR numbers are the organisation's, not the repo's: #N may be another repo's PR.\n const on = shown.value?.repository;\n if (lower(on?.name) !== lower(r.repo) || lower(on?.project?.name) !== lower(r.project))\n return { ok: false, error: `PR #${number} is in ${on?.project?.name ?? '?'}/${on?.name ?? '?'}, not ${r.project}/${r.repo}` };\n const pr = prForStartOf(r, shown.value ?? {});\n return pr ? { ok: true, pr } : { ok: false, error: \"couldn't read what az said about the PR\" };\n },\n\n async prState(run, url) {\n const l = parseAzurePrUrl(url);\n if (!l) return { ok: false, error: 'not an Azure DevOps pull request link' };\n const shown = await az<AzPr>(run, os.tmpdir(), ['repos', 'pr', 'show', '--id', String(l.number), '--org', l.repo.orgUrl]);\n return shown.ok ? { ok: true, state: prState(shown.value?.status) } : { ok: false, error: shown.error };\n },\n\n async createPr(run, cwd, branch, opts) {\n const r = repoAt(cwd);\n if (!r) return { ok: false, error: \"this repo's origin isn't an Azure DevOps one\" };\n // `--fill` as gh does it: the last commit's subject and body.\n const subject = (await run('git', ['log', '-1', '--format=%s'], cwd)).stdout.trim() || branch;\n const body = (await run('git', ['log', '-1', '--format=%b'], cwd)).stdout.trim();\n // Into the repo's default branch, as `az repos pr create` would; through the REST API, so the title and\n // description travel in a file, never on argv (a line break there ended the command on Windows).\n const repo = await invoke<{ defaultBranch?: string }>(run, cwd, r, 'repositories', {});\n if (!repo.ok) return { ok: false, error: repo.error };\n const target = repo.value?.defaultBranch;\n if (!target) return { ok: false, error: `couldn't tell ${r.repo}'s default branch` };\n const made = await invoke<AzPr>(run, cwd, r, 'pullRequests', {}, 'POST', {\n sourceRefName: `refs/heads/${branch}`,\n targetRefName: target,\n title: subject,\n description: body,\n isDraft: opts.draft,\n });\n if (!made.ok) return { ok: false, error: made.error };\n const n = made.value?.pullRequestId;\n return { ok: true, ...(typeof n === 'number' ? { url: prWebUrl(r, n) } : {}) };\n },\n\n async mergePr(run, cwd, number, method, headSha) {\n const r = repoAt(cwd);\n if (!r) return { ok: false, error: \"this repo's origin isn't an Azure DevOps one\" };\n // Completing with lastMergeSourceCommit: Azure DevOps refuses when the PR moved past the commit you were shown.\n const done = await invoke<AzPr>(run, cwd, r, 'pullRequests', { pullRequestId: number }, 'PATCH', {\n status: 'completed',\n lastMergeSourceCommit: { commitId: headSha },\n completionOptions: { mergeStrategy: MERGE_STRATEGY[method], deleteSourceBranch: false },\n });\n if (!done.ok) return { ok: false, error: done.error };\n // Merged only when Azure DevOps says completed: a completion it only queued (policies still running) isn't.\n const status = done.value?.status;\n if (status === 'completed') return { ok: true };\n const why = done.value?.mergeStatus && done.value.mergeStatus !== 'succeeded' ? ` (merge: ${done.value.mergeStatus})` : '';\n const queued = status === 'active' ? ': its completion may be queued until its policies pass' : '';\n return { ok: false, error: `Azure DevOps didn't complete PR #${number}, it is ${status ?? 'in an unknown state'}${why}${queued}` };\n },\n\n async mergedPr(run, cwd, branch, tip) {\n const r = repoAt(cwd);\n if (!r) return undefined;\n const list = await az<AzPr[]>(run, cwd, [\n 'repos',\n 'pr',\n 'list',\n ...where(r),\n '--source-branch',\n branch,\n '--status',\n 'completed',\n '--top',\n '10',\n ]);\n if (!list.ok || !Array.isArray(list.value)) return undefined;\n return list.value.find((p) => p.lastMergeSourceCommit?.commitId === tip)?.pullRequestId ?? null;\n },\n\n async openPrs(run, cwd) {\n const r = repoAt(cwd);\n if (!r) return { ok: false, error: \"this repo's origin isn't an Azure DevOps one\" };\n const list = await az<AzPr[]>(run, cwd, ['repos', 'pr', 'list', ...where(r), '--status', 'active', '--top', String(OPEN_PR_LIMIT)]);\n if (!list.ok) return { ok: false, error: list.error };\n // Not a list is not \"no PRs\": the review queue would drop every review of the repo.\n if (!Array.isArray(list.value)) return { ok: false, error: \"couldn't read what az said\" };\n return {\n ok: true,\n prs: list.value.flatMap((p) => openPrOf(r, p) ?? []),\n ...(list.value.length >= OPEN_PR_LIMIT ? { more: true } : {}),\n };\n },\n\n // Each comment its own thread, then the summary, then the vote: what went out before a failure is said, so a retry\n // sends none of it again; a call that failed without a clear refusal may have gone through (`inDoubt`), and the\n // steps after it weren't tried (`rest`: if it went, the review went only in part).\n async submitReview(run, cwd, number, review): Promise<SubmitReviewResult> {\n const r = repoAt(cwd);\n if (!r) return { ok: false, error: \"this repo's origin isn't an Azure DevOps one\" };\n // The push the review read: its comments are anchored there (nothing is posted when it can't be found).\n const iteration = review.comments.length ? await iterationAt(run, cwd, r, number, review.commitId) : null;\n if (iteration && !iteration.ok) return { ok: false, error: iteration.error, posted: 0 };\n const summary = !!review.body.trim();\n const vote = review.event !== 'comment';\n for (const [i, c] of review.comments.entries()) {\n const made = await postThread(run, cwd, r, number, c, iteration?.ok ? iteration.value : 0);\n if (!made.ok)\n return {\n ok: false,\n error: `${c.path}:${c.line}: ${made.error}`,\n posted: i,\n ...(made.uncertain\n ? { inDoubt: { comments: [i], summary: false, rest: i < review.comments.length - 1 || summary || vote } }\n : {}),\n };\n }\n if (summary) {\n const general = await invoke(run, cwd, r, 'pullRequestThreads', { pullRequestId: number }, 'POST', {\n comments: [{ parentCommentId: 0, content: review.body, commentType: 1 }],\n status: 'active',\n });\n if (!general.ok)\n return {\n ok: false,\n error: `the summary: ${general.error}`,\n posted: review.comments.length,\n ...(general.uncertain ? { inDoubt: { comments: [], summary: true, rest: vote } } : {}),\n };\n }\n // The verdict as Azure DevOps votes: approve 10, wait for author −5; a plain comment leaves the vote as it is.\n // A vote set twice is the same vote: a retry may send it again.\n if (review.event !== 'comment') {\n const vote = review.event === 'approve' ? 'approve' : 'wait-for-author';\n const v = await az(run, cwd, ['repos', 'pr', 'set-vote', '--id', String(number), '--vote', vote, '--org', r.orgUrl]);\n if (!v.ok)\n return {\n ok: false,\n error: `the comments went out, the vote didn't: ${v.error}`,\n posted: review.comments.length,\n summaryPosted: summary,\n };\n }\n return { ok: true, url: prWebUrl(r, number) };\n },\n\n // Read only: the PR's threads and its reviewers' votes (two GETs through `az devops invoke`).\n async discussion(run, cwd, number) {\n const r = repoAt(cwd);\n if (!r) return { ok: false, error: \"this repo's origin isn't an Azure DevOps one\" };\n const threads = await invoke<{ value?: AzThread[] }>(run, cwd, r, 'pullRequestThreads', { pullRequestId: number });\n if (!threads.ok) return { ok: false, error: threads.error };\n const pr = await invoke<AzPr>(run, cwd, r, 'pullRequests', { pullRequestId: number });\n if (!pr.ok) return { ok: false, error: pr.error };\n return { ok: true, discussion: discussionOf(r, number, threads.value?.value ?? [], pr.value ?? null) };\n },\n\n async reviewFeedback(run, cwd, number) {\n const r = repoAt(cwd);\n if (!r) return null;\n const me = await viewer(run, cwd);\n // Who you are tells your words from a reviewer's: without it the lookup failed (callers keep the last count).\n if (!me) return null;\n const threads = await invoke<{ value?: AzThread[] }>(run, cwd, r, 'pullRequestThreads', { pullRequestId: number });\n if (!threads.ok) return null;\n return feedbackOf(r, number, threads.value?.value ?? [], me);\n },\n\n threads: {\n isId: (id) => AZURE_THREAD_ID.test(id),\n repoOf: azureThreadRepoId,\n async now(run, cwd, id) {\n const t = parseAzureThreadId(id);\n if (!t) return { ok: false, error: 'not an Azure DevOps thread id' };\n const me = await viewer(run, cwd);\n const got = await invoke<AzThread>(run, cwd, t.repo, 'pullRequestThreads', { pullRequestId: t.pr, threadId: t.thread });\n if (!me || !got.ok || !got.value)\n return { ok: false, error: `couldn't read the thread on Azure DevOps first${got.ok ? '' : `: ${got.error}`}` };\n const people = (got.value.comments ?? []).filter((c) => c && !c.isDeleted && c.commentType !== 'system');\n return {\n ok: true,\n thread: {\n viewer: me,\n resolved: RESOLVED_THREAD.has(got.value.status ?? ''),\n lastAuthor: people.at(-1)?.author?.uniqueName ?? null,\n },\n };\n },\n async live(run, cwd, id) {\n const t = parseAzureThreadId(id);\n if (!t) return { ok: false, error: 'not an Azure DevOps thread id' };\n const me = await viewer(run, cwd);\n const got = await invoke<AzThread>(run, cwd, t.repo, 'pullRequestThreads', { pullRequestId: t.pr, threadId: t.thread });\n const pr = await az<AzPr>(run, cwd, ['repos', 'pr', 'show', '--id', String(t.pr), '--org', t.repo.orgUrl]);\n if (!me || !got.ok || !got.value || !pr.ok) return { ok: false, error: `${id} isn't a review thread Azure DevOps knows` };\n const people = (got.value.comments ?? []).filter((c) => c && !c.isDeleted && c.commentType !== 'system');\n const first = people[0];\n const last = people.at(-1);\n const url = `${prWebUrl(t.repo, t.pr)}?discussionId=${t.thread}`;\n const ctx = got.value.threadContext;\n const repo = parseAzureOrigin(`${t.repo.orgUrl}/${encodeURIComponent(t.repo.project)}/_git/${encodeURIComponent(t.repo.repo)}`);\n return {\n ok: true,\n thread: {\n viewer: me,\n resolved: RESOLVED_THREAD.has(got.value.status ?? ''),\n outdated: false,\n path: ctx?.filePath ? ctx.filePath.replace(/^\\//, '') : null,\n line: ctx?.rightFileEnd?.line ?? null,\n originalStartLine: null,\n originalLine: null,\n first: first ? { author: first.author?.uniqueName ?? '', body: first.content ?? '', url, diffHunk: null } : null,\n last: last ? { author: last.author?.uniqueName ?? '', url } : null,\n pr: {\n number: t.pr,\n url: prWebUrl(t.repo, t.pr),\n headBranch: (pr.value?.sourceRefName ?? '').replace(/^refs\\/heads\\//, ''),\n repoId: repo ? `${repo.org}/${repo.project}/${repo.repo}`.toLowerCase() : '',\n },\n },\n };\n },\n async isResolved(run, cwd, id) {\n const t = parseAzureThreadId(id);\n if (!t) return null;\n const got = await invoke<AzThread>(run, cwd, t.repo, 'pullRequestThreads', { pullRequestId: t.pr, threadId: t.thread });\n return got.ok && got.value?.status ? RESOLVED_THREAD.has(got.value.status) : null;\n },\n async reply(run, cwd, id, body) {\n const t = parseAzureThreadId(id);\n if (!t) return { ok: false, error: 'not an Azure DevOps thread id' };\n const made = await invoke(run, cwd, t.repo, 'pullRequestThreadComments', { pullRequestId: t.pr, threadId: t.thread }, 'POST', {\n content: body,\n parentCommentId: 1,\n commentType: 1,\n });\n return made.ok ? { ok: true, url: `${prWebUrl(t.repo, t.pr)}?discussionId=${t.thread}` } : { ok: false, error: made.error };\n },\n async resolve(run, cwd, id) {\n const t = parseAzureThreadId(id);\n if (!t) return false;\n const done = await invoke(run, cwd, t.repo, 'pullRequestThreads', { pullRequestId: t.pr, threadId: t.thread }, 'PATCH', {\n status: 'fixed',\n });\n return done.ok;\n },\n },\n\n rateLimited: (text) => THROTTLED.test(text),\n // A completed PR's merge commit is the user's own (Azure DevOps commits as the person completing it).\n hostCommit: () => false,\n commands: azureCommands,\n};\n","import type { PrLink } from '../types.js';\n\n/**\n * Azure DevOps origins, pull request links and review-thread ids. Pure and\n * import-free (types only): the SPA reads links and thread ids with it too\n * (`core/hosts/links.ts`).\n *\n * A repo is `org/project/repo` (lower case: its id here). Origins:\n * https://dev.azure.com/{org}/{project}/_git/{repo} (also `{user}@dev.azure.com`)\n * https://{org}.visualstudio.com/[DefaultCollection/]{project}/_git/{repo}\n * git@ssh.dev.azure.com:v3/{org}/{project}/{repo}\n * {org}@vs-ssh.visualstudio.com:v3/{org}/{project}/{repo}\n */\n\nexport interface AzureRepo {\n org: string;\n project: string;\n repo: string;\n /** The org's URL, as `az --org` takes it. */\n orgUrl: string;\n}\n\nconst dec = (s: string) => {\n try {\n return decodeURIComponent(s);\n } catch {\n return s;\n }\n};\nconst strip = (s: string) => s.replace(/\\.git$/, '').replace(/\\/+$/, '');\n\n/**\n * What an org, a project and a repo may be called: Azure DevOps' own rules (an org: letters, digits and\n * hyphens; a project or repo: none of `\\ / : * ? \" ' < > ; # $ { } , + = [ ] |`, nor a control character),\n * plus none of `% & ^ !`. These names reach `az`'s argv and its REST routes, so anything else isn't a repo here.\n */\nconst ORG_NAME = /^[A-Za-z0-9][A-Za-z0-9-]{0,49}$/;\nconst PART_NAME = /^[^\\\\/:*?\"'<>;#$*{},+=[\\]|%&^!\\x00-\\x1f\\x7f]{1,128}$/;\nexport const azureNameOk = (org: string, project: string, repo: string): boolean =>\n ORG_NAME.test(org) && PART_NAME.test(project) && PART_NAME.test(repo) && project.trim() === project && repo.trim() === repo;\n\n/** The org of an org URL `az --org` takes, only in the forms Azure DevOps has: `https://dev.azure.com/<org>`, `https://<org>.visualstudio.com`. */\nexport function azureOrgOf(orgUrl: string): string | null {\n const m = /^https:\\/\\/dev\\.azure\\.com\\/([^/]+)$/.exec(orgUrl) ?? /^https:\\/\\/([^./]+)\\.visualstudio\\.com$/.exec(orgUrl);\n return m && ORG_NAME.test(m[1]) ? m[1] : null;\n}\n\nfunction repoOf(org: string, project: string, repo: string, orgUrl: string): AzureRepo | null {\n const r = { org: dec(org), project: dec(project), repo: dec(strip(repo)), orgUrl };\n return azureNameOk(r.org, r.project, r.repo) && azureOrgOf(orgUrl) === r.org ? r : null;\n}\n\n/** An origin on Azure DevOps, read; null for anything else (and for names Azure DevOps wouldn't have). */\nexport function parseAzureOrigin(origin: string): AzureRepo | null {\n const o = origin.trim();\n let m = /^https?:\\/\\/(?:[^@/]+@)?dev\\.azure\\.com\\/([^/]+)\\/([^/]+)\\/_git\\/([^/?#]+)/i.exec(o);\n if (m) return repoOf(m[1], m[2], m[3], `https://dev.azure.com/${m[1]}`);\n m = /^https?:\\/\\/(?:[^@/]+@)?([^./]+)\\.visualstudio\\.com\\/(?:DefaultCollection\\/)?([^/]+)\\/_git\\/([^/?#]+)/i.exec(o);\n if (m) return repoOf(m[1], m[2], m[3], `https://${m[1]}.visualstudio.com`);\n m = /^(?:ssh:\\/\\/)?[^@]+@ssh\\.dev\\.azure\\.com[:/]v3\\/([^/]+)\\/([^/]+)\\/([^/]+)$/i.exec(o);\n if (m) return repoOf(m[1], m[2], m[3], `https://dev.azure.com/${m[1]}`);\n m = /^(?:ssh:\\/\\/)?[^@]+@vs-ssh\\.visualstudio\\.com[:/]v3\\/([^/]+)\\/([^/]+)\\/([^/]+)$/i.exec(o);\n if (m) return repoOf(m[1], m[2], m[3], `https://${m[1]}.visualstudio.com`);\n return null;\n}\n\n/** An origin on Azure DevOps. */\nexport const onAzure = (origin: string) => parseAzureOrigin(origin) !== null;\n\n/** `org/project/repo` (lower case) of an Azure DevOps origin; null for another host. */\nexport function azureRepoId(origin: string): string | null {\n const r = parseAzureOrigin(origin);\n return r ? `${r.org}/${r.project}/${r.repo}`.toLowerCase() : null;\n}\n\n/** The repo's web address (its PRs live under `/pullrequest/<id>`). */\nexport function azureWebUrl(r: Pick<AzureRepo, 'orgUrl' | 'project' | 'repo'>): string {\n return `${r.orgUrl}/${encodeURIComponent(r.project)}/_git/${encodeURIComponent(r.repo)}`;\n}\n\n/** An Azure DevOps pull request link (any tail); null for anything else. */\nexport function parseAzurePrUrl(text: string): (PrLink & { repo: AzureRepo }) | null {\n const t = text.trim();\n const m = /^(https?:\\/\\/[^?#]+\\/_git\\/[^/?#]+)\\/pullrequest\\/(\\d+)(?:[/?#].*)?$/i.exec(t);\n if (!m) return null;\n const repo = parseAzureOrigin(m[1]);\n if (!repo) return null;\n const number = Number(m[2]);\n return {\n repoId: `${repo.org}/${repo.project}/${repo.repo}`.toLowerCase(),\n number,\n url: `${azureWebUrl(repo)}/pullrequest/${number}`,\n label: `${repo.repo}!${number}`,\n repo,\n };\n}\n\n/**\n * A review thread's id here: Azure DevOps numbers threads per pull request,\n * so the id carries where it is — `AZT_<org/project/repo, base64url>_<pr>_<thread>` —\n * and any thread can be answered from any folder, like GitHub's global ids.\n */\nexport const AZURE_THREAD_ID = /^AZT_[A-Za-z0-9_-]{2,400}_\\d{1,9}_\\d{1,9}$/;\n\nconst b64url = (s: string) => {\n const bytes = new TextEncoder().encode(s);\n let bin = '';\n for (const b of bytes) bin += String.fromCharCode(b);\n return btoa(bin).replace(/\\+/g, '-').replace(/\\//g, '_').replace(/=+$/, '');\n};\nconst unb64url = (s: string) => {\n const bin = atob(s.replace(/-/g, '+').replace(/_/g, '/'));\n return new TextDecoder().decode(Uint8Array.from(bin, (c) => c.charCodeAt(0)));\n};\n\n/** The `org/project/repo` id (lower case) of the repo a thread id is on; null when it isn't a valid one. */\nexport function azureThreadRepoId(id: string): string | null {\n const t = parseAzureThreadId(id);\n const org = t ? azureOrgOf(t.repo.orgUrl) : null;\n return t && org ? `${org}/${t.repo.project}/${t.repo.repo}`.toLowerCase() : null;\n}\n\nexport function azureThreadId(r: Pick<AzureRepo, 'orgUrl' | 'project' | 'repo'>, pr: number, thread: number): string {\n return `AZT_${b64url(JSON.stringify([r.orgUrl, r.project, r.repo]))}_${pr}_${thread}`;\n}\n\n/** A thread id read back: its repo, PR and thread; null when it isn't one. */\nexport function parseAzureThreadId(\n id: string,\n): { repo: Pick<AzureRepo, 'orgUrl' | 'project' | 'repo'>; pr: number; thread: number } | null {\n if (!AZURE_THREAD_ID.test(id)) return null;\n const m = /^AZT_(.+)_(\\d+)_(\\d+)$/.exec(id);\n if (!m) return null;\n try {\n const v: unknown = JSON.parse(unb64url(m[1]));\n if (!Array.isArray(v) || v.length !== 3 || !v.every((x) => typeof x === 'string')) return null;\n const [orgUrl, project, repo] = v as [string, string, string];\n // Only an org URL Azure DevOps has, and names it would have: the id is text anyone can hand `work pr reply`,\n // and its org URL is where `az` would connect, signed in as you. It must read back as the same repo.\n const back = parseAzureOrigin(azureWebUrl({ orgUrl, project, repo }));\n if (!back || back.orgUrl !== orgUrl || back.project !== project || back.repo !== repo) return null;\n return { repo: { orgUrl, project, repo }, pr: Number(m[2]), thread: Number(m[3]) };\n } catch {\n return null;\n }\n}\n","import type {\n ChecksState,\n FailingCheck,\n PrDiscussionCommentWire,\n PrDiscussionReviewWire,\n PrDiscussionThreadWire,\n ShipPr,\n} from '../../api-types.js';\nimport type { PullRequestInfo } from '../../pr/pr-types.js';\nimport type { ReviewFeedback, ReviewThread } from '../../pr/review-types.js';\nimport type { OpenPr, PrDiscussion, PrForStart } from '../types.js';\nimport { discussionBody, MAX_THREAD_COMMENTS } from '../discussion.js';\nimport { azureThreadId, azureWebUrl, type AzureRepo } from './origin.js';\n\n/**\n * PURE — Azure DevOps' answers (the `az repos` / REST JSON) read into work's\n * wire types, which keep GitHub's vocabulary (#63): every field optional and\n * checked — it is someone else's output.\n *\n * reviewer votes 10 / 5 → approved; −5 (waiting for author) / −10 (rejected) → changes requested\n * build policy evaluations → checks passing / failing / running\n * mergeStatus `conflicts` → conflicting (`DIRTY`); `isDraft` → draft\n * status active / completed / abandoned → OPEN / MERGED / CLOSED\n * threads active / pending → open; fixed / closed / wontFix / byDesign → resolved\n */\n\nexport interface AzPr {\n pullRequestId?: number;\n title?: string;\n description?: string;\n status?: string;\n isDraft?: boolean;\n mergeStatus?: string;\n sourceRefName?: string;\n targetRefName?: string;\n lastMergeSourceCommit?: { commitId?: string } | null;\n closedDate?: string;\n creationDate?: string;\n createdBy?: { uniqueName?: string; displayName?: string } | null;\n reviewers?: Array<{ uniqueName?: string; displayName?: string; vote?: number; isRequired?: boolean } | null> | null;\n forkSource?: { repository?: { name?: string; project?: { name?: string } } } | null;\n /** The repo it's in (PR numbers are the organisation's, not the repo's). */\n repository?: { name?: string; project?: { name?: string } } | null;\n}\n\n/** A PR's iteration: one push of its source branch. */\nexport interface AzIteration {\n id?: number;\n sourceRefCommit?: { commitId?: string } | null;\n}\n\nexport interface AzPolicy {\n status?: string;\n configuration?: {\n isBlocking?: boolean;\n isEnabled?: boolean;\n type?: { displayName?: string };\n settings?: { displayName?: string };\n } | null;\n}\n\nexport interface AzThread {\n id?: number;\n status?: string;\n isDeleted?: boolean;\n threadContext?: {\n filePath?: string;\n rightFileStart?: { line?: number };\n rightFileEnd?: { line?: number };\n leftFileStart?: { line?: number };\n leftFileEnd?: { line?: number };\n } | null;\n comments?: Array<{\n id?: number;\n author?: { uniqueName?: string; displayName?: string } | null;\n content?: string;\n publishedDate?: string;\n commentType?: string;\n isDeleted?: boolean;\n } | null> | null;\n}\n\nconst branch = (ref: string | undefined) => (ref ?? '').replace(/^refs\\/heads\\//, '');\nconst lower = (s: string | undefined | null) => (s ?? '').toLowerCase();\n\nexport function prState(status: string | undefined): ShipPr['state'] {\n return status === 'completed' ? 'MERGED' : status === 'abandoned' ? 'CLOSED' : 'OPEN';\n}\n\n/** The reviewers' votes as GitHub's review decision ('' when nobody is asked). */\nexport function reviewDecision(pr: AzPr): string {\n const votes = (pr.reviewers ?? []).filter((r) => !!r).map((r) => r!.vote ?? 0);\n if (!votes.length) return '';\n if (votes.some((v) => v < 0)) return 'CHANGES_REQUESTED';\n const required = (pr.reviewers ?? []).filter((r) => r?.isRequired);\n if (required.length ? required.every((r) => (r!.vote ?? 0) > 0) : votes.some((v) => v > 0)) return 'APPROVED';\n return 'REVIEW_REQUIRED';\n}\n\nconst isBuild = (p: AzPolicy) => /build/i.test(p.configuration?.type?.displayName ?? '');\n\n/** Build policies as checks, and the failing ones by name. */\nexport function checksOf(policies: AzPolicy[]): { checks: ChecksState; failing: FailingCheck[] } {\n const builds = policies.filter((p) => p.configuration?.isEnabled !== false && isBuild(p) && p.status !== 'notApplicable');\n const failing = builds\n .filter((p) => p.status === 'rejected' || p.status === 'broken')\n .map((p) => ({ name: p.configuration?.settings?.displayName || p.configuration?.type?.displayName || 'build' }));\n if (!builds.length) return { checks: 'none', failing: [] };\n if (failing.length) return { checks: 'fail', failing };\n if (builds.some((p) => p.status === 'queued' || p.status === 'running')) return { checks: 'pending', failing: [] };\n return { checks: 'pass', failing: [] };\n}\n\n/** GitHub's mergeStateStatus from what Azure DevOps says: conflicts, draft, a blocking policy not met, a failed or\n * refused merge, not worked out yet, or clean. */\nexport function mergeState(pr: AzPr, policies: AzPolicy[]): string {\n if (pr.mergeStatus === 'conflicts') return 'DIRTY';\n if (pr.isDraft) return 'DRAFT';\n const blocking = policies.filter(\n (p) => p.configuration?.isBlocking && p.configuration?.isEnabled !== false && p.status !== 'notApplicable',\n );\n if (blocking.some((p) => p.status === 'rejected' || p.status === 'broken')) return 'BLOCKED';\n if (blocking.some((p) => p.status !== 'approved')) return 'BLOCKED';\n // Its merge failed, or a policy refused it: not mergeable. Not worked out yet (queued, notSet): unknown, as GitHub says.\n if (pr.mergeStatus === 'failure' || pr.mergeStatus === 'rejectedByPolicy') return 'BLOCKED';\n if (pr.mergeStatus === 'queued' || pr.mergeStatus === 'notSet') return 'UNKNOWN';\n return 'CLEAN';\n}\n\nexport const prWebUrl = (repo: Pick<AzureRepo, 'orgUrl' | 'project' | 'repo'>, id: number) => `${azureWebUrl(repo)}/pullrequest/${id}`;\n\n/** A PR (and its policies) as work's ShipPr. */\nexport function shipPrOf(repo: AzureRepo, pr: AzPr, policies: AzPolicy[]): ShipPr | null {\n const n = pr.pullRequestId;\n const head = pr.lastMergeSourceCommit?.commitId;\n if (typeof n !== 'number' || !head) return null;\n const { checks, failing } = checksOf(policies);\n const state = prState(pr.status);\n return {\n number: n,\n url: prWebUrl(repo, n),\n state,\n isDraft: pr.isDraft === true,\n mergeStateStatus: mergeState(pr, policies),\n checks,\n headSha: head,\n ...(state === 'MERGED' && pr.closedDate ? { mergedAt: pr.closedDate } : {}),\n // Only a closed PR's date says it hasn't changed since: an open one's creationDate never moves, and the PR\n // watch would believe its review threads unchanged for good. Without it they're read every check.\n ...(state !== 'OPEN' && pr.closedDate ? { updatedAt: pr.closedDate } : {}),\n reviewDecision: reviewDecision(pr),\n ...(pr.createdBy?.uniqueName ? { author: pr.createdBy.uniqueName } : {}),\n ...(pr.targetRefName ? { baseBranch: branch(pr.targetRefName) } : {}),\n ...(failing.length ? { failing } : {}),\n };\n}\n\n/** The branch's PR to show: an open one, else the newest. */\nexport function pickPr(list: AzPr[]): AzPr | null {\n const valid = list.filter((p) => typeof p.pullRequestId === 'number');\n return (\n valid.find((p) => p.status === 'active') ??\n [...valid].sort((a, b) => (b.creationDate ?? '').localeCompare(a.creationDate ?? ''))[0] ??\n null\n );\n}\n\nconst myVote = (pr: AzPr, me: string) => (pr.reviewers ?? []).find((r) => lower(r?.uniqueName) === lower(me))?.vote;\n\n/** A PR as the dashboard's list row (yours, or asking your review). */\nexport function prInfoOf(repo: AzureRepo, alias: string, pr: AzPr, me: string): PullRequestInfo | null {\n const n = pr.pullRequestId;\n if (typeof n !== 'number') return null;\n const vote = me ? myVote(pr, me) : undefined;\n const decision = reviewDecision(pr);\n return {\n number: n,\n title: pr.title ?? '',\n branch: branch(pr.sourceRefName),\n url: prWebUrl(repo, n),\n isDraft: pr.isDraft === true,\n checksStatus: 'NONE', // policies are asked per PR by the PR watch, not for the whole list\n reviewDecision: decision === 'APPROVED' || decision === 'CHANGES_REQUESTED' || decision === 'REVIEW_REQUIRED' ? decision : 'NONE',\n myReview: vote === undefined || vote === 0 ? 'NONE' : vote > 0 ? 'APPROVED' : 'CHANGES_REQUESTED',\n isMine: !!me && lower(pr.createdBy?.uniqueName) === lower(me),\n conflicting: pr.mergeStatus === 'conflicts',\n reviewRequested: vote === 0,\n repoAlias: alias,\n ...(me && pr.createdBy?.uniqueName ? { author: pr.createdBy.uniqueName } : {}),\n fork: !!pr.forkSource,\n };\n}\n\nexport function openPrOf(repo: AzureRepo, pr: AzPr): OpenPr | null {\n const n = pr.pullRequestId;\n const head = pr.lastMergeSourceCommit?.commitId;\n if (typeof n !== 'number' || !head || pr.status !== 'active') return null;\n return {\n number: n,\n title: pr.title ?? '',\n url: prWebUrl(repo, n),\n branch: branch(pr.sourceRefName),\n headSha: head,\n base: branch(pr.targetRefName),\n author: pr.createdBy?.uniqueName ?? '',\n isDraft: pr.isDraft === true,\n // Azure DevOps' PR list says nothing of size: the review queue's size limit can't apply before it's fetched.\n additions: 0,\n deletions: 0,\n requested: (pr.reviewers ?? []).filter((r) => r && (r.vote ?? 0) === 0 && r.uniqueName).map((r) => r!.uniqueName!),\n ...(pr.forkSource ? { fork: true as const } : {}),\n };\n}\n\nexport function prForStartOf(repo: AzureRepo, pr: AzPr): PrForStart | null {\n const n = pr.pullRequestId;\n if (typeof n !== 'number') return null;\n return {\n number: n,\n title: pr.title ?? '',\n url: prWebUrl(repo, n),\n branch: branch(pr.sourceRefName),\n ...(pr.lastMergeSourceCommit?.commitId ? { headSha: pr.lastMergeSourceCommit.commitId } : {}),\n base: branch(pr.targetRefName),\n author: pr.createdBy?.uniqueName ?? '',\n state: prState(pr.status),\n ...(pr.forkSource ? { fork: { owner: pr.forkSource.repository?.project?.name ?? 'a fork' } } : {}),\n };\n}\n\nexport const RESOLVED_THREAD = new Set(['fixed', 'closed', 'wontFix', 'byDesign']);\n\n/** The PR's discussion threads as work's review feedback: people's comments only (Azure's own system notes left out). */\nexport function feedbackOf(repo: AzureRepo, prNumber: number, threads: AzThread[], viewer: string): ReviewFeedback {\n const out: ReviewThread[] = [];\n for (const t of threads) {\n if (typeof t.id !== 'number' || t.isDeleted) continue;\n const comments = (t.comments ?? []).filter((c) => !!c && !c.isDeleted && c.commentType !== 'system');\n if (!comments.length) continue;\n const url = `${prWebUrl(repo, prNumber)}?discussionId=${t.id}`;\n out.push({\n id: azureThreadId(repo, prNumber, t.id),\n isResolved: RESOLVED_THREAD.has(t.status ?? ''),\n isOutdated: false,\n path: t.threadContext?.filePath ? t.threadContext.filePath.replace(/^\\//, '') : null,\n line: t.threadContext?.rightFileEnd?.line ?? t.threadContext?.rightFileStart?.line ?? null,\n code: null,\n comments: comments.map((c) => ({\n id: `${t.id}-${c!.id ?? 0}`,\n author: c!.author?.uniqueName ?? c!.author?.displayName ?? 'unknown',\n // Azure DevOps has no \"association\": a commenter on a PR is in the organisation (its members are who can).\n association: 'MEMBER',\n body: c!.content ?? '',\n url,\n createdAt: c!.publishedDate ?? '',\n })),\n });\n }\n return { viewer, threads: out, reviews: [], comments: [] };\n}\n\n/**\n * A PR's discussion in work's host-neutral shape (#64): threads on a file's line are review threads (right side, or\n * left when only the old side is named), threads on no file are conversation comments, and each reviewer's vote is\n * their verdict (10 / 5 approved, −5 / −10 changes requested; 0 says nothing). Azure's own system notes (a vote cast,\n * a push) are left out, as are deleted threads and comments. Azure DevOps has no \"outdated\" and no association.\n */\nexport function discussionOf(repo: AzureRepo, prNumber: number, threads: AzThread[], pr: AzPr | null): PrDiscussion {\n const web = prWebUrl(repo, prNumber);\n const out: PrDiscussionThreadWire[] = [];\n const comments: PrDiscussionCommentWire[] = [];\n let more = false;\n for (const t of threads) {\n if (typeof t.id !== 'number' || t.isDeleted) continue;\n const people = (t.comments ?? []).filter((c) => !!c && !c.isDeleted && c.commentType !== 'system');\n if (!people.length) continue;\n const url = `${web}?discussionId=${t.id}`;\n const said = people.map((c): PrDiscussionCommentWire => ({\n author: c!.author?.uniqueName ?? c!.author?.displayName ?? 'unknown',\n body: discussionBody(c!.content),\n at: c!.publishedDate ?? '',\n url,\n }));\n const ctx = t.threadContext;\n if (!ctx?.filePath) {\n comments.push(...said);\n continue;\n }\n const right = ctx.rightFileEnd?.line ?? ctx.rightFileStart?.line ?? null;\n const left = ctx.leftFileEnd?.line ?? ctx.leftFileStart?.line ?? null;\n if (said.length > MAX_THREAD_COMMENTS) more = true;\n out.push({\n id: azureThreadId(repo, prNumber, t.id),\n path: ctx.filePath.replace(/^\\//, ''),\n line: right ?? left,\n side: right === null && left !== null ? 'left' : 'right',\n outdated: false,\n resolved: RESOLVED_THREAD.has(t.status ?? ''),\n url,\n comments: said.slice(0, MAX_THREAD_COMMENTS),\n });\n }\n const reviews = (pr?.reviewers ?? []).flatMap((r): PrDiscussionReviewWire[] => {\n const vote = r?.vote ?? 0;\n if (!r || !vote) return [];\n return [\n {\n author: r.uniqueName ?? r.displayName ?? 'unknown',\n state: vote > 0 ? 'approved' : 'changes-requested',\n body: '',\n at: '',\n url: web,\n },\n ];\n });\n return { threads: out, reviews, comments, ...(more ? { more: true as const } : {}) };\n}\n","import { originUrl, readGitConfig } from '../worktree/repo-scan.js';\nimport { configView } from '../platform/config-cache.js';\nimport { addCommands, DEFAULT_HOST } from './commands.js';\nimport { originHostname } from './origin-hostname.js';\nimport { github } from './github/adapter.js';\nimport { azure } from './azure/adapter.js';\nimport type { GitHost } from './types.js';\n\nexport type { GitHost } from './types.js';\nexport { DEFAULT_HOST } from './commands.js';\n\n/**\n * The hosts work knows, and which one a repo is on. Like the agent registry\n * (core/agents/index.ts): built-in adapters plus any registered at run time\n * (tests' fake host), looked up by id or by a repo's origin.\n *\n * A repo is on the host whose adapter claims its origin. Config `gitHosts`\n * names the host for an origin's hostname no adapter claims by its URL — for\n * a host that can work with such a server (one registered at run time; the\n * built-in Azure DevOps adapter reads only dev.azure.com and\n * visualstudio.com). A repo nobody claims — no origin, another server — is\n * asked as GitHub, as before hosts existed: `gh` itself says whether it\n * knows it, finding a GitHub Enterprise server from the repo's folder, so\n * GitHub Enterprise needs no entry (its PRs are listed per repo, the one\n * search being github.com's).\n */\n\nconst builtIn: GitHost[] = [github, azure];\nconst registered: GitHost[] = [];\n\n/** Every host: registered ones first (a test's fake host can claim an origin before GitHub's adapter does). */\nexport function knownHosts(): GitHost[] {\n return [...registered, ...builtIn];\n}\n\nexport function hostById(id: string | null | undefined): GitHost | null {\n return knownHosts().find((h) => h.id === id) ?? null;\n}\n\n/** The default host's adapter (GitHub). */\nexport function defaultHost(): GitHost {\n return hostById(DEFAULT_HOST) ?? github;\n}\n\n/** Add a host (a test's fake, a future adapter). Returns its removal. */\nexport function registerHost(host: GitHost): () => void {\n registered.unshift(host);\n const dropCommands = addCommands(host.id, host.commands);\n return () => {\n const i = registered.indexOf(host);\n if (i >= 0) registered.splice(i, 1);\n dropCommands();\n };\n}\n\n/** Config `gitHosts`: an origin hostname (lower case) → a host id. Bad entries are dropped. */\nconst overrides = configView((raw) => {\n const out = new Map<string, string>();\n const v = raw?.gitHosts;\n if (v && typeof v === 'object' && !Array.isArray(v))\n for (const [k, id] of Object.entries(v as Record<string, unknown>)) if (typeof id === 'string') out.set(k.toLowerCase(), id);\n return out;\n});\n\nexport { originHostname };\n\nexport interface HostLookupDeps {\n /** A repo's git config text (tests pass their own). */\n gitConfig?: (repoPath: string) => string | null;\n /** Config `gitHosts` (tests pass their own). */\n overrides?: () => Map<string, string>;\n}\n\n/** The host an origin is on: the config's word for its hostname, else the adapter that claims it, else the default. */\nexport function hostForOrigin(origin: string | null, deps: Pick<HostLookupDeps, 'overrides'> = {}): GitHost {\n if (origin) {\n const name = originHostname(origin);\n const named = name ? hostById((deps.overrides ?? overrides)().get(name)) : null;\n if (named) return named;\n const claimed = knownHosts().find((h) => h.matches(origin));\n if (claimed) return claimed;\n }\n return defaultHost();\n}\n\n/** The host a repo (or a worktree of it) is on, from its origin; with the origin, for the host's list. */\nexport function hostForRepo(repoPath: string, deps: HostLookupDeps = {}): { host: GitHost; origin: string | null } {\n const text = (deps.gitConfig ?? readGitConfig)(repoPath);\n const origin = text ? originUrl(text) : null;\n return { host: hostForOrigin(origin, deps), origin };\n}\n\n/** The host whose review-thread ids look like this one (ids are each host's own shape); null for none. */\nexport function hostOfThread(id: string): GitHost | null {\n return knownHosts().find((h) => h.threads.isId(id)) ?? null;\n}\n\n/** The host a pull request link is on, and the link read; null when no host reads it. */\nexport function hostOfPrUrl(text: string): { host: GitHost; link: NonNullable<ReturnType<GitHost['parsePrUrl']>> } | null {\n for (const host of knownHosts()) {\n const link = host.parsePrUrl(text);\n if (link) return { host, link };\n }\n return null;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKO,SAAS,eAAe,QAA+B;AAC5D,QAAM,IAAI,OAAO,KAAK;AACtB,QAAM,MAAM,+CAA+C,KAAK,CAAC;AACjE,MAAI,IAAK,QAAO,IAAI,CAAC,EAAE,YAAY;AACnC,QAAM,MAAM,iCAAiC,KAAK,CAAC;AACnD,SAAO,MAAM,IAAI,CAAC,EAAE,YAAY,IAAI;AACtC;;;ACXA,OAAOA,SAAQ;;;ACQR,IAAM,mBAAmB;AAGzB,SAAS,SAAS,QAAyB;AAChD,SAAO,4BAA4B,KAAK,MAAM;AAChD;AAGO,SAAS,aAAa,QAA+B;AAC1D,MAAI,CAAC,SAAS,MAAM,EAAG,QAAO;AAC9B,QAAM,IAAI,uCAAuC,KAAK,OAAO,KAAK,CAAC;AACnE,SAAO,IAAI,GAAG,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,GAAG,YAAY,IAAI;AAC/C;AAGO,SAAS,iBAAiB,MAA6B;AAC5D,QAAM,IAAI,0FAA0F,KAAK,KAAK,KAAK,CAAC;AACpH,MAAI,CAAC,EAAG,QAAO;AACf,QAAM,SAAS,OAAO,EAAE,CAAC,CAAC;AAC1B,SAAO;AAAA,IACL,QAAQ,GAAG,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,GAAG,YAAY;AAAA,IACtC;AAAA,IACA,KAAK,sBAAsB,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,SAAS,MAAM;AAAA,IACtD,OAAO,GAAG,EAAE,CAAC,CAAC,IAAI,MAAM;AAAA,EAC1B;AACF;;;ACjCA,SAAS,gBAAgB;;;ACsBlB,IAAM,mBAAmB,IAAI;AAEpC,IAAM,WAAW;AAOjB,IAAM,QAAQ,oBAAI,IAAmB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aAAa,eAAe,QAAQ;AACvD,QAAM,SAAS,OAAO,UAAU,IAAI,IAAI;AACxC,SAAO,EAAE,MAAM,cAAc,QAAQ,IAAI,GAAG,OAAO;AACrD;AAGO,SAAS,aAAa,IAA4B;AACvD,SAAO,WAAW,EAAE,KAAK,CAAC,MAAM,EAAE,QAAQ,KAAK,EAAE,CAAC,KAAK;AACzD;AAGO,SAAS,YAAY,MAA8F;AACxH,aAAW,QAAQ,WAAW,GAAG;AAC/B,UAAM,OAAO,KAAK,WAAW,IAAI;AACjC,QAAI,KAAM,QAAO,EAAE,MAAM,KAAK;AAAA,EAChC;AACA,SAAO;AACT;","names":["os","reviewDecision","onGithub","branch","comments","os","fs","os","path","policies","viewer","lower","fs","path","os","OPEN_PR_LIMIT","branch","vote"]}