MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / verifyResolvedVersion

Function verifyResolvedVersion

src/upgrade/index.ts:449–462  ·  view source on GitHub ↗
(latest: string, deps: UpgradeDeps)

Source from the content-addressed store, hash-verified

447 * every future one — keeps serving the old version. Exported for unit tests.
448 */
449export function verifyResolvedVersion(latest: string, deps: UpgradeDeps): VersionProbe {
450 if (!deps.hasCommand('codegraph')) return 'inconclusive';
451 // Windows installs expose codegraph through a .cmd launcher; Node can't
452 // spawn .cmd files without a shell, so route through cmd.exe there.
453 const probe = deps.platform === 'win32'
454 ? deps.capture('cmd.exe', ['/d', '/s', '/c', 'codegraph --version'])
455 : deps.capture('codegraph', ['--version']);
456 if (!probe || probe.code !== 0) return 'inconclusive';
457 // `codegraph --version` prints the bare version; take the last non-empty
458 // line so a stray runtime warning above it can't spoil the parse.
459 const reported = probe.stdout.trim().split(/\r?\n/).pop()?.trim() ?? '';
460 if (!parseSemver(reported)) return 'inconclusive';
461 return compareVersions(reported, latest) === 0 ? 'match' : 'mismatch';
462}
463
464/**
465 * Log the outcome of the post-upgrade version probe. On a match the user

Callers 2

upgrade.test.tsFile · 0.90
reportResolvedVersionFunction · 0.85

Calls 2

parseSemverFunction · 0.85
compareVersionsFunction · 0.85

Tested by

no test coverage detected