@silicaclaw/cli 1.0.0-beta.16 → 1.0.0-beta.17
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
|
@@ -143,6 +143,11 @@ Usage:
|
|
|
143
143
|
silicaclaw onboard
|
|
144
144
|
silicaclaw connect
|
|
145
145
|
silicaclaw update
|
|
146
|
+
silicaclaw start [--mode=local|lan|global-preview]
|
|
147
|
+
silicaclaw stop
|
|
148
|
+
silicaclaw restart [--mode=local|lan|global-preview]
|
|
149
|
+
silicaclaw status
|
|
150
|
+
silicaclaw logs [local-console|signaling]
|
|
146
151
|
silicaclaw gateway <start|stop|restart|status|logs>
|
|
147
152
|
silicaclaw local-console
|
|
148
153
|
silicaclaw explorer
|
|
@@ -155,6 +160,11 @@ Commands:
|
|
|
155
160
|
onboard Interactive step-by-step onboarding (recommended)
|
|
156
161
|
connect Cross-network connect wizard (global-preview first)
|
|
157
162
|
update Check latest npm version and show upgrade commands
|
|
163
|
+
start Start gateway-managed background services
|
|
164
|
+
stop Stop gateway-managed background services
|
|
165
|
+
restart Restart gateway-managed background services
|
|
166
|
+
status Show gateway-managed service status
|
|
167
|
+
logs Show gateway-managed service logs
|
|
158
168
|
gateway Manage background services (start/stop/restart/status/logs)
|
|
159
169
|
local-console Start local console (http://localhost:4310)
|
|
160
170
|
explorer Start public explorer (http://localhost:4311)
|
|
@@ -188,6 +198,15 @@ switch (cmd) {
|
|
|
188
198
|
cwd: process.cwd(),
|
|
189
199
|
});
|
|
190
200
|
break;
|
|
201
|
+
case "start":
|
|
202
|
+
case "stop":
|
|
203
|
+
case "restart":
|
|
204
|
+
case "status":
|
|
205
|
+
case "logs":
|
|
206
|
+
run("node", [resolve(ROOT_DIR, "scripts", "silicaclaw-gateway.mjs"), cmd, ...process.argv.slice(3)], {
|
|
207
|
+
cwd: process.cwd(),
|
|
208
|
+
});
|
|
209
|
+
break;
|
|
191
210
|
case "local-console":
|
|
192
211
|
case "console":
|
|
193
212
|
run("npm", ["run", "local-console"]);
|
|
@@ -13,6 +13,25 @@ const ROOT_DIR = resolve(__dirname, "..");
|
|
|
13
13
|
const argv = process.argv.slice(2);
|
|
14
14
|
const cmd = String(argv[0] || "help").toLowerCase();
|
|
15
15
|
|
|
16
|
+
function readJson(file) {
|
|
17
|
+
try {
|
|
18
|
+
return JSON.parse(String(readFileSync(file, "utf8")));
|
|
19
|
+
} catch {
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function isSilicaClawDir(dir) {
|
|
25
|
+
const pkgPath = join(dir, "package.json");
|
|
26
|
+
if (!existsSync(pkgPath)) return false;
|
|
27
|
+
const pkg = readJson(pkgPath);
|
|
28
|
+
if (!pkg || typeof pkg !== "object") return false;
|
|
29
|
+
const name = String(pkg.name || "");
|
|
30
|
+
if (name === "@silicaclaw/cli" || name === "silicaclaw") return true;
|
|
31
|
+
const scripts = pkg.scripts && typeof pkg.scripts === "object" ? pkg.scripts : {};
|
|
32
|
+
return Boolean(scripts.gateway || scripts["local-console"] || scripts["public-explorer"]);
|
|
33
|
+
}
|
|
34
|
+
|
|
16
35
|
function parseFlag(name, fallback = "") {
|
|
17
36
|
const prefix = `--${name}=`;
|
|
18
37
|
for (const item of argv) {
|
|
@@ -27,17 +46,17 @@ function hasFlag(name) {
|
|
|
27
46
|
|
|
28
47
|
function detectAppDir() {
|
|
29
48
|
const envDir = process.env.SILICACLAW_APP_DIR;
|
|
30
|
-
if (envDir &&
|
|
49
|
+
if (envDir && isSilicaClawDir(envDir)) {
|
|
31
50
|
return resolve(envDir);
|
|
32
51
|
}
|
|
33
52
|
|
|
34
53
|
const cwd = process.cwd();
|
|
35
|
-
if (
|
|
54
|
+
if (isSilicaClawDir(cwd)) {
|
|
36
55
|
return resolve(cwd);
|
|
37
56
|
}
|
|
38
57
|
|
|
39
58
|
const homeCandidate = join(homedir(), "silicaclaw");
|
|
40
|
-
if (
|
|
59
|
+
if (isSilicaClawDir(homeCandidate)) {
|
|
41
60
|
return resolve(homeCandidate);
|
|
42
61
|
}
|
|
43
62
|
|
|
@@ -209,9 +228,9 @@ function printConnectionSummary(status) {
|
|
|
209
228
|
console.log(`- signaling: ${signalingUrl} (room=${room})`);
|
|
210
229
|
}
|
|
211
230
|
console.log(`- local-console log: ${status?.local_console?.log_file || CONSOLE_LOG_FILE}`);
|
|
212
|
-
console.log(`- status:
|
|
213
|
-
console.log(`- logs:
|
|
214
|
-
console.log(`- stop:
|
|
231
|
+
console.log(`- status: silicaclaw gateway status`);
|
|
232
|
+
console.log(`- logs: silicaclaw gateway logs local-console`);
|
|
233
|
+
console.log(`- stop: silicaclaw gateway stop`);
|
|
215
234
|
}
|
|
216
235
|
|
|
217
236
|
function listeningProcessOnPort(port) {
|
|
@@ -260,7 +279,7 @@ function printStopSummary() {
|
|
|
260
279
|
console.log(` inspect: lsof -nP -iTCP:4510 -sTCP:LISTEN`);
|
|
261
280
|
console.log(` stop it: kill ${signalingListener.pid}`);
|
|
262
281
|
}
|
|
263
|
-
console.log(`- check status:
|
|
282
|
+
console.log(`- check status: silicaclaw gateway status`);
|
|
264
283
|
}
|
|
265
284
|
|
|
266
285
|
function tailFile(file, lines = 80) {
|