@moberg_hr/work-tree 2.12.2 → 2.13.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/dist/{account-H25RWDLL.js → account-2C2YDOIV.js} +11 -11
- package/dist/{add-repo-6JP5XWPF.js → add-repo-ENM45555.js} +8 -8
- package/dist/{answer-H3PTZZAX.js → answer-N5BGRCZE.js} +5 -5
- package/dist/{attach-STMGUOI5.js → attach-FRLECF6U.js} +9 -9
- package/dist/bin.js +2 -2
- package/dist/{block-XJKNFMLV.js → block-SPIM2L7Z.js} +7 -7
- package/dist/{broadcast-RTFVOYTS.js → broadcast-I6A7Z3UL.js} +3 -3
- package/dist/{catchup-4ANFB24Y.js → catchup-XJ4EOYUC.js} +8 -8
- package/dist/{chunk-VHPMBDOM.js → chunk-257RJ7GN.js} +4 -4
- package/dist/{chunk-EL7CYYJF.js → chunk-3GI5PO57.js} +2 -2
- package/dist/{chunk-VIBM55WP.js → chunk-3IUD7OOG.js} +3 -3
- package/dist/{chunk-4IUSJXOY.js → chunk-3NSUFJVB.js} +9 -9
- package/dist/{chunk-HVZAGQUV.js → chunk-4SRABK2D.js} +3 -3
- package/dist/{chunk-7JNYJ6RL.js → chunk-4UBX7TEX.js} +3 -3
- package/dist/{chunk-J4JORJBH.js → chunk-5IEFHZWE.js} +4 -4
- package/dist/{chunk-B7Q6K5EM.js → chunk-5WBYGJS3.js} +2 -2
- package/dist/{chunk-MOSPIQZF.js → chunk-7CABBTGX.js} +2 -2
- package/dist/chunk-7CABBTGX.js.map +1 -0
- package/dist/{chunk-2KL5MJIJ.js → chunk-7KLDOQG6.js} +6 -6
- package/dist/{chunk-MKHZFXGX.js → chunk-AF6XEJTP.js} +2 -2
- package/dist/{chunk-XQ2CNRYH.js → chunk-AIQ4I4AT.js} +2 -2
- package/dist/{chunk-LQWNWPEO.js → chunk-AQHGYLVN.js} +63 -5
- package/dist/{chunk-LQWNWPEO.js.map → chunk-AQHGYLVN.js.map} +1 -1
- package/dist/{chunk-3H5ZMSJT.js → chunk-BVH6EFV5.js} +5 -5
- package/dist/{chunk-7O2H2KOQ.js → chunk-CJSH42MW.js} +52 -51
- package/dist/chunk-CJSH42MW.js.map +1 -0
- package/dist/{chunk-RHQ5DWJQ.js → chunk-EOK3XZCM.js} +3 -3
- package/dist/{chunk-JJTEW3LB.js → chunk-EZPZNHEU.js} +4 -4
- package/dist/{chunk-34DFG4E5.js → chunk-FUU47TYZ.js} +3 -3
- package/dist/{chunk-D4FYTREI.js → chunk-GMZV4RRV.js} +5 -5
- package/dist/{chunk-BLNWKPL7.js → chunk-JK3YCAP7.js} +2 -2
- package/dist/{chunk-LFA2ACWM.js → chunk-JMFEIHMB.js} +4 -4
- package/dist/{chunk-YF4MPWTZ.js → chunk-JPVP46D4.js} +3 -3
- package/dist/{chunk-MZFSW3VF.js → chunk-KTJ5QJCN.js} +2 -2
- package/dist/{chunk-XHIL6L5U.js → chunk-L562BYTL.js} +7 -7
- package/dist/{chunk-YDXRZ5SD.js → chunk-MGKCH7SE.js} +3 -3
- package/dist/{chunk-U55AFVHY.js → chunk-MJZ6XOXR.js} +2 -2
- package/dist/{chunk-6GNGPYL6.js → chunk-MVTA24XH.js} +2 -2
- package/dist/{chunk-ILF3BNIX.js → chunk-N4ADXF5N.js} +3 -3
- package/dist/{chunk-CP6W4MTM.js → chunk-NR4IKXRO.js} +2 -2
- package/dist/chunk-NYOJVO47.js +9 -0
- package/dist/{chunk-T7RSU35I.js → chunk-OIC2PWUH.js} +2 -2
- package/dist/{chunk-XT2VC2OW.js → chunk-OJPGOZNT.js} +2 -2
- package/dist/{chunk-ONWG3PI5.js → chunk-QG46R3C4.js} +5 -5
- package/dist/{chunk-5DY4YW36.js → chunk-R2JBLEOC.js} +2 -2
- package/dist/{chunk-2QIX5XDL.js → chunk-RIKAEVFL.js} +2 -2
- package/dist/{chunk-RUN6ISZA.js → chunk-RZUXQ7ZP.js} +2 -2
- package/dist/{chunk-MRE4WOHB.js → chunk-S2TSH66J.js} +5 -5
- package/dist/{chunk-GBNEIQLL.js → chunk-TAQB6FQY.js} +7 -7
- package/dist/{chunk-N6QKAQ4V.js → chunk-TNCSXIXB.js} +2 -2
- package/dist/{chunk-X3SDPWEE.js → chunk-UHWJXERU.js} +5 -5
- package/dist/{chunk-KMED3WHH.js → chunk-UWHBW4G2.js} +2 -2
- package/dist/{chunk-KX4WF3XR.js → chunk-VB6HRYG6.js} +6 -6
- package/dist/{chunk-PUDJV2PE.js → chunk-VFPJ7CRK.js} +5 -5
- package/dist/{chunk-GYR7P3V2.js → chunk-VWQ7LZFO.js} +2 -2
- package/dist/{chunk-CWQQCJKO.js → chunk-W75NWJRU.js} +4 -4
- package/dist/{chunk-VR53YKEJ.js → chunk-WORXBWCC.js} +4 -4
- package/dist/{chunk-2KGZRG43.js → chunk-WXUAIB32.js} +4 -4
- package/dist/{chunk-FVGDOG5T.js → chunk-YTYOVM4A.js} +4 -4
- package/dist/{chunk-3DZR5LFG.js → chunk-Z3KFELLM.js} +3 -3
- package/dist/{cleanup-K2QJM4DG.js → cleanup-SROJYVPL.js} +22 -22
- package/dist/{cli-54DS3EWN.js → cli-L7LAM65Q.js} +3 -3
- package/dist/{config-KXMYBBR2.js → config-2LB26LNE.js} +5 -5
- package/dist/{diff-YE4NJ3ZF.js → diff-IP3UYSQC.js} +6 -6
- package/dist/{digest-HHN5ZHPV.js → digest-GP4JUCKJ.js} +5 -5
- package/dist/{fork-WBVQ64NR.js → fork-AEA54A4Q.js} +19 -19
- package/dist/{history-HDGGYOZK.js → history-2KDR7AMX.js} +3 -3
- package/dist/{hook-6QS5OPM6.js → hook-TRWITUW6.js} +7 -7
- package/dist/{hydrate-LNFOMIY4.js → hydrate-B6XLDX3A.js} +3 -3
- package/dist/{init-YKVXA7HB.js → init-EP5TCKCI.js} +8 -8
- package/dist/{install-skills-O3X5SQP7.js → install-skills-LQO7EHL7.js} +3 -3
- package/dist/install-skills-bin.js +2 -2
- package/dist/{keep-IWCSOV3Y.js → keep-VWCXTRLQ.js} +5 -5
- package/dist/{list-6WP3AWGR.js → list-OTYXJ7PG.js} +3 -3
- package/dist/{move-YD6J4BEI.js → move-2XPFAJ6C.js} +9 -9
- package/dist/{note-X2FOVB5E.js → note-LXVBPO7G.js} +5 -5
- package/dist/{overlaps-EXDYGDL6.js → overlaps-ATTRQOYO.js} +9 -9
- package/dist/{pin-IOV7TXP2.js → pin-6FYKLGH7.js} +5 -5
- package/dist/{pr-J6MQ37D2.js → pr-32HTOP6M.js} +14 -14
- package/dist/{prune-B47MCBAQ.js → prune-W5EYYUPS.js} +20 -20
- package/dist/{pty-host-QW4AZXH3.js → pty-host-LOT7Y5IF.js} +7 -7
- package/dist/{read-JAIM2DYY.js → read-GVGKDMI6.js} +5 -5
- package/dist/{recent-XNVY5UVF.js → recent-YAHDS2L7.js} +8 -8
- package/dist/{remove-SBTYBMEX.js → remove-BS4INNKF.js} +21 -21
- package/dist/{restart-QO7UT3BS.js → restart-FU4L3Y6D.js} +5 -5
- package/dist/{resume-SEN6WIHS.js → resume-T3UQ7HWI.js} +8 -8
- package/dist/{run-RTYE6K3I.js → run-W6VRRIPD.js} +3 -3
- package/dist/{screen-N2TLCEUU.js → screen-XPLXJDTN.js} +5 -5
- package/dist/{search-D5ECXHUE.js → search-FI2BA7UV.js} +3 -3
- package/dist/{section-4L3EIRIA.js → section-2WP2FU74.js} +5 -5
- package/dist/{send-MGIL5V3H.js → send-MKQHJRUK.js} +6 -6
- package/dist/{sessions-2OK2D7NT.js → sessions-PLY3RLOO.js} +17 -17
- package/dist/show-NBAP6W34.js +63 -0
- package/dist/show-NBAP6W34.js.map +1 -0
- package/dist/{snooze-IYRTDL3T.js → snooze-66DER2G2.js} +5 -5
- package/dist/{start-5LZ7YZGK.js → start-CH76J5IE.js} +5 -5
- package/dist/{status-AXM4QWC5.js → status-CJSOIL5Y.js} +7 -7
- package/dist/{stop-RB5PF5I6.js → stop-VH2KGCWH.js} +5 -5
- package/dist/{sync-RRDTJ7S6.js → sync-TUDFXYWS.js} +20 -20
- package/dist/{time-INJY7DSM.js → time-U7QHPL5U.js} +6 -6
- package/dist/{timesheet-TPXVMNSL.js → timesheet-7KASD74P.js} +8 -8
- package/dist/{tree-6OE7SYA2.js → tree-KZS7ZWLG.js} +19 -19
- package/dist/{update-YMDG7O3M.js → update-AQKZUX4D.js} +11 -11
- package/dist/{usage-U3VFDLZD.js → usage-4AFZVL6M.js} +5 -5
- package/dist/{wait-G7OYEH7U.js → wait-NG2TIA6W.js} +6 -6
- package/dist/wd-bin.js +4 -4
- package/dist/web/assets/{PtyView-DUabYdWF.js → PtyView-D9qrtXgY.js} +2 -2
- package/dist/web/assets/{PtyView-DUabYdWF.js.map → PtyView-D9qrtXgY.js.map} +1 -1
- package/dist/web/assets/{index-BGsdgBN7.css → index-BzKRYccu.css} +1 -1
- package/dist/web/assets/index-D91uDCop.js +126 -0
- package/dist/web/assets/index-D91uDCop.js.map +1 -0
- package/dist/web/index.html +2 -2
- package/dist/{web-VSC6HQQL.js → web-JTQP5Q4L.js} +520 -377
- package/dist/web-JTQP5Q4L.js.map +1 -0
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/plugins/work-tree/skills/work-sessions/SKILL.md +2 -0
- package/dist/chunk-7O2H2KOQ.js.map +0 -1
- package/dist/chunk-MOSPIQZF.js.map +0 -1
- package/dist/chunk-PQXKYBR5.js +0 -9
- package/dist/web/assets/index-6hLYu1gO.js +0 -126
- package/dist/web/assets/index-6hLYu1gO.js.map +0 -1
- package/dist/web-VSC6HQQL.js.map +0 -1
- /package/dist/{account-H25RWDLL.js.map → account-2C2YDOIV.js.map} +0 -0
- /package/dist/{add-repo-6JP5XWPF.js.map → add-repo-ENM45555.js.map} +0 -0
- /package/dist/{answer-H3PTZZAX.js.map → answer-N5BGRCZE.js.map} +0 -0
- /package/dist/{attach-STMGUOI5.js.map → attach-FRLECF6U.js.map} +0 -0
- /package/dist/{block-XJKNFMLV.js.map → block-SPIM2L7Z.js.map} +0 -0
- /package/dist/{broadcast-RTFVOYTS.js.map → broadcast-I6A7Z3UL.js.map} +0 -0
- /package/dist/{catchup-4ANFB24Y.js.map → catchup-XJ4EOYUC.js.map} +0 -0
- /package/dist/{chunk-VHPMBDOM.js.map → chunk-257RJ7GN.js.map} +0 -0
- /package/dist/{chunk-EL7CYYJF.js.map → chunk-3GI5PO57.js.map} +0 -0
- /package/dist/{chunk-VIBM55WP.js.map → chunk-3IUD7OOG.js.map} +0 -0
- /package/dist/{chunk-4IUSJXOY.js.map → chunk-3NSUFJVB.js.map} +0 -0
- /package/dist/{chunk-HVZAGQUV.js.map → chunk-4SRABK2D.js.map} +0 -0
- /package/dist/{chunk-7JNYJ6RL.js.map → chunk-4UBX7TEX.js.map} +0 -0
- /package/dist/{chunk-J4JORJBH.js.map → chunk-5IEFHZWE.js.map} +0 -0
- /package/dist/{chunk-B7Q6K5EM.js.map → chunk-5WBYGJS3.js.map} +0 -0
- /package/dist/{chunk-2KL5MJIJ.js.map → chunk-7KLDOQG6.js.map} +0 -0
- /package/dist/{chunk-MKHZFXGX.js.map → chunk-AF6XEJTP.js.map} +0 -0
- /package/dist/{chunk-XQ2CNRYH.js.map → chunk-AIQ4I4AT.js.map} +0 -0
- /package/dist/{chunk-3H5ZMSJT.js.map → chunk-BVH6EFV5.js.map} +0 -0
- /package/dist/{chunk-RHQ5DWJQ.js.map → chunk-EOK3XZCM.js.map} +0 -0
- /package/dist/{chunk-JJTEW3LB.js.map → chunk-EZPZNHEU.js.map} +0 -0
- /package/dist/{chunk-34DFG4E5.js.map → chunk-FUU47TYZ.js.map} +0 -0
- /package/dist/{chunk-D4FYTREI.js.map → chunk-GMZV4RRV.js.map} +0 -0
- /package/dist/{chunk-BLNWKPL7.js.map → chunk-JK3YCAP7.js.map} +0 -0
- /package/dist/{chunk-LFA2ACWM.js.map → chunk-JMFEIHMB.js.map} +0 -0
- /package/dist/{chunk-YF4MPWTZ.js.map → chunk-JPVP46D4.js.map} +0 -0
- /package/dist/{chunk-MZFSW3VF.js.map → chunk-KTJ5QJCN.js.map} +0 -0
- /package/dist/{chunk-XHIL6L5U.js.map → chunk-L562BYTL.js.map} +0 -0
- /package/dist/{chunk-YDXRZ5SD.js.map → chunk-MGKCH7SE.js.map} +0 -0
- /package/dist/{chunk-U55AFVHY.js.map → chunk-MJZ6XOXR.js.map} +0 -0
- /package/dist/{chunk-6GNGPYL6.js.map → chunk-MVTA24XH.js.map} +0 -0
- /package/dist/{chunk-ILF3BNIX.js.map → chunk-N4ADXF5N.js.map} +0 -0
- /package/dist/{chunk-CP6W4MTM.js.map → chunk-NR4IKXRO.js.map} +0 -0
- /package/dist/{chunk-PQXKYBR5.js.map → chunk-NYOJVO47.js.map} +0 -0
- /package/dist/{chunk-T7RSU35I.js.map → chunk-OIC2PWUH.js.map} +0 -0
- /package/dist/{chunk-XT2VC2OW.js.map → chunk-OJPGOZNT.js.map} +0 -0
- /package/dist/{chunk-ONWG3PI5.js.map → chunk-QG46R3C4.js.map} +0 -0
- /package/dist/{chunk-5DY4YW36.js.map → chunk-R2JBLEOC.js.map} +0 -0
- /package/dist/{chunk-2QIX5XDL.js.map → chunk-RIKAEVFL.js.map} +0 -0
- /package/dist/{chunk-RUN6ISZA.js.map → chunk-RZUXQ7ZP.js.map} +0 -0
- /package/dist/{chunk-MRE4WOHB.js.map → chunk-S2TSH66J.js.map} +0 -0
- /package/dist/{chunk-GBNEIQLL.js.map → chunk-TAQB6FQY.js.map} +0 -0
- /package/dist/{chunk-N6QKAQ4V.js.map → chunk-TNCSXIXB.js.map} +0 -0
- /package/dist/{chunk-X3SDPWEE.js.map → chunk-UHWJXERU.js.map} +0 -0
- /package/dist/{chunk-KMED3WHH.js.map → chunk-UWHBW4G2.js.map} +0 -0
- /package/dist/{chunk-KX4WF3XR.js.map → chunk-VB6HRYG6.js.map} +0 -0
- /package/dist/{chunk-PUDJV2PE.js.map → chunk-VFPJ7CRK.js.map} +0 -0
- /package/dist/{chunk-GYR7P3V2.js.map → chunk-VWQ7LZFO.js.map} +0 -0
- /package/dist/{chunk-CWQQCJKO.js.map → chunk-W75NWJRU.js.map} +0 -0
- /package/dist/{chunk-VR53YKEJ.js.map → chunk-WORXBWCC.js.map} +0 -0
- /package/dist/{chunk-2KGZRG43.js.map → chunk-WXUAIB32.js.map} +0 -0
- /package/dist/{chunk-FVGDOG5T.js.map → chunk-YTYOVM4A.js.map} +0 -0
- /package/dist/{chunk-3DZR5LFG.js.map → chunk-Z3KFELLM.js.map} +0 -0
- /package/dist/{cleanup-K2QJM4DG.js.map → cleanup-SROJYVPL.js.map} +0 -0
- /package/dist/{cli-54DS3EWN.js.map → cli-L7LAM65Q.js.map} +0 -0
- /package/dist/{config-KXMYBBR2.js.map → config-2LB26LNE.js.map} +0 -0
- /package/dist/{diff-YE4NJ3ZF.js.map → diff-IP3UYSQC.js.map} +0 -0
- /package/dist/{digest-HHN5ZHPV.js.map → digest-GP4JUCKJ.js.map} +0 -0
- /package/dist/{fork-WBVQ64NR.js.map → fork-AEA54A4Q.js.map} +0 -0
- /package/dist/{history-HDGGYOZK.js.map → history-2KDR7AMX.js.map} +0 -0
- /package/dist/{hook-6QS5OPM6.js.map → hook-TRWITUW6.js.map} +0 -0
- /package/dist/{hydrate-LNFOMIY4.js.map → hydrate-B6XLDX3A.js.map} +0 -0
- /package/dist/{init-YKVXA7HB.js.map → init-EP5TCKCI.js.map} +0 -0
- /package/dist/{install-skills-O3X5SQP7.js.map → install-skills-LQO7EHL7.js.map} +0 -0
- /package/dist/{keep-IWCSOV3Y.js.map → keep-VWCXTRLQ.js.map} +0 -0
- /package/dist/{list-6WP3AWGR.js.map → list-OTYXJ7PG.js.map} +0 -0
- /package/dist/{move-YD6J4BEI.js.map → move-2XPFAJ6C.js.map} +0 -0
- /package/dist/{note-X2FOVB5E.js.map → note-LXVBPO7G.js.map} +0 -0
- /package/dist/{overlaps-EXDYGDL6.js.map → overlaps-ATTRQOYO.js.map} +0 -0
- /package/dist/{pin-IOV7TXP2.js.map → pin-6FYKLGH7.js.map} +0 -0
- /package/dist/{pr-J6MQ37D2.js.map → pr-32HTOP6M.js.map} +0 -0
- /package/dist/{prune-B47MCBAQ.js.map → prune-W5EYYUPS.js.map} +0 -0
- /package/dist/{pty-host-QW4AZXH3.js.map → pty-host-LOT7Y5IF.js.map} +0 -0
- /package/dist/{read-JAIM2DYY.js.map → read-GVGKDMI6.js.map} +0 -0
- /package/dist/{recent-XNVY5UVF.js.map → recent-YAHDS2L7.js.map} +0 -0
- /package/dist/{remove-SBTYBMEX.js.map → remove-BS4INNKF.js.map} +0 -0
- /package/dist/{restart-QO7UT3BS.js.map → restart-FU4L3Y6D.js.map} +0 -0
- /package/dist/{resume-SEN6WIHS.js.map → resume-T3UQ7HWI.js.map} +0 -0
- /package/dist/{run-RTYE6K3I.js.map → run-W6VRRIPD.js.map} +0 -0
- /package/dist/{screen-N2TLCEUU.js.map → screen-XPLXJDTN.js.map} +0 -0
- /package/dist/{search-D5ECXHUE.js.map → search-FI2BA7UV.js.map} +0 -0
- /package/dist/{section-4L3EIRIA.js.map → section-2WP2FU74.js.map} +0 -0
- /package/dist/{send-MGIL5V3H.js.map → send-MKQHJRUK.js.map} +0 -0
- /package/dist/{sessions-2OK2D7NT.js.map → sessions-PLY3RLOO.js.map} +0 -0
- /package/dist/{snooze-IYRTDL3T.js.map → snooze-66DER2G2.js.map} +0 -0
- /package/dist/{start-5LZ7YZGK.js.map → start-CH76J5IE.js.map} +0 -0
- /package/dist/{status-AXM4QWC5.js.map → status-CJSOIL5Y.js.map} +0 -0
- /package/dist/{stop-RB5PF5I6.js.map → stop-VH2KGCWH.js.map} +0 -0
- /package/dist/{sync-RRDTJ7S6.js.map → sync-TUDFXYWS.js.map} +0 -0
- /package/dist/{time-INJY7DSM.js.map → time-U7QHPL5U.js.map} +0 -0
- /package/dist/{timesheet-TPXVMNSL.js.map → timesheet-7KASD74P.js.map} +0 -0
- /package/dist/{tree-6OE7SYA2.js.map → tree-KZS7ZWLG.js.map} +0 -0
- /package/dist/{update-YMDG7O3M.js.map → update-AQKZUX4D.js.map} +0 -0
- /package/dist/{usage-U3VFDLZD.js.map → usage-4AFZVL6M.js.map} +0 -0
- /package/dist/{wait-G7OYEH7U.js.map → wait-NG2TIA6W.js.map} +0 -0
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
ensureAgentPath,
|
|
4
4
|
restartHost
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-JK3YCAP7.js";
|
|
6
6
|
import {
|
|
7
7
|
createMonthGather,
|
|
8
8
|
defaultTimeDeps,
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
graphProblem,
|
|
17
17
|
signOutGraph,
|
|
18
18
|
startDeviceLogin
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-GMZV4RRV.js";
|
|
20
20
|
import {
|
|
21
21
|
addTask,
|
|
22
22
|
completeTask,
|
|
@@ -38,7 +38,7 @@ import {
|
|
|
38
38
|
serveSpa,
|
|
39
39
|
sessionBaseForPath,
|
|
40
40
|
submitReviewSchema
|
|
41
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-4SRABK2D.js";
|
|
42
42
|
import {
|
|
43
43
|
announceChange,
|
|
44
44
|
createArchivedRows,
|
|
@@ -53,25 +53,28 @@ import {
|
|
|
53
53
|
stageSeenKey,
|
|
54
54
|
storeHolding,
|
|
55
55
|
withRestoring
|
|
56
|
-
} from "./chunk-
|
|
56
|
+
} from "./chunk-L562BYTL.js";
|
|
57
57
|
import {
|
|
58
58
|
createDigestSource
|
|
59
|
-
} from "./chunk-
|
|
59
|
+
} from "./chunk-257RJ7GN.js";
|
|
60
60
|
import {
|
|
61
61
|
createBuildFoldersJob,
|
|
62
62
|
defaultBranchTidyDeps,
|
|
63
63
|
defaultBuildFoldersDeps,
|
|
64
64
|
deleteMergedBranches,
|
|
65
65
|
findMergedBranches
|
|
66
|
-
} from "./chunk-
|
|
66
|
+
} from "./chunk-VB6HRYG6.js";
|
|
67
67
|
import {
|
|
68
68
|
defaultCleanupDeps
|
|
69
|
-
} from "./chunk-
|
|
69
|
+
} from "./chunk-UHWJXERU.js";
|
|
70
70
|
import {
|
|
71
71
|
DiffStatCache,
|
|
72
72
|
findOverlaps,
|
|
73
73
|
wantsDiffStat
|
|
74
|
-
} from "./chunk-
|
|
74
|
+
} from "./chunk-OJPGOZNT.js";
|
|
75
|
+
import {
|
|
76
|
+
sendToSession
|
|
77
|
+
} from "./chunk-KWHHB737.js";
|
|
75
78
|
import {
|
|
76
79
|
MAX_NOTE_CHARS,
|
|
77
80
|
readNote,
|
|
@@ -89,7 +92,7 @@ import {
|
|
|
89
92
|
removeBlocker,
|
|
90
93
|
sweepBlocks,
|
|
91
94
|
unblockedPrompt
|
|
92
|
-
} from "./chunk-
|
|
95
|
+
} from "./chunk-3IUD7OOG.js";
|
|
93
96
|
import {
|
|
94
97
|
jiraWorklogPoster,
|
|
95
98
|
logWorkDay,
|
|
@@ -107,28 +110,25 @@ import {
|
|
|
107
110
|
removeAgentAccount,
|
|
108
111
|
setDefaultAgentAccount,
|
|
109
112
|
switchRefusal
|
|
110
|
-
} from "./chunk-
|
|
113
|
+
} from "./chunk-7KLDOQG6.js";
|
|
111
114
|
import {
|
|
112
115
|
buildUsage,
|
|
113
116
|
realUsageDeps,
|
|
114
117
|
setupAgentUsage
|
|
115
|
-
} from "./chunk-
|
|
118
|
+
} from "./chunk-YTYOVM4A.js";
|
|
116
119
|
import {
|
|
117
120
|
sessionWorkTime
|
|
118
|
-
} from "./chunk-
|
|
121
|
+
} from "./chunk-JPVP46D4.js";
|
|
119
122
|
import "./chunk-UVZITL47.js";
|
|
120
|
-
import {
|
|
121
|
-
sendToSession
|
|
122
|
-
} from "./chunk-KWHHB737.js";
|
|
123
123
|
import {
|
|
124
124
|
defaultForkDeps,
|
|
125
125
|
forkSession,
|
|
126
126
|
startSessionWithPrompt
|
|
127
|
-
} from "./chunk-
|
|
127
|
+
} from "./chunk-VFPJ7CRK.js";
|
|
128
128
|
import {
|
|
129
129
|
addRepoRefusal,
|
|
130
130
|
addedRepoNote
|
|
131
|
-
} from "./chunk-
|
|
131
|
+
} from "./chunk-AF6XEJTP.js";
|
|
132
132
|
import {
|
|
133
133
|
BehindCache,
|
|
134
134
|
behindMain,
|
|
@@ -144,14 +144,14 @@ import {
|
|
|
144
144
|
stackedOn,
|
|
145
145
|
updateFromBase,
|
|
146
146
|
updateFromMain
|
|
147
|
-
} from "./chunk-
|
|
147
|
+
} from "./chunk-WORXBWCC.js";
|
|
148
148
|
import {
|
|
149
149
|
askCatchUp,
|
|
150
150
|
cachedCatchUp,
|
|
151
151
|
catchUp,
|
|
152
152
|
catchUpFacts,
|
|
153
153
|
forgetCatchUp
|
|
154
|
-
} from "./chunk-
|
|
154
|
+
} from "./chunk-WXUAIB32.js";
|
|
155
155
|
import {
|
|
156
156
|
applyPlacePatch,
|
|
157
157
|
applySectionOp,
|
|
@@ -248,7 +248,7 @@ import {
|
|
|
248
248
|
checkTools,
|
|
249
249
|
saveFolders,
|
|
250
250
|
setupState
|
|
251
|
-
} from "./chunk-
|
|
251
|
+
} from "./chunk-Z3KFELLM.js";
|
|
252
252
|
import {
|
|
253
253
|
RepoAdminError,
|
|
254
254
|
deleteGroup,
|
|
@@ -260,7 +260,7 @@ import {
|
|
|
260
260
|
setRepoIgnored,
|
|
261
261
|
setReviewMode,
|
|
262
262
|
setScanRoot
|
|
263
|
-
} from "./chunk-
|
|
263
|
+
} from "./chunk-AIQ4I4AT.js";
|
|
264
264
|
import {
|
|
265
265
|
freeLeftovers,
|
|
266
266
|
leftoversOf,
|
|
@@ -269,32 +269,32 @@ import {
|
|
|
269
269
|
parsePrRef,
|
|
270
270
|
resolvePrToStart,
|
|
271
271
|
workOnPrPrompt
|
|
272
|
-
} from "./chunk-
|
|
272
|
+
} from "./chunk-FUU47TYZ.js";
|
|
273
273
|
import {
|
|
274
274
|
legacyUnsafeCheck
|
|
275
|
-
} from "./chunk-
|
|
276
|
-
import {
|
|
277
|
-
agentsBySession,
|
|
278
|
-
summarizeAgents
|
|
279
|
-
} from "./chunk-CP6W4MTM.js";
|
|
275
|
+
} from "./chunk-TAQB6FQY.js";
|
|
280
276
|
import {
|
|
281
277
|
howToLift
|
|
282
278
|
} from "./chunk-FZHFD2AY.js";
|
|
279
|
+
import {
|
|
280
|
+
agentsBySession,
|
|
281
|
+
summarizeAgents
|
|
282
|
+
} from "./chunk-NR4IKXRO.js";
|
|
283
283
|
import {
|
|
284
284
|
resolveWorkBinPath
|
|
285
285
|
} from "./chunk-AH5TM3NB.js";
|
|
286
286
|
import {
|
|
287
287
|
editorArgs,
|
|
288
288
|
openUrl
|
|
289
|
-
} from "./chunk-
|
|
289
|
+
} from "./chunk-3GI5PO57.js";
|
|
290
290
|
import {
|
|
291
291
|
removeWorktreeInChild
|
|
292
|
-
} from "./chunk-
|
|
292
|
+
} from "./chunk-UWHBW4G2.js";
|
|
293
293
|
import {
|
|
294
294
|
archiveMergedSession,
|
|
295
295
|
archiveWaiting,
|
|
296
296
|
defaultArchiveDeps
|
|
297
|
-
} from "./chunk-
|
|
297
|
+
} from "./chunk-3NSUFJVB.js";
|
|
298
298
|
import {
|
|
299
299
|
cleanupVerdict,
|
|
300
300
|
createCleanupJob
|
|
@@ -314,7 +314,7 @@ import {
|
|
|
314
314
|
retireResolvedReplies,
|
|
315
315
|
sessionRepoRefs,
|
|
316
316
|
withThreadContext
|
|
317
|
-
} from "./chunk-
|
|
317
|
+
} from "./chunk-S2TSH66J.js";
|
|
318
318
|
import {
|
|
319
319
|
DEFAULT_TRUSTED_BOTS,
|
|
320
320
|
createCiStore,
|
|
@@ -324,23 +324,23 @@ import {
|
|
|
324
324
|
openThreadsOf,
|
|
325
325
|
reviewMessage,
|
|
326
326
|
subAgentHint
|
|
327
|
-
} from "./chunk-
|
|
327
|
+
} from "./chunk-MGKCH7SE.js";
|
|
328
328
|
import {
|
|
329
329
|
sessionStatusView,
|
|
330
330
|
shownState
|
|
331
|
-
} from "./chunk-
|
|
331
|
+
} from "./chunk-EOK3XZCM.js";
|
|
332
332
|
import {
|
|
333
333
|
internalReadOnly,
|
|
334
334
|
runInternal,
|
|
335
335
|
runInternalReadOnly,
|
|
336
336
|
summarizeCheckpoint,
|
|
337
337
|
throttleTrailing
|
|
338
|
-
} from "./chunk-
|
|
338
|
+
} from "./chunk-EZPZNHEU.js";
|
|
339
339
|
import {
|
|
340
340
|
computeDiff,
|
|
341
341
|
computeRangeDiff,
|
|
342
342
|
parseGitDiff
|
|
343
|
-
} from "./chunk-
|
|
343
|
+
} from "./chunk-R2JBLEOC.js";
|
|
344
344
|
import {
|
|
345
345
|
commandWords,
|
|
346
346
|
describeProcess,
|
|
@@ -357,7 +357,7 @@ import {
|
|
|
357
357
|
keyedQueue,
|
|
358
358
|
oneAtATime,
|
|
359
359
|
runWorkChild
|
|
360
|
-
} from "./chunk-
|
|
360
|
+
} from "./chunk-W75NWJRU.js";
|
|
361
361
|
import {
|
|
362
362
|
configurePtyPool,
|
|
363
363
|
detachPtyPool,
|
|
@@ -381,21 +381,21 @@ import {
|
|
|
381
381
|
syncPtyPool,
|
|
382
382
|
terminalTicketUrl,
|
|
383
383
|
writeToPty
|
|
384
|
-
} from "./chunk-
|
|
384
|
+
} from "./chunk-QG46R3C4.js";
|
|
385
385
|
import "./chunk-G5AAYK56.js";
|
|
386
386
|
import {
|
|
387
387
|
disposeAllWatchers,
|
|
388
388
|
disposeSessionWatcher,
|
|
389
389
|
findSession as findSession2,
|
|
390
390
|
subscribeSession
|
|
391
|
-
} from "./chunk-
|
|
391
|
+
} from "./chunk-MVTA24XH.js";
|
|
392
392
|
import "./chunk-IIIAV6OD.js";
|
|
393
393
|
import "./chunk-RECQAHC5.js";
|
|
394
394
|
import {
|
|
395
395
|
teardownWorktree,
|
|
396
396
|
toBaseSpec,
|
|
397
397
|
wouldRefuseRemoval
|
|
398
|
-
} from "./chunk-
|
|
398
|
+
} from "./chunk-JMFEIHMB.js";
|
|
399
399
|
import "./chunk-UH72CZAX.js";
|
|
400
400
|
import {
|
|
401
401
|
isWorktreeFolder
|
|
@@ -405,15 +405,15 @@ import {
|
|
|
405
405
|
assistantDir,
|
|
406
406
|
describeView,
|
|
407
407
|
writeAssistantContext
|
|
408
|
-
} from "./chunk-
|
|
408
|
+
} from "./chunk-KTJ5QJCN.js";
|
|
409
409
|
import "./chunk-7E5XPDKX.js";
|
|
410
|
-
import "./chunk-
|
|
410
|
+
import "./chunk-RZUXQ7ZP.js";
|
|
411
411
|
import {
|
|
412
412
|
NOTE_NUDGE,
|
|
413
413
|
findSessionForCwd,
|
|
414
414
|
readPendingForSession,
|
|
415
415
|
readPendingForWorktree
|
|
416
|
-
} from "./chunk-
|
|
416
|
+
} from "./chunk-N4ADXF5N.js";
|
|
417
417
|
import {
|
|
418
418
|
getCommentFileStore
|
|
419
419
|
} from "./chunk-RVSRZ57P.js";
|
|
@@ -433,17 +433,17 @@ import {
|
|
|
433
433
|
stageInputOf,
|
|
434
434
|
withRequiredChecks,
|
|
435
435
|
workElsewhere
|
|
436
|
-
} from "./chunk-
|
|
436
|
+
} from "./chunk-BVH6EFV5.js";
|
|
437
437
|
import {
|
|
438
438
|
createSessionBranches
|
|
439
|
-
} from "./chunk-
|
|
439
|
+
} from "./chunk-5IEFHZWE.js";
|
|
440
440
|
import {
|
|
441
441
|
defaultHost,
|
|
442
442
|
hostById,
|
|
443
443
|
hostForRepo,
|
|
444
444
|
hostOfPrUrl,
|
|
445
445
|
originHostname
|
|
446
|
-
} from "./chunk-
|
|
446
|
+
} from "./chunk-MJZ6XOXR.js";
|
|
447
447
|
import {
|
|
448
448
|
MAX_THREAD_BODY
|
|
449
449
|
} from "./chunk-FGPXMAYU.js";
|
|
@@ -456,7 +456,7 @@ import {
|
|
|
456
456
|
readSessionBranches,
|
|
457
457
|
repoNameOf,
|
|
458
458
|
wasPushed
|
|
459
|
-
} from "./chunk-
|
|
459
|
+
} from "./chunk-OIC2PWUH.js";
|
|
460
460
|
import {
|
|
461
461
|
enrollProblem,
|
|
462
462
|
groupProblem,
|
|
@@ -557,7 +557,7 @@ import {
|
|
|
557
557
|
updateCheckpoint,
|
|
558
558
|
whileRestoring,
|
|
559
559
|
writeArchiveRecord
|
|
560
|
-
} from "./chunk-
|
|
560
|
+
} from "./chunk-7CABBTGX.js";
|
|
561
561
|
import {
|
|
562
562
|
dayKey
|
|
563
563
|
} from "./chunk-NEJVK5CF.js";
|
|
@@ -590,10 +590,10 @@ import {
|
|
|
590
590
|
readJsonlSince,
|
|
591
591
|
refShaFromFiles,
|
|
592
592
|
workingBranch
|
|
593
|
-
} from "./chunk-
|
|
593
|
+
} from "./chunk-AQHGYLVN.js";
|
|
594
594
|
import {
|
|
595
595
|
VERSION
|
|
596
|
-
} from "./chunk-
|
|
596
|
+
} from "./chunk-NYOJVO47.js";
|
|
597
597
|
import {
|
|
598
598
|
resolveProjectTarget
|
|
599
599
|
} from "./chunk-7UXV4X2Y.js";
|
|
@@ -659,11 +659,11 @@ import {
|
|
|
659
659
|
} from "./chunk-6THUVP6T.js";
|
|
660
660
|
|
|
661
661
|
// src/commands/web.ts
|
|
662
|
-
import
|
|
662
|
+
import fs21 from "fs";
|
|
663
663
|
import chalk from "chalk";
|
|
664
664
|
|
|
665
665
|
// src/server/web-server.ts
|
|
666
|
-
import
|
|
666
|
+
import fs18 from "fs";
|
|
667
667
|
|
|
668
668
|
// src/core/conversations/last-reply.ts
|
|
669
669
|
function lastReplyOf(entries) {
|
|
@@ -1598,6 +1598,280 @@ function mountSessionReviewRoutes(app, deps) {
|
|
|
1598
1598
|
return { drop: reviews.drop };
|
|
1599
1599
|
}
|
|
1600
1600
|
|
|
1601
|
+
// src/server/routes/session-show-routes.ts
|
|
1602
|
+
import fs4 from "fs";
|
|
1603
|
+
|
|
1604
|
+
// src/core/sessions/shown-file.ts
|
|
1605
|
+
import path2 from "path";
|
|
1606
|
+
function shownKind(file) {
|
|
1607
|
+
const ext = file.slice(file.lastIndexOf(".") + 1).toLowerCase();
|
|
1608
|
+
if (ext === "md" || ext === "markdown" || ext === "mdx") return "markdown";
|
|
1609
|
+
if (["png", "jpg", "jpeg", "gif", "webp", "bmp", "avif"].includes(ext)) return "image";
|
|
1610
|
+
return "text";
|
|
1611
|
+
}
|
|
1612
|
+
function imageType(file) {
|
|
1613
|
+
const ext = file.slice(file.lastIndexOf(".") + 1).toLowerCase();
|
|
1614
|
+
const types = {
|
|
1615
|
+
png: "image/png",
|
|
1616
|
+
jpg: "image/jpeg",
|
|
1617
|
+
jpeg: "image/jpeg",
|
|
1618
|
+
gif: "image/gif",
|
|
1619
|
+
webp: "image/webp",
|
|
1620
|
+
bmp: "image/bmp",
|
|
1621
|
+
avif: "image/avif"
|
|
1622
|
+
};
|
|
1623
|
+
return types[ext] ?? null;
|
|
1624
|
+
}
|
|
1625
|
+
var norm = (p) => path2.resolve(p).replace(/\\/g, "/").replace(/\/+$/, "");
|
|
1626
|
+
var sameStart = (a, b) => process.platform === "win32" ? a.toLowerCase() === b.toLowerCase() : a === b;
|
|
1627
|
+
function locateInSession(s, file) {
|
|
1628
|
+
const target = norm(file);
|
|
1629
|
+
const roots = s.paths.map((p) => ({ repo: path2.basename(norm(p)), root: norm(p) }));
|
|
1630
|
+
if (s.isGroup && roots.length) {
|
|
1631
|
+
const parents = [...new Set(roots.map((r) => path2.posix.dirname(r.root)))];
|
|
1632
|
+
if (parents.length === 1) roots.push({ repo: "", root: parents[0] });
|
|
1633
|
+
}
|
|
1634
|
+
const holding = roots.filter((r) => target.length > r.root.length + 1 && sameStart(target.slice(0, r.root.length + 1), `${r.root}/`)).sort((a, b) => b.root.length - a.root.length)[0];
|
|
1635
|
+
if (!holding) return null;
|
|
1636
|
+
const rel = target.slice(holding.root.length + 1);
|
|
1637
|
+
if (holding.repo === "" && rel.includes("/")) return null;
|
|
1638
|
+
return { repo: holding.repo, path: rel };
|
|
1639
|
+
}
|
|
1640
|
+
function createShownFiles(deps) {
|
|
1641
|
+
const shown = /* @__PURE__ */ new Map();
|
|
1642
|
+
return {
|
|
1643
|
+
get: (sessionId) => shown.get(sessionId) ?? null,
|
|
1644
|
+
show(sessionId, file) {
|
|
1645
|
+
const next = { repo: file.repo, path: file.path, at: (deps.now?.() ?? /* @__PURE__ */ new Date()).toISOString() };
|
|
1646
|
+
shown.set(sessionId, next);
|
|
1647
|
+
deps.onChange(sessionId);
|
|
1648
|
+
return next;
|
|
1649
|
+
},
|
|
1650
|
+
/** False when it showed nothing. */
|
|
1651
|
+
close(sessionId) {
|
|
1652
|
+
if (!shown.delete(sessionId)) return false;
|
|
1653
|
+
deps.onChange(sessionId);
|
|
1654
|
+
return true;
|
|
1655
|
+
}
|
|
1656
|
+
};
|
|
1657
|
+
}
|
|
1658
|
+
|
|
1659
|
+
// src/core/worktree/code-browse.ts
|
|
1660
|
+
import fs3 from "fs";
|
|
1661
|
+
import path3 from "path";
|
|
1662
|
+
var MAX_CODE_FILES = 5e4;
|
|
1663
|
+
var MAX_CODE_FILE_BYTES = 2 * 1024 * 1024;
|
|
1664
|
+
var LIST_TTL_MS = 3e3;
|
|
1665
|
+
function codeRoots(s) {
|
|
1666
|
+
return s.paths.map((p) => ({ name: path3.basename(p), root: p }));
|
|
1667
|
+
}
|
|
1668
|
+
function groupRoot(s) {
|
|
1669
|
+
if (!s.isGroup || s.paths.length === 0) return null;
|
|
1670
|
+
const parents = [...new Set(s.paths.map((p) => path3.dirname(p)))];
|
|
1671
|
+
return parents.length === 1 ? parents[0] : null;
|
|
1672
|
+
}
|
|
1673
|
+
var realIo = {
|
|
1674
|
+
git: (cwd, args) => runGitAsync(cwd, { args })
|
|
1675
|
+
};
|
|
1676
|
+
var nul = (out) => out.split("\0").filter(Boolean);
|
|
1677
|
+
var fwd = (p) => p.replace(/\\/g, "/");
|
|
1678
|
+
var listCache = /* @__PURE__ */ new Map();
|
|
1679
|
+
var MAX_LISTS = 12;
|
|
1680
|
+
var sets = /* @__PURE__ */ new WeakMap();
|
|
1681
|
+
function setOf(files) {
|
|
1682
|
+
let set = sets.get(files);
|
|
1683
|
+
if (!set) sets.set(files, set = new Set(files));
|
|
1684
|
+
return set;
|
|
1685
|
+
}
|
|
1686
|
+
async function isListed(root, rel, io = realIo, now = Date.now()) {
|
|
1687
|
+
const hit = listCache.get(root);
|
|
1688
|
+
if (hit && now - hit.at < LIST_TTL_MS) return setOf(await hit.files).has(rel);
|
|
1689
|
+
const r = await io.git(root, ["ls-files", "-c", "-o", "--exclude-standard", "-z", "--", `:(literal)${rel}`]);
|
|
1690
|
+
return r.status === 0 && nul(r.stdout).some((f) => fwd(f) === rel);
|
|
1691
|
+
}
|
|
1692
|
+
function listRepoFiles(root, io = realIo, now = Date.now()) {
|
|
1693
|
+
const hit = listCache.get(root);
|
|
1694
|
+
if (hit && now - hit.at < LIST_TTL_MS) return hit.files;
|
|
1695
|
+
const files = io.git(root, ["ls-files", "-t", "-c", "-o", "-d", "--exclude-standard", "-z"]).then((r) => {
|
|
1696
|
+
if (r.status !== 0) return [];
|
|
1697
|
+
const listed = /* @__PURE__ */ new Set();
|
|
1698
|
+
const gone = /* @__PURE__ */ new Set();
|
|
1699
|
+
for (const e of nul(r.stdout)) {
|
|
1700
|
+
const p = fwd(e.slice(2));
|
|
1701
|
+
if (e[0] === "R") gone.add(p);
|
|
1702
|
+
else listed.add(p);
|
|
1703
|
+
}
|
|
1704
|
+
return [...listed].filter((f) => !gone.has(f)).sort();
|
|
1705
|
+
});
|
|
1706
|
+
listCache.delete(root);
|
|
1707
|
+
listCache.set(root, { at: now, files });
|
|
1708
|
+
while (listCache.size > MAX_LISTS) listCache.delete(listCache.keys().next().value);
|
|
1709
|
+
return files;
|
|
1710
|
+
}
|
|
1711
|
+
async function changedFiles(root, base, io = realIo) {
|
|
1712
|
+
const out = /* @__PURE__ */ new Set();
|
|
1713
|
+
const status = await io.git(root, ["status", "--porcelain=v1", "-z", "--untracked-files=all"]);
|
|
1714
|
+
if (status.status === 0) {
|
|
1715
|
+
const entries = nul(status.stdout);
|
|
1716
|
+
for (let i = 0; i < entries.length; i++) {
|
|
1717
|
+
const e = entries[i];
|
|
1718
|
+
const code = e.slice(0, 2);
|
|
1719
|
+
out.add(fwd(e.slice(3)));
|
|
1720
|
+
if (code.includes("R") || code.includes("C")) i++;
|
|
1721
|
+
}
|
|
1722
|
+
}
|
|
1723
|
+
let from = null;
|
|
1724
|
+
for (const ref of base ? base.startsWith("origin/") ? [base] : [base, `origin/${base}`] : ["origin/HEAD"]) {
|
|
1725
|
+
const mb = await io.git(root, ["merge-base", ref, "HEAD"]);
|
|
1726
|
+
const sha = mb.stdout.trim();
|
|
1727
|
+
if (mb.status !== 0 || !sha || sha === from) continue;
|
|
1728
|
+
if (!from || (await io.git(root, ["merge-base", "--is-ancestor", from, sha])).status === 0) from = sha;
|
|
1729
|
+
}
|
|
1730
|
+
if (!from && base) {
|
|
1731
|
+
const mb = await io.git(root, ["merge-base", "origin/HEAD", "HEAD"]);
|
|
1732
|
+
if (mb.status === 0 && mb.stdout.trim()) from = mb.stdout.trim();
|
|
1733
|
+
}
|
|
1734
|
+
if (from) {
|
|
1735
|
+
const diff = await io.git(root, ["diff", "--name-only", "-z", `${from}...HEAD`]);
|
|
1736
|
+
if (diff.status === 0) for (const f of nul(diff.stdout)) out.add(fwd(f));
|
|
1737
|
+
}
|
|
1738
|
+
return [...out].sort();
|
|
1739
|
+
}
|
|
1740
|
+
async function listCodeFiles(s, io = realIo) {
|
|
1741
|
+
const repos = await Promise.all(
|
|
1742
|
+
codeRoots(s).map(async ({ name, root }) => {
|
|
1743
|
+
if (!fs3.existsSync(root)) return { name, files: [], changed: [], truncated: false };
|
|
1744
|
+
const [all, changed] = await Promise.all([listRepoFiles(root, io), changedFiles(root, s.baseBranches?.[root] ?? s.baseBranch, io)]);
|
|
1745
|
+
const listed = new Set(all);
|
|
1746
|
+
return {
|
|
1747
|
+
name,
|
|
1748
|
+
files: all.slice(0, MAX_CODE_FILES),
|
|
1749
|
+
changed: changed.filter((f) => listed.has(f)),
|
|
1750
|
+
truncated: all.length > MAX_CODE_FILES
|
|
1751
|
+
};
|
|
1752
|
+
})
|
|
1753
|
+
);
|
|
1754
|
+
return { group: !!s.isGroup, rootFiles: groupRootFiles(s), repos };
|
|
1755
|
+
}
|
|
1756
|
+
function groupRootFiles(s) {
|
|
1757
|
+
const dir = groupRoot(s);
|
|
1758
|
+
if (!dir) return [];
|
|
1759
|
+
try {
|
|
1760
|
+
return fs3.readdirSync(dir, { withFileTypes: true }).filter((e) => e.isFile() && isGroupNote(e.name)).map((e) => e.name).sort();
|
|
1761
|
+
} catch {
|
|
1762
|
+
return [];
|
|
1763
|
+
}
|
|
1764
|
+
}
|
|
1765
|
+
var isGroupNote = (name) => !name.startsWith(".") && /\.md$/i.test(name);
|
|
1766
|
+
async function codeFilePath(s, repo, rel, io = realIo) {
|
|
1767
|
+
let root;
|
|
1768
|
+
let allowed;
|
|
1769
|
+
if (repo === "") {
|
|
1770
|
+
root = groupRoot(s);
|
|
1771
|
+
allowed = !!root && groupRootFiles(s).includes(rel);
|
|
1772
|
+
} else {
|
|
1773
|
+
root = codeRoots(s).find((r) => r.name === repo)?.root ?? null;
|
|
1774
|
+
allowed = !!root && await isListed(root, rel, io);
|
|
1775
|
+
}
|
|
1776
|
+
if (!root) return { error: "unknown repo" };
|
|
1777
|
+
if (!allowed) return { error: "not listed" };
|
|
1778
|
+
try {
|
|
1779
|
+
const full = path3.resolve(root, rel);
|
|
1780
|
+
const realRoot = fs3.realpathSync.native(root);
|
|
1781
|
+
const real = fs3.realpathSync.native(full);
|
|
1782
|
+
const inside2 = path3.relative(realRoot, real);
|
|
1783
|
+
if (!inside2 || inside2.startsWith("..") || path3.isAbsolute(inside2)) return { error: "not listed" };
|
|
1784
|
+
const st = fs3.statSync(real);
|
|
1785
|
+
if (!st.isFile()) return { error: "unreadable" };
|
|
1786
|
+
return { real, size: st.size };
|
|
1787
|
+
} catch (err) {
|
|
1788
|
+
return { error: err.code === "ENOENT" ? "not listed" : "unreadable" };
|
|
1789
|
+
}
|
|
1790
|
+
}
|
|
1791
|
+
async function readCodeFile(s, repo, rel, io = realIo) {
|
|
1792
|
+
const at = await codeFilePath(s, repo, rel, io);
|
|
1793
|
+
if ("error" in at) return at;
|
|
1794
|
+
if (at.size > MAX_CODE_FILE_BYTES) return { repo, path: rel, size: at.size, text: null, reason: "too-large" };
|
|
1795
|
+
try {
|
|
1796
|
+
const buf = await fs3.promises.readFile(at.real);
|
|
1797
|
+
if (buf.subarray(0, 8e3).includes(0)) return { repo, path: rel, size: at.size, text: null, reason: "binary" };
|
|
1798
|
+
return { repo, path: rel, size: at.size, text: buf.toString("utf-8") };
|
|
1799
|
+
} catch (err) {
|
|
1800
|
+
return { error: err.code === "ENOENT" ? "not listed" : "unreadable" };
|
|
1801
|
+
}
|
|
1802
|
+
}
|
|
1803
|
+
|
|
1804
|
+
// src/server/routes/session-show-routes.ts
|
|
1805
|
+
var MAX_SHOWN_IMAGE_BYTES = 20 * 1024 * 1024;
|
|
1806
|
+
function mountSessionShowRoutes(app, deps) {
|
|
1807
|
+
const shown = createShownFiles({ onChange: (sessionId) => deps.broadcast("session-show-changed", { sessionId }) });
|
|
1808
|
+
const locate = deps.locate ?? ((s, repo, rel) => codeFilePath(s, repo, rel));
|
|
1809
|
+
const wire = (id) => {
|
|
1810
|
+
const f = shown.get(id);
|
|
1811
|
+
return { shown: f ? { ...f, kind: shownKind(f.path) } : null };
|
|
1812
|
+
};
|
|
1813
|
+
app.get("/api/sessions/:id/show", (c) => {
|
|
1814
|
+
const id = c.req.param("id");
|
|
1815
|
+
if (!findSession2(id)) return c.json({ error: "unknown session" }, 404);
|
|
1816
|
+
return c.json(wire(id));
|
|
1817
|
+
});
|
|
1818
|
+
app.post("/api/sessions/:id/show", async (c) => {
|
|
1819
|
+
const id = c.req.param("id");
|
|
1820
|
+
const session = findSession2(id);
|
|
1821
|
+
if (!session) return c.json({ error: "unknown session" }, 404);
|
|
1822
|
+
if (session.archivedAt) return c.json({ error: "It is archived: restore it first." }, 409);
|
|
1823
|
+
const body = await c.req.json().catch(() => ({}));
|
|
1824
|
+
if (body.close === true) {
|
|
1825
|
+
shown.close(id);
|
|
1826
|
+
return c.json(wire(id));
|
|
1827
|
+
}
|
|
1828
|
+
const at = typeof body.file === "string" && body.file ? locateInSession(session, body.file) : typeof body.repo === "string" && typeof body.path === "string" && body.path ? { repo: body.repo, path: body.path.replace(/\\/g, "/") } : void 0;
|
|
1829
|
+
if (at === void 0) return c.json({ error: "file (an absolute path), or repo and path" }, 400);
|
|
1830
|
+
if (!at) return c.json({ error: "That file is not in one of this session\u2019s folders." }, 404);
|
|
1831
|
+
const found = await locate(session, at.repo, at.path);
|
|
1832
|
+
if ("error" in found)
|
|
1833
|
+
return c.json(
|
|
1834
|
+
{
|
|
1835
|
+
error: found.error === "not listed" ? "That file isn\u2019t one this session can show: it doesn\u2019t exist, or git ignores it." : `It can\u2019t be shown: ${found.error}.`
|
|
1836
|
+
},
|
|
1837
|
+
404
|
|
1838
|
+
);
|
|
1839
|
+
shown.show(id, at);
|
|
1840
|
+
return c.json(wire(id));
|
|
1841
|
+
});
|
|
1842
|
+
app.delete("/api/sessions/:id/show", (c) => {
|
|
1843
|
+
const id = c.req.param("id");
|
|
1844
|
+
if (!findSession2(id)) return c.json({ error: "unknown session" }, 404);
|
|
1845
|
+
shown.close(id);
|
|
1846
|
+
return c.json(wire(id));
|
|
1847
|
+
});
|
|
1848
|
+
app.get("/api/sessions/:id/show/image", async (c) => {
|
|
1849
|
+
const id = c.req.param("id");
|
|
1850
|
+
const session = findSession2(id);
|
|
1851
|
+
const f = shown.get(id);
|
|
1852
|
+
const type = f ? imageType(f.path) : null;
|
|
1853
|
+
if (!session || !f || !type) return c.json({ error: "it shows no image" }, 404);
|
|
1854
|
+
const found = await locate(session, f.repo, f.path);
|
|
1855
|
+
if ("error" in found) return c.json({ error: "not there any more" }, 404);
|
|
1856
|
+
if (found.size > MAX_SHOWN_IMAGE_BYTES) return c.json({ error: "too large to show" }, 413);
|
|
1857
|
+
let bytes;
|
|
1858
|
+
try {
|
|
1859
|
+
bytes = await fs4.promises.readFile(found.real);
|
|
1860
|
+
} catch {
|
|
1861
|
+
return c.json({ error: "not there any more" }, 404);
|
|
1862
|
+
}
|
|
1863
|
+
return new Response(new Uint8Array(bytes), {
|
|
1864
|
+
headers: {
|
|
1865
|
+
"Content-Type": type,
|
|
1866
|
+
"X-Content-Type-Options": "nosniff",
|
|
1867
|
+
"Content-Security-Policy": "default-src 'none'; sandbox",
|
|
1868
|
+
"Cache-Control": "no-store"
|
|
1869
|
+
}
|
|
1870
|
+
});
|
|
1871
|
+
});
|
|
1872
|
+
return { drop: (sessionId) => void shown.close(sessionId) };
|
|
1873
|
+
}
|
|
1874
|
+
|
|
1601
1875
|
// src/core/review/local-review-store.ts
|
|
1602
1876
|
var strings2 = (v) => Array.isArray(v) && v.every((x) => typeof x === "string");
|
|
1603
1877
|
function isStoredLocalReview(v) {
|
|
@@ -1623,17 +1897,17 @@ function dropLocalReview(sessionId) {
|
|
|
1623
1897
|
}
|
|
1624
1898
|
|
|
1625
1899
|
// src/core/review/local-review-tree.ts
|
|
1626
|
-
import
|
|
1627
|
-
var
|
|
1900
|
+
import path4 from "path";
|
|
1901
|
+
var norm2 = (p) => path4.resolve(p).replace(/\\/g, "/").replace(/\/+$/, "");
|
|
1628
1902
|
function sessionTree(paths, names) {
|
|
1629
1903
|
const byName = /* @__PURE__ */ new Map();
|
|
1630
|
-
for (const p of paths) byName.set(
|
|
1904
|
+
for (const p of paths) byName.set(path4.basename(norm2(p)), [...byName.get(path4.basename(norm2(p))) ?? [], norm2(p)]);
|
|
1631
1905
|
const dirs = names.map((n) => byName.get(n));
|
|
1632
1906
|
if (names.length === 0 || dirs.some((d) => !d || d.length !== 1)) return null;
|
|
1633
1907
|
const found = dirs.map((d) => d[0]);
|
|
1634
1908
|
if (names.length === 1) return { cwd: found[0], repos: [{ dir: found[0], sub: null }] };
|
|
1635
|
-
const parent =
|
|
1636
|
-
if (found.some((d) =>
|
|
1909
|
+
const parent = path4.posix.dirname(found[0]);
|
|
1910
|
+
if (found.some((d) => path4.posix.dirname(d) !== parent)) return null;
|
|
1637
1911
|
return { cwd: parent, repos: found.map((dir, i) => ({ dir, sub: names[i] })) };
|
|
1638
1912
|
}
|
|
1639
1913
|
var LOCAL_TREE_TIMEOUT_MS = 42e4;
|
|
@@ -1655,7 +1929,7 @@ async function localTreeRun(paths, names, deps) {
|
|
|
1655
1929
|
|
|
1656
1930
|
// src/core/platform/process-usage.ts
|
|
1657
1931
|
import { execFile } from "child_process";
|
|
1658
|
-
import
|
|
1932
|
+
import path5 from "path";
|
|
1659
1933
|
var num = (v) => typeof v === "number" && Number.isFinite(v) && v >= 0 ? v : null;
|
|
1660
1934
|
function parseCimUsage(json2) {
|
|
1661
1935
|
let data;
|
|
@@ -1701,7 +1975,7 @@ function parsePsUsage(stdout, now) {
|
|
|
1701
1975
|
out.push({
|
|
1702
1976
|
pid: Number(m[1]),
|
|
1703
1977
|
ppid: Number(m[2]),
|
|
1704
|
-
name:
|
|
1978
|
+
name: path5.posix.basename(first),
|
|
1705
1979
|
exe: first.startsWith("/") ? first : null,
|
|
1706
1980
|
command,
|
|
1707
1981
|
memBytes: Number(m[3]) * 1024,
|
|
@@ -1752,151 +2026,6 @@ function leftoverSummary(found) {
|
|
|
1752
2026
|
return `${found.processes} process${found.processes === 1 ? "" : "es"} left running for over a day in ${found.sessions} session${found.sessions === 1 ? "" : "s"} (${formatBytes(found.bytes)})`;
|
|
1753
2027
|
}
|
|
1754
2028
|
|
|
1755
|
-
// src/core/worktree/code-browse.ts
|
|
1756
|
-
import fs3 from "fs";
|
|
1757
|
-
import path4 from "path";
|
|
1758
|
-
var MAX_CODE_FILES = 5e4;
|
|
1759
|
-
var MAX_CODE_FILE_BYTES = 2 * 1024 * 1024;
|
|
1760
|
-
var LIST_TTL_MS = 3e3;
|
|
1761
|
-
function codeRoots(s) {
|
|
1762
|
-
return s.paths.map((p) => ({ name: path4.basename(p), root: p }));
|
|
1763
|
-
}
|
|
1764
|
-
function groupRoot(s) {
|
|
1765
|
-
if (!s.isGroup || s.paths.length === 0) return null;
|
|
1766
|
-
const parents = [...new Set(s.paths.map((p) => path4.dirname(p)))];
|
|
1767
|
-
return parents.length === 1 ? parents[0] : null;
|
|
1768
|
-
}
|
|
1769
|
-
var realIo = {
|
|
1770
|
-
git: (cwd, args) => runGitAsync(cwd, { args })
|
|
1771
|
-
};
|
|
1772
|
-
var nul = (out) => out.split("\0").filter(Boolean);
|
|
1773
|
-
var fwd = (p) => p.replace(/\\/g, "/");
|
|
1774
|
-
var listCache = /* @__PURE__ */ new Map();
|
|
1775
|
-
var MAX_LISTS = 12;
|
|
1776
|
-
var sets = /* @__PURE__ */ new WeakMap();
|
|
1777
|
-
function setOf(files) {
|
|
1778
|
-
let set = sets.get(files);
|
|
1779
|
-
if (!set) sets.set(files, set = new Set(files));
|
|
1780
|
-
return set;
|
|
1781
|
-
}
|
|
1782
|
-
async function isListed(root, rel, io = realIo, now = Date.now()) {
|
|
1783
|
-
const hit = listCache.get(root);
|
|
1784
|
-
if (hit && now - hit.at < LIST_TTL_MS) return setOf(await hit.files).has(rel);
|
|
1785
|
-
const r = await io.git(root, ["ls-files", "-c", "-o", "--exclude-standard", "-z", "--", `:(literal)${rel}`]);
|
|
1786
|
-
return r.status === 0 && nul(r.stdout).some((f) => fwd(f) === rel);
|
|
1787
|
-
}
|
|
1788
|
-
function listRepoFiles(root, io = realIo, now = Date.now()) {
|
|
1789
|
-
const hit = listCache.get(root);
|
|
1790
|
-
if (hit && now - hit.at < LIST_TTL_MS) return hit.files;
|
|
1791
|
-
const files = io.git(root, ["ls-files", "-t", "-c", "-o", "-d", "--exclude-standard", "-z"]).then((r) => {
|
|
1792
|
-
if (r.status !== 0) return [];
|
|
1793
|
-
const listed = /* @__PURE__ */ new Set();
|
|
1794
|
-
const gone = /* @__PURE__ */ new Set();
|
|
1795
|
-
for (const e of nul(r.stdout)) {
|
|
1796
|
-
const p = fwd(e.slice(2));
|
|
1797
|
-
if (e[0] === "R") gone.add(p);
|
|
1798
|
-
else listed.add(p);
|
|
1799
|
-
}
|
|
1800
|
-
return [...listed].filter((f) => !gone.has(f)).sort();
|
|
1801
|
-
});
|
|
1802
|
-
listCache.delete(root);
|
|
1803
|
-
listCache.set(root, { at: now, files });
|
|
1804
|
-
while (listCache.size > MAX_LISTS) listCache.delete(listCache.keys().next().value);
|
|
1805
|
-
return files;
|
|
1806
|
-
}
|
|
1807
|
-
async function changedFiles(root, base, io = realIo) {
|
|
1808
|
-
const out = /* @__PURE__ */ new Set();
|
|
1809
|
-
const status = await io.git(root, ["status", "--porcelain=v1", "-z", "--untracked-files=all"]);
|
|
1810
|
-
if (status.status === 0) {
|
|
1811
|
-
const entries = nul(status.stdout);
|
|
1812
|
-
for (let i = 0; i < entries.length; i++) {
|
|
1813
|
-
const e = entries[i];
|
|
1814
|
-
const code = e.slice(0, 2);
|
|
1815
|
-
out.add(fwd(e.slice(3)));
|
|
1816
|
-
if (code.includes("R") || code.includes("C")) i++;
|
|
1817
|
-
}
|
|
1818
|
-
}
|
|
1819
|
-
let from = null;
|
|
1820
|
-
for (const ref of base ? base.startsWith("origin/") ? [base] : [base, `origin/${base}`] : ["origin/HEAD"]) {
|
|
1821
|
-
const mb = await io.git(root, ["merge-base", ref, "HEAD"]);
|
|
1822
|
-
const sha = mb.stdout.trim();
|
|
1823
|
-
if (mb.status !== 0 || !sha || sha === from) continue;
|
|
1824
|
-
if (!from || (await io.git(root, ["merge-base", "--is-ancestor", from, sha])).status === 0) from = sha;
|
|
1825
|
-
}
|
|
1826
|
-
if (!from && base) {
|
|
1827
|
-
const mb = await io.git(root, ["merge-base", "origin/HEAD", "HEAD"]);
|
|
1828
|
-
if (mb.status === 0 && mb.stdout.trim()) from = mb.stdout.trim();
|
|
1829
|
-
}
|
|
1830
|
-
if (from) {
|
|
1831
|
-
const diff = await io.git(root, ["diff", "--name-only", "-z", `${from}...HEAD`]);
|
|
1832
|
-
if (diff.status === 0) for (const f of nul(diff.stdout)) out.add(fwd(f));
|
|
1833
|
-
}
|
|
1834
|
-
return [...out].sort();
|
|
1835
|
-
}
|
|
1836
|
-
async function listCodeFiles(s, io = realIo) {
|
|
1837
|
-
const repos = await Promise.all(
|
|
1838
|
-
codeRoots(s).map(async ({ name, root }) => {
|
|
1839
|
-
if (!fs3.existsSync(root)) return { name, files: [], changed: [], truncated: false };
|
|
1840
|
-
const [all, changed] = await Promise.all([listRepoFiles(root, io), changedFiles(root, s.baseBranches?.[root] ?? s.baseBranch, io)]);
|
|
1841
|
-
const listed = new Set(all);
|
|
1842
|
-
return {
|
|
1843
|
-
name,
|
|
1844
|
-
files: all.slice(0, MAX_CODE_FILES),
|
|
1845
|
-
changed: changed.filter((f) => listed.has(f)),
|
|
1846
|
-
truncated: all.length > MAX_CODE_FILES
|
|
1847
|
-
};
|
|
1848
|
-
})
|
|
1849
|
-
);
|
|
1850
|
-
return { group: !!s.isGroup, rootFiles: groupRootFiles(s), repos };
|
|
1851
|
-
}
|
|
1852
|
-
function groupRootFiles(s) {
|
|
1853
|
-
const dir = groupRoot(s);
|
|
1854
|
-
if (!dir) return [];
|
|
1855
|
-
try {
|
|
1856
|
-
return fs3.readdirSync(dir, { withFileTypes: true }).filter((e) => e.isFile() && isGroupNote(e.name)).map((e) => e.name).sort();
|
|
1857
|
-
} catch {
|
|
1858
|
-
return [];
|
|
1859
|
-
}
|
|
1860
|
-
}
|
|
1861
|
-
var isGroupNote = (name) => !name.startsWith(".") && /\.md$/i.test(name);
|
|
1862
|
-
async function codeFilePath(s, repo, rel, io = realIo) {
|
|
1863
|
-
let root;
|
|
1864
|
-
let allowed;
|
|
1865
|
-
if (repo === "") {
|
|
1866
|
-
root = groupRoot(s);
|
|
1867
|
-
allowed = !!root && groupRootFiles(s).includes(rel);
|
|
1868
|
-
} else {
|
|
1869
|
-
root = codeRoots(s).find((r) => r.name === repo)?.root ?? null;
|
|
1870
|
-
allowed = !!root && await isListed(root, rel, io);
|
|
1871
|
-
}
|
|
1872
|
-
if (!root) return { error: "unknown repo" };
|
|
1873
|
-
if (!allowed) return { error: "not listed" };
|
|
1874
|
-
try {
|
|
1875
|
-
const full = path4.resolve(root, rel);
|
|
1876
|
-
const realRoot = fs3.realpathSync.native(root);
|
|
1877
|
-
const real = fs3.realpathSync.native(full);
|
|
1878
|
-
const inside2 = path4.relative(realRoot, real);
|
|
1879
|
-
if (!inside2 || inside2.startsWith("..") || path4.isAbsolute(inside2)) return { error: "not listed" };
|
|
1880
|
-
const st = fs3.statSync(real);
|
|
1881
|
-
if (!st.isFile()) return { error: "unreadable" };
|
|
1882
|
-
return { real, size: st.size };
|
|
1883
|
-
} catch (err) {
|
|
1884
|
-
return { error: err.code === "ENOENT" ? "not listed" : "unreadable" };
|
|
1885
|
-
}
|
|
1886
|
-
}
|
|
1887
|
-
async function readCodeFile(s, repo, rel, io = realIo) {
|
|
1888
|
-
const at = await codeFilePath(s, repo, rel, io);
|
|
1889
|
-
if ("error" in at) return at;
|
|
1890
|
-
if (at.size > MAX_CODE_FILE_BYTES) return { repo, path: rel, size: at.size, text: null, reason: "too-large" };
|
|
1891
|
-
try {
|
|
1892
|
-
const buf = await fs3.promises.readFile(at.real);
|
|
1893
|
-
if (buf.subarray(0, 8e3).includes(0)) return { repo, path: rel, size: at.size, text: null, reason: "binary" };
|
|
1894
|
-
return { repo, path: rel, size: at.size, text: buf.toString("utf-8") };
|
|
1895
|
-
} catch (err) {
|
|
1896
|
-
return { error: err.code === "ENOENT" ? "not listed" : "unreadable" };
|
|
1897
|
-
}
|
|
1898
|
-
}
|
|
1899
|
-
|
|
1900
2029
|
// src/core/worktree/code-symbols.ts
|
|
1901
2030
|
var MAX_LINE_CHARS = 240;
|
|
1902
2031
|
function parseGrepLine(line) {
|
|
@@ -1970,9 +2099,9 @@ var NOT_NAMES = /* @__PURE__ */ new Set([
|
|
|
1970
2099
|
"typeof",
|
|
1971
2100
|
"await"
|
|
1972
2101
|
]);
|
|
1973
|
-
function declarationOf(
|
|
2102
|
+
function declarationOf(path23, text) {
|
|
1974
2103
|
for (const r of RULES) {
|
|
1975
|
-
if (!r.ext.test(
|
|
2104
|
+
if (!r.ext.test(path23)) continue;
|
|
1976
2105
|
const m = r.re.exec(text);
|
|
1977
2106
|
if (!m) continue;
|
|
1978
2107
|
const name = r.name(m);
|
|
@@ -2329,8 +2458,8 @@ function mountSetupRoutes(app, opts) {
|
|
|
2329
2458
|
}
|
|
2330
2459
|
|
|
2331
2460
|
// src/core/updates/update-source.ts
|
|
2332
|
-
import
|
|
2333
|
-
import
|
|
2461
|
+
import fs5 from "fs";
|
|
2462
|
+
import path6 from "path";
|
|
2334
2463
|
|
|
2335
2464
|
// src/core/updates/updates.ts
|
|
2336
2465
|
function parseVersion(v) {
|
|
@@ -2387,8 +2516,8 @@ function whatsNewFor(i) {
|
|
|
2387
2516
|
}
|
|
2388
2517
|
function installKindOf(packageRoot2, configDir, hasGit) {
|
|
2389
2518
|
if (!packageRoot2) return "npm";
|
|
2390
|
-
const
|
|
2391
|
-
if (
|
|
2519
|
+
const norm4 = (p) => p.replace(/\\/g, "/").replace(/\/+$/, "").toLowerCase();
|
|
2520
|
+
if (norm4(packageRoot2).startsWith(`${norm4(configDir)}/runtime/`)) return "desktop";
|
|
2392
2521
|
return hasGit ? "dev" : "npm";
|
|
2393
2522
|
}
|
|
2394
2523
|
function parseDesktopUpdate(text) {
|
|
@@ -2415,8 +2544,8 @@ function parseDesktopUpdate(text) {
|
|
|
2415
2544
|
var RELEASES_REPO = "moberghr/cli-work-tree-manager";
|
|
2416
2545
|
var RELEASES_URL = `https://api.github.com/repos/${RELEASES_REPO}/releases?per_page=30`;
|
|
2417
2546
|
var SEEN_KEY = "ui:seen-version";
|
|
2418
|
-
var desktopUpdatePath = () =>
|
|
2419
|
-
var desktopRequestPath = () =>
|
|
2547
|
+
var desktopUpdatePath = () => path6.join(getConfigDir(), "desktop-update.json");
|
|
2548
|
+
var desktopRequestPath = () => path6.join(getConfigDir(), "desktop-request.json");
|
|
2420
2549
|
async function fetchReleases(get = (url) => fetch(url, { headers: { "User-Agent": "work", Accept: "application/vnd.github+json" }, signal: AbortSignal.timeout(15e3) }), run2 = defaultRunner) {
|
|
2421
2550
|
const why = await get(RELEASES_URL).then(
|
|
2422
2551
|
async (res) => res.ok ? parseReleases(await res.json()) : res.status === 403 ? "GitHub's limit for this address is spent" : `GitHub answered ${res.status}`,
|
|
@@ -2456,7 +2585,7 @@ function networkFailure(err) {
|
|
|
2456
2585
|
function readDesktopUpdate(file = desktopUpdatePath()) {
|
|
2457
2586
|
let text;
|
|
2458
2587
|
try {
|
|
2459
|
-
text =
|
|
2588
|
+
text = fs5.readFileSync(file, "utf-8");
|
|
2460
2589
|
} catch {
|
|
2461
2590
|
return null;
|
|
2462
2591
|
}
|
|
@@ -2478,7 +2607,7 @@ function markSeenVersion(version) {
|
|
|
2478
2607
|
}
|
|
2479
2608
|
function installKind() {
|
|
2480
2609
|
const root = packageRoot();
|
|
2481
|
-
return installKindOf(root, getConfigDir(), !!root &&
|
|
2610
|
+
return installKindOf(root, getConfigDir(), !!root && fs5.existsSync(path6.join(root, ".git")));
|
|
2482
2611
|
}
|
|
2483
2612
|
var defaultDeps = () => ({
|
|
2484
2613
|
fetchReleases: () => fetchReleases(),
|
|
@@ -2571,7 +2700,7 @@ function mountAppUpdateRoutes(app, opts) {
|
|
|
2571
2700
|
}
|
|
2572
2701
|
|
|
2573
2702
|
// src/server/routes/usage-routes.ts
|
|
2574
|
-
import
|
|
2703
|
+
import fs6 from "fs";
|
|
2575
2704
|
var FRESH_MS = 5e3;
|
|
2576
2705
|
function createUsageCache(build, ttlMs = FRESH_MS, now = Date.now) {
|
|
2577
2706
|
let last = null;
|
|
@@ -2633,7 +2762,7 @@ function watchUsage(opts) {
|
|
|
2633
2762
|
};
|
|
2634
2763
|
let watcher = null;
|
|
2635
2764
|
try {
|
|
2636
|
-
|
|
2765
|
+
fs6.mkdirSync(dir, { recursive: true });
|
|
2637
2766
|
watcher = createFsWatcher({ roots: [dir], onChange });
|
|
2638
2767
|
} catch (e) {
|
|
2639
2768
|
report("warn", `[usage] not watching ${dir}: ${e instanceof Error ? e.message : String(e)}`);
|
|
@@ -2743,8 +2872,8 @@ var SETTING_PATTERNS = {
|
|
|
2743
2872
|
agentId: "^[\\w.-]+$",
|
|
2744
2873
|
envName: "^[A-Za-z_][A-Za-z0-9_]*$"
|
|
2745
2874
|
};
|
|
2746
|
-
var bool = (
|
|
2747
|
-
path:
|
|
2875
|
+
var bool = (path23, section, label, help, def, when) => ({
|
|
2876
|
+
path: path23,
|
|
2748
2877
|
section,
|
|
2749
2878
|
label,
|
|
2750
2879
|
help,
|
|
@@ -3110,7 +3239,7 @@ var SETTINGS = [
|
|
|
3110
3239
|
"at the next work web start"
|
|
3111
3240
|
)
|
|
3112
3241
|
];
|
|
3113
|
-
var settingAt = (
|
|
3242
|
+
var settingAt = (path23) => SETTINGS.find((f) => f.path === path23);
|
|
3114
3243
|
function checkSetting(field, raw) {
|
|
3115
3244
|
const checked = checkValue(field, raw);
|
|
3116
3245
|
if (checked.ok && checked.value === null && field.required) return { ok: false, error: "it can\u2019t be left empty" };
|
|
@@ -3156,16 +3285,16 @@ function checkValue(field, raw) {
|
|
|
3156
3285
|
return typeof raw === "string" && k.options.some((o) => o.value === raw) ? { ok: true, value: raw } : { ok: false, error: `one of ${k.options.map((o) => o.value).join(", ")}` };
|
|
3157
3286
|
}
|
|
3158
3287
|
}
|
|
3159
|
-
function valueAt(obj,
|
|
3288
|
+
function valueAt(obj, path23) {
|
|
3160
3289
|
let cur = obj;
|
|
3161
|
-
for (const key of
|
|
3290
|
+
for (const key of path23.split(".")) {
|
|
3162
3291
|
if (!cur || typeof cur !== "object" || Array.isArray(cur)) return void 0;
|
|
3163
3292
|
cur = cur[key];
|
|
3164
3293
|
}
|
|
3165
3294
|
return cur;
|
|
3166
3295
|
}
|
|
3167
|
-
function setValueAt(obj,
|
|
3168
|
-
const keys =
|
|
3296
|
+
function setValueAt(obj, path23, value) {
|
|
3297
|
+
const keys = path23.split(".");
|
|
3169
3298
|
const chain = [obj];
|
|
3170
3299
|
let cur = obj;
|
|
3171
3300
|
for (const key of keys.slice(0, -1)) {
|
|
@@ -3202,8 +3331,8 @@ function checkRepoSetting(key, raw) {
|
|
|
3202
3331
|
return raw === "all" || raw === "asked" || raw === "off" ? { ok: true, value: raw } : { ok: false, error: "all, asked or off" };
|
|
3203
3332
|
}
|
|
3204
3333
|
function repoSettingsOf(raw, alias) {
|
|
3205
|
-
const map = (
|
|
3206
|
-
const m = valueAt(raw,
|
|
3334
|
+
const map = (path23) => {
|
|
3335
|
+
const m = valueAt(raw, path23);
|
|
3207
3336
|
return m && typeof m === "object" && !Array.isArray(m) ? m : {};
|
|
3208
3337
|
};
|
|
3209
3338
|
const checks = map(REPO_SETTING_PATH.requiredChecks)[alias];
|
|
@@ -3258,11 +3387,11 @@ function mountSettingsRoutes(app, opts) {
|
|
|
3258
3387
|
}
|
|
3259
3388
|
|
|
3260
3389
|
// src/core/settings/settings-admin.ts
|
|
3261
|
-
import
|
|
3262
|
-
import
|
|
3390
|
+
import fs7 from "fs";
|
|
3391
|
+
import path7 from "path";
|
|
3263
3392
|
function rawConfig(file = getConfigPath()) {
|
|
3264
3393
|
try {
|
|
3265
|
-
const raw = JSON.parse(
|
|
3394
|
+
const raw = JSON.parse(fs7.readFileSync(file, "utf-8"));
|
|
3266
3395
|
return raw && typeof raw === "object" && !Array.isArray(raw) ? raw : {};
|
|
3267
3396
|
} catch {
|
|
3268
3397
|
return {};
|
|
@@ -3277,13 +3406,13 @@ function readSettings() {
|
|
|
3277
3406
|
}
|
|
3278
3407
|
return { values, configPath: getConfigPath() };
|
|
3279
3408
|
}
|
|
3280
|
-
async function writeSetting(
|
|
3281
|
-
const field = settingAt(
|
|
3282
|
-
if (!field) throw new SettingsError(`no setting ${
|
|
3409
|
+
async function writeSetting(path23, value) {
|
|
3410
|
+
const field = settingAt(path23);
|
|
3411
|
+
if (!field) throw new SettingsError(`no setting ${path23}`, 404);
|
|
3283
3412
|
const checked = checkSetting(field, value);
|
|
3284
3413
|
if (!checked.ok) throw new SettingsError(`${field.label}: ${checked.error}`);
|
|
3285
|
-
const toWrite = checkedFolders(
|
|
3286
|
-
await editConfig((raw) => setValueAt(raw,
|
|
3414
|
+
const toWrite = checkedFolders(path23, checked.value);
|
|
3415
|
+
await editConfig((raw) => setValueAt(raw, path23, toWrite)).catch((err) => {
|
|
3287
3416
|
throw err instanceof RepoAdminError ? new SettingsError(err.message) : err;
|
|
3288
3417
|
});
|
|
3289
3418
|
return readSettings();
|
|
@@ -3297,10 +3426,10 @@ function checkedFolders(at, value) {
|
|
|
3297
3426
|
if (at === "scanRoots" && Array.isArray(value))
|
|
3298
3427
|
return value.map((v) => {
|
|
3299
3428
|
const p = expandHome(v);
|
|
3300
|
-
if (!
|
|
3429
|
+
if (!path7.isAbsolute(p))
|
|
3301
3430
|
throw new SettingsError(`Folders scanned for repos: ${v} isn't a full path (start it from the drive, / or ~)`);
|
|
3302
|
-
const full =
|
|
3303
|
-
if (!
|
|
3431
|
+
const full = path7.resolve(p);
|
|
3432
|
+
if (!fs7.statSync(full, { throwIfNoEntry: false })?.isDirectory())
|
|
3304
3433
|
throw new SettingsError(`Folders scanned for repos: ${full} isn't a folder`);
|
|
3305
3434
|
return full;
|
|
3306
3435
|
});
|
|
@@ -3350,7 +3479,7 @@ var configSettings = {
|
|
|
3350
3479
|
};
|
|
3351
3480
|
|
|
3352
3481
|
// src/core/conversations/timeline-source.ts
|
|
3353
|
-
import
|
|
3482
|
+
import path8 from "path";
|
|
3354
3483
|
|
|
3355
3484
|
// src/core/conversations/timeline.ts
|
|
3356
3485
|
var SIZE_LABEL = /^(\d+ files? · \+\d+ −\d+|no changes)$/;
|
|
@@ -3399,7 +3528,7 @@ async function commitsOf(repo, since, run2) {
|
|
|
3399
3528
|
if (log.code !== 0) return [];
|
|
3400
3529
|
return log.stdout.split("\n").filter(Boolean).map((line) => {
|
|
3401
3530
|
const [sha, at, ...subject] = line.split(" ");
|
|
3402
|
-
return { repo:
|
|
3531
|
+
return { repo: path8.basename(repo), sha, at, subject: subject.join(" ") };
|
|
3403
3532
|
});
|
|
3404
3533
|
}
|
|
3405
3534
|
async function sessionTimeline(s, deps = {}) {
|
|
@@ -3466,8 +3595,8 @@ function mountBlockRoutes(app, opts) {
|
|
|
3466
3595
|
}
|
|
3467
3596
|
|
|
3468
3597
|
// src/server/routes/jira-watch-routes.ts
|
|
3469
|
-
import
|
|
3470
|
-
import
|
|
3598
|
+
import fs8 from "fs";
|
|
3599
|
+
import path9 from "path";
|
|
3471
3600
|
|
|
3472
3601
|
// src/core/jira/jira-prompt.ts
|
|
3473
3602
|
var branchFor = (issue) => `feat/${issue.key}`;
|
|
@@ -3688,16 +3817,16 @@ async function sweepJira(deps) {
|
|
|
3688
3817
|
var EVERY_MS = 5 * 6e4;
|
|
3689
3818
|
function aboutRepo(dir) {
|
|
3690
3819
|
try {
|
|
3691
|
-
const readme = ["README.md", "readme.md", "README"].map((n) =>
|
|
3820
|
+
const readme = ["README.md", "readme.md", "README"].map((n) => path9.join(dir, n)).find((f) => fs8.existsSync(f));
|
|
3692
3821
|
if (readme) {
|
|
3693
|
-
const line =
|
|
3822
|
+
const line = fs8.readFileSync(readme, "utf8").split(/\r?\n/).map(
|
|
3694
3823
|
(l) => l.replace(/^[#>*\-\s]+/, "").replace(/[`*_[\]]/g, "").trim()
|
|
3695
3824
|
).find((l) => l.length > 20 && !/^(!|<|http)/.test(l));
|
|
3696
3825
|
if (line) return line.slice(0, 160);
|
|
3697
3826
|
}
|
|
3698
|
-
const pkg =
|
|
3699
|
-
if (
|
|
3700
|
-
const d = JSON.parse(
|
|
3827
|
+
const pkg = path9.join(dir, "package.json");
|
|
3828
|
+
if (fs8.existsSync(pkg)) {
|
|
3829
|
+
const d = JSON.parse(fs8.readFileSync(pkg, "utf8")).description;
|
|
3701
3830
|
if (typeof d === "string" && d.trim()) return d.trim().slice(0, 160);
|
|
3702
3831
|
}
|
|
3703
3832
|
} catch {
|
|
@@ -3709,7 +3838,7 @@ function watchTargets(cfg = loadConfig()) {
|
|
|
3709
3838
|
const repos = Object.entries(cfg.repos).map(([alias, dir]) => ({
|
|
3710
3839
|
name: alias,
|
|
3711
3840
|
kind: "repo",
|
|
3712
|
-
members: [
|
|
3841
|
+
members: [path9.basename(dir)],
|
|
3713
3842
|
about: aboutRepo(dir)
|
|
3714
3843
|
}));
|
|
3715
3844
|
const groups = Object.entries(cfg.groups).map(([name, aliases]) => ({ name, kind: "group", members: aliases }));
|
|
@@ -3885,7 +4014,7 @@ function describeStall(s) {
|
|
|
3885
4014
|
}
|
|
3886
4015
|
|
|
3887
4016
|
// src/server/web-server.ts
|
|
3888
|
-
import
|
|
4017
|
+
import path20 from "path";
|
|
3889
4018
|
import { Hono } from "hono";
|
|
3890
4019
|
import { streamSSE as streamSSE2 } from "hono/streaming";
|
|
3891
4020
|
|
|
@@ -4213,8 +4342,8 @@ function mountPanesRoutes(app, opts) {
|
|
|
4213
4342
|
}
|
|
4214
4343
|
|
|
4215
4344
|
// src/server/routes/worktree-routes.ts
|
|
4216
|
-
import
|
|
4217
|
-
import
|
|
4345
|
+
import fs9 from "fs";
|
|
4346
|
+
import path10 from "path";
|
|
4218
4347
|
import { spawn } from "child_process";
|
|
4219
4348
|
|
|
4220
4349
|
// src/core/platform/started.ts
|
|
@@ -4329,7 +4458,7 @@ function mountWorktreeRoutes(app, opts) {
|
|
|
4329
4458
|
if (waiting.length) return { body: { error: `Not deleted: ${waiting.join("; ")}.`, blocked: waiting }, status: 409 };
|
|
4330
4459
|
}
|
|
4331
4460
|
try {
|
|
4332
|
-
const onDisk = session.paths.some((p) =>
|
|
4461
|
+
const onDisk = session.paths.some((p) => fs9.existsSync(p));
|
|
4333
4462
|
if (!sessionOnly && onDisk && session.paths.some((p) => wouldRefuseRemoval(p, force ?? false))) {
|
|
4334
4463
|
return { body: { error: REFUSED }, status: 409 };
|
|
4335
4464
|
}
|
|
@@ -4400,7 +4529,7 @@ function mountWorktreeRoutes(app, opts) {
|
|
|
4400
4529
|
const wantsFile = !!body && typeof body === "object" && "path" in body;
|
|
4401
4530
|
const asked = wantsFile ? openFileSchema.safeParse(body) : null;
|
|
4402
4531
|
if (asked && !asked.success) return c.json({ error: "repo and path required" }, 400);
|
|
4403
|
-
const folder = session.isGroup ?
|
|
4532
|
+
const folder = session.isGroup ? path10.dirname(session.paths[0]) : session.paths[0];
|
|
4404
4533
|
let file;
|
|
4405
4534
|
if (asked?.success) {
|
|
4406
4535
|
const at = await codeFilePath(session, asked.data.repo, asked.data.path);
|
|
@@ -4469,7 +4598,7 @@ function mountWorktreeRoutes(app, opts) {
|
|
|
4469
4598
|
import { zValidator as zValidator6 } from "@hono/zod-validator";
|
|
4470
4599
|
import { z as z5 } from "zod";
|
|
4471
4600
|
import { EventEmitter } from "events";
|
|
4472
|
-
import
|
|
4601
|
+
import path11 from "path";
|
|
4473
4602
|
import { streamSSE } from "hono/streaming";
|
|
4474
4603
|
function mountScopeRoutes(app, opts) {
|
|
4475
4604
|
const background = /* @__PURE__ */ new Set();
|
|
@@ -4716,7 +4845,7 @@ function mountScopeRoutes(app, opts) {
|
|
|
4716
4845
|
const fromSha = fromEntry.repos[p] ?? "HEAD";
|
|
4717
4846
|
const toSha = toEntry === void 0 ? "working" : toEntry.repos[p] ?? "HEAD";
|
|
4718
4847
|
return {
|
|
4719
|
-
name:
|
|
4848
|
+
name: path11.basename(p),
|
|
4720
4849
|
root: p,
|
|
4721
4850
|
files: computeRangeDiff({ root: p, fromRef: fromSha, toRef: toSha })
|
|
4722
4851
|
};
|
|
@@ -4733,7 +4862,7 @@ function mountScopeRoutes(app, opts) {
|
|
|
4733
4862
|
}
|
|
4734
4863
|
const resolved = scope.paths.map((p) => resolveRepoDiff(p, base, sessionBaseForPath(p)));
|
|
4735
4864
|
const repos = scope.paths.map((p, i) => ({
|
|
4736
|
-
name:
|
|
4865
|
+
name: path11.basename(p),
|
|
4737
4866
|
root: p,
|
|
4738
4867
|
resolvedBase: resolved[i].resolvedBase,
|
|
4739
4868
|
files: computeDiff({ root: p, diffArg: resolved[i].diffArg })
|
|
@@ -4764,7 +4893,7 @@ function mountScopeRoutes(app, opts) {
|
|
|
4764
4893
|
if (!relPath || !Number.isInteger(start) || !Number.isInteger(end)) {
|
|
4765
4894
|
return c.json({ error: "bad path/start/end" }, 400);
|
|
4766
4895
|
}
|
|
4767
|
-
const root = scope.paths.length === 1 ? scope.paths[0] : scope.paths.find((p) =>
|
|
4896
|
+
const root = scope.paths.length === 1 ? scope.paths[0] : scope.paths.find((p) => path11.basename(p) === repoName);
|
|
4768
4897
|
if (!root) return c.json({ error: "unknown repo" }, 404);
|
|
4769
4898
|
const result = readContextLines({ root, relPath, start, end, ref });
|
|
4770
4899
|
if (!result) return c.json({ error: "cannot read file" }, 400);
|
|
@@ -5022,7 +5151,7 @@ function mountTerminalRoutes(app, opts) {
|
|
|
5022
5151
|
}
|
|
5023
5152
|
|
|
5024
5153
|
// src/server/routes/status-routes.ts
|
|
5025
|
-
import
|
|
5154
|
+
import path12 from "path";
|
|
5026
5155
|
|
|
5027
5156
|
// src/core/status/notifier.ts
|
|
5028
5157
|
var MESSAGES = {
|
|
@@ -5170,7 +5299,7 @@ function mountStatusRoutes(app, opts) {
|
|
|
5170
5299
|
const kind = notifyKindForTransition(status.prevState ? { state: status.prevState } : null, status);
|
|
5171
5300
|
if (kind) {
|
|
5172
5301
|
const config = loadConfig();
|
|
5173
|
-
const launchDir = session.isGroup && session.paths[0] ?
|
|
5302
|
+
const launchDir = session.isGroup && session.paths[0] ? path12.dirname(session.paths[0]) : session.paths[0] ?? body.cwd;
|
|
5174
5303
|
const name = `${session.target} \xB7 ${session.branch}`;
|
|
5175
5304
|
const snooze = readSnooze(id);
|
|
5176
5305
|
const route = snooze?.until && snoozeActive(snooze, { attention: status }) ? "none" : presence.route(id);
|
|
@@ -6199,14 +6328,14 @@ function mountRailRoutes(app, opts) {
|
|
|
6199
6328
|
}
|
|
6200
6329
|
|
|
6201
6330
|
// src/core/worktree/shared-folders.ts
|
|
6202
|
-
import
|
|
6203
|
-
import
|
|
6204
|
-
var
|
|
6331
|
+
import fs10 from "fs";
|
|
6332
|
+
import path13 from "path";
|
|
6333
|
+
var norm3 = (p) => path13.resolve(p).replace(/\\/g, "/").toLowerCase();
|
|
6205
6334
|
function shadowedSessions(sessions, branchCheckedOut2) {
|
|
6206
6335
|
const byFolder = /* @__PURE__ */ new Map();
|
|
6207
6336
|
for (const s of sessions) {
|
|
6208
6337
|
if (s.isGroup || s.paths.length !== 1) continue;
|
|
6209
|
-
const key =
|
|
6338
|
+
const key = norm3(s.paths[0]);
|
|
6210
6339
|
byFolder.set(key, [...byFolder.get(key) ?? [], s]);
|
|
6211
6340
|
}
|
|
6212
6341
|
const shadowed = /* @__PURE__ */ new Set();
|
|
@@ -6220,14 +6349,14 @@ function shadowedSessions(sessions, branchCheckedOut2) {
|
|
|
6220
6349
|
}
|
|
6221
6350
|
function branchCheckedOut(dir) {
|
|
6222
6351
|
try {
|
|
6223
|
-
const dotGit =
|
|
6352
|
+
const dotGit = path13.join(dir, ".git");
|
|
6224
6353
|
let gitDir = dotGit;
|
|
6225
|
-
if (
|
|
6226
|
-
const m = /^gitdir:\s*(.+)$/m.exec(
|
|
6354
|
+
if (fs10.statSync(dotGit).isFile()) {
|
|
6355
|
+
const m = /^gitdir:\s*(.+)$/m.exec(fs10.readFileSync(dotGit, "utf8"));
|
|
6227
6356
|
if (!m) return null;
|
|
6228
|
-
gitDir =
|
|
6357
|
+
gitDir = path13.resolve(dir, m[1].trim());
|
|
6229
6358
|
}
|
|
6230
|
-
const head =
|
|
6359
|
+
const head = fs10.readFileSync(path13.join(gitDir, "HEAD"), "utf8");
|
|
6231
6360
|
const ref = /^ref:\s*refs\/heads\/(.+)$/m.exec(head);
|
|
6232
6361
|
return ref ? ref[1].trim() : null;
|
|
6233
6362
|
} catch {
|
|
@@ -6236,14 +6365,14 @@ function branchCheckedOut(dir) {
|
|
|
6236
6365
|
}
|
|
6237
6366
|
|
|
6238
6367
|
// src/core/platform/build-stamp.ts
|
|
6239
|
-
import
|
|
6368
|
+
import fs11 from "fs";
|
|
6240
6369
|
var cached = null;
|
|
6241
6370
|
function buildStamp() {
|
|
6242
6371
|
if (cached) return cached;
|
|
6243
6372
|
const forced = process.env.WORK_BUILD_STAMP;
|
|
6244
6373
|
if (forced) return cached = forced;
|
|
6245
6374
|
try {
|
|
6246
|
-
cached = String(Math.floor(
|
|
6375
|
+
cached = String(Math.floor(fs11.statSync(process.argv[1]).mtimeMs));
|
|
6247
6376
|
} catch {
|
|
6248
6377
|
cached = "unknown";
|
|
6249
6378
|
}
|
|
@@ -6554,8 +6683,8 @@ function mountPrReplyRoutes(app, opts) {
|
|
|
6554
6683
|
}
|
|
6555
6684
|
|
|
6556
6685
|
// src/core/archive/archive-retention.ts
|
|
6557
|
-
import
|
|
6558
|
-
import
|
|
6686
|
+
import fs12 from "fs";
|
|
6687
|
+
import path14 from "path";
|
|
6559
6688
|
import zlib from "zlib";
|
|
6560
6689
|
var DEFAULT_COMPRESS_AFTER_DAYS = 30;
|
|
6561
6690
|
var DAY_MS = 24 * 36e5;
|
|
@@ -6567,7 +6696,7 @@ function applyArchiveRetention(opts) {
|
|
|
6567
6696
|
const out = { compressed: [], dropped: [], bytesSaved: 0 };
|
|
6568
6697
|
let ids;
|
|
6569
6698
|
try {
|
|
6570
|
-
ids =
|
|
6699
|
+
ids = fs12.readdirSync(root, { withFileTypes: true }).filter((d) => d.isDirectory()).map((d) => d.name);
|
|
6571
6700
|
} catch {
|
|
6572
6701
|
return out;
|
|
6573
6702
|
}
|
|
@@ -6576,17 +6705,17 @@ function applyArchiveRetention(opts) {
|
|
|
6576
6705
|
if (!rec) continue;
|
|
6577
6706
|
const age = now - Date.parse(rec.archivedAt);
|
|
6578
6707
|
if (!Number.isFinite(age)) continue;
|
|
6579
|
-
const ignored =
|
|
6580
|
-
if (compressAfter > 0 && age >= compressAfter * DAY_MS && !rec.ignoredDroppedAt &&
|
|
6581
|
-
|
|
6708
|
+
const ignored = path14.join(archiveDirFor(id, root), "ignored");
|
|
6709
|
+
if (compressAfter > 0 && age >= compressAfter * DAY_MS && !rec.ignoredDroppedAt && fs12.existsSync(ignored)) {
|
|
6710
|
+
fs12.rmSync(ignored, { recursive: true, force: true });
|
|
6582
6711
|
rec.ignoredDroppedAt = new Date(now).toISOString();
|
|
6583
6712
|
writeArchiveRecord(rec, root);
|
|
6584
6713
|
}
|
|
6585
6714
|
if (rec.transcriptsDroppedAt) continue;
|
|
6586
|
-
const dir =
|
|
6715
|
+
const dir = path14.join(archiveDirFor(id, root), "transcripts");
|
|
6587
6716
|
if (dropAfter > 0 && age >= dropAfter * DAY_MS) {
|
|
6588
6717
|
out.bytesSaved += dirBytes(dir);
|
|
6589
|
-
|
|
6718
|
+
fs12.rmSync(dir, { recursive: true, force: true });
|
|
6590
6719
|
rec.transcriptsDroppedAt = new Date(now).toISOString();
|
|
6591
6720
|
writeArchiveRecord(rec, root);
|
|
6592
6721
|
out.dropped.push(id);
|
|
@@ -6594,16 +6723,16 @@ function applyArchiveRetention(opts) {
|
|
|
6594
6723
|
}
|
|
6595
6724
|
if (compressAfter <= 0 || rec.compressedAt || age < compressAfter * DAY_MS) continue;
|
|
6596
6725
|
for (const t of rec.transcripts) {
|
|
6597
|
-
const plain =
|
|
6598
|
-
if (!
|
|
6599
|
-
const data =
|
|
6726
|
+
const plain = path14.join(dir, t.file);
|
|
6727
|
+
if (!fs12.existsSync(plain)) continue;
|
|
6728
|
+
const data = fs12.readFileSync(plain);
|
|
6600
6729
|
const gz = zlib.gzipSync(data);
|
|
6601
|
-
|
|
6602
|
-
if (!zlib.gunzipSync(
|
|
6603
|
-
|
|
6730
|
+
fs12.writeFileSync(`${plain}.gz`, gz);
|
|
6731
|
+
if (!zlib.gunzipSync(fs12.readFileSync(`${plain}.gz`)).equals(data)) {
|
|
6732
|
+
fs12.rmSync(`${plain}.gz`, { force: true });
|
|
6604
6733
|
continue;
|
|
6605
6734
|
}
|
|
6606
|
-
|
|
6735
|
+
fs12.rmSync(plain, { force: true });
|
|
6607
6736
|
out.bytesSaved += data.length - gz.length;
|
|
6608
6737
|
}
|
|
6609
6738
|
rec.compressedAt = new Date(now).toISOString();
|
|
@@ -6615,7 +6744,7 @@ function applyArchiveRetention(opts) {
|
|
|
6615
6744
|
function dirBytes(dir) {
|
|
6616
6745
|
let n = 0;
|
|
6617
6746
|
try {
|
|
6618
|
-
for (const f of
|
|
6747
|
+
for (const f of fs12.readdirSync(dir)) n += fs12.statSync(path14.join(dir, f)).size;
|
|
6619
6748
|
} catch {
|
|
6620
6749
|
}
|
|
6621
6750
|
return n;
|
|
@@ -7093,7 +7222,7 @@ function reviewModeOf(alias, config) {
|
|
|
7093
7222
|
return { mode: "all", from: "default" };
|
|
7094
7223
|
}
|
|
7095
7224
|
function reviewProjects(config) {
|
|
7096
|
-
return Object.entries(config.repos).map(([alias,
|
|
7225
|
+
return Object.entries(config.repos).map(([alias, path23]) => ({ alias, path: path23, mode: reviewModeOf(alias, config).mode }));
|
|
7097
7226
|
}
|
|
7098
7227
|
function reviewLimits(config) {
|
|
7099
7228
|
return {
|
|
@@ -7240,8 +7369,8 @@ function mountReviewRoutes(app, deps) {
|
|
|
7240
7369
|
|
|
7241
7370
|
// src/core/review/review-tree.ts
|
|
7242
7371
|
import { randomBytes } from "crypto";
|
|
7243
|
-
import
|
|
7244
|
-
import
|
|
7372
|
+
import fs13 from "fs";
|
|
7373
|
+
import path15 from "path";
|
|
7245
7374
|
|
|
7246
7375
|
// src/core/review/review-source.ts
|
|
7247
7376
|
var reviewRef = (number) => `refs/work/review/${number}`;
|
|
@@ -7297,7 +7426,7 @@ async function dropReviewRef(run2, repoPath, number) {
|
|
|
7297
7426
|
}
|
|
7298
7427
|
|
|
7299
7428
|
// src/core/review/review-tree.ts
|
|
7300
|
-
var reviewTreesDir = () =>
|
|
7429
|
+
var reviewTreesDir = () => path15.join(getConfigDir(), "review-trees");
|
|
7301
7430
|
var NO_HOOKS = ".no-hooks";
|
|
7302
7431
|
var NO_LFS = ["-c", "filter.lfs.smudge=", "-c", "filter.lfs.process=", "-c", "filter.lfs.required=false"];
|
|
7303
7432
|
var NO_LFS_ENV = { GIT_LFS_SKIP_SMUDGE: "1" };
|
|
@@ -7310,17 +7439,17 @@ var runSuffix = () => `${process.pid.toString(36)}${randomBytes(3).toString("hex
|
|
|
7310
7439
|
var firstLine = (s) => s.trim().split(/\r?\n/)[0] ?? "";
|
|
7311
7440
|
function rmTree(dir) {
|
|
7312
7441
|
try {
|
|
7313
|
-
|
|
7442
|
+
fs13.rmSync(dir, { recursive: true, force: true, maxRetries: 5, retryDelay: 200 });
|
|
7314
7443
|
} catch {
|
|
7315
7444
|
}
|
|
7316
|
-
return !
|
|
7445
|
+
return !fs13.existsSync(dir);
|
|
7317
7446
|
}
|
|
7318
7447
|
async function createReviewTree(run2, at, opts) {
|
|
7319
7448
|
const root = opts.root ?? reviewTreesDir();
|
|
7320
|
-
const dir =
|
|
7321
|
-
const noHooks =
|
|
7322
|
-
|
|
7323
|
-
if (
|
|
7449
|
+
const dir = path15.join(root, reviewTreeName(at.alias, at.number, at.headSha, opts.run ?? runSuffix()));
|
|
7450
|
+
const noHooks = path15.join(root, NO_HOOKS);
|
|
7451
|
+
fs13.mkdirSync(noHooks, { recursive: true });
|
|
7452
|
+
if (fs13.existsSync(dir)) await removeReviewTree(run2, at.repoPath, dir);
|
|
7324
7453
|
const added = await run2(
|
|
7325
7454
|
"git",
|
|
7326
7455
|
[
|
|
@@ -7355,9 +7484,9 @@ async function createReviewTree(run2, at, opts) {
|
|
|
7355
7484
|
}
|
|
7356
7485
|
const removed = [];
|
|
7357
7486
|
for (const rel of listed.stdout.split("\0").filter((rel2) => opts.strip(rel2))) {
|
|
7358
|
-
const file =
|
|
7359
|
-
|
|
7360
|
-
if (
|
|
7487
|
+
const file = path15.join(dir, rel);
|
|
7488
|
+
fs13.rmSync(file, { recursive: true, force: true });
|
|
7489
|
+
if (fs13.existsSync(file)) {
|
|
7361
7490
|
await removeReviewTree(run2, at.repoPath, dir);
|
|
7362
7491
|
return { ok: false, error: `couldn't remove ${rel} from the checkout` };
|
|
7363
7492
|
}
|
|
@@ -7366,7 +7495,7 @@ async function createReviewTree(run2, at, opts) {
|
|
|
7366
7495
|
return { ok: true, dir, removed };
|
|
7367
7496
|
}
|
|
7368
7497
|
async function removeReviewTree(run2, repoPath, dir) {
|
|
7369
|
-
if (
|
|
7498
|
+
if (fs13.existsSync(dir)) await run2("git", ["worktree", "remove", "--force", "--force", dir], repoPath);
|
|
7370
7499
|
const gone = rmTree(dir);
|
|
7371
7500
|
await run2("git", ["worktree", "prune"], repoPath);
|
|
7372
7501
|
return gone;
|
|
@@ -7385,8 +7514,8 @@ async function withReviewTree(run2, at, use, opts) {
|
|
|
7385
7514
|
}
|
|
7386
7515
|
function gitDirOf(dir) {
|
|
7387
7516
|
try {
|
|
7388
|
-
const m = /^gitdir:\s*(.+)$/m.exec(
|
|
7389
|
-
return m ?
|
|
7517
|
+
const m = /^gitdir:\s*(.+)$/m.exec(fs13.readFileSync(path15.join(dir, ".git"), "utf8"));
|
|
7518
|
+
return m ? path15.resolve(dir, m[1].trim(), "..", "..") : null;
|
|
7390
7519
|
} catch {
|
|
7391
7520
|
return null;
|
|
7392
7521
|
}
|
|
@@ -7398,19 +7527,19 @@ async function sweepReviewTrees(run2, opts = {}) {
|
|
|
7398
7527
|
const failed = [];
|
|
7399
7528
|
let names;
|
|
7400
7529
|
try {
|
|
7401
|
-
names =
|
|
7530
|
+
names = fs13.readdirSync(root, { withFileTypes: true }).filter((e) => e.isDirectory() && e.name !== NO_HOOKS).map((e) => e.name);
|
|
7402
7531
|
} catch {
|
|
7403
7532
|
return { swept, failed };
|
|
7404
7533
|
}
|
|
7405
7534
|
for (const name of names) {
|
|
7406
|
-
const dir =
|
|
7535
|
+
const dir = path15.join(root, name);
|
|
7407
7536
|
try {
|
|
7408
|
-
if (opts.olderThanMs && now -
|
|
7537
|
+
if (opts.olderThanMs && now - fs13.statSync(dir).mtimeMs < opts.olderThanMs) continue;
|
|
7409
7538
|
} catch {
|
|
7410
7539
|
continue;
|
|
7411
7540
|
}
|
|
7412
7541
|
const gitDir = gitDirOf(dir);
|
|
7413
|
-
const gone = gitDir &&
|
|
7542
|
+
const gone = gitDir && fs13.existsSync(gitDir) ? await removeReviewTree(run2, gitDir, dir) : rmTree(dir);
|
|
7414
7543
|
(gone ? swept : failed).push(name);
|
|
7415
7544
|
}
|
|
7416
7545
|
return { swept, failed };
|
|
@@ -7747,7 +7876,7 @@ function createReviewQueue(deps) {
|
|
|
7747
7876
|
}
|
|
7748
7877
|
|
|
7749
7878
|
// src/core/review/review-deps.ts
|
|
7750
|
-
import
|
|
7879
|
+
import fs14 from "fs";
|
|
7751
7880
|
var AGENT_TIMEOUT_MS = 18e4;
|
|
7752
7881
|
var CHECKOUT_AGENT_TIMEOUT_MS = 3e5;
|
|
7753
7882
|
var TREE_SWEEP_MIN_AGE_MS = CHECKOUT_AGENT_TIMEOUT_MS + 5 * 6e4;
|
|
@@ -7829,7 +7958,7 @@ function realReviewRouteIo() {
|
|
|
7829
7958
|
function realFixIo(opts) {
|
|
7830
7959
|
return {
|
|
7831
7960
|
lookUp: (r) => resolvePrToStart(r.url, loadConfig() ?? { repos: {}, groups: {} }, r.repo),
|
|
7832
|
-
liveSessionOn: (alias, branch) => sessionOnBranch(loadHistory(), loadConfig(), alias, branch, { branchOf: checkedOutBranch, exists: (p) =>
|
|
7961
|
+
liveSessionOn: (alias, branch) => sessionOnBranch(loadHistory(), loadConfig(), alias, branch, { branchOf: checkedOutBranch, exists: (p) => fs14.existsSync(p) }),
|
|
7833
7962
|
create: async (alias, branch, name) => {
|
|
7834
7963
|
const config = loadConfig();
|
|
7835
7964
|
if (!config) return { ok: false, error: "no config" };
|
|
@@ -7884,7 +8013,7 @@ function startReviewSweeps(opts) {
|
|
|
7884
8013
|
}
|
|
7885
8014
|
|
|
7886
8015
|
// src/core/diff/session-history.ts
|
|
7887
|
-
import
|
|
8016
|
+
import path16 from "path";
|
|
7888
8017
|
|
|
7889
8018
|
// src/core/diff/diff-points.ts
|
|
7890
8019
|
var SHA = /^[0-9a-f]{7,40}$/;
|
|
@@ -7980,12 +8109,12 @@ async function sessionHistory(session, others = []) {
|
|
|
7980
8109
|
});
|
|
7981
8110
|
if (diffArg === "HEAD") continue;
|
|
7982
8111
|
const log = await g(["log", `-n${MAX_COMMITS2}`, "--format=%H%x1f%cI%x1f%s", `${diffArg}..HEAD`, "--"], root);
|
|
7983
|
-
if (log.ok && log.out) commits.push(...parseLog(log.out,
|
|
8112
|
+
if (log.ok && log.out) commits.push(...parseLog(log.out, path16.basename(root)));
|
|
7984
8113
|
}
|
|
7985
8114
|
for (const b of others) {
|
|
7986
8115
|
const tip = await tipOf(b);
|
|
7987
8116
|
if (!tip) continue;
|
|
7988
|
-
const repo =
|
|
8117
|
+
const repo = path16.basename(b.path);
|
|
7989
8118
|
const start = liveStart(b) ?? b.start;
|
|
7990
8119
|
let list = [];
|
|
7991
8120
|
let base;
|
|
@@ -8046,7 +8175,7 @@ function parseLog(stdout, repo) {
|
|
|
8046
8175
|
return out;
|
|
8047
8176
|
}
|
|
8048
8177
|
function computeSessionRange(session, from, to) {
|
|
8049
|
-
const paths = session.paths.map((p) =>
|
|
8178
|
+
const paths = session.paths.map((p) => path16.resolve(p));
|
|
8050
8179
|
const refs = rangeRefs(paths, loadManifest(scopeHashForPaths(paths)).entries, from, to);
|
|
8051
8180
|
if ("error" in refs) return refs;
|
|
8052
8181
|
return { repos: refs.map((r) => ({ name: r.name, root: r.root, files: computeRangeDiff(r) })) };
|
|
@@ -8065,17 +8194,17 @@ async function sessionHistoryWire(session) {
|
|
|
8065
8194
|
}
|
|
8066
8195
|
|
|
8067
8196
|
// src/server/routes/revert-routes.ts
|
|
8068
|
-
import
|
|
8197
|
+
import path18 from "path";
|
|
8069
8198
|
import { zValidator as zValidator7 } from "@hono/zod-validator";
|
|
8070
8199
|
import { z as z6 } from "zod";
|
|
8071
8200
|
|
|
8072
8201
|
// src/core/diff/revert.ts
|
|
8073
|
-
import
|
|
8074
|
-
import
|
|
8202
|
+
import fs15 from "fs";
|
|
8203
|
+
import path17 from "path";
|
|
8075
8204
|
function inside(root, rel) {
|
|
8076
|
-
const abs =
|
|
8077
|
-
const back =
|
|
8078
|
-
if (!back || back.startsWith("..") ||
|
|
8205
|
+
const abs = path17.resolve(root, rel);
|
|
8206
|
+
const back = path17.relative(path17.resolve(root), abs);
|
|
8207
|
+
if (!back || back.startsWith("..") || path17.isAbsolute(back)) return null;
|
|
8079
8208
|
return abs;
|
|
8080
8209
|
}
|
|
8081
8210
|
function inHead(root, rel) {
|
|
@@ -8085,7 +8214,7 @@ function removeNew(root, rel) {
|
|
|
8085
8214
|
const abs = inside(root, rel);
|
|
8086
8215
|
if (!abs) return { ok: false, status: 400, error: `path escapes the worktree: ${rel}` };
|
|
8087
8216
|
git(["rm", "--cached", "-q", "--ignore-unmatch", "--", rel], root);
|
|
8088
|
-
|
|
8217
|
+
fs15.rmSync(abs, { force: true });
|
|
8089
8218
|
return null;
|
|
8090
8219
|
}
|
|
8091
8220
|
function revertFile(root, file) {
|
|
@@ -8188,8 +8317,8 @@ function mountRevertRoutes(app, opts) {
|
|
|
8188
8317
|
if (!session) return c.json({ error: "unknown session" }, 404);
|
|
8189
8318
|
const body = c.req.valid("json");
|
|
8190
8319
|
const repo = opts.uncommitted(session).find((r) => r.name === body.repo);
|
|
8191
|
-
const allowed = new Set(session.paths.map((p) =>
|
|
8192
|
-
if (!repo || !allowed.has(
|
|
8320
|
+
const allowed = new Set(session.paths.map((p) => path18.resolve(p).toLowerCase()));
|
|
8321
|
+
if (!repo || !allowed.has(path18.resolve(repo.root).toLowerCase())) {
|
|
8193
8322
|
return c.json({ error: `unknown repo: ${body.repo}` }, 404);
|
|
8194
8323
|
}
|
|
8195
8324
|
const file = repo.files.find((f) => f.path === body.path);
|
|
@@ -8246,7 +8375,7 @@ function mountDevRoutes(app, opts) {
|
|
|
8246
8375
|
}
|
|
8247
8376
|
|
|
8248
8377
|
// src/server/routes/ci-routes.ts
|
|
8249
|
-
import
|
|
8378
|
+
import fs16 from "fs";
|
|
8250
8379
|
var WAKE_PROMPT = NOTE_NUDGE;
|
|
8251
8380
|
async function wakeForNote(id) {
|
|
8252
8381
|
if (loadConfig()?.prWatch?.wakeClaude === false) return "off";
|
|
@@ -8267,7 +8396,7 @@ function mountCiRoutes(app, opts) {
|
|
|
8267
8396
|
lookOnly: opts.lookOnly,
|
|
8268
8397
|
sessions: () => {
|
|
8269
8398
|
const now = Date.now();
|
|
8270
|
-
return loadHistory().filter((s) => watchable(s, now, { exists: (p) =>
|
|
8399
|
+
return loadHistory().filter((s) => watchable(s, now, { exists: (p) => fs16.existsSync(p), lastWriteMs: lastConversationWriteMs })).map((session) => ({ id: sessionIdFor(session), session }));
|
|
8271
8400
|
},
|
|
8272
8401
|
// Never-pushed branches can't have a PR: don't ask GitHub about them,
|
|
8273
8402
|
// unless the watch already knows one (a merged PR whose branch is gone).
|
|
@@ -8346,27 +8475,27 @@ function mountCiRoutes(app, opts) {
|
|
|
8346
8475
|
}
|
|
8347
8476
|
|
|
8348
8477
|
// src/core/diff/diffs-sweep.ts
|
|
8349
|
-
import
|
|
8350
|
-
import
|
|
8478
|
+
import fs17 from "fs";
|
|
8479
|
+
import path19 from "path";
|
|
8351
8480
|
var SWEEP_AFTER_DAYS = 30;
|
|
8352
8481
|
var DISPOSABLE = /\.(html|log)$/i;
|
|
8353
|
-
function sweepOldDiffArtifacts(now = Date.now(), maxAgeDays = SWEEP_AFTER_DAYS, dir =
|
|
8482
|
+
function sweepOldDiffArtifacts(now = Date.now(), maxAgeDays = SWEEP_AFTER_DAYS, dir = path19.join(getConfigDir(), "diffs")) {
|
|
8354
8483
|
const cutoff = now - maxAgeDays * 24 * 60 * 60 * 1e3;
|
|
8355
8484
|
let removed = 0;
|
|
8356
8485
|
let bytes = 0;
|
|
8357
8486
|
let names;
|
|
8358
8487
|
try {
|
|
8359
|
-
names =
|
|
8488
|
+
names = fs17.readdirSync(dir);
|
|
8360
8489
|
} catch {
|
|
8361
8490
|
return { removed, bytes };
|
|
8362
8491
|
}
|
|
8363
8492
|
for (const name of names) {
|
|
8364
8493
|
if (!DISPOSABLE.test(name)) continue;
|
|
8365
|
-
const file =
|
|
8494
|
+
const file = path19.join(dir, name);
|
|
8366
8495
|
try {
|
|
8367
|
-
const st =
|
|
8496
|
+
const st = fs17.statSync(file);
|
|
8368
8497
|
if (!st.isFile() || st.mtimeMs >= cutoff) continue;
|
|
8369
|
-
|
|
8498
|
+
fs17.rmSync(file, { force: true });
|
|
8370
8499
|
removed++;
|
|
8371
8500
|
bytes += st.size;
|
|
8372
8501
|
} catch {
|
|
@@ -8957,7 +9086,7 @@ var LEFTOVERS_EVERY_MS = 60 * 6e4;
|
|
|
8957
9086
|
function computeSessionDiff(s, base) {
|
|
8958
9087
|
const resolved = s.paths.map((p) => resolveRepoDiff(p, base, s.baseBranches?.[p] ?? s.baseBranch));
|
|
8959
9088
|
const repos = s.paths.map((p, i) => ({
|
|
8960
|
-
name:
|
|
9089
|
+
name: path20.basename(p),
|
|
8961
9090
|
root: p,
|
|
8962
9091
|
resolvedBase: resolved[i].resolvedBase,
|
|
8963
9092
|
files: computeDiff({ root: p, diffArg: resolved[i].diffArg })
|
|
@@ -9008,7 +9137,7 @@ async function startWebServer(opts = {}) {
|
|
|
9008
9137
|
let activityWatcher = null;
|
|
9009
9138
|
if (!lean) {
|
|
9010
9139
|
try {
|
|
9011
|
-
const roots = activityRoots().filter((r) =>
|
|
9140
|
+
const roots = activityRoots().filter((r) => fs18.existsSync(r));
|
|
9012
9141
|
if (roots.length > 0) {
|
|
9013
9142
|
activityWatcher = createFsWatcher({
|
|
9014
9143
|
roots,
|
|
@@ -9061,7 +9190,7 @@ async function startWebServer(opts = {}) {
|
|
|
9061
9190
|
}, 500);
|
|
9062
9191
|
}
|
|
9063
9192
|
});
|
|
9064
|
-
const repoNames = (s) => s.isGroup ? s.paths.map((p) =>
|
|
9193
|
+
const repoNames = (s) => s.isGroup ? s.paths.map((p) => path20.basename(p)) : [s.target];
|
|
9065
9194
|
const diffStatFor = (id, s, hasStatus) => wantsDiffStat(s, hasStatus) ? diffStats.get(id, s.paths, repoNames(s)) : null;
|
|
9066
9195
|
const archivedRow = createArchivedRows();
|
|
9067
9196
|
app.get("/api/sessions", (c) => {
|
|
@@ -9612,6 +9741,7 @@ async function startWebServer(opts = {}) {
|
|
|
9612
9741
|
mountSessionOrderRoutes(app, { broadcast });
|
|
9613
9742
|
mountRailRoutes(app, { broadcast });
|
|
9614
9743
|
mountNoteRoutes(app, { broadcast });
|
|
9744
|
+
mountSessionShowRoutes(app, { broadcast });
|
|
9615
9745
|
mountSessionReviewRoutes(app, {
|
|
9616
9746
|
prepare: (session, repo) => prepareLocalReview(session, repo, {
|
|
9617
9747
|
diff: (s) => computeSessionDiff(s, "branch"),
|
|
@@ -9620,7 +9750,7 @@ async function startWebServer(opts = {}) {
|
|
|
9620
9750
|
inTree: (s, names) => localTreeRun(s.paths, names, {
|
|
9621
9751
|
readOnly: internalReadOnly,
|
|
9622
9752
|
run: (prompt, cwd, deny) => runInternalReadOnly(prompt, cwd, LOCAL_TREE_TIMEOUT_MS, { lane: "localReviews", deny }),
|
|
9623
|
-
exists: (dir) =>
|
|
9753
|
+
exists: (dir) => fs18.existsSync(dir)
|
|
9624
9754
|
}),
|
|
9625
9755
|
rules: () => rulesWith(loadConfig()?.reviews?.rules)
|
|
9626
9756
|
}),
|
|
@@ -9655,7 +9785,7 @@ async function startWebServer(opts = {}) {
|
|
|
9655
9785
|
updatesTimer?.unref?.();
|
|
9656
9786
|
const desktopFile = desktopUpdatePath();
|
|
9657
9787
|
const onDesktopUpdate = () => broadcast("updates-changed", { ts: Date.now() });
|
|
9658
|
-
if (jobs)
|
|
9788
|
+
if (jobs) fs18.watchFile(desktopFile, { interval: 3e3 }, onDesktopUpdate);
|
|
9659
9789
|
const usageWatcher = wireUsage(app, { broadcast, build: () => buildUsage(realUsageDeps()) });
|
|
9660
9790
|
mountPtyHostRoutes(app, {
|
|
9661
9791
|
dev: !!dev,
|
|
@@ -9731,7 +9861,7 @@ async function startWebServer(opts = {}) {
|
|
|
9731
9861
|
if (timeFirst) clearTimeout(timeFirst);
|
|
9732
9862
|
if (timeTimer) clearInterval(timeTimer);
|
|
9733
9863
|
timeKeeper?.stop();
|
|
9734
|
-
|
|
9864
|
+
fs18.unwatchFile(desktopFile, onDesktopUpdate);
|
|
9735
9865
|
usageWatcher.stop();
|
|
9736
9866
|
for (const t of conversationSyncs.values()) clearTimeout(t);
|
|
9737
9867
|
clearTimeout(sweepTimer);
|
|
@@ -9788,11 +9918,11 @@ function startAccountSync(deps) {
|
|
|
9788
9918
|
}
|
|
9789
9919
|
|
|
9790
9920
|
// src/core/platform/autostart.ts
|
|
9791
|
-
import
|
|
9792
|
-
import
|
|
9921
|
+
import fs19 from "fs";
|
|
9922
|
+
import path21 from "path";
|
|
9793
9923
|
function startupScriptPath() {
|
|
9794
9924
|
if (process.platform !== "win32" || !process.env.APPDATA) return null;
|
|
9795
|
-
return
|
|
9925
|
+
return path21.join(process.env.APPDATA, "Microsoft", "Windows", "Start Menu", "Programs", "Startup", "work-web.vbs");
|
|
9796
9926
|
}
|
|
9797
9927
|
function vbsQuote(s) {
|
|
9798
9928
|
return '"' + s.replace(/"/g, '""') + '"';
|
|
@@ -9810,11 +9940,11 @@ function setAutostart(enabled, workBin) {
|
|
|
9810
9940
|
const file = startupScriptPath();
|
|
9811
9941
|
if (!file) throw new Error("Autostart is only supported on Windows so far.");
|
|
9812
9942
|
if (enabled) {
|
|
9813
|
-
|
|
9814
|
-
|
|
9943
|
+
fs19.mkdirSync(path21.dirname(file), { recursive: true });
|
|
9944
|
+
fs19.writeFileSync(file, buildStartupScript(process.execPath, workBin), "utf-8");
|
|
9815
9945
|
} else {
|
|
9816
9946
|
try {
|
|
9817
|
-
|
|
9947
|
+
fs19.unlinkSync(file);
|
|
9818
9948
|
} catch {
|
|
9819
9949
|
}
|
|
9820
9950
|
}
|
|
@@ -9831,14 +9961,14 @@ async function demoHostSubmit(url, review) {
|
|
|
9831
9961
|
};
|
|
9832
9962
|
return { ok: true, url: `${url}#pullrequestreview-1` };
|
|
9833
9963
|
}
|
|
9834
|
-
var hunk = (
|
|
9964
|
+
var hunk = (path23, lines, status = "modified") => {
|
|
9835
9965
|
const added = lines.filter((l) => l.startsWith("+")).length;
|
|
9836
9966
|
const deleted = lines.filter((l) => l.startsWith("-")).length;
|
|
9837
9967
|
const context = lines.length - added - deleted;
|
|
9838
9968
|
return [
|
|
9839
|
-
`diff --git a/${
|
|
9840
|
-
...status === "added" ? ["new file mode 100644", "index 0000000..1111111", "--- /dev/null"] : ["index 1111111..2222222 100644", `--- a/${
|
|
9841
|
-
`+++ b/${
|
|
9969
|
+
`diff --git a/${path23} b/${path23}`,
|
|
9970
|
+
...status === "added" ? ["new file mode 100644", "index 0000000..1111111", "--- /dev/null"] : ["index 1111111..2222222 100644", `--- a/${path23}`],
|
|
9971
|
+
`+++ b/${path23}`,
|
|
9842
9972
|
`@@ -${status === "added" ? 0 : 1},${status === "added" ? 0 : context + deleted} +1,${context + added} @@`,
|
|
9843
9973
|
...lines
|
|
9844
9974
|
].join("\n");
|
|
@@ -10336,7 +10466,7 @@ function createDemoRepos(liveTargets) {
|
|
|
10336
10466
|
/** GET /api/projects: what New worktree offers, as the real one reads config. */
|
|
10337
10467
|
projects() {
|
|
10338
10468
|
return {
|
|
10339
|
-
singles: Object.entries(repos).map(([name,
|
|
10469
|
+
singles: Object.entries(repos).map(([name, path23]) => ({ name, kind: "single", path: path23 })),
|
|
10340
10470
|
groups: Object.entries(groups).map(([name, members]) => ({ name, kind: "group", members }))
|
|
10341
10471
|
};
|
|
10342
10472
|
},
|
|
@@ -10378,12 +10508,12 @@ function createDemoRepos(liveTargets) {
|
|
|
10378
10508
|
}));
|
|
10379
10509
|
return { roots: [root], repos: rows, groups: groupRows };
|
|
10380
10510
|
},
|
|
10381
|
-
enroll(alias,
|
|
10382
|
-
if (!found.some((f) => f.path ===
|
|
10383
|
-
const problem = enrollProblem(alias,
|
|
10511
|
+
enroll(alias, path23) {
|
|
10512
|
+
if (!found.some((f) => f.path === path23)) throw new DemoRepoError(`${path23} is not the top folder of a git repository`);
|
|
10513
|
+
const problem = enrollProblem(alias, path23, config());
|
|
10384
10514
|
if (problem) throw new DemoRepoError(problem);
|
|
10385
|
-
repos[alias] =
|
|
10386
|
-
ignored.delete(
|
|
10515
|
+
repos[alias] = path23;
|
|
10516
|
+
ignored.delete(path23);
|
|
10387
10517
|
},
|
|
10388
10518
|
remove(alias, force) {
|
|
10389
10519
|
if (!(alias in repos)) throw new DemoRepoError(`no repo \u201C${alias}\u201D`);
|
|
@@ -10392,9 +10522,9 @@ function createDemoRepos(liveTargets) {
|
|
|
10392
10522
|
delete repos[alias];
|
|
10393
10523
|
for (const g2 of Object.keys(groups)) groups[g2] = groups[g2].filter((m) => m !== alias);
|
|
10394
10524
|
},
|
|
10395
|
-
ignore(
|
|
10396
|
-
if (on) ignored.add(
|
|
10397
|
-
else ignored.delete(
|
|
10525
|
+
ignore(path23, on) {
|
|
10526
|
+
if (on) ignored.add(path23);
|
|
10527
|
+
else ignored.delete(path23);
|
|
10398
10528
|
},
|
|
10399
10529
|
saveGroup(name, members, creating) {
|
|
10400
10530
|
const problem = groupProblem(name, members, config(), { creating });
|
|
@@ -11634,15 +11764,15 @@ ${reply}\r
|
|
|
11634
11764
|
if (refusal || !s) return { ok: false, status: refusal?.status ?? 404, error: refusal?.error ?? "unknown session" };
|
|
11635
11765
|
s.repos.push({ name: alias, uncommitted: "", sinceBranch: "", published: false, pr: null });
|
|
11636
11766
|
const from = base || "main";
|
|
11637
|
-
const
|
|
11767
|
+
const path23 = this.wire(s).paths[s.repos.length - 1];
|
|
11638
11768
|
s.comments.post({
|
|
11639
11769
|
side: "general",
|
|
11640
11770
|
status: "published",
|
|
11641
|
-
body: addedRepoNote({ alias, path:
|
|
11771
|
+
body: addedRepoNote({ alias, path: path23, branch: s.branch, from, imported: true })
|
|
11642
11772
|
});
|
|
11643
11773
|
this.emit("comments-changed", { sessionId: id });
|
|
11644
11774
|
this.changed();
|
|
11645
|
-
return { ok: true, wire: { ok: true, path:
|
|
11775
|
+
return { ok: true, wire: { ok: true, path: path23, branch: s.branch, created: true, from, imported: true, warnings: [] } };
|
|
11646
11776
|
}
|
|
11647
11777
|
// -- CI (the PR watch, simulated) ------------------------------------------
|
|
11648
11778
|
/** The Today digest, through the same builder as work web: the demo's
|
|
@@ -12220,20 +12350,20 @@ function demoCodeFiles(repos, group) {
|
|
|
12220
12350
|
})
|
|
12221
12351
|
};
|
|
12222
12352
|
}
|
|
12223
|
-
function demoCodeFile(repos, group, repo,
|
|
12353
|
+
function demoCodeFile(repos, group, repo, path23) {
|
|
12224
12354
|
if (repo === "") {
|
|
12225
|
-
if (!group ||
|
|
12355
|
+
if (!group || path23 !== "CLAUDE.md") return null;
|
|
12226
12356
|
const text2 = `# Group instructions
|
|
12227
12357
|
|
|
12228
12358
|
Repos: ${repos.map((r2) => r2.name).join(", ")}.
|
|
12229
12359
|
`;
|
|
12230
|
-
return { repo, path:
|
|
12360
|
+
return { repo, path: path23, size: text2.length, text: text2 };
|
|
12231
12361
|
}
|
|
12232
12362
|
const r = repos.find((x) => x.name === repo);
|
|
12233
12363
|
if (!r) return null;
|
|
12234
|
-
const changed = r.changed.find((f) => f.path ===
|
|
12235
|
-
const text = changed ? newSide(changed) : COMMON[
|
|
12236
|
-
return text === void 0 ? null : { repo, path:
|
|
12364
|
+
const changed = r.changed.find((f) => f.path === path23 && f.status !== "deleted");
|
|
12365
|
+
const text = changed ? newSide(changed) : COMMON[path23]?.replace(/\{repo\}/g, repo);
|
|
12366
|
+
return text === void 0 ? null : { repo, path: path23, size: text.length, text };
|
|
12237
12367
|
}
|
|
12238
12368
|
function demoCodeSearch(repos, group, query) {
|
|
12239
12369
|
const q = query.trim();
|
|
@@ -12242,12 +12372,12 @@ function demoCodeSearch(repos, group, query) {
|
|
|
12242
12372
|
const text = [];
|
|
12243
12373
|
const fold = (x) => ignoresCase(q) ? x.toLowerCase() : x;
|
|
12244
12374
|
for (const r of demoCodeFiles(repos, group).repos) {
|
|
12245
|
-
for (const
|
|
12246
|
-
const lines = (demoCodeFile(repos, group, r.name,
|
|
12375
|
+
for (const path23 of r.files) {
|
|
12376
|
+
const lines = (demoCodeFile(repos, group, r.name, path23)?.text ?? "").split("\n");
|
|
12247
12377
|
lines.forEach((line, i) => {
|
|
12248
|
-
const d = declarationOf(
|
|
12249
|
-
if (d) symbols.push({ ...d, repo: r.name, path:
|
|
12250
|
-
if (fold(line).includes(fold(q))) text.push({ repo: r.name, path:
|
|
12378
|
+
const d = declarationOf(path23, line);
|
|
12379
|
+
if (d) symbols.push({ ...d, repo: r.name, path: path23, line: i + 1, text: line.trim() });
|
|
12380
|
+
if (fold(line).includes(fold(q))) text.push({ repo: r.name, path: path23, line: i + 1, text: line });
|
|
12251
12381
|
});
|
|
12252
12382
|
}
|
|
12253
12383
|
}
|
|
@@ -12518,13 +12648,13 @@ function createDemoSettings(repoPathOf) {
|
|
|
12518
12648
|
};
|
|
12519
12649
|
return {
|
|
12520
12650
|
read,
|
|
12521
|
-
async write(
|
|
12522
|
-
const f = settingAt(
|
|
12523
|
-
if (!f) throw new SettingsError(`no setting ${
|
|
12651
|
+
async write(path23, value) {
|
|
12652
|
+
const f = settingAt(path23);
|
|
12653
|
+
if (!f) throw new SettingsError(`no setting ${path23}`, 404);
|
|
12524
12654
|
const r = checkSetting(f, value);
|
|
12525
12655
|
if (!r.ok) throw new SettingsError(`${f.label}: ${r.error}`);
|
|
12526
|
-
if (r.value === null) delete values[
|
|
12527
|
-
else values[
|
|
12656
|
+
if (r.value === null) delete values[path23];
|
|
12657
|
+
else values[path23] = r.value;
|
|
12528
12658
|
return read();
|
|
12529
12659
|
},
|
|
12530
12660
|
readRepo,
|
|
@@ -12706,6 +12836,19 @@ async function startDemoServer(opts) {
|
|
|
12706
12836
|
});
|
|
12707
12837
|
return c.json({ events });
|
|
12708
12838
|
});
|
|
12839
|
+
app.get(
|
|
12840
|
+
"/api/sessions/:id/show",
|
|
12841
|
+
(c) => scenario.list().some((x) => x.id === c.req.param("id")) ? c.json({ shown: null }) : notFound(c)
|
|
12842
|
+
);
|
|
12843
|
+
app.post(
|
|
12844
|
+
"/api/sessions/:id/show",
|
|
12845
|
+
(c) => scenario.list().some((x) => x.id === c.req.param("id")) ? c.json({ error: "The demo has no files to show." }, 404) : notFound(c)
|
|
12846
|
+
);
|
|
12847
|
+
app.delete(
|
|
12848
|
+
"/api/sessions/:id/show",
|
|
12849
|
+
(c) => scenario.list().some((x) => x.id === c.req.param("id")) ? c.json({ shown: null }) : notFound(c)
|
|
12850
|
+
);
|
|
12851
|
+
app.get("/api/sessions/:id/show/image", (c) => c.json({ error: "it shows no image" }, 404));
|
|
12709
12852
|
const localReviews = /* @__PURE__ */ new Set();
|
|
12710
12853
|
const demoLocalReview = (w) => {
|
|
12711
12854
|
if (!localReviews.has(w.id)) return { status: "none", repo: null, repos: [] };
|
|
@@ -13684,16 +13827,16 @@ async function startDemoServer(opts) {
|
|
|
13684
13827
|
}
|
|
13685
13828
|
|
|
13686
13829
|
// src/core/platform/web-life.ts
|
|
13687
|
-
import
|
|
13688
|
-
import
|
|
13689
|
-
var lifePath = () =>
|
|
13830
|
+
import fs20 from "fs";
|
|
13831
|
+
import path22 from "path";
|
|
13832
|
+
var lifePath = () => path22.join(getConfigDir(), "web-life.json");
|
|
13690
13833
|
function isLife(v) {
|
|
13691
13834
|
const l = v;
|
|
13692
13835
|
return !!l && typeof l === "object" && typeof l.pid === "number" && typeof l.version === "string" && typeof l.startedAt === "string" && typeof l.lastSeen === "string" && (l.ended === void 0 || typeof l.ended?.at === "string" && typeof l.ended?.how === "string");
|
|
13693
13836
|
}
|
|
13694
13837
|
function readWebLife() {
|
|
13695
13838
|
try {
|
|
13696
|
-
const v = JSON.parse(
|
|
13839
|
+
const v = JSON.parse(fs20.readFileSync(lifePath(), "utf-8"));
|
|
13697
13840
|
return isLife(v) ? v : null;
|
|
13698
13841
|
} catch {
|
|
13699
13842
|
return null;
|
|
@@ -13772,7 +13915,7 @@ async function reinstallAgentSetup(lean) {
|
|
|
13772
13915
|
}
|
|
13773
13916
|
function startAccountSetupSync(lean, o = {}) {
|
|
13774
13917
|
return startAccountSync({
|
|
13775
|
-
folders: () => (o.folders ?? agentAccountFolders)().filter((dir) =>
|
|
13918
|
+
folders: () => (o.folders ?? agentAccountFolders)().filter((dir) => fs21.existsSync(dir)),
|
|
13776
13919
|
apply: o.apply ?? (() => reinstallAgentSetup(lean)),
|
|
13777
13920
|
onError: swallow("set up a changed Claude account"),
|
|
13778
13921
|
...o.everyMs !== void 0 ? { everyMs: o.everyMs } : {}
|
|
@@ -14076,4 +14219,4 @@ export {
|
|
|
14076
14219
|
stopExisting,
|
|
14077
14220
|
webCommand
|
|
14078
14221
|
};
|
|
14079
|
-
//# sourceMappingURL=web-
|
|
14222
|
+
//# sourceMappingURL=web-JTQP5Q4L.js.map
|