vercel 59.17.0 → 59.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (220) hide show
  1. package/dist/chunks/add-EM223ILV.js +8 -0
  2. package/dist/chunks/{add-7VKP56JJ.js → add-G5SYPCB4.js} +1 -1
  3. package/dist/chunks/add-SKKI525V.js +8 -0
  4. package/dist/chunks/build-JEZ2ELHZ.js +7 -0
  5. package/dist/chunks/{chunk-JTVVBRW7.js → chunk-2Q47GHFX.js} +1 -1
  6. package/dist/chunks/{chunk-ZB6NNKOB.js → chunk-327GP3PO.js} +1 -1
  7. package/dist/chunks/{chunk-MVAM5QXS.js → chunk-33FG2PIV.js} +1 -1
  8. package/dist/chunks/chunk-4P66SQRS.js +9 -0
  9. package/dist/chunks/{chunk-XSVBYDYI.js → chunk-4VGOAPFY.js} +1 -1
  10. package/dist/chunks/{chunk-3EZENL67.js → chunk-556CXJRE.js} +1 -1
  11. package/dist/chunks/{chunk-QY4UZGLW.js → chunk-5XK67SSI.js} +1 -1
  12. package/dist/chunks/{chunk-V6GSMYQB.js → chunk-5ZIZD5ZG.js} +1 -1
  13. package/dist/chunks/{chunk-AJQZAHAG.js → chunk-6RHRDUSK.js} +1 -1
  14. package/dist/chunks/{chunk-GRNTLNC7.js → chunk-7NYQ7CTP.js} +1 -1
  15. package/dist/chunks/{chunk-HBFPLBTX.js → chunk-7O3KGTQ3.js} +1 -1
  16. package/dist/chunks/{chunk-A5SVOPQK.js → chunk-AGDWVTJV.js} +4 -4
  17. package/dist/chunks/{chunk-HJWWMWLL.js → chunk-AJAO4Q3T.js} +1 -1
  18. package/dist/chunks/{chunk-CKKCHHEZ.js → chunk-B7XCF45C.js} +1 -1
  19. package/dist/chunks/{chunk-CN2QZO4U.js → chunk-BW24TEUN.js} +1 -1
  20. package/dist/chunks/chunk-CJPM2DXZ.js +7 -0
  21. package/dist/chunks/{chunk-OTSU5NS3.js → chunk-CQPIWP7K.js} +1 -1
  22. package/dist/chunks/{chunk-L243RUIR.js → chunk-CWTXZPUV.js} +1 -1
  23. package/dist/chunks/{chunk-YV6CTDHR.js → chunk-DLKR2CG6.js} +1 -1
  24. package/dist/chunks/{chunk-G7Y77DFH.js → chunk-E4CRGS56.js} +1 -1
  25. package/dist/chunks/{chunk-6YAADRQB.js → chunk-EGG7SPNM.js} +1 -1
  26. package/dist/chunks/chunk-F5HAX74T.js +18 -0
  27. package/dist/chunks/{chunk-ZYTGXCXP.js → chunk-FBVWXFCP.js} +1 -1
  28. package/dist/chunks/{chunk-XGWR4HFH.js → chunk-FCC3LYIB.js} +1 -1
  29. package/dist/chunks/{chunk-UVOVAU43.js → chunk-FNYAHJIZ.js} +1 -1
  30. package/dist/chunks/{chunk-O67S7BW6.js → chunk-FUK2JEKI.js} +1 -1
  31. package/dist/chunks/{chunk-UMCKAEPK.js → chunk-GCHDJ44X.js} +1 -1
  32. package/dist/chunks/{chunk-4QX77CP7.js → chunk-GGZODU6S.js} +1 -1
  33. package/dist/chunks/chunk-GI6G3FJJ.js +19 -0
  34. package/dist/chunks/{chunk-EVZRQGNK.js → chunk-GTK7TBLW.js} +1 -1
  35. package/dist/chunks/{chunk-ZZQRMRWD.js → chunk-GWPIATTW.js} +1 -1
  36. package/dist/chunks/{chunk-MPV7JL34.js → chunk-HBF4YJR2.js} +1 -1
  37. package/dist/chunks/chunk-HKKKVW7W.js +8 -0
  38. package/dist/chunks/{chunk-75CPY75D.js → chunk-IERVS47L.js} +1 -1
  39. package/dist/chunks/chunk-IH2HZFLM.js +8 -0
  40. package/dist/chunks/{chunk-5QNKMAN3.js → chunk-IX4MMEGJ.js} +3 -3
  41. package/dist/chunks/{chunk-AB4GEWGP.js → chunk-JB45UWGT.js} +1 -1
  42. package/dist/chunks/{chunk-K3KJZLBD.js → chunk-JDQP267R.js} +1 -1
  43. package/dist/chunks/{chunk-ZJLMBHD6.js → chunk-KU32YRCG.js} +1 -1
  44. package/dist/chunks/{chunk-HEE6XLHF.js → chunk-LASMHNUP.js} +2 -2
  45. package/dist/chunks/{chunk-JYAUUIR4.js → chunk-LZTGSYL3.js} +1 -1
  46. package/dist/chunks/chunk-MBHVWCFE.js +7 -0
  47. package/dist/chunks/{chunk-QMY5EY5M.js → chunk-MIGWUMB3.js} +1 -1
  48. package/dist/chunks/{chunk-KH4SXKLD.js → chunk-NLQNFWX2.js} +1 -1
  49. package/dist/chunks/{chunk-3DRX67W4.js → chunk-OROPHBHW.js} +1 -1
  50. package/dist/chunks/{chunk-QGIGNMII.js → chunk-OWEH7BYO.js} +1 -1
  51. package/dist/chunks/{chunk-ZIPVX7LD.js → chunk-OXH3RM6U.js} +1 -1
  52. package/dist/chunks/{chunk-G6CTAHKY.js → chunk-PIKD5KTH.js} +1 -1
  53. package/dist/chunks/{chunk-EGMJRU5P.js → chunk-PNRWNSM2.js} +1 -1
  54. package/dist/chunks/chunk-Q2Z6EXCT.js +11 -0
  55. package/dist/chunks/{chunk-UZBQDJR7.js → chunk-QYPQGOSO.js} +1 -1
  56. package/dist/chunks/chunk-RIQFJ2MY.js +27 -0
  57. package/dist/chunks/{chunk-Z6Y55QJW.js → chunk-RTRCTYW6.js} +2 -2
  58. package/dist/chunks/{chunk-4NE5IQ25.js → chunk-RVJ2E3BM.js} +1 -1
  59. package/dist/chunks/{chunk-G77VJ754.js → chunk-SPPD6HZ7.js} +1 -1
  60. package/dist/chunks/{chunk-3TXEXPUW.js → chunk-TCS3FDID.js} +1 -1
  61. package/dist/chunks/{chunk-PCFGV4Y7.js → chunk-TEFZFCIF.js} +1 -1
  62. package/dist/chunks/{chunk-WKZ6JSGZ.js → chunk-TKBORMUF.js} +1 -1
  63. package/dist/chunks/{chunk-XQ73QIQ3.js → chunk-U6TAKLJ6.js} +1 -1
  64. package/dist/chunks/{chunk-NUGLE4QY.js → chunk-UED2PPFP.js} +1 -1
  65. package/dist/chunks/{chunk-QIM3U2QM.js → chunk-VDYU5GXV.js} +1 -1
  66. package/dist/chunks/chunk-VOZEB6PD.js +7 -0
  67. package/dist/chunks/{chunk-JSFWLEP3.js → chunk-VRBSHDYH.js} +1 -1
  68. package/dist/chunks/chunk-W2XUH2WW.js +25 -0
  69. package/dist/chunks/chunk-WR5OOWD6.js +10 -0
  70. package/dist/chunks/{chunk-RAIBQIKB.js → chunk-XKNCIFFB.js} +1 -1
  71. package/dist/chunks/chunk-XM3JW6AL.js +7 -0
  72. package/dist/chunks/{chunk-LVWXFCBP.js → chunk-XPTHZQSQ.js} +1 -1
  73. package/dist/chunks/chunk-XPV22OOJ.js +9 -0
  74. package/dist/chunks/{chunk-TJCIHDPZ.js → chunk-XQWBEAKZ.js} +1 -1
  75. package/dist/chunks/{chunk-2B2MN3U5.js → chunk-XV6SDZIO.js} +1 -1
  76. package/dist/chunks/{chunk-6MSXYTO7.js → chunk-XZYKYDQO.js} +1 -1
  77. package/dist/chunks/{chunk-V3N37D4D.js → chunk-Z2LUKMI6.js} +1 -1
  78. package/dist/chunks/{chunk-PQCAYAZ3.js → chunk-ZOI3EEL3.js} +1 -1
  79. package/dist/chunks/chunk-ZRS5X7M2.js +7 -0
  80. package/dist/chunks/{chunk-6RIQPTJA.js → chunk-ZVFZIWBV.js} +1 -1
  81. package/dist/chunks/clear-D6L6DOJX.js +8 -0
  82. package/dist/chunks/{compile-vercel-config-QSK54DR5.js → compile-vercel-config-HTWCKOXQ.js} +1 -1
  83. package/dist/chunks/config-3PKXC765.js +7 -0
  84. package/dist/chunks/config-UC3QD67B.js +8 -0
  85. package/dist/chunks/connect-git-provider-LSTDI4TC.js +7 -0
  86. package/dist/chunks/{constants-G4UYVLOF.js → constants-NCE2LWSS.js} +1 -1
  87. package/dist/chunks/delete-6QE6SZFG.js +9 -0
  88. package/dist/chunks/delete-KIBUBKS5.js +10 -0
  89. package/dist/chunks/{detect-projects-KARO5GUW.js → detect-projects-64MZJZ6M.js} +1 -1
  90. package/dist/chunks/{detect-services-E6YHXKW4.js → detect-services-HCM5D7CD.js} +1 -1
  91. package/dist/chunks/disable-2SIGN57F.js +7 -0
  92. package/dist/chunks/discard-SU4KZRF4.js +14 -0
  93. package/dist/chunks/edit-UPPFWMDP.js +8 -0
  94. package/dist/chunks/edit-XSC7KTWU.js +9 -0
  95. package/dist/chunks/enable-ON2Z35WD.js +7 -0
  96. package/dist/chunks/{exec-4AISDHUV.js → exec-ZLT5KH2Z.js} +1 -1
  97. package/dist/chunks/{export-NHFTH2RG.js → export-4WCA27XL.js} +1 -1
  98. package/dist/chunks/future-LU77KNDL.js +7 -0
  99. package/dist/chunks/{generate-cert-for-deploy-XRP7KJJT.js → generate-cert-for-deploy-UFWA55HF.js} +1 -1
  100. package/dist/chunks/image-OUAKVKKW.js +7 -0
  101. package/dist/chunks/import-builders-GAOM5PLP.js +7 -0
  102. package/dist/chunks/inspect-2U2ZS6BV.js +9 -0
  103. package/dist/chunks/{inspect-2ODMUOBD.js → inspect-CPKV2YRR.js} +1 -1
  104. package/dist/chunks/inspect-HSMBKUSW.js +13 -0
  105. package/dist/chunks/{inspect-BDBUAW64.js → inspect-N3RXYOHT.js} +1 -1
  106. package/dist/chunks/{inspect-PG2FOH2K.js → inspect-VVRA6JZQ.js} +1 -1
  107. package/dist/chunks/list-A7WJ266A.js +11 -0
  108. package/dist/chunks/{list-DPSVL3LB.js → list-EPOTOCMN.js} +1 -1
  109. package/dist/chunks/{list-XTWDVN6W.js → list-XGP6PIS5.js} +1 -1
  110. package/dist/chunks/login-7ALV7XD4.js +9 -0
  111. package/dist/chunks/login-YQ7QPK4A.js +7 -0
  112. package/dist/chunks/{logs-ZMEAEAT2.js → logs-4WPTTXCS.js} +1 -1
  113. package/dist/chunks/{ls-HV6R6EFU.js → ls-62NGKVG2.js} +1 -1
  114. package/dist/chunks/{ls-FGCLFYVB.js → ls-FOS2BGO3.js} +1 -1
  115. package/dist/chunks/{ls-M6LA6GW2.js → ls-FUXVU2FM.js} +1 -1
  116. package/dist/chunks/{ls-ITZ7B6PN.js → ls-L5IRHEBU.js} +1 -1
  117. package/dist/chunks/{ls-AOKYY6S4.js → ls-OGLSDDB5.js} +1 -1
  118. package/dist/chunks/{ls-AD6U4YKQ.js → ls-UDE66BQH.js} +1 -1
  119. package/dist/chunks/{ls-TQCHJ433.js → ls-WLDQKOJX.js} +1 -1
  120. package/dist/chunks/{mutate-ECYH3M3M.js → mutate-TA3QMCKY.js} +1 -1
  121. package/dist/chunks/notifications-4XNZKXKP.js +7 -0
  122. package/dist/chunks/open-G2NKF4KL.js +7 -0
  123. package/dist/chunks/openapi-YEDROCHV.js +7 -0
  124. package/dist/chunks/permissions-35SS45VZ.js +7 -0
  125. package/dist/chunks/prompt-missing-credentials-YVS4S7X2.js +7 -0
  126. package/dist/chunks/publish-LSRQFUBZ.js +15 -0
  127. package/dist/chunks/pull-BOJ3ZTIE.js +7 -0
  128. package/dist/chunks/{purchase-domain-if-available-GLGUG72T.js → purchase-domain-if-available-KEMVAHHF.js} +1 -1
  129. package/dist/chunks/push-FLK45IKR.js +7 -0
  130. package/dist/chunks/{query-CDQJX2Z7.js → query-XP27OAHW.js} +2 -2
  131. package/dist/chunks/reauthenticate-APC7ZYFC.js +7 -0
  132. package/dist/chunks/reorder-F22Q63TM.js +10 -0
  133. package/dist/chunks/reply-CPWRB47S.js +9 -0
  134. package/dist/chunks/resolve-L7Y4FLIS.js +12 -0
  135. package/dist/chunks/restore-FOQ5TF47.js +16 -0
  136. package/dist/chunks/{rm-H3UFGM5B.js → rm-7CH7JXQR.js} +1 -1
  137. package/dist/chunks/rm-IBIBN3TV.js +8 -0
  138. package/dist/chunks/rm-OQL6ZGQM.js +8 -0
  139. package/dist/chunks/rm-PWMT2FES.js +8 -0
  140. package/dist/chunks/{rm-7YF4FPRG.js → rm-QTAD3MMN.js} +1 -1
  141. package/dist/chunks/routes-ZD7XUKLY.js +7 -0
  142. package/dist/chunks/{rule-inspect-QJKXA6GM.js → rule-inspect-SGVM6FEZ.js} +1 -1
  143. package/dist/chunks/rules-MMAVDLJB.js +7 -0
  144. package/dist/chunks/{schema-2OJNI6A5.js → schema-B74HJNER.js} +1 -1
  145. package/dist/chunks/{schema-BIFEX4HY.js → schema-JYYQBTCL.js} +1 -1
  146. package/dist/chunks/select-org-5OUQKTNI.js +7 -0
  147. package/dist/chunks/{set-GYCTXDOC.js → set-6MRJYM56.js} +1 -1
  148. package/dist/chunks/setup-and-link-M6GYPEQY.js +7 -0
  149. package/dist/chunks/tags-SWK66ZCK.js +7 -0
  150. package/dist/chunks/{types-LRXQEDYI.js → types-BTHJ46LC.js} +1 -1
  151. package/dist/chunks/{update-4ZU5XKA2.js → update-UVXYG3Q7.js} +1 -1
  152. package/dist/chunks/{chunk-XFVGX5HG.js → vlt-builder-graph-B4DFIUS6.js} +1 -1
  153. package/dist/commands/build/index.js +1 -1
  154. package/dist/commands/deploy/index.js +6 -6
  155. package/dist/commands/dev/index.js +12 -11
  156. package/dist/commands/env/index.js +1 -1
  157. package/dist/commands/link/index.js +1 -1
  158. package/dist/commands/list/index.js +1 -1
  159. package/dist/commands-bulk.js +605 -574
  160. package/dist/index.js +6 -6
  161. package/dist/version.mjs +1 -1
  162. package/package.json +19 -19
  163. package/dist/chunks/add-EVIN2PRI.js +0 -8
  164. package/dist/chunks/add-KHUJ5BSP.js +0 -8
  165. package/dist/chunks/build-JX4MLRH3.js +0 -7
  166. package/dist/chunks/chunk-3AKI2QN6.js +0 -13
  167. package/dist/chunks/chunk-57GHYR4Y.js +0 -25
  168. package/dist/chunks/chunk-6SLI6JAA.js +0 -8
  169. package/dist/chunks/chunk-HODOBPBQ.js +0 -7
  170. package/dist/chunks/chunk-HTC6KO2B.js +0 -7
  171. package/dist/chunks/chunk-LNPMDXBJ.js +0 -7
  172. package/dist/chunks/chunk-LSBEGBBX.js +0 -9
  173. package/dist/chunks/chunk-NS4FH2TY.js +0 -11
  174. package/dist/chunks/chunk-OMHZEZGJ.js +0 -8
  175. package/dist/chunks/chunk-R2TGGVCT.js +0 -19
  176. package/dist/chunks/chunk-UETTIYUQ.js +0 -8
  177. package/dist/chunks/chunk-WIOGEJOJ.js +0 -9
  178. package/dist/chunks/chunk-YKZLKOOD.js +0 -12
  179. package/dist/chunks/chunk-ZCPBIHDL.js +0 -18
  180. package/dist/chunks/clear-X4OSHTWA.js +0 -8
  181. package/dist/chunks/config-CYB2D7JW.js +0 -8
  182. package/dist/chunks/config-OMS5PWMD.js +0 -7
  183. package/dist/chunks/connect-git-provider-GIU5WZ52.js +0 -7
  184. package/dist/chunks/delete-FGAGJXOB.js +0 -9
  185. package/dist/chunks/delete-VCTCCONO.js +0 -10
  186. package/dist/chunks/disable-HH54G52S.js +0 -7
  187. package/dist/chunks/discard-5WINBWIU.js +0 -14
  188. package/dist/chunks/edit-VRGGDLHE.js +0 -9
  189. package/dist/chunks/edit-XPCNKJWN.js +0 -8
  190. package/dist/chunks/enable-YDUGO5UD.js +0 -7
  191. package/dist/chunks/future-E2FHKPJN.js +0 -7
  192. package/dist/chunks/image-F7YIEOEF.js +0 -7
  193. package/dist/chunks/import-builders-QRQT4S2U.js +0 -7
  194. package/dist/chunks/inspect-3FLLLXNZ.js +0 -9
  195. package/dist/chunks/inspect-IGC2Q4VF.js +0 -13
  196. package/dist/chunks/list-DPLMC7O6.js +0 -11
  197. package/dist/chunks/login-DEAEVUHM.js +0 -7
  198. package/dist/chunks/login-XBBIV5CZ.js +0 -9
  199. package/dist/chunks/native-self-update-KOJVRMHR.js +0 -7
  200. package/dist/chunks/notifications-ZOG67PRF.js +0 -7
  201. package/dist/chunks/open-H6UQKAZ4.js +0 -7
  202. package/dist/chunks/openapi-MO5HYMHR.js +0 -7
  203. package/dist/chunks/permissions-UXSL3L5W.js +0 -7
  204. package/dist/chunks/prompt-missing-credentials-IUHLYSQU.js +0 -7
  205. package/dist/chunks/publish-LVRMJU7C.js +0 -15
  206. package/dist/chunks/pull-N73PO6QD.js +0 -7
  207. package/dist/chunks/push-BR24ODVX.js +0 -7
  208. package/dist/chunks/reauthenticate-SH4XR7NH.js +0 -7
  209. package/dist/chunks/reorder-4CT3NI3X.js +0 -10
  210. package/dist/chunks/reply-6SBUWKEV.js +0 -9
  211. package/dist/chunks/resolve-4YRSE3DN.js +0 -12
  212. package/dist/chunks/restore-HKI7YSAI.js +0 -16
  213. package/dist/chunks/rm-4WGNHC36.js +0 -8
  214. package/dist/chunks/rm-EHWULTJ4.js +0 -8
  215. package/dist/chunks/rm-ZZYVVAWZ.js +0 -8
  216. package/dist/chunks/routes-5DERZV5M.js +0 -7
  217. package/dist/chunks/rules-LG2IKQ7A.js +0 -7
  218. package/dist/chunks/select-org-KSCYSESV.js +0 -7
  219. package/dist/chunks/setup-and-link-FV35BKJV.js +0 -7
  220. package/dist/chunks/tags-C7RMO53H.js +0 -7
