MCPcopy Create free account
hub / github.com/bearlyai/OpenADE / handleIsGitInstalled

Function handleIsGitInstalled

projects/electron/src/modules/code/git.ts:511–532  ·  view source on GitHub ↗

* Check if git is installed

()

Source from the content-addressed store, hash-verified

509 * Check if git is installed
510 */
511async 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.

Callers 1

isRuntimeGitInstalledFunction · 0.85

Calls 1

execCommandFunction · 0.90

Tested by

no test coverage detected