Add runtime detection and unified mcp and probe CLI commands

This commit is contained in:
gitea committed 2026-08-25 13:49:00 +08:00
1 parent 551fb9177f
commit b109f3f49f
8 files changed
+118 -19

No files matched your search

+19 -1
View File
@@ -24,6 +24,8 @@ import { clearCorpTokenCache } from "../core/auth/token-store.js";
import { getHoseProvisionalAuthLink } from "../core/auth/hose.js";
import { VERSION } from "../version.js";
import { runServiceCommand, serviceStatus, type ServiceConfig } from "./service.js";
import { startServer } from "../server.js";
import { runProbe } from "../probe.js";
const DEFAULT_APP_ROOT = dirname(dirname(dirname(fileURLToPath(import.meta.url))));
const STATE_DIR = join(homedir(), ".config", "seal-home");
@@ -50,7 +52,10 @@ const KNOWN_AREAS = new Set([
"context",
"rules",
"approval-runs",
"simulation"
"simulation",
"mcp",
"server",
"probe"
]);
type ParsedArgs = {
@@ -198,6 +203,17 @@ async function dispatch(argv: string[], runtime: CliRuntime) {
return;
}
if (area === "mcp" || area === "server") {
await startServer();
return;
}
if (area === "probe") {
const corpId = maybeName ?? stringOption(args.options.corp) ?? (action && action !== "--corp" ? action : undefined);
await runProbe({ corpId });
return;
}
if (area === "service") {
const result = await runServiceCommand(action, {
appRoot: runtime.appRoot,
@@ -1561,6 +1577,8 @@ function printHelp() {
Usage:
seal-home version
seal-home mcp
seal-home probe [<corpId>]
seal-home config paths
seal-home config get
seal-home config mode <stateful|stateless> [--corp <corpId>]
+5 -1
View File
@@ -133,7 +133,11 @@ function isSealHomeProcess(pid: number, appRoot: string) {
try {
const command = execFileSync("ps", ["-p", String(pid), "-o", "command="], { encoding: "utf8" });
return command.includes(appRoot) && command.includes("service") && command.includes("run");
const matchesTarget =
command.includes(appRoot) ||
command.includes("seal-home") ||
command.includes("src/cli.ts");
return matchesTarget && command.includes("service") && command.includes("run");
} catch {
return false;
}