()
| 11 | const execAsync = promisify(exec); |
| 12 | |
| 13 | export async function getLatestVersion() { |
| 14 | const response = await fetchWithTimeout( |
| 15 | `https://api.promptfoo.dev/api/latestVersion`, |
| 16 | { |
| 17 | headers: { 'x-promptfoo-silent': 'true' }, |
| 18 | }, |
| 19 | 10000, |
| 20 | ); |
| 21 | if (!response.ok) { |
| 22 | throw new Error(`Failed to fetch package information for promptfoo`); |
| 23 | } |
| 24 | const data = (await response.json()) as { latestVersion: string }; |
| 25 | return data.latestVersion; |
| 26 | } |
| 27 | |
| 28 | export async function checkForUpdates(): Promise<boolean> { |
| 29 | if (getEnvBool('PROMPTFOO_DISABLE_UPDATE')) { |
no test coverage detected
searching dependent graphs…