MCPcopy
hub / github.com/forloopcodes/contextplus / walkDirectory

Function walkDirectory

src/core/walker.ts:76–90  ·  view source on GitHub ↗
(options: WalkOptions)

Source from the content-addressed store, hash-verified

74}
75
76export async function walkDirectory(options: WalkOptions): Promise<FileEntry[]> {
77 const rootDir = resolve(options.rootDir);
78 const startDir = options.targetPath ? resolve(rootDir, options.targetPath) : rootDir;
79 const ig = await loadIgnoreRules(rootDir);
80 const results: FileEntry[] = [];
81
82 try {
83 await stat(startDir);
84 } catch {
85 return results;
86 }
87
88 await walkRecursive(startDir, rootDir, ig, 0, options.depthLimit ?? 0, results);
89 return results;
90}
91
92export function groupByDirectory(entries: FileEntry[]): Map<string, FileEntry[]> {
93 const groups = new Map<string, FileEntry[]>();

Callers 8

walker.test.mjsFile · 0.85
walker.demo.mjsFile · 0.85
semanticNavigateFunction · 0.85
getBlastRadiusFunction · 0.85
getContextTreeFunction · 0.85
buildIndexFunction · 0.85
buildIdentifierIndexFunction · 0.85
getFeatureHubFunction · 0.85

Calls 2

loadIgnoreRulesFunction · 0.85
walkRecursiveFunction · 0.85

Tested by

no test coverage detected