Dashboard › cli › Distillation
328ce6fc-f15c-4461-8208-27e195af7310["lore_tm_v1_uGUKzKMtx30L8m8FBiddCF51B_PGIdJ4L3fLqxF01Yw","lore_tm_v1_OdSrxNU75Yvz55ggTxDA6Qft0LJoQ6dixGth8S6ab4w","lore_tm_v1_IjkaVyeemKnQLTgyDqJ6VZKJokR9kNVpYi5tCDBoPpQ"]
packages/cli/src/lib/upgrade.ts to import valid as semverValid from semver, import compareVersions, and stop directly importing GITHUB_RELEASES_URL.packages/cli/src/lib/upgrade.ts changes fetchLatestNightlyVersion(signal?: AbortSignal, source?: UpgradeSource): Promise<string> into a wrapper around fetchLatestNightlyVersionWithSource(signal, source ? [source] : UPGRADE_SOURCES), returning only .version; an explicit source limits resolution to that source, while omission uses the ordered source list.packages/cli/src/lib/upgrade.ts adds resolveExistingUpgradeVersion(...), which invokes resolveUpgradeSource(...).packages/cli/src/lib/upgrade.ts preserves backward-compatible exports: InstallationMethod is re-exported as a type from ./binary.js, and parseInstallationMethod is re-exported from ./binary.js.packages/cli/src/lib/upgrade.ts fully consumes binary downloads via await response.arrayBuffer() and writes new Uint8Array(body) using writeFile; the stated reason is that Bun.write(path, Response) with a large streaming body can exit before completion due to Bun issue https://github.com/oven-sh/bun/issues/13237.packages/cli/test/lib/upgrade.test.ts found coverage for source-aware/default behavior across fetchLatestFromGitHub(), versionExists(...), fetchLatestNightlyVersion(...), executeUpgrade(...), and downloadBinaryToTemp(...), including explicit UPGRADE_SOURCES[0] calls and stable/nightly versions such as 1.0.0, 99.99.99, 0.14.0-dev.1772661724, 0.14.0-dev.9999999999, and 0.0.0-dev.1740000000.packages/cli/test/lib/ghcr.test.ts found source-aware tests for getAnonymousToken(UPGRADE_SOURCES[0]) and fetchNightlyManifest("token", undefined, UPGRADE_SOURCES[0]), alongside tests for fetchManifest(...) and downloadNightlyBlob(...).packages/cli/src/lib/upgrade.ts includes: resolveUpgradeSource(...) at lines 442, 535, and 620; source-specific getAnonymousToken(source, signal) and fetchManifest(token, tag, signal, source) at lines 547-548; getGitHubReleaseByTagUrl(version, source) at line 621; source-specific nightly existence checks at lines 648-650; source-specific stable release checks at line 670; source-specific nightly manifest/blob download at lines 866-872; and getBinaryDownloadUrl(version, source) at line 905.packages/cli/src/lib/upgrade.ts: fetchLatestFromGitHub at line 462, fetchLatestNightlyVersion at line 561, versionExists at line 692, downloadBinaryToTemp at line 1042, and executeUpgrade at line 1280.packages/cli/src/lib/upgrade.ts passes the selected source into attemptDeltaUpgrade at line 1141 and into download execution through downloadBinaryToTemp around line 1290.packages/cli/src/lib/ghcr.ts exposes source-aware GHCR operations: getAnonymousToken at line 208, fetchManifest at line 249, fetchNightlyManifest at line 285, downloadNightlyBlob at line 354, listTags at line 495, and downloadLayerBlob at line 538; fetchNightlyManifest calls fetchManifest(token, GHCR_TAG, signal, source), and downloadLayerBlob calls downloadNightlyBlob(token, digest, signal, source).packages/cli/src/lib/delta-upgrade.ts uses getGitHubReleasesUrl(source) for source-specific release discovery at lines 128 and 210; the latter requests ?per_page=12. It also exposes attemptDeltaUpgrade at line 595, prefetchNightlyPatches at line 688, and prefetchStablePatches at line 696.packages/cli/src/lib/delta-upgrade.ts builds patch chains using client.listTags(opts.token, PATCH_TAG_PREFIX, opts.signal) and fetches each chain tag with client.fetchManifest(opts.token, tag, opts.signal).packages/cli/src/lib/version-check.ts passes the resolved source to both prefetchNightlyPatches(latestVersion, signal, source) and prefetchStablePatches(latestVersion, signal, source) at lines 242 and 244.packages/cli/src/lib/release-notes.ts performs source-specific changelog release discovery with ${getGitHubReleasesUrl(source)}?per_page=${CHANGELOG_MAX_RELEASES} at line 592 and exports fetchChangelog at line 752.packages/cli/src/commands/cli/upgrade.ts checks targets with versionExists(lookupMethod, target) at line 297, passes source into executeUpgrade(method, target, downloadTag, offline, setMessage, source) at line 680, passes source into curl execution at line 766, and delegates changelog retrieval to fetchChangelog(...) at line 875.