saycoder 0.1.3 → 0.1.4
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/bin/saycoder.js +12 -9
- package/package.json +1 -1
package/bin/saycoder.js
CHANGED
|
@@ -138,10 +138,9 @@ function installOpenCode(registry) {
|
|
|
138
138
|
const args = ["install", "-g", "opencode-ai", "--foreground-scripts", "--verbose", "--loglevel", "verbose"];
|
|
139
139
|
if (registry) args.push("--registry", registry);
|
|
140
140
|
step(`Installing OpenCode with npm${registry ? ` using ${registry}` : ""}...`);
|
|
141
|
-
const result = spawnSync("npm", args, {
|
|
141
|
+
const result = spawnSync(process.platform === "win32" ? "npm.cmd" : "npm", args, {
|
|
142
142
|
encoding: "utf8",
|
|
143
143
|
stdio: ["ignore", "pipe", "pipe"],
|
|
144
|
-
shell: process.platform === "win32",
|
|
145
144
|
});
|
|
146
145
|
|
|
147
146
|
if (result.stdout) output.write(result.stdout);
|
|
@@ -169,14 +168,18 @@ function pathRefreshHint() {
|
|
|
169
168
|
}
|
|
170
169
|
|
|
171
170
|
function verifyOpenCode() {
|
|
172
|
-
const
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
171
|
+
const commands = process.platform === "win32" ? ["opencode.cmd", "opencode.exe", "opencode"] : ["opencode"];
|
|
172
|
+
|
|
173
|
+
for (const command of commands) {
|
|
174
|
+
const result = spawnSync(command, ["--version"], {
|
|
175
|
+
encoding: "utf8",
|
|
176
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
if (result.status === 0) return (result.stdout || result.stderr || "").trim();
|
|
180
|
+
}
|
|
177
181
|
|
|
178
|
-
|
|
179
|
-
return (result.stdout || result.stderr || "").trim();
|
|
182
|
+
return null;
|
|
180
183
|
}
|
|
181
184
|
|
|
182
185
|
function step(message) {
|