From 0214d667967bad2c2138dc1ec53e32994e61f37d Mon Sep 17 00:00:00 2001 From: Dean Sharon Date: Sun, 22 Mar 2026 14:32:22 +0200 Subject: [PATCH] fix(hud): version badge cache ignores post-install version changes Cache now stores only npm `latest` version. Installed version is always read live from manifest.json, so upgrading between cache refreshes no longer shows a stale upgrade notice. --- CHANGELOG.md | 3 +++ src/cli/hud/components/version-badge.ts | 7 +++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f909733..c12d626 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Fixed +- **HUD**: version upgrade notice persists after install — cache now stores only npm `latest`, reads installed version live + --- ## [1.8.2] - 2026-03-22 diff --git a/src/cli/hud/components/version-badge.ts b/src/cli/hud/components/version-badge.ts index b2a14e4..dc0158c 100644 --- a/src/cli/hud/components/version-badge.ts +++ b/src/cli/hud/components/version-badge.ts @@ -9,7 +9,6 @@ const VERSION_CACHE_KEY = 'version-check'; const VERSION_CACHE_TTL = 24 * 60 * 60 * 1000; // 24 hours interface VersionInfo { - current: string; latest: string; } @@ -80,17 +79,17 @@ export default async function versionBadge( const current = getCurrentVersion(ctx.devflowDir); if (!current) return null; - // Check cache + // Cache only the npm registry result (expensive); current is always live let info = readCache(VERSION_CACHE_KEY); if (!info) { const latest = await fetchLatestVersion(); if (latest) { - info = { current, latest }; + info = { latest }; writeCache(VERSION_CACHE_KEY, info, VERSION_CACHE_TTL); } } - if (info && compareVersions(info.current, info.latest) < 0) { + if (info && compareVersions(current, info.latest) < 0) { const badge = `\u2726 Devflow v${info.latest} \u00B7 update: npx devflow-kit init`; return { text: yellow(badge), raw: badge }; }