vercel 54.14.0 → 54.14.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/dist/chunks/{add-PVEKZBHH.js → add-INSQH24S.js} +7 -7
  2. package/dist/chunks/{chunk-FPRA7U2P.js → chunk-467YGYFK.js} +1 -1
  3. package/dist/chunks/{chunk-6K3WJDFA.js → chunk-4WQGP4Z4.js} +9 -9
  4. package/dist/chunks/{chunk-V4GROAUJ.js → chunk-5QKYBWW2.js} +4 -7
  5. package/dist/chunks/chunk-64IF634X.js +18 -0
  6. package/dist/chunks/{chunk-V2WFM23D.js → chunk-74VEZPM6.js} +1 -1
  7. package/dist/chunks/{chunk-5SYDEK2N.js → chunk-D7MGZH35.js} +1 -1
  8. package/dist/chunks/{chunk-Y76J3TGD.js → chunk-DAKMPPIS.js} +1 -1
  9. package/dist/chunks/{chunk-KJ5O7JQQ.js → chunk-F4WXNECT.js} +27 -60
  10. package/dist/chunks/{chunk-RWJORLQP.js → chunk-F6SCQ6XU.js} +58 -16
  11. package/dist/chunks/{chunk-7CJZCFLW.js → chunk-FKNOCLZU.js} +2 -2
  12. package/dist/chunks/{chunk-CO5D46AG.js → chunk-GGP5R3FU.js} +18 -38
  13. package/dist/chunks/{chunk-J5273CSE.js → chunk-HIYWSGI7.js} +19 -10
  14. package/dist/chunks/{chunk-TH555JND.js → chunk-J4LCBXF2.js} +14 -41
  15. package/dist/chunks/{chunk-ABOX5TXU.js → chunk-L7U3Z7E4.js} +3 -3
  16. package/dist/chunks/{chunk-7OZWGXPA.js → chunk-MKB32SJZ.js} +2 -2
  17. package/dist/chunks/{chunk-4KAFHBYE.js → chunk-NMGGBH7K.js} +1 -1
  18. package/dist/chunks/{chunk-C3VH3X5Y.js → chunk-P2AMQX7F.js} +3 -3
  19. package/dist/chunks/{chunk-6D6CSOSK.js → chunk-P6VIXOWO.js} +84 -60
  20. package/dist/chunks/{chunk-PV533MBH.js → chunk-PMUUPCDL.js} +1 -1
  21. package/dist/chunks/{chunk-S4VHXL2Y.js → chunk-TVBXGFEL.js} +1 -1
  22. package/dist/chunks/{chunk-G7QWUIGS.js → chunk-UEFCAT3N.js} +2 -2
  23. package/dist/chunks/{chunk-OEM7RB3X.js → chunk-UJ3ZCBUA.js} +1 -1
  24. package/dist/chunks/{chunk-VNUNCNPE.js → chunk-UPI3OHBK.js} +1 -1
  25. package/dist/chunks/chunk-VXYGCOKL.js +28 -0
  26. package/dist/chunks/{chunk-5UCWXYNH.js → chunk-XLLAD5DR.js} +87 -45
  27. package/dist/chunks/{chunk-Z7KOKD2G.js → chunk-YQPAAXUU.js} +1 -1
  28. package/dist/chunks/{chunk-B6C7NMT3.js → chunk-Z2MBXYZZ.js} +1 -1
  29. package/dist/chunks/{chunk-DAASB6YQ.js → chunk-ZRJQY3VK.js} +22 -2
  30. package/dist/chunks/{compile-vercel-config-MD37D2F7.js → compile-vercel-config-VPPGDFKL.js} +3 -3
  31. package/dist/chunks/{delete-6EMDCXSA.js → delete-O3EHQHYD.js} +8 -6
  32. package/dist/chunks/{disable-FLJ27NHG.js → disable-GJDQC34I.js} +8 -6
  33. package/dist/chunks/{discard-KEIII6RM.js → discard-UZT23XN2.js} +8 -6
  34. package/dist/chunks/{edit-DOL2ZJPG.js → edit-PEQIROSE.js} +10 -8
  35. package/dist/chunks/{enable-PZWZIETT.js → enable-ACNEAJ5S.js} +8 -6
  36. package/dist/chunks/{export-2PFHAELC.js → export-ZICIQKHJ.js} +4 -4
  37. package/dist/chunks/{inspect-WPWOZJ2K.js → inspect-PUFF7LND.js} +6 -6
  38. package/dist/chunks/{list-4R5DCLTB.js → list-FWUV4NO4.js} +5 -5
  39. package/dist/chunks/{list-ZT7QK2H7.js → list-L2UFHHQ7.js} +7 -7
  40. package/dist/chunks/{ls-4JTXQXMQ.js → ls-6HVFGIQS.js} +7 -7
  41. package/dist/chunks/{publish-JV4J3SOA.js → publish-HKTAQMYG.js} +8 -6
  42. package/dist/chunks/{query-N22EYSZZ.js → query-VQ5HDMFO.js} +97 -41
  43. package/dist/chunks/{reorder-TG53BKW4.js → reorder-CVMW6VL7.js} +8 -6
  44. package/dist/chunks/{restore-U7O4VESA.js → restore-32NXH4EH.js} +8 -6
  45. package/dist/chunks/{rm-XA4LYZXI.js → rm-7TPDWMJZ.js} +7 -7
  46. package/dist/chunks/{routes-EAMQVFU2.js → routes-YEU33SON.js} +2 -2
  47. package/dist/chunks/{rule-inspect-HC745CYT.js → rule-inspect-PQORU3SU.js} +7 -7
  48. package/dist/chunks/{rules-RMN72YHN.js → rules-VIITOYFN.js} +6 -6
  49. package/dist/chunks/{schema-CZVKUXM6.js → schema-AECGMSF5.js} +6 -6
  50. package/dist/chunks/{stamp-ENIXDCRO.js → stamp-AA7R3MZS.js} +3 -1
  51. package/dist/chunks/{update-PU3WLIA7.js → update-J4QCT3GS.js} +7 -7
  52. package/dist/commands/build/index.js +16 -14
  53. package/dist/commands/deploy/index.js +22 -163
  54. package/dist/commands/dev/index.js +13 -14
  55. package/dist/commands/env/index.js +153 -92
  56. package/dist/commands/link/index.js +11 -11
  57. package/dist/commands/list/index.js +10 -8
  58. package/dist/commands-bulk.js +222 -85
  59. package/dist/index.js +18 -18
  60. package/dist/version.mjs +1 -1
  61. package/package.json +16 -16
