(name: string, cwd: string)
| 86 | |
| 87 | /** Load a single skill by name without applying enabled-state filtering. */ |
| 88 | export async function loadSkillByName(name: string, cwd: string): Promise<SkillSpec | null> { |
| 89 | for (const { root, origin } of [ |
| 90 | { root: projectSkillsDir(cwd), origin: 'project' as const }, |
| 91 | { root: userSkillsDir(), origin: 'user' as const }, |
| 92 | ]) { |
| 93 | const skillDir = path.join(root, name); |
| 94 | const skillFile = path.join(skillDir, 'SKILL.md'); |
| 95 | try { |
| 96 | const raw = await fs.readFile(skillFile, 'utf-8'); |
| 97 | return parseSkill(raw, name, skillDir, origin); |
| 98 | } catch { |
| 99 | continue; |
| 100 | } |
| 101 | } |
| 102 | return null; |
| 103 | } |
| 104 | |
| 105 | /** Parse a SKILL.md into a SkillSpec. Returns null if the spec is unusable. */ |
| 106 | export function parseSkill( |
no test coverage detected