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

Function findNearestCodeGraphRoot

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

Source from the content-addressed store, hash-verified

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