(targetDir: string, skillContents: Map<string, string>)
| 328 | } |
| 329 | |
| 330 | async function getInstallStatus(targetDir: string, skillContents: Map<string, string>): Promise<InstallStatus> { |
| 331 | try { |
| 332 | await fs.access(targetDir) |
| 333 | } catch { |
| 334 | return 'installed' |
| 335 | } |
| 336 | |
| 337 | for (const [file, content] of skillContents) { |
| 338 | const targetPath = path.join(targetDir, file) |
| 339 | try { |
| 340 | const existing = await fs.readFile(targetPath, 'utf8') |
| 341 | if (existing !== content) { |
| 342 | return 'updated' |
| 343 | } |
| 344 | } catch { |
| 345 | return 'installed' |
| 346 | } |
| 347 | } |
| 348 | |
| 349 | return 'up-to-date' |
| 350 | } |
| 351 | |
| 352 | async function installSkillFiles(targetDir: string, skillContents: Map<string, string>): Promise<InstallStatus> { |
| 353 | const status = await getInstallStatus(targetDir, skillContents) |
no outgoing calls
no test coverage detected