MCPcopy Index your code
hub / github.com/MiniMax-AI/cli / resolveVersion

Function resolveVersion

src/update/self-update.ts:63–83  ·  view source on GitHub ↗
(channel: Channel)

Source from the content-addressed store, hash-verified

61}
62
63async function resolveVersion(channel: Channel): Promise<string> {
64 if (channel !== 'stable' && channel !== 'latest') {
65 // Exact version: normalise to tag format
66 return channel.startsWith('v') ? channel : `v${channel}`;
67 }
68
69 // latest = most recent release including pre-releases
70 if (channel === 'latest') {
71 const res = await ghFetch(`/repos/${REPO}/releases?per_page=1`);
72 if (!res.ok) throw new CLIError('Failed to fetch releases from GitHub.', ExitCode.GENERAL);
73 const releases = await res.json() as Array<{ tag_name: string }>;
74 if (!releases.length) throw new CLIError('No releases found.', ExitCode.GENERAL);
75 return releases[0].tag_name;
76 }
77
78 // stable = latest non-prerelease
79 const res = await ghFetch(`/repos/${REPO}/releases/latest`);
80 if (!res.ok) throw new CLIError('Failed to fetch latest release from GitHub.', ExitCode.GENERAL);
81 const release = await res.json() as { tag_name: string };
82 return release.tag_name;
83}
84
85async function fetchManifest(version: string): Promise<Manifest> {
86 const url = `https://github.com/${REPO}/releases/download/${version}/manifest.json`;

Callers 1

resolveUpdateTargetFunction · 0.85

Calls 1

ghFetchFunction · 0.85

Tested by

no test coverage detected