vercel 59.14.0 → 59.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (459) hide show
  1. package/dist/chunks/add-7XFD2OHW.js +8 -0
  2. package/dist/chunks/add-HZC7AUBY.js +8 -0
  3. package/dist/chunks/add-PYUNJZ6K.js +8 -0
  4. package/dist/chunks/build-EFKQ6BND.js +7 -0
  5. package/dist/chunks/chunk-2B2MN3U5.js +8 -0
  6. package/dist/chunks/chunk-2H77IRPI.js +9 -0
  7. package/dist/chunks/chunk-2I64AYHG.js +7 -0
  8. package/dist/chunks/chunk-2PPXY24N.js +20 -0
  9. package/dist/chunks/chunk-2S6PE6GB.js +7 -0
  10. package/dist/chunks/{chunk-PIMIVJYK.js → chunk-3FMJYJUR.js} +7 -32
  11. package/dist/chunks/chunk-3IAQUNQH.js +7 -0
  12. package/dist/chunks/chunk-3QHJYVCY.js +7 -0
  13. package/dist/chunks/chunk-3QT7VOE3.js +7 -0
  14. package/dist/chunks/chunk-3TXEXPUW.js +7 -0
  15. package/dist/chunks/chunk-4MZK6JT6.js +7 -0
  16. package/dist/chunks/chunk-4NE5IQ25.js +7 -0
  17. package/dist/chunks/chunk-4PNSSS3L.js +7 -0
  18. package/dist/chunks/chunk-4QX77CP7.js +7 -0
  19. package/dist/chunks/chunk-57GHYR4Y.js +25 -0
  20. package/dist/chunks/chunk-5QQNYN4N.js +7 -0
  21. package/dist/chunks/chunk-5XJNPXQK.js +7 -0
  22. package/dist/chunks/chunk-6L236MNA.js +7 -0
  23. package/dist/chunks/chunk-6PFC3KWQ.js +7 -0
  24. package/dist/chunks/chunk-6QKS6QK7.js +7 -0
  25. package/dist/chunks/chunk-6RIQPTJA.js +8 -0
  26. package/dist/chunks/chunk-6TAQ6OWD.js +13 -0
  27. package/dist/chunks/chunk-6YAADRQB.js +9 -0
  28. package/dist/chunks/chunk-75CPY75D.js +15 -0
  29. package/dist/chunks/chunk-7HL2RPUO.js +7 -0
  30. package/dist/chunks/chunk-7PNYOSDU.js +9 -0
  31. package/dist/chunks/chunk-7R5FEXZ5.js +7 -0
  32. package/dist/chunks/chunk-7RMCBXBB.js +62 -0
  33. package/dist/chunks/chunk-7RR7MIMT.js +7 -0
  34. package/dist/chunks/chunk-7T6TL3GQ.js +7 -0
  35. package/dist/chunks/chunk-ADUYPK2G.js +13 -0
  36. package/dist/chunks/chunk-AFPOIDM5.js +7 -0
  37. package/dist/chunks/chunk-AM46JVVN.js +7 -0
  38. package/dist/chunks/chunk-AVSPFBLM.js +7 -0
  39. package/dist/chunks/chunk-B4ATVYZW.js +7 -0
  40. package/dist/chunks/chunk-BATE73HA.js +9 -0
  41. package/dist/chunks/{chunk-64IF634X.js → chunk-BRK4OB4B.js} +1 -12
  42. package/dist/chunks/chunk-BVH2AEFE.js +7 -0
  43. package/dist/chunks/chunk-CN2QZO4U.js +7 -0
  44. package/dist/chunks/chunk-COQGD2EI.js +8 -0
  45. package/dist/chunks/chunk-CUAIEGNE.js +7 -0
  46. package/dist/chunks/chunk-CVKB54WW.js +7 -0
  47. package/dist/chunks/{chunk-A3NYPUKZ.js → chunk-CZSOZKHX.js} +1 -11
  48. package/dist/chunks/chunk-D4MW3RDW.js +7 -0
  49. package/dist/chunks/chunk-DFVNL5ML.js +7 -0
  50. package/dist/chunks/chunk-EE3FVJLV.js +16 -0
  51. package/dist/chunks/chunk-EGMJRU5P.js +28 -0
  52. package/dist/chunks/chunk-ENBTTYJR.js +7 -0
  53. package/dist/chunks/chunk-ENS6KX2F.js +7 -0
  54. package/dist/chunks/chunk-EOBD4ZEG.js +8 -0
  55. package/dist/chunks/chunk-EOCTK4EA.js +7 -0
  56. package/dist/chunks/chunk-EQ52F4LH.js +7 -0
  57. package/dist/chunks/chunk-ETV3C2CV.js +7 -0
  58. package/dist/chunks/chunk-EVZRQGNK.js +7 -0
  59. package/dist/chunks/chunk-F2ZWW2IO.js +8 -0
  60. package/dist/chunks/chunk-FAW6NBLQ.js +7 -0
  61. package/dist/chunks/chunk-FI772UVH.js +7 -0
  62. package/dist/chunks/chunk-FKCOBJFH.js +7 -0
  63. package/dist/chunks/chunk-FVGESGJI.js +45 -0
  64. package/dist/chunks/chunk-G5FC5ZCO.js +9 -0
  65. package/dist/chunks/chunk-G6CTAHKY.js +39 -0
  66. package/dist/chunks/chunk-G7Y77DFH.js +7 -0
  67. package/dist/chunks/chunk-GHAY4PSD.js +7 -0
  68. package/dist/chunks/chunk-GHM7V3GG.js +7 -0
  69. package/dist/chunks/chunk-GRNTLNC7.js +7 -0
  70. package/dist/chunks/chunk-GTRGQIY2.js +10 -0
  71. package/dist/chunks/chunk-GU6VIFR5.js +7 -0
  72. package/dist/chunks/{constants-YMCRE6IG.js → chunk-GZNDA6SV.js} +2 -9
  73. package/dist/chunks/chunk-HBFPLBTX.js +10 -0
  74. package/dist/chunks/chunk-HEGJZJO7.js +7 -0
  75. package/dist/chunks/chunk-HSJ6AHWG.js +12 -0
  76. package/dist/chunks/chunk-HTC6KO2B.js +7 -0
  77. package/dist/chunks/chunk-HVUHCRZB.js +18 -0
  78. package/dist/chunks/chunk-HZZ5L472.js +7 -0
  79. package/dist/chunks/chunk-IVSSTHB6.js +7 -0
  80. package/dist/chunks/chunk-IVWPQYIH.js +7 -0
  81. package/dist/chunks/chunk-J3U3L45Y.js +7 -0
  82. package/dist/chunks/chunk-JAJW3P42.js +7 -0
  83. package/dist/chunks/chunk-JEIMW3CO.js +7 -0
  84. package/dist/chunks/chunk-JIYY3B4C.js +7 -0
  85. package/dist/chunks/chunk-JKTQV2QJ.js +7 -0
  86. package/dist/chunks/chunk-JTVVBRW7.js +7 -0
  87. package/dist/chunks/chunk-JYAUUIR4.js +7 -0
  88. package/dist/chunks/chunk-JZRMH5UA.js +7 -0
  89. package/dist/chunks/chunk-K2RAW5DI.js +10 -0
  90. package/dist/chunks/chunk-K3KJZLBD.js +7 -0
  91. package/dist/chunks/chunk-KK4AJES5.js +36 -0
  92. package/dist/chunks/chunk-KKS7XWEX.js +7 -0
  93. package/dist/chunks/chunk-KNEWCUWF.js +14 -0
  94. package/dist/chunks/chunk-KO733OJG.js +9 -0
  95. package/dist/chunks/chunk-L243RUIR.js +19 -0
  96. package/dist/chunks/chunk-L3JDEHCQ.js +7 -0
  97. package/dist/chunks/chunk-LDM3SQAU.js +13 -0
  98. package/dist/chunks/chunk-LNPMDXBJ.js +7 -0
  99. package/dist/chunks/chunk-M2W3HKV3.js +23 -0
  100. package/dist/chunks/chunk-M2XARQBF.js +9 -0
  101. package/dist/chunks/chunk-M5AV545M.js +7 -0
  102. package/dist/chunks/chunk-MAVRGZQP.js +7 -0
  103. package/dist/chunks/chunk-MBL6TXEJ.js +7 -0
  104. package/dist/chunks/chunk-MEAY2K5Z.js +11 -0
  105. package/dist/chunks/chunk-MY4MONOH.js +7 -0
  106. package/dist/chunks/chunk-N3N5UHIL.js +7 -0
  107. package/dist/chunks/chunk-N3ZZ7FHQ.js +7 -0
  108. package/dist/chunks/chunk-N6CNMMSZ.js +7 -0
  109. package/dist/chunks/chunk-NBVY237X.js +7 -0
  110. package/dist/chunks/chunk-NGNOUPWS.js +25 -0
  111. package/dist/chunks/chunk-NHTF332K.js +7 -0
  112. package/dist/chunks/chunk-NNP5NITU.js +15 -0
  113. package/dist/chunks/chunk-NS4FH2TY.js +11 -0
  114. package/dist/chunks/chunk-NUGLE4QY.js +11 -0
  115. package/dist/chunks/chunk-NWFHHUKZ.js +7 -0
  116. package/dist/chunks/chunk-O7G3CZ42.js +7 -0
  117. package/dist/chunks/chunk-OD6RZ3XZ.js +8 -0
  118. package/dist/chunks/chunk-OHDEHZLX.js +7 -0
  119. package/dist/chunks/chunk-OK3S6KFX.js +16 -0
  120. package/dist/chunks/chunk-OKZDOANA.js +23 -0
  121. package/dist/chunks/chunk-OSCCYU74.js +7 -0
  122. package/dist/chunks/chunk-OUHPDA7Q.js +7 -0
  123. package/dist/chunks/chunk-P2O5DOYE.js +7 -0
  124. package/dist/chunks/chunk-PHW54NU5.js +13 -0
  125. package/dist/chunks/chunk-PPCFQQSU.js +7 -0
  126. package/dist/chunks/chunk-QGIGNMII.js +8 -0
  127. package/dist/chunks/chunk-QGIQK47P.js +7 -0
  128. package/dist/chunks/chunk-QHJLRTVY.js +7 -0
  129. package/dist/chunks/{chunk-2473DUBR.js → chunk-QR7QPUFN.js} +1 -9
  130. package/dist/chunks/chunk-QTKJC2O5.js +7 -0
  131. package/dist/chunks/chunk-R2TGGVCT.js +19 -0
  132. package/dist/chunks/chunk-RAIBQIKB.js +7 -0
  133. package/dist/chunks/chunk-RCTYVKM5.js +16 -0
  134. package/dist/chunks/chunk-RKAUVPOQ.js +86 -0
  135. package/dist/chunks/chunk-S5CEIACD.js +7 -0
  136. package/dist/chunks/chunk-SGWVKRSR.js +8 -0
  137. package/dist/chunks/chunk-SOJCELXH.js +7 -0
  138. package/dist/chunks/chunk-SXUEGVWB.js +7 -0
  139. package/dist/chunks/{chunk-GGPE5377.js → chunk-T3GQAMBJ.js} +1 -9
  140. package/dist/chunks/chunk-T52FMXWC.js +7 -0
  141. package/dist/chunks/chunk-TG2RCYTH.js +7 -0
  142. package/dist/chunks/chunk-TJCIHDPZ.js +9 -0
  143. package/dist/chunks/chunk-TKBXN4H3.js +9 -0
  144. package/dist/chunks/chunk-TRTEXGVN.js +7 -0
  145. package/dist/chunks/chunk-TXELFFNK.js +15 -0
  146. package/dist/chunks/chunk-U56NHYAH.js +7 -0
  147. package/dist/chunks/chunk-U7KCDTCH.js +12 -0
  148. package/dist/chunks/chunk-UETTIYUQ.js +8 -0
  149. package/dist/chunks/chunk-UGMZQZJE.js +24 -0
  150. package/dist/chunks/chunk-ULLWCOYC.js +7 -0
  151. package/dist/chunks/chunk-UXTHEQVJ.js +21 -0
  152. package/dist/chunks/chunk-VLZ47RWM.js +44 -0
  153. package/dist/chunks/chunk-WKZ6JSGZ.js +7 -0
  154. package/dist/chunks/chunk-WPS6JZF6.js +7 -0
  155. package/dist/chunks/chunk-WRILLB46.js +7 -0
  156. package/dist/chunks/chunk-WUZD4KBL.js +7 -0
  157. package/dist/chunks/chunk-XCJDGQO7.js +7 -0
  158. package/dist/chunks/{pkg-56KRLZ5K.js → chunk-XD2LZRBS.js} +1 -7
  159. package/dist/chunks/chunk-XFVGX5HG.js +7 -0
  160. package/dist/chunks/chunk-XHOGOH6N.js +7 -0
  161. package/dist/chunks/{update-route-version-E3V47KNI.js → chunk-XPXOV5UO.js} +1 -7
  162. package/dist/chunks/chunk-XQ73QIQ3.js +7 -0
  163. package/dist/chunks/chunk-XSVBYDYI.js +8 -0
  164. package/dist/chunks/chunk-YKZLKOOD.js +12 -0
  165. package/dist/chunks/chunk-YMVDWVMO.js +7 -0
  166. package/dist/chunks/chunk-YPTLSODC.js +7 -0
  167. package/dist/chunks/chunk-YV6CTDHR.js +7 -0
  168. package/dist/chunks/chunk-Z6Y55QJW.js +23 -0
  169. package/dist/chunks/chunk-ZDX75YNZ.js +7 -0
  170. package/dist/chunks/chunk-ZIPVX7LD.js +7 -0
  171. package/dist/chunks/chunk-ZKYS7EAB.js +7 -0
  172. package/dist/chunks/chunk-ZT6KDLLY.js +20 -0
  173. package/dist/chunks/chunk-ZXE4XYIV.js +7 -0
  174. package/dist/chunks/chunk-ZZQRMRWD.js +20 -0
  175. package/dist/chunks/cjs-GOQHXIHX.js +54 -0
  176. package/dist/chunks/clear-5NQAVWIF.js +8 -0
  177. package/dist/chunks/compile-vercel-config-6J2XUFRK.js +7 -0
  178. package/dist/chunks/config-CKYRXZXL.js +7 -0
  179. package/dist/chunks/config-VNUY4RJ4.js +8 -0
  180. package/dist/chunks/connect-git-provider-GIU5WZ52.js +7 -0
  181. package/dist/chunks/constants-G4UYVLOF.js +7 -0
  182. package/dist/chunks/create-project-SRQGD4JY.js +7 -0
  183. package/dist/chunks/delete-GTXXCSKQ.js +10 -0
  184. package/dist/chunks/delete-HRJEO4MI.js +9 -0
  185. package/dist/chunks/detect-projects-2GNCZ4CS.js +7 -0
  186. package/dist/chunks/detect-services-GHILEGNU.js +7 -0
  187. package/dist/chunks/disable-RWCRVG5O.js +7 -0
  188. package/dist/chunks/discard-SHFIYCJU.js +14 -0
  189. package/dist/chunks/edit-DMO3NSO2.js +9 -0
  190. package/dist/chunks/edit-EVQI2RSS.js +8 -0
  191. package/dist/chunks/enable-AWDU6STD.js +7 -0
  192. package/dist/chunks/esm-7HVUFWMN.js +7 -0
  193. package/dist/chunks/esm-BZBEM7YA.js +7 -0
  194. package/dist/chunks/esm-CXICLFA3.js +9 -0
  195. package/dist/chunks/esm-HDEHVK7I.js +9 -0
  196. package/dist/chunks/esm-NQRLKALI.js +20 -0
  197. package/dist/chunks/esm-SZZI53W7.js +7 -0
  198. package/dist/chunks/esm-WGJFGCLK.js +7 -0
  199. package/dist/chunks/exec-4AISDHUV.js +16372 -0
  200. package/dist/chunks/export-IQKTA4RS.js +19 -0
  201. package/dist/chunks/fetch-proxy-AEAWC6MD.js +7 -0
  202. package/dist/chunks/future-E2FHKPJN.js +7 -0
  203. package/dist/chunks/generate-cert-for-deploy-VKOWC4PZ.js +7 -0
  204. package/dist/chunks/image-LDFYNOCA.js +7 -0
  205. package/dist/chunks/import-builders-P7CXSX2D.js +7 -0
  206. package/dist/chunks/inspect-3N47ODIH.js +15 -0
  207. package/dist/chunks/inspect-53SGDDAH.js +20 -0
  208. package/dist/chunks/inspect-5INZDUQS.js +19 -0
  209. package/dist/chunks/inspect-WMT2M335.js +9 -0
  210. package/dist/chunks/inspect-Y6BUCOUV.js +13 -0
  211. package/dist/chunks/list-BIAPHKFM.js +11 -0
  212. package/dist/chunks/list-DMOCRRSE.js +16 -0
  213. package/dist/chunks/list-K5J7OULR.js +10 -0
  214. package/dist/chunks/login-DEAEVUHM.js +7 -0
  215. package/dist/chunks/login-SRVNHI4Y.js +9 -0
  216. package/dist/chunks/logs-GK7CJBYY.js +7 -0
  217. package/dist/chunks/ls-7ZX6DCJW.js +12 -0
  218. package/dist/chunks/ls-AJWN5ZR4.js +12 -0
  219. package/dist/chunks/ls-BFJWCRLZ.js +12 -0
  220. package/dist/chunks/ls-KGIE6HCO.js +12 -0
  221. package/dist/chunks/ls-UVKTHBTE.js +8 -0
  222. package/dist/chunks/ls-WEG45IOC.js +8 -0
  223. package/dist/chunks/native-self-update-KOJVRMHR.js +7 -0
  224. package/dist/chunks/open-OEWPI5G6.js +7 -0
  225. package/dist/chunks/openapi-MO5HYMHR.js +7 -0
  226. package/dist/chunks/permissions-EPQBQFE3.js +7 -0
  227. package/dist/chunks/pkg-YFU67U7I.js +7 -0
  228. package/dist/chunks/prompt-missing-credentials-IUHLYSQU.js +7 -0
  229. package/dist/chunks/publish-JG7MEPWT.js +15 -0
  230. package/dist/chunks/pull-MRKXG6TO.js +7 -0
  231. package/dist/chunks/purchase-domain-if-available-O5ARXEZ5.js +7 -0
  232. package/dist/chunks/push-XOXJDFYO.js +7 -0
  233. package/dist/chunks/query-AL7C6WV2.js +12 -0
  234. package/dist/chunks/reauthenticate-SH4XR7NH.js +7 -0
  235. package/dist/chunks/reorder-5DMRFDBY.js +10 -0
  236. package/dist/chunks/reply-WSRNZWFD.js +9 -0
  237. package/dist/chunks/repo-info-to-url-SK3VX6UL.js +7 -0
  238. package/dist/chunks/resolve-YJUXQVOZ.js +12 -0
  239. package/dist/chunks/resolve-deployment-framework-preset-XF3NJIDS.js +7 -0
  240. package/dist/chunks/restore-QT3DBGKU.js +16 -0
  241. package/dist/chunks/rm-MHPIUEZ5.js +8 -0
  242. package/dist/chunks/rm-MVZFU6RG.js +8 -0
  243. package/dist/chunks/rm-PXR4J2US.js +8 -0
  244. package/dist/chunks/rm-WB2AIP3N.js +8 -0
  245. package/dist/chunks/rm-XRP6MRUT.js +8 -0
  246. package/dist/chunks/routes-5DERZV5M.js +7 -0
  247. package/dist/chunks/rule-inspect-TT3DRGCS.js +8 -0
  248. package/dist/chunks/rules-B5GW4KJH.js +7 -0
  249. package/dist/chunks/schema-JY5QTZOG.js +14 -0
  250. package/dist/chunks/schema-KCNKVFT3.js +44 -0
  251. package/dist/chunks/select-org-KSCYSESV.js +7 -0
  252. package/dist/chunks/set-7BANEWEL.js +7 -0
  253. package/dist/chunks/setup-and-link-ZAV3EFGC.js +7 -0
  254. package/dist/chunks/slugify-O5DBATYT.js +7 -0
  255. package/dist/chunks/stamp-OX4YO3KY.js +7 -0
  256. package/dist/chunks/tags-VZR66NUC.js +7 -0
  257. package/dist/chunks/types-LRXQEDYI.js +14 -0
  258. package/dist/chunks/update-RBFNNSWE.js +8 -0
  259. package/dist/chunks/update-route-version-XZAFPQJC.js +7 -0
  260. package/dist/chunks/utils-B5ZTMQKY.js +58 -0
  261. package/dist/chunks/vlt-builder-importer-YVCYYRVV.js +11 -0
  262. package/dist/commands/build/index.js +24 -4925
  263. package/dist/commands/deploy/index.js +43 -2875
  264. package/dist/commands/dev/index.js +56 -23857
  265. package/dist/commands/env/index.js +26 -3411
  266. package/dist/commands/link/index.js +4 -284
  267. package/dist/commands/list/index.js +6 -566
  268. package/dist/commands-bulk.js +1187 -87691
  269. package/dist/help.js +1 -8
  270. package/dist/index.js +19 -2591
  271. package/dist/version.mjs +1 -1
  272. package/package.json +50 -51
  273. package/dist/chunks/add-EQZRT4XL.js +0 -221
  274. package/dist/chunks/add-KMDROZC3.js +0 -196
  275. package/dist/chunks/add-QPJ3XMBV.js +0 -145
  276. package/dist/chunks/build-W4HPTAOB.js +0 -251
  277. package/dist/chunks/chunk-26CU4Q3C.js +0 -598
  278. package/dist/chunks/chunk-2HSQ7YUK.js +0 -93
  279. package/dist/chunks/chunk-2JIX6UMI.js +0 -4626
  280. package/dist/chunks/chunk-2LCFOK66.js +0 -1536
  281. package/dist/chunks/chunk-332LMJLZ.js +0 -16014
  282. package/dist/chunks/chunk-3HZLXCVL.js +0 -137
  283. package/dist/chunks/chunk-3VM7HWF6.js +0 -104
  284. package/dist/chunks/chunk-3ZE5CFVM.js +0 -346
  285. package/dist/chunks/chunk-4IALDGB7.js +0 -22
  286. package/dist/chunks/chunk-4KD5BYHB.js +0 -127
  287. package/dist/chunks/chunk-4TUMNBEE.js +0 -231
  288. package/dist/chunks/chunk-4WG2MYCI.js +0 -163
  289. package/dist/chunks/chunk-57RHXXXG.js +0 -150
  290. package/dist/chunks/chunk-5AJPMLDV.js +0 -28
  291. package/dist/chunks/chunk-5EIV6LPQ.js +0 -305
  292. package/dist/chunks/chunk-5NF5HOBJ.js +0 -1854
  293. package/dist/chunks/chunk-653QRQAD.js +0 -417
  294. package/dist/chunks/chunk-67CRVWDF.js +0 -81
  295. package/dist/chunks/chunk-6E6KPBXY.js +0 -43
  296. package/dist/chunks/chunk-75VENWDN.js +0 -1892
  297. package/dist/chunks/chunk-7MRDIPJY.js +0 -107
  298. package/dist/chunks/chunk-7NRNFV77.js +0 -875
  299. package/dist/chunks/chunk-7Q45OKWR.js +0 -149
  300. package/dist/chunks/chunk-AHU7WNL2.js +0 -24
  301. package/dist/chunks/chunk-AINIBIP4.js +0 -39
  302. package/dist/chunks/chunk-AJ5HUOWB.js +0 -14059
  303. package/dist/chunks/chunk-AKLTIZCU.js +0 -46
  304. package/dist/chunks/chunk-AQ6P3IGG.js +0 -49
  305. package/dist/chunks/chunk-B5NH7SLK.js +0 -324
  306. package/dist/chunks/chunk-B5XLQKHI.js +0 -849
  307. package/dist/chunks/chunk-BEQV3X2L.js +0 -86
  308. package/dist/chunks/chunk-CAHP7UGE.js +0 -79
  309. package/dist/chunks/chunk-CFDDM4TX.js +0 -13618
  310. package/dist/chunks/chunk-CJV7J7B5.js +0 -314
  311. package/dist/chunks/chunk-CV5YC2EN.js +0 -867
  312. package/dist/chunks/chunk-CXFY6A6W.js +0 -255
  313. package/dist/chunks/chunk-D5SMZXVO.js +0 -233
  314. package/dist/chunks/chunk-E336ZXPP.js +0 -43
  315. package/dist/chunks/chunk-EDMW7SBH.js +0 -246
  316. package/dist/chunks/chunk-EFYMIIER.js +0 -40
  317. package/dist/chunks/chunk-EKPSCRJZ.js +0 -26
  318. package/dist/chunks/chunk-EOZFDJSY.js +0 -18
  319. package/dist/chunks/chunk-EWBCSDTM.js +0 -1708
  320. package/dist/chunks/chunk-EZKW5YJ2.js +0 -177
  321. package/dist/chunks/chunk-F2QLCXCF.js +0 -2399
  322. package/dist/chunks/chunk-FGDKMNEN.js +0 -21
  323. package/dist/chunks/chunk-FRVG4OW3.js +0 -7438
  324. package/dist/chunks/chunk-FVF4UHDM.js +0 -1288
  325. package/dist/chunks/chunk-G5FBSUL4.js +0 -822
  326. package/dist/chunks/chunk-GDOUDU6O.js +0 -74
  327. package/dist/chunks/chunk-GGP5R3FU.js +0 -129
  328. package/dist/chunks/chunk-GVNCVKCI.js +0 -68
  329. package/dist/chunks/chunk-GY5I4AYD.js +0 -122
  330. package/dist/chunks/chunk-GZLPFESR.js +0 -48
  331. package/dist/chunks/chunk-HB4UKFDO.js +0 -1295
  332. package/dist/chunks/chunk-HD4DR3DA.js +0 -818
  333. package/dist/chunks/chunk-HKHXKSXQ.js +0 -152
  334. package/dist/chunks/chunk-HM24ZWQL.js +0 -174
  335. package/dist/chunks/chunk-HRXRELD3.js +0 -338
  336. package/dist/chunks/chunk-IB5L4LKZ.js +0 -1082
  337. package/dist/chunks/chunk-IIMSID24.js +0 -104
  338. package/dist/chunks/chunk-J7JKZM4T.js +0 -58
  339. package/dist/chunks/chunk-JC2O346E.js +0 -137
  340. package/dist/chunks/chunk-JSD4EZL3.js +0 -34
  341. package/dist/chunks/chunk-JZXJZX7O.js +0 -257
  342. package/dist/chunks/chunk-K3RED3VO.js +0 -566
  343. package/dist/chunks/chunk-KFWQ3EFH.js +0 -151
  344. package/dist/chunks/chunk-KW7BS25T.js +0 -466
  345. package/dist/chunks/chunk-KXDWXXJH.js +0 -70
  346. package/dist/chunks/chunk-LERVNZTD.js +0 -90
  347. package/dist/chunks/chunk-LYAAQDNS.js +0 -242
  348. package/dist/chunks/chunk-M5I6INNF.js +0 -61
  349. package/dist/chunks/chunk-N6HP5BLI.js +0 -18190
  350. package/dist/chunks/chunk-ND5CF2H3.js +0 -53
  351. package/dist/chunks/chunk-NFU4XJIR.js +0 -120
  352. package/dist/chunks/chunk-NW34PW6V.js +0 -1772
  353. package/dist/chunks/chunk-OAMU5QO6.js +0 -18
  354. package/dist/chunks/chunk-OCIZ6ZYA.js +0 -253
  355. package/dist/chunks/chunk-ORQZKIIB.js +0 -2914
  356. package/dist/chunks/chunk-P3SKP5WM.js +0 -27
  357. package/dist/chunks/chunk-P4QNYOFB.js +0 -96
  358. package/dist/chunks/chunk-P7VSBDR4.js +0 -827
  359. package/dist/chunks/chunk-PEC3CQSK.js +0 -90
  360. package/dist/chunks/chunk-PMSMUMUO.js +0 -30
  361. package/dist/chunks/chunk-PNGVSHR3.js +0 -40
  362. package/dist/chunks/chunk-POOO7W47.js +0 -916
  363. package/dist/chunks/chunk-PRWJUY5U.js +0 -848
  364. package/dist/chunks/chunk-Q2DGFCO7.js +0 -579
  365. package/dist/chunks/chunk-RBF2NPUP.js +0 -577
  366. package/dist/chunks/chunk-RBIFXFZX.js +0 -52
  367. package/dist/chunks/chunk-RDTRWLWB.js +0 -11441
  368. package/dist/chunks/chunk-RN6V5ODW.js +0 -114
  369. package/dist/chunks/chunk-RNSMTWA6.js +0 -122
  370. package/dist/chunks/chunk-RTJASENB.js +0 -59
  371. package/dist/chunks/chunk-RVBZ64EQ.js +0 -52
  372. package/dist/chunks/chunk-S7KYDPEM.js +0 -1564
  373. package/dist/chunks/chunk-SLPSPYVR.js +0 -334
  374. package/dist/chunks/chunk-SM3F3PYJ.js +0 -522
  375. package/dist/chunks/chunk-TO7QZGYK.js +0 -105
  376. package/dist/chunks/chunk-TSBUHSN7.js +0 -3495
  377. package/dist/chunks/chunk-TSFWMUCY.js +0 -506
  378. package/dist/chunks/chunk-TZ2YI2VH.js +0 -87
  379. package/dist/chunks/chunk-UG2WOB5L.js +0 -150
  380. package/dist/chunks/chunk-UNKHOYMF.js +0 -559
  381. package/dist/chunks/chunk-UOVWUSLG.js +0 -2099
  382. package/dist/chunks/chunk-V4RMJKQP.js +0 -36
  383. package/dist/chunks/chunk-VGIMO3ZK.js +0 -17
  384. package/dist/chunks/chunk-VGKSIKCC.js +0 -92
  385. package/dist/chunks/chunk-VP5Y3SZG.js +0 -106
  386. package/dist/chunks/chunk-VXYGCOKL.js +0 -28
  387. package/dist/chunks/chunk-W7FGI2GZ.js +0 -233
  388. package/dist/chunks/chunk-WGGABYO5.js +0 -31
  389. package/dist/chunks/chunk-XDGOOW3K.js +0 -60
  390. package/dist/chunks/chunk-XFF5TGRA.js +0 -303
  391. package/dist/chunks/chunk-XNIZGCN5.js +0 -58
  392. package/dist/chunks/chunk-XPJLPUKO.js +0 -117
  393. package/dist/chunks/chunk-XUAWTW4W.js +0 -467
  394. package/dist/chunks/chunk-YPQSDAEW.js +0 -29
  395. package/dist/chunks/chunk-YS76T533.js +0 -270
  396. package/dist/chunks/chunk-ZDU2NODC.js +0 -104
  397. package/dist/chunks/chunk-ZW6HETRE.js +0 -97
  398. package/dist/chunks/cjs-DV4RM7XU.js +0 -20743
  399. package/dist/chunks/clear-4IACMLFU.js +0 -141
  400. package/dist/chunks/compile-vercel-config-PQQ3OCLV.js +0 -33
  401. package/dist/chunks/config-BQQKMQBP.js +0 -168
  402. package/dist/chunks/config-OCPNHXQL.js +0 -127
  403. package/dist/chunks/delete-HRKIYPCO.js +0 -159
  404. package/dist/chunks/delete-P2UL3KTU.js +0 -226
  405. package/dist/chunks/detect-projects-ODNU4PK2.js +0 -18
  406. package/dist/chunks/detect-services-U7QGT7VO.js +0 -40
  407. package/dist/chunks/disable-3NYMICQ3.js +0 -198
  408. package/dist/chunks/discard-RNVEJUK3.js +0 -145
  409. package/dist/chunks/edit-63S2RQHR.js +0 -162
  410. package/dist/chunks/edit-CTENFZ7H.js +0 -647
  411. package/dist/chunks/enable-WILWXAHV.js +0 -204
  412. package/dist/chunks/exec-4IPHZ55G.js +0 -1291
  413. package/dist/chunks/export-YHGV3EPK.js +0 -177
  414. package/dist/chunks/fetch-proxy-R3JZNXBZ.js +0 -99
  415. package/dist/chunks/image-MWKS2YMB.js +0 -75
  416. package/dist/chunks/import-builders-H55X5VYD.js +0 -39
  417. package/dist/chunks/inspect-JTJMK6TO.js +0 -596
  418. package/dist/chunks/inspect-KBIPLMGR.js +0 -216
  419. package/dist/chunks/inspect-OP26FDBY.js +0 -171
  420. package/dist/chunks/inspect-SW4UMWTB.js +0 -175
  421. package/dist/chunks/inspect-WPLZPVBO.js +0 -145
  422. package/dist/chunks/list-HE7DWAWH.js +0 -387
  423. package/dist/chunks/list-OUG7WCT7.js +0 -404
  424. package/dist/chunks/list-QUSEURJZ.js +0 -426
  425. package/dist/chunks/login-MIIQJVF3.js +0 -233
  426. package/dist/chunks/ls-24N3DUK4.js +0 -183
  427. package/dist/chunks/ls-3Y7KEFKT.js +0 -175
  428. package/dist/chunks/ls-75F5HIJ5.js +0 -188
  429. package/dist/chunks/ls-REN6X2X5.js +0 -204
  430. package/dist/chunks/ls-W4STUDXK.js +0 -223
  431. package/dist/chunks/ls-Z4CTSD6C.js +0 -210
  432. package/dist/chunks/open-ARMCLPBK.js +0 -116
  433. package/dist/chunks/permissions-JKI67F62.js +0 -99
  434. package/dist/chunks/publish-SMSQ7OX2.js +0 -155
  435. package/dist/chunks/pull-4QZJZELD.js +0 -45
  436. package/dist/chunks/push-T6IYQY2J.js +0 -191
  437. package/dist/chunks/query-CP3JK5LW.js +0 -725
  438. package/dist/chunks/reorder-RAWKFGLV.js +0 -412
  439. package/dist/chunks/reply-235UHUD4.js +0 -176
  440. package/dist/chunks/resolve-5KCLN7QV.js +0 -237
  441. package/dist/chunks/resolve-deployment-framework-preset-NPE6RLV3.js +0 -36
  442. package/dist/chunks/restore-D24WAUAN.js +0 -252
  443. package/dist/chunks/rm-DBQDXSOC.js +0 -162
  444. package/dist/chunks/rm-G5INO77R.js +0 -148
  445. package/dist/chunks/rm-NLKSEKZ5.js +0 -195
  446. package/dist/chunks/rm-QV76CJA4.js +0 -322
  447. package/dist/chunks/rm-TZ4PDDUK.js +0 -147
  448. package/dist/chunks/routes-QVMBXOSX.js +0 -24
  449. package/dist/chunks/rule-inspect-76MC7I2D.js +0 -123
  450. package/dist/chunks/rules-IDUXVTPG.js +0 -89
  451. package/dist/chunks/schema-AV6BHGKY.js +0 -237
  452. package/dist/chunks/schema-QJVQTNB4.js +0 -381
  453. package/dist/chunks/set-L5NFQSCF.js +0 -250
  454. package/dist/chunks/setup-and-link-USSVDKCM.js +0 -65
  455. package/dist/chunks/stamp-AA7R3MZS.js +0 -16
  456. package/dist/chunks/tags-2NLUU4EC.js +0 -69
  457. package/dist/chunks/types-4GAJ7XQQ.js +0 -116
  458. package/dist/chunks/update-WGLBB65M.js +0 -224
  459. package/dist/chunks/vlt-builder-importer-USCFHWPL.js +0 -322
