vercel 59.16.0 → 59.18.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/dist/chunks/{add-7G6574RA.js → add-G2FG4MZK.js} +1 -1
- package/dist/chunks/{add-65ZSJF26.js → add-JYMUUDWF.js} +1 -1
- package/dist/chunks/{add-MFTI65B7.js → add-PMMNU7RN.js} +1 -1
- package/dist/chunks/{build-BLQRFSLM.js → build-IVYHMLHB.js} +1 -1
- package/dist/chunks/{chunk-QGHN2WOY.js → chunk-22NPN6VB.js} +1 -1
- package/dist/chunks/{chunk-G7Y77DFH.js → chunk-254TC5HX.js} +1 -1
- package/dist/chunks/{chunk-BMOWQEWL.js → chunk-2NOOW6ZP.js} +1 -1
- package/dist/chunks/{chunk-JTVVBRW7.js → chunk-2Q47GHFX.js} +1 -1
- package/dist/chunks/{chunk-DFE7LVAK.js → chunk-2YBNGUYY.js} +1 -1
- package/dist/chunks/chunk-46NPQBNU.js +27 -0
- package/dist/chunks/{chunk-EGMJRU5P.js → chunk-4A5YIRNE.js} +1 -1
- package/dist/chunks/{chunk-XSVBYDYI.js → chunk-4VGOAPFY.js} +1 -1
- package/dist/chunks/{chunk-ZM2RFVTV.js → chunk-66K6BTX2.js} +1 -1
- package/dist/chunks/{chunk-XK2BQUWV.js → chunk-72ZDPBW5.js} +2 -2
- package/dist/chunks/{chunk-GRNTLNC7.js → chunk-7NYQ7CTP.js} +1 -1
- package/dist/chunks/{chunk-HBFPLBTX.js → chunk-7O3KGTQ3.js} +1 -1
- package/dist/chunks/{chunk-V4L6NUSW.js → chunk-7VWHD7WQ.js} +1 -1
- package/dist/chunks/chunk-AL5JWXZE.js +9 -0
- package/dist/chunks/{chunk-TGVB4DJ4.js → chunk-BDCZFSP2.js} +1 -1
- package/dist/chunks/{chunk-R2TGGVCT.js → chunk-CBWDIZAF.js} +1 -1
- package/dist/chunks/chunk-CJ3LL5E7.js +7 -0
- package/dist/chunks/chunk-CJPM2DXZ.js +7 -0
- package/dist/chunks/{chunk-7GU2GVQ7.js → chunk-CRNMRUJK.js} +1 -1
- package/dist/chunks/{chunk-YCCBAQIH.js → chunk-DD5EEWWR.js} +4 -4
- package/dist/chunks/{chunk-YV6CTDHR.js → chunk-DLKR2CG6.js} +1 -1
- package/dist/chunks/chunk-EEKVUD55.js +8 -0
- package/dist/chunks/{chunk-6YAADRQB.js → chunk-EGG7SPNM.js} +1 -1
- package/dist/chunks/{chunk-PZPLBXHU.js → chunk-FEV4CIBN.js} +1 -1
- package/dist/chunks/{chunk-GYGIBRFB.js → chunk-FM2ODCMZ.js} +1 -1
- package/dist/chunks/{chunk-7HSQ4ULK.js → chunk-FOUWMNT7.js} +1 -1
- package/dist/chunks/{chunk-FANE2VO3.js → chunk-FZIRRUBO.js} +1 -1
- package/dist/chunks/{chunk-4QX77CP7.js → chunk-GGZODU6S.js} +1 -1
- package/dist/chunks/{chunk-ZZQRMRWD.js → chunk-GWPIATTW.js} +1 -1
- package/dist/chunks/{chunk-R3RHRLGI.js → chunk-H7S7TVBZ.js} +1 -1
- package/dist/chunks/{chunk-7FEWFNWG.js → chunk-HFDQ3P7T.js} +1 -1
- package/dist/chunks/{chunk-7V6DZO2T.js → chunk-HQEAROJN.js} +1 -1
- package/dist/chunks/chunk-HUHUQXHY.js +7 -0
- package/dist/chunks/{chunk-M67S3ZNJ.js → chunk-HUI32UNA.js} +4 -4
- package/dist/chunks/chunk-I7QY6ROQ.js +9 -0
- package/dist/chunks/{chunk-265LYROU.js → chunk-IG7TNQGL.js} +1 -1
- package/dist/chunks/{chunk-K3KJZLBD.js → chunk-JDQP267R.js} +1 -1
- package/dist/chunks/{chunk-YCD5VEHQ.js → chunk-JNFC2ASC.js} +1 -1
- package/dist/chunks/{chunk-ZIPVX7LD.js → chunk-KACMQTK7.js} +1 -1
- package/dist/chunks/{chunk-L243RUIR.js → chunk-KCSMPBFZ.js} +1 -1
- package/dist/chunks/chunk-KNQ3Y22G.js +10 -0
- package/dist/chunks/{chunk-7RMCBXBB.js → chunk-LASMHNUP.js} +2 -2
- package/dist/chunks/chunk-LX5GOY7N.js +8 -0
- package/dist/chunks/{chunk-3EBQRPCU.js → chunk-MOPFNLFK.js} +1 -1
- package/dist/chunks/{chunk-G4QF3M55.js → chunk-Q2TOOW5N.js} +1 -1
- package/dist/chunks/chunk-QDE5CFRC.js +11 -0
- package/dist/chunks/{chunk-RN2EWPUH.js → chunk-QE5VDLPY.js} +2 -2
- package/dist/chunks/{chunk-75CPY75D.js → chunk-QTSRDWKO.js} +1 -1
- package/dist/chunks/chunk-QVINTB7T.js +14 -0
- package/dist/chunks/{chunk-4PNSSS3L.js → chunk-QYPQGOSO.js} +1 -1
- package/dist/chunks/chunk-RCHRY3CN.js +7 -0
- package/dist/chunks/{chunk-Z6Y55QJW.js → chunk-RTRCTYW6.js} +2 -2
- package/dist/chunks/{chunk-4NE5IQ25.js → chunk-RVJ2E3BM.js} +1 -1
- package/dist/chunks/{chunk-RAIBQIKB.js → chunk-SA2SQV6P.js} +1 -1
- package/dist/chunks/{chunk-G6CTAHKY.js → chunk-SECZRAWX.js} +1 -1
- package/dist/chunks/{chunk-V6GSMYQB.js → chunk-SJ6ZELKN.js} +1 -1
- package/dist/chunks/{chunk-IT3UX6V4.js → chunk-SQ5VXZP6.js} +1 -1
- package/dist/chunks/{chunk-3TXEXPUW.js → chunk-TCS3FDID.js} +1 -1
- package/dist/chunks/{chunk-XQ73QIQ3.js → chunk-U6TAKLJ6.js} +1 -1
- package/dist/chunks/{chunk-NUGLE4QY.js → chunk-UED2PPFP.js} +1 -1
- package/dist/chunks/chunk-VOZEB6PD.js +7 -0
- package/dist/chunks/chunk-W2XUH2WW.js +25 -0
- package/dist/chunks/{chunk-XFVGX5HG.js → chunk-WKZ6JSGZ.js} +1 -1
- package/dist/chunks/{chunk-EVZRQGNK.js → chunk-WSNDO7JA.js} +1 -1
- package/dist/chunks/{chunk-6NVGLVCH.js → chunk-WTXJ4X2D.js} +1 -1
- package/dist/chunks/{chunk-RUJT2JBX.js → chunk-WUMV6WRR.js} +1 -1
- package/dist/chunks/{chunk-TJCIHDPZ.js → chunk-XQWBEAKZ.js} +1 -1
- package/dist/chunks/{chunk-2B2MN3U5.js → chunk-XV6SDZIO.js} +1 -1
- package/dist/chunks/{chunk-PV5PBVER.js → chunk-XZYKYDQO.js} +1 -1
- package/dist/chunks/{chunk-CN2QZO4U.js → chunk-Y7SVAW54.js} +1 -1
- package/dist/chunks/{chunk-MPV7JL34.js → chunk-YCFYVPFP.js} +1 -1
- package/dist/chunks/{chunk-JYAUUIR4.js → chunk-YNINVUX2.js} +1 -1
- package/dist/chunks/{chunk-QGIGNMII.js → chunk-YWDSQTGK.js} +1 -1
- package/dist/chunks/{chunk-NB2UCUFL.js → chunk-YYH7OWMO.js} +1 -1
- package/dist/chunks/{chunk-XZ2JXEXU.js → chunk-ZQGW6A7G.js} +1 -1
- package/dist/chunks/{chunk-6RIQPTJA.js → chunk-ZVFZIWBV.js} +1 -1
- package/dist/chunks/{clear-OJ6EDV3Q.js → clear-QWLAXTZ2.js} +1 -1
- package/dist/chunks/{compile-vercel-config-HKMFYX2L.js → compile-vercel-config-7Z4U2GXV.js} +1 -1
- package/dist/chunks/{config-LULRZCTY.js → config-DWUI22HZ.js} +1 -1
- package/dist/chunks/config-S2ZQRGUM.js +7 -0
- package/dist/chunks/config-validator.mjs +1 -1
- package/dist/chunks/connect-git-provider-WOJ5VGWD.js +7 -0
- package/dist/chunks/{constants-NCE2LWSS.js → constants-G4UYVLOF.js} +1 -1
- package/dist/chunks/{delete-DUHLA627.js → delete-DKXWEXSY.js} +1 -1
- package/dist/chunks/{delete-HBL7TKZ5.js → delete-LJFDZG3J.js} +1 -1
- package/dist/chunks/{detect-projects-2GNCZ4CS.js → detect-projects-64MZJZ6M.js} +1 -1
- package/dist/chunks/{detect-services-5GIRISUS.js → detect-services-OYKTY23L.js} +1 -1
- package/dist/chunks/{disable-XTZ2FN2I.js → disable-5ZNYIRQ6.js} +1 -1
- package/dist/chunks/{discard-4IW37YWA.js → discard-VGPXMVDP.js} +1 -1
- package/dist/chunks/{edit-BBEW6J4Y.js → edit-OAUR6VZN.js} +1 -1
- package/dist/chunks/{edit-PUQ4NHNH.js → edit-PZJIUQUQ.js} +1 -1
- package/dist/chunks/{enable-4AIU4V44.js → enable-XHKXM6ZO.js} +1 -1
- package/dist/chunks/{exec-4AISDHUV.js → exec-ZLT5KH2Z.js} +1 -1
- package/dist/chunks/{export-NQ4SZHRW.js → export-WJ5AOD5D.js} +1 -1
- package/dist/chunks/future-CFQTZYLF.js +7 -0
- package/dist/chunks/{generate-cert-for-deploy-IGJNGQLD.js → generate-cert-for-deploy-MLBCRZP7.js} +1 -1
- package/dist/chunks/{image-PEDML4FR.js → image-O62TT3WT.js} +1 -1
- package/dist/chunks/import-builders-XBF4XRUV.js +7 -0
- package/dist/chunks/{inspect-TUXRUGES.js → inspect-37P6UWRK.js} +1 -1
- package/dist/chunks/{inspect-EEGSI64I.js → inspect-5UD3BTCK.js} +1 -1
- package/dist/chunks/{inspect-EZP7WID3.js → inspect-JNAVK3W2.js} +1 -1
- package/dist/chunks/{inspect-WY6ISJM6.js → inspect-PTE3AJIM.js} +1 -1
- package/dist/chunks/{inspect-DXFD47VC.js → inspect-ZEQB7B56.js} +1 -1
- package/dist/chunks/{list-QTYHA5QM.js → list-BCNACV7V.js} +1 -1
- package/dist/chunks/{list-EQBJKUH7.js → list-D4WFKHXH.js} +1 -1
- package/dist/chunks/{list-JC24ACBV.js → list-NFRKB6ZN.js} +1 -1
- package/dist/chunks/{login-WDMVEUBV.js → login-IN4CKJYT.js} +1 -1
- package/dist/chunks/login-YBF2T6BO.js +7 -0
- package/dist/chunks/{logs-JWDSCEI5.js → logs-3ULFZW4S.js} +1 -1
- package/dist/chunks/{ls-3VJGBK3L.js → ls-454PHZ45.js} +1 -1
- package/dist/chunks/{ls-3ZKP7ZPO.js → ls-6P2SJGIV.js} +1 -1
- package/dist/chunks/{ls-BAMHXX2I.js → ls-A2FWZ3NF.js} +1 -1
- package/dist/chunks/{ls-TYHGH2W4.js → ls-AOXH6ROK.js} +1 -1
- package/dist/chunks/{ls-YA2L3HO5.js → ls-KOJYZ2MR.js} +1 -1
- package/dist/chunks/{ls-YXJ4X57G.js → ls-M4AAACDP.js} +1 -1
- package/dist/chunks/{ls-S6JZYPGH.js → ls-SQLHYCYD.js} +1 -1
- package/dist/chunks/{mutate-PE6TUYAM.js → mutate-VRGKUIKY.js} +1 -1
- package/dist/chunks/{notifications-T3RUG34N.js → notifications-EWKMY3H6.js} +1 -1
- package/dist/chunks/{open-BAWCRPNZ.js → open-WLDHUEDQ.js} +1 -1
- package/dist/chunks/openapi-V5CKADGX.js +7 -0
- package/dist/chunks/{permissions-4AXOWGE6.js → permissions-6GBDJTT6.js} +1 -1
- package/dist/chunks/prompt-missing-credentials-BTUGE7QE.js +7 -0
- package/dist/chunks/{publish-2XWTYLVS.js → publish-2UPLM3TI.js} +1 -1
- package/dist/chunks/pull-Y5CUBUU7.js +7 -0
- package/dist/chunks/{purchase-domain-if-available-BLEETOAR.js → purchase-domain-if-available-IMVQLQ5H.js} +1 -1
- package/dist/chunks/{push-HVT3DU7K.js → push-CAAKZO2C.js} +1 -1
- package/dist/chunks/{query-MJ7EBPCB.js → query-UFFZMZWM.js} +2 -2
- package/dist/chunks/reauthenticate-BUEUJA3T.js +7 -0
- package/dist/chunks/{reorder-2L5YJSXX.js → reorder-YMD7BWAB.js} +1 -1
- package/dist/chunks/{reply-PPDMG3MF.js → reply-3KG3AZCJ.js} +1 -1
- package/dist/chunks/{resolve-YJVUNKED.js → resolve-JBH2ULOU.js} +1 -1
- package/dist/chunks/{restore-V6I26UDI.js → restore-Y4Z3F6HQ.js} +1 -1
- package/dist/chunks/{rm-3NXDUNS4.js → rm-G2VITZWG.js} +1 -1
- package/dist/chunks/{rm-SQNLLMLK.js → rm-OPYE65YL.js} +1 -1
- package/dist/chunks/{rm-VUOBWXNR.js → rm-RG2M3HCR.js} +1 -1
- package/dist/chunks/{rm-CD6UH446.js → rm-S2XKAZ2G.js} +1 -1
- package/dist/chunks/{rm-43ZFE4U2.js → rm-SUIELRWK.js} +1 -1
- package/dist/chunks/routes-ZD7XUKLY.js +7 -0
- package/dist/chunks/{rule-inspect-D6NCXGFR.js → rule-inspect-NUSKPGGY.js} +1 -1
- package/dist/chunks/{rules-CI4NIZTK.js → rules-HRB2B2DX.js} +1 -1
- package/dist/chunks/{schema-GTOTPNEE.js → schema-HISMGDPE.js} +1 -1
- package/dist/chunks/{schema-C2ZBFLA5.js → schema-MAANM5RD.js} +1 -1
- package/dist/chunks/{select-org-KSCYSESV.js → select-org-EMVG2OX2.js} +1 -1
- package/dist/chunks/{set-5OG2JDEK.js → set-FVZSBB5K.js} +1 -1
- package/dist/chunks/setup-and-link-V2VNR6UN.js +7 -0
- package/dist/chunks/{tags-77GJR6ZK.js → tags-GH3U4E6I.js} +1 -1
- package/dist/chunks/{types-LRXQEDYI.js → types-6SBDA4SL.js} +1 -1
- package/dist/chunks/{update-5BEQ4XCV.js → update-R536DPNI.js} +1 -1
- package/dist/chunks/{chunk-TKBORMUF.js → vlt-builder-graph-B4DFIUS6.js} +1 -1
- package/dist/commands/build/index.js +4 -4
- package/dist/commands/deploy/index.js +4 -4
- package/dist/commands/dev/index.js +12 -11
- 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 +641 -553
- package/dist/index.js +5 -5
- package/dist/version.mjs +1 -1
- package/package.json +49 -49
- package/dist/chunks/chunk-4XH66IEQ.js +0 -14
- package/dist/chunks/chunk-4XO6BRQW.js +0 -8
- package/dist/chunks/chunk-57GHYR4Y.js +0 -25
- package/dist/chunks/chunk-AK5EV3WD.js +0 -13
- package/dist/chunks/chunk-HTC6KO2B.js +0 -7
- package/dist/chunks/chunk-LNPMDXBJ.js +0 -7
- package/dist/chunks/chunk-LSBEGBBX.js +0 -9
- package/dist/chunks/chunk-NS4FH2TY.js +0 -11
- package/dist/chunks/chunk-O3QTFKP3.js +0 -7
- package/dist/chunks/chunk-OTVTI2GM.js +0 -8
- package/dist/chunks/chunk-TEAQZXCV.js +0 -9
- package/dist/chunks/chunk-UETTIYUQ.js +0 -8
- package/dist/chunks/chunk-YKZLKOOD.js +0 -12
- package/dist/chunks/config-IVZNLEUK.js +0 -7
- package/dist/chunks/connect-git-provider-GIU5WZ52.js +0 -7
- package/dist/chunks/future-E2FHKPJN.js +0 -7
- package/dist/chunks/import-builders-UAMMKJAT.js +0 -7
- package/dist/chunks/login-DEAEVUHM.js +0 -7
- package/dist/chunks/native-self-update-KOJVRMHR.js +0 -7
- package/dist/chunks/openapi-MO5HYMHR.js +0 -7
- package/dist/chunks/prompt-missing-credentials-IUHLYSQU.js +0 -7
- package/dist/chunks/pull-KCOUWGVC.js +0 -7
- package/dist/chunks/reauthenticate-SH4XR7NH.js +0 -7
- package/dist/chunks/routes-5DERZV5M.js +0 -7
- package/dist/chunks/setup-and-link-KW27P3UH.js +0 -7
|
@@ -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{MISSING_BOTH_MESSAGE}from"./chunk-
|
|
7
|
+
import{MISSING_BOTH_MESSAGE}from"./chunk-JNFC2ASC.js";import{RULE_ENVIRONMENTS}from"./chunk-IVWPQYIH.js";import{resolveProjectContext}from"./chunk-WUMV6WRR.js";import{AGENT_REASON,AGENT_STATUS}from"./chunk-ENBTTYJR.js";import{detectExplicitScope}from"./chunk-CJ3LL5E7.js";import{printError}from"./chunk-AL5JWXZE.js";import{outputAgentError}from"./chunk-KNQ3Y22G.js";import{isAPIError}from"./chunk-CBWDIZAF.js";import{output_manager_default}from"./chunk-RTRCTYW6.js";function messageFor(err){return isAPIError(err)?err.serverMessage||err.message:err instanceof Error?err.message:String(err)}function handleTracingApiError(client,err){if(client.nonInteractive){let status=isAPIError(err)?err.status:void 0;outputAgentError(client,{status:AGENT_STATUS.ERROR,reason:status===403?AGENT_REASON.PERMISSION_DENIED:status===404?AGENT_REASON.NOT_FOUND:AGENT_REASON.API_ERROR,message:messageFor(err)})}return isAPIError(err)&&err.status===403?(output_manager_default.error(messageFor(err)),1):(printError(err),1)}function configError(client,reason,message){return client.nonInteractive&&outputAgentError(client,{status:AGENT_STATUS.ERROR,reason,message}),output_manager_default.error(message),1}function invalidArguments(client,message){return configError(client,AGENT_REASON.INVALID_ARGUMENTS,message)}function ruleNotFound(client,message){return configError(client,AGENT_REASON.NOT_FOUND,message)}function confirmationRequired(client,message,next){return outputAgentError(client,{status:AGENT_STATUS.ERROR,reason:AGENT_REASON.CONFIRMATION_REQUIRED,message,userActionRequired:!0,next}),output_manager_default.error(message),1}function writeConfigJson(client,{project,bare,envelope,message,next}){if(!client.nonInteractive){client.stdout.write(`${JSON.stringify(bare,null,2)}
|
|
8
8
|
`);return}client.stdout.write(`${JSON.stringify({status:AGENT_STATUS.OK,projectId:project.id,projectName:project.name,...envelope,message,next},null,2)}
|
|
9
9
|
`)}var RULE_LIMIT=10,MIN_SAMPLE_RATE=1,MAX_SAMPLE_RATE=100;function isRuleEnvironment(value){return RULE_ENVIRONMENTS.includes(value)}var ENVIRONMENT_ERROR=`\`environment\` must be one of: ${RULE_ENVIRONMENTS.join(", ")}.`,RATE_ERROR=`\`rate\` must be a whole number from ${MIN_SAMPLE_RATE} to ${MAX_SAMPLE_RATE}.`,EMPTY_PATH_ERROR="`requestPath` cannot be empty.";function parseSampleRate(value){if(!/^\d+$/.test(value.trim()))return;let rate=Number(value);return rate>=MIN_SAMPLE_RATE&&rate<=MAX_SAMPLE_RATE?rate:void 0}function toRow(rule){return{environment:rule.env??"any",requestPath:rule.requestPath??null,sampleRate:Math.round(rule.rate*100)}}function toApiRate(sampleRate){return sampleRate/100}function toRule(row){return{rate:toApiRate(row.sampleRate),...row.environment==="any"?{}:{env:row.environment},...row.requestPath===null?{}:{requestPath:row.requestPath}}}var ALL_PATHS_LABEL="(all paths)";function formatPath(requestPath){return requestPath??ALL_PATHS_LABEL}function formatRate(sampleRate){return`${sampleRate}%`}function formatRuleTarget(environment,requestPath){return`${environment} ${formatPath(requestPath)}`}function formatRuleLine(row){return`${formatRuleTarget(row.environment,row.requestPath)} ${formatRate(row.sampleRate)}`}var COMMAND_WORD_COUNT=3;function subcommandArguments(positional){return positional.slice(COMMAND_WORD_COUNT)}function hasSameKey(a,b){return a.environment===b.environment&&a.requestPath===b.requestPath}async function readProjectTracing({client,teamId,projectId}){let project=await client.fetch(`/v9/projects/${encodeURIComponent(projectId)}`,{accountId:teamId}),tracing=project.tracing??null;return{project,tracing,entries:(tracing?.samplingRules??[]).map(rule=>({rule,row:toRow(rule)}))}}async function writeSamplingRules({client,teamId,projectId,tracing,rules}){let body={tracing:{...tracing??{},samplingRules:rules}};await client.fetch(`/v9/projects/${encodeURIComponent(projectId)}`,{accountId:teamId,method:"PATCH",body})}async function resolveConfigScope(client,flags){let link=await resolveProjectContext({client,projectNameOrId:flags.project});return link.status==="error"?{exitCode:link.exitCode}:link.status==="not_linked"?(output_manager_default.error(MISSING_BOTH_MESSAGE),{exitCode:1}):flags.project===void 0&&detectExplicitScope(client)&&link.org.id!==client.config.currentTeam?(output_manager_default.error(`The linked project ${link.project.name} belongs to ${link.org.slug||link.org.id}, which is not the scope that was passed. Pass --project <name> to act on a project in that scope.`),{exitCode:1}):{teamId:link.org.id,projectId:link.project.id}}export{handleTracingApiError,invalidArguments,ruleNotFound,confirmationRequired,writeConfigJson,RULE_LIMIT,isRuleEnvironment,ENVIRONMENT_ERROR,RATE_ERROR,EMPTY_PATH_ERROR,parseSampleRate,toApiRate,toRule,formatPath,formatRate,formatRuleTarget,formatRuleLine,subcommandArguments,hasSameKey,readProjectTracing,writeSamplingRules,resolveConfigScope};
|
|
@@ -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_dist}from"./chunk-
|
|
7
|
+
import{require_dist}from"./chunk-W2XUH2WW.js";import{forceOption,formatOption,jsonOption,projectOption,yesOption}from"./chunk-JAJW3P42.js";import{packageName,require_lib}from"./chunk-FI772UVH.js";import{__toESM}from"./chunk-6L236MNA.js";var import_constants=__toESM(require_dist(),1),import_title=__toESM(require_lib(),1),envTargetChoices=import_constants.PROJECT_ENV_TARGET.map(t=>({name:(0,import_title.default)(t),value:t}));function isValidEnvTarget(target){return typeof target>"u"||envTargetChoices.map(c=>c.value).includes(target)}function getEnvTargetPlaceholder(){return`<${envTargetChoices.map(c=>c.value).join(" | ")}>`}function parseEnvTargetArg(arg){return Array.from(new Set(arg.split(",").map(t=>t.trim()).filter(Boolean)))}var targetPlaceholder=getEnvTargetPlaceholder(),listSubcommand={name:"list",aliases:["ls"],description:"List all Environment Variables for a Project",arguments:[{name:"environment",required:!1},{name:"git-branch",required:!1}],options:[formatOption,jsonOption,projectOption,{name:"guidance",description:"Receive command suggestions once command is complete",shorthand:null,type:Boolean,deprecated:!1}],examples:[]},addSubcommand={name:"add",aliases:[],description:"Add an Environment Variable",arguments:[{name:"name",required:!0},{name:"environment",required:!1}],options:[projectOption,{name:"git-branch",description:"Set the Git branch for a Preview Environment Variable",shorthand:null,type:String,argument:"NAME",deprecated:!1},{name:"sensitive",description:"Store the value as a Secret",shorthand:null,type:Boolean,deprecated:!1},{name:"no-sensitive",description:"Store the value as Config",shorthand:null,type:Boolean,deprecated:!1},{name:"type",description:"Set the Environment Variable type (`config` or `secret`)",shorthand:null,type:String,argument:"TYPE",deprecated:!1},{name:"visibility",description:"Deprecated alias for `--type`",shorthand:null,type:String,argument:"VISIBILITY",deprecated:!0},{...forceOption,description:"Overwrite an existing variable for the same target",shorthand:null},{...yesOption,description:"Accept default choices when adding an Environment Variable"},{name:"guidance",description:"Show command suggestions after completion",shorthand:null,type:Boolean,deprecated:!1},{name:"value",description:"Set the variable value for non-interactive use; otherwise use stdin or the prompt",shorthand:null,type:String,argument:"VALUE",deprecated:!1}],examples:[{name:"Add a new variable (prompts for value and Environments)",value:[`${packageName} env add <name>`,`${packageName} env add API_TOKEN`]},{name:"Add a new Environment Variable to a specific Environment",value:[`${packageName} env add <name> ${targetPlaceholder}`,`${packageName} env add DB_PASS production`]},{name:"Add one variable to multiple Environments (comma-separated)",value:[`${packageName} env add <name> <environment>[,<environment>]`,`${packageName} env add API_URL production,preview,development`]},{name:"Override an existing Environment Variable of same target (production, preview, deployment)",value:`${packageName} env add API_TOKEN --force`},{name:"Add a Config Environment Variable that remains readable later",value:`${packageName} env add API_TOKEN --no-sensitive`},{name:"Add a new Environment Variable for a specific Environment and Git Branch",value:[`${packageName} env add <name> ${targetPlaceholder} --git-branch <name>`,`${packageName} env add DB_PASS preview --git-branch feat1`]},{name:"Add a new Environment Variable from stdin",value:[`cat <file> | ${packageName} env add <name> ${targetPlaceholder}`,`cat ~/.npmrc | ${packageName} env add NPM_RC preview`,`${packageName} env add API_URL production < url.txt`]},{name:"Add with --value for non-interactive use",value:`${packageName} env add API_TOKEN production --value "<value>" --yes`}]},removeSubcommand={name:"remove",aliases:["rm"],description:"Remove an Environment Variable (see examples below)",arguments:[{name:"name",required:!0},{name:"environment",required:!1}],options:[projectOption,{...yesOption,description:"Skip the confirmation prompt when removing an Environment Variable"}],examples:[{name:"Remove a variable from multiple Environments",value:[`${packageName} env rm <name>`,`${packageName} env rm API_TOKEN`]},{name:"Remove a variable from a specific Environment",value:[`${packageName} env rm <name> ${targetPlaceholder}`,`${packageName} env rm NPM_RC preview`]},{name:"Remove a variable from a specific Environment and Git Branch",value:[`${packageName} env rm <name> ${targetPlaceholder} <gitbranch>`,`${packageName} env rm NPM_RC preview feat1`]}]},pullSubcommand={name:"pull",aliases:[],description:"Pull all Development Environment Variables from the cloud and write to a file [.env.local]",arguments:[{name:"filename",required:!1}],options:[projectOption,{name:"environment",description:"Set the Environment when pulling Environment Variables",shorthand:null,type:String,argument:"TARGET",deprecated:!1},{name:"git-branch",description:"Specify the Git branch to pull specific Environment Variables for",shorthand:null,type:String,argument:"NAME",deprecated:!1},{name:"id",description:"Pull environment variables for a specific deployment (e.g. dpl_xxx)",shorthand:null,type:String,argument:"ID",deprecated:!1},{...yesOption,description:"Skip the confirmation prompt when removing an environment variable"}],examples:[{name:"Pull all Development Environment Variables down from the cloud",value:[`${packageName} env pull <file>`,`${packageName} env pull .env.development.local`]},{name:"Pull environment variables for a specific deployment",value:`${packageName} env pull --id dpl_xxx`}]},runSubcommand={name:"run",aliases:[],description:"Run a command with environment variables from the linked Vercel project",arguments:[{name:"command",required:!0,multiple:!0}],options:[projectOption,{name:"environment",description:"Specify the environment to pull variables from (default: development)",shorthand:"e",type:String,argument:"TARGET",deprecated:!1},{name:"git-branch",description:"Specify the Git branch to pull specific Environment Variables for",shorthand:null,type:String,argument:"NAME",deprecated:!1}],examples:[{name:"Run Next.js dev server with development environment variables",value:`${packageName} env run -- next dev`},{name:"Run tests with preview environment variables for a specific branch",value:`${packageName} env run -e preview --git-branch feature-x -- npm test`}]},updateSubcommand={name:"update",aliases:[],description:"Update the value of an existing Environment Variable (see examples below)",arguments:[{name:"name",required:!0},{name:"environment",required:!1}],options:[projectOption,{name:"sensitive",description:"Store the updated value as a Secret",shorthand:null,type:Boolean,deprecated:!1},{name:"type",description:"Set the Environment Variable type (`config` or `secret`)",shorthand:null,type:String,argument:"TYPE",deprecated:!1},{name:"visibility",description:"Deprecated alias for `--type`",shorthand:null,type:String,argument:"VISIBILITY",deprecated:!0},{...yesOption,description:"Skip the confirmation prompt when updating an Environment Variable"},{name:"value",description:"New value for the variable (non-interactive). Otherwise use stdin or you will be prompted.",shorthand:null,type:String,argument:"VALUE",deprecated:!1}],examples:[{name:"Update a variable in all Environments",value:[`${packageName} env update <name>`,`${packageName} env update API_TOKEN`]},{name:"Update a variable in a specific Environment",value:[`${packageName} env update <name> ${targetPlaceholder}`,`${packageName} env update DB_PASS production`]},{name:"Update a variable for a specific Environment and Git Branch",value:[`${packageName} env update <name> ${targetPlaceholder} <gitbranch>`,`${packageName} env update NPM_RC preview feat1`]},{name:"Update a variable from stdin",value:[`cat <file> | ${packageName} env update <name> ${targetPlaceholder}`,`cat ~/.npmrc | ${packageName} env update NPM_RC preview`,`${packageName} env update API_URL production < url.txt`]}]},envCommand={name:"env",aliases:[],description:"Interact with Environment Variables for a Project",arguments:[],subcommands:[addSubcommand,listSubcommand,pullSubcommand,removeSubcommand,runSubcommand,updateSubcommand],options:[],examples:[{name:"Run a command with Environment Variables from the linked Project",value:`${packageName} env run -- <command>`},{name:"Add one variable to multiple Environments",value:`${packageName} env add API_URL production,preview,development`}]};export{envTargetChoices,isValidEnvTarget,getEnvTargetPlaceholder,parseEnvTargetArg,listSubcommand,addSubcommand,removeSubcommand,pullSubcommand,runSubcommand,updateSubcommand,envCommand};
|
|
@@ -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{AGENT_REASON}from"./chunk-ENBTTYJR.js";import{getProjectByNameOrId}from"./chunk-
|
|
7
|
+
import{AGENT_REASON}from"./chunk-ENBTTYJR.js";import{getProjectByNameOrId}from"./chunk-HUI32UNA.js";import{ProjectNotFound}from"./chunk-CBWDIZAF.js";var MISSING_BOTH_MESSAGE="No linked project found. Run `vercel link`, pass --cwd to a linked dir, or use --scope <team> and --project <name>.";async function resolveScope({client,flags={},linkedProject}){let flagScope=flags.scope?.trim()||void 0,flagProject=flags.project?.trim()||void 0;if(linkedProject.status==="linked"){if(!flagScope&&!flagProject)return{teamId:linkedProject.org.id,projectId:linkedProject.project.id};let teamId=flagScope?client.config.currentTeam:linkedProject.org.id;if(!teamId)return{reason:AGENT_REASON.NOT_FOUND,message:`Team not found: ${flagScope}`};let project=await getProjectByNameOrId(client,flagProject??linkedProject.project.id,teamId);return project instanceof ProjectNotFound?{reason:AGENT_REASON.NOT_FOUND,message:`Project not found: ${flagProject}`}:{teamId,projectId:project.id}}if(flagScope&&flagProject){let teamId=client.config.currentTeam;if(!teamId)return{reason:AGENT_REASON.NOT_FOUND,message:`Team not found: ${flagScope}`};let project=await getProjectByNameOrId(client,flagProject,teamId);return project instanceof ProjectNotFound?{reason:AGENT_REASON.NOT_FOUND,message:`Project not found: ${flagProject}`}:{teamId,projectId:project.id}}return{reason:AGENT_REASON.NOT_LINKED,message:MISSING_BOTH_MESSAGE}}export{MISSING_BOTH_MESSAGE,resolveScope};
|
|
@@ -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{parseArguments}from"./chunk-
|
|
7
|
+
import{parseArguments}from"./chunk-HUHUQXHY.js";import{require_cli_config}from"./chunk-BRK4OB4B.js";import{__toESM}from"./chunk-6L236MNA.js";var config=__toESM(require_cli_config(),1);import path from"node:path";function getGlobalPathConfig2(argvSlice=process.argv.slice(2),cwd=process.cwd()){let confFlag=parseArguments(argvSlice,{},{permissive:!0}).flags["--global-config"];return confFlag?path.resolve(cwd,confFlag):config.getGlobalPathConfig()}export{getGlobalPathConfig2 as getGlobalPathConfig};
|
|
@@ -4,7 +4,7 @@ import { dirname as __dirname_ } from 'node:path';
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
const __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
const __dirname = __dirname_(__filename);
|
|
7
|
-
import{require_open}from"./chunk-ULLWCOYC.js";import{getTeams}from"./chunk-
|
|
7
|
+
import{require_open}from"./chunk-ULLWCOYC.js";import{getTeams}from"./chunk-Y7SVAW54.js";import{deviceAccessTokenRequest,deviceAuthorizationRequest,isOAuthError,processDeviceAuthorizationResponse,processTokenResponse}from"./chunk-5XJNPXQK.js";import{printError}from"./chunk-AL5JWXZE.js";import{humanizePath}from"./chunk-PPCFQQSU.js";import{getUser}from"./chunk-WSNDO7JA.js";import{getCommandName}from"./chunk-FI772UVH.js";import{emoji,output_manager_default}from"./chunk-RTRCTYW6.js";import{require_ansi_escapes}from"./chunk-7HL2RPUO.js";import{require_source}from"./chunk-U7KCDTCH.js";import{__toESM}from"./chunk-6L236MNA.js";var import_chalk=__toESM(require_source(),1),open=__toESM(require_open(),1),import_ansi_escapes=__toESM(require_ansi_escapes(),1);import readline from"node:readline";import{KNOWN_AGENTS}from"@vercel/detect-agent";async function updateCurrentTeamAfterLogin(client,ssoTeamId){if(ssoTeamId)client.config.currentTeam=ssoTeamId;else{let user=null;try{user=await getUser(client)}catch{return output_manager_default.error("Failed to fetch the logged in user. Please try again."),1}user.version==="northstar"&&user.defaultTeamId?client.config.currentTeam=user.defaultTeamId:delete client.config.currentTeam}}async function performDeviceCodeFlow(client,options){let deviceAuthorizationResponse=await deviceAuthorizationRequest({refresh_token:options?.refreshToken,acr_values:options?.acrValues});output_manager_default.debug(`'Device Authorization response:', ${await deviceAuthorizationResponse.clone().text()}`);let[deviceAuthorizationError,deviceAuthorization]=await processDeviceAuthorizationResponse(deviceAuthorizationResponse);if(deviceAuthorizationError)return options?.fallbackToLoginOnStepUpFailure&&options.refreshToken&&isOAuthError(deviceAuthorizationError)&&(deviceAuthorizationError.code==="invalid_grant"||deviceAuthorizationError.code==="invalid_scope")?(output_manager_default.debug(`Step-up device authorization failed: ${deviceAuthorizationError.cause.message}`),output_manager_default.log("Couldn't refresh the saved login. Starting a new login."),performDeviceCodeFlow(client,options.teamId?{teamId:options.teamId}:void 0)):(printError(isOAuthError(deviceAuthorizationError)?deviceAuthorizationError.cause:deviceAuthorizationError),null);let{device_code,user_code,verification_uri,expiresAt,interval}=deviceAuthorization,{verification_uri_complete}=deviceAuthorization;if(options?.teamId){let url=new URL(verification_uri_complete);url.searchParams.set("team_id",options.teamId),verification_uri_complete=url.toString()}let isCursorAgent=client.agentName===KNOWN_AGENTS.CURSOR||client.agentName===KNOWN_AGENTS.CURSOR_CLI,shouldSkipBrowser=process.env.CI&&!isCursorAgent;if(output_manager_default.log(`
|
|
8
8
|
Visit ${import_chalk.default.bold(output_manager_default.link(verification_uri.replace("https://",""),verification_uri_complete,{color:!1,fallback:()=>verification_uri_complete}))}${output_manager_default.supportsHyperlink?` and enter ${import_chalk.default.bold(user_code)}`:""}
|
|
9
9
|
`),!shouldSkipBrowser)try{(await open.default(verification_uri_complete)).on("error",error=>{output_manager_default.debug(`Failed to open browser: ${error}`)})}catch(error){output_manager_default.debug(`Failed to open browser: ${error}`),client.isAgent&&client.nonInteractive&&(output_manager_default.log(`
|
|
10
10
|
${import_chalk.default.yellow("\u26A0")} ${import_chalk.default.bold("Browser could not be opened automatically.")}
|
|
@@ -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{getGlobalFlagsFromArgs,stripSensitiveAuthArgs,suggestionFlagTakesSeparateValue}from"./chunk-JAJW3P42.js";import{teamCache}from"./chunk-VOZEB6PD.js";import{LinkRequiredError,ProjectNotFound,isAPIError}from"./chunk-CBWDIZAF.js";import{getCommandName,packageName}from"./chunk-FI772UVH.js";import{require_dist}from"./chunk-QGIQK47P.js";import{pkg_default}from"./chunk-AVSPFBLM.js";import{__toESM}from"./chunk-6L236MNA.js";function quoteArg(value){return/^[A-Za-z0-9_./@:-]+$/.test(value)?value:`'${value.replace(/'/g,"'\\''")}'`}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 trackAgentCommandOutcome(client,exitCode){if(!client.isAgent||!client.telemetryEventStore)return;let args=client.argv.slice(2),separator=args.indexOf("--"),help=args.slice(0,separator<0?args.length:separator).some(arg=>arg==="--help"||arg==="-h");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"})})}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{}}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.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=1){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."),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=1){shouldEmitNonInteractiveCommandError(client)&&(writeAgentError(client,payload),process.exit(exitCode))}function writeAgentError(client,payload){let enriched={...getErrorRecovery(payload,client),...payload,...agentErrorMetadata(client)};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{quoteArg,mentionsObservabilityPlus,observabilityPlusPurchaseFix,observabilityPlusRecovery,getErrorRecovery,agentErrorMetadata,trackAgentError,trackAgentCommandOutcome,buildCommandWithYes,redactEnvValueArgs,omitGlobalFlagsFromArgs,buildIntegrationCommandTailFromArgv,buildCommandWithGlobalFlags,withGlobalFlags,getPreservedArgsForEnvAdd,buildEnvAddCommandWithPreservedArgs,getPreservedArgsForEnvPull,getPreservedArgsForEnvRm,buildEnvRmCommandWithPreservedArgs,getPreservedArgsForEnvUpdate,buildEnvUpdateCommandWithPreservedArgs,outputActionRequired,argvHasNonInteractive,shouldEmitNonInteractiveCommandError,outputAgentError,writeAgentError,outputAgentSuccess,exitWithNonInteractiveError,openUrlInBrowserCommand};
|