MCPcopy Create free account
hub / github.com/Noumena-Network/code / migrateChangelogFromConfig

Function migrateChangelogFromConfig

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

Source from the content-addressed store, hash-verified

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

Callers 1

runMigrationsFunction · 0.85

Calls 4

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

Tested by

no test coverage detected