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
@@ -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 };
|
||||
}
|
||||
Reference in new issue
Block a user