Dashboard › cli › Distillation
eab0bebd-081f-4d8e-9041-5a353ece973c["lore_tm_v1_KQ3WZUTpadRXAQmMd-WjUcrnRTEuTeayYZvkfcbyGtI","lore_tm_v1_PCvrbhq-P-UscMxQvcfuDPepluxJtax07ADtqUKC6Jc"]
packages/cli/src/lib/delta-upgrade.ts: fetchRecentReleases(), resolveStableChain(), resolveNightlyChain(), resolveStableDelta(), resolveNightlyDelta(), attemptDeltaUpgrade(), prefetchNightlyPatches(), and prefetchStablePatches() now accept an UpgradeSource, defaulting through getPrimaryUpgradeSource() or PRIMARY_UPGRADE_SOURCE, and consistently use that selected source’s GitHub/GHCR repository.packages/cli/src/lib/upgrade.ts adding ResolvedUpgradeVersion with readonly version: string and readonly source: UpgradeSource, preserving the selected source for every later lookup and download in one standalone-binary upgrade operation.extractReleaseVersions() accepting either a single { tag_name?: string } release or an array of releases, filtering array entries that are drafts or prereleases, retaining tags beginning with source.tagPrefix, and stripping that prefix.fetchLatestFromGitHubWithSource(signal?, sources = UPGRADE_SOURCES) selecting a source through resolveUpgradeSource({ getProbeUrl: getGitHubLatestReleaseUrl, signal, sources }), parsing the already-returned probe response, stripping VERSION_PREFIX_REGEX = /^v/, returning { version, source }, and throwing UpgradeError("network_error", "No version found in GitHub release") when no CLI version is present.fetchLatestFromGitHub(signal?, source?) returning only .version; an explicit source is probed alone as [source], while omission probes ordered UPGRADE_SOURCES.fetchLatestNightlyVersionWithSource(signal?, sources = UPGRADE_SOURCES) checking cancellation first, probing each source’s getGitHubRepositoryUrl, obtaining a source-specific anonymous GHCR token, fetching that source’s nightly manifest, and returning { version: getNightlyVersion(manifest), source }.tag "nightly": HTTP 404 advances to the next source; other errors are rethrown; exhausting sources throws UpgradeError("network_error", "No CLI upgrade source was found: every source returned HTTP 404").fetchLatestNightlyVersion(signal?, source?) returning only .version, probing either the explicit source alone or all ordered UPGRADE_SOURCES.resolveLatestUpgradeVersion(channel, signal?) selecting fetchLatestNightlyVersionWithSource(signal) for channel "nightly" and fetchLatestFromGitHubWithSource(signal) otherwise.resolveExistingUpgradeVersion(version) probing ordered sources with getGitHubRepositoryUrl for nightly versions or getGitHubReleaseByTagUrl(version, source) for stable versions; a selected nightly source is additionally checked by nightlyVersionExists(version, selected.source), and all-source HTTP 404 exhaustion maps to null.nightlyVersionExists(version, source) becoming source-specific and treating only HTTP 404 as absence; the previous HTTP 403-means-absent handling was removed, so a 403 now propagates.standaloneVersionExists(version, source?): with an explicit source it checks only that source—GHCR for nightly or getGitHubReleaseByTagUrl() for stable—and without a source it delegates to resolveExistingUpgradeVersion() for ordered fallback.versionExists(method, version, source?) routing nightly versions and "curl"/"brew" methods through standaloneVersionExists(), while retaining npm-registry checking for other stable installation methods.packages/cli/src/lib/upgrade.ts: downloadNightlyToPath(), downloadStableToPath(), downloadBinaryToTemp(), tryDeltaUpgrade(), downloadFullBinary(), and executeUpgrade() accept source: UpgradeSource = PRIMARY_UPGRADE_SOURCE; stable URLs use getBinaryDownloadUrl(version, source), while nightly token, manifest, and blob requests all use the same source.packages/cli/src/lib/version-check.ts switching to fetchLatestFromGitHubWithSource() and fetchLatestNightlyVersionWithSource(), then passing the returned source into maybePrefetchPatches() and onward to prefetchStablePatches() or prefetchNightlyPatches(), preserving discovery-source affinity during background prefetch.packages/cli/test/lib/delta-upgrade.test.ts defining LEGACY_UPGRADE_SOURCE = UPGRADE_SOURCES[1] and failing immediately with Legacy upgrade source is not configured if absent.https://api.github.com/repos/getsentry/cli/releases?per_page=12, while legacy nightly requests use only https://ghcr.io/v2/getsentry/cli/tags/list?n=100 or token scope https://ghcr.io/token?scope=repository:getsentry/cli:pull, with no getsentry/toolkit access.importDeltaUpgradeWithVersion(version) using vi.resetModules() and vi.doMock("../../src/lib/constants.js", ...) to substitute CLI_VERSION, plus restoreDeltaUpgradeModule() to unmock and reset modules after source-affinity tests.https://api.github.com/repos/getsentry/toolkit/releases?per_page=100, Toolkit tags use cli@, unrelated tags such as mcp@9.0.0 are ignored, draft/prerelease entries are excluded, and the first matching CLI entry is selected from response order.mcp@9.0.0, cli@1.2.3, and cli@1.3.0; fetchLatestFromGitHub() is expected to return 1.2.3, demonstrating response-order selection rather than semantic maximum selection.https://api.github.com/repos/getsentry/toolkit/releases?per_page=100, then legacy uses https://api.github.com/repos/getsentry/cli/releases/latest; all sources returning 404 yields No CLI upgrade source was found: every source returned HTTP 404.https://api.github.com/repos/getsentry/toolkit/releases/tags/cli%401.0.0, falling back on Toolkit 404 to legacy tag https://api.github.com/repos/getsentry/cli/releases/tags/1.0.0, and never falling back when an explicit source is supplied.getBinaryDownloadUrl("1.0.0") now expected to begin with https://github.com/getsentry/toolkit/releases/download/ and contain /cli@1.0.0/ plus a sentry- platform binary name.https://ghcr.io/v2/getsentry/toolkit/manifests/nightly; a Toolkit manifest HTTP 404 permits fallback to the legacy getsentry/cli source, while HTTP 403 must abort without probing legacy.99.0.0 with UPGRADE_SOURCES[0]; Toolkit 404 followed by legacy discovery prefetches 99.0.0 with UPGRADE_SOURCES[1]; nightly Toolkit discovery prefetches 99.0.0-dev.200 with UPGRADE_SOURCES[0].https://api.github.com/repos/getsentry/toolkit, https://ghcr.io/token?scope=repository:getsentry/toolkit:pull, then https://ghcr.io/v2/getsentry/toolkit/manifests/nightly; tests throw on any unexpected getsentry/cli access.packages/cli/src/lib/binary.ts lines 274–347 defining GITHUB_RELEASES_URL = getGitHubReleasesUrl(), ResolvedUpgradeSource, ResolveUpgradeSourceOptions, fetchUpgradeProbe(), and resolveUpgradeSource().ResolveUpgradeSourceOptions containing getProbeUrl: (source: UpgradeSource) => string, optional fetch?: typeof fetch, optional shared signal?: AbortSignal, and optional ordered sources?: readonly UpgradeSource[].fetchUpgradeProbe() using options.fetch ?? customFetch, getGitHubHeaders(), and the shared abort signal; it rethrows AbortError, maps TLS certificate errors to UpgradeError("network_error", buildTlsErrorDetail(error)), and maps other connection failures to UpgradeError("network_error", \Failed to connect to GitHub: ${stringifyUnknown(error)}`)`.resolveUpgradeSource() returns the successful probe response so the caller “never repeats the request.”resolveUpgradeSource() probing options.sources ?? UPGRADE_SOURCES in order, returning { source, response } on the first response.ok, advancing only for HTTP 404, and immediately throwing UpgradeError("network_error", \Failed to fetch from GitHub: HTTP ${response.status}`)` for every other HTTP status.resolveUpgradeSource() throwing UpgradeError("network_error", "No CLI upgrade source was found: every source returned HTTP 404") after all configured sources return 404.