vercel 58.3.0 → 58.4.4

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 (82) hide show
  1. package/dist/chunks/{add-X634O3US.js → add-245XOFJO.js} +3 -3
  2. package/dist/chunks/{add-3RKTVRL7.js → add-P7WBQMBW.js} +4 -4
  3. package/dist/chunks/{add-YTFWON7N.js → add-XH24V5VU.js} +3 -3
  4. package/dist/chunks/{build-DJIDUWYB.js → build-M7NJYJPE.js} +3 -3
  5. package/dist/chunks/{chunk-C33L5ZKY.js → chunk-2FMPLU44.js} +3 -3
  6. package/dist/chunks/{chunk-UJNNTGJY.js → chunk-2LBVX2H3.js} +1 -1
  7. package/dist/chunks/{chunk-MTW6MVY7.js → chunk-2MAPZXVV.js} +4 -4
  8. package/dist/chunks/{chunk-752Z4JQP.js → chunk-2WILSD7J.js} +1 -1
  9. package/dist/chunks/{chunk-ZPH66MB6.js → chunk-3QAUXPIR.js} +122 -3
  10. package/dist/chunks/{chunk-UQJMDWCY.js → chunk-4BUPRO5B.js} +2 -2
  11. package/dist/chunks/{chunk-BM5FP7VW.js → chunk-4CCY5OPH.js} +997 -1184
  12. package/dist/chunks/{chunk-C6BDHNNF.js → chunk-62MH5KPX.js} +2 -2
  13. package/dist/chunks/{chunk-QZV24TDR.js → chunk-AQDWMAPM.js} +8 -8
  14. package/dist/chunks/chunk-CPFNFVCL.js +85 -0
  15. package/dist/chunks/{chunk-NVSQ6KXI.js → chunk-HSYF5SI3.js} +1 -1
  16. package/dist/chunks/{chunk-PNXQB4IO.js → chunk-IEDUCUDV.js} +3 -3
  17. package/dist/chunks/{chunk-5YXUTGSY.js → chunk-M5NOLAJ4.js} +1 -1
  18. package/dist/chunks/{chunk-AZNCOIGT.js → chunk-NJ6QXKQD.js} +1 -1
  19. package/dist/chunks/{chunk-WXJ6E3MY.js → chunk-SJYAUEZR.js} +209 -47
  20. package/dist/chunks/{chunk-Z5ZQJ5VJ.js → chunk-TJJ562C5.js} +3 -0
  21. package/dist/chunks/{chunk-OTQD3MHJ.js → chunk-UE3JUVUZ.js} +3 -3
  22. package/dist/chunks/chunk-V5P25P7F.js +22 -0
  23. package/dist/chunks/{chunk-D3EEVTWR.js → chunk-XE5VSQ25.js} +1 -1
  24. package/dist/chunks/{chunk-UDDCOV62.js → chunk-Y5GTPWXB.js} +2 -2
  25. package/dist/chunks/{chunk-RUOBMMEA.js → chunk-YCPUAG77.js} +1 -1
  26. package/dist/chunks/{chunk-JID5CRQL.js → chunk-YDUINEII.js} +2 -2
  27. package/dist/chunks/{chunk-IH5JOYGQ.js → chunk-ZGBBPJ6B.js} +7 -3
  28. package/dist/chunks/{clear-J3OCB2DQ.js → clear-HWIKQ4NC.js} +3 -3
  29. package/dist/chunks/{compile-vercel-config-G2WILJR4.js → compile-vercel-config-U5NRIMZ2.js} +2 -2
  30. package/dist/chunks/config-validator.mjs +1 -1
  31. package/dist/chunks/{delete-HKUZTZE7.js → delete-FZCOUFGN.js} +3 -3
  32. package/dist/chunks/{delete-3NQLU7PQ.js → delete-NVMGVD5Z.js} +3 -3
  33. package/dist/chunks/{disable-7AIA4JV3.js → disable-ERM2BWEQ.js} +3 -3
  34. package/dist/chunks/{discard-MIGUGPGO.js → discard-KM5OLEN4.js} +3 -3
  35. package/dist/chunks/{edit-3AU746TG.js → edit-HT3UTATZ.js} +4 -4
  36. package/dist/chunks/{edit-MDQW3S4R.js → edit-TOSB2EMI.js} +3 -3
  37. package/dist/chunks/{enable-EGNWRQEI.js → enable-BQL6AOQV.js} +3 -3
  38. package/dist/chunks/{export-EMBHNUMU.js → export-UOWQHOG3.js} +3 -3
  39. package/dist/chunks/{image-XXZ5DRIW.js → image-F5SC6Q7Y.js} +4 -4
  40. package/dist/chunks/{inspect-O7SVDBHM.js → inspect-35FU5R62.js} +3 -3
  41. package/dist/chunks/{inspect-TXVTHRAZ.js → inspect-5J5GSTOB.js} +3 -3
  42. package/dist/chunks/{inspect-MYUNZMLJ.js → inspect-GKJ6T5H4.js} +3 -3
  43. package/dist/chunks/{inspect-S5WJ47OH.js → inspect-LGKOLH2O.js} +4 -4
  44. package/dist/chunks/{inspect-7V5ZHBBB.js → inspect-PZJM2CWT.js} +3 -3
  45. package/dist/chunks/{list-NZ4ZOO6B.js → list-2IIE7CAP.js} +4 -4
  46. package/dist/chunks/{list-BQLJJACX.js → list-ITFJYYQ2.js} +3 -3
  47. package/dist/chunks/{list-LC2ON7OM.js → list-KZETH3ZE.js} +2 -2
  48. package/dist/chunks/{login-4B7KPSUW.js → login-BQPJCJEZ.js} +3 -3
  49. package/dist/chunks/{ls-TWNQ7KZN.js → ls-7GHDK4MD.js} +4 -4
  50. package/dist/chunks/{ls-FRSKR6K2.js → ls-DL2LA35C.js} +3 -3
  51. package/dist/chunks/{ls-WCTLFAPI.js → ls-UXUEP54B.js} +3 -3
  52. package/dist/chunks/{ls-4J2WGR7U.js → ls-YSFWSM6J.js} +3 -3
  53. package/dist/chunks/{ls-7XMM4KCU.js → ls-ZZFLH7PK.js} +3 -3
  54. package/dist/chunks/{open-J4SAVWUP.js → open-ADNJQN5E.js} +3 -3
  55. package/dist/chunks/{permissions-67T43WNH.js → permissions-72SZCBIY.js} +5 -5
  56. package/dist/chunks/{publish-CSXOTJLD.js → publish-OOAGSEBM.js} +3 -3
  57. package/dist/chunks/{push-7KOVRV5N.js → push-B6TZDXNF.js} +3 -3
  58. package/dist/chunks/{query-CTRPYYXR.js → query-LZWS5TDH.js} +2 -2
  59. package/dist/chunks/{reorder-E4PPJNEX.js → reorder-MRHFKPMK.js} +3 -3
  60. package/dist/chunks/{reply-Z742BMF3.js → reply-BKTJXO3B.js} +3 -3
  61. package/dist/chunks/{resolve-KPZJZ6IQ.js → resolve-BKVGSGPN.js} +3 -3
  62. package/dist/chunks/{restore-ZTH2FY4I.js → restore-USR7SKWV.js} +3 -3
  63. package/dist/chunks/{rm-FVGLSIHP.js → rm-2UO6BT3A.js} +4 -4
  64. package/dist/chunks/{rm-VOFJM4XW.js → rm-37MKKV3I.js} +3 -3
  65. package/dist/chunks/{rm-DE37CFKU.js → rm-KUWPNZIS.js} +3 -3
  66. package/dist/chunks/{rm-C4ODJDWP.js → rm-VY3OHKFH.js} +3 -3
  67. package/dist/chunks/{rule-inspect-6RLS3ZNB.js → rule-inspect-JVDOOTWK.js} +4 -4
  68. package/dist/chunks/{rules-VSXJT2QE.js → rules-NTBFZBIF.js} +7 -7
  69. package/dist/chunks/{schema-3E24G2AG.js → schema-6EZ72OVH.js} +2 -2
  70. package/dist/chunks/{tags-AIZLNITP.js → tags-HNPC63QA.js} +3 -3
  71. package/dist/chunks/{update-QHWT7YG4.js → update-LUYWNZP3.js} +4 -4
  72. package/dist/commands/build/index.js +9 -9
  73. package/dist/commands/deploy/index.js +15 -12
  74. package/dist/commands/dev/index.js +21 -10
  75. package/dist/commands/env/index.js +281 -17
  76. package/dist/commands/link/index.js +7 -7
  77. package/dist/commands/list/index.js +3 -3
  78. package/dist/commands-bulk.js +3160 -2263
  79. package/dist/index.js +19 -17
  80. package/dist/version.mjs +1 -1
  81. package/package.json +33 -40
  82. package/dist/chunks/chunk-V4RMJKQP.js +0 -36
