MCPcopy Create free account
hub / github.com/QodeXcli/QodeX / walk

Function walk

src/orchestration/engine.ts:325–343  ·  view source on GitHub ↗
(dir: string)

Source from the content-addressed store, hash-verified

323 const exts = new Set(['.ts', '.tsx', '.js', '.jsx', '.mjs', '.cjs']);
324
325 async function walk(dir: string) {
326 if (out.length >= cap) return;
327 let entries;
328 try { entries = await fs.readdir(dir, { withFileTypes: true }); } catch { return; }
329 for (const e of entries) {
330 if (out.length >= cap) return;
331 if (e.name.startsWith('.') && e.name !== '.qodex') { /* allow dotfiles except heavy */ }
332 const abs = path.join(dir, e.name);
333 if (e.isDirectory()) {
334 if (SKIP.has(e.name)) continue;
335 await walk(abs);
336 } else if (exts.has(path.extname(e.name))) {
337 try {
338 const content = await fs.readFile(abs, 'utf-8');
339 out.push({ rel: path.relative(root, abs), content });
340 } catch { /* skip unreadable */ }
341 }
342 }
343 }
344 await walk(root);
345 return out;
346}

Callers 1

walkProjectSourceFunction · 0.70

Calls 2

hasMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected