MCPcopy Create free account
hub / github.com/AnukarOP/claude-code-leaked / parseChangelog

Function parseChangelog

source code/utils/releaseNotes.ts:158–198  ·  view source on GitHub ↗
(content: string)

Source from the content-addressed store, hash-verified

156 * @returns Record mapping version numbers to arrays of release notes
157 */
158export function parseChangelog(content: string): Record<string, string[]> {
159 try {
160 if (!content) return {}
161
162 // Parse the content
163 const releaseNotes: Record<string, string[]> = {}
164
165 // Split by heading lines (## X.X.X)
166 const sections = content.split(/^## /gm).slice(1) // Skip the first section which is the header
167
168 for (const section of sections) {
169 const lines = section.trim().split('\n')
170 if (lines.length === 0) continue
171
172 // Extract version from the first line
173 // Handle both "1.2.3" and "1.2.3 - YYYY-MM-DD" formats
174 const versionLine = lines[0]
175 if (!versionLine) continue
176
177 // First part before any dash is the version
178 const version = versionLine.split(' - ')[0]?.trim() || ''
179 if (!version) continue
180
181 // Extract bullet points
182 const notes = lines
183 .slice(1)
184 .filter(line => line.trim().startsWith('- '))
185 .map(line => line.trim().substring(2).trim())
186 .filter(Boolean)
187
188 if (notes.length > 0) {
189 releaseNotes[version] = notes
190 }
191 }
192
193 return releaseNotes
194 } catch (error) {
195 logError(toError(error))
196 return {}
197 }
198}
199
200/**
201 * Gets release notes to show based on the previously seen version.

Callers 3

getRecentReleaseNotesFunction · 0.85
getAllReleaseNotesFunction · 0.85

Calls 2

toErrorFunction · 0.85
logErrorFunction · 0.70

Tested by

no test coverage detected