@ghfs/cli 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +41 -1
- package/dist/cli.mjs +5718 -559
- package/dist/factory-UMSInaa_.mjs +1166 -0
- package/dist/index.d.mts +363 -2
- package/dist/index.mjs +1 -1
- package/dist/ui/200.html +1 -1
- package/dist/ui/404.html +1 -1
- package/dist/ui/_nuxt/2UxHyX5q.js +1 -0
- package/dist/ui/_nuxt/32ctXXKs.js +1 -0
- package/dist/ui/_nuxt/3e1v2bzS.js +1 -0
- package/dist/ui/_nuxt/3t-6YNGz.js +1 -0
- package/dist/ui/_nuxt/4A_iFExJ.js +1 -0
- package/dist/ui/_nuxt/5VeTt0Ye.js +1 -0
- package/dist/ui/_nuxt/5i3qLPDT.js +1 -0
- package/dist/ui/_nuxt/85-TOEBH.js +1 -0
- package/dist/ui/_nuxt/B0m2ddpp.js +1 -0
- package/dist/ui/_nuxt/B0tHio-l.js +1 -0
- package/dist/ui/_nuxt/B1dDrJ26.js +1 -0
- package/dist/ui/_nuxt/B1yitclQ.js +1 -0
- package/dist/ui/_nuxt/B5q1GTce.js +1 -0
- package/dist/ui/_nuxt/B6aJPvgy.js +1 -0
- package/dist/ui/_nuxt/B7c-h3xW.js +1 -0
- package/dist/ui/_nuxt/B7mTdjB0.js +1 -0
- package/dist/ui/_nuxt/BA47KaF1.js +1 -0
- package/dist/ui/_nuxt/BBf5iR-q.js +1 -0
- package/dist/ui/_nuxt/BBxLfTx_.js +1 -0
- package/dist/ui/_nuxt/BDEKrZIi.js +1 -0
- package/dist/ui/_nuxt/BEDo0Tqx.js +1 -0
- package/dist/ui/_nuxt/BERRCDM3.js +1 -0
- package/dist/ui/_nuxt/BETggiCN.js +1 -0
- package/dist/ui/_nuxt/BEwlwnbL.js +1 -0
- package/dist/ui/_nuxt/BFfxhgS-.js +1 -0
- package/dist/ui/_nuxt/BGJmEYvX.js +1 -0
- package/dist/ui/_nuxt/BH7IYjvW.js +1 -0
- package/dist/ui/_nuxt/BIGW1oBm.js +1 -0
- package/dist/ui/_nuxt/BIv1doCn.js +1 -0
- package/dist/ui/_nuxt/BJDFO7_C.js +1 -0
- package/dist/ui/_nuxt/BM1_JUlF.js +1 -0
- package/dist/ui/_nuxt/BMKCr1FU.js +1 -0
- package/dist/ui/_nuxt/BMWR74SV.js +1 -0
- package/dist/ui/_nuxt/BO53GVu8.js +1 -0
- package/dist/ui/_nuxt/BPQ3VLAy.js +1 -0
- package/dist/ui/_nuxt/BQ8w6xss.js +1 -0
- package/dist/ui/_nuxt/BRHolxvo.js +1 -0
- package/dist/ui/_nuxt/BRZ36xJF.js +1 -0
- package/dist/ui/_nuxt/BTJTHyun.js +1 -0
- package/dist/ui/_nuxt/BTifaqeh.js +1 -0
- package/dist/ui/_nuxt/BUtzH8cE.js +1 -0
- package/dist/ui/_nuxt/BUw7H-hv.js +1 -0
- package/dist/ui/_nuxt/BV7otONQ.js +1 -0
- package/dist/ui/_nuxt/BVQ-GDCI.js +1 -0
- package/dist/ui/_nuxt/BVkGXMyj.js +1 -0
- package/dist/ui/_nuxt/BWvSN4gD.js +1 -0
- package/dist/ui/_nuxt/BXkSAIEj.js +1 -0
- package/dist/ui/_nuxt/BYunw83y.js +1 -0
- package/dist/ui/_nuxt/BZvkOJ9d.js +1 -0
- package/dist/ui/_nuxt/B_m7g4N7.js +1 -0
- package/dist/ui/_nuxt/BcOcwvcX.js +1 -0
- package/dist/ui/_nuxt/BcVCzyr7.js +1 -0
- package/dist/ui/_nuxt/BcllPdc-.js +1 -0
- package/dist/ui/_nuxt/BdImnpbu.js +1 -0
- package/dist/ui/_nuxt/BdnUsdx6.js +1 -0
- package/dist/ui/_nuxt/BeJSdlF9.js +1 -0
- package/dist/ui/_nuxt/BfHTSMKl.js +1 -0
- package/dist/ui/_nuxt/BfSCyJF4.js +1 -0
- package/dist/ui/_nuxt/BfjtVDDH.js +1 -0
- package/dist/ui/_nuxt/BgDCqdQA.js +1 -0
- package/dist/ui/_nuxt/BhOHFoWU.js +1 -0
- package/dist/ui/_nuxt/BkioyH1T.js +1 -0
- package/dist/ui/_nuxt/Bkuqu6BP.js +1 -0
- package/dist/ui/_nuxt/BmXAJ9_W.js +1 -0
- package/dist/ui/_nuxt/Bmn6On1c.js +1 -0
- package/dist/ui/_nuxt/Bp6g37R7.js +1 -0
- package/dist/ui/_nuxt/BqNa2AkI.js +1 -0
- package/dist/ui/_nuxt/BqTXFGrv.js +1 -0
- package/dist/ui/_nuxt/BqYA7rlc.js +1 -0
- package/dist/ui/_nuxt/Br6cN0cg.js +1 -0
- package/dist/ui/_nuxt/BsS91CYL.js +1 -0
- package/dist/ui/_nuxt/BshV_Xbc.js +1 -0
- package/dist/ui/_nuxt/BspZqrRM.js +1 -0
- package/dist/ui/_nuxt/BtCnVYZw.js +1 -0
- package/dist/ui/_nuxt/BtOb2qkB.js +1 -0
- package/dist/ui/_nuxt/BthQWCQV.js +1 -0
- package/dist/ui/_nuxt/BtqSS_iP.js +1 -0
- package/dist/ui/_nuxt/Buea-lGh.js +1 -0
- package/dist/ui/_nuxt/BvOdM423.js +1 -0
- package/dist/ui/_nuxt/Bv_4Rxtq.js +1 -0
- package/dist/ui/_nuxt/BvzEVeQv.js +1 -0
- package/dist/ui/_nuxt/Bw305WKR.js +1 -0
- package/dist/ui/_nuxt/BxgE0vQu.js +1 -0
- package/dist/ui/_nuxt/BzJJZx-M.js +1 -0
- package/dist/ui/_nuxt/Bzq9aFVy.js +1 -0
- package/dist/ui/_nuxt/C-SQnVFl.js +1 -0
- package/dist/ui/_nuxt/C0HS_06l.js +1 -0
- package/dist/ui/_nuxt/C0hk2d4L.js +1 -0
- package/dist/ui/_nuxt/C151Ov-r.js +1 -0
- package/dist/ui/_nuxt/C27-OAKa.js +1 -0
- package/dist/ui/_nuxt/C2t-YnRu.js +1 -0
- package/dist/ui/_nuxt/C39BiMTA.js +1 -0
- package/dist/ui/_nuxt/C3B-1QV4.js +1 -0
- package/dist/ui/_nuxt/C3Wv6jpd.js +1 -0
- package/dist/ui/_nuxt/C3mMm8J8.js +1 -0
- package/dist/ui/_nuxt/C4EeE6gA.js +1 -0
- package/dist/ui/_nuxt/C4IJs8-o.js +1 -0
- package/dist/ui/_nuxt/C4gqWexZ.js +1 -0
- package/dist/ui/_nuxt/C5BYcBs_.js +1 -0
- package/dist/ui/_nuxt/C5YyOfLZ.js +1 -0
- package/dist/ui/_nuxt/C7zT0LnQ.js +1 -0
- package/dist/ui/_nuxt/C8M2exoo.js +1 -0
- package/dist/ui/_nuxt/C8lEn-DE.js +1 -0
- package/dist/ui/_nuxt/C98Dy4si.js +1 -0
- package/dist/ui/_nuxt/C9dUb6Cb.js +1 -0
- package/dist/ui/_nuxt/C9oPPf7i.js +1 -0
- package/dist/ui/_nuxt/C9tS-k6U.js +1 -0
- package/dist/ui/_nuxt/CAFt9gP4.js +1 -0
- package/dist/ui/_nuxt/CBaQQc7g.js +1 -0
- package/dist/ui/_nuxt/CDBrVQLm.js +1 -0
- package/dist/ui/_nuxt/CDVJQ6XC.js +1 -0
- package/dist/ui/_nuxt/CDx5xZoG.js +1 -0
- package/dist/ui/_nuxt/CEL-wOlO.js +1 -0
- package/dist/ui/_nuxt/CEu0bR-o.js +1 -0
- package/dist/ui/_nuxt/CFHQjOhq.js +1 -0
- package/dist/ui/_nuxt/CG6Dc4jp.js +1 -0
- package/dist/ui/_nuxt/CH1njM8p.js +1 -0
- package/dist/ui/_nuxt/CHLpvVh8.js +1 -0
- package/dist/ui/_nuxt/CHM0blh-.js +1 -0
- package/dist/ui/_nuxt/CJc9bBzg.js +1 -0
- package/dist/ui/_nuxt/CKIfxQSi.js +1 -0
- package/dist/ui/_nuxt/CLj8gQPS.js +1 -0
- package/dist/ui/_nuxt/CLxacb5B.js +1 -0
- package/dist/ui/_nuxt/CMTm3GFP.js +1 -0
- package/dist/ui/_nuxt/CO1LY3CK.js +1 -0
- package/dist/ui/_nuxt/COkxafJQ.js +1 -0
- package/dist/ui/_nuxt/COt5Ahok.js +1 -0
- package/dist/ui/_nuxt/CRqJ_cUM.js +1 -0
- package/dist/ui/_nuxt/CS3Unz2-.js +1 -0
- package/dist/ui/_nuxt/CSXwinHm.js +1 -0
- package/dist/ui/_nuxt/CTRr51gU.js +1 -0
- package/dist/ui/_nuxt/CUuTKBJd.js +1 -0
- package/dist/ui/_nuxt/CV3vykTa.js +1 -0
- package/dist/ui/_nuxt/CVO1_9PV.js +1 -0
- package/dist/ui/_nuxt/CVdnzihN.js +1 -0
- package/dist/ui/_nuxt/CXtECtnM.js +1 -0
- package/dist/ui/_nuxt/CXvaQtF9.js +1 -0
- package/dist/ui/_nuxt/CYsAdtH9.js +1 -0
- package/dist/ui/_nuxt/CafNBF8u.js +1 -0
- package/dist/ui/_nuxt/CbFg5uaA.js +1 -0
- package/dist/ui/_nuxt/CbfX1IO0.js +1 -0
- package/dist/ui/_nuxt/CcsQSqEB.js +1 -0
- package/dist/ui/_nuxt/CeAyd5Ju.js +1 -0
- package/dist/ui/_nuxt/CeZK1NFH.js +1 -0
- package/dist/ui/_nuxt/CenWIFCC.js +1 -0
- package/dist/ui/_nuxt/CfQXZHmo.js +1 -0
- package/dist/ui/_nuxt/Cg-RD9OK.js +1 -0
- package/dist/ui/_nuxt/ChMvpjG-.js +1 -0
- package/dist/ui/_nuxt/ChS_g7wu.js +1 -0
- package/dist/ui/_nuxt/ChgxH8nk.js +1 -0
- package/dist/ui/_nuxt/Cj5Yp3dK.js +1 -0
- package/dist/ui/_nuxt/CkByrt1z.js +1 -0
- package/dist/ui/_nuxt/CkXjmgJE.js +1 -0
- package/dist/ui/_nuxt/CklMAg4u.js +1 -0
- package/dist/ui/_nuxt/Cmh6b_Ma.js +1 -0
- package/dist/ui/_nuxt/CnnmHF94.js +1 -0
- package/dist/ui/_nuxt/CnsnAmq5.js +1 -0
- package/dist/ui/_nuxt/Co6uUVPk.js +1 -0
- package/dist/ui/_nuxt/CoDkCxhg.js +1 -0
- package/dist/ui/_nuxt/Cp-IABpG.js +1 -0
- package/dist/ui/_nuxt/Cp8Y5tLI.js +1 -0
- package/dist/ui/_nuxt/Cq5zzVJU.js +1 -0
- package/dist/ui/_nuxt/CquLrc37.js +1 -0
- package/dist/ui/_nuxt/CrQuFoFY.js +1 -0
- package/dist/ui/_nuxt/Cs0ovY-E.js +1 -0
- package/dist/ui/_nuxt/CsfeWuGM.js +1 -0
- package/dist/ui/_nuxt/Csfq5Kiy.js +1 -0
- package/dist/ui/_nuxt/CuPHTKiy.js +1 -0
- package/dist/ui/_nuxt/CufHLc7y.js +1 -0
- package/dist/ui/_nuxt/Cuk6v7N8.js +1 -0
- package/dist/ui/_nuxt/Cvjx9yec.js +1 -0
- package/dist/ui/_nuxt/CwoSXNpI.js +1 -0
- package/dist/ui/_nuxt/CxGSJlkm.js +1 -0
- package/dist/ui/_nuxt/CxbxFI8M.js +1 -0
- package/dist/ui/_nuxt/CyktbL80.js +1 -0
- package/dist/ui/_nuxt/CylS5w8V.js +1 -0
- package/dist/ui/_nuxt/Cz2AlsmD.js +1 -0
- package/dist/ui/_nuxt/CzTSHFRz.js +1 -0
- package/dist/ui/_nuxt/D-2ljcwZ.js +1 -0
- package/dist/ui/_nuxt/D0YGMca9.js +1 -0
- package/dist/ui/_nuxt/D0jeqgqx.js +1 -0
- package/dist/ui/_nuxt/D0r3Knsf.js +1 -0
- package/dist/ui/_nuxt/D17OF-Vu.js +1 -0
- package/dist/ui/_nuxt/D1j8_8rp.js +1 -0
- package/dist/ui/_nuxt/D2j5LXpq.js +1 -0
- package/dist/ui/_nuxt/D3apom_0.js +1 -0
- package/dist/ui/_nuxt/D3lLCCz7.js +1 -0
- package/dist/ui/_nuxt/D4_iv3hh.js +1 -0
- package/dist/ui/_nuxt/D4h5O-jR.js +1 -0
- package/dist/ui/_nuxt/D5-asLiD.js +1 -0
- package/dist/ui/_nuxt/D53aC0YG.js +1 -0
- package/dist/ui/_nuxt/D5KoaKCx.js +1 -0
- package/dist/ui/_nuxt/D7o27uSR.js +1 -0
- package/dist/ui/_nuxt/D7oLnXFd.js +1 -0
- package/dist/ui/_nuxt/D82EKSYY.js +1 -0
- package/dist/ui/_nuxt/D82vCrfD.js +1 -0
- package/dist/ui/_nuxt/D87Tk5Gz.js +1 -0
- package/dist/ui/_nuxt/D8l8udqQ.js +1 -0
- package/dist/ui/_nuxt/D93ZcfNL.js +1 -0
- package/dist/ui/_nuxt/D97Zzqfu.js +1 -0
- package/dist/ui/_nuxt/DAi9KRSo.js +1 -0
- package/dist/ui/_nuxt/DCJHYwE6.js +67 -0
- package/dist/ui/_nuxt/DFQXde-d.js +1 -0
- package/dist/ui/_nuxt/DFWUc33u.js +1 -0
- package/dist/ui/_nuxt/DFXneXwc.js +1 -0
- package/dist/ui/_nuxt/DGztddWO.js +1 -0
- package/dist/ui/_nuxt/DH5Ifo-i.js +1 -0
- package/dist/ui/_nuxt/DHCkPAjA.js +1 -0
- package/dist/ui/_nuxt/DHJKELXO.js +1 -0
- package/dist/ui/_nuxt/DHQR4-dF.js +1 -0
- package/dist/ui/_nuxt/DMk3OuwW.js +1 -0
- package/dist/ui/_nuxt/DMkUaiYH.js +1 -0
- package/dist/ui/_nuxt/DMzUqQB5.js +1 -0
- package/dist/ui/_nuxt/DQyhUUbL.js +1 -0
- package/dist/ui/_nuxt/DRcdqDVD.js +1 -0
- package/dist/ui/_nuxt/DRg8JJMk.js +1 -0
- package/dist/ui/_nuxt/DRje8inN.js +1 -0
- package/dist/ui/_nuxt/DRw_LuNl.js +1 -0
- package/dist/ui/_nuxt/DS2KJUFh.js +1 -0
- package/dist/ui/_nuxt/DSSpBswy.js +1 -0
- package/dist/ui/_nuxt/DSvCPggb.js +1 -0
- package/dist/ui/_nuxt/DT3CNIhV.js +1 -0
- package/dist/ui/_nuxt/DToHIG1N.js +1 -0
- package/dist/ui/_nuxt/DUszq2jm.js +1 -0
- package/dist/ui/_nuxt/DV7GczEv.js +1 -0
- package/dist/ui/_nuxt/DVFEvuxE.js +1 -0
- package/dist/ui/_nuxt/DVMEJ2y_.js +1 -0
- package/dist/ui/_nuxt/DVxCFoDh.js +1 -0
- package/dist/ui/_nuxt/{BXG6gk4R.js → DWbelWgw.js} +1 -1
- package/dist/ui/_nuxt/DWedfzmr.js +1 -0
- package/dist/ui/_nuxt/DWrx1Km3.js +1 -0
- package/dist/ui/_nuxt/DXbdFlpD.js +1 -0
- package/dist/ui/_nuxt/DXmwc3jG.js +1 -0
- package/dist/ui/_nuxt/DXvB9xmW.js +1 -0
- package/dist/ui/_nuxt/DYE7WIF3.js +1 -0
- package/dist/ui/_nuxt/DZ9PSxVF.js +1 -0
- package/dist/ui/_nuxt/DZxFcAj9.js +1 -0
- package/dist/ui/_nuxt/D_Q5rh1f.js +1 -0
- package/dist/ui/_nuxt/Da5cRb03.js +1 -0
- package/dist/ui/_nuxt/Dc-5oQ3p.js +1 -0
- package/dist/ui/_nuxt/Dc-i7Zfu.js +1 -0
- package/dist/ui/_nuxt/DcWK9jms.js +1 -0
- package/dist/ui/_nuxt/DcaNXYhu.js +1 -0
- package/dist/ui/_nuxt/Dd19v3D-.js +1 -0
- package/dist/ui/_nuxt/DdkO51Og.js +1 -0
- package/dist/ui/_nuxt/Ddv68eIx.js +1 -0
- package/dist/ui/_nuxt/Des-eS-w.js +1 -0
- package/dist/ui/_nuxt/Df2X-ZUM.js +1 -0
- package/dist/ui/_nuxt/Df6bDoY_.js +1 -0
- package/dist/ui/_nuxt/DfNjGIrv.js +1 -0
- package/dist/ui/_nuxt/DhaVEd23.js +1 -0
- package/dist/ui/_nuxt/DhaYTIfE.js +1 -0
- package/dist/ui/_nuxt/DiuiI0_S.js +1 -0
- package/dist/ui/_nuxt/DjAJT7YJ.js +1 -0
- package/dist/ui/_nuxt/DkFqJrB1.js +1 -0
- package/dist/ui/_nuxt/DkwncUOv.js +1 -0
- package/dist/ui/_nuxt/Dl1uYT3n.js +15 -0
- package/dist/ui/_nuxt/DnULxvSX.js +1 -0
- package/dist/ui/_nuxt/Dpen1YoG.js +1 -0
- package/dist/ui/_nuxt/Dph4kLrZ.js +1 -0
- package/dist/ui/_nuxt/DqQDbK_p.js +1 -0
- package/dist/ui/_nuxt/Dqspr-GT.js +1 -0
- package/dist/ui/_nuxt/DqwNpetd.js +1 -0
- package/dist/ui/_nuxt/DsOJ9woJ.js +1 -0
- package/dist/ui/_nuxt/Dsmy0J62.js +1 -0
- package/dist/ui/_nuxt/Dspwwk_N.js +1 -0
- package/dist/ui/_nuxt/Dx-B1_4e.js +1 -0
- package/dist/ui/_nuxt/DyxjwDmM.js +1 -0
- package/dist/ui/_nuxt/E3gJ1_iC.js +1 -0
- package/dist/ui/_nuxt/GsRaNv29.js +1 -0
- package/dist/ui/_nuxt/HgPamjhh.js +1 -0
- package/dist/ui/_nuxt/IF9eRakj.js +1 -0
- package/dist/ui/_nuxt/IeuSbFQv.js +1 -0
- package/dist/ui/_nuxt/KW6xsasC.js +1 -0
- package/dist/ui/_nuxt/L9t79GZl.js +1 -0
- package/dist/ui/_nuxt/LYj2JSs-.js +1 -0
- package/dist/ui/_nuxt/MRO5bC_T.js +1 -0
- package/dist/ui/_nuxt/MzD3tlZU.js +1 -0
- package/dist/ui/_nuxt/P80f7IUj.js +1 -0
- package/dist/ui/_nuxt/Pmp26Uib.js +1 -0
- package/dist/ui/_nuxt/Project.BMA756E4.css +1 -0
- package/dist/ui/_nuxt/QIJgUcNo.js +1 -0
- package/dist/ui/_nuxt/VOosw3JB.js +1 -0
- package/dist/ui/_nuxt/Ve4PFQV2.js +1 -0
- package/dist/ui/_nuxt/W70NOuRA.js +1 -0
- package/dist/ui/_nuxt/Yzrsuije.js +1 -0
- package/dist/ui/_nuxt/_H4v1dQx.js +1 -0
- package/dist/ui/_nuxt/_ykCGR6B.js +1 -0
- package/dist/ui/_nuxt/bCR0ucgS.js +1 -0
- package/dist/ui/_nuxt/bE4Kk8sk.js +1 -0
- package/dist/ui/_nuxt/bN70gL4F.js +1 -0
- package/dist/ui/_nuxt/builds/latest.json +1 -1
- package/dist/ui/_nuxt/builds/meta/283a6ae8-b1fa-4a56-aab5-927ed1779674.json +1 -0
- package/dist/ui/_nuxt/dwOrl1Do.js +1 -0
- package/dist/ui/_nuxt/e9S_qqu4.js +1 -0
- package/dist/ui/_nuxt/entry.DnCs62PI.css +1 -0
- package/dist/ui/_nuxt/error-404.CiGdHkfa.css +1 -0
- package/dist/ui/_nuxt/error-500.DrZuPeVU.css +1 -0
- package/dist/ui/_nuxt/fuZLfV_i.js +1 -0
- package/dist/ui/_nuxt/g9-lgVsj.js +1 -0
- package/dist/ui/_nuxt/gcz8RCvz.js +1 -0
- package/dist/ui/_nuxt/hJgmCMqR.js +1 -0
- package/dist/ui/_nuxt/hegEt444.js +1 -0
- package/dist/ui/_nuxt/index.C3E0NnSu.css +1 -0
- package/dist/ui/_nuxt/ivQhLDHX.js +11 -0
- package/dist/ui/_nuxt/k_qm7-4y.js +1 -0
- package/dist/ui/_nuxt/ka8bt-K2.js +153 -0
- package/dist/ui/_nuxt/lBpI9LM0.js +1 -0
- package/dist/ui/_nuxt/lXgVvXCa.js +1 -0
- package/dist/ui/_nuxt/mWjccvbQ.js +1 -0
- package/dist/ui/_nuxt/n2N0HUVH.js +1 -0
- package/dist/ui/_nuxt/qdsjHGoJ.js +1 -0
- package/dist/ui/_nuxt/rGO070M0.js +1 -0
- package/dist/ui/_nuxt/rZm6bMo-.js +1 -0
- package/dist/ui/_nuxt/rgL8RFrC.js +1 -0
- package/dist/ui/_nuxt/u5AG7uiY.js +1 -0
- package/dist/ui/_nuxt/uYugtg8r.js +1 -0
- package/dist/ui/_nuxt/vE_lwT2v.js +1 -0
- package/dist/ui/_nuxt/vGWfd6FD.js +1 -0
- package/dist/ui/_nuxt/wDzz0qaB.js +1 -0
- package/dist/ui/_nuxt/wEQ09or8.js +1 -0
- package/dist/ui/_nuxt/yv6CvBhz.js +1 -0
- package/dist/ui/_nuxt/zinMudAE.js +1 -0
- package/dist/ui/hub/index.html +1 -0
- package/dist/ui/hub/queue/index.html +1 -0
- package/dist/ui/hub/recent/index.html +1 -0
- package/dist/ui/index.html +1 -1
- package/dist/ui/queue/index.html +1 -0
- package/dist/ui/recent/index.html +1 -0
- package/package.json +27 -24
- package/skills/ghfs/SKILL.md +10 -0
- package/dist/factory-DypZ8oi9.mjs +0 -570
- package/dist/provider-BFJGpjCs.d.mts +0 -203
- package/dist/server/index.d.mts +0 -287
- package/dist/server/index.mjs +0 -2
- package/dist/server-n1FLF8Xo.mjs +0 -3331
- package/dist/ui/_nuxt/BMIwt_GL.js +0 -1
- package/dist/ui/_nuxt/DA9k4Rdg.js +0 -69
- package/dist/ui/_nuxt/builds/meta/64045338-3c37-4c7d-a0df-5b21000f8b0a.json +0 -1
- package/dist/ui/_nuxt/entry.B5oa46-c.css +0 -1
- package/dist/ui/_nuxt/error-404.CktHaldI.css +0 -1
- package/dist/ui/_nuxt/error-500.DVdbZfrj.css +0 -1
|
@@ -0,0 +1,1166 @@
|
|
|
1
|
+
import { defineDiagnostics } from "nostics";
|
|
2
|
+
import { retry } from "@octokit/plugin-retry";
|
|
3
|
+
import { throttling } from "@octokit/plugin-throttling";
|
|
4
|
+
import { Octokit } from "octokit";
|
|
5
|
+
//#region src/diagnostics/index.ts
|
|
6
|
+
const diagnostics = defineDiagnostics({
|
|
7
|
+
docsBase: (code) => `https://github.com/antfu/ghfs/blob/main/docs/errors/${code.toLowerCase()}.md`,
|
|
8
|
+
codes: {
|
|
9
|
+
GHFS0001: {
|
|
10
|
+
why: "Missing GitHub token.",
|
|
11
|
+
fix: "Set GH_TOKEN or GITHUB_TOKEN, or run `gh auth login`."
|
|
12
|
+
},
|
|
13
|
+
GHFS0002: {
|
|
14
|
+
why: "Token prompt cancelled.",
|
|
15
|
+
fix: "Re-run the command and provide a token when prompted, or set GH_TOKEN/GITHUB_TOKEN."
|
|
16
|
+
},
|
|
17
|
+
GHFS0010: {
|
|
18
|
+
why: (p) => `Invalid --repo value: ${p.value}`,
|
|
19
|
+
fix: "Use `owner/name`, a full GitHub URL, or a git remote URL."
|
|
20
|
+
},
|
|
21
|
+
GHFS0011: {
|
|
22
|
+
why: (p) => `Invalid repo in ghfs.config.ts: ${p.value}`,
|
|
23
|
+
fix: "Use `owner/name`, a full GitHub URL, or a git remote URL."
|
|
24
|
+
},
|
|
25
|
+
GHFS0012: {
|
|
26
|
+
why: "Repository selection cancelled.",
|
|
27
|
+
fix: "Pass `--repo owner/name` or set `repo` in ghfs.config.ts to select non-interactively."
|
|
28
|
+
},
|
|
29
|
+
GHFS0013: {
|
|
30
|
+
why: (p) => `Invalid repository selection: ${p.value}`,
|
|
31
|
+
fix: "Pick one of the detected candidates or pass `--repo` explicitly."
|
|
32
|
+
},
|
|
33
|
+
GHFS0014: {
|
|
34
|
+
why: (p) => `Repo mismatch detected. git=${p.gitRepo} package.json=${p.pkgRepo}.`,
|
|
35
|
+
fix: "Use `--repo` to disambiguate."
|
|
36
|
+
},
|
|
37
|
+
GHFS0015: {
|
|
38
|
+
why: "Could not resolve repository.",
|
|
39
|
+
fix: "Provide `--repo` or set `repo` in ghfs.config.ts."
|
|
40
|
+
},
|
|
41
|
+
GHFS0016: {
|
|
42
|
+
why: (p) => `Invalid repo slug: ${p.repo}`,
|
|
43
|
+
fix: "Use the `owner/name` form."
|
|
44
|
+
},
|
|
45
|
+
GHFS0100: {
|
|
46
|
+
why: "Interactive execute prompts are unavailable.",
|
|
47
|
+
fix: "Use `--non-interactive` or provide prompts."
|
|
48
|
+
},
|
|
49
|
+
GHFS0101: {
|
|
50
|
+
why: (p) => `Operation conflict: remote updated_at=${p.remoteUpdatedAt}`,
|
|
51
|
+
fix: "Re-run `ghfs sync` to refresh tracked state, then retry the operation."
|
|
52
|
+
},
|
|
53
|
+
GHFS0102: { why: "Execution cancelled." },
|
|
54
|
+
GHFS0103: {
|
|
55
|
+
why: (p) => `Unsupported action: ${p.action}`,
|
|
56
|
+
fix: "Use one of the supported action names. See README for the list."
|
|
57
|
+
},
|
|
58
|
+
GHFS0104: { why: (p) => `Action ${p.action} requires ${p.issue} to be a pull request.` },
|
|
59
|
+
GHFS0105: {
|
|
60
|
+
why: (p) => `Failed to parse execute YAML: ${p.detail}`,
|
|
61
|
+
fix: "Check the YAML syntax in execute.yml."
|
|
62
|
+
},
|
|
63
|
+
GHFS0106: {
|
|
64
|
+
why: (p) => `Invalid execute file: ${p.detail}`,
|
|
65
|
+
fix: "Verify that every operation has the required fields and allowed types."
|
|
66
|
+
},
|
|
67
|
+
GHFS0107: {
|
|
68
|
+
why: (p) => `Invalid execute file: ${p.detail}`,
|
|
69
|
+
fix: "Use one of the supported action names."
|
|
70
|
+
},
|
|
71
|
+
GHFS0108: {
|
|
72
|
+
why: (p) => `Invalid execute file: ${p.detail}`,
|
|
73
|
+
fix: "Fix the listed rule violations and retry."
|
|
74
|
+
},
|
|
75
|
+
GHFS0150: { why: "invalid quoted string syntax" },
|
|
76
|
+
GHFS0151: { why: (p) => `unrecognized action pattern: ${p.command}` },
|
|
77
|
+
GHFS0152: { why: (p) => `${p.command} expects: ${p.syntax}` },
|
|
78
|
+
GHFS0153: { why: (p) => `${p.command} expects a single issue reference (#123)` },
|
|
79
|
+
GHFS0154: { why: (p) => `${p.command} requires at least one label` },
|
|
80
|
+
GHFS0155: { why: (p) => `${p.command} requires at least one assignee` },
|
|
81
|
+
GHFS0156: { why: (p) => `${p.command} requires a non-empty comment` },
|
|
82
|
+
GHFS0157: { why: (p) => `${p.command} expects one or more issue references (#123 #456)` },
|
|
83
|
+
GHFS0160: { why: (p) => `per-item: missing markdown for ${p.issue} (${p.path})` },
|
|
84
|
+
GHFS0161: { why: (p) => `per-item: invalid or missing frontmatter for ${p.issue}` },
|
|
85
|
+
GHFS0200: {
|
|
86
|
+
why: "A sync is already in progress.",
|
|
87
|
+
fix: "Wait for the current sync to finish, then retry."
|
|
88
|
+
},
|
|
89
|
+
GHFS0201: {
|
|
90
|
+
why: "An execute is already in progress.",
|
|
91
|
+
fix: "Wait for the current execute run to finish, then retry."
|
|
92
|
+
},
|
|
93
|
+
GHFS0202: { why: (p) => `Queue entry not found: ${p.id}` },
|
|
94
|
+
GHFS0203: { why: (p) => `Cannot remove a per-item edit from the queue. Edit ${p.target} directly to adjust it.` },
|
|
95
|
+
GHFS0204: { why: "execute.md not found; cannot remove op." },
|
|
96
|
+
GHFS0205: { why: (p) => `Cannot edit ${p.source} ops from the queue panel.` },
|
|
97
|
+
GHFS0206: { why: (p) => p.detail },
|
|
98
|
+
GHFS0300: { why: (p) => `Unexpected patch response for pull ${p.issue}.` },
|
|
99
|
+
GHFS0301: {
|
|
100
|
+
why: (p) => `Milestone not found: ${p.value}`,
|
|
101
|
+
fix: "Create the milestone on GitHub, or pass its numeric id."
|
|
102
|
+
},
|
|
103
|
+
GHFS0302: {
|
|
104
|
+
why: "Cannot remove a reaction without an authenticated user.",
|
|
105
|
+
fix: "Ensure GH_TOKEN/GITHUB_TOKEN is set so ghfs knows which user's reaction to remove."
|
|
106
|
+
},
|
|
107
|
+
GHFS0400: { why: "Sync context was not initialized." },
|
|
108
|
+
GHFS0401: { why: (p) => `Missing tracked canonical data for ${p.issue}.` }
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
//#endregion
|
|
112
|
+
//#region src/logger.ts
|
|
113
|
+
function formatInline(d) {
|
|
114
|
+
return `[${d.name}] ${d.message}`;
|
|
115
|
+
}
|
|
116
|
+
//#endregion
|
|
117
|
+
//#region src/utils/repo.ts
|
|
118
|
+
function splitRepo(repo) {
|
|
119
|
+
const [owner, name] = repo.split("/");
|
|
120
|
+
if (!owner || !name) throw diagnostics.GHFS0016({ repo });
|
|
121
|
+
return {
|
|
122
|
+
owner,
|
|
123
|
+
repo: name
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
//#endregion
|
|
127
|
+
//#region src/utils/color.ts
|
|
128
|
+
function randomHexColor() {
|
|
129
|
+
return Math.floor(Math.random() * 16777216).toString(16).padStart(6, "0");
|
|
130
|
+
}
|
|
131
|
+
//#endregion
|
|
132
|
+
//#region src/utils/format.ts
|
|
133
|
+
function formatIssueNumber(number, options = {}) {
|
|
134
|
+
const label = `#${number}`;
|
|
135
|
+
if (!options.repo) return label;
|
|
136
|
+
return formatTerminalLink(label, toGitHubIssueUrl(options.repo, number, options.kind));
|
|
137
|
+
}
|
|
138
|
+
function formatTerminalLink(text, url) {
|
|
139
|
+
return `\u001B]8;;${url}\u001B\\${text}\u001B]8;;\u001B\\`;
|
|
140
|
+
}
|
|
141
|
+
function toGitHubIssueUrl(repo, number, kind = "issue") {
|
|
142
|
+
return `https://github.com/${repo}/${kind === "pull" ? "pull" : "issues"}/${number}`;
|
|
143
|
+
}
|
|
144
|
+
function formatValue(value) {
|
|
145
|
+
if (value == null) return "";
|
|
146
|
+
if (value instanceof Date) return `${value.toLocaleString()} (${formatRelativeTime(value)})`;
|
|
147
|
+
if (typeof value === "number") return formatNumber(value);
|
|
148
|
+
return String(value);
|
|
149
|
+
}
|
|
150
|
+
function formatNumber(value) {
|
|
151
|
+
return value.toLocaleString();
|
|
152
|
+
}
|
|
153
|
+
function formatRelativeTime(date) {
|
|
154
|
+
const diff = (/* @__PURE__ */ new Date()).getTime() - date.getTime();
|
|
155
|
+
if (diff < 1e3) return "just now";
|
|
156
|
+
if (diff < 6e4) return `${Math.round(diff / 1e3)}s ago`;
|
|
157
|
+
if (diff < 36e5) return `${Math.round(diff / 6e4)}m ago`;
|
|
158
|
+
return date.toLocaleString();
|
|
159
|
+
}
|
|
160
|
+
function countNoun(count, singular, plural = `${singular}s`) {
|
|
161
|
+
return `${count} ${count === 1 ? singular : plural}`;
|
|
162
|
+
}
|
|
163
|
+
function formatDuration(durationMs) {
|
|
164
|
+
if (durationMs < 1e3) return `${durationMs}ms`;
|
|
165
|
+
return `${(durationMs / 1e3).toFixed(2)}s`;
|
|
166
|
+
}
|
|
167
|
+
//#endregion
|
|
168
|
+
//#region src/utils/reactions.ts
|
|
169
|
+
const REACTION_KEYS = [
|
|
170
|
+
"plusOne",
|
|
171
|
+
"minusOne",
|
|
172
|
+
"laugh",
|
|
173
|
+
"hooray",
|
|
174
|
+
"confused",
|
|
175
|
+
"heart",
|
|
176
|
+
"rocket",
|
|
177
|
+
"eyes"
|
|
178
|
+
];
|
|
179
|
+
/**
|
|
180
|
+
* GitHub's wire format for reaction content (REST + GraphQL accept these
|
|
181
|
+
* strings, sometimes uppercased in GraphQL). Order matches REACTION_KEYS.
|
|
182
|
+
*/
|
|
183
|
+
const REACTION_CONTENTS = [
|
|
184
|
+
"+1",
|
|
185
|
+
"-1",
|
|
186
|
+
"laugh",
|
|
187
|
+
"hooray",
|
|
188
|
+
"confused",
|
|
189
|
+
"heart",
|
|
190
|
+
"rocket",
|
|
191
|
+
"eyes"
|
|
192
|
+
];
|
|
193
|
+
const CONTENT_TO_KEY = {
|
|
194
|
+
"+1": "plusOne",
|
|
195
|
+
"-1": "minusOne",
|
|
196
|
+
"laugh": "laugh",
|
|
197
|
+
"hooray": "hooray",
|
|
198
|
+
"confused": "confused",
|
|
199
|
+
"heart": "heart",
|
|
200
|
+
"rocket": "rocket",
|
|
201
|
+
"eyes": "eyes"
|
|
202
|
+
};
|
|
203
|
+
function reactionKeyFromContent(content) {
|
|
204
|
+
return CONTENT_TO_KEY[content];
|
|
205
|
+
}
|
|
206
|
+
function isReactionContent(value) {
|
|
207
|
+
return typeof value === "string" && REACTION_CONTENTS.includes(value);
|
|
208
|
+
}
|
|
209
|
+
function createEmptyReactions() {
|
|
210
|
+
return {
|
|
211
|
+
totalCount: 0,
|
|
212
|
+
plusOne: 0,
|
|
213
|
+
minusOne: 0,
|
|
214
|
+
laugh: 0,
|
|
215
|
+
hooray: 0,
|
|
216
|
+
confused: 0,
|
|
217
|
+
heart: 0,
|
|
218
|
+
rocket: 0,
|
|
219
|
+
eyes: 0
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
function normalizeReactions(reactions) {
|
|
223
|
+
const normalized = createEmptyReactions();
|
|
224
|
+
if (!reactions) return normalized;
|
|
225
|
+
for (const key of REACTION_KEYS) normalized[key] = normalizeCount(reactions[key]);
|
|
226
|
+
const computedTotal = REACTION_KEYS.reduce((sum, key) => sum + normalized[key], 0);
|
|
227
|
+
normalized.totalCount = Math.max(normalizeCount(reactions.totalCount), computedTotal);
|
|
228
|
+
return normalized;
|
|
229
|
+
}
|
|
230
|
+
function normalizeCount(value) {
|
|
231
|
+
if (typeof value !== "number") return 0;
|
|
232
|
+
if (!Number.isFinite(value)) return 0;
|
|
233
|
+
if (value <= 0) return 0;
|
|
234
|
+
return Math.floor(value);
|
|
235
|
+
}
|
|
236
|
+
//#endregion
|
|
237
|
+
//#region src/providers/helpers.ts
|
|
238
|
+
async function collectPages(pages) {
|
|
239
|
+
const items = [];
|
|
240
|
+
for await (const page of pages) items.push(...page);
|
|
241
|
+
return items;
|
|
242
|
+
}
|
|
243
|
+
async function* iteratePages(pages) {
|
|
244
|
+
for await (const page of pages) for (const item of page) yield item;
|
|
245
|
+
}
|
|
246
|
+
//#endregion
|
|
247
|
+
//#region src/providers/github/client.ts
|
|
248
|
+
const BaseOctokit = Octokit.plugin(retry, throttling);
|
|
249
|
+
function createGitHubClient(token) {
|
|
250
|
+
return new BaseOctokit({
|
|
251
|
+
auth: token,
|
|
252
|
+
throttle: {
|
|
253
|
+
onRateLimit: (retryAfter, options) => {
|
|
254
|
+
if ((options.request.retryCount ?? 0) < 2) return true;
|
|
255
|
+
return false;
|
|
256
|
+
},
|
|
257
|
+
onSecondaryRateLimit: () => {
|
|
258
|
+
return false;
|
|
259
|
+
}
|
|
260
|
+
},
|
|
261
|
+
retry: {
|
|
262
|
+
doNotRetry: [401, 403],
|
|
263
|
+
retries: 2
|
|
264
|
+
}
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
//#endregion
|
|
268
|
+
//#region src/providers/github/provider.ts
|
|
269
|
+
function createGitHubProvider(options) {
|
|
270
|
+
const octokit = createGitHubClient(options.token);
|
|
271
|
+
const { owner, repo } = options;
|
|
272
|
+
let requestCount = 0;
|
|
273
|
+
const bumpRequestCount = () => {
|
|
274
|
+
requestCount += 1;
|
|
275
|
+
};
|
|
276
|
+
let authenticatedUserPromise = null;
|
|
277
|
+
const fetchAuthenticatedUserCached = () => {
|
|
278
|
+
if (!authenticatedUserPromise) authenticatedUserPromise = fetchAuthenticatedUser(octokit, bumpRequestCount);
|
|
279
|
+
return authenticatedUserPromise;
|
|
280
|
+
};
|
|
281
|
+
return {
|
|
282
|
+
paginateItems: (paginateOptions) => paginateItems(octokit, owner, repo, paginateOptions, bumpRequestCount),
|
|
283
|
+
fetchItems: (paginateOptions) => fetchItems(octokit, owner, repo, paginateOptions, bumpRequestCount),
|
|
284
|
+
eachItem: (paginateOptions) => eachItem(octokit, owner, repo, paginateOptions, bumpRequestCount),
|
|
285
|
+
fetchItemsByNumbers: (numbers) => fetchItemsByNumbers(octokit, owner, repo, numbers, bumpRequestCount),
|
|
286
|
+
fetchComments: (number) => fetchComments(octokit, owner, repo, number, bumpRequestCount),
|
|
287
|
+
fetchPullMetadata: (number) => fetchPullMetadata(octokit, owner, repo, number, bumpRequestCount),
|
|
288
|
+
fetchPullPatch: (number) => fetchPullPatch(octokit, owner, repo, number, bumpRequestCount),
|
|
289
|
+
fetchPullCommits: (number) => fetchPullCommits(octokit, owner, repo, number, bumpRequestCount),
|
|
290
|
+
fetchTimeline: (number) => fetchTimeline(octokit, owner, repo, number, bumpRequestCount),
|
|
291
|
+
fetchItemSnapshot: (number) => fetchItemSnapshot(octokit, owner, repo, number, bumpRequestCount),
|
|
292
|
+
fetchRepository: () => fetchRepository(octokit, owner, repo, bumpRequestCount),
|
|
293
|
+
fetchRepositoryLabels: () => fetchRepositoryLabels(octokit, owner, repo, bumpRequestCount),
|
|
294
|
+
fetchRepositoryMilestones: () => fetchRepositoryMilestones(octokit, owner, repo, bumpRequestCount),
|
|
295
|
+
fetchAuthenticatedUser: fetchAuthenticatedUserCached,
|
|
296
|
+
countUpdatedSince: (since) => countUpdatedSince(octokit, owner, repo, since, bumpRequestCount),
|
|
297
|
+
getRequestCount: () => requestCount,
|
|
298
|
+
actionClose: (number) => actionClose(octokit, owner, repo, number, bumpRequestCount),
|
|
299
|
+
actionReopen: (number) => actionReopen(octokit, owner, repo, number, bumpRequestCount),
|
|
300
|
+
actionSetTitle: (number, title) => actionSetTitle(octokit, owner, repo, number, title, bumpRequestCount),
|
|
301
|
+
actionSetBody: (number, body) => actionSetBody(octokit, owner, repo, number, body, bumpRequestCount),
|
|
302
|
+
actionAddComment: (number, body) => actionAddComment(octokit, owner, repo, number, body, bumpRequestCount),
|
|
303
|
+
actionAddLabels: (number, labels) => actionAddLabels(octokit, owner, repo, number, labels, bumpRequestCount),
|
|
304
|
+
actionRemoveLabels: (number, labels) => actionRemoveLabels(octokit, owner, repo, number, labels, bumpRequestCount),
|
|
305
|
+
actionSetLabels: (number, labels) => actionSetLabels(octokit, owner, repo, number, labels, bumpRequestCount),
|
|
306
|
+
actionAddAssignees: (number, assignees) => actionAddAssignees(octokit, owner, repo, number, assignees, bumpRequestCount),
|
|
307
|
+
actionRemoveAssignees: (number, assignees) => actionRemoveAssignees(octokit, owner, repo, number, assignees, bumpRequestCount),
|
|
308
|
+
actionSetAssignees: (number, assignees) => actionSetAssignees(octokit, owner, repo, number, assignees, bumpRequestCount),
|
|
309
|
+
actionSetMilestone: (number, milestone) => actionSetMilestone(octokit, owner, repo, number, milestone, bumpRequestCount),
|
|
310
|
+
actionClearMilestone: (number) => actionClearMilestone(octokit, owner, repo, number, bumpRequestCount),
|
|
311
|
+
actionLock: (number, reason) => actionLock(octokit, owner, repo, number, reason, bumpRequestCount),
|
|
312
|
+
actionUnlock: (number) => actionUnlock(octokit, owner, repo, number, bumpRequestCount),
|
|
313
|
+
actionRequestReviewers: (number, reviewers) => actionRequestReviewers(octokit, owner, repo, number, reviewers, bumpRequestCount),
|
|
314
|
+
actionRemoveReviewers: (number, reviewers) => actionRemoveReviewers(octokit, owner, repo, number, reviewers, bumpRequestCount),
|
|
315
|
+
actionMarkReadyForReview: (number) => actionMarkReadyForReview(octokit, owner, repo, number, bumpRequestCount),
|
|
316
|
+
actionConvertToDraft: (number) => actionConvertToDraft(octokit, owner, repo, number, bumpRequestCount),
|
|
317
|
+
actionAddReaction: (number, reaction, target) => actionAddReaction(octokit, owner, repo, number, reaction, target, bumpRequestCount),
|
|
318
|
+
actionRemoveReaction: (number, reaction, target) => actionRemoveReaction(octokit, owner, repo, number, reaction, target, fetchAuthenticatedUserCached, bumpRequestCount),
|
|
319
|
+
fetchViewerReactions: (number, target) => fetchViewerReactions(octokit, owner, repo, number, target, fetchAuthenticatedUserCached, bumpRequestCount)
|
|
320
|
+
};
|
|
321
|
+
}
|
|
322
|
+
async function* paginateItems(octokit, owner, repo, options, bumpRequestCount) {
|
|
323
|
+
const iterator = octokit.paginate.iterator(octokit.rest.issues.listForRepo, {
|
|
324
|
+
owner,
|
|
325
|
+
repo,
|
|
326
|
+
state: options.state,
|
|
327
|
+
sort: "updated",
|
|
328
|
+
direction: "asc",
|
|
329
|
+
per_page: 100,
|
|
330
|
+
since: options.since
|
|
331
|
+
});
|
|
332
|
+
for await (const page of iterator) {
|
|
333
|
+
bumpRequestCount();
|
|
334
|
+
yield page.data.map(mapIssue);
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
async function fetchItems(octokit, owner, repo, options, bumpRequestCount) {
|
|
338
|
+
return await collectPages(paginateItems(octokit, owner, repo, options, bumpRequestCount));
|
|
339
|
+
}
|
|
340
|
+
async function* eachItem(octokit, owner, repo, options, bumpRequestCount) {
|
|
341
|
+
yield* iteratePages(paginateItems(octokit, owner, repo, options, bumpRequestCount));
|
|
342
|
+
}
|
|
343
|
+
async function fetchItemsByNumbers(octokit, owner, repo, numbers, bumpRequestCount) {
|
|
344
|
+
return (await Promise.all(numbers.map(async (number) => {
|
|
345
|
+
bumpRequestCount();
|
|
346
|
+
return mapIssue((await octokit.rest.issues.get({
|
|
347
|
+
owner,
|
|
348
|
+
repo,
|
|
349
|
+
issue_number: number
|
|
350
|
+
})).data);
|
|
351
|
+
}))).sort((a, b) => a.number - b.number);
|
|
352
|
+
}
|
|
353
|
+
async function fetchComments(octokit, owner, repo, number, bumpRequestCount) {
|
|
354
|
+
bumpRequestCount();
|
|
355
|
+
return (await octokit.paginate(octokit.rest.issues.listComments, {
|
|
356
|
+
owner,
|
|
357
|
+
repo,
|
|
358
|
+
issue_number: number,
|
|
359
|
+
per_page: 100
|
|
360
|
+
})).map(mapComment);
|
|
361
|
+
}
|
|
362
|
+
async function fetchPullMetadata(octokit, owner, repo, number, bumpRequestCount) {
|
|
363
|
+
bumpRequestCount();
|
|
364
|
+
const pull = (await octokit.rest.pulls.get({
|
|
365
|
+
owner,
|
|
366
|
+
repo,
|
|
367
|
+
pull_number: number
|
|
368
|
+
})).data;
|
|
369
|
+
return {
|
|
370
|
+
isDraft: pull.draft,
|
|
371
|
+
merged: pull.merged,
|
|
372
|
+
mergedAt: pull.merged_at,
|
|
373
|
+
baseRef: pull.base.ref,
|
|
374
|
+
headRef: pull.head.ref,
|
|
375
|
+
requestedReviewers: pull.requested_reviewers.map((reviewer) => reviewer.login)
|
|
376
|
+
};
|
|
377
|
+
}
|
|
378
|
+
async function fetchPullPatch(octokit, owner, repo, number, bumpRequestCount) {
|
|
379
|
+
bumpRequestCount();
|
|
380
|
+
const result = await octokit.request("GET /repos/{owner}/{repo}/pulls/{pull_number}", {
|
|
381
|
+
owner,
|
|
382
|
+
repo,
|
|
383
|
+
pull_number: number,
|
|
384
|
+
mediaType: { format: "patch" }
|
|
385
|
+
});
|
|
386
|
+
if (typeof result.data === "string") return result.data;
|
|
387
|
+
throw diagnostics.GHFS0300({ issue: formatIssueNumber(number, {
|
|
388
|
+
repo: `${owner}/${repo}`,
|
|
389
|
+
kind: "pull"
|
|
390
|
+
}) });
|
|
391
|
+
}
|
|
392
|
+
async function fetchPullCommits(octokit, owner, repo, number, bumpRequestCount) {
|
|
393
|
+
bumpRequestCount();
|
|
394
|
+
return (await octokit.paginate(octokit.rest.pulls.listCommits, {
|
|
395
|
+
owner,
|
|
396
|
+
repo,
|
|
397
|
+
pull_number: number,
|
|
398
|
+
per_page: 100
|
|
399
|
+
})).map(mapPullCommit);
|
|
400
|
+
}
|
|
401
|
+
async function fetchTimeline(octokit, owner, repo, number, bumpRequestCount) {
|
|
402
|
+
bumpRequestCount();
|
|
403
|
+
const events = await octokit.paginate(octokit.rest.issues.listEventsForTimeline, {
|
|
404
|
+
owner,
|
|
405
|
+
repo,
|
|
406
|
+
issue_number: number,
|
|
407
|
+
per_page: 100
|
|
408
|
+
});
|
|
409
|
+
const out = [];
|
|
410
|
+
for (const event of events) {
|
|
411
|
+
const mapped = mapTimelineEvent(event);
|
|
412
|
+
if (mapped) out.push(mapped);
|
|
413
|
+
}
|
|
414
|
+
await enrichReviewReactions(octokit, out, bumpRequestCount);
|
|
415
|
+
return out;
|
|
416
|
+
}
|
|
417
|
+
async function enrichReviewReactions(octokit, events, bumpRequestCount) {
|
|
418
|
+
const reviewIds = events.flatMap((e) => e.kind === "reviewed" && e.review?.nodeId ? [e.review.nodeId] : []);
|
|
419
|
+
if (reviewIds.length === 0) return;
|
|
420
|
+
const unique = [...new Set(reviewIds)];
|
|
421
|
+
try {
|
|
422
|
+
bumpRequestCount();
|
|
423
|
+
const data = await octokit.graphql(`query ReviewReactions($ids: [ID!]!) {
|
|
424
|
+
nodes(ids: $ids) {
|
|
425
|
+
... on PullRequestReview {
|
|
426
|
+
id
|
|
427
|
+
reactionGroups { content users(first: 0) { totalCount } }
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
}`, { ids: unique });
|
|
431
|
+
const byId = /* @__PURE__ */ new Map();
|
|
432
|
+
for (const node of data.nodes ?? []) {
|
|
433
|
+
if (!node?.id || !node.reactionGroups) continue;
|
|
434
|
+
const reactions = createEmptyReactions();
|
|
435
|
+
for (const group of node.reactionGroups) {
|
|
436
|
+
const wireContent = graphqlContentToReaction(group.content);
|
|
437
|
+
if (!wireContent) continue;
|
|
438
|
+
const count = group.users.totalCount;
|
|
439
|
+
if (count <= 0) continue;
|
|
440
|
+
reactions[reactionKeyFromContent(wireContent)] = count;
|
|
441
|
+
reactions.totalCount += count;
|
|
442
|
+
}
|
|
443
|
+
byId.set(node.id, reactions);
|
|
444
|
+
}
|
|
445
|
+
for (const event of events) {
|
|
446
|
+
if (event.kind !== "reviewed" || !event.review?.nodeId) continue;
|
|
447
|
+
const reactions = byId.get(event.review.nodeId);
|
|
448
|
+
if (reactions) event.review.reactions = reactions;
|
|
449
|
+
}
|
|
450
|
+
} catch {}
|
|
451
|
+
}
|
|
452
|
+
async function fetchItemSnapshot(octokit, owner, repo, number, bumpRequestCount) {
|
|
453
|
+
bumpRequestCount();
|
|
454
|
+
const issue = (await octokit.rest.issues.get({
|
|
455
|
+
owner,
|
|
456
|
+
repo,
|
|
457
|
+
issue_number: number
|
|
458
|
+
})).data;
|
|
459
|
+
return {
|
|
460
|
+
number,
|
|
461
|
+
kind: issue.pull_request ? "pull" : "issue",
|
|
462
|
+
updatedAt: issue.updated_at ?? null
|
|
463
|
+
};
|
|
464
|
+
}
|
|
465
|
+
async function fetchRepository(octokit, owner, repo, bumpRequestCount) {
|
|
466
|
+
bumpRequestCount();
|
|
467
|
+
return (await octokit.rest.repos.get({
|
|
468
|
+
owner,
|
|
469
|
+
repo
|
|
470
|
+
})).data;
|
|
471
|
+
}
|
|
472
|
+
async function fetchRepositoryLabels(octokit, owner, repo, bumpRequestCount) {
|
|
473
|
+
bumpRequestCount();
|
|
474
|
+
return await octokit.paginate(octokit.rest.issues.listLabelsForRepo, {
|
|
475
|
+
owner,
|
|
476
|
+
repo,
|
|
477
|
+
per_page: 100
|
|
478
|
+
});
|
|
479
|
+
}
|
|
480
|
+
async function fetchRepositoryMilestones(octokit, owner, repo, bumpRequestCount) {
|
|
481
|
+
bumpRequestCount();
|
|
482
|
+
return await octokit.paginate(octokit.rest.issues.listMilestones, {
|
|
483
|
+
owner,
|
|
484
|
+
repo,
|
|
485
|
+
state: "all",
|
|
486
|
+
per_page: 100
|
|
487
|
+
});
|
|
488
|
+
}
|
|
489
|
+
async function fetchAuthenticatedUser(octokit, bumpRequestCount) {
|
|
490
|
+
bumpRequestCount();
|
|
491
|
+
try {
|
|
492
|
+
const result = await octokit.rest.users.getAuthenticated();
|
|
493
|
+
return {
|
|
494
|
+
login: result.data.login,
|
|
495
|
+
name: result.data.name ?? null,
|
|
496
|
+
avatarUrl: result.data.avatar_url
|
|
497
|
+
};
|
|
498
|
+
} catch {
|
|
499
|
+
return null;
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
async function countUpdatedSince(octokit, owner, repo, since, bumpRequestCount) {
|
|
503
|
+
bumpRequestCount();
|
|
504
|
+
const sinceQuery = normalizeSinceForSearch(since);
|
|
505
|
+
const result = await octokit.graphql(`query CountsUpdated($issuesQuery: String!, $pullsQuery: String!) {
|
|
506
|
+
issues: search(query: $issuesQuery, type: ISSUE, first: 0) { issueCount }
|
|
507
|
+
pulls: search(query: $pullsQuery, type: ISSUE, first: 0) { issueCount }
|
|
508
|
+
}`, {
|
|
509
|
+
issuesQuery: `repo:${owner}/${repo} is:issue updated:>=${sinceQuery}`,
|
|
510
|
+
pullsQuery: `repo:${owner}/${repo} is:pr updated:>=${sinceQuery}`
|
|
511
|
+
});
|
|
512
|
+
return {
|
|
513
|
+
issues: result.issues.issueCount,
|
|
514
|
+
pulls: result.pulls.issueCount
|
|
515
|
+
};
|
|
516
|
+
}
|
|
517
|
+
function normalizeSinceForSearch(since) {
|
|
518
|
+
const date = new Date(since);
|
|
519
|
+
if (Number.isNaN(date.getTime())) return since;
|
|
520
|
+
return date.toISOString();
|
|
521
|
+
}
|
|
522
|
+
async function actionClose(octokit, owner, repo, number, bumpRequestCount) {
|
|
523
|
+
bumpRequestCount();
|
|
524
|
+
await octokit.rest.issues.update({
|
|
525
|
+
owner,
|
|
526
|
+
repo,
|
|
527
|
+
issue_number: number,
|
|
528
|
+
state: "closed"
|
|
529
|
+
});
|
|
530
|
+
}
|
|
531
|
+
async function actionReopen(octokit, owner, repo, number, bumpRequestCount) {
|
|
532
|
+
bumpRequestCount();
|
|
533
|
+
await octokit.rest.issues.update({
|
|
534
|
+
owner,
|
|
535
|
+
repo,
|
|
536
|
+
issue_number: number,
|
|
537
|
+
state: "open"
|
|
538
|
+
});
|
|
539
|
+
}
|
|
540
|
+
async function actionSetTitle(octokit, owner, repo, number, title, bumpRequestCount) {
|
|
541
|
+
bumpRequestCount();
|
|
542
|
+
await octokit.rest.issues.update({
|
|
543
|
+
owner,
|
|
544
|
+
repo,
|
|
545
|
+
issue_number: number,
|
|
546
|
+
title
|
|
547
|
+
});
|
|
548
|
+
}
|
|
549
|
+
async function actionSetBody(octokit, owner, repo, number, body, bumpRequestCount) {
|
|
550
|
+
bumpRequestCount();
|
|
551
|
+
await octokit.rest.issues.update({
|
|
552
|
+
owner,
|
|
553
|
+
repo,
|
|
554
|
+
issue_number: number,
|
|
555
|
+
body
|
|
556
|
+
});
|
|
557
|
+
}
|
|
558
|
+
async function actionAddComment(octokit, owner, repo, number, body, bumpRequestCount) {
|
|
559
|
+
bumpRequestCount();
|
|
560
|
+
await octokit.rest.issues.createComment({
|
|
561
|
+
owner,
|
|
562
|
+
repo,
|
|
563
|
+
issue_number: number,
|
|
564
|
+
body
|
|
565
|
+
});
|
|
566
|
+
}
|
|
567
|
+
async function actionAddLabels(octokit, owner, repo, number, labels, bumpRequestCount) {
|
|
568
|
+
await ensureLabelsExist(octokit, owner, repo, labels, bumpRequestCount);
|
|
569
|
+
bumpRequestCount();
|
|
570
|
+
await octokit.rest.issues.addLabels({
|
|
571
|
+
owner,
|
|
572
|
+
repo,
|
|
573
|
+
issue_number: number,
|
|
574
|
+
labels
|
|
575
|
+
});
|
|
576
|
+
}
|
|
577
|
+
async function actionRemoveLabels(octokit, owner, repo, number, labels, bumpRequestCount) {
|
|
578
|
+
for (const label of labels) try {
|
|
579
|
+
bumpRequestCount();
|
|
580
|
+
await octokit.rest.issues.removeLabel({
|
|
581
|
+
owner,
|
|
582
|
+
repo,
|
|
583
|
+
issue_number: number,
|
|
584
|
+
name: label
|
|
585
|
+
});
|
|
586
|
+
} catch (error) {
|
|
587
|
+
if (error.status !== 404) throw error;
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
async function actionSetLabels(octokit, owner, repo, number, labels, bumpRequestCount) {
|
|
591
|
+
await ensureLabelsExist(octokit, owner, repo, labels, bumpRequestCount);
|
|
592
|
+
bumpRequestCount();
|
|
593
|
+
await octokit.rest.issues.setLabels({
|
|
594
|
+
owner,
|
|
595
|
+
repo,
|
|
596
|
+
issue_number: number,
|
|
597
|
+
labels
|
|
598
|
+
});
|
|
599
|
+
}
|
|
600
|
+
async function ensureLabelsExist(octokit, owner, repo, labels, bumpRequestCount) {
|
|
601
|
+
if (!labels.length) return;
|
|
602
|
+
const existingLabels = await fetchRepositoryLabels(octokit, owner, repo, bumpRequestCount);
|
|
603
|
+
const existingLabelNames = new Set(existingLabels.map((label) => label.name.toLowerCase()));
|
|
604
|
+
for (const label of labels) {
|
|
605
|
+
const normalizedLabel = label.toLowerCase();
|
|
606
|
+
if (existingLabelNames.has(normalizedLabel)) continue;
|
|
607
|
+
try {
|
|
608
|
+
bumpRequestCount();
|
|
609
|
+
await octokit.rest.issues.createLabel({
|
|
610
|
+
owner,
|
|
611
|
+
repo,
|
|
612
|
+
name: label,
|
|
613
|
+
color: randomHexColor()
|
|
614
|
+
});
|
|
615
|
+
existingLabelNames.add(normalizedLabel);
|
|
616
|
+
} catch (error) {
|
|
617
|
+
if (error.status !== 422) throw error;
|
|
618
|
+
existingLabelNames.add(normalizedLabel);
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
async function actionAddAssignees(octokit, owner, repo, number, assignees, bumpRequestCount) {
|
|
623
|
+
bumpRequestCount();
|
|
624
|
+
await octokit.rest.issues.addAssignees({
|
|
625
|
+
owner,
|
|
626
|
+
repo,
|
|
627
|
+
issue_number: number,
|
|
628
|
+
assignees
|
|
629
|
+
});
|
|
630
|
+
}
|
|
631
|
+
async function actionRemoveAssignees(octokit, owner, repo, number, assignees, bumpRequestCount) {
|
|
632
|
+
bumpRequestCount();
|
|
633
|
+
await octokit.rest.issues.removeAssignees({
|
|
634
|
+
owner,
|
|
635
|
+
repo,
|
|
636
|
+
issue_number: number,
|
|
637
|
+
assignees
|
|
638
|
+
});
|
|
639
|
+
}
|
|
640
|
+
async function actionSetAssignees(octokit, owner, repo, number, assignees, bumpRequestCount) {
|
|
641
|
+
bumpRequestCount();
|
|
642
|
+
await octokit.rest.issues.update({
|
|
643
|
+
owner,
|
|
644
|
+
repo,
|
|
645
|
+
issue_number: number,
|
|
646
|
+
assignees
|
|
647
|
+
});
|
|
648
|
+
}
|
|
649
|
+
async function actionSetMilestone(octokit, owner, repo, number, milestone, bumpRequestCount) {
|
|
650
|
+
const resolvedMilestone = await resolveMilestone(octokit, owner, repo, milestone, bumpRequestCount);
|
|
651
|
+
bumpRequestCount();
|
|
652
|
+
await octokit.rest.issues.update({
|
|
653
|
+
owner,
|
|
654
|
+
repo,
|
|
655
|
+
issue_number: number,
|
|
656
|
+
milestone: resolvedMilestone
|
|
657
|
+
});
|
|
658
|
+
}
|
|
659
|
+
async function actionClearMilestone(octokit, owner, repo, number, bumpRequestCount) {
|
|
660
|
+
bumpRequestCount();
|
|
661
|
+
await octokit.rest.issues.update({
|
|
662
|
+
owner,
|
|
663
|
+
repo,
|
|
664
|
+
issue_number: number,
|
|
665
|
+
milestone: null
|
|
666
|
+
});
|
|
667
|
+
}
|
|
668
|
+
async function actionLock(octokit, owner, repo, number, reason, bumpRequestCount) {
|
|
669
|
+
bumpRequestCount();
|
|
670
|
+
await octokit.rest.issues.lock({
|
|
671
|
+
owner,
|
|
672
|
+
repo,
|
|
673
|
+
issue_number: number,
|
|
674
|
+
lock_reason: normalizeLockReason(reason)
|
|
675
|
+
});
|
|
676
|
+
}
|
|
677
|
+
async function actionUnlock(octokit, owner, repo, number, bumpRequestCount) {
|
|
678
|
+
bumpRequestCount();
|
|
679
|
+
await octokit.rest.issues.unlock({
|
|
680
|
+
owner,
|
|
681
|
+
repo,
|
|
682
|
+
issue_number: number
|
|
683
|
+
});
|
|
684
|
+
}
|
|
685
|
+
async function actionRequestReviewers(octokit, owner, repo, number, reviewers, bumpRequestCount) {
|
|
686
|
+
bumpRequestCount();
|
|
687
|
+
await octokit.rest.pulls.requestReviewers({
|
|
688
|
+
owner,
|
|
689
|
+
repo,
|
|
690
|
+
pull_number: number,
|
|
691
|
+
reviewers
|
|
692
|
+
});
|
|
693
|
+
}
|
|
694
|
+
async function actionRemoveReviewers(octokit, owner, repo, number, reviewers, bumpRequestCount) {
|
|
695
|
+
bumpRequestCount();
|
|
696
|
+
await octokit.rest.pulls.removeRequestedReviewers({
|
|
697
|
+
owner,
|
|
698
|
+
repo,
|
|
699
|
+
pull_number: number,
|
|
700
|
+
reviewers
|
|
701
|
+
});
|
|
702
|
+
}
|
|
703
|
+
async function actionMarkReadyForReview(octokit, owner, repo, number, bumpRequestCount) {
|
|
704
|
+
bumpRequestCount();
|
|
705
|
+
await octokit.request("POST /repos/{owner}/{repo}/pulls/{pull_number}/ready_for_review", {
|
|
706
|
+
owner,
|
|
707
|
+
repo,
|
|
708
|
+
pull_number: number
|
|
709
|
+
});
|
|
710
|
+
}
|
|
711
|
+
async function actionConvertToDraft(octokit, owner, repo, number, bumpRequestCount) {
|
|
712
|
+
bumpRequestCount();
|
|
713
|
+
await octokit.request("POST /repos/{owner}/{repo}/pulls/{pull_number}/convert-to-draft", {
|
|
714
|
+
owner,
|
|
715
|
+
repo,
|
|
716
|
+
pull_number: number
|
|
717
|
+
});
|
|
718
|
+
}
|
|
719
|
+
async function resolveMilestone(octokit, owner, repo, value, bumpRequestCount) {
|
|
720
|
+
if (typeof value === "number") return value;
|
|
721
|
+
if (/^\d+$/.test(value)) return Number(value);
|
|
722
|
+
bumpRequestCount();
|
|
723
|
+
const matched = (await octokit.paginate(octokit.rest.issues.listMilestones, {
|
|
724
|
+
owner,
|
|
725
|
+
repo,
|
|
726
|
+
state: "all",
|
|
727
|
+
per_page: 100
|
|
728
|
+
})).find((item) => item.title === value);
|
|
729
|
+
if (!matched) throw diagnostics.GHFS0301({ value });
|
|
730
|
+
return matched.number;
|
|
731
|
+
}
|
|
732
|
+
function normalizeLockReason(reason) {
|
|
733
|
+
if (!reason) return void 0;
|
|
734
|
+
if (reason === "too-heated") return "too heated";
|
|
735
|
+
return reason;
|
|
736
|
+
}
|
|
737
|
+
function mapIssue(issue) {
|
|
738
|
+
return {
|
|
739
|
+
number: issue.number,
|
|
740
|
+
kind: issue.pull_request ? "pull" : "issue",
|
|
741
|
+
...issue.html_url ? { url: issue.html_url } : {},
|
|
742
|
+
state: issue.state === "closed" ? "closed" : "open",
|
|
743
|
+
stateReason: normalizeStateReason(issue.state_reason),
|
|
744
|
+
updatedAt: issue.updated_at,
|
|
745
|
+
createdAt: issue.created_at,
|
|
746
|
+
closedAt: issue.closed_at,
|
|
747
|
+
title: issue.title,
|
|
748
|
+
body: issue.body,
|
|
749
|
+
author: issue.user?.login ?? null,
|
|
750
|
+
...issue.user?.avatar_url ? { authorAvatarUrl: issue.user.avatar_url } : {},
|
|
751
|
+
labels: issue.labels.map((label) => {
|
|
752
|
+
if (typeof label === "string") return label;
|
|
753
|
+
return label.name ?? void 0;
|
|
754
|
+
}).filter((label) => Boolean(label)),
|
|
755
|
+
assignees: (issue.assignees ?? []).map((assignee) => assignee.login),
|
|
756
|
+
milestone: issue.milestone?.title ?? null,
|
|
757
|
+
reactions: mapReactions(issue.reactions)
|
|
758
|
+
};
|
|
759
|
+
}
|
|
760
|
+
function normalizeStateReason(reason) {
|
|
761
|
+
if (reason === "completed" || reason === "not_planned" || reason === "reopened") return reason;
|
|
762
|
+
return null;
|
|
763
|
+
}
|
|
764
|
+
function mapComment(comment) {
|
|
765
|
+
return {
|
|
766
|
+
id: comment.id,
|
|
767
|
+
body: comment.body,
|
|
768
|
+
createdAt: comment.created_at,
|
|
769
|
+
updatedAt: comment.updated_at,
|
|
770
|
+
author: comment.user?.login ?? null,
|
|
771
|
+
...comment.user?.avatar_url ? { authorAvatarUrl: comment.user.avatar_url } : {},
|
|
772
|
+
reactions: mapReactions(comment.reactions)
|
|
773
|
+
};
|
|
774
|
+
}
|
|
775
|
+
function mapPullCommit(commit) {
|
|
776
|
+
return {
|
|
777
|
+
sha: commit.sha,
|
|
778
|
+
message: commit.commit.message,
|
|
779
|
+
authorLogin: commit.author?.login ?? null,
|
|
780
|
+
authorName: commit.commit.author?.name ?? null,
|
|
781
|
+
authorDate: commit.commit.author?.date ?? commit.commit.committer?.date ?? "",
|
|
782
|
+
committerLogin: commit.committer?.login ?? null,
|
|
783
|
+
committerDate: commit.commit.committer?.date ?? commit.commit.author?.date ?? "",
|
|
784
|
+
...commit.html_url ? { url: commit.html_url } : {}
|
|
785
|
+
};
|
|
786
|
+
}
|
|
787
|
+
function mapTimelineEvent(event) {
|
|
788
|
+
const eventName = event.event;
|
|
789
|
+
if (!eventName) return null;
|
|
790
|
+
if (eventName === "committed" && event.sha) {
|
|
791
|
+
const createdAt = event.committer?.date ?? event.author?.date;
|
|
792
|
+
if (!createdAt) return null;
|
|
793
|
+
const fullMessage = event.message ?? "";
|
|
794
|
+
const firstLine = fullMessage.split("\n", 1)[0] ?? "";
|
|
795
|
+
return {
|
|
796
|
+
id: `commit:${event.sha}`,
|
|
797
|
+
kind: "committed",
|
|
798
|
+
createdAt,
|
|
799
|
+
actor: event.author?.name ?? event.committer?.name ?? null,
|
|
800
|
+
sha: event.sha,
|
|
801
|
+
commitMessage: firstLine,
|
|
802
|
+
body: fullMessage,
|
|
803
|
+
...event.commit_url ? { commitUrl: event.commit_url } : {}
|
|
804
|
+
};
|
|
805
|
+
}
|
|
806
|
+
const createdAt = event.created_at ?? event.submitted_at;
|
|
807
|
+
if (!createdAt) return null;
|
|
808
|
+
const id = event.id != null ? String(event.id) : `${eventName}:${createdAt}`;
|
|
809
|
+
const actor = event.actor?.login ?? event.user?.login ?? null;
|
|
810
|
+
const actorAvatarUrl = event.actor?.avatar_url ?? event.user?.avatar_url ?? void 0;
|
|
811
|
+
const base = {
|
|
812
|
+
id,
|
|
813
|
+
createdAt,
|
|
814
|
+
actor,
|
|
815
|
+
...actorAvatarUrl ? { actorAvatarUrl } : {}
|
|
816
|
+
};
|
|
817
|
+
function extractSource() {
|
|
818
|
+
const issue = event.source?.issue;
|
|
819
|
+
if (!issue?.number) return void 0;
|
|
820
|
+
return {
|
|
821
|
+
number: issue.number,
|
|
822
|
+
kind: issue.pull_request ? "pull" : "issue",
|
|
823
|
+
...issue.title ? { title: issue.title } : {},
|
|
824
|
+
...issue.html_url ? { url: issue.html_url } : {},
|
|
825
|
+
...issue.repository?.full_name ? { repo: issue.repository.full_name } : {}
|
|
826
|
+
};
|
|
827
|
+
}
|
|
828
|
+
switch (eventName) {
|
|
829
|
+
case "closed": return {
|
|
830
|
+
...base,
|
|
831
|
+
kind: "closed",
|
|
832
|
+
...event.state_reason ? { stateReason: event.state_reason } : {},
|
|
833
|
+
...event.commit_id ? { sha: event.commit_id } : {},
|
|
834
|
+
...event.commit_url ? { commitUrl: event.commit_url } : {}
|
|
835
|
+
};
|
|
836
|
+
case "reopened": return {
|
|
837
|
+
...base,
|
|
838
|
+
kind: "reopened"
|
|
839
|
+
};
|
|
840
|
+
case "merged": return {
|
|
841
|
+
...base,
|
|
842
|
+
kind: "merged",
|
|
843
|
+
...event.commit_id ? { sha: event.commit_id } : {},
|
|
844
|
+
...event.commit_url ? { commitUrl: event.commit_url } : {}
|
|
845
|
+
};
|
|
846
|
+
case "head_ref_force_pushed": return {
|
|
847
|
+
...base,
|
|
848
|
+
kind: "head_ref_force_pushed",
|
|
849
|
+
...event.commit_id ? { sha: event.commit_id } : {},
|
|
850
|
+
...event.commit_url ? { commitUrl: event.commit_url } : {}
|
|
851
|
+
};
|
|
852
|
+
case "head_ref_deleted":
|
|
853
|
+
case "head_ref_restored":
|
|
854
|
+
case "unlocked":
|
|
855
|
+
case "ready_for_review":
|
|
856
|
+
case "convert_to_draft":
|
|
857
|
+
case "pinned":
|
|
858
|
+
case "unpinned":
|
|
859
|
+
case "mentioned":
|
|
860
|
+
case "subscribed":
|
|
861
|
+
case "unsubscribed": return {
|
|
862
|
+
...base,
|
|
863
|
+
kind: eventName
|
|
864
|
+
};
|
|
865
|
+
case "locked": return {
|
|
866
|
+
...base,
|
|
867
|
+
kind: "locked",
|
|
868
|
+
...event.lock_reason ? { lockReason: event.lock_reason } : {}
|
|
869
|
+
};
|
|
870
|
+
case "labeled":
|
|
871
|
+
case "unlabeled":
|
|
872
|
+
if (!event.label) return null;
|
|
873
|
+
return {
|
|
874
|
+
...base,
|
|
875
|
+
kind: eventName,
|
|
876
|
+
label: {
|
|
877
|
+
name: event.label.name,
|
|
878
|
+
color: event.label.color ?? ""
|
|
879
|
+
}
|
|
880
|
+
};
|
|
881
|
+
case "assigned":
|
|
882
|
+
case "unassigned":
|
|
883
|
+
if (!event.assignee?.login) return null;
|
|
884
|
+
return {
|
|
885
|
+
...base,
|
|
886
|
+
kind: eventName,
|
|
887
|
+
assignee: event.assignee.login
|
|
888
|
+
};
|
|
889
|
+
case "review_requested":
|
|
890
|
+
case "review_request_removed": {
|
|
891
|
+
const userLogin = event.requested_reviewer?.login;
|
|
892
|
+
const teamName = event.requested_team?.name;
|
|
893
|
+
const reviewer = userLogin ?? teamName;
|
|
894
|
+
if (!reviewer) return null;
|
|
895
|
+
return {
|
|
896
|
+
...base,
|
|
897
|
+
kind: eventName,
|
|
898
|
+
requestedReviewer: reviewer,
|
|
899
|
+
...userLogin ? {} : { isTeam: true }
|
|
900
|
+
};
|
|
901
|
+
}
|
|
902
|
+
case "reviewed": {
|
|
903
|
+
const rawState = event.state ?? "commented";
|
|
904
|
+
return {
|
|
905
|
+
...base,
|
|
906
|
+
kind: "reviewed",
|
|
907
|
+
review: {
|
|
908
|
+
state: normalizeReviewState(rawState),
|
|
909
|
+
body: event.body ?? null,
|
|
910
|
+
submittedAt: event.submitted_at ?? createdAt,
|
|
911
|
+
...event.node_id ? { nodeId: event.node_id } : {}
|
|
912
|
+
},
|
|
913
|
+
body: event.body ?? null
|
|
914
|
+
};
|
|
915
|
+
}
|
|
916
|
+
case "review_dismissed": {
|
|
917
|
+
const dismissed = event.dismissed_review;
|
|
918
|
+
if (!dismissed) return {
|
|
919
|
+
...base,
|
|
920
|
+
kind: "unknown",
|
|
921
|
+
rawKind: eventName
|
|
922
|
+
};
|
|
923
|
+
return {
|
|
924
|
+
...base,
|
|
925
|
+
kind: "review_dismissed",
|
|
926
|
+
dismissedReview: {
|
|
927
|
+
state: dismissed.state,
|
|
928
|
+
reviewId: dismissed.review_id,
|
|
929
|
+
dismissalMessage: dismissed.dismissal_message
|
|
930
|
+
},
|
|
931
|
+
...event.review?.user?.login ? { reviewedBy: event.review.user.login } : {}
|
|
932
|
+
};
|
|
933
|
+
}
|
|
934
|
+
case "commented": return {
|
|
935
|
+
...base,
|
|
936
|
+
kind: "commented",
|
|
937
|
+
...typeof event.id === "number" ? { commentId: event.id } : {},
|
|
938
|
+
body: event.body ?? null
|
|
939
|
+
};
|
|
940
|
+
case "renamed":
|
|
941
|
+
if (!event.rename) return null;
|
|
942
|
+
return {
|
|
943
|
+
...base,
|
|
944
|
+
kind: "renamed",
|
|
945
|
+
rename: {
|
|
946
|
+
from: event.rename.from,
|
|
947
|
+
to: event.rename.to
|
|
948
|
+
}
|
|
949
|
+
};
|
|
950
|
+
case "referenced":
|
|
951
|
+
case "cross-referenced":
|
|
952
|
+
case "connected":
|
|
953
|
+
case "disconnected":
|
|
954
|
+
case "marked_as_duplicate":
|
|
955
|
+
case "unmarked_as_duplicate": {
|
|
956
|
+
const source = extractSource();
|
|
957
|
+
return {
|
|
958
|
+
...base,
|
|
959
|
+
kind: eventName,
|
|
960
|
+
...source ? { source } : {}
|
|
961
|
+
};
|
|
962
|
+
}
|
|
963
|
+
case "milestoned":
|
|
964
|
+
case "demilestoned": return {
|
|
965
|
+
...base,
|
|
966
|
+
kind: eventName,
|
|
967
|
+
...event.milestone?.title ? { milestone: event.milestone.title } : {}
|
|
968
|
+
};
|
|
969
|
+
case "transferred": {
|
|
970
|
+
const fromRepo = event.transferred?.from_repository?.full_name ?? event.from_repository?.full_name;
|
|
971
|
+
return {
|
|
972
|
+
...base,
|
|
973
|
+
kind: "transferred",
|
|
974
|
+
...fromRepo ? { fromRepo } : {}
|
|
975
|
+
};
|
|
976
|
+
}
|
|
977
|
+
case "base_ref_changed": {
|
|
978
|
+
const fromRef = event.changes?.base?.ref?.from ?? event.base_ref?.from;
|
|
979
|
+
const toRef = event.changes?.base?.ref?.to ?? event.base_ref?.to;
|
|
980
|
+
return {
|
|
981
|
+
...base,
|
|
982
|
+
kind: "base_ref_changed",
|
|
983
|
+
...fromRef ? { oldRef: fromRef } : {},
|
|
984
|
+
...toRef ? { newRef: toRef } : {}
|
|
985
|
+
};
|
|
986
|
+
}
|
|
987
|
+
case "auto_merge_enabled":
|
|
988
|
+
case "auto_merge_disabled":
|
|
989
|
+
case "auto_squash_enabled":
|
|
990
|
+
case "auto_squash_disabled":
|
|
991
|
+
case "auto_rebase_enabled":
|
|
992
|
+
case "auto_rebase_disabled": return {
|
|
993
|
+
...base,
|
|
994
|
+
kind: eventName,
|
|
995
|
+
...event.commit_title ? { commitTitle: event.commit_title } : {},
|
|
996
|
+
...event.commit_message ? { commitMessage: event.commit_message } : {}
|
|
997
|
+
};
|
|
998
|
+
default: return {
|
|
999
|
+
...base,
|
|
1000
|
+
kind: "unknown",
|
|
1001
|
+
rawKind: eventName
|
|
1002
|
+
};
|
|
1003
|
+
}
|
|
1004
|
+
}
|
|
1005
|
+
function normalizeReviewState(state) {
|
|
1006
|
+
const lower = state.toLowerCase();
|
|
1007
|
+
if (lower === "approved" || lower === "changes_requested" || lower === "commented" || lower === "dismissed" || lower === "pending") return lower;
|
|
1008
|
+
return "commented";
|
|
1009
|
+
}
|
|
1010
|
+
const REACTION_TO_GRAPHQL = {
|
|
1011
|
+
"+1": "THUMBS_UP",
|
|
1012
|
+
"-1": "THUMBS_DOWN",
|
|
1013
|
+
"laugh": "LAUGH",
|
|
1014
|
+
"hooray": "HOORAY",
|
|
1015
|
+
"confused": "CONFUSED",
|
|
1016
|
+
"heart": "HEART",
|
|
1017
|
+
"rocket": "ROCKET",
|
|
1018
|
+
"eyes": "EYES"
|
|
1019
|
+
};
|
|
1020
|
+
const GRAPHQL_TO_REACTION = Object.fromEntries(Object.entries(REACTION_TO_GRAPHQL).map(([k, v]) => [v, k]));
|
|
1021
|
+
function graphqlContentToReaction(graphqlContent) {
|
|
1022
|
+
return GRAPHQL_TO_REACTION[graphqlContent] ?? null;
|
|
1023
|
+
}
|
|
1024
|
+
async function actionAddReaction(octokit, owner, repo, number, reaction, target, bumpRequestCount) {
|
|
1025
|
+
bumpRequestCount();
|
|
1026
|
+
if (target.kind === "item") {
|
|
1027
|
+
await octokit.rest.reactions.createForIssue({
|
|
1028
|
+
owner,
|
|
1029
|
+
repo,
|
|
1030
|
+
issue_number: number,
|
|
1031
|
+
content: reaction
|
|
1032
|
+
});
|
|
1033
|
+
return;
|
|
1034
|
+
}
|
|
1035
|
+
if (target.kind === "comment") {
|
|
1036
|
+
await octokit.rest.reactions.createForIssueComment({
|
|
1037
|
+
owner,
|
|
1038
|
+
repo,
|
|
1039
|
+
comment_id: target.commentId,
|
|
1040
|
+
content: reaction
|
|
1041
|
+
});
|
|
1042
|
+
return;
|
|
1043
|
+
}
|
|
1044
|
+
await octokit.graphql(`mutation AddReviewReaction($subjectId: ID!, $content: ReactionContent!) {
|
|
1045
|
+
addReaction(input: { subjectId: $subjectId, content: $content }) {
|
|
1046
|
+
reaction { id }
|
|
1047
|
+
}
|
|
1048
|
+
}`, {
|
|
1049
|
+
subjectId: target.reviewId,
|
|
1050
|
+
content: REACTION_TO_GRAPHQL[reaction]
|
|
1051
|
+
});
|
|
1052
|
+
}
|
|
1053
|
+
async function actionRemoveReaction(octokit, owner, repo, number, reaction, target, fetchAuth, bumpRequestCount) {
|
|
1054
|
+
if (target.kind === "review") {
|
|
1055
|
+
bumpRequestCount();
|
|
1056
|
+
await octokit.graphql(`mutation RemoveReviewReaction($subjectId: ID!, $content: ReactionContent!) {
|
|
1057
|
+
removeReaction(input: { subjectId: $subjectId, content: $content }) {
|
|
1058
|
+
reaction { id }
|
|
1059
|
+
}
|
|
1060
|
+
}`, {
|
|
1061
|
+
subjectId: target.reviewId,
|
|
1062
|
+
content: REACTION_TO_GRAPHQL[reaction]
|
|
1063
|
+
});
|
|
1064
|
+
return;
|
|
1065
|
+
}
|
|
1066
|
+
const user = await fetchAuth();
|
|
1067
|
+
if (!user) throw diagnostics.GHFS0302();
|
|
1068
|
+
if (target.kind === "item") {
|
|
1069
|
+
bumpRequestCount();
|
|
1070
|
+
const mine = (await octokit.paginate(octokit.rest.reactions.listForIssue, {
|
|
1071
|
+
owner,
|
|
1072
|
+
repo,
|
|
1073
|
+
issue_number: number,
|
|
1074
|
+
content: reaction,
|
|
1075
|
+
per_page: 100
|
|
1076
|
+
})).find((r) => r.user?.login === user.login && r.content === reaction);
|
|
1077
|
+
if (!mine) return;
|
|
1078
|
+
bumpRequestCount();
|
|
1079
|
+
await octokit.rest.reactions.deleteForIssue({
|
|
1080
|
+
owner,
|
|
1081
|
+
repo,
|
|
1082
|
+
issue_number: number,
|
|
1083
|
+
reaction_id: mine.id
|
|
1084
|
+
});
|
|
1085
|
+
return;
|
|
1086
|
+
}
|
|
1087
|
+
bumpRequestCount();
|
|
1088
|
+
const mineComment = (await octokit.paginate(octokit.rest.reactions.listForIssueComment, {
|
|
1089
|
+
owner,
|
|
1090
|
+
repo,
|
|
1091
|
+
comment_id: target.commentId,
|
|
1092
|
+
content: reaction,
|
|
1093
|
+
per_page: 100
|
|
1094
|
+
})).find((r) => r.user?.login === user.login && r.content === reaction);
|
|
1095
|
+
if (!mineComment) return;
|
|
1096
|
+
bumpRequestCount();
|
|
1097
|
+
await octokit.rest.reactions.deleteForIssueComment({
|
|
1098
|
+
owner,
|
|
1099
|
+
repo,
|
|
1100
|
+
comment_id: target.commentId,
|
|
1101
|
+
reaction_id: mineComment.id
|
|
1102
|
+
});
|
|
1103
|
+
}
|
|
1104
|
+
async function fetchViewerReactions(octokit, owner, repo, number, target, fetchAuth, bumpRequestCount) {
|
|
1105
|
+
if (target.kind === "review") {
|
|
1106
|
+
bumpRequestCount();
|
|
1107
|
+
return ((await octokit.graphql(`query ViewerReviewReactions($id: ID!) {
|
|
1108
|
+
node(id: $id) {
|
|
1109
|
+
... on PullRequestReview {
|
|
1110
|
+
reactionGroups { content viewerHasReacted }
|
|
1111
|
+
}
|
|
1112
|
+
}
|
|
1113
|
+
}`, { id: target.reviewId })).node?.reactionGroups ?? []).filter((g) => g.viewerHasReacted).map((g) => graphqlContentToReaction(g.content)).filter((c) => c !== null);
|
|
1114
|
+
}
|
|
1115
|
+
const user = await fetchAuth();
|
|
1116
|
+
if (!user) return [];
|
|
1117
|
+
if (target.kind === "item") {
|
|
1118
|
+
bumpRequestCount();
|
|
1119
|
+
return collectViewerReactions(await octokit.paginate(octokit.rest.reactions.listForIssue, {
|
|
1120
|
+
owner,
|
|
1121
|
+
repo,
|
|
1122
|
+
issue_number: number,
|
|
1123
|
+
per_page: 100
|
|
1124
|
+
}), user.login);
|
|
1125
|
+
}
|
|
1126
|
+
bumpRequestCount();
|
|
1127
|
+
return collectViewerReactions(await octokit.paginate(octokit.rest.reactions.listForIssueComment, {
|
|
1128
|
+
owner,
|
|
1129
|
+
repo,
|
|
1130
|
+
comment_id: target.commentId,
|
|
1131
|
+
per_page: 100
|
|
1132
|
+
}), user.login);
|
|
1133
|
+
}
|
|
1134
|
+
function collectViewerReactions(reactions, login) {
|
|
1135
|
+
const out = /* @__PURE__ */ new Set();
|
|
1136
|
+
for (const r of reactions) {
|
|
1137
|
+
if (r.user?.login !== login) continue;
|
|
1138
|
+
if (isReactionContent(r.content)) out.add(r.content);
|
|
1139
|
+
}
|
|
1140
|
+
return [...out];
|
|
1141
|
+
}
|
|
1142
|
+
function mapReactions(reactions) {
|
|
1143
|
+
return normalizeReactions({
|
|
1144
|
+
totalCount: reactions?.total_count,
|
|
1145
|
+
plusOne: reactions?.["+1"],
|
|
1146
|
+
minusOne: reactions?.["-1"],
|
|
1147
|
+
laugh: reactions?.laugh,
|
|
1148
|
+
hooray: reactions?.hooray,
|
|
1149
|
+
confused: reactions?.confused,
|
|
1150
|
+
heart: reactions?.heart,
|
|
1151
|
+
rocket: reactions?.rocket,
|
|
1152
|
+
eyes: reactions?.eyes
|
|
1153
|
+
});
|
|
1154
|
+
}
|
|
1155
|
+
//#endregion
|
|
1156
|
+
//#region src/providers/factory.ts
|
|
1157
|
+
function createRepositoryProvider(options) {
|
|
1158
|
+
const { owner, repo } = splitRepo(options.repo);
|
|
1159
|
+
return createGitHubProvider({
|
|
1160
|
+
token: options.token,
|
|
1161
|
+
owner,
|
|
1162
|
+
repo
|
|
1163
|
+
});
|
|
1164
|
+
}
|
|
1165
|
+
//#endregion
|
|
1166
|
+
export { countNoun as a, formatTerminalLink as c, diagnostics as d, normalizeReactions as i, formatValue as l, REACTION_CONTENTS as n, formatDuration as o, isReactionContent as r, formatIssueNumber as s, createRepositoryProvider as t, formatInline as u };
|