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

Function lookup

packages/kaos/test/ssh.test.ts:772–781  ·  view source on GitHub ↗
(root: TreeNode, path: string)

Source from the content-addressed store, hash-verified

770 }
771
772 function lookup(root: TreeNode, path: string): TreeNode | undefined {
773 if (path === '/') return root;
774 const parts = path.split('/').filter(Boolean);
775 let current: TreeNode | undefined = root;
776 for (const part of parts) {
777 if (!current?.children?.[part]) return undefined;
778 current = current.children[part];
779 }
780 return current;
781 }
782
783 // Fake SFTP that exposes a tree and implements the handful of callbacks
784 // SSHKaos actually calls. Anything not needed is left unimplemented.

Callers 4

statFunction · 0.85
lstatFunction · 0.85
readdirFunction · 0.85
readFileFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected