* Check if a source file exists in a given directory for a base name. * Tries common source extensions.
(dir, baseName)
| 152 | * Tries common source extensions. |
| 153 | */ |
| 154 | function sourceExistsInDir(dir, baseName) { |
| 155 | const extensions = ['.ts', '.tsx', '.js', '.jsx', '.py', '.go', '.rs', '.java', '.rb']; |
| 156 | const absDir = path.isAbsolute(dir) ? dir : path.join(PROJECT_ROOT, dir); |
| 157 | for (const ext of extensions) { |
| 158 | if (fs.existsSync(path.join(absDir, baseName + ext))) return true; |
| 159 | } |
| 160 | return false; |
| 161 | } |
| 162 | |
| 163 | function matchesPathPattern(filePath, pattern) { |
| 164 | if (!pattern) return false; |