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

Function migrateChangelogFromConfig

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

Source from the content-addressed store, hash-verified

53 * before any other config saves that might re-add the deprecated field.
54 */
55export async function migrateChangelogFromConfig(): Promise<void> {
56 const config = getGlobalConfig()
57 if (!config.cachedChangelog) {
58 return
59 }
60
61 const cachePath = getChangelogCachePath()
62
63 // If cache file doesn't exist, create it from old config
64 try {
65 await mkdir(dirname(cachePath), { recursive: true })
66 await writeFile(cachePath, config.cachedChangelog, {
67 encoding: 'utf-8',
68 flag: 'wx', // Write only if file doesn't exist
69 })
70 } catch {
71 // File already exists, which is fine - skip silently
72 }
73
74 // Remove the deprecated field from config
75 saveGlobalConfig(({ cachedChangelog: _, ...rest }) => rest)
76}
77
78/**
79 * Fetch the changelog from GitHub and store it in cache file

Callers 1

runMigrationsFunction · 0.85

Calls 4

getGlobalConfigFunction · 0.85
getChangelogCachePathFunction · 0.85
mkdirFunction · 0.85
saveGlobalConfigFunction · 0.85

Tested by

no test coverage detected