MCPcopy
hub / github.com/claude-code-best/claude-code / getLatestVersion

Function getLatestVersion

src/cli/updateCCB.ts:67–78  ·  view source on GitHub ↗

* Get the latest version from npm registry.

()

Source from the content-addressed store, hash-verified

65 * Get the latest version from npm registry.
66 */
67async function getLatestVersion(): Promise<string | null> {
68 const result = await execFileNoThrowWithCwd(
69 'npm',
70 ['view', `${PACKAGE_NAME}@latest`, 'version', '--prefer-online'],
71 { abortSignal: AbortSignal.timeout(10_000), cwd: homedir() },
72 )
73 if (result.code !== 0) {
74 logForDebugging(`npm view failed: ${result.stderr}`)
75 return null
76 }
77 return result.stdout.trim()
78}
79
80/**
81 * Compare two semver strings. Returns true if a >= b.

Callers 2

updateCCBFunction · 0.70
AutoUpdaterFunction · 0.50

Calls 2

execFileNoThrowWithCwdFunction · 0.85
logForDebuggingFunction · 0.50

Tested by

no test coverage detected