MCPcopy
hub / github.com/promptfoo/promptfoo / getLatestVersion

Function getLatestVersion

src/updates.ts:13–26  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

11const execAsync = promisify(exec);
12
13export 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
28export async function checkForUpdates(): Promise<boolean> {
29 if (getEnvBool('PROMPTFOO_DISABLE_UPDATE')) {

Callers 3

updates.test.tsFile · 0.90
version.tsFile · 0.90
checkForUpdatesFunction · 0.85

Calls 1

fetchWithTimeoutFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…