@vclawhub/vclaw 0.2.3 → 0.2.4

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.
Files changed (2) hide show
  1. package/dist/cli.js +14 -93
  2. package/package.json +10 -5
package/dist/cli.js CHANGED
@@ -1,95 +1,16 @@
1
- #!/usr/bin/env bun
2
- // @bun
1
+ #!/usr/bin/env node
2
+ // vclaw — VClaw Hub CLI wrapper
3
+ // Detects Bun at runtime, spawns the real CLI.
4
+ import { spawnSync } from "node:child_process";
5
+ import { fileURLToPath } from "node:url";
6
+ import { dirname, join } from "node:path";
3
7
 
4
- // src/cli.ts
5
- var {$ } = globalThis.Bun;
6
- var PROJECT_ROOT = import.meta.dirname + "/..";
7
- var HELP = `
8
- VClaw Agent \u2014 Local Agentic Mesh Wrapper
8
+ const __dirname = dirname(fileURLToPath(import.meta.url));
9
+ const args = process.argv.slice(2);
10
+ const bunPath = join(__dirname, "cli.bun.ts");
9
11
 
10
- Usage:
11
- bunx @vclawhub/vclaw install Install the full stack
12
- bunx @vclawhub/vclaw up Launch NATS + pi-web.dev
13
- bunx @vclawhub/vclaw up --onboard <email> Launch + join vchat.email
14
- bunx @vclawhub/vclaw up --uninstall Remove everything
15
- bunx @vclawhub/vclaw onboard <email> Join the vchat.email network
16
- bunx @vclawhub/vclaw help Show this message
17
-
18
- Examples:
19
- bunx @vclawhub/vclaw install
20
- bunx @vclawhub/vclaw up
21
- bunx @vclawhub/vclaw up --onboard alice@example.com
22
- `;
23
- var cmd = process.argv[2]?.toLowerCase();
24
- switch (cmd) {
25
- case "install": {
26
- const localScript = `${PROJECT_ROOT}/install.sh`;
27
- const { exitCode } = await $`test -f ${localScript}`.quiet();
28
- if (exitCode === 0) {
29
- console.log("\uD83D\uDCE6 Running local install.sh...");
30
- await $`bash ${localScript}`;
31
- } else {
32
- console.log("\uD83D\uDCE6 Fetching installer from vclawhub.com...");
33
- await $`curl -fsSL https://vclawhub.com/install | sh`;
34
- }
35
- break;
36
- }
37
- case "up": {
38
- const onboardFlag = process.argv.indexOf("--onboard");
39
- let email = "";
40
- if (onboardFlag !== -1 && process.argv[onboardFlag + 1]) {
41
- email = process.argv[onboardFlag + 1];
42
- }
43
- const localScript = `${PROJECT_ROOT}/vclaw-up`;
44
- const uninstallFlag = process.argv.indexOf("--uninstall");
45
- const { exitCode } = await $`test -f ${localScript}`.quiet();
46
- if (exitCode === 0 && uninstallFlag !== -1) {
47
- console.log("\uD83E\uDDF9 Uninstalling VClaw Hub...");
48
- await $`bash ${localScript} --uninstall`;
49
- process.exit(0);
50
- } else if (exitCode === 0 && email) {
51
- console.log("\uD83D\uDE80 Launching stack and joining vchat.email network...");
52
- await $`bash ${localScript} --onboard ${email}`;
53
- } else if (exitCode === 0) {
54
- console.log("\uD83D\uDE80 Launching local agentic mesh...");
55
- await $`bash ${localScript}`;
56
- } else if (email) {
57
- console.log("\uD83D\uDE80 Starting NATS server...");
58
- const natsServer = Bun.which("nats-server");
59
- if (!natsServer) {
60
- console.error("\u274C nats-server not found. Run 'vclaw-agent install' first.");
61
- process.exit(1);
62
- }
63
- const dataDir = `${process.env.HOME}/.local/share/vclaw`;
64
- await $`mkdir -p ${dataDir}/nats-data`;
65
- await $`nats-server --port 4222 --jetstream --store_dir ${dataDir}/nats-data > ${dataDir}/nats-server.log 2>&1 &`.quiet();
66
- console.log(" \u2714 NATS server started on 127.0.0.1:4222");
67
- const piUrl = "https://pi-web.dev/?connect=127.0.0.1:4222";
68
- await $`bunx open ${piUrl}`.quiet().catch(() => {});
69
- console.log(` \u2714 Browser opened to ${piUrl}`);
70
- console.log(`
71
- \uD83D\uDCE1 Onboarding to vchat.email...`);
72
- await $`bunx @vchatemail/agent ensoul --email ${email}`;
73
- } else {
74
- console.error("\u274C vclaw-up not found. Run 'vclaw-agent install' first.");
75
- process.exit(1);
76
- }
77
- break;
78
- }
79
- case "onboard": {
80
- const email = process.argv[3];
81
- if (!email) {
82
- console.error("\u274C Usage: bunx @vclawhub/vclaw onboard <email>");
83
- process.exit(1);
84
- }
85
- console.log(`\uD83D\uDCE1 Joining vchat.email network as ${email}...`);
86
- await $`bunx @vchatemail/agent ensoul --email ${email}`;
87
- break;
88
- }
89
- case "help":
90
- case "--help":
91
- case "-h":
92
- default:
93
- console.log(HELP);
94
- break;
95
- }
12
+ // Try bun first, then bunx
13
+ const { status } = spawnSync("bun", [bunPath, ...args], {
14
+ stdio: "inherit",
15
+ });
16
+ process.exit(status ?? 1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vclawhub/vclaw",
3
- "version": "0.2.3",
3
+ "version": "0.2.4",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "VClaw Agent — one-command setup for pi.dev + pi-web.dev + NATS leaf node + vchat.email network",
@@ -24,7 +24,7 @@
24
24
  },
