* Check if git is installed
()
| 509 | * Check if git is installed |
| 510 | */ |
| 511 | async function handleIsGitInstalled(): Promise<IsGitInstalledResponse> { |
| 512 | const startTime = Date.now() |
| 513 | logger.info("[Git:isGitInstalled] Checking git installation") |
| 514 | |
| 515 | // Return cached result if available |
| 516 | if (gitInstalledCache) { |
| 517 | logger.info("[Git:isGitInstalled] Returning cached result", JSON.stringify({ duration: Date.now() - startTime })) |
| 518 | return gitInstalledCache |
| 519 | } |
| 520 | |
| 521 | const result = await execCommand("git", ["--version"], { timeout: 2000 }) |
| 522 | if (result.success) { |
| 523 | const version = result.stdout.trim() |
| 524 | gitInstalledCache = { installed: true, version } |
| 525 | logger.info("[Git:isGitInstalled] Git is installed", JSON.stringify({ version, duration: Date.now() - startTime })) |
| 526 | return gitInstalledCache |
| 527 | } |
| 528 | |
| 529 | gitInstalledCache = { installed: false } |
| 530 | logger.warn("[Git:isGitInstalled] Git is not installed", JSON.stringify({ error: result.stderr, duration: Date.now() - startTime })) |
| 531 | return gitInstalledCache |
| 532 | } |
| 533 | |
| 534 | /** |
| 535 | * Check if gh CLI is installed and authenticated. |
no test coverage detected