* Log the outcome of the post-upgrade version probe. On a match the user * knows the current terminal is already serving the new version; on a * mismatch they get told exactly which stale install is hijacking their PATH * instead of discovering it via a mysteriously unchanged `codegraph -v`. * I
(latest: string, deps: UpgradeDeps)
| 472 | * (which spawns the PATH-resolved binary) on it. |
| 473 | */ |
| 474 | function reportResolvedVersion(latest: string, deps: UpgradeDeps): VersionProbe { |
| 475 | const { method } = deps; |
| 476 | // A project-local npm install isn't served by PATH's `codegraph` (that |
| 477 | // would be some other install) — a probe could only false-alarm. |
| 478 | if (method.kind === 'npm' && method.scope === 'local') return 'inconclusive'; |
| 479 | const probe = verifyResolvedVersion(latest, deps); |
| 480 | switch (probe) { |
| 481 | case 'match': |
| 482 | deps.log(c.green(`✓ \`codegraph\` on your PATH now reports ${latest} — this terminal is already using it.`)); |
| 483 | break; |
| 484 | case 'mismatch': |
| 485 | deps.warn(`Installed ${latest}, but the \`codegraph\` this terminal resolves still reports an older version.`); |
| 486 | deps.log(c.dim('Another CodeGraph install earlier on your PATH is shadowing the one just upgraded.')); |
| 487 | deps.log(c.dim('Find every copy with `which -a codegraph` (Windows: `where codegraph`) and remove or upgrade the stale one.')); |
| 488 | break; |
| 489 | case 'inconclusive': |
| 490 | deps.log(c.dim('Open a new terminal if `codegraph --version` looks unchanged (PATH cache).')); |
| 491 | break; |
| 492 | } |
| 493 | return probe; |
| 494 | } |
| 495 | |
| 496 | /** |
| 497 | * Refresh the agent surfaces previous installs wrote — the marker-fenced |
no test coverage detected