MCPcopy Create free account
hub / github.com/AnukarOP/claude-code-leaked / checkForReleaseNotes

Function checkForReleaseNotes

source code/utils/releaseNotes.ts:289–329  ·  view source on GitHub ↗
(
  lastSeenVersion: string | null | undefined,
  currentVersion: string = MACRO.VERSION,
)

Source from the content-addressed store, hash-verified

287 * @returns An object with hasReleaseNotes and the releaseNotes content
288 */
289export async function checkForReleaseNotes(
290 lastSeenVersion: string | null | undefined,
291 currentVersion: string = MACRO.VERSION,
292): Promise<{ hasReleaseNotes: boolean; releaseNotes: string[] }> {
293 // For Ant builds, use VERSION_CHANGELOG bundled at build time
294 if (process.env.USER_TYPE === 'ant') {
295 const changelog = MACRO.VERSION_CHANGELOG
296 if (changelog) {
297 const commits = changelog.trim().split('\n').filter(Boolean)
298 return {
299 hasReleaseNotes: commits.length > 0,
300 releaseNotes: commits,
301 }
302 }
303 return {
304 hasReleaseNotes: false,
305 releaseNotes: [],
306 }
307 }
308
309 // Ensure the in-memory cache is populated for subsequent sync reads
310 const cachedChangelog = await getStoredChangelog()
311
312 // If the version has changed or we don't have a cached changelog, fetch a new one
313 // This happens in the background and doesn't block the UI
314 if (lastSeenVersion !== currentVersion || !cachedChangelog) {
315 fetchAndStoreChangelog().catch(error => logError(toError(error)))
316 }
317
318 const releaseNotes = getRecentReleaseNotes(
319 currentVersion,
320 lastSeenVersion,
321 cachedChangelog,
322 )
323 const hasReleaseNotes = releaseNotes.length > 0
324
325 return {
326 hasReleaseNotes,
327 releaseNotes,
328 }
329}
330
331/**
332 * Synchronous variant of checkForReleaseNotes for React render paths.

Callers 1

setupFunction · 0.85

Calls 5

getStoredChangelogFunction · 0.85
fetchAndStoreChangelogFunction · 0.85
toErrorFunction · 0.85
getRecentReleaseNotesFunction · 0.85
logErrorFunction · 0.70

Tested by

no test coverage detected