MCPcopy Create free account
hub / github.com/arktypeio/arktype / prepareSkillInstall

Function prepareSkillInstall

ark/type/cli.ts:308–335  ·  view source on GitHub ↗
(
	projectRoot: string,
	targetDir?: string,
	opts?: InstallSkillOptions
)

Source from the content-addressed store, hash-verified

306}
307
308const 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
337const applySkillInstall = ({
338 dest,

Callers 2

installBundledSkillFunction · 0.85
runInitFunction · 0.85

Calls 6

bundledSkillPathFunction · 0.85
defaultSkillTargetFunction · 0.85
resolveSafeSkillDirFunction · 0.85
isWithinDirFunction · 0.85
validateSkillTreeFunction · 0.85

Tested by

no test coverage detected