MCPcopy Create free account
hub / github.com/Noumena-Network/code / installVersionFromBinary

Function installVersionFromBinary

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

Source from the content-addressed store, hash-verified

371}
372
373async function installVersionFromBinary(
374 stagingPath: string,
375 installPath: string,
376) {
377 try {
378 // For direct binary downloads (GCS, generic bucket), the binary is directly in staging
379 const platform = getPlatform()
380 const binaryName = getBinaryName(platform)
381 const stagedBinaryPath = join(stagingPath, binaryName)
382
383 try {
384 await stat(stagedBinaryPath)
385 } catch {
386 logEvent('ncode_native_install_binary_failure', {
387 stage_binary_exists: true,
388 error_binary_not_found: true,
389 })
390 const error = new Error('Staged binary not found')
391 throw error
392 }
393
394 await atomicMoveToInstallPath(stagedBinaryPath, installPath)
395
396 // Clean up staging directory
397 await rm(stagingPath, { recursive: true, force: true })
398
399 logEvent('ncode_native_install_binary_success', {})
400 } catch (error) {
401 if (!errorMessage(error).includes('Staged binary not found')) {
402 logEvent('ncode_native_install_binary_failure', {
403 stage_atomic_move: true,
404 error_move_failed: true,
405 })
406 }
407 logError(toError(error))
408 throw error
409 }
410}
411
412async function installVersion(
413 stagingPath: string,

Callers 1

installVersionFunction · 0.85

Calls 9

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

Tested by

no test coverage detected