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

Function getUpdateNotice

src/upgrade/update-check.ts:209–226  ·  view source on GitHub ↗
(deps: UpdateCheckDeps = {})

Source from the content-addressed store, hash-verified

207 * still returns immediately from the stale cache.
208 */
209export function getUpdateNotice(deps: UpdateCheckDeps = {}): string | null {
210 const d = resolveDeps(deps);
211 if (updateCheckDisabled(d.env)) return null;
212
213 const useMemo = deps.dir === undefined && deps.now === undefined;
214 const nowMs = d.now();
215 if (useMemo && noticeMemo && nowMs - noticeMemo.at < NOTICE_MEMO_TTL_MS) {
216 return noticeMemo.value;
217 }
218
219 const cached = readUpdateCheckCache(d.dir);
220 if (!cacheIsFresh(cached, nowMs)) {
221 void refreshUpdateCheck(deps).catch(() => { /* fail silent */ });
222 }
223 const value = noticeFrom(cached, d);
224 if (useMemo) noticeMemo = { at: nowMs, value };
225 return value;
226}
227
228/** Test hook: clear the per-process memo. */
229export function resetUpdateNoticeMemo(): void {

Callers 3

handleStatusMethod · 0.90
initializeInstructionsFunction · 0.90

Calls 6

resolveDepsFunction · 0.85
updateCheckDisabledFunction · 0.85
readUpdateCheckCacheFunction · 0.85
cacheIsFreshFunction · 0.85
refreshUpdateCheckFunction · 0.85
noticeFromFunction · 0.85

Tested by

no test coverage detected