metheus-governance-mcp-cli 0.2.16 → 0.2.17
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/cli.mjs +16 -6
- package/package.json +1 -1
package/cli.mjs
CHANGED
|
@@ -4017,16 +4017,24 @@ function commandExists(bin) {
|
|
|
4017
4017
|
return check.status === 0;
|
|
4018
4018
|
}
|
|
4019
4019
|
|
|
4020
|
-
function tryRegister(cliBin, serverName, proxyArgs) {
|
|
4020
|
+
function tryRegister(cliBin, serverName, proxyArgs, options = {}) {
|
|
4021
4021
|
const selfPath = fileURLToPath(import.meta.url);
|
|
4022
4022
|
const baseAddArgs =
|
|
4023
4023
|
cliBin === "claude"
|
|
4024
4024
|
? ["mcp", "add", "--scope", "user", serverName]
|
|
4025
4025
|
: ["mcp", "add", serverName];
|
|
4026
|
-
const
|
|
4027
|
-
|
|
4028
|
-
|
|
4029
|
-
|
|
4026
|
+
const workspaceEnv = String(options.workspaceDir || "").trim();
|
|
4027
|
+
const codexEnvArgs =
|
|
4028
|
+
cliBin === "codex" && workspaceEnv
|
|
4029
|
+
? ["--env", `METHEUS_WORKSPACE_DIR=${workspaceEnv}`]
|
|
4030
|
+
: [];
|
|
4031
|
+
const attempts = [];
|
|
4032
|
+
if (codexEnvArgs.length > 0) {
|
|
4033
|
+
attempts.push([...baseAddArgs, ...codexEnvArgs, "--", process.execPath, selfPath, "proxy", ...proxyArgs]);
|
|
4034
|
+
attempts.push([...baseAddArgs, ...codexEnvArgs, process.execPath, selfPath, "proxy", ...proxyArgs]);
|
|
4035
|
+
}
|
|
4036
|
+
attempts.push([...baseAddArgs, "--", process.execPath, selfPath, "proxy", ...proxyArgs]);
|
|
4037
|
+
attempts.push([...baseAddArgs, process.execPath, selfPath, "proxy", ...proxyArgs]);
|
|
4030
4038
|
for (const args of attempts) {
|
|
4031
4039
|
const run = runCLICommand(cliBin, args, { stdio: "inherit" });
|
|
4032
4040
|
if (run.status === 0) return true;
|
|
@@ -4102,7 +4110,9 @@ function runSetupInternal(flags, options = {}) {
|
|
|
4102
4110
|
if (!ensureOnly || alreadyRegistered) {
|
|
4103
4111
|
runRemove(cliBin, context.serverName);
|
|
4104
4112
|
}
|
|
4105
|
-
const ok = tryRegister(cliBin, context.serverName, context.proxyArgs
|
|
4113
|
+
const ok = tryRegister(cliBin, context.serverName, context.proxyArgs, {
|
|
4114
|
+
workspaceDir: context.workspaceDir,
|
|
4115
|
+
});
|
|
4106
4116
|
const action = ensureOnly
|
|
4107
4117
|
? alreadyRegistered
|
|
4108
4118
|
? "updated"
|