@elf5/periscope 1.0.64 → 1.0.70

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/dist/cli.js CHANGED
@@ -175,7 +175,7 @@ var init_package = __esm({
175
175
  "package.json"() {
176
176
  package_default = {
177
177
  name: "@elf5/periscope",
178
- version: "1.0.64",
178
+ version: "1.0.70",
179
179
  description: "CLI client for Periscope SSH tunnel server",
180
180
  main: "dist/index.js",
181
181
  types: "dist/index.d.ts",
@@ -214,14 +214,10 @@ var init_package = __esm({
214
214
  author: "Elf 5",
215
215
  type: "module",
216
216
  license: "MIT",
217
- repository: {
218
- type: "git",
219
- url: "https://github.com/elf-5/periscope-client-npm.git"
220
- },
221
217
  bugs: {
222
- url: "https://github.com/elf-5/periscope-client-npm/issues"
218
+ email: "support@elf5.com"
223
219
  },
224
- homepage: "https://github.com/elf-5/periscope-client-npm#readme",
220
+ homepage: "https://elf5.com",
225
221
  engines: {
226
222
  node: ">=22.0.0"
227
223
  },
@@ -234,7 +230,13 @@ var init_package = __esm({
234
230
  glob: "^11.0.0",
235
231
  uuid: "^10.0.0"
236
232
  },
237
- dependencies: {
233
+ "lint-staged": {
234
+ "*.ts": [
235
+ "prettier --write",
236
+ "eslint --fix"
237
+ ]
238
+ },
239
+ devDependencies: {
238
240
  "@azure/msal-node": "^2.6.6",
239
241
  "@microsoft/dev-tunnels-connections": "^1.2.1",
240
242
  "@microsoft/dev-tunnels-contracts": "^1.2.1",
@@ -248,15 +250,7 @@ var init_package = __esm({
248
250
  commander: "^12.0.0",
249
251
  dotenv: "^16.4.5",
250
252
  open: "^10.0.3",
251
- "openid-client": "^6.8.2"
252
- },
253
- "lint-staged": {
254
- "*.ts": [
255
- "prettier --write",
256
- "eslint --fix"
257
- ]
258
- },
259
- devDependencies: {
253
+ "openid-client": "^6.8.2",
260
254
  "@elf-5/periscope-api-client": "^1.0.129",
261
255
  "@types/node": "^20.14.0",
262
256
  "@typescript-eslint/eslint-plugin": "^8.41.0",
@@ -1770,7 +1764,8 @@ import * as fs3 from "fs";
1770
1764
  import * as path3 from "path";
1771
1765
  import * as os3 from "os";
1772
1766
  import * as dotenv from "dotenv";
1773
- var ConfigManager = class {
1767
+ var ConfigManager = class _ConfigManager {
1768
+ static DEFAULT_SERVER_URL = "https://periscope.elf5.com";
1774
1769
  static CONFIG_DIR = path3.join(os3.homedir(), ".periscope");
1775
1770
  static CONFIG_FILE = "config.json";
1776
1771
  static testConfig = null;
@@ -1808,6 +1803,9 @@ var ConfigManager = class {
1808
1803
  }
1809
1804
  }
1810
1805
  config2 = this.mergeEnvironmentVariables(config2);
1806
+ if (!config2.serverUrl) {
1807
+ config2.serverUrl = _ConfigManager.DEFAULT_SERVER_URL;
1808
+ }
1811
1809
  return config2;
1812
1810
  }
1813
1811
  /**
@@ -4015,25 +4013,21 @@ var BaseCommand = class {
4015
4013
  */
4016
4014
  static async authenticateWithChoice(client3, prompt = "select_account") {
4017
4015
  log.info("Authentication required...");
4018
- const deviceCodeEnabled = process.env.PERISCOPE_ENABLE_DEVICE_CODE === "true";
4019
- let useBrowser = true;
4020
- if (deviceCodeEnabled) {
4021
- const rl = getReadlineInterface();
4022
- useBrowser = await new Promise((resolve, reject) => {
4023
- log.blank();
4024
- log.info("Choose authentication method:");
4025
- log.info("1. Browser authentication (recommended)");
4026
- log.info("2. Device code authentication");
4027
- try {
4028
- rl.question(
4029
- "Enter your choice (1 or 2) [default: 1]: ",
4030
- (answer) => resolve((answer.trim() || "1") === "1")
4031
- );
4032
- } catch (error) {
4033
- reject(error);
4034
- }
4035
- });
4036
- }
4016
+ const rl = getReadlineInterface();
4017
+ const useBrowser = await new Promise((resolve, reject) => {
4018
+ log.blank();
4019
+ log.info("Choose authentication method:");
4020
+ log.info("1. Browser (recommended)");
4021
+ log.info("2. Device code (for WSL or headless environments)");
4022
+ try {
4023
+ rl.question(
4024
+ "Enter your choice (1 or 2) [default: 1]: ",
4025
+ (answer) => resolve((answer.trim() || "1") === "1")
4026
+ );
4027
+ } catch (error) {
4028
+ reject(error);
4029
+ }
4030
+ });
4037
4031
  log.info(
4038
4032
  useBrowser ? `Starting browser authentication (${prompt})...` : "Starting device code authentication..."
4039
4033
  );
@@ -4064,12 +4058,6 @@ var BaseCommand = class {
4064
4058
  */
4065
4059
  static async initClient(existingConfig) {
4066
4060
  const config2 = existingConfig ?? ConfigManager.load();
4067
- if (!config2.serverUrl) {
4068
- log.error(
4069
- "Server URL not configured. Run: periscope config set --server <url>"
4070
- );
4071
- exitOrThrow(1);
4072
- }
4073
4061
  return { client: new PeriscopeClient(config2), config: config2 };
4074
4062
  }
4075
4063
  /**
@@ -4491,7 +4479,8 @@ var ConfigCommand = class _ConfigCommand extends BaseCommand {
4491
4479
  _ConfigCommand.showConfigValue(
4492
4480
  "Server URL ",
4493
4481
  config2.serverUrl,
4494
- "PERISCOPE_SERVER_URL"
4482
+ "PERISCOPE_SERVER_URL",
4483
+ ConfigManager.DEFAULT_SERVER_URL
4495
4484
  );
4496
4485
  _ConfigCommand.showConfigValue(
4497
4486
  "Request Log ",
@@ -4504,11 +4493,12 @@ var ConfigCommand = class _ConfigCommand extends BaseCommand {
4504
4493
  this.handleError(_ConfigCommand.Action.SHOW, error);
4505
4494
  }
4506
4495
  }
4507
- static showConfigValue(label, value, envVar) {
4496
+ static showConfigValue(label, value, envVar, defaultValue) {
4508
4497
  const envValue = process.env[envVar];
4509
4498
  const isFromEnv = envValue !== void 0 && envValue !== "";
4499
+ const isDefault = !isFromEnv && value === defaultValue;
4510
4500
  const displayValue = value || "Not configured";
4511
- const source = isFromEnv ? " (from env)" : "";
4501
+ const source = isFromEnv ? " (from env)" : isDefault ? " (default)" : "";
4512
4502
  log.info(`${label}: ${displayValue}${source}`);
4513
4503
  }
4514
4504
  };