@fiber-pay/cli 0.1.0-rc.7 → 0.1.0

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
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // src/index.ts
4
- import { join as join9 } from "path";
4
+ import { join as join11 } from "path";
5
5
  import { Command as Command14 } from "commander";
6
6
 
7
7
  // src/commands/binary.ts
@@ -1400,7 +1400,9 @@ function createChannelCommand(config) {
1400
1400
  }
1401
1401
 
1402
1402
  // src/commands/config.ts
1403
- import { existsSync as existsSync5, readFileSync as readFileSync4, writeFileSync as writeFileSync4 } from "fs";
1403
+ import { existsSync as existsSync5, readdirSync, readFileSync as readFileSync4, writeFileSync as writeFileSync4 } from "fs";
1404
+ import { homedir } from "os";
1405
+ import { join as join5 } from "path";
1404
1406
  import { Command as Command3 } from "commander";
1405
1407
  import { parseDocument, stringify as yamlStringify } from "yaml";
1406
1408
 
@@ -2123,6 +2125,56 @@ function createConfigCommand(_config) {
2123
2125
  }
2124
2126
  }
2125
2127
  });
2128
+ profile.command("list").description("List all available Fiber profiles").option("--json").action(async (options) => {
2129
+ const homeDir = homedir();
2130
+ const profilesDir = join5(homeDir, ".fiber-pay", "profiles");
2131
+ const defaultDir = join5(homeDir, ".fiber-pay");
2132
+ const defaultConfigPath = join5(defaultDir, "config.yml");
2133
+ const profiles = [];
2134
+ const hasDefaultConfig = existsSync5(defaultConfigPath);
2135
+ if (hasDefaultConfig) {
2136
+ profiles.push("default");
2137
+ }
2138
+ if (existsSync5(profilesDir)) {
2139
+ try {
2140
+ const entries = readdirSync(profilesDir, { withFileTypes: true });
2141
+ for (const entry of entries) {
2142
+ if (entry.isDirectory() && entry.name !== "default") {
2143
+ profiles.push(entry.name);
2144
+ }
2145
+ }
2146
+ } catch (error) {
2147
+ if (options.json) {
2148
+ printJsonError({
2149
+ code: "PROFILE_LIST_ERROR",
2150
+ message: `Failed to read profiles directory: ${error instanceof Error ? error.message : String(error)}`,
2151
+ recoverable: true
2152
+ });
2153
+ process.exit(1);
2154
+ } else {
2155
+ console.error(
2156
+ `Warning: Could not read profiles directory: ${error instanceof Error ? error.message : String(error)}`
2157
+ );
2158
+ }
2159
+ }
2160
+ }
2161
+ profiles.sort((a, b) => {
2162
+ if (a === "default") return -1;
2163
+ if (b === "default") return 1;
2164
+ return a.localeCompare(b);
2165
+ });
2166
+ if (options.json) {
2167
+ printJsonSuccess({ profiles, count: profiles.length });
2168
+ } else {
2169
+ if (profiles.length === 0) {
2170
+ console.log("No profiles found.");
2171
+ } else {
2172
+ for (const profileName of profiles) {
2173
+ console.log(profileName);
2174
+ }
2175
+ }
2176
+ }
2177
+ });
2126
2178
  profile.command("set").description("Set a profile key").argument("<key>", `One of: ${PROFILE_KEYS.join(", ")}`).argument("<value>").option("--json").action(async (key, value, options) => {
2127
2179
  if (!PROFILE_KEYS.includes(key)) {
2128
2180
  const msg = `Unknown profile key: ${key}. Valid keys: ${PROFILE_KEYS.join(", ")}`;
@@ -2483,17 +2535,158 @@ import { Command as Command6 } from "commander";
2483
2535
 
2484
2536
  // src/lib/log-files.ts
2485
2537
  import {
2486
- appendFileSync,
2487
2538
  closeSync,
2488
2539
  createReadStream,
2489
2540
  existsSync as existsSync6,
2490
2541
  mkdirSync as mkdirSync2,
2491
2542
  openSync,
2492
- readdirSync,
2543
+ readdirSync as readdirSync2,
2493
2544
  readSync,
2494
2545
  statSync
2495
2546
  } from "fs";
2496
- import { join as join5 } from "path";
2547
+ import { join as join7 } from "path";
2548
+
2549
+ // src/lib/log-writer.ts
2550
+ import { createWriteStream } from "fs";
2551
+ import { mkdir } from "fs/promises";
2552
+ import { dirname as dirname2, join as join6 } from "path";
2553
+ var LogWriter = class {
2554
+ constructor(baseDir, filename) {
2555
+ this.baseDir = baseDir;
2556
+ this.filename = filename;
2557
+ }
2558
+ stream = null;
2559
+ pendingWrites = 0;
2560
+ lastErrorTime = 0;
2561
+ errorRateLimitMs = 1e3;
2562
+ isClosing = false;
2563
+ waitingForDrain = false;
2564
+ currentDate = null;
2565
+ async append(text) {
2566
+ if (this.isClosing) {
2567
+ throw new Error("Cannot append to closing LogWriter");
2568
+ }
2569
+ await this.ensureStream();
2570
+ if (!this.stream) {
2571
+ throw new Error("Failed to create write stream");
2572
+ }
2573
+ return new Promise((resolve2, reject) => {
2574
+ const stream = this.stream;
2575
+ if (this.waitingForDrain) {
2576
+ const onDrain = () => {
2577
+ this.waitingForDrain = false;
2578
+ stream.off("drain", onDrain);
2579
+ stream.off("error", onError);
2580
+ this.performWrite(text, resolve2, reject);
2581
+ };
2582
+ const onError = (err) => {
2583
+ this.waitingForDrain = false;
2584
+ stream.off("drain", onDrain);
2585
+ stream.off("error", onError);
2586
+ this.handleError(err);
2587
+ reject(err);
2588
+ };
2589
+ stream.once("drain", onDrain);
2590
+ stream.once("error", onError);
2591
+ return;
2592
+ }
2593
+ this.performWrite(text, resolve2, reject);
2594
+ });
2595
+ }
2596
+ async flush() {
2597
+ if (this.isClosing || !this.stream) {
2598
+ return;
2599
+ }
2600
+ this.isClosing = true;
2601
+ while (this.pendingWrites > 0) {
2602
+ await new Promise((resolve2) => setTimeout(resolve2, 10));
2603
+ }
2604
+ return new Promise((resolve2, reject) => {
2605
+ if (!this.stream) {
2606
+ resolve2();
2607
+ return;
2608
+ }
2609
+ const stream = this.stream;
2610
+ stream.once("finish", () => {
2611
+ this.stream = null;
2612
+ resolve2();
2613
+ });
2614
+ stream.once("error", (err) => {
2615
+ this.handleError(err);
2616
+ this.stream = null;
2617
+ reject(err);
2618
+ });
2619
+ stream.end();
2620
+ });
2621
+ }
2622
+ async ensureStream() {
2623
+ this.isClosing = false;
2624
+ const today = this.todayDateString();
2625
+ if (this.stream && this.currentDate !== today && !this.isClosing) {
2626
+ await this.flush();
2627
+ this.stream = null;
2628
+ }
2629
+ if (this.stream && !this.isClosing) {
2630
+ return;
2631
+ }
2632
+ this.currentDate = today;
2633
+ const logPath = this.resolveLogPath();
2634
+ await this.ensureDirectory(logPath);
2635
+ this.stream = createWriteStream(logPath, {
2636
+ flags: "a",
2637
+ highWaterMark: 16 * 1024
2638
+ });
2639
+ this.stream.on("error", (err) => {
2640
+ this.handleError(err);
2641
+ this.stream = null;
2642
+ this.isClosing = true;
2643
+ });
2644
+ this.isClosing = false;
2645
+ }
2646
+ performWrite(text, resolve2, reject) {
2647
+ if (!this.stream) {
2648
+ reject(new Error("Stream is not available"));
2649
+ return;
2650
+ }
2651
+ this.pendingWrites += 1;
2652
+ const canContinue = this.stream.write(text, (err) => {
2653
+ this.pendingWrites -= 1;
2654
+ if (err) {
2655
+ this.handleError(err);
2656
+ reject(err);
2657
+ } else {
2658
+ resolve2();
2659
+ }
2660
+ });
2661
+ if (!canContinue) {
2662
+ this.waitingForDrain = true;
2663
+ }
2664
+ }
2665
+ async ensureDirectory(filePath) {
2666
+ const dir = dirname2(filePath);
2667
+ await mkdir(dir, { recursive: true });
2668
+ }
2669
+ resolveLogPath() {
2670
+ const dateStr = this.todayDateString();
2671
+ return join6(this.baseDir, "logs", dateStr, this.filename);
2672
+ }
2673
+ todayDateString() {
2674
+ const now = /* @__PURE__ */ new Date();
2675
+ const y = now.getUTCFullYear();
2676
+ const m = String(now.getUTCMonth() + 1).padStart(2, "0");
2677
+ const d = String(now.getUTCDate()).padStart(2, "0");
2678
+ return `${y}-${m}-${d}`;
2679
+ }
2680
+ handleError(error) {
2681
+ const now = Date.now();
2682
+ if (now - this.lastErrorTime >= this.errorRateLimitMs) {
2683
+ this.lastErrorTime = now;
2684
+ console.error(`[LogWriter] ${error.message}`);
2685
+ }
2686
+ }
2687
+ };
2688
+
2689
+ // src/lib/log-files.ts
2497
2690
  var DATE_DIR_PATTERN = /^\d{4}-\d{2}-\d{2}$/;
2498
2691
  function todayDateString() {
2499
2692
  const now = /* @__PURE__ */ new Date();
@@ -2517,11 +2710,11 @@ function resolveLogDirForDate(dataDir, date) {
2517
2710
  }
2518
2711
  function resolveLogDirForDateWithOptions(dataDir, date, options) {
2519
2712
  const dateStr = date ?? todayDateString();
2520
- const logsBaseDir = options.logsBaseDir ?? join5(dataDir, "logs");
2713
+ const logsBaseDir = options.logsBaseDir ?? join7(dataDir, "logs");
2521
2714
  if (date !== void 0) {
2522
2715
  validateLogDate(dateStr);
2523
2716
  }
2524
- const dir = join5(logsBaseDir, dateStr);
2717
+ const dir = join7(logsBaseDir, dateStr);
2525
2718
  const ensureExists = options.ensureExists ?? true;
2526
2719
  if (ensureExists) {
2527
2720
  mkdirSync2(dir, { recursive: true });
@@ -2529,16 +2722,16 @@ function resolveLogDirForDateWithOptions(dataDir, date, options) {
2529
2722
  return dir;
2530
2723
  }
2531
2724
  function resolvePersistedLogPaths(dataDir, meta, date) {
2532
- const logsBaseDir = meta?.logsBaseDir ?? join5(dataDir, "logs");
2725
+ const logsBaseDir = meta?.logsBaseDir ?? join7(dataDir, "logs");
2533
2726
  if (date) {
2534
2727
  const dir2 = resolveLogDirForDateWithOptions(dataDir, date, {
2535
2728
  logsBaseDir,
2536
2729
  ensureExists: false
2537
2730
  });
2538
2731
  return {
2539
- runtimeAlerts: join5(dir2, "runtime.alerts.jsonl"),
2540
- fnnStdout: join5(dir2, "fnn.stdout.log"),
2541
- fnnStderr: join5(dir2, "fnn.stderr.log")
2732
+ runtimeAlerts: join7(dir2, "runtime.alerts.jsonl"),
2733
+ fnnStdout: join7(dir2, "fnn.stdout.log"),
2734
+ fnnStderr: join7(dir2, "fnn.stderr.log")
2542
2735
  };
2543
2736
  }
2544
2737
  if (meta?.alertLogFilePath || meta?.fnnStdoutLogPath || meta?.fnnStderrLogPath) {
@@ -2547,9 +2740,9 @@ function resolvePersistedLogPaths(dataDir, meta, date) {
2547
2740
  ensureExists: false
2548
2741
  });
2549
2742
  return {
2550
- runtimeAlerts: meta.alertLogFilePath ?? join5(defaultDir, "runtime.alerts.jsonl"),
2551
- fnnStdout: meta.fnnStdoutLogPath ?? join5(defaultDir, "fnn.stdout.log"),
2552
- fnnStderr: meta.fnnStderrLogPath ?? join5(defaultDir, "fnn.stderr.log")
2743
+ runtimeAlerts: meta.alertLogFilePath ?? join7(defaultDir, "runtime.alerts.jsonl"),
2744
+ fnnStdout: meta.fnnStdoutLogPath ?? join7(defaultDir, "fnn.stdout.log"),
2745
+ fnnStderr: meta.fnnStderrLogPath ?? join7(defaultDir, "fnn.stderr.log")
2553
2746
  };
2554
2747
  }
2555
2748
  const dir = resolveLogDirForDateWithOptions(dataDir, void 0, {
@@ -2557,24 +2750,35 @@ function resolvePersistedLogPaths(dataDir, meta, date) {
2557
2750
  ensureExists: false
2558
2751
  });
2559
2752
  return {
2560
- runtimeAlerts: join5(dir, "runtime.alerts.jsonl"),
2561
- fnnStdout: join5(dir, "fnn.stdout.log"),
2562
- fnnStderr: join5(dir, "fnn.stderr.log")
2753
+ runtimeAlerts: join7(dir, "runtime.alerts.jsonl"),
2754
+ fnnStdout: join7(dir, "fnn.stdout.log"),
2755
+ fnnStderr: join7(dir, "fnn.stderr.log")
2563
2756
  };
2564
2757
  }
2565
2758
  function listLogDates(dataDir, logsBaseDir) {
2566
- const logsDir = logsBaseDir ?? join5(dataDir, "logs");
2759
+ const logsDir = logsBaseDir ?? join7(dataDir, "logs");
2567
2760
  if (!existsSync6(logsDir)) {
2568
2761
  return [];
2569
2762
  }
2570
- const entries = readdirSync(logsDir, { withFileTypes: true });
2763
+ const entries = readdirSync2(logsDir, { withFileTypes: true });
2571
2764
  const dates = entries.filter((entry) => entry.isDirectory() && DATE_DIR_PATTERN.test(entry.name)).map((entry) => entry.name);
2572
2765
  dates.sort((a, b) => a > b ? -1 : a < b ? 1 : 0);
2573
2766
  return dates;
2574
2767
  }
2575
- function appendToTodayLog(dataDir, filename, text) {
2576
- const dir = resolveLogDirForDate(dataDir);
2577
- appendFileSync(join5(dir, filename), text, "utf-8");
2768
+ var logWriters = /* @__PURE__ */ new Map();
2769
+ function getLogWriter(dataDir, filename) {
2770
+ const key = `${dataDir}:${filename}`;
2771
+ if (!logWriters.has(key)) {
2772
+ logWriters.set(key, new LogWriter(dataDir, filename));
2773
+ }
2774
+ return logWriters.get(key);
2775
+ }
2776
+ async function appendToTodayLog(dataDir, filename, text) {
2777
+ const writer = getLogWriter(dataDir, filename);
2778
+ await writer.append(text);
2779
+ }
2780
+ async function flushPendingLogs() {
2781
+ await Promise.all(Array.from(logWriters.values()).map((w) => w.flush()));
2578
2782
  }
2579
2783
  function resolvePersistedLogTargets(paths, source) {
2580
2784
  const all = [
@@ -3013,7 +3217,7 @@ ${title}: ${filePath}`);
3013
3217
 
3014
3218
  // src/commands/logs.ts
3015
3219
  import { existsSync as existsSync8, statSync as statSync2 } from "fs";
3016
- import { join as join6 } from "path";
3220
+ import { join as join8 } from "path";
3017
3221
  import { formatRuntimeAlert } from "@fiber-pay/runtime";
3018
3222
  import { Command as Command7 } from "commander";
3019
3223
  var ALLOWED_SOURCES = /* @__PURE__ */ new Set([
@@ -3069,7 +3273,7 @@ function createLogsCommand(config) {
3069
3273
  process.exit(1);
3070
3274
  }
3071
3275
  if (listDates) {
3072
- const logsDir = meta?.logsBaseDir ?? join6(config.dataDir, "logs");
3276
+ const logsDir = meta?.logsBaseDir ?? join8(config.dataDir, "logs");
3073
3277
  const dates = listLogDates(config.dataDir, logsDir);
3074
3278
  if (json) {
3075
3279
  printJsonSuccess({ dates, logsDir });
@@ -3469,7 +3673,7 @@ function printNodeNetworkHuman(data) {
3469
3673
  // src/lib/node-start.ts
3470
3674
  import { spawn } from "child_process";
3471
3675
  import { mkdirSync as mkdirSync3 } from "fs";
3472
- import { join as join7 } from "path";
3676
+ import { join as join9 } from "path";
3473
3677
  import {
3474
3678
  createKeyManager,
3475
3679
  ensureFiberBinary,
@@ -3512,7 +3716,7 @@ async function autoConnectBootnodes(rpc, bootnodes) {
3512
3716
  }
3513
3717
 
3514
3718
  // src/lib/node-migration.ts
3515
- import { dirname as dirname2 } from "path";
3719
+ import { dirname as dirname3 } from "path";
3516
3720
  import { BinaryManager as BinaryManager2, MigrationManager } from "@fiber-pay/node";
3517
3721
 
3518
3722
  // src/lib/migration-utils.ts
@@ -3536,7 +3740,7 @@ async function runMigrationGuard(opts) {
3536
3740
  return { checked: false, skippedReason: "store does not exist" };
3537
3741
  }
3538
3742
  const storePath = MigrationManager.resolveStorePath(dataDir);
3539
- const binaryDir = dirname2(binaryPath);
3743
+ const binaryDir = dirname3(binaryPath);
3540
3744
  const bm = new BinaryManager2(binaryDir);
3541
3745
  const migrateBinPath = bm.getMigrateBinaryPath();
3542
3746
  let migrationCheck;
@@ -3796,8 +4000,8 @@ async function runNodeStartCommand(config, options) {
3796
4000
  options.runtimeProxyListen ?? config.runtimeProxyListen ?? "127.0.0.1:8229"
3797
4001
  );
3798
4002
  const proxyListenSource = options.runtimeProxyListen ? "cli" : config.runtimeProxyListen ? "profile" : "default";
3799
- const runtimeStateFilePath = join7(config.dataDir, "runtime-state.json");
3800
- const logsBaseDir = join7(config.dataDir, "logs");
4003
+ const runtimeStateFilePath = join9(config.dataDir, "runtime-state.json");
4004
+ const logsBaseDir = join9(config.dataDir, "logs");
3801
4005
  mkdirSync3(logsBaseDir, { recursive: true });
3802
4006
  resolveLogDirForDate(config.dataDir);
3803
4007
  const resolvedBinary = resolveBinaryPath(config);
@@ -3872,11 +4076,13 @@ async function runNodeStartCommand(config, options) {
3872
4076
  removePidFile(config.dataDir);
3873
4077
  });
3874
4078
  processManager.on("stdout", (text) => {
3875
- appendToTodayLog(config.dataDir, "fnn.stdout.log", text);
4079
+ appendToTodayLog(config.dataDir, "fnn.stdout.log", text).catch(() => {
4080
+ });
3876
4081
  emitFnnLog("stdout", text);
3877
4082
  });
3878
4083
  processManager.on("stderr", (text) => {
3879
- appendToTodayLog(config.dataDir, "fnn.stderr.log", text);
4084
+ appendToTodayLog(config.dataDir, "fnn.stderr.log", text).catch(() => {
4085
+ });
3880
4086
  emitFnnLog("stderr", text);
3881
4087
  });
3882
4088
  await processManager.start();
@@ -3970,7 +4176,7 @@ async function runNodeStartCommand(config, options) {
3970
4176
  alerts: [{ type: "stdout" }, { type: "daily-file", baseLogsDir: logsBaseDir }],
3971
4177
  jobs: {
3972
4178
  enabled: true,
3973
- dbPath: join7(config.dataDir, "runtime-jobs.db")
4179
+ dbPath: join9(config.dataDir, "runtime-jobs.db")
3974
4180
  }
3975
4181
  });
3976
4182
  const runtimeStatus = runtime.service.getStatus();
@@ -3982,9 +4188,9 @@ async function runNodeStartCommand(config, options) {
3982
4188
  fiberRpcUrl: runtimeStatus.targetUrl,
3983
4189
  proxyListen: runtimeStatus.proxyListen,
3984
4190
  stateFilePath: runtimeStateFilePath,
3985
- alertLogFilePath: join7(todayLogDir, "runtime.alerts.jsonl"),
3986
- fnnStdoutLogPath: join7(todayLogDir, "fnn.stdout.log"),
3987
- fnnStderrLogPath: join7(todayLogDir, "fnn.stderr.log"),
4191
+ alertLogFilePath: join9(todayLogDir, "runtime.alerts.jsonl"),
4192
+ fnnStdoutLogPath: join9(todayLogDir, "fnn.stdout.log"),
4193
+ fnnStderrLogPath: join9(todayLogDir, "fnn.stderr.log"),
3988
4194
  logsBaseDir,
3989
4195
  daemon: false
3990
4196
  });
@@ -4055,7 +4261,7 @@ async function runNodeStartCommand(config, options) {
4055
4261
  process.exit(1);
4056
4262
  }
4057
4263
  emitStage("rpc_ready", "ok", { rpcUrl: config.rpcUrl });
4058
- const bootnodes = nodeConfig.configFilePath ? extractBootnodeAddrs(nodeConfig.configFilePath) : extractBootnodeAddrs(join7(config.dataDir, "config.yml"));
4264
+ const bootnodes = nodeConfig.configFilePath ? extractBootnodeAddrs(nodeConfig.configFilePath) : extractBootnodeAddrs(join9(config.dataDir, "config.yml"));
4059
4265
  if (bootnodes.length > 0) {
4060
4266
  await autoConnectBootnodes(rpc, bootnodes);
4061
4267
  }
@@ -4117,6 +4323,23 @@ async function runNodeStartCommand(config, options) {
4117
4323
  if (!json) {
4118
4324
  console.log("\n\u{1F6D1} Shutting down...");
4119
4325
  }
4326
+ let flushTimeout;
4327
+ try {
4328
+ await Promise.race([
4329
+ flushPendingLogs(),
4330
+ new Promise((_, reject) => {
4331
+ flushTimeout = setTimeout(() => reject(new Error("Flush timeout")), 5e3);
4332
+ })
4333
+ ]);
4334
+ } catch (err) {
4335
+ if (!json) {
4336
+ console.log("\u26A0\uFE0F Log flush timed out, continuing shutdown...");
4337
+ }
4338
+ } finally {
4339
+ if (flushTimeout !== void 0) {
4340
+ clearTimeout(flushTimeout);
4341
+ }
4342
+ }
4120
4343
  if (runtimeDaemon) {
4121
4344
  stopRuntimeDaemonFromNode({ dataDir: config.dataDir, rpcUrl: config.rpcUrl });
4122
4345
  } else if (runtime) {
@@ -5433,7 +5656,7 @@ function createPeerCommand(config) {
5433
5656
 
5434
5657
  // src/commands/runtime.ts
5435
5658
  import { spawn as spawn2 } from "child_process";
5436
- import { join as join8, resolve } from "path";
5659
+ import { join as join10, resolve } from "path";
5437
5660
  import {
5438
5661
  alertPriorityOrder,
5439
5662
  formatRuntimeAlert as formatRuntimeAlert2,
@@ -5662,7 +5885,7 @@ function createRuntimeCommand(config) {
5662
5885
  logsBaseDir,
5663
5886
  ensureExists: false
5664
5887
  });
5665
- const effectiveAlertLogPath = alertLogsBaseDir ? join8(todayLogDir, "runtime.alerts.jsonl") : alertLogFile ?? join8(todayLogDir, "runtime.alerts.jsonl");
5888
+ const effectiveAlertLogPath = alertLogsBaseDir ? join10(todayLogDir, "runtime.alerts.jsonl") : alertLogFile ?? join10(todayLogDir, "runtime.alerts.jsonl");
5666
5889
  writeRuntimePid(config.dataDir, process.pid);
5667
5890
  writeRuntimeMeta(config.dataDir, {
5668
5891
  pid: process.pid,
@@ -5671,8 +5894,8 @@ function createRuntimeCommand(config) {
5671
5894
  proxyListen: status.proxyListen,
5672
5895
  stateFilePath: runtimeConfig.storage?.stateFilePath,
5673
5896
  alertLogFilePath: effectiveAlertLogPath,
5674
- fnnStdoutLogPath: join8(todayLogDir, "fnn.stdout.log"),
5675
- fnnStderrLogPath: join8(todayLogDir, "fnn.stderr.log"),
5897
+ fnnStdoutLogPath: join10(todayLogDir, "fnn.stdout.log"),
5898
+ fnnStderrLogPath: join10(todayLogDir, "fnn.stderr.log"),
5676
5899
  logsBaseDir,
5677
5900
  daemon: daemon || isRuntimeChild
5678
5901
  });
@@ -5924,8 +6147,8 @@ function createRuntimeCommand(config) {
5924
6147
  import { Command as Command12 } from "commander";
5925
6148
 
5926
6149
  // src/lib/build-info.ts
5927
- var CLI_VERSION = "0.1.0-rc.7";
5928
- var CLI_COMMIT = "f71c561d8f423b9c88b79f5568dc1c6f9fbc93e3";
6150
+ var CLI_VERSION = "0.1.0";
6151
+ var CLI_COMMIT = "a3f2219ee96693b1cb80808f401ba5ee660f556b";
5929
6152
 
5930
6153
  // src/commands/version.ts
5931
6154
  function createVersionCommand() {
@@ -5944,7 +6167,7 @@ function createVersionCommand() {
5944
6167
  }
5945
6168
 
5946
6169
  // src/commands/wallet.ts
5947
- import { Command as Command13 } from "commander";
6170
+ import { Command as Command13, Option } from "commander";
5948
6171
 
5949
6172
  // src/lib/wallet-address.ts
5950
6173
  import { scriptToAddress as scriptToAddress2 } from "@fiber-pay/sdk";
@@ -5959,6 +6182,14 @@ async function runWalletAddressCommand(config, options) {
5959
6182
  printJsonSuccess({ address });
5960
6183
  return;
5961
6184
  }
6185
+ if (options.qrcode) {
6186
+ const qrcode = await import("qrcode");
6187
+ console.log("\u2705 Funding address retrieved\n");
6188
+ const qrString = await qrcode.toString(address, { type: "terminal", small: true });
6189
+ console.log(qrString);
6190
+ console.log(` ${truncateMiddle(address, 8, 6)}`);
6191
+ return;
6192
+ }
5962
6193
  console.log("\u2705 Funding address retrieved");
5963
6194
  console.log(` Address: ${address}`);
5964
6195
  }
@@ -5992,7 +6223,7 @@ async function runWalletBalanceCommand(config, options) {
5992
6223
  // src/commands/wallet.ts
5993
6224
  function createWalletCommand(config) {
5994
6225
  const wallet = new Command13("wallet").description("Wallet management");
5995
- wallet.command("address").description("Display the funding address").option("--json").action(async (options) => {
6226
+ wallet.command("address").description("Display the funding address").addOption(new Option("--json", "Output as JSON").conflicts("qrcode")).option("--qrcode", "Display address as QR code in terminal").action(async (options) => {
5996
6227
  await runWalletAddressCommand(config, options);
5997
6228
  });
5998
6229
  wallet.command("balance").description("Display the CKB balance").option("--json").action(async (options) => {
@@ -6138,7 +6369,7 @@ function applyGlobalOverrides(argv) {
6138
6369
  }
6139
6370
  if (!explicitDataDir && profileName) {
6140
6371
  const homeDir = process.env.HOME ?? process.cwd();
6141
- process.env.FIBER_DATA_DIR = join9(homeDir, ".fiber-pay", "profiles", profileName);
6372
+ process.env.FIBER_DATA_DIR = join11(homeDir, ".fiber-pay", "profiles", profileName);
6142
6373
  }
6143
6374
  }
6144
6375
  function printFatal(error) {