@@ -24,7 +24,7 @@ import {
24
24
  import {
25
25
  formatEnvironment,
26
26
  validateLsArgs
27
- } from "../../chunks/chunk-D3EEVTWR.js";
27
+ } from "../../chunks/chunk-XE5VSQ25.js";
28
28
  import {
29
29
  validateJsonOutput
30
30
  } from "../../chunks/chunk-XPKWKPWA.js";
@@ -33,7 +33,7 @@ import {
33
33
  } from "../../chunks/chunk-YPQSDAEW.js";
34
34
  import {
35
35
  getCommandAliases
36
- } from "../../chunks/chunk-ZPH66MB6.js";
36
+ } from "../../chunks/chunk-3QAUXPIR.js";
37
37
  import "../../chunks/chunk-AW5YINX6.js";
38
38
  import "../../chunks/chunk-A5KP5HAI.js";
39
39
  import "../../chunks/chunk-J6LK45HT.js";
@@ -56,7 +56,7 @@ import {
56
56
  stamp_default
57
57
  } from "../../chunks/chunk-64IF634X.js";
58
58
  import "../../chunks/chunk-VXYGCOKL.js";
59
- import "../../chunks/chunk-RUOBMMEA.js";
59
+ import "../../chunks/chunk-YCPUAG77.js";
60
60
  import {
61
61
  help
62
62
  } from "../../chunks/chunk-ZX2FSPWV.js";
