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

Function installLatestImpl

src/utils/nativeInstaller/installer.ts:964–1004  ·  view source on GitHub ↗
(
  channelOrVersion: string,
  forceReinstall: boolean = false,
)

Source from the content-addressed store, hash-verified

962}
963
964async function installLatestImpl(
965 channelOrVersion: string,
966 forceReinstall: boolean = false,
967): Promise<InstallLatestResult> {
968 const updateResult = await updateLatest(channelOrVersion, forceReinstall)
969
970 if (!updateResult.success) {
971 return {
972 latestVersion: null,
973 wasUpdated: false,
974 lockFailed: updateResult.lockFailed,
975 lockHolderPid: updateResult.lockHolderPid,
976 }
977 }
978
979 // Installation succeeded (early return above covers failure). Mark as native
980 // and disable legacy auto-updater to protect symlinks.
981 const config = getGlobalConfig()
982 if (config.installMethod !== 'native') {
983 saveGlobalConfig(current => ({
984 ...current,
985 installMethod: 'native',
986 // Disable legacy auto-updater to prevent npm sessions from deleting native symlinks.
987 // Native installations use NativeAutoUpdater instead, which respects native installation.
988 autoUpdates: false,
989 // Mark this as protection-based, not user preference
990 autoUpdatesProtectedForNative: true,
991 }))
992 logForDebugging(
993 'Native installer: Set installMethod to "native" and disabled legacy auto-updater for protection',
994 )
995 }
996
997 void cleanupOldVersions()
998
999 return {
1000 latestVersion: updateResult.latestVersion,
1001 wasUpdated: updateResult.success,
1002 lockFailed: false,
1003 }
1004}
1005
1006async function getVersionFromSymlink(
1007 symlinkPath: string,

Callers 1

installLatestFunction · 0.85

Calls 5

updateLatestFunction · 0.85
cleanupOldVersionsFunction · 0.85
getGlobalConfigFunction · 0.50
saveGlobalConfigFunction · 0.50
logForDebuggingFunction · 0.50

Tested by

no test coverage detected