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

Function findNearestCodeGraphRoot

src/directory.ts:365–384  ·  view source on GitHub ↗
(startPath: string)

Source from the content-addressed store, hash-verified

363}
364
365export function findNearestCodeGraphRoot(startPath: string): string | null {
366 let current = path.resolve(startPath);
367 const root = path.parse(current).root;
368
369 while (current !== root) {
370 if (isInitialized(current)) {
371 return current;
372 }
373 const parent = path.dirname(current);
374 if (parent === current) break; // Reached filesystem root
375 current = parent;
376 }
377
378 // Check root as well
379 if (isInitialized(current)) {
380 return current;
381 }
382
383 return null;
384}
385
386/** Heavy/irrelevant directory names the sub-project scan never descends into. */
387const SUBPROJECT_SCAN_SKIP = new Set([

Callers 6

recordDaemonWarningFunction · 0.90
getCodeGraphMethod · 0.90
mainFunction · 0.90
findServerRootFunction · 0.85

Calls 3

isInitializedFunction · 0.85
parseMethod · 0.80
resolveMethod · 0.65

Tested by

no test coverage detected