25
25
  "homepage": "https://vclawhub.com",
26
26
  "bin": {
27
- "vclaw": "./dist/cli.js"
27
+ "vclaw": "dist/cli.js"
28
28
  },
29
29
  "files": [
30
30
  "dist/cli.js",
@@ -34,10 +34,15 @@
34
34
  "scripts/"
35
35
  ],
36
36
  "scripts": {
37
- "build": "bun build ./src/cli.ts --target=bun --outdir=dist",
38
- "dev": "bun --watch ./src/cli.ts",
37
+ "build": "bun build ./src/cli.bun.ts --target=bun --outfile=dist/cli.bun.js && cp src/cli.ts dist/cli.js",
38
+ "compile:darwin-arm64": "bun build --compile --target=bun-darwin-arm64 ./src/cli.bun.ts --outfile=dist/vclaw-darwin-arm64",
39
+ "compile:darwin-x64": "bun build --compile --target=bun-darwin-x64 ./src/cli.bun.ts --outfile=dist/vclaw-darwin-x64",
40
+ "compile:linux-x64": "bun build --compile --target=bun-linux-x64 ./src/cli.bun.ts --outfile=dist/vclaw-linux-x64",
41
+ "compile:linux-arm64": "bun build --compile --target=bun-linux-arm64 ./src/cli.bun.ts --outfile=dist/vclaw-linux-arm64",
42
+ "compile:all": "bun run compile:darwin-arm64 && bun run compile:darwin-x64 && bun run compile:linux-x64 && bun run compile:linux-arm64",
43
+ "dev": "bun --watch ./src/cli.bun.ts",
39
44
  "prepublishOnly": "bun run build",
40
- "start": "bun run ./src/cli.ts"
45
+ "start": "bun run ./src/cli.bun.ts"
41
46
  },
42
47
  "engines": {
43
48
  "bun": ">=1.2"