@moberg_hr/work-tree 2.23.2 → 2.23.4
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-6ZQ3VFA2.js → account-TSSDZ7HI.js} +26 -27
- package/dist/{account-6ZQ3VFA2.js.map → account-TSSDZ7HI.js.map} +1 -1
- package/dist/{add-repo-WXDEKZRX.js → add-repo-X6BY6Y7G.js} +20 -21
- package/dist/{add-repo-WXDEKZRX.js.map → add-repo-X6BY6Y7G.js.map} +1 -1
- package/dist/{answer-L55DWMR5.js → answer-44MKEQDP.js} +12 -12
- package/dist/{attach-KLVI7BHS.js → attach-4442NY36.js} +21 -22
- package/dist/{attach-KLVI7BHS.js.map → attach-4442NY36.js.map} +1 -1
- package/dist/bin.js +4 -4
- package/dist/{block-BRNRP226.js → block-KH7GT6KC.js} +17 -18
- package/dist/{block-BRNRP226.js.map → block-KH7GT6KC.js.map} +1 -1
- package/dist/{broadcast-GQE7H3MF.js → broadcast-RHPRE6OM.js} +10 -10
- package/dist/{catchup-ZMG4OWF2.js → catchup-POW3OD2J.js} +15 -15
- package/dist/{child-MPXXJ2QX.js → child-Y5H7NS7I.js} +18 -15
- package/dist/child-Y5H7NS7I.js.map +1 -0
- package/dist/{chunk-A53OR6P5.js → chunk-2TXH75I4.js} +7 -7
- package/dist/{chunk-HCYES6U7.js → chunk-32CMRR6M.js} +2 -2
- package/dist/{chunk-VQEMPGJL.js → chunk-4FCPWNZD.js} +2 -2
- package/dist/{chunk-PSALWCBD.js → chunk-4VQJQ6CO.js} +5 -5
- package/dist/{chunk-DK3UMOX7.js → chunk-55MJYS5Q.js} +2 -2
- package/dist/{chunk-773UJC5C.js → chunk-5C5NTOZT.js} +7 -7
- package/dist/{chunk-NREZVTBP.js → chunk-6ER6IBFJ.js} +2 -2
- package/dist/chunk-6SOIHZYE.js +9 -0
- package/dist/{chunk-MMEFW2PI.js → chunk-7FY6V6SF.js} +7 -7
- package/dist/{chunk-ZPDCVDE2.js → chunk-7GMENM2D.js} +2 -2
- package/dist/{chunk-JVOQSU6R.js → chunk-7L3D3SZA.js} +6 -6
- package/dist/{chunk-VPZ5ILKT.js → chunk-7VDNNWPU.js} +5 -5
- package/dist/{chunk-NWKVTUTN.js → chunk-B34R6TQO.js} +399 -192
- package/dist/chunk-B34R6TQO.js.map +1 -0
- package/dist/{chunk-6S3DYLGH.js → chunk-BLCQOJDB.js} +6 -6
- package/dist/{chunk-XB4SCJWD.js → chunk-BMZ4KPUT.js} +7 -7
- package/dist/{chunk-XIN6XUFL.js → chunk-D4XRXS3P.js} +2 -2
- package/dist/{chunk-2JLG65GB.js → chunk-D7ZWESWW.js} +3 -3
- package/dist/{chunk-KJAE7WO5.js → chunk-DIBXT67T.js} +2 -2
- package/dist/{chunk-VNZBFVGY.js → chunk-EFCWSWZK.js} +6 -6
- package/dist/{chunk-HBYXSFLN.js → chunk-F44FMA67.js} +5 -5
- package/dist/{chunk-BBI4YQTS.js → chunk-FC5WCLWJ.js} +18 -18
- package/dist/{chunk-MYXEX6BB.js → chunk-FCMPVWE7.js} +33 -10
- package/dist/chunk-FCMPVWE7.js.map +1 -0
- package/dist/{chunk-C5BBVVHW.js → chunk-FFRNSK4S.js} +2 -2
- package/dist/{chunk-ETWP7MDS.js → chunk-FX4KMK4M.js} +1 -1
- package/dist/chunk-FX4KMK4M.js.map +1 -0
- package/dist/{chunk-RGKGJOES.js → chunk-H2QFMDSU.js} +9 -9
- package/dist/{chunk-LOFGDH5B.js → chunk-IEKDHKGO.js} +2 -2
- package/dist/{chunk-EORL2V7P.js → chunk-IN52DQRN.js} +2 -2
- package/dist/{chunk-G4VKMMIC.js → chunk-IUOY42LA.js} +15 -15
- package/dist/{chunk-XT3FON6A.js → chunk-J5NSFIQ5.js} +5 -5
- package/dist/{chunk-HUGHF45U.js → chunk-JIQ2XXFX.js} +3 -3
- package/dist/{chunk-M2P722BR.js → chunk-JPUNYEQR.js} +2 -2
- package/dist/{chunk-T5GJVUSL.js → chunk-KBEP7BJP.js} +2 -2
- package/dist/chunk-KPAT46RL.js +21 -0
- package/dist/chunk-KPAT46RL.js.map +1 -0
- package/dist/{chunk-HO5KESIB.js → chunk-LC44HSCM.js} +4 -4
- package/dist/{chunk-NLU6MBYT.js → chunk-LCMLUSBQ.js} +12 -12
- package/dist/{chunk-SF3DIIKN.js → chunk-M7GVYIAB.js} +3 -3
- package/dist/{chunk-SUHANL3G.js → chunk-MC5T6J2V.js} +7 -7
- package/dist/{chunk-ZG6HB4BO.js → chunk-MFZRX6GM.js} +13 -17
- package/dist/chunk-MFZRX6GM.js.map +1 -0
- package/dist/{chunk-GNIYYXQX.js → chunk-MSXMX7C7.js} +2 -2
- package/dist/{chunk-XL4YNA3L.js → chunk-NIMROXWE.js} +22 -13
- package/dist/chunk-NIMROXWE.js.map +1 -0
- package/dist/{chunk-IUVMVNIO.js → chunk-NTBTO4SJ.js} +6 -6
- package/dist/{chunk-LW6VCL6S.js → chunk-NUWP3CGK.js} +7 -7
- package/dist/{chunk-NS7WH53I.js → chunk-O45NATRC.js} +2 -2
- package/dist/{chunk-APHVSSLI.js → chunk-OJ23FAT5.js} +2 -2
- package/dist/{chunk-QAIG5FSQ.js → chunk-OOVYRRGT.js} +3 -3
- package/dist/{chunk-XBWS77S2.js → chunk-OTY7XB5J.js} +2 -2
- package/dist/chunk-OU3BTWR6.js +482 -0
- package/dist/chunk-OU3BTWR6.js.map +1 -0
- package/dist/{chunk-MYASALCU.js → chunk-OYNVFQM5.js} +9 -9
- package/dist/{chunk-QMWV4UKB.js → chunk-PLEILEF4.js} +3 -3
- package/dist/{chunk-WH6DAD6D.js → chunk-PX7BDJQV.js} +2 -2
- package/dist/{chunk-GF7RAQFD.js → chunk-QNLWGTNI.js} +3 -3
- package/dist/{chunk-KWJ6S4NZ.js → chunk-S5Z247FI.js} +9 -9
- package/dist/{chunk-BGQ6NUU7.js → chunk-S77BGUVD.js} +4 -4
- package/dist/{chunk-K6FD5WDW.js → chunk-UGZ6WBYP.js} +8 -8
- package/dist/{chunk-QSSCVTFG.js → chunk-UVRGRMN4.js} +4 -4
- package/dist/{chunk-7HQSILMM.js → chunk-V4RNP62T.js} +4 -4
- package/dist/{chunk-7BH2PUYY.js → chunk-W3OU74ER.js} +5 -5
- package/dist/{chunk-CRAGAIOS.js → chunk-W4KMOS7T.js} +11 -11
- package/dist/{chunk-LCYYJFSZ.js → chunk-WD7XHWRQ.js} +5 -5
- package/dist/{chunk-ZHK5XOV5.js → chunk-XMWMC5R2.js} +60 -60
- package/dist/{chunk-BZOYUBK4.js → chunk-XXOOR3IV.js} +6 -6
- package/dist/{chunk-ED6YLB4S.js → chunk-YQSWVHKK.js} +13 -13
- package/dist/chunk-YQSWVHKK.js.map +1 -0
- package/dist/{chunk-DNC2ZJOF.js → chunk-ZCRIGDCK.js} +7 -7
- package/dist/{chunk-P53UYZZ4.js → chunk-ZU2265JN.js} +2 -2
- package/dist/{cleanup-DRELB6UC.js → cleanup-HTM3VX4O.js} +38 -40
- package/dist/{cleanup-DRELB6UC.js.map → cleanup-HTM3VX4O.js.map} +1 -1
- package/dist/{cli-C3U2BC44.js → cli-6UA7NFOP.js} +4 -4
- package/dist/{color-T75ANAWG.js → color-GLNALQJU.js} +14 -14
- package/dist/{config-KI6JOXKW.js → config-MC6A5AOY.js} +16 -17
- package/dist/{config-KI6JOXKW.js.map → config-MC6A5AOY.js.map} +1 -1
- package/dist/{coordinate-4PPZN4U4.js → coordinate-JRJX7LN6.js} +26 -16
- package/dist/coordinate-JRJX7LN6.js.map +1 -0
- package/dist/{diff-NDZPRQV7.js → diff-ABQL4OGG.js} +15 -16
- package/dist/{diff-NDZPRQV7.js.map → diff-ABQL4OGG.js.map} +1 -1
- package/dist/{digest-H5YFX5WR.js → digest-K5LVRZJ2.js} +12 -12
- package/dist/{fork-HHHATXVI.js → fork-SYSHOZEC.js} +33 -35
- package/dist/{fork-HHHATXVI.js.map → fork-SYSHOZEC.js.map} +1 -1
- package/dist/{history-3Z7AS2AC.js → history-UPV5FKKH.js} +10 -10
- package/dist/{hook-KOK7NKCO.js → hook-HKZEOBBJ.js} +31 -24
- package/dist/hook-HKZEOBBJ.js.map +1 -0
- package/dist/{hydrate-VI3XSZQH.js → hydrate-W6LXQTDU.js} +11 -11
- package/dist/{init-7NOKRHNJ.js → init-DXALHRTW.js} +18 -19
- package/dist/{init-7NOKRHNJ.js.map → init-DXALHRTW.js.map} +1 -1
- package/dist/{install-skills-TL5D7HZU.js → install-skills-COQUL6LG.js} +11 -9
- package/dist/install-skills-bin.js +10 -8
- package/dist/install-skills-bin.js.map +1 -1
- package/dist/{keep-G62GSDOQ.js → keep-5725FMZD.js} +12 -12
- package/dist/{list-CEVAZQ4V.js → list-HCD535CS.js} +11 -11
- package/dist/{move-ISAW6RDM.js → move-I46P3OHI.js} +24 -25
- package/dist/{move-ISAW6RDM.js.map → move-I46P3OHI.js.map} +1 -1
- package/dist/{note-YIVFXTGM.js → note-EJMRTSDZ.js} +12 -12
- package/dist/{overlaps-YBEHBRRK.js → overlaps-7KFBI2B2.js} +18 -19
- package/dist/{overlaps-YBEHBRRK.js.map → overlaps-7KFBI2B2.js.map} +1 -1
- package/dist/{pin-J4IDSHRG.js → pin-QR3CSLIU.js} +13 -13
- package/dist/{pr-Z7CPBBGT.js → pr-IOWS2QWR.js} +26 -27
- package/dist/{pr-Z7CPBBGT.js.map → pr-IOWS2QWR.js.map} +1 -1
- package/dist/{prune-UA3UDZSM.js → prune-GUSIRD4X.js} +35 -37
- package/dist/{prune-UA3UDZSM.js.map → prune-GUSIRD4X.js.map} +1 -1
- package/dist/{pty-host-JIQUP62K.js → pty-host-BFPESGGA.js} +29 -32
- package/dist/{pty-host-JIQUP62K.js.map → pty-host-BFPESGGA.js.map} +1 -1
- package/dist/{read-DG4PCLFH.js → read-VL5G36JG.js} +17 -13
- package/dist/{read-DG4PCLFH.js.map → read-VL5G36JG.js.map} +1 -1
- package/dist/{recent-PGD6QYAH.js → recent-WXDFS3EQ.js} +21 -22
- package/dist/{recent-PGD6QYAH.js.map → recent-WXDFS3EQ.js.map} +1 -1
- package/dist/{remove-TPLA64HP.js → remove-FID7UAFE.js} +36 -38
- package/dist/{remove-TPLA64HP.js.map → remove-FID7UAFE.js.map} +1 -1
- package/dist/{report-K3OTT2ED.js → report-4ZFCDVGT.js} +16 -13
- package/dist/report-4ZFCDVGT.js.map +1 -0
- package/dist/{restart-477IX2JX.js → restart-NO3V563I.js} +14 -15
- package/dist/{restart-477IX2JX.js.map → restart-NO3V563I.js.map} +1 -1
- package/dist/{resume-OYBAJCYE.js → resume-HXJQMNLX.js} +21 -22
- package/dist/{resume-OYBAJCYE.js.map → resume-HXJQMNLX.js.map} +1 -1
- package/dist/{review-6PWFSBAO.js → review-F54E75RF.js} +11 -11
- package/dist/{review-now-AT2SPPRO.js → review-now-K3GBWULH.js} +2 -2
- package/dist/{run-XEHF2N4A.js → run-X7VJAHIA.js} +10 -10
- package/dist/{screen-SFU6TCDV.js → screen-2HPSFMT5.js} +12 -12
- package/dist/{search-VJ3BGWPX.js → search-XNWJXKLY.js} +10 -10
- package/dist/{section-ZLINSTGS.js → section-GF4S3RHQ.js} +14 -14
- package/dist/{send-NBP2WYBG.js → send-W3W42FBF.js} +26 -16
- package/dist/send-W3W42FBF.js.map +1 -0
- package/dist/{sessions-UT4I7A43.js → sessions-PQV6NZKZ.js} +31 -33
- package/dist/{sessions-UT4I7A43.js.map → sessions-PQV6NZKZ.js.map} +1 -1
- package/dist/{show-RK2EWOR6.js → show-75JNPHZZ.js} +11 -11
- package/dist/{snooze-T2WWIKZN.js → snooze-R3IISMDC.js} +12 -12
- package/dist/{start-AWHOIA3Q.js → start-PD6MO5H5.js} +12 -12
- package/dist/{state-HK67C4UA.js → state-KUP4OEXR.js} +2 -2
- package/dist/{status-QE2DA6RR.js → status-ZJDIGGFB.js} +15 -16
- package/dist/{status-QE2DA6RR.js.map → status-ZJDIGGFB.js.map} +1 -1
- package/dist/{statusline-Z5HLKDIA.js → statusline-SZPL3QBC.js} +5 -5
- package/dist/{statusline-hook-VPPS3PFO.js → statusline-hook-6BNEVENM.js} +4 -4
- package/dist/{stop-YOU3P3ZR.js → stop-CID5EBHG.js} +12 -12
- package/dist/{sync-74EFTPBJ.js → sync-VV4MLQ4Q.js} +35 -37
- package/dist/{sync-74EFTPBJ.js.map → sync-VV4MLQ4Q.js.map} +1 -1
- package/dist/{time-ZGMZZ5OY.js → time-THNKOLZK.js} +14 -14
- package/dist/{time-actions-VAGRSY5B.js → time-actions-6L4RQ3A7.js} +3 -3
- package/dist/{timesheet-N74LPF5M.js → timesheet-5DYIZGCM.js} +20 -21
- package/dist/{timesheet-N74LPF5M.js.map → timesheet-5DYIZGCM.js.map} +1 -1
- package/dist/{todo-UVKGOG7D.js → todo-VHYBQC3I.js} +2 -2
- package/dist/{tree-FXTCWC6D.js → tree-HCKKRJ6Y.js} +37 -39
- package/dist/{tree-FXTCWC6D.js.map → tree-HCKKRJ6Y.js.map} +1 -1
- package/dist/{update-5QSRHIWH.js → update-MJ4DQLAN.js} +20 -21
- package/dist/{update-5QSRHIWH.js.map → update-MJ4DQLAN.js.map} +1 -1
- package/dist/{usage-CW7CDFU3.js → usage-XLLVYWBE.js} +12 -12
- package/dist/{usage-ask-V2SIRW4F.js → usage-ask-QBLLIHE3.js} +11 -11
- package/dist/version-ATSNJMTH.js +31 -0
- package/dist/version-ATSNJMTH.js.map +1 -0
- package/dist/{wait-XXC3I6DK.js → wait-NIPHM5DN.js} +13 -13
- package/dist/wd-bin.js +3 -3
- package/dist/web/assets/{PtyView-BLTE5F3E.js → PtyView-DCwMId37.js} +2 -2
- package/dist/web/assets/{PtyView-BLTE5F3E.js.map → PtyView-DCwMId37.js.map} +1 -1
- package/dist/web/assets/{index-BiadbzE6.js → index-AQoEcgyy.js} +27 -27
- package/dist/web/assets/index-AQoEcgyy.js.map +1 -0
- package/dist/web/index.html +1 -1
- package/dist/{web-SUSR4IAK.js → web-NMS22ZDZ.js} +198 -92
- package/dist/web-NMS22ZDZ.js.map +1 -0
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/plugins/work-tree/skills/work-sessions/SKILL.md +35 -50
- package/dist/child-MPXXJ2QX.js.map +0 -1
- package/dist/chunk-4CXUVBOD.js +0 -76
- package/dist/chunk-4CXUVBOD.js.map +0 -1
- package/dist/chunk-BMPTUIP4.js +0 -105
- package/dist/chunk-BMPTUIP4.js.map +0 -1
- package/dist/chunk-DYKA3LO3.js +0 -9
- package/dist/chunk-ED6YLB4S.js.map +0 -1
- package/dist/chunk-ETWP7MDS.js.map +0 -1
- package/dist/chunk-MYXEX6BB.js.map +0 -1
- package/dist/chunk-NWKVTUTN.js.map +0 -1
- package/dist/chunk-SJBEIYLK.js +0 -16
- package/dist/chunk-SJBEIYLK.js.map +0 -1
- package/dist/chunk-TC3H7I6O.js +0 -196
- package/dist/chunk-TC3H7I6O.js.map +0 -1
- package/dist/chunk-TNJF7T33.js +0 -17
- package/dist/chunk-TNJF7T33.js.map +0 -1
- package/dist/chunk-XL4YNA3L.js.map +0 -1
- package/dist/chunk-ZG6HB4BO.js.map +0 -1
- package/dist/coordinate-4PPZN4U4.js.map +0 -1
- package/dist/hook-KOK7NKCO.js.map +0 -1
- package/dist/report-K3OTT2ED.js.map +0 -1
- package/dist/send-NBP2WYBG.js.map +0 -1
- package/dist/version-RJ4PCHPB.js +0 -117
- package/dist/version-RJ4PCHPB.js.map +0 -1
- package/dist/web/assets/index-BiadbzE6.js.map +0 -1
- package/dist/web-SUSR4IAK.js.map +0 -1
- /package/dist/{answer-L55DWMR5.js.map → answer-44MKEQDP.js.map} +0 -0
- /package/dist/{broadcast-GQE7H3MF.js.map → broadcast-RHPRE6OM.js.map} +0 -0
- /package/dist/{catchup-ZMG4OWF2.js.map → catchup-POW3OD2J.js.map} +0 -0
- /package/dist/{chunk-A53OR6P5.js.map → chunk-2TXH75I4.js.map} +0 -0
- /package/dist/{chunk-HCYES6U7.js.map → chunk-32CMRR6M.js.map} +0 -0
- /package/dist/{chunk-VQEMPGJL.js.map → chunk-4FCPWNZD.js.map} +0 -0
- /package/dist/{chunk-PSALWCBD.js.map → chunk-4VQJQ6CO.js.map} +0 -0
- /package/dist/{chunk-DK3UMOX7.js.map → chunk-55MJYS5Q.js.map} +0 -0
- /package/dist/{chunk-773UJC5C.js.map → chunk-5C5NTOZT.js.map} +0 -0
- /package/dist/{chunk-NREZVTBP.js.map → chunk-6ER6IBFJ.js.map} +0 -0
- /package/dist/{chunk-DYKA3LO3.js.map → chunk-6SOIHZYE.js.map} +0 -0
- /package/dist/{chunk-MMEFW2PI.js.map → chunk-7FY6V6SF.js.map} +0 -0
- /package/dist/{chunk-ZPDCVDE2.js.map → chunk-7GMENM2D.js.map} +0 -0
- /package/dist/{chunk-JVOQSU6R.js.map → chunk-7L3D3SZA.js.map} +0 -0
- /package/dist/{chunk-VPZ5ILKT.js.map → chunk-7VDNNWPU.js.map} +0 -0
- /package/dist/{chunk-6S3DYLGH.js.map → chunk-BLCQOJDB.js.map} +0 -0
- /package/dist/{chunk-XB4SCJWD.js.map → chunk-BMZ4KPUT.js.map} +0 -0
- /package/dist/{chunk-XIN6XUFL.js.map → chunk-D4XRXS3P.js.map} +0 -0
- /package/dist/{chunk-2JLG65GB.js.map → chunk-D7ZWESWW.js.map} +0 -0
- /package/dist/{chunk-KJAE7WO5.js.map → chunk-DIBXT67T.js.map} +0 -0
- /package/dist/{chunk-VNZBFVGY.js.map → chunk-EFCWSWZK.js.map} +0 -0
- /package/dist/{chunk-HBYXSFLN.js.map → chunk-F44FMA67.js.map} +0 -0
- /package/dist/{chunk-BBI4YQTS.js.map → chunk-FC5WCLWJ.js.map} +0 -0
- /package/dist/{chunk-C5BBVVHW.js.map → chunk-FFRNSK4S.js.map} +0 -0
- /package/dist/{chunk-RGKGJOES.js.map → chunk-H2QFMDSU.js.map} +0 -0
- /package/dist/{chunk-LOFGDH5B.js.map → chunk-IEKDHKGO.js.map} +0 -0
- /package/dist/{chunk-EORL2V7P.js.map → chunk-IN52DQRN.js.map} +0 -0
- /package/dist/{chunk-G4VKMMIC.js.map → chunk-IUOY42LA.js.map} +0 -0
- /package/dist/{chunk-XT3FON6A.js.map → chunk-J5NSFIQ5.js.map} +0 -0
- /package/dist/{chunk-HUGHF45U.js.map → chunk-JIQ2XXFX.js.map} +0 -0
- /package/dist/{chunk-M2P722BR.js.map → chunk-JPUNYEQR.js.map} +0 -0
- /package/dist/{chunk-T5GJVUSL.js.map → chunk-KBEP7BJP.js.map} +0 -0
- /package/dist/{chunk-HO5KESIB.js.map → chunk-LC44HSCM.js.map} +0 -0
- /package/dist/{chunk-NLU6MBYT.js.map → chunk-LCMLUSBQ.js.map} +0 -0
- /package/dist/{chunk-SF3DIIKN.js.map → chunk-M7GVYIAB.js.map} +0 -0
- /package/dist/{chunk-SUHANL3G.js.map → chunk-MC5T6J2V.js.map} +0 -0
- /package/dist/{chunk-GNIYYXQX.js.map → chunk-MSXMX7C7.js.map} +0 -0
- /package/dist/{chunk-IUVMVNIO.js.map → chunk-NTBTO4SJ.js.map} +0 -0
- /package/dist/{chunk-LW6VCL6S.js.map → chunk-NUWP3CGK.js.map} +0 -0
- /package/dist/{chunk-NS7WH53I.js.map → chunk-O45NATRC.js.map} +0 -0
- /package/dist/{chunk-APHVSSLI.js.map → chunk-OJ23FAT5.js.map} +0 -0
- /package/dist/{chunk-QAIG5FSQ.js.map → chunk-OOVYRRGT.js.map} +0 -0
- /package/dist/{chunk-XBWS77S2.js.map → chunk-OTY7XB5J.js.map} +0 -0
- /package/dist/{chunk-MYASALCU.js.map → chunk-OYNVFQM5.js.map} +0 -0
- /package/dist/{chunk-QMWV4UKB.js.map → chunk-PLEILEF4.js.map} +0 -0
- /package/dist/{chunk-WH6DAD6D.js.map → chunk-PX7BDJQV.js.map} +0 -0
- /package/dist/{chunk-GF7RAQFD.js.map → chunk-QNLWGTNI.js.map} +0 -0
- /package/dist/{chunk-KWJ6S4NZ.js.map → chunk-S5Z247FI.js.map} +0 -0
- /package/dist/{chunk-BGQ6NUU7.js.map → chunk-S77BGUVD.js.map} +0 -0
- /package/dist/{chunk-K6FD5WDW.js.map → chunk-UGZ6WBYP.js.map} +0 -0
- /package/dist/{chunk-QSSCVTFG.js.map → chunk-UVRGRMN4.js.map} +0 -0
- /package/dist/{chunk-7HQSILMM.js.map → chunk-V4RNP62T.js.map} +0 -0
- /package/dist/{chunk-7BH2PUYY.js.map → chunk-W3OU74ER.js.map} +0 -0
- /package/dist/{chunk-CRAGAIOS.js.map → chunk-W4KMOS7T.js.map} +0 -0
- /package/dist/{chunk-LCYYJFSZ.js.map → chunk-WD7XHWRQ.js.map} +0 -0
- /package/dist/{chunk-ZHK5XOV5.js.map → chunk-XMWMC5R2.js.map} +0 -0
- /package/dist/{chunk-BZOYUBK4.js.map → chunk-XXOOR3IV.js.map} +0 -0
- /package/dist/{chunk-DNC2ZJOF.js.map → chunk-ZCRIGDCK.js.map} +0 -0
- /package/dist/{chunk-P53UYZZ4.js.map → chunk-ZU2265JN.js.map} +0 -0
- /package/dist/{cli-C3U2BC44.js.map → cli-6UA7NFOP.js.map} +0 -0
- /package/dist/{color-T75ANAWG.js.map → color-GLNALQJU.js.map} +0 -0
- /package/dist/{digest-H5YFX5WR.js.map → digest-K5LVRZJ2.js.map} +0 -0
- /package/dist/{history-3Z7AS2AC.js.map → history-UPV5FKKH.js.map} +0 -0
- /package/dist/{hydrate-VI3XSZQH.js.map → hydrate-W6LXQTDU.js.map} +0 -0
- /package/dist/{install-skills-TL5D7HZU.js.map → install-skills-COQUL6LG.js.map} +0 -0
- /package/dist/{keep-G62GSDOQ.js.map → keep-5725FMZD.js.map} +0 -0
- /package/dist/{list-CEVAZQ4V.js.map → list-HCD535CS.js.map} +0 -0
- /package/dist/{note-YIVFXTGM.js.map → note-EJMRTSDZ.js.map} +0 -0
- /package/dist/{pin-J4IDSHRG.js.map → pin-QR3CSLIU.js.map} +0 -0
- /package/dist/{review-6PWFSBAO.js.map → review-F54E75RF.js.map} +0 -0
- /package/dist/{review-now-AT2SPPRO.js.map → review-now-K3GBWULH.js.map} +0 -0
- /package/dist/{run-XEHF2N4A.js.map → run-X7VJAHIA.js.map} +0 -0
- /package/dist/{screen-SFU6TCDV.js.map → screen-2HPSFMT5.js.map} +0 -0
- /package/dist/{search-VJ3BGWPX.js.map → search-XNWJXKLY.js.map} +0 -0
- /package/dist/{section-ZLINSTGS.js.map → section-GF4S3RHQ.js.map} +0 -0
- /package/dist/{show-RK2EWOR6.js.map → show-75JNPHZZ.js.map} +0 -0
- /package/dist/{snooze-T2WWIKZN.js.map → snooze-R3IISMDC.js.map} +0 -0
- /package/dist/{start-AWHOIA3Q.js.map → start-PD6MO5H5.js.map} +0 -0
- /package/dist/{state-HK67C4UA.js.map → state-KUP4OEXR.js.map} +0 -0
- /package/dist/{statusline-Z5HLKDIA.js.map → statusline-SZPL3QBC.js.map} +0 -0
- /package/dist/{statusline-hook-VPPS3PFO.js.map → statusline-hook-6BNEVENM.js.map} +0 -0
- /package/dist/{stop-YOU3P3ZR.js.map → stop-CID5EBHG.js.map} +0 -0
- /package/dist/{time-ZGMZZ5OY.js.map → time-THNKOLZK.js.map} +0 -0
- /package/dist/{time-actions-VAGRSY5B.js.map → time-actions-6L4RQ3A7.js.map} +0 -0
- /package/dist/{todo-UVKGOG7D.js.map → todo-VHYBQC3I.js.map} +0 -0
- /package/dist/{usage-CW7CDFU3.js.map → usage-XLLVYWBE.js.map} +0 -0
- /package/dist/{usage-ask-V2SIRW4F.js.map → usage-ask-QBLLIHE3.js.map} +0 -0
- /package/dist/{wait-XXC3I6DK.js.map → wait-NIPHM5DN.js.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/commands/config.ts","../src/core/agents/group-instructions.ts"],"sourcesContent":["import fs from 'node:fs';\nimport path from 'node:path';\nimport chalk from 'chalk';\nimport type { CommandModule } from 'yargs';\nimport { loadConfig, saveConfig, getConfigPath, getConfigDir, ensureConfig } from '../core/platform/config.js';\nimport { generateGroupInstructions } from '../core/agents/group-instructions.js';\nimport { openInEditor } from '../core/platform/launch.js';\nimport { enrollRepo, RepoAdminError, repoInventory } from '../core/worktree/repo-admin.js';\nimport { scanForRepos } from '../core/worktree/repo-scan.js';\nimport { loadHistory } from '../core/sessions/history.js';\n\nexport const configCommand: CommandModule = {\n command: 'config <action>',\n describe: 'Manage configuration',\n builder: (yargs) =>\n yargs\n .showHelpOnFail(true)\n .positional('action', {\n describe: 'Config action to perform',\n choices: ['add', 'remove', 'list', 'group', 'scan', 'show', 'edit'] as const,\n type: 'string',\n demandOption: true,\n })\n .option('json', { type: 'boolean', describe: 'scan: the inventory as JSON (the Repos page’s /api/repos)' })\n .option('args', {\n type: 'array',\n string: true,\n hidden: true,\n })\n .strict(false),\n handler: async (argv) => {\n const action = argv.action as string;\n // Collect all extra positional args after the action\n const extra = (argv._ as string[]).slice(1); // slice off 'config'\n\n switch (action) {\n case 'add':\n await handleAdd(extra);\n break;\n case 'scan':\n handleScan(extra, argv.json === true);\n break;\n case 'remove':\n handleRemove(extra);\n break;\n case 'list':\n handleList();\n break;\n case 'group':\n handleGroup(extra);\n break;\n case 'show':\n handleShow();\n break;\n case 'edit':\n handleEdit();\n break;\n default:\n showConfigHelp();\n }\n },\n};\n\nasync function handleAdd(args: string[]): Promise<void> {\n const [alias, repoPath] = args;\n if (!alias || !repoPath) {\n console.error('Usage: work config add <alias> <path>');\n process.exitCode = 1;\n return;\n }\n\n if (!fs.existsSync(repoPath)) {\n console.error(`Path does not exist: ${repoPath}`);\n process.exitCode = 1;\n return;\n }\n\n // The Repos page's rules: a free alias, the repo's own top folder, a folder name no other repo has.\n try {\n await enrollRepo(alias, repoPath);\n } catch (err) {\n if (!(err instanceof RepoAdminError)) throw err;\n console.error(err.message);\n process.exitCode = 1;\n return;\n }\n console.log(chalk.green(`Added: ${alias} -> ${path.resolve(repoPath)}`));\n}\n\n/**\n * `work config scan [folder] [--json]`: the git repos in your scanned\n * folders (or in `folder`), enrolled or not — what the Repos page lists.\n */\nfunction handleScan(args: string[], json: boolean): void {\n const config = ensureConfig();\n const [folder] = args;\n const inv = folder\n ? repoInventory(config, loadHistory(), scanForRepos(folder, { skip: [config.worktreesRoot] }))\n : repoInventory(config, loadHistory());\n if (json) {\n console.log(JSON.stringify(inv, null, 2));\n return;\n }\n console.log(chalk.dim(`Scanned: ${inv.roots.length ? (folder ?? inv.roots.join(', ')) : '(no folder: set worktreesRoot, or pass one)'}`));\n const fresh = inv.repos.filter((r) => r.status === 'new');\n console.log(chalk.bold(`\\nNot enrolled (${fresh.length})`));\n for (const r of fresh) {\n const how = r.problem ? chalk.yellow(r.problem) : chalk.dim(`work config add ${r.suggestedAlias} \"${r.path}\"`);\n console.log(` ${r.folder.padEnd(28)} ${(r.origin ?? '').padEnd(32)} ${how}`);\n }\n const odd = inv.repos.filter((r) => r.status === 'missing' || r.sharedWith?.length);\n if (odd.length) {\n console.log(chalk.bold(`\\nTo look at (${odd.length})`));\n for (const r of odd)\n console.log(\n ` ${r.alias!.padEnd(28)} ${r.status === 'missing' ? chalk.red('folder gone: ' + r.path) : chalk.yellow(`same folder as ${r.sharedWith!.join(', ')}`)}`,\n );\n }\n const ignored = inv.repos.filter((r) => r.status === 'ignored').length;\n const enrolled = inv.repos.filter((r) => r.status === 'enrolled').length;\n console.log(chalk.dim(`\\n${enrolled} enrolled · ${ignored} ignored · the dashboard's Repos page adds, removes and ignores them.`));\n}\n\nfunction handleRemove(args: string[]): void {\n const [alias] = args;\n if (!alias) {\n console.error('Usage: work config remove <alias>');\n process.exitCode = 1;\n return;\n }\n\n const config = ensureConfig();\n\n if (!(alias in config.repos)) {\n console.error(`Repository alias not found: ${alias}`);\n process.exitCode = 1;\n return;\n }\n\n delete config.repos[alias];\n saveConfig(config);\n console.log(chalk.green(`Removed: ${alias}`));\n}\n\nfunction handleList(): void {\n const config = loadConfig();\n if (!config) {\n console.log(chalk.yellow('No configuration found. Run \"work init\" to set up.'));\n return;\n }\n\n console.log('');\n console.log(chalk.cyan('Work Configuration'));\n console.log(chalk.cyan('=================='));\n console.log(chalk.green(`Worktrees Root: ${config.worktreesRoot}`));\n console.log('');\n console.log(chalk.green('Repositories:'));\n\n const repoKeys = Object.keys(config.repos);\n if (repoKeys.length === 0) {\n console.log(chalk.gray(' (none configured)'));\n } else {\n for (const key of repoKeys) {\n console.log(` ${key} -> ${config.repos[key]}`);\n }\n }\n console.log('');\n\n console.log(chalk.green('Groups:'));\n const groupKeys = Object.keys(config.groups);\n if (groupKeys.length === 0) {\n console.log(chalk.gray(' (none configured)'));\n } else {\n for (const key of groupKeys) {\n const aliases = config.groups[key].join(', ');\n console.log(` ${key} -> [${aliases}]`);\n }\n }\n console.log('');\n}\n\nfunction handleGroup(args: string[]): void {\n const [subAction, ...rest] = args;\n switch (subAction) {\n case 'add':\n handleAddGroup(rest);\n break;\n case 'remove':\n handleRemoveGroup(rest);\n break;\n case 'regen':\n handleRegenGroup(rest);\n break;\n default:\n showGroupHelp();\n }\n}\n\nfunction handleAddGroup(args: string[]): void {\n const [groupName, ...repoAliases] = args;\n if (!groupName) {\n console.error('Usage: work config group add <name> <alias1> <alias2> [alias3...]');\n process.exitCode = 1;\n return;\n }\n\n if (repoAliases.length < 2) {\n console.error('A group must contain at least 2 repository aliases.');\n console.log(chalk.yellow('Usage: work config group add <name> <alias1> <alias2> [alias3...]'));\n process.exitCode = 1;\n return;\n }\n\n const config = ensureConfig();\n\n // Validate: all aliases exist in repos\n for (const alias of repoAliases) {\n if (!(alias in config.repos)) {\n console.error(`Repository alias not found: ${alias}`);\n console.log(chalk.yellow(`Available aliases: ${Object.keys(config.repos).join(', ')}`));\n process.exitCode = 1;\n return;\n }\n }\n\n // Validate: group name doesn't collide with repo aliases\n if (groupName in config.repos) {\n console.error(`Group name '${groupName}' conflicts with an existing repository alias.`);\n process.exitCode = 1;\n return;\n }\n\n // Validate: group name doesn't collide with repo folder names\n const repoFolderNames = Object.values(config.repos).map((p) => path.basename(p));\n if (repoFolderNames.includes(groupName)) {\n console.error(`Group name '${groupName}' conflicts with a repository folder name.`);\n process.exitCode = 1;\n return;\n }\n\n config.groups[groupName] = repoAliases;\n saveConfig(config);\n console.log(chalk.green(`Added group: ${groupName} -> [${repoAliases.join(', ')}]`));\n\n // Generate combined CLAUDE.md\n generateGroupInstructions(groupName, repoAliases, config);\n}\n\nfunction handleRemoveGroup(args: string[]): void {\n const [groupName] = args;\n if (!groupName) {\n console.error('Usage: work config group remove <name>');\n process.exitCode = 1;\n return;\n }\n\n const config = ensureConfig();\n\n if (!(groupName in config.groups)) {\n console.error(`Group not found: ${groupName}`);\n process.exitCode = 1;\n return;\n }\n\n delete config.groups[groupName];\n saveConfig(config);\n\n // Delete the .claude.md file\n const claudeMdPath = path.join(getConfigDir(), `${groupName}.claude.md`);\n if (fs.existsSync(claudeMdPath)) {\n fs.unlinkSync(claudeMdPath);\n console.log(`Deleted: ${claudeMdPath}`);\n }\n\n console.log(chalk.green(`Removed group: ${groupName}`));\n}\n\nfunction handleRegenGroup(args: string[]): void {\n const [groupName] = args;\n if (!groupName) {\n console.error('Usage: work config group regen <name>');\n process.exitCode = 1;\n return;\n }\n\n const config = ensureConfig();\n\n if (!(groupName in config.groups)) {\n console.error(`Group not found: ${groupName}`);\n process.exitCode = 1;\n return;\n }\n\n const repoAliases = config.groups[groupName];\n generateGroupInstructions(groupName, repoAliases, config);\n}\n\nfunction handleShow(): void {\n const configPath = getConfigPath();\n if (fs.existsSync(configPath)) {\n console.log(chalk.green(`Config file: ${configPath}`));\n console.log('');\n const content = fs.readFileSync(configPath, 'utf-8');\n console.log(content);\n } else {\n console.log(chalk.yellow('No configuration file found. Run \"work init\" to set up.'));\n }\n}\n\nfunction handleEdit(): void {\n const configPath = getConfigPath();\n if (!fs.existsSync(configPath)) {\n console.error('No configuration file found. Run \"work init\" first.');\n process.exitCode = 1;\n return;\n }\n openInEditor(configPath);\n}\n\nfunction showConfigHelp(): void {\n console.log(chalk.yellow('Usage: work config <action>'));\n console.log('');\n console.log(chalk.green('Actions:'));\n console.log(' add <alias> <path> - Add a repository');\n console.log(' remove <alias> - Remove a repository');\n console.log(' list - List all configured repositories and groups');\n console.log(' group <sub> - Manage groups (add, remove, regen)');\n console.log(' show - Show configuration file contents');\n console.log(' edit - Open configuration file in editor');\n}\n\nfunction showGroupHelp(): void {\n console.log(chalk.yellow('Usage: work config group <action>'));\n console.log('');\n console.log(chalk.green('Actions:'));\n console.log(' add <name> <alias1> <alias2> [...] - Create a repository group');\n console.log(' remove <name> - Remove a repository group');\n console.log(' regen <name> - Regenerate group CLAUDE.md');\n}\n","import fs from 'node:fs';\nimport path from 'node:path';\nimport spawn from '../platform/spawn.js';\nimport type { WorkConfig } from '../platform/config.js';\nimport { getConfigDir } from '../platform/config.js';\nimport { agentFor, internalAgent } from './index.js';\nimport { report } from '../platform/report.js';\n\n/**\n * Generate a group's combined instructions file — under the name the\n * configured agent reads (CLAUDE.md, AGENTS.md: agents/ `instructionsFile`),\n * from each repo's own — written by the summarising agent's one-shot run.\n * Falls back to a concatenated template if that run fails. Kept in\n * ~/.work/<group>.claude.md (the name it always had) and copied into each\n * group worktree's root.\n */\nexport function generateGroupInstructions(groupName: string, repoAliases: string[], config: WorkConfig): void {\n const outputPath = path.join(getConfigDir(), `${groupName}.claude.md`);\n const fileName = agentFor(config).instructionsFile;\n\n // Build prompt with each repo's instructions file\n const promptParts: string[] = [];\n promptParts.push(`You are generating a ${fileName} file (instructions for an AI coding agent) for a multi-repository workspace.`);\n promptParts.push('The workspace contains the following repositories as subdirectories:');\n promptParts.push('');\n\n for (const alias of repoAliases) {\n const repoPath = config.repos[alias];\n const repoName = path.basename(repoPath);\n const claudeMdPath = path.join(repoPath, fileName);\n\n promptParts.push(`## Repository: ${repoName}/ (alias: ${alias})`);\n\n if (fs.existsSync(claudeMdPath)) {\n const content = fs.readFileSync(claudeMdPath, 'utf-8');\n promptParts.push(`### ${fileName} contents:`);\n promptParts.push('```');\n promptParts.push(content);\n promptParts.push('```');\n } else {\n promptParts.push(`(no ${fileName} found)`);\n }\n promptParts.push('');\n }\n\n promptParts.push(`Generate a combined ${fileName} for this workspace that:`);\n promptParts.push('1. Explains the workspace structure (which subdirectories contain which repos)');\n promptParts.push(`2. Merges and synthesizes the instructions from all repos' ${fileName} files`);\n promptParts.push('3. Notes any cross-repo relationships or considerations');\n promptParts.push('4. Keeps all specific technical instructions (build commands, test commands, etc.) organized by repository');\n promptParts.push('');\n promptParts.push(`Output ONLY the markdown content for the combined ${fileName}, with no additional commentary.`);\n\n const prompt = promptParts.join('\\n');\n\n report('step', `Generating the combined ${fileName} for group '${groupName}'...`);\n report('detail', `(${internalAgent(config).name} writes the combined file)`);\n\n // Text-only, no tools, neutral cwd, tagged internal: the summarising agent's one-shot (agents/).\n const oneShot = internalAgent(config).oneShot;\n const run = oneShot?.command({}) ?? null;\n const result = run\n ? spawn.sync(run.cmd, run.args, {\n input: prompt,\n encoding: 'utf-8',\n stdio: ['pipe', 'pipe', 'pipe'],\n windowsHide: true,\n cwd: run.cwd,\n env: run.env,\n })\n : null;\n\n let content: string;\n\n if (!result || result.status !== 0 || !result.stdout?.trim()) {\n report('warn', `Couldn't have the combined ${fileName} written. Creating a basic template instead.`);\n content = buildFallbackTemplate(groupName, repoAliases, config);\n } else {\n content = result.stdout.trim();\n }\n\n fs.writeFileSync(outputPath, content, 'utf-8');\n report('success', `Saved: ${outputPath}`);\n}\n\nfunction buildFallbackTemplate(groupName: string, repoAliases: string[], config: WorkConfig): string {\n const fileName = agentFor(config).instructionsFile;\n const parts: string[] = [];\n parts.push(`# Multi-Repository Workspace: ${groupName}`);\n parts.push('');\n parts.push('This workspace contains the following repositories:');\n parts.push('');\n\n for (const alias of repoAliases) {\n const repoPath = config.repos[alias];\n const repoName = path.basename(repoPath);\n parts.push(`- **${repoName}/** (alias: ${alias})`);\n }\n\n parts.push('');\n parts.push('## Per-Repository Instructions');\n parts.push('');\n\n for (const alias of repoAliases) {\n const repoPath = config.repos[alias];\n const repoName = path.basename(repoPath);\n const claudeMdPath = path.join(repoPath, fileName);\n\n parts.push(`### ${repoName}`);\n\n if (fs.existsSync(claudeMdPath)) {\n const content = fs.readFileSync(claudeMdPath, 'utf-8');\n parts.push(content);\n } else {\n parts.push(`(no ${fileName} found)`);\n }\n parts.push('');\n }\n\n return parts.join('\\n');\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAOA,SAAQ;AACf,OAAOC,WAAU;AACjB,OAAO,WAAW;;;ACFlB,OAAO,QAAQ;AACf,OAAO,UAAU;AAeV,SAAS,0BAA0B,WAAmB,aAAuB,QAA0B;AAC5G,QAAM,aAAa,KAAK,KAAK,aAAa,GAAG,GAAG,SAAS,YAAY;AACrE,QAAM,WAAW,SAAS,MAAM,EAAE;AAGlC,QAAM,cAAwB,CAAC;AAC/B,cAAY,KAAK,wBAAwB,QAAQ,+EAA+E;AAChI,cAAY,KAAK,sEAAsE;AACvF,cAAY,KAAK,EAAE;AAEnB,aAAW,SAAS,aAAa;AAC/B,UAAM,WAAW,OAAO,MAAM,KAAK;AACnC,UAAM,WAAW,KAAK,SAAS,QAAQ;AACvC,UAAM,eAAe,KAAK,KAAK,UAAU,QAAQ;AAEjD,gBAAY,KAAK,kBAAkB,QAAQ,aAAa,KAAK,GAAG;AAEhE,QAAI,GAAG,WAAW,YAAY,GAAG;AAC/B,YAAMC,WAAU,GAAG,aAAa,cAAc,OAAO;AACrD,kBAAY,KAAK,OAAO,QAAQ,YAAY;AAC5C,kBAAY,KAAK,KAAK;AACtB,kBAAY,KAAKA,QAAO;AACxB,kBAAY,KAAK,KAAK;AAAA,IACxB,OAAO;AACL,kBAAY,KAAK,OAAO,QAAQ,SAAS;AAAA,IAC3C;AACA,gBAAY,KAAK,EAAE;AAAA,EACrB;AAEA,cAAY,KAAK,uBAAuB,QAAQ,2BAA2B;AAC3E,cAAY,KAAK,gFAAgF;AACjG,cA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,OAAO;AACL,YAAQ,IAAI,MAAM,OAAO,yDAAyD,CAAC;AAAA,EACrF;AACF;AAEA,SAAS,aAAmB;AAC1B,QAAM,aAAa,cAAc;AACjC,MAAI,CAACA,IAAG,WAAW,UAAU,GAAG;AAC9B,YAAQ,MAAM,qDAAqD;AACnE,YAAQ,WAAW;AACnB;AAAA,EACF;AACA,eAAa,UAAU;AACzB;AAEA,SAAS,iBAAuB;AAC9B,UAAQ,IAAI,MAAM,OAAO,6BAA6B,CAAC;AACvD,UAAQ,IAAI,EAAE;AACd,UAAQ,IAAI,MAAM,MAAM,UAAU,CAAC;AACnC,UAAQ,IAAI,4DAA4D;AACxE,UAAQ,IAAI,+DAA+D;AAC3E,UAAQ,IAAI,uFAAuF;AACnG,UAAQ,IAAI,8EAA8E;AAC1F,UAAQ,IAAI,4EAA4E;AACxF,UAAQ,IAAI,6EAA6E;AAC3F;AAEA,SAAS,gBAAsB;AAC7B,UAAQ,IAAI,MAAM,OAAO,mCAAmC,CAAC;AAC7D,UAAQ,IAAI,EAAE;AACd,UAAQ,IAAI,MAAM,MAAM,UAAU,CAAC;AACnC,UAAQ,IAAI,qEAAqE;AACjF,UAAQ,IAAI,qEAAqE;AACjF,UAAQ,IAAI,sEAAsE;AACpF;","names":["fs","path","content","fs","path"]}
|
|
1
|
+
{"version":3,"sources":["../src/commands/config.ts","../src/core/agents/group-instructions.ts"],"sourcesContent":["import fs from 'node:fs';\nimport path from 'node:path';\nimport chalk from 'chalk';\nimport type { CommandModule } from 'yargs';\nimport { loadConfig, saveConfig, getConfigPath, getConfigDir, ensureConfig } from '../core/platform/config.js';\nimport { generateGroupInstructions } from '../core/agents/group-instructions.js';\nimport { openInEditor } from '../core/platform/launch.js';\nimport { enrollRepo, RepoAdminError, repoInventory } from '../core/worktree/repo-admin.js';\nimport { scanForRepos } from '../core/worktree/repo-scan.js';\nimport { loadHistory } from '../core/sessions/history.js';\n\nexport const configCommand: CommandModule = {\n command: 'config <action>',\n describe: 'Manage configuration',\n builder: (yargs) =>\n yargs\n .showHelpOnFail(true)\n .positional('action', {\n describe: 'Config action to perform',\n choices: ['add', 'remove', 'list', 'group', 'scan', 'show', 'edit'] as const,\n type: 'string',\n demandOption: true,\n })\n .option('json', { type: 'boolean', describe: 'scan: the inventory as JSON (the Repos page’s /api/repos)' })\n .option('args', {\n type: 'array',\n string: true,\n hidden: true,\n })\n .strict(false),\n handler: async (argv) => {\n const action = argv.action as string;\n // Collect all extra positional args after the action\n const extra = (argv._ as string[]).slice(1); // slice off 'config'\n\n switch (action) {\n case 'add':\n await handleAdd(extra);\n break;\n case 'scan':\n handleScan(extra, argv.json === true);\n break;\n case 'remove':\n handleRemove(extra);\n break;\n case 'list':\n handleList();\n break;\n case 'group':\n handleGroup(extra);\n break;\n case 'show':\n handleShow();\n break;\n case 'edit':\n handleEdit();\n break;\n default:\n showConfigHelp();\n }\n },\n};\n\nasync function handleAdd(args: string[]): Promise<void> {\n const [alias, repoPath] = args;\n if (!alias || !repoPath) {\n console.error('Usage: work config add <alias> <path>');\n process.exitCode = 1;\n return;\n }\n\n if (!fs.existsSync(repoPath)) {\n console.error(`Path does not exist: ${repoPath}`);\n process.exitCode = 1;\n return;\n }\n\n // The Repos page's rules: a free alias, the repo's own top folder, a folder name no other repo has.\n try {\n await enrollRepo(alias, repoPath);\n } catch (err) {\n if (!(err instanceof RepoAdminError)) throw err;\n console.error(err.message);\n process.exitCode = 1;\n return;\n }\n console.log(chalk.green(`Added: ${alias} -> ${path.resolve(repoPath)}`));\n}\n\n/**\n * `work config scan [folder] [--json]`: the git repos in your scanned\n * folders (or in `folder`), enrolled or not — what the Repos page lists.\n */\nfunction handleScan(args: string[], json: boolean): void {\n const config = ensureConfig();\n const [folder] = args;\n const inv = folder\n ? repoInventory(config, loadHistory(), scanForRepos(folder, { skip: [config.worktreesRoot] }))\n : repoInventory(config, loadHistory());\n if (json) {\n console.log(JSON.stringify(inv, null, 2));\n return;\n }\n console.log(chalk.dim(`Scanned: ${inv.roots.length ? (folder ?? inv.roots.join(', ')) : '(no folder: set worktreesRoot, or pass one)'}`));\n const fresh = inv.repos.filter((r) => r.status === 'new');\n console.log(chalk.bold(`\\nNot enrolled (${fresh.length})`));\n for (const r of fresh) {\n const how = r.problem ? chalk.yellow(r.problem) : chalk.dim(`work config add ${r.suggestedAlias} \"${r.path}\"`);\n console.log(` ${r.folder.padEnd(28)} ${(r.origin ?? '').padEnd(32)} ${how}`);\n }\n const odd = inv.repos.filter((r) => r.status === 'missing' || r.sharedWith?.length);\n if (odd.length) {\n console.log(chalk.bold(`\\nTo look at (${odd.length})`));\n for (const r of odd)\n console.log(\n ` ${r.alias!.padEnd(28)} ${r.status === 'missing' ? chalk.red('folder gone: ' + r.path) : chalk.yellow(`same folder as ${r.sharedWith!.join(', ')}`)}`,\n );\n }\n const ignored = inv.repos.filter((r) => r.status === 'ignored').length;\n const enrolled = inv.repos.filter((r) => r.status === 'enrolled').length;\n console.log(chalk.dim(`\\n${enrolled} enrolled · ${ignored} ignored · the dashboard's Repos page adds, removes and ignores them.`));\n}\n\nfunction handleRemove(args: string[]): void {\n const [alias] = args;\n if (!alias) {\n console.error('Usage: work config remove <alias>');\n process.exitCode = 1;\n return;\n }\n\n const config = ensureConfig();\n\n if (!(alias in config.repos)) {\n console.error(`Repository alias not found: ${alias}`);\n process.exitCode = 1;\n return;\n }\n\n delete config.repos[alias];\n saveConfig(config);\n console.log(chalk.green(`Removed: ${alias}`));\n}\n\nfunction handleList(): void {\n const config = loadConfig();\n if (!config) {\n console.log(chalk.yellow('No configuration found. Run \"work init\" to set up.'));\n return;\n }\n\n console.log('');\n console.log(chalk.cyan('Work Configuration'));\n console.log(chalk.cyan('=================='));\n console.log(chalk.green(`Worktrees Root: ${config.worktreesRoot}`));\n console.log('');\n console.log(chalk.green('Repositories:'));\n\n const repoKeys = Object.keys(config.repos);\n if (repoKeys.length === 0) {\n console.log(chalk.gray(' (none configured)'));\n } else {\n for (const key of repoKeys) {\n console.log(` ${key} -> ${config.repos[key]}`);\n }\n }\n console.log('');\n\n console.log(chalk.green('Groups:'));\n const groupKeys = Object.keys(config.groups);\n if (groupKeys.length === 0) {\n console.log(chalk.gray(' (none configured)'));\n } else {\n for (const key of groupKeys) {\n const aliases = config.groups[key].join(', ');\n console.log(` ${key} -> [${aliases}]`);\n }\n }\n console.log('');\n}\n\nfunction handleGroup(args: string[]): void {\n const [subAction, ...rest] = args;\n switch (subAction) {\n case 'add':\n handleAddGroup(rest);\n break;\n case 'remove':\n handleRemoveGroup(rest);\n break;\n case 'regen':\n handleRegenGroup(rest);\n break;\n default:\n showGroupHelp();\n }\n}\n\nfunction handleAddGroup(args: string[]): void {\n const [groupName, ...repoAliases] = args;\n if (!groupName) {\n console.error('Usage: work config group add <name> <alias1> <alias2> [alias3...]');\n process.exitCode = 1;\n return;\n }\n\n if (repoAliases.length < 2) {\n console.error('A group must contain at least 2 repository aliases.');\n console.log(chalk.yellow('Usage: work config group add <name> <alias1> <alias2> [alias3...]'));\n process.exitCode = 1;\n return;\n }\n\n const config = ensureConfig();\n\n // Validate: all aliases exist in repos\n for (const alias of repoAliases) {\n if (!(alias in config.repos)) {\n console.error(`Repository alias not found: ${alias}`);\n console.log(chalk.yellow(`Available aliases: ${Object.keys(config.repos).join(', ')}`));\n process.exitCode = 1;\n return;\n }\n }\n\n // Validate: group name doesn't collide with repo aliases\n if (groupName in config.repos) {\n console.error(`Group name '${groupName}' conflicts with an existing repository alias.`);\n process.exitCode = 1;\n return;\n }\n\n // Validate: group name doesn't collide with repo folder names\n const repoFolderNames = Object.values(config.repos).map((p) => path.basename(p));\n if (repoFolderNames.includes(groupName)) {\n console.error(`Group name '${groupName}' conflicts with a repository folder name.`);\n process.exitCode = 1;\n return;\n }\n\n config.groups[groupName] = repoAliases;\n saveConfig(config);\n console.log(chalk.green(`Added group: ${groupName} -> [${repoAliases.join(', ')}]`));\n\n // Generate combined CLAUDE.md\n generateGroupInstructions(groupName, repoAliases, config);\n}\n\nfunction handleRemoveGroup(args: string[]): void {\n const [groupName] = args;\n if (!groupName) {\n console.error('Usage: work config group remove <name>');\n process.exitCode = 1;\n return;\n }\n\n const config = ensureConfig();\n\n if (!(groupName in config.groups)) {\n console.error(`Group not found: ${groupName}`);\n process.exitCode = 1;\n return;\n }\n\n delete config.groups[groupName];\n saveConfig(config);\n\n // Delete the .claude.md file\n const claudeMdPath = path.join(getConfigDir(), `${groupName}.claude.md`);\n if (fs.existsSync(claudeMdPath)) {\n fs.unlinkSync(claudeMdPath);\n console.log(`Deleted: ${claudeMdPath}`);\n }\n\n console.log(chalk.green(`Removed group: ${groupName}`));\n}\n\nfunction handleRegenGroup(args: string[]): void {\n const [groupName] = args;\n if (!groupName) {\n console.error('Usage: work config group regen <name>');\n process.exitCode = 1;\n return;\n }\n\n const config = ensureConfig();\n\n if (!(groupName in config.groups)) {\n console.error(`Group not found: ${groupName}`);\n process.exitCode = 1;\n return;\n }\n\n const repoAliases = config.groups[groupName];\n generateGroupInstructions(groupName, repoAliases, config);\n}\n\nfunction handleShow(): void {\n const configPath = getConfigPath();\n if (fs.existsSync(configPath)) {\n console.log(chalk.green(`Config file: ${configPath}`));\n console.log('');\n const content = fs.readFileSync(configPath, 'utf-8');\n console.log(content);\n } else {\n console.log(chalk.yellow('No configuration file found. Run \"work init\" to set up.'));\n }\n}\n\nfunction handleEdit(): void {\n const configPath = getConfigPath();\n if (!fs.existsSync(configPath)) {\n console.error('No configuration file found. Run \"work init\" first.');\n process.exitCode = 1;\n return;\n }\n openInEditor(configPath);\n}\n\nfunction showConfigHelp(): void {\n console.log(chalk.yellow('Usage: work config <action>'));\n console.log('');\n console.log(chalk.green('Actions:'));\n console.log(' add <alias> <path> - Add a repository');\n console.log(' remove <alias> - Remove a repository');\n console.log(' list - List all configured repositories and groups');\n console.log(' group <sub> - Manage groups (add, remove, regen)');\n console.log(' show - Show configuration file contents');\n console.log(' edit - Open configuration file in editor');\n}\n\nfunction showGroupHelp(): void {\n console.log(chalk.yellow('Usage: work config group <action>'));\n console.log('');\n console.log(chalk.green('Actions:'));\n console.log(' add <name> <alias1> <alias2> [...] - Create a repository group');\n console.log(' remove <name> - Remove a repository group');\n console.log(' regen <name> - Regenerate group CLAUDE.md');\n}\n","import fs from 'node:fs';\nimport path from 'node:path';\nimport spawn from '../platform/spawn.js';\nimport type { WorkConfig } from '../platform/config.js';\nimport { getConfigDir } from '../platform/config.js';\nimport { agentFor, internalAgent } from './index.js';\nimport { report } from '../platform/report.js';\n\n/**\n * Generate a group's combined instructions file — under the name the\n * configured agent reads (CLAUDE.md, AGENTS.md: agents/ `instructionsFile`),\n * from each repo's own — written by the summarising agent's one-shot run.\n * Falls back to a concatenated template if that run fails. Kept in\n * ~/.work/<group>.claude.md (the name it always had) and copied into each\n * group worktree's root.\n */\nexport function generateGroupInstructions(groupName: string, repoAliases: string[], config: WorkConfig): void {\n const outputPath = path.join(getConfigDir(), `${groupName}.claude.md`);\n const fileName = agentFor(config).instructionsFile;\n\n // Build prompt with each repo's instructions file\n const promptParts: string[] = [];\n promptParts.push(`You are generating a ${fileName} file (instructions for an AI coding agent) for a multi-repository workspace.`);\n promptParts.push('The workspace contains the following repositories as subdirectories:');\n promptParts.push('');\n\n for (const alias of repoAliases) {\n const repoPath = config.repos[alias];\n const repoName = path.basename(repoPath);\n const claudeMdPath = path.join(repoPath, fileName);\n\n promptParts.push(`## Repository: ${repoName}/ (alias: ${alias})`);\n\n if (fs.existsSync(claudeMdPath)) {\n const content = fs.readFileSync(claudeMdPath, 'utf-8');\n promptParts.push(`### ${fileName} contents:`);\n promptParts.push('```');\n promptParts.push(content);\n promptParts.push('```');\n } else {\n promptParts.push(`(no ${fileName} found)`);\n }\n promptParts.push('');\n }\n\n promptParts.push(`Generate a combined ${fileName} for this workspace that:`);\n promptParts.push('1. Explains the workspace structure (which subdirectories contain which repos)');\n promptParts.push(`2. Merges and synthesizes the instructions from all repos' ${fileName} files`);\n promptParts.push('3. Notes any cross-repo relationships or considerations');\n promptParts.push('4. Keeps all specific technical instructions (build commands, test commands, etc.) organized by repository');\n promptParts.push('');\n promptParts.push(`Output ONLY the markdown content for the combined ${fileName}, with no additional commentary.`);\n\n const prompt = promptParts.join('\\n');\n\n report('step', `Generating the combined ${fileName} for group '${groupName}'...`);\n report('detail', `(${internalAgent(config).name} writes the combined file)`);\n\n // Text-only, no tools, neutral cwd, tagged internal: the summarising agent's one-shot (agents/).\n const oneShot = internalAgent(config).oneShot;\n const run = oneShot?.command({}) ?? null;\n const result = run\n ? spawn.sync(run.cmd, run.args, {\n input: prompt,\n encoding: 'utf-8',\n stdio: ['pipe', 'pipe', 'pipe'],\n windowsHide: true,\n cwd: run.cwd,\n env: run.env,\n })\n : null;\n\n let content: string;\n\n if (!result || result.status !== 0 || !result.stdout?.trim()) {\n report('warn', `Couldn't have the combined ${fileName} written. Creating a basic template instead.`);\n content = buildFallbackTemplate(groupName, repoAliases, config);\n } else {\n content = result.stdout.trim();\n }\n\n fs.writeFileSync(outputPath, content, 'utf-8');\n report('success', `Saved: ${outputPath}`);\n}\n\nfunction buildFallbackTemplate(groupName: string, repoAliases: string[], config: WorkConfig): string {\n const fileName = agentFor(config).instructionsFile;\n const parts: string[] = [];\n parts.push(`# Multi-Repository Workspace: ${groupName}`);\n parts.push('');\n parts.push('This workspace contains the following repositories:');\n parts.push('');\n\n for (const alias of repoAliases) {\n const repoPath = config.repos[alias];\n const repoName = path.basename(repoPath);\n parts.push(`- **${repoName}/** (alias: ${alias})`);\n }\n\n parts.push('');\n parts.push('## Per-Repository Instructions');\n parts.push('');\n\n for (const alias of repoAliases) {\n const repoPath = config.repos[alias];\n const repoName = path.basename(repoPath);\n const claudeMdPath = path.join(repoPath, fileName);\n\n parts.push(`### ${repoName}`);\n\n if (fs.existsSync(claudeMdPath)) {\n const content = fs.readFileSync(claudeMdPath, 'utf-8');\n parts.push(content);\n } else {\n parts.push(`(no ${fileName} found)`);\n }\n parts.push('');\n }\n\n return parts.join('\\n');\n}\n"],"mappings":";;;;;;;;;;;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,SAAS,iBAAuB;AAC9B,UAAQ,IAAI,MAAM,OAAO,6BAA6B,CAAC;AACvD,UAAQ,IAAI,EAAE;AACd,UAAQ,IAAI,MAAM,MAAM,UAAU,CAAC;AACnC,UAAQ,IAAI,4DAA4D;AACxE,UAAQ,IAAI,+DAA+D;AAC3E,UAAQ,IAAI,uFAAuF;AACnG,UAAQ,IAAI,8EAA8E;AAC1F,UAAQ,IAAI,4EAA4E;AACxF,UAAQ,IAAI,6EAA6E;AAC3F;AAEA,SAAS,gBAAsB;AAC7B,UAAQ,IAAI,MAAM,OAAO,mCAAmC,CAAC;AAC7D,UAAQ,IAAI,EAAE;AACd,UAAQ,IAAI,MAAM,MAAM,UAAU,CAAC;AACnC,UAAQ,IAAI,qEAAqE;AACjF,UAAQ,IAAI,qEAAqE;AACjF,UAAQ,IAAI,sEAAsE;AACpF;","names":["fs","path","content","fs","path"]}
|
|
@@ -2,43 +2,47 @@
|
|
|
2
2
|
import {
|
|
3
3
|
sessionFromArgs,
|
|
4
4
|
sessionPositionals
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-S77BGUVD.js";
|
|
6
6
|
import "./chunk-6AQRYLOB.js";
|
|
7
7
|
import {
|
|
8
8
|
MAX_CHILDREN,
|
|
9
9
|
adoptChild,
|
|
10
10
|
coordinatorSince,
|
|
11
|
+
grantedBySetting,
|
|
12
|
+
mayCoordinate,
|
|
11
13
|
releaseChild,
|
|
12
14
|
setCoordinator
|
|
13
|
-
} from "./chunk-
|
|
14
|
-
import "./chunk-
|
|
15
|
+
} from "./chunk-FCMPVWE7.js";
|
|
16
|
+
import "./chunk-IEKDHKGO.js";
|
|
15
17
|
import "./chunk-ZSHWP2VS.js";
|
|
16
18
|
import "./chunk-UPS7NHKI.js";
|
|
17
19
|
import "./chunk-HUXS3VAI.js";
|
|
18
20
|
import {
|
|
19
21
|
findSession,
|
|
20
22
|
loadHistory
|
|
21
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-NIMROXWE.js";
|
|
22
24
|
import "./chunk-NEJVK5CF.js";
|
|
25
|
+
import "./chunk-B34R6TQO.js";
|
|
26
|
+
import "./chunk-KGHWHAVF.js";
|
|
23
27
|
import {
|
|
24
28
|
sessionIdFor
|
|
25
29
|
} from "./chunk-QGUBOOEN.js";
|
|
26
|
-
import "./chunk-NWKVTUTN.js";
|
|
27
|
-
import "./chunk-KGHWHAVF.js";
|
|
28
|
-
import "./chunk-BMPTUIP4.js";
|
|
29
|
-
import "./chunk-ED6YLB4S.js";
|
|
30
30
|
import "./chunk-Z6ACV5ZQ.js";
|
|
31
|
-
import "./chunk-JUGF3YE7.js";
|
|
32
|
-
import "./chunk-HK6AZQ5Z.js";
|
|
33
|
-
import "./chunk-XIN6XUFL.js";
|
|
34
|
-
import "./chunk-ETWP7MDS.js";
|
|
35
31
|
import "./chunk-7ZATXG5F.js";
|
|
32
|
+
import "./chunk-JUGF3YE7.js";
|
|
36
33
|
import "./chunk-BR6OWWAA.js";
|
|
34
|
+
import "./chunk-OU3BTWR6.js";
|
|
35
|
+
import "./chunk-YQSWVHKK.js";
|
|
36
|
+
import "./chunk-D4XRXS3P.js";
|
|
37
|
+
import {
|
|
38
|
+
loadConfig
|
|
39
|
+
} from "./chunk-FX4KMK4M.js";
|
|
37
40
|
import "./chunk-M2X6OHHR.js";
|
|
38
41
|
import "./chunk-QOSAWNOU.js";
|
|
39
42
|
import "./chunk-D2J3AD6L.js";
|
|
40
43
|
import "./chunk-5ZCCUM75.js";
|
|
41
44
|
import "./chunk-IAKOKZYW.js";
|
|
45
|
+
import "./chunk-HK6AZQ5Z.js";
|
|
42
46
|
import "./chunk-F2ECTTSY.js";
|
|
43
47
|
|
|
44
48
|
// src/commands/coordinate.ts
|
|
@@ -111,12 +115,18 @@ var coordinateCommand = {
|
|
|
111
115
|
return;
|
|
112
116
|
}
|
|
113
117
|
const since = coordinatorSince(id);
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
)
|
|
118
|
+
const config = loadConfig();
|
|
119
|
+
if (since) console.log(`${name} coordinates sessions of its own (since ${since}).`);
|
|
120
|
+
else if (mayCoordinate(id, s, config))
|
|
121
|
+
console.log(
|
|
122
|
+
`${name} coordinates sessions of its own: it is a repo's own checkout, and the setting lets those (coordinateOwnCheckout).`
|
|
123
|
+
);
|
|
124
|
+
else if (grantedBySetting(s, config))
|
|
125
|
+
console.log(chalk.gray(`${name} does not coordinate other sessions: you took it back here (--off).`));
|
|
126
|
+
else console.log(chalk.gray(`${name} does not coordinate other sessions.`));
|
|
117
127
|
}
|
|
118
128
|
};
|
|
119
129
|
export {
|
|
120
130
|
coordinateCommand
|
|
121
131
|
};
|
|
122
|
-
//# sourceMappingURL=coordinate-
|
|
132
|
+
//# sourceMappingURL=coordinate-JRJX7LN6.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/coordinate.ts"],"sourcesContent":["import chalk from 'chalk';\nimport type { CommandModule } from 'yargs';\nimport { loadConfig } from '../core/platform/config.js';\nimport { sessionIdFor } from '../core/sessions/session-id.js';\nimport {\n adoptChild,\n coordinatorSince,\n grantedBySetting,\n MAX_CHILDREN,\n mayCoordinate,\n releaseChild,\n setCoordinator,\n} from '../core/sessions/session-children.js';\nimport { findSession, loadHistory } from '../core/sessions/history.js';\nimport { sessionFromArgs, sessionPositionals } from './shared/session-arg.js';\n\n/**\n * `work coordinate` — let a session start, message and finish sessions of its own without asking each time\n * (`work child …`, session-children.ts). It is the grant, so it is never pre-allowed: Claude running it asks you.\n * `--off` takes it back; no flag says whether it stands.\n */\nexport const coordinateCommand: CommandModule = {\n command: 'coordinate [target] [branch]',\n describe: 'Let a session start and drive sessions of its own without asking each time (default: the session for this folder)',\n builder: (yargs) =>\n sessionPositionals(yargs)\n .option('on', { type: 'boolean', describe: 'Grant it' })\n .option('off', { type: 'boolean', describe: 'Take it back' })\n .option('adopt', {\n type: 'array',\n string: true,\n describe: 'Also coordinate a session you already have: --adopt <target> <branch> (grants it too)',\n })\n .option('release', { type: 'array', string: true, describe: 'Stop coordinating one: --release <target> <branch>' })\n .check((a) => !(a.on && a.off) || 'Give --on or --off, not both')\n .check(\n (a) =>\n [a.adopt, a.release].every((v) => v === undefined || (Array.isArray(v) && v.length === 2)) ||\n 'Name the session as <target> <branch>',\n ),\n handler: (argv) => {\n const s = sessionFromArgs(argv);\n if (!s) return;\n const id = sessionIdFor(s);\n const name = `${s.target} · ${s.branch}`;\n const other = (v: unknown) => {\n const [t, b] = v as [string, string];\n const o = findSession(loadHistory(), t, b);\n if (!o) {\n console.error(chalk.red(`No session ${t} ${b}.`));\n process.exitCode = 1;\n }\n return o ?? null;\n };\n if (argv.release) {\n const o = other(argv.release);\n if (!o) return;\n const done = releaseChild(id, sessionIdFor(o));\n console.log(done ? `${name} no longer coordinates ${o.target} · ${o.branch}.` : chalk.gray(`${name} did not coordinate it.`));\n return;\n }\n if (argv.adopt) {\n const o = other(argv.adopt);\n if (!o) return;\n if (o.archivedAt) {\n console.error(chalk.red(`${o.target} · ${o.branch} is archived: restore it first.`));\n process.exitCode = 1;\n return;\n }\n const r = adoptChild(id, sessionIdFor(o));\n if (!r.ok) {\n console.error(chalk.red(`${o.target} · ${o.branch}: ${r.error}`));\n process.exitCode = 1;\n return;\n }\n setCoordinator(id, true);\n console.log(\n chalk.green(\n `${name} now coordinates ${o.target} · ${o.branch}: \\`work child send\\` reaches it without asking (typed in when idle, started when asleep), and it reports back with \\`work report\\`. Its permission prompts still come to you.`,\n ),\n );\n return;\n }\n if (argv.on) {\n setCoordinator(id, true);\n console.log(\n chalk.green(\n `${name} may now start up to ${MAX_CHILDREN} sessions of its own, message them and archive them (\\`work child …\\`) without asking. Their permission prompts still come to you. \\`work coordinate --off\\` takes it back.`,\n ),\n );\n return;\n }\n if (argv.off) {\n setCoordinator(id, false);\n console.log(chalk.green(`${name} asks you again before driving other sessions.`));\n return;\n }\n const since = coordinatorSince(id);\n const config = loadConfig();\n if (since) console.log(`${name} coordinates sessions of its own (since ${since}).`);\n else if (mayCoordinate(id, s, config))\n console.log(\n `${name} coordinates sessions of its own: it is a repo's own checkout, and the setting lets those (coordinateOwnCheckout).`,\n );\n else if (grantedBySetting(s, config))\n console.log(chalk.gray(`${name} does not coordinate other sessions: you took it back here (--off).`));\n else console.log(chalk.gray(`${name} does not coordinate other sessions.`));\n },\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,WAAW;AAqBX,IAAM,oBAAmC;AAAA,EAC9C,SAAS;AAAA,EACT,UAAU;AAAA,EACV,SAAS,CAAC,UACR,mBAAmB,KAAK,EACrB,OAAO,MAAM,EAAE,MAAM,WAAW,UAAU,WAAW,CAAC,EACtD,OAAO,OAAO,EAAE,MAAM,WAAW,UAAU,eAAe,CAAC,EAC3D,OAAO,SAAS;AAAA,IACf,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,UAAU;AAAA,EACZ,CAAC,EACA,OAAO,WAAW,EAAE,MAAM,SAAS,QAAQ,MAAM,UAAU,qDAAqD,CAAC,EACjH,MAAM,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,QAAQ,8BAA8B,EAC/D;AAAA,IACC,CAAC,MACC,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,MAAM,UAAc,MAAM,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAE,KACzF;AAAA,EACJ;AAAA,EACJ,SAAS,CAAC,SAAS;AACjB,UAAM,IAAI,gBAAgB,IAAI;AAC9B,QAAI,CAAC,EAAG;AACR,UAAM,KAAK,aAAa,CAAC;AACzB,UAAM,OAAO,GAAG,EAAE,MAAM,SAAM,EAAE,MAAM;AACtC,UAAM,QAAQ,CAAC,MAAe;AAC5B,YAAM,CAAC,GAAG,CAAC,IAAI;AACf,YAAM,IAAI,YAAY,YAAY,GAAG,GAAG,CAAC;AACzC,UAAI,CAAC,GAAG;AACN,gBAAQ,MAAM,MAAM,IAAI,cAAc,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AACA,UAAM,QAAQ,iBAAiB,EAAE;AACjC,UAAM,SAAS,WAAW;AAC1B,QAAI,MAAO,SAAQ,IAAI,GAAG,IAAI,2CAA2C,KAAK,IAAI;AAAA,aACzE,cAAc,IAAI,GAAG,MAAM;AAClC,cAAQ;AAAA,QACN,GAAG,IAAI;AAAA,MACT;AAAA,aACO,iBAAiB,GAAG,MAAM;AACjC,cAAQ,IAAI,MAAM,KAAK,GAAG,IAAI,qEAAqE,CAAC;AAAA,QACjG,SAAQ,IAAI,MAAM,KAAK,GAAG,IAAI,sCAAsC,CAAC;AAAA,EAC5E;AACF;","names":[]}
|
|
@@ -9,10 +9,10 @@ import {
|
|
|
9
9
|
resolveWebRoot,
|
|
10
10
|
startDiffServer,
|
|
11
11
|
submitReviewSchema
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-UVRGRMN4.js";
|
|
13
13
|
import {
|
|
14
14
|
computeDiff
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-7GMENM2D.js";
|
|
16
16
|
import {
|
|
17
17
|
existingWebDecision,
|
|
18
18
|
readWebUrl,
|
|
@@ -27,25 +27,21 @@ import {
|
|
|
27
27
|
} from "./chunk-HUXS3VAI.js";
|
|
28
28
|
import {
|
|
29
29
|
openUrl
|
|
30
|
-
} from "./chunk-
|
|
31
|
-
import "./chunk-
|
|
32
|
-
import "./chunk-XL4YNA3L.js";
|
|
30
|
+
} from "./chunk-5C5NTOZT.js";
|
|
31
|
+
import "./chunk-NIMROXWE.js";
|
|
33
32
|
import "./chunk-NEJVK5CF.js";
|
|
34
|
-
import "./chunk-
|
|
35
|
-
import "./chunk-NWKVTUTN.js";
|
|
33
|
+
import "./chunk-B34R6TQO.js";
|
|
36
34
|
import "./chunk-KGHWHAVF.js";
|
|
37
|
-
import "./chunk-
|
|
38
|
-
import "./chunk-ED6YLB4S.js";
|
|
35
|
+
import "./chunk-QGUBOOEN.js";
|
|
39
36
|
import "./chunk-JYWX2N5W.js";
|
|
40
37
|
import "./chunk-Z6ACV5ZQ.js";
|
|
41
|
-
import "./chunk-JUGF3YE7.js";
|
|
42
|
-
import {
|
|
43
|
-
resolveWorkBinPath
|
|
44
|
-
} from "./chunk-HK6AZQ5Z.js";
|
|
45
|
-
import "./chunk-XIN6XUFL.js";
|
|
46
|
-
import "./chunk-ETWP7MDS.js";
|
|
47
38
|
import "./chunk-7ZATXG5F.js";
|
|
39
|
+
import "./chunk-JUGF3YE7.js";
|
|
48
40
|
import "./chunk-BR6OWWAA.js";
|
|
41
|
+
import "./chunk-OU3BTWR6.js";
|
|
42
|
+
import "./chunk-YQSWVHKK.js";
|
|
43
|
+
import "./chunk-D4XRXS3P.js";
|
|
44
|
+
import "./chunk-FX4KMK4M.js";
|
|
49
45
|
import {
|
|
50
46
|
spawnDetachedWork
|
|
51
47
|
} from "./chunk-M2X6OHHR.js";
|
|
@@ -53,6 +49,9 @@ import "./chunk-QOSAWNOU.js";
|
|
|
53
49
|
import "./chunk-D2J3AD6L.js";
|
|
54
50
|
import "./chunk-5ZCCUM75.js";
|
|
55
51
|
import "./chunk-IAKOKZYW.js";
|
|
52
|
+
import {
|
|
53
|
+
resolveWorkBinPath
|
|
54
|
+
} from "./chunk-HK6AZQ5Z.js";
|
|
56
55
|
import "./chunk-F2ECTTSY.js";
|
|
57
56
|
|
|
58
57
|
// src/commands/diff.ts
|
|
@@ -591,4 +590,4 @@ export {
|
|
|
591
590
|
resolveWorkBinPath,
|
|
592
591
|
webServerResponds
|
|
593
592
|
};
|
|
594
|
-
//# sourceMappingURL=diff-
|
|
593
|
+
//# sourceMappingURL=diff-ABQL4OGG.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/commands/diff.ts","../src/server/comment-server.ts","../src/core/comments/review-poll.ts","../src/core/diff/static-renderer.ts"],"sourcesContent":["import { resolveWorkBinPath } from '../core/platform/work-bin.js';\nimport fs from 'node:fs';\nimport os from 'node:os';\nimport path from 'node:path';\nimport chalk from 'chalk';\nimport type { CommandModule } from 'yargs';\nimport { computeDiff } from '../core/diff/diff-pipeline.js';\nimport { stableDiffPath, type RepoSpec } from '../core/diff/repo-spec.js';\nimport {\n buildRepoSpecs,\n findAnyParentBranch,\n resolveBase,\n resolveScope,\n type DiffScope,\n type ResolvedBase,\n} from '../core/diff/diff-scope.js';\nimport { formatSingleComment, startCommentServer } from '../server/comment-server.js';\nimport { diffReviewSnapshot } from '../core/comments/review-poll.js';\nimport { renderStatic } from '../core/diff/static-renderer.js';\nimport { openUrl } from '../core/platform/launch.js';\nimport { spawnDetachedWork } from '../core/platform/process.js';\nimport { existingWebDecision, readWebUrl, webUrlPath } from '../core/platform/web-discovery.js';\n\n/** Write an informational message to stderr. Keeps stdout clean so it can\n * be piped or captured by callers (notably `wd -c` review mode, where\n * stdout carries the comments markdown payload). */\nfunction info(message: string): void {\n process.stderr.write(message + '\\n');\n}\n\n/** Per-scope stable filesystem stem under ~/.work/diffs/. Used by the\n * static-render path to pick its output filename and (legacy) by the\n * `wd -c` comment-server fallback. */\nfunction scopePathStem(repoSpecs: RepoSpec[]): string {\n return stableDiffPath(repoSpecs.map((r) => r.root));\n}\n\n// mode handlers\ninterface RenderContext {\n scope: DiffScope;\n base: string;\n baseSource: ResolvedBase['source'];\n repoSpecs: RepoSpec[];\n /** Stable filesystem stem (no extension) under ~/.work/diffs/. The\n * static-render path appends `.html` to get its output file. */\n scopeStem: string;\n scopeLabel: string;\n}\n\n/**\n * `wd --stop`: de-register this scope from the running work web. The\n * work web process itself keeps running — it's a singleton serving\n * every scope, so killing the server because one user stopped one\n * review would punish every other open tab. Use `work web --stop`\n * to terminate the server.\n */\nasync function runStop(repoSpecs: RepoSpec[]): Promise<void> {\n const webUrl = readWebUrl();\n if (!webUrl) {\n info(chalk.gray('No work web running — nothing to stop.'));\n return;\n }\n // Compute the same scope hash work web does (sha1 of sorted root\n // paths) and DELETE it. `scope-routes.ts` clears the auto-snapshot\n // subscriber + manifest as part of that handler.\n const hash = stableDiffPath(repoSpecs.map((r) => r.root))\n .split(/[\\\\/]/)\n .pop()!;\n try {\n const res = await fetch(`${webUrl}api/scopes/${hash}`, {\n method: 'DELETE',\n });\n if (res.ok) {\n info(chalk.gray('De-registered this scope from work web.'));\n } else {\n info(chalk.yellow(`work web responded ${res.status} — scope may not have been registered.`));\n }\n } catch (err) {\n console.error(chalk.red('Could not reach work web:'), (err as Error).message);\n }\n}\n\nexport { resolveWorkBinPath } from '../core/platform/work-bin.js';\n\n// Discovery of the running work web lives in core/web-discovery.ts;\n// webServerResponds is re-exported for existing callers/tests.\nexport { webServerResponds } from '../core/platform/web-discovery.js';\n\n/**\n * Spawn a detached, lean `work web` instance and wait for its url file\n * to appear. Used when `wd` runs with no existing work web — instead of\n * starting a per-scope standalone daemon, we boot a single shared\n * server in \"lean\" mode (skips the Claude activity watcher + hook\n * installation) and route every subsequent `wd` invocation through it.\n *\n * Returns the discovered URL on success, null on timeout. Safe against\n * a concurrent `wd` racing to do the same thing: the second `work web`\n * detects the singleton via the pid file and exits cleanly; the first\n * winner's url file is what both invocations end up reading.\n */\nasync function ensureWorkWebRunning(): Promise<string | null> {\n const existing = readWebUrl();\n // A non-empty url file is not proof of a live server — it survives\n // crashes and kill -9. Probe before trusting it. If it's stale, fall\n // through to spawn a fresh server. We also delete the stale file first:\n // otherwise `waitForUrlFile` below would read the leftover dead URL and\n // return it immediately, never waiting for the new server's URL, and the\n // subsequent scope POST would fail with connection-refused.\n if (existing) {\n // Busy counts as running: only a server that is really gone is replaced\n // (see existingWebDecision — replacing a busy one orphaned it).\n if ((await existingWebDecision(existing)) === 'reuse') return existing;\n try {\n fs.unlinkSync(webUrlPath());\n } catch {\n /* already gone */\n }\n }\n\n // Spawn `node <work-bin> web --lean --no-open` detached. We're\n // running as either `dist/bin.js` (the `work` binary) or\n // `dist/wd-bin.js` (the `wd` shim). The `web` subcommand only\n // lives on the `work` binary; `resolveWorkBinPath` does the sibling\n // swap when we're the shim.\n const workBin = resolveWorkBinPath(process.argv[1]);\n spawnDetachedWork(workBin, ['web', '--lean', '--no-open'], path.join(os.homedir(), '.work', 'web-autostart.log'));\n\n // Poll the url file. Generous-ish timeout because cold startup\n // includes resolving the SPA dist + binding a port + writing the\n // file; 5 s leaves headroom for slow disks / antivirus on Windows.\n const url = await waitForUrlFile(webUrlPath(), 5000);\n return url;\n}\n\n/**\n * Try to register this scope with a running (or just-spawned) `work\n * web` server. Returns the browser URL to open\n * (e.g. `http://127.0.0.1:54321/diff/abc123`) on success, null when\n * everything (existing instance + autostart) failed.\n */\nasync function tryRegisterWithWorkWeb(ctx: RenderContext, routeKind: 'diff' | 'review'): Promise<string | null> {\n const webUrl = await ensureWorkWebRunning();\n if (!webUrl) return null;\n try {\n const res = await fetch(`${webUrl}api/scopes`, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({\n paths: ctx.repoSpecs.map((r) => r.root),\n label: ctx.scopeLabel,\n }),\n });\n if (!res.ok) return null;\n const body = (await res.json()) as { hash: string };\n const route = routeKind === 'diff' ? 'diff' : 'review';\n return `${webUrl}${route}/${body.hash}`;\n } catch {\n return null;\n }\n}\n\n/** Foreground launcher: opens a diff in the browser via `work web`. When\n * no work web is running, we auto-start a lean one (`tryRegisterWithWorkWeb`\n * handles the spawn + wait) — a single server backs every `wd` invocation\n * across all worktrees, no per-scope daemon class. */\nasync function runLauncher(ctx: RenderContext): Promise<void> {\n const webRouteUrl = await tryRegisterWithWorkWeb(ctx, 'diff');\n if (webRouteUrl) {\n info(chalk.gray(`Opening: ${webRouteUrl}`));\n openUrl(webRouteUrl);\n return;\n }\n // Reached only on autostart failure (port refused, dist/web missing,\n // 5 s wait elapsed). Surface a clear error rather than silently\n // falling back to a per-scope process the user would then leak.\n console.error(chalk.red('Could not start or reach work web.'));\n console.error(\n chalk.gray(`Tail ~/.work/web-autostart.log for diagnostics, or run \\`work web\\` in another shell to inspect startup directly.`),\n );\n process.exitCode = 1;\n}\n\n/**\n * Static-file mode (the default for `wd`). Renders the React SPA shell\n * with the diff data inlined, writes it to ~/.work/diffs/<hash>.html,\n * opens the browser at file://…, and exits. No server, no daemon, no\n * port — the file works forever (modulo your filesystem). Same React\n * components and screens as the live server: file tree, scrollspy,\n * viewed checkboxes, syntax highlighting, intra-line diff.\n *\n * Trade-off: no live reload, no comments. Use `wd --server` (or `wd -c`\n * for review mode) when you need those.\n */\nfunction runStatic(ctx: RenderContext, initialBranch: boolean): void {\n // Always compute the uncommitted scope (cheap, the user expects it as\n // the default tab).\n const uncommitted = buildRepoSpecs(ctx.scope, 'HEAD');\n\n // Try to resolve a parent branch for each repo. If we find one, compute\n // the \"since branch\" scope too so the SPA can offer the toggle. If not,\n // the tab simply doesn't appear.\n //\n // Group worktrees: each sub-repo may have a different parent. We pick a\n // representative resolvedBase from the active repo (or the first one)\n // for the badge label; per-repo merge-base lookups still happen inside\n // buildRepoSpecs.\n const primaryRoot = ctx.scope.repos.find((r) => r.name === ctx.scope.activeRepoName)?.root ?? ctx.scope.repos[0].root;\n // Per-repo fork points (group worktrees forked with different bases). Each\n // repo's spec resolves against its own base inside buildRepoSpecs.\n const perRepoBase = ctx.scope.session?.baseBranches;\n // Representative parent for the badge label: the active repo's recorded\n // base, else the session default, else lenient auto-detect. The lenient\n // finder keeps the toggle available even when the branch has no commits\n // past its parent yet (the diff just renders empty — better than no tab).\n const parent = perRepoBase?.[primaryRoot] ?? ctx.scope.session?.baseBranch ?? findAnyParentBranch(primaryRoot);\n const branch =\n parent === null\n ? undefined\n : {\n specs: buildRepoSpecs(ctx.scope, parent, perRepoBase),\n resolvedBase: parent,\n };\n\n // Don't write a file when both views are empty — `wd` is a viewer,\n // not a generator of empty pages.\n const uncommittedTotal = uncommitted.reduce((s, r) => s + computeDiff({ root: r.root, diffArg: r.diffArg }).length, 0);\n const branchTotal = branch ? branch.specs.reduce((s, r) => s + computeDiff({ root: r.root, diffArg: r.diffArg }).length, 0) : 0;\n if (uncommittedTotal === 0 && branchTotal === 0) {\n info(chalk.gray('No changes to show.'));\n return;\n }\n\n const html = renderStatic({\n scopeLabel: ctx.scopeLabel,\n uncommitted,\n branch,\n initialBase: initialBranch && branch ? 'branch' : 'uncommitted',\n });\n const filePath = `${ctx.scopeStem}.html`;\n fs.writeFileSync(filePath, html, 'utf-8');\n info(chalk.gray(`Wrote ${filePath}`));\n openUrl(`file:///${filePath.replace(/\\\\/g, '/')}`);\n}\n\nfunction waitForUrlFile(filePath: string, timeoutMs: number): Promise<string | null> {\n return new Promise((resolve) => {\n const start = Date.now();\n const tick = () => {\n try {\n const v = fs.readFileSync(filePath, 'utf-8').trim();\n if (v) return resolve(v);\n } catch {\n /* not yet */\n }\n if (Date.now() - start > timeoutMs) return resolve(null);\n setTimeout(tick, 75);\n };\n tick();\n });\n}\n\n/**\n * Try to route `wd -c` through a running `work web`. Registers the scope\n * as a reviewable view, opens the browser at /review/<hash>, then polls\n * the scope's comments and proxies them to stdout as the markers the\n * `wd-review` skill consumes (`--- review started ---`,\n * `--- comment ---`, etc.). Returns true if work web handled the review;\n * the caller falls back to a standalone server when this returns false.\n */\nasync function tryReviewViaWorkWeb(ctx: RenderContext): Promise<boolean> {\n const webUrl = await ensureWorkWebRunning();\n if (!webUrl) return false;\n\n let hash: string;\n try {\n const res = await fetch(`${webUrl}api/scopes`, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({\n paths: ctx.repoSpecs.map((r) => r.root),\n label: ctx.scopeLabel,\n }),\n });\n if (!res.ok) return false;\n hash = ((await res.json()) as { hash: string }).hash;\n } catch {\n return false;\n }\n\n const initialTotal = ctx.repoSpecs.reduce((s, r) => s + computeDiff({ root: r.root, diffArg: r.diffArg }).length, 0);\n const reviewUrl = `${webUrl}review/${hash}`;\n info(chalk.gray(`Opening review in work web: ${reviewUrl}`));\n info(chalk.gray('Comments stream below. Ctrl+C to detach.'));\n process.stdout.write(\n `--- review started ---\\nrepos: ${ctx.repoSpecs.map((r) => r.name).join(', ')}\\nfiles: ${initialTotal}\\nurl: ${reviewUrl}\\n\\n`,\n );\n openUrl(reviewUrl);\n\n // Poll the scope's comments. Cheap (one localhost JSON GET) and\n // simpler than reading SSE chunks in Node. The skill latency budget\n // is generous so 1s is fine.\n const seen = new Set<string>();\n let exiting = false;\n let interval: NodeJS.Timeout | null = null;\n // Reentrancy guard. `setInterval(poll, 1000)` fires every second\n // regardless of whether the previous tick has resolved. A slow `work\n // web` response (>1s) would otherwise let two `poll()`s mutate `seen`\n // concurrently. JS being single-threaded makes interleaving impossible\n // for synchronous blocks but the await points do let two flows\n // interleave — duplicate `--- review done ---` markers if `ended:true`\n // races with a slow prior poll.\n let polling = false;\n\n type SnapshotComment = import('../core/comments/comment-types.js').Comment;\n\n async function poll(): Promise<void> {\n if (exiting || polling) return;\n polling = true;\n try {\n const res = await fetch(`${webUrl}api/scopes/${hash}/comments`);\n if (res.status === 404) {\n // Scope is gone (user explicitly removed it). Treat like\n // End Review for the marker stream.\n process.stdout.write(`--- review done ---\\ntotal: ${seen.size}\\n`);\n cleanup();\n process.exit(0);\n }\n if (!res.ok) return;\n const { comments, ended } = (await res.json()) as {\n comments: SnapshotComment[];\n ended?: boolean;\n };\n // Compute deltas before checking `ended` so any comments posted\n // in the same batch as End Review still flush through.\n const { newComments, deleted } = diffReviewSnapshot(comments, seen);\n for (const id of deleted) {\n process.stdout.write(`--- comment deleted ---\\nid: ${id}\\n\\n`);\n }\n for (const c of newComments) {\n process.stdout.write(formatSingleComment(c));\n }\n // End Review fired: emit the done marker and exit. The scope\n // (and the browser tab) stays viewable — only the CLI proxy\n // stops.\n if (ended) {\n process.stdout.write(`--- review done ---\\ntotal: ${seen.size}\\n`);\n cleanup();\n process.exit(0);\n }\n } catch {\n /* transient — retry next tick */\n } finally {\n polling = false;\n }\n }\n\n function cleanup(): void {\n exiting = true;\n if (interval) clearInterval(interval);\n // Don't deregister — the browser tab and URL should keep working\n // after the CLI exits. Scopes live in work web's memory until it\n // restarts or the user removes them from the dashboard.\n }\n\n const onSignal = () => {\n process.stdout.write(`--- review aborted (signal) ---\\n`);\n cleanup();\n process.exit(0);\n };\n process.on('SIGINT', onSignal);\n process.on('SIGTERM', onSignal);\n\n // Arm the interval BEFORE the first poll. If the first poll triggers\n // cleanup (e.g. scope already ended, 404), `cleanup()` clears this\n // interval correctly — otherwise the previous shape left a small window\n // where setInterval would be assigned AFTER cleanup ran, which mocked\n // tests reproduced (the real runtime survives because process.exit is\n // synchronous, but tests that stub process.exit would leak the timer).\n interval = setInterval(poll, 1000);\n await poll();\n // Block forever — cleanup happens via signal or 404 detection.\n await new Promise(() => {});\n return true;\n}\n\nasync function runReview(ctx: RenderContext): Promise<void> {\n // Quick check — early-exit if nothing to review. (Server will recompute\n // on each /api/diff request thereafter, which is what's served live.)\n const initialTotal = ctx.repoSpecs.reduce((s, r) => s + computeDiff({ root: r.root, diffArg: r.diffArg }).length, 0);\n if (initialTotal === 0) {\n info(chalk.gray('No changes to review.'));\n return;\n }\n\n // Prefer work web when it's running — same consolidation pattern as\n // `wd` (read-only). The CLI proxies the marker stream so the\n // wd-review skill flow is unchanged. Falls back to a standalone\n // comment-server when work web isn't up.\n if (await tryReviewViaWorkWeb(ctx)) return;\n\n const onComment = (c: import('../server/comment-server.js').Comment) => {\n process.stdout.write(formatSingleComment(c));\n };\n const onCommentDeleted = (id: string) => {\n process.stdout.write(`--- comment deleted ---\\nid: ${id}\\n\\n`);\n };\n const onSubmitReviewStart = (info: { count: number; summary: import('../server/comment-server.js').Comment | null }) => {\n const head = `--- review submitted ---\\ncount: ${info.count}${info.summary ? `\\nsummary-id: ${info.summary.id}` : ''}\\n\\n`;\n process.stdout.write(head);\n };\n const onSubmitReviewEnd = () => {\n process.stdout.write(`--- review batch end ---\\n\\n`);\n };\n\n const handle = await startCommentServer({\n repos: ctx.repoSpecs,\n scopeLabel: ctx.scopeLabel,\n sessionBaseBranch: ctx.scope.session?.baseBranch,\n sessionBaseBranches: ctx.scope.session?.baseBranches,\n onComment,\n onCommentDeleted,\n onSubmitReviewStart,\n onSubmitReviewEnd,\n });\n\n // URL discovery is intentionally not persisted to disk. The only\n // consumer (Claude via the wd-review skill) reads it from the\n // `--- review started ---` marker on stdout below. Skipping the\n // file write removes the only way a stale or wrong URL could leak\n // into a different Claude session.\n info(chalk.gray('Opening browser for review. Comments stream as you save them.'));\n info(chalk.gray('Page reloads automatically when you save a file. Click \"End review\" (or Ctrl+C) when finished.'));\n process.stdout.write(\n `--- review started ---\\nrepos: ${ctx.repoSpecs.map((r) => r.name).join(', ')}\\nfiles: ${initialTotal}\\nurl: ${handle.url}\\n\\n`,\n );\n openUrl(handle.url);\n\n const cleanup = () => {\n void handle.stop();\n };\n\n const onSignal = () => {\n process.stdout.write(`--- review aborted (signal) ---\\n`);\n cleanup();\n process.exit(0);\n };\n process.on('SIGINT', onSignal);\n process.on('SIGTERM', onSignal);\n\n const comments = await handle.waitForDone();\n await new Promise((r) => setTimeout(r, 100));\n cleanup();\n process.stdout.write(`--- review done ---\\ntotal: ${comments.length}\\n`);\n}\n\n// command export\nexport const diffCommand: CommandModule = {\n command: 'diff [base]',\n describe: 'Open a GitHub-PR-style diff overview in your browser',\n builder: (yargs) =>\n yargs\n .positional('base', {\n describe:\n 'Base ref to compare against. Default: HEAD (uncommitted only). Use --branch for a full PR-style diff vs the parent branch.',\n type: 'string',\n })\n .option('branch', {\n type: 'boolean',\n default: false,\n describe: 'Open the \"Since branch\" tab by default (still shows uncommitted as the other tab — toggle in the browser).',\n })\n .option('static', {\n type: 'boolean',\n default: false,\n describe:\n 'Write a self-contained HTML file with the current diff inlined (no server, no live reload). The default is a live server you can refresh.',\n })\n .option('server', {\n type: 'boolean',\n default: false,\n hidden: true,\n describe: 'Run a live server (now the default; flag kept for back-compat).',\n })\n .option('watch', {\n type: 'boolean',\n default: false,\n hidden: true,\n describe: 'Alias for --server. Kept for back-compat.',\n })\n .option('stop', {\n type: 'boolean',\n default: false,\n describe:\n 'De-register this scope from work web. The work web server itself keeps running; use `work web --stop` to terminate the server.',\n })\n .option('comments', {\n type: 'boolean',\n alias: 'c',\n default: false,\n describe:\n 'Review mode: open the diff in a browser with a comment UI; block until you click \"Done & Send\", then print all comments to stdout as markdown.',\n }),\n handler: async (argv) => {\n const scope = resolveScope(process.cwd());\n if (!scope) {\n console.error(chalk.red('Not inside a git repository or known worktree.'));\n process.exit(1);\n }\n\n const { base, source: baseSource } = resolveBase(scope, {\n base: argv.base as string | undefined,\n branch: argv.branch as boolean | undefined,\n });\n const repoSpecs = buildRepoSpecs(scope, base);\n const scopeStem = scopePathStem(repoSpecs);\n\n // `wd --stop` doesn't need the full ctx — it only needs the repo\n // specs to derive the scope hash. Short-circuit before the\n // status-message block so a stop call stays quiet.\n if (argv.stop) return runStop(repoSpecs);\n\n // Use stderr for status messages so review mode's stdout stays clean\n // (the comments markdown is the only data wd writes to stdout).\n if (base === 'HEAD') {\n info(chalk.gray('Showing uncommitted changes vs HEAD.'));\n } else {\n info(chalk.gray(`Showing diff vs ${base} [${baseSource}]${scope.isGroup ? `, across ${scope.repos.length} repos` : ''}.`));\n }\n\n const scopeLabel = `${scope.repos.map((r) => r.name).join(', ')} · ${base}`;\n const ctx: RenderContext = {\n scope,\n base,\n baseSource,\n repoSpecs,\n scopeStem,\n scopeLabel,\n };\n\n if (argv.comments) return runReview(ctx);\n if (argv.static) return runStatic(ctx, !!argv.branch);\n // Default: live server via work web. `runLauncher` registers the\n // scope (auto-spawning a lean work web when one isn't running).\n return runLauncher(ctx);\n },\n};\n","import { Hono } from 'hono';\nimport { zValidator } from '@hono/zod-validator';\nimport { createCommentStore } from '../core/comments/comment-store.js';\nimport { startDiffServer, type DiffServerApi, type DiffServerHandle } from './diff-server.js';\nimport type { RepoSpec } from '../core/diff/repo-spec.js';\nimport type { Comment } from '../core/comments/comment-types.js';\nimport { commentInputSchema, resolveSchema, submitReviewSchema } from '../core/comments/comment-schemas.js';\n\nexport type { Comment, CommentAuthor, CommentSide, CommentStatus } from '../core/comments/comment-types.js';\n\nexport interface CommentServerOptions {\n repos: RepoSpec[];\n scopeLabel: string;\n /** Session baseBranch — threaded to the diff server so `?base=branch`\n * honours the user's recorded base instead of auto-detecting. */\n sessionBaseBranch?: string;\n /** Per-repo fork points keyed by repo root (group worktrees forked with\n * different bases per repo). Overrides `sessionBaseBranch` per repo. */\n sessionBaseBranches?: Record<string, string>;\n onComment?: (comment: Comment) => void;\n onCommentDeleted?: (id: string) => void;\n onSubmitReviewStart?: (info: { count: number; summary: Comment | null }) => void;\n onSubmitReviewEnd?: () => void;\n watchDebounceMs?: number;\n}\n\nexport interface CommentServerHandle {\n url: string;\n waitForDone(): Promise<Comment[]>;\n snapshot(): Comment[];\n stop(): Promise<void>;\n}\n\nexport async function startCommentServer(opts: CommentServerOptions): Promise<CommentServerHandle> {\n const store = createCommentStore();\n let resolveDone: ((comments: Comment[]) => void) | null = null;\n const donePromise = new Promise<Comment[]>((resolve) => {\n resolveDone = resolve;\n });\n\n function attachRoutes(api: DiffServerApi): void {\n const routes = new Hono();\n\n routes.get('/api/comments', (c) => c.json({ comments: store.snapshot() }));\n\n routes.post('/api/comments', zValidator('json', commentInputSchema), (c) => {\n try {\n const input = c.req.valid('json');\n const comment = store.post(input);\n if (comment.status === 'published' && comment.author === 'user' && opts.onComment) {\n opts.onComment(comment);\n }\n if (comment.author === 'claude') {\n api.broadcast('comments-changed', { id: comment.id });\n }\n return c.json({ comment, comments: store.snapshot() });\n } catch (err) {\n return c.json({ error: (err as Error).message }, 400);\n }\n });\n\n routes.delete('/api/comments/:id', (c) => {\n const id = c.req.param('id');\n const removed = store.remove(id);\n if (removed && opts.onCommentDeleted) opts.onCommentDeleted(id);\n return c.json({ comments: store.snapshot() });\n });\n\n routes.post('/api/comments/:id/resolve', zValidator('json', resolveSchema), (c) => {\n const updated = store.setResolved(c.req.param('id'), c.req.valid('json').resolved);\n if (updated) api.broadcast('comments-changed', { id: updated.id });\n return c.json({ comments: store.snapshot() });\n });\n\n routes.post('/api/submit-review', zValidator('json', submitReviewSchema), (c) => {\n const body = c.req.valid('json');\n const result = store.submit(body.summary);\n if (opts.onSubmitReviewStart) {\n opts.onSubmitReviewStart({\n count: result.drafts.length,\n summary: result.summary,\n });\n }\n if (result.summary && opts.onComment) opts.onComment(result.summary);\n if (opts.onComment) {\n for (const d of result.drafts) opts.onComment(d);\n }\n if (opts.onSubmitReviewEnd) opts.onSubmitReviewEnd();\n return c.json({\n count: result.drafts.length,\n comments: store.snapshot(),\n });\n });\n\n routes.post('/api/discard-review', (c) => {\n const discarded = store.discardDrafts();\n return c.json({ discarded, comments: store.snapshot() });\n });\n\n routes.post('/api/done', (c) => {\n const out = c.json({ ok: true, count: store.list().length });\n if (resolveDone) {\n resolveDone(store.snapshot());\n resolveDone = null;\n }\n return out;\n });\n\n api.route('/', routes);\n }\n\n const server: DiffServerHandle = await startDiffServer({\n repos: opts.repos,\n scopeLabel: opts.scopeLabel,\n sessionBaseBranch: opts.sessionBaseBranch,\n sessionBaseBranches: opts.sessionBaseBranches,\n watchDebounceMs: opts.watchDebounceMs,\n attachRoutes,\n });\n\n return {\n url: server.url,\n waitForDone: () => donePromise,\n snapshot: () => store.snapshot(),\n stop: () => server.stop(),\n };\n}\n\n/** Read-only variant: diff + watch + SSE only. Used by `wd` / `wd --watch`. */\nexport async function startReadOnlyDiffServer(opts: {\n repos: RepoSpec[];\n scopeLabel: string;\n sessionBaseBranch?: string;\n watchDebounceMs?: number;\n}): Promise<{ url: string; stop: () => Promise<void> }> {\n const server = await startDiffServer({\n repos: opts.repos,\n scopeLabel: opts.scopeLabel,\n sessionBaseBranch: opts.sessionBaseBranch,\n watchDebounceMs: opts.watchDebounceMs,\n readOnly: true,\n });\n return { url: server.url, stop: () => server.stop() };\n}\n\n/** Format a single comment as a markdown chunk for stdout. */\nexport function formatSingleComment(c: Comment): string {\n const bodyLines = c.body\n .split('\\n')\n .map((l) => `> ${l}`)\n .join('\\n');\n const header =\n c.side === 'general'\n ? `**General review comment**`\n : c.side === 'file'\n ? `**${c.repo}/${c.file}** : whole file`\n : `**${c.repo}/${c.file}** : line ${c.line} (${c.side})`;\n const meta: string[] = [];\n if (c.author === 'claude') meta.push('author: claude');\n if (c.parentId) meta.push(`reply-to: ${c.parentId}`);\n meta.push(`id: ${c.id}`);\n return [`--- comment ---`, header, meta.join(' · '), bodyLines, ``].join('\\n');\n}\n","/**\n * Pure helper for the `wd -c` polling loop in `commands/diff.ts`.\n *\n * Given the previous-tick set of \"seen\" comment ids and the current\n * snapshot, return:\n * - new published comments to emit (in snapshot order)\n * - deleted ids to emit\n * - the next `seen` set to track going into the following tick\n *\n * The function MUTATES `seen` in place by adding new ids and removing\n * deleted ones. Callers can read `seen.size` after this returns to get\n * the running total — that's what's reported as `--- review done --- total`.\n *\n * Extracted from inline logic in `tryReviewViaWorkWeb` so it can be\n * tested without standing up a fake HTTP server or mocking process.exit.\n * The C-1 review finding (deleted ids never pruned, inflating the\n * reported total) lived here.\n */\n\nimport type { Comment } from './comment-types.js';\n\nexport interface SnapshotDiff {\n /** Published comments not already in `seen`, in snapshot order. */\n newComments: Comment[];\n /** Ids present in `seen` but missing from the current snapshot. */\n deleted: string[];\n}\n\nexport function diffReviewSnapshot(snapshot: Comment[], seen: Set<string>): SnapshotDiff {\n const now = new Set(snapshot.map((c) => c.id));\n\n const deleted: string[] = [];\n for (const id of seen) {\n if (!now.has(id)) deleted.push(id);\n }\n for (const id of deleted) seen.delete(id);\n\n const newComments: Comment[] = [];\n for (const c of snapshot) {\n if (seen.has(c.id)) continue;\n if (c.status === 'draft') continue;\n newComments.push(c);\n }\n for (const c of snapshot) {\n if (c.status === 'published') seen.add(c.id);\n }\n\n return { newComments, deleted };\n}\n","import fs from 'node:fs';\nimport path from 'node:path';\nimport { computeDiff } from './diff-pipeline.js';\nimport { resolveWebRoot } from '../platform/web-static.js';\nimport type { RepoSpec } from './repo-spec.js';\n\nexport type DiffBase = 'uncommitted' | 'branch';\n\nexport interface DiffPayload {\n repos: {\n name: string;\n root: string;\n files: ReturnType<typeof computeDiff>;\n }[];\n /** The ref the diff was computed against (HEAD for uncommitted, e.g.\n * `origin/main` for branch). */\n resolvedBase: string;\n}\n\nexport interface StaticBootData {\n context: {\n mode: 'review';\n scopeLabel: string;\n repos: { name: string }[];\n readOnly: true;\n staticMode: true;\n /** Which tab the SPA opens on. The user can toggle to the other one\n * in-browser; both diffs are inlined. */\n initialBase: DiffBase;\n };\n /** Both scopes, computed ahead of time. The SPA picks one based on\n * the toggle and re-uses the other when the user clicks across. */\n diffs: {\n uncommitted: DiffPayload;\n branch?: DiffPayload;\n };\n /** Legacy single-scope payload for backward compatibility with any\n * earlier static HTML. Mirrors diffs[initialBase] so an older client\n * that only looks at `diff` still renders. */\n diff: DiffPayload;\n}\n\nexport interface RenderStaticOptions {\n scopeLabel: string;\n /** Always computed (default tab). */\n uncommitted: RepoSpec[];\n /** Optional branch-scope specs. When provided, the SPA gains a\n * \"Since branch\" tab. The resolvedBase shows up next to the file\n * count and in the empty state. */\n branch?: { specs: RepoSpec[]; resolvedBase: string };\n /** Which tab opens by default. Defaults to 'uncommitted' or, when\n * branch specs are provided AND uncommitted has nothing to show,\n * the caller can set this to 'branch'. */\n initialBase?: DiffBase;\n}\n\nfunction buildDiff(specs: RepoSpec[], resolvedBase: string): DiffPayload {\n return {\n repos: specs.map((r) => ({\n name: r.name,\n root: r.root,\n files: computeDiff({ root: r.root, diffArg: r.diffArg }),\n })),\n resolvedBase,\n };\n}\n\n/**\n * Build a self-contained HTML file from the React SPA bundle. Reads the\n * built `dist/web/index.html`, inlines the JS/CSS as <script>/<style>, and\n * injects the boot data so the SPA can render without a server.\n *\n * Computes both diff scopes (Uncommitted vs Since branch) when branch\n * specs are provided so the toggle works entirely client-side — no\n * fetch needed, file:// works.\n */\nexport function renderStatic(opts: RenderStaticOptions): string {\n const webRoot = resolveWebRoot();\n if (!webRoot) {\n throw new Error('Could not find dist/web/. Run `npm run build` first.');\n }\n const shellPath = path.join(webRoot, 'index.html');\n let shell = fs.readFileSync(shellPath, 'utf-8');\n\n const uncommitted = buildDiff(opts.uncommitted, 'HEAD');\n const branch = opts.branch ? buildDiff(opts.branch.specs, opts.branch.resolvedBase) : undefined;\n const initialBase: DiffBase = opts.initialBase ?? 'uncommitted';\n const initial = initialBase === 'branch' && branch ? branch : uncommitted;\n\n const boot: StaticBootData = {\n context: {\n mode: 'review',\n scopeLabel: opts.scopeLabel,\n repos: opts.uncommitted.map((r) => ({ name: r.name })),\n readOnly: true,\n staticMode: true,\n initialBase: branch ? initialBase : 'uncommitted',\n },\n diffs: { uncommitted, branch },\n diff: initial,\n };\n\n // ORDER MATTERS: inject the boot script BEFORE inlining the bundle. The\n // SPA bundle contains literal `</head>` substrings (HTML template helpers\n // inside react-dom / marked / etc.), so replacing `</head>` *after*\n // inlining matches the wrong occurrence and splices JSON into JavaScript.\n // See tests/core/static-renderer.test.ts for the regression test.\n const bootJson = escapeForScriptTag(JSON.stringify(boot));\n const bootScript = `<script>window.__WD_BOOT__=${bootJson};</script>`;\n // String.prototype.replace interprets `$&`, `$'`, `$\\``, `$1`, `$$` in\n // the replacement string. The boot JSON can absolutely contain `$'` —\n // e.g. a shell regex like `'^(None)?$'` — which would silently splice\n // the substring AFTER `</head>` (the SPA's body) into the middle of\n // our JSON. Use a function callback so the replacement is taken\n // verbatim, no $-substitution. (This bit us in real CI logs.)\n shell = shell.replace(/<\\/head>/i, () => `${bootScript}</head>`);\n\n // Inline external CSS/JS so the file works over file:// with no server.\n // Same `</tag` escape rule as the JS inliner — a literal `</style` in\n // the CSS bundle (CSS-in-JS comment strings, minifier quirks) would\n // close the wrapping <style> tag early and dump the rest into HTML.\n shell = shell.replace(/<link rel=\"stylesheet\"[^>]*href=\"([^\"]+)\"[^>]*>/g, (_match, href) => {\n const css = readAsset(webRoot, href);\n if (!css) return '';\n const escaped = css.replace(/<\\/style/gi, '<\\\\/style');\n return `<style>${escaped}</style>`;\n });\n shell = shell.replace(/<script\\b[^>]*\\bsrc=\"([^\"]+)\"[^>]*><\\/script>/g, (_match, src) => {\n const js = readAsset(webRoot, src);\n if (!js) return '';\n // Any literal `</script>` inside the bundle would terminate the outer\n // <script> tag early. Browsers match `</script` case-insensitively\n // with optional whitespace, so escape that form.\n const escaped = js.replace(/<\\/script/gi, '<\\\\/script');\n return `<script type=\"module\">${escaped}</script>`;\n });\n\n return shell;\n}\n\n/**\n * Make a JSON payload safe to embed as a literal value inside a `<script>`\n * tag in HTML. JSON itself is fine, but several characters break when it's\n * inlined as JS source:\n *\n * 1. `</script` (case-insensitive) — closes the wrapping tag.\n * 2. `<!--` — flips the HTML parser into \"script data escaped\" state.\n * Combined with a later `<script` / `-->` it can hide code from the\n * parser; a defensive escape is cheaper than reasoning about it.\n * 3. U+2028 (LINE SEPARATOR) and U+2029 (PARAGRAPH SEPARATOR) — legal\n * inside JSON strings, but treated as line terminators inside JS\n * string literals on older engines. JSON.stringify emits them raw.\n *\n * Patterns use \\uXXXX escapes (not literal characters) so esbuild doesn't\n * interpret them as regex line terminators at parse time.\n */\nexport function escapeForScriptTag(json: string): string {\n // We escape the leading `<` of any HTML-sensitive opener (`</script`,\n // `<!--`) as `<` instead of `\\/` or `\\!`. `<` is the\n // strict-JSON form of `<`, so the output is parsable as JSON AND safe\n // to embed in a <script> tag.\n //\n // U+2028/U+2029: legal in JSON strings but treated as line terminators\n // inside legacy JS string literals. Escape both. RegExp constructor\n // avoids putting a literal line-separator in the source file (esbuild\n // refuses, and they're invisible in diffs).\n //\n // Raw control chars (LF/CR/NUL/etc.): we've seen JSON.stringify output\n // in the wild that somehow contains raw newlines mid-string (cause\n // still under investigation — likely something upstream that hands us\n // a pre-built string masquerading as a JSON fragment). JSON.parse\n // rejects raw control chars in strings, so the SPA crashes with\n // \"Bad control character\" or \"failed to fetch\". Belt-and-suspenders:\n // re-escape every raw control char so the output is always valid JSON\n // regardless of what produced it.\n const LS_RE = new RegExp('\\\\u2028', 'g');\n const PS_RE = new RegExp('\\\\u2029', 'g');\n return json\n .replace(/<(\\/script|!--)/gi, '\\\\u003c$1')\n .replace(LS_RE, '\\\\u2028')\n .replace(PS_RE, '\\\\u2029')\n .replace(/[\\x00-\\x08\\x0b\\x0c\\x0e-\\x1f]/g, (c) => {\n // Skip \\t (0x09), \\n (0x0a), \\r (0x0d) — those are handled below\n // as proper JSON escapes so the parser keeps the line breaks\n // visible if they were intentional.\n return '\\\\u' + c.charCodeAt(0).toString(16).padStart(4, '0');\n })\n .replace(/\\n/g, '\\\\n')\n .replace(/\\r/g, '\\\\r');\n}\n\nfunction readAsset(webRoot: string, urlPath: string): string | null {\n // Strip query string and leading slash; resolve under webRoot.\n const clean = urlPath.split('?')[0].replace(/^\\//, '');\n const full = path.join(webRoot, clean);\n // Guard against path traversal even though the shell controls the URLs.\n if (!path.normalize(full).startsWith(path.normalize(webRoot))) return null;\n try {\n return fs.readFileSync(full, 'utf-8');\n } catch {\n return null;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,OAAOA,SAAQ;AACf,OAAO,QAAQ;AACf,OAAOC,WAAU;AACjB,OAAO,WAAW;;;ACJlB,SAAS,YAAY;AACrB,SAAS,kBAAkB;AAgC3B,eAAsB,mBAAmB,MAA0D;AACjG,QAAM,QAAQ,mBAAmB;AACjC,MAAI,cAAsD;AAC1D,QAAM,cAAc,IAAI,QAAmB,CAAC,YAAY;AACtD,kBAAc;AAAA,EAChB,CAAC;AAED,WAAS,aAAa,KAA0B;AAC9C,UAAM,SAAS,IAAI,KAAK;AAExB,WAAO,IAAI,iBAAiB,CAAC,MAAM,EAAE,KAAK,EAAE,UAAU,MAAM,SAAS,EAAE,CAAC,CAAC;AAEzE,WAAO,KAAK,iBAAiB,WAAW,QAAQ,kBAAkB,GAAG,CAAC,MAAM;AAC1E,UAAI;AACF,cAAM,QAAQ,EAAE,IAAI,MAAM,MAAM;AAChC,cAAM,UAAU,MAAM,KAAK,KAAK;AAChC,YAAI,QAAQ,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CAAC,CAAC,KAAK,MAAM;AAGpD,WAAO,YAAY,GAAG;AAAA,EACxB;AACF;","names":["fs","path","fs","path","info"]}
|
|
1
|
+
{"version":3,"sources":["../src/commands/diff.ts","../src/server/comment-server.ts","../src/core/comments/review-poll.ts","../src/core/diff/static-renderer.ts"],"sourcesContent":["import { resolveWorkBinPath } from '../core/platform/work-bin.js';\nimport fs from 'node:fs';\nimport os from 'node:os';\nimport path from 'node:path';\nimport chalk from 'chalk';\nimport type { CommandModule } from 'yargs';\nimport { computeDiff } from '../core/diff/diff-pipeline.js';\nimport { stableDiffPath, type RepoSpec } from '../core/diff/repo-spec.js';\nimport {\n buildRepoSpecs,\n findAnyParentBranch,\n resolveBase,\n resolveScope,\n type DiffScope,\n type ResolvedBase,\n} from '../core/diff/diff-scope.js';\nimport { formatSingleComment, startCommentServer } from '../server/comment-server.js';\nimport { diffReviewSnapshot } from '../core/comments/review-poll.js';\nimport { renderStatic } from '../core/diff/static-renderer.js';\nimport { openUrl } from '../core/platform/launch.js';\nimport { spawnDetachedWork } from '../core/platform/process.js';\nimport { existingWebDecision, readWebUrl, webUrlPath } from '../core/platform/web-discovery.js';\n\n/** Write an informational message to stderr. Keeps stdout clean so it can\n * be piped or captured by callers (notably `wd -c` review mode, where\n * stdout carries the comments markdown payload). */\nfunction info(message: string): void {\n process.stderr.write(message + '\\n');\n}\n\n/** Per-scope stable filesystem stem under ~/.work/diffs/. Used by the\n * static-render path to pick its output filename and (legacy) by the\n * `wd -c` comment-server fallback. */\nfunction scopePathStem(repoSpecs: RepoSpec[]): string {\n return stableDiffPath(repoSpecs.map((r) => r.root));\n}\n\n// mode handlers\ninterface RenderContext {\n scope: DiffScope;\n base: string;\n baseSource: ResolvedBase['source'];\n repoSpecs: RepoSpec[];\n /** Stable filesystem stem (no extension) under ~/.work/diffs/. The\n * static-render path appends `.html` to get its output file. */\n scopeStem: string;\n scopeLabel: string;\n}\n\n/**\n * `wd --stop`: de-register this scope from the running work web. The\n * work web process itself keeps running — it's a singleton serving\n * every scope, so killing the server because one user stopped one\n * review would punish every other open tab. Use `work web --stop`\n * to terminate the server.\n */\nasync function runStop(repoSpecs: RepoSpec[]): Promise<void> {\n const webUrl = readWebUrl();\n if (!webUrl) {\n info(chalk.gray('No work web running — nothing to stop.'));\n return;\n }\n // Compute the same scope hash work web does (sha1 of sorted root\n // paths) and DELETE it. `scope-routes.ts` clears the auto-snapshot\n // subscriber + manifest as part of that handler.\n const hash = stableDiffPath(repoSpecs.map((r) => r.root))\n .split(/[\\\\/]/)\n .pop()!;\n try {\n const res = await fetch(`${webUrl}api/scopes/${hash}`, {\n method: 'DELETE',\n });\n if (res.ok) {\n info(chalk.gray('De-registered this scope from work web.'));\n } else {\n info(chalk.yellow(`work web responded ${res.status} — scope may not have been registered.`));\n }\n } catch (err) {\n console.error(chalk.red('Could not reach work web:'), (err as Error).message);\n }\n}\n\nexport { resolveWorkBinPath } from '../core/platform/work-bin.js';\n\n// Discovery of the running work web lives in core/web-discovery.ts;\n// webServerResponds is re-exported for existing callers/tests.\nexport { webServerResponds } from '../core/platform/web-discovery.js';\n\n/**\n * Spawn a detached, lean `work web` instance and wait for its url file\n * to appear. Used when `wd` runs with no existing work web — instead of\n * starting a per-scope standalone daemon, we boot a single shared\n * server in \"lean\" mode (skips the Claude activity watcher + hook\n * installation) and route every subsequent `wd` invocation through it.\n *\n * Returns the discovered URL on success, null on timeout. Safe against\n * a concurrent `wd` racing to do the same thing: the second `work web`\n * detects the singleton via the pid file and exits cleanly; the first\n * winner's url file is what both invocations end up reading.\n */\nasync function ensureWorkWebRunning(): Promise<string | null> {\n const existing = readWebUrl();\n // A non-empty url file is not proof of a live server — it survives\n // crashes and kill -9. Probe before trusting it. If it's stale, fall\n // through to spawn a fresh server. We also delete the stale file first:\n // otherwise `waitForUrlFile` below would read the leftover dead URL and\n // return it immediately, never waiting for the new server's URL, and the\n // subsequent scope POST would fail with connection-refused.\n if (existing) {\n // Busy counts as running: only a server that is really gone is replaced\n // (see existingWebDecision — replacing a busy one orphaned it).\n if ((await existingWebDecision(existing)) === 'reuse') return existing;\n try {\n fs.unlinkSync(webUrlPath());\n } catch {\n /* already gone */\n }\n }\n\n // Spawn `node <work-bin> web --lean --no-open` detached. We're\n // running as either `dist/bin.js` (the `work` binary) or\n // `dist/wd-bin.js` (the `wd` shim). The `web` subcommand only\n // lives on the `work` binary; `resolveWorkBinPath` does the sibling\n // swap when we're the shim.\n const workBin = resolveWorkBinPath(process.argv[1]);\n spawnDetachedWork(workBin, ['web', '--lean', '--no-open'], path.join(os.homedir(), '.work', 'web-autostart.log'));\n\n // Poll the url file. Generous-ish timeout because cold startup\n // includes resolving the SPA dist + binding a port + writing the\n // file; 5 s leaves headroom for slow disks / antivirus on Windows.\n const url = await waitForUrlFile(webUrlPath(), 5000);\n return url;\n}\n\n/**\n * Try to register this scope with a running (or just-spawned) `work\n * web` server. Returns the browser URL to open\n * (e.g. `http://127.0.0.1:54321/diff/abc123`) on success, null when\n * everything (existing instance + autostart) failed.\n */\nasync function tryRegisterWithWorkWeb(ctx: RenderContext, routeKind: 'diff' | 'review'): Promise<string | null> {\n const webUrl = await ensureWorkWebRunning();\n if (!webUrl) return null;\n try {\n const res = await fetch(`${webUrl}api/scopes`, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({\n paths: ctx.repoSpecs.map((r) => r.root),\n label: ctx.scopeLabel,\n }),\n });\n if (!res.ok) return null;\n const body = (await res.json()) as { hash: string };\n const route = routeKind === 'diff' ? 'diff' : 'review';\n return `${webUrl}${route}/${body.hash}`;\n } catch {\n return null;\n }\n}\n\n/** Foreground launcher: opens a diff in the browser via `work web`. When\n * no work web is running, we auto-start a lean one (`tryRegisterWithWorkWeb`\n * handles the spawn + wait) — a single server backs every `wd` invocation\n * across all worktrees, no per-scope daemon class. */\nasync function runLauncher(ctx: RenderContext): Promise<void> {\n const webRouteUrl = await tryRegisterWithWorkWeb(ctx, 'diff');\n if (webRouteUrl) {\n info(chalk.gray(`Opening: ${webRouteUrl}`));\n openUrl(webRouteUrl);\n return;\n }\n // Reached only on autostart failure (port refused, dist/web missing,\n // 5 s wait elapsed). Surface a clear error rather than silently\n // falling back to a per-scope process the user would then leak.\n console.error(chalk.red('Could not start or reach work web.'));\n console.error(\n chalk.gray(`Tail ~/.work/web-autostart.log for diagnostics, or run \\`work web\\` in another shell to inspect startup directly.`),\n );\n process.exitCode = 1;\n}\n\n/**\n * Static-file mode (the default for `wd`). Renders the React SPA shell\n * with the diff data inlined, writes it to ~/.work/diffs/<hash>.html,\n * opens the browser at file://…, and exits. No server, no daemon, no\n * port — the file works forever (modulo your filesystem). Same React\n * components and screens as the live server: file tree, scrollspy,\n * viewed checkboxes, syntax highlighting, intra-line diff.\n *\n * Trade-off: no live reload, no comments. Use `wd --server` (or `wd -c`\n * for review mode) when you need those.\n */\nfunction runStatic(ctx: RenderContext, initialBranch: boolean): void {\n // Always compute the uncommitted scope (cheap, the user expects it as\n // the default tab).\n const uncommitted = buildRepoSpecs(ctx.scope, 'HEAD');\n\n // Try to resolve a parent branch for each repo. If we find one, compute\n // the \"since branch\" scope too so the SPA can offer the toggle. If not,\n // the tab simply doesn't appear.\n //\n // Group worktrees: each sub-repo may have a different parent. We pick a\n // representative resolvedBase from the active repo (or the first one)\n // for the badge label; per-repo merge-base lookups still happen inside\n // buildRepoSpecs.\n const primaryRoot = ctx.scope.repos.find((r) => r.name === ctx.scope.activeRepoName)?.root ?? ctx.scope.repos[0].root;\n // Per-repo fork points (group worktrees forked with different bases). Each\n // repo's spec resolves against its own base inside buildRepoSpecs.\n const perRepoBase = ctx.scope.session?.baseBranches;\n // Representative parent for the badge label: the active repo's recorded\n // base, else the session default, else lenient auto-detect. The lenient\n // finder keeps the toggle available even when the branch has no commits\n // past its parent yet (the diff just renders empty — better than no tab).\n const parent = perRepoBase?.[primaryRoot] ?? ctx.scope.session?.baseBranch ?? findAnyParentBranch(primaryRoot);\n const branch =\n parent === null\n ? undefined\n : {\n specs: buildRepoSpecs(ctx.scope, parent, perRepoBase),\n resolvedBase: parent,\n };\n\n // Don't write a file when both views are empty — `wd` is a viewer,\n // not a generator of empty pages.\n const uncommittedTotal = uncommitted.reduce((s, r) => s + computeDiff({ root: r.root, diffArg: r.diffArg }).length, 0);\n const branchTotal = branch ? branch.specs.reduce((s, r) => s + computeDiff({ root: r.root, diffArg: r.diffArg }).length, 0) : 0;\n if (uncommittedTotal === 0 && branchTotal === 0) {\n info(chalk.gray('No changes to show.'));\n return;\n }\n\n const html = renderStatic({\n scopeLabel: ctx.scopeLabel,\n uncommitted,\n branch,\n initialBase: initialBranch && branch ? 'branch' : 'uncommitted',\n });\n const filePath = `${ctx.scopeStem}.html`;\n fs.writeFileSync(filePath, html, 'utf-8');\n info(chalk.gray(`Wrote ${filePath}`));\n openUrl(`file:///${filePath.replace(/\\\\/g, '/')}`);\n}\n\nfunction waitForUrlFile(filePath: string, timeoutMs: number): Promise<string | null> {\n return new Promise((resolve) => {\n const start = Date.now();\n const tick = () => {\n try {\n const v = fs.readFileSync(filePath, 'utf-8').trim();\n if (v) return resolve(v);\n } catch {\n /* not yet */\n }\n if (Date.now() - start > timeoutMs) return resolve(null);\n setTimeout(tick, 75);\n };\n tick();\n });\n}\n\n/**\n * Try to route `wd -c` through a running `work web`. Registers the scope\n * as a reviewable view, opens the browser at /review/<hash>, then polls\n * the scope's comments and proxies them to stdout as the markers the\n * `wd-review` skill consumes (`--- review started ---`,\n * `--- comment ---`, etc.). Returns true if work web handled the review;\n * the caller falls back to a standalone server when this returns false.\n */\nasync function tryReviewViaWorkWeb(ctx: RenderContext): Promise<boolean> {\n const webUrl = await ensureWorkWebRunning();\n if (!webUrl) return false;\n\n let hash: string;\n try {\n const res = await fetch(`${webUrl}api/scopes`, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({\n paths: ctx.repoSpecs.map((r) => r.root),\n label: ctx.scopeLabel,\n }),\n });\n if (!res.ok) return false;\n hash = ((await res.json()) as { hash: string }).hash;\n } catch {\n return false;\n }\n\n const initialTotal = ctx.repoSpecs.reduce((s, r) => s + computeDiff({ root: r.root, diffArg: r.diffArg }).length, 0);\n const reviewUrl = `${webUrl}review/${hash}`;\n info(chalk.gray(`Opening review in work web: ${reviewUrl}`));\n info(chalk.gray('Comments stream below. Ctrl+C to detach.'));\n process.stdout.write(\n `--- review started ---\\nrepos: ${ctx.repoSpecs.map((r) => r.name).join(', ')}\\nfiles: ${initialTotal}\\nurl: ${reviewUrl}\\n\\n`,\n );\n openUrl(reviewUrl);\n\n // Poll the scope's comments. Cheap (one localhost JSON GET) and\n // simpler than reading SSE chunks in Node. The skill latency budget\n // is generous so 1s is fine.\n const seen = new Set<string>();\n let exiting = false;\n let interval: NodeJS.Timeout | null = null;\n // Reentrancy guard. `setInterval(poll, 1000)` fires every second\n // regardless of whether the previous tick has resolved. A slow `work\n // web` response (>1s) would otherwise let two `poll()`s mutate `seen`\n // concurrently. JS being single-threaded makes interleaving impossible\n // for synchronous blocks but the await points do let two flows\n // interleave — duplicate `--- review done ---` markers if `ended:true`\n // races with a slow prior poll.\n let polling = false;\n\n type SnapshotComment = import('../core/comments/comment-types.js').Comment;\n\n async function poll(): Promise<void> {\n if (exiting || polling) return;\n polling = true;\n try {\n const res = await fetch(`${webUrl}api/scopes/${hash}/comments`);\n if (res.status === 404) {\n // Scope is gone (user explicitly removed it). Treat like\n // End Review for the marker stream.\n process.stdout.write(`--- review done ---\\ntotal: ${seen.size}\\n`);\n cleanup();\n process.exit(0);\n }\n if (!res.ok) return;\n const { comments, ended } = (await res.json()) as {\n comments: SnapshotComment[];\n ended?: boolean;\n };\n // Compute deltas before checking `ended` so any comments posted\n // in the same batch as End Review still flush through.\n const { newComments, deleted } = diffReviewSnapshot(comments, seen);\n for (const id of deleted) {\n process.stdout.write(`--- comment deleted ---\\nid: ${id}\\n\\n`);\n }\n for (const c of newComments) {\n process.stdout.write(formatSingleComment(c));\n }\n // End Review fired: emit the done marker and exit. The scope\n // (and the browser tab) stays viewable — only the CLI proxy\n // stops.\n if (ended) {\n process.stdout.write(`--- review done ---\\ntotal: ${seen.size}\\n`);\n cleanup();\n process.exit(0);\n }\n } catch {\n /* transient — retry next tick */\n } finally {\n polling = false;\n }\n }\n\n function cleanup(): void {\n exiting = true;\n if (interval) clearInterval(interval);\n // Don't deregister — the browser tab and URL should keep working\n // after the CLI exits. Scopes live in work web's memory until it\n // restarts or the user removes them from the dashboard.\n }\n\n const onSignal = () => {\n process.stdout.write(`--- review aborted (signal) ---\\n`);\n cleanup();\n process.exit(0);\n };\n process.on('SIGINT', onSignal);\n process.on('SIGTERM', onSignal);\n\n // Arm the interval BEFORE the first poll. If the first poll triggers\n // cleanup (e.g. scope already ended, 404), `cleanup()` clears this\n // interval correctly — otherwise the previous shape left a small window\n // where setInterval would be assigned AFTER cleanup ran, which mocked\n // tests reproduced (the real runtime survives because process.exit is\n // synchronous, but tests that stub process.exit would leak the timer).\n interval = setInterval(poll, 1000);\n await poll();\n // Block forever — cleanup happens via signal or 404 detection.\n await new Promise(() => {});\n return true;\n}\n\nasync function runReview(ctx: RenderContext): Promise<void> {\n // Quick check — early-exit if nothing to review. (Server will recompute\n // on each /api/diff request thereafter, which is what's served live.)\n const initialTotal = ctx.repoSpecs.reduce((s, r) => s + computeDiff({ root: r.root, diffArg: r.diffArg }).length, 0);\n if (initialTotal === 0) {\n info(chalk.gray('No changes to review.'));\n return;\n }\n\n // Prefer work web when it's running — same consolidation pattern as\n // `wd` (read-only). The CLI proxies the marker stream so the\n // wd-review skill flow is unchanged. Falls back to a standalone\n // comment-server when work web isn't up.\n if (await tryReviewViaWorkWeb(ctx)) return;\n\n const onComment = (c: import('../server/comment-server.js').Comment) => {\n process.stdout.write(formatSingleComment(c));\n };\n const onCommentDeleted = (id: string) => {\n process.stdout.write(`--- comment deleted ---\\nid: ${id}\\n\\n`);\n };\n const onSubmitReviewStart = (info: { count: number; summary: import('../server/comment-server.js').Comment | null }) => {\n const head = `--- review submitted ---\\ncount: ${info.count}${info.summary ? `\\nsummary-id: ${info.summary.id}` : ''}\\n\\n`;\n process.stdout.write(head);\n };\n const onSubmitReviewEnd = () => {\n process.stdout.write(`--- review batch end ---\\n\\n`);\n };\n\n const handle = await startCommentServer({\n repos: ctx.repoSpecs,\n scopeLabel: ctx.scopeLabel,\n sessionBaseBranch: ctx.scope.session?.baseBranch,\n sessionBaseBranches: ctx.scope.session?.baseBranches,\n onComment,\n onCommentDeleted,\n onSubmitReviewStart,\n onSubmitReviewEnd,\n });\n\n // URL discovery is intentionally not persisted to disk. The only\n // consumer (Claude via the wd-review skill) reads it from the\n // `--- review started ---` marker on stdout below. Skipping the\n // file write removes the only way a stale or wrong URL could leak\n // into a different Claude session.\n info(chalk.gray('Opening browser for review. Comments stream as you save them.'));\n info(chalk.gray('Page reloads automatically when you save a file. Click \"End review\" (or Ctrl+C) when finished.'));\n process.stdout.write(\n `--- review started ---\\nrepos: ${ctx.repoSpecs.map((r) => r.name).join(', ')}\\nfiles: ${initialTotal}\\nurl: ${handle.url}\\n\\n`,\n );\n openUrl(handle.url);\n\n const cleanup = () => {\n void handle.stop();\n };\n\n const onSignal = () => {\n process.stdout.write(`--- review aborted (signal) ---\\n`);\n cleanup();\n process.exit(0);\n };\n process.on('SIGINT', onSignal);\n process.on('SIGTERM', onSignal);\n\n const comments = await handle.waitForDone();\n await new Promise((r) => setTimeout(r, 100));\n cleanup();\n process.stdout.write(`--- review done ---\\ntotal: ${comments.length}\\n`);\n}\n\n// command export\nexport const diffCommand: CommandModule = {\n command: 'diff [base]',\n describe: 'Open a GitHub-PR-style diff overview in your browser',\n builder: (yargs) =>\n yargs\n .positional('base', {\n describe:\n 'Base ref to compare against. Default: HEAD (uncommitted only). Use --branch for a full PR-style diff vs the parent branch.',\n type: 'string',\n })\n .option('branch', {\n type: 'boolean',\n default: false,\n describe: 'Open the \"Since branch\" tab by default (still shows uncommitted as the other tab — toggle in the browser).',\n })\n .option('static', {\n type: 'boolean',\n default: false,\n describe:\n 'Write a self-contained HTML file with the current diff inlined (no server, no live reload). The default is a live server you can refresh.',\n })\n .option('server', {\n type: 'boolean',\n default: false,\n hidden: true,\n describe: 'Run a live server (now the default; flag kept for back-compat).',\n })\n .option('watch', {\n type: 'boolean',\n default: false,\n hidden: true,\n describe: 'Alias for --server. Kept for back-compat.',\n })\n .option('stop', {\n type: 'boolean',\n default: false,\n describe:\n 'De-register this scope from work web. The work web server itself keeps running; use `work web --stop` to terminate the server.',\n })\n .option('comments', {\n type: 'boolean',\n alias: 'c',\n default: false,\n describe:\n 'Review mode: open the diff in a browser with a comment UI; block until you click \"Done & Send\", then print all comments to stdout as markdown.',\n }),\n handler: async (argv) => {\n const scope = resolveScope(process.cwd());\n if (!scope) {\n console.error(chalk.red('Not inside a git repository or known worktree.'));\n process.exit(1);\n }\n\n const { base, source: baseSource } = resolveBase(scope, {\n base: argv.base as string | undefined,\n branch: argv.branch as boolean | undefined,\n });\n const repoSpecs = buildRepoSpecs(scope, base);\n const scopeStem = scopePathStem(repoSpecs);\n\n // `wd --stop` doesn't need the full ctx — it only needs the repo\n // specs to derive the scope hash. Short-circuit before the\n // status-message block so a stop call stays quiet.\n if (argv.stop) return runStop(repoSpecs);\n\n // Use stderr for status messages so review mode's stdout stays clean\n // (the comments markdown is the only data wd writes to stdout).\n if (base === 'HEAD') {\n info(chalk.gray('Showing uncommitted changes vs HEAD.'));\n } else {\n info(chalk.gray(`Showing diff vs ${base} [${baseSource}]${scope.isGroup ? `, across ${scope.repos.length} repos` : ''}.`));\n }\n\n const scopeLabel = `${scope.repos.map((r) => r.name).join(', ')} · ${base}`;\n const ctx: RenderContext = {\n scope,\n base,\n baseSource,\n repoSpecs,\n scopeStem,\n scopeLabel,\n };\n\n if (argv.comments) return runReview(ctx);\n if (argv.static) return runStatic(ctx, !!argv.branch);\n // Default: live server via work web. `runLauncher` registers the\n // scope (auto-spawning a lean work web when one isn't running).\n return runLauncher(ctx);\n },\n};\n","import { Hono } from 'hono';\nimport { zValidator } from '@hono/zod-validator';\nimport { createCommentStore } from '../core/comments/comment-store.js';\nimport { startDiffServer, type DiffServerApi, type DiffServerHandle } from './diff-server.js';\nimport type { RepoSpec } from '../core/diff/repo-spec.js';\nimport type { Comment } from '../core/comments/comment-types.js';\nimport { commentInputSchema, resolveSchema, submitReviewSchema } from '../core/comments/comment-schemas.js';\n\nexport type { Comment, CommentAuthor, CommentSide, CommentStatus } from '../core/comments/comment-types.js';\n\nexport interface CommentServerOptions {\n repos: RepoSpec[];\n scopeLabel: string;\n /** Session baseBranch — threaded to the diff server so `?base=branch`\n * honours the user's recorded base instead of auto-detecting. */\n sessionBaseBranch?: string;\n /** Per-repo fork points keyed by repo root (group worktrees forked with\n * different bases per repo). Overrides `sessionBaseBranch` per repo. */\n sessionBaseBranches?: Record<string, string>;\n onComment?: (comment: Comment) => void;\n onCommentDeleted?: (id: string) => void;\n onSubmitReviewStart?: (info: { count: number; summary: Comment | null }) => void;\n onSubmitReviewEnd?: () => void;\n watchDebounceMs?: number;\n}\n\nexport interface CommentServerHandle {\n url: string;\n waitForDone(): Promise<Comment[]>;\n snapshot(): Comment[];\n stop(): Promise<void>;\n}\n\nexport async function startCommentServer(opts: CommentServerOptions): Promise<CommentServerHandle> {\n const store = createCommentStore();\n let resolveDone: ((comments: Comment[]) => void) | null = null;\n const donePromise = new Promise<Comment[]>((resolve) => {\n resolveDone = resolve;\n });\n\n function attachRoutes(api: DiffServerApi): void {\n const routes = new Hono();\n\n routes.get('/api/comments', (c) => c.json({ comments: store.snapshot() }));\n\n routes.post('/api/comments', zValidator('json', commentInputSchema), (c) => {\n try {\n const input = c.req.valid('json');\n const comment = store.post(input);\n if (comment.status === 'published' && comment.author === 'user' && opts.onComment) {\n opts.onComment(comment);\n }\n if (comment.author === 'claude') {\n api.broadcast('comments-changed', { id: comment.id });\n }\n return c.json({ comment, comments: store.snapshot() });\n } catch (err) {\n return c.json({ error: (err as Error).message }, 400);\n }\n });\n\n routes.delete('/api/comments/:id', (c) => {\n const id = c.req.param('id');\n const removed = store.remove(id);\n if (removed && opts.onCommentDeleted) opts.onCommentDeleted(id);\n return c.json({ comments: store.snapshot() });\n });\n\n routes.post('/api/comments/:id/resolve', zValidator('json', resolveSchema), (c) => {\n const updated = store.setResolved(c.req.param('id'), c.req.valid('json').resolved);\n if (updated) api.broadcast('comments-changed', { id: updated.id });\n return c.json({ comments: store.snapshot() });\n });\n\n routes.post('/api/submit-review', zValidator('json', submitReviewSchema), (c) => {\n const body = c.req.valid('json');\n const result = store.submit(body.summary);\n if (opts.onSubmitReviewStart) {\n opts.onSubmitReviewStart({\n count: result.drafts.length,\n summary: result.summary,\n });\n }\n if (result.summary && opts.onComment) opts.onComment(result.summary);\n if (opts.onComment) {\n for (const d of result.drafts) opts.onComment(d);\n }\n if (opts.onSubmitReviewEnd) opts.onSubmitReviewEnd();\n return c.json({\n count: result.drafts.length,\n comments: store.snapshot(),\n });\n });\n\n routes.post('/api/discard-review', (c) => {\n const discarded = store.discardDrafts();\n return c.json({ discarded, comments: store.snapshot() });\n });\n\n routes.post('/api/done', (c) => {\n const out = c.json({ ok: true, count: store.list().length });\n if (resolveDone) {\n resolveDone(store.snapshot());\n resolveDone = null;\n }\n return out;\n });\n\n api.route('/', routes);\n }\n\n const server: DiffServerHandle = await startDiffServer({\n repos: opts.repos,\n scopeLabel: opts.scopeLabel,\n sessionBaseBranch: opts.sessionBaseBranch,\n sessionBaseBranches: opts.sessionBaseBranches,\n watchDebounceMs: opts.watchDebounceMs,\n attachRoutes,\n });\n\n return {\n url: server.url,\n waitForDone: () => donePromise,\n snapshot: () => store.snapshot(),\n stop: () => server.stop(),\n };\n}\n\n/** Read-only variant: diff + watch + SSE only. Used by `wd` / `wd --watch`. */\nexport async function startReadOnlyDiffServer(opts: {\n repos: RepoSpec[];\n scopeLabel: string;\n sessionBaseBranch?: string;\n watchDebounceMs?: number;\n}): Promise<{ url: string; stop: () => Promise<void> }> {\n const server = await startDiffServer({\n repos: opts.repos,\n scopeLabel: opts.scopeLabel,\n sessionBaseBranch: opts.sessionBaseBranch,\n watchDebounceMs: opts.watchDebounceMs,\n readOnly: true,\n });\n return { url: server.url, stop: () => server.stop() };\n}\n\n/** Format a single comment as a markdown chunk for stdout. */\nexport function formatSingleComment(c: Comment): string {\n const bodyLines = c.body\n .split('\\n')\n .map((l) => `> ${l}`)\n .join('\\n');\n const header =\n c.side === 'general'\n ? `**General review comment**`\n : c.side === 'file'\n ? `**${c.repo}/${c.file}** : whole file`\n : `**${c.repo}/${c.file}** : line ${c.line} (${c.side})`;\n const meta: string[] = [];\n if (c.author === 'claude') meta.push('author: claude');\n if (c.parentId) meta.push(`reply-to: ${c.parentId}`);\n meta.push(`id: ${c.id}`);\n return [`--- comment ---`, header, meta.join(' · '), bodyLines, ``].join('\\n');\n}\n","/**\n * Pure helper for the `wd -c` polling loop in `commands/diff.ts`.\n *\n * Given the previous-tick set of \"seen\" comment ids and the current\n * snapshot, return:\n * - new published comments to emit (in snapshot order)\n * - deleted ids to emit\n * - the next `seen` set to track going into the following tick\n *\n * The function MUTATES `seen` in place by adding new ids and removing\n * deleted ones. Callers can read `seen.size` after this returns to get\n * the running total — that's what's reported as `--- review done --- total`.\n *\n * Extracted from inline logic in `tryReviewViaWorkWeb` so it can be\n * tested without standing up a fake HTTP server or mocking process.exit.\n * The C-1 review finding (deleted ids never pruned, inflating the\n * reported total) lived here.\n */\n\nimport type { Comment } from './comment-types.js';\n\nexport interface SnapshotDiff {\n /** Published comments not already in `seen`, in snapshot order. */\n newComments: Comment[];\n /** Ids present in `seen` but missing from the current snapshot. */\n deleted: string[];\n}\n\nexport function diffReviewSnapshot(snapshot: Comment[], seen: Set<string>): SnapshotDiff {\n const now = new Set(snapshot.map((c) => c.id));\n\n const deleted: string[] = [];\n for (const id of seen) {\n if (!now.has(id)) deleted.push(id);\n }\n for (const id of deleted) seen.delete(id);\n\n const newComments: Comment[] = [];\n for (const c of snapshot) {\n if (seen.has(c.id)) continue;\n if (c.status === 'draft') continue;\n newComments.push(c);\n }\n for (const c of snapshot) {\n if (c.status === 'published') seen.add(c.id);\n }\n\n return { newComments, deleted };\n}\n","import fs from 'node:fs';\nimport path from 'node:path';\nimport { computeDiff } from './diff-pipeline.js';\nimport { resolveWebRoot } from '../platform/web-static.js';\nimport type { RepoSpec } from './repo-spec.js';\n\nexport type DiffBase = 'uncommitted' | 'branch';\n\nexport interface DiffPayload {\n repos: {\n name: string;\n root: string;\n files: ReturnType<typeof computeDiff>;\n }[];\n /** The ref the diff was computed against (HEAD for uncommitted, e.g.\n * `origin/main` for branch). */\n resolvedBase: string;\n}\n\nexport interface StaticBootData {\n context: {\n mode: 'review';\n scopeLabel: string;\n repos: { name: string }[];\n readOnly: true;\n staticMode: true;\n /** Which tab the SPA opens on. The user can toggle to the other one\n * in-browser; both diffs are inlined. */\n initialBase: DiffBase;\n };\n /** Both scopes, computed ahead of time. The SPA picks one based on\n * the toggle and re-uses the other when the user clicks across. */\n diffs: {\n uncommitted: DiffPayload;\n branch?: DiffPayload;\n };\n /** Legacy single-scope payload for backward compatibility with any\n * earlier static HTML. Mirrors diffs[initialBase] so an older client\n * that only looks at `diff` still renders. */\n diff: DiffPayload;\n}\n\nexport interface RenderStaticOptions {\n scopeLabel: string;\n /** Always computed (default tab). */\n uncommitted: RepoSpec[];\n /** Optional branch-scope specs. When provided, the SPA gains a\n * \"Since branch\" tab. The resolvedBase shows up next to the file\n * count and in the empty state. */\n branch?: { specs: RepoSpec[]; resolvedBase: string };\n /** Which tab opens by default. Defaults to 'uncommitted' or, when\n * branch specs are provided AND uncommitted has nothing to show,\n * the caller can set this to 'branch'. */\n initialBase?: DiffBase;\n}\n\nfunction buildDiff(specs: RepoSpec[], resolvedBase: string): DiffPayload {\n return {\n repos: specs.map((r) => ({\n name: r.name,\n root: r.root,\n files: computeDiff({ root: r.root, diffArg: r.diffArg }),\n })),\n resolvedBase,\n };\n}\n\n/**\n * Build a self-contained HTML file from the React SPA bundle. Reads the\n * built `dist/web/index.html`, inlines the JS/CSS as <script>/<style>, and\n * injects the boot data so the SPA can render without a server.\n *\n * Computes both diff scopes (Uncommitted vs Since branch) when branch\n * specs are provided so the toggle works entirely client-side — no\n * fetch needed, file:// works.\n */\nexport function renderStatic(opts: RenderStaticOptions): string {\n const webRoot = resolveWebRoot();\n if (!webRoot) {\n throw new Error('Could not find dist/web/. Run `npm run build` first.');\n }\n const shellPath = path.join(webRoot, 'index.html');\n let shell = fs.readFileSync(shellPath, 'utf-8');\n\n const uncommitted = buildDiff(opts.uncommitted, 'HEAD');\n const branch = opts.branch ? buildDiff(opts.branch.specs, opts.branch.resolvedBase) : undefined;\n const initialBase: DiffBase = opts.initialBase ?? 'uncommitted';\n const initial = initialBase === 'branch' && branch ? branch : uncommitted;\n\n const boot: StaticBootData = {\n context: {\n mode: 'review',\n scopeLabel: opts.scopeLabel,\n repos: opts.uncommitted.map((r) => ({ name: r.name })),\n readOnly: true,\n staticMode: true,\n initialBase: branch ? initialBase : 'uncommitted',\n },\n diffs: { uncommitted, branch },\n diff: initial,\n };\n\n // ORDER MATTERS: inject the boot script BEFORE inlining the bundle. The\n // SPA bundle contains literal `</head>` substrings (HTML template helpers\n // inside react-dom / marked / etc.), so replacing `</head>` *after*\n // inlining matches the wrong occurrence and splices JSON into JavaScript.\n // See tests/core/static-renderer.test.ts for the regression test.\n const bootJson = escapeForScriptTag(JSON.stringify(boot));\n const bootScript = `<script>window.__WD_BOOT__=${bootJson};</script>`;\n // String.prototype.replace interprets `$&`, `$'`, `$\\``, `$1`, `$$` in\n // the replacement string. The boot JSON can absolutely contain `$'` —\n // e.g. a shell regex like `'^(None)?$'` — which would silently splice\n // the substring AFTER `</head>` (the SPA's body) into the middle of\n // our JSON. Use a function callback so the replacement is taken\n // verbatim, no $-substitution. (This bit us in real CI logs.)\n shell = shell.replace(/<\\/head>/i, () => `${bootScript}</head>`);\n\n // Inline external CSS/JS so the file works over file:// with no server.\n // Same `</tag` escape rule as the JS inliner — a literal `</style` in\n // the CSS bundle (CSS-in-JS comment strings, minifier quirks) would\n // close the wrapping <style> tag early and dump the rest into HTML.\n shell = shell.replace(/<link rel=\"stylesheet\"[^>]*href=\"([^\"]+)\"[^>]*>/g, (_match, href) => {\n const css = readAsset(webRoot, href);\n if (!css) return '';\n const escaped = css.replace(/<\\/style/gi, '<\\\\/style');\n return `<style>${escaped}</style>`;\n });\n shell = shell.replace(/<script\\b[^>]*\\bsrc=\"([^\"]+)\"[^>]*><\\/script>/g, (_match, src) => {\n const js = readAsset(webRoot, src);\n if (!js) return '';\n // Any literal `</script>` inside the bundle would terminate the outer\n // <script> tag early. Browsers match `</script` case-insensitively\n // with optional whitespace, so escape that form.\n const escaped = js.replace(/<\\/script/gi, '<\\\\/script');\n return `<script type=\"module\">${escaped}</script>`;\n });\n\n return shell;\n}\n\n/**\n * Make a JSON payload safe to embed as a literal value inside a `<script>`\n * tag in HTML. JSON itself is fine, but several characters break when it's\n * inlined as JS source:\n *\n * 1. `</script` (case-insensitive) — closes the wrapping tag.\n * 2. `<!--` — flips the HTML parser into \"script data escaped\" state.\n * Combined with a later `<script` / `-->` it can hide code from the\n * parser; a defensive escape is cheaper than reasoning about it.\n * 3. U+2028 (LINE SEPARATOR) and U+2029 (PARAGRAPH SEPARATOR) — legal\n * inside JSON strings, but treated as line terminators inside JS\n * string literals on older engines. JSON.stringify emits them raw.\n *\n * Patterns use \\uXXXX escapes (not literal characters) so esbuild doesn't\n * interpret them as regex line terminators at parse time.\n */\nexport function escapeForScriptTag(json: string): string {\n // We escape the leading `<` of any HTML-sensitive opener (`</script`,\n // `<!--`) as `<` instead of `\\/` or `\\!`. `<` is the\n // strict-JSON form of `<`, so the output is parsable as JSON AND safe\n // to embed in a <script> tag.\n //\n // U+2028/U+2029: legal in JSON strings but treated as line terminators\n // inside legacy JS string literals. Escape both. RegExp constructor\n // avoids putting a literal line-separator in the source file (esbuild\n // refuses, and they're invisible in diffs).\n //\n // Raw control chars (LF/CR/NUL/etc.): we've seen JSON.stringify output\n // in the wild that somehow contains raw newlines mid-string (cause\n // still under investigation — likely something upstream that hands us\n // a pre-built string masquerading as a JSON fragment). JSON.parse\n // rejects raw control chars in strings, so the SPA crashes with\n // \"Bad control character\" or \"failed to fetch\". Belt-and-suspenders:\n // re-escape every raw control char so the output is always valid JSON\n // regardless of what produced it.\n const LS_RE = new RegExp('\\\\u2028', 'g');\n const PS_RE = new RegExp('\\\\u2029', 'g');\n return json\n .replace(/<(\\/script|!--)/gi, '\\\\u003c$1')\n .replace(LS_RE, '\\\\u2028')\n .replace(PS_RE, '\\\\u2029')\n .replace(/[\\x00-\\x08\\x0b\\x0c\\x0e-\\x1f]/g, (c) => {\n // Skip \\t (0x09), \\n (0x0a), \\r (0x0d) — those are handled below\n // as proper JSON escapes so the parser keeps the line breaks\n // visible if they were intentional.\n return '\\\\u' + c.charCodeAt(0).toString(16).padStart(4, '0');\n })\n .replace(/\\n/g, '\\\\n')\n .replace(/\\r/g, '\\\\r');\n}\n\nfunction readAsset(webRoot: string, urlPath: string): string | null {\n // Strip query string and leading slash; resolve under webRoot.\n const clean = urlPath.split('?')[0].replace(/^\\//, '');\n const full = path.join(webRoot, clean);\n // Guard against path traversal even though the shell controls the URLs.\n if (!path.normalize(full).startsWith(path.normalize(webRoot))) return null;\n try {\n return fs.readFileSync(full, 'utf-8');\n } catch {\n return null;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,OAAOA,SAAQ;AACf,OAAO,QAAQ;AACf,OAAOC,WAAU;AACjB,OAAO,WAAW;;;ACJlB,SAAS,YAAY;AACrB,SAAS,kBAAkB;AAgC3B,eAAsB,mBAAmB,MAA0D;AACjG,QAAM,QAAQ,mBAAmB;AACjC,MAAI,cAAsD;AAC1D,QAAM,cAAc,IAAI,QAAmB,CAAC,YAAY;AACtD,kBAAc;AAAA,EAChB,CAAC;AAED,WAAS,aAAa,KAA0B;AAC9C,UAAM,SAA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;AAEA,UAAM,aAAa,GAAG,MAAM,MAAM,IAAI,CAAC,MAAM,EAAE,IAAI,EAAE,KAAK,IAAI,CAAC,SAAM,IAAI;AACzE,UAAM,MAAqB;AAAA,MACzB;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAEA,QAAI,KAAK,SAAU,QAAO,UAAU,GAAG;AACvC,QAAI,KAAK,OAAQ,QAAO,UAAU,KAAK,CAAC,CAAC,KAAK,MAAM;AAGpD,WAAO,YAAY,GAAG;AAAA,EACxB;AACF;","names":["fs","path","fs","path","info"]}
|
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
createDigestSource
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-MC5T6J2V.js";
|
|
5
|
+
import "./chunk-XXOOR3IV.js";
|
|
6
6
|
import {
|
|
7
7
|
askWorkWeb
|
|
8
8
|
} from "./chunk-LB2GAU7E.js";
|
|
9
|
-
import "./chunk-
|
|
9
|
+
import "./chunk-NIMROXWE.js";
|
|
10
10
|
import {
|
|
11
11
|
formatWorked
|
|
12
12
|
} from "./chunk-NEJVK5CF.js";
|
|
13
|
-
import "./chunk-
|
|
14
|
-
import "./chunk-NWKVTUTN.js";
|
|
13
|
+
import "./chunk-B34R6TQO.js";
|
|
15
14
|
import "./chunk-KGHWHAVF.js";
|
|
16
|
-
import "./chunk-
|
|
17
|
-
import "./chunk-ED6YLB4S.js";
|
|
15
|
+
import "./chunk-QGUBOOEN.js";
|
|
18
16
|
import "./chunk-Z6ACV5ZQ.js";
|
|
19
|
-
import "./chunk-JUGF3YE7.js";
|
|
20
|
-
import "./chunk-HK6AZQ5Z.js";
|
|
21
|
-
import "./chunk-XIN6XUFL.js";
|
|
22
|
-
import "./chunk-ETWP7MDS.js";
|
|
23
17
|
import "./chunk-7ZATXG5F.js";
|
|
18
|
+
import "./chunk-JUGF3YE7.js";
|
|
24
19
|
import "./chunk-BR6OWWAA.js";
|
|
20
|
+
import "./chunk-OU3BTWR6.js";
|
|
21
|
+
import "./chunk-YQSWVHKK.js";
|
|
22
|
+
import "./chunk-D4XRXS3P.js";
|
|
23
|
+
import "./chunk-FX4KMK4M.js";
|
|
25
24
|
import "./chunk-M2X6OHHR.js";
|
|
26
25
|
import "./chunk-QOSAWNOU.js";
|
|
27
26
|
import "./chunk-D2J3AD6L.js";
|
|
28
27
|
import "./chunk-5ZCCUM75.js";
|
|
29
28
|
import "./chunk-IAKOKZYW.js";
|
|
29
|
+
import "./chunk-HK6AZQ5Z.js";
|
|
30
30
|
import "./chunk-F2ECTTSY.js";
|
|
31
31
|
|
|
32
32
|
// src/core/conversations/digest-view.ts
|
|
@@ -110,4 +110,4 @@ export {
|
|
|
110
110
|
digestCommand,
|
|
111
111
|
parseSince
|
|
112
112
|
};
|
|
113
|
-
//# sourceMappingURL=digest-
|
|
113
|
+
//# sourceMappingURL=digest-K5LVRZJ2.js.map
|