MCPcopy Create free account
hub / github.com/continuedev/continue / compareVersions

Function compareVersions

extensions/cli/src/version.ts:77–105  ·  view source on GitHub ↗
(
  current: string,
  latest: string,
)

Source from the content-addressed store, hash-verified

75 });
76
77export function compareVersions(
78 current: string,
79 latest: string,
80): "newer" | "same" | "older" {
81 if (current === "unknown" || latest === "unknown") {
82 return "same";
83 }
84
85 // Simple semantic version comparison
86 const parseVersion = (version: string) => {
87 const parts = version
88 .replace(/^v/, "")
89 .split(".")
90 .map((part) => parseInt(part, 10));
91 return { major: parts[0] || 0, minor: parts[1] || 0, patch: parts[2] || 0 };
92 };
93
94 const currentParts = parseVersion(current);
95 const latestParts = parseVersion(latest);
96
97 if (currentParts.major > latestParts.major) return "newer";
98 if (currentParts.major < latestParts.major) return "older";
99 if (currentParts.minor > latestParts.minor) return "newer";
100 if (currentParts.minor < latestParts.minor) return "older";
101 if (currentParts.patch > latestParts.patch) return "newer";
102 if (currentParts.patch < latestParts.patch) return "older";
103
104 return "same";
105}

Callers 1

checkAndAutoUpdateMethod · 0.85

Calls 1

parseVersionFunction · 0.85

Tested by

no test coverage detected