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

Function findServerRoot

src/directory.ts:516–526  ·  view source on GitHub ↗

resolveServerRoot before the sensitive-folder refusal.

(searchFrom: string, opts: { subprojectScan?: boolean })

Source from the content-addressed store, hash-verified

514
515/** {@link resolveServerRoot} before the sensitive-folder refusal. */
516function findServerRoot(searchFrom: string, opts: { subprojectScan?: boolean }): ServerRootResolution {
517 const none: ServerRootResolution = { root: null, viaSubScan: false, candidates: [], refusal: null };
518 const up = findNearestCodeGraphRoot(searchFrom);
519 if (up) return { root: up, viaSubScan: false, candidates: [], refusal: null };
520 if (opts.subprojectScan === false) return none;
521 const base = path.resolve(searchFrom);
522 if (!eligibleForSubprojectScan(base)) return none;
523 const subs = findIndexedSubprojectRoots(base);
524 if (subs.length === 1) return { root: subs[0]!, viaSubScan: true, candidates: subs, refusal: null };
525 return { ...none, candidates: subs };
526}
527
528/**
529 * Unicode-aware word-boundary emulation for the keyword lists below. JS's `\b`

Callers 1

resolveServerRootFunction · 0.85

Calls 4

findNearestCodeGraphRootFunction · 0.85
resolveMethod · 0.65

Tested by

no test coverage detected