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

Function dirsRootToLeaf

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

Source from the content-addressed store, hash-verified

141}
142
143function dirsRootToLeaf(kaos: Kaos, workDir: string, projectRoot: string): string[] {
144 const dirs: string[] = [];
145 let current = kaos.normpath(workDir);
146
147 while (true) {
148 dirs.push(current);
149 if (current === projectRoot) break;
150 const parent = dirname(current);
151 if (parent === current) break;
152 current = parent;
153 }
154
155 return dirs.toReversed();
156}
157
158interface AgentFile {
159 readonly path: string;

Callers 1

loadAgentsMdForRootsFunction · 0.85

Calls 2

normpathMethod · 0.65
pushMethod · 0.45

Tested by

no test coverage detected