feat: add skill installer (#279)

* feat: add skill installer with install/uninstall and settings UI

* feat: refactor skill installer with extracted SkillLibraryList component

* feat: simplify SkillsEditor, extract SkillLibraryList

* feat: refactor skill installer components and add github utility
This commit is contained in:
Chris Scott authored and GitHub committed 2026-06-17 23:11:29 -04:00
1 parent 24d34f28a3
commit 6e80cdfb8c
24 files changed
+2381 -577

No files matched your search

+39
View File
@@ -11,6 +11,8 @@ import type {
CreateSkillRequest,
UpdateSkillRequest,
SkillScope,
InstallSkillFromGithubRequest,
InstallSkillResponse,
} from './types/settings'
import { API_BASE_URL } from '@/config'
import { fetchWrapper, FetchError } from './fetchWrapper'
@@ -268,6 +270,43 @@ export const settingsApi = {
method: 'DELETE',
})
},
installSkillFromGithub: async (data: InstallSkillFromGithubRequest): Promise<InstallSkillResponse> => {
return fetchWrapper(`${API_BASE_URL}/api/settings/skills/install`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(data),
})
},
installSkillFromUpload: async (data: {
files: File[]
scope: SkillScope
repoId?: number
overwrite?: boolean
}): Promise<InstallSkillResponse> => {
const formData = new FormData()
formData.append('sourceType', 'upload')
formData.append('scope', data.scope)
if (data.repoId !== undefined) formData.append('repoId', String(data.repoId))
if (data.overwrite !== undefined) formData.append('overwrite', String(data.overwrite))
const fileManifest: Array<{ fieldName: string; relativePath: string }> = []
data.files.forEach((file, index) => {
const fieldName = `file${index}`
const relativePath = file.webkitRelativePath || file.name
fileManifest.push({ fieldName, relativePath })
formData.append(fieldName, file)
})
formData.append('fileManifest', JSON.stringify(fileManifest))
return fetchWrapper(`${API_BASE_URL}/api/settings/skills/install`, {
method: 'POST',
body: formData,
})
},
}
export interface VersionInfo {