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

Function validateProjectPath

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

Source from the content-addressed store, hash-verified

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