MCPcopy Index your code
hub / github.com/Noumena-Network/code / update

Function update

src/cli/update.ts:32–425  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

30import { isInternalBuild } from 'src/capabilities/static.js'
31
32export async function update() {
33 logEvent('ncode_update_check', {})
34 writeToStdout(`Current version: ${MACRO.VERSION}\n`)
35
36 const channel = getInitialSettings()?.autoUpdatesChannel ?? 'latest'
37 writeToStdout(`Checking for updates to ${channel} version...\n`)
38
39 logForDebugging('update: Starting update check')
40
41 // Run diagnostic to detect potential issues
42 logForDebugging('update: Running diagnostic')
43 const diagnostic = await getDoctorDiagnostic()
44 logForDebugging(`update: Installation type: ${diagnostic.installationType}`)
45 logForDebugging(
46 `update: Config install method: ${diagnostic.configInstallMethod}`,
47 )
48
49 // Check for multiple installations
50 if (diagnostic.multipleInstallations.length > 1) {
51 writeToStdout('\n')
52 writeToStdout(chalk.yellow('Warning: Multiple installations found') + '\n')
53 for (const install of diagnostic.multipleInstallations) {
54 const current =
55 diagnostic.installationType === install.type
56 ? ' (currently running)'
57 : ''
58 writeToStdout(`- ${install.type} at ${install.path}${current}\n`)
59 }
60 }
61
62 // Display warnings if any exist
63 if (diagnostic.warnings.length > 0) {
64 writeToStdout('\n')
65 for (const warning of diagnostic.warnings) {
66 logForDebugging(`update: Warning detected: ${warning.issue}`)
67
68 // Don't skip PATH warnings - they're always relevant
69 // The user needs to know that 'which ncode' points elsewhere
70 logForDebugging(`update: Showing warning: ${warning.issue}`)
71
72 writeToStdout(chalk.yellow(`Warning: ${warning.issue}\n`))
73
74 writeToStdout(chalk.bold(`Fix: ${warning.fix}\n`))
75 }
76 }
77
78 // Update config if installMethod is not set (but skip for package managers)
79 const config = getGlobalConfig()
80 if (
81 !config.installMethod &&
82 diagnostic.installationType !== 'package-manager'
83 ) {
84 writeToStdout('\n')
85 writeToStdout('Updating configuration to track installation method...\n')
86 let detectedMethod: 'local' | 'native' | 'global' | 'unknown' = 'unknown'
87
88 // Map diagnostic installation type to config install method
89 switch (diagnostic.installationType) {

Calls 15

writeToStdoutFunction · 0.85
getDoctorDiagnosticFunction · 0.85
gracefulShutdownFunction · 0.85
gteFunction · 0.85
removeInstalledSymlinkFunction · 0.85
localInstallationExistsFunction · 0.85
installGlobalPackageFunction · 0.85
logEventFunction · 0.50
getInitialSettingsFunction · 0.50

Tested by

no test coverage detected