vercel 64.5.0 → 64.7.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 (250) hide show
  1. package/dist/chunks/{add-KBBLLPHW.js → add-J6YV6RJ7.js} +1 -1
  2. package/dist/chunks/{add-CG73LA5A.js → add-LN5C4Y2G.js} +1 -1
  3. package/dist/chunks/add-UBG7IGYE.js +8 -0
  4. package/dist/chunks/{build-7EWHBKAN.js → build-7QUO5T72.js} +1 -1
  5. package/dist/chunks/chunk-2B2Z447M.js +10 -0
  6. package/dist/chunks/{chunk-XEBMH33W.js → chunk-2EYJFHEL.js} +1 -1
  7. package/dist/chunks/chunk-2IRZ2C5L.js +9 -0
  8. package/dist/chunks/{chunk-UGMTKOTN.js → chunk-2LMIOQID.js} +1 -1
  9. package/dist/chunks/{chunk-TCQZFIBR.js → chunk-2PSLXHNT.js} +1 -1
  10. package/dist/chunks/chunk-3BTEMYLT.js +7 -0
  11. package/dist/chunks/chunk-4ITTBUCW.js +7 -0
  12. package/dist/chunks/chunk-4KYSK2MS.js +7 -0
  13. package/dist/chunks/{chunk-XXCWQPAH.js → chunk-4XKEOH4J.js} +1 -1
  14. package/dist/chunks/{chunk-VS7O22ED.js → chunk-54KLVDB5.js} +1 -1
  15. package/dist/chunks/{chunk-MPZFMEVK.js → chunk-7ENWK2AH.js} +1 -1
  16. package/dist/chunks/{chunk-QOFK5PKB.js → chunk-A4NHFQVX.js} +2 -2
  17. package/dist/chunks/{chunk-QEXSF4NA.js → chunk-AAFST44A.js} +1 -1
  18. package/dist/chunks/chunk-AGH2CMUM.js +7 -0
  19. package/dist/chunks/chunk-ANUSL4ES.js +7 -0
  20. package/dist/chunks/chunk-AOYNYH5D.js +7 -0
  21. package/dist/chunks/chunk-BMQREWR6.js +10 -0
  22. package/dist/chunks/chunk-BXHADCSX.js +7 -0
  23. package/dist/chunks/{chunk-Q5ZGA2RO.js → chunk-CFEJIJGS.js} +1 -1
  24. package/dist/chunks/{chunk-7GFRZWLE.js → chunk-CQQQSUQX.js} +1 -1
  25. package/dist/chunks/{chunk-JH257EDL.js → chunk-D7X7W4F4.js} +1 -1
  26. package/dist/chunks/{chunk-UQIVF4Q2.js → chunk-DD5XIW5T.js} +1 -1
  27. package/dist/chunks/{chunk-ZQKDO5PL.js → chunk-DQLWDDNU.js} +1 -1
  28. package/dist/chunks/{chunk-PAOR4MQZ.js → chunk-DX6PPIY7.js} +1 -1
  29. package/dist/chunks/chunk-EU2FGSLR.js +15 -0
  30. package/dist/chunks/{chunk-6UCSM3CZ.js → chunk-EVEH3L3V.js} +1 -1
  31. package/dist/chunks/{chunk-TPVAPVQC.js → chunk-EVXOSCYR.js} +1 -1
  32. package/dist/chunks/chunk-EWK3VAME.js +9 -0
  33. package/dist/chunks/{chunk-DRXOTZSJ.js → chunk-EWUSBHX5.js} +1 -1
  34. package/dist/chunks/chunk-F2TLISI5.js +7 -0
  35. package/dist/chunks/chunk-FOGLMAZE.js +7 -0
  36. package/dist/chunks/{chunk-3DP66SQ4.js → chunk-FZUNGPGO.js} +1 -1
  37. package/dist/chunks/{chunk-GVUB6QGX.js → chunk-GH6O7YJ3.js} +1 -1
  38. package/dist/chunks/{chunk-6QRT6USI.js → chunk-GOVZY7W2.js} +1 -1
  39. package/dist/chunks/{chunk-LD5U73LA.js → chunk-HGTMU34S.js} +1 -1
  40. package/dist/chunks/{chunk-ZZ3LJ22B.js → chunk-HJV7CTD4.js} +2 -2
  41. package/dist/chunks/{chunk-OHVPJNGY.js → chunk-I7KMJTOY.js} +1 -1
  42. package/dist/chunks/{chunk-PTI3TP7P.js → chunk-IULNLFPX.js} +1 -1
  43. package/dist/chunks/{chunk-JZ7FDBS4.js → chunk-JHB3TYKZ.js} +1 -1
  44. package/dist/chunks/{chunk-H3KYG32S.js → chunk-JJSDTLBW.js} +1 -1
  45. package/dist/chunks/{chunk-V3RDOM3U.js → chunk-JSCK6WWR.js} +3 -3
  46. package/dist/chunks/chunk-JXKKJ5OI.js +7 -0
  47. package/dist/chunks/{chunk-DXLLC7ZM.js → chunk-KJKM2UNP.js} +1 -1
  48. package/dist/chunks/chunk-KJWOXBZV.js +7 -0
  49. package/dist/chunks/chunk-KYMABVTF.js +25 -0
  50. package/dist/chunks/{chunk-2UPVIVAA.js → chunk-M2NKATEC.js} +1 -1
  51. package/dist/chunks/{chunk-TE2EE7DR.js → chunk-MGOPTP7N.js} +1 -1
  52. package/dist/chunks/{chunk-5S2NK6K6.js → chunk-MP27ZZFO.js} +1 -1
  53. package/dist/chunks/{chunk-3GUO6F6P.js → chunk-N5SAC4AS.js} +1 -1
  54. package/dist/chunks/{chunk-LUJL3KFT.js → chunk-N7YVHGLM.js} +1 -1
  55. package/dist/chunks/{chunk-GWB27IAS.js → chunk-NBNZYZFM.js} +1 -1
  56. package/dist/chunks/chunk-O3AL3QFA.js +7 -0
  57. package/dist/chunks/chunk-O5ZJ5YJP.js +10 -0
  58. package/dist/chunks/{chunk-3NNH2U5M.js → chunk-OGH32TS2.js} +1 -1
  59. package/dist/chunks/chunk-OS62YRSW.js +7 -0
  60. package/dist/chunks/{chunk-VRAMXFRB.js → chunk-P4U47GXI.js} +4 -3
  61. package/dist/chunks/{chunk-5NXYYFRL.js → chunk-PA5N7YTJ.js} +1 -1
  62. package/dist/chunks/{chunk-TKBORMUF.js → chunk-PADL3C6Z.js} +1 -1
  63. package/dist/chunks/chunk-PE5BSEYV.js +7 -0
  64. package/dist/chunks/{chunk-CITTRAYH.js → chunk-PNR5J6ZW.js} +1 -1
  65. package/dist/chunks/chunk-PPWMHBWP.js +9 -0
  66. package/dist/chunks/chunk-PUKYAALC.js +7 -0
  67. package/dist/chunks/{chunk-5AYB3JRL.js → chunk-QQ6IA4O5.js} +1 -1
  68. package/dist/chunks/{chunk-BJXMXDBM.js → chunk-QRCJKCMF.js} +1 -1
  69. package/dist/chunks/{chunk-SI7FQJIE.js → chunk-QW4W2UB6.js} +1 -1
  70. package/dist/chunks/{chunk-LYU4MVL5.js → chunk-R5QHLEAJ.js} +4 -4
  71. package/dist/chunks/chunk-R6Y4Z5VL.js +7 -0
  72. package/dist/chunks/{chunk-JIGCN5QS.js → chunk-RD7VCVW5.js} +3 -3
  73. package/dist/chunks/chunk-S76ILVQO.js +7 -0
  74. package/dist/chunks/chunk-SADXKDBI.js +7 -0
  75. package/dist/chunks/{chunk-HARXQZV3.js → chunk-SCJH3KSQ.js} +1 -1
  76. package/dist/chunks/{chunk-7QQIWMAT.js → chunk-SQXVQT2O.js} +5 -5
  77. package/dist/chunks/{chunk-CMEEAXVV.js → chunk-TD7MFXUO.js} +1 -1
  78. package/dist/chunks/{chunk-2UMWTCY7.js → chunk-TVHFWIH4.js} +1 -1
  79. package/dist/chunks/{chunk-GLH4PVMY.js → chunk-UI53O6MW.js} +1 -1
  80. package/dist/chunks/chunk-VO6FF6DY.js +7 -0
  81. package/dist/chunks/chunk-WFJEWVTE.js +12 -0
  82. package/dist/chunks/{chunk-OUHPDA7Q.js → chunk-WKZ6JSGZ.js} +1 -1
  83. package/dist/chunks/{chunk-OYMFOCD5.js → chunk-WX2KXEZV.js} +1 -1
  84. package/dist/chunks/{chunk-YQKURZ5W.js → chunk-X44OEPBR.js} +1 -1
  85. package/dist/chunks/{chunk-P5BNAP5T.js → chunk-X5HOJBDL.js} +7 -7
  86. package/dist/chunks/{chunk-ACVDKHVS.js → chunk-XGO6AXX5.js} +2 -2
  87. package/dist/chunks/chunk-Y4GLHDBA.js +9 -0
  88. package/dist/chunks/{chunk-WN7EJWN4.js → chunk-YE6WQYJH.js} +2 -2
  89. package/dist/chunks/chunk-Z5NJL63U.js +7 -0
  90. package/dist/chunks/chunk-ZOYMKZOR.js +7 -0
  91. package/dist/chunks/{chunk-TLEBLYBS.js → chunk-ZT2HVX54.js} +1 -1
  92. package/dist/chunks/{clear-35NUHHDI.js → clear-HKGEIG6F.js} +1 -1
  93. package/dist/chunks/{compile-vercel-config-UQIYIVA6.js → compile-vercel-config-ZY34MDLE.js} +1 -1
  94. package/dist/chunks/{config-FZD3R5VT.js → config-33ZMAOLB.js} +1 -1
  95. package/dist/chunks/config-VWDIXJZA.js +7 -0
  96. package/dist/chunks/config-validator.mjs +1 -1
  97. package/dist/chunks/{constants-ICJL2EO5.js → constants-JAB7MRSK.js} +1 -1
  98. package/dist/chunks/delete-OMER3AX3.js +10 -0
  99. package/dist/chunks/{delete-6LSSOF4X.js → delete-ZHGL7GGN.js} +1 -1
  100. package/dist/chunks/{detect-projects-THLTMO7V.js → detect-projects-PNODS4M7.js} +1 -1
  101. package/dist/chunks/{detect-services-GFVD2C3W.js → detect-services-ABFXK5B7.js} +1 -1
  102. package/dist/chunks/disable-OIGHKAMI.js +7 -0
  103. package/dist/chunks/discard-XUMTJVVB.js +14 -0
  104. package/dist/chunks/edit-3DIEWIVC.js +8 -0
  105. package/dist/chunks/{edit-R2RUDKC4.js → edit-IQ74VVWW.js} +1 -1
  106. package/dist/chunks/enable-AVCTKWMV.js +7 -0
  107. package/dist/chunks/{export-KTLACTAJ.js → export-LS4WTCAJ.js} +1 -1
  108. package/dist/chunks/future-BSDI3CNY.js +7 -0
  109. package/dist/chunks/generate-cert-for-deploy-FEZT4VSA.js +7 -0
  110. package/dist/chunks/image-BIOIWB4M.js +7 -0
  111. package/dist/chunks/{import-builders-JONKAYLL.js → import-builders-5TVTITKF.js} +1 -1
  112. package/dist/chunks/inspect-2OWYT5HO.js +13 -0
  113. package/dist/chunks/{inspect-JDSFHP6X.js → inspect-4OQTNJ46.js} +1 -1
  114. package/dist/chunks/{inspect-7IZ7M2TX.js → inspect-FR333BCC.js} +1 -1
  115. package/dist/chunks/{inspect-PQNECP2Z.js → inspect-VEBZWYJL.js} +1 -1
  116. package/dist/chunks/{inspect-PWLUWUGV.js → inspect-WPYSJNEK.js} +1 -1
  117. package/dist/chunks/list-LZCBVTIL.js +12 -0
  118. package/dist/chunks/{list-3N2CBVOG.js → list-Z43SODYP.js} +1 -1
  119. package/dist/chunks/{list-2G2BWD4T.js → list-ZK7VDRVT.js} +2 -2
  120. package/dist/chunks/{login-LLM3Q6GJ.js → login-36BXMMDQ.js} +1 -1
  121. package/dist/chunks/login-HAND2C3L.js +7 -0
  122. package/dist/chunks/logs-JYROMZI7.js +7 -0
  123. package/dist/chunks/{ls-5YLXAARZ.js → ls-H3ICVEYT.js} +1 -1
  124. package/dist/chunks/ls-IMAHWKOH.js +8 -0
  125. package/dist/chunks/ls-LYVIYO4J.js +12 -0
  126. package/dist/chunks/ls-M7YO74RP.js +12 -0
  127. package/dist/chunks/ls-QND7WBWE.js +12 -0
  128. package/dist/chunks/ls-VWA57ZVD.js +12 -0
  129. package/dist/chunks/ls-YWZLCIGC.js +11 -0
  130. package/dist/chunks/mutate-JQF3GLZP.js +9 -0
  131. package/dist/chunks/notifications-2SS4R53X.js +7 -0
  132. package/dist/chunks/open-RF3GYOHD.js +7 -0
  133. package/dist/chunks/openapi-GTAWN7OT.js +7 -0
  134. package/dist/chunks/permissions-G4F4PLFB.js +7 -0
  135. package/dist/chunks/prompt-missing-credentials-CV5NLAYI.js +7 -0
  136. package/dist/chunks/publish-KXUGNXEK.js +15 -0
  137. package/dist/chunks/pull-ELQ3GVJJ.js +7 -0
  138. package/dist/chunks/purchase-domain-if-available-QDQJOGOX.js +7 -0
  139. package/dist/chunks/{push-6LE54BCC.js → push-WSYAQQKI.js} +1 -1
  140. package/dist/chunks/query-ESQIFSJ6.js +12 -0
  141. package/dist/chunks/reauthenticate-H7ZY6BVA.js +7 -0
  142. package/dist/chunks/reorder-SADHAXS4.js +10 -0
  143. package/dist/chunks/{reply-6HUIX4AX.js → reply-UFH3BEMN.js} +1 -1
  144. package/dist/chunks/{resolve-TNBNGA3G.js → resolve-5THDM4PN.js} +1 -1
  145. package/dist/chunks/resolve-agent-team-MCTKBED5.js +7 -0
  146. package/dist/chunks/restore-3ZTRYEOV.js +16 -0
  147. package/dist/chunks/rm-GUSBRP6P.js +8 -0
  148. package/dist/chunks/rm-HUQFQOP2.js +8 -0
  149. package/dist/chunks/rm-WVA4E2BL.js +8 -0
  150. package/dist/chunks/rm-ZL4VR3BA.js +8 -0
  151. package/dist/chunks/rm-ZQWP6MUB.js +8 -0
  152. package/dist/chunks/routes-ZOLO53UC.js +7 -0
  153. package/dist/chunks/rule-inspect-WJ6ENOME.js +8 -0
  154. package/dist/chunks/{schema-HIKNWMV2.js → schema-7ACGW22H.js} +1 -1
  155. package/dist/chunks/{schema-QHZO72DB.js → schema-D2CWSXZU.js} +7 -7
  156. package/dist/chunks/{select-org-CK5CWC3A.js → select-org-3BWXFGPH.js} +1 -1
  157. package/dist/chunks/set-5I5CPDY3.js +7 -0
  158. package/dist/chunks/setup-and-link-HJSR6ANM.js +7 -0
  159. package/dist/chunks/skills-C2WOCF5Q.js +590 -0
  160. package/dist/chunks/{tags-35DFWGDC.js → tags-HTY22QMH.js} +1 -1
  161. package/dist/chunks/{types-77UW6BI4.js → types-6PREOZWK.js} +1 -1
  162. package/dist/chunks/update-6TDKMDKO.js +8 -0
  163. package/dist/commands/build/index.js +3 -3
  164. package/dist/commands/deploy/index.js +12 -9
  165. package/dist/commands/dev/index.js +3 -3
  166. package/dist/commands/env/index.js +13 -13
  167. package/dist/commands/link/index.js +1 -1
  168. package/dist/commands/list/index.js +2 -2
  169. package/dist/commands-bulk.js +315 -275
  170. package/dist/help.js +1 -1
  171. package/dist/index.js +2 -2
  172. package/dist/internal-build.js +1 -1
  173. package/dist/root-help-commands.mjs +1 -1
  174. package/dist/runtime-assets/dev-tunnel/api/tunnel.ts +443 -0
  175. package/dist/runtime-assets/dev-tunnel/lib/env.ts +25 -0
  176. package/dist/runtime-assets/dev-tunnel/lib/tunnel_pb.ts +505 -0
  177. package/dist/version.mjs +1 -1
  178. package/package.json +63 -57
  179. package/dist/chunks/add-U5U56FJR.js +0 -8
  180. package/dist/chunks/chunk-2B3A3MOX.js +0 -7
  181. package/dist/chunks/chunk-74QCXPNW.js +0 -7
  182. package/dist/chunks/chunk-7NNENHGN.js +0 -7
  183. package/dist/chunks/chunk-BFRDBBSO.js +0 -7
  184. package/dist/chunks/chunk-CMKLX4DC.js +0 -7
  185. package/dist/chunks/chunk-D4MW3RDW.js +0 -7
  186. package/dist/chunks/chunk-DDLM6CIQ.js +0 -10
  187. package/dist/chunks/chunk-GVVIFYQE.js +0 -7
  188. package/dist/chunks/chunk-HJRAWEA2.js +0 -7
  189. package/dist/chunks/chunk-ILFUNCJZ.js +0 -7
  190. package/dist/chunks/chunk-ITKS32PG.js +0 -7
  191. package/dist/chunks/chunk-J6O6JW2K.js +0 -7
  192. package/dist/chunks/chunk-KUGXOLL7.js +0 -25
  193. package/dist/chunks/chunk-MI7W4QMV.js +0 -7
  194. package/dist/chunks/chunk-MYHJNSCW.js +0 -15
  195. package/dist/chunks/chunk-N2TNA2FE.js +0 -9
  196. package/dist/chunks/chunk-U73RXMGU.js +0 -7
  197. package/dist/chunks/chunk-UCAE5Z5L.js +0 -7
  198. package/dist/chunks/chunk-VEMJINMZ.js +0 -13
  199. package/dist/chunks/chunk-VLDU2MDL.js +0 -7
  200. package/dist/chunks/chunk-VRWLNWNE.js +0 -7
  201. package/dist/chunks/chunk-W3TGCMRW.js +0 -9
  202. package/dist/chunks/chunk-WCBNKVVG.js +0 -9
  203. package/dist/chunks/chunk-Y24OSBXP.js +0 -7
  204. package/dist/chunks/chunk-ZBDLYNUF.js +0 -7
  205. package/dist/chunks/chunk-ZDKSDWSO.js +0 -9
  206. package/dist/chunks/chunk-ZMY3GQBK.js +0 -7
  207. package/dist/chunks/config-IQE5C7PZ.js +0 -7
  208. package/dist/chunks/delete-IBRCB3S3.js +0 -10
  209. package/dist/chunks/disable-4TODXYTB.js +0 -7
  210. package/dist/chunks/discard-WHC5FKWF.js +0 -14
  211. package/dist/chunks/edit-3DXOWQMF.js +0 -8
  212. package/dist/chunks/enable-2OAHPKCN.js +0 -7
  213. package/dist/chunks/future-JZ3RVO4B.js +0 -7
  214. package/dist/chunks/generate-cert-for-deploy-D4IHTKQS.js +0 -7
  215. package/dist/chunks/image-UW5U6CRJ.js +0 -7
  216. package/dist/chunks/inspect-2FS4PYBH.js +0 -13
  217. package/dist/chunks/list-Y3OA4KFK.js +0 -11
  218. package/dist/chunks/login-VQN3F7JU.js +0 -7
  219. package/dist/chunks/logs-XEJPLFXM.js +0 -7
  220. package/dist/chunks/ls-2DACOWSU.js +0 -12
  221. package/dist/chunks/ls-2M7QSW2F.js +0 -12
  222. package/dist/chunks/ls-7DJWHOK4.js +0 -12
  223. package/dist/chunks/ls-GY2YLYMD.js +0 -12
  224. package/dist/chunks/ls-NJEJSYSO.js +0 -11
  225. package/dist/chunks/ls-OAJKYQEL.js +0 -8
  226. package/dist/chunks/mutate-G2I4ISF4.js +0 -9
  227. package/dist/chunks/notifications-6MXYY2V6.js +0 -7
  228. package/dist/chunks/open-YKOYB7PH.js +0 -7
  229. package/dist/chunks/openapi-36GMGEXR.js +0 -7
  230. package/dist/chunks/permissions-RRP6IEHS.js +0 -7
  231. package/dist/chunks/prompt-missing-credentials-WQUF6X6K.js +0 -7
  232. package/dist/chunks/publish-AQ3FYC3J.js +0 -15
  233. package/dist/chunks/pull-HT2MQ3ML.js +0 -7
  234. package/dist/chunks/purchase-domain-if-available-NDEUZYHK.js +0 -7
  235. package/dist/chunks/query-SNY42BTX.js +0 -12
  236. package/dist/chunks/reauthenticate-4SGT475I.js +0 -7
  237. package/dist/chunks/reorder-SRF3NE5U.js +0 -10
  238. package/dist/chunks/resolve-agent-team-XSXRT42F.js +0 -7
  239. package/dist/chunks/restore-HK4SWMZP.js +0 -16
  240. package/dist/chunks/rm-4VXZ3AIX.js +0 -8
  241. package/dist/chunks/rm-ESSU4MS4.js +0 -8
  242. package/dist/chunks/rm-EWPYZXTX.js +0 -8
  243. package/dist/chunks/rm-GNDGYUKQ.js +0 -8
  244. package/dist/chunks/rm-SKCAZTYN.js +0 -8
  245. package/dist/chunks/routes-LK2HUGAK.js +0 -7
  246. package/dist/chunks/rule-inspect-RHHD5UIR.js +0 -8
  247. package/dist/chunks/rules-FF5FU7BV.js +0 -7
  248. package/dist/chunks/set-5P44OPZP.js +0 -7
  249. package/dist/chunks/setup-and-link-OLSKD2HE.js +0 -7
  250. package/dist/chunks/update-WHBFIV22.js +0 -8
@@ -1,9 +0,0 @@
1
- import { createRequire as __createRequire } from 'node:module';
2
- import { fileURLToPath as __fileURLToPath } from 'node:url';
3
- import { dirname as __dirname_ } from 'node:path';
4
- const require = __createRequire(import.meta.url);
5
- const __filename = __fileURLToPath(import.meta.url);
6
- const __dirname = __dirname_(__filename);
7
- import{RULE_ENVIRONMENTS}from"./chunk-J6O6JW2K.js";import{AGENT_STATUS}from"./chunk-DDLM6CIQ.js";function writeConfigJson(client,{project,bare,envelope,message,next}){if(!client.nonInteractive){client.stdout.write(`${JSON.stringify(bare,null,2)}
8
- `);return}client.stdout.write(`${JSON.stringify({status:AGENT_STATUS.OK,projectId:project.id,projectName:project.name,...envelope,message,next},null,2)}
9
- `)}var RULE_LIMIT=10,MIN_SAMPLE_RATE=1,MAX_SAMPLE_RATE=100;function isRuleEnvironment(value){return RULE_ENVIRONMENTS.includes(value)}var ENVIRONMENT_ERROR=`\`environment\` must be one of: ${RULE_ENVIRONMENTS.join(", ")}.`,RATE_ERROR=`\`rate\` must be a whole number from ${MIN_SAMPLE_RATE} to ${MAX_SAMPLE_RATE}.`,EMPTY_PATH_ERROR="`requestPath` cannot be empty.";function parseSampleRate(value){if(!/^\d+$/.test(value.trim()))return;let rate=Number(value);return rate>=MIN_SAMPLE_RATE&&rate<=MAX_SAMPLE_RATE?rate:void 0}function toRow(rule){return{environment:rule.env??"any",requestPath:rule.requestPath??null,sampleRate:Math.round(rule.rate*100)}}function toApiRate(sampleRate){return sampleRate/100}function toRule(row){return{type:"head_sampling",rate:toApiRate(row.sampleRate),...row.environment==="any"?{}:{env:row.environment},...row.requestPath===null?{}:{requestPath:row.requestPath}}}var ALL_PATHS_LABEL="(all paths)";function formatPath(requestPath){return requestPath??ALL_PATHS_LABEL}function formatRate(sampleRate){return`${sampleRate}%`}function formatRuleTarget(environment,requestPath){return`${environment} ${formatPath(requestPath)}`}function formatRuleLine(row){return`${formatRuleTarget(row.environment,row.requestPath)} ${formatRate(row.sampleRate)}`}var COMMAND_WORD_COUNT=3;function subcommandArguments(positional){return positional.slice(COMMAND_WORD_COUNT)}function hasSameKey(a,b){return a.environment===b.environment&&a.requestPath===b.requestPath}async function readTracingConfig({client,teamId,projectId,projectName}){let config=await client.fetch(`/v1/drains/tracing/config?${new URLSearchParams({projectId})}`,{accountId:teamId}),sampling=config.enabled&&config.sampling.length===0?[{type:"head_sampling",rate:1}]:config.sampling;return{project:{id:projectId,name:projectName},enabled:config.enabled,entries:sampling.map(rule=>({rule,row:toRow(rule)}))}}async function writeSamplingRules({client,teamId,projectId,rules}){await client.fetch(`/v1/drains/tracing/config?${new URLSearchParams({projectId})}`,{accountId:teamId,method:"PUT",body:{enabled:rules.length>0,...rules.length>0?{sampling:rules}:{}}})}export{writeConfigJson,RULE_LIMIT,isRuleEnvironment,ENVIRONMENT_ERROR,RATE_ERROR,EMPTY_PATH_ERROR,parseSampleRate,toApiRate,toRule,formatPath,formatRate,formatRuleTarget,formatRuleLine,subcommandArguments,hasSameKey,readTracingConfig,writeSamplingRules};
@@ -1,7 +0,0 @@
1
- import { createRequire as __createRequire } from 'node:module';
2
- import { fileURLToPath as __fileURLToPath } from 'node:url';
3
- import { dirname as __dirname_ } from 'node:path';
4
- const require = __createRequire(import.meta.url);
5
- const __filename = __fileURLToPath(import.meta.url);
6
- const __dirname = __dirname_(__filename);
7
- import{isNativeBinaryInstall}from"./chunk-NWGBDBZI.js";import{require_lib}from"./chunk-JIGCN5QS.js";import{packageName}from"./chunk-JESNVRVR.js";import{__toESM}from"./chunk-BZENIQ7N.js";var import_fs_extra=__toESM(require_lib(),1);import{join as join2,sep}from"path";import{execFile}from"child_process";import{tmpdir}from"node:os";import{resolve}from"node:path";var trustedUpgradeEnvironment=Object.freeze({...process.env}),trustedUpgradeDirectory=resolve(tmpdir());import{join}from"path";var packageManagers={npm:{metadataArgs:specifier=>["view",specifier,"version","--json","--global"],installArgs:specifier=>["i","-g",specifier],releaseAgeBypassArgs:["--min-release-age=0"],globalDetection:{args:["root","-g"],packageDir:(root,pkg)=>join(root,pkg)}},pnpm:{metadataArgs:specifier=>["view",specifier,"version","--json"],installArgs:specifier=>["i","-g",specifier],releaseAgeBypassArgs:["--config.minimumReleaseAge=0"],globalDetection:{args:pkg=>["list","-g",pkg,"--depth=0","--json"],packageDir:(output,pkg)=>{try{let projects=JSON.parse(output),path=(Array.isArray(projects)?projects[0]:projects)?.dependencies?.[pkg]?.path;return typeof path=="string"?path:void 0}catch{return}}}},yarn:{metadataArgs:specifier=>["info",specifier.endsWith("@latest")?specifier.slice(0,-7):specifier,"version","--json"],installArgs:specifier=>["global","add",specifier],releaseAgeBypassArgs:[],globalDetection:{args:["--silent","global","dir"],packageDir:(root,pkg)=>join(root,"node_modules",pkg)}},bun:{metadataArgs:specifier=>["info",specifier,"version","--json","--global"],installArgs:specifier=>["add","-g",specifier],releaseAgeBypassArgs:[],globalDetection:{args:["pm","bin","-g"],binaryNames:["vercel","vc"]}}};function getUpgradePackageManager(name){return packageManagers[name]}var UnsupportedUpgradeInstallError=class extends Error{},globalCliTypes=["npm","pnpm","yarn","bun"];function throwIfAborted(signal){if(signal?.aborted)throw signal.reason instanceof Error?signal.reason:new Error("Package manager detection was aborted")}async function getPackageManagerGlobalRoot(cliType,pkg,env=trustedUpgradeEnvironment,signal){try{let detectionArgs=getUpgradePackageManager(cliType).globalDetection.args;return(await new Promise((resolve2,reject)=>{execFile(cliType,typeof detectionArgs=="function"?detectionArgs(pkg):detectionArgs,{encoding:"utf8",windowsHide:!0,cwd:trustedUpgradeDirectory,timeout:15e3,env:{...env},signal},(error,stdout2)=>{error?reject(error):resolve2(stdout2)})})).trim()||null}catch{return throwIfAborted(signal),null}}async function detectGlobalPackageManager(installPath,pkg,cliTypes=globalCliTypes,env=trustedUpgradeEnvironment,signal){for(let cliType of cliTypes){throwIfAborted(signal);let root=await getPackageManagerGlobalRoot(cliType,pkg,env,signal);if(!root)continue;let detection=getUpgradePackageManager(cliType).globalDetection;if(detection.packageDir)try{let packageDir=detection.packageDir(root,pkg);if(!packageDir)continue;let resolvedPackageDir=await(0,import_fs_extra.realpath)(packageDir);if(installPath===resolvedPackageDir||installPath.startsWith(resolvedPackageDir+sep))return cliType}catch{}for(let binary of detection.binaryNames||[])try{let target=await(0,import_fs_extra.realpath)(join2(root,binary));if(target===installPath||target.startsWith(installPath+sep)||installPath.startsWith(target+sep))return cliType;let entrypoint=await(0,import_fs_extra.realpath)(process.argv[1]);if(!isNativeBinaryInstall()&&target===entrypoint)return cliType}catch{}}return null}async function resolveInstall(env=trustedUpgradeEnvironment,signal){throwIfAborted(signal);let nativeExecutable=isNativeBinaryInstall()&&env.VERCEL_CLI_PACKAGE_EXECUTABLE,resolvedNativeExecutable=nativeExecutable&&await(0,import_fs_extra.realpath)(nativeExecutable).catch(()=>null),entrypoint=resolvedNativeExecutable&&resolvedNativeExecutable===await(0,import_fs_extra.realpath)(process.execPath).catch(()=>null)?env.VERCEL_CLI_PACKAGE_ENTRYPOINT:process.argv[1],installPath=entrypoint&&await(0,import_fs_extra.realpath)(entrypoint).catch(()=>null);if(!installPath)throw new UnsupportedUpgradeInstallError("Could not resolve this Vercel CLI installation. Update it with the package manager that installed it.");let packageManager=await detectGlobalPackageManager(installPath,packageName,globalCliTypes,env,signal);if(!packageManager)throw new UnsupportedUpgradeInstallError("Could not detect a supported global npm, pnpm, Yarn, or Bun installation of Vercel CLI. Update it with the package manager that installed it.");return{packageManager,global:!0,assumed:!1}}async function isGlobal(){try{return await resolveInstall(),!0}catch{return!1}}async function getUpdateCommandInfo(env=trustedUpgradeEnvironment,signal){let{packageManager}=await resolveInstall(env,signal),args=getUpgradePackageManager(packageManager).installArgs(`${packageName}@latest`),allowBuild=pnpmAllowBuildFlag(packageManager,"esbuild");return{command:`${packageManager} ${args.join(" ")}${allowBuild}`,global:!0,packageManager,assumed:!1}}function pnpmAllowBuildFlag(cliType,pkg){return cliType==="pnpm"?` --allow-build=${pkg}`:""}async function getUpdateCommand(){return(await getUpdateCommandInfo()).command}export{trustedUpgradeEnvironment,trustedUpgradeDirectory,getUpgradePackageManager,isGlobal,getUpdateCommandInfo,getUpdateCommand};
@@ -1,7 +0,0 @@
1
- import { createRequire as __createRequire } from 'node:module';
2
- import { fileURLToPath as __fileURLToPath } from 'node:url';
3
- import { dirname as __dirname_ } from 'node:path';
4
- const require = __createRequire(import.meta.url);
5
- const __filename = __fileURLToPath(import.meta.url);
6
- const __dirname = __dirname_(__filename);
7
- import{allOption,confirmOption,formatOption,jsonOption,limitOption,nextOption,yesOption}from"./chunk-MI7W4QMV.js";import{packageName}from"./chunk-JESNVRVR.js";var listCommand={name:"list",aliases:["ls"],description:"List deployments.",arguments:[{name:"app",required:!1}],options:[allOption,{name:"meta",description:"Filter deployments by metadata (e.g.: `-m KEY=value`). Can appear many times.",argument:"KEY=VALUE",shorthand:"m",type:[String],deprecated:!1},{name:"policy",description:"See deployments with provided Deployment Retention policies (e.g.: `-p KEY=value`). Can appear many times.",argument:"KEY=VALUE",shorthand:"p",type:[String],deprecated:!1},{name:"environment",description:"",argument:"TARGET",shorthand:null,type:String,deprecated:!1},{name:"status",description:"Filter deployments by their status. Can be comma-separated for multiple statuses (e.g.: `--status BUILDING,READY`)",argument:"STATUS",shorthand:"s",type:String,deprecated:!1},nextOption,limitOption,{name:"prod",shorthand:null,type:Boolean,deprecated:!1},yesOption,confirmOption,formatOption,jsonOption],examples:[{name:"List all deployments for the currently linked project",value:`${packageName} list`},{name:"List all deployments across all projects",value:`${packageName} list --all`},{name:"List all deployments for the project `my-app`",value:`${packageName} list my-app`},{name:"Filter deployments by metadata",value:`${packageName} list -m key1=value1 -m key2=value2`},{name:"Paginate deployments for a project, where `1584722256178` is the time in milliseconds since the UNIX epoch",value:`${packageName} list my-app --next 1584722256178`},{name:"Filter deployments by status",value:`${packageName} list --status READY`},{name:"Filter deployments by multiple statuses",value:`${packageName} list --status BUILDING,ERROR`}]};export{listCommand};
@@ -1,13 +0,0 @@
1
- import { createRequire as __createRequire } from 'node:module';
2
- import { fileURLToPath as __fileURLToPath } from 'node:url';
3
- import { dirname as __dirname_ } from 'node:path';
4
- const require = __createRequire(import.meta.url);
5
- const __filename = __fileURLToPath(import.meta.url);
6
- const __dirname = __dirname_(__filename);
7
- import{getScope}from"./chunk-GLH4PVMY.js";import{AGENT_REASON,AGENT_STATUS,buildCommandWithGlobalFlags,outputAgentError,shouldEmitNonInteractiveCommandError}from"./chunk-DDLM6CIQ.js";import{getOrgById}from"./chunk-JIGCN5QS.js";import{output_manager_default}from"./chunk-M774HRX5.js";async function printProjectNotFoundError(client,projectNameOrId,commandName,orgId){let contextName;try{orgId?contextName=(await getOrgById(client,orgId))?.slug??orgId:contextName=(await getScope(client)).contextName}catch(err){contextName=orgId,output_manager_default.debug(`Scope lookup failed during error reporting: ${err}`)}let scopeClause=contextName?` (${contextName})`:"",headline=`Project "${projectNameOrId}" was not found in the current scope${scopeClause}.`;if(output_manager_default.error(`${headline}
8
-
9
- If it lives in a different team or account:
10
- \u2022 Retry with \`--scope <team-slug|your-username>\`, or
11
- \u2022 Run \`vercel switch <team-slug|your-username>\` to change scope.
12
-
13
- List accessible teams with \`vercel teams ls\`.`),!shouldEmitNonInteractiveCommandError(client))return;let retryWithScope=buildCommandWithGlobalFlags(client.argv,`${commandName} --project ${projectNameOrId} --scope <team-slug>`);outputAgentError(client,{status:AGENT_STATUS.ERROR,reason:AGENT_REASON.PROJECT_NOT_FOUND,message:`${headline} If it lives in a different team or account, retry with --scope <team-slug|your-username> or run \`vercel switch <team-slug|your-username>\` to change scope.`,...contextName?{scope:contextName}:{},next:[{command:"vercel teams ls",when:"list accessible teams"},{command:retryWithScope,when:"retry with a specific team"},{command:"vercel switch <team-slug>",when:"change the default scope"}]},1)}export{printProjectNotFoundError};
@@ -1,7 +0,0 @@
1
- import { createRequire as __createRequire } from 'node:module';
2
- import { fileURLToPath as __fileURLToPath } from 'node:url';
3
- import { dirname as __dirname_ } from 'node:path';
4
- const require = __createRequire(import.meta.url);
5
- const __filename = __fileURLToPath(import.meta.url);
6
- const __dirname = __dirname_(__filename);
7
- import{quoteArg}from"./chunk-DDLM6CIQ.js";import{arg_common_default,stripSensitiveAuthArgs}from"./chunk-MI7W4QMV.js";import{packageName}from"./chunk-JESNVRVR.js";import{__commonJS,__toESM}from"./chunk-BZENIQ7N.js";var require_arg=__commonJS({"../../node_modules/.pnpm/arg@5.0.0/node_modules/arg/index.js"(exports,module){var flagSymbol=Symbol("arg flag"),ArgError=class _ArgError extends Error{constructor(msg,code){super(msg),this.name="ArgError",this.code=code,Object.setPrototypeOf(this,_ArgError.prototype)}};function arg2(opts,{argv=process.argv.slice(2),permissive=!1,stopAtPositional=!1}={}){if(!opts)throw new ArgError("argument specification object is required","ARG_CONFIG_NO_SPEC");let result={_:[]},aliases={},handlers={};for(let key of Object.keys(opts)){if(!key)throw new ArgError("argument key cannot be an empty string","ARG_CONFIG_EMPTY_KEY");if(key[0]!=="-")throw new ArgError(`argument key must start with '-' but found: '${key}'`,"ARG_CONFIG_NONOPT_KEY");if(key.length===1)throw new ArgError(`argument key must have a name; singular '-' keys are not allowed: ${key}`,"ARG_CONFIG_NONAME_KEY");if(typeof opts[key]=="string"){aliases[key]=opts[key];continue}let type=opts[key],isFlag=!1;if(Array.isArray(type)&&type.length===1&&typeof type[0]=="function"){let[fn]=type;type=(value,name,prev=[])=>(prev.push(fn(value,name,prev[prev.length-1])),prev),isFlag=fn===Boolean||fn[flagSymbol]===!0}else if(typeof type=="function")isFlag=type===Boolean||type[flagSymbol]===!0;else throw new ArgError(`type missing or not a function or valid array type: ${key}`,"ARG_CONFIG_VAD_TYPE");if(key[1]!=="-"&&key.length>2)throw new ArgError(`short argument keys (with a single hyphen) must have only one character: ${key}`,"ARG_CONFIG_SHORTOPT_TOOLONG");handlers[key]=[type,isFlag]}for(let i=0,len=argv.length;i<len;i++){let wholeArg=argv[i];if(stopAtPositional&&result._.length>0){result._=result._.concat(argv.slice(i));break}if(wholeArg==="--"){result._=result._.concat(argv.slice(i+1));break}if(wholeArg.length>1&&wholeArg[0]==="-"){let separatedArguments=wholeArg[1]==="-"||wholeArg.length===2?[wholeArg]:wholeArg.slice(1).split("").map(a=>`-${a}`);for(let j=0;j<separatedArguments.length;j++){let arg3=separatedArguments[j],[originalArgName,argStr]=arg3[1]==="-"?arg3.split(/=(.*)/,2):[arg3,void 0],argName=originalArgName;for(;argName in aliases;)argName=aliases[argName];if(!(argName in handlers))if(permissive){result._.push(arg3);continue}else throw new ArgError(`unknown or unexpected option: ${originalArgName}`,"ARG_UNKNOWN_OPTION");let[type,isFlag]=handlers[argName];if(!isFlag&&j+1<separatedArguments.length)throw new ArgError(`option requires argument (but was followed by another short argument): ${originalArgName}`,"ARG_MISSING_REQUIRED_SHORTARG");if(isFlag)result[argName]=type(!0,argName,result[argName]);else if(argStr===void 0){if(argv.length<i+2||argv[i+1].length>1&&argv[i+1][0]==="-"&&!(argv[i+1].match(/^-?\d*(\.(?=\d))?\d*$/)&&(type===Number||typeof BigInt<"u"&&type===BigInt))){let extended=originalArgName===argName?"":` (alias for ${argName})`;throw new ArgError(`option requires argument: ${originalArgName}${extended}`,"ARG_MISSING_REQUIRED_LONGARG")}result[argName]=type(argv[i+1],argName,result[argName]),++i}else result[argName]=type(argStr,argName,result[argName])}}else result._.push(wholeArg)}return result}arg2.flag=fn=>(fn[flagSymbol]=!0,fn);arg2.COUNT=arg2.flag((v,name,existingCount)=>(existingCount||0)+1);arg2.ArgError=ArgError;module.exports=arg2}});var import_arg=__toESM(require_arg(),1);function suggestCorrection(input,choices){if(input.replace(/^-+/,"").length<3||choices.includes(input))return;let matches=[...new Set(choices)].filter(choice=>{if(Math.abs(input.length-choice.length)>1)return!1;let i=0;for(;i<input.length&&input[i]===choice[i];)i++;return input.length===choice.length?input.slice(i+1)===choice.slice(i+1)||input[i]===choice[i+1]&&input[i+1]===choice[i]&&input.slice(i+2)===choice.slice(i+2):input.length>choice.length?input.slice(i+1)===choice.slice(i):input.slice(i)===choice.slice(i+1)});return matches.length===1?matches[0]:void 0}var SAFE_VALUE_FLAGS=new Set(["--cwd","--scope","--team","-S","-T","--project","-p","--format","--environment","--since","--until","--limit"]),READ_COMMANDS=new Set(["inspect","list","ls","schema","whoami"]);function buildCorrectedCommand(argv,from,to,flagsSpecification={}){let corrected=argv.slice(2),spec={...arg_common_default(),...flagsSpecification},valuelessFlags=new Set,takesValue=new Set;for(let[name,value]of Object.entries(spec))((typeof value=="string"?spec[value]:value)===Boolean?valuelessFlags:takesValue).add(name);for(let i=0;i<corrected.length;i++){let value=corrected[i];if(value==="--")break;if(value===from||value.startsWith(`${from}=`)){corrected[i]=to+value.slice(from.length);break}takesValue.has(value)&&i++}let args=stripSensitiveAuthArgs(corrected).filter(arg2=>!/^-t[^-=]/.test(arg2)),out=[],positionals=0,readCommand=!1;for(let i=0;i<args.length;i++){let value=args[i];if(value==="--"){out.push("--","<argument>");break}if(value.startsWith("-")){if(/^-[A-Za-z][^=].+/.test(value)&&!value.startsWith("--")){let name2=value.slice(0,2);out.push(name2,SAFE_VALUE_FLAGS.has(name2)?value.slice(2):"<value>");continue}let equals=value.indexOf("="),name=equals<0?value:value.slice(0,equals);equals>=0?out.push(`${name}=${SAFE_VALUE_FLAGS.has(name)||valuelessFlags.has(name)&&/^(true|false)$/.test(value.slice(equals+1))?value.slice(equals+1):"<value>"}`):(out.push(name),!valuelessFlags.has(name)&&i+1<args.length&&(takesValue.has(name)||!args[i+1].startsWith("-"))&&(i++,out.push(SAFE_VALUE_FLAGS.has(name)?args[i]:"<value>")))}else positionals++,positionals<=2&&(readCommand||=READ_COMMANDS.has(value)),out.push(positionals<=2||readCommand?value:"<argument>")}return[packageName,...out].map(quoteArg).join(" ")}var argumentErrors=new WeakSet;function isArgumentError(error){return error instanceof Error&&argumentErrors.has(error)}function parseWithSuggestions(args,spec,options){try{return(0,import_arg.default)(spec,{...options,argv:args})}catch(error){if(error instanceof Error&&"code"in error&&["ARG_UNKNOWN_OPTION","ARG_MISSING_REQUIRED_LONGARG","ARG_MISSING_REQUIRED_SHORTARG"].includes(String(error.code))){let err=error,option=/(?:unknown or unexpected option|option requires argument(?: \([^)]*\))?): (--?[A-Za-z0-9-]+)(?: \(alias for --?[A-Za-z0-9-]+\))?$/.exec(err.message)?.[1];option&&(argumentErrors.add(err),err.invalidOption=option,err.allowedOptions=Object.keys(spec).filter(name=>name.startsWith("--")).sort(),err.code==="ARG_UNKNOWN_OPTION"&&(err.suggestedOption=suggestCorrection(option,err.allowedOptions)),err.flagsSpecification=spec)}throw error}}function getArgs(argv,argsOptions,argOptions={}){return parseWithSuggestions(argv,Object.assign({},arg_common_default(),argsOptions),argOptions)}function parseArguments(args,flagsSpecification,parserOptions={}){let{_:positional,...rest}=parseWithSuggestions(args,Object.assign({},arg_common_default(),flagsSpecification),parserOptions);return{args:positional,flags:rest}}function takeCommand(argv,flagsSpecification){let{_:positional}=parseWithSuggestions(argv,Object.assign({},arg_common_default(),flagsSpecification),{stopAtPositional:!0}),index=argv.length-positional.length;return{command:positional[0],args:[...argv.slice(0,index),...argv.slice(index+1)]}}export{require_arg,suggestCorrection,buildCorrectedCommand,isArgumentError,getArgs,parseArguments,takeCommand};
@@ -1,7 +0,0 @@
1
- import { createRequire as __createRequire } from 'node:module';
2
- import { fileURLToPath as __fileURLToPath } from 'node:url';
3
- import { dirname as __dirname_ } from 'node:path';
4
- const require = __createRequire(import.meta.url);
5
- const __filename = __fileURLToPath(import.meta.url);
6
- const __dirname = __dirname_(__filename);
7
- import{getEnvTargetPlaceholder}from"./chunk-CMKLX4DC.js";import{projectOption,yesOption}from"./chunk-MI7W4QMV.js";import{packageName}from"./chunk-JESNVRVR.js";var buildCommand={name:"build",aliases:[],description:"Build the project.",arguments:[],options:[{name:"prod",description:"Build a production deployment",shorthand:null,type:Boolean,deprecated:!1},{name:"target",shorthand:null,type:String,argument:"TARGET",deprecated:!1,description:"Specify the target environment"},{name:"output",description:"Directory where built assets will be written to",shorthand:null,argument:"DIR",type:String,deprecated:!1},{...yesOption,description:"Skip the confirmation prompt about pulling environment variables and project settings when not found locally"},{name:"standalone",description:"Create a standalone build with all dependencies inlined into function output folders",shorthand:null,type:Boolean,deprecated:!1},{name:"id",description:"Deployment ID to pull environment variables from (e.g. dpl_xxx)",shorthand:null,type:String,argument:"ID",deprecated:!1},projectOption],examples:[{name:"Build the project",value:`${packageName} build`},{name:"Build the project in a specific directory",value:`${packageName} build --cwd ./path-to-project`},{name:"Build with deployment-scoped environment variables",value:`${packageName} build --id dpl_xxx`}]};var pullCommand={name:"pull",aliases:[],description:"Pull Environment Variables and project settings into .vercel",arguments:[{name:"project-path",required:!1}],options:[{name:"environment",description:"Deployment environment [development]",argument:"TARGET",shorthand:null,type:String,deprecated:!1},{name:"git-branch",description:"Specify the Git branch to pull specific Environment Variables for",argument:"NAME",shorthand:null,type:String,deprecated:!1},{name:"prod",shorthand:null,type:Boolean,deprecated:!1},{...yesOption,description:"Skip questions when setting up new project using default scope and settings"},projectOption],examples:[{name:"Pull the latest Environment Variables and Project Settings from the cloud",value:`${packageName} pull`},{name:"Pull the latest Environment Variables and Project Settings from the cloud targeting a directory",value:`${packageName} pull ./path-to-project`},{name:"Pull for a specific environment",value:`${packageName} pull --environment=${getEnvTargetPlaceholder()}`},{name:"Pull for a preview feature branch",value:`${packageName} pull --environment=preview --git-branch=feature-branch`},{name:"Pull Environment Variables into an application env file with `vercel env pull`",value:`${packageName} env pull`}]};export{buildCommand,pullCommand};
@@ -1,9 +0,0 @@
1
- import { createRequire as __createRequire } from 'node:module';
2
- import { fileURLToPath as __fileURLToPath } from 'node:url';
3
- import { dirname as __dirname_ } from 'node:path';
4
- const require = __createRequire(import.meta.url);
5
- const __filename = __fileURLToPath(import.meta.url);
6
- const __dirname = __dirname_(__filename);
7
- import{formatOption,jsonOption,projectOption,yesOption}from"./chunk-MI7W4QMV.js";import{packageName}from"./chunk-JESNVRVR.js";var builtInBody={type:"built-in",name:"Production server errors",triggers:{mode:"selected",items:[{type:"error_anomaly",filter:"statusGroup:5xx AND route:/api/*"}]},matchMinimumSeverityLevel:"high"},patchBody={name:"Critical production errors",matchMinimumSeverityLevel:"critical"},authoringReference={title:"Authoring reference",body:["vercel alerts rules schema --type built-in"]},rulesAddHelpSections=[{title:"Scope",body:["Provide ruleScope in the body or use a scope flag, not both.","--project maps to one included project.","--all maps to every project in the team."]},{title:"Built-in body (rule.json)",body:[...JSON.stringify(builtInBody,null,2).split(`
8
- `),"","vercel alerts rules add --project my-app --body ./rule.json"]},authoringReference],rulesUpdateHelpSections=[{title:"Update body",body:["Include only the fields to change. type is optional and inferred from the stored rule.","Use --project or --all to change scope with or without --body.","Do not combine a ruleScope field in the body with --project or --all.","--all moves the rule to team-wide scope."]},{title:"Partial body (patch.json)",body:[...JSON.stringify(patchBody,null,2).split(`
9
- `),"","vercel alerts rules update ar_abc123 --body ./patch.json","vercel alerts rules update ar_abc123 --project my-app"]},authoringReference];var projectScopeOption={...projectOption,shorthand:"p",description:"Use a project by name or ID"},listAllOption={name:"all",shorthand:"a",type:Boolean,deprecated:!1,description:"List all accessible rules in the selected team"},mutationAllOption={...listAllOption,description:"Apply the rule to all projects in the selected team"},deprecatedItemScopeOptions=[{...projectScopeOption,deprecated:!0},{...listAllOption,deprecated:!0}],bodyOption={name:"body",shorthand:null,type:String,argument:"PATH",deprecated:!1,description:"Read the alert rule body from a JSON file"},rulesLsSubcommand={name:"ls",aliases:["list"],default:!0,description:"List alert rules for a project or team",arguments:[],options:[projectScopeOption,listAllOption,{name:"type",shorthand:null,type:[String],argument:"TYPE",deprecated:!1,description:"Filter by rule type"},formatOption,jsonOption],examples:[{name:"List rules affecting the linked project",value:`${packageName} alerts rules ls`},{name:"List all rules in the selected team",value:`${packageName} alerts rules ls --all`},{name:"Write JSON output",value:`${packageName} alerts rules ls --all --json`}]},rulesSchemaSubcommand={name:"schema",aliases:[],description:"Show alert rule request fields and examples",arguments:[],options:[{name:"type",shorthand:null,type:String,argument:"TYPE",deprecated:!1,description:"Rule type to describe"},formatOption,jsonOption],examples:[{name:"List supported rule types",value:`${packageName} alerts rules schema`},{name:"Show the built-in rule schema",value:`${packageName} alerts rules schema --type built-in`}]},rulesAddSubcommand={name:"add",aliases:["create"],description:"Create an alert rule from a JSON body",helpSections:rulesAddHelpSections,arguments:[],options:[projectScopeOption,mutationAllOption,formatOption,jsonOption,bodyOption],examples:[{name:"Create a project-scoped rule",value:`${packageName} alerts rules add --project my-app --body ./rule.json`},{name:"Create a team-wide built-in rule",value:`${packageName} alerts rules add --all --body ./rule.json`}]},rulesInspectSubcommand={name:"inspect",aliases:["get"],description:"Show one alert rule by ID",arguments:[{name:"ruleId",required:!0}],options:[...deprecatedItemScopeOptions,formatOption,jsonOption],examples:[{name:"Inspect a rule",value:`${packageName} alerts rules inspect ar_abc123`},{name:"Write JSON output",value:`${packageName} alerts rules inspect ar_abc123 --json`}]},rulesRmSubcommand={name:"remove",aliases:["rm","delete"],description:"Delete an alert rule",arguments:[{name:"ruleId",required:!0}],options:[...deprecatedItemScopeOptions,formatOption,jsonOption,yesOption],examples:[{name:"Delete with confirmation",value:`${packageName} alerts rules remove ar_abc123`},{name:"Delete without a prompt",value:`${packageName} alerts rules remove ar_abc123 --yes`}]},rulesUpdateSubcommand={name:"update",aliases:["patch"],description:"Patch an alert rule or change its scope",helpSections:rulesUpdateHelpSections,arguments:[{name:"ruleId",required:!0}],options:[projectScopeOption,mutationAllOption,formatOption,jsonOption,{...bodyOption,description:"Read the partial update body from a JSON file"}],examples:[{name:"Update fields from a file",value:`${packageName} alerts rules update ar_abc123 --body ./patch.json`},{name:"Move a rule to a project",value:`${packageName} alerts rules update ar_abc123 --project my-app`}]},notificationTargetOptions=[{name:"webhook",shorthand:null,type:String,argument:"WEBHOOK_ID",deprecated:!1,description:"Select an account webhook by ID"},{name:"slack-channel",shorthand:null,type:String,argument:"CHANNEL_ID",deprecated:!1,description:"Select a Slack channel by ID"},{name:"slack-installation-id",shorthand:null,type:String,argument:"INSTALLATION_ID",deprecated:!1,description:"Slack installation ID. Optional only when the team has exactly one completed Slack installation."}],criticalOnlyOption={name:"critical-only",shorthand:null,type:Boolean,deprecated:!1,description:"Notify only when Vercel Agent escalates an alert to Critical"},noCriticalOnlyOption={name:"no-critical-only",shorthand:null,type:Boolean,deprecated:!1,description:"Deliver every alert matched by the rule"},rulesNotificationsLsSubcommand={name:"ls",aliases:["list"],default:!0,description:"List notification destinations for all readable rules or one alert rule",arguments:[{name:"ruleId",required:!1}],options:[formatOption,jsonOption],examples:[{name:"List notification destinations for all readable rules",value:`${packageName} alerts rules notifications ls`},{name:"List notification destinations for one rule",value:`${packageName} alerts rules notifications ls ar_abc123`},{name:"Write JSON output",value:`${packageName} alerts rules notifications ar_abc123 --json`}]},rulesNotificationsLinkSubcommand={name:"link",aliases:[],description:"Link a Slack channel or account webhook to an alert rule",arguments:[{name:"<ruleId>",required:!0}],options:[...notificationTargetOptions,criticalOnlyOption,formatOption,jsonOption],examples:[{name:"Link a Slack channel",value:`${packageName} alerts rules notifications link ar_abc123 --slack-channel C123`},{name:"Link a Slack channel from a specific installation",value:`${packageName} alerts rules notifications link ar_abc123 --slack-channel C123 --slack-installation-id icfg_abc123`},{name:"Link a webhook",value:`${packageName} alerts rules notifications link ar_abc123 --webhook wh_abc123`},{name:"Link a Critical-only webhook",value:`${packageName} alerts rules notifications link ar_abc123 --webhook wh_abc123 --critical-only`}]},rulesNotificationsUpdateSubcommand={name:"update",aliases:["patch"],description:"Update a notification destination's delivery setting",arguments:[{name:"<ruleId>",required:!0}],options:[...notificationTargetOptions,criticalOnlyOption,noCriticalOnlyOption,formatOption,jsonOption],examples:[{name:"Restrict a Slack channel to Critical alerts",value:`${packageName} alerts rules notifications update ar_abc123 --slack-channel C123 --critical-only`},{name:"Restore delivery for every alert matched by the rule",value:`${packageName} alerts rules notifications update ar_abc123 --webhook wh_abc123 --no-critical-only`}]},rulesNotificationsUnlinkSubcommand={name:"unlink",aliases:[],description:"Unlink a Slack channel or account webhook from an alert rule",arguments:[{name:"<ruleId>",required:!0}],options:[...notificationTargetOptions,formatOption,jsonOption],examples:[{name:"Unlink a Slack channel",value:`${packageName} alerts rules notifications unlink ar_abc123 --slack-channel C123`},{name:"Unlink a webhook",value:`${packageName} alerts rules notifications unlink ar_abc123 --webhook wh_abc123`}]},rulesNotificationsAggregateCommand={name:"notifications",aliases:[],description:"List and manage linked Slack and webhook destinations for alert rules",arguments:[],subcommands:[rulesNotificationsLsSubcommand,rulesNotificationsLinkSubcommand,rulesNotificationsUpdateSubcommand,rulesNotificationsUnlinkSubcommand],options:[formatOption,jsonOption],examples:[{name:"List destinations for all readable rules",value:`${packageName} alerts rules notifications`},{name:"List destinations for one rule",value:`${packageName} alerts rules notifications ar_abc123`},{name:"Link Slack with the team's only installation",value:`${packageName} alerts rules notifications link ar_abc123 --slack-channel C123`}]},rulesAggregateCommand={name:"rules",aliases:[],description:"Create, inspect, list, update, and delete alert rules and manage their notification destinations",arguments:[],subcommands:[rulesLsSubcommand,rulesSchemaSubcommand,rulesAddSubcommand,rulesInspectSubcommand,rulesRmSubcommand,rulesUpdateSubcommand,rulesNotificationsAggregateCommand],options:[],examples:[{name:"List rules for the linked project",value:`${packageName} alerts rules ls`},{name:"Add a rule",value:`${packageName} alerts rules add --project my-app --body ./rule.json`},{name:"Inspect a rule",value:`${packageName} alerts rules inspect ar_abc123`},{name:"Update a rule",value:`${packageName} alerts rules update ar_abc123 --body ./patch.json`},{name:"Delete a rule",value:`${packageName} alerts rules remove ar_abc123`},{name:"List notification destinations for a rule",value:`${packageName} alerts rules notifications ar_abc123`}]};export{rulesLsSubcommand,rulesSchemaSubcommand,rulesAddSubcommand,rulesInspectSubcommand,rulesRmSubcommand,rulesUpdateSubcommand,rulesNotificationsLsSubcommand,rulesNotificationsLinkSubcommand,rulesNotificationsUpdateSubcommand,rulesNotificationsUnlinkSubcommand,rulesNotificationsAggregateCommand,rulesAggregateCommand};
@@ -1,9 +0,0 @@
1
- import { createRequire as __createRequire } from 'node:module';
2
- import { fileURLToPath as __fileURLToPath } from 'node:url';
3
- import { dirname as __dirname_ } from 'node:path';
4
- const require = __createRequire(import.meta.url);
5
- const __filename = __fileURLToPath(import.meta.url);
6
- const __dirname = __dirname_(__filename);
7
- import{emitAlertsScopeError,resolveAlertsScope}from"./chunk-PTI3TP7P.js";import{getExitCodeForErrorCode,handleValidationError,validateAllProjectMutualExclusivity}from"./chunk-ZQKDO5PL.js";import{isJSONObject}from"./chunk-V3RDOM3U.js";import{getScope}from"./chunk-GLH4PVMY.js";import{AGENT_REASON,buildCommandWithGlobalFlags,getExitCodeForReason,outputAgentError}from"./chunk-DDLM6CIQ.js";import{getProjectByNameOrId}from"./chunk-JIGCN5QS.js";import{ProjectNotFound,isAPIError}from"./chunk-XSDAUM4F.js";import{output_manager_default}from"./chunk-M774HRX5.js";async function resolveRulesTeam(client,jsonOutput){let{team}=await getScope(client,{resolveLocalScope:!0});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:"Alert rules 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="alerts rules 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,"alerts rules --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}import{readFileSync}from"fs";import{resolve}from"path";function rulesCollectionPath(teamId,options={}){let query=new URLSearchParams({teamId});return options.limit!==void 0&&query.set("limit",String(options.limit)),options.cursor&&query.set("cursor",options.cursor),options.projectId&&query.set("projectId",options.projectId),options.type&&query.set("type",options.type),`/alerts/v3/alert-rules?${query.toString()}`}function rulesItemPath(teamId,ruleId){let query=new URLSearchParams({teamId});return`/alerts/v3/alert-rules/${encodeURIComponent(ruleId)}?${query.toString()}`}function ruleNotificationsPath(teamId,ruleId){let query=new URLSearchParams({teamId});return`/alerts/v3/alert-rules/${encodeURIComponent(ruleId)}/notifications?${query.toString()}`}function rulesNotificationsPath(teamId,options={}){let query=new URLSearchParams({teamId});return options.limit!==void 0&&query.set("limit",String(options.limit)),options.cursor&&query.set("cursor",options.cursor),`/alerts/v3/alert-rules/notifications?${query.toString()}`}function rulesNotificationLinksPath(teamId,ruleId){let query=new URLSearchParams({teamId});return`/alerts/v3/alert-rules/${encodeURIComponent(ruleId)}/notifications/links?${query.toString()}`}function rulesSchemaPath(teamId,type){let query=new URLSearchParams({teamId});return type&&query.set("type",type),`/alerts/v3/alert-rules/schema?${query.toString()}`}async function fetchRule(client,scope,ruleId){return(await client.fetch(rulesItemPath(scope.teamId,ruleId))).rule}function getIssues(error){return Array.isArray(error.issues)?error.issues.filter(issue=>isJSONObject(issue)&&typeof issue.path=="string"&&typeof issue.message=="string"):[]}function outputRulesError(client,jsonOutput,code,message,options={}){let issues=options.issues??[],issueSummary=issues.slice(0,5).map(issue=>`${issue.path||"body"}: ${issue.message}`).join("; "),exitCode=options.reason!==void 0?getExitCodeForReason(options.reason):getExitCodeForErrorCode(code);return outputAgentError(client,{status:"error",reason:options.reason??AGENT_REASON.INVALID_ARGUMENTS,message,hint:options.hint??(issueSummary||void 0)},exitCode),jsonOutput?client.stdout.write(`${JSON.stringify({error:{code,message,...issues.length?{issues}:{}}},null,2)}
8
- `):output_manager_default.fatal([message,...issues.map(issue=>` ${issue.path}: ${issue.message}`)].join(`
9
- `)),exitCode}function handleRulesApiError(client,err,jsonOutput){let message=err.status===401?"You do not have access to alert rules in this team. Ensure your role can manage Alert Rules, or pass --token and --scope.":err.status===403?err.serverMessage||"You do not have permission to manage alert rules in this team.":err.status>=500?`The alert rules endpoint failed (${err.status}). Re-run with --debug and share the x-vercel-id from the failed request.`:err.serverMessage||`API error (${err.status}).`;return outputRulesError(client,jsonOutput,err.code||"API_ERROR",message,{reason:err.status===401?"not_authorized":err.status===403?"forbidden":err.status===404?AGENT_REASON.NOT_FOUND:err.status===429?"rate_limited":AGENT_REASON.API_ERROR,issues:getIssues(err),hint:err.status===401||err.status===403?"Confirm the team with `vercel whoami`; use --scope <team-slug> if the rule belongs to another team.":void 0})}var LEGACY_BODY_FIELDS=["alertTypes","customAlert","queryJsonString"];function readRuleBody(client,bodyPath,jsonOutput){let raw;try{raw=readFileSync(resolve(client.cwd,bodyPath),"utf8")}catch{return outputRulesError(client,jsonOutput,"INVALID_ARGUMENTS",`Could not read --body file: ${bodyPath}`)}let parsed;try{parsed=JSON.parse(raw)}catch{return outputRulesError(client,jsonOutput,"INVALID_ARGUMENTS","Invalid JSON in --body file.")}return isJSONObject(parsed)?LEGACY_BODY_FIELDS.some(field=>Object.hasOwn(parsed,field))?outputRulesError(client,jsonOutput,"LEGACY_ALERT_RULE_BODY","This body uses the previous alert-rules shape. Rewrite it using the current schema.",{hint:"Run `vercel alerts rules schema --type built-in` for examples."}):parsed:outputRulesError(client,jsonOutput,"INVALID_ARGUMENTS","The --body file must contain a JSON object.")}function getBodyType(body){return body.type==="built-in"||body.type==="custom"?body.type:void 0}function emitRulesArgParseError(client,err,recoverWithProjectFlag){let message=err instanceof Error?err.message:String(err),projectFlagMissingArg=message.includes("--project")&&message.includes("requires argument");outputAgentError(client,{status:"error",reason:AGENT_REASON.INVALID_ARGUMENTS,message:projectFlagMissingArg?"`--project` requires a project name or id (for example `--project my-app`).":message,next:[{command:buildCommandWithGlobalFlags(client.argv,projectFlagMissingArg?recoverWithProjectFlag:"alerts rules --help"),when:projectFlagMissingArg?"Retry with a project name or id":"See valid `alerts rules` subcommands"}]},2)}export{resolveRulesTeam,resolveRulesProject,parseRulesFlagsAndScope,rulesCollectionPath,rulesItemPath,ruleNotificationsPath,rulesNotificationsPath,rulesNotificationLinksPath,rulesSchemaPath,fetchRule,outputRulesError,handleRulesApiError,readRuleBody,getBodyType,emitRulesArgParseError};
@@ -1,7 +0,0 @@
1
- import { createRequire as __createRequire } from 'node:module';
2
- import { fileURLToPath as __fileURLToPath } from 'node:url';
3
- import { dirname as __dirname_ } from 'node:path';
4
- const require = __createRequire(import.meta.url);
5
- const __filename = __fileURLToPath(import.meta.url);
6
- const __dirname = __dirname_(__filename);
7
- import{formatOption,jsonOption,limitOption,nextOption,projectOption,sinceOption,untilOption}from"./chunk-MI7W4QMV.js";import{packageName}from"./chunk-JESNVRVR.js";var typesSubcommand={name:"types",aliases:[],description:"List available event types with descriptions.",arguments:[],options:[formatOption,jsonOption],examples:[{name:"List all event types",value:`${packageName} activity types`},{name:"Output JSON",value:`${packageName} activity types --json`}]},activityCommand={name:"activity",aliases:[],description:"List user activity events.",arguments:[],subcommands:[{name:"ls",aliases:["list"],description:"",default:!0,hidden:!0,arguments:[],options:[],examples:[]},typesSubcommand],options:[{name:"type",shorthand:null,type:[String],argument:"TYPE",deprecated:!1,description:"Filter by event type. Repeatable and comma-separated (e.g. --type deployment --type project-created or --type deployment,project-created)."},sinceOption,untilOption,{...projectOption,shorthand:"p",description:"Filter by project (overrides auto-detected linked project)."},{name:"all",shorthand:"a",type:Boolean,deprecated:!1,description:"Show all team events (ignore linked project auto-scoping)."},limitOption,nextOption,formatOption,jsonOption],examples:[{name:"List events for the linked project",value:`${packageName} activity`},{name:"Filter events by multiple types",value:`${packageName} activity --type deployment --type project-created --since 7d`},{name:"Filter events by comma-separated types",value:`${packageName} activity --type deployment,project-created --since 7d`},{name:"List all team events",value:`${packageName} activity --all --since 30d`},{name:"Output JSON",value:`${packageName} activity --json | jq '.events[]'`},{name:"List activity event types",value:`${packageName} activity types`}]};export{typesSubcommand,activityCommand};
@@ -1,7 +0,0 @@
1
- import { createRequire as __createRequire } from 'node:module';
2
- import { fileURLToPath as __fileURLToPath } from 'node:url';
3
- import { dirname as __dirname_ } from 'node:path';
4
- const require = __createRequire(import.meta.url);
5
- const __filename = __fileURLToPath(import.meta.url);
6
- const __dirname = __dirname_(__filename);
7
- import{tracesConfigCommand}from"./chunk-J6O6JW2K.js";import{deploymentOption,nextCursorOption,projectOption,protectionBypassOption,sinceOption,untilOption,yesOption}from"./chunk-MI7W4QMV.js";import{packageName}from"./chunk-JESNVRVR.js";var spanQueryOptions=[{...projectOption,shorthand:"p",description:"Filter spans to one project (default: all team projects)"},{name:"environment",shorthand:null,type:String,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)"},{name:"deployment-id",shorthand:null,type:String,deprecated:!1,description:"Filter by deployment ID"},{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-id",shorthand:null,type:String,deprecated:!1,description:"Filter by trace ID"},{name:"span-id",shorthand:null,type:String,deprecated:!1,description:"Filter by span ID"},{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:"Fetch 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:null,type:String,argument:"NAME|ID",deprecated:!1,description:"Project name or id to fetch the trace from (overrides the 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. Only valid with --open. Defaults to timeline."}],examples:[{name:"Fetch a trace by trace ID",value:`${packageName} traces inspect e5c0d1efb3904155472b01692c7f2d00`},{name:"Fetch 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:"Fetch a trace without the default inspect subcommand",value:`${packageName} traces e5c0d1efb3904155472b01692c7f2d00`},{name:"Fetch 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}],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 flags 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)"},{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",value:`${packageName} traces search --next <cursor> --json`}]},tracesCommand={name:"traces",aliases:[],description:"Fetch project traces and search spans across a Vercel team.",arguments:[{name:"id",required:!1}],subcommands:[getSubcommand,searchSubcommand,createSubcommand,tracesConfigCommand],options:[],examples:[{name:"Fetch a trace by trace ID",value:`${packageName} traces inspect e5c0d1efb3904155472b01692c7f2d00`},{name:"Fetch 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};
@@ -1,9 +0,0 @@
1
- import { createRequire as __createRequire } from 'node:module';
2
- import { fileURLToPath as __fileURLToPath } from 'node:url';
3
- import { dirname as __dirname_ } from 'node:path';
4
- const require = __createRequire(import.meta.url);
5
- const __filename = __fileURLToPath(import.meta.url);
6
- const __dirname = __dirname_(__filename);
7
- import{writeProjectSettings}from"./chunk-OYMFOCD5.js";import{autoInstallVercelPlugin}from"./chunk-ZZ3LJ22B.js";import{envPullCommandLogic}from"./chunk-SI7FQJIE.js";import{stamp_default}from"./chunk-A2RZZQEP.js";import{ensureLink}from"./chunk-ZMY3GQBK.js";import{pullCommand}from"./chunk-VRWLNWNE.js";import{parseTarget}from"./chunk-2B3A3MOX.js";import{help}from"./chunk-H3KYG32S.js";import{printError}from"./chunk-HARXQZV3.js";import{TelemetryClient}from"./chunk-KUGXOLL7.js";import{parseArguments}from"./chunk-VLDU2MDL.js";import{getFlagsSpecification}from"./chunk-MI7W4QMV.js";import{VERCEL_DIR,VERCEL_DIR_PROJECT}from"./chunk-JIGCN5QS.js";import{humanizePath}from"./chunk-PPCFQQSU.js";import{emoji,output_manager_default,prependEmoji}from"./chunk-M774HRX5.js";import{require_source}from"./chunk-NB2WLB3J.js";import{__toESM}from"./chunk-BZENIQ7N.js";var import_chalk=__toESM(require_source(),1);import{join}from"node:path";var PullTelemetryClient=class extends TelemetryClient{trackCliArgumentProjectPath(value){value&&this.trackCliArgument({arg:"projectPath",value:this.redactedValue})}trackCliOptionEnvironment(environment){environment&&this.trackCliOption({option:"environment",value:this.redactedTargetName(environment)})}trackCliOptionGitBranch(gitBranch){gitBranch&&this.trackCliOption({option:"git-branch",value:this.redactedValue})}trackCliFlagProd(isProduction){isProduction&&this.trackCliFlag("prod")}trackCliFlagYes(yes){yes&&this.trackCliFlag("yes")}};async function pullAllEnvFiles(environment,client,link,flags,cwd){let environmentFile=`.env.${environment}.local`;return await envPullCommandLogic(client,join(".vercel",environmentFile),!!flags["--yes"],environment,link,flags["--git-branch"],cwd,"vercel-cli:pull"),0}async function main(client){let parsedArgs=null,flagsSpecification=getFlagsSpecification(pullCommand.options);try{parsedArgs=parseArguments(client.argv.slice(2),flagsSpecification)}catch(error){return printError(error),2}let telemetryClient=new PullTelemetryClient({opts:{store:client.telemetryEventStore}});if(parsedArgs.flags["--help"])return telemetryClient.trackCliFlagHelp("pull"),output_manager_default.print(help(pullCommand,{columns:client.stderr.columns})),0;let cwd=parsedArgs.args[1]||client.cwd,autoConfirm=!!parsedArgs.flags["--yes"],isProduction=!!parsedArgs.flags["--prod"],environment=parseTarget({flagName:"environment",flags:parsedArgs.flags})||"development";telemetryClient.trackCliArgumentProjectPath(parsedArgs.args[1]),telemetryClient.trackCliFlagYes(autoConfirm),telemetryClient.trackCliFlagProd(isProduction),telemetryClient.trackCliOptionGitBranch(parsedArgs.flags["--git-branch"]),telemetryClient.trackCliOptionEnvironment(parsedArgs.flags["--environment"]),telemetryClient.trackCliOptionProject(parsedArgs.flags["--project"]);let returnCode=await pullCommandLogic(client,cwd,autoConfirm,environment,parsedArgs.flags,parsedArgs.flags["--project"]);return returnCode===0&&!autoConfirm&&await autoInstallVercelPlugin(client),returnCode}async function pullCommandLogic(client,cwd,autoConfirm,environment,flags,projectNameOrId){let link=await ensureLink("pull",client,cwd,{autoConfirm,pullEnv:!1,projectName:projectNameOrId,failIfNotFound:!!projectNameOrId,skipOwnerLookup:!0});if(typeof link=="number")return link;let{project,org,repoRoot}=link,currentDirectory;repoRoot?currentDirectory=join(repoRoot,project.rootDirectory||""):currentDirectory=cwd,client.config.currentTeam=org.type==="team"?org.id:void 0;let pullResultCode=await pullAllEnvFiles(environment,client,link,flags,currentDirectory);if(pullResultCode!==0)return pullResultCode;output_manager_default.print(`
8
- `),output_manager_default.log("Downloading project settings"),await writeProjectSettings(currentDirectory,project,org,typeof repoRoot=="string");let settingsStamp=stamp_default();return output_manager_default.print(`${prependEmoji(`Downloaded project settings to ${import_chalk.default.bold(humanizePath(join(currentDirectory,VERCEL_DIR,VERCEL_DIR_PROJECT)))} ${import_chalk.default.gray(settingsStamp())}`,emoji("success"))}
9
- `),0}export{main,pullCommandLogic};
@@ -1,7 +0,0 @@
1
- import { createRequire as __createRequire } from 'node:module';
2
- import { fileURLToPath as __fileURLToPath } from 'node:url';
3
- import { dirname as __dirname_ } from 'node:path';
4
- const require = __createRequire(import.meta.url);
5
- const __filename = __fileURLToPath(import.meta.url);
6
- const __dirname = __dirname_(__filename);
7
- import{printProjectNotFoundError}from"./chunk-VEMJINMZ.js";import{performDeviceCodeFlow}from"./chunk-CITTRAYH.js";import{param}from"./chunk-3G3FQYMW.js";import{detectExplicitScope}from"./chunk-GLH4PVMY.js";import{buildCommandWithYes,outputActionRequired}from"./chunk-DDLM6CIQ.js";import{getLinkedProject,resolveProjectCwd}from"./chunk-JIGCN5QS.js";import{isAPIError}from"./chunk-XSDAUM4F.js";import{getCommandName,getCommandNamePlain}from"./chunk-JESNVRVR.js";import{output_manager_default}from"./chunk-M774HRX5.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}),client.persistAuthConfig(),await fn()}}function getAcrValuesFromWWWAuthenticate(header){if(!header)return;let bearerIndex=header.toLowerCase().indexOf("bearer");if(bearerIndex===-1)return;let match=header.slice(bearerIndex+6).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};async function ensureLink(commandName,client,cwd,opts={}){opts.singleFile||(cwd=await resolveProjectCwd(cwd));let link=opts.link,nonInteractive=opts.nonInteractive??client.nonInteractive??!1;if(opts.nonInteractive=nonInteractive,link||(opts.forceDelete?link={status:"not_linked",org:null,project:null}:link=await getLinkedProject(client,{cwd,projectName:opts.projectName,projectNameIsExplicit:!!(opts.projectName&&opts.failIfNotFound),scopeIsExplicit:detectExplicitScope(client),allowOwnerLookupFallback:opts.allowOwnerLookupFallback,skipOwnerLookup:opts.skipOwnerLookup,skipRemoteLookup:opts.skipRemoteLookup,skipProjectRootResolution:!!opts.singleFile}),opts.link=link),link.status==="linked"&&opts.forceDelete||link.status==="not_linked"){if(link.status==="not_linked"&&opts.failIfNotFound&&opts.projectName)return await printProjectNotFoundError(client,opts.projectName,commandName,link.orgId),1;if(link.status==="not_linked"&&opts.requireExistingLink)return output_manager_default.error(`Project is not linked. Run ${getCommandName("link")} first.`),1;let{default:setupAndLink}=await import("./setup-and-link-OLSKD2HE.js");if(link=await setupAndLink(client,cwd,opts),link.status==="not_linked")return 0}return link.status==="error"?(link.reason==="HEADLESS"&&(nonInteractive?outputActionRequired(client,{status:"action_required",reason:"confirmation_required",message:`Command ${getCommandNamePlain(commandName)} requires confirmation. Use option --yes to confirm.`,next:[{command:buildCommandWithYes(client.argv),when:"Confirm and run"}]},link.exitCode):output_manager_default.error(`Command ${getCommandName(commandName)} requires confirmation. Use option ${param("--yes")} to confirm.`)),nonInteractive&&process.exit(link.exitCode),link.exitCode):link}export{getEnvRecords,pullEnvRecords,parseEnv,ensureLink};
@@ -1,7 +0,0 @@
1
- import { createRequire as __createRequire } from 'node:module';
2
- import { fileURLToPath as __fileURLToPath } from 'node:url';
3
- import { dirname as __dirname_ } from 'node:path';
4
- const require = __createRequire(import.meta.url);
5
- const __filename = __fileURLToPath(import.meta.url);
6
- const __dirname = __dirname_(__filename);
7
- import{getSubcommand}from"./chunk-ETV3C2CV.js";import{getCommandAliases}from"./chunk-MYHJNSCW.js";import{tracesCommand}from"./chunk-ZBDLYNUF.js";import{lsSubcommand,rmSubcommand,setSubcommand,tracesConfigCommand}from"./chunk-J6O6JW2K.js";import"./chunk-BFRDBBSO.js";import"./chunk-2UMWTCY7.js";import"./chunk-Q5ZGA2RO.js";import"./chunk-UGMTKOTN.js";import"./chunk-UQIVF4Q2.js";import"./chunk-ITKS32PG.js";import"./chunk-7NNENHGN.js";import"./chunk-Y24OSBXP.js";import"./chunk-GVVIFYQE.js";import"./chunk-W3TGCMRW.js";import"./chunk-B4YYOSPY.js";import"./chunk-LD5U73LA.js";import"./chunk-VRWLNWNE.js";import"./chunk-TPVAPVQC.js";import"./chunk-JALVF3C2.js";import"./chunk-CMKLX4DC.js";import"./chunk-UCAE5Z5L.js";import{help}from"./chunk-H3KYG32S.js";import"./chunk-773GOZIR.js";import"./chunk-67GZ5REA.js";import"./chunk-BS32OUOC.js";import{TelemetryClient}from"./chunk-KUGXOLL7.js";import"./chunk-VKXEOL4K.js";import"./chunk-NWGBDBZI.js";import"./chunk-4SAVH3H7.js";import"./chunk-MI7W4QMV.js";import"./chunk-VKPZP4LC.js";import"./chunk-JESNVRVR.js";import{output_manager_default}from"./chunk-M774HRX5.js";import"./chunk-RM3ZDRYE.js";import"./chunk-OO572JUC.js";import"./chunk-D3AHZ5LI.js";import"./chunk-2GHZGOWT.js";import"./chunk-YHPPP3SF.js";import"./chunk-NB2WLB3J.js";import"./chunk-ISWW3DKF.js";import"./chunk-BRQUZ5NC.js";import"./chunk-BZENIQ7N.js";var TracesConfigTelemetryClient=class extends TelemetryClient{trackCliSubcommandLs(actual){this.trackCliSubcommand({subcommand:"ls",value:actual})}trackCliSubcommandSet(actual){this.trackCliSubcommand({subcommand:"set",value:actual})}trackCliSubcommandRm(actual){this.trackCliSubcommand({subcommand:"rm",value:actual})}};var COMMAND_CONFIG={ls:getCommandAliases(lsSubcommand),set:getCommandAliases(setSubcommand),rm:getCommandAliases(rmSubcommand)},SUBCOMMAND_METADATA={ls:lsSubcommand,set:setSubcommand,rm:rmSubcommand};async function config(client,{args,needHelp,subcommandOriginal,telemetry}){let{subcommand:action,subcommandOriginal:actionOriginal}=getSubcommand(args,COMMAND_CONFIG),actionMetadata=typeof action=="string"?SUBCOMMAND_METADATA[action]:void 0;function printHelp(command){return output_manager_default.print(help(command,{parent:tracesCommand,columns:client.stderr.columns})),needHelp?0:2}if(needHelp)return telemetry.trackCliFlagHelp("traces",subcommandOriginal),printHelp(actionMetadata||tracesConfigCommand);telemetry.trackCliSubcommandConfig(subcommandOriginal);let configTelemetry=new TracesConfigTelemetryClient({opts:{store:client.telemetryEventStore}});switch(action){case"ls":return configTelemetry.trackCliSubcommandLs(actionOriginal),(await import("./ls-5YLXAARZ.js")).default(client);case"set":return configTelemetry.trackCliSubcommandSet(actionOriginal),(await import("./set-5P44OPZP.js")).default(client);case"rm":return configTelemetry.trackCliSubcommandRm(actionOriginal),(await import("./rm-4VXZ3AIX.js")).default(client);default:return printHelp(tracesConfigCommand)}}export{config as default};
@@ -1,10 +0,0 @@
1
- import { createRequire as __createRequire } from 'node:module';
2
- import { fileURLToPath as __fileURLToPath } from 'node:url';
3
- import { dirname as __dirname_ } from 'node:path';
4
- const require = __createRequire(import.meta.url);
5
- const __filename = __fileURLToPath(import.meta.url);
6
- const __dirname = __dirname_(__filename);
7
- import{getRouteVersions}from"./chunk-BVH2AEFE.js";import{getRouteTypeLabel,getRoutes,offerAutoPromote,parseSubcommandArgs,requireProjectContext,resolveRoutes,withGlobalFlags}from"./chunk-2UPVIVAA.js";import"./chunk-DRXOTZSJ.js";import{stamp_default}from"./chunk-A2RZZQEP.js";import"./chunk-VEMJINMZ.js";import{deleteSubcommand}from"./chunk-UQIVF4Q2.js";import"./chunk-Q7D7RGXM.js";import"./chunk-HARXQZV3.js";import"./chunk-GLH4PVMY.js";import"./chunk-XEBMH33W.js";import"./chunk-VKXEOL4K.js";import"./chunk-MXTC4ZAQ.js";import"./chunk-4SAVH3H7.js";import"./chunk-ZS2WS4AM.js";import"./chunk-AOWWC6WZ.js";import"./chunk-MY4MONOH.js";import"./chunk-VLDU2MDL.js";import{AGENT_REASON,AGENT_STATUS,outputAgentError}from"./chunk-DDLM6CIQ.js";import"./chunk-MI7W4QMV.js";import"./chunk-JIGCN5QS.js";import"./chunk-ROPQIBWJ.js";import"./chunk-VKPZP4LC.js";import"./chunk-PPCFQQSU.js";import"./chunk-IJCCFLCQ.js";import"./chunk-ZQME5XUJ.js";import"./chunk-2VBFQZ72.js";import"./chunk-XSDAUM4F.js";import"./chunk-JESNVRVR.js";import{output_manager_default}from"./chunk-M774HRX5.js";import"./chunk-RM3ZDRYE.js";import"./chunk-OO572JUC.js";import"./chunk-D3AHZ5LI.js";import"./chunk-2GHZGOWT.js";import"./chunk-YHPPP3SF.js";import{require_source}from"./chunk-NB2WLB3J.js";import"./chunk-ISWW3DKF.js";import"./chunk-BRQUZ5NC.js";import{__toESM}from"./chunk-BZENIQ7N.js";var import_chalk=__toESM(require_source(),1);async function deleteRoutes(client,projectId,routeIds,options={}){let{teamId}=options,query=new URLSearchParams;teamId&&query.set("teamId",teamId);let queryString=query.toString(),url=`/v1/projects/${projectId}/routes${queryString?`?${queryString}`:""}`;return await client.fetch(url,{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({routeIds})})}async function deleteRoute(client,argv){let parsed=await parseSubcommandArgs(argv,deleteSubcommand,client);if(typeof parsed=="number")return parsed;let link=await requireProjectContext(client,"routes",parsed.flags["--project"]);if(typeof link=="number")return link;let{project,org}=link,teamId=org.type==="team"?org.id:void 0,{args,flags}=parsed,skipConfirmation=flags["--yes"];if(args.length===0)return client.nonInteractive&&outputAgentError(client,{status:AGENT_STATUS.ERROR,reason:AGENT_REASON.MISSING_ARGUMENTS,message:"At least one route name or ID is required.",next:[{command:withGlobalFlags(client,"routes delete <name-or-id> --yes"),when:"pass one or more ids/names and --yes to skip confirm"}]},2),output_manager_default.error(`At least one route name or ID is required. Usage: ${withGlobalFlags(client,"routes delete <name-or-id> [...]")}`),2;let{versions}=await getRouteVersions(client,project.id,{teamId}),existingStagingVersion=versions.find(v=>v.isStaging);output_manager_default.spinner("Fetching routes");let{routes}=await getRoutes(client,project.id,{teamId});if(output_manager_default.stopSpinner(),routes.length===0)return client.nonInteractive&&outputAgentError(client,{status:AGENT_STATUS.ERROR,reason:AGENT_REASON.NOT_FOUND,message:"No routes found in this project."},1),output_manager_default.error("No routes found in this project."),1;let resolved=await resolveRoutes(client,routes,args);if(!resolved)return 1;output_manager_default.print(`
8
- `),output_manager_default.log(`The following ${resolved.length===1?"route":`${resolved.length} routes`} will be deleted:`);for(let route of resolved){let typeLabels=getRouteTypeLabel(route);output_manager_default.print(` ${import_chalk.default.red("\xD7")} ${route.name} ${import_chalk.default.gray(`(${route.route.src})`)} ${import_chalk.default.gray(`[${typeLabels}]`)}
9
- `)}if(output_manager_default.print(`
10
- `),!skipConfirmation&&(client.nonInteractive&&outputAgentError(client,{status:AGENT_STATUS.ERROR,reason:AGENT_REASON.CONFIRMATION_REQUIRED,message:"Deletion requires confirmation. Pass --yes to skip the prompt in non-interactive mode.",next:[{command:withGlobalFlags(client,`routes delete ${args.join(" ")} --yes`),when:"re-run with --yes to confirm without prompt"}]},1),!await client.input.confirm(`Delete ${resolved.length===1?"this route":`these ${resolved.length} routes`}?`,!1)))return output_manager_default.log("Aborted."),0;let deleteStamp=stamp_default();output_manager_default.spinner(`Deleting ${resolved.length===1?"route":`${resolved.length} routes`}`);try{let{deletedCount,version}=await deleteRoutes(client,project.id,resolved.map(r=>r.id),{teamId});return output_manager_default.log(`${import_chalk.default.cyan("Deleted")} ${deletedCount} ${deletedCount===1?"route":"routes"} ${import_chalk.default.gray(deleteStamp())}`),await offerAutoPromote(client,project.id,version,!!existingStagingVersion,{teamId,skipPrompts:skipConfirmation}),0}catch(e){let error=e;return client.nonInteractive&&outputAgentError(client,{status:AGENT_STATUS.ERROR,reason:AGENT_REASON.API_ERROR,message:"Failed to delete routes for this project. See hint for error details.",hint:error.message||"Retry with the same command once transient issues are resolved."},1),output_manager_default.error(error.message||"Failed to delete routes"),1}}export{deleteRoute as default};
@@ -1,7 +0,0 @@
1
- import { createRequire as __createRequire } from 'node:module';
2
- import { fileURLToPath as __fileURLToPath } from 'node:url';
3
- import { dirname as __dirname_ } from 'node:path';
4
- const require = __createRequire(import.meta.url);
5
- const __filename = __fileURLToPath(import.meta.url);
6
- const __dirname = __dirname_(__filename);
7
- import{editRoute}from"./chunk-AM46JVVN.js";import{getRouteVersions}from"./chunk-BVH2AEFE.js";import{getRoutes,offerAutoPromote,parseSubcommandArgs,requireProjectContext,resolveRoute,withGlobalFlags}from"./chunk-2UPVIVAA.js";import"./chunk-DRXOTZSJ.js";import{stamp_default}from"./chunk-A2RZZQEP.js";import"./chunk-VEMJINMZ.js";import{disableSubcommand}from"./chunk-UQIVF4Q2.js";import"./chunk-Q7D7RGXM.js";import"./chunk-HARXQZV3.js";import"./chunk-GLH4PVMY.js";import"./chunk-XEBMH33W.js";import"./chunk-VKXEOL4K.js";import"./chunk-MXTC4ZAQ.js";import"./chunk-4SAVH3H7.js";import"./chunk-ZS2WS4AM.js";import"./chunk-AOWWC6WZ.js";import"./chunk-MY4MONOH.js";import"./chunk-VLDU2MDL.js";import{outputAgentError}from"./chunk-DDLM6CIQ.js";import"./chunk-MI7W4QMV.js";import"./chunk-JIGCN5QS.js";import"./chunk-ROPQIBWJ.js";import"./chunk-VKPZP4LC.js";import"./chunk-PPCFQQSU.js";import"./chunk-IJCCFLCQ.js";import"./chunk-ZQME5XUJ.js";import"./chunk-2VBFQZ72.js";import"./chunk-XSDAUM4F.js";import"./chunk-JESNVRVR.js";import{output_manager_default}from"./chunk-M774HRX5.js";import"./chunk-RM3ZDRYE.js";import"./chunk-OO572JUC.js";import"./chunk-D3AHZ5LI.js";import"./chunk-2GHZGOWT.js";import"./chunk-YHPPP3SF.js";import{require_source}from"./chunk-NB2WLB3J.js";import"./chunk-ISWW3DKF.js";import"./chunk-BRQUZ5NC.js";import{__toESM}from"./chunk-BZENIQ7N.js";var import_chalk=__toESM(require_source(),1);async function disable(client,argv){let parsed=await parseSubcommandArgs(argv,disableSubcommand,client);if(typeof parsed=="number")return parsed;let link=await requireProjectContext(client,"routes",parsed.flags["--project"]);if(typeof link=="number")return link;let{project,org}=link,teamId=org.type==="team"?org.id:void 0,{args}=parsed,identifier=args[0];if(!identifier)return client.nonInteractive&&outputAgentError(client,{status:"error",reason:"missing_arguments",message:"Route name or ID is required.",next:[{command:withGlobalFlags(client,"routes disable <name-or-id>"),when:"replace <name-or-id>"},{command:withGlobalFlags(client,"routes list"),when:"list routes"}]},2),output_manager_default.error(`Route name or ID is required. Usage: ${withGlobalFlags(client,"routes disable <name-or-id>")}`),2;let{versions}=await getRouteVersions(client,project.id,{teamId}),existingStagingVersion=versions.find(v=>v.isStaging);output_manager_default.spinner("Fetching routes");let{routes}=await getRoutes(client,project.id,{teamId});if(output_manager_default.stopSpinner(),routes.length===0)return client.nonInteractive&&outputAgentError(client,{status:"error",reason:"not_found",message:"No routes found in this project."},1),output_manager_default.error("No routes found in this project."),1;let route=await resolveRoute(client,routes,identifier);if(!route)return client.nonInteractive&&outputAgentError(client,{status:"error",reason:"not_found",message:`No route found matching "${identifier}".`,next:[{command:withGlobalFlags(client,"routes list"),when:"list routes"}]},1),output_manager_default.error(`No route found matching "${identifier}". Run ${import_chalk.default.cyan(withGlobalFlags(client,"routes list"))} to see all routes.`),1;if(route.enabled===!1)return output_manager_default.log(`Route "${route.name}" is already disabled.`),0;let disableStamp=stamp_default();output_manager_default.spinner(`Disabling route "${route.name}"`);try{let{version}=await editRoute(client,project.id,route.id,{route:{name:route.name,description:route.description,enabled:!1,srcSyntax:route.srcSyntax,route:route.route}},{teamId});return output_manager_default.log(`${import_chalk.default.cyan("Disabled")} route "${route.name}" ${import_chalk.default.gray(disableStamp())}`),await offerAutoPromote(client,project.id,version,!!existingStagingVersion,{teamId}),0}catch(e){let error=e;return client.nonInteractive&&outputAgentError(client,{status:"error",reason:"api_error",message:error.message||"Failed to disable route"},1),output_manager_default.error(error.message||"Failed to disable route"),1}}export{disable as default};
@@ -1,14 +0,0 @@
1
- import { createRequire as __createRequire } from 'node:module';
2
- import { fileURLToPath as __fileURLToPath } from 'node:url';
3
- import { dirname as __dirname_ } from 'node:path';
4
- const require = __createRequire(import.meta.url);
5
- const __filename = __fileURLToPath(import.meta.url);
6
- const __dirname = __dirname_(__filename);
7
- import{updateRouteVersion}from"./chunk-6QKS6QK7.js";import{getRouteVersions}from"./chunk-BVH2AEFE.js";import{confirmAction,getRoutes,parseSubcommandArgs,printDiffSummary,requireProjectContext,withGlobalFlags}from"./chunk-2UPVIVAA.js";import"./chunk-DRXOTZSJ.js";import{stamp_default}from"./chunk-A2RZZQEP.js";import"./chunk-VEMJINMZ.js";import{discardSubcommand}from"./chunk-UQIVF4Q2.js";import"./chunk-Q7D7RGXM.js";import"./chunk-HARXQZV3.js";import"./chunk-GLH4PVMY.js";import"./chunk-XEBMH33W.js";import"./chunk-VKXEOL4K.js";import"./chunk-MXTC4ZAQ.js";import"./chunk-4SAVH3H7.js";import"./chunk-ZS2WS4AM.js";import"./chunk-AOWWC6WZ.js";import"./chunk-MY4MONOH.js";import"./chunk-VLDU2MDL.js";import{outputAgentError}from"./chunk-DDLM6CIQ.js";import"./chunk-MI7W4QMV.js";import"./chunk-JIGCN5QS.js";import"./chunk-ROPQIBWJ.js";import"./chunk-VKPZP4LC.js";import"./chunk-PPCFQQSU.js";import"./chunk-IJCCFLCQ.js";import"./chunk-ZQME5XUJ.js";import"./chunk-2VBFQZ72.js";import"./chunk-XSDAUM4F.js";import"./chunk-JESNVRVR.js";import{output_manager_default}from"./chunk-M774HRX5.js";import"./chunk-RM3ZDRYE.js";import"./chunk-OO572JUC.js";import"./chunk-D3AHZ5LI.js";import"./chunk-2GHZGOWT.js";import"./chunk-YHPPP3SF.js";import{require_source}from"./chunk-NB2WLB3J.js";import"./chunk-ISWW3DKF.js";import"./chunk-BRQUZ5NC.js";import{__toESM}from"./chunk-BZENIQ7N.js";var import_chalk=__toESM(require_source(),1);async function discard(client,argv){let parsed=await parseSubcommandArgs(argv,discardSubcommand,client);if(typeof parsed=="number")return parsed;let link=await requireProjectContext(client,"routes",parsed.flags["--project"]);if(typeof link=="number")return link;let{project,org}=link,teamId=org.type==="team"?org.id:void 0;output_manager_default.spinner(`Fetching route versions for ${import_chalk.default.bold(project.name)}`);let{versions}=await getRouteVersions(client,project.id,{teamId}),stagingVersion=versions.find(v=>v.isStaging);if(!stagingVersion)return output_manager_default.warn(`No staged changes to discard. Make changes first with ${import_chalk.default.cyan(withGlobalFlags(client,"routes add"))}.`),0;output_manager_default.spinner("Fetching staged changes");let{routes:diffRoutes}=await getRoutes(client,project.id,{teamId,versionId:stagingVersion.id,diff:!0}),changedRoutes=diffRoutes.filter(r=>r.action!==void 0);if(changedRoutes.length>0?(output_manager_default.print(`
8
- ${import_chalk.default.bold("Changes to be discarded:")}
9
-
10
- `),printDiffSummary(changedRoutes),output_manager_default.print(`
11
- `)):output_manager_default.print(`
12
- ${import_chalk.default.gray("No changes detected in staging version.")}
13
-
14
- `),!await confirmAction(client,parsed.flags["--yes"],"Discard all staged changes?","This action cannot be undone."))return output_manager_default.log("Canceled"),0;let updateStamp=stamp_default();output_manager_default.spinner("Discarding staged changes");try{return await updateRouteVersion(client,project.id,stagingVersion.id,"discard",{teamId}),output_manager_default.log(`${import_chalk.default.cyan("Success!")} Staged changes discarded ${import_chalk.default.gray(updateStamp())}`),0}catch(e){let msg=e.message||"Failed to discard staged changes";return client.nonInteractive?(outputAgentError(client,{status:"error",reason:"api_error",message:msg,next:[{command:withGlobalFlags(client,"routes discard --yes")}]}),process.exit(1),1):(output_manager_default.error(msg),1)}}export{discard as default};
@@ -1,8 +0,0 @@
1
- import { createRequire as __createRequire } from 'node:module';
2
- import { fileURLToPath as __fileURLToPath } from 'node:url';
3
- import { dirname as __dirname_ } from 'node:path';
4
- const require = __createRequire(import.meta.url);
5
- const __filename = __fileURLToPath(import.meta.url);
6
- const __dirname = __dirname_(__filename);
7
- import{editRoute}from"./chunk-AM46JVVN.js";import{applyFlagMutations,cloneRoute,convertRouteToCurrentRoute,generateRoute,generatedRouteToAddInput,hasAnyTransformFlags,populateRouteEnv,printGeneratedRoutePreview,printRouteConfig,routingRuleToCurrentRoute,runInteractiveEditLoop}from"./chunk-CMEEAXVV.js";import{getRouteVersions}from"./chunk-BVH2AEFE.js";import{getRoutes,offerAutoPromote,parseSubcommandArgs,requireProjectContext,resolveRoute,shellQuoteRouteIdentifierForSuggestion,withGlobalFlags}from"./chunk-2UPVIVAA.js";import"./chunk-DRXOTZSJ.js";import{stamp_default}from"./chunk-A2RZZQEP.js";import"./chunk-VEMJINMZ.js";import{editSubcommand}from"./chunk-UQIVF4Q2.js";import"./chunk-Q7D7RGXM.js";import"./chunk-HARXQZV3.js";import"./chunk-GLH4PVMY.js";import"./chunk-XEBMH33W.js";import"./chunk-VKXEOL4K.js";import"./chunk-MXTC4ZAQ.js";import"./chunk-4SAVH3H7.js";import"./chunk-ZS2WS4AM.js";import"./chunk-AOWWC6WZ.js";import"./chunk-MY4MONOH.js";import"./chunk-VLDU2MDL.js";import{outputAgentError}from"./chunk-DDLM6CIQ.js";import"./chunk-MI7W4QMV.js";import"./chunk-JIGCN5QS.js";import"./chunk-ROPQIBWJ.js";import"./chunk-VKPZP4LC.js";import"./chunk-PPCFQQSU.js";import"./chunk-IJCCFLCQ.js";import"./chunk-ZQME5XUJ.js";import"./chunk-2VBFQZ72.js";import"./chunk-XSDAUM4F.js";import"./chunk-JESNVRVR.js";import{output_manager_default}from"./chunk-M774HRX5.js";import"./chunk-RM3ZDRYE.js";import"./chunk-OO572JUC.js";import"./chunk-D3AHZ5LI.js";import"./chunk-2GHZGOWT.js";import"./chunk-YHPPP3SF.js";import{require_source}from"./chunk-NB2WLB3J.js";import"./chunk-ISWW3DKF.js";import"./chunk-BRQUZ5NC.js";import{__toESM}from"./chunk-BZENIQ7N.js";var import_chalk=__toESM(require_source(),1);async function edit(client,argv){let parsed=await parseSubcommandArgs(argv,editSubcommand,client);if(typeof parsed=="number")return parsed;let link=await requireProjectContext(client,"routes",parsed.flags["--project"]);if(typeof link=="number")return link;let{project,org}=link,teamId=org.type==="team"?org.id:void 0,{args,flags}=parsed,skipConfirmation=flags["--yes"],identifier=args[0],{RoutesEditTelemetryClient}=await import("./routes-LK2HUGAK.js"),telemetry=new RoutesEditTelemetryClient({opts:{store:client.telemetryEventStore}});if(telemetry.trackCliArgumentNameOrId(identifier),telemetry.trackCliFlagYes(skipConfirmation),telemetry.trackCliOptionName(flags["--name"]),telemetry.trackCliOptionDescription(flags["--description"]),telemetry.trackCliOptionSrc(flags["--src"]),telemetry.trackCliOptionSrcSyntax(flags["--src-syntax"]),telemetry.trackCliOptionAction(flags["--action"]),telemetry.trackCliOptionDest(flags["--dest"]),telemetry.trackCliOptionStatus(flags["--status"]),telemetry.trackCliFlagNoDest(flags["--no-dest"]),telemetry.trackCliFlagNoStatus(flags["--no-status"]),telemetry.trackCliFlagClearConditions(flags["--clear-conditions"]),telemetry.trackCliFlagClearHeaders(flags["--clear-headers"]),telemetry.trackCliFlagClearTransforms(flags["--clear-transforms"]),telemetry.trackCliOptionSetResponseHeader(flags["--set-response-header"]),telemetry.trackCliOptionAppendResponseHeader(flags["--append-response-header"]),telemetry.trackCliOptionDeleteResponseHeader(flags["--delete-response-header"]),telemetry.trackCliOptionSetRequestHeader(flags["--set-request-header"]),telemetry.trackCliOptionAppendRequestHeader(flags["--append-request-header"]),telemetry.trackCliOptionDeleteRequestHeader(flags["--delete-request-header"]),telemetry.trackCliOptionSetRequestQuery(flags["--set-request-query"]),telemetry.trackCliOptionAppendRequestQuery(flags["--append-request-query"]),telemetry.trackCliOptionDeleteRequestQuery(flags["--delete-request-query"]),telemetry.trackCliOptionHas(flags["--has"]),telemetry.trackCliOptionMissing(flags["--missing"]),telemetry.trackCliOptionAi(flags["--ai"]),!identifier)return client.nonInteractive&&outputAgentError(client,{status:"error",reason:"missing_arguments",message:"Route name or ID is required as the first argument after routes update.",next:[{command:withGlobalFlags(client,"routes update <name-or-id>"),when:"replace <name-or-id> with route name or id from routes list"},{command:withGlobalFlags(client,"routes list"),when:"to list routes"}]},2),output_manager_default.error(`Route name or ID is required. Usage: ${withGlobalFlags(client,"routes update <name-or-id>")}`),2;let{versions}=await getRouteVersions(client,project.id,{teamId}),existingStagingVersion=versions.find(v=>v.isStaging);output_manager_default.spinner("Fetching routes");let{routes}=await getRoutes(client,project.id,{teamId});if(output_manager_default.stopSpinner(),routes.length===0)return client.nonInteractive&&outputAgentError(client,{status:"error",reason:"not_found",message:"No routes found in this project.",next:[{command:withGlobalFlags(client,"routes add --ai <description> --yes"),when:"add a route first (or use full flags)"}]},1),output_manager_default.error("No routes found in this project."),1;let originalRoute=await resolveRoute(client,routes,identifier);if(!originalRoute)return client.nonInteractive&&outputAgentError(client,{status:"error",reason:"not_found",message:`No route found matching "${identifier}".`,next:[{command:withGlobalFlags(client,"routes list"),when:"to list routes and pick an exact name or id"},{command:withGlobalFlags(client,"routes update <name-or-id>"),when:"retry with a unique name or id"}]},1),output_manager_default.error(`No route found matching "${identifier}". Run ${import_chalk.default.cyan(withGlobalFlags(client,"routes list"))} to see all routes.`),1;let aiPrompt=flags["--ai"];if(aiPrompt){let usedConflicts=["--name","--description","--src","--src-syntax","--action","--dest","--status","--no-dest","--no-status","--has","--missing","--set-response-header","--append-response-header","--delete-response-header","--set-request-header","--append-request-header","--delete-request-header","--set-request-query","--append-request-query","--delete-request-query","--clear-conditions","--clear-headers","--clear-transforms"].filter(f=>flags[f]!==void 0);return usedConflicts.length>0?(client.nonInteractive&&outputAgentError(client,{status:"error",reason:"invalid_arguments",message:`Cannot use --ai with ${usedConflicts.join(", ")}. Use --ai alone to describe changes.`,next:[{command:withGlobalFlags(client,`routes update ${shellQuoteRouteIdentifierForSuggestion(identifier)} --ai <description> --yes`),when:"use only --ai with route id/name already set"}]},2),output_manager_default.error(`Cannot use --ai with ${usedConflicts.join(", ")}. Use --ai alone to describe changes.`),2):await handleAIEdit(client,project.id,teamId,originalRoute,aiPrompt,skipConfirmation,existingStagingVersion)}let route=cloneRoute(originalRoute);if(flags["--name"]!==void 0||flags["--description"]!==void 0||flags["--src"]!==void 0||flags["--src-syntax"]!==void 0||flags["--action"]!==void 0||flags["--dest"]!==void 0||flags["--status"]!==void 0||flags["--no-dest"]!==void 0||flags["--no-status"]!==void 0||flags["--has"]!==void 0||flags["--missing"]!==void 0||flags["--clear-conditions"]!==void 0||flags["--clear-headers"]!==void 0||flags["--clear-transforms"]!==void 0||hasAnyTransformFlags(flags)){let error=applyFlagMutations(route,flags);if(error)return client.nonInteractive&&outputAgentError(client,{status:"error",reason:"invalid_arguments",message:error,next:[{command:withGlobalFlags(client,`routes update ${shellQuoteRouteIdentifierForSuggestion(identifier)} ...`),when:"fix flags per message; see routes update --help"}]},2),output_manager_default.error(error),2}else{if(!client.stdin.isTTY||client.nonInteractive)return client.nonInteractive&&outputAgentError(client,{status:"error",reason:"missing_arguments",message:"No update flags provided. In non-interactive mode pass flags such as --name, --src, --dest, --action, header flags, or --ai <description> --yes.",next:[{command:withGlobalFlags(client,`routes update ${shellQuoteRouteIdentifierForSuggestion(identifier)} --dest <dest> --yes`),when:"example: set destination; see routes update --help"}],hint:"Run vercel routes update --help for all flag options."},2),output_manager_default.error(`No update flags provided. When running non-interactively, use flags like --name, --dest, --src, etc. Run ${withGlobalFlags(client,"routes update --help")} for all options.`),2;if(output_manager_default.log(`
8
- Editing route "${originalRoute.name}"`),printRouteConfig(route),await client.input.select({message:"How would you like to update this route?",choices:[{name:"Describe changes (AI-powered)",value:"ai"},{name:"Edit manually (field by field)",value:"manual"}]})==="ai")return telemetry.trackCliOptionAi("interactive"),await handleAIEdit(client,project.id,teamId,originalRoute,void 0,skipConfirmation,existingStagingVersion);await runInteractiveEditLoop(client,route)}if(populateRouteEnv(route.route,route.srcSyntax),JSON.stringify(route)===JSON.stringify(originalRoute))return output_manager_default.log("No changes made."),0;let editStamp=stamp_default();output_manager_default.spinner(`Updating route "${route.name}"`);try{let{version}=await editRoute(client,project.id,originalRoute.id,{route:{name:route.name,description:route.description,enabled:route.enabled,srcSyntax:route.srcSyntax,route:route.route}},{teamId});return output_manager_default.log(`${import_chalk.default.cyan("Updated")} route "${route.name}" ${import_chalk.default.gray(editStamp())}`),await offerAutoPromote(client,project.id,version,!!existingStagingVersion,{teamId,skipPrompts:skipConfirmation}),0}catch(e){let error=e;return output_manager_default.error(error.message||"Failed to update route"),1}}async function handleAIEdit(client,projectId,teamId,originalRoute,aiPrompt,skipConfirmation,existingStagingVersion){let currentRoute=routingRuleToCurrentRoute(originalRoute),prompt=aiPrompt,currentGenerated;for(;;){prompt||(prompt=await client.input.text({message:"Describe what you'd like to change:",validate:val=>val?val.length>2e3?"Description must be 2000 characters or less":!0:"A description is required"})),output_manager_default.spinner("Generating updated route...");let errorMessage;try{let result=await generateRoute(client,projectId,{prompt,currentRoute},{teamId});result.error?errorMessage=result.error:result.route?currentGenerated=result.route:errorMessage="Could not apply changes. Try rephrasing."}catch(e){errorMessage=e.message||"Failed to generate updated route"}if(currentGenerated)break;if(output_manager_default.error(errorMessage),skipConfirmation||!client.stdin.isTTY)return 1;if(await client.input.select({message:"What would you like to do?",choices:[{name:"Try again with a different description",value:"retry"},{name:"Cancel",value:"cancel"}]})==="cancel")return output_manager_default.log("No changes made."),0;prompt=void 0}if(printGeneratedRoutePreview(currentGenerated),skipConfirmation)return await applyAIEdit(client,projectId,teamId,originalRoute,currentGenerated,existingStagingVersion,skipConfirmation);if(!client.stdin.isTTY)return output_manager_default.error(`Cannot interactively confirm route changes in a non-TTY environment. Use ${withGlobalFlags(client,'routes update <name-or-id> --ai "..." --yes')} to skip confirmation.`),1;for(;;){let choice=await client.input.select({message:"What would you like to do?",choices:[{name:"Confirm changes",value:"confirm"},{name:"Edit again with AI",value:"ai-edit"},{name:"Edit manually",value:"manual"},{name:"Discard",value:"discard"}],pageSize:4,loop:!1});if(choice==="confirm")return await applyAIEdit(client,projectId,teamId,originalRoute,currentGenerated,existingStagingVersion,skipConfirmation);if(choice==="ai-edit"){let editPrompt=await client.input.text({message:"Describe what you'd like to change:",validate:val=>val?val.length>2e3?"Description must be 2000 characters or less":!0:"A description is required"});output_manager_default.spinner("Updating route...");try{let editResult=await generateRoute(client,projectId,{prompt:editPrompt,currentRoute:convertRouteToCurrentRoute(currentGenerated)},{teamId});if(editResult.error){output_manager_default.error(editResult.error),output_manager_default.log("Keeping previous route:"),printGeneratedRoutePreview(currentGenerated);continue}if(!editResult.route){output_manager_default.error("Could not apply changes. Try rephrasing."),output_manager_default.log("Keeping previous route:"),printGeneratedRoutePreview(currentGenerated);continue}currentGenerated=editResult.route,printGeneratedRoutePreview(currentGenerated)}catch(e){let error=e;output_manager_default.error(error.message||"Failed to update route"),output_manager_default.log("Keeping previous route:"),printGeneratedRoutePreview(currentGenerated)}continue}if(choice==="manual"){let routeInput=generatedRouteToAddInput(currentGenerated),manualRoute=cloneRoute(originalRoute);manualRoute.name=routeInput.name,manualRoute.description=routeInput.description,manualRoute.srcSyntax=routeInput.srcSyntax,manualRoute.route=routeInput.route,await runInteractiveEditLoop(client,manualRoute),populateRouteEnv(manualRoute.route,manualRoute.srcSyntax);let editStamp=stamp_default();output_manager_default.spinner(`Updating route "${manualRoute.name}"`);try{let{version}=await editRoute(client,projectId,originalRoute.id,{route:{name:manualRoute.name,description:manualRoute.description,enabled:manualRoute.enabled,srcSyntax:manualRoute.srcSyntax,route:manualRoute.route}},{teamId});return output_manager_default.log(`${import_chalk.default.cyan("Updated")} route "${manualRoute.name}" ${import_chalk.default.gray(editStamp())}`),await offerAutoPromote(client,projectId,version,!!existingStagingVersion,{teamId,skipPrompts:skipConfirmation}),0}catch(e){let error=e;return output_manager_default.error(error.message||"Failed to update route"),1}}return output_manager_default.log("No changes made."),0}}async function applyAIEdit(client,projectId,teamId,originalRoute,generated,existingStagingVersion,skipConfirmation){let routeInput=generatedRouteToAddInput(generated);populateRouteEnv(routeInput.route,routeInput.srcSyntax);let editStamp=stamp_default();output_manager_default.spinner(`Updating route "${routeInput.name}"`);try{let{version}=await editRoute(client,projectId,originalRoute.id,{route:{name:routeInput.name,description:routeInput.description,enabled:originalRoute.enabled,srcSyntax:routeInput.srcSyntax,route:routeInput.route}},{teamId});return output_manager_default.log(`${import_chalk.default.cyan("Updated")} route "${routeInput.name}" ${import_chalk.default.gray(editStamp())}`),await offerAutoPromote(client,projectId,version,!!existingStagingVersion,{teamId,skipPrompts:skipConfirmation}),0}catch(e){let error=e;return output_manager_default.error(error.message||"Failed to update route"),1}}export{edit as default};
@@ -1,7 +0,0 @@
1
- import { createRequire as __createRequire } from 'node:module';
2
- import { fileURLToPath as __fileURLToPath } from 'node:url';
3
- import { dirname as __dirname_ } from 'node:path';
4
- const require = __createRequire(import.meta.url);
5
- const __filename = __fileURLToPath(import.meta.url);
6
- const __dirname = __dirname_(__filename);
7
- import{editRoute}from"./chunk-AM46JVVN.js";import{getRouteVersions}from"./chunk-BVH2AEFE.js";import{getRoutes,offerAutoPromote,parseSubcommandArgs,requireProjectContext,resolveRoute,withGlobalFlags}from"./chunk-2UPVIVAA.js";import"./chunk-DRXOTZSJ.js";import{stamp_default}from"./chunk-A2RZZQEP.js";import"./chunk-VEMJINMZ.js";import{enableSubcommand}from"./chunk-UQIVF4Q2.js";import"./chunk-Q7D7RGXM.js";import"./chunk-HARXQZV3.js";import"./chunk-GLH4PVMY.js";import"./chunk-XEBMH33W.js";import"./chunk-VKXEOL4K.js";import"./chunk-MXTC4ZAQ.js";import"./chunk-4SAVH3H7.js";import"./chunk-ZS2WS4AM.js";import"./chunk-AOWWC6WZ.js";import"./chunk-MY4MONOH.js";import"./chunk-VLDU2MDL.js";import{outputAgentError}from"./chunk-DDLM6CIQ.js";import"./chunk-MI7W4QMV.js";import"./chunk-JIGCN5QS.js";import"./chunk-ROPQIBWJ.js";import"./chunk-VKPZP4LC.js";import"./chunk-PPCFQQSU.js";import"./chunk-IJCCFLCQ.js";import"./chunk-ZQME5XUJ.js";import"./chunk-2VBFQZ72.js";import"./chunk-XSDAUM4F.js";import"./chunk-JESNVRVR.js";import{output_manager_default}from"./chunk-M774HRX5.js";import"./chunk-RM3ZDRYE.js";import"./chunk-OO572JUC.js";import"./chunk-D3AHZ5LI.js";import"./chunk-2GHZGOWT.js";import"./chunk-YHPPP3SF.js";import{require_source}from"./chunk-NB2WLB3J.js";import"./chunk-ISWW3DKF.js";import"./chunk-BRQUZ5NC.js";import{__toESM}from"./chunk-BZENIQ7N.js";var import_chalk=__toESM(require_source(),1);async function enable(client,argv){let parsed=await parseSubcommandArgs(argv,enableSubcommand,client);if(typeof parsed=="number")return parsed;let link=await requireProjectContext(client,"routes",parsed.flags["--project"]);if(typeof link=="number")return link;let{project,org}=link,teamId=org.type==="team"?org.id:void 0,{args}=parsed,identifier=args[0];if(!identifier)return client.nonInteractive&&outputAgentError(client,{status:"error",reason:"missing_arguments",message:"Route name or ID is required.",next:[{command:withGlobalFlags(client,"routes enable <name-or-id>"),when:"replace <name-or-id>"},{command:withGlobalFlags(client,"routes list"),when:"list routes"}]},2),output_manager_default.error(`Route name or ID is required. Usage: ${withGlobalFlags(client,"routes enable <name-or-id>")}`),2;let{versions}=await getRouteVersions(client,project.id,{teamId}),existingStagingVersion=versions.find(v=>v.isStaging);output_manager_default.spinner("Fetching routes");let{routes}=await getRoutes(client,project.id,{teamId});if(output_manager_default.stopSpinner(),routes.length===0)return client.nonInteractive&&outputAgentError(client,{status:"error",reason:"not_found",message:"No routes found in this project.",next:[{command:withGlobalFlags(client,"routes add --help"),when:"add routes first"}]},1),output_manager_default.error("No routes found in this project."),1;let route=await resolveRoute(client,routes,identifier);if(!route)return client.nonInteractive&&outputAgentError(client,{status:"error",reason:"not_found",message:`No route found matching "${identifier}".`,next:[{command:withGlobalFlags(client,"routes list"),when:"list routes"}]},1),output_manager_default.error(`No route found matching "${identifier}". Run ${import_chalk.default.cyan(withGlobalFlags(client,"routes list"))} to see all routes.`),1;if(route.enabled!==!1)return output_manager_default.log(`Route "${route.name}" is already enabled.`),0;let enableStamp=stamp_default();output_manager_default.spinner(`Enabling route "${route.name}"`);try{let{version}=await editRoute(client,project.id,route.id,{route:{name:route.name,description:route.description,enabled:!0,srcSyntax:route.srcSyntax,route:route.route}},{teamId});return output_manager_default.log(`${import_chalk.default.cyan("Enabled")} route "${route.name}" ${import_chalk.default.gray(enableStamp())}`),await offerAutoPromote(client,project.id,version,!!existingStagingVersion,{teamId}),0}catch(e){let error=e;return client.nonInteractive&&outputAgentError(client,{status:"error",reason:"api_error",message:error.message||"Failed to enable route"},1),output_manager_default.error(error.message||"Failed to enable route"),1}}export{enable as default};
@@ -1,7 +0,0 @@
1
- import { createRequire as __createRequire } from 'node:module';
2
- import { fileURLToPath as __fileURLToPath } from 'node:url';
3
- import { dirname as __dirname_ } from 'node:path';
4
- const require = __createRequire(import.meta.url);
5
- const __filename = __fileURLToPath(import.meta.url);
6
- const __dirname = __dirname_(__filename);
7
- import{getSignupVerificationUrl,login,performDeviceCodeFlow,saveDeviceCodeTokens}from"./chunk-CITTRAYH.js";import"./chunk-PVASGBEF.js";import"./chunk-EVQJ7SCV.js";import"./chunk-HARXQZV3.js";import"./chunk-AOWWC6WZ.js";import"./chunk-MY4MONOH.js";import"./chunk-VLDU2MDL.js";import"./chunk-DDLM6CIQ.js";import"./chunk-MI7W4QMV.js";import"./chunk-PPCFQQSU.js";import"./chunk-ZQME5XUJ.js";import"./chunk-2VBFQZ72.js";import"./chunk-XSDAUM4F.js";import"./chunk-JESNVRVR.js";import"./chunk-M774HRX5.js";import"./chunk-RM3ZDRYE.js";import"./chunk-OO572JUC.js";import"./chunk-D3AHZ5LI.js";import"./chunk-2GHZGOWT.js";import"./chunk-YHPPP3SF.js";import"./chunk-NB2WLB3J.js";import"./chunk-ISWW3DKF.js";import"./chunk-BRQUZ5NC.js";import"./chunk-BZENIQ7N.js";export{getSignupVerificationUrl,login,performDeviceCodeFlow,saveDeviceCodeTokens};
@@ -1,7 +0,0 @@
1
- import { createRequire as __createRequire } from 'node:module';
2
- import { fileURLToPath as __fileURLToPath } from 'node:url';
3
- import { dirname as __dirname_ } from 'node:path';
4
- const require = __createRequire(import.meta.url);
5
- const __filename = __fileURLToPath(import.meta.url);
6
- const __dirname = __dirname_(__filename);
7
- import{createCertForCns,require_cjs,setupDomain}from"./chunk-LUJL3KFT.js";import"./chunk-DXLLC7ZM.js";import"./chunk-O4FDRZ22.js";import"./chunk-T3GQAMBJ.js";import"./chunk-A2RZZQEP.js";import"./chunk-3G3FQYMW.js";import"./chunk-Q7D7RGXM.js";import"./chunk-HVUJNVPS.js";import"./chunk-GLH4PVMY.js";import"./chunk-XEBMH33W.js";import"./chunk-VKXEOL4K.js";import"./chunk-MXTC4ZAQ.js";import"./chunk-4SAVH3H7.js";import"./chunk-ZS2WS4AM.js";import"./chunk-AOWWC6WZ.js";import"./chunk-MY4MONOH.js";import"./chunk-VLDU2MDL.js";import"./chunk-DDLM6CIQ.js";import"./chunk-MI7W4QMV.js";import"./chunk-JIGCN5QS.js";import"./chunk-ROPQIBWJ.js";import"./chunk-VKPZP4LC.js";import"./chunk-PPCFQQSU.js";import"./chunk-IJCCFLCQ.js";import"./chunk-ZQME5XUJ.js";import"./chunk-2VBFQZ72.js";import{InvalidDomain,NowError}from"./chunk-XSDAUM4F.js";import"./chunk-JESNVRVR.js";import{output_manager_default}from"./chunk-M774HRX5.js";import"./chunk-RM3ZDRYE.js";import"./chunk-OO572JUC.js";import"./chunk-D3AHZ5LI.js";import"./chunk-2GHZGOWT.js";import"./chunk-YHPPP3SF.js";import"./chunk-NB2WLB3J.js";import"./chunk-ISWW3DKF.js";import"./chunk-BRQUZ5NC.js";import{__toESM}from"./chunk-BZENIQ7N.js";var import_tldts=__toESM(require_cjs(),1);async function generateCertForDeploy(client,contextName,deployURL){let parsedDomain=(0,import_tldts.parse)(deployURL),{domain}=parsedDomain;if(!domain)return new InvalidDomain(deployURL);output_manager_default.spinner(`Setting custom suffix domain ${domain}`);let result=await setupDomain(client,domain,contextName);if(output_manager_default.stopSpinner(),result instanceof NowError)return result;output_manager_default.spinner(`Generating a wildcard certificate for ${domain}`);let cert=await createCertForCns(client,[domain,`*.${domain}`],contextName);if(output_manager_default.stopSpinner(),cert instanceof NowError)return cert}export{generateCertForDeploy as default};
@@ -1,7 +0,0 @@
1
- import { createRequire as __createRequire } from 'node:module';
2
- import { fileURLToPath as __fileURLToPath } from 'node:url';
3
- import { dirname as __dirname_ } from 'node:path';
4
- const require = __createRequire(import.meta.url);
5
- const __filename = __fileURLToPath(import.meta.url);
6
- const __dirname = __dirname_(__filename);
7
- import{getInvalidSubcommand}from"./chunk-TG2RCYTH.js";import{getSubcommand}from"./chunk-ETV3C2CV.js";import{AGENT_REASON,buildCommandWithGlobalFlags,outputAgentError}from"./chunk-DDLM6CIQ.js";import"./chunk-MI7W4QMV.js";import"./chunk-2VBFQZ72.js";import"./chunk-XSDAUM4F.js";import"./chunk-JESNVRVR.js";import{output_manager_default}from"./chunk-M774HRX5.js";import"./chunk-RM3ZDRYE.js";import"./chunk-OO572JUC.js";import"./chunk-D3AHZ5LI.js";import"./chunk-2GHZGOWT.js";import"./chunk-YHPPP3SF.js";import"./chunk-NB2WLB3J.js";import"./chunk-ISWW3DKF.js";import"./chunk-BRQUZ5NC.js";import"./chunk-BZENIQ7N.js";var IMAGE_CONFIG={ls:["ls","list"],inspect:["inspect","get"],rm:["rm","remove","delete"]};async function image(client,argv,telemetry){let{subcommand,args}=getSubcommand(argv,IMAGE_CONFIG);if(subcommand==null){let message=argv.length===0?getInvalidSubcommand(IMAGE_CONFIG):`Unknown "vcr image" subcommand "${argv[0]}".`;return outputAgentError(client,{status:"error",reason:AGENT_REASON.INVALID_ARGUMENTS,message,next:[{command:buildCommandWithGlobalFlags(client.argv,"vcr image --help"),when:"Show valid image subcommands"}]},2),output_manager_default.error(`${message} Run \`vercel vcr image --help\`.`),2}switch(subcommand){case"ls":return(await import("./ls-7DJWHOK4.js")).default(client,args,telemetry);case"inspect":return(await import("./inspect-PQNECP2Z.js")).default(client,args,telemetry);case"rm":return(await import("./rm-SKCAZTYN.js")).default(client,args,telemetry);default:return output_manager_default.error(`Unhandled image subcommand: ${subcommand}`),1}}export{image as default};
@@ -1,13 +0,0 @@
1
- import { createRequire as __createRequire } from 'node:module';
2
- import { fileURLToPath as __fileURLToPath } from 'node:url';
3
- import { dirname as __dirname_ } from 'node:path';
4
- const require = __createRequire(import.meta.url);
5
- const __filename = __fileURLToPath(import.meta.url);
6
- const __dirname = __dirname_(__filename);
7
- import{formatTriggerOperator,getGroupStartedAt,getGroupTitle,getGroupType,humanizeReference,normalizeTimestamp,renderAlertTable}from"./chunk-RRWEIG6B.js";import{resolveAlertsScope}from"./chunk-PTI3TP7P.js";import{formatGranularity}from"./chunk-IVSSTHB6.js";import{formatDate}from"./chunk-YTDK6AHS.js";import"./chunk-GZNDA6SV.js";import{outputError}from"./chunk-ZQKDO5PL.js";import"./chunk-GHAY4PSD.js";import{truncateEnd,truncateMiddle}from"./chunk-ID663OJ7.js";import{inspectSubcommand}from"./chunk-GVVIFYQE.js";import"./chunk-W3TGCMRW.js";import"./chunk-773GOZIR.js";import{printError}from"./chunk-HARXQZV3.js";import"./chunk-67GZ5REA.js";import"./chunk-BS32OUOC.js";import{validateJsonOutput}from"./chunk-D4MW3RDW.js";import"./chunk-GLH4PVMY.js";import"./chunk-XEBMH33W.js";import"./chunk-VKXEOL4K.js";import"./chunk-MXTC4ZAQ.js";import"./chunk-4SAVH3H7.js";import"./chunk-ZS2WS4AM.js";import"./chunk-AOWWC6WZ.js";import"./chunk-MY4MONOH.js";import{parseArguments}from"./chunk-VLDU2MDL.js";import{AGENT_REASON,buildCommandWithGlobalFlags,outputAgentError}from"./chunk-DDLM6CIQ.js";import{getFlagsSpecification}from"./chunk-MI7W4QMV.js";import"./chunk-JIGCN5QS.js";import"./chunk-ROPQIBWJ.js";import"./chunk-VKPZP4LC.js";import"./chunk-PPCFQQSU.js";import"./chunk-IJCCFLCQ.js";import"./chunk-ZQME5XUJ.js";import"./chunk-2VBFQZ72.js";import{isAPIError}from"./chunk-XSDAUM4F.js";import{packageName}from"./chunk-JESNVRVR.js";import{output_manager_default}from"./chunk-M774HRX5.js";import"./chunk-RM3ZDRYE.js";import"./chunk-OO572JUC.js";import"./chunk-D3AHZ5LI.js";import"./chunk-2GHZGOWT.js";import"./chunk-YHPPP3SF.js";import{require_source}from"./chunk-NB2WLB3J.js";import"./chunk-ISWW3DKF.js";import"./chunk-BRQUZ5NC.js";import{__toESM}from"./chunk-BZENIQ7N.js";var import_chalk=__toESM(require_source(),1);var aggregationLabels={sum:"Sum",avg:"Average",min:"Min",max:"Max",p50:"P50",p75:"P75",p90:"P90",p95:"P95",p99:"P99",stddev:"Std Dev",unique:"Unique",persecond:"Per Second",percent:"Percent"},formatCustomAlertRatioBelowFivePercent=new Intl.NumberFormat("en-US",{maximumFractionDigits:2,minimumFractionDigits:2,style:"percent"}),formatCustomAlertRatioThresholdValue=new Intl.NumberFormat("en-US",{maximumFractionDigits:4,minimumFractionDigits:0,style:"percent"});function getGroupStatus(group){if(group.status)return group.status;let alerts=group.alerts??[];return alerts.some(alert=>alert.status==="active")?"active":alerts.length>0?"resolved":"-"}function humanizeLabel(value){return humanizeReference(value,{case:"title"})}function formatAlertFieldValue(value,maxLength=64){if(value==null)return;let displayValue=typeof value=="number"?formatNumber(value):String(value);if(displayValue)return truncateMiddle(displayValue,maxLength)}function formatNumber(value){let absValue=Math.abs(value),sign=value<0?"-":"";for(let[threshold,suffix]of[[1e9,"B"],[1e6,"M"],[1e3,"k"]])if(absValue>=threshold)return`${sign}${(absValue/threshold).toFixed(1).replace(/\.0$/,"")}${suffix}`;return Number.isInteger(value)?String(value):value.toFixed(2).replace(/\.?0+$/,"")}function parseFormattedNumber(value){let trimmed=value.trim();if(!trimmed)return;let number=Number(trimmed.replace(/,/g,""));return Number.isFinite(number)?number:void 0}function formatRatio(value){if(value.trim().endsWith("%"))return value;let number=parseFormattedNumber(value);if(number===void 0)return value;let percent=number*100;return percent>=5?`${Math.floor(percent)}%`:formatCustomAlertRatioBelowFivePercent.format(number)}function formatRatioThreshold(value){if(value.trim().endsWith("%"))return value;let number=parseFormattedNumber(value);return number===void 0?value:formatCustomAlertRatioThresholdValue.format(number)}function getAlertSonarQuery(alert){return alert.sonarQuery??alert.data?.sonarQuery}function getCustomAlertBaselineTitle(alert){let granularity=getAlertSonarQuery(alert)?.granularity;return(granularity&&("hours"in granularity||"days"in granularity)?"7-day baseline":"24-hour baseline").replace(/\b[a-z]/g,character=>character.toUpperCase())}function appendUnit(value,unit){return!unit||unit==="score"?value:unit==="ratio"?formatRatio(value):unit==="%"?value.endsWith("%")?value:`${value}%`:value.toLowerCase().includes(unit.toLowerCase())?value:`${value} ${unit}`}function formatThreshold(alert){let data=alert.data,formatted=alert.formattedValues?.formattedThreshold??(data?.triggerThreshold===void 0?void 0:formatNumber(data.triggerThreshold));if(!formatted)return;let operator=formatTriggerOperator(data?.triggerOperator),threshold=data?.triggerType==="anomaly"?`${formatted} z-score`:alert.unit==="ratio"?formatRatioThreshold(formatted):appendUnit(formatted,alert.unit);return[operator,threshold].filter(Boolean).join(" ")}function getRuleIds(alert){let ids=new Set,dataRuleId=alert.data?.ruleId;dataRuleId&&ids.add(dataRuleId);for(let ruleId of alert.rules??[])ruleId&&ids.add(ruleId);return[...ids]}function getAlertResolvedAt(alert){return normalizeTimestamp(alert.recordedResolvedAt??alert.resolvedAt)}function getSignalRows(alert){let rows=[],formattedValues=alert.formattedValues??{},observed=formattedValues.formattedCount,baseline=formattedValues.formattedAvg,change=[formattedValues.changeDirection,formattedValues.changeAmount].filter(Boolean).join(" "),zscore=alert.data?.zscore,threshold=formatThreshold(alert),minThreshold=alert.data?.minThreshold,isRatioFormulaAlert=!!getCustomAlertFormula(alert);return alert.eventLabel&&rows.push(["Event",alert.eventLabel]),alert.measureLabel&&rows.push(["Measure",alert.measureLabel]),observed&&rows.push(["Observed Value",appendUnit(observed,alert.unit)]),baseline&&rows.push([alert.type==="custom_alert"&&alert.data?.triggerType==="anomaly"?getCustomAlertBaselineTitle(alert):"Baseline",appendUnit(baseline,alert.unit)]),change&&rows.push(["Change",change]),zscore!==void 0&&rows.push(["Observed Deviation",`${formatNumber(zscore)} z-score`]),threshold&&rows.push(["Threshold",threshold]),minThreshold!==void 0&&!isRatioFormulaAlert&&rows.push(["Minimum",alert.unit==="ratio"?formatNumber(minThreshold):appendUnit(formatNumber(minThreshold),alert.unit)]),formattedValues.errorRate&&rows.push(["Error Rate",formattedValues.errorRate]),formattedValues.avgErrorRate&&rows.push(["Baseline Error Rate",formattedValues.avgErrorRate]),rows.push(...getFieldRows(alert)),rows}function getFieldRows(alert){let fields=alert.data?.fields;if(!fields)return[];let groupBy=getAlertSonarQuery(alert)?.groupBy??[];return[...groupBy,...Object.keys(fields).filter(key=>!groupBy.includes(key))].flatMap(key=>{let value=fields[key],displayValue=formatAlertFieldValue(value);return displayValue?[[humanizeLabel(key),displayValue]]:[]})}function formatAggregation(value){return value?aggregationLabels[value]??humanizeLabel(value):void 0}function formatQueryReference(value){return value?humanizeLabel(value):void 0}function formatRollupDetail(rollup,fallbackMeasure){if(!rollup)return;let aggregation=formatAggregation(rollup.aggregation),measure=fallbackMeasure??formatQueryReference(rollup.measure);return[aggregation,measure].filter(Boolean).join(" ")||void 0}function getPrimaryRollup(rollups){return Object.values(rollups??{})[0]}function getCustomAlertFormula(alert){let formula=alert.data?.formula;if(formula?.operator==="divide"&&formula.left&&formula.right)return{operator:formula.operator,left:formula.left,right:formula.right}}function getQueryRows(alert){if(alert.type!=="custom_alert")return[];let query=getAlertSonarQuery(alert);if(!query)return[];let formula=getCustomAlertFormula(alert),rows=[],addRow=(label,value)=>{value&&rows.push([label,truncateMiddle(value,120)])};if(addRow("Event",alert.eventLabel??formatQueryReference(query.event)),formula)addRow("Numerator",formatRollupDetail(query.rollups?.[formula.left])),addRow("Denominator",formatRollupDetail(query.rollups?.[formula.right]));else{let primaryRollup=getPrimaryRollup(query.rollups);addRow("Measure",alert.measureLabel??formatQueryReference(primaryRollup?.measure)),addRow("Aggregation",formatAggregation(primaryRollup?.aggregation))}addRow("Granularity",formatGranularity(query.granularity));let groupBy=query.groupBy?.filter(Boolean)??[];if(groupBy.length>0&&addRow("Group by",groupBy.map(humanizeLabel).join(", ")),formula&&typeof alert.data?.minThreshold=="number"&&addRow("Minimum Numerator",formatNumber(alert.data.minThreshold)),addRow("Filter by",query.filter?.trim()),formula)for(let[label,rollupName]of[["Numerator filter",formula.left],["Denominator filter",formula.right]])addRow(label,query.rollups?.[rollupName]?.filter?.trim());return rows}function getDetailRows(alert){let data=alert.data;if(!data)return[];let rows=[],addRow=(label,value)=>{let displayValue=formatAlertFieldValue(value);displayValue&&rows.push([label,displayValue])};return addRow("Route",data.route),addRow("Status Group",data.statusGroup),addRow("Deployment ID",data.deploymentId),rows}function renderAlertSections(alert){let lines=[],signalRows=getSignalRows(alert);signalRows.length>0&&(lines.push(import_chalk.default.cyan("Signals")),lines.push(renderAlertTable(signalRows,3)));let queryRows=getQueryRows(alert);return queryRows.length>0&&(lines.push(import_chalk.default.cyan("Query")),lines.push(renderAlertTable(queryRows,3))),lines.join(`
8
- `)}function renderAlert(alert,index,totalAlerts){let title=alert.title||`Alert ${index+1}`,ruleIds=getRuleIds(alert),resolvedAt=getAlertResolvedAt(alert),sections=renderAlertSections(alert),summaryRows=[["Alert id",alert.id||"-"],["Type",alert.type||"-"],["Status",alert.status||"-"],["Started At",formatDate(normalizeTimestamp(alert.recordedStartedAt??alert.startedAt))],...resolvedAt!==void 0?[["Resolved At",formatDate(resolvedAt)]]:[],...ruleIds.length>0?[["Rule id",ruleIds.map(id=>truncateMiddle(id,48)).join(", ")]]:[],...getDetailRows(alert)];return[import_chalk.default.bold(totalAlerts>1?`Alert ${index+1}: ${title}`:title),renderAlertTable(summaryRows,3),...sections?[sections]:[]].join(`
9
- `)}function printAlertGroup(group,groupId){let alerts=group.alerts??[],singleAlert=alerts.length===1?alerts[0]:void 0,singleAlertRuleIds=singleAlert?getRuleIds(singleAlert):[],singleAlertResolvedAt=singleAlert?getAlertResolvedAt(singleAlert):void 0,summaryRows=[["Title",truncateEnd(getGroupTitle(group),80)],["Group id",group.id||groupId],["Type",getGroupType(group)],["Status",getGroupStatus(group)],["Started At",formatDate(getGroupStartedAt(group))],...singleAlertResolvedAt!==void 0?[["Resolved At",formatDate(singleAlertResolvedAt)]]:[],["Alerts",String(alerts.length)],...singleAlert?.id?[["Alert id",singleAlert.id]]:[],...singleAlertRuleIds.length>0?[["Rule id",singleAlertRuleIds.map(id=>truncateMiddle(id,48)).join(", ")]]:[],...singleAlert?getDetailRows(singleAlert):[]],renderedAlerts=alerts.length>0?alerts.length===1?renderAlertSections(alerts[0]):alerts.map((alert,index)=>renderAlert(alert,index,alerts.length)).join(`
10
-
11
- `):"No alerts in this group.";output_manager_default.print(["",`${import_chalk.default.bold("Alert group")} ${import_chalk.default.cyan(group.id||groupId)}`,renderAlertTable(summaryRows,3),"",renderedAlerts,""].join(`
12
- `))}async function inspect(client,argv){let parsedArgs,spec=getFlagsSpecification(inspectSubcommand.options);try{parsedArgs=parseArguments(argv,spec)}catch(e){let msg=e instanceof Error?e.message:String(e),projectFlagMissingArg=msg.includes("--project")&&msg.includes("requires argument");return outputAgentError(client,{status:"error",reason:AGENT_REASON.INVALID_ARGUMENTS,message:projectFlagMissingArg?"`--project` requires a project name or id (for example `--project my-app`).":msg,next:projectFlagMissingArg?[{command:buildCommandWithGlobalFlags(client.argv,"alerts inspect <groupId> --project <name-or-id>"),when:"Re-run with placeholders replaced"}]:[{command:buildCommandWithGlobalFlags(client.argv,"alerts inspect --help"),when:"See valid `alerts inspect` usage"}]},2),printError(e),2}let groupId=parsedArgs.args[0],fr=validateJsonOutput(parsedArgs.flags);if(!fr.valid)return outputAgentError(client,{status:"error",reason:AGENT_REASON.INVALID_ARGUMENTS,message:fr.error},2),output_manager_default.error(fr.error),2;if(!groupId)return outputAgentError(client,{status:"error",reason:AGENT_REASON.MISSING_ARGUMENTS,message:`Missing group id. Example: ${packageName} alerts inspect <groupId>`,next:[{command:buildCommandWithGlobalFlags(client.argv,"alerts inspect <groupId>"),when:"Replace <groupId> with a group id from `vercel alerts`"}]},2),outputError(client,fr.jsonOutput,"MISSING_ARGUMENTS","Usage: `vercel alerts inspect <groupId>`");let scope=await resolveAlertsScope(client,{project:parsedArgs.flags["--project"],all:parsedArgs.flags["--all"],jsonOutput:fr.jsonOutput,command:`alerts inspect ${groupId}`});if(typeof scope=="number")return scope;let query=new URLSearchParams({teamId:scope.teamId});scope.projectId&&query.set("projectId",scope.projectId);let path=`/alerts/v3/groups/${encodeURIComponent(groupId)}?${query.toString()}`;output_manager_default.spinner("Fetching alert group...");try{let group=await client.fetch(path);return fr.jsonOutput?client.stdout.write(`${JSON.stringify({group},null,2)}
13
- `):printAlertGroup(group,groupId),0}catch(err){if(isAPIError(err)){let msg=err.serverMessage||`API error (${err.status}).`,reason=err.status===401?"not_authorized":err.status===403?"forbidden":err.status===404?AGENT_REASON.NOT_FOUND:err.status===429?"rate_limited":AGENT_REASON.API_ERROR;return outputAgentError(client,{status:"error",reason,message:msg,...err.status===401||err.status===403?{hint:"Confirm team scope; use --scope <team-slug> if the group belongs to another team.",next:[{command:buildCommandWithGlobalFlags(client.argv,"whoami"),when:"See current user and team"},{command:buildCommandWithGlobalFlags(client.argv,`alerts inspect ${groupId}`),when:"Retry after fixing scope or permissions"}]}:{}},1),outputError(client,fr.jsonOutput,err.code||"API_ERROR",msg)}throw err}finally{output_manager_default.stopSpinner()}}export{inspect as default};
@@ -1,11 +0,0 @@
1
- import { createRequire as __createRequire } from 'node:module';
2
- import { fileURLToPath as __fileURLToPath } from 'node:url';
3
- import { dirname as __dirname_ } from 'node:path';
4
- const require = __createRequire(import.meta.url);
5
- const __filename = __fileURLToPath(import.meta.url);
6
- const __dirname = __dirname_(__filename);
7
- import{renderThreadRow}from"./chunk-GNV6PG6W.js";import{handleCommentsParseError,inferBranch,listThreads,resolveCommentsScope}from"./chunk-6QRT6USI.js";import{handleValidationError,outputError,validateIntegerRangeWithDefault}from"./chunk-ZQKDO5PL.js";import"./chunk-F4KY2TOK.js";import"./chunk-ID663OJ7.js";import"./chunk-DRXOTZSJ.js";import"./chunk-VEMJINMZ.js";import{listSubcommand}from"./chunk-7NNENHGN.js";import"./chunk-HARXQZV3.js";import"./chunk-BS32OUOC.js";import{validateJsonOutput}from"./chunk-D4MW3RDW.js";import{getScope}from"./chunk-GLH4PVMY.js";import"./chunk-XEBMH33W.js";import"./chunk-VKXEOL4K.js";import"./chunk-MXTC4ZAQ.js";import"./chunk-4SAVH3H7.js";import"./chunk-ZS2WS4AM.js";import"./chunk-AOWWC6WZ.js";import"./chunk-MY4MONOH.js";import{parseArguments}from"./chunk-VLDU2MDL.js";import"./chunk-DDLM6CIQ.js";import{getFlagsSpecification,stripSensitiveAuthArgs}from"./chunk-MI7W4QMV.js";import"./chunk-JIGCN5QS.js";import"./chunk-ROPQIBWJ.js";import"./chunk-VKPZP4LC.js";import"./chunk-PPCFQQSU.js";import"./chunk-IJCCFLCQ.js";import"./chunk-ZQME5XUJ.js";import"./chunk-2VBFQZ72.js";import{isAPIError}from"./chunk-XSDAUM4F.js";import{getCommandName}from"./chunk-JESNVRVR.js";import{output_manager_default}from"./chunk-M774HRX5.js";import"./chunk-RM3ZDRYE.js";import"./chunk-OO572JUC.js";import"./chunk-D3AHZ5LI.js";import"./chunk-2GHZGOWT.js";import"./chunk-YHPPP3SF.js";import{require_source}from"./chunk-NB2WLB3J.js";import"./chunk-ISWW3DKF.js";import"./chunk-BRQUZ5NC.js";import{__toESM}from"./chunk-BZENIQ7N.js";var import_chalk=__toESM(require_source(),1);function validateStatus(value){let status=value??"unresolved";if(["unresolved","resolved","all"].includes(status))return status}async function resolveAuthors(client,authors,jsonOutput){if(!authors||authors.length===0)return;if(!authors.includes("me"))return authors;let{user}=await getScope(client);return user?authors.map(author=>author==="me"?user.id:author):outputError(client,jsonOutput,"USER_REQUIRED","Can't resolve `--author me` when authenticated as an app. Use an author ID with `--author`, or authenticate with a user token.")}function statusWord(status){return status==="all"?"":` ${status}`}function printActiveFilters(flags){let parts=[];flags["--author"]?.length&&parts.push(`--author ${flags["--author"].join(", ")} (takes a user ID or \`me\` \u2014 usernames match nothing)`);let pagePaths=flags["--page-path"]??flags["--page"];pagePaths?.length&&parts.push(`--page-path ${pagePaths.join(", ")}`),flags["--search"]&&parts.push(`--search ${flags["--search"]}`),flags["--content-id"]?.length&&parts.push(`--content-id ${flags["--content-id"].join(", ")}`),parts.length>0&&output_manager_default.log(`Filters: ${parts.join(" \xB7 ")}`)}function countLine(count,status){return`${count}${statusWord(status)} comment${count===1?"":"s"}`}var SCOPE_FLAG_NAMES=new Set(["--scope","-S","--project","-p","--team","-T"]);function argvFlagTokens(client){return stripSensitiveAuthArgs(client.argv.slice(3))}function scopeFlagsSuffix(client){let tokens=argvFlagTokens(client),out=[];for(let i=0;i<tokens.length;i++){let token=tokens[i],name=token.split("=")[0];SCOPE_FLAG_NAMES.has(name)&&(out.push(token),!token.includes("=")&&i+1<tokens.length&&out.push(tokens[++i]))}return out.length>0?` ${out.join(" ")}`:""}function nextPageFlagsSuffix(client){let tokens=argvFlagTokens(client),out=[];for(let i=0;i<tokens.length;i++){let token=tokens[i];if(!token.startsWith("-"))continue;let name=token.split("=")[0];if(name==="--next"||name==="-N"){!token.includes("=")&&i+1<tokens.length&&i++;continue}out.push(name==="--page"?token.replace(/^--page(?==|$)/,"--page-path"):token),!token.includes("=")&&i+1<tokens.length&&!tokens[i+1].startsWith("-")&&out.push(tokens[++i])}return out.length>0?` ${out.join(" ")}`:""}function shellSafe(value){return/^[A-Za-z0-9._/-]+$/.test(value)?value:`'${value.replace(/'/g,"'\\''")}'`}async function printEmptyState(client,scope,focus,params,status,flags){let probe;try{probe=await listThreads(client,scope.teamId,{...params,branch:void 0,cursor:void 0,limit:20})}catch{output_manager_default.log(`No${statusWord(status)} comments on ${focus.value}.`);return}let branches=new Map;for(let thread of probe.threads){let branch=thread.branch??"(no branch)";branches.set(branch,(branches.get(branch)??0)+1)}if(branches.size===0){output_manager_default.log(`No${statusWord(status)} comments in ${scope.projectName??"this project"} on any branch.`),printActiveFilters(flags);return}output_manager_default.log(`No${statusWord(status)} comments on ${focus.value}.`);let suffix=probe.pagination.nextCursor?"+":"",scopeSuffix=scopeFlagsSuffix(client);if(branches.size===1){let[branch,count]=[...branches.entries()][0];output_manager_default.log(`${count}${suffix}${statusWord(status)} on ${import_chalk.default.bold(branch)} \u2014 run ${getCommandName(`comments --branch ${shellSafe(branch)}${scopeSuffix}`)}`);return}let total=[...branches.values()].reduce((a,b)=>a+b,0);output_manager_default.log(`${total}${suffix}${statusWord(status)} on other branches \u2014 run ${getCommandName(`comments --all-branches${scopeSuffix}`)}`)}async function list(client,telemetry,defaultInvocation){let parsedArgs,flagsSpecification=getFlagsSpecification(listSubcommand.options);try{parsedArgs=parseArguments(client.argv.slice(2),flagsSpecification)}catch(err){return handleCommentsParseError(err,"list")}let flags=parsedArgs.flags,pagePaths=flags["--page-path"]??flags["--page"],expectedPositionals=defaultInvocation?1:2;if(parsedArgs.args.length>expectedPositionals)return output_manager_default.error(`Unknown ${defaultInvocation?"subcommand":"argument"} "${parsedArgs.args[expectedPositionals]}". Run \`vercel comments --help\` for usage.`),1;let formatResult=validateJsonOutput(flags);if(!formatResult.valid)return output_manager_default.error(formatResult.error),2;let jsonOutput=formatResult.jsonOutput;telemetry.trackCliOptionProject(flags["--project"]),telemetry.trackCliOptionBranch(flags["--branch"]),telemetry.trackCliFlagAllBranches(flags["--all-branches"]),telemetry.trackCliOptionStatus(flags["--status"]),telemetry.trackCliOptionPagePath(flags["--page-path"]),telemetry.trackCliOptionPage(flags["--page"]),telemetry.trackCliOptionAuthor(flags["--author"]),telemetry.trackCliOptionContentId(flags["--content-id"]),telemetry.trackCliOptionSearch(flags["--search"]),telemetry.trackCliOptionLimit(flags["--limit"]),telemetry.trackCliOptionNext(flags["--next"]),telemetry.trackCliOptionFormat(flags["--format"]);let status=validateStatus(flags["--status"]);if(!status)return outputError(client,jsonOutput,"INVALID_STATUS",`Invalid --status "${flags["--status"]}". Valid values: unresolved, resolved, all.`);let limitResult=validateIntegerRangeWithDefault(flags["--limit"],{flag:"--limit",min:1,max:100,defaultValue:20});if(!limitResult.valid)return handleValidationError(limitResult,jsonOutput,client);if(flags["--branch"]&&flags["--all-branches"])return outputError(client,jsonOutput,"MUTUAL_EXCLUSIVITY","Cannot specify both --branch and --all-branches.");let scope=await resolveCommentsScope(client,{project:flags["--project"],requireProject:!0,jsonOutput});if(typeof scope=="number")return scope;let focus,branchFilter;if(flags["--branch"]&&flags["--branch"].length>0)branchFilter=flags["--branch"],focus={value:branchFilter.join(", "),source:"flag"};else if(!flags["--all-branches"]&&scope.linked){let inferred=inferBranch(client.cwd);inferred&&(focus=inferred,branchFilter=[inferred.value])}let authors=await resolveAuthors(client,flags["--author"],jsonOutput);if(typeof authors=="number")return authors;let params={projectId:scope.projectId,branch:branchFilter,status:status==="all"?void 0:status,page:pagePaths,author:authors,contentId:flags["--content-id"],search:flags["--search"],limit:limitResult.value,cursor:flags["--next"]};jsonOutput||output_manager_default.spinner("Fetching comments\u2026");let response;try{response=await listThreads(client,scope.teamId,params)}catch(err){if(isAPIError(err))return outputError(client,jsonOutput,err.code||"API_ERROR",err.serverMessage||`API error (${err.status}).`);throw err}finally{output_manager_default.stopSpinner()}let threads=response.threads??[],nextCursor=response.pagination?.nextCursor??null;if(jsonOutput){let envelope={scope:{teamId:scope.teamId,...scope.teamSlug&&{teamSlug:scope.teamSlug},...scope.projectId&&{projectId:scope.projectId},...scope.projectName&&{projectName:scope.projectName},...focus&&focus.source!=="flag"&&{inferredBranch:focus.value}},filters:{...status!=="all"&&{status},...focus&&{branch:{value:focus.value,source:focus.source}}},pagination:{nextCursor},threads};return client.stdout.write(`${JSON.stringify(envelope,null,2)}
8
- `),0}let branchLabel=focus?focus.value:"all branches";if(output_manager_default.log(`Comments in ${import_chalk.default.bold(scope.projectName??scope.projectId??"")} \xB7 ${branchLabel}`),threads.length===0)return focus?await printEmptyState(client,scope,focus,params,status,flags):(output_manager_default.log(`No${statusWord(status)} comments in ${scope.projectName??"this project"}.`),printActiveFilters(flags)),0;output_manager_default.print(`
9
- `);for(let thread of threads)output_manager_default.print(`${renderThreadRow(thread,{showBranch:!focus})}
10
-
11
- `);return output_manager_default.log(countLine(threads.length,status)),output_manager_default.log(`To read a thread, run ${getCommandName(`comments inspect <id>${scopeFlagsSuffix(client)}`)}`),nextCursor&&output_manager_default.log(`To display the next page, run ${getCommandName(`comments${nextPageFlagsSuffix(client)} --next ${nextCursor}`)}`),0}export{list as default};
@@ -1,7 +0,0 @@
1
- import { createRequire as __createRequire } from 'node:module';
2
- import { fileURLToPath as __fileURLToPath } from 'node:url';
3
- import { dirname as __dirname_ } from 'node:path';
4
- const require = __createRequire(import.meta.url);
5
- const __filename = __fileURLToPath(import.meta.url);
6
- const __dirname = __dirname_(__filename);
7
- import{login}from"./chunk-3GUO6F6P.js";import"./chunk-CITTRAYH.js";import"./chunk-PVASGBEF.js";import"./chunk-B4YYOSPY.js";import"./chunk-EVQJ7SCV.js";import"./chunk-H3KYG32S.js";import"./chunk-773GOZIR.js";import"./chunk-HARXQZV3.js";import"./chunk-67GZ5REA.js";import"./chunk-BS32OUOC.js";import"./chunk-KUGXOLL7.js";import"./chunk-VKXEOL4K.js";import"./chunk-NWGBDBZI.js";import"./chunk-4SAVH3H7.js";import"./chunk-AOWWC6WZ.js";import"./chunk-MY4MONOH.js";import"./chunk-VLDU2MDL.js";import"./chunk-DDLM6CIQ.js";import"./chunk-MI7W4QMV.js";import"./chunk-VKPZP4LC.js";import"./chunk-PPCFQQSU.js";import"./chunk-ZQME5XUJ.js";import"./chunk-2VBFQZ72.js";import"./chunk-XSDAUM4F.js";import"./chunk-JESNVRVR.js";import"./chunk-M774HRX5.js";import"./chunk-RM3ZDRYE.js";import"./chunk-OO572JUC.js";import"./chunk-D3AHZ5LI.js";import"./chunk-2GHZGOWT.js";import"./chunk-YHPPP3SF.js";import"./chunk-NB2WLB3J.js";import"./chunk-ISWW3DKF.js";import"./chunk-BRQUZ5NC.js";import"./chunk-BZENIQ7N.js";export{login as default};
@@ -1,7 +0,0 @@
1
- import { createRequire as __createRequire } from 'node:module';
2
- import { fileURLToPath as __fileURLToPath } from 'node:url';
3
- import { dirname as __dirname_ } from 'node:path';
4
- const require = __createRequire(import.meta.url);
5
- const __filename = __fileURLToPath(import.meta.url);
6
- const __dirname = __dirname_(__filename);
7
- import{collectBuildLogs,displayBuildLogs,displayBuildLogsUntilFinalError,parseLogLines}from"./chunk-VS7O22ED.js";import"./chunk-3NNH2U5M.js";import"./chunk-O4FDRZ22.js";import"./chunk-IVIZLWZQ.js";import"./chunk-HVUJNVPS.js";import"./chunk-BS32OUOC.js";import"./chunk-GLH4PVMY.js";import"./chunk-XEBMH33W.js";import"./chunk-VKXEOL4K.js";import"./chunk-MXTC4ZAQ.js";import"./chunk-4SAVH3H7.js";import"./chunk-ZS2WS4AM.js";import"./chunk-AOWWC6WZ.js";import"./chunk-MY4MONOH.js";import"./chunk-VLDU2MDL.js";import"./chunk-DDLM6CIQ.js";import"./chunk-MI7W4QMV.js";import"./chunk-JIGCN5QS.js";import"./chunk-ROPQIBWJ.js";import"./chunk-VKPZP4LC.js";import"./chunk-PPCFQQSU.js";import"./chunk-IJCCFLCQ.js";import"./chunk-ZQME5XUJ.js";import"./chunk-2VBFQZ72.js";import"./chunk-XSDAUM4F.js";import"./chunk-JESNVRVR.js";import"./chunk-M774HRX5.js";import"./chunk-RM3ZDRYE.js";import"./chunk-OO572JUC.js";import"./chunk-D3AHZ5LI.js";import"./chunk-2GHZGOWT.js";import"./chunk-YHPPP3SF.js";import"./chunk-NB2WLB3J.js";import"./chunk-ISWW3DKF.js";import"./chunk-BRQUZ5NC.js";import"./chunk-BZENIQ7N.js";export{collectBuildLogs,displayBuildLogs,displayBuildLogsUntilFinalError,parseLogLines};