Files
CC-Switch/src/lib/api/skills.ts
T
YoVinchen 0f959112b1 refactor(skill): remove skillsPath configuration (#310)
Remove the skillsPath field from SkillRepo and Skill structs since
recursive scanning now automatically discovers skills in all directories.
Simplify the UI by removing the path input field.
2025-11-28 16:26:28 +08:00

47 lines
1.0 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;
}
export interface SkillRepo {
owner: string;
name: string;
branch: string;
enabled: boolean;
}
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 });
},
};