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

Function findProjectRoot

packages/agent-core/src/profile/context.ts:131–141  ·  view source on GitHub ↗
(kaos: Kaos, workDir: string)

Source from the content-addressed store, hash-verified

129}
130
131async function findProjectRoot(kaos: Kaos, workDir: string): Promise<string> {
132 const initial = kaos.normpath(workDir);
133 let current = initial;
134
135 while (true) {
136 if (await pathExists(kaos, join(current, '.git'))) return current;
137 const parent = dirname(current);
138 if (parent === current) return initial;
139 current = parent;
140 }
141}
142
143function dirsRootToLeaf(kaos: Kaos, workDir: string, projectRoot: string): string[] {
144 const dirs: string[] = [];

Callers 1

loadAgentsMdForRootsFunction · 0.70

Calls 2

pathExistsFunction · 0.70
normpathMethod · 0.65

Tested by

no test coverage detected