(latest: string, deps: UpgradeDeps)
| 447 | * every future one — keeps serving the old version. Exported for unit tests. |
| 448 | */ |
| 449 | export 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 |
no test coverage detected