feat(skills): auto-backup skill files before uninstall

Create a local backup under ~/.cc-switch/skill-backups/ before removing
skill directories. The backup includes all skill files and a meta.json
with original skill metadata. Old backups are pruned to keep at most 20.
The backup path is returned to the frontend and shown in the success
toast. Bump version to 3.12.3.
This commit is contained in:
Jason
2026-03-15 23:26:50 +08:00
parent 04254d6ffe
commit 9336001746
20 changed files with 850 additions and 28 deletions
+9 -2
View File
@@ -27,6 +27,10 @@ export interface InstalledSkill {
installedAt: number;
}
export interface SkillUninstallResult {
backupPath?: string;
}
/** 可发现的 Skill(来自仓库) */
export interface DiscoverableSkill {
key: string;
@@ -94,7 +98,7 @@ export const skillsApi = {
},
/** 卸载 Skill(统一卸载) */
async uninstallUnified(id: string): Promise<boolean> {
async uninstallUnified(id: string): Promise<SkillUninstallResult> {
return await invoke("uninstall_skill_unified", { id });
},
@@ -139,7 +143,10 @@ export const skillsApi = {
},
/** 卸载技能(兼容旧 API) */
async uninstall(directory: string, app: AppId = "claude"): Promise<boolean> {
async uninstall(
directory: string,
app: AppId = "claude",
): Promise<SkillUninstallResult> {
if (app === "claude") {
return await invoke("uninstall_skill", { directory });
}