MCPcopy
hub / github.com/upstash/context7 / getTargetDirs

Function getTargetDirs

packages/cli/src/utils/ide.ts:259–279  ·  view source on GitHub ↗
(targets: InstallTargets)

Source from the content-addressed store, hash-verified

257}
258
259export function getTargetDirs(targets: InstallTargets): string[] {
260 const hasUniversal = targets.ides.some((ide) => ide === "universal");
261 const dirs: string[] = [];
262
263 for (const scope of targets.scopes) {
264 const baseDir = scope === "global" ? homedir() : process.cwd();
265
266 if (hasUniversal) {
267 const uniPath = scope === "global" ? UNIVERSAL_SKILLS_GLOBAL_PATH : UNIVERSAL_SKILLS_PATH;
268 dirs.push(join(baseDir, uniPath));
269 }
270
271 for (const ide of targets.ides) {
272 if (ide === "universal") continue;
273 const pathMap = scope === "global" ? IDE_GLOBAL_PATHS : IDE_PATHS;
274 dirs.push(join(baseDir, pathMap[ide]));
275 }
276 }
277
278 return dirs;
279}
280
281export function getTargetDirFromSelection(ide: IDE, scope: Scope): string {
282 if (ide === "universal") {

Callers 4

generateCommandFunction · 0.85
installCommandFunction · 0.85
searchCommandFunction · 0.85
suggestCommandFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected