mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-08-03 02:51:17 +08:00
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:
@@ -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 });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user