feat(skills): add restore and delete for skill backups

Introduce list/restore/delete commands for skill backups created during
uninstall. Restore copies files back to SSOT, saves the DB record, and
syncs to the current app with rollback on failure. Delete removes the
backup directory after a confirmation dialog. ConfirmDialog gains a
configurable zIndex prop to support nested dialog stacking.
This commit is contained in:
Jason
2026-03-16 00:00:31 +08:00
parent 9336001746
commit 333c9f277b
12 changed files with 678 additions and 3 deletions
+25
View File
@@ -31,6 +31,13 @@ export interface SkillUninstallResult {
backupPath?: string;
}
export interface SkillBackupEntry {
backupId: string;
backupPath: string;
createdAt: number;
skill: InstalledSkill;
}
/** 可发现的 Skill(来自仓库) */
export interface DiscoverableSkill {
key: string;
@@ -89,6 +96,16 @@ export const skillsApi = {
return await invoke("get_installed_skills");
},
/** 获取可恢复的 Skill 备份列表 */
async getBackups(): Promise<SkillBackupEntry[]> {
return await invoke("get_skill_backups");
},
/** 删除 Skill 备份 */
async deleteBackup(backupId: string): Promise<boolean> {
return await invoke("delete_skill_backup", { backupId });
},
/** 安装 Skill(统一安装) */
async installUnified(
skill: DiscoverableSkill,
@@ -102,6 +119,14 @@ export const skillsApi = {
return await invoke("uninstall_skill_unified", { id });
},
/** 从备份恢复 Skill */
async restoreBackup(
backupId: string,
currentApp: AppId,
): Promise<InstalledSkill> {
return await invoke("restore_skill_backup", { backupId, currentApp });
},
/** 切换 Skill 的应用启用状态 */
async toggleApp(id: string, app: AppId, enabled: boolean): Promise<boolean> {
return await invoke("toggle_skill_app", { id, app, enabled });