* Recursively walk workPath collecting .py files, skipping hidden dirs, * __pycache__, and node_modules. Only used on error paths.
( dir: string, rootDir: string )
| 165 | * __pycache__, and node_modules. Only used on error paths. |
| 166 | */ |
| 167 | async function findPythonFilesRecursive( |
| 168 | dir: string, |
| 169 | rootDir: string |
| 170 | ): Promise<string[]> { |
| 171 | const results: string[] = []; |
| 172 | let entries; |
| 173 | try { |
| 174 | entries = await fs.promises.readdir(dir, { withFileTypes: true }); |
| 175 | } catch { |
| 176 | return results; |
| 177 | } |
| 178 | for (const entry of entries) { |
| 179 | if (entry.name.startsWith('.') || SKIP_DIRS.has(entry.name)) continue; |
| 180 | const fullPath = join(dir, entry.name); |
| 181 | if (entry.isDirectory()) { |
| 182 | results.push(...(await findPythonFilesRecursive(fullPath, rootDir))); |
| 183 | } else if (entry.isFile() && entry.name.endsWith('.py')) { |
| 184 | results.push(relative(rootDir, fullPath).replace(/\\/g, '/')); |
| 185 | } |
| 186 | } |
| 187 | return results; |
| 188 | } |
| 189 | |
| 190 | /** |
| 191 | * Recursive scan returning every .py file that exports a valid app/handler. |
no test coverage detected