MCPcopy Index your code
hub / github.com/ChatLab/ChatLab / isNewerVersion

Function isNewerVersion

apps/cli/src/update-checker.ts:58–73  ·  view source on GitHub ↗
(latest: string, current: string)

Source from the content-addressed store, hash-verified

56}
57
58function isNewerVersion(latest: string, current: string): boolean {
59 const parse = (v: string) => {
60 const [core, pre] = v.split('-', 2)
61 const parts = core.split('.').map(Number)
62 return { major: parts[0] || 0, minor: parts[1] || 0, patch: parts[2] || 0, pre }
63 }
64 const l = parse(latest)
65 const c = parse(current)
66 if (l.major !== c.major) return l.major > c.major
67 if (l.minor !== c.minor) return l.minor > c.minor
68 if (l.patch !== c.patch) return l.patch > c.patch
69 // Design note: prerelease users are not prompted for prerelease-to-prerelease updates.
70 // Only a stable release with the same core version should supersede a prerelease build.
71 if (c.pre && !l.pre) return true
72 return false
73}
74
75async function fetchLatestVersion(): Promise<string | null> {
76 try {

Callers 1

Calls 1

parseFunction · 0.85

Tested by

no test coverage detected