@moberg_hr/work-tree 2.11.4 → 2.11.5
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-JOKEFQ46.js → account-EAVYWOKR.js} +38 -24
- package/dist/account-EAVYWOKR.js.map +1 -0
- package/dist/{add-repo-JKVHNRWU.js → add-repo-3THEK6UG.js} +22 -22
- package/dist/{answer-PDCLL5Z2.js → answer-3CJQWBGY.js} +13 -13
- package/dist/{attach-BIFQP5OY.js → attach-FQSBZXI7.js} +19 -19
- package/dist/bin.js +4 -4
- package/dist/{block-EI3OQVDM.js → block-NGD2KNTU.js} +18 -18
- package/dist/{broadcast-ZSA3L5FY.js → broadcast-NLASZGWR.js} +10 -10
- package/dist/{catchup-SNMGWNRX.js → catchup-WJPWOGVI.js} +16 -16
- package/dist/{chunk-2R6EHVZG.js → chunk-3257QPVM.js} +3 -3
- package/dist/{chunk-IYWNDEXA.js → chunk-3KVOYBM4.js} +6 -6
- package/dist/{chunk-HJ2RKMBI.js → chunk-3O6QFWZ6.js} +2 -2
- package/dist/{chunk-MGNJPBZU.js → chunk-45MDVVW7.js} +6 -6
- package/dist/{chunk-K7Y7YTN3.js → chunk-5LUXNIPA.js} +2 -2
- package/dist/{chunk-M7FX37Z2.js → chunk-5RAAS4II.js} +9 -7
- package/dist/{chunk-M7FX37Z2.js.map → chunk-5RAAS4II.js.map} +1 -1
- package/dist/{chunk-73MGZAGV.js → chunk-64M7W2OQ.js} +5 -5
- package/dist/{chunk-AU7XGTJZ.js → chunk-7FNJ6A2U.js} +3 -3
- package/dist/{chunk-WQN7HJK6.js → chunk-7IZVI76D.js} +10 -10
- package/dist/{chunk-PMEOGFGV.js → chunk-7UXV4X2Y.js} +2 -2
- package/dist/{chunk-RH4BGTER.js → chunk-ACNCTLFO.js} +3 -3
- package/dist/{chunk-BLOV7ECI.js → chunk-AGRUEZQX.js} +2 -2
- package/dist/{chunk-2VYWTBC6.js → chunk-ANS6OH55.js} +3 -3
- package/dist/{chunk-HRUKMBF3.js → chunk-AYHDJMMJ.js} +2 -2
- package/dist/{chunk-F7IOGLKV.js → chunk-B2K2I2PQ.js} +26 -8
- package/dist/chunk-B2K2I2PQ.js.map +1 -0
- package/dist/{chunk-ZJBVZ4OJ.js → chunk-BHJ73OPQ.js} +4 -4
- package/dist/{chunk-7HQM5NYN.js → chunk-BK73QU45.js} +3 -3
- package/dist/{chunk-BENY64FW.js → chunk-BW5U6ENJ.js} +4 -4
- package/dist/{chunk-VADGWMXL.js → chunk-C72Y42VC.js} +6 -6
- package/dist/{chunk-7OZZUQDW.js → chunk-C7ZKDWPI.js} +4 -4
- package/dist/{chunk-PHHBZDO2.js → chunk-CS2EINZJ.js} +58 -58
- package/dist/{chunk-ZX2VBM2F.js → chunk-CVMO75V5.js} +4 -4
- package/dist/{chunk-QRYZAY7R.js → chunk-DHOC2S2L.js} +8 -8
- package/dist/{chunk-DMGNJ73M.js → chunk-DROLR3NJ.js} +2 -2
- package/dist/{chunk-KJRUC2QY.js → chunk-DS2CKYQ4.js} +2 -2
- package/dist/{chunk-KCDHOW22.js → chunk-DTFACBDD.js} +182 -94
- package/dist/chunk-DTFACBDD.js.map +1 -0
- package/dist/{chunk-VQACXAFX.js → chunk-DW245WK4.js} +9 -4
- package/dist/chunk-DW245WK4.js.map +1 -0
- package/dist/{chunk-MBSCZQ2C.js → chunk-DZ6SLAIZ.js} +2 -2
- package/dist/{chunk-XZKQHQBB.js → chunk-EJSGPLXO.js} +7 -5
- package/dist/{chunk-XZKQHQBB.js.map → chunk-EJSGPLXO.js.map} +1 -1
- package/dist/{chunk-BDPRYJL3.js → chunk-EYDGX32Q.js} +2 -2
- package/dist/chunk-FC7RECDP.js +9 -0
- package/dist/{chunk-SC2FQ6BR.js → chunk-FM6VLU4T.js} +5 -5
- package/dist/{chunk-WYQD44Y4.js → chunk-G2V2V5UC.js} +7 -3
- package/dist/chunk-G2V2V5UC.js.map +1 -0
- package/dist/{chunk-6MMXVHPL.js → chunk-H4TMS567.js} +7 -7
- package/dist/{chunk-NFWSJFYY.js → chunk-HHXVHUGP.js} +2 -2
- package/dist/{chunk-3QEDOZMA.js → chunk-HORDAO4Z.js} +4 -4
- package/dist/{chunk-E6WVQXF4.js → chunk-I3FLUAK7.js} +3 -3
- package/dist/{chunk-RIEBQWQC.js → chunk-I7AEQDG7.js} +2 -2
- package/dist/{chunk-O5ZJY5BT.js → chunk-INI6TEYT.js} +2 -1
- package/dist/chunk-INI6TEYT.js.map +1 -0
- package/dist/{chunk-CL3SSNBC.js → chunk-IREGW23T.js} +2 -2
- package/dist/{chunk-YKQLHFY4.js → chunk-IUWMT6PF.js} +48 -4
- package/dist/chunk-IUWMT6PF.js.map +1 -0
- package/dist/{chunk-GAE3NB3G.js → chunk-JIWPC53O.js} +9 -9
- package/dist/{chunk-U3RRXU6W.js → chunk-JNAYPBAB.js} +7 -7
- package/dist/{chunk-TW44C7CG.js → chunk-JVRS73M6.js} +6 -6
- package/dist/{chunk-CSTPOCV2.js → chunk-K5EAVRXX.js} +3 -3
- package/dist/{chunk-WV5U4S5N.js → chunk-KCWU6HNJ.js} +8 -8
- package/dist/{chunk-KKVWDMSM.js → chunk-LSZ6HI3U.js} +2 -2
- package/dist/{chunk-253Q6TOC.js → chunk-MKQ7IA6U.js} +3 -3
- package/dist/{chunk-3XU7Y2MV.js → chunk-N5PQHNYK.js} +2 -2
- package/dist/{chunk-3PXA5RJ2.js → chunk-NOB3VR5I.js} +37 -118
- package/dist/chunk-NOB3VR5I.js.map +1 -0
- package/dist/{chunk-BTR2E5WD.js → chunk-NUPLJJOS.js} +17 -16
- package/dist/chunk-NUPLJJOS.js.map +1 -0
- package/dist/{chunk-FFL7ETBY.js → chunk-OIVEYULL.js} +6 -6
- package/dist/{chunk-2YKV6MNQ.js → chunk-OTKWVUGB.js} +3 -3
- package/dist/{chunk-LPHYUNMD.js → chunk-PGGNMC34.js} +5 -3
- package/dist/{chunk-LPHYUNMD.js.map → chunk-PGGNMC34.js.map} +1 -1
- package/dist/{chunk-DMA3XCMF.js → chunk-RPWEOEA3.js} +11 -7
- package/dist/chunk-RPWEOEA3.js.map +1 -0
- package/dist/{chunk-CJ2QTQHG.js → chunk-RSCRZGUW.js} +2 -2
- package/dist/{chunk-N75AJ3ZR.js → chunk-S36RENUJ.js} +3 -3
- package/dist/{chunk-SQ4ZGEZY.js → chunk-SPVVXKDV.js} +2 -2
- package/dist/chunk-SQACJQUY.js +37 -0
- package/dist/chunk-SQACJQUY.js.map +1 -0
- package/dist/{chunk-KP2CI5QU.js → chunk-TFNDOWYP.js} +4 -4
- package/dist/{chunk-SMXRY653.js → chunk-TL7K3XUY.js} +7 -7
- package/dist/{chunk-HECIDNBU.js → chunk-TMAQASMH.js} +9 -9
- package/dist/{chunk-6C7CR2W2.js → chunk-TMBO55MM.js} +2 -2
- package/dist/{chunk-GV3KXHF3.js → chunk-TSFNTMMY.js} +3 -3
- package/dist/{chunk-5DUKO7WC.js → chunk-TUDDISCX.js} +6 -3
- package/dist/{chunk-3UI35AFZ.js → chunk-U2MOKVPZ.js} +2 -2
- package/dist/{chunk-RXZKYHSW.js → chunk-UQJQZ526.js} +5 -5
- package/dist/{chunk-RUUEZSQY.js → chunk-VPFAXLSX.js} +10 -8
- package/dist/{chunk-RUUEZSQY.js.map → chunk-VPFAXLSX.js.map} +1 -1
- package/dist/{chunk-VJ5XMYXE.js → chunk-VVRSPS67.js} +2 -2
- package/dist/{chunk-5ZU6H62F.js → chunk-ZIFWZJ7X.js} +2 -2
- package/dist/{chunk-3LDQPUJ6.js → chunk-ZQJKAZRD.js} +10 -10
- package/dist/{chunk-3QKH7JNR.js → chunk-ZS7ZXAXB.js} +33 -2
- package/dist/chunk-ZS7ZXAXB.js.map +1 -0
- package/dist/{cleanup-5CPX253G.js → cleanup-GFYEKCJS.js} +40 -40
- package/dist/cli-QP3BQXVW.js +20 -0
- package/dist/{completion-QCB7PKKT.js → completion-OEU4UZEA.js} +4 -4
- package/dist/{config-EQFAXBMQ.js → config-W3AEOOUK.js} +16 -16
- package/dist/{diff-MLCUMIYC.js → diff-G53V34KI.js} +16 -16
- package/dist/{digest-KSAGLQND.js → digest-W4425I4J.js} +13 -13
- package/dist/{fork-RCTVMUYI.js → fork-HTPJML6G.js} +36 -36
- package/dist/{history-N4ZURR4F.js → history-TYKH3SKB.js} +10 -10
- package/dist/{hook-DRZVYLJB.js → hook-F7WR5UIQ.js} +18 -18
- package/dist/{hydrate-NVJZZAFT.js → hydrate-HDZ62YMD.js} +11 -11
- package/dist/{init-RF6YC4BQ.js → init-Q5KJ666H.js} +21 -21
- package/dist/install-skills-C46BIZ5O.js +23 -0
- package/dist/install-skills-bin.js +9 -9
- package/dist/{keep-7Q3B6QT5.js → keep-MYHUCQWD.js} +12 -12
- package/dist/{list-PIJ4ROHR.js → list-BGHRHYV6.js} +12 -12
- package/dist/{move-XAZG3MJT.js → move-OHV2DC4V.js} +26 -26
- package/dist/{note-JJXIQ4QK.js → note-2I5WTKED.js} +12 -12
- package/dist/{overlaps-3YN4UQWC.js → overlaps-PX4BD23H.js} +20 -20
- package/dist/{pin-OOCB6DFR.js → pin-UTMH2XUZ.js} +12 -12
- package/dist/{pr-LCG4W65A.js → pr-PZCO36TY.js} +28 -28
- package/dist/{prune-2NGAUOPI.js → prune-APCNVQKK.js} +38 -38
- package/dist/{pty-host-XRXRI6UL.js → pty-host-Q5VNQKP2.js} +38 -18
- package/dist/pty-host-Q5VNQKP2.js.map +1 -0
- package/dist/{read-FJDDCX4D.js → read-HSQNG4CA.js} +12 -12
- package/dist/{recent-AAXLCQUF.js → recent-SNDWYLUH.js} +18 -18
- package/dist/{remove-VO5V45IJ.js → remove-5F5SP5TM.js} +50 -38
- package/dist/remove-5F5SP5TM.js.map +1 -0
- package/dist/{restart-AP763LE2.js → restart-HWSAV22N.js} +13 -13
- package/dist/{resume-SPO5XNDT.js → resume-DBO7FTEQ.js} +18 -18
- package/dist/{review-5IGFQF2T.js → review-36OJ5EES.js} +11 -9
- package/dist/{review-5IGFQF2T.js.map → review-36OJ5EES.js.map} +1 -1
- package/dist/{review-now-HHQIBVUS.js → review-now-CZPT7X4K.js} +3 -3
- package/dist/{run-JZWZHJOE.js → run-QQARI2AH.js} +10 -10
- package/dist/{screen-JRMMYVHB.js → screen-SXJEHTUY.js} +13 -13
- package/dist/{search-XOWMVFP2.js → search-U25QWSX4.js} +10 -10
- package/dist/{section-7WO7IHG6.js → section-TCH4DXE7.js} +12 -12
- package/dist/{send-OCSMOCUE.js → send-ZCKMC65W.js} +14 -14
- package/dist/{sessions-UAZALGGH.js → sessions-7PKZZ4NG.js} +32 -32
- package/dist/{snooze-UDJ5UDCS.js → snooze-JBPRRYAF.js} +12 -12
- package/dist/{start-OEG3T2SW.js → start-L6AWLRVP.js} +13 -13
- package/dist/{state-BR43ONIH.js → state-JHCC5CAR.js} +2 -2
- package/dist/{status-R4T2EHG5.js → status-WWRZLDGT.js} +17 -17
- package/dist/{statusline-3H3HAPCZ.js → statusline-MIFW47UA.js} +7 -7
- package/dist/{statusline-hook-FILOARNM.js → statusline-hook-W7KWKWAC.js} +5 -5
- package/dist/{stop-D3LRCCJS.js → stop-WHUBU5JZ.js} +13 -13
- package/dist/{sync-FWC2EWLW.js → sync-AVDUHYPQ.js} +38 -38
- package/dist/{time-AMAMIDWD.js → time-MIJM6SM6.js} +13 -13
- package/dist/{time-actions-YOXF5WC7.js → time-actions-Y5USDGSE.js} +3 -3
- package/dist/{timesheet-QFBA2Z2A.js → timesheet-AVRH56TG.js} +22 -22
- package/dist/{todo-TALKJYK6.js → todo-O6Y5MEQR.js} +2 -2
- package/dist/{tree-PJM2R2VA.js → tree-7YD6DL3H.js} +45 -40
- package/dist/{tree-PJM2R2VA.js.map → tree-7YD6DL3H.js.map} +1 -1
- package/dist/{update-RVZMM54Z.js → update-XGT2DFTT.js} +22 -22
- package/dist/{usage-W4UXQUPD.js → usage-7NM6L2MR.js} +12 -12
- package/dist/{version-WPF664CL.js → version-V7IM2UL4.js} +9 -9
- package/dist/{wait-C3S7Q6FA.js → wait-HCIFDLNX.js} +13 -13
- package/dist/wd-bin.js +7 -7
- package/dist/web/assets/{PtyView-Bq8MHIjd.js → PtyView-R0tQXVW8.js} +2 -2
- package/dist/web/assets/{PtyView-Bq8MHIjd.js.map → PtyView-R0tQXVW8.js.map} +1 -1
- package/dist/web/assets/index-Beb-xh6z.js +126 -0
- package/dist/web/assets/index-Beb-xh6z.js.map +1 -0
- package/dist/web/assets/{index-vHIk7hQs.css → index-QlOaahcZ.css} +1 -1
- package/dist/web/index.html +2 -2
- package/dist/{web-MPSYOYQ2.js → web-AXS3EMZ3.js} +1862 -1216
- package/dist/web-AXS3EMZ3.js.map +1 -0
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/dist/account-JOKEFQ46.js.map +0 -1
- package/dist/chunk-3PXA5RJ2.js.map +0 -1
- package/dist/chunk-3QKH7JNR.js.map +0 -1
- package/dist/chunk-AWY2HWAQ.js +0 -9
- package/dist/chunk-BTR2E5WD.js.map +0 -1
- package/dist/chunk-DMA3XCMF.js.map +0 -1
- package/dist/chunk-F7IOGLKV.js.map +0 -1
- package/dist/chunk-KCDHOW22.js.map +0 -1
- package/dist/chunk-O5ZJY5BT.js.map +0 -1
- package/dist/chunk-VQACXAFX.js.map +0 -1
- package/dist/chunk-WYQD44Y4.js.map +0 -1
- package/dist/chunk-YKQLHFY4.js.map +0 -1
- package/dist/cli-D2RPZWWM.js +0 -20
- package/dist/install-skills-DV7JBW56.js +0 -23
- package/dist/pty-host-XRXRI6UL.js.map +0 -1
- package/dist/remove-VO5V45IJ.js.map +0 -1
- package/dist/web/assets/index-DkVQmwkZ.js +0 -126
- package/dist/web/assets/index-DkVQmwkZ.js.map +0 -1
- package/dist/web-MPSYOYQ2.js.map +0 -1
- /package/dist/{add-repo-JKVHNRWU.js.map → add-repo-3THEK6UG.js.map} +0 -0
- /package/dist/{answer-PDCLL5Z2.js.map → answer-3CJQWBGY.js.map} +0 -0
- /package/dist/{attach-BIFQP5OY.js.map → attach-FQSBZXI7.js.map} +0 -0
- /package/dist/{block-EI3OQVDM.js.map → block-NGD2KNTU.js.map} +0 -0
- /package/dist/{broadcast-ZSA3L5FY.js.map → broadcast-NLASZGWR.js.map} +0 -0
- /package/dist/{catchup-SNMGWNRX.js.map → catchup-WJPWOGVI.js.map} +0 -0
- /package/dist/{chunk-2R6EHVZG.js.map → chunk-3257QPVM.js.map} +0 -0
- /package/dist/{chunk-IYWNDEXA.js.map → chunk-3KVOYBM4.js.map} +0 -0
- /package/dist/{chunk-HJ2RKMBI.js.map → chunk-3O6QFWZ6.js.map} +0 -0
- /package/dist/{chunk-MGNJPBZU.js.map → chunk-45MDVVW7.js.map} +0 -0
- /package/dist/{chunk-K7Y7YTN3.js.map → chunk-5LUXNIPA.js.map} +0 -0
- /package/dist/{chunk-73MGZAGV.js.map → chunk-64M7W2OQ.js.map} +0 -0
- /package/dist/{chunk-AU7XGTJZ.js.map → chunk-7FNJ6A2U.js.map} +0 -0
- /package/dist/{chunk-WQN7HJK6.js.map → chunk-7IZVI76D.js.map} +0 -0
- /package/dist/{chunk-PMEOGFGV.js.map → chunk-7UXV4X2Y.js.map} +0 -0
- /package/dist/{chunk-RH4BGTER.js.map → chunk-ACNCTLFO.js.map} +0 -0
- /package/dist/{chunk-BLOV7ECI.js.map → chunk-AGRUEZQX.js.map} +0 -0
- /package/dist/{chunk-2VYWTBC6.js.map → chunk-ANS6OH55.js.map} +0 -0
- /package/dist/{chunk-HRUKMBF3.js.map → chunk-AYHDJMMJ.js.map} +0 -0
- /package/dist/{chunk-ZJBVZ4OJ.js.map → chunk-BHJ73OPQ.js.map} +0 -0
- /package/dist/{chunk-7HQM5NYN.js.map → chunk-BK73QU45.js.map} +0 -0
- /package/dist/{chunk-BENY64FW.js.map → chunk-BW5U6ENJ.js.map} +0 -0
- /package/dist/{chunk-VADGWMXL.js.map → chunk-C72Y42VC.js.map} +0 -0
- /package/dist/{chunk-7OZZUQDW.js.map → chunk-C7ZKDWPI.js.map} +0 -0
- /package/dist/{chunk-PHHBZDO2.js.map → chunk-CS2EINZJ.js.map} +0 -0
- /package/dist/{chunk-ZX2VBM2F.js.map → chunk-CVMO75V5.js.map} +0 -0
- /package/dist/{chunk-QRYZAY7R.js.map → chunk-DHOC2S2L.js.map} +0 -0
- /package/dist/{chunk-DMGNJ73M.js.map → chunk-DROLR3NJ.js.map} +0 -0
- /package/dist/{chunk-KJRUC2QY.js.map → chunk-DS2CKYQ4.js.map} +0 -0
- /package/dist/{chunk-MBSCZQ2C.js.map → chunk-DZ6SLAIZ.js.map} +0 -0
- /package/dist/{chunk-BDPRYJL3.js.map → chunk-EYDGX32Q.js.map} +0 -0
- /package/dist/{chunk-AWY2HWAQ.js.map → chunk-FC7RECDP.js.map} +0 -0
- /package/dist/{chunk-SC2FQ6BR.js.map → chunk-FM6VLU4T.js.map} +0 -0
- /package/dist/{chunk-6MMXVHPL.js.map → chunk-H4TMS567.js.map} +0 -0
- /package/dist/{chunk-NFWSJFYY.js.map → chunk-HHXVHUGP.js.map} +0 -0
- /package/dist/{chunk-3QEDOZMA.js.map → chunk-HORDAO4Z.js.map} +0 -0
- /package/dist/{chunk-E6WVQXF4.js.map → chunk-I3FLUAK7.js.map} +0 -0
- /package/dist/{chunk-RIEBQWQC.js.map → chunk-I7AEQDG7.js.map} +0 -0
- /package/dist/{chunk-CL3SSNBC.js.map → chunk-IREGW23T.js.map} +0 -0
- /package/dist/{chunk-GAE3NB3G.js.map → chunk-JIWPC53O.js.map} +0 -0
- /package/dist/{chunk-U3RRXU6W.js.map → chunk-JNAYPBAB.js.map} +0 -0
- /package/dist/{chunk-TW44C7CG.js.map → chunk-JVRS73M6.js.map} +0 -0
- /package/dist/{chunk-CSTPOCV2.js.map → chunk-K5EAVRXX.js.map} +0 -0
- /package/dist/{chunk-WV5U4S5N.js.map → chunk-KCWU6HNJ.js.map} +0 -0
- /package/dist/{chunk-KKVWDMSM.js.map → chunk-LSZ6HI3U.js.map} +0 -0
- /package/dist/{chunk-253Q6TOC.js.map → chunk-MKQ7IA6U.js.map} +0 -0
- /package/dist/{chunk-3XU7Y2MV.js.map → chunk-N5PQHNYK.js.map} +0 -0
- /package/dist/{chunk-FFL7ETBY.js.map → chunk-OIVEYULL.js.map} +0 -0
- /package/dist/{chunk-2YKV6MNQ.js.map → chunk-OTKWVUGB.js.map} +0 -0
- /package/dist/{chunk-CJ2QTQHG.js.map → chunk-RSCRZGUW.js.map} +0 -0
- /package/dist/{chunk-N75AJ3ZR.js.map → chunk-S36RENUJ.js.map} +0 -0
- /package/dist/{chunk-SQ4ZGEZY.js.map → chunk-SPVVXKDV.js.map} +0 -0
- /package/dist/{chunk-KP2CI5QU.js.map → chunk-TFNDOWYP.js.map} +0 -0
- /package/dist/{chunk-SMXRY653.js.map → chunk-TL7K3XUY.js.map} +0 -0
- /package/dist/{chunk-HECIDNBU.js.map → chunk-TMAQASMH.js.map} +0 -0
- /package/dist/{chunk-6C7CR2W2.js.map → chunk-TMBO55MM.js.map} +0 -0
- /package/dist/{chunk-GV3KXHF3.js.map → chunk-TSFNTMMY.js.map} +0 -0
- /package/dist/{chunk-5DUKO7WC.js.map → chunk-TUDDISCX.js.map} +0 -0
- /package/dist/{chunk-3UI35AFZ.js.map → chunk-U2MOKVPZ.js.map} +0 -0
- /package/dist/{chunk-RXZKYHSW.js.map → chunk-UQJQZ526.js.map} +0 -0
- /package/dist/{chunk-VJ5XMYXE.js.map → chunk-VVRSPS67.js.map} +0 -0
- /package/dist/{chunk-5ZU6H62F.js.map → chunk-ZIFWZJ7X.js.map} +0 -0
- /package/dist/{chunk-3LDQPUJ6.js.map → chunk-ZQJKAZRD.js.map} +0 -0
- /package/dist/{cleanup-5CPX253G.js.map → cleanup-GFYEKCJS.js.map} +0 -0
- /package/dist/{cli-D2RPZWWM.js.map → cli-QP3BQXVW.js.map} +0 -0
- /package/dist/{completion-QCB7PKKT.js.map → completion-OEU4UZEA.js.map} +0 -0
- /package/dist/{config-EQFAXBMQ.js.map → config-W3AEOOUK.js.map} +0 -0
- /package/dist/{diff-MLCUMIYC.js.map → diff-G53V34KI.js.map} +0 -0
- /package/dist/{digest-KSAGLQND.js.map → digest-W4425I4J.js.map} +0 -0
- /package/dist/{fork-RCTVMUYI.js.map → fork-HTPJML6G.js.map} +0 -0
- /package/dist/{history-N4ZURR4F.js.map → history-TYKH3SKB.js.map} +0 -0
- /package/dist/{hook-DRZVYLJB.js.map → hook-F7WR5UIQ.js.map} +0 -0
- /package/dist/{hydrate-NVJZZAFT.js.map → hydrate-HDZ62YMD.js.map} +0 -0
- /package/dist/{init-RF6YC4BQ.js.map → init-Q5KJ666H.js.map} +0 -0
- /package/dist/{install-skills-DV7JBW56.js.map → install-skills-C46BIZ5O.js.map} +0 -0
- /package/dist/{keep-7Q3B6QT5.js.map → keep-MYHUCQWD.js.map} +0 -0
- /package/dist/{list-PIJ4ROHR.js.map → list-BGHRHYV6.js.map} +0 -0
- /package/dist/{move-XAZG3MJT.js.map → move-OHV2DC4V.js.map} +0 -0
- /package/dist/{note-JJXIQ4QK.js.map → note-2I5WTKED.js.map} +0 -0
- /package/dist/{overlaps-3YN4UQWC.js.map → overlaps-PX4BD23H.js.map} +0 -0
- /package/dist/{pin-OOCB6DFR.js.map → pin-UTMH2XUZ.js.map} +0 -0
- /package/dist/{pr-LCG4W65A.js.map → pr-PZCO36TY.js.map} +0 -0
- /package/dist/{prune-2NGAUOPI.js.map → prune-APCNVQKK.js.map} +0 -0
- /package/dist/{read-FJDDCX4D.js.map → read-HSQNG4CA.js.map} +0 -0
- /package/dist/{recent-AAXLCQUF.js.map → recent-SNDWYLUH.js.map} +0 -0
- /package/dist/{restart-AP763LE2.js.map → restart-HWSAV22N.js.map} +0 -0
- /package/dist/{resume-SPO5XNDT.js.map → resume-DBO7FTEQ.js.map} +0 -0
- /package/dist/{review-now-HHQIBVUS.js.map → review-now-CZPT7X4K.js.map} +0 -0
- /package/dist/{run-JZWZHJOE.js.map → run-QQARI2AH.js.map} +0 -0
- /package/dist/{screen-JRMMYVHB.js.map → screen-SXJEHTUY.js.map} +0 -0
- /package/dist/{search-XOWMVFP2.js.map → search-U25QWSX4.js.map} +0 -0
- /package/dist/{section-7WO7IHG6.js.map → section-TCH4DXE7.js.map} +0 -0
- /package/dist/{send-OCSMOCUE.js.map → send-ZCKMC65W.js.map} +0 -0
- /package/dist/{sessions-UAZALGGH.js.map → sessions-7PKZZ4NG.js.map} +0 -0
- /package/dist/{snooze-UDJ5UDCS.js.map → snooze-JBPRRYAF.js.map} +0 -0
- /package/dist/{start-OEG3T2SW.js.map → start-L6AWLRVP.js.map} +0 -0
- /package/dist/{state-BR43ONIH.js.map → state-JHCC5CAR.js.map} +0 -0
- /package/dist/{status-R4T2EHG5.js.map → status-WWRZLDGT.js.map} +0 -0
- /package/dist/{statusline-3H3HAPCZ.js.map → statusline-MIFW47UA.js.map} +0 -0
- /package/dist/{statusline-hook-FILOARNM.js.map → statusline-hook-W7KWKWAC.js.map} +0 -0
- /package/dist/{stop-D3LRCCJS.js.map → stop-WHUBU5JZ.js.map} +0 -0
- /package/dist/{sync-FWC2EWLW.js.map → sync-AVDUHYPQ.js.map} +0 -0
- /package/dist/{time-AMAMIDWD.js.map → time-MIJM6SM6.js.map} +0 -0
- /package/dist/{time-actions-YOXF5WC7.js.map → time-actions-Y5USDGSE.js.map} +0 -0
- /package/dist/{timesheet-QFBA2Z2A.js.map → timesheet-AVRH56TG.js.map} +0 -0
- /package/dist/{todo-TALKJYK6.js.map → todo-O6Y5MEQR.js.map} +0 -0
- /package/dist/{update-RVZMM54Z.js.map → update-XGT2DFTT.js.map} +0 -0
- /package/dist/{usage-W4UXQUPD.js.map → usage-7NM6L2MR.js.map} +0 -0
- /package/dist/{version-WPF664CL.js.map → version-V7IM2UL4.js.map} +0 -0
- /package/dist/{wait-C3S7Q6FA.js.map → wait-HCIFDLNX.js.map} +0 -0
|
@@ -5,42 +5,41 @@ import {
|
|
|
5
5
|
} from "./chunk-AKMPF72Y.js";
|
|
6
6
|
import {
|
|
7
7
|
listReplies
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-5RAAS4II.js";
|
|
9
9
|
import {
|
|
10
10
|
shownState
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-ACNCTLFO.js";
|
|
12
12
|
import {
|
|
13
13
|
runInternal
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-B2K2I2PQ.js";
|
|
15
15
|
import {
|
|
16
16
|
runningFromNames,
|
|
17
17
|
stopRunningFrom
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-TUDDISCX.js";
|
|
19
19
|
import {
|
|
20
20
|
disposePty
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-ZQJKAZRD.js";
|
|
22
22
|
import {
|
|
23
23
|
saveIgnored,
|
|
24
24
|
teardownWorktree,
|
|
25
25
|
worktreeFor
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-TMAQASMH.js";
|
|
27
27
|
import {
|
|
28
28
|
isLeftover
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-LSZ6HI3U.js";
|
|
30
30
|
import {
|
|
31
31
|
readPendingForSession
|
|
32
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-PGGNMC34.js";
|
|
33
33
|
import {
|
|
34
34
|
buildFoldersOf,
|
|
35
35
|
clearBuildFolders
|
|
36
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-ZIFWZJ7X.js";
|
|
37
37
|
import {
|
|
38
38
|
defaultRunner
|
|
39
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-MKQ7IA6U.js";
|
|
40
40
|
import {
|
|
41
41
|
archiveRefFor,
|
|
42
42
|
archiveSession,
|
|
43
|
-
checkedOutBranch,
|
|
44
43
|
dropSaved,
|
|
45
44
|
loadHistory,
|
|
46
45
|
readStatus,
|
|
@@ -50,16 +49,17 @@ import {
|
|
|
50
49
|
setSessionArchived,
|
|
51
50
|
stopDev,
|
|
52
51
|
turnInProgress
|
|
53
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-NOB3VR5I.js";
|
|
54
53
|
import {
|
|
55
54
|
sessionIdFor
|
|
56
55
|
} from "./chunk-RUYTU2WJ.js";
|
|
57
56
|
import {
|
|
58
|
-
agentOf
|
|
59
|
-
|
|
57
|
+
agentOf,
|
|
58
|
+
checkedOutBranch
|
|
59
|
+
} from "./chunk-DTFACBDD.js";
|
|
60
60
|
import {
|
|
61
61
|
loadConfig
|
|
62
|
-
} from "./chunk-
|
|
62
|
+
} from "./chunk-INI6TEYT.js";
|
|
63
63
|
|
|
64
64
|
// src/core/archive/session-archive-deps.ts
|
|
65
65
|
import fs from "fs";
|
|
@@ -190,6 +190,7 @@ function defaultArchiveDeps(opts = {}) {
|
|
|
190
190
|
},
|
|
191
191
|
removeWorktree: async (s) => {
|
|
192
192
|
if (s.paths.every((p) => !fs.existsSync(p))) return true;
|
|
193
|
+
if (opts.removeWorktree) return opts.removeWorktree(s);
|
|
193
194
|
return teardownWorktree(s.target, s.isGroup, s.branch, config(), true, s.paths);
|
|
194
195
|
},
|
|
195
196
|
setArchived: (s) => setSessionArchived(s.target, s.branch, true),
|
|
@@ -282,4 +283,4 @@ export {
|
|
|
282
283
|
archiveMergedSession,
|
|
283
284
|
defaultArchiveDeps
|
|
284
285
|
};
|
|
285
|
-
//# sourceMappingURL=chunk-
|
|
286
|
+
//# sourceMappingURL=chunk-NUPLJJOS.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/core/archive/session-archive-deps.ts","../src/core/archive/archive-summary.ts"],"sourcesContent":["import fs from 'node:fs';\nimport path from 'node:path';\nimport { checkedOutBranch } from '../git/git-head.js';\nimport { loadConfig } from '../platform/config.js';\nimport { agentOf } from '../agents/index.js';\nimport { examineWorktree, normPath, type CleanupSession } from '../cleanup/cleanup.js';\nimport { loadHistory, setSessionArchived, type WorktreeSession } from '../sessions/history.js';\nimport { disposePty } from '../pty/pty-pool.js';\nimport { sessionIdFor } from '../sessions/session-id.js';\nimport { readStatus, turnInProgress } from '../status/session-status.js';\nimport { shownState } from '../status/turn-activity.js';\nimport { defaultRunner, type CommandRunner } from '../pr/ship.js';\nimport { teardownWorktree } from '../worktree/worktree.js';\nimport { archiveSession, type ArchiveDeps, type ArchivedPr } from './session-archive.js';\nimport { archiveRefFor, dropSaved, saveUncommitted, type SavedUncommitted } from './archive-uncommitted.js';\nimport { readPendingForSession } from '../comments/pending-delivery.js';\nimport { listReplies } from '../pr/pr-replies.js';\nimport { stopDev } from '../worktree/dev-server.js';\nimport { runningFromNames, stopRunningFrom } from '../platform/running-from.js';\nimport { buildFoldersOf, clearBuildFolders } from '../cleanup/build-folders.js';\nimport { runInternal } from '../diff/checkpoint-summary.js';\nimport { summarizeArchive } from './archive-summary.js';\nimport { isLeftover } from '../worktree/leftover.js';\nimport { saveIgnored, type SavedIgnored } from './archive-ignored.js';\nimport { worktreeFor } from './archive-restore.js';\nimport { recordedRepos, sessionAliases } from '../sessions/session-repos.js';\n\nconst plural = (n: number, one: string, many: string) => `${n} ${n === 1 ? one : many}`;\n\n/**\n * What archiving now would leave unfinished, in words (empty: nothing):\n * replies Claude drafted for you to post, notes its Claude hasn't been\n * given yet, a Claude mid-turn or waiting for your answer.\n */\nexport function archiveWaiting(id: string): string[] {\n const out: string[] = [];\n const drafts = listReplies(id).filter((r) => r.status === 'draft').length;\n if (drafts) out.push(`${plural(drafts, 'reply', 'replies')} to post on review threads`);\n const pending = readPendingForSession(id).length;\n if (pending) out.push(`${plural(pending, 'note', 'notes')} not yet delivered to its Claude`);\n // As the dashboard shows it (a Claude that died mid-turn isn't \"working\" forever).\n const session = loadHistory().find((s) => sessionIdFor(s) === id);\n const st = session ? shownState(session) : readStatus(id)?.state;\n if (st === 'working') out.push('its Claude is working');\n if (st === 'needs_input') out.push('its Claude is waiting for your answer');\n return out;\n}\n\n/**\n * The PR watch's archive of merged work (its `archive` dep): `merged`, so\n * nothing waiting in it holds it up. Resolves to what it kept that was\n * waiting (\"2 reply drafts\"), for the Activity note; throws when it didn't\n * archive (a turn in progress), so the watch notes it and tries again.\n */\nexport async function archiveMergedSession(id: string, deps: ArchiveDeps, onChanged: () => void = () => {}): Promise<string | undefined> {\n const s = loadHistory().find((x) => sessionIdFor(x) === id);\n if (!s || s.archivedAt) return undefined;\n // The PR watch, unasked: what you run from it is yours, so it keeps the worktree rather than stop it.\n const out = await archiveSession(s, deps, { merged: true, unattended: true, by: 'pr-merged' });\n onChanged();\n if (!out.ok) throw new Error(out.message);\n return out.kept;\n}\n\nexport interface ArchiveDepsOptions {\n /** Release other handles on its folders first (the web server's watchers,\n * a Claude): Windows won't delete a folder something holds open. */\n release?: (sessionId: string) => Promise<void>;\n /** How its worktree is removed (work web: in a child process, remove-child.ts — git's delete is synchronous). */\n removeWorktree?: (s: WorktreeSession) => Promise<boolean>;\n /** Its PRs, for the summary (the PR watch's cache). */\n prs?: (sessionId: string) => ArchivedPr[];\n run?: CommandRunner;\n}\n\n/** The real inputs of archiveSession, the same for the dashboard, the PR watch and the CLI. */\nexport function defaultArchiveDeps(opts: ArchiveDepsOptions = {}): ArchiveDeps {\n const run = opts.run ?? defaultRunner;\n const config = () => {\n const c = loadConfig();\n if (!c) throw new Error('No config: run `work init` first.');\n return c;\n };\n return {\n stopClaude: async (id) => {\n await disposePty(id);\n await opts.release?.(id);\n },\n removable: async (s, { uncommittedSaved = false } = {}) => {\n const cfg = loadConfig();\n if (!cfg) return { ok: false, reason: 'no work config to check it against' };\n const repos = Object.values(cfg.repos).map(normPath);\n // A session on a repo's own checkout (`work tree <repo>` without a\n // branch) points at the repo itself: that folder is never removed.\n if (s.paths.some((p) => repos.includes(normPath(p)))) return { ok: false, reason: \"it is the repo's own checkout\" };\n if (s.paths.every((p) => !fs.existsSync(p))) return { ok: true, reason: 'already gone' };\n const cs: CleanupSession = {\n id: sessionIdFor(s),\n target: s.target,\n branch: s.branch,\n isGroup: s.isGroup,\n paths: s.paths,\n archivedAt: null,\n lastActiveMs: 0,\n aliases: sessionAliases(s, cfg),\n };\n const c = await examineWorktree(cs, { baseCheckouts: () => Object.values(cfg.repos), run });\n // Uncommitted files that were saved don't keep it; commits not in the\n // main branch still do (nothing else has them).\n const savedAway = uncommittedSaved && c.verdict === 'dirty' && c.repos.every((r) => !r.exists || r.merged !== null);\n return { ok: c.verdict === 'merged' || c.verdict === 'gone' || savedAway, reason: c.reason };\n },\n saveUncommitted: async (s, dir, stamp) => {\n const id = sessionIdFor(s);\n const saved: Record<string, SavedUncommitted> = {};\n for (const [alias, repo] of repoPaths(s, loadConfig())) {\n const wt = worktreeOf(s, repo, alias);\n // A repo's own checkout is never removed, so nothing of it needs saving.\n if (!wt || !fs.existsSync(wt) || normPath(wt) === normPath(repo)) continue;\n const r = await saveUncommitted(wt, alias, archiveRefFor(id, alias, stamp), dir, `${alias}-${stamp}`);\n if ('error' in r) return { saved, error: r.error };\n if ('saved' in r) saved[alias] = r.saved;\n }\n return { saved, error: null };\n },\n dropSaved: async (s, saved, dir) => {\n const cfg = loadConfig();\n for (const [alias, u] of Object.entries(saved)) {\n const repo = cfg?.repos[alias];\n if (repo) await dropSaved(repo, u, dir);\n }\n },\n halfRemoved: (s) => s.paths.filter(isLeftover),\n saveIgnored: async (s, dir) => {\n const cfg = loadConfig();\n const out: Record<string, SavedIgnored> = {};\n for (const [alias] of repoPaths(s, cfg)) {\n const wt = cfg ? worktreeFor(s, alias, cfg) : null;\n if (!wt || !fs.existsSync(wt)) continue;\n const r = await saveIgnored(wt, path.join(dir, 'ignored', alias));\n if (r.files || r.skipped) out[alias] = r;\n }\n return out;\n },\n removeWorktree: async (s) => {\n if (s.paths.every((p) => !fs.existsSync(p))) return true;\n if (opts.removeWorktree) return opts.removeWorktree(s);\n return teardownWorktree(s.target, s.isGroup, s.branch, config(), true, s.paths);\n },\n setArchived: (s) => setSessionArchived(s.target, s.branch, true),\n transcripts: (s: WorktreeSession) => (agentOf(s).conversation?.files(s) ?? []).map((t) => t.file),\n prs: opts.prs,\n lastSummary: (id) => readStatus(id)?.summary ?? null,\n waiting: archiveWaiting,\n // Mid-turn: working as the dashboard shows it, or at a dialog mid-turn (turnInProgress).\n working: (id) => {\n const session = loadHistory().find((x) => sessionIdFor(x) === id);\n return (session ? shownState(session) : readStatus(id)?.state) === 'working' || turnInProgress(readStatus(id));\n },\n kept: (id) => {\n const st = readStatus(id);\n return {\n replyDrafts: listReplies(id)\n .filter((r) => r.status === 'draft')\n .map((r) => ({ threadId: r.threadId, url: r.url, reviewer: r.reviewer, draft: r.draft ?? '' })),\n notes: readPendingForSession(id).map((c) => ({ id: c.id, text: c.body })),\n ...(st?.state === 'needs_input' && st.summary ? { askingYou: st.summary } : {}),\n };\n },\n stopDev: (id) => void stopDev(id),\n stopRunningFrom: (s) => stopRunningFrom(s.paths),\n runningFrom: (s) => runningFromNames(s.paths),\n heads: (s) => {\n const out: Record<string, string> = {};\n for (const [alias, repo] of repoPaths(s, loadConfig())) {\n const wt = worktreeOf(s, repo, alias);\n const branch = wt ? checkedOutBranch(wt) : null;\n if (branch && branch !== s.branch) out[alias] = branch;\n }\n return out;\n },\n tips: async (s, heads) => {\n const cfg = loadConfig();\n const out: Record<string, string> = {};\n for (const [alias, repo] of repoPaths(s, cfg)) {\n const r = await run('git', ['-C', repo, 'rev-parse', '--verify', '--quiet', `refs/heads/${heads[alias] ?? s.branch}`], repo);\n if (r.code === 0 && r.stdout.trim()) out[alias] = r.stdout.trim();\n }\n return out;\n },\n clearBuildFolders: async (s) => {\n let folders = 0;\n let bytes = 0;\n for (const p of s.paths) {\n if (!fs.existsSync(p)) continue;\n const sized = await buildFoldersOf(p, run);\n const r = await clearBuildFolders(p, run);\n folders += r.removed.length;\n bytes += sized.filter((f) => r.removed.includes(f.path)).reduce((n, f) => n + f.bytes, 0);\n }\n return { folders, bytes };\n },\n tidy: async (s, heads) => {\n const cfg = loadConfig();\n const repos = repoPaths(s, cfg);\n // Its per-turn checkpoints stay (refs in the repos, and their manifest): Restore puts the\n // worktree back at the same path, so the Diff tab's turns come back with it. They go when\n // the session is deleted (clearSessionCheckpoints).\n // A local branch already in the main branch goes (its tip is recorded,\n // and reachable from the main branch, so Restore can recreate it). A\n // squash-merged one stays: its commits are reachable from nothing else.\n // Both the session's branch and the one checked out, when Claude switched.\n const deleted: string[] = [];\n for (const [alias, repo] of repos) {\n const base = (await run('git', ['-C', repo, 'rev-parse', '--abbrev-ref', 'origin/HEAD'], repo)).stdout.trim();\n if (!base || base === 'origin/HEAD') continue;\n const merged = (await run('git', ['-C', repo, 'branch', '--merged', base, '--format=%(refname:short)'], repo)).stdout\n .split('\\n')\n .map((l) => l.trim());\n const inUse = (await run('git', ['-C', repo, 'worktree', 'list', '--porcelain'], repo)).stdout;\n const head = heads[alias] ?? s.branch;\n for (const branch of new Set([s.branch, head])) {\n if (!merged.includes(branch) || inUse.includes(`branch refs/heads/${branch}\\n`)) continue;\n // Reported only for the checked-out one: that is what Restore recreates.\n if ((await run('git', ['-C', repo, 'branch', '-D', branch], repo)).code === 0 && branch === head) deleted.push(alias);\n }\n }\n return deleted;\n },\n summarize: (rec) => summarizeArchive(rec, (prompt) => runInternal(prompt, 60_000)),\n };\n}\n\n/** The session's worktree of a repo: its only path, or (a group) its recorded one, else the one named after the repo's folder. */\nfunction worktreeOf(s: WorktreeSession, repo: string, alias: string): string | null {\n if (!s.isGroup) return s.paths[0] ?? null;\n const own = recordedRepos(s);\n if (own) return own.find((r) => r.alias === alias)?.path ?? null;\n const name = path.basename(repo).toLowerCase();\n return s.paths.find((p) => path.basename(p).toLowerCase() === name) ?? null;\n}\n\n/** The session's repos as [alias, base checkout path] (its own, sessionAliases; a row from before: each group member). */\nfunction repoPaths(s: WorktreeSession, cfg: ReturnType<typeof loadConfig>): Array<[string, string]> {\n if (!cfg) return [];\n const aliases = sessionAliases(s, cfg);\n return aliases.filter((a) => cfg.repos[a] && fs.existsSync(cfg.repos[a])).map((a) => [a, cfg.repos[a]]);\n}\n","import type { ArchiveRecord } from './session-archive.js';\n\n/**\n * The few sentences an archived session keeps on what was done and why —\n * what the Sessions list shows for it, and what archive search finds.\n * Written after archiving by an internal `claude -p` (no tools, neutral\n * cwd: the prompts are your text, but they are only material here).\n */\n\nconst MAX_PROMPT_CHARS = 600;\nconst MAX_INPUT_CHARS = 12_000;\n\n/** The prompt for the summary, from what the archive kept (pure, for tests). */\nexport function summaryPrompt(rec: ArchiveRecord): string {\n const prompts = rec.summary.prompts\n .map((p) => `- ${p.text.replace(/\\s+/g, ' ').slice(0, MAX_PROMPT_CHARS)}`)\n .join('\\n')\n .slice(0, MAX_INPUT_CHARS);\n const prs = rec.summary.prs.map((p) => `#${p.number} (${p.repo}, ${p.state.toLowerCase()})`).join(', ');\n return [\n 'Below is what a developer asked a coding assistant during one piece of work on a git branch, and how it ended.',\n 'Write 2–4 plain sentences on what was done and why, for finding this work again months later:',\n 'name the feature or bug, the main changes, and anything left open. No preamble, no lists, no markdown.',\n '',\n `Branch: ${rec.branch} (${rec.target})`,\n rec.summary.jiraKey ? `Jira: ${rec.summary.jiraKey}` : '',\n prs ? `Pull requests: ${prs}` : '',\n '',\n `The developer's requests (${rec.summary.promptCount} in all; first and latest shown):`,\n prompts || '(none kept)',\n '',\n rec.summary.lastSummary ? `How the last turn ended: ${rec.summary.lastSummary}` : '',\n ]\n .filter((l, i, all) => l !== '' || all[i - 1] !== '')\n .join('\\n');\n}\n\n/** Ask `claude -p` (injectable) for the summary; null when it can't say. */\nexport async function summarizeArchive(rec: ArchiveRecord, ask: (prompt: string) => Promise<string | null>): Promise<string | null> {\n if (rec.summary.prompts.length === 0 && !rec.summary.lastSummary) return null;\n const out = (await ask(summaryPrompt(rec)))?.trim();\n if (!out) return null;\n // One paragraph, bounded: it is shown in a list row.\n return clipToSentence(out.replace(/\\s+/g, ' '), MAX_SUMMARY_CHARS);\n}\n\nconst MAX_SUMMARY_CHARS = 800;\n\n/** At most `max` characters, ending at a sentence when one ends past half of it (else at a word, with \"…\"). */\nexport function clipToSentence(text: string, max = MAX_SUMMARY_CHARS): string {\n if (text.length <= max) return text;\n const head = text.slice(0, max);\n const end = Math.max(head.lastIndexOf('. '), head.lastIndexOf('! '), head.lastIndexOf('? '));\n if (end >= max / 2) return head.slice(0, end + 1);\n const space = head.lastIndexOf(' ');\n return `${head.slice(0, space > 0 ? space : max).trimEnd()}…`;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ;AACf,OAAO,UAAU;;;ACQjB,IAAM,mBAAmB;AACzB,IAAM,kBAAkB;AAGjB,SAAS,cAAc,KAA4B;AACxD,QAAM,UAAU,IAAI,QAAQ,QACzB,IAAI,CAAC,MAAM,KAAK,EAAE,KAAK,QAAQ,QAAQ,GAAG,EAAE,MAAM,GAAG,gBAAgB,CAAC,EAAE,EACxE,KAAK,IAAI,EACT,MAAM,GAAG,eAAe;AAC3B,QAAM,MAAM,IAAI,QAAQ,IAAI,IAAI,CAAC,MAAM,IAAI,EAAE,MAAM,KAAK,EAAE,IAAI,KAAK,EAAE,MAAM,YAAY,CAAC,GAAG,EAAE,KAAK,IAAI;AACtG,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,WAAW,IAAI,MAAM,KAAK,IAAI,MAAM;AAAA,IACpC,IAAI,QAAQ,UAAU,SAAS,IAAI,QAAQ,OAAO,KAAK;AAAA,IACvD,MAAM,kBAAkB,GAAG,KAAK;AAAA,IAChC;AAAA,IACA,6BAA6B,IAAI,QAAQ,WAAW;AAAA,IACpD,WAAW;AAAA,IACX;AAAA,IACA,IAAI,QAAQ,cAAc,4BAA4B,IAAI,QAAQ,WAAW,KAAK;AAAA,EACpF,EACG,OAAO,CAAC,GAAG,GAAG,QAAQ,MAAM,MAAM,IAAI,IAAI,CAAC,MAAM,E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|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-ACNCTLFO.js";
|
|
5
5
|
import {
|
|
6
6
|
recordCheckedOutBranches
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-64M7W2OQ.js";
|
|
8
8
|
import {
|
|
9
9
|
defaultRunner
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-MKQ7IA6U.js";
|
|
11
11
|
import {
|
|
12
12
|
archiveDirFor,
|
|
13
13
|
bestEffort,
|
|
@@ -16,13 +16,13 @@ import {
|
|
|
16
16
|
readArchive,
|
|
17
17
|
sessionAliases,
|
|
18
18
|
setSessionBase
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-NOB3VR5I.js";
|
|
20
20
|
import {
|
|
21
21
|
sessionIdFor
|
|
22
22
|
} from "./chunk-RUYTU2WJ.js";
|
|
23
23
|
import {
|
|
24
24
|
loadConfig
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-INI6TEYT.js";
|
|
26
26
|
|
|
27
27
|
// src/core/stacks/session-update.ts
|
|
28
28
|
import path4 from "path";
|
|
@@ -426,4 +426,4 @@ export {
|
|
|
426
426
|
moveOntoMain,
|
|
427
427
|
updateSession
|
|
428
428
|
};
|
|
429
|
-
//# sourceMappingURL=chunk-
|
|
429
|
+
//# sourceMappingURL=chunk-OIVEYULL.js.map
|
|
@@ -4,13 +4,13 @@ import {
|
|
|
4
4
|
workSteps,
|
|
5
5
|
workedBetween,
|
|
6
6
|
workedByDay
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-NOB3VR5I.js";
|
|
8
8
|
import {
|
|
9
9
|
dayKey
|
|
10
10
|
} from "./chunk-NEJVK5CF.js";
|
|
11
11
|
import {
|
|
12
12
|
agentOf
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-DTFACBDD.js";
|
|
14
14
|
|
|
15
15
|
// src/core/conversations/work-time-source.ts
|
|
16
16
|
import fs from "fs";
|
|
@@ -153,4 +153,4 @@ export {
|
|
|
153
153
|
sessionTokens,
|
|
154
154
|
sessionWorkTime
|
|
155
155
|
};
|
|
156
|
-
//# sourceMappingURL=chunk-
|
|
156
|
+
//# sourceMappingURL=chunk-OTKWVUGB.js.map
|
|
@@ -8,14 +8,16 @@ import {
|
|
|
8
8
|
scopeHashFor
|
|
9
9
|
} from "./chunk-ZSHWP2VS.js";
|
|
10
10
|
import {
|
|
11
|
-
checkedOutBranch,
|
|
12
11
|
loadHistory
|
|
13
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-NOB3VR5I.js";
|
|
14
13
|
import {
|
|
15
14
|
sessionIdFor,
|
|
16
15
|
tx,
|
|
17
16
|
withDb
|
|
18
17
|
} from "./chunk-RUYTU2WJ.js";
|
|
18
|
+
import {
|
|
19
|
+
checkedOutBranch
|
|
20
|
+
} from "./chunk-DTFACBDD.js";
|
|
19
21
|
|
|
20
22
|
// src/core/comments/pending-delivery.ts
|
|
21
23
|
import fs from "fs";
|
|
@@ -184,4 +186,4 @@ export {
|
|
|
184
186
|
claimForDelivery,
|
|
185
187
|
formatPendingForPrompt
|
|
186
188
|
};
|
|
187
|
-
//# sourceMappingURL=chunk-
|
|
189
|
+
//# sourceMappingURL=chunk-PGGNMC34.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/core/comments/pending-delivery.ts"],"sourcesContent":["/**\n * Bridge between `work web` review comments and any live Claude session\n * running in the same worktree. Storage (state.db, see db.ts):\n *\n * comments the comment stores (comment-file-store.ts)\n * comment_deliveries (session, comment id) pairs surfaced to Claude\n *\n * \"Pending\" = published, user-authored, not in the delivered list. Replies\n * authored by Claude (author === 'claude') are excluded — Claude wrote\n * them; we don't need to echo them back.\n *\n * Delivery is lazy: when a Claude in the matching worktree submits a\n * prompt, the hook reads pending comments via this module, prints them as\n * a system-reminder block to stdout (which Claude Code injects into the\n * conversation), and marks them delivered.\n */\n\nimport { checkedOutBranch } from '../git/git-head.js';\nimport fs from 'node:fs';\nimport path from 'node:path';\nimport { loadHistory, type WorktreeSession } from '../sessions/history.js';\nimport { sessionIdFor } from '../sessions/session-id.js';\nimport { getCommentFileStore, readStoreComments, readStoresComments } from './comment-file-store.js';\nimport { scopeHashFor } from '../diff/repo-spec.js';\nimport { tx, withDb, type Db } from '../platform/db.js';\nimport type { Comment } from './comment-types.js';\n\nfunction deliveredIds(d: Db, sessionId: string): Set<string> {\n return new Set(\n (d.prepare('SELECT comment_id FROM comment_deliveries WHERE session_id = ?').all(sessionId) as Array<{ comment_id: string }>).map(\n (r) => r.comment_id,\n ),\n );\n}\n\n/** Norm-path comparison that mirrors what we do server-side. */\nfunction normalize(p: string): string {\n return path.resolve(p).replace(/\\\\/g, '/').toLowerCase();\n}\n\n/** Map a Claude cwd back to a session. Tries direct-match against any\n * session's path first, then ancestor match (so cwd inside a subdir of a\n * worktree still resolves to the worktree's session). */\n/**\n * Two sessions on one folder (an old entry and a newer one, a typo'd target\n * re-added): which of them a Claude there is. Not an archived one when the\n * other isn't; then the one whose branch is checked out there; then the one\n * entered last. The oldest used to win, so status and comments went to an\n * entry nobody looks at.\n */\nfunction owns(candidate: WorktreeSession, current: WorktreeSession, root: string): boolean {\n if (!!candidate.archivedAt !== !!current.archivedAt) return !candidate.archivedAt;\n const onBranch = checkedOutBranch(root);\n const a = candidate.branch === onBranch;\n const b = current.branch === onBranch;\n if (a !== b) return a;\n return (Date.parse(candidate.lastAccessedAt) || 0) > (Date.parse(current.lastAccessedAt) || 0);\n}\n\nexport function findSessionForCwd(cwd: string, sessions: WorktreeSession[] = loadHistory()): WorktreeSession | null {\n const here = normalize(cwd);\n // Deepest root containing cwd wins, so nested worktrees disambiguate. A\n // group's roots include the group root (the sub-repos' parent) — that's\n // where `work tree` launches Claude for a group, so hooks fire from there.\n let best: { session: WorktreeSession; root: string; len: number } | null = null;\n for (const s of sessions) {\n const roots = s.isGroup && s.paths[0] ? [...s.paths, path.dirname(s.paths[0])] : s.paths;\n for (const root of roots) {\n const r = normalize(root);\n if (!(here === r || here.startsWith(r + '/'))) continue;\n if (!best || r.length > best.len || (r.length === best.len && owns(s, best.session, root))) {\n best = { session: s, root, len: r.length };\n }\n }\n }\n if (!best) return null;\n // A separate checkout nested INSIDE the session's tree (a git worktree at\n // <repo>/.claude/worktrees/x, a vendored repo) is not this session: its\n // Claude must not report status, take checkpoints or receive comments as\n // if it were the parent. Any `.git` between cwd and the matched root —\n // other than the session's own repos — marks a different checkout.\n // (Plain fs checks: this runs on every hook.)\n const own = new Set(best.session.paths.map(normalize));\n const top = normalize(best.root);\n for (let dir = path.resolve(cwd); normalize(dir) !== top && normalize(dir).startsWith(top + '/'); dir = path.dirname(dir)) {\n if (!own.has(normalize(dir)) && fs.existsSync(path.join(dir, '.git'))) return null;\n if (path.dirname(dir) === dir) break;\n }\n return best.session;\n}\n\nfunction isPendingFor(delivered: Set<string>) {\n return (c: Comment) => c.status === 'published' && c.author === 'user' && !delivered.has(c.id);\n}\n\n/** Returns published user comments that haven't been delivered yet.\n * Reads through the file-store cache so we see in-flight writes\n * (`session-meta.ts` and other readers couldn't, when they re-read the\n * disk directly). */\n/**\n * The line typed into an idle Claude (or given as the first prompt of one\n * work starts) so its UserPromptSubmit hook attaches the pending comments.\n * Short on purpose: a long typed note got mangled by Claude Code's paste\n * handling. It says where the content is, so it reads right in the\n * transcript.\n */\nexport const NOTE_NUDGE =\n 'work has new notes for you (review feedback, CI results or comments); they are attached to this message. Work through them now.';\n\nexport function readPendingForSession(sessionId: string): Comment[] {\n const delivered = withDb((d) => deliveredIds(d, sessionId));\n return readStoreComments(sessionId).filter(isPendingFor(delivered));\n}\n\n/** Comment-store ids for every `wd` scope that could cover this worktree.\n * A scope is keyed by `sha1` of its sorted repo roots (see\n * `repo-spec.scopeHashFor`), so from a session's paths we can rebuild the\n * exact ids without consulting `work web`'s in-memory scope registry:\n * - the whole-set hash → a group `wd` opened at the group root, or the\n * single-repo `wd` (one path);\n * - each individual path's hash → a `wd` opened inside one sub-repo of a\n * group worktree.\n * `registerScope` hashes `path.resolve()`d roots, so we resolve here too or\n * the hashes won't line up. Mirrors `scope-manager.commentStoreIdForScope`\n * (`scope-<hash>`). */\nexport function scopeStoreIdsForPaths(paths: string[]): string[] {\n const resolved = paths.map((p) => path.resolve(p));\n const ids = new Set<string>();\n ids.add(`scope-${scopeHashFor(resolved)}`);\n for (const p of resolved) ids.add(`scope-${scopeHashFor([p])}`);\n return [...ids];\n}\n\n/**\n * Pending comments for a whole worktree: the session's own comment store\n * PLUS any `wd` / `wd -c` scope review store covering the same paths.\n *\n * `wd` registers its review under a scope-hash comment store, not the\n * session store the hook reads — without this merge, comments left in the\n * `wd` review UI would never reach the Claude running in that worktree.\n * Delivered-tracking stays per-session (one `<sessionId>.delivered.json`),\n * so a comment surfaced here won't be re-delivered regardless of which\n * store it came from.\n */\nexport function readPendingForWorktree(session: WorktreeSession, sessionId: string = sessionIdFor(session)): Comment[] {\n const delivered = withDb((d) => deliveredIds(d, sessionId));\n const pending = isPendingFor(delivered);\n const storeIds = [sessionId, ...scopeStoreIdsForPaths(session.paths)];\n const rows = readStoresComments(storeIds); // one query: this runs for every row of /api/sessions\n const seen = new Set<string>();\n const out: Comment[] = [];\n for (const storeId of storeIds) {\n for (const c of rows.get(storeId) ?? []) {\n if (seen.has(c.id) || !pending(c)) continue;\n seen.add(c.id);\n out.push(c);\n }\n }\n return out;\n}\n\n/**\n * What was handed to Claude is done once its turn really ends: your review\n * comments and work's notes to it (PR feedback, CI, a prompt you sent) —\n * every top-level comment of yours it was given, in the session's store and\n * any `wd` scope store over its paths — are marked resolved. Left open, they\n * piled up on the Diff tab's badge (three PR-watch notes read as \"3\"), to\n * resolve or delete by hand. Resolved threads stay listed (dimmed) and can\n * be reopened. Claude's own replies are left as they are. Returns the ids\n * resolved.\n */\nexport function resolveAddressed(session: WorktreeSession): string[] {\n const sessionId = sessionIdFor(session);\n const delivered = withDb((d) => deliveredIds(d, sessionId));\n if (delivered.size === 0) return [];\n const done: string[] = [];\n for (const storeId of [sessionId, ...scopeStoreIdsForPaths(session.paths)]) {\n const open = readStoreComments(storeId).filter(\n (c) => delivered.has(c.id) && c.author === 'user' && c.status === 'published' && !c.parentId && !c.resolved,\n );\n if (open.length === 0) continue;\n const store = getCommentFileStore(storeId);\n for (const c of open) if (store.setResolved(c.id, true)) done.push(c.id);\n }\n return done;\n}\n\n/** Persist a delivery batch, so these ids are never surfaced again. */\nexport function markDelivered(sessionId: string, ids: string[]): void {\n if (ids.length === 0) return;\n tx((d) => {\n const ins = d.prepare('INSERT OR IGNORE INTO comment_deliveries (session_id, comment_id) VALUES (?, ?)');\n for (const id of ids) ins.run(sessionId, id);\n });\n}\n\n/**\n * Claim comments for delivery: of `ids`, return the ones nobody has\n * delivered yet, and mark them delivered — atomically. Two deliverers\n * racing (a Stop hook and the PTY push for the same comment) then can't\n * both send it: only the one that claimed it does. A deliverer whose send\n * fails gives the ids back with `releaseClaim`.\n */\nexport function claimForDelivery(sessionId: string, ids: string[]): string[] {\n if (ids.length === 0) return [];\n // INSERT OR IGNORE in one write transaction: a row inserted here is our\n // claim; one that already existed was someone else's.\n return tx((d) => {\n const ins = d.prepare('INSERT OR IGNORE INTO comment_deliveries (session_id, comment_id) VALUES (?, ?)');\n return ids.filter((id) => ins.run(sessionId, id).changes > 0);\n });\n}\n\n/** Undo a claim whose delivery failed, so the next hook picks them up. */\nexport function releaseClaim(sessionId: string, ids: string[]): void {\n if (ids.length === 0) return;\n tx((d) => {\n const del = d.prepare('DELETE FROM comment_deliveries WHERE session_id = ? AND comment_id = ?');\n for (const id of ids) del.run(sessionId, id);\n });\n}\n\n/** Cap the size of one comment body we surface to Claude. A pathologically\n * long comment shouldn't blow out Claude's context — we truncate, then\n * hint at the rest via \"(truncated)\". 4 KB is generous for a code-review\n * note while leaving headroom for batches. */\nconst MAX_BODY_BYTES = 4 * 1024;\n/** A general note: a prompt, or work's own note (a PR review round quotes\n * every thread, then a bot's overview). 4 KB once cut such a note before\n * the line telling Claude how to draft its replies. */\nconst MAX_NOTE_BYTES = 16 * 1024;\n/** Overall cap on the whole system-reminder payload. Multiple long\n * comments at once still get bounded — but room for four whole notes, since\n * the cut falls on the newest one's end: its instructions. */\nconst MAX_TOTAL_BYTES = 4 * MAX_NOTE_BYTES;\n\n/**\n * Format pending comments as a system-reminder block suitable for stdout.\n * Returns empty string when there's nothing pending — the caller (the\n * `work hook` CLI) just exits silently in that case.\n *\n * Truncates pathologically long bodies and caps the overall payload so\n * one runaway comment can't displace the rest of Claude's context.\n */\nexport function formatPendingForPrompt(pending: Comment[]): string {\n if (pending.length === 0) return '';\n\n const sorted = [...pending].sort((a, b) => a.createdAt.localeCompare(b.createdAt));\n\n const general = sorted.filter((c) => c.side === 'general' && !c.parentId);\n const inline = sorted.filter((c) => c.side !== 'general' && !c.parentId);\n const replies = sorted.filter((c) => c.parentId);\n\n const lines: string[] = [];\n lines.push('<system-reminder>');\n lines.push(`New review comments from \\`work web\\` (${pending.length} item${pending.length === 1 ? '' : 's'}):`);\n lines.push('');\n\n if (general.length > 0) {\n lines.push('## General notes');\n for (const c of general) {\n // General notes (this is where `work broadcast` lands) may be multi-line\n // prompts — deliver the whole body, not just line 1. Only the byte cap\n // applies. Inline/reply comments still use the one-line `formatBody`.\n lines.push(formatFullBody('-', c));\n }\n lines.push('');\n }\n\n if (inline.length > 0) {\n lines.push('## Inline comments');\n for (const c of inline) {\n const where = `${c.repo}/${c.file}:${c.line} (${c.side})`;\n lines.push(formatBody(`- ${where}`, c));\n }\n lines.push('');\n }\n\n if (replies.length > 0) {\n lines.push('## Replies');\n for (const c of replies) {\n lines.push(formatBody(`- (reply to ${c.parentId})`, c));\n }\n lines.push('');\n }\n\n lines.push(\n 'Address them as part of your next response. You can reply via the same review UI by posting back to the latest review URL at `~/.work/web.url` + `/api/sessions/<id>/comments` with `author: \"claude\"`.',\n );\n lines.push('</system-reminder>');\n const out = lines.join('\\n');\n if (out.length <= MAX_TOTAL_BYTES) return out;\n const trimmed = out.slice(0, MAX_TOTAL_BYTES - 200);\n return (\n trimmed +\n '\\n\\n(…review payload truncated for context-window safety; ' +\n `${pending.length} comment(s) total — open work web for the full list.)\\n` +\n '</system-reminder>'\n );\n}\n\nfunction formatBody(prefix: string, c: Comment): string {\n const lead = c.body.split('\\n')[0].trim();\n const capped = lead.length > MAX_BODY_BYTES ? `${lead.slice(0, MAX_BODY_BYTES)}…` : lead;\n return `${prefix}: ${capped}${c.body.includes('\\n') ? ' …' : ''}`;\n}\n\n/** Like `formatBody` but preserves the full multi-line body (only the note\n * cap applies). Multi-line bodies are emitted under the bullet, indented, so\n * a broadcast prompt arrives intact rather than truncated to its first line. */\nfunction formatFullBody(prefix: string, c: Comment): string {\n const body = c.body.trim();\n const capped = body.length > MAX_NOTE_BYTES ? `${body.slice(0, MAX_NOTE_BYTES)}…` : body;\n const bodyLines = capped.split('\\n');\n if (bodyLines.length === 1) return `${prefix}: ${bodyLines[0]}`;\n const [first, ...rest] = bodyLines;\n return [`${prefix}: ${first}`, ...rest.map((l) => ` ${l}`)].join('\\n');\n}\n\n/** Re-export so consumers don't have to know which module owns it. */\nexport { sessionIdFor };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAkBA,OAAO,QAAQ;AACf,OAAO,UAAU;AAQjB,SAAS,aAAa,GAAO,WAAgC;AAC3D,SAAO,IAAI;AAAA,IACR,EAAE,QAAQ,gEAAgE,EAAE,IAAI,SAAS,EAAoC;AAAA,MAC5H,CAAC,MAAM,EAAE;AAAA,IACX;AAAA,EACF;AACF;AAGA,SAAS,UAAU,GAAmB;AACpC,SAAO,KAAK,QAAQ,CAAC,EAAE,QAAQ,OAAO,GAAG,EAAE,YAAY;AACzD;AAYA,SAAS,KAAK,WAA4B,SAA0B,MAAuB;AACzF,MAAI,CAAC,CAAC,UAAU,eAAe,CAAC,CAAC,QAAQ,WAAY,QAAO,CAAC,UAAU;AACvE,QAAM,WAAW,iBAAiB,IAAI;AACtC,QAAM,IA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KAAK,SAAS,IAAI,IAAI,YAAO,EAAE;AACjE;AAKA,SAAS,eAAe,QAAgB,GAAoB;AAC1D,QAAM,OAAO,EAAE,KAAK,KAAK;AACzB,QAAM,SAAS,KAAK,SAAS,iBAAiB,GAAG,KAAK,MAAM,GAAG,cAAc,CAAC,WAAM;AACpF,QAAM,YAAY,OAAO,MAAM,IAAI;AACnC,MAAI,UAAU,WAAW,EAAG,QAAO,GAAG,MAAM,KAAK,UAAU,CAAC,CAAC;AAC7D,QAAM,CAAC,OAAO,GAAG,IAAI,IAAI;AACzB,SAAO,CAAC,GAAG,MAAM,KAAK,KAAK,IAAI,GAAG,KAAK,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC,EAAE,KAAK,IAAI;AACxE;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/core/comments/pending-delivery.ts"],"sourcesContent":["/**\n * Bridge between `work web` review comments and any live Claude session\n * running in the same worktree. Storage (state.db, see db.ts):\n *\n * comments the comment stores (comment-file-store.ts)\n * comment_deliveries (session, comment id) pairs surfaced to Claude\n *\n * \"Pending\" = published, user-authored, not in the delivered list. Replies\n * authored by Claude (author === 'claude') are excluded — Claude wrote\n * them; we don't need to echo them back.\n *\n * Delivery is lazy: when a Claude in the matching worktree submits a\n * prompt, the hook reads pending comments via this module, prints them as\n * a system-reminder block to stdout (which Claude Code injects into the\n * conversation), and marks them delivered.\n */\n\nimport { checkedOutBranch } from '../git/git-head.js';\nimport fs from 'node:fs';\nimport path from 'node:path';\nimport { loadHistory, type WorktreeSession } from '../sessions/history.js';\nimport { sessionIdFor } from '../sessions/session-id.js';\nimport { getCommentFileStore, readStoreComments, readStoresComments } from './comment-file-store.js';\nimport { scopeHashFor } from '../diff/repo-spec.js';\nimport { tx, withDb, type Db } from '../platform/db.js';\nimport type { Comment } from './comment-types.js';\n\nfunction deliveredIds(d: Db, sessionId: string): Set<string> {\n return new Set(\n (d.prepare('SELECT comment_id FROM comment_deliveries WHERE session_id = ?').all(sessionId) as Array<{ comment_id: string }>).map(\n (r) => r.comment_id,\n ),\n );\n}\n\n/** Norm-path comparison that mirrors what we do server-side. */\nfunction normalize(p: string): string {\n return path.resolve(p).replace(/\\\\/g, '/').toLowerCase();\n}\n\n/** Map a Claude cwd back to a session. Tries direct-match against any\n * session's path first, then ancestor match (so cwd inside a subdir of a\n * worktree still resolves to the worktree's session). */\n/**\n * Two sessions on one folder (an old entry and a newer one, a typo'd target\n * re-added): which of them a Claude there is. Not an archived one when the\n * other isn't; then the one whose branch is checked out there; then the one\n * entered last. The oldest used to win, so status and comments went to an\n * entry nobody looks at.\n */\nfunction owns(candidate: WorktreeSession, current: WorktreeSession, root: string): boolean {\n if (!!candidate.archivedAt !== !!current.archivedAt) return !candidate.archivedAt;\n const onBranch = checkedOutBranch(root);\n const a = candidate.branch === onBranch;\n const b = current.branch === onBranch;\n if (a !== b) return a;\n return (Date.parse(candidate.lastAccessedAt) || 0) > (Date.parse(current.lastAccessedAt) || 0);\n}\n\nexport function findSessionForCwd(cwd: string, sessions: WorktreeSession[] = loadHistory()): WorktreeSession | null {\n const here = normalize(cwd);\n // Deepest root containing cwd wins, so nested worktrees disambiguate. A\n // group's roots include the group root (the sub-repos' parent) — that's\n // where `work tree` launches Claude for a group, so hooks fire from there.\n let best: { session: WorktreeSession; root: string; len: number } | null = null;\n for (const s of sessions) {\n const roots = s.isGroup && s.paths[0] ? [...s.paths, path.dirname(s.paths[0])] : s.paths;\n for (const root of roots) {\n const r = normalize(root);\n if (!(here === r || here.startsWith(r + '/'))) continue;\n if (!best || r.length > best.len || (r.length === best.len && owns(s, best.session, root))) {\n best = { session: s, root, len: r.length };\n }\n }\n }\n if (!best) return null;\n // A separate checkout nested INSIDE the session's tree (a git worktree at\n // <repo>/.claude/worktrees/x, a vendored repo) is not this session: its\n // Claude must not report status, take checkpoints or receive comments as\n // if it were the parent. Any `.git` between cwd and the matched root —\n // other than the session's own repos — marks a different checkout.\n // (Plain fs checks: this runs on every hook.)\n const own = new Set(best.session.paths.map(normalize));\n const top = normalize(best.root);\n for (let dir = path.resolve(cwd); normalize(dir) !== top && normalize(dir).startsWith(top + '/'); dir = path.dirname(dir)) {\n if (!own.has(normalize(dir)) && fs.existsSync(path.join(dir, '.git'))) return null;\n if (path.dirname(dir) === dir) break;\n }\n return best.session;\n}\n\nfunction isPendingFor(delivered: Set<string>) {\n return (c: Comment) => c.status === 'published' && c.author === 'user' && !delivered.has(c.id);\n}\n\n/** Returns published user comments that haven't been delivered yet.\n * Reads through the file-store cache so we see in-flight writes\n * (`session-meta.ts` and other readers couldn't, when they re-read the\n * disk directly). */\n/**\n * The line typed into an idle Claude (or given as the first prompt of one\n * work starts) so its UserPromptSubmit hook attaches the pending comments.\n * Short on purpose: a long typed note got mangled by Claude Code's paste\n * handling. It says where the content is, so it reads right in the\n * transcript.\n */\nexport const NOTE_NUDGE =\n 'work has new notes for you (review feedback, CI results or comments); they are attached to this message. Work through them now.';\n\nexport function readPendingForSession(sessionId: string): Comment[] {\n const delivered = withDb((d) => deliveredIds(d, sessionId));\n return readStoreComments(sessionId).filter(isPendingFor(delivered));\n}\n\n/** Comment-store ids for every `wd` scope that could cover this worktree.\n * A scope is keyed by `sha1` of its sorted repo roots (see\n * `repo-spec.scopeHashFor`), so from a session's paths we can rebuild the\n * exact ids without consulting `work web`'s in-memory scope registry:\n * - the whole-set hash → a group `wd` opened at the group root, or the\n * single-repo `wd` (one path);\n * - each individual path's hash → a `wd` opened inside one sub-repo of a\n * group worktree.\n * `registerScope` hashes `path.resolve()`d roots, so we resolve here too or\n * the hashes won't line up. Mirrors `scope-manager.commentStoreIdForScope`\n * (`scope-<hash>`). */\nexport function scopeStoreIdsForPaths(paths: string[]): string[] {\n const resolved = paths.map((p) => path.resolve(p));\n const ids = new Set<string>();\n ids.add(`scope-${scopeHashFor(resolved)}`);\n for (const p of resolved) ids.add(`scope-${scopeHashFor([p])}`);\n return [...ids];\n}\n\n/**\n * Pending comments for a whole worktree: the session's own comment store\n * PLUS any `wd` / `wd -c` scope review store covering the same paths.\n *\n * `wd` registers its review under a scope-hash comment store, not the\n * session store the hook reads — without this merge, comments left in the\n * `wd` review UI would never reach the Claude running in that worktree.\n * Delivered-tracking stays per-session (one `<sessionId>.delivered.json`),\n * so a comment surfaced here won't be re-delivered regardless of which\n * store it came from.\n */\nexport function readPendingForWorktree(session: WorktreeSession, sessionId: string = sessionIdFor(session)): Comment[] {\n const delivered = withDb((d) => deliveredIds(d, sessionId));\n const pending = isPendingFor(delivered);\n const storeIds = [sessionId, ...scopeStoreIdsForPaths(session.paths)];\n const rows = readStoresComments(storeIds); // one query: this runs for every row of /api/sessions\n const seen = new Set<string>();\n const out: Comment[] = [];\n for (const storeId of storeIds) {\n for (const c of rows.get(storeId) ?? []) {\n if (seen.has(c.id) || !pending(c)) continue;\n seen.add(c.id);\n out.push(c);\n }\n }\n return out;\n}\n\n/**\n * What was handed to Claude is done once its turn really ends: your review\n * comments and work's notes to it (PR feedback, CI, a prompt you sent) —\n * every top-level comment of yours it was given, in the session's store and\n * any `wd` scope store over its paths — are marked resolved. Left open, they\n * piled up on the Diff tab's badge (three PR-watch notes read as \"3\"), to\n * resolve or delete by hand. Resolved threads stay listed (dimmed) and can\n * be reopened. Claude's own replies are left as they are. Returns the ids\n * resolved.\n */\nexport function resolveAddressed(session: WorktreeSession): string[] {\n const sessionId = sessionIdFor(session);\n const delivered = withDb((d) => deliveredIds(d, sessionId));\n if (delivered.size === 0) return [];\n const done: string[] = [];\n for (const storeId of [sessionId, ...scopeStoreIdsForPaths(session.paths)]) {\n const open = readStoreComments(storeId).filter(\n (c) => delivered.has(c.id) && c.author === 'user' && c.status === 'published' && !c.parentId && !c.resolved,\n );\n if (open.length === 0) continue;\n const store = getCommentFileStore(storeId);\n for (const c of open) if (store.setResolved(c.id, true)) done.push(c.id);\n }\n return done;\n}\n\n/** Persist a delivery batch, so these ids are never surfaced again. */\nexport function markDelivered(sessionId: string, ids: string[]): void {\n if (ids.length === 0) return;\n tx((d) => {\n const ins = d.prepare('INSERT OR IGNORE INTO comment_deliveries (session_id, comment_id) VALUES (?, ?)');\n for (const id of ids) ins.run(sessionId, id);\n });\n}\n\n/**\n * Claim comments for delivery: of `ids`, return the ones nobody has\n * delivered yet, and mark them delivered — atomically. Two deliverers\n * racing (a Stop hook and the PTY push for the same comment) then can't\n * both send it: only the one that claimed it does. A deliverer whose send\n * fails gives the ids back with `releaseClaim`.\n */\nexport function claimForDelivery(sessionId: string, ids: string[]): string[] {\n if (ids.length === 0) return [];\n // INSERT OR IGNORE in one write transaction: a row inserted here is our\n // claim; one that already existed was someone else's.\n return tx((d) => {\n const ins = d.prepare('INSERT OR IGNORE INTO comment_deliveries (session_id, comment_id) VALUES (?, ?)');\n return ids.filter((id) => ins.run(sessionId, id).changes > 0);\n });\n}\n\n/** Undo a claim whose delivery failed, so the next hook picks them up. */\nexport function releaseClaim(sessionId: string, ids: string[]): void {\n if (ids.length === 0) return;\n tx((d) => {\n const del = d.prepare('DELETE FROM comment_deliveries WHERE session_id = ? AND comment_id = ?');\n for (const id of ids) del.run(sessionId, id);\n });\n}\n\n/** Cap the size of one comment body we surface to Claude. A pathologically\n * long comment shouldn't blow out Claude's context — we truncate, then\n * hint at the rest via \"(truncated)\". 4 KB is generous for a code-review\n * note while leaving headroom for batches. */\nconst MAX_BODY_BYTES = 4 * 1024;\n/** A general note: a prompt, or work's own note (a PR review round quotes\n * every thread, then a bot's overview). 4 KB once cut such a note before\n * the line telling Claude how to draft its replies. */\nconst MAX_NOTE_BYTES = 16 * 1024;\n/** Overall cap on the whole system-reminder payload. Multiple long\n * comments at once still get bounded — but room for four whole notes, since\n * the cut falls on the newest one's end: its instructions. */\nconst MAX_TOTAL_BYTES = 4 * MAX_NOTE_BYTES;\n\n/**\n * Format pending comments as a system-reminder block suitable for stdout.\n * Returns empty string when there's nothing pending — the caller (the\n * `work hook` CLI) just exits silently in that case.\n *\n * Truncates pathologically long bodies and caps the overall payload so\n * one runaway comment can't displace the rest of Claude's context.\n */\nexport function formatPendingForPrompt(pending: Comment[]): string {\n if (pending.length === 0) return '';\n\n const sorted = [...pending].sort((a, b) => a.createdAt.localeCompare(b.createdAt));\n\n const general = sorted.filter((c) => c.side === 'general' && !c.parentId);\n const inline = sorted.filter((c) => c.side !== 'general' && !c.parentId);\n const replies = sorted.filter((c) => c.parentId);\n\n const lines: string[] = [];\n lines.push('<system-reminder>');\n lines.push(`New review comments from \\`work web\\` (${pending.length} item${pending.length === 1 ? '' : 's'}):`);\n lines.push('');\n\n if (general.length > 0) {\n lines.push('## General notes');\n for (const c of general) {\n // General notes (this is where `work broadcast` lands) may be multi-line\n // prompts — deliver the whole body, not just line 1. Only the byte cap\n // applies. Inline/reply comments still use the one-line `formatBody`.\n lines.push(formatFullBody('-', c));\n }\n lines.push('');\n }\n\n if (inline.length > 0) {\n lines.push('## Inline comments');\n for (const c of inline) {\n const where = `${c.repo}/${c.file}:${c.line} (${c.side})`;\n lines.push(formatBody(`- ${where}`, c));\n }\n lines.push('');\n }\n\n if (replies.length > 0) {\n lines.push('## Replies');\n for (const c of replies) {\n lines.push(formatBody(`- (reply to ${c.parentId})`, c));\n }\n lines.push('');\n }\n\n lines.push(\n 'Address them as part of your next response. You can reply via the same review UI by posting back to the latest review URL at `~/.work/web.url` + `/api/sessions/<id>/comments` with `author: \"claude\"`.',\n );\n lines.push('</system-reminder>');\n const out = lines.join('\\n');\n if (out.length <= MAX_TOTAL_BYTES) return out;\n const trimmed = out.slice(0, MAX_TOTAL_BYTES - 200);\n return (\n trimmed +\n '\\n\\n(…review payload truncated for context-window safety; ' +\n `${pending.length} comment(s) total — open work web for the full list.)\\n` +\n '</system-reminder>'\n );\n}\n\nfunction formatBody(prefix: string, c: Comment): string {\n const lead = c.body.split('\\n')[0].trim();\n const capped = lead.length > MAX_BODY_BYTES ? `${lead.slice(0, MAX_BODY_BYTES)}…` : lead;\n return `${prefix}: ${capped}${c.body.includes('\\n') ? ' …' : ''}`;\n}\n\n/** Like `formatBody` but preserves the full multi-line body (only the note\n * cap applies). Multi-line bodies are emitted under the bullet, indented, so\n * a broadcast prompt arrives intact rather than truncated to its first line. */\nfunction formatFullBody(prefix: string, c: Comment): string {\n const body = c.body.trim();\n const capped = body.length > MAX_NOTE_BYTES ? `${body.slice(0, MAX_NOTE_BYTES)}…` : body;\n const bodyLines = capped.split('\\n');\n if (bodyLines.length === 1) return `${prefix}: ${bodyLines[0]}`;\n const [first, ...rest] = bodyLines;\n return [`${prefix}: ${first}`, ...rest.map((l) => ` ${l}`)].join('\\n');\n}\n\n/** Re-export so consumers don't have to know which module owns it. */\nexport { sessionIdFor };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAkBA,OAAO,QAAQ;AACf,OAAO,UAAU;AAQjB,SAAS,aAAa,GAAO,WAAgC;AAC3D,SAAO,IAAI;AAAA,IACR,EAAE,QAAQ,gEAAgE,EAAE,IAAI,SAAS,EAAoC;AAAA,MAC5H,CAAC,MAAM,EAAE;AAAA,IACX;AAAA,EACF;AACF;AAGA,SAAS,UAAU,GAAmB;AACpC,SAAO,KAAK,QAAQ,CAAC,EAAE,QAAQ,OAAO,GAAG,EAAE,YAAY;AACzD;AAYA,SAAS,KAAK,WAA4B,SAA0B,MAAuB;AACzF,MAAI,CAAC,CAAC,UAAU,eAAe,CAAC,CAAC,QAAQ,WAAY,QAAO,CAAC,UAAU;AACvE,QAAM,WAAW,iBAAiB,IAAI;AACtC,QAAM,IAAI,UAAU,WAAW;AAC/B,QAAM,IAAI,QAAQ,WAAW;AAC7B,MAAI,MAAM,EAAG,QAAO;AACpB,UAAQ,KAAK,MAAM,UAAU,cAAc,KAAK,MAAM,KAAK,MAAM,QAAQ,cAAc,KAAK;AAC9F;AAEO,SAAS,kBAAkB,KAAa,WAA8B,YAAY,GAA2B;AAClH,QAAM,OAAO,UAAU,GAAG;AAI1B,MAAI,OAAuE;AAC3E,aAAW,KAAK,UAAU;AACxB,UAAM,QAAQ,EAAE,WAAW,EAAE,MAAM,CAAC,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AAI;AACzB,SAAO,CAAC,GAAG,MAAM,KAAK,KAAK,IAAI,GAAG,KAAK,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC,EAAE,KAAK,IAAI;AACxE;","names":[]}
|
|
@@ -1,22 +1,26 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
|
+
isEmptyBaseSpec,
|
|
3
4
|
openBaseCheckout,
|
|
4
5
|
setupWorktree
|
|
5
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-TMAQASMH.js";
|
|
6
7
|
import {
|
|
7
8
|
defaultRunner
|
|
8
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-MKQ7IA6U.js";
|
|
9
10
|
import {
|
|
10
11
|
findSession,
|
|
11
12
|
loadHistory,
|
|
12
13
|
sessionAliases
|
|
13
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-NOB3VR5I.js";
|
|
15
|
+
import {
|
|
16
|
+
ownsBranch
|
|
17
|
+
} from "./chunk-DTFACBDD.js";
|
|
14
18
|
import {
|
|
15
19
|
resolveProjectTarget
|
|
16
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-7UXV4X2Y.js";
|
|
17
21
|
import {
|
|
18
22
|
spawn_default
|
|
19
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-DW245WK4.js";
|
|
20
24
|
import {
|
|
21
25
|
collectingReporter,
|
|
22
26
|
withReporter
|
|
@@ -169,7 +173,7 @@ async function pruneWorktrees(target, branch, config, repos) {
|
|
|
169
173
|
var createInProcess = async (req, config) => {
|
|
170
174
|
const invalid = invalidRequest(req);
|
|
171
175
|
if (invalid) return { ok: false, error: invalid };
|
|
172
|
-
if (!req.branch) {
|
|
176
|
+
if (!req.branch || (!req.base || isEmptyBaseSpec(req.base)) && ownsBranch(req.target, req.branch, config)) {
|
|
173
177
|
const opened = await openBaseCheckout(req.target, config, { jiraKey: req.jiraKey, name: req.name, account: req.account });
|
|
174
178
|
return opened.ok ? { ok: true, branch: opened.branch, launchDir: opened.repoPath, paths: [opened.repoPath] } : { ok: false, error: opened.error };
|
|
175
179
|
}
|
|
@@ -200,4 +204,4 @@ export {
|
|
|
200
204
|
createInChild,
|
|
201
205
|
createInProcess
|
|
202
206
|
};
|
|
203
|
-
//# sourceMappingURL=chunk-
|
|
207
|
+
//# sourceMappingURL=chunk-RPWEOEA3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/core/worktree/setup-child.ts"],"sourcesContent":["import path from 'node:path';\nimport crossSpawn from '../platform/spawn.js';\nimport type { BaseSpec } from '../git/base-spec.js';\nimport type { WorkConfig } from '../platform/config.js';\nimport { findSession, loadHistory } from '../sessions/history.js';\nimport { openBaseCheckout, setupWorktree } from './worktree.js';\nimport { ownsBranch } from './own-checkout.js';\nimport { isEmptyBaseSpec } from '../git/base-spec.js';\nimport { collectingReporter, withReporter } from '../platform/report.js';\nimport { resolveProjectTarget } from './resolve.js';\nimport { defaultRunner } from '../pr/ship.js';\nimport { sessionAliases } from '../sessions/session-repos.js';\n\n/**\n * Creating a worktree runs git synchronously (fetch, pull, worktree add):\n * done inside work web, that held up every request — the dashboard, the\n * terminals' relays, the status hooks — for as long as the network took.\n * So work web runs it as `work tree … --setup-only` in a child process and\n * reads the result back from the history it wrote. The CLI and tests use\n * the in-process `createInProcess`; both answer the same way.\n */\n\nexport interface CreateRequest {\n target: string;\n /** Empty: the repo's own checkout, on the branch it has (`work tree <repo>`). */\n branch?: string;\n base?: BaseSpec;\n jiraKey?: string;\n name?: string;\n /** A new session's repos instead of its group's config (a fork of a session folder: the parent's own). */\n repos?: string[];\n /** The Claude account a new session runs on; unset: the configured default. */\n account?: string;\n}\n\nexport type CreateResult =\n { ok: true; branch: string; launchDir: string; paths: string[]; warnings?: string[] } | { ok: false; error: string };\n\n/** The line `work tree --setup-only` ends with on success: what it warned about (the parent reads only this). */\nexport const SETUP_WARNINGS = 'work-setup-warnings ';\n\n/** The warnings a `--setup-only` child printed (its last such line); none when there is none. Pure. */\nexport function setupWarningsOf(stdout: string): string[] {\n const line = stdout\n .split(/\\r?\\n/)\n .reverse()\n .find((l) => l.startsWith(SETUP_WARNINGS));\n if (!line) return [];\n try {\n const v: unknown = JSON.parse(line.slice(SETUP_WARNINGS.length));\n return Array.isArray(v) ? v.filter((x): x is string => typeof x === 'string') : [];\n } catch {\n return [];\n }\n}\nexport type CreateWorktree = (req: CreateRequest, config: WorkConfig) => Promise<CreateResult>;\n\n/**\n * A request the child's command line could misread: a project or branch\n * starting with `-` would be taken for a flag (`--fresh` as a branch opened\n * the base checkout instead). Git refuses such branch names anyway. Pure.\n */\nexport function invalidRequest(req: CreateRequest): string | null {\n if (req.target.startsWith('-')) return `not a project: ${req.target}`;\n if (req.branch?.startsWith('-')) return `${req.branch} is not a valid branch name (it can't start with \"-\")`;\n for (const [alias, b] of Object.entries(req.base?.perRepo ?? {}))\n if (alias.startsWith('-') || b.startsWith('-')) return `not a valid base: ${alias}=${b}`;\n if (req.base?.default?.startsWith('-')) return `not a valid base: ${req.base.default}`;\n if (req.account?.startsWith('-')) return `not a Claude account: ${req.account}`;\n for (const alias of req.repos ?? []) if (!alias || alias.startsWith('-') || alias.includes(',')) return `not a repo: ${alias}`;\n return null;\n}\n\n/** `--base` flags for a base spec (`--base=dev`, `--base=backend=dev`). Pure. */\nexport function baseArgs(spec: BaseSpec | undefined): string[] {\n if (!spec) return [];\n const out: string[] = [];\n if (spec.default) out.push(`--base=${spec.default}`);\n for (const [alias, b] of Object.entries(spec.perRepo)) out.push(`--base=${alias}=${b}`);\n return out;\n}\n\n/**\n * The argv of the child `work tree` run (after node and the bin). Values go\n * as `--flag=value`: a name like `--fresh` given as `--name --fresh` would\n * be read as a flag of its own (and the name lost). Pure.\n */\nexport function childArgs(req: CreateRequest): string[] {\n return [\n 'tree',\n req.target,\n ...(req.branch ? [req.branch] : []),\n '--setup-only',\n ...baseArgs(req.base),\n ...(req.jiraKey ? [`--jira-key=${req.jiraKey}`] : []),\n ...(req.name?.trim() ? [`--name=${req.name.trim()}`] : []),\n ...(req.repos?.length ? [`--repos=${req.repos.join(',')}`] : []),\n ...(req.account ? [`--account=${req.account}`] : []),\n ];\n}\n\n/**\n * One creation at a time per project: they fetch, pull and add worktrees in\n * the same repos (git's own locks would turn two at once into a failure),\n * and a double-clicked create of the same branch gets the first one's answer.\n */\nexport function oneAtATime(create: CreateWorktree, queue: KeyedQueue = keyedQueue()): CreateWorktree {\n const same = new Map<string, Promise<CreateResult>>();\n return (req, config) => {\n const key = `${req.target}\\0${req.branch ?? ''}`;\n const running = same.get(key);\n if (running) return running;\n const job = queue(req.target, () => create(req, config));\n same.set(key, job);\n void job\n .catch(() => undefined)\n .then(() => {\n if (same.get(key) === job) same.delete(key);\n });\n return job;\n };\n}\n\n/** Runs jobs one after another per key (a project, or a repo), any number of keys at once. */\nexport type KeyedQueue = <T>(key: string, job: () => Promise<T>) => Promise<T>;\n\nexport function keyedQueue(): KeyedQueue {\n const queues = new Map<string, Promise<unknown>>();\n return <T>(key: string, job: () => Promise<T>): Promise<T> => {\n const before = queues.get(key) ?? Promise.resolve();\n const run = before.then(job);\n const tail = run.catch(() => undefined);\n queues.set(key, tail);\n void tail.then(() => {\n if (queues.get(key) === tail) queues.delete(key);\n });\n return run;\n };\n}\n\n/** What a child `work` run gave back. */\nexport interface ChildRun {\n stdout: string;\n stderr: string;\n code: number | null;\n /** Killed after its time ran out. */\n timedOut: boolean;\n /** It couldn't be started at all. */\n spawnError?: string;\n}\n\n/**\n * Run `node <work> <args…>` in a child process (no window, no colours),\n * killed after `timeoutMs` (5 min). This process's node flags go with it:\n * under tsx (dev) they are what loads a .ts entry (but not a debugger's,\n * whose port is taken).\n */\nexport function runWorkChild(\n workBin: string,\n args: string[],\n opts: { node?: string; execArgv?: string[]; timeoutMs?: number } = {},\n): Promise<ChildRun> {\n return new Promise((resolve) => {\n const child = crossSpawn(\n opts.node ?? process.execPath,\n [...(opts.execArgv ?? process.execArgv).filter((f) => !/^--inspect/.test(f)), workBin, ...args],\n { windowsHide: true, env: { ...process.env, NO_COLOR: '1', FORCE_COLOR: '0' } },\n );\n let stdout = '';\n let stderr = '';\n child.stdout?.on('data', (d: Buffer) => (stdout += d.toString()));\n child.stderr?.on('data', (d: Buffer) => (stderr += d.toString()));\n let timedOut = false;\n const timer = setTimeout(\n () => {\n timedOut = true;\n child.kill();\n },\n opts.timeoutMs ?? 5 * 60_000,\n );\n let settled = false;\n const done = (r: ChildRun) => {\n if (settled) return;\n settled = true;\n clearTimeout(timer);\n resolve(r);\n };\n child.on('error', (err) => done({ stdout, stderr, code: null, timedOut, spawnError: err.message }));\n child.on('close', (code) => done({ stdout, stderr, code, timedOut }));\n });\n}\n\n/** What a child printed, in one line, its colours stripped. Pure. */\nexport function childText(text: string): string {\n return text\n .replace(ANSI, '')\n .split(/\\r?\\n/)\n .map((l) => l.trim())\n .filter(Boolean)\n .join(' ');\n}\n\nconst ANSI = /\\x1b\\[[0-9;]*m/g;\n\nconst norm = (p: string) => path.resolve(p).replace(/\\\\/g, '/').toLowerCase();\n\n/** What the run left in the history: the session it created or opened. */\nfunction resultFromHistory(req: CreateRequest, config: WorkConfig): CreateResult {\n const history = loadHistory();\n if (req.branch) {\n const s = findSession(history, req.target, req.branch);\n if (!s) return { ok: false, error: 'the worktree was set up, but its session is not in the history' };\n return { ok: true, branch: s.branch, launchDir: s.isGroup && s.paths[0] ? path.dirname(s.paths[0]) : s.paths[0], paths: s.paths };\n }\n const repo = config.repos[req.target];\n const s = repo\n ? history\n .filter((x) => !x.archivedAt && x.target === req.target && x.paths.some((p) => norm(p) === norm(repo)))\n .sort((a, b) => b.lastAccessedAt.localeCompare(a.lastAccessedAt))[0]\n : undefined;\n if (!s) return { ok: false, error: `opened ${req.target}, but its session is not in the history` };\n return { ok: true, branch: s.branch, launchDir: repo, paths: [repo] };\n}\n\n/** Out of process (work web): `node <work> tree … --setup-only`, then the history. */\nexport function createInChild(workBin: string, opts: { node?: string; execArgv?: string[]; timeoutMs?: number } = {}): CreateWorktree {\n return async (req, config) => {\n const invalid = invalidRequest(req);\n if (invalid) return { ok: false, error: invalid };\n const r = await runWorkChild(workBin, childArgs(req), opts);\n if (r.spawnError) return { ok: false, error: `could not run work: ${r.spawnError}` };\n if (r.timedOut) {\n // Killed from outside, its own rollback never ran: drop what a\n // half-made `git worktree add` registered, so a retry can make it.\n await pruneWorktrees(req.target, req.branch, config, req.repos);\n return { ok: false, error: 'setting it up took too long (stopped; run it again, or `work tree` it from a terminal to see why)' };\n }\n if (r.code === 0) {\n const made = resultFromHistory(req, config);\n const warnings = setupWarningsOf(r.stdout);\n return made.ok && warnings.length ? { ...made, warnings } : made;\n }\n // Its errors, as the CLI printed them (the reporter sends errors to stderr).\n const why = childText(r.stderr || r.stdout);\n return { ok: false, error: why || (r.code === null ? 'setting it up took too long' : `work tree exited ${r.code}`) };\n };\n}\n\n/**\n * `git worktree prune` in each repo of the session (best effort): its own\n * repos when it has a row (sessionAliases: one added to it, or a fork's list),\n * else the project's.\n */\nexport async function pruneWorktrees(\n target: string,\n branch: string | undefined,\n config: WorkConfig,\n /** The repos the run was asked for (a fork of a session folder: its own), when it has no row yet. */\n repos?: string[],\n): Promise<void> {\n const known = branch ? findSession(loadHistory(), target, branch) : undefined;\n const aliases = known ? sessionAliases(known, config) : repos?.length ? repos : (resolveProjectTarget(target, config)?.repoAliases ?? []);\n for (const alias of aliases) {\n const repo = config.repos[alias];\n if (repo) await defaultRunner('git', ['-C', repo, 'worktree', 'prune'], repo).catch(() => undefined);\n }\n}\n\n/** In process (the CLI, tests): the same core calls `work tree` makes. */\nexport const createInProcess: CreateWorktree = async (req, config) => {\n const invalid = invalidRequest(req);\n if (invalid) return { ok: false, error: invalid };\n // No branch, or the one the repo's own folder is on (it can't be checked out twice): that folder.\n if (!req.branch || ((!req.base || isEmptyBaseSpec(req.base)) && ownsBranch(req.target, req.branch, config))) {\n const opened = await openBaseCheckout(req.target, config, { jiraKey: req.jiraKey, name: req.name, account: req.account });\n return opened.ok\n ? { ok: true, branch: opened.branch, launchDir: opened.repoPath, paths: [opened.repoPath] }\n : { ok: false, error: opened.error };\n }\n // Keep what core reports, so a failure says why.\n const reports = collectingReporter();\n const created = await withReporter(reports, () =>\n setupWorktree(req.target, req.branch!, config, req.base, req.jiraKey, {\n name: req.name,\n ...(req.account ? { account: req.account } : {}),\n ...(req.repos?.length ? { repos: req.repos } : {}),\n }),\n );\n const warnings = reports.entries.filter((e) => e.level === 'warn' && e.text.trim()).map((e) => e.text.trim());\n if (!created)\n return {\n ok: false,\n error:\n reports\n .errors()\n .map((e) => e.trim())\n .join(' ') || 'setup failed (target not found?)',\n };\n return { ok: true, branch: req.branch, launchDir: created.launchDir, paths: created.paths, ...(warnings.length ? { warnings } : {}) };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,UAAU;AAuCV,IAAM,iBAAiB;AAGvB,SAAS,gBAAgB,QAA0B;AACxD,QAAM,OAAO,OACV,MAAM,OAAO,EACb,QAAQ,EACR,KAAK,CAAC,MAAM,EAAE,WAAW,cAAc,CAAC;AAC3C,MAAI,CAAC,KAAM,QAAO,CAAC;AACnB,MAAI;AACF,UAAM,IAAa,KAAK,MAAM,KAAK,MAAM,eAAe,MAAM,CAAC;AAC/D,WAAO,MAAM,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,MAAmB,OAAO,MAAM,QAAQ,IAAI,CAAC;AAAA,EACnF,QAAQ;AACN,WAAO,CAAC;AAAA,EACV;AACF;AAQO,SAAS,eAAe,KAAmC;AAChE,MAAI,IAAI,OAAO,WAAW,GAAG,EAAG,QAAO,kBAAkB,IAAI,MAAM;AACnE,MAAI,IAAI,QAAQ,WAAW,GAAG,EAAG,QAAO,GAAG,IAAI,MAAM;AACrD,aAAW,CAAC,OAAO,CAAC,KAAK,OAAO,QAAQ,IAAI,MAAM,WAAW,CAAC,CAAC;AAC7D,QAAI,MAAM,WAAW,GAAG,KAAK,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AAE,OAAO,IAAI,MAAM,IAAI,CAAC;AAAA,IAClD,CAAC;AAAA,EACH;AACA,QAAM,WAAW,QAAQ,QAAQ,OAAO,CAAC,MAAM,EAAE,UAAU,UAAU,EAAE,KAAK,KAAK,CAAC,EAAE,IAAI,CAAC,MAAM,EAAE,KAAK,KAAK,CAAC;AAC5G,MAAI,CAAC;AACH,WAAO;AAAA,MACL,IAAI;AAAA,MACJ,OACE,QACG,OAAO,EACP,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,EACnB,KAAK,GAAG,KAAK;AAAA,IACpB;AACF,SAAO,EAAE,IAAI,MAAM,QAAQ,IAAI,QAAQ,WAAW,QAAQ,WAAW,OAAO,QAAQ,OAAO,GAAI,SAAS,SAAS,EAAE,SAAS,IAAI,CAAC,EAAG;AACtI;","names":["s"]}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
owedToYou,
|
|
4
4
|
stageWaiting
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-NOB3VR5I.js";
|
|
6
6
|
|
|
7
7
|
// src/core/sessions/session-view.ts
|
|
8
8
|
var RECENT_MS = 24 * 36e5;
|
|
@@ -76,4 +76,4 @@ export {
|
|
|
76
76
|
OWED_LONG,
|
|
77
77
|
waitingOnOthers
|
|
78
78
|
};
|
|
79
|
-
//# sourceMappingURL=chunk-
|
|
79
|
+
//# sourceMappingURL=chunk-RSCRZGUW.js.map
|
|
@@ -4,11 +4,11 @@ import {
|
|
|
4
4
|
} from "./chunk-AH5TM3NB.js";
|
|
5
5
|
import {
|
|
6
6
|
spawnSpecFor
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-ZQJKAZRD.js";
|
|
8
8
|
import {
|
|
9
9
|
PtyHostClient,
|
|
10
10
|
ensureHost
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-7FNJ6A2U.js";
|
|
12
12
|
import {
|
|
13
13
|
sessionIdFor
|
|
14
14
|
} from "./chunk-RUYTU2WJ.js";
|
|
@@ -116,4 +116,4 @@ async function attachSession(session, launch = {}) {
|
|
|
116
116
|
export {
|
|
117
117
|
attachSession
|
|
118
118
|
};
|
|
119
|
-
//# sourceMappingURL=chunk-
|
|
119
|
+
//# sourceMappingURL=chunk-S36RENUJ.js.map
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
import {
|
|
6
6
|
DISPLAY_LABEL,
|
|
7
7
|
displayStatus
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-RSCRZGUW.js";
|
|
9
9
|
import {
|
|
10
10
|
atomicWriteFile
|
|
11
11
|
} from "./chunk-D2J3AD6L.js";
|
|
@@ -164,4 +164,4 @@ export {
|
|
|
164
164
|
assistantContextReview,
|
|
165
165
|
readAssistantContext
|
|
166
166
|
};
|
|
167
|
-
//# sourceMappingURL=chunk-
|
|
167
|
+
//# sourceMappingURL=chunk-SPVVXKDV.js.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
childText,
|
|
4
|
+
runWorkChild
|
|
5
|
+
} from "./chunk-RPWEOEA3.js";
|
|
6
|
+
import {
|
|
7
|
+
report
|
|
8
|
+
} from "./chunk-AU27USPZ.js";
|
|
9
|
+
|
|
10
|
+
// src/core/worktree/remove-child.ts
|
|
11
|
+
var WORKTREE_REMOVED = "work-worktree-removed ";
|
|
12
|
+
function removedOf(stdout) {
|
|
13
|
+
const line = stdout.split(/\r?\n/).reverse().find((l) => l.startsWith(WORKTREE_REMOVED));
|
|
14
|
+
if (!line) return null;
|
|
15
|
+
const v = line.slice(WORKTREE_REMOVED.length).trim();
|
|
16
|
+
return v === "true" ? true : v === "false" ? false : null;
|
|
17
|
+
}
|
|
18
|
+
function removeChildArgs(s) {
|
|
19
|
+
return ["remove", "--worktree-only", "--", s.target, s.branch];
|
|
20
|
+
}
|
|
21
|
+
function removeWorktreeInChild(workBin, opts = {}) {
|
|
22
|
+
return async (s) => {
|
|
23
|
+
const run = opts.run ?? ((bin, args) => runWorkChild(bin, args, opts));
|
|
24
|
+
const r = await run(workBin(), removeChildArgs(s));
|
|
25
|
+
const removed = removedOf(r.stdout);
|
|
26
|
+
if (removed !== null) return removed;
|
|
27
|
+
const why = r.spawnError ?? (r.timedOut ? "it took too long and was stopped" : childText(r.stderr || r.stdout) || `it ended with code ${r.code}`);
|
|
28
|
+
report("warn", `Couldn't remove the worktree of ${s.target} ${s.branch}: ${why}`);
|
|
29
|
+
return false;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export {
|
|
34
|
+
WORKTREE_REMOVED,
|
|
35
|
+
removeWorktreeInChild
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=chunk-SQACJQUY.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/core/worktree/remove-child.ts"],"sourcesContent":["import type { WorktreeSession } from '../sessions/session-types.js';\nimport { report } from '../platform/report.js';\nimport { childText, runWorkChild, type ChildRun } from './setup-child.js';\n\n/**\n * Removing a worktree runs git synchronously (`git worktree remove` deletes every file, and waits on any the antivirus\n * or an editor holds): done inside work web on Archive, it held up every request — the terminals' tickets, the status\n * hooks — for as long as the delete took (reported: 24 s, the PTY host read as not answering). So work web runs it as\n * `work remove … --worktree-only` in a child process, as it does creation (setup-child.ts). The CLI removes in\n * process, as before.\n */\n\n/** The line `work remove --worktree-only` ends with: whether every folder went (the parent reads only this). */\nexport const WORKTREE_REMOVED = 'work-worktree-removed ';\n\n/** What the child said of the removal; null when it never got to say (it crashed, or was killed). Pure. */\nexport function removedOf(stdout: string): boolean | null {\n const line = stdout\n .split(/\\r?\\n/)\n .reverse()\n .find((l) => l.startsWith(WORKTREE_REMOVED));\n if (!line) return null;\n const v = line.slice(WORKTREE_REMOVED.length).trim();\n return v === 'true' ? true : v === 'false' ? false : null;\n}\n\n/** The child's command line: the session's folders are found from its row, never passed. `--` keeps a name from reading as a flag. */\nexport function removeChildArgs(s: Pick<WorktreeSession, 'target' | 'branch'>): string[] {\n return ['remove', '--worktree-only', '--', s.target, s.branch];\n}\n\nexport type RemoveWorktree = (s: WorktreeSession) => Promise<boolean>;\n\n/**\n * Remove a session's worktree in a child process: true when every folder went, false when one stayed (in use,\n * unreadable) — as `teardownWorktree` answers. A child that never answered (crashed, timed out) counts as not removed,\n * reported with what it printed: the archive then keeps the worktree.\n */\nexport function removeWorktreeInChild(\n workBin: () => string,\n opts: { timeoutMs?: number; execArgv?: string[]; run?: (bin: string, args: string[]) => Promise<ChildRun> } = {},\n): RemoveWorktree {\n return async (s) => {\n const run = opts.run ?? ((bin, args) => runWorkChild(bin, args, opts));\n const r = await run(workBin(), removeChildArgs(s));\n const removed = removedOf(r.stdout);\n if (removed !== null) return removed;\n const why =\n r.spawnError ?? (r.timedOut ? 'it took too long and was stopped' : childText(r.stderr || r.stdout) || `it ended with code ${r.code}`);\n // Not removed, as far as anyone can tell: the archive keeps the worktree, and this says why.\n report('warn', `Couldn't remove the worktree of ${s.target} ${s.branch}: ${why}`);\n return false;\n };\n}\n"],"mappings":";;;;;;;;;;AAaO,IAAM,mBAAmB;AAGzB,SAAS,UAAU,QAAgC;AACxD,QAAM,OAAO,OACV,MAAM,OAAO,EACb,QAAQ,EACR,KAAK,CAAC,MAAM,EAAE,WAAW,gBAAgB,CAAC;AAC7C,MAAI,CAAC,KAAM,QAAO;AAClB,QAAM,IAAI,KAAK,MAAM,iBAAiB,MAAM,EAAE,KAAK;AACnD,SAAO,MAAM,SAAS,OAAO,MAAM,UAAU,QAAQ;AACvD;AAGO,SAAS,gBAAgB,GAAyD;AACvF,SAAO,CAAC,UAAU,mBAAmB,MAAM,EAAE,QAAQ,EAAE,MAAM;AAC/D;AASO,SAAS,sBACd,SACA,OAA8G,CAAC,GAC/F;AAChB,SAAO,OAAO,MAAM;AAClB,UAAM,MAAM,KAAK,QAAQ,CAAC,KAAK,SAAS,aAAa,KAAK,MAAM,IAAI;AACpE,UAAM,IAAI,MAAM,IAAI,QAAQ,GAAG,gBAAgB,CAAC,CAAC;AACjD,UAAM,UAAU,UAAU,EAAE,MAAM;AAClC,QAAI,YAAY,KAAM,QAAO;AAC7B,UAAM,MACJ,EAAE,eAAe,EAAE,WAAW,qCAAqC,UAAU,EAAE,UAAU,EAAE,MAAM,KAAK,sBAAsB,EAAE,IAAI;AAEpI,WAAO,QAAQ,mCAAmC,EAAE,MAAM,IAAI,EAAE,MAAM,KAAK,GAAG,EAAE;AAChF,WAAO;AAAA,EACT;AACF;","names":[]}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
runInternal
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-B2K2I2PQ.js";
|
|
5
5
|
import {
|
|
6
6
|
messageOf,
|
|
7
7
|
readStatus
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-NOB3VR5I.js";
|
|
9
9
|
import {
|
|
10
10
|
sessionIdFor
|
|
11
11
|
} from "./chunk-RUYTU2WJ.js";
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
agentOf,
|
|
14
14
|
lineTimeOf,
|
|
15
15
|
readJsonlSince
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-DTFACBDD.js";
|
|
17
17
|
|
|
18
18
|
// src/core/conversations/catch-up-deps.ts
|
|
19
19
|
var askCatchUp = (prompt) => runInternal(prompt, 9e4);
|
|
@@ -100,4 +100,4 @@ export {
|
|
|
100
100
|
cachedCatchUp,
|
|
101
101
|
catchUp
|
|
102
102
|
};
|
|
103
|
-
//# sourceMappingURL=chunk-
|
|
103
|
+
//# sourceMappingURL=chunk-TFNDOWYP.js.map
|
|
@@ -2,29 +2,29 @@
|
|
|
2
2
|
import {
|
|
3
3
|
branchFacts,
|
|
4
4
|
repoBase
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-EJSGPLXO.js";
|
|
6
6
|
import {
|
|
7
7
|
hostForRepo
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-JVRS73M6.js";
|
|
9
9
|
import {
|
|
10
10
|
BRANCH_WATCH_MS,
|
|
11
11
|
otherBranchesToWatch,
|
|
12
12
|
readSessionBranches,
|
|
13
13
|
wasPushed
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-64M7W2OQ.js";
|
|
15
15
|
import {
|
|
16
16
|
defaultRunner
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-MKQ7IA6U.js";
|
|
18
18
|
import {
|
|
19
19
|
DEFAULT_HOST,
|
|
20
20
|
sessionRepos
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-NOB3VR5I.js";
|
|
22
22
|
import {
|
|
23
23
|
sessionIdFor
|
|
24
24
|
} from "./chunk-RUYTU2WJ.js";
|
|
25
25
|
import {
|
|
26
26
|
loadConfig
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-INI6TEYT.js";
|
|
28
28
|
|
|
29
29
|
// src/core/pr/ship.ts
|
|
30
30
|
import path from "path";
|
|
@@ -412,4 +412,4 @@ export {
|
|
|
412
412
|
runShipAction,
|
|
413
413
|
mergeSelected
|
|
414
414
|
};
|
|
415
|
-
//# sourceMappingURL=chunk-
|
|
415
|
+
//# sourceMappingURL=chunk-TL7K3XUY.js.map
|