fix(cli): doctor only flags dependencies behind npm latest

RI
3h ago
+29-5

Summary

capgo doctor (and the capgo_doctor MCP tool) treated any dependency whose version differed from npm's latest as outdated, including versions newer than latest. It now flags a dependency only when it is behind latest. Versions it can't parse as semver keep the old inequality check.

Motivation

The release flow bumps the CLI version on main before the staged npm publish is approved. During that window, CI builds a CLI that is newer than npm's latest (for example, 8.114.6 locally against 8.114.5 on npm). The doctor then fails with "Some dependencies are not up to date". Since #4267, that makes test-mcp-project-dir-cwd-cache.mjs fail in "Run CLI tests" on every PR that runs the CLI suite.

Business Impact

Users on a prerelease or local build no longer get a false "outdated" error from doctor. PR CI no longer goes red whenever a staged CLI publish is waiting for approval.

Test Plan

  • bun run test:doctor-analytics: new assertions cover a newer-than-latest version (not outdated), an older version (outdated) and an unparseable version (inequality kept)
  • bun run typecheck and bun run lint in cli/
  • test-mcp-project-dir-cwd-cache.mjs locally: unmodified main gives 0/5 (every doctor call reports "not up to date"); with this change, all three doctor-only cases pass. The two cases that call the onboarding tools time out locally on unmodified main too, and they passed in CI before #4267.
  • CI "Run CLI tests" green

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Dependency checks now correctly distinguish older installed versions from matching or newer versions. When version values cannot be parsed, differing versions are still reported as outdated.
  • Documentation
    • Clarified how the doctor command determines whether dependencies are outdated, including how it handles newer installed versions and versions that cannot be parsed.