MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / findProjectRoot

Function findProjectRoot

packages/agent-core/src/mcp/config-loader.ts:62–72  ·  view source on GitHub ↗
(cwd: string)

Source from the content-addressed store, hash-verified

60}
61
62async function findProjectRoot(cwd: string): Promise<string> {
63 const start = normalize(cwd);
64 let current = start;
65
66 while (true) {
67 if (await pathExists(join(current, '.git'))) return current;
68 const parent = dirname(current);
69 if (parent === current) return start;
70 current = parent;
71 }
72}
73
74async function pathExists(filePath: string): Promise<boolean> {
75 try {

Callers 1

resolveMcpJsonPathsFunction · 0.70

Calls 2

normalizeFunction · 0.85
pathExistsFunction · 0.70

Tested by

no test coverage detected