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

Function findSkillDirs

server/utils/skills.ts:69–80  ·  view source on GitHub ↗
(tree: PackageFileTree[])

Source from the content-addressed store, hash-verified

67 * Returns skill names and their children for file counting.
68 */
69export function findSkillDirs(tree: PackageFileTree[]): SkillDirInfo[] {
70 const skillsDir = tree.find(node => node.type === 'directory' && node.name === 'skills')
71 if (!skillsDir?.children) return []
72
73 return skillsDir.children
74 .filter(
75 child =>
76 child.type === 'directory' &&
77 child.children?.some(f => f.type === 'file' && f.name === 'SKILL.md'),
78 )
79 .map(child => ({ name: child.name, children: child.children || [] }))
80}
81
82const countFilesRecursive = (nodes: PackageFileTree[]): number =>
83 nodes.reduce((acc, n) => acc + (n.type === 'file' ? 1 : countFilesRecursive(n.children || [])), 0)

Callers 1

handleDiscoveryFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected