vercel 64.0.2 → 64.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/dist/chunks/{add-XUNOIBOU.js → add-GEAC4RAQ.js} +1 -1
- package/dist/chunks/{add-FZLHLH56.js → add-JH6ALI3H.js} +1 -1
- package/dist/chunks/{add-BXOEELS6.js → add-XZJ4G2MM.js} +1 -1
- package/dist/chunks/{build-PCEPD6N5.js → build-3T6EUCCK.js} +1 -1
- package/dist/chunks/{chunk-VYC3AMWW.js → chunk-4ZICRXI5.js} +1 -1
- package/dist/chunks/{chunk-ZEQLYYUJ.js → chunk-5VWJIYJE.js} +1 -1
- package/dist/chunks/{chunk-BZ3YIITB.js → chunk-67NNB6S6.js} +1 -1
- package/dist/chunks/{chunk-OAOSM4JQ.js → chunk-7YRPMVZK.js} +1 -1
- package/dist/chunks/{chunk-GNKUINRV.js → chunk-AR5T62PK.js} +1 -1
- package/dist/chunks/{chunk-QADFMDEL.js → chunk-BAJDLMZS.js} +1 -1
- package/dist/chunks/chunk-CSIUJLB7.js +9 -0
- package/dist/chunks/{chunk-4R32LMIV.js → chunk-DW3TSGVC.js} +1 -1
- package/dist/chunks/{chunk-HKHQBR4Y.js → chunk-ELI3L2UX.js} +1 -1
- package/dist/chunks/chunk-FBJWLH2A.js +8 -0
- package/dist/chunks/chunk-FLQJAP2A.js +14 -0
- package/dist/chunks/{chunk-RG4ARRCN.js → chunk-FWFTX2WE.js} +1 -1
- package/dist/chunks/{chunk-Z6HYEIYV.js → chunk-HAVEFTOO.js} +1 -1
- package/dist/chunks/{chunk-RNF5CSW6.js → chunk-IDGWQE4B.js} +1 -1
- package/dist/chunks/{chunk-ZV2YYRGF.js → chunk-J53D7SLS.js} +1 -1
- package/dist/chunks/{chunk-IUF3I4BN.js → chunk-JAQM6UXY.js} +1 -1
- package/dist/chunks/chunk-JEPRHNQU.js +7 -0
- package/dist/chunks/{chunk-S2JJZDW6.js → chunk-JESE5FPO.js} +1 -1
- package/dist/chunks/{chunk-FECLYNNO.js → chunk-JJSDRKX4.js} +2 -2
- package/dist/chunks/{chunk-TNZMCRAP.js → chunk-JNJOUMGF.js} +1 -1
- package/dist/chunks/{chunk-7C2QFD5D.js → chunk-KAJM2NEI.js} +1 -1
- package/dist/chunks/{chunk-K6BJ5GVA.js → chunk-KELSPU2J.js} +2 -2
- package/dist/chunks/{chunk-CNU4T7FO.js → chunk-M7GT3ZPT.js} +1 -1
- package/dist/chunks/{chunk-MYX5A5KF.js → chunk-MFIVZXHH.js} +1 -1
- package/dist/chunks/{chunk-FO7MV3VE.js → chunk-NJINP2WU.js} +1 -1
- package/dist/chunks/{chunk-YYPNUQDI.js → chunk-NWGBDBZI.js} +1 -1
- package/dist/chunks/{chunk-OIB6INSE.js → chunk-OGCVOINQ.js} +1 -1
- package/dist/chunks/{chunk-I3D36ZLJ.js → chunk-OJZEOWK2.js} +1 -1
- package/dist/chunks/{chunk-KLH6NMWT.js → chunk-PJMVU4JC.js} +2 -2
- package/dist/chunks/{chunk-WJ5GXTPJ.js → chunk-R5K37TXM.js} +1 -1
- package/dist/chunks/{chunk-34ZJMN36.js → chunk-RFEREQPS.js} +1 -1
- package/dist/chunks/{chunk-YCQFJOHY.js → chunk-SD757OFS.js} +5 -2
- package/dist/chunks/{chunk-ZYTRVEE3.js → chunk-THSHYFA6.js} +1 -1
- package/dist/chunks/{chunk-X33ZHJ45.js → chunk-UBKETNGO.js} +1 -1
- package/dist/chunks/{chunk-RELWXDML.js → chunk-UDQYOGSQ.js} +1 -1
- package/dist/chunks/{chunk-6LXX5P3A.js → chunk-VM6TZGLE.js} +1 -1
- package/dist/chunks/{chunk-P2DETVWN.js → chunk-VRWPRZJY.js} +1 -1
- package/dist/chunks/{chunk-P4YB5FAK.js → chunk-WLK5BBNP.js} +1 -1
- package/dist/chunks/{chunk-GHVWBHMT.js → chunk-WQIGKVBV.js} +1 -1
- package/dist/chunks/{chunk-KLZZRZPR.js → chunk-XXDVZWWM.js} +1 -1
- package/dist/chunks/{chunk-4CDUQXUK.js → chunk-YCXZZSW6.js} +1 -1
- package/dist/chunks/{chunk-TYTNF34C.js → chunk-YI5G2A3V.js} +1 -1
- package/dist/chunks/{chunk-Q7CITIB3.js → chunk-YNIW7DTL.js} +1 -1
- package/dist/chunks/{chunk-BDFUWXIX.js → chunk-Z6UFAIEX.js} +1 -1
- package/dist/chunks/{chunk-TMMEVR3B.js → chunk-ZKDWPKO2.js} +1 -1
- package/dist/chunks/{chunk-IVSKWN3O.js → chunk-ZMBDYOVN.js} +1 -1
- package/dist/chunks/{clear-MO5T5MPM.js → clear-XCZCETRU.js} +1 -1
- package/dist/chunks/{compile-vercel-config-PB3PBGGE.js → compile-vercel-config-NQKOGOPH.js} +1 -1
- package/dist/chunks/{config-63EI73DZ.js → config-CIM647OM.js} +1 -1
- package/dist/chunks/{config-KZTDW2QM.js → config-P42IQJDF.js} +1 -1
- package/dist/chunks/{delete-UB32CPKH.js → delete-KJMVCQ7C.js} +1 -1
- package/dist/chunks/{delete-2UDSDSP4.js → delete-MVJ3NENU.js} +1 -1
- package/dist/chunks/{detect-services-WGEJOZNA.js → detect-services-UYQZT6MU.js} +1 -1
- package/dist/chunks/{disable-JIJU4GNV.js → disable-666GPFHE.js} +1 -1
- package/dist/chunks/{discard-O65PEVZT.js → discard-RUQPJMOG.js} +1 -1
- package/dist/chunks/{edit-KWWBA2X3.js → edit-IIM7GKC2.js} +1 -1
- package/dist/chunks/{edit-L4FF6DXN.js → edit-NRJCMP4B.js} +1 -1
- package/dist/chunks/{enable-S62D7E5S.js → enable-FVXIP7NX.js} +1 -1
- package/dist/chunks/{export-OZ4RCU45.js → export-VPGLK5KL.js} +1 -1
- package/dist/chunks/{generate-cert-for-deploy-S5NMGXYT.js → generate-cert-for-deploy-MWXVKKFQ.js} +1 -1
- package/dist/chunks/{image-OFC55KW4.js → image-URNV2ABR.js} +1 -1
- package/dist/chunks/{import-builders-QHBL27W6.js → import-builders-FC5ESQ34.js} +1 -1
- package/dist/chunks/{inspect-XP5PASNY.js → inspect-6KZERH2F.js} +1 -1
- package/dist/chunks/{inspect-WCNQQI76.js → inspect-G5NDWTDB.js} +1 -1
- package/dist/chunks/{inspect-35NUO5W2.js → inspect-LYGYBYV3.js} +1 -1
- package/dist/chunks/{inspect-BNXHORO6.js → inspect-OBNVJRYC.js} +1 -1
- package/dist/chunks/{inspect-IXITCFX4.js → inspect-P4XEVJW5.js} +1 -1
- package/dist/chunks/{list-OQOQNY3M.js → list-5YBZG374.js} +1 -1
- package/dist/chunks/{list-5FOC7RBS.js → list-AV5CMKBK.js} +1 -1
- package/dist/chunks/{list-NJ42HMZJ.js → list-ICJMKLOR.js} +1 -1
- package/dist/chunks/{login-LGUJR7CK.js → login-5VKAY2R5.js} +1 -1
- package/dist/chunks/{login-X7K2C7IO.js → login-SUBW6IFU.js} +1 -1
- package/dist/chunks/{logs-EH3XT4WK.js → logs-BJL37R5U.js} +1 -1
- package/dist/chunks/{ls-GG4RSGA4.js → ls-3Y2X26EY.js} +1 -1
- package/dist/chunks/{ls-MCI6TODA.js → ls-AKUJ4VUV.js} +1 -1
- package/dist/chunks/{ls-5SSERJCY.js → ls-EJ4THXVR.js} +1 -1
- package/dist/chunks/{ls-EYG5GFIX.js → ls-QGJPVPLK.js} +1 -1
- package/dist/chunks/{ls-72Y3CWNF.js → ls-SOTQGCPD.js} +1 -1
- package/dist/chunks/{ls-3M5GSH6T.js → ls-TXKT6RCY.js} +1 -1
- package/dist/chunks/{ls-D66KXCEQ.js → ls-VEWJPLJC.js} +1 -1
- package/dist/chunks/{mutate-VM3WSWZD.js → mutate-Y4KO4NAJ.js} +1 -1
- package/dist/chunks/{notifications-T4QZSK34.js → notifications-J3SMCQX5.js} +1 -1
- package/dist/chunks/{open-2TSWF7N6.js → open-COGMMSHS.js} +1 -1
- package/dist/chunks/{openapi-UYT3A457.js → openapi-TP6GEZGZ.js} +1 -1
- package/dist/chunks/{permissions-IAM4KOAB.js → permissions-43WFISAY.js} +1 -1
- package/dist/chunks/{prompt-missing-credentials-C2JLCS3F.js → prompt-missing-credentials-5AQVXSFB.js} +1 -1
- package/dist/chunks/{publish-E5CQKZV2.js → publish-4NSLHSHF.js} +1 -1
- package/dist/chunks/{pull-FCIBUMPR.js → pull-MS2PVQUV.js} +1 -1
- package/dist/chunks/{purchase-domain-if-available-LDWR2G45.js → purchase-domain-if-available-S43PVX5Y.js} +1 -1
- package/dist/chunks/{push-ZWGOHNYH.js → push-2NBXVOX2.js} +1 -1
- package/dist/chunks/{query-LYHMXYRT.js → query-DI4FF2ZM.js} +1 -1
- package/dist/chunks/{reorder-2ZHAHZTI.js → reorder-P4AXRPMF.js} +1 -1
- package/dist/chunks/{reply-6WH2VCFF.js → reply-ULZRH7KA.js} +1 -1
- package/dist/chunks/{resolve-RRLE67FD.js → resolve-3IS44LUW.js} +1 -1
- package/dist/chunks/{resolve-agent-team-ESQPBTIE.js → resolve-agent-team-DDBPICVE.js} +1 -1
- package/dist/chunks/{restore-3WU5FYUK.js → restore-WM4EZHD4.js} +1 -1
- package/dist/chunks/{rm-27VKBKTH.js → rm-4XX3UUUF.js} +1 -1
- package/dist/chunks/{rm-ZN3VHILG.js → rm-53YK7N2N.js} +1 -1
- package/dist/chunks/{rm-C6VVMUCP.js → rm-7Z6GJ4O2.js} +1 -1
- package/dist/chunks/{rm-CAPJK4ND.js → rm-C455A2EH.js} +1 -1
- package/dist/chunks/{rm-3T2RJ37B.js → rm-TRMBM6DD.js} +1 -1
- package/dist/chunks/{routes-PKCKZ5T6.js → routes-3RJGIZYJ.js} +1 -1
- package/dist/chunks/{rule-inspect-3XXNK2ON.js → rule-inspect-FMZTPH3S.js} +1 -1
- package/dist/chunks/rules-K7XMFMXG.js +7 -0
- package/dist/chunks/{schema-GAUOV4YT.js → schema-5R44NJNE.js} +2 -2
- package/dist/chunks/{schema-XKLWHSSQ.js → schema-PQZAACV2.js} +1 -1
- package/dist/chunks/{set-6UUR4ZX2.js → set-SZPCOILW.js} +1 -1
- package/dist/chunks/{setup-and-link-MCBSB4BW.js → setup-and-link-OAS7PYL6.js} +1 -1
- package/dist/chunks/{tags-Z45CQGA6.js → tags-YS7EQDJY.js} +1 -1
- package/dist/chunks/{update-BPLPDZSK.js → update-QVYTOT35.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 +686 -679
- package/dist/index.js +2 -5
- package/dist/internal-build.js +1 -1
- package/dist/root-help-commands.mjs +1 -1
- package/dist/version.mjs +1 -1
- package/package.json +56 -56
- package/dist/chunks/chunk-3CTSLNNG.js +0 -8
- package/dist/chunks/chunk-LU5O3NH7.js +0 -9
- package/dist/chunks/chunk-OKFDH3WB.js +0 -12
- package/dist/chunks/rules-ZJW64O5H.js +0 -7
package/README.md
CHANGED
|
@@ -53,6 +53,8 @@ At this point you can make modifications to the CLI source code and test them ou
|
|
|
53
53
|
cd packages/cli
|
|
54
54
|
```
|
|
55
55
|
|
|
56
|
+
Before you add or rename a command, flag, or output, read [AGENTS.md](AGENTS.md) and the CLI design system in [`.agents/skills/cli-ux`](.agents/skills/cli-ux/SKILL.md).
|
|
57
|
+
|
|
56
58
|
### `pnpm vercel <cli-commands...>`
|
|
57
59
|
|
|
58
60
|
From within the `packages/cli` directory, you can use the "vercel" script to quickly execute Vercel CLI from its TypeScript source code directly (without having to manually compile first). For example:
|
|
@@ -4,5 +4,5 @@ import { dirname as __dirname_ } from 'node:path';
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
const __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
const __dirname = __dirname_(__filename);
|
|
7
|
-
import{parseTeamRefs,teamRefBody}from"./chunk-LSF7FY6X.js";import{repositoryPermissionsPath}from"./chunk-DFVNL5ML.js";import{emitVcrArgParseError,resolveVcrScope,validateVcrJsonOutput}from"./chunk-
|
|
7
|
+
import{parseTeamRefs,teamRefBody}from"./chunk-LSF7FY6X.js";import{repositoryPermissionsPath}from"./chunk-DFVNL5ML.js";import{emitVcrArgParseError,resolveVcrScope,validateVcrJsonOutput}from"./chunk-YCXZZSW6.js";import{outputError}from"./chunk-5UEBA6N6.js";import{require_async_sema}from"./chunk-NZ2TFADV.js";import"./chunk-GSOPJJO5.js";import{permissionsAddSubcommand}from"./chunk-AU42HSQ3.js";import"./chunk-FBYA6LLM.js";import"./chunk-SCV7XEEO.js";import{printError}from"./chunk-OZ47SVXA.js";import"./chunk-D4MW3RDW.js";import"./chunk-J53D7SLS.js";import"./chunk-FIIHB66A.js";import"./chunk-VKXEOL4K.js";import"./chunk-MXTC4ZAQ.js";import"./chunk-4SAVH3H7.js";import"./chunk-ZS2WS4AM.js";import"./chunk-AOWWC6WZ.js";import"./chunk-MY4MONOH.js";import{parseArguments}from"./chunk-Z4OH72VZ.js";import{AGENT_REASON,buildCommandWithGlobalFlags,outputAgentError}from"./chunk-FZIRYAXC.js";import{getFlagsSpecification}from"./chunk-5IPBCD7K.js";import"./chunk-KELSPU2J.js";import"./chunk-ROPQIBWJ.js";import"./chunk-VKPZP4LC.js";import"./chunk-PPCFQQSU.js";import"./chunk-N7Q2IESO.js";import"./chunk-WPQN5UKR.js";import"./chunk-2VBFQZ72.js";import{isAPIError}from"./chunk-YIIPBH2D.js";import{packageName}from"./chunk-JESNVRVR.js";import{output_manager_default}from"./chunk-75IAMKGV.js";import"./chunk-RM3ZDRYE.js";import"./chunk-OO572JUC.js";import"./chunk-D3AHZ5LI.js";import"./chunk-2GHZGOWT.js";import"./chunk-YHPPP3SF.js";import"./chunk-NB2WLB3J.js";import"./chunk-ISWW3DKF.js";import"./chunk-BRQUZ5NC.js";import{__toESM}from"./chunk-BZENIQ7N.js";var import_async_sema=__toESM(require_async_sema(),1);var USAGE="vcr permissions <repository> add <team>[,<team>...]";async function add(client,argv,telemetry){let parsedArgs;try{parsedArgs=parseArguments(argv,getFlagsSpecification(permissionsAddSubcommand.options))}catch(err){return emitVcrArgParseError(client,err,USAGE),printError(err),2}let fr=validateVcrJsonOutput(client,parsedArgs.flags);if(typeof fr=="number")return fr;let repository=parsedArgs.args[0],teamRefs=parseTeamRefs(parsedArgs.args.slice(2)),project=parsedArgs.flags["--project"];if(telemetry.trackCliOptionProject(project),telemetry.trackCliOptionFormat(parsedArgs.flags["--format"]),teamRefs.length===0)return outputAgentError(client,{status:"error",reason:AGENT_REASON.MISSING_ARGUMENTS,message:`Missing team. Example: ${packageName} vcr permissions ${repository} add team_1a2b3c4d`,next:[{command:buildCommandWithGlobalFlags(client.argv,USAGE),when:"Replace <team> with a team id or slug (comma-separate multiple teams)"}]},2),outputError(client,fr.jsonOutput,"MISSING_ARGUMENTS",`Usage: \`vercel ${USAGE}\``);let scope=await resolveVcrScope(client,{project,jsonOutput:fr.jsonOutput});if(typeof scope=="number")return scope;let path=repositoryPermissionsPath(scope,repository),added=[],failed=[];output_manager_default.spinner(`Sharing ${repository} with ${teamRefs.length===1?teamRefs[0]:`${teamRefs.length} teams`}...`);let sema=new import_async_sema.default(10),results;try{results=await Promise.all(teamRefs.map(async team=>{await sema.acquire();try{let result=await client.fetch(path,{method:"POST",body:teamRefBody(team)});return{ok:!0,team,permission:result.permission}}catch(err){if(!isAPIError(err))throw err;let message=err.serverMessage||`API error (${err.status}).`;return{ok:!1,team,failure:{team,code:err.code||"API_ERROR",message}}}finally{sema.release()}}))}finally{output_manager_default.stopSpinner()}for(let result of results)result.ok?(added.push(result.permission),fr.jsonOutput||output_manager_default.success(`Shared ${repository} with ${result.permission?.teamSlug??result.team}`)):(failed.push(result.failure),fr.jsonOutput||output_manager_default.error(`Failed to share ${repository} with ${result.team}: ${result.failure.message}`));return failed.length>0&&outputAgentError(client,{status:"error",reason:AGENT_REASON.API_ERROR,message:`Failed to share ${repository} with ${failed.map(f=>`${f.team} (${f.message})`).join(", ")}`},1),fr.jsonOutput&&client.stdout.write(`${JSON.stringify({permissions:added,failed},null,2)}
|
|
8
8
|
`),failed.length>0?1:0}export{add as default};
|
|
@@ -4,5 +4,5 @@ import { dirname as __dirname_ } from 'node:path';
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
const __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
const __dirname = __dirname_(__filename);
|
|
7
|
-
import{printRuleMutationReceipt}from"./chunk-MJD6WHG4.js";import"./chunk-RRWEIG6B.js";import{emitRulesArgParseError,getBodyType,handleRulesApiError,outputRulesError,readRuleBody,resolveRulesProject,resolveRulesTeam,rulesCollectionPath}from"./chunk-
|
|
7
|
+
import{printRuleMutationReceipt}from"./chunk-MJD6WHG4.js";import"./chunk-RRWEIG6B.js";import{emitRulesArgParseError,getBodyType,handleRulesApiError,outputRulesError,readRuleBody,resolveRulesProject,resolveRulesTeam,rulesCollectionPath}from"./chunk-YNIW7DTL.js";import"./chunk-UDQYOGSQ.js";import"./chunk-YTDK6AHS.js";import"./chunk-GZNDA6SV.js";import"./chunk-5UEBA6N6.js";import"./chunk-GHAY4PSD.js";import"./chunk-PJMVU4JC.js";import"./chunk-O4FDRZ22.js";import"./chunk-T3GQAMBJ.js";import"./chunk-P2O5DOYE.js";import"./chunk-ID663OJ7.js";import{rulesAddSubcommand}from"./chunk-CSIUJLB7.js";import"./chunk-773GOZIR.js";import{printError}from"./chunk-OZ47SVXA.js";import"./chunk-67GZ5REA.js";import"./chunk-BS32OUOC.js";import{validateJsonOutput}from"./chunk-D4MW3RDW.js";import"./chunk-J53D7SLS.js";import"./chunk-FIIHB66A.js";import"./chunk-VKXEOL4K.js";import"./chunk-MXTC4ZAQ.js";import"./chunk-4SAVH3H7.js";import"./chunk-ZS2WS4AM.js";import"./chunk-AOWWC6WZ.js";import"./chunk-MY4MONOH.js";import{parseArguments}from"./chunk-Z4OH72VZ.js";import"./chunk-FZIRYAXC.js";import{getFlagsSpecification}from"./chunk-5IPBCD7K.js";import"./chunk-KELSPU2J.js";import"./chunk-ROPQIBWJ.js";import"./chunk-VKPZP4LC.js";import"./chunk-PPCFQQSU.js";import"./chunk-N7Q2IESO.js";import"./chunk-WPQN5UKR.js";import"./chunk-2VBFQZ72.js";import{isAPIError}from"./chunk-YIIPBH2D.js";import"./chunk-JESNVRVR.js";import{output_manager_default}from"./chunk-75IAMKGV.js";import"./chunk-RM3ZDRYE.js";import"./chunk-OO572JUC.js";import"./chunk-D3AHZ5LI.js";import"./chunk-2GHZGOWT.js";import"./chunk-YHPPP3SF.js";import"./chunk-NB2WLB3J.js";import"./chunk-ISWW3DKF.js";import"./chunk-BRQUZ5NC.js";import"./chunk-BZENIQ7N.js";function applyScopeFlag(client,body,type,scope,flags,jsonOutput){if(Object.hasOwn(body,"ruleScope"))return flags["--project"]||flags["--all"]?outputRulesError(client,jsonOutput,"SCOPE_CONFLICT","Specify rule scope either in the body or with --project/--all, not both."):void 0;if(flags["--project"]){body.ruleScope=type==="custom"?{type:"project",projectId:scope.projectId}:{type:"include",projectIds:[scope.projectId]};return}if(flags["--all"]){if(type==="custom")return outputRulesError(client,jsonOutput,"INVALID_SCOPE","Custom alert rules must target one project. Use --project <name-or-id>.");body.ruleScope={type:"all"};return}return outputRulesError(client,jsonOutput,"MISSING_SCOPE","Missing rule scope. Add ruleScope to the body, or pass --project or --all.")}async function resolveCreateScope(client,flags,jsonOutput){return flags["--project"]&&flags["--all"]?outputRulesError(client,jsonOutput,"MUTUAL_EXCLUSIVITY","Cannot specify both --all and --project. Use one or the other."):flags["--project"]?resolveRulesProject(client,flags["--project"],jsonOutput,"alerts rules add"):resolveRulesTeam(client,jsonOutput)}async function add(client,argv){let parsedArgs;try{parsedArgs=parseArguments(argv,getFlagsSpecification(rulesAddSubcommand.options))}catch(error){return emitRulesArgParseError(client,error,"alerts rules add --project <name-or-id> --body <path>"),printError(error),2}let flags=parsedArgs.flags,format=validateJsonOutput(flags);if(!format.valid)return outputRulesError(client,!1,"INVALID_ARGUMENTS",format.error);if(!flags["--body"])return outputRulesError(client,format.jsonOutput,"MISSING_ARGUMENTS","Missing required flag: --body <PATH>.");let body=readRuleBody(client,flags["--body"],format.jsonOutput);if(typeof body=="number")return body;let type=getBodyType(body);if(!type)return outputRulesError(client,format.jsonOutput,"INVALID_RULE_TYPE","Create body must set a supported rule type.");if(Object.hasOwn(body,"ruleScope")&&(flags["--project"]||flags["--all"]))return outputRulesError(client,format.jsonOutput,"SCOPE_CONFLICT","Specify rule scope either in the body or with --project/--all, not both.");if(type==="custom"&&flags["--all"])return outputRulesError(client,format.jsonOutput,"INVALID_SCOPE","Custom alert rules must target one project. Use --project <name-or-id>.");let scope=await resolveCreateScope(client,flags,format.jsonOutput);if(typeof scope=="number")return scope;let scopeError=applyScopeFlag(client,body,type,scope,flags,format.jsonOutput);if(scopeError!==void 0)return scopeError;output_manager_default.spinner("Creating alert rule\u2026");try{let response=await client.fetch(rulesCollectionPath(scope.teamId),{method:"POST",body});return format.jsonOutput?client.stdout.write(`${JSON.stringify(response,null,2)}
|
|
8
8
|
`):printRuleMutationReceipt("Created",response.rule,client.argv),0}catch(error){if(isAPIError(error))return handleRulesApiError(client,error,format.jsonOutput);throw error}finally{output_manager_default.stopSpinner()}}export{add as default};
|
|
@@ -4,5 +4,5 @@ import { dirname as __dirname_ } from 'node:path';
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
const __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
const __dirname = __dirname_(__filename);
|
|
7
|
-
import{emitVcrArgParseError,handleVcrApiError,resolveVcrScope,validateVcrJsonOutput}from"./chunk-
|
|
7
|
+
import{emitVcrArgParseError,handleVcrApiError,resolveVcrScope,validateVcrJsonOutput}from"./chunk-YCXZZSW6.js";import{outputError}from"./chunk-5UEBA6N6.js";import"./chunk-GSOPJJO5.js";import{addSubcommand}from"./chunk-RZGWCQP7.js";import"./chunk-AG5QQNJ3.js";import"./chunk-AU42HSQ3.js";import"./chunk-L5FUUGYX.js";import"./chunk-FBYA6LLM.js";import"./chunk-SCV7XEEO.js";import{printError}from"./chunk-OZ47SVXA.js";import"./chunk-D4MW3RDW.js";import"./chunk-J53D7SLS.js";import"./chunk-FIIHB66A.js";import"./chunk-VKXEOL4K.js";import"./chunk-MXTC4ZAQ.js";import"./chunk-4SAVH3H7.js";import"./chunk-ZS2WS4AM.js";import"./chunk-AOWWC6WZ.js";import"./chunk-MY4MONOH.js";import{parseArguments}from"./chunk-Z4OH72VZ.js";import{AGENT_REASON,buildCommandWithGlobalFlags,outputAgentError}from"./chunk-FZIRYAXC.js";import{getFlagsSpecification}from"./chunk-5IPBCD7K.js";import"./chunk-KELSPU2J.js";import"./chunk-ROPQIBWJ.js";import"./chunk-VKPZP4LC.js";import"./chunk-PPCFQQSU.js";import"./chunk-N7Q2IESO.js";import"./chunk-WPQN5UKR.js";import"./chunk-2VBFQZ72.js";import{isAPIError}from"./chunk-YIIPBH2D.js";import{packageName}from"./chunk-JESNVRVR.js";import{output_manager_default}from"./chunk-75IAMKGV.js";import"./chunk-RM3ZDRYE.js";import"./chunk-OO572JUC.js";import"./chunk-D3AHZ5LI.js";import"./chunk-2GHZGOWT.js";import"./chunk-YHPPP3SF.js";import"./chunk-NB2WLB3J.js";import"./chunk-ISWW3DKF.js";import"./chunk-BRQUZ5NC.js";import"./chunk-BZENIQ7N.js";async function add(client,argv,telemetry){let parsedArgs;try{parsedArgs=parseArguments(argv,getFlagsSpecification(addSubcommand.options))}catch(err){return emitVcrArgParseError(client,err,"vcr create <name> --project <name-or-id>"),printError(err),2}let fr=validateVcrJsonOutput(client,parsedArgs.flags);if(typeof fr=="number")return fr;let name=parsedArgs.args[0],project=parsedArgs.flags["--project"];if(telemetry.trackCliOptionProject(project),telemetry.trackCliOptionFormat(parsedArgs.flags["--format"]),!name)return outputAgentError(client,{status:"error",reason:AGENT_REASON.MISSING_ARGUMENTS,message:`Missing repository name. Example: ${packageName} vcr create <name>`,next:[{command:buildCommandWithGlobalFlags(client.argv,"vcr create <name>"),when:"Replace <name> with the repository name to create"}]},2),outputError(client,fr.jsonOutput,"MISSING_ARGUMENTS","Usage: `vercel vcr create <name>`");let scope=await resolveVcrScope(client,{project,jsonOutput:fr.jsonOutput});if(typeof scope=="number")return scope;let path=`/v1/vcr/repository?teamId=${encodeURIComponent(scope.teamId)}`;output_manager_default.spinner("Creating repository...");try{let created=await client.fetch(path,{method:"POST",body:{projectId:scope.projectId,name}});return fr.jsonOutput?client.stdout.write(`${JSON.stringify(created,null,2)}
|
|
8
8
|
`):output_manager_default.success(`Created repository ${created.repository?.name??name}`),0}catch(err){if(isAPIError(err))return handleVcrApiError(client,err,fr.jsonOutput,{retry:{command:buildCommandWithGlobalFlags(client.argv,"vcr ls"),when:"List existing repositories (a name conflict means it already exists)"}});throw err}finally{output_manager_default.stopSpinner()}}export{add as default};
|
|
@@ -4,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{DEFAULT_TAG,buildRepositoryReference,parseNameArg,validateImageParts}from"./chunk-HEGJZJO7.js";import{VCR_ENGINES,emitVcrArgParseError,isBuildxAvailable,isEngineInstalled,pushCompressionArgs,reportEngineCommandFailure,reportEnginePushFailure,resolveRegistry,resolveVcrScope,runEngine,splitPassthrough,validateVcrChoice}from"./chunk-
|
|
7
|
+
import{DEFAULT_TAG,buildRepositoryReference,parseNameArg,validateImageParts}from"./chunk-HEGJZJO7.js";import{VCR_ENGINES,emitVcrArgParseError,isBuildxAvailable,isEngineInstalled,pushCompressionArgs,reportEngineCommandFailure,reportEnginePushFailure,resolveRegistry,resolveVcrScope,runEngine,splitPassthrough,validateVcrChoice}from"./chunk-YCXZZSW6.js";import{outputError}from"./chunk-5UEBA6N6.js";import"./chunk-GSOPJJO5.js";import{buildSubcommand}from"./chunk-RZGWCQP7.js";import"./chunk-AG5QQNJ3.js";import"./chunk-AU42HSQ3.js";import"./chunk-L5FUUGYX.js";import"./chunk-FBYA6LLM.js";import"./chunk-SCV7XEEO.js";import{printError}from"./chunk-OZ47SVXA.js";import"./chunk-D4MW3RDW.js";import"./chunk-J53D7SLS.js";import"./chunk-FIIHB66A.js";import"./chunk-VKXEOL4K.js";import"./chunk-MXTC4ZAQ.js";import"./chunk-4SAVH3H7.js";import"./chunk-ZS2WS4AM.js";import"./chunk-AOWWC6WZ.js";import"./chunk-MY4MONOH.js";import{parseArguments}from"./chunk-Z4OH72VZ.js";import{AGENT_REASON,buildCommandWithGlobalFlags,outputAgentError}from"./chunk-FZIRYAXC.js";import{getFlagsSpecification}from"./chunk-5IPBCD7K.js";import"./chunk-KELSPU2J.js";import"./chunk-ROPQIBWJ.js";import"./chunk-VKPZP4LC.js";import"./chunk-PPCFQQSU.js";import"./chunk-N7Q2IESO.js";import"./chunk-WPQN5UKR.js";import"./chunk-2VBFQZ72.js";import"./chunk-YIIPBH2D.js";import"./chunk-JESNVRVR.js";import{output_manager_default}from"./chunk-75IAMKGV.js";import"./chunk-RM3ZDRYE.js";import"./chunk-OO572JUC.js";import"./chunk-D3AHZ5LI.js";import"./chunk-2GHZGOWT.js";import"./chunk-YHPPP3SF.js";import"./chunk-NB2WLB3J.js";import"./chunk-ISWW3DKF.js";import"./chunk-BRQUZ5NC.js";import"./chunk-BZENIQ7N.js";var DEFAULT_PLATFORM="linux/amd64";async function build(client,telemetry){let{own,passthrough}=splitPassthrough(client.argv),parsedArgs;try{parsedArgs=parseArguments(own,getFlagsSpecification(buildSubcommand.options))}catch(err){return emitVcrArgParseError(client,err,"vcr build <engine> [path] [name[:tag]]"),printError(err),2}let[engineArg,pathArg,nameArg]=parsedArgs.args.slice(2),project=parsedArgs.flags["--project"],platform=parsedArgs.flags["--platform"],push=!!parsedArgs.flags["--push"];if(telemetry.trackCliArgumentEngine(engineArg),telemetry.trackCliArgumentPath(pathArg),telemetry.trackCliArgumentName(nameArg),telemetry.trackCliOptionProject(project),telemetry.trackCliOptionPlatform(platform),telemetry.trackCliFlagPush(push),!engineArg){let message=`Missing engine. Choose one of: ${VCR_ENGINES.join(", ")}.`;return outputAgentError(client,{status:"error",reason:AGENT_REASON.MISSING_ARGUMENTS,message,next:[{command:buildCommandWithGlobalFlags(client.argv,"vcr build docker"),when:"Replace docker with the container tool you use"}]},2),outputError(client,!1,"MISSING_ARGUMENTS",message)}let choiceError=validateVcrChoice(client,"engine",engineArg,VCR_ENGINES,!1);if(typeof choiceError=="number")return choiceError;let engine=engineArg;if(!isEngineInstalled(engine)){let message=`\`${engine}\` is not installed or not on your PATH. Install it and try again.`;return outputAgentError(client,{status:"error",reason:"engine_not_found",message},1),outputError(client,!1,"ENGINE_NOT_FOUND",message)}let scope=await resolveVcrScope(client,{project,jsonOutput:!1});if(typeof scope=="number")return scope;let parsed=parseNameArg(nameArg,scope.projectName);if("error"in parsed)return outputAgentError(client,{status:"error",reason:AGENT_REASON.INVALID_ARGUMENTS,message:parsed.error},2),outputError(client,!1,"INVALID_ARGUMENTS",parsed.error);let validationError=validateImageParts(parsed);if(validationError)return outputAgentError(client,{status:"error",reason:AGENT_REASON.INVALID_ARGUMENTS,message:validationError},2),outputError(client,!1,"INVALID_ARGUMENTS",validationError);let ref=`${buildRepositoryReference({registry:resolveRegistry(),teamSlug:scope.teamSlug,projectName:scope.projectName,repository:parsed.repository})}:${parsed.tag??DEFAULT_TAG}`,contextPath=pathArg??".",buildPlatform=platform??DEFAULT_PLATFORM;if(push&&engine==="docker"&&await isBuildxAvailable()){let outputSpec=`type=image,name=${ref},push=true,oci-mediatypes=true,compression=zstd,compression-level=3,force-compression=true`,engineArgs2=["buildx","build","--platform",buildPlatform,"--output",outputSpec,...passthrough,contextPath];output_manager_default.log(`Running: ${engine} ${engineArgs2.join(" ")}`);let result2=await runEngine(engine,engineArgs2,{cwd:client.cwd,captureStderr:!0});return result2.exitCode!==0?reportEnginePushFailure(client,engine,"buildx build",result2):(output_manager_default.success(`Built and pushed ${ref} (zstd compression)`),0)}push&&engine==="docker"&&output_manager_default.warn("Docker Buildx is not available; building and pushing without zstd compression. Install Buildx for smaller, faster image pushes.");let engineArgs=["build","--platform",buildPlatform,"--tag",ref,...passthrough,contextPath];output_manager_default.log(`Running: ${engine} ${engineArgs.join(" ")}`);let result=await runEngine(engine,engineArgs,{cwd:client.cwd});if(result.exitCode!==0)return reportEngineCommandFailure(client,engine,"build",result);if(!push)return output_manager_default.success(`Built ${ref}`),output_manager_default.log(`Push it with \`${buildCommandWithGlobalFlags(client.argv,`vcr push ${engine}${nameArg?` ${nameArg}`:""}`)}\`.`),0;let pushArgs=["push",...pushCompressionArgs(engine),ref];output_manager_default.log(`Running: ${engine} ${pushArgs.join(" ")}`);let pushResult=await runEngine(engine,pushArgs,{cwd:client.cwd,captureStderr:!0});if(pushResult.exitCode!==0)return reportEnginePushFailure(client,engine,"push",pushResult);let compressed=engine!=="docker";return output_manager_default.success(`Built and pushed ${ref}${compressed?" (zstd compression)":""}`),0}export{build as default};
|
|
@@ -4,4 +4,4 @@ import { dirname as __dirname_ } from 'node:path';
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
const __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
const __dirname = __dirname_(__filename);
|
|
7
|
-
import{printProjectNotFoundError}from"./chunk-
|
|
7
|
+
import{printProjectNotFoundError}from"./chunk-UBKETNGO.js";import{performDeviceCodeFlow}from"./chunk-37QGCN6P.js";import{param}from"./chunk-3G3FQYMW.js";import{detectExplicitScope}from"./chunk-J53D7SLS.js";import{buildCommandWithYes,outputActionRequired}from"./chunk-FZIRYAXC.js";import{getLinkedProject,resolveProjectCwd}from"./chunk-KELSPU2J.js";import{isAPIError}from"./chunk-YIIPBH2D.js";import{getCommandName,getCommandNamePlain}from"./chunk-JESNVRVR.js";import{output_manager_default}from"./chunk-75IAMKGV.js";import{URLSearchParams}from"url";var RECOVERABLE_CHALLENGE_CODES=new Set(["challenge_required","challenge_required_email_otp","user_auth_required"]);async function withEnvChallengeRecovery(client,fn){let hadStoredSession=!!(client.authConfig.token||client.authConfig.refreshToken);try{return await fn()}catch(error){if(!isAPIError(error))throw error;let isRecoverableChallenge=RECOVERABLE_CHALLENGE_CODES.has(error.code),isRejectedStoredSession=hadStoredSession&&error.invalidToken===!0;if(!isRecoverableChallenge&&!isRejectedStoredSession||client.authConfig.tokenSource||!client.stdin.isTTY||client.nonInteractive)throw error;output_manager_default.stopSpinner(),output_manager_default.log("Sensitive Environment Variables require fresh authentication.");let refreshToken=client.authConfig.refreshToken,acrValues=getAcrValuesFromWWWAuthenticate(error.wwwAuthenticate),tokens=isRecoverableChallenge&&refreshToken&&acrValues?await performDeviceCodeFlow(client,{refreshToken,acrValues,fallbackToLoginOnStepUpFailure:!0}):await performDeviceCodeFlow(client);if(!tokens)throw error;return client.updateAuthConfig({token:tokens.access_token,userId:void 0,expiresAt:Math.floor(Date.now()/1e3)+tokens.expires_in,refreshToken:tokens.refresh_token}),client.persistAuthConfig(),await fn()}}function getAcrValuesFromWWWAuthenticate(header){if(!header)return;let bearerIndex=header.toLowerCase().indexOf("bearer");if(bearerIndex===-1)return;let match=header.slice(bearerIndex+6).match(/(?:^|[,\s])acr_values=(?:"((?:\\.|[^"\\])*)"|([^,\s]+))/i);return match?.[1]?.replace(/\\(.)/g,"$1")??match?.[2]}async function getEnvRecords(client,projectId,source,{target,gitBranch,decrypt}={}){output_manager_default.debug(`Fetching Environment Variables of project ${projectId} and target ${target}`);let query=new URLSearchParams;if(target){let targetParam="target";target!=="production"&&target!=="preview"&&target!=="development"&&(targetParam="customEnvironmentId"),query.set(targetParam,target)}gitBranch&&query.set("gitBranch",gitBranch),decrypt&&query.set("decrypt",decrypt.toString()),source&&query.set("source",source);let url=`/v10/projects/${projectId}/env?${query}`;return withEnvChallengeRecovery(client,()=>client.fetch(url))}async function pullEnvRecords(client,projectIdOrDeploymentId,source,{target,gitBranch}={}){output_manager_default.debug(`Fetching Environment Variables of ${projectIdOrDeploymentId} and target ${target}`);let query=new URLSearchParams,url=`/v3/env/pull/${projectIdOrDeploymentId}`;return projectIdOrDeploymentId.startsWith("dpl_")||target&&(url+=`/${encodeURIComponent(target)}`,gitBranch&&(url+=`/${encodeURIComponent(gitBranch)}`)),source&&query.set("source",source),Array.from(query).length>0&&(url+=`?${query}`),withEnvChallengeRecovery(client,()=>client.fetch(url))}var parseEnv=env=>{if(!env)return{};if(typeof env=="string"&&(env=[env]),Array.isArray(env)){let startingDict={};return env.reduce((o,e)=>{let key,value,equalsSign=e.indexOf("=");return equalsSign===-1?key=e:(key=e.slice(0,equalsSign),value=e.slice(equalsSign+1)),o[key]=value,o},startingDict)}return env};async function ensureLink(commandName,client,cwd,opts={}){opts.singleFile||(cwd=await resolveProjectCwd(cwd));let link=opts.link,nonInteractive=opts.nonInteractive??client.nonInteractive??!1;if(opts.nonInteractive=nonInteractive,link||(opts.forceDelete?link={status:"not_linked",org:null,project:null}:link=await getLinkedProject(client,{cwd,projectName:opts.projectName,projectNameIsExplicit:!!(opts.projectName&&opts.failIfNotFound),scopeIsExplicit:detectExplicitScope(client),allowOwnerLookupFallback:opts.allowOwnerLookupFallback,skipOwnerLookup:opts.skipOwnerLookup,skipRemoteLookup:opts.skipRemoteLookup,skipProjectRootResolution:!!opts.singleFile}),opts.link=link),link.status==="linked"&&opts.forceDelete||link.status==="not_linked"){if(link.status==="not_linked"&&opts.failIfNotFound&&opts.projectName)return await printProjectNotFoundError(client,opts.projectName,commandName,link.orgId),1;if(link.status==="not_linked"&&opts.requireExistingLink)return output_manager_default.error(`Project is not linked. Run ${getCommandName("link")} first.`),1;let{default:setupAndLink}=await import("./setup-and-link-OAS7PYL6.js");if(link=await setupAndLink(client,cwd,opts),link.status==="not_linked")return 0}return link.status==="error"?(link.reason==="HEADLESS"&&(nonInteractive?outputActionRequired(client,{status:"action_required",reason:"confirmation_required",message:`Command ${getCommandNamePlain(commandName)} requires confirmation. Use option --yes to confirm.`,next:[{command:buildCommandWithYes(client.argv),when:"Confirm and run"}]},link.exitCode):output_manager_default.error(`Command ${getCommandName(commandName)} requires confirmation. Use option ${param("--yes")} to confirm.`)),nonInteractive&&process.exit(link.exitCode),link.exitCode):link}export{getEnvRecords,pullEnvRecords,parseEnv,ensureLink};
|
|
@@ -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{VERCEL_DIR,VERCEL_DIR_PROJECT,require_lib}from"./chunk-
|
|
7
|
+
import{VERCEL_DIR,VERCEL_DIR_PROJECT,require_lib}from"./chunk-KELSPU2J.js";import{require_dist}from"./chunk-RM3ZDRYE.js";import{__toESM}from"./chunk-BZENIQ7N.js";var import_fs_extra=__toESM(require_lib(),1);import{join}from"path";var import_error_utils=__toESM(require_dist(),1);async function writeProjectSettings(cwd,project,org,isRepoLinked){let analyticsId;project.analytics?.id&&(!project.analytics.disabledAt||project.analytics.enabledAt&&project.analytics.enabledAt>project.analytics.disabledAt)&&(analyticsId=project.analytics.id);let projectLinkAndSettings={projectId:isRepoLinked?void 0:project.id,orgId:isRepoLinked?void 0:org.id,projectName:isRepoLinked?void 0:project.name,settings:{createdAt:project.createdAt,framework:project.framework,devCommand:project.devCommand,installCommand:project.installCommand,buildCommand:project.buildCommand,outputDirectory:project.outputDirectory,rootDirectory:project.rootDirectory,directoryListing:project.directoryListing,nodeVersion:project.nodeVersion,analyticsId}},path=join(cwd,VERCEL_DIR,VERCEL_DIR_PROJECT);return await(0,import_fs_extra.outputJSON)(path,projectLinkAndSettings,{spaces:2})}async function readProjectSettings(vercelDir){try{return JSON.parse(await(0,import_fs_extra.readFile)(join(vercelDir,VERCEL_DIR_PROJECT),"utf8"))}catch(err){if((0,import_error_utils.isErrnoException)(err)&&err.code&&["ENOENT","ENOTDIR"].includes(err.code)||(0,import_error_utils.isError)(err)&&err.name==="SyntaxError")return null;throw err}}function pickOverrides(vercelConfig){let overrides={};for(let prop of["buildCommand","devCommand","framework","ignoreCommand","installCommand","outputDirectory"])typeof vercelConfig[prop]<"u"&&(prop==="ignoreCommand"?overrides.commandForIgnoringBuildStep=vercelConfig[prop]:overrides[prop]=vercelConfig[prop]);return overrides}export{writeProjectSettings,readProjectSettings,pickOverrides};
|
|
@@ -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{readJSONFile}from"./chunk-
|
|
7
|
+
import{readJSONFile}from"./chunk-ZKDWPKO2.js";import{require_dist as require_dist2,validateConfig}from"./chunk-YBOS65VB.js";import{require_dist2 as require_dist}from"./chunk-BLAIBYEU.js";import{compileVercelConfig}from"./chunk-OGCVOINQ.js";import{CantParseJSONFile}from"./chunk-YIIPBH2D.js";import{require_build_utils}from"./chunk-75IAMKGV.js";import{__toESM}from"./chunk-BZENIQ7N.js";var import_fs_detectors=__toESM(require_dist(),1),import_service_topology=__toESM(require_dist2(),1);import{readFile,writeFile}from"fs/promises";import{basename,join as join2}from"path";import{parse as tomlParse,stringify as tomlStringify}from"smol-toml";var import_build_utils=__toESM(require_build_utils(),1);import{join}from"path";function createDetectEntrypoint(projectRoot){return async({workPath,framework})=>{let absWorkPath=(0,import_build_utils.normalizePath)(join(projectRoot,workPath)),builderName;if((0,import_build_utils.isPythonFramework)(framework))builderName="@vercel/python";else if((0,import_build_utils.isNodeBackendFramework)(framework))builderName="@vercel/backends";else if(framework==="go")builderName="@vercel/go";else if(framework==="rust")builderName="@vercel/rust";else return null;let detectEntrypoint=await loadBuilderDetectEntrypoint(builderName,projectRoot);return detectEntrypoint?detectEntrypoint(builderName==="@vercel/python"?{workPath:absWorkPath,framework}:{workPath:absWorkPath}):null}}async function loadBuilderDetectEntrypoint(name,projectRoot){let{importBuilders}=await import("./import-builders-FC5ESQ34.js"),loaded=(await importBuilders(new Set([name]),projectRoot)).get(name);if(!loaded)return;let detect=loaded.builder.detectEntrypoint;return typeof detect=="function"?detect:void 0}function getServicesConfiguration(config){let configuredServices=config?.services??config?.experimentalServicesV2??config?.experimentalServices,configuredServicesType=config?.services?"services":config?.experimentalServicesV2?"experimentalServicesV2":config?.experimentalServices?"experimentalServices":void 0;return{configuredServices,configuredServicesType}}async function loadVercelConfig(cwd){try{let{configPath}=await compileVercelConfig(cwd);if(!configPath)return null;let config=await readJSONFile(configPath);return config instanceof Error?null:config}catch{return null}}function isServicesEnvEnabled(){let value=process.env.VERCEL_USE_EXPERIMENTAL_SERVICES;return value==="1"||value?.toLowerCase()==="true"}async function isExperimentalServicesEnabled(cwd){let{configuredServices}=getServicesConfiguration(await loadVercelConfig(cwd));return isServicesEnvEnabled()||configuredServices!==void 0}async function tryDetectServices(cwd,config){config===void 0&&(config=await loadVercelConfig(cwd));let configuration=getServicesConfiguration(config);if(!isServicesEnvEnabled()&&!configuration.configuredServices)return null;let fs=new import_fs_detectors.LocalFileSystemDetector(cwd),result=await(0,import_service_topology.detectServices)({fs,configuredServices:configuration.configuredServices,configuredServicesType:configuration.configuredServicesType,detectEntrypoint:createDetectEntrypoint(cwd)});return result.errors.some(e=>e.code==="NO_SERVICES_CONFIGURED")?null:result}async function writeServicesConfig(cwd,config){let prepared=await prepareServicesConfigWrite(cwd,config);return await writeFile(prepared.configPath,prepared.content,"utf8"),{configFileName:basename(prepared.configPath)}}async function getServicesConfigWriteBlocker(cwd,config){try{return await prepareServicesConfigWrite(cwd,config),null}catch(error){return getServicesConfigWriteBlockerFromError(error)}}function toProjectServicesConfigPatch(config){let services={};for(let[name,svc]of Object.entries(config)){let buildCommand=svc.preDeployCommand&&svc.buildCommand?`${svc.buildCommand} && ${svc.preDeployCommand}`:svc.preDeployCommand||svc.buildCommand;services[name]={root:svc.root,...svc.framework?{framework:svc.framework}:{},...svc.entrypoint?{entrypoint:svc.entrypoint}:{},...buildCommand?{buildCommand}:{}}}let rewrites=(0,import_service_topology.generateServiceRewrites)(config);return{services,...rewrites.length>0?{rewrites}:{}}}async function prepareServicesConfigWrite(cwd,config){let compileResult=await compileVercelConfig(cwd),configPath=join2(cwd,"vercel.json");if(compileResult.sourceFile==="vercel.toml")return prepareTomlServicesConfigWrite(join2(cwd,"vercel.toml"),config);if(compileResult.wasCompiled)throw new Error(`Cannot automatically update ${compileResult.sourceFile??"the current Vercel config"}.`);let existingConfig={};if(compileResult.configPath&&basename(compileResult.configPath)==="vercel.json"){let result=await readJSONFile(configPath);if(result instanceof CantParseJSONFile)throw result;existingConfig=result??{}}let patch=toProjectServicesConfigPatch(config),nextConfig={...existingConfig,...patch,...patch.rewrites?{rewrites:[...existingConfig.rewrites??[],...patch.rewrites]}:{}},validationError=validateConfig(nextConfig);if(validationError)throw validationError;return{configPath,content:JSON.stringify(nextConfig,null,2)+`
|
|
8
8
|
`}}async function prepareTomlServicesConfigWrite(configPath,config){let patch=toProjectServicesConfigPatch(config),patchKeys=Object.keys(patch),existingContent;try{existingContent=await readFile(configPath,"utf8")}catch{existingContent=""}if(existingContent.trim()){let existingParsed=tomlParse(existingContent),overlapping=patchKeys.filter(key=>key in existingParsed);if(overlapping.length>0){let plural=overlapping.length>1,keyList=overlapping.map(k=>`"${k}"`).join(", ");throw new Error(`Cannot automatically update vercel.toml: key${plural?"s":""} ${keyList} already exist${plural?"":"s"}.`)}}let patchToml=tomlStringify(patch),content=existingContent.trim()?existingContent.trimEnd()+`
|
|
9
9
|
|
|
10
10
|
`+patchToml+`
|
|
@@ -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{createDetectEntrypoint,getServicesConfigWriteBlocker,writeServicesConfig}from"./chunk-
|
|
7
|
+
import{createDetectEntrypoint,getServicesConfigWriteBlocker,writeServicesConfig}from"./chunk-67NNB6S6.js";import{detectProjects}from"./chunk-YTEZO2SZ.js";import{require_slugify}from"./chunk-COD3WAUI.js";import{selectOrg}from"./chunk-G6B6TVAE.js";import{createProject}from"./chunk-QHJLRTVY.js";import{readJSONFile}from"./chunk-ZKDWPKO2.js";import{singleFileProjectSettings,validateRootDirectory}from"./chunk-Z6UFAIEX.js";import{require_dist as require_dist2}from"./chunk-YBOS65VB.js";import{checkExistsAndConnect,parseRepoUrl,selectAndParseRemoteUrl}from"./chunk-SYEKOJHT.js";import{require_dist2 as require_dist}from"./chunk-BLAIBYEU.js";import{compileVercelConfig,findSourceVercelConfigFile}from"./chunk-OGCVOINQ.js";import{Separator}from"./chunk-MVGTMPMI.js";import{isPromptBackError,isPromptCanceledError}from"./chunk-P2O5DOYE.js";import{pull}from"./chunk-YI5G2A3V.js";import{require_frameworks}from"./chunk-MVCAUS4F.js";import{table}from"./chunk-773GOZIR.js";import{printError}from"./chunk-OZ47SVXA.js";import{getLocalPathConfig}from"./chunk-J53D7SLS.js";import{VERCEL_DIR_PROJECT,VERCEL_DIR_README,fetchProjectsForRepoUrl,findProjectsFromPath,findRepoRoot,getGitConfigPath,getLinkedProject,getProjectByNameOrId,getRemoteUrls,getVercelDirectory,isDirectory,linkFolderToProject,linkRepoProject,parseGitConfig,pluckRemoteUrls,require_lib,resolveGitRemote}from"./chunk-KELSPU2J.js";import{humanizePath}from"./chunk-PPCFQQSU.js";import{printAlignedLabel}from"./chunk-N7Q2IESO.js";import{CantParseJSONFile,ProjectNotFound,isAPIError}from"./chunk-YIIPBH2D.js";import{output_manager_default,require_build_utils}from"./chunk-75IAMKGV.js";import{require_source}from"./chunk-NB2WLB3J.js";import{__toESM}from"./chunk-BZENIQ7N.js";var import_fs_extra=__toESM(require_lib(),1),import_slugify3=__toESM(require_slugify(),1),import_build_utils4=__toESM(require_build_utils(),1),import_fs_detectors2=__toESM(require_dist(),1);import{join as join3,basename,extname}from"path";var import_chalk=__toESM(require_source(),1);var import_slugify=__toESM(require_slugify(),1);var SEARCH_ALL_PROJECTS="search-all-projects",CREATE_NEW_PROJECT="create-new-project",BACK_TO_PROJECT_SELECTION=Symbol("back-to-project-selection"),BACK_TO_TEAM_SELECTION=Symbol("back-to-team-selection"),SWITCH_GIT_REMOTE=Symbol("switch-git-remote"),NO_EXISTING_PROJECTS=Symbol("no-existing-projects");async function inputProjectDecision(client,defaultDecision){let createChoice={name:"Create new project",value:"create"},existingChoice={name:"Link existing project",value:"existing"};return await client.input.select({message:"Project?",choices:defaultDecision==="existing"?[existingChoice,createChoice]:[createChoice,existingChoice]})}function randomNameSuffix(){return Math.random().toString(36).slice(2,6).padEnd(4,"0")}async function suggestNewProjectName(client,org,slugifiedName,knownTaken){let taken=knownTaken;if(!taken)try{taken=!(await getProjectByNameOrId(client,slugifiedName,org.id)instanceof ProjectNotFound)}catch{taken=!1}return taken?`${slugifiedName}-${randomNameSuffix()}`:slugifiedName}function promptForProjectName(client,org,defaultName,message="Name?"){return client.input.text({message,default:defaultName,validate:async val=>val?await getProjectByNameOrId(client,val,org.id)instanceof ProjectNotFound?!0:"Project already exists":"Project name cannot be empty"})}async function promptForProjectNameWithBack(client,org,defaultName){try{return await client.withPromptBackNavigation(()=>promptForProjectName(client,org,defaultName,`Name? ${import_chalk.default.dim("Press \u2191 to return to project options")}`))}catch(error){if(isPromptBackError(error))return BACK_TO_PROJECT_SELECTION;throw error}}async function searchExistingProjects(client,org,allowBack){let firstPage=await client.fetch("/v9/projects?limit=100",{accountId:org.id}),projects=firstPage.projects,hasMoreProjects=firstPage.pagination.next!=null;if(projects.length===0)return output_manager_default.log(`No existing projects found under ${import_chalk.default.bold(org.slug)}. Creating new project.`),NO_EXISTING_PROJECTS;let pageSize=15,countHint=projects.length>pageSize?` ${import_chalk.default.dim(`(${hasMoreProjects?"100+":projects.length} projects)`)}`:"";return await client.input.search({message:`Which project?${countHint}`,pageSize,source:async(term,{signal})=>{let searchTerm=term?.trim(),matchingProjects=projects;if(searchTerm)if(hasMoreProjects)matchingProjects=(await client.fetch(`/v9/projects?search=${encodeURIComponent(searchTerm)}&limit=20`,{accountId:org.id,signal})).projects;else{let normalizedSearchTerm=searchTerm.toLowerCase();matchingProjects=projects.filter(project=>project.name.toLowerCase().includes(normalizedSearchTerm)||project.id===searchTerm)}let choices=matchingProjects.slice().sort((a,b)=>b.updatedAt-a.updatedAt).map(project=>({name:project.name,value:project}));if(!allowBack)return choices;let backChoice={name:"Back to project options",value:BACK_TO_PROJECT_SELECTION};return choices.length===0?[backChoice]:searchTerm?choices:[...choices,new Separator,backChoice]}})}async function inputProject(client,org,detectedProjectName,autoConfirm=!1,skipAutoDetect=!1,showProjectSuggestions=!1,allowTeamSelectionBack=!1,repoMatches=[],gitRemoteOptions){let slugifiedName=(0,import_slugify.default)(detectedProjectName),canSwitchGitRemote=(gitRemoteOptions?.remoteNames.length??0)>1,detectedProject=null;if(!skipAutoDetect&&repoMatches.length===0){output_manager_default.spinner("Searching for existing projects\u2026",1e3);let[project,slugifiedProject]=await Promise.all([getProjectByNameOrId(client,detectedProjectName,org.id),slugifiedName!==detectedProjectName?getProjectByNameOrId(client,slugifiedName,org.id):null]);if(detectedProject=project instanceof ProjectNotFound?slugifiedProject instanceof ProjectNotFound?null:slugifiedProject:project,detectedProject&&!detectedProject.id)throw new Error('Detected linked project does not have "id".');output_manager_default.stopSpinner()}if(autoConfirm)return repoMatches.length===1?repoMatches[0]:detectedProject||detectedProjectName;if(client.nonInteractive){if(detectedProject)return detectedProject;let err=new Error("Confirmation required");throw err.code="HEADLESS",err}let slugifiedNameKnownFree=!skipAutoDetect&&repoMatches.length===0&&!detectedProject,memoizedDefaultName;async function defaultNewProjectName(){return memoizedDefaultName===void 0&&(memoizedDefaultName=slugifiedNameKnownFree?slugifiedName:await suggestNewProjectName(client,org,slugifiedName,detectedProject?.name===slugifiedName)),memoizedDefaultName}let shouldLinkProject;if(showProjectSuggestions&&!skipAutoDetect)for(;;){let choices=[];if(repoMatches.length>0?choices.push(...repoMatches.map(match=>({name:`${match.project.name} ${import_chalk.default.gray("(linked by git)")}`,value:match})),new Separator):detectedProject&&choices.push({name:`${detectedProject.name} ${import_chalk.default.gray("(folder name)")}`,value:detectedProject},new Separator),choices.push({name:"Search all projects",value:SEARCH_ALL_PROJECTS,description:"Browse or search every project in this team"},{name:"Create a new project",value:CREATE_NEW_PROJECT,description:`Create it under ${org.slug}`}),canSwitchGitRemote){let current=gitRemoteOptions?.currentRemoteName;choices.push({name:"Switch Git remote",value:SWITCH_GIT_REMOTE,description:current?`Suggestions are from ${current}`:"Search projects linked to a different remote"})}allowTeamSelectionBack&&choices.push({name:"Choose a different team",value:BACK_TO_TEAM_SELECTION,description:"Return to team selection"});let selected=await client.input.select({message:"Which project?",choices});if(selected===BACK_TO_TEAM_SELECTION)return BACK_TO_TEAM_SELECTION;if(selected===SWITCH_GIT_REMOTE)return SWITCH_GIT_REMOTE;if(selected===CREATE_NEW_PROJECT){let projectName=await promptForProjectNameWithBack(client,org,await defaultNewProjectName());if(projectName===BACK_TO_PROJECT_SELECTION)continue;return projectName}if(selected!==SEARCH_ALL_PROJECTS)return selected;let existingProject=await searchExistingProjects(client,org,!0);if(existingProject!==BACK_TO_PROJECT_SELECTION){if(existingProject===NO_EXISTING_PROJECTS){let projectName=await promptForProjectNameWithBack(client,org,slugifiedName);if(projectName===BACK_TO_PROJECT_SELECTION)continue;return projectName}return existingProject}}else if(!detectedProject)shouldLinkProject=await inputProjectDecision(client,skipAutoDetect?"existing":"create")==="existing";else{if(output_manager_default.print(` ${import_chalk.default.bold("Found existing project")}
|
|
8
8
|
`),printAlignedLabel("Project",`${org.slug}/${detectedProject.name}`),await client.input.confirm("Link directory to project?",!0))return detectedProject;shouldLinkProject=await inputProjectDecision(client,"existing")==="existing"}if(shouldLinkProject){let existingProject=await searchExistingProjects(client,org,!1);if(existingProject!==NO_EXISTING_PROJECTS&&existingProject!==BACK_TO_PROJECT_SELECTION)return existingProject}return await promptForProjectName(client,org,await defaultNewProjectName())}var import_build_utils=__toESM(require_build_utils(),1),import_chalk2=__toESM(require_source(),1);import path from"path";async function inputRootDirectory(client,cwd,autoConfirm=!1){if(autoConfirm)return null;for(;;){let rootDirectory=await client.input.text({message:"Code directory?",transformer:input=>`${import_chalk2.default.dim("./")}${input}`});if(!rootDirectory)return null;let normal=path.normalize(rootDirectory);if(normal==="."||normal==="./")return null;let fullPath=path.join(cwd,normal);if(await validateRootDirectory(cwd,fullPath,"Please choose a different one.")!==!1)return(0,import_build_utils.normalizePath)(normal)}}var import_chalk3=__toESM(require_source(),1),import_frameworks=__toESM(require_frameworks(),1);function isSettingValue(setting){return setting&&typeof setting.value=="string"}var settingMap={buildCommand:"Build Command",devCommand:"Development Command",commandForIgnoringBuildStep:"Ignore Command",installCommand:"Install Command",outputDirectory:"Output Directory",framework:"Framework"},settingKeys=Object.keys(settingMap).sort();async function editProjectSettings(client,projectSettings,framework,autoConfirm,localConfigurationOverrides,configFileName="vercel.json"){let settings=Object.assign({buildCommand:null,devCommand:null,framework:null,commandForIgnoringBuildStep:null,installCommand:null,outputDirectory:null},projectSettings);if(localConfigurationOverrides&&Object.values(localConfigurationOverrides??{}).some(Boolean)){for(let setting of settingKeys){let localConfigValue=localConfigurationOverrides[setting];localConfigValue&&(settings[setting]=localConfigValue)}output_manager_default.print(` Local settings detected in ${configFileName}:
|
|
9
9
|
`);for(let setting of settingKeys){let override=localConfigurationOverrides[setting];override&&output_manager_default.print(` ${import_chalk3.default.dim(`${import_chalk3.default.bold(`${settingMap[setting]}:`)} ${override}`)}
|
|
10
10
|
`)}if(localConfigurationOverrides.framework){let overrideFramework=import_frameworks.frameworkList.find(f=>f.slug===localConfigurationOverrides.framework);overrideFramework&&(framework=overrideFramework,output_manager_default.print(` Merging default Project Settings for ${framework.name}. Previously listed overrides are prioritized.
|
|
@@ -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{printProjectNotFoundError}from"./chunk-
|
|
7
|
+
import{printProjectNotFoundError}from"./chunk-UBKETNGO.js";import{detectExplicitScope}from"./chunk-J53D7SLS.js";import{omitGlobalFlagsFromArgs}from"./chunk-FZIRYAXC.js";import{getLinkedProject}from"./chunk-KELSPU2J.js";function getInvokingCommandFromArgv(argv){let args=omitGlobalFlagsFromArgs(argv.slice(2)),positionals=[];for(let arg of args){if(arg.startsWith("-"))break;positionals.push(arg)}return positionals.join(" ")}async function resolveProjectContext({client,cwd=client.cwd,projectNameOrId,commandName="",projectNotFoundHandling="report",skipOwnerLookup}){let context=await getLinkedProject(client,{cwd,projectName:projectNameOrId,projectNameIsExplicit:!!projectNameOrId,scopeIsExplicit:detectExplicitScope(client),skipOwnerLookup});return context.status==="not_linked"&&projectNameOrId&&projectNotFoundHandling==="report"?(await printProjectNotFoundError(client,projectNameOrId,commandName||getInvokingCommandFromArgv(client.argv),context.orgId),{status:"error",exitCode:1,orgId:context.orgId}):context}export{resolveProjectContext};
|
|
@@ -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{js_yaml_default}from"./chunk-V6Y6UK6B.js";import{require_minimatch}from"./chunk-BLAIBYEU.js";import{pullEnvRecords}from"./chunk-
|
|
7
|
+
import{js_yaml_default}from"./chunk-V6Y6UK6B.js";import{require_minimatch}from"./chunk-BLAIBYEU.js";import{pullEnvRecords}from"./chunk-4ZICRXI5.js";import{output_manager_default}from"./chunk-75IAMKGV.js";import{__toESM}from"./chunk-BZENIQ7N.js";var INTEGRATIONS_POLL_INTERVAL_MS=5e3,INTEGRATIONS_POLL_TIMEOUT_MS=3*60*1e3;async function fetchDeploymentBuildEnv(client,deploymentId,{quiet=!1}={}){let deadline=Date.now()+INTEGRATIONS_POLL_TIMEOUT_MS,isPolling=!1;for(;Date.now()<deadline;)try{return await pullEnvRecords(client,deploymentId,"vercel-cli:pull")}catch(err){if(err&&typeof err=="object"&&"integrationsStatus"in err&&err.integrationsStatus==="pending"){!isPolling&&!quiet&&(output_manager_default.spinner("Waiting for deployment integrations to finish provisioning..."),isPolling=!0),await new Promise(resolve=>setTimeout(resolve,INTEGRATIONS_POLL_INTERVAL_MS));continue}throw err}throw new Error("Timed out waiting for deployment integrations to complete provisioning.")}import{existsSync,readFileSync}from"node:fs";import{dirname,join,parse,relative}from"node:path";var import_minimatch=__toESM(require_minimatch(),1);function findWorkspaceRootCandidates(startDir){let{root}=parse(startDir),candidates=[],dir=startDir;for(let i=0;i<64;i++){let type=workspaceTypeOf(dir);if(type&&candidates.unshift({dir,type}),dir===root)break;let parent=dirname(dir);if(parent===dir)break;dir=parent}return candidates}function workspaceTypeOf(dir){if(existsSync(join(dir,"pnpm-workspace.yaml")))return"pnpm";let pkgPath=join(dir,"package.json");if(existsSync(pkgPath))try{let pkg=JSON.parse(readFileSync(pkgPath,"utf8")),{workspaces}=pkg;if(Array.isArray(workspaces)&&workspaces.length>0||workspaces&&typeof workspaces=="object"&&Array.isArray(workspaces.packages)&&workspaces.packages.length>0)return"npm"}catch{}return null}function readWorkspacePatterns(candidate){try{if(candidate.type==="pnpm"){let packages2=js_yaml_default.load(readFileSync(join(candidate.dir,"pnpm-workspace.yaml"),"utf8"))?.packages;return Array.isArray(packages2)?packages2.filter(p=>typeof p=="string"):null}let pkg=JSON.parse(readFileSync(join(candidate.dir,"package.json"),"utf8")),{workspaces}=pkg,packages=Array.isArray(workspaces)?workspaces:workspaces?.packages;return Array.isArray(packages)?packages.filter(p=>typeof p=="string"):null}catch{return null}}function workspaceClaims(candidate,memberDir){let rel=normalizeRelative(relative(candidate.dir,memberDir));if(rel==="")return!1;let patterns=readWorkspacePatterns(candidate);if(!patterns||patterns.length===0)return!1;let positives=[],negatives=[];for(let pattern of patterns)pattern.startsWith("!")?negatives.push(normalizeRelative(pattern.slice(1))):positives.push(normalizeRelative(pattern));let matches=pattern=>(0,import_minimatch.default)(rel,pattern,{dot:!1});return!positives.some(matches)||negatives.some(matches)?!1:existsSync(join(memberDir,"package.json"))}function resolvePerDirectoryLinkRoot(anchorDir,rootDirectorySetting){let repoRoot=anchorDir;for(let candidate of findWorkspaceRootCandidates(anchorDir))if(workspaceClaims(candidate,anchorDir)){repoRoot=candidate.dir;break}let linkLocation=normalizeRelative(relative(repoRoot,anchorDir));if(linkLocation==="")return{repoRoot,resolvedRootDirectory:""};let setting=normalizeRelative(rootDirectorySetting??"");return setting===""?{repoRoot,resolvedRootDirectory:linkLocation}:existsSync(join(anchorDir,setting))?{repoRoot,resolvedRootDirectory:normalizeRelative(relative(repoRoot,join(anchorDir,setting)))}:{repoRoot,resolvedRootDirectory:linkLocation,advisory:`Ignoring "rootDirectory" setting "${setting}" for the project linked in "${anchorDir}": "${join(anchorDir,setting)}" does not exist, so the build will use the linked directory "${linkLocation}" instead. Remove the "rootDirectory" setting, or configure it at the repository root.`}}function normalizeRelative(p){let normalized=p.replace(/\\/g,"/").replace(/^\.\//,"").replace(/^\/+/,"").replace(/\/+$/,"");return normalized==="."?"":normalized}export{fetchDeploymentBuildEnv,resolvePerDirectoryLinkRoot};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __dirname_ } from 'node:path';
|
|
4
|
+
const require = __createRequire(import.meta.url);
|
|
5
|
+
const __filename = __fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = __dirname_(__filename);
|
|
7
|
+
import{formatOption,jsonOption,projectOption,yesOption}from"./chunk-5IPBCD7K.js";import{packageName}from"./chunk-JESNVRVR.js";var builtInBody={type:"built-in",name:"Production server errors",triggers:{mode:"selected",items:[{type:"error_anomaly",filter:"statusGroup:5xx AND route:/api/*"}]},matchMinimumSeverityLevel:"high"},patchBody={name:"Critical production errors",matchMinimumSeverityLevel:"critical"},authoringReference={title:"Authoring reference",body:["vercel alerts rules schema --type built-in"]},rulesAddHelpSections=[{title:"Scope",body:["Provide ruleScope in the body or use a scope flag, not both.","--project maps to one included project.","--all maps to every project in the team."]},{title:"Built-in body (rule.json)",body:[...JSON.stringify(builtInBody,null,2).split(`
|
|
8
|
+
`),"","vercel alerts rules add --project my-app --body ./rule.json"]},authoringReference],rulesUpdateHelpSections=[{title:"Update body",body:["Include only the fields to change. type is optional and inferred from the stored rule.","Use --project or --all to change scope with or without --body.","Do not combine a ruleScope field in the body with --project or --all.","--all moves the rule to team-wide scope."]},{title:"Partial body (patch.json)",body:[...JSON.stringify(patchBody,null,2).split(`
|
|
9
|
+
`),"","vercel alerts rules update ar_abc123 --body ./patch.json","vercel alerts rules update ar_abc123 --project my-app"]},authoringReference];var projectScopeOption={...projectOption,shorthand:"p",description:"Use a project by name or ID"},listAllOption={name:"all",shorthand:"a",type:Boolean,deprecated:!1,description:"List all accessible rules in the selected team"},mutationAllOption={...listAllOption,description:"Apply the rule to all projects in the selected team"},deprecatedItemScopeOptions=[{...projectScopeOption,deprecated:!0},{...listAllOption,deprecated:!0}],bodyOption={name:"body",shorthand:null,type:String,argument:"PATH",deprecated:!1,description:"Read the alert rule body from a JSON file"},rulesLsSubcommand={name:"ls",aliases:["list"],default:!0,description:"List alert rules for a project or team",arguments:[],options:[projectScopeOption,listAllOption,{name:"type",shorthand:null,type:[String],argument:"TYPE",deprecated:!1,description:"Filter by rule type"},formatOption,jsonOption],examples:[{name:"List rules affecting the linked project",value:`${packageName} alerts rules ls`},{name:"List all rules in the selected team",value:`${packageName} alerts rules ls --all`},{name:"Write JSON output",value:`${packageName} alerts rules ls --all --json`}]},rulesSchemaSubcommand={name:"schema",aliases:[],description:"Show alert rule request fields and examples",arguments:[],options:[{name:"type",shorthand:null,type:String,argument:"TYPE",deprecated:!1,description:"Rule type to describe"},formatOption],examples:[{name:"List supported rule types",value:`${packageName} alerts rules schema`},{name:"Show the built-in rule schema",value:`${packageName} alerts rules schema --type built-in`}]},rulesAddSubcommand={name:"add",aliases:["create"],description:"Create an alert rule from a JSON body",helpSections:rulesAddHelpSections,arguments:[],options:[projectScopeOption,mutationAllOption,formatOption,jsonOption,bodyOption],examples:[{name:"Create a project-scoped rule",value:`${packageName} alerts rules add --project my-app --body ./rule.json`},{name:"Create a team-wide built-in rule",value:`${packageName} alerts rules add --all --body ./rule.json`}]},rulesInspectSubcommand={name:"inspect",aliases:["get"],description:"Show one alert rule by ID",arguments:[{name:"ruleId",required:!0}],options:[...deprecatedItemScopeOptions,formatOption,jsonOption],examples:[{name:"Inspect a rule",value:`${packageName} alerts rules inspect ar_abc123`},{name:"Write JSON output",value:`${packageName} alerts rules inspect ar_abc123 --json`}]},rulesRmSubcommand={name:"remove",aliases:["rm","delete"],description:"Delete an alert rule",arguments:[{name:"ruleId",required:!0}],options:[...deprecatedItemScopeOptions,formatOption,jsonOption,yesOption],examples:[{name:"Delete with confirmation",value:`${packageName} alerts rules remove ar_abc123`},{name:"Delete without a prompt",value:`${packageName} alerts rules remove ar_abc123 --yes`}]},rulesUpdateSubcommand={name:"update",aliases:["patch"],description:"Patch an alert rule or change its scope",helpSections:rulesUpdateHelpSections,arguments:[{name:"ruleId",required:!0}],options:[projectScopeOption,mutationAllOption,formatOption,jsonOption,{...bodyOption,description:"Read the partial update body from a JSON file"}],examples:[{name:"Update fields from a file",value:`${packageName} alerts rules update ar_abc123 --body ./patch.json`},{name:"Move a rule to a project",value:`${packageName} alerts rules update ar_abc123 --project my-app`}]},notificationTargetOptions=[{name:"webhook",shorthand:null,type:String,argument:"WEBHOOK_ID",deprecated:!1,description:"Select an account webhook by ID"},{name:"slack-channel",shorthand:null,type:String,argument:"CHANNEL_ID",deprecated:!1,description:"Select a Slack channel by ID"},{name:"slack-installation-id",shorthand:null,type:String,argument:"INSTALLATION_ID",deprecated:!1,description:"Slack installation ID. Optional only when the team has exactly one completed Slack installation."}],criticalOnlyOption={name:"critical-only",shorthand:null,type:Boolean,deprecated:!1,description:"Notify only when Vercel Agent escalates an alert to Critical"},noCriticalOnlyOption={name:"no-critical-only",shorthand:null,type:Boolean,deprecated:!1,description:"Deliver every alert matched by the rule"},rulesNotificationsLsSubcommand={name:"ls",aliases:["list"],default:!0,description:"List notification destinations for all readable rules or one alert rule",arguments:[{name:"ruleId",required:!1}],options:[formatOption,jsonOption],examples:[{name:"List notification destinations for all readable rules",value:`${packageName} alerts rules notifications ls`},{name:"List notification destinations for one rule",value:`${packageName} alerts rules notifications ls ar_abc123`},{name:"Write JSON output",value:`${packageName} alerts rules notifications ar_abc123 --json`}]},rulesNotificationsLinkSubcommand={name:"link",aliases:[],description:"Link a Slack channel or account webhook to an alert rule",arguments:[{name:"<ruleId>",required:!0}],options:[...notificationTargetOptions,criticalOnlyOption,formatOption,jsonOption],examples:[{name:"Link a Slack channel",value:`${packageName} alerts rules notifications link ar_abc123 --slack-channel C123`},{name:"Link a Slack channel from a specific installation",value:`${packageName} alerts rules notifications link ar_abc123 --slack-channel C123 --slack-installation-id icfg_abc123`},{name:"Link a webhook",value:`${packageName} alerts rules notifications link ar_abc123 --webhook wh_abc123`},{name:"Link a Critical-only webhook",value:`${packageName} alerts rules notifications link ar_abc123 --webhook wh_abc123 --critical-only`}]},rulesNotificationsUpdateSubcommand={name:"update",aliases:["patch"],description:"Update a notification destination's delivery setting",arguments:[{name:"<ruleId>",required:!0}],options:[...notificationTargetOptions,criticalOnlyOption,noCriticalOnlyOption,formatOption,jsonOption],examples:[{name:"Restrict a Slack channel to Critical alerts",value:`${packageName} alerts rules notifications update ar_abc123 --slack-channel C123 --critical-only`},{name:"Restore delivery for every alert matched by the rule",value:`${packageName} alerts rules notifications update ar_abc123 --webhook wh_abc123 --no-critical-only`}]},rulesNotificationsUnlinkSubcommand={name:"unlink",aliases:[],description:"Unlink a Slack channel or account webhook from an alert rule",arguments:[{name:"<ruleId>",required:!0}],options:[...notificationTargetOptions,formatOption,jsonOption],examples:[{name:"Unlink a Slack channel",value:`${packageName} alerts rules notifications unlink ar_abc123 --slack-channel C123`},{name:"Unlink a webhook",value:`${packageName} alerts rules notifications unlink ar_abc123 --webhook wh_abc123`}]},rulesNotificationsAggregateCommand={name:"notifications",aliases:[],description:"List and manage linked Slack and webhook destinations for alert rules",arguments:[],subcommands:[rulesNotificationsLsSubcommand,rulesNotificationsLinkSubcommand,rulesNotificationsUpdateSubcommand,rulesNotificationsUnlinkSubcommand],options:[formatOption,jsonOption],examples:[{name:"List destinations for all readable rules",value:`${packageName} alerts rules notifications`},{name:"List destinations for one rule",value:`${packageName} alerts rules notifications ar_abc123`},{name:"Link Slack with the team's only installation",value:`${packageName} alerts rules notifications link ar_abc123 --slack-channel C123`}]},rulesAggregateCommand={name:"rules",aliases:[],description:"Create, inspect, list, update, and delete alert rules and manage their notification destinations",arguments:[],subcommands:[rulesLsSubcommand,rulesSchemaSubcommand,rulesAddSubcommand,rulesInspectSubcommand,rulesRmSubcommand,rulesUpdateSubcommand,rulesNotificationsAggregateCommand],options:[],examples:[{name:"List rules for the linked project",value:`${packageName} alerts rules ls`},{name:"Add a rule",value:`${packageName} alerts rules add --project my-app --body ./rule.json`},{name:"Inspect a rule",value:`${packageName} alerts rules inspect ar_abc123`},{name:"Update a rule",value:`${packageName} alerts rules update ar_abc123 --body ./patch.json`},{name:"Delete a rule",value:`${packageName} alerts rules remove ar_abc123`},{name:"List notification destinations for a rule",value:`${packageName} alerts rules notifications ar_abc123`}]};export{rulesLsSubcommand,rulesSchemaSubcommand,rulesAddSubcommand,rulesInspectSubcommand,rulesRmSubcommand,rulesUpdateSubcommand,rulesNotificationsLsSubcommand,rulesNotificationsLinkSubcommand,rulesNotificationsUpdateSubcommand,rulesNotificationsUnlinkSubcommand,rulesNotificationsAggregateCommand,rulesAggregateCommand};
|
|
@@ -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-J2LAZELI.js";import{getScope}from"./chunk-
|
|
7
|
+
import{require_dist}from"./chunk-O4FDRZ22.js";import{getDeployment}from"./chunk-J2LAZELI.js";import{getScope}from"./chunk-J53D7SLS.js";import{toNodeReadable}from"./chunk-MY4MONOH.js";import{output_manager_default}from"./chunk-75IAMKGV.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};
|