@silicaclaw/cli 1.0.0-beta.13 → 1.0.0-beta.15
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 +2 -0
- package/package.json +1 -1
- package/scripts/silicaclaw-cli.mjs +30 -6
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,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
import { spawnSync } from "node:child_process";
|
|
4
|
-
import { existsSync, readFileSync } from "node:fs";
|
|
4
|
+
import { accessSync, constants, existsSync, readFileSync } from "node:fs";
|
|
5
5
|
import { dirname, resolve } from "node:path";
|
|
6
6
|
import { fileURLToPath } from "node:url";
|
|
7
7
|
|
|
@@ -58,7 +58,22 @@ function isNpxRun() {
|
|
|
58
58
|
return ROOT_DIR.includes("/.npm/_npx/");
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
+
function canWriteGlobalPrefix() {
|
|
62
|
+
try {
|
|
63
|
+
const prefixResult = runCapture("npm", ["prefix", "-g"]);
|
|
64
|
+
if ((prefixResult.status ?? 1) !== 0) return false;
|
|
65
|
+
const prefix = String(prefixResult.stdout || "").trim();
|
|
66
|
+
if (!prefix) return false;
|
|
67
|
+
const targetDir = resolve(prefix, "lib", "node_modules");
|
|
68
|
+
accessSync(targetDir, constants.W_OK);
|
|
69
|
+
return true;
|
|
70
|
+
} catch {
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
61
75
|
function showUpdateGuide(current, latest, beta) {
|
|
76
|
+
const npxRuntime = isNpxRun();
|
|
62
77
|
console.log("SilicaClaw update check");
|
|
63
78
|
console.log(`current: ${current}`);
|
|
64
79
|
console.log(`latest : ${latest || "-"}`);
|
|
@@ -82,12 +97,21 @@ function showUpdateGuide(current, latest, beta) {
|
|
|
82
97
|
console.log(" alias silicaclaw='npx -y @silicaclaw/cli@beta'");
|
|
83
98
|
console.log(" silicaclaw version");
|
|
84
99
|
console.log("");
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
100
|
+
const writableGlobal = canWriteGlobalPrefix();
|
|
101
|
+
if (!npxRuntime && writableGlobal) {
|
|
102
|
+
console.log("3) global install mode (optional)");
|
|
103
|
+
console.log(" npm i -g @silicaclaw/cli@beta");
|
|
104
|
+
console.log(" silicaclaw version");
|
|
105
|
+
console.log("");
|
|
106
|
+
} 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.");
|
|
109
|
+
console.log("");
|
|
110
|
+
}
|
|
111
|
+
if (npxRuntime) {
|
|
90
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'");
|
|
91
115
|
}
|
|
92
116
|
}
|
|
93
117
|
|