MCPcopy
hub / github.com/colbymchenry/codegraph / findNearestCodeGraphRoot

Function findNearestCodeGraphRoot

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

Source from the content-addressed store, hash-verified

156}
157
158export function findNearestCodeGraphRoot(startPath: string): string | null {
159 let current = path.resolve(startPath);
160 const root = path.parse(current).root;
161
162 while (current !== root) {
163 if (isInitialized(current)) {
164 return current;
165 }
166 const parent = path.dirname(current);
167 if (parent === current) break; // Reached filesystem root
168 current = parent;
169 }
170
171 // Check root as well
172 if (isInitialized(current)) {
173 return current;
174 }
175
176 return null;
177}
178
179/** Heavy/irrelevant directory names the sub-project scan never descends into. */
180const SUBPROJECT_SCAN_SKIP = new Set([

Callers 6

resolveDaemonRootFunction · 0.90
getCodeGraphMethod · 0.90
retryInitializeSyncMethod · 0.90
doInitializeMethod · 0.90
handleInitializeMethod · 0.90
mainFunction · 0.90

Calls 2

isInitializedFunction · 0.85
resolveMethod · 0.80

Tested by

no test coverage detected