( skills: Skill[], activatedSkillDirs: Set<string>, inputPath: string, )
| 53 | } |
| 54 | |
| 55 | export function resolveSkillReadPath( |
| 56 | skills: Skill[], |
| 57 | activatedSkillDirs: Set<string>, |
| 58 | inputPath: string, |
| 59 | ): SkillReadResolution | undefined { |
| 60 | const absolutePath = resolve(expandHomePath(inputPath)); |
| 61 | |
| 62 | for (const skill of skills) { |
| 63 | const skillFilePath = resolve(skill.filePath); |
| 64 | if (absolutePath === skillFilePath) { |
| 65 | return { absolutePath, skill, isSkillFile: true }; |
| 66 | } |
| 67 | } |
| 68 | |
| 69 | for (const skill of skills) { |
| 70 | const baseDir = resolve(skill.baseDir); |
| 71 | if (!activatedSkillDirs.has(baseDir)) continue; |
| 72 | if (!isPathInsideRoot(absolutePath, baseDir)) continue; |
| 73 | |
| 74 | return { absolutePath, skill, isSkillFile: false }; |
| 75 | } |
| 76 | |
| 77 | return undefined; |
| 78 | } |
| 79 | |
| 80 | export function markSkillActivated( |
| 81 | activatedSkillDirs: Set<string>, |
no test coverage detected