MCPcopy Create free account
hub / github.com/bearlyai/OpenADE / walkForConfigFiles

Function walkForConfigFiles

projects/electron/src/modules/code/procs/discover.ts:138–157  ·  view source on GitHub ↗

* Walk filesystem to find config files * * @param dir - Directory to walk * @param files - Accumulator for found files * @param depth - Current depth (for limiting recursion) * @returns Array of absolute paths to config files

(dir: string, files: string[] = [], depth = 0)

Source from the content-addressed store, hash-verified

136 * @returns Array of absolute paths to config files
137 */
138async function walkForConfigFiles(dir: string, files: string[] = [], depth = 0): Promise<string[]> {
139 // Limit depth to avoid runaway recursion
140 if (depth > 10) return files
141
142 try {
143 const entries = await fs.readdir(dir, { withFileTypes: true })
144
145 for (const entry of entries) {
146 if (CONFIG_FILENAMES_SET.has(entry.name) && entry.isFile()) {
147 files.push(path.join(dir, entry.name))
148 } else if (entry.isDirectory() && !IGNORE_DIRS.has(entry.name) && !entry.name.startsWith(".")) {
149 await walkForConfigFiles(path.join(dir, entry.name), files, depth + 1)
150 }
151 }
152 } catch {
153 // Ignore permission errors etc
154 }
155
156 return files
157}

Callers 1

findProcsFilesFunction · 0.85

Calls 3

hasMethod · 0.80
pushMethod · 0.80
isDirectoryMethod · 0.80

Tested by

no test coverage detected