为审核记录导出增加可复用的本地后台任务及 status/wait/list,等待超时或观察进程退出后任务继续执行。 统一实时脱敏诊断输出,保留 stdout 单一 JSON;补齐高级参数、预览和筛选配置摘要。 默认保留合思未找到单据,分别统计单据与审核记录,并显式报告部分补取失败。 补充 CLI/Skill 版本诊断、技能路由及回归测试,修复企业列表加载开销和源码更新测试隔离。
73 lines
2.4 KiB
TypeScript
73 lines
2.4 KiB
TypeScript
import { usageError } from "../../core/errors.js";
|
|
import { join } from "node:path";
|
|
import {
|
|
getAllLinkableHostsStatus,
|
|
getAntigravitySkillsStatus,
|
|
syncAllLinkableHosts,
|
|
syncAntigravitySkillsConfig
|
|
} from "../../core/agent-hosts/index.js";
|
|
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";
|
|
import { getSkillVersionStatus } from "../../core/skill-version.js";
|
|
import { VERSION } from "../../version.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-use")
|
|
: getDefaultGlobalSkillDir();
|
|
|
|
const result = installSkillFiles(targetDir);
|
|
const isGlobal = !isLocal && !customDir;
|
|
const antigravity = isGlobal ? syncAntigravitySkillsConfig() : undefined;
|
|
const hosts = isGlobal ? syncAllLinkableHosts() : undefined;
|
|
|
|
printJson({
|
|
installed: true,
|
|
targetDir: result.targetDir,
|
|
fileCount: result.files.length,
|
|
files: result.files,
|
|
...(antigravity ? { antigravity } : {}),
|
|
...(hosts ? { hosts } : {})
|
|
});
|
|
return;
|
|
}
|
|
|
|
if (action === "status" || action === "get" || !action) {
|
|
const globalDir = getDefaultGlobalSkillDir();
|
|
const localDir = join(process.cwd(), ".agents", "skills", "seal-use");
|
|
const antigravity = getAntigravitySkillsStatus();
|
|
const hosts = getAllLinkableHostsStatus();
|
|
printJson({
|
|
global: {
|
|
dir: globalDir,
|
|
...getSkillVersionStatus(VERSION, join(globalDir, "SKILL.md"))
|
|
},
|
|
local: {
|
|
dir: localDir,
|
|
...getSkillVersionStatus(VERSION, join(localDir, "SKILL.md"))
|
|
},
|
|
antigravity,
|
|
hosts
|
|
});
|
|
return;
|
|
}
|
|
|
|
throw usageError(`Unknown skill command: ${action}. Run 'seal-use help' for available commands.`);
|
|
}
|