MCPcopy Create free account
hub / github.com/backnotprop/plannotator / isWithinProjectRoot

Function isWithinProjectRoot

packages/shared/resolve-file.ts:151–158  ·  view source on GitHub ↗
(candidate: string, projectRoot: string)

Source from the content-addressed store, hash-verified

149}
150
151export function isWithinProjectRoot(candidate: string, projectRoot: string): boolean {
152 const normalizedCandidate = normalizeComparablePath(candidate);
153 const normalizedProjectRoot = normalizeComparablePath(projectRoot);
154 return (
155 normalizedCandidate === normalizedProjectRoot ||
156 normalizedCandidate.startsWith(`${normalizedProjectRoot}/`)
157 );
158}
159
160function getLowercaseBasename(input: string): string {
161 const normalizedInput = normalizeSeparators(input);

Callers 13

resolveFolderSourceFileFunction · 0.90
saveSourceFileAtomicFunction · 0.90
isWithinAllowedRootsFunction · 0.90
resolveCodeFileFunction · 0.85
resolveMarkdownFileCoreFunction · 0.85
isWithinAllowedRootsFunction · 0.85

Calls 1

normalizeComparablePathFunction · 0.85

Tested by

no test coverage detected