metheus-governance-mcp-cli 0.2.12 → 0.2.13
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 -13
- package/package.json +1 -1
package/cli.mjs
CHANGED
|
@@ -35,12 +35,12 @@ function printUsage() {
|
|
|
35
35
|
"Metheus Governance MCP CLI",
|
|
36
36
|
"",
|
|
37
37
|
"Usage:",
|
|
38
|
-
` ${cmd} [--project-id <uuid>] [--ctxpack-key <key>] [--base-url <url>] [--workspace-dir <path>] [--flow <auto|device|callback|manual>]`,
|
|
38
|
+
` ${cmd} [--project-id <uuid>] [--ctxpack-key <key>] [--base-url <url>] [--workspace-dir <path|auto>] [--flow <auto|device|callback|manual>]`,
|
|
39
39
|
` ${cmd} init [--project-id <uuid>] [--ctxpack-key <key>] [--base-url <url>] [--flow <auto|device|callback|manual>]`,
|
|
40
|
-
` ${cmd} setup [--project-id <uuid>] [--ctxpack-key <key>] [--base-url <url>] [--workspace-dir <path>] [--name <server_name>]`,
|
|
40
|
+
` ${cmd} setup [--project-id <uuid>] [--ctxpack-key <key>] [--base-url <url>] [--workspace-dir <path|auto>] [--name <server_name>]`,
|
|
41
41
|
` ${cmd} doctor [--project-id <uuid>] [--ctxpack-key <key>] [--base-url <url>] [--timeout-seconds <n>]`,
|
|
42
|
-
` ${cmd} proxy [--project-id <uuid>] [--ctxpack-key <key>] [--base-url <url>] [--workspace-dir <path>] [--include-drafts <true|false>] [--auto-pull-on-conflict <true|false>] [--timeout-seconds <n>]`,
|
|
43
|
-
` ${cmd} ctxpack pull [--project-id <uuid>] [--base-url <url>] [--workspace-dir <path>] [--paths <csv>] [--timeout-seconds <n>]`,
|
|
42
|
+
` ${cmd} proxy [--project-id <uuid>] [--ctxpack-key <key>] [--base-url <url>] [--workspace-dir <path|auto>] [--include-drafts <true|false>] [--auto-pull-on-conflict <true|false>] [--timeout-seconds <n>]`,
|
|
43
|
+
` ${cmd} ctxpack pull [--project-id <uuid>] [--base-url <url>] [--workspace-dir <path|auto>] [--paths <csv>] [--timeout-seconds <n>]`,
|
|
44
44
|
` ${cmd} auth status`,
|
|
45
45
|
` ${cmd} auth login [--base-url <url>] [--flow <auto|device|callback|manual>] [--keycloak-url <url>] [--realm <name>] [--client-id <id>] [--open-browser <true|false>] [--callback-port <n>] [--timeout-seconds <n>] [--manual <true|false>]`,
|
|
46
46
|
` ${cmd} auth set --token <jwt> [--refresh-token <token>] [--base-url <url>]`,
|
|
@@ -285,6 +285,13 @@ function resolveWorkspaceDir(rawPath) {
|
|
|
285
285
|
return path.resolve(process.cwd());
|
|
286
286
|
}
|
|
287
287
|
|
|
288
|
+
function isAutoWorkspaceMode(rawValue) {
|
|
289
|
+
const value = String(rawValue || "")
|
|
290
|
+
.trim()
|
|
291
|
+
.toLowerCase();
|
|
292
|
+
return value === "auto" || value === "dynamic" || value === "client";
|
|
293
|
+
}
|
|
294
|
+
|
|
288
295
|
function fileURIToLocalPath(rawValue) {
|
|
289
296
|
const value = String(rawValue || "").trim();
|
|
290
297
|
if (!value || !/^file:\/\//i.test(value)) return "";
|
|
@@ -4004,13 +4011,17 @@ function resolveSetupContext(flags) {
|
|
|
4004
4011
|
const ctxpackKey = String(flags["ctxpack-key"] || buildCtxpackKeyFromMeta(workspaceMeta) || "").trim();
|
|
4005
4012
|
const baseURL = String(flags["base-url"] || DEFAULT_SITE_URL).trim().replace(/\/+$/, "");
|
|
4006
4013
|
const workspaceDirRaw = String(flags["workspace-dir"] || "").trim();
|
|
4007
|
-
const
|
|
4008
|
-
const
|
|
4014
|
+
const workspaceAutoMode = isAutoWorkspaceMode(workspaceDirRaw);
|
|
4015
|
+
const hasWorkspaceDirFlag = workspaceDirRaw.length > 0;
|
|
4016
|
+
const shouldPinWorkspaceDir = !workspaceAutoMode;
|
|
4017
|
+
const workspaceDir = resolveWorkspaceDir(
|
|
4018
|
+
hasWorkspaceDirFlag && !workspaceAutoMode ? workspaceDirRaw : process.cwd(),
|
|
4019
|
+
);
|
|
4009
4020
|
const serverName = String(flags.name || DEFAULT_SERVER_NAME).trim() || DEFAULT_SERVER_NAME;
|
|
4010
4021
|
const proxyArgs = ["--base-url", `${baseURL}/governance/mcp`];
|
|
4011
|
-
// Default mode
|
|
4012
|
-
//
|
|
4013
|
-
if (
|
|
4022
|
+
// Default mode pins workspace path to where setup/init runs.
|
|
4023
|
+
// Use --workspace-dir auto when runtime auto-detection is preferred.
|
|
4024
|
+
if (shouldPinWorkspaceDir) {
|
|
4014
4025
|
proxyArgs.push("--workspace-dir", workspaceDir);
|
|
4015
4026
|
}
|
|
4016
4027
|
if (projectID) proxyArgs.push("--project-id", projectID);
|
|
@@ -4020,7 +4031,8 @@ function resolveSetupContext(flags) {
|
|
|
4020
4031
|
ctxpackKey,
|
|
4021
4032
|
baseURL,
|
|
4022
4033
|
workspaceDir,
|
|
4023
|
-
|
|
4034
|
+
shouldPinWorkspaceDir,
|
|
4035
|
+
workspaceAutoMode,
|
|
4024
4036
|
serverName,
|
|
4025
4037
|
proxyArgs,
|
|
4026
4038
|
};
|
|
@@ -4052,9 +4064,7 @@ function runSetupInternal(flags, options = {}) {
|
|
|
4052
4064
|
process.stdout.write(ensureOnly ? "\nEnsure complete.\n" : "\nInstall complete.\n");
|
|
4053
4065
|
process.stdout.write(`Server: ${context.serverName}\n`);
|
|
4054
4066
|
process.stdout.write(`Gateway: ${context.baseURL}/governance/mcp\n`);
|
|
4055
|
-
process.stdout.write(
|
|
4056
|
-
`Workspace: ${context.hasExplicitWorkspaceDir ? context.workspaceDir : "auto (client current folder)"}\n`,
|
|
4057
|
-
);
|
|
4067
|
+
process.stdout.write(`Workspace: ${context.shouldPinWorkspaceDir ? context.workspaceDir : "auto (client current folder)"}\n`);
|
|
4058
4068
|
process.stdout.write(`Project: ${context.projectID || "auto-detect from .metheus_ctxpack_sync.json"}\n`);
|
|
4059
4069
|
if (context.ctxpackKey) {
|
|
4060
4070
|
process.stdout.write(`Ctxpack: ${context.ctxpackKey}\n`);
|