import type { CommandContext, VersionRecord } from '../types.js'; /** * 检查目录是否存在 */ export declare function dirExists(dir: string): Promise; /** * 确保目录存在 */ export declare function ensureDir(dir: string): Promise; /** * 递归复制目录(保留 .sh 文件执行权限) */ export declare function copyDirWithPerms(src: string, dest: string): Promise; /** * 递归复制目录(通用,不处理权限) */ export declare function copyDir(src: string, dest: string): Promise; /** * 递归删除目录 */ export declare function removeDir(dir: string): Promise; /** * 删除文件 */ export declare function removeFile(filePath: string): Promise; /** * 读取版本记录文件 */ export declare function readVersionFile(versionFilePath: string): Promise; /** * 读取安装记录。兼容旧版本曾写入 skill 目录内的隐藏记录文件。 */ export declare function readVersionRecord(ctx: CommandContext): Promise; export interface InstalledSkillPath { skillName: string; skillDir: string; } /** * 将安装记录中的 skill 名称限制在当前包白名单内,并确保删除路径仍位于目标目录下。 */ export declare function resolveInstalledSkillPaths(targetDir: string, recordedSkillNames: unknown, allowedSkillNames: readonly string[]): InstalledSkillPath[]; export type VersionRecordWriteLocation = 'config' | 'legacy'; /** * 将旧版 skill 目录内的隐藏安装记录迁移到用户配置目录;若用户配置目录不可写, * 保留并更新 skill 目录内的兼容记录。 */ export declare function migrateVersionRecord(ctx: CommandContext, record: VersionRecord): Promise; /** * 写入版本记录文件 */ export declare function writeVersionFile(versionFilePath: string, record: VersionRecord): Promise; /** * 写入安装记录。优先写入用户配置目录;若当前环境无法写入该目录, * 降级写入 skill 目录内的旧版兼容记录文件。 */ export declare function writeVersionRecordWithFallback(ctx: CommandContext, record: VersionRecord): Promise; /** * 安装 Skill 文件到目标目录 * 从包内 skill/ 目录复制 SKILL.md + references/ 到目标 skills 目录 */ export declare function installSkillFiles(packageRoot: string, targetDir: string): Promise; export interface ExactSkillInstallOptions { transactionId?: string; } /** * 原子安装到已经确定的单个 Skill 目录。自更新使用事务 ID,便于超时恢复。 */ export declare function installSkillFilesAtPath(packageRoot: string, skillTargetDir: string, options?: ExactSkillInstallOptions): Promise; /** * 检查 skill 是否已安装 */ export declare function isSkillInstalled(targetDir: string, skillName: string): Promise; /** * 获取目标目录中已存在的 skills */ export declare function getExistingSkills(targetDir: string, skillNames: string[]): Promise; //# sourceMappingURL=file.d.ts.map