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