MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / walk

Function walk

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

Source from the content-addressed store, hash-verified

426 const max = opts.max ?? 64;
427 const out: string[] = [];
428 const walk = (dir: string, depth: number): void => {
429 if (out.length >= max || depth > maxDepth) return;
430 let entries: fs.Dirent[];
431 try { entries = fs.readdirSync(dir, { withFileTypes: true }); } catch { return; }
432 for (const e of entries) {
433 if (out.length >= max) return;
434 if (!e.isDirectory()) continue;
435 if (e.name.startsWith('.') || SUBPROJECT_SCAN_SKIP.has(e.name)) continue;
436 const child = path.join(dir, e.name);
437 if (isInitialized(child)) { out.push(child); continue; } // don't descend into an indexed project
438 walk(child, depth + 1);
439 }
440 };
441 walk(root, 1);
442 return out;
443}

Callers 1

Calls 4

isInitializedFunction · 0.85
hasMethod · 0.80
pushMethod · 0.80
joinMethod · 0.45

Tested by

no test coverage detected