MCPcopy
hub / github.com/claude-code-best/claude-code / checkForReleaseNotes

Function checkForReleaseNotes

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

Source from the content-addressed store, hash-verified

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