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

Function resolveServerRoot

src/directory.ts:281–293  ·  view source on GitHub ↗
(
  searchFrom: string,
  opts: { subprojectScan?: boolean } = {},
)

Source from the content-addressed store, hash-verified

279 * retry path throttles it; the up-walk always runs).
280 */
281export function resolveServerRoot(
282 searchFrom: string,
283 opts: { subprojectScan?: boolean } = {},
284): ServerRootResolution {
285 const up = findNearestCodeGraphRoot(searchFrom);
286 if (up) return { root: up, viaSubScan: false, candidates: [] };
287 if (opts.subprojectScan === false) return { root: null, viaSubScan: false, candidates: [] };
288 const base = path.resolve(searchFrom);
289 if (!eligibleForSubprojectScan(base)) return { root: null, viaSubScan: false, candidates: [] };
290 const subs = findIndexedSubprojectRoots(base);
291 if (subs.length === 1) return { root: subs[0]!, viaSubScan: true, candidates: subs };
292 return { root: null, viaSubScan: false, candidates: subs };
293}
294
295/**
296 * Unicode-aware word-boundary emulation for the keyword lists below. JS's `\b`

Callers 4

resolveDaemonRootFunction · 0.90
retryInitializeSyncMethod · 0.90
doInitializeMethod · 0.90
handleInitializeMethod · 0.90

Calls 4

findNearestCodeGraphRootFunction · 0.85
resolveMethod · 0.65

Tested by

no test coverage detected