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

Function walkDir

src/directory.ts:506–523  ·  view source on GitHub ↗
(dir: string, prefix: string = '')

Source from the content-addressed store, hash-verified

504 const files: string[] = [];
505
506 function walkDir(dir: string, prefix: string = ''): void {
507 const entries = fs.readdirSync(dir, { withFileTypes: true });
508
509 for (const entry of entries) {
510 const relativePath = prefix ? `${prefix}/${entry.name}` : entry.name;
511
512 // Skip symlinks to prevent following links outside .codegraph
513 if (entry.isSymbolicLink()) {
514 continue;
515 }
516
517 if (entry.isDirectory()) {
518 walkDir(path.join(dir, entry.name), relativePath);
519 } else {
520 files.push(relativePath);
521 }
522 }
523 }
524
525 walkDir(codegraphDir);
526 return files;

Callers 2

listDirectoryContentsFunction · 0.85
getDirectorySizeFunction · 0.85

Calls 1

joinMethod · 0.80

Tested by

no test coverage detected