MCPcopy
hub / github.com/colbymchenry/codegraph / walk

Function walk

src/directory.ts:219–231  ·  view source on GitHub ↗
(dir: string, depth: number)

Source from the content-addressed store, hash-verified

217 const max = opts.max ?? 64;
218 const out: string[] = [];
219 const walk = (dir: string, depth: number): void => {
220 if (out.length >= max || depth > maxDepth) return;
221 let entries: fs.Dirent[];
222 try { entries = fs.readdirSync(dir, { withFileTypes: true }); } catch { return; }
223 for (const e of entries) {
224 if (out.length >= max) return;
225 if (!e.isDirectory()) continue;
226 if (e.name.startsWith('.') || SUBPROJECT_SCAN_SKIP.has(e.name)) continue;
227 const child = path.join(dir, e.name);
228 if (isInitialized(child)) { out.push(child); continue; } // don't descend into an indexed project
229 walk(child, depth + 1);
230 }
231 };
232 walk(root, 1);
233 return out;
234}

Callers 1

Calls 3

isInitializedFunction · 0.85
hasMethod · 0.80
joinMethod · 0.80

Tested by

no test coverage detected