MCPcopy Index your code
hub / github.com/codeaashu/claude-code / installVersionFromBinary

Function installVersionFromBinary

src/utils/nativeInstaller/installer.ts:385–422  ·  view source on GitHub ↗
(
  stagingPath: string,
  installPath: string,
)

Source from the content-addressed store, hash-verified

383}
384
385async function installVersionFromBinary(
386 stagingPath: string,
387 installPath: string,
388) {
389 try {
390 // For direct binary downloads (GCS, generic bucket), the binary is directly in staging
391 const platform = getPlatform()
392 const binaryName = getBinaryName(platform)
393 const stagedBinaryPath = join(stagingPath, binaryName)
394
395 try {
396 await stat(stagedBinaryPath)
397 } catch {
398 logEvent('tengu_native_install_binary_failure', {
399 stage_binary_exists: true,
400 error_binary_not_found: true,
401 })
402 const error = new Error('Staged binary not found')
403 throw error
404 }
405
406 await atomicMoveToInstallPath(stagedBinaryPath, installPath)
407
408 // Clean up staging directory
409 await rm(stagingPath, { recursive: true, force: true })
410
411 logEvent('tengu_native_install_binary_success', {})
412 } catch (error) {
413 if (!errorMessage(error).includes('Staged binary not found')) {
414 logEvent('tengu_native_install_binary_failure', {
415 stage_atomic_move: true,
416 error_move_failed: true,
417 })
418 }
419 logError(toError(error))
420 throw error
421 }
422}
423
424async function installVersion(
425 stagingPath: string,

Callers 1

installVersionFunction · 0.85

Calls 9

getPlatformFunction · 0.85
getBinaryNameFunction · 0.85
statFunction · 0.85
logEventFunction · 0.85
atomicMoveToInstallPathFunction · 0.85
rmFunction · 0.85
toErrorFunction · 0.85
errorMessageFunction · 0.50
logErrorFunction · 0.50

Tested by

no test coverage detected