@@ -20,7 +20,7 @@ import {
20
20
  import {
21
21
  formatEnvironment,
22
22
  validateLsArgs
23
- } from "../../chunks/chunk-Y76J3TGD.js";
23
+ } from "../../chunks/chunk-DAKMPPIS.js";
24
24
  import {
25
25
  validateJsonOutput
26
26
  } from "../../chunks/chunk-XPKWKPWA.js";
@@ -29,8 +29,8 @@ import {
29
29
  } from "../../chunks/chunk-YPQSDAEW.js";
30
30
  import {
31
31
  getCommandAliases
32
- } from "../../chunks/chunk-KJ5O7JQQ.js";
33
- import "../../chunks/chunk-DAASB6YQ.js";
32
+ } from "../../chunks/chunk-F4WXNECT.js";
33
+ import "../../chunks/chunk-ZRJQY3VK.js";
34
34
  import "../../chunks/chunk-WFRHKZFI.js";
35
35
  import "../../chunks/chunk-IQQJHYW4.js";
36
36
  import "../../chunks/chunk-NGRSQRSN.js";
@@ -40,10 +40,14 @@ import "../../chunks/chunk-ZTPOJE63.js";
40
40
  import {
41
41
  require_execa
42
42
  } from "../../chunks/chunk-YI3JV6GM.js";
