@vercel/cli-support 65.11.0 → 65.12.0-snapshot-f37009a35593

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 (369) hide show
  1. package/README.md +8 -120
  2. package/dist/chunks/add-6HUHUS65.js +8 -0
  3. package/dist/chunks/add-Q4SUNMBK.js +8 -0
  4. package/dist/chunks/add-Z7P3MHVF.js +8 -0
  5. package/dist/chunks/{alerts-JGRRCQA4.js → alerts-VOYMO6NJ.js} +1 -1
  6. package/dist/chunks/build-73WG7HKM.js +7 -0
  7. package/dist/chunks/{chunk-PUKYAALC.js → chunk-24SIHFEW.js} +1 -1
  8. package/dist/chunks/{chunk-QROI2U32.js → chunk-2CQJKBKV.js} +2 -4
  9. package/dist/chunks/{chunk-7MZLV3KK.js → chunk-2CZL3GJU.js} +1 -1
  10. package/dist/chunks/{chunk-TPJV5UNE.js → chunk-2I6UGVH5.js} +1 -1
  11. package/dist/chunks/{chunk-4E6BGQWR.js → chunk-2LOA3LC6.js} +1 -1
  12. package/dist/chunks/{chunk-EBIJ26IV.js → chunk-2PHHMZHH.js} +1 -1
  13. package/dist/chunks/{chunk-M3Z6NSC2.js → chunk-2V6UURUN.js} +1 -1
  14. package/dist/chunks/{chunk-CFYLTZSV.js → chunk-3AGRCSWN.js} +1 -1
  15. package/dist/chunks/{chunk-42J2KCDF.js → chunk-3EFPSM6M.js} +1 -1
  16. package/dist/chunks/{chunk-RR5SDYNN.js → chunk-3G4I23WW.js} +1 -1
  17. package/dist/chunks/{chunk-DQASZDQT.js → chunk-3SNWIYU7.js} +1 -1
  18. package/dist/chunks/{chunk-EVBGFSK5.js → chunk-42Y46TZ3.js} +1 -1
  19. package/dist/chunks/{chunk-KV3QXTRZ.js → chunk-4OO6TXBM.js} +1 -1
  20. package/dist/chunks/chunk-4ZDL2HTZ.js +13 -0
  21. package/dist/chunks/{chunk-UUDE44NV.js → chunk-54FY6GJ5.js} +1 -1
  22. package/dist/chunks/{chunk-RIJ45N7C.js → chunk-5HQEYPDO.js} +1 -1
  23. package/dist/chunks/chunk-5KL6UFII.js +7 -0
  24. package/dist/chunks/{chunk-ECFLIVEE.js → chunk-5L566FZB.js} +1 -1
  25. package/dist/chunks/{chunk-4ELZOAQH.js → chunk-5TMHRECT.js} +1 -1
  26. package/dist/chunks/chunk-5UXMH3EL.js +7 -0
  27. package/dist/chunks/{chunk-74VQ7PQV.js → chunk-5YLKPSZI.js} +1 -1
  28. package/dist/chunks/chunk-66TKNVRG.js +60 -0
  29. package/dist/chunks/{chunk-RDWLLSPU.js → chunk-6737KAJP.js} +1 -1
  30. package/dist/chunks/{chunk-EGTJTCCW.js → chunk-6G5IWHTD.js} +1 -1
  31. package/dist/chunks/chunk-6JFZDAQH.js +7 -0
  32. package/dist/chunks/{chunk-V5TOMLK4.js → chunk-6Q2XEYCJ.js} +1 -1
  33. package/dist/chunks/{chunk-7VGBGUX7.js → chunk-6S6UZV3V.js} +1 -1
  34. package/dist/chunks/{chunk-NUSKXXZZ.js → chunk-6X3MLL5W.js} +1 -1
  35. package/dist/chunks/chunk-77MIP53X.js +7 -0
  36. package/dist/chunks/chunk-7BDQUBSO.js +7 -0
  37. package/dist/chunks/{chunk-42FOKWGX.js → chunk-7PGDJTAH.js} +1 -1
  38. package/dist/chunks/{chunk-BZIC36KP.js → chunk-7TVNKTN2.js} +1 -1
  39. package/dist/chunks/{chunk-TUAS3L5I.js → chunk-7YHKDIPH.js} +1 -1
  40. package/dist/chunks/{chunk-IIGNDMLO.js → chunk-ABSFPYM4.js} +1 -1
  41. package/dist/chunks/{chunk-MBXLL2HF.js → chunk-AGLOVMPC.js} +3 -3
  42. package/dist/chunks/chunk-AILHY5MN.js +7 -0
  43. package/dist/chunks/{chunk-WBSFE6IE.js → chunk-AQBK55BT.js} +1 -1
  44. package/dist/chunks/{chunk-UNPK7LVC.js → chunk-AUAV6LGZ.js} +1 -1
  45. package/dist/chunks/chunk-AW33SRYY.js +7 -0
  46. package/dist/chunks/chunk-AYT5GPAY.js +7 -0
  47. package/dist/chunks/{chunk-VRH7LWOC.js → chunk-B4KA3ZH2.js} +1 -1
  48. package/dist/chunks/chunk-BF2L7ASS.js +7 -0
  49. package/dist/chunks/{chunk-PFZCGMJ7.js → chunk-BH5OASEJ.js} +1 -1
  50. package/dist/chunks/chunk-BIGJEDOA.js +11 -0
  51. package/dist/chunks/chunk-BOJDM3O7.js +7 -0
  52. package/dist/chunks/chunk-C7SUDWRU.js +10 -0
  53. package/dist/chunks/{chunk-B56SRT5W.js → chunk-CHZP4RWN.js} +1 -1
  54. package/dist/chunks/{chunk-375JVQYK.js → chunk-CJZE7647.js} +1 -1
  55. package/dist/chunks/{chunk-YZKARZ2B.js → chunk-CKJZSRAC.js} +1 -1
  56. package/dist/chunks/{chunk-MIIHBRKV.js → chunk-DUMYLYQM.js} +1 -1
  57. package/dist/chunks/{chunk-SF4E3AQ3.js → chunk-E3WP42P2.js} +1 -1
  58. package/dist/chunks/{chunk-6UMVJ7RL.js → chunk-E7CEQ2PO.js} +1 -1
  59. package/dist/chunks/chunk-EM3U6PRB.js +7 -0
  60. package/dist/chunks/{chunk-AMPJ6RWT.js → chunk-EZVNGJN5.js} +1 -1
  61. package/dist/chunks/{chunk-WMWB7QKG.js → chunk-F2QYQZQH.js} +1 -1
  62. package/dist/chunks/{chunk-ZPBGAZC2.js → chunk-F6KURUPQ.js} +1 -1
  63. package/dist/chunks/{chunk-5DXC4TE2.js → chunk-F7L5SXJM.js} +1 -1
  64. package/dist/chunks/{chunk-XH2R2EIK.js → chunk-FBI6U33Y.js} +1 -1
  65. package/dist/chunks/{chunk-7NMC4E66.js → chunk-FGLU4ZJS.js} +1 -1
  66. package/dist/chunks/{chunk-FNH3T3CF.js → chunk-FGZXIHGN.js} +1 -1
  67. package/dist/chunks/{chunk-W24TLPO5.js → chunk-G2PVH4GO.js} +1 -1
  68. package/dist/chunks/{chunk-HNH3DPIZ.js → chunk-GAILIG45.js} +1 -1
  69. package/dist/chunks/{chunk-FVVOHGQE.js → chunk-GHNHUSVK.js} +1 -1
  70. package/dist/chunks/{chunk-4DMKP6AO.js → chunk-GOI2VVI7.js} +2 -2
  71. package/dist/chunks/chunk-GORL5DZC.js +11 -0
  72. package/dist/chunks/{chunk-GL66K54F.js → chunk-GPDERS2D.js} +1 -1
  73. package/dist/chunks/{chunk-UBJVL3NJ.js → chunk-GQJ3M4XR.js} +3 -3
  74. package/dist/chunks/{chunk-JUSNW3IF.js → chunk-GTXGURVR.js} +1 -1
  75. package/dist/chunks/{chunk-CU3LNJZV.js → chunk-GUSOYIW6.js} +1 -1
  76. package/dist/chunks/{chunk-AO6AMYBF.js → chunk-GY44CQXK.js} +1 -1
  77. package/dist/chunks/{chunk-EZLPMOHM.js → chunk-H2LSYF4A.js} +1 -1
  78. package/dist/chunks/{chunk-4U6ACPA4.js → chunk-HR66URIC.js} +1 -1
  79. package/dist/chunks/{chunk-4KM733OB.js → chunk-HVJN2SSK.js} +1 -1
  80. package/dist/chunks/{chunk-C5QEQSEX.js → chunk-I6ONU42A.js} +1 -1
  81. package/dist/chunks/{chunk-VAZ7JG2Z.js → chunk-ICD2IWKG.js} +1 -1
  82. package/dist/chunks/{chunk-UF2E5BDE.js → chunk-ICR2CGFN.js} +1 -1
  83. package/dist/chunks/{chunk-NT2N5UR4.js → chunk-IRIFXCZW.js} +1 -1
  84. package/dist/chunks/{chunk-CD6ZWCKT.js → chunk-J7BMH22N.js} +1 -1
  85. package/dist/chunks/{chunk-ECGY67NB.js → chunk-J7RNU6AO.js} +1 -1
  86. package/dist/chunks/{chunk-SDYCW5JM.js → chunk-JONZUKWX.js} +1 -1
  87. package/dist/chunks/{chunk-P24YBQ6H.js → chunk-JVGENO2R.js} +1 -1
  88. package/dist/chunks/{chunk-PKNEWN4W.js → chunk-K46QQRUN.js} +1 -1
  89. package/dist/chunks/{chunk-BJXLR2RE.js → chunk-KKYNEEM7.js} +1 -1
  90. package/dist/chunks/{chunk-3TDFSO4X.js → chunk-KPSINH7T.js} +1 -1
  91. package/dist/chunks/chunk-KR4DMT3I.js +7 -0
  92. package/dist/chunks/{chunk-MO2G2ND2.js → chunk-LM66FQOH.js} +1 -1
  93. package/dist/chunks/{chunk-6ORJPXDQ.js → chunk-LTBNB6FS.js} +1 -1
  94. package/dist/chunks/{chunk-RCUDI7OF.js → chunk-M32HBBPK.js} +1 -1
  95. package/dist/chunks/{chunk-ZQXXESKG.js → chunk-MAA5GRIM.js} +1 -1
  96. package/dist/chunks/chunk-MCYG7CCE.js +7 -0
  97. package/dist/chunks/{chunk-ITQPDXXA.js → chunk-MTZYPCZ7.js} +1 -1
  98. package/dist/chunks/{chunk-NE6PKR2J.js → chunk-MWWMY5R6.js} +1 -1
  99. package/dist/chunks/{chunk-UFXIPUNI.js → chunk-MXALPSIX.js} +1 -1
  100. package/dist/chunks/{chunk-7JMN657A.js → chunk-NBTFAXL4.js} +1 -1
  101. package/dist/chunks/{chunk-HYOWFNOP.js → chunk-NIZW6D6D.js} +1 -1
  102. package/dist/chunks/{chunk-KBVYN635.js → chunk-NREH4VSU.js} +1 -1
  103. package/dist/chunks/{chunk-QDHTI5WK.js → chunk-NVTAZWAJ.js} +1 -1
  104. package/dist/chunks/{chunk-5B5CLOKM.js → chunk-NWNNLRAY.js} +1 -1
  105. package/dist/chunks/{chunk-NDMQVBTV.js → chunk-NYJTWSSD.js} +1 -1
  106. package/dist/chunks/{chunk-7ZJ7VUIR.js → chunk-O3DAPRJ3.js} +1 -1
  107. package/dist/chunks/{chunk-K7ARJYAG.js → chunk-OFOZ5DBA.js} +1 -1
  108. package/dist/chunks/{chunk-FYE7ILRR.js → chunk-OFZUWHZW.js} +1 -1
  109. package/dist/chunks/{chunk-RI6DJAFI.js → chunk-OHEM2CSW.js} +1 -1
  110. package/dist/chunks/{chunk-IHTWZEQW.js → chunk-OKKG2FUS.js} +1 -1
  111. package/dist/chunks/{chunk-DR6OJB6P.js → chunk-OLHEIHLT.js} +1 -1
  112. package/dist/chunks/chunk-OMMFXWXP.js +10 -0
  113. package/dist/chunks/chunk-OMR2EZCN.js +7 -0
  114. package/dist/chunks/chunk-PKXUVASX.js +8 -0
  115. package/dist/chunks/{chunk-VKCBEW6R.js → chunk-PSMNKYYB.js} +1 -1
  116. package/dist/chunks/{chunk-EIMHC5UY.js → chunk-PW27HP2P.js} +1 -1
  117. package/dist/chunks/{chunk-TZE4CS4K.js → chunk-QBHTNUM5.js} +1 -1
  118. package/dist/chunks/{chunk-YUHKH4TK.js → chunk-QKOLFLLP.js} +1 -1
  119. package/dist/chunks/{chunk-B6QVH6IG.js → chunk-QTED25YU.js} +1 -1
  120. package/dist/chunks/chunk-RAF34CKY.js +13 -0
  121. package/dist/chunks/chunk-REJLEESP.js +10 -0
  122. package/dist/chunks/chunk-SEHERY6U.js +7 -0
  123. package/dist/chunks/{chunk-5FIY443M.js → chunk-SMETSNPH.js} +1 -1
  124. package/dist/chunks/{chunk-NMIZSQDN.js → chunk-SP6E7PHW.js} +1 -1
  125. package/dist/chunks/chunk-SQBDW5FO.js +10 -0
  126. package/dist/chunks/chunk-SQKTR4V7.js +8 -0
  127. package/dist/chunks/{chunk-CHIYT3V4.js → chunk-TA7KTIDV.js} +1 -1
  128. package/dist/chunks/{chunk-VWJXV5ZM.js → chunk-TCFQL43G.js} +1 -1
  129. package/dist/chunks/{chunk-2J35YKA2.js → chunk-TFTF3C3G.js} +12 -12
  130. package/dist/chunks/{chunk-NZW3RIQM.js → chunk-TJ3V2D24.js} +1 -1
  131. package/dist/chunks/{chunk-JTAUWH5V.js → chunk-TJUZVODP.js} +1 -1
  132. package/dist/chunks/chunk-U7XX53IQ.js +10 -0
  133. package/dist/chunks/{chunk-WTFD4MDT.js → chunk-UZQJQXGJ.js} +1 -1
  134. package/dist/chunks/{chunk-UIMJNASP.js → chunk-V7G4VDZI.js} +1 -1
  135. package/dist/chunks/{chunk-WNDR5HCU.js → chunk-VCJIB3FB.js} +1 -1
  136. package/dist/chunks/{chunk-AYZ52QDF.js → chunk-VM6X5BTK.js} +1 -1
  137. package/dist/chunks/{chunk-HZEKH3RO.js → chunk-VVTMF2AY.js} +1 -1
  138. package/dist/chunks/{chunk-N65H4JMJ.js → chunk-W25UARQV.js} +1 -1
  139. package/dist/chunks/chunk-WLMW7K7F.js +7 -0
  140. package/dist/chunks/{chunk-4VP57TOJ.js → chunk-WZ6SPHBV.js} +1 -1
  141. package/dist/chunks/{chunk-HDISAMDF.js → chunk-WZCHLGSK.js} +1 -1
  142. package/dist/chunks/{chunk-IHCYNUI2.js → chunk-XJYDISH3.js} +1 -1
  143. package/dist/chunks/{chunk-ZTHW5VNH.js → chunk-XM4PXDYM.js} +2 -2
  144. package/dist/chunks/{chunk-4T57TXQ3.js → chunk-XTCS76ZH.js} +1 -1
  145. package/dist/chunks/{chunk-YODQLETL.js → chunk-XVDUP67R.js} +1 -1
  146. package/dist/chunks/{chunk-SLCPSRDR.js → chunk-Y2FVJ7YO.js} +1 -1
  147. package/dist/chunks/{chunk-FVTRIRML.js → chunk-Y5S2OEJH.js} +1 -1
  148. package/dist/chunks/{chunk-EJN55YDV.js → chunk-YANOBY2G.js} +1 -1
  149. package/dist/chunks/{chunk-2RXUQ72I.js → chunk-YIOMTAUF.js} +1 -1
  150. package/dist/chunks/{chunk-BW25OFQG.js → chunk-YLCIOXSX.js} +1 -1
  151. package/dist/chunks/{chunk-GZLYNPNU.js → chunk-YNCWSPPJ.js} +1 -1
  152. package/dist/chunks/chunk-YTGBRFGS.js +12 -0
  153. package/dist/chunks/{chunk-UI2H2EIM.js → chunk-YTRKHRL3.js} +1 -1
  154. package/dist/chunks/{chunk-F7AVGV4Y.js → chunk-Z73UJVGD.js} +1 -1
  155. package/dist/chunks/chunk-ZGB2RHJO.js +7 -0
  156. package/dist/chunks/{chunk-6Y2ZL5XJ.js → chunk-ZKNEIE44.js} +2 -2
  157. package/dist/chunks/chunk-ZZLCRSES.js +11 -0
  158. package/dist/chunks/clear-UUIST3TQ.js +8 -0
  159. package/dist/chunks/{cli-embedded-Y74S252S.js → cli-embedded-ABHGJLYX.js} +1 -1
  160. package/dist/chunks/compile-vercel-config-TCWZLB4R.js +7 -0
  161. package/dist/chunks/config-EN7EVY7Y.js +7 -0
  162. package/dist/chunks/config-SQJODWK5.js +8 -0
  163. package/dist/chunks/config-validator.mjs +1 -1
  164. package/dist/chunks/{connect-git-provider-GFAJLQLU.js → connect-git-provider-BMUUC7ND.js} +1 -1
  165. package/dist/chunks/contract-V2RNNPSD.js +10 -0
  166. package/dist/chunks/delete-FWZRAXCE.js +10 -0
  167. package/dist/chunks/delete-OKKKJTHJ.js +9 -0
  168. package/dist/chunks/describe-XDK4J6I4.js +25 -0
  169. package/dist/chunks/detect-projects-AKK2XI76.js +7 -0
  170. package/dist/chunks/detect-services-BA2VYT26.js +7 -0
  171. package/dist/chunks/disable-BUKHXRKK.js +7 -0
  172. package/dist/chunks/discard-NTONJLH6.js +14 -0
  173. package/dist/chunks/edit-5TTS2KXH.js +8 -0
  174. package/dist/chunks/edit-T3TLRCN7.js +9 -0
  175. package/dist/chunks/enable-MQS3YEHK.js +7 -0
  176. package/dist/chunks/{esm-4ZHGYTUV.js → esm-CF5UHWPM.js} +1 -1
  177. package/dist/chunks/{esm-LNIAU767.js → esm-EYOXGOVF.js} +1 -1
  178. package/dist/chunks/{esm-IBY43SSX.js → esm-FSME24KA.js} +1 -1
  179. package/dist/chunks/{esm-7FVTQHRH.js → esm-IUATPKKB.js} +1 -1
  180. package/dist/chunks/{esm-GTSUYLKG.js → esm-L6OKDFWP.js} +1 -1
  181. package/dist/chunks/{esm-TEM4KPXZ.js → esm-ORQC2ZSA.js} +1 -1
  182. package/dist/chunks/{esm-TLAM7FSK.js → esm-PYIZNQIK.js} +1 -1
  183. package/dist/chunks/{exec-H3X7U4P3.js → exec-RQ257MTR.js} +1 -1
  184. package/dist/chunks/{export-25TQ3YBT.js → export-JFOZSZ3A.js} +1 -1
  185. package/dist/chunks/future-UE6MKJBW.js +7 -0
  186. package/dist/chunks/generate-cert-for-deploy-QOZGFDZ3.js +7 -0
  187. package/dist/chunks/image-L464C43M.js +7 -0
  188. package/dist/chunks/import-builders-OKHP2LMP.js +7 -0
  189. package/dist/chunks/{inspect-3W3TUJ6P.js → inspect-6X7WDJ7A.js} +1 -1
  190. package/dist/chunks/inspect-I6LQLOBG.js +8 -0
  191. package/dist/chunks/inspect-J6DQEWE6.js +9 -0
  192. package/dist/chunks/{inspect-BRYVSQBD.js → inspect-MEXR5NED.js} +1 -1
  193. package/dist/chunks/{inspect-TN2QY3BP.js → inspect-PB7FEMTF.js} +1 -1
  194. package/dist/chunks/inspect-QVKTTC25.js +13 -0
  195. package/dist/chunks/list-763XVNFH.js +8 -0
  196. package/dist/chunks/{list-WA6Q7DUN.js → list-JNP2JS6S.js} +1 -1
  197. package/dist/chunks/list-WCFVA323.js +12 -0
  198. package/dist/chunks/{list-6W4UQBY4.js → list-YABLIB6F.js} +1 -1
  199. package/dist/chunks/login-ESQGN76L.js +7 -0
  200. package/dist/chunks/login-TCDMQCUN.js +9 -0
  201. package/dist/chunks/logs-XQ3GRSVT.js +7 -0
  202. package/dist/chunks/ls-G3LVLUUA.js +11 -0
  203. package/dist/chunks/{ls-4WP6LHLL.js → ls-HN627DO2.js} +1 -1
  204. package/dist/chunks/{ls-UXE5RSZN.js → ls-IDVSAIXK.js} +1 -1
  205. package/dist/chunks/{ls-L5LLKZBV.js → ls-QJRJMA3M.js} +1 -1
  206. package/dist/chunks/ls-VHFDKCAX.js +8 -0
  207. package/dist/chunks/ls-VKEGSWJC.js +8 -0
  208. package/dist/chunks/{ls-MAJ4QZTY.js → ls-WS2Y3HLU.js} +1 -1
  209. package/dist/chunks/migrate-experimental-services-ACV46HSU.js +7 -0
  210. package/dist/chunks/mutate-YODDN5YZ.js +9 -0
  211. package/dist/chunks/{native-self-update-DEVBYOH2.js → native-self-update-7LL6RPJW.js} +1 -1
  212. package/dist/chunks/notifications-JB5C3EOX.js +7 -0
  213. package/dist/chunks/open-U3RARGVY.js +7 -0
  214. package/dist/chunks/openapi-457MABMI.js +7 -0
  215. package/dist/chunks/permissions-IJ5RWOFN.js +7 -0
  216. package/dist/chunks/{plugin-offer-JUYWL4I7.js → plugin-offer-G2O7LE5J.js} +1 -1
  217. package/dist/chunks/prompt-missing-credentials-64B3MTSQ.js +7 -0
  218. package/dist/chunks/publish-U5CL2T2R.js +15 -0
  219. package/dist/chunks/pull-2GWUZBZP.js +7 -0
  220. package/dist/chunks/purchase-domain-if-available-YAXCMJJ4.js +7 -0
  221. package/dist/chunks/push-KLJAUP23.js +7 -0
  222. package/dist/chunks/query-L24ELT33.js +12 -0
  223. package/dist/chunks/reauthenticate-B6AQPMND.js +7 -0
  224. package/dist/chunks/remove-PWS5EJ7F.js +9 -0
  225. package/dist/chunks/reorder-UHLYHQWA.js +10 -0
  226. package/dist/chunks/reply-6K6KF3BQ.js +9 -0
  227. package/dist/chunks/resolve-NBUE43YD.js +12 -0
  228. package/dist/chunks/resolve-agent-team-A2MA7WKR.js +7 -0
  229. package/dist/chunks/{resolve-deployment-framework-preset-AXXYBFCL.js → resolve-deployment-framework-preset-4TKUU6AH.js} +1 -1
  230. package/dist/chunks/restore-6E42I6QB.js +16 -0
  231. package/dist/chunks/rm-ACOGDOLU.js +8 -0
  232. package/dist/chunks/rm-CQTPSSV7.js +8 -0
  233. package/dist/chunks/rm-J4ADWWIH.js +8 -0
  234. package/dist/chunks/rm-Q45IZPKT.js +8 -0
  235. package/dist/chunks/rm-SCRKJUPY.js +8 -0
  236. package/dist/chunks/{routes-BP54NO3Z.js → routes-NEZJKMR5.js} +1 -1
  237. package/dist/chunks/rule-inspect-J4FPZ744.js +8 -0
  238. package/dist/chunks/{schema-753JMRZA.js → schema-JYUBHEHG.js} +1 -1
  239. package/dist/chunks/schema-X6YVMDC2.js +14 -0
  240. package/dist/chunks/select-org-ZDUXNG4O.js +7 -0
  241. package/dist/chunks/set-NYEQ7AZZ.js +7 -0
  242. package/dist/chunks/set-Q2EJ3V44.js +9 -0
  243. package/dist/chunks/setup-and-link-4QGFYNOP.js +7 -0
  244. package/dist/chunks/{skills-QZ4AMS2K.js → skills-DUOUHPBY.js} +1 -1
  245. package/dist/chunks/{statuspage-KHTMA4WL.js → statuspage-K5SC7KAQ.js} +1 -1
  246. package/dist/chunks/{detect-projects-K7SVMH5T.js → table-W6LOHWWF.js} +1 -1
  247. package/dist/chunks/tags-AX2D63LZ.js +7 -0
  248. package/dist/chunks/{types-NPUAHKSK.js → types-7L6HBXAU.js} +1 -1
  249. package/dist/chunks/{update-7XH7HM5F.js → update-WJXK5YUS.js} +1 -1
  250. package/dist/chunks/usage-WDUNWCTW.js +13 -0
  251. package/dist/chunks/validate-config-YLL6RPCP.js +7 -0
  252. package/dist/commands/build/index.js +1 -1
  253. package/dist/commands/deploy/index.js +19 -37
  254. package/dist/commands/dev/index.js +4 -4
  255. package/dist/commands/env/index.js +1 -1
  256. package/dist/commands/link/index.js +1 -1
  257. package/dist/commands/list/index.js +1 -1
  258. package/dist/commands/project/index.js +1 -1
  259. package/dist/commands-account.js +3 -3
  260. package/dist/commands-ai.js +6 -6
  261. package/dist/commands-blob.js +1 -1
  262. package/dist/commands-core.js +20 -20
  263. package/dist/commands-deployments.js +5 -5
  264. package/dist/commands-flags.js +1 -1
  265. package/dist/commands-integrations.js +1 -1
  266. package/dist/commands-observability.js +15 -8
  267. package/dist/commands-routing.js +5 -4
  268. package/dist/help.js +1 -1
  269. package/dist/index.js +5 -5
  270. package/dist/internal-build.js +1 -1
  271. package/dist/package.json +45 -245
  272. package/dist/vc.js +47 -695
  273. package/dist/version.mjs +1 -1
  274. package/package.json +50 -195
  275. package/dist/chunks/add-4R6FUHQT.js +0 -8
  276. package/dist/chunks/add-F3H4BFJZ.js +0 -8
  277. package/dist/chunks/add-TCOJ4SIQ.js +0 -8
  278. package/dist/chunks/build-GOLTZF6S.js +0 -7
  279. package/dist/chunks/chunk-3KJ6HWSX.js +0 -7
  280. package/dist/chunks/chunk-5X635INY.js +0 -11
  281. package/dist/chunks/chunk-7LPNDK2O.js +0 -7
  282. package/dist/chunks/chunk-A3M2BHWR.js +0 -13
  283. package/dist/chunks/chunk-BUFEV3T4.js +0 -11
  284. package/dist/chunks/chunk-BVR6OIU5.js +0 -7
  285. package/dist/chunks/chunk-D7BB5BPA.js +0 -10
  286. package/dist/chunks/chunk-DBT6PGEH.js +0 -7
  287. package/dist/chunks/chunk-DRZVM7CB.js +0 -12
  288. package/dist/chunks/chunk-EICEQXVS.js +0 -7
  289. package/dist/chunks/chunk-F2R7L3ZB.js +0 -7
  290. package/dist/chunks/chunk-FHMCTV5E.js +0 -7
  291. package/dist/chunks/chunk-FOE3MWES.js +0 -7
  292. package/dist/chunks/chunk-HKU6D7DU.js +0 -8
  293. package/dist/chunks/chunk-IOTKHTZH.js +0 -7
  294. package/dist/chunks/chunk-K4JTCVNW.js +0 -13
  295. package/dist/chunks/chunk-LALPOYIA.js +0 -8
  296. package/dist/chunks/chunk-M3R7F2N4.js +0 -7
  297. package/dist/chunks/chunk-MUKXOI2K.js +0 -8
  298. package/dist/chunks/chunk-NIS66BFX.js +0 -63
  299. package/dist/chunks/chunk-NSPW47RU.js +0 -7
  300. package/dist/chunks/chunk-NTDP6RTQ.js +0 -11
  301. package/dist/chunks/chunk-Q2QVK3TH.js +0 -7
  302. package/dist/chunks/chunk-RM3ZDRYE.js +0 -7
  303. package/dist/chunks/chunk-UCRMJMH6.js +0 -10
  304. package/dist/chunks/chunk-XQDHMFQY.js +0 -7
  305. package/dist/chunks/chunk-XRIM4BUF.js +0 -7
  306. package/dist/chunks/chunk-Z64MQIOE.js +0 -10
  307. package/dist/chunks/chunk-ZS2WS4AM.js +0 -7
  308. package/dist/chunks/clear-PECHXMV5.js +0 -8
  309. package/dist/chunks/compile-vercel-config-EM3HYOQC.js +0 -7
  310. package/dist/chunks/config-DA2NZUDH.js +0 -8
  311. package/dist/chunks/config-X6O3DT7V.js +0 -7
  312. package/dist/chunks/contract-RHMWRX4W.js +0 -10
  313. package/dist/chunks/delete-5RN5VW5L.js +0 -9
  314. package/dist/chunks/delete-MT6I7R7K.js +0 -10
  315. package/dist/chunks/detect-services-HSA4JHJX.js +0 -7
  316. package/dist/chunks/disable-LXPZDQMC.js +0 -7
  317. package/dist/chunks/discard-PW65T65S.js +0 -14
  318. package/dist/chunks/edit-WFSONASO.js +0 -8
  319. package/dist/chunks/edit-YID3FOJ3.js +0 -9
  320. package/dist/chunks/enable-X2EKQCIY.js +0 -7
  321. package/dist/chunks/future-DQBK457G.js +0 -7
  322. package/dist/chunks/generate-cert-for-deploy-OMEACY5G.js +0 -7
  323. package/dist/chunks/image-AO2OZG4W.js +0 -7
  324. package/dist/chunks/import-builders-GSDV4K4A.js +0 -7
  325. package/dist/chunks/inspect-4244CRHI.js +0 -13
  326. package/dist/chunks/inspect-C43IV7X4.js +0 -9
  327. package/dist/chunks/inspect-RP5KXOYQ.js +0 -8
  328. package/dist/chunks/list-2SY6PZLC.js +0 -12
  329. package/dist/chunks/list-WBKZGIMQ.js +0 -8
  330. package/dist/chunks/login-K6XBWOFD.js +0 -9
  331. package/dist/chunks/login-OGMXEW5N.js +0 -7
  332. package/dist/chunks/logs-R3ZERQ7M.js +0 -7
  333. package/dist/chunks/ls-EVAQD3LI.js +0 -8
  334. package/dist/chunks/ls-O5DKK3TY.js +0 -8
  335. package/dist/chunks/ls-PTHGXQLK.js +0 -11
  336. package/dist/chunks/mutate-EKZWPQQJ.js +0 -9
  337. package/dist/chunks/notifications-F5S3RKZF.js +0 -7
  338. package/dist/chunks/open-KGVG54NN.js +0 -7
  339. package/dist/chunks/openapi-7TPDTMCU.js +0 -7
  340. package/dist/chunks/permissions-5K7JZOMB.js +0 -7
  341. package/dist/chunks/prompt-missing-credentials-DX2KJB5X.js +0 -7
  342. package/dist/chunks/publish-KIRTO2ZO.js +0 -15
  343. package/dist/chunks/pull-3CRJK7BX.js +0 -7
  344. package/dist/chunks/purchase-domain-if-available-55IXEF43.js +0 -7
  345. package/dist/chunks/push-4YG5HKSD.js +0 -7
  346. package/dist/chunks/query-67KQVLTR.js +0 -12
  347. package/dist/chunks/reauthenticate-SWSBFGDU.js +0 -7
  348. package/dist/chunks/remove-SYTIFVWW.js +0 -9
  349. package/dist/chunks/reorder-TX5MXJEB.js +0 -10
  350. package/dist/chunks/reply-XVK33N5T.js +0 -9
  351. package/dist/chunks/resolve-JZ262ZF4.js +0 -12
  352. package/dist/chunks/resolve-agent-team-BG5YW55B.js +0 -7
  353. package/dist/chunks/restore-IPFL7TKT.js +0 -16
  354. package/dist/chunks/rm-2BCAZGQU.js +0 -8
  355. package/dist/chunks/rm-3CCU3CE6.js +0 -8
  356. package/dist/chunks/rm-5CQV5LYG.js +0 -8
  357. package/dist/chunks/rm-OV4OU6H2.js +0 -8
  358. package/dist/chunks/rm-WFGMOZ3G.js +0 -8
  359. package/dist/chunks/rule-inspect-RFJIIXZH.js +0 -8
  360. package/dist/chunks/schema-SUNFQGUL.js +0 -14
  361. package/dist/chunks/select-org-MPHPWWPU.js +0 -7
  362. package/dist/chunks/set-BR6EEOPB.js +0 -7
  363. package/dist/chunks/set-I3NWZRSI.js +0 -9
  364. package/dist/chunks/setup-and-link-MRTKVOWD.js +0 -7
  365. package/dist/chunks/tags-7DIZEAVE.js +0 -7
  366. package/dist/chunks/usage-3BS7JCCU.js +0 -13
  367. package/dist/chunks/validate-config-LAD7BU3B.js +0 -7
  368. package/dist/launcher-errors.js +0 -11
  369. package/dist/native-download.js +0 -8
