MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / localPath

Function localPath

graph-ui/tools/license-build-inventory.ts:23–29  ·  view source on GitHub ↗
(path: string)

Source from the content-addressed store, hash-verified

21 return rel !== '..' && !rel.startsWith(`..${process.platform === 'win32' ? '\\' : '/'}`) && !isAbsolute(rel);
22 };
23 function localPath(path: string): string {
24 const actual = realpathSync(path);
25 const dependencies = realpathSync(join(root, 'node_modules'));
26 if (inside(dependencies, actual)) return `node_modules/${slash(relative(dependencies, actual))}`;
27 if (inside(realpathSync(root), actual)) return slash(relative(realpathSync(root), actual));
28 throw new Error(`License inventory input outside the UI: ${path}`);
29 }
30 function record(path: string): string | undefined {
31 const clean = path.split('?')[0];
32 if (!clean || clean.includes('\0') || !isAbsolute(clean) || !existsSync(clean) || !statSync(clean).isFile()) return;

Callers 1

recordFunction · 0.85

Calls 2

slashFunction · 0.85
insideFunction · 0.70

Tested by

no test coverage detected