@mx-space/cli 0.1.1 → 0.2.1

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.
Files changed (235) hide show
  1. package/README.md +101 -28
  2. package/ROADMAP.md +4 -3
  3. package/dist/{Lexical.dev-DpU35QTu.mjs → Lexical.dev-CMevU1DO.mjs} +1 -1
  4. package/dist/{Lexical.dev-DpU35QTu.mjs.map → Lexical.dev-CMevU1DO.mjs.map} +1 -1
  5. package/dist/{Lexical.node-gYNDt_p9.mjs → Lexical.node-BR9e7Cyk.mjs} +2 -2
  6. package/dist/{Lexical.node-gYNDt_p9.mjs.map → Lexical.node-BR9e7Cyk.mjs.map} +1 -1
  7. package/dist/{Lexical.prod-t4c3bHV3.mjs → Lexical.prod-PUD-z9fY.mjs} +1 -1
  8. package/dist/{Lexical.prod-t4c3bHV3.mjs.map → Lexical.prod-PUD-z9fY.mjs.map} +1 -1
  9. package/dist/{LexicalClipboard.dev-CdeeWCIq.mjs → LexicalClipboard.dev-DZC2zppG.mjs} +6 -6
  10. package/dist/{LexicalClipboard.dev-CdeeWCIq.mjs.map → LexicalClipboard.dev-DZC2zppG.mjs.map} +1 -1
  11. package/dist/{LexicalClipboard.node-0e9GBL1g.mjs → LexicalClipboard.node-e5G1wVGb.mjs} +2 -2
  12. package/dist/{LexicalClipboard.node-0e9GBL1g.mjs.map → LexicalClipboard.node-e5G1wVGb.mjs.map} +1 -1
  13. package/dist/{LexicalClipboard.prod-CsCWYmV7.mjs → LexicalClipboard.prod-DE2azzIb.mjs} +6 -6
  14. package/dist/{LexicalClipboard.prod-CsCWYmV7.mjs.map → LexicalClipboard.prod-DE2azzIb.mjs.map} +1 -1
  15. package/dist/{LexicalCodeCore.dev-haI2cqH8.mjs → LexicalCodeCore.dev-gs--x55I.mjs} +3 -3
  16. package/dist/{LexicalCodeCore.dev-haI2cqH8.mjs.map → LexicalCodeCore.dev-gs--x55I.mjs.map} +1 -1
  17. package/dist/{LexicalCodeCore.prod-D_k7zuE5.mjs → LexicalCodeCore.prod-DPHOnyEj.mjs} +3 -3
  18. package/dist/{LexicalCodeCore.prod-D_k7zuE5.mjs.map → LexicalCodeCore.prod-DPHOnyEj.mjs.map} +1 -1
  19. package/dist/{LexicalDragon.dev-CAggdFh_.mjs → LexicalDragon.dev-CVe8bzVN.mjs} +3 -3
  20. package/dist/{LexicalDragon.dev-CAggdFh_.mjs.map → LexicalDragon.dev-CVe8bzVN.mjs.map} +1 -1
  21. package/dist/{LexicalDragon.node-QMR_wqJg.mjs → LexicalDragon.node-c7EHvcnK.mjs} +2 -2
  22. package/dist/{LexicalDragon.node-QMR_wqJg.mjs.map → LexicalDragon.node-c7EHvcnK.mjs.map} +1 -1
  23. package/dist/{LexicalDragon.prod-OssQhwS-.mjs → LexicalDragon.prod-D6KvqyLD.mjs} +3 -3
  24. package/dist/{LexicalDragon.prod-OssQhwS-.mjs.map → LexicalDragon.prod-D6KvqyLD.mjs.map} +1 -1
  25. package/dist/{LexicalExtension.dev-CtDZiMCU.mjs → LexicalExtension.dev-PDo8HyEw.mjs} +3 -3
  26. package/dist/{LexicalExtension.dev-CtDZiMCU.mjs.map → LexicalExtension.dev-PDo8HyEw.mjs.map} +1 -1
  27. package/dist/{LexicalExtension.node-BM0gh8zu.mjs → LexicalExtension.node-BKzjRb-0.mjs} +2 -2
  28. package/dist/{LexicalExtension.node-BM0gh8zu.mjs.map → LexicalExtension.node-BKzjRb-0.mjs.map} +1 -1
  29. package/dist/{LexicalExtension.prod-Ug6emhEO.mjs → LexicalExtension.prod-D0x_lX7q.mjs} +3 -3
  30. package/dist/{LexicalExtension.prod-Ug6emhEO.mjs.map → LexicalExtension.prod-D0x_lX7q.mjs.map} +1 -1
  31. package/dist/{LexicalHeadless.dev-D4yQpl_s.mjs → LexicalHeadless.dev-DBKcW82j.mjs} +2 -2
  32. package/dist/{LexicalHeadless.dev-D4yQpl_s.mjs.map → LexicalHeadless.dev-DBKcW82j.mjs.map} +1 -1
  33. package/dist/{LexicalHeadless.prod-jeN65B3k.mjs → LexicalHeadless.prod-D4nEh7cR.mjs} +2 -2
  34. package/dist/{LexicalHeadless.prod-jeN65B3k.mjs.map → LexicalHeadless.prod-D4nEh7cR.mjs.map} +1 -1
  35. package/dist/{LexicalHtml.dev-BdU1_ITQ.mjs → LexicalHtml.dev-vsWW05es.mjs} +4 -4
  36. package/dist/{LexicalHtml.dev-BdU1_ITQ.mjs.map → LexicalHtml.dev-vsWW05es.mjs.map} +1 -1
  37. package/dist/{LexicalHtml.node-DLtAh00E.mjs → LexicalHtml.node-CpibAfba.mjs} +2 -2
  38. package/dist/{LexicalHtml.node-DLtAh00E.mjs.map → LexicalHtml.node-CpibAfba.mjs.map} +1 -1
  39. package/dist/{LexicalHtml.prod-DdLE1HHT.mjs → LexicalHtml.prod-Bqz-3WAp.mjs} +4 -4
  40. package/dist/{LexicalHtml.prod-DdLE1HHT.mjs.map → LexicalHtml.prod-Bqz-3WAp.mjs.map} +1 -1
  41. package/dist/{LexicalLink.dev-DK87Biuy.mjs → LexicalLink.dev-BO0J0B1E.mjs} +4 -4
  42. package/dist/{LexicalLink.dev-DK87Biuy.mjs.map → LexicalLink.dev-BO0J0B1E.mjs.map} +1 -1
  43. package/dist/{LexicalLink.prod-fssuv6Sf.mjs → LexicalLink.prod-D66AhUCZ.mjs} +4 -4
  44. package/dist/{LexicalLink.prod-fssuv6Sf.mjs.map → LexicalLink.prod-D66AhUCZ.mjs.map} +1 -1
  45. package/dist/{LexicalList.dev-BJ4dr_rk.mjs → LexicalList.dev-DVGTWRk0.mjs} +4 -4
  46. package/dist/{LexicalList.dev-BJ4dr_rk.mjs.map → LexicalList.dev-DVGTWRk0.mjs.map} +1 -1
  47. package/dist/{LexicalList.prod-jWBbaWfi.mjs → LexicalList.prod-Bao7NGl7.mjs} +4 -4
  48. package/dist/{LexicalList.prod-jWBbaWfi.mjs.map → LexicalList.prod-Bao7NGl7.mjs.map} +1 -1
  49. package/dist/{LexicalMarkdown.dev-C8e-eh6y.mjs → LexicalMarkdown.dev-CRWkZwlp.mjs} +4 -4
  50. package/dist/{LexicalMarkdown.dev-C8e-eh6y.mjs.map → LexicalMarkdown.dev-CRWkZwlp.mjs.map} +1 -1
  51. package/dist/{LexicalMarkdown.prod-k73tZVb2.mjs → LexicalMarkdown.prod-tGG6js4r.mjs} +4 -4
  52. package/dist/{LexicalMarkdown.prod-k73tZVb2.mjs.map → LexicalMarkdown.prod-tGG6js4r.mjs.map} +1 -1
  53. package/dist/{LexicalRichText.dev-CrSqq3K-.mjs → LexicalRichText.dev-DPXfQePC.mjs} +6 -6
  54. package/dist/{LexicalRichText.dev-CrSqq3K-.mjs.map → LexicalRichText.dev-DPXfQePC.mjs.map} +1 -1
  55. package/dist/{LexicalRichText.node-B7k7wlQz.mjs → LexicalRichText.node-BEkm_YwY.mjs} +5 -5
  56. package/dist/{LexicalRichText.node-B7k7wlQz.mjs.map → LexicalRichText.node-BEkm_YwY.mjs.map} +1 -1
  57. package/dist/{LexicalRichText.prod-CqvyxQ9m.mjs → LexicalRichText.prod-DlfudC5w.mjs} +6 -6
  58. package/dist/{LexicalRichText.prod-CqvyxQ9m.mjs.map → LexicalRichText.prod-DlfudC5w.mjs.map} +1 -1
  59. package/dist/{LexicalSelection.dev-sNOHKHe_.mjs → LexicalSelection.dev-BVTArZ-b.mjs} +2 -2
  60. package/dist/{LexicalSelection.dev-sNOHKHe_.mjs.map → LexicalSelection.dev-BVTArZ-b.mjs.map} +1 -1
  61. package/dist/{LexicalSelection.node-Di7GwBCZ.mjs → LexicalSelection.node-CQ8iTYsz.mjs} +2 -2
  62. package/dist/{LexicalSelection.node-Di7GwBCZ.mjs.map → LexicalSelection.node-CQ8iTYsz.mjs.map} +1 -1
  63. package/dist/{LexicalSelection.prod-SWllPJop.mjs → LexicalSelection.prod-BZKGGs-G.mjs} +2 -2
  64. package/dist/{LexicalSelection.prod-SWllPJop.mjs.map → LexicalSelection.prod-BZKGGs-G.mjs.map} +1 -1
  65. package/dist/{LexicalTable.dev-CQkLHXJx.mjs → LexicalTable.dev-C-AOEpJn.mjs} +5 -5
  66. package/dist/{LexicalTable.dev-CQkLHXJx.mjs.map → LexicalTable.dev-C-AOEpJn.mjs.map} +1 -1
  67. package/dist/{LexicalTable.prod-BtqCwKSi.mjs → LexicalTable.prod-Cyn0qWxZ.mjs} +5 -5
  68. package/dist/{LexicalTable.prod-BtqCwKSi.mjs.map → LexicalTable.prod-Cyn0qWxZ.mjs.map} +1 -1
  69. package/dist/{LexicalUtils.dev-DiUpsXE8.mjs → LexicalUtils.dev-DRRDyAlS.mjs} +3 -3
  70. package/dist/{LexicalUtils.dev-DiUpsXE8.mjs.map → LexicalUtils.dev-DRRDyAlS.mjs.map} +1 -1
  71. package/dist/{LexicalUtils.node-CmK462d1.mjs → LexicalUtils.node-Dz-HANi6.mjs} +2 -2
  72. package/dist/{LexicalUtils.node-CmK462d1.mjs.map → LexicalUtils.node-Dz-HANi6.mjs.map} +1 -1
  73. package/dist/{LexicalUtils.prod-bWwV4GAF.mjs → LexicalUtils.prod-CmeHwh8W.mjs} +3 -3
  74. package/dist/{LexicalUtils.prod-bWwV4GAF.mjs.map → LexicalUtils.prod-CmeHwh8W.mjs.map} +1 -1
  75. package/dist/{auth-OeKZZ_2x.mjs → auth-CAKmTDpF.mjs} +11 -11
  76. package/dist/auth-CAKmTDpF.mjs.map +1 -0
  77. package/dist/bin/mxs.d.mts +2 -1
  78. package/dist/bin/mxs.mjs +402 -55
  79. package/dist/bin/mxs.mjs.map +1 -1
  80. package/dist/{config-store-WL7dNMS6.mjs → config-store-B8_9iStL.mjs} +21 -81
  81. package/dist/config-store-B8_9iStL.mjs.map +1 -0
  82. package/dist/{create-Cxnqt_Wt.mjs → create-5wbU7IQh.mjs} +5 -5
  83. package/dist/{create-Cxnqt_Wt.mjs.map → create-5wbU7IQh.mjs.map} +1 -1
  84. package/dist/{create-DUOSAqBm.mjs → create-Bs6K7AyQ.mjs} +3 -3
  85. package/dist/{create-DUOSAqBm.mjs.map → create-Bs6K7AyQ.mjs.map} +1 -1
  86. package/dist/{create-C85MSrtt.mjs → create-DBReocgJ.mjs} +5 -5
  87. package/dist/{create-C85MSrtt.mjs.map → create-DBReocgJ.mjs.map} +1 -1
  88. package/dist/{create-BVHnXtIH.mjs → create-DGVaE0_S.mjs} +4 -4
  89. package/dist/{create-BVHnXtIH.mjs.map → create-DGVaE0_S.mjs.map} +1 -1
  90. package/dist/{create-BWA2WGrW.mjs → create-lLFZuMsz.mjs} +3 -3
  91. package/dist/{create-BWA2WGrW.mjs.map → create-lLFZuMsz.mjs.map} +1 -1
  92. package/dist/{delete-CGy-cV6k.mjs → delete-6tkhHQDp.mjs} +5 -5
  93. package/dist/delete-6tkhHQDp.mjs.map +1 -0
  94. package/dist/{delete-CcyrLNZv.mjs → delete-CRFxitDN.mjs} +6 -6
  95. package/dist/delete-CRFxitDN.mjs.map +1 -0
  96. package/dist/{delete-Cjxehwj7.mjs → delete-DU2Hvsy8.mjs} +5 -5
  97. package/dist/delete-DU2Hvsy8.mjs.map +1 -0
  98. package/dist/{delete-BEXOOFAJ.mjs → delete-nJmHtvfq.mjs} +6 -6
  99. package/dist/delete-nJmHtvfq.mjs.map +1 -0
  100. package/dist/{delete-CKqlAUT8.mjs → delete-tJhXI8s4.mjs} +5 -5
  101. package/dist/delete-tJhXI8s4.mjs.map +1 -0
  102. package/dist/{onboarding-C1t1yoay.mjs → dist-DJF1Ntdn.mjs} +95 -173
  103. package/dist/dist-DJF1Ntdn.mjs.map +1 -0
  104. package/dist/{document-output-C5PWbz2p.mjs → document-output-BFJdwPV0.mjs} +5 -5
  105. package/dist/document-output-BFJdwPV0.mjs.map +1 -0
  106. package/dist/{edit-BuKMUNVC.mjs → edit-BMjTbPQO.mjs} +5 -5
  107. package/dist/edit-BMjTbPQO.mjs.map +1 -0
  108. package/dist/{edit-DFnOnk4i.mjs → edit-BnEmMmv6.mjs} +9 -9
  109. package/dist/edit-BnEmMmv6.mjs.map +1 -0
  110. package/dist/{edit-BRaZ6GGg.mjs → edit-C4vRSmRy.mjs} +9 -9
  111. package/dist/{edit-BRaZ6GGg.mjs.map → edit-C4vRSmRy.mjs.map} +1 -1
  112. package/dist/{edit-t108N11Q.mjs → edit-CQsW5gnk.mjs} +8 -8
  113. package/dist/{edit-t108N11Q.mjs.map → edit-CQsW5gnk.mjs.map} +1 -1
  114. package/dist/{editor-xrF-j3UE.mjs → editor-BIw1ALTF.mjs} +4 -4
  115. package/dist/editor-BIw1ALTF.mjs.map +1 -0
  116. package/dist/{envelope-overlays-DPAlMNW1.mjs → envelope-overlays-DXXygxdF.mjs} +2 -2
  117. package/dist/{envelope-overlays-DPAlMNW1.mjs.map → envelope-overlays-DXXygxdF.mjs.map} +1 -1
  118. package/dist/{get-CwcNFb39.mjs → get-B3Y5hAAO.mjs} +3 -3
  119. package/dist/{get-CwcNFb39.mjs.map → get-B3Y5hAAO.mjs.map} +1 -1
  120. package/dist/{get-DnDvLa9S.mjs → get-C5fmd5Vf.mjs} +4 -4
  121. package/dist/{get-DnDvLa9S.mjs.map → get-C5fmd5Vf.mjs.map} +1 -1
  122. package/dist/{get-Doi-NKAh.mjs → get-Cdp2tmwz.mjs} +6 -6
  123. package/dist/get-Cdp2tmwz.mjs.map +1 -0
  124. package/dist/{get-DxTU7Nom.mjs → get-D18ChSKU.mjs} +3 -3
  125. package/dist/{get-DxTU7Nom.mjs.map → get-D18ChSKU.mjs.map} +1 -1
  126. package/dist/{get-BYoAlJwB.mjs → get-NSHTGu4Y.mjs} +4 -4
  127. package/dist/{get-BYoAlJwB.mjs.map → get-NSHTGu4Y.mjs.map} +1 -1
  128. package/dist/{get-GdRz82RW.mjs → get-XBPJr95m.mjs} +4 -4
  129. package/dist/{get-GdRz82RW.mjs.map → get-XBPJr95m.mjs.map} +1 -1
  130. package/dist/index.d.mts +57 -11
  131. package/dist/index.mjs +11 -10
  132. package/dist/{list-DVunNsXr.mjs → list-B6703n9X.mjs} +3 -3
  133. package/dist/{list-DVunNsXr.mjs.map → list-B6703n9X.mjs.map} +1 -1
  134. package/dist/{list-DN81zVDA.mjs → list-BtNocJhc.mjs} +3 -3
  135. package/dist/{list-DN81zVDA.mjs.map → list-BtNocJhc.mjs.map} +1 -1
  136. package/dist/{list-DHG-MzOM.mjs → list-C9dXrU9H.mjs} +3 -3
  137. package/dist/{list-DHG-MzOM.mjs.map → list-C9dXrU9H.mjs.map} +1 -1
  138. package/dist/{list-CtME3aDw.mjs → list-CcwcYZgN.mjs} +3 -3
  139. package/dist/{list-CtME3aDw.mjs.map → list-CcwcYZgN.mjs.map} +1 -1
  140. package/dist/{list-CLAcZYZ4.mjs → list-Ctc8b5gT.mjs} +3 -3
  141. package/dist/{list-CLAcZYZ4.mjs.map → list-Ctc8b5gT.mjs.map} +1 -1
  142. package/dist/{list-DbNCVZbz.mjs → list-b60JzCTw.mjs} +3 -3
  143. package/dist/{list-DbNCVZbz.mjs.map → list-b60JzCTw.mjs.map} +1 -1
  144. package/dist/{litexml-codec-CDoRloiR.mjs → litexml-codec-CfIxcPG0.mjs} +10 -10
  145. package/dist/{litexml-codec-CDoRloiR.mjs.map → litexml-codec-CfIxcPG0.mjs.map} +1 -1
  146. package/dist/{login-mjliJn8U.mjs → login-bZx4HaVs.mjs} +21 -9
  147. package/dist/{login-mjliJn8U.mjs.map → login-bZx4HaVs.mjs.map} +1 -1
  148. package/dist/logout-C0Dzitsu.mjs +18 -0
  149. package/dist/logout-C0Dzitsu.mjs.map +1 -0
  150. package/dist/ls-wMiTXZPQ.mjs +33 -0
  151. package/dist/ls-wMiTXZPQ.mjs.map +1 -0
  152. package/dist/mark-Dh9BErsf.mjs +29 -0
  153. package/dist/mark-Dh9BErsf.mjs.map +1 -0
  154. package/dist/onboarding-Bw_I8qpf.mjs +214 -0
  155. package/dist/onboarding-Bw_I8qpf.mjs.map +1 -0
  156. package/dist/{output-CTnO1lYt.d.mts → output-D2dDlyV2.d.mts} +1 -1
  157. package/dist/{output-BM7aBFwt.mjs → output-vzequvhd.mjs} +52 -9
  158. package/dist/output-vzequvhd.mjs.map +1 -0
  159. package/dist/{payload-CN11pUto.mjs → payload-CO4zbNr8.mjs} +17 -17
  160. package/dist/payload-CO4zbNr8.mjs.map +1 -0
  161. package/dist/profile-CNe2uWJi.mjs +172 -0
  162. package/dist/profile-CNe2uWJi.mjs.map +1 -0
  163. package/dist/{publish-akQWYsnL.mjs → publish-CzzucXQq.mjs} +4 -4
  164. package/dist/{publish-akQWYsnL.mjs.map → publish-CzzucXQq.mjs.map} +1 -1
  165. package/dist/{publish-CN3NTJ_r.mjs → publish-DRQkpxsz.mjs} +4 -4
  166. package/dist/{publish-CN3NTJ_r.mjs.map → publish-DRQkpxsz.mjs.map} +1 -1
  167. package/dist/{resolve-CyjMlaoJ.mjs → resolve-BYg5Gees.mjs} +5 -5
  168. package/dist/resolve-BYg5Gees.mjs.map +1 -0
  169. package/dist/{resolve-Bw5Po9yK.mjs → resolve-BlpMdnaM.mjs} +4 -4
  170. package/dist/resolve-BlpMdnaM.mjs.map +1 -0
  171. package/dist/{resolve-BogJOR7R.mjs → resolve-CUsHGcb-.mjs} +4 -4
  172. package/dist/resolve-CUsHGcb-.mjs.map +1 -0
  173. package/dist/{resolve-helpers-CahPoJ0Y.mjs → resolve-helpers-CoHYa2uk.mjs} +2 -2
  174. package/dist/{resolve-helpers-CahPoJ0Y.mjs.map → resolve-helpers-CoHYa2uk.mjs.map} +1 -1
  175. package/dist/{resolve-Bp1AfBmM.mjs → resolve-jdb1VqAG.mjs} +5 -5
  176. package/dist/resolve-jdb1VqAG.mjs.map +1 -0
  177. package/dist/rm-D-2iW1Cr.mjs +33 -0
  178. package/dist/rm-D-2iW1Cr.mjs.map +1 -0
  179. package/dist/run-Dnax6uhZ.mjs +130 -0
  180. package/dist/run-Dnax6uhZ.mjs.map +1 -0
  181. package/dist/self-update-CZywTwGd.mjs +1610 -0
  182. package/dist/self-update-CZywTwGd.mjs.map +1 -0
  183. package/dist/{set-ClbrGFGv.mjs → set-Dk28LAy5.mjs} +5 -5
  184. package/dist/set-Dk28LAy5.mjs.map +1 -0
  185. package/dist/{shared-C2EAn5h_.mjs → shared-d0_6ZPn_.mjs} +13 -9
  186. package/dist/shared-d0_6ZPn_.mjs.map +1 -0
  187. package/dist/show-DScu6mXz.mjs +39 -0
  188. package/dist/show-DScu6mXz.mjs.map +1 -0
  189. package/dist/status-8F6tgphP.mjs +23 -0
  190. package/dist/status-8F6tgphP.mjs.map +1 -0
  191. package/dist/{update-dc-72pUN.mjs → update-B1LGxV0n.mjs} +6 -6
  192. package/dist/{update-dc-72pUN.mjs.map → update-B1LGxV0n.mjs.map} +1 -1
  193. package/dist/{update-CHmckeo8.mjs → update-CXetpFT3.mjs} +4 -4
  194. package/dist/{update-CHmckeo8.mjs.map → update-CXetpFT3.mjs.map} +1 -1
  195. package/dist/{update-Duh-iVOZ.mjs → update-Dr4BW8U-.mjs} +6 -6
  196. package/dist/{update-Duh-iVOZ.mjs.map → update-Dr4BW8U-.mjs.map} +1 -1
  197. package/dist/{update-qfiC-9Og.mjs → update-bqcHRJPC.mjs} +6 -6
  198. package/dist/update-bqcHRJPC.mjs.map +1 -0
  199. package/dist/{update-CJjwg09n.mjs → update-dBtzzmkN.mjs} +5 -5
  200. package/dist/update-dBtzzmkN.mjs.map +1 -0
  201. package/dist/use-D7eKESSW.mjs +29 -0
  202. package/dist/use-D7eKESSW.mjs.map +1 -0
  203. package/dist/{whoami-UwcdRchK.mjs → whoami-CKSNd6zL.mjs} +6 -6
  204. package/dist/whoami-CKSNd6zL.mjs.map +1 -0
  205. package/package.json +15 -13
  206. package/LICENSE +0 -33
  207. package/dist/auth-OeKZZ_2x.mjs.map +0 -1
  208. package/dist/chunk-hT5z_Zn9.mjs +0 -35
  209. package/dist/config-store-WL7dNMS6.mjs.map +0 -1
  210. package/dist/delete-BEXOOFAJ.mjs.map +0 -1
  211. package/dist/delete-CGy-cV6k.mjs.map +0 -1
  212. package/dist/delete-CKqlAUT8.mjs.map +0 -1
  213. package/dist/delete-CcyrLNZv.mjs.map +0 -1
  214. package/dist/delete-Cjxehwj7.mjs.map +0 -1
  215. package/dist/document-output-C5PWbz2p.mjs.map +0 -1
  216. package/dist/edit-BuKMUNVC.mjs.map +0 -1
  217. package/dist/edit-DFnOnk4i.mjs.map +0 -1
  218. package/dist/editor-xrF-j3UE.mjs.map +0 -1
  219. package/dist/get-Doi-NKAh.mjs.map +0 -1
  220. package/dist/logout-Bslt_ZJ4.mjs +0 -11
  221. package/dist/logout-Bslt_ZJ4.mjs.map +0 -1
  222. package/dist/onboarding-C1t1yoay.mjs.map +0 -1
  223. package/dist/output-BM7aBFwt.mjs.map +0 -1
  224. package/dist/payload-CN11pUto.mjs.map +0 -1
  225. package/dist/resolve-BogJOR7R.mjs.map +0 -1
  226. package/dist/resolve-Bp1AfBmM.mjs.map +0 -1
  227. package/dist/resolve-Bw5Po9yK.mjs.map +0 -1
  228. package/dist/resolve-CyjMlaoJ.mjs.map +0 -1
  229. package/dist/set-ClbrGFGv.mjs.map +0 -1
  230. package/dist/shared-C2EAn5h_.mjs.map +0 -1
  231. package/dist/status-Cvyrrx-J.mjs +0 -22
  232. package/dist/status-Cvyrrx-J.mjs.map +0 -1
  233. package/dist/update-CJjwg09n.mjs.map +0 -1
  234. package/dist/update-qfiC-9Og.mjs.map +0 -1
  235. package/dist/whoami-UwcdRchK.mjs.map +0 -1
