@vm0/cli 9.82.1 → 9.82.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vm0/cli",
3
- "version": "9.82.1",
3
+ "version": "9.82.2",
4
4
  "description": "CLI application",
5
5
  "repository": {
6
6
  "type": "git",
package/zero.js CHANGED
@@ -80,7 +80,7 @@ import {
80
80
  updateZeroUserPreferences,
81
81
  upsertZeroOrgModelProvider,
82
82
  withErrorHandler
83
- } from "./chunk-2KN52BP2.js";
83
+ } from "./chunk-2RXB3R33.js";
84
84
 
85
85
  // src/zero.ts
86
86
  import { Command as Command55 } from "commander";
@@ -296,7 +296,8 @@ var setCommand2 = new Command11().name("set").description("Create or update an o
296
296
  } else if (isInteractive()) {
297
297
  const prompted = await promptPassword("Enter secret value:");
298
298
  if (prompted === void 0) {
299
- process.exit(0);
299
+ console.log(chalk11.dim("Cancelled"));
300
+ return;
300
301
  }
301
302
  value = prompted;
302
303
  } else {
@@ -783,6 +784,11 @@ async function handleInteractiveMode() {
783
784
  )
784
785
  });
785
786
  }
787
+ let cancelled = false;
788
+ const onCancel = () => {
789
+ cancelled = true;
790
+ return false;
791
+ };
786
792
  const { modelProviders: configuredProviders } = await listZeroOrgModelProviders();
787
793
  const configuredTypes = new Set(configuredProviders.map((p) => p.type));
788
794
  const annotatedChoices = getSelectableProviderTypes().map((type2) => {
@@ -808,8 +814,12 @@ async function handleInteractiveMode() {
808
814
  message: "Select provider type:",
809
815
  choices: annotatedChoices
810
816
  },
811
- { onCancel: () => process.exit(0) }
817
+ { onCancel }
812
818
  );
819
+ if (cancelled) {
820
+ console.log(chalk18.dim("Cancelled"));
821
+ return null;
822
+ }
813
823
  const type = typeResponse.type;
814
824
  const existingProvider = configuredProviders.find((p) => p.type === type);
815
825
  if (existingProvider) {
@@ -826,8 +836,12 @@ async function handleInteractiveMode() {
826
836
  { title: "Update secret", value: "update" }
827
837
  ]
828
838
  },
829
- { onCancel: () => process.exit(0) }
839
+ { onCancel }
830
840
  );
841
+ if (cancelled) {
842
+ console.log(chalk18.dim("Cancelled"));
843
+ return null;
844
+ }
831
845
  if (actionResponse.action === "keep") {
832
846
  const selectedModel2 = await promptForModelSelection(type);
833
847
  return {
@@ -864,14 +878,19 @@ async function handleInteractiveMode() {
864
878
  message: `Enter your ${secretLabel}:`,
865
879
  validate: (value) => value.length > 0 || `${secretLabel} is required`
866
880
  },
867
- { onCancel: () => process.exit(0) }
881
+ { onCancel }
868
882
  );
883
+ if (cancelled) {
884
+ console.log(chalk18.dim("Cancelled"));
885
+ return null;
886
+ }
869
887
  const secret = secretResponse.secret;
870
888
  const selectedModel = await promptForModelSelection(type);
871
889
  return { type, secret, selectedModel, isInteractiveMode: true };
872
890
  }
873
891
  async function promptSetAsDefault(type, framework, isDefault) {
874
892
  if (isDefault) return;
893
+ let cancelled = false;
875
894
  const response = await prompts2(
876
895
  {
877
896
  type: "confirm",
@@ -879,8 +898,17 @@ async function promptSetAsDefault(type, framework, isDefault) {
879
898
  message: "Set this provider as default?",
880
899
  initial: false
881
900
  },
882
- { onCancel: () => process.exit(0) }
901
+ {
902
+ onCancel: () => {
903
+ cancelled = true;
904
+ return false;
905
+ }
906
+ }
883
907
  );
908
+ if (cancelled) {
909
+ console.log(chalk18.dim("Cancelled"));
910
+ return;
911
+ }
884
912
  if (response.setDefault) {
885
913
  await setZeroOrgModelProviderDefault(type);
886
914
  console.log(chalk18.green(`\u2713 Default for ${framework} set to "${type}"`));
@@ -1399,7 +1427,8 @@ async function connectViaApiToken(connectorType, tokenValue) {
1399
1427
  `${secretConfig.label}${secretConfig.placeholder ? chalk27.dim(` (${secretConfig.placeholder})`) : ""}:`
1400
1428
  );
1401
1429
  if (!value) {
1402
- throw new Error("Cancelled");
1430
+ console.log(chalk27.dim("Cancelled"));
1431
+ return;
1403
1432
  }
1404
1433
  inputSecrets[secretName] = value;
1405
1434
  }
@@ -1451,7 +1480,8 @@ async function resolveAuthMethod(connectorType, tokenFlag) {
1451
1480
  ]
1452
1481
  );
1453
1482
  if (!selected) {
1454
- throw new Error("Cancelled");
1483
+ console.log(chalk27.dim("Cancelled"));
1484
+ return null;
1455
1485
  }
1456
1486
  return selected;
1457
1487
  }
@@ -1520,6 +1550,7 @@ var connectCommand = new Command30().name("connect").description("Connect a thir
1520
1550
  return;
1521
1551
  }
1522
1552
  const authMethod = await resolveAuthMethod(connectorType, options.token);
1553
+ if (!authMethod) return;
1523
1554
  if (authMethod === "api-token") {
1524
1555
  await connectViaApiToken(connectorType, options.token);
1525
1556
  return;
@@ -2663,7 +2694,8 @@ var setCommand4 = new Command44().name("set").description("Create or update a se
2663
2694
  } else if (isInteractive()) {
2664
2695
  const prompted = await promptPassword("Enter secret value:");
2665
2696
  if (prompted === void 0) {
2666
- process.exit(0);
2697
+ console.log(chalk39.dim("Cancelled"));
2698
+ return;
2667
2699
  }
2668
2700
  value = prompted;
2669
2701
  } else {
@@ -2942,7 +2974,7 @@ function applyCapabilityVisibility(prog) {
2942
2974
  }
2943
2975
  }
2944
2976
  var program = new Command55();
2945
- program.name("zero").description("Zero CLI - Manage your zero platform").version("9.82.1");
2977
+ program.name("zero").description("Zero CLI - Manage your zero platform").version("9.82.2");
2946
2978
  program.addCommand(zeroOrgCommand);
2947
2979
  program.addCommand(zeroAgentCommand);
2948
2980
  program.addCommand(zeroConnectorCommand);
@@ -2953,14 +2985,6 @@ program.addCommand(zeroSlackCommand);
2953
2985
  program.addCommand(zeroVariableCommand);
2954
2986
  program.addCommand(zeroWhoamiCommand);
2955
2987
  if (process.argv[1]?.endsWith("zero.js") || process.argv[1]?.endsWith("zero.ts") || process.argv[1]?.endsWith("zero")) {
2956
- process.stdout.on("error", (err) => {
2957
- if (err.code === "EPIPE") process.exit(0);
2958
- throw err;
2959
- });
2960
- process.stderr.on("error", (err) => {
2961
- if (err.code === "EPIPE") process.exit(0);
2962
- throw err;
2963
- });
2964
2988
  configureGlobalProxyFromEnv();
2965
2989
  applyCapabilityVisibility(program);
2966
2990
  program.parse();