solana-traderclaw 1.0.22 → 1.0.23
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.
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { execSync, spawn } from "child_process";
|
|
2
2
|
import { randomBytes } from "crypto";
|
|
3
3
|
import { existsSync, mkdirSync, readFileSync, renameSync, statSync, writeFileSync } from "fs";
|
|
4
|
-
import { homedir } from "os";
|
|
4
|
+
import { homedir, tmpdir } from "os";
|
|
5
5
|
import { dirname, join } from "path";
|
|
6
6
|
import { fileURLToPath } from "url";
|
|
7
7
|
import { choosePreferredProviderModel } from "./llm-model-preference.mjs";
|
|
@@ -244,8 +244,17 @@ async function installPlugin(modeConfig, onEvent) {
|
|
|
244
244
|
urls: [],
|
|
245
245
|
});
|
|
246
246
|
}
|
|
247
|
+
// npm resolves bare package names against process cwd; a folder named solana-traderclaw under /root becomes file:solana-traderclaw and breaks global install.
|
|
248
|
+
const npmCwd = tmpdir();
|
|
249
|
+
if (typeof onEvent === "function") {
|
|
250
|
+
onEvent({
|
|
251
|
+
type: "stdout",
|
|
252
|
+
text: `Running npm global install with cwd=${npmCwd} (avoids shadowing by ./solana-traderclaw in the wizard shell).\n`,
|
|
253
|
+
urls: [],
|
|
254
|
+
});
|
|
255
|
+
}
|
|
247
256
|
try {
|
|
248
|
-
await runCommandWithEvents("npm", ["install", "-g", spec], { onEvent });
|
|
257
|
+
await runCommandWithEvents("npm", ["install", "-g", spec], { onEvent, cwd: npmCwd });
|
|
249
258
|
return { installed: true, available: commandExists(modeConfig.cliName), forced: false };
|
|
250
259
|
} catch (err) {
|
|
251
260
|
if (!isNpmGlobalBinConflict(err, modeConfig.cliName)) throw err;
|
|
@@ -256,7 +265,7 @@ async function installPlugin(modeConfig, onEvent) {
|
|
|
256
265
|
urls: [],
|
|
257
266
|
});
|
|
258
267
|
}
|
|
259
|
-
await runCommandWithEvents("npm", ["install", "-g", "--force", spec], { onEvent });
|
|
268
|
+
await runCommandWithEvents("npm", ["install", "-g", "--force", spec], { onEvent, cwd: npmCwd });
|
|
260
269
|
return { installed: true, available: commandExists(modeConfig.cliName), forced: true };
|
|
261
270
|
}
|
|
262
271
|
}
|
package/package.json
CHANGED