Dashboard › cli › Distillation
cc643ba3-ef06-4062-8205-4c55f1350c81["lore_tm_v1_5lYZCwFM1MP3s_hv7zv-R9eHNUgplDxUtKtyjECsviQ","lore_tm_v1_7YpFC5Y6PYL36H_vkztAPxmY8vGCcLESRBJJ2t4B2R8","lore_tm_v1_anEfUnTSMrHwIFVO3gl4DQ9Jp7Rt8nQjgIfQ89rWHEo"]
packages/cli/src/commands/cli/upgrade.ts threading optional source?: UpgradeSource through target resolution and upgrade execution, including resolveExistingUpgradeVersion(), resolveLatestUpgradeVersion(), executeUpgrade(), and returned target/done result types.packages/cli/src/commands/cli/setup.ts stating that current targets must never be treated as migration sources.packages/cli/src/lib/binary.ts line 263 constructing the Toolkit-style releases query as `${getGitHubReleasesUrl(source)}?per_page=100`.packages/cli/src/lib/ghcr.ts using TAGS_PAGE_SIZE = 100, building source-specific tag-list URLs as `${GHCR_REGISTRY}/v2/${source.ghcrRepo}/tags/list?n=${TAGS_PAGE_SIZE}`, and continuing pagination while a page contains exactly 100 tags.packages/cli/src/lib/release-notes.ts line 692 constructing source-specific commit-history URLs as https://api.github.com/repos/${source.githubRepo}/commits?sha=main&since=${sinceDate}&until=${untilDate}&per_page=100.packages/cli/src/commands/cli/upgrade.ts defining CHANNEL_VERSIONS = new Set(["nightly", "stable"]); resolveChannelAndVersion() treats those positional values case-insensitively as channel selectors with versionArg: undefined, otherwise uses getReleaseChannel() and preserves the positional version.resolveOfflineTarget(versionArg) stripping VERSION_PREFIX_REGEX from an explicit version; without one it reads getVersionCheckInfo().latestVersion and throws UpgradeError("network_error", "No cached version available. Run any command to trigger a background version check, then retry.") if the cache is empty.resolveTargetWithFallback() rejecting an offline channel switch without an explicit version because the cached version belongs to the previous channel, with UpgradeError("unsupported_operation", "Cannot switch channels in offline mode — the cached version belongs to the current channel. Run 'sentry cli upgrade' with network access to switch channels.").persistChannelFn() because setReleaseChannel clears the version cache on channel changes; it returns { kind: "target", target, offline: "explicit" }.resolveTargetVersion(), and propagating the resolved source in { kind: "target", target, offline: false, source }.UpgradeError instances with reason === "network_error"; a successful fallback returns { kind: "target", target, offline: "network-fallback" }, while absence of a cached version causes the original network error to be rethrown.validateMethod() permits offline upgrades only when method === "curl" and otherwise throws UpgradeError("unsupported_operation", "Offline upgrade is only supported for curl-installed binaries.").validateMethod() rejecting method === "unknown" with UpgradeError("unknown_method").validateMethod() rejecting a pinned stable version for Homebrew with UpgradeError("unsupported_operation", "Homebrew does not support installing a specific version. Run 'brew upgrade getsentry/tools/sentry' to upgrade to the latest formula version.").resolvePinnedVersion(lookupMethod, target) using versionExists(lookupMethod, target) for non-curl methods and returning no source; for curl it uses resolveExistingUpgradeVersion(target), returns resolved.source, and maps a missing version to UpgradeError("version_not_found", \Version ${target} not found`)`.resolveTargetVersion() classifying an upgrade as standalone when channel === "nightly", method === "curl", or method === "brew"; standalone resolution calls resolveLatestUpgradeVersion(channel), while other methods call fetchLatestVersion(method, channel).resolveTargetVersion() stripping VERSION_PREFIX_REGEX from a pinned positional version, otherwise using the latest discovered version, and initially retaining latestResolution?.source.buildCheckResult({ target, versionArg, method, channel, flags }) together with source: latestResolution?.source.CLI_VERSION === target, flags.force is false, and the channel did not change, resolution returns an "up-to-date" UpgradeResult with forced: false.resolveTargetVersion() sets lookupMethod = channel === "nightly" ? "curl" : method, calls resolvePinnedVersion(), and preserves the returned source for subsequent installation.