( packageName: string, version: string, skillDirs: SkillDirInfo[], )
| 169 | * Fetch skill list with frontmatter for discovery endpoint. |
| 170 | */ |
| 171 | export async function fetchSkillsList( |
| 172 | packageName: string, |
| 173 | version: string, |
| 174 | skillDirs: SkillDirInfo[], |
| 175 | ): Promise<SkillListItem[]> { |
| 176 | const skills = await Promise.all( |
| 177 | skillDirs.map(async ({ name: dirName, children }) => { |
| 178 | try { |
| 179 | const { frontmatter } = await fetchSkillContent(packageName, version, dirName) |
| 180 | const warnings = validateSkill(frontmatter) |
| 181 | const fileCounts = countSkillFiles(children) |
| 182 | const item: SkillListItem = { |
| 183 | name: frontmatter.name, |
| 184 | description: frontmatter.description, |
| 185 | dirName, |
| 186 | license: frontmatter.license, |
| 187 | compatibility: frontmatter.compatibility, |
| 188 | warnings: warnings.length > 0 ? warnings : undefined, |
| 189 | fileCounts, |
| 190 | } |
| 191 | return item |
| 192 | } catch { |
| 193 | return null |
| 194 | } |
| 195 | }), |
| 196 | ) |
| 197 | return skills.filter((s): s is SkillListItem => s !== null) |
| 198 | } |
| 199 | |
| 200 | export interface WellKnownSkillItem { |
| 201 | name: string |
no test coverage detected