codexport 0.3.1 → 0.3.2
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 -4
- 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.2";
|
|
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 === "qmd" || commandName === "qmd") {
|
|
501
|
+
const remainingArgs = allStrings(args) ? args : [];
|
|
502
|
+
return { command: "npx", args: ["-y", "-p", "@tobilu/qmd", "qmd", ...remainingArgs] };
|
|
503
|
+
}
|
|
500
504
|
const npmPackage = npmPackageForPortableMcp(name, commandName);
|
|
501
505
|
if (npmPackage) {
|
|
502
506
|
const remainingArgs = packageLauncherArgs(commandName, args);
|
|
@@ -510,8 +514,8 @@ function portableMcpLauncher(name, command, args, sourceHome, server) {
|
|
|
510
514
|
args: ["--from", uvTool.packageName, uvTool.binaryName, ...remainingArgs],
|
|
511
515
|
repair: {
|
|
512
516
|
whenMissing: "uvx",
|
|
513
|
-
command:
|
|
514
|
-
args: [
|
|
517
|
+
command: "__codexport_install_uv",
|
|
518
|
+
args: []
|
|
515
519
|
}
|
|
516
520
|
};
|
|
517
521
|
}
|
|
@@ -571,7 +575,6 @@ function npmPackageForPortableMcp(name, commandName) {
|
|
|
571
575
|
"opensrc-mcp-stdio": "opensrc-mcp",
|
|
572
576
|
"perplexity-webui": "perplexity-webui-mcp",
|
|
573
577
|
"perplexity-webui-mcp": "perplexity-webui-mcp",
|
|
574
|
-
"qmd": "qmd-cli",
|
|
575
578
|
"reddit-mcp-buddy": "reddit-mcp-buddy",
|
|
576
579
|
"xcodebuildmcp": "xcodebuildmcp"
|
|
577
580
|
};
|
|
@@ -806,6 +809,7 @@ async function commandMcpRun(ctx, name) {
|
|
|
806
809
|
: [];
|
|
807
810
|
if (!command)
|
|
808
811
|
throw new CliError(`MCP ${name} has no command.`, 1);
|
|
812
|
+
ensurePortablePathEnv(server);
|
|
809
813
|
const launcher = mcpHasRequiredPortableEnv(name, command, server)
|
|
810
814
|
? portableMcpLauncher(name, command, args, sourceHome, server)
|
|
811
815
|
: undefined;
|
|
@@ -834,6 +838,9 @@ async function repairMcpLauncherIfNeeded(launcher, env) {
|
|
|
834
838
|
if (launcher.repair.command === "__codexport_install_fff_mcp") {
|
|
835
839
|
await installFffMcp(env);
|
|
836
840
|
}
|
|
841
|
+
else if (launcher.repair.command === "__codexport_install_uv") {
|
|
842
|
+
await installUv(env);
|
|
843
|
+
}
|
|
837
844
|
else {
|
|
838
845
|
await runCommandWithEnv(launcher.repair.command, launcher.repair.args, env);
|
|
839
846
|
}
|
|
@@ -841,6 +848,28 @@ async function repairMcpLauncherIfNeeded(launcher, env) {
|
|
|
841
848
|
throw new CliError(`MCP repair completed but ${launcher.repair.whenMissing} is still not on PATH.`, 1);
|
|
842
849
|
}
|
|
843
850
|
}
|
|
851
|
+
async function installUv(env) {
|
|
852
|
+
if (platform() === "win32") {
|
|
853
|
+
await runCommandWithEnv("powershell.exe", [
|
|
854
|
+
"-NoProfile",
|
|
855
|
+
"-ExecutionPolicy",
|
|
856
|
+
"Bypass",
|
|
857
|
+
"-Command",
|
|
858
|
+
"irm https://astral.sh/uv/install.ps1 | iex"
|
|
859
|
+
], env);
|
|
860
|
+
}
|
|
861
|
+
else {
|
|
862
|
+
await runCommandWithEnv("sh", ["-c", "curl -LsSf https://astral.sh/uv/install.sh | sh"], env);
|
|
863
|
+
}
|
|
864
|
+
const installHome = env.HOME ?? env.USERPROFILE ?? homedir();
|
|
865
|
+
const uvBinDir = platform() === "win32"
|
|
866
|
+
? path.join(installHome, ".local", "bin")
|
|
867
|
+
: path.join(installHome, ".local", "bin");
|
|
868
|
+
const pathValue = env.PATH ?? "";
|
|
869
|
+
if (!pathValue.split(path.delimiter).includes(uvBinDir)) {
|
|
870
|
+
env.PATH = [uvBinDir, pathValue].filter(Boolean).join(path.delimiter);
|
|
871
|
+
}
|
|
872
|
+
}
|
|
844
873
|
async function installFffMcp(env) {
|
|
845
874
|
const target = fffReleaseTarget();
|
|
846
875
|
const releasesResponse = await fetch("https://api.github.com/repos/dmtrKovalenko/fff.nvim/releases");
|