(maxItems: number)
| 310 | * For external users, uses public changelog |
| 311 | */ |
| 312 | export function getRecentReleaseNotesSync(maxItems: number): string[] { |
| 313 | // For ants, use bundled changelog |
| 314 | if (process.env.USER_TYPE === 'ant') { |
| 315 | const changelog = MACRO.VERSION_CHANGELOG |
| 316 | if (changelog) { |
| 317 | const commits = changelog.trim().split('\n').filter(Boolean) |
| 318 | return commits.slice(0, maxItems) |
| 319 | } |
| 320 | return [] |
| 321 | } |
| 322 | |
| 323 | const changelog = getStoredChangelogFromMemory() |
| 324 | if (!changelog) { |
| 325 | return [] |
| 326 | } |
| 327 | |
| 328 | let parsed |
| 329 | try { |
| 330 | parsed = parseChangelog(changelog) |
| 331 | } catch { |
| 332 | return [] |
| 333 | } |
| 334 | |
| 335 | // Get notes from recent versions |
| 336 | const allNotes: string[] = [] |
| 337 | const versions = Object.keys(parsed) |
| 338 | .sort((a, b) => (gt(a, b) ? -1 : 1)) |
| 339 | .slice(0, 3) // Look at top 3 recent versions |
| 340 | |
| 341 | for (const version of versions) { |
| 342 | const notes = parsed[version] |
| 343 | if (notes) { |
| 344 | allNotes.push(...notes) |
| 345 | } |
| 346 | } |
| 347 | |
| 348 | // Return raw notes without filtering or premature truncation |
| 349 | return allNotes.slice(0, maxItems) |
| 350 | } |
| 351 |
no test coverage detected