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

Function resolveServerRoot

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

Source from the content-addressed store, hash-verified

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