Skip to content

feat(doctor): version check + 24h cache (#280) - #282

Merged
hurttlocker merged 1 commit into
mainfrom
feat/280-version-check
Mar 1, 2026
Merged

hurttlocker merged 1 commit into
mainfrom
feat/280-version-check

Conversation

@hurttlocker

Copy link
Copy Markdown
Owner

What

cortex doctor now compares the running binary version against the latest GitHub release. Catches the version drift x7 hit during first-time setup.

How it works

  1. Checks ~/.cortex/.version-cache first (24h TTL)
  2. If cache is stale or missing, hits api.github.com/repos/hurttlocker/cortex/releases/latest (5s timeout, no auth needed)
  3. Compares tag_name against the compiled version var
  4. Caches result for 24h

Output examples

Behind:

⚠ version: running 1.2.0, latest is v1.3.0
  → Update with `brew upgrade cortex` or download from https://github.com/hurttlocker/cortex/releases/tag/v1.3.0

Current:

✓ version: up to date (1.3.0)

Offline:

✓ version: running 1.3.0 (update check skipped — offline or rate-limited)

Safety

  • Never blocks (5s timeout, graceful fallback)
  • No auth required (public repo)
  • 24h cache prevents API spam
  • All 890+ tests pass

Closes #280

cortex doctor now checks if the running binary is behind the latest
GitHub release. Results are cached in ~/.cortex/.version-cache for 24h
so it doesn't hit the GitHub API on every run.

When behind:
  ⚠ version: running 1.2.0, latest is v1.3.0
  Hint: Update with brew upgrade cortex or download from releases

When current:
  ✓ version: up to date (1.3.0)

When offline:
  ✓ version: running 1.3.0 (update check skipped — offline or rate-limited)

Never blocks — gracefully degrades when GitHub is unreachable.

Closes #280
@hurttlocker
hurttlocker merged commit b052bb6 into main Mar 1, 2026
4 checks passed
@hurttlocker
hurttlocker deleted the feat/280-version-check branch March 1, 2026 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: version check — warn if binary is behind latest release

1 participant