@@ -4,4 +4,4 @@ import { dirname as __dirname_ } from 'node:path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  const __filename = __fileURLToPath(import.meta.url);
6
6
  const __dirname = __dirname_(__filename);
7
- import{outputError}from"./chunk-42FOKWGX.js";import{canPrompt}from"./chunk-IQ7FPAI4.js";import{readFileSync}from"node:fs";function readAllStandardInput(stdin){return stdin.isTTY?Promise.resolve(""):new Promise(resolve=>{let chunks=[],timer=setTimeout(()=>{chunks.length===0&&(cleanup(),resolve(""))},500),onData=chunk=>{chunks.push(String(chunk))},onEnd=()=>{cleanup(),resolve(chunks.join(""))};function cleanup(){clearTimeout(timer),stdin.off("data",onData),stdin.off("end",onEnd)}stdin.setEncoding("utf8"),stdin.on("data",onData),stdin.on("end",onEnd)})}async function resolveMessageContent(client,flags,jsonOutput){if(flags.message!==void 0&&flags.file!==void 0)return outputError(client,jsonOutput,"CONFLICTING_CONTENT","Use either --message or --file, not both.");if(flags.message!==void 0)return flags.message;if(flags.file!==void 0){if(flags.file==="-"){let piped2=await readAllStandardInput(client.stdin);return piped2||outputError(client,jsonOutput,"MISSING_CONTENT","No content received on stdin for `--file -`.")}try{return readFileSync(flags.file,"utf8")}catch(err){return outputError(client,jsonOutput,"FILE_READ_ERROR",`Could not read ${flags.file}: ${err instanceof Error?err.message:String(err)}`)}}let piped=await readAllStandardInput(client.stdin);if(piped)return piped;if(!flags.hasAttachments){if(canPrompt(client)&&!jsonOutput){let text=await client.input.text({message:"Comment message:"});if(text)return text}return outputError(client,jsonOutput,"MISSING_CONTENT",'No content provided. Pass --message <text>, --file <path>, or pipe stdin (e.g. `echo "LGTM" | vercel comments reply <thread>`).')}}export{resolveMessageContent};
7
+ import{outputError}from"./chunk-7PGDJTAH.js";import{canPrompt}from"./chunk-IQ7FPAI4.js";import{readFileSync}from"node:fs";function readAllStandardInput(stdin){return stdin.isTTY?Promise.resolve(""):new Promise(resolve=>{let chunks=[],timer=setTimeout(()=>{chunks.length===0&&(cleanup(),resolve(""))},500),onData=chunk=>{chunks.push(String(chunk))},onEnd=()=>{cleanup(),resolve(chunks.join(""))};function cleanup(){clearTimeout(timer),stdin.off("data",onData),stdin.off("end",onEnd)}stdin.setEncoding("utf8"),stdin.on("data",onData),stdin.on("end",onEnd)})}async function resolveMessageContent(client,flags,jsonOutput){if(flags.message!==void 0&&flags.file!==void 0)return outputError(client,jsonOutput,"CONFLICTING_CONTENT","Use either --message or --file, not both.");if(flags.message!==void 0)return flags.message;if(flags.file!==void 0){if(flags.file==="-"){let piped2=await readAllStandardInput(client.stdin);return piped2||outputError(client,jsonOutput,"MISSING_CONTENT","No content received on stdin for `--file -`.")}try{return readFileSync(flags.file,"utf8")}catch(err){return outputError(client,jsonOutput,"FILE_READ_ERROR",`Could not read ${flags.file}: ${err instanceof Error?err.message:String(err)}`)}}let piped=await readAllStandardInput(client.stdin);if(piped)return piped;if(!flags.hasAttachments){if(canPrompt(client)&&!jsonOutput){let text=await client.input.text({message:"Comment message:"});if(text)return text}return outputError(client,jsonOutput,"MISSING_CONTENT",'No content provided. Pass --message <text>, --file <path>, or pipe stdin (e.g. `echo "LGTM" | vercel comments reply <thread>`).')}}export{resolveMessageContent};
@@ -4,4 +4,4 @@ import { dirname as __dirname_ } from 'node:path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  const __filename = __fileURLToPath(import.meta.url);
6
6
  const __dirname = __dirname_(__filename);
7
- import{performDeviceCodeFlow}from"./chunk-4T57TXQ3.js";import{isAPIError}from"./chunk-4DMKP6AO.js";import{output_manager_default}from"./chunk-GZLYNPNU.js";import{URLSearchParams}from"url";var RECOVERABLE_CHALLENGE_CODES=new Set(["challenge_required","challenge_required_email_otp","user_auth_required"]);async function withEnvChallengeRecovery(client,fn){let hadStoredSession=!!(client.authConfig.token||client.authConfig.refreshToken);try{return await fn()}catch(error){if(!isAPIError(error))throw error;let isRecoverableChallenge=RECOVERABLE_CHALLENGE_CODES.has(error.code),isRejectedStoredSession=hadStoredSession&&error.invalidToken===!0;if(!isRecoverableChallenge&&!isRejectedStoredSession||client.authConfig.tokenSource||!client.stdin.isTTY||client.nonInteractive)throw error;output_manager_default.stopSpinner(),output_manager_default.log("Sensitive Environment Variables require fresh authentication.");let refreshToken=client.authConfig.refreshToken,acrValues=getAcrValuesFromWWWAuthenticate(error.wwwAuthenticate),tokens=isRecoverableChallenge&&refreshToken&&acrValues?await performDeviceCodeFlow(client,{refreshToken,acrValues,fallbackToLoginOnStepUpFailure:!0}):await performDeviceCodeFlow(client);if(!tokens)throw error;return client.updateAuthConfig({token:tokens.access_token,userId:void 0,expiresAt:Math.floor(Date.now()/1e3)+tokens.expires_in,refreshToken:tokens.refresh_token,dpop:tokens.dpop}),client.persistAuthConfig(),await fn()}}function getAcrValuesFromWWWAuthenticate(header){if(!header)return;let lowerHeader=header.toLowerCase(),scheme=lowerHeader.includes("bearer")?"bearer":"dpop",schemeIndex=lowerHeader.indexOf(scheme);if(schemeIndex===-1)return;let match=header.slice(schemeIndex+scheme.length).match(/(?:^|[,\s])acr_values=(?:"((?:\\.|[^"\\])*)"|([^,\s]+))/i);return match?.[1]?.replace(/\\(.)/g,"$1")??match?.[2]}async function getEnvRecords(client,projectId,source,{target,gitBranch,decrypt}={}){output_manager_default.debug(`Fetching Environment Variables of project ${projectId} and target ${target}`);let query=new URLSearchParams;if(target){let targetParam="target";target!=="production"&&target!=="preview"&&target!=="development"&&(targetParam="customEnvironmentId"),query.set(targetParam,target)}gitBranch&&query.set("gitBranch",gitBranch),decrypt&&query.set("decrypt",decrypt.toString()),source&&query.set("source",source);let url=`/v10/projects/${projectId}/env?${query}`;return withEnvChallengeRecovery(client,()=>client.fetch(url))}async function pullEnvRecords(client,projectIdOrDeploymentId,source,{target,gitBranch}={}){output_manager_default.debug(`Fetching Environment Variables of ${projectIdOrDeploymentId} and target ${target}`);let query=new URLSearchParams,url=`/v3/env/pull/${projectIdOrDeploymentId}`;return projectIdOrDeploymentId.startsWith("dpl_")||target&&(url+=`/${encodeURIComponent(target)}`,gitBranch&&(url+=`/${encodeURIComponent(gitBranch)}`)),source&&query.set("source",source),Array.from(query).length>0&&(url+=`?${query}`),withEnvChallengeRecovery(client,()=>client.fetch(url))}var parseEnv=env=>{if(!env)return{};if(typeof env=="string"&&(env=[env]),Array.isArray(env)){let startingDict={};return env.reduce((o,e)=>{let key,value,equalsSign=e.indexOf("=");return equalsSign===-1?key=e:(key=e.slice(0,equalsSign),value=e.slice(equalsSign+1)),o[key]=value,o},startingDict)}return env};export{getEnvRecords,pullEnvRecords,parseEnv};
7
+ import{performDeviceCodeFlow}from"./chunk-XTCS76ZH.js";import{isAPIError}from"./chunk-GOI2VVI7.js";import{output_manager_default}from"./chunk-YNCWSPPJ.js";import{URLSearchParams}from"url";var RECOVERABLE_CHALLENGE_CODES=new Set(["challenge_required","challenge_required_email_otp","user_auth_required"]);async function withEnvChallengeRecovery(client,fn){let hadStoredSession=!!(client.authConfig.token||client.authConfig.refreshToken);try{return await fn()}catch(error){if(!isAPIError(error))throw error;let isRecoverableChallenge=RECOVERABLE_CHALLENGE_CODES.has(error.code),isRejectedStoredSession=hadStoredSession&&error.invalidToken===!0;if(!isRecoverableChallenge&&!isRejectedStoredSession||client.authConfig.tokenSource||!client.stdin.isTTY||client.nonInteractive)throw error;output_manager_default.stopSpinner(),output_manager_default.log("Sensitive Environment Variables require fresh authentication.");let refreshToken=client.authConfig.refreshToken,acrValues=getAcrValuesFromWWWAuthenticate(error.wwwAuthenticate),tokens=isRecoverableChallenge&&refreshToken&&acrValues?await performDeviceCodeFlow(client,{refreshToken,acrValues,fallbackToLoginOnStepUpFailure:!0}):await performDeviceCodeFlow(client);if(!tokens)throw error;return client.updateAuthConfig({token:tokens.access_token,userId:void 0,expiresAt:Math.floor(Date.now()/1e3)+tokens.expires_in,refreshToken:tokens.refresh_token,dpop:tokens.dpop}),client.persistAuthConfig(),await fn()}}function getAcrValuesFromWWWAuthenticate(header){if(!header)return;let lowerHeader=header.toLowerCase(),scheme=lowerHeader.includes("bearer")?"bearer":"dpop",schemeIndex=lowerHeader.indexOf(scheme);if(schemeIndex===-1)return;let match=header.slice(schemeIndex+scheme.length).match(/(?:^|[,\s])acr_values=(?:"((?:\\.|[^"\\])*)"|([^,\s]+))/i);return match?.[1]?.replace(/\\(.)/g,"$1")??match?.[2]}async function getEnvRecords(client,projectId,source,{target,gitBranch,decrypt}={}){output_manager_default.debug(`Fetching Environment Variables of project ${projectId} and target ${target}`);let query=new URLSearchParams;if(target){let targetParam="target";target!=="production"&&target!=="preview"&&target!=="development"&&(targetParam="customEnvironmentId"),query.set(targetParam,target)}gitBranch&&query.set("gitBranch",gitBranch),decrypt&&query.set("decrypt",decrypt.toString()),source&&query.set("source",source);let url=`/v10/projects/${projectId}/env?${query}`;return withEnvChallengeRecovery(client,()=>client.fetch(url))}async function pullEnvRecords(client,projectIdOrDeploymentId,source,{target,gitBranch}={}){output_manager_default.debug(`Fetching Environment Variables of ${projectIdOrDeploymentId} and target ${target}`);let query=new URLSearchParams,url=`/v3/env/pull/${projectIdOrDeploymentId}`;return projectIdOrDeploymentId.startsWith("dpl_")||target&&(url+=`/${encodeURIComponent(target)}`,gitBranch&&(url+=`/${encodeURIComponent(gitBranch)}`)),source&&query.set("source",source),Array.from(query).length>0&&(url+=`?${query}`),withEnvChallengeRecovery(client,()=>client.fetch(url))}export{getEnvRecords,pullEnvRecords};
@@ -4,4 +4,4 @@ import { dirname as __dirname_ } from 'node:path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  const __filename = __fileURLToPath(import.meta.url);
6
6
  const __dirname = __dirname_(__filename);
7
- import{packageName}from"./chunk-VRH7LWOC.js";import{formatOption,jsonOption,limitOption,projectOption,sinceOption,untilOption}from"./chunk-AMPJ6RWT.js";var listSubcommand={name:"ls",aliases:["list"],description:"",default:!0,hidden:!0,arguments:[],options:[],examples:[]},inspectSubcommand={name:"inspect",aliases:[],description:"Show details for a single alert group",arguments:[{name:"groupId",required:!0}],options:[formatOption,jsonOption,{...projectOption,shorthand:"p",description:"Filter by project (overrides auto-detected linked project)."},{name:"all",shorthand:"a",type:Boolean,deprecated:!1,description:"Use team-wide scope (ignore linked project auto-scoping)."}],examples:[{name:"Inspect a group in the linked project",value:`${packageName} alerts inspect grp_abc123`},{name:"Inspect as JSON",value:`${packageName} alerts inspect grp_abc123 --json`}]},alertsCommand={name:"alerts",aliases:[],description:"List alert groups or inspect a group. To manage alert rules, see `vercel monitors`.",arguments:[],subcommands:[listSubcommand,inspectSubcommand],options:[{name:"type",shorthand:null,type:[String],argument:"TYPE",deprecated:!1,description:"Filter by alert type. Repeatable and comma-separated (for example --type usage_anomaly,error_anomaly)."},{...projectOption,shorthand:"p",description:"Filter by project (overrides auto-detected linked project)."},{name:"all",shorthand:"a",type:Boolean,deprecated:!1,description:"Show team-wide alerts (ignore linked project auto-scoping)."},{name:"ai",shorthand:null,type:Boolean,deprecated:!1,description:"Print AI-focused sections (title, resolved time, summary, key findings) instead of table output."},{...sinceOption,description:`${sinceOption.description} (default: 24h ago)`},untilOption,limitOption,formatOption,jsonOption],examples:[{name:"List alerts for the linked project",value:`${packageName} alerts`},{name:"List team-wide alerts",value:`${packageName} alerts --all`},{name:"Filter by type",value:`${packageName} alerts --type usage_anomaly --type error_anomaly`},{name:"Output JSON",value:`${packageName} alerts --json`},{name:"Custom time range",value:`${packageName} alerts --since 2026-03-01T00:00:00.000Z --until 2026-03-02T00:00:00.000Z`}]};export{listSubcommand,inspectSubcommand,alertsCommand};
7
+ import{packageName}from"./chunk-B4KA3ZH2.js";import{formatOption,jsonOption,limitOption,projectOption,sinceOption,untilOption}from"./chunk-EZVNGJN5.js";var listSubcommand={name:"ls",aliases:["list"],description:"",default:!0,hidden:!0,arguments:[],options:[],examples:[]},inspectSubcommand={name:"inspect",aliases:[],description:"Show details for a single alert group",arguments:[{name:"groupId",required:!0}],options:[formatOption,jsonOption,{...projectOption,shorthand:"p",description:"Filter by project (overrides auto-detected linked project)."},{name:"all",shorthand:"a",type:Boolean,deprecated:!1,description:"Use team-wide scope (ignore linked project auto-scoping)."}],examples:[{name:"Inspect a group in the linked project",value:`${packageName} alerts inspect grp_abc123`},{name:"Inspect as JSON",value:`${packageName} alerts inspect grp_abc123 --json`}]},alertsCommand={name:"alerts",aliases:[],description:"List alert groups or inspect a group. To manage alert rules, see `vercel monitors`.",arguments:[],subcommands:[listSubcommand,inspectSubcommand],options:[{name:"type",shorthand:null,type:[String],argument:"TYPE",deprecated:!1,description:"Filter by alert type. Repeatable and comma-separated (for example --type usage_anomaly,error_anomaly)."},{...projectOption,shorthand:"p",description:"Filter by project (overrides auto-detected linked project)."},{name:"all",shorthand:"a",type:Boolean,deprecated:!1,description:"Show team-wide alerts (ignore linked project auto-scoping)."},{name:"ai",shorthand:null,type:Boolean,deprecated:!1,description:"Print AI-focused sections (title, resolved time, summary, key findings) instead of table output."},{...sinceOption,description:`${sinceOption.description} (default: 24h ago)`},untilOption,limitOption,formatOption,jsonOption],examples:[{name:"List alerts for the linked project",value:`${packageName} alerts`},{name:"List team-wide alerts",value:`${packageName} alerts --all`},{name:"Filter by type",value:`${packageName} alerts --type usage_anomaly --type error_anomaly`},{name:"Output JSON",value:`${packageName} alerts --json`},{name:"Custom time range",value:`${packageName} alerts --since 2026-03-01T00:00:00.000Z --until 2026-03-02T00:00:00.000Z`}]};export{listSubcommand,inspectSubcommand,alertsCommand};
@@ -4,4 +4,4 @@ import { dirname as __dirname_ } from 'node:path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  const __filename = __fileURLToPath(import.meta.url);
6
6
  const __dirname = __dirname_(__filename);
7
- import{require_json_parse_better_errors}from"./chunk-25565AGS.js";import{require_lib}from"./chunk-2J35YKA2.js";import{CantParseJSONFile}from"./chunk-4DMKP6AO.js";import{require_dist}from"./chunk-RM3ZDRYE.js";import{__toESM}from"./chunk-BZENIQ7N.js";var import_fs_extra=__toESM(require_lib(),1);var import_json_parse_better_errors=__toESM(require_json_parse_better_errors(),1),import_error_utils=__toESM(require_dist(),1);async function readJSONFile(file){let content=await readFileSafe(file);if(content===null)return content;try{return(0,import_json_parse_better_errors.default)(content)}catch(error){return new CantParseJSONFile(file,(0,import_error_utils.errorToString)(error))}}async function readFileSafe(file){try{return await import_fs_extra.default.readFile(file,"utf8")}catch{return null}}export{readJSONFile};
7
+ import{require_json_parse_better_errors}from"./chunk-25565AGS.js";import{require_lib}from"./chunk-TFTF3C3G.js";import{CantParseJSONFile}from"./chunk-GOI2VVI7.js";import{require_dist}from"./chunk-MCYG7CCE.js";import{__toESM}from"./chunk-BZENIQ7N.js";var import_fs_extra=__toESM(require_lib(),1);var import_json_parse_better_errors=__toESM(require_json_parse_better_errors(),1),import_error_utils=__toESM(require_dist(),1);async function readJSONFile(file){let content=await readFileSafe(file);if(content===null)return content;try{return(0,import_json_parse_better_errors.default)(content)}catch(error){return new CantParseJSONFile(file,(0,import_error_utils.errorToString)(error))}}async function readFileSafe(file){try{return await import_fs_extra.default.readFile(file,"utf8")}catch{return null}}export{readJSONFile};
@@ -4,4 +4,4 @@ import { dirname as __dirname_ } from 'node:path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  const __filename = __fileURLToPath(import.meta.url);
6
6
  const __dirname = __dirname_(__filename);
