metheus-governance-mcp-cli 0.2.288 → 0.2.289
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 +73 -35
- package/lib/local-project-dispatch.mjs +12 -1
- package/package.json +1 -1
package/cli.mjs
CHANGED
|
@@ -12292,14 +12292,18 @@ function resolveRunnerProjectUpExecutionPolicy(flags = {}) {
|
|
|
12292
12292
|
const applyRequested = Object.prototype.hasOwnProperty.call(flags, "apply")
|
|
12293
12293
|
? boolFromRaw(flags.apply, true)
|
|
12294
12294
|
: true;
|
|
12295
|
-
const explicitStartDetachedRequested = Object.prototype.hasOwnProperty.call(flags, "start-detached")
|
|
12295
|
+
const explicitStartDetachedRequested = Object.prototype.hasOwnProperty.call(flags, "start-detached")
|
|
12296
|
+
|| Object.prototype.hasOwnProperty.call(flags, "start_detached");
|
|
12296
12297
|
const explicitDetachedAliasRequested = Object.prototype.hasOwnProperty.call(flags, "detached");
|
|
12297
12298
|
const explicitStartRequested = Object.prototype.hasOwnProperty.call(flags, "start");
|
|
12298
|
-
const startRequested =
|
|
12299
|
+
const startRequested = explicitStartRequested
|
|
12299
12300
|
? boolFromRaw(flags.start, true)
|
|
12300
12301
|
: false;
|
|
12302
|
+
const startDetachedRaw = Object.prototype.hasOwnProperty.call(flags, "start-detached")
|
|
12303
|
+
? flags["start-detached"]
|
|
12304
|
+
: flags.start_detached;
|
|
12301
12305
|
const startDetachedRequested = explicitStartDetachedRequested
|
|
12302
|
-
? boolFromRaw(
|
|
12306
|
+
? boolFromRaw(startDetachedRaw, true)
|
|
12303
12307
|
: (explicitDetachedAliasRequested
|
|
12304
12308
|
? boolFromRaw(flags.detached, false)
|
|
12305
12309
|
: !explicitStartRequested);
|
|
@@ -16970,7 +16974,7 @@ function buildLocalToolSpecs() {
|
|
|
16970
16974
|
{
|
|
16971
16975
|
name: "runner.project_up",
|
|
16972
16976
|
description:
|
|
16973
|
-
"Audit one project destination, create missing runner routes, and
|
|
16977
|
+
"Audit one project destination, create missing runner routes, and let front-end/TUI flows bootstrap detached polling in one step. Pass start=false and start_detached=false for prepare-only mode, or use runner.start_detached directly when routes are already ready.",
|
|
16974
16978
|
inputSchema: buildRunnerProjectUpInputSchema(),
|
|
16975
16979
|
},
|
|
16976
16980
|
{
|
|
@@ -19407,10 +19411,24 @@ TELEGRAM_BOT_REVIEW_TOKEN=review-token
|
|
|
19407
19411
|
push("runner_project_up_probe_failure_blocks_without_existing_route", false, String(err?.message || err));
|
|
19408
19412
|
}
|
|
19409
19413
|
|
|
19410
|
-
try {
|
|
19411
|
-
const
|
|
19412
|
-
|
|
19413
|
-
|
|
19414
|
+
try {
|
|
19415
|
+
const projectUpPolicy = resolveRunnerProjectUpExecutionPolicy({ start_detached: true });
|
|
19416
|
+
push(
|
|
19417
|
+
"runner_project_up_tool_flag_accepts_start_detached_snake_case",
|
|
19418
|
+
projectUpPolicy.applyRequested === true
|
|
19419
|
+
&& projectUpPolicy.startRequested === false
|
|
19420
|
+
&& projectUpPolicy.startDetachedRequested === true
|
|
19421
|
+
&& projectUpPolicy.shouldStartRunner === true,
|
|
19422
|
+
`apply=${projectUpPolicy.applyRequested} start=${projectUpPolicy.startRequested} detached=${projectUpPolicy.startDetachedRequested} shouldStart=${projectUpPolicy.shouldStartRunner}`,
|
|
19423
|
+
);
|
|
19424
|
+
} catch (err) {
|
|
19425
|
+
push("runner_project_up_tool_flag_accepts_start_detached_snake_case", false, String(err?.message || err));
|
|
19426
|
+
}
|
|
19427
|
+
|
|
19428
|
+
try {
|
|
19429
|
+
const projectUpResponse = await handleLocalProjectToolDispatchImpl(
|
|
19430
|
+
{
|
|
19431
|
+
requestObj: {
|
|
19414
19432
|
jsonrpc: "2.0",
|
|
19415
19433
|
id: 8,
|
|
19416
19434
|
method: "tools/call",
|
|
@@ -19436,36 +19454,56 @@ TELEGRAM_BOT_REVIEW_TOKEN=review-token
|
|
|
19436
19454
|
workspaceSignalTrusted: true,
|
|
19437
19455
|
},
|
|
19438
19456
|
{
|
|
19439
|
-
...buildLocalProjectDispatchDeps(),
|
|
19440
|
-
buildRunnerProjectUpResult: async () => ({
|
|
19441
|
-
summaryPayload: {
|
|
19457
|
+
...buildLocalProjectDispatchDeps(),
|
|
19458
|
+
buildRunnerProjectUpResult: async () => ({
|
|
19459
|
+
summaryPayload: {
|
|
19442
19460
|
ok: true,
|
|
19443
19461
|
project_id: selftestProjectID,
|
|
19444
19462
|
destination_label: "Selftest Room",
|
|
19445
|
-
destination_id: "dest-1",
|
|
19446
|
-
route_apply_requested: true,
|
|
19447
|
-
route_apply_changed: true,
|
|
19448
|
-
enabled_routes_for_selection: ["telegram-monitor-selftest"],
|
|
19449
|
-
next_steps: [`${CLI_NAME} runner show --route-name telegram-monitor-selftest`],
|
|
19450
|
-
|
|
19451
|
-
|
|
19452
|
-
|
|
19453
|
-
|
|
19454
|
-
|
|
19455
|
-
|
|
19456
|
-
|
|
19457
|
-
|
|
19458
|
-
|
|
19459
|
-
|
|
19460
|
-
|
|
19461
|
-
|
|
19462
|
-
|
|
19463
|
-
|
|
19464
|
-
|
|
19465
|
-
|
|
19466
|
-
|
|
19467
|
-
|
|
19468
|
-
|
|
19463
|
+
destination_id: "dest-1",
|
|
19464
|
+
route_apply_requested: true,
|
|
19465
|
+
route_apply_changed: true,
|
|
19466
|
+
enabled_routes_for_selection: ["telegram-monitor-selftest"],
|
|
19467
|
+
next_steps: [`${CLI_NAME} runner show --route-name telegram-monitor-selftest`],
|
|
19468
|
+
start_detached_requested: true,
|
|
19469
|
+
},
|
|
19470
|
+
matchingRoutes: [{ name: "telegram-monitor-selftest" }],
|
|
19471
|
+
applyRequested: true,
|
|
19472
|
+
applyResult: { ok: true, changed: true },
|
|
19473
|
+
shouldStartRunner: true,
|
|
19474
|
+
startDetachedRequested: true,
|
|
19475
|
+
startFlags: {
|
|
19476
|
+
"project-id": selftestProjectID,
|
|
19477
|
+
provider: "telegram",
|
|
19478
|
+
"destination-id": "dest-1",
|
|
19479
|
+
},
|
|
19480
|
+
applyFailureBlocksStart: false,
|
|
19481
|
+
}),
|
|
19482
|
+
startDetachedRunnerWithFlags: async () => ({
|
|
19483
|
+
ok: true,
|
|
19484
|
+
already_running: true,
|
|
19485
|
+
registry_file: "registry.json",
|
|
19486
|
+
launch: {
|
|
19487
|
+
launch_id: "launch-project-up-1",
|
|
19488
|
+
pid: 4242,
|
|
19489
|
+
project_ids: [selftestProjectID],
|
|
19490
|
+
route_names: ["telegram-monitor-selftest"],
|
|
19491
|
+
destination_labels: ["Selftest Room"],
|
|
19492
|
+
},
|
|
19493
|
+
}),
|
|
19494
|
+
},
|
|
19495
|
+
);
|
|
19496
|
+
const projectUpStructured = safeObject(safeObject(projectUpResponse).result)?.structuredContent || {};
|
|
19497
|
+
push(
|
|
19498
|
+
"local_runner_project_up_tool_dispatches",
|
|
19499
|
+
projectUpStructured.ok === true
|
|
19500
|
+
&& ensureArray(projectUpStructured.enabled_routes_for_selection).includes("telegram-monitor-selftest")
|
|
19501
|
+
&& projectUpStructured.already_running === true
|
|
19502
|
+
&& String(safeObject(projectUpStructured.launch).launch_id || "").trim() === "launch-project-up-1",
|
|
19503
|
+
`routes=${ensureArray(projectUpStructured.enabled_routes_for_selection).join(",")} launch=${String(safeObject(projectUpStructured.launch).launch_id || "").trim() || "-"} already_running=${projectUpStructured.already_running ? "true" : "false"}`,
|
|
19504
|
+
);
|
|
19505
|
+
} catch (err) {
|
|
19506
|
+
push("local_runner_project_up_tool_dispatches", false, String(err?.message || err));
|
|
19469
19507
|
}
|
|
19470
19508
|
|
|
19471
19509
|
try {
|
|
@@ -629,13 +629,20 @@ export async function handleLocalProjectToolDispatch(
|
|
|
629
629
|
...toolArgs,
|
|
630
630
|
...(Object.prototype.hasOwnProperty.call(toolArgs, "project_id") ? {} : { project_id: resolveProjectID(toolArgs, args, workspaceDir, deps) }),
|
|
631
631
|
...(Object.prototype.hasOwnProperty.call(toolArgs, "start") ? {} : { start: false }),
|
|
632
|
-
...(Object.prototype.hasOwnProperty.call(toolArgs, "start_detached") ? {} : { start_detached:
|
|
632
|
+
...(Object.prototype.hasOwnProperty.call(toolArgs, "start_detached") ? {} : { start_detached: true }),
|
|
633
633
|
...(Object.prototype.hasOwnProperty.call(toolArgs, "json") ? {} : { json: true }),
|
|
634
634
|
};
|
|
635
635
|
const result = await buildRunnerProjectUpResult(normalizedFlags);
|
|
636
|
+
let launchPayload = null;
|
|
637
|
+
if (result.shouldStartRunner && result.startDetachedRequested && !result.applyFailureBlocksStart) {
|
|
638
|
+
launchPayload = await startDetachedRunnerWithFlags(result.startFlags, "runner.project_up");
|
|
639
|
+
}
|
|
636
640
|
const payload = {
|
|
637
641
|
...safeObject(result.summaryPayload),
|
|
638
642
|
matching_routes: ensureArray(result.matchingRoutes).map((route) => String(safeObject(route).name || "").trim()).filter(Boolean),
|
|
643
|
+
launch: safeObject(launchPayload?.launch),
|
|
644
|
+
already_running: Boolean(launchPayload?.already_running),
|
|
645
|
+
registry_file: String(launchPayload?.registry_file || safeObject(result.summaryPayload).registry_file || "").trim(),
|
|
639
646
|
};
|
|
640
647
|
const text = [
|
|
641
648
|
`ok: ${payload.ok ? "true" : "false"}`,
|
|
@@ -644,6 +651,10 @@ export async function handleLocalProjectToolDispatch(
|
|
|
644
651
|
`destination_id: ${String(payload.destination_id || "").trim() || "-"}`,
|
|
645
652
|
`route_apply_requested: ${payload.route_apply_requested ? "true" : "false"}`,
|
|
646
653
|
`route_apply_changed: ${payload.route_apply_changed ? "true" : "false"}`,
|
|
654
|
+
`start_detached_requested: ${payload.start_detached_requested ? "true" : "false"}`,
|
|
655
|
+
`already_running: ${payload.already_running ? "true" : "false"}`,
|
|
656
|
+
`launch_id: ${String(safeObject(payload.launch).launch_id || "").trim() || "-"}`,
|
|
657
|
+
`pid: ${String(safeObject(payload.launch).pid || "").trim() || "-"}`,
|
|
647
658
|
`enabled_routes_for_selection: ${ensureArray(payload.enabled_routes_for_selection).join(", ") || "-"}`,
|
|
648
659
|
`next_steps: ${ensureArray(payload.next_steps).join(" | ") || "-"}`,
|
|
649
660
|
].join("\n");
|