MCPcopy
hub / github.com/npmx-dev/npmx.dev / fetchSkillsList

Function fetchSkillsList

server/utils/skills.ts:171–198  ·  view source on GitHub ↗
(
  packageName: string,
  version: string,
  skillDirs: SkillDirInfo[],
)

Source from the content-addressed store, hash-verified

169 * Fetch skill list with frontmatter for discovery endpoint.
170 */
171export 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
200export interface WellKnownSkillItem {
201 name: string

Callers 1

handleDiscoveryFunction · 0.85

Calls 3

fetchSkillContentFunction · 0.85
validateSkillFunction · 0.85
countSkillFilesFunction · 0.85

Tested by

no test coverage detected