MCPcopy Index your code
hub / github.com/continuedev/continue / getLatestVersion

Function getLatestVersion

extensions/cli/src/version.ts:29–63  ·  view source on GitHub ↗
(
  signal?: AbortSignal,
)

Source from the content-addressed store, hash-verified

27let latestVersionCache: Promise<string | null> | null = null;
28
29export async function getLatestVersion(
30 signal?: AbortSignal,
31): Promise<string | null> {
32 // Return cached promise if it exists
33 if (latestVersionCache) {
34 return latestVersionCache;
35 }
36
37 // Create and cache the promise
38 latestVersionCache = (async () => {
39 try {
40 const id = getEventUserId();
41 const response = await fetch(
42 `https://api.continue.dev/cn/info?id=${encodeURIComponent(id)}`,
43 { signal },
44 );
45 if (!response.ok) {
46 throw new Error(`HTTP error! status: ${response.status}`);
47 }
48 const data = await response.json();
49 return data.version;
50 } catch (error) {
51 if (error instanceof Error && error.name === "AbortError") {
52 // Request was aborted, don't log
53 return null;
54 }
55 logger?.debug(
56 "Warning: Could not fetch latest version from api.continue.dev",
57 );
58 return null;
59 }
60 })();
61
62 return latestVersionCache;
63}
64
65getLatestVersion()
66 .then((version) => {

Callers 2

version.tsFile · 0.85
checkAndAutoUpdateMethod · 0.85

Calls 3

getEventUserIdFunction · 0.85
fetchFunction · 0.50
debugMethod · 0.45

Tested by

no test coverage detected