( projectRoot: string, targetDir?: string, opts?: InstallSkillOptions )
| 306 | } |
| 307 | |
| 308 | const prepareSkillInstall = ( |
| 309 | projectRoot: string, |
| 310 | targetDir?: string, |
| 311 | opts?: InstallSkillOptions |
| 312 | ): PreparedSkillInstall => { |
| 313 | const src = bundledSkillPath() |
| 314 | const dest = |
| 315 | targetDir !== undefined ? |
| 316 | resolveExplicitSkillTarget(opts?.cwd ?? process.cwd(), targetDir) |
| 317 | : defaultSkillTarget(projectRoot) |
| 318 | const resolvedDest = resolveSafeSkillDir( |
| 319 | projectRoot, |
| 320 | dest, |
| 321 | targetDir !== undefined, |
| 322 | Boolean(opts?.allowOutside) |
| 323 | ) |
| 324 | const realSrc = realpathSync(src) |
| 325 | if ( |
| 326 | isWithinDir(realSrc, resolvedDest) || |
| 327 | isWithinDir(resolvedDest, realSrc) |
| 328 | ) { |
| 329 | throw new Error( |
| 330 | `Refusing to install skill to ${dest}: destination overlaps bundled skill source ${realSrc}` |
| 331 | ) |
| 332 | } |
| 333 | validateSkillTree(realSrc, resolvedDest) |
| 334 | return { dest, realSrc, resolvedDest } |
| 335 | } |
| 336 | |
| 337 | const applySkillInstall = ({ |
| 338 | dest, |
no test coverage detected