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,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.`);
|
||||
}
|
||||
Reference in new issue
Block a user