@trading-boy/cli 1.2.13 → 1.2.15

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.
@@ -49898,8 +49898,13 @@ function writeEnvValue(filePath, key, value) {
49898
49898
  function registerConfigCommand(program2) {
49899
49899
  const configCmd = program2.command("config").description("Configuration management commands");
49900
49900
  configCmd.command("show").description("Display current configuration (sensitive values redacted)").addOption(new Option("--format <format>", "Output format").choices(["text", "json"]).default("text")).action((options) => {
49901
+ let config2 = null;
49901
49902
  try {
49902
- const config2 = getConfig();
49903
+ config2 = getConfig();
49904
+ } catch {
49905
+ config2 = null;
49906
+ }
49907
+ if (config2) {
49903
49908
  if (options.format === "json") {
49904
49909
  const configRecord = config2;
49905
49910
  const redacted = {};
@@ -49911,11 +49916,20 @@ function registerConfigCommand(program2) {
49911
49916
  } else {
49912
49917
  console.log(formatConfigOutput(config2));
49913
49918
  }
49914
- } catch (error49) {
49915
- const message = error49 instanceof Error ? error49.message : String(error49);
49916
- logger17.error({ error: message }, "Failed to load config");
49917
- console.error(source_default.red(`Error: ${message}`));
49918
- process.exitCode = 1;
49919
+ } else {
49920
+ console.log(source_default.yellow(" Note: Full config validation unavailable (server env vars not set)\n"));
49921
+ const redacted = {};
49922
+ for (const key of VALID_KEYS) {
49923
+ const value = process.env[key];
49924
+ redacted[key] = value !== void 0 ? redactValue(key, value) : source_default.dim("(not set)");
49925
+ }
49926
+ if (options.format === "json") {
49927
+ console.log(JSON.stringify(redacted, null, 2));
49928
+ } else {
49929
+ for (const [key, value] of Object.entries(redacted)) {
49930
+ console.log(` ${source_default.cyan(key.padEnd(30))} ${value}`);
49931
+ }
49932
+ }
49919
49933
  }
49920
49934
  });
49921
49935
  configCmd.command("set <key> <value>").description("Set a config value in the .env file").action((key, value) => {
@@ -50238,6 +50252,7 @@ function registerLoginCommand(program2) {
50238
50252
 
50239
50253
  // dist/commands/logout.js
50240
50254
  init_source();
50255
+ init_esm15();
50241
50256
  var logger20 = createLogger("cli-logout");
50242
50257
  async function executeLogout() {
50243
50258
  const existing = await loadCredentials();
@@ -50249,15 +50264,28 @@ async function executeLogout() {
50249
50264
  function registerLogoutCommand(program2) {
50250
50265
  program2.command("logout").description("Clear stored API key and credentials").action(async () => {
50251
50266
  try {
50252
- const result = await executeLogout();
50253
- console.log("");
50254
- if (result.wasAuthenticated) {
50255
- console.log(source_default.green(` Logged out successfully.`));
50256
- console.log(` ${source_default.gray("Cleared key:")} ${result.redactedKey}`);
50257
- } else {
50267
+ const existing = await loadCredentials();
50268
+ if (!existing) {
50269
+ console.log("");
50258
50270
  console.log(source_default.dim(" No credentials found \u2014 already logged out."));
50271
+ console.log("");
50272
+ return;
50259
50273
  }
50260
50274
  console.log("");
50275
+ console.log(source_default.yellow(" Warning: Your API key will be cleared from this machine."));
50276
+ console.log(source_default.yellow(" You will need your API key to log back in."));
50277
+ console.log(source_default.yellow(" There is no way to recover a lost key \u2014 a new one must be provisioned."));
50278
+ console.log("");
50279
+ const proceed = await esm_default4({ message: "Are you sure you want to logout?" });
50280
+ if (!proceed) {
50281
+ console.log(source_default.dim(" Logout cancelled."));
50282
+ return;
50283
+ }
50284
+ const result = await executeLogout();
50285
+ console.log("");
50286
+ console.log(source_default.green(` Logged out successfully.`));
50287
+ console.log(` ${source_default.gray("Cleared key:")} ${result.redactedKey}`);
50288
+ console.log("");
50261
50289
  } catch (error49) {
50262
50290
  const message = error49 instanceof Error ? error49.message : String(error49);
50263
50291
  logger20.error({ error: message }, "Logout failed");
@@ -222,10 +222,17 @@ export function registerConfigCommand(program) {
222
222
  .description('Display current configuration (sensitive values redacted)')
223
223
  .addOption(new Option('--format <format>', 'Output format').choices(['text', 'json']).default('text'))
224
224
  .action((options) => {
225
+ let config = null;
225
226
  try {
226
- const config = getConfig();
227
+ config = getConfig();
228
+ }
229
+ catch {
230
+ // Config validation failed (e.g. missing DB passwords in CLI-only mode)
231
+ // Fall back to showing raw env vars
232
+ config = null;
233
+ }
234
+ if (config) {
227
235
  if (options.format === 'json') {
228
- // Build a redacted config object for JSON output
229
236
  const configRecord = config;
230
237
  const redacted = {};
231
238
  for (const key of VALID_KEYS) {
@@ -238,11 +245,22 @@ export function registerConfigCommand(program) {
238
245
  console.log(formatConfigOutput(config));
239
246
  }
240
247
  }
241
- catch (error) {
242
- const message = error instanceof Error ? error.message : String(error);
243
- logger.error({ error: message }, 'Failed to load config');
244
- console.error(chalk.red(`Error: ${message}`));
245
- process.exitCode = 1;
248
+ else {
249
+ // Graceful fallback: show available env vars without full validation
250
+ console.log(chalk.yellow(' Note: Full config validation unavailable (server env vars not set)\n'));
251
+ const redacted = {};
252
+ for (const key of VALID_KEYS) {
253
+ const value = process.env[key];
254
+ redacted[key] = value !== undefined ? redactValue(key, value) : chalk.dim('(not set)');
255
+ }
256
+ if (options.format === 'json') {
257
+ console.log(JSON.stringify(redacted, null, 2));
258
+ }
259
+ else {
260
+ for (const [key, value] of Object.entries(redacted)) {
261
+ console.log(` ${chalk.cyan(key.padEnd(30))} ${value}`);
262
+ }
263
+ }
246
264
  }
247
265
  });
248
266
  // ─── config set ───
@@ -1,6 +1,7 @@
1
1
  import chalk from 'chalk';
2
2
  import { createLogger } from '@trading-boy/core';
3
3
  import { clearCredentials, loadCredentials, redactApiKey } from '../credentials.js';
4
+ import { confirm } from '@inquirer/prompts';
4
5
  const logger = createLogger('cli-logout');
5
6
  // ─── Logout Logic ───
6
7
  export async function executeLogout() {
@@ -17,15 +18,27 @@ export function registerLogoutCommand(program) {
17
18
  .description('Clear stored API key and credentials')
18
19
  .action(async () => {
19
20
  try {
20
- const result = await executeLogout();
21
- console.log('');
22
- if (result.wasAuthenticated) {
23
- console.log(chalk.green(` Logged out successfully.`));
24
- console.log(` ${chalk.gray('Cleared key:')} ${result.redactedKey}`);
25
- }
26
- else {
21
+ const existing = await loadCredentials();
22
+ if (!existing) {
23
+ console.log('');
27
24
  console.log(chalk.dim(' No credentials found — already logged out.'));
25
+ console.log('');
26
+ return;
27
+ }
28
+ console.log('');
29
+ console.log(chalk.yellow(' Warning: Your API key will be cleared from this machine.'));
30
+ console.log(chalk.yellow(' You will need your API key to log back in.'));
31
+ console.log(chalk.yellow(' There is no way to recover a lost key — a new one must be provisioned.'));
32
+ console.log('');
33
+ const proceed = await confirm({ message: 'Are you sure you want to logout?' });
34
+ if (!proceed) {
35
+ console.log(chalk.dim(' Logout cancelled.'));
36
+ return;
28
37
  }
38
+ const result = await executeLogout();
39
+ console.log('');
40
+ console.log(chalk.green(` Logged out successfully.`));
41
+ console.log(` ${chalk.gray('Cleared key:')} ${result.redactedKey}`);
29
42
  console.log('');
30
43
  }
31
44
  catch (error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trading-boy/cli",
3
- "version": "1.2.13",
3
+ "version": "1.2.15",
4
4
  "description": "Trading Boy CLI — crypto context intelligence for traders and AI agents. Query real-time prices, funding rates, whale activity, and DeFi risk for 100+ Solana tokens and 229 Hyperliquid perpetuals.",
5
5
  "homepage": "https://cabal.ventures",
6
6
  "repository": {