MCPcopy
hub / github.com/codeaashu/claude-code / fetchAndStoreChangelog

Function fetchAndStoreChangelog

src/utils/releaseNotes.ts:82–119  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

80 * This runs in the background and doesn't block the UI
81 */
82export async function fetchAndStoreChangelog(): Promise<void> {
83 // Skip in noninteractive mode
84 if (getIsNonInteractiveSession()) {
85 return
86 }
87
88 // Skip network requests if nonessential traffic is disabled
89 if (isEssentialTrafficOnly()) {
90 return
91 }
92
93 const response = await axios.get(RAW_CHANGELOG_URL)
94 if (response.status === 200) {
95 const changelogContent = response.data
96
97 // Skip write if content unchanged — writing Date.now() defeats the
98 // dirty-check in saveGlobalConfig since the timestamp always differs.
99 if (changelogContent === changelogMemoryCache) {
100 return
101 }
102
103 const cachePath = getChangelogCachePath()
104
105 // Ensure cache directory exists
106 await mkdir(dirname(cachePath), { recursive: true })
107
108 // Write changelog to cache file
109 await writeFile(cachePath, changelogContent, { encoding: 'utf-8' })
110 changelogMemoryCache = changelogContent
111
112 // Update timestamp in config
113 const changelogLastFetched = Date.now()
114 saveGlobalConfig(current => ({
115 ...current,
116 changelogLastFetched,
117 }))
118 }
119}
120
121/**
122 * Get the stored changelog from cache file if available.

Callers 2

checkForReleaseNotesFunction · 0.85
callFunction · 0.85

Calls 6

isEssentialTrafficOnlyFunction · 0.85
getChangelogCachePathFunction · 0.85
mkdirFunction · 0.85
saveGlobalConfigFunction · 0.85
getMethod · 0.65

Tested by

no test coverage detected