feat: integrate skills.sh search for discovering skills from public registry

Add skills.sh API integration allowing users to search and install from
a catalog of 91K+ agent skills directly within CC Switch. The search
results are converted to DiscoverableSkill objects and reuse the existing
install pipeline. Includes fallback directory search for repos where
skills are nested in subdirectories, and filters out non-GitHub sources.
This commit is contained in:
Jason
2026-04-05 22:16:10 +08:00
parent 33f5d56afd
commit d51e774b20
11 changed files with 583 additions and 57 deletions
+28
View File
@@ -95,6 +95,25 @@ export interface MigrationResult {
errors: string[];
}
/** skills.sh 可发现的技能 */
export interface SkillsShDiscoverableSkill {
key: string;
name: string;
directory: string;
repoOwner: string;
repoName: string;
repoBranch: string;
installs: number;
readmeUrl?: string;
}
/** skills.sh 搜索结果 */
export interface SkillsShSearchResult {
skills: SkillsShDiscoverableSkill[];
totalCount: number;
query: string;
}
/** 仓库配置 */
export interface SkillRepo {
owner: string;
@@ -183,6 +202,15 @@ export const skillsApi = {
return await invoke("migrate_skill_storage", { target });
},
/** 搜索 skills.sh 公共目录 */
async searchSkillsSh(
query: string,
limit: number,
offset: number,
): Promise<SkillsShSearchResult> {
return await invoke("search_skills_sh", { query, limit, offset });
},
// ========== 兼容旧 API ==========
/** 获取技能列表(兼容旧 API) */