Dashboard › cli › Distillation
ae12fb1c-e52b-405e-8ee6-7046a14882b6["lore_tm_v1_eG_LPbscY73zBl8sRHAkQO_jrTNsPULxNyBkt_CQ0cU","lore_tm_v1_4xANSx32RZIApDZlKcYCvA5jof_QAJkLspi-UdlWBoA","lore_tm_v1_964rP4f1ycT6ULhbOAZR2VPS20Gan4O75cBT1DFgaDc","lore_tm_v1_lFCRDwZclrRHjOkcIoDtGh-xhM7uRwDLJEaOHR_VWjw","lore_tm_v1_XvECAl_C0CfwIO5g0u978kc-Q4RDjIqFXW4F0OoI9AI"]
feat/toolkit-bridge-upgrade was at commit dbee7e9f2 and tracked origin/feat/toolkit-bridge-upgrade; recent commits, newest first, were: dbee7e9f2 test(cli): update toolkit upgrade fixtures, 723375b6c fix(cli): address upgrade review findings, 9c874298e fix(cli): address toolkit bridge review, and 04867eaf9 feat(cli): add toolkit upgrade bridge.packages/cli/src/commands/cli/upgrade.ts, packages/cli/src/lib/binary.ts, packages/cli/src/lib/delta-upgrade.ts, packages/cli/src/lib/ghcr.ts, packages/cli/src/lib/release-notes.ts, packages/cli/src/lib/upgrade.ts, packages/cli/src/lib/version-check.ts, packages/cli/test/commands/cli.test.ts, packages/cli/test/commands/cli/upgrade.test.ts, packages/cli/test/lib/binary.test.ts, packages/cli/test/lib/delta-upgrade.mocked.test.ts, packages/cli/test/lib/delta-upgrade.test.ts, packages/cli/test/lib/ghcr.test.ts, packages/cli/test/lib/release-notes.test.ts, packages/cli/test/lib/upgrade.test.ts, and packages/cli/test/lib/version-check.test.ts.packages/cli/src/lib/binary.ts introduced UpgradeSource, containing readonly githubRepo, ghcrRepo, and tagPrefix fields for a repository pair that hosts stable GitHub CLI releases and nightly GHCR images.packages/cli/src/lib/binary.ts defines ordered UPGRADE_SOURCES: 1. { githubRepo: "getsentry/toolkit", ghcrRepo: "getsentry/toolkit", tagPrefix: "cli@" }; 2. { githubRepo: "getsentry/cli", ghcrRepo: "getsentry/cli", tagPrefix: "" }. PRIMARY_UPGRADE_SOURCE is UPGRADE_SOURCES[0].resolveUpgradeSource() returns the successful probe Response to the caller so it βnever repeats the request.βpackages/cli/src/lib/binary.ts added source-aware helpers: getBinaryDownloadUrl(version, source) builds https://github.com/${source.githubRepo}/releases/download/${source.tagPrefix}${version}/${getPlatformBinaryName()}; getGitHubReleasesUrl(source) builds the sourceβs GitHub releases API base; getGitHubReleaseByTagUrl(version, source) appends /tags/${encodeURIComponent(tag)}; getGitHubLatestReleaseUrl(source) uses ?per_page=100 for prefixed sources and /latest for unprefixed sources; getGitHubRepositoryUrl(source) builds the repository API URL.GITHUB_RELEASES_URL now derives from getGitHubReleasesUrl() and therefore points at the primary getsentry/toolkit source by default, replacing the former hard-coded https://api.github.com/repos/getsentry/cli/releases.packages/cli/src/lib/binary.ts added ResolvedUpgradeSource with readonly source: UpgradeSource and response: Response, plus ResolveUpgradeSourceOptions with getProbeUrl, optional fetch, optional signal, and optional ordered sources.fetchUpgradeProbe() uses options.fetch ?? customFetch, applies getGitHubHeaders(), propagates AbortError, converts TLS certificate failures to UpgradeError("network_error", buildTlsErrorDetail(error)), and converts other connection failures to UpgradeError("network_error", "Failed to connect to GitHub: ...").resolveUpgradeSource() returns the first successful source/response pair, skips to the next source only for status 404, maps other unsuccessful statuses to UpgradeError("network_error", "Failed to fetch from GitHub: HTTP ${response.status}"), and throws UpgradeSourceNotFoundError after all sources return 404.UpgradeSourceNotFoundError extends UpgradeError, has name "UpgradeSourceNotFoundError", code "network_error", and detail "No CLI upgrade source was found: every source returned HTTP 404".packages/cli/src/lib/binary.ts documents compareVersions(a, b) as using semver.compare, rather than Bun.semver.order, to correctly compare stable X.Y.Z and nightly X.Y.Z-dev.<unix-seconds> versions, including numeric SemVer prerelease identifiers.packages/cli/src/commands/cli/upgrade.ts expanded ResolveResult so both { kind: "target" } and { kind: "done" } may carry source?: UpgradeSource.resolvePinnedVersion(lookupMethod, target) in packages/cli/src/commands/cli/upgrade.ts retains versionExists() validation for non-curl methods; for "curl" it calls resolveExistingUpgradeVersion(target), throws UpgradeError("version_not_found", "Version ${target} not found") if unresolved, and otherwise returns the resolved UpgradeSource."nightly" or "stable", packages/cli/src/commands/cli/upgrade.ts now selects lookupMethod = channel === "nightly" ? "curl" : method and preserves the source returned by resolvePinnedVersion().executeUpgrade(method, target, downloadTag, offline, setMessage, source). It uses rolling tag NIGHTLY_TAG only for latest-nightly upgrades with no explicit version argument; a specific nightly version uses its own tag.persistChannel(channel, channelChanged, version) runs after target resolution because setReleaseChannel() clears the version-check cache on channel changes, and running it earlier would prevent resolveOfflineTarget() from reading the cached version; it persists when the channel changed or version is a channel selector.packages/cli/src/lib/delta-upgrade.ts made stable and nightly delta handling source-aware via UpgradeSource, PRIMARY_UPGRADE_SOURCE, and getGitHubReleasesUrl(source), replacing direct reliance on the former GITHUB_RELEASES_URL/GHCR_REPO constants.stableSource(source) in packages/cli/src/lib/delta-upgrade.ts wraps customFetch for prefixed-source release-list responses: it verifies an array, keeps valid non-draft/non-prerelease releases whose tag_name starts with source.tagPrefix, and strips that prefix before returning the transformed JSON to githubReleaseSource().fetchRecentReleases(signal?, source = getPrimaryUpgradeSource()) now requests ${getGitHubReleasesUrl(source)}?per_page=12, filters to valid non-draft/non-prerelease releases matching source.tagPrefix, strips the prefix from tag_name, and still returns [] for unsuccessful HTTP responses, non-array payloads, or caught errors.prefetchNightlyPatches(targetVersion, signal?, source = getPrimaryUpgradeSource()) now invokes prefetch(nightlySource(source), targetVersion, signal), ensuring nightly patch prefetch uses the selected upgrade source.packages/cli/src/lib/ghcr.ts changed the default GHCR_REPO from hard-coded "getsentry/cli" to PRIMARY_UPGRADE_SOURCE.ghcrRepo, which is currently "getsentry/toolkit".packages/cli/src/lib/ghcr.ts added GhcrManifestHttpError, extending UpgradeError, with readonly numeric status, name "GhcrManifestHttpError", code "network_error", and message Failed to fetch manifest for tag "${tag}": HTTP ${status}.getAnonymousToken() now accepts either an UpgradeSource plus optional AbortSignal, or an AbortSignal alone for backward compatibility; it requests ${GHCR_REGISTRY}/token?scope=repository:${source.ghcrRepo}:pull and defaults to PRIMARY_UPGRADE_SOURCE.listTags(token, prefix?, signal?, source = PRIMARY_UPGRADE_SOURCE) in packages/cli/src/lib/ghcr.ts is now source-aware while retaining optional prefix filtering and paginated OCI tag listing.