()
| 485 | } |
| 486 | |
| 487 | export async function getGitState(): Promise<GitRepoState | null> { |
| 488 | try { |
| 489 | const [ |
| 490 | commitHash, |
| 491 | branchName, |
| 492 | remoteUrl, |
| 493 | isHeadOnRemote, |
| 494 | isClean, |
| 495 | worktreeCount, |
| 496 | ] = await Promise.all([ |
| 497 | getHead(), |
| 498 | getBranch(), |
| 499 | getRemoteUrl(), |
| 500 | getIsHeadOnRemote(), |
| 501 | getIsClean(), |
| 502 | getWorktreeCount(), |
| 503 | ]) |
| 504 | |
| 505 | return { |
| 506 | commitHash, |
| 507 | branchName, |
| 508 | remoteUrl, |
| 509 | isHeadOnRemote, |
| 510 | isClean, |
| 511 | worktreeCount, |
| 512 | } |
| 513 | } catch (_) { |
| 514 | // Fail silently - git state is best effort |
| 515 | return null |
| 516 | } |
| 517 | } |
| 518 | |
| 519 | export async function getGithubRepo(): Promise<string | null> { |
| 520 | const { parseGitRemote } = await import('./detectRepository.js') |
no test coverage detected