()
| 17 | } |
| 18 | |
| 19 | export async function call(): Promise<LocalCommandResult> { |
| 20 | // Try to fetch the latest changelog with a 500ms timeout |
| 21 | let freshNotes: Array<[string, string[]]> = [] |
| 22 | |
| 23 | try { |
| 24 | const timeoutPromise = new Promise<void>((_, reject) => { |
| 25 | setTimeout(rej => rej(new Error('Timeout')), 500, reject) |
| 26 | }) |
| 27 | |
| 28 | await Promise.race([fetchAndStoreChangelog(), timeoutPromise]) |
| 29 | freshNotes = getAllReleaseNotes(await getStoredChangelog()) |
| 30 | } catch { |
| 31 | // Either fetch failed or timed out - just use cached notes |
| 32 | } |
| 33 | |
| 34 | // If we have fresh notes from the quick fetch, use those |
| 35 | if (freshNotes.length > 0) { |
| 36 | return { type: 'text', value: formatReleaseNotes(freshNotes) } |
| 37 | } |
| 38 | |
| 39 | // Otherwise check cached notes |
| 40 | const cachedNotes = getAllReleaseNotes(await getStoredChangelog()) |
| 41 | if (cachedNotes.length > 0) { |
| 42 | return { type: 'text', value: formatReleaseNotes(cachedNotes) } |
| 43 | } |
| 44 | |
| 45 | // Nothing available, show link |
| 46 | return { |
| 47 | type: 'text', |
| 48 | value: `See the full changelog at: ${CHANGELOG_URL}`, |
| 49 | } |
| 50 | } |
| 51 | |
| 52 |
nothing calls this directly
no test coverage detected