()
| 30 | * Detect the git repository root, or null if not in a repo / git unavailable. |
| 31 | */ |
| 32 | export function getGitRoot(): string | null { |
| 33 | try { |
| 34 | const proc = Bun.spawnSync(['git', 'rev-parse', '--show-toplevel'], { |
| 35 | stdout: 'pipe', |
| 36 | stderr: 'pipe', |
| 37 | timeout: 2_000, // Don't hang if .git is broken |
| 38 | }); |
| 39 | if (proc.exitCode !== 0) return null; |
| 40 | return proc.stdout.toString().trim() || null; |
| 41 | } catch { |
| 42 | return null; |
| 43 | } |
| 44 | } |
| 45 | |
| 46 | /** |
| 47 | * Resolve all browse config paths. |
no outgoing calls
no test coverage detected