@@ -0,0 +1,8 @@
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{emitVcrArgParseError,handleVcrApiError,resolveVcrScope,validateVcrJsonOutput}from"./chunk-TEFZFCIF.js";import{outputError}from"./chunk-ZVFZIWBV.js";import"./chunk-D4MW3RDW.js";import{addSubcommand}from"./chunk-65JYSI26.js";import"./chunk-YMVDWVMO.js";import"./chunk-O7G3CZ42.js";import"./chunk-N3N5UHIL.js";import"./chunk-7O3KGTQ3.js";import"./chunk-2I64AYHG.js";import"./chunk-SOJCELXH.js";import"./chunk-QTKJC2O5.js";import{AGENT_REASON}from"./chunk-ENBTTYJR.js";import"./chunk-MBHVWCFE.js";import"./chunk-5XJNPXQK.js";import{printError}from"./chunk-4P66SQRS.js";import{parseArguments}from"./chunk-ZRS5X7M2.js";import"./chunk-MY4MONOH.js";import"./chunk-AGDWVTJV.js";import"./chunk-F2ZWW2IO.js";import"./chunk-B4ATVYZW.js";import"./chunk-PPCFQQSU.js";import{buildCommandWithGlobalFlags,outputAgentError}from"./chunk-WR5OOWD6.js";import{getFlagsSpecification}from"./chunk-JAJW3P42.js";import"./chunk-4VGOAPFY.js";import"./chunk-GTK7TBLW.js";import"./chunk-VOZEB6PD.js";import{isAPIError}from"./chunk-GI6G3FJJ.js";import{packageName}from"./chunk-FI772UVH.js";import{output_manager_default}from"./chunk-RTRCTYW6.js";import"./chunk-QGIQK47P.js";import"./chunk-BRK4OB4B.js";import"./chunk-AVSPFBLM.js";import"./chunk-XCJDGQO7.js";import"./chunk-YPTLSODC.js";import"./chunk-7HL2RPUO.js";import"./chunk-U7KCDTCH.js";import"./chunk-N3ZZ7FHQ.js";import"./chunk-GU6VIFR5.js";import"./chunk-6L236MNA.js";async function add(client,argv,telemetry){let parsedArgs;try{parsedArgs=parseArguments(argv,getFlagsSpecification(addSubcommand.options))}catch(err){return emitVcrArgParseError(client,err,"vcr add <name> --project <name-or-id>"),printError(err),1}let fr=validateVcrJsonOutput(client,parsedArgs.flags);if(typeof fr=="number")return fr;let name=parsedArgs.args[0],project=parsedArgs.flags["--project"];if(telemetry.trackCliOptionProject(project),telemetry.trackCliOptionFormat(parsedArgs.flags["--format"]),!name)return outputAgentError(client,{status:"error",reason:AGENT_REASON.MISSING_ARGUMENTS,message:`Missing repository name. Example: ${packageName} vcr add <name>`,next:[{command:buildCommandWithGlobalFlags(client.argv,"vcr add <name>"),when:"Replace <name> with the repository name to create"}]},1),outputError(client,fr.jsonOutput,"MISSING_ARGUMENTS","Usage: `vercel vcr add <name>`");let scope=await resolveVcrScope(client,{project,jsonOutput:fr.jsonOutput});if(typeof scope=="number")return scope;let path=`/v1/vcr/repository?teamId=${encodeURIComponent(scope.teamId)}`;output_manager_default.spinner("Creating repository...");try{let created=await client.fetch(path,{method:"POST",body:{projectId:scope.projectId,name}});return fr.jsonOutput?client.stdout.write(`${JSON.stringify(created,null,2)}
8
+ `):output_manager_default.success(`Created repository ${created.repository?.name??name}`),0}catch(err){if(isAPIError(err))return handleVcrApiError(client,err,fr.jsonOutput,{retry:{command:buildCommandWithGlobalFlags(client.argv,"vcr ls"),when:"List existing repositories (a name conflict means it already exists)"}});throw err}finally{output_manager_default.stopSpinner()}}export{add as default};
@@ -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{printRuleMutationReceipt}from"./chunk-G6CTAHKY.js";import{emitRulesArgParseError,getBodyType,handleRulesApiError,outputRulesError,readRuleBody,resolveRulesProject,resolveRulesTeam,rulesCollectionPath}from"./chunk-KH4SXKLD.js";import"./chunk-7PNYOSDU.js";import"./chunk-OTSU5NS3.js";import"./chunk-6PFC3KWQ.js";import"./chunk-GZNDA6SV.js";import"./chunk-WRILLB46.js";import"./chunk-6RIQPTJA.js";import"./chunk-GHAY4PSD.js";import"./chunk-5QNKMAN3.js";import"./chunk-TRTEXGVN.js";import"./chunk-T3GQAMBJ.js";import"./chunk-J3U3L45Y.js";import"./chunk-ZIPVX7LD.js";import"./chunk-PQCAYAZ3.js";import"./chunk-MBL6TXEJ.js";import{validateJsonOutput}from"./chunk-D4MW3RDW.js";import"./chunk-P2O5DOYE.js";import{rulesAddSubcommand}from"./chunk-OAKO6LVS.js";import"./chunk-GHM7V3GG.js";import"./chunk-QR7QPUFN.js";import"./chunk-QTKJC2O5.js";import"./chunk-ENBTTYJR.js";import"./chunk-6TAQ6OWD.js";import"./chunk-WPS6JZF6.js";import"./chunk-NS4FH2TY.js";import"./chunk-HODOBPBQ.js";import"./chunk-RCTYVKM5.js";import{parseArguments}from"./chunk-HTC6KO2B.js";import"./chunk-5XJNPXQK.js";import{printError}from"./chunk-LNPMDXBJ.js";import"./chunk-MY4MONOH.js";import"./chunk-BRK4OB4B.js";import"./chunk-A5SVOPQK.js";import"./chunk-F2ZWW2IO.js";import"./chunk-B4ATVYZW.js";import"./chunk-PPCFQQSU.js";import"./chunk-OSCCYU74.js";import{getFlagsSpecification}from"./chunk-JAJW3P42.js";import"./chunk-XSVBYDYI.js";import"./chunk-EVZRQGNK.js";import{isAPIError}from"./chunk-R2TGGVCT.js";import"./chunk-FI772UVH.js";import"./chunk-XFVGX5HG.js";import{output_manager_default}from"./chunk-Z6Y55QJW.js";import"./chunk-QGIQK47P.js";import"./chunk-AVSPFBLM.js";import"./chunk-XCJDGQO7.js";import"./chunk-YPTLSODC.js";import"./chunk-7HL2RPUO.js";import"./chunk-U7KCDTCH.js";import"./chunk-N3ZZ7FHQ.js";import"./chunk-GU6VIFR5.js";import"./chunk-6L236MNA.js";function applyScopeFlag(client,body,type,scope,flags,jsonOutput){if(Object.hasOwn(body,"ruleScope"))return flags["--project"]||flags["--all"]?outputRulesError(client,jsonOutput,"SCOPE_CONFLICT","Specify rule scope either in the body or with --project/--all, not both."):void 0;if(flags["--project"]){body.ruleScope=type==="custom"?{type:"project",projectId:scope.projectId}:{type:"include",projectIds:[scope.projectId]};return}if(flags["--all"]){if(type==="custom")return outputRulesError(client,jsonOutput,"INVALID_SCOPE","Custom alert rules must target one project. Use --project <name-or-id>.");body.ruleScope={type:"all"};return}return outputRulesError(client,jsonOutput,"MISSING_SCOPE","Missing rule scope. Add ruleScope to the body, or pass --project or --all.")}async function resolveCreateScope(client,flags,jsonOutput){return flags["--project"]&&flags["--all"]?outputRulesError(client,jsonOutput,"MUTUAL_EXCLUSIVITY","Cannot specify both --all and --project. Use one or the other."):flags["--project"]?resolveRulesProject(client,flags["--project"],jsonOutput,"alerts rules add"):resolveRulesTeam(client,jsonOutput)}async function add(client,argv){let parsedArgs;try{parsedArgs=parseArguments(argv,getFlagsSpecification(rulesAddSubcommand.options))}catch(error){return emitRulesArgParseError(client,error,"alerts rules add --project <name-or-id> --body <path>"),printError(error),1}let flags=parsedArgs.flags,format=validateJsonOutput(flags);if(!format.valid)return outputRulesError(client,!1,"INVALID_ARGUMENTS",format.error);if(!flags["--body"])return outputRulesError(client,format.jsonOutput,"MISSING_ARGUMENTS","Missing required flag: --body <PATH>.");let body=readRuleBody(client,flags["--body"],format.jsonOutput);if(typeof body=="number")return body;let type=getBodyType(body);if(!type)return outputRulesError(client,format.jsonOutput,"INVALID_RULE_TYPE","Create body must set a supported rule type.");if(Object.hasOwn(body,"ruleScope")&&(flags["--project"]||flags["--all"]))return outputRulesError(client,format.jsonOutput,"SCOPE_CONFLICT","Specify rule scope either in the body or with --project/--all, not both.");if(type==="custom"&&flags["--all"])return outputRulesError(client,format.jsonOutput,"INVALID_SCOPE","Custom alert rules must target one project. Use --project <name-or-id>.");let scope=await resolveCreateScope(client,flags,format.jsonOutput);if(typeof scope=="number")return scope;let scopeError=applyScopeFlag(client,body,type,scope,flags,format.jsonOutput);if(scopeError!==void 0)return scopeError;output_manager_default.spinner("Creating alert rule\u2026");try{let response=await client.fetch(rulesCollectionPath(scope.teamId),{method:"POST",body});return format.jsonOutput?client.stdout.write(`${JSON.stringify(response,null,2)}
7
+ import{printRuleMutationReceipt}from"./chunk-PIKD5KTH.js";import{emitRulesArgParseError,getBodyType,handleRulesApiError,outputRulesError,readRuleBody,resolveRulesProject,resolveRulesTeam,rulesCollectionPath}from"./chunk-NLQNFWX2.js";import"./chunk-7PNYOSDU.js";import"./chunk-CQPIWP7K.js";import"./chunk-6PFC3KWQ.js";import"./chunk-GZNDA6SV.js";import"./chunk-WRILLB46.js";import"./chunk-ZVFZIWBV.js";import"./chunk-GHAY4PSD.js";import"./chunk-IX4MMEGJ.js";import"./chunk-TRTEXGVN.js";import"./chunk-T3GQAMBJ.js";import"./chunk-J3U3L45Y.js";import"./chunk-OXH3RM6U.js";import"./chunk-ZOI3EEL3.js";import"./chunk-MBL6TXEJ.js";import{validateJsonOutput}from"./chunk-D4MW3RDW.js";import"./chunk-P2O5DOYE.js";import{rulesAddSubcommand}from"./chunk-OAKO6LVS.js";import"./chunk-GHM7V3GG.js";import"./chunk-QR7QPUFN.js";import"./chunk-QTKJC2O5.js";import"./chunk-ENBTTYJR.js";import"./chunk-6TAQ6OWD.js";import"./chunk-WPS6JZF6.js";import"./chunk-MBHVWCFE.js";import"./chunk-RCTYVKM5.js";import"./chunk-5XJNPXQK.js";import{printError}from"./chunk-4P66SQRS.js";import{parseArguments}from"./chunk-ZRS5X7M2.js";import"./chunk-MY4MONOH.js";import"./chunk-AGDWVTJV.js";import"./chunk-F2ZWW2IO.js";import"./chunk-B4ATVYZW.js";import"./chunk-PPCFQQSU.js";import"./chunk-OSCCYU74.js";import"./chunk-WR5OOWD6.js";import{getFlagsSpecification}from"./chunk-JAJW3P42.js";import"./chunk-4VGOAPFY.js";import"./chunk-GTK7TBLW.js";import"./chunk-VOZEB6PD.js";import{isAPIError}from"./chunk-GI6G3FJJ.js";import"./chunk-FI772UVH.js";import{output_manager_default}from"./chunk-RTRCTYW6.js";import"./chunk-QGIQK47P.js";import"./chunk-BRK4OB4B.js";import"./chunk-AVSPFBLM.js";import"./chunk-XCJDGQO7.js";import"./chunk-YPTLSODC.js";import"./chunk-7HL2RPUO.js";import"./chunk-U7KCDTCH.js";import"./chunk-N3ZZ7FHQ.js";import"./chunk-GU6VIFR5.js";import"./chunk-6L236MNA.js";function applyScopeFlag(client,body,type,scope,flags,jsonOutput){if(Object.hasOwn(body,"ruleScope"))return flags["--project"]||flags["--all"]?outputRulesError(client,jsonOutput,"SCOPE_CONFLICT","Specify rule scope either in the body or with --project/--all, not both."):void 0;if(flags["--project"]){body.ruleScope=type==="custom"?{type:"project",projectId:scope.projectId}:{type:"include",projectIds:[scope.projectId]};return}if(flags["--all"]){if(type==="custom")return outputRulesError(client,jsonOutput,"INVALID_SCOPE","Custom alert rules must target one project. Use --project <name-or-id>.");body.ruleScope={type:"all"};return}return outputRulesError(client,jsonOutput,"MISSING_SCOPE","Missing rule scope. Add ruleScope to the body, or pass --project or --all.")}async function resolveCreateScope(client,flags,jsonOutput){return flags["--project"]&&flags["--all"]?outputRulesError(client,jsonOutput,"MUTUAL_EXCLUSIVITY","Cannot specify both --all and --project. Use one or the other."):flags["--project"]?resolveRulesProject(client,flags["--project"],jsonOutput,"alerts rules add"):resolveRulesTeam(client,jsonOutput)}async function add(client,argv){let parsedArgs;try{parsedArgs=parseArguments(argv,getFlagsSpecification(rulesAddSubcommand.options))}catch(error){return emitRulesArgParseError(client,error,"alerts rules add --project <name-or-id> --body <path>"),printError(error),1}let flags=parsedArgs.flags,format=validateJsonOutput(flags);if(!format.valid)return outputRulesError(client,!1,"INVALID_ARGUMENTS",format.error);if(!flags["--body"])return outputRulesError(client,format.jsonOutput,"MISSING_ARGUMENTS","Missing required flag: --body <PATH>.");let body=readRuleBody(client,flags["--body"],format.jsonOutput);if(typeof body=="number")return body;let type=getBodyType(body);if(!type)return outputRulesError(client,format.jsonOutput,"INVALID_RULE_TYPE","Create body must set a supported rule type.");if(Object.hasOwn(body,"ruleScope")&&(flags["--project"]||flags["--all"]))return outputRulesError(client,format.jsonOutput,"SCOPE_CONFLICT","Specify rule scope either in the body or with --project/--all, not both.");if(type==="custom"&&flags["--all"])return outputRulesError(client,format.jsonOutput,"INVALID_SCOPE","Custom alert rules must target one project. Use --project <name-or-id>.");let scope=await resolveCreateScope(client,flags,format.jsonOutput);if(typeof scope=="number")return scope;let scopeError=applyScopeFlag(client,body,type,scope,flags,format.jsonOutput);if(scopeError!==void 0)return scopeError;output_manager_default.spinner("Creating alert rule\u2026");try{let response=await client.fetch(rulesCollectionPath(scope.teamId),{method:"POST",body});return format.jsonOutput?client.stdout.write(`${JSON.stringify(response,null,2)}
8
8
  `):printRuleMutationReceipt("Created",response.rule,client.argv),0}catch(error){if(isAPIError(error))return handleRulesApiError(client,error,format.jsonOutput);throw error}finally{output_manager_default.stopSpinner()}}export{add as default};
@@ -0,0 +1,8 @@
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{parseTeamRefs,require_async_sema,teamRefBody}from"./chunk-S5CEIACD.js";import{repositoryPermissionsPath}from"./chunk-DFVNL5ML.js";import{emitVcrArgParseError,resolveVcrScope,validateVcrJsonOutput}from"./chunk-TEFZFCIF.js";import{outputError}from"./chunk-ZVFZIWBV.js";import"./chunk-D4MW3RDW.js";import{permissionsAddSubcommand}from"./chunk-YMVDWVMO.js";import"./chunk-7O3KGTQ3.js";import"./chunk-2I64AYHG.js";import"./chunk-SOJCELXH.js";import"./chunk-QTKJC2O5.js";import{AGENT_REASON}from"./chunk-ENBTTYJR.js";import"./chunk-MBHVWCFE.js";import"./chunk-5XJNPXQK.js";import{printError}from"./chunk-4P66SQRS.js";import{parseArguments}from"./chunk-ZRS5X7M2.js";import"./chunk-MY4MONOH.js";import"./chunk-AGDWVTJV.js";import"./chunk-F2ZWW2IO.js";import"./chunk-B4ATVYZW.js";import"./chunk-PPCFQQSU.js";import{buildCommandWithGlobalFlags,outputAgentError}from"./chunk-WR5OOWD6.js";import{getFlagsSpecification}from"./chunk-JAJW3P42.js";import"./chunk-4VGOAPFY.js";import"./chunk-GTK7TBLW.js";import"./chunk-VOZEB6PD.js";import{isAPIError}from"./chunk-GI6G3FJJ.js";import{packageName}from"./chunk-FI772UVH.js";import{output_manager_default}from"./chunk-RTRCTYW6.js";import"./chunk-QGIQK47P.js";import"./chunk-BRK4OB4B.js";import"./chunk-AVSPFBLM.js";import"./chunk-XCJDGQO7.js";import"./chunk-YPTLSODC.js";import"./chunk-7HL2RPUO.js";import"./chunk-U7KCDTCH.js";import"./chunk-N3ZZ7FHQ.js";import"./chunk-GU6VIFR5.js";import{__toESM}from"./chunk-6L236MNA.js";var import_async_sema=__toESM(require_async_sema(),1);var USAGE="vcr permissions <repository> add <team>[,<team>...]";async function add(client,argv,telemetry){let parsedArgs;try{parsedArgs=parseArguments(argv,getFlagsSpecification(permissionsAddSubcommand.options))}catch(err){return emitVcrArgParseError(client,err,USAGE),printError(err),1}let fr=validateVcrJsonOutput(client,parsedArgs.flags);if(typeof fr=="number")return fr;let repository=parsedArgs.args[0],teamRefs=parseTeamRefs(parsedArgs.args.slice(2)),project=parsedArgs.flags["--project"];if(telemetry.trackCliOptionProject(project),telemetry.trackCliOptionFormat(parsedArgs.flags["--format"]),teamRefs.length===0)return outputAgentError(client,{status:"error",reason:AGENT_REASON.MISSING_ARGUMENTS,message:`Missing team. Example: ${packageName} vcr permissions ${repository} add team_1a2b3c4d`,next:[{command:buildCommandWithGlobalFlags(client.argv,USAGE),when:"Replace <team> with a team id or slug (comma-separate multiple teams)"}]},1),outputError(client,fr.jsonOutput,"MISSING_ARGUMENTS",`Usage: \`vercel ${USAGE}\``);let scope=await resolveVcrScope(client,{project,jsonOutput:fr.jsonOutput});if(typeof scope=="number")return scope;let path=repositoryPermissionsPath(scope,repository),added=[],failed=[];output_manager_default.spinner(`Sharing ${repository} with ${teamRefs.length===1?teamRefs[0]:`${teamRefs.length} teams`}...`);let sema=new import_async_sema.default(10),results;try{results=await Promise.all(teamRefs.map(async team=>{await sema.acquire();try{let result=await client.fetch(path,{method:"POST",body:teamRefBody(team)});return{ok:!0,team,permission:result.permission}}catch(err){if(!isAPIError(err))throw err;let message=err.serverMessage||`API error (${err.status}).`;return{ok:!1,team,failure:{team,code:err.code||"API_ERROR",message}}}finally{sema.release()}}))}finally{output_manager_default.stopSpinner()}for(let result of results)result.ok?(added.push(result.permission),fr.jsonOutput||output_manager_default.success(`Shared ${repository} with ${result.permission?.teamSlug??result.team}`)):(failed.push(result.failure),fr.jsonOutput||output_manager_default.error(`Failed to share ${repository} with ${result.team}: ${result.failure.message}`));return failed.length>0&&outputAgentError(client,{status:"error",reason:AGENT_REASON.API_ERROR,message:`Failed to share ${repository} with ${failed.map(f=>`${f.team} (${f.message})`).join(", ")}`},1),fr.jsonOutput&&client.stdout.write(`${JSON.stringify({permissions:added,failed},null,2)}
8
+ `),failed.length>0?1:0}export{add as 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{DEFAULT_TAG,buildRepositoryReference,parseNameArg,validateImageParts}from"./chunk-HEGJZJO7.js";import{VCR_ENGINES,emitVcrArgParseError,isBuildxAvailable,isEngineInstalled,pushCompressionArgs,reportEngineCommandFailure,reportEnginePushFailure,resolveRegistry,resolveVcrScope,runEngine,splitPassthrough,validateVcrChoice}from"./chunk-TEFZFCIF.js";import{outputError}from"./chunk-ZVFZIWBV.js";import"./chunk-D4MW3RDW.js";import{buildSubcommand}from"./chunk-65JYSI26.js";import"./chunk-YMVDWVMO.js";import"./chunk-O7G3CZ42.js";import"./chunk-N3N5UHIL.js";import"./chunk-7O3KGTQ3.js";import"./chunk-2I64AYHG.js";import"./chunk-SOJCELXH.js";import"./chunk-QTKJC2O5.js";import{AGENT_REASON}from"./chunk-ENBTTYJR.js";import"./chunk-MBHVWCFE.js";import"./chunk-5XJNPXQK.js";import{printError}from"./chunk-4P66SQRS.js";import{parseArguments}from"./chunk-ZRS5X7M2.js";import"./chunk-MY4MONOH.js";import"./chunk-AGDWVTJV.js";import"./chunk-F2ZWW2IO.js";import"./chunk-B4ATVYZW.js";import"./chunk-PPCFQQSU.js";import{buildCommandWithGlobalFlags,outputAgentError}from"./chunk-WR5OOWD6.js";import{getFlagsSpecification}from"./chunk-JAJW3P42.js";import"./chunk-4VGOAPFY.js";import"./chunk-GTK7TBLW.js";import"./chunk-VOZEB6PD.js";import"./chunk-GI6G3FJJ.js";import"./chunk-FI772UVH.js";import{output_manager_default}from"./chunk-RTRCTYW6.js";import"./chunk-QGIQK47P.js";import"./chunk-BRK4OB4B.js";import"./chunk-AVSPFBLM.js";import"./chunk-XCJDGQO7.js";import"./chunk-YPTLSODC.js";import"./chunk-7HL2RPUO.js";import"./chunk-U7KCDTCH.js";import"./chunk-N3ZZ7FHQ.js";import"./chunk-GU6VIFR5.js";import"./chunk-6L236MNA.js";var DEFAULT_PLATFORM="linux/amd64";async function build(client,telemetry){let{own,passthrough}=splitPassthrough(client.argv),parsedArgs;try{parsedArgs=parseArguments(own,getFlagsSpecification(buildSubcommand.options))}catch(err){return emitVcrArgParseError(client,err,"vcr build <engine> [path] [name[:tag]]"),printError(err),1}let[engineArg,pathArg,nameArg]=parsedArgs.args.slice(2),project=parsedArgs.flags["--project"],platform=parsedArgs.flags["--platform"],push=!!parsedArgs.flags["--push"];if(telemetry.trackCliArgumentEngine(engineArg),telemetry.trackCliArgumentPath(pathArg),telemetry.trackCliArgumentName(nameArg),telemetry.trackCliOptionProject(project),telemetry.trackCliOptionPlatform(platform),telemetry.trackCliFlagPush(push),!engineArg){let message=`Missing engine. Choose one of: ${VCR_ENGINES.join(", ")}.`;return outputAgentError(client,{status:"error",reason:AGENT_REASON.MISSING_ARGUMENTS,message,next:[{command:buildCommandWithGlobalFlags(client.argv,"vcr build docker"),when:"Replace docker with the container tool you use"}]},1),outputError(client,!1,"MISSING_ARGUMENTS",message)}let choiceError=validateVcrChoice(client,"engine",engineArg,VCR_ENGINES,!1);if(typeof choiceError=="number")return choiceError;let engine=engineArg;if(!isEngineInstalled(engine)){let message=`\`${engine}\` is not installed or not on your PATH. Install it and try again.`;return outputAgentError(client,{status:"error",reason:"engine_not_found",message},1),outputError(client,!1,"ENGINE_NOT_FOUND",message)}let scope=await resolveVcrScope(client,{project,jsonOutput:!1});if(typeof scope=="number")return scope;let parsed=parseNameArg(nameArg,scope.projectName);if("error"in parsed)return outputAgentError(client,{status:"error",reason:AGENT_REASON.INVALID_ARGUMENTS,message:parsed.error},1),outputError(client,!1,"INVALID_ARGUMENTS",parsed.error);let validationError=validateImageParts(parsed);if(validationError)return outputAgentError(client,{status:"error",reason:AGENT_REASON.INVALID_ARGUMENTS,message:validationError},1),outputError(client,!1,"INVALID_ARGUMENTS",validationError);let ref=`${buildRepositoryReference({registry:resolveRegistry(),teamSlug:scope.teamSlug,projectName:scope.projectName,repository:parsed.repository})}:${parsed.tag??DEFAULT_TAG}`,contextPath=pathArg??".",buildPlatform=platform??DEFAULT_PLATFORM;if(push&&engine==="docker"&&await isBuildxAvailable()){let outputSpec=`type=image,name=${ref},push=true,oci-mediatypes=true,compression=zstd,compression-level=3,force-compression=true`,engineArgs2=["buildx","build","--platform",buildPlatform,"--output",outputSpec,...passthrough,contextPath];output_manager_default.log(`Running: ${engine} ${engineArgs2.join(" ")}`);let result2=await runEngine(engine,engineArgs2,{cwd:client.cwd,captureStderr:!0});return result2.exitCode!==0?reportEnginePushFailure(client,engine,"buildx build",result2):(output_manager_default.success(`Built and pushed ${ref} (zstd compression)`),0)}push&&engine==="docker"&&output_manager_default.warn("Docker Buildx is not available; building and pushing without zstd compression. Install Buildx for smaller, faster image pushes.");let engineArgs=["build","--platform",buildPlatform,"--tag",ref,...passthrough,contextPath];output_manager_default.log(`Running: ${engine} ${engineArgs.join(" ")}`);let result=await runEngine(engine,engineArgs,{cwd:client.cwd});if(result.exitCode!==0)return reportEngineCommandFailure(client,engine,"build",result);if(!push)return output_manager_default.success(`Built ${ref}`),output_manager_default.log(`Push it with \`${buildCommandWithGlobalFlags(client.argv,`vcr push ${engine}${nameArg?` ${nameArg}`:""}`)}\`.`),0;let pushArgs=["push",...pushCompressionArgs(engine),ref];output_manager_default.log(`Running: ${engine} ${pushArgs.join(" ")}`);let pushResult=await runEngine(engine,pushArgs,{cwd:client.cwd,captureStderr:!0});if(pushResult.exitCode!==0)return reportEnginePushFailure(client,engine,"push",pushResult);let compressed=engine!=="docker";return output_manager_default.success(`Built and pushed ${ref}${compressed?" (zstd compression)":""}`),0}export{build as default};
@@ -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{canPrompt}from"./chunk-XD2LZRBS.js";import{outputError}from"./chunk-6RIQPTJA.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 -m <text>, --file <path>, or pipe stdin (e.g. `echo "LGTM" | vercel comments reply <thread>`).')}}export{resolveMessageContent};
7
+ import{canPrompt}from"./chunk-XD2LZRBS.js";import{outputError}from"./chunk-ZVFZIWBV.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 -m <text>, --file <path>, or pipe stdin (e.g. `echo "LGTM" | vercel comments reply <thread>`).')}}export{resolveMessageContent};
@@ -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{formatCondition,formatTransform,isTargetTransform}from"./chunk-UMCKAEPK.js";import{output_manager_default}from"./chunk-Z6Y55QJW.js";import{require_source}from"./chunk-U7KCDTCH.js";import{__toESM}from"./chunk-6L236MNA.js";function extractEnvVarNames(value){let names=new Set;for(let m of value.matchAll(/\$\{?([A-Z_][A-Z0-9_]*)\}?/g))names.add(m[1]);return Array.from(names)}function escapeRegex(value){return value.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function referencesEnvVar(value,name){let escapedName=escapeRegex(name);return new RegExp(`\\$(?:\\{${escapedName}\\}|${escapedName}(?![A-Za-z0-9_]))`).test(value)}function referencesBracedEnvVar(value,name){return new RegExp(`\\$\\{${escapeRegex(name)}\\}`).test(value)}function collectReferencedEnvVars(values,explicitEnv=[],excludedNames=new Set){let names=new Set(explicitEnv.filter(name=>values.some(value=>referencesEnvVar(value,name))));for(let value of values)for(let name of extractEnvVarNames(value))(!excludedNames.has(name)||names.has(name)||referencesBracedEnvVar(value,name))&&names.add(name);return Array.from(names)}function collectNamedRegexCaptures(source){return new Set(Array.from(source.matchAll(/\(\?<([a-zA-Z][a-zA-Z0-9_]*)>/g),match=>match[1]))}function populateRouteEnv(route,srcSyntax="regex"){let excludedNames=srcSyntax==="regex"&&route.src?collectNamedRegexCaptures(route.src):new Set,routeValues=[...route.dest?[route.dest]:[],...Object.values(route.headers||{})],routeEnv=collectReferencedEnvVars(routeValues,route.env,excludedNames);if(route.env=routeEnv.length>0?routeEnv:void 0,route.transforms)for(let transform of route.transforms){let args=transform.args?Array.isArray(transform.args)?transform.args:[transform.args]:[],names=collectReferencedEnvVars(args,transform.env,excludedNames);transform.env=names.length>0?names:void 0}}async function generateRoute(client,projectId,input,options={}){let{teamId}=options,query=new URLSearchParams;teamId&&query.set("teamId",teamId);let queryString=query.toString(),url=`/v1/projects/${projectId}/routes/generate${queryString?`?${queryString}`:""}`;return await client.fetch(url,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(input)})}function parseTransforms(values,type,op){return values.map(value=>parseTransform(value,type,op))}function parseTransform(input,type,op){if(op==="delete"){let key2=input.trim();if(!key2)throw new Error("Delete operation requires a key");return{type,op,target:{key:key2}}}let eqIndex=input.indexOf("=");if(eqIndex===-1)throw new Error(`Invalid format: "${input}". Expected format: key=value`);let key=input.slice(0,eqIndex).trim(),args=input.slice(eqIndex+1);if(!key)throw new Error("Transform key cannot be empty");return{type,op,target:{key},args}}function collectTransforms(flags){let transforms=[];return flags.setResponseHeader&&transforms.push(...parseTransforms(flags.setResponseHeader,"response.headers","set")),flags.appendResponseHeader&&transforms.push(...parseTransforms(flags.appendResponseHeader,"response.headers","append")),flags.deleteResponseHeader&&transforms.push(...parseTransforms(flags.deleteResponseHeader,"response.headers","delete")),flags.setRequestHeader&&transforms.push(...parseTransforms(flags.setRequestHeader,"request.headers","set")),flags.appendRequestHeader&&transforms.push(...parseTransforms(flags.appendRequestHeader,"request.headers","append")),flags.deleteRequestHeader&&transforms.push(...parseTransforms(flags.deleteRequestHeader,"request.headers","delete")),flags.setRequestQuery&&transforms.push(...parseTransforms(flags.setRequestQuery,"request.query","set")),flags.appendRequestQuery&&transforms.push(...parseTransforms(flags.appendRequestQuery,"request.query","append")),flags.deleteRequestQuery&&transforms.push(...parseTransforms(flags.deleteRequestQuery,"request.query","delete")),transforms}function collectResponseHeaders(setHeaders){let headers={};for(let input of setHeaders){let eqIndex=input.indexOf("=");if(eqIndex===-1)throw new Error(`Invalid header format: "${input}". Expected format: key=value`);let key=input.slice(0,eqIndex).trim(),value=input.slice(eqIndex+1);if(!key)throw new Error("Header key cannot be empty");headers[key]=value}return headers}var MAX_NAME_LENGTH=256,MAX_DESCRIPTION_LENGTH=1024,MAX_CONDITIONS=16,VALID_SYNTAXES=["regex","path-to-regexp","equals"],REDIRECT_STATUS_CODES=[301,302,303,307,308],VALID_ACTION_TYPES=["rewrite","redirect","set-status"],ALL_ACTION_CHOICES=[{name:"Rewrite",value:"rewrite",exclusive:!0},{name:"Redirect",value:"redirect",exclusive:!0},{name:"Set Status Code",value:"set-status",exclusive:!0},{name:"Response Headers",value:"response-headers"},{name:"Request Headers",value:"request-headers"},{name:"Request Query",value:"request-query"}];function stripQuotes(str){return str.startsWith('"')&&str.endsWith('"')&&str.length>=2||str.startsWith("'")&&str.endsWith("'")&&str.length>=2?str.slice(1,-1):str}function extractTransformFlags(flags){return{setResponseHeader:flags["--set-response-header"],appendResponseHeader:flags["--append-response-header"],deleteResponseHeader:flags["--delete-response-header"],setRequestHeader:flags["--set-request-header"],appendRequestHeader:flags["--append-request-header"],deleteRequestHeader:flags["--delete-request-header"],setRequestQuery:flags["--set-request-query"],appendRequestQuery:flags["--append-request-query"],deleteRequestQuery:flags["--delete-request-query"]}}function collectHeadersAndTransforms(transformFlags){let headers=transformFlags.setResponseHeader?collectResponseHeaders(transformFlags.setResponseHeader):{},transforms=collectTransforms({...transformFlags,setResponseHeader:void 0});return{headers,transforms}}function hasAnyTransformFlags(flags){let tf=extractTransformFlags(flags);return!!(tf.setResponseHeader||tf.appendResponseHeader||tf.deleteResponseHeader||tf.setRequestHeader||tf.appendRequestHeader||tf.deleteRequestHeader||tf.setRequestQuery||tf.appendRequestQuery||tf.deleteRequestQuery)}function validateActionFlags(action,dest,status){if(!action)return dest||status!==void 0?"--action is required when using --dest or --status. Use --action rewrite, --action redirect, or --action set-status.":null;if(!VALID_ACTION_TYPES.includes(action))return`Invalid action type: "${action}". Valid types: ${VALID_ACTION_TYPES.join(", ")}`;switch(action){case"rewrite":if(!dest)return"--action rewrite requires --dest.";if(status!==void 0)return"--action rewrite does not accept --status.";break;case"redirect":if(!dest)return"--action redirect requires --dest.";if(status===void 0)return`--action redirect requires --status (${REDIRECT_STATUS_CODES.join(", ")}).`;if(!REDIRECT_STATUS_CODES.includes(status))return`Invalid redirect status: ${status}. Must be one of: ${REDIRECT_STATUS_CODES.join(", ")}`;break;case"set-status":if(dest)return"--action set-status does not accept --dest.";if(status===void 0)return"--action set-status requires --status.";if(status<100||status>599)return"Status code must be between 100 and 599.";break}return null}async function collectActionDetails(client,actionType,flags){switch(actionType){case"rewrite":{let dest=await client.input.text({message:"Destination URL:",validate:val=>val?!0:"Destination is required"});Object.assign(flags,{"--dest":dest});break}case"redirect":{let dest=await client.input.text({message:"Destination URL:",validate:val=>val?!0:"Destination is required"}),status=await client.input.select({message:"Status code:",choices:[{name:"307 - Temporary Redirect",value:307},{name:"308 - Permanent Redirect",value:308},{name:"301 - Moved Permanently",value:301},{name:"302 - Found",value:302},{name:"303 - See Other",value:303}]});Object.assign(flags,{"--dest":dest,"--status":status});break}case"set-status":{let statusCode=await client.input.text({message:"HTTP status code:",validate:val=>{let num=parseInt(val,10);return isNaN(num)||num<100||num>599?"Status code must be between 100 and 599":!0}});Object.assign(flags,{"--status":parseInt(statusCode,10)});break}case"response-headers":{await collectInteractiveHeaders(client,"response",flags);break}case"request-headers":{await collectInteractiveHeaders(client,"request-header",flags);break}case"request-query":{await collectInteractiveHeaders(client,"request-query",flags);break}}}async function collectInteractiveConditions(client,flags){let addMore=!0;for(;addMore;){let currentHas=flags["--has"]||[],currentMissing=flags["--missing"]||[];if(currentHas.length>0||currentMissing.length>0){output_manager_default.log(`
7
+ import{formatCondition,formatTransform,isTargetTransform}from"./chunk-GCHDJ44X.js";import{output_manager_default}from"./chunk-RTRCTYW6.js";import{require_source}from"./chunk-U7KCDTCH.js";import{__toESM}from"./chunk-6L236MNA.js";function extractEnvVarNames(value){let names=new Set;for(let m of value.matchAll(/\$\{?([A-Z_][A-Z0-9_]*)\}?/g))names.add(m[1]);return Array.from(names)}function escapeRegex(value){return value.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function referencesEnvVar(value,name){let escapedName=escapeRegex(name);return new RegExp(`\\$(?:\\{${escapedName}\\}|${escapedName}(?![A-Za-z0-9_]))`).test(value)}function referencesBracedEnvVar(value,name){return new RegExp(`\\$\\{${escapeRegex(name)}\\}`).test(value)}function collectReferencedEnvVars(values,explicitEnv=[],excludedNames=new Set){let names=new Set(explicitEnv.filter(name=>values.some(value=>referencesEnvVar(value,name))));for(let value of values)for(let name of extractEnvVarNames(value))(!excludedNames.has(name)||names.has(name)||referencesBracedEnvVar(value,name))&&names.add(name);return Array.from(names)}function collectNamedRegexCaptures(source){return new Set(Array.from(source.matchAll(/\(\?<([a-zA-Z][a-zA-Z0-9_]*)>/g),match=>match[1]))}function populateRouteEnv(route,srcSyntax="regex"){let excludedNames=srcSyntax==="regex"&&route.src?collectNamedRegexCaptures(route.src):new Set,routeValues=[...route.dest?[route.dest]:[],...Object.values(route.headers||{})],routeEnv=collectReferencedEnvVars(routeValues,route.env,excludedNames);if(route.env=routeEnv.length>0?routeEnv:void 0,route.transforms)for(let transform of route.transforms){let args=transform.args?Array.isArray(transform.args)?transform.args:[transform.args]:[],names=collectReferencedEnvVars(args,transform.env,excludedNames);transform.env=names.length>0?names:void 0}}async function generateRoute(client,projectId,input,options={}){let{teamId}=options,query=new URLSearchParams;teamId&&query.set("teamId",teamId);let queryString=query.toString(),url=`/v1/projects/${projectId}/routes/generate${queryString?`?${queryString}`:""}`;return await client.fetch(url,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(input)})}function parseTransforms(values,type,op){return values.map(value=>parseTransform(value,type,op))}function parseTransform(input,type,op){if(op==="delete"){let key2=input.trim();if(!key2)throw new Error("Delete operation requires a key");return{type,op,target:{key:key2}}}let eqIndex=input.indexOf("=");if(eqIndex===-1)throw new Error(`Invalid format: "${input}". Expected format: key=value`);let key=input.slice(0,eqIndex).trim(),args=input.slice(eqIndex+1);if(!key)throw new Error("Transform key cannot be empty");return{type,op,target:{key},args}}function collectTransforms(flags){let transforms=[];return flags.setResponseHeader&&transforms.push(...parseTransforms(flags.setResponseHeader,"response.headers","set")),flags.appendResponseHeader&&transforms.push(...parseTransforms(flags.appendResponseHeader,"response.headers","append")),flags.deleteResponseHeader&&transforms.push(...parseTransforms(flags.deleteResponseHeader,"response.headers","delete")),flags.setRequestHeader&&transforms.push(...parseTransforms(flags.setRequestHeader,"request.headers","set")),flags.appendRequestHeader&&transforms.push(...parseTransforms(flags.appendRequestHeader,"request.headers","append")),flags.deleteRequestHeader&&transforms.push(...parseTransforms(flags.deleteRequestHeader,"request.headers","delete")),flags.setRequestQuery&&transforms.push(...parseTransforms(flags.setRequestQuery,"request.query","set")),flags.appendRequestQuery&&transforms.push(...parseTransforms(flags.appendRequestQuery,"request.query","append")),flags.deleteRequestQuery&&transforms.push(...parseTransforms(flags.deleteRequestQuery,"request.query","delete")),transforms}function collectResponseHeaders(setHeaders){let headers={};for(let input of setHeaders){let eqIndex=input.indexOf("=");if(eqIndex===-1)throw new Error(`Invalid header format: "${input}". Expected format: key=value`);let key=input.slice(0,eqIndex).trim(),value=input.slice(eqIndex+1);if(!key)throw new Error("Header key cannot be empty");headers[key]=value}return headers}var MAX_NAME_LENGTH=256,MAX_DESCRIPTION_LENGTH=1024,MAX_CONDITIONS=16,VALID_SYNTAXES=["regex","path-to-regexp","equals"],REDIRECT_STATUS_CODES=[301,302,303,307,308],VALID_ACTION_TYPES=["rewrite","redirect","set-status"],ALL_ACTION_CHOICES=[{name:"Rewrite",value:"rewrite",exclusive:!0},{name:"Redirect",value:"redirect",exclusive:!0},{name:"Set Status Code",value:"set-status",exclusive:!0},{name:"Response Headers",value:"response-headers"},{name:"Request Headers",value:"request-headers"},{name:"Request Query",value:"request-query"}];function stripQuotes(str){return str.startsWith('"')&&str.endsWith('"')&&str.length>=2||str.startsWith("'")&&str.endsWith("'")&&str.length>=2?str.slice(1,-1):str}function extractTransformFlags(flags){return{setResponseHeader:flags["--set-response-header"],appendResponseHeader:flags["--append-response-header"],deleteResponseHeader:flags["--delete-response-header"],setRequestHeader:flags["--set-request-header"],appendRequestHeader:flags["--append-request-header"],deleteRequestHeader:flags["--delete-request-header"],setRequestQuery:flags["--set-request-query"],appendRequestQuery:flags["--append-request-query"],deleteRequestQuery:flags["--delete-request-query"]}}function collectHeadersAndTransforms(transformFlags){let headers=transformFlags.setResponseHeader?collectResponseHeaders(transformFlags.setResponseHeader):{},transforms=collectTransforms({...transformFlags,setResponseHeader:void 0});return{headers,transforms}}function hasAnyTransformFlags(flags){let tf=extractTransformFlags(flags);return!!(tf.setResponseHeader||tf.appendResponseHeader||tf.deleteResponseHeader||tf.setRequestHeader||tf.appendRequestHeader||tf.deleteRequestHeader||tf.setRequestQuery||tf.appendRequestQuery||tf.deleteRequestQuery)}function validateActionFlags(action,dest,status){if(!action)return dest||status!==void 0?"--action is required when using --dest or --status. Use --action rewrite, --action redirect, or --action set-status.":null;if(!VALID_ACTION_TYPES.includes(action))return`Invalid action type: "${action}". Valid types: ${VALID_ACTION_TYPES.join(", ")}`;switch(action){case"rewrite":if(!dest)return"--action rewrite requires --dest.";if(status!==void 0)return"--action rewrite does not accept --status.";break;case"redirect":if(!dest)return"--action redirect requires --dest.";if(status===void 0)return`--action redirect requires --status (${REDIRECT_STATUS_CODES.join(", ")}).`;if(!REDIRECT_STATUS_CODES.includes(status))return`Invalid redirect status: ${status}. Must be one of: ${REDIRECT_STATUS_CODES.join(", ")}`;break;case"set-status":if(dest)return"--action set-status does not accept --dest.";if(status===void 0)return"--action set-status requires --status.";if(status<100||status>599)return"Status code must be between 100 and 599.";break}return null}async function collectActionDetails(client,actionType,flags){switch(actionType){case"rewrite":{let dest=await client.input.text({message:"Destination URL:",validate:val=>val?!0:"Destination is required"});Object.assign(flags,{"--dest":dest});break}case"redirect":{let dest=await client.input.text({message:"Destination URL:",validate:val=>val?!0:"Destination is required"}),status=await client.input.select({message:"Status code:",choices:[{name:"307 - Temporary Redirect",value:307},{name:"308 - Permanent Redirect",value:308},{name:"301 - Moved Permanently",value:301},{name:"302 - Found",value:302},{name:"303 - See Other",value:303}]});Object.assign(flags,{"--dest":dest,"--status":status});break}case"set-status":{let statusCode=await client.input.text({message:"HTTP status code:",validate:val=>{let num=parseInt(val,10);return isNaN(num)||num<100||num>599?"Status code must be between 100 and 599":!0}});Object.assign(flags,{"--status":parseInt(statusCode,10)});break}case"response-headers":{await collectInteractiveHeaders(client,"response",flags);break}case"request-headers":{await collectInteractiveHeaders(client,"request-header",flags);break}case"request-query":{await collectInteractiveHeaders(client,"request-query",flags);break}}}async function collectInteractiveConditions(client,flags){let addMore=!0;for(;addMore;){let currentHas=flags["--has"]||[],currentMissing=flags["--missing"]||[];if(currentHas.length>0||currentMissing.length>0){output_manager_default.log(`
8
8
  Current conditions:`);for(let c of currentHas)output_manager_default.print(` has: ${c}
9
9
  `);for(let c of currentMissing)output_manager_default.print(` does not have: ${c}
10
10
  `);output_manager_default.print(`
@@ -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-N6CNMMSZ.js";import{require_lib}from"./chunk-A5SVOPQK.js";import{CantParseJSONFile}from"./chunk-R2TGGVCT.js";import{require_dist}from"./chunk-QGIQK47P.js";import{__toESM}from"./chunk-6L236MNA.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-N6CNMMSZ.js";import{require_lib}from"./chunk-AGDWVTJV.js";import{CantParseJSONFile}from"./chunk-GI6G3FJJ.js";import{require_dist}from"./chunk-QGIQK47P.js";import{__toESM}from"./chunk-6L236MNA.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};
@@ -0,0 +1,9 @@
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{buildCorrectedCommand,isArgumentError}from"./chunk-ZRS5X7M2.js";import{getErrorRecovery,shouldEmitNonInteractiveCommandError,trackAgentError,writeAgentError}from"./chunk-WR5OOWD6.js";import{InvalidToken,parseRetryAfterHeaderAsMillis,require_bytes}from"./chunk-GI6G3FJJ.js";import{getCommandName}from"./chunk-FI772UVH.js";import{output_manager_default}from"./chunk-RTRCTYW6.js";import{pkg_default}from"./chunk-AVSPFBLM.js";import{require_source}from"./chunk-U7KCDTCH.js";import{__toESM}from"./chunk-6L236MNA.js";var import_chalk=__toESM(require_source(),1);var import_bytes=__toESM(require_bytes(),1);async function responseError(res,fallbackMessage=null,parsedBody={}){let message="",bodyError;if(res.status>=400&&res.status<500){let body;try{body=await res.json()}catch{body=parsedBody}bodyError=body.error||body.err||{},message=bodyError.message}message||(message=fallbackMessage===null?"Response Error":fallbackMessage);let err=new Error(`${message} (${res.status})`);if(err.status=res.status,err.serverMessage=message,bodyError)for(let field of Object.keys(bodyError))field!=="message"&&(err[field]=bodyError[field]);if(res.status===429||res.status===503){let parsed=parseRetryAfterHeaderAsMillis(res.headers.get("Retry-After"));err.retryAfterMs=parsed??(res.status===429?0:void 0)}return err}function toEnumerableError(err){let enumerable={};enumerable.name=err.name;for(let key of Object.getOwnPropertyNames(err))enumerable[key]=err[key];return enumerable}function printError(error2,client,options={}){typeof error2=="string"&&(error2=new Error(error2));let apiError=error2,{message,stack,status,code,sizeLimit}=apiError,authenticationError=error2 instanceof InvalidToken||status===401,displayMessage=authenticationError?new InvalidToken(client?.authConfig.tokenSource??(error2 instanceof InvalidToken?error2.tokenSource:void 0)).message:apiError.serverMessage||message,argumentError=isArgumentError(error2)?error2:void 0,suggestion=argumentError?.suggestedOption&&argumentError.invalidOption,correction=suggestion&&client&&argumentError?buildCorrectedCommand(client.argv,argumentError.invalidOption,argumentError.suggestedOption,argumentError.flagsSpecification):void 0,recovery=getErrorRecovery(apiError,client),reason=authenticationError?"not_authorized":status===403?"forbidden":status===402?"payment_required":status===401?"not_authorized":status===429?"rate_limited":code==="ARG_UNKNOWN_OPTION"?"invalid_arguments":"api_error",hint=argumentError?.allowedOptions?`Vercel CLI ${pkg_default.version} accepts: ${argumentError.allowedOptions.join(", ")}.${suggestion?` Did you mean ${argumentError.suggestedOption}?`:""}`:recovery.hint;if(client&&(status||authenticationError||options.json||argumentError?.allowedOptions)){let payload={...recovery,status:"error",reason,message:displayMessage,hint,...argumentError?.allowedOptions&&{allowedOptions:argumentError.allowedOptions,suggestedOption:argumentError.suggestedOption,cliVersion:pkg_default.version},...correction&&{next:[{command:correction,when:correction.includes("<")?"Replace placeholders with the intended values, then run the corrected command":"Run the corrected command"}]}};if(options.json||shouldEmitNonInteractiveCommandError(client)){output_manager_default.stopSpinner(),writeAgentError(client,payload);return}trackAgentError(client,payload)}if(authenticationError){output_manager_default.stopSpinner(),output_manager_default.fatal(displayMessage);return}if(hint){output_manager_default.stopSpinner(),output_manager_default.fatal(apiError.serverMessage||message||"The request failed."),output_manager_default.print(` ${hint}
8
+ `),correction&&output_manager_default.print(` ${correction}
9
+ `);return}output_manager_default.debug(`handling error: ${stack}`),message!=="User force closed the prompt with 0 null"&&(status===403?output_manager_default.error(message||`Authentication error. Run ${getCommandName("login")} to log-in again.`):status===429?output_manager_default.error(message):code==="size_limit_exceeded"?output_manager_default.error(`File size limit exceeded (${(0,import_bytes.default)(sizeLimit)})`):message?output_manager_default.prettyError(apiError):status===500?output_manager_default.error("Unexpected server error. Please retry."):code==="USER_ABORT"?output_manager_default.log("Canceled"):output_manager_default.error(`Unexpected error. Please try again later. (${message})`))}export{responseError,toEnumerableError,printError};
@@ -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{output_manager_default}from"./chunk-Z6Y55QJW.js";import{require_source}from"./chunk-U7KCDTCH.js";import{__toESM}from"./chunk-6L236MNA.js";var import_chalk=__toESM(require_source(),1);var ALIGNED_LABEL_WIDTH=16;function formatAlignedLabel(label,value,options={}){let gutter=options.gutter==="\u2713"?import_chalk.default.green("\u2713"):options.gutter,prefix=gutter?`${gutter} `:" ",paddedLabel=label.length<ALIGNED_LABEL_WIDTH?label.padEnd(ALIGNED_LABEL_WIDTH):`${label} `;return`${prefix}${import_chalk.default.bold(paddedLabel)}${value}`}function printAlignedLabel(label,value,options={}){output_manager_default.print(`${formatAlignedLabel(label,import_chalk.default.bold(value),options)}
7
+ import{output_manager_default}from"./chunk-RTRCTYW6.js";import{require_source}from"./chunk-U7KCDTCH.js";import{__toESM}from"./chunk-6L236MNA.js";var import_chalk=__toESM(require_source(),1);var ALIGNED_LABEL_WIDTH=16;function formatAlignedLabel(label,value,options={}){let gutter=options.gutter==="\u2713"?import_chalk.default.green("\u2713"):options.gutter,prefix=gutter?`${gutter} `:" ",labelWidth=Math.max(ALIGNED_LABEL_WIDTH,options.labelWidth??ALIGNED_LABEL_WIDTH),paddedLabel=label.length<labelWidth?label.padEnd(labelWidth):`${label} `,format=options.emphasis==="subtle"?import_chalk.default.dim:import_chalk.default.bold;return`${prefix}${format(paddedLabel)}${format(value)}`}function printAlignedLabel(label,value,options={}){output_manager_default.print(`${formatAlignedLabel(label,value,options)}
8
8
  `)}export{ALIGNED_LABEL_WIDTH,formatAlignedLabel,printAlignedLabel};