MCPcopy Index your code
hub / github.com/ChatLab/ChatLab / FetchSkillAdapter

Class FetchSkillAdapter

src/services/skill/fetch.ts:4–48  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2import { get, post, put, del } from '../utils/http'
3
4export class FetchSkillAdapter implements SkillServiceAdapter {
5 async getAll(): Promise<SkillSummary[]> {
6 return get<SkillSummary[]>('/ai/skills')
7 }
8
9 async getConfig(id: string): Promise<SkillConfig | null> {
10 try {
11 return await get<SkillConfig>(`/ai/skills/${id}`)
12 } catch {
13 return null
14 }
15 }
16
17 async create(rawMd: string) {
18 return post<{ success: boolean; id?: string; error?: string }>('/ai/skills', { rawMd })
19 }
20
21 async update(id: string, rawMd: string) {
22 return put<{ success: boolean; error?: string }>(`/ai/skills/${id}`, { rawMd })
23 }
24
25 async delete(id: string) {
26 return del<{ success: boolean; error?: string }>(`/ai/skills/${id}`)
27 }
28
29 async importFromMd(rawMd: string) {
30 return post<{ success: boolean; error?: string }>('/ai/skills/import', { rawMd })
31 }
32
33 async importBuiltin(builtinId: string) {
34 return post<{ success: boolean; id?: string; error?: string }>('/ai/skills/import-builtin', { builtinId })
35 }
36
37 async reimport(id: string) {
38 return post<{ success: boolean; error?: string }>(`/ai/skills/${id}/reimport`, {})
39 }
40
41 async getBuiltinCatalog(): Promise<BuiltinSkillInfo[]> {
42 try {
43 return await get<BuiltinSkillInfo[]>('/ai/skills/builtin-catalog')
44 } catch {
45 return []
46 }
47 }
48}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected