/** * Minimal semver comparison for release ordering. Kept out of * `cli/commands/update.ts` so the `version` command path does not have to load * the 1200-line updater (and its embedded-skill bundle) just to decide whether * a cached release is newer. */ export function compareSemVer(v1: string, v2: string): number { const p1 = v1.replace(/^v/, "").split(".").map((n) => Number.parseInt(n, 10) || 0); const p2 = v2.replace(/^v/, "").split(".").map((n) => Number.parseInt(n, 10) || 0); for (let i = 0; i < Math.max(p1.length, p2.length); i++) { const a = p1[i] ?? 0; const b = p2[i] ?? 0; if (a > b) return 1; if (a < b) return -1; } return 0; } export function isNewerVersion(latest: string, current: string): boolean { return compareSemVer(latest, current) > 0; }