Add embedded skill exporter and mcp config subcommands and bump to v0.7.0
This commit is contained in:
1 parent
ce06d8f600
commit
f1380873e4
13 files changed
+3393
-1505
No files matched your search
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "seal-home",
|
||||
"version": "0.6.0",
|
||||
"version": "0.7.0",
|
||||
"description": "Seal Home tenant operations: approval-run diagnosis, minimal rule remediation, delegation links, Hose/合思 authorization, users, rules, billing, and search.",
|
||||
"author": {
|
||||
"name": "yingqing"
|
||||
|
||||
Vendored
+3150
-1496
File diff suppressed because it is too large.
Load diff
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "seal-home",
|
||||
"version": "0.6.0",
|
||||
"version": "0.7.0",
|
||||
"type": "module",
|
||||
"module": "src/server.ts",
|
||||
"bin": {
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
---
|
||||
name: seal-home
|
||||
description: "v0.6.0: Use when working with Seal Home tenant operations: packaged customer feedback from WeChat or screenshots, target-enterprise discovery, approval-run and Langfuse diagnosis, simulation test batch creation and publishing, minimal approval-rule remediation and publishing, delegation links, Hose/合思 authorization, LLM config, permissions, billing, users, rules, documents, and search."
|
||||
description: "v0.7.0: Use when working with Seal Home tenant operations: packaged customer feedback from WeChat or screenshots, target-enterprise discovery, approval-run and Langfuse diagnosis, simulation test batch creation and publishing, minimal approval-rule remediation and publishing, delegation links, Hose/合思 authorization, LLM config, permissions, billing, users, rules, documents, and search."
|
||||
metadata:
|
||||
version: 0.6.0
|
||||
short-description: Seal tenant and Hose approval automation (v0.6.0)
|
||||
version: 0.7.0
|
||||
short-description: Seal tenant and Hose approval automation (v0.7.0)
|
||||
---
|
||||
|
||||
# Seal Home (v0.6.0)
|
||||
# Seal Home (v0.7.0)
|
||||
|
||||
Use the `seal_cli` MCP tool when it is available; pass the command string as its `command` argument. If MCP is unavailable, fall back to the global `seal-home` CLI. This skill is a routing layer for agents: keep this file short, choose the right command, and read a focused reference only when the task needs detail.
|
||||
|
||||
|
||||
@@ -120,6 +120,42 @@ describe("CLI version & help handling", () => {
|
||||
expect(parsed.mode).toBe("source");
|
||||
expect(parsed.version).toBe(VERSION);
|
||||
});
|
||||
|
||||
test("mcp-config outputs valid mcp configuration json", () => {
|
||||
const result = runCli(["mcp-config"]);
|
||||
expect(result.status).toBe(0);
|
||||
const parsed = JSON.parse(result.stdout.trim());
|
||||
expect(parsed.mcpServers["seal-home"]).toMatchObject({
|
||||
command: "seal-home",
|
||||
args: ["mcp"]
|
||||
});
|
||||
});
|
||||
|
||||
test("skill dump outputs embedded skill markdown", () => {
|
||||
const result = runCli(["skill", "dump"]);
|
||||
expect(result.status).toBe(0);
|
||||
expect(result.stdout).toContain("name: seal-home");
|
||||
expect(result.stdout).toContain("# Seal Home");
|
||||
});
|
||||
|
||||
test("skill status outputs installation directories", () => {
|
||||
const result = runCli(["skill", "status"]);
|
||||
expect(result.status).toBe(0);
|
||||
const parsed = JSON.parse(result.stdout.trim());
|
||||
expect(parsed.global).toHaveProperty("dir");
|
||||
expect(parsed.local).toHaveProperty("dir");
|
||||
});
|
||||
|
||||
test("skill install writes files to specified directory", () => {
|
||||
const tmp = mkdtempSync(join(tmpdir(), "cli-skill-install-"));
|
||||
tempDirs.push(tmp);
|
||||
const result = runCli(["skill", "install", "--dir", tmp]);
|
||||
expect(result.status).toBe(0);
|
||||
const parsed = JSON.parse(result.stdout.trim());
|
||||
expect(parsed.installed).toBe(true);
|
||||
expect(parsed.targetDir).toBe(tmp);
|
||||
expect(parsed.fileCount).toBeGreaterThan(5);
|
||||
});
|
||||
});
|
||||
|
||||
function makeConfigEnv(): Record<string, string> {
|
||||
|
||||
+23
-1
@@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -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.`);
|
||||
}
|
||||
@@ -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 {
|
||||
|
||||
@@ -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
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
import { describe, expect, test } from "bun:test";
|
||||
import { mkdtempSync, rmSync, existsSync } from "node:fs";
|
||||
import { tmpdir } from "node:os";
|
||||
import { join } from "node:path";
|
||||
import { EMBEDDED_SKILL_FILES, getSkillContent, installSkillFiles } from "./embedded-skill.js";
|
||||
|
||||
describe("embedded-skill", () => {
|
||||
test("embeds SKILL.md and reference files", () => {
|
||||
expect(EMBEDDED_SKILL_FILES["SKILL.md"]).toBeDefined();
|
||||
expect(EMBEDDED_SKILL_FILES["SKILL.md"]).toContain("name: seal-home");
|
||||
expect(EMBEDDED_SKILL_FILES["references/cli.md"]).toBeDefined();
|
||||
expect(getSkillContent()).toContain("name: seal-home");
|
||||
});
|
||||
|
||||
test("installSkillFiles writes all embedded files to target directory", () => {
|
||||
const tmp = mkdtempSync(join(tmpdir(), "skill-test-"));
|
||||
try {
|
||||
const res = installSkillFiles(tmp);
|
||||
expect(res.targetDir).toBe(tmp);
|
||||
expect(res.files.length).toBeGreaterThan(5);
|
||||
expect(existsSync(join(tmp, "SKILL.md"))).toBe(true);
|
||||
expect(existsSync(join(tmp, "references", "cli.md"))).toBe(true);
|
||||
} finally {
|
||||
rmSync(tmp, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,59 @@
|
||||
import { existsSync, mkdirSync, writeFileSync } from "node:fs";
|
||||
import { homedir } from "node:os";
|
||||
import { dirname, join } from "node:path";
|
||||
|
||||
import skillMain from "../../skills/seal-home/SKILL.md" with { type: "text" };
|
||||
import agentOpenAi from "../../skills/seal-home/agents/openai.yaml" with { type: "text" };
|
||||
import refRuleLightweight from "../../skills/seal-home/references/rule-lightweight.md" with { type: "text" };
|
||||
import refApprovalBadCases from "../../skills/seal-home/references/approval-bad-cases.md" with { type: "text" };
|
||||
import refCli from "../../skills/seal-home/references/cli.md" with { type: "text" };
|
||||
import refApprovalRunLightweight from "../../skills/seal-home/references/approval-run-lightweight.md" with { type: "text" };
|
||||
import refApprovalAttachmentTrace from "../../skills/seal-home/references/approval-attachment-trace.md" with { type: "text" };
|
||||
import refCustomerFeedbackRuleRemediation from "../../skills/seal-home/references/customer-feedback-rule-remediation.md" with { type: "text" };
|
||||
import refHoseEnterpriseAuth from "../../skills/seal-home/references/hose-enterprise-auth.md" with { type: "text" };
|
||||
|
||||
export const EMBEDDED_SKILL_FILES: Record<string, string> = {
|
||||
"SKILL.md": skillMain,
|
||||
"agents/openai.yaml": agentOpenAi,
|
||||
"references/rule-lightweight.md": refRuleLightweight,
|
||||
"references/approval-bad-cases.md": refApprovalBadCases,
|
||||
"references/cli.md": refCli,
|
||||
"references/approval-run-lightweight.md": refApprovalRunLightweight,
|
||||
"references/approval-attachment-trace.md": refApprovalAttachmentTrace,
|
||||
"references/customer-feedback-rule-remediation.md": refCustomerFeedbackRuleRemediation,
|
||||
"references/hose-enterprise-auth.md": refHoseEnterpriseAuth
|
||||
};
|
||||
|
||||
export function getSkillContent(): string {
|
||||
return EMBEDDED_SKILL_FILES["SKILL.md"] || "";
|
||||
}
|
||||
|
||||
export function getDefaultGlobalSkillDir(): string {
|
||||
return join(homedir(), ".agents", "skills", "seal-home");
|
||||
}
|
||||
|
||||
export function installSkillFiles(targetDir: string = getDefaultGlobalSkillDir()): { targetDir: string; files: string[] } {
|
||||
mkdirSync(targetDir, { recursive: true });
|
||||
const installed: string[] = [];
|
||||
|
||||
for (const [relPath, content] of Object.entries(EMBEDDED_SKILL_FILES)) {
|
||||
const fullPath = join(targetDir, relPath);
|
||||
mkdirSync(dirname(fullPath), { recursive: true });
|
||||
writeFileSync(fullPath, content, "utf8");
|
||||
installed.push(relPath);
|
||||
}
|
||||
|
||||
return {
|
||||
targetDir,
|
||||
files: installed
|
||||
};
|
||||
}
|
||||
|
||||
export function syncGlobalSkillIfPresent(): { synced: boolean; targetDir?: string } {
|
||||
const globalDir = getDefaultGlobalSkillDir();
|
||||
if (existsSync(globalDir)) {
|
||||
installSkillFiles(globalDir);
|
||||
return { synced: true, targetDir: globalDir };
|
||||
}
|
||||
return { synced: false };
|
||||
}
|
||||
Vendored
+14
@@ -0,0 +1,14 @@
|
||||
declare module "*.md" {
|
||||
const content: string;
|
||||
export default content;
|
||||
}
|
||||
|
||||
declare module "*.yaml" {
|
||||
const content: string;
|
||||
export default content;
|
||||
}
|
||||
|
||||
declare module "*.yml" {
|
||||
const content: string;
|
||||
export default content;
|
||||
}
|
||||
Reference in new issue
Block a user