@silicaclaw/cli 1.0.0-beta.15 → 1.0.0-beta.16

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@silicaclaw/cli",
3
- "version": "1.0.0-beta.15",
3
+ "version": "1.0.0-beta.16",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -87,31 +87,28 @@ function showUpdateGuide(current, latest, beta) {
87
87
  console.log("Update available.");
88
88
  }
89
89
  console.log("");
90
- console.log("Recommended commands:");
91
- console.log("1) npx mode (recommended, zero setup)");
92
- console.log(" npx @silicaclaw/cli@beta onboard");
93
- console.log(" npx @silicaclaw/cli@beta connect");
94
- console.log(" npx @silicaclaw/cli@beta update");
95
- console.log("");
96
- console.log("2) shell alias mode (no global install / no PATH edits)");
97
- console.log(" alias silicaclaw='npx -y @silicaclaw/cli@beta'");
98
- console.log(" silicaclaw version");
90
+ console.log("Quick next commands:");
91
+ console.log("1) Start local gateway");
92
+ console.log(" silicaclaw gateway start --mode=local");
93
+ console.log("2) Check gateway status");
94
+ console.log(" silicaclaw gateway status");
95
+ console.log("3) npx one-shot (no alias/global install)");
96
+ console.log(" npx -y @silicaclaw/cli@beta gateway start --mode=local");
99
97
  console.log("");
98
+
100
99
  const writableGlobal = canWriteGlobalPrefix();
101
100
  if (!npxRuntime && writableGlobal) {
102
- console.log("3) global install mode (optional)");
101
+ console.log("Optional global install:");
103
102
  console.log(" npm i -g @silicaclaw/cli@beta");
104
103
  console.log(" silicaclaw version");
105
104
  console.log("");
106
105
  } else if (!npxRuntime) {
107
- console.log("Global install skipped: current npm global directory is not writable (likely EACCES).");
108
- console.log("Use npx or alias mode above.");
106
+ console.log("Global install skipped: npm global directory is not writable (likely EACCES).");
109
107
  console.log("");
110
108
  }
111
109
  if (npxRuntime) {
112
- console.log("Detected npx runtime: use npx commands above for immediate update.");
113
- console.log("If `silicaclaw: command not found`, run:");
114
- console.log("alias silicaclaw='npx -y @silicaclaw/cli@beta'");
110
+ console.log("Detected npx runtime.");
111
+ console.log("If `silicaclaw` is unavailable in this shell, use the npx one-shot command above.");
115
112
  }
116
113
  }
117
114
 
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { spawn } from "node:child_process";
3
+ import { spawn, spawnSync } from "node:child_process";
4
4
  import { existsSync, mkdirSync, openSync, readFileSync, rmSync, writeFileSync } from "node:fs";
5
5
  import { homedir } from "node:os";
6
6
  import { dirname, join, resolve } from "node:path";
@@ -193,6 +193,74 @@ function showStatus() {
193
193
  updated_at: state?.updated_at || null,
194
194
  };
195
195
  console.log(JSON.stringify(payload, null, 2));
196
+ return payload;
197
+ }
198
+
199
+ function printConnectionSummary(status) {
200
+ if (!status?.local_console?.running) return;
201
+ console.log("");
202
+ console.log("Gateway connection summary:");
203
+ console.log(`- local-console: http://localhost:4310`);
204
+ console.log(`- mode: ${status.mode}`);
205
+ console.log(`- adapter: ${status.adapter}`);
206
+ if (status.mode === "global-preview") {
207
+ const signalingUrl = status?.signaling?.url || "http://localhost:4510";
208
+ const room = status?.signaling?.room || "silicaclaw-demo";
209
+ console.log(`- signaling: ${signalingUrl} (room=${room})`);
210
+ }
211
+ console.log(`- local-console log: ${status?.local_console?.log_file || CONSOLE_LOG_FILE}`);
212
+ console.log(`- status: cd "${APP_DIR}" && npm run gateway -- status`);
213
+ console.log(`- logs: cd "${APP_DIR}" && npm run gateway -- logs local-console`);
214
+ console.log(`- stop: cd "${APP_DIR}" && npm run gateway -- stop`);
215
+ }
216
+
217
+ function listeningProcessOnPort(port) {
218
+ try {
219
+ const pidRes = spawnSync("lsof", ["-nP", `-iTCP:${port}`, "-sTCP:LISTEN", "-t"], {
220
+ encoding: "utf8",
221
+ stdio: ["ignore", "pipe", "ignore"],
222
+ });
223
+ const pid = String(pidRes.stdout || "")
224
+ .split(/\r?\n/)
225
+ .map((s) => s.trim())
226
+ .find(Boolean);
227
+ if (!pid) return null;
228
+
229
+ const cmdRes = spawnSync("ps", ["-p", pid, "-o", "command="], {
230
+ encoding: "utf8",
231
+ stdio: ["ignore", "pipe", "ignore"],
232
+ });
233
+ const command = String(cmdRes.stdout || "").trim() || "unknown";
234
+ return { pid, command };
235
+ } catch {
236
+ return null;
237
+ }
238
+ }
239
+
240
+ function printStopSummary() {
241
+ const localListener = listeningProcessOnPort(4310);
242
+ const signalingListener = listeningProcessOnPort(4510);
243
+ console.log("");
244
+ console.log("Gateway stop summary:");
245
+ if (!localListener) {
246
+ console.log("- local-console port 4310: stopped");
247
+ } else {
248
+ console.log(`- local-console port 4310: still in use by pid=${localListener.pid}`);
249
+ console.log(` command: ${localListener.command}`);
250
+ console.log(" this is likely another process not started by gateway");
251
+ console.log(` inspect: lsof -nP -iTCP:4310 -sTCP:LISTEN`);
252
+ console.log(` stop it: kill ${localListener.pid}`);
253
+ }
254
+ if (!signalingListener) {
255
+ console.log("- signaling port 4510: stopped");
256
+ } else {
257
+ console.log(`- signaling port 4510: still in use by pid=${signalingListener.pid}`);
258
+ console.log(` command: ${signalingListener.command}`);
259
+ console.log(" this is likely another process not started by gateway");
260
+ console.log(` inspect: lsof -nP -iTCP:4510 -sTCP:LISTEN`);
261
+ console.log(` stop it: kill ${signalingListener.pid}`);
262
+ }
263
+ console.log(`- check status: cd "${APP_DIR}" && npm run gateway -- status`);
196
264
  }
197
265
 
198
266
  function tailFile(file, lines = 80) {
@@ -287,18 +355,21 @@ async function main() {
287
355
  }
288
356
  if (cmd === "start") {
289
357
  startAll();
290
- showStatus();
358
+ const status = showStatus();
359
+ printConnectionSummary(status);
291
360
  return;
292
361
  }
293
362
  if (cmd === "stop") {
294
363
  await stopAll();
295
364
  showStatus();
365
+ printStopSummary();
296
366
  return;
297
367
  }
298
368
  if (cmd === "restart") {
299
369
  await stopAll();
300
370
  startAll();
301
- showStatus();
371
+ const status = showStatus();
372
+ printConnectionSummary(status);
302
373
  return;
303
374
  }
304
375
  if (cmd === "logs") {
@@ -318,4 +389,3 @@ main().catch((error) => {
318
389
  console.error(error?.message || String(error));
319
390
  process.exit(1);
320
391
  });
321
-