@bitsocial/bitsocial-cli 0.19.43 → 0.19.44

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
@@ -344,7 +344,7 @@ EXAMPLES
344
344
  $ bitsocial challenge install ./my-local-challenge
345
345
  ```
346
346
 
347
- _See code: [src/cli/commands/challenge/install.ts](https://github.com/bitsocialnet/bitsocial-cli/blob/v0.19.43/src/cli/commands/challenge/install.ts)_
347
+ _See code: [src/cli/commands/challenge/install.ts](https://github.com/bitsocialnet/bitsocial-cli/blob/v0.19.44/src/cli/commands/challenge/install.ts)_
348
348
 
349
349
  ## `bitsocial challenge list`
350
350
 
@@ -367,7 +367,7 @@ EXAMPLES
367
367
  $ bitsocial challenge list -q
368
368
  ```
369
369
 
370
- _See code: [src/cli/commands/challenge/list.ts](https://github.com/bitsocialnet/bitsocial-cli/blob/v0.19.43/src/cli/commands/challenge/list.ts)_
370
+ _See code: [src/cli/commands/challenge/list.ts](https://github.com/bitsocialnet/bitsocial-cli/blob/v0.19.44/src/cli/commands/challenge/list.ts)_
371
371
 
372
372
  ## `bitsocial challenge remove NAME`
373
373
 
@@ -392,7 +392,7 @@ EXAMPLES
392
392
  $ bitsocial challenge remove @scope/my-challenge
393
393
  ```
394
394
 
395
- _See code: [src/cli/commands/challenge/remove.ts](https://github.com/bitsocialnet/bitsocial-cli/blob/v0.19.43/src/cli/commands/challenge/remove.ts)_
395
+ _See code: [src/cli/commands/challenge/remove.ts](https://github.com/bitsocialnet/bitsocial-cli/blob/v0.19.44/src/cli/commands/challenge/remove.ts)_
396
396
 
397
397
  ## `bitsocial community create`
398
398
 
@@ -417,7 +417,7 @@ EXAMPLES
417
417
  $ bitsocial community create --title 'Hello Plebs' --description 'Welcome'
418
418
  ```
419
419
 
420
- _See code: [src/cli/commands/community/create.ts](https://github.com/bitsocialnet/bitsocial-cli/blob/v0.19.43/src/cli/commands/community/create.ts)_
420
+ _See code: [src/cli/commands/community/create.ts](https://github.com/bitsocialnet/bitsocial-cli/blob/v0.19.44/src/cli/commands/community/create.ts)_
421
421
 
422
422
  ## `bitsocial community delete ADDRESSES`
423
423
 
@@ -442,7 +442,7 @@ EXAMPLES
442
442
  $ bitsocial community delete 12D3KooWG3XbzoVyAE6Y9vHZKF64Yuuu4TjdgQKedk14iYmTEPWu
443
443
  ```
444
444
 
445
- _See code: [src/cli/commands/community/delete.ts](https://github.com/bitsocialnet/bitsocial-cli/blob/v0.19.43/src/cli/commands/community/delete.ts)_
445
+ _See code: [src/cli/commands/community/delete.ts](https://github.com/bitsocialnet/bitsocial-cli/blob/v0.19.44/src/cli/commands/community/delete.ts)_
446
446
 
447
447
  ## `bitsocial community edit ADDRESS`
448
448
 
@@ -494,7 +494,7 @@ EXAMPLES
494
494
  $ bitsocial community edit plebbit.bso --settings.fetchThumbnailUrls=false
495
495
  ```
496
496
 
497
- _See code: [src/cli/commands/community/edit.ts](https://github.com/bitsocialnet/bitsocial-cli/blob/v0.19.43/src/cli/commands/community/edit.ts)_
497
+ _See code: [src/cli/commands/community/edit.ts](https://github.com/bitsocialnet/bitsocial-cli/blob/v0.19.44/src/cli/commands/community/edit.ts)_
498
498
 
499
499
  ## `bitsocial community get [ADDRESS]`
500
500
 
@@ -525,7 +525,7 @@ EXAMPLES
525
525
  $ bitsocial community get --publicKey 12D3KooWG3XbzoVyAE6Y9vHZKF64Yuuu4TjdgQKedk14iYmTEPWu
526
526
  ```
527
527
 
528
- _See code: [src/cli/commands/community/get.ts](https://github.com/bitsocialnet/bitsocial-cli/blob/v0.19.43/src/cli/commands/community/get.ts)_
528
+ _See code: [src/cli/commands/community/get.ts](https://github.com/bitsocialnet/bitsocial-cli/blob/v0.19.44/src/cli/commands/community/get.ts)_
529
529
 
530
530
  ## `bitsocial community list`
531
531
 
@@ -548,7 +548,7 @@ EXAMPLES
548
548
  $ bitsocial community list
549
549
  ```
550
550
 
551
- _See code: [src/cli/commands/community/list.ts](https://github.com/bitsocialnet/bitsocial-cli/blob/v0.19.43/src/cli/commands/community/list.ts)_
551
+ _See code: [src/cli/commands/community/list.ts](https://github.com/bitsocialnet/bitsocial-cli/blob/v0.19.44/src/cli/commands/community/list.ts)_
552
552
 
553
553
  ## `bitsocial community start ADDRESSES`
554
554
 
@@ -577,7 +577,7 @@ EXAMPLES
577
577
  $ bitsocial community start $(bitsocial community list -q)
578
578
  ```
579
579
 
580
- _See code: [src/cli/commands/community/start.ts](https://github.com/bitsocialnet/bitsocial-cli/blob/v0.19.43/src/cli/commands/community/start.ts)_
580
+ _See code: [src/cli/commands/community/start.ts](https://github.com/bitsocialnet/bitsocial-cli/blob/v0.19.44/src/cli/commands/community/start.ts)_
581
581
 
582
582
  ## `bitsocial community stop ADDRESSES`
583
583
 
@@ -602,7 +602,7 @@ EXAMPLES
602
602
  $ bitsocial community stop Qmb99crTbSUfKXamXwZBe829Vf6w5w5TktPkb6WstC9RFW
603
603
  ```
604
604
 
605
- _See code: [src/cli/commands/community/stop.ts](https://github.com/bitsocialnet/bitsocial-cli/blob/v0.19.43/src/cli/commands/community/stop.ts)_
605
+ _See code: [src/cli/commands/community/stop.ts](https://github.com/bitsocialnet/bitsocial-cli/blob/v0.19.44/src/cli/commands/community/stop.ts)_
606
606
 
607
607
  ## `bitsocial daemon`
608
608
 
@@ -643,7 +643,7 @@ EXAMPLES
643
643
  $ bitsocial daemon --chainProviderUrls https://mainnet.infura.io/v3/YOUR_KEY
644
644
  ```
645
645
 
646
- _See code: [src/cli/commands/daemon.ts](https://github.com/bitsocialnet/bitsocial-cli/blob/v0.19.43/src/cli/commands/daemon.ts)_
646
+ _See code: [src/cli/commands/daemon.ts](https://github.com/bitsocialnet/bitsocial-cli/blob/v0.19.44/src/cli/commands/daemon.ts)_
647
647
 
648
648
  ## `bitsocial help [COMMAND]`
649
649
 
@@ -700,7 +700,7 @@ EXAMPLES
700
700
  $ bitsocial logs --since 1h -f
701
701
  ```
702
702
 
703
- _See code: [src/cli/commands/logs.ts](https://github.com/bitsocialnet/bitsocial-cli/blob/v0.19.43/src/cli/commands/logs.ts)_
703
+ _See code: [src/cli/commands/logs.ts](https://github.com/bitsocialnet/bitsocial-cli/blob/v0.19.44/src/cli/commands/logs.ts)_
704
704
 
705
705
  ## `bitsocial update check`
706
706
 
@@ -717,7 +717,7 @@ EXAMPLES
717
717
  $ bitsocial update check
718
718
  ```
719
719
 
720
- _See code: [src/cli/commands/update/check.ts](https://github.com/bitsocialnet/bitsocial-cli/blob/v0.19.43/src/cli/commands/update/check.ts)_
720
+ _See code: [src/cli/commands/update/check.ts](https://github.com/bitsocialnet/bitsocial-cli/blob/v0.19.44/src/cli/commands/update/check.ts)_
721
721
 
722
722
  ## `bitsocial update install [VERSION]`
723
723
 
@@ -749,7 +749,7 @@ EXAMPLES
749
749
  $ bitsocial update install --no-restart-daemons
750
750
  ```
751
751
 
752
- _See code: [src/cli/commands/update/install.ts](https://github.com/bitsocialnet/bitsocial-cli/blob/v0.19.43/src/cli/commands/update/install.ts)_
752
+ _See code: [src/cli/commands/update/install.ts](https://github.com/bitsocialnet/bitsocial-cli/blob/v0.19.44/src/cli/commands/update/install.ts)_
753
753
 
754
754
  ## `bitsocial update versions`
755
755
 
@@ -771,7 +771,7 @@ EXAMPLES
771
771
  $ bitsocial update versions --limit 5
772
772
  ```
773
773
 
774
- _See code: [src/cli/commands/update/versions.ts](https://github.com/bitsocialnet/bitsocial-cli/blob/v0.19.43/src/cli/commands/update/versions.ts)_
774
+ _See code: [src/cli/commands/update/versions.ts](https://github.com/bitsocialnet/bitsocial-cli/blob/v0.19.44/src/cli/commands/update/versions.ts)_
775
775
  <!-- commandsstop -->
776
776
 
777
777
  ## Contribution
@@ -0,0 +1,129 @@
1
+ import { createHash } from "node:crypto";
2
+ import { createWriteStream } from "node:fs";
3
+ import fs from "node:fs/promises";
4
+ import os from "node:os";
5
+ import path from "node:path";
6
+ import { Readable } from "node:stream";
7
+ import { finished as streamFinished } from "node:stream/promises";
8
+ import { fileURLToPath } from "node:url";
9
+
10
+ const __filename = fileURLToPath(import.meta.url);
11
+ const __dirname = path.dirname(__filename);
12
+ const packageRoot = path.join(__dirname, "..");
13
+
14
+ const dryRun = process.argv.includes("--dry-run");
15
+
16
+ async function main() {
17
+ const pkgPath = path.join(packageRoot, "package.json");
18
+ const pkg = JSON.parse(await fs.readFile(pkgPath, "utf-8"));
19
+ const webuis = pkg.webuis;
20
+ if (!webuis || webuis.length === 0) {
21
+ console.log("No webuis configured in package.json");
22
+ return;
23
+ }
24
+
25
+ const githubToken = process.env["GITHUB_TOKEN"];
26
+ if (githubToken) console.log("Using GITHUB_TOKEN for API requests");
27
+ const headers = githubToken ? { authorization: `Bearer ${githubToken}` } : undefined;
28
+
29
+ let updatedCount = 0;
30
+
31
+ for (const entry of webuis) {
32
+ const { url, sha256OfHtmlZip } = entry;
33
+
34
+ // Parse "https://github.com/{owner}/{repo}/releases/tag/{tag}"
35
+ const match = url.match(/github\.com\/([^/]+\/[^/]+)\/releases\/tag\/(.+)$/);
36
+ if (!match) {
37
+ console.warn(`Warning: Could not parse GitHub release URL: ${url}. Skipping.`);
38
+ continue;
39
+ }
40
+ const [, ownerRepo, currentTag] = match;
41
+ const repoName = ownerRepo.split("/")[1];
42
+
43
+ // Fetch latest release
44
+ const latestRes = await fetch(`https://api.github.com/repos/${ownerRepo}/releases/latest`, { headers });
45
+ if (!latestRes.ok) {
46
+ if (latestRes.status === 403) {
47
+ console.warn(`Warning: GitHub API rate limited for ${ownerRepo}. Set GITHUB_TOKEN to avoid this. Skipping.`);
48
+ } else {
49
+ console.warn(`Warning: Failed to fetch latest release for ${ownerRepo}, status ${latestRes.status}. Skipping.`);
50
+ }
51
+ continue;
52
+ }
53
+
54
+ const latest = await latestRes.json();
55
+ const latestTag = latest.tag_name;
56
+
57
+ if (latestTag === currentTag) {
58
+ console.log(`${repoName}: ${currentTag} (already latest)`);
59
+ continue;
60
+ }
61
+
62
+ // Find html zip asset
63
+ const htmlZipAsset = latest.assets.find((asset) => asset.name.includes("html"));
64
+ if (!htmlZipAsset) {
65
+ console.warn(`Warning: No HTML zip asset found in ${ownerRepo}@${latestTag}. Skipping.`);
66
+ continue;
67
+ }
68
+
69
+ if (dryRun) {
70
+ console.log(`${repoName}: ${currentTag} -> ${latestTag} (would update)`);
71
+ updatedCount++;
72
+ continue;
73
+ }
74
+
75
+ // Download zip to temp dir
76
+ const tmpPath = path.join(os.tmpdir(), htmlZipAsset.name);
77
+ const downloadRes = await fetch(htmlZipAsset["browser_download_url"], { headers });
78
+ if (!downloadRes.ok || !downloadRes.body) {
79
+ console.warn(`Warning: Failed to download ${htmlZipAsset.name}, status ${downloadRes.status}. Skipping.`);
80
+ continue;
81
+ }
82
+
83
+ const writer = createWriteStream(tmpPath);
84
+ await streamFinished(Readable.fromWeb(downloadRes.body).pipe(writer));
85
+ writer.close();
86
+
87
+ // Compute SHA256
88
+ const fileBuffer = await fs.readFile(tmpPath);
89
+ const newHash = createHash("sha256").update(fileBuffer).digest("hex");
90
+
91
+ // Clean up temp file
92
+ await fs.rm(tmpPath);
93
+
94
+ // Update entry
95
+ entry.url = `https://github.com/${ownerRepo}/releases/tag/${latestTag}`;
96
+ entry.sha256OfHtmlZip = newHash;
97
+ updatedCount++;
98
+ console.log(`${repoName}: ${currentTag} -> ${latestTag} (updated)`);
99
+ }
100
+
101
+ if (updatedCount === 0) {
102
+ console.log("\nAll web UIs are already at their latest versions.");
103
+ return;
104
+ }
105
+
106
+ if (dryRun) {
107
+ console.log(`\n${updatedCount} web UI(s) would be updated (dry run, no changes made).`);
108
+ return;
109
+ }
110
+
111
+ // Write updated package.json
112
+ pkg.webuis = webuis;
113
+ await fs.writeFile(pkgPath, JSON.stringify(pkg, null, 4) + "\n");
114
+ console.log(`\nUpdated ${updatedCount} web UI(s) in package.json.`);
115
+
116
+ // Remove dist/webuis/ so postinstall re-downloads
117
+ const distWebuis = path.join(packageRoot, "dist", "webuis");
118
+ try {
119
+ await fs.rm(distWebuis, { recursive: true });
120
+ console.log("Removed dist/webuis/ — run 'npm run ci:download-web-uis' to re-download.");
121
+ } catch (e) {
122
+ if (e.code !== "ENOENT") throw e;
123
+ }
124
+ }
125
+
126
+ main().catch((err) => {
127
+ console.error(err);
128
+ process.exit(1);
129
+ });
@@ -208,9 +208,11 @@ export async function runNpmInstall(challengeDir) {
208
208
  const originalContent = await fs.readFile(pkgJsonPath, "utf-8");
209
209
  const pkg = JSON.parse(originalContent);
210
210
  const hadDevDeps = pkg.devDependencies !== undefined;
211
- if (hadDevDeps) {
211
+ const hadScripts = pkg.scripts !== undefined;
212
+ if (hadDevDeps || hadScripts) {
212
213
  const stripped = { ...pkg };
213
214
  delete stripped.devDependencies;
215
+ delete stripped.scripts;
214
216
  await fs.writeFile(pkgJsonPath, JSON.stringify(stripped, null, 2) + "\n");
215
217
  }
216
218
  try {
@@ -243,7 +245,7 @@ export async function runNpmInstall(challengeDir) {
243
245
  });
244
246
  }
245
247
  finally {
246
- if (hadDevDeps) {
248
+ if (hadDevDeps || hadScripts) {
247
249
  await fs.writeFile(pkgJsonPath, originalContent);
248
250
  }
249
251
  }
@@ -223,7 +223,6 @@ export default class Daemon extends Command {
223
223
  // Create BSO name resolvers for .bso/.eth domain resolution
224
224
  const bsoResolvers = createBsoResolvers(flags.chainProviderUrls, mergedPkcOptions.dataPath);
225
225
  mergedPkcOptions.nameResolvers = [...(mergedPkcOptions.nameResolvers || []), ...bsoResolvers];
226
- console.log(".bso name resolvers:", bsoResolvers.map((r) => r.provider).join(", "));
227
226
  let mainProcessExited = false;
228
227
  let pendingKuboStart;
229
228
  // Kubo Node may fail randomly, we need to set a listener so when it exits because of an error we restart it
@@ -713,5 +713,5 @@
713
713
  ]
714
714
  }
715
715
  },
716
- "version": "0.19.43"
716
+ "version": "0.19.44"
717
717
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bitsocial/bitsocial-cli",
3
- "version": "0.19.43",
3
+ "version": "0.19.44",
4
4
  "description": "Command line interface to Bitsocial API",
5
5
  "types": "./dist/index.d.ts",
6
6
  "homepage": "https://github.com/bitsocialnet/bitsocial-cli",
@@ -25,7 +25,8 @@
25
25
  "postinstall": "node bin/postinstall.js",
26
26
  "generate:readme": "oclif readme && sed -i 's@/src/commands/@/src/cli/commands/@g' README.md && sed -i 's@src/commands@src/cli/commands@g' README.md",
27
27
  "ci:download-web-uis": "node bin/postinstall.js",
28
- "ci:daemon:test-before-release": "node --loader ts-node/esm ci-bin/run-daemon-before-release.ts"
28
+ "ci:daemon:test-before-release": "node --loader ts-node/esm ci-bin/run-daemon-before-release.ts",
29
+ "update-webuis": "node bin/update-webuis.js"
29
30
  },
30
31
  "files": [
31
32
  "/bin",
@@ -93,7 +94,7 @@
93
94
  "@types/node": "22.19.13",
94
95
  "@types/prettier": "2.7.1",
95
96
  "@types/tcp-port-used": "1.0.4",
96
- "@types/ws": "^8.18.1",
97
+ "@types/ws": "8.18.1",
97
98
  "commitizen": "4.2.5",
98
99
  "cz-conventional-changelog": "3.3.0",
99
100
  "eslint": "8.27.0",
@@ -111,7 +112,7 @@
111
112
  "wait-on": "6.0.1"
112
113
  },
113
114
  "dependencies": {
114
- "@bitsocial/bso-resolver": "0.0.5",
115
+ "@bitsocial/bso-resolver": "0.0.6",
115
116
  "@multiformats/multiaddr": "13.0.1",
116
117
  "@oclif/core": "4.8.0",
117
118
  "@oclif/plugin-help": "6.2.36",
@@ -139,8 +140,8 @@
139
140
  "sha256OfHtmlZip": "14653b19e88868fda6fef26601f477947e44251cc52bd95d7d6fec158ae67b6f"
140
141
  },
141
142
  {
142
- "url": "https://github.com/bitsocialnet/5chan/releases/tag/v0.6.4",
143
- "sha256OfHtmlZip": "b47685f868c868c6afe96e865897876fabac2ddf121a00d194cee36fdff9d348"
143
+ "url": "https://github.com/bitsocialnet/5chan/releases/tag/v0.7.4",
144
+ "sha256OfHtmlZip": "c768bd40a6f9e6c3889d2e57df843e667594974c6f3048357e2b6148aeec3385"
144
145
  }
145
146
  ]
146
147
  }