* Recursive scan returning every .py file that exports a valid app/handler. * Used only on the error path to suggest a tool.vercel.entrypoint snippet.
( workPath: string )
| 192 | * Used only on the error path to suggest a tool.vercel.entrypoint snippet. |
| 193 | */ |
| 194 | async function findEntrypointCandidates( |
| 195 | workPath: string |
| 196 | ): Promise<PythonEntrypoint[]> { |
| 197 | const pyFiles = await findPythonFilesRecursive(workPath, workPath); |
| 198 | const candidates: PythonEntrypoint[] = []; |
| 199 | for (const relPath of pyFiles) { |
| 200 | try { |
| 201 | const content = await fs.promises.readFile( |
| 202 | join(workPath, relPath), |
| 203 | 'utf-8' |
| 204 | ); |
| 205 | const varName = await findAppOrHandler(content); |
| 206 | if (varName) { |
| 207 | candidates.push({ entrypoint: relPath, variableName: varName }); |
| 208 | } |
| 209 | } catch {} |
| 210 | } |
| 211 | return candidates; |
| 212 | } |
| 213 | |
| 214 | function renderCandidateSuggestion(candidates: PythonEntrypoint[]): string { |
| 215 | const lines = candidates.map( |
no test coverage detected