@silicaclaw/cli 1.0.0-beta.14 → 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/CHANGELOG.md CHANGED
@@ -14,6 +14,8 @@
14
14
  - `silicaclaw update` guidance polish:
15
15
  - prioritize zero-setup `npx` flow
16
16
  - clarify global install is optional
17
+ - hide global-install recommendation during `npx` runtime to avoid repeated `EACCES` loops
18
+ - add explicit `command not found` alias guidance for first-run shells
17
19
  - README first-screen and structure polish:
18
20
  - fixed v1.0 beta project positioning
19
21
  - added concise feature summary
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@silicaclaw/cli",
3
- "version": "1.0.0-beta.14",
3
+ "version": "1.0.0-beta.16",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -73,6 +73,7 @@ function canWriteGlobalPrefix() {
73
73
  }
74
74
 
75
75
  function showUpdateGuide(current, latest, beta) {
76
+ const npxRuntime = isNpxRun();
76
77
  console.log("SilicaClaw update check");
77
78
  console.log(`current: ${current}`);
78
79
  console.log(`latest : ${latest || "-"}`);
@@ -86,29 +87,28 @@ function showUpdateGuide(current, latest, beta) {
86
87
  console.log("Update available.");
87
88
  }
88
89
  console.log("");
89
- console.log("Recommended commands:");
90
- console.log("1) npx mode (recommended, zero setup)");
91
- console.log(" npx @silicaclaw/cli@beta onboard");
92
- console.log(" npx @silicaclaw/cli@beta connect");
93
- console.log(" npx @silicaclaw/cli@beta update");
94
- console.log("");
95
- console.log("2) shell alias mode (no global install / no PATH edits)");
96
- console.log(" alias silicaclaw='npx -y @silicaclaw/cli@beta'");
97
- 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");
98
97
  console.log("");
98
+
99
99
  const writableGlobal = canWriteGlobalPrefix();
100
- if (writableGlobal) {
101
- console.log("3) global install mode (optional)");
100
+ if (!npxRuntime && writableGlobal) {
101
+ console.log("Optional global install:");
102
102
  console.log(" npm i -g @silicaclaw/cli@beta");
103
103
  console.log(" silicaclaw version");
104
104
  console.log("");
105
- } else {
106
- console.log("Global install skipped: current npm global directory is not writable (likely EACCES).");
107
- console.log("Use npx or alias mode above.");
105
+ } else if (!npxRuntime) {
106
+ console.log("Global install skipped: npm global directory is not writable (likely EACCES).");
108
107
  console.log("");
109
108
  }
110
- if (isNpxRun()) {
111
- console.log("Detected npx runtime: use npx commands above for immediate update.");
109
+ if (npxRuntime) {
110
+ console.log("Detected npx runtime.");
111
+ console.log("If `silicaclaw` is unavailable in this shell, use the npx one-shot command above.");
112
112
  }
113
113
  }
114
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
-