@moberg_hr/work-tree 2.3.2 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -1
- package/dist/add-repo-5SYBDVG2.js +384 -0
- package/dist/add-repo-5SYBDVG2.js.map +1 -0
- package/dist/{answer-UWI22VOE.js → answer-OA2WTJCZ.js} +11 -11
- package/dist/{attach-HYHEXW5J.js → attach-5GXPA7BV.js} +14 -14
- package/dist/bin.js +5 -5
- package/dist/{block-A25XE7HC.js → block-VINEC2MW.js} +11 -11
- package/dist/{broadcast-AG7P5BKQ.js → broadcast-ENAJDNVU.js} +8 -8
- package/dist/{catchup-VTGG7BAR.js → catchup-NC4WHSBF.js} +14 -14
- package/dist/{chunk-XDBMLTFY.js → chunk-3HBHM2VX.js} +4 -4
- package/dist/chunk-3IOIY4W6.js +39 -0
- package/dist/chunk-3IOIY4W6.js.map +1 -0
- package/dist/{chunk-7OBX4MJY.js → chunk-3KOYICWB.js} +4 -4
- package/dist/{chunk-HWIRY3WO.js → chunk-3NISM3OI.js} +7 -6
- package/dist/chunk-3NISM3OI.js.map +1 -0
- package/dist/{chunk-ZSXMIPU4.js → chunk-3Q6S6TRY.js} +3 -3
- package/dist/{chunk-MEK7BIVS.js → chunk-45X4QO4V.js} +37 -17
- package/dist/chunk-45X4QO4V.js.map +1 -0
- package/dist/{chunk-3D63HGOG.js → chunk-4ETSGWB2.js} +3 -3
- package/dist/{chunk-IVPV6VPW.js → chunk-4VNUU6S6.js} +3 -3
- package/dist/{chunk-7W6I4VXA.js → chunk-65YMLGQB.js} +7 -7
- package/dist/{chunk-C3E7XETB.js → chunk-6KM2C2UO.js} +7 -7
- package/dist/{chunk-R5QLAXNJ.js → chunk-6SJOM62D.js} +2 -2
- package/dist/{chunk-ROLNJOSE.js → chunk-A53IRCOO.js} +2 -1
- package/dist/chunk-A53IRCOO.js.map +1 -0
- package/dist/{chunk-QQNPAZNP.js → chunk-AC6N2EIN.js} +12 -11
- package/dist/{chunk-QQNPAZNP.js.map → chunk-AC6N2EIN.js.map} +1 -1
- package/dist/{chunk-YIODX4PM.js → chunk-AKGDIBSE.js} +2 -2
- package/dist/{chunk-HWP4NEYL.js → chunk-BCPH3SZM.js} +2 -2
- package/dist/{chunk-4P533364.js → chunk-BO3BNBBE.js} +7 -7
- package/dist/{chunk-KNYEQLIF.js → chunk-BURVDS7U.js} +2 -2
- package/dist/{chunk-MF6LDFDW.js → chunk-C224P3D3.js} +2 -2
- package/dist/{chunk-B3HIALTV.js → chunk-CGJGWALF.js} +2 -2
- package/dist/{chunk-CALBDLDJ.js → chunk-DHBKD2TG.js} +3 -3
- package/dist/{chunk-PIEYQBWL.js → chunk-EASMYJG3.js} +13 -12
- package/dist/chunk-EASMYJG3.js.map +1 -0
- package/dist/{chunk-EOETYHTD.js → chunk-FRCV6NWT.js} +2 -2
- package/dist/{chunk-GOHSGTR5.js → chunk-FXHTSSV2.js} +3 -3
- package/dist/{chunk-NER44YB7.js → chunk-FXIEYT6L.js} +8 -8
- package/dist/{chunk-WRUQPVTS.js → chunk-GDCTRDUY.js} +4 -4
- package/dist/{chunk-DRYY4BPY.js → chunk-I2TUJLI4.js} +5 -5
- package/dist/{chunk-IJ6YYFXY.js → chunk-IOSB2HMV.js} +3 -3
- package/dist/{chunk-XFRSOUBJ.js → chunk-IZSMQ6X2.js} +67 -56
- package/dist/chunk-IZSMQ6X2.js.map +1 -0
- package/dist/{chunk-5EGGS6Y6.js → chunk-JCCGLFMU.js} +94 -56
- package/dist/chunk-JCCGLFMU.js.map +1 -0
- package/dist/{chunk-Y2HNFNCS.js → chunk-JCMGIW7G.js} +5 -3
- package/dist/chunk-JCMGIW7G.js.map +1 -0
- package/dist/{chunk-YV2MPIFG.js → chunk-JDW4GXEA.js} +4 -4
- package/dist/chunk-JUGSJ37Z.js +9 -0
- package/dist/{chunk-LMLVJEY7.js → chunk-L3JK6V5I.js} +2 -2
- package/dist/{chunk-T6YP6GPK.js → chunk-L7OQ7O4K.js} +3 -3
- package/dist/{chunk-WMOXIFBF.js → chunk-LYKWTHOD.js} +38 -10
- package/dist/chunk-LYKWTHOD.js.map +1 -0
- package/dist/{chunk-KPGO5VFR.js → chunk-M2TQNGMD.js} +5 -5
- package/dist/{chunk-Y33WKESH.js → chunk-MAFJE26N.js} +2 -2
- package/dist/{chunk-CIAXJC5H.js → chunk-MM32YZT6.js} +4 -4
- package/dist/{chunk-OB63GDEC.js → chunk-OESAI3XS.js} +2 -2
- package/dist/{chunk-722K7XWW.js → chunk-PLOO7NQU.js} +4 -4
- package/dist/{chunk-DMUZIBPM.js → chunk-R2SR3PER.js} +10 -4
- package/dist/chunk-R2SR3PER.js.map +1 -0
- package/dist/{chunk-B2Q5BYOD.js → chunk-R7334LAS.js} +5 -5
- package/dist/{chunk-NM4SABMQ.js → chunk-RFQRVXFQ.js} +529 -424
- package/dist/chunk-RFQRVXFQ.js.map +1 -0
- package/dist/{chunk-U3NYRIFH.js → chunk-S4ILKUFN.js} +13 -3
- package/dist/{chunk-U3NYRIFH.js.map → chunk-S4ILKUFN.js.map} +1 -1
- package/dist/{chunk-H7KH5CDM.js → chunk-SBRHGEFP.js} +3 -3
- package/dist/{chunk-CGMFZOS5.js → chunk-VES42DOD.js} +236 -81
- package/dist/chunk-VES42DOD.js.map +1 -0
- package/dist/chunk-VGQV4LX7.js +33 -0
- package/dist/chunk-VGQV4LX7.js.map +1 -0
- package/dist/{chunk-OBFHGN7Q.js → chunk-WOAFMVKW.js} +2 -2
- package/dist/{chunk-TKL4B2OI.js → chunk-WUJJ2FTK.js} +8 -4
- package/dist/chunk-WUJJ2FTK.js.map +1 -0
- package/dist/{chunk-CFO2JMKW.js → chunk-XEIREYW6.js} +29 -25
- package/dist/chunk-XEIREYW6.js.map +1 -0
- package/dist/{chunk-QDKLIYGR.js → chunk-XZ5DA5X4.js} +14 -3
- package/dist/{chunk-QDKLIYGR.js.map → chunk-XZ5DA5X4.js.map} +1 -1
- package/dist/{chunk-TBOE7DG5.js → chunk-YDYHURVA.js} +2 -2
- package/dist/{chunk-75I3DHVU.js → chunk-ZFSV65M5.js} +3 -3
- package/dist/{chunk-RFE4EBUP.js → chunk-ZHKE637Q.js} +3 -3
- package/dist/{cleanup-Q6AQXSRS.js → cleanup-7VJ4KUMR.js} +28 -27
- package/dist/{cleanup-Q6AQXSRS.js.map → cleanup-7VJ4KUMR.js.map} +1 -1
- package/dist/cli-RFG23HUW.js +18 -0
- package/dist/{command-hook-installer-2ZFJJGKY.js → command-hook-installer-PTTVCWH7.js} +4 -4
- package/dist/{config-DOPH6NOU.js → config-CREG6OI3.js} +9 -9
- package/dist/{diff-DZJLSTRO.js → diff-UYXZID2B.js} +12 -12
- package/dist/{digest-QTNPN2E6.js → digest-I5Z6W2EP.js} +10 -10
- package/dist/{fork-HDJ54HH2.js → fork-5AOB45N2.js} +26 -25
- package/dist/{fork-HDJ54HH2.js.map → fork-5AOB45N2.js.map} +1 -1
- package/dist/history-3LFLB4FO.js +55 -0
- package/dist/{hook-V7JNOY2E.js → hook-SJOCXGLD.js} +14 -14
- package/dist/{hydrate-NGZ26R2Y.js → hydrate-YEJCVZZ7.js} +29 -12
- package/dist/hydrate-YEJCVZZ7.js.map +1 -0
- package/dist/{init-BQIBLPP5.js → init-6F67TVM7.js} +9 -9
- package/dist/{install-skills-LCXJIHK4.js → install-skills-ESCNSPBY.js} +4 -4
- package/dist/install-skills-bin.js +3 -3
- package/dist/{list-4KATUVO3.js → list-NHZUEVTA.js} +32 -12
- package/dist/list-NHZUEVTA.js.map +1 -0
- package/dist/{move-LYO5J2ZH.js → move-JICK4XA5.js} +25 -23
- package/dist/{move-LYO5J2ZH.js.map → move-JICK4XA5.js.map} +1 -1
- package/dist/{note-7XR4YA6R.js → note-KZMWEGZP.js} +11 -11
- package/dist/{overlaps-5WKQT3LX.js → overlaps-O353DOQI.js} +9 -9
- package/dist/{pin-GJM3KSG7.js → pin-7CON36HF.js} +11 -11
- package/dist/{pr-YO7XSYUA.js → pr-4KUGJDZ2.js} +14 -14
- package/dist/{prune-BUGPJLLO.js → prune-KQ77276H.js} +27 -26
- package/dist/{prune-BUGPJLLO.js.map → prune-KQ77276H.js.map} +1 -1
- package/dist/{pty-host-O5H4FKWF.js → pty-host-MSCJGN5G.js} +10 -10
- package/dist/{read-XMU63E3F.js → read-J42H6OVE.js} +10 -10
- package/dist/{recent-73SHXIFU.js → recent-BZQP3RKA.js} +10 -10
- package/dist/recent-BZQP3RKA.js.map +1 -0
- package/dist/{remove-ZXDVVOHF.js → remove-GRRKSGS7.js} +28 -27
- package/dist/{remove-ZXDVVOHF.js.map → remove-GRRKSGS7.js.map} +1 -1
- package/dist/report-BSETCIYQ.js +18 -0
- package/dist/{restart-S4D7LD3A.js → restart-REFEZGH2.js} +11 -11
- package/dist/{resume-YIIQIJCS.js → resume-RGP2BCKL.js} +10 -10
- package/dist/resume-RGP2BCKL.js.map +1 -0
- package/dist/{run-WN2O7EX7.js → run-WYDFP6EL.js} +7 -7
- package/dist/{screen-LX6XHNYN.js → screen-YWJLDINC.js} +11 -11
- package/dist/{search-DCDJVBKW.js → search-M4DU4GUB.js} +7 -7
- package/dist/{section-XD46IHMW.js → section-AYN6EHPO.js} +11 -11
- package/dist/{send-P4NILVGL.js → send-O3SI53O7.js} +16 -16
- package/dist/{sessions-POSS5NRV.js → sessions-4BASM7AC.js} +20 -20
- package/dist/{snooze-ONAR2WNP.js → snooze-F3NT7PZO.js} +10 -10
- package/dist/{start-6YKHYYX5.js → start-7OQNLGDU.js} +11 -11
- package/dist/{state-NV4FQNMT.js → state-NRK5CBXZ.js} +5 -5
- package/dist/{status-KYRZRITO.js → status-HLOEWXJ3.js} +8 -8
- package/dist/{stop-QU372WAY.js → stop-YRGANOU7.js} +11 -11
- package/dist/{sync-JR24WVJ7.js → sync-YDK5R7XQ.js} +27 -26
- package/dist/{sync-JR24WVJ7.js.map → sync-YDK5R7XQ.js.map} +1 -1
- package/dist/{time-FYXXC5XC.js → time-T5RBWMDN.js} +12 -12
- package/dist/time-actions-FLLFYEVY.js +15 -0
- package/dist/time-actions-FLLFYEVY.js.map +1 -0
- package/dist/{timesheet-57EG6ABE.js → timesheet-UB6OASXF.js} +14 -14
- package/dist/{todo-UDYY4QTY.js → todo-OE62TNES.js} +6 -6
- package/dist/{tree-RDPJOIDT.js → tree-DRDDTXQ2.js} +42 -24
- package/dist/tree-DRDDTXQ2.js.map +1 -0
- package/dist/{update-OZXFQMYI.js → update-S57YQGPG.js} +13 -13
- package/dist/{wait-3MQST3FP.js → wait-2CRY7XQ5.js} +11 -11
- package/dist/wd-bin.js +9 -9
- package/dist/web/assets/{PtyView-DBG0B_A4.js → PtyView-BZ57sEm1.js} +2 -2
- package/dist/web/assets/{PtyView-DBG0B_A4.js.map → PtyView-BZ57sEm1.js.map} +1 -1
- package/dist/web/assets/index-CDYWfNo_.css +1 -0
- package/dist/web/assets/index-CqTf1VAm.js +119 -0
- package/dist/web/assets/index-CqTf1VAm.js.map +1 -0
- package/dist/web/index.html +2 -2
- package/dist/{web-DSJT4HSI.js → web-A3VW2IYG.js} +471 -298
- package/dist/web-A3VW2IYG.js.map +1 -0
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/dist/chunk-5EGGS6Y6.js.map +0 -1
- package/dist/chunk-CFO2JMKW.js.map +0 -1
- package/dist/chunk-CGMFZOS5.js.map +0 -1
- package/dist/chunk-DMUZIBPM.js.map +0 -1
- package/dist/chunk-HWIRY3WO.js.map +0 -1
- package/dist/chunk-KPGR4JRE.js +0 -9
- package/dist/chunk-MEK7BIVS.js.map +0 -1
- package/dist/chunk-NM4SABMQ.js.map +0 -1
- package/dist/chunk-PIEYQBWL.js.map +0 -1
- package/dist/chunk-ROLNJOSE.js.map +0 -1
- package/dist/chunk-TKL4B2OI.js.map +0 -1
- package/dist/chunk-WMOXIFBF.js.map +0 -1
- package/dist/chunk-XFRSOUBJ.js.map +0 -1
- package/dist/chunk-Y2HNFNCS.js.map +0 -1
- package/dist/cli-X4Z2UYJZ.js +0 -18
- package/dist/hydrate-NGZ26R2Y.js.map +0 -1
- package/dist/list-4KATUVO3.js.map +0 -1
- package/dist/recent-73SHXIFU.js.map +0 -1
- package/dist/report-TEIRRYH4.js +0 -16
- package/dist/resume-YIIQIJCS.js.map +0 -1
- package/dist/time-actions-L3OWQHEX.js +0 -15
- package/dist/tree-RDPJOIDT.js.map +0 -1
- package/dist/web/assets/index-DoT3bzyK.css +0 -1
- package/dist/web/assets/index-rLMVfFdt.js +0 -119
- package/dist/web/assets/index-rLMVfFdt.js.map +0 -1
- package/dist/web-DSJT4HSI.js.map +0 -1
- /package/dist/{answer-UWI22VOE.js.map → answer-OA2WTJCZ.js.map} +0 -0
- /package/dist/{attach-HYHEXW5J.js.map → attach-5GXPA7BV.js.map} +0 -0
- /package/dist/{block-A25XE7HC.js.map → block-VINEC2MW.js.map} +0 -0
- /package/dist/{broadcast-AG7P5BKQ.js.map → broadcast-ENAJDNVU.js.map} +0 -0
- /package/dist/{catchup-VTGG7BAR.js.map → catchup-NC4WHSBF.js.map} +0 -0
- /package/dist/{chunk-XDBMLTFY.js.map → chunk-3HBHM2VX.js.map} +0 -0
- /package/dist/{chunk-7OBX4MJY.js.map → chunk-3KOYICWB.js.map} +0 -0
- /package/dist/{chunk-ZSXMIPU4.js.map → chunk-3Q6S6TRY.js.map} +0 -0
- /package/dist/{chunk-3D63HGOG.js.map → chunk-4ETSGWB2.js.map} +0 -0
- /package/dist/{chunk-IVPV6VPW.js.map → chunk-4VNUU6S6.js.map} +0 -0
- /package/dist/{chunk-7W6I4VXA.js.map → chunk-65YMLGQB.js.map} +0 -0
- /package/dist/{chunk-C3E7XETB.js.map → chunk-6KM2C2UO.js.map} +0 -0
- /package/dist/{chunk-R5QLAXNJ.js.map → chunk-6SJOM62D.js.map} +0 -0
- /package/dist/{chunk-YIODX4PM.js.map → chunk-AKGDIBSE.js.map} +0 -0
- /package/dist/{chunk-HWP4NEYL.js.map → chunk-BCPH3SZM.js.map} +0 -0
- /package/dist/{chunk-4P533364.js.map → chunk-BO3BNBBE.js.map} +0 -0
- /package/dist/{chunk-KNYEQLIF.js.map → chunk-BURVDS7U.js.map} +0 -0
- /package/dist/{chunk-MF6LDFDW.js.map → chunk-C224P3D3.js.map} +0 -0
- /package/dist/{chunk-B3HIALTV.js.map → chunk-CGJGWALF.js.map} +0 -0
- /package/dist/{chunk-CALBDLDJ.js.map → chunk-DHBKD2TG.js.map} +0 -0
- /package/dist/{chunk-EOETYHTD.js.map → chunk-FRCV6NWT.js.map} +0 -0
- /package/dist/{chunk-GOHSGTR5.js.map → chunk-FXHTSSV2.js.map} +0 -0
- /package/dist/{chunk-NER44YB7.js.map → chunk-FXIEYT6L.js.map} +0 -0
- /package/dist/{chunk-WRUQPVTS.js.map → chunk-GDCTRDUY.js.map} +0 -0
- /package/dist/{chunk-DRYY4BPY.js.map → chunk-I2TUJLI4.js.map} +0 -0
- /package/dist/{chunk-IJ6YYFXY.js.map → chunk-IOSB2HMV.js.map} +0 -0
- /package/dist/{chunk-YV2MPIFG.js.map → chunk-JDW4GXEA.js.map} +0 -0
- /package/dist/{chunk-KPGR4JRE.js.map → chunk-JUGSJ37Z.js.map} +0 -0
- /package/dist/{chunk-LMLVJEY7.js.map → chunk-L3JK6V5I.js.map} +0 -0
- /package/dist/{chunk-T6YP6GPK.js.map → chunk-L7OQ7O4K.js.map} +0 -0
- /package/dist/{chunk-KPGO5VFR.js.map → chunk-M2TQNGMD.js.map} +0 -0
- /package/dist/{chunk-Y33WKESH.js.map → chunk-MAFJE26N.js.map} +0 -0
- /package/dist/{chunk-CIAXJC5H.js.map → chunk-MM32YZT6.js.map} +0 -0
- /package/dist/{chunk-OB63GDEC.js.map → chunk-OESAI3XS.js.map} +0 -0
- /package/dist/{chunk-722K7XWW.js.map → chunk-PLOO7NQU.js.map} +0 -0
- /package/dist/{chunk-B2Q5BYOD.js.map → chunk-R7334LAS.js.map} +0 -0
- /package/dist/{chunk-H7KH5CDM.js.map → chunk-SBRHGEFP.js.map} +0 -0
- /package/dist/{chunk-OBFHGN7Q.js.map → chunk-WOAFMVKW.js.map} +0 -0
- /package/dist/{chunk-TBOE7DG5.js.map → chunk-YDYHURVA.js.map} +0 -0
- /package/dist/{chunk-75I3DHVU.js.map → chunk-ZFSV65M5.js.map} +0 -0
- /package/dist/{chunk-RFE4EBUP.js.map → chunk-ZHKE637Q.js.map} +0 -0
- /package/dist/{cli-X4Z2UYJZ.js.map → cli-RFG23HUW.js.map} +0 -0
- /package/dist/{command-hook-installer-2ZFJJGKY.js.map → command-hook-installer-PTTVCWH7.js.map} +0 -0
- /package/dist/{config-DOPH6NOU.js.map → config-CREG6OI3.js.map} +0 -0
- /package/dist/{diff-DZJLSTRO.js.map → diff-UYXZID2B.js.map} +0 -0
- /package/dist/{digest-QTNPN2E6.js.map → digest-I5Z6W2EP.js.map} +0 -0
- /package/dist/{install-skills-LCXJIHK4.js.map → history-3LFLB4FO.js.map} +0 -0
- /package/dist/{hook-V7JNOY2E.js.map → hook-SJOCXGLD.js.map} +0 -0
- /package/dist/{init-BQIBLPP5.js.map → init-6F67TVM7.js.map} +0 -0
- /package/dist/{report-TEIRRYH4.js.map → install-skills-ESCNSPBY.js.map} +0 -0
- /package/dist/{note-7XR4YA6R.js.map → note-KZMWEGZP.js.map} +0 -0
- /package/dist/{overlaps-5WKQT3LX.js.map → overlaps-O353DOQI.js.map} +0 -0
- /package/dist/{pin-GJM3KSG7.js.map → pin-7CON36HF.js.map} +0 -0
- /package/dist/{pr-YO7XSYUA.js.map → pr-4KUGJDZ2.js.map} +0 -0
- /package/dist/{pty-host-O5H4FKWF.js.map → pty-host-MSCJGN5G.js.map} +0 -0
- /package/dist/{read-XMU63E3F.js.map → read-J42H6OVE.js.map} +0 -0
- /package/dist/{time-actions-L3OWQHEX.js.map → report-BSETCIYQ.js.map} +0 -0
- /package/dist/{restart-S4D7LD3A.js.map → restart-REFEZGH2.js.map} +0 -0
- /package/dist/{run-WN2O7EX7.js.map → run-WYDFP6EL.js.map} +0 -0
- /package/dist/{screen-LX6XHNYN.js.map → screen-YWJLDINC.js.map} +0 -0
- /package/dist/{search-DCDJVBKW.js.map → search-M4DU4GUB.js.map} +0 -0
- /package/dist/{section-XD46IHMW.js.map → section-AYN6EHPO.js.map} +0 -0
- /package/dist/{send-P4NILVGL.js.map → send-O3SI53O7.js.map} +0 -0
- /package/dist/{sessions-POSS5NRV.js.map → sessions-4BASM7AC.js.map} +0 -0
- /package/dist/{snooze-ONAR2WNP.js.map → snooze-F3NT7PZO.js.map} +0 -0
- /package/dist/{start-6YKHYYX5.js.map → start-7OQNLGDU.js.map} +0 -0
- /package/dist/{state-NV4FQNMT.js.map → state-NRK5CBXZ.js.map} +0 -0
- /package/dist/{status-KYRZRITO.js.map → status-HLOEWXJ3.js.map} +0 -0
- /package/dist/{stop-QU372WAY.js.map → stop-YRGANOU7.js.map} +0 -0
- /package/dist/{time-FYXXC5XC.js.map → time-T5RBWMDN.js.map} +0 -0
- /package/dist/{timesheet-57EG6ABE.js.map → timesheet-UB6OASXF.js.map} +0 -0
- /package/dist/{todo-UDYY4QTY.js.map → todo-OE62TNES.js.map} +0 -0
- /package/dist/{update-OZXFQMYI.js.map → update-S57YQGPG.js.map} +0 -0
- /package/dist/{wait-3MQST3FP.js.map → wait-2CRY7XQ5.js.map} +0 -0
|
@@ -2,7 +2,20 @@
|
|
|
2
2
|
import {
|
|
3
3
|
ensureAgentPath,
|
|
4
4
|
findOnPath
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-JDW4GXEA.js";
|
|
6
|
+
import {
|
|
7
|
+
defaultTimeDeps,
|
|
8
|
+
fetchIssueDetail,
|
|
9
|
+
fetchJiraPane,
|
|
10
|
+
fetchMyIssues,
|
|
11
|
+
fetchMyIssuesOrThrow,
|
|
12
|
+
finishDeviceLogin,
|
|
13
|
+
graphAccount,
|
|
14
|
+
graphApp,
|
|
15
|
+
graphProblem,
|
|
16
|
+
signOutGraph,
|
|
17
|
+
startDeviceLogin
|
|
18
|
+
} from "./chunk-65YMLGQB.js";
|
|
6
19
|
import {
|
|
7
20
|
addTask,
|
|
8
21
|
completeTask,
|
|
@@ -10,7 +23,7 @@ import {
|
|
|
10
23
|
getTasks,
|
|
11
24
|
removeTask,
|
|
12
25
|
uncompleteTask
|
|
13
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-OESAI3XS.js";
|
|
14
27
|
import {
|
|
15
28
|
commentInputSchema,
|
|
16
29
|
detectParentBranch,
|
|
@@ -23,7 +36,7 @@ import {
|
|
|
23
36
|
serveSpa,
|
|
24
37
|
sessionBaseForPath,
|
|
25
38
|
submitReviewSchema
|
|
26
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-R7334LAS.js";
|
|
27
40
|
import {
|
|
28
41
|
announceChange,
|
|
29
42
|
createArchivedRows,
|
|
@@ -37,10 +50,10 @@ import {
|
|
|
37
50
|
sessionWire,
|
|
38
51
|
stageSeenKey,
|
|
39
52
|
storeHolding
|
|
40
|
-
} from "./chunk-
|
|
53
|
+
} from "./chunk-LYKWTHOD.js";
|
|
41
54
|
import {
|
|
42
55
|
createDigestSource
|
|
43
|
-
} from "./chunk-
|
|
56
|
+
} from "./chunk-I2TUJLI4.js";
|
|
44
57
|
import {
|
|
45
58
|
agentsBySession,
|
|
46
59
|
createBuildFoldersJob,
|
|
@@ -49,38 +62,37 @@ import {
|
|
|
49
62
|
deleteMergedBranches,
|
|
50
63
|
findMergedBranches,
|
|
51
64
|
summarizeAgents
|
|
52
|
-
} from "./chunk-
|
|
65
|
+
} from "./chunk-AC6N2EIN.js";
|
|
66
|
+
import {
|
|
67
|
+
defaultCleanupDeps
|
|
68
|
+
} from "./chunk-EASMYJG3.js";
|
|
53
69
|
import {
|
|
54
70
|
DiffStatCache,
|
|
55
71
|
findOverlaps,
|
|
56
72
|
wantsDiffStat
|
|
57
|
-
} from "./chunk-
|
|
58
|
-
import {
|
|
59
|
-
defaultTimeDeps,
|
|
60
|
-
fetchIssueDetail,
|
|
61
|
-
fetchJiraPane,
|
|
62
|
-
fetchMyIssues,
|
|
63
|
-
fetchMyIssuesOrThrow,
|
|
64
|
-
finishDeviceLogin,
|
|
65
|
-
graphAccount,
|
|
66
|
-
graphApp,
|
|
67
|
-
graphProblem,
|
|
68
|
-
signOutGraph,
|
|
69
|
-
startDeviceLogin
|
|
70
|
-
} from "./chunk-7W6I4VXA.js";
|
|
71
|
-
import {
|
|
72
|
-
defaultCleanupDeps
|
|
73
|
-
} from "./chunk-PIEYQBWL.js";
|
|
73
|
+
} from "./chunk-L3JK6V5I.js";
|
|
74
74
|
import {
|
|
75
75
|
LATER_TEXT,
|
|
76
76
|
restartCountsText
|
|
77
77
|
} from "./chunk-TNJF7T33.js";
|
|
78
|
+
import {
|
|
79
|
+
sendToSession
|
|
80
|
+
} from "./chunk-RYNBBSLY.js";
|
|
81
|
+
import {
|
|
82
|
+
applyPlacePatch,
|
|
83
|
+
applySectionOp,
|
|
84
|
+
changeRailSections,
|
|
85
|
+
cleanPlacePatch,
|
|
86
|
+
cleanSectionOp,
|
|
87
|
+
placeSession,
|
|
88
|
+
readRailLayout
|
|
89
|
+
} from "./chunk-BCPH3SZM.js";
|
|
78
90
|
import {
|
|
79
91
|
MAX_NOTE_CHARS,
|
|
80
92
|
readNote,
|
|
81
93
|
saveNote,
|
|
82
94
|
sessionsWithNotes
|
|
83
|
-
} from "./chunk-
|
|
95
|
+
} from "./chunk-CGJGWALF.js";
|
|
84
96
|
import {
|
|
85
97
|
addBlocker,
|
|
86
98
|
allBlocks,
|
|
@@ -91,19 +103,21 @@ import {
|
|
|
91
103
|
removeBlocker,
|
|
92
104
|
sweepBlocks,
|
|
93
105
|
unblockedPrompt
|
|
94
|
-
} from "./chunk-
|
|
106
|
+
} from "./chunk-4VNUU6S6.js";
|
|
95
107
|
import {
|
|
96
108
|
jiraWorklogPoster,
|
|
97
109
|
logWorkDay,
|
|
98
110
|
loggedDays,
|
|
99
111
|
worklogSettings
|
|
100
|
-
} from "./chunk-
|
|
112
|
+
} from "./chunk-6SJOM62D.js";
|
|
101
113
|
import {
|
|
102
114
|
sessionWorkTime
|
|
103
|
-
} from "./chunk-
|
|
115
|
+
} from "./chunk-IOSB2HMV.js";
|
|
104
116
|
import {
|
|
105
|
-
|
|
106
|
-
|
|
117
|
+
checkTools,
|
|
118
|
+
saveFolders,
|
|
119
|
+
setupState
|
|
120
|
+
} from "./chunk-3Q6S6TRY.js";
|
|
107
121
|
import {
|
|
108
122
|
RepoAdminError,
|
|
109
123
|
deleteGroup,
|
|
@@ -113,7 +127,7 @@ import {
|
|
|
113
127
|
saveGroup,
|
|
114
128
|
setRepoIgnored,
|
|
115
129
|
setScanRoot
|
|
116
|
-
} from "./chunk-
|
|
130
|
+
} from "./chunk-WUJJ2FTK.js";
|
|
117
131
|
import {
|
|
118
132
|
fetchAllPullRequests,
|
|
119
133
|
freeLeftovers,
|
|
@@ -122,16 +136,21 @@ import {
|
|
|
122
136
|
openInLeftovers,
|
|
123
137
|
parsePrRef,
|
|
124
138
|
resolvePrToStart
|
|
125
|
-
} from "./chunk-
|
|
139
|
+
} from "./chunk-6KM2C2UO.js";
|
|
126
140
|
import {
|
|
127
141
|
editorArgs,
|
|
128
142
|
openUrl
|
|
129
|
-
} from "./chunk-
|
|
143
|
+
} from "./chunk-YDYHURVA.js";
|
|
144
|
+
import {
|
|
145
|
+
enrollProblem,
|
|
146
|
+
groupProblem,
|
|
147
|
+
suggestAlias
|
|
148
|
+
} from "./chunk-HMK3INUS.js";
|
|
130
149
|
import {
|
|
131
150
|
archiveMergedSession,
|
|
132
151
|
archiveWaiting,
|
|
133
152
|
defaultArchiveDeps
|
|
134
|
-
} from "./chunk-
|
|
153
|
+
} from "./chunk-XEIREYW6.js";
|
|
135
154
|
import {
|
|
136
155
|
cleanupVerdict,
|
|
137
156
|
createCleanupJob
|
|
@@ -146,29 +165,24 @@ import {
|
|
|
146
165
|
postReply,
|
|
147
166
|
rememberSent,
|
|
148
167
|
saveDraft
|
|
149
|
-
} from "./chunk-
|
|
150
|
-
import "./chunk-
|
|
168
|
+
} from "./chunk-C224P3D3.js";
|
|
169
|
+
import "./chunk-ZFSV65M5.js";
|
|
151
170
|
import {
|
|
152
171
|
defaultForkDeps,
|
|
153
172
|
forkSession,
|
|
154
173
|
startSessionWithPrompt
|
|
155
|
-
} from "./chunk-
|
|
174
|
+
} from "./chunk-45X4QO4V.js";
|
|
156
175
|
import {
|
|
176
|
+
childText,
|
|
157
177
|
createInChild,
|
|
158
178
|
createInProcess,
|
|
159
|
-
|
|
160
|
-
|
|
179
|
+
keyedQueue,
|
|
180
|
+
oneAtATime,
|
|
181
|
+
runWorkChild
|
|
182
|
+
} from "./chunk-JCCGLFMU.js";
|
|
161
183
|
import {
|
|
162
184
|
resolveWorkBinPath
|
|
163
185
|
} from "./chunk-AH5TM3NB.js";
|
|
164
|
-
import {
|
|
165
|
-
teardownWorktree,
|
|
166
|
-
toBaseSpec,
|
|
167
|
-
wouldRefuseRemoval
|
|
168
|
-
} from "./chunk-CGMFZOS5.js";
|
|
169
|
-
import {
|
|
170
|
-
isWorktreeFolder
|
|
171
|
-
} from "./chunk-KUCMJHQW.js";
|
|
172
186
|
import {
|
|
173
187
|
configurePtyPool,
|
|
174
188
|
detachPtyPool,
|
|
@@ -193,11 +207,26 @@ import {
|
|
|
193
207
|
subscribeSession,
|
|
194
208
|
syncPtyPool,
|
|
195
209
|
writeToPty
|
|
196
|
-
} from "./chunk-
|
|
210
|
+
} from "./chunk-FXIEYT6L.js";
|
|
197
211
|
import {
|
|
198
212
|
dbPtySessions
|
|
199
|
-
} from "./chunk-
|
|
200
|
-
import "./chunk-
|
|
213
|
+
} from "./chunk-4ETSGWB2.js";
|
|
214
|
+
import "./chunk-DHBKD2TG.js";
|
|
215
|
+
import {
|
|
216
|
+
addRepoRefusal,
|
|
217
|
+
addedRepoNote
|
|
218
|
+
} from "./chunk-3IOIY4W6.js";
|
|
219
|
+
import {
|
|
220
|
+
teardownWorktree,
|
|
221
|
+
toBaseSpec,
|
|
222
|
+
wouldRefuseRemoval
|
|
223
|
+
} from "./chunk-VES42DOD.js";
|
|
224
|
+
import "./chunk-VGQV4LX7.js";
|
|
225
|
+
import {
|
|
226
|
+
isWorktreeFolder
|
|
227
|
+
} from "./chunk-KUCMJHQW.js";
|
|
228
|
+
import "./chunk-PSUJZUYX.js";
|
|
229
|
+
import "./chunk-5WM24P5N.js";
|
|
201
230
|
import {
|
|
202
231
|
BehindCache,
|
|
203
232
|
behindMain,
|
|
@@ -213,46 +242,46 @@ import {
|
|
|
213
242
|
stackedOn,
|
|
214
243
|
updateFromBase,
|
|
215
244
|
updateFromMain
|
|
216
|
-
} from "./chunk-
|
|
245
|
+
} from "./chunk-3NISM3OI.js";
|
|
217
246
|
import {
|
|
218
247
|
sessionStatusView,
|
|
219
248
|
shownState
|
|
220
|
-
} from "./chunk-
|
|
249
|
+
} from "./chunk-3KOYICWB.js";
|
|
250
|
+
import {
|
|
251
|
+
defaultRunner,
|
|
252
|
+
mergeSelected,
|
|
253
|
+
runShipAction,
|
|
254
|
+
shipPreflight
|
|
255
|
+
} from "./chunk-3GIH4WTA.js";
|
|
221
256
|
import {
|
|
222
257
|
askCatchUp,
|
|
223
258
|
cachedCatchUp,
|
|
224
259
|
catchUp,
|
|
225
260
|
catchUpFacts,
|
|
226
261
|
forgetCatchUp
|
|
227
|
-
} from "./chunk-
|
|
262
|
+
} from "./chunk-M2TQNGMD.js";
|
|
228
263
|
import {
|
|
229
264
|
runInternal,
|
|
230
265
|
summarizeCheckpoint,
|
|
231
266
|
throttleTrailing
|
|
232
|
-
} from "./chunk-
|
|
267
|
+
} from "./chunk-PLOO7NQU.js";
|
|
233
268
|
import {
|
|
234
269
|
computeDiff,
|
|
235
270
|
computeRangeDiff,
|
|
236
271
|
parseGitDiff
|
|
237
|
-
} from "./chunk-
|
|
238
|
-
import {
|
|
239
|
-
applyPlacePatch,
|
|
240
|
-
applySectionOp,
|
|
241
|
-
changeRailSections,
|
|
242
|
-
cleanPlacePatch,
|
|
243
|
-
cleanSectionOp,
|
|
244
|
-
placeSession,
|
|
245
|
-
readRailLayout
|
|
246
|
-
} from "./chunk-HWP4NEYL.js";
|
|
272
|
+
} from "./chunk-3HBHM2VX.js";
|
|
247
273
|
import {
|
|
248
274
|
packageRoot
|
|
249
275
|
} from "./chunk-LNHSBM4L.js";
|
|
250
276
|
import {
|
|
251
277
|
VERSION
|
|
252
|
-
} from "./chunk-
|
|
278
|
+
} from "./chunk-JUGSJ37Z.js";
|
|
253
279
|
import {
|
|
254
280
|
resolveProjectTarget
|
|
255
|
-
} from "./chunk-
|
|
281
|
+
} from "./chunk-R2SR3PER.js";
|
|
282
|
+
import {
|
|
283
|
+
git
|
|
284
|
+
} from "./chunk-AKGDIBSE.js";
|
|
256
285
|
import {
|
|
257
286
|
DEFAULT_CATCH_UP_DAYS,
|
|
258
287
|
addDays,
|
|
@@ -271,10 +300,15 @@ import {
|
|
|
271
300
|
tempoSetup,
|
|
272
301
|
timeRange,
|
|
273
302
|
updateDay
|
|
274
|
-
} from "./chunk-
|
|
303
|
+
} from "./chunk-L7OQ7O4K.js";
|
|
275
304
|
import {
|
|
276
305
|
isOwnCheckout
|
|
277
306
|
} from "./chunk-TUFQJXXO.js";
|
|
307
|
+
import {
|
|
308
|
+
CONTEXT_WARN,
|
|
309
|
+
describeView,
|
|
310
|
+
writeAssistantContext
|
|
311
|
+
} from "./chunk-ZHKE637Q.js";
|
|
278
312
|
import {
|
|
279
313
|
clearDevWebDiscovery,
|
|
280
314
|
clearWebDiscovery,
|
|
@@ -286,46 +320,20 @@ import {
|
|
|
286
320
|
readWebUrl,
|
|
287
321
|
writeDevWebDiscovery,
|
|
288
322
|
writeWebDiscovery
|
|
289
|
-
} from "./chunk-
|
|
290
|
-
import {
|
|
291
|
-
CONTEXT_WARN,
|
|
292
|
-
describeView,
|
|
293
|
-
writeAssistantContext
|
|
294
|
-
} from "./chunk-RFE4EBUP.js";
|
|
323
|
+
} from "./chunk-MAFJE26N.js";
|
|
295
324
|
import {
|
|
296
325
|
NOTE_NUDGE,
|
|
297
326
|
findSessionForCwd,
|
|
298
327
|
readPendingForSession,
|
|
299
328
|
readPendingForWorktree
|
|
300
|
-
} from "./chunk-
|
|
301
|
-
import "./chunk-ZSHWP2VS.js";
|
|
329
|
+
} from "./chunk-BO3BNBBE.js";
|
|
302
330
|
import {
|
|
303
331
|
getCommentFileStore
|
|
304
|
-
} from "./chunk-
|
|
332
|
+
} from "./chunk-XZ5DA5X4.js";
|
|
333
|
+
import "./chunk-ZSHWP2VS.js";
|
|
305
334
|
import {
|
|
306
335
|
createCommentStore
|
|
307
336
|
} from "./chunk-HUXS3VAI.js";
|
|
308
|
-
import {
|
|
309
|
-
checkTools,
|
|
310
|
-
saveFolders,
|
|
311
|
-
setupState
|
|
312
|
-
} from "./chunk-ZSXMIPU4.js";
|
|
313
|
-
import {
|
|
314
|
-
enrollProblem,
|
|
315
|
-
groupProblem,
|
|
316
|
-
suggestAlias
|
|
317
|
-
} from "./chunk-HMK3INUS.js";
|
|
318
|
-
import "./chunk-PSUJZUYX.js";
|
|
319
|
-
import "./chunk-5WM24P5N.js";
|
|
320
|
-
import {
|
|
321
|
-
defaultRunner,
|
|
322
|
-
mergeSelected,
|
|
323
|
-
runShipAction,
|
|
324
|
-
shipPreflight
|
|
325
|
-
} from "./chunk-3GIH4WTA.js";
|
|
326
|
-
import {
|
|
327
|
-
git
|
|
328
|
-
} from "./chunk-YIODX4PM.js";
|
|
329
337
|
import {
|
|
330
338
|
DECISION_MARKER,
|
|
331
339
|
STAGE_WANTS_YOU,
|
|
@@ -350,6 +358,7 @@ import {
|
|
|
350
358
|
disposeAllScopes,
|
|
351
359
|
findScope,
|
|
352
360
|
findSession,
|
|
361
|
+
findSessionById,
|
|
353
362
|
getScope,
|
|
354
363
|
headAdvancedSinceInitial,
|
|
355
364
|
headBroughtInOtherWork,
|
|
@@ -381,6 +390,7 @@ import {
|
|
|
381
390
|
scopesToSweep,
|
|
382
391
|
searchConversations,
|
|
383
392
|
sessionOwnsScope,
|
|
393
|
+
sessionRepos,
|
|
384
394
|
setCheckpointLabel,
|
|
385
395
|
setSessionArchived,
|
|
386
396
|
setSessionBase,
|
|
@@ -399,9 +409,10 @@ import {
|
|
|
399
409
|
turnInProgress,
|
|
400
410
|
updateCheckpoint,
|
|
401
411
|
writeArchiveRecord
|
|
402
|
-
} from "./chunk-
|
|
412
|
+
} from "./chunk-RFQRVXFQ.js";
|
|
403
413
|
import {
|
|
404
414
|
activityRoots,
|
|
415
|
+
agentFor,
|
|
405
416
|
agentOf,
|
|
406
417
|
agentWriteMs,
|
|
407
418
|
detachHere,
|
|
@@ -411,7 +422,7 @@ import {
|
|
|
411
422
|
liveAgents,
|
|
412
423
|
readJsonlSince,
|
|
413
424
|
recentProcessTable
|
|
414
|
-
} from "./chunk-
|
|
425
|
+
} from "./chunk-JCMGIW7G.js";
|
|
415
426
|
import {
|
|
416
427
|
spawn_default
|
|
417
428
|
} from "./chunk-RCYI7SRA.js";
|
|
@@ -425,11 +436,11 @@ import {
|
|
|
425
436
|
sessionIdFor,
|
|
426
437
|
tx,
|
|
427
438
|
withDb
|
|
428
|
-
} from "./chunk-
|
|
439
|
+
} from "./chunk-FXHTSSV2.js";
|
|
429
440
|
import {
|
|
430
441
|
report
|
|
431
|
-
} from "./chunk-
|
|
432
|
-
import "./chunk-
|
|
442
|
+
} from "./chunk-S4ILKUFN.js";
|
|
443
|
+
import "./chunk-FRCV6NWT.js";
|
|
433
444
|
import {
|
|
434
445
|
DEFAULT_PROMPTS,
|
|
435
446
|
DEFAULT_TIME_SETTINGS,
|
|
@@ -437,13 +448,13 @@ import {
|
|
|
437
448
|
getConfigDir,
|
|
438
449
|
isWorkday,
|
|
439
450
|
loadConfig
|
|
440
|
-
} from "./chunk-
|
|
451
|
+
} from "./chunk-A53IRCOO.js";
|
|
441
452
|
|
|
442
453
|
// src/commands/web.ts
|
|
443
454
|
import chalk from "chalk";
|
|
444
455
|
|
|
445
456
|
// src/server/web-server.ts
|
|
446
|
-
import
|
|
457
|
+
import fs14 from "fs";
|
|
447
458
|
|
|
448
459
|
// src/server/routes/session-control-routes.ts
|
|
449
460
|
function realDeps(app) {
|
|
@@ -808,6 +819,118 @@ function mountForkRoutes(app, opts) {
|
|
|
808
819
|
});
|
|
809
820
|
}
|
|
810
821
|
|
|
822
|
+
// src/server/routes/session-repo-routes.ts
|
|
823
|
+
import fs from "fs";
|
|
824
|
+
import { zValidator as zValidator2 } from "@hono/zod-validator";
|
|
825
|
+
import { z as z2 } from "zod";
|
|
826
|
+
function scopeReleaser(api) {
|
|
827
|
+
return (_id, paths) => void api?.releaseSessionScope(paths, false);
|
|
828
|
+
}
|
|
829
|
+
function mountSessionRepoRoutes(app, opts) {
|
|
830
|
+
const schema = z2.object({ alias: z2.string().min(1).max(200), base: z2.string().max(200).optional() });
|
|
831
|
+
const running = /* @__PURE__ */ new Set();
|
|
832
|
+
app.post("/api/sessions/:id/repos", zValidator2("json", schema), async (c) => {
|
|
833
|
+
const id = c.req.param("id");
|
|
834
|
+
const { alias, base: rawBase } = c.req.valid("json");
|
|
835
|
+
const base = rawBase?.trim() || void 0;
|
|
836
|
+
const config = loadConfig();
|
|
837
|
+
if (!config) return c.json({ error: "no config" }, 400);
|
|
838
|
+
const s = findSessionById(id);
|
|
839
|
+
const refusal = addRepoRefusal(s, alias, config, (p) => fs.existsSync(p), base);
|
|
840
|
+
if (refusal || !s) return c.json({ error: refusal?.error ?? "unknown session" }, refusal?.status ?? 404);
|
|
841
|
+
if (running.has(id)) return c.json({ error: "a repo is being added to this session already: wait for it" }, 409);
|
|
842
|
+
running.add(id);
|
|
843
|
+
try {
|
|
844
|
+
const r = await opts.queue(alias, async () => {
|
|
845
|
+
await opts.release(id, s.paths);
|
|
846
|
+
try {
|
|
847
|
+
return await opts.run(id, alias, base);
|
|
848
|
+
} finally {
|
|
849
|
+
await opts.release(id, s.paths);
|
|
850
|
+
}
|
|
851
|
+
});
|
|
852
|
+
opts.invalidate(id);
|
|
853
|
+
opts.broadcast("sessions-changed", { ts: Date.now() });
|
|
854
|
+
if (!r.ok) return c.json({ error: r.error }, r.status);
|
|
855
|
+
const after = findSessionById(id) ?? s;
|
|
856
|
+
const body = addedRepoNote({ alias, ...r.wire }, agentFor(config, after).instructionsFile);
|
|
857
|
+
const warnings = [...r.wire.warnings ?? []];
|
|
858
|
+
await opts.note(id, body).catch((err) => warnings.push(`couldn't tell its Claude: ${err.message}`));
|
|
859
|
+
return c.json({ ...r.wire, warnings });
|
|
860
|
+
} catch (err) {
|
|
861
|
+
return c.json({ error: `couldn't add ${alias}: ${err.message}` }, 500);
|
|
862
|
+
} finally {
|
|
863
|
+
running.delete(id);
|
|
864
|
+
}
|
|
865
|
+
});
|
|
866
|
+
}
|
|
867
|
+
|
|
868
|
+
// src/server/session-note.ts
|
|
869
|
+
function noteThroughComments(app) {
|
|
870
|
+
return async (sessionId, body) => {
|
|
871
|
+
const res = await app.request(`/api/sessions/${encodeURIComponent(sessionId)}/comments`, {
|
|
872
|
+
method: "POST",
|
|
873
|
+
headers: { "Content-Type": "application/json" },
|
|
874
|
+
body: JSON.stringify({ side: "general", status: "published", body })
|
|
875
|
+
});
|
|
876
|
+
if (!res.ok) throw new Error(`posting the note failed: ${res.status}`);
|
|
877
|
+
};
|
|
878
|
+
}
|
|
879
|
+
|
|
880
|
+
// src/core/worktree/add-repo-child.ts
|
|
881
|
+
import fs2 from "fs";
|
|
882
|
+
import path from "path";
|
|
883
|
+
var statusOf = (v) => v === 400 || v === 404 || v === 409 ? v : 500;
|
|
884
|
+
var strings = (v) => Array.isArray(v) ? v.filter((x) => typeof x === "string") : [];
|
|
885
|
+
function parseChildOutcome(stdout, stderr, code) {
|
|
886
|
+
const lines = stdout.split(/\r?\n/).map((l) => l.trim()).filter(Boolean);
|
|
887
|
+
for (let i = lines.length - 1; i >= 0; i--) {
|
|
888
|
+
if (!lines[i].startsWith("{")) continue;
|
|
889
|
+
try {
|
|
890
|
+
const v = JSON.parse(lines[i]);
|
|
891
|
+
if (typeof v.error === "string") return { ok: false, error: v.error, status: statusOf(v.status) };
|
|
892
|
+
if (v.ok === true && typeof v.path === "string" && typeof v.branch === "string" && typeof v.created === "boolean")
|
|
893
|
+
return {
|
|
894
|
+
ok: true,
|
|
895
|
+
wire: {
|
|
896
|
+
ok: true,
|
|
897
|
+
path: v.path,
|
|
898
|
+
branch: v.branch,
|
|
899
|
+
created: v.created,
|
|
900
|
+
...typeof v.from === "string" ? { from: v.from } : {},
|
|
901
|
+
imported: v.imported === true,
|
|
902
|
+
warnings: strings(v.warnings)
|
|
903
|
+
}
|
|
904
|
+
};
|
|
905
|
+
} catch {
|
|
906
|
+
}
|
|
907
|
+
}
|
|
908
|
+
return { ok: false, error: childText(stderr) || `work add-repo exited ${code ?? "(killed)"}`, status: 500 };
|
|
909
|
+
}
|
|
910
|
+
function addRepoChildArgs(sessionId, alias, base) {
|
|
911
|
+
return ["add-repo", alias, `--session-id=${sessionId}`, "--in-process", "--json", ...base ? [`--base=${base}`] : []];
|
|
912
|
+
}
|
|
913
|
+
function afterTimeout(sessionId, alias) {
|
|
914
|
+
const config = loadConfig();
|
|
915
|
+
const s = findSessionById(sessionId);
|
|
916
|
+
const repo = config?.repos[alias];
|
|
917
|
+
if (!config || !s || !repo) return "checking it out took too long (stopped)";
|
|
918
|
+
if (sessionRepos(s, config).some((r) => r.alias === alias))
|
|
919
|
+
return `checking it out took too long (stopped): ${alias} is in the session, but its Diff tab turns or instructions may not have been updated`;
|
|
920
|
+
const left = s.paths[0] ? path.join(path.dirname(s.paths[0]), path.basename(repo)) : "";
|
|
921
|
+
return left && fs2.existsSync(left) ? `checking it out took too long (stopped): ${left} was left half made \u2014 remove it, then try again` : "checking it out took too long (stopped; run `work add-repo` from a terminal to see why)";
|
|
922
|
+
}
|
|
923
|
+
function addRepoInChild(workBin, opts = {}) {
|
|
924
|
+
return async (sessionId, alias, base) => {
|
|
925
|
+
const r = await runWorkChild(workBin(), addRepoChildArgs(sessionId, alias, base), opts);
|
|
926
|
+
if (r.spawnError) return { ok: false, error: `could not run work: ${r.spawnError}`, status: 500 };
|
|
927
|
+
if (!r.timedOut) return parseChildOutcome(r.stdout, r.stderr, r.code);
|
|
928
|
+
const repo = loadConfig()?.repos[alias];
|
|
929
|
+
if (repo && fs2.existsSync(repo)) await defaultRunner("git", ["-C", repo, "worktree", "prune"], repo).catch(() => void 0);
|
|
930
|
+
return { ok: false, error: afterTimeout(sessionId, alias), status: 500 };
|
|
931
|
+
};
|
|
932
|
+
}
|
|
933
|
+
|
|
811
934
|
// src/server/routes/note-routes.ts
|
|
812
935
|
function mountNoteRoutes(app, opts) {
|
|
813
936
|
app.get("/api/sessions/:id/note", (c) => {
|
|
@@ -828,17 +951,17 @@ function mountNoteRoutes(app, opts) {
|
|
|
828
951
|
}
|
|
829
952
|
|
|
830
953
|
// src/core/worktree/code-browse.ts
|
|
831
|
-
import
|
|
832
|
-
import
|
|
954
|
+
import fs3 from "fs";
|
|
955
|
+
import path2 from "path";
|
|
833
956
|
var MAX_CODE_FILES = 5e4;
|
|
834
957
|
var MAX_CODE_FILE_BYTES = 2 * 1024 * 1024;
|
|
835
958
|
var LIST_TTL_MS = 3e3;
|
|
836
959
|
function codeRoots(s) {
|
|
837
|
-
return s.paths.map((p) => ({ name:
|
|
960
|
+
return s.paths.map((p) => ({ name: path2.basename(p), root: p }));
|
|
838
961
|
}
|
|
839
962
|
function groupRoot(s) {
|
|
840
963
|
if (!s.isGroup || s.paths.length === 0) return null;
|
|
841
|
-
const parents = [...new Set(s.paths.map((p) =>
|
|
964
|
+
const parents = [...new Set(s.paths.map((p) => path2.dirname(p)))];
|
|
842
965
|
return parents.length === 1 ? parents[0] : null;
|
|
843
966
|
}
|
|
844
967
|
var realIo = {
|
|
@@ -911,7 +1034,7 @@ async function changedFiles(root, base, io = realIo) {
|
|
|
911
1034
|
async function listCodeFiles(s, io = realIo) {
|
|
912
1035
|
const repos = await Promise.all(
|
|
913
1036
|
codeRoots(s).map(async ({ name, root }) => {
|
|
914
|
-
if (!
|
|
1037
|
+
if (!fs3.existsSync(root)) return { name, files: [], changed: [], truncated: false };
|
|
915
1038
|
const [all, changed] = await Promise.all([listRepoFiles(root, io), changedFiles(root, s.baseBranches?.[root] ?? s.baseBranch, io)]);
|
|
916
1039
|
const listed = new Set(all);
|
|
917
1040
|
return {
|
|
@@ -928,7 +1051,7 @@ function groupRootFiles(s) {
|
|
|
928
1051
|
const dir = groupRoot(s);
|
|
929
1052
|
if (!dir) return [];
|
|
930
1053
|
try {
|
|
931
|
-
return
|
|
1054
|
+
return fs3.readdirSync(dir, { withFileTypes: true }).filter((e) => e.isFile() && isGroupNote(e.name)).map((e) => e.name).sort();
|
|
932
1055
|
} catch {
|
|
933
1056
|
return [];
|
|
934
1057
|
}
|
|
@@ -947,12 +1070,12 @@ async function codeFilePath(s, repo, rel, io = realIo) {
|
|
|
947
1070
|
if (!root) return { error: "unknown repo" };
|
|
948
1071
|
if (!allowed) return { error: "not listed" };
|
|
949
1072
|
try {
|
|
950
|
-
const full =
|
|
951
|
-
const realRoot =
|
|
952
|
-
const real =
|
|
953
|
-
const inside2 =
|
|
954
|
-
if (!inside2 || inside2.startsWith("..") ||
|
|
955
|
-
const st =
|
|
1073
|
+
const full = path2.resolve(root, rel);
|
|
1074
|
+
const realRoot = fs3.realpathSync.native(root);
|
|
1075
|
+
const real = fs3.realpathSync.native(full);
|
|
1076
|
+
const inside2 = path2.relative(realRoot, real);
|
|
1077
|
+
if (!inside2 || inside2.startsWith("..") || path2.isAbsolute(inside2)) return { error: "not listed" };
|
|
1078
|
+
const st = fs3.statSync(real);
|
|
956
1079
|
if (!st.isFile()) return { error: "unreadable" };
|
|
957
1080
|
return { real, size: st.size };
|
|
958
1081
|
} catch (err) {
|
|
@@ -964,7 +1087,7 @@ async function readCodeFile(s, repo, rel, io = realIo) {
|
|
|
964
1087
|
if ("error" in at) return at;
|
|
965
1088
|
if (at.size > MAX_CODE_FILE_BYTES) return { repo, path: rel, size: at.size, text: null, reason: "too-large" };
|
|
966
1089
|
try {
|
|
967
|
-
const buf = await
|
|
1090
|
+
const buf = await fs3.promises.readFile(at.real);
|
|
968
1091
|
if (buf.subarray(0, 8e3).includes(0)) return { repo, path: rel, size: at.size, text: null, reason: "binary" };
|
|
969
1092
|
return { repo, path: rel, size: at.size, text: buf.toString("utf-8") };
|
|
970
1093
|
} catch (err) {
|
|
@@ -975,8 +1098,8 @@ async function readCodeFile(s, repo, rel, io = realIo) {
|
|
|
975
1098
|
// src/core/worktree/code-symbols.ts
|
|
976
1099
|
var MAX_LINE_CHARS = 240;
|
|
977
1100
|
function parseGrepLine(line) {
|
|
978
|
-
const
|
|
979
|
-
if (
|
|
1101
|
+
const z7 = /^([^\0]+)\0(\d+)\0(.*)$/.exec(line);
|
|
1102
|
+
if (z7) return { path: z7[1], line: Number(z7[2]), text: z7[3] };
|
|
980
1103
|
const m = /^(.+?):(\d+):(.*)$/.exec(line);
|
|
981
1104
|
return m ? { path: m[1], line: Number(m[2]), text: m[3] } : null;
|
|
982
1105
|
}
|
|
@@ -1045,9 +1168,9 @@ var NOT_NAMES = /* @__PURE__ */ new Set([
|
|
|
1045
1168
|
"typeof",
|
|
1046
1169
|
"await"
|
|
1047
1170
|
]);
|
|
1048
|
-
function declarationOf(
|
|
1171
|
+
function declarationOf(path17, text) {
|
|
1049
1172
|
for (const r of RULES) {
|
|
1050
|
-
if (!r.ext.test(
|
|
1173
|
+
if (!r.ext.test(path17)) continue;
|
|
1051
1174
|
const m = r.re.exec(text);
|
|
1052
1175
|
if (!m) continue;
|
|
1053
1176
|
const name = r.name(m);
|
|
@@ -1404,8 +1527,8 @@ function mountSetupRoutes(app, opts) {
|
|
|
1404
1527
|
}
|
|
1405
1528
|
|
|
1406
1529
|
// src/core/updates/update-source.ts
|
|
1407
|
-
import
|
|
1408
|
-
import
|
|
1530
|
+
import fs4 from "fs";
|
|
1531
|
+
import path3 from "path";
|
|
1409
1532
|
|
|
1410
1533
|
// src/core/updates/updates.ts
|
|
1411
1534
|
function parseVersion(v) {
|
|
@@ -1490,8 +1613,8 @@ function parseDesktopUpdate(text) {
|
|
|
1490
1613
|
var RELEASES_REPO = "moberghr/cli-work-tree-manager";
|
|
1491
1614
|
var RELEASES_URL = `https://api.github.com/repos/${RELEASES_REPO}/releases?per_page=30`;
|
|
1492
1615
|
var SEEN_KEY = "ui:seen-version";
|
|
1493
|
-
var desktopUpdatePath = () =>
|
|
1494
|
-
var desktopRequestPath = () =>
|
|
1616
|
+
var desktopUpdatePath = () => path3.join(getConfigDir(), "desktop-update.json");
|
|
1617
|
+
var desktopRequestPath = () => path3.join(getConfigDir(), "desktop-request.json");
|
|
1495
1618
|
async function fetchReleases(get = (url) => fetch(url, { headers: { "User-Agent": "work", Accept: "application/vnd.github+json" }, signal: AbortSignal.timeout(15e3) }), run = defaultRunner) {
|
|
1496
1619
|
const why = await get(RELEASES_URL).then(
|
|
1497
1620
|
async (res) => res.ok ? parseReleases(await res.json()) : res.status === 403 ? "GitHub's limit for this address is spent" : `GitHub answered ${res.status}`,
|
|
@@ -1510,7 +1633,7 @@ async function fetchReleases(get = (url) => fetch(url, { headers: { "User-Agent"
|
|
|
1510
1633
|
function readDesktopUpdate(file = desktopUpdatePath()) {
|
|
1511
1634
|
let text;
|
|
1512
1635
|
try {
|
|
1513
|
-
text =
|
|
1636
|
+
text = fs4.readFileSync(file, "utf-8");
|
|
1514
1637
|
} catch {
|
|
1515
1638
|
return null;
|
|
1516
1639
|
}
|
|
@@ -1532,7 +1655,7 @@ function markSeenVersion(version) {
|
|
|
1532
1655
|
}
|
|
1533
1656
|
function installKind() {
|
|
1534
1657
|
const root = packageRoot();
|
|
1535
|
-
return installKindOf(root, getConfigDir(), !!root &&
|
|
1658
|
+
return installKindOf(root, getConfigDir(), !!root && fs4.existsSync(path3.join(root, ".git")));
|
|
1536
1659
|
}
|
|
1537
1660
|
var defaultDeps = () => ({
|
|
1538
1661
|
fetchReleases: () => fetchReleases(),
|
|
@@ -1703,7 +1826,7 @@ function mountRepoRoutes(app, opts) {
|
|
|
1703
1826
|
}
|
|
1704
1827
|
|
|
1705
1828
|
// src/core/conversations/timeline-source.ts
|
|
1706
|
-
import
|
|
1829
|
+
import path4 from "path";
|
|
1707
1830
|
|
|
1708
1831
|
// src/core/conversations/timeline.ts
|
|
1709
1832
|
var SIZE_LABEL = /^(\d+ files? · \+\d+ −\d+|no changes)$/;
|
|
@@ -1752,7 +1875,7 @@ async function commitsOf(repo, since, run) {
|
|
|
1752
1875
|
if (log.code !== 0) return [];
|
|
1753
1876
|
return log.stdout.split("\n").filter(Boolean).map((line) => {
|
|
1754
1877
|
const [sha, at, ...subject] = line.split(" ");
|
|
1755
|
-
return { repo:
|
|
1878
|
+
return { repo: path4.basename(repo), sha, at, subject: subject.join(" ") };
|
|
1756
1879
|
});
|
|
1757
1880
|
}
|
|
1758
1881
|
async function sessionTimeline(s, deps = {}) {
|
|
@@ -1820,8 +1943,8 @@ function mountBlockRoutes(app, opts) {
|
|
|
1820
1943
|
}
|
|
1821
1944
|
|
|
1822
1945
|
// src/server/routes/jira-watch-routes.ts
|
|
1823
|
-
import
|
|
1824
|
-
import
|
|
1946
|
+
import fs5 from "fs";
|
|
1947
|
+
import path5 from "path";
|
|
1825
1948
|
|
|
1826
1949
|
// src/core/jira/jira-prompt.ts
|
|
1827
1950
|
var branchFor = (issue) => `feat/${issue.key}`;
|
|
@@ -2042,16 +2165,16 @@ async function sweepJira(deps) {
|
|
|
2042
2165
|
var EVERY_MS = 5 * 6e4;
|
|
2043
2166
|
function aboutRepo(dir) {
|
|
2044
2167
|
try {
|
|
2045
|
-
const readme = ["README.md", "readme.md", "README"].map((n) =>
|
|
2168
|
+
const readme = ["README.md", "readme.md", "README"].map((n) => path5.join(dir, n)).find((f) => fs5.existsSync(f));
|
|
2046
2169
|
if (readme) {
|
|
2047
|
-
const line =
|
|
2170
|
+
const line = fs5.readFileSync(readme, "utf8").split(/\r?\n/).map(
|
|
2048
2171
|
(l) => l.replace(/^[#>*\-\s]+/, "").replace(/[`*_[\]]/g, "").trim()
|
|
2049
2172
|
).find((l) => l.length > 20 && !/^(!|<|http)/.test(l));
|
|
2050
2173
|
if (line) return line.slice(0, 160);
|
|
2051
2174
|
}
|
|
2052
|
-
const pkg =
|
|
2053
|
-
if (
|
|
2054
|
-
const d = JSON.parse(
|
|
2175
|
+
const pkg = path5.join(dir, "package.json");
|
|
2176
|
+
if (fs5.existsSync(pkg)) {
|
|
2177
|
+
const d = JSON.parse(fs5.readFileSync(pkg, "utf8")).description;
|
|
2055
2178
|
if (typeof d === "string" && d.trim()) return d.trim().slice(0, 160);
|
|
2056
2179
|
}
|
|
2057
2180
|
} catch {
|
|
@@ -2063,7 +2186,7 @@ function watchTargets(cfg = loadConfig()) {
|
|
|
2063
2186
|
const repos = Object.entries(cfg.repos).map(([alias, dir]) => ({
|
|
2064
2187
|
name: alias,
|
|
2065
2188
|
kind: "repo",
|
|
2066
|
-
members: [
|
|
2189
|
+
members: [path5.basename(dir)],
|
|
2067
2190
|
about: aboutRepo(dir)
|
|
2068
2191
|
}));
|
|
2069
2192
|
const groups = Object.entries(cfg.groups).map(([name, aliases]) => ({ name, kind: "group", members: aliases }));
|
|
@@ -2237,12 +2360,12 @@ function describeStall(s) {
|
|
|
2237
2360
|
}
|
|
2238
2361
|
|
|
2239
2362
|
// src/server/web-server.ts
|
|
2240
|
-
import
|
|
2363
|
+
import path15 from "path";
|
|
2241
2364
|
import { Hono } from "hono";
|
|
2242
2365
|
import { streamSSE as streamSSE2 } from "hono/streaming";
|
|
2243
2366
|
|
|
2244
2367
|
// src/server/routes/session-comment-routes.ts
|
|
2245
|
-
import { zValidator as
|
|
2368
|
+
import { zValidator as zValidator3 } from "@hono/zod-validator";
|
|
2246
2369
|
function mountSessionCommentRoutes(app, opts) {
|
|
2247
2370
|
function requireSession(id) {
|
|
2248
2371
|
return findSession2(id);
|
|
@@ -2264,7 +2387,7 @@ function mountSessionCommentRoutes(app, opts) {
|
|
|
2264
2387
|
if (!ctx) return c.json({ error: "unknown session" }, 404);
|
|
2265
2388
|
return c.json({ comments: listFor(ctx) });
|
|
2266
2389
|
});
|
|
2267
|
-
app.post("/api/sessions/:id/comments",
|
|
2390
|
+
app.post("/api/sessions/:id/comments", zValidator3("json", commentInputSchema), (c) => {
|
|
2268
2391
|
const id = c.req.param("id");
|
|
2269
2392
|
const ctx = context(id);
|
|
2270
2393
|
if (!ctx) return c.json({ error: "unknown session" }, 404);
|
|
@@ -2289,7 +2412,7 @@ function mountSessionCommentRoutes(app, opts) {
|
|
|
2289
2412
|
if (home && getCommentFileStore(home).remove(cid)) changed(ctx, home, { deleted: cid });
|
|
2290
2413
|
return c.json({ comments: listFor(ctx) });
|
|
2291
2414
|
});
|
|
2292
|
-
app.post("/api/sessions/:id/comments/:cid/resolve",
|
|
2415
|
+
app.post("/api/sessions/:id/comments/:cid/resolve", zValidator3("json", resolveSchema), (c) => {
|
|
2293
2416
|
const cid = c.req.param("cid");
|
|
2294
2417
|
const ctx = context(c.req.param("id"));
|
|
2295
2418
|
if (!ctx) return c.json({ error: "unknown session" }, 404);
|
|
@@ -2298,7 +2421,7 @@ function mountSessionCommentRoutes(app, opts) {
|
|
|
2298
2421
|
if (home && updated) changed(ctx, home, { id: updated.id });
|
|
2299
2422
|
return c.json({ comments: listFor(ctx) });
|
|
2300
2423
|
});
|
|
2301
|
-
app.post("/api/sessions/:id/submit-review",
|
|
2424
|
+
app.post("/api/sessions/:id/submit-review", zValidator3("json", submitReviewSchema), (c) => {
|
|
2302
2425
|
const id = c.req.param("id");
|
|
2303
2426
|
const ctx = context(id);
|
|
2304
2427
|
if (!ctx) return c.json({ error: "unknown session" }, 404);
|
|
@@ -2336,8 +2459,8 @@ async function typeAndSubmit(sessionId, text, write = writeToPty, wait) {
|
|
|
2336
2459
|
}
|
|
2337
2460
|
|
|
2338
2461
|
// src/server/routes/panes-routes.ts
|
|
2339
|
-
import { zValidator as
|
|
2340
|
-
import { z as
|
|
2462
|
+
import { zValidator as zValidator4 } from "@hono/zod-validator";
|
|
2463
|
+
import { z as z3 } from "zod";
|
|
2341
2464
|
|
|
2342
2465
|
// src/core/worktree/branch-check.ts
|
|
2343
2466
|
import os from "os";
|
|
@@ -2497,21 +2620,21 @@ function mountPanesRoutes(app, opts) {
|
|
|
2497
2620
|
}
|
|
2498
2621
|
});
|
|
2499
2622
|
app.get("/api/tasks", (c) => c.json({ tasks: getTasks() }));
|
|
2500
|
-
const newTaskSchema =
|
|
2501
|
-
text:
|
|
2502
|
-
link:
|
|
2623
|
+
const newTaskSchema = z3.object({
|
|
2624
|
+
text: z3.string().min(1),
|
|
2625
|
+
link: z3.string().optional()
|
|
2503
2626
|
});
|
|
2504
|
-
app.post("/api/tasks",
|
|
2627
|
+
app.post("/api/tasks", zValidator4("json", newTaskSchema), async (c) => {
|
|
2505
2628
|
const { text, link } = c.req.valid("json");
|
|
2506
2629
|
const task = await addTask(text, link);
|
|
2507
2630
|
opts.broadcast("tasks-changed", { id: task.id });
|
|
2508
2631
|
return c.json({ task, tasks: getTasks() });
|
|
2509
2632
|
});
|
|
2510
|
-
const editSchema =
|
|
2511
|
-
text:
|
|
2512
|
-
done:
|
|
2633
|
+
const editSchema = z3.object({
|
|
2634
|
+
text: z3.string().min(1).optional(),
|
|
2635
|
+
done: z3.boolean().optional()
|
|
2513
2636
|
});
|
|
2514
|
-
app.patch("/api/tasks/:id",
|
|
2637
|
+
app.patch("/api/tasks/:id", zValidator4("json", editSchema), async (c) => {
|
|
2515
2638
|
const id = Number(c.req.param("id"));
|
|
2516
2639
|
if (!Number.isFinite(id)) {
|
|
2517
2640
|
return c.json({ error: "invalid id" }, 400);
|
|
@@ -2539,23 +2662,23 @@ function mountPanesRoutes(app, opts) {
|
|
|
2539
2662
|
}
|
|
2540
2663
|
|
|
2541
2664
|
// src/server/routes/worktree-routes.ts
|
|
2542
|
-
import
|
|
2543
|
-
import
|
|
2665
|
+
import fs6 from "fs";
|
|
2666
|
+
import path6 from "path";
|
|
2544
2667
|
import { spawn } from "child_process";
|
|
2545
2668
|
import crossSpawn2 from "cross-spawn";
|
|
2546
|
-
import { zValidator as
|
|
2547
|
-
import { z as
|
|
2669
|
+
import { zValidator as zValidator5 } from "@hono/zod-validator";
|
|
2670
|
+
import { z as z4 } from "zod";
|
|
2548
2671
|
function mountWorktreeRoutes(app, opts) {
|
|
2549
|
-
const createSchema =
|
|
2550
|
-
target:
|
|
2672
|
+
const createSchema = z4.object({
|
|
2673
|
+
target: z4.string().min(1),
|
|
2551
2674
|
/** Empty or left out: the repo's own checkout, on the branch it has (`work tree <repo>`). */
|
|
2552
|
-
branch:
|
|
2553
|
-
base:
|
|
2554
|
-
jiraKey:
|
|
2675
|
+
branch: z4.string().optional(),
|
|
2676
|
+
base: z4.string().optional(),
|
|
2677
|
+
jiraKey: z4.string().optional(),
|
|
2555
2678
|
/** Start Claude with this as its first message. */
|
|
2556
|
-
prompt:
|
|
2679
|
+
prompt: z4.string().max(2e4).optional(),
|
|
2557
2680
|
/** Name the session (its title); the branch stays its identity. */
|
|
2558
|
-
name:
|
|
2681
|
+
name: z4.string().max(120).optional()
|
|
2559
2682
|
});
|
|
2560
2683
|
const startSession = opts.startSession ?? startSessionWithPrompt;
|
|
2561
2684
|
const create = opts.create ?? createInProcess;
|
|
@@ -2565,7 +2688,7 @@ function mountWorktreeRoutes(app, opts) {
|
|
|
2565
2688
|
const r = await resolvePr(ref, c.req.query("target") || void 0);
|
|
2566
2689
|
return r.ok ? c.json({ pr: r.pr }) : c.json({ error: r.error }, 400);
|
|
2567
2690
|
});
|
|
2568
|
-
app.post("/api/worktrees",
|
|
2691
|
+
app.post("/api/worktrees", zValidator5("json", createSchema), async (c) => {
|
|
2569
2692
|
const { target, base, jiraKey, prompt, name } = c.req.valid("json");
|
|
2570
2693
|
const config = loadConfig();
|
|
2571
2694
|
if (!config) return c.json({ error: "no config" }, 400);
|
|
@@ -2596,6 +2719,7 @@ function mountWorktreeRoutes(app, opts) {
|
|
|
2596
2719
|
sessionId: id,
|
|
2597
2720
|
launchDir: result.launchDir,
|
|
2598
2721
|
paths: result.paths,
|
|
2722
|
+
...made.warnings?.length ? { warnings: made.warnings } : {},
|
|
2599
2723
|
...started ? { started } : {},
|
|
2600
2724
|
...startError ? { startError } : {}
|
|
2601
2725
|
});
|
|
@@ -2604,12 +2728,12 @@ function mountWorktreeRoutes(app, opts) {
|
|
|
2604
2728
|
}
|
|
2605
2729
|
});
|
|
2606
2730
|
const REFUSED = "Worktree not removed: uncommitted changes, unpushed commits, or git refused. Retry with force, or forget the session only.";
|
|
2607
|
-
const removeSchema =
|
|
2608
|
-
force:
|
|
2609
|
-
sessionOnly:
|
|
2731
|
+
const removeSchema = z4.object({
|
|
2732
|
+
force: z4.boolean().optional(),
|
|
2733
|
+
sessionOnly: z4.boolean().optional()
|
|
2610
2734
|
});
|
|
2611
2735
|
const deleting = /* @__PURE__ */ new Map();
|
|
2612
|
-
app.delete("/api/sessions/:id/worktree",
|
|
2736
|
+
app.delete("/api/sessions/:id/worktree", zValidator5("json", removeSchema), async (c) => {
|
|
2613
2737
|
const id = c.req.param("id");
|
|
2614
2738
|
const asked = c.req.valid("json");
|
|
2615
2739
|
const key = `${!!asked.force}:${!!asked.sessionOnly}`;
|
|
@@ -2635,7 +2759,7 @@ function mountWorktreeRoutes(app, opts) {
|
|
|
2635
2759
|
if (waiting.length) return { body: { error: `Not deleted: ${waiting.join("; ")}.`, blocked: waiting }, status: 409 };
|
|
2636
2760
|
}
|
|
2637
2761
|
try {
|
|
2638
|
-
const onDisk = session.paths.some((p) =>
|
|
2762
|
+
const onDisk = session.paths.some((p) => fs6.existsSync(p));
|
|
2639
2763
|
if (!sessionOnly && onDisk && session.paths.some((p) => wouldRefuseRemoval(p, force ?? false))) {
|
|
2640
2764
|
return { body: { error: REFUSED }, status: 409 };
|
|
2641
2765
|
}
|
|
@@ -2693,10 +2817,10 @@ function mountWorktreeRoutes(app, opts) {
|
|
|
2693
2817
|
opts.broadcast("sessions-changed", { ts: Date.now() });
|
|
2694
2818
|
return c.json({ results });
|
|
2695
2819
|
});
|
|
2696
|
-
const openFileSchema =
|
|
2697
|
-
repo:
|
|
2698
|
-
path:
|
|
2699
|
-
line:
|
|
2820
|
+
const openFileSchema = z4.object({
|
|
2821
|
+
repo: z4.string().max(200),
|
|
2822
|
+
path: z4.string().min(1).max(4096),
|
|
2823
|
+
line: z4.number().int().positive().max(1e7).optional()
|
|
2700
2824
|
});
|
|
2701
2825
|
app.post("/api/sessions/:id/open-editor", async (c) => {
|
|
2702
2826
|
const id = c.req.param("id");
|
|
@@ -2706,7 +2830,7 @@ function mountWorktreeRoutes(app, opts) {
|
|
|
2706
2830
|
const wantsFile = !!body && typeof body === "object" && "path" in body;
|
|
2707
2831
|
const asked = wantsFile ? openFileSchema.safeParse(body) : null;
|
|
2708
2832
|
if (asked && !asked.success) return c.json({ error: "repo and path required" }, 400);
|
|
2709
|
-
const folder = session.isGroup ?
|
|
2833
|
+
const folder = session.isGroup ? path6.dirname(session.paths[0]) : session.paths[0];
|
|
2710
2834
|
let file;
|
|
2711
2835
|
if (asked?.success) {
|
|
2712
2836
|
const at = await codeFilePath(session, asked.data.repo, asked.data.path);
|
|
@@ -2765,10 +2889,10 @@ function mountWorktreeRoutes(app, opts) {
|
|
|
2765
2889
|
}
|
|
2766
2890
|
|
|
2767
2891
|
// src/server/routes/scope-routes.ts
|
|
2768
|
-
import { zValidator as
|
|
2769
|
-
import { z as
|
|
2892
|
+
import { zValidator as zValidator6 } from "@hono/zod-validator";
|
|
2893
|
+
import { z as z5 } from "zod";
|
|
2770
2894
|
import { EventEmitter } from "events";
|
|
2771
|
-
import
|
|
2895
|
+
import path7 from "path";
|
|
2772
2896
|
import { streamSSE } from "hono/streaming";
|
|
2773
2897
|
function mountScopeRoutes(app, opts) {
|
|
2774
2898
|
const checkpointWatched = /* @__PURE__ */ new Set();
|
|
@@ -2884,11 +3008,11 @@ function mountScopeRoutes(app, opts) {
|
|
|
2884
3008
|
}
|
|
2885
3009
|
app.post(
|
|
2886
3010
|
"/api/scopes",
|
|
2887
|
-
|
|
3011
|
+
zValidator6(
|
|
2888
3012
|
"json",
|
|
2889
|
-
|
|
2890
|
-
paths:
|
|
2891
|
-
label:
|
|
3013
|
+
z5.object({
|
|
3014
|
+
paths: z5.array(z5.string().min(1)).min(1),
|
|
3015
|
+
label: z5.string().optional()
|
|
2892
3016
|
})
|
|
2893
3017
|
),
|
|
2894
3018
|
(c) => {
|
|
@@ -2909,7 +3033,7 @@ function mountScopeRoutes(app, opts) {
|
|
|
2909
3033
|
}
|
|
2910
3034
|
);
|
|
2911
3035
|
app.get("/api/scopes", (c) => c.json({ scopes: listScopes() }));
|
|
2912
|
-
app.post("/api/checkpoint",
|
|
3036
|
+
app.post("/api/checkpoint", zValidator6("json", z5.object({ cwd: z5.string().min(1) })), async (c) => {
|
|
2913
3037
|
const { cwd } = c.req.valid("json");
|
|
2914
3038
|
const matched = scopesForCwd(cwd);
|
|
2915
3039
|
let snapshotted = 0;
|
|
@@ -2942,7 +3066,7 @@ function mountScopeRoutes(app, opts) {
|
|
|
2942
3066
|
}
|
|
2943
3067
|
return c.json({ ok: true, scopes: matched.length, snapshotted });
|
|
2944
3068
|
});
|
|
2945
|
-
app.post("/api/checkpoint/seal",
|
|
3069
|
+
app.post("/api/checkpoint/seal", zValidator6("json", z5.object({ cwd: z5.string().min(1) })), (c) => {
|
|
2946
3070
|
const { cwd } = c.req.valid("json");
|
|
2947
3071
|
const matched = scopesForCwd(cwd);
|
|
2948
3072
|
let sealed = 0;
|
|
@@ -3008,7 +3132,7 @@ function mountScopeRoutes(app, opts) {
|
|
|
3008
3132
|
const fromSha = fromEntry.repos[p] ?? "HEAD";
|
|
3009
3133
|
const toSha = toEntry === void 0 ? "working" : toEntry.repos[p] ?? "HEAD";
|
|
3010
3134
|
return {
|
|
3011
|
-
name:
|
|
3135
|
+
name: path7.basename(p),
|
|
3012
3136
|
root: p,
|
|
3013
3137
|
files: computeRangeDiff({ root: p, fromRef: fromSha, toRef: toSha })
|
|
3014
3138
|
};
|
|
@@ -3025,7 +3149,7 @@ function mountScopeRoutes(app, opts) {
|
|
|
3025
3149
|
}
|
|
3026
3150
|
const resolved = scope.paths.map((p) => resolveRepoDiff(p, base, sessionBaseForPath(p)));
|
|
3027
3151
|
const repos = scope.paths.map((p, i) => ({
|
|
3028
|
-
name:
|
|
3152
|
+
name: path7.basename(p),
|
|
3029
3153
|
root: p,
|
|
3030
3154
|
resolvedBase: resolved[i].resolvedBase,
|
|
3031
3155
|
files: computeDiff({ root: p, diffArg: resolved[i].diffArg })
|
|
@@ -3056,7 +3180,7 @@ function mountScopeRoutes(app, opts) {
|
|
|
3056
3180
|
if (!relPath || !Number.isInteger(start) || !Number.isInteger(end)) {
|
|
3057
3181
|
return c.json({ error: "bad path/start/end" }, 400);
|
|
3058
3182
|
}
|
|
3059
|
-
const root = scope.paths.length === 1 ? scope.paths[0] : scope.paths.find((p) =>
|
|
3183
|
+
const root = scope.paths.length === 1 ? scope.paths[0] : scope.paths.find((p) => path7.basename(p) === repoName);
|
|
3060
3184
|
if (!root) return c.json({ error: "unknown repo" }, 404);
|
|
3061
3185
|
const result = readContextLines({ root, relPath, start, end, ref });
|
|
3062
3186
|
if (!result) return c.json({ error: "cannot read file" }, 400);
|
|
@@ -3108,7 +3232,7 @@ function mountScopeRoutes(app, opts) {
|
|
|
3108
3232
|
ended: scope.ended
|
|
3109
3233
|
});
|
|
3110
3234
|
});
|
|
3111
|
-
app.post("/api/scopes/:hash/comments",
|
|
3235
|
+
app.post("/api/scopes/:hash/comments", zValidator6("json", commentInputSchema), (c) => {
|
|
3112
3236
|
const scope = getScope(c.req.param("hash"));
|
|
3113
3237
|
if (!scope) return c.json({ error: "unknown scope" }, 404);
|
|
3114
3238
|
const ctx = context(scope.hash);
|
|
@@ -3133,7 +3257,7 @@ function mountScopeRoutes(app, opts) {
|
|
|
3133
3257
|
if (home && getCommentFileStore(home).remove(cid)) storeChanged(ctx, home, { deleted: cid });
|
|
3134
3258
|
return c.json({ comments: listFor(ctx) });
|
|
3135
3259
|
});
|
|
3136
|
-
app.post("/api/scopes/:hash/comments/:cid/resolve",
|
|
3260
|
+
app.post("/api/scopes/:hash/comments/:cid/resolve", zValidator6("json", resolveSchema), (c) => {
|
|
3137
3261
|
const scope = getScope(c.req.param("hash"));
|
|
3138
3262
|
if (!scope) return c.json({ error: "unknown scope" }, 404);
|
|
3139
3263
|
const ctx = context(scope.hash);
|
|
@@ -3143,7 +3267,7 @@ function mountScopeRoutes(app, opts) {
|
|
|
3143
3267
|
if (home && updated) storeChanged(ctx, home, { id: updated.id });
|
|
3144
3268
|
return c.json({ comments: listFor(ctx) });
|
|
3145
3269
|
});
|
|
3146
|
-
app.post("/api/scopes/:hash/submit-review",
|
|
3270
|
+
app.post("/api/scopes/:hash/submit-review", zValidator6("json", submitReviewSchema), (c) => {
|
|
3147
3271
|
const scope = getScope(c.req.param("hash"));
|
|
3148
3272
|
if (!scope) return c.json({ error: "unknown scope" }, 404);
|
|
3149
3273
|
const ctx = context(scope.hash);
|
|
@@ -3239,7 +3363,7 @@ function mountTerminalRoutes(app) {
|
|
|
3239
3363
|
}
|
|
3240
3364
|
|
|
3241
3365
|
// src/server/routes/status-routes.ts
|
|
3242
|
-
import
|
|
3366
|
+
import path8 from "path";
|
|
3243
3367
|
|
|
3244
3368
|
// src/core/pr/pr-watch-store.ts
|
|
3245
3369
|
function createSeenStores() {
|
|
@@ -3433,7 +3557,7 @@ function mountStatusRoutes(app, opts) {
|
|
|
3433
3557
|
const kind = notifyKindForTransition(status.prevState ? { state: status.prevState } : null, status);
|
|
3434
3558
|
if (kind) {
|
|
3435
3559
|
const config = loadConfig();
|
|
3436
|
-
const launchDir = session.isGroup && session.paths[0] ?
|
|
3560
|
+
const launchDir = session.isGroup && session.paths[0] ? path8.dirname(session.paths[0]) : session.paths[0] ?? body.cwd;
|
|
3437
3561
|
const name = `${session.target} \xB7 ${session.branch}`;
|
|
3438
3562
|
const snooze = readSnooze(id);
|
|
3439
3563
|
const route = snooze?.until && snoozeActive(snooze, { attention: status }) ? "none" : presence.route(id);
|
|
@@ -3537,6 +3661,7 @@ function mountShipRoutes(app, opts) {
|
|
|
3537
3661
|
const session = findSession2(id);
|
|
3538
3662
|
if (!session) return { ok: false };
|
|
3539
3663
|
let ok;
|
|
3664
|
+
let warnings = [];
|
|
3540
3665
|
if (archived) {
|
|
3541
3666
|
const out = await archiveSession(session, defaultArchiveDeps({ release: opts.release }), {
|
|
3542
3667
|
force,
|
|
@@ -3569,12 +3694,13 @@ function mountShipRoutes(app, opts) {
|
|
|
3569
3694
|
};
|
|
3570
3695
|
}
|
|
3571
3696
|
ok = true;
|
|
3697
|
+
warnings = made.warnings ?? [];
|
|
3572
3698
|
} else {
|
|
3573
3699
|
restoreArchivedTranscripts(session);
|
|
3574
3700
|
ok = await setSessionArchived(session.target, session.branch, false);
|
|
3575
3701
|
}
|
|
3576
3702
|
opts.broadcast("sessions-changed", { ts: Date.now() });
|
|
3577
|
-
return { ok };
|
|
3703
|
+
return warnings.length ? { ok, warnings } : { ok };
|
|
3578
3704
|
};
|
|
3579
3705
|
app.post("/api/sessions/:id/title", async (c) => {
|
|
3580
3706
|
const session = findSession2(c.req.param("id"));
|
|
@@ -3629,7 +3755,7 @@ function mountShipRoutes(app, opts) {
|
|
|
3629
3755
|
if (r.blocked) return c.json({ error: r.message, blocked: r.blocked }, 409);
|
|
3630
3756
|
if (r.holders) return c.json({ error: r.error, holders: r.holders }, 409);
|
|
3631
3757
|
if (r.error) return c.json({ error: r.error }, 500);
|
|
3632
|
-
return r.ok ? c.json({ ok: true }) : c.json({ error: "unknown session" }, 404);
|
|
3758
|
+
return r.ok ? c.json({ ok: true, ...r.warnings?.length ? { warnings: r.warnings } : {} }) : c.json({ error: "unknown session" }, 404);
|
|
3633
3759
|
});
|
|
3634
3760
|
}
|
|
3635
3761
|
function parseSelection(v) {
|
|
@@ -3723,9 +3849,9 @@ function mountRailRoutes(app, opts) {
|
|
|
3723
3849
|
}
|
|
3724
3850
|
|
|
3725
3851
|
// src/core/worktree/shared-folders.ts
|
|
3726
|
-
import
|
|
3727
|
-
import
|
|
3728
|
-
var norm = (p) =>
|
|
3852
|
+
import fs7 from "fs";
|
|
3853
|
+
import path9 from "path";
|
|
3854
|
+
var norm = (p) => path9.resolve(p).replace(/\\/g, "/").toLowerCase();
|
|
3729
3855
|
function shadowedSessions(sessions, branchCheckedOut2) {
|
|
3730
3856
|
const byFolder = /* @__PURE__ */ new Map();
|
|
3731
3857
|
for (const s of sessions) {
|
|
@@ -3744,14 +3870,14 @@ function shadowedSessions(sessions, branchCheckedOut2) {
|
|
|
3744
3870
|
}
|
|
3745
3871
|
function branchCheckedOut(dir) {
|
|
3746
3872
|
try {
|
|
3747
|
-
const dotGit =
|
|
3873
|
+
const dotGit = path9.join(dir, ".git");
|
|
3748
3874
|
let gitDir = dotGit;
|
|
3749
|
-
if (
|
|
3750
|
-
const m = /^gitdir:\s*(.+)$/m.exec(
|
|
3875
|
+
if (fs7.statSync(dotGit).isFile()) {
|
|
3876
|
+
const m = /^gitdir:\s*(.+)$/m.exec(fs7.readFileSync(dotGit, "utf8"));
|
|
3751
3877
|
if (!m) return null;
|
|
3752
|
-
gitDir =
|
|
3878
|
+
gitDir = path9.resolve(dir, m[1].trim());
|
|
3753
3879
|
}
|
|
3754
|
-
const head =
|
|
3880
|
+
const head = fs7.readFileSync(path9.join(gitDir, "HEAD"), "utf8");
|
|
3755
3881
|
const ref = /^ref:\s*refs\/heads\/(.+)$/m.exec(head);
|
|
3756
3882
|
return ref ? ref[1].trim() : null;
|
|
3757
3883
|
} catch {
|
|
@@ -3760,14 +3886,14 @@ function branchCheckedOut(dir) {
|
|
|
3760
3886
|
}
|
|
3761
3887
|
|
|
3762
3888
|
// src/core/platform/build-stamp.ts
|
|
3763
|
-
import
|
|
3889
|
+
import fs8 from "fs";
|
|
3764
3890
|
var cached = null;
|
|
3765
3891
|
function buildStamp() {
|
|
3766
3892
|
if (cached) return cached;
|
|
3767
3893
|
const forced = process.env.WORK_BUILD_STAMP;
|
|
3768
3894
|
if (forced) return cached = forced;
|
|
3769
3895
|
try {
|
|
3770
|
-
cached = String(Math.floor(
|
|
3896
|
+
cached = String(Math.floor(fs8.statSync(process.argv[1]).mtimeMs));
|
|
3771
3897
|
} catch {
|
|
3772
3898
|
cached = "unknown";
|
|
3773
3899
|
}
|
|
@@ -4065,8 +4191,8 @@ function mountPrReplyRoutes(app, opts) {
|
|
|
4065
4191
|
}
|
|
4066
4192
|
|
|
4067
4193
|
// src/core/archive/archive-retention.ts
|
|
4068
|
-
import
|
|
4069
|
-
import
|
|
4194
|
+
import fs9 from "fs";
|
|
4195
|
+
import path10 from "path";
|
|
4070
4196
|
import zlib from "zlib";
|
|
4071
4197
|
var DEFAULT_COMPRESS_AFTER_DAYS = 30;
|
|
4072
4198
|
var DAY_MS = 24 * 36e5;
|
|
@@ -4078,7 +4204,7 @@ function applyArchiveRetention(opts) {
|
|
|
4078
4204
|
const out = { compressed: [], dropped: [], bytesSaved: 0 };
|
|
4079
4205
|
let ids;
|
|
4080
4206
|
try {
|
|
4081
|
-
ids =
|
|
4207
|
+
ids = fs9.readdirSync(root, { withFileTypes: true }).filter((d) => d.isDirectory()).map((d) => d.name);
|
|
4082
4208
|
} catch {
|
|
4083
4209
|
return out;
|
|
4084
4210
|
}
|
|
@@ -4087,17 +4213,17 @@ function applyArchiveRetention(opts) {
|
|
|
4087
4213
|
if (!rec) continue;
|
|
4088
4214
|
const age = now - Date.parse(rec.archivedAt);
|
|
4089
4215
|
if (!Number.isFinite(age)) continue;
|
|
4090
|
-
const ignored =
|
|
4091
|
-
if (compressAfter > 0 && age >= compressAfter * DAY_MS && !rec.ignoredDroppedAt &&
|
|
4092
|
-
|
|
4216
|
+
const ignored = path10.join(archiveDirFor(id, root), "ignored");
|
|
4217
|
+
if (compressAfter > 0 && age >= compressAfter * DAY_MS && !rec.ignoredDroppedAt && fs9.existsSync(ignored)) {
|
|
4218
|
+
fs9.rmSync(ignored, { recursive: true, force: true });
|
|
4093
4219
|
rec.ignoredDroppedAt = new Date(now).toISOString();
|
|
4094
4220
|
writeArchiveRecord(rec, root);
|
|
4095
4221
|
}
|
|
4096
4222
|
if (rec.transcriptsDroppedAt) continue;
|
|
4097
|
-
const dir =
|
|
4223
|
+
const dir = path10.join(archiveDirFor(id, root), "transcripts");
|
|
4098
4224
|
if (dropAfter > 0 && age >= dropAfter * DAY_MS) {
|
|
4099
4225
|
out.bytesSaved += dirBytes(dir);
|
|
4100
|
-
|
|
4226
|
+
fs9.rmSync(dir, { recursive: true, force: true });
|
|
4101
4227
|
rec.transcriptsDroppedAt = new Date(now).toISOString();
|
|
4102
4228
|
writeArchiveRecord(rec, root);
|
|
4103
4229
|
out.dropped.push(id);
|
|
@@ -4105,16 +4231,16 @@ function applyArchiveRetention(opts) {
|
|
|
4105
4231
|
}
|
|
4106
4232
|
if (compressAfter <= 0 || rec.compressedAt || age < compressAfter * DAY_MS) continue;
|
|
4107
4233
|
for (const t of rec.transcripts) {
|
|
4108
|
-
const plain =
|
|
4109
|
-
if (!
|
|
4110
|
-
const data =
|
|
4234
|
+
const plain = path10.join(dir, t.file);
|
|
4235
|
+
if (!fs9.existsSync(plain)) continue;
|
|
4236
|
+
const data = fs9.readFileSync(plain);
|
|
4111
4237
|
const gz = zlib.gzipSync(data);
|
|
4112
|
-
|
|
4113
|
-
if (!zlib.gunzipSync(
|
|
4114
|
-
|
|
4238
|
+
fs9.writeFileSync(`${plain}.gz`, gz);
|
|
4239
|
+
if (!zlib.gunzipSync(fs9.readFileSync(`${plain}.gz`)).equals(data)) {
|
|
4240
|
+
fs9.rmSync(`${plain}.gz`, { force: true });
|
|
4115
4241
|
continue;
|
|
4116
4242
|
}
|
|
4117
|
-
|
|
4243
|
+
fs9.rmSync(plain, { force: true });
|
|
4118
4244
|
out.bytesSaved += data.length - gz.length;
|
|
4119
4245
|
}
|
|
4120
4246
|
rec.compressedAt = new Date(now).toISOString();
|
|
@@ -4126,7 +4252,7 @@ function applyArchiveRetention(opts) {
|
|
|
4126
4252
|
function dirBytes(dir) {
|
|
4127
4253
|
let n = 0;
|
|
4128
4254
|
try {
|
|
4129
|
-
for (const f of
|
|
4255
|
+
for (const f of fs9.readdirSync(dir)) n += fs9.statSync(path10.join(dir, f)).size;
|
|
4130
4256
|
} catch {
|
|
4131
4257
|
}
|
|
4132
4258
|
return n;
|
|
@@ -4331,17 +4457,17 @@ function mountTimeRoutes(app, opts) {
|
|
|
4331
4457
|
}
|
|
4332
4458
|
|
|
4333
4459
|
// src/server/routes/revert-routes.ts
|
|
4334
|
-
import
|
|
4335
|
-
import { zValidator as
|
|
4336
|
-
import { z as
|
|
4460
|
+
import path12 from "path";
|
|
4461
|
+
import { zValidator as zValidator7 } from "@hono/zod-validator";
|
|
4462
|
+
import { z as z6 } from "zod";
|
|
4337
4463
|
|
|
4338
4464
|
// src/core/diff/revert.ts
|
|
4339
|
-
import
|
|
4340
|
-
import
|
|
4465
|
+
import fs10 from "fs";
|
|
4466
|
+
import path11 from "path";
|
|
4341
4467
|
function inside(root, rel) {
|
|
4342
|
-
const abs =
|
|
4343
|
-
const back =
|
|
4344
|
-
if (!back || back.startsWith("..") ||
|
|
4468
|
+
const abs = path11.resolve(root, rel);
|
|
4469
|
+
const back = path11.relative(path11.resolve(root), abs);
|
|
4470
|
+
if (!back || back.startsWith("..") || path11.isAbsolute(back)) return null;
|
|
4345
4471
|
return abs;
|
|
4346
4472
|
}
|
|
4347
4473
|
function inHead(root, rel) {
|
|
@@ -4351,7 +4477,7 @@ function removeNew(root, rel) {
|
|
|
4351
4477
|
const abs = inside(root, rel);
|
|
4352
4478
|
if (!abs) return { ok: false, status: 400, error: `path escapes the worktree: ${rel}` };
|
|
4353
4479
|
git(["rm", "--cached", "-q", "--ignore-unmatch", "--", rel], root);
|
|
4354
|
-
|
|
4480
|
+
fs10.rmSync(abs, { force: true });
|
|
4355
4481
|
return null;
|
|
4356
4482
|
}
|
|
4357
4483
|
function revertFile(root, file) {
|
|
@@ -4440,22 +4566,22 @@ function revertLines(root, file, start, end) {
|
|
|
4440
4566
|
}
|
|
4441
4567
|
|
|
4442
4568
|
// src/server/routes/revert-routes.ts
|
|
4443
|
-
var revertSchema =
|
|
4444
|
-
repo:
|
|
4445
|
-
path:
|
|
4446
|
-
lines:
|
|
4569
|
+
var revertSchema = z6.object({
|
|
4570
|
+
repo: z6.string().min(1),
|
|
4571
|
+
path: z6.string().min(1),
|
|
4572
|
+
lines: z6.object({ start: z6.number().int().min(0), end: z6.number().int().min(0) }).optional(),
|
|
4447
4573
|
/** Leave Claude a note about it (default true). */
|
|
4448
|
-
tell:
|
|
4574
|
+
tell: z6.boolean().optional()
|
|
4449
4575
|
});
|
|
4450
4576
|
function mountRevertRoutes(app, opts) {
|
|
4451
|
-
app.post("/api/sessions/:id/revert",
|
|
4577
|
+
app.post("/api/sessions/:id/revert", zValidator7("json", revertSchema), async (c) => {
|
|
4452
4578
|
const id = c.req.param("id");
|
|
4453
4579
|
const session = findSession2(id);
|
|
4454
4580
|
if (!session) return c.json({ error: "unknown session" }, 404);
|
|
4455
4581
|
const body = c.req.valid("json");
|
|
4456
4582
|
const repo = opts.uncommitted(session).find((r) => r.name === body.repo);
|
|
4457
|
-
const allowed = new Set(session.paths.map((p) =>
|
|
4458
|
-
if (!repo || !allowed.has(
|
|
4583
|
+
const allowed = new Set(session.paths.map((p) => path12.resolve(p).toLowerCase()));
|
|
4584
|
+
if (!repo || !allowed.has(path12.resolve(repo.root).toLowerCase())) {
|
|
4459
4585
|
return c.json({ error: `unknown repo: ${body.repo}` }, 404);
|
|
4460
4586
|
}
|
|
4461
4587
|
const file = repo.files.find((f) => f.path === body.path);
|
|
@@ -4512,7 +4638,7 @@ function mountDevRoutes(app, opts) {
|
|
|
4512
4638
|
}
|
|
4513
4639
|
|
|
4514
4640
|
// src/server/routes/ci-routes.ts
|
|
4515
|
-
import
|
|
4641
|
+
import fs11 from "fs";
|
|
4516
4642
|
|
|
4517
4643
|
// src/core/pr/review-quote.ts
|
|
4518
4644
|
function quoteForAgent(s, max = 600) {
|
|
@@ -5053,7 +5179,7 @@ function mountCiRoutes(app, opts) {
|
|
|
5053
5179
|
lookOnly: opts.lookOnly,
|
|
5054
5180
|
sessions: () => {
|
|
5055
5181
|
const cutoff = Date.now() - RECENT_MS;
|
|
5056
|
-
return loadHistory().filter((s) => !s.archivedAt && Date.parse(s.lastAccessedAt) >= cutoff && s.paths.some((p) =>
|
|
5182
|
+
return loadHistory().filter((s) => !s.archivedAt && Date.parse(s.lastAccessedAt) >= cutoff && s.paths.some((p) => fs11.existsSync(p))).map((session) => ({ id: sessionIdFor(session), session }));
|
|
5057
5183
|
},
|
|
5058
5184
|
// Never-pushed branches can't have a PR: don't ask GitHub about them,
|
|
5059
5185
|
// unless the watch already knows one (a merged PR whose branch is gone).
|
|
@@ -5122,27 +5248,27 @@ function mountCiRoutes(app, opts) {
|
|
|
5122
5248
|
}
|
|
5123
5249
|
|
|
5124
5250
|
// src/core/diff/diffs-sweep.ts
|
|
5125
|
-
import
|
|
5126
|
-
import
|
|
5251
|
+
import fs12 from "fs";
|
|
5252
|
+
import path13 from "path";
|
|
5127
5253
|
var SWEEP_AFTER_DAYS = 30;
|
|
5128
5254
|
var DISPOSABLE = /\.(html|log)$/i;
|
|
5129
|
-
function sweepOldDiffArtifacts(now = Date.now(), maxAgeDays = SWEEP_AFTER_DAYS, dir =
|
|
5255
|
+
function sweepOldDiffArtifacts(now = Date.now(), maxAgeDays = SWEEP_AFTER_DAYS, dir = path13.join(getConfigDir(), "diffs")) {
|
|
5130
5256
|
const cutoff = now - maxAgeDays * 24 * 60 * 60 * 1e3;
|
|
5131
5257
|
let removed = 0;
|
|
5132
5258
|
let bytes = 0;
|
|
5133
5259
|
let names;
|
|
5134
5260
|
try {
|
|
5135
|
-
names =
|
|
5261
|
+
names = fs12.readdirSync(dir);
|
|
5136
5262
|
} catch {
|
|
5137
5263
|
return { removed, bytes };
|
|
5138
5264
|
}
|
|
5139
5265
|
for (const name of names) {
|
|
5140
5266
|
if (!DISPOSABLE.test(name)) continue;
|
|
5141
|
-
const file =
|
|
5267
|
+
const file = path13.join(dir, name);
|
|
5142
5268
|
try {
|
|
5143
|
-
const st =
|
|
5269
|
+
const st = fs12.statSync(file);
|
|
5144
5270
|
if (!st.isFile() || st.mtimeMs >= cutoff) continue;
|
|
5145
|
-
|
|
5271
|
+
fs12.rmSync(file, { force: true });
|
|
5146
5272
|
removed++;
|
|
5147
5273
|
bytes += st.size;
|
|
5148
5274
|
} catch {
|
|
@@ -5152,7 +5278,7 @@ function sweepOldDiffArtifacts(now = Date.now(), maxAgeDays = SWEEP_AFTER_DAYS,
|
|
|
5152
5278
|
}
|
|
5153
5279
|
|
|
5154
5280
|
// src/core/diff/session-history.ts
|
|
5155
|
-
import
|
|
5281
|
+
import path14 from "path";
|
|
5156
5282
|
|
|
5157
5283
|
// src/core/diff/diff-points.ts
|
|
5158
5284
|
var SHA = /^[0-9a-f]{7,40}$/;
|
|
@@ -5222,7 +5348,7 @@ function sessionCommits(session) {
|
|
|
5222
5348
|
if (log.exitCode !== 0 || !log.stdout) continue;
|
|
5223
5349
|
for (const line of log.stdout.split("\n")) {
|
|
5224
5350
|
const [sha, at, subject] = line.split("");
|
|
5225
|
-
if (sha && at) out.push({ repo:
|
|
5351
|
+
if (sha && at) out.push({ repo: path14.basename(root), sha, at, subject: subject ?? "" });
|
|
5226
5352
|
}
|
|
5227
5353
|
}
|
|
5228
5354
|
if (commitCache.size >= COMMIT_CACHE_MAX) commitCache.delete(commitCache.keys().next().value);
|
|
@@ -5230,7 +5356,7 @@ function sessionCommits(session) {
|
|
|
5230
5356
|
return out;
|
|
5231
5357
|
}
|
|
5232
5358
|
function computeSessionRange(session, from, to) {
|
|
5233
|
-
const paths = session.paths.map((p) =>
|
|
5359
|
+
const paths = session.paths.map((p) => path14.resolve(p));
|
|
5234
5360
|
const refs = rangeRefs(paths, loadManifest(scopeHashForPaths(paths)).entries, from, to);
|
|
5235
5361
|
if ("error" in refs) return refs;
|
|
5236
5362
|
return { repos: refs.map((r) => ({ name: r.name, root: r.root, files: computeRangeDiff(r) })) };
|
|
@@ -5394,13 +5520,13 @@ async function bridgeToHost(ws, sessionId, pending) {
|
|
|
5394
5520
|
}
|
|
5395
5521
|
|
|
5396
5522
|
// src/core/pty/agent-restart.ts
|
|
5397
|
-
import
|
|
5523
|
+
import fs13 from "fs";
|
|
5398
5524
|
var PACKED_MTIME_BEFORE = Date.parse("1990-01-01T00:00:00Z");
|
|
5399
5525
|
function installedAt(cmd, find = findOnPath) {
|
|
5400
5526
|
const file = find(cmd);
|
|
5401
5527
|
if (!file) return null;
|
|
5402
5528
|
try {
|
|
5403
|
-
return installTime(
|
|
5529
|
+
return installTime(fs13.statSync(fs13.realpathSync(file)));
|
|
5404
5530
|
} catch {
|
|
5405
5531
|
return null;
|
|
5406
5532
|
}
|
|
@@ -5610,7 +5736,7 @@ function sleepCandidates(ptys, now, afterMs, busy, keep = /* @__PURE__ */ new Se
|
|
|
5610
5736
|
function computeSessionDiff(s, base) {
|
|
5611
5737
|
const resolved = s.paths.map((p) => resolveRepoDiff(p, base, s.baseBranches?.[p] ?? s.baseBranch));
|
|
5612
5738
|
const repos = s.paths.map((p, i) => ({
|
|
5613
|
-
name:
|
|
5739
|
+
name: path15.basename(p),
|
|
5614
5740
|
root: p,
|
|
5615
5741
|
resolvedBase: resolved[i].resolvedBase,
|
|
5616
5742
|
files: computeDiff({ root: p, diffArg: resolved[i].diffArg })
|
|
@@ -5661,7 +5787,7 @@ async function startWebServer(opts = {}) {
|
|
|
5661
5787
|
let activityWatcher = null;
|
|
5662
5788
|
if (!lean) {
|
|
5663
5789
|
try {
|
|
5664
|
-
const roots = activityRoots().filter((r) =>
|
|
5790
|
+
const roots = activityRoots().filter((r) => fs14.existsSync(r));
|
|
5665
5791
|
if (roots.length > 0) {
|
|
5666
5792
|
activityWatcher = createFsWatcher({
|
|
5667
5793
|
roots,
|
|
@@ -5701,7 +5827,8 @@ async function startWebServer(opts = {}) {
|
|
|
5701
5827
|
return c.json({ ok: true, pid: process.pid });
|
|
5702
5828
|
});
|
|
5703
5829
|
let diffStatBroadcast = null;
|
|
5704
|
-
const
|
|
5830
|
+
const worktreeQueue = keyedQueue();
|
|
5831
|
+
const makeWorktree = oneAtATime((req, config) => createInChild(getWorkBin())(req, config), worktreeQueue);
|
|
5705
5832
|
const behindCache = new BehindCache({ onChange: () => broadcast("sessions-changed", { ts: Date.now() }) });
|
|
5706
5833
|
const diffStats = new DiffStatCache({
|
|
5707
5834
|
onChange: () => {
|
|
@@ -5712,7 +5839,7 @@ async function startWebServer(opts = {}) {
|
|
|
5712
5839
|
}, 500);
|
|
5713
5840
|
}
|
|
5714
5841
|
});
|
|
5715
|
-
const repoNames = (s) => s.isGroup ? s.paths.map((p) =>
|
|
5842
|
+
const repoNames = (s) => s.isGroup ? s.paths.map((p) => path15.basename(p)) : [s.target];
|
|
5716
5843
|
const diffStatFor = (id, s, hasStatus) => wantsDiffStat(s, hasStatus) ? diffStats.get(id, s.paths, repoNames(s)) : null;
|
|
5717
5844
|
const archivedRow = createArchivedRows();
|
|
5718
5845
|
app.get("/api/sessions", (c) => {
|
|
@@ -6021,14 +6148,7 @@ async function startWebServer(opts = {}) {
|
|
|
6021
6148
|
startRun: () => activity.start("stacks", "Updating stacked sessions"),
|
|
6022
6149
|
busy: stackSyncing,
|
|
6023
6150
|
shownState,
|
|
6024
|
-
tell:
|
|
6025
|
-
const res = await app.request(`/api/sessions/${encodeURIComponent(sessionIdFor(s))}/comments`, {
|
|
6026
|
-
method: "POST",
|
|
6027
|
-
headers: { "Content-Type": "application/json" },
|
|
6028
|
-
body: JSON.stringify({ side: "general", status: "published", body })
|
|
6029
|
-
});
|
|
6030
|
-
if (!res.ok) throw new Error(`posting the note failed: ${res.status}`);
|
|
6031
|
-
}
|
|
6151
|
+
tell: (s, body) => noteThroughComments(app)(sessionIdFor(s), body)
|
|
6032
6152
|
};
|
|
6033
6153
|
const syncStacksAfter = async (id) => {
|
|
6034
6154
|
if (readStatus(id)?.state !== "idle") return;
|
|
@@ -6154,6 +6274,18 @@ async function startWebServer(opts = {}) {
|
|
|
6154
6274
|
if (s) scopeApi?.releaseSessionScope(s.paths, false);
|
|
6155
6275
|
};
|
|
6156
6276
|
mountShipRoutes(app, { broadcast, onRepoChanged: (id) => diffStats.invalidate(id), release: releaseSession, create: makeWorktree });
|
|
6277
|
+
mountSessionRepoRoutes(app, {
|
|
6278
|
+
broadcast,
|
|
6279
|
+
run: addRepoInChild(getWorkBin),
|
|
6280
|
+
queue: worktreeQueue,
|
|
6281
|
+
// The scope only: the session stays, and its file watcher keeps serving whoever listens.
|
|
6282
|
+
release: scopeReleaser(scopeApi),
|
|
6283
|
+
invalidate: (id) => {
|
|
6284
|
+
diffStats.invalidate(id);
|
|
6285
|
+
behindCache.invalidate(id);
|
|
6286
|
+
},
|
|
6287
|
+
note: noteThroughComments(app)
|
|
6288
|
+
});
|
|
6157
6289
|
mountTimeRoutes(app, { deps: timeDeps, broadcast, onGraphChanged: () => void timeKeeper?.run() });
|
|
6158
6290
|
mountSessionOrderRoutes(app, { broadcast });
|
|
6159
6291
|
mountRailRoutes(app, { broadcast });
|
|
@@ -6182,7 +6314,7 @@ async function startWebServer(opts = {}) {
|
|
|
6182
6314
|
updatesTimer?.unref?.();
|
|
6183
6315
|
const desktopFile = desktopUpdatePath();
|
|
6184
6316
|
const onDesktopUpdate = () => broadcast("updates-changed", { ts: Date.now() });
|
|
6185
|
-
if (jobs)
|
|
6317
|
+
if (jobs) fs14.watchFile(desktopFile, { interval: 3e3 }, onDesktopUpdate);
|
|
6186
6318
|
app.get("/api/pty-host/health", (c) => c.json(hostHealth(hostBeat())));
|
|
6187
6319
|
let lastHostState = hostHealth(hostBeat()).state;
|
|
6188
6320
|
const hostTick = lean ? null : setInterval(() => {
|
|
@@ -6247,7 +6379,7 @@ async function startWebServer(opts = {}) {
|
|
|
6247
6379
|
if (timeFirst) clearTimeout(timeFirst);
|
|
6248
6380
|
if (timeTimer) clearInterval(timeTimer);
|
|
6249
6381
|
timeKeeper?.stop();
|
|
6250
|
-
|
|
6382
|
+
fs14.unwatchFile(desktopFile, onDesktopUpdate);
|
|
6251
6383
|
for (const t of conversationSyncs.values()) clearTimeout(t);
|
|
6252
6384
|
clearTimeout(sweepTimer);
|
|
6253
6385
|
activityWatcher?.stop();
|
|
@@ -6270,11 +6402,11 @@ async function startWebServer(opts = {}) {
|
|
|
6270
6402
|
}
|
|
6271
6403
|
|
|
6272
6404
|
// src/core/platform/autostart.ts
|
|
6273
|
-
import
|
|
6274
|
-
import
|
|
6405
|
+
import fs15 from "fs";
|
|
6406
|
+
import path16 from "path";
|
|
6275
6407
|
function startupScriptPath() {
|
|
6276
6408
|
if (process.platform !== "win32" || !process.env.APPDATA) return null;
|
|
6277
|
-
return
|
|
6409
|
+
return path16.join(process.env.APPDATA, "Microsoft", "Windows", "Start Menu", "Programs", "Startup", "work-web.vbs");
|
|
6278
6410
|
}
|
|
6279
6411
|
function vbsQuote(s) {
|
|
6280
6412
|
return '"' + s.replace(/"/g, '""') + '"';
|
|
@@ -6292,11 +6424,11 @@ function setAutostart(enabled, workBin) {
|
|
|
6292
6424
|
const file = startupScriptPath();
|
|
6293
6425
|
if (!file) throw new Error("Autostart is only supported on Windows so far.");
|
|
6294
6426
|
if (enabled) {
|
|
6295
|
-
|
|
6296
|
-
|
|
6427
|
+
fs15.mkdirSync(path16.dirname(file), { recursive: true });
|
|
6428
|
+
fs15.writeFileSync(file, buildStartupScript(process.execPath, workBin), "utf-8");
|
|
6297
6429
|
} else {
|
|
6298
6430
|
try {
|
|
6299
|
-
|
|
6431
|
+
fs15.unlinkSync(file);
|
|
6300
6432
|
} catch {
|
|
6301
6433
|
}
|
|
6302
6434
|
}
|
|
@@ -6340,7 +6472,7 @@ function createDemoRepos(liveTargets) {
|
|
|
6340
6472
|
/** GET /api/projects: what New worktree offers, as the real one reads config. */
|
|
6341
6473
|
projects() {
|
|
6342
6474
|
return {
|
|
6343
|
-
singles: Object.entries(repos).map(([name,
|
|
6475
|
+
singles: Object.entries(repos).map(([name, path17]) => ({ name, kind: "single", path: path17 })),
|
|
6344
6476
|
groups: Object.entries(groups).map(([name, members]) => ({ name, kind: "group", members }))
|
|
6345
6477
|
};
|
|
6346
6478
|
},
|
|
@@ -6382,12 +6514,12 @@ function createDemoRepos(liveTargets) {
|
|
|
6382
6514
|
}));
|
|
6383
6515
|
return { roots: [root], repos: rows, groups: groupRows };
|
|
6384
6516
|
},
|
|
6385
|
-
enroll(alias,
|
|
6386
|
-
if (!found.some((f) => f.path ===
|
|
6387
|
-
const problem = enrollProblem(alias,
|
|
6517
|
+
enroll(alias, path17) {
|
|
6518
|
+
if (!found.some((f) => f.path === path17)) throw new DemoRepoError(`${path17} is not the top folder of a git repository`);
|
|
6519
|
+
const problem = enrollProblem(alias, path17, config());
|
|
6388
6520
|
if (problem) throw new DemoRepoError(problem);
|
|
6389
|
-
repos[alias] =
|
|
6390
|
-
ignored.delete(
|
|
6521
|
+
repos[alias] = path17;
|
|
6522
|
+
ignored.delete(path17);
|
|
6391
6523
|
},
|
|
6392
6524
|
remove(alias, force) {
|
|
6393
6525
|
if (!(alias in repos)) throw new DemoRepoError(`no repo \u201C${alias}\u201D`);
|
|
@@ -6396,9 +6528,9 @@ function createDemoRepos(liveTargets) {
|
|
|
6396
6528
|
delete repos[alias];
|
|
6397
6529
|
for (const g of Object.keys(groups)) groups[g] = groups[g].filter((m) => m !== alias);
|
|
6398
6530
|
},
|
|
6399
|
-
ignore(
|
|
6400
|
-
if (on) ignored.add(
|
|
6401
|
-
else ignored.delete(
|
|
6531
|
+
ignore(path17, on) {
|
|
6532
|
+
if (on) ignored.add(path17);
|
|
6533
|
+
else ignored.delete(path17);
|
|
6402
6534
|
},
|
|
6403
6535
|
saveGroup(name, members, creating) {
|
|
6404
6536
|
const problem = groupProblem(name, members, config(), { creating });
|
|
@@ -7036,6 +7168,8 @@ ${reply}\r
|
|
|
7036
7168
|
branch: s.branch,
|
|
7037
7169
|
isGroup: s.isGroup,
|
|
7038
7170
|
paths: s.repos.map((r) => `~/worktrees/${s.target}/${s.branch.replace(/\//g, "-")}${s.isGroup ? "/" + r.name : ""}`),
|
|
7171
|
+
repos: s.isGroup ? s.repos.map((r) => r.name) : [s.target],
|
|
7172
|
+
folder: s.isGroup,
|
|
7039
7173
|
createdAt: s.createdAt,
|
|
7040
7174
|
lastAccessedAt: s.lastAccessedAt,
|
|
7041
7175
|
draftCount: comments.filter((c) => c.status === "draft").length,
|
|
@@ -7241,6 +7375,37 @@ ${reply}\r
|
|
|
7241
7375
|
comments(id) {
|
|
7242
7376
|
return this.sessions.get(id)?.comments ?? null;
|
|
7243
7377
|
}
|
|
7378
|
+
/**
|
|
7379
|
+
* Add a repo to a session folder (simulated, as add-repo.ts refuses and
|
|
7380
|
+
* does it): checked out on the session's branch, made from the base (main),
|
|
7381
|
+
* its Claude told by a published note.
|
|
7382
|
+
*/
|
|
7383
|
+
addRepo(id, alias, base) {
|
|
7384
|
+
const s = this.sessions.get(id);
|
|
7385
|
+
const paths = s ? this.wire(s).paths : [];
|
|
7386
|
+
const repos = Object.fromEntries(this.projects().singles.map((p) => [p.name, `/demo/repos/${p.name}`]));
|
|
7387
|
+
const shape = s ? {
|
|
7388
|
+
target: s.target,
|
|
7389
|
+
branch: s.branch,
|
|
7390
|
+
isGroup: s.isGroup,
|
|
7391
|
+
paths,
|
|
7392
|
+
repos: s.repos.map((r) => r.name),
|
|
7393
|
+
archivedAt: s.archivedAt ?? void 0
|
|
7394
|
+
} : null;
|
|
7395
|
+
const refusal = addRepoRefusal(shape, alias, { repos, groups: {} }, () => false, base);
|
|
7396
|
+
if (refusal || !s) return { ok: false, status: refusal?.status ?? 404, error: refusal?.error ?? "unknown session" };
|
|
7397
|
+
s.repos.push({ name: alias, uncommitted: "", sinceBranch: "", published: false, pr: null });
|
|
7398
|
+
const from = base || "main";
|
|
7399
|
+
const path17 = this.wire(s).paths[s.repos.length - 1];
|
|
7400
|
+
s.comments.post({
|
|
7401
|
+
side: "general",
|
|
7402
|
+
status: "published",
|
|
7403
|
+
body: addedRepoNote({ alias, path: path17, branch: s.branch, from, imported: true })
|
|
7404
|
+
});
|
|
7405
|
+
this.emit("comments-changed", { sessionId: id });
|
|
7406
|
+
this.changed();
|
|
7407
|
+
return { ok: true, wire: { ok: true, path: path17, branch: s.branch, created: true, from, imported: true, warnings: [] } };
|
|
7408
|
+
}
|
|
7244
7409
|
// -- CI (the PR watch, simulated) ------------------------------------------
|
|
7245
7410
|
/** The Today digest, through the same builder as work web: the demo's
|
|
7246
7411
|
* prompts are the `> …` lines of its simulated terminals. */
|
|
@@ -7768,20 +7933,20 @@ function demoCodeFiles(repos, group) {
|
|
|
7768
7933
|
})
|
|
7769
7934
|
};
|
|
7770
7935
|
}
|
|
7771
|
-
function demoCodeFile(repos, group, repo,
|
|
7936
|
+
function demoCodeFile(repos, group, repo, path17) {
|
|
7772
7937
|
if (repo === "") {
|
|
7773
|
-
if (!group ||
|
|
7938
|
+
if (!group || path17 !== "CLAUDE.md") return null;
|
|
7774
7939
|
const text2 = `# Group instructions
|
|
7775
7940
|
|
|
7776
7941
|
Repos: ${repos.map((r2) => r2.name).join(", ")}.
|
|
7777
7942
|
`;
|
|
7778
|
-
return { repo, path:
|
|
7943
|
+
return { repo, path: path17, size: text2.length, text: text2 };
|
|
7779
7944
|
}
|
|
7780
7945
|
const r = repos.find((x) => x.name === repo);
|
|
7781
7946
|
if (!r) return null;
|
|
7782
|
-
const changed = r.changed.find((f) => f.path ===
|
|
7783
|
-
const text = changed ? newSide(changed) : COMMON[
|
|
7784
|
-
return text === void 0 ? null : { repo, path:
|
|
7947
|
+
const changed = r.changed.find((f) => f.path === path17 && f.status !== "deleted");
|
|
7948
|
+
const text = changed ? newSide(changed) : COMMON[path17]?.replace(/\{repo\}/g, repo);
|
|
7949
|
+
return text === void 0 ? null : { repo, path: path17, size: text.length, text };
|
|
7785
7950
|
}
|
|
7786
7951
|
function demoCodeSearch(repos, group, query) {
|
|
7787
7952
|
const q = query.trim();
|
|
@@ -7790,12 +7955,12 @@ function demoCodeSearch(repos, group, query) {
|
|
|
7790
7955
|
const text = [];
|
|
7791
7956
|
const fold = (x) => ignoresCase(q) ? x.toLowerCase() : x;
|
|
7792
7957
|
for (const r of demoCodeFiles(repos, group).repos) {
|
|
7793
|
-
for (const
|
|
7794
|
-
const lines = (demoCodeFile(repos, group, r.name,
|
|
7958
|
+
for (const path17 of r.files) {
|
|
7959
|
+
const lines = (demoCodeFile(repos, group, r.name, path17)?.text ?? "").split("\n");
|
|
7795
7960
|
lines.forEach((line, i) => {
|
|
7796
|
-
const d = declarationOf(
|
|
7797
|
-
if (d) symbols.push({ ...d, repo: r.name, path:
|
|
7798
|
-
if (fold(line).includes(fold(q))) text.push({ repo: r.name, path:
|
|
7961
|
+
const d = declarationOf(path17, line);
|
|
7962
|
+
if (d) symbols.push({ ...d, repo: r.name, path: path17, line: i + 1, text: line.trim() });
|
|
7963
|
+
if (fold(line).includes(fold(q))) text.push({ repo: r.name, path: path17, line: i + 1, text: line });
|
|
7799
7964
|
});
|
|
7800
7965
|
}
|
|
7801
7966
|
}
|
|
@@ -8177,13 +8342,13 @@ async function startDemoServer(opts) {
|
|
|
8177
8342
|
(c) => c.json({
|
|
8178
8343
|
sessions: scenario.list().filter((w) => c.req.query("archived") === "1" || !w.archivedAt).map((w) => {
|
|
8179
8344
|
const out = draftsFor(w.id) ? { ...w, replyDrafts: draftsFor(w.id) } : { ...w };
|
|
8180
|
-
const
|
|
8345
|
+
const z7 = snoozes.get(w.id);
|
|
8181
8346
|
const waiting = (blocks.get(w.id) ?? []).filter(
|
|
8182
8347
|
(b) => b.kind === "pr" || scenario.list().some((x) => x.id === b.sessionId && !x.archivedAt)
|
|
8183
8348
|
);
|
|
8184
8349
|
const withBlocks = waiting.length ? { ...out, blockedBy: waiting } : out;
|
|
8185
8350
|
const noted = notes.has(w.id) ? { ...withBlocks, hasNote: true } : withBlocks;
|
|
8186
|
-
return
|
|
8351
|
+
return z7 && snoozeActive(z7, noted) ? { ...noted, snoozed: { until: z7.until } } : noted;
|
|
8187
8352
|
})
|
|
8188
8353
|
})
|
|
8189
8354
|
);
|
|
@@ -8191,13 +8356,13 @@ async function startDemoServer(opts) {
|
|
|
8191
8356
|
const body = await json2(c);
|
|
8192
8357
|
const w = scenario.list().find((x) => x.id === c.req.param("id"));
|
|
8193
8358
|
if (!w) return notFound(c);
|
|
8194
|
-
let
|
|
8195
|
-
if (typeof body.until === "string")
|
|
8196
|
-
else if (body.for === "2h" || body.for === "tomorrow" || body.for === "change")
|
|
8359
|
+
let z7;
|
|
8360
|
+
if (typeof body.until === "string") z7 = snoozeUntil(body.until, new Date(scenario.clockMs()));
|
|
8361
|
+
else if (body.for === "2h" || body.for === "tomorrow" || body.for === "change") z7 = snoozeFor(body.for, w);
|
|
8197
8362
|
else return c.json({ error: "for: '2h', 'tomorrow' or 'change', or until: a time" }, 400);
|
|
8198
|
-
if (!
|
|
8199
|
-
snoozes.set(w.id,
|
|
8200
|
-
return c.json({ ok: true, snooze:
|
|
8363
|
+
if (!z7) return c.json({ error: "not a time to snooze until: give one in the next 30 days" }, 400);
|
|
8364
|
+
snoozes.set(w.id, z7);
|
|
8365
|
+
return c.json({ ok: true, snooze: z7 });
|
|
8201
8366
|
});
|
|
8202
8367
|
app.delete("/api/sessions/:id/snooze", (c) => {
|
|
8203
8368
|
snoozes.delete(c.req.param("id"));
|
|
@@ -8536,6 +8701,14 @@ async function startDemoServer(opts) {
|
|
|
8536
8701
|
const s = scenario.create(w.target, branch, prompt, w.branch);
|
|
8537
8702
|
return c.json({ sessionId: s.id, paths: s.paths, summarized: true });
|
|
8538
8703
|
});
|
|
8704
|
+
app.post("/api/sessions/:id/repos", async (c) => {
|
|
8705
|
+
const body = await json2(c);
|
|
8706
|
+
if (typeof body.alias !== "string" || !body.alias) return c.json({ error: "alias is required" }, 400);
|
|
8707
|
+
const base = typeof body.base === "string" && body.base.trim() ? body.base.trim() : void 0;
|
|
8708
|
+
const r = scenario.addRepo(c.req.param("id"), body.alias, base);
|
|
8709
|
+
if (!r.ok) return c.json({ error: r.error }, r.status);
|
|
8710
|
+
return c.json(r.wire);
|
|
8711
|
+
});
|
|
8539
8712
|
app.post("/api/worktrees", async (c) => {
|
|
8540
8713
|
const body = await json2(c);
|
|
8541
8714
|
if (typeof body.target !== "string" || !body.target) return c.json({ error: "target is required" }, 400);
|
|
@@ -9196,4 +9369,4 @@ export {
|
|
|
9196
9369
|
stopExisting,
|
|
9197
9370
|
webCommand
|
|
9198
9371
|
};
|
|
9199
|
-
//# sourceMappingURL=web-
|
|
9372
|
+
//# sourceMappingURL=web-A3VW2IYG.js.map
|