Add embedded skill exporter and mcp config subcommands and bump to v0.7.0

This commit is contained in:
gitea committed 2026-08-25 14:17:12 +08:00
1 parent ce06d8f600
commit f1380873e4
13 files changed
+3393 -1505

No files matched your search

+23 -1
View File
@@ -1,5 +1,27 @@
import { startServer } from "../../server.js";
import { printJson } from "../printer.js";
import type { ParsedArgs } from "../types.js";
export async function handleMcpCommand(action: string | undefined, args: ParsedArgs) {
if (action === "config" || action === "json") {
printMcpConfig();
return;
}
export async function handleMcpCommand() {
await startServer();
}
export function printMcpConfig() {
printJson({
mcpServers: {
"seal-home": {
type: "stdio",
command: "seal-home",
args: ["mcp"],
env: {
SEAL_HOME_MCP_ENABLED: "true"
}
}
}
});
}
+54
View File
@@ -0,0 +1,54 @@
import { existsSync } from "node:fs";
import { join } from "node:path";
import {
getDefaultGlobalSkillDir,
getSkillContent,
installSkillFiles
} from "../../core/embedded-skill.js";
import { booleanOption, stringOption } from "../parser.js";
import { printJson } from "../printer.js";
import type { ParsedArgs } from "../types.js";
export function handleSkillCommand(action: string | undefined, maybeName: string | undefined, args: ParsedArgs) {
if (action === "dump" || action === "cat" || action === "show") {
process.stdout.write(`${getSkillContent()}\n`);
return;
}
if (action === "install" || action === "init" || action === "sync") {
const isLocal = booleanOption(args.options.local) || booleanOption(args.options.workspace);
const customDir = stringOption(args.options.dir) ?? stringOption(args.options.target) ?? maybeName;
const targetDir = customDir
? customDir
: isLocal
? join(process.cwd(), ".agents", "skills", "seal-home")
: getDefaultGlobalSkillDir();
const result = installSkillFiles(targetDir);
printJson({
installed: true,
targetDir: result.targetDir,
fileCount: result.files.length,
files: result.files
});
return;
}
if (action === "status" || action === "get" || !action) {
const globalDir = getDefaultGlobalSkillDir();
const localDir = join(process.cwd(), ".agents", "skills", "seal-home");
printJson({
global: {
dir: globalDir,
installed: existsSync(join(globalDir, "SKILL.md"))
},
local: {
dir: localDir,
installed: existsSync(join(localDir, "SKILL.md"))
}
});
return;
}
throw new Error(`Unknown skill command: ${action}. Run 'seal-home help' for available commands.`);
}
+4
View File
@@ -2,6 +2,7 @@ import { chmodSync, existsSync, mkdirSync, readFileSync, renameSync, rmSync, unl
import { dirname, join } from "node:path";
import { spawnSync } from "node:child_process";
import { isCompiledBinary } from "../../core/runtime.js";
import { syncGlobalSkillIfPresent } from "../../core/embedded-skill.js";
import { VERSION } from "../../version.js";
import { runServiceCommand, serviceStatus } from "../service.js";
import { printJson } from "../printer.js";
@@ -147,11 +148,14 @@ export async function handleUpdateCommand(runtime: CliRuntime, options: UpdateOp
if (wasRunning) await runServiceCommand("start", serviceConfig);
const skillSync = syncGlobalSkillIfPresent();
printJson({
updated: true,
fromVersion: VERSION,
toVersion: latestVersion,
serviceRestarted: wasRunning,
skillSynced: skillSync.synced ? skillSync.targetDir : false,
mode: "binary"
});
} finally {
+5
View File
@@ -75,6 +75,11 @@ export function printHelp() {
Usage:
seal-home version
seal-home mcp
seal-home mcp config
seal-home mcp-config
seal-home skill dump
seal-home skill install [--dir <path>|--local]
seal-home skill status
seal-home probe [<corpId>]
seal-home config paths
seal-home config get
+15 -2
View File
@@ -12,12 +12,13 @@ import { handleContextCommand } from "./commands/context.js";
import { handleCorpsCommand } from "./commands/corps.js";
import { handleDelegationCommand } from "./commands/delegation.js";
import { handleLlmCommand } from "./commands/llm.js";
import { handleMcpCommand } from "./commands/mcp.js";
import { handleMcpCommand, printMcpConfig } from "./commands/mcp.js";
import { handlePermissionsCommand } from "./commands/permissions.js";
import { handleProbeCommand } from "./commands/probe.js";
import { handleRulesCommand } from "./commands/rules.js";
import { handleServiceCommand } from "./commands/service.js";
import { handleSimulationCommand } from "./commands/simulation.js";
import { handleSkillCommand } from "./commands/skill.js";
import { handleSourceCommand } from "./commands/source.js";
import { handleToolCommand } from "./commands/tool.js";
import { handleToolsListCommand } from "./commands/tools.js";
@@ -58,6 +59,8 @@ const KNOWN_AREAS = new Set([
"simulation",
"mcp",
"server",
"mcp-config",
"skill",
"probe"
]);
@@ -141,8 +144,18 @@ async function dispatch(argv: string[], runtime: CliRuntime) {
throw new Error(`Unknown command: ${args.command.join(" ")}. Run 'seal-home help' for available commands.`);
}
if (area === "mcp-config") {
printMcpConfig();
return;
}
if (area === "skill") {
handleSkillCommand(action, maybeName, args);
return;
}
if (area === "mcp" || area === "server") {
await handleMcpCommand();
await handleMcpCommand(action, args);
return;
}