@moberg_hr/work-tree 2.17.2 → 2.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{account-H2PGGR3Q.js → account-TT5TOV7Y.js} +25 -22
- package/dist/{account-H2PGGR3Q.js.map → account-TT5TOV7Y.js.map} +1 -1
- package/dist/{add-repo-6OLFENCR.js → add-repo-LM5M2TW4.js} +20 -17
- package/dist/{add-repo-6OLFENCR.js.map → add-repo-LM5M2TW4.js.map} +1 -1
- package/dist/{answer-AAWIGGVF.js → answer-Q47UH37K.js} +12 -9
- package/dist/{answer-AAWIGGVF.js.map → answer-Q47UH37K.js.map} +1 -1
- package/dist/{attach-3CLKNIHR.js → attach-JMA4XCEB.js} +20 -17
- package/dist/{attach-3CLKNIHR.js.map → attach-JMA4XCEB.js.map} +1 -1
- package/dist/bin.js +3 -3
- package/dist/{block-CCHW2U25.js → block-TTMTQ5WO.js} +13 -10
- package/dist/{block-CCHW2U25.js.map → block-TTMTQ5WO.js.map} +1 -1
- package/dist/{broadcast-RWGJLRU7.js → broadcast-MQL3PHVK.js} +9 -6
- package/dist/{broadcast-RWGJLRU7.js.map → broadcast-MQL3PHVK.js.map} +1 -1
- package/dist/{catchup-CWPIE6X3.js → catchup-DKD3BGTG.js} +14 -11
- package/dist/{catchup-CWPIE6X3.js.map → catchup-DKD3BGTG.js.map} +1 -1
- package/dist/{chunk-6FD52UQ6.js → chunk-3OUUWNK2.js} +6 -6
- package/dist/{chunk-UKEI5DJS.js → chunk-4J2F6OWM.js} +2 -2
- package/dist/{chunk-2I3HHZMS.js → chunk-5JRO64D4.js} +2 -2
- package/dist/{chunk-DAVDKNRH.js → chunk-63RNLC25.js} +2 -2
- package/dist/{chunk-V2TTONXR.js → chunk-7PKIZVR7.js} +5 -5
- package/dist/{chunk-3E3WHGSI.js → chunk-AQKPXFC2.js} +3 -3
- package/dist/{chunk-RYFHY3JQ.js → chunk-ARQSFOYE.js} +3 -3
- package/dist/chunk-BR6OWWAA.js +64 -0
- package/dist/chunk-BR6OWWAA.js.map +1 -0
- package/dist/{chunk-GUHRMQNP.js → chunk-C2BFHQHX.js} +4 -4
- package/dist/{chunk-XT2ZKXMT.js → chunk-CZWZMRQ3.js} +17 -5
- package/dist/chunk-CZWZMRQ3.js.map +1 -0
- package/dist/{chunk-VS6DDWIX.js → chunk-D77U5ELL.js} +2 -2
- package/dist/{chunk-A5OQHOEV.js → chunk-DA2KILWV.js} +2 -2
- package/dist/{chunk-63HMFHNG.js → chunk-DLV7TRON.js} +2 -2
- package/dist/{chunk-ZFFWFVER.js → chunk-E25DJVBD.js} +2 -2
- package/dist/{chunk-Q6RMN7PX.js → chunk-EP7LCLHB.js} +5 -5
- package/dist/{chunk-E2PKPMWC.js → chunk-ESEIPUMT.js} +2 -2
- package/dist/{chunk-ZWFNIN6O.js → chunk-FAGTMW6W.js} +2 -2
- package/dist/{chunk-D4V5W6IC.js → chunk-FJADRDML.js} +4 -4
- package/dist/{chunk-IWMODEU4.js → chunk-GR4LV3ZS.js} +4 -4
- package/dist/{chunk-REPFZIPP.js → chunk-HGB7BITW.js} +16 -70
- package/dist/chunk-HGB7BITW.js.map +1 -0
- package/dist/{chunk-4GUB7MQG.js → chunk-HREHEBL2.js} +9 -9
- package/dist/{chunk-RFNMR7M4.js → chunk-IALCEDTH.js} +13 -13
- package/dist/{chunk-DOOT25BN.js → chunk-JEH4X76F.js} +2 -2
- package/dist/{chunk-JTQBQEL4.js → chunk-JIK4FY3E.js} +3 -3
- package/dist/{chunk-SNQVTLBX.js → chunk-JPXEX3XW.js} +2 -2
- package/dist/{chunk-DOYJR2HF.js → chunk-JUGF3YE7.js} +5 -4
- package/dist/chunk-JUGF3YE7.js.map +1 -0
- package/dist/chunk-KGHWHAVF.js +24 -0
- package/dist/chunk-KGHWHAVF.js.map +1 -0
- package/dist/{chunk-T3HVNKHI.js → chunk-KQ7QLBY2.js} +3 -3
- package/dist/{chunk-WC23KWN4.js → chunk-KX6KZYU4.js} +3 -3
- package/dist/{chunk-UVZITL47.js → chunk-LK7HJGUC.js} +1 -1
- package/dist/chunk-LK7HJGUC.js.map +1 -0
- package/dist/{chunk-LHUSNLSJ.js → chunk-LVNRPAQK.js} +9 -9
- package/dist/{chunk-YJVBX3HU.js → chunk-NBLF2SNP.js} +4 -4
- package/dist/{chunk-YXDWREKR.js → chunk-NGB2K7HX.js} +2 -2
- package/dist/{chunk-OHMLCXRW.js → chunk-O22DNTKU.js} +21 -26
- package/dist/chunk-O22DNTKU.js.map +1 -0
- package/dist/{chunk-33SBTWZW.js → chunk-OEQASHE3.js} +54 -54
- package/dist/{chunk-INQVYKB4.js → chunk-PLTFWTIE.js} +3 -3
- package/dist/{chunk-CHSKQHYY.js → chunk-QEZGXU5Q.js} +5 -5
- package/dist/{chunk-3A3HSUBD.js → chunk-QHFUCX2J.js} +2 -2
- package/dist/{chunk-NKKISMHV.js → chunk-RNEN6NUX.js} +3 -3
- package/dist/{chunk-WK5ZIO6B.js → chunk-SFFAPGA5.js} +2 -2
- package/dist/{chunk-6T5JRU75.js → chunk-T3KZSJHU.js} +5 -5
- package/dist/{chunk-ZED6QQJ5.js → chunk-TI2CNJLD.js} +4 -4
- package/dist/{chunk-FDTBJW7M.js → chunk-U4INTLIY.js} +5 -5
- package/dist/chunk-UKPZXS5B.js +9 -0
- package/dist/{chunk-2AENPORN.js → chunk-V6KHER6C.js} +5 -5
- package/dist/{chunk-TMRRQ6TT.js → chunk-VEERK6HO.js} +2 -2
- package/dist/{chunk-UM4R6YIC.js → chunk-VFRJO737.js} +8 -8
- package/dist/{chunk-3HWQYW6S.js → chunk-VFZI4SAH.js} +2 -2
- package/dist/{chunk-4TTIEI7I.js → chunk-VRMALBZK.js} +2 -2
- package/dist/{chunk-JHCR7H4Y.js → chunk-WIYDT3PY.js} +5 -29
- package/dist/chunk-WIYDT3PY.js.map +1 -0
- package/dist/{chunk-QAY2Q2JC.js → chunk-WVZG5Q4L.js} +2 -2
- package/dist/{chunk-DZACN5FM.js → chunk-XFWO5FYK.js} +3 -3
- package/dist/{chunk-RF6DCSJM.js → chunk-XPX5AAYH.js} +3 -3
- package/dist/{chunk-WJGSOT6H.js → chunk-XUO5F4JU.js} +3 -3
- package/dist/{chunk-S6V3G3J5.js → chunk-YCCZKF4F.js} +3 -3
- package/dist/chunk-YQSWVHKK.js +33 -0
- package/dist/chunk-YQSWVHKK.js.map +1 -0
- package/dist/{chunk-OUPQW7WQ.js → chunk-Z4MI3HBV.js} +5 -5
- package/dist/{chunk-UBGKHTXX.js → chunk-Z5TRUCIA.js} +9 -9
- package/dist/{chunk-HX7B4PI2.js → chunk-ZKSITAVC.js} +4 -4
- package/dist/{cleanup-6QC2ISW2.js → cleanup-MW27IU2D.js} +31 -28
- package/dist/{cleanup-6QC2ISW2.js.map → cleanup-MW27IU2D.js.map} +1 -1
- package/dist/{cli-7RMR5D5O.js → cli-QVGLGPQB.js} +3 -3
- package/dist/{color-CRVXKHMC.js → color-RGMFJAHN.js} +11 -8
- package/dist/{color-CRVXKHMC.js.map → color-RGMFJAHN.js.map} +1 -1
- package/dist/{config-4EZIXQDV.js → config-AWVOZGZR.js} +11 -8
- package/dist/{config-4EZIXQDV.js.map → config-AWVOZGZR.js.map} +1 -1
- package/dist/{diff-PU2AYXR7.js → diff-WJKZRFRM.js} +12 -9
- package/dist/{diff-PU2AYXR7.js.map → diff-WJKZRFRM.js.map} +1 -1
- package/dist/{digest-NRVPOSQO.js → digest-OX5NEL2K.js} +11 -8
- package/dist/{digest-NRVPOSQO.js.map → digest-OX5NEL2K.js.map} +1 -1
- package/dist/{fork-AHV22A2S.js → fork-4AAA7GAX.js} +32 -29
- package/dist/{fork-AHV22A2S.js.map → fork-4AAA7GAX.js.map} +1 -1
- package/dist/{history-II3FYVXY.js → history-MMA6YXFH.js} +9 -6
- package/dist/{hook-CSOXC4SP.js → hook-MOC7MYLG.js} +16 -13
- package/dist/{hook-CSOXC4SP.js.map → hook-MOC7MYLG.js.map} +1 -1
- package/dist/{hydrate-MMQX5KGM.js → hydrate-EGS47UUM.js} +9 -6
- package/dist/{hydrate-MMQX5KGM.js.map → hydrate-EGS47UUM.js.map} +1 -1
- package/dist/{init-2GUP4SBN.js → init-QOFM5BTW.js} +14 -11
- package/dist/{init-2GUP4SBN.js.map → init-QOFM5BTW.js.map} +1 -1
- package/dist/{install-skills-LAFRMJ7N.js → install-skills-E24KULUM.js} +9 -6
- package/dist/install-skills-bin.js +8 -5
- package/dist/install-skills-bin.js.map +1 -1
- package/dist/{keep-HD6TXD65.js → keep-WLDMR63Z.js} +11 -8
- package/dist/{keep-HD6TXD65.js.map → keep-WLDMR63Z.js.map} +1 -1
- package/dist/{list-7HHYTAIA.js → list-YJ6BSG2M.js} +9 -6
- package/dist/{list-7HHYTAIA.js.map → list-YJ6BSG2M.js.map} +1 -1
- package/dist/{move-AJTGIGJR.js → move-AGSZHGWY.js} +21 -18
- package/dist/{move-AJTGIGJR.js.map → move-AGSZHGWY.js.map} +1 -1
- package/dist/{note-5H5CDNXB.js → note-GCNBL5A2.js} +11 -8
- package/dist/{note-5H5CDNXB.js.map → note-GCNBL5A2.js.map} +1 -1
- package/dist/{overlaps-YB2S7TEC.js → overlaps-X3YDTLTV.js} +15 -12
- package/dist/{overlaps-YB2S7TEC.js.map → overlaps-X3YDTLTV.js.map} +1 -1
- package/dist/{pin-4IHOP6F6.js → pin-22MYV72V.js} +11 -8
- package/dist/{pin-4IHOP6F6.js.map → pin-22MYV72V.js.map} +1 -1
- package/dist/{pr-RTFRPS5N.js → pr-YRQYEWL7.js} +27 -24
- package/dist/{pr-RTFRPS5N.js.map → pr-YRQYEWL7.js.map} +1 -1
- package/dist/{prune-P3Y6HAGE.js → prune-7RV6GMHU.js} +29 -26
- package/dist/{prune-P3Y6HAGE.js.map → prune-7RV6GMHU.js.map} +1 -1
- package/dist/{pty-host-CXWNRSC6.js → pty-host-PUVNAZ3F.js} +16 -13
- package/dist/{pty-host-CXWNRSC6.js.map → pty-host-PUVNAZ3F.js.map} +1 -1
- package/dist/{read-FAAEZAAH.js → read-BOB63DIH.js} +11 -8
- package/dist/{read-FAAEZAAH.js.map → read-BOB63DIH.js.map} +1 -1
- package/dist/{recent-4A7ROGTU.js → recent-S2JIDTHB.js} +16 -13
- package/dist/{recent-4A7ROGTU.js.map → recent-S2JIDTHB.js.map} +1 -1
- package/dist/{remove-4HT5JHPR.js → remove-EKBQROBE.js} +30 -27
- package/dist/{remove-4HT5JHPR.js.map → remove-EKBQROBE.js.map} +1 -1
- package/dist/{restart-X4VCGVVD.js → restart-UM7XOGDO.js} +11 -8
- package/dist/{restart-X4VCGVVD.js.map → restart-UM7XOGDO.js.map} +1 -1
- package/dist/{resume-CIYUYUGR.js → resume-BFE6ETTN.js} +16 -13
- package/dist/{resume-CIYUYUGR.js.map → resume-BFE6ETTN.js.map} +1 -1
- package/dist/{review-WTNHUBNY.js → review-XQG3AEMG.js} +10 -7
- package/dist/{review-WTNHUBNY.js.map → review-XQG3AEMG.js.map} +1 -1
- package/dist/{run-VYG6IYO4.js → run-KFICX2JE.js} +9 -6
- package/dist/{run-VYG6IYO4.js.map → run-KFICX2JE.js.map} +1 -1
- package/dist/{screen-LPWYIT4D.js → screen-2B66BGKO.js} +11 -8
- package/dist/{screen-LPWYIT4D.js.map → screen-2B66BGKO.js.map} +1 -1
- package/dist/{search-T3GQMWFL.js → search-3MXCGLOL.js} +9 -6
- package/dist/{search-T3GQMWFL.js.map → search-3MXCGLOL.js.map} +1 -1
- package/dist/{section-Y6LOV4R5.js → section-QJV7ENVX.js} +11 -8
- package/dist/{section-Y6LOV4R5.js.map → section-QJV7ENVX.js.map} +1 -1
- package/dist/{send-HSDMFC6W.js → send-LAAEMPZQ.js} +13 -10
- package/dist/{send-HSDMFC6W.js.map → send-LAAEMPZQ.js.map} +1 -1
- package/dist/{sessions-WLYINQDP.js → sessions-TWN3F43J.js} +29 -26
- package/dist/{sessions-WLYINQDP.js.map → sessions-TWN3F43J.js.map} +1 -1
- package/dist/{show-CRU7ZNCF.js → show-JFRJVS3G.js} +10 -7
- package/dist/{show-CRU7ZNCF.js.map → show-JFRJVS3G.js.map} +1 -1
- package/dist/{snooze-YQFTGZL5.js → snooze-RRPHFFMD.js} +11 -8
- package/dist/{snooze-YQFTGZL5.js.map → snooze-RRPHFFMD.js.map} +1 -1
- package/dist/{start-EYFMHXJ6.js → start-XTEZKSA3.js} +11 -8
- package/dist/{start-EYFMHXJ6.js.map → start-XTEZKSA3.js.map} +1 -1
- package/dist/{status-PFGSYLDB.js → status-2BFFMHO2.js} +13 -10
- package/dist/{status-PFGSYLDB.js.map → status-2BFFMHO2.js.map} +1 -1
- package/dist/{statusline-NEVXTHUY.js → statusline-B6U3ANSM.js} +3 -2
- package/dist/{statusline-NEVXTHUY.js.map → statusline-B6U3ANSM.js.map} +1 -1
- package/dist/{statusline-hook-H5MM2PA2.js → statusline-hook-SYRLMSDL.js} +7 -5
- package/dist/{statusline-hook-H5MM2PA2.js.map → statusline-hook-SYRLMSDL.js.map} +1 -1
- package/dist/{stop-AV7NEC7U.js → stop-I6WWTUFP.js} +11 -8
- package/dist/{stop-AV7NEC7U.js.map → stop-I6WWTUFP.js.map} +1 -1
- package/dist/{sync-2M5O3NX7.js → sync-SB5JN2EN.js} +29 -26
- package/dist/{sync-2M5O3NX7.js.map → sync-SB5JN2EN.js.map} +1 -1
- package/dist/{time-E7FJHTKI.js → time-IEFF5FEV.js} +12 -9
- package/dist/{time-E7FJHTKI.js.map → time-IEFF5FEV.js.map} +1 -1
- package/dist/{timesheet-LTC7EXNJ.js → timesheet-RRK4ENUU.js} +14 -11
- package/dist/{timesheet-LTC7EXNJ.js.map → timesheet-RRK4ENUU.js.map} +1 -1
- package/dist/{tree-CQT5LU62.js → tree-G4ATBUTH.js} +28 -25
- package/dist/{tree-CQT5LU62.js.map → tree-G4ATBUTH.js.map} +1 -1
- package/dist/{update-BZOZCI7G.js → update-LSDD3ZDO.js} +17 -14
- package/dist/{update-BZOZCI7G.js.map → update-LSDD3ZDO.js.map} +1 -1
- package/dist/{usage-IOCB7U4W.js → usage-CTT5CMQK.js} +15 -10
- package/dist/usage-CTT5CMQK.js.map +1 -0
- package/dist/usage-ask-YJNTOGXY.js +176 -0
- package/dist/usage-ask-YJNTOGXY.js.map +1 -0
- package/dist/{version-U2QIALPO.js → version-6UJN2CCE.js} +3 -2
- package/dist/{version-U2QIALPO.js.map → version-6UJN2CCE.js.map} +1 -1
- package/dist/{wait-J5BM6222.js → wait-2L67BLEO.js} +13 -10
- package/dist/{wait-J5BM6222.js.map → wait-2L67BLEO.js.map} +1 -1
- package/dist/wd-bin.js +2 -2
- package/dist/web/assets/{PtyView-DiTbw6LM.js → PtyView-DhDNPvL9.js} +2 -2
- package/dist/web/assets/{PtyView-DiTbw6LM.js.map → PtyView-DhDNPvL9.js.map} +1 -1
- package/dist/web/assets/{index-Du3J-M5I.js → index-CfBb7suR.js} +4 -4
- package/dist/web/assets/index-CfBb7suR.js.map +1 -0
- package/dist/web/index.html +1 -1
- package/dist/{web-52FISJAC.js → web-MUO46QAX.js} +175 -158
- package/dist/web-MUO46QAX.js.map +1 -0
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/dist/chunk-DOYJR2HF.js.map +0 -1
- package/dist/chunk-JHCR7H4Y.js.map +0 -1
- package/dist/chunk-M7CC2GUA.js +0 -9
- package/dist/chunk-OHMLCXRW.js.map +0 -1
- package/dist/chunk-REPFZIPP.js.map +0 -1
- package/dist/chunk-UVZITL47.js.map +0 -1
- package/dist/chunk-XT2ZKXMT.js.map +0 -1
- package/dist/usage-IOCB7U4W.js.map +0 -1
- package/dist/web/assets/index-Du3J-M5I.js.map +0 -1
- package/dist/web-52FISJAC.js.map +0 -1
- /package/dist/{chunk-6FD52UQ6.js.map → chunk-3OUUWNK2.js.map} +0 -0
- /package/dist/{chunk-UKEI5DJS.js.map → chunk-4J2F6OWM.js.map} +0 -0
- /package/dist/{chunk-2I3HHZMS.js.map → chunk-5JRO64D4.js.map} +0 -0
- /package/dist/{chunk-DAVDKNRH.js.map → chunk-63RNLC25.js.map} +0 -0
- /package/dist/{chunk-V2TTONXR.js.map → chunk-7PKIZVR7.js.map} +0 -0
- /package/dist/{chunk-3E3WHGSI.js.map → chunk-AQKPXFC2.js.map} +0 -0
- /package/dist/{chunk-RYFHY3JQ.js.map → chunk-ARQSFOYE.js.map} +0 -0
- /package/dist/{chunk-GUHRMQNP.js.map → chunk-C2BFHQHX.js.map} +0 -0
- /package/dist/{chunk-VS6DDWIX.js.map → chunk-D77U5ELL.js.map} +0 -0
- /package/dist/{chunk-A5OQHOEV.js.map → chunk-DA2KILWV.js.map} +0 -0
- /package/dist/{chunk-63HMFHNG.js.map → chunk-DLV7TRON.js.map} +0 -0
- /package/dist/{chunk-ZFFWFVER.js.map → chunk-E25DJVBD.js.map} +0 -0
- /package/dist/{chunk-Q6RMN7PX.js.map → chunk-EP7LCLHB.js.map} +0 -0
- /package/dist/{chunk-E2PKPMWC.js.map → chunk-ESEIPUMT.js.map} +0 -0
- /package/dist/{chunk-ZWFNIN6O.js.map → chunk-FAGTMW6W.js.map} +0 -0
- /package/dist/{chunk-D4V5W6IC.js.map → chunk-FJADRDML.js.map} +0 -0
- /package/dist/{chunk-IWMODEU4.js.map → chunk-GR4LV3ZS.js.map} +0 -0
- /package/dist/{chunk-4GUB7MQG.js.map → chunk-HREHEBL2.js.map} +0 -0
- /package/dist/{chunk-RFNMR7M4.js.map → chunk-IALCEDTH.js.map} +0 -0
- /package/dist/{chunk-DOOT25BN.js.map → chunk-JEH4X76F.js.map} +0 -0
- /package/dist/{chunk-JTQBQEL4.js.map → chunk-JIK4FY3E.js.map} +0 -0
- /package/dist/{chunk-SNQVTLBX.js.map → chunk-JPXEX3XW.js.map} +0 -0
- /package/dist/{chunk-T3HVNKHI.js.map → chunk-KQ7QLBY2.js.map} +0 -0
- /package/dist/{chunk-WC23KWN4.js.map → chunk-KX6KZYU4.js.map} +0 -0
- /package/dist/{chunk-LHUSNLSJ.js.map → chunk-LVNRPAQK.js.map} +0 -0
- /package/dist/{chunk-YJVBX3HU.js.map → chunk-NBLF2SNP.js.map} +0 -0
- /package/dist/{chunk-YXDWREKR.js.map → chunk-NGB2K7HX.js.map} +0 -0
- /package/dist/{chunk-33SBTWZW.js.map → chunk-OEQASHE3.js.map} +0 -0
- /package/dist/{chunk-INQVYKB4.js.map → chunk-PLTFWTIE.js.map} +0 -0
- /package/dist/{chunk-CHSKQHYY.js.map → chunk-QEZGXU5Q.js.map} +0 -0
- /package/dist/{chunk-3A3HSUBD.js.map → chunk-QHFUCX2J.js.map} +0 -0
- /package/dist/{chunk-NKKISMHV.js.map → chunk-RNEN6NUX.js.map} +0 -0
- /package/dist/{chunk-WK5ZIO6B.js.map → chunk-SFFAPGA5.js.map} +0 -0
- /package/dist/{chunk-6T5JRU75.js.map → chunk-T3KZSJHU.js.map} +0 -0
- /package/dist/{chunk-ZED6QQJ5.js.map → chunk-TI2CNJLD.js.map} +0 -0
- /package/dist/{chunk-FDTBJW7M.js.map → chunk-U4INTLIY.js.map} +0 -0
- /package/dist/{chunk-M7CC2GUA.js.map → chunk-UKPZXS5B.js.map} +0 -0
- /package/dist/{chunk-2AENPORN.js.map → chunk-V6KHER6C.js.map} +0 -0
- /package/dist/{chunk-TMRRQ6TT.js.map → chunk-VEERK6HO.js.map} +0 -0
- /package/dist/{chunk-UM4R6YIC.js.map → chunk-VFRJO737.js.map} +0 -0
- /package/dist/{chunk-3HWQYW6S.js.map → chunk-VFZI4SAH.js.map} +0 -0
- /package/dist/{chunk-4TTIEI7I.js.map → chunk-VRMALBZK.js.map} +0 -0
- /package/dist/{chunk-QAY2Q2JC.js.map → chunk-WVZG5Q4L.js.map} +0 -0
- /package/dist/{chunk-DZACN5FM.js.map → chunk-XFWO5FYK.js.map} +0 -0
- /package/dist/{chunk-RF6DCSJM.js.map → chunk-XPX5AAYH.js.map} +0 -0
- /package/dist/{chunk-WJGSOT6H.js.map → chunk-XUO5F4JU.js.map} +0 -0
- /package/dist/{chunk-S6V3G3J5.js.map → chunk-YCCZKF4F.js.map} +0 -0
- /package/dist/{chunk-OUPQW7WQ.js.map → chunk-Z4MI3HBV.js.map} +0 -0
- /package/dist/{chunk-UBGKHTXX.js.map → chunk-Z5TRUCIA.js.map} +0 -0
- /package/dist/{chunk-HX7B4PI2.js.map → chunk-ZKSITAVC.js.map} +0 -0
- /package/dist/{cli-7RMR5D5O.js.map → cli-QVGLGPQB.js.map} +0 -0
- /package/dist/{history-II3FYVXY.js.map → history-MMA6YXFH.js.map} +0 -0
- /package/dist/{install-skills-LAFRMJ7N.js.map → install-skills-E24KULUM.js.map} +0 -0
|
@@ -4,55 +4,55 @@ import {
|
|
|
4
4
|
openInLeftovers,
|
|
5
5
|
resolvePrToStart,
|
|
6
6
|
workOnPrPrompt
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-AQKPXFC2.js";
|
|
8
8
|
import {
|
|
9
9
|
retiredUnsafeOption,
|
|
10
10
|
warnRetiredUnsafe
|
|
11
11
|
} from "./chunk-S3CTXKSN.js";
|
|
12
12
|
import {
|
|
13
13
|
clearLaunchedUnsafeWhenIdle
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-3OUUWNK2.js";
|
|
15
15
|
import "./chunk-FZHFD2AY.js";
|
|
16
|
-
import "./chunk-
|
|
16
|
+
import "./chunk-VEERK6HO.js";
|
|
17
17
|
import "./chunk-ICEP4WAK.js";
|
|
18
18
|
import {
|
|
19
19
|
attachSession
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-JIK4FY3E.js";
|
|
21
21
|
import {
|
|
22
22
|
SETUP_WARNINGS
|
|
23
|
-
} from "./chunk-
|
|
24
|
-
import "./chunk-
|
|
25
|
-
import "./chunk-
|
|
26
|
-
import "./chunk-
|
|
27
|
-
import "./chunk-
|
|
28
|
-
import "./chunk-
|
|
23
|
+
} from "./chunk-FJADRDML.js";
|
|
24
|
+
import "./chunk-HREHEBL2.js";
|
|
25
|
+
import "./chunk-VRMALBZK.js";
|
|
26
|
+
import "./chunk-WVZG5Q4L.js";
|
|
27
|
+
import "./chunk-4J2F6OWM.js";
|
|
28
|
+
import "./chunk-DLV7TRON.js";
|
|
29
29
|
import {
|
|
30
30
|
BaseSpecError,
|
|
31
31
|
isEmptyBaseSpec,
|
|
32
32
|
openBaseCheckout,
|
|
33
33
|
parseBaseSpec,
|
|
34
34
|
setupWorktree
|
|
35
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-C2BFHQHX.js";
|
|
36
36
|
import "./chunk-PZ7WTBSI.js";
|
|
37
37
|
import "./chunk-EORL2V7P.js";
|
|
38
38
|
import "./chunk-SJBEIYLK.js";
|
|
39
|
-
import "./chunk-
|
|
39
|
+
import "./chunk-FAGTMW6W.js";
|
|
40
40
|
import "./chunk-7E5XPDKX.js";
|
|
41
|
-
import "./chunk-
|
|
42
|
-
import "./chunk-
|
|
41
|
+
import "./chunk-63RNLC25.js";
|
|
42
|
+
import "./chunk-XPX5AAYH.js";
|
|
43
43
|
import "./chunk-ZSHWP2VS.js";
|
|
44
44
|
import "./chunk-CNZV3UCM.js";
|
|
45
45
|
import "./chunk-HUXS3VAI.js";
|
|
46
46
|
import "./chunk-LM2T5OR3.js";
|
|
47
|
-
import "./chunk-
|
|
48
|
-
import "./chunk-
|
|
49
|
-
import "./chunk-
|
|
47
|
+
import "./chunk-EP7LCLHB.js";
|
|
48
|
+
import "./chunk-TI2CNJLD.js";
|
|
49
|
+
import "./chunk-JPXEX3XW.js";
|
|
50
50
|
import "./chunk-FGPXMAYU.js";
|
|
51
|
-
import "./chunk-
|
|
51
|
+
import "./chunk-QHFUCX2J.js";
|
|
52
52
|
import {
|
|
53
53
|
launchAi,
|
|
54
54
|
openVSCode
|
|
55
|
-
} from "./chunk-
|
|
55
|
+
} from "./chunk-YCCZKF4F.js";
|
|
56
56
|
import "./chunk-GNIYYXQX.js";
|
|
57
57
|
import "./chunk-T5GJVUSL.js";
|
|
58
58
|
import "./chunk-XBWS77S2.js";
|
|
@@ -60,7 +60,7 @@ import "./chunk-4CXUVBOD.js";
|
|
|
60
60
|
import {
|
|
61
61
|
findSession,
|
|
62
62
|
loadHistory
|
|
63
|
-
} from "./chunk-
|
|
63
|
+
} from "./chunk-D77U5ELL.js";
|
|
64
64
|
import "./chunk-NEJVK5CF.js";
|
|
65
65
|
import "./chunk-ALBTIOP3.js";
|
|
66
66
|
import "./chunk-LNHSBM4L.js";
|
|
@@ -68,23 +68,26 @@ import {
|
|
|
68
68
|
agentFor,
|
|
69
69
|
ownsBranch,
|
|
70
70
|
sessionToolFor
|
|
71
|
-
} from "./chunk-
|
|
71
|
+
} from "./chunk-O22DNTKU.js";
|
|
72
|
+
import "./chunk-KGHWHAVF.js";
|
|
73
|
+
import "./chunk-WIYDT3PY.js";
|
|
72
74
|
import {
|
|
73
75
|
envArgs
|
|
74
|
-
} from "./chunk-
|
|
76
|
+
} from "./chunk-YQSWVHKK.js";
|
|
75
77
|
import {
|
|
76
78
|
getAllTargetNames,
|
|
77
79
|
resolveFromCwd,
|
|
78
80
|
resolveProjectTarget
|
|
79
81
|
} from "./chunk-IPHADNF5.js";
|
|
80
82
|
import "./chunk-JYWX2N5W.js";
|
|
81
|
-
import "./chunk-
|
|
83
|
+
import "./chunk-JUGF3YE7.js";
|
|
82
84
|
import "./chunk-HK6AZQ5Z.js";
|
|
83
85
|
import "./chunk-7334DEPX.js";
|
|
84
86
|
import {
|
|
85
87
|
ensureConfig
|
|
86
88
|
} from "./chunk-MWIPHUAE.js";
|
|
87
|
-
import "./chunk-
|
|
89
|
+
import "./chunk-HGB7BITW.js";
|
|
90
|
+
import "./chunk-BR6OWWAA.js";
|
|
88
91
|
import "./chunk-VHENFC2S.js";
|
|
89
92
|
import "./chunk-QOSAWNOU.js";
|
|
90
93
|
import "./chunk-D2J3AD6L.js";
|
|
@@ -330,4 +333,4 @@ var treeCommand = {
|
|
|
330
333
|
export {
|
|
331
334
|
treeCommand
|
|
332
335
|
};
|
|
333
|
-
//# sourceMappingURL=tree-
|
|
336
|
+
//# sourceMappingURL=tree-G4ATBUTH.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/commands/tree.ts"],"sourcesContent":["import fs from 'node:fs';\nimport { agentFor, sessionToolFor } from '../core/agents/index.js';\nimport chalk from 'chalk';\nimport type { CommandModule } from 'yargs';\nimport { ensureConfig } from '../core/platform/config.js';\nimport { resolveProjectTarget, getAllTargetNames, resolveFromCwd } from '../core/worktree/resolve.js';\nimport { openBaseCheckout, setupWorktree } from '../core/worktree/worktree.js';\nimport { ownsBranch } from '../core/worktree/own-checkout.js';\nimport { findSession, loadHistory } from '../core/sessions/history.js';\nimport { clearLaunchedUnsafeWhenIdle } from '../core/sessions/legacy-unsafe-io.js';\nimport { retiredUnsafeOption, warnRetiredUnsafe } from './shared/retired-unsafe.js';\nimport { keepingWarnings } from '../core/platform/report.js';\nimport { SETUP_WARNINGS } from '../core/worktree/setup-child.js';\nimport { leftoversOf, openInLeftovers } from '../core/archive/restore-leftovers.js';\nimport { attachSession } from './shared/attach-session.js';\nimport { openVSCode, launchAi } from '../core/platform/launch.js';\nimport { envArgs } from '../core/platform/env-delta.js';\nimport { parseBaseSpec, isEmptyBaseSpec, BaseSpecError } from '../core/git/base-spec.js';\nimport { resolvePrToStart } from '../core/pr/pr-start.js';\nimport { workOnPrPrompt } from '../core/pr/pr-ref.js';\n\nexport const treeCommand: CommandModule = {\n command: ['tree [target] [branch]', 't [target] [branch]'],\n describe: 'Create or switch to a worktree and launch the configured AI tool',\n builder: (yargs) =>\n yargs\n .showHelpOnFail(true)\n .positional('target', {\n describe: 'Project alias or group name',\n type: 'string',\n })\n .positional('branch', {\n describe: 'Branch name (e.g., feature/login). Omit to work on the base repo.',\n type: 'string',\n })\n .option('here', {\n describe: 'Infer target and branch from the current worktree directory',\n type: 'boolean',\n default: false,\n })\n .option('open', {\n describe: 'Open VS Code in the worktree after creation',\n type: 'boolean',\n default: false,\n })\n .option('unsafe', retiredUnsafeOption)\n .option('pull', {\n describe: 'Pull latest changes when switching into an existing worktree or the base repo. Use --no-pull to skip.',\n type: 'boolean',\n default: true,\n })\n .option('host', {\n describe:\n 'Run the AI session in the PTY host and attach this terminal to it (the default): it survives closing the tab, shows in `work web` — the same screen there and here — and restores after a reboot. Ctrl+] detaches. --no-host (or config `launchViaHost: false`) launches directly in this terminal instead.',\n type: 'boolean',\n })\n .option('fresh', {\n describe: 'Start a new AI conversation instead of continuing the previous one for this directory',\n type: 'boolean',\n default: false,\n })\n .option('base', {\n describe:\n 'Base branch to fork from instead of HEAD. Repeatable. Use a bare branch (--base dev) for all repos, or alias=branch (--base backend=dev --base frontend=feat/x) for per-repo bases in a group.',\n type: 'string',\n })\n .option('prompt', {\n describe: 'Initial prompt to send to the AI tool on startup',\n type: 'string',\n })\n .option('prompt-file', {\n describe: 'File containing the initial prompt (deleted after reading)',\n type: 'string',\n })\n .option('pr', {\n describe:\n \"Work on a pull request, on its branch (what you push lands in it): its link, or its number with <target>. Someone else's too; not one from a fork\",\n type: 'string',\n })\n .option('name', {\n describe: 'Name the session (shown instead of the branch; rename later with F2 in the dashboard)',\n type: 'string',\n })\n .option('account', {\n describe:\n 'The Claude account a new session runs on (a name from `work account list`; default: the configured default). An existing session keeps its own.',\n type: 'string',\n })\n .option('issue-key', {\n describe: 'Link a Jira issue key to this worktree session',\n type: 'string',\n hidden: true,\n })\n .option('repos', {\n describe: \"A new session's repos (comma-separated aliases) instead of its group's: made as a session folder (used by Fork…)\",\n type: 'string',\n hidden: true,\n })\n .option('setup-only', {\n describe: 'Create worktree without launching the AI tool (used by dashboard)',\n type: 'boolean',\n default: false,\n hidden: true,\n }),\n handler: async (argv) => {\n let targetName = argv.target as string | undefined;\n let branchName = argv.branch as string | undefined;\n const here = argv.here as boolean;\n const open = argv.open as boolean;\n warnRetiredUnsafe(argv);\n const pull = argv.pull as boolean;\n const fresh = argv.fresh as boolean;\n const setupOnly = argv['setup-only'] as boolean;\n let baseSpec;\n try {\n baseSpec = parseBaseSpec(argv.base as string | string[] | undefined);\n } catch (err) {\n if (err instanceof BaseSpecError) {\n console.error(err.message);\n process.exitCode = 1;\n return;\n }\n throw err;\n }\n const issueKey = argv['issue-key'] as string | undefined;\n const account = argv.account as string | undefined;\n const promptFile = argv['prompt-file'] as string | undefined;\n let initialPrompt = argv.prompt as string | undefined;\n\n // --prompt-file takes precedence: read and delete the temp file\n if (promptFile) {\n try {\n initialPrompt = fs.readFileSync(promptFile, 'utf-8');\n fs.unlinkSync(promptFile);\n } catch {\n // ignore — fall through to --prompt or no prompt\n }\n }\n\n const config = ensureConfig();\n // Via the host unless told otherwise: one Claude that the terminal and\n // the dashboard both show. A direct launch is invisible to work web.\n const viaHost = (argv.host as boolean | undefined) ?? config.launchViaHost ?? true;\n\n /**\n * Launch the AI tool, continuing the previous conversation for this\n * directory when there is one. `--continue` errors out (\"No conversation\n * found to continue\") in a directory the tool has never run in, so the flag\n * is gated on an existing transcript.\n */\n const launchTool = async (dir: string, port: number | undefined, sessionKey: { target: string; branch: string }): Promise<void> => {\n if (viaHost) {\n const session = findSession(loadHistory(), sessionKey.target, sessionKey.branch);\n if (session) {\n // The host decides --continue itself (the agent's own canResume\n // gate); `fresh` and the prompt ride along on the first spawn.\n process.exitCode = await attachSession(session, {\n fresh,\n initialPrompt,\n forwardEnv: true,\n });\n return;\n }\n console.log(chalk.yellow('Session not found in history — launching directly instead of via the PTY host.'));\n }\n // The session's agent: what to run, and whether it can resume here.\n const own = findSession(loadHistory(), sessionKey.target, sessionKey.branch);\n const agent = agentFor(config, own);\n const tool = agent.launch.tool(config);\n // The session's account: its conversations are in that account's folder, and the agent starts on it.\n const resume = !fresh && agent.launch.canResume(dir, { session: own });\n if (resume) {\n console.log(chalk.gray(`Continuing the previous ${tool.cmd} conversation (--fresh starts a new one).`));\n }\n // Started normally now: a launchedUnsafe from before the retirement no longer describes it — unless that agent\n // still runs in another terminal, which keeps the flag and its guards (legacy-unsafe.ts; remove next release).\n clearLaunchedUnsafeWhenIdle(sessionKey.target, sessionKey.branch);\n console.log(`Starting ${tool.cmd}...`);\n // With work's hooks for this process (--settings), never the user's settings' (agents/session-hooks.ts).\n launchAi(dir, sessionToolFor(tool), { initialPrompt, resume }, port, ...envArgs(agent.launch.env?.(own ?? null)));\n };\n\n // --pr: the PR's repo and branch, and a first prompt saying whose branch it is.\n const prArg = argv.pr as string | undefined;\n if (prArg !== undefined) {\n if (branchName || here || !isEmptyBaseSpec(baseSpec)) {\n console.error(\"--pr takes the PR's own branch: don't combine it with a branch, --here or --base.\");\n process.exitCode = 1;\n return;\n }\n const found = await resolvePrToStart(prArg, config, targetName);\n if (!found.ok) {\n console.error(found.error);\n process.exitCode = 1;\n return;\n }\n targetName = found.pr.alias;\n branchName = found.pr.branch;\n // The PR's context goes to a new session only (with your --prompt as what to do): back in\n // one, your --prompt goes as it is, and nothing re-sends the first message.\n if (!findSession(loadHistory(), targetName, branchName)) initialPrompt = workOnPrPrompt(found.pr, initialPrompt);\n console.log(\n chalk.cyan(`PR #${found.pr.number} by @${found.pr.author || '?'}: ${found.pr.title}, on its branch ${branchName} in ${targetName}`),\n );\n }\n\n // --here: infer target and branch from the current worktree directory\n if (here) {\n if (targetName) {\n console.error('Cannot combine --here with an explicit target.');\n process.exitCode = 1;\n return;\n }\n const inferred = resolveFromCwd(config, process.cwd(), loadHistory());\n if ('error' in inferred) {\n console.error(inferred.error);\n process.exitCode = 1;\n return;\n }\n targetName = inferred.target;\n branchName = inferred.isBaseRepo ? undefined : inferred.branch;\n console.log(chalk.cyan(`Resolved from current directory: ${targetName}${branchName ? ' @ ' + branchName : ' (base repo)'}`));\n } else if (!targetName) {\n console.error('Specify a target, or use --here to infer it from the current directory.');\n process.exitCode = 1;\n return;\n }\n\n // --base requires a branch name\n if (!isEmptyBaseSpec(baseSpec) && !branchName) {\n console.error('--base requires a branch name');\n console.log(chalk.yellow(`Usage: work tree ${targetName} <branch> --base <base>`));\n process.exitCode = 1;\n return;\n }\n\n // Resolve project target (for validation and base-repo handling)\n const target = resolveProjectTarget(targetName, config);\n if (!target) {\n const allNames = getAllTargetNames(config);\n console.error(`Project or group not found: ${targetName}`);\n console.log(chalk.yellow(`Available: ${allNames.join(', ')}`));\n console.log(chalk.yellow('Add a new project with: work config add <alias> <path>'));\n process.exitCode = 1;\n return;\n }\n\n // The branch the repo's own folder is on can't be checked out a second time: asking for it means that folder.\n if (branchName && isEmptyBaseSpec(baseSpec) && !target.isGroup && ownsBranch(targetName, branchName, config)) {\n console.log(chalk.gray(`${branchName} is the branch ${targetName}'s own folder is on: opening it there.`));\n branchName = undefined;\n }\n\n // No branch specified — work directly on the base repo\n if (!branchName) {\n if (target.isGroup) {\n console.error('Branch is required for group targets.');\n console.log(chalk.yellow(`Usage: work tree ${targetName} <branch>`));\n process.exitCode = 1;\n return;\n }\n\n console.log(chalk.cyan(`Working on base repo: ${targetName}`));\n const opened = await openBaseCheckout(targetName, config, {\n pull,\n issueKey,\n name: typeof argv.name === 'string' ? argv.name : undefined,\n account,\n });\n if (!opened.ok) {\n console.error(opened.error);\n process.exitCode = 1;\n return;\n }\n const { repoPath, branch: currentBranch } = opened;\n console.log(`Repo path: ${repoPath}`);\n if (opened.dropped.length) console.log(chalk.gray(`Replaced older entries for this checkout: ${opened.dropped.join(', ')}`));\n\n if (open) openVSCode(repoPath);\n if (!setupOnly) await launchTool(repoPath, undefined, { target: targetName, branch: currentBranch });\n return;\n }\n\n // Create/switch worktree via shared core logic\n const repos =\n typeof argv.repos === 'string'\n ? argv.repos\n .split(',')\n .map((a) => a.trim())\n .filter(Boolean)\n : [];\n const { value: result, warnings } = await keepingWarnings(() =>\n setupWorktree(targetName, branchName, config, baseSpec, issueKey, {\n pull,\n name: argv.name as string | undefined,\n ...(account ? { account } : {}),\n ...(repos.length ? { repos } : {}),\n }),\n );\n if (!result) {\n // Run by you (not work web's child, whose route says it): what keeps the old folder in use, by name.\n const left = setupOnly ? [] : leftoversOf(findSession(loadHistory(), targetName, branchName)?.paths ?? []);\n const open = await openInLeftovers(left);\n if (open.length) console.error(chalk.yellow(`Still open in its old folder: ${open.join(', ')}. Stop it and try again.`));\n process.exitCode = 1;\n return;\n }\n\n if (open) {\n for (const p of result.paths) {\n openVSCode(p);\n }\n }\n\n console.log(`Worktree path: ${result.launchDir}`);\n // work web's child: what it warned about, for the dashboard (it reads only this line).\n if (setupOnly) console.log(`${SETUP_WARNINGS}${JSON.stringify(warnings)}`);\n if (!setupOnly) {\n await launchTool(result.launchDir, result.port, { target: targetName, branch: branchName });\n }\n },\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ;AAEf,OAAO,WAAW;AAmBX,IAAM,cAA6B;AAAA,EACxC,SAAS,CAAC,0BAA0B,qBAAqB;AAAA,EACzD,UAAU;AAAA,EACV,SAAS,CAAC,UACR,MACG,eAAe,IAAI,EACnB,WAAW,UAAU;AAAA,IACpB,UAAU;AAAA,IACV,MAAM;AAAA,EACR,CAAC,EACA,WAAW,UAAU;AAAA,IACpB,UAAU;AAAA,IACV,MAAM;AAAA,EACR,CAAC,EACA,OAAO,QAAQ;AAAA,IACd,UAAU;AAAA,IACV,MAAM;AAAA,IACN,SAAS;AAAA,EACX,CAAC,EACA,OAAO,QAAQ;AAAA,IACd,UAAU;AAAA,IACV,MAAM;AAAA,IACN,SAAS;AAAA,EACX,CAAC,EACA,OAAO,UAAU,mBAAmB,EACpC,OAAO,QAAQ;AAAA,IACd,UAAU;AAAA,IACV,MAAM;AAAA,IACN,SAAS;AAAA,EACX,CAAC,EACA,OAAO,QAAQ;AAAA,IACd,UACE;AAAA,IACF,MAAM;AAAA,EACR,CAAC,EACA,OAAO,SAAS;AAAA,IACf,UAAU;AAAA,IACV,MAAM;AAAA,IACN,SAAS;AAAA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GAAG,EACT,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,EACnB,OAAO,OAAO,IACjB,CAAC;AACP,UAAM,EAAE,OAAO,QAAQ,SAAS,IAAI,MAAM;AAAA,MAAgB,MACxD,cAAc,YAAY,YAAY,QAAQ,UAAU,UAAU;AAAA,QAChE;AAAA,QACA,MAAM,KAAK;AAAA,QACX,GAAI,UAAU,EAAE,QAAQ,IAAI,CAAC;AAAA,QAC7B,GAAI,MAAM,SAAS,EAAE,MAAM,IAAI,CAAC;AAAA,MAClC,CAAC;AAAA,IACH;AACA,QAAI,CAAC,QAAQ;AAEX,YAAM,OAAO,YAAY,CAAC,IAAI,YAAY,YAAY,YAAY,GAAG,YAAY,UAAU,GAAG,SAAS,CAAC,CAAC;AACzG,YAAMA,QAAO,MAAM,gBAAgB,IAAI;AACvC,UAAIA,MAAK,OAAQ,SAAQ,MAAM,MAAM,OAAO,iCAAiCA,MAAK,KAAK,IAAI,CAAC,0BAA0B,CAAC;AACvH,cAAQ,WAAW;AACnB;AAAA,IACF;AAEA,QAAI,MAAM;AACR,iBAAW,KAAK,OAAO,OAAO;AAC5B,mBAAW,CAAC;AAAA,MACd;AAAA,IACF;AAEA,YAAQ,IAAI,kBAAkB,OAAO,SAAS,EAAE;AAEhD,QAAI,UAAW,SAAQ,IAAI,GAAG,cAAc,GAAG,KAAK,UAAU,QAAQ,CAAC,EAAE;AACzE,QAAI,CAAC,WAAW;AACd,YAAM,WAAW,OAAO,WAAW,OAAO,MAAM,EAAE,QAAQ,YAAY,QAAQ,WAAW,CAAC;AAAA,IAC5F;AAAA,EACF;AACF;","names":["open"]}
|
|
1
|
+
{"version":3,"sources":["../src/commands/tree.ts"],"sourcesContent":["import fs from 'node:fs';\nimport { agentFor, sessionToolFor } from '../core/agents/index.js';\nimport chalk from 'chalk';\nimport type { CommandModule } from 'yargs';\nimport { ensureConfig } from '../core/platform/config.js';\nimport { resolveProjectTarget, getAllTargetNames, resolveFromCwd } from '../core/worktree/resolve.js';\nimport { openBaseCheckout, setupWorktree } from '../core/worktree/worktree.js';\nimport { ownsBranch } from '../core/worktree/own-checkout.js';\nimport { findSession, loadHistory } from '../core/sessions/history.js';\nimport { clearLaunchedUnsafeWhenIdle } from '../core/sessions/legacy-unsafe-io.js';\nimport { retiredUnsafeOption, warnRetiredUnsafe } from './shared/retired-unsafe.js';\nimport { keepingWarnings } from '../core/platform/report.js';\nimport { SETUP_WARNINGS } from '../core/worktree/setup-child.js';\nimport { leftoversOf, openInLeftovers } from '../core/archive/restore-leftovers.js';\nimport { attachSession } from './shared/attach-session.js';\nimport { openVSCode, launchAi } from '../core/platform/launch.js';\nimport { envArgs } from '../core/platform/env-delta.js';\nimport { parseBaseSpec, isEmptyBaseSpec, BaseSpecError } from '../core/git/base-spec.js';\nimport { resolvePrToStart } from '../core/pr/pr-start.js';\nimport { workOnPrPrompt } from '../core/pr/pr-ref.js';\n\nexport const treeCommand: CommandModule = {\n command: ['tree [target] [branch]', 't [target] [branch]'],\n describe: 'Create or switch to a worktree and launch the configured AI tool',\n builder: (yargs) =>\n yargs\n .showHelpOnFail(true)\n .positional('target', {\n describe: 'Project alias or group name',\n type: 'string',\n })\n .positional('branch', {\n describe: 'Branch name (e.g., feature/login). Omit to work on the base repo.',\n type: 'string',\n })\n .option('here', {\n describe: 'Infer target and branch from the current worktree directory',\n type: 'boolean',\n default: false,\n })\n .option('open', {\n describe: 'Open VS Code in the worktree after creation',\n type: 'boolean',\n default: false,\n })\n .option('unsafe', retiredUnsafeOption)\n .option('pull', {\n describe: 'Pull latest changes when switching into an existing worktree or the base repo. Use --no-pull to skip.',\n type: 'boolean',\n default: true,\n })\n .option('host', {\n describe:\n 'Run the AI session in the PTY host and attach this terminal to it (the default): it survives closing the tab, shows in `work web` — the same screen there and here — and restores after a reboot. Ctrl+] detaches. --no-host (or config `launchViaHost: false`) launches directly in this terminal instead.',\n type: 'boolean',\n })\n .option('fresh', {\n describe: 'Start a new AI conversation instead of continuing the previous one for this directory',\n type: 'boolean',\n default: false,\n })\n .option('base', {\n describe:\n 'Base branch to fork from instead of HEAD. Repeatable. Use a bare branch (--base dev) for all repos, or alias=branch (--base backend=dev --base frontend=feat/x) for per-repo bases in a group.',\n type: 'string',\n })\n .option('prompt', {\n describe: 'Initial prompt to send to the AI tool on startup',\n type: 'string',\n })\n .option('prompt-file', {\n describe: 'File containing the initial prompt (deleted after reading)',\n type: 'string',\n })\n .option('pr', {\n describe:\n \"Work on a pull request, on its branch (what you push lands in it): its link, or its number with <target>. Someone else's too; not one from a fork\",\n type: 'string',\n })\n .option('name', {\n describe: 'Name the session (shown instead of the branch; rename later with F2 in the dashboard)',\n type: 'string',\n })\n .option('account', {\n describe:\n 'The Claude account a new session runs on (a name from `work account list`; default: the configured default). An existing session keeps its own.',\n type: 'string',\n })\n .option('issue-key', {\n describe: 'Link a Jira issue key to this worktree session',\n type: 'string',\n hidden: true,\n })\n .option('repos', {\n describe: \"A new session's repos (comma-separated aliases) instead of its group's: made as a session folder (used by Fork…)\",\n type: 'string',\n hidden: true,\n })\n .option('setup-only', {\n describe: 'Create worktree without launching the AI tool (used by dashboard)',\n type: 'boolean',\n default: false,\n hidden: true,\n }),\n handler: async (argv) => {\n let targetName = argv.target as string | undefined;\n let branchName = argv.branch as string | undefined;\n const here = argv.here as boolean;\n const open = argv.open as boolean;\n warnRetiredUnsafe(argv);\n const pull = argv.pull as boolean;\n const fresh = argv.fresh as boolean;\n const setupOnly = argv['setup-only'] as boolean;\n let baseSpec;\n try {\n baseSpec = parseBaseSpec(argv.base as string | string[] | undefined);\n } catch (err) {\n if (err instanceof BaseSpecError) {\n console.error(err.message);\n process.exitCode = 1;\n return;\n }\n throw err;\n }\n const issueKey = argv['issue-key'] as string | undefined;\n const account = argv.account as string | undefined;\n const promptFile = argv['prompt-file'] as string | undefined;\n let initialPrompt = argv.prompt as string | undefined;\n\n // --prompt-file takes precedence: read and delete the temp file\n if (promptFile) {\n try {\n initialPrompt = fs.readFileSync(promptFile, 'utf-8');\n fs.unlinkSync(promptFile);\n } catch {\n // ignore — fall through to --prompt or no prompt\n }\n }\n\n const config = ensureConfig();\n // Via the host unless told otherwise: one Claude that the terminal and\n // the dashboard both show. A direct launch is invisible to work web.\n const viaHost = (argv.host as boolean | undefined) ?? config.launchViaHost ?? true;\n\n /**\n * Launch the AI tool, continuing the previous conversation for this\n * directory when there is one. `--continue` errors out (\"No conversation\n * found to continue\") in a directory the tool has never run in, so the flag\n * is gated on an existing transcript.\n */\n const launchTool = async (dir: string, port: number | undefined, sessionKey: { target: string; branch: string }): Promise<void> => {\n if (viaHost) {\n const session = findSession(loadHistory(), sessionKey.target, sessionKey.branch);\n if (session) {\n // The host decides --continue itself (the agent's own canResume\n // gate); `fresh` and the prompt ride along on the first spawn.\n process.exitCode = await attachSession(session, {\n fresh,\n initialPrompt,\n forwardEnv: true,\n });\n return;\n }\n console.log(chalk.yellow('Session not found in history — launching directly instead of via the PTY host.'));\n }\n // The session's agent: what to run, and whether it can resume here.\n const own = findSession(loadHistory(), sessionKey.target, sessionKey.branch);\n const agent = agentFor(config, own);\n const tool = agent.launch.tool(config);\n // The session's account: its conversations are in that account's folder, and the agent starts on it.\n const resume = !fresh && agent.launch.canResume(dir, { session: own });\n if (resume) {\n console.log(chalk.gray(`Continuing the previous ${tool.cmd} conversation (--fresh starts a new one).`));\n }\n // Started normally now: a launchedUnsafe from before the retirement no longer describes it — unless that agent\n // still runs in another terminal, which keeps the flag and its guards (legacy-unsafe.ts; remove next release).\n clearLaunchedUnsafeWhenIdle(sessionKey.target, sessionKey.branch);\n console.log(`Starting ${tool.cmd}...`);\n // With work's hooks for this process (--settings), never the user's settings' (agents/session-hooks.ts).\n launchAi(dir, sessionToolFor(tool), { initialPrompt, resume }, port, ...envArgs(agent.launch.env?.(own ?? null)));\n };\n\n // --pr: the PR's repo and branch, and a first prompt saying whose branch it is.\n const prArg = argv.pr as string | undefined;\n if (prArg !== undefined) {\n if (branchName || here || !isEmptyBaseSpec(baseSpec)) {\n console.error(\"--pr takes the PR's own branch: don't combine it with a branch, --here or --base.\");\n process.exitCode = 1;\n return;\n }\n const found = await resolvePrToStart(prArg, config, targetName);\n if (!found.ok) {\n console.error(found.error);\n process.exitCode = 1;\n return;\n }\n targetName = found.pr.alias;\n branchName = found.pr.branch;\n // The PR's context goes to a new session only (with your --prompt as what to do): back in\n // one, your --prompt goes as it is, and nothing re-sends the first message.\n if (!findSession(loadHistory(), targetName, branchName)) initialPrompt = workOnPrPrompt(found.pr, initialPrompt);\n console.log(\n chalk.cyan(`PR #${found.pr.number} by @${found.pr.author || '?'}: ${found.pr.title}, on its branch ${branchName} in ${targetName}`),\n );\n }\n\n // --here: infer target and branch from the current worktree directory\n if (here) {\n if (targetName) {\n console.error('Cannot combine --here with an explicit target.');\n process.exitCode = 1;\n return;\n }\n const inferred = resolveFromCwd(config, process.cwd(), loadHistory());\n if ('error' in inferred) {\n console.error(inferred.error);\n process.exitCode = 1;\n return;\n }\n targetName = inferred.target;\n branchName = inferred.isBaseRepo ? undefined : inferred.branch;\n console.log(chalk.cyan(`Resolved from current directory: ${targetName}${branchName ? ' @ ' + branchName : ' (base repo)'}`));\n } else if (!targetName) {\n console.error('Specify a target, or use --here to infer it from the current directory.');\n process.exitCode = 1;\n return;\n }\n\n // --base requires a branch name\n if (!isEmptyBaseSpec(baseSpec) && !branchName) {\n console.error('--base requires a branch name');\n console.log(chalk.yellow(`Usage: work tree ${targetName} <branch> --base <base>`));\n process.exitCode = 1;\n return;\n }\n\n // Resolve project target (for validation and base-repo handling)\n const target = resolveProjectTarget(targetName, config);\n if (!target) {\n const allNames = getAllTargetNames(config);\n console.error(`Project or group not found: ${targetName}`);\n console.log(chalk.yellow(`Available: ${allNames.join(', ')}`));\n console.log(chalk.yellow('Add a new project with: work config add <alias> <path>'));\n process.exitCode = 1;\n return;\n }\n\n // The branch the repo's own folder is on can't be checked out a second time: asking for it means that folder.\n if (branchName && isEmptyBaseSpec(baseSpec) && !target.isGroup && ownsBranch(targetName, branchName, config)) {\n console.log(chalk.gray(`${branchName} is the branch ${targetName}'s own folder is on: opening it there.`));\n branchName = undefined;\n }\n\n // No branch specified — work directly on the base repo\n if (!branchName) {\n if (target.isGroup) {\n console.error('Branch is required for group targets.');\n console.log(chalk.yellow(`Usage: work tree ${targetName} <branch>`));\n process.exitCode = 1;\n return;\n }\n\n console.log(chalk.cyan(`Working on base repo: ${targetName}`));\n const opened = await openBaseCheckout(targetName, config, {\n pull,\n issueKey,\n name: typeof argv.name === 'string' ? argv.name : undefined,\n account,\n });\n if (!opened.ok) {\n console.error(opened.error);\n process.exitCode = 1;\n return;\n }\n const { repoPath, branch: currentBranch } = opened;\n console.log(`Repo path: ${repoPath}`);\n if (opened.dropped.length) console.log(chalk.gray(`Replaced older entries for this checkout: ${opened.dropped.join(', ')}`));\n\n if (open) openVSCode(repoPath);\n if (!setupOnly) await launchTool(repoPath, undefined, { target: targetName, branch: currentBranch });\n return;\n }\n\n // Create/switch worktree via shared core logic\n const repos =\n typeof argv.repos === 'string'\n ? argv.repos\n .split(',')\n .map((a) => a.trim())\n .filter(Boolean)\n : [];\n const { value: result, warnings } = await keepingWarnings(() =>\n setupWorktree(targetName, branchName, config, baseSpec, issueKey, {\n pull,\n name: argv.name as string | undefined,\n ...(account ? { account } : {}),\n ...(repos.length ? { repos } : {}),\n }),\n );\n if (!result) {\n // Run by you (not work web's child, whose route says it): what keeps the old folder in use, by name.\n const left = setupOnly ? [] : leftoversOf(findSession(loadHistory(), targetName, branchName)?.paths ?? []);\n const open = await openInLeftovers(left);\n if (open.length) console.error(chalk.yellow(`Still open in its old folder: ${open.join(', ')}. Stop it and try again.`));\n process.exitCode = 1;\n return;\n }\n\n if (open) {\n for (const p of result.paths) {\n openVSCode(p);\n }\n }\n\n console.log(`Worktree path: ${result.launchDir}`);\n // work web's child: what it warned about, for the dashboard (it reads only this line).\n if (setupOnly) console.log(`${SETUP_WARNINGS}${JSON.stringify(warnings)}`);\n if (!setupOnly) {\n await launchTool(result.launchDir, result.port, { target: targetName, branch: branchName });\n }\n },\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ;AAEf,OAAO,WAAW;AAmBX,IAAM,cAA6B;AAAA,EACxC,SAAS,CAAC,0BAA0B,qBAAqB;AAAA,EACzD,UAAU;AAAA,EACV,SAAS,CAAC,UACR,MACG,eAAe,IAAI,EACnB,WAAW,UAAU;AAAA,IACpB,UAAU;AAAA,IACV,MAAM;AAAA,EACR,CAAC,EACA,WAAW,UAAU;AAAA,IACpB,UAAU;AAAA,IACV,MAAM;AAAA,EACR,CAAC,EACA,OAAO,QAAQ;AAAA,IACd,UAAU;AAAA,IACV,MAAM;AAAA,IACN,SAAS;AAAA,EACX,CAAC,EACA,OAAO,QAAQ;AAAA,IACd,UAAU;AAAA,IACV,MAAM;AAAA,IACN,SAAS;AAAA,EACX,CAAC,EACA,OAAO,UAAU,mBAAmB,EACpC,OAAO,QAAQ;AAAA,IACd,UAAU;AAAA,IACV,MAAM;AAAA,IACN,SAAS;AAAA,EACX,CAAC,EACA,OAAO,QAAQ;AAAA,IACd,UACE;AAAA,IACF,MAAM;AAAA,EACR,CAAC,EACA,OAAO,SAAS;AAAA,IACf,UAAU;AAAA,IACV,MAAM;AAAA,IACN,SAAS;AAAA,EACX,CAAC,EACA,OAAO,QAAQ;AAAA,IACd,UACE;AAAA,IACF,MAAM;AAAA,EACR,CAAC,EACA,OAAO,UAAU;AAAA,IAChB,UAAU;AAAA,IACV,MAAM;AAAA,EACR,CAAC,EACA,OAAO,eAAe;AAAA,IACrB,UAAU;AAAA,IACV,MAAM;AAAA,EACR,CAAC,EACA,OAAO,MAAM;AAAA,IACZ,UACE;AAAA,IACF,MAAM;AAAA,EACR,CAAC,EACA,OAAO,QAAQ;AAAA,IACd,UAAU;AAAA,IACV,MAAM;AAAA,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A,IACH;AACA,QAAI,CAAC,QAAQ;AAEX,YAAM,OAAO,YAAY,CAAC,IAAI,YAAY,YAAY,YAAY,GAAG,YAAY,UAAU,GAAG,SAAS,CAAC,CAAC;AACzG,YAAMA,QAAO,MAAM,gBAAgB,IAAI;AACvC,UAAIA,MAAK,OAAQ,SAAQ,MAAM,MAAM,OAAO,iCAAiCA,MAAK,KAAK,IAAI,CAAC,0BAA0B,CAAC;AACvH,cAAQ,WAAW;AACnB;AAAA,IACF;AAEA,QAAI,MAAM;AACR,iBAAW,KAAK,OAAO,OAAO;AAC5B,mBAAW,CAAC;AAAA,MACd;AAAA,IACF;AAEA,YAAQ,IAAI,kBAAkB,OAAO,SAAS,EAAE;AAEhD,QAAI,UAAW,SAAQ,IAAI,GAAG,cAAc,GAAG,KAAK,UAAU,QAAQ,CAAC,EAAE;AACzE,QAAI,CAAC,WAAW;AACd,YAAM,WAAW,OAAO,WAAW,OAAO,MAAM,EAAE,QAAQ,YAAY,QAAQ,WAAW,CAAC;AAAA,IAC5F;AAAA,EACF;AACF;","names":["open"]}
|
|
@@ -1,36 +1,39 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
updateSession
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-U4INTLIY.js";
|
|
5
|
+
import "./chunk-XFWO5FYK.js";
|
|
6
6
|
import {
|
|
7
7
|
sessionFromArgs,
|
|
8
8
|
sessionPositionals
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-ARQSFOYE.js";
|
|
10
10
|
import "./chunk-6AQRYLOB.js";
|
|
11
|
-
import "./chunk-
|
|
11
|
+
import "./chunk-XPX5AAYH.js";
|
|
12
12
|
import "./chunk-ZSHWP2VS.js";
|
|
13
13
|
import "./chunk-CNZV3UCM.js";
|
|
14
14
|
import "./chunk-HUXS3VAI.js";
|
|
15
|
-
import "./chunk-
|
|
16
|
-
import "./chunk-
|
|
17
|
-
import "./chunk-
|
|
15
|
+
import "./chunk-EP7LCLHB.js";
|
|
16
|
+
import "./chunk-TI2CNJLD.js";
|
|
17
|
+
import "./chunk-JPXEX3XW.js";
|
|
18
18
|
import "./chunk-FGPXMAYU.js";
|
|
19
|
-
import "./chunk-
|
|
19
|
+
import "./chunk-QHFUCX2J.js";
|
|
20
20
|
import "./chunk-GNIYYXQX.js";
|
|
21
21
|
import "./chunk-T5GJVUSL.js";
|
|
22
22
|
import "./chunk-XBWS77S2.js";
|
|
23
23
|
import "./chunk-4CXUVBOD.js";
|
|
24
|
-
import "./chunk-
|
|
24
|
+
import "./chunk-D77U5ELL.js";
|
|
25
25
|
import "./chunk-NEJVK5CF.js";
|
|
26
26
|
import "./chunk-ALBTIOP3.js";
|
|
27
|
-
import "./chunk-
|
|
28
|
-
import "./chunk-
|
|
29
|
-
import "./chunk-
|
|
27
|
+
import "./chunk-O22DNTKU.js";
|
|
28
|
+
import "./chunk-KGHWHAVF.js";
|
|
29
|
+
import "./chunk-WIYDT3PY.js";
|
|
30
|
+
import "./chunk-YQSWVHKK.js";
|
|
31
|
+
import "./chunk-JUGF3YE7.js";
|
|
30
32
|
import "./chunk-HK6AZQ5Z.js";
|
|
31
33
|
import "./chunk-7334DEPX.js";
|
|
32
34
|
import "./chunk-MWIPHUAE.js";
|
|
33
|
-
import "./chunk-
|
|
35
|
+
import "./chunk-HGB7BITW.js";
|
|
36
|
+
import "./chunk-BR6OWWAA.js";
|
|
34
37
|
import "./chunk-VHENFC2S.js";
|
|
35
38
|
import "./chunk-QOSAWNOU.js";
|
|
36
39
|
import "./chunk-D2J3AD6L.js";
|
|
@@ -71,4 +74,4 @@ var updateCommand = {
|
|
|
71
74
|
export {
|
|
72
75
|
updateCommand
|
|
73
76
|
};
|
|
74
|
-
//# sourceMappingURL=update-
|
|
77
|
+
//# sourceMappingURL=update-LSDD3ZDO.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/commands/update.ts"],"sourcesContent":["import chalk from 'chalk';\nimport type { CommandModule } from 'yargs';\nimport { updateSession } from '../core/stacks/session-update.js';\nimport { sessionFromArgs, sessionPositionals } from './shared/session-arg.js';\n\n/**\n * `work update` — the dashboard's Update from main / Update from <parent> /\n * Move onto main (session-update.ts): whichever the session needs.\n */\nexport const updateCommand: CommandModule = {\n command: 'update [target] [branch]',\n describe: \"Bring a session's branch up to date: from main, from the session it is stacked on, or onto main once that one merged\",\n builder: (yargs) => sessionPositionals(yargs),\n handler: async (argv) => {\n const s = sessionFromArgs(argv);\n if (!s) return;\n const r = await updateSession(s);\n if (!r.ok) {\n console.error(chalk.red(r.error));\n process.exitCode = 1;\n return;\n }\n const what = r.how === 'onto-main' ? `onto main (${r.base} merged)` : r.how === 'parent' ? `from ${r.base}` : 'from main';\n console.log(chalk.cyan(`Updating ${s.target} · ${s.branch} ${what}…`));\n for (const x of r.results) {\n if (!x.ok) console.log(chalk.red(` ${x.repo}: ${x.reason}`));\n else if (x.how === 'nothing') console.log(chalk.gray(` ${x.repo}: already up to date`));\n else\n console.log(\n chalk.green(\n ` ${x.repo}: ${x.how === 'rebase' ? 'rebased on' : 'merged'} ${x.base} (${x.commits} commit${x.commits === 1 ? '' : 's'})`,\n ),\n );\n }\n if (r.results.some((x) => !x.ok)) process.exitCode = 1;\n },\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/commands/update.ts"],"sourcesContent":["import chalk from 'chalk';\nimport type { CommandModule } from 'yargs';\nimport { updateSession } from '../core/stacks/session-update.js';\nimport { sessionFromArgs, sessionPositionals } from './shared/session-arg.js';\n\n/**\n * `work update` — the dashboard's Update from main / Update from <parent> /\n * Move onto main (session-update.ts): whichever the session needs.\n */\nexport const updateCommand: CommandModule = {\n command: 'update [target] [branch]',\n describe: \"Bring a session's branch up to date: from main, from the session it is stacked on, or onto main once that one merged\",\n builder: (yargs) => sessionPositionals(yargs),\n handler: async (argv) => {\n const s = sessionFromArgs(argv);\n if (!s) return;\n const r = await updateSession(s);\n if (!r.ok) {\n console.error(chalk.red(r.error));\n process.exitCode = 1;\n return;\n }\n const what = r.how === 'onto-main' ? `onto main (${r.base} merged)` : r.how === 'parent' ? `from ${r.base}` : 'from main';\n console.log(chalk.cyan(`Updating ${s.target} · ${s.branch} ${what}…`));\n for (const x of r.results) {\n if (!x.ok) console.log(chalk.red(` ${x.repo}: ${x.reason}`));\n else if (x.how === 'nothing') console.log(chalk.gray(` ${x.repo}: already up to date`));\n else\n console.log(\n chalk.green(\n ` ${x.repo}: ${x.how === 'rebase' ? 'rebased on' : 'merged'} ${x.base} (${x.commits} commit${x.commits === 1 ? '' : 's'})`,\n ),\n );\n }\n if (r.results.some((x) => !x.ok)) process.exitCode = 1;\n },\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,WAAW;AASX,IAAM,gBAA+B;AAAA,EAC1C,SAAS;AAAA,EACT,UAAU;AAAA,EACV,SAAS,CAAC,UAAU,mBAAmB,KAAK;AAAA,EAC5C,SAAS,OAAO,SAAS;AACvB,UAAM,IAAI,gBAAgB,IAAI;AAC9B,QAAI,CAAC,EAAG;AACR,UAAM,IAAI,MAAM,cAAc,CAAC;AAC/B,QAAI,CAAC,EAAE,IAAI;AACT,cAAQ,MAAM,MAAM,IAAI,EAAE,KAAK,CAAC;AAChC,cAAQ,WAAW;AACnB;AAAA,IACF;AACA,UAAM,OAAO,EAAE,QAAQ,cAAc,cAAc,EAAE,IAAI,aAAa,EAAE,QAAQ,WAAW,QAAQ,EAAE,IAAI,KAAK;AAC9G,YAAQ,IAAI,MAAM,KAAK,YAAY,EAAE,MAAM,SAAM,EAAE,MAAM,IAAI,IAAI,QAAG,CAAC;AACrE,eAAW,KAAK,EAAE,SAAS;AACzB,UAAI,CAAC,EAAE,GAAI,SAAQ,IAAI,MAAM,IAAI,KAAK,EAAE,IAAI,KAAK,EAAE,MAAM,EAAE,CAAC;AAAA,eACnD,EAAE,QAAQ,UAAW,SAAQ,IAAI,MAAM,KAAK,KAAK,EAAE,IAAI,sBAAsB,CAAC;AAAA;AAErF,gBAAQ;AAAA,UACN,MAAM;AAAA,YACJ,KAAK,EAAE,IAAI,KAAK,EAAE,QAAQ,WAAW,eAAe,QAAQ,IAAI,EAAE,IAAI,KAAK,EAAE,OAAO,UAAU,EAAE,YAAY,IAAI,KAAK,GAAG;AAAA,UAC1H;AAAA,QACF;AAAA,IACJ;AACA,QAAI,EAAE,QAAQ,KAAK,CAAC,MAAM,CAAC,EAAE,EAAE,EAAG,SAAQ,WAAW;AAAA,EACvD;AACF;","names":[]}
|
|
@@ -2,25 +2,29 @@
|
|
|
2
2
|
import {
|
|
3
3
|
buildUsage,
|
|
4
4
|
realUsageDeps,
|
|
5
|
+
refreshUsage,
|
|
5
6
|
restoreAgentUsage
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
7
|
+
} from "./chunk-CZWZMRQ3.js";
|
|
8
|
+
import "./chunk-PLTFWTIE.js";
|
|
8
9
|
import {
|
|
9
10
|
formatTokens,
|
|
10
11
|
resetPhrase
|
|
11
|
-
} from "./chunk-
|
|
12
|
-
import "./chunk-
|
|
12
|
+
} from "./chunk-LK7HJGUC.js";
|
|
13
|
+
import "./chunk-D77U5ELL.js";
|
|
13
14
|
import "./chunk-NEJVK5CF.js";
|
|
14
15
|
import "./chunk-ALBTIOP3.js";
|
|
15
16
|
import {
|
|
16
17
|
knownAgents
|
|
17
|
-
} from "./chunk-
|
|
18
|
-
import "./chunk-
|
|
19
|
-
import "./chunk-
|
|
18
|
+
} from "./chunk-O22DNTKU.js";
|
|
19
|
+
import "./chunk-KGHWHAVF.js";
|
|
20
|
+
import "./chunk-WIYDT3PY.js";
|
|
21
|
+
import "./chunk-YQSWVHKK.js";
|
|
22
|
+
import "./chunk-JUGF3YE7.js";
|
|
20
23
|
import "./chunk-HK6AZQ5Z.js";
|
|
21
24
|
import "./chunk-7334DEPX.js";
|
|
22
25
|
import "./chunk-MWIPHUAE.js";
|
|
23
|
-
import "./chunk-
|
|
26
|
+
import "./chunk-HGB7BITW.js";
|
|
27
|
+
import "./chunk-BR6OWWAA.js";
|
|
24
28
|
import "./chunk-VHENFC2S.js";
|
|
25
29
|
import "./chunk-QOSAWNOU.js";
|
|
26
30
|
import "./chunk-D2J3AD6L.js";
|
|
@@ -41,7 +45,7 @@ function usageLines(w, now = Date.now()) {
|
|
|
41
45
|
if (a.accounts.length > 1) lines.push(chalk.gray(` account ${acc.account}${acc.isDefault ? " (default)" : ""}`));
|
|
42
46
|
for (const win of acc.windows) {
|
|
43
47
|
const pct = `${Math.round(win.usedPercent)}%`;
|
|
44
|
-
lines.push(` ${win.label.padEnd(
|
|
48
|
+
lines.push(` ${win.label.padEnd(18)} ${pct.padStart(4)} ${chalk.gray(resetPhrase(win.resetsAt, now))}`);
|
|
45
49
|
}
|
|
46
50
|
}
|
|
47
51
|
}
|
|
@@ -73,6 +77,7 @@ var usageCommand = {
|
|
|
73
77
|
if (done.some((d) => !d.ok)) process.exitCode = 1;
|
|
74
78
|
return;
|
|
75
79
|
}
|
|
80
|
+
await refreshUsage(knownAgents());
|
|
76
81
|
const wire = await buildUsage(realUsageDeps());
|
|
77
82
|
if (argv.json) {
|
|
78
83
|
console.log(JSON.stringify(wire, null, 2));
|
|
@@ -85,4 +90,4 @@ export {
|
|
|
85
90
|
usageCommand,
|
|
86
91
|
usageLines
|
|
87
92
|
};
|
|
88
|
-
//# sourceMappingURL=usage-
|
|
93
|
+
//# sourceMappingURL=usage-CTT5CMQK.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/usage.ts"],"sourcesContent":["import chalk from 'chalk';\nimport type { CommandModule } from 'yargs';\nimport { buildUsage, realUsageDeps, refreshUsage } from '../core/usage/usage-source.js';\nimport { formatTokens, resetPhrase } from '../core/usage/usage.js';\nimport type { TokenTotals, UsageWire } from '../core/api-types.js';\nimport { knownAgents } from '../core/agents/index.js';\nimport { restoreAgentUsage } from '../core/usage/usage-setup.js';\n\n/**\n * `work usage` — each agent's plan limits (as its status line last reported\n * them) and the tokens work saw in the sessions' transcripts (core/usage/).\n */\n\nconst totals = (t: TokenTotals) => `${formatTokens(t.input)} in · ${formatTokens(t.cached)} cached · ${formatTokens(t.output)} out`;\n\n/** The wire as the lines `work usage` prints. */\nexport function usageLines(w: UsageWire, now = Date.now()): string[] {\n const lines: string[] = [];\n for (const a of w.agents) {\n lines.push(chalk.bold(a.name));\n const readings = a.accounts.filter((acc) => acc.windows.length > 0);\n if (readings.length === 0) lines.push(chalk.gray(' no reading yet — its next session records one'));\n for (const acc of readings) {\n if (a.accounts.length > 1) lines.push(chalk.gray(` account ${acc.account}${acc.isDefault ? ' (default)' : ''}`));\n for (const win of acc.windows) {\n const pct = `${Math.round(win.usedPercent)}%`;\n lines.push(` ${win.label.padEnd(18)} ${pct.padStart(4)} ${chalk.gray(resetPhrase(win.resetsAt, now))}`);\n }\n }\n }\n if (w.agents.length === 0) lines.push(chalk.gray('No agent reports its usage limits.'));\n lines.push('', chalk.bold('Tokens'), ` today ${totals(w.tokens.today)}`, ` this week ${totals(w.tokens.week)}`);\n const isZero = (t: TokenTotals) => t.input + t.cached + t.output === 0;\n for (const m of w.tokens.byModel) {\n // A model unused today shows only its week.\n const parts = [isZero(m.today) ? '' : `${totals(m.today)} today`, isZero(m.week) ? '' : `${totals(m.week)} this week`].filter(Boolean);\n if (parts.length > 0) lines.push(chalk.gray(` ${m.model}: ${parts.join(' · ')}`));\n }\n if (w.tokens.topSessions.length > 0) {\n lines.push('', chalk.bold('Top sessions this week'));\n for (const s of w.tokens.topSessions) lines.push(` ${formatTokens(s.week.input + s.week.output).padStart(7)} ${s.label}`);\n }\n return lines;\n}\n\nexport const usageCommand: CommandModule = {\n command: 'usage',\n describe: \"Plan limits (5-hour, weekly) as the agent's status line last reported them, and the tokens used today and this week\",\n builder: (yargs) =>\n yargs\n .option('json', { type: 'boolean', describe: 'Print the same data the dashboard shows, as JSON' })\n .option('restore', {\n type: 'boolean',\n describe:\n 'Give each agent back the setting work reads its limits from (Claude Code: its own status line). work web sets it up again unless config usage.statusLine is false',\n })\n // Its first name, from before it covered every agent.\n .option('restore-statusline', { type: 'boolean', hidden: true }),\n handler: async (argv) => {\n if (argv.restore || argv['restore-statusline']) {\n const done = await restoreAgentUsage(knownAgents());\n if (done.length === 0) console.log('No agent has a usage setting to give back.');\n for (const d of done) console.log(`${d.name}: ${d.message}`);\n if (done.some((d) => !d.ok)) process.exitCode = 1;\n return;\n }\n await refreshUsage(knownAgents());\n const wire = await buildUsage(realUsageDeps());\n if (argv.json) {\n console.log(JSON.stringify(wire, null, 2));\n return;\n }\n for (const l of usageLines(wire)) console.log(l);\n },\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,WAAW;AAalB,IAAM,SAAS,CAAC,MAAmB,GAAG,aAAa,EAAE,KAAK,CAAC,YAAS,aAAa,EAAE,MAAM,CAAC,gBAAa,aAAa,EAAE,MAAM,CAAC;AAGtH,SAAS,WAAW,GAAc,MAAM,KAAK,IAAI,GAAa;AACnE,QAAM,QAAkB,CAAC;AACzB,aAAW,KAAK,EAAE,QAAQ;AACxB,UAAM,KAAK,MAAM,KAAK,EAAE,IAAI,CAAC;AAC7B,UAAM,WAAW,EAAE,SAAS,OAAO,CAAC,QAAQ,IAAI,QAAQ,SAAS,CAAC;AAClE,QAAI,SAAS,WAAW,EAAG,OAAM,KAAK,MAAM,KAAK,sDAAiD,CAAC;AACnG,eAAW,OAAO,UAAU;AAC1B,UAAI,EAAE,SAAS,SAAS,EAAG,OAAM,KAAK,MAAM,KAAK,aAAa,IAAI,OAAO,GAAG,IAAI,YAAY,eAAe,EAAE,EAAE,CAAC;AAChH,iBAAW,OAAO,IAAI,SAAS;AAC7B,cAAM,MAAM,GAAG,KAAK,MAAM,IAAI,WAAW,CAAC;AAC1C,cAAM,KAAK,KAAK,IAAI,MAAM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CAAC,EAEA,OAAO,sBAAsB,EAAE,MAAM,WAAW,QAAQ,KAAK,CAAC;AAAA,EACnE,SAAS,OAAO,SAAS;AACvB,QAAI,KAAK,WAAW,KAAK,oBAAoB,GAAG;AAC9C,YAAM,OAAO,MAAM,kBAAkB,YAAY,CAAC;AAClD,UAAI,KAAK,WAAW,EAAG,SAAQ,IAAI,4CAA4C;AAC/E,iBAAW,KAAK,KAAM,SAAQ,IAAI,GAAG,EAAE,IAAI,KAAK,EAAE,OAAO,EAAE;AAC3D,UAAI,KAAK,KAAK,CAAC,MAAM,CAAC,EAAE,EAAE,EAAG,SAAQ,WAAW;AAChD;AAAA,IACF;AACA,UAAM,aAAa,YAAY,CAAC;AAChC,UAAM,OAAO,MAAM,WAAW,cAAc,CAAC;AAC7C,QAAI,KAAK,MAAM;AACb,cAAQ,IAAI,KAAK,UAAU,MAAM,MAAM,CAAC,CAAC;AACzC;AAAA,IACF;AACA,eAAW,KAAK,WAAW,IAAI,EAAG,SAAQ,IAAI,CAAC;AAAA,EACjD;AACF;","names":[]}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
withoutParentSession
|
|
4
|
+
} from "./chunk-KGHWHAVF.js";
|
|
5
|
+
import {
|
|
6
|
+
applyEnvDelta,
|
|
7
|
+
internalRunEnv
|
|
8
|
+
} from "./chunk-YQSWVHKK.js";
|
|
9
|
+
import {
|
|
10
|
+
recordReading
|
|
11
|
+
} from "./chunk-JUGF3YE7.js";
|
|
12
|
+
import {
|
|
13
|
+
accountEnv,
|
|
14
|
+
isLoggedIn,
|
|
15
|
+
setUpAccounts
|
|
16
|
+
} from "./chunk-7334DEPX.js";
|
|
17
|
+
import "./chunk-MWIPHUAE.js";
|
|
18
|
+
import {
|
|
19
|
+
accountOf,
|
|
20
|
+
clampPercent,
|
|
21
|
+
labelOf
|
|
22
|
+
} from "./chunk-BR6OWWAA.js";
|
|
23
|
+
import {
|
|
24
|
+
spawn_default
|
|
25
|
+
} from "./chunk-QOSAWNOU.js";
|
|
26
|
+
import "./chunk-D2J3AD6L.js";
|
|
27
|
+
import "./chunk-5ZCCUM75.js";
|
|
28
|
+
import {
|
|
29
|
+
debugLog
|
|
30
|
+
} from "./chunk-IAKOKZYW.js";
|
|
31
|
+
import "./chunk-F2ECTTSY.js";
|
|
32
|
+
|
|
33
|
+
// src/core/agents/claude/usage-ask.ts
|
|
34
|
+
import os from "os";
|
|
35
|
+
var USAGE_ASK_ARGS = [
|
|
36
|
+
"-p",
|
|
37
|
+
"--input-format",
|
|
38
|
+
"stream-json",
|
|
39
|
+
"--output-format",
|
|
40
|
+
"stream-json",
|
|
41
|
+
"--verbose",
|
|
42
|
+
"--setting-sources",
|
|
43
|
+
"",
|
|
44
|
+
"--no-session-persistence",
|
|
45
|
+
"--strict-mcp-config"
|
|
46
|
+
];
|
|
47
|
+
var REQUEST_ID = "work-usage";
|
|
48
|
+
var USAGE_ASK_REQUEST = JSON.stringify({
|
|
49
|
+
type: "control_request",
|
|
50
|
+
request_id: REQUEST_ID,
|
|
51
|
+
request: { subtype: "get_usage", skip_behaviors: true }
|
|
52
|
+
});
|
|
53
|
+
var ASK_EVERY_MS = 5 * 6e4;
|
|
54
|
+
var ASK_TIMEOUT_MS = 2e4;
|
|
55
|
+
var isRecord = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
56
|
+
function resetIso(v) {
|
|
57
|
+
if (typeof v !== "string" || v.trim() === "") return null;
|
|
58
|
+
const ms = Date.parse(v);
|
|
59
|
+
return Number.isFinite(ms) ? new Date(ms).toISOString() : null;
|
|
60
|
+
}
|
|
61
|
+
var slug = (name) => name.toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_|_$/g, "");
|
|
62
|
+
var ACCOUNT_KEYS = ["five_hour", "seven_day"];
|
|
63
|
+
var MODEL_KEYS = ["seven_day_opus", "seven_day_sonnet"];
|
|
64
|
+
function parseUsageAnswer(stdout) {
|
|
65
|
+
for (const line of stdout.split("\n")) {
|
|
66
|
+
if (!line.includes('"control_response"')) continue;
|
|
67
|
+
let v;
|
|
68
|
+
try {
|
|
69
|
+
v = JSON.parse(line);
|
|
70
|
+
} catch {
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
if (!isRecord(v) || v.type !== "control_response" || !isRecord(v.response)) continue;
|
|
74
|
+
const r = v.response;
|
|
75
|
+
if (r.subtype !== "success" || r.request_id !== REQUEST_ID || !isRecord(r.response)) continue;
|
|
76
|
+
const limits = r.response.rate_limits;
|
|
77
|
+
if (!isRecord(limits)) return null;
|
|
78
|
+
const windows = [];
|
|
79
|
+
const add = (id, label, w, asked) => {
|
|
80
|
+
if (!isRecord(w) || typeof w.utilization !== "number" || !Number.isFinite(w.utilization)) return;
|
|
81
|
+
windows.push({
|
|
82
|
+
id,
|
|
83
|
+
label,
|
|
84
|
+
usedPercent: clampPercent(w.utilization),
|
|
85
|
+
resetsAt: resetIso(w.resets_at),
|
|
86
|
+
...asked ? { asked: true } : {}
|
|
87
|
+
});
|
|
88
|
+
};
|
|
89
|
+
for (const key of ACCOUNT_KEYS) add(key, labelOf(key), limits[key], false);
|
|
90
|
+
for (const key of MODEL_KEYS) add(key, labelOf(key), limits[key], true);
|
|
91
|
+
if (Array.isArray(limits.model_scoped)) {
|
|
92
|
+
for (const m of limits.model_scoped) {
|
|
93
|
+
if (!isRecord(m) || typeof m.display_name !== "string" || !m.display_name.trim()) continue;
|
|
94
|
+
const name = m.display_name.trim().slice(0, 40);
|
|
95
|
+
const id = `seven_day_model_${slug(name)}`;
|
|
96
|
+
if (windows.some((w) => w.id === id)) continue;
|
|
97
|
+
add(id, `Weekly ${name} limit`, m, true);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return windows;
|
|
101
|
+
}
|
|
102
|
+
return null;
|
|
103
|
+
}
|
|
104
|
+
var runAsk = (env) => new Promise((resolve, reject) => {
|
|
105
|
+
const child = spawn_default("claude", USAGE_ASK_ARGS, { cwd: os.tmpdir(), env, stdio: ["pipe", "pipe", "pipe"], windowsHide: true });
|
|
106
|
+
let out = "";
|
|
107
|
+
const timer = setTimeout(() => child.kill(), ASK_TIMEOUT_MS);
|
|
108
|
+
timer.unref?.();
|
|
109
|
+
child.stdout?.setEncoding("utf8");
|
|
110
|
+
child.stdout?.on("data", (d) => {
|
|
111
|
+
out += d;
|
|
112
|
+
if (out.includes(`"request_id":"${REQUEST_ID}"`) && out.endsWith("\n")) child.kill();
|
|
113
|
+
});
|
|
114
|
+
child.stderr?.resume();
|
|
115
|
+
child.on("error", (e) => {
|
|
116
|
+
clearTimeout(timer);
|
|
117
|
+
reject(e);
|
|
118
|
+
});
|
|
119
|
+
child.on("close", () => {
|
|
120
|
+
clearTimeout(timer);
|
|
121
|
+
resolve(out);
|
|
122
|
+
});
|
|
123
|
+
child.stdin?.on("error", () => void 0);
|
|
124
|
+
child.stdin?.end(`${USAGE_ASK_REQUEST}
|
|
125
|
+
`);
|
|
126
|
+
});
|
|
127
|
+
function askEnv(account, base = process.env) {
|
|
128
|
+
const env = withoutParentSession({ ...applyEnvDelta(base, accountEnv(account)), ...internalRunEnv() });
|
|
129
|
+
for (const k of Object.keys(env)) if (/^ANTHROPIC_(API_KEY|AUTH_TOKEN)$/i.test(k)) delete env[k];
|
|
130
|
+
return env;
|
|
131
|
+
}
|
|
132
|
+
var lastAsked = /* @__PURE__ */ new Map();
|
|
133
|
+
function resetUsageAsks() {
|
|
134
|
+
lastAsked.clear();
|
|
135
|
+
}
|
|
136
|
+
async function askClaudeUsage(o = {}) {
|
|
137
|
+
const now = o.now ?? Date.now();
|
|
138
|
+
const run = o.run ?? runAsk;
|
|
139
|
+
const loggedIn = o.loggedIn ?? isLoggedIn;
|
|
140
|
+
let accounts;
|
|
141
|
+
try {
|
|
142
|
+
accounts = o.accounts ?? setUpAccounts();
|
|
143
|
+
} catch (e) {
|
|
144
|
+
debugLog("WARN", `[usage] accounts not read for asking: ${e instanceof Error ? e.message : String(e)}`);
|
|
145
|
+
return [];
|
|
146
|
+
}
|
|
147
|
+
const due = accounts.filter((a) => loggedIn(a.dir) !== false && now - (lastAsked.get(a.name) ?? -Infinity) >= ASK_EVERY_MS);
|
|
148
|
+
for (const a of due) lastAsked.set(a.name, now);
|
|
149
|
+
const done = await Promise.all(
|
|
150
|
+
due.map(async (a) => {
|
|
151
|
+
try {
|
|
152
|
+
const windows = parseUsageAnswer(await run(askEnv(a.name)));
|
|
153
|
+
if (!windows || windows.length === 0) {
|
|
154
|
+
debugLog("INFO", `[usage] ${a.name}: Claude Code gave no usage answer (get_usage)`);
|
|
155
|
+
return null;
|
|
156
|
+
}
|
|
157
|
+
recordReading("claude", accountOf(a.dir), windows, now, { full: true });
|
|
158
|
+
return a.name;
|
|
159
|
+
} catch (e) {
|
|
160
|
+
debugLog("WARN", `[usage] ${a.name}: asking Claude Code for usage failed: ${e instanceof Error ? e.message : String(e)}`);
|
|
161
|
+
return null;
|
|
162
|
+
}
|
|
163
|
+
})
|
|
164
|
+
);
|
|
165
|
+
return done.filter((n) => n !== null);
|
|
166
|
+
}
|
|
167
|
+
export {
|
|
168
|
+
ASK_EVERY_MS,
|
|
169
|
+
USAGE_ASK_ARGS,
|
|
170
|
+
USAGE_ASK_REQUEST,
|
|
171
|
+
askClaudeUsage,
|
|
172
|
+
askEnv,
|
|
173
|
+
parseUsageAnswer,
|
|
174
|
+
resetUsageAsks
|
|
175
|
+
};
|
|
176
|
+
//# sourceMappingURL=usage-ask-YJNTOGXY.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/core/agents/claude/usage-ask.ts"],"sourcesContent":["import os from 'node:os';\nimport spawn from '../../platform/spawn.js';\nimport { applyEnvDelta } from '../../platform/env-delta.js';\nimport { internalRunEnv } from '../../platform/internal-run.js';\nimport { debugLog } from '../../platform/logger.js';\nimport { recordReading } from '../../usage/usage-store.js';\nimport { accountEnv, isLoggedIn, setUpAccounts, type ClaudeAccount } from './accounts.js';\nimport { withoutParentSession } from './env.js';\nimport { accountOf, clampPercent, labelOf } from './rate-limits.js';\nimport type { UsageWindow } from '../../usage/usage.js';\n\n/**\n * Asking Claude Code for its plan limits, as `/usage` shows them. Its status line (rate-limits.ts) carries only the\n * 5-hour and weekly windows; a model's own weekly window (Fable's: `/usage`'s \"Current week (Fable)\") is in no status\n * line and no rate-limit event. Claude Code tells it when asked, through a `get_usage` control request written to\n * `claude -p --input-format stream-json --output-format stream-json --verbose` with no prompt: no model is asked, it\n * costs nothing and answers in about a second, signed in as the account's sessions are (no token of ours).\n *\n * Measured on 2.1.330 (2026-11-21, Windows; the request as Novadeck found it on 2.1.323): the answer's\n * `rate_limits.model_scoped` lists each model's window by `display_name` with `utilization` (0–100) and an ISO\n * `resets_at`; `five_hour` and `seven_day` are there too, and `seven_day_opus` / `seven_day_sonnet` where the plan has\n * them (else null). It is undocumented: an answer that doesn't fit gives no reading, and the status line's stay.\n *\n * The run loads none of the user's settings, hooks, plugins or MCP servers (`--setting-sources \"\"`,\n * `--strict-mcp-config`), keeps no session (`--no-session-persistence`), starts in a neutral folder, and goes without\n * `ANTHROPIC_API_KEY` / `ANTHROPIC_AUTH_TOKEN` (print mode would take them; the plan's limits are the login's).\n */\n\nexport const USAGE_ASK_ARGS = [\n '-p',\n '--input-format',\n 'stream-json',\n '--output-format',\n 'stream-json',\n '--verbose',\n '--setting-sources',\n '',\n '--no-session-persistence',\n '--strict-mcp-config',\n];\n\nconst REQUEST_ID = 'work-usage';\n\n/** The one line written to the run's input. */\nexport const USAGE_ASK_REQUEST = JSON.stringify({\n type: 'control_request',\n request_id: REQUEST_ID,\n request: { subtype: 'get_usage', skip_behaviors: true },\n});\n\n/** How often an account is asked at most: GET /api/usage asks, and it comes on every reading the status line writes. */\nexport const ASK_EVERY_MS = 5 * 60_000;\n\n/** A run that hasn't answered by then is stopped. */\nconst ASK_TIMEOUT_MS = 20_000;\n\nconst isRecord = (v: unknown): v is Record<string, unknown> => typeof v === 'object' && v !== null && !Array.isArray(v);\n\nfunction resetIso(v: unknown): string | null {\n if (typeof v !== 'string' || v.trim() === '') return null;\n const ms = Date.parse(v);\n return Number.isFinite(ms) ? new Date(ms).toISOString() : null;\n}\n\n/** `Fable` → `fable`, `Opus 4` → `opus_4`: a model window's id part. */\nconst slug = (name: string) =>\n name\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, '_')\n .replace(/^_|_$/g, '');\n\n/** The account-wide windows the status line also gives, and the per-model ones it doesn't (`asked`). */\nconst ACCOUNT_KEYS = ['five_hour', 'seven_day'];\nconst MODEL_KEYS = ['seven_day_opus', 'seven_day_sonnet'];\n\n/** The windows in a `get_usage` answer (the run's stdout, one JSON object per line); null when no answer fits. */\nexport function parseUsageAnswer(stdout: string): UsageWindow[] | null {\n for (const line of stdout.split('\\n')) {\n if (!line.includes('\"control_response\"')) continue;\n let v: unknown;\n try {\n v = JSON.parse(line);\n } catch {\n continue;\n }\n if (!isRecord(v) || v.type !== 'control_response' || !isRecord(v.response)) continue;\n const r = v.response;\n if (r.subtype !== 'success' || r.request_id !== REQUEST_ID || !isRecord(r.response)) continue;\n const limits = r.response.rate_limits;\n if (!isRecord(limits)) return null;\n const windows: UsageWindow[] = [];\n const add = (id: string, label: string, w: unknown, asked: boolean) => {\n if (!isRecord(w) || typeof w.utilization !== 'number' || !Number.isFinite(w.utilization)) return;\n windows.push({\n id,\n label,\n usedPercent: clampPercent(w.utilization),\n resetsAt: resetIso(w.resets_at),\n ...(asked ? { asked: true } : {}),\n });\n };\n for (const key of ACCOUNT_KEYS) add(key, labelOf(key), limits[key], false);\n for (const key of MODEL_KEYS) add(key, labelOf(key), limits[key], true);\n if (Array.isArray(limits.model_scoped)) {\n for (const m of limits.model_scoped) {\n if (!isRecord(m) || typeof m.display_name !== 'string' || !m.display_name.trim()) continue;\n const name = m.display_name.trim().slice(0, 40);\n const id = `seven_day_model_${slug(name)}`;\n if (windows.some((w) => w.id === id)) continue;\n add(id, `Weekly ${name} limit`, m, true);\n }\n }\n return windows;\n }\n return null;\n}\n\n/** Runs the ask with `env` and gives back what it printed (rejects when it couldn't run). Injectable for tests. */\nexport type UsageAskRun = (env: NodeJS.ProcessEnv) => Promise<string>;\n\nconst runAsk: UsageAskRun = (env) =>\n new Promise((resolve, reject) => {\n const child = spawn('claude', USAGE_ASK_ARGS, { cwd: os.tmpdir(), env, stdio: ['pipe', 'pipe', 'pipe'], windowsHide: true });\n let out = '';\n const timer = setTimeout(() => child.kill(), ASK_TIMEOUT_MS);\n timer.unref?.();\n child.stdout?.setEncoding('utf8');\n child.stdout?.on('data', (d: string) => {\n out += d;\n // The answer is all we wanted: don't wait for it to wind down.\n if (out.includes(`\"request_id\":\"${REQUEST_ID}\"`) && out.endsWith('\\n')) child.kill();\n });\n child.stderr?.resume();\n child.on('error', (e) => {\n clearTimeout(timer);\n reject(e);\n });\n child.on('close', () => {\n clearTimeout(timer);\n resolve(out);\n });\n child.stdin?.on('error', () => undefined); // it may exit before reading\n child.stdin?.end(`${USAGE_ASK_REQUEST}\\n`);\n });\n\n/** The environment an account is asked in: its config folder, work's internal-run marker, no API key and no parent session. */\nexport function askEnv(account: string, base: NodeJS.ProcessEnv = process.env): NodeJS.ProcessEnv {\n const env = withoutParentSession({ ...applyEnvDelta(base, accountEnv(account)), ...internalRunEnv() }) as NodeJS.ProcessEnv;\n for (const k of Object.keys(env)) if (/^ANTHROPIC_(API_KEY|AUTH_TOKEN)$/i.test(k)) delete env[k];\n return env;\n}\n\nconst lastAsked = new Map<string, number>();\n\n/** Forget when each account was asked (tests). */\nexport function resetUsageAsks(): void {\n lastAsked.clear();\n}\n\n/**\n * Ask each signed-in account not asked in the last ASK_EVERY_MS and keep its answer as the account's reading (a full\n * one: it replaces the status line's, `asked` windows included). Never throws; returns the accounts it recorded.\n */\nexport async function askClaudeUsage(\n o: { now?: number; run?: UsageAskRun; accounts?: ClaudeAccount[]; loggedIn?: (dir: string) => boolean | null } = {},\n): Promise<string[]> {\n const now = o.now ?? Date.now();\n const run = o.run ?? runAsk;\n const loggedIn = o.loggedIn ?? isLoggedIn;\n let accounts: ClaudeAccount[];\n try {\n accounts = o.accounts ?? setUpAccounts();\n } catch (e) {\n debugLog('WARN', `[usage] accounts not read for asking: ${e instanceof Error ? e.message : String(e)}`);\n return [];\n }\n const due = accounts.filter((a) => loggedIn(a.dir) !== false && now - (lastAsked.get(a.name) ?? -Infinity) >= ASK_EVERY_MS);\n for (const a of due) lastAsked.set(a.name, now);\n const done = await Promise.all(\n due.map(async (a) => {\n try {\n const windows = parseUsageAnswer(await run(askEnv(a.name)));\n if (!windows || windows.length === 0) {\n debugLog('INFO', `[usage] ${a.name}: Claude Code gave no usage answer (get_usage)`);\n return null;\n }\n // Kept under the key the status-line hook uses for this folder (~/.claude: `default`).\n recordReading('claude', accountOf(a.dir), windows, now, { full: true });\n return a.name;\n } catch (e) {\n debugLog('WARN', `[usage] ${a.name}: asking Claude Code for usage failed: ${e instanceof Error ? e.message : String(e)}`);\n return null;\n }\n }),\n );\n return done.filter((n): n is string => n !== null);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ;AA4BR,IAAM,iBAAiB;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEA,IAAM,aAAa;AAGZ,IAAM,oBAAoB,KAAK,UAAU;AAAA,EAC9C,MAAM;AAAA,EACN,YAAY;AAAA,EACZ,SAAS,EAAE,SAAS,aAAa,gBAAgB,KAAK;AACxD,CAAC;AAGM,IAAM,eAAe,IAAI;AAGhC,IAAM,iBAAiB;AAEvB,IAAM,WAAW,CAAC,MAA6C,OAAO,MAAM,YAAY,MAAM,QAAQ,CAAC,MAAM,QAAQ,CAAC;AAEtH,SAAS,SAAS,GAA2B;AAC3C,MAAI,OAAO,MAAM,YAAY,EAAE,KAAK,MAAM,GAAI,QAAO;AACr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,eAAO,EAAE;AAAA,MACX,SAAS,GAAG;AACV,iBAAS,QAAQ,WAAW,EAAE,IAAI,0CAA0C,aAAa,QAAQ,EAAE,UAAU,OAAO,CAAC,CAAC,EAAE;AACxH,eAAO;AAAA,MACT;AAAA,IACF,CAAC;AAAA,EACH;AACA,SAAO,KAAK,OAAO,CAAC,MAAmB,MAAM,IAAI;AACnD;","names":[]}
|
|
@@ -9,7 +9,8 @@ import {
|
|
|
9
9
|
} from "./chunk-4CXUVBOD.js";
|
|
10
10
|
import {
|
|
11
11
|
READ_ONLY_MIN_VERSION
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-WIYDT3PY.js";
|
|
13
|
+
import "./chunk-YQSWVHKK.js";
|
|
13
14
|
import "./chunk-7334DEPX.js";
|
|
14
15
|
import "./chunk-MWIPHUAE.js";
|
|
15
16
|
import {
|
|
@@ -113,4 +114,4 @@ export {
|
|
|
113
114
|
parseClaudeVersion,
|
|
114
115
|
runVersion
|
|
115
116
|
};
|
|
116
|
-
//# sourceMappingURL=version-
|
|
117
|
+
//# sourceMappingURL=version-6UJN2CCE.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/core/agents/claude/version.ts"],"sourcesContent":["import fs from 'node:fs';\nimport os from 'node:os';\nimport { findOnPath } from '../../platform/find-on-path.js';\nimport { launchFor } from '../../platform/batch-launch.js';\nimport spawn from '../../platform/spawn.js';\nimport { killTreeAsync } from '../../platform/process.js';\nimport { installTime } from '../../pty/agent-restart.js';\nimport { READ_ONLY_MIN_VERSION } from './internal.js';\n\n/**\n * Which Claude Code is installed, for the read-only review run (internal.ts, `internalClaudeReadOnlySpawn`): its\n * isolation rests on flags measured on one version — `--restricted`, `--setting-sources user`,\n * CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD. An older Claude Code may not know them, or not keep them as measured,\n * so below that version (or one that can't be told) the checkout run is skipped and the Reviews AI step reads the diff\n * alone (review-queue.ts says why in Activity).\n */\n\n/** How long `claude --version` may take. */\nexport const VERSION_TIMEOUT_MS = 10_000;\n\n/** How long an answer is kept even when nothing about the binary seems to have changed: a backstop for an update the\n * stamp can't see. */\nexport const VERSION_TTL_MS = 10 * 60_000;\n\n/** `2.1.317 (Claude Code)` → [2, 1, 317]; null when there's no version in it. Pure. */\nexport function parseClaudeVersion(text: string): [number, number, number] | null {\n const m = /(\\d+)\\.(\\d+)\\.(\\d+)/.exec(text);\n return m ? [Number(m[1]), Number(m[2]), Number(m[3])] : null;\n}\n\n/** a ≥ b, part by part. Pure. */\nexport function atLeast(a: [number, number, number], b: [number, number, number]): boolean {\n for (let i = 0; i < 3; i++) if (a[i] !== b[i]) return a[i] > b[i];\n return true;\n}\n\nexport interface VersionIo {\n /** The file `claude` runs (null: not on PATH). */\n find: () => string | null;\n /** What identifies the installed binary (`binaryStamp`; null: can't be read — then nothing is remembered). */\n stamp: (file: string) => string | null;\n /** `claude --version`'s output (null: it failed or timed out). */\n version: (file: string) => Promise<string | null>;\n /** The clock (for the TTL). */\n now?: () => number;\n}\n\n/**\n * The file `claude` really runs (links followed: `~/.local/bin/claude` → `versions/2.1.296`), when it was installed\n * (`installTime`: npm unpacks every file dated 1985, so its mtime alone never moves on an npm update) and its size:\n * an update changes at least one. Null when it can't be read.\n */\nexport function binaryStamp(file: string): string | null {\n try {\n const real = fs.realpathSync(file);\n const st = fs.statSync(real);\n return `${real}|${installTime(st)}|${st.size}`;\n } catch {\n return null;\n }\n}\n\n/** `<file> --version`, with a timeout: what it printed, or null. */\nexport function runVersion(file: string): Promise<string | null> {\n return new Promise((resolve) => {\n const launch = launchFor(file, ['--version']);\n if ('refused' in launch) return resolve(null);\n let out = '';\n let settled = false;\n const done = (v: string | null) => {\n if (settled) return;\n settled = true;\n clearTimeout(timer);\n resolve(v);\n };\n const child = spawn(launch.cmd, launch.args, { cwd: os.tmpdir(), windowsHide: true, stdio: ['ignore', 'pipe', 'ignore'] });\n const timer = setTimeout(() => {\n // A .cmd shim runs under cmd.exe: the tree goes, not only the shell.\n if (child.pid) void killTreeAsync(child.pid);\n else child.kill();\n done(null);\n }, VERSION_TIMEOUT_MS);\n child.stdout?.on('data', (d: Buffer) => (out += d.toString()));\n child.on('error', () => done(null));\n child.on('close', (code) => done(code === 0 ? out : null));\n });\n}\n\nconst realIo: VersionIo = {\n find: () => findOnPath('claude'),\n stamp: binaryStamp,\n version: runVersion,\n};\n\n/** Asked once per binary (its stamp), for at most VERSION_TTL_MS: an update of Claude Code is asked again. */\nconst cache = new Map<string, { at: number; answer: Promise<{ ok: boolean; why?: string }> }>();\n\n/**\n * Whether the installed Claude Code may run the read-only review: at least READ_ONLY_MIN_VERSION. Unknown — not on\n * PATH, `--version` failing or saying nothing parseable — is no.\n */\nexport function claudeReadOnlyAvailable(io: VersionIo = realIo): Promise<{ ok: boolean; why?: string }> {\n const file = io.find();\n if (!file) return Promise.resolve({ ok: false, why: \"Claude Code's version can't be told (claude isn't on PATH)\" });\n const stamp = io.stamp(file);\n const now = io.now ?? Date.now;\n const key = stamp ? `${file}|${stamp}` : null;\n const known = key ? cache.get(key) : undefined;\n if (known && now() - known.at < VERSION_TTL_MS) return known.answer;\n const asked = io.version(file).then((text): { ok: boolean; why?: string } => {\n const v = text ? parseClaudeVersion(text) : null;\n if (!v) return { ok: false, why: \"Claude Code's version can't be told (claude --version gave none)\" };\n const min = parseClaudeVersion(READ_ONLY_MIN_VERSION)!;\n return atLeast(v, min)\n ? { ok: true }\n : {\n ok: false,\n why: `Claude Code ${v.join('.')} is older than ${READ_ONLY_MIN_VERSION}, the version its read-only flags were measured on`,\n };\n });\n // A binary that can't be identified isn't remembered at all, and a failure to ask not for good: the next review\n // asks again (the binary may be fine a moment later).\n if (!key) return asked;\n const entry = { at: now(), answer: asked };\n cache.set(key, entry);\n void asked.then((r) => {\n if (!r.ok && r.why?.includes(\"can't be told\") && cache.get(key) === entry) cache.delete(key);\n });\n return asked;\n}\n\n/** For tests: forget what was asked. */\nexport function forgetClaudeVersions(): void {\n cache.clear();\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/core/agents/claude/version.ts"],"sourcesContent":["import fs from 'node:fs';\nimport os from 'node:os';\nimport { findOnPath } from '../../platform/find-on-path.js';\nimport { launchFor } from '../../platform/batch-launch.js';\nimport spawn from '../../platform/spawn.js';\nimport { killTreeAsync } from '../../platform/process.js';\nimport { installTime } from '../../pty/agent-restart.js';\nimport { READ_ONLY_MIN_VERSION } from './internal.js';\n\n/**\n * Which Claude Code is installed, for the read-only review run (internal.ts, `internalClaudeReadOnlySpawn`): its\n * isolation rests on flags measured on one version — `--restricted`, `--setting-sources user`,\n * CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD. An older Claude Code may not know them, or not keep them as measured,\n * so below that version (or one that can't be told) the checkout run is skipped and the Reviews AI step reads the diff\n * alone (review-queue.ts says why in Activity).\n */\n\n/** How long `claude --version` may take. */\nexport const VERSION_TIMEOUT_MS = 10_000;\n\n/** How long an answer is kept even when nothing about the binary seems to have changed: a backstop for an update the\n * stamp can't see. */\nexport const VERSION_TTL_MS = 10 * 60_000;\n\n/** `2.1.317 (Claude Code)` → [2, 1, 317]; null when there's no version in it. Pure. */\nexport function parseClaudeVersion(text: string): [number, number, number] | null {\n const m = /(\\d+)\\.(\\d+)\\.(\\d+)/.exec(text);\n return m ? [Number(m[1]), Number(m[2]), Number(m[3])] : null;\n}\n\n/** a ≥ b, part by part. Pure. */\nexport function atLeast(a: [number, number, number], b: [number, number, number]): boolean {\n for (let i = 0; i < 3; i++) if (a[i] !== b[i]) return a[i] > b[i];\n return true;\n}\n\nexport interface VersionIo {\n /** The file `claude` runs (null: not on PATH). */\n find: () => string | null;\n /** What identifies the installed binary (`binaryStamp`; null: can't be read — then nothing is remembered). */\n stamp: (file: string) => string | null;\n /** `claude --version`'s output (null: it failed or timed out). */\n version: (file: string) => Promise<string | null>;\n /** The clock (for the TTL). */\n now?: () => number;\n}\n\n/**\n * The file `claude` really runs (links followed: `~/.local/bin/claude` → `versions/2.1.296`), when it was installed\n * (`installTime`: npm unpacks every file dated 1985, so its mtime alone never moves on an npm update) and its size:\n * an update changes at least one. Null when it can't be read.\n */\nexport function binaryStamp(file: string): string | null {\n try {\n const real = fs.realpathSync(file);\n const st = fs.statSync(real);\n return `${real}|${installTime(st)}|${st.size}`;\n } catch {\n return null;\n }\n}\n\n/** `<file> --version`, with a timeout: what it printed, or null. */\nexport function runVersion(file: string): Promise<string | null> {\n return new Promise((resolve) => {\n const launch = launchFor(file, ['--version']);\n if ('refused' in launch) return resolve(null);\n let out = '';\n let settled = false;\n const done = (v: string | null) => {\n if (settled) return;\n settled = true;\n clearTimeout(timer);\n resolve(v);\n };\n const child = spawn(launch.cmd, launch.args, { cwd: os.tmpdir(), windowsHide: true, stdio: ['ignore', 'pipe', 'ignore'] });\n const timer = setTimeout(() => {\n // A .cmd shim runs under cmd.exe: the tree goes, not only the shell.\n if (child.pid) void killTreeAsync(child.pid);\n else child.kill();\n done(null);\n }, VERSION_TIMEOUT_MS);\n child.stdout?.on('data', (d: Buffer) => (out += d.toString()));\n child.on('error', () => done(null));\n child.on('close', (code) => done(code === 0 ? out : null));\n });\n}\n\nconst realIo: VersionIo = {\n find: () => findOnPath('claude'),\n stamp: binaryStamp,\n version: runVersion,\n};\n\n/** Asked once per binary (its stamp), for at most VERSION_TTL_MS: an update of Claude Code is asked again. */\nconst cache = new Map<string, { at: number; answer: Promise<{ ok: boolean; why?: string }> }>();\n\n/**\n * Whether the installed Claude Code may run the read-only review: at least READ_ONLY_MIN_VERSION. Unknown — not on\n * PATH, `--version` failing or saying nothing parseable — is no.\n */\nexport function claudeReadOnlyAvailable(io: VersionIo = realIo): Promise<{ ok: boolean; why?: string }> {\n const file = io.find();\n if (!file) return Promise.resolve({ ok: false, why: \"Claude Code's version can't be told (claude isn't on PATH)\" });\n const stamp = io.stamp(file);\n const now = io.now ?? Date.now;\n const key = stamp ? `${file}|${stamp}` : null;\n const known = key ? cache.get(key) : undefined;\n if (known && now() - known.at < VERSION_TTL_MS) return known.answer;\n const asked = io.version(file).then((text): { ok: boolean; why?: string } => {\n const v = text ? parseClaudeVersion(text) : null;\n if (!v) return { ok: false, why: \"Claude Code's version can't be told (claude --version gave none)\" };\n const min = parseClaudeVersion(READ_ONLY_MIN_VERSION)!;\n return atLeast(v, min)\n ? { ok: true }\n : {\n ok: false,\n why: `Claude Code ${v.join('.')} is older than ${READ_ONLY_MIN_VERSION}, the version its read-only flags were measured on`,\n };\n });\n // A binary that can't be identified isn't remembered at all, and a failure to ask not for good: the next review\n // asks again (the binary may be fine a moment later).\n if (!key) return asked;\n const entry = { at: now(), answer: asked };\n cache.set(key, entry);\n void asked.then((r) => {\n if (!r.ok && r.why?.includes(\"can't be told\") && cache.get(key) === entry) cache.delete(key);\n });\n return asked;\n}\n\n/** For tests: forget what was asked. */\nexport function forgetClaudeVersions(): void {\n cache.clear();\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ;AACf,OAAO,QAAQ;AAiBR,IAAM,qBAAqB;AAI3B,IAAM,iBAAiB,KAAK;AAG5B,SAAS,mBAAmB,MAA+C;AAChF,QAAM,IAAI,sBAAsB,KAAK,IAAI;AACzC,SAAO,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,GAAG,OAAO,EAAE,CAAC,CAAC,GAAG,OAAO,EAAE,CAAC,CAAC,CAAC,IAAI;AAC1D;AAGO,SAAS,QAAQ,GAA6B,GAAsC;AACzF,WAAS,IAAI,GAAG,IAAI,GAAG,IAAK,KAAI,EAAE,CAAC,MAAM,EAAE,CAAC,EAAG,QAAO,EAAE,CAAC,IAAI,EAAE,CAAC;AAChE,SAAO;AACT;AAkBO,SAAS,YAAY,MAA6B;AACvD,MAAI;AACF,UAAM,OAAO,GAAG,aAAa,IAAI;AACjC,UAAM,KAAK,GAAG,SAAS,IAAI;AAC3B,WAAO,GAAG,IAAI,IAAI,YAAY,EAAE,CAAC,IAAI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