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

Function findServerRoot

src/directory.ts:517–527  ·  view source on GitHub ↗

resolveServerRoot before the sensitive-folder refusal.

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

Source from the content-addressed store, hash-verified

515
516/** {@link resolveServerRoot} before the sensitive-folder refusal. */
517function findServerRoot(searchFrom: string, opts: { subprojectScan?: boolean }): ServerRootResolution {
518 const none: ServerRootResolution = { root: null, viaSubScan: false, candidates: [], refusal: null };
519 const up = findNearestCodeGraphRoot(searchFrom);
520 if (up) return { root: up, viaSubScan: false, candidates: [], refusal: null };
521 if (opts.subprojectScan === false) return none;
522 const base = path.resolve(searchFrom);
523 if (!eligibleForSubprojectScan(base)) return none;
524 const subs = findIndexedSubprojectRoots(base);
525 if (subs.length === 1) return { root: subs[0]!, viaSubScan: true, candidates: subs, refusal: null };
526 return { ...none, candidates: subs };
527}
528
529/**
530 * 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