(startPath: string)
| 156 | } |
| 157 | |
| 158 | export function findNearestCodeGraphRoot(startPath: string): string | null { |
| 159 | let current = path.resolve(startPath); |
| 160 | const root = path.parse(current).root; |
| 161 | |
| 162 | while (current !== root) { |
| 163 | if (isInitialized(current)) { |
| 164 | return current; |
| 165 | } |
| 166 | const parent = path.dirname(current); |
| 167 | if (parent === current) break; // Reached filesystem root |
| 168 | current = parent; |
| 169 | } |
| 170 | |
| 171 | // Check root as well |
| 172 | if (isInitialized(current)) { |
| 173 | return current; |
| 174 | } |
| 175 | |
| 176 | return null; |
| 177 | } |
| 178 | |
| 179 | /** Heavy/irrelevant directory names the sub-project scan never descends into. */ |
| 180 | const SUBPROJECT_SCAN_SKIP = new Set([ |
no test coverage detected