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

Function resolveServerRoot

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

Source from the content-addressed store, hash-verified

501 * a tool call would refuse them.
502 */
503export function resolveServerRoot(
504 searchFrom: string,
505 opts: { subprojectScan?: boolean } = {},
506): ServerRootResolution {
507 const found = findServerRoot(searchFrom, opts);
508 if (!found.root && found.candidates.length === 0) return found;
509 const startRefusal = fs.existsSync(searchFrom) ? sensitiveDirectoryRefusal(searchFrom) : null;
510 if (!found.root) return startRefusal ? { ...found, candidates: [] } : found;
511 const refusal = startRefusal ?? sensitiveDirectoryRefusal(found.root);
512 return refusal ? { root: null, viaSubScan: false, candidates: [], refusal } : found;
513}
514
515/** {@link resolveServerRoot} before the sensitive-folder refusal. */
516function findServerRoot(searchFrom: string, opts: { subprojectScan?: boolean }): ServerRootResolution {

Callers 7

resolveDaemonRootFunction · 0.90
startDaemonProcessMethod · 0.90
retryInitializeSyncMethod · 0.90
doInitializeMethod · 0.90
handleInitializeMethod · 0.90
security.test.tsFile · 0.90

Calls 2

findServerRootFunction · 0.85

Tested by

no test coverage detected