@@ -1,3495 +0,0 @@
1
- import { createRequire as __createRequire } from 'node:module';
2
- import { fileURLToPath as __fileURLToPath } from 'node:url';
3
- import { dirname as __dirname_ } from 'node:path';
4
- const require = __createRequire(import.meta.url);
5
- const __filename = __fileURLToPath(import.meta.url);
6
- const __dirname = __dirname_(__filename);
7
- import {
8
- getUpdateCommandInfo,
9
- isGlobal
10
- } from "./chunk-D5SMZXVO.js";
11
- import {
12
- progress,
13
- require_ci_info
14
- } from "./chunk-UNKHOYMF.js";
15
- import {
16
- writeToConfigFile
17
- } from "./chunk-UOVWUSLG.js";
18
- import {
19
- getGlobalPathConfig
20
- } from "./chunk-AINIBIP4.js";
21
- import {
22
- validateJsonOutput
23
- } from "./chunk-KXDWXXJH.js";
24
- import {
25
- apiCommand,
26
- listSubcommand4 as listSubcommand
27
- } from "./chunk-CFDDM4TX.js";
28
- import {
29
- require_semver
30
- } from "./chunk-IB5L4LKZ.js";
31
- import {
32
- require_chownr,
33
- require_mkdirp,
34
- require_pump,
35
- require_tar_stream
36
- } from "./chunk-N6HP5BLI.js";
37
- import {
38
- require_ms
39
- } from "./chunk-GGP5R3FU.js";
40
- import {
41
- help
42
- } from "./chunk-YS76T533.js";
43
- import {
44
- TelemetryClient
45
- } from "./chunk-HB4UKFDO.js";
46
- import {
47
- fetch as fetch2,
48
- toNodeReadable
49
- } from "./chunk-XNIZGCN5.js";
50
- import {
51
- printError
52
- } from "./chunk-3VM7HWF6.js";
53
- import {
54
- parseArguments
55
- } from "./chunk-57RHXXXG.js";
56
- import {
57
- getInstallRoot,
58
- isNativeBinaryInstall
59
- } from "./chunk-4IALDGB7.js";
60
- import {
61
- require_strip_ansi
62
- } from "./chunk-XPJLPUKO.js";
63
- import {
64
- getFlagsSpecification,
65
- packageName
66
- } from "./chunk-Q2DGFCO7.js";
67
- import {
68
- output_manager_default
69
- } from "./chunk-2JIX6UMI.js";
70
- import {
71
- pkg_default
72
- } from "./chunk-P4QNYOFB.js";
73
- import {
74
- require_source
75
- } from "./chunk-S7KYDPEM.js";
76
- import {
77
- __commonJS,
78
- __require,
79
- __toESM
80
- } from "./chunk-TZ2YI2VH.js";
81
-
82
- // ../../node_modules/.pnpm/tar-fs@1.16.5/node_modules/tar-fs/index.js
83
- var require_tar_fs = __commonJS({
84
- "../../node_modules/.pnpm/tar-fs@1.16.5/node_modules/tar-fs/index.js"(exports) {
85
- var chownr = require_chownr();
86
- var tar2 = require_tar_stream();
87
- var pump = require_pump();
88
- var mkdirp = require_mkdirp();
89
- var fs = __require("fs");
90
- var path = __require("path");
91
- var os = __require("os");
92
- var win32 = os.platform() === "win32";
93
- var noop = function() {
94
- };
95
- var echo = function(name) {
96
- return name;
97
- };
98
- var normalize = !win32 ? echo : function(name) {
99
- return name.replace(/\\/g, "/").replace(/[:?<>|]/g, "_");
100
- };
101
- var statAll = function(fs2, stat2, cwd, ignore, entries, sort) {
102
- var queue = entries || ["."];
103
- return function loop(callback) {
104
- if (!queue.length)
105
- return callback();
106
- var next = queue.shift();
107
- var nextAbs = path.join(cwd, next);
108
- stat2(nextAbs, function(err, stat3) {
109
- if (err)
110
- return callback(err);
111
- if (!stat3.isDirectory())
112
- return callback(null, next, stat3);
113
- fs2.readdir(nextAbs, function(err2, files) {
114
- if (err2)
115
- return callback(err2);
116
- if (sort)
117
- files.sort();
118
- for (var i = 0; i < files.length; i++) {
119
- if (!ignore(path.join(cwd, next, files[i])))
120
- queue.push(path.join(next, files[i]));
121
- }
122
- callback(null, next, stat3);
123
- });
124
- });
125
- };
126
- };
127
- var strip = function(map, level) {
128
- return function(header) {
129
- header.name = header.name.split("/").slice(level).join("/");
130
- var linkname = header.linkname;
131
- if (linkname && (header.type === "link" || path.isAbsolute(linkname))) {
132
- header.linkname = linkname.split("/").slice(level).join("/");
133
- }
134
- return map(header);
135
- };
136
- };
137
- exports.pack = function(cwd, opts) {
138
- if (!cwd)
139
- cwd = ".";
140
- if (!opts)
141
- opts = {};
142
- var xfs = opts.fs || fs;
143
- var ignore = opts.ignore || opts.filter || noop;
144
- var map = opts.map || noop;
145
- var mapStream = opts.mapStream || echo;
146
- var statNext = statAll(xfs, opts.dereference ? xfs.stat : xfs.lstat, cwd, ignore, opts.entries, opts.sort);
147
- var strict = opts.strict !== false;
148
- var umask = typeof opts.umask === "number" ? ~opts.umask : ~processUmask();
149
- var dmode = typeof opts.dmode === "number" ? opts.dmode : 0;
150
- var fmode = typeof opts.fmode === "number" ? opts.fmode : 0;
151
- var pack = opts.pack || tar2.pack();
152
- var finish = opts.finish || noop;
153
- if (opts.strip)
154
- map = strip(map, opts.strip);
155
- if (opts.readable) {
156
- dmode |= parseInt(555, 8);
157
- fmode |= parseInt(444, 8);
158
- }
159
- if (opts.writable) {
160
- dmode |= parseInt(333, 8);
161
- fmode |= parseInt(222, 8);
162
- }
163
- var onsymlink = function(filename, header) {
164
- xfs.readlink(path.join(cwd, filename), function(err, linkname) {
165
- if (err)
166
- return pack.destroy(err);
167
- header.linkname = normalize(linkname);
168
- pack.entry(header, onnextentry);
169
- });
170
- };
171
- var onstat = function(err, filename, stat2) {
172
- if (err)
173
- return pack.destroy(err);
174
- if (!filename) {
175
- if (opts.finalize !== false)
176
- pack.finalize();
177
- return finish(pack);
178
- }
179
- if (stat2.isSocket())
180
- return onnextentry();
181
- var header = {
182
- name: normalize(filename),
183
- mode: (stat2.mode | (stat2.isDirectory() ? dmode : fmode)) & umask,
184
- mtime: stat2.mtime,
185
- size: stat2.size,
186
- type: "file",
187
- uid: stat2.uid,
188
- gid: stat2.gid
189
- };
190
- if (stat2.isDirectory()) {
191
- header.size = 0;
192
- header.type = "directory";
193
- header = map(header) || header;
194
- return pack.entry(header, onnextentry);
195
- }
196
- if (stat2.isSymbolicLink()) {
197
- header.size = 0;
198
- header.type = "symlink";
199
- header = map(header) || header;
200
- return onsymlink(filename, header);
201
- }
202
- header = map(header) || header;
203
- if (!stat2.isFile()) {
204
- if (strict)
205
- return pack.destroy(new Error("unsupported type for " + filename));
206
- return onnextentry();
207
- }
208
- var entry = pack.entry(header, onnextentry);
209
- if (!entry)
210
- return;
211
- var rs = mapStream(xfs.createReadStream(path.join(cwd, filename)), header);
212
- rs.on("error", function(err2) {
213
- entry.destroy(err2);
214
- });
215
- pump(rs, entry);
216
- };
217
- var onnextentry = function(err) {
218
- if (err)
219
- return pack.destroy(err);
220
- statNext(onstat);
221
- };
222
- onnextentry();
223
- return pack;
224
- };
225
- var head = function(list) {
226
- return list.length ? list[list.length - 1] : null;
227
- };
228
- var processGetuid = function() {
229
- return process.getuid ? process.getuid() : -1;
230
- };
231
- var processUmask = function() {
232
- return process.umask ? process.umask() : 0;
233
- };
234
- exports.extract = function(cwd, opts) {
235
- if (!cwd)
236
- cwd = ".";
237
- if (!opts)
238
- opts = {};
239
- var xfs = opts.fs || fs;
240
- var ignore = opts.ignore || opts.filter || noop;
241
- var map = opts.map || noop;
242
- var mapStream = opts.mapStream || echo;
243
- var own = opts.chown !== false && !win32 && processGetuid() === 0;
244
- var extract = opts.extract || tar2.extract();
245
- var stack = [];
246
- var now = /* @__PURE__ */ new Date();
247
- var umask = typeof opts.umask === "number" ? ~opts.umask : ~processUmask();
248
- var dmode = typeof opts.dmode === "number" ? opts.dmode : 0;
249
- var fmode = typeof opts.fmode === "number" ? opts.fmode : 0;
250
- var strict = opts.strict !== false;
251
- if (opts.strip)
252
- map = strip(map, opts.strip);
253
- if (opts.readable) {
254
- dmode |= parseInt(555, 8);
255
- fmode |= parseInt(444, 8);
256
- }
257
- if (opts.writable) {
258
- dmode |= parseInt(333, 8);
259
- fmode |= parseInt(222, 8);
260
- }
261
- var utimesParent = function(name, cb) {
262
- var top;
263
- while ((top = head(stack)) && name.slice(0, top[0].length) !== top[0])
264
- stack.pop();
265
- if (!top)
266
- return cb();
267
- xfs.utimes(top[0], now, top[1], cb);
268
- };
269
- var utimes = function(name, header, cb) {
270
- if (opts.utimes === false)
271
- return cb();
272
- if (header.type === "directory")
273
- return xfs.utimes(name, now, header.mtime, cb);
274
- if (header.type === "symlink")
275
- return utimesParent(name, cb);
276
- xfs.utimes(name, now, header.mtime, function(err) {
277
- if (err)
278
- return cb(err);
279
- utimesParent(name, cb);
280
- });
281
- };
282
- var chperm = function(name, header, cb) {
283
- var link = header.type === "symlink";
284
- var chmod2 = link ? xfs.lchmod : xfs.chmod;
285
- var chown = link ? xfs.lchown : xfs.chown;
286
- if (!chmod2)
287
- return cb();
288
- var mode = (header.mode | (header.type === "directory" ? dmode : fmode)) & umask;
289
- chmod2(name, mode, function(err) {
290
- if (err)
291
- return cb(err);
292
- if (!own)
293
- return cb();
294
- if (!chown)
295
- return cb();
296
- chown(name, header.uid, header.gid, cb);
297
- });
298
- };
299
- extract.on("entry", function(header, stream, next) {
300
- header = map(header) || header;
301
- header.name = normalize(header.name);
302
- var name = path.join(cwd, path.join("/", header.name));
303
- if (ignore(name, header)) {
304
- stream.resume();
305
- return next();
306
- }
307
- var stat2 = function(err) {
308
- if (err)
309
- return next(err);
310
- utimes(name, header, function(err2) {
311
- if (err2)
312
- return next(err2);
313
- if (win32)
314
- return next();
315
- chperm(name, header, next);
316
- });
317
- };
318
- var onsymlink = function() {
319
- if (win32)
320
- return next();
321
- xfs.unlink(name, function() {
322
- var dst = path.resolve(path.dirname(name), header.linkname);
323
- if (!dst.startsWith(path.resolve(cwd)))
324
- return next(new Error(name + " is not a valid symlink"));
325
- xfs.symlink(header.linkname, name, stat2);
326
- });
327
- };
328
- var onlink = function() {
329
- if (win32)
330
- return next();
331
- xfs.unlink(name, function() {
332
- var srcpath = path.join(cwd, path.join("/", header.linkname));
333
- xfs.realpath(srcpath, function(err, dst) {
334
- if (err || !dst.startsWith(path.resolve(cwd)))
335
- return next(new Error(name + " is not a valid hardlink"));
336
- xfs.link(dst, name, function(err2) {
337
- if (err2 && err2.code === "EPERM" && opts.hardlinkAsFilesFallback) {
338
- stream = xfs.createReadStream(srcpath);
339
- return onfile();
340
- }
341
- stat2(err2);
342
- });
343
- });
344
- });
345
- };
346
- var onfile = function() {
347
- var ws = xfs.createWriteStream(name);
348
- var rs = mapStream(stream, header);
349
- ws.on("error", function(err) {
350
- rs.destroy(err);
351
- });
352
- pump(rs, ws, function(err) {
353
- if (err)
354
- return next(err);
355
- ws.on("close", stat2);
356
- });
357
- };
358
- if (header.type === "directory") {
359
- stack.push([name, header.mtime]);
360
- return mkdirfix(name, {
361
- fs: xfs,
362
- own,
363
- uid: header.uid,
364
- gid: header.gid
365
- }, stat2);
366
- }
367
- var dir = path.dirname(name);
368
- validate(xfs, dir, path.join(cwd, "."), function(err, valid) {
369
- if (err)
370
- return next(err);
371
- if (!valid)
372
- return next(new Error(dir + " is not a valid path"));
373
- mkdirfix(dir, {
374
- fs: xfs,
375
- own,
376
- uid: header.uid,
377
- gid: header.gid
378
- }, function(err2) {
379
- if (err2)
380
- return next(err2);
381
- switch (header.type) {
382
- case "file":
383
- return onfile();
384
- case "link":
385
- return onlink();
386
- case "symlink":
387
- return onsymlink();
388
- }
389
- if (strict)
390
- return next(new Error("unsupported type for " + name + " (" + header.type + ")"));
391
- stream.resume();
392
- next();
393
- });
394
- });
395
- });
396
- if (opts.finish)
397
- extract.on("finish", opts.finish);
398
- return extract;
399
- };
400
- function validate(fs2, name, root, cb) {
401
- if (name === root)
402
- return cb(null, true);
403
- fs2.lstat(name, function(err, st) {
404
- if (err && err.code !== "ENOENT")
405
- return cb(err);
406
- if (err || st.isDirectory())
407
- return validate(fs2, path.join(name, ".."), root, cb);
408
- cb(null, false);
409
- });
410
- }
411
- function mkdirfix(name, opts, cb) {
412
- mkdirp(name, { fs: opts.fs }, function(err, made) {
413
- if (!err && made && opts.own) {
414
- chownr(made, opts.uid, opts.gid, cb);
415
- } else {
416
- cb(err);
417
- }
418
- });
419
- }
420
- }
421
- });
422
-
423
- // ../../node_modules/.pnpm/jaro-winkler@0.2.8/node_modules/jaro-winkler/index.js
424
- var require_jaro_winkler = __commonJS({
425
- "../../node_modules/.pnpm/jaro-winkler@0.2.8/node_modules/jaro-winkler/index.js"(exports, module) {
426
- (function(root) {
427
- "use strict";
428
- function extend(a, b) {
429
- for (var property in b) {
430
- if (b.hasOwnProperty(property)) {
431
- a[property] = b[property];
432
- }
433
- }
434
- return a;
435
- }
436
- function distance2(s1, s2, options) {
437
- var m = 0;
438
- var defaults = { caseSensitive: true };
439
- var settings = extend(defaults, options);
440
- var i;
441
- var j;
442
- if (s1.length === 0 || s2.length === 0) {
443
- return 0;
444
- }
445
- if (!settings.caseSensitive) {
446
- s1 = s1.toUpperCase();
447
- s2 = s2.toUpperCase();
448
- }
449
- if (s1 === s2) {
450
- return 1;
451
- }
452
- var range = Math.floor(Math.max(s1.length, s2.length) / 2) - 1;
453
- var s1Matches = new Array(s1.length);
454
- var s2Matches = new Array(s2.length);
455
- for (i = 0; i < s1.length; i++) {
456
- var low = i >= range ? i - range : 0;
457
- var high = i + range <= s2.length - 1 ? i + range : s2.length - 1;
458
- for (j = low; j <= high; j++) {
459
- if (s1Matches[i] !== true && s2Matches[j] !== true && s1[i] === s2[j]) {
460
- ++m;
461
- s1Matches[i] = s2Matches[j] = true;
462
- break;
463
- }
464
- }
465
- }
466
- if (m === 0) {
467
- return 0;
468
- }
469
- var k = 0;
470
- var numTrans = 0;
471
- for (i = 0; i < s1.length; i++) {
472
- if (s1Matches[i] === true) {
473
- for (j = k; j < s2.length; j++) {
474
- if (s2Matches[j] === true) {
475
- k = j + 1;
476
- break;
477
- }
478
- }
479
- if (s1[i] !== s2[j]) {
480
- ++numTrans;
481
- }
482
- }
483
- }
484
- var weight = (m / s1.length + m / s2.length + (m - numTrans / 2) / m) / 3;
485
- var l = 0;
486
- var p = 0.1;
487
- if (weight > 0.7) {
488
- while (s1[l] === s2[l] && l < 4) {
489
- ++l;
490
- }
491
- weight = weight + l * p * (1 - weight);
492
- }
493
- return weight;
494
- }
495
- if (typeof define === "function" && define.amd) {
496
- define([], function() {
497
- return distance2;
498
- });
499
- } else if (typeof exports === "object") {
500
- module.exports = distance2;
501
- } else {
502
- root.distance = distance2;
503
- }
504
- })(exports);
505
- }
506
- });
507
-
508
- // src/util/openapi/openapi-cache.ts
509
- import { join } from "path";
510
- import { readFile, writeFile, mkdir } from "fs/promises";
511
-
512
- // src/util/openapi/constants.ts
513
- var OPENAPI_URL = "https://openapi.vercel.sh/";
514
- var SSO_API_URL = "https://vercel.com/sso-api";
515
- var CACHE_FILE = "openapi-spec.json";
516
- var CACHE_TTL_MS = 24 * 60 * 60 * 1e3;
517
- var FETCH_TIMEOUT_MS = 10 * 1e3;
518
- var MAX_OPENAPI_SPEC_BYTES = 50 * 1024 * 1024;
519
-
520
- // src/util/openapi/read-spec-response.ts
521
- async function readSpecResponse(response, url, maxBytes = MAX_OPENAPI_SPEC_BYTES) {
522
- const contentLength = response.headers.get("content-length");
523
- if (contentLength) {
524
- const bytes = Number(contentLength);
525
- if (Number.isFinite(bytes) && bytes > maxBytes) {
526
- throw new Error(
527
- `OpenAPI spec from ${url} exceeds the ${maxBytes} byte limit.`
528
- );
529
- }
530
- }
531
- if (!response.body) {
532
- throw new Error(`OpenAPI spec from ${url} returned an empty response.`);
533
- }
534
- const reader = response.body.getReader();
535
- const chunks = [];
536
- let totalBytes = 0;
537
- while (true) {
538
- const { done, value } = await reader.read();
539
- if (done) {
540
- break;
541
- }
542
- if (!value) {
543
- continue;
544
- }
545
- totalBytes += value.byteLength;
546
- if (totalBytes > maxBytes) {
547
- await reader.cancel();
548
- throw new Error(
549
- `OpenAPI spec from ${url} exceeds the ${maxBytes} byte limit.`
550
- );
551
- }
552
- chunks.push(value);
553
- }
554
- const buffer = new Uint8Array(totalBytes);
555
- let offset = 0;
556
- for (const chunk of chunks) {
557
- buffer.set(chunk, offset);
558
- offset += chunk.byteLength;
559
- }
560
- return JSON.parse(new TextDecoder().decode(buffer));
561
- }
562
-
563
- // src/util/openapi/spec-url-allowlist.ts
564
- var ALLOWED_SPEC_HOSTS = ["vercel.sh", "vercel.tools"];
565
- function assertAllowedSpecUrl(specUrl) {
566
- const parsedUrl = new URL(specUrl);
567
- if (parsedUrl.protocol !== "https:") {
568
- throw new Error("OpenAPI spec URL must use https");
569
- }
570
- if (!ALLOWED_SPEC_HOSTS.some((host) => isHostOrSubdomain(parsedUrl, host))) {
571
- throw new Error("OpenAPI spec URL must be on an allowed origin.");
572
- }
573
- return parsedUrl;
574
- }
575
- function isHostOrSubdomain(url, host) {
576
- return url.hostname === host || url.hostname.endsWith(`.${host}`);
577
- }
578
-
579
- // src/util/openapi/openapi-cache.ts
580
- var OpenApiCache = class {
581
- constructor(options) {
582
- this.spec = null;
583
- this.error = null;
584
- this.cachePath = join(getGlobalPathConfig(), CACHE_FILE);
585
- this.specUrl = options?.specUrl;
586
- this.fetchSpecUrl = options?.fetchSpecUrl;
587
- }
588
- /**
589
- * Check if the spec has been loaded
590
- */
591
- get isLoaded() {
592
- return this.spec !== null;
593
- }
594
- get loadError() {
595
- return this.error;
596
- }
597
- /**
598
- * Load the OpenAPI spec, using cache if available and fresh.
599
- * Returns true if successful, false otherwise.
600
- */
601
- async load(forceRefresh = false) {
602
- return this.loadSpec(forceRefresh);
603
- }
604
- async loadSpec(forceRefresh = false) {
605
- this.error = null;
606
- if (this.specUrl) {
607
- return this.loadCustomSpec(this.specUrl);
608
- }
609
- if (!forceRefresh) {
610
- const cached = await this.readCache(this.cachePath);
611
- if (cached && !this.isExpired(cached.fetchedAt)) {
612
- output_manager_default.debug("Using cached OpenAPI spec");
613
- this.spec = cached.spec;
614
- return true;
615
- }
616
- }
617
- try {
618
- output_manager_default.debug("Fetching OpenAPI spec from " + OPENAPI_URL);
619
- this.spec = await this.fetchSpec(OPENAPI_URL);
620
- await this.saveCache(this.cachePath, this.spec);
621
- return true;
622
- } catch (err) {
623
- output_manager_default.debug(`Failed to fetch OpenAPI spec: ${err}`);
624
- const stale = await this.readCache(this.cachePath);
625
- if (stale) {
626
- output_manager_default.debug("Using stale cached OpenAPI spec");
627
- this.spec = stale.spec;
628
- return true;
629
- }
630
- return false;
631
- }
632
- }
633
- async loadCustomSpec(specUrl) {
634
- try {
635
- assertAllowedSpecUrl(specUrl);
636
- output_manager_default.debug("Fetching OpenAPI spec from " + specUrl);
637
- const spec = this.fetchSpecUrl ? await this.fetchSpecUrl(specUrl) : await this.fetchSpec(specUrl);
638
- if (!spec) {
639
- this.error = `Could not load OpenAPI spec from ${specUrl}.`;
640
- return false;
641
- }
642
- this.validateSpec(spec, specUrl);
643
- this.spec = spec;
644
- return Boolean(this.spec);
645
- } catch (err) {
646
- const message = err instanceof Error ? err.message : String(err);
647
- this.error = message;
648
- output_manager_default.debug(`Failed to fetch OpenAPI spec from ${specUrl}: ${message}`);
649
- return false;
650
- }
651
- }
652
- /**
653
- * Load the OpenAPI spec with spinner UI.
654
- * Returns true if successful, false otherwise.
655
- */
656
- async loadWithSpinner(forceRefresh = false) {
657
- output_manager_default.spinner(
658
- forceRefresh ? "Refreshing API endpoints..." : "Loading API endpoints..."
659
- );
660
- const success = await this.load(forceRefresh);
661
- output_manager_default.stopSpinner();
662
- return success;
663
- }
664
- /**
665
- * Get all available endpoints from the loaded spec, sorted by path then method.
666
- * Throws if spec hasn't been loaded yet.
667
- */
668
- getEndpoints() {
669
- this.ensureLoaded();
670
- const endpoints = this.extractEndpoints();
671
- return this.sortEndpoints(endpoints);
672
- }
673
- /**
674
- * Extract body fields from a requestBody schema.
675
- * Throws if spec hasn't been loaded yet.
676
- */
677
- getBodyFields(endpoint) {
678
- this.ensureLoaded();
679
- if (!endpoint.requestBody?.content)
680
- return [];
681
- const jsonContent = endpoint.requestBody.content["application/json"];
682
- if (!jsonContent?.schema)
683
- return [];
684
- const schema = this.resolveSchemaRef(jsonContent.schema);
685
- if (!schema?.properties)
686
- return [];
687
- const requiredFields = new Set(schema.required || []);
688
- const fields = [];
689
- for (const [name, propSchema] of Object.entries(schema.properties)) {
690
- const resolvedProp = this.resolveSchemaRef(propSchema);
691
- let enumValues = resolvedProp?.enum || propSchema.enum;
692
- if (!enumValues && (resolvedProp?.type === "array" || propSchema.type === "array")) {
693
- const items = resolvedProp?.items || propSchema.items;
694
- if (items) {
695
- const resolvedItems = this.resolveSchemaRef(items);
696
- enumValues = resolvedItems?.enum || items.enum;
697
- }
698
- }
699
- fields.push({
700
- name,
701
- required: requiredFields.has(name),
702
- description: resolvedProp?.description || propSchema.description,
703
- type: resolvedProp?.type || propSchema.type,
704
- enumValues
705
- });
706
- }
707
- fields.sort((a, b) => {
708
- if (a.required !== b.required) {
709
- return a.required ? -1 : 1;
710
- }
711
- return a.name.localeCompare(b.name);
712
- });
713
- return fields;
714
- }
715
- /**
716
- * Extract `x-vercel-cli.displayColumns` from the 200 response schema of an
717
- * endpoint. Returns `null` when the spec has no display hint.
718
- */
719
- getDisplayColumns(endpoint) {
720
- this.ensureLoaded();
721
- const pathItem = this.spec.paths[endpoint.path];
722
- if (!pathItem)
723
- return null;
724
- const operation = pathItem[endpoint.method.toLowerCase()];
725
- if (!operation?.responses)
726
- return null;
727
- const ok = operation.responses["200"] || operation.responses["201"];
728
- if (!ok)
729
- return null;
730
- const jsonContent = ok.content?.["application/json"];
731
- if (!jsonContent?.schema)
732
- return null;
733
- return this.findDisplayColumns(jsonContent.schema);
734
- }
735
- findDisplayColumns(schema) {
736
- const xCli = schema["x-vercel-cli"];
737
- if (xCli?.displayColumns)
738
- return xCli.displayColumns;
739
- for (const key of ["oneOf", "allOf", "anyOf"]) {
740
- const variants = schema[key];
741
- if (variants) {
742
- for (const sub of variants) {
743
- const found = this.findDisplayColumns(sub);
744
- if (found)
745
- return found;
746
- }
747
- }
748
- }
749
- return null;
750
- }
751
- // ─────────────────────────────────────────────────────────────────────────────
752
- // Private methods
753
- // ─────────────────────────────────────────────────────────────────────────────
754
- /**
755
- * Ensure the spec is loaded before accessing it
756
- */
757
- ensureLoaded() {
758
- if (!this.spec) {
759
- throw new Error(
760
- "OpenAPI spec not loaded. Call load() or loadWithSpinner() first."
761
- );
762
- }
763
- }
764
- /**
765
- * Read cached spec from disk
766
- */
767
- async readCache(cachePath) {
768
- try {
769
- const content = await readFile(cachePath, "utf-8");
770
- return JSON.parse(content);
771
- } catch {
772
- return null;
773
- }
774
- }
775
- /**
776
- * Save public spec to disk cache
777
- */
778
- async saveCache(cachePath, spec) {
779
- const cached = {
780
- fetchedAt: Date.now(),
781
- spec
782
- };
783
- const dir = join(cachePath, "..");
784
- await mkdir(dir, { recursive: true });
785
- await writeFile(cachePath, JSON.stringify(cached));
786
- output_manager_default.debug("Saved OpenAPI spec to cache");
787
- }
788
- /**
789
- * Fetch OpenAPI spec from remote with timeout
790
- */
791
- async fetchSpec(url) {
792
- const controller = new AbortController();
793
- const timeoutId = setTimeout(() => controller.abort(), FETCH_TIMEOUT_MS);
794
- try {
795
- const response = await fetch(url, { signal: controller.signal });
796
- if (!response.ok) {
797
- throw new Error(`Failed to fetch OpenAPI spec: ${response.status}`);
798
- }
799
- const spec = await readSpecResponse(response, url);
800
- this.validateSpec(spec, url);
801
- return spec;
802
- } finally {
803
- clearTimeout(timeoutId);
804
- }
805
- }
806
- validateSpec(spec, url) {
807
- if (!spec || typeof spec !== "object") {
808
- throw new Error(
809
- `Invalid OpenAPI spec from ${url}: expected a JSON object.`
810
- );
811
- }
812
- if (typeof spec.openapi !== "string" || !spec.openapi.startsWith("3.")) {
813
- throw new Error(
814
- `Invalid OpenAPI spec from ${url}: expected an OpenAPI 3.x document with an "openapi" field.`
815
- );
816
- }
817
- if (!spec.paths || typeof spec.paths !== "object") {
818
- throw new Error(
819
- `Invalid OpenAPI spec from ${url}: expected a "paths" object.`
820
- );
821
- }
822
- for (const path of Object.keys(spec.paths)) {
823
- if (!path.startsWith("/") || path.startsWith("//")) {
824
- throw new Error(
825
- `Invalid OpenAPI spec from ${url}: path "${path}" must be a relative API path.`
826
- );
827
- }
828
- }
829
- }
830
- /**
831
- * Check if cached spec is expired
832
- */
833
- isExpired(fetchedAt) {
834
- return Date.now() - fetchedAt > CACHE_TTL_MS;
835
- }
836
- /**
837
- * Sort endpoints by path, then by method.
838
- */
839
- sortEndpoints(endpoints) {
840
- return endpoints.sort((a, b) => {
841
- const pathCompare = a.path.localeCompare(b.path);
842
- if (pathCompare !== 0)
843
- return pathCompare;
844
- return a.method.localeCompare(b.method);
845
- });
846
- }
847
- /**
848
- * Extract all available endpoints from the loaded spec.
849
- */
850
- extractEndpoints() {
851
- const endpoints = [];
852
- for (const [path, pathItem] of Object.entries(this.spec.paths)) {
853
- const methods = ["get", "post", "put", "patch", "delete"];
854
- for (const method of methods) {
855
- const operation = pathItem[method];
856
- if (operation) {
857
- const pathParams = pathItem.parameters || [];
858
- const opParams = operation.parameters || [];
859
- const allParams = [...pathParams, ...opParams];
860
- endpoints.push({
861
- path,
862
- method: method.toUpperCase(),
863
- summary: operation.summary || pathItem.summary || "",
864
- description: operation.description || pathItem.description || "",
865
- operationId: operation.operationId || "",
866
- tags: operation.tags || [],
867
- parameters: allParams,
868
- requestBody: operation.requestBody
869
- });
870
- }
871
- }
872
- }
873
- return endpoints;
874
- }
875
- /**
876
- * Resolve a $ref to its actual schema
877
- */
878
- resolveSchemaRef(schema, spec = this.spec) {
879
- if (!schema)
880
- return void 0;
881
- if (schema.$ref) {
882
- const match = schema.$ref.match(/^#\/components\/schemas\/(.+)$/);
883
- if (match && spec.components?.schemas) {
884
- const resolved = spec.components.schemas[match[1]];
885
- return this.resolveSchemaRef(resolved, spec);
886
- }
887
- return void 0;
888
- }
889
- if (schema.allOf && schema.allOf.length > 0) {
890
- const merged = { type: "object", properties: {}, required: [] };
891
- for (const subSchema of schema.allOf) {
892
- const resolved = this.resolveSchemaRef(subSchema, spec);
893
- if (resolved) {
894
- if (resolved.properties) {
895
- merged.properties = {
896
- ...merged.properties,
897
- ...resolved.properties
898
- };
899
- }
900
- if (resolved.required) {
901
- merged.required = [
902
- ...merged.required || [],
903
- ...resolved.required
904
- ];
905
- }
906
- }
907
- }
908
- return merged;
909
- }
910
- return schema;
911
- }
912
- };
913
-
914
- // src/util/openapi/matches-cli-api-tag.ts
915
- async function matchesCliApiTag(tagHint) {
916
- if (!tagHint || tagHint.startsWith("-") || tagHint.includes("/")) {
917
- return false;
918
- }
919
- const cache = new OpenApiCache();
920
- const loaded = await cache.load();
921
- if (!loaded) {
922
- return false;
923
- }
924
- const endpoints = cache.getEndpoints();
925
- const lower = tagHint.toLowerCase();
926
- return endpoints.some((ep) => ep.tags.some((t) => t.toLowerCase() === lower));
927
- }
928
- async function resolveOpenApiTagForProjectsCli() {
929
- if (await matchesCliApiTag("projects")) {
930
- return "projects";
931
- }
932
- if (await matchesCliApiTag("project")) {
933
- return "project";
934
- }
935
- return null;
936
- }
937
- async function resolveOpenApiTagForTeamsCli() {
938
- if (await matchesCliApiTag("teams")) {
939
- return "teams";
940
- }
941
- if (await matchesCliApiTag("team")) {
942
- return "team";
943
- }
944
- return null;
945
- }
946
-
947
- // src/commands/api/index.ts
948
- var import_chalk4 = __toESM(require_source(), 1);
949
-
950
- // src/util/telemetry/commands/api/index.ts
951
- var ApiTelemetryClient = class extends TelemetryClient {
952
- trackCliArgumentEndpoint(endpoint) {
953
- if (endpoint) {
954
- const normalized = this.normalizeEndpoint(endpoint);
955
- this.trackCliArgument({
956
- arg: "endpoint",
957
- value: normalized
958
- });
959
- }
960
- }
961
- trackCliArgumentOperationId(operationId) {
962
- if (operationId) {
963
- this.trackCliArgument({
964
- arg: "operationId",
965
- value: operationId
966
- });
967
- }
968
- }
969
- trackCliOptionMethod(method) {
970
- if (method) {
971
- const validMethods = ["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD"];
972
- const upperMethod = method.toUpperCase();
973
- const value = validMethods.includes(upperMethod) ? upperMethod : this.redactedValue;
974
- this.trackCliOption({
975
- option: "method",
976
- value
977
- });
978
- }
979
- }
980
- trackCliOptionField(fields) {
981
- if (fields && fields.length > 0) {
982
- this.trackCliOption({
983
- option: "field",
984
- value: this.redactedArgumentsLength(fields)
985
- });
986
- }
987
- }
988
- trackCliOptionRawField(fields) {
989
- if (fields && fields.length > 0) {
990
- this.trackCliOption({
991
- option: "raw-field",
992
- value: this.redactedArgumentsLength(fields)
993
- });
994
- }
995
- }
996
- trackCliOptionHeader(headers) {
997
- if (headers && headers.length > 0) {
998
- this.trackCliOption({
999
- option: "header",
1000
- value: this.redactedArgumentsLength(headers)
1001
- });
1002
- }
1003
- }
1004
- trackCliOptionInput(input) {
1005
- if (input) {
1006
- const value = input === "-" ? "stdin" : "file";
1007
- this.trackCliOption({
1008
- option: "input",
1009
- value
1010
- });
1011
- }
1012
- }
1013
- trackCliOptionSpecUrl(specUrl) {
1014
- if (specUrl) {
1015
- this.trackCliOption({
1016
- option: "spec-url",
1017
- value: this.redactedValue
1018
- });
1019
- }
1020
- }
1021
- trackCliFlagPaginate(value) {
1022
- if (value) {
1023
- this.trackCliFlag("paginate");
1024
- }
1025
- }
1026
- trackCliFlagInclude(value) {
1027
- if (value) {
1028
- this.trackCliFlag("include");
1029
- }
1030
- }
1031
- trackCliFlagSilent(value) {
1032
- if (value) {
1033
- this.trackCliFlag("silent");
1034
- }
1035
- }
1036
- trackCliFlagVerbose(value) {
1037
- if (value) {
1038
- this.trackCliFlag("verbose");
1039
- }
1040
- }
1041
- trackCliFlagRaw(value) {
1042
- if (value) {
1043
- this.trackCliFlag("raw");
1044
- }
1045
- }
1046
- trackCliFlagRefresh(value) {
1047
- if (value) {
1048
- this.trackCliFlag("refresh");
1049
- }
1050
- }
1051
- trackCliOptionGenerate(format) {
1052
- if (format) {
1053
- const validFormats = ["curl"];
1054
- const value = validFormats.includes(format) ? format : this.redactedValue;
1055
- this.trackCliOption({
1056
- option: "generate",
1057
- value
1058
- });
1059
- }
1060
- }
1061
- trackCliFlagDangerouslySkipPermissions(value) {
1062
- if (value) {
1063
- this.trackCliFlag("dangerously-skip-permissions");
1064
- }
1065
- }
1066
- trackCliSubcommandList() {
1067
- this.trackCliSubcommand({ subcommand: "list", value: "list" });
1068
- }
1069
- trackCliOptionFormat(format) {
1070
- if (format) {
1071
- const validFormats = ["table", "json"];
1072
- const value = validFormats.includes(format) ? format : this.redactedValue;
1073
- this.trackCliOption({
1074
- option: "format",
1075
- value
1076
- });
1077
- }
1078
- }
1079
- trackCliFlagJson(json) {
1080
- if (json) {
1081
- this.trackCliFlag("json");
1082
- }
1083
- }
1084
- /**
1085
- * Normalize endpoint by replacing IDs with placeholders for privacy
1086
- */
1087
- normalizeEndpoint(endpoint) {
1088
- return endpoint.replace(/\/dpl_[a-zA-Z0-9]+/g, "/:deploymentId").replace(/\/prj_[a-zA-Z0-9]+/g, "/:projectId").replace(/\/team_[a-zA-Z0-9]+/g, "/:teamId").replace(/\/[a-f0-9]{24}/g, "/:id").replace(/\/[a-f0-9-]{36}/g, "/:uuid");
1089
- }
1090
- };
1091
-
1092
- // src/commands/api/request-builder.ts
1093
- import { readFile as readFile2 } from "fs/promises";
1094
- import { resolve } from "path";
1095
- async function buildRequest(endpoint, flags) {
1096
- const headers = {};
1097
- let body;
1098
- const customHeaders = flags["--header"] || [];
1099
- for (const header of customHeaders) {
1100
- const colonIndex = header.indexOf(":");
1101
- if (colonIndex > 0) {
1102
- const key = header.substring(0, colonIndex).trim();
1103
- const value = header.substring(colonIndex + 1).trim();
1104
- headers[key] = value;
1105
- }
1106
- }
1107
- const fields = flags["--field"] || [];
1108
- const rawFields = flags["--raw-field"] || [];
1109
- if (fields.length > 0 || rawFields.length > 0) {
1110
- body = {};
1111
- for (const field of fields) {
1112
- const { key, value } = await parseField(field, true);
1113
- body[key] = value;
1114
- }
1115
- for (const field of rawFields) {
1116
- const { key, value } = await parseField(field, false);
1117
- body[key] = value;
1118
- }
1119
- }
1120
- if (flags["--input"]) {
1121
- const inputPath = flags["--input"];
1122
- if (inputPath === "-") {
1123
- body = await readStdin();
1124
- } else {
1125
- body = await readFile2(resolve(inputPath), "utf-8");
1126
- }
1127
- if (typeof body === "string") {
1128
- try {
1129
- body = JSON.parse(body);
1130
- } catch {
1131
- }
1132
- }
1133
- }
1134
- let method = flags["--method"]?.toUpperCase() || "GET";
1135
- if (!flags["--method"] && body) {
1136
- method = "POST";
1137
- }
1138
- return {
1139
- url: endpoint,
1140
- method,
1141
- headers,
1142
- body
1143
- };
1144
- }
1145
- async function parseCliKeyValueField(field, typed) {
1146
- return parseField(field, typed);
1147
- }
1148
- async function parseField(field, typed) {
1149
- const eqIndex = field.indexOf("=");
1150
- if (eqIndex === -1) {
1151
- throw new Error(`Invalid field format: ${field}. Expected key=value`);
1152
- }
1153
- const key = field.substring(0, eqIndex);
1154
- let value = field.substring(eqIndex + 1);
1155
- if (typed && typeof value === "string") {
1156
- if (value.startsWith("@")) {
1157
- const filePath = value.substring(1);
1158
- if (filePath === "-") {
1159
- value = await readStdin();
1160
- } else {
1161
- value = await readFile2(resolve(filePath), "utf-8");
1162
- }
1163
- if (typeof value === "string") {
1164
- try {
1165
- value = JSON.parse(value);
1166
- } catch {
1167
- }
1168
- }
1169
- } else if (value === "true") {
1170
- value = true;
1171
- } else if (value === "false") {
1172
- value = false;
1173
- } else if (value === "null") {
1174
- value = null;
1175
- } else if (/^-?\d+$/.test(value)) {
1176
- value = parseInt(value, 10);
1177
- } else if (/^-?\d*\.\d+$/.test(value)) {
1178
- value = parseFloat(value);
1179
- } else if (value.startsWith("[") || value.startsWith("{")) {
1180
- try {
1181
- value = JSON.parse(value);
1182
- } catch {
1183
- }
1184
- }
1185
- }
1186
- return { key, value };
1187
- }
1188
- async function readStdin() {
1189
- const chunks = [];
1190
- for await (const chunk of process.stdin) {
1191
- chunks.push(Buffer.from(chunk));
1192
- }
1193
- return Buffer.concat(chunks).toString(
1194
- "utf-8"
1195
- );
1196
- }
1197
- function formatOutput(data, options) {
1198
- if (options.raw) {
1199
- if (typeof data === "string") {
1200
- return data;
1201
- }
1202
- return JSON.stringify(data);
1203
- }
1204
- return JSON.stringify(data, null, 2);
1205
- }
1206
- function generateCurlCommand(config, baseUrl) {
1207
- const parts = ["curl"];
1208
- if (config.method !== "GET") {
1209
- parts.push(`-X ${config.method}`);
1210
- }
1211
- parts.push(`-H 'Authorization: Bearer <TOKEN>'`);
1212
- for (const [key, value] of Object.entries(config.headers)) {
1213
- parts.push(`-H '${key}: ${escapeShellArg(value)}'`);
1214
- }
1215
- if (config.method !== "GET" && config.body) {
1216
- const bodyStr = typeof config.body === "string" ? config.body : JSON.stringify(config.body);
1217
- parts.push(`-H 'Content-Type: application/json'`);
1218
- parts.push(`-d '${escapeShellArg(bodyStr)}'`);
1219
- }
1220
- const fullUrl = `${baseUrl}${config.url}`;
1221
- parts.push(`'${fullUrl}'`);
1222
- return parts.join(" \\\n ");
1223
- }
1224
- function escapeShellArg(str) {
1225
- return str.replace(/'/g, "'\\''");
1226
- }
1227
-
1228
- // src/commands/api/operation-request-builder.ts
1229
- import { readFile as readFile3 } from "fs/promises";
1230
- import { resolve as resolve2 } from "path";
1231
- var GLOBAL_CLI_QUERY_PARAMS = /* @__PURE__ */ new Set(["teamId", "slug"]);
1232
- async function parseOperationKeyValuePairs(endpoint, bodyFields, flags, positionalKeyValues) {
1233
- const pathParamNames = new Set(
1234
- endpoint.parameters.filter((p) => p.in === "path").map((p) => p.name)
1235
- );
1236
- const queryParamNames = new Set(
1237
- endpoint.parameters.filter((p) => p.in === "query").map((p) => p.name)
1238
- );
1239
- const headerParamNames = new Set(
1240
- endpoint.parameters.filter((p) => p.in === "header").map((p) => p.name)
1241
- );
1242
- const bodyFieldNames = new Set(bodyFields.map((f) => f.name));
1243
- const pathValues = {};
1244
- const queryValues = {};
1245
- const headerValues = {};
1246
- const body = {};
1247
- async function dispatchPair(field, typed) {
1248
- const eqIndex = field.indexOf("=");
1249
- if (eqIndex === -1) {
1250
- throw new Error(
1251
- `Invalid option "${field}". Expected key=value (or use flags -F / -f).`
1252
- );
1253
- }
1254
- const key = field.slice(0, eqIndex);
1255
- const param = endpoint.parameters.find((p) => p.name === key);
1256
- if (param?.in === "path") {
1257
- const { value } = await parseCliKeyValueField(field, false);
1258
- pathValues[key] = String(value);
1259
- return;
1260
- }
1261
- if (param?.in === "query") {
1262
- const { value } = await parseCliKeyValueField(field, typed);
1263
- queryValues[key] = typeof value === "object" && value !== null ? JSON.stringify(value) : String(value);
1264
- return;
1265
- }
1266
- if (param?.in === "header") {
1267
- const { value } = await parseCliKeyValueField(field, false);
1268
- headerValues[key] = String(value);
1269
- return;
1270
- }
1271
- if (param?.in === "cookie") {
1272
- throw new Error(
1273
- `Option "${key}" is cookie-based; set it via headers instead.`
1274
- );
1275
- }
1276
- if (bodyFieldNames.has(key)) {
1277
- const { value } = await parseCliKeyValueField(field, typed);
1278
- body[key] = value;
1279
- return;
1280
- }
1281
- if (!param && pathParamNames.has(key)) {
1282
- const { value } = await parseCliKeyValueField(field, false);
1283
- pathValues[key] = String(value);
1284
- return;
1285
- }
1286
- if (!param && queryParamNames.has(key)) {
1287
- const { value } = await parseCliKeyValueField(field, typed);
1288
- queryValues[key] = typeof value === "object" && value !== null ? JSON.stringify(value) : String(value);
1289
- return;
1290
- }
1291
- if (!param && headerParamNames.has(key)) {
1292
- const { value } = await parseCliKeyValueField(field, false);
1293
- headerValues[key] = String(value);
1294
- return;
1295
- }
1296
- throw new Error(
1297
- `Unknown option "${key}" for operation ${endpoint.operationId}. Check the API docs or run \`vercel api ls --json\`.`
1298
- );
1299
- }
1300
- for (const field of flags["--field"] || []) {
1301
- await dispatchPair(field, true);
1302
- }
1303
- for (const field of flags["--raw-field"] || []) {
1304
- await dispatchPair(field, false);
1305
- }
1306
- for (const field of positionalKeyValues) {
1307
- await dispatchPair(field, true);
1308
- }
1309
- return { pathValues, queryValues, headerValues, body };
1310
- }
1311
- function getMissingRequiredOperationParams(endpoint, bodyFields, parsed, flags) {
1312
- const pathParams = endpoint.parameters.filter((p) => p.in === "path");
1313
- const missingPath = pathParams.filter(
1314
- (p) => parsed.pathValues[p.name] === void 0
1315
- );
1316
- const requiredQuery = endpoint.parameters.filter(
1317
- (p) => p.in === "query" && p.required && !GLOBAL_CLI_QUERY_PARAMS.has(p.name)
1318
- );
1319
- const missingQuery = requiredQuery.filter(
1320
- (p) => parsed.queryValues[p.name] === void 0
1321
- );
1322
- const requiredHeader = endpoint.parameters.filter(
1323
- (p) => p.in === "header" && p.required
1324
- );
1325
- const missingHeader = requiredHeader.filter(
1326
- (p) => parsed.headerValues[p.name] === void 0
1327
- );
1328
- const missingBody = bodyFields.filter(
1329
- (f) => f.required && parsed.body[f.name] === void 0 && !flags["--input"]
1330
- );
1331
- return {
1332
- path: missingPath,
1333
- query: missingQuery,
1334
- header: missingHeader,
1335
- body: missingBody
1336
- };
1337
- }
1338
- function getUnsetOptionalOperationParams(endpoint, bodyFields, parsed, flags) {
1339
- const unsetQuery = endpoint.parameters.filter(
1340
- (p) => p.in === "query" && parsed.queryValues[p.name] === void 0 && (!p.required || GLOBAL_CLI_QUERY_PARAMS.has(p.name))
1341
- );
1342
- const unsetHeader = endpoint.parameters.filter(
1343
- (p) => p.in === "header" && !p.required && parsed.headerValues[p.name] === void 0
1344
- );
1345
- const unsetBody = bodyFields.filter(
1346
- (f) => !f.required && parsed.body[f.name] === void 0 && !flags["--input"]
1347
- );
1348
- return {
1349
- query: unsetQuery,
1350
- header: unsetHeader,
1351
- body: unsetBody
1352
- };
1353
- }
1354
- async function buildRequestForResolvedOperation(endpoint, bodyFields, flags, positionalKeyValues) {
1355
- const headers = {};
1356
- const customHeaders = flags["--header"] || [];
1357
- for (const header of customHeaders) {
1358
- const colonIndex = header.indexOf(":");
1359
- if (colonIndex > 0) {
1360
- const key = header.substring(0, colonIndex).trim();
1361
- const value = header.substring(colonIndex + 1).trim();
1362
- headers[key] = value;
1363
- }
1364
- }
1365
- const method = (flags["--method"]?.toUpperCase() || endpoint.method).toUpperCase();
1366
- const pathParamNames = new Set(
1367
- endpoint.parameters.filter((p) => p.in === "path").map((p) => p.name)
1368
- );
1369
- const parsed = await parseOperationKeyValuePairs(
1370
- endpoint,
1371
- bodyFields,
1372
- flags,
1373
- positionalKeyValues
1374
- );
1375
- const { pathValues, queryValues, headerValues, body } = parsed;
1376
- for (const [k, v] of Object.entries(headerValues)) {
1377
- headers[k] = v;
1378
- }
1379
- let urlPath = endpoint.path;
1380
- for (const name of pathParamNames) {
1381
- const value = pathValues[name];
1382
- if (value === void 0) {
1383
- throw new Error(
1384
- `Missing required path option {${name}} for ${endpoint.operationId}.`
1385
- );
1386
- }
1387
- urlPath = urlPath.replace(`{${name}}`, encodeURIComponent(value));
1388
- }
1389
- if (/\{[^}]+\}/.test(urlPath)) {
1390
- throw new Error(
1391
- `Unresolved path placeholders in ${urlPath}. Provide values for all path options.`
1392
- );
1393
- }
1394
- const requiredQuery = endpoint.parameters.filter(
1395
- (p) => p.in === "query" && p.required && !GLOBAL_CLI_QUERY_PARAMS.has(p.name)
1396
- );
1397
- for (const p of requiredQuery) {
1398
- if (queryValues[p.name] === void 0) {
1399
- throw new Error(
1400
- `Missing required query option "${p.name}" for ${endpoint.operationId}.`
1401
- );
1402
- }
1403
- }
1404
- const requiredHeader = endpoint.parameters.filter(
1405
- (h) => h.in === "header" && h.required
1406
- );
1407
- for (const h of requiredHeader) {
1408
- if (headerValues[h.name] === void 0) {
1409
- throw new Error(
1410
- `Missing required header option "${h.name}" for ${endpoint.operationId}.`
1411
- );
1412
- }
1413
- }
1414
- const requiredBody = bodyFields.filter((f) => f.required);
1415
- for (const f of requiredBody) {
1416
- if (body[f.name] === void 0 && !flags["--input"]) {
1417
- throw new Error(
1418
- `Missing required body option "${f.name}" for ${endpoint.operationId}.`
1419
- );
1420
- }
1421
- }
1422
- const queryString = new URLSearchParams(queryValues).toString();
1423
- if (queryString) {
1424
- urlPath += (urlPath.includes("?") ? "&" : "?") + queryString;
1425
- }
1426
- let finalBody = Object.keys(body).length > 0 ? body : void 0;
1427
- if (flags["--input"]) {
1428
- const inputPath = flags["--input"];
1429
- let inputBody;
1430
- if (inputPath === "-") {
1431
- inputBody = await readStdin();
1432
- } else {
1433
- inputBody = await readFile3(resolve2(inputPath), "utf-8");
1434
- }
1435
- if (typeof inputBody === "string") {
1436
- try {
1437
- finalBody = JSON.parse(inputBody);
1438
- } catch {
1439
- finalBody = inputBody;
1440
- }
1441
- } else {
1442
- finalBody = inputBody;
1443
- }
1444
- }
1445
- if (method === "GET" || method === "HEAD") {
1446
- finalBody = void 0;
1447
- }
1448
- return {
1449
- url: urlPath,
1450
- method,
1451
- headers,
1452
- body: finalBody
1453
- };
1454
- }
1455
-
1456
- // src/util/openapi/spec-url.ts
1457
- import { createHash } from "crypto";
1458
- var MAX_REDIRECTS = 3;
1459
- async function fetchSpecUrl(client, specUrl) {
1460
- const specOrigin = assertAllowedSpecUrl(specUrl).origin;
1461
- const probe = await fetchWithTimeout(specUrl, { readSpec: true });
1462
- if (probe.response.ok) {
1463
- return probe.spec ?? null;
1464
- }
1465
- const nonce = getSetCookieValue(probe.response, "_vercel_sso_nonce");
1466
- if (!nonce) {
1467
- output_manager_default.debug(
1468
- `OpenAPI spec URL returned ${probe.response.status} without a Vercel SSO nonce`
1469
- );
1470
- throw new Error(formatHttpError(specUrl, probe.response));
1471
- }
1472
- const token = client.authConfig.token;
1473
- if (!token) {
1474
- output_manager_default.debug("OpenAPI spec URL requires Vercel authentication");
1475
- return null;
1476
- }
1477
- const hashedNonce = createHash("sha256").update(nonce).digest("hex");
1478
- const ssoUrl = `${SSO_API_URL}?url=${encodeURIComponent(
1479
- specUrl
1480
- )}&nonce=${hashedNonce}`;
1481
- const sso = await fetchWithTimeout(ssoUrl, {
1482
- cookie: `authorization=${encodeURIComponent(`Bearer ${token}`)}; isLoggedIn=1`
1483
- });
1484
- const location = sso.response.headers.get("location");
1485
- if (!location || !location.includes("_vercel_jwt=")) {
1486
- output_manager_default.debug("OpenAPI spec URL: user has no access");
1487
- throw new Error(formatHttpError(specUrl, sso.response));
1488
- }
1489
- const cookies = /* @__PURE__ */ new Map([["_vercel_sso_nonce", nonce]]);
1490
- let url = location;
1491
- for (let i = 0; i <= MAX_REDIRECTS; i++) {
1492
- if (!isSameOriginUrl(url, specOrigin)) {
1493
- output_manager_default.debug("OpenAPI spec URL: cross-origin redirect rejected");
1494
- return null;
1495
- }
1496
- const { response, spec } = await fetchWithTimeout(url, {
1497
- cookie: Array.from(cookies, ([name, value]) => `${name}=${value}`).join(
1498
- "; "
1499
- ),
1500
- readSpec: true
1501
- });
1502
- if (response.ok) {
1503
- return spec ?? null;
1504
- }
1505
- const next = response.headers.get("location");
1506
- if (response.status >= 300 && response.status < 400 && next) {
1507
- const setJwt = getSetCookieValue(response, "_vercel_jwt");
1508
- if (setJwt) {
1509
- cookies.set("_vercel_jwt", setJwt);
1510
- }
1511
- const nextUrl = new URL(next, url).href;
1512
- if (!isSameOriginUrl(nextUrl, specOrigin)) {
1513
- output_manager_default.debug("OpenAPI spec URL: cross-origin redirect rejected");
1514
- return null;
1515
- }
1516
- url = nextUrl;
1517
- continue;
1518
- }
1519
- output_manager_default.debug(`OpenAPI spec URL: unexpected response ${response.status}`);
1520
- throw new Error(formatHttpError(url, response));
1521
- }
1522
- output_manager_default.debug("OpenAPI spec URL: too many redirects");
1523
- return null;
1524
- }
1525
- function createOpenApiCache(client, specUrl) {
1526
- return new OpenApiCache(
1527
- specUrl ? {
1528
- specUrl,
1529
- fetchSpecUrl: (url) => fetchSpecUrl(client, url)
1530
- } : void 0
1531
- );
1532
- }
1533
- async function fetchWithTimeout(url, options) {
1534
- const controller = new AbortController();
1535
- const timeoutId = setTimeout(() => controller.abort(), FETCH_TIMEOUT_MS);
1536
- try {
1537
- const response = await fetch(url, {
1538
- redirect: "manual",
1539
- signal: controller.signal,
1540
- headers: options?.cookie ? { cookie: options.cookie } : void 0
1541
- });
1542
- const spec = options?.readSpec && response.ok ? await readSpecResponse(
1543
- response,
1544
- formatDiagnosticUrl(url)
1545
- ) : void 0;
1546
- return { response, spec };
1547
- } finally {
1548
- clearTimeout(timeoutId);
1549
- }
1550
- }
1551
- function isSameOriginUrl(url, origin) {
1552
- try {
1553
- return new URL(url).origin === origin;
1554
- } catch {
1555
- return false;
1556
- }
1557
- }
1558
- function formatHttpError(url, response) {
1559
- const statusText = response.statusText ? ` ${response.statusText}` : "";
1560
- return `Could not load OpenAPI spec from ${formatDiagnosticUrl(url)}: HTTP ${response.status}${statusText}.`;
1561
- }
1562
- function formatDiagnosticUrl(url) {
1563
- try {
1564
- const parsed = new URL(url);
1565
- parsed.hash = "";
1566
- for (const key of parsed.searchParams.keys()) {
1567
- parsed.searchParams.set(key, "[redacted]");
1568
- }
1569
- return parsed.href;
1570
- } catch {
1571
- return url;
1572
- }
1573
- }
1574
- function getSetCookieValue(response, name) {
1575
- const header = response.headers.get("set-cookie");
1576
- if (!header) {
1577
- return null;
1578
- }
1579
- const match = header.match(new RegExp(`${name}=([^;,\\s]+)`));
1580
- return match ? match[1] : null;
1581
- }
1582
-
1583
- // src/util/openapi/vercel-cli-table.ts
1584
- var import_ms = __toESM(require_ms(), 1);
1585
- var import_chalk = __toESM(require_source(), 1);
1586
-
1587
- // src/util/openapi/resolve-by-tag-operation.ts
1588
- function resolveEndpointByTagAndOperationId(endpoints, tag, operationHint) {
1589
- const tagLower = tag.toLowerCase();
1590
- const tagMatches = endpoints.filter(
1591
- (ep) => ep.tags.some((t) => t.toLowerCase() === tagLower)
1592
- );
1593
- if (tagMatches.length === 0) {
1594
- return {
1595
- ok: false,
1596
- reason: "no_tag",
1597
- tag,
1598
- tagMatches: [],
1599
- operationHint
1600
- };
1601
- }
1602
- const withOpId = tagMatches.filter((ep) => ep.operationId.length > 0);
1603
- if (withOpId.length === 0) {
1604
- return {
1605
- ok: false,
1606
- reason: "no_operation",
1607
- tag,
1608
- tagMatches,
1609
- operationHint
1610
- };
1611
- }
1612
- const hint = operationHint.trim();
1613
- const hintLower = hint.toLowerCase();
1614
- const exact = withOpId.filter((ep) => ep.operationId === hint);
1615
- if (exact.length === 1) {
1616
- return { ok: true, endpoint: exact[0] };
1617
- }
1618
- if (exact.length > 1) {
1619
- return {
1620
- ok: false,
1621
- reason: "ambiguous_operation",
1622
- tag,
1623
- tagMatches: exact,
1624
- operationHint: hint
1625
- };
1626
- }
1627
- const exactCi = withOpId.filter(
1628
- (ep) => ep.operationId.toLowerCase() === hintLower
1629
- );
1630
- if (exactCi.length === 1) {
1631
- return { ok: true, endpoint: exactCi[0] };
1632
- }
1633
- if (exactCi.length > 1) {
1634
- return {
1635
- ok: false,
1636
- reason: "ambiguous_operation",
1637
- tag,
1638
- tagMatches: exactCi,
1639
- operationHint: hint
1640
- };
1641
- }
1642
- return {
1643
- ok: false,
1644
- reason: "no_operation",
1645
- tag,
1646
- tagMatches,
1647
- operationHint: hint
1648
- };
1649
- }
1650
-
1651
- // src/util/openapi/try-openapi-fallback.ts
1652
- async function tryOpenApiFallback(client, cliArgs, resolveTag) {
1653
- if (!process.env.VERCEL_AUTO_API) {
1654
- return null;
1655
- }
1656
- const operationHint = cliArgs[0];
1657
- if (!operationHint || operationHint.startsWith("-")) {
1658
- return null;
1659
- }
1660
- const tag = await resolveTag();
1661
- if (!tag) {
1662
- return null;
1663
- }
1664
- const apiFlagsSpec = getFlagsSpecification(apiCommand.options);
1665
- let apiParsed;
1666
- try {
1667
- apiParsed = parseArguments(client.argv.slice(2), apiFlagsSpec, {
1668
- permissive: true
1669
- });
1670
- } catch {
1671
- return null;
1672
- }
1673
- const flags = apiParsed.flags;
1674
- if (flags["--dangerously-skip-permissions"]) {
1675
- client.dangerouslySkipPermissions = true;
1676
- }
1677
- if (flags["--help"]) {
1678
- return printOperationHelpForTagCommand(client, flags, tag, operationHint);
1679
- }
1680
- return runTagOperation(client, {
1681
- tag,
1682
- operationId: operationHint,
1683
- flags,
1684
- positionalOperationFields: cliArgs.slice(1)
1685
- });
1686
- }
1687
-
1688
- // src/commands/api/constants.ts
1689
- var API_BASE_URL = "https://api.vercel.com";
1690
-
1691
- // src/commands/api/format-utils.ts
1692
- var import_chalk2 = __toESM(require_source(), 1);
1693
- function colorizeMethod(method) {
1694
- switch (method) {
1695
- case "GET":
1696
- return import_chalk2.default.cyan(method);
1697
- case "POST":
1698
- return import_chalk2.default.green(method);
1699
- case "PUT":
1700
- return import_chalk2.default.yellow(method);
1701
- case "PATCH":
1702
- return import_chalk2.default.blue(method);
1703
- case "DELETE":
1704
- return import_chalk2.default.red(method);
1705
- default:
1706
- return method;
1707
- }
1708
- }
1709
- function colorizeMethodPadded(method, width = 7) {
1710
- const colored = colorizeMethod(method);
1711
- const padding = " ".repeat(Math.max(0, width - method.length));
1712
- return colored + padding;
1713
- }
1714
- function formatPathParam(paramName) {
1715
- return import_chalk2.default.cyan(`{${paramName}}`);
1716
- }
1717
- function formatTypeHint(type) {
1718
- return import_chalk2.default.dim(`[${type}]`);
1719
- }
1720
- function formatDescription(description) {
1721
- if (!description)
1722
- return "";
1723
- return import_chalk2.default.gray(` (${description})`);
1724
- }
1725
-
1726
- // src/commands/api/display-columns.ts
1727
- var import_chalk3 = __toESM(require_source(), 1);
1728
- function getByPath(obj, path) {
1729
- let current = obj;
1730
- for (const segment of path.split(".")) {
1731
- if (current == null || typeof current !== "object")
1732
- return void 0;
1733
- current = current[segment];
1734
- }
1735
- return current;
1736
- }
1737
- function parseArrayColumns(data, columns) {
1738
- const entries = Object.entries(columns);
1739
- const first = entries[0];
1740
- if (!first)
1741
- return null;
1742
- const bracketIdx = first[1].indexOf("[].");
1743
- if (bracketIdx === -1)
1744
- return null;
1745
- const arrayKey = first[1].slice(0, bracketIdx);
1746
- const rowColumns = {};
1747
- for (const [label, path] of entries) {
1748
- const prefix = path.slice(0, bracketIdx);
1749
- if (prefix !== arrayKey || !path.startsWith(prefix + "[].")) {
1750
- return null;
1751
- }
1752
- rowColumns[label] = path.slice(bracketIdx + 3);
1753
- }
1754
- const arr = getByPath(data, arrayKey);
1755
- if (!Array.isArray(arr))
1756
- return null;
1757
- return { rows: arr, rowColumns };
1758
- }
1759
- function formatValue(value) {
1760
- if (value === null || value === void 0)
1761
- return import_chalk3.default.dim("\u2013");
1762
- if (typeof value === "number") {
1763
- if (value > 1e12 && value < 2e12) {
1764
- return new Date(value).toISOString();
1765
- }
1766
- return String(value);
1767
- }
1768
- if (typeof value === "boolean")
1769
- return String(value);
1770
- if (typeof value === "string")
1771
- return value;
1772
- return JSON.stringify(value);
1773
- }
1774
- function renderCard(data, columns) {
1775
- const entries = Object.entries(columns);
1776
- const maxLabel = Math.max(...entries.map(([label]) => label.length));
1777
- const lines = entries.map(([label, path]) => {
1778
- const value = getByPath(data, path);
1779
- return ` ${import_chalk3.default.gray(label.padEnd(maxLabel))} ${formatValue(value)}`;
1780
- });
1781
- return lines.join("\n");
1782
- }
1783
- function renderTable(rows, columns) {
1784
- const entries = Object.entries(columns);
1785
- const headerRow = entries.map(([label]) => label);
1786
- const dataRows = rows.map(
1787
- (row) => entries.map(([, path]) => formatValue(getByPath(row, path)))
1788
- );
1789
- const widths = entries.map(([label], colIdx) => {
1790
- const dataMax = dataRows.reduce(
1791
- (max, row) => Math.max(max, stripAnsi(row[colIdx]).length),
1792
- 0
1793
- );
1794
- return Math.max(label.length, dataMax);
1795
- });
1796
- const header = headerRow.map((h, i) => import_chalk3.default.bold(h.padEnd(widths[i]))).join(" ");
1797
- const body = dataRows.map(
1798
- (row) => row.map((cell, i) => {
1799
- const pad = widths[i] - stripAnsi(cell).length;
1800
- return cell + " ".repeat(Math.max(0, pad));
1801
- }).join(" ")
1802
- );
1803
- return [header, ...body].join("\n");
1804
- }
1805
- function stripAnsi(str) {
1806
- return str.replace(/\x1b\[[0-9;]*m/g, "");
1807
- }
1808
-
1809
- // src/commands/api/index.ts
1810
- async function api(client) {
1811
- const telemetryClient = new ApiTelemetryClient({
1812
- opts: { store: client.telemetryEventStore }
1813
- });
1814
- let parsedArgs;
1815
- const flagsSpec = getFlagsSpecification(apiCommand.options);
1816
- try {
1817
- parsedArgs = parseArguments(client.argv.slice(2), flagsSpec, {
1818
- permissive: true
1819
- });
1820
- } catch (err) {
1821
- printError(err);
1822
- return 1;
1823
- }
1824
- const { args, flags } = parsedArgs;
1825
- const needHelp = flags["--help"];
1826
- const firstArg = args[1];
1827
- if (firstArg === "ls" || firstArg === "list") {
1828
- const lsFlagsSpec = getFlagsSpecification(listSubcommand.options);
1829
- let lsParsedArgs;
1830
- try {
1831
- lsParsedArgs = parseArguments(client.argv.slice(2), lsFlagsSpec);
1832
- } catch (err) {
1833
- printError(err);
1834
- return 1;
1835
- }
1836
- const lsFlags = lsParsedArgs.flags;
1837
- if (lsFlags["--help"]) {
1838
- telemetryClient.trackCliFlagHelp("api", firstArg);
1839
- output_manager_default.print(
1840
- help(listSubcommand, {
1841
- parent: apiCommand,
1842
- columns: client.stderr.columns
1843
- })
1844
- );
1845
- return 2;
1846
- }
1847
- const formatResult = validateJsonOutput(lsFlags);
1848
- if (!formatResult.valid) {
1849
- output_manager_default.error(formatResult.error);
1850
- return 1;
1851
- }
1852
- telemetryClient.trackCliSubcommandList();
1853
- if (lsFlags["--refresh"])
1854
- telemetryClient.trackCliFlagRefresh(true);
1855
- if (lsFlags["--format"])
1856
- telemetryClient.trackCliOptionFormat(lsFlags["--format"]);
1857
- telemetryClient.trackCliFlagJson(lsFlags["--json"]);
1858
- if (lsFlags["--spec-url"])
1859
- telemetryClient.trackCliOptionSpecUrl(lsFlags["--spec-url"]);
1860
- return listEndpoints(
1861
- client,
1862
- lsFlags["--refresh"] ?? false,
1863
- lsFlags["--spec-url"],
1864
- formatResult.jsonOutput ? "json" : "table"
1865
- );
1866
- }
1867
- if (needHelp) {
1868
- telemetryClient.trackCliFlagHelp("api");
1869
- output_manager_default.print(help(apiCommand, { columns: client.stderr.columns }));
1870
- return 2;
1871
- }
1872
- if (flags["--dangerously-skip-permissions"]) {
1873
- client.dangerouslySkipPermissions = true;
1874
- }
1875
- let endpoint;
1876
- let selectedMethod;
1877
- let selectedBodyFields = [];
1878
- if (!firstArg) {
1879
- if (client.stdin.isTTY) {
1880
- const selected = await promptEndpointSelection(
1881
- client,
1882
- flags["--refresh"] ?? false,
1883
- flags["--spec-url"]
1884
- );
1885
- if (!selected) {
1886
- return 1;
1887
- }
1888
- endpoint = selected.finalUrl;
1889
- selectedMethod = selected.method;
1890
- selectedBodyFields = selected.bodyFields;
1891
- } else {
1892
- output_manager_default.error("Endpoint is required. Usage: vercel api <endpoint>");
1893
- return 1;
1894
- }
1895
- } else {
1896
- endpoint = firstArg;
1897
- }
1898
- if (endpoint && !endpoint.startsWith("/")) {
1899
- output_manager_default.error(
1900
- `Invalid arguments. Use an API path starting with /, or run \`${packageName} api\` interactively.`
1901
- );
1902
- return 1;
1903
- }
1904
- try {
1905
- const resolvedUrl = new URL(endpoint, API_BASE_URL);
1906
- if (resolvedUrl.origin !== API_BASE_URL) {
1907
- output_manager_default.error(
1908
- "Invalid endpoint: must be a Vercel API path, not an external URL"
1909
- );
1910
- return 1;
1911
- }
1912
- } catch {
1913
- output_manager_default.error("Invalid endpoint URL format");
1914
- return 1;
1915
- }
1916
- const finalFlags = { ...flags };
1917
- if (selectedMethod && !flags["--method"]) {
1918
- finalFlags["--method"] = selectedMethod;
1919
- }
1920
- if (selectedBodyFields.length > 0) {
1921
- const existingFields = finalFlags["--field"] || [];
1922
- finalFlags["--field"] = [...existingFields, ...selectedBodyFields];
1923
- }
1924
- let requestConfig;
1925
- try {
1926
- requestConfig = await buildRequest(endpoint, finalFlags);
1927
- } catch (err) {
1928
- printError(err);
1929
- return 1;
1930
- }
1931
- telemetryClient.trackCliArgumentEndpoint(requestConfig.url);
1932
- telemetryClient.trackCliArgumentOperationId(void 0);
1933
- telemetryClient.trackCliOptionMethod(flags["--method"]);
1934
- telemetryClient.trackCliOptionHeader(flags["--header"]);
1935
- telemetryClient.trackCliOptionInput(flags["--input"]);
1936
- if (flags["--paginate"])
1937
- telemetryClient.trackCliFlagPaginate(true);
1938
- if (flags["--include"])
1939
- telemetryClient.trackCliFlagInclude(true);
1940
- if (flags["--silent"])
1941
- telemetryClient.trackCliFlagSilent(true);
1942
- if (flags["--verbose"])
1943
- telemetryClient.trackCliFlagVerbose(true);
1944
- if (flags["--raw"])
1945
- telemetryClient.trackCliFlagRaw(true);
1946
- if (flags["--refresh"])
1947
- telemetryClient.trackCliFlagRefresh(true);
1948
- if (flags["--spec-url"])
1949
- telemetryClient.trackCliOptionSpecUrl(flags["--spec-url"]);
1950
- if (flags["--generate"])
1951
- telemetryClient.trackCliOptionGenerate(flags["--generate"]);
1952
- if (flags["--dangerously-skip-permissions"])
1953
- telemetryClient.trackCliFlagDangerouslySkipPermissions(true);
1954
- if (flags["--generate"] === "curl") {
1955
- const curlCmd = generateCurlCommand(
1956
- requestConfig,
1957
- "https://api.vercel.com"
1958
- );
1959
- output_manager_default.log("");
1960
- output_manager_default.log("Replace <TOKEN> with your auth token:");
1961
- output_manager_default.log("");
1962
- client.stdout.write(curlCmd + "\n");
1963
- return 0;
1964
- }
1965
- return executeApiRequest(client, requestConfig, finalFlags);
1966
- }
1967
- async function printOperationHelpForTagCommand(client, flags, tag, operationId) {
1968
- const openApi = createOpenApiCache(client, flags["--spec-url"]);
1969
- const loaded = await openApi.loadWithSpinner(flags["--refresh"] ?? false);
1970
- if (!loaded) {
1971
- output_manager_default.error(openApi.loadError ?? "Could not load API specification");
1972
- return 1;
1973
- }
1974
- const allEndpoints = openApi.getEndpoints();
1975
- const resolved = resolveEndpointByTagAndOperationId(
1976
- allEndpoints,
1977
- tag,
1978
- operationId
1979
- );
1980
- if (!resolved.ok) {
1981
- printTagOperationResolveError(resolved, allEndpoints);
1982
- return 1;
1983
- }
1984
- const ep = resolved.endpoint;
1985
- const bodyFields = openApi.getBodyFields(ep);
1986
- printOperationHelpDetails(ep, bodyFields, tag);
1987
- return 2;
1988
- }
1989
- function printOperationHelpDetails(ep, bodyFields, tag) {
1990
- const lines = [];
1991
- lines.push("");
1992
- lines.push(import_chalk4.default.bold(ep.operationId || "(operation)"));
1993
- const blurb = ep.summary?.trim() || ep.description?.trim();
1994
- if (blurb) {
1995
- lines.push("");
1996
- lines.push(import_chalk4.default.dim(blurb));
1997
- }
1998
- lines.push("");
1999
- lines.push(import_chalk4.default.bold("Options"));
2000
- lines.push("");
2001
- const pathParams = ep.parameters.filter((p) => p.in === "path");
2002
- const orderedParams = [
2003
- ...pathParams,
2004
- ...ep.parameters.filter((p) => p.in === "query"),
2005
- ...ep.parameters.filter((p) => p.in === "header"),
2006
- ...ep.parameters.filter((p) => p.in === "cookie")
2007
- ];
2008
- for (const p of orderedParams) {
2009
- const globalNote = p.in === "query" && GLOBAL_CLI_QUERY_PARAMS.has(p.name) ? import_chalk4.default.dim(" (often set via --scope)") : "";
2010
- let reqLabel;
2011
- if (p.in === "query") {
2012
- reqLabel = p.required && !GLOBAL_CLI_QUERY_PARAMS.has(p.name) ? import_chalk4.default.red("required") : import_chalk4.default.dim("optional");
2013
- } else if (p.in === "path") {
2014
- reqLabel = p.required !== false ? import_chalk4.default.red("required") : import_chalk4.default.dim("optional");
2015
- } else if (p.in === "header") {
2016
- reqLabel = p.required ? import_chalk4.default.red("required") : import_chalk4.default.dim("optional");
2017
- } else {
2018
- reqLabel = p.required ? import_chalk4.default.red("required") : import_chalk4.default.dim("optional");
2019
- }
2020
- lines.push(
2021
- ` ${import_chalk4.default.cyan(p.name)} ${reqLabel}${globalNote}${formatDescription(p.description)}`
2022
- );
2023
- }
2024
- for (const f of bodyFields) {
2025
- const req = f.required ? import_chalk4.default.red("required") : import_chalk4.default.dim("optional");
2026
- const typeHint = f.type ? ` ${formatTypeHint(f.type)}` : "";
2027
- lines.push(
2028
- ` ${import_chalk4.default.cyan(f.name)} ${req}${typeHint}${formatDescription(f.description)}`
2029
- );
2030
- }
2031
- if (orderedParams.length === 0 && bodyFields.length === 0) {
2032
- lines.push(import_chalk4.default.dim(" (none)"));
2033
- }
2034
- lines.push("");
2035
- lines.push(import_chalk4.default.bold("Example"));
2036
- const exampleSuffix = pathParams.length > 0 ? ` ${pathParams.map((p) => `${p.name}=<value>`).join(" ")}` : "";
2037
- lines.push(
2038
- import_chalk4.default.dim(` ${packageName} api ${tag} ${ep.operationId}${exampleSuffix}`)
2039
- );
2040
- lines.push("");
2041
- output_manager_default.print(lines.join("\n"));
2042
- }
2043
- function printMissingOperationParamsHelp(endpoint, missing) {
2044
- output_manager_default.error(
2045
- `Missing required options for operation ${import_chalk4.default.bold(endpoint.operationId)}.`
2046
- );
2047
- output_manager_default.log(
2048
- import_chalk4.default.dim(
2049
- `Pass each as key=value after the operationId, or use -F key=value. Example: \`${packageName} api ${endpoint.tags[0] ?? "tag"} ${endpoint.operationId} idOrName=my-project\``
2050
- )
2051
- );
2052
- output_manager_default.log("");
2053
- output_manager_default.log(import_chalk4.default.bold("Options"));
2054
- output_manager_default.log("");
2055
- for (const p of missing.path) {
2056
- output_manager_default.log(` ${import_chalk4.default.cyan(p.name)}${formatDescription(p.description)}`);
2057
- }
2058
- for (const p of missing.header) {
2059
- output_manager_default.log(` ${import_chalk4.default.cyan(p.name)}${formatDescription(p.description)}`);
2060
- }
2061
- for (const p of missing.query) {
2062
- output_manager_default.log(` ${import_chalk4.default.cyan(p.name)}${formatDescription(p.description)}`);
2063
- }
2064
- for (const f of missing.body) {
2065
- const typeHint = f.type ? ` ${formatTypeHint(f.type)}` : "";
2066
- output_manager_default.log(
2067
- ` ${import_chalk4.default.cyan(f.name)}${typeHint}${formatDescription(f.description)}`
2068
- );
2069
- }
2070
- output_manager_default.log("");
2071
- }
2072
- async function promptMissingParamsForTagOperation(client, endpoint, bodyFields, flags, positionalKeyValues) {
2073
- const pos = [...positionalKeyValues];
2074
- while (true) {
2075
- const parsed = await (async () => {
2076
- try {
2077
- return await parseOperationKeyValuePairs(
2078
- endpoint,
2079
- bodyFields,
2080
- flags,
2081
- pos
2082
- );
2083
- } catch (err) {
2084
- printError(err);
2085
- return null;
2086
- }
2087
- })();
2088
- if (parsed === null) {
2089
- return null;
2090
- }
2091
- const missing = getMissingRequiredOperationParams(
2092
- endpoint,
2093
- bodyFields,
2094
- parsed,
2095
- flags
2096
- );
2097
- if (missing.path.length === 0 && missing.query.length === 0 && missing.header.length === 0 && missing.body.length === 0) {
2098
- break;
2099
- }
2100
- for (const param of missing.path) {
2101
- const value = await client.input.text({
2102
- message: `Enter value for ${formatPathParam(param.name)}${formatDescription(param.description)}:`,
2103
- validate: createRequiredValidator(param.name)
2104
- });
2105
- pos.push(`${param.name}=${value}`);
2106
- }
2107
- for (const param of missing.header) {
2108
- const value = await client.input.text({
2109
- message: `Enter value for header ${import_chalk4.default.cyan(param.name)}${formatDescription(param.description)}:`,
2110
- validate: createRequiredValidator(param.name)
2111
- });
2112
- pos.push(`${param.name}=${value}`);
2113
- }
2114
- for (const param of missing.query) {
2115
- const value = await client.input.text({
2116
- message: `Enter value for ${import_chalk4.default.cyan(param.name)}${formatDescription(param.description)}:`,
2117
- validate: createRequiredValidator(param.name)
2118
- });
2119
- pos.push(`${param.name}=${value}`);
2120
- }
2121
- for (const field of missing.body) {
2122
- const value = await promptForBodyField(client, field, true);
2123
- pos.push(`${field.name}=${value}`);
2124
- }
2125
- }
2126
- return promptUnsetOptionalParamsForTagOperation(
2127
- client,
2128
- endpoint,
2129
- bodyFields,
2130
- flags,
2131
- pos
2132
- );
2133
- }
2134
- async function promptUnsetOptionalParamsForTagOperation(client, endpoint, bodyFields, flags, positionalKeyValues) {
2135
- const pos = [...positionalKeyValues];
2136
- const parsed = await (async () => {
2137
- try {
2138
- return await parseOperationKeyValuePairs(
2139
- endpoint,
2140
- bodyFields,
2141
- flags,
2142
- pos
2143
- );
2144
- } catch (err) {
2145
- printError(err);
2146
- return null;
2147
- }
2148
- })();
2149
- if (parsed === null) {
2150
- return null;
2151
- }
2152
- const unset = getUnsetOptionalOperationParams(
2153
- endpoint,
2154
- bodyFields,
2155
- parsed,
2156
- flags
2157
- );
2158
- if (unset.query.length === 0 && unset.header.length === 0 && unset.body.length === 0) {
2159
- return pos;
2160
- }
2161
- if (unset.query.length > 0) {
2162
- const selected = await client.input.checkbox({
2163
- message: "Select optional query parameters to include:",
2164
- pageSize: 20,
2165
- choices: unset.query.map((p) => ({
2166
- name: `${import_chalk4.default.cyan(p.name)}${GLOBAL_CLI_QUERY_PARAMS.has(p.name) ? import_chalk4.default.dim(" (team / scope; omit to use CLI default)") : ""}${formatDescription(p.description)}`,
2167
- value: p.name
2168
- }))
2169
- });
2170
- for (const paramName of selected) {
2171
- const param = unset.query.find((p) => p.name === paramName);
2172
- const value = await client.input.text({
2173
- message: `Enter value for ${import_chalk4.default.cyan(param.name)}${formatDescription(param.description)}:`,
2174
- validate: createRequiredValidator(param.name)
2175
- });
2176
- pos.push(`${param.name}=${value}`);
2177
- }
2178
- }
2179
- if (unset.header.length > 0) {
2180
- const selected = await client.input.checkbox({
2181
- message: "Select optional header parameters to include:",
2182
- pageSize: 20,
2183
- choices: unset.header.map((p) => ({
2184
- name: `${import_chalk4.default.cyan(p.name)}${formatDescription(p.description)}`,
2185
- value: p.name
2186
- }))
2187
- });
2188
- for (const paramName of selected) {
2189
- const param = unset.header.find((p) => p.name === paramName);
2190
- const value = await client.input.text({
2191
- message: `Enter value for header ${import_chalk4.default.cyan(param.name)}${formatDescription(param.description)}:`,
2192
- validate: createRequiredValidator(param.name)
2193
- });
2194
- pos.push(`${param.name}=${value}`);
2195
- }
2196
- }
2197
- if (unset.body.length > 0) {
2198
- const selected = await client.input.checkbox({
2199
- message: "Select optional body fields to include:",
2200
- pageSize: 20,
2201
- choices: unset.body.map((f) => ({
2202
- name: `${import_chalk4.default.cyan(f.name)}${f.type ? ` ${formatTypeHint(f.type)}` : ""}${formatDescription(f.description)}`,
2203
- value: f.name
2204
- }))
2205
- });
2206
- for (const fieldName of selected) {
2207
- const field = unset.body.find((f) => f.name === fieldName);
2208
- const value = await promptForBodyField(client, field, true);
2209
- pos.push(`${field.name}=${value}`);
2210
- }
2211
- }
2212
- return pos;
2213
- }
2214
- function printTagOperationResolveError(result, allEndpoints) {
2215
- if (result.reason === "no_tag") {
2216
- const tags = [...new Set(allEndpoints.flatMap((ep) => ep.tags || []))].sort();
2217
- const preview = tags.slice(0, 25).join(", ");
2218
- output_manager_default.error(
2219
- `No operations use tag "${result.tag}".${tags.length > 0 ? ` Example tags: ${preview}${tags.length > 25 ? ", \u2026" : ""}.` : ""} Run \`vercel api ls --json\` to inspect tags.`
2220
- );
2221
- return;
2222
- }
2223
- if (result.reason === "no_operation") {
2224
- const ids = result.tagMatches.map((ep) => ep.operationId).filter(Boolean).sort();
2225
- output_manager_default.error(
2226
- `No operation matches "${result.operationHint}" under tag "${result.tag}".${ids.length > 0 ? ` Operations include: ${ids.slice(0, 20).join(", ")}${ids.length > 20 ? ", \u2026" : ""}.` : ""}`
2227
- );
2228
- return;
2229
- }
2230
- const lines = result.tagMatches.map(
2231
- (ep) => ` ${ep.operationId} ${ep.method} ${ep.path}`
2232
- );
2233
- output_manager_default.error(
2234
- `Multiple operations match "${result.operationHint}" under tag "${result.tag}":
2235
- ${lines.join("\n")}`
2236
- );
2237
- }
2238
- async function executeApiRequest(client, requestConfig, flags, displayColumns, options) {
2239
- if (flags["--verbose"]) {
2240
- output_manager_default.debug(`Request: ${requestConfig.method} ${requestConfig.url}`);
2241
- if (Object.keys(requestConfig.headers).length > 0) {
2242
- output_manager_default.debug(`Headers: ${JSON.stringify(requestConfig.headers)}`);
2243
- }
2244
- if (requestConfig.body) {
2245
- output_manager_default.debug(
2246
- `Body: ${typeof requestConfig.body === "string" ? requestConfig.body : JSON.stringify(requestConfig.body)}`
2247
- );
2248
- }
2249
- }
2250
- if (flags["--paginate"]) {
2251
- return executePaginatedRequest(client, requestConfig, flags);
2252
- }
2253
- return executeSingleRequest(
2254
- client,
2255
- requestConfig,
2256
- flags,
2257
- displayColumns,
2258
- options
2259
- );
2260
- }
2261
- async function executeSingleRequest(client, config, flags, displayColumns, options) {
2262
- try {
2263
- const confirmed = await client.confirmMutatingOperation(
2264
- config.url,
2265
- config.method
2266
- );
2267
- if (!confirmed) {
2268
- return 1;
2269
- }
2270
- const response = await client.fetch(config.url, {
2271
- method: config.method,
2272
- body: config.body,
2273
- headers: config.headers,
2274
- json: false
2275
- });
2276
- return handleResponse(
2277
- client,
2278
- response,
2279
- flags,
2280
- config.method,
2281
- displayColumns,
2282
- options
2283
- );
2284
- } catch (err) {
2285
- output_manager_default.prettyError(err);
2286
- return 1;
2287
- }
2288
- }
2289
- async function executePaginatedRequest(client, config, flags) {
2290
- const results = [];
2291
- try {
2292
- const confirmed = await client.confirmMutatingOperation(
2293
- config.url,
2294
- config.method
2295
- );
2296
- if (!confirmed) {
2297
- return 1;
2298
- }
2299
- for await (const page of client.fetchPaginated(
2300
- config.url,
2301
- {
2302
- method: config.method,
2303
- body: config.body,
2304
- headers: config.headers
2305
- }
2306
- )) {
2307
- const data = extractPaginatedData(page);
2308
- results.push(...data);
2309
- }
2310
- return outputResults(client, results, flags);
2311
- } catch (err) {
2312
- output_manager_default.prettyError(err);
2313
- return 1;
2314
- }
2315
- }
2316
- function extractPaginatedData(page) {
2317
- for (const [key, value] of Object.entries(page)) {
2318
- if (key !== "pagination" && Array.isArray(value)) {
2319
- return value;
2320
- }
2321
- }
2322
- const { pagination, ...rest } = page;
2323
- return [rest];
2324
- }
2325
- async function handleResponse(client, response, flags, method, displayColumns, options) {
2326
- if (flags["--include"]) {
2327
- outputHeaders(client, response);
2328
- }
2329
- if (flags["--silent"]) {
2330
- return response.ok ? 0 : 1;
2331
- }
2332
- const contentType = response.headers.get("content-type") || "";
2333
- const isMutation = options?.tagOperation && method !== "GET";
2334
- if (contentType.includes("application/json")) {
2335
- const json = await response.json();
2336
- if (flags["--verbose"]) {
2337
- output_manager_default.debug(
2338
- `Response status: ${response.status} ${response.statusText}`
2339
- );
2340
- }
2341
- if (displayColumns && response.ok && !flags["--raw"]) {
2342
- return outputWithDisplayColumns(client, json, displayColumns);
2343
- }
2344
- if (isMutation && !flags["--raw"]) {
2345
- if (!response.ok) {
2346
- return outputMutationResult(client, response, method, json);
2347
- }
2348
- return outputMutationResult(client, response, method);
2349
- }
2350
- return outputResults(client, json, flags);
2351
- }
2352
- const text = await response.text();
2353
- if (isMutation && !flags["--raw"]) {
2354
- return outputMutationResult(
2355
- client,
2356
- response,
2357
- method,
2358
- response.ok ? void 0 : text
2359
- );
2360
- }
2361
- client.stdout.write(text);
2362
- return response.ok ? 0 : 1;
2363
- }
2364
- function outputHeaders(client, response) {
2365
- client.stdout.write(`HTTP ${response.status} ${response.statusText}
2366
- `);
2367
- response.headers.forEach((value, key) => {
2368
- client.stdout.write(`${key}: ${value}
2369
- `);
2370
- });
2371
- client.stdout.write("\n");
2372
- }
2373
- function outputWithDisplayColumns(client, data, columns) {
2374
- const parsed = parseArrayColumns(data, columns);
2375
- if (parsed) {
2376
- client.stdout.write(renderTable(parsed.rows, parsed.rowColumns) + "\n");
2377
- return 0;
2378
- }
2379
- if (Array.isArray(data)) {
2380
- client.stdout.write(renderTable(data, columns) + "\n");
2381
- } else if (data && typeof data === "object") {
2382
- client.stdout.write(renderCard(data, columns) + "\n");
2383
- } else {
2384
- client.stdout.write(formatOutput(data, {}) + "\n");
2385
- }
2386
- return 0;
2387
- }
2388
- function outputMutationResult(client, response, method, errorBody) {
2389
- const verb = method === "POST" ? "Created" : method === "PATCH" || method === "PUT" ? "Updated" : method === "DELETE" ? "Deleted" : "Done";
2390
- if (response.ok) {
2391
- client.stdout.write(
2392
- `${import_chalk4.default.green("Success")} ${verb} ${import_chalk4.default.dim(`(${response.status})`)}
2393
- `
2394
- );
2395
- return 0;
2396
- }
2397
- const errorMessage = extractErrorMessage(errorBody);
2398
- const statusLine = `${import_chalk4.default.red("Error")} ${response.status} ${response.statusText}`;
2399
- client.stdout.write(
2400
- errorMessage ? `${statusLine}
2401
- ${import_chalk4.default.dim(errorMessage)}
2402
- ` : `${statusLine}
2403
- `
2404
- );
2405
- return 1;
2406
- }
2407
- function extractErrorMessage(body) {
2408
- if (!body)
2409
- return null;
2410
- if (typeof body === "string")
2411
- return body;
2412
- if (typeof body === "object" && body !== null) {
2413
- const obj = body;
2414
- if (typeof obj.message === "string")
2415
- return obj.message;
2416
- const err = obj.error;
2417
- if (err && typeof err.message === "string")
2418
- return err.message;
2419
- }
2420
- return null;
2421
- }
2422
- function outputResults(client, data, flags) {
2423
- const formatted = formatOutput(data, {
2424
- raw: flags["--raw"]
2425
- });
2426
- client.stdout.write(formatted + "\n");
2427
- return 0;
2428
- }
2429
- async function promptEndpointSelection(client, forceRefresh, specUrl) {
2430
- try {
2431
- const openApi = createOpenApiCache(client, specUrl);
2432
- const success = await openApi.loadWithSpinner(forceRefresh);
2433
- if (!success) {
2434
- output_manager_default.error(
2435
- openApi.loadError ?? "Could not load API specification for endpoint selection"
2436
- );
2437
- return null;
2438
- }
2439
- const endpoints = openApi.getEndpoints();
2440
- const selectedEndpoint = await promptForEndpoint(client, endpoints);
2441
- const bodyFieldsSpec = openApi.getBodyFields(selectedEndpoint);
2442
- const { finalUrl, bodyFields } = await promptForParameters(
2443
- client,
2444
- selectedEndpoint.path,
2445
- selectedEndpoint.parameters,
2446
- bodyFieldsSpec
2447
- );
2448
- return {
2449
- path: selectedEndpoint.path,
2450
- method: selectedEndpoint.method,
2451
- finalUrl,
2452
- bodyFields
2453
- };
2454
- } catch (err) {
2455
- output_manager_default.stopSpinner();
2456
- output_manager_default.debug(`Endpoint selection failed: ${err}`);
2457
- return null;
2458
- }
2459
- }
2460
- async function promptForEndpoint(client, endpoints) {
2461
- const total = endpoints.length;
2462
- const buildChoices = () => endpoints.map((ep) => ({
2463
- name: `${colorizeMethodPadded(ep.method)} ${ep.path}`,
2464
- value: ep,
2465
- // Show full description if available, otherwise show summary
2466
- description: ep.description || ep.summary || void 0,
2467
- // Include summary in searchable metadata
2468
- summary: ep.summary,
2469
- tags: ep.tags
2470
- }));
2471
- return client.input.search({
2472
- message: `Search for an API endpoint (${total} available):`,
2473
- source: async (term) => {
2474
- const allChoices = buildChoices();
2475
- if (!term) {
2476
- return allChoices;
2477
- }
2478
- const lowerTerm = term.toLowerCase();
2479
- return allChoices.filter((choice) => {
2480
- const searchableText = [
2481
- choice.name,
2482
- choice.summary || "",
2483
- choice.description || "",
2484
- ...choice.tags || []
2485
- ].join(" ").toLowerCase();
2486
- return searchableText.includes(lowerTerm);
2487
- });
2488
- }
2489
- });
2490
- }
2491
- async function listEndpoints(client, forceRefresh, specUrl, format) {
2492
- const openApi = createOpenApiCache(client, specUrl);
2493
- const success = await openApi.loadWithSpinner(forceRefresh);
2494
- if (!success) {
2495
- output_manager_default.error(openApi.loadError ?? "Could not load API specification");
2496
- return 1;
2497
- }
2498
- const endpoints = openApi.getEndpoints();
2499
- if (format === "json") {
2500
- return outputEndpointsAsJson(client, endpoints);
2501
- }
2502
- return outputEndpointsAsTable(endpoints);
2503
- }
2504
- function outputEndpointsAsJson(client, endpoints) {
2505
- const jsonOutput = endpoints.map((ep) => ({
2506
- method: ep.method,
2507
- path: ep.path,
2508
- summary: ep.summary || null,
2509
- description: ep.description || null,
2510
- operationId: ep.operationId || null,
2511
- tags: ep.tags
2512
- }));
2513
- client.stdout.write(JSON.stringify(jsonOutput, null, 2) + "\n");
2514
- return 0;
2515
- }
2516
- function groupEndpointsByPath(endpoints) {
2517
- const grouped = /* @__PURE__ */ new Map();
2518
- for (const ep of endpoints) {
2519
- const existing = grouped.get(ep.path) || [];
2520
- existing.push({
2521
- method: ep.method,
2522
- summary: ep.summary
2523
- });
2524
- grouped.set(ep.path, existing);
2525
- }
2526
- const methodOrder = ["GET", "POST", "PUT", "PATCH", "DELETE"];
2527
- for (const [path, methods] of grouped) {
2528
- methods.sort(
2529
- (a, b) => methodOrder.indexOf(a.method) - methodOrder.indexOf(b.method)
2530
- );
2531
- grouped.set(path, methods);
2532
- }
2533
- return grouped;
2534
- }
2535
- function outputEndpointsAsTable(endpoints) {
2536
- const grouped = groupEndpointsByPath(endpoints);
2537
- const methodWidth = 7;
2538
- output_manager_default.log("");
2539
- for (const [path, methods] of grouped) {
2540
- output_manager_default.log(import_chalk4.default.bold(path));
2541
- for (const { method, summary } of methods) {
2542
- const coloredMethod = colorizeMethod(method);
2543
- const paddedMethod = method.padEnd(methodWidth);
2544
- const methodDisplay = coloredMethod + paddedMethod.slice(method.length);
2545
- output_manager_default.log(` ${methodDisplay} ${import_chalk4.default.gray(summary || "")}`);
2546
- }
2547
- output_manager_default.log("");
2548
- }
2549
- output_manager_default.log(
2550
- `${import_chalk4.default.bold(grouped.size.toString())} routes, ${import_chalk4.default.bold(endpoints.length.toString())} endpoints`
2551
- );
2552
- return 0;
2553
- }
2554
- function createRequiredValidator(fieldName) {
2555
- return (input) => {
2556
- if (!input.trim()) {
2557
- return `${fieldName} is required`;
2558
- }
2559
- return true;
2560
- };
2561
- }
2562
- function buildQueryString(params) {
2563
- return Object.entries(params).map(([k, v]) => `${encodeURIComponent(k)}=${encodeURIComponent(v)}`).join("&");
2564
- }
2565
- async function promptForParameters(client, path, parameters, bodyFieldsSpec) {
2566
- const globalParams = /* @__PURE__ */ new Set(["teamId", "slug"]);
2567
- const pathParams = parameters.filter((p) => p.in === "path");
2568
- const requiredQueryParams = parameters.filter(
2569
- (p) => p.in === "query" && p.required && !globalParams.has(p.name)
2570
- );
2571
- const optionalQueryParams = parameters.filter(
2572
- (p) => p.in === "query" && !p.required && !globalParams.has(p.name)
2573
- );
2574
- const requiredBodyFields = bodyFieldsSpec.filter((f) => f.required);
2575
- const optionalBodyFields = bodyFieldsSpec.filter((f) => !f.required);
2576
- let finalPath = path;
2577
- for (const param of pathParams) {
2578
- const value = await promptForParameterValue(
2579
- client,
2580
- param,
2581
- `Enter value for ${formatPathParam(param.name)}${formatDescription(param.description)}:`
2582
- );
2583
- finalPath = finalPath.replace(`{${param.name}}`, encodeURIComponent(value));
2584
- }
2585
- const queryValues = {};
2586
- for (const param of requiredQueryParams) {
2587
- queryValues[param.name] = await promptForParameterValue(
2588
- client,
2589
- param,
2590
- `Enter value for ${import_chalk4.default.cyan(param.name)}${formatDescription(param.description)}:`
2591
- );
2592
- }
2593
- if (optionalQueryParams.length > 0) {
2594
- const selectedOptionalParams = await client.input.checkbox({
2595
- message: "Select optional query parameters to include:",
2596
- pageSize: 20,
2597
- choices: optionalQueryParams.map((p) => ({
2598
- name: `${import_chalk4.default.cyan(p.name)}${formatDescription(p.description)}`,
2599
- value: p.name
2600
- }))
2601
- });
2602
- for (const paramName of selectedOptionalParams) {
2603
- const param = optionalQueryParams.find((p) => p.name === paramName);
2604
- queryValues[param.name] = await promptForParameterValue(
2605
- client,
2606
- param,
2607
- `Enter value for ${import_chalk4.default.cyan(param.name)}${formatDescription(param.description)}:`
2608
- );
2609
- }
2610
- }
2611
- const bodyFieldValues = [];
2612
- for (const field of requiredBodyFields) {
2613
- const value = await promptForBodyField(client, field, true);
2614
- bodyFieldValues.push(`${field.name}=${value}`);
2615
- }
2616
- if (optionalBodyFields.length > 0) {
2617
- const selectedOptionalFields = await client.input.checkbox({
2618
- message: "Select optional body fields to include:",
2619
- pageSize: 20,
2620
- choices: optionalBodyFields.map((f) => ({
2621
- name: `${import_chalk4.default.cyan(f.name)}${f.type ? ` ${formatTypeHint(f.type)}` : ""}${formatDescription(f.description)}`,
2622
- value: f.name
2623
- }))
2624
- });
2625
- for (const fieldName of selectedOptionalFields) {
2626
- const field = optionalBodyFields.find((f) => f.name === fieldName);
2627
- const value = await promptForBodyField(client, field, true);
2628
- bodyFieldValues.push(`${field.name}=${value}`);
2629
- }
2630
- }
2631
- const queryString = buildQueryString(queryValues);
2632
- if (queryString) {
2633
- finalPath += `?${queryString}`;
2634
- }
2635
- return { finalUrl: finalPath, bodyFields: bodyFieldValues };
2636
- }
2637
- async function promptForParameterValue(client, param, message) {
2638
- const schemaDefault = param.schema?.default !== void 0 ? String(param.schema.default) : void 0;
2639
- const enumValues = param.schema?.enum;
2640
- if (enumValues && enumValues.length > 0) {
2641
- return client.input.select({
2642
- message,
2643
- choices: enumValues.map((v) => ({ name: String(v), value: String(v) })),
2644
- default: schemaDefault
2645
- });
2646
- }
2647
- return client.input.text({
2648
- message,
2649
- default: schemaDefault,
2650
- validate: createRequiredValidator(param.name)
2651
- });
2652
- }
2653
- async function promptForBodyField(client, field, required) {
2654
- const description = formatDescription(field.description);
2655
- const optionalHint = required ? "" : import_chalk4.default.dim(" (optional)");
2656
- if (field.type === "array" && field.enumValues && field.enumValues.length > 0) {
2657
- const choices = field.enumValues.map((v) => ({
2658
- name: String(v),
2659
- value: String(v)
2660
- }));
2661
- const selected = await client.input.checkbox({
2662
- message: `Select values for ${import_chalk4.default.cyan(field.name)}${optionalHint}${description}:`,
2663
- choices,
2664
- required
2665
- });
2666
- return JSON.stringify(selected);
2667
- }
2668
- if (field.enumValues && field.enumValues.length > 0) {
2669
- const choices = field.enumValues.map((v) => ({
2670
- name: String(v),
2671
- value: String(v)
2672
- }));
2673
- if (!required) {
2674
- choices.unshift({ name: import_chalk4.default.dim("(skip)"), value: "" });
2675
- }
2676
- return client.input.select({
2677
- message: `Select value for ${import_chalk4.default.cyan(field.name)}${optionalHint}${description}:`,
2678
- choices
2679
- });
2680
- }
2681
- const typeHint = field.type ? ` ${formatTypeHint(field.type)}` : "";
2682
- return client.input.text({
2683
- message: `Enter value for ${import_chalk4.default.cyan(field.name)}${optionalHint}${typeHint}${description}:`,
2684
- validate: required ? createRequiredValidator(field.name) : void 0
2685
- });
2686
- }
2687
- async function runTagOperation(client, options) {
2688
- const { tag, operationId, flags, positionalOperationFields } = options;
2689
- const telemetryClient = new ApiTelemetryClient({
2690
- opts: { store: client.telemetryEventStore }
2691
- });
2692
- const finalFlags = { ...flags };
2693
- const openApi = createOpenApiCache(client, finalFlags["--spec-url"]);
2694
- const loaded = await openApi.loadWithSpinner(
2695
- finalFlags["--refresh"] ?? false
2696
- );
2697
- if (!loaded) {
2698
- output_manager_default.error(openApi.loadError ?? "Could not load API specification");
2699
- return 1;
2700
- }
2701
- const allEndpoints = openApi.getEndpoints();
2702
- const resolved = resolveEndpointByTagAndOperationId(
2703
- allEndpoints,
2704
- tag,
2705
- operationId
2706
- );
2707
- if (!resolved.ok) {
2708
- printTagOperationResolveError(resolved, allEndpoints);
2709
- return 1;
2710
- }
2711
- const bodyFields = openApi.getBodyFields(resolved.endpoint);
2712
- const displayColumns = openApi.getDisplayColumns(resolved.endpoint);
2713
- let tagOperationPositional = positionalOperationFields;
2714
- if (client.stdin.isTTY) {
2715
- const prompted = await promptMissingParamsForTagOperation(
2716
- client,
2717
- resolved.endpoint,
2718
- bodyFields,
2719
- finalFlags,
2720
- tagOperationPositional
2721
- );
2722
- if (prompted === null) {
2723
- return 1;
2724
- }
2725
- tagOperationPositional = prompted;
2726
- } else {
2727
- try {
2728
- const parsed = await parseOperationKeyValuePairs(
2729
- resolved.endpoint,
2730
- bodyFields,
2731
- finalFlags,
2732
- tagOperationPositional
2733
- );
2734
- const missing = getMissingRequiredOperationParams(
2735
- resolved.endpoint,
2736
- bodyFields,
2737
- parsed,
2738
- finalFlags
2739
- );
2740
- if (missing.path.length > 0 || missing.query.length > 0 || missing.header.length > 0 || missing.body.length > 0) {
2741
- printMissingOperationParamsHelp(resolved.endpoint, missing);
2742
- return 1;
2743
- }
2744
- } catch (err) {
2745
- printError(err);
2746
- return 1;
2747
- }
2748
- }
2749
- let requestConfig;
2750
- try {
2751
- requestConfig = await buildRequestForResolvedOperation(
2752
- resolved.endpoint,
2753
- bodyFields,
2754
- finalFlags,
2755
- tagOperationPositional
2756
- );
2757
- } catch (err) {
2758
- printError(err);
2759
- return 1;
2760
- }
2761
- telemetryClient.trackCliArgumentEndpoint(tag);
2762
- telemetryClient.trackCliArgumentOperationId(operationId);
2763
- telemetryClient.trackCliOptionMethod(finalFlags["--method"]);
2764
- telemetryClient.trackCliOptionHeader(finalFlags["--header"]);
2765
- telemetryClient.trackCliOptionInput(finalFlags["--input"]);
2766
- if (finalFlags["--paginate"])
2767
- telemetryClient.trackCliFlagPaginate(true);
2768
- if (finalFlags["--include"])
2769
- telemetryClient.trackCliFlagInclude(true);
2770
- if (finalFlags["--silent"])
2771
- telemetryClient.trackCliFlagSilent(true);
2772
- if (finalFlags["--verbose"])
2773
- telemetryClient.trackCliFlagVerbose(true);
2774
- if (finalFlags["--raw"])
2775
- telemetryClient.trackCliFlagRaw(true);
2776
- if (finalFlags["--refresh"])
2777
- telemetryClient.trackCliFlagRefresh(true);
2778
- if (finalFlags["--spec-url"])
2779
- telemetryClient.trackCliOptionSpecUrl(finalFlags["--spec-url"]);
2780
- if (finalFlags["--generate"])
2781
- telemetryClient.trackCliOptionGenerate(finalFlags["--generate"]);
2782
- if (finalFlags["--dangerously-skip-permissions"])
2783
- telemetryClient.trackCliFlagDangerouslySkipPermissions(true);
2784
- if (finalFlags["--generate"] === "curl") {
2785
- const curlCmd = generateCurlCommand(
2786
- requestConfig,
2787
- "https://api.vercel.com"
2788
- );
2789
- output_manager_default.log("");
2790
- output_manager_default.log("Replace <TOKEN> with your auth token:");
2791
- output_manager_default.log("");
2792
- client.stdout.write(curlCmd + "\n");
2793
- return 0;
2794
- }
2795
- return executeApiRequest(client, requestConfig, finalFlags, displayColumns, {
2796
- tagOperation: true
2797
- });
2798
- }
2799
-
2800
- // src/util/upgrade.ts
2801
- var import_semver = __toESM(require_semver(), 1);
2802
- import { spawn, execFile } from "child_process";
2803
- import { tmpdir } from "os";
2804
- function renderUpgradeProgress(current, total, phase) {
2805
- const bar = progress(current, total);
2806
- output_manager_default.spinner(
2807
- bar ? `Upgrading Vercel CLI [${bar}] (${current}/${total})${phase ? ` ${phase}` : ""}` : phase || "Upgrading Vercel CLI\u2026",
2808
- 0
2809
- );
2810
- }
2811
- function execFileStdout(command, args) {
2812
- return new Promise((resolve3, reject) => {
2813
- execFile(
2814
- command,
2815
- args,
2816
- { encoding: "utf8", windowsHide: true },
2817
- (error, stdout) => {
2818
- if (error) {
2819
- reject(error);
2820
- return;
2821
- }
2822
- resolve3(stdout.toString());
2823
- }
2824
- );
2825
- });
2826
- }
2827
- function parseVersionOutput(stdout) {
2828
- for (const line of stdout.trim().split("\n").reverse()) {
2829
- try {
2830
- const parsed = JSON.parse(line);
2831
- const version = typeof parsed === "string" ? parsed : typeof parsed?.data === "string" ? parsed.data : void 0;
2832
- if (version && import_semver.default.valid(version)) {
2833
- return version;
2834
- }
2835
- } catch {
2836
- const version = line.trim();
2837
- if (import_semver.default.valid(version)) {
2838
- return version;
2839
- }
2840
- }
2841
- }
2842
- return void 0;
2843
- }
2844
- async function getLatestPackageVersion(packageManager, installArgs) {
2845
- const packageSpecifier = installArgs.find((arg) => arg.endsWith("@latest"));
2846
- if (!packageSpecifier) {
2847
- return void 0;
2848
- }
2849
- const queryArgs = packageManager === "yarn" ? ["info", packageSpecifier, "version", "--json"] : ["view", packageSpecifier, "version", "--json"];
2850
- try {
2851
- const stdout = await execFileStdout(packageManager, queryArgs);
2852
- return parseVersionOutput(stdout);
2853
- } catch (error) {
2854
- output_manager_default.debug(
2855
- `Failed to resolve the latest Vercel CLI version: ${error instanceof Error ? error.message : String(error)}`
2856
- );
2857
- return void 0;
2858
- }
2859
- }
2860
- function isVersionCurrent(current, latest) {
2861
- return import_semver.default.valid(current) && import_semver.default.valid(latest) ? import_semver.default.gte(current, latest) : current === latest;
2862
- }
2863
- async function executeUpgrade(targetVersion) {
2864
- const totalSteps = targetVersion ? 2 : 3;
2865
- renderUpgradeProgress(0, totalSteps, "Resolving installer\u2026");
2866
- const { command: updateCommand, global } = await getUpdateCommandInfo().catch(
2867
- (error) => {
2868
- output_manager_default.stopSpinner();
2869
- throw error;
2870
- }
2871
- );
2872
- const [command, ...args] = updateCommand.split(" ");
2873
- const cwd = global ? tmpdir() : process.cwd();
2874
- const versionBefore = pkg_default.version;
2875
- let resolvedTargetVersion = targetVersion;
2876
- if (!resolvedTargetVersion) {
2877
- renderUpgradeProgress(1, totalSteps, "Checking for updates\u2026");
2878
- resolvedTargetVersion = await getLatestPackageVersion(command, args);
2879
- }
2880
- if (resolvedTargetVersion && isVersionCurrent(versionBefore, resolvedTargetVersion)) {
2881
- renderUpgradeProgress(totalSteps, totalSteps);
2882
- output_manager_default.stopSpinner();
2883
- output_manager_default.log(
2884
- `No upgrade available. Vercel CLI is already up to date (v${versionBefore}).`
2885
- );
2886
- return 0;
2887
- }
2888
- output_manager_default.debug(`Executing: ${updateCommand} (cwd: ${cwd})`);
2889
- renderUpgradeProgress(targetVersion ? 1 : 2, totalSteps, "Installing\u2026");
2890
- return new Promise((resolve3) => {
2891
- const stdout = [];
2892
- const stderr = [];
2893
- const upgradeProcess = spawn(command, args, {
2894
- cwd,
2895
- stdio: ["inherit", "pipe", "pipe"],
2896
- shell: false
2897
- });
2898
- upgradeProcess.stdout?.on("data", (data) => {
2899
- stdout.push(Uint8Array.from(data));
2900
- output_manager_default.debug(`[upgrade stdout] ${data.toString().trimEnd()}`);
2901
- });
2902
- upgradeProcess.stderr?.on("data", (data) => {
2903
- stderr.push(Uint8Array.from(data));
2904
- output_manager_default.debug(`[upgrade stderr] ${data.toString().trimEnd()}`);
2905
- });
2906
- upgradeProcess.on("error", (err) => {
2907
- output_manager_default.stopSpinner();
2908
- output_manager_default.error(`Failed to execute upgrade command: ${err.message}`);
2909
- output_manager_default.log(`You can try running the command manually: ${updateCommand}`);
2910
- resolve3(1);
2911
- });
2912
- upgradeProcess.on("close", (code) => {
2913
- if (code !== 0) {
2914
- output_manager_default.stopSpinner();
2915
- const stdoutStr = Buffer.concat(stdout).toString();
2916
- const stderrStr = Buffer.concat(stderr).toString();
2917
- if (stdoutStr) {
2918
- output_manager_default.print(stdoutStr);
2919
- }
2920
- if (stderrStr) {
2921
- output_manager_default.print(stderrStr);
2922
- }
2923
- output_manager_default.error(`Upgrade failed with exit code ${code ?? "unknown"}`);
2924
- output_manager_default.log(
2925
- `You can try running the command manually: ${updateCommand}`
2926
- );
2927
- resolve3(code ?? 1);
2928
- return;
2929
- }
2930
- renderUpgradeProgress(totalSteps, totalSteps);
2931
- output_manager_default.stopSpinner();
2932
- if (resolvedTargetVersion) {
2933
- output_manager_default.success(
2934
- `Vercel CLI has been upgraded to v${resolvedTargetVersion} successfully!`
2935
- );
2936
- resolve3(0);
2937
- return;
2938
- }
2939
- output_manager_default.success("Vercel CLI has been upgraded successfully!");
2940
- resolve3(0);
2941
- });
2942
- });
2943
- }
2944
-
2945
- // src/util/updates.ts
2946
- var import_ci_info = __toESM(require_ci_info(), 1);
2947
-
2948
- // src/util/native-self-update.ts
2949
- var import_tar_fs = __toESM(require_tar_fs(), 1);
2950
- var import_semver2 = __toESM(require_semver(), 1);
2951
- import { createGunzip } from "zlib";
2952
- import { createHash as createHash2 } from "crypto";
2953
- import { createWriteStream } from "fs";
2954
- import { tmpdir as tmpdir2 } from "os";
2955
- import { join as join2, sep } from "path";
2956
- import { pipeline } from "stream/promises";
2957
- import {
2958
- chmod,
2959
- copyFile,
2960
- mkdir as mkdir2,
2961
- mkdtemp,
2962
- readdir,
2963
- readFile as readFile4,
2964
- readlink,
2965
- realpath,
2966
- rename,
2967
- rm,
2968
- stat,
2969
- symlink,
2970
- unlink,
2971
- writeFile as writeFile2
2972
- } from "fs/promises";
2973
- var REGISTRY = "https://registry.npmjs.org";
2974
- async function moveFile(source, destination) {
2975
- try {
2976
- await rename(source, destination);
2977
- } catch (err) {
2978
- if (err.code !== "EXDEV") {
2979
- throw err;
2980
- }
2981
- await copyFile(source, destination);
2982
- await rm(source, { force: true });
2983
- }
2984
- }
2985
- var CURL_INSTALL_COMMAND = "curl -fsSL https://api-frameworks.vercel.sh/install | sh";
2986
- var SUPPORTED_PLATFORMS = /* @__PURE__ */ new Set([
2987
- "darwin-arm64",
2988
- "darwin-x64",
2989
- "linux-arm64",
2990
- "linux-x64"
2991
- ]);
2992
- function platformTarget() {
2993
- return `${process.platform}-${process.arch}`;
2994
- }
2995
- function isSupportedPlatform() {
2996
- return SUPPORTED_PLATFORMS.has(platformTarget());
2997
- }
2998
- function unsupportedPlatformMessage() {
2999
- const supported = Array.from(SUPPORTED_PLATFORMS).join(", ");
3000
- return `The native Vercel CLI binary is not available for your platform (${platformTarget()}). Supported platforms: ${supported}. You can install the CLI with a package manager instead: npm i -g vercel@latest`;
3001
- }
3002
- function nativePackageSuffix() {
3003
- return `vc-native-${platformTarget()}`;
3004
- }
3005
- function nativePackageName() {
3006
- return `@vercel/${nativePackageSuffix()}`;
3007
- }
3008
- async function isCurlInstall() {
3009
- if (!isNativeBinaryInstall()) {
3010
- return false;
3011
- }
3012
- const versionsPrefix = join2(getInstallRoot(), "versions") + sep;
3013
- if (process.execPath.startsWith(versionsPrefix)) {
3014
- return true;
3015
- }
3016
- try {
3017
- const real = await realpath(process.execPath);
3018
- return real.startsWith(versionsPrefix);
3019
- } catch {
3020
- return false;
3021
- }
3022
- }
3023
- async function resolveLatestVersion(pkgName) {
3024
- const res = await fetch2(`${REGISTRY}/${pkgName}/latest`);
3025
- if (!res.ok) {
3026
- throw new Error(
3027
- `Failed to fetch package metadata from the npm registry (HTTP ${res.status})`
3028
- );
3029
- }
3030
- const manifest = await res.json();
3031
- if (!manifest.version || !import_semver2.default.valid(manifest.version)) {
3032
- throw new Error("Could not resolve the latest native binary version");
3033
- }
3034
- return manifest.version;
3035
- }
3036
- async function resolveLatestNativeVersion() {
3037
- return resolveLatestVersion(nativePackageName());
3038
- }
3039
- async function listAvailableVersions(pkgName) {
3040
- const res = await fetch2(`${REGISTRY}/${pkgName}`, {
3041
- headers: {
3042
- // Abbreviated metadata: much smaller response.
3043
- accept: "application/vnd.npm.install-v1+json"
3044
- }
3045
- });
3046
- if (!res.ok) {
3047
- throw new Error(
3048
- `Failed to fetch package metadata from the npm registry (HTTP ${res.status})`
3049
- );
3050
- }
3051
- const manifest = await res.json();
3052
- const versions = Object.keys(manifest.versions ?? {}).filter(
3053
- (v) => import_semver2.default.valid(v)
3054
- );
3055
- return versions.sort(import_semver2.default.rcompare);
3056
- }
3057
- async function downloadAndExtractBinary(version, destination) {
3058
- if (!isSupportedPlatform()) {
3059
- throw new Error(unsupportedPlatformMessage());
3060
- }
3061
- const suffix = nativePackageSuffix();
3062
- const tarballUrl = `${REGISTRY}/@vercel/${suffix}/-/${suffix}-${version}.tgz`;
3063
- const res = await fetch2(tarballUrl);
3064
- if (res.status === 404) {
3065
- throw new Error(
3066
- `No native binary is available for Vercel CLI v${version} on ${platformTarget()}. Older versions may predate native binary builds. You can install that version with a package manager instead: npm i -g vercel@${version}`
3067
- );
3068
- }
3069
- if (!res.ok) {
3070
- throw new Error(`Failed to download ${tarballUrl} (HTTP ${res.status})`);
3071
- }
3072
- const tmpDir = await mkdtemp(join2(tmpdir2(), "vercel-upgrade-"));
3073
- try {
3074
- await pipeline(
3075
- toNodeReadable(res.body),
3076
- createGunzip(),
3077
- import_tar_fs.default.extract(tmpDir, {
3078
- // Drop symlink/hardlink entries: they're the tar link-following
3079
- // traversal vector (CVE-2024-12905 / CVE-2025-48387).
3080
- ignore: (_name, header) => header?.type !== "file" && header?.type !== "directory"
3081
- })
3082
- );
3083
- const binary = join2(tmpDir, "package", "bin", "vercel");
3084
- const stats = await stat(binary).catch(() => null);
3085
- if (!stats?.isFile()) {
3086
- throw new Error(
3087
- "Downloaded tarball did not contain the expected binary (package/bin/vercel)"
3088
- );
3089
- }
3090
- await mkdir2(destination, { recursive: true });
3091
- await chmod(binary, 493);
3092
- await moveFile(binary, join2(destination, "vercel"));
3093
- } finally {
3094
- await rm(tmpDir, { recursive: true, force: true });
3095
- }
3096
- }
3097
- async function forceSymlink(target, linkPath) {
3098
- await unlink(linkPath).catch(() => {
3099
- });
3100
- await symlink(target, linkPath);
3101
- }
3102
- async function linkVersion(version) {
3103
- const installRoot = getInstallRoot();
3104
- const binaryPath = join2(installRoot, "versions", version, "vercel");
3105
- const binDir = join2(installRoot, "bin");
3106
- await mkdir2(binDir, { recursive: true });
3107
- await forceSymlink(binaryPath, join2(binDir, "vercel"));
3108
- await forceSymlink(binaryPath, join2(binDir, "vc"));
3109
- }
3110
- async function installAndLinkVersion(version) {
3111
- const installRoot = getInstallRoot();
3112
- const versionDir = join2(installRoot, "versions", version);
3113
- const binaryPath = join2(versionDir, "vercel");
3114
- const existing = await stat(binaryPath).catch(() => null);
3115
- if (!existing?.isFile()) {
3116
- output_manager_default.spinner(`Downloading Vercel CLI v${version}\u2026`, 0);
3117
- await downloadAndExtractBinary(version, versionDir);
3118
- }
3119
- await linkVersion(version);
3120
- }
3121
- var PR_BINARIES_URL = process.env.VERCEL_PR_BINARIES_URL || "https://api-frameworks.vercel.sh/pr-binaries";
3122
- function parsePrTarget(target) {
3123
- const match = /^pr[/-](\d+)$/i.exec(target.trim());
3124
- if (!match) {
3125
- return void 0;
3126
- }
3127
- const pr = Number(match[1]);
3128
- return Number.isSafeInteger(pr) && pr > 0 ? pr : void 0;
3129
- }
3130
- function prVersionDirName(pr) {
3131
- return `pr-${pr}`;
3132
- }
3133
- function isPrVersionName(name) {
3134
- return /^pr-\d+$/.test(name);
3135
- }
3136
- async function fetchPrBuildSha(pr) {
3137
- const url = `${PR_BINARIES_URL}/${pr}/current-sha`;
3138
- const res = await fetch2(url);
3139
- if (res.status === 404) {
3140
- throw new Error(
3141
- `Couldn't find a binary for PR #${pr}. The current-sha pointer is not published yet.`
3142
- );
3143
- }
3144
- if (!res.ok) {
3145
- throw new Error(
3146
- `Failed to fetch the current build for PR #${pr} (HTTP ${res.status}).`
3147
- );
3148
- }
3149
- const sha = (await res.text()).trim().toLowerCase();
3150
- if (!/^[0-9a-f]{40}$/.test(sha)) {
3151
- throw new Error(`Unexpected build SHA format for PR #${pr}.`);
3152
- }
3153
- return sha;
3154
- }
3155
- function missingPrPlatformMessage(pr, buildSha) {
3156
- const platform = platformTarget();
3157
- const shortSha = buildSha.slice(0, 12);
3158
- return `Couldn't find a ${platform} binary for PR #${pr} (${shortSha}). This SHA exists, but this platform isn't ready yet.`;
3159
- }
3160
- function getPrBinaryBaseUrl(pr, buildSha) {
3161
- return `${PR_BINARIES_URL}/${pr}/shas/${buildSha}`;
3162
- }
3163
- async function fetchPrChecksum(pr, buildSha) {
3164
- const url = `${getPrBinaryBaseUrl(pr, buildSha)}/vercel-${platformTarget()}.sha256`;
3165
- const res = await fetch2(url);
3166
- if (res.status === 404) {
3167
- throw new Error(missingPrPlatformMessage(pr, buildSha));
3168
- }
3169
- if (!res.ok) {
3170
- throw new Error(
3171
- `Failed to fetch the checksum for PR #${pr} (HTTP ${res.status}).`
3172
- );
3173
- }
3174
- const text = (await res.text()).trim();
3175
- const sha = text.split(/\s+/)[0]?.toLowerCase();
3176
- if (!/^[0-9a-f]{64}$/.test(sha ?? "")) {
3177
- throw new Error(`Unexpected checksum format for PR #${pr}.`);
3178
- }
3179
- return sha;
3180
- }
3181
- async function downloadPrBinary(pr, buildSha, expectedSha, destination) {
3182
- if (!isSupportedPlatform()) {
3183
- throw new Error(unsupportedPlatformMessage());
3184
- }
3185
- const url = `${getPrBinaryBaseUrl(pr, buildSha)}/vercel-${platformTarget()}`;
3186
- const res = await fetch2(url);
3187
- if (res.status === 404) {
3188
- throw new Error(missingPrPlatformMessage(pr, buildSha));
3189
- }
3190
- if (!res.ok) {
3191
- throw new Error(`Failed to download ${url} (HTTP ${res.status})`);
3192
- }
3193
- const tmpDir = await mkdtemp(join2(tmpdir2(), "vercel-pr-"));
3194
- try {
3195
- const tmpBinary = join2(tmpDir, "vercel");
3196
- const hash = createHash2("sha256");
3197
- const body = toNodeReadable(res.body);
3198
- body.on("data", (chunk) => hash.update(chunk));
3199
- await pipeline(body, createWriteStream(tmpBinary));
3200
- const actualSha = hash.digest("hex");
3201
- if (actualSha !== expectedSha) {
3202
- throw new Error(
3203
- `Checksum mismatch for PR #${pr} binary. The build may have been updated mid-download; try again.`
3204
- );
3205
- }
3206
- await mkdir2(destination, { recursive: true });
3207
- await chmod(tmpBinary, 493);
3208
- await moveFile(tmpBinary, join2(destination, "vercel"));
3209
- await writeFile2(join2(destination, "vercel.sha256"), `${actualSha}
3210
- `);
3211
- } finally {
3212
- await rm(tmpDir, { recursive: true, force: true });
3213
- }
3214
- }
3215
- async function installAndLinkPrBinary(pr) {
3216
- const installRoot = getInstallRoot();
3217
- const versionDir = join2(installRoot, "versions", prVersionDirName(pr));
3218
- const binaryPath = join2(versionDir, "vercel");
3219
- const shaPath = join2(versionDir, "vercel.sha256");
3220
- output_manager_default.spinner(`Checking latest build for PR #${pr}\u2026`, 0);
3221
- const buildSha = await fetchPrBuildSha(pr);
3222
- const remoteSha = await fetchPrChecksum(pr, buildSha);
3223
- const existing = await stat(binaryPath).catch(() => null);
3224
- const localSha = existing?.isFile() ? (await readFile4(shaPath, "utf8").catch(() => "")).trim().split(/\s+/)[0] : void 0;
3225
- if (existing?.isFile() && localSha === remoteSha) {
3226
- await writeFile2(join2(versionDir, "build-sha"), `${buildSha}
3227
- `);
3228
- await linkVersion(prVersionDirName(pr));
3229
- return { updated: false, buildSha };
3230
- }
3231
- output_manager_default.spinner(`Downloading Vercel CLI build for PR #${pr}\u2026`, 0);
3232
- await downloadPrBinary(pr, buildSha, remoteSha, versionDir);
3233
- await writeFile2(join2(versionDir, "build-sha"), `${buildSha}
3234
- `);
3235
- await linkVersion(prVersionDirName(pr));
3236
- return { updated: true, buildSha };
3237
- }
3238
- async function listInstalledVersions() {
3239
- const versionsDir = join2(getInstallRoot(), "versions");
3240
- const entries = await readdir(versionsDir, { withFileTypes: true }).catch(
3241
- () => []
3242
- );
3243
- const versions = [];
3244
- const prBuilds = [];
3245
- for (const entry of entries) {
3246
- const isPr = isPrVersionName(entry.name);
3247
- if (!entry.isDirectory() || !import_semver2.default.valid(entry.name) && !isPr) {
3248
- continue;
3249
- }
3250
- const binary = join2(versionsDir, entry.name, "vercel");
3251
- const stats = await stat(binary).catch(() => null);
3252
- if (stats?.isFile()) {
3253
- (isPr ? prBuilds : versions).push(entry.name);
3254
- }
3255
- }
3256
- return [...versions.sort(import_semver2.default.rcompare), ...prBuilds.sort()];
3257
- }
3258
- async function getLinkedVersion() {
3259
- const link = join2(getInstallRoot(), "bin", "vercel");
3260
- try {
3261
- const target = await readlink(link);
3262
- const segments = target.split(sep);
3263
- const versionsIdx = segments.lastIndexOf("versions");
3264
- const version = versionsIdx >= 0 ? segments[versionsIdx + 1] : void 0;
3265
- return version && (import_semver2.default.valid(version) || isPrVersionName(version)) ? version : void 0;
3266
- } catch {
3267
- return void 0;
3268
- }
3269
- }
3270
- async function isLinkedToPrBuild() {
3271
- const linked = await getLinkedVersion();
3272
- return linked !== void 0 && isPrVersionName(linked);
3273
- }
3274
- function pinFilePath() {
3275
- return join2(getInstallRoot(), "pinned");
3276
- }
3277
- async function setPinnedVersion(version) {
3278
- await writeFile2(pinFilePath(), `${version}
3279
- `);
3280
- }
3281
- async function clearPinnedVersion() {
3282
- await unlink(pinFilePath()).catch(() => {
3283
- });
3284
- }
3285
- async function getPinnedVersion() {
3286
- const pinned = (await readFile4(pinFilePath(), "utf8").catch(() => "")).trim().split(/\s+/)[0];
3287
- if (!pinned) {
3288
- return void 0;
3289
- }
3290
- const linked = await getLinkedVersion();
3291
- return pinned === linked ? pinned : void 0;
3292
- }
3293
- async function getPrBuildSha(name) {
3294
- const shaPath = join2(getInstallRoot(), "versions", name, "build-sha");
3295
- const sha = (await readFile4(shaPath, "utf8").catch(() => "")).trim().toLowerCase();
3296
- return /^[0-9a-f]{40}$/.test(sha) ? sha : void 0;
3297
- }
3298
- function packageManagerRemovalCommand() {
3299
- const segments = process.execPath.split(sep);
3300
- if (segments.includes("pnpm") || segments.includes(".pnpm")) {
3301
- return "pnpm rm -g vercel";
3302
- }
3303
- if (segments.includes("yarn") || segments.includes(".yarn")) {
3304
- return "yarn global remove vercel";
3305
- }
3306
- return "npm rm -g vercel";
3307
- }
3308
- async function printMigrationCleanup() {
3309
- if (await isCurlInstall()) {
3310
- return;
3311
- }
3312
- const removalCommand = packageManagerRemovalCommand();
3313
- const binDir = join2(getInstallRoot(), "bin");
3314
- output_manager_default.print("\n");
3315
- output_manager_default.log(
3316
- `The Vercel CLI now updates itself in ${binDir} and no longer needs your package manager.`
3317
- );
3318
- output_manager_default.log(
3319
- `Remove the old install so the new binary takes effect: ${removalCommand}`
3320
- );
3321
- output_manager_default.log(
3322
- "Then open a new terminal (or run `hash -r`) so your shell picks up the new binary."
3323
- );
3324
- }
3325
- async function executeNativeSelfUpdate(targetVersion) {
3326
- try {
3327
- output_manager_default.spinner("Checking for updates\u2026", 0);
3328
- const version = targetVersion ?? await resolveLatestNativeVersion();
3329
- const onPrBuild = await isLinkedToPrBuild();
3330
- if (!targetVersion && !onPrBuild && import_semver2.default.valid(version) && import_semver2.default.valid(pkg_default.version) && import_semver2.default.gte(pkg_default.version, version)) {
3331
- output_manager_default.stopSpinner();
3332
- output_manager_default.log(
3333
- `No upgrade available. Vercel CLI is already up to date (v${pkg_default.version}).`
3334
- );
3335
- return 0;
3336
- }
3337
- if (onPrBuild) {
3338
- output_manager_default.stopSpinner();
3339
- output_manager_default.log(
3340
- `Currently on a PR build (${await getLinkedVersion()}). Switching back to the latest release\u2026`
3341
- );
3342
- }
3343
- await installAndLinkVersion(version);
3344
- await clearPinnedVersion();
3345
- output_manager_default.stopSpinner();
3346
- output_manager_default.success(`Vercel CLI has been upgraded to v${version} successfully!`);
3347
- await printMigrationCleanup();
3348
- return 0;
3349
- } catch (error) {
3350
- output_manager_default.stopSpinner();
3351
- output_manager_default.error(
3352
- `Upgrade failed: ${error instanceof Error ? error.message : String(error)}`
3353
- );
3354
- output_manager_default.log(`You can try reinstalling manually: ${CURL_INSTALL_COMMAND}`);
3355
- return 1;
3356
- }
3357
- }
3358
-
3359
- // src/util/updates.ts
3360
- async function isVersionPinned() {
3361
- if (!isNativeBinaryInstall()) {
3362
- return false;
3363
- }
3364
- return await getPinnedVersion() !== void 0;
3365
- }
3366
- function isAutoUpdateEnabled(config) {
3367
- return config.updates?.auto === true;
3368
- }
3369
- function hasAutoUpdatePreference(config) {
3370
- return typeof config.updates?.auto === "boolean";
3371
- }
3372
- function setAutoUpdate(client, enabled) {
3373
- client.config = {
3374
- ...client.config,
3375
- updates: {
3376
- ...client.config.updates,
3377
- auto: enabled
3378
- }
3379
- };
3380
- writeToConfigFile(client.config);
3381
- }
3382
- async function canAutoUpdate(client, exitCode, command) {
3383
- if (isNativeBinaryInstall()) {
3384
- return false;
3385
- }
3386
- if (!isAutoUpdateEnabled(client.config)) {
3387
- return false;
3388
- }
3389
- if (exitCode !== 0) {
3390
- return false;
3391
- }
3392
- if (import_ci_info.default.isCI) {
3393
- return false;
3394
- }
3395
- if (client.nonInteractive || client.isAgent) {
3396
- return false;
3397
- }
3398
- if (command === "upgrade") {
3399
- return false;
3400
- }
3401
- return isGlobal();
3402
- }
3403
-
3404
- // src/util/output/box.ts
3405
- var import_chalk5 = __toESM(require_source(), 1);
3406
- var import_strip_ansi = __toESM(require_strip_ansi(), 1);
3407
- var border = ["\u2500", "\u256D", "\u256E", "\u2502", "\u2502", "\u2570", "\u256F"];
3408
- var nothing = ["\u2500", "", "", "", "", "", ""];
3409
- function box(message, {
3410
- borderColor,
3411
- padding = 1,
3412
- textAlignment = "center",
3413
- terminalColumns: cols = process.stdout.columns || process.env.COLUMNS && parseInt(process.env.COLUMNS, 10) || 80
3414
- } = {}) {
3415
- const lines = message.split(/\r?\n/).map((line) => [line, (0, import_strip_ansi.default)(line).length]);
3416
- const maxLine = lines.reduce((p, [, len]) => Math.max(p, len), 0);
3417
- const borderColorFn = borderColor && import_chalk5.default[borderColor] || import_chalk5.default.yellow;
3418
- const clampedSidePadding = Math.max(1, padding * 3);
3419
- const narrowMode = maxLine + 2 + clampedSidePadding * 2 > cols;
3420
- const sidePadding = narrowMode ? 0 : clampedSidePadding;
3421
- const innerWidth = Math.min(maxLine + sidePadding * 2, cols);
3422
- const [hr, topLeft, topRight, left, right, bottomLeft, bottomRight] = narrowMode ? nothing : border;
3423
- const spacerRow = narrowMode ? "\n".repeat(padding) : `${borderColorFn(`${left}${" ".repeat(innerWidth)}${right}`)}
3424
- `.repeat(
3425
- padding
3426
- );
3427
- const renderLine = ([line, len]) => {
3428
- let leftPadding = 0;
3429
- let rightPadding = 0;
3430
- if (!narrowMode) {
3431
- leftPadding = sidePadding;
3432
- rightPadding = sidePadding;
3433
- if (textAlignment === "center") {
3434
- leftPadding += Math.floor((maxLine - len) / 2);
3435
- rightPadding += maxLine - len - leftPadding + sidePadding;
3436
- } else if (textAlignment === "right") {
3437
- leftPadding += maxLine - len;
3438
- } else if (textAlignment === "left") {
3439
- rightPadding += maxLine - len;
3440
- }
3441
- }
3442
- return borderColorFn(left) + " ".repeat(leftPadding) + line + " ".repeat(rightPadding) + borderColorFn(right);
3443
- };
3444
- return borderColorFn(`${topLeft}${hr.repeat(innerWidth)}${topRight}`) + "\n" + spacerRow + lines.map(renderLine).join("\n") + "\n" + spacerRow + borderColorFn(`${bottomLeft}${hr.repeat(innerWidth)}${bottomRight}`);
3445
- }
3446
-
3447
- // src/util/did-you-mean.ts
3448
- var import_jaro_winkler = __toESM(require_jaro_winkler(), 1);
3449
- var did_you_mean_default = didYouMean;
3450
- function didYouMean(input, list, threshold = 0.5) {
3451
- const rated = list.map((item) => [dashAwareDistance(input, item), item]);
3452
- const found = rated.filter((item) => item[0] > threshold);
3453
- if (found.length) {
3454
- const highestRated = found.reduce((accu, curr) => {
3455
- return accu[0] > curr[0] ? accu : curr;
3456
- });
3457
- return highestRated[1];
3458
- }
3459
- }
3460
- function dashAwareDistance(word, dashWord) {
3461
- const fullDistance = (0, import_jaro_winkler.default)(word, dashWord);
3462
- const distances = dashWord.split("-").map((w) => (0, import_jaro_winkler.default)(w, word));
3463
- const meanDistance = distances.reduce((accu, curr) => accu + curr) / distances.length;
3464
- return fullDistance > meanDistance ? fullDistance : meanDistance;
3465
- }
3466
-
3467
- export {
3468
- did_you_mean_default,
3469
- OpenApiCache,
3470
- matchesCliApiTag,
3471
- resolveOpenApiTagForProjectsCli,
3472
- resolveOpenApiTagForTeamsCli,
3473
- api,
3474
- tryOpenApiFallback,
3475
- executeUpgrade,
3476
- require_tar_fs,
3477
- CURL_INSTALL_COMMAND,
3478
- isCurlInstall,
3479
- listAvailableVersions,
3480
- installAndLinkVersion,
3481
- parsePrTarget,
3482
- installAndLinkPrBinary,
3483
- listInstalledVersions,
3484
- getLinkedVersion,
3485
- setPinnedVersion,
3486
- getPinnedVersion,
3487
- getPrBuildSha,
3488
- executeNativeSelfUpdate,
3489
- isVersionPinned,
3490
- isAutoUpdateEnabled,
3491
- hasAutoUpdatePreference,
3492
- setAutoUpdate,
3493
- canAutoUpdate,
3494
- box
3495
- };