@bitsocial/bitsocial-cli 0.19.39 → 0.19.41

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/README.md CHANGED
@@ -304,13 +304,16 @@ $ bitsocial community edit mysub.bso '--roles["author-address.bso"]' null
304
304
  * [`bitsocial community create`](#bitsocial-community-create)
305
305
  * [`bitsocial community delete ADDRESSES`](#bitsocial-community-delete-addresses)
306
306
  * [`bitsocial community edit ADDRESS`](#bitsocial-community-edit-address)
307
- * [`bitsocial community get ADDRESS`](#bitsocial-community-get-address)
307
+ * [`bitsocial community get [ADDRESS]`](#bitsocial-community-get-address)
308
308
  * [`bitsocial community list`](#bitsocial-community-list)
309
309
  * [`bitsocial community start ADDRESSES`](#bitsocial-community-start-addresses)
310
310
  * [`bitsocial community stop ADDRESSES`](#bitsocial-community-stop-addresses)
311
311
  * [`bitsocial daemon`](#bitsocial-daemon)
312
312
  * [`bitsocial help [COMMAND]`](#bitsocial-help-command)
313
313
  * [`bitsocial logs`](#bitsocial-logs)
314
+ * [`bitsocial update check`](#bitsocial-update-check)
315
+ * [`bitsocial update install [VERSION]`](#bitsocial-update-install-version)
316
+ * [`bitsocial update versions`](#bitsocial-update-versions)
314
317
 
315
318
  ## `bitsocial challenge install PACKAGE`
316
319
 
@@ -341,7 +344,7 @@ EXAMPLES
341
344
  $ bitsocial challenge install ./my-local-challenge
342
345
  ```
343
346
 
344
- _See code: [src/cli/commands/challenge/install.ts](https://github.com/bitsocialnet/bitsocial-cli/blob/v0.19.38/src/cli/commands/challenge/install.ts)_
347
+ _See code: [src/cli/commands/challenge/install.ts](https://github.com/bitsocialnet/bitsocial-cli/blob/v0.19.41/src/cli/commands/challenge/install.ts)_
345
348
 
346
349
  ## `bitsocial challenge list`
347
350
 
@@ -364,7 +367,7 @@ EXAMPLES
364
367
  $ bitsocial challenge list -q
365
368
  ```
366
369
 
367
- _See code: [src/cli/commands/challenge/list.ts](https://github.com/bitsocialnet/bitsocial-cli/blob/v0.19.38/src/cli/commands/challenge/list.ts)_
370
+ _See code: [src/cli/commands/challenge/list.ts](https://github.com/bitsocialnet/bitsocial-cli/blob/v0.19.41/src/cli/commands/challenge/list.ts)_
368
371
 
369
372
  ## `bitsocial challenge remove NAME`
370
373
 
@@ -389,7 +392,7 @@ EXAMPLES
389
392
  $ bitsocial challenge remove @scope/my-challenge
390
393
  ```
391
394
 
392
- _See code: [src/cli/commands/challenge/remove.ts](https://github.com/bitsocialnet/bitsocial-cli/blob/v0.19.38/src/cli/commands/challenge/remove.ts)_
395
+ _See code: [src/cli/commands/challenge/remove.ts](https://github.com/bitsocialnet/bitsocial-cli/blob/v0.19.41/src/cli/commands/challenge/remove.ts)_
393
396
 
394
397
  ## `bitsocial community create`
395
398
 
@@ -414,7 +417,7 @@ EXAMPLES
414
417
  $ bitsocial community create --title 'Hello Plebs' --description 'Welcome'
415
418
  ```
416
419
 
417
- _See code: [src/cli/commands/community/create.ts](https://github.com/bitsocialnet/bitsocial-cli/blob/v0.19.38/src/cli/commands/community/create.ts)_
420
+ _See code: [src/cli/commands/community/create.ts](https://github.com/bitsocialnet/bitsocial-cli/blob/v0.19.41/src/cli/commands/community/create.ts)_
418
421
 
419
422
  ## `bitsocial community delete ADDRESSES`
420
423
 
@@ -439,7 +442,7 @@ EXAMPLES
439
442
  $ bitsocial community delete 12D3KooWG3XbzoVyAE6Y9vHZKF64Yuuu4TjdgQKedk14iYmTEPWu
440
443
  ```
441
444
 
442
- _See code: [src/cli/commands/community/delete.ts](https://github.com/bitsocialnet/bitsocial-cli/blob/v0.19.38/src/cli/commands/community/delete.ts)_
445
+ _See code: [src/cli/commands/community/delete.ts](https://github.com/bitsocialnet/bitsocial-cli/blob/v0.19.41/src/cli/commands/community/delete.ts)_
443
446
 
444
447
  ## `bitsocial community edit ADDRESS`
445
448
 
@@ -491,21 +494,23 @@ EXAMPLES
491
494
  $ bitsocial community edit plebbit.bso --settings.fetchThumbnailUrls=false
492
495
  ```
493
496
 
494
- _See code: [src/cli/commands/community/edit.ts](https://github.com/bitsocialnet/bitsocial-cli/blob/v0.19.38/src/cli/commands/community/edit.ts)_
497
+ _See code: [src/cli/commands/community/edit.ts](https://github.com/bitsocialnet/bitsocial-cli/blob/v0.19.41/src/cli/commands/community/edit.ts)_
495
498
 
496
- ## `bitsocial community get ADDRESS`
499
+ ## `bitsocial community get [ADDRESS]`
497
500
 
498
501
  Fetch a local or remote community, and print its json in the terminal
499
502
 
500
503
  ```
501
504
  USAGE
502
- $ bitsocial community get ADDRESS --pkcRpcUrl <value>
505
+ $ bitsocial community get [ADDRESS] --pkcRpcUrl <value> [--name <value>] [--publicKey <value>]
503
506
 
504
507
  ARGUMENTS
505
- ADDRESS Address of the community to fetch
508
+ [ADDRESS] Address of the community to fetch
506
509
 
507
510
  FLAGS
511
+ --name=<value> Name of the community to fetch
508
512
  --pkcRpcUrl=<value> (required) [default: ws://localhost:9138/] URL to PKC RPC
513
+ --publicKey=<value> Public key of the community to fetch
509
514
 
510
515
  DESCRIPTION
511
516
  Fetch a local or remote community, and print its json in the terminal
@@ -514,9 +519,13 @@ EXAMPLES
514
519
  $ bitsocial community get plebmusic.bso
515
520
 
516
521
  $ bitsocial community get 12D3KooWG3XbzoVyAE6Y9vHZKF64Yuuu4TjdgQKedk14iYmTEPWu
522
+
523
+ $ bitsocial community get --name my-community
524
+
525
+ $ bitsocial community get --publicKey 12D3KooWG3XbzoVyAE6Y9vHZKF64Yuuu4TjdgQKedk14iYmTEPWu
517
526
  ```
518
527
 
519
- _See code: [src/cli/commands/community/get.ts](https://github.com/bitsocialnet/bitsocial-cli/blob/v0.19.38/src/cli/commands/community/get.ts)_
528
+ _See code: [src/cli/commands/community/get.ts](https://github.com/bitsocialnet/bitsocial-cli/blob/v0.19.41/src/cli/commands/community/get.ts)_
520
529
 
521
530
  ## `bitsocial community list`
522
531
 
@@ -539,7 +548,7 @@ EXAMPLES
539
548
  $ bitsocial community list
540
549
  ```
541
550
 
542
- _See code: [src/cli/commands/community/list.ts](https://github.com/bitsocialnet/bitsocial-cli/blob/v0.19.38/src/cli/commands/community/list.ts)_
551
+ _See code: [src/cli/commands/community/list.ts](https://github.com/bitsocialnet/bitsocial-cli/blob/v0.19.41/src/cli/commands/community/list.ts)_
543
552
 
544
553
  ## `bitsocial community start ADDRESSES`
545
554
 
@@ -568,7 +577,7 @@ EXAMPLES
568
577
  $ bitsocial community start $(bitsocial community list -q)
569
578
  ```
570
579
 
571
- _See code: [src/cli/commands/community/start.ts](https://github.com/bitsocialnet/bitsocial-cli/blob/v0.19.38/src/cli/commands/community/start.ts)_
580
+ _See code: [src/cli/commands/community/start.ts](https://github.com/bitsocialnet/bitsocial-cli/blob/v0.19.41/src/cli/commands/community/start.ts)_
572
581
 
573
582
  ## `bitsocial community stop ADDRESSES`
574
583
 
@@ -593,7 +602,7 @@ EXAMPLES
593
602
  $ bitsocial community stop Qmb99crTbSUfKXamXwZBe829Vf6w5w5TktPkb6WstC9RFW
594
603
  ```
595
604
 
596
- _See code: [src/cli/commands/community/stop.ts](https://github.com/bitsocialnet/bitsocial-cli/blob/v0.19.38/src/cli/commands/community/stop.ts)_
605
+ _See code: [src/cli/commands/community/stop.ts](https://github.com/bitsocialnet/bitsocial-cli/blob/v0.19.41/src/cli/commands/community/stop.ts)_
597
606
 
598
607
  ## `bitsocial daemon`
599
608
 
@@ -635,7 +644,7 @@ EXAMPLES
635
644
  $ bitsocial daemon --chainProviderUrls viem --chainProviderUrls https://mainnet.infura.io/v3/YOUR_KEY
636
645
  ```
637
646
 
638
- _See code: [src/cli/commands/daemon.ts](https://github.com/bitsocialnet/bitsocial-cli/blob/v0.19.38/src/cli/commands/daemon.ts)_
647
+ _See code: [src/cli/commands/daemon.ts](https://github.com/bitsocialnet/bitsocial-cli/blob/v0.19.41/src/cli/commands/daemon.ts)_
639
648
 
640
649
  ## `bitsocial help [COMMAND]`
641
650
 
@@ -663,15 +672,16 @@ View the latest BitSocial daemon log file. By default dumps the full log and exi
663
672
 
664
673
  ```
665
674
  USAGE
666
- $ bitsocial logs [-f] [-n <value>] [--since <value>] [--until <value>]
675
+ $ bitsocial logs [-f] [-n <value>] [--since <value>] [--until <value>] [--logPath <value>]
667
676
 
668
677
  FLAGS
669
- -f, --follow Follow log output in real-time (like tail -f)
670
- -n, --tail=<value> [default: all] Number of log entries to show from the end. Use "all" to show everything.
671
- --since=<value> Show logs since timestamp (ISO 8601, e.g. 2026-01-02T13:23:37Z) or relative time (e.g. 30s, 42m,
672
- 2h, 1d)
673
- --until=<value> Show logs before timestamp (ISO 8601, e.g. 2026-01-02T13:23:37Z) or relative time (e.g. 30s, 42m,
674
- 2h, 1d)
678
+ -f, --follow Follow log output in real-time (like tail -f)
679
+ -n, --tail=<value> [default: all] Number of log entries to show from the end. Use "all" to show everything.
680
+ --logPath=<value> Specify the directory containing log files
681
+ --since=<value> Show logs since timestamp (ISO 8601, e.g. 2026-01-02T13:23:37Z) or relative time (e.g. 30s,
682
+ 42m, 2h, 1d)
683
+ --until=<value> Show logs before timestamp (ISO 8601, e.g. 2026-01-02T13:23:37Z) or relative time (e.g. 30s,
684
+ 42m, 2h, 1d)
675
685
 
676
686
  DESCRIPTION
677
687
  View the latest BitSocial daemon log file. By default dumps the full log and exits. Use --follow to stream new output
@@ -691,7 +701,75 @@ EXAMPLES
691
701
  $ bitsocial logs --since 1h -f
692
702
  ```
693
703
 
694
- _See code: [src/cli/commands/logs.ts](https://github.com/bitsocialnet/bitsocial-cli/blob/v0.19.38/src/cli/commands/logs.ts)_
704
+ _See code: [src/cli/commands/logs.ts](https://github.com/bitsocialnet/bitsocial-cli/blob/v0.19.41/src/cli/commands/logs.ts)_
705
+
706
+ ## `bitsocial update check`
707
+
708
+ Check if a newer version of bitsocial is available on npm
709
+
710
+ ```
711
+ USAGE
712
+ $ bitsocial update check
713
+
714
+ DESCRIPTION
715
+ Check if a newer version of bitsocial is available on npm
716
+
717
+ EXAMPLES
718
+ $ bitsocial update check
719
+ ```
720
+
721
+ _See code: [src/cli/commands/update/check.ts](https://github.com/bitsocialnet/bitsocial-cli/blob/v0.19.41/src/cli/commands/update/check.ts)_
722
+
723
+ ## `bitsocial update install [VERSION]`
724
+
725
+ Install a specific version of bitsocial from npm
726
+
727
+ ```
728
+ USAGE
729
+ $ bitsocial update install [VERSION] [--force]
730
+
731
+ ARGUMENTS
732
+ [VERSION] [default: latest] Version to install (e.g. "0.19.40" or "latest")
733
+
734
+ FLAGS
735
+ --force Reinstall even if already on the requested version
736
+
737
+ DESCRIPTION
738
+ Install a specific version of bitsocial from npm
739
+
740
+ EXAMPLES
741
+ $ bitsocial update install
742
+
743
+ $ bitsocial update install latest
744
+
745
+ $ bitsocial update install 0.19.40
746
+
747
+ $ bitsocial update install --force
748
+ ```
749
+
750
+ _See code: [src/cli/commands/update/install.ts](https://github.com/bitsocialnet/bitsocial-cli/blob/v0.19.41/src/cli/commands/update/install.ts)_
751
+
752
+ ## `bitsocial update versions`
753
+
754
+ List available bitsocial versions on npm
755
+
756
+ ```
757
+ USAGE
758
+ $ bitsocial update versions [--limit <value>]
759
+
760
+ FLAGS
761
+ --limit=<value> [default: 20] Maximum number of versions to display
762
+
763
+ DESCRIPTION
764
+ List available bitsocial versions on npm
765
+
766
+ EXAMPLES
767
+ $ bitsocial update versions
768
+
769
+ $ bitsocial update versions --limit 5
770
+ ```
771
+
772
+ _See code: [src/cli/commands/update/versions.ts](https://github.com/bitsocialnet/bitsocial-cli/blob/v0.19.41/src/cli/commands/update/versions.ts)_
695
773
  <!-- commandsstop -->
696
774
 
697
775
  ## Contribution
@@ -1,7 +1,7 @@
1
1
  import { Command, Flags } from "@oclif/core";
2
2
  import defaults from "../common-utils/defaults.js";
3
3
  import PKC from "@pkcprotocol/pkc-js";
4
- import { getPKCLogger, setupDebugLogger } from "../util.js";
4
+ import { PKCLogger, setupDebugLogger } from "../util.js";
5
5
  const getPKCConnectOverride = () => {
6
6
  const globalWithOverride = globalThis;
7
7
  return globalWithOverride.__PKC_RPC_CONNECT_OVERRIDE;
@@ -16,8 +16,7 @@ export class BaseCommand extends Command {
16
16
  };
17
17
  async init() {
18
18
  await super.init();
19
- const Logger = await getPKCLogger();
20
- setupDebugLogger(Logger, { enableDefaultNamespace: false });
19
+ setupDebugLogger(PKCLogger, { enableDefaultNamespace: false });
21
20
  }
22
21
  async _connectToPkcRpc(pkcRpcUrl) {
23
22
  const connectOverride = getPKCConnectOverride();
@@ -28,7 +27,6 @@ export class BaseCommand extends Command {
28
27
  const errors = [];
29
28
  pkc.on("error", (err) => {
30
29
  errors.push(err);
31
- console.error("Error from pkc instance", err);
32
30
  });
33
31
  await new Promise((resolve, reject) => {
34
32
  const timeout = setTimeout(() => {
@@ -39,6 +37,11 @@ export class BaseCommand extends Command {
39
37
  clearTimeout(timeout);
40
38
  resolve();
41
39
  });
40
+ }).catch((err) => {
41
+ if (err && typeof err === "object" && "code" in err && err.code === "ERR_RPC_AUTH_REQUIRED") {
42
+ throw err;
43
+ }
44
+ throw new Error(`Could not connect to the daemon at ${pkcRpcUrl}. Is it running? Start it with: bitsocial daemon`);
42
45
  });
43
46
  return pkc;
44
47
  }
@@ -3,7 +3,7 @@ import { Flags } from "@oclif/core";
3
3
  import DataObjectParser from "dataobject-parser";
4
4
  import fs from "fs";
5
5
  import { BaseCommand } from "../../base-command.js";
6
- import { getPKCLogger } from "../../../util.js";
6
+ import { PKCLogger } from "../../../util.js";
7
7
  import * as remeda from "remeda";
8
8
  export default class Create extends BaseCommand {
9
9
  static description = "Create a community with specific properties. A newly created community will be started after creation and be able to receive publications. For a list of properties, visit https://github.com/pkcprotocol/pkc-js";
@@ -21,7 +21,7 @@ export default class Create extends BaseCommand {
21
21
  };
22
22
  async run() {
23
23
  const { flags } = await this.parse(Create);
24
- const log = (await getPKCLogger())("bitsocial-cli:commands:community:create");
24
+ const log = PKCLogger("bitsocial-cli:commands:community:create");
25
25
  log(`flags: `, flags);
26
26
  const pkc = await this._connectToPkcRpc(flags.pkcRpcUrl.toString());
27
27
  const createOptions = DataObjectParser.transpose(remeda.omit(flags, ["pkcRpcUrl", "privateKeyPath"]))["_data"];
@@ -1,4 +1,4 @@
1
- import { getPKCLogger } from "../../../util.js";
1
+ import { PKCLogger } from "../../../util.js";
2
2
  import { BaseCommand } from "../../base-command.js";
3
3
  import { Args } from "@oclif/core";
4
4
  export default class Delete extends BaseCommand {
@@ -17,7 +17,7 @@ export default class Delete extends BaseCommand {
17
17
  ];
18
18
  async run() {
19
19
  const { argv, flags } = await this.parse(Delete);
20
- const log = (await getPKCLogger())("bitsocial-cli:commands:community:delete");
20
+ const log = PKCLogger("bitsocial-cli:commands:community:delete");
21
21
  log(`addresses: `, argv);
22
22
  log(`flags: `, flags);
23
23
  const addresses = argv;
@@ -2,7 +2,7 @@
2
2
  import DataObjectParser from "dataobject-parser";
3
3
  import { Args } from "@oclif/core";
4
4
  import { BaseCommand } from "../../base-command.js";
5
- import { getPKCLogger, mergeDeep } from "../../../util.js";
5
+ import { PKCLogger, mergeDeep } from "../../../util.js";
6
6
  import * as remeda from "remeda";
7
7
  export default class Edit extends BaseCommand {
8
8
  static description = "Edit a community's properties. For a list of properties, visit https://github.com/pkcprotocol/pkc-js";
@@ -45,7 +45,7 @@ export default class Edit extends BaseCommand {
45
45
  ];
46
46
  async run() {
47
47
  const { flags, args } = await this.parse(Edit);
48
- const log = (await getPKCLogger())("bitsocial-cli:commands:community:edit");
48
+ const log = PKCLogger("bitsocial-cli:commands:community:edit");
49
49
  log(`flags: `, flags);
50
50
  const pkc = await this._connectToPkcRpc(flags.pkcRpcUrl.toString());
51
51
  const editOptions = DataObjectParser.transpose(remeda.omit(flags, ["pkcRpcUrl"]))["_data"];
@@ -3,7 +3,11 @@ export default class Get extends BaseCommand {
3
3
  static description: string;
4
4
  static examples: string[];
5
5
  static args: {
6
- address: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
6
+ address: import("@oclif/core/interfaces").Arg<string | undefined, Record<string, unknown>>;
7
+ };
8
+ static flags: {
9
+ name: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
10
+ publicKey: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
7
11
  };
8
12
  run(): Promise<void>;
9
13
  }
@@ -1,24 +1,44 @@
1
- import { Args } from "@oclif/core";
1
+ import { Args, Flags } from "@oclif/core";
2
2
  import { BaseCommand } from "../../base-command.js";
3
3
  import * as remeda from "remeda";
4
4
  export default class Get extends BaseCommand {
5
5
  static description = "Fetch a local or remote community, and print its json in the terminal";
6
6
  static examples = [
7
7
  "bitsocial community get plebmusic.bso",
8
- "bitsocial community get 12D3KooWG3XbzoVyAE6Y9vHZKF64Yuuu4TjdgQKedk14iYmTEPWu"
8
+ "bitsocial community get 12D3KooWG3XbzoVyAE6Y9vHZKF64Yuuu4TjdgQKedk14iYmTEPWu",
9
+ "bitsocial community get --name my-community",
10
+ "bitsocial community get --publicKey 12D3KooWG3XbzoVyAE6Y9vHZKF64Yuuu4TjdgQKedk14iYmTEPWu"
9
11
  ];
10
12
  static args = {
11
13
  address: Args.string({
12
14
  name: "address",
13
- required: true,
15
+ required: false,
14
16
  description: "Address of the community to fetch"
15
17
  })
16
18
  };
19
+ static flags = {
20
+ name: Flags.string({
21
+ description: "Name of the community to fetch"
22
+ }),
23
+ publicKey: Flags.string({
24
+ description: "Public key of the community to fetch"
25
+ })
26
+ };
17
27
  async run() {
18
28
  const { args, flags } = await this.parse(Get);
29
+ const lookupParam = {};
30
+ if (args.address)
31
+ lookupParam.address = args.address;
32
+ if (flags.name)
33
+ lookupParam.name = flags.name;
34
+ if (flags.publicKey)
35
+ lookupParam.publicKey = flags.publicKey;
36
+ if (Object.keys(lookupParam).length === 0) {
37
+ this.error("At least one of address argument, --name, or --publicKey must be provided");
38
+ }
19
39
  const pkc = await this._connectToPkcRpc(flags.pkcRpcUrl.toString());
20
40
  try {
21
- const community = await pkc.getCommunity({ address: args.address });
41
+ const community = await pkc.getCommunity(lookupParam);
22
42
  const communityJson = JSON.parse(JSON.stringify(community));
23
43
  this.logJson({ posts: communityJson.posts, ...remeda.omit(communityJson, ["posts"]) }); // make sure posts is printed first, because most users won't look at it
24
44
  }
@@ -1,7 +1,7 @@
1
1
  import { Flags } from "@oclif/core";
2
2
  import { BaseCommand } from "../../base-command.js";
3
3
  import { EOL } from "os";
4
- import { getPKCLogger } from "../../../util.js";
4
+ import { PKCLogger } from "../../../util.js";
5
5
  import { printTable } from "@oclif/table";
6
6
  export default class List extends BaseCommand {
7
7
  static description = "List your communities";
@@ -11,7 +11,7 @@ export default class List extends BaseCommand {
11
11
  };
12
12
  async run() {
13
13
  const { flags } = await this.parse(List);
14
- const log = (await getPKCLogger())("bitsocial-cli:commands:community:list");
14
+ const log = PKCLogger("bitsocial-cli:commands:community:list");
15
15
  log(`flags: `, flags);
16
16
  const pkc = await this._connectToPkcRpc(flags.pkcRpcUrl.toString());
17
17
  const communities = pkc.communities;
@@ -1,4 +1,4 @@
1
- import { getPKCLogger } from "../../../util.js";
1
+ import { PKCLogger } from "../../../util.js";
2
2
  import { BaseCommand } from "../../base-command.js";
3
3
  import { Args } from "@oclif/core";
4
4
  export default class Start extends BaseCommand {
@@ -22,7 +22,7 @@ export default class Start extends BaseCommand {
22
22
  async run() {
23
23
  const { argv, flags } = await this.parse(Start);
24
24
  const addresses = argv;
25
- const log = (await getPKCLogger())("bitsocial-cli:commands:community:start");
25
+ const log = PKCLogger("bitsocial-cli:commands:community:start");
26
26
  log(`addresses: `, addresses);
27
27
  log(`flags: `, flags);
28
28
  const pkc = await this._connectToPkcRpc(flags.pkcRpcUrl.toString());
@@ -1,4 +1,4 @@
1
- import { getPKCLogger } from "../../../util.js";
1
+ import { PKCLogger } from "../../../util.js";
2
2
  import { BaseCommand } from "../../base-command.js";
3
3
  import { Args } from "@oclif/core";
4
4
  export default class Stop extends BaseCommand {
@@ -17,7 +17,7 @@ export default class Stop extends BaseCommand {
17
17
  ];
18
18
  async run() {
19
19
  const { argv, flags } = await this.parse(Stop);
20
- const log = (await getPKCLogger())("bitsocial-cli:commands:community:stop");
20
+ const log = PKCLogger("bitsocial-cli:commands:community:stop");
21
21
  log(`addresses: `, argv);
22
22
  log(`flags: `, flags);
23
23
  const addresses = argv;
@@ -3,7 +3,7 @@ import defaults from "../../common-utils/defaults.js";
3
3
  import { startKuboNode } from "../../ipfs/startIpfs.js";
4
4
  import path from "path";
5
5
  import tcpPortUsed from "tcp-port-used";
6
- import { getLanIpV4Address, getPKCLogger, setupDebugLogger, loadKuboConfigFile, parseMultiAddrKuboRpcToUrl, parseMultiAddrIpfsGatewayToUrl } from "../../util.js";
6
+ import { getLanIpV4Address, PKCLogger, setupDebugLogger, loadKuboConfigFile, parseMultiAddrKuboRpcToUrl, parseMultiAddrIpfsGatewayToUrl } from "../../util.js";
7
7
  import { startDaemonServer } from "../../webui/daemon-server.js";
8
8
  import { loadChallengesIntoPKC } from "../../challenge-packages/challenge-utils.js";
9
9
  import { migrateDataDirectory } from "../../common-utils/data-migration.js";
@@ -161,10 +161,9 @@ export default class Daemon extends Command {
161
161
  process.env["DEBUG_COLORS"] = "1";
162
162
  process.env["DEBUG_HIDE_DATE"] = "1";
163
163
  const { flags } = await this.parse(Daemon);
164
- const Logger = await getPKCLogger();
165
- this._setupLogger(Logger);
166
- const { logFilePath, stdoutWrite } = await this._pipeDebugLogsToLogFile(flags.logPath, Logger);
167
- const log = Logger("bitsocial-cli:daemon");
164
+ this._setupLogger(PKCLogger);
165
+ const { logFilePath, stdoutWrite } = await this._pipeDebugLogsToLogFile(flags.logPath, PKCLogger);
166
+ const log = PKCLogger("bitsocial-cli:daemon");
168
167
  try {
169
168
  // Log debug info after pipe is set up so it goes to the log file, not terminal
170
169
  const envDebug = process.env["_PKC_DEBUG"] || process.env["DEBUG"];
@@ -5,7 +5,7 @@ import * as fsPromises from "fs/promises";
5
5
  import assert from "assert";
6
6
  import tcpPortUsed from "tcp-port-used";
7
7
  import { path as ipfsExePathFunc } from "kubo";
8
- import { getPKCLogger } from "../util.js";
8
+ import { PKCLogger } from "../util.js";
9
9
  async function getKuboExePath() {
10
10
  return ipfsExePathFunc();
11
11
  }
@@ -189,7 +189,7 @@ async function ensureIpfsPortsAreAvailable(log, configPath, apiUrl, gatewayUrl)
189
189
  }
190
190
  export async function startKuboNode(apiUrl, gatewayUrl, dataPath, onSpawn) {
191
191
  return new Promise(async (resolve, reject) => {
192
- const log = (await getPKCLogger())("bitsocial-cli:ipfs:startKuboNode");
192
+ const log = PKCLogger("bitsocial-cli:ipfs:startKuboNode");
193
193
  const ipfsDataPath = process.env["IPFS_PATH"] || path.join(dataPath, ".bitsocial-cli.ipfs");
194
194
  await fs.promises.mkdir(ipfsDataPath, { recursive: true });
195
195
  const ipfsConfigPath = path.join(ipfsDataPath, "config");
package/dist/util.d.ts CHANGED
@@ -1,11 +1,12 @@
1
- export type PKCLogger = Awaited<ReturnType<typeof getPKCLogger>> & {
1
+ import PKCLogger from "@pkcprotocol/pkc-logger";
2
+ export { PKCLogger };
3
+ export type PKCLoggerType = typeof PKCLogger & {
2
4
  inspectOpts?: {
3
5
  depth?: number;
4
6
  colors?: boolean;
5
7
  [key: string]: any;
6
8
  };
7
9
  };
8
- export declare function getPKCLogger(): Promise<typeof import("@pkcprotocol/pkc-logger").default>;
9
10
  /**
10
11
  * Read _PKC_DEBUG / DEBUG env vars and configure the Logger instance.
11
12
  * Does NOT redirect output — debug logs go to stderr (the default for the debug module).
@@ -14,7 +15,7 @@ export declare function getPKCLogger(): Promise<typeof import("@pkcprotocol/pkc-
14
15
  * when no DEBUG env is set (used by daemon). If false, only enable if user
15
16
  * explicitly set DEBUG or _PKC_DEBUG (used by non-daemon commands).
16
17
  */
17
- export declare function setupDebugLogger(Logger: PKCLogger, options?: {
18
+ export declare function setupDebugLogger(Logger: PKCLoggerType, options?: {
18
19
  enableDefaultNamespace?: boolean;
19
20
  }): {
20
21
  debugNamespace: string | undefined;
package/dist/util.js CHANGED
@@ -2,10 +2,8 @@ import os from "os";
2
2
  import path from "path";
3
3
  import fs from "fs";
4
4
  import * as fsPromises from "fs/promises";
5
- export async function getPKCLogger() {
6
- const Logger = await import("@pkcprotocol/pkc-logger");
7
- return Logger.default;
8
- }
5
+ import PKCLogger from "@pkcprotocol/pkc-logger";
6
+ export { PKCLogger };
9
7
  /**
10
8
  * Read _PKC_DEBUG / DEBUG env vars and configure the Logger instance.
11
9
  * Does NOT redirect output — debug logs go to stderr (the default for the debug module).
@@ -3,7 +3,7 @@ import { fileURLToPath } from "url";
3
3
  const __filename = fileURLToPath(import.meta.url);
4
4
  const __dirname = path.dirname(__filename);
5
5
  import fs from "fs/promises";
6
- import { getPKCLogger } from "../util.js";
6
+ import { PKCLogger } from "../util.js";
7
7
  import { randomBytes } from "crypto";
8
8
  import express from "express";
9
9
  import { loadChallengesIntoPKC } from "../challenge-packages/challenge-utils.js";
@@ -40,7 +40,7 @@ async function _generateRpcAuthKeyIfNotExisting(pkcDataPath) {
40
40
  // The daemon server will host both RPC and webui on the same port
41
41
  export async function startDaemonServer(rpcUrl, ipfsGatewayUrl, pkcOptions) {
42
42
  // Start pkc-js RPC
43
- const log = (await getPKCLogger())("bitsocial-cli:daemon:startDaemonServer");
43
+ const log = PKCLogger("bitsocial-cli:daemon:startDaemonServer");
44
44
  const webuiExpressApp = express();
45
45
  const httpServer = webuiExpressApp.listen(Number(rpcUrl.port));
46
46
  log("HTTP server is running on", "0.0.0.0" + ":" + rpcUrl.port);