@@ -84,7 +84,7 @@ import {
84
84
  resolveProjectContext,
85
85
  runSubcommand,
86
86
  updateSubcommand
87
- } from "../../chunks/chunk-BM5FP7VW.js";
87
+ } from "../../chunks/chunk-4CCY5OPH.js";
88
88
  import {
89
89
  TelemetryClient,
90
90
  require_dist as require_dist2
@@ -99,7 +99,7 @@ import {
99
99
  getPreservedArgsForEnvUpdate,
100
100
  outputActionRequired,
101
101
  outputAgentError
102
- } from "../../chunks/chunk-Z5ZQJ5VJ.js";
102
+ } from "../../chunks/chunk-TJJ562C5.js";
103
103
  import {
104
104
  printError
105
105
  } from "../../chunks/chunk-KBEX5MYS.js";
@@ -137,7 +137,7 @@ var import_chalk = __toESM(require_source(), 1);
137
137
 
138
138
  // src/util/env/add-env-record.ts
139
139
  var import_constants = __toESM(require_dist2(), 1);
140
- async function addEnvRecord(client, projectId, upsert, type, key, value, targets, gitBranch) {
140
+ async function addEnvRecord(client, projectId, upsert, type, key, value, targets, gitBranch, visibility) {
141
141
  const actionWord = upsert ? "Overriding" : "Adding";
142
142
  output_manager_default.debug(
143
143
  `${actionWord} ${type} Environment Variable ${key} to ${targets.length} targets`
@@ -154,7 +154,8 @@ async function addEnvRecord(client, projectId, upsert, type, key, value, targets
154
154
  value,
155
155
  target,
156
156
  customEnvironmentIds: customEnvironmentIds.length > 0 ? customEnvironmentIds : void 0,
157
- gitBranch: gitBranch || void 0
157
+ gitBranch: gitBranch || void 0,
158
+ ...visibility !== void 0 ? { visibility } : {}
158
159
  };
159
160
  const args = upsert ? `?upsert=${upsert}` : "";
160
161
  const url = `/v10/projects/${projectId}/env${args}`;
@@ -410,6 +411,15 @@ var EnvAddTelemetryClient = class extends TelemetryClient {
410
411
  });
411
412
  }
412
413
  }
