metheus-governance-mcp-cli 0.2.32 → 0.2.34
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 +23 -0
- package/package.json +1 -1
package/cli.mjs
CHANGED
|
@@ -516,6 +516,8 @@ function isEditorInstallDirectory(candidatePath) {
|
|
|
516
516
|
// Guard against runtime cwd/env resolving to editor installation directory
|
|
517
517
|
// instead of the actual opened workspace.
|
|
518
518
|
if (normalized.includes("\\appdata\\local\\programs\\microsoft vs code")) return true;
|
|
519
|
+
if (normalized.includes("\\appdata\\local\\programs\\antigravity")) return true;
|
|
520
|
+
if (normalized.includes("\\appdata\\local\\programs\\cursor")) return true;
|
|
519
521
|
if (normalized.includes("\\program files\\microsoft vs code")) return true;
|
|
520
522
|
if (normalized.includes("\\program files (x86)\\microsoft vs code")) return true;
|
|
521
523
|
return false;
|
|
@@ -4029,6 +4031,15 @@ async function runProxy(flags) {
|
|
|
4029
4031
|
timeoutSeconds: intFromRaw(flags["timeout-seconds"], 30),
|
|
4030
4032
|
};
|
|
4031
4033
|
const gatewayURL = buildGatewayURL(args);
|
|
4034
|
+
// Diagnostic: log workspace resolution context to file for debugging.
|
|
4035
|
+
try {
|
|
4036
|
+
const _diagDir = path.join(String(process.env.USERPROFILE || process.env.HOME || "."), ".metheus");
|
|
4037
|
+
fs.mkdirSync(_diagDir, { recursive: true });
|
|
4038
|
+
fs.appendFileSync(
|
|
4039
|
+
path.join(_diagDir, "mcp-proxy-diag.log"),
|
|
4040
|
+
`[${new Date().toISOString()}] boot: cwd=${process.cwd()} workspace-dir=${workspaceDirRaw} autoMode=${workspaceAutoMode} pinned=${pinnedWorkspaceDir || "(none)"} METHEUS_WORKSPACE_DIR=${process.env.METHEUS_WORKSPACE_DIR || "(unset)"}\n`,
|
|
4041
|
+
);
|
|
4042
|
+
} catch { /* best-effort */ }
|
|
4032
4043
|
let lastRefreshAttemptAtMs = 0;
|
|
4033
4044
|
let lastRefreshError = "";
|
|
4034
4045
|
let sessionWorkspaceDir = "";
|
|
@@ -4106,6 +4117,9 @@ async function runProxy(flags) {
|
|
|
4106
4117
|
const currentCwdCandidate = sanitizeWorkspaceCandidate(process.cwd());
|
|
4107
4118
|
if (currentCwdCandidate && !isHomeWorkspaceRoot(currentCwdCandidate)) {
|
|
4108
4119
|
sessionWorkspaceDir = currentCwdCandidate;
|
|
4120
|
+
// VS Code forks (Antigravity, Cursor) set cwd to workspace folder
|
|
4121
|
+
// when spawning MCP server processes, so treat plausible cwd as trusted.
|
|
4122
|
+
sessionWorkspaceTrusted = true;
|
|
4109
4123
|
}
|
|
4110
4124
|
}
|
|
4111
4125
|
if (strongEnvWorkspaceCandidate) {
|
|
@@ -4126,6 +4140,15 @@ async function runProxy(flags) {
|
|
|
4126
4140
|
requestObj,
|
|
4127
4141
|
toolArgs,
|
|
4128
4142
|
);
|
|
4143
|
+
if (isJsonRpcMethod(requestObj, "tools/call")) {
|
|
4144
|
+
try {
|
|
4145
|
+
const _diagDir = path.join(String(process.env.USERPROFILE || process.env.HOME || "."), ".metheus");
|
|
4146
|
+
fs.appendFileSync(
|
|
4147
|
+
path.join(_diagDir, "mcp-proxy-diag.log"),
|
|
4148
|
+
`[${new Date().toISOString()}] tools/call: tool=${toolName} sessionWS=${sessionWorkspaceDir} resolvedWS=${requestWorkspaceDir} trusted=${workspaceSignalTrusted} strongReq=${strongRequestWorkspaceCandidate || "(none)"} strongEnv=${strongEnvWorkspaceCandidate || "(none)"}\n`,
|
|
4149
|
+
);
|
|
4150
|
+
} catch { /* best-effort */ }
|
|
4151
|
+
}
|
|
4129
4152
|
let autoSyncSummary = null;
|
|
4130
4153
|
if (isJsonRpcMethod(requestObj, "tools/call")) {
|
|
4131
4154
|
autoSyncSummary = await maybeAutoSyncCtxpackForCall({
|