MCPcopy Index your code
hub / github.com/codeaashu/claude-code / parseSkillPaths

Function parseSkillPaths

src/skills/loadSkillsDir.ts:159–178  ·  view source on GitHub ↗

* Parse paths frontmatter from a skill, using the same format as CLAUDE.md rules. * Returns undefined if no paths are specified or if all patterns are match-all.

(frontmatter: FrontmatterData)

Source from the content-addressed store, hash-verified

157 * Returns undefined if no paths are specified or if all patterns are match-all.
158 */
159function parseSkillPaths(frontmatter: FrontmatterData): string[] | undefined {
160 if (!frontmatter.paths) {
161 return undefined
162 }
163
164 const patterns = splitPathInFrontmatter(frontmatter.paths)
165 .map(pattern => {
166 // Remove /** suffix - ignore library treats 'path' as matching both
167 // the path itself and everything inside it
168 return pattern.endsWith('/**') ? pattern.slice(0, -3) : pattern
169 })
170 .filter((p: string) => p.length > 0)
171
172 // If all patterns are ** (match-all), treat as no paths (undefined)
173 if (patterns.length === 0 || patterns.every((p: string) => p === '**')) {
174 return undefined
175 }
176
177 return patterns
178}
179
180/**
181 * Parses all skill frontmatter fields that are shared between file-based and

Callers 1

loadSkillsFromSkillsDirFunction · 0.85

Calls 1

splitPathInFrontmatterFunction · 0.85

Tested by

no test coverage detected