vercel 56.2.1 → 56.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. package/dist/chunks/{add-YIAPBLSF.js → add-CF5SQESQ.js} +10 -13
  2. package/dist/chunks/{add-ZAQLTF5W.js → add-DMRGZN3Z.js} +9 -12
  3. package/dist/chunks/{chunk-75PKWYOS.js → chunk-22G26AIX.js} +99 -74
  4. package/dist/chunks/{chunk-7OJJKCSW.js → chunk-2C2JJTAM.js} +6 -10
  5. package/dist/chunks/{chunk-DDEPCAGE.js → chunk-2MXGTALG.js} +529 -164
  6. package/dist/chunks/{chunk-5AJNUXWP.js → chunk-3PKFXNJZ.js} +2 -4
  7. package/dist/chunks/{chunk-5OT26JZN.js → chunk-3VS4DTAU.js} +4 -6
  8. package/dist/chunks/{chunk-JJWESW5Y.js → chunk-4G6QZSBL.js} +2 -4
  9. package/dist/chunks/{chunk-NULWLKT7.js → chunk-4YOCOUDN.js} +4 -4
  10. package/dist/chunks/{chunk-GXBDQRHJ.js → chunk-4Z5LC2CI.js} +1 -1
  11. package/dist/chunks/{chunk-CMJMYVQM.js → chunk-6OMC3HOW.js} +1 -1
  12. package/dist/chunks/{chunk-JF7LPEBD.js → chunk-A6LE5VAN.js} +1 -1
  13. package/dist/chunks/{chunk-QY63UKTP.js → chunk-DMSLNAVH.js} +2 -2
  14. package/dist/chunks/{chunk-52V5NDUN.js → chunk-DZHRFBKE.js} +2 -2
  15. package/dist/chunks/{chunk-MYD7N6MH.js → chunk-ERPZJ4SX.js} +13 -3
  16. package/dist/chunks/{chunk-YKJA5TVC.js → chunk-EYNXG3FO.js} +3 -5
  17. package/dist/chunks/{chunk-RLJA2KI7.js → chunk-FYQPTH5C.js} +2 -4
  18. package/dist/chunks/{chunk-7TJLLZPN.js → chunk-G4PG5HVE.js} +6 -10
  19. package/dist/chunks/{chunk-7C7MMT4J.js → chunk-GIL3VAUR.js} +2 -4
  20. package/dist/chunks/{chunk-GPVU6JRS.js → chunk-HUKYQKVQ.js} +9 -7
  21. package/dist/chunks/{chunk-EPBUWIAO.js → chunk-I2IICWBW.js} +48 -24
  22. package/dist/chunks/{chunk-KXVQEPTA.js → chunk-ICSIFPXG.js} +3 -5
  23. package/dist/chunks/{chunk-P6AK7SVK.js → chunk-KSSNLCL4.js} +360 -25
  24. package/dist/chunks/{chunk-HIO4M75R.js → chunk-KXKQQIUS.js} +6 -10
  25. package/dist/chunks/{chunk-HA7C7SDO.js → chunk-LHFNIZ2P.js} +2 -4
  26. package/dist/chunks/{chunk-2I34TRQZ.js → chunk-NP32PAKT.js} +2 -2
  27. package/dist/chunks/{chunk-QEEGXNFK.js → chunk-NZRWTCRM.js} +1 -1
  28. package/dist/chunks/{chunk-IDMKFYEA.js → chunk-OGG6UBXK.js} +2 -4
  29. package/dist/chunks/{chunk-PASZMRTZ.js → chunk-PRO4S2KV.js} +5 -5
  30. package/dist/chunks/{chunk-DD6D5J7E.js → chunk-Q5ADSH7D.js} +8 -12
  31. package/dist/chunks/{chunk-6ZVIC6FL.js → chunk-QP3C5YS5.js} +8 -8
  32. package/dist/chunks/{chunk-5HNYJHOB.js → chunk-SDK7R4WO.js} +1 -1
  33. package/dist/chunks/{chunk-22GUZ5KG.js → chunk-STJJ3DFO.js} +2 -4
  34. package/dist/chunks/{chunk-EHTPDXTS.js → chunk-SZXT3PDQ.js} +3 -294
  35. package/dist/chunks/{chunk-CB3I3QIT.js → chunk-UDWRZXIT.js} +193 -85
  36. package/dist/chunks/{chunk-DREO3DFB.js → chunk-VZSZBD4V.js} +16 -6
  37. package/dist/chunks/{chunk-VOBBH2SB.js → chunk-W346YNDN.js} +0 -49
  38. package/dist/chunks/{chunk-7S3QUMIG.js → chunk-YS6EDZHB.js} +3 -5
  39. package/dist/chunks/{chunk-UESEGACQ.js → chunk-ZDCS54ZZ.js} +3 -3
  40. package/dist/chunks/{chunk-4RGSUV5C.js → chunk-ZVLPUREX.js} +2 -2
  41. package/dist/chunks/{compile-vercel-config-4NKPN3EG.js → compile-vercel-config-RPPL7W56.js} +4 -4
  42. package/dist/chunks/{delete-NCMDC3IU.js → delete-QBVZ5X6B.js} +14 -14
  43. package/dist/chunks/{disable-Z7DXY4AY.js → disable-YYGXPXBI.js} +14 -13
  44. package/dist/chunks/{discard-4ILK3ULP.js → discard-X2MSUFGI.js} +13 -12
  45. package/dist/chunks/{edit-ROJQCTWR.js → edit-3ABZQYUU.js} +17 -18
  46. package/dist/chunks/{enable-TAVCLAEC.js → enable-HUMYCGKA.js} +14 -13
  47. package/dist/chunks/{export-YTSIGJFX.js → export-KGHH4WAT.js} +15 -14
  48. package/dist/chunks/{image-LORSHERP.js → image-OO3WWKZV.js} +6 -8
  49. package/dist/chunks/{inspect-5C4UHSCT.js → inspect-5TNHHD2M.js} +10 -12
  50. package/dist/chunks/{inspect-OHDU2SVS.js → inspect-FNUCB7Y3.js} +8 -10
  51. package/dist/chunks/{inspect-L4UIWOXO.js → inspect-KSSQEAW7.js} +11 -15
  52. package/dist/chunks/{inspect-A2X7RTP4.js → inspect-Z6SSD2SR.js} +8 -10
  53. package/dist/chunks/{list-FGVDMSFN.js → list-TXNYRVJG.js} +8 -10
  54. package/dist/chunks/{list-P2B5MHON.js → list-X2AD3HCX.js} +10 -13
  55. package/dist/chunks/{login-4BK3VGII.js → login-SLPCZ2OF.js} +11 -14
  56. package/dist/chunks/{ls-YXKRRYTL.js → ls-2YSINRJ3.js} +10 -13
  57. package/dist/chunks/{ls-NU4D6TLG.js → ls-4QMJLQQL.js} +10 -13
  58. package/dist/chunks/{ls-WDRFGE2J.js → ls-C7MNQ4IK.js} +12 -15
  59. package/dist/chunks/{ls-RAC5LMTR.js → ls-QLTOY23G.js} +9 -12
  60. package/dist/chunks/{publish-DGF2TQCQ.js → publish-GV4LLLXP.js} +13 -12
  61. package/dist/chunks/{query-NWW6RDHK.js → query-3AHRMAPA.js} +10 -12
  62. package/dist/chunks/{reorder-TTZBKCEB.js → reorder-VSVOPNM4.js} +17 -16
  63. package/dist/chunks/{restore-DG3LZMHQ.js → restore-FKYCF73P.js} +19 -18
  64. package/dist/chunks/{rm-7WXXLTXF.js → rm-4QCXZRC2.js} +10 -13
  65. package/dist/chunks/{rm-U2DFRDKE.js → rm-UTFG42FN.js} +8 -11
  66. package/dist/chunks/{rm-2VBE4C2V.js → rm-YV5WQKQM.js} +9 -12
  67. package/dist/chunks/{rule-inspect-4NL3GGDB.js → rule-inspect-IONN4MTP.js} +9 -12
  68. package/dist/chunks/{rules-DABNOUNG.js → rules-S2KPV7HY.js} +9 -11
  69. package/dist/chunks/{schema-4RRRUUOO.js → schema-3LX3V2HE.js} +11 -12
  70. package/dist/chunks/{tags-MLX3AHHK.js → tags-CQ4FRIJ4.js} +5 -7
  71. package/dist/chunks/{types-2TPA6J4G.js → types-QKLIFDDP.js} +5 -5
  72. package/dist/chunks/{update-YXH7WWTN.js → update-U7OGHCP5.js} +9 -12
  73. package/dist/commands/build/index.js +26 -31
  74. package/dist/commands/deploy/index.js +57 -75
  75. package/dist/commands/dev/index.js +193 -159
  76. package/dist/commands/env/index.js +70 -47
  77. package/dist/commands/link/index.js +25 -29
  78. package/dist/commands/list/index.js +13 -17
  79. package/dist/commands-bulk.js +637 -620
  80. package/dist/index.js +23 -25
  81. package/dist/version.mjs +1 -1
  82. package/package.json +20 -20
  83. package/dist/chunks/chunk-DWU7JOO6.js +0 -158
  84. package/dist/chunks/chunk-IC4YEIGW.js +0 -101
  85. package/dist/chunks/chunk-IMUF5MGV.js +0 -81
  86. package/dist/chunks/chunk-SGL3NMOP.js +0 -86
@@ -31,13 +31,12 @@ import {
31
31
  runInteractiveEditLoop,
32
32
  stripQuotes,
33
33
  validateActionFlags
34
- } from "./chunks/chunk-5HNYJHOB.js";
34
+ } from "./chunks/chunk-SDK7R4WO.js";
35
35
  import {
36
36
  getRouteVersions
37
37
  } from "./chunks/chunk-AHU7WNL2.js";
38
38
  import {
39
39
  TRANSFORM_TYPE_LABELS,
40
- ensureProjectLink,
41
40
  findVersionById,
42
41
  formatCondition,
43
42
  formatTransform,
@@ -48,8 +47,11 @@ import {
48
47
  offerAutoPromote,
49
48
  parsePosition,
50
49
  parseSubcommandArgs,
51
- withGlobalFlags
52
- } from "./chunks/chunk-75PKWYOS.js";
50
+ parseSubcommandArguments,
51
+ requireProjectContext,
52
+ validateRequiredArguments,
53
+ withGlobalFlags as withGlobalFlags2
54
+ } from "./chunks/chunk-22G26AIX.js";
53
55
  import {
54
56
  normalizeRepeatableStringFilters,
55
57
  parseTimeFlag
@@ -66,11 +68,11 @@ import {
66
68
  resolveOpenApiTagForTeamsCli,
67
69
  setAutoUpdate,
68
70
  tryOpenApiFallback
69
- } from "./chunks/chunk-6ZVIC6FL.js";
71
+ } from "./chunks/chunk-QP3C5YS5.js";
70
72
  import {
71
73
  getUpdateCommand,
72
74
  isGlobal
73
- } from "./chunks/chunk-52V5NDUN.js";
75
+ } from "./chunks/chunk-DZHRFBKE.js";
74
76
  import {
75
77
  Now,
76
78
  addDomain,
@@ -92,14 +94,14 @@ import {
92
94
  require_format,
93
95
  require_jsonlines,
94
96
  setupDomain
95
- } from "./chunks/chunk-DD6D5J7E.js";
97
+ } from "./chunks/chunk-Q5ADSH7D.js";
96
98
  import {
97
99
  getGlobalPathConfig,
98
100
  persistAuthConfig,
99
101
  readLocalConfig,
100
102
  sleep,
101
103
  writeToConfigFile
102
- } from "./chunks/chunk-NULWLKT7.js";
104
+ } from "./chunks/chunk-4YOCOUDN.js";
103
105
  import "./chunks/chunk-V5P25P7F.js";
104
106
  import {
105
107
  CHECKBOX_INSTRUCTIONS,
@@ -107,15 +109,14 @@ import {
107
109
  getCustomEnvironments,
108
110
  pickCustomEnvironment,
109
111
  readStandardInput,
110
- require_dist as require_dist4,
111
- resolveProjectContext
112
- } from "./chunks/chunk-VOBBH2SB.js";
112
+ require_dist as require_dist4
113
+ } from "./chunks/chunk-W346YNDN.js";
113
114
  import {
114
115
  getInvalidSubcommand
115
116
  } from "./chunks/chunk-VGIMO3ZK.js";
116
117
  import {
117
118
  formatTable
118
- } from "./chunks/chunk-4RGSUV5C.js";
119
+ } from "./chunks/chunk-ZVLPUREX.js";
119
120
  import "./chunks/chunk-XBN2O34P.js";
120
121
  import {
121
122
  getPaginationOpts,
@@ -124,15 +125,10 @@ import {
124
125
  import {
125
126
  getCommandFlags
126
127
  } from "./chunks/chunk-EOZFDJSY.js";
127
- import {
128
- getDeployment,
129
- mapCertError,
130
- toHost
131
- } from "./chunks/chunk-SGL3NMOP.js";
132
128
  import {
133
129
  formatEnvironment,
134
130
  validateLsArgs
135
- } from "./chunks/chunk-2I34TRQZ.js";
131
+ } from "./chunks/chunk-NP32PAKT.js";
136
132
  import {
137
133
  validateJsonOutput
138
134
  } from "./chunks/chunk-XPKWKPWA.js";
@@ -419,7 +415,7 @@ import {
419
415
  webAnalyticsSubcommand,
420
416
  webhooksCommand,
421
417
  whoamiCommand
422
- } from "./chunks/chunk-EPBUWIAO.js";
418
+ } from "./chunks/chunk-I2IICWBW.js";
423
419
  import {
424
420
  addSubcommand as addSubcommand12,
425
421
  inspectSubcommand as inspectSubcommand8,
@@ -427,22 +423,22 @@ import {
427
423
  loginSubcommand,
428
424
  removeSubcommand as removeSubcommand14,
429
425
  vcrCommand
430
- } from "./chunks/chunk-5OT26JZN.js";
426
+ } from "./chunks/chunk-3VS4DTAU.js";
431
427
  import {
432
428
  tagsAggregateCommand,
433
429
  tagsInspectSubcommand,
434
430
  tagsLsSubcommand
435
- } from "./chunks/chunk-7C7MMT4J.js";
431
+ } from "./chunks/chunk-GIL3VAUR.js";
436
432
  import {
437
433
  imageAggregateCommand,
438
434
  imageInspectSubcommand,
439
435
  imageLsSubcommand,
440
436
  imageRmSubcommand
441
- } from "./chunks/chunk-RLJA2KI7.js";
437
+ } from "./chunks/chunk-FYQPTH5C.js";
442
438
  import {
443
439
  metricsCommand,
444
440
  schemaSubcommand
445
- } from "./chunks/chunk-JJWESW5Y.js";
441
+ } from "./chunks/chunk-4G6QZSBL.js";
446
442
  import {
447
443
  addSubcommand as addSubcommand9,
448
444
  deleteSubcommand,
@@ -458,16 +454,16 @@ import {
458
454
  reorderSubcommand,
459
455
  restoreSubcommand as restoreSubcommand2,
460
456
  routesCommand
461
- } from "./chunks/chunk-DREO3DFB.js";
457
+ } from "./chunks/chunk-VZSZBD4V.js";
462
458
  import {
463
459
  activityCommand,
464
460
  typesSubcommand
465
- } from "./chunks/chunk-5AJNUXWP.js";
461
+ } from "./chunks/chunk-3PKFXNJZ.js";
466
462
  import {
467
463
  alertsCommand,
468
464
  inspectSubcommand as inspectSubcommand2,
469
465
  listSubcommand as listSubcommand2
470
- } from "./chunks/chunk-7S3QUMIG.js";
466
+ } from "./chunks/chunk-YS6EDZHB.js";
471
467
  import {
472
468
  rulesAddSubcommand as rulesAddSubcommand2,
473
469
  rulesAggregateCommand,
@@ -475,14 +471,14 @@ import {
475
471
  rulesLsSubcommand,
476
472
  rulesRmSubcommand,
477
473
  rulesUpdateSubcommand
478
- } from "./chunks/chunk-22GUZ5KG.js";
479
- import "./chunks/chunk-IDMKFYEA.js";
480
- import "./chunks/chunk-HA7C7SDO.js";
474
+ } from "./chunks/chunk-STJJ3DFO.js";
475
+ import "./chunks/chunk-OGG6UBXK.js";
476
+ import "./chunks/chunk-LHFNIZ2P.js";
481
477
  import {
482
478
  main
483
- } from "./chunks/chunk-GPVU6JRS.js";
479
+ } from "./chunks/chunk-HUKYQKVQ.js";
484
480
  import "./chunks/chunk-IB5L4LKZ.js";
485
- import "./chunks/chunk-JF7LPEBD.js";
481
+ import "./chunks/chunk-A6LE5VAN.js";
486
482
  import {
487
483
  require_execa
488
484
  } from "./chunks/chunk-R6IGDGX3.js";
@@ -497,26 +493,16 @@ import {
497
493
  } from "./chunks/chunk-VXYGCOKL.js";
498
494
  import {
499
495
  ensureLink
500
- } from "./chunks/chunk-HIO4M75R.js";
501
- import "./chunks/chunk-PASZMRTZ.js";
502
- import "./chunks/chunk-UESEGACQ.js";
503
- import "./chunks/chunk-IMUF5MGV.js";
504
- import {
505
- AGENT_ACTION,
506
- AGENT_REASON,
507
- AGENT_STATUS
508
- } from "./chunks/chunk-IC4YEIGW.js";
509
- import "./chunks/chunk-YKJA5TVC.js";
496
+ } from "./chunks/chunk-KXKQQIUS.js";
497
+ import "./chunks/chunk-PRO4S2KV.js";
498
+ import "./chunks/chunk-ZDCS54ZZ.js";
499
+ import "./chunks/chunk-EYNXG3FO.js";
510
500
  import {
511
501
  help
512
- } from "./chunks/chunk-QY63UKTP.js";
502
+ } from "./chunks/chunk-DMSLNAVH.js";
513
503
  import {
514
504
  table
515
- } from "./chunks/chunk-QEEGXNFK.js";
516
- import {
517
- detectExplicitScope,
518
- getScope
519
- } from "./chunks/chunk-DWU7JOO6.js";
505
+ } from "./chunks/chunk-NZRWTCRM.js";
520
506
  import {
521
507
  ALIGNED_LABEL_WIDTH,
522
508
  STANDARD_ENVIRONMENTS,
@@ -526,14 +512,17 @@ import {
526
512
  createEnvObject,
527
513
  createGitMeta,
528
514
  createProject,
515
+ detectExplicitScope,
529
516
  disconnectGitProvider,
530
517
  envPullCommandLogic,
531
518
  envTargetChoices,
532
519
  formatProject,
520
+ getDeployment,
533
521
  getLinkFromDir,
534
522
  getLinkedProject,
535
523
  getProjectByNameOrId,
536
524
  getProjectLink,
525
+ getScope,
537
526
  getTeamById,
538
527
  getTeams,
539
528
  getUser,
@@ -543,6 +532,7 @@ import {
543
532
  isValidEnvTarget,
544
533
  isVercelTomlEnabled,
545
534
  list,
535
+ mapCertError,
546
536
  modify,
547
537
  param,
548
538
  parseGitConfig,
@@ -564,13 +554,18 @@ import {
564
554
  require_pluralize,
565
555
  require_pump,
566
556
  require_tar_stream,
557
+ resolveProjectContext,
567
558
  resolveProjectCwd,
568
559
  revocationRequest,
569
560
  selectAndParseRemoteUrl,
570
561
  selectOrg,
562
+ toHost,
571
563
  ua_default
572
- } from "./chunks/chunk-DDEPCAGE.js";
564
+ } from "./chunks/chunk-2MXGTALG.js";
573
565
  import {
566
+ AGENT_ACTION,
567
+ AGENT_REASON,
568
+ AGENT_STATUS,
574
569
  argvHasNonInteractive,
575
570
  buildCommandWithGlobalFlags,
576
571
  buildCommandWithYes,
@@ -580,22 +575,17 @@ import {
580
575
  outputActionRequired,
581
576
  outputAgentError,
582
577
  outputAgentSuccess,
583
- shouldEmitNonInteractiveCommandError
584
- } from "./chunks/chunk-CB3I3QIT.js";
578
+ shouldEmitNonInteractiveCommandError,
579
+ withGlobalFlags
580
+ } from "./chunks/chunk-UDWRZXIT.js";
585
581
  import {
586
582
  TelemetryClient
587
583
  } from "./chunks/chunk-ECCWJHC6.js";
588
584
  import {
589
- GLOBAL_CLI_FLAG_NAMES,
590
- getCommandNameWithGlobalFlags,
591
- getFlagsSpecification,
592
- getGlobalFlagsOnlyFromArgs,
593
- getSameSubcommandSuggestionFlags,
594
- globalCliFlagTakesValue,
595
585
  parseArguments,
596
586
  printError,
597
587
  require_strip_ansi
598
- } from "./chunks/chunk-EHTPDXTS.js";
588
+ } from "./chunks/chunk-SZXT3PDQ.js";
599
589
  import {
600
590
  APIError,
601
591
  AliasInUse,
@@ -643,12 +633,16 @@ import {
643
633
  code,
644
634
  getCommandName,
645
635
  getCommandNamePlain,
636
+ getFlagsSpecification,
637
+ getGlobalFlagsFromArgs,
638
+ getProjectOptionFromArgs,
639
+ getSameSubcommandSuggestionFlags,
646
640
  isAPIError,
647
641
  packageName,
648
642
  require_bytes,
649
643
  require_lib as require_lib2,
650
644
  stripSensitiveAuthArgs
651
- } from "./chunks/chunk-P6AK7SVK.js";
645
+ } from "./chunks/chunk-KSSNLCL4.js";
652
646
  import {
653
647
  pkg_default
654
648
  } from "./chunks/chunk-P4QNYOFB.js";
@@ -2392,7 +2386,7 @@ async function activity(client) {
2392
2386
  return 0;
2393
2387
  }
2394
2388
  telemetry2.trackCliSubcommandTypes(subcommandOriginal);
2395
- const typesFn = (await import("./chunks/types-2TPA6J4G.js")).default;
2389
+ const typesFn = (await import("./chunks/types-QKLIFDDP.js")).default;
2396
2390
  return typesFn(client, telemetry2);
2397
2391
  }
2398
2392
  default: {
@@ -2402,7 +2396,7 @@ async function activity(client) {
2402
2396
  return 0;
2403
2397
  }
2404
2398
  telemetry2.trackCliSubcommandLs(subcommandOriginal);
2405
- const listFn = (await import("./chunks/list-FGVDMSFN.js")).default;
2399
+ const listFn = (await import("./chunks/list-TXNYRVJG.js")).default;
2406
2400
  return listFn(client, telemetry2);
2407
2401
  }
2408
2402
  }
@@ -5894,12 +5888,12 @@ async function alerts(client) {
5894
5888
  switch (subcommand) {
5895
5889
  case "inspect": {
5896
5890
  telemetry2.trackCliSubcommandInspect(subcommandOriginal);
5897
- const inspectFn = (await import("./chunks/inspect-L4UIWOXO.js")).default;
5891
+ const inspectFn = (await import("./chunks/inspect-KSSQEAW7.js")).default;
5898
5892
  return inspectFn(client, args);
5899
5893
  }
5900
5894
  case "rules": {
5901
5895
  telemetry2.trackCliSubcommandRules(args[0] ?? "ls");
5902
- const rulesFn = (await import("./chunks/rules-DABNOUNG.js")).default;
5896
+ const rulesFn = (await import("./chunks/rules-S2KPV7HY.js")).default;
5903
5897
  const rulesArgs = [...args];
5904
5898
  const project = parsedArgs.flags["--project"];
5905
5899
  const format4 = parsedArgs.flags["--format"];
@@ -5913,7 +5907,7 @@ async function alerts(client) {
5913
5907
  }
5914
5908
  default: {
5915
5909
  telemetry2.trackCliSubcommandLs(subcommandOriginal);
5916
- const listFn = (await import("./chunks/list-P2B5MHON.js")).default;
5910
+ const listFn = (await import("./chunks/list-X2AD3HCX.js")).default;
5917
5911
  return listFn(client, telemetry2);
5918
5912
  }
5919
5913
  }
@@ -10200,7 +10194,7 @@ async function buy(client, argv) {
10200
10194
  telemetry2.trackCliArgumentDomain(domainName);
10201
10195
  if (!domainName) {
10202
10196
  if (client.nonInteractive) {
10203
- const flags = getGlobalFlagsOnlyFromArgs(client.argv.slice(2));
10197
+ const flags = getGlobalFlagsFromArgs(client.argv.slice(2));
10204
10198
  const cmd2 = getCommandNamePlain(
10205
10199
  `domains buy <domain> ${flags.join(" ")}`.trim()
10206
10200
  );
@@ -10226,7 +10220,7 @@ async function buy(client, argv) {
10226
10220
  return 1;
10227
10221
  }
10228
10222
  if (client.nonInteractive) {
10229
- const flags = getGlobalFlagsOnlyFromArgs(client.argv.slice(2));
10223
+ const flags = getGlobalFlagsFromArgs(client.argv.slice(2));
10230
10224
  const interactiveCmd = getCommandNamePlain(
10231
10225
  `domains buy ${domainName} ${flags.filter((f) => f !== "--non-interactive").join(" ")}`.trim()
10232
10226
  );
@@ -16451,7 +16445,7 @@ var DeployHooksRmTelemetryClient = class extends TelemetryClient {
16451
16445
 
16452
16446
  // src/commands/deploy-hooks/rm.ts
16453
16447
  function deployHooksCommandWithGlobalFlags(baseSubcommand, argv) {
16454
- const globalFlags = getGlobalFlagsOnlyFromArgs(argv.slice(2));
16448
+ const globalFlags = getGlobalFlagsFromArgs(argv.slice(2));
16455
16449
  const full = globalFlags.length ? `${baseSubcommand} ${globalFlags.join(" ")}` : baseSubcommand;
16456
16450
  return getCommandNamePlain(full);
16457
16451
  }
@@ -16923,10 +16917,6 @@ var DnsAddTelemetryClient = class extends TelemetryClient {
16923
16917
  };
16924
16918
 
16925
16919
  // src/commands/dns/add.ts
16926
- function withGlobalFlags2(client, commandTemplate) {
16927
- const flags = getGlobalFlagsOnlyFromArgs(client.argv.slice(2));
16928
- return getCommandNamePlain(`${commandTemplate} ${flags.join(" ")}`.trim());
16929
- }
16930
16920
  async function add4(client, argv) {
16931
16921
  let parsedArgs;
16932
16922
  const flagsSpecification = getFlagsSpecification(addSubcommand3.options);
@@ -16951,7 +16941,7 @@ async function add4(client, argv) {
16951
16941
  const parsedParams = parseAddArgs(args);
16952
16942
  if (!parsedParams) {
16953
16943
  if (client.nonInteractive) {
16954
- const cmd2 = withGlobalFlags2(
16944
+ const cmd2 = withGlobalFlags(
16955
16945
  client,
16956
16946
  "dns add <domain> <name> <type> <value>"
16957
16947
  );
@@ -16983,7 +16973,7 @@ async function add4(client, argv) {
16983
16973
  const { domain: domain2, data: argData } = parsedParams;
16984
16974
  const valueArgs = args.slice(3);
16985
16975
  if (client.nonInteractive && !argData) {
16986
- const cmd2 = withGlobalFlags2(
16976
+ const cmd2 = withGlobalFlags(
16987
16977
  client,
16988
16978
  "dns add <domain> <name> <type> <value>"
16989
16979
  );
@@ -17000,7 +16990,7 @@ async function add4(client, argv) {
17000
16990
  when: "to add a DNS record (replace placeholders)"
17001
16991
  },
17002
16992
  {
17003
- command: withGlobalFlags2(client, "dns --help"),
16993
+ command: withGlobalFlags(client, "dns --help"),
17004
16994
  when: "for usage and examples"
17005
16995
  }
17006
16996
  ]
@@ -17029,7 +17019,7 @@ async function add4(client, argv) {
17029
17019
  message: "Record details could not be determined non-interactively. Provide full arguments for dns add.",
17030
17020
  next: [
17031
17021
  {
17032
- command: withGlobalFlags2(client, "dns --help")
17022
+ command: withGlobalFlags(client, "dns --help")
17033
17023
  }
17034
17024
  ]
17035
17025
  },
@@ -17051,7 +17041,7 @@ async function add4(client, argv) {
17051
17041
  message: `The domain ${domain2} can't be found under ${contextName}.`,
17052
17042
  next: [
17053
17043
  {
17054
- command: withGlobalFlags2(client, "dns ls"),
17044
+ command: withGlobalFlags(client, "dns ls"),
17055
17045
  when: "to list DNS records for your scope"
17056
17046
  }
17057
17047
  ]
@@ -17204,10 +17194,6 @@ var DnsImportTelemetryClient = class extends TelemetryClient {
17204
17194
  };
17205
17195
 
17206
17196
  // src/commands/dns/import.ts
17207
- function withGlobalFlags3(client, commandTemplate) {
17208
- const flags = getGlobalFlagsOnlyFromArgs(client.argv.slice(2));
17209
- return getCommandNamePlain(`${commandTemplate} ${flags.join(" ")}`.trim());
17210
- }
17211
17197
  async function importZone(client, argv) {
17212
17198
  let parsedArgs;
17213
17199
  const flagsSpecification = getFlagsSpecification(importSubcommand.options);
@@ -17238,7 +17224,7 @@ async function importZone(client, argv) {
17238
17224
  });
17239
17225
  if (args.length !== 2) {
17240
17226
  if (client.nonInteractive) {
17241
- const cmd2 = withGlobalFlags3(client, "dns import <domain> <zonefile>");
17227
+ const cmd2 = withGlobalFlags(client, "dns import <domain> <zonefile>");
17242
17228
  outputActionRequired(
17243
17229
  client,
17244
17230
  {
@@ -17283,7 +17269,7 @@ async function importZone(client, argv) {
17283
17269
  message: `The domain ${domain2} can't be found under ${contextName}.`,
17284
17270
  next: [
17285
17271
  {
17286
- command: withGlobalFlags3(client, "dns ls"),
17272
+ command: withGlobalFlags(client, "dns ls"),
17287
17273
  when: "to list DNS records for your scope"
17288
17274
  }
17289
17275
  ]
@@ -17452,7 +17438,7 @@ async function ls5(client, argv) {
17452
17438
  }
17453
17439
  const { args, flags: opts } = parsedArgs;
17454
17440
  if (client.nonInteractive && args.length > 1) {
17455
- const flags = getGlobalFlagsOnlyFromArgs(client.argv.slice(2));
17441
+ const flags = getGlobalFlagsFromArgs(client.argv.slice(2));
17456
17442
  const cmd2 = getCommandNamePlain(
17457
17443
  `dns ls <domain> ${flags.join(" ")}`.trim()
17458
17444
  );
@@ -17511,7 +17497,7 @@ async function ls5(client, argv) {
17511
17497
  );
17512
17498
  if (data instanceof DomainNotFound) {
17513
17499
  if (client.nonInteractive) {
17514
- const flags = getGlobalFlagsOnlyFromArgs(client.argv.slice(2));
17500
+ const flags = getGlobalFlagsFromArgs(client.argv.slice(2));
17515
17501
  const cmd2 = getCommandNamePlain(`dns ls ${flags.join(" ")}`.trim());
17516
17502
  outputAgentError(
17517
17503
  client,
@@ -17631,10 +17617,6 @@ var DnsRmTelemetryClient = class extends TelemetryClient {
17631
17617
  };
17632
17618
 
17633
17619
  // src/commands/dns/rm.ts
17634
- function withGlobalFlags4(client, commandTemplate) {
17635
- const flags = getGlobalFlagsOnlyFromArgs(client.argv.slice(2));
17636
- return getCommandNamePlain(`${commandTemplate} ${flags.join(" ")}`.trim());
17637
- }
17638
17620
  async function rm5(client, argv) {
17639
17621
  let parsedArgs;
17640
17622
  const flagsSpecification = getFlagsSpecification(removeSubcommand5.options);
@@ -17666,7 +17648,7 @@ async function rm5(client, argv) {
17666
17648
  const [recordId] = args;
17667
17649
  if (args.length !== 1) {
17668
17650
  if (client.nonInteractive) {
17669
- const cmd2 = withGlobalFlags4(client, "dns rm <id> --yes");
17651
+ const cmd2 = withGlobalFlags(client, "dns rm <id> --yes");
17670
17652
  outputActionRequired(
17671
17653
  client,
17672
17654
  {
@@ -17704,7 +17686,7 @@ async function rm5(client, argv) {
17704
17686
  message: "DNS record not found.",
17705
17687
  next: [
17706
17688
  {
17707
- command: withGlobalFlags4(client, "dns ls"),
17689
+ command: withGlobalFlags(client, "dns ls"),
17708
17690
  when: "to list DNS records and ids"
17709
17691
  }
17710
17692
  ]
@@ -18037,15 +18019,11 @@ var DomainsAddTelemetryClient = class extends TelemetryClient {
18037
18019
 
18038
18020
  // src/commands/domains/add.ts
18039
18021
  var import_error_utils8 = __toESM(require_dist(), 1);
18040
- function withGlobalFlags5(client, commandTemplate) {
18041
- const flags = getGlobalFlagsOnlyFromArgs(client.argv.slice(2));
18042
- return getCommandNamePlain(`${commandTemplate} ${flags.join(" ")}`.trim());
18043
- }
18044
18022
  var VERCEL_DOMAINS_DASHBOARD = "https://vercel.com/dashboard/domains";
18045
18023
  function nextCommandsForDomainsAddFailure(client, domainName, projectName, err) {
18046
18024
  const next = [
18047
18025
  {
18048
- command: withGlobalFlags5(client, `domains inspect ${domainName}`),
18026
+ command: withGlobalFlags(client, `domains inspect ${domainName}`),
18049
18027
  when: "to inspect domain configuration and ownership"
18050
18028
  }
18051
18029
  ];
@@ -18057,11 +18035,11 @@ function nextCommandsForDomainsAddFailure(client, domainName, projectName, err)
18057
18035
  const aliasConflict = code2 === "ALIAS_DOMAIN_EXIST" || status3 === 409 || msg.includes("already assigned") || msg.includes("already in use");
18058
18036
  if (looksLikeOwnershipOrPurchaseIssue || aliasConflict) {
18059
18037
  next.push({
18060
- command: withGlobalFlags5(client, `domains buy ${domainName}`),
18038
+ command: withGlobalFlags(client, `domains buy ${domainName}`),
18061
18039
  when: "user must run interactively in a terminal\u2014agents must not purchase; purchase also available in dashboard"
18062
18040
  });
18063
18041
  next.push({
18064
- command: withGlobalFlags5(client, "domains transfer-in"),
18042
+ command: withGlobalFlags(client, "domains transfer-in"),
18065
18043
  when: "to transfer a domain you already own from another registrar into Vercel"
18066
18044
  });
18067
18045
  next.push({
@@ -18071,7 +18049,7 @@ function nextCommandsForDomainsAddFailure(client, domainName, projectName, err)
18071
18049
  }
18072
18050
  if (aliasConflict && !looksLikeOwnershipOrPurchaseIssue && projectName) {
18073
18051
  next.push({
18074
- command: withGlobalFlags5(
18052
+ command: withGlobalFlags(
18075
18053
  client,
18076
18054
  `domains add ${domainName} ${projectName} --force`
18077
18055
  ),
@@ -18084,22 +18062,22 @@ function nextCommandsForDomainsAddSuccess(client, domainName, projectName) {
18084
18062
  if (!projectName) {
18085
18063
  return [
18086
18064
  {
18087
- command: withGlobalFlags5(client, `domains add ${domainName} <project>`),
18065
+ command: withGlobalFlags(client, `domains add ${domainName} <project>`),
18088
18066
  when: "to attach this domain to a project"
18089
18067
  },
18090
18068
  {
18091
- command: withGlobalFlags5(client, `domains inspect ${domainName}`),
18069
+ command: withGlobalFlags(client, `domains inspect ${domainName}`),
18092
18070
  when: "to inspect domain configuration and ownership"
18093
18071
  }
18094
18072
  ];
18095
18073
  }
18096
18074
  return [
18097
18075
  {
18098
- command: withGlobalFlags5(client, `domains verify ${domainName}`),
18076
+ command: withGlobalFlags(client, `domains verify ${domainName}`),
18099
18077
  when: "to check DNS configuration and see the records you need to set"
18100
18078
  },
18101
18079
  {
18102
- command: withGlobalFlags5(client, `domains inspect ${domainName}`),
18080
+ command: withGlobalFlags(client, `domains inspect ${domainName}`),
18103
18081
  when: "to inspect domain configuration and ownership"
18104
18082
  }
18105
18083
  ];
@@ -18153,10 +18131,10 @@ async function add5(client, argv) {
18153
18131
  const { args, flags: opts } = parsedArgs;
18154
18132
  const force = opts["--force"];
18155
18133
  telemetry2.trackCliFlagForce(force);
18156
- const { contextName } = await getScope(client);
18134
+ const { contextName } = await getScope(client, { resolveLocalScope: true });
18157
18135
  if (args.length < 1 || args.length > 2) {
18158
18136
  if (client.nonInteractive) {
18159
- const cmd2 = withGlobalFlags5(client, "domains add <domain> [project]");
18137
+ const cmd2 = withGlobalFlags(client, "domains add <domain> [project]");
18160
18138
  outputActionRequired(
18161
18139
  client,
18162
18140
  {
@@ -18187,7 +18165,7 @@ async function add5(client, argv) {
18187
18165
  telemetry2.trackCliArgumentProject(args[1]);
18188
18166
  if (!projectName) {
18189
18167
  if (!isPublicSuffix(domainName) && !isRootDomain(domainName)) {
18190
- const cmd2 = withGlobalFlags5(
18168
+ const cmd2 = withGlobalFlags(
18191
18169
  client,
18192
18170
  `domains add ${domainName} <project>`
18193
18171
  );
@@ -21791,20 +21769,22 @@ async function activateFirewallConfig(client, projectId, configVersion, options
21791
21769
  }
21792
21770
 
21793
21771
  // src/commands/firewall/shared.ts
21794
- function withGlobalFlags6(client, commandTemplate) {
21795
- const flags = getGlobalFlagsOnlyFromArgs(client.argv.slice(2));
21796
- return getCommandNamePlain(`${commandTemplate} ${flags.join(" ")}`.trim());
21772
+ function withGlobalFlags3(client, commandTemplate) {
21773
+ return withGlobalFlags(client, commandTemplate, {
21774
+ preserveProject: true
21775
+ });
21797
21776
  }
21798
21777
  async function parseSubcommandArgs2(argv, command, client, commandPath) {
21799
21778
  let parsedArgs;
21800
- const flagsSpecification = getFlagsSpecification(command.options);
21801
21779
  const fullPath = commandPath || command.name;
21802
21780
  try {
21803
- parsedArgs = parseArguments(argv, flagsSpecification);
21781
+ parsedArgs = parseSubcommandArguments(argv, command);
21804
21782
  } catch (err) {
21805
21783
  if (client?.nonInteractive) {
21806
21784
  const rawMessage = err instanceof Error ? err.message : String(err);
21807
- const flags = getGlobalFlagsOnlyFromArgs(client.argv.slice(2));
21785
+ const flags = getGlobalFlagsFromArgs(client.argv.slice(2), {
21786
+ preserveProject: true
21787
+ });
21808
21788
  outputAgentError(
21809
21789
  client,
21810
21790
  {
@@ -21829,40 +21809,6 @@ async function parseSubcommandArgs2(argv, command, client, commandPath) {
21829
21809
  }
21830
21810
  return parsedArgs;
21831
21811
  }
21832
- async function ensureProjectLink2(client) {
21833
- const link = await getLinkedProject(client);
21834
- if (link.status === "error") {
21835
- return link.exitCode;
21836
- } else if (link.status === "not_linked") {
21837
- if (client.nonInteractive) {
21838
- const flags = getGlobalFlagsOnlyFromArgs(client.argv.slice(2));
21839
- const cmd2 = getCommandNamePlain(`link ${flags.join(" ")}`.trim());
21840
- outputAgentError(
21841
- client,
21842
- {
21843
- status: AGENT_STATUS.ERROR,
21844
- reason: AGENT_REASON.NOT_LINKED,
21845
- userActionRequired: true,
21846
- message: "Your codebase is not linked to a Vercel project. Run link first, then retry firewall commands.",
21847
- next: [
21848
- {
21849
- command: cmd2,
21850
- when: "to link this directory to a project"
21851
- }
21852
- ]
21853
- },
21854
- 1
21855
- );
21856
- return 1;
21857
- }
21858
- output_manager_default.error(
21859
- `Your codebase isn't linked to a project on Vercel. Run ${getCommandName("link")} to begin.`
21860
- );
21861
- return 1;
21862
- }
21863
- client.config.currentTeam = link.org.type === "team" ? link.org.id : void 0;
21864
- return link;
21865
- }
21866
21812
  async function confirmAction(client, skipConfirmation, message, details) {
21867
21813
  if (skipConfirmation)
21868
21814
  return true;
@@ -21898,7 +21844,7 @@ async function detectExistingDraft(client, projectId, teamId) {
21898
21844
  async function offerAutoPublish(client, projectId, hadExistingDraft, opts) {
21899
21845
  output_manager_default.print(
21900
21846
  `
21901
- ${import_chalk80.default.gray(`This change is staged. Run ${import_chalk80.default.cyan(getCommandName("firewall publish"))} to make it live, or ${import_chalk80.default.cyan(getCommandName("firewall discard"))} to undo.`)}
21847
+ ${import_chalk80.default.gray(`This change is staged. Run ${import_chalk80.default.cyan(withGlobalFlags3(client, "firewall publish"))} to make it live, or ${import_chalk80.default.cyan(withGlobalFlags3(client, "firewall discard"))} to undo.`)}
21902
21848
  `
21903
21849
  );
21904
21850
  if (!hadExistingDraft && !opts.skipPrompts && client.stdin.isTTY && !client.nonInteractive) {
@@ -21926,7 +21872,7 @@ async function offerAutoPublish(client, projectId, hadExistingDraft, opts) {
21926
21872
  }
21927
21873
  } else if (hadExistingDraft) {
21928
21874
  output_manager_default.warn(
21929
- `There are other draft changes. Review with ${import_chalk80.default.cyan(getCommandName("firewall diff"))} before publishing.`
21875
+ `There are other draft changes. Review with ${import_chalk80.default.cyan(withGlobalFlags3(client, "firewall diff"))} before publishing.`
21930
21876
  );
21931
21877
  }
21932
21878
  }
@@ -22638,7 +22584,11 @@ async function overview(client, argv) {
22638
22584
  const parsed = await parseSubcommandArgs2(argv, overviewSubcommand, client);
22639
22585
  if (typeof parsed === "number")
22640
22586
  return parsed;
22641
- const link = await ensureProjectLink2(client);
22587
+ const link = await requireProjectContext(
22588
+ client,
22589
+ "firewall",
22590
+ parsed.flags["--project"]
22591
+ );
22642
22592
  if (typeof link === "number")
22643
22593
  return link;
22644
22594
  const { project, org } = link;
@@ -22681,7 +22631,7 @@ async function overview(client, argv) {
22681
22631
  status: "error",
22682
22632
  reason: "api_error",
22683
22633
  message: msg,
22684
- next: [{ command: withGlobalFlags6(client, "firewall overview") }]
22634
+ next: [{ command: withGlobalFlags3(client, "firewall overview") }]
22685
22635
  });
22686
22636
  process.exit(1);
22687
22637
  return 1;
@@ -22697,7 +22647,11 @@ async function diff(client, argv) {
22697
22647
  const parsed = await parseSubcommandArgs2(argv, diffSubcommand, client);
22698
22648
  if (typeof parsed === "number")
22699
22649
  return parsed;
22700
- const link = await ensureProjectLink2(client);
22650
+ const link = await requireProjectContext(
22651
+ client,
22652
+ "firewall",
22653
+ parsed.flags["--project"]
22654
+ );
22701
22655
  if (typeof link === "number")
22702
22656
  return link;
22703
22657
  const { project, org } = link;
@@ -22729,7 +22683,7 @@ ${import_chalk83.default.bold(`Pending changes (${draft.changes.length}):`)}
22729
22683
  output_manager_default.print(formatDiffOutput(draft.changes, activeRulesMap));
22730
22684
  output_manager_default.print("\n\n");
22731
22685
  output_manager_default.print(
22732
- ` Run ${import_chalk83.default.cyan(getCommandName("firewall publish"))} to publish, or ${import_chalk83.default.cyan(getCommandName("firewall discard"))} to discard.
22686
+ ` Run ${import_chalk83.default.cyan(withGlobalFlags3(client, "firewall publish"))} to publish, or ${import_chalk83.default.cyan(withGlobalFlags3(client, "firewall discard"))} to discard.
22733
22687
 
22734
22688
  `
22735
22689
  );
@@ -22742,7 +22696,7 @@ ${import_chalk83.default.bold(`Pending changes (${draft.changes.length}):`)}
22742
22696
  status: "error",
22743
22697
  reason: "api_error",
22744
22698
  message: msg,
22745
- next: [{ command: withGlobalFlags6(client, "firewall diff") }]
22699
+ next: [{ command: withGlobalFlags3(client, "firewall diff") }]
22746
22700
  });
22747
22701
  process.exit(1);
22748
22702
  return 1;
@@ -22758,7 +22712,11 @@ async function publish(client, argv) {
22758
22712
  const parsed = await parseSubcommandArgs2(argv, publishSubcommand, client);
22759
22713
  if (typeof parsed === "number")
22760
22714
  return parsed;
22761
- const link = await ensureProjectLink2(client);
22715
+ const link = await requireProjectContext(
22716
+ client,
22717
+ "firewall",
22718
+ parsed.flags["--project"]
22719
+ );
22762
22720
  if (typeof link === "number")
22763
22721
  return link;
22764
22722
  const { project, org } = link;
@@ -22806,7 +22764,7 @@ ${import_chalk84.default.bold(`Changes to be published (${draft.changes.length})
22806
22764
  status: "error",
22807
22765
  reason: "api_error",
22808
22766
  message: msg,
22809
- next: [{ command: withGlobalFlags6(client, "firewall publish --yes") }]
22767
+ next: [{ command: withGlobalFlags3(client, "firewall publish --yes") }]
22810
22768
  });
22811
22769
  process.exit(1);
22812
22770
  return 1;
@@ -22837,7 +22795,11 @@ async function discard(client, argv) {
22837
22795
  const parsed = await parseSubcommandArgs2(argv, discardSubcommand, client);
22838
22796
  if (typeof parsed === "number")
22839
22797
  return parsed;
22840
- const link = await ensureProjectLink2(client);
22798
+ const link = await requireProjectContext(
22799
+ client,
22800
+ "firewall",
22801
+ parsed.flags["--project"]
22802
+ );
22841
22803
  if (typeof link === "number")
22842
22804
  return link;
22843
22805
  const { project, org } = link;
@@ -22885,7 +22847,7 @@ ${import_chalk85.default.bold(`Changes to be discarded (${draft.changes.length})
22885
22847
  status: "error",
22886
22848
  reason: "api_error",
22887
22849
  message: msg,
22888
- next: [{ command: withGlobalFlags6(client, "firewall discard --yes") }]
22850
+ next: [{ command: withGlobalFlags3(client, "firewall discard --yes") }]
22889
22851
  });
22890
22852
  process.exit(1);
22891
22853
  return 1;
@@ -22906,7 +22868,11 @@ async function list9(client, argv) {
22906
22868
  );
22907
22869
  if (typeof parsed === "number")
22908
22870
  return parsed;
22909
- const link = await ensureProjectLink2(client);
22871
+ const link = await requireProjectContext(
22872
+ client,
22873
+ "firewall",
22874
+ parsed.flags["--project"]
22875
+ );
22910
22876
  if (typeof link === "number")
22911
22877
  return link;
22912
22878
  const { project, org } = link;
@@ -22942,7 +22908,7 @@ ${formatBypassTable(bypasses)}
22942
22908
  message: msg,
22943
22909
  next: [
22944
22910
  {
22945
- command: withGlobalFlags6(client, "firewall system-bypass list")
22911
+ command: withGlobalFlags3(client, "firewall system-bypass list")
22946
22912
  }
22947
22913
  ]
22948
22914
  });
@@ -23106,7 +23072,11 @@ async function add6(client, argv) {
23106
23072
  return 1;
23107
23073
  }
23108
23074
  }
23109
- const link = await ensureProjectLink2(client);
23075
+ const link = await requireProjectContext(
23076
+ client,
23077
+ "firewall",
23078
+ parsed.flags["--project"]
23079
+ );
23110
23080
  if (typeof link === "number")
23111
23081
  return link;
23112
23082
  const { project, org } = link;
@@ -23148,7 +23118,7 @@ async function add6(client, argv) {
23148
23118
  message: msg,
23149
23119
  next: [
23150
23120
  {
23151
- command: withGlobalFlags6(
23121
+ command: withGlobalFlags3(
23152
23122
  client,
23153
23123
  `firewall system-bypass add ${ip}${domain2 ? ` --domain ${domain2}` : ""}${notes ? ` --notes "${notes}"` : ""} --yes`
23154
23124
  )
@@ -23209,7 +23179,11 @@ async function remove3(client, argv) {
23209
23179
  return 1;
23210
23180
  }
23211
23181
  }
23212
- const link = await ensureProjectLink2(client);
23182
+ const link = await requireProjectContext(
23183
+ client,
23184
+ "firewall",
23185
+ parsed.flags["--project"]
23186
+ );
23213
23187
  if (typeof link === "number")
23214
23188
  return link;
23215
23189
  const { project, org } = link;
@@ -23244,7 +23218,7 @@ async function remove3(client, argv) {
23244
23218
  const error = e2;
23245
23219
  if (error.status === 404) {
23246
23220
  output_manager_default.error(
23247
- `No bypass rule found for ${import_chalk88.default.bold(ip)}. Run ${import_chalk88.default.cyan(getCommandName("firewall system-bypass list"))} to view all rules.`
23221
+ `No bypass rule found for ${import_chalk88.default.bold(ip)}. Run ${import_chalk88.default.cyan(withGlobalFlags3(client, "firewall system-bypass list"))} to view all rules.`
23248
23222
  );
23249
23223
  return 1;
23250
23224
  }
@@ -23256,7 +23230,7 @@ async function remove3(client, argv) {
23256
23230
  message: msg,
23257
23231
  next: [
23258
23232
  {
23259
- command: withGlobalFlags6(
23233
+ command: withGlobalFlags3(
23260
23234
  client,
23261
23235
  `firewall system-bypass remove ${ip}${domain2 ? ` --domain ${domain2}` : ""} --yes`
23262
23236
  )
@@ -23271,184 +23245,13 @@ async function remove3(client, argv) {
23271
23245
  }
23272
23246
  }
23273
23247
 
23274
- // src/util/telemetry/commands/firewall/index.ts
23275
- var FirewallTelemetryClient = class extends TelemetryClient {
23276
- trackCliSubcommandOverview(actual) {
23277
- this.trackCliSubcommand({
23278
- subcommand: "overview",
23279
- value: actual
23280
- });
23281
- }
23282
- trackCliSubcommandDiff(actual) {
23283
- this.trackCliSubcommand({
23284
- subcommand: "diff",
23285
- value: actual
23286
- });
23287
- }
23288
- trackCliSubcommandPublish(actual) {
23289
- this.trackCliSubcommand({
23290
- subcommand: "publish",
23291
- value: actual
23292
- });
23293
- }
23294
- trackCliSubcommandDiscard(actual) {
23295
- this.trackCliSubcommand({
23296
- subcommand: "discard",
23297
- value: actual
23298
- });
23299
- }
23300
- trackCliSubcommandRules(actual) {
23301
- this.trackCliSubcommand({
23302
- subcommand: "rules",
23303
- value: actual
23304
- });
23305
- }
23306
- trackCliSubcommandRulesList(actual) {
23307
- this.trackCliSubcommand({
23308
- subcommand: "rules:list",
23309
- value: actual
23310
- });
23311
- }
23312
- trackCliSubcommandRulesInspect(actual) {
23313
- this.trackCliSubcommand({
23314
- subcommand: "rules:inspect",
23315
- value: actual
23316
- });
23317
- }
23318
- trackCliSubcommandRulesAdd(actual) {
23319
- this.trackCliSubcommand({
23320
- subcommand: "rules:add",
23321
- value: actual
23322
- });
23323
- }
23324
- trackCliSubcommandRulesEdit(actual) {
23325
- this.trackCliSubcommand({
23326
- subcommand: "rules:edit",
23327
- value: actual
23328
- });
23329
- }
23330
- trackCliSubcommandRulesEnable(actual) {
23331
- this.trackCliSubcommand({
23332
- subcommand: "rules:enable",
23333
- value: actual
23334
- });
23335
- }
23336
- trackCliSubcommandRulesDisable(actual) {
23337
- this.trackCliSubcommand({
23338
- subcommand: "rules:disable",
23339
- value: actual
23340
- });
23341
- }
23342
- trackCliSubcommandRulesRemove(actual) {
23343
- this.trackCliSubcommand({
23344
- subcommand: "rules:remove",
23345
- value: actual
23346
- });
23347
- }
23348
- trackCliSubcommandRulesReorder(actual) {
23349
- this.trackCliSubcommand({
23350
- subcommand: "rules:reorder",
23351
- value: actual
23352
- });
23353
- }
23354
- trackCliSubcommandIpBlocks(actual) {
23355
- this.trackCliSubcommand({
23356
- subcommand: "ip-blocks",
23357
- value: actual
23358
- });
23359
- }
23360
- trackCliSubcommandIpBlocksList(actual) {
23361
- this.trackCliSubcommand({
23362
- subcommand: "ip-blocks:list",
23363
- value: actual
23364
- });
23365
- }
23366
- trackCliSubcommandIpBlocksBlock(actual) {
23367
- this.trackCliSubcommand({
23368
- subcommand: "ip-blocks:block",
23369
- value: actual
23370
- });
23371
- }
23372
- trackCliSubcommandIpBlocksUnblock(actual) {
23373
- this.trackCliSubcommand({
23374
- subcommand: "ip-blocks:unblock",
23375
- value: actual
23376
- });
23377
- }
23378
- trackCliSubcommandSystemBypass(actual) {
23379
- this.trackCliSubcommand({
23380
- subcommand: "system-bypass",
23381
- value: actual
23382
- });
23383
- }
23384
- trackCliSubcommandSystemBypassList(actual) {
23385
- this.trackCliSubcommand({
23386
- subcommand: "system-bypass:list",
23387
- value: actual
23388
- });
23389
- }
23390
- trackCliSubcommandSystemBypassAdd(actual) {
23391
- this.trackCliSubcommand({
23392
- subcommand: "system-bypass:add",
23393
- value: actual
23394
- });
23395
- }
23396
- trackCliSubcommandSystemBypassRemove(actual) {
23397
- this.trackCliSubcommand({
23398
- subcommand: "system-bypass:remove",
23399
- value: actual
23400
- });
23401
- }
23402
- trackCliSubcommandAttackMode(actual) {
23403
- this.trackCliSubcommand({
23404
- subcommand: "attack-mode",
23405
- value: actual
23406
- });
23407
- }
23408
- trackCliSubcommandAttackModeEnable(actual) {
23409
- this.trackCliSubcommand({
23410
- subcommand: "attack-mode:enable",
23411
- value: actual
23412
- });
23413
- }
23414
- trackCliSubcommandAttackModeDisable(actual) {
23415
- this.trackCliSubcommand({
23416
- subcommand: "attack-mode:disable",
23417
- value: actual
23418
- });
23419
- }
23420
- trackCliSubcommandSystemMitigations(actual) {
23421
- this.trackCliSubcommand({
23422
- subcommand: "system-mitigations",
23423
- value: actual
23424
- });
23425
- }
23426
- trackCliSubcommandSystemMitigationsPause(actual) {
23427
- this.trackCliSubcommand({
23428
- subcommand: "system-mitigations:pause",
23429
- value: actual
23430
- });
23431
- }
23432
- trackCliSubcommandSystemMitigationsResume(actual) {
23433
- this.trackCliSubcommand({
23434
- subcommand: "system-mitigations:resume",
23435
- value: actual
23436
- });
23437
- }
23438
- };
23439
-
23440
23248
  // src/commands/firewall/system-bypass/index.ts
23441
23249
  var COMMAND_CONFIG19 = {
23442
23250
  list: getCommandAliases(systemBypassListSubcommand),
23443
23251
  add: getCommandAliases(systemBypassAddSubcommand),
23444
23252
  remove: getCommandAliases(systemBypassRemoveSubcommand)
23445
23253
  };
23446
- async function main10(client, args) {
23447
- const telemetry2 = new FirewallTelemetryClient({
23448
- opts: {
23449
- store: client.telemetryEventStore
23450
- }
23451
- });
23254
+ async function main10(client, args, telemetry2) {
23452
23255
  const flagsSpecification = getFlagsSpecification(
23453
23256
  systemBypassSubcommand.options
23454
23257
  );
@@ -23568,7 +23371,7 @@ async function enable(client, argv) {
23568
23371
  message: "Enabling attack mode challenges all visitors and cannot be performed non-interactively. Agents must not make this change on behalf of a user. The user must run this command interactively in a terminal to review the impact and confirm.",
23569
23372
  next: [
23570
23373
  {
23571
- command: withGlobalFlags6(client, "firewall attack-mode enable"),
23374
+ command: withGlobalFlags3(client, "firewall attack-mode enable"),
23572
23375
  when: "user runs this command interactively"
23573
23376
  }
23574
23377
  ]
@@ -23590,7 +23393,11 @@ async function enable(client, argv) {
23590
23393
  );
23591
23394
  return 1;
23592
23395
  }
23593
- const link = await ensureProjectLink2(client);
23396
+ const link = await requireProjectContext(
23397
+ client,
23398
+ "firewall",
23399
+ parsed.flags["--project"]
23400
+ );
23594
23401
  if (typeof link === "number")
23595
23402
  return link;
23596
23403
  const { project } = link;
@@ -23644,7 +23451,7 @@ async function disable(client, argv) {
23644
23451
  message: "Disabling attack mode affects traffic handling and cannot be performed non-interactively. Agents must not make this change on behalf of a user. The user must run this command interactively in a terminal.",
23645
23452
  next: [
23646
23453
  {
23647
- command: withGlobalFlags6(client, "firewall attack-mode disable"),
23454
+ command: withGlobalFlags3(client, "firewall attack-mode disable"),
23648
23455
  when: "user runs this command interactively"
23649
23456
  }
23650
23457
  ]
@@ -23659,7 +23466,11 @@ async function disable(client, argv) {
23659
23466
  );
23660
23467
  return 1;
23661
23468
  }
23662
- const link = await ensureProjectLink2(client);
23469
+ const link = await requireProjectContext(
23470
+ client,
23471
+ "firewall",
23472
+ parsed.flags["--project"]
23473
+ );
23663
23474
  if (typeof link === "number")
23664
23475
  return link;
23665
23476
  const { project } = link;
@@ -23697,12 +23508,7 @@ var COMMAND_CONFIG20 = {
23697
23508
  enable: getCommandAliases(attackModeEnableSubcommand),
23698
23509
  disable: getCommandAliases(attackModeDisableSubcommand)
23699
23510
  };
23700
- async function main11(client, args) {
23701
- const telemetry2 = new FirewallTelemetryClient({
23702
- opts: {
23703
- store: client.telemetryEventStore
23704
- }
23705
- });
23511
+ async function main11(client, args, telemetry2) {
23706
23512
  const flagsSpecification = getFlagsSpecification(
23707
23513
  attackModeSubcommand.options
23708
23514
  );
@@ -23794,7 +23600,7 @@ async function pause(client, argv) {
23794
23600
  message: "Pausing system mitigations disables DDoS protection and cannot be performed non-interactively. Agents must not make this change on behalf of a user. The user must run this command interactively in a terminal to review the impact and confirm.",
23795
23601
  next: [
23796
23602
  {
23797
- command: withGlobalFlags6(
23603
+ command: withGlobalFlags3(
23798
23604
  client,
23799
23605
  "firewall system-mitigations pause"
23800
23606
  ),
@@ -23812,7 +23618,11 @@ async function pause(client, argv) {
23812
23618
  );
23813
23619
  return 1;
23814
23620
  }
23815
- const link = await ensureProjectLink2(client);
23621
+ const link = await requireProjectContext(
23622
+ client,
23623
+ "firewall",
23624
+ parsed.flags["--project"]
23625
+ );
23816
23626
  if (typeof link === "number")
23817
23627
  return link;
23818
23628
  const { project, org } = link;
@@ -23871,7 +23681,7 @@ async function resume(client, argv) {
23871
23681
  message: "Resuming system mitigations affects traffic protection and cannot be performed non-interactively. Agents must not make this change on behalf of a user. The user must run this command interactively in a terminal.",
23872
23682
  next: [
23873
23683
  {
23874
- command: withGlobalFlags6(
23684
+ command: withGlobalFlags3(
23875
23685
  client,
23876
23686
  "firewall system-mitigations resume"
23877
23687
  ),
@@ -23889,7 +23699,11 @@ async function resume(client, argv) {
23889
23699
  );
23890
23700
  return 1;
23891
23701
  }
23892
- const link = await ensureProjectLink2(client);
23702
+ const link = await requireProjectContext(
23703
+ client,
23704
+ "firewall",
23705
+ parsed.flags["--project"]
23706
+ );
23893
23707
  if (typeof link === "number")
23894
23708
  return link;
23895
23709
  const { project, org } = link;
@@ -23933,12 +23747,7 @@ var COMMAND_CONFIG21 = {
23933
23747
  pause: getCommandAliases(systemMitigationsPauseSubcommand),
23934
23748
  resume: getCommandAliases(systemMitigationsResumeSubcommand)
23935
23749
  };
23936
- async function main12(client, args) {
23937
- const telemetry2 = new FirewallTelemetryClient({
23938
- opts: {
23939
- store: client.telemetryEventStore
23940
- }
23941
- });
23750
+ async function main12(client, args, telemetry2) {
23942
23751
  const flagsSpecification = getFlagsSpecification(
23943
23752
  systemMitigationsSubcommand.options
23944
23753
  );
@@ -24021,7 +23830,11 @@ async function list10(client, argv) {
24021
23830
  );
24022
23831
  if (typeof parsed === "number")
24023
23832
  return parsed;
24024
- const link = await ensureProjectLink2(client);
23833
+ const link = await requireProjectContext(
23834
+ client,
23835
+ "firewall",
23836
+ parsed.flags["--project"]
23837
+ );
24025
23838
  if (typeof link === "number")
24026
23839
  return link;
24027
23840
  const { project, org } = link;
@@ -24058,7 +23871,7 @@ ${formatIpBlocksTable(annotated)}
24058
23871
  if (ipChanges > 0) {
24059
23872
  output_manager_default.print(
24060
23873
  `
24061
- ${import_chalk93.default.yellow(`${ipChanges} unpublished IP block change${ipChanges !== 1 ? "s" : ""}.`)} Run ${import_chalk93.default.cyan(getCommandName("firewall publish"))} to publish.
23874
+ ${import_chalk93.default.yellow(`${ipChanges} unpublished IP block change${ipChanges !== 1 ? "s" : ""}.`)} Run ${import_chalk93.default.cyan(withGlobalFlags3(client, "firewall publish"))} to publish.
24062
23875
  `
24063
23876
  );
24064
23877
  } else {
@@ -24078,7 +23891,7 @@ ${formatIpBlocksTable(annotated)}
24078
23891
  message: msg,
24079
23892
  next: [
24080
23893
  {
24081
- command: withGlobalFlags6(client, "firewall ip-blocks list")
23894
+ command: withGlobalFlags3(client, "firewall ip-blocks list")
24082
23895
  }
24083
23896
  ]
24084
23897
  });
@@ -24145,7 +23958,11 @@ async function block(client, argv) {
24145
23958
  return 1;
24146
23959
  }
24147
23960
  }
24148
- const link = await ensureProjectLink2(client);
23961
+ const link = await requireProjectContext(
23962
+ client,
23963
+ "firewall",
23964
+ parsed.flags["--project"]
23965
+ );
24149
23966
  if (typeof link === "number")
24150
23967
  return link;
24151
23968
  const { project, org } = link;
@@ -24201,7 +24018,7 @@ async function block(client, argv) {
24201
24018
  message: msg,
24202
24019
  next: [
24203
24020
  {
24204
- command: withGlobalFlags6(
24021
+ command: withGlobalFlags3(
24205
24022
  client,
24206
24023
  `firewall ip-blocks block ${ip}${hostname2 !== "*" ? ` --hostname ${hostname2}` : ""} --yes`
24207
24024
  )
@@ -24232,7 +24049,11 @@ async function unblock(client, argv) {
24232
24049
  output_manager_default.error("Missing required argument: <id-or-ip>");
24233
24050
  return 1;
24234
24051
  }
24235
- const link = await ensureProjectLink2(client);
24052
+ const link = await requireProjectContext(
24053
+ client,
24054
+ "firewall",
24055
+ parsed.flags["--project"]
24056
+ );
24236
24057
  if (typeof link === "number")
24237
24058
  return link;
24238
24059
  const { project, org } = link;
@@ -24255,7 +24076,7 @@ async function unblock(client, argv) {
24255
24076
  }
24256
24077
  if (matches.length === 0) {
24257
24078
  output_manager_default.error(
24258
- `No IP block found for "${identifier}". Run ${import_chalk95.default.cyan(getCommandName("firewall ip-blocks list"))} to view all rules.`
24079
+ `No IP block found for "${identifier}". Run ${import_chalk95.default.cyan(withGlobalFlags3(client, "firewall ip-blocks list"))} to view all rules.`
24259
24080
  );
24260
24081
  return 1;
24261
24082
  }
@@ -24271,7 +24092,7 @@ async function unblock(client, argv) {
24271
24092
  reason: "ambiguous_match",
24272
24093
  message: `Multiple IP blocks match "${identifier}". Use --hostname to narrow the match or specify the full rule ID.`,
24273
24094
  next: matches.map((r) => ({
24274
- command: withGlobalFlags6(
24095
+ command: withGlobalFlags3(
24275
24096
  client,
24276
24097
  `firewall ip-blocks unblock "${identifier}" --hostname "${r.hostname}" --yes`
24277
24098
  ),
@@ -24342,7 +24163,7 @@ async function unblock(client, argv) {
24342
24163
  message: msg,
24343
24164
  next: [
24344
24165
  {
24345
- command: withGlobalFlags6(
24166
+ command: withGlobalFlags3(
24346
24167
  client,
24347
24168
  `firewall ip-blocks unblock ${identifier} --yes`
24348
24169
  )
@@ -24363,12 +24184,7 @@ var COMMAND_CONFIG22 = {
24363
24184
  block: getCommandAliases(ipBlocksBlockSubcommand),
24364
24185
  unblock: getCommandAliases(ipBlocksUnblockSubcommand)
24365
24186
  };
24366
- async function main13(client, args) {
24367
- const telemetry2 = new FirewallTelemetryClient({
24368
- opts: {
24369
- store: client.telemetryEventStore
24370
- }
24371
- });
24187
+ async function main13(client, args, telemetry2) {
24372
24188
  const flagsSpecification = getFlagsSpecification(ipBlocksSubcommand.options);
24373
24189
  let parsedArgs;
24374
24190
  try {
@@ -24460,7 +24276,11 @@ async function list11(client, argv) {
24460
24276
  );
24461
24277
  if (typeof parsed === "number")
24462
24278
  return parsed;
24463
- const link = await ensureProjectLink2(client);
24279
+ const link = await requireProjectContext(
24280
+ client,
24281
+ "firewall",
24282
+ parsed.flags["--project"]
24283
+ );
24464
24284
  if (typeof link === "number")
24465
24285
  return link;
24466
24286
  const { project, org } = link;
@@ -24531,7 +24351,7 @@ ${formatRulesTable(annotated)}
24531
24351
  if (ruleChanges > 0) {
24532
24352
  output_manager_default.print(
24533
24353
  `
24534
- ${import_chalk96.default.yellow(`${ruleChanges} unpublished rule change${ruleChanges !== 1 ? "s" : ""}.`)} Run ${import_chalk96.default.cyan(getCommandName("firewall publish"))} to publish.
24354
+ ${import_chalk96.default.yellow(`${ruleChanges} unpublished rule change${ruleChanges !== 1 ? "s" : ""}.`)} Run ${import_chalk96.default.cyan(withGlobalFlags3(client, "firewall publish"))} to publish.
24535
24355
  `
24536
24356
  );
24537
24357
  } else {
@@ -24549,7 +24369,7 @@ ${formatRulesTable(annotated)}
24549
24369
  status: "error",
24550
24370
  reason: "api_error",
24551
24371
  message: msg,
24552
- next: [{ command: withGlobalFlags6(client, "firewall rules list") }]
24372
+ next: [{ command: withGlobalFlags3(client, "firewall rules list") }]
24553
24373
  });
24554
24374
  process.exit(1);
24555
24375
  return 1;
@@ -24581,14 +24401,14 @@ async function inspect3(client, argv) {
24581
24401
  message: "Rule name or ID is required.",
24582
24402
  next: [
24583
24403
  {
24584
- command: withGlobalFlags6(
24404
+ command: withGlobalFlags3(
24585
24405
  client,
24586
24406
  "firewall rules inspect <name-or-id>"
24587
24407
  ),
24588
24408
  when: "replace <name-or-id>"
24589
24409
  },
24590
24410
  {
24591
- command: withGlobalFlags6(client, "firewall rules list"),
24411
+ command: withGlobalFlags3(client, "firewall rules list"),
24592
24412
  when: "list rules"
24593
24413
  }
24594
24414
  ]
@@ -24597,11 +24417,15 @@ async function inspect3(client, argv) {
24597
24417
  );
24598
24418
  }
24599
24419
  output_manager_default.error(
24600
- `Rule name or ID is required. Usage: ${getCommandName("firewall rules inspect <name-or-id>")}`
24420
+ `Rule name or ID is required. Usage: ${withGlobalFlags3(client, "firewall rules inspect <name-or-id>")}`
24601
24421
  );
24602
24422
  return 1;
24603
24423
  }
24604
- const link = await ensureProjectLink2(client);
24424
+ const link = await requireProjectContext(
24425
+ client,
24426
+ "firewall",
24427
+ parsed.flags["--project"]
24428
+ );
24605
24429
  if (typeof link === "number")
24606
24430
  return link;
24607
24431
  const { project, org } = link;
@@ -24624,7 +24448,7 @@ async function inspect3(client, argv) {
24624
24448
  message: `No rule found for "${identifier}".`,
24625
24449
  next: [
24626
24450
  {
24627
- command: withGlobalFlags6(client, "firewall rules list"),
24451
+ command: withGlobalFlags3(client, "firewall rules list"),
24628
24452
  when: "list rules"
24629
24453
  }
24630
24454
  ]
@@ -24633,7 +24457,7 @@ async function inspect3(client, argv) {
24633
24457
  );
24634
24458
  }
24635
24459
  output_manager_default.error(
24636
- `No rule found for "${identifier}". Run ${import_chalk97.default.cyan(getCommandName("firewall rules list"))} to view all rules.`
24460
+ `No rule found for "${identifier}". Run ${import_chalk97.default.cyan(withGlobalFlags3(client, "firewall rules list"))} to view all rules.`
24637
24461
  );
24638
24462
  return 1;
24639
24463
  }
@@ -24649,7 +24473,7 @@ async function inspect3(client, argv) {
24649
24473
  reason: "ambiguous_match",
24650
24474
  message: `Multiple rules match "${identifier}". Specify the full rule ID.`,
24651
24475
  next: matches.map((r) => ({
24652
- command: withGlobalFlags6(
24476
+ command: withGlobalFlags3(
24653
24477
  client,
24654
24478
  `firewall rules inspect "${r.id}"`
24655
24479
  ),
@@ -24697,7 +24521,7 @@ ${formatRuleDetail(rule)}
24697
24521
  message: msg,
24698
24522
  next: [
24699
24523
  {
24700
- command: withGlobalFlags6(
24524
+ command: withGlobalFlags3(
24701
24525
  client,
24702
24526
  `firewall rules inspect ${identifier}`
24703
24527
  )
@@ -26223,14 +26047,14 @@ async function handleAIAdd(client, project, teamId, opts) {
26223
26047
  message: `AI could not generate a rule: ${response.error}`,
26224
26048
  next: [
26225
26049
  {
26226
- command: withGlobalFlags6(
26050
+ command: withGlobalFlags3(
26227
26051
  client,
26228
26052
  'firewall rules add --ai "more specific prompt" --yes'
26229
26053
  ),
26230
26054
  when: "try with a more specific description"
26231
26055
  },
26232
26056
  {
26233
- command: withGlobalFlags6(
26057
+ command: withGlobalFlags3(
26234
26058
  client,
26235
26059
  `firewall rules add "Name" --condition '{"type":"path","op":"pre","value":"/api"}' --action deny --yes`
26236
26060
  ),
@@ -26276,7 +26100,7 @@ async function handleAIAdd(client, project, teamId, opts) {
26276
26100
  message: "AI did not return a rule. Try a more specific description.",
26277
26101
  next: [
26278
26102
  {
26279
- command: withGlobalFlags6(
26103
+ command: withGlobalFlags3(
26280
26104
  client,
26281
26105
  'firewall rules add --ai "more specific prompt" --yes'
26282
26106
  ),
@@ -26317,7 +26141,7 @@ async function handleAIAdd(client, project, teamId, opts) {
26317
26141
  message: msg,
26318
26142
  next: [
26319
26143
  {
26320
- command: withGlobalFlags6(
26144
+ command: withGlobalFlags3(
26321
26145
  client,
26322
26146
  'firewall rules add --ai "more specific prompt" --yes'
26323
26147
  ),
@@ -26470,7 +26294,7 @@ async function createFromGenerated(client, project, teamId, rule, opts) {
26470
26294
  message: msg,
26471
26295
  next: [
26472
26296
  {
26473
- command: withGlobalFlags6(client, "firewall rules add --yes"),
26297
+ command: withGlobalFlags3(client, "firewall rules add --yes"),
26474
26298
  when: "try again"
26475
26299
  }
26476
26300
  ]
@@ -26514,14 +26338,14 @@ async function add7(client, argv) {
26514
26338
  message: "AI mode is not available in non-interactive mode. AI-generated rules require human review before staging. Use --json or --condition flags instead.",
26515
26339
  next: [
26516
26340
  {
26517
- command: withGlobalFlags6(
26341
+ command: withGlobalFlags3(
26518
26342
  client,
26519
26343
  `firewall rules add "Name" --condition '{"type":"path","op":"pre","value":"/api"}' --action deny --yes`
26520
26344
  ),
26521
26345
  when: "create with flags"
26522
26346
  },
26523
26347
  {
26524
- command: withGlobalFlags6(
26348
+ command: withGlobalFlags3(
26525
26349
  client,
26526
26350
  `firewall rules add --json '{"name":"...","conditionGroup":[...],"action":{...}}' --yes`
26527
26351
  ),
@@ -26535,7 +26359,11 @@ async function add7(client, argv) {
26535
26359
  );
26536
26360
  return 1;
26537
26361
  }
26538
- const link = await ensureProjectLink2(client);
26362
+ const link = await requireProjectContext(
26363
+ client,
26364
+ "firewall",
26365
+ parsed.flags["--project"]
26366
+ );
26539
26367
  if (typeof link === "number")
26540
26368
  return link;
26541
26369
  const { project, org } = link;
@@ -26570,7 +26398,11 @@ async function add7(client, argv) {
26570
26398
  }
26571
26399
  ]
26572
26400
  });
26573
- const link = await ensureProjectLink2(client);
26401
+ const link = await requireProjectContext(
26402
+ client,
26403
+ "firewall",
26404
+ parsed.flags["--project"]
26405
+ );
26574
26406
  if (typeof link === "number")
26575
26407
  return link;
26576
26408
  const { project, org } = link;
@@ -26597,14 +26429,14 @@ async function add7(client, argv) {
26597
26429
  message: "No rule definition provided. Use --json or --condition flags.",
26598
26430
  next: [
26599
26431
  {
26600
- command: withGlobalFlags6(
26432
+ command: withGlobalFlags3(
26601
26433
  client,
26602
26434
  `firewall rules add "Name" --condition '{"type":"path","op":"pre","value":"/api"}' --action deny --yes`
26603
26435
  ),
26604
26436
  when: "create with flags"
26605
26437
  },
26606
26438
  {
26607
- command: withGlobalFlags6(
26439
+ command: withGlobalFlags3(
26608
26440
  client,
26609
26441
  `firewall rules add --json '{"name":"Name","conditionGroup":[...],"action":{"mitigate":{"action":"deny"}}}' --yes`
26610
26442
  ),
@@ -26703,7 +26535,7 @@ async function handleFlagAdd(client, parsed, conditionFlags) {
26703
26535
  const name = parsed.args[0];
26704
26536
  if (!name) {
26705
26537
  output_manager_default.error(
26706
- `Missing rule name. Provide as the first argument: ${import_chalk101.default.cyan(getCommandName('firewall rules add "Rule name" --condition ...'))}`
26538
+ `Missing rule name. Provide as the first argument: ${import_chalk101.default.cyan(withGlobalFlags3(client, 'firewall rules add "Rule name" --condition ...'))}`
26707
26539
  );
26708
26540
  return 1;
26709
26541
  }
@@ -26780,7 +26612,12 @@ async function handleFlagAdd(client, parsed, conditionFlags) {
26780
26612
  return createRule2(client, parsed, rule);
26781
26613
  }
26782
26614
  async function createRule2(client, parsed, rule) {
26783
- const link = await ensureProjectLink2(client);
26615
+ const projectName = parsed.flags["--project"];
26616
+ const link = await requireProjectContext(
26617
+ client,
26618
+ "firewall",
26619
+ typeof projectName === "string" ? projectName : void 0
26620
+ );
26784
26621
  if (typeof link === "number")
26785
26622
  return link;
26786
26623
  const { project, org } = link;
@@ -26836,7 +26673,7 @@ ${formatRuleExpanded(previewRule)}
26836
26673
  message: msg,
26837
26674
  next: [
26838
26675
  {
26839
- command: withGlobalFlags6(client, "firewall rules add --yes")
26676
+ command: withGlobalFlags3(client, "firewall rules add --yes")
26840
26677
  }
26841
26678
  ]
26842
26679
  });
@@ -26859,7 +26696,11 @@ async function edit2(client, argv) {
26859
26696
  if (typeof parsed === "number")
26860
26697
  return parsed;
26861
26698
  let identifier = parsed.args[0];
26862
- const link = await ensureProjectLink2(client);
26699
+ const link = await requireProjectContext(
26700
+ client,
26701
+ "firewall",
26702
+ parsed.flags["--project"]
26703
+ );
26863
26704
  if (typeof link === "number")
26864
26705
  return link;
26865
26706
  const { project, org } = link;
@@ -26873,7 +26714,7 @@ async function edit2(client, argv) {
26873
26714
  output_manager_default.stopSpinner();
26874
26715
  if (client.nonInteractive || !client.stdin.isTTY) {
26875
26716
  output_manager_default.error(
26876
- `Missing required argument: <name-or-id>. Run ${import_chalk102.default.cyan(getCommandName("firewall rules list"))} to see all rules.`
26717
+ `Missing required argument: <name-or-id>. Run ${import_chalk102.default.cyan(withGlobalFlags3(client, "firewall rules list"))} to see all rules.`
26877
26718
  );
26878
26719
  return 1;
26879
26720
  }
@@ -26900,7 +26741,7 @@ async function edit2(client, argv) {
26900
26741
  const matches = resolveRule(currentRules, identifier);
26901
26742
  if (matches.length === 0) {
26902
26743
  output_manager_default.error(
26903
- `No rule found for "${identifier}". Run ${import_chalk102.default.cyan(getCommandName("firewall rules list"))} to view all rules.`
26744
+ `No rule found for "${identifier}". Run ${import_chalk102.default.cyan(withGlobalFlags3(client, "firewall rules list"))} to view all rules.`
26904
26745
  );
26905
26746
  return 1;
26906
26747
  }
@@ -26949,14 +26790,14 @@ async function edit2(client, argv) {
26949
26790
  message: "AI mode is not available in non-interactive mode. AI-generated changes require human review. Use --json or flag-based editing instead.",
26950
26791
  next: [
26951
26792
  {
26952
- command: withGlobalFlags6(
26793
+ command: withGlobalFlags3(
26953
26794
  client,
26954
26795
  `firewall rules edit "${identifier}" --action challenge --yes`
26955
26796
  ),
26956
26797
  when: "edit with flags"
26957
26798
  },
26958
26799
  {
26959
- command: withGlobalFlags6(
26800
+ command: withGlobalFlags3(
26960
26801
  client,
26961
26802
  `firewall rules edit "${identifier}" --json '{"name":"...","conditionGroup":[...],"action":{...}}' --yes`
26962
26803
  ),
@@ -27028,14 +26869,14 @@ ${import_chalk102.default.bold("Current rule:")}
27028
26869
  message: "No edit flags provided. Use --json, --condition, --action, --name, etc.",
27029
26870
  next: [
27030
26871
  {
27031
- command: withGlobalFlags6(
26872
+ command: withGlobalFlags3(
27032
26873
  client,
27033
26874
  `firewall rules edit "${identifier}" --action challenge --yes`
27034
26875
  ),
27035
26876
  when: "edit with flags"
27036
26877
  },
27037
26878
  {
27038
- command: withGlobalFlags6(
26879
+ command: withGlobalFlags3(
27039
26880
  client,
27040
26881
  `firewall rules edit "${identifier}" --json '{"name":"...","conditionGroup":[...],"action":{"mitigate":{"action":"deny"}}}' --yes`
27041
26882
  ),
@@ -27444,7 +27285,7 @@ ${formatRuleExpanded(modified)}
27444
27285
  message: msg,
27445
27286
  next: [
27446
27287
  {
27447
- command: withGlobalFlags6(
27288
+ command: withGlobalFlags3(
27448
27289
  client,
27449
27290
  `firewall rules edit "${originalRule.name}" --yes`
27450
27291
  )
@@ -27469,7 +27310,11 @@ async function enable2(client, argv) {
27469
27310
  );
27470
27311
  if (typeof parsed === "number")
27471
27312
  return parsed;
27472
- const link = await ensureProjectLink2(client);
27313
+ const link = await requireProjectContext(
27314
+ client,
27315
+ "firewall",
27316
+ parsed.flags["--project"]
27317
+ );
27473
27318
  if (typeof link === "number")
27474
27319
  return link;
27475
27320
  const { project, org } = link;
@@ -27499,14 +27344,14 @@ async function enable2(client, argv) {
27499
27344
  message: "Rule name or ID is required.",
27500
27345
  next: [
27501
27346
  {
27502
- command: withGlobalFlags6(
27347
+ command: withGlobalFlags3(
27503
27348
  client,
27504
27349
  "firewall rules enable <name-or-id>"
27505
27350
  ),
27506
27351
  when: "replace <name-or-id>"
27507
27352
  },
27508
27353
  {
27509
- command: withGlobalFlags6(client, "firewall rules list"),
27354
+ command: withGlobalFlags3(client, "firewall rules list"),
27510
27355
  when: "list rules"
27511
27356
  }
27512
27357
  ]
@@ -27515,7 +27360,7 @@ async function enable2(client, argv) {
27515
27360
  );
27516
27361
  }
27517
27362
  output_manager_default.error(
27518
- `Rule name or ID is required. Usage: ${getCommandName("firewall rules enable <name-or-id>")}`
27363
+ `Rule name or ID is required. Usage: ${withGlobalFlags3(client, "firewall rules enable <name-or-id>")}`
27519
27364
  );
27520
27365
  return 1;
27521
27366
  }
@@ -27542,7 +27387,7 @@ async function enable2(client, argv) {
27542
27387
  if (allMatches.length === 0) {
27543
27388
  output_manager_default.stopSpinner();
27544
27389
  output_manager_default.error(
27545
- `No rule found for "${identifier}". Run ${import_chalk103.default.cyan(getCommandName("firewall rules list"))} to view all rules.`
27390
+ `No rule found for "${identifier}". Run ${import_chalk103.default.cyan(withGlobalFlags3(client, "firewall rules list"))} to view all rules.`
27546
27391
  );
27547
27392
  return 1;
27548
27393
  }
@@ -27566,7 +27411,7 @@ async function enable2(client, argv) {
27566
27411
  reason: "ambiguous_match",
27567
27412
  message: `Multiple rules match "${identifier}". Specify the full rule ID.`,
27568
27413
  next: matches.map((r) => ({
27569
- command: withGlobalFlags6(
27414
+ command: withGlobalFlags3(
27570
27415
  client,
27571
27416
  `firewall rules enable "${r.id}" --yes`
27572
27417
  ),
@@ -27645,7 +27490,11 @@ async function disable2(client, argv) {
27645
27490
  );
27646
27491
  if (typeof parsed === "number")
27647
27492
  return parsed;
27648
- const link = await ensureProjectLink2(client);
27493
+ const link = await requireProjectContext(
27494
+ client,
27495
+ "firewall",
27496
+ parsed.flags["--project"]
27497
+ );
27649
27498
  if (typeof link === "number")
27650
27499
  return link;
27651
27500
  const { project, org } = link;
@@ -27675,14 +27524,14 @@ async function disable2(client, argv) {
27675
27524
  message: "Rule name or ID is required.",
27676
27525
  next: [
27677
27526
  {
27678
- command: withGlobalFlags6(
27527
+ command: withGlobalFlags3(
27679
27528
  client,
27680
27529
  "firewall rules disable <name-or-id>"
27681
27530
  ),
27682
27531
  when: "replace <name-or-id>"
27683
27532
  },
27684
27533
  {
27685
- command: withGlobalFlags6(client, "firewall rules list"),
27534
+ command: withGlobalFlags3(client, "firewall rules list"),
27686
27535
  when: "list rules"
27687
27536
  }
27688
27537
  ]
@@ -27691,7 +27540,7 @@ async function disable2(client, argv) {
27691
27540
  );
27692
27541
  }
27693
27542
  output_manager_default.error(
27694
- `Rule name or ID is required. Usage: ${getCommandName("firewall rules disable <name-or-id>")}`
27543
+ `Rule name or ID is required. Usage: ${withGlobalFlags3(client, "firewall rules disable <name-or-id>")}`
27695
27544
  );
27696
27545
  return 1;
27697
27546
  }
@@ -27718,7 +27567,7 @@ async function disable2(client, argv) {
27718
27567
  if (allMatches.length === 0) {
27719
27568
  output_manager_default.stopSpinner();
27720
27569
  output_manager_default.error(
27721
- `No rule found for "${identifier}". Run ${import_chalk104.default.cyan(getCommandName("firewall rules list"))} to view all rules.`
27570
+ `No rule found for "${identifier}". Run ${import_chalk104.default.cyan(withGlobalFlags3(client, "firewall rules list"))} to view all rules.`
27722
27571
  );
27723
27572
  return 1;
27724
27573
  }
@@ -27742,7 +27591,7 @@ async function disable2(client, argv) {
27742
27591
  reason: "ambiguous_match",
27743
27592
  message: `Multiple rules match "${identifier}". Specify the full rule ID.`,
27744
27593
  next: matches.map((r) => ({
27745
- command: withGlobalFlags6(
27594
+ command: withGlobalFlags3(
27746
27595
  client,
27747
27596
  `firewall rules disable "${r.id}" --yes`
27748
27597
  ),
@@ -27820,7 +27669,11 @@ async function remove4(client, argv) {
27820
27669
  );
27821
27670
  if (typeof parsed === "number")
27822
27671
  return parsed;
27823
- const link = await ensureProjectLink2(client);
27672
+ const link = await requireProjectContext(
27673
+ client,
27674
+ "firewall",
27675
+ parsed.flags["--project"]
27676
+ );
27824
27677
  if (typeof link === "number")
27825
27678
  return link;
27826
27679
  const { project, org } = link;
@@ -27850,14 +27703,14 @@ async function remove4(client, argv) {
27850
27703
  message: "Rule name or ID is required.",
27851
27704
  next: [
27852
27705
  {
27853
- command: withGlobalFlags6(
27706
+ command: withGlobalFlags3(
27854
27707
  client,
27855
27708
  "firewall rules remove <name-or-id> --yes"
27856
27709
  ),
27857
27710
  when: "replace <name-or-id>"
27858
27711
  },
27859
27712
  {
27860
- command: withGlobalFlags6(client, "firewall rules list"),
27713
+ command: withGlobalFlags3(client, "firewall rules list"),
27861
27714
  when: "list rules"
27862
27715
  }
27863
27716
  ]
@@ -27866,7 +27719,7 @@ async function remove4(client, argv) {
27866
27719
  );
27867
27720
  }
27868
27721
  output_manager_default.error(
27869
- `Rule name or ID is required. Usage: ${getCommandName("firewall rules remove <name-or-id> --yes")}`
27722
+ `Rule name or ID is required. Usage: ${withGlobalFlags3(client, "firewall rules remove <name-or-id> --yes")}`
27870
27723
  );
27871
27724
  return 1;
27872
27725
  }
@@ -27888,7 +27741,7 @@ async function remove4(client, argv) {
27888
27741
  if (matches.length === 0) {
27889
27742
  output_manager_default.stopSpinner();
27890
27743
  output_manager_default.error(
27891
- `No rule found for "${identifier}". Run ${import_chalk105.default.cyan(getCommandName("firewall rules list"))} to view all rules.`
27744
+ `No rule found for "${identifier}". Run ${import_chalk105.default.cyan(withGlobalFlags3(client, "firewall rules list"))} to view all rules.`
27892
27745
  );
27893
27746
  return 1;
27894
27747
  }
@@ -27902,7 +27755,7 @@ async function remove4(client, argv) {
27902
27755
  reason: "ambiguous_match",
27903
27756
  message: `Multiple rules match "${identifier}". Specify the full rule ID.`,
27904
27757
  next: matches.map((r) => ({
27905
- command: withGlobalFlags6(
27758
+ command: withGlobalFlags3(
27906
27759
  client,
27907
27760
  `firewall rules remove "${r.id}" --yes`
27908
27761
  ),
@@ -27991,7 +27844,11 @@ async function reorder(client, argv) {
27991
27844
  );
27992
27845
  if (typeof parsed === "number")
27993
27846
  return parsed;
27994
- const link = await ensureProjectLink2(client);
27847
+ const link = await requireProjectContext(
27848
+ client,
27849
+ "firewall",
27850
+ parsed.flags["--project"]
27851
+ );
27995
27852
  if (typeof link === "number")
27996
27853
  return link;
27997
27854
  const { project, org } = link;
@@ -28019,14 +27876,14 @@ async function reorder(client, argv) {
28019
27876
  message: "Rule name or ID is required.",
28020
27877
  next: [
28021
27878
  {
28022
- command: withGlobalFlags6(
27879
+ command: withGlobalFlags3(
28023
27880
  client,
28024
27881
  "firewall rules reorder <name-or-id> --first --yes"
28025
27882
  ),
28026
27883
  when: "replace <name-or-id>"
28027
27884
  },
28028
27885
  {
28029
- command: withGlobalFlags6(client, "firewall rules list"),
27886
+ command: withGlobalFlags3(client, "firewall rules list"),
28030
27887
  when: "list rules"
28031
27888
  }
28032
27889
  ]
@@ -28035,7 +27892,7 @@ async function reorder(client, argv) {
28035
27892
  );
28036
27893
  }
28037
27894
  output_manager_default.error(
28038
- `Rule name or ID is required. Usage: ${getCommandName("firewall rules reorder <name-or-id> --position N --yes")}`
27895
+ `Rule name or ID is required. Usage: ${withGlobalFlags3(client, "firewall rules reorder <name-or-id> --position N --yes")}`
28039
27896
  );
28040
27897
  return 1;
28041
27898
  }
@@ -28057,7 +27914,7 @@ async function reorder(client, argv) {
28057
27914
  if (matches.length === 0) {
28058
27915
  output_manager_default.stopSpinner();
28059
27916
  output_manager_default.error(
28060
- `No rule found for "${identifier}". Run ${import_chalk106.default.cyan(getCommandName("firewall rules list"))} to view all rules.`
27917
+ `No rule found for "${identifier}". Run ${import_chalk106.default.cyan(withGlobalFlags3(client, "firewall rules list"))} to view all rules.`
28061
27918
  );
28062
27919
  return 1;
28063
27920
  }
@@ -28071,7 +27928,7 @@ async function reorder(client, argv) {
28071
27928
  reason: "ambiguous_match",
28072
27929
  message: `Multiple rules match "${identifier}". Specify the full rule ID.`,
28073
27930
  next: matches.map((r) => ({
28074
- command: withGlobalFlags6(
27931
+ command: withGlobalFlags3(
28075
27932
  client,
28076
27933
  `firewall rules reorder "${r.id}" --first --yes`
28077
27934
  ),
@@ -28140,14 +27997,14 @@ async function reorder(client, argv) {
28140
27997
  message: "A position flag is required. Use --position N, --first, or --last.",
28141
27998
  next: [
28142
27999
  {
28143
- command: withGlobalFlags6(
28000
+ command: withGlobalFlags3(
28144
28001
  client,
28145
28002
  `firewall rules reorder "${rule.name}" --first --yes`
28146
28003
  ),
28147
28004
  when: "move to first position"
28148
28005
  },
28149
28006
  {
28150
- command: withGlobalFlags6(
28007
+ command: withGlobalFlags3(
28151
28008
  client,
28152
28009
  `firewall rules reorder "${rule.name}" --last --yes`
28153
28010
  ),
@@ -28247,12 +28104,7 @@ var COMMAND_CONFIG23 = {
28247
28104
  remove: getCommandAliases(rulesRemoveSubcommand2),
28248
28105
  reorder: getCommandAliases(rulesReorderSubcommand)
28249
28106
  };
28250
- async function main14(client, args) {
28251
- const telemetry2 = new FirewallTelemetryClient({
28252
- opts: {
28253
- store: client.telemetryEventStore
28254
- }
28255
- });
28107
+ async function main14(client, args, telemetry2) {
28256
28108
  const flagsSpecification = getFlagsSpecification(rulesSubcommand2.options);
28257
28109
  let parsedArgs;
28258
28110
  try {
@@ -28364,6 +28216,172 @@ async function main14(client, args) {
28364
28216
  }
28365
28217
  }
28366
28218
 
28219
+ // src/util/telemetry/commands/firewall/index.ts
28220
+ var FirewallTelemetryClient = class extends TelemetryClient {
28221
+ trackCliSubcommandOverview(actual) {
28222
+ this.trackCliSubcommand({
28223
+ subcommand: "overview",
28224
+ value: actual
28225
+ });
28226
+ }
28227
+ trackCliSubcommandDiff(actual) {
28228
+ this.trackCliSubcommand({
28229
+ subcommand: "diff",
28230
+ value: actual
28231
+ });
28232
+ }
28233
+ trackCliSubcommandPublish(actual) {
28234
+ this.trackCliSubcommand({
28235
+ subcommand: "publish",
28236
+ value: actual
28237
+ });
28238
+ }
28239
+ trackCliSubcommandDiscard(actual) {
28240
+ this.trackCliSubcommand({
28241
+ subcommand: "discard",
28242
+ value: actual
28243
+ });
28244
+ }
28245
+ trackCliSubcommandRules(actual) {
28246
+ this.trackCliSubcommand({
28247
+ subcommand: "rules",
28248
+ value: actual
28249
+ });
28250
+ }
28251
+ trackCliSubcommandRulesList(actual) {
28252
+ this.trackCliSubcommand({
28253
+ subcommand: "rules:list",
28254
+ value: actual
28255
+ });
28256
+ }
28257
+ trackCliSubcommandRulesInspect(actual) {
28258
+ this.trackCliSubcommand({
28259
+ subcommand: "rules:inspect",
28260
+ value: actual
28261
+ });
28262
+ }
28263
+ trackCliSubcommandRulesAdd(actual) {
28264
+ this.trackCliSubcommand({
28265
+ subcommand: "rules:add",
28266
+ value: actual
28267
+ });
28268
+ }
28269
+ trackCliSubcommandRulesEdit(actual) {
28270
+ this.trackCliSubcommand({
28271
+ subcommand: "rules:edit",
28272
+ value: actual
28273
+ });
28274
+ }
28275
+ trackCliSubcommandRulesEnable(actual) {
28276
+ this.trackCliSubcommand({
28277
+ subcommand: "rules:enable",
28278
+ value: actual
28279
+ });
28280
+ }
28281
+ trackCliSubcommandRulesDisable(actual) {
28282
+ this.trackCliSubcommand({
28283
+ subcommand: "rules:disable",
28284
+ value: actual
28285
+ });
28286
+ }
28287
+ trackCliSubcommandRulesRemove(actual) {
28288
+ this.trackCliSubcommand({
28289
+ subcommand: "rules:remove",
28290
+ value: actual
28291
+ });
28292
+ }
28293
+ trackCliSubcommandRulesReorder(actual) {
28294
+ this.trackCliSubcommand({
28295
+ subcommand: "rules:reorder",
28296
+ value: actual
28297
+ });
28298
+ }
28299
+ trackCliSubcommandIpBlocks(actual) {
28300
+ this.trackCliSubcommand({
28301
+ subcommand: "ip-blocks",
28302
+ value: actual
28303
+ });
28304
+ }
28305
+ trackCliSubcommandIpBlocksList(actual) {
28306
+ this.trackCliSubcommand({
28307
+ subcommand: "ip-blocks:list",
28308
+ value: actual
28309
+ });
28310
+ }
28311
+ trackCliSubcommandIpBlocksBlock(actual) {
28312
+ this.trackCliSubcommand({
28313
+ subcommand: "ip-blocks:block",
28314
+ value: actual
28315
+ });
28316
+ }
28317
+ trackCliSubcommandIpBlocksUnblock(actual) {
28318
+ this.trackCliSubcommand({
28319
+ subcommand: "ip-blocks:unblock",
28320
+ value: actual
28321
+ });
28322
+ }
28323
+ trackCliSubcommandSystemBypass(actual) {
28324
+ this.trackCliSubcommand({
28325
+ subcommand: "system-bypass",
28326
+ value: actual
28327
+ });
28328
+ }
28329
+ trackCliSubcommandSystemBypassList(actual) {
28330
+ this.trackCliSubcommand({
28331
+ subcommand: "system-bypass:list",
28332
+ value: actual
28333
+ });
28334
+ }
28335
+ trackCliSubcommandSystemBypassAdd(actual) {
28336
+ this.trackCliSubcommand({
28337
+ subcommand: "system-bypass:add",
28338
+ value: actual
28339
+ });
28340
+ }
28341
+ trackCliSubcommandSystemBypassRemove(actual) {
28342
+ this.trackCliSubcommand({
28343
+ subcommand: "system-bypass:remove",
28344
+ value: actual
28345
+ });
28346
+ }
28347
+ trackCliSubcommandAttackMode(actual) {
28348
+ this.trackCliSubcommand({
28349
+ subcommand: "attack-mode",
28350
+ value: actual
28351
+ });
28352
+ }
28353
+ trackCliSubcommandAttackModeEnable(actual) {
28354
+ this.trackCliSubcommand({
28355
+ subcommand: "attack-mode:enable",
28356
+ value: actual
28357
+ });
28358
+ }
28359
+ trackCliSubcommandAttackModeDisable(actual) {
28360
+ this.trackCliSubcommand({
28361
+ subcommand: "attack-mode:disable",
28362
+ value: actual
28363
+ });
28364
+ }
28365
+ trackCliSubcommandSystemMitigations(actual) {
28366
+ this.trackCliSubcommand({
28367
+ subcommand: "system-mitigations",
28368
+ value: actual
28369
+ });
28370
+ }
28371
+ trackCliSubcommandSystemMitigationsPause(actual) {
28372
+ this.trackCliSubcommand({
28373
+ subcommand: "system-mitigations:pause",
28374
+ value: actual
28375
+ });
28376
+ }
28377
+ trackCliSubcommandSystemMitigationsResume(actual) {
28378
+ this.trackCliSubcommand({
28379
+ subcommand: "system-mitigations:resume",
28380
+ value: actual
28381
+ });
28382
+ }
28383
+ };
28384
+
28367
28385
  // src/commands/firewall/index.ts
28368
28386
  var COMMAND_CONFIG24 = {
28369
28387
  overview: getCommandAliases(overviewSubcommand),
@@ -28411,6 +28429,9 @@ async function main15(client) {
28411
28429
  })
28412
28430
  );
28413
28431
  }
28432
+ if (subcommand && !needHelp) {
28433
+ telemetry2.trackCliOptionProject(getProjectOptionFromArgs(args));
28434
+ }
28414
28435
  switch (subcommand) {
28415
28436
  case "overview":
28416
28437
  if (needHelp) {
@@ -28447,27 +28468,27 @@ async function main15(client) {
28447
28468
  case "rules": {
28448
28469
  telemetry2.trackCliSubcommandRules(subcommandOriginal);
28449
28470
  const nestedArgs = needHelp ? [...args, "--help"] : args;
28450
- return main14(client, nestedArgs);
28471
+ return main14(client, nestedArgs, telemetry2);
28451
28472
  }
28452
28473
  case "ip-blocks": {
28453
28474
  telemetry2.trackCliSubcommandIpBlocks(subcommandOriginal);
28454
28475
  const nestedArgs = needHelp ? [...args, "--help"] : args;
28455
- return main13(client, nestedArgs);
28476
+ return main13(client, nestedArgs, telemetry2);
28456
28477
  }
28457
28478
  case "system-bypass": {
28458
28479
  telemetry2.trackCliSubcommandSystemBypass(subcommandOriginal);
28459
28480
  const nestedArgs = needHelp ? [...args, "--help"] : args;
28460
- return main10(client, nestedArgs);
28481
+ return main10(client, nestedArgs, telemetry2);
28461
28482
  }
28462
28483
  case "attack-mode": {
28463
28484
  telemetry2.trackCliSubcommandAttackMode(subcommandOriginal);
28464
28485
  const nestedArgs = needHelp ? [...args, "--help"] : args;
28465
- return main11(client, nestedArgs);
28486
+ return main11(client, nestedArgs, telemetry2);
28466
28487
  }
28467
28488
  case "system-mitigations": {
28468
28489
  telemetry2.trackCliSubcommandSystemMitigations(subcommandOriginal);
28469
28490
  const nestedArgs = needHelp ? [...args, "--help"] : args;
28470
- return main12(client, nestedArgs);
28491
+ return main12(client, nestedArgs, telemetry2);
28471
28492
  }
28472
28493
  default:
28473
28494
  output_manager_default.error(getInvalidSubcommand(COMMAND_CONFIG24));
@@ -37712,7 +37733,10 @@ function isRecord3(value) {
37712
37733
  // src/commands/flags/rules-common.ts
37713
37734
  var import_chalk144 = __toESM(require_source(), 1);
37714
37735
  async function resolveRulesCommandContext(client, options) {
37715
- const link = await getLinkedProject(client);
37736
+ const link = await resolveProjectContext({
37737
+ client,
37738
+ projectNameOrId: options.projectName
37739
+ });
37716
37740
  if (link.status === "error") {
37717
37741
  return { exitCode: link.exitCode };
37718
37742
  } else if (link.status === "not_linked") {
@@ -37795,6 +37819,7 @@ async function rulesLs(client, argv) {
37795
37819
  telemetryClient.trackCliArgumentFlag(flagArg);
37796
37820
  telemetryClient.trackCliOptionEnvironment(environment);
37797
37821
  telemetryClient.trackCliFlagJson(json);
37822
+ telemetryClient.trackCliOptionProject(flags["--project"]);
37798
37823
  if (!flagArg) {
37799
37824
  output_manager_default.error("Please provide a flag slug or ID to list rules for");
37800
37825
  output_manager_default.log(
@@ -37804,6 +37829,7 @@ async function rulesLs(client, argv) {
37804
37829
  }
37805
37830
  try {
37806
37831
  const context = await resolveRulesCommandContext(client, {
37832
+ projectName: parsedArgs.flags["--project"],
37807
37833
  flagArg,
37808
37834
  environment,
37809
37835
  promptMessage: "Select an environment to list rules for:"
@@ -37828,12 +37854,13 @@ async function rulesLs(client, argv) {
37828
37854
  const lsStamp = stamp_default();
37829
37855
  const environmentLabel = effectiveEnvironment.inheritedFrom ? `${context.environment} (reuses ${effectiveEnvironment.inheritedFrom})` : context.environment;
37830
37856
  if (rules3.length === 0) {
37857
+ const projectFlag = flags["--project"] ? ` --project ${flags["--project"]}` : "";
37831
37858
  output_manager_default.log(
37832
37859
  `No conditional rules found for ${import_chalk145.default.bold(context.flag.slug)} in ${environmentLabel} ${import_chalk145.default.gray(lsStamp())}`
37833
37860
  );
37834
37861
  output_manager_default.log(
37835
37862
  `
37836
- Add one with: ${getCommandName("flags rules add " + context.flag.slug + " --environment " + context.environment + " --condition user.plan:eq:pro --variant on")}`
37863
+ Add one with: ${getCommandName("flags rules add " + context.flag.slug + " --environment " + context.environment + " --condition user.plan:eq:pro --variant on" + projectFlag)}`
37837
37864
  );
37838
37865
  return 0;
37839
37866
  }
@@ -37927,6 +37954,7 @@ async function rulesAdd(client, argv) {
37927
37954
  telemetryClient.trackCliOptionStart(start);
37928
37955
  telemetryClient.trackCliOptionPosition(position);
37929
37956
  telemetryClient.trackCliOptionMessage(message);
37957
+ telemetryClient.trackCliOptionProject(flags["--project"]);
37930
37958
  const outcomeOptions = {
37931
37959
  variantSelector,
37932
37960
  baseSelector,
@@ -37946,6 +37974,7 @@ async function rulesAdd(client, argv) {
37946
37974
  }
37947
37975
  try {
37948
37976
  const context = await resolveRulesCommandContext(client, {
37977
+ projectName: parsedArgs.flags["--project"],
37949
37978
  flagArg,
37950
37979
  environment,
37951
37980
  promptMessage: "Select an environment to add the rule to:",
@@ -38058,6 +38087,7 @@ async function rulesUpdate(client, argv) {
38058
38087
  telemetryClient.trackCliOptionStage(stageInputs);
38059
38088
  telemetryClient.trackCliOptionStart(start);
38060
38089
  telemetryClient.trackCliOptionMessage(message);
38090
+ telemetryClient.trackCliOptionProject(flags["--project"]);
38061
38091
  const outcomeOptions = {
38062
38092
  variantSelector,
38063
38093
  baseSelector,
@@ -38077,6 +38107,7 @@ async function rulesUpdate(client, argv) {
38077
38107
  }
38078
38108
  try {
38079
38109
  const context = await resolveRulesCommandContext(client, {
38110
+ projectName: parsedArgs.flags["--project"],
38080
38111
  flagArg,
38081
38112
  environment,
38082
38113
  promptMessage: "Select an environment containing the rule:",
@@ -38172,6 +38203,7 @@ async function rulesRemove(client, argv) {
38172
38203
  telemetryClient.trackCliArgumentRule(ruleId);
38173
38204
  telemetryClient.trackCliOptionEnvironment(environment);
38174
38205
  telemetryClient.trackCliOptionMessage(message);
38206
+ telemetryClient.trackCliOptionProject(flags["--project"]);
38175
38207
  if (!flagArg || !ruleId) {
38176
38208
  output_manager_default.error("Please provide a flag slug or ID and rule ID to remove");
38177
38209
  output_manager_default.log(
@@ -38181,6 +38213,7 @@ async function rulesRemove(client, argv) {
38181
38213
  }
38182
38214
  try {
38183
38215
  const context = await resolveRulesCommandContext(client, {
38216
+ projectName: parsedArgs.flags["--project"],
38184
38217
  flagArg,
38185
38218
  environment,
38186
38219
  promptMessage: "Select an environment containing the rule:",
@@ -38248,6 +38281,7 @@ async function rulesMove(client, argv) {
38248
38281
  telemetryClient.trackCliOptionEnvironment(environment);
38249
38282
  telemetryClient.trackCliOptionPosition(position);
38250
38283
  telemetryClient.trackCliOptionMessage(message);
38284
+ telemetryClient.trackCliOptionProject(flags["--project"]);
38251
38285
  if (!flagArg || !ruleId || position === void 0) {
38252
38286
  output_manager_default.error(
38253
38287
  "Please provide a flag slug or ID, rule ID, and destination position"
@@ -38259,6 +38293,7 @@ async function rulesMove(client, argv) {
38259
38293
  }
38260
38294
  try {
38261
38295
  const context = await resolveRulesCommandContext(client, {
38296
+ projectName: parsedArgs.flags["--project"],
38262
38297
  flagArg,
38263
38298
  environment,
38264
38299
  promptMessage: "Select an environment containing the rule:",
@@ -38773,6 +38808,7 @@ async function connect(client, argv) {
38773
38808
  });
38774
38809
  telemetry2.trackCliFlagConfirm(opts["--confirm"]);
38775
38810
  telemetry2.trackCliFlagYes(opts["--yes"]);
38811
+ telemetry2.trackCliOptionProject(opts["--project"]);
38776
38812
  if ("--confirm" in opts) {
38777
38813
  output_manager_default.warn("`--confirm` is deprecated, please use `--yes` instead");
38778
38814
  opts["--yes"] = opts["--confirm"];
@@ -38788,8 +38824,11 @@ async function connect(client, argv) {
38788
38824
  }
38789
38825
  const repoArg = args[0];
38790
38826
  telemetry2.trackCliArgumentGitUrl(repoArg);
38827
+ const projectName = opts["--project"];
38791
38828
  const linkedProject = await ensureLink("git", client, client.cwd, {
38792
- autoConfirm: confirm
38829
+ autoConfirm: confirm,
38830
+ projectName,
38831
+ failIfNotFound: Boolean(projectName)
38793
38832
  });
38794
38833
  if (typeof linkedProject === "number") {
38795
38834
  return linkedProject;
@@ -39010,6 +39049,7 @@ async function disconnect(client, argv) {
39010
39049
  });
39011
39050
  telemetry2.trackCliFlagConfirm(opts["--confirm"]);
39012
39051
  telemetry2.trackCliFlagYes(opts["--yes"]);
39052
+ telemetry2.trackCliOptionProject(opts["--project"]);
39013
39053
  if ("--confirm" in opts) {
39014
39054
  output_manager_default.warn("`--confirm` is deprecated, please use `--yes` instead");
39015
39055
  opts["--yes"] = opts["--confirm"];
@@ -39023,8 +39063,11 @@ async function disconnect(client, argv) {
39023
39063
  return 2;
39024
39064
  }
39025
39065
  const autoConfirm = Boolean(parsedArgs.flags["--yes"]);
39066
+ const projectName = opts["--project"];
39026
39067
  const linkedProject = await ensureLink("git", client, client.cwd, {
39027
- autoConfirm
39068
+ autoConfirm,
39069
+ projectName,
39070
+ failIfNotFound: Boolean(projectName)
39028
39071
  });
39029
39072
  if (typeof linkedProject === "number") {
39030
39073
  return linkedProject;
@@ -48235,7 +48278,7 @@ async function metrics(client) {
48235
48278
  return 0;
48236
48279
  }
48237
48280
  telemetry2.trackCliSubcommandSchema(subcommandOriginal);
48238
- const schemaFn = (await import("./chunks/schema-4RRRUUOO.js")).default;
48281
+ const schemaFn = (await import("./chunks/schema-3LX3V2HE.js")).default;
48239
48282
  return schemaFn(client, telemetry2);
48240
48283
  }
48241
48284
  default: {
@@ -48248,7 +48291,7 @@ async function metrics(client) {
48248
48291
  output_manager_default.print(help(metricsCommand, { columns: client.stderr.columns }));
48249
48292
  return 2;
48250
48293
  }
48251
- const queryFn = (await import("./chunks/query-NWW6RDHK.js")).default;
48294
+ const queryFn = (await import("./chunks/query-3AHRMAPA.js")).default;
48252
48295
  return queryFn(client, telemetry2);
48253
48296
  }
48254
48297
  }
@@ -48495,7 +48538,7 @@ async function createGroup(client) {
48495
48538
  const wouldAffectBilling = existingMfeProjectCount + projectsToAddCount > freeProjects;
48496
48539
  if (wouldAffectBilling) {
48497
48540
  if (isNonInteractive) {
48498
- const flags = getGlobalFlagsOnlyFromArgs(client.argv.slice(2));
48541
+ const flags = getGlobalFlagsFromArgs(client.argv.slice(2));
48499
48542
  const interactiveCmd = getCommandNamePlain(
48500
48543
  `microfrontends create-group ${flags.filter((f) => f !== "--non-interactive").join(" ")}`.trim()
48501
48544
  );
@@ -48956,7 +48999,7 @@ async function addToGroup(client) {
48956
48999
  if (wouldAffectBilling) {
48957
49000
  if (client.nonInteractive) {
48958
49001
  const settingsUrl2 = `https://vercel.com/${teamSlug}/${project.name}/settings/microfrontends`;
48959
- const flags = getGlobalFlagsOnlyFromArgs(client.argv.slice(2));
49002
+ const flags = getGlobalFlagsFromArgs(client.argv.slice(2));
48960
49003
  const interactiveCmd = getCommandNamePlain(
48961
49004
  `microfrontends add-to-group ${flags.filter((f) => f !== "--non-interactive").join(" ")}`.trim()
48962
49005
  );
@@ -53328,51 +53371,21 @@ var import_chalk205 = __toESM(require_source(), 1);
53328
53371
  var import_pluralize12 = __toESM(require_pluralize(), 1);
53329
53372
 
53330
53373
  // src/commands/redirects/shared.ts
53374
+ function withGlobalFlags4(client, commandTemplate) {
53375
+ return withGlobalFlags(client, commandTemplate, {
53376
+ preserveProject: true
53377
+ });
53378
+ }
53331
53379
  async function parseSubcommandArgs3(argv, command) {
53332
53380
  let parsedArgs;
53333
- const flagsSpecification = getFlagsSpecification(command.options);
53334
53381
  try {
53335
- parsedArgs = parseArguments(argv, flagsSpecification);
53382
+ parsedArgs = parseSubcommandArguments(argv, command);
53336
53383
  } catch (err) {
53337
53384
  printError(err);
53338
53385
  return 1;
53339
53386
  }
53340
53387
  return parsedArgs;
53341
53388
  }
53342
- function validateRequiredArgs(args, required) {
53343
- for (let i = 0; i < required.length; i++) {
53344
- if (!args[i]) {
53345
- return `Missing required argument: ${required[i]}`;
53346
- }
53347
- }
53348
- return null;
53349
- }
53350
- async function ensureProjectLink3(client) {
53351
- const link = await getLinkedProject(client);
53352
- if (link.status === "error") {
53353
- return link.exitCode;
53354
- } else if (link.status === "not_linked") {
53355
- if (client.nonInteractive) {
53356
- const linkCmd = getCommandNamePlain("link");
53357
- outputAgentError(
53358
- client,
53359
- {
53360
- status: AGENT_STATUS.ERROR,
53361
- reason: AGENT_REASON.NOT_LINKED,
53362
- message: `Your codebase isn't linked to a project on Vercel. Run ${linkCmd} to begin.`,
53363
- next: [{ command: linkCmd }]
53364
- },
53365
- 1
53366
- );
53367
- }
53368
- output_manager_default.error(
53369
- `Your codebase isn't linked to a project on Vercel. Run ${getCommandName("link")} to begin.`
53370
- );
53371
- return 1;
53372
- }
53373
- client.config.currentTeam = link.org.type === "team" ? link.org.id : void 0;
53374
- return link;
53375
- }
53376
53389
  async function confirmAction2(client, skipConfirmation, message, details) {
53377
53390
  if (skipConfirmation)
53378
53391
  return true;
@@ -53393,45 +53406,14 @@ function isValidUrl(url) {
53393
53406
  return false;
53394
53407
  }
53395
53408
  }
53396
- var REDIRECTS_SUBCOMMAND_EXCLUSIVE_FLAGS = /* @__PURE__ */ new Set([
53397
- "--status",
53398
- "--case-sensitive",
53399
- "--preserve-query-params",
53400
- "--name",
53401
- "--overwrite"
53402
- ]);
53403
53409
  function getArgsAfterRedirectsSubcommand(fullArgs, subcommand) {
53404
53410
  const idx = fullArgs.indexOf(subcommand);
53405
53411
  return idx >= 0 ? fullArgs.slice(idx + 1) : [];
53406
53412
  }
53407
53413
  function getRedirectGlobalFlagsOnly(afterSubcommandArgs) {
53408
- const out = [];
53409
- for (let i = 0; i < afterSubcommandArgs.length; i++) {
53410
- const a = afterSubcommandArgs[i];
53411
- if (!a.startsWith("-"))
53412
- continue;
53413
- let name = a;
53414
- const hasEq = a.includes("=");
53415
- if (hasEq) {
53416
- name = a.slice(0, a.indexOf("="));
53417
- }
53418
- if (REDIRECTS_SUBCOMMAND_EXCLUSIVE_FLAGS.has(name)) {
53419
- if (!hasEq && (name === "--status" || name === "--name") && i + 1 < afterSubcommandArgs.length && !afterSubcommandArgs[i + 1].startsWith("-")) {
53420
- i++;
53421
- }
53422
- continue;
53423
- }
53424
- if (!GLOBAL_CLI_FLAG_NAMES.has(name)) {
53425
- continue;
53426
- }
53427
- out.push(a);
53428
- if (!hasEq && globalCliFlagTakesValue(name)) {
53429
- if (i + 1 < afterSubcommandArgs.length && !afterSubcommandArgs[i + 1].startsWith("-")) {
53430
- out.push(afterSubcommandArgs[++i]);
53431
- }
53432
- }
53433
- }
53434
- return out;
53414
+ return getGlobalFlagsFromArgs(afterSubcommandArgs, {
53415
+ preserveProject: true
53416
+ });
53435
53417
  }
53436
53418
  function getRedirectPromoteSuggestionFlags(afterSubcommandArgs) {
53437
53419
  const parts = getRedirectGlobalFlagsOnly(afterSubcommandArgs);
@@ -53442,7 +53424,7 @@ function getRedirectPromoteSuggestionFlags(afterSubcommandArgs) {
53442
53424
  }
53443
53425
  function buildRedirectsSuggestionFlags(fullArgs, subcommand, options = {}) {
53444
53426
  const after = getArgsAfterRedirectsSubcommand(fullArgs, subcommand);
53445
- const flagParts = after.filter((a) => a.startsWith("-"));
53427
+ const flagParts = getSameSubcommandSuggestionFlags(after);
53446
53428
  if (options.ensureYes !== false && !flagParts.some((a) => a === "--yes" || a === "-y")) {
53447
53429
  flagParts.push("--yes");
53448
53430
  }
@@ -53491,7 +53473,11 @@ async function list14(client, argv) {
53491
53473
  const parsed = await parseSubcommandArgs3(argv, listSubcommand14);
53492
53474
  if (typeof parsed === "number")
53493
53475
  return parsed;
53494
- const link = await ensureProjectLink3(client);
53476
+ const link = await requireProjectContext(
53477
+ client,
53478
+ "redirects",
53479
+ parsed.flags["--project"]
53480
+ );
53495
53481
  if (typeof link === "number")
53496
53482
  return link;
53497
53483
  const { project, org } = link;
@@ -53512,7 +53498,7 @@ async function list14(client, argv) {
53512
53498
  if (!stagingVersion) {
53513
53499
  output_manager_default.error(
53514
53500
  `No staging version found for ${import_chalk205.default.bold(project.name)}. Run ${import_chalk205.default.cyan(
53515
- "vercel redirects list-versions"
53501
+ withGlobalFlags4(client, "redirects list-versions")
53516
53502
  )} to see available versions.`
53517
53503
  );
53518
53504
  return 1;
@@ -53536,7 +53522,7 @@ async function list14(client, argv) {
53536
53522
  if (!version) {
53537
53523
  output_manager_default.error(
53538
53524
  `Version "${versionIdFlag}" not found. Run ${import_chalk205.default.cyan(
53539
- "vercel redirects list-versions"
53525
+ withGlobalFlags4(client, "redirects list-versions")
53540
53526
  )} to see available versions.`
53541
53527
  );
53542
53528
  return 1;
@@ -53609,7 +53595,7 @@ async function list14(client, argv) {
53609
53595
  output_manager_default.log(resultMessage);
53610
53596
  if (client.nonInteractive && redirects.length === 0 && !staging && !versionIdFlag) {
53611
53597
  output_manager_default.log(
53612
- ` ${getCommandNamePlain("redirects list")} shows production redirects only. If you added redirects but do not see them here, they may still be staged only\u2014run ${getCommandNamePlain("redirects list --staging")} to view staged changes.`
53598
+ ` ${withGlobalFlags4(client, "redirects list")} shows production redirects only. If you added redirects but do not see them here, they may still be staged only\u2014run ${withGlobalFlags4(client, "redirects list --staging")} to view staged changes.`
53613
53599
  );
53614
53600
  }
53615
53601
  if (redirects.length > 0) {
@@ -53626,7 +53612,9 @@ async function list14(client, argv) {
53626
53612
  if (perPage) {
53627
53613
  command += ` --per-page ${perPage}`;
53628
53614
  }
53629
- output_manager_default.log(`To display the next page, run ${getCommandName(command)}`);
53615
+ output_manager_default.log(
53616
+ `To display the next page, run ${withGlobalFlags4(client, command)}`
53617
+ );
53630
53618
  }
53631
53619
  return 0;
53632
53620
  }
@@ -53656,7 +53644,11 @@ async function listVersions2(client, argv) {
53656
53644
  const parsed = await parseSubcommandArgs3(argv, listVersionsSubcommand);
53657
53645
  if (typeof parsed === "number")
53658
53646
  return parsed;
53659
- const link = await ensureProjectLink3(client);
53647
+ const link = await requireProjectContext(
53648
+ client,
53649
+ "redirects",
53650
+ parsed.flags["--project"]
53651
+ );
53660
53652
  if (typeof link === "number")
53661
53653
  return link;
53662
53654
  const { project, org } = link;
@@ -53769,7 +53761,11 @@ async function add10(client, argv) {
53769
53761
  const parsed = await parseSubcommandArgs3(argv, addSubcommand8);
53770
53762
  if (typeof parsed === "number")
53771
53763
  return parsed;
53772
- const link = await ensureProjectLink3(client);
53764
+ const link = await requireProjectContext(
53765
+ client,
53766
+ "redirects",
53767
+ parsed.flags["--project"]
53768
+ );
53773
53769
  if (typeof link === "number")
53774
53770
  return link;
53775
53771
  const { project, org } = link;
@@ -54196,7 +54192,11 @@ async function upload(client, argv) {
54196
54192
  const parsed = await parseSubcommandArgs3(argv, uploadSubcommand);
54197
54193
  if (typeof parsed === "number")
54198
54194
  return parsed;
54199
- const link = await ensureProjectLink3(client);
54195
+ const link = await requireProjectContext(
54196
+ client,
54197
+ "redirects",
54198
+ parsed.flags["--project"]
54199
+ );
54200
54200
  if (typeof link === "number")
54201
54201
  return link;
54202
54202
  const { project, org } = link;
@@ -54380,7 +54380,7 @@ async function upload(client, argv) {
54380
54380
  ]
54381
54381
  },
54382
54382
  ...existingStagingVersion && {
54383
- hint: `Review staged changes with ${getCommandNamePlain("redirects list --staging")} before promoting.`
54383
+ hint: `Review staged changes with ${withGlobalFlags4(client, "redirects list --staging")} before promoting.`
54384
54384
  }
54385
54385
  };
54386
54386
  client.stdout.write(`${JSON.stringify(jsonOutput, null, 2)}
@@ -54548,7 +54548,7 @@ async function remove7(client, argv) {
54548
54548
  const parsed = await parseSubcommandArgs3(argv, removeSubcommand12);
54549
54549
  if (typeof parsed === "number")
54550
54550
  return parsed;
54551
- const error = validateRequiredArgs(parsed.args, ["source"]);
54551
+ const error = validateRequiredArguments(parsed.args, ["source"]);
54552
54552
  if (error) {
54553
54553
  if (client.nonInteractive) {
54554
54554
  const flagParts = buildRedirectsSuggestionFlags(
@@ -54573,7 +54573,11 @@ async function remove7(client, argv) {
54573
54573
  output_manager_default.error(error);
54574
54574
  return 1;
54575
54575
  }
54576
- const link = await ensureProjectLink3(client);
54576
+ const link = await requireProjectContext(
54577
+ client,
54578
+ "redirects",
54579
+ parsed.flags["--project"]
54580
+ );
54577
54581
  if (typeof link === "number")
54578
54582
  return link;
54579
54583
  const { project, org } = link;
@@ -54681,7 +54685,7 @@ async function remove7(client, argv) {
54681
54685
  ]
54682
54686
  },
54683
54687
  ...existingStagingVersion && {
54684
- hint: `Review staged changes with ${getCommandNamePlain("redirects list --staging")} before promoting.`
54688
+ hint: `Review staged changes with ${withGlobalFlags4(client, "redirects list --staging")} before promoting.`
54685
54689
  }
54686
54690
  };
54687
54691
  client.stdout.write(`${JSON.stringify(jsonOutput, null, 2)}
@@ -54740,7 +54744,7 @@ async function promote(client, argv) {
54740
54744
  const parsed = await parseSubcommandArgs3(argv, promoteSubcommand);
54741
54745
  if (typeof parsed === "number")
54742
54746
  return parsed;
54743
- const error = validateRequiredArgs(parsed.args, ["version-id"]);
54747
+ const error = validateRequiredArguments(parsed.args, ["version-id"]);
54744
54748
  if (error) {
54745
54749
  if (client.nonInteractive) {
54746
54750
  const afterPromote = getArgsAfterRedirectsSubcommand(
@@ -54776,7 +54780,11 @@ async function promote(client, argv) {
54776
54780
  output_manager_default.error(error);
54777
54781
  return 1;
54778
54782
  }
54779
- const link = await ensureProjectLink3(client);
54783
+ const link = await requireProjectContext(
54784
+ client,
54785
+ "redirects",
54786
+ parsed.flags["--project"]
54787
+ );
54780
54788
  if (typeof link === "number")
54781
54789
  return link;
54782
54790
  const { project, org } = link;
@@ -54962,7 +54970,7 @@ async function restore(client, argv) {
54962
54970
  const parsed = await parseSubcommandArgs3(argv, restoreSubcommand);
54963
54971
  if (typeof parsed === "number")
54964
54972
  return parsed;
54965
- const error = validateRequiredArgs(parsed.args, ["version-id"]);
54973
+ const error = validateRequiredArguments(parsed.args, ["version-id"]);
54966
54974
  if (error) {
54967
54975
  if (client.nonInteractive) {
54968
54976
  const afterRestore = getArgsAfterRedirectsSubcommand(
@@ -55001,7 +55009,11 @@ async function restore(client, argv) {
55001
55009
  output_manager_default.error(error);
55002
55010
  return 1;
55003
55011
  }
55004
- const link = await ensureProjectLink3(client);
55012
+ const link = await requireProjectContext(
55013
+ client,
55014
+ "redirects",
55015
+ parsed.flags["--project"]
55016
+ );
55005
55017
  if (typeof link === "number")
55006
55018
  return link;
55007
55019
  const { project, org } = link;
@@ -55263,6 +55275,9 @@ async function main25(client) {
55263
55275
  })
55264
55276
  );
55265
55277
  }
55278
+ if (subcommand && !needHelp) {
55279
+ telemetry2.trackCliOptionProject(getProjectOptionFromArgs(args));
55280
+ }
55266
55281
  switch (subcommand) {
55267
55282
  case "list":
55268
55283
  if (needHelp) {
@@ -56820,7 +56835,11 @@ async function list15(client, argv) {
56820
56835
  const parsed = await parseSubcommandArgs(argv, listSubcommand15, client);
56821
56836
  if (typeof parsed === "number")
56822
56837
  return parsed;
56823
- const link = await ensureProjectLink(client);
56838
+ const link = await requireProjectContext(
56839
+ client,
56840
+ "routes",
56841
+ parsed.flags["--project"]
56842
+ );
56824
56843
  if (typeof link === "number")
56825
56844
  return link;
56826
56845
  const { project, org } = link;
@@ -56846,7 +56865,7 @@ async function list15(client, argv) {
56846
56865
  status: "error",
56847
56866
  reason: "invalid_arguments",
56848
56867
  message: msg,
56849
- next: [{ command: withGlobalFlags(client, "routes list") }]
56868
+ next: [{ command: withGlobalFlags2(client, "routes list") }]
56850
56869
  });
56851
56870
  process.exit(1);
56852
56871
  }
@@ -56861,7 +56880,7 @@ async function list15(client, argv) {
56861
56880
  status: "error",
56862
56881
  reason: "invalid_arguments",
56863
56882
  message: msg,
56864
- next: [{ command: withGlobalFlags(client, "routes list") }]
56883
+ next: [{ command: withGlobalFlags2(client, "routes list") }]
56865
56884
  });
56866
56885
  process.exit(1);
56867
56886
  }
@@ -56875,7 +56894,7 @@ async function list15(client, argv) {
56875
56894
  status: "error",
56876
56895
  reason: "invalid_arguments",
56877
56896
  message: msg,
56878
- next: [{ command: withGlobalFlags(client, "routes list --diff") }]
56897
+ next: [{ command: withGlobalFlags2(client, "routes list --diff") }]
56879
56898
  });
56880
56899
  process.exit(1);
56881
56900
  }
@@ -56898,7 +56917,7 @@ async function list15(client, argv) {
56898
56917
  status: "error",
56899
56918
  reason: "not_found",
56900
56919
  message: msg,
56901
- next: [{ command: withGlobalFlags(client, "routes list") }]
56920
+ next: [{ command: withGlobalFlags2(client, "routes list") }]
56902
56921
  });
56903
56922
  process.exit(1);
56904
56923
  }
@@ -56917,23 +56936,21 @@ async function list15(client, argv) {
56917
56936
  });
56918
56937
  const stagingVersion = versions2.find((v) => v.isStaging);
56919
56938
  if (!stagingVersion) {
56920
- const msg = `No staged changes to diff. Run ${getCommandName("routes add")} or ${getCommandName("routes edit")} to make changes.`;
56939
+ const msg = `No staged changes to diff. Run ${withGlobalFlags2(client, "routes add")} or ${withGlobalFlags2(client, "routes edit")} to make changes.`;
56921
56940
  if (client.nonInteractive) {
56922
56941
  outputAgentError(client, {
56923
56942
  status: "error",
56924
56943
  reason: "not_found",
56925
56944
  message: msg,
56926
56945
  next: [
56927
- { command: withGlobalFlags(client, "routes list") },
56928
- { command: withGlobalFlags(client, "routes add") }
56946
+ { command: withGlobalFlags2(client, "routes list") },
56947
+ { command: withGlobalFlags2(client, "routes add") }
56929
56948
  ]
56930
56949
  });
56931
56950
  process.exit(1);
56932
56951
  }
56933
56952
  output_manager_default.error(
56934
- `No staged changes to diff. Run ${import_chalk215.default.cyan(
56935
- getCommandName("routes add")
56936
- )} or ${import_chalk215.default.cyan(getCommandName("routes edit"))} to make changes.`
56953
+ `No staged changes to diff. Run ${import_chalk215.default.cyan(withGlobalFlags2(client, "routes add"))} or ${import_chalk215.default.cyan(withGlobalFlags2(client, "routes edit"))} to make changes.`
56937
56954
  );
56938
56955
  return 1;
56939
56956
  }
@@ -56946,7 +56963,7 @@ async function list15(client, argv) {
56946
56963
  const { versions: versions2 } = await getRouteVersions(client, project.id, {
56947
56964
  teamId
56948
56965
  });
56949
- const result = findVersionById(versions2, versionIdFlag);
56966
+ const result = findVersionById(client, versions2, versionIdFlag);
56950
56967
  if (result.error || !result.version) {
56951
56968
  const msg = result.error ?? "Version not found";
56952
56969
  if (client.nonInteractive) {
@@ -56954,7 +56971,11 @@ async function list15(client, argv) {
56954
56971
  status: "error",
56955
56972
  reason: "not_found",
56956
56973
  message: msg,
56957
- next: [{ command: withGlobalFlags(client, "routes list-versions") }]
56974
+ next: [
56975
+ {
56976
+ command: withGlobalFlags2(client, "routes list-versions")
56977
+ }
56978
+ ]
56958
56979
  });
56959
56980
  process.exit(1);
56960
56981
  }
@@ -57163,7 +57184,11 @@ async function listVersions3(client, argv) {
57163
57184
  );
57164
57185
  if (typeof parsed === "number")
57165
57186
  return parsed;
57166
- const link = await ensureProjectLink(client);
57187
+ const link = await requireProjectContext(
57188
+ client,
57189
+ "routes",
57190
+ parsed.flags["--project"]
57191
+ );
57167
57192
  if (typeof link === "number")
57168
57193
  return link;
57169
57194
  const { project, org } = link;
@@ -57179,7 +57204,7 @@ async function listVersions3(client, argv) {
57179
57204
  message: "Count must be between 1 and 100",
57180
57205
  next: [
57181
57206
  {
57182
- command: withGlobalFlags(
57207
+ command: withGlobalFlags2(
57183
57208
  client,
57184
57209
  "routes list-versions --count 20"
57185
57210
  )
@@ -57241,15 +57266,15 @@ function getRelativeTime(timestamp) {
57241
57266
 
57242
57267
  // src/commands/routes/inspect.ts
57243
57268
  var import_chalk217 = __toESM(require_source(), 1);
57244
- function withGlobalFlags7(client, commandTemplate) {
57245
- const flags = getGlobalFlagsOnlyFromArgs(client.argv.slice(2));
57246
- return getCommandNamePlain(`${commandTemplate} ${flags.join(" ")}`.trim());
57247
- }
57248
57269
  async function inspect8(client, argv) {
57249
57270
  const parsed = await parseSubcommandArgs(argv, inspectSubcommand7, client);
57250
57271
  if (typeof parsed === "number")
57251
57272
  return parsed;
57252
- const link = await ensureProjectLink(client);
57273
+ const link = await requireProjectContext(
57274
+ client,
57275
+ "routes",
57276
+ parsed.flags["--project"]
57277
+ );
57253
57278
  if (typeof link === "number")
57254
57279
  return link;
57255
57280
  const { project, org } = link;
@@ -57267,11 +57292,11 @@ async function inspect8(client, argv) {
57267
57292
  message: "Route name or ID is required. Pass a single route name or ID as the first argument after inspect.",
57268
57293
  next: [
57269
57294
  {
57270
- command: withGlobalFlags7(client, "routes inspect <name-or-id>"),
57295
+ command: withGlobalFlags2(client, "routes inspect <name-or-id>"),
57271
57296
  when: "replace <name-or-id> with route name or ID from routes list"
57272
57297
  },
57273
57298
  {
57274
- command: withGlobalFlags7(client, "routes list"),
57299
+ command: withGlobalFlags2(client, "routes list"),
57275
57300
  when: "to list routes and copy an exact name or id"
57276
57301
  }
57277
57302
  ]
@@ -57281,7 +57306,7 @@ async function inspect8(client, argv) {
57281
57306
  return 1;
57282
57307
  }
57283
57308
  output_manager_default.error(
57284
- `Missing route name or ID. Usage: ${import_chalk217.default.cyan(getCommandName("routes inspect <name-or-id>"))}`
57309
+ `Missing route name or ID. Usage: ${import_chalk217.default.cyan(withGlobalFlags2(client, "routes inspect <name-or-id>"))}`
57285
57310
  );
57286
57311
  return 1;
57287
57312
  }
@@ -57309,7 +57334,7 @@ async function inspect8(client, argv) {
57309
57334
  message: `No route found matching "${identifier}".`,
57310
57335
  next: [
57311
57336
  {
57312
- command: withGlobalFlags7(client, "routes list"),
57337
+ command: withGlobalFlags2(client, "routes list"),
57313
57338
  when: "to list routes and pick an exact name or id"
57314
57339
  }
57315
57340
  ]
@@ -57320,7 +57345,7 @@ async function inspect8(client, argv) {
57320
57345
  }
57321
57346
  output_manager_default.error(
57322
57347
  `No route found matching "${identifier}". Run ${import_chalk217.default.cyan(
57323
- getCommandName("routes list")
57348
+ withGlobalFlags2(client, "routes list")
57324
57349
  )} to see all routes.`
57325
57350
  );
57326
57351
  return 1;
@@ -57336,11 +57361,11 @@ async function inspect8(client, argv) {
57336
57361
  message: `Multiple routes match "${identifier}" (${routes2.length} matches). Pass an exact route name or ID; non-interactive mode cannot prompt for a choice.`,
57337
57362
  next: [
57338
57363
  {
57339
- command: withGlobalFlags7(client, "routes list"),
57364
+ command: withGlobalFlags2(client, "routes list"),
57340
57365
  when: "to see route names and ids, then inspect with a unique id"
57341
57366
  },
57342
57367
  {
57343
- command: withGlobalFlags7(client, "routes inspect <name-or-id>"),
57368
+ command: withGlobalFlags2(client, "routes inspect <name-or-id>"),
57344
57369
  when: "retry with a single unique name or id"
57345
57370
  }
57346
57371
  ]
@@ -57741,10 +57766,6 @@ async function addRoute(client, projectId, routeInput, options = {}) {
57741
57766
  }
57742
57767
 
57743
57768
  // src/commands/routes/add.ts
57744
- function withGlobalFlags8(client, commandTemplate) {
57745
- const flags = getGlobalFlagsOnlyFromArgs(client.argv.slice(2));
57746
- return getCommandNamePlain(`${commandTemplate} ${flags.join(" ")}`.trim());
57747
- }
57748
57769
  function shellQuoteArg(value) {
57749
57770
  if (/[\s"'\\]/.test(value)) {
57750
57771
  return `"${value.replace(/\\/g, "\\\\").replace(/"/g, '\\"')}"`;
@@ -57786,13 +57807,17 @@ function buildRoutesAddFullFlagsSuggestion(client, parsed) {
57786
57807
  parts.push("--status", String(flags["--status"]));
57787
57808
  }
57788
57809
  parts.push("--yes");
57789
- return withGlobalFlags8(client, parts.join(" "));
57810
+ return withGlobalFlags2(client, parts.join(" "));
57790
57811
  }
57791
57812
  async function add11(client, argv) {
57792
57813
  const parsed = await parseSubcommandArgs(argv, addSubcommand9, client);
57793
57814
  if (typeof parsed === "number")
57794
57815
  return parsed;
57795
- const link = await ensureProjectLink(client);
57816
+ const link = await requireProjectContext(
57817
+ client,
57818
+ "routes",
57819
+ parsed.flags["--project"]
57820
+ );
57796
57821
  if (typeof link === "number")
57797
57822
  return link;
57798
57823
  const { project, org } = link;
@@ -57858,7 +57883,7 @@ async function add11(client, argv) {
57858
57883
  message: "In non-interactive mode pass either full route flags (name, --src, --action, --dest, --yes) or --ai <description> with --yes. For --src use a URL path pattern that starts with a forward slash / (e.g. /about, /api/:path*). With --src-syntax regex you may use a regex such as ^/api/.*. Run vercel routes add --help for options.",
57859
57884
  next: [
57860
57885
  {
57861
- command: withGlobalFlags8(
57886
+ command: withGlobalFlags2(
57862
57887
  client,
57863
57888
  "routes add --ai <description> --yes"
57864
57889
  ),
@@ -57942,7 +57967,7 @@ async function add11(client, argv) {
57942
57967
  );
57943
57968
  }
57944
57969
  output_manager_default.error(
57945
- `Route name is required when using --yes. Usage: ${getCommandName('routes add "Route Name" --src "/path" --action rewrite --dest "/destination" --yes')}`
57970
+ `Route name is required when using --yes. Usage: ${withGlobalFlags2(client, 'routes add "Route Name" --src "/path" --action rewrite --dest "/destination" --yes')}`
57946
57971
  );
57947
57972
  return 1;
57948
57973
  } else {
@@ -58015,7 +58040,7 @@ async function add11(client, argv) {
58015
58040
  );
58016
58041
  }
58017
58042
  output_manager_default.error(
58018
- `Source path is required when using --yes. Usage: ${getCommandName('routes add "Name" --src "/path" --action rewrite --dest "/dest" --yes')}`
58043
+ `Source path is required when using --yes. Usage: ${withGlobalFlags2(client, 'routes add "Name" --src "/path" --action rewrite --dest "/dest" --yes')}`
58019
58044
  );
58020
58045
  return 1;
58021
58046
  } else {
@@ -58315,7 +58340,7 @@ async function add11(client, argv) {
58315
58340
  ...!existingStagingVersion && {
58316
58341
  next: [
58317
58342
  {
58318
- command: withGlobalFlags8(client, "routes publish --yes"),
58343
+ command: withGlobalFlags2(client, "routes publish --yes"),
58319
58344
  when: "to promote this version to production"
58320
58345
  }
58321
58346
  ]
@@ -58408,7 +58433,7 @@ async function add11(client, argv) {
58408
58433
  hint: error.message || "Use `vercel routes list --diff` to inspect staged routes, then adjust flags and retry.",
58409
58434
  next: [
58410
58435
  {
58411
- command: withGlobalFlags8(client, "routes list --diff"),
58436
+ command: withGlobalFlags2(client, "routes list --diff"),
58412
58437
  when: "to inspect staged state"
58413
58438
  }
58414
58439
  ]
@@ -58477,14 +58502,14 @@ async function handleAIAdd2(client, projectId, teamId, aiPrompt, skipPrompts, pa
58477
58502
  message: errorMessage2 || "Could not generate a route after retry. Rephrase --ai description or use full route flags.",
58478
58503
  next: [
58479
58504
  {
58480
- command: withGlobalFlags8(
58505
+ command: withGlobalFlags2(
58481
58506
  client,
58482
58507
  "routes add --ai <description> --yes"
58483
58508
  ),
58484
58509
  when: "retry with a clearer description (replace <description>)"
58485
58510
  },
58486
58511
  {
58487
- command: parsedForSuggestion ? buildRoutesAddFullFlagsSuggestion(client, parsedForSuggestion) : withGlobalFlags8(
58512
+ command: parsedForSuggestion ? buildRoutesAddFullFlagsSuggestion(client, parsedForSuggestion) : withGlobalFlags2(
58488
58513
  client,
58489
58514
  "routes add <name> --src <path> --action rewrite --dest <dest> --yes"
58490
58515
  ),
@@ -58534,7 +58559,7 @@ async function handleAIAdd2(client, projectId, teamId, aiPrompt, skipPrompts, pa
58534
58559
  message: "Route creation from AI preview requires a TTY to confirm, or use full flags with --yes non-interactively.",
58535
58560
  next: [
58536
58561
  {
58537
- command: parsedForSuggestion ? buildRoutesAddFullFlagsSuggestion(client, parsedForSuggestion) : withGlobalFlags8(
58562
+ command: parsedForSuggestion ? buildRoutesAddFullFlagsSuggestion(client, parsedForSuggestion) : withGlobalFlags2(
58538
58563
  client,
58539
58564
  "routes add <name> --src <path> --action rewrite --dest <dest> --yes"
58540
58565
  ),
@@ -58546,7 +58571,7 @@ async function handleAIAdd2(client, projectId, teamId, aiPrompt, skipPrompts, pa
58546
58571
  );
58547
58572
  }
58548
58573
  output_manager_default.error(
58549
- `Cannot interactively confirm route creation in a non-TTY environment. Use full route flags with ${getCommandName("routes add <name> --src ... --yes")}, or run in a TTY.`
58574
+ `Cannot interactively confirm route creation in a non-TTY environment. Use full route flags with ${withGlobalFlags2(client, "routes add <name> --src ... --yes")}, or run in a TTY.`
58550
58575
  );
58551
58576
  return 1;
58552
58577
  }
@@ -58695,7 +58720,7 @@ async function createFromGenerated2(client, projectId, teamId, generated, existi
58695
58720
  ...!existingStagingVersion && {
58696
58721
  next: [
58697
58722
  {
58698
- command: withGlobalFlags8(client, "routes publish --yes"),
58723
+ command: withGlobalFlags2(client, "routes publish --yes"),
58699
58724
  when: "to promote this version to production"
58700
58725
  }
58701
58726
  ]
@@ -58739,7 +58764,7 @@ async function createFromGenerated2(client, projectId, teamId, generated, existi
58739
58764
  hint: error.message || "Use `vercel routes list --diff` to inspect staged routes, then adjust flags and retry.",
58740
58765
  next: [
58741
58766
  {
58742
- command: withGlobalFlags8(client, "routes list --diff"),
58767
+ command: withGlobalFlags2(client, "routes list --diff"),
58743
58768
  when: "to inspect staged state"
58744
58769
  }
58745
58770
  ]
@@ -58803,6 +58828,9 @@ async function main26(client) {
58803
58828
  })
58804
58829
  );
58805
58830
  }
58831
+ if (subcommand && !needHelp) {
58832
+ telemetry2.trackCliOptionProject(getProjectOptionFromArgs(args));
58833
+ }
58806
58834
  switch (subcommand) {
58807
58835
  case "list":
58808
58836
  if (needHelp) {
@@ -58843,7 +58871,7 @@ async function main26(client) {
58843
58871
  return 2;
58844
58872
  }
58845
58873
  telemetry2.trackCliSubcommandEdit(subcommandOriginal);
58846
- return (await import("./chunks/edit-ROJQCTWR.js")).default(client, args);
58874
+ return (await import("./chunks/edit-3ABZQYUU.js")).default(client, args);
58847
58875
  case "delete":
58848
58876
  if (needHelp) {
58849
58877
  telemetry2.trackCliFlagHelp("routes", subcommandOriginal);
@@ -58851,7 +58879,7 @@ async function main26(client) {
58851
58879
  return 2;
58852
58880
  }
58853
58881
  telemetry2.trackCliSubcommandDelete(subcommandOriginal);
58854
- return (await import("./chunks/delete-NCMDC3IU.js")).default(client, args);
58882
+ return (await import("./chunks/delete-QBVZ5X6B.js")).default(client, args);
58855
58883
  case "enable":
58856
58884
  if (needHelp) {
58857
58885
  telemetry2.trackCliFlagHelp("routes", subcommandOriginal);
@@ -58859,7 +58887,7 @@ async function main26(client) {
58859
58887
  return 2;
58860
58888
  }
58861
58889
  telemetry2.trackCliSubcommandEnable(subcommandOriginal);
58862
- return (await import("./chunks/enable-TAVCLAEC.js")).default(client, args);
58890
+ return (await import("./chunks/enable-HUMYCGKA.js")).default(client, args);
58863
58891
  case "disable":
58864
58892
  if (needHelp) {
58865
58893
  telemetry2.trackCliFlagHelp("routes", subcommandOriginal);
@@ -58867,7 +58895,7 @@ async function main26(client) {
58867
58895
  return 2;
58868
58896
  }
58869
58897
  telemetry2.trackCliSubcommandDisable(subcommandOriginal);
58870
- return (await import("./chunks/disable-Z7DXY4AY.js")).default(client, args);
58898
+ return (await import("./chunks/disable-YYGXPXBI.js")).default(client, args);
58871
58899
  case "reorder":
58872
58900
  if (needHelp) {
58873
58901
  telemetry2.trackCliFlagHelp("routes", subcommandOriginal);
@@ -58875,7 +58903,7 @@ async function main26(client) {
58875
58903
  return 2;
58876
58904
  }
58877
58905
  telemetry2.trackCliSubcommandReorder(subcommandOriginal);
58878
- return (await import("./chunks/reorder-TTZBKCEB.js")).default(client, args);
58906
+ return (await import("./chunks/reorder-VSVOPNM4.js")).default(client, args);
58879
58907
  case "export":
58880
58908
  if (needHelp) {
58881
58909
  telemetry2.trackCliFlagHelp("routes", subcommandOriginal);
@@ -58883,7 +58911,7 @@ async function main26(client) {
58883
58911
  return 2;
58884
58912
  }
58885
58913
  telemetry2.trackCliSubcommandExport(subcommandOriginal);
58886
- return (await import("./chunks/export-YTSIGJFX.js")).default(client, args);
58914
+ return (await import("./chunks/export-KGHH4WAT.js")).default(client, args);
58887
58915
  case "publish":
58888
58916
  if (needHelp) {
58889
58917
  telemetry2.trackCliFlagHelp("routes", subcommandOriginal);
@@ -58891,7 +58919,7 @@ async function main26(client) {
58891
58919
  return 2;
58892
58920
  }
58893
58921
  telemetry2.trackCliSubcommandPublish(subcommandOriginal);
58894
- return (await import("./chunks/publish-DGF2TQCQ.js")).default(client, args);
58922
+ return (await import("./chunks/publish-GV4LLLXP.js")).default(client, args);
58895
58923
  case "restore":
58896
58924
  if (needHelp) {
58897
58925
  telemetry2.trackCliFlagHelp("routes", subcommandOriginal);
@@ -58899,7 +58927,7 @@ async function main26(client) {
58899
58927
  return 2;
58900
58928
  }
58901
58929
  telemetry2.trackCliSubcommandRestore(subcommandOriginal);
58902
- return (await import("./chunks/restore-DG3LZMHQ.js")).default(client, args);
58930
+ return (await import("./chunks/restore-FKYCF73P.js")).default(client, args);
58903
58931
  case "discard-staging":
58904
58932
  if (needHelp) {
58905
58933
  telemetry2.trackCliFlagHelp("routes", subcommandOriginal);
@@ -58907,7 +58935,7 @@ async function main26(client) {
58907
58935
  return 2;
58908
58936
  }
58909
58937
  telemetry2.trackCliSubcommandDiscardStaging(subcommandOriginal);
58910
- return (await import("./chunks/discard-4ILK3ULP.js")).default(client, args);
58938
+ return (await import("./chunks/discard-X2MSUFGI.js")).default(client, args);
58911
58939
  default:
58912
58940
  output_manager_default.error(getInvalidSubcommand(COMMAND_CONFIG41));
58913
58941
  output_manager_default.print(help(routesCommand, { columns: client.stderr.columns }));
@@ -59436,9 +59464,13 @@ async function list16(client, argv) {
59436
59464
  }
59437
59465
  const asJson = formatResult.jsonOutput;
59438
59466
  telemetry2.trackCliOptionFormat(parsedArgs.flags["--format"]);
59467
+ const projectName = parsedArgs.flags["--project"];
59468
+ telemetry2.trackCliOptionProject(projectName);
59439
59469
  const autoConfirm = !!parsedArgs.flags["--yes"];
59440
59470
  const link = await ensureLink(targetCommand.name, client, cwd, {
59441
- autoConfirm
59471
+ autoConfirm,
59472
+ projectName,
59473
+ failIfNotFound: Boolean(projectName)
59442
59474
  });
59443
59475
  if (typeof link === "number") {
59444
59476
  return link;
@@ -59816,10 +59848,6 @@ var TeamsInviteTelemetryClient = class extends TelemetryClient {
59816
59848
  };
59817
59849
 
59818
59850
  // src/commands/teams/invite.ts
59819
- function withGlobalFlags9(client, commandTemplate) {
59820
- const flags = getGlobalFlagsOnlyFromArgs(client.argv.slice(2));
59821
- return getCommandNamePlain(`${commandTemplate} ${flags.join(" ")}`.trim());
59822
- }
59823
59851
  var validateEmail = (data) => email.test(data.trim()) || data.length === 0;
59824
59852
  var domains = Array.from(
59825
59853
  /* @__PURE__ */ new Set([
@@ -59905,7 +59933,7 @@ Please select a team scope using ${getCommandName(
59905
59933
  `switch`
59906
59934
  )} or use ${cmd("--scope")}`;
59907
59935
  if (client.nonInteractive) {
59908
- const switchCmd = withGlobalFlags9(client, "teams switch <slug>");
59936
+ const switchCmd = withGlobalFlags(client, "teams switch <slug>");
59909
59937
  outputAgentError(
59910
59938
  client,
59911
59939
  {
@@ -60416,10 +60444,6 @@ var TeamsSwitchTelemetryClient = class extends TelemetryClient {
60416
60444
  };
60417
60445
 
60418
60446
  // src/commands/teams/switch.ts
60419
- function withGlobalFlags10(client, commandTemplate) {
60420
- const flags = getGlobalFlagsOnlyFromArgs(client.argv.slice(2));
60421
- return getCommandNamePlain(`${commandTemplate} ${flags.join(" ")}`.trim());
60422
- }
60423
60447
  var updateCurrentTeam = (config, team) => {
60424
60448
  if (team) {
60425
60449
  config.currentTeam = team.id;
@@ -60489,7 +60513,7 @@ async function change(client, argv) {
60489
60513
  when: "to switch scope (replace <slug> with team slug)"
60490
60514
  },
60491
60515
  {
60492
- command: withGlobalFlags10(client, "teams list"),
60516
+ command: withGlobalFlags(client, "teams list"),
60493
60517
  when: "to list teams and slugs"
60494
60518
  }
60495
60519
  ]
@@ -60521,11 +60545,11 @@ async function change(client, argv) {
60521
60545
  message: "You are not a member of the current team anymore. Switch to a valid team or personal scope.",
60522
60546
  next: [
60523
60547
  {
60524
- command: withGlobalFlags10(client, "teams list"),
60548
+ command: withGlobalFlags(client, "teams list"),
60525
60549
  when: "to list teams and slugs you can switch to"
60526
60550
  },
60527
60551
  {
60528
- command: withGlobalFlags10(client, "login"),
60552
+ command: withGlobalFlags(client, "login"),
60529
60553
  when: "to re-authenticate if your session or team membership changed"
60530
60554
  }
60531
60555
  ]
@@ -60598,7 +60622,7 @@ async function change(client, argv) {
60598
60622
  when: "to switch scope (replace <slug> with team slug)"
60599
60623
  },
60600
60624
  {
60601
- command: withGlobalFlags10(client, "teams list"),
60625
+ command: withGlobalFlags(client, "teams list"),
60602
60626
  when: "to list teams and slugs"
60603
60627
  }
60604
60628
  ]
@@ -60661,7 +60685,7 @@ async function change(client, argv) {
60661
60685
  message: `You do not have permission to access scope "${desiredSlug}".`,
60662
60686
  next: [
60663
60687
  {
60664
- command: withGlobalFlags10(client, "teams list")
60688
+ command: withGlobalFlags(client, "teams list")
60665
60689
  }
60666
60690
  ]
60667
60691
  },
@@ -60694,10 +60718,6 @@ async function change(client, argv) {
60694
60718
  }
60695
60719
 
60696
60720
  // src/commands/teams/request.ts
60697
- function withGlobalFlags11(client, commandTemplate) {
60698
- const flags = getGlobalFlagsOnlyFromArgs(client.argv.slice(2));
60699
- return getCommandNamePlain(`${commandTemplate} ${flags.join(" ")}`.trim());
60700
- }
60701
60721
  function optionRoot(flagToken) {
60702
60722
  if (flagToken.startsWith("--")) {
60703
60723
  return flagToken.includes("=") ? `--${flagToken.slice(2).split("=")[0]}` : flagToken;
@@ -60710,7 +60730,7 @@ function teamsRequestNextCommand(client) {
60710
60730
  (a) => a === "request" || a === "access-request"
60711
60731
  );
60712
60732
  const afterRequest = reqIdx >= 0 ? fullArgs.slice(reqIdx + 1) : [];
60713
- const globalParts = getGlobalFlagsOnlyFromArgs(fullArgs);
60733
+ const globalParts = getGlobalFlagsFromArgs(fullArgs);
60714
60734
  const subParts = getSameSubcommandSuggestionFlags(afterRequest);
60715
60735
  const seen = /* @__PURE__ */ new Set();
60716
60736
  for (const g of globalParts) {
@@ -60735,10 +60755,7 @@ function teamsRequestNextCommand(client) {
60735
60755
  i += 1;
60736
60756
  }
60737
60757
  }
60738
- const base = getCommandNameWithGlobalFlags(
60739
- "teams request [userId]",
60740
- client.argv
60741
- );
60758
+ const base = withGlobalFlags(client, "teams request [userId]");
60742
60759
  if (extras.length === 0) {
60743
60760
  return base;
60744
60761
  }
@@ -60816,7 +60833,7 @@ async function request(client, argv) {
60816
60833
  const asJson = formatResult.jsonOutput;
60817
60834
  const { currentTeam: teamId } = client.config;
60818
60835
  if (!teamId) {
60819
- const switchCmd = withGlobalFlags11(client, "teams switch <slug>");
60836
+ const switchCmd = withGlobalFlags(client, "teams switch <slug>");
60820
60837
  if (client.nonInteractive) {
60821
60838
  outputAgentError(
60822
60839
  client,
@@ -63529,25 +63546,25 @@ async function vcr(client) {
63529
63546
  switch (subcommand) {
63530
63547
  case "ls":
63531
63548
  telemetry2.trackCliSubcommandLs(subcommandOriginal);
63532
- return (await import("./chunks/ls-WDRFGE2J.js")).default(client, args, telemetry2);
63549
+ return (await import("./chunks/ls-C7MNQ4IK.js")).default(client, args, telemetry2);
63533
63550
  case "inspect":
63534
63551
  telemetry2.trackCliSubcommandInspect(subcommandOriginal);
63535
- return (await import("./chunks/inspect-5C4UHSCT.js")).default(client, args, telemetry2);
63552
+ return (await import("./chunks/inspect-5TNHHD2M.js")).default(client, args, telemetry2);
63536
63553
  case "add":
63537
63554
  telemetry2.trackCliSubcommandAdd(subcommandOriginal);
63538
- return (await import("./chunks/add-YIAPBLSF.js")).default(client, args, telemetry2);
63555
+ return (await import("./chunks/add-CF5SQESQ.js")).default(client, args, telemetry2);
63539
63556
  case "rm":
63540
63557
  telemetry2.trackCliSubcommandRm(subcommandOriginal);
63541
- return (await import("./chunks/rm-7WXXLTXF.js")).default(client, args, telemetry2);
63558
+ return (await import("./chunks/rm-4QCXZRC2.js")).default(client, args, telemetry2);
63542
63559
  case "login":
63543
63560
  telemetry2.trackCliSubcommandLogin(subcommandOriginal);
63544
- return (await import("./chunks/login-4BK3VGII.js")).default(client, args, telemetry2);
63561
+ return (await import("./chunks/login-SLPCZ2OF.js")).default(client, args, telemetry2);
63545
63562
  case "tag":
63546
63563
  telemetry2.trackCliSubcommandTag(subcommandOriginal);
63547
- return (await import("./chunks/tags-MLX3AHHK.js")).default(client, args, telemetry2);
63564
+ return (await import("./chunks/tags-CQ4FRIJ4.js")).default(client, args, telemetry2);
63548
63565
  case "image":
63549
63566
  telemetry2.trackCliSubcommandImage(subcommandOriginal);
63550
- return (await import("./chunks/image-LORSHERP.js")).default(client, args, telemetry2);
63567
+ return (await import("./chunks/image-OO3WWKZV.js")).default(client, args, telemetry2);
63551
63568
  default:
63552
63569
  output_manager_default.error(getInvalidSubcommand(COMMAND_CONFIG47));
63553
63570
  output_manager_default.print(help(vcrCommand, { columns: client.stderr.columns }));
@@ -64206,7 +64223,7 @@ var WebhooksRmTelemetryClient = class extends TelemetryClient {
64206
64223
 
64207
64224
  // src/commands/webhooks/rm.ts
64208
64225
  function webhookCommandWithGlobalFlags(baseSubcommand, argv) {
64209
- const globalFlags = getGlobalFlagsOnlyFromArgs(argv.slice(2));
64226
+ const globalFlags = getGlobalFlagsFromArgs(argv.slice(2));
64210
64227
  const full = globalFlags.length ? `${baseSubcommand} ${globalFlags.join(" ")}` : baseSubcommand;
64211
64228
  return getCommandNamePlain(full);
64212
64229
  }