@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.
- package/dist/{account-QSNXX5YV.js → account-QZH4MA42.js} +21 -21
- package/dist/{add-repo-YZ32MLZG.js → add-repo-CAQSJPLG.js} +17 -17
- package/dist/{answer-Y4T5X446.js → answer-3QIKCVON.js} +12 -12
- package/dist/{attach-XPYWYHDP.js → attach-GR3AD4D7.js} +19 -19
- package/dist/bin.js +5 -5
- package/dist/{block-JVAGG5QA.js → block-JFZ5RDO3.js} +15 -16
- package/dist/{block-JVAGG5QA.js.map → block-JFZ5RDO3.js.map} +1 -1
- package/dist/{broadcast-FATIANHX.js → broadcast-WW6DBVZ3.js} +10 -10
- package/dist/{catchup-OTI2KZG5.js → catchup-RMYAFVK3.js} +15 -15
- package/dist/{chunk-VV3NFLLP.js → chunk-26YZYL77.js} +3 -3
- package/dist/{chunk-UP2JTDBI.js → chunk-32VFZGPR.js} +3 -3
- package/dist/{chunk-ZRATYLBB.js → chunk-33XSEAHO.js} +2 -2
- package/dist/{chunk-E67DOUVU.js → chunk-3OAW37JA.js} +107 -18
- package/dist/chunk-3OAW37JA.js.map +1 -0
- package/dist/{chunk-27LWL6QE.js → chunk-3SBQIJQS.js} +468 -14
- package/dist/chunk-3SBQIJQS.js.map +1 -0
- package/dist/{chunk-MM7344RC.js → chunk-4CNBSPNL.js} +2 -2
- package/dist/{chunk-RHDZPV6C.js → chunk-4EL7FVQQ.js} +2 -2
- package/dist/{chunk-FMLE2WSN.js → chunk-4IRPL6XA.js} +2 -2
- package/dist/{chunk-BNKVENDF.js → chunk-4NUWTGAP.js} +5 -5
- package/dist/{chunk-46XSWHCQ.js → chunk-5E44Z6IL.js} +5 -4
- package/dist/chunk-5E44Z6IL.js.map +1 -0
- package/dist/{chunk-KL4YYV37.js → chunk-5FBRQW2F.js} +4 -4
- package/dist/{chunk-TKWUSJNQ.js → chunk-5LW5OJHH.js} +7 -9
- package/dist/{chunk-TKWUSJNQ.js.map → chunk-5LW5OJHH.js.map} +1 -1
- package/dist/{chunk-JNCKZ3OF.js → chunk-63FTAMDO.js} +4 -4
- package/dist/{chunk-WKOJ7NXD.js → chunk-6RMB3I3V.js} +4 -4
- package/dist/{chunk-6J6U7JXN.js → chunk-6YZBMC35.js} +3 -3
- package/dist/{chunk-3BSFVKMK.js → chunk-7DUGVGUZ.js} +2 -2
- package/dist/{chunk-IOHK45WE.js → chunk-7OFVXQSM.js} +2 -2
- package/dist/{chunk-34E2LA3M.js → chunk-A6N4FF4K.js} +5 -5
- package/dist/{chunk-IFQOOCT7.js → chunk-AOWYAOAX.js} +46 -24
- package/dist/chunk-AOWYAOAX.js.map +1 -0
- package/dist/{chunk-V4U5RGEG.js → chunk-BDPRYJL3.js} +3 -3
- package/dist/chunk-BDPRYJL3.js.map +1 -0
- package/dist/{chunk-4TTYEMOY.js → chunk-BM36OYVS.js} +14 -7
- package/dist/chunk-BM36OYVS.js.map +1 -0
- package/dist/{chunk-66VPQOVZ.js → chunk-C7CDET5W.js} +13 -10
- package/dist/chunk-C7CDET5W.js.map +1 -0
- package/dist/{chunk-RCGFHJM7.js → chunk-CBCOVIXZ.js} +2 -2
- package/dist/{chunk-ZXHMC7UO.js → chunk-D2J3AD6L.js} +3 -5
- package/dist/chunk-D2J3AD6L.js.map +1 -0
- package/dist/{chunk-ICXUTMGH.js → chunk-DGVCN7HB.js} +2 -2
- package/dist/{chunk-B5WDN63X.js → chunk-DMGNJ73M.js} +2 -2
- package/dist/{chunk-LZZCJAJQ.js → chunk-DTUKXBAR.js} +7 -7
- package/dist/{chunk-FKM67CZZ.js → chunk-FEL7UMIO.js} +7 -9
- package/dist/{chunk-FKM67CZZ.js.map → chunk-FEL7UMIO.js.map} +1 -1
- package/dist/chunk-FGPXMAYU.js +25 -0
- package/dist/chunk-FGPXMAYU.js.map +1 -0
- package/dist/{chunk-2K5TDJ7M.js → chunk-FI2HURCM.js} +5 -5
- package/dist/{chunk-2HHIDWHH.js → chunk-FJQT7OWV.js} +7 -7
- package/dist/{chunk-LKESANVD.js → chunk-FNA27U2B.js} +2 -2
- package/dist/{chunk-6YMLYU5G.js → chunk-FZJ472VJ.js} +7 -7
- package/dist/{chunk-ADIN3DTD.js → chunk-GG4VKPAX.js} +2 -2
- package/dist/{chunk-V7GCYL6A.js → chunk-GOK6JBB2.js} +6 -6
- package/dist/{chunk-IKX3B26P.js → chunk-GZYXCMJH.js} +4 -4
- package/dist/{chunk-VFH4SU3M.js → chunk-HRBAXQXF.js} +9 -9
- package/dist/{chunk-2VRZVUM7.js → chunk-ISE5VJP2.js} +6 -6
- package/dist/{chunk-OCMNBOPX.js → chunk-JVHHSKBJ.js} +2 -2
- package/dist/{chunk-3S6L437Q.js → chunk-K3H4EQHV.js} +4 -4
- package/dist/{chunk-KDO7D46L.js → chunk-KJRUC2QY.js} +3 -3
- package/dist/{chunk-Z6ZMWFNV.js → chunk-LA3X5A3U.js} +6 -8
- package/dist/{chunk-Z6ZMWFNV.js.map → chunk-LA3X5A3U.js.map} +1 -1
- package/dist/{chunk-PSUJZUYX.js → chunk-LM2T5OR3.js} +3 -2
- package/dist/{chunk-UBOKRHNV.js → chunk-MKJH2D4V.js} +2 -2
- package/dist/{chunk-NWOCQVSL.js → chunk-MR7XFKTK.js} +7 -7
- package/dist/{chunk-Z7I6DQAR.js → chunk-N4W34U3I.js} +42 -9
- package/dist/chunk-N4W34U3I.js.map +1 -0
- package/dist/{chunk-PCNNW63Z.js → chunk-NFWSJFYY.js} +2 -2
- package/dist/{chunk-TIG7NHVO.js → chunk-NKIZLEO2.js} +21 -9
- package/dist/chunk-NKIZLEO2.js.map +1 -0
- package/dist/{chunk-353ZINJ2.js → chunk-NXN7B3BE.js} +3 -3
- package/dist/{chunk-3XG23PLG.js → chunk-O36SFV5G.js} +13 -3
- package/dist/{chunk-3XG23PLG.js.map → chunk-O36SFV5G.js.map} +1 -1
- package/dist/{chunk-2MAZV5KS.js → chunk-O5ZJY5BT.js} +16 -3
- package/dist/chunk-O5ZJY5BT.js.map +1 -0
- package/dist/{chunk-WY7QZ2P7.js → chunk-O6UWELSS.js} +2 -2
- package/dist/{chunk-WVV54JP3.js → chunk-OAP7XYNK.js} +53 -53
- package/dist/{chunk-AHI2WVWP.js → chunk-OYLUYJTY.js} +8 -8
- package/dist/{chunk-PHGVVFTF.js → chunk-PJGAPVK4.js} +108 -133
- package/dist/chunk-PJGAPVK4.js.map +1 -0
- package/dist/{chunk-RJUMLWXP.js → chunk-PTYM27VH.js} +114 -18
- package/dist/chunk-PTYM27VH.js.map +1 -0
- package/dist/{chunk-Y7T73SAP.js → chunk-RUYTU2WJ.js} +7 -3
- package/dist/chunk-RUYTU2WJ.js.map +1 -0
- package/dist/{chunk-5R5JEQW7.js → chunk-SFMIDVB7.js} +17 -12
- package/dist/chunk-SFMIDVB7.js.map +1 -0
- package/dist/{chunk-GZGJQKQT.js → chunk-SKRVI3Z4.js} +2 -2
- package/dist/{chunk-E7WPTSHQ.js → chunk-UJ2GAHAZ.js} +11 -11
- package/dist/{chunk-4O4VQQEA.js → chunk-VJ5XMYXE.js} +3 -3
- package/dist/{chunk-IDQVTWLX.js → chunk-VRTOALU3.js} +5 -5
- package/dist/chunk-WAIFKHD6.js +9 -0
- package/dist/{chunk-LJKF73JB.js → chunk-WDL6ANZ3.js} +3 -3
- package/dist/{chunk-F3PEUOTP.js → chunk-WGKU5PPI.js} +2 -2
- package/dist/{chunk-JVBIWU7S.js → chunk-X5RHYVXY.js} +3 -3
- package/dist/{chunk-RQFHA5BM.js → chunk-YKQLHFY4.js} +43 -8
- package/dist/chunk-YKQLHFY4.js.map +1 -0
- package/dist/{chunk-FSQJOZS4.js → chunk-ZI7XN4VD.js} +9 -9
- package/dist/{cleanup-M5TY4FQS.js → cleanup-OMYTNUP4.js} +35 -35
- package/dist/{cli-446A536X.js → cli-G7EUXIPW.js} +5 -5
- package/dist/{command-hook-installer-7Q7UD7AU.js → command-hook-installer-GMQ4IVDE.js} +3 -3
- package/dist/{config-JLORGUXN.js → config-YO5QGP3B.js} +11 -11
- package/dist/{diff-4O5HXNZ7.js → diff-LIG47TN7.js} +12 -12
- package/dist/{digest-IAAZXJCC.js → digest-FMSWN4A6.js} +11 -11
- package/dist/{fork-ULJYPEKY.js → fork-A7U7AM4M.js} +32 -32
- package/dist/{history-JFZF22M7.js → history-NMHRGJ76.js} +9 -9
- package/dist/{hook-UYOIQVJ7.js → hook-NDETZUEC.js} +17 -17
- package/dist/{hydrate-DROI4RJ7.js → hydrate-ZTKYATH3.js} +10 -10
- package/dist/{init-FF75CQM7.js → init-MMJF5ZVJ.js} +16 -16
- package/dist/{install-skills-XSAHNBYD.js → install-skills-KS6N4U6L.js} +8 -8
- package/dist/install-skills-bin.js +7 -7
- package/dist/{list-5FEHBP6N.js → list-Z77M43EU.js} +9 -9
- package/dist/{move-422L6PPI.js → move-YQIYXSFQ.js} +20 -20
- package/dist/{note-AAXPD5VA.js → note-C5SVIML6.js} +13 -13
- package/dist/{overlaps-WPNUYOFF.js → overlaps-ARNCAXUT.js} +16 -16
- package/dist/{pin-QXPF23BB.js → pin-D4J3XXDU.js} +13 -13
- package/dist/{pr-QLGXPKPQ.js → pr-VMDNT4T7.js} +24 -24
- package/dist/{prune-GRHKRRVT.js → prune-XKMNAY7O.js} +33 -33
- package/dist/{pty-host-XDDXA4SL.js → pty-host-FVXJRFSL.js} +59 -21
- package/dist/pty-host-FVXJRFSL.js.map +1 -0
- package/dist/{read-YWKD2DGP.js → read-PWWKV66E.js} +12 -12
- package/dist/{recent-SI5BDVVH.js → recent-C4ZH75KK.js} +17 -17
- package/dist/{remove-RXXCHY44.js → remove-QFZ4YGVH.js} +32 -32
- package/dist/{restart-CPNDEXU6.js → restart-NZ2QYWA4.js} +12 -12
- package/dist/{resume-BLP4TTJK.js → resume-PRMBJOOG.js} +17 -17
- package/dist/{review-now-ADWZPELT.js → review-now-HHQIBVUS.js} +5 -5
- package/dist/{run-JFCDJ3EV.js → run-LUXAB6F5.js} +9 -9
- package/dist/{screen-LBOPAUXV.js → screen-PJJEEXVP.js} +12 -12
- package/dist/{search-AMEGRH24.js → search-4HW2HAPD.js} +9 -9
- package/dist/{section-73Z34PVE.js → section-PWWC2XPV.js} +13 -13
- package/dist/{send-IZBSEET5.js → send-JZMFXJ2B.js} +13 -13
- package/dist/{sessions-WVQ2U2W4.js → sessions-KQOSJ3OP.js} +28 -28
- package/dist/{snooze-7IBHY5MY.js → snooze-ZMYLNEVQ.js} +12 -12
- package/dist/{start-AU62TW6M.js → start-L2S4FTDD.js} +12 -12
- package/dist/{state-IZV7DAPL.js → state-BR43ONIH.js} +15 -6
- package/dist/state-BR43ONIH.js.map +1 -0
- package/dist/{status-Z7OMNYZX.js → status-N4WDRKZP.js} +14 -14
- package/dist/{statusline-VJFY7ZAB.js → statusline-WKKYCH7O.js} +5 -5
- package/dist/{statusline-hook-JA7MNE5H.js → statusline-hook-K7KPN2H6.js} +3 -3
- package/dist/{stop-PWNXSFBD.js → stop-IMXPEISI.js} +12 -12
- package/dist/{sync-2BTZVDDG.js → sync-5Q5FLL2B.js} +33 -33
- package/dist/{time-CTCIAXIY.js → time-ZK7RLSJI.js} +14 -14
- package/dist/{time-actions-UYBOXET6.js → time-actions-YOXF5WC7.js} +5 -5
- package/dist/{timesheet-BUFQ34FC.js → timesheet-73FNOA42.js} +16 -16
- package/dist/{todo-2R7VID57.js → todo-TALKJYK6.js} +5 -5
- package/dist/{tree-LQDPAXQA.js → tree-S2TMFTUZ.js} +32 -33
- package/dist/{tree-LQDPAXQA.js.map → tree-S2TMFTUZ.js.map} +1 -1
- package/dist/{update-2IYJHY7H.js → update-WZJ7B3QA.js} +19 -19
- package/dist/{usage-IR5GNF4R.js → usage-LQVXS6YO.js} +11 -11
- package/dist/{version-ONEI52TI.js → version-TVT6GSRF.js} +5 -5
- package/dist/{wait-6DH34L53.js → wait-AQGROBL7.js} +13 -13
- package/dist/wd-bin.js +4 -4
- package/dist/web/assets/PtyView-Bx7qpA8Y.js +96 -0
- package/dist/web/assets/PtyView-Bx7qpA8Y.js.map +1 -0
- package/dist/web/assets/index-CpqiTeqj.css +1 -0
- package/dist/web/assets/index-CxSvivCX.js +126 -0
- package/dist/web/assets/index-CxSvivCX.js.map +1 -0
- package/dist/web/index.html +2 -2
- package/dist/{web-RIHGV7YY.js → web-AKDU7HMP.js} +3735 -2713
- package/dist/web-AKDU7HMP.js.map +1 -0
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/dist/chunk-27LWL6QE.js.map +0 -1
- package/dist/chunk-2MAZV5KS.js.map +0 -1
- package/dist/chunk-46XSWHCQ.js.map +0 -1
- package/dist/chunk-4TTYEMOY.js.map +0 -1
- package/dist/chunk-5R5JEQW7.js.map +0 -1
- package/dist/chunk-66VPQOVZ.js.map +0 -1
- package/dist/chunk-7S2NQRWL.js +0 -9
- package/dist/chunk-AQP6SCCJ.js +0 -66
- package/dist/chunk-AQP6SCCJ.js.map +0 -1
- package/dist/chunk-E67DOUVU.js.map +0 -1
- package/dist/chunk-IFQOOCT7.js.map +0 -1
- package/dist/chunk-L22AWXWA.js +0 -29
- package/dist/chunk-L22AWXWA.js.map +0 -1
- package/dist/chunk-PHGVVFTF.js.map +0 -1
- package/dist/chunk-RJUMLWXP.js.map +0 -1
- package/dist/chunk-RQFHA5BM.js.map +0 -1
- package/dist/chunk-TIG7NHVO.js.map +0 -1
- package/dist/chunk-V4U5RGEG.js.map +0 -1
- package/dist/chunk-Y7T73SAP.js.map +0 -1
- package/dist/chunk-Z7I6DQAR.js.map +0 -1
- package/dist/chunk-ZXHMC7UO.js.map +0 -1
- package/dist/pty-host-XDDXA4SL.js.map +0 -1
- package/dist/state-IZV7DAPL.js.map +0 -1
- package/dist/web/assets/PtyView-kBcAOwHr.js +0 -96
- package/dist/web/assets/PtyView-kBcAOwHr.js.map +0 -1
- package/dist/web/assets/index-BgfR3N99.js +0 -124
- package/dist/web/assets/index-BgfR3N99.js.map +0 -1
- package/dist/web/assets/index-CKpHjII8.css +0 -1
- package/dist/web-RIHGV7YY.js.map +0 -1
- /package/dist/{account-QSNXX5YV.js.map → account-QZH4MA42.js.map} +0 -0
- /package/dist/{add-repo-YZ32MLZG.js.map → add-repo-CAQSJPLG.js.map} +0 -0
- /package/dist/{answer-Y4T5X446.js.map → answer-3QIKCVON.js.map} +0 -0
- /package/dist/{attach-XPYWYHDP.js.map → attach-GR3AD4D7.js.map} +0 -0
- /package/dist/{broadcast-FATIANHX.js.map → broadcast-WW6DBVZ3.js.map} +0 -0
- /package/dist/{catchup-OTI2KZG5.js.map → catchup-RMYAFVK3.js.map} +0 -0
- /package/dist/{chunk-VV3NFLLP.js.map → chunk-26YZYL77.js.map} +0 -0
- /package/dist/{chunk-UP2JTDBI.js.map → chunk-32VFZGPR.js.map} +0 -0
- /package/dist/{chunk-ZRATYLBB.js.map → chunk-33XSEAHO.js.map} +0 -0
- /package/dist/{chunk-MM7344RC.js.map → chunk-4CNBSPNL.js.map} +0 -0
- /package/dist/{chunk-RHDZPV6C.js.map → chunk-4EL7FVQQ.js.map} +0 -0
- /package/dist/{chunk-FMLE2WSN.js.map → chunk-4IRPL6XA.js.map} +0 -0
- /package/dist/{chunk-BNKVENDF.js.map → chunk-4NUWTGAP.js.map} +0 -0
- /package/dist/{chunk-KL4YYV37.js.map → chunk-5FBRQW2F.js.map} +0 -0
- /package/dist/{chunk-JNCKZ3OF.js.map → chunk-63FTAMDO.js.map} +0 -0
- /package/dist/{chunk-WKOJ7NXD.js.map → chunk-6RMB3I3V.js.map} +0 -0
- /package/dist/{chunk-6J6U7JXN.js.map → chunk-6YZBMC35.js.map} +0 -0
- /package/dist/{chunk-3BSFVKMK.js.map → chunk-7DUGVGUZ.js.map} +0 -0
- /package/dist/{chunk-IOHK45WE.js.map → chunk-7OFVXQSM.js.map} +0 -0
- /package/dist/{chunk-34E2LA3M.js.map → chunk-A6N4FF4K.js.map} +0 -0
- /package/dist/{chunk-RCGFHJM7.js.map → chunk-CBCOVIXZ.js.map} +0 -0
- /package/dist/{chunk-ICXUTMGH.js.map → chunk-DGVCN7HB.js.map} +0 -0
- /package/dist/{chunk-B5WDN63X.js.map → chunk-DMGNJ73M.js.map} +0 -0
- /package/dist/{chunk-LZZCJAJQ.js.map → chunk-DTUKXBAR.js.map} +0 -0
- /package/dist/{chunk-2K5TDJ7M.js.map → chunk-FI2HURCM.js.map} +0 -0
- /package/dist/{chunk-2HHIDWHH.js.map → chunk-FJQT7OWV.js.map} +0 -0
- /package/dist/{chunk-LKESANVD.js.map → chunk-FNA27U2B.js.map} +0 -0
- /package/dist/{chunk-6YMLYU5G.js.map → chunk-FZJ472VJ.js.map} +0 -0
- /package/dist/{chunk-ADIN3DTD.js.map → chunk-GG4VKPAX.js.map} +0 -0
- /package/dist/{chunk-V7GCYL6A.js.map → chunk-GOK6JBB2.js.map} +0 -0
- /package/dist/{chunk-IKX3B26P.js.map → chunk-GZYXCMJH.js.map} +0 -0
- /package/dist/{chunk-VFH4SU3M.js.map → chunk-HRBAXQXF.js.map} +0 -0
- /package/dist/{chunk-2VRZVUM7.js.map → chunk-ISE5VJP2.js.map} +0 -0
- /package/dist/{chunk-OCMNBOPX.js.map → chunk-JVHHSKBJ.js.map} +0 -0
- /package/dist/{chunk-3S6L437Q.js.map → chunk-K3H4EQHV.js.map} +0 -0
- /package/dist/{chunk-KDO7D46L.js.map → chunk-KJRUC2QY.js.map} +0 -0
- /package/dist/{chunk-PSUJZUYX.js.map → chunk-LM2T5OR3.js.map} +0 -0
- /package/dist/{chunk-UBOKRHNV.js.map → chunk-MKJH2D4V.js.map} +0 -0
- /package/dist/{chunk-NWOCQVSL.js.map → chunk-MR7XFKTK.js.map} +0 -0
- /package/dist/{chunk-PCNNW63Z.js.map → chunk-NFWSJFYY.js.map} +0 -0
- /package/dist/{chunk-353ZINJ2.js.map → chunk-NXN7B3BE.js.map} +0 -0
- /package/dist/{chunk-WY7QZ2P7.js.map → chunk-O6UWELSS.js.map} +0 -0
- /package/dist/{chunk-WVV54JP3.js.map → chunk-OAP7XYNK.js.map} +0 -0
- /package/dist/{chunk-AHI2WVWP.js.map → chunk-OYLUYJTY.js.map} +0 -0
- /package/dist/{chunk-GZGJQKQT.js.map → chunk-SKRVI3Z4.js.map} +0 -0
- /package/dist/{chunk-E7WPTSHQ.js.map → chunk-UJ2GAHAZ.js.map} +0 -0
- /package/dist/{chunk-4O4VQQEA.js.map → chunk-VJ5XMYXE.js.map} +0 -0
- /package/dist/{chunk-IDQVTWLX.js.map → chunk-VRTOALU3.js.map} +0 -0
- /package/dist/{chunk-7S2NQRWL.js.map → chunk-WAIFKHD6.js.map} +0 -0
- /package/dist/{chunk-LJKF73JB.js.map → chunk-WDL6ANZ3.js.map} +0 -0
- /package/dist/{chunk-F3PEUOTP.js.map → chunk-WGKU5PPI.js.map} +0 -0
- /package/dist/{chunk-JVBIWU7S.js.map → chunk-X5RHYVXY.js.map} +0 -0
- /package/dist/{chunk-FSQJOZS4.js.map → chunk-ZI7XN4VD.js.map} +0 -0
- /package/dist/{cleanup-M5TY4FQS.js.map → cleanup-OMYTNUP4.js.map} +0 -0
- /package/dist/{cli-446A536X.js.map → cli-G7EUXIPW.js.map} +0 -0
- /package/dist/{command-hook-installer-7Q7UD7AU.js.map → command-hook-installer-GMQ4IVDE.js.map} +0 -0
- /package/dist/{config-JLORGUXN.js.map → config-YO5QGP3B.js.map} +0 -0
- /package/dist/{diff-4O5HXNZ7.js.map → diff-LIG47TN7.js.map} +0 -0
- /package/dist/{digest-IAAZXJCC.js.map → digest-FMSWN4A6.js.map} +0 -0
- /package/dist/{fork-ULJYPEKY.js.map → fork-A7U7AM4M.js.map} +0 -0
- /package/dist/{history-JFZF22M7.js.map → history-NMHRGJ76.js.map} +0 -0
- /package/dist/{hook-UYOIQVJ7.js.map → hook-NDETZUEC.js.map} +0 -0
- /package/dist/{hydrate-DROI4RJ7.js.map → hydrate-ZTKYATH3.js.map} +0 -0
- /package/dist/{init-FF75CQM7.js.map → init-MMJF5ZVJ.js.map} +0 -0
- /package/dist/{install-skills-XSAHNBYD.js.map → install-skills-KS6N4U6L.js.map} +0 -0
- /package/dist/{list-5FEHBP6N.js.map → list-Z77M43EU.js.map} +0 -0
- /package/dist/{move-422L6PPI.js.map → move-YQIYXSFQ.js.map} +0 -0
- /package/dist/{note-AAXPD5VA.js.map → note-C5SVIML6.js.map} +0 -0
- /package/dist/{overlaps-WPNUYOFF.js.map → overlaps-ARNCAXUT.js.map} +0 -0
- /package/dist/{pin-QXPF23BB.js.map → pin-D4J3XXDU.js.map} +0 -0
- /package/dist/{pr-QLGXPKPQ.js.map → pr-VMDNT4T7.js.map} +0 -0
- /package/dist/{prune-GRHKRRVT.js.map → prune-XKMNAY7O.js.map} +0 -0
- /package/dist/{read-YWKD2DGP.js.map → read-PWWKV66E.js.map} +0 -0
- /package/dist/{recent-SI5BDVVH.js.map → recent-C4ZH75KK.js.map} +0 -0
- /package/dist/{remove-RXXCHY44.js.map → remove-QFZ4YGVH.js.map} +0 -0
- /package/dist/{restart-CPNDEXU6.js.map → restart-NZ2QYWA4.js.map} +0 -0
- /package/dist/{resume-BLP4TTJK.js.map → resume-PRMBJOOG.js.map} +0 -0
- /package/dist/{review-now-ADWZPELT.js.map → review-now-HHQIBVUS.js.map} +0 -0
- /package/dist/{run-JFCDJ3EV.js.map → run-LUXAB6F5.js.map} +0 -0
- /package/dist/{screen-LBOPAUXV.js.map → screen-PJJEEXVP.js.map} +0 -0
- /package/dist/{search-AMEGRH24.js.map → search-4HW2HAPD.js.map} +0 -0
- /package/dist/{section-73Z34PVE.js.map → section-PWWC2XPV.js.map} +0 -0
- /package/dist/{send-IZBSEET5.js.map → send-JZMFXJ2B.js.map} +0 -0
- /package/dist/{sessions-WVQ2U2W4.js.map → sessions-KQOSJ3OP.js.map} +0 -0
- /package/dist/{snooze-7IBHY5MY.js.map → snooze-ZMYLNEVQ.js.map} +0 -0
- /package/dist/{start-AU62TW6M.js.map → start-L2S4FTDD.js.map} +0 -0
- /package/dist/{status-Z7OMNYZX.js.map → status-N4WDRKZP.js.map} +0 -0
- /package/dist/{statusline-VJFY7ZAB.js.map → statusline-WKKYCH7O.js.map} +0 -0
- /package/dist/{statusline-hook-JA7MNE5H.js.map → statusline-hook-K7KPN2H6.js.map} +0 -0
- /package/dist/{stop-PWNXSFBD.js.map → stop-IMXPEISI.js.map} +0 -0
- /package/dist/{sync-2BTZVDDG.js.map → sync-5Q5FLL2B.js.map} +0 -0
- /package/dist/{time-CTCIAXIY.js.map → time-ZK7RLSJI.js.map} +0 -0
- /package/dist/{time-actions-UYBOXET6.js.map → time-actions-YOXF5WC7.js.map} +0 -0
- /package/dist/{timesheet-BUFQ34FC.js.map → timesheet-73FNOA42.js.map} +0 -0
- /package/dist/{todo-2R7VID57.js.map → todo-TALKJYK6.js.map} +0 -0
- /package/dist/{update-2IYJHY7H.js.map → update-WZJ7B3QA.js.map} +0 -0
- /package/dist/{usage-IR5GNF4R.js.map → usage-LQVXS6YO.js.map} +0 -0
- /package/dist/{version-ONEI52TI.js.map → version-TVT6GSRF.js.map} +0 -0
- /package/dist/{wait-6DH34L53.js.map → wait-AQGROBL7.js.map} +0 -0
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
parsePrLink
|
|
4
|
-
} from "./chunk-L22AWXWA.js";
|
|
5
2
|
import {
|
|
6
3
|
describeProcess,
|
|
7
4
|
findHolders,
|
|
@@ -14,11 +11,7 @@ import {
|
|
|
14
11
|
import {
|
|
15
12
|
hostForOrigin,
|
|
16
13
|
hostOfPrUrl
|
|
17
|
-
} from "./chunk-
|
|
18
|
-
import {
|
|
19
|
-
DEFAULT_HOST,
|
|
20
|
-
commandsFor
|
|
21
|
-
} from "./chunk-AQP6SCCJ.js";
|
|
14
|
+
} from "./chunk-PJGAPVK4.js";
|
|
22
15
|
import {
|
|
23
16
|
originUrl,
|
|
24
17
|
readGitConfig
|
|
@@ -26,6 +19,11 @@ import {
|
|
|
26
19
|
import {
|
|
27
20
|
defaultRunner
|
|
28
21
|
} from "./chunk-KSVYR4G2.js";
|
|
22
|
+
import {
|
|
23
|
+
DEFAULT_HOST,
|
|
24
|
+
commandsFor,
|
|
25
|
+
parsePrLink
|
|
26
|
+
} from "./chunk-3SBQIJQS.js";
|
|
29
27
|
|
|
30
28
|
// src/core/archive/restore-leftovers.ts
|
|
31
29
|
function leftoversOf(paths) {
|
|
@@ -157,4 +155,4 @@ export {
|
|
|
157
155
|
workOnPrPrompt,
|
|
158
156
|
resolvePrToStart
|
|
159
157
|
};
|
|
160
|
-
//# sourceMappingURL=chunk-
|
|
158
|
+
//# sourceMappingURL=chunk-FEL7UMIO.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/core/archive/restore-leftovers.ts","../src/core/pr/pr-ref.ts","../src/core/pr/pr-start.ts"],"sourcesContent":["import { isLeftover } from '../worktree/leftover.js';\nimport { describeProcess, findHolders, normDir, stopRunningFrom, type Holders } from '../platform/running-from.js';\n\n/**\n * Before a Restore makes a worktree again over what git left of it (a folder\n * it removed only in part, leftover.ts): that folder has to be moved out of\n * the way, and can't be while something runs from it — a dev server its\n * Claude left running. One place for both front-ends: the dashboard's\n * Restore (which asks \"Stop it and restore?\") and `work tree` (which says\n * what to stop).\n */\n\nexport interface LeftoverIo {\n /** What runs from or names the folders (running-from.ts). */\n holders?: (dirs: string[]) => Promise<Holders>;\n /** Stop what runs from them, saying what. */\n stop?: (dirs: string[]) => Promise<string[]>;\n}\n\n/** The session's folders git removed only in part. */\nexport function leftoversOf(paths: string[]): string[] {\n return paths.filter((p) => isLeftover(p));\n}\n\nconst names = (procs: Holders['stoppable'], dirs: string[]) =>\n procs.map((p) =>\n describeProcess(\n p,\n dirs.map((d) => normDir(d)),\n ),\n );\n\n/** What runs from the leftovers, and what has them open: one look at the processes (null: no answer). */\nexport async function lookAtLeftovers(leftovers: string[], io: LeftoverIo = {}): Promise<{ running: string[]; open: string[] } | null> {\n if (leftovers.length === 0) return { running: [], open: [] };\n const h = await (io.holders ?? ((d: string[]) => findHolders(d)))(leftovers).catch(() => null);\n if (!h) return null;\n const running = names(h.stoppable, leftovers);\n return { running, open: [...running, ...names(h.others, leftovers)] };\n}\n\n/** What runs from the leftovers now (\"node …\\vite\\bin\\vite.js --mode demo (PID 35464)\"): none to wait for, []. */\nexport async function runningFromLeftovers(leftovers: string[], io: LeftoverIo = {}): Promise<string[]> {\n return (await lookAtLeftovers(leftovers, io))?.running ?? [];\n}\n\n/** Stop what runs from the leftovers (asked for), saying what. */\nexport async function freeLeftovers(leftovers: string[], io: LeftoverIo = {}): Promise<string[]> {\n if (leftovers.length === 0) return [];\n return (io.stop ?? ((d: string[]) => stopRunningFrom(d)))(leftovers).catch(() => []);\n}\n\n/** Everything that has the leftovers open — what runs from them and what only names them (an editor) — for a failure's message. */\nexport async function openInLeftovers(leftovers: string[], io: LeftoverIo = {}): Promise<string[]> {\n return (await lookAtLeftovers(leftovers, io))?.open ?? [];\n}\n","/**\n * Starting a session on someone else's pull request — on their branch, so\n * what you push lands in their PR. Pure (the SPA and the demo use it): how a\n * PR is named, and what its session's Claude is told first. The lookup\n * (the repo's host) is `pr-start.ts`.\n */\n\nimport type { PrToStart } from '../api-types.js';\nimport { commandsFor, DEFAULT_HOST } from '../hosts/commands.js';\nimport { parsePrLink } from '../hosts/links.js';\n\nexport type { PrToStart };\n\n/** A PR as you'd name it: its link (repo known), or its number (in a repo you pick). */\nexport interface PrRef {\n /** The repo's id on its host, from a link (GitHub: `owner/name`, lowercase). */\n repo?: string;\n /** The host a link is on. */\n host?: string;\n number: number;\n}\n\n/** A PR link of a host work knows (any tail), `#123` or `123`; null for anything else. */\nexport function parsePrRef(input: string): PrRef | null {\n const s = input.trim();\n const link = parsePrLink(s);\n if (link) return { repo: link.repoId, ...(link.host === DEFAULT_HOST ? {} : { host: link.host }), number: link.number };\n const n = /^#?(\\d+)$/.exec(s);\n return n && Number(n[1]) > 0 ? { number: Number(n[1]) } : null;\n}\n\n/**\n * The first message to the session's Claude: whose PR this is, that what it\n * pushes lands there, and to get up to speed — then do `instruction`, or\n * with none, say where it stands and wait for what the user wants. Nothing\n * on the host (no comments, reviews or replies): that's the author's\n * conversation. Its commands are the PR's host's (`host`; GitHub's when absent).\n */\nexport function workOnPrPrompt(\n pr: Pick<PrToStart, 'number' | 'title' | 'url'> & { author?: string; host?: string },\n instruction?: string,\n): string {\n const cmd = commandsFor(pr.host);\n const who = pr.author ? `@${pr.author}` : 'its author';\n const todo = instruction?.trim();\n const upToSpeed = `Get up to speed first (${cmd.view(pr.number)}, ${cmd.diff(pr.number)})`;\n return [\n `Work on PR #${pr.number} by ${who}: ${pr.title}`,\n pr.url,\n '',\n `This worktree is on ${who}'s branch: what you commit and push lands in their PR.`,\n ...(todo ? [`${upToSpeed}, then:`, '', todo, ''] : [`${upToSpeed}, tell me where it stands, and wait for what I want done.`]),\n `Don't post on ${cmd.host} (no comments, reviews or replies).`,\n ].join('\\n');\n}\n","import type { WorkConfig } from '../platform/config.js';\nimport { originUrl, readGitConfig } from '../worktree/repo-scan.js';\nimport { parsePrRef, type PrRef, type PrToStart } from './pr-ref.js';\nimport { defaultRunner, type CommandRunner } from './ship.js';\nimport { DEFAULT_HOST, hostForOrigin, hostOfPrUrl } from '../hosts/index.js';\n\nexport type PrStartResult = { ok: true; pr: PrToStart } | { ok: false; error: string };\n\nexport interface PrStartDeps {\n run?: CommandRunner;\n /** A repo's `.git/config` text (tests pass their own). */\n gitConfig?: (repoPath: string) => string | null;\n}\n\n/**\n * Which of your repos a PR is in, and its branch: from its link (the repo\n * matched by its origin) or its number (in `target`, a repo). Refused: a\n * repo you haven't enrolled, a group as the repo of a bare number, a PR\n * that isn't open, and one from a fork — its branch isn't on origin, so the\n * session couldn't push to it (and `work tree` would make a new, empty\n * branch of that name instead).\n */\nexport async function resolvePrToStart(\n input: string,\n config: Pick<WorkConfig, 'repos' | 'groups'>,\n target?: string,\n deps: PrStartDeps = {},\n): Promise<PrStartResult> {\n const run = deps.run ?? defaultRunner;\n const gitConfig = deps.gitConfig ?? readGitConfig;\n // A link any host reads (one registered at run time too), else a number.\n const linked = hostOfPrUrl(input);\n const ref: PrRef | null = linked ? { repo: linked.link.repoId, host: linked.host.id, number: linked.link.number } : parsePrRef(input);\n if (!ref) return { ok: false, error: 'Give a pull request link (as your browser shows it), or its number with a repo.' };\n\n // Each repo on its own host (its origin's), with its id there.\n const repoOf = (alias: string) => {\n const origin = originUrl(gitConfig(config.repos[alias]) ?? '');\n const host = hostForOrigin(origin);\n return { host, id: origin ? host.repoId(origin) : null };\n };\n let alias: string | undefined;\n if (ref.repo) {\n const matches = Object.keys(config.repos).filter((a) => {\n const r = repoOf(a);\n return r.id === ref.repo && (!ref.host || r.host.id === ref.host);\n });\n if (!matches.length) return { ok: false, error: `${ref.repo} isn't one of your repos: add it first (work config add <alias> <path>).` };\n // A target named beside a link must hold it: the repo itself, or a group with it among its repos.\n const within = target ? (config.groups?.[target] ?? [target]) : matches;\n alias = matches.find((a) => within.includes(a));\n if (!alias) return { ok: false, error: `PR #${ref.number} is in ${matches.join(' / ')} (${ref.repo}), not ${target}.` };\n } else {\n if (!target) return { ok: false, error: `PR #${ref.number}: which repo? Give its link, or pick the repo.` };\n if (config.groups?.[target])\n return { ok: false, error: `${target} is a group: a PR is one repo's. Give its link, or one of the group's repos.` };\n if (!config.repos[target]) return { ok: false, error: `${target} isn't one of your repos.` };\n alias = target;\n }\n const { host, id: repoId } = repoOf(alias);\n if (!repoId) {\n return { ok: false, error: `${alias}'s origin isn't a ${host.name} repo work can read: it can only look up PRs on a host it knows.` };\n }\n\n const view = await host.prByNumber(run, config.repos[alias], repoId, ref.number);\n if (!view.ok) return { ok: false, error: view.error };\n const pr = view.pr;\n if (pr.state && pr.state !== 'OPEN') return { ok: false, error: `PR #${ref.number} is ${pr.state.toLowerCase()}.` };\n if (pr.fork) {\n return {\n ok: false,\n error: `PR #${ref.number} comes from a fork (${pr.fork.owner}): its branch isn't on origin, so a session couldn't push to it.`,\n };\n }\n if (!pr.branch) return { ok: false, error: `PR #${ref.number}: ${host.cli.cmd} didn't say its branch.` };\n const stale = await localGoneOtherWay(run, config.repos[alias], pr.branch, pr.headSha);\n if (stale) return { ok: false, error: stale };\n return {\n ok: true,\n pr: {\n alias,\n number: pr.number,\n title: pr.title,\n url: pr.url,\n branch: pr.branch,\n base: pr.base,\n author: pr.author,\n // Absent for GitHub (the wire's default), so a reader from before hosts sees what it always did.\n ...(host.id === DEFAULT_HOST ? {} : { host: host.id }),\n },\n };\n}\n\n/**\n * `work tree` takes a local branch of that name over origin's, moving it\n * forward when it can. One that has gone another way than the PR (the author\n * force-pushed, or an unrelated branch of the same name) would open on the\n * wrong commits, and what's pushed from it wouldn't go. Ahead (your commits\n * on top) or behind (it fast-forwards) is fine; when git can't tell (no\n * fetch), the usual warning on entering is left to say it.\n */\nasync function localGoneOtherWay(run: CommandRunner, repoPath: string, branch: string, headOid?: string): Promise<string | null> {\n if (!headOid) return null;\n const local = await run('git', ['rev-parse', '--verify', '--quiet', `refs/heads/${branch}`], repoPath);\n if (local.code !== 0) return null;\n await run('git', ['fetch', '--quiet', 'origin', branch], repoPath);\n const contains = await run('git', ['merge-base', '--is-ancestor', headOid, `refs/heads/${branch}`], repoPath);\n if (contains.code === 0) return null;\n const behind = await run('git', ['merge-base', '--is-ancestor', `refs/heads/${branch}`, headOid], repoPath);\n if (behind.code !== 1 || contains.code !== 1) return null; // 1 = not an ancestor; anything else: git couldn't say\n return `Your local branch ${branch} and the PR's have gone separate ways (a force-push, or another branch of that name): rename yours (git branch -m ${branch} ${branch}-old) and try again, or go into its session as it is (work tree <repo> ${branch}).`;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoBO,SAAS,YAAY,OAA2B;AACrD,SAAO,MAAM,OAAO,CAAC,MAAM,WAAW,CAAC,CAAC;AAC1C;AAEA,IAAM,QAAQ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D,SAAO,qBAAqB,MAAM,qHAAqH,MAAM,IAAI,MAAM,0EAA0E,MAAM;AACzP;","names":["alias","host"]}
|
|
1
|
+
{"version":3,"sources":["../src/core/archive/restore-leftovers.ts","../src/core/pr/pr-ref.ts","../src/core/pr/pr-start.ts"],"sourcesContent":["import { isLeftover } from '../worktree/leftover.js';\nimport { describeProcess, findHolders, normDir, stopRunningFrom, type Holders } from '../platform/running-from.js';\n\n/**\n * Before a Restore makes a worktree again over what git left of it (a folder\n * it removed only in part, leftover.ts): that folder has to be moved out of\n * the way, and can't be while something runs from it — a dev server its\n * Claude left running. One place for both front-ends: the dashboard's\n * Restore (which asks \"Stop it and restore?\") and `work tree` (which says\n * what to stop).\n */\n\nexport interface LeftoverIo {\n /** What runs from or names the folders (running-from.ts). */\n holders?: (dirs: string[]) => Promise<Holders>;\n /** Stop what runs from them, saying what. */\n stop?: (dirs: string[]) => Promise<string[]>;\n}\n\n/** The session's folders git removed only in part. */\nexport function leftoversOf(paths: string[]): string[] {\n return paths.filter((p) => isLeftover(p));\n}\n\nconst names = (procs: Holders['stoppable'], dirs: string[]) =>\n procs.map((p) =>\n describeProcess(\n p,\n dirs.map((d) => normDir(d)),\n ),\n );\n\n/** What runs from the leftovers, and what has them open: one look at the processes (null: no answer). */\nexport async function lookAtLeftovers(leftovers: string[], io: LeftoverIo = {}): Promise<{ running: string[]; open: string[] } | null> {\n if (leftovers.length === 0) return { running: [], open: [] };\n const h = await (io.holders ?? ((d: string[]) => findHolders(d)))(leftovers).catch(() => null);\n if (!h) return null;\n const running = names(h.stoppable, leftovers);\n return { running, open: [...running, ...names(h.others, leftovers)] };\n}\n\n/** What runs from the leftovers now (\"node …\\vite\\bin\\vite.js --mode demo (PID 35464)\"): none to wait for, []. */\nexport async function runningFromLeftovers(leftovers: string[], io: LeftoverIo = {}): Promise<string[]> {\n return (await lookAtLeftovers(leftovers, io))?.running ?? [];\n}\n\n/** Stop what runs from the leftovers (asked for), saying what. */\nexport async function freeLeftovers(leftovers: string[], io: LeftoverIo = {}): Promise<string[]> {\n if (leftovers.length === 0) return [];\n return (io.stop ?? ((d: string[]) => stopRunningFrom(d)))(leftovers).catch(() => []);\n}\n\n/** Everything that has the leftovers open — what runs from them and what only names them (an editor) — for a failure's message. */\nexport async function openInLeftovers(leftovers: string[], io: LeftoverIo = {}): Promise<string[]> {\n return (await lookAtLeftovers(leftovers, io))?.open ?? [];\n}\n","/**\n * Starting a session on someone else's pull request — on their branch, so\n * what you push lands in their PR. Pure (the SPA and the demo use it): how a\n * PR is named, and what its session's Claude is told first. The lookup\n * (the repo's host) is `pr-start.ts`.\n */\n\nimport type { PrToStart } from '../api-types.js';\nimport { commandsFor, DEFAULT_HOST } from '../hosts/commands.js';\nimport { parsePrLink } from '../hosts/links.js';\n\nexport type { PrToStart };\n\n/** A PR as you'd name it: its link (repo known), or its number (in a repo you pick). */\nexport interface PrRef {\n /** The repo's id on its host, from a link (GitHub: `owner/name`, lowercase). */\n repo?: string;\n /** The host a link is on. */\n host?: string;\n number: number;\n}\n\n/** A PR link of a host work knows (any tail), `#123` or `123`; null for anything else. */\nexport function parsePrRef(input: string): PrRef | null {\n const s = input.trim();\n const link = parsePrLink(s);\n if (link) return { repo: link.repoId, ...(link.host === DEFAULT_HOST ? {} : { host: link.host }), number: link.number };\n const n = /^#?(\\d+)$/.exec(s);\n return n && Number(n[1]) > 0 ? { number: Number(n[1]) } : null;\n}\n\n/**\n * The first message to the session's Claude: whose PR this is, that what it\n * pushes lands there, and to get up to speed — then do `instruction`, or\n * with none, say where it stands and wait for what the user wants. Nothing\n * on the host (no comments, reviews or replies): that's the author's\n * conversation. Its commands are the PR's host's (`host`; GitHub's when absent).\n */\nexport function workOnPrPrompt(\n pr: Pick<PrToStart, 'number' | 'title' | 'url'> & { author?: string; host?: string },\n instruction?: string,\n): string {\n const cmd = commandsFor(pr.host);\n const who = pr.author ? `@${pr.author}` : 'its author';\n const todo = instruction?.trim();\n const upToSpeed = `Get up to speed first (${cmd.view(pr.number)}, ${cmd.diff(pr.number)})`;\n return [\n `Work on PR #${pr.number} by ${who}: ${pr.title}`,\n pr.url,\n '',\n `This worktree is on ${who}'s branch: what you commit and push lands in their PR.`,\n ...(todo ? [`${upToSpeed}, then:`, '', todo, ''] : [`${upToSpeed}, tell me where it stands, and wait for what I want done.`]),\n `Don't post on ${cmd.host} (no comments, reviews or replies).`,\n ].join('\\n');\n}\n","import type { WorkConfig } from '../platform/config.js';\nimport { originUrl, readGitConfig } from '../worktree/repo-scan.js';\nimport { parsePrRef, type PrRef, type PrToStart } from './pr-ref.js';\nimport { defaultRunner, type CommandRunner } from './ship.js';\nimport { DEFAULT_HOST, hostForOrigin, hostOfPrUrl } from '../hosts/index.js';\n\nexport type PrStartResult = { ok: true; pr: PrToStart } | { ok: false; error: string };\n\nexport interface PrStartDeps {\n run?: CommandRunner;\n /** A repo's `.git/config` text (tests pass their own). */\n gitConfig?: (repoPath: string) => string | null;\n}\n\n/**\n * Which of your repos a PR is in, and its branch: from its link (the repo\n * matched by its origin) or its number (in `target`, a repo). Refused: a\n * repo you haven't enrolled, a group as the repo of a bare number, a PR\n * that isn't open, and one from a fork — its branch isn't on origin, so the\n * session couldn't push to it (and `work tree` would make a new, empty\n * branch of that name instead).\n */\nexport async function resolvePrToStart(\n input: string,\n config: Pick<WorkConfig, 'repos' | 'groups'>,\n target?: string,\n deps: PrStartDeps = {},\n): Promise<PrStartResult> {\n const run = deps.run ?? defaultRunner;\n const gitConfig = deps.gitConfig ?? readGitConfig;\n // A link any host reads (one registered at run time too), else a number.\n const linked = hostOfPrUrl(input);\n const ref: PrRef | null = linked ? { repo: linked.link.repoId, host: linked.host.id, number: linked.link.number } : parsePrRef(input);\n if (!ref) return { ok: false, error: 'Give a pull request link (as your browser shows it), or its number with a repo.' };\n\n // Each repo on its own host (its origin's), with its id there.\n const repoOf = (alias: string) => {\n const origin = originUrl(gitConfig(config.repos[alias]) ?? '');\n const host = hostForOrigin(origin);\n return { host, id: origin ? host.repoId(origin) : null };\n };\n let alias: string | undefined;\n if (ref.repo) {\n const matches = Object.keys(config.repos).filter((a) => {\n const r = repoOf(a);\n return r.id === ref.repo && (!ref.host || r.host.id === ref.host);\n });\n if (!matches.length) return { ok: false, error: `${ref.repo} isn't one of your repos: add it first (work config add <alias> <path>).` };\n // A target named beside a link must hold it: the repo itself, or a group with it among its repos.\n const within = target ? (config.groups?.[target] ?? [target]) : matches;\n alias = matches.find((a) => within.includes(a));\n if (!alias) return { ok: false, error: `PR #${ref.number} is in ${matches.join(' / ')} (${ref.repo}), not ${target}.` };\n } else {\n if (!target) return { ok: false, error: `PR #${ref.number}: which repo? Give its link, or pick the repo.` };\n if (config.groups?.[target])\n return { ok: false, error: `${target} is a group: a PR is one repo's. Give its link, or one of the group's repos.` };\n if (!config.repos[target]) return { ok: false, error: `${target} isn't one of your repos.` };\n alias = target;\n }\n const { host, id: repoId } = repoOf(alias);\n if (!repoId) {\n return { ok: false, error: `${alias}'s origin isn't a ${host.name} repo work can read: it can only look up PRs on a host it knows.` };\n }\n\n const view = await host.prByNumber(run, config.repos[alias], repoId, ref.number);\n if (!view.ok) return { ok: false, error: view.error };\n const pr = view.pr;\n if (pr.state && pr.state !== 'OPEN') return { ok: false, error: `PR #${ref.number} is ${pr.state.toLowerCase()}.` };\n if (pr.fork) {\n return {\n ok: false,\n error: `PR #${ref.number} comes from a fork (${pr.fork.owner}): its branch isn't on origin, so a session couldn't push to it.`,\n };\n }\n if (!pr.branch) return { ok: false, error: `PR #${ref.number}: ${host.cli.cmd} didn't say its branch.` };\n const stale = await localGoneOtherWay(run, config.repos[alias], pr.branch, pr.headSha);\n if (stale) return { ok: false, error: stale };\n return {\n ok: true,\n pr: {\n alias,\n number: pr.number,\n title: pr.title,\n url: pr.url,\n branch: pr.branch,\n base: pr.base,\n author: pr.author,\n // Absent for GitHub (the wire's default), so a reader from before hosts sees what it always did.\n ...(host.id === DEFAULT_HOST ? {} : { host: host.id }),\n },\n };\n}\n\n/**\n * `work tree` takes a local branch of that name over origin's, moving it\n * forward when it can. One that has gone another way than the PR (the author\n * force-pushed, or an unrelated branch of the same name) would open on the\n * wrong commits, and what's pushed from it wouldn't go. Ahead (your commits\n * on top) or behind (it fast-forwards) is fine; when git can't tell (no\n * fetch), the usual warning on entering is left to say it.\n */\nasync function localGoneOtherWay(run: CommandRunner, repoPath: string, branch: string, headOid?: string): Promise<string | null> {\n if (!headOid) return null;\n const local = await run('git', ['rev-parse', '--verify', '--quiet', `refs/heads/${branch}`], repoPath);\n if (local.code !== 0) return null;\n await run('git', ['fetch', '--quiet', 'origin', branch], repoPath);\n const contains = await run('git', ['merge-base', '--is-ancestor', headOid, `refs/heads/${branch}`], repoPath);\n if (contains.code === 0) return null;\n const behind = await run('git', ['merge-base', '--is-ancestor', `refs/heads/${branch}`, headOid], repoPath);\n if (behind.code !== 1 || contains.code !== 1) return null; // 1 = not an ancestor; anything else: git couldn't say\n return `Your local branch ${branch} and the PR's have gone separate ways (a force-push, or another branch of that name): rename yours (git branch -m ${branch} ${branch}-old) and try again, or go into its session as it is (work tree <repo> ${branch}).`;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoBO,SAAS,YAAY,OAA2B;AACrD,SAAO,MAAM,OAAO,CAAC,MAAM,WAAW,CAAC,CAAC;AAC1C;AAEA,IAAM,QAAQ,CAAC,OAA6B,SAC1C,MAAM;AAAA,EAAI,CAAC,MACT;AAAA,IACE;AAAA,IACA,KAAK,IAAI,CAAC,MAAM,QAAQ,CAAC,CAAC;AAAA,EAC5B;AACF;AAGF,eAAsB,gBAAgB,WAAqB,KAAiB,CAAC,GAA0D;AACrI,MAAI,UAAU,WAAW,EAAG,QAAO,EAAE,SAAS,CAAC,GAAG,MAAM,CAAC,EAAE;AAC3D,QAAM,IAAI,OAAO,GAAG,YAAY,CAAC,MAAgB,YAAY,CAAC,IAAI,SAAS,EAAE,MAAM,MAAM,IAAI;AAC7F,MAAI,CAAC,EAAG,QAAO;AACf,QAAM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ACJ,IAAI;AAAA,MACF;AAAA,MACA,QAAQ,GAAG;AAAA,MACX,OAAO,GAAG;AAAA,MACV,KAAK,GAAG;AAAA,MACR,QAAQ,GAAG;AAAA,MACX,MAAM,GAAG;AAAA,MACT,QAAQ,GAAG;AAAA;AAAA,MAEX,GAAI,KAAK,OAAO,eAAe,CAAC,IAAI,EAAE,MAAM,KAAK,GAAG;AAAA,IACtD;AAAA,EACF;AACF;AAUA,eAAe,kBAAkB,KAAoB,UAAkB,QAAgB,SAA0C;AAC/H,MAAI,CAAC,QAAS,QAAO;AACrB,QAAM,QAAQ,MAAM,IAAI,OAAO,CAAC,aAAa,YAAY,WAAW,cAAc,MAAM,EAAE,GAAG,QAAQ;AACrG,MAAI,MAAM,SAAS,EAAG,QAAO;AAC7B,QAAM,IAAI,OAAO,CAAC,SAAS,WAAW,UAAU,MAAM,GAAG,QAAQ;AACjE,QAAM,WAAW,MAAM,IAAI,OAAO,CAAC,cAAc,iBAAiB,SAAS,cAAc,MAAM,EAAE,GAAG,QAAQ;AAC5G,MAAI,SAAS,SAAS,EAAG,QAAO;AAChC,QAAM,SAAS,MAAM,IAAI,OAAO,CAAC,cAAc,iBAAiB,cAAc,MAAM,IAAI,OAAO,GAAG,QAAQ;AAC1G,MAAI,OAAO,SAAS,KAAK,SAAS,SAAS,EAAG,QAAO;AACrD,SAAO,qBAAqB,MAAM,qHAAqH,MAAM,IAAI,MAAM,0EAA0E,MAAM;AACzP;","names":["alias","host"]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// src/core/pr/review-types.ts
|
|
4
|
+
var MAX_THREAD_BODY = 8e3;
|
|
5
|
+
var MAX_HUNK = 12e3;
|
|
6
|
+
function threadCode(hunk, originalStartLine, originalLine, outdated) {
|
|
7
|
+
if (typeof hunk !== "string" || !hunk.startsWith("@@")) return null;
|
|
8
|
+
const end = typeof originalLine === "number" ? originalLine : null;
|
|
9
|
+
const start = typeof originalStartLine === "number" ? originalStartLine : end;
|
|
10
|
+
const lines = end !== null && start !== null && end >= start ? Math.min(end - start + 1, 200) : 1;
|
|
11
|
+
const kept = hunk.length > MAX_HUNK ? `${hunk.split("\n")[0]}
|
|
12
|
+
${hunk.slice(-MAX_HUNK).split("\n").slice(1).join("\n")}` : hunk;
|
|
13
|
+
return { hunk: kept, lines, ...outdated ? { outdated: true } : {} };
|
|
14
|
+
}
|
|
15
|
+
function isThreadCode(v) {
|
|
16
|
+
const c = v;
|
|
17
|
+
return !!c && typeof c === "object" && typeof c.hunk === "string" && c.hunk.startsWith("@@") && typeof c.lines === "number" && c.lines >= 1 && (c.outdated === void 0 || typeof c.outdated === "boolean");
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export {
|
|
21
|
+
MAX_THREAD_BODY,
|
|
22
|
+
threadCode,
|
|
23
|
+
isThreadCode
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=chunk-FGPXMAYU.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/core/pr/review-types.ts"],"sourcesContent":["import type { ThreadCode } from '../api-types.js';\n\n/**\n * A PR's review feedback as work keeps it, whatever host it came from: its\n * threads (resolved or not, with the code each is on), the reviews and the\n * conversation comments, and who you are. Pure; each host's adapter reads\n * its own API into these (GitHub's: core/hosts/github/review.ts).\n */\n\nexport interface ReviewComment {\n id: string;\n author: string;\n /** GitHub's authorAssociation: OWNER, MEMBER, COLLABORATOR, CONTRIBUTOR,\n * FIRST_TIME_CONTRIBUTOR, NONE, … */\n association: string;\n body: string;\n url: string;\n createdAt: string;\n}\nexport interface ReviewThread {\n id: string;\n isResolved: boolean;\n isOutdated: boolean;\n path: string | null;\n line: number | null;\n /** The code it's on (its first comment's diff hunk), when it's on a line. */\n code?: ThreadCode | null;\n comments: ReviewComment[];\n}\n\n/** The most of a comment kept for the dashboard (a review can paste a log): the rest is on GitHub. */\nexport const MAX_THREAD_BODY = 8000;\n/** The most of a diff hunk kept: its end is what matters, and the view shows only the last lines. */\nconst MAX_HUNK = 12_000;\n\n/** A thread's code from what GitHub gives (its first comment's hunk, the original line range); null when it has none. Pure. */\nexport function threadCode(hunk: unknown, originalStartLine: unknown, originalLine: unknown, outdated: boolean): ThreadCode | null {\n if (typeof hunk !== 'string' || !hunk.startsWith('@@')) return null;\n const end = typeof originalLine === 'number' ? originalLine : null;\n const start = typeof originalStartLine === 'number' ? originalStartLine : end;\n const lines = end !== null && start !== null && end >= start ? Math.min(end - start + 1, 200) : 1;\n // Too long: keep the header and the end (the commented line is the last).\n const kept = hunk.length > MAX_HUNK ? `${hunk.split('\\n')[0]}\\n${hunk.slice(-MAX_HUNK).split('\\n').slice(1).join('\\n')}` : hunk;\n return { hunk: kept, lines, ...(outdated ? { outdated: true } : {}) };\n}\n\n/** A stored thread code as written here; anything else is dropped. Pure. */\nexport function isThreadCode(v: unknown): v is ThreadCode {\n const c = v as Partial<ThreadCode> | null;\n return (\n !!c &&\n typeof c === 'object' &&\n typeof c.hunk === 'string' &&\n c.hunk.startsWith('@@') &&\n typeof c.lines === 'number' &&\n c.lines >= 1 &&\n (c.outdated === undefined || typeof c.outdated === 'boolean')\n );\n}\nexport interface ReviewFeedback {\n viewer: string;\n threads: ReviewThread[];\n /** Review summaries (APPROVED / CHANGES_REQUESTED / COMMENTED) with a body. */\n reviews: Array<ReviewComment & { state: string }>;\n /** Conversation (issue) comments on the PR. */\n comments: ReviewComment[];\n}\n"],"mappings":";;;AA+BO,IAAM,kBAAkB;AAE/B,IAAM,WAAW;AAGV,SAAS,WAAW,MAAe,mBAA4B,cAAuB,UAAsC;AACjI,MAAI,OAAO,SAAS,YAAY,CAAC,KAAK,WAAW,IAAI,EAAG,QAAO;AAC/D,QAAM,MAAM,OAAO,iBAAiB,WAAW,eAAe;AAC9D,QAAM,QAAQ,OAAO,sBAAsB,WAAW,oBAAoB;AAC1E,QAAM,QAAQ,QAAQ,QAAQ,UAAU,QAAQ,OAAO,QAAQ,KAAK,IAAI,MAAM,QAAQ,GAAG,GAAG,IAAI;AAEhG,QAAM,OAAO,KAAK,SAAS,WAAW,GAAG,KAAK,MAAM,IAAI,EAAE,CAAC,CAAC;AAAA,EAAK,KAAK,MAAM,CAAC,QAAQ,EAAE,MAAM,IAAI,EAAE,MAAM,CAAC,EAAE,KAAK,IAAI,CAAC,KAAK;AAC3H,SAAO,EAAE,MAAM,MAAM,OAAO,GAAI,WAAW,EAAE,UAAU,KAAK,IAAI,CAAC,EAAG;AACtE;AAGO,SAAS,aAAa,GAA6B;AACxD,QAAM,IAAI;AACV,SACE,CAAC,CAAC,KACF,OAAO,MAAM,YACb,OAAO,EAAE,SAAS,YAClB,EAAE,KAAK,WAAW,IAAI,KACtB,OAAO,EAAE,UAAU,YACnB,EAAE,SAAS,MACV,EAAE,aAAa,UAAa,OAAO,EAAE,aAAa;AAEvD;","names":[]}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
runInternal
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-A6N4FF4K.js";
|
|
5
5
|
import {
|
|
6
6
|
messageOf,
|
|
7
7
|
readStatus
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-3SBQIJQS.js";
|
|
9
9
|
import {
|
|
10
10
|
sessionIdFor
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-RUYTU2WJ.js";
|
|
12
12
|
import {
|
|
13
13
|
agentOf,
|
|
14
14
|
lineTimeOf,
|
|
15
15
|
readJsonlSince
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-N4W34U3I.js";
|
|
17
17
|
|
|
18
18
|
// src/core/conversations/catch-up-deps.ts
|
|
19
19
|
var askCatchUp = (prompt) => runInternal(prompt, 9e4);
|
|
@@ -100,4 +100,4 @@ export {
|
|
|
100
100
|
cachedCatchUp,
|
|
101
101
|
catchUp
|
|
102
102
|
};
|
|
103
|
-
//# sourceMappingURL=chunk-
|
|
103
|
+
//# sourceMappingURL=chunk-FI2HURCM.js.map
|
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
agentsBySession
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-32VFZGPR.js";
|
|
5
5
|
import {
|
|
6
6
|
legacyUnsafeCase
|
|
7
7
|
} from "./chunk-FZHFD2AY.js";
|
|
8
8
|
import {
|
|
9
9
|
findSession as findSession2
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-O6UWELSS.js";
|
|
11
11
|
import {
|
|
12
12
|
dbPtySessions
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-KJRUC2QY.js";
|
|
14
14
|
import {
|
|
15
15
|
clearLaunchedUnsafe,
|
|
16
16
|
findSession,
|
|
17
17
|
loadHistory
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-3SBQIJQS.js";
|
|
19
19
|
import {
|
|
20
20
|
sessionIdFor
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-RUYTU2WJ.js";
|
|
22
22
|
import {
|
|
23
23
|
liveAgents
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-N4W34U3I.js";
|
|
25
25
|
|
|
26
26
|
// src/core/sessions/legacy-unsafe-io.ts
|
|
27
27
|
function agentsOf(id, io) {
|
|
@@ -47,4 +47,4 @@ export {
|
|
|
47
47
|
legacyUnsafeCheck,
|
|
48
48
|
clearLaunchedUnsafeWhenIdle
|
|
49
49
|
};
|
|
50
|
-
//# sourceMappingURL=chunk-
|
|
50
|
+
//# sourceMappingURL=chunk-FJQT7OWV.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
writeTempTree
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-3SBQIJQS.js";
|
|
5
5
|
import {
|
|
6
6
|
git
|
|
7
7
|
} from "./chunk-DCCC7LEP.js";
|
|
@@ -534,4 +534,4 @@ export {
|
|
|
534
534
|
computeDiff,
|
|
535
535
|
computeRangeDiff
|
|
536
536
|
};
|
|
537
|
-
//# sourceMappingURL=chunk-
|
|
537
|
+
//# sourceMappingURL=chunk-FNA27U2B.js.map
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
createInProcess
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-WDL6ANZ3.js";
|
|
5
5
|
import {
|
|
6
6
|
ensurePty,
|
|
7
7
|
peekPty
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-SFMIDVB7.js";
|
|
9
9
|
import {
|
|
10
10
|
getCommentFileStore
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-7DUGVGUZ.js";
|
|
12
12
|
import {
|
|
13
13
|
checkedOutBranch,
|
|
14
14
|
recordedRepos,
|
|
15
15
|
sessionAliases
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-3SBQIJQS.js";
|
|
17
17
|
import {
|
|
18
18
|
sessionIdFor
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-RUYTU2WJ.js";
|
|
20
20
|
import {
|
|
21
21
|
resolveProjectTarget
|
|
22
22
|
} from "./chunk-4K4S53KX.js";
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
import {
|
|
28
28
|
DEFAULT_ACCOUNT,
|
|
29
29
|
loadConfig
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-O5ZJY5BT.js";
|
|
31
31
|
|
|
32
32
|
// src/core/sessions/fork.ts
|
|
33
33
|
import path from "path";
|
|
@@ -172,4 +172,4 @@ export {
|
|
|
172
172
|
uncommittedFiles,
|
|
173
173
|
defaultForkDeps
|
|
174
174
|
};
|
|
175
|
-
//# sourceMappingURL=chunk-
|
|
175
|
+
//# sourceMappingURL=chunk-FZJ472VJ.js.map
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
json,
|
|
7
7
|
tx,
|
|
8
8
|
withDb
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-RUYTU2WJ.js";
|
|
10
10
|
|
|
11
11
|
// src/core/jira/jira-worklog.ts
|
|
12
12
|
function worklogSettings(config, env = process.env) {
|
|
@@ -119,4 +119,4 @@ export {
|
|
|
119
119
|
logWorkDay,
|
|
120
120
|
jiraWorklogPoster
|
|
121
121
|
};
|
|
122
|
-
//# sourceMappingURL=chunk-
|
|
122
|
+
//# sourceMappingURL=chunk-GG4VKPAX.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
agentsBySession
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-32VFZGPR.js";
|
|
5
5
|
import {
|
|
6
6
|
accountSwitchRefusal,
|
|
7
7
|
haltPty,
|
|
@@ -9,20 +9,20 @@ import {
|
|
|
9
9
|
ptyPid,
|
|
10
10
|
ptyPids,
|
|
11
11
|
resumePtyOnAccount
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-SFMIDVB7.js";
|
|
13
13
|
import {
|
|
14
14
|
findSession
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-O6UWELSS.js";
|
|
16
16
|
import {
|
|
17
17
|
isArchiving,
|
|
18
18
|
loadHistory,
|
|
19
19
|
setSessionAccount
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-3SBQIJQS.js";
|
|
21
21
|
import {
|
|
22
22
|
AccountAdminError,
|
|
23
23
|
agentOf,
|
|
24
24
|
liveAgents
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-N4W34U3I.js";
|
|
26
26
|
import {
|
|
27
27
|
createRestarter
|
|
28
28
|
} from "./chunk-7QNVFVG6.js";
|
|
@@ -336,4 +336,4 @@ export {
|
|
|
336
336
|
createAccountLogins,
|
|
337
337
|
accountSkillsNote
|
|
338
338
|
};
|
|
339
|
-
//# sourceMappingURL=chunk-
|
|
339
|
+
//# sourceMappingURL=chunk-GOK6JBB2.js.map
|
|
@@ -2,17 +2,17 @@
|
|
|
2
2
|
import {
|
|
3
3
|
ensureHost,
|
|
4
4
|
probeHostDetailed
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-O36SFV5G.js";
|
|
6
6
|
import {
|
|
7
7
|
hostInfoPath,
|
|
8
8
|
readHostInfo
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-BDPRYJL3.js";
|
|
10
10
|
import {
|
|
11
11
|
agentFor,
|
|
12
12
|
agentSettings,
|
|
13
13
|
assistantAgent,
|
|
14
14
|
internalAgent
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-N4W34U3I.js";
|
|
16
16
|
import {
|
|
17
17
|
detachHere,
|
|
18
18
|
isPidAlive,
|
|
@@ -169,4 +169,4 @@ export {
|
|
|
169
169
|
restartHost,
|
|
170
170
|
ensureAgentPath
|
|
171
171
|
};
|
|
172
|
-
//# sourceMappingURL=chunk-
|
|
172
|
+
//# sourceMappingURL=chunk-GZYXCMJH.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
sessionFolderPath
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-JVHHSKBJ.js";
|
|
5
5
|
import {
|
|
6
6
|
isLeftover,
|
|
7
7
|
putLeftoverBack,
|
|
@@ -11,10 +11,10 @@ import {
|
|
|
11
11
|
import {
|
|
12
12
|
makeFolder,
|
|
13
13
|
worktreeFolderMessage
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-LM2T5OR3.js";
|
|
15
15
|
import {
|
|
16
16
|
recordCheckedOutBranches
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-3OAW37JA.js";
|
|
18
18
|
import {
|
|
19
19
|
isBuildOutputPath
|
|
20
20
|
} from "./chunk-I6MILNM5.js";
|
|
@@ -36,13 +36,13 @@ import {
|
|
|
36
36
|
upsertSession,
|
|
37
37
|
upsertSessionWithPort,
|
|
38
38
|
writeArchiveRecord
|
|
39
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-3SBQIJQS.js";
|
|
40
40
|
import {
|
|
41
41
|
sessionIdFor
|
|
42
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-RUYTU2WJ.js";
|
|
43
43
|
import {
|
|
44
44
|
agentFor
|
|
45
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-N4W34U3I.js";
|
|
46
46
|
import {
|
|
47
47
|
resolveProjectTarget
|
|
48
48
|
} from "./chunk-4K4S53KX.js";
|
|
@@ -60,10 +60,10 @@ import {
|
|
|
60
60
|
} from "./chunk-DCCC7LEP.js";
|
|
61
61
|
import {
|
|
62
62
|
DEFAULT_ACCOUNT
|
|
63
|
-
} from "./chunk-
|
|
63
|
+
} from "./chunk-O5ZJY5BT.js";
|
|
64
64
|
import {
|
|
65
65
|
atomicWriteFile
|
|
66
|
-
} from "./chunk-
|
|
66
|
+
} from "./chunk-D2J3AD6L.js";
|
|
67
67
|
import {
|
|
68
68
|
report
|
|
69
69
|
} from "./chunk-AU27USPZ.js";
|
|
@@ -1100,4 +1100,4 @@ export {
|
|
|
1100
1100
|
teardownWorktree,
|
|
1101
1101
|
openBaseCheckout
|
|
1102
1102
|
};
|
|
1103
|
-
//# sourceMappingURL=chunk-
|
|
1103
|
+
//# sourceMappingURL=chunk-HRBAXQXF.js.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
shownState
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-6RMB3I3V.js";
|
|
5
5
|
import {
|
|
6
6
|
recordCheckedOutBranches
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-3OAW37JA.js";
|
|
8
8
|
import {
|
|
9
9
|
defaultRunner
|
|
10
10
|
} from "./chunk-KSVYR4G2.js";
|
|
@@ -16,13 +16,13 @@ import {
|
|
|
16
16
|
readArchive,
|
|
17
17
|
sessionAliases,
|
|
18
18
|
setSessionBase
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-3SBQIJQS.js";
|
|
20
20
|
import {
|
|
21
21
|
sessionIdFor
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-RUYTU2WJ.js";
|
|
23
23
|
import {
|
|
24
24
|
loadConfig
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-O5ZJY5BT.js";
|
|
26
26
|
|
|
27
27
|
// src/core/stacks/session-update.ts
|
|
28
28
|
import path4 from "path";
|
|
@@ -426,4 +426,4 @@ export {
|
|
|
426
426
|
moveOntoMain,
|
|
427
427
|
updateSession
|
|
428
428
|
};
|
|
429
|
-
//# sourceMappingURL=chunk-
|
|
429
|
+
//# sourceMappingURL=chunk-ISE5VJP2.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
sessionIdFor
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-RUYTU2WJ.js";
|
|
5
5
|
|
|
6
6
|
// src/core/worktree/session-folder.ts
|
|
7
7
|
import path from "path";
|
|
@@ -30,4 +30,4 @@ export {
|
|
|
30
30
|
sessionFolderPath,
|
|
31
31
|
flatFolderOwner
|
|
32
32
|
};
|
|
33
|
-
//# sourceMappingURL=chunk-
|
|
33
|
+
//# sourceMappingURL=chunk-JVHHSKBJ.js.map
|
|
@@ -4,14 +4,14 @@ import {
|
|
|
4
4
|
} from "./chunk-AH5TM3NB.js";
|
|
5
5
|
import {
|
|
6
6
|
spawnSpecFor
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-SFMIDVB7.js";
|
|
8
8
|
import {
|
|
9
9
|
PtyHostClient,
|
|
10
10
|
ensureHost
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-O36SFV5G.js";
|
|
12
12
|
import {
|
|
13
13
|
sessionIdFor
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-RUYTU2WJ.js";
|
|
15
15
|
|
|
16
16
|
// src/commands/shared/attach-session.ts
|
|
17
17
|
import chalk from "chalk";
|
|
@@ -116,4 +116,4 @@ async function attachSession(session, launch = {}) {
|
|
|
116
116
|
export {
|
|
117
117
|
attachSession
|
|
118
118
|
};
|
|
119
|
-
//# sourceMappingURL=chunk-
|
|
119
|
+
//# sourceMappingURL=chunk-K3H4EQHV.js.map
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
import {
|
|
3
3
|
isPersistedPty,
|
|
4
4
|
ptySessionsPath
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-BDPRYJL3.js";
|
|
6
6
|
import {
|
|
7
7
|
json,
|
|
8
8
|
tx,
|
|
9
9
|
withDb
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-RUYTU2WJ.js";
|
|
11
11
|
|
|
12
12
|
// src/core/pty/pty-sessions-file.ts
|
|
13
13
|
import fs from "fs";
|
|
@@ -73,4 +73,4 @@ export {
|
|
|
73
73
|
adoptLegacyRestoreList,
|
|
74
74
|
forgetPersistedSession
|
|
75
75
|
};
|
|
76
|
-
//# sourceMappingURL=chunk-
|
|
76
|
+
//# sourceMappingURL=chunk-KJRUC2QY.js.map
|
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
parsePrLink
|
|
4
|
-
} from "./chunk-L22AWXWA.js";
|
|
5
2
|
import {
|
|
6
3
|
hostOfPrUrl
|
|
7
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-PJGAPVK4.js";
|
|
8
5
|
import {
|
|
9
|
-
loadHistory
|
|
10
|
-
|
|
6
|
+
loadHistory,
|
|
7
|
+
parsePrLink
|
|
8
|
+
} from "./chunk-3SBQIJQS.js";
|
|
11
9
|
import {
|
|
12
10
|
json,
|
|
13
11
|
sessionIdFor,
|
|
14
12
|
tx,
|
|
15
13
|
withDb
|
|
16
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-RUYTU2WJ.js";
|
|
17
15
|
|
|
18
16
|
// src/core/rail/blocks.ts
|
|
19
17
|
var MAX_BLOCKERS = 10;
|
|
@@ -166,4 +164,4 @@ export {
|
|
|
166
164
|
blockRefFrom,
|
|
167
165
|
blockedPrState
|
|
168
166
|
};
|
|
169
|
-
//# sourceMappingURL=chunk-
|
|
167
|
+
//# sourceMappingURL=chunk-LA3X5A3U.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/core/rail/blocks.ts","../src/core/rail/session-blocks.ts"],"sourcesContent":["/**\n * PURE — the \"blocked by\" rules (session-blocks.ts stores them), shared with\n * the demo; keep it free of anything but the hosts' pure link readers.\n */\n\nimport { parsePrLink } from '../hosts/links.js';\n\nexport type BlockRef =\n { kind: 'session'; id: string; label: string } | { kind: 'pr'; url: string; label: string; state?: 'OPEN' | 'MERGED' | 'CLOSED' };\n\nexport interface SessionBlock {\n by: BlockRef[];\n at: string;\n}\n\nexport const MAX_BLOCKERS = 10;\n\n/** A blocker's key: one per thing waited on. Pure. */\nexport const blockKey = (b: Pick<BlockRef, 'kind'> & { id?: string; url?: string }): string =>\n b.kind === 'session' ? `session:${b.id}` : `pr:${b.url}`;\n\n/** A pull request link of a host work knows, normalized (no trailing path, query or hash); null when it isn't one. Pure. */\nexport function prUrl(text: string): { url: string; label: string } | null {\n const t = text.trim();\n if (!/^https:\\/\\//i.test(t)) return null; // a link, as pasted from the browser\n const link = parsePrLink(t);\n return link ? { url: link.url, label: link.label } : null;\n}\n\n/** Is it done (so it no longer blocks)? `sessionGone(id)`: archived or deleted. Pure. */\nexport function blockerDone(b: BlockRef, sessionGone: (id: string) => boolean): boolean {\n return b.kind === 'session' ? sessionGone(b.id) : b.state === 'MERGED' || b.state === 'CLOSED';\n}\n\n/** What its Claude is told when the wait is over. Pure. */\nexport function unblockedPrompt(done: BlockRef[]): string {\n const what = done\n .map((b) => (b.kind === 'pr' ? `${b.label} (${b.state === 'CLOSED' ? 'closed, not merged' : 'merged'})` : `${b.label} (done)`))\n .join(', ');\n return `What this session was waiting on is done: ${what}. Bring the branch up to date if it needs the change (work update), then carry on. If something there changes the plan, start a line with DECISION NEEDED: and ask.`;\n}\n","import { json, tx, withDb } from '../platform/db.js';\nimport { prUrl } from './blocks.js';\nimport { hostOfPrUrl } from '../hosts/index.js';\nimport type { CommandRunner } from '../pr/ship.js';\nimport { sessionIdFor } from '../sessions/session-id.js';\nimport { loadHistory } from '../sessions/history.js';\nimport { blockerDone, blockKey, MAX_BLOCKERS, type BlockRef, type SessionBlock } from './blocks.js';\n\nexport { blockerDone, blockKey, prUrl, unblockedPrompt, MAX_BLOCKERS, type BlockRef, type SessionBlock } from './blocks.js';\n\n/**\n * \"Blocked by\": a session waiting on other work — another session (its\n * worktree), or a pull request by URL. While it waits it leaves the Inbox for\n * a \"Waiting on others\" section (a question from its Claude still shows:\n * that is never hidden). When everything it waits on is done — the session\n * archived or deleted, the PR merged or closed — the block clears itself,\n * you are told, and so is its Claude. state.db `session_blocks` (schema v7,\n * gone with the session).\n */\n\nfunction isRef(v: unknown): v is BlockRef {\n const o = v as Record<string, unknown> | null;\n if (!o || typeof o.label !== 'string') return false;\n if (o.kind === 'session') return typeof o.id === 'string';\n return o.kind === 'pr' && typeof o.url === 'string';\n}\n\nfunction asBlock(v: unknown): SessionBlock | null {\n const o = v as SessionBlock | null;\n if (!o || typeof o !== 'object' || !Array.isArray(o.by) || typeof o.at !== 'string') return null;\n const by = o.by.filter(isRef);\n return by.length ? { by, at: o.at } : null;\n}\n\nexport function readBlock(sessionId: string): SessionBlock | null {\n const row = withDb(\n (d) => d.prepare('SELECT data FROM session_blocks WHERE session_id = ?').get(sessionId) as { data: string } | undefined,\n );\n return row ? asBlock(json.parse(row.data)) : null;\n}\n\n/** Every session's block (the sessions list, the sweep: one query). */\nexport function allBlocks(): Map<string, SessionBlock> {\n const rows = withDb((d) => d.prepare('SELECT session_id, data FROM session_blocks').all() as Array<{ session_id: string; data: string }>);\n const out = new Map<string, SessionBlock>();\n for (const r of rows) {\n const b = asBlock(json.parse(r.data));\n if (b) out.set(r.session_id, b);\n }\n return out;\n}\n\n/** Add something it waits on (not itself; at most MAX_BLOCKERS; the same thing once). */\nexport function addBlocker(\n sessionId: string,\n ref: BlockRef,\n now = new Date(),\n): { ok: true; block: SessionBlock } | { ok: false; error: string } {\n if (ref.kind === 'session' && ref.id === sessionId) return { ok: false, error: 'a session cannot wait on itself' };\n return tx((d) => {\n // Waiting on one that (perhaps through others) waits on this one: neither would ever be let go.\n if (ref.kind === 'session') {\n const waitsOn = (id: string): string[] => {\n const row = d.prepare('SELECT data FROM session_blocks WHERE session_id = ?').get(id) as { data: string } | undefined;\n const b = row ? asBlock(json.parse(row.data)) : null;\n return (b?.by ?? []).flatMap((x) => (x.kind === 'session' ? [x.id] : []));\n };\n const seen = new Set<string>();\n for (let todo = [ref.id]; todo.length;) {\n const id = todo.pop()!;\n if (id === sessionId)\n return { ok: false as const, error: `${ref.label} already waits on this one: they would wait on each other for ever` };\n if (seen.has(id)) continue;\n seen.add(id);\n todo.push(...waitsOn(id));\n }\n }\n const row = d.prepare('SELECT data FROM session_blocks WHERE session_id = ?').get(sessionId) as { data: string } | undefined;\n const prev = row ? asBlock(json.parse(row.data)) : null;\n const by = (prev?.by ?? []).filter((b) => blockKey(b) !== blockKey(ref));\n if (by.length >= MAX_BLOCKERS) return { ok: false as const, error: `at most ${MAX_BLOCKERS} things to wait on` };\n const block = { by: [...by, ref], at: prev?.at ?? now.toISOString() };\n d.prepare('INSERT OR REPLACE INTO session_blocks (session_id, data) VALUES (?, ?)').run(sessionId, JSON.stringify(block));\n return { ok: true as const, block };\n });\n}\n\n/** Stop waiting on one thing (`key`), or on everything (no key). */\nexport function removeBlocker(sessionId: string, key?: string): SessionBlock | null {\n return tx((d) => {\n const row = d.prepare('SELECT data FROM session_blocks WHERE session_id = ?').get(sessionId) as { data: string } | undefined;\n const prev = row ? asBlock(json.parse(row.data)) : null;\n const by = key ? (prev?.by ?? []).filter((b) => blockKey(b) !== key) : [];\n if (by.length === 0) {\n d.prepare('DELETE FROM session_blocks WHERE session_id = ?').run(sessionId);\n return null;\n }\n const block = { by, at: prev!.at };\n d.prepare('INSERT OR REPLACE INTO session_blocks (session_id, data) VALUES (?, ?)').run(sessionId, JSON.stringify(block));\n return block;\n });\n}\n\n/** Record what a PR blocker's state is now (the sweep asks gh). */\nexport function setPrState(sessionId: string, url: string, state: 'OPEN' | 'MERGED' | 'CLOSED'): void {\n tx((d) => {\n const row = d.prepare('SELECT data FROM session_blocks WHERE session_id = ?').get(sessionId) as { data: string } | undefined;\n const prev = row ? asBlock(json.parse(row.data)) : null;\n if (!prev) return;\n const by = prev.by.map((b) => (b.kind === 'pr' && b.url === url ? { ...b, state } : b));\n d.prepare('INSERT OR REPLACE INTO session_blocks (session_id, data) VALUES (?, ?)').run(sessionId, JSON.stringify({ ...prev, by }));\n });\n}\n\nexport interface UnblockDeps {\n blocks: () => Map<string, SessionBlock>;\n /** Archived, or no longer a session. */\n sessionGone: (id: string) => boolean;\n /** A PR's state (gh pr view), null when gh can't say. */\n prState: (url: string) => Promise<'OPEN' | 'MERGED' | 'CLOSED' | null>;\n /** A session whose wait is over: told, and its Claude told. */\n unblocked: (sessionId: string, done: BlockRef[]) => Promise<void>;\n}\n\n/**\n * The sweep: ask about each PR waited on, and clear the blocks whose every\n * blocker is done. Returns the sessions unblocked.\n */\nexport async function sweepBlocks(deps: UnblockDeps): Promise<string[]> {\n const out: string[] = [];\n for (const [sessionId, block] of deps.blocks()) {\n if (deps.sessionGone(sessionId)) continue;\n for (const b of block.by) {\n if (b.kind !== 'pr' || b.state === 'MERGED' || b.state === 'CLOSED') continue;\n const st = await deps.prState(b.url).catch(() => null);\n if (st && st !== b.state) {\n setPrState(sessionId, b.url, st);\n b.state = st;\n }\n }\n if (block.by.every((b) => blockerDone(b, deps.sessionGone))) {\n // Only what this look found done: a blocker added meanwhile stays (and\n // the session with it), until a look finds that one done too.\n for (const b of block.by) removeBlocker(sessionId, blockKey(b));\n if (readBlock(sessionId)) continue;\n out.push(sessionId);\n await deps.unblocked(sessionId, block.by).catch(() => undefined);\n }\n }\n return out;\n}\n\n/** A request's blocker, checked: a live session (by id), or a pull request link of a host work knows. */\nexport function blockRefFrom(body: { kind?: unknown; id?: unknown; url?: unknown } | null): BlockRef | null {\n if (body?.kind === 'session' && typeof body.id === 'string') {\n const s = loadHistory().find((x) => sessionIdFor(x) === body.id && !x.archivedAt);\n return s ? { kind: 'session', id: body.id, label: s.title && s.title.trim() ? s.title : s.branch } : null;\n }\n if (body?.kind === 'pr' && typeof body.url === 'string') {\n // A built-in host's link, else one a registered host reads.\n const reg = prUrl(body.url) ? null : hostOfPrUrl(body.url);\n const pr = prUrl(body.url) ?? (reg ? { url: reg.link.url, label: reg.link.label } : null);\n return pr ? { kind: 'pr', url: pr.url, label: pr.label } : null;\n }\n return null;\n}\n\n/**\n * Where a \"blocked by\" PR stands, asked of the host its link is on: its\n * state; `rateLimited` when the host said its API limit is spent (the sweep\n * rests, as the PR watch does); null when it couldn't say.\n */\nexport async function blockedPrState(\n url: string,\n run: CommandRunner,\n): Promise<{ state: 'OPEN' | 'MERGED' | 'CLOSED' } | { rateLimited: true; host: string } | null> {\n const found = hostOfPrUrl(url);\n if (!found) return null;\n const r = await found.host.prState(run, url).catch(() => null);\n if (!r) return null;\n if (r.ok) return { state: r.state };\n return found.host.rateLimited(r.error) ? { rateLimited: true, host: found.host.name } : null;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAeO,IAAM,eAAe;AAGrB,IAAM,WAAW,CAA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,OAAO,IAAI;AAAA,EACvG;AACA,MAAI,MAAM,SAAS,QAAQ,OAAO,KAAK,QAAQ,UAAU;AAEvD,UAAM,MAAM,MAAM,KAAK,GAAG,IAAI,OAAO,YAAY,KAAK,GAAG;AACzD,UAAM,KAAK,MAAM,KAAK,GAAG,MAAM,MAAM,EAAE,KAAK,IAAI,KAAK,KAAK,OAAO,IAAI,KAAK,MAAM,IAAI;AACpF,WAAO,KAAK,EAAE,MAAM,MAAM,KAAK,GAAG,KAAK,OAAO,GAAG,MAAM,IAAI;AAAA,EAC7D;AACA,SAAO;AACT;AAOA,eAAsB,eACpB,KACA,KAC+F;AAC/F,QAAM,QAAQ,YAAY,GAAG;AAC7B,MAAI,CAAC,MAAO,QAAO;AACnB,QAAM,IAAI,MAAM,MAAM,KAAK,QAAQ,KAAK,GAAG,EAAE,MAAM,MAAM,IAAI;AAC7D,MAAI,CAAC,EAAG,QAAO;AACf,MAAI,EAAE,GAAI,QAAO,EAAE,OAAO,EAAE,MAAM;AAClC,SAAO,MAAM,KAAK,YAAY,EAAE,KAAK,IAAI,EAAE,aAAa,MAAM,MAAM,MAAM,KAAK,KAAK,IAAI;AAC1F;","names":["row"]}
|
|
1
|
+
{"version":3,"sources":["../src/core/rail/blocks.ts","../src/core/rail/session-blocks.ts"],"sourcesContent":["/**\n * PURE — the \"blocked by\" rules (session-blocks.ts stores them), shared with\n * the demo; keep it free of anything but the hosts' pure link readers.\n */\n\nimport { parsePrLink } from '../hosts/links.js';\n\nexport type BlockRef =\n { kind: 'session'; id: string; label: string } | { kind: 'pr'; url: string; label: string; state?: 'OPEN' | 'MERGED' | 'CLOSED' };\n\nexport interface SessionBlock {\n by: BlockRef[];\n at: string;\n}\n\nexport const MAX_BLOCKERS = 10;\n\n/** A blocker's key: one per thing waited on. Pure. */\nexport const blockKey = (b: Pick<BlockRef, 'kind'> & { id?: string; url?: string }): string =>\n b.kind === 'session' ? `session:${b.id}` : `pr:${b.url}`;\n\n/** A pull request link of a host work knows, normalized (no trailing path, query or hash); null when it isn't one. Pure. */\nexport function prUrl(text: string): { url: string; label: string } | null {\n const t = text.trim();\n if (!/^https:\\/\\//i.test(t)) return null; // a link, as pasted from the browser\n const link = parsePrLink(t);\n return link ? { url: link.url, label: link.label } : null;\n}\n\n/** Is it done (so it no longer blocks)? `sessionGone(id)`: archived or deleted. Pure. */\nexport function blockerDone(b: BlockRef, sessionGone: (id: string) => boolean): boolean {\n return b.kind === 'session' ? sessionGone(b.id) : b.state === 'MERGED' || b.state === 'CLOSED';\n}\n\n/** What its Claude is told when the wait is over. Pure. */\nexport function unblockedPrompt(done: BlockRef[]): string {\n const what = done\n .map((b) => (b.kind === 'pr' ? `${b.label} (${b.state === 'CLOSED' ? 'closed, not merged' : 'merged'})` : `${b.label} (done)`))\n .join(', ');\n return `What this session was waiting on is done: ${what}. Bring the branch up to date if it needs the change (work update), then carry on. If something there changes the plan, start a line with DECISION NEEDED: and ask.`;\n}\n","import { json, tx, withDb } from '../platform/db.js';\nimport { prUrl } from './blocks.js';\nimport { hostOfPrUrl } from '../hosts/index.js';\nimport type { CommandRunner } from '../pr/ship.js';\nimport { sessionIdFor } from '../sessions/session-id.js';\nimport { loadHistory } from '../sessions/history.js';\nimport { blockerDone, blockKey, MAX_BLOCKERS, type BlockRef, type SessionBlock } from './blocks.js';\n\nexport { blockerDone, blockKey, prUrl, unblockedPrompt, MAX_BLOCKERS, type BlockRef, type SessionBlock } from './blocks.js';\n\n/**\n * \"Blocked by\": a session waiting on other work — another session (its\n * worktree), or a pull request by URL. While it waits it leaves the Inbox for\n * a \"Waiting on others\" section (a question from its Claude still shows:\n * that is never hidden). When everything it waits on is done — the session\n * archived or deleted, the PR merged or closed — the block clears itself,\n * you are told, and so is its Claude. state.db `session_blocks` (schema v7,\n * gone with the session).\n */\n\nfunction isRef(v: unknown): v is BlockRef {\n const o = v as Record<string, unknown> | null;\n if (!o || typeof o.label !== 'string') return false;\n if (o.kind === 'session') return typeof o.id === 'string';\n return o.kind === 'pr' && typeof o.url === 'string';\n}\n\nfunction asBlock(v: unknown): SessionBlock | null {\n const o = v as SessionBlock | null;\n if (!o || typeof o !== 'object' || !Array.isArray(o.by) || typeof o.at !== 'string') return null;\n const by = o.by.filter(isRef);\n return by.length ? { by, at: o.at } : null;\n}\n\nexport function readBlock(sessionId: string): SessionBlock | null {\n const row = withDb(\n (d) => d.prepare('SELECT data FROM session_blocks WHERE session_id = ?').get(sessionId) as { data: string } | undefined,\n );\n return row ? asBlock(json.parse(row.data)) : null;\n}\n\n/** Every session's block (the sessions list, the sweep: one query). */\nexport function allBlocks(): Map<string, SessionBlock> {\n const rows = withDb((d) => d.prepare('SELECT session_id, data FROM session_blocks').all() as Array<{ session_id: string; data: string }>);\n const out = new Map<string, SessionBlock>();\n for (const r of rows) {\n const b = asBlock(json.parse(r.data));\n if (b) out.set(r.session_id, b);\n }\n return out;\n}\n\n/** Add something it waits on (not itself; at most MAX_BLOCKERS; the same thing once). */\nexport function addBlocker(\n sessionId: string,\n ref: BlockRef,\n now = new Date(),\n): { ok: true; block: SessionBlock } | { ok: false; error: string } {\n if (ref.kind === 'session' && ref.id === sessionId) return { ok: false, error: 'a session cannot wait on itself' };\n return tx((d) => {\n // Waiting on one that (perhaps through others) waits on this one: neither would ever be let go.\n if (ref.kind === 'session') {\n const waitsOn = (id: string): string[] => {\n const row = d.prepare('SELECT data FROM session_blocks WHERE session_id = ?').get(id) as { data: string } | undefined;\n const b = row ? asBlock(json.parse(row.data)) : null;\n return (b?.by ?? []).flatMap((x) => (x.kind === 'session' ? [x.id] : []));\n };\n const seen = new Set<string>();\n for (let todo = [ref.id]; todo.length;) {\n const id = todo.pop()!;\n if (id === sessionId)\n return { ok: false as const, error: `${ref.label} already waits on this one: they would wait on each other for ever` };\n if (seen.has(id)) continue;\n seen.add(id);\n todo.push(...waitsOn(id));\n }\n }\n const row = d.prepare('SELECT data FROM session_blocks WHERE session_id = ?').get(sessionId) as { data: string } | undefined;\n const prev = row ? asBlock(json.parse(row.data)) : null;\n const by = (prev?.by ?? []).filter((b) => blockKey(b) !== blockKey(ref));\n if (by.length >= MAX_BLOCKERS) return { ok: false as const, error: `at most ${MAX_BLOCKERS} things to wait on` };\n const block = { by: [...by, ref], at: prev?.at ?? now.toISOString() };\n d.prepare('INSERT OR REPLACE INTO session_blocks (session_id, data) VALUES (?, ?)').run(sessionId, JSON.stringify(block));\n return { ok: true as const, block };\n });\n}\n\n/** Stop waiting on one thing (`key`), or on everything (no key). */\nexport function removeBlocker(sessionId: string, key?: string): SessionBlock | null {\n return tx((d) => {\n const row = d.prepare('SELECT data FROM session_blocks WHERE session_id = ?').get(sessionId) as { data: string } | undefined;\n const prev = row ? asBlock(json.parse(row.data)) : null;\n const by = key ? (prev?.by ?? []).filter((b) => blockKey(b) !== key) : [];\n if (by.length === 0) {\n d.prepare('DELETE FROM session_blocks WHERE session_id = ?').run(sessionId);\n return null;\n }\n const block = { by, at: prev!.at };\n d.prepare('INSERT OR REPLACE INTO session_blocks (session_id, data) VALUES (?, ?)').run(sessionId, JSON.stringify(block));\n return block;\n });\n}\n\n/** Record what a PR blocker's state is now (the sweep asks gh). */\nexport function setPrState(sessionId: string, url: string, state: 'OPEN' | 'MERGED' | 'CLOSED'): void {\n tx((d) => {\n const row = d.prepare('SELECT data FROM session_blocks WHERE session_id = ?').get(sessionId) as { data: string } | undefined;\n const prev = row ? asBlock(json.parse(row.data)) : null;\n if (!prev) return;\n const by = prev.by.map((b) => (b.kind === 'pr' && b.url === url ? { ...b, state } : b));\n d.prepare('INSERT OR REPLACE INTO session_blocks (session_id, data) VALUES (?, ?)').run(sessionId, JSON.stringify({ ...prev, by }));\n });\n}\n\nexport interface UnblockDeps {\n blocks: () => Map<string, SessionBlock>;\n /** Archived, or no longer a session. */\n sessionGone: (id: string) => boolean;\n /** A PR's state (gh pr view), null when gh can't say. */\n prState: (url: string) => Promise<'OPEN' | 'MERGED' | 'CLOSED' | null>;\n /** A session whose wait is over: told, and its Claude told. */\n unblocked: (sessionId: string, done: BlockRef[]) => Promise<void>;\n}\n\n/**\n * The sweep: ask about each PR waited on, and clear the blocks whose every\n * blocker is done. Returns the sessions unblocked.\n */\nexport async function sweepBlocks(deps: UnblockDeps): Promise<string[]> {\n const out: string[] = [];\n for (const [sessionId, block] of deps.blocks()) {\n if (deps.sessionGone(sessionId)) continue;\n for (const b of block.by) {\n if (b.kind !== 'pr' || b.state === 'MERGED' || b.state === 'CLOSED') continue;\n const st = await deps.prState(b.url).catch(() => null);\n if (st && st !== b.state) {\n setPrState(sessionId, b.url, st);\n b.state = st;\n }\n }\n if (block.by.every((b) => blockerDone(b, deps.sessionGone))) {\n // Only what this look found done: a blocker added meanwhile stays (and\n // the session with it), until a look finds that one done too.\n for (const b of block.by) removeBlocker(sessionId, blockKey(b));\n if (readBlock(sessionId)) continue;\n out.push(sessionId);\n await deps.unblocked(sessionId, block.by).catch(() => undefined);\n }\n }\n return out;\n}\n\n/** A request's blocker, checked: a live session (by id), or a pull request link of a host work knows. */\nexport function blockRefFrom(body: { kind?: unknown; id?: unknown; url?: unknown } | null): BlockRef | null {\n if (body?.kind === 'session' && typeof body.id === 'string') {\n const s = loadHistory().find((x) => sessionIdFor(x) === body.id && !x.archivedAt);\n return s ? { kind: 'session', id: body.id, label: s.title && s.title.trim() ? s.title : s.branch } : null;\n }\n if (body?.kind === 'pr' && typeof body.url === 'string') {\n // A built-in host's link, else one a registered host reads.\n const reg = prUrl(body.url) ? null : hostOfPrUrl(body.url);\n const pr = prUrl(body.url) ?? (reg ? { url: reg.link.url, label: reg.link.label } : null);\n return pr ? { kind: 'pr', url: pr.url, label: pr.label } : null;\n }\n return null;\n}\n\n/**\n * Where a \"blocked by\" PR stands, asked of the host its link is on: its\n * state; `rateLimited` when the host said its API limit is spent (the sweep\n * rests, as the PR watch does); null when it couldn't say.\n */\nexport async function blockedPrState(\n url: string,\n run: CommandRunner,\n): Promise<{ state: 'OPEN' | 'MERGED' | 'CLOSED' } | { rateLimited: true; host: string } | null> {\n const found = hostOfPrUrl(url);\n if (!found) return null;\n const r = await found.host.prState(run, url).catch(() => null);\n if (!r) return null;\n if (r.ok) return { state: r.state };\n return found.host.rateLimited(r.error) ? { rateLimited: true, host: found.host.name } : null;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAeO,IAAM,eAAe;AAGrB,IAAM,WAAW,CAAC,MACvB,EAAE,SAAS,YAAY,WAAW,EAAE,EAAE,KAAK,MAAM,EAAE,GAAG;AAGjD,SAAS,MAAM,MAAqD;AACzE,QAAM,IAAI,KAAK,KAAK;AACpB,MAAI,CAAC,eAAe,KAAK,CAAC,EAAG,QAAO;AACpC,QAAM,OAAO,YAAY,CAAC;AAC1B,SAAO,OAAO,EAAE,KAAK,KAAK,KAAK,OAAO,KAAK,MAAM,IAAI;AACvD;AAGO,SAAS,YAAY,GAAa,aAA+C;AACtF,SAAO,EAAE,SAAS,YAAY,YAAY,EAAE,EAAE,IAAI,EAAE,UAAU,YAAY,EAAE,UAAU;AACxF;AAGO,SAAS,gBAAgB,MAA0B;AACxD,QAAM,OAAO,KACV,IAAI,CAAC,MAAO,EAAE,SAAS,OAAO,GAAG,EAAE,KAAK,KAAK,EAAE,UAAU,WAAW,uBAAuB,QAAQ,MAAM,GAAG,EAAE,KAAK,SAAU,EAC7H,KAAK,IAAI;AACZ,SAAO,6CAA6C,IAAI;AAC1D;;;ACpBA,SAAS,MAAM,GAA2B;AACxC,QAAM,IAAI;AACV,MAAI,CAAC,KAAK,OAAO,EAAE,UAAU,SAAU,QAAO;AAC9C,MAAI,EAAE,SAAS,UAAW,QAAO,OAAO,EAAE,OAAO;AACjD,SAAO,EAAE,SAAS,QAAQ,OAAO,EAAE,QAAQ;AAC7C;AAEA,SAAS,QAAQ,GAAiC;AAChD,QAAM,IAAI;AACV,MAAI,CAAC,KAAK,OAAO,MAAM,YAAY,CAAC,MAAM,QAAQ,EAAE,EAAE,KAAK,OAAO,EAAE,OAAO,SAAU,QAAO;AAC5F,QAAM,KAAK,EAAE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