metheus-governance-mcp-cli 0.2.76 → 0.2.77
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 +87 -8
- package/package.json +1 -1
package/cli.mjs
CHANGED
|
@@ -5029,6 +5029,7 @@ async function runProxy(flags) {
|
|
|
5029
5029
|
}
|
|
5030
5030
|
|
|
5031
5031
|
function runSetupInternal(flags, options = {}) {
|
|
5032
|
+
const printOutput = options.printOutput !== false;
|
|
5032
5033
|
const setupRegistrationDeps = buildSetupRegistrationDeps();
|
|
5033
5034
|
const summary = runSetupInternalFlow(
|
|
5034
5035
|
{
|
|
@@ -5039,7 +5040,10 @@ function runSetupInternal(flags, options = {}) {
|
|
|
5039
5040
|
setupRegistrationDeps,
|
|
5040
5041
|
);
|
|
5041
5042
|
const lines = buildSetupOutputLines(summary, setupRegistrationDeps);
|
|
5042
|
-
|
|
5043
|
+
if (printOutput) {
|
|
5044
|
+
process.stdout.write(`\n${lines.join("\n")}\n`);
|
|
5045
|
+
}
|
|
5046
|
+
return { summary, lines };
|
|
5043
5047
|
}
|
|
5044
5048
|
|
|
5045
5049
|
function runSetup(flags) {
|
|
@@ -5213,25 +5217,100 @@ TELEGRAM_BOT_REVIEW_TOKEN=review-token
|
|
|
5213
5217
|
}
|
|
5214
5218
|
}
|
|
5215
5219
|
|
|
5220
|
+
function bootstrapSupportsANSIColors() {
|
|
5221
|
+
if (!process.stdout?.isTTY) return false;
|
|
5222
|
+
if (process.env.NO_COLOR) return false;
|
|
5223
|
+
const term = String(process.env.TERM || "").toLowerCase();
|
|
5224
|
+
return term && term !== "dumb";
|
|
5225
|
+
}
|
|
5226
|
+
|
|
5227
|
+
function bootstrapColorText(value, colorCode) {
|
|
5228
|
+
if (!value || !bootstrapSupportsANSIColors()) return value;
|
|
5229
|
+
return `\u001b[${colorCode}m${value}\u001b[0m`;
|
|
5230
|
+
}
|
|
5231
|
+
|
|
5232
|
+
function bootstrapPadRight(value, width) {
|
|
5233
|
+
const text = String(value || "");
|
|
5234
|
+
if (text.length >= width) return text;
|
|
5235
|
+
return `${text}${" ".repeat(width - text.length)}`;
|
|
5236
|
+
}
|
|
5237
|
+
|
|
5238
|
+
function bootstrapWrapAsciiLine(value, width) {
|
|
5239
|
+
const text = String(value || "");
|
|
5240
|
+
if (!text) return [""];
|
|
5241
|
+
const lines = [];
|
|
5242
|
+
for (const rawLine of text.split(/\r?\n/)) {
|
|
5243
|
+
if (!rawLine) {
|
|
5244
|
+
lines.push("");
|
|
5245
|
+
continue;
|
|
5246
|
+
}
|
|
5247
|
+
let remaining = rawLine;
|
|
5248
|
+
while (remaining.length > width) {
|
|
5249
|
+
let breakAt = remaining.lastIndexOf(" ", width);
|
|
5250
|
+
if (breakAt <= 0) breakAt = width;
|
|
5251
|
+
lines.push(remaining.slice(0, breakAt).trimEnd());
|
|
5252
|
+
remaining = remaining.slice(breakAt).trimStart();
|
|
5253
|
+
}
|
|
5254
|
+
lines.push(remaining);
|
|
5255
|
+
}
|
|
5256
|
+
return lines;
|
|
5257
|
+
}
|
|
5258
|
+
|
|
5259
|
+
function formatBootstrapBlock(title, lines = [], { accentColor = "36" } = {}) {
|
|
5260
|
+
const innerWidth = 64;
|
|
5261
|
+
const border = `+${"-".repeat(innerWidth + 2)}+`;
|
|
5262
|
+
const output = [bootstrapColorText(border, accentColor)];
|
|
5263
|
+
const renderedTitle = `| ${bootstrapPadRight(String(title || ""), innerWidth)} |`;
|
|
5264
|
+
output.push(bootstrapColorText(renderedTitle, accentColor));
|
|
5265
|
+
for (const line of Array.isArray(lines) ? lines : [lines]) {
|
|
5266
|
+
for (const wrapped of bootstrapWrapAsciiLine(line, innerWidth)) {
|
|
5267
|
+
output.push(`| ${bootstrapPadRight(wrapped, innerWidth)} |`);
|
|
5268
|
+
}
|
|
5269
|
+
}
|
|
5270
|
+
output.push(bootstrapColorText(border, accentColor));
|
|
5271
|
+
return output.join("\n");
|
|
5272
|
+
}
|
|
5273
|
+
|
|
5216
5274
|
async function runBootstrap(flags) {
|
|
5217
|
-
process.stdout.write(
|
|
5275
|
+
process.stdout.write(
|
|
5276
|
+
`\n${formatBootstrapBlock("BOOTSTRAP", [
|
|
5277
|
+
"Check auth, ensure local templates, and keep CLI registrations in sync",
|
|
5278
|
+
], { accentColor: "35" })}\n`,
|
|
5279
|
+
);
|
|
5218
5280
|
const authFlowDeps = buildAuthFlowDeps();
|
|
5219
5281
|
let resolved = resolveCurrentAccessToken(authFlowDeps);
|
|
5220
5282
|
if (!resolved.token) {
|
|
5221
|
-
process.stdout.write(
|
|
5283
|
+
process.stdout.write(
|
|
5284
|
+
`\n${formatBootstrapBlock("BOOTSTRAP | AUTH", [
|
|
5285
|
+
"Auth token missing or expired",
|
|
5286
|
+
"Starting login flow",
|
|
5287
|
+
], { accentColor: "33" })}\n`,
|
|
5288
|
+
);
|
|
5222
5289
|
await runAuthLogin(flags, authFlowDeps);
|
|
5223
5290
|
resolved = resolveCurrentAccessToken(authFlowDeps);
|
|
5224
5291
|
if (!resolved.token) {
|
|
5225
|
-
process.stderr.write(
|
|
5292
|
+
process.stderr.write(
|
|
5293
|
+
`\n${formatBootstrapBlock("BOOTSTRAP | ERROR", [
|
|
5294
|
+
"Auth login finished but token is still unavailable.",
|
|
5295
|
+
], { accentColor: "31" })}\n`,
|
|
5296
|
+
);
|
|
5226
5297
|
process.exitCode = 1;
|
|
5227
5298
|
return;
|
|
5228
5299
|
}
|
|
5229
|
-
} else {
|
|
5230
|
-
process.stdout.write(`Auth token OK (${resolved.source}).\n`);
|
|
5231
5300
|
}
|
|
5301
|
+
process.stdout.write(
|
|
5302
|
+
`\n${formatBootstrapBlock("BOOTSTRAP | AUTH", [
|
|
5303
|
+
`Auth token OK (${resolved.source}).`,
|
|
5304
|
+
], { accentColor: "32" })}\n`,
|
|
5305
|
+
);
|
|
5232
5306
|
|
|
5233
|
-
runSetupInternal(flags, { ensureOnly: true });
|
|
5234
|
-
process.stdout.write("
|
|
5307
|
+
const { lines } = runSetupInternal(flags, { ensureOnly: true, printOutput: false });
|
|
5308
|
+
process.stdout.write(`\n${formatBootstrapBlock("BOOTSTRAP | SUMMARY", lines, { accentColor: "36" })}\n`);
|
|
5309
|
+
process.stdout.write(
|
|
5310
|
+
`\n${formatBootstrapBlock("BOOTSTRAP | DONE", [
|
|
5311
|
+
"Bootstrap complete.",
|
|
5312
|
+
], { accentColor: "32" })}\n`,
|
|
5313
|
+
);
|
|
5235
5314
|
}
|
|
5236
5315
|
|
|
5237
5316
|
async function runBot(argv) {
|