* Extract a bundled skill's reference files to disk so the model can * Read/Grep them on demand. Called lazily on first skill invocation. * * Returns the directory written to, or null if write failed (skill * continues to work, just without the base-directory prefix).
( skillName: string, files: Record<string, string>, )
| 129 | * continues to work, just without the base-directory prefix). |
| 130 | */ |
| 131 | async function extractBundledSkillFiles( |
| 132 | skillName: string, |
| 133 | files: Record<string, string>, |
| 134 | ): Promise<string | null> { |
| 135 | const dir = getBundledSkillExtractDir(skillName) |
| 136 | try { |
| 137 | await writeSkillFiles(dir, files) |
| 138 | return dir |
| 139 | } catch (e) { |
| 140 | logForDebugging( |
| 141 | `Failed to extract bundled skill '${skillName}' to ${dir}: ${e instanceof Error ? e.message : String(e)}`, |
| 142 | ) |
| 143 | return null |
| 144 | } |
| 145 | } |
| 146 | |
| 147 | async function writeSkillFiles( |
| 148 | dir: string, |
no test coverage detected