414
+ trackCliOptionVisibility(visibility) {
415
+ if (visibility) {
416
+ const validVisibilities = ["config", "secret"];
417
+ this.trackCliOption({
418
+ option: "visibility",
419
+ value: validVisibilities.includes(visibility) ? visibility : this.redactedValue
420
+ });
421
+ }
422
+ }
413
423
  trackCliFlagSensitive(sensitive) {
414
424
  if (sensitive) {
415
425
  this.trackCliFlag("sensitive");
@@ -439,6 +449,141 @@ var EnvAddTelemetryClient = class extends TelemetryClient {
439
449
 
440
450
  // src/commands/env/add.ts
441
451
  import { determineAgent } from "@vercel/detect-agent";
452
+
453
+ // src/util/env/env-var-config-secret-ui.ts
454
+ function isEnvVarConfigSecretUiEnabled() {
455
+ const raw = process.env.VERCEL_ENV_VAR_CONFIG_SECRET_UI;
456
+ return raw === "1" || raw?.toLowerCase() === "true" || raw?.toLowerCase() === "on";
457
+ }
458
+ function shouldEnforceSensitiveEnvVarPolicy(policyOn) {
459
+ return policyOn && !isEnvVarConfigSecretUiEnabled();
460
+ }
461
+ function formatVisibilityLabel(visibility, type) {
462
+ const resolved = visibility ?? visibilityFromEnvType(type);
463
+ if (resolved === "config") {
464
+ return "Config";
465
+ }
466
+ if (resolved === "secret") {
467
+ return "Secret";
468
+ }
469
+ return void 0;
470
+ }
471
+ function visibilityFromEnvType(type) {
472
+ if (type === "sensitive") {
473
+ return "secret";
474
+ }
475
+ if (type === "plain" || type === "encrypted") {
476
+ return "config";
477
+ }
478
+ return void 0;
479
+ }
480
+ function hasNonDevelopmentTarget(envTargets) {
481
+ return envTargets.some((target) => target !== "development");
482
+ }
483
+ function getPublicPrefixSecretVisibilityError(key, options) {
484
+ const publicPrefix = getPublicPrefix(key);
485
+ if (!publicPrefix) {
486
+ return null;
487
+ }
488
+ const wouldBeSecret = options.visibility === "secret" || options.type === "sensitive";
489
+ if (!wouldBeSecret) {
490
+ return null;
491
+ }
492
+ const prefixLabel = publicPrefix.replace(/_$/, "");
493
+ if (hasNonDevelopmentTarget(options.envTargets)) {
494
+ return `Environment variables with a public framework prefix (${prefixLabel}) cannot use secret visibility on Production or Preview. Target Development only, rename to remove the public prefix, or use \`--visibility config\` with \`--no-sensitive\` on Development.`;
495
+ }
496
+ return `Environment variables with a public framework prefix (${prefixLabel}) cannot use secret visibility. Rename to remove the public prefix or use \`--visibility config\` with \`--no-sensitive\`.`;
497
+ }
498
+ function getDevelopmentSecretVisibilityError(envTargets, options) {
499
+ if (!envTargets.includes("development")) {
500
+ return null;
501
+ }
502
+ const wouldBeSecret = options.type === "sensitive" || options.visibility === "secret";
503
+ if (!wouldBeSecret) {
504
+ return null;
505
+ }
506
+ const hasNonDevelopment = envTargets.some((target) => target !== "development");
507
+ if (hasNonDevelopment) {
508
+ return `Sensitive Environment Variables are not supported on the Development Environment. Add --no-sensitive to store a non-sensitive value for all selected Environments, or run \`vercel env add\` separately for Development.`;
509
+ }
510
+ return `--sensitive is not allowed with the Development Environment. Sensitive Environment Variables are only supported on Production and Preview.`;
511
+ }
512
+ function shouldOmitInferredVisibility(key, envTargets, teamSensitivePolicyOn) {
513
+ if (!getPublicPrefix(key)) {
514
+ return false;
515
+ }
516
+ if (!hasNonDevelopmentTarget(envTargets)) {
517
+ return false;
518
+ }
519
+ return teamSensitivePolicyOn;
520
+ }
521
+ function resolveEnvVarVisibility(options) {
522
+ if (!options.configSecretUiEnabled) {
523
+ return {};
524
+ }
525
+ if (options.explicitVisibility !== void 0) {
526
+ if (options.explicitVisibility !== "config" && options.explicitVisibility !== "secret") {
527
+ return {
528
+ error: "The `--visibility` flag must be either `config` or `secret`."
529
+ };
530
+ }
531
+ const publicPrefixError2 = getPublicPrefixSecretVisibilityError(
532
+ options.key,
533
+ {
534
+ visibility: options.explicitVisibility,
535
+ type: options.type,
536
+ envTargets: options.envTargets
537
+ }
538
+ );
539
+ if (publicPrefixError2) {
540
+ return { error: publicPrefixError2 };
541
+ }
542
+ const developmentError2 = getDevelopmentSecretVisibilityError(
543
+ options.envTargets,
544
+ {
545
+ type: options.type,
546
+ visibility: options.explicitVisibility
547
+ }
548
+ );
549
+ if (developmentError2) {
550
+ return { error: developmentError2 };
551
+ }
552
+ return { visibility: options.explicitVisibility };
553
+ }
554
+ const inferred = visibilityFromEnvType(options.type);
555
+ if (inferred === void 0) {
556
+ return {};
557
+ }
558
+ const developmentError = getDevelopmentSecretVisibilityError(
559
+ options.envTargets,
560
+ {
561
+ type: options.type,
562
+ visibility: inferred
563
+ }
564
+ );
565
+ if (developmentError) {
566
+ return { error: developmentError };
567
+ }
568
+ if (shouldOmitInferredVisibility(
569
+ options.key,
570
+ options.envTargets,
571
+ options.teamSensitivePolicyOn
572
+ )) {
573
+ return {};
574
+ }
575
+ const publicPrefixError = getPublicPrefixSecretVisibilityError(options.key, {
576
+ visibility: inferred,
577
+ type: options.type,
578
+ envTargets: options.envTargets
579
+ });
580
+ if (publicPrefixError) {
581
+ return { error: publicPrefixError };
582
+ }
583
+ return { visibility: inferred };
584
+ }
585
+
586
+ // src/commands/env/add.ts
442
587
  var SENSITIVE_VALUE_HINT = "Sensitive values cannot be read later";
443
588
  var SENSITIVE_SECRET_PROMPT = `Store as sensitive? ${import_chalk.default.dim(
444
589
  SENSITIVE_VALUE_HINT
@@ -507,6 +652,10 @@ function multiTargetSuggestion(argv, envName, targets, addNoSensitive) {
507
652
  when: addNoSensitive ? "Add one non-sensitive variable to all listed environments" : "Add one variable to multiple environments"
508
653
  };
509
654
  }
655
+ function filterSensitiveMultiTargetSuggestionTargets(targets, opts) {
656
+ const excludeDevelopment = opts.forceSensitive || opts.policyOn;
657
+ return excludeDevelopment ? targets.filter((target) => target !== "development") : targets;
658
+ }
510
659
  function projectLabel(link) {
511
660
  return `${link.org.slug}/${link.project.name}`;
512
661
  }
@@ -528,7 +677,7 @@ function formatEnvironmentTargets(envTargets, customEnvironments) {
528
677
  function typeLabel(type) {
529
678
  return type === "sensitive" ? "Sensitive" : "Non-sensitive";
530
679
  }
531
- function printEnvAddResult(link, envName, envTargets, envGitBranch, customEnvironments, finalType, force) {
680
+ function printEnvAddResult(link, envName, envTargets, envGitBranch, customEnvironments, finalType, force, visibility) {
532
681
  output_manager_default.print("\n");
533
682
  printAlignedLabel(force ? "Overrode" : "Added", envName, { gutter: "\u2713" });
534
683
  printAlignedLabel("Project", projectLabel(link));
@@ -540,6 +689,12 @@ function printEnvAddResult(link, envName, envTargets, envGitBranch, customEnviro
540
689
  printAlignedLabel("Branch", envGitBranch);
541
690
  }
542
691
  printAlignedLabel("Type", typeLabel(finalType));
692
+ if (isEnvVarConfigSecretUiEnabled()) {
693
+ const visibilityLabel = formatVisibilityLabel(visibility, finalType);
694
+ if (visibilityLabel) {
695
+ printAlignedLabel("Visibility", visibilityLabel);
696
+ }
697
+ }
543
698
  }
544
699
  function printEnvAddWarning(message) {
545
700
  output_manager_default.print(`${import_chalk.default.yellow("!")} ${message}
@@ -572,6 +727,7 @@ async function add(client, argv) {
572
727
  return 1;
573
728
  }
574
729
  const { args, flags: opts } = parsedArgs;
730
+ const configSecretUiEnabled = isEnvVarConfigSecretUiEnabled();
575
731
  const stdInput = await readStandardInput(client.stdin);
576
732
  const valueFromFlag = typeof opts["--value"] === "string" ? opts["--value"] : void 0;
577
733
  let [envName, envTargetArg, envGitBranch] = args;
@@ -591,6 +747,9 @@ async function add(client, argv) {
591
747
  telemetryClient.trackCliFlagForce(opts["--force"]);
592
748
  telemetryClient.trackCliFlagGuidance(opts["--guidance"]);
593
749
  telemetryClient.trackCliFlagYes(opts["--yes"]);
750
+ telemetryClient.trackCliOptionVisibility(
751
+ typeof opts["--visibility"] === "string" ? opts["--visibility"] : void 0
752
+ );
594
753
  telemetryClient.trackCliOptionProject(opts["--project"]);
595
754
  if (args.length > 3) {
596
755
  output_manager_default.error(
@@ -769,7 +928,13 @@ async function add(client, argv) {
769
928
  }
770
929
  if (missing.includes("missing_environment")) {
771
930
  const standardAvailable = choices2.map((c) => c.value).filter((v) => isValidEnvTarget(v));
772
- const multiTargets = opts["--sensitive"] ? standardAvailable.filter((t) => t !== "development") : standardAvailable;
931
+ const multiTargets = filterSensitiveMultiTargetSuggestionTargets(
932
+ standardAvailable,
933
+ {
934
+ forceSensitive: Boolean(opts["--sensitive"]),
935
+ policyOn: false
936
+ }
937
+ );
773
938
  if (multiTargets.length > 1) {
774
939
  next.push(
775
940
  multiTargetSuggestion(
@@ -1036,11 +1201,26 @@ async function add(client, argv) {
1036
1201
  );
1037
1202
  return 1;
1038
1203
  }
1204
+ const explicitVisibility = typeof opts["--visibility"] === "string" ? opts["--visibility"] : void 0;
1205
+ if (explicitVisibility === "secret" && forceEncrypted) {
1206
+ output_manager_default.error(
1207
+ "`--visibility secret` cannot be used with `--no-sensitive`. Pick one."
1208
+ );
1209
+ return 1;
1210
+ }
1211
+ if (explicitVisibility === "config" && forceSensitive) {
1212
+ output_manager_default.error(
1213
+ "`--visibility config` cannot be used with `--sensitive`. Pick one."
1214
+ );
1215
+ return 1;
1216
+ }
1039
1217
  let policyOn = false;
1218
+ let teamSensitivePolicyOn = false;
1040
1219
  if (link.org.type === "team") {
1041
1220
  try {
1042
1221
  const team = await getTeamById(client, link.org.id);
1043
- policyOn = team?.sensitiveEnvironmentVariablePolicy === "on";
1222
+ teamSensitivePolicyOn = team?.sensitiveEnvironmentVariablePolicy === "on";
1223
+ policyOn = shouldEnforceSensitiveEnvVarPolicy(teamSensitivePolicyOn);
1044
1224
  } catch {
1045
1225
  }
1046
1226
  }
@@ -1210,7 +1390,13 @@ async function add(client, argv) {
1210
1390
  while (envTargets.length === 0) {
1211
1391
  if (client.nonInteractive && envChoices.length > 0) {
1212
1392
  const standardAvailable = choices.map((c) => c.value).filter((v) => isValidEnvTarget(v));
1213
- const multiTargets = policyOn || forceSensitive ? standardAvailable.filter((t) => t !== "development") : standardAvailable;
1393
+ const multiTargets = filterSensitiveMultiTargetSuggestionTargets(
1394
+ standardAvailable,
1395
+ {
1396
+ forceSensitive,
1397
+ policyOn
1398
+ }
1399
+ );
1214
1400
  const next = [];
1215
1401
  if (multiTargets.length > 1) {
1216
1402
  next.push(
@@ -1314,6 +1500,29 @@ async function add(client, argv) {
1314
1500
  }
1315
1501
  }
1316
1502
  const upsert = opts["--force"] ? "true" : "";
1503
+ const { visibility, error: visibilityError } = resolveEnvVarVisibility({
1504
+ configSecretUiEnabled,
1505
+ explicitVisibility,
1506
+ type: finalType,
1507
+ key: envName,
1508
+ envTargets,
1509
+ teamSensitivePolicyOn
1510
+ });
1511
+ if (visibilityError) {
1512
+ if (client.nonInteractive) {
1513
+ outputAgentError(
1514
+ client,
1515
+ {
1516
+ status: "error",
1517
+ reason: "invalid_visibility",
1518
+ message: visibilityError
1519
+ },
1520
+ 1
1521
+ );
1522
+ }
1523
+ output_manager_default.error(visibilityError);
1524
+ return 1;
1525
+ }
1317
1526
  try {
1318
1527
  output_manager_default.spinner("Saving\u2026");
1319
1528
  await addEnvRecord(
@@ -1324,7 +1533,8 @@ async function add(client, argv) {
1324
1533
  envName,
1325
1534
  finalValue,
1326
1535
  envTargets,
1327
- envGitBranch
1536
+ envGitBranch,
1537
+ visibility
1328
1538
  );
1329
1539
  } catch (err) {
1330
1540
  if (client.nonInteractive && isAPIError(err)) {
@@ -1352,7 +1562,8 @@ async function add(client, argv) {
1352
1562
  envGitBranch,
1353
1563
  customEnvironments,
1354
1564
  finalType,
1355
- Boolean(opts["--force"])
1565
+ Boolean(opts["--force"]),
1566
+ visibility
1356
1567
  );
1357
1568
  const { isAgent } = await determineAgent();
1358
1569
  const guidanceMode = parsedArgs.flags["--guidance"] ?? isAgent;
@@ -1947,7 +2158,7 @@ var import_chalk4 = __toESM(require_source(), 1);
1947
2158
 
1948
2159
  // src/util/env/update-env-record.ts
1949
2160
  var import_constants2 = __toESM(require_dist2(), 1);
1950
- async function updateEnvRecord(client, projectId, envId, type, key, value, targets, gitBranch) {
2161
+ async function updateEnvRecord(client, projectId, envId, type, key, value, targets, gitBranch, visibility) {
1951
2162
  output_manager_default.debug(
1952
2163
  `Updating ${type} Environment Variable ${key} in ${targets.length} targets`
1953
2164
  );
@@ -1962,7 +2173,8 @@ async function updateEnvRecord(client, projectId, envId, type, key, value, targe
1962
2173
  value,
1963
2174
  target,
1964
2175
  customEnvironmentIds: customEnvironmentIds.length > 0 ? customEnvironmentIds : void 0,
1965
- gitBranch: gitBranch || void 0
2176
+ gitBranch: gitBranch || void 0,
2177
+ ...visibility !== void 0 ? { visibility } : {}
1966
2178
  };
1967
2179
  if (key) {
1968
2180
  body.key = key;
@@ -2020,6 +2232,15 @@ var EnvUpdateTelemetryClient = class extends TelemetryClient {
2020
2232
  });
2021
2233
  }
2022
2234
  }
2235
+ trackCliOptionVisibility(visibility) {
2236
+ if (visibility) {
2237
+ const validVisibilities = ["config", "secret"];
2238
+ this.trackCliOption({
2239
+ option: "visibility",
2240
+ value: validVisibilities.includes(visibility) ? visibility : this.redactedValue
2241
+ });
2242
+ }
2243
+ }
2023
2244
  };
2024
2245
 
2025
2246
  // src/commands/env/update.ts
@@ -2065,6 +2286,9 @@ async function update(client, argv) {
2065
2286
  telemetryClient.trackCliFlagSensitive(opts["--sensitive"]);
2066
2287
  telemetryClient.trackCliFlagYes(opts["--yes"]);
2067
2288
  telemetryClient.trackCliOptionValue(valueFromFlag);
2289
+ telemetryClient.trackCliOptionVisibility(
2290
+ typeof opts["--visibility"] === "string" ? opts["--visibility"] : void 0
2291
+ );
2068
2292
  if (args.length > 3) {
2069
2293
  if (client.nonInteractive) {
2070
2294
  outputAgentError(
@@ -2325,11 +2549,14 @@ async function update(client, argv) {
2325
2549
  });
2326
2550
  selectedEnv = matchingEnvs[selectedIndex];
2327
2551
  }
2552
+ const configSecretUiEnabled = isEnvVarConfigSecretUiEnabled();
2328
2553
  let policyOn = false;
2554
+ let teamSensitivePolicyOn = false;
2329
2555
  if (link.org.type === "team") {
2330
2556
  try {
2331
2557
  const team = await getTeamById(client, link.org.id);
2332
- policyOn = team?.sensitiveEnvironmentVariablePolicy === "on";
2558
+ teamSensitivePolicyOn = team?.sensitiveEnvironmentVariablePolicy === "on";
2559
+ policyOn = shouldEnforceSensitiveEnvVarPolicy(teamSensitivePolicyOn);
2333
2560
  } catch {
2334
2561
  }
2335
2562
  }
@@ -2439,10 +2666,40 @@ async function update(client, argv) {
2439
2666
  }
2440
2667
  }
2441
2668
  const type = opts["--sensitive"] ? "sensitive" : selectedEnv.type;
2669
+ const explicitVisibility = typeof opts["--visibility"] === "string" ? opts["--visibility"] : void 0;
2670
+ if (explicitVisibility === "config" && opts["--sensitive"]) {
2671
+ output_manager_default.error(
2672
+ "`--visibility config` cannot be used with `--sensitive`. Pick one."
2673
+ );
2674
+ return 1;
2675
+ }
2442
2676
  const targets = Array.isArray(selectedEnv.target) ? selectedEnv.target : [selectedEnv.target].filter(
2443
2677
  (r) => Boolean(r)
2444
2678
  );
2445
2679
  const allTargets = [...targets, ...selectedEnv.customEnvironmentIds || []];
2680
+ const { visibility, error: visibilityError } = resolveEnvVarVisibility({
2681
+ configSecretUiEnabled,
2682
+ explicitVisibility,
2683
+ type,
2684
+ key: envName,
2685
+ envTargets: allTargets,
2686
+ teamSensitivePolicyOn
2687
+ });
2688
+ if (visibilityError) {
2689
+ if (client.nonInteractive) {
2690
+ outputAgentError(
2691
+ client,
2692
+ {
2693
+ status: "error",
2694
+ reason: "invalid_visibility",
2695
+ message: visibilityError
2696
+ },
2697
+ 1
2698
+ );
2699
+ }
2700
+ output_manager_default.error(visibilityError);
2701
+ return 1;
2702
+ }
2446
2703
  const updateStamp = stamp_default();
2447
2704
  try {
2448
2705
  output_manager_default.spinner("Updating");
@@ -2455,7 +2712,8 @@ async function update(client, argv) {
2455
2712
  keyToUpdate,
2456
2713
  finalValue,
2457
2714
  allTargets,
2458
- selectedEnv.gitBranch || ""
2715
+ selectedEnv.gitBranch || "",
2716
+ visibility
2459
2717
  );
2460
2718
  } catch (err) {
2461
2719
  if (client.nonInteractive && isAPIError(err)) {
@@ -2485,6 +2743,12 @@ async function update(client, argv) {
2485
2743
  )}
2486
2744
  `
2487
2745
  );
2746
+ if (configSecretUiEnabled) {
2747
+ const visibilityLabel = formatVisibilityLabel(visibility, type);
2748
+ if (visibilityLabel) {
2749
+ printAlignedLabel("Visibility", visibilityLabel);
2750
+ }
2751
+ }
2488
2752
  return 0;
2489
2753
  }
2490
2754
 
@@ -11,7 +11,7 @@ import {
11
11
  addSubcommand7 as addSubcommand,
12
12
  getCommandAliases,
13
13
  linkCommand
14
- } from "../../chunks/chunk-ZPH66MB6.js";
14
+ } from "../../chunks/chunk-3QAUXPIR.js";
15
15
  import "../../chunks/chunk-AW5YINX6.js";
16
16
  import "../../chunks/chunk-A5KP5HAI.js";
17
17
  import "../../chunks/chunk-J6LK45HT.js";
@@ -26,12 +26,12 @@ import "../../chunks/chunk-7QVJTI5H.js";
26
26
  import "../../chunks/chunk-O5GNPPTU.js";
27
27
  import {
28
28
  ensureLink
29
- } from "../../chunks/chunk-C33L5ZKY.js";
30
- import "../../chunks/chunk-OTQD3MHJ.js";
29
+ } from "../../chunks/chunk-2FMPLU44.js";
30
+ import "../../chunks/chunk-UE3JUVUZ.js";
31
31
  import {
32
32
  isPromptCanceledError
33
- } from "../../chunks/chunk-V4RMJKQP.js";
34
- import "../../chunks/chunk-RUOBMMEA.js";
33
+ } from "../../chunks/chunk-CPFNFVCL.js";
34
+ import "../../chunks/chunk-YCPUAG77.js";
35
35
  import {
36
36
  help
37
37
  } from "../../chunks/chunk-ZX2FSPWV.js";
@@ -43,11 +43,11 @@ import {
43
43
  getScope,
44
44
  pull,
45
45
  resolveProjectCwd
46
- } from "../../chunks/chunk-BM5FP7VW.js";
46
+ } from "../../chunks/chunk-4CCY5OPH.js";
47
47
  import {
48
48
  TelemetryClient
49
49
  } from "../../chunks/chunk-ECCWJHC6.js";
50
- import "../../chunks/chunk-Z5ZQJ5VJ.js";
50
+ import "../../chunks/chunk-TJJ562C5.js";
51
51
  import {
52
52
  printError
53
53
  } from "../../chunks/chunk-KBEX5MYS.js";
@@ -17,7 +17,7 @@ import {
17
17
  import {
18
18
  formatEnvironment,
19
19
  validateLsArgs
20
- } from "../../chunks/chunk-D3EEVTWR.js";
20
+ } from "../../chunks/chunk-XE5VSQ25.js";
21
21
  import {
22
22
  validateJsonOutput
23
23
  } from "../../chunks/chunk-XPKWKPWA.js";
@@ -41,13 +41,13 @@ import {
41
41
  getScope,
42
42
  parseTarget,
43
43
  toHost
44
- } from "../../chunks/chunk-BM5FP7VW.js";
44
+ } from "../../chunks/chunk-4CCY5OPH.js";
45
45
  import {
46
46
  TelemetryClient
47
47
  } from "../../chunks/chunk-ECCWJHC6.js";
48
48
  import {
49
49
  exitWithNonInteractiveError
50
- } from "../../chunks/chunk-Z5ZQJ5VJ.js";
50
+ } from "../../chunks/chunk-TJJ562C5.js";
51
51
  import {
52
52
  printError
53
53
  } from "../../chunks/chunk-KBEX5MYS.js";