()
| 472 | } |
| 473 | |
| 474 | export async function getGitState(): Promise<GitRepoState | null> { |
| 475 | try { |
| 476 | const [ |
| 477 | commitHash, |
| 478 | branchName, |
| 479 | remoteUrl, |
| 480 | isHeadOnRemote, |
| 481 | isClean, |
| 482 | worktreeCount, |
| 483 | ] = await Promise.all([ |
| 484 | getHead(), |
| 485 | getBranch(), |
| 486 | getRemoteUrl(), |
| 487 | getIsHeadOnRemote(), |
| 488 | getIsClean(), |
| 489 | getWorktreeCount(), |
| 490 | ]) |
| 491 | |
| 492 | return { |
| 493 | commitHash, |
| 494 | branchName, |
| 495 | remoteUrl, |
| 496 | isHeadOnRemote, |
| 497 | isClean, |
| 498 | worktreeCount, |
| 499 | } |
| 500 | } catch (_) { |
| 501 | // Fail silently - git state is best effort |
| 502 | return null |
| 503 | } |
| 504 | } |
| 505 | |
| 506 | export async function getGithubRepo(): Promise<string | null> { |
| 507 | const { parseGitRemote } = await import('./detectRepository.js') |
no test coverage detected