7
- import{tracesConfigCommand}from"./chunk-IHTWZEQW.js";import{packageName}from"./chunk-VRH7LWOC.js";import{deploymentOption,nextCursorOption,projectOption,protectionBypassOption,sinceOption,untilOption,yesOption}from"./chunk-AMPJ6RWT.js";var spanQueryOptions=[{...projectOption,shorthand:"p",description:"Filter spans to one project (default: all team projects)"},{name:"environment",shorthand:"e",type:String,argument:"ENVIRONMENT",deprecated:!1,description:"Environment: production or preview (case-insensitive)"},{name:"service",shorthand:null,type:String,deprecated:!1,description:"Filter by service name"},{name:"name",shorthand:null,type:String,deprecated:!1,description:"Filter by span name"},{name:"kind",shorthand:null,type:String,deprecated:!1,description:"Filter by span kind: unspecified (0), internal (1), server (2), client (3), producer (4), consumer (5)"},{name:"status",shorthand:null,type:String,deprecated:!1,description:"Status: error, ok, or unset (case-insensitive)"},{...deploymentOption,description:"Filter by deployment ID"},{name:"deployment-id",shorthand:null,type:String,deprecated:!0},{name:"request-id",shorthand:null,type:String,deprecated:!1,description:"Filter by request ID. Some IDs return 404 in traces inspect. Reuse --scope and --project. See traces inspect --help."},{name:"trace",shorthand:null,type:String,argument:"TRACE",deprecated:!1,description:"Filter by trace ID"},{name:"trace-id",shorthand:null,type:String,deprecated:!0},{name:"span",shorthand:null,type:String,argument:"SPAN",deprecated:!1,description:"Filter by span ID"},{name:"span-id",shorthand:null,type:String,deprecated:!0},{name:"root",shorthand:null,type:Boolean,deprecated:!1,description:"Show root spans only"},{...sinceOption,description:`${sinceOption.description} (default: 1h ago)`},untilOption];var requestIdLookupHelp={title:"Request-ID lookup",body:["A request ID in search results does not guarantee traces inspect can retrieve the trace. Lookup requires a matching root span in the same project within 30 minutes after the request-ID timestamp.","","If no matching root is found, lookup returns 404. Use the same --scope and --project for search and inspect."]},getSubcommand={name:"inspect",aliases:["get"],default:!0,description:"Show a captured trace by trace ID or request ID",helpSections:[{title:"Trace-ID lookup",body:["A 32-character hexadecimal ID selects trace-ID lookup. Other IDs select request-ID lookup.","Trace-ID lookup retrieves the trace directly within the trace retention window. Use the same --scope and --project as search."]},requestIdLookupHelp],arguments:[{name:"id",required:!0}],options:[{name:"json",shorthand:null,type:Boolean,deprecated:!1,description:"Print the raw trace JSON to stdout"},{name:"project",shorthand:"p",type:String,argument:"NAME|ID",deprecated:!1,description:"Project that owns the trace (default: linked project)"},{name:"open",shorthand:null,type:Boolean,deprecated:!1,description:"Open the trace in the Vercel Dashboard instead of printing it."},{name:"view",shorthand:null,type:String,argument:"timeline|tree|waterfall",deprecated:!1,description:"Dashboard view to open (default: timeline). Only valid with --open."}],examples:[{name:"Inspect a trace by trace ID",value:`${packageName} traces inspect e5c0d1efb3904155472b01692c7f2d00`},{name:"Inspect a trace by request ID",value:`${packageName} traces inspect qb46r-1790847620933-1145d2891a3e`},{name:"Print the raw trace JSON",value:`${packageName} traces inspect e5c0d1efb3904155472b01692c7f2d00 --json`},{name:"Inspect a trace without typing the default inspect subcommand",value:`${packageName} traces e5c0d1efb3904155472b01692c7f2d00`},{name:"Inspect a trace from a specific team and project",value:`${packageName} traces inspect e5c0d1efb3904155472b01692c7f2d00 --scope my-team --project my-app`},{name:"Open the trace in the Vercel Dashboard",value:`${packageName} traces inspect e5c0d1efb3904155472b01692c7f2d00 --open`},{name:"Open the trace in the Vercel Dashboard with the waterfall view",value:`${packageName} traces inspect e5c0d1efb3904155472b01692c7f2d00 --open --view waterfall`}]},createSubcommand={name:"create",aliases:[],description:"Capture a session trace for a request (alias for `vercel curl --trace`).",arguments:[{name:"path",required:!0}],forwardsUnknownOptions:!0,options:[deploymentOption,protectionBypassOption,{name:"json",shorthand:null,type:Boolean,deprecated:!1,description:"Emit { response, requestId } as JSON on stdout"},{...yesOption,description:"Skip the production confirmation prompt (e.g. in non-interactive mode)"}],examples:[{name:"Capture a session trace for a request",value:`${packageName} traces create /api/hello`},{name:"Target a specific deployment",value:`${packageName} traces create /api/status --deployment https://your-project-abc123.vercel.app`},{name:"Pass curl options after the separator",value:`${packageName} traces create /api/test -- --request POST --data '{"name": "John"}'`}]},searchSubcommand={name:"search",aliases:[],description:"Search team spans. Use --project to filter one project. Results are newest first. Duration filters do not sort results.",helpSections:[{title:"Table columns",body:["Available: span.startTime, span.duration, span.name, span.status.code, service.name, environment, request.id, trace.id, span.id, parent.id, span.kind","Default: all except environment, request.id, and span.kind."]},{title:"KQL filters",body:["Fields: project.id, environment, service.name, deployment.id, request.id, user.id, session.id","Span fields: span.name, span.kind, span.id, parent.id, span.isRoot, span.status.code, span.duration","Trace fields: trace.id, trace.state","","Other fields search span attributes first, then resource attributes.","","span.duration uses milliseconds.","span.kind uses the numeric values shown under --kind.","span.status.code uses Error, Ok, or Unset.","Use field:value filters. Plain text search is not supported.","Use NOT to exclude values. End a value with * to match a prefix.","Wrap values with spaces in double quotes. Keep the full query in single quotes."]},{title:"Paging",body:["When more spans match, a Next page command is printed on stderr.","--json prints one span line per record and ends with a summary line; --non-interactive implies --json.","--next continues from the summary's pagination.next value. It keeps the original team, project, filters, and time window, so it can't be combined with them. --limit can change."]}],arguments:[],options:[...spanQueryOptions,{name:"limit",shorthand:"n",type:Number,deprecated:!1,description:"Maximum number of spans (default: 100, max: 1000)"},{name:"query",shorthand:"q",type:String,deprecated:!1,description:"Filter spans using KQL"},{name:"columns",shorthand:null,argument:"LIST",type:String,deprecated:!1,description:"Columns to show, in order. Separate names with commas. Cannot be used with --json or --non-interactive."},{...nextCursorOption,description:"Continue a previous search from its summary's next value"},{name:"json",shorthand:null,type:Boolean,deprecated:!1,description:"Output JSON Lines ending with a summary line"}],examples:[{name:"Find production errors for one service",value:`${packageName} traces search --environment production --service checkout-api --status error --since 1h`},{name:"Use KQL and output JSON Lines",value:`${packageName} traces search --query 'http.route:"/api/checkout"' --kind server --json`},{name:"Exclude span names starting with app/lib/fetch-api",value:`${packageName} traces search --query 'NOT span.name:app/lib/fetch-api*'`},{name:"Exclude exact span names",value:`${packageName} traces search --query 'NOT span.name:("GET /screenshot/v2" OR "middleware GET")'`},{name:"Find spans longer than 2 seconds",value:`${packageName} traces search --query 'span.duration > 2000' --columns span.startTime,span.duration,span.name,span.kind,span.status.code`},{name:"Continue from the summary's next value",placeholders:["<CURSOR>"],value:`${packageName} traces search --next <CURSOR> --json`}]},tracesCommand={name:"traces",aliases:[],description:"Inspect project traces and search spans across a Vercel team.",arguments:[{name:"id",required:!1}],subcommands:[getSubcommand,searchSubcommand,createSubcommand,tracesConfigCommand],options:[],examples:[{name:"Inspect a trace by trace ID",value:`${packageName} traces inspect e5c0d1efb3904155472b01692c7f2d00`},{name:"Inspect a trace by request ID",value:`${packageName} traces inspect qb46r-1790847620933-1145d2891a3e`},{name:"Print the raw trace JSON",value:`${packageName} traces inspect e5c0d1efb3904155472b01692c7f2d00 --json`},{name:"Capture a session trace for a request",value:`${packageName} traces create /api/hello`},{name:"Search recent spans",value:`${packageName} traces search --status error`},{name:"List the trace sampling rules for a project",value:`${packageName} traces config ls`}]};export{getSubcommand,createSubcommand,searchSubcommand,tracesCommand};
7
+ import{tracesConfigCommand}from"./chunk-OKKG2FUS.js";import{packageName}from"./chunk-B4KA3ZH2.js";import{deploymentOption,nextCursorOption,projectOption,protectionBypassOption,sinceOption,untilOption,yesOption}from"./chunk-EZVNGJN5.js";var spanQueryOptions=[{...projectOption,shorthand:"p",description:"Filter spans to one project (default: all team projects)"},{name:"environment",shorthand:"e",type:String,argument:"ENVIRONMENT",deprecated:!1,description:"Environment: production or preview (case-insensitive)"},{name:"service",shorthand:null,type:String,deprecated:!1,description:"Filter by service name"},{name:"name",shorthand:null,type:String,deprecated:!1,description:"Filter by span name"},{name:"kind",shorthand:null,type:String,deprecated:!1,description:"Filter by span kind: unspecified (0), internal (1), server (2), client (3), producer (4), consumer (5)"},{name:"status",shorthand:null,type:String,deprecated:!1,description:"Status: error, ok, or unset (case-insensitive)"},{...deploymentOption,description:"Filter by deployment ID"},{name:"deployment-id",shorthand:null,type:String,deprecated:!0},{name:"request-id",shorthand:null,type:String,deprecated:!1,description:"Filter by request ID. Some IDs return 404 in traces inspect. Reuse --scope and --project. See traces inspect --help."},{name:"trace",shorthand:null,type:String,argument:"TRACE",deprecated:!1,description:"Filter by trace ID"},{name:"trace-id",shorthand:null,type:String,deprecated:!0},{name:"span",shorthand:null,type:String,argument:"SPAN",deprecated:!1,description:"Filter by span ID"},{name:"span-id",shorthand:null,type:String,deprecated:!0},{name:"root",shorthand:null,type:Boolean,deprecated:!1,description:"Show root spans only"},{...sinceOption,description:`${sinceOption.description} (default: 1h ago)`},untilOption];var requestIdLookupHelp={title:"Request-ID lookup",body:["A request ID in search results does not guarantee traces inspect can retrieve the trace. Lookup requires a matching root span in the same project within 30 minutes after the request-ID timestamp.","","If no matching root is found, lookup returns 404. Use the same --scope and --project for search and inspect."]},getSubcommand={name:"inspect",aliases:["get"],default:!0,description:"Show a captured trace by trace ID or request ID",helpSections:[{title:"Trace-ID lookup",body:["A 32-character hexadecimal ID selects trace-ID lookup. Other IDs select request-ID lookup.","Trace-ID lookup retrieves the trace directly within the trace retention window. Use the same --scope and --project as search."]},requestIdLookupHelp],arguments:[{name:"id",required:!0}],options:[{name:"json",shorthand:null,type:Boolean,deprecated:!1,description:"Print the raw trace JSON to stdout"},{name:"project",shorthand:"p",type:String,argument:"NAME|ID",deprecated:!1,description:"Project that owns the trace (default: linked project)"},{name:"open",shorthand:null,type:Boolean,deprecated:!1,description:"Open the trace in the Vercel Dashboard instead of printing it."},{name:"view",shorthand:null,type:String,argument:"timeline|tree|waterfall",deprecated:!1,description:"Dashboard view to open (default: timeline). Only valid with --open."}],examples:[{name:"Inspect a trace by trace ID",value:`${packageName} traces inspect e5c0d1efb3904155472b01692c7f2d00`},{name:"Inspect a trace by request ID",value:`${packageName} traces inspect qb46r-1790847620933-1145d2891a3e`},{name:"Print the raw trace JSON",value:`${packageName} traces inspect e5c0d1efb3904155472b01692c7f2d00 --json`},{name:"Inspect a trace without typing the default inspect subcommand",value:`${packageName} traces e5c0d1efb3904155472b01692c7f2d00`},{name:"Inspect a trace from a specific team and project",value:`${packageName} traces inspect e5c0d1efb3904155472b01692c7f2d00 --scope my-team --project my-app`},{name:"Open the trace in the Vercel Dashboard",value:`${packageName} traces inspect e5c0d1efb3904155472b01692c7f2d00 --open`},{name:"Open the trace in the Vercel Dashboard with the waterfall view",value:`${packageName} traces inspect e5c0d1efb3904155472b01692c7f2d00 --open --view waterfall`}]},createSubcommand={name:"create",aliases:[],description:"Capture a session trace for a request (alias for `vercel curl --trace`).",arguments:[{name:"path",required:!0}],forwardsUnknownOptions:!0,options:[deploymentOption,protectionBypassOption,{name:"json",shorthand:null,type:Boolean,deprecated:!1,description:"Emit { response, requestId } as JSON on stdout"},{...yesOption,description:"Skip the production confirmation prompt (e.g. in non-interactive mode)"}],examples:[{name:"Capture a session trace for a request",value:`${packageName} traces create /api/hello`},{name:"Target a specific deployment",value:`${packageName} traces create /api/status --deployment https://your-project-abc123.vercel.app`},{name:"Pass curl options after the separator",value:`${packageName} traces create /api/test -- --request POST --data '{"name": "John"}'`}]},searchSubcommand={name:"search",aliases:[],description:"Search team spans. Use --project to filter one project. Results are newest first. Duration filters do not sort results.",helpSections:[{title:"Table columns",body:["Available: span.startTime, span.duration, span.name, span.status.code, service.name, environment, request.id, trace.id, span.id, parent.id, span.kind","Default: all except environment, request.id, and span.kind."]},{title:"KQL filters",body:["Fields: project.id, environment, service.name, deployment.id, request.id, user.id, session.id","Span fields: span.name, span.kind, span.id, parent.id, span.isRoot, span.status.code, span.duration","Trace fields: trace.id, trace.state","","Other fields search span attributes first, then resource attributes.","","span.duration uses milliseconds.","span.kind uses the numeric values shown under --kind.","span.status.code uses Error, Ok, or Unset.","Use field:value filters. Plain text search is not supported.","Use NOT to exclude values. End a value with * to match a prefix.","Wrap values with spaces in double quotes. Keep the full query in single quotes."]},{title:"Paging",body:["When more spans match, a Next page command is printed on stderr.","--json prints one span line per record and ends with a summary line; --non-interactive implies --json.","--next continues from the summary's pagination.next value. It keeps the original team, project, filters, and time window, so it can't be combined with them. --limit can change."]}],arguments:[],options:[...spanQueryOptions,{name:"limit",shorthand:"n",type:Number,deprecated:!1,description:"Maximum number of spans (default: 100, max: 1000)"},{name:"query",shorthand:"q",type:String,deprecated:!1,description:"Filter spans using KQL"},{name:"columns",shorthand:null,argument:"LIST",type:String,deprecated:!1,description:"Columns to show, in order. Separate names with commas. Cannot be used with --json or --non-interactive."},{...nextCursorOption,description:"Continue a previous search from its summary's next value"},{name:"json",shorthand:null,type:Boolean,deprecated:!1,description:"Output JSON Lines ending with a summary line"}],examples:[{name:"Find production errors for one service",value:`${packageName} traces search --environment production --service checkout-api --status error --since 1h`},{name:"Use KQL and output JSON Lines",value:`${packageName} traces search --query 'http.route:"/api/checkout"' --kind server --json`},{name:"Exclude span names starting with app/lib/fetch-api",value:`${packageName} traces search --query 'NOT span.name:app/lib/fetch-api*'`},{name:"Exclude exact span names",value:`${packageName} traces search --query 'NOT span.name:("GET /screenshot/v2" OR "middleware GET")'`},{name:"Find spans longer than 2 seconds",value:`${packageName} traces search --query 'span.duration > 2000' --columns span.startTime,span.duration,span.name,span.kind,span.status.code`},{name:"Continue from the summary's next value",placeholders:["<CURSOR>"],value:`${packageName} traces search --next <CURSOR> --json`}]},tracesCommand={name:"traces",aliases:[],description:"Inspect project traces and search spans across a Vercel team.",arguments:[{name:"id",required:!1}],subcommands:[getSubcommand,searchSubcommand,createSubcommand,tracesConfigCommand],options:[],examples:[{name:"Inspect a trace by trace ID",value:`${packageName} traces inspect e5c0d1efb3904155472b01692c7f2d00`},{name:"Inspect a trace by request ID",value:`${packageName} traces inspect qb46r-1790847620933-1145d2891a3e`},{name:"Print the raw trace JSON",value:`${packageName} traces inspect e5c0d1efb3904155472b01692c7f2d00 --json`},{name:"Capture a session trace for a request",value:`${packageName} traces create /api/hello`},{name:"Search recent spans",value:`${packageName} traces search --status error`},{name:"List the trace sampling rules for a project",value:`${packageName} traces config ls`}]};export{getSubcommand,createSubcommand,searchSubcommand,tracesCommand};
@@ -4,4 +4,4 @@ import { dirname as __dirname_ } from 'node:path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  const __filename = __fileURLToPath(import.meta.url);
6
6
  const __dirname = __dirname_(__filename);
7
- import{getTeamByIdOrSlug}from"./chunk-2VBFQZ72.js";import{getCommandName}from"./chunk-VRH7LWOC.js";import{output_manager_default}from"./chunk-GZLYNPNU.js";async function resolveBudgetTeam(client){let id=await client.resolveCurrentTeam();if(!id)return output_manager_default.error("No team selected. Use `vercel --scope <team-slug> budget \u2026` or run `vercel switch` first."),null;try{let team=await getTeamByIdOrSlug(client,id);return{id:team.id,slug:team.slug}}catch{return{id,slug:id}}}function rejectUnexpectedArgs(args,command){return args.length===0?!1:(output_manager_default.error(`Unexpected argument "${args[0]}". ${getCommandName(command)} takes options only.`),!0)}export{resolveBudgetTeam,rejectUnexpectedArgs};
7
+ import{getTeamByIdOrSlug}from"./chunk-2VBFQZ72.js";import{getCommandName}from"./chunk-B4KA3ZH2.js";import{output_manager_default}from"./chunk-YNCWSPPJ.js";async function resolveBudgetTeam(client){let id=await client.resolveCurrentTeam();if(!id)return output_manager_default.error("No team selected. Use `vercel --scope <team-slug> budget \u2026` or run `vercel switch` first."),null;try{let team=await getTeamByIdOrSlug(client,id);return{id:team.id,slug:team.slug}}catch{return{id,slug:id}}}function rejectUnexpectedArgs(args,command){return args.length===0?!1:(output_manager_default.error(`Unexpected argument "${args[0]}". ${getCommandName(command)} takes options only.`),!0)}export{resolveBudgetTeam,rejectUnexpectedArgs};
@@ -4,4 +4,4 @@ import { dirname as __dirname_ } from 'node:path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  const __filename = __fileURLToPath(import.meta.url);
6
6
  const __dirname = __dirname_(__filename);
7
- import{getCommandName}from"./chunk-VRH7LWOC.js";import{output_manager_default}from"./chunk-GZLYNPNU.js";import{require_source}from"./chunk-NB2WLB3J.js";import{__toESM}from"./chunk-BZENIQ7N.js";var import_chalk=__toESM(require_source(),1);function validateLsArgs(options){let{commandName,args,maxArgs=0,exitCode=1,usageString}=options;if(args.length>maxArgs){let usage=usageString||getCommandName(commandName);return output_manager_default.error(`Invalid number of arguments. Usage: ${import_chalk.default.cyan(usage)}`),exitCode}return 0}export{validateLsArgs};
7
+ import{getCommandName}from"./chunk-B4KA3ZH2.js";import{output_manager_default}from"./chunk-YNCWSPPJ.js";import{require_source}from"./chunk-NB2WLB3J.js";import{__toESM}from"./chunk-BZENIQ7N.js";var import_chalk=__toESM(require_source(),1);function validateLsArgs(options){let{commandName,args,maxArgs=0,exitCode=1,usageString}=options;if(args.length>maxArgs){let usage=usageString||getCommandName(commandName);return output_manager_default.error(`Invalid number of arguments. Usage: ${import_chalk.default.cyan(usage)}`),exitCode}return 0}export{validateLsArgs};
@@ -4,5 +4,5 @@ import { dirname as __dirname_ } from 'node:path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  const __filename = __fileURLToPath(import.meta.url);
6
6
  const __dirname = __dirname_(__filename);
