MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / noticeFrom

Function noticeFrom

src/upgrade/update-check.ts:141–153  ·  view source on GitHub ↗
(cache: UpdateCheckCacheFile | null, d: ResolvedDeps)

Source from the content-addressed store, hash-verified

139}
140
141function noticeFrom(cache: UpdateCheckCacheFile | null, d: ResolvedDeps): string | null {
142 if (!cache?.latest) return null;
143 // A dev build whose package.json couldn't be read reports the sentinel
144 // version; any comparison against it would always claim an update.
145 if (d.currentVersion === '0.0.0-unknown') return null;
146 // Canonicalize BOTH sides before comparing or rendering — a non-semver
147 // `latest` (garbage redirect, tampered cache) yields no notice at all
148 // rather than flowing into agent-visible text.
149 const latest = canonicalVersionTag(cache.latest);
150 const current = canonicalVersionTag(d.currentVersion);
151 if (!latest || !current) return null;
152 return isUpdateAvailable(current, latest) ? formatUpdateNotice(current, latest) : null;
153}
154
155function cacheIsFresh(cache: UpdateCheckCacheFile | null, nowMs: number): boolean {
156 if (!cache) return false;

Callers 2

refreshUpdateCheckFunction · 0.85
getUpdateNoticeFunction · 0.85

Calls 3

isUpdateAvailableFunction · 0.90
canonicalVersionTagFunction · 0.85
formatUpdateNoticeFunction · 0.85

Tested by

no test coverage detected