(startPath: string)
| 363 | } |
| 364 | |
| 365 | export function findNearestCodeGraphRoot(startPath: string): string | null { |
| 366 | let current = path.resolve(startPath); |
| 367 | const root = path.parse(current).root; |
| 368 | |
| 369 | while (current !== root) { |
| 370 | if (isInitialized(current)) { |
| 371 | return current; |
| 372 | } |
| 373 | const parent = path.dirname(current); |
| 374 | if (parent === current) break; // Reached filesystem root |
| 375 | current = parent; |
| 376 | } |
| 377 | |
| 378 | // Check root as well |
| 379 | if (isInitialized(current)) { |
| 380 | return current; |
| 381 | } |
| 382 | |
| 383 | return null; |
| 384 | } |
| 385 | |
| 386 | /** Heavy/irrelevant directory names the sub-project scan never descends into. */ |
| 387 | const SUBPROJECT_SCAN_SKIP = new Set([ |
no test coverage detected