@silicaclaw/cli 1.0.0-beta.31 → 1.0.0-beta.33
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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@silicaclaw/cli",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.33",
|
|
4
4
|
"private": false,
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"onboard": "node scripts/silicaclaw-cli.mjs onboard",
|
|
55
55
|
"quickstart": "bash scripts/quickstart.sh",
|
|
56
56
|
"gateway": "node scripts/silicaclaw-gateway.mjs",
|
|
57
|
-
"local-console": "npm run --workspace @silicaclaw/local-console
|
|
57
|
+
"local-console": "npm run --workspace @silicaclaw/local-console start",
|
|
58
58
|
"public-explorer": "npm run --workspace @silicaclaw/public-explorer dev",
|
|
59
59
|
"logo": "bash scripts/install-logo.sh",
|
|
60
60
|
"webrtc-signaling": "node scripts/webrtc-signaling-server.mjs",
|
|
@@ -85,6 +85,15 @@ function runInherit(cmd, args, extra = {}) {
|
|
|
85
85
|
return result;
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
+
function compactOutput(text, limit = 18) {
|
|
89
|
+
const lines = String(text || "")
|
|
90
|
+
.split(/\r?\n/)
|
|
91
|
+
.map((line) => line.trimEnd())
|
|
92
|
+
.filter(Boolean);
|
|
93
|
+
if (lines.length <= limit) return lines.join("\n");
|
|
94
|
+
return lines.slice(-limit).join("\n");
|
|
95
|
+
}
|
|
96
|
+
|
|
88
97
|
function readVersion() {
|
|
89
98
|
const versionFile = resolve(ROOT_DIR, "VERSION");
|
|
90
99
|
if (!existsSync(versionFile)) return "unknown";
|
|
@@ -122,6 +131,10 @@ function userEnvFile() {
|
|
|
122
131
|
return resolve(homedir(), ".silicaclaw", "env.sh");
|
|
123
132
|
}
|
|
124
133
|
|
|
134
|
+
function userNpmCacheDir() {
|
|
135
|
+
return resolve(homedir(), ".silicaclaw", "npm-cache");
|
|
136
|
+
}
|
|
137
|
+
|
|
125
138
|
function ensureLineInFile(filePath, block) {
|
|
126
139
|
try {
|
|
127
140
|
const current = existsSync(filePath) ? readFileSync(filePath, "utf8") : "";
|
|
@@ -190,9 +203,11 @@ function installPersistentCommand() {
|
|
|
190
203
|
const binDir = userShimDir();
|
|
191
204
|
const shimPath = userShimPath();
|
|
192
205
|
const envFile = userEnvFile();
|
|
206
|
+
const npmCacheDir = userNpmCacheDir();
|
|
193
207
|
const envBlock = [
|
|
194
208
|
"#!/usr/bin/env bash",
|
|
195
209
|
'export PATH="$HOME/.silicaclaw/bin:$PATH"',
|
|
210
|
+
'export npm_config_cache="$HOME/.silicaclaw/npm-cache"',
|
|
196
211
|
"",
|
|
197
212
|
].join("\n");
|
|
198
213
|
const rcBlock = [
|
|
@@ -202,12 +217,14 @@ function installPersistentCommand() {
|
|
|
202
217
|
].join("\n");
|
|
203
218
|
|
|
204
219
|
mkdirSync(binDir, { recursive: true });
|
|
220
|
+
mkdirSync(npmCacheDir, { recursive: true });
|
|
205
221
|
writeFileSync(envFile, envBlock, { encoding: "utf8", mode: 0o755 });
|
|
206
222
|
writeFileSync(
|
|
207
223
|
shimPath,
|
|
208
224
|
[
|
|
209
225
|
"#!/usr/bin/env bash",
|
|
210
226
|
"set -euo pipefail",
|
|
227
|
+
'export npm_config_cache="${npm_config_cache:-$HOME/.silicaclaw/npm-cache}"',
|
|
211
228
|
'exec npx -y @silicaclaw/cli@beta "$@"',
|
|
212
229
|
"",
|
|
213
230
|
].join("\n"),
|
|
@@ -426,6 +443,33 @@ function update() {
|
|
|
426
443
|
}
|
|
427
444
|
}
|
|
428
445
|
|
|
446
|
+
function doctor() {
|
|
447
|
+
const steps = [
|
|
448
|
+
{ label: "Check", cmd: "npm", args: ["run", "-ws", "check"] },
|
|
449
|
+
{ label: "Build", cmd: "npm", args: ["run", "-ws", "build"] },
|
|
450
|
+
{ label: "Functional", cmd: "node", args: ["scripts/functional-check.mjs"] },
|
|
451
|
+
];
|
|
452
|
+
|
|
453
|
+
headline();
|
|
454
|
+
console.log("");
|
|
455
|
+
|
|
456
|
+
for (const step of steps) {
|
|
457
|
+
const result = runCapture(step.cmd, step.args, { cwd: ROOT_DIR });
|
|
458
|
+
if ((result.status ?? 1) === 0) {
|
|
459
|
+
kv(step.label, paint("ok", COLOR.green));
|
|
460
|
+
continue;
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
kv(step.label, paint("failed", COLOR.yellow));
|
|
464
|
+
const detail = compactOutput(`${result.stdout || ""}\n${result.stderr || ""}`);
|
|
465
|
+
if (detail) {
|
|
466
|
+
console.log("");
|
|
467
|
+
console.log(detail);
|
|
468
|
+
}
|
|
469
|
+
process.exit(result.status ?? 1);
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
|
|
429
473
|
function help() {
|
|
430
474
|
headline();
|
|
431
475
|
console.log("");
|
|
@@ -446,21 +490,9 @@ const cmd = String(process.argv[2] || "help").trim().toLowerCase();
|
|
|
446
490
|
|
|
447
491
|
switch (cmd) {
|
|
448
492
|
case "onboard":
|
|
449
|
-
headline();
|
|
450
|
-
console.log("");
|
|
451
|
-
section("Opening onboarding");
|
|
452
|
-
kv("Mode", "interactive setup");
|
|
453
|
-
kv("Focus", "install command, profile, internet relay");
|
|
454
|
-
console.log("");
|
|
455
493
|
run("bash", [resolve(ROOT_DIR, "scripts", "quickstart.sh")]);
|
|
456
494
|
break;
|
|
457
495
|
case "connect":
|
|
458
|
-
headline();
|
|
459
|
-
console.log("");
|
|
460
|
-
section("Opening connect wizard");
|
|
461
|
-
kv("Mode", "global-preview first");
|
|
462
|
-
kv("Relay", "https://relay.silicaclaw.com");
|
|
463
|
-
console.log("");
|
|
464
496
|
run("bash", [resolve(ROOT_DIR, "scripts", "quickstart.sh")], {
|
|
465
497
|
env: {
|
|
466
498
|
...process.env,
|
|
@@ -502,11 +534,7 @@ switch (cmd) {
|
|
|
502
534
|
run("npm", ["run", "webrtc-signaling"]);
|
|
503
535
|
break;
|
|
504
536
|
case "doctor":
|
|
505
|
-
|
|
506
|
-
console.log("");
|
|
507
|
-
section("Running health checks");
|
|
508
|
-
console.log("");
|
|
509
|
-
run("npm", ["run", "health"]);
|
|
537
|
+
doctor();
|
|
510
538
|
break;
|
|
511
539
|
case "version":
|
|
512
540
|
case "-v":
|
|
@@ -230,18 +230,20 @@ function buildStatusPayload() {
|
|
|
230
230
|
const localPid = readPid(CONSOLE_PID_FILE);
|
|
231
231
|
const sigPid = readPid(SIGNALING_PID_FILE);
|
|
232
232
|
const state = readState();
|
|
233
|
+
const localListener = listeningProcessOnPort(4310);
|
|
234
|
+
const signalingListener = listeningProcessOnPort(4510);
|
|
233
235
|
return {
|
|
234
236
|
app_dir: APP_DIR,
|
|
235
237
|
mode: state?.mode || "unknown",
|
|
236
238
|
adapter: state?.adapter || "unknown",
|
|
237
239
|
local_console: {
|
|
238
240
|
pid: localPid,
|
|
239
|
-
running:
|
|
241
|
+
running: Boolean(localListener),
|
|
240
242
|
log_file: CONSOLE_LOG_FILE,
|
|
241
243
|
},
|
|
242
244
|
signaling: {
|
|
243
245
|
pid: sigPid,
|
|
244
|
-
running:
|
|
246
|
+
running: Boolean(signalingListener),
|
|
245
247
|
log_file: SIGNALING_LOG_FILE,
|
|
246
248
|
url: state?.signaling_url || null,
|
|
247
249
|
room: state?.room || null,
|