vercel 64.2.0 → 64.3.1
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-WVK3AP46.js → add-5RV75RPG.js} +1 -1
- package/dist/chunks/{add-UPXURHDI.js → add-RFCYPSPS.js} +1 -1
- package/dist/chunks/{add-IATD2WUV.js → add-UXOTAL3N.js} +1 -1
- package/dist/chunks/{build-JOGD3ZEF.js → build-SE3QLNVF.js} +1 -1
- package/dist/chunks/{chunk-4BS552UW.js → chunk-26Z4U6G4.js} +2 -2
- package/dist/chunks/{chunk-XEQT373M.js → chunk-2B3A3MOX.js} +1 -1
- package/dist/chunks/{chunk-4VEK7DEH.js → chunk-444RE4Z5.js} +1 -1
- package/dist/chunks/{chunk-TY4PMK7Y.js → chunk-6GIP2YPX.js} +1 -1
- package/dist/chunks/{chunk-KLYIX4HK.js → chunk-6HOVHRWJ.js} +3 -3
- package/dist/chunks/chunk-6ZRULOO3.js +7 -0
- package/dist/chunks/{chunk-JGPRCZC2.js → chunk-7GFRZWLE.js} +1 -1
- package/dist/chunks/{chunk-VURCIZKT.js → chunk-A63VVXW2.js} +1 -1
- package/dist/chunks/{chunk-4IIRQJUW.js → chunk-AA434KXY.js} +1 -1
- package/dist/chunks/{chunk-N5D4455C.js → chunk-AALI66ML.js} +1 -1
- package/dist/chunks/{chunk-AKM22FBX.js → chunk-AQUDXMFH.js} +1 -1
- package/dist/chunks/chunk-BAT6SDBJ.js +10 -0
- package/dist/chunks/{chunk-WE3ZJX7P.js → chunk-CMKLX4DC.js} +1 -1
- package/dist/chunks/{chunk-JSBEAHKA.js → chunk-CYV3X62I.js} +1 -1
- package/dist/chunks/{chunk-EO7GUARB.js → chunk-DNDBPLLI.js} +1 -1
- package/dist/chunks/{chunk-UJUNGWSD.js → chunk-DNTQK2SW.js} +1 -1
- package/dist/chunks/{chunk-3GSGG4YR.js → chunk-E6R2QOOR.js} +1 -1
- package/dist/chunks/{chunk-CRQDQNQZ.js → chunk-ELDHGU6N.js} +1 -1
- package/dist/chunks/{chunk-DYQXJCHO.js → chunk-EVQJ7SCV.js} +1 -1
- package/dist/chunks/{chunk-FTY4BCAF.js → chunk-EXPLBM7J.js} +1 -1
- package/dist/chunks/{chunk-YO4VLAB7.js → chunk-FLBI6DY2.js} +1 -1
- package/dist/chunks/{chunk-N6ECEBHG.js → chunk-G2IJOQR3.js} +1 -1
- package/dist/chunks/{chunk-5JEU6QSM.js → chunk-GCSAJUL6.js} +1 -1
- package/dist/chunks/{chunk-OLWE4UFC.js → chunk-GF7EG5IA.js} +1 -1
- package/dist/chunks/{chunk-NBABZO3A.js → chunk-GJP22N6R.js} +1 -1
- package/dist/chunks/{chunk-YDM2PMMP.js → chunk-GLJH35MJ.js} +1 -1
- package/dist/chunks/{chunk-TBLIJ2PS.js → chunk-GNV6PG6W.js} +1 -1
- package/dist/chunks/{chunk-FGNMYSLD.js → chunk-GWZ4VPU3.js} +1 -1
- package/dist/chunks/{chunk-4GL254L4.js → chunk-H3KYG32S.js} +2 -2
- package/dist/chunks/{chunk-EEZLBOSP.js → chunk-H7CRPXOA.js} +4 -4
- package/dist/chunks/{chunk-JEPRHNQU.js → chunk-HJRAWEA2.js} +1 -1
- package/dist/chunks/{chunk-7BOCT55A.js → chunk-HTLGLTKD.js} +2 -2
- package/dist/chunks/{chunk-E6UKNYFF.js → chunk-HVUJNVPS.js} +1 -1
- package/dist/chunks/{chunk-WZ7YJDKT.js → chunk-IIC2A4YN.js} +1 -1
- package/dist/chunks/{chunk-N7Q2IESO.js → chunk-IJCCFLCQ.js} +1 -1
- package/dist/chunks/{chunk-KUGY5FIM.js → chunk-IL7X6EKK.js} +1 -1
- package/dist/chunks/{chunk-XD2LZRBS.js → chunk-IQ7FPAI4.js} +1 -1
- package/dist/chunks/{chunk-J2LAZELI.js → chunk-IVIZLWZQ.js} +1 -1
- package/dist/chunks/{chunk-O7JMHULU.js → chunk-IYCHAIFZ.js} +1 -1
- package/dist/chunks/{chunk-TWKII7HO.js → chunk-JCTXRR4A.js} +1 -1
- package/dist/chunks/{chunk-GSVOI5LW.js → chunk-JV6IPUGX.js} +1 -1
- package/dist/chunks/{chunk-IRJ5XFT2.js → chunk-KGXW36FQ.js} +2 -2
- package/dist/chunks/{chunk-GSOPJJO5.js → chunk-KKCBFBJK.js} +1 -1
- package/dist/chunks/{chunk-WVJYKHGZ.js → chunk-KKQL4AKH.js} +1 -1
- package/dist/chunks/{chunk-JNJOUMGF.js → chunk-KUGXOLL7.js} +1 -1
- package/dist/chunks/{chunk-75IAMKGV.js → chunk-M774HRX5.js} +2 -2
- package/dist/chunks/{chunk-J3CDVZE7.js → chunk-MMPQC2N6.js} +1 -1
- package/dist/chunks/{chunk-PAN6TUTQ.js → chunk-MV4WHUIC.js} +1 -1
- package/dist/chunks/{chunk-SYEKOJHT.js → chunk-MZ3QGJH3.js} +1 -1
- package/dist/chunks/{chunk-QDOYNWNQ.js → chunk-MZLQY2EQ.js} +1 -1
- package/dist/chunks/{chunk-SQB4T5FL.js → chunk-OCOVCC5Q.js} +1 -1
- package/dist/chunks/{chunk-ZUCSA4IW.js → chunk-OJKZ7EV3.js} +1 -1
- package/dist/chunks/{chunk-7C6BXZCV.js → chunk-OUTCLR64.js} +1 -1
- package/dist/chunks/{chunk-3EU7MN5M.js → chunk-QAETJRKX.js} +1 -1
- package/dist/chunks/{chunk-WW4VUFHJ.js → chunk-QC3HEGFD.js} +1 -1
- package/dist/chunks/{chunk-YBOS65VB.js → chunk-QC5AMRWR.js} +1 -1
- package/dist/chunks/{chunk-LLPIBKFX.js → chunk-QCWV7FML.js} +1 -1
- package/dist/chunks/{chunk-XSVF2CZM.js → chunk-TCYAAWLB.js} +1 -1
- package/dist/chunks/{chunk-THZR6O2M.js → chunk-TDDZGUU6.js} +1 -1
- package/dist/chunks/{chunk-4TTF5E5U.js → chunk-U3NQZJQ4.js} +8 -8
- package/dist/chunks/{chunk-X65QKYDM.js → chunk-VRWLNWNE.js} +1 -1
- package/dist/chunks/{chunk-I62UUYTS.js → chunk-VVAZC5IO.js} +1 -1
- package/dist/chunks/{chunk-QL3IYPBV.js → chunk-WGOQGKS5.js} +1 -1
- package/dist/chunks/{chunk-3EYOQC4R.js → chunk-WYI4VNXT.js} +1 -1
- package/dist/chunks/{chunk-SRAC7DI4.js → chunk-XJXX4QXA.js} +1 -1
- package/dist/chunks/{chunk-YIIPBH2D.js → chunk-XSDAUM4F.js} +1 -1
- package/dist/chunks/{chunk-GUJVJKO7.js → chunk-XW4ZWX3I.js} +1 -1
- package/dist/chunks/{chunk-A5R2HHNK.js → chunk-YROIQRYI.js} +1 -1
- package/dist/chunks/{chunk-YP46QVEI.js → chunk-YS542RHZ.js} +1 -1
- package/dist/chunks/{chunk-WIAAACUI.js → chunk-YUYCSDCO.js} +1 -1
- package/dist/chunks/{chunk-HAVEFTOO.js → chunk-ZE53XHAY.js} +1 -1
- package/dist/chunks/{chunk-SGXN7SMU.js → chunk-ZLWTPS5T.js} +1 -1
- package/dist/chunks/{chunk-5UEBA6N6.js → chunk-ZQKDO5PL.js} +1 -1
- package/dist/chunks/{chunk-WPQN5UKR.js → chunk-ZQME5XUJ.js} +1 -1
- package/dist/chunks/{chunk-EF3YL2R7.js → chunk-ZVLDGT4O.js} +1 -1
- package/dist/chunks/{chunk-N7L3XLWC.js → chunk-ZZ3LJ22B.js} +1 -1
- package/dist/chunks/{clear-FNH7KUCF.js → clear-2VHJFFMM.js} +1 -1
- package/dist/chunks/{compile-vercel-config-4LNHE3YV.js → compile-vercel-config-ADKZDUAU.js} +1 -1
- package/dist/chunks/{config-JEHKUQMZ.js → config-6YWGF4CO.js} +1 -1
- package/dist/chunks/{config-W3TVZPSK.js → config-VAOXMKVX.js} +1 -1
- package/dist/chunks/{connect-git-provider-VJYXBRYG.js → connect-git-provider-2JIBL3ST.js} +1 -1
- package/dist/chunks/{delete-HCZA6EVL.js → delete-FEUSV3JO.js} +1 -1
- package/dist/chunks/{delete-LV744KVD.js → delete-YW2NH7VG.js} +1 -1
- package/dist/chunks/{detect-services-TVZ4HYVB.js → detect-services-A2B6KJO5.js} +1 -1
- package/dist/chunks/{disable-N7WZSMD4.js → disable-KA6PS2CZ.js} +1 -1
- package/dist/chunks/{discard-2DN52DNW.js → discard-ZNUPAJTQ.js} +1 -1
- package/dist/chunks/{edit-MGJWXNFV.js → edit-D7VE55ZF.js} +1 -1
- package/dist/chunks/{edit-CALU7PMG.js → edit-YTYYBVZN.js} +1 -1
- package/dist/chunks/{enable-7GKPLJNR.js → enable-Q4OCTJIJ.js} +1 -1
- package/dist/chunks/{exec-QZXH5RXR.js → exec-NMRO6DIZ.js} +2 -2
- package/dist/chunks/{export-BSOJAVDV.js → export-UX6JVWOD.js} +1 -1
- package/dist/chunks/{future-OV5I5HWT.js → future-6UTK4EFE.js} +1 -1
- package/dist/chunks/{generate-cert-for-deploy-GKQRQ3ZQ.js → generate-cert-for-deploy-WDKFR34X.js} +1 -1
- package/dist/chunks/{image-NMQWZBTW.js → image-IL7IN7MD.js} +1 -1
- package/dist/chunks/{import-builders-WLKZNPTB.js → import-builders-FX2XXVRT.js} +1 -1
- package/dist/chunks/{inspect-LZJ5X3PH.js → inspect-E2HPGMNI.js} +1 -1
- package/dist/chunks/{inspect-V7M3GSZ7.js → inspect-F6NLCWHN.js} +1 -1
- package/dist/chunks/{inspect-LF3DIZZ2.js → inspect-UNZR445S.js} +1 -1
- package/dist/chunks/{inspect-PV6VVAN6.js → inspect-UPXTGUJQ.js} +1 -1
- package/dist/chunks/{inspect-UEDFNY5H.js → inspect-YAMAGNIW.js} +1 -1
- package/dist/chunks/{list-AFVTD43R.js → list-FDYB6GHF.js} +1 -1
- package/dist/chunks/{list-64R2DNZA.js → list-G4E6RG3V.js} +1 -1
- package/dist/chunks/{list-QTTCSTZA.js → list-GDI5O246.js} +1 -1
- package/dist/chunks/{login-OS6DZT32.js → login-HU5OFS7T.js} +1 -1
- package/dist/chunks/{login-SKIDVUB7.js → login-XYYNIAMM.js} +1 -1
- package/dist/chunks/{logs-6AXWBF4D.js → logs-EWXTZN4W.js} +1 -1
- package/dist/chunks/{ls-WSPWJDWP.js → ls-3GNX6IPE.js} +1 -1
- package/dist/chunks/{ls-5TZIOB3Q.js → ls-A3HIPTF5.js} +1 -1
- package/dist/chunks/{ls-EADWIBEQ.js → ls-A4NEYMKP.js} +1 -1
- package/dist/chunks/{ls-UP6KDPCD.js → ls-CGZ3NL5R.js} +1 -1
- package/dist/chunks/{ls-723HTK5U.js → ls-MO3R46TQ.js} +1 -1
- package/dist/chunks/{ls-YPQ3CTTN.js → ls-SZKDUJHV.js} +1 -1
- package/dist/chunks/{ls-A5A3APRI.js → ls-TCB7UUPP.js} +1 -1
- package/dist/chunks/{mutate-WHVA5NTT.js → mutate-BQAP2S7A.js} +1 -1
- package/dist/chunks/{notifications-I4PKIOYY.js → notifications-TDSFYYNB.js} +1 -1
- package/dist/chunks/{open-SV3USET3.js → open-YPOEUM3S.js} +1 -1
- package/dist/chunks/{openapi-NZJ6Q5Y2.js → openapi-BQSQNXQE.js} +1 -1
- package/dist/chunks/{permissions-3ZMQVJAQ.js → permissions-6LOJKL5W.js} +1 -1
- package/dist/chunks/{prompt-missing-credentials-44DQQXOI.js → prompt-missing-credentials-IGTCFUA6.js} +1 -1
- package/dist/chunks/{publish-EDLEZCAF.js → publish-CATCXJZG.js} +1 -1
- package/dist/chunks/pull-CXUNHWAO.js +7 -0
- package/dist/chunks/{purchase-domain-if-available-R3YQ2TFP.js → purchase-domain-if-available-4YKWAHH5.js} +1 -1
- package/dist/chunks/{push-6O3JAFDA.js → push-KZZE3AQ3.js} +1 -1
- package/dist/chunks/{query-MYKQOBG3.js → query-GHFOZV7K.js} +1 -1
- package/dist/chunks/{reauthenticate-3UH4WWKC.js → reauthenticate-W7QIXLZ3.js} +1 -1
- package/dist/chunks/{reorder-IU6GZK4H.js → reorder-XU55LOZ5.js} +1 -1
- package/dist/chunks/{reply-FG74YRJ3.js → reply-B2XOCSZD.js} +1 -1
- package/dist/chunks/{resolve-MD3PGOME.js → resolve-H4BZ2QI3.js} +1 -1
- package/dist/chunks/{resolve-agent-team-X6GPGGDR.js → resolve-agent-team-43HZCPF3.js} +1 -1
- package/dist/chunks/{restore-7KOACNT7.js → restore-AJLS2N6C.js} +1 -1
- package/dist/chunks/{rm-JRAF4TPV.js → rm-2TR2KBDP.js} +1 -1
- package/dist/chunks/{rm-SKKBN7LZ.js → rm-IGY6LD6H.js} +1 -1
- package/dist/chunks/{rm-HOE3GJAB.js → rm-N6ZUA66Z.js} +1 -1
- package/dist/chunks/{rm-CSIBWFYG.js → rm-OI5VS7GG.js} +1 -1
- package/dist/chunks/{rm-ZF2F2ZE3.js → rm-ZQUVOC3V.js} +1 -1
- package/dist/chunks/{routes-3RJGIZYJ.js → routes-TCMUHSJF.js} +1 -1
- package/dist/chunks/{rule-inspect-NICYVQPY.js → rule-inspect-NLEABBTP.js} +1 -1
- package/dist/chunks/{rules-NHACEVVC.js → rules-SVLVB6YB.js} +1 -1
- package/dist/chunks/{schema-3XLZGVH5.js → schema-HWS2SOZS.js} +1 -1
- package/dist/chunks/{schema-ZJASGDRI.js → schema-KG4RWQBC.js} +1 -1
- package/dist/chunks/{select-org-XVAGUP4V.js → select-org-AAB5RBSB.js} +1 -1
- package/dist/chunks/{set-JOSIBICX.js → set-AJEMEBZU.js} +1 -1
- package/dist/chunks/setup-and-link-6AIRWXXX.js +7 -0
- package/dist/chunks/{tags-LVP4LVHL.js → tags-O6R6VWPP.js} +1 -1
- package/dist/chunks/{types-YEYQERHE.js → types-Y3NJROKH.js} +1 -1
- package/dist/chunks/{update-HPEVXFST.js → update-C7XR7CHI.js} +1 -1
- package/dist/commands/build/index.js +1 -1
- package/dist/commands/deploy/index.js +4 -4
- package/dist/commands/dev/index.js +2 -2
- 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 +756 -705
- package/dist/index.js +2 -2
- package/dist/internal-build.js +1 -1
- package/dist/root-help-commands.mjs +1 -1
- package/dist/version.mjs +1 -1
- package/package.json +57 -56
- package/dist/chunks/chunk-EKUHN42H.js +0 -7
- package/dist/chunks/chunk-RIDPB64C.js +0 -10
- package/dist/chunks/pull-5DQNSJCA.js +0 -7
- package/dist/chunks/setup-and-link-7GIAMCTM.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{require_dist}from"./chunk-O4FDRZ22.js";import{getDeployment}from"./chunk-
|
|
7
|
+
import{require_dist}from"./chunk-O4FDRZ22.js";import{getDeployment}from"./chunk-IVIZLWZQ.js";import{getScope}from"./chunk-IIC2A4YN.js";import{toNodeReadable}from"./chunk-MY4MONOH.js";import{output_manager_default}from"./chunk-M774HRX5.js";import{require_ansi_escapes}from"./chunk-YHPPP3SF.js";import{__commonJS,__require,__toESM}from"./chunk-BZENIQ7N.js";var require_parser=__commonJS({"../../node_modules/.pnpm/jsonlines@0.1.1/node_modules/jsonlines/lib/parser.js"(exports,module){var Transform=__require("stream").Transform;function Parser(options){if(!(this instanceof Parser))throw new TypeError("Cannot call a class as a function");options=options||{},Transform.call(this,{objectMode:!0}),this._memory="",this._emitInvalidLines=options.emitInvalidLines||!1}Parser.prototype=Object.create(Transform.prototype);Parser.prototype._handleLines=function(lines,cb){for(var i=0;i<lines.length;i++)if(lines[i]!==""){var err=null,json=null;try{json=JSON.parse(lines[i])}catch(_err){_err.source=lines[i],err=_err}if(err)if(this._emitInvalidLines)this.emit("invalid-line",err);else return cb(err);else this.push(json)}cb(null)};Parser.prototype._transform=function(chunk,encoding,cb){var lines=(this._memory+chunk.toString()).split(`
|
|
8
8
|
`);this._memory=lines.pop(),this._handleLines(lines,cb)};Parser.prototype._flush=function(cb){if(!this._memory)return cb(null);var line=this._memory;this._memory="",this._handleLines([line],cb)};module.exports=Parser}});var require_stringifier=__commonJS({"../../node_modules/.pnpm/jsonlines@0.1.1/node_modules/jsonlines/lib/stringifier.js"(exports,module){var Transform=__require("stream").Transform;function Stringifier(){if(!(this instanceof Stringifier))throw new TypeError("Cannot call a class as a function");Transform.call(this,{objectMode:!0})}Stringifier.prototype=Object.create(Transform.prototype);Stringifier.prototype._transform=function(data,_,cb){var value;try{value=JSON.stringify(data)}catch(err){return err.source=data,cb(err)}cb(null,value+`
|
|
9
9
|
`)};module.exports=Stringifier}});var require_jsonlines=__commonJS({"../../node_modules/.pnpm/jsonlines@0.1.1/node_modules/jsonlines/index.js"(exports){var Parser=require_parser(),Stringifier=require_stringifier();exports.parse=function(options){return new Parser(options)};exports.stringify=function(){return new Stringifier}}});var import_async_retry=__toESM(require_dist(),1),import_jsonlines=__toESM(require_jsonlines(),1),import_ansi_escapes=__toESM(require_ansi_escapes(),1);import{URLSearchParams}from"url";async function printEvents(client,urlOrDeploymentId,{mode,onEvent,onAliasAssigned,quiet,findOpts},abortController){let{log,debug}=output_manager_default,scope=mode==="deploy"?await getScope(client):null,o=0;await(0,import_async_retry.default)(async(bail,attemptNumber)=>{if(abortController?.signal.aborted)return;attemptNumber>1&&debug("Retrying events");let query=new URLSearchParams({direction:findOpts.direction,follow:findOpts.follow?"1":"",format:"lines"});findOpts.limit&&query.set("limit",String(findOpts.limit)),findOpts.since&&query.set("since",String(findOpts.since)),findOpts.until&&query.set("until",String(findOpts.until));let eventsUrl=`/v3/now/deployments/${urlOrDeploymentId}/events?${query}`;try{let eventsRes=await client.fetch(eventsUrl,{json:!1,signal:abortController?.signal});if(eventsRes.ok){let readable=toNodeReadable(eventsRes.body);return new Promise((resolve,reject)=>{let stream=readable.pipe(import_jsonlines.default.parse()),poller;mode==="deploy"&&(poller=function startPoller(){return setTimeout(async()=>{try{if((await getDeployment(client,scope.contextName,urlOrDeploymentId)).readyState==="READY"){stream.end(),finish();return}poller=startPoller()}catch(err2){stream.end(),finish(err2)}},5e3)}());let finishCalled=!1;function finish(err2){finishCalled||(finishCalled=!0,clearTimeout(poller),err2?reject(err2):resolve())}let latestLogDate=0,onData=data=>{if(data.type==="alias-assigned"){data.deploymentId===urlOrDeploymentId&&onAliasAssigned?.(data);return}let{event,payload,date}=data;event==="state"&&payload.value==="READY"?mode==="deploy"&&(stream.end(),finish()):(latestLogDate=Math.max(latestLogDate,date),onEvent(data))},onErrorCalled=!1,onError=err2=>{if(finishCalled||onErrorCalled)return;if(err2.name==="AbortError"){finish();return}onErrorCalled=!0,o++;let errorMessage=`Deployment event stream error: ${err2.message}`;if(!findOpts.follow){log(errorMessage);return}debug(errorMessage),clearTimeout(poller),stream.destroy(err2);let retryFindOpts={...findOpts,since:latestLogDate},retryTimeout=setTimeout(()=>{abortController?.signal.removeEventListener("abort",onAbort),!abortController?.signal.aborted&&printEvents(client,urlOrDeploymentId,{mode,onEvent,onAliasAssigned,quiet,findOpts:retryFindOpts},abortController).then(resolve,reject)},2e3);onAliasAssigned&&retryTimeout.unref?.();let onAbort=()=>{clearTimeout(retryTimeout),finish()};abortController?.signal.addEventListener("abort",onAbort,{once:!0})};stream.on("end",finish),stream.on("data",onData),stream.on("error",onError),readable.on("error",onError)})}let err=new Error(`Deployment events status ${eventsRes.status}`);if(eventsRes.status<500)bail(err);else throw err}catch(err){if(err instanceof Error&&err.name==="AbortError")return;throw err}},{retries:4,unref:!!onAliasAssigned,onRetry:err=>{!quiet&&o&&(process.stdout.write((0,import_ansi_escapes.eraseLines)(o+1)),o=0),log(`Deployment events polling error: ${err.message}`)}})}var events_default=printEvents;export{events_default};
|
|
@@ -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-MI7W4QMV.js";import{teamCache}from"./chunk-2VBFQZ72.js";import{LinkRequiredError,ProjectNotFound,isAPIError}from"./chunk-XSDAUM4F.js";import{getCommandName,packageName}from"./chunk-JESNVRVR.js";import{recordCliError}from"./chunk-M774HRX5.js";import{require_dist}from"./chunk-RM3ZDRYE.js";import{pkg_default}from"./chunk-OO572JUC.js";import{__toESM}from"./chunk-BZENIQ7N.js";function quoteArg(value){return/^[A-Za-z0-9_./@:-]+$/.test(value)?value:`'${value.replace(/'/g,"'\\''")}'`}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",AGENT_CANNOT_SWITCH:"agent_cannot_switch",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",PRICE_CHANGED:"price_changed",CONFLICT:"conflict",DOMAIN_NOT_AVAILABLE:"domain_not_available",TLD_NOT_SUPPORTED:"tld_not_supported",PAYMENT_FAILED:"payment_failed",UNKNOWN_OUTCOME:"unknown_outcome",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",SCHEDULE_ALREADY_ACTIVE:"schedule_already_active",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",PLAN_LIMIT:"plan_limit",NOT_TEAM_MEMBER:"not_team_member",INVALID_ROLE_COMBINATION:"invalid_role_combination",TARGET_CONFLICT:"target_conflict",DEPRECATED:"deprecated",LIMIT_CLAMPED:"limit_clamped",METRICS_UNAVAILABLE:"metrics_unavailable",STREAM_GAP:"stream_gap"},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",PRIORITY_PROJECT_ENABLE_COMMAND="project priority enable",BUY_PRO_COMMAND="buy pro",PROJECT_ENABLE_COMMAND="project observability enable";function mentionsObservabilityPlus(message){return/observability\s+plus/i.test(message)}function mentionsPriorityProject(message){return/priority\s+project/i.test(message)||/priority\s+tier/i.test(message)}function observabilityPlusDenialReason(error){if(!error||typeof error!="object"||!("meta"in error))return;let meta=error.meta;if(meta&&typeof meta=="object"&&"reason"in meta&&typeof meta.reason=="string")return meta.reason}function observabilityPlusPurchaseHint(){return`Subscribe with ${getCommandName(OBSERVABILITY_PLUS_PURCHASE_COMMAND)}.`}function isHobbyLikePlan(plan){return plan==="hobby"||plan==="oss"}function isProOrEnterprisePlan(plan){return plan==="pro"||plan==="enterprise"}function currentTeamPlan(client){let id=client?.config?.currentTeam;if(id)return teamCache.get(id)?.billing?.plan}function planForTeam(idOrSlug){return teamCache.get(idOrSlug)?.billing?.plan}function buyProFix(hint){return{command:BUY_PRO_COMMAND,hint:hint??`Upgrade with ${getCommandName(BUY_PRO_COMMAND)}.`,when:"a person has approved upgrading the plan"}}function observabilityPlusPurchaseFix(){return{command:OBSERVABILITY_PLUS_PURCHASE_COMMAND,hint:observabilityPlusPurchaseHint(),when:"a person has approved buying the add-on"}}function inferDenialReason(message){if(/(?:disabled|switched off|re-enable)/i.test(message))return"subscription_disabled";if(/excluded from it|include the project/i.test(message))return"project_excluded";if(/upgrade your plan/i.test(message)&&/pro and enterprise/i.test(message))return"plan_upgrade_required";if(/(?:quota|usage limit|query limit)/i.test(message))return"quota"}function plusNeedsPlanUpgradeHint(){return`Observability Plus is available on Pro and Enterprise. Upgrade with ${getCommandName(BUY_PRO_COMMAND)}. The add-on cannot be purchased on Hobby.`}function observabilityPlusRecovery(message,denialReason,plan){if(mentionsObservabilityPlus(message))switch(denialReason??inferDenialReason(message)){case"subscription_disabled":return{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."};case"project_excluded":return{command:PROJECT_ENABLE_COMMAND,excludeFlags:["--non-interactive","--project","--yes"],hint:`Observability Plus is on for the team, but this project is excluded. Enable it with ${getCommandName(PROJECT_ENABLE_COMMAND)}. A new subscription is not needed.`,preserveProject:!1,when:"a person has approved enabling Observability Plus for this project"};case"plan_upgrade_required":return buyProFix(plusNeedsPlanUpgradeHint());case"quota":return{hint:"The usage limit was reached. Ask a team owner to review the limit before retrying."};default:return isHobbyLikePlan(plan)?buyProFix(plusNeedsPlanUpgradeHint()):{...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 priorityProjectRecovery(message,plan){if(mentionsPriorityProject(message))return isHobbyLikePlan(plan)?buyProFix(`Priority Projects are only available on Pro or Enterprise team plans. Upgrade with ${getCommandName(BUY_PRO_COMMAND)}, then run ${getCommandName(PRIORITY_PROJECT_ENABLE_COMMAND)}.`):{command:PRIORITY_PROJECT_ENABLE_COMMAND,excludeFlags:["--non-interactive","--project","--yes"],hint:getCommandName(PRIORITY_PROJECT_ENABLE_COMMAND),preserveProject:!1,when:"user runs this command in an interactive terminal"}}function observabilityPlanRecovery(message,denialReason,plan){return priorityProjectRecovery(message,plan)??observabilityPlusRecovery(message,denialReason,plan)}var PROJECT_POSITIONAL_COMMANDS=new Set([PRIORITY_PROJECT_ENABLE_COMMAND,PROJECT_ENABLE_COMMAND]);function currentTeamScope(client){let id=client?.config?.currentTeam;if(id)return teamCache.get(id)?.slug??id}function targetRecovery(fix,target){if(!fix)return;let targeted=command=>{let out=command;return target.projectName&&PROJECT_POSITIONAL_COMMANDS.has(command)&&(out+=` ${quoteArg(target.projectName)}`),target.scope&&(out+=` --scope ${quoteArg(target.scope)}`),out},hint=fix.hint;for(let command of[BUY_PRO_COMMAND,OBSERVABILITY_PLUS_PURCHASE_COMMAND,PRIORITY_PROJECT_ENABLE_COMMAND,PROJECT_ENABLE_COMMAND])hint=hint.split(getCommandName(command)).join(getCommandName(targeted(command)));if(!fix.command)return{...fix,hint};let excludeFlags=new Set(fix.excludeFlags??[]),preserveProject=fix.preserveProject;return target.projectName&&PROJECT_POSITIONAL_COMMANDS.has(fix.command)&&(excludeFlags.add("--project"),preserveProject=!1),fix.command===BUY_PRO_COMMAND&&excludeFlags.add("--project"),target.scope&&(excludeFlags.add("--scope"),excludeFlags.add("--team")),{...fix,command:targeted(fix.command),hint,...excludeFlags.size?{excludeFlags:Array.from(excludeFlags)}:{},...preserveProject!==void 0?{preserveProject}:{}}}function clientObservabilityPlanRecovery(client,error,message,projectName,scope){return targetRecovery(observabilityPlanRecovery(message,observabilityPlusDenialReason(error),scope?planForTeam(scope):currentTeamPlan(client)),{projectName,scope:scope??currentTeamScope(client)})}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:observabilityPlanRecovery(message,observabilityPlusDenialReason(error),currentTeamPlan(client))?.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=[],linkCommand=buildCommandWithGlobalFlags(argv,"link",packageName,{preserveProject:!0,excludeFlags:["--scope","--team"]});for(let choice of payload.choices){let slug=choice.name;next.push({command:`${linkCommand} --scope ${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{quoteArg,AGENT_STATUS,AGENT_REASON,getExitCodeForReason,AGENT_ACTION,PRIORITY_PROJECT_ENABLE_COMMAND,BUY_PRO_COMMAND,isProOrEnterprisePlan,buyProFix,targetRecovery,clientObservabilityPlanRecovery,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{require_dist}from"./chunk-
|
|
7
|
+
import{require_dist}from"./chunk-KUGXOLL7.js";import{forceOption,formatOption,jsonOption,projectOption,yesOption}from"./chunk-MI7W4QMV.js";import{packageName,require_lib}from"./chunk-JESNVRVR.js";import{__toESM}from"./chunk-BZENIQ7N.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,description:"Specify the output format (json, including readable Environment Variable values)"},{...jsonOption,description:"Output as JSON, including readable Environment Variable values"},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 remove <name>`,`${packageName} env remove API_TOKEN`]},{name:"Remove a variable from a specific Environment",value:[`${packageName} env remove <name> ${targetPlaceholder}`,`${packageName} env remove NPM_RC preview`]},{name:"Remove a variable from a specific Environment and Git Branch",value:[`${packageName} env remove <name> ${targetPlaceholder} <gitbranch>`,`${packageName} env remove NPM_RC preview feat1`]}]},pullSubcommand={name:"pull",aliases:[],description:"Pull Environment Variables into a local file (default: .env.local)",arguments:[{name:"filename",required:!1}],options:[projectOption,{name:"environment",description:"Select the environment to pull (default: development)",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 overwriting an existing file"}],examples:[{name:"Pull Development Environment Variables into a custom file (check .gitignore)",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{STANDARD_ENVIRONMENTS}from"./chunk-
|
|
7
|
+
import{STANDARD_ENVIRONMENTS}from"./chunk-WYI4VNXT.js";import{require_lib}from"./chunk-JESNVRVR.js";import{output_manager_default}from"./chunk-M774HRX5.js";import{require_source}from"./chunk-NB2WLB3J.js";import{__toESM}from"./chunk-BZENIQ7N.js";var import_chalk=__toESM(require_source(),1);var import_title=__toESM(require_lib(),1);function formatEnvironment(orgSlug,projectSlug,environment){let projectUrl=`https://vercel.com/${orgSlug}/${projectSlug}`,boldName=import_chalk.default.bold(STANDARD_ENVIRONMENTS.includes(environment.slug)?(0,import_title.default)(environment.slug):environment.slug);return output_manager_default.link(boldName,`${projectUrl}/settings/environments/${environment.slug}`,{fallback:()=>boldName,color:!1})}export{formatEnvironment};
|
|
@@ -4,4 +4,4 @@ import { dirname as __dirname_ } from 'node:path';
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
const __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
const __dirname = __dirname_(__filename);
|
|
7
|
-
import{getCommandName}from"./chunk-JESNVRVR.js";import{output_manager_default}from"./chunk-
|
|
7
|
+
import{getCommandName}from"./chunk-JESNVRVR.js";import{output_manager_default}from"./chunk-M774HRX5.js";import{require_source}from"./chunk-NB2WLB3J.js";import{__toESM}from"./chunk-BZENIQ7N.js";var import_chalk=__toESM(require_source(),1);function validateLsArgs(options){let{commandName,args,maxArgs=0,exitCode=1,usageString}=options;if(args.length>maxArgs){let usage=usageString||getCommandName(commandName);return output_manager_default.error(`Invalid number of arguments. Usage: ${import_chalk.default.cyan(usage)}`),exitCode}return 0}export{validateLsArgs};
|