Dashboard › cli › Distillation
580e5068-2fd8-486e-b436-d85aa6925aa9["lore_tm_v1_i0iTM3ukmHTWejP91-W-72ghF_SvA12_omSarkA5v-k","lore_tm_v1_DGkb71lkwfACINWSYz5cD15cIrVLoxlnh1T6hlvh6so"]
packages/cli/src/lib/upgrade.ts now imports valid as semverValid from semver, plus compareVersions and source-aware upgrade helpers/types including UpgradeSourceNotFoundError.packages/cli/src/lib/upgrade.ts is: 1. Homebrew via cheap authoritative realpath check, 2. stored install info in DB as the fast path, 3. legacy detection via curl paths, subprocess calls, then node_modules path, 4. auto-save the detected method for future runs.detectInstallationMethod() must always check for Homebrew first because stored install information may be stale, such as when a user switches from a previously recorded curl installation to Homebrew.fetchLatestFromGitHub(signal?, source?) in packages/cli/src/lib/upgrade.ts now delegates to fetchLatestFromGitHubWithSource(signal, source ? [source] : UPGRADE_SOURCES) and returns only the discovered .version; a supplied source restricts discovery to that source, while omission uses the ordered UPGRADE_SOURCES.packages/cli/src/lib/upgrade.ts uses the source-specific URL getGitHubReleaseByTagUrl(version, source).packages/cli/src/lib/upgrade.ts now calls fetchManifest(token, \nightly-${version}`, undefined, source)`, preserving the selected upgrade source.packages/cli/src/lib/upgrade.ts uses VERIFY_MAX_ATTEMPTS = 6; six probes with five intervening sleeps provide an approximately 3.1-second total wall-clock budget.waitForBinaryVisible throws UpgradeError when the downloaded file never becomes visible or remains empty.packages/cli/src/lib/version-check.ts now imports UpgradeSource from ./binary.js and replaces fetchLatestFromGitHub / fetchLatestNightlyVersion with fetchLatestFromGitHubWithSource / fetchLatestNightlyVersionWithSource.cliGroupIndex(args) in packages/cli/src/lib/version-check.ts locates the cli command group while skipping leading global flags and values belonging to value-taking global flags; -- ends the search, and the first non-flag token returns its index only if it is exactly cli, otherwise undefined.maybePrefetchPatches(channel, latestVersion, signal, source) now requires an UpgradeSource; when latestVersion is newer than CLI_VERSION, it passes that source to prefetchNightlyPatches(latestVersion, signal, source) or prefetchStablePatches(latestVersion, signal, source).logger.debug("Delta patch pre-fetch failed (best-effort)", error), allowing the version check to succeed, followed by opportunistic stale patch-cache cleanup.checkForUpdateInBackgroundImpl() is non-blocking and never throws; errors, including DB access failures, are caught and reported to Sentry rather than crashing the CLI."version-check" with operation "version.check" and forceTransaction: true.{ version: latestVersion, source }: nightly checks call fetchLatestNightlyVersionWithSource(signal), stable checks call fetchLatestFromGitHubWithSource(signal), and the selected source is forwarded to maybePrefetchPatches(channel, latestVersion, signal, source) so offline delta patches come from the same source.getUpdateNotificationWithCopy() never throws; errors are caught and reported to Sentry, and it returns null when stderr is not a TTY, no cached version exists, the CLI is up to date, notification is daily-rate-limited, or an error occurs.getUpdateNotificationWithCopy() returns a non-null update message, it persists last_notified = now through markUpdateNotified, preventing another notification within the rate-limit window.\n${muted(label)} ${cyan(CLI_VERSION)} -> ${cyan(latestVersion)} Run ${cyan('"sentry cli upgrade"')} to update.\n.