Open History to see the last commit
1import { compareCliVersions, normalizeCliVersion } from "./cliVersion";
2
3const CODEX_VERSION_PATTERN = /\bv?(\d+\.\d+(?:\.\d+)?(?:-[0-9A-Za-z.-]+)?)\b/;
4
5export const MINIMUM_CODEX_CLI_VERSION = "0.37.0";
6
7export const compareCodexCliVersions = compareCliVersions;
8
9export function parseCodexCliVersion(output: string): string | null {
10 const match = CODEX_VERSION_PATTERN.exec(output);
11 if (!match?.[1]) {
12 return null;
13 }
14
15 return normalizeCliVersion(match[1]);
16}
17
18export function isCodexCliVersionSupported(version: string): boolean {
19 return compareCodexCliVersions(version, MINIMUM_CODEX_CLI_VERSION) >= 0;
20}
21
22export function formatCodexCliUpgradeMessage(version: string | null): string {
23 const versionLabel = version ? `v${version}` : "the installed version";
24 return `Codex CLI ${versionLabel} is too old for T3 Code. Upgrade to v${MINIMUM_CODEX_CLI_VERSION} or newer and restart T3 Code.`;
25}