mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-04-18 09:22:55 +08:00
- Add skills_path field to Skill struct - Use skills_path to construct correct source path during installation - Fix installation for repos with custom skill subdirectories
49 lines
1.2 KiB
TypeScript
49 lines
1.2 KiB
TypeScript
import { invoke } from "@tauri-apps/api/core";
|
|
|
|
export interface Skill {
|
|
key: string;
|
|
name: string;
|
|
description: string;
|
|
directory: string;
|
|
readmeUrl?: string;
|
|
installed: boolean;
|
|
repoOwner?: string;
|
|
repoName?: string;
|
|
repoBranch?: string;
|
|
skillsPath?: string; // 技能所在的子目录路径,如 "skills"
|
|
}
|
|
|
|
export interface SkillRepo {
|
|
owner: string;
|
|
name: string;
|
|
branch: string;
|
|
enabled: boolean;
|
|
skillsPath?: string; // 可选:技能所在的子目录路径,如 "skills"
|
|
}
|
|
|
|
export const skillsApi = {
|
|
async getAll(): Promise<Skill[]> {
|
|
return await invoke("get_skills");
|
|
},
|
|
|
|
async install(directory: string): Promise<boolean> {
|
|
return await invoke("install_skill", { directory });
|
|
},
|
|
|
|
async uninstall(directory: string): Promise<boolean> {
|
|
return await invoke("uninstall_skill", { directory });
|
|
},
|
|
|
|
async getRepos(): Promise<SkillRepo[]> {
|
|
return await invoke("get_skill_repos");
|
|
},
|
|
|
|
async addRepo(repo: SkillRepo): Promise<boolean> {
|
|
return await invoke("add_skill_repo", { repo });
|
|
},
|
|
|
|
async removeRepo(owner: string, name: string): Promise<boolean> {
|
|
return await invoke("remove_skill_repo", { owner, name });
|
|
},
|
|
};
|