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

Function getRecentReleaseNotes

src/utils/releaseNotes.ts:208–241  ·  view source on GitHub ↗
(
  currentVersion: string,
  previousVersion: string | null | undefined,
  changelogContent: string = getStoredChangelogFromMemory(),
)

Source from the content-addressed store, hash-verified

206 * @returns Array of release notes to display
207 */
208export function getRecentReleaseNotes(
209 currentVersion: string,
210 previousVersion: string | null | undefined,
211 changelogContent: string = getStoredChangelogFromMemory(),
212): string[] {
213 try {
214 const releaseNotes = parseChangelog(changelogContent)
215
216 // Strip SHA from both versions to compare only the base versions
217 const baseCurrentVersion = coerce(currentVersion)
218 const basePreviousVersion = previousVersion ? coerce(previousVersion) : null
219
220 if (
221 !basePreviousVersion ||
222 (baseCurrentVersion &&
223 gt(baseCurrentVersion.version, basePreviousVersion.version))
224 ) {
225 // Get all versions that are newer than the last seen version
226 return Object.entries(releaseNotes)
227 .filter(
228 ([version]) =>
229 !basePreviousVersion || gt(version, basePreviousVersion.version),
230 )
231 .sort(([versionA], [versionB]) => (gt(versionA, versionB) ? -1 : 1)) // Sort newest first
232 .flatMap(([_, notes]) => notes)
233 .filter(Boolean)
234 .slice(0, MAX_RELEASE_NOTES_SHOWN)
235 }
236 } catch (error) {
237 logError(toError(error))
238 return []
239 }
240 return []
241}
242
243/**
244 * Gets all release notes as an array of [version, notes] arrays.

Callers 2

checkForReleaseNotesFunction · 0.85
checkForReleaseNotesSyncFunction · 0.85

Calls 6

parseChangelogFunction · 0.85
gtFunction · 0.85
entriesMethod · 0.80
logErrorFunction · 0.70
toErrorFunction · 0.70

Tested by

no test coverage detected