@foundingbot/x 0.0.0 → 0.0.46-preview.20261014.1

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 ADDED
@@ -0,0 +1,3 @@
1
+ # Server
2
+
3
+ Node.js WebSocket server for the Founding Bot X app.
@@ -0,0 +1,33 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ const { spawnSync } = require("node:child_process");
4
+ const { constants } = require("node:os");
5
+ const { dirname, join } = require("node:path");
6
+
7
+ const SUPPORTED = ["darwin-arm64", "linux-arm64", "linux-x64", "win32-arm64", "win32-x64"];
8
+ const key = process.platform + "-" + process.arch;
9
+
10
+ let packageDir;
11
+ try {
12
+ packageDir = dirname(require.resolve("@foundingbot/x-" + key + "/package.json"));
13
+ } catch {
14
+ process.stderr.write(
15
+ [
16
+ "foundingbot-x: no Founding Bot X CLI build is available for this platform (" + key + ").",
17
+ "Supported platforms: " + SUPPORTED.join(", ") + ".",
18
+ "If yours is listed, reinstall @foundingbot/x so npm fetches its optional dependency.",
19
+ "The desktop app and release archives are at https://founding.bot",
20
+ "",
21
+ ].join("\n"),
22
+ );
23
+ process.exit(1);
24
+ }
25
+
26
+ const executable = join(packageDir, process.platform === "win32" ? "foundingbot-x.exe" : "foundingbot-x");
27
+ const result = spawnSync(executable, process.argv.slice(2), { stdio: "inherit" });
28
+ if (result.error) {
29
+ process.stderr.write("foundingbot-x: failed to start " + executable + ": " + result.error.message + "\n");
30
+ process.exit(1);
31
+ }
32
+ // A child killed by a signal has no status; report it the way a shell would.
33
+ process.exit(result.status ?? 128 + (constants.signals[result.signal] || 1));
package/dist/bin.mjs ADDED
@@ -0,0 +1,27 @@
1
+ import { spawn } from "node:child_process";
2
+ import { constants } from "node:os";
3
+ import { dirname, join } from "node:path";
4
+ import { createRequire } from "node:module";
5
+ const require = createRequire(import.meta.url);
6
+ const executableName = process.platform === "win32" ? "foundingbot-x.exe" : "foundingbot-x";
7
+ const executable = join(dirname(require.resolve("@foundingbot/x-" + process.platform + "-" + process.arch + "/package.json")), executableName);
8
+ const ipc = process.send !== undefined;
9
+ const child = spawn(executable, process.argv.slice(2), {
10
+ stdio: ipc ? ["inherit", "inherit", "inherit", "ipc"] : "inherit",
11
+ });
12
+ const fail = (error) => {
13
+ if (!error) return;
14
+ process.stderr.write("foundingbot-x: " + error.message + "\n");
15
+ child.kill("SIGTERM");
16
+ process.exitCode = 1;
17
+ };
18
+ if (ipc) {
19
+ process.on("message", (message) => { if (child.connected) child.send(message, fail); });
20
+ child.on("message", (message) => { if (process.connected) process.send(message, fail); });
21
+ process.on("disconnect", () => { if (child.connected) child.disconnect(); });
22
+ }
23
+ for (const signal of ["SIGINT", "SIGTERM", "SIGHUP"]) {
24
+ process.on(signal, () => child.kill(signal));
25
+ }
26
+ child.on("error", (error) => { fail(error); process.exit(1); });
27
+ child.on("exit", (code, signal) => process.exit(code ?? 128 + (constants.signals[signal] || 1)));
package/package.json CHANGED
@@ -1,6 +1,25 @@
1
1
  {
2
2
  "name": "@foundingbot/x",
3
- "version": "0.0.0",
4
- "description": "Placeholder for Founding Bot X.",
5
- "license": "UNLICENSED"
3
+ "version": "0.0.46-preview.20261014.1",
4
+ "description": "Founding Bot X CLI. Installs the self-contained executable for this platform.",
5
+ "license": "UNLICENSED",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/phuctm97/foundingbot-x.git",
9
+ "directory": "apps/server"
10
+ },
11
+ "bin": {
12
+ "foundingbot-x": "./bin/foundingbot-x.js"
13
+ },
14
+ "files": [
15
+ "bin",
16
+ "dist"
17
+ ],
18
+ "optionalDependencies": {
19
+ "@foundingbot/x-darwin-arm64": "0.0.46-preview.20261014.1",
20
+ "@foundingbot/x-linux-arm64": "0.0.46-preview.20261014.1",
21
+ "@foundingbot/x-linux-x64": "0.0.46-preview.20261014.1",
22
+ "@foundingbot/x-win32-arm64": "0.0.46-preview.20261014.1",
23
+ "@foundingbot/x-win32-x64": "0.0.46-preview.20261014.1"
24
+ }
6
25
  }