7
- import{getTeams}from"./chunk-SLCPSRDR.js";import{param}from"./chunk-3G3FQYMW.js";import{outputActionRequired}from"./chunk-5X635INY.js";import{getUser}from"./chunk-2J35YKA2.js";import{printAlignedLabel}from"./chunk-PKNEWN4W.js";import{getTeamByIdOrSlug}from"./chunk-2VBFQZ72.js";import{getCommandName,packageName}from"./chunk-VRH7LWOC.js";import{emoji,output_manager_default}from"./chunk-GZLYNPNU.js";import{require_build_utils}from"./chunk-5MDNVAE6.js";import{require_source}from"./chunk-NB2WLB3J.js";import{__toESM}from"./chunk-BZENIQ7N.js";var import_chalk=__toESM(require_source(),1);var import_build_utils=__toESM(require_build_utils(),1);function getScopeOrTeamFromArgv(argv){let args=argv.slice(2);for(let i=0;i<args.length;i++){let arg=args[i];if(arg==="--scope"||arg==="--team"||arg==="-S"||arg==="-T"){let next=args[i+1];if(typeof next=="string"&&!next.startsWith("-"))return next;continue}if(arg.startsWith("--scope="))return arg.slice(8);if(arg.startsWith("--team="))return arg.slice(7)}return null}async function findExplicitTeam(client,scope){if(!scope)return;let knownUser=client.user??client.authConfig.cachedUser;if(!(knownUser&&(knownUser.id===scope||knownUser.username===scope)))try{let team=await getTeamByIdOrSlug(client,scope,{useCurrentTeam:!1});if(team.id===scope||team.slug===scope)return{type:"team",id:team.id,slug:team.slug}}catch(err){output_manager_default.debug(`Direct team lookup for scope "${scope}" failed: ${err}`)}}async function selectOrg(client,question,autoConfirm,searchable=!1,meta,description){let{config:{currentTeam}}=client,localConfigScope=client.localConfig?.scope,explicitScope=getScopeOrTeamFromArgv(client.argv)??(typeof localConfigScope=="string"?localConfigScope:null)??(0,import_build_utils.getPlatformEnv)("ORG_ID")??null;output_manager_default.spinner("Loading teams\u2026",1e3);let user,teams;try{let explicitTeam=await findExplicitTeam(client,explicitScope);if(explicitTeam)return explicitTeam;[user,teams]=await Promise.all([getUser(client),getTeams(client)])}finally{output_manager_default.stopSpinner()}let formatChoiceName=(name,slug,isCurrent,limited)=>{let title=`${name} (${slug})`;return isCurrent&&(title+=` ${import_chalk.default.bold("(current)")}`),limited&&(title+=` ${emoji("locked")}`),title},personalAccountChoice=user.version==="northstar"?[]:[{name:formatChoiceName(user.name||user.username,user.username,!currentTeam,user.limited),value:{type:"user",id:user.id,slug:user.username}}],orderedTeams=client.ignoresSavedTeam?teams:teams.sort(a=>a.id===user.defaultTeamId?-1:1),choices=[...personalAccountChoice,...orderedTeams.map(team=>({name:formatChoiceName(team.name||team.slug,team.slug,team.id===currentTeam,team.limited),value:{type:"team",id:team.id,slug:team.slug}}))],defaultChoiceIndex=Math.max(choices.findIndex(choice=>choice.value.id===currentTeam),0);meta&&(meta.choiceCount=choices.length);let matchExplicitScope=()=>{if(!explicitScope)return;let match=choices.find(c=>c.value.id===explicitScope||c.value.slug===explicitScope);if(match)return match.value;if(user.id===explicitScope||user.email===explicitScope||user.username===explicitScope)return choices.find(c=>c.value.type==="user")?.value};if(client.nonInteractive||!client.stdin.isTTY){let match=matchExplicitScope();if(match)return match;if(choices.length===1)return choices[0].value;let actionRequired={status:"action_required",reason:"missing_scope",message:choices.length>0?"Provide --scope explicitly. No default is applied in non-interactive mode.":"No teams available.",...choices.length>0&&{userActionRequired:!0,hint:"Ask the user which team to use, then run the matching command in next[]. Do not choose a team yourself."},choices:choices.map(c=>({id:c.value.id,name:c.value.slug})),next:choices.map(c=>({command:`${packageName} link --scope ${c.value.slug}`}))};outputActionRequired(client,actionRequired),output_manager_default.error(choices.length>0?`Multiple teams found. Teams are never auto-selected when the CLI runs without an interactive terminal. Re-run this command with ${param("--scope <slug>")}, or run ${getCommandName("teams ls")} to list your teams.`:"No teams available."),process.exit(1)}let explicitOrg=matchExplicitScope();if(explicitOrg)return explicitOrg;if(choices.length===1)return printAlignedLabel("Team",choices[0].value.slug),choices[0].value;let descriptionLine=description?`
7
+ import{getTeams}from"./chunk-Y2FVJ7YO.js";import{param}from"./chunk-3G3FQYMW.js";import{outputActionRequired}from"./chunk-GORL5DZC.js";import{getUser}from"./chunk-TFTF3C3G.js";import{printAlignedLabel}from"./chunk-K46QQRUN.js";import{getTeamByIdOrSlug}from"./chunk-2VBFQZ72.js";import{getCommandName,packageName}from"./chunk-B4KA3ZH2.js";import{emoji,output_manager_default}from"./chunk-YNCWSPPJ.js";import{require_build_utils}from"./chunk-5MDNVAE6.js";import{require_source}from"./chunk-NB2WLB3J.js";import{__toESM}from"./chunk-BZENIQ7N.js";var import_chalk=__toESM(require_source(),1);var import_build_utils=__toESM(require_build_utils(),1);function getScopeOrTeamFromArgv(argv){let args=argv.slice(2);for(let i=0;i<args.length;i++){let arg=args[i];if(arg==="--scope"||arg==="--team"||arg==="-S"||arg==="-T"){let next=args[i+1];if(typeof next=="string"&&!next.startsWith("-"))return next;continue}if(arg.startsWith("--scope="))return arg.slice(8);if(arg.startsWith("--team="))return arg.slice(7)}return null}async function findExplicitTeam(client,scope){if(!scope)return;let knownUser=client.user??client.authConfig.cachedUser;if(!(knownUser&&(knownUser.id===scope||knownUser.username===scope)))try{let team=await getTeamByIdOrSlug(client,scope,{useCurrentTeam:!1});if(team.id===scope||team.slug===scope)return{type:"team",id:team.id,slug:team.slug}}catch(err){output_manager_default.debug(`Direct team lookup for scope "${scope}" failed: ${err}`)}}async function selectOrg(client,question,autoConfirm,searchable=!1,meta,description){let{config:{currentTeam}}=client,localConfigScope=client.localConfig?.scope,explicitScope=getScopeOrTeamFromArgv(client.argv)??(typeof localConfigScope=="string"?localConfigScope:null)??(0,import_build_utils.getPlatformEnv)("ORG_ID")??null;output_manager_default.spinner("Loading teams\u2026",1e3);let user,teams;try{let explicitTeam=await findExplicitTeam(client,explicitScope);if(explicitTeam)return explicitTeam;[user,teams]=await Promise.all([getUser(client),getTeams(client)])}finally{output_manager_default.stopSpinner()}let formatChoiceName=(name,slug,isCurrent,limited)=>{let title=`${name} (${slug})`;return isCurrent&&(title+=` ${import_chalk.default.bold("(current)")}`),limited&&(title+=` ${emoji("locked")}`),title},personalAccountChoice=user.version==="northstar"?[]:[{name:formatChoiceName(user.name||user.username,user.username,!currentTeam,user.limited),value:{type:"user",id:user.id,slug:user.username}}],orderedTeams=client.ignoresSavedTeam?teams:teams.sort(a=>a.id===user.defaultTeamId?-1:1),choices=[...personalAccountChoice,...orderedTeams.map(team=>({name:formatChoiceName(team.name||team.slug,team.slug,team.id===currentTeam,team.limited),value:{type:"team",id:team.id,slug:team.slug}}))],defaultChoiceIndex=Math.max(choices.findIndex(choice=>choice.value.id===currentTeam),0);meta&&(meta.choiceCount=choices.length);let matchExplicitScope=()=>{if(!explicitScope)return;let match=choices.find(c=>c.value.id===explicitScope||c.value.slug===explicitScope);if(match)return match.value;if(user.id===explicitScope||user.email===explicitScope||user.username===explicitScope)return choices.find(c=>c.value.type==="user")?.value};if(client.nonInteractive||!client.stdin.isTTY){let match=matchExplicitScope();if(match)return match;if(choices.length===1)return choices[0].value;let actionRequired={status:"action_required",reason:"missing_scope",message:choices.length>0?"Provide --scope explicitly. No default is applied in non-interactive mode.":"No teams available.",...choices.length>0&&{userActionRequired:!0,hint:"Ask the user which team to use, then run the matching command in next[]. Do not choose a team yourself."},choices:choices.map(c=>({id:c.value.id,name:c.value.slug})),next:choices.map(c=>({command:`${packageName} link --scope ${c.value.slug}`}))};outputActionRequired(client,actionRequired),output_manager_default.error(choices.length>0?`Multiple teams found. Teams are never auto-selected when the CLI runs without an interactive terminal. Re-run this command with ${param("--scope <slug>")}, or run ${getCommandName("teams ls")} to list your teams.`:"No teams available."),process.exit(1)}let explicitOrg=matchExplicitScope();if(explicitOrg)return explicitOrg;if(choices.length===1)return printAlignedLabel("Team",choices[0].value.slug),choices[0].value;let descriptionLine=description?`
8
8
  ${import_chalk.default.dim(` ${description}`)}`:"";if(!searchable)return await client.input.select({message:`${question}${descriptionLine}`,choices,default:choices[defaultChoiceIndex].value});let defaultChoice=choices[defaultChoiceIndex],initialChoices=defaultChoice?[defaultChoice,...choices.filter(choice=>choice!==defaultChoice)]:choices,pageSize=15,countHint=choices.length>pageSize?` ${import_chalk.default.dim(`(${choices.length} teams)`)}`:"";return await client.input.search({message:`${question}${countHint}${descriptionLine}`,pageSize,source:term=>{let searchTerm=term?.trim().toLowerCase();return searchTerm?choices.filter(choice=>choice.name.toLowerCase().includes(searchTerm)||choice.value.slug.toLowerCase().includes(searchTerm)):initialChoices}})}export{selectOrg};
@@ -4,7 +4,7 @@ import { dirname as __dirname_ } from 'node:path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  const __filename = __fileURLToPath(import.meta.url);
6
6
  const __dirname = __dirname_(__filename);
7
- import{require_semver}from"./chunk-BPUANOGW.js";import{getInstallRoot,isNativeBinaryInstall}from"./chunk-NWGBDBZI.js";import{output_manager_default}from"./chunk-GZLYNPNU.js";import{require_tar_fs}from"./chunk-KRPY5FHJ.js";import{fetch,toNodeReadable}from"./chunk-MY4MONOH.js";import{__toESM}from"./chunk-BZENIQ7N.js";var import_tar_fs=__toESM(require_tar_fs(),1),import_semver=__toESM(require_semver(),1);import{createGunzip}from"node:zlib";import{createHash as createHash2}from"node:crypto";import{createWriteStream}from"node:fs";import{tmpdir}from"node:os";import{join as join2,sep as sep2}from"node:path";import{pipeline}from"node:stream/promises";import{chmod,copyFile,mkdir as mkdir3,mkdtemp,realpath,rename as rename3,rm as rm3,stat as stat2,writeFile as writeFile3}from"node:fs/promises";import{randomUUID as randomUUID2}from"node:crypto";import{join,relative,resolve,sep}from"node:path";import{mkdir as mkdir2,readFile as readFile2,readlink,rename as rename2,rm as rm2,stat,symlink,writeFile as writeFile2}from"node:fs/promises";import{createHash,randomUUID}from"node:crypto";import{dirname}from"node:path";import{link,mkdir,readFile,rename,rm,writeFile}from"node:fs/promises";var DEFAULT_WAIT_MS=3e4,DEFAULT_RETRY_MS=50,RELEASE_OWNER_CHECK_ATTEMPTS=3,RELEASE_OWNER_CHECK_RETRY_MS=10;async function readOwnerRaw(lockPath){let value=JSON.parse(await readFile(lockPath,"utf8"));if(!(typeof value.token!="string"||value.token.length===0||!Number.isSafeInteger(value.pid)||(value.pid??0)<=0||typeof value.createdAt!="number"||!Number.isFinite(value.createdAt)||value.createdAt<=0))return value}async function readOwner(lockPath){try{return await readOwnerRaw(lockPath)}catch{return}}async function stillOwnsLock(ownerPath,token){for(let attempt=0;;attempt++)try{return(await readOwnerRaw(ownerPath))?.token===token}catch(error){if(error.code==="ENOENT")return!1;if(attempt>=RELEASE_OWNER_CHECK_ATTEMPTS-1)return!0;await new Promise(resolve2=>setTimeout(resolve2,RELEASE_OWNER_CHECK_RETRY_MS))}}function processExists(pid){try{return process.kill(pid,0),!0}catch(error){return error.code==="EPERM"}}async function moveAbandonedDirectoryLock(lockPath,abandonedAfterMs){let owner=await readOwner(`${lockPath}/owner.json`);if(!owner||Date.now()-owner.createdAt<abandonedAfterMs||processExists(owner.pid))return!1;let generation=createHash("sha256").update(owner.token).digest("hex"),tombstone=`${lockPath}.abandoned-${generation}`;try{return await rename(lockPath,tombstone),!0}catch(error){if(isContentionError(error,["ENOENT","EEXIST","ENOTEMPTY"]))return!1;throw error}}function isContentionError(error,expectedCodes){let code=error.code;return!!(code&&expectedCodes.includes(code)||process.platform==="win32"&&code==="EPERM")}async function waitForRetry(startedAt,lockPath,{waitMs,retryMs,busyMessage}){if(waitMs===0||Date.now()-startedAt>=waitMs)throw new Error(busyMessage(lockPath,waitMs!==0));await new Promise(resolveTimeout=>setTimeout(resolveTimeout,Math.min(retryMs,waitMs)))}async function withFileLock(lockPath,action,{waitMs=DEFAULT_WAIT_MS,retryMs=DEFAULT_RETRY_MS,busyMessage}){await mkdir(dirname(lockPath),{recursive:!0});let owner={token:randomUUID(),pid:process.pid,createdAt:Date.now()},claim=`${lockPath}.claim-${owner.token}`,released=`${lockPath}.released-${owner.token}`,startedAt=Date.now(),acquired=!1;await writeFile(claim,`${JSON.stringify(owner)}
7
+ import{require_semver}from"./chunk-BPUANOGW.js";import{require_tar_fs}from"./chunk-KRPY5FHJ.js";import{getInstallRoot,isNativeBinaryInstall}from"./chunk-NWGBDBZI.js";import{fetch,toNodeReadable}from"./chunk-MY4MONOH.js";import{output_manager_default}from"./chunk-YNCWSPPJ.js";import{__toESM}from"./chunk-BZENIQ7N.js";var import_tar_fs=__toESM(require_tar_fs(),1),import_semver=__toESM(require_semver(),1);import{createGunzip}from"node:zlib";import{createHash as createHash2}from"node:crypto";import{createWriteStream}from"node:fs";import{tmpdir}from"node:os";import{join as join2,sep as sep2}from"node:path";import{pipeline}from"node:stream/promises";import{chmod,copyFile,mkdir as mkdir3,mkdtemp,realpath,rename as rename3,rm as rm3,stat as stat2,writeFile as writeFile3}from"node:fs/promises";import{randomUUID as randomUUID2}from"node:crypto";import{join,relative,resolve,sep}from"node:path";import{mkdir as mkdir2,readFile as readFile2,readlink,rename as rename2,rm as rm2,stat,symlink,writeFile as writeFile2}from"node:fs/promises";import{createHash,randomUUID}from"node:crypto";import{dirname}from"node:path";import{link,mkdir,readFile,rename,rm,writeFile}from"node:fs/promises";var DEFAULT_WAIT_MS=3e4,DEFAULT_RETRY_MS=50,RELEASE_OWNER_CHECK_ATTEMPTS=3,RELEASE_OWNER_CHECK_RETRY_MS=10;async function readOwnerRaw(lockPath){let value=JSON.parse(await readFile(lockPath,"utf8"));if(!(typeof value.token!="string"||value.token.length===0||!Number.isSafeInteger(value.pid)||(value.pid??0)<=0||typeof value.createdAt!="number"||!Number.isFinite(value.createdAt)||value.createdAt<=0))return value}async function readOwner(lockPath){try{return await readOwnerRaw(lockPath)}catch{return}}async function stillOwnsLock(ownerPath,token){for(let attempt=0;;attempt++)try{return(await readOwnerRaw(ownerPath))?.token===token}catch(error){if(error.code==="ENOENT")return!1;if(attempt>=RELEASE_OWNER_CHECK_ATTEMPTS-1)return!0;await new Promise(resolve2=>setTimeout(resolve2,RELEASE_OWNER_CHECK_RETRY_MS))}}function processExists(pid){try{return process.kill(pid,0),!0}catch(error){return error.code==="EPERM"}}async function moveAbandonedDirectoryLock(lockPath,abandonedAfterMs){let owner=await readOwner(`${lockPath}/owner.json`);if(!owner||Date.now()-owner.createdAt<abandonedAfterMs||processExists(owner.pid))return!1;let generation=createHash("sha256").update(owner.token).digest("hex"),tombstone=`${lockPath}.abandoned-${generation}`;try{return await rename(lockPath,tombstone),!0}catch(error){if(isContentionError(error,["ENOENT","EEXIST","ENOTEMPTY"]))return!1;throw error}}function isContentionError(error,expectedCodes){let code=error.code;return!!(code&&expectedCodes.includes(code)||process.platform==="win32"&&code==="EPERM")}async function waitForRetry(startedAt,lockPath,{waitMs,retryMs,busyMessage}){if(waitMs===0||Date.now()-startedAt>=waitMs)throw new Error(busyMessage(lockPath,waitMs!==0));await new Promise(resolveTimeout=>setTimeout(resolveTimeout,Math.min(retryMs,waitMs)))}async function withFileLock(lockPath,action,{waitMs=DEFAULT_WAIT_MS,retryMs=DEFAULT_RETRY_MS,busyMessage}){await mkdir(dirname(lockPath),{recursive:!0});let owner={token:randomUUID(),pid:process.pid,createdAt:Date.now()},claim=`${lockPath}.claim-${owner.token}`,released=`${lockPath}.released-${owner.token}`,startedAt=Date.now(),acquired=!1;await writeFile(claim,`${JSON.stringify(owner)}
8
8
  `,{flag:"wx"});try{for(;;)try{await link(claim,lockPath),acquired=!0;break}catch(error){if(!isContentionError(error,["EEXIST"]))throw error;await waitForRetry(startedAt,lockPath,{waitMs,retryMs,busyMessage})}return await rm(claim,{force:!0}).catch(()=>{}),await action()}finally{acquired&&await stillOwnsLock(lockPath,owner.token)&&(await rename(lockPath,released).then(()=>!0).catch(()=>!1)?await rm(released,{force:!0}):await rm(lockPath,{force:!0})),await rm(claim,{force:!0})}}async function withDirectoryLock(lockPath,action,{waitMs=DEFAULT_WAIT_MS,retryMs=DEFAULT_RETRY_MS,busyMessage,abandonedAfterMs}){await mkdir(dirname(lockPath),{recursive:!0});let owner={token:randomUUID(),pid:process.pid,createdAt:Date.now()},claim=`${lockPath}.claim-${owner.token}`,ownerPath=`${claim}/owner.json`,startedAt=Date.now(),acquired=!1;await mkdir(claim),await writeFile(ownerPath,`${JSON.stringify(owner)}
9
9
  `);try{for(;;)try{await rename(claim,lockPath),acquired=!0;break}catch(error){if(!isContentionError(error,["EEXIST","ENOTEMPTY"]))throw error;if(abandonedAfterMs!==void 0&&await moveAbandonedDirectoryLock(lockPath,abandonedAfterMs))continue;await waitForRetry(startedAt,lockPath,{waitMs,retryMs,busyMessage})}return await action()}finally{if(acquired&&await stillOwnsLock(`${lockPath}/owner.json`,owner.token)){let released=`${lockPath}.released-${owner.token}`;await rename(lockPath,released).then(()=>!0).catch(()=>!1)?await rm(released,{recursive:!0,force:!0}):await rm(lockPath,{recursive:!0,force:!0})}await rm(claim,{recursive:!0,force:!0})}}var SLOTS=["a","b"],LOCK_RETRY_MS=50;function tracksDir(root){return join(root,"versions","tracks")}function slotDir(root,track,slot){return join(tracksDir(root),track,slot)}function isTrack(value){return value==="production"||value==="pr"}function isSlot(value){return value==="a"||value==="b"}async function atomicSymlink(target,path){let temporary=`${path}.tmp-${randomUUID2()}`;await symlink(target,temporary);try{await rename2(temporary,path)}catch(error){throw await rm2(temporary,{force:!0}),error}}async function atomicWrite(path,contents){let temporary=`${path}.tmp-${randomUUID2()}`;await writeFile2(temporary,contents);try{await rename2(temporary,path)}catch(error){throw await rm2(temporary,{force:!0}),error}}async function readSlotMetadata(root,track,slot){try{let value=JSON.parse(await readFile2(join(slotDir(root,track,slot),"metadata.json"),"utf8"));return value.track!==track||value.slot!==slot||typeof value.version!="string"?void 0:value}catch{return}}async function readPointer(root,path){try{let target=resolve(root,await readlink(path)),rel=relative(tracksDir(root),target).split(sep);return rel.length!==2||!isTrack(rel[0])||!isSlot(rel[1])?void 0:{track:rel[0],slot:rel[1]}}catch{return}}async function readActivePointer(root){return readPointer(root,join(root,"active"))}async function readTrackPointer(root,track){try{let slot=(await readlink(join(tracksDir(root),track,"active"))).split(sep).pop();return slot&&isSlot(slot)?slot:void 0}catch{return}}async function readNativeInstallState(root){let pointer=await readActivePointer(root);if(!pointer)return;let active=await readSlotMetadata(root,pointer.track,pointer.slot);if(!active)return;let pendingProduction;try{let pending=JSON.parse(await readFile2(join(root,"pending-production.json"),"utf8"));pending.slot&&isSlot(pending.slot)&&pending.version&&(await readSlotMetadata(root,"production",pending.slot))?.version===pending.version&&!(pointer.track==="production"&&pointer.slot===pending.slot)&&(pendingProduction={slot:pending.slot,version:pending.version})}catch{}return{...active,pendingProduction}}async function ensureNativeBinLinks(root){let bin=join(root,"bin");await mkdir2(bin,{recursive:!0});for(let name of["vercel","vc"]){let path=join(bin,name),expected=join("..","active","vercel");await readlink(path).catch(()=>{})!==expected&&await atomicSymlink(expected,path)}}async function markPendingProduction(root,slot,version){await atomicWrite(join(root,"pending-production.json"),`${JSON.stringify({slot,version})}
10
10
  `)}async function activateSlot(root,track,slot){let metadata=await readSlotMetadata(root,track,slot),binary=await stat(join(slotDir(root,track,slot),"vercel")).catch(()=>{});if(!metadata||!binary?.isFile())throw new Error(`Cannot activate incomplete ${track}/${slot} slot`);let trackDir=join(tracksDir(root),track);await mkdir2(trackDir,{recursive:!0}),await atomicSymlink(slot,join(trackDir,"active")),await atomicSymlink(relative(root,slotDir(root,track,slot)),join(root,"active")),track==="production"&&await rm2(join(root,"pending-production.json"),{force:!0}),await ensureNativeBinLinks(root)}async function getInactiveSlot(root,track){let active=await readActivePointer(root);return(active?.track===track?active.slot:await readTrackPointer(root,track))==="a"?"b":"a"}async function writeTrackSlot(root,metadata,prepare,{signal}={}){signal?.throwIfAborted();let slot=await getInactiveSlot(root,metadata.track),trackDir=join(tracksDir(root),metadata.track),destination=slotDir(root,metadata.track,slot),temporary=join(trackDir,`.slot-${slot}-${randomUUID2()}`),backup=join(trackDir,`.old-${slot}-${randomUUID2()}`);signal?.throwIfAborted(),await mkdir2(temporary,{recursive:!0});try{if(signal?.throwIfAborted(),await prepare(temporary),signal?.throwIfAborted(),!(await stat(join(temporary,"vercel")).catch(()=>{}))?.isFile())throw new Error("Prepared slot does not contain a Vercel CLI binary");signal?.throwIfAborted(),await atomicWrite(join(temporary,"metadata.json"),`${JSON.stringify({...metadata,slot})}
@@ -4,5 +4,5 @@ import { dirname as __dirname_ } from 'node:path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  const __filename = __fileURLToPath(import.meta.url);
6
6
  const __dirname = __dirname_(__filename);
7
- import{writeJsonError}from"./chunk-UFXIPUNI.js";import{printError}from"./chunk-NDMQVBTV.js";import{packageName}from"./chunk-VRH7LWOC.js";import{output_manager_default}from"./chunk-GZLYNPNU.js";import{require_dist}from"./chunk-RM3ZDRYE.js";import{getGlobalFlagsFromArgs,quoteArg}from"./chunk-AMPJ6RWT.js";import{AGENT_REASON,AGENT_STATUS,getExitCodeForReason}from"./chunk-Q2QVK3TH.js";import{__toESM}from"./chunk-BZENIQ7N.js";var import_error_utils=__toESM(require_dist(),1);function startJsonOutput(client){client.nonInteractive=!0,client.jsonMode={errorWritten:!1},output_manager_default.initialize({quiet:!0})}function writeJsonResult(client,document){output_manager_default.stopSpinner();let indent=client.stdout.isTTY?2:void 0;return client.stdout.write(`${JSON.stringify(document,null,indent)}
7
+ import{writeJsonError}from"./chunk-MXALPSIX.js";import{printError}from"./chunk-NYJTWSSD.js";import{AGENT_REASON,AGENT_STATUS,getExitCodeForReason}from"./chunk-GORL5DZC.js";import{packageName}from"./chunk-B4KA3ZH2.js";import{output_manager_default}from"./chunk-YNCWSPPJ.js";import{require_dist}from"./chunk-MCYG7CCE.js";import{getGlobalFlagsFromArgs,quoteArg}from"./chunk-EZVNGJN5.js";import{__toESM}from"./chunk-BZENIQ7N.js";var import_error_utils=__toESM(require_dist(),1);function startJsonOutput(client){client.nonInteractive=!0,client.jsonMode={errorWritten:!1},output_manager_default.initialize({quiet:!0})}function writeJsonResult(client,document){output_manager_default.stopSpinner();let indent=client.stdout.isTTY?2:void 0;return client.stdout.write(`${JSON.stringify(document,null,indent)}
8
8
  `),0}function writeJsonFailure(client,payload,exitCode=getExitCodeForReason(payload.reason)){return client.jsonMode&&(client.jsonMode.errorWritten=!0),writeJsonError(client,payload,exitCode)}function writeJsonUsageError(client,err){return startJsonOutput(client),writeJsonFailure(client,{status:AGENT_STATUS.ERROR,reason:AGENT_REASON.INVALID_ARGUMENTS,message:(0,import_error_utils.errorToString)(err)},2)}function jsonNextStep(client,args,when){let argv=[packageName,...args,...getGlobalFlagsFromArgs(client.argv.slice(2))];return{command:argv.map(quoteArg).join(" "),argv,...when?{when}:{}}}async function runWithJsonOutput(client,run){startJsonOutput(client);let exitCode;try{exitCode=await run()}catch(err){if(client.jsonMode?.errorWritten)throw err;if(printError(err,client),client.jsonMode?.errorWritten)return 1;let code=(0,import_error_utils.isErrnoException)(err)&&typeof err.code=="string"?err.code:"";return writeJsonFailure(client,{status:AGENT_STATUS.ERROR,reason:code?code.toLowerCase().replace(/^err_/,""):AGENT_REASON.INTERNAL_ERROR,message:(0,import_error_utils.errorToString)(err)},1)}return exitCode!==0&&!client.jsonMode?.errorWritten&&writeJsonFailure(client,{status:AGENT_STATUS.ERROR,reason:AGENT_REASON.COMMAND_FAILED,message:output_manager_default.quietError??"The command failed."},exitCode),exitCode}export{writeJsonResult,writeJsonFailure,writeJsonUsageError,jsonNextStep,runWithJsonOutput};
@@ -4,4 +4,4 @@ import { dirname as __dirname_ } from 'node:path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  const __filename = __fileURLToPath(import.meta.url);
6
6
  const __dirname = __dirname_(__filename);
7
- import{getShortFlags,globalCommandOptions}from"./chunk-AMPJ6RWT.js";var COMMAND_SHORTHANDS=new Set(["-d"]);function walkCommandArgs(commands,args,start,visit){let command={name:"",aliases:[],subcommands:commands},options=[...globalCommandOptions],argumentCount=0;for(let i=start;i<args.length;i++){let token=args[i];if(token==="--")return;if(token.length>1&&token.startsWith("-")){(visit(i,command,argumentCount)||!token.includes("=")&&takesValue(token,options))&&i++;continue}let subcommand=argumentCount===0?command.subcommands?.find(candidate=>candidate.name===token||candidate.aliases.includes(token)):void 0;subcommand?(command=subcommand,options.push(...subcommand.options??[])):argumentCount++}}function takesValue(token,options){let flag=/^-[A-Za-z]{2,}$/.test(token)?`-${token.slice(-1)}`:token,option=options.find(candidate=>`--${candidate.name}`===flag||getShortFlags(candidate).includes(flag));return option!==void 0&&option.type!==Boolean}function findHiddenOption(command,flag){return command.options?.find(option=>`-${option.deprecatedShorthand}`===flag)}function findCommandShorthands(commands,args,start=0){let found=new Set;return walkCommandArgs(commands,args,start,(index,command,argumentCount)=>{let next=args[index+1],required=(command.arguments??[]).filter(argument=>argument.required).length;return!COMMAND_SHORTHANDS.has(args[index])||!findHiddenOption(command,args[index])||argumentCount<required||next===void 0||next.startsWith("-")?!1:(found.add(index),!0)}),found}function findHiddenShorthandOption(commands,args,flag,start=0){let found;return walkCommandArgs(commands,args,start,(index,command)=>(args[index]===flag&&(found??=findHiddenOption(command,flag)),!1)),found}export{findCommandShorthands,findHiddenShorthandOption};
7
+ import{getShortFlags,globalCommandOptions}from"./chunk-EZVNGJN5.js";var COMMAND_SHORTHANDS=new Set(["-d"]);function walkCommandArgs(commands,args,start,visit){let command={name:"",aliases:[],subcommands:commands},options=[...globalCommandOptions],argumentCount=0;for(let i=start;i<args.length;i++){let token=args[i];if(token==="--")return;if(token.length>1&&token.startsWith("-")){(visit(i,command,argumentCount)||!token.includes("=")&&takesValue(token,options))&&i++;continue}let subcommand=argumentCount===0?command.subcommands?.find(candidate=>candidate.name===token||candidate.aliases.includes(token)):void 0;subcommand?(command=subcommand,options.push(...subcommand.options??[])):argumentCount++}}function takesValue(token,options){let flag=/^-[A-Za-z]{2,}$/.test(token)?`-${token.slice(-1)}`:token,option=options.find(candidate=>`--${candidate.name}`===flag||getShortFlags(candidate).includes(flag));return option!==void 0&&option.type!==Boolean}function findHiddenOption(command,flag){return command.options?.find(option=>`-${option.deprecatedShorthand}`===flag)}function findCommandShorthands(commands,args,start=0){let found=new Set;return walkCommandArgs(commands,args,start,(index,command,argumentCount)=>{let next=args[index+1],required=(command.arguments??[]).filter(argument=>argument.required).length;return!COMMAND_SHORTHANDS.has(args[index])||!findHiddenOption(command,args[index])||argumentCount<required||next===void 0||next.startsWith("-")?!1:(found.add(index),!0)}),found}function findHiddenShorthandOption(commands,args,flag,start=0){let found;return walkCommandArgs(commands,args,start,(index,command)=>(args[index]===flag&&(found??=findHiddenOption(command,flag)),!1)),found}export{findCommandShorthands,findHiddenShorthandOption};
@@ -0,0 +1,13 @@
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{getOrCreateDeploymentProtectionToken}from"./chunk-OMMFXWXP.js";import{getProtectionForProductionDomain,readEnabledProtection}from"./chunk-V7G4VDZI.js";import{ensureLink}from"./chunk-U7XX53IQ.js";import{toHost}from"./chunk-NBTFAXL4.js";import{getTeams}from"./chunk-Y2FVJ7YO.js";import{curlCommand}from"./chunk-2CQJKBKV.js";import{printError}from"./chunk-NYJTWSSD.js";import{help}from"./chunk-VVTMF2AY.js";import{detectExplicitScope,getScope,introspectToken,isAppPrincipalEnabled,resolveAppFromToken}from"./chunk-ZGB2RHJO.js";import{TelemetryClient}from"./chunk-AGLOVMPC.js";import{getLinkedProject,getUser}from"./chunk-TFTF3C3G.js";import{getGlobalPathConfig}from"./chunk-GPDERS2D.js";import{parseArguments}from"./chunk-VM6X5BTK.js";import{InvalidToken,isAPIError}from"./chunk-GOI2VVI7.js";import{cmd,getCommandName}from"./chunk-B4KA3ZH2.js";import{output_manager_default}from"./chunk-YNCWSPPJ.js";import{require_dist}from"./chunk-MCYG7CCE.js";import{getFlagsSpecification}from"./chunk-EZVNGJN5.js";import{require_source}from"./chunk-NB2WLB3J.js";import{__toESM}from"./chunk-BZENIQ7N.js";import{spawn as spawn2}from"child_process";var SECRET_HEADER=/^((?:x-vercel-protection-bypass|cookie):\s*).+$/i,redactSecretHeader=arg=>arg.replace(SECRET_HEADER,"$1[REDACTED]"),requoteArgs=arg=>arg.includes(" ")?arg.includes('"')?`'${arg}'`:`"${arg}"`:arg;var CurlTelemetryClient=class extends TelemetryClient{trackCliArgumentPath(path){if(path){let value=path.startsWith("/")?"slash":"no-slash";this.trackCliArgument({arg:"path",value})}}trackCliOptionDeployment(deploymentId){if(deploymentId){let value=deploymentId.startsWith("http://")||deploymentId.startsWith("https://")?"url":deploymentId.startsWith("dpl_")?"dpl_":"no-prefix";this.trackCliOption({option:"deployment",value})}}trackCliOptionProtectionBypass(secret){secret&&this.trackCliOption({option:"protection-bypass",value:this.redactedValue})}trackCliFlagYes(yes){yes&&this.trackCliFlag("yes")}trackCliFlagTrace(trace2){trace2&&this.trackCliFlag("trace")}trackCliFlagJson(json){json&&this.trackCliFlag("json")}trackCliFlagYesOnProduction(value){value&&this.trackCliFlag("yes-on-production")}};var import_chalk=__toESM(require_source(),1),import_error_utils=__toESM(require_dist(),1);async function getDeploymentAccounts(client){if(detectExplicitScope(client))return client.config.currentTeam?[client.config.currentTeam]:[];if(isAppPrincipalEnabled())try{await getUser(client)}catch(err){if(!(err instanceof InvalidToken))throw err;let token=await introspectToken(client).catch(()=>null);if(!token||!resolveAppFromToken(token))throw err;return token.team?[token.team.id]:[]}let currentTeam=client.config.currentTeam;try{return(await getTeams(client)).filter(team=>!team.limited).map(team=>team.id).sort((a,b)=>+(b===currentTeam)-+(a===currentTeam))}catch(err){if(err instanceof InvalidToken&&currentTeam)return[currentTeam];throw err}}async function resolveDeployment(client,selector,accountId){let hostOrId=selector.includes(".")?toHost(selector):selector,endpoint=`/v13/deployments/${encodeURIComponent(hostOrId)}`,lookup=async accountId2=>{try{let deployment2=await client.fetch(endpoint,{useCurrentTeam:!1,...accountId2?{accountId:accountId2}:{},bailOn429:!0});return deployment2?{...deployment2,ownerId:deployment2.ownerId??deployment2.team?.id}:null}catch(err){if(!isAPIError(err)||err.status!==403&&err.status!==404)throw err;return output_manager_default.debug(`Deployment lookup failed for ${hostOrId}: ${err}`),null}};if(accountId||detectExplicitScope(client))return lookup(accountId??client.config.currentTeam);let deployment=await lookup();if(deployment?.projectId&&deployment.ownerId)return deployment;let accounts;try{accounts=await getDeploymentAccounts(client)}catch(err){if(deployment?.url)return deployment;throw err}for(let account of accounts){let scoped=await lookup(account);if(scoped?.projectId&&scoped.ownerId)return scoped;deployment??=scoped}return deployment}async function getDeploymentUrlById(client,deploymentIdOrUrl,accountId){try{if(deploymentIdOrUrl.startsWith("http://")||deploymentIdOrUrl.startsWith("https://"))try{return new URL(deploymentIdOrUrl).origin}catch{return output_manager_default.debug(`Invalid deployment URL provided: ${deploymentIdOrUrl}`),null}if(deploymentIdOrUrl.includes("vercel.app"))return`https://${deploymentIdOrUrl}`;let fullDeploymentId=deploymentIdOrUrl;fullDeploymentId.startsWith("dpl_")||(fullDeploymentId=`dpl_${deploymentIdOrUrl}`);let deployment=await resolveDeployment(client,fullDeploymentId,accountId);return!deployment||!deployment.url?null:`https://${deployment.url}`}catch(error){return output_manager_default.debug(`Failed to fetch deployment by ID: ${error}`),null}}function looksLikeHostname(path){let firstSegment=path.split("/")[0];return firstSegment.includes(".")&&!firstSegment.startsWith(".")}function orgFromOwner(id,slug=id){return{type:id.startsWith("team_")?"team":"user",id,slug}}var VC_STRING_FLAGS=new Set(["--deployment","--protection-bypass"]),VC_IGNORED_STRING_FLAGS=new Set(["--scope","--team"]),VC_IGNORED_BOOLEAN_FLAGS=new Set(["--debug"]),VC_BOOLEAN_FLAGS=new Set(["--yes","--help","--trace","--json"]);function flagName(arg){let eqIdx=arg.indexOf("=");return eqIdx===-1?arg:arg.slice(0,eqIdx)}function flagValue(args,index){let arg=args[index],eqIdx=arg.indexOf("=");if(eqIdx!==-1)return arg.slice(eqIdx+1);let next=args[index+1];return next&&!next.startsWith("-")?next:void 0}function getCurlLikeArgs(rawArgs,commandName){if(rawArgs[0]===commandName)return rawArgs.slice(1);let commandIndex=0;for(;commandIndex<rawArgs.length;){let arg=rawArgs[commandIndex];if(VC_IGNORED_BOOLEAN_FLAGS.has(flagName(arg))){commandIndex++;continue}if(!VC_IGNORED_STRING_FLAGS.has(flagName(arg)))break;commandIndex++,!arg.includes("=")&&commandIndex<rawArgs.length&&commandIndex++}return rawArgs[commandIndex]===commandName?rawArgs.slice(commandIndex+1):[...rawArgs]}function parseCurlLikeArgs(rawArgs,commandName){let result={target:void 0,deployment:void 0,protectionBypass:void 0,yes:!1,help:!1,trace:!1,json:!1,toolFlags:[]},args=getCurlLikeArgs(rawArgs,commandName),separatorIndex=args.indexOf("--"),beforeSeparator=separatorIndex===-1?args:args.slice(0,separatorIndex),afterSeparator=separatorIndex===-1?[]:args.slice(separatorIndex+1);for(let i=0;i<beforeSeparator.length;i++){let arg=beforeSeparator[i],name=flagName(arg);if(VC_STRING_FLAGS.has(name)){let value=flagValue(beforeSeparator,i);!arg.includes("=")&&value!==void 0&&i++,name==="--deployment"?result.deployment=value:result.protectionBypass=value;continue}if(!VC_IGNORED_BOOLEAN_FLAGS.has(name)){if(VC_IGNORED_STRING_FLAGS.has(name)){let value=flagValue(beforeSeparator,i);!arg.includes("=")&&value!==void 0&&i++;continue}if(VC_BOOLEAN_FLAGS.has(name)){name==="--yes"?result.yes=!0:name==="--trace"?result.trace=!0:name==="--json"?result.json=!0:result.help=!0;continue}if(!result.target&&name==="--url"){let value=flagValue(beforeSeparator,i);!arg.includes("=")&&value!==void 0&&i++,result.target=value;continue}!result.target&&!arg.startsWith("-")?result.target=arg:result.toolFlags.push(arg)}}return result.toolFlags.push(...afterSeparator),result}function setupCurlLikeCommand(client,command,telemetryClient,options={}){let{print}=output_manager_default;if(options.allowFullUrl){let parsed=parseCurlLikeArgs(options.args??client.argv.slice(2),command.name);if(parsed.help)return print(help(command,{stream:client.stderr,columns:client.stderr.columns})),0;let path2=parsed.target;if(telemetryClient.trackCliArgumentPath(path2),parsed.deployment&&telemetryClient.trackCliOptionDeployment(parsed.deployment),parsed.protectionBypass&&telemetryClient.trackCliOptionProtectionBypass(parsed.protectionBypass),!path2)return output_manager_default.error(`${getCommandName(`${command.name} <url|path>`)} requires a URL or API path (e.g., 'https://example.vercel.app/api/hello' or '/api/hello')`),print(help(command,{stream:client.stderr,columns:client.stderr.columns})),2;let isFullUrl2=path2.startsWith("http://")||path2.startsWith("https://");return!isFullUrl2&&looksLikeHostname(path2)&&(isFullUrl2=!0),output_manager_default.debug(`${command.name} options (${parsed.toolFlags.length} args): ${JSON.stringify(parsed.toolFlags)}`),{path:isFullUrl2&&!path2.startsWith("http")?`https://${path2}`:path2,isFullUrl:isFullUrl2,deploymentFlag:parsed.deployment,protectionBypassFlag:parsed.protectionBypass,toolFlags:parsed.toolFlags,yes:parsed.yes,trace:parsed.trace,json:parsed.json}}let parsedArgs=null,flagsSpecification=getFlagsSpecification(command.options);try{parsedArgs=parseArguments(client.argv.slice(2),flagsSpecification)}catch(err){return printError(err),2}let{flags}=parsedArgs;if(parsedArgs.flags["--help"])return print(help(command,{stream:client.stderr,columns:client.stderr.columns})),0;parsedArgs.args[0]===command.name&&parsedArgs.args.shift();let separatorIndex=process.argv.indexOf("--"),path=parsedArgs.args[0];telemetryClient.trackCliArgumentPath(path);let deploymentFlag=flags["--deployment"];deploymentFlag&&telemetryClient.trackCliOptionDeployment(deploymentFlag);let protectionBypassFlag=flags["--protection-bypass"];if(protectionBypassFlag&&telemetryClient.trackCliOptionProtectionBypass(protectionBypassFlag),!path||path==="--"||path.startsWith("-"))return options.allowFullUrl?output_manager_default.error(`${getCommandName(`${command.name} <url|path>`)} requires a URL or API path (e.g., 'https://example.vercel.app/api/hello' or '/api/hello')`):output_manager_default.error(`${getCommandName(`${command.name} <path>`)} requires an API path (e.g., '/' or '/api/hello' or 'api/hello')`),print(help(command,{stream:client.stderr,columns:client.stderr.columns})),1;let isFullUrl=path.startsWith("http://")||path.startsWith("https://");if(!isFullUrl&&looksLikeHostname(path)&&(isFullUrl=!0),isFullUrl&&!options.allowFullUrl)return output_manager_default.error("The <path> argument must be a relative API path (e.g., '/' or '/api/hello'), not a full URL."),output_manager_default.print("To target a specific deployment within the currently linked project, use the --deployment <id|url> option."),print(help(command,{stream:client.stderr,columns:client.stderr.columns})),1;let toolFlags=separatorIndex!==-1?process.argv.slice(separatorIndex+1):[];return output_manager_default.debug(`${command.name} options (${toolFlags.length} args): ${JSON.stringify(toolFlags)}`),{path:isFullUrl&&!path.startsWith("http")?`https://${path}`:path,isFullUrl,deploymentFlag,protectionBypassFlag,toolFlags,yes:!!flags["--yes"],trace:!!flags["--trace"],json:!!flags["--json"]}}async function resolveProjectFromUrl(client,url){let host=toHost(url);try{let deployment=await resolveDeployment(client,host);if(deployment){let link=await linkFromDeployment(client,deployment);if(link)return link}}catch(err){if(output_manager_default.debug(`Deployment lookup failed for ${host}: ${err}`),isAPIError(err)&&err.status===429)return null}try{let aliasUrl=`/now/aliases/${encodeURIComponent(host)}`;try{let alias=await client.fetch(aliasUrl,{useCurrentTeam:!1,...detectExplicitScope(client)?{accountId:client.config.currentTeam}:{}});if(alias.projectId&&alias.ownerId)return{status:"linked",project:await client.fetch(`/v9/projects/${encodeURIComponent(alias.projectId)}`,{accountId:alias.ownerId}),org:orgFromOwner(alias.ownerId)}}catch(err){output_manager_default.debug(`User alias lookup failed for ${host}: ${err}`)}for(let accountId of await getDeploymentAccounts(client))try{let alias=await client.fetch(aliasUrl,{accountId}),projectId=alias.projectId,ownerId=alias.ownerId||accountId;if(projectId)return{status:"linked",project:await client.fetch(`/v9/projects/${encodeURIComponent(projectId)}`,{accountId:ownerId}),org:orgFromOwner(ownerId)}}catch(err){output_manager_default.debug(`Alias lookup failed for ${host} in ${accountId}: ${err}`)}}catch(err){output_manager_default.debug(`Team lookup failed for ${host}: ${err}`)}return null}async function getFullUrlAndToken(client,fullUrl,protectionBypassFlag){if(protectionBypassFlag)return{fullUrl,deploymentProtectionToken:protectionBypassFlag,link:null};if(process.env.VERCEL_AUTOMATION_BYPASS_SECRET)return output_manager_default.debug("Using protection bypass secret from environment variable"),{fullUrl,deploymentProtectionToken:process.env.VERCEL_AUTOMATION_BYPASS_SECRET,link:null};let link=await resolveProjectFromUrl(client,fullUrl),deploymentProtectionToken=null;if(link)try{deploymentProtectionToken=await getOrCreateDeploymentProtectionToken(client,link,{readinessUrl:fullUrl})}catch(err){output_manager_default.debug(`Failed to get deployment protection bypass token: ${err}`)}return{fullUrl,deploymentProtectionToken,link}}async function linkFromDeployment(client,deployment){return!deployment.projectId||!deployment.ownerId?null:{status:"linked",project:await client.fetch(`/v9/projects/${encodeURIComponent(deployment.projectId)}`,{accountId:deployment.ownerId}),org:orgFromOwner(deployment.ownerId)}}async function resolveTargetProject(client,deployment,deploymentFlag){try{let link=await linkFromDeployment(client,deployment);return link||output_manager_default.warn(`Deployment "${deploymentFlag}" is missing project metadata; proceeding without an automatic protection bypass token.`),link}catch(err){return output_manager_default.debug(`Failed to resolve deployment project: ${err}`),output_manager_default.warn(`Failed to load project for deployment "${deploymentFlag}"; proceeding without an automatic protection bypass token.`),null}}async function tryGetDeployment(client,selector){try{return await resolveDeployment(client,selector)}catch(err){return output_manager_default.debug(`Failed to resolve deployment: ${err}`),null}}async function tryLinkFromSelector(client,selector){try{let deployment=await resolveDeployment(client,selector);return deployment?await linkFromDeployment(client,deployment):null}catch(err){return output_manager_default.debug(`Failed to resolve trace project context: ${err}`),null}}async function getLinkedProjectOrNull(client){try{let linked=await getLinkedProject(client,{cwd:client.cwd});return linked.status==="linked"?linked:null}catch(err){return output_manager_default.debug(`Failed to load linked project: ${err}`),null}}function hasAutomationBypassToken(project){return Object.values(project.protectionBypass??{}).some(token=>token.scope==="automation-bypass")}async function getDeploymentUrlAndToken(client,commandName,path,options){let{deploymentFlag,protectionBypassFlag,autoConfirm,resolveProjectForTrace}=options,suppliedProtectionBypass=deploymentFlag?protectionBypassFlag??(process.env.VERCEL_AUTOMATION_BYPASS_SECRET||void 0):protectionBypassFlag,link=null,createProtectionBypassIfMissing=!deploymentFlag,baseUrl;if(deploymentFlag){let requestedBaseUrl=deploymentFlag.startsWith("http://")||deploymentFlag.startsWith("https://")||deploymentFlag.includes("vercel.app")?await getDeploymentUrlById(client,deploymentFlag):null,deploymentSelector=deploymentFlag.includes(".")||deploymentFlag.startsWith("dpl_")?deploymentFlag:`dpl_${deploymentFlag}`;if(suppliedProtectionBypass!==void 0){if(baseUrl=requestedBaseUrl??await getDeploymentUrlById(client,deploymentFlag)??"",!baseUrl)return output_manager_default.error(`No deployment found for ID "${deploymentFlag}"`),1;resolveProjectForTrace&&(link=await tryLinkFromSelector(client,deploymentSelector)??await getLinkedProjectOrNull(client))}else{let deployment=await tryGetDeployment(client,deploymentSelector);if(baseUrl=requestedBaseUrl??(deployment?.url?`https://${deployment.url}`:""),!baseUrl)return output_manager_default.error(`No deployment found for ID "${deploymentFlag}"`),1;deployment?(link=await resolveTargetProject(client,deployment,deploymentFlag),link&&!hasAutomationBypassToken(link.project)&&(createProtectionBypassIfMissing=(await getLinkedProjectOrNull(client))?.project.id===link.project.id)):output_manager_default.warn(`Could not resolve project information for deployment "${deploymentFlag}"; proceeding without an automatic protection bypass token.`)}}else{try{await getScope(client)}catch(err){if((0,import_error_utils.isErrnoException)(err)&&(err.code==="NOT_AUTHORIZED"||err.code==="TEAM_DELETED"))return output_manager_default.error(err.message),1;throw err}let ensuredLink;try{ensuredLink=await ensureLink(commandName,client,client.cwd,{autoConfirm})}catch(err){if((0,import_error_utils.isErrnoException)(err)&&err.code==="NOT_AUTHORIZED")return output_manager_default.error(err.message),1;throw err}if(typeof ensuredLink=="number")return ensuredLink;link=ensuredLink;let{project}=ensuredLink;if(!project.targets&&!project.latestDeployments){let linkedProject=await getLinkedProject(client,{cwd:client.cwd});if(linkedProject.status!=="linked")return output_manager_default.error("This command requires a linked project. Please run:"),output_manager_default.print(" vercel link"),1;if(!linkedProject.project||!linkedProject.org)return output_manager_default.error("Failed to get project information"),1;project=linkedProject.project}let preferredAlias=project.targets?.production?.alias?.[0],backupAlias=project.latestDeployments?.[0]?.url,target=preferredAlias||backupAlias;if(!target)throw new Error("No deployment URL found for the project");baseUrl=`https://${target}`}let fullUrl=`${baseUrl}${path.startsWith("/")?path:`/${path}`}`;output_manager_default.debug(`${import_chalk.default.cyan("Target URL:")} ${import_chalk.default.bold(fullUrl)}`);let deploymentProtectionToken=suppliedProtectionBypass??null;if(suppliedProtectionBypass===void 0&&link?.project.id)try{deploymentProtectionToken=await getOrCreateDeploymentProtectionToken(client,link,{createIfMissing:createProtectionBypassIfMissing,readinessUrl:fullUrl})}catch(err){return output_manager_default.error(`Failed to get deployment protection bypass token: ${err instanceof Error?err.message:String(err)}`),1}return{fullUrl,deploymentProtectionToken,link}}function traceCurl(root){let span=root?.child("vc.cli.curl"),finished=!1;return code=>{finished||(finished=!0,code!==0&&span?.setAttributes({error:"true"}),span?.stop())}}var import_error_utils2=__toESM(require_dist(),1);import{spawn}from"child_process";import{tmpdir}from"os";import{join as join2}from"path";import{mkdtemp,readFile as readFile2,rm}from"fs/promises";async function confirmProduction(client,{deploymentTarget,yes,isTTY}){return deploymentTarget!=="production"||yes?"proceed":isTTY?await client.input.confirm("You are about to capture a trace against a production deployment. Continue?",!1)?"proceed":"declined":(output_manager_default.error("Use --yes to capture traces on production from non-interactive contexts."),"non-tty-no-yes")}import{createHash}from"crypto";import{chmod,mkdir,readFile,unlink,writeFile}from"fs/promises";import{dirname,join}from"path";var FALLBACK_TTL_MS=5*60*1e3,EXPIRY_BUFFER_MS=30*1e3,CACHE_SCHEMA_VERSION=1;function resolveCacheDir(override){return override||join(getGlobalPathConfig(),"cache","traces")}function cacheFilename(teamId,host){let key=`${teamId??""}:${host}`;return`${createHash("sha256").update(key).digest("hex")}.json`}function cachePath(cacheDir,teamId,host){return join(cacheDir,cacheFilename(teamId,host))}async function readCache(path){let raw;try{raw=await readFile(path,"utf8")}catch{return null}try{let parsed=JSON.parse(raw);return!parsed||typeof parsed.token!="string"||typeof parsed.expiresAt!="number"||parsed.schemaVersion!==CACHE_SCHEMA_VERSION?null:parsed}catch{return output_manager_default.debug(`Trace cookie cache file is corrupt at ${path}; re-issuing.`),null}}async function writeCache(path,entry){await mkdir(dirname(path),{recursive:!0}),await writeFile(path,JSON.stringify(entry),{mode:384}),await chmod(path,384)}async function issueToken(client,{teamId,projectId,hostname}){let body=JSON.stringify({projectId,hostname}),response=await client.fetch("/v1/projects/traces/session",{method:"POST",body,headers:{"Content-Type":"application/json"},accountId:teamId});if(!response?.token)throw new Error("Trace session response is missing a token");let expiresAt=typeof response.expiresAt=="number"?response.expiresAt:Date.now()+FALLBACK_TTL_MS;return{token:response.token,expiresAt}}async function getTraceSessionToken({client,teamId,projectId,host,evictedToken,cacheDir}){let dir=resolveCacheDir(cacheDir),hostname=toHost(host),path=cachePath(dir,teamId,hostname),cached=await readCache(path);if(cached&&evictedToken&&cached.token===evictedToken)await unlink(path).catch(()=>{});else if(cached&&Date.now()<cached.expiresAt-EXPIRY_BUFFER_MS)return{token:cached.token,expiresAt:cached.expiresAt,fromCache:!0};let issued=await issueToken(client,{teamId,projectId,hostname});try{await writeCache(path,{token:issued.token,expiresAt:issued.expiresAt,schemaVersion:CACHE_SCHEMA_VERSION})}catch(err){output_manager_default.debug(`Failed to write trace cookie cache: ${err}`)}return{token:issued.token,expiresAt:issued.expiresAt,fromCache:!1}}var TRACE_COOKIE_NAME="_vercel_tracing",SESSION_COOKIE_NAME="_vercel_session";async function lookupDeployment(client,fullUrl,accountId){let deployment=await resolveDeployment(client,fullUrl,accountId);if(!deployment)throw new Error("Deployment not found");return deployment}function resolveTeamId(link,deployment){if(link?.org.type==="team")return link.org.id;if(deployment.ownerId?.startsWith("team_"))return deployment.ownerId}function extractVercelId(headerDump){let lines=headerDump.split(/\r?\n/),lastValue;for(let line of lines){let idx=line.indexOf(":");if(idx===-1)continue;line.slice(0,idx).trim().toLowerCase()==="x-vercel-id"&&(lastValue=line.slice(idx+1).trim())}if(!lastValue)return;let sepIdx=lastValue.lastIndexOf("::");return sepIdx===-1?lastValue:lastValue.slice(sepIdx+2)}function extractFinalStatus(headerDump){let lines=headerDump.split(/\r?\n/),lastStatus;for(let line of lines){let match=line.match(/^HTTP\/[\d.]+\s+(\d{3})/);match&&(lastStatus=Number(match[1]))}return lastStatus}async function runCurlAndCaptureHeaders(client,curlFlags,json){let tmpDir=await mkdtemp(join2(tmpdir(),"vc-curl-trace-")),headerFile=join2(tmpDir,"headers"),flags=["--dump-header",headerFile,...curlFlags];try{let{exitCode,capturedBody}=await new Promise(resolve=>{let finishTrace=traceCurl(client.telemetryEventStore.enabled?client.rootSpan:void 0),child=spawn("curl",flags,{stdio:json?["inherit","pipe","inherit"]:"inherit",shell:!1}),buf="";json&&child.stdout&&(child.stdout.setEncoding("utf8"),child.stdout.on("data",chunk=>{buf+=chunk})),child.on("error",err=>{finishTrace(1),err.code==="ENOENT"?output_manager_default.error("curl command not found. Please install curl."):output_manager_default.error(`Failed to execute curl: ${err.message}`),resolve({exitCode:1,capturedBody:buf})}),child.on("close",code=>{finishTrace(code),resolve({exitCode:code??1,capturedBody:buf})})}),headerDump="";try{headerDump=await readFile2(headerFile,"utf8")}catch(err){output_manager_default.debug(`Failed to read curl header dump: ${err}`)}return{exitCode,headerDump,capturedBody}}finally{await rm(tmpDir,{recursive:!0,force:!0}).catch(()=>{})}}async function trace(client,{fullUrl,link,curlFlags,json,yes,telemetry}){telemetry.trackCliFlagTrace(!0),json&&telemetry.trackCliFlagJson(!0);let accountId=link?.org.id,deployment;try{deployment=await lookupDeployment(client,fullUrl,accountId)}catch(err){return output_manager_default.error(`Failed to look up deployment for tracing: ${err instanceof Error?err.message:String(err)}`),1}let projectId=link?.project.id??deployment.projectId;if(!projectId)return output_manager_default.error("Could not resolve project for trace session. Run `vercel link` and retry."),1;let teamId=resolveTeamId(link,deployment),userId;try{userId=client.authConfig.userId??(await getUser(client)).id}catch(err){return output_manager_default.error(`Failed to resolve user for trace session: ${(0,import_error_utils2.errorToString)(err)}`),1}let deploymentTarget=deployment.target==="production"?"production":"preview",confirmation=await confirmProduction(client,{deploymentTarget,yes,isTTY:!!client.stdin.isTTY});if(confirmation==="non-tty-no-yes")return 1;if(confirmation==="declined")return output_manager_default.log("Trace cancelled."),0;deploymentTarget==="production"&&yes&&telemetry.trackCliFlagYesOnProduction(!0);let session;try{session=await getTraceSessionToken({client,teamId,projectId,host:fullUrl})}catch(err){return output_manager_default.error(`Failed to acquire trace session: ${err instanceof Error?err.message:String(err)}`),1}let{exitCode,headerDump,capturedBody}=await runCurlWithCookie(client,session.token,userId,curlFlags,json);if(session.fromCache&&extractFinalStatus(headerDump)===401&&exitCode===0){output_manager_default.debug("Trace cookie returned 401; evicting cache and retrying.");let refreshed;try{refreshed=await getTraceSessionToken({client,teamId,projectId,host:fullUrl,evictedToken:session.token})}catch(err){return output_manager_default.error(`Failed to refresh trace session after 401: ${err instanceof Error?err.message:String(err)}`),1}({exitCode,headerDump,capturedBody}=await runCurlWithCookie(client,refreshed.token,userId,curlFlags,json))}let requestId=extractVercelId(headerDump);return json?(client.stdout.write(`${JSON.stringify({response:capturedBody,requestId:requestId??null},null,2)}
8
+ `),requestId?exitCode:exitCode===0?1:exitCode):requestId?(client.stderr.write(`
9
+ Run \`vercel traces inspect ${requestId}\` to fetch the trace.
10
+ `),exitCode):(output_manager_default.error("Trace cookie was set but the response did not include an x-vercel-id header."),exitCode===0?1:exitCode)}async function runCurlWithCookie(client,token,userId,curlFlags,json){let flagsWithCookie=["--header",`Cookie: ${TRACE_COOKIE_NAME}=${token}; ${SESSION_COOKIE_NAME}=${userId}`,...curlFlags];return output_manager_default.debug(`Executing: curl ${flagsWithCookie.map(redactSecretHeader).map(requoteArgs).join(" ")}`),runCurlAndCaptureHeaders(client,flagsWithCookie,json)}async function curl(client){return runCurl(client,{})}async function runCurl(client,{forceTrace=!1,args}){let telemetryClient=new CurlTelemetryClient({opts:{store:client.telemetryEventStore}}),setup=setupCurlLikeCommand(client,curlCommand,telemetryClient,{allowFullUrl:!0,args});if(typeof setup=="number")return setup;let{path,isFullUrl,deploymentFlag,protectionBypassFlag,toolFlags,json:jsonFlag}=setup,unsupportedFlag=toolFlags.find(escapesRedirectLimit);if(unsupportedFlag)return output_manager_default.error(`${cmd(unsupportedFlag)} is not supported by ${getCommandName("curl")}.`),2;let traceFlag=forceTrace||setup.trace,result=isFullUrl?await getFullUrlAndToken(client,path,protectionBypassFlag):await getDeploymentUrlAndToken(client,"curl",path,{deploymentFlag,protectionBypassFlag,autoConfirm:setup.yes,resolveProjectForTrace:traceFlag});if(typeof result=="number")return result;let{fullUrl,deploymentProtectionToken}=result,curlFlags=[...toolFlags];return deploymentProtectionToken&&(curlFlags.unshift("--header",`x-vercel-protection-bypass: ${deploymentProtectionToken}`),curlFlags.push("--max-redirs","0")),curlFlags.unshift("--url",fullUrl),traceFlag?trace(client,{fullUrl,link:result.link??null,curlFlags,json:jsonFlag,yes:setup.yes,telemetry:telemetryClient}):(output_manager_default.debug(`Executing: curl ${curlFlags.map(redactSecretHeader).map(requoteArgs).join(" ")}`),deploymentProtectionToken&&bypassesProtection(result.link,fullUrl)&&(output_manager_default.warning("This request bypasses Deployment Protection, so its response doesn't show whether the URL is public."),output_manager_default.print(`
11
+ To check public access:
12
+ ${cmd(`curl ${shellQuote(fullUrl)}`)}
13
+ `)),new Promise(resolve=>{let finishTrace=traceCurl(client.telemetryEventStore.enabled?client.rootSpan:void 0),curlProcess=spawn2("curl",curlFlags,{stdio:"inherit",shell:!1});curlProcess.on("error",err=>{finishTrace(1),"code"in err&&err.code==="ENOENT"?(output_manager_default.error("curl command not found. Please install curl."),resolve(1)):(output_manager_default.error(`Failed to execute curl: ${err.message}`),resolve(1))}),curlProcess.on("close",code=>{finishTrace(code),resolve(code??1)})}))}function bypassesProtection(link,url){if(!link)return!0;let methods=readEnabledProtection(link.project),productionDomain=link.project.targets?.production?.alias?.[0];return(productionDomain&&toHost(url).toLowerCase()===productionDomain?getProtectionForProductionDomain(methods):methods).length>0}var CURL_SHORT_OPTIONS_WITH_VALUE="EKCbcdDFPHhmoUQreXYytzTuAw";function escapesRedirectLimit(flag){if(flag==="--"||flag==="--next"||flag==="--config")return!0;if(!flag.startsWith("-")||flag.startsWith("--"))return!1;for(let option of flag.slice(1)){if(option===":"||option==="K")return!0;if(CURL_SHORT_OPTIONS_WITH_VALUE.includes(option))return!1}return!1}function shellQuote(value){return/^[\w./:@%+=,-]+$/.test(value)?value:`'${value.replace(/'/g,"'\\''")}'`}export{redactSecretHeader,requoteArgs,setupCurlLikeCommand,getDeploymentUrlAndToken,curl,runCurl};
@@ -4,7 +4,7 @@ import { dirname as __dirname_ } from 'node:path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  const __filename = __fileURLToPath(import.meta.url);
6
6
  const __dirname = __dirname_(__filename);
7
- import{require_string_width,require_strip_ansi}from"./chunk-BULSRTQE.js";import{require_ansi_styles}from"./chunk-BRQUZ5NC.js";import{__commonJS,__require}from"./chunk-BZENIQ7N.js";var require_lib=__commonJS({"../../node_modules/.pnpm/mute-stream@1.0.0/node_modules/mute-stream/lib/index.js"(exports,module){var Stream=__require("stream"),MuteStream=class extends Stream{#isTTY=null;constructor(opts={}){super(opts),this.writable=this.readable=!0,this.muted=!1,this.on("pipe",this._onpipe),this.replace=opts.replace,this._prompt=opts.prompt||null,this._hadControl=!1}#destSrc(key,def){return this._dest?this._dest[key]:this._src?this._src[key]:def}#proxy(method,...args){typeof this._dest?.[method]=="function"&&this._dest[method](...args),typeof this._src?.[method]=="function"&&this._src[method](...args)}get isTTY(){return this.#isTTY!==null?this.#isTTY:this.#destSrc("isTTY",!1)}set isTTY(val){this.#isTTY=val}get rows(){return this.#destSrc("rows")}get columns(){return this.#destSrc("columns")}mute(){this.muted=!0}unmute(){this.muted=!1}_onpipe(src){this._src=src}pipe(dest,options){return this._dest=dest,super.pipe(dest,options)}pause(){if(this._src)return this._src.pause()}resume(){if(this._src)return this._src.resume()}write(c){if(this.muted){if(!this.replace)return!0;if(c.match(/^\u001b/))return c.indexOf(this._prompt)===0&&(c=c.slice(this._prompt.length),c=c.replace(/./g,this.replace),c=this._prompt+c),this._hadControl=!0,this.emit("data",c);this._prompt&&this._hadControl&&c.indexOf(this._prompt)===0&&(this._hadControl=!1,this.emit("data",this._prompt),c=c.slice(this._prompt.length)),c=c.toString().replace(/./g,this.replace)}this.emit("data",c)}end(c){this.muted&&(c&&this.replace?c=c.toString().replace(/./g,this.replace):c=null),c&&this.emit("data",c),this.emit("end")}destroy(...args){return this.#proxy("destroy",...args)}destroySoon(...args){return this.#proxy("destroySoon",...args)}close(...args){return this.#proxy("close",...args)}};module.exports=MuteStream}});var require_cli_width=__commonJS({"../../node_modules/.pnpm/cli-width@4.1.0/node_modules/cli-width/index.js"(exports,module){"use strict";module.exports=cliWidth;function normalizeOpts(options){let defaultOpts={defaultWidth:0,output:process.stdout,tty:__require("tty")};return options?(Object.keys(defaultOpts).forEach(function(key){options[key]||(options[key]=defaultOpts[key])}),options):defaultOpts}function cliWidth(options){let opts=normalizeOpts(options);if(opts.output.getWindowSize)return opts.output.getWindowSize()[0]||opts.defaultWidth;if(opts.tty.getWindowSize)return opts.tty.getWindowSize()[1]||opts.defaultWidth;if(opts.output.columns)return opts.output.columns;if(process.env.CLI_WIDTH){let width=parseInt(process.env.CLI_WIDTH,10);if(!isNaN(width)&&width!==0)return width}return opts.defaultWidth}}});var require_wrap_ansi=__commonJS({"../../node_modules/.pnpm/wrap-ansi@6.2.0/node_modules/wrap-ansi/index.js"(exports,module){"use strict";var stringWidth=require_string_width(),stripAnsi=require_strip_ansi(),ansiStyles=require_ansi_styles(),ESCAPES=new Set(["\x1B","\x9B"]),END_CODE=39,wrapAnsi=code=>`${ESCAPES.values().next().value}[${code}m`,wordLengths=string=>string.split(" ").map(character=>stringWidth(character)),wrapWord=(rows,word,columns)=>{let characters=[...word],isInsideEscape=!1,visible=stringWidth(stripAnsi(rows[rows.length-1]));for(let[index,character]of characters.entries()){let characterLength=stringWidth(character);if(visible+characterLength<=columns?rows[rows.length-1]+=character:(rows.push(character),visible=0),ESCAPES.has(character))isInsideEscape=!0;else if(isInsideEscape&&character==="m"){isInsideEscape=!1;continue}isInsideEscape||(visible+=characterLength,visible===columns&&index<characters.length-1&&(rows.push(""),visible=0))}!visible&&rows[rows.length-1].length>0&&rows.length>1&&(rows[rows.length-2]+=rows.pop())},stringVisibleTrimSpacesRight=str=>{let words=str.split(" "),last=words.length;for(;last>0&&!(stringWidth(words[last-1])>0);)last--;return last===words.length?str:words.slice(0,last).join(" ")+words.slice(last).join("")},exec=(string,columns,options={})=>{if(options.trim!==!1&&string.trim()==="")return"";let pre="",ret="",escapeCode,lengths=wordLengths(string),rows=[""];for(let[index,word]of string.split(" ").entries()){options.trim!==!1&&(rows[rows.length-1]=rows[rows.length-1].trimLeft());let rowLength=stringWidth(rows[rows.length-1]);if(index!==0&&(rowLength>=columns&&(options.wordWrap===!1||options.trim===!1)&&(rows.push(""),rowLength=0),(rowLength>0||options.trim===!1)&&(rows[rows.length-1]+=" ",rowLength++)),options.hard&&lengths[index]>columns){let remainingColumns=columns-rowLength,breaksStartingThisLine=1+Math.floor((lengths[index]-remainingColumns-1)/columns);Math.floor((lengths[index]-1)/columns)<breaksStartingThisLine&&rows.push(""),wrapWord(rows,word,columns);continue}if(rowLength+lengths[index]>columns&&rowLength>0&&lengths[index]>0){if(options.wordWrap===!1&&rowLength<columns){wrapWord(rows,word,columns);continue}rows.push("")}if(rowLength+lengths[index]>columns&&options.wordWrap===!1){wrapWord(rows,word,columns);continue}rows[rows.length-1]+=word}options.trim!==!1&&(rows=rows.map(stringVisibleTrimSpacesRight)),pre=rows.join(`
7
+ import{require_ansi_styles}from"./chunk-BRQUZ5NC.js";import{require_string_width,require_strip_ansi}from"./chunk-BULSRTQE.js";import{__commonJS,__require}from"./chunk-BZENIQ7N.js";var require_lib=__commonJS({"../../node_modules/.pnpm/mute-stream@1.0.0/node_modules/mute-stream/lib/index.js"(exports,module){var Stream=__require("stream"),MuteStream=class extends Stream{#isTTY=null;constructor(opts={}){super(opts),this.writable=this.readable=!0,this.muted=!1,this.on("pipe",this._onpipe),this.replace=opts.replace,this._prompt=opts.prompt||null,this._hadControl=!1}#destSrc(key,def){return this._dest?this._dest[key]:this._src?this._src[key]:def}#proxy(method,...args){typeof this._dest?.[method]=="function"&&this._dest[method](...args),typeof this._src?.[method]=="function"&&this._src[method](...args)}get isTTY(){return this.#isTTY!==null?this.#isTTY:this.#destSrc("isTTY",!1)}set isTTY(val){this.#isTTY=val}get rows(){return this.#destSrc("rows")}get columns(){return this.#destSrc("columns")}mute(){this.muted=!0}unmute(){this.muted=!1}_onpipe(src){this._src=src}pipe(dest,options){return this._dest=dest,super.pipe(dest,options)}pause(){if(this._src)return this._src.pause()}resume(){if(this._src)return this._src.resume()}write(c){if(this.muted){if(!this.replace)return!0;if(c.match(/^\u001b/))return c.indexOf(this._prompt)===0&&(c=c.slice(this._prompt.length),c=c.replace(/./g,this.replace),c=this._prompt+c),this._hadControl=!0,this.emit("data",c);this._prompt&&this._hadControl&&c.indexOf(this._prompt)===0&&(this._hadControl=!1,this.emit("data",this._prompt),c=c.slice(this._prompt.length)),c=c.toString().replace(/./g,this.replace)}this.emit("data",c)}end(c){this.muted&&(c&&this.replace?c=c.toString().replace(/./g,this.replace):c=null),c&&this.emit("data",c),this.emit("end")}destroy(...args){return this.#proxy("destroy",...args)}destroySoon(...args){return this.#proxy("destroySoon",...args)}close(...args){return this.#proxy("close",...args)}};module.exports=MuteStream}});var require_cli_width=__commonJS({"../../node_modules/.pnpm/cli-width@4.1.0/node_modules/cli-width/index.js"(exports,module){"use strict";module.exports=cliWidth;function normalizeOpts(options){let defaultOpts={defaultWidth:0,output:process.stdout,tty:__require("tty")};return options?(Object.keys(defaultOpts).forEach(function(key){options[key]||(options[key]=defaultOpts[key])}),options):defaultOpts}function cliWidth(options){let opts=normalizeOpts(options);if(opts.output.getWindowSize)return opts.output.getWindowSize()[0]||opts.defaultWidth;if(opts.tty.getWindowSize)return opts.tty.getWindowSize()[1]||opts.defaultWidth;if(opts.output.columns)return opts.output.columns;if(process.env.CLI_WIDTH){let width=parseInt(process.env.CLI_WIDTH,10);if(!isNaN(width)&&width!==0)return width}return opts.defaultWidth}}});var require_wrap_ansi=__commonJS({"../../node_modules/.pnpm/wrap-ansi@6.2.0/node_modules/wrap-ansi/index.js"(exports,module){"use strict";var stringWidth=require_string_width(),stripAnsi=require_strip_ansi(),ansiStyles=require_ansi_styles(),ESCAPES=new Set(["\x1B","\x9B"]),END_CODE=39,wrapAnsi=code=>`${ESCAPES.values().next().value}[${code}m`,wordLengths=string=>string.split(" ").map(character=>stringWidth(character)),wrapWord=(rows,word,columns)=>{let characters=[...word],isInsideEscape=!1,visible=stringWidth(stripAnsi(rows[rows.length-1]));for(let[index,character]of characters.entries()){let characterLength=stringWidth(character);if(visible+characterLength<=columns?rows[rows.length-1]+=character:(rows.push(character),visible=0),ESCAPES.has(character))isInsideEscape=!0;else if(isInsideEscape&&character==="m"){isInsideEscape=!1;continue}isInsideEscape||(visible+=characterLength,visible===columns&&index<characters.length-1&&(rows.push(""),visible=0))}!visible&&rows[rows.length-1].length>0&&rows.length>1&&(rows[rows.length-2]+=rows.pop())},stringVisibleTrimSpacesRight=str=>{let words=str.split(" "),last=words.length;for(;last>0&&!(stringWidth(words[last-1])>0);)last--;return last===words.length?str:words.slice(0,last).join(" ")+words.slice(last).join("")},exec=(string,columns,options={})=>{if(options.trim!==!1&&string.trim()==="")return"";let pre="",ret="",escapeCode,lengths=wordLengths(string),rows=[""];for(let[index,word]of string.split(" ").entries()){options.trim!==!1&&(rows[rows.length-1]=rows[rows.length-1].trimLeft());let rowLength=stringWidth(rows[rows.length-1]);if(index!==0&&(rowLength>=columns&&(options.wordWrap===!1||options.trim===!1)&&(rows.push(""),rowLength=0),(rowLength>0||options.trim===!1)&&(rows[rows.length-1]+=" ",rowLength++)),options.hard&&lengths[index]>columns){let remainingColumns=columns-rowLength,breaksStartingThisLine=1+Math.floor((lengths[index]-remainingColumns-1)/columns);Math.floor((lengths[index]-1)/columns)<breaksStartingThisLine&&rows.push(""),wrapWord(rows,word,columns);continue}if(rowLength+lengths[index]>columns&&rowLength>0&&lengths[index]>0){if(options.wordWrap===!1&&rowLength<columns){wrapWord(rows,word,columns);continue}rows.push("")}if(rowLength+lengths[index]>columns&&options.wordWrap===!1){wrapWord(rows,word,columns);continue}rows[rows.length-1]+=word}options.trim!==!1&&(rows=rows.map(stringVisibleTrimSpacesRight)),pre=rows.join(`
8
8
  `);for(let[index,character]of[...pre].entries()){if(ret+=character,ESCAPES.has(character)){let code2=parseFloat(/\d[^m]*/.exec(pre.slice(index,index+4)));escapeCode=code2===END_CODE?null:code2}let code=ansiStyles.codes.get(Number(escapeCode));escapeCode&&code&&(pre[index+1]===`
9
9
  `?ret+=wrapAnsi(code):character===`
10
10
  `&&(ret+=wrapAnsi(escapeCode)))}return ret};module.exports=(string,columns,options)=>String(string).normalize().replace(/\r\n/g,`
@@ -4,7 +4,7 @@ import { dirname as __dirname_ } from 'node:path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  const __filename = __fileURLToPath(import.meta.url);
6
6
  const __dirname = __dirname_(__filename);
7
- import{applyEdits,init_main,modify,parse as parse2,printParseErrorCode}from"./chunk-J24BABG4.js";import{init_dist,parse,stringify}from"./chunk-U4Z2MMOF.js";import{require_execa}from"./chunk-RCUDI7OF.js";import{external_exports}from"./chunk-2AMO2VMV.js";import{printAlignedLabel}from"./chunk-PKNEWN4W.js";import{output_manager_default}from"./chunk-GZLYNPNU.js";import{__toESM}from"./chunk-BZENIQ7N.js";import{join as join2}from"node:path";init_dist();init_main();import{readFile,writeFile,mkdir,copyFile,access,chmod,lstat,stat,link,unlink}from"node:fs/promises";import{isDeepStrictEqual}from"node:util";import{dirname}from"node:path";async function pathExists(path){try{return await access(path),!0}catch{return!1}}async function isFile(path){try{return(await stat(path)).isFile()}catch{return!1}}async function isSymlink(path){try{return(await lstat(path)).isSymbolicLink()}catch{return!1}}async function readFileOrNull(path){try{return await readFile(path,"utf8")}catch(err){if(err.code==="ENOENT")return null;throw err}}function isPlainObject(value){return typeof value=="object"&&value!==null&&!Array.isArray(value)&&Object.getPrototypeOf(value)===Object.prototype}function deepMerge(base,patch){let out={...base};for(let[key,patchValue]of Object.entries(patch)){let baseValue=out[key];isPlainObject(baseValue)&&isPlainObject(patchValue)?out[key]=deepMerge(baseValue,patchValue):out[key]=patchValue}return out}function detectJsonFormatting(text){let eol=text.includes(`\r
7
+ import{applyEdits,init_main,modify,parse as parse2,printParseErrorCode}from"./chunk-J24BABG4.js";import{init_dist,parse,stringify}from"./chunk-U4Z2MMOF.js";import{external_exports}from"./chunk-2AMO2VMV.js";import{require_execa}from"./chunk-M32HBBPK.js";import{printAlignedLabel}from"./chunk-K46QQRUN.js";import{output_manager_default}from"./chunk-YNCWSPPJ.js";import{__toESM}from"./chunk-BZENIQ7N.js";import{join as join2}from"node:path";init_dist();init_main();import{readFile,writeFile,mkdir,copyFile,access,chmod,lstat,stat,link,unlink}from"node:fs/promises";import{isDeepStrictEqual}from"node:util";import{dirname}from"node:path";async function pathExists(path){try{return await access(path),!0}catch{return!1}}async function isFile(path){try{return(await stat(path)).isFile()}catch{return!1}}async function isSymlink(path){try{return(await lstat(path)).isSymbolicLink()}catch{return!1}}async function readFileOrNull(path){try{return await readFile(path,"utf8")}catch(err){if(err.code==="ENOENT")return null;throw err}}function isPlainObject(value){return typeof value=="object"&&value!==null&&!Array.isArray(value)&&Object.getPrototypeOf(value)===Object.prototype}function deepMerge(base,patch){let out={...base};for(let[key,patchValue]of Object.entries(patch)){let baseValue=out[key];isPlainObject(baseValue)&&isPlainObject(patchValue)?out[key]=deepMerge(baseValue,patchValue):out[key]=patchValue}return out}function detectJsonFormatting(text){let eol=text.includes(`\r
8
8
  `)?`\r
9
9
  `:`
10
10
  `,indent=text.match(/^([ \t]+)\S/m)?.[1];return indent?.startsWith(" ")?{eol,insertSpaces:!1,tabSize:1}:{eol,insertSpaces:!0,tabSize:indent?.length||2}}function parseJsonObjectOrNull(current,parse4=JSON.parse){if(!current||!current.trim())return null;let raw;try{raw=parse4(current)}catch(err){throw new Error(`existing file is not valid JSON (${err.message})`)}if(!isPlainObject(raw))throw new Error("existing file is not a JSON object");return raw}function mergeJson(current,patch,parse4=JSON.parse){let raw=parseJsonObjectOrNull(current,parse4);if(!current||raw===null)return`${JSON.stringify(deepMerge({},patch),null,2)}
@@ -0,0 +1,7 @@
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{require_dist2 as require_dist}from"./chunk-66TKNVRG.js";import{__commonJS}from"./chunk-BZENIQ7N.js";var require_dist2=__commonJS({"../service-topology/dist/index.js"(exports,module){"use strict";var __defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__hasOwnProp=Object.prototype.hasOwnProperty,__export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to},__toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod),src_exports={};__export(src_exports,{INTERNAL_SERVICE_PREFIX:()=>import_fs_detectors.INTERNAL_SERVICE_PREFIX,autoDetectServices:()=>import_fs_detectors.autoDetectServices,detectDaemons:()=>import_fs_detectors.detectDaemons,detectServices:()=>import_fs_detectors.detectServices,generateServiceRewrites:()=>import_fs_detectors.generateServiceRewrites,generateServicesRoutes:()=>import_fs_detectors.generateServicesRoutes,getInternalServiceCronPath:()=>import_fs_detectors.getInternalServiceCronPath,getInternalServiceCronPathPrefix:()=>import_fs_detectors.getInternalServiceCronPathPrefix,getInternalServiceFunctionPath:()=>import_fs_detectors.getInternalServiceFunctionPath,getInternalServiceWorkerPath:()=>import_fs_detectors.getInternalServiceWorkerPath,getInternalServiceWorkerPathPrefix:()=>import_fs_detectors.getInternalServiceWorkerPathPrefix,hasLegacyServicesConfig:()=>import_fs_detectors.hasLegacyServicesConfig,isExperimentalService:()=>import_fs_detectors.isExperimentalService,isExperimentalServiceV2:()=>import_fs_detectors.isExperimentalServiceV2,isRouteOwningBuilder:()=>import_fs_detectors.isRouteOwningBuilder,isStaticBuild:()=>import_fs_detectors.isStaticBuild,migrateExperimentalServices:()=>import_fs_detectors.migrateExperimentalServices,planExperimentalServicesMigration:()=>import_fs_detectors.planExperimentalServicesMigration,resolveAllConfiguredServices:()=>import_fs_detectors.resolveAllConfiguredServices,resolveAllConfiguredServicesV2:()=>import_fs_detectors.resolveAllConfiguredServicesV2,resolveConfiguredServiceV2:()=>import_fs_detectors.resolveConfiguredServiceV2,validateServiceConfigV2:()=>import_fs_detectors.validateServiceConfigV2});module.exports=__toCommonJS(src_exports);var import_fs_detectors=require_dist()}});export{require_dist2 as require_dist};
@@ -4,4 +4,4 @@ import { dirname as __dirname_ } from 'node:path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  const __filename = __fileURLToPath(import.meta.url);
6
6
  const __dirname = __dirname_(__filename);
7
- import{packageName}from"./chunk-VRH7LWOC.js";import{jsonOption,limitOption,projectOption,yesOption}from"./chunk-AMPJ6RWT.js";var listSubcommand={name:"list",aliases:["ls"],description:"List all routing rules for the current project. These routes apply to all deployments and environments.",arguments:[],options:[projectOption,jsonOption,{name:"query",description:"Search by name, description, source, or destination",shorthand:"q",type:String,argument:"TEXT",deprecated:!1},{name:"search",description:"Deprecated alias for `--query`",shorthand:"s",type:String,argument:"QUERY",deprecated:!0},{name:"type",description:"Filter by type: rewrite, redirect, set_status, transform",shorthand:null,type:String,argument:"TYPE",deprecated:!1},{name:"filter",description:"Deprecated alias for `--type`",shorthand:"f",type:String,argument:"TYPE",deprecated:!0},{name:"production",description:"List routes from the live production version",shorthand:null,type:Boolean,deprecated:!1},{name:"routes-version",description:"List routes from a specific version",shorthand:null,type:String,argument:"VERSION",deprecated:!1},{name:"version-id",description:"Deprecated alias for `--routes-version`",shorthand:null,type:String,argument:"VERSION_ID",deprecated:!0},{name:"diff",description:"Compare staged changes against production. Use with --routes-version to compare a specific version.",shorthand:null,type:Boolean,deprecated:!1},{name:"expand",description:"Show expanded details for each route",shorthand:null,deprecatedShorthand:"e",type:Boolean,deprecated:!1}],examples:[{name:"List all routes",value:`${packageName} routes list`},{name:"Search for routes",value:`${packageName} routes list --query "api"`},{name:"Filter by type",value:`${packageName} routes list --type rewrite`},{name:"Show staged changes",value:`${packageName} routes list --diff`},{name:"Show live production routes",value:`${packageName} routes list --production`},{name:"Show expanded details",value:`${packageName} routes list --expand`}]},listVersionsSubcommand={name:"list-versions",aliases:["ls-versions"],description:"List all versions of routing rules",arguments:[],options:[projectOption,jsonOption,{...limitOption,description:"Number of versions to fetch (default: 20, max: 100)"},{name:"count",description:"Deprecated alias for `--limit`",shorthand:null,type:Number,argument:"NUMBER",deprecated:!0}],examples:[{name:"List route versions",value:`${packageName} routes list-versions`},{name:"List more versions",value:`${packageName} routes list-versions --limit 50`}]},inspectSubcommand={name:"inspect",aliases:[],description:"Show detailed information about a specific route",arguments:[{name:"name-or-id",required:!0}],options:[projectOption,jsonOption,{name:"diff",description:"Compare staged changes against production for this route",shorthand:null,type:Boolean,deprecated:!1}],examples:[{name:"Inspect a route by name",value:`${packageName} routes inspect "API rewrite"`},{name:"Inspect a route by ID",value:`${packageName} routes inspect abc123`},{name:"Show staged changes for a route",value:`${packageName} routes inspect "My route" --diff`}]},addSubcommand={name:"add",aliases:[],description:"Add a new routing rule to the project",arguments:[{name:"name",required:!1}],options:[projectOption,{name:"src",description:"Path pattern (required in non-interactive mode)",shorthand:null,type:String,argument:"PATTERN",deprecated:!1},{name:"src-syntax",description:"Path syntax: regex, path-to-regexp, equals (default: regex)",shorthand:null,type:String,argument:"TYPE",deprecated:!1},{name:"action",description:"Action type: rewrite, redirect, or set-status (required with --dest/--status)",shorthand:null,type:String,argument:"TYPE",deprecated:!1},{name:"dest",description:"Destination URL for rewrite or redirect",shorthand:null,type:String,argument:"URL",deprecated:!1},{name:"status",description:"Status code (301/302/307/308 for redirect, or any for set-status)",shorthand:null,type:Number,argument:"CODE",deprecated:!1},{name:"set-response-header",description:"Set response header: key=value (repeatable)",shorthand:null,type:[String],argument:"HEADER",deprecated:!1},{name:"append-response-header",description:"Append to response header: key=value (repeatable)",shorthand:null,type:[String],argument:"HEADER",deprecated:!1},{name:"delete-response-header",description:"Delete response header: key (repeatable)",shorthand:null,type:[String],argument:"KEY",deprecated:!1},{name:"set-request-header",description:"Set request header: key=value (repeatable)",shorthand:null,type:[String],argument:"HEADER",deprecated:!1},{name:"append-request-header",description:"Append to request header: key=value (repeatable)",shorthand:null,type:[String],argument:"HEADER",deprecated:!1},{name:"delete-request-header",description:"Delete request header: key (repeatable)",shorthand:null,type:[String],argument:"KEY",deprecated:!1},{name:"set-request-query",description:"Set query parameter: key=value (repeatable)",shorthand:null,type:[String],argument:"PARAM",deprecated:!1},{name:"append-request-query",description:"Append to query parameter: key=value (repeatable)",shorthand:null,type:[String],argument:"PARAM",deprecated:!1},{name:"delete-request-query",description:"Delete query parameter: key (repeatable)",shorthand:null,type:[String],argument:"KEY",deprecated:!1},{name:"has",description:"Condition that must match: type:key or type:key:value (repeatable)",shorthand:null,type:[String],argument:"CONDITION",deprecated:!1},{name:"missing",description:'"Does not have" condition: type:key or type:key:value (repeatable)',shorthand:null,type:[String],argument:"CONDITION",deprecated:!1},{name:"description",description:"Route description (max 1024 chars)",shorthand:null,type:String,argument:"TEXT",deprecated:!1},{name:"no-enable",description:"Add the route turned off (default: on)",shorthand:null,type:Boolean,deprecated:!1},{name:"disabled",description:"Deprecated alias for `--no-enable`",shorthand:null,type:Boolean,deprecated:!0},{name:"ai",description:"Generate route from a natural language description (AI-powered)",shorthand:null,type:String,argument:"PROMPT",deprecated:!1},{name:"position",description:"Position: start, end, after:<id>, before:<id>",shorthand:null,type:String,argument:"POSITION",deprecated:!1},{name:"yes",description:"Skip confirmation prompts",shorthand:"y",type:Boolean,deprecated:!1}],examples:[{name:"Interactive mode",value:`${packageName} routes add`},{name:"Create with AI",value:`${packageName} routes add --ai "Rewrite /api/* to https://backend.internal/*"`},{name:"Add a rewrite",value:`${packageName} routes add "API Proxy" --src "/api/:path*" --src-syntax path-to-regexp --action rewrite --dest "https://api.example.com/:path*" --yes`},{name:"Add a redirect",value:`${packageName} routes add "Old Blog" --src "/blog" --src-syntax equals --action redirect --dest "/articles" --status 301 --yes`},{name:"Add CORS headers",value:`${packageName} routes add "CORS" --src "^/api/.*$" --set-response-header "Access-Control-Allow-Origin=*" --yes`},{name:"Block access (set status)",value:`${packageName} routes add "Block Admin" --src "^/admin/.*$" --action set-status --status 403 --yes`},{name:"Conditional redirect",value:`${packageName} routes add "Auth Required" --src "/protected/:path*" --src-syntax path-to-regexp --action redirect --dest "/login" --status 307 --missing "cookie:session" --yes`},{name:"Rewrite with request headers",value:`${packageName} routes add "Backend Proxy" --src "/backend/:path*" --src-syntax path-to-regexp --action rewrite --dest "https://internal.example.com/:path*" --set-request-header "X-Forwarded-Host=myapp.com" --yes`},{name:"Add route at start",value:`${packageName} routes add "Priority Route" --src "/priority" --src-syntax equals --action rewrite --dest "/handler" --position start --yes`}]},publishSubcommand={name:"publish",aliases:[],description:"Publish all staged routing changes to production",arguments:[],options:[projectOption,{...yesOption,description:"Skip the confirmation prompt when publishing"}],examples:[{name:"Publish staged changes",value:`${packageName} routes publish`},{name:"Publish without confirmation",value:`${packageName} routes publish --yes`}]},restoreSubcommand={name:"restore",aliases:[],description:"Restore a previous routing version to production",arguments:[{name:"version-id",required:!0}],options:[projectOption,{...yesOption,description:"Skip the confirmation prompt when restoring"}],examples:[{name:"Restore a previous version",placeholders:["<version-id>"],value:`${packageName} routes restore <version-id>`},{name:"Restore without confirmation",placeholders:["<version-id>"],value:`${packageName} routes restore <version-id> --yes`}]},discardSubcommand={name:"discard-staging",aliases:[],description:"Discard staged routing changes",arguments:[],options:[projectOption,{...yesOption,description:"Skip the confirmation prompt when discarding"}],examples:[{name:"Discard staged changes",value:`${packageName} routes discard-staging`},{name:"Discard without confirmation",value:`${packageName} routes discard-staging --yes`}]},deleteSubcommand={name:"remove",aliases:["rm","delete"],description:"Remove one or more routing rules",arguments:[{name:"name-or-id",required:!0,multiple:!0}],options:[projectOption,{...yesOption,description:"Skip the confirmation prompt when removing"}],examples:[{name:"Remove a route by name",value:`${packageName} routes remove "Old Redirect"`},{name:"Remove a route by ID",value:`${packageName} routes remove abc123`},{name:"Remove multiple routes",value:`${packageName} routes remove "Route A" "Route B"`},{name:"Remove without confirmation",value:`${packageName} routes remove "Old Route" --yes`}]},enableSubcommand={name:"enable",aliases:[],description:"Enable a disabled routing rule",arguments:[{name:"name-or-id",required:!0}],options:[projectOption],examples:[{name:"Enable a route by name",value:`${packageName} routes enable "API Proxy"`},{name:"Enable a route by ID",value:`${packageName} routes enable abc123`}]},disableSubcommand={name:"disable",aliases:[],description:"Disable a routing rule without deleting it",arguments:[{name:"name-or-id",required:!0}],options:[projectOption],examples:[{name:"Disable a route by name",value:`${packageName} routes disable "API Proxy"`},{name:"Disable a route by ID",value:`${packageName} routes disable abc123`}]},reorderSubcommand={name:"move",aliases:["reorder"],description:"Move a routing rule to a different position",arguments:[{name:"name-or-id",required:!0}],options:[projectOption,{name:"position",description:"Target position: start, end, a number (1-based), before:<id>, after:<id>",shorthand:null,type:String,argument:"POSITION",deprecated:!1},{name:"first",description:"Move to the first position (highest priority)",shorthand:null,type:Boolean,deprecated:!1},{name:"last",description:"Move to the last position (lowest priority)",shorthand:null,type:Boolean,deprecated:!1},{...yesOption,description:"Skip the confirmation prompt when moving"}],examples:[{name:"Move to first position",value:`${packageName} routes move "Catch All" --first`},{name:"Move to last position",value:`${packageName} routes move "Catch All" --last`},{name:"Move to a specific position",value:`${packageName} routes move "API Proxy" --position 3`},{name:"Move after another route",value:`${packageName} routes move "API Proxy" --position after:route-id-123`},{name:"Interactive move (prompts for position)",value:`${packageName} routes move "API Proxy"`}]},editSubcommand={name:"update",aliases:["edit"],description:"Update an existing routing rule",arguments:[{name:"name-or-id",required:!0}],options:[projectOption,{name:"name",description:"Change route name",shorthand:null,type:String,argument:"NAME",deprecated:!1},{name:"description",description:'Change description (use "" to clear)',shorthand:null,type:String,argument:"TEXT",deprecated:!1},{name:"src",description:"Change source path pattern",shorthand:null,type:String,argument:"PATTERN",deprecated:!1},{name:"src-syntax",description:"Change path syntax: regex, path-to-regexp, equals",shorthand:null,type:String,argument:"TYPE",deprecated:!1},{name:"action",description:"Set action type: rewrite, redirect, or set-status (required when switching types)",shorthand:null,type:String,argument:"TYPE",deprecated:!1},{name:"dest",description:"Set destination URL",shorthand:null,type:String,argument:"URL",deprecated:!1},{name:"status",description:"Set status code",shorthand:null,type:Number,argument:"CODE",deprecated:!1},{name:"no-dest",description:"Remove destination",shorthand:null,type:Boolean,deprecated:!1},{name:"no-status",description:"Remove status code",shorthand:null,type:Boolean,deprecated:!1},{name:"set-response-header",description:"Set response header: key=value (repeatable)",shorthand:null,type:[String],argument:"HEADER",deprecated:!1},{name:"append-response-header",description:"Append to response header: key=value (repeatable)",shorthand:null,type:[String],argument:"HEADER",deprecated:!1},{name:"delete-response-header",description:"Delete response header: key (repeatable)",shorthand:null,type:[String],argument:"KEY",deprecated:!1},{name:"set-request-header",description:"Set request header: key=value (repeatable)",shorthand:null,type:[String],argument:"HEADER",deprecated:!1},{name:"append-request-header",description:"Append to request header: key=value (repeatable)",shorthand:null,type:[String],argument:"HEADER",deprecated:!1},{name:"delete-request-header",description:"Delete request header: key (repeatable)",shorthand:null,type:[String],argument:"KEY",deprecated:!1},{name:"set-request-query",description:"Set query parameter: key=value (repeatable)",shorthand:null,type:[String],argument:"PARAM",deprecated:!1},{name:"append-request-query",description:"Append to query parameter: key=value (repeatable)",shorthand:null,type:[String],argument:"PARAM",deprecated:!1},{name:"delete-request-query",description:"Delete query parameter: key (repeatable)",shorthand:null,type:[String],argument:"KEY",deprecated:!1},{name:"has",description:"Add a has condition: type:key or type:key:value (repeatable)",shorthand:null,type:[String],argument:"CONDITION",deprecated:!1},{name:"missing",description:'Add a "does not have" condition: type:key or type:key:value (repeatable)',shorthand:null,type:[String],argument:"CONDITION",deprecated:!1},{name:"clear-conditions",description:"Remove all has/does-not-have conditions",shorthand:null,type:Boolean,deprecated:!1},{name:"clear-headers",description:"Remove all response headers",shorthand:null,type:Boolean,deprecated:!1},{name:"clear-transforms",description:"Remove all transforms (request headers, request query)",shorthand:null,type:Boolean,deprecated:!1},{name:"ai",description:"Describe changes using natural language (AI-powered)",shorthand:null,type:String,argument:"PROMPT",deprecated:!1},{...yesOption,description:"Skip confirmation prompts"}],examples:[{name:"Interactive mode",value:`${packageName} routes update "API Proxy"`},{name:"Update with AI",value:`${packageName} routes update "API Proxy" --ai "Add CORS headers and change status to 308"`},{name:"Change destination",value:`${packageName} routes update "API Proxy" --dest "https://new-api.example.com/:path*"`},{name:"Switch to redirect",value:`${packageName} routes update "Old Route" --action redirect --dest "/new" --status 301`},{name:"Add a response header",value:`${packageName} routes update "My Route" --set-response-header "Cache-Control=public, max-age=3600"`},{name:"Clear all conditions and add new ones",value:`${packageName} routes update "My Route" --clear-conditions --has "header:Authorization"`}]},exportSubcommand={name:"export",aliases:[],description:"Export routes to a vercel.json or vercel.ts file",arguments:[{name:"name-or-id",required:!1}],options:[projectOption,{name:"output",description:"Output file format: .json or .ts (default: .json)",shorthand:"o",type:String,argument:"json|ts",deprecated:!1}],examples:[{name:"Export as vercel.json format",value:`${packageName} routes export`},{name:"Export as vercel.ts format",value:`${packageName} routes export --output ts`},{name:"Export a specific route",value:`${packageName} routes export "API Proxy"`},{name:"Export to a file",value:`${packageName} routes export > routes.json`}]},routesCommand={name:"routes",aliases:[],description:"Manage routing rules for a project. Routes managed at the project level apply to all deployments and environments.",arguments:[],subcommands:[listSubcommand,listVersionsSubcommand,inspectSubcommand,addSubcommand,editSubcommand,deleteSubcommand,enableSubcommand,disableSubcommand,reorderSubcommand,exportSubcommand,publishSubcommand,restoreSubcommand,discardSubcommand],options:[],examples:[]};export{listSubcommand,listVersionsSubcommand,inspectSubcommand,addSubcommand,publishSubcommand,restoreSubcommand,discardSubcommand,deleteSubcommand,enableSubcommand,disableSubcommand,reorderSubcommand,editSubcommand,exportSubcommand,routesCommand};
7
+ import{packageName}from"./chunk-B4KA3ZH2.js";import{jsonOption,limitOption,projectOption,yesOption}from"./chunk-EZVNGJN5.js";var listSubcommand={name:"list",aliases:["ls"],description:"List all routing rules for the current project. These routes apply to all deployments and environments.",arguments:[],options:[projectOption,jsonOption,{name:"query",description:"Search by name, description, source, or destination",shorthand:"q",type:String,argument:"TEXT",deprecated:!1},{name:"search",description:"Deprecated alias for `--query`",shorthand:"s",type:String,argument:"QUERY",deprecated:!0},{name:"type",description:"Filter by type: rewrite, redirect, set_status, transform",shorthand:null,type:String,argument:"TYPE",deprecated:!1},{name:"filter",description:"Deprecated alias for `--type`",shorthand:"f",type:String,argument:"TYPE",deprecated:!0},{name:"production",description:"List routes from the live production version",shorthand:null,type:Boolean,deprecated:!1},{name:"routes-version",description:"List routes from a specific version",shorthand:null,type:String,argument:"VERSION",deprecated:!1},{name:"version-id",description:"Deprecated alias for `--routes-version`",shorthand:null,type:String,argument:"VERSION_ID",deprecated:!0},{name:"diff",description:"Compare staged changes against production. Use with --routes-version to compare a specific version.",shorthand:null,type:Boolean,deprecated:!1},{name:"expand",description:"Show expanded details for each route",shorthand:null,deprecatedShorthand:"e",type:Boolean,deprecated:!1}],examples:[{name:"List all routes",value:`${packageName} routes list`},{name:"Search for routes",value:`${packageName} routes list --query "api"`},{name:"Filter by type",value:`${packageName} routes list --type rewrite`},{name:"Show staged changes",value:`${packageName} routes list --diff`},{name:"Show live production routes",value:`${packageName} routes list --production`},{name:"Show expanded details",value:`${packageName} routes list --expand`}]},listVersionsSubcommand={name:"list-versions",aliases:["ls-versions"],description:"List all versions of routing rules",arguments:[],options:[projectOption,jsonOption,{...limitOption,description:"Number of versions to fetch (default: 20, max: 100)"},{name:"count",description:"Deprecated alias for `--limit`",shorthand:null,type:Number,argument:"NUMBER",deprecated:!0}],examples:[{name:"List route versions",value:`${packageName} routes list-versions`},{name:"List more versions",value:`${packageName} routes list-versions --limit 50`}]},inspectSubcommand={name:"inspect",aliases:[],description:"Show detailed information about a specific route",arguments:[{name:"name-or-id",required:!0}],options:[projectOption,jsonOption,{name:"diff",description:"Compare staged changes against production for this route",shorthand:null,type:Boolean,deprecated:!1}],examples:[{name:"Inspect a route by name",value:`${packageName} routes inspect "API rewrite"`},{name:"Inspect a route by ID",value:`${packageName} routes inspect abc123`},{name:"Show staged changes for a route",value:`${packageName} routes inspect "My route" --diff`}]},addSubcommand={name:"add",aliases:[],description:"Add a new routing rule to the project",arguments:[{name:"name",required:!1}],options:[projectOption,{name:"src",description:"Path pattern (required in non-interactive mode)",shorthand:null,type:String,argument:"PATTERN",deprecated:!1},{name:"src-syntax",description:"Path syntax: regex, path-to-regexp, equals (default: regex)",shorthand:null,type:String,argument:"TYPE",deprecated:!1},{name:"action",description:"Action type: rewrite, redirect, or set-status (required with --dest/--status)",shorthand:null,type:String,argument:"TYPE",deprecated:!1},{name:"dest",description:"Destination URL for rewrite or redirect",shorthand:null,type:String,argument:"URL",deprecated:!1},{name:"status",description:"Status code (301/302/307/308 for redirect, or any for set-status)",shorthand:null,type:Number,argument:"CODE",deprecated:!1},{name:"set-response-header",description:"Set response header: key=value (repeatable)",shorthand:null,type:[String],argument:"HEADER",deprecated:!1},{name:"append-response-header",description:"Append to response header: key=value (repeatable)",shorthand:null,type:[String],argument:"HEADER",deprecated:!1},{name:"delete-response-header",description:"Delete response header: key (repeatable)",shorthand:null,type:[String],argument:"KEY",deprecated:!1},{name:"set-request-header",description:"Set request header: key=value (repeatable)",shorthand:null,type:[String],argument:"HEADER",deprecated:!1},{name:"append-request-header",description:"Append to request header: key=value (repeatable)",shorthand:null,type:[String],argument:"HEADER",deprecated:!1},{name:"delete-request-header",description:"Delete request header: key (repeatable)",shorthand:null,type:[String],argument:"KEY",deprecated:!1},{name:"set-request-query",description:"Set query parameter: key=value (repeatable)",shorthand:null,type:[String],argument:"PARAM",deprecated:!1},{name:"append-request-query",description:"Append to query parameter: key=value (repeatable)",shorthand:null,type:[String],argument:"PARAM",deprecated:!1},{name:"delete-request-query",description:"Delete query parameter: key (repeatable)",shorthand:null,type:[String],argument:"KEY",deprecated:!1},{name:"has",description:"Condition that must match: type:key or type:key:value (repeatable)",shorthand:null,type:[String],argument:"CONDITION",deprecated:!1},{name:"missing",description:'"Does not have" condition: type:key or type:key:value (repeatable)',shorthand:null,type:[String],argument:"CONDITION",deprecated:!1},{name:"description",description:"Route description (max 1024 chars)",shorthand:null,type:String,argument:"TEXT",deprecated:!1},{name:"no-enable",description:"Add the route turned off (default: on)",shorthand:null,type:Boolean,deprecated:!1},{name:"disabled",description:"Deprecated alias for `--no-enable`",shorthand:null,type:Boolean,deprecated:!0},{name:"ai",description:"Generate route from a natural language description (AI-powered)",shorthand:null,type:String,argument:"PROMPT",deprecated:!1},{name:"position",description:"Position: start, end, after:<id>, before:<id>",shorthand:null,type:String,argument:"POSITION",deprecated:!1},{name:"yes",description:"Skip confirmation prompts",shorthand:"y",type:Boolean,deprecated:!1}],examples:[{name:"Interactive mode",value:`${packageName} routes add`},{name:"Create with AI",value:`${packageName} routes add --ai "Rewrite /api/* to https://backend.internal/*"`},{name:"Add a rewrite",value:`${packageName} routes add "API Proxy" --src "/api/:path*" --src-syntax path-to-regexp --action rewrite --dest "https://api.example.com/:path*" --yes`},{name:"Add a redirect",value:`${packageName} routes add "Old Blog" --src "/blog" --src-syntax equals --action redirect --dest "/articles" --status 301 --yes`},{name:"Add CORS headers",value:`${packageName} routes add "CORS" --src "^/api/.*$" --set-response-header "Access-Control-Allow-Origin=*" --yes`},{name:"Block access (set status)",value:`${packageName} routes add "Block Admin" --src "^/admin/.*$" --action set-status --status 403 --yes`},{name:"Conditional redirect",value:`${packageName} routes add "Auth Required" --src "/protected/:path*" --src-syntax path-to-regexp --action redirect --dest "/login" --status 307 --missing "cookie:session" --yes`},{name:"Rewrite with request headers",value:`${packageName} routes add "Backend Proxy" --src "/backend/:path*" --src-syntax path-to-regexp --action rewrite --dest "https://internal.example.com/:path*" --set-request-header "X-Forwarded-Host=myapp.com" --yes`},{name:"Add route at start",value:`${packageName} routes add "Priority Route" --src "/priority" --src-syntax equals --action rewrite --dest "/handler" --position start --yes`}]},publishSubcommand={name:"publish",aliases:[],description:"Publish all staged routing changes to production",arguments:[],options:[projectOption,{...yesOption,description:"Skip the confirmation prompt when publishing"}],examples:[{name:"Publish staged changes",value:`${packageName} routes publish`},{name:"Publish without confirmation",value:`${packageName} routes publish --yes`}]},restoreSubcommand={name:"restore",aliases:[],description:"Restore a previous routing version to production",arguments:[{name:"version-id",required:!0}],options:[projectOption,{...yesOption,description:"Skip the confirmation prompt when restoring"}],examples:[{name:"Restore a previous version",placeholders:["<version-id>"],value:`${packageName} routes restore <version-id>`},{name:"Restore without confirmation",placeholders:["<version-id>"],value:`${packageName} routes restore <version-id> --yes`}]},discardSubcommand={name:"discard-staging",aliases:[],description:"Discard staged routing changes",arguments:[],options:[projectOption,{...yesOption,description:"Skip the confirmation prompt when discarding"}],examples:[{name:"Discard staged changes",value:`${packageName} routes discard-staging`},{name:"Discard without confirmation",value:`${packageName} routes discard-staging --yes`}]},deleteSubcommand={name:"remove",aliases:["rm","delete"],description:"Remove one or more routing rules",arguments:[{name:"name-or-id",required:!0,multiple:!0}],options:[projectOption,{...yesOption,description:"Skip the confirmation prompt when removing"}],examples:[{name:"Remove a route by name",value:`${packageName} routes remove "Old Redirect"`},{name:"Remove a route by ID",value:`${packageName} routes remove abc123`},{name:"Remove multiple routes",value:`${packageName} routes remove "Route A" "Route B"`},{name:"Remove without confirmation",value:`${packageName} routes remove "Old Route" --yes`}]},enableSubcommand={name:"enable",aliases:[],description:"Enable a disabled routing rule",arguments:[{name:"name-or-id",required:!0}],options:[projectOption],examples:[{name:"Enable a route by name",value:`${packageName} routes enable "API Proxy"`},{name:"Enable a route by ID",value:`${packageName} routes enable abc123`}]},disableSubcommand={name:"disable",aliases:[],description:"Disable a routing rule without deleting it",arguments:[{name:"name-or-id",required:!0}],options:[projectOption],examples:[{name:"Disable a route by name",value:`${packageName} routes disable "API Proxy"`},{name:"Disable a route by ID",value:`${packageName} routes disable abc123`}]},reorderSubcommand={name:"move",aliases:["reorder"],description:"Move a routing rule to a different position",arguments:[{name:"name-or-id",required:!0}],options:[projectOption,{name:"position",description:"Target position: start, end, a number (1-based), before:<id>, after:<id>",shorthand:null,type:String,argument:"POSITION",deprecated:!1},{name:"first",description:"Move to the first position (highest priority)",shorthand:null,type:Boolean,deprecated:!1},{name:"last",description:"Move to the last position (lowest priority)",shorthand:null,type:Boolean,deprecated:!1},{...yesOption,description:"Skip the confirmation prompt when moving"}],examples:[{name:"Move to first position",value:`${packageName} routes move "Catch All" --first`},{name:"Move to last position",value:`${packageName} routes move "Catch All" --last`},{name:"Move to a specific position",value:`${packageName} routes move "API Proxy" --position 3`},{name:"Move after another route",value:`${packageName} routes move "API Proxy" --position after:route-id-123`},{name:"Interactive move (prompts for position)",value:`${packageName} routes move "API Proxy"`}]},editSubcommand={name:"update",aliases:["edit"],description:"Update an existing routing rule",arguments:[{name:"name-or-id",required:!0}],options:[projectOption,{name:"name",description:"Change route name",shorthand:null,type:String,argument:"NAME",deprecated:!1},{name:"description",description:'Change description (use "" to clear)',shorthand:null,type:String,argument:"TEXT",deprecated:!1},{name:"src",description:"Change source path pattern",shorthand:null,type:String,argument:"PATTERN",deprecated:!1},{name:"src-syntax",description:"Change path syntax: regex, path-to-regexp, equals",shorthand:null,type:String,argument:"TYPE",deprecated:!1},{name:"action",description:"Set action type: rewrite, redirect, or set-status (required when switching types)",shorthand:null,type:String,argument:"TYPE",deprecated:!1},{name:"dest",description:"Set destination URL",shorthand:null,type:String,argument:"URL",deprecated:!1},{name:"status",description:"Set status code",shorthand:null,type:Number,argument:"CODE",deprecated:!1},{name:"no-dest",description:"Remove destination",shorthand:null,type:Boolean,deprecated:!1},{name:"no-status",description:"Remove status code",shorthand:null,type:Boolean,deprecated:!1},{name:"set-response-header",description:"Set response header: key=value (repeatable)",shorthand:null,type:[String],argument:"HEADER",deprecated:!1},{name:"append-response-header",description:"Append to response header: key=value (repeatable)",shorthand:null,type:[String],argument:"HEADER",deprecated:!1},{name:"delete-response-header",description:"Delete response header: key (repeatable)",shorthand:null,type:[String],argument:"KEY",deprecated:!1},{name:"set-request-header",description:"Set request header: key=value (repeatable)",shorthand:null,type:[String],argument:"HEADER",deprecated:!1},{name:"append-request-header",description:"Append to request header: key=value (repeatable)",shorthand:null,type:[String],argument:"HEADER",deprecated:!1},{name:"delete-request-header",description:"Delete request header: key (repeatable)",shorthand:null,type:[String],argument:"KEY",deprecated:!1},{name:"set-request-query",description:"Set query parameter: key=value (repeatable)",shorthand:null,type:[String],argument:"PARAM",deprecated:!1},{name:"append-request-query",description:"Append to query parameter: key=value (repeatable)",shorthand:null,type:[String],argument:"PARAM",deprecated:!1},{name:"delete-request-query",description:"Delete query parameter: key (repeatable)",shorthand:null,type:[String],argument:"KEY",deprecated:!1},{name:"has",description:"Add a has condition: type:key or type:key:value (repeatable)",shorthand:null,type:[String],argument:"CONDITION",deprecated:!1},{name:"missing",description:'Add a "does not have" condition: type:key or type:key:value (repeatable)',shorthand:null,type:[String],argument:"CONDITION",deprecated:!1},{name:"clear-conditions",description:"Remove all has/does-not-have conditions",shorthand:null,type:Boolean,deprecated:!1},{name:"clear-headers",description:"Remove all response headers",shorthand:null,type:Boolean,deprecated:!1},{name:"clear-transforms",description:"Remove all transforms (request headers, request query)",shorthand:null,type:Boolean,deprecated:!1},{name:"ai",description:"Describe changes using natural language (AI-powered)",shorthand:null,type:String,argument:"PROMPT",deprecated:!1},{...yesOption,description:"Skip confirmation prompts"}],examples:[{name:"Interactive mode",value:`${packageName} routes update "API Proxy"`},{name:"Update with AI",value:`${packageName} routes update "API Proxy" --ai "Add CORS headers and change status to 308"`},{name:"Change destination",value:`${packageName} routes update "API Proxy" --dest "https://new-api.example.com/:path*"`},{name:"Switch to redirect",value:`${packageName} routes update "Old Route" --action redirect --dest "/new" --status 301`},{name:"Add a response header",value:`${packageName} routes update "My Route" --set-response-header "Cache-Control=public, max-age=3600"`},{name:"Clear all conditions and add new ones",value:`${packageName} routes update "My Route" --clear-conditions --has "header:Authorization"`}]},exportSubcommand={name:"export",aliases:[],description:"Export routes to a vercel.json or vercel.ts file",arguments:[{name:"name-or-id",required:!1}],options:[projectOption,{name:"output",description:"Output file format: .json or .ts (default: .json)",shorthand:"o",type:String,argument:"json|ts",deprecated:!1}],examples:[{name:"Export as vercel.json format",value:`${packageName} routes export`},{name:"Export as vercel.ts format",value:`${packageName} routes export --output ts`},{name:"Export a specific route",value:`${packageName} routes export "API Proxy"`},{name:"Export to a file",value:`${packageName} routes export > routes.json`}]},routesCommand={name:"routes",aliases:[],description:"Manage routing rules for a project. Routes managed at the project level apply to all deployments and environments.",arguments:[],subcommands:[listSubcommand,listVersionsSubcommand,inspectSubcommand,addSubcommand,editSubcommand,deleteSubcommand,enableSubcommand,disableSubcommand,reorderSubcommand,exportSubcommand,publishSubcommand,restoreSubcommand,discardSubcommand],options:[],examples:[]};export{listSubcommand,listVersionsSubcommand,inspectSubcommand,addSubcommand,publishSubcommand,restoreSubcommand,discardSubcommand,deleteSubcommand,enableSubcommand,disableSubcommand,reorderSubcommand,editSubcommand,exportSubcommand,routesCommand};
@@ -4,6 +4,6 @@ import { dirname as __dirname_ } from 'node:path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  const __filename = __fileURLToPath(import.meta.url);
6
6
  const __dirname = __dirname_(__filename);
7
- import{require_figures}from"./chunk-JUAHDOL6.js";import{Separator,ValidationError,createPrompt,isBackspaceKey,isDownKey,isEnterKey,isNumberKey,isUpKey,makeTheme,require_source,useKeypress,useMemo,usePagination,usePrefix,useRef,useState}from"./chunk-UI2H2EIM.js";import{require_ansi_escapes}from"./chunk-YHPPP3SF.js";import{__toESM}from"./chunk-BZENIQ7N.js";var import_chalk=__toESM(require_source(),1),import_figures=__toESM(require_figures(),1),import_ansi_escapes=__toESM(require_ansi_escapes(),1),selectTheme={icon:{cursor:import_figures.default.pointer},style:{disabled:text=>import_chalk.default.dim(`- ${text}`)}};function isSelectable(item){return!Separator.isSeparator(item)&&!item.disabled}var esm_default=createPrompt((config,done)=>{let{choices:items,loop=!0,pageSize=7}=config,firstRender=useRef(!0),theme=makeTheme(selectTheme,config.theme),prefix=usePrefix({theme}),[status,setStatus]=useState("pending"),searchTimeoutRef=useRef(void 0),bounds=useMemo(()=>{let first=items.findIndex(isSelectable),last=items.length-1-[...items].reverse().findIndex(isSelectable);if(first<0)throw new ValidationError("[select prompt] No selectable choices. All choices are disabled.");return{first,last}},[items]),defaultItemIndex=useMemo(()=>"default"in config?items.findIndex(item=>isSelectable(item)&&item.value===config.default):-1,[config.default,items]),[active,setActive]=useState(defaultItemIndex===-1?bounds.first:defaultItemIndex),selectedChoice=items[active];useKeypress((key,rl)=>{if(clearTimeout(searchTimeoutRef.current),isEnterKey(key))setStatus("done"),done(selectedChoice.value);else if(isUpKey(key)||isDownKey(key)){if(rl.clearLine(0),loop||isUpKey(key)&&active!==bounds.first||isDownKey(key)&&active!==bounds.last){let offset=isUpKey(key)?-1:1,next=active;do next=(next+offset+items.length)%items.length;while(!isSelectable(items[next]));setActive(next)}}else if(isNumberKey(key)){rl.clearLine(0);let position=Number(key.name)-1,item=items[position];item!=null&&isSelectable(item)&&setActive(position)}else if(isBackspaceKey(key))rl.clearLine(0);else{let searchTerm=rl.line.toLowerCase(),matchIndex=items.findIndex(item=>Separator.isSeparator(item)||!isSelectable(item)?!1:String(item.name||item.value).toLowerCase().startsWith(searchTerm));matchIndex>=0&&setActive(matchIndex),searchTimeoutRef.current=setTimeout(()=>{rl.clearLine(0)},700)}});let message=theme.style.message(config.message),helpTip;firstRender.current&&items.length<=pageSize&&(firstRender.current=!1,helpTip=theme.style.help("(Use arrow keys)"));let page=usePagination({items,active,renderItem({item,isActive}){if(Separator.isSeparator(item))return` ${item.separator}`;let line=item.name||item.value;if(item.disabled){let disabledLabel=typeof item.disabled=="string"?item.disabled:"(disabled)";return theme.style.disabled(`${line} ${disabledLabel}`)}let color=isActive?theme.style.highlight:x=>x,cursor=isActive?theme.icon.cursor:" ";return color(`${cursor} ${line}`)},pageSize,loop,theme});if(status==="done"){let answer=selectedChoice.name||String(selectedChoice.value);return`${prefix} ${message} ${theme.style.answer(answer)}`}let choiceDescription=selectedChoice.description?`
7
+ import{require_figures}from"./chunk-JUAHDOL6.js";import{Separator,ValidationError,createPrompt,isBackspaceKey,isDownKey,isEnterKey,isNumberKey,isUpKey,makeTheme,require_source,useKeypress,useMemo,usePagination,usePrefix,useRef,useState}from"./chunk-YTRKHRL3.js";import{require_ansi_escapes}from"./chunk-YHPPP3SF.js";import{__toESM}from"./chunk-BZENIQ7N.js";var import_chalk=__toESM(require_source(),1),import_figures=__toESM(require_figures(),1),import_ansi_escapes=__toESM(require_ansi_escapes(),1),selectTheme={icon:{cursor:import_figures.default.pointer},style:{disabled:text=>import_chalk.default.dim(`- ${text}`)}};function isSelectable(item){return!Separator.isSeparator(item)&&!item.disabled}var esm_default=createPrompt((config,done)=>{let{choices:items,loop=!0,pageSize=7}=config,firstRender=useRef(!0),theme=makeTheme(selectTheme,config.theme),prefix=usePrefix({theme}),[status,setStatus]=useState("pending"),searchTimeoutRef=useRef(void 0),bounds=useMemo(()=>{let first=items.findIndex(isSelectable),last=items.length-1-[...items].reverse().findIndex(isSelectable);if(first<0)throw new ValidationError("[select prompt] No selectable choices. All choices are disabled.");return{first,last}},[items]),defaultItemIndex=useMemo(()=>"default"in config?items.findIndex(item=>isSelectable(item)&&item.value===config.default):-1,[config.default,items]),[active,setActive]=useState(defaultItemIndex===-1?bounds.first:defaultItemIndex),selectedChoice=items[active];useKeypress((key,rl)=>{if(clearTimeout(searchTimeoutRef.current),isEnterKey(key))setStatus("done"),done(selectedChoice.value);else if(isUpKey(key)||isDownKey(key)){if(rl.clearLine(0),loop||isUpKey(key)&&active!==bounds.first||isDownKey(key)&&active!==bounds.last){let offset=isUpKey(key)?-1:1,next=active;do next=(next+offset+items.length)%items.length;while(!isSelectable(items[next]));setActive(next)}}else if(isNumberKey(key)){rl.clearLine(0);let position=Number(key.name)-1,item=items[position];item!=null&&isSelectable(item)&&setActive(position)}else if(isBackspaceKey(key))rl.clearLine(0);else{let searchTerm=rl.line.toLowerCase(),matchIndex=items.findIndex(item=>Separator.isSeparator(item)||!isSelectable(item)?!1:String(item.name||item.value).toLowerCase().startsWith(searchTerm));matchIndex>=0&&setActive(matchIndex),searchTimeoutRef.current=setTimeout(()=>{rl.clearLine(0)},700)}});let message=theme.style.message(config.message),helpTip;firstRender.current&&items.length<=pageSize&&(firstRender.current=!1,helpTip=theme.style.help("(Use arrow keys)"));let page=usePagination({items,active,renderItem({item,isActive}){if(Separator.isSeparator(item))return` ${item.separator}`;let line=item.name||item.value;if(item.disabled){let disabledLabel=typeof item.disabled=="string"?item.disabled:"(disabled)";return theme.style.disabled(`${line} ${disabledLabel}`)}let color=isActive?theme.style.highlight:x=>x,cursor=isActive?theme.icon.cursor:" ";return color(`${cursor} ${line}`)},pageSize,loop,theme});if(status==="done"){let answer=selectedChoice.name||String(selectedChoice.value);return`${prefix} ${message} ${theme.style.answer(answer)}`}let choiceDescription=selectedChoice.description?`
8
8
  ${selectedChoice.description}`:"";return`${[prefix,message,helpTip].filter(Boolean).join(" ")}
9
9
  ${page}${choiceDescription}${import_ansi_escapes.default.cursorHide}`});export{esm_default};
@@ -0,0 +1,7 @@
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{emitAlertsScopeError,resolveAlertsScope}from"./chunk-AYT5GPAY.js";import{handleValidationError,validateAllProjectMutualExclusivity}from"./chunk-7PGDJTAH.js";import{getScope}from"./chunk-ZGB2RHJO.js";import{AGENT_REASON,buildCommandWithGlobalFlags,outputAgentError}from"./chunk-GORL5DZC.js";import{getProjectByNameOrId}from"./chunk-TFTF3C3G.js";import{ProjectNotFound,isAPIError}from"./chunk-GOI2VVI7.js";async function resolveRulesTeam(client,jsonOutput){let scope;try{scope=await getScope(client,{resolveLocalScope:!0})}catch(err){if(isAPIError(err)&&(err.status===403||err.status===404))return emitAlertsScopeError(client,jsonOutput,err.code||"API_ERROR",err.serverMessage||`API error (${err.status}).`,{reason:AGENT_REASON.MISSING_SCOPE,hint:"The selected team could not be loaded. Select a team you can access, or pass --scope <team-slug>.",next:[{command:buildCommandWithGlobalFlags(client.argv,"teams switch"),when:"Select a team"},{command:buildCommandWithGlobalFlags(client.argv,"whoami"),when:"Inspect the current scope"}]});throw err}let{team}=scope;return team?{teamId:team.id}:emitAlertsScopeError(client,jsonOutput,"NO_TEAM","No team context found. Run `vercel switch` to select a team, use `--scope <team>`, or link a team project.",{reason:AGENT_REASON.MISSING_SCOPE,hint:"Monitors belong to a team. Select the team before retrying.",next:[{command:buildCommandWithGlobalFlags(client.argv,"teams switch"),when:"Select a team"},{command:buildCommandWithGlobalFlags(client.argv,"whoami"),when:"Inspect the current scope"}]})}async function resolveRulesProject(client,projectNameOrId,jsonOutput,command){let teamScope=await resolveRulesTeam(client,jsonOutput);if(typeof teamScope=="number")return teamScope;try{let project=await getProjectByNameOrId(client,projectNameOrId,teamScope.teamId);return project instanceof ProjectNotFound?emitAlertsScopeError(client,jsonOutput,"PROJECT_NOT_FOUND",`Project "${projectNameOrId}" was not found in the selected team.`,{reason:AGENT_REASON.NOT_FOUND,next:[{command:buildCommandWithGlobalFlags(client.argv,`${command} --project <name_or_id>`),when:"Retry with a valid project"}]}):{...teamScope,projectId:project.id,projectName:project.name}}catch(error){if(!isAPIError(error))throw error;return emitAlertsScopeError(client,jsonOutput,error.code||"API_ERROR",error.serverMessage||`API error (${error.status}).`,{reason:error.status===401?"not_authorized":error.status===403?"forbidden":AGENT_REASON.API_ERROR})}}async function parseRulesFlagsAndScope(client,flags,jsonOutput,command="monitors ls"){let mutual=validateAllProjectMutualExclusivity(flags["--all"],flags["--project"]);if(!mutual.valid)return outputAgentError(client,{status:"error",reason:AGENT_REASON.INVALID_ARGUMENTS,message:mutual.message,next:[{command:buildCommandWithGlobalFlags(client.argv,"monitors --help"),when:"Use either `--project` or `--all`, not both"}]},2),handleValidationError(mutual,jsonOutput,client);if(flags["--all"])return resolveRulesTeam(client,jsonOutput);if(flags["--project"])return resolveRulesProject(client,flags["--project"],jsonOutput,command);let linkedScope=await resolveAlertsScope(client,{jsonOutput,command});if(typeof linkedScope=="number")return linkedScope;let teamScope=await resolveRulesTeam(client,jsonOutput);return typeof teamScope=="number"?teamScope:linkedScope.teamId===teamScope.teamId?linkedScope:teamScope}export{resolveRulesTeam,resolveRulesProject,parseRulesFlagsAndScope};
@@ -4,4 +4,4 @@ import { dirname as __dirname_ } from 'node:path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  const __filename = __fileURLToPath(import.meta.url);
6
6
  const __dirname = __dirname_(__filename);
7
- import{packageName}from"./chunk-VRH7LWOC.js";import{formatOption,jsonOption,limitOption,nextCursorOption,sinceOption,untilOption,yesOption}from"./chunk-AMPJ6RWT.js";var inspectSubcommand={name:"inspect",aliases:["overview"],description:"Show this cycle's on-demand spend against Spend Management",arguments:[],options:[formatOption,jsonOption],examples:[{name:"Show this cycle's on-demand spend against Spend Management",value:`${packageName} billing budgets inspect`}]},listSubcommand={name:"list",aliases:["ls"],description:"List every Spend Management budget on this team, of any scope",default:!0,arguments:[],options:[formatOption,jsonOption],examples:[{name:"List Spend Management budgets",value:`${packageName} billing budgets`}]},setSubcommand={name:"set",aliases:["update"],description:"Create or update this team's Spend Management budget",arguments:[],options:[{name:"amount",shorthand:null,type:Number,argument:"USD",deprecated:!1,description:"Budget amount in whole dollars (minimum 1). Creates with 50/75/100% alerts and notifications on; updates keep pause and webhook settings unless those options are also passed"},{name:"pause",shorthand:null,type:Boolean,deprecated:!1,description:"Pause all projects and production deployments at 100% of the budget amount"},{name:"no-pause",shorthand:null,type:Boolean,deprecated:!1,description:"Do not pause all projects or their production deployments when the budget is reached"},{name:"webhook",shorthand:null,type:String,argument:"URL",deprecated:!1,description:"Webhook URL to notify when a threshold is reached"},{name:"no-webhook",shorthand:null,type:Boolean,deprecated:!1,description:"Remove the budget webhook"},formatOption,jsonOption],examples:[{name:"Create a $500 budget with default 50/75/100% alerts",value:`${packageName} billing budgets set --amount 500`},{name:"Change the budget amount",value:`${packageName} billing budgets set --amount 800`},{name:"Pause all projects and production deployments at 100% of the existing budget",value:`${packageName} billing budgets set --pause`},{name:"Notify a webhook without changing the amount",value:`${packageName} billing budgets set --webhook https://example.com/hook`},{name:"Remove the webhook",value:`${packageName} billing budgets set --no-webhook`}]},removeSubcommand={name:"remove",aliases:["rm","delete","disable"],description:"Remove this team's Spend Management budget",arguments:[],options:[yesOption,formatOption,jsonOption],examples:[{name:"Remove the Spend Management budget without confirmation",value:`${packageName} billing budgets remove --yes`}]},alertsDescription="List Spend Management alerts: each budget threshold reached, newest first. For observability alerts, see `vercel alerts`.",alertsOptions=[{...sinceOption,description:"Show alerts triggered after this time (ISO 8601 or relative: 1d, 7d, 30d)"},{...untilOption,description:"Show alerts triggered before this time (ISO 8601 or relative)"},limitOption,nextCursorOption,formatOption,jsonOption],alertsListSubcommand={name:"list",aliases:["ls"],description:alertsDescription,default:!0,hidden:!0,arguments:[],options:alertsOptions,examples:[]},alertsSubcommand={name:"alerts",aliases:[],description:alertsDescription,arguments:[],subcommands:[alertsListSubcommand],options:alertsOptions,examples:[{name:"List recent Spend Management alerts for this team",value:`${packageName} billing budgets alerts`},{name:"List alerts from the last 30 days",value:`${packageName} billing budgets alerts --since 30d`},{name:"Output alerts as JSON",value:`${packageName} billing budgets alerts --json`}]},budgetCommand={name:"budgets",aliases:["budget"],summary:"Manage spending beyond included credit",description:"Show and manage Spend Management for on-demand charges after included credit",arguments:[],subcommands:[inspectSubcommand,listSubcommand,setSubcommand,removeSubcommand,alertsSubcommand],options:[],examples:[{name:"List Spend Management budgets",value:`${packageName} billing budgets`},{name:"Show this cycle's on-demand spend against Spend Management",value:`${packageName} billing budgets inspect`},{name:"Set a $500 budget that pauses all projects and production deployments at 100%",value:`${packageName} billing budgets set --amount 500 --pause`},{name:"Pause all projects and production deployments at 100% of the existing budget",value:`${packageName} billing budgets set --pause`},{name:"Remove the Spend Management budget",value:`${packageName} billing budgets remove --yes`},{name:"List recent Spend Management alerts",value:`${packageName} billing budgets alerts`}]},DEPRECATED_BUDGET_ACTIONS={overview:"inspect",update:"set",delete:"remove",disable:"remove"};export{inspectSubcommand,listSubcommand,setSubcommand,removeSubcommand,alertsListSubcommand,alertsSubcommand,budgetCommand,DEPRECATED_BUDGET_ACTIONS};
7
+ import{packageName}from"./chunk-B4KA3ZH2.js";import{formatOption,jsonOption,limitOption,nextCursorOption,sinceOption,untilOption,yesOption}from"./chunk-EZVNGJN5.js";var inspectSubcommand={name:"inspect",aliases:["overview"],description:"Show this cycle's on-demand spend against Spend Management",arguments:[],options:[formatOption,jsonOption],examples:[{name:"Show this cycle's on-demand spend against Spend Management",value:`${packageName} billing budgets inspect`}]},listSubcommand={name:"list",aliases:["ls"],description:"List every Spend Management budget on this team, of any scope",default:!0,arguments:[],options:[formatOption,jsonOption],examples:[{name:"List Spend Management budgets",value:`${packageName} billing budgets`}]},setSubcommand={name:"set",aliases:["update"],description:"Create or update this team's Spend Management budget",arguments:[],options:[{name:"amount",shorthand:null,type:Number,argument:"USD",deprecated:!1,description:"Budget amount in whole dollars (minimum 1). Creates with 50/75/100% alerts and notifications on; updates keep pause and webhook settings unless those options are also passed"},{name:"pause",shorthand:null,type:Boolean,deprecated:!1,description:"Pause all projects and production deployments at 100% of the budget amount"},{name:"no-pause",shorthand:null,type:Boolean,deprecated:!1,description:"Do not pause all projects or their production deployments when the budget is reached"},{name:"webhook",shorthand:null,type:String,argument:"URL",deprecated:!1,description:"Webhook URL to notify when a threshold is reached"},{name:"no-webhook",shorthand:null,type:Boolean,deprecated:!1,description:"Remove the budget webhook"},formatOption,jsonOption],examples:[{name:"Create a $500 budget with default 50/75/100% alerts",value:`${packageName} billing budgets set --amount 500`},{name:"Change the budget amount",value:`${packageName} billing budgets set --amount 800`},{name:"Pause all projects and production deployments at 100% of the existing budget",value:`${packageName} billing budgets set --pause`},{name:"Notify a webhook without changing the amount",value:`${packageName} billing budgets set --webhook https://example.com/hook`},{name:"Remove the webhook",value:`${packageName} billing budgets set --no-webhook`}]},removeSubcommand={name:"remove",aliases:["rm","delete","disable"],description:"Remove this team's Spend Management budget",arguments:[],options:[yesOption,formatOption,jsonOption],examples:[{name:"Remove the Spend Management budget without confirmation",value:`${packageName} billing budgets remove --yes`}]},alertsDescription="List Spend Management alerts: each budget threshold reached, newest first. For observability alerts, see `vercel alerts`.",alertsOptions=[{...sinceOption,description:"Show alerts triggered after this time (ISO 8601 or relative: 1d, 7d, 30d)"},{...untilOption,description:"Show alerts triggered before this time (ISO 8601 or relative)"},limitOption,nextCursorOption,formatOption,jsonOption],alertsListSubcommand={name:"list",aliases:["ls"],description:alertsDescription,default:!0,hidden:!0,arguments:[],options:alertsOptions,examples:[]},alertsSubcommand={name:"alerts",aliases:[],description:alertsDescription,arguments:[],subcommands:[alertsListSubcommand],options:alertsOptions,examples:[{name:"List recent Spend Management alerts for this team",value:`${packageName} billing budgets alerts`},{name:"List alerts from the last 30 days",value:`${packageName} billing budgets alerts --since 30d`},{name:"Output alerts as JSON",value:`${packageName} billing budgets alerts --json`}]},budgetCommand={name:"budgets",aliases:["budget"],summary:"Manage spending beyond included credit",description:"Show and manage Spend Management for on-demand charges after included credit",arguments:[],subcommands:[inspectSubcommand,listSubcommand,setSubcommand,removeSubcommand,alertsSubcommand],options:[],examples:[{name:"List Spend Management budgets",value:`${packageName} billing budgets`},{name:"Show this cycle's on-demand spend against Spend Management",value:`${packageName} billing budgets inspect`},{name:"Set a $500 budget that pauses all projects and production deployments at 100%",value:`${packageName} billing budgets set --amount 500 --pause`},{name:"Pause all projects and production deployments at 100% of the existing budget",value:`${packageName} billing budgets set --pause`},{name:"Remove the Spend Management budget",value:`${packageName} billing budgets remove --yes`},{name:"List recent Spend Management alerts",value:`${packageName} billing budgets alerts`}]},DEPRECATED_BUDGET_ACTIONS={overview:"inspect",update:"set",delete:"remove",disable:"remove"};export{inspectSubcommand,listSubcommand,setSubcommand,removeSubcommand,alertsListSubcommand,alertsSubcommand,budgetCommand,DEPRECATED_BUDGET_ACTIONS};