@@ -1,13 +1,13 @@
1
- import { i as emitSuccess, r as emitInfo } from "./output-BM7aBFwt.mjs";
2
- import { u as writeCredentials } from "./config-store-WL7dNMS6.mjs";
3
- import { l as requestDeviceCode, o as pollDeviceToken, u as toCredentials } from "./auth-OeKZZ_2x.mjs";
4
- import { n as resolveContext } from "./shared-C2EAn5h_.mjs";
1
+ import { i as emitSuccess, r as emitInfo } from "./output-vzequvhd.mjs";
2
+ import { f as setCurrentProfile, h as writeProfileCredentials, l as readProfileConfig, m as writeProfileConfig, r as getCurrentProfile } from "./profile-CNe2uWJi.mjs";
3
+ import { l as requestDeviceCode, o as pollDeviceToken, u as toCredentials } from "./auth-CAKmTDpF.mjs";
4
+ import { n as resolveContext } from "./shared-d0_6ZPn_.mjs";
5
5
  import childProcess, { execFile } from "node:child_process";
6
6
  import path from "node:path";
7
7
  import fs from "node:fs";
8
8
  import V from "node:process";
9
- import os from "node:os";
10
9
  import { promisify } from "node:util";
10
+ import os from "node:os";
11
11
  import { fileURLToPath } from "node:url";
12
12
  import fs$1, { constants } from "node:fs/promises";
13
13
  import { Buffer } from "node:buffer";