43
- import "../../chunks/chunk-OEM7RB3X.js";
43
+ import {
44
+ stamp_default
45
+ } from "../../chunks/chunk-64IF634X.js";
46
+ import "../../chunks/chunk-VXYGCOKL.js";
47
+ import "../../chunks/chunk-UJ3ZCBUA.js";
44
48
  import {
45
49
  help
46
- } from "../../chunks/chunk-VNUNCNPE.js";
50
+ } from "../../chunks/chunk-UPI3OHBK.js";
47
51
  import {
48
52
  STANDARD_ENVIRONMENTS,
49
53
  addSubcommand,
@@ -58,6 +62,7 @@ import {
58
62
  listSubcommand,
59
63
  param,
60
64
  parseTarget,
65
+ printAlignedLabel,
61
66
  pull,
62
67
  pullEnvRecords,
63
68
  pullSubcommand,
@@ -65,11 +70,11 @@ import {
65
70
  require_frameworks,
66
71
  runSubcommand,
67
72
  updateSubcommand
68
- } from "../../chunks/chunk-5UCWXYNH.js";
73
+ } from "../../chunks/chunk-XLLAD5DR.js";
69
74
  import {
70
75
  TelemetryClient,
71
76
  require_dist as require_dist2
72
- } from "../../chunks/chunk-J5273CSE.js";
77
+ } from "../../chunks/chunk-HIYWSGI7.js";
73
78
  import {
74
79
  buildCommandWithYes,
75
80
  buildEnvAddCommandWithPreservedArgs,
@@ -81,11 +86,10 @@ import {
81
86
  outputActionRequired,
82
87
  outputAgentError
83
88
  } from "../../chunks/chunk-NHGCQRK5.js";
84
- import {
85
- require_ms,
86
- stamp_default
87
- } from "../../chunks/chunk-CO5D46AG.js";
88
89
  import "../../chunks/chunk-N2T234LO.js";
90
+ import {
91
+ require_ms
92
+ } from "../../chunks/chunk-GGP5R3FU.js";
89
93
  import "../../chunks/chunk-4NDOMD3E.js";
90
94
  import {
91
95
  getFlagsSpecification,
@@ -420,7 +424,21 @@ var EnvAddTelemetryClient = class extends TelemetryClient {
420
424
 
421
425
  // src/commands/env/add.ts
422
426
  import { determineAgent } from "@vercel/detect-agent";
423
- var SENSITIVE_SECRET_PROMPT = "Is the value a sensitive secret?";
427
+ var SENSITIVE_VALUE_HINT = "Sensitive values cannot be read later";
428
+ var SENSITIVE_SECRET_PROMPT = `Store as sensitive? ${import_chalk.default.dim(
429
+ SENSITIVE_VALUE_HINT
430
+ )}`;
431
+ var CHECKBOX_INSTRUCTIONS = [
432
+ " ",
433
+ import_chalk.default.cyan("<space>"),
434
+ import_chalk.default.dim(" select, "),
435
+ import_chalk.default.cyan("<enter>"),
436
+ import_chalk.default.dim(" confirm, "),
437
+ import_chalk.default.cyan("<a>"),
438
+ import_chalk.default.dim(" toggle all, "),
439
+ import_chalk.default.cyan("<i>"),
440
+ import_chalk.default.dim(" invert")
441
+ ].join("");
424
442
  function filterEnvChoicesForSensitivity(choices, opts) {
425
443
  if (opts.isSensitive) {
426
444
  return choices.filter((c) => c.value !== "development");
@@ -458,20 +476,66 @@ function resolveFinalType(envTargets, isSensitive, opts) {
458
476
  }
459
477
  return "encrypted";
460
478
  }
461
- function valueForNextCommand(value) {
462
- if (!/[\s'"\\]/.test(value))
463
- return value;
464
- return `"${value.replace(/\\/g, "\\\\").replace(/"/g, '\\"')}"`;
465
- }
466
479
  function fillEnvAddTemplate(template, opts) {
467
480
  const targetPlaceholder = getEnvTargetPlaceholder();
468
- let out = template.replace(/<name>/g, opts.envName ?? "<name>").split(targetPlaceholder).join(opts.envTargetArg ?? targetPlaceholder).replace(/<gitbranch>/g, opts.envGitBranch ?? "<gitbranch>");
469
- if (opts.valueFromFlag !== void 0) {
470
- out = out.replace(/<value>/g, valueForNextCommand(opts.valueFromFlag));
471
- } else {
472
- out = out.replace(/<value>/g, "<value>");
481
+ const out = template.replace(/<name>/g, opts.envName ?? "<name>").split(targetPlaceholder).join(opts.envTargetArg ?? targetPlaceholder).replace(/<gitbranch>/g, opts.envGitBranch ?? "<gitbranch>");
482
+ return out.replace(/<value>/g, "<value>");
483
+ }
484
+ function redactEnvValueArgs(argv) {
485
+ const redacted = [...argv];
486
+ for (let i = 0; i < redacted.length; i++) {
487
+ if (redacted[i] === "--value" && i + 1 < redacted.length) {
488
+ redacted[i + 1] = '"<value>"';
489
+ i++;
490
+ } else if (redacted[i].startsWith("--value=")) {
491
+ redacted[i] = '--value="<value>"';
492
+ }
473
493
  }
474
- return out;
494
+ return redacted;
495
+ }
496
+ function projectLabel(link) {
497
+ return `${link.org.slug}/${link.project.name}`;
498
+ }
499
+ function formatEnvironmentTarget(target, customEnvironments) {
500
+ const standardTarget = envTargetChoices.find(
501
+ (choice) => choice.value === target
502
+ );
503
+ if (standardTarget) {
504
+ return standardTarget.name;
505
+ }
506
+ const customEnvironment = customEnvironments.find(
507
+ (env) => env.id === target || env.slug === target
508
+ );
509
+ return customEnvironment?.slug ?? target;
510
+ }
511
+ function formatEnvironmentTargets(envTargets, customEnvironments) {
512
+ return envTargets.map((target) => formatEnvironmentTarget(target, customEnvironments)).join(", ");
513
+ }
514
+ function typeLabel(type) {
515
+ return type === "sensitive" ? "Sensitive" : "Non-sensitive";
516
+ }
517
+ function printEnvAddResult(link, envName, envTargets, envGitBranch, customEnvironments, finalType, force) {
518
+ output_manager_default.print("\n");
519
+ printAlignedLabel(force ? "Overrode" : "Added", envName, { gutter: "\u2713" });
520
+ printAlignedLabel("Project", projectLabel(link));
521
+ printAlignedLabel(
522
+ "Environments",
523
+ formatEnvironmentTargets(envTargets, customEnvironments)
524
+ );
525
+ if (envGitBranch) {
526
+ printAlignedLabel("Branch", envGitBranch);
527
+ }
528
+ printAlignedLabel("Type", typeLabel(finalType));
529
+ }
530
+ function printEnvAddWarning(message) {
531
+ output_manager_default.print(`${import_chalk.default.yellow("!")} ${message}
532
+ `);
533
+ }
534
+ function promptEnvValue(client, opts) {
535
+ return client.input.text({
536
+ message: `Value?`,
537
+ ...opts.isSensitive ? { transformer: (value) => "*".repeat(value.length) } : {}
538
+ });
475
539
  }
476
540
  async function add(client, argv) {
477
541
  let parsedArgs;
@@ -505,7 +569,9 @@ async function add(client, argv) {
505
569
  telemetryClient.trackCliArgumentName(envName);
506
570
  telemetryClient.trackCliArgumentEnvironment(envTargetArg);
507
571
  telemetryClient.trackCliArgumentGitBranch(envGitBranch);
508
- telemetryClient.trackCliOptionValue(opts["--value"]);
572
+ telemetryClient.trackCliOptionValue(
573
+ valueFromFlag === void 0 ? void 0 : "<redacted>"
574
+ );
509
575
  telemetryClient.trackCliFlagSensitive(opts["--sensitive"]);
510
576
  telemetryClient.trackCliFlagNoSensitive(opts["--no-sensitive"]);
511
577
  telemetryClient.trackCliFlagForce(opts["--force"]);
@@ -554,7 +620,7 @@ async function add(client, argv) {
554
620
  "<scope>",
555
621
  ...linkPreserved
556
622
  ];
557
- let envAddRetryArgv = client.argv;
623
+ let envAddRetryArgv = redactEnvValueArgs(client.argv);
558
624
  if (envTargetArg === "preview" && envGitBranch === void 0) {
559
625
  const argvArgs = client.argv.slice(2);
560
626
  const addIdx = argvArgs.indexOf("add");
@@ -566,11 +632,11 @@ async function add(client, argv) {
566
632
  pos++;
567
633
  }
568
634
  const insertAt = 2 + pos;
569
- envAddRetryArgv = [
635
+ envAddRetryArgv = redactEnvValueArgs([
570
636
  ...client.argv.slice(0, insertAt),
571
637
  "<gitbranch>",
572
638
  ...client.argv.slice(insertAt)
573
- ];
639
+ ]);
574
640
  }
575
641
  }
576
642
  outputAgentError(
@@ -644,11 +710,10 @@ async function add(client, argv) {
644
710
  return "third argument <gitbranch> for Preview, or omit for all Preview branches";
645
711
  return m;
646
712
  });
647
- const fullTemplate = `env add <name> ${getEnvTargetPlaceholder()} <gitbranch> --value <value> --yes`;
713
+ const fullTemplate = `env add <name> ${getEnvTargetPlaceholder()} <gitbranch> --value "<value>" --yes`;
648
714
  const filledTemplate = fillEnvAddTemplate(fullTemplate, {
649
715
  envName,
650
716
  envTargetArg,
651
- valueFromFlag,
652
717
  envGitBranch
653
718
  });
654
719
  const next = [];
@@ -663,12 +728,12 @@ async function add(client, argv) {
663
728
  }
664
729
  if (missing.includes("git_branch_required") && envName && (valueFromFlag !== void 0 || stdInput)) {
665
730
  const branchSpecific = fillEnvAddTemplate(
666
- "env add <name> preview <gitbranch> --value <value> --yes",
667
- { envName, envTargetArg: "preview", valueFromFlag }
731
+ 'env add <name> preview <gitbranch> --value "<value>" --yes',
732
+ { envName, envTargetArg: "preview" }
668
733
  );
669
734
  const branchAll = fillEnvAddTemplate(
670
- "env add <name> preview --value <value> --yes",
671
- { envName, envTargetArg: "preview", valueFromFlag }
735
+ 'env add <name> preview --value "<value>" --yes',
736
+ { envName, envTargetArg: "preview" }
672
737
  );
673
738
  next.push(
674
739
  {
@@ -702,7 +767,7 @@ async function add(client, argv) {
702
767
  }
703
768
  if (!envName) {
704
769
  envName = await client.input.text({
705
- message: `What's the name of the variable?`,
770
+ message: `Name?`,
706
771
  validate: (val) => val ? true : "Name cannot be empty"
707
772
  });
708
773
  }
@@ -714,7 +779,7 @@ async function add(client, argv) {
714
779
  const sensitiveWarning = keyWarnings.find((w) => w.requiresConfirmation);
715
780
  if (!sensitiveWarning) {
716
781
  for (const w of keyWarnings) {
717
- output_manager_default.warn(w.message);
782
+ printEnvAddWarning(w.message);
718
783
  }
719
784
  keyAccepted = true;
720
785
  break;
@@ -733,14 +798,14 @@ async function add(client, argv) {
733
798
  {
734
799
  command: buildEnvAddCommandWithPreservedArgs(
735
800
  client.argv,
736
- `env add ${envName} ${getEnvTargetPlaceholder()} --value <value> --yes`
801
+ `env add ${envName} ${getEnvTargetPlaceholder()} --value "<value>" --yes`
737
802
  ),
738
803
  when: "Leave as is"
739
804
  },
740
805
  {
741
806
  command: buildEnvAddCommandWithPreservedArgs(
742
807
  client.argv,
743
- `env add ${nameWithoutPrefix2} ${getEnvTargetPlaceholder()} --value <value> --yes`
808
+ `env add ${nameWithoutPrefix2} ${getEnvTargetPlaceholder()} --value "<value>" --yes`
744
809
  ),
745
810
  when: "Rename"
746
811
  }
@@ -748,16 +813,16 @@ async function add(client, argv) {
748
813
  });
749
814
  }
750
815
  for (const w of keyWarnings) {
751
- output_manager_default.warn(w.message);
816
+ printEnvAddWarning(w.message);
752
817
  }
753
818
  const nameWithoutPrefix = removePublicPrefix(envName);
754
819
  const choices2 = [
755
- { name: "Leave as is", value: "c" },
820
+ { name: `Keep ${envName}`, value: "c" },
756
821
  { name: `Rename to ${nameWithoutPrefix}`, value: "p" },
757
- { name: "Re-enter", value: "r" }
822
+ { name: "Re-enter name", value: "r" }
758
823
  ];
759
824
  const action = await client.input.select({
760
- message: "How to proceed?",
825
+ message: "Variable name?",
761
826
  choices: choices2
762
827
  });
763
828
  if (action === "c") {
@@ -767,7 +832,7 @@ async function add(client, argv) {
767
832
  output_manager_default.log(`Renamed to ${envName}`);
768
833
  } else {
769
834
  envName = await client.input.text({
770
- message: `What's the name of the variable?`,
835
+ message: `Name?`,
771
836
  validate: (val) => val ? true : "Name cannot be empty"
772
837
  });
773
838
  }
@@ -775,7 +840,7 @@ async function add(client, argv) {
775
840
  } else {
776
841
  const keyWarnings = getEnvKeyWarnings(envName);
777
842
  for (const w of keyWarnings) {
778
- output_manager_default.warn(w.message);
843
+ printEnvAddWarning(w.message);
779
844
  }
780
845
  }
781
846
  const link = await getLinkedProject(client);
@@ -799,7 +864,7 @@ async function add(client, argv) {
799
864
  ...link.status === "not_linked" ? ["--scope", "<scope>"] : [],
800
865
  ...linkPreserved
801
866
  ];
802
- let envAddRetryArgv = client.argv;
867
+ let envAddRetryArgv = redactEnvValueArgs(client.argv);
803
868
  if (envTargetArg === "preview" && envGitBranch === void 0) {
804
869
  const argvArgs = client.argv.slice(2);
805
870
  const addIdx = argvArgs.indexOf("add");
@@ -811,11 +876,11 @@ async function add(client, argv) {
811
876
  pos++;
812
877
  }
813
878
  const insertAt = 2 + pos;
814
- envAddRetryArgv = [
879
+ envAddRetryArgv = redactEnvValueArgs([
815
880
  ...client.argv.slice(0, insertAt),
816
881
  "<gitbranch>",
817
882
  ...client.argv.slice(insertAt)
818
- ];
883
+ ]);
819
884
  }
820
885
  }
821
886
  outputAgentError(
@@ -908,16 +973,24 @@ async function add(client, argv) {
908
973
  } else if (skipSensitivePrompt) {
909
974
  isSensitive = true;
910
975
  } else {
911
- output_manager_default.log(
912
- `Sensitive values cannot be retrieved later from the dashboard or CLI.`
913
- );
914
976
  isSensitive = await client.input.confirm(SENSITIVE_SECRET_PROMPT, true);
915
977
  if (policyOn && !isSensitive) {
916
- output_manager_default.log(
917
- `Your team requires sensitive Environment Variables for Production and Preview. To add a non-sensitive value, you can only target the Development Environment.`
978
+ output_manager_default.print(
979
+ ` ${import_chalk.default.dim(
980
+ "Team policy limits non-sensitive values to Development."
981
+ )}
982
+ `
918
983
  );
919
984
  }
920
985
  }
986
+ if (!client.nonInteractive && skipSensitivePrompt && policyOn && !isSensitive && envTargets.length === 0) {
987
+ output_manager_default.print(
988
+ ` ${import_chalk.default.dim(
989
+ "Team policy limits non-sensitive values to Development."
990
+ )}
991
+ `
992
+ );
993
+ }
921
994
  if (forceSensitive && envTargets.includes("development")) {
922
995
  const msg = `--sensitive is not allowed with the Development Environment. Sensitive Environment Variables are only supported on Production and Preview.`;
923
996
  if (client.nonInteractive) {
@@ -989,42 +1062,26 @@ async function add(client, argv) {
989
1062
  outputActionRequired(client, {
990
1063
  status: "action_required",
991
1064
  reason: "missing_value",
992
- message: "In non-interactive mode provide the value via --value or stdin. Example: vercel env add <name> <environment> --value 'value' --yes",
1065
+ message: 'In non-interactive mode provide the value via --value or stdin. Example: vercel env add <name> <environment> --value "<value>" --yes',
993
1066
  next: [
994
1067
  {
995
1068
  command: buildEnvAddCommandWithPreservedArgs(
996
1069
  client.argv,
997
- `env add <name> ${getEnvTargetPlaceholder()} --value <value> --yes`
1070
+ `env add <name> ${getEnvTargetPlaceholder()} --value "<value>" --yes`
998
1071
  )
999
1072
  }
1000
1073
  ]
1001
1074
  });
1002
1075
  }
1003
- if (isSensitive) {
1004
- envValue = await client.input.password({
1005
- message: `What's the value of ${envName}?`,
1006
- mask: true
1007
- });
1008
- } else {
1009
- envValue = await client.input.text({
1010
- message: `What's the value of ${envName}?`,
1011
- validate: (val) => val ? true : "Value cannot be empty"
1012
- });
1013
- }
1076
+ envValue = await promptEnvValue(client, { isSensitive });
1014
1077
  }
1015
1078
  const { finalValue } = await validateEnvValue({
1016
1079
  envName,
1017
1080
  initialValue: envValue,
1018
1081
  skipConfirm,
1019
- promptForValue: () => isSensitive ? client.input.password({
1020
- message: `What's the value of ${envName}?`,
1021
- mask: true
1022
- }) : client.input.text({
1023
- message: `What's the value of ${envName}?`,
1024
- validate: (val) => val ? true : "Value cannot be empty"
1025
- }),
1026
- selectAction: (choices2) => client.input.select({ message: "How to proceed?", choices: choices2 }),
1027
- showWarning: (msg) => output_manager_default.warn(msg),
1082
+ promptForValue: () => promptEnvValue(client, { isSensitive }),
1083
+ selectAction: (choices2) => client.input.select({ message: "Value?", choices: choices2 }),
1084
+ showWarning: (msg) => printEnvAddWarning(msg),
1028
1085
  showLog: (msg) => output_manager_default.log(msg)
1029
1086
  });
1030
1087
  while (envTargets.length === 0) {
@@ -1034,7 +1091,7 @@ async function add(client, argv) {
1034
1091
  reason: "missing_environment",
1035
1092
  message: `Specify at least one environment. Add as argument or use: ${buildEnvAddCommandWithPreservedArgs(
1036
1093
  client.argv,
1037
- `env add ${envName} <environment> --value <value> --yes`
1094
+ `env add ${envName} <environment> --value "<value>" --yes`
1038
1095
  )}`,
1039
1096
  choices: envChoices.map((c) => ({
1040
1097
  id: c.value,
@@ -1043,13 +1100,14 @@ async function add(client, argv) {
1043
1100
  next: envChoices.slice(0, 5).map((c) => ({
1044
1101
  command: buildEnvAddCommandWithPreservedArgs(
1045
1102
  client.argv,
1046
- `env add ${envName} ${c.value} --value <value> --yes`
1103
+ `env add ${envName} ${c.value} --value "<value>" --yes`
1047
1104
  )
1048
1105
  }))
1049
1106
  });
1050
1107
  }
1051
1108
  envTargets = await client.input.checkbox({
1052
- message: `Add ${envName} to which Environments (select multiple)?`,
1109
+ message: `Environments?`,
1110
+ instructions: CHECKBOX_INSTRUCTIONS,
1053
1111
  choices: envChoices
1054
1112
  });
1055
1113
  if (envTargets.length === 0) {
@@ -1065,7 +1123,7 @@ async function add(client, argv) {
1065
1123
  output_manager_default.error(postSelectionError);
1066
1124
  return 1;
1067
1125
  }
1068
- if (envGitBranch === void 0 && envTargets.length === 1 && envTargets[0] === "preview") {
1126
+ if (envGitBranch === void 0 && envTargets.length === 1 && envTargets[0] === "preview" && !(client.nonInteractive && args.length === 2)) {
1069
1127
  if (client.nonInteractive) {
1070
1128
  outputActionRequired(
1071
1129
  client,
@@ -1077,14 +1135,14 @@ async function add(client, argv) {
1077
1135
  {
1078
1136
  command: buildEnvAddCommandWithPreservedArgs(
1079
1137
  client.argv,
1080
- `env add ${envName} preview <gitbranch> --value <value> --yes`
1138
+ `env add ${envName} preview <gitbranch> --value "<value>" --yes`
1081
1139
  ),
1082
1140
  when: "Add to a specific Git branch"
1083
1141
  },
1084
1142
  {
1085
1143
  command: buildEnvAddCommandWithPreservedArgs(
1086
1144
  client.argv,
1087
- `env add ${envName} preview --value <value> --yes`
1145
+ `env add ${envName} preview --value "<value>" --yes`
1088
1146
  ),
1089
1147
  when: "Add to all Preview branches"
1090
1148
  }
@@ -1093,8 +1151,12 @@ async function add(client, argv) {
1093
1151
  1
1094
1152
  );
1095
1153
  } else {
1154
+ output_manager_default.print(
1155
+ ` ${import_chalk.default.dim("Leave empty to apply to all Preview branches.")}
1156
+ `
1157
+ );
1096
1158
  envGitBranch = await client.input.text({
1097
- message: `Add ${envName} to which Git branch? (leave empty for all Preview branches)?`
1159
+ message: `Git branch?`
1098
1160
  });
1099
1161
  }
1100
1162
  }
@@ -1106,16 +1168,15 @@ async function add(client, argv) {
1106
1168
  });
1107
1169
  if (policyOn && !hasDevelopment) {
1108
1170
  if (forceEncrypted) {
1109
- output_manager_default.warn(
1171
+ printEnvAddWarning(
1110
1172
  `--no-sensitive is ignored: your team enforces sensitive Environment Variables for Production and Preview.`
1111
1173
  );
1112
1174
  finalType = "sensitive";
1113
1175
  }
1114
1176
  }
1115
1177
  const upsert = opts["--force"] ? "true" : "";
1116
- const addStamp = stamp_default();
1117
1178
  try {
1118
- output_manager_default.spinner("Saving");
1179
+ output_manager_default.spinner("Saving\u2026");
1119
1180
  await addEnvRecord(
1120
1181
  client,
1121
1182
  project.id,
@@ -1145,14 +1206,14 @@ async function add(client, argv) {
1145
1206
  }
1146
1207
  throw err;
1147
1208
  }
1148
- output_manager_default.print(
1149
- `${prependEmoji(
1150
- `${opts["--force"] ? "Overrode" : "Added"} Environment Variable ${import_chalk.default.bold(envName)} to Project ${import_chalk.default.bold(
1151
- project.name
1152
- )} ${import_chalk.default.gray(addStamp())}`,
1153
- emoji("success")
1154
- )}
1155
- `
1209
+ printEnvAddResult(
1210
+ link,
1211
+ envName,
1212
+ envTargets,
1213
+ envGitBranch,
1214
+ customEnvironments,
1215
+ finalType,
1216
+ Boolean(opts["--force"])
1156
1217
  );
1157
1218
  const { isAgent } = await determineAgent();
1158
1219
  const guidanceMode = parsedArgs.flags["--guidance"] ?? isAgent;
@@ -1675,7 +1736,7 @@ async function run(client) {
1675
1736
  flags: parsedArgs.flags
1676
1737
  }) || "development";
1677
1738
  const gitBranch = parsedArgs.flags["--git-branch"];
1678
- output_manager_default.spinner(`Downloading \`${environment}\` Environment Variables`);
1739
+ output_manager_default.spinner(`Downloading \`${environment}\` environment variables`);
1679
1740
  const records = await pullEnvRecords(
1680
1741
  client,
1681
1742
  link.project.id,
@@ -11,8 +11,8 @@ import {
11
11
  addSubcommand7 as addSubcommand,
12
12
  getCommandAliases,
13
13
  linkCommand
14
- } from "../../chunks/chunk-KJ5O7JQQ.js";
15
- import "../../chunks/chunk-DAASB6YQ.js";
14
+ } from "../../chunks/chunk-F4WXNECT.js";
15
+ import "../../chunks/chunk-ZRJQY3VK.js";
16
16
  import "../../chunks/chunk-WFRHKZFI.js";
17
17
  import "../../chunks/chunk-IQQJHYW4.js";
18
18
  import "../../chunks/chunk-NGRSQRSN.js";
@@ -21,29 +21,29 @@ import "../../chunks/chunk-FMN3NXRC.js";
21
21
  import "../../chunks/chunk-ZTPOJE63.js";
22
22
  import {
23
23
  ensureLink
24
- } from "../../chunks/chunk-7CJZCFLW.js";
25
- import "../../chunks/chunk-6D6CSOSK.js";
24
+ } from "../../chunks/chunk-FKNOCLZU.js";
25
+ import "../../chunks/chunk-P6VIXOWO.js";
26
26
  import "../../chunks/chunk-LJ5WXXG6.js";
27
- import "../../chunks/chunk-V2WFM23D.js";
28
- import "../../chunks/chunk-OEM7RB3X.js";
27
+ import "../../chunks/chunk-74VEZPM6.js";
28
+ import "../../chunks/chunk-UJ3ZCBUA.js";
29
29
  import {
30
30
  detectExplicitScope,
31
31
  getScope
32
- } from "../../chunks/chunk-Z7KOKD2G.js";
32
+ } from "../../chunks/chunk-YQPAAXUU.js";
33
33
  import {
34
34
  help
35
- } from "../../chunks/chunk-VNUNCNPE.js";
35
+ } from "../../chunks/chunk-UPI3OHBK.js";
36
36
  import {
37
37
  addRepoLink,
38
38
  autoInstallVercelPlugin,
39
39
  ensureRepoLink
40
- } from "../../chunks/chunk-5UCWXYNH.js";
40
+ } from "../../chunks/chunk-XLLAD5DR.js";
41
41
  import {
42
42
  TelemetryClient
43
- } from "../../chunks/chunk-J5273CSE.js";
43
+ } from "../../chunks/chunk-HIYWSGI7.js";
44
44
  import "../../chunks/chunk-NHGCQRK5.js";
45
- import "../../chunks/chunk-CO5D46AG.js";
46
45
  import "../../chunks/chunk-N2T234LO.js";
46
+ import "../../chunks/chunk-GGP5R3FU.js";
47
47
  import "../../chunks/chunk-4NDOMD3E.js";
48
48
  import {
49
49
  getFlagsSpecification,
@@ -20,34 +20,36 @@ import {
20
20
  import {
21
21
  formatEnvironment,
22
22
  validateLsArgs
23
- } from "../../chunks/chunk-Y76J3TGD.js";
23
+ } from "../../chunks/chunk-DAKMPPIS.js";
24
24
  import {
25
25
  validateJsonOutput
26
26
  } from "../../chunks/chunk-XPKWKPWA.js";
27
27
  import {
28
28
  listCommand
29
29
  } from "../../chunks/chunk-ZTPOJE63.js";
30
+ import {
31
+ elapsed
32
+ } from "../../chunks/chunk-VXYGCOKL.js";
30
33
  import {
31
34
  getScope
32
- } from "../../chunks/chunk-Z7KOKD2G.js";
35
+ } from "../../chunks/chunk-YQPAAXUU.js";
33
36
  import {
34
37
  help
35
- } from "../../chunks/chunk-VNUNCNPE.js";
38
+ } from "../../chunks/chunk-UPI3OHBK.js";
36
39
  import {
37
40
  formatProject,
38
41
  getLinkedProject,
39
42
  getProjectByNameOrId,
40
43
  parseTarget
41
- } from "../../chunks/chunk-5UCWXYNH.js";
44
+ } from "../../chunks/chunk-XLLAD5DR.js";
42
45
  import {
43
46
  TelemetryClient
44
- } from "../../chunks/chunk-J5273CSE.js";
47
+ } from "../../chunks/chunk-HIYWSGI7.js";
45
48
  import "../../chunks/chunk-NHGCQRK5.js";
49
+ import "../../chunks/chunk-N2T234LO.js";
46
50
  import {
47
- elapsed,
48
51
  require_ms
49
- } from "../../chunks/chunk-CO5D46AG.js";
50
- import "../../chunks/chunk-N2T234LO.js";
52
+ } from "../../chunks/chunk-GGP5R3FU.js";
51
53
  import {
52
54
  table
53
55
  } from "../../chunks/chunk-4NDOMD3E.js";