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

Function validateProjectPath

src/utils.ts:345–361  ·  view source on GitHub ↗
(dirPath: string)

Source from the content-addressed store, hash-verified

343 * @returns An error message if invalid, or null if valid
344 */
345export function validateProjectPath(dirPath: string): string | null {
346 const refusal = sensitiveDirectoryRefusal(dirPath);
347 if (refusal) return refusal;
348
349 // Verify it's a real directory
350 const resolved = path.resolve(dirPath);
351 try {
352 const stats = fs.statSync(resolved);
353 if (!stats.isDirectory()) {
354 return `Path is not a directory: ${resolved}`;
355 }
356 } catch {
357 return `Path does not exist or is not accessible: ${resolved}`;
358 }
359
360 return null;
361}
362
363/**
364 * The sensitive-folder half of {@link validateProjectPath}: why `dirPath` is,

Callers 4

getCodeGraphMethod · 0.90
resolveProjectFileFunction · 0.90
security.test.tsFile · 0.90
mainFunction · 0.85

Calls 2

resolveMethod · 0.65

Tested by

no test coverage detected