mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-07-31 19:22:15 +08:00
feat(skill): add multi-app skill support for Claude/Codex (#365)
* feat(skill): add multi-app skill support for Claude/Codex/Gemini - Add app-specific skill management with AppType prefix in skill keys - Implement per-app skill tracking in database schema - Add get_skills_for_app command to retrieve skills by application - Update SkillsPage to support app-specific skill loading with initialApp prop - Parse app parameter and validate against supported app types - Maintain backward compatibility with default claude app * fix(usage): reorder cache columns and prevent header text wrapping - Swap cache read and cache write columns order - Add whitespace-nowrap to all table headers to prevent text wrapping - Improves table readability and layout consistency
This commit is contained in:
+20
-6
@@ -19,17 +19,31 @@ export interface SkillRepo {
|
||||
enabled: boolean;
|
||||
}
|
||||
|
||||
export type AppType = "claude" | "codex" | "gemini";
|
||||
|
||||
export const skillsApi = {
|
||||
async getAll(): Promise<Skill[]> {
|
||||
return await invoke("get_skills");
|
||||
async getAll(app: AppType = "claude"): Promise<Skill[]> {
|
||||
if (app === "claude") {
|
||||
return await invoke("get_skills");
|
||||
}
|
||||
return await invoke("get_skills_for_app", { app });
|
||||
},
|
||||
|
||||
async install(directory: string): Promise<boolean> {
|
||||
return await invoke("install_skill", { directory });
|
||||
async install(directory: string, app: AppType = "claude"): Promise<boolean> {
|
||||
if (app === "claude") {
|
||||
return await invoke("install_skill", { directory });
|
||||
}
|
||||
return await invoke("install_skill_for_app", { app, directory });
|
||||
},
|
||||
|
||||
async uninstall(directory: string): Promise<boolean> {
|
||||
return await invoke("uninstall_skill", { directory });
|
||||
async uninstall(
|
||||
directory: string,
|
||||
app: AppType = "claude",
|
||||
): Promise<boolean> {
|
||||
if (app === "claude") {
|
||||
return await invoke("uninstall_skill", { directory });
|
||||
}
|
||||
return await invoke("uninstall_skill_for_app", { app, directory });
|
||||
},
|
||||
|
||||
async getRepos(): Promise<SkillRepo[]> {
|
||||
|
||||
+16
-12
@@ -36,9 +36,10 @@ export const useAddProviderMutation = (appId: AppId) => {
|
||||
toast.success(
|
||||
t("notifications.providerAdded", {
|
||||
defaultValue: "供应商已添加",
|
||||
}), {
|
||||
closeButton: true
|
||||
}
|
||||
}),
|
||||
{
|
||||
closeButton: true,
|
||||
},
|
||||
);
|
||||
},
|
||||
onError: (error: Error) => {
|
||||
@@ -66,9 +67,10 @@ export const useUpdateProviderMutation = (appId: AppId) => {
|
||||
toast.success(
|
||||
t("notifications.updateSuccess", {
|
||||
defaultValue: "供应商更新成功",
|
||||
}), {
|
||||
closeButton: true
|
||||
}
|
||||
}),
|
||||
{
|
||||
closeButton: true,
|
||||
},
|
||||
);
|
||||
},
|
||||
onError: (error: Error) => {
|
||||
@@ -106,9 +108,10 @@ export const useDeleteProviderMutation = (appId: AppId) => {
|
||||
toast.success(
|
||||
t("notifications.deleteSuccess", {
|
||||
defaultValue: "供应商已删除",
|
||||
}), {
|
||||
closeButton: true
|
||||
}
|
||||
}),
|
||||
{
|
||||
closeButton: true,
|
||||
},
|
||||
);
|
||||
},
|
||||
onError: (error: Error) => {
|
||||
@@ -147,9 +150,10 @@ export const useSwitchProviderMutation = (appId: AppId) => {
|
||||
t("notifications.switchSuccess", {
|
||||
defaultValue: "切换供应商成功",
|
||||
appName: t(`apps.${appId}`, { defaultValue: appId }),
|
||||
}), {
|
||||
closeButton: true
|
||||
}
|
||||
}),
|
||||
{
|
||||
closeButton: true,
|
||||
},
|
||||
);
|
||||
},
|
||||
onError: (error: Error) => {
|
||||
|
||||
Reference in New Issue
Block a user