codexport 0.3.3 → 0.3.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/dist/index.js +33 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -11,7 +11,7 @@ import { homedir, platform } from "node:os";
|
|
|
11
11
|
import path from "node:path";
|
|
12
12
|
import { spawn } from "node:child_process";
|
|
13
13
|
import { parse as parseToml, stringify as stringifyToml } from "smol-toml";
|
|
14
|
-
const VERSION = "0.3.
|
|
14
|
+
const VERSION = "0.3.4";
|
|
15
15
|
const DEFAULT_PORT = 17342;
|
|
16
16
|
const DEFAULT_TIMEOUT_MS = 5_000;
|
|
17
17
|
const CODEXPORT_DIR = ".codexport";
|
|
@@ -497,6 +497,10 @@ function portableMcpLauncher(name, command, args, sourceHome, server) {
|
|
|
497
497
|
if (nodePackage) {
|
|
498
498
|
return { command: "npx", args: ["-y", nodePackage.packageName, ...nodePackage.remainingArgs] };
|
|
499
499
|
}
|
|
500
|
+
if (name === "discord-py-self" || commandName === "discord-py-self-mcp") {
|
|
501
|
+
const remainingArgs = allStrings(args) ? args : [];
|
|
502
|
+
return { command: "npx", args: ["-y", "discord-selfbot-mcp", ...remainingArgs] };
|
|
503
|
+
}
|
|
500
504
|
if (name === "qmd" || commandName === "qmd") {
|
|
501
505
|
const remainingArgs = allStrings(args) ? args : [];
|
|
502
506
|
return { command: "npx", args: ["-y", "-p", "@tobilu/qmd", "qmd", ...remainingArgs] };
|
|
@@ -842,7 +846,7 @@ async function repairMcpLauncherIfNeeded(launcher, env) {
|
|
|
842
846
|
await installUv(env);
|
|
843
847
|
}
|
|
844
848
|
else {
|
|
845
|
-
await
|
|
849
|
+
await runRepairCommandWithEnv(launcher.repair.command, launcher.repair.args, env);
|
|
846
850
|
}
|
|
847
851
|
if (!(await executableExists(launcher.repair.whenMissing, env))) {
|
|
848
852
|
throw new CliError(`MCP repair completed but ${launcher.repair.whenMissing} is still not on PATH.`, 1);
|
|
@@ -850,7 +854,7 @@ async function repairMcpLauncherIfNeeded(launcher, env) {
|
|
|
850
854
|
}
|
|
851
855
|
async function installUv(env) {
|
|
852
856
|
if (platform() === "win32") {
|
|
853
|
-
await
|
|
857
|
+
await runRepairCommandWithEnv("powershell.exe", [
|
|
854
858
|
"-NoProfile",
|
|
855
859
|
"-ExecutionPolicy",
|
|
856
860
|
"Bypass",
|
|
@@ -859,7 +863,7 @@ async function installUv(env) {
|
|
|
859
863
|
], env);
|
|
860
864
|
}
|
|
861
865
|
else {
|
|
862
|
-
await
|
|
866
|
+
await runRepairCommandWithEnv("sh", ["-c", "curl -LsSf https://astral.sh/uv/install.sh | sh"], env);
|
|
863
867
|
}
|
|
864
868
|
const installHome = env.HOME ?? env.USERPROFILE ?? homedir();
|
|
865
869
|
const uvBinDir = platform() === "win32"
|
|
@@ -935,11 +939,15 @@ async function repairGitquarryEnvIfNeeded(name, env) {
|
|
|
935
939
|
}
|
|
936
940
|
const installHome = env.HOME ?? env.USERPROFILE ?? homedir();
|
|
937
941
|
const installDir = path.join(installHome, ".codexport", "tools", "gitquarry");
|
|
938
|
-
await ensureDir(installDir);
|
|
939
|
-
await runCommandWithEnv("npm", ["install", "--prefix", installDir, "gitquarry"], env);
|
|
940
942
|
const binaryPath = platform() === "win32"
|
|
941
943
|
? path.join(installDir, "node_modules", ".bin", "gitquarry.cmd")
|
|
942
944
|
: path.join(installDir, "node_modules", ".bin", "gitquarry");
|
|
945
|
+
if (await pathExists(binaryPath)) {
|
|
946
|
+
env.GITQUARRY_CLI_PATH = binaryPath;
|
|
947
|
+
return;
|
|
948
|
+
}
|
|
949
|
+
await ensureDir(installDir);
|
|
950
|
+
await runRepairCommandWithEnv("npm", ["install", "--prefix", installDir, "gitquarry"], env);
|
|
943
951
|
if (!(await pathExists(binaryPath))) {
|
|
944
952
|
throw new CliError("MCP repair installed gitquarry but could not find its npm shim.", 1);
|
|
945
953
|
}
|
|
@@ -1023,6 +1031,25 @@ function runCommandWithEnv(command, args, env) {
|
|
|
1023
1031
|
});
|
|
1024
1032
|
});
|
|
1025
1033
|
}
|
|
1034
|
+
function runRepairCommandWithEnv(command, args, env) {
|
|
1035
|
+
return new Promise((resolve, reject) => {
|
|
1036
|
+
const child = spawn(command, args, { stdio: ["ignore", "pipe", "pipe"], env });
|
|
1037
|
+
child.stdout.on("data", (chunk) => process.stderr.write(chunk));
|
|
1038
|
+
child.stderr.on("data", (chunk) => process.stderr.write(chunk));
|
|
1039
|
+
child.on("error", (error) => {
|
|
1040
|
+
const message = error.code === "ENOENT"
|
|
1041
|
+
? `MCP repair program not found: ${command}. Install it on this follower or add it to PATH.`
|
|
1042
|
+
: asError(error).message;
|
|
1043
|
+
reject(new CliError(message, 1));
|
|
1044
|
+
});
|
|
1045
|
+
child.on("exit", (code) => {
|
|
1046
|
+
if (code === 0)
|
|
1047
|
+
resolve();
|
|
1048
|
+
else
|
|
1049
|
+
reject(new CliError(`${command} ${args.join(" ")} exited with ${code}`, code ?? 1));
|
|
1050
|
+
});
|
|
1051
|
+
});
|
|
1052
|
+
}
|
|
1026
1053
|
async function installMasterService(ctx, port, dryRun) {
|
|
1027
1054
|
const command = `${process.execPath} ${realpathSync(fileURLToPath(import.meta.url))} master serve --port ${port}`;
|
|
1028
1055
|
if (platform() === "linux") {
|