MCPcopy Index your code
hub / github.com/upstash/context7 / shouldShowUpdateNotification

Function shouldShowUpdateNotification

packages/cli/src/utils/update-check.ts:261–280  ·  view source on GitHub ↗
(
  info: UpdateInfo,
  options: { now?: number; stateFile?: string; cooldownMs?: number } = {}
)

Source from the content-addressed store, hash-verified

259}
260
261export async function shouldShowUpdateNotification(
262 info: UpdateInfo,
263 options: { now?: number; stateFile?: string; cooldownMs?: number } = {}
264): Promise<boolean> {
265 if (!info.updateAvailable) return false;
266
267 const now = options.now ?? Date.now();
268 const cooldownMs = options.cooldownMs ?? DEFAULT_CACHE_TTL_MS;
269 const state = await readUpdateState(options.stateFile);
270
271 if (
272 state.notifiedVersion === info.latestVersion &&
273 state.lastNotifiedAt &&
274 now - state.lastNotifiedAt < cooldownMs
275 ) {
276 return false;
277 }
278
279 return true;
280}
281
282export async function markUpdateNotificationShown(
283 latestVersion: string,

Callers 3

maybeShowUpgradeNoticeFunction · 0.85

Calls 1

readUpdateStateFunction · 0.85

Tested by

no test coverage detected