@@ -540,7 +540,7 @@ defineLazyProperty(apps, "edge", () => detectPlatformBinary({
540
540
  defineLazyProperty(apps, "safari", () => detectPlatformBinary({ darwin: "Safari" }));
541
541
  //#endregion
542
542
  //#region src/commands/auth/login.ts
543
- async function run(flags, out) {
543
+ async function run(flags, out, opts = {}) {
544
544
  const ctx = await resolveContext(flags, out);
545
545
  emitInfo(`probing ${ctx.apiUrl}…`, out);
546
546
  emitInfo(`API base: ${ctx.apiBase}`, out);
@@ -566,8 +566,20 @@ async function run(flags, out) {
566
566
  if (state === "slow_down") emitInfo("slow_down — increasing interval", out);
567
567
  }
568
568
  }));
569
- await writeCredentials(cred);
570
- emitInfo("authorized", out);
569
+ const target = flags.profile?.trim() || await getCurrentProfile() || "default";
570
+ const existing = await readProfileConfig(target);
571
+ await writeProfileConfig(target, {
572
+ ...existing,
573
+ api_url: ctx.apiUrl,
574
+ api_base: ctx.apiBase,
575
+ auth_base: ctx.authBase,
576
+ api_version: ctx.apiVersion,
577
+ client_id: ctx.clientId,
578
+ ...opts.production !== void 0 ? { production: opts.production } : existing.production !== void 0 ? { production: existing.production } : {}
579
+ });
580
+ await writeProfileCredentials(target, cred);
581
+ await setCurrentProfile(target);
582
+ emitInfo(`mxs: logged in to profile '${target}'`, out);
571
583
  emitSuccess({
572
584
  user: cred.user ?? null,
573
585
  expires_at: cred.expires_at
@@ -576,4 +588,4 @@ async function run(flags, out) {
576
588
  //#endregion
577
589
  export { run };
578
590
 
579
- //# sourceMappingURL=login-mjliJn8U.mjs.map
591
+ //# sourceMappingURL=login-bZx4HaVs.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"login-mjliJn8U.mjs","names":["process","execFile","powerShellPath","process","execFile","fs","fsConstants","isWsl","windowsPowerShellPath","execFileAsync","process","execFileAsync","process","execFileAsync","defaultBrowser","process","windows","process","process","isWsl","fs","fsConstants"],"sources":["../../../node_modules/.pnpm/is-docker@3.0.0/node_modules/is-docker/index.js","../../../node_modules/.pnpm/is-inside-container@1.0.0/node_modules/is-inside-container/index.js","../../../node_modules/.pnpm/is-wsl@3.1.1/node_modules/is-wsl/index.js","../../../node_modules/.pnpm/powershell-utils@0.1.0/node_modules/powershell-utils/index.js","../../../node_modules/.pnpm/wsl-utils@0.3.1/node_modules/wsl-utils/utilities.js","../../../node_modules/.pnpm/wsl-utils@0.3.1/node_modules/wsl-utils/index.js","../../../node_modules/.pnpm/define-lazy-prop@3.0.0/node_modules/define-lazy-prop/index.js","../../../node_modules/.pnpm/default-browser-id@5.0.1/node_modules/default-browser-id/index.js","../../../node_modules/.pnpm/run-applescript@7.1.0/node_modules/run-applescript/index.js","../../../node_modules/.pnpm/bundle-name@4.1.0/node_modules/bundle-name/index.js","../../../node_modules/.pnpm/default-browser@5.5.0/node_modules/default-browser/windows.js","../../../node_modules/.pnpm/default-browser@5.5.0/node_modules/default-browser/index.js","../../../node_modules/.pnpm/is-in-ssh@1.0.0/node_modules/is-in-ssh/index.js","../../../node_modules/.pnpm/open@11.0.0/node_modules/open/index.js","../src/commands/auth/login.ts"],"sourcesContent":["import fs from 'node:fs';\n\nlet isDockerCached;\n\nfunction hasDockerEnv() {\n\ttry {\n\t\tfs.statSync('/.dockerenv');\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n}\n\nfunction hasDockerCGroup() {\n\ttry {\n\t\treturn fs.readFileSync('/proc/self/cgroup', 'utf8').includes('docker');\n\t} catch {\n\t\treturn false;\n\t}\n}\n\nexport default function isDocker() {\n\t// TODO: Use `??=` when targeting Node.js 16.\n\tif (isDockerCached === undefined) {\n\t\tisDockerCached = hasDockerEnv() || hasDockerCGroup();\n\t}\n\n\treturn isDockerCached;\n}\n","import fs from 'node:fs';\nimport isDocker from 'is-docker';\n\nlet cachedResult;\n\n// Podman detection\nconst hasContainerEnv = () => {\n\ttry {\n\t\tfs.statSync('/run/.containerenv');\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n};\n\nexport default function isInsideContainer() {\n\t// TODO: Use `??=` when targeting Node.js 16.\n\tif (cachedResult === undefined) {\n\t\tcachedResult = hasContainerEnv() || isDocker();\n\t}\n\n\treturn cachedResult;\n}\n","import process from 'node:process';\nimport os from 'node:os';\nimport fs from 'node:fs';\nimport isInsideContainer from 'is-inside-container';\n\nconst isWsl = () => {\n\tif (process.platform !== 'linux') {\n\t\treturn false;\n\t}\n\n\tif (os.release().toLowerCase().includes('microsoft')) {\n\t\tif (isInsideContainer()) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t}\n\n\ttry {\n\t\tif (fs.readFileSync('/proc/version', 'utf8').toLowerCase().includes('microsoft')) {\n\t\t\treturn !isInsideContainer();\n\t\t}\n\t} catch {}\n\n\t// Fallback for custom kernels: check WSL-specific paths.\n\tif (\n\t\tfs.existsSync('/proc/sys/fs/binfmt_misc/WSLInterop')\n\t\t|| fs.existsSync('/run/WSL')\n\t) {\n\t\treturn !isInsideContainer();\n\t}\n\n\treturn false;\n};\n\nexport default process.env.__IS_WSL_TEST__ ? isWsl : isWsl();\n","import process from 'node:process';\nimport {Buffer} from 'node:buffer';\nimport {promisify} from 'node:util';\nimport childProcess from 'node:child_process';\nimport fs, {constants as fsConstants} from 'node:fs/promises';\n\nconst execFile = promisify(childProcess.execFile);\n\nexport const powerShellPath = () => `${process.env.SYSTEMROOT || process.env.windir || String.raw`C:\\Windows`}\\\\System32\\\\WindowsPowerShell\\\\v1.0\\\\powershell.exe`;\n\n// Cache for PowerShell accessibility check\nlet canAccessCache;\n\nexport const canAccessPowerShell = async () => {\n\tcanAccessCache ??= (async () => {\n\t\ttry {\n\t\t\tawait fs.access(powerShellPath(), fsConstants.X_OK);\n\t\t\treturn true;\n\t\t} catch {\n\t\t\treturn false;\n\t\t}\n\t})();\n\n\treturn canAccessCache;\n};\n\nexport const executePowerShell = async (command, options = {}) => {\n\tconst {\n\t\tpowerShellPath: psPath,\n\t\t...execFileOptions\n\t} = options;\n\n\tconst encodedCommand = executePowerShell.encodeCommand(command);\n\n\treturn execFile(\n\t\tpsPath ?? powerShellPath(),\n\t\t[\n\t\t\t...executePowerShell.argumentsPrefix,\n\t\t\tencodedCommand,\n\t\t],\n\t\t{\n\t\t\tencoding: 'utf8',\n\t\t\t...execFileOptions,\n\t\t},\n\t);\n};\n\nexecutePowerShell.argumentsPrefix = [\n\t'-NoProfile',\n\t'-NonInteractive',\n\t'-ExecutionPolicy',\n\t'Bypass',\n\t'-EncodedCommand',\n];\n\nexecutePowerShell.encodeCommand = command => Buffer.from(command, 'utf16le').toString('base64');\n\nexecutePowerShell.escapeArgument = value => `'${String(value).replaceAll('\\'', '\\'\\'')}'`;\n","export function parseMountPointFromConfig(content) {\n\tfor (const line of content.split('\\n')) {\n\t\t// Skip comment lines\n\t\tif (/^\\s*#/.test(line)) {\n\t\t\tcontinue;\n\t\t}\n\n\t\t// Match root at start of line (after optional whitespace)\n\t\tconst match = /^\\s*root\\s*=\\s*(?<mountPoint>\"[^\"]*\"|'[^']*'|[^#]*)/.exec(line);\n\t\tif (!match) {\n\t\t\tcontinue;\n\t\t}\n\n\t\treturn match.groups.mountPoint\n\t\t\t.trim()\n\t\t\t// Strip surrounding quotes\n\t\t\t.replaceAll(/^[\"']|[\"']$/g, '');\n\t}\n}\n","import {promisify} from 'node:util';\nimport childProcess from 'node:child_process';\nimport fs, {constants as fsConstants} from 'node:fs/promises';\nimport isWsl from 'is-wsl';\nimport {powerShellPath as windowsPowerShellPath, executePowerShell} from 'powershell-utils';\nimport {parseMountPointFromConfig} from './utilities.js';\n\nconst execFile = promisify(childProcess.execFile);\n\nexport const wslDrivesMountPoint = (() => {\n\t// Default value for \"root\" param\n\t// according to https://docs.microsoft.com/en-us/windows/wsl/wsl-config\n\tconst defaultMountPoint = '/mnt/';\n\n\tlet mountPoint;\n\n\treturn async function () {\n\t\tif (mountPoint) {\n\t\t\t// Return memoized mount point value\n\t\t\treturn mountPoint;\n\t\t}\n\n\t\tconst configFilePath = '/etc/wsl.conf';\n\n\t\tlet isConfigFileExists = false;\n\t\ttry {\n\t\t\tawait fs.access(configFilePath, fsConstants.F_OK);\n\t\t\tisConfigFileExists = true;\n\t\t} catch {}\n\n\t\tif (!isConfigFileExists) {\n\t\t\treturn defaultMountPoint;\n\t\t}\n\n\t\tconst configContent = await fs.readFile(configFilePath, {encoding: 'utf8'});\n\t\tconst parsedMountPoint = parseMountPointFromConfig(configContent);\n\n\t\tif (parsedMountPoint === undefined) {\n\t\t\treturn defaultMountPoint;\n\t\t}\n\n\t\tmountPoint = parsedMountPoint;\n\t\tmountPoint = mountPoint.endsWith('/') ? mountPoint : `${mountPoint}/`;\n\n\t\treturn mountPoint;\n\t};\n})();\n\nexport const powerShellPathFromWsl = async () => {\n\tconst mountPoint = await wslDrivesMountPoint();\n\treturn `${mountPoint}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`;\n};\n\nexport const powerShellPath = isWsl ? powerShellPathFromWsl : windowsPowerShellPath;\n\n// Cache for PowerShell accessibility check\nlet canAccessPowerShellPromise;\n\nexport const canAccessPowerShell = async () => {\n\tcanAccessPowerShellPromise ??= (async () => {\n\t\ttry {\n\t\t\tconst psPath = await powerShellPath();\n\t\t\tawait fs.access(psPath, fsConstants.X_OK);\n\t\t\treturn true;\n\t\t} catch {\n\t\t\t// PowerShell is not accessible (either doesn't exist, no execute permission, or other error)\n\t\t\treturn false;\n\t\t}\n\t})();\n\n\treturn canAccessPowerShellPromise;\n};\n\nexport const wslDefaultBrowser = async () => {\n\tconst psPath = await powerShellPath();\n\tconst command = String.raw`(Get-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice\").ProgId`;\n\n\tconst {stdout} = await executePowerShell(command, {powerShellPath: psPath});\n\n\treturn stdout.trim();\n};\n\nexport const convertWslPathToWindows = async path => {\n\t// Don't convert URLs\n\tif (/^[a-z]+:\\/\\//i.test(path)) {\n\t\treturn path;\n\t}\n\n\ttry {\n\t\tconst {stdout} = await execFile('wslpath', ['-aw', path], {encoding: 'utf8'});\n\t\treturn stdout.trim();\n\t} catch {\n\t\t// If wslpath fails, return the original path\n\t\treturn path;\n\t}\n};\n\nexport {default as isWsl} from 'is-wsl';\n","export default function defineLazyProperty(object, propertyName, valueGetter) {\n\tconst define = value => Object.defineProperty(object, propertyName, {value, enumerable: true, writable: true});\n\n\tObject.defineProperty(object, propertyName, {\n\t\tconfigurable: true,\n\t\tenumerable: true,\n\t\tget() {\n\t\t\tconst result = valueGetter();\n\t\t\tdefine(result);\n\t\t\treturn result;\n\t\t},\n\t\tset(value) {\n\t\t\tdefine(value);\n\t\t}\n\t});\n\n\treturn object;\n}\n","import {promisify} from 'node:util';\nimport process from 'node:process';\nimport {execFile} from 'node:child_process';\n\nconst execFileAsync = promisify(execFile);\n\nexport default async function defaultBrowserId() {\n\tif (process.platform !== 'darwin') {\n\t\tthrow new Error('macOS only');\n\t}\n\n\tconst {stdout} = await execFileAsync('defaults', ['read', 'com.apple.LaunchServices/com.apple.launchservices.secure', 'LSHandlers']);\n\n\t// `(?!-)` is to prevent matching `LSHandlerRoleAll = \"-\";`.\n\tconst match = /LSHandlerRoleAll = \"(?!-)(?<id>[^\"]+?)\";\\s+?LSHandlerURLScheme = (?:http|https);/.exec(stdout);\n\n\tconst browserId = match?.groups.id ?? 'com.apple.Safari';\n\n\t// Correct the case for Safari's bundle identifier\n\tif (browserId === 'com.apple.safari') {\n\t\treturn 'com.apple.Safari';\n\t}\n\n\treturn browserId;\n}\n","import process from 'node:process';\nimport {promisify} from 'node:util';\nimport {execFile, execFileSync} from 'node:child_process';\n\nconst execFileAsync = promisify(execFile);\n\nexport async function runAppleScript(script, {humanReadableOutput = true, signal} = {}) {\n\tif (process.platform !== 'darwin') {\n\t\tthrow new Error('macOS only');\n\t}\n\n\tconst outputArguments = humanReadableOutput ? [] : ['-ss'];\n\n\tconst execOptions = {};\n\tif (signal) {\n\t\texecOptions.signal = signal;\n\t}\n\n\tconst {stdout} = await execFileAsync('osascript', ['-e', script, outputArguments], execOptions);\n\treturn stdout.trim();\n}\n\nexport function runAppleScriptSync(script, {humanReadableOutput = true} = {}) {\n\tif (process.platform !== 'darwin') {\n\t\tthrow new Error('macOS only');\n\t}\n\n\tconst outputArguments = humanReadableOutput ? [] : ['-ss'];\n\n\tconst stdout = execFileSync('osascript', ['-e', script, ...outputArguments], {\n\t\tencoding: 'utf8',\n\t\tstdio: ['ignore', 'pipe', 'ignore'],\n\t\ttimeout: 500,\n\t});\n\n\treturn stdout.trim();\n}\n","import {runAppleScript} from 'run-applescript';\n\nexport default async function bundleName(bundleId) {\n\treturn runAppleScript(`tell application \"Finder\" to set app_path to application file id \"${bundleId}\" as string\\ntell application \"System Events\" to get value of property list item \"CFBundleName\" of property list file (app_path & \":Contents:Info.plist\")`);\n}\n","import {promisify} from 'node:util';\nimport {execFile} from 'node:child_process';\n\nconst execFileAsync = promisify(execFile);\n\n// TODO: Fix the casing of bundle identifiers in the next major version.\n\n// Windows doesn't have browser IDs in the same way macOS/Linux does so we give fake\n// ones that look real and match the macOS/Linux versions for cross-platform apps.\nconst windowsBrowserProgIds = {\n\tMSEdgeHTM: {name: 'Edge', id: 'com.microsoft.edge'}, // The missing `L` is correct.\n\tMSEdgeBHTML: {name: 'Edge Beta', id: 'com.microsoft.edge.beta'},\n\tMSEdgeDHTML: {name: 'Edge Dev', id: 'com.microsoft.edge.dev'},\n\tAppXq0fevzme2pys62n3e0fbqa7peapykr8v: {name: 'Edge', id: 'com.microsoft.edge.old'},\n\tChromeHTML: {name: 'Chrome', id: 'com.google.chrome'},\n\tChromeBHTML: {name: 'Chrome Beta', id: 'com.google.chrome.beta'},\n\tChromeDHTML: {name: 'Chrome Dev', id: 'com.google.chrome.dev'},\n\tChromiumHTM: {name: 'Chromium', id: 'org.chromium.Chromium'},\n\tBraveHTML: {name: 'Brave', id: 'com.brave.Browser'},\n\tBraveBHTML: {name: 'Brave Beta', id: 'com.brave.Browser.beta'},\n\tBraveDHTML: {name: 'Brave Dev', id: 'com.brave.Browser.dev'},\n\tBraveSSHTM: {name: 'Brave Nightly', id: 'com.brave.Browser.nightly'},\n\tFirefoxURL: {name: 'Firefox', id: 'org.mozilla.firefox'},\n\tOperaStable: {name: 'Opera', id: 'com.operasoftware.Opera'},\n\tVivaldiHTM: {name: 'Vivaldi', id: 'com.vivaldi.Vivaldi'},\n\t'IE.HTTP': {name: 'Internet Explorer', id: 'com.microsoft.ie'},\n};\n\nexport const _windowsBrowserProgIdMap = new Map(Object.entries(windowsBrowserProgIds));\n\nexport class UnknownBrowserError extends Error {}\n\nexport default async function defaultBrowser(_execFileAsync = execFileAsync) {\n\tconst {stdout} = await _execFileAsync('reg', [\n\t\t'QUERY',\n\t\t' HKEY_CURRENT_USER\\\\Software\\\\Microsoft\\\\Windows\\\\Shell\\\\Associations\\\\UrlAssociations\\\\http\\\\UserChoice',\n\t\t'/v',\n\t\t'ProgId',\n\t]);\n\n\tconst match = /ProgId\\s*REG_SZ\\s*(?<id>\\S+)/.exec(stdout);\n\tif (!match) {\n\t\tthrow new UnknownBrowserError(`Cannot find Windows browser in stdout: ${JSON.stringify(stdout)}`);\n\t}\n\n\tconst {id} = match.groups;\n\n\t// Windows can append a hash suffix to ProgIds using a dot or hyphen\n\t// (e.g., `ChromeHTML.ABC123`, `FirefoxURL-6F193CCC56814779`).\n\t// Try exact match first, then try without the suffix.\n\tconst dotIndex = id.lastIndexOf('.');\n\tconst hyphenIndex = id.lastIndexOf('-');\n\tconst baseIdByDot = dotIndex === -1 ? undefined : id.slice(0, dotIndex);\n\tconst baseIdByHyphen = hyphenIndex === -1 ? undefined : id.slice(0, hyphenIndex);\n\n\treturn windowsBrowserProgIds[id] ?? windowsBrowserProgIds[baseIdByDot] ?? windowsBrowserProgIds[baseIdByHyphen] ?? {name: id, id};\n}\n","import {promisify} from 'node:util';\nimport process from 'node:process';\nimport {execFile} from 'node:child_process';\nimport defaultBrowserId from 'default-browser-id';\nimport bundleName from 'bundle-name';\nimport windows from './windows.js';\n\nexport {_windowsBrowserProgIdMap} from './windows.js';\n\nconst execFileAsync = promisify(execFile);\n\n// Inlined: https://github.com/sindresorhus/titleize/blob/main/index.js\nconst titleize = string => string.toLowerCase().replaceAll(/(?:^|\\s|-)\\S/g, x => x.toUpperCase());\n\nexport default async function defaultBrowser() {\n\tif (process.platform === 'darwin') {\n\t\tconst id = await defaultBrowserId();\n\t\tconst name = await bundleName(id);\n\t\treturn {name, id};\n\t}\n\n\tif (process.platform === 'linux') {\n\t\tconst {stdout} = await execFileAsync('xdg-mime', ['query', 'default', 'x-scheme-handler/http']);\n\t\tconst id = stdout.trim();\n\t\tconst name = titleize(id.replace(/.desktop$/, '').replace('-', ' '));\n\t\treturn {name, id};\n\t}\n\n\tif (process.platform === 'win32') {\n\t\treturn windows();\n\t}\n\n\tthrow new Error('Only macOS, Linux, and Windows are supported');\n}\n","import process from 'node:process';\n\nconst isInSsh = Boolean(process.env.SSH_CONNECTION\n\t|| process.env.SSH_CLIENT\n\t|| process.env.SSH_TTY);\n\nexport default isInSsh;\n","import process from 'node:process';\nimport path from 'node:path';\nimport {fileURLToPath} from 'node:url';\nimport childProcess from 'node:child_process';\nimport fs, {constants as fsConstants} from 'node:fs/promises';\nimport {\n\tisWsl,\n\tpowerShellPath,\n\tconvertWslPathToWindows,\n\tcanAccessPowerShell,\n\twslDefaultBrowser,\n} from 'wsl-utils';\nimport {executePowerShell} from 'powershell-utils';\nimport defineLazyProperty from 'define-lazy-prop';\nimport defaultBrowser, {_windowsBrowserProgIdMap} from 'default-browser';\nimport isInsideContainer from 'is-inside-container';\nimport isInSsh from 'is-in-ssh';\n\nconst fallbackAttemptSymbol = Symbol('fallbackAttempt');\n\n// Path to included `xdg-open`.\nconst __dirname = import.meta.url ? path.dirname(fileURLToPath(import.meta.url)) : '';\nconst localXdgOpenPath = path.join(__dirname, 'xdg-open');\n\nconst {platform, arch} = process;\n\nconst tryEachApp = async (apps, opener) => {\n\tif (apps.length === 0) {\n\t\t// No app was provided\n\t\treturn;\n\t}\n\n\tconst errors = [];\n\n\tfor (const app of apps) {\n\t\ttry {\n\t\t\treturn await opener(app); // eslint-disable-line no-await-in-loop\n\t\t} catch (error) {\n\t\t\terrors.push(error);\n\t\t}\n\t}\n\n\tthrow new AggregateError(errors, 'Failed to open in all supported apps');\n};\n\n// eslint-disable-next-line complexity\nconst baseOpen = async options => {\n\toptions = {\n\t\twait: false,\n\t\tbackground: false,\n\t\tnewInstance: false,\n\t\tallowNonzeroExitCode: false,\n\t\t...options,\n\t};\n\n\tconst isFallbackAttempt = options[fallbackAttemptSymbol] === true;\n\tdelete options[fallbackAttemptSymbol];\n\n\tif (Array.isArray(options.app)) {\n\t\treturn tryEachApp(options.app, singleApp => baseOpen({\n\t\t\t...options,\n\t\t\tapp: singleApp,\n\t\t\t[fallbackAttemptSymbol]: true,\n\t\t}));\n\t}\n\n\tlet {name: app, arguments: appArguments = []} = options.app ?? {};\n\tappArguments = [...appArguments];\n\n\tif (Array.isArray(app)) {\n\t\treturn tryEachApp(app, appName => baseOpen({\n\t\t\t...options,\n\t\t\tapp: {\n\t\t\t\tname: appName,\n\t\t\t\targuments: appArguments,\n\t\t\t},\n\t\t\t[fallbackAttemptSymbol]: true,\n\t\t}));\n\t}\n\n\tif (app === 'browser' || app === 'browserPrivate') {\n\t\t// IDs from default-browser for macOS and windows are the same.\n\t\t// IDs are lowercased to increase chances of a match.\n\t\tconst ids = {\n\t\t\t'com.google.chrome': 'chrome',\n\t\t\t'google-chrome.desktop': 'chrome',\n\t\t\t'com.brave.browser': 'brave',\n\t\t\t'org.mozilla.firefox': 'firefox',\n\t\t\t'firefox.desktop': 'firefox',\n\t\t\t'com.microsoft.msedge': 'edge',\n\t\t\t'com.microsoft.edge': 'edge',\n\t\t\t'com.microsoft.edgemac': 'edge',\n\t\t\t'microsoft-edge.desktop': 'edge',\n\t\t\t'com.apple.safari': 'safari',\n\t\t};\n\n\t\t// Incognito flags for each browser in `apps`.\n\t\tconst flags = {\n\t\t\tchrome: '--incognito',\n\t\t\tbrave: '--incognito',\n\t\t\tfirefox: '--private-window',\n\t\t\tedge: '--inPrivate',\n\t\t\t// Safari doesn't support private mode via command line\n\t\t};\n\n\t\tlet browser;\n\t\tif (isWsl) {\n\t\t\tconst progId = await wslDefaultBrowser();\n\t\t\tconst browserInfo = _windowsBrowserProgIdMap.get(progId);\n\t\t\tbrowser = browserInfo ?? {};\n\t\t} else {\n\t\t\tbrowser = await defaultBrowser();\n\t\t}\n\n\t\tif (browser.id in ids) {\n\t\t\tconst browserName = ids[browser.id.toLowerCase()];\n\n\t\t\tif (app === 'browserPrivate') {\n\t\t\t\t// Safari doesn't support private mode via command line\n\t\t\t\tif (browserName === 'safari') {\n\t\t\t\t\tthrow new Error('Safari doesn\\'t support opening in private mode via command line');\n\t\t\t\t}\n\n\t\t\t\tappArguments.push(flags[browserName]);\n\t\t\t}\n\n\t\t\treturn baseOpen({\n\t\t\t\t...options,\n\t\t\t\tapp: {\n\t\t\t\t\tname: apps[browserName],\n\t\t\t\t\targuments: appArguments,\n\t\t\t\t},\n\t\t\t});\n\t\t}\n\n\t\tthrow new Error(`${browser.name} is not supported as a default browser`);\n\t}\n\n\tlet command;\n\tconst cliArguments = [];\n\tconst childProcessOptions = {};\n\n\t// Determine if we should use Windows/PowerShell behavior in WSL.\n\t// We only use Windows integration if PowerShell is actually accessible.\n\t// This allows the package to work in sandboxed WSL environments where Windows access is restricted.\n\tlet shouldUseWindowsInWsl = false;\n\tif (isWsl && !isInsideContainer() && !isInSsh && !app) {\n\t\tshouldUseWindowsInWsl = await canAccessPowerShell();\n\t}\n\n\tif (platform === 'darwin') {\n\t\tcommand = 'open';\n\n\t\tif (options.wait) {\n\t\t\tcliArguments.push('--wait-apps');\n\t\t}\n\n\t\tif (options.background) {\n\t\t\tcliArguments.push('--background');\n\t\t}\n\n\t\tif (options.newInstance) {\n\t\t\tcliArguments.push('--new');\n\t\t}\n\n\t\tif (app) {\n\t\t\tcliArguments.push('-a', app);\n\t\t}\n\t} else if (platform === 'win32' || shouldUseWindowsInWsl) {\n\t\tcommand = await powerShellPath();\n\n\t\tcliArguments.push(...executePowerShell.argumentsPrefix);\n\n\t\tif (!isWsl) {\n\t\t\tchildProcessOptions.windowsVerbatimArguments = true;\n\t\t}\n\n\t\t// Convert WSL Linux paths to Windows paths\n\t\tif (isWsl && options.target) {\n\t\t\toptions.target = await convertWslPathToWindows(options.target);\n\t\t}\n\n\t\t// Suppress PowerShell progress messages that are written to stderr\n\t\tconst encodedArguments = ['$ProgressPreference = \\'SilentlyContinue\\';', 'Start'];\n\n\t\tif (options.wait) {\n\t\t\tencodedArguments.push('-Wait');\n\t\t}\n\n\t\tif (app) {\n\t\t\tencodedArguments.push(executePowerShell.escapeArgument(app));\n\t\t\tif (options.target) {\n\t\t\t\tappArguments.push(options.target);\n\t\t\t}\n\t\t} else if (options.target) {\n\t\t\tencodedArguments.push(executePowerShell.escapeArgument(options.target));\n\t\t}\n\n\t\tif (appArguments.length > 0) {\n\t\t\tappArguments = appArguments.map(argument => executePowerShell.escapeArgument(argument));\n\t\t\tencodedArguments.push('-ArgumentList', appArguments.join(','));\n\t\t}\n\n\t\t// Using Base64-encoded command, accepted by PowerShell, to allow special characters.\n\t\toptions.target = executePowerShell.encodeCommand(encodedArguments.join(' '));\n\n\t\tif (!options.wait) {\n\t\t\t// PowerShell will keep the parent process alive unless stdio is ignored.\n\t\t\tchildProcessOptions.stdio = 'ignore';\n\t\t}\n\t} else {\n\t\tif (app) {\n\t\t\tcommand = app;\n\t\t} else {\n\t\t\t// When bundled by Webpack, there's no actual package file path and no local `xdg-open`.\n\t\t\tconst isBundled = !__dirname || __dirname === '/';\n\n\t\t\t// Check if local `xdg-open` exists and is executable.\n\t\t\tlet exeLocalXdgOpen = false;\n\t\t\ttry {\n\t\t\t\tawait fs.access(localXdgOpenPath, fsConstants.X_OK);\n\t\t\t\texeLocalXdgOpen = true;\n\t\t\t} catch {}\n\n\t\t\tconst useSystemXdgOpen = process.versions.electron\n\t\t\t\t?? (platform === 'android' || isBundled || !exeLocalXdgOpen);\n\t\t\tcommand = useSystemXdgOpen ? 'xdg-open' : localXdgOpenPath;\n\t\t}\n\n\t\tif (appArguments.length > 0) {\n\t\t\tcliArguments.push(...appArguments);\n\t\t}\n\n\t\tif (!options.wait) {\n\t\t\t// `xdg-open` will block the process unless stdio is ignored\n\t\t\t// and it's detached from the parent even if it's unref'd.\n\t\t\tchildProcessOptions.stdio = 'ignore';\n\t\t\tchildProcessOptions.detached = true;\n\t\t}\n\t}\n\n\tif (platform === 'darwin' && appArguments.length > 0) {\n\t\tcliArguments.push('--args', ...appArguments);\n\t}\n\n\t// IMPORTANT: On macOS, the target MUST come AFTER '--args'.\n\t// When using --args, ALL following arguments are passed to the app.\n\t// Example: open -a \"chrome\" --args --incognito https://site.com\n\t// This passes BOTH --incognito AND https://site.com to Chrome.\n\t// Without this order, Chrome won't open in incognito. See #332.\n\tif (options.target) {\n\t\tcliArguments.push(options.target);\n\t}\n\n\tconst subprocess = childProcess.spawn(command, cliArguments, childProcessOptions);\n\n\tif (options.wait) {\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tsubprocess.once('error', reject);\n\n\t\t\tsubprocess.once('close', exitCode => {\n\t\t\t\tif (!options.allowNonzeroExitCode && exitCode !== 0) {\n\t\t\t\t\treject(new Error(`Exited with code ${exitCode}`));\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tresolve(subprocess);\n\t\t\t});\n\t\t});\n\t}\n\n\t// When we're in a fallback attempt, we need to detect launch failures before trying the next app.\n\t// Wait for the close event to check the exit code before unreffing.\n\t// The launcher (open/xdg-open/PowerShell) exits quickly (~10-30ms) even on success.\n\tif (isFallbackAttempt) {\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tsubprocess.once('error', reject);\n\n\t\t\tsubprocess.once('spawn', () => {\n\t\t\t\t// Keep error handler active for post-spawn errors\n\t\t\t\tsubprocess.once('close', exitCode => {\n\t\t\t\t\tsubprocess.off('error', reject);\n\n\t\t\t\t\tif (exitCode !== 0) {\n\t\t\t\t\t\treject(new Error(`Exited with code ${exitCode}`));\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tsubprocess.unref();\n\t\t\t\t\tresolve(subprocess);\n\t\t\t\t});\n\t\t\t});\n\t\t});\n\t}\n\n\tsubprocess.unref();\n\n\t// Handle spawn errors before the caller can attach listeners.\n\t// This prevents unhandled error events from crashing the process.\n\treturn new Promise((resolve, reject) => {\n\t\tsubprocess.once('error', reject);\n\n\t\t// Wait for the subprocess to spawn before resolving.\n\t\t// This ensures the process is established before the caller continues,\n\t\t// preventing issues when process.exit() is called immediately after.\n\t\tsubprocess.once('spawn', () => {\n\t\t\tsubprocess.off('error', reject);\n\t\t\tresolve(subprocess);\n\t\t});\n\t});\n};\n\nconst open = (target, options) => {\n\tif (typeof target !== 'string') {\n\t\tthrow new TypeError('Expected a `target`');\n\t}\n\n\treturn baseOpen({\n\t\t...options,\n\t\ttarget,\n\t});\n};\n\nexport const openApp = (name, options) => {\n\tif (typeof name !== 'string' && !Array.isArray(name)) {\n\t\tthrow new TypeError('Expected a valid `name`');\n\t}\n\n\tconst {arguments: appArguments = []} = options ?? {};\n\tif (appArguments !== undefined && appArguments !== null && !Array.isArray(appArguments)) {\n\t\tthrow new TypeError('Expected `appArguments` as Array type');\n\t}\n\n\treturn baseOpen({\n\t\t...options,\n\t\tapp: {\n\t\t\tname,\n\t\t\targuments: appArguments,\n\t\t},\n\t});\n};\n\nfunction detectArchBinary(binary) {\n\tif (typeof binary === 'string' || Array.isArray(binary)) {\n\t\treturn binary;\n\t}\n\n\tconst {[arch]: archBinary} = binary;\n\n\tif (!archBinary) {\n\t\tthrow new Error(`${arch} is not supported`);\n\t}\n\n\treturn archBinary;\n}\n\nfunction detectPlatformBinary({[platform]: platformBinary}, {wsl} = {}) {\n\tif (wsl && isWsl) {\n\t\treturn detectArchBinary(wsl);\n\t}\n\n\tif (!platformBinary) {\n\t\tthrow new Error(`${platform} is not supported`);\n\t}\n\n\treturn detectArchBinary(platformBinary);\n}\n\nexport const apps = {\n\tbrowser: 'browser',\n\tbrowserPrivate: 'browserPrivate',\n};\n\ndefineLazyProperty(apps, 'chrome', () => detectPlatformBinary({\n\tdarwin: 'google chrome',\n\twin32: 'chrome',\n\t// `chromium-browser` is the older deb package name used by Ubuntu/Debian before snap.\n\tlinux: ['google-chrome', 'google-chrome-stable', 'chromium', 'chromium-browser'],\n}, {\n\twsl: {\n\t\tia32: '/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe',\n\t\tx64: ['/mnt/c/Program Files/Google/Chrome/Application/chrome.exe', '/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe'],\n\t},\n}));\n\ndefineLazyProperty(apps, 'brave', () => detectPlatformBinary({\n\tdarwin: 'brave browser',\n\twin32: 'brave',\n\tlinux: ['brave-browser', 'brave'],\n}, {\n\twsl: {\n\t\tia32: '/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe',\n\t\tx64: ['/mnt/c/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe', '/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe'],\n\t},\n}));\n\ndefineLazyProperty(apps, 'firefox', () => detectPlatformBinary({\n\tdarwin: 'firefox',\n\twin32: String.raw`C:\\Program Files\\Mozilla Firefox\\firefox.exe`,\n\tlinux: 'firefox',\n}, {\n\twsl: '/mnt/c/Program Files/Mozilla Firefox/firefox.exe',\n}));\n\ndefineLazyProperty(apps, 'edge', () => detectPlatformBinary({\n\tdarwin: 'microsoft edge',\n\twin32: 'msedge',\n\tlinux: ['microsoft-edge', 'microsoft-edge-dev'],\n}, {\n\twsl: '/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe',\n}));\n\ndefineLazyProperty(apps, 'safari', () => detectPlatformBinary({\n\tdarwin: 'Safari',\n}));\n\nexport default open;\n","import open from 'open'\n\nimport {\n pollDeviceToken,\n requestDeviceCode,\n toCredentials,\n} from '../../core/auth'\nimport { writeCredentials } from '../../core/config-store'\nimport { emitInfo, emitSuccess, type OutputOptions } from '../../core/output'\nimport { type GlobalFlags, resolveContext } from '../internal/shared'\n\nexport async function run(flags: GlobalFlags, out: OutputOptions) {\n const ctx = await resolveContext(flags, out)\n emitInfo(`probing ${ctx.apiUrl}…`, out)\n emitInfo(`API base: ${ctx.apiBase}`, out)\n\n const code = await requestDeviceCode(ctx.authBase, ctx.clientId)\n emitInfo(`visit: ${code.verification_uri}`, out)\n emitInfo(`code: ${code.user_code}`, out)\n emitInfo(`expires in ${code.expires_in}s`, out)\n\n if (out.json) {\n process.stdout.write(\n `${JSON.stringify({\n ok: true,\n data: {\n verification_uri: code.verification_uri,\n verification_uri_complete: code.verification_uri_complete,\n user_code: code.user_code,\n expires_in: code.expires_in,\n interval: code.interval,\n },\n })}\\n`,\n )\n } else if (!flags.quiet && code.verification_uri_complete) {\n void open(code.verification_uri_complete).catch(() => undefined)\n }\n\n const token = await pollDeviceToken(\n ctx.authBase,\n ctx.clientId,\n code.device_code,\n {\n intervalSec: code.interval,\n expiresInSec: code.expires_in,\n onTick: (state) => {\n if (state === 'slow_down')\n emitInfo('slow_down — increasing interval', out)\n },\n },\n )\n const cred = toCredentials(token)\n await writeCredentials(cred)\n emitInfo('authorized', out)\n emitSuccess(\n {\n user: cred.user ?? null,\n expires_at: cred.expires_at,\n },\n out,\n )\n}\n"],"x_google_ignoreList":[0,1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,GAAG;CAE9C,IAAI,IAAI,MACN,QAAQ,OAAO,MACb,GAAG,KAAK,UAAU;EAChB,IAAI;EACJ,MAAM;GACJ,kBAAkB,KAAK;GACvB,2BAA2B,KAAK;GAChC,WAAW,KAAK;GAChB,YAAY,KAAK;GACjB,UAAU,KAAK;EACjB;CACF,CAAC,EAAE,GACL;MACK,IAAI,CAAC,MAAM,SAAS,KAAK,2BAC9B,KAAU,KAAK,yBAAyB,EAAE,YAAY,KAAA,CAAS;CAgBjE,MAAM,OAAO,cAAc,MAbP,gBAClB,IAAI,UACJ,IAAI,UACJ,KAAK,aACL;EACE,aAAa,KAAK;EAClB,cAAc,KAAK;EACnB,SAAS,UAAU;GACjB,IAAI,UAAU,aACZ,SAAS,mCAAmC,GAAG;EACnD;CACF,CACF,CACgC;CAChC,MAAM,iBAAiB,IAAI;CAC3B,SAAS,cAAc,GAAG;CAC1B,YACE;EACE,MAAM,KAAK,QAAQ;EACnB,YAAY,KAAK;CACnB,GACA,GACF;AACF"}
1
+ {"version":3,"file":"login-bZx4HaVs.mjs","names":["process","execFile","powerShellPath","process","execFile","fs","fsConstants","isWsl","windowsPowerShellPath","execFileAsync","process","execFileAsync","process","execFileAsync","defaultBrowser","process","windows","process","process","isWsl","fs","fsConstants"],"sources":["../../../node_modules/.pnpm/is-docker@3.0.0/node_modules/is-docker/index.js","../../../node_modules/.pnpm/is-inside-container@1.0.0/node_modules/is-inside-container/index.js","../../../node_modules/.pnpm/is-wsl@3.1.1/node_modules/is-wsl/index.js","../../../node_modules/.pnpm/powershell-utils@0.1.0/node_modules/powershell-utils/index.js","../../../node_modules/.pnpm/wsl-utils@0.3.1/node_modules/wsl-utils/utilities.js","../../../node_modules/.pnpm/wsl-utils@0.3.1/node_modules/wsl-utils/index.js","../../../node_modules/.pnpm/define-lazy-prop@3.0.0/node_modules/define-lazy-prop/index.js","../../../node_modules/.pnpm/default-browser-id@5.0.1/node_modules/default-browser-id/index.js","../../../node_modules/.pnpm/run-applescript@7.1.0/node_modules/run-applescript/index.js","../../../node_modules/.pnpm/bundle-name@4.1.0/node_modules/bundle-name/index.js","../../../node_modules/.pnpm/default-browser@5.5.0/node_modules/default-browser/windows.js","../../../node_modules/.pnpm/default-browser@5.5.0/node_modules/default-browser/index.js","../../../node_modules/.pnpm/is-in-ssh@1.0.0/node_modules/is-in-ssh/index.js","../../../node_modules/.pnpm/open@11.0.0/node_modules/open/index.js","../src/commands/auth/login.ts"],"sourcesContent":["import fs from 'node:fs';\n\nlet isDockerCached;\n\nfunction hasDockerEnv() {\n\ttry {\n\t\tfs.statSync('/.dockerenv');\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n}\n\nfunction hasDockerCGroup() {\n\ttry {\n\t\treturn fs.readFileSync('/proc/self/cgroup', 'utf8').includes('docker');\n\t} catch {\n\t\treturn false;\n\t}\n}\n\nexport default function isDocker() {\n\t// TODO: Use `??=` when targeting Node.js 16.\n\tif (isDockerCached === undefined) {\n\t\tisDockerCached = hasDockerEnv() || hasDockerCGroup();\n\t}\n\n\treturn isDockerCached;\n}\n","import fs from 'node:fs';\nimport isDocker from 'is-docker';\n\nlet cachedResult;\n\n// Podman detection\nconst hasContainerEnv = () => {\n\ttry {\n\t\tfs.statSync('/run/.containerenv');\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n};\n\nexport default function isInsideContainer() {\n\t// TODO: Use `??=` when targeting Node.js 16.\n\tif (cachedResult === undefined) {\n\t\tcachedResult = hasContainerEnv() || isDocker();\n\t}\n\n\treturn cachedResult;\n}\n","import process from 'node:process';\nimport os from 'node:os';\nimport fs from 'node:fs';\nimport isInsideContainer from 'is-inside-container';\n\nconst isWsl = () => {\n\tif (process.platform !== 'linux') {\n\t\treturn false;\n\t}\n\n\tif (os.release().toLowerCase().includes('microsoft')) {\n\t\tif (isInsideContainer()) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t}\n\n\ttry {\n\t\tif (fs.readFileSync('/proc/version', 'utf8').toLowerCase().includes('microsoft')) {\n\t\t\treturn !isInsideContainer();\n\t\t}\n\t} catch {}\n\n\t// Fallback for custom kernels: check WSL-specific paths.\n\tif (\n\t\tfs.existsSync('/proc/sys/fs/binfmt_misc/WSLInterop')\n\t\t|| fs.existsSync('/run/WSL')\n\t) {\n\t\treturn !isInsideContainer();\n\t}\n\n\treturn false;\n};\n\nexport default process.env.__IS_WSL_TEST__ ? isWsl : isWsl();\n","import process from 'node:process';\nimport {Buffer} from 'node:buffer';\nimport {promisify} from 'node:util';\nimport childProcess from 'node:child_process';\nimport fs, {constants as fsConstants} from 'node:fs/promises';\n\nconst execFile = promisify(childProcess.execFile);\n\nexport const powerShellPath = () => `${process.env.SYSTEMROOT || process.env.windir || String.raw`C:\\Windows`}\\\\System32\\\\WindowsPowerShell\\\\v1.0\\\\powershell.exe`;\n\n// Cache for PowerShell accessibility check\nlet canAccessCache;\n\nexport const canAccessPowerShell = async () => {\n\tcanAccessCache ??= (async () => {\n\t\ttry {\n\t\t\tawait fs.access(powerShellPath(), fsConstants.X_OK);\n\t\t\treturn true;\n\t\t} catch {\n\t\t\treturn false;\n\t\t}\n\t})();\n\n\treturn canAccessCache;\n};\n\nexport const executePowerShell = async (command, options = {}) => {\n\tconst {\n\t\tpowerShellPath: psPath,\n\t\t...execFileOptions\n\t} = options;\n\n\tconst encodedCommand = executePowerShell.encodeCommand(command);\n\n\treturn execFile(\n\t\tpsPath ?? powerShellPath(),\n\t\t[\n\t\t\t...executePowerShell.argumentsPrefix,\n\t\t\tencodedCommand,\n\t\t],\n\t\t{\n\t\t\tencoding: 'utf8',\n\t\t\t...execFileOptions,\n\t\t},\n\t);\n};\n\nexecutePowerShell.argumentsPrefix = [\n\t'-NoProfile',\n\t'-NonInteractive',\n\t'-ExecutionPolicy',\n\t'Bypass',\n\t'-EncodedCommand',\n];\n\nexecutePowerShell.encodeCommand = command => Buffer.from(command, 'utf16le').toString('base64');\n\nexecutePowerShell.escapeArgument = value => `'${String(value).replaceAll('\\'', '\\'\\'')}'`;\n","export function parseMountPointFromConfig(content) {\n\tfor (const line of content.split('\\n')) {\n\t\t// Skip comment lines\n\t\tif (/^\\s*#/.test(line)) {\n\t\t\tcontinue;\n\t\t}\n\n\t\t// Match root at start of line (after optional whitespace)\n\t\tconst match = /^\\s*root\\s*=\\s*(?<mountPoint>\"[^\"]*\"|'[^']*'|[^#]*)/.exec(line);\n\t\tif (!match) {\n\t\t\tcontinue;\n\t\t}\n\n\t\treturn match.groups.mountPoint\n\t\t\t.trim()\n\t\t\t// Strip surrounding quotes\n\t\t\t.replaceAll(/^[\"']|[\"']$/g, '');\n\t}\n}\n","import {promisify} from 'node:util';\nimport childProcess from 'node:child_process';\nimport fs, {constants as fsConstants} from 'node:fs/promises';\nimport isWsl from 'is-wsl';\nimport {powerShellPath as windowsPowerShellPath, executePowerShell} from 'powershell-utils';\nimport {parseMountPointFromConfig} from './utilities.js';\n\nconst execFile = promisify(childProcess.execFile);\n\nexport const wslDrivesMountPoint = (() => {\n\t// Default value for \"root\" param\n\t// according to https://docs.microsoft.com/en-us/windows/wsl/wsl-config\n\tconst defaultMountPoint = '/mnt/';\n\n\tlet mountPoint;\n\n\treturn async function () {\n\t\tif (mountPoint) {\n\t\t\t// Return memoized mount point value\n\t\t\treturn mountPoint;\n\t\t}\n\n\t\tconst configFilePath = '/etc/wsl.conf';\n\n\t\tlet isConfigFileExists = false;\n\t\ttry {\n\t\t\tawait fs.access(configFilePath, fsConstants.F_OK);\n\t\t\tisConfigFileExists = true;\n\t\t} catch {}\n\n\t\tif (!isConfigFileExists) {\n\t\t\treturn defaultMountPoint;\n\t\t}\n\n\t\tconst configContent = await fs.readFile(configFilePath, {encoding: 'utf8'});\n\t\tconst parsedMountPoint = parseMountPointFromConfig(configContent);\n\n\t\tif (parsedMountPoint === undefined) {\n\t\t\treturn defaultMountPoint;\n\t\t}\n\n\t\tmountPoint = parsedMountPoint;\n\t\tmountPoint = mountPoint.endsWith('/') ? mountPoint : `${mountPoint}/`;\n\n\t\treturn mountPoint;\n\t};\n})();\n\nexport const powerShellPathFromWsl = async () => {\n\tconst mountPoint = await wslDrivesMountPoint();\n\treturn `${mountPoint}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`;\n};\n\nexport const powerShellPath = isWsl ? powerShellPathFromWsl : windowsPowerShellPath;\n\n// Cache for PowerShell accessibility check\nlet canAccessPowerShellPromise;\n\nexport const canAccessPowerShell = async () => {\n\tcanAccessPowerShellPromise ??= (async () => {\n\t\ttry {\n\t\t\tconst psPath = await powerShellPath();\n\t\t\tawait fs.access(psPath, fsConstants.X_OK);\n\t\t\treturn true;\n\t\t} catch {\n\t\t\t// PowerShell is not accessible (either doesn't exist, no execute permission, or other error)\n\t\t\treturn false;\n\t\t}\n\t})();\n\n\treturn canAccessPowerShellPromise;\n};\n\nexport const wslDefaultBrowser = async () => {\n\tconst psPath = await powerShellPath();\n\tconst command = String.raw`(Get-ItemProperty -Path \"HKCU:\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice\").ProgId`;\n\n\tconst {stdout} = await executePowerShell(command, {powerShellPath: psPath});\n\n\treturn stdout.trim();\n};\n\nexport const convertWslPathToWindows = async path => {\n\t// Don't convert URLs\n\tif (/^[a-z]+:\\/\\//i.test(path)) {\n\t\treturn path;\n\t}\n\n\ttry {\n\t\tconst {stdout} = await execFile('wslpath', ['-aw', path], {encoding: 'utf8'});\n\t\treturn stdout.trim();\n\t} catch {\n\t\t// If wslpath fails, return the original path\n\t\treturn path;\n\t}\n};\n\nexport {default as isWsl} from 'is-wsl';\n","export default function defineLazyProperty(object, propertyName, valueGetter) {\n\tconst define = value => Object.defineProperty(object, propertyName, {value, enumerable: true, writable: true});\n\n\tObject.defineProperty(object, propertyName, {\n\t\tconfigurable: true,\n\t\tenumerable: true,\n\t\tget() {\n\t\t\tconst result = valueGetter();\n\t\t\tdefine(result);\n\t\t\treturn result;\n\t\t},\n\t\tset(value) {\n\t\t\tdefine(value);\n\t\t}\n\t});\n\n\treturn object;\n}\n","import {promisify} from 'node:util';\nimport process from 'node:process';\nimport {execFile} from 'node:child_process';\n\nconst execFileAsync = promisify(execFile);\n\nexport default async function defaultBrowserId() {\n\tif (process.platform !== 'darwin') {\n\t\tthrow new Error('macOS only');\n\t}\n\n\tconst {stdout} = await execFileAsync('defaults', ['read', 'com.apple.LaunchServices/com.apple.launchservices.secure', 'LSHandlers']);\n\n\t// `(?!-)` is to prevent matching `LSHandlerRoleAll = \"-\";`.\n\tconst match = /LSHandlerRoleAll = \"(?!-)(?<id>[^\"]+?)\";\\s+?LSHandlerURLScheme = (?:http|https);/.exec(stdout);\n\n\tconst browserId = match?.groups.id ?? 'com.apple.Safari';\n\n\t// Correct the case for Safari's bundle identifier\n\tif (browserId === 'com.apple.safari') {\n\t\treturn 'com.apple.Safari';\n\t}\n\n\treturn browserId;\n}\n","import process from 'node:process';\nimport {promisify} from 'node:util';\nimport {execFile, execFileSync} from 'node:child_process';\n\nconst execFileAsync = promisify(execFile);\n\nexport async function runAppleScript(script, {humanReadableOutput = true, signal} = {}) {\n\tif (process.platform !== 'darwin') {\n\t\tthrow new Error('macOS only');\n\t}\n\n\tconst outputArguments = humanReadableOutput ? [] : ['-ss'];\n\n\tconst execOptions = {};\n\tif (signal) {\n\t\texecOptions.signal = signal;\n\t}\n\n\tconst {stdout} = await execFileAsync('osascript', ['-e', script, outputArguments], execOptions);\n\treturn stdout.trim();\n}\n\nexport function runAppleScriptSync(script, {humanReadableOutput = true} = {}) {\n\tif (process.platform !== 'darwin') {\n\t\tthrow new Error('macOS only');\n\t}\n\n\tconst outputArguments = humanReadableOutput ? [] : ['-ss'];\n\n\tconst stdout = execFileSync('osascript', ['-e', script, ...outputArguments], {\n\t\tencoding: 'utf8',\n\t\tstdio: ['ignore', 'pipe', 'ignore'],\n\t\ttimeout: 500,\n\t});\n\n\treturn stdout.trim();\n}\n","import {runAppleScript} from 'run-applescript';\n\nexport default async function bundleName(bundleId) {\n\treturn runAppleScript(`tell application \"Finder\" to set app_path to application file id \"${bundleId}\" as string\\ntell application \"System Events\" to get value of property list item \"CFBundleName\" of property list file (app_path & \":Contents:Info.plist\")`);\n}\n","import {promisify} from 'node:util';\nimport {execFile} from 'node:child_process';\n\nconst execFileAsync = promisify(execFile);\n\n// TODO: Fix the casing of bundle identifiers in the next major version.\n\n// Windows doesn't have browser IDs in the same way macOS/Linux does so we give fake\n// ones that look real and match the macOS/Linux versions for cross-platform apps.\nconst windowsBrowserProgIds = {\n\tMSEdgeHTM: {name: 'Edge', id: 'com.microsoft.edge'}, // The missing `L` is correct.\n\tMSEdgeBHTML: {name: 'Edge Beta', id: 'com.microsoft.edge.beta'},\n\tMSEdgeDHTML: {name: 'Edge Dev', id: 'com.microsoft.edge.dev'},\n\tAppXq0fevzme2pys62n3e0fbqa7peapykr8v: {name: 'Edge', id: 'com.microsoft.edge.old'},\n\tChromeHTML: {name: 'Chrome', id: 'com.google.chrome'},\n\tChromeBHTML: {name: 'Chrome Beta', id: 'com.google.chrome.beta'},\n\tChromeDHTML: {name: 'Chrome Dev', id: 'com.google.chrome.dev'},\n\tChromiumHTM: {name: 'Chromium', id: 'org.chromium.Chromium'},\n\tBraveHTML: {name: 'Brave', id: 'com.brave.Browser'},\n\tBraveBHTML: {name: 'Brave Beta', id: 'com.brave.Browser.beta'},\n\tBraveDHTML: {name: 'Brave Dev', id: 'com.brave.Browser.dev'},\n\tBraveSSHTM: {name: 'Brave Nightly', id: 'com.brave.Browser.nightly'},\n\tFirefoxURL: {name: 'Firefox', id: 'org.mozilla.firefox'},\n\tOperaStable: {name: 'Opera', id: 'com.operasoftware.Opera'},\n\tVivaldiHTM: {name: 'Vivaldi', id: 'com.vivaldi.Vivaldi'},\n\t'IE.HTTP': {name: 'Internet Explorer', id: 'com.microsoft.ie'},\n};\n\nexport const _windowsBrowserProgIdMap = new Map(Object.entries(windowsBrowserProgIds));\n\nexport class UnknownBrowserError extends Error {}\n\nexport default async function defaultBrowser(_execFileAsync = execFileAsync) {\n\tconst {stdout} = await _execFileAsync('reg', [\n\t\t'QUERY',\n\t\t' HKEY_CURRENT_USER\\\\Software\\\\Microsoft\\\\Windows\\\\Shell\\\\Associations\\\\UrlAssociations\\\\http\\\\UserChoice',\n\t\t'/v',\n\t\t'ProgId',\n\t]);\n\n\tconst match = /ProgId\\s*REG_SZ\\s*(?<id>\\S+)/.exec(stdout);\n\tif (!match) {\n\t\tthrow new UnknownBrowserError(`Cannot find Windows browser in stdout: ${JSON.stringify(stdout)}`);\n\t}\n\n\tconst {id} = match.groups;\n\n\t// Windows can append a hash suffix to ProgIds using a dot or hyphen\n\t// (e.g., `ChromeHTML.ABC123`, `FirefoxURL-6F193CCC56814779`).\n\t// Try exact match first, then try without the suffix.\n\tconst dotIndex = id.lastIndexOf('.');\n\tconst hyphenIndex = id.lastIndexOf('-');\n\tconst baseIdByDot = dotIndex === -1 ? undefined : id.slice(0, dotIndex);\n\tconst baseIdByHyphen = hyphenIndex === -1 ? undefined : id.slice(0, hyphenIndex);\n\n\treturn windowsBrowserProgIds[id] ?? windowsBrowserProgIds[baseIdByDot] ?? windowsBrowserProgIds[baseIdByHyphen] ?? {name: id, id};\n}\n","import {promisify} from 'node:util';\nimport process from 'node:process';\nimport {execFile} from 'node:child_process';\nimport defaultBrowserId from 'default-browser-id';\nimport bundleName from 'bundle-name';\nimport windows from './windows.js';\n\nexport {_windowsBrowserProgIdMap} from './windows.js';\n\nconst execFileAsync = promisify(execFile);\n\n// Inlined: https://github.com/sindresorhus/titleize/blob/main/index.js\nconst titleize = string => string.toLowerCase().replaceAll(/(?:^|\\s|-)\\S/g, x => x.toUpperCase());\n\nexport default async function defaultBrowser() {\n\tif (process.platform === 'darwin') {\n\t\tconst id = await defaultBrowserId();\n\t\tconst name = await bundleName(id);\n\t\treturn {name, id};\n\t}\n\n\tif (process.platform === 'linux') {\n\t\tconst {stdout} = await execFileAsync('xdg-mime', ['query', 'default', 'x-scheme-handler/http']);\n\t\tconst id = stdout.trim();\n\t\tconst name = titleize(id.replace(/.desktop$/, '').replace('-', ' '));\n\t\treturn {name, id};\n\t}\n\n\tif (process.platform === 'win32') {\n\t\treturn windows();\n\t}\n\n\tthrow new Error('Only macOS, Linux, and Windows are supported');\n}\n","import process from 'node:process';\n\nconst isInSsh = Boolean(process.env.SSH_CONNECTION\n\t|| process.env.SSH_CLIENT\n\t|| process.env.SSH_TTY);\n\nexport default isInSsh;\n","import process from 'node:process';\nimport path from 'node:path';\nimport {fileURLToPath} from 'node:url';\nimport childProcess from 'node:child_process';\nimport fs, {constants as fsConstants} from 'node:fs/promises';\nimport {\n\tisWsl,\n\tpowerShellPath,\n\tconvertWslPathToWindows,\n\tcanAccessPowerShell,\n\twslDefaultBrowser,\n} from 'wsl-utils';\nimport {executePowerShell} from 'powershell-utils';\nimport defineLazyProperty from 'define-lazy-prop';\nimport defaultBrowser, {_windowsBrowserProgIdMap} from 'default-browser';\nimport isInsideContainer from 'is-inside-container';\nimport isInSsh from 'is-in-ssh';\n\nconst fallbackAttemptSymbol = Symbol('fallbackAttempt');\n\n// Path to included `xdg-open`.\nconst __dirname = import.meta.url ? path.dirname(fileURLToPath(import.meta.url)) : '';\nconst localXdgOpenPath = path.join(__dirname, 'xdg-open');\n\nconst {platform, arch} = process;\n\nconst tryEachApp = async (apps, opener) => {\n\tif (apps.length === 0) {\n\t\t// No app was provided\n\t\treturn;\n\t}\n\n\tconst errors = [];\n\n\tfor (const app of apps) {\n\t\ttry {\n\t\t\treturn await opener(app); // eslint-disable-line no-await-in-loop\n\t\t} catch (error) {\n\t\t\terrors.push(error);\n\t\t}\n\t}\n\n\tthrow new AggregateError(errors, 'Failed to open in all supported apps');\n};\n\n// eslint-disable-next-line complexity\nconst baseOpen = async options => {\n\toptions = {\n\t\twait: false,\n\t\tbackground: false,\n\t\tnewInstance: false,\n\t\tallowNonzeroExitCode: false,\n\t\t...options,\n\t};\n\n\tconst isFallbackAttempt = options[fallbackAttemptSymbol] === true;\n\tdelete options[fallbackAttemptSymbol];\n\n\tif (Array.isArray(options.app)) {\n\t\treturn tryEachApp(options.app, singleApp => baseOpen({\n\t\t\t...options,\n\t\t\tapp: singleApp,\n\t\t\t[fallbackAttemptSymbol]: true,\n\t\t}));\n\t}\n\n\tlet {name: app, arguments: appArguments = []} = options.app ?? {};\n\tappArguments = [...appArguments];\n\n\tif (Array.isArray(app)) {\n\t\treturn tryEachApp(app, appName => baseOpen({\n\t\t\t...options,\n\t\t\tapp: {\n\t\t\t\tname: appName,\n\t\t\t\targuments: appArguments,\n\t\t\t},\n\t\t\t[fallbackAttemptSymbol]: true,\n\t\t}));\n\t}\n\n\tif (app === 'browser' || app === 'browserPrivate') {\n\t\t// IDs from default-browser for macOS and windows are the same.\n\t\t// IDs are lowercased to increase chances of a match.\n\t\tconst ids = {\n\t\t\t'com.google.chrome': 'chrome',\n\t\t\t'google-chrome.desktop': 'chrome',\n\t\t\t'com.brave.browser': 'brave',\n\t\t\t'org.mozilla.firefox': 'firefox',\n\t\t\t'firefox.desktop': 'firefox',\n\t\t\t'com.microsoft.msedge': 'edge',\n\t\t\t'com.microsoft.edge': 'edge',\n\t\t\t'com.microsoft.edgemac': 'edge',\n\t\t\t'microsoft-edge.desktop': 'edge',\n\t\t\t'com.apple.safari': 'safari',\n\t\t};\n\n\t\t// Incognito flags for each browser in `apps`.\n\t\tconst flags = {\n\t\t\tchrome: '--incognito',\n\t\t\tbrave: '--incognito',\n\t\t\tfirefox: '--private-window',\n\t\t\tedge: '--inPrivate',\n\t\t\t// Safari doesn't support private mode via command line\n\t\t};\n\n\t\tlet browser;\n\t\tif (isWsl) {\n\t\t\tconst progId = await wslDefaultBrowser();\n\t\t\tconst browserInfo = _windowsBrowserProgIdMap.get(progId);\n\t\t\tbrowser = browserInfo ?? {};\n\t\t} else {\n\t\t\tbrowser = await defaultBrowser();\n\t\t}\n\n\t\tif (browser.id in ids) {\n\t\t\tconst browserName = ids[browser.id.toLowerCase()];\n\n\t\t\tif (app === 'browserPrivate') {\n\t\t\t\t// Safari doesn't support private mode via command line\n\t\t\t\tif (browserName === 'safari') {\n\t\t\t\t\tthrow new Error('Safari doesn\\'t support opening in private mode via command line');\n\t\t\t\t}\n\n\t\t\t\tappArguments.push(flags[browserName]);\n\t\t\t}\n\n\t\t\treturn baseOpen({\n\t\t\t\t...options,\n\t\t\t\tapp: {\n\t\t\t\t\tname: apps[browserName],\n\t\t\t\t\targuments: appArguments,\n\t\t\t\t},\n\t\t\t});\n\t\t}\n\n\t\tthrow new Error(`${browser.name} is not supported as a default browser`);\n\t}\n\n\tlet command;\n\tconst cliArguments = [];\n\tconst childProcessOptions = {};\n\n\t// Determine if we should use Windows/PowerShell behavior in WSL.\n\t// We only use Windows integration if PowerShell is actually accessible.\n\t// This allows the package to work in sandboxed WSL environments where Windows access is restricted.\n\tlet shouldUseWindowsInWsl = false;\n\tif (isWsl && !isInsideContainer() && !isInSsh && !app) {\n\t\tshouldUseWindowsInWsl = await canAccessPowerShell();\n\t}\n\n\tif (platform === 'darwin') {\n\t\tcommand = 'open';\n\n\t\tif (options.wait) {\n\t\t\tcliArguments.push('--wait-apps');\n\t\t}\n\n\t\tif (options.background) {\n\t\t\tcliArguments.push('--background');\n\t\t}\n\n\t\tif (options.newInstance) {\n\t\t\tcliArguments.push('--new');\n\t\t}\n\n\t\tif (app) {\n\t\t\tcliArguments.push('-a', app);\n\t\t}\n\t} else if (platform === 'win32' || shouldUseWindowsInWsl) {\n\t\tcommand = await powerShellPath();\n\n\t\tcliArguments.push(...executePowerShell.argumentsPrefix);\n\n\t\tif (!isWsl) {\n\t\t\tchildProcessOptions.windowsVerbatimArguments = true;\n\t\t}\n\n\t\t// Convert WSL Linux paths to Windows paths\n\t\tif (isWsl && options.target) {\n\t\t\toptions.target = await convertWslPathToWindows(options.target);\n\t\t}\n\n\t\t// Suppress PowerShell progress messages that are written to stderr\n\t\tconst encodedArguments = ['$ProgressPreference = \\'SilentlyContinue\\';', 'Start'];\n\n\t\tif (options.wait) {\n\t\t\tencodedArguments.push('-Wait');\n\t\t}\n\n\t\tif (app) {\n\t\t\tencodedArguments.push(executePowerShell.escapeArgument(app));\n\t\t\tif (options.target) {\n\t\t\t\tappArguments.push(options.target);\n\t\t\t}\n\t\t} else if (options.target) {\n\t\t\tencodedArguments.push(executePowerShell.escapeArgument(options.target));\n\t\t}\n\n\t\tif (appArguments.length > 0) {\n\t\t\tappArguments = appArguments.map(argument => executePowerShell.escapeArgument(argument));\n\t\t\tencodedArguments.push('-ArgumentList', appArguments.join(','));\n\t\t}\n\n\t\t// Using Base64-encoded command, accepted by PowerShell, to allow special characters.\n\t\toptions.target = executePowerShell.encodeCommand(encodedArguments.join(' '));\n\n\t\tif (!options.wait) {\n\t\t\t// PowerShell will keep the parent process alive unless stdio is ignored.\n\t\t\tchildProcessOptions.stdio = 'ignore';\n\t\t}\n\t} else {\n\t\tif (app) {\n\t\t\tcommand = app;\n\t\t} else {\n\t\t\t// When bundled by Webpack, there's no actual package file path and no local `xdg-open`.\n\t\t\tconst isBundled = !__dirname || __dirname === '/';\n\n\t\t\t// Check if local `xdg-open` exists and is executable.\n\t\t\tlet exeLocalXdgOpen = false;\n\t\t\ttry {\n\t\t\t\tawait fs.access(localXdgOpenPath, fsConstants.X_OK);\n\t\t\t\texeLocalXdgOpen = true;\n\t\t\t} catch {}\n\n\t\t\tconst useSystemXdgOpen = process.versions.electron\n\t\t\t\t?? (platform === 'android' || isBundled || !exeLocalXdgOpen);\n\t\t\tcommand = useSystemXdgOpen ? 'xdg-open' : localXdgOpenPath;\n\t\t}\n\n\t\tif (appArguments.length > 0) {\n\t\t\tcliArguments.push(...appArguments);\n\t\t}\n\n\t\tif (!options.wait) {\n\t\t\t// `xdg-open` will block the process unless stdio is ignored\n\t\t\t// and it's detached from the parent even if it's unref'd.\n\t\t\tchildProcessOptions.stdio = 'ignore';\n\t\t\tchildProcessOptions.detached = true;\n\t\t}\n\t}\n\n\tif (platform === 'darwin' && appArguments.length > 0) {\n\t\tcliArguments.push('--args', ...appArguments);\n\t}\n\n\t// IMPORTANT: On macOS, the target MUST come AFTER '--args'.\n\t// When using --args, ALL following arguments are passed to the app.\n\t// Example: open -a \"chrome\" --args --incognito https://site.com\n\t// This passes BOTH --incognito AND https://site.com to Chrome.\n\t// Without this order, Chrome won't open in incognito. See #332.\n\tif (options.target) {\n\t\tcliArguments.push(options.target);\n\t}\n\n\tconst subprocess = childProcess.spawn(command, cliArguments, childProcessOptions);\n\n\tif (options.wait) {\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tsubprocess.once('error', reject);\n\n\t\t\tsubprocess.once('close', exitCode => {\n\t\t\t\tif (!options.allowNonzeroExitCode && exitCode !== 0) {\n\t\t\t\t\treject(new Error(`Exited with code ${exitCode}`));\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tresolve(subprocess);\n\t\t\t});\n\t\t});\n\t}\n\n\t// When we're in a fallback attempt, we need to detect launch failures before trying the next app.\n\t// Wait for the close event to check the exit code before unreffing.\n\t// The launcher (open/xdg-open/PowerShell) exits quickly (~10-30ms) even on success.\n\tif (isFallbackAttempt) {\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tsubprocess.once('error', reject);\n\n\t\t\tsubprocess.once('spawn', () => {\n\t\t\t\t// Keep error handler active for post-spawn errors\n\t\t\t\tsubprocess.once('close', exitCode => {\n\t\t\t\t\tsubprocess.off('error', reject);\n\n\t\t\t\t\tif (exitCode !== 0) {\n\t\t\t\t\t\treject(new Error(`Exited with code ${exitCode}`));\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tsubprocess.unref();\n\t\t\t\t\tresolve(subprocess);\n\t\t\t\t});\n\t\t\t});\n\t\t});\n\t}\n\n\tsubprocess.unref();\n\n\t// Handle spawn errors before the caller can attach listeners.\n\t// This prevents unhandled error events from crashing the process.\n\treturn new Promise((resolve, reject) => {\n\t\tsubprocess.once('error', reject);\n\n\t\t// Wait for the subprocess to spawn before resolving.\n\t\t// This ensures the process is established before the caller continues,\n\t\t// preventing issues when process.exit() is called immediately after.\n\t\tsubprocess.once('spawn', () => {\n\t\t\tsubprocess.off('error', reject);\n\t\t\tresolve(subprocess);\n\t\t});\n\t});\n};\n\nconst open = (target, options) => {\n\tif (typeof target !== 'string') {\n\t\tthrow new TypeError('Expected a `target`');\n\t}\n\n\treturn baseOpen({\n\t\t...options,\n\t\ttarget,\n\t});\n};\n\nexport const openApp = (name, options) => {\n\tif (typeof name !== 'string' && !Array.isArray(name)) {\n\t\tthrow new TypeError('Expected a valid `name`');\n\t}\n\n\tconst {arguments: appArguments = []} = options ?? {};\n\tif (appArguments !== undefined && appArguments !== null && !Array.isArray(appArguments)) {\n\t\tthrow new TypeError('Expected `appArguments` as Array type');\n\t}\n\n\treturn baseOpen({\n\t\t...options,\n\t\tapp: {\n\t\t\tname,\n\t\t\targuments: appArguments,\n\t\t},\n\t});\n};\n\nfunction detectArchBinary(binary) {\n\tif (typeof binary === 'string' || Array.isArray(binary)) {\n\t\treturn binary;\n\t}\n\n\tconst {[arch]: archBinary} = binary;\n\n\tif (!archBinary) {\n\t\tthrow new Error(`${arch} is not supported`);\n\t}\n\n\treturn archBinary;\n}\n\nfunction detectPlatformBinary({[platform]: platformBinary}, {wsl} = {}) {\n\tif (wsl && isWsl) {\n\t\treturn detectArchBinary(wsl);\n\t}\n\n\tif (!platformBinary) {\n\t\tthrow new Error(`${platform} is not supported`);\n\t}\n\n\treturn detectArchBinary(platformBinary);\n}\n\nexport const apps = {\n\tbrowser: 'browser',\n\tbrowserPrivate: 'browserPrivate',\n};\n\ndefineLazyProperty(apps, 'chrome', () => detectPlatformBinary({\n\tdarwin: 'google chrome',\n\twin32: 'chrome',\n\t// `chromium-browser` is the older deb package name used by Ubuntu/Debian before snap.\n\tlinux: ['google-chrome', 'google-chrome-stable', 'chromium', 'chromium-browser'],\n}, {\n\twsl: {\n\t\tia32: '/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe',\n\t\tx64: ['/mnt/c/Program Files/Google/Chrome/Application/chrome.exe', '/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe'],\n\t},\n}));\n\ndefineLazyProperty(apps, 'brave', () => detectPlatformBinary({\n\tdarwin: 'brave browser',\n\twin32: 'brave',\n\tlinux: ['brave-browser', 'brave'],\n}, {\n\twsl: {\n\t\tia32: '/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe',\n\t\tx64: ['/mnt/c/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe', '/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe'],\n\t},\n}));\n\ndefineLazyProperty(apps, 'firefox', () => detectPlatformBinary({\n\tdarwin: 'firefox',\n\twin32: String.raw`C:\\Program Files\\Mozilla Firefox\\firefox.exe`,\n\tlinux: 'firefox',\n}, {\n\twsl: '/mnt/c/Program Files/Mozilla Firefox/firefox.exe',\n}));\n\ndefineLazyProperty(apps, 'edge', () => detectPlatformBinary({\n\tdarwin: 'microsoft edge',\n\twin32: 'msedge',\n\tlinux: ['microsoft-edge', 'microsoft-edge-dev'],\n}, {\n\twsl: '/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe',\n}));\n\ndefineLazyProperty(apps, 'safari', () => detectPlatformBinary({\n\tdarwin: 'Safari',\n}));\n\nexport default open;\n","import open from 'open'\n\nimport {\n pollDeviceToken,\n requestDeviceCode,\n toCredentials,\n} from '../../core/auth'\nimport { emitInfo, emitSuccess, type OutputOptions } from '../../core/output'\nimport {\n getCurrentProfile,\n readProfileConfig,\n setCurrentProfile,\n writeProfileConfig,\n writeProfileCredentials,\n} from '../../core/profile'\nimport { type GlobalFlags, resolveContext } from '../internal/shared'\n\nexport interface LoginOpts {\n production?: boolean\n}\n\nexport async function run(\n flags: GlobalFlags,\n out: OutputOptions,\n opts: LoginOpts = {},\n) {\n const ctx = await resolveContext(flags, out)\n emitInfo(`probing ${ctx.apiUrl}…`, out)\n emitInfo(`API base: ${ctx.apiBase}`, out)\n\n const code = await requestDeviceCode(ctx.authBase, ctx.clientId)\n emitInfo(`visit: ${code.verification_uri}`, out)\n emitInfo(`code: ${code.user_code}`, out)\n emitInfo(`expires in ${code.expires_in}s`, out)\n\n if (out.json) {\n process.stdout.write(\n `${JSON.stringify({\n ok: true,\n data: {\n verification_uri: code.verification_uri,\n verification_uri_complete: code.verification_uri_complete,\n user_code: code.user_code,\n expires_in: code.expires_in,\n interval: code.interval,\n },\n })}\\n`,\n )\n } else if (!flags.quiet && code.verification_uri_complete) {\n void open(code.verification_uri_complete).catch(() => undefined)\n }\n\n const token = await pollDeviceToken(\n ctx.authBase,\n ctx.clientId,\n code.device_code,\n {\n intervalSec: code.interval,\n expiresInSec: code.expires_in,\n onTick: (state) => {\n if (state === 'slow_down')\n emitInfo('slow_down — increasing interval', out)\n },\n },\n )\n const cred = toCredentials(token)\n\n // Determine target profile per spec §3:\n // 1. --profile flag\n // 2. active current profile\n // 3. fresh install → 'default'\n const target =\n flags.profile?.trim() || (await getCurrentProfile()) || 'default'\n\n const existing = await readProfileConfig(target)\n await writeProfileConfig(target, {\n ...existing,\n api_url: ctx.apiUrl,\n api_base: ctx.apiBase,\n auth_base: ctx.authBase,\n api_version: ctx.apiVersion,\n client_id: ctx.clientId,\n ...(opts.production !== undefined\n ? { production: opts.production }\n : existing.production !== undefined\n ? { production: existing.production }\n : {}),\n })\n await writeProfileCredentials(target, cred)\n await setCurrentProfile(target)\n\n emitInfo(`mxs: logged in to profile '${target}'`, out)\n emitSuccess(\n {\n user: cred.user ?? null,\n expires_at: cred.expires_at,\n },\n out,\n )\n}\n"],"x_google_ignoreList":[0,1,2,3,4,5,6,7,8,9,10,11,12,13],"mappings":";;;;;;;;;;;;;;AAEA,IAAI;AAEJ,SAAS,eAAe;CACvB,IAAI;EACH,GAAG,SAAS,aAAa;EACzB,OAAO;CACR,QAAQ;EACP,OAAO;CACR;AACD;AAEA,SAAS,kBAAkB;CAC1B,IAAI;EACH,OAAO,GAAG,aAAa,qBAAq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;MACK,IAAI,CAAC,MAAM,SAAS,KAAK,2BAC9B,KAAU,KAAK,yBAAyB,EAAE,YAAY,KAAA,CAAS;CAgBjE,MAAM,OAAO,cAAc,MAbP,gBAClB,IAAI,UACJ,IAAI,UACJ,KAAK,aACL;EACE,aAAa,KAAK;EAClB,cAAc,KAAK;EACnB,SAAS,UAAU;GACjB,IAAI,UAAU,aACZ,SAAS,mCAAmC,GAAG;EACnD;CACF,CACF,CACgC;CAMhC,MAAM,SACJ,MAAM,SAAS,KAAK,KAAM,MAAM,kBAAkB,KAAM;CAE1D,MAAM,WAAW,MAAM,kBAAkB,MAAM;CAC/C,MAAM,mBAAmB,QAAQ;EAC/B,GAAG;EACH,SAAS,IAAI;EACb,UAAU,IAAI;EACd,WAAW,IAAI;EACf,aAAa,IAAI;EACjB,WAAW,IAAI;EACf,GAAI,KAAK,eAAe,KAAA,IACpB,EAAE,YAAY,KAAK,WAAW,IAC9B,SAAS,eAAe,KAAA,IACtB,EAAE,YAAY,SAAS,WAAW,IAClC,CAAC;CACT,CAAC;CACD,MAAM,wBAAwB,QAAQ,IAAI;CAC1C,MAAM,kBAAkB,MAAM;CAE9B,SAAS,8BAA8B,OAAO,IAAI,GAAG;CACrD,YACE;EACE,MAAM,KAAK,QAAQ;EACnB,YAAY,KAAK;CACnB,GACA,GACF;AACF"}
@@ -0,0 +1,18 @@
1
+ import { c as MxsErrorCode, i as emitSuccess, r as emitInfo, s as MxsError } from "./output-vzequvhd.mjs";
2
+ import { r as getCurrentProfile, t as deleteProfileCredentials } from "./profile-CNe2uWJi.mjs";
3
+ //#region src/commands/auth/logout.ts
4
+ async function run(flags, out) {
5
+ const target = flags.profile?.trim() || await getCurrentProfile() || null;
6
+ if (!target) throw new MxsError({
7
+ code: MxsErrorCode.ProfileNoneActive,
8
+ message: "no active profile to log out of",
9
+ hint: "pass --profile <name> or set an active profile with `mxs profile use <name>`"
10
+ });
11
+ await deleteProfileCredentials(target);
12
+ emitInfo(`mxs: logged out of profile '${target}'`, out);
13
+ emitSuccess({ ok: true }, out);
14
+ }
15
+ //#endregion
16
+ export { run };
17
+
18
+ //# sourceMappingURL=logout-C0Dzitsu.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logout-C0Dzitsu.mjs","names":[],"sources":["../src/commands/auth/logout.ts"],"sourcesContent":["import { MxsError, MxsErrorCode } from '../../core/errors'\nimport { emitInfo, emitSuccess, type OutputOptions } from '../../core/output'\nimport { deleteProfileCredentials, getCurrentProfile } from '../../core/profile'\nimport { type GlobalFlags } from '../internal/shared'\n\nexport async function run(flags: GlobalFlags, out: OutputOptions) {\n const target = flags.profile?.trim() || (await getCurrentProfile()) || null\n\n if (!target) {\n throw new MxsError({\n code: MxsErrorCode.ProfileNoneActive,\n message: 'no active profile to log out of',\n hint: 'pass --profile <name> or set an active profile with `mxs profile use <name>`',\n })\n }\n\n await deleteProfileCredentials(target)\n emitInfo(`mxs: logged out of profile '${target}'`, out)\n emitSuccess({ ok: true }, out)\n}\n"],"mappings":";;;AAKA,eAAsB,IAAI,OAAoB,KAAoB;CAChE,MAAM,SAAS,MAAM,SAAS,KAAK,KAAM,MAAM,kBAAkB,KAAM;CAEvE,IAAI,CAAC,QACH,MAAM,IAAI,SAAS;EACjB,MAAM,aAAa;EACnB,SAAS;EACT,MAAM;CACR,CAAC;CAGH,MAAM,yBAAyB,MAAM;CACrC,SAAS,+BAA+B,OAAO,IAAI,GAAG;CACtD,YAAY,EAAE,IAAI,KAAK,GAAG,GAAG;AAC/B"}
@@ -0,0 +1,33 @@
1
+ import { i as emitSuccess, o as renderTable } from "./output-vzequvhd.mjs";
2
+ import { c as listProfiles, l as readProfileConfig, r as getCurrentProfile } from "./profile-CNe2uWJi.mjs";
3
+ //#region src/commands/profile/ls.ts
4
+ async function run(_flags, out) {
5
+ const [names, current] = await Promise.all([listProfiles(), getCurrentProfile()]);
6
+ const rows = await Promise.all(names.map(async (name) => {
7
+ const cfg = await readProfileConfig(name);
8
+ return {
9
+ current: name === current ? "*" : "",
10
+ name,
11
+ api_url: cfg.api_url ?? "",
12
+ production: cfg.production ? "yes" : "no"
13
+ };
14
+ }));
15
+ if (out.json || out.output === "json") {
16
+ emitSuccess(rows, out);
17
+ return;
18
+ }
19
+ if (rows.length === 0) {
20
+ process.stdout.write("(no profiles)\n");
21
+ return;
22
+ }
23
+ process.stdout.write(`${renderTable(rows, [
24
+ "current",
25
+ "name",
26
+ "api_url",
27
+ "production"
28
+ ])}\n`);
29
+ }
30
+ //#endregion
31
+ export { run };
32
+
33
+ //# sourceMappingURL=ls-wMiTXZPQ.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ls-wMiTXZPQ.mjs","names":[],"sources":["../src/commands/profile/ls.ts"],"sourcesContent":["import { emitSuccess, type OutputOptions, renderTable } from '../../core/output'\nimport {\n getCurrentProfile,\n listProfiles,\n readProfileConfig,\n} from '../../core/profile'\nimport type { GlobalFlags } from '../internal/shared'\n\nexport async function run(_flags: GlobalFlags, out: OutputOptions) {\n const [names, current] = await Promise.all([\n listProfiles(),\n getCurrentProfile(),\n ])\n\n const rows = await Promise.all(\n names.map(async (name) => {\n const cfg = await readProfileConfig(name)\n return {\n current: name === current ? '*' : '',\n name,\n api_url: cfg.api_url ?? '',\n production: cfg.production ? 'yes' : 'no',\n }\n }),\n )\n\n if (out.json || out.output === 'json') {\n emitSuccess(rows, out)\n return\n }\n\n if (rows.length === 0) {\n process.stdout.write('(no profiles)\\n')\n return\n }\n\n process.stdout.write(\n `${renderTable(rows, ['current', 'name', 'api_url', 'production'])}\\n`,\n )\n}\n"],"mappings":";;;AAQA,eAAsB,IAAI,QAAqB,KAAoB;CACjE,MAAM,CAAC,OAAO,WAAW,MAAM,QAAQ,IAAI,CACzC,aAAa,GACb,kBAAkB,CACpB,CAAC;CAED,MAAM,OAAO,MAAM,QAAQ,IACzB,MAAM,IAAI,OAAO,SAAS;EACxB,MAAM,MAAM,MAAM,kBAAkB,IAAI;EACxC,OAAO;GACL,SAAS,SAAS,UAAU,MAAM;GAClC;GACA,SAAS,IAAI,WAAW;GACxB,YAAY,IAAI,aAAa,QAAQ;EACvC;CACF,CAAC,CACH;CAEA,IAAI,IAAI,QAAQ,IAAI,WAAW,QAAQ;EACrC,YAAY,MAAM,GAAG;EACrB;CACF;CAEA,IAAI,KAAK,WAAW,GAAG;EACrB,QAAQ,OAAO,MAAM,iBAAiB;EACtC;CACF;CAEA,QAAQ,OAAO,MACb,GAAG,YAAY,MAAM;EAAC;EAAW;EAAQ;EAAW;CAAY,CAAC,EAAE,GACrE;AACF"}
@@ -0,0 +1,29 @@
1
+ import { c as MxsErrorCode, r as emitInfo, s as MxsError } from "./output-vzequvhd.mjs";
2
+ import { l as readProfileConfig, m as writeProfileConfig, o as getProfileDir, p as validateProfileName } from "./profile-CNe2uWJi.mjs";
3
+ import { promises } from "node:fs";
4
+ //#region src/commands/profile/mark.ts
5
+ async function run(name, opts, _flags, out) {
6
+ validateProfileName(name);
7
+ if (opts.production === void 0) throw new MxsError({
8
+ code: MxsErrorCode.ValidationFailed,
9
+ message: "one of --production or --no-production is required"
10
+ });
11
+ try {
12
+ if (!(await promises.stat(getProfileDir(name))).isDirectory()) throw new Error("not a directory");
13
+ } catch (err) {
14
+ if (err?.code !== "ENOENT" && !(err instanceof MxsError)) throw err;
15
+ throw new MxsError({
16
+ code: MxsErrorCode.ProfileNotFound,
17
+ message: `profile '${name}' does not exist`
18
+ });
19
+ }
20
+ await writeProfileConfig(name, {
21
+ ...await readProfileConfig(name),
22
+ production: opts.production
23
+ });
24
+ emitInfo(`mxs: profile '${name}' marked with ${opts.production ? "--production" : "--no-production"}`, out);
25
+ }
26
+ //#endregion
27
+ export { run };
28
+
29
+ //# sourceMappingURL=mark-Dh9BErsf.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mark-Dh9BErsf.mjs","names":["fs"],"sources":["../src/commands/profile/mark.ts"],"sourcesContent":["import { promises as fs } from 'node:fs'\n\nimport { MxsError, MxsErrorCode } from '../../core/errors'\nimport { emitInfo, type OutputOptions } from '../../core/output'\nimport {\n getProfileDir,\n readProfileConfig,\n validateProfileName,\n writeProfileConfig,\n} from '../../core/profile'\nimport type { GlobalFlags } from '../internal/shared'\n\nexport interface MarkOpts {\n production?: boolean\n}\n\nexport async function run(\n name: string,\n opts: MarkOpts,\n _flags: GlobalFlags,\n out: OutputOptions,\n) {\n validateProfileName(name)\n\n if (opts.production === undefined) {\n throw new MxsError({\n code: MxsErrorCode.ValidationFailed,\n message: 'one of --production or --no-production is required',\n })\n }\n\n try {\n const stat = await fs.stat(getProfileDir(name))\n if (!stat.isDirectory()) throw new Error('not a directory')\n } catch (err: any) {\n if (err?.code !== 'ENOENT' && !(err instanceof MxsError)) throw err\n throw new MxsError({\n code: MxsErrorCode.ProfileNotFound,\n message: `profile '${name}' does not exist`,\n })\n }\n\n const existing = await readProfileConfig(name)\n await writeProfileConfig(name, { ...existing, production: opts.production })\n\n const flag = opts.production ? '--production' : '--no-production'\n emitInfo(`mxs: profile '${name}' marked with ${flag}`, out)\n}\n"],"mappings":";;;;AAgBA,eAAsB,IACpB,MACA,MACA,QACA,KACA;CACA,oBAAoB,IAAI;CAExB,IAAI,KAAK,eAAe,KAAA,GACtB,MAAM,IAAI,SAAS;EACjB,MAAM,aAAa;EACnB,SAAS;CACX,CAAC;CAGH,IAAI;EAEF,IAAI,EAAC,MADcA,SAAG,KAAK,cAAc,IAAI,CAAC,GACpC,YAAY,GAAG,MAAM,IAAI,MAAM,iBAAiB;CAC5D,SAAS,KAAU;EACjB,IAAI,KAAK,SAAS,YAAY,EAAE,eAAe,WAAW,MAAM;EAChE,MAAM,IAAI,SAAS;GACjB,MAAM,aAAa;GACnB,SAAS,YAAY,KAAK;EAC5B,CAAC;CACH;CAGA,MAAM,mBAAmB,MAAM;EAAE,GAAG,MADb,kBAAkB,IAAI;EACC,YAAY,KAAK;CAAW,CAAC;CAG3E,SAAS,iBAAiB,KAAK,gBADlB,KAAK,aAAa,iBAAiB,qBACO,GAAG;AAC5D"}
@@ -0,0 +1,214 @@
1
+ import { t as Pe } from "./dist-DJF1Ntdn.mjs";
2
+ import { c as MxsErrorCode, s as MxsError } from "./output-vzequvhd.mjs";
3
+ import { f as setCurrentProfile, m as writeProfileConfig, r as getCurrentProfile } from "./profile-CNe2uWJi.mjs";
4
+ import { f as writeCredentials, l as readCredentials, s as normalizeApiUrl } from "./config-store-B8_9iStL.mjs";
5
+ import { c as refreshAccessToken, n as defaultHttp, r as ensureFreshToken, s as probeAuthEndpoint } from "./auth-CAKmTDpF.mjs";
6
+ //#region src/core/gate.ts
7
+ const SAFE_METHODS = new Set([
8
+ "GET",
9
+ "HEAD",
10
+ "OPTIONS"
11
+ ]);
12
+ function decideWriteGate(resolved, method) {
13
+ if (SAFE_METHODS.has(method)) return { allow: true };
14
+ if (!resolved.isProduction) return { allow: true };
15
+ if (resolved.profileExplicit) return { allow: true };
16
+ if (resolved.urlOverridden) return { allow: true };
17
+ const name = resolved.profileName ?? "unknown";
18
+ const url = resolved.apiUrl;
19
+ return {
20
+ allow: false,
21
+ code: MxsErrorCode.ProfileWriteRequiresExplicit,
22
+ message: `write blocked: active profile '${name}' (${url}) is production`,
23
+ hint: `active profile '${name}' is production; retry with --profile ${name} or MXS_PROFILE=${name}`
24
+ };
25
+ }
26
+ //#endregion
27
+ //#region src/core/api-client.ts
28
+ var ApiClient = class {
29
+ ctx;
30
+ http;
31
+ token;
32
+ refreshed = false;
33
+ constructor(ctx) {
34
+ this.ctx = ctx;
35
+ this.http = ctx.http ?? defaultHttp();
36
+ this.token = ctx.token;
37
+ if (ctx.resolved?.isProduction && !ctx.quiet) {
38
+ const r = ctx.resolved;
39
+ process.stderr.write(`mxs: profile=${r.profileName} (production) → ${r.apiUrl}\n`);
40
+ }
41
+ }
42
+ get apiBase() {
43
+ return this.ctx.apiBase;
44
+ }
45
+ async request(path, options = {}) {
46
+ const method = options.method ?? "GET";
47
+ if (this.ctx.resolved) {
48
+ const decision = decideWriteGate(this.ctx.resolved, method);
49
+ if (!decision.allow) throw new MxsError({
50
+ code: MxsErrorCode.ProfileWriteRequiresExplicit,
51
+ message: decision.message,
52
+ hint: decision.hint,
53
+ details: {
54
+ profile: this.ctx.resolved.profileName,
55
+ api_url: this.ctx.resolved.apiUrl
56
+ }
57
+ });
58
+ }
59
+ if (this.ctx.autoRefresh && this.token) await this.tryRefresh();
60
+ const url = buildUrl(this.ctx.apiBase, path, options.query);
61
+ const headers = {
62
+ accept: "application/json",
63
+ ...options.headers
64
+ };
65
+ if (this.token) headers.authorization = `Bearer ${this.token}`;
66
+ if (this.ctx.apiKey) headers["x-api-key"] = this.ctx.apiKey;
67
+ if (options.body !== void 0 && !(options.body instanceof FormData)) headers["content-type"] ??= "application/json";
68
+ const startedAt = Date.now();
69
+ let res = await this.http.fetch(url, {
70
+ method,
71
+ headers,
72
+ body: options.body === void 0 ? void 0 : options.body instanceof FormData ? options.body : JSON.stringify(options.body),
73
+ signal: options.signal
74
+ });
75
+ if (this.ctx.verbose) process.stderr.write(`${method} ${url} → ${res.status} (${Date.now() - startedAt}ms)\n`);
76
+ if (res.status === 401 && !this.refreshed && this.token) {
77
+ const refreshed = await this.tryRefresh();
78
+ if (refreshed) {
79
+ this.refreshed = true;
80
+ headers.authorization = `Bearer ${refreshed.access_token}`;
81
+ this.token = refreshed.access_token;
82
+ res = await this.http.fetch(url, {
83
+ method,
84
+ headers,
85
+ body: options.body === void 0 ? void 0 : options.body instanceof FormData ? options.body : JSON.stringify(options.body),
86
+ signal: options.signal
87
+ });
88
+ }
89
+ }
90
+ const data = await parseBody(res);
91
+ if (res.ok) return {
92
+ ok: true,
93
+ status: res.status,
94
+ data
95
+ };
96
+ throw toMxsError(res.status, data);
97
+ }
98
+ async tryRefresh() {
99
+ const current = await readCredentials();
100
+ if (!current) return null;
101
+ if (this.token && current.access_token !== this.token) return null;
102
+ const refreshed = await refreshAccessToken(this.ctx.authBase, this.ctx.clientId, current, this.http);
103
+ if (!refreshed) return null;
104
+ await writeCredentials(refreshed);
105
+ this.token = refreshed.access_token;
106
+ return refreshed;
107
+ }
108
+ };
109
+ async function createApiClient(ctx) {
110
+ if (!ctx.token) return new ApiClient(ctx);
111
+ const fresh = await ensureFreshToken(ctx.authBase, ctx.clientId, ctx.http ?? defaultHttp()).catch(() => null);
112
+ if (fresh) return new ApiClient({
113
+ ...ctx,
114
+ token: fresh.access_token
115
+ });
116
+ return new ApiClient(ctx);
117
+ }
118
+ function buildUrl(base, path, query) {
119
+ const url = new URL(path.startsWith("/") ? path.slice(1) : path, base.endsWith("/") ? base : `${base}/`);
120
+ if (query) for (const [k, v] of Object.entries(query)) {
121
+ if (v === void 0 || v === null) continue;
122
+ url.searchParams.set(k, String(v));
123
+ }
124
+ return url.toString();
125
+ }
126
+ async function parseBody(res) {
127
+ if ((res.headers.get("content-type") ?? "").includes("application/json")) try {
128
+ return await res.json();
129
+ } catch {
130
+ return;
131
+ }
132
+ return await res.text();
133
+ }
134
+ function toMxsError(status, body) {
135
+ if (status === 401) return new MxsError({
136
+ code: MxsErrorCode.AuthExpired,
137
+ message: "authentication required",
138
+ hint: "run `mxs auth login`",
139
+ details: body
140
+ });
141
+ if (status === 403) return new MxsError({
142
+ code: MxsErrorCode.AuthDenied,
143
+ message: "permission denied",
144
+ details: body
145
+ });
146
+ if (status === 404) return new MxsError({
147
+ code: MxsErrorCode.ResourceNotFound,
148
+ message: "resource not found",
149
+ details: body
150
+ });
151
+ if (status === 422 || status === 400) return new MxsError({
152
+ code: MxsErrorCode.ValidationFailed,
153
+ message: extractMessage(body) ?? "validation failed",
154
+ details: body
155
+ });
156
+ if (status >= 500) return new MxsError({
157
+ code: MxsErrorCode.ServerError,
158
+ message: extractMessage(body) ?? `server error (${status})`,
159
+ details: body
160
+ });
161
+ return new MxsError({
162
+ code: MxsErrorCode.Generic,
163
+ message: extractMessage(body) ?? `request failed (${status})`,
164
+ details: body
165
+ });
166
+ }
167
+ function extractMessage(body) {
168
+ if (!body || typeof body !== "object") return null;
169
+ const msg = body.message;
170
+ if (typeof msg === "string") return msg;
171
+ if (Array.isArray(msg) && typeof msg[0] === "string") return msg.join("; ");
172
+ return null;
173
+ }
174
+ //#endregion
175
+ //#region src/core/onboarding.ts
176
+ async function runOnboarding(opts = {}) {
177
+ const tty = opts.isTTY ?? Boolean(process.stdin.isTTY && process.stdout.isTTY);
178
+ let input = opts.initialApiUrl;
179
+ if (!input) {
180
+ if (!tty) throw new MxsError({
181
+ code: MxsErrorCode.ConfigMissingApiUrl,
182
+ message: "API URL is not configured",
183
+ hint: "set MXS_API_URL or pass --api-url <url>, or run `mxs auth login` in an interactive shell"
184
+ });
185
+ if (opts.prompt) input = await opts.prompt("API URL of your mx-core server");
186
+ else {
187
+ const answer = await Pe({
188
+ message: "API URL of your mx-core server",
189
+ placeholder: "https://blog.example.com",
190
+ validate: (v) => !v || v.trim().length === 0 ? "required" : void 0
191
+ });
192
+ if (typeof answer !== "string") throw new MxsError({
193
+ code: MxsErrorCode.ConfigMissingApiUrl,
194
+ message: "onboarding aborted"
195
+ });
196
+ input = answer;
197
+ }
198
+ }
199
+ const probed = await probeAuthEndpoint(normalizeApiUrl(input), opts.http ?? defaultHttp());
200
+ const target = opts.profile?.trim() || await getCurrentProfile() || "default";
201
+ await writeProfileConfig(target, {
202
+ api_url: probed.apiUrl,
203
+ api_base: probed.apiBase,
204
+ auth_base: probed.authBase,
205
+ api_version: probed.apiVersion,
206
+ client_id: "mxs-cli"
207
+ });
208
+ await setCurrentProfile(target);
209
+ return probed;
210
+ }
211
+ //#endregion
212
+ export { ApiClient as n, createApiClient as r, runOnboarding as t };
213
+
214
+ //# sourceMappingURL=onboarding-Bw_I8qpf.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"onboarding-Bw_I8qpf.mjs","names":["text"],"sources":["../src/core/gate.ts","../src/core/api-client.ts","../src/core/onboarding.ts"],"sourcesContent":["import type { ResolvedConfig } from './config-store'\nimport { MxsErrorCode } from './errors'\n\nexport type HttpMethod =\n | 'GET'\n | 'HEAD'\n | 'OPTIONS'\n | 'POST'\n | 'PUT'\n | 'PATCH'\n | 'DELETE'\n\nexport interface GateDecision {\n allow: boolean\n code?: 'profile.write_requires_explicit'\n message?: string\n hint?: string\n}\n\nconst SAFE_METHODS = new Set<HttpMethod>(['GET', 'HEAD', 'OPTIONS'])\n\nexport function decideWriteGate(\n resolved: ResolvedConfig,\n method: HttpMethod,\n): GateDecision {\n if (SAFE_METHODS.has(method)) {\n return { allow: true }\n }\n if (!resolved.isProduction) {\n return { allow: true }\n }\n if (resolved.profileExplicit) {\n return { allow: true }\n }\n if (resolved.urlOverridden) {\n return { allow: true }\n }\n\n const name = resolved.profileName ?? 'unknown'\n const url = resolved.apiUrl\n\n return {\n allow: false,\n code: MxsErrorCode.ProfileWriteRequiresExplicit,\n message: `write blocked: active profile '${name}' (${url}) is production`,\n hint: `active profile '${name}' is production; retry with --profile ${name} or MXS_PROFILE=${name}`,\n }\n}\n","import {\n type AuthHttp,\n defaultHttp,\n ensureFreshToken,\n refreshAccessToken,\n} from './auth'\nimport {\n type CredentialsShape,\n readCredentials,\n type ResolvedConfig,\n writeCredentials,\n} from './config-store'\nimport { MxsError, MxsErrorCode } from './errors'\nimport { decideWriteGate, type HttpMethod } from './gate'\n\nexport interface ApiClientContext {\n apiBase: string\n authBase: string\n clientId: string\n token?: string\n apiKey?: string\n autoRefresh?: boolean\n verbose?: boolean\n quiet?: boolean\n http?: AuthHttp\n /** When provided, enables the production banner and write gate. */\n resolved?: ResolvedConfig\n}\n\nexport interface RequestOptions {\n method?: 'GET' | 'POST' | 'PATCH' | 'PUT' | 'DELETE'\n body?: unknown\n query?: Record<string, unknown>\n headers?: Record<string, string>\n signal?: AbortSignal\n}\n\nexport interface ApiResponse<T> {\n ok: boolean\n status: number\n data: T\n}\n\nexport class ApiClient {\n private http: AuthHttp\n private token?: string\n private refreshed = false\n\n constructor(private ctx: ApiClientContext) {\n this.http = ctx.http ?? defaultHttp()\n this.token = ctx.token\n if (ctx.resolved?.isProduction && !ctx.quiet) {\n const r = ctx.resolved\n process.stderr.write(\n `mxs: profile=${r.profileName} (production) → ${r.apiUrl}\\n`,\n )\n }\n }\n\n get apiBase(): string {\n return this.ctx.apiBase\n }\n\n async request<T = unknown>(\n path: string,\n options: RequestOptions = {},\n ): Promise<ApiResponse<T>> {\n const method = (options.method ?? 'GET') as HttpMethod\n if (this.ctx.resolved) {\n const decision = decideWriteGate(this.ctx.resolved, method)\n if (!decision.allow) {\n throw new MxsError({\n code: MxsErrorCode.ProfileWriteRequiresExplicit,\n message: decision.message!,\n hint: decision.hint,\n details: {\n profile: this.ctx.resolved.profileName,\n api_url: this.ctx.resolved.apiUrl,\n },\n })\n }\n }\n if (this.ctx.autoRefresh && this.token) {\n await this.tryRefresh()\n }\n const url = buildUrl(this.ctx.apiBase, path, options.query)\n const headers: Record<string, string> = {\n accept: 'application/json',\n ...options.headers,\n }\n if (this.token) headers.authorization = `Bearer ${this.token}`\n if (this.ctx.apiKey) headers['x-api-key'] = this.ctx.apiKey\n if (options.body !== undefined && !(options.body instanceof FormData)) {\n headers['content-type'] ??= 'application/json'\n }\n const startedAt = Date.now()\n let res = await this.http.fetch(url, {\n method,\n headers,\n body:\n options.body === undefined\n ? undefined\n : options.body instanceof FormData\n ? options.body\n : JSON.stringify(options.body),\n signal: options.signal,\n })\n if (this.ctx.verbose) {\n process.stderr.write(\n `${method} ${url} → ${res.status} (${Date.now() - startedAt}ms)\\n`,\n )\n }\n\n if (res.status === 401 && !this.refreshed && this.token) {\n const refreshed = await this.tryRefresh()\n if (refreshed) {\n this.refreshed = true\n headers.authorization = `Bearer ${refreshed.access_token}`\n this.token = refreshed.access_token\n res = await this.http.fetch(url, {\n method,\n headers,\n body:\n options.body === undefined\n ? undefined\n : options.body instanceof FormData\n ? options.body\n : JSON.stringify(options.body),\n signal: options.signal,\n })\n }\n }\n\n const data = await parseBody<T>(res)\n if (res.ok) return { ok: true, status: res.status, data }\n\n throw toMxsError(res.status, data)\n }\n\n private async tryRefresh(): Promise<CredentialsShape | null> {\n const current = await readCredentials()\n if (!current) return null\n if (this.token && current.access_token !== this.token) return null\n const refreshed = await refreshAccessToken(\n this.ctx.authBase,\n this.ctx.clientId,\n current,\n this.http,\n )\n if (!refreshed) return null\n await writeCredentials(refreshed)\n this.token = refreshed.access_token\n return refreshed\n }\n}\n\nexport async function createApiClient(\n ctx: ApiClientContext,\n): Promise<ApiClient> {\n if (!ctx.token) return new ApiClient(ctx)\n const fresh = await ensureFreshToken(\n ctx.authBase,\n ctx.clientId,\n ctx.http ?? defaultHttp(),\n ).catch(() => null)\n if (fresh) {\n return new ApiClient({ ...ctx, token: fresh.access_token })\n }\n return new ApiClient(ctx)\n}\n\nfunction buildUrl(\n base: string,\n path: string,\n query?: Record<string, unknown>,\n): string {\n const url = new URL(\n path.startsWith('/') ? path.slice(1) : path,\n base.endsWith('/') ? base : `${base}/`,\n )\n if (query) {\n for (const [k, v] of Object.entries(query)) {\n if (v === undefined || v === null) continue\n url.searchParams.set(k, String(v))\n }\n }\n return url.toString()\n}\n\nasync function parseBody<T>(res: Response): Promise<T> {\n const ct = res.headers.get('content-type') ?? ''\n if (ct.includes('application/json')) {\n try {\n return (await res.json()) as T\n } catch {\n return undefined as T\n }\n }\n return (await res.text()) as unknown as T\n}\n\nfunction toMxsError(status: number, body: unknown): MxsError {\n if (status === 401) {\n return new MxsError({\n code: MxsErrorCode.AuthExpired,\n message: 'authentication required',\n hint: 'run `mxs auth login`',\n details: body,\n })\n }\n if (status === 403) {\n return new MxsError({\n code: MxsErrorCode.AuthDenied,\n message: 'permission denied',\n details: body,\n })\n }\n if (status === 404) {\n return new MxsError({\n code: MxsErrorCode.ResourceNotFound,\n message: 'resource not found',\n details: body,\n })\n }\n if (status === 422 || status === 400) {\n return new MxsError({\n code: MxsErrorCode.ValidationFailed,\n message: extractMessage(body) ?? 'validation failed',\n details: body,\n })\n }\n if (status >= 500) {\n return new MxsError({\n code: MxsErrorCode.ServerError,\n message: extractMessage(body) ?? `server error (${status})`,\n details: body,\n })\n }\n return new MxsError({\n code: MxsErrorCode.Generic,\n message: extractMessage(body) ?? `request failed (${status})`,\n details: body,\n })\n}\n\nfunction extractMessage(body: unknown): string | null {\n if (!body || typeof body !== 'object') return null\n const msg = (body as Record<string, unknown>).message\n if (typeof msg === 'string') return msg\n if (Array.isArray(msg) && typeof msg[0] === 'string') return msg.join('; ')\n return null\n}\n","import { text } from '@clack/prompts'\n\nimport { type AuthHttp, defaultHttp, probeAuthEndpoint } from './auth'\nimport { normalizeApiUrl } from './config-store'\nimport { MxsError, MxsErrorCode } from './errors'\nimport {\n getCurrentProfile,\n setCurrentProfile,\n writeProfileConfig,\n} from './profile'\n\nexport interface OnboardingResult {\n apiUrl: string\n apiBase: string\n authBase: string\n apiVersion: number\n}\n\nexport interface OnboardingOptions {\n http?: AuthHttp\n initialApiUrl?: string\n isTTY?: boolean\n prompt?: (question: string) => Promise<string>\n /** Override the target profile name (mirrors --profile flag). */\n profile?: string\n}\n\nexport async function runOnboarding(\n opts: OnboardingOptions = {},\n): Promise<OnboardingResult> {\n const tty = opts.isTTY ?? Boolean(process.stdin.isTTY && process.stdout.isTTY)\n let input = opts.initialApiUrl\n if (!input) {\n if (!tty) {\n throw new MxsError({\n code: MxsErrorCode.ConfigMissingApiUrl,\n message: 'API URL is not configured',\n hint: 'set MXS_API_URL or pass --api-url <url>, or run `mxs auth login` in an interactive shell',\n })\n }\n if (opts.prompt) {\n input = await opts.prompt('API URL of your mx-core server')\n } else {\n const answer = await text({\n message: 'API URL of your mx-core server',\n placeholder: 'https://blog.example.com',\n validate: (v) => (!v || v.trim().length === 0 ? 'required' : undefined),\n })\n if (typeof answer !== 'string') {\n throw new MxsError({\n code: MxsErrorCode.ConfigMissingApiUrl,\n message: 'onboarding aborted',\n })\n }\n input = answer\n }\n }\n\n const apiUrl = normalizeApiUrl(input)\n const probed = await probeAuthEndpoint(apiUrl, opts.http ?? defaultHttp())\n\n // Determine target profile: --profile > active current > 'default'\n const target =\n opts.profile?.trim() || (await getCurrentProfile()) || 'default'\n\n await writeProfileConfig(target, {\n api_url: probed.apiUrl,\n api_base: probed.apiBase,\n auth_base: probed.authBase,\n api_version: probed.apiVersion,\n client_id: 'mxs-cli',\n })\n\n await setCurrentProfile(target)\n\n return probed\n}\n"],"mappings":";;;;;;AAmBA,MAAM,eAAe,IAAI,IAAgB;CAAC;CAAO;CAAQ;AAAS,CAAC;AAEnE,SAAgB,gBACd,UACA,QACc;CACd,IAAI,aAAa,IAAI,MAAM,GACzB,OAAO,EAAE,OAAO,KAAK;CAEvB,IAAI,CAAC,SAAS,cACZ,OAAO,EAAE,OAAO,KAAK;CAEvB,IAAI,SAAS,iBACX,OAAO,EAAE,OAAO,KAAK;CAEvB,IAAI,SAAS,eACX,OAAO,EAAE,OAAO,KAAK;CAGvB,MAAM,OAAO,SAAS,eAAe;CACrC,MAAM,MAAM,SAAS;CAErB,OAAO;EACL,OAAO;EACP,MAAM,aAAa;EACnB,SAAS,kCAAkC,KAAK,KAAK,IAAI;EACzD,MAAM,mBAAmB,KAAK,wCAAwC,KAAK,kBAAkB;CAC/F;AACF;;;ACJA,IAAa,YAAb,MAAuB;CAKD;CAJpB;CACA;CACA,YAAoB;CAEpB,YAAY,KAA+B;EAAvB,KAAA,MAAA;EAClB,KAAK,OAAO,IAAI,QAAQ,YAAY;EACpC,KAAK,QAAQ,IAAI;EACjB,IAAI,IAAI,UAAU,gBAAgB,CAAC,IAAI,OAAO;GAC5C,MAAM,IAAI,IAAI;GACd,QAAQ,OAAO,MACb,gBAAgB,EAAE,YAAY,kBAAkB,EAAE,OAAO,GAC3D;EACF;CACF;CAEA,IAAI,UAAkB;EACpB,OAAO,KAAK,IAAI;CAClB;CAEA,MAAM,QACJ,MACA,UAA0B,CAAC,GACF;EACzB,MAAM,SAAU,QAAQ,UAAU;EAClC,IAAI,KAAK,IAAI,UAAU;GACrB,MAAM,WAAW,gBAAgB,KAAK,IAAI,UAAU,MAA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