MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / lexicalPathWithinRoot

Function lexicalPathWithinRoot

src/utils.ts:123–126  ·  view source on GitHub ↗
(projectRoot: string, filePath: string)

Source from the content-addressed store, hash-verified

121 * contents get served — those must keep the symlink-aware check (#527).
122 */
123export function lexicalPathWithinRoot(projectRoot: string, filePath: string): string | null {
124 const resolved = path.resolve(projectRoot, filePath);
125 return isWithinDir(resolved, path.resolve(projectRoot)) ? resolved : null;
126}
127
128/**
129 * Whether a path made relative to a root (`path.relative(root, p)`, or a

Callers 4

createContextMethod · 0.90
defaultSourceReaderFunction · 0.90
security.test.tsFile · 0.90
validatePathWithinRootFunction · 0.85

Calls 2

isWithinDirFunction · 0.85
resolveMethod · 0.65

Tested by

no test coverage detected