vercel 62.4.0 → 62.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.
- package/README.md +2 -0
- package/dist/chunks/{add-XZMJUVCZ.js → add-OXHI3PVM.js} +1 -1
- package/dist/chunks/{add-K6P7R3M4.js → add-P3FNSVMN.js} +1 -1
- package/dist/chunks/{add-E6SM6YUU.js → add-WUT6QU2J.js} +1 -1
- package/dist/chunks/{build-ORM2P3M7.js → build-J6VW3KHT.js} +1 -1
- package/dist/chunks/{chunk-3YAQUAOG.js → chunk-2KSNNB4B.js} +1 -1
- package/dist/chunks/{chunk-54SEEVOA.js → chunk-35QK5NDD.js} +1 -1
- package/dist/chunks/{chunk-LOD56FYJ.js → chunk-3XLK5ZPD.js} +5 -5
- package/dist/chunks/{chunk-TNJVIC27.js → chunk-3ZMD36SU.js} +1 -1
- package/dist/chunks/{chunk-GV6XYKYC.js → chunk-46UCIIJN.js} +1 -1
- package/dist/chunks/chunk-4CACOKMS.js +7 -0
- package/dist/chunks/chunk-4H5LPD3T.js +9 -0
- package/dist/chunks/{chunk-SDGWKUST.js → chunk-4KQBTIMZ.js} +1 -1
- package/dist/chunks/{chunk-YMM3VY3J.js → chunk-4QSVBLAS.js} +1 -1
- package/dist/chunks/{chunk-Z4VR6CQ2.js → chunk-5AXNGQJC.js} +1 -1
- package/dist/chunks/{chunk-ROOWZCAB.js → chunk-5IPBCD7K.js} +1 -1
- package/dist/chunks/{chunk-KQM2AGUS.js → chunk-5JN3FWV2.js} +1 -1
- package/dist/chunks/{chunk-HNF6WZ5S.js → chunk-5M45EBVX.js} +2 -2
- package/dist/chunks/{chunk-UZ2DSUM6.js → chunk-5ZQF5WIO.js} +1 -1
- package/dist/chunks/{chunk-G7AD7DRG.js → chunk-6C4RPAG7.js} +1 -1
- package/dist/chunks/{chunk-SANUW37I.js → chunk-6DJ6PMEK.js} +2 -2
- package/dist/chunks/chunk-6EW4BCMR.js +9 -0
- package/dist/chunks/chunk-774D3BGN.js +7 -0
- package/dist/chunks/chunk-7SNMU7U7.js +7 -0
- package/dist/chunks/{chunk-HWWHR7H3.js → chunk-A73N3QKT.js} +1 -1
- package/dist/chunks/{chunk-GTZDB7IL.js → chunk-AEEEEOYS.js} +1 -1
- package/dist/chunks/chunk-APSIFBD4.js +7 -0
- package/dist/chunks/{chunk-R3B67TKQ.js → chunk-B2L2QTXT.js} +1 -1
- package/dist/chunks/{chunk-UDVWL4I4.js → chunk-BHBNTQRT.js} +1 -1
- package/dist/chunks/{chunk-B4VX6C2E.js → chunk-CF2PIWRO.js} +1 -1
- package/dist/chunks/{chunk-VUCFX2G4.js → chunk-CR2ZQBDU.js} +1 -1
- package/dist/chunks/{chunk-ETYHCI6U.js → chunk-CRITS7IX.js} +1 -1
- package/dist/chunks/{chunk-3P7HVGKM.js → chunk-DGH5CD6D.js} +1 -1
- package/dist/chunks/chunk-DZZFEAM6.js +7 -0
- package/dist/chunks/{chunk-MJRZSYU2.js → chunk-ECMWDZTJ.js} +4 -4
- package/dist/chunks/{chunk-WT73KR4Y.js → chunk-EDDOQXEI.js} +1 -1
- package/dist/chunks/{chunk-UV4HOEHC.js → chunk-EQ24OC5G.js} +1 -1
- package/dist/chunks/{chunk-57NFMJ6O.js → chunk-FAJB3JV5.js} +1 -1
- package/dist/chunks/chunk-FB3U3RAM.js +9 -0
- package/dist/chunks/{chunk-DQ2KI6FO.js → chunk-FEEG5UU2.js} +1 -1
- package/dist/chunks/{chunk-PP36OP55.js → chunk-FQJCWZ4C.js} +1 -1
- package/dist/chunks/chunk-GMTLVRN7.js +8 -0
- package/dist/chunks/{chunk-DJC2LX46.js → chunk-GUTZ45DE.js} +1 -1
- package/dist/chunks/{chunk-7NEJJJH6.js → chunk-H3QRCTIJ.js} +1 -1
- package/dist/chunks/{chunk-RDC4BJSR.js → chunk-I5JR7PIO.js} +1 -1
- package/dist/chunks/{chunk-TNERVI3E.js → chunk-IEKUTNKT.js} +1 -1
- package/dist/chunks/{chunk-XQVD5V3T.js → chunk-JNLWD6DK.js} +1 -1
- package/dist/chunks/{chunk-VGXFOQ4P.js → chunk-K2RQEX7N.js} +1 -1
- package/dist/chunks/{chunk-QFVAARN7.js → chunk-KXMVFT2K.js} +1 -1
- package/dist/chunks/{chunk-SL5SJUAH.js → chunk-LCH3SUJ7.js} +1 -1
- package/dist/chunks/{chunk-TQ5ETS24.js → chunk-LWQVT6YW.js} +1 -1
- package/dist/chunks/chunk-LXNMVWYO.js +9 -0
- package/dist/chunks/{chunk-PTUZ7ATN.js → chunk-LYKPLTZ7.js} +1 -1
- package/dist/chunks/chunk-M3HO5CTQ.js +7 -0
- package/dist/chunks/{chunk-IHXHZBHR.js → chunk-M4IVLSNQ.js} +1 -1
- package/dist/chunks/{chunk-3HO365U7.js → chunk-M4IWOZEG.js} +1 -1
- package/dist/chunks/{chunk-6BZCSVH6.js → chunk-M5NWE7EO.js} +1 -1
- package/dist/chunks/{chunk-MCCL762Q.js → chunk-MCBO6LL7.js} +2 -2
- package/dist/chunks/{chunk-I46LFJJG.js → chunk-MIG67KZ2.js} +1 -1
- package/dist/chunks/{chunk-JEYKXG6O.js → chunk-MOLEXKVC.js} +1 -1
- package/dist/chunks/{chunk-RINZXCDJ.js → chunk-NM67DIPQ.js} +1 -1
- package/dist/chunks/{chunk-V6MR45PD.js → chunk-NNP5NITU.js} +1 -1
- package/dist/chunks/{chunk-7W3B5AJR.js → chunk-NYFB3EYC.js} +1 -1
- package/dist/chunks/chunk-O3UY73UQ.js +7 -0
- package/dist/chunks/chunk-O5A7CNRV.js +7 -0
- package/dist/chunks/chunk-ONPJXQQ6.js +10 -0
- package/dist/chunks/{chunk-LW3HJWXW.js → chunk-OQVE2WXX.js} +1 -1
- package/dist/chunks/chunk-ORJGSUQT.js +9 -0
- package/dist/chunks/{chunk-SM5JI6QM.js → chunk-PE7QZUY7.js} +1 -1
- package/dist/chunks/{chunk-EWWFNMPZ.js → chunk-Q2YQSMIB.js} +8 -6
- package/dist/chunks/{chunk-J4YZKLVO.js → chunk-Q7AYTXUR.js} +2 -2
- package/dist/chunks/{chunk-IIKYA7SM.js → chunk-QZ2G3AMY.js} +1 -1
- package/dist/chunks/{chunk-FSHYI4ZE.js → chunk-RMZJP32R.js} +1 -1
- package/dist/chunks/{chunk-7OBZ2AM6.js → chunk-RSLPLRVK.js} +1 -1
- package/dist/chunks/{chunk-OL3BQESW.js → chunk-RYMRVMGD.js} +3 -3
- package/dist/chunks/{chunk-MB4RN7BI.js → chunk-S54ISKGR.js} +1 -1
- package/dist/chunks/{chunk-QLJ72TJJ.js → chunk-SMC4MGY5.js} +1 -1
- package/dist/chunks/{chunk-72DVIZTW.js → chunk-SR5XEF7L.js} +1 -1
- package/dist/chunks/{chunk-LQBC5QPO.js → chunk-TAT5WGDZ.js} +1 -1
- package/dist/chunks/chunk-THB7KY2N.js +7 -0
- package/dist/chunks/{chunk-XQQGQ55A.js → chunk-UKMRJIIZ.js} +1 -1
- package/dist/chunks/{chunk-MKY5IBKK.js → chunk-UKVEXM5O.js} +1 -1
- package/dist/chunks/{chunk-5G3VXZB4.js → chunk-ULHETT7U.js} +1 -1
- package/dist/chunks/{chunk-JI2BTGLU.js → chunk-UOZHC2ZG.js} +1 -1
- package/dist/chunks/chunk-V426AGVC.js +9 -0
- package/dist/chunks/{chunk-EWW4GCZY.js → chunk-V6Y6UK6B.js} +2 -4
- package/dist/chunks/{chunk-WGPFU3NA.js → chunk-VWBJWUYQ.js} +1 -1
- package/dist/chunks/{chunk-TKBORMUF.js → chunk-WKZ6JSGZ.js} +1 -1
- package/dist/chunks/{chunk-GNJPIPBF.js → chunk-WNTA7DCC.js} +1 -1
- package/dist/chunks/chunk-WOTPEBSH.js +11 -0
- package/dist/chunks/{chunk-HTZPGIVL.js → chunk-XQQ7DTQG.js} +1 -1
- package/dist/chunks/{chunk-C5KVTG2O.js → chunk-YEWZFZ2O.js} +1 -1
- package/dist/chunks/{chunk-YAJFAGUO.js → chunk-YGMOJBSP.js} +2 -2
- package/dist/chunks/{chunk-3GUBYJN6.js → chunk-YKOIVWZI.js} +1 -1
- package/dist/chunks/{chunk-BIFJ5QEB.js → chunk-YTIANIL7.js} +1 -1
- package/dist/chunks/chunk-YUDKK2QJ.js +7 -0
- package/dist/chunks/chunk-YW5R6XQI.js +7 -0
- package/dist/chunks/{chunk-6NPXWN5F.js → chunk-YZBYL3SH.js} +1 -1
- package/dist/chunks/{chunk-7X34JCBW.js → chunk-ZN37NQM4.js} +1 -1
- package/dist/chunks/{chunk-6RNZA3VS.js → chunk-ZNQI6M3S.js} +1 -1
- package/dist/chunks/{chunk-ZXEYTD3W.js → chunk-ZTUQEA2X.js} +1 -1
- package/dist/chunks/{clear-IWIBH2TY.js → clear-VMJVLPVR.js} +1 -1
- package/dist/chunks/{compile-vercel-config-B2ZES5JB.js → compile-vercel-config-YCLXPL5H.js} +1 -1
- package/dist/chunks/{config-5GNX5VM2.js → config-JPX6NJMJ.js} +1 -1
- package/dist/chunks/{config-BLTCR2NA.js → config-YMUUPO3R.js} +1 -1
- package/dist/chunks/config-validator.mjs +1 -1
- package/dist/chunks/{connect-git-provider-VYU65KTS.js → connect-git-provider-KLSBCSD2.js} +1 -1
- package/dist/chunks/{constants-NCE2LWSS.js → constants-G4UYVLOF.js} +1 -1
- package/dist/chunks/{delete-TN2UUEOF.js → delete-E7J4B5E5.js} +1 -1
- package/dist/chunks/{delete-DSDSQVG7.js → delete-EEY7M6XT.js} +1 -1
- package/dist/chunks/{detect-services-VQWDU5RR.js → detect-services-E2TWAKQS.js} +1 -1
- package/dist/chunks/{disable-76QRXL7J.js → disable-5TKY6JK2.js} +1 -1
- package/dist/chunks/{discard-CWXRCRFL.js → discard-ALSOF66H.js} +1 -1
- package/dist/chunks/{edit-LYZPKUZY.js → edit-2M3KEE3H.js} +1 -1
- package/dist/chunks/{edit-KC6AK6DA.js → edit-ISUCMYNW.js} +1 -1
- package/dist/chunks/{enable-ZVEULDXQ.js → enable-2QTTTYQD.js} +1 -1
- package/dist/chunks/{exec-3RMS2X6B.js → exec-XIQJ2A3J.js} +1 -1
- package/dist/chunks/{export-SYT5NHSM.js → export-PV2NDS7C.js} +1 -1
- package/dist/chunks/{future-YNSZJIAG.js → future-SQS5POAL.js} +1 -1
- package/dist/chunks/{generate-cert-for-deploy-G26VGC4I.js → generate-cert-for-deploy-4EJRA7MS.js} +1 -1
- package/dist/chunks/{image-XAJFJ6UD.js → image-6GL2UOA2.js} +1 -1
- package/dist/chunks/import-builders-KAZMYQCR.js +7 -0
- package/dist/chunks/{inspect-HIRGIJON.js → inspect-3HGROSZO.js} +1 -1
- package/dist/chunks/{inspect-A76MME2I.js → inspect-FK6GC5JZ.js} +1 -1
- package/dist/chunks/{inspect-DF35I6AZ.js → inspect-LZMU7RIU.js} +1 -1
- package/dist/chunks/{inspect-JEHOMETA.js → inspect-ORVORGUM.js} +1 -1
- package/dist/chunks/{inspect-7CODV4HJ.js → inspect-UNL54246.js} +1 -1
- package/dist/chunks/{list-XNNJCS5K.js → list-EWJI2WSQ.js} +1 -1
- package/dist/chunks/{list-3KNHQV4S.js → list-FVUIZPC7.js} +1 -1
- package/dist/chunks/{list-M2YCP5HV.js → list-WOUJM4WR.js} +1 -1
- package/dist/chunks/login-IJLY5XTT.js +7 -0
- package/dist/chunks/{login-UM35IU3S.js → login-JREQ7SLY.js} +1 -1
- package/dist/chunks/logs-Z7IMGFO2.js +7 -0
- package/dist/chunks/{ls-M2SGUIZK.js → ls-4COX4SMJ.js} +1 -1
- package/dist/chunks/{ls-KGYG3F3A.js → ls-6CD2OQGA.js} +1 -1
- package/dist/chunks/ls-6DOYSBQM.js +8 -0
- package/dist/chunks/{ls-ISILCAV4.js → ls-AHT2FRGM.js} +1 -1
- package/dist/chunks/{ls-YJEUWZFT.js → ls-LXBUE4LZ.js} +1 -1
- package/dist/chunks/{ls-Z2JKBJKR.js → ls-RBWPVJ5G.js} +1 -1
- package/dist/chunks/{ls-Y3CBOCK2.js → ls-W5SJUIHD.js} +1 -1
- package/dist/chunks/{mutate-ZCA7FKDL.js → mutate-TVUHBRBK.js} +1 -1
- package/dist/chunks/{notifications-7QROHXJQ.js → notifications-OXOSD6UK.js} +1 -1
- package/dist/chunks/{open-FU7OJPAY.js → open-SWPHB54M.js} +1 -1
- package/dist/chunks/{openapi-KGCZ7LB4.js → openapi-32XHDVJL.js} +1 -1
- package/dist/chunks/{permissions-I4ZXPUVY.js → permissions-A4WMGETJ.js} +1 -1
- package/dist/chunks/{prompt-missing-credentials-YPLDAGZA.js → prompt-missing-credentials-6IXO6VND.js} +1 -1
- package/dist/chunks/{publish-6WBGPES3.js → publish-2CS4RYJW.js} +1 -1
- package/dist/chunks/pull-WWUH4M5V.js +7 -0
- package/dist/chunks/purchase-domain-if-available-TAXCYIV7.js +7 -0
- package/dist/chunks/{push-ZRDFCF3D.js → push-OPRW7M4I.js} +1 -1
- package/dist/chunks/{query-RXONIAT5.js → query-22PGP7BC.js} +1 -1
- package/dist/chunks/{reauthenticate-7RZ2XFR4.js → reauthenticate-LMR25CIE.js} +1 -1
- package/dist/chunks/{reorder-P5LWY3FS.js → reorder-Y3NMEA2S.js} +1 -1
- package/dist/chunks/{reply-QNIIC2TP.js → reply-YEZHST2Q.js} +1 -1
- package/dist/chunks/{resolve-RQBKN4WL.js → resolve-QC37E2EB.js} +1 -1
- package/dist/chunks/{restore-NPY7XA3A.js → restore-RMQVGYQB.js} +1 -1
- package/dist/chunks/rm-42U6SPVV.js +8 -0
- package/dist/chunks/{rm-5LVIH5IE.js → rm-43MPIHP3.js} +1 -1
- package/dist/chunks/{rm-4PBTYQBF.js → rm-4MSUYUEP.js} +1 -1
- package/dist/chunks/{rm-XOE3T2QM.js → rm-DPHE34CD.js} +1 -1
- package/dist/chunks/{rm-K3V6KVHW.js → rm-JHWXYHJY.js} +1 -1
- package/dist/chunks/{routes-FOCZWOGO.js → routes-2GTCE542.js} +1 -1
- package/dist/chunks/{rule-inspect-6UI5XBGA.js → rule-inspect-7LIPL5YY.js} +1 -1
- package/dist/chunks/{rules-MJWNYYRT.js → rules-6KWBVUF2.js} +1 -1
- package/dist/chunks/{schema-SOV2XP24.js → schema-OUFU5V7Z.js} +1 -1
- package/dist/chunks/{schema-ABJKQ6AB.js → schema-S2DE7S5N.js} +1 -1
- package/dist/chunks/{select-org-G4KFHFH3.js → select-org-EL66MG67.js} +1 -1
- package/dist/chunks/set-VXSNREF4.js +7 -0
- package/dist/chunks/setup-and-link-I7SGZNGO.js +7 -0
- package/dist/chunks/{tags-DY5IM5QF.js → tags-AGLQDT3Z.js} +1 -1
- package/dist/chunks/{types-RHUVE4FN.js → types-GQNKYZJH.js} +1 -1
- package/dist/chunks/{update-6WSCOLSB.js → update-TI3YRVQT.js} +1 -1
- package/dist/chunks/{vlt-builder-graph-B4DFIUS6.js → vlt-builder-graph-S4YJ5UTQ.js} +1 -1
- package/dist/chunks/vlt-builder-importer-2ITR3DMQ.js +11 -0
- package/dist/commands/build/index.js +7 -7
- package/dist/commands/deploy/index.js +44 -28
- package/dist/commands/dev/index.js +8 -8
- package/dist/commands/env/index.js +1 -1
- package/dist/commands/link/index.js +1 -1
- package/dist/commands/list/index.js +1 -1
- package/dist/commands-bulk.js +419 -406
- package/dist/index.js +7 -8
- package/dist/internal-build-worker.js +4 -4
- package/dist/internal-build.js +11 -0
- package/dist/root-help-commands.mjs +1 -1
- package/dist/vc.js +24 -9
- package/dist/version.mjs +1 -1
- package/package.json +56 -55
- package/dist/chunks/chunk-2KCAQTPM.js +0 -9
- package/dist/chunks/chunk-AUIBCIET.js +0 -7
- package/dist/chunks/chunk-CJPM2DXZ.js +0 -7
- package/dist/chunks/chunk-DBDWXNAR.js +0 -7
- package/dist/chunks/chunk-E4M34FSN.js +0 -9
- package/dist/chunks/chunk-EZU5U2PZ.js +0 -7
- package/dist/chunks/chunk-J7JW6BBJ.js +0 -9
- package/dist/chunks/chunk-L37LRUIN.js +0 -7
- package/dist/chunks/chunk-LKYVY3SY.js +0 -7
- package/dist/chunks/chunk-OY2H4NBN.js +0 -8
- package/dist/chunks/chunk-QYGA4IKR.js +0 -7
- package/dist/chunks/chunk-TATIUO4V.js +0 -11
- package/dist/chunks/chunk-VX7JFH7Q.js +0 -7
- package/dist/chunks/chunk-WQLEYC3T.js +0 -9
- package/dist/chunks/chunk-WVUD3JPC.js +0 -10
- package/dist/chunks/chunk-XP4C5FLG.js +0 -7
- package/dist/chunks/import-builders-JXIILQOI.js +0 -7
- package/dist/chunks/login-2GVRFOQQ.js +0 -7
- package/dist/chunks/logs-HS5YRXDR.js +0 -7
- package/dist/chunks/ls-WROXB2SF.js +0 -8
- package/dist/chunks/pull-BJUOPX3J.js +0 -7
- package/dist/chunks/purchase-domain-if-available-7KTEXJFK.js +0 -7
- package/dist/chunks/rm-GGY4TGSX.js +0 -8
- package/dist/chunks/set-DJO2C6XG.js +0 -7
- package/dist/chunks/setup-and-link-BZCJ74II.js +0 -7
- package/dist/chunks/vlt-builder-importer-W63QEXYX.js +0 -11
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __dirname_ } from 'node:path';
|
|
4
|
+
const require = __createRequire(import.meta.url);
|
|
5
|
+
const __filename = __fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = __dirname_(__filename);
|
|
7
|
+
import{tracesConfigCommand}from"./chunk-774D3BGN.js";import{deploymentOption,projectOption,protectionBypassOption,sinceOption,untilOption,yesOption}from"./chunk-5IPBCD7K.js";import{packageName}from"./chunk-FI772UVH.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."]}],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."},{name:"json",shorthand:"j",type:Boolean,deprecated:!1,description:"Output one JSON object per 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`}]},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};
|
|
@@ -0,0 +1,10 @@
|
|
|
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-BKV35LVB.js";import{getGlobalFlagsFromArgs,stripSensitiveAuthArgs,suggestionFlagTakesSeparateValue}from"./chunk-5IPBCD7K.js";import{teamCache}from"./chunk-VOZEB6PD.js";import{LinkRequiredError,ProjectNotFound,isAPIError}from"./chunk-NM67DIPQ.js";import{getCommandName,packageName}from"./chunk-FI772UVH.js";import{recordCliError}from"./chunk-Q2YQSMIB.js";import{require_dist}from"./chunk-QGIQK47P.js";import{pkg_default}from"./chunk-AVSPFBLM.js";import{__toESM}from"./chunk-6L236MNA.js";var AGENT_STATUS={ERROR:"error",ACTION_REQUIRED:"action_required",OK:"ok"},AGENT_REASON={MISSING_ARGUMENTS:"missing_arguments",INVALID_ARGUMENTS:"invalid_arguments",CONFIRMATION_REQUIRED:"confirmation_required",INTERACTIVE_CONFIRMATION_REQUIRED:"interactive_confirmation_required",LOGIN_REQUIRED:"login_required",PROJECT_SETTINGS_REQUIRED:"project_settings_required",NOT_LINKED:"not_linked",NOT_FOUND:"not_found",PROJECT_NOT_FOUND:"project_not_found",MISSING_SCOPE:"missing_scope",SCOPE_NOT_ACCESSIBLE:"scope_not_accessible",API_ERROR:"api_error",RATE_LIMITED:"rate_limited",SEGMENT_IN_USE:"segment_in_use",ENTITY_IN_USE:"entity_in_use",MISSING_REQUIREMENTS:"missing_requirements",MISSING_NAME:"missing_name",MISSING_VALUE:"missing_value",MISSING_ENVIRONMENT:"missing_environment",ENV_NOT_FOUND:"env_not_found",MULTIPLE_ENVS:"multiple_envs",ENV_FILE_EXISTS:"env_file_exists",GIT_BRANCH_REQUIRED:"git_branch_required",ENV_KEY_SENSITIVE:"env_key_sensitive",AMBIGUOUS_ROUTE:"ambiguous_route",ROUTE_CREATE_FAILED:"route_create_failed",ROUTE_GENERATION_FAILED:"route_generation_failed",DOMAIN_NOT_FOUND:"domain_not_found",DNS_RECORD_NOT_FOUND:"dns_record_not_found",INCOMPLETE_RECORD:"incomplete_record",PERMISSION_DENIED:"permission_denied",INVALID_PORT:"invalid_port",INVALID_DNS_TYPE:"invalid_dns_type",DNS_ADD_FAILED:"dns_add_failed",INVALID_DOMAIN:"invalid_domain",CONFIGURED_CORRECTLY:"configured_correctly",VERIFICATION_NEEDED:"verification_needed",INVALID_CONFIGURATION:"invalid_configuration",DNS_CHANGE_REQUIRED:"dns_change_required",DNS_CHANGE_RECOMMENDED:"dns_change_recommended",DNSSEC_NEEDS_TO_BE_DISABLED:"dnssec_needs_to_be_disabled",PROJECT_ATTACHMENT_RECOMMENDED:"project_attachment_recommended",PROJECT_DOMAIN_MISSING:"project_domain_missing",INTEGRATION_TERMS_ACCEPTANCE_REQUIRED:"integration_terms_acceptance_required",INTEGRATION_SETUP_REQUIRED:"integration_setup_required",HAS_RESOURCES:"has_resources",INTEGRATION_SANDBOX_CLAIM_REQUIRED:"integration_sandbox_claim_required",CLASSIC_TOKEN_REQUIRED:"classic_token_required",TOKEN_USER_SCOPE_REQUIRED:"token_user_scope_required",MISSING_URL:"missing_url",MISSING_EVENTS:"missing_events",INVALID_URL:"invalid_url",INVALID_EVENT:"invalid_event",INVALID_BUDGET:"invalid_budget",INVALID_REFRESH_PERIOD:"invalid_refresh_period",INVALID_EXPIRATION:"invalid_expiration",INVALID_ALERT_THRESHOLDS:"invalid_alert_thresholds",REQUIRES_CONSENT:"requires_consent",MISSING_ISSUER_ID:"missing_issuer_id",MISSING_KEY:"missing_key",MISSING_KEY_ID:"missing_key_id",MISSING_PROJECT:"missing_project",ISSUER_NOT_FOUND:"issuer_not_found",ISSUER_MANAGED:"issuer_managed",ISSUER_REQUIRES_IMPORTED_KEY:"issuer_requires_imported_key",ISSUER_REQUIRES_GENERATED_KEY:"issuer_requires_generated_key",KEY_NOT_REVOKING:"key_not_revoking",NO_CHANGES_REQUESTED:"no_changes_requested",GIT_REPOSITORY_REQUIRED:"git_repository_required",CI_RUN_NOT_FOUND:"ci_run_not_found",CI_RUN_IN_PROGRESS:"ci_run_in_progress",CI_RUN_NOT_RETRYABLE:"ci_run_not_retryable",SCHEDULES_NOT_ENABLED:"schedules_not_enabled",SCHEDULE_ALREADY_EXISTS:"schedule_already_exists",SCHEDULE_COMPLETED:"schedule_completed",STATIC_SCHEDULE:"static_schedule",INVALID_CRON_EXPRESSION:"invalid_cron_expression",INVALID_JITTER:"invalid_jitter",JITTER_EXCEEDS_CADENCE:"jitter_exceeds_cadence",SINGLE_AT_TOO_SOON:"single_at_too_soon",SCHEDULE_PAYLOAD_TOO_LARGE:"payload_too_large",SCHEDULE_PAYLOAD_STORE_FAILED:"payload_store_failed",SCHEDULE_SERVICE_UNAVAILABLE:"service_unavailable",SCHEDULE_SERVICE_ERROR:"service_error",REDIRECT_NOT_FOUND:"redirect_not_found",VERSION_NOT_FOUND:"version_not_found",VERSION_ALREADY_LIVE:"version_already_live",VERSION_IS_STAGING:"version_is_staging",PLAN_UPGRADE_REQUIRED:"plan_upgrade_required",NOT_TEAM_MEMBER:"not_team_member",INVALID_ROLE_COMBINATION:"invalid_role_combination"},USAGE_ERROR_REASONS=new Set(["invalid_arguments","missing_arguments","unknown_command","missing_command","invalid_environment","invalid_type","missing_id","missing_value","missing_name","missing_flags","missing_clients","invalid_clients","conflicting_type_flags","missing_environment","invalid_slug","invalid_name","invalid_alert_thresholds","invalid_budget","invalid_dns_type","invalid_event","invalid_expiration","invalid_port","invalid_refresh_period","invalid_role_combination","invalid_url","missing_events","missing_issuer_id","missing_key_id","missing_key","missing_url"]);function getExitCodeForReason(reason){return reason!==void 0&&USAGE_ERROR_REASONS.has(reason)?2:1}var AGENT_ACTION={MISSING_ARGUMENTS:"missing_arguments",CONFIRMATION_REQUIRED:"confirmation_required",LOGIN_REQUIRED:"login_required"};var import_error_utils=__toESM(require_dist(),1);var OBSERVABILITY_PLUS_PURCHASE_COMMAND="buy addon observability-plus";function mentionsObservabilityPlus(message){return/observability\s+plus/i.test(message)}function observabilityPlusPurchaseHint(){return`Subscribe with ${getCommandName(OBSERVABILITY_PLUS_PURCHASE_COMMAND)}.`}function observabilityPlusPurchaseFix(){return{command:OBSERVABILITY_PLUS_PURCHASE_COMMAND,hint:observabilityPlusPurchaseHint(),when:"a person has approved buying the add-on"}}function observabilityPlusRecovery(message){if(mentionsObservabilityPlus(message))return/(?:disabled|switched off|re-enable)/i.test(message)?{hint:"Observability Plus is disabled. Ask a team owner to enable it for the intended team or project, then retry. A new subscription may not be needed."}:/(?:quota|usage limit|query limit)/i.test(message)?{hint:"The usage limit was reached. Ask a team owner to review the limit before retrying."}:{...observabilityPlusPurchaseFix(),hint:`Check whether Observability Plus is disabled for this project or the team needs a subscription. Enable it if already subscribed. Otherwise, ${observabilityPlusPurchaseHint()}`,when:"the team has no subscription and a person has approved buying the add-on"}}function errorContext(client){let teamId=client?.config?.currentTeam;return teamId?client?.teams?.find(team=>team.id===teamId||team.slug===teamId)?.slug??teamCache.get(teamId)?.slug:client?.user?.username||client?.user?.email}function getErrorRecovery(error,client){let reason=error.reason?.toLowerCase(),scope=errorContext(client);if(error.status===403||["forbidden","permission_denied","scope_not_accessible"].includes(reason??""))return{hint:`Check that the selected team is correct${scope?` (${scope})`:""}. If it is, ask a team owner to grant the required access. Retry only after the team or access changes.`,retryable:!1,userActionRequired:!0,...scope&&{scope},...error.action&&{action:error.action},...error.resource&&{resource:error.resource}};if(error.status===401||reason==="not_authorized")return{hint:"Provide valid credentials for the intended account and team, then retry.",retryable:!1,userActionRequired:!0};if(error.status===402||["payment_required","plan_upgrade_required"].includes(reason??"")){let message=error.serverMessage??error.message??"";return{hint:observabilityPlusRecovery(message)?.hint??(/(?:disabled|switched off|re-enable)/i.test(message)?"Enable the feature for the selected team or project, then retry.":/(?:overdue|payment method|unpaid|balance)/i.test(message)?"Ask a team owner to resolve the billing issue, then retry.":/(?:plan|subscription)/i.test(message)?"Ask a team owner to confirm the required plan or subscription before changing billing. Retry after access is enabled.":"Check the billing or feature requirement reported above with a team owner. Retry after that requirement is resolved."),retryable:!1,userActionRequired:!0,...scope&&{scope}}}if(error.status===429||reason==="rate_limited"){let wait=error.retryAfterMs;return{hint:typeof wait=="number"&&Number.isFinite(wait)&&wait>0?`Wait at least ${Math.ceil(wait/1e3)} seconds before trying again.`:wait==="never"?"This request cannot be retried with the current limit. Ask a team owner to review the limit.":"The request limit was reached. Wait before trying again; no retry time was provided.",retryable:wait!=="never",...typeof wait=="number"&&Number.isFinite(wait)&&wait>0&&{retryAfterMs:wait}}}return{}}import{randomUUID}from"node:crypto";function agentErrorMetadata(client){return client.isAgent?{cliVersion:pkg_default.version,invocationId:client.telemetryEventStore?.currentInvocationId}:{}}function agentErrorCategory(reason){return/^(forbidden|permission_denied|scope_not_accessible)$/i.test(reason)?"permission":/^(payment_required|plan_upgrade_required)$/i.test(reason)?"billing":/^(not_authorized|login_required)$/i.test(reason)?"authentication":/^(rate_limited|too_many_requests)$/i.test(reason)?"rate_limit":/^(invalid_arguments|unknown_command|ARG_UNKNOWN_OPTION)$/i.test(reason)?"usage":/^(link_required|project_not_found|not_found)$/i.test(reason)?"project_context":"other"}function trackAgentError(client,error){!client.isAgent||!client.telemetryEventStore||client.telemetryEventStore.add({id:randomUUID(),eventTime:Date.now(),key:"agent_error",value:JSON.stringify({invocationId:client.telemetryEventStore.currentInvocationId,category:agentErrorCategory(error.reason),hasRecovery:!!error.hint,retryable:error.retryable,userActionRequired:error.userActionRequired})})}function isHelpInvocation(argv){let args=argv.slice(2),separator=args.indexOf("--");return args.slice(0,separator<0?args.length:separator).some(arg=>arg==="--help"||arg==="-h")}function trackAgentCommandOutcome(client,exitCode){if(!client.isAgent||!client.telemetryEventStore)return;let help=isHelpInvocation(client.argv);client.telemetryEventStore.add({id:randomUUID(),eventTime:Date.now(),key:"agent_command_outcome",value:JSON.stringify({invocationId:client.telemetryEventStore.currentInvocationId,exitCode,outcome:help&&(exitCode===0||exitCode===2)?"help":exitCode===0?"success":"failure"})})}function buildCommandWithYes(argv,pkgName=packageName){let args=stripSensitiveAuthArgs(argv.slice(2)),out=args.some(a=>a==="--yes"||a==="-y")?args:[...args,"--yes"];return`${pkgName} ${out.join(" ")}`.trim()}function redactEnvValueArgs(argv){let redacted=[...argv];for(let i=0;i<redacted.length;i++)redacted[i]==="--value"&&i+1<redacted.length?(redacted[i+1]='"<value>"',i++):redacted[i].startsWith("--value=")&&(redacted[i]='--value="<value>"');return redacted}var GLOBAL_FLAG_NAMES=new Set(["--cwd","--config","--yes","-y","--non-interactive","--scope","--team","-S","-T"]),GLOBAL_FLAG_SHORTHANDS={"-y":"--yes","-S":"--scope","-T":"--team"};function canonicalGlobalFlagName(name){return GLOBAL_FLAG_SHORTHANDS[name]??name}function getGlobalFlagsFromArgv(argv){let args=getGlobalFlagsFromArgs(argv.slice(2),{preserveConfig:!0,preserveYes:!0}),out=[];for(let i=0;i<args.length;i++){let arg=args[i],name=arg.startsWith("--")?arg.split("=")[0]:arg;GLOBAL_FLAG_NAMES.has(name)&&(out.push(arg),suggestionFlagTakesSeparateValue(name)&&!arg.includes("=")&&i+1<args.length&&!args[i+1].startsWith("-")&&(out.push(args[i+1]),i++))}return out}function omitGlobalFlagsFromArgs(args){let safeArgs=stripSensitiveAuthArgs(args),out=[];for(let i=0;i<safeArgs.length;i++){let arg=safeArgs[i],name=arg.startsWith("--")?arg.split("=")[0]:arg;if(GLOBAL_FLAG_NAMES.has(name)){suggestionFlagTakesSeparateValue(name)&&!arg.includes("=")&&i+1<safeArgs.length&&!safeArgs[i+1].startsWith("-")&&i++;continue}out.push(arg)}return out}function buildIntegrationCommandTailFromArgv(argv){let args=argv.slice(2),idx=args.indexOf("integration");return idx===-1?"integration":omitGlobalFlagsFromArgs(args.slice(idx)).join(" ")}function buildCommandWithGlobalFlags(argv,commandTemplate,pkgName=packageName,options){let preserved=options?.globalFlags==="all"?getGlobalFlagsFromArgs(argv.slice(2),{preserveProject:options.preserveProject}):getGlobalFlagsFromArgv(argv);if(options?.globalFlags!=="all"&&options?.preserveProject){let globalArgs=getGlobalFlagsFromArgs(argv.slice(2)),contextArgs=getGlobalFlagsFromArgs(argv.slice(2),{preserveProject:!0});preserved.push(...contextArgs.slice(globalArgs.length))}let exclude=new Set(commandTemplate.split(/\s+/).filter(token=>token.startsWith("-")).map(token=>canonicalGlobalFlagName(token.split("=")[0])));for(let flag of options?.excludeFlags??[])exclude.add(canonicalGlobalFlagName(flag));if(exclude.size){let out=[];for(let i=0;i<preserved.length;i++){let arg=preserved[i],name=arg.startsWith("--")?arg.split("=")[0]:arg;if(exclude.has(canonicalGlobalFlagName(name))){!arg.includes("=")&&i+1<preserved.length&&!preserved[i+1].startsWith("-")&&i++;continue}out.push(arg)}preserved=out}let base=`${pkgName} ${commandTemplate}`;return preserved.length===0?base:options?.prependGlobalFlags?`${pkgName} ${preserved.join(" ")} ${commandTemplate}`:`${base} ${preserved.join(" ")}`}function withGlobalFlags(client,commandTemplate,options={}){return buildCommandWithGlobalFlags(client.argv,commandTemplate,packageName,{globalFlags:"all",preserveProject:options.preserveProject})}function getPreservedArgsAfterEnvSubcommand(argv,subcommands,positionalCount){let args=stripSensitiveAuthArgs(argv.slice(2)),envIdx=args.findIndex((arg,index)=>arg==="env"&&subcommands.includes(args[index+1])),subcommandIdx=envIdx+1;if(envIdx===-1)return args;let preserved=[],positionals=0,optionsEnded=!1;for(let i=subcommandIdx+1;i<args.length;i++){let arg=args[i];if(arg==="--"&&!optionsEnded){optionsEnded=!0;continue}if(!optionsEnded&&arg.startsWith("-")){preserved.push(arg),!arg.includes("=")&&suggestionFlagTakesSeparateValue(arg)&&i+1<args.length&&!args[i+1].startsWith("-")&&preserved.push(args[++i]);continue}if(positionals<positionalCount){positionals++;continue}optionsEnded&&!preserved.includes("--")&&preserved.push("--"),preserved.push(arg)}return preserved}function omitPreservedFlagsAlreadyInTemplate(args,commandTemplate){let templateFlags=new Set(commandTemplate.split(/\s+/).filter(token=>token.startsWith("-")).map(token=>canonicalGlobalFlagName(token.split("=")[0]))),out=[];for(let i=0;i<args.length;i++){let arg=args[i],name=arg.startsWith("-")?arg.split("=")[0]:arg;if(!templateFlags.has(canonicalGlobalFlagName(name))){out.push(arg);continue}!arg.includes("=")&&suggestionFlagTakesSeparateValue(name)&&i+1<args.length&&!args[i+1].startsWith("-")&&i++}return out}function getPreservedArgsForEnvAdd(argv){return getPreservedArgsAfterEnvSubcommand(argv,["add"],3)}function buildEnvAddCommandWithPreservedArgs(argv,commandTemplate,pkgName=packageName){let preserved=omitPreservedFlagsAlreadyInTemplate(getPreservedArgsForEnvAdd(argv),commandTemplate),base=`${pkgName} ${commandTemplate}`;return preserved.length===0?base:`${base} ${preserved.map(quoteArg).join(" ")}`}function getPreservedArgsForEnvPull(argv){return getPreservedArgsAfterEnvSubcommand(argv,["pull"],1)}function getPreservedArgsForEnvRm(argv){return getPreservedArgsAfterEnvSubcommand(argv,["rm","remove"],3)}function buildEnvRmCommandWithPreservedArgs(argv,commandTemplate,pkgName=packageName){let preserved=omitPreservedFlagsAlreadyInTemplate(getPreservedArgsForEnvRm(argv),commandTemplate),base=`${pkgName} ${commandTemplate}`;return preserved.length===0?base:`${base} ${preserved.map(quoteArg).join(" ")}`}function getPreservedArgsForEnvUpdate(argv){return getPreservedArgsAfterEnvSubcommand(argv,["update"],3)}function buildEnvUpdateCommandWithPreservedArgs(argv,commandTemplate,pkgName=packageName){let preserved=omitPreservedFlagsAlreadyInTemplate(getPreservedArgsForEnvUpdate(argv),commandTemplate),base=`${pkgName} ${commandTemplate}`;return preserved.length===0?base:`${base} ${preserved.map(quoteArg).join(" ")}`}function buildCommandWithScope(argv,scopeSlug,pkgName=packageName){let args=stripSensitiveAuthArgs(argv.slice(2)),out=[];for(let i=0;i<args.length;i++){if(args[i]==="--scope"||args[i]==="--team"||args[i]==="-S"||args[i]==="-T"){i++;continue}args[i].startsWith("--scope=")||args[i].startsWith("--team=")||out.push(args[i])}return out.push("--scope",scopeSlug),`${pkgName} ${out.join(" ")}`}function enrichActionRequiredWithInvokingCommand(payload,argv){if(payload.reason!=="missing_scope"||!payload.choices?.length)return payload;let next=[],linkArgv=[...argv.slice(0,2),"link",...argv.slice(3)];for(let choice of payload.choices){let slug=choice.name;next.push({command:buildCommandWithScope(linkArgv,slug),when:"Link first (then run any command without --scope)"}),next.push({command:buildCommandWithScope(argv,slug),when:"Run this command with scope (no link)"})}return{...payload,next}}function outputActionRequired(client,payload,exitCode=getExitCodeForReason(payload.reason)){if(!shouldEmitNonInteractiveCommandError(client))return;let enriched=enrichActionRequiredWithInvokingCommand(payload,client.argv);!enriched.hint&&enriched.next?.length&&(enriched.hint="Run one of the commands in next[] to complete without prompting."),recordCliError({code:payload.reason}),client.stdout.write(`${JSON.stringify(enriched,null,2)}
|
|
8
|
+
`),process.exit(exitCode)}function argvHasNonInteractive(argv){if(!argv?.length)return!1;for(let i=0;i<argv.length;i++){let a=argv[i];if(a==="--non-interactive")return argv[i+1]!=="false";if(a.startsWith("--non-interactive="))return a.slice(18)!=="false"}return!1}function shouldEmitNonInteractiveCommandError(client){return client.nonInteractive||argvHasNonInteractive(client.argv??[])}function outputAgentError(client,payload,exitCode=getExitCodeForReason(payload.reason)){shouldEmitNonInteractiveCommandError(client)&&(writeAgentError(client,payload),process.exit(exitCode))}function writeAgentError(client,payload){let enriched={...getErrorRecovery(payload,client),...payload,...agentErrorMetadata(client)};recordCliError({code:payload.reason,reportOnSuccess:!0}),trackAgentError(client,enriched),client.stdout.write(`${JSON.stringify(enriched,null,2)}
|
|
9
|
+
`)}function outputAgentSuccess(client,payload,exitCode=0){shouldEmitNonInteractiveCommandError(client)&&(!payload.hint&&payload.next?.length&&(payload.hint="Follow up with one of the commands in next[]."),client.stdout.write(`${JSON.stringify(payload,null,2)}
|
|
10
|
+
`),process.exit(exitCode))}function buildNextStepsForGlobalConfig(client){return[{command:buildCommandWithGlobalFlags(client.argv,"global-config list"),when:"List Global Config stores in the current team scope"},{command:buildCommandWithGlobalFlags(client.argv,"teams switch"),when:"Switch to the team that owns the Global Config"},{command:buildCommandWithGlobalFlags(client.argv,"whoami"),when:"Verify the current team or user scope"}]}var GLOBAL_CONFIG_NON_INTERACTIVE_HINT="Global Config commands use your current team scope. Pass --scope or run `vercel teams switch` if the store is missing.",LIST_ERROR_HINT="Project names are team-scoped. Use --scope when the project belongs to another team, or `list --all` to list deployments across all projects.";function buildNextStepsForList(client,projectName){return[projectName?{command:buildCommandWithGlobalFlags(client.argv,`project ls --filter ${projectName}`),when:"Search projects matching the attempted name to find the right one"}:{command:buildCommandWithGlobalFlags(client.argv,"project ls --filter <name>"),when:"Search projects by name substring to find the right one (replace <name>)"},{command:buildCommandWithGlobalFlags(client.argv,"list --all"),when:"List deployments across all projects in the current scope"},{command:buildCommandWithGlobalFlags(client.argv,"link"),when:"Re-link this directory to the correct Vercel project"}]}function buildNextStepsForProjectSubcommands(client,variant){let byName=variant==="access-groups"?{template:"project access-groups <name>",when:"List access groups by project name (replace <name>)"}:variant==="access-summary"?{template:"project access-summary <name>",when:"Show role counts by project name (replace <name>)"}:variant==="protection"?{template:"project protection <name>",when:"Show deployment protection by project name (replace <name>)"}:variant==="update"?{template:"project update <name> --framework <slug>",when:"Update a framework preset by project name (replace <name> and <slug>)"}:variant==="speed-insights"?{template:"project speed-insights <name>",when:"Enable Speed Insights by project name (replace <name>)"}:variant==="web-analytics"?{template:"project web-analytics <name>",when:"Enable Web Analytics by project name (replace <name>)"}:variant==="observability"?{template:"project observability enable <name>",when:"Enable Observability Plus by project name (replace <name>)"}:variant==="checks"?{template:"project checks add <name>",when:"Create a deployment check by project name (replace <name>)"}:variant==="inspect"?{template:"project inspect <name>",when:"Inspect a project by name (replace <name>)"}:variant==="resume"?{template:"project resume <name>",when:"Resume production traffic by project name (replace <name>)"}:{template:"project members <name>",when:"List members by project name (replace <name>)"};return[{command:buildCommandWithGlobalFlags(client.argv,"link"),when:"Re-link this directory to the correct Vercel project"},{command:buildCommandWithGlobalFlags(client.argv,byName.template),when:byName.when},{command:buildCommandWithGlobalFlags(client.argv,"project ls"),when:"List projects in the current team to pick a name"}]}var PROJECT_SUBCOMMAND_ERROR_HINT="If you use --cwd, ensure that folder is linked to the right project, or pass an explicit project name. Use --scope when the project belongs to another team.";function resolveNonInteractiveDefaults(client,variant){return variant==="global-config"?{next:buildNextStepsForGlobalConfig(client),hint:GLOBAL_CONFIG_NON_INTERACTIVE_HINT}:variant==="list"?{next:buildNextStepsForList(client),hint:LIST_ERROR_HINT}:{next:buildNextStepsForProjectSubcommands(client,variant),hint:PROJECT_SUBCOMMAND_ERROR_HINT}}function writeAgentErrorPayloadAndExit(client,payload,exitCode,variant){let defaults=["link_required","project_not_found","not_found"].includes(payload.reason)?resolveNonInteractiveDefaults(client,variant):{},out={...payload,next:payload.next??defaults.next,hint:payload.hint??defaults.hint};writeAgentError(client,out),process.exit(exitCode)}function isProjectNotFoundLike(err){return!!(err instanceof ProjectNotFound||(0,import_error_utils.isError)(err)&&"code"in err&&err.code==="PROJECT_NOT_FOUND")}function isLinkRequiredLike(err){return err instanceof LinkRequiredError}function normalizeApiErrorText(message){return message.replace(/\s*\(\d{3}\)\s*$/,"").trim()}function exitWithNonInteractiveError(client,err,exitCode=1,options={variant:"members"}){if(!shouldEmitNonInteractiveCommandError(client))return;let{variant}=options;if(isLinkRequiredLike(err)){if(variant==="global-config"){writeAgentErrorPayloadAndExit(client,{status:"error",reason:"link_required",message:err instanceof Error?err.message:String(err),next:buildNextStepsForGlobalConfig(client),hint:GLOBAL_CONFIG_NON_INTERACTIVE_HINT},exitCode,"global-config");return}writeAgentErrorPayloadAndExit(client,{status:"error",reason:"link_required",message:err instanceof Error?err.message:String(err)},exitCode,variant);return}if(isProjectNotFoundLike(err)){writeAgentErrorPayloadAndExit(client,{status:"error",reason:"project_not_found",message:err instanceof Error?err.message:String(err),...variant==="list"&&options.projectName?{next:buildNextStepsForList(client,options.projectName)}:{}},exitCode,variant);return}if(isAPIError(err)){let rawMessage=err.serverMessage||err.message,message=normalizeApiErrorText(rawMessage),reason=err.status===403?"forbidden":err.status===402?"payment_required":err.status===401?"not_authorized":err.status===404?variant==="global-config"?"not_found":"project_not_found":err.status===429?"rate_limited":"api_error";writeAgentErrorPayloadAndExit(client,{status:"error",reason,message,...getErrorRecovery(err,client),...err.action&&{action:err.action},...err.resource&&{resource:err.resource}},exitCode,variant)}writeAgentErrorPayloadAndExit(client,{status:"error",reason:"unexpected_error",message:err instanceof Error?err.message:String(err)},exitCode,variant)}function openUrlInBrowserCommand(url){return process.platform==="win32"?`start ${url}`:process.platform==="darwin"?`open '${url}'`:`xdg-open '${url}'`}export{AGENT_STATUS,AGENT_REASON,getExitCodeForReason,AGENT_ACTION,mentionsObservabilityPlus,observabilityPlusPurchaseFix,observabilityPlusRecovery,getErrorRecovery,agentErrorMetadata,trackAgentError,isHelpInvocation,trackAgentCommandOutcome,buildCommandWithYes,redactEnvValueArgs,getGlobalFlagsFromArgv,omitGlobalFlagsFromArgs,buildIntegrationCommandTailFromArgv,buildCommandWithGlobalFlags,withGlobalFlags,getPreservedArgsForEnvAdd,buildEnvAddCommandWithPreservedArgs,getPreservedArgsForEnvPull,getPreservedArgsForEnvRm,buildEnvRmCommandWithPreservedArgs,getPreservedArgsForEnvUpdate,buildEnvUpdateCommandWithPreservedArgs,outputActionRequired,argvHasNonInteractive,shouldEmitNonInteractiveCommandError,outputAgentError,writeAgentError,outputAgentSuccess,exitWithNonInteractiveError,openUrlInBrowserCommand};
|
|
@@ -4,4 +4,4 @@ import { dirname as __dirname_ } from 'node:path';
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
const __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
const __dirname = __dirname_(__filename);
|
|
7
|
-
import{projectOption,yesOption}from"./chunk-ROOWZCAB.js";import{packageName}from"./chunk-FI772UVH.js";var listSubcommand={name:"list",aliases:["ls"],description:"List all routing rules for the current project. These routes apply to all deployments and environments.",arguments:[],options:[projectOption,{name:"search",description:"Search by name, description, source, or destination",shorthand:"s",type:String,argument:"QUERY",deprecated:!1},{name:"filter",description:"Filter by type: rewrite, redirect, set_status, transform",shorthand:"f",type:String,argument:"TYPE",deprecated:!1},{name:"production",description:"List routes from the live production version",shorthand:null,type:Boolean,deprecated:!1},{name:"version-id",description:"List routes from a specific version ID",shorthand:null,type:String,argument:"VERSION_ID",deprecated:!1},{name:"diff",description:"Compare staged changes against production. Use with --version-id to compare a specific version.",shorthand:null,type:Boolean,deprecated:!1},{name:"expand",description:"Show expanded details for each route",shorthand:"e",type:Boolean,deprecated:!1}],examples:[{name:"List all routes",value:`${packageName} routes list`},{name:"Search for routes",value:`${packageName} routes list --search "api"`},{name:"Filter by type",value:`${packageName} routes list --filter rewrite`},{name:"Show staged changes",value:`${packageName} routes list --diff`},{name:"Show live production routes",value:`${packageName} routes list --production`},{name:"Show expanded details",value:`${packageName} routes list --expand`}]},listVersionsSubcommand={name:"list-versions",aliases:["ls-versions"],description:"List all versions of routing rules",arguments:[],options:[projectOption,{name:"count",description:"Number of versions to fetch (default: 20, max: 100)",shorthand:null,type:Number,argument:"NUMBER",deprecated:!1}],examples:[{name:"List route versions",value:`${packageName} routes list-versions`},{name:"List more versions",value:`${packageName} routes list-versions --count 50`}]},inspectSubcommand={name:"inspect",aliases:[],description:"Show detailed information about a specific route",arguments:[{name:"name-or-id",required:!0}],options:[projectOption,{name:"diff",description:"Compare staged changes against production for this route",shorthand:null,type:Boolean,deprecated:!1}],examples:[{name:"Inspect a route by name",value:`${packageName} routes inspect "API rewrite"`},{name:"Inspect a route by ID",value:`${packageName} routes inspect abc123`},{name:"Show staged changes for a route",value:`${packageName} routes inspect "My route" --diff`}]},addSubcommand={name:"add",aliases:[],description:"Add a new routing rule to the project",arguments:[{name:"name",required:!1}],options:[projectOption,{name:"src",description:"Path pattern (required in non-interactive mode)",shorthand:null,type:String,argument:"PATTERN",deprecated:!1},{name:"src-syntax",description:"Path syntax: regex (default), path-to-regexp, equals",shorthand:null,type:String,argument:"TYPE",deprecated:!1},{name:"action",description:"Action type: rewrite, redirect, or set-status (required with --dest/--status)",shorthand:null,type:String,argument:"TYPE",deprecated:!1},{name:"dest",description:"Destination URL for rewrite or redirect",shorthand:null,type:String,argument:"URL",deprecated:!1},{name:"status",description:"Status code (301/302/307/308 for redirect, or any for set-status)",shorthand:null,type:Number,argument:"CODE",deprecated:!1},{name:"set-response-header",description:"Set response header: key=value (repeatable)",shorthand:null,type:[String],argument:"HEADER",deprecated:!1},{name:"append-response-header",description:"Append to response header: key=value (repeatable)",shorthand:null,type:[String],argument:"HEADER",deprecated:!1},{name:"delete-response-header",description:"Delete response header: key (repeatable)",shorthand:null,type:[String],argument:"KEY",deprecated:!1},{name:"set-request-header",description:"Set request header: key=value (repeatable)",shorthand:null,type:[String],argument:"HEADER",deprecated:!1},{name:"append-request-header",description:"Append to request header: key=value (repeatable)",shorthand:null,type:[String],argument:"HEADER",deprecated:!1},{name:"delete-request-header",description:"Delete request header: key (repeatable)",shorthand:null,type:[String],argument:"KEY",deprecated:!1},{name:"set-request-query",description:"Set query parameter: key=value (repeatable)",shorthand:null,type:[String],argument:"PARAM",deprecated:!1},{name:"append-request-query",description:"Append to query parameter: key=value (repeatable)",shorthand:null,type:[String],argument:"PARAM",deprecated:!1},{name:"delete-request-query",description:"Delete query parameter: key (repeatable)",shorthand:null,type:[String],argument:"KEY",deprecated:!1},{name:"has",description:"Condition that must match: type:key or type:key:value (repeatable)",shorthand:null,type:[String],argument:"CONDITION",deprecated:!1},{name:"missing",description:'"Does not have" condition: type:key or type:key:value (repeatable)',shorthand:null,type:[String],argument:"CONDITION",deprecated:!1},{name:"description",description:"Route description (max 1024 chars)",shorthand:null,type:String,argument:"TEXT",deprecated:!1},{name:"disabled",description:"Create route in disabled state",shorthand:null,type:Boolean,deprecated:!1},{name:"ai",description:"Generate route from a natural language description (AI-powered)",shorthand:null,type:String,argument:"PROMPT",deprecated:!1},{name:"position",description:"Position: start, end, after:<id>, before:<id>",shorthand:null,type:String,argument:"POSITION",deprecated:!1},{name:"yes",description:"Skip confirmation prompts",shorthand:"y",type:Boolean,deprecated:!1}],examples:[{name:"Interactive mode",value:`${packageName} routes add`},{name:"Create with AI",value:`${packageName} routes add --ai "Rewrite /api/* to https://backend.internal/*"`},{name:"Add a rewrite",value:`${packageName} routes add "API Proxy" --src "/api/:path*" --src-syntax path-to-regexp --action rewrite --dest "https://api.example.com/:path*" --yes`},{name:"Add a redirect",value:`${packageName} routes add "Old Blog" --src "/blog" --src-syntax equals --action redirect --dest "/articles" --status 301 --yes`},{name:"Add CORS headers",value:`${packageName} routes add "CORS" --src "^/api/.*$" --set-response-header "Access-Control-Allow-Origin=*" --yes`},{name:"Block access (set status)",value:`${packageName} routes add "Block Admin" --src "^/admin/.*$" --action set-status --status 403 --yes`},{name:"Conditional redirect",value:`${packageName} routes add "Auth Required" --src "/protected/:path*" --src-syntax path-to-regexp --action redirect --dest "/login" --status 307 --missing "cookie:session" --yes`},{name:"Rewrite with request headers",value:`${packageName} routes add "Backend Proxy" --src "/backend/:path*" --src-syntax path-to-regexp --action rewrite --dest "https://internal.example.com/:path*" --set-request-header "X-Forwarded-Host=myapp.com" --yes`},{name:"Add route at start",value:`${packageName} routes add "Priority Route" --src "/priority" --src-syntax equals --action rewrite --dest "/handler" --position start --yes`}]},publishSubcommand={name:"publish",aliases:[],description:"Publish all staged routing changes to production",arguments:[],options:[projectOption,{...yesOption,description:"Skip the confirmation prompt when publishing"}],examples:[{name:"Publish staged changes",value:`${packageName} routes publish`},{name:"Publish without confirmation",value:`${packageName} routes publish --yes`}]},restoreSubcommand={name:"restore",aliases:[],description:"Restore a previous routing version to production",arguments:[{name:"version-id",required:!0}],options:[projectOption,{...yesOption,description:"Skip the confirmation prompt when restoring"}],examples:[{name:"Restore a previous version",value:`${packageName} routes restore <version-id>`},{name:"Restore without confirmation",value:`${packageName} routes restore <version-id> --yes`}]},discardSubcommand={name:"discard-staging",aliases:[],description:"Discard staged routing changes",arguments:[],options:[projectOption,{...yesOption,description:"Skip the confirmation prompt when discarding"}],examples:[{name:"Discard staged changes",value:`${packageName} routes discard-staging`},{name:"Discard without confirmation",value:`${packageName} routes discard-staging --yes`}]},deleteSubcommand={name:"delete",aliases:["rm"],description:"Delete one or more routing rules",arguments:[{name:"name-or-id",required:!0,multiple:!0}],options:[projectOption,{...yesOption,description:"Skip the confirmation prompt when deleting"}],examples:[{name:"Delete a route by name",value:`${packageName} routes delete "Old Redirect"`},{name:"Delete a route by ID",value:`${packageName} routes delete abc123`},{name:"Delete multiple routes",value:`${packageName} routes delete "Route A" "Route B"`},{name:"Delete without confirmation",value:`${packageName} routes delete "Old Route" --yes`}]},enableSubcommand={name:"enable",aliases:[],description:"Enable a disabled routing rule",arguments:[{name:"name-or-id",required:!0}],options:[projectOption],examples:[{name:"Enable a route by name",value:`${packageName} routes enable "API Proxy"`},{name:"Enable a route by ID",value:`${packageName} routes enable abc123`}]},disableSubcommand={name:"disable",aliases:[],description:"Disable a routing rule without deleting it",arguments:[{name:"name-or-id",required:!0}],options:[projectOption],examples:[{name:"Disable a route by name",value:`${packageName} routes disable "API Proxy"`},{name:"Disable a route by ID",value:`${packageName} routes disable abc123`}]},reorderSubcommand={name:"reorder",aliases:["move"],description:"Move a routing rule to a different position",arguments:[{name:"name-or-id",required:!0}],options:[projectOption,{name:"position",description:"Target position: start, end, a number (1-based), before:<id>, after:<id>",shorthand:null,type:String,argument:"POSITION",deprecated:!1},{name:"first",description:"Move to the first position (highest priority)",shorthand:null,type:Boolean,deprecated:!1},{name:"last",description:"Move to the last position (lowest priority)",shorthand:null,type:Boolean,deprecated:!1},{...yesOption,description:"Skip the confirmation prompt when reordering"}],examples:[{name:"Move to first position",value:`${packageName} routes reorder "Catch All" --first`},{name:"Move to last position",value:`${packageName} routes reorder "Catch All" --last`},{name:"Move to a specific position",value:`${packageName} routes reorder "API Proxy" --position 3`},{name:"Move after another route",value:`${packageName} routes reorder "API Proxy" --position after:route-id-123`},{name:"Interactive reorder (prompts for position)",value:`${packageName} routes reorder "API Proxy"`}]},editSubcommand={name:"edit",aliases:[],description:"Edit an existing routing rule",arguments:[{name:"name-or-id",required:!0}],options:[projectOption,{name:"name",description:"Change route name",shorthand:null,type:String,argument:"NAME",deprecated:!1},{name:"description",description:'Change description (use "" to clear)',shorthand:null,type:String,argument:"TEXT",deprecated:!1},{name:"src",description:"Change source path pattern",shorthand:null,type:String,argument:"PATTERN",deprecated:!1},{name:"src-syntax",description:"Change path syntax: regex, path-to-regexp, equals",shorthand:null,type:String,argument:"TYPE",deprecated:!1},{name:"action",description:"Set action type: rewrite, redirect, or set-status (required when switching types)",shorthand:null,type:String,argument:"TYPE",deprecated:!1},{name:"dest",description:"Set destination URL",shorthand:null,type:String,argument:"URL",deprecated:!1},{name:"status",description:"Set status code",shorthand:null,type:Number,argument:"CODE",deprecated:!1},{name:"no-dest",description:"Remove destination",shorthand:null,type:Boolean,deprecated:!1},{name:"no-status",description:"Remove status code",shorthand:null,type:Boolean,deprecated:!1},{name:"set-response-header",description:"Set response header: key=value (repeatable)",shorthand:null,type:[String],argument:"HEADER",deprecated:!1},{name:"append-response-header",description:"Append to response header: key=value (repeatable)",shorthand:null,type:[String],argument:"HEADER",deprecated:!1},{name:"delete-response-header",description:"Delete response header: key (repeatable)",shorthand:null,type:[String],argument:"KEY",deprecated:!1},{name:"set-request-header",description:"Set request header: key=value (repeatable)",shorthand:null,type:[String],argument:"HEADER",deprecated:!1},{name:"append-request-header",description:"Append to request header: key=value (repeatable)",shorthand:null,type:[String],argument:"HEADER",deprecated:!1},{name:"delete-request-header",description:"Delete request header: key (repeatable)",shorthand:null,type:[String],argument:"KEY",deprecated:!1},{name:"set-request-query",description:"Set query parameter: key=value (repeatable)",shorthand:null,type:[String],argument:"PARAM",deprecated:!1},{name:"append-request-query",description:"Append to query parameter: key=value (repeatable)",shorthand:null,type:[String],argument:"PARAM",deprecated:!1},{name:"delete-request-query",description:"Delete query parameter: key (repeatable)",shorthand:null,type:[String],argument:"KEY",deprecated:!1},{name:"has",description:"Add a has condition: type:key or type:key:value (repeatable)",shorthand:null,type:[String],argument:"CONDITION",deprecated:!1},{name:"missing",description:'Add a "does not have" condition: type:key or type:key:value (repeatable)',shorthand:null,type:[String],argument:"CONDITION",deprecated:!1},{name:"clear-conditions",description:"Remove all has/does-not-have conditions",shorthand:null,type:Boolean,deprecated:!1},{name:"clear-headers",description:"Remove all response headers",shorthand:null,type:Boolean,deprecated:!1},{name:"clear-transforms",description:"Remove all transforms (request headers, request query)",shorthand:null,type:Boolean,deprecated:!1},{name:"ai",description:"Describe changes using natural language (AI-powered)",shorthand:null,type:String,argument:"PROMPT",deprecated:!1},{...yesOption,description:"Skip confirmation prompts"}],examples:[{name:"Interactive mode",value:`${packageName} routes edit "API Proxy"`},{name:"Edit with AI",value:`${packageName} routes edit "API Proxy" --ai "Add CORS headers and change status to 308"`},{name:"Change destination",value:`${packageName} routes edit "API Proxy" --dest "https://new-api.example.com/:path*"`},{name:"Switch to redirect",value:`${packageName} routes edit "Old Route" --action redirect --dest "/new" --status 301`},{name:"Add a response header",value:`${packageName} routes edit "My Route" --set-response-header "Cache-Control=public, max-age=3600"`},{name:"Clear all conditions and add new ones",value:`${packageName} routes edit "My Route" --clear-conditions --has "header:Authorization"`}]},exportSubcommand={name:"export",aliases:[],description:"Export routes to a vercel.json or vercel.ts file",arguments:[{name:"name-or-id",required:!1}],options:[projectOption,{name:"output",description:"Output file format: .json (default) or .ts",shorthand:"o",type:String,argument:"json|ts",deprecated:!1}],examples:[{name:"Export as vercel.json format",value:`${packageName} routes export`},{name:"Export as vercel.ts format",value:`${packageName} routes export --output ts`},{name:"Export a specific route",value:`${packageName} routes export "API Proxy"`},{name:"Export to a file",value:`${packageName} routes export > routes.json`}]},routesCommand={name:"routes",aliases:[],description:"Manage routing rules for a project. Routes managed at the project level apply to all deployments and environments.",arguments:[],subcommands:[listSubcommand,listVersionsSubcommand,inspectSubcommand,addSubcommand,editSubcommand,deleteSubcommand,enableSubcommand,disableSubcommand,reorderSubcommand,exportSubcommand,publishSubcommand,restoreSubcommand,discardSubcommand],options:[],examples:[]};export{listSubcommand,listVersionsSubcommand,inspectSubcommand,addSubcommand,publishSubcommand,restoreSubcommand,discardSubcommand,deleteSubcommand,enableSubcommand,disableSubcommand,reorderSubcommand,editSubcommand,exportSubcommand,routesCommand};
|
|
7
|
+
import{projectOption,yesOption}from"./chunk-5IPBCD7K.js";import{packageName}from"./chunk-FI772UVH.js";var listSubcommand={name:"list",aliases:["ls"],description:"List all routing rules for the current project. These routes apply to all deployments and environments.",arguments:[],options:[projectOption,{name:"search",description:"Search by name, description, source, or destination",shorthand:"s",type:String,argument:"QUERY",deprecated:!1},{name:"filter",description:"Filter by type: rewrite, redirect, set_status, transform",shorthand:"f",type:String,argument:"TYPE",deprecated:!1},{name:"production",description:"List routes from the live production version",shorthand:null,type:Boolean,deprecated:!1},{name:"version-id",description:"List routes from a specific version ID",shorthand:null,type:String,argument:"VERSION_ID",deprecated:!1},{name:"diff",description:"Compare staged changes against production. Use with --version-id to compare a specific version.",shorthand:null,type:Boolean,deprecated:!1},{name:"expand",description:"Show expanded details for each route",shorthand:"e",type:Boolean,deprecated:!1}],examples:[{name:"List all routes",value:`${packageName} routes list`},{name:"Search for routes",value:`${packageName} routes list --search "api"`},{name:"Filter by type",value:`${packageName} routes list --filter rewrite`},{name:"Show staged changes",value:`${packageName} routes list --diff`},{name:"Show live production routes",value:`${packageName} routes list --production`},{name:"Show expanded details",value:`${packageName} routes list --expand`}]},listVersionsSubcommand={name:"list-versions",aliases:["ls-versions"],description:"List all versions of routing rules",arguments:[],options:[projectOption,{name:"count",description:"Number of versions to fetch (default: 20, max: 100)",shorthand:null,type:Number,argument:"NUMBER",deprecated:!1}],examples:[{name:"List route versions",value:`${packageName} routes list-versions`},{name:"List more versions",value:`${packageName} routes list-versions --count 50`}]},inspectSubcommand={name:"inspect",aliases:[],description:"Show detailed information about a specific route",arguments:[{name:"name-or-id",required:!0}],options:[projectOption,{name:"diff",description:"Compare staged changes against production for this route",shorthand:null,type:Boolean,deprecated:!1}],examples:[{name:"Inspect a route by name",value:`${packageName} routes inspect "API rewrite"`},{name:"Inspect a route by ID",value:`${packageName} routes inspect abc123`},{name:"Show staged changes for a route",value:`${packageName} routes inspect "My route" --diff`}]},addSubcommand={name:"add",aliases:[],description:"Add a new routing rule to the project",arguments:[{name:"name",required:!1}],options:[projectOption,{name:"src",description:"Path pattern (required in non-interactive mode)",shorthand:null,type:String,argument:"PATTERN",deprecated:!1},{name:"src-syntax",description:"Path syntax: regex (default), path-to-regexp, equals",shorthand:null,type:String,argument:"TYPE",deprecated:!1},{name:"action",description:"Action type: rewrite, redirect, or set-status (required with --dest/--status)",shorthand:null,type:String,argument:"TYPE",deprecated:!1},{name:"dest",description:"Destination URL for rewrite or redirect",shorthand:null,type:String,argument:"URL",deprecated:!1},{name:"status",description:"Status code (301/302/307/308 for redirect, or any for set-status)",shorthand:null,type:Number,argument:"CODE",deprecated:!1},{name:"set-response-header",description:"Set response header: key=value (repeatable)",shorthand:null,type:[String],argument:"HEADER",deprecated:!1},{name:"append-response-header",description:"Append to response header: key=value (repeatable)",shorthand:null,type:[String],argument:"HEADER",deprecated:!1},{name:"delete-response-header",description:"Delete response header: key (repeatable)",shorthand:null,type:[String],argument:"KEY",deprecated:!1},{name:"set-request-header",description:"Set request header: key=value (repeatable)",shorthand:null,type:[String],argument:"HEADER",deprecated:!1},{name:"append-request-header",description:"Append to request header: key=value (repeatable)",shorthand:null,type:[String],argument:"HEADER",deprecated:!1},{name:"delete-request-header",description:"Delete request header: key (repeatable)",shorthand:null,type:[String],argument:"KEY",deprecated:!1},{name:"set-request-query",description:"Set query parameter: key=value (repeatable)",shorthand:null,type:[String],argument:"PARAM",deprecated:!1},{name:"append-request-query",description:"Append to query parameter: key=value (repeatable)",shorthand:null,type:[String],argument:"PARAM",deprecated:!1},{name:"delete-request-query",description:"Delete query parameter: key (repeatable)",shorthand:null,type:[String],argument:"KEY",deprecated:!1},{name:"has",description:"Condition that must match: type:key or type:key:value (repeatable)",shorthand:null,type:[String],argument:"CONDITION",deprecated:!1},{name:"missing",description:'"Does not have" condition: type:key or type:key:value (repeatable)',shorthand:null,type:[String],argument:"CONDITION",deprecated:!1},{name:"description",description:"Route description (max 1024 chars)",shorthand:null,type:String,argument:"TEXT",deprecated:!1},{name:"disabled",description:"Create route in disabled state",shorthand:null,type:Boolean,deprecated:!1},{name:"ai",description:"Generate route from a natural language description (AI-powered)",shorthand:null,type:String,argument:"PROMPT",deprecated:!1},{name:"position",description:"Position: start, end, after:<id>, before:<id>",shorthand:null,type:String,argument:"POSITION",deprecated:!1},{name:"yes",description:"Skip confirmation prompts",shorthand:"y",type:Boolean,deprecated:!1}],examples:[{name:"Interactive mode",value:`${packageName} routes add`},{name:"Create with AI",value:`${packageName} routes add --ai "Rewrite /api/* to https://backend.internal/*"`},{name:"Add a rewrite",value:`${packageName} routes add "API Proxy" --src "/api/:path*" --src-syntax path-to-regexp --action rewrite --dest "https://api.example.com/:path*" --yes`},{name:"Add a redirect",value:`${packageName} routes add "Old Blog" --src "/blog" --src-syntax equals --action redirect --dest "/articles" --status 301 --yes`},{name:"Add CORS headers",value:`${packageName} routes add "CORS" --src "^/api/.*$" --set-response-header "Access-Control-Allow-Origin=*" --yes`},{name:"Block access (set status)",value:`${packageName} routes add "Block Admin" --src "^/admin/.*$" --action set-status --status 403 --yes`},{name:"Conditional redirect",value:`${packageName} routes add "Auth Required" --src "/protected/:path*" --src-syntax path-to-regexp --action redirect --dest "/login" --status 307 --missing "cookie:session" --yes`},{name:"Rewrite with request headers",value:`${packageName} routes add "Backend Proxy" --src "/backend/:path*" --src-syntax path-to-regexp --action rewrite --dest "https://internal.example.com/:path*" --set-request-header "X-Forwarded-Host=myapp.com" --yes`},{name:"Add route at start",value:`${packageName} routes add "Priority Route" --src "/priority" --src-syntax equals --action rewrite --dest "/handler" --position start --yes`}]},publishSubcommand={name:"publish",aliases:[],description:"Publish all staged routing changes to production",arguments:[],options:[projectOption,{...yesOption,description:"Skip the confirmation prompt when publishing"}],examples:[{name:"Publish staged changes",value:`${packageName} routes publish`},{name:"Publish without confirmation",value:`${packageName} routes publish --yes`}]},restoreSubcommand={name:"restore",aliases:[],description:"Restore a previous routing version to production",arguments:[{name:"version-id",required:!0}],options:[projectOption,{...yesOption,description:"Skip the confirmation prompt when restoring"}],examples:[{name:"Restore a previous version",value:`${packageName} routes restore <version-id>`},{name:"Restore without confirmation",value:`${packageName} routes restore <version-id> --yes`}]},discardSubcommand={name:"discard-staging",aliases:[],description:"Discard staged routing changes",arguments:[],options:[projectOption,{...yesOption,description:"Skip the confirmation prompt when discarding"}],examples:[{name:"Discard staged changes",value:`${packageName} routes discard-staging`},{name:"Discard without confirmation",value:`${packageName} routes discard-staging --yes`}]},deleteSubcommand={name:"delete",aliases:["rm"],description:"Delete one or more routing rules",arguments:[{name:"name-or-id",required:!0,multiple:!0}],options:[projectOption,{...yesOption,description:"Skip the confirmation prompt when deleting"}],examples:[{name:"Delete a route by name",value:`${packageName} routes delete "Old Redirect"`},{name:"Delete a route by ID",value:`${packageName} routes delete abc123`},{name:"Delete multiple routes",value:`${packageName} routes delete "Route A" "Route B"`},{name:"Delete without confirmation",value:`${packageName} routes delete "Old Route" --yes`}]},enableSubcommand={name:"enable",aliases:[],description:"Enable a disabled routing rule",arguments:[{name:"name-or-id",required:!0}],options:[projectOption],examples:[{name:"Enable a route by name",value:`${packageName} routes enable "API Proxy"`},{name:"Enable a route by ID",value:`${packageName} routes enable abc123`}]},disableSubcommand={name:"disable",aliases:[],description:"Disable a routing rule without deleting it",arguments:[{name:"name-or-id",required:!0}],options:[projectOption],examples:[{name:"Disable a route by name",value:`${packageName} routes disable "API Proxy"`},{name:"Disable a route by ID",value:`${packageName} routes disable abc123`}]},reorderSubcommand={name:"reorder",aliases:["move"],description:"Move a routing rule to a different position",arguments:[{name:"name-or-id",required:!0}],options:[projectOption,{name:"position",description:"Target position: start, end, a number (1-based), before:<id>, after:<id>",shorthand:null,type:String,argument:"POSITION",deprecated:!1},{name:"first",description:"Move to the first position (highest priority)",shorthand:null,type:Boolean,deprecated:!1},{name:"last",description:"Move to the last position (lowest priority)",shorthand:null,type:Boolean,deprecated:!1},{...yesOption,description:"Skip the confirmation prompt when reordering"}],examples:[{name:"Move to first position",value:`${packageName} routes reorder "Catch All" --first`},{name:"Move to last position",value:`${packageName} routes reorder "Catch All" --last`},{name:"Move to a specific position",value:`${packageName} routes reorder "API Proxy" --position 3`},{name:"Move after another route",value:`${packageName} routes reorder "API Proxy" --position after:route-id-123`},{name:"Interactive reorder (prompts for position)",value:`${packageName} routes reorder "API Proxy"`}]},editSubcommand={name:"edit",aliases:[],description:"Edit an existing routing rule",arguments:[{name:"name-or-id",required:!0}],options:[projectOption,{name:"name",description:"Change route name",shorthand:null,type:String,argument:"NAME",deprecated:!1},{name:"description",description:'Change description (use "" to clear)',shorthand:null,type:String,argument:"TEXT",deprecated:!1},{name:"src",description:"Change source path pattern",shorthand:null,type:String,argument:"PATTERN",deprecated:!1},{name:"src-syntax",description:"Change path syntax: regex, path-to-regexp, equals",shorthand:null,type:String,argument:"TYPE",deprecated:!1},{name:"action",description:"Set action type: rewrite, redirect, or set-status (required when switching types)",shorthand:null,type:String,argument:"TYPE",deprecated:!1},{name:"dest",description:"Set destination URL",shorthand:null,type:String,argument:"URL",deprecated:!1},{name:"status",description:"Set status code",shorthand:null,type:Number,argument:"CODE",deprecated:!1},{name:"no-dest",description:"Remove destination",shorthand:null,type:Boolean,deprecated:!1},{name:"no-status",description:"Remove status code",shorthand:null,type:Boolean,deprecated:!1},{name:"set-response-header",description:"Set response header: key=value (repeatable)",shorthand:null,type:[String],argument:"HEADER",deprecated:!1},{name:"append-response-header",description:"Append to response header: key=value (repeatable)",shorthand:null,type:[String],argument:"HEADER",deprecated:!1},{name:"delete-response-header",description:"Delete response header: key (repeatable)",shorthand:null,type:[String],argument:"KEY",deprecated:!1},{name:"set-request-header",description:"Set request header: key=value (repeatable)",shorthand:null,type:[String],argument:"HEADER",deprecated:!1},{name:"append-request-header",description:"Append to request header: key=value (repeatable)",shorthand:null,type:[String],argument:"HEADER",deprecated:!1},{name:"delete-request-header",description:"Delete request header: key (repeatable)",shorthand:null,type:[String],argument:"KEY",deprecated:!1},{name:"set-request-query",description:"Set query parameter: key=value (repeatable)",shorthand:null,type:[String],argument:"PARAM",deprecated:!1},{name:"append-request-query",description:"Append to query parameter: key=value (repeatable)",shorthand:null,type:[String],argument:"PARAM",deprecated:!1},{name:"delete-request-query",description:"Delete query parameter: key (repeatable)",shorthand:null,type:[String],argument:"KEY",deprecated:!1},{name:"has",description:"Add a has condition: type:key or type:key:value (repeatable)",shorthand:null,type:[String],argument:"CONDITION",deprecated:!1},{name:"missing",description:'Add a "does not have" condition: type:key or type:key:value (repeatable)',shorthand:null,type:[String],argument:"CONDITION",deprecated:!1},{name:"clear-conditions",description:"Remove all has/does-not-have conditions",shorthand:null,type:Boolean,deprecated:!1},{name:"clear-headers",description:"Remove all response headers",shorthand:null,type:Boolean,deprecated:!1},{name:"clear-transforms",description:"Remove all transforms (request headers, request query)",shorthand:null,type:Boolean,deprecated:!1},{name:"ai",description:"Describe changes using natural language (AI-powered)",shorthand:null,type:String,argument:"PROMPT",deprecated:!1},{...yesOption,description:"Skip confirmation prompts"}],examples:[{name:"Interactive mode",value:`${packageName} routes edit "API Proxy"`},{name:"Edit with AI",value:`${packageName} routes edit "API Proxy" --ai "Add CORS headers and change status to 308"`},{name:"Change destination",value:`${packageName} routes edit "API Proxy" --dest "https://new-api.example.com/:path*"`},{name:"Switch to redirect",value:`${packageName} routes edit "Old Route" --action redirect --dest "/new" --status 301`},{name:"Add a response header",value:`${packageName} routes edit "My Route" --set-response-header "Cache-Control=public, max-age=3600"`},{name:"Clear all conditions and add new ones",value:`${packageName} routes edit "My Route" --clear-conditions --has "header:Authorization"`}]},exportSubcommand={name:"export",aliases:[],description:"Export routes to a vercel.json or vercel.ts file",arguments:[{name:"name-or-id",required:!1}],options:[projectOption,{name:"output",description:"Output file format: .json (default) or .ts",shorthand:"o",type:String,argument:"json|ts",deprecated:!1}],examples:[{name:"Export as vercel.json format",value:`${packageName} routes export`},{name:"Export as vercel.ts format",value:`${packageName} routes export --output ts`},{name:"Export a specific route",value:`${packageName} routes export "API Proxy"`},{name:"Export to a file",value:`${packageName} routes export > routes.json`}]},routesCommand={name:"routes",aliases:[],description:"Manage routing rules for a project. Routes managed at the project level apply to all deployments and environments.",arguments:[],subcommands:[listSubcommand,listVersionsSubcommand,inspectSubcommand,addSubcommand,editSubcommand,deleteSubcommand,enableSubcommand,disableSubcommand,reorderSubcommand,exportSubcommand,publishSubcommand,restoreSubcommand,discardSubcommand],options:[],examples:[]};export{listSubcommand,listVersionsSubcommand,inspectSubcommand,addSubcommand,publishSubcommand,restoreSubcommand,discardSubcommand,deleteSubcommand,enableSubcommand,disableSubcommand,reorderSubcommand,editSubcommand,exportSubcommand,routesCommand};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __dirname_ } from 'node:path';
|
|
4
|
+
const require = __createRequire(import.meta.url);
|
|
5
|
+
const __filename = __fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = __dirname_(__filename);
|
|
7
|
+
import{readJSONFile}from"./chunk-RMZJP32R.js";import{getScope,writeToConfigFile}from"./chunk-THB7KY2N.js";import{require_types}from"./chunk-GHM7V3GG.js";import{getArgs}from"./chunk-LYKPLTZ7.js";import{humanizePath}from"./chunk-PPCFQQSU.js";import{CantFindConfig,CantParseJSONFile,DeprecatedNowJson,WorkingDirectoryDoesNotExist}from"./chunk-NM67DIPQ.js";import{cliErrorFromUnknown,output_manager_default,recordCliError}from"./chunk-Q2YQSMIB.js";import{require_dist}from"./chunk-QGIQK47P.js";import{__commonJS,__toESM}from"./chunk-6L236MNA.js";var require_epipebomb=__commonJS({"../../node_modules/.pnpm/epipebomb@1.0.0/node_modules/epipebomb/epipebomb.js"(exports,module){module.exports=epipeBomb;function epipeBomb(stream,callback){stream==null&&(stream=process.stdout),callback==null&&(callback=process.exit);function epipeFilter(err){if(err.code==="EPIPE")return callback();stream.listeners("error").length<=1&&(stream.removeAllListeners(),stream.emit("error",err),stream.on("error",epipeFilter))}stream.on("error",epipeFilter)}}});var sentry;async function getSentry(){if(!sentry){let[SentryModule,{SENTRY_DSN},{default:pkg}]=await Promise.all([import("./cjs-GOQHXIHX.js"),import("./constants-G4UYVLOF.js"),import("./pkg-YFU67U7I.js")]),Sentry="init"in SentryModule?SentryModule:SentryModule.default;Sentry.init({dsn:SENTRY_DSN,release:`vercel-cli@${pkg.version}`,environment:"stable",autoSessionTracking:!1}),sentry=Sentry}return sentry}function isOutputDebugEnabled(debugFlag){return debugFlag===!0||process.env.VERCEL_CLI_DEBUG==="1"}var import_epipebomb=__toESM(require_epipebomb(),1),SILENCED_ERRORS=["DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead."],installed=!1;function installProcessGuards(){if(installed)return;installed=!0;let originalError=console.error;console.error=msg=>{SILENCED_ERRORS.some(error=>typeof msg=="string"&&msg.includes(error))||originalError(msg)},(0,import_epipebomb.default)()}var import_error_utils=__toESM(require_dist(),1);async function reportError(sentry2,client,error){if(ignoreError(error))return;let user,team,scopeError;try{({user,team}=await getScope(client))}catch(err){(0,import_error_utils.isError)(err)&&(scopeError=err)}sentry2.withScope(scope=>{if(user){let spec={email:user.email,id:user.id,username:user.username,name:user.name};scope.setUser(spec)}team&&scope.setTag("currentTeam",team.id),scopeError&&scope.setExtra("scopeError",{name:scopeError.name,message:scopeError.message,stack:scopeError.stack});let args,argsError;try{args=getArgs(process.argv.slice(2),{})}catch(err){(0,import_error_utils.isError)(err)&&(argsError=err)}if(args){let flags=["--env","--build-env","--token"];for(let flag of flags)args[flag]&&(args[flag]="REDACTED");args._.length>=4&&args._[0].startsWith("secret")&&args._[1]==="add"&&(args._[3]="REDACTED"),scope.setExtra("args",args)}else{let msg="Unable to parse args";argsError&&(msg+=`: ${argsError}`),scope.setExtra("args",msg)}scope.setExtra("node",{execPath:process.execPath,version:process.version,platform:process.platform}),sentry2.captureException(error)});let sentryClient=sentry2.getCurrentHub().getClient();sentryClient&&await sentryClient.close()}function ignoreError(error){return(0,import_error_utils.isError)(error)&&error.message.includes("uv_cwd")}var fatalErrorHandlerSymbol=Symbol.for("vercel.cli.fatal-error-handler");async function exitWithUnexpectedError(error){let handler=globalThis[fatalErrorHandlerSymbol];if(typeof handler=="function")try{await handler(error)}catch{}process.exit(1)}async function handleUnexpectedError(client,err){let{message}=err;return message.includes("sentry")&&message.includes("ENOTFOUND")?(output_manager_default.debug(`Sentry is not reachable: ${err}`),!1):(output_manager_default.error(`An unexpected error occurred!
|
|
8
|
+
${err.stack}`),await reportError(await getSentry(),client,err),!0)}function registerUnexpectedErrorHandlers(getClient){process.on("unhandledRejection",async err=>{recordCliError(cliErrorFromUnknown(err)),err?err instanceof Error?await handleUnexpectedError(getClient(),err):(output_manager_default.error(`An unexpected rejection occurred
|
|
9
|
+
${err}`),await reportError(await getSentry(),getClient(),err)):output_manager_default.error("An unexpected empty rejection occurred"),await exitWithUnexpectedError(err)}),process.on("uncaughtException",async error=>{await handleUnexpectedError(getClient(),error)&&await exitWithUnexpectedError(error)})}var import_types=__toESM(require_types(),1);import path from"path";var import_error_utils2=__toESM(require_dist(),1);var config;async function earlyGetConfig(configFile){if(config)return config;let localPath;try{localPath=process.cwd()}catch(err){if((0,import_error_utils2.isErrnoException)(err)&&err.code==="ENOENT")return new WorkingDirectoryDoesNotExist;throw err}if(configFile){let localFilePath=path.resolve(localPath,configFile);output_manager_default.debug(`Found config in provided --local-config path ${localFilePath}`);let localConfig=await readJSONFile(localFilePath);return localConfig instanceof CantParseJSONFile?localConfig:localConfig===null?new CantFindConfig([humanizePath(localFilePath)]):(config=localConfig,config[import_types.fileNameSymbol]=configFile,config)}let vercelFilePath=path.resolve(localPath,"vercel.json"),nowFilePath=path.resolve(localPath,"now.json"),[vercelConfig,nowConfig]=await Promise.all([readJSONFile(vercelFilePath),readJSONFile(nowFilePath)]);return vercelConfig instanceof CantParseJSONFile?vercelConfig:nowConfig instanceof CantParseJSONFile?nowConfig:vercelConfig!==null?(output_manager_default.debug(`Found config in file "${vercelFilePath}"`),config=vercelConfig,config[import_types.fileNameSymbol]="vercel.json",config):nowConfig!==null?new DeprecatedNowJson(nowFilePath):new CantFindConfig([vercelFilePath].map(humanizePath))}var fallbackReason;function recordDirectBuildFallback(reason){fallbackReason=reason}function getDirectBuildFallbackAttributes(){return fallbackReason===void 0?void 0:{directBuild:"false",fallbackReason}}function checkTelemetryStatus({config:config2}){config2.telemetry||process.env.VERCEL_TELEMETRY_DISABLED||(output_manager_default.note("The Vercel CLI now collects telemetry regarding usage of the CLI."),output_manager_default.log("This information is used to shape the CLI roadmap and prioritize features."),output_manager_default.log("You can learn more, including how to opt-out if you'd not like to participate in this program, by visiting the following URL:"),output_manager_default.log("https://vercel.com/docs/cli/about-telemetry"),config2.telemetry={enabled:!0},writeToConfigFile(config2))}export{getSentry,isOutputDebugEnabled,installProcessGuards,reportError,exitWithUnexpectedError,handleUnexpectedError,registerUnexpectedErrorHandlers,earlyGetConfig,recordDirectBuildFallback,getDirectBuildFallbackAttributes,checkTelemetryStatus};
|
|
@@ -4,4 +4,4 @@ import { dirname as __dirname_ } from 'node:path';
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
const __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
const __dirname = __dirname_(__filename);
|
|
7
|
-
import{APIError,InvalidToken,MissingUser}from"./chunk-
|
|
7
|
+
import{APIError,InvalidToken,MissingUser}from"./chunk-NM67DIPQ.js";import{output_manager_default}from"./chunk-Q2YQSMIB.js";async function getUser(client){return client.user?client.user:(client.userPromise||(client.userPromise=fetchUser(client).finally(()=>{client.userPromise=void 0})),client.userPromise)}async function fetchUser(client){try{let res=await client.fetch("/v2/user",{useCurrentTeam:!1});if(!res.user)throw new MissingUser;if(client.authConfig.userId!==res.user.id){client.updateAuthConfig({userId:res.user.id});try{client.persistAuthConfig()}catch{output_manager_default.debug("Failed to persist cached userId to auth config.")}}return client.telemetryEventStore.updateUserId(res.user.id),client.user=res.user,res.user}catch(error){if(error instanceof APIError&&error.status===403){if(client.user=void 0,client.userPromise=void 0,client.authConfig.userId){client.updateAuthConfig({userId:void 0});try{client.persistAuthConfig()}catch{output_manager_default.debug("Failed to persist cached userId to auth config.")}}throw new InvalidToken(client.authConfig.tokenSource)}throw error}}export{getUser};
|
|
@@ -8,17 +8,19 @@ import{require_dist}from"./chunk-QGIQK47P.js";import{require_escape_string_regex
|
|
|
8
8
|
`],["r","\r"],["t"," "],["b","\b"],["f","\f"],["v","\v"],["0","\0"],["\\","\\"],["e","\x1B"],["a","\x07"]]);function unescape(c){return c[0]==="u"&&c.length===5||c[0]==="x"&&c.length===3?String.fromCharCode(parseInt(c.slice(1),16)):ESCAPES.get(c)||c}function parseArguments(name,args){let results=[],chunks=args.trim().split(/\s*,\s*/g),matches;for(let chunk of chunks)if(!isNaN(chunk))results.push(Number(chunk));else if(matches=chunk.match(STRING_REGEX))results.push(matches[2].replace(ESCAPE_REGEX,(m,escape,chr)=>escape?unescape(escape):chr));else throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name}')`);return results}function parseStyle(style){STYLE_REGEX.lastIndex=0;let results=[],matches;for(;(matches=STYLE_REGEX.exec(style))!==null;){let name=matches[1];if(matches[2]){let args=parseArguments(name,matches[2]);results.push([name].concat(args))}else results.push([name])}return results}function buildStyle(chalk4,styles){let enabled={};for(let layer of styles)for(let style of layer.styles)enabled[style[0]]=layer.inverse?null:style.slice(1);let current=chalk4;for(let styleName of Object.keys(enabled))if(Array.isArray(enabled[styleName])){if(!(styleName in current))throw new Error(`Unknown Chalk style: ${styleName}`);enabled[styleName].length>0?current=current[styleName].apply(current,enabled[styleName]):current=current[styleName]}return current}module.exports=(chalk4,tmp)=>{let styles=[],chunks=[],chunk=[];if(tmp.replace(TEMPLATE_REGEX,(m,escapeChar,inverse,style,close,chr)=>{if(escapeChar)chunk.push(unescape(escapeChar));else if(style){let str=chunk.join("");chunk=[],chunks.push(styles.length===0?str:buildStyle(chalk4,styles)(str)),styles.push({inverse,styles:parseStyle(style)})}else if(close){if(styles.length===0)throw new Error("Found extraneous } in Chalk template literal");chunks.push(buildStyle(chalk4,styles)(chunk.join(""))),chunk=[],styles.pop()}else chunk.push(chr)}),chunks.push(chunk.join("")),styles.length>0){let errMsg=`Chalk template literal is missing ${styles.length} closing bracket${styles.length===1?"":"s"} (\`}\`)`;throw new Error(errMsg)}return chunks.join("")}}});var require_chalk=__commonJS({"../../node_modules/.pnpm/chalk@2.4.2/node_modules/chalk/index.js"(exports,module){"use strict";var escapeStringRegexp=require_escape_string_regexp(),ansiStyles=require_ansi_styles(),stdoutColor=require_supports_color2().stdout,template=require_templates(),isSimpleWindowsTerm=process.platform==="win32"&&!(process.env.TERM||"").toLowerCase().startsWith("xterm"),levelMapping=["ansi","ansi","ansi256","ansi16m"],skipModels=new Set(["gray"]),styles=Object.create(null);function applyOptions(obj,options){options=options||{};let scLevel=stdoutColor?stdoutColor.level:0;obj.level=options.level===void 0?scLevel:options.level,obj.enabled="enabled"in options?options.enabled:obj.level>0}function Chalk(options){if(!this||!(this instanceof Chalk)||this.template){let chalk4={};return applyOptions(chalk4,options),chalk4.template=function(){let args=[].slice.call(arguments);return chalkTag.apply(null,[chalk4.template].concat(args))},Object.setPrototypeOf(chalk4,Chalk.prototype),Object.setPrototypeOf(chalk4.template,chalk4),chalk4.template.constructor=Chalk,chalk4.template}applyOptions(this,options)}isSimpleWindowsTerm&&(ansiStyles.blue.open="\x1B[94m");for(let key of Object.keys(ansiStyles))ansiStyles[key].closeRe=new RegExp(escapeStringRegexp(ansiStyles[key].close),"g"),styles[key]={get(){let codes=ansiStyles[key];return build.call(this,this._styles?this._styles.concat(codes):[codes],this._empty,key)}};styles.visible={get(){return build.call(this,this._styles||[],!0,"visible")}};ansiStyles.color.closeRe=new RegExp(escapeStringRegexp(ansiStyles.color.close),"g");for(let model of Object.keys(ansiStyles.color.ansi))skipModels.has(model)||(styles[model]={get(){let level=this.level;return function(){let codes={open:ansiStyles.color[levelMapping[level]][model].apply(null,arguments),close:ansiStyles.color.close,closeRe:ansiStyles.color.closeRe};return build.call(this,this._styles?this._styles.concat(codes):[codes],this._empty,model)}}});ansiStyles.bgColor.closeRe=new RegExp(escapeStringRegexp(ansiStyles.bgColor.close),"g");for(let model of Object.keys(ansiStyles.bgColor.ansi)){if(skipModels.has(model))continue;let bgModel="bg"+model[0].toUpperCase()+model.slice(1);styles[bgModel]={get(){let level=this.level;return function(){let codes={open:ansiStyles.bgColor[levelMapping[level]][model].apply(null,arguments),close:ansiStyles.bgColor.close,closeRe:ansiStyles.bgColor.closeRe};return build.call(this,this._styles?this._styles.concat(codes):[codes],this._empty,model)}}}}var proto=Object.defineProperties(()=>{},styles);function build(_styles,_empty,key){let builder=function(){return applyStyle.apply(builder,arguments)};builder._styles=_styles,builder._empty=_empty;let self=this;return Object.defineProperty(builder,"level",{enumerable:!0,get(){return self.level},set(level){self.level=level}}),Object.defineProperty(builder,"enabled",{enumerable:!0,get(){return self.enabled},set(enabled){self.enabled=enabled}}),builder.hasGrey=this.hasGrey||key==="gray"||key==="grey",builder.__proto__=proto,builder}function applyStyle(){let args=arguments,argsLen=args.length,str=String(arguments[0]);if(argsLen===0)return"";if(argsLen>1)for(let a=1;a<argsLen;a++)str+=" "+args[a];if(!this.enabled||this.level<=0||!str)return this._empty?"":str;let originalDim=ansiStyles.dim.open;isSimpleWindowsTerm&&this.hasGrey&&(ansiStyles.dim.open="");for(let code of this._styles.slice().reverse())str=code.open+str.replace(code.closeRe,code.open)+code.close,str=str.replace(/\r?\n/g,`${code.close}$&${code.open}`);return ansiStyles.dim.open=originalDim,str}function chalkTag(chalk4,strings){if(!Array.isArray(strings))return[].slice.call(arguments,1).join(" ");let args=[].slice.call(arguments,2),parts=[strings.raw[0]];for(let i=1;i<strings.length;i++)parts.push(String(args[i-1]).replace(/[{}\\]/g,"\\$&")),parts.push(String(strings.raw[i]));return template(chalk4,parts.join(""))}Object.defineProperties(Chalk.prototype,styles);module.exports=Chalk();module.exports.supportsColor=stdoutColor;module.exports.default=module.exports}});var require_mimic_fn=__commonJS({"../../node_modules/.pnpm/mimic-fn@1.2.0/node_modules/mimic-fn/index.js"(exports,module){"use strict";module.exports=(to,from)=>{for(let prop of Object.getOwnPropertyNames(from).concat(Object.getOwnPropertySymbols(from)))Object.defineProperty(to,prop,Object.getOwnPropertyDescriptor(from,prop));return to}}});var require_onetime=__commonJS({"../../node_modules/.pnpm/onetime@2.0.1/node_modules/onetime/index.js"(exports,module){"use strict";var mimicFn=require_mimic_fn();module.exports=(fn,opts)=>{if(opts===!0)throw new TypeError("The second argument is now an options object");if(typeof fn!="function")throw new TypeError("Expected a function");opts=opts||{};let ret,called=!1,fnName=fn.displayName||fn.name||"<anonymous>",onetime=function(){if(called){if(opts.throw===!0)throw new Error(`Function \`${fnName}\` can only be called once`);return ret}return called=!0,ret=fn.apply(this,arguments),fn=null,ret};return mimicFn(onetime,fn),onetime}}});var require_signals=__commonJS({"../../node_modules/.pnpm/signal-exit@3.0.7/node_modules/signal-exit/signals.js"(exports,module){module.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];process.platform!=="win32"&&module.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&module.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")}});var require_signal_exit=__commonJS({"../../node_modules/.pnpm/signal-exit@3.0.7/node_modules/signal-exit/index.js"(exports,module){var process2=global.process,processOk=function(process3){return process3&&typeof process3=="object"&&typeof process3.removeListener=="function"&&typeof process3.emit=="function"&&typeof process3.reallyExit=="function"&&typeof process3.listeners=="function"&&typeof process3.kill=="function"&&typeof process3.pid=="number"&&typeof process3.on=="function"};processOk(process2)?(assert=__require("assert"),signals=require_signals(),isWin=/^win/i.test(process2.platform),EE=__require("events"),typeof EE!="function"&&(EE=EE.EventEmitter),process2.__signal_exit_emitter__?emitter=process2.__signal_exit_emitter__:(emitter=process2.__signal_exit_emitter__=new EE,emitter.count=0,emitter.emitted={}),emitter.infinite||(emitter.setMaxListeners(1/0),emitter.infinite=!0),module.exports=function(cb,opts){if(!processOk(global.process))return function(){};assert.equal(typeof cb,"function","a callback must be provided for exit handler"),loaded===!1&&load();var ev="exit";opts&&opts.alwaysLast&&(ev="afterexit");var remove=function(){emitter.removeListener(ev,cb),emitter.listeners("exit").length===0&&emitter.listeners("afterexit").length===0&&unload()};return emitter.on(ev,cb),remove},unload=function(){!loaded||!processOk(global.process)||(loaded=!1,signals.forEach(function(sig){try{process2.removeListener(sig,sigListeners[sig])}catch{}}),process2.emit=originalProcessEmit,process2.reallyExit=originalProcessReallyExit,emitter.count-=1)},module.exports.unload=unload,emit=function(event,code,signal){emitter.emitted[event]||(emitter.emitted[event]=!0,emitter.emit(event,code,signal))},sigListeners={},signals.forEach(function(sig){sigListeners[sig]=function(){if(processOk(global.process)){var listeners=process2.listeners(sig);listeners.length===emitter.count&&(unload(),emit("exit",null,sig),emit("afterexit",null,sig),isWin&&sig==="SIGHUP"&&(sig="SIGINT"),process2.kill(process2.pid,sig))}}}),module.exports.signals=function(){return signals},loaded=!1,load=function(){loaded||!processOk(global.process)||(loaded=!0,emitter.count+=1,signals=signals.filter(function(sig){try{return process2.on(sig,sigListeners[sig]),!0}catch{return!1}}),process2.emit=processEmit,process2.reallyExit=processReallyExit)},module.exports.load=load,originalProcessReallyExit=process2.reallyExit,processReallyExit=function(code){processOk(global.process)&&(process2.exitCode=code||0,emit("exit",process2.exitCode,null),emit("afterexit",process2.exitCode,null),originalProcessReallyExit.call(process2,process2.exitCode))},originalProcessEmit=process2.emit,processEmit=function(ev,arg){if(ev==="exit"&&processOk(global.process)){arg!==void 0&&(process2.exitCode=arg);var ret=originalProcessEmit.apply(this,arguments);return emit("exit",process2.exitCode,null),emit("afterexit",process2.exitCode,null),ret}else return originalProcessEmit.apply(this,arguments)}):module.exports=function(){return function(){}};var assert,signals,isWin,EE,emitter,unload,emit,sigListeners,loaded,load,originalProcessReallyExit,processReallyExit,originalProcessEmit,processEmit}});var require_restore_cursor=__commonJS({"../../node_modules/.pnpm/restore-cursor@2.0.0/node_modules/restore-cursor/index.js"(exports,module){"use strict";var onetime=require_onetime(),signalExit=require_signal_exit();module.exports=onetime(()=>{signalExit(()=>{process.stderr.write("\x1B[?25h")},{alwaysLast:!0})})}});var require_cli_cursor=__commonJS({"../../node_modules/.pnpm/cli-cursor@2.1.0/node_modules/cli-cursor/index.js"(exports){"use strict";var restoreCursor=require_restore_cursor(),hidden=!1;exports.show=stream=>{let s=stream||process.stderr;s.isTTY&&(hidden=!1,s.write("\x1B[?25h"))};exports.hide=stream=>{let s=stream||process.stderr;s.isTTY&&(restoreCursor(),hidden=!0,s.write("\x1B[?25l"))};exports.toggle=(force,stream)=>{force!==void 0&&(hidden=force),hidden?exports.show(stream):exports.hide(stream)}}});var require_log_symbols=__commonJS({"../../node_modules/.pnpm/log-symbols@2.2.0/node_modules/log-symbols/index.js"(exports,module){"use strict";var chalk4=require_chalk(),isSupported=process.platform!=="win32"||process.env.CI||process.env.TERM==="xterm-256color",main={info:chalk4.blue("\u2139"),success:chalk4.green("\u2714"),warning:chalk4.yellow("\u26A0"),error:chalk4.red("\u2716")},fallbacks={info:chalk4.blue("i"),success:chalk4.green("\u221A"),warning:chalk4.yellow("\u203C"),error:chalk4.red("\xD7")};module.exports=isSupported?main:fallbacks}});var require_ansi_regex=__commonJS({"../../node_modules/.pnpm/ansi-regex@4.1.1/node_modules/ansi-regex/index.js"(exports,module){"use strict";module.exports=options=>{options=Object.assign({onlyFirst:!1},options);let pattern=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");return new RegExp(pattern,options.onlyFirst?void 0:"g")}}});var require_strip_ansi=__commonJS({"../../node_modules/.pnpm/strip-ansi@5.2.0/node_modules/strip-ansi/index.js"(exports,module){"use strict";var ansiRegex=require_ansi_regex(),stripAnsi=string=>typeof string=="string"?string.replace(ansiRegex(),""):string;module.exports=stripAnsi;module.exports.default=stripAnsi}});var require_clone=__commonJS({"../../node_modules/.pnpm/clone@1.0.4/node_modules/clone/clone.js"(exports,module){var clone=function(){"use strict";function clone2(parent,circular,depth,prototype){var filter;typeof circular=="object"&&(depth=circular.depth,prototype=circular.prototype,filter=circular.filter,circular=circular.circular);var allParents=[],allChildren=[],useBuffer=typeof Buffer<"u";typeof circular>"u"&&(circular=!0),typeof depth>"u"&&(depth=1/0);function _clone(parent2,depth2){if(parent2===null)return null;if(depth2==0)return parent2;var child,proto;if(typeof parent2!="object")return parent2;if(clone2.__isArray(parent2))child=[];else if(clone2.__isRegExp(parent2))child=new RegExp(parent2.source,__getRegExpFlags(parent2)),parent2.lastIndex&&(child.lastIndex=parent2.lastIndex);else if(clone2.__isDate(parent2))child=new Date(parent2.getTime());else{if(useBuffer&&Buffer.isBuffer(parent2))return Buffer.allocUnsafe?child=Buffer.allocUnsafe(parent2.length):child=new Buffer(parent2.length),parent2.copy(child),child;typeof prototype>"u"?(proto=Object.getPrototypeOf(parent2),child=Object.create(proto)):(child=Object.create(prototype),proto=prototype)}if(circular){var index=allParents.indexOf(parent2);if(index!=-1)return allChildren[index];allParents.push(parent2),allChildren.push(child)}for(var i in parent2){var attrs;proto&&(attrs=Object.getOwnPropertyDescriptor(proto,i)),!(attrs&&attrs.set==null)&&(child[i]=_clone(parent2[i],depth2-1))}return child}return _clone(parent,depth)}clone2.clonePrototype=function(parent){if(parent===null)return null;var c=function(){};return c.prototype=parent,new c};function __objToStr(o){return Object.prototype.toString.call(o)}clone2.__objToStr=__objToStr;function __isDate(o){return typeof o=="object"&&__objToStr(o)==="[object Date]"}clone2.__isDate=__isDate;function __isArray(o){return typeof o=="object"&&__objToStr(o)==="[object Array]"}clone2.__isArray=__isArray;function __isRegExp(o){return typeof o=="object"&&__objToStr(o)==="[object RegExp]"}clone2.__isRegExp=__isRegExp;function __getRegExpFlags(re){var flags="";return re.global&&(flags+="g"),re.ignoreCase&&(flags+="i"),re.multiline&&(flags+="m"),flags}return clone2.__getRegExpFlags=__getRegExpFlags,clone2}();typeof module=="object"&&module.exports&&(module.exports=clone)}});var require_defaults=__commonJS({"../../node_modules/.pnpm/defaults@1.0.4/node_modules/defaults/index.js"(exports,module){var clone=require_clone();module.exports=function(options,defaults){return options=options||{},Object.keys(defaults).forEach(function(key){typeof options[key]>"u"&&(options[key]=clone(defaults[key]))}),options}}});var require_combining=__commonJS({"../../node_modules/.pnpm/wcwidth@1.0.1/node_modules/wcwidth/combining.js"(exports,module){module.exports=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531],[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]]}});var require_wcwidth=__commonJS({"../../node_modules/.pnpm/wcwidth@1.0.1/node_modules/wcwidth/index.js"(exports,module){"use strict";var defaults=require_defaults(),combining=require_combining(),DEFAULTS={nul:0,control:0};module.exports=function(str){return wcswidth(str,DEFAULTS)};module.exports.config=function(opts){return opts=defaults(opts||{},DEFAULTS),function(str){return wcswidth(str,opts)}};function wcswidth(str,opts){if(typeof str!="string")return wcwidth(str,opts);for(var s=0,i=0;i<str.length;i++){var n=wcwidth(str.charCodeAt(i),opts);if(n<0)return-1;s+=n}return s}function wcwidth(ucs,opts){return ucs===0?opts.nul:ucs<32||ucs>=127&&ucs<160?opts.control:bisearch(ucs)?0:1+(ucs>=4352&&(ucs<=4447||ucs==9001||ucs==9002||ucs>=11904&&ucs<=42191&&ucs!=12351||ucs>=44032&&ucs<=55203||ucs>=63744&&ucs<=64255||ucs>=65040&&ucs<=65049||ucs>=65072&&ucs<=65135||ucs>=65280&&ucs<=65376||ucs>=65504&&ucs<=65510||ucs>=131072&&ucs<=196605||ucs>=196608&&ucs<=262141))}function bisearch(ucs){var min=0,max=combining.length-1,mid;if(ucs<combining[0][0]||ucs>combining[max][1])return!1;for(;max>=min;)if(mid=Math.floor((min+max)/2),ucs>combining[mid][1])min=mid+1;else if(ucs<combining[mid][0])max=mid-1;else return!0;return!1}}});var require_ora=__commonJS({"../../node_modules/.pnpm/ora@3.4.0/node_modules/ora/index.js"(exports,module){"use strict";var chalk4=require_chalk(),cliCursor=require_cli_cursor(),cliSpinners=require_cli_spinners(),logSymbols=require_log_symbols(),stripAnsi=require_strip_ansi(),wcwidth=require_wcwidth(),TEXT=Symbol("text"),PREFIX_TEXT=Symbol("prefixText"),Ora=class{constructor(options){typeof options=="string"&&(options={text:options}),this.options=Object.assign({text:"",color:"cyan",stream:process.stderr},options),this.spinner=this.options.spinner,this.color=this.options.color,this.hideCursor=this.options.hideCursor!==!1,this.interval=this.options.interval||this.spinner.interval||100,this.stream=this.options.stream,this.id=null,this.isEnabled=typeof this.options.isEnabled=="boolean"?this.options.isEnabled:this.stream&&this.stream.isTTY&&!process.env.CI,this.text=this.options.text,this.prefixText=this.options.prefixText,this.linesToClear=0,this.indent=this.options.indent}get indent(){return this._indent}set indent(indent=0){if(!(indent>=0&&Number.isInteger(indent)))throw new Error("The `indent` option must be an integer from 0 and up");this._indent=indent}get spinner(){return this._spinner}set spinner(spinner){if(this.frameIndex=0,typeof spinner=="object"){if(spinner.frames===void 0)throw new Error("The given spinner must have a `frames` property");this._spinner=spinner}else if(process.platform==="win32")this._spinner=cliSpinners.line;else if(spinner===void 0)this._spinner=cliSpinners.dots;else if(cliSpinners[spinner])this._spinner=cliSpinners[spinner];else throw new Error(`There is no built-in spinner named '${spinner}'. See https://github.com/sindresorhus/cli-spinners/blob/master/spinners.json for a full list.`)}get text(){return this[TEXT]}get prefixText(){return this[PREFIX_TEXT]}get isSpinning(){return this.id!==null}updateLineCount(){let columns=this.stream.columns||80,fullPrefixText=typeof this[PREFIX_TEXT]=="string"?this[PREFIX_TEXT]+"-":"";this.lineCount=stripAnsi(fullPrefixText+"--"+this[TEXT]).split(`
|
|
9
9
|
`).reduce((count,line)=>count+Math.max(1,Math.ceil(wcwidth(line)/columns)),0)}set text(value){this[TEXT]=value,this.updateLineCount()}set prefixText(value){this[PREFIX_TEXT]=value,this.updateLineCount()}frame(){let{frames}=this.spinner,frame=frames[this.frameIndex];this.color&&(frame=chalk4[this.color](frame)),this.frameIndex=++this.frameIndex%frames.length;let fullPrefixText=typeof this.prefixText=="string"?this.prefixText+" ":"",fullText=typeof this.text=="string"?" "+this.text:"";return fullPrefixText+frame+fullText}clear(){if(!this.isEnabled||!this.stream.isTTY)return this;for(let i=0;i<this.linesToClear;i++)i>0&&this.stream.moveCursor(0,-1),this.stream.clearLine(),this.stream.cursorTo(this.indent);return this.linesToClear=0,this}render(){return this.clear(),this.stream.write(this.frame()),this.linesToClear=this.lineCount,this}start(text){return text&&(this.text=text),this.isEnabled?this.isSpinning?this:(this.hideCursor&&cliCursor.hide(this.stream),this.render(),this.id=setInterval(this.render.bind(this),this.interval),this):(this.stream.write(`- ${this.text}
|
|
10
10
|
`),this)}stop(){return this.isEnabled?(clearInterval(this.id),this.id=null,this.frameIndex=0,this.clear(),this.hideCursor&&cliCursor.show(this.stream),this):this}succeed(text){return this.stopAndPersist({symbol:logSymbols.success,text})}fail(text){return this.stopAndPersist({symbol:logSymbols.error,text})}warn(text){return this.stopAndPersist({symbol:logSymbols.warning,text})}info(text){return this.stopAndPersist({symbol:logSymbols.info,text})}stopAndPersist(options={}){let prefixText=options.prefixText||this.prefixText,fullPrefixText=typeof prefixText=="string"?prefixText+" ":"",text=options.text||this.text,fullText=typeof text=="string"?" "+text:"";return this.stop(),this.stream.write(`${fullPrefixText}${options.symbol||" "}${fullText}
|
|
11
|
-
`),this}},oraFactory=function(opts){return new Ora(opts)};module.exports=oraFactory;module.exports.default=oraFactory;module.exports.promise=(action,options)=>{if(typeof action.then!="function")throw new TypeError("Parameter `action` must be a Promise");let spinner=new Ora(options);return spinner.start(),action.then(()=>{spinner.succeed()},()=>{spinner.fail()}),spinner}}});var require_build_utils=__commonJS({"cjs-dependency:@vercel/build-utils"(exports,module){module.exports=__require("@vercel/build-utils")}});var import_chalk=__toESM(require_source(),1),link=import_chalk.default.cyan.underline,link_default=link;var import_ansi_escapes=__toESM(require_ansi_escapes(),1);function eraseLines(numberOfLines){return import_ansi_escapes.default.eraseLines(numberOfLines)}
|
|
12
|
-
`)?result:result.trimStart()}var import_chalk3=__toESM(require_source(),1),ansiEscapes2=__toESM(require_ansi_escapes(),1),import_supports_hyperlinks=__toESM(require_supports_hyperlinks(),1);var import_ora=__toESM(require_ora(),1),import_chalk2=__toESM(require_source(),1);function wait(opts,delay=300){let text=opts.text,spinner=null;if(typeof text!="string")throw new Error('"text" is required for Ora spinner');let timeout=setTimeout(()=>{spinner=(0,import_ora.default)(opts),spinner.text=import_chalk2.default.gray(text),spinner.color="gray",spinner.start()},delay),stop=()=>{clearTimeout(timeout),spinner&&(spinner.stop(),spinner=null,process.stderr.write(eraseLines(1)))};return stop.text=text,Object.defineProperty(stop,"text",{get(){return text},set(v){text=v,spinner&&(spinner.text=import_chalk2.default.gray(v))}}),stop}var import_error_utils=__toESM(require_dist(),1);import{inspect}from"util";var chars={tick:process.platform==="win32"?"\u221A":"\u2714",cross:process.platform==="win32"?"\u2613":"\u2718",fatal:process.platform==="win32"?"x":"\u2717"},chars_default=chars;var IS_TEST=process.env.NODE_ENV==="test",defaultChalkColorLevel=0,Output=class{constructor(stream,options={}){this.isDebugEnabled=()=>this.debugEnabled;this.print=str=>{this.colorDisabled&&(str=removeEmoji(str)),this.stopSpinner(),this.stream.write(str)};this.log=(str,color=import_chalk3.default.grey)=>{this.print(`${color(">")} ${str}
|
|
11
|
+
`),this}},oraFactory=function(opts){return new Ora(opts)};module.exports=oraFactory;module.exports.default=oraFactory;module.exports.promise=(action,options)=>{if(typeof action.then!="function")throw new TypeError("Parameter `action` must be a Promise");let spinner=new Ora(options);return spinner.start(),action.then(()=>{spinner.succeed()},()=>{spinner.fail()}),spinner}}});var require_build_utils=__commonJS({"cjs-dependency:@vercel/build-utils"(exports,module){module.exports=__require("@vercel/build-utils")}});var import_chalk=__toESM(require_source(),1),link=import_chalk.default.cyan.underline,link_default=link;var import_ansi_escapes=__toESM(require_ansi_escapes(),1);function eraseLines(numberOfLines){return import_ansi_escapes.default.eraseLines(numberOfLines)}var emojiLabels={notice:"\u{1F4DD}",tip:"\u{1F4A1}",warning:"\u2757\uFE0F",link:"\u{1F517}",inspect:"\u{1F50D}",success:"\u2705",locked:"\u{1F512}",loading:"\u23F3"},stripEmojiRegex=new RegExp(Object.values(emojiLabels).join("|"),"gi");function emoji(label){return emojiLabels[label]}function prependEmoji(message,emoji2){return emoji2&&process.stdout.isTTY?`${emoji2} ${message}`:message}function removeEmoji(message){let result=message.replace(stripEmojiRegex,"");return result.startsWith(`
|
|
12
|
+
`)?result:result.trimStart()}function toValueWithArgs(valFn,...args){return typeof valFn=="function"?valFn(...args):valFn}var captureStackTrace=Error.captureStackTrace,Diagnostic=class Diagnostic2 extends Error{name="Diagnostic";docs;fix;sources;get why(){return this.message}constructor(init,captureFrom=Diagnostic2){super(init.why,{cause:init.cause}),this.fix=init.fix,this.docs=init.docs,this.sources=init.sources,captureStackTrace?.(this,captureFrom)}toJSON(){return{name:this.name,why:this.why,fix:this.fix,docs:this.docs,sources:this.sources,cause:this.cause,stack:this.stack}}};function deriveDocs(docsBase,code){return typeof docsBase=="string"?`${docsBase}/${code.toLowerCase()}`:docsBase?.(code)}function defineDiagnostics(options){let reporters=options.reporters??[],result={},{docsBase}=options;for(let code of Object.keys(options.codes)){let def=options.codes[code],docs=def.docs===!1?void 0:def.docs||deriveDocs(docsBase,code),handle=(params={},reporterOptions={})=>{let diagnostic=new Diagnostic({why:toValueWithArgs(def.why,params),fix:toValueWithArgs(def.fix,params),docs,cause:params.cause,sources:params.sources},handle);diagnostic.name=code;for(let reporter of reporters)reporter(diagnostic,reporterOptions);return diagnostic};result[code]=handle}return result}var UNCLASSIFIED_ERROR_CODE="UNCLASSIFIED_ERROR",MAX_SCANNED_OUTPUT_LENGTH=64*1024,recorded;function stringProperty(value,key){if(typeof value=="object"&&value!==null&&key in value){let property=value[key];if(typeof property=="string")return property}}function numberProperty(value,key){if(typeof value=="object"&&value!==null&&key in value){let property=value[key];if(typeof property=="number")return property}}function cliErrorFromUnknown(err,{includeMessage=!1}={}){let code=err instanceof Diagnostic&&err.name!=="Diagnostic"?err.name:stringProperty(err,"code");return{status:numberProperty(err,"status"),code:code??(err instanceof Error&&err.name!=="Error"&&err.name!=="Diagnostic"?err.name:void 0),slug:stringProperty(err,"slug"),action:stringProperty(err,"action"),serverMessage:includeMessage?stringProperty(err,"serverMessage")??stringProperty(err,"message"):void 0}}function recordCliError(details,{override=!1}={}){recorded&&!override&&(recorded.code||!details.code)||(recorded=details)}function recordCliErrorFromOutput(chunk){if(typeof chunk!="string"||chunk.length>MAX_SCANNED_OUTPUT_LENGTH||!chunk.includes('"reason"'))return;let text=chunk.trim();if(!text.startsWith("{"))return;let payload;try{payload=JSON.parse(text)}catch{return}let status=stringProperty(payload,"status"),reason=stringProperty(payload,"reason");(status==="error"||status==="action_required")&&reason&&recordCliError({code:reason})}function takeCliError(){let details=recorded;return recorded=void 0,details}var import_chalk3=__toESM(require_source(),1),ansiEscapes2=__toESM(require_ansi_escapes(),1),import_supports_hyperlinks=__toESM(require_supports_hyperlinks(),1);var import_ora=__toESM(require_ora(),1),import_chalk2=__toESM(require_source(),1);function wait(opts,delay=300){let text=opts.text,spinner=null;if(typeof text!="string")throw new Error('"text" is required for Ora spinner');let timeout=setTimeout(()=>{spinner=(0,import_ora.default)(opts),spinner.text=import_chalk2.default.gray(text),spinner.color="gray",spinner.start()},delay),stop=()=>{clearTimeout(timeout),spinner&&(spinner.stop(),spinner=null,process.stderr.write(eraseLines(1)))};return stop.text=text,Object.defineProperty(stop,"text",{get(){return text},set(v){text=v,spinner&&(spinner.text=import_chalk2.default.gray(v))}}),stop}var import_error_utils=__toESM(require_dist(),1);import{inspect}from"util";var chars={tick:process.platform==="win32"?"\u221A":"\u2714",cross:process.platform==="win32"?"\u2613":"\u2718",fatal:process.platform==="win32"?"x":"\u2717",warning:"!"},chars_default=chars;var IS_TEST=process.env.NODE_ENV==="test",defaultChalkColorLevel=0,Output=class{constructor(stream,options={}){this.isDebugEnabled=()=>this.debugEnabled;this.print=str=>{this.colorDisabled&&(str=removeEmoji(str)),this.stopSpinner(),this.stream.write(str)};this.log=(str,color=import_chalk3.default.grey)=>{this.print(`${color(">")} ${str}
|
|
13
13
|
`)};this.dim=(str,color=import_chalk3.default.grey)=>{this.print(`${color(`> ${str}`)}
|
|
14
14
|
`)};this.warn=(str,slug=null,link3=null,action="Learn More")=>{let details=slug?`https://err.sh/vercel/${slug}`:link3;this.print(import_chalk3.default.yellow(import_chalk3.default.bold("WARNING! ")+str+(details?`
|
|
15
15
|
${action}: ${link_default(details)}`:""))),this.print(`
|
|
16
|
-
`)};this.note=str=>{this.log(import_chalk3.default`{yellow.bold NOTE:} ${str}`)};this.error=(str,slug,link3,action="Learn More")=>{this.print(`${import_chalk3.default.red("Error:")} ${str}
|
|
16
|
+
`)};this.note=str=>{this.log(import_chalk3.default`{yellow.bold NOTE:} ${str}`)};this.error=(str,slug,link3,action="Learn More")=>{recordCliError({slug}),this.print(`${import_chalk3.default.red("Error:")} ${str}
|
|
17
17
|
`);let details=slug?`https://err.sh/vercel/${slug}`:link3;details&&this.print(`${import_chalk3.default.bold(action)}: ${link_default(details)}
|
|
18
|
-
`)};this.fatal=str=>{this.print(`${import_chalk3.default.red(chars_default.fatal)} ${str.replace(/\n/g,`
|
|
18
|
+
`)};this.fatal=str=>{recordCliError({}),this.print(`${import_chalk3.default.red(chars_default.fatal)} ${str.replace(/\n/g,`
|
|
19
19
|
`)}
|
|
20
|
-
`)};this.
|
|
20
|
+
`)};this.warning=str=>{this.print(`${import_chalk3.default.yellow(chars_default.warning)} ${str.replace(/\n/g,`
|
|
21
|
+
`)}
|
|
22
|
+
`)};this.prettyError=err=>{if(recordCliError(cliErrorFromUnknown(err)),err instanceof Diagnostic){let code=err.name&&err.name!=="Diagnostic"?err.name:void 0,str=code?`${import_chalk3.default.dim(`[${code}]`)} ${(0,import_error_utils.errorToString)(err)}`:(0,import_error_utils.errorToString)(err);err.fix&&(str+=`
|
|
21
23
|
${import_chalk3.default.bold("Fix:")} ${err.fix}`);let action=err.action;return this.error(str,void 0,err.docs,action??"Learn More")}return this.error((0,import_error_utils.errorToString)(err),void 0,err.link,err.action)};this.ready=str=>{this.print(`${import_chalk3.default.cyan("> Ready!")} ${str}
|
|
22
24
|
`)};this.success=str=>{this.print(`${import_chalk3.default.cyan("> Success!")} ${str}
|
|
23
25
|
`)};this.debug=debug=>{this.debugEnabled&&this.log(`${import_chalk3.default.bold("[debug]")} ${import_chalk3.default.gray(`[${new Date().toISOString()}]`)} ${debugToString(debug)}`)};this.spinner=(message,delay=300)=>{if(this.debugEnabled){this.debug(`Spinner invoked (${message}) with a ${delay}ms delay`);return}IS_TEST||!this.stream.isTTY?this.print(`${message}
|
|
24
|
-
`):(this.spinnerMessage=message,this._spinner?this._spinner.text=message:this._spinner=wait({text:message,stream:this.stream},delay))};this.stopSpinner=()=>{if(this.debugEnabled&&this.spinnerMessage){let msg=`Spinner stopped (${this.spinnerMessage})`;this.spinnerMessage="",this.debug(msg)}this._spinner&&(this._spinner(),this._spinner=null,this.spinnerMessage="")};this.time=async(label,fn)=>{let promise=typeof fn=="function"?fn():fn;if(this.debugEnabled){let startLabel=typeof label=="function"?label():label;this.debug(startLabel);let start=Date.now(),r=await promise,endLabel=typeof label=="function"?label(r):label,duration=Date.now()-start,durationPretty=duration<1e3?`${duration}ms`:`${(duration/1e3).toFixed(2)}s`;return this.debug(`${endLabel} ${import_chalk3.default.gray(`[${durationPretty}]`)}`),r}return promise};this.link=(text,url,{fallback,color=import_chalk3.default.cyan}={})=>this.supportsHyperlink?ansiEscapes2.link(color?color(text):text,url):fallback===!1?link_default(text):typeof fallback=="function"?fallback():`${text} (${link_default(url)})`;this.spinnerMessage="",this._spinner=null,this.initialize({...options,stream})}initialize({stream,debug:debugEnabled,supportsHyperlink,noColor}={}){stream!==void 0&&(this.stream=stream),debugEnabled!==void 0&&(this.debugEnabled=debugEnabled),supportsHyperlink===void 0?this.supportsHyperlink=(0,import_supports_hyperlinks.supportsHyperlink)(this.stream):this.supportsHyperlink=supportsHyperlink,noColor!==void 0&&(this.colorDisabled=getNoColor(noColor),this.colorDisabled?(defaultChalkColorLevel=import_chalk3.default.level,import_chalk3.default.level=0):import_chalk3.default.level=defaultChalkColorLevel)}};function getNoColor(noColorArg){return!!(process.env.FORCE_COLOR==="0"||process.env.NO_COLOR==="1"||noColorArg)}function debugToString(debug){return typeof debug=="string"?debug:inspect(debug)}var output=new Output(process.stderr,{debug:!1}),output_manager_default=output;export{link_default,require_signal_exit,eraseLines,Diagnostic,defineDiagnostics,emoji,prependEmoji,chars_default,output_manager_default,require_build_utils};
|
|
26
|
+
`):(this.spinnerMessage=message,this._spinner?this._spinner.text=message:this._spinner=wait({text:message,stream:this.stream},delay))};this.stopSpinner=()=>{if(this.debugEnabled&&this.spinnerMessage){let msg=`Spinner stopped (${this.spinnerMessage})`;this.spinnerMessage="",this.debug(msg)}this._spinner&&(this._spinner(),this._spinner=null,this.spinnerMessage="")};this.time=async(label,fn)=>{let promise=typeof fn=="function"?fn():fn;if(this.debugEnabled){let startLabel=typeof label=="function"?label():label;this.debug(startLabel);let start=Date.now(),r=await promise,endLabel=typeof label=="function"?label(r):label,duration=Date.now()-start,durationPretty=duration<1e3?`${duration}ms`:`${(duration/1e3).toFixed(2)}s`;return this.debug(`${endLabel} ${import_chalk3.default.gray(`[${durationPretty}]`)}`),r}return promise};this.link=(text,url,{fallback,color=import_chalk3.default.cyan}={})=>this.supportsHyperlink?ansiEscapes2.link(color?color(text):text,url):fallback===!1?link_default(text):typeof fallback=="function"?fallback():`${text} (${link_default(url)})`;this.spinnerMessage="",this._spinner=null,this.initialize({...options,stream})}initialize({stream,debug:debugEnabled,supportsHyperlink,noColor}={}){stream!==void 0&&(this.stream=stream),debugEnabled!==void 0&&(this.debugEnabled=debugEnabled),supportsHyperlink===void 0?this.supportsHyperlink=(0,import_supports_hyperlinks.supportsHyperlink)(this.stream):this.supportsHyperlink=supportsHyperlink,noColor!==void 0&&(this.colorDisabled=getNoColor(noColor),this.colorDisabled?(defaultChalkColorLevel=import_chalk3.default.level,import_chalk3.default.level=0):import_chalk3.default.level=defaultChalkColorLevel)}};function getNoColor(noColorArg){return!!(process.env.FORCE_COLOR==="0"||process.env.NO_COLOR==="1"||noColorArg)}function debugToString(debug){return typeof debug=="string"?debug:inspect(debug)}var output=new Output(process.stderr,{debug:!1}),output_manager_default=output;export{link_default,require_signal_exit,eraseLines,Diagnostic,defineDiagnostics,emoji,prependEmoji,chars_default,UNCLASSIFIED_ERROR_CODE,cliErrorFromUnknown,recordCliError,recordCliErrorFromOutput,takeCliError,output_manager_default,require_build_utils};
|
|
@@ -4,5 +4,5 @@ import { dirname as __dirname_ } from 'node:path';
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
const __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
const __dirname = __dirname_(__filename);
|
|
7
|
-
import{require_ms}from"./chunk-QTKJC2O5.js";import{output_manager_default}from"./chunk-
|
|
8
|
-
`}function writeJsonError(client,code,message){client.stdout.write(formatJsonError(code,message))}var USAGE_ERROR_CODES=new Set(["CONFLICTING_CONTENT","INVALID_AGGREGATION","INVALID_ARGUMENTS","INVALID_ATTACHMENT","INVALID_GRANULARITY","INVALID_LIMIT","INVALID_RULE_TYPE","INVALID_STATUS","INVALID_THREAD","INVALID_TIME","INVALID_TIME_RANGE","MESSAGE_WITH_MULTIPLE_THREADS","MISSING_ARGUMENT","MISSING_ARGUMENTS","MISSING_CONTENT","MISSING_FLAG","MISSING_THREAD","MUTUAL_EXCLUSIVITY"]);function getExitCodeForErrorCode(code){return USAGE_ERROR_CODES.has(code)?2:1}function outputError(client,jsonOutput,code,message){return jsonOutput?writeJsonError(client,code,message):output_manager_default.error(message),getExitCodeForErrorCode(code)}function handleValidationError(result,jsonOutput,client){return outputError(client,jsonOutput,result.code,result.message)}export{parseTimeFlag,resolveTimeRange,validateAllProjectMutualExclusivity,validateTimeBound,validateTimeOrder,normalizeRepeatableStringFilters,validateIntegerRangeWithDefault,validateOptionalIntegerRange,writeJsonError,getExitCodeForErrorCode,outputError,handleValidationError};
|
|
7
|
+
import{require_ms}from"./chunk-QTKJC2O5.js";import{output_manager_default}from"./chunk-Q2YQSMIB.js";import{__toESM}from"./chunk-6L236MNA.js";var import_ms=__toESM(require_ms(),1);function parseTimeFlag(input){let milliseconds=(0,import_ms.default)(input);if(milliseconds!==void 0)return new Date(Date.now()-milliseconds);let date=new Date(input);if(isNaN(date.getTime()))throw new Error(`Invalid time format "${input}". Use relative (1h, 30m, 2d, 1w) or ISO 8601 datetime.`);return date}function resolveTimeRange(since="1h",until){let startTime=parseTimeFlag(since),endTime=until?parseTimeFlag(until):new Date;return{startTime,endTime}}function validateAllProjectMutualExclusivity(all,project){return all&&project?{valid:!1,code:"MUTUAL_EXCLUSIVITY",message:"Cannot specify both --all and --project. Use one or the other."}:{valid:!0}}function validateTimeBound(input){if(!input)return{valid:!0,value:void 0};try{return{valid:!0,value:parseTimeFlag(input)}}catch(err){return{valid:!1,code:"INVALID_TIME",message:err.message}}}function validateTimeOrder(since,until){return since&&until&&since.getTime()>until.getTime()?{valid:!1,code:"INVALID_TIME_RANGE",message:"`--since` must be earlier than `--until`."}:{valid:!0}}function normalizeRepeatableStringFilters(filters){if(!filters||filters.length===0)return[];let normalized=filters.flatMap(filter=>filter.split(",")).map(filter=>filter.trim()).filter(Boolean);return[...new Set(normalized)]}function validateIntegerRangeWithDefault(value,opts){return value===void 0?{valid:!0,value:opts.defaultValue}:Number.isNaN(value)?{valid:!1,code:"INVALID_LIMIT",message:`Please provide a number for flag \`${opts.flag}\`.`}:!Number.isInteger(value)||value<opts.min||value>opts.max?{valid:!1,code:"INVALID_LIMIT",message:`\`${opts.flag}\` must be an integer between ${opts.min} and ${opts.max}.`}:{valid:!0,value}}function validateOptionalIntegerRange(value,opts){return value===void 0?{valid:!0,value:void 0}:Number.isNaN(value)?{valid:!1,code:opts.code||"INVALID_LIMIT",message:`Please provide a number for flag \`${opts.flag}\`.`}:!Number.isInteger(value)||value<opts.min||value>opts.max?{valid:!1,code:opts.code||"INVALID_LIMIT",message:`\`${opts.flag}\` must be an integer between ${opts.min} and ${opts.max}.`}:{valid:!0,value}}function formatJsonError(code,message){return`${JSON.stringify({error:{code,message}},null,2)}
|
|
8
|
+
`}function writeJsonError(client,code,message){client.stdout.write(formatJsonError(code,message))}var USAGE_ERROR_CODES=new Set(["CONFLICTING_CONTENT","INVALID_AGGREGATION","INVALID_ARGUMENTS","INVALID_ATTACHMENT","INVALID_GRANULARITY","INVALID_GROUP_BY","INVALID_LIMIT","INVALID_RULE_TYPE","INVALID_STATUS","INVALID_THREAD","INVALID_TIME","INVALID_TIME_RANGE","MESSAGE_WITH_MULTIPLE_THREADS","MISSING_ARGUMENT","MISSING_ARGUMENTS","MISSING_CONTENT","MISSING_FLAG","MISSING_THREAD","MUTUAL_EXCLUSIVITY"]);function getExitCodeForErrorCode(code){return USAGE_ERROR_CODES.has(code)?2:1}function outputError(client,jsonOutput,code,message){return jsonOutput?writeJsonError(client,code,message):output_manager_default.error(message),getExitCodeForErrorCode(code)}function handleValidationError(result,jsonOutput,client){return outputError(client,jsonOutput,result.code,result.message)}export{parseTimeFlag,resolveTimeRange,validateAllProjectMutualExclusivity,validateTimeBound,validateTimeOrder,normalizeRepeatableStringFilters,validateIntegerRangeWithDefault,validateOptionalIntegerRange,writeJsonError,getExitCodeForErrorCode,outputError,handleValidationError};
|
|
@@ -4,6 +4,6 @@ import { dirname as __dirname_ } from 'node:path';
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
const __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
const __dirname = __dirname_(__filename);
|
|
7
|
-
import{emitAlertsScopeError,resolveAlertsScope}from"./chunk-
|
|
7
|
+
import{emitAlertsScopeError,resolveAlertsScope}from"./chunk-CR2ZQBDU.js";import{getExitCodeForErrorCode,handleValidationError,validateAllProjectMutualExclusivity}from"./chunk-Q7AYTXUR.js";import{isJSONObject}from"./chunk-ECMWDZTJ.js";import{AGENT_REASON,buildCommandWithGlobalFlags,getExitCodeForReason,outputAgentError}from"./chunk-ONPJXQQ6.js";import{getScope}from"./chunk-THB7KY2N.js";import{getProjectByNameOrId}from"./chunk-3XLK5ZPD.js";import{ProjectNotFound,isAPIError}from"./chunk-NM67DIPQ.js";import{output_manager_default}from"./chunk-Q2YQSMIB.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
8
|
`):output_manager_default.fatal([message,...issues.map(issue=>` ${issue.path}: ${issue.message}`)].join(`
|
|
9
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};
|
|
@@ -4,4 +4,4 @@ import { dirname as __dirname_ } from 'node:path';
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
const __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
const __dirname = __dirname_(__filename);
|
|
7
|
-
import{require_json_parse_better_errors}from"./chunk-N6CNMMSZ.js";import{require_lib}from"./chunk-
|
|
7
|
+
import{require_json_parse_better_errors}from"./chunk-N6CNMMSZ.js";import{require_lib}from"./chunk-3XLK5ZPD.js";import{CantParseJSONFile}from"./chunk-NM67DIPQ.js";import{require_dist}from"./chunk-QGIQK47P.js";import{__toESM}from"./chunk-6L236MNA.js";var import_fs_extra=__toESM(require_lib(),1);var import_json_parse_better_errors=__toESM(require_json_parse_better_errors(),1),import_error_utils=__toESM(require_dist(),1);async function readJSONFile(file){let content=await readFileSafe(file);if(content===null)return content;try{return(0,import_json_parse_better_errors.default)(content)}catch(error){return new CantParseJSONFile(file,(0,import_error_utils.errorToString)(error))}}async function readFileSafe(file){try{return await import_fs_extra.default.readFile(file,"utf8")}catch{return null}}export{readJSONFile};
|
|
@@ -4,4 +4,4 @@ import { dirname as __dirname_ } from 'node:path';
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
const __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
const __dirname = __dirname_(__filename);
|
|
7
|
-
import{getEnvTargetPlaceholder}from"./chunk-
|
|
7
|
+
import{getEnvTargetPlaceholder}from"./chunk-LWQVT6YW.js";import{projectOption,yesOption}from"./chunk-5IPBCD7K.js";import{packageName}from"./chunk-FI772UVH.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};
|