Dashboard › cli › Distillation
9cd9a0fa-93a3-4259-9f05-0859fd7760c9["lore_tm_v1_FhdvZClpzzhhmmK2dRI5Pwd48wKbYU7q5U63zq345_4","lore_tm_v1_yA7ILa4Ine85tXGCv6cwrq8wRV2j-QhF-ShfIkaZpG8","lore_tm_v1_PQvOuIPuekA1twWqAyBlrRZtwHNHtIQ-x7dAZXy7KQg"]
🔴 (20:34) User provided packages/cli/src/lib/binary.ts lines 1-350. The module is shared by setup --install and upgrade for installing, replacing, and managing the CLI binary.
🔴 (20:34) User provided packages/cli/src/lib/binary.ts installation metadata: KNOWN_CURL_DIRS = [".local/bin", "bin", ".sentry/bin"]; InstallationMethod supports "curl" | "brew" | "npm" | "pnpm" | "bun" | "yarn" | "unknown"; VALID_METHODS allows all except "unknown" for --method; parseInstallationMethod(value) lowercases input and throws Invalid method: ${value}. Must be one of: ${VALID_METHODS.join(", ")} when invalid.
🔴 (20:34) User provided isMusl() in packages/cli/src/lib/binary.ts: it returns false outside Linux, caches its result in cachedIsMusl, first checks /lib/ld-musl-${muslArch}.so.1 with muslArch mapped to "x86_64" for process.arch === "x64" and "aarch64" otherwise, then runs spawnSync("ldd", ["--version"]) and searches combined stdout/stderr case-insensitively for "musl"; if ldd fails, it assumes glibc.
🔴 (20:34) User provided getPlatformBinaryName() in packages/cli/src/lib/binary.ts: platform names are "darwin", "windows", or fallback "linux"; architecture is "arm64" only when process.arch === "arm64" and otherwise "x64"; musl adds "-musl" and Windows adds ".exe"; resulting format is sentry-${os}-${arch}${libcSuffix}${suffix}.
🔴 (20:34) User provided release helpers in packages/cli/src/lib/binary.ts: getBinaryDownloadUrl(version) returns https://github.com/getsentry/cli/releases/download/${version}/${getPlatformBinaryName()}; GITHUB_RELEASES_URL is https://api.github.com/repos/getsentry/cli/releases; getGitHubHeaders() returns Accept: "application/vnd.github.v3+json" and "User-Agent": getUserAgent().
🔴 (20:34) User provided version helpers in packages/cli/src/lib/binary.ts: isNightlyVersion(version) identifies nightlies via version.includes("-dev."); compareVersions(a, b) returns semverCompare(a, b) from the semver package; isDowngrade(current, target) checks whether compareVersions(current, target) === 1.
🔴 (20:34) User provided a stale JSDoc reference in packages/cli/src/lib/binary.ts lines 175-177: compareVersions() is documented as using Bun.semver.order, although the implementation imports and calls compare as semverCompare from "semver".
🔴 (20:34) User provided getBinaryFilename() in packages/cli/src/lib/binary.ts: it returns "sentry.exe" on win32 and "sentry" elsewhere.
🔴 (20:34) User provided getBinaryPaths(installPath) in packages/cli/src/lib/binary.ts: it returns installPath, tempPath: \${installPath}.download`, oldPath: `${installPath}.old`, and lockPath: `${installPath}.lock`. 🔴 (20:34) User provided determineInstallDir(homeDir, env)priority inpackages/cli/src/lib/binary.ts: 1. env.SENTRY_INSTALL_DIR; 2. ~/.local/binif it exists and is present inPATH; 3. ~/binif it exists and is present inPATH; 4. fallback ~/.sentry/bin, with setup expected to handle PATH modification. 🔴 (20:34) User provided fetchWithUpgradeError(url, init, serviceName)inpackages/cli/src/lib/binary.ts: it calls customFetch; rethrows an AbortErrorunchanged; maps TLS certificate errors tonew UpgradeError("network_error", buildTlsErrorDetail(error)); and maps other failures to new UpgradeError("network_error", `Failed to connect to ${serviceName}: ${stringifyUnknown(error)}`). 🔴 (20:34) User provided replaceBinarySync(tempPath, installPath)inpackages/cli/src/lib/binary.ts: it is intentionally synchronous so the replacement sequence cannot be interrupted; Unix performs atomic renameSync(tempPath, installPath); Windows first attempts renameSync(installPath, `${installPath}.old`), retries after unlinkSync(oldPath)if necessary, tolerates a missing current binary, then renames the temporary binary into place. 🔴 (20:34) User provided cleanup design comments inpackages/cli/src/lib/binary.ts: .oldfiles left by Windows upgrades are removed on subsequent CLI startup viacleanupOldBinary(); .downloadfiles are deliberately not cleaned on startup because another process may be upgrading, and their cleanup occurs inside the upgrade flow under an exclusive lock. 🔴 (20:34) User provided search evidence thatpackages/cli/src/lib/version-check.tsdocuments nightly detection usingCLI_VERSIONcontaining"-dev.<timestamp>", checks GHCR for nightly builds and GitHub Releases for stable builds, and caches results in the database for display. 🔴 (20:34) User provided search evidence for packages/cli/src/lib/upgrade.ts: nightly versions use GHCR manifests and versioned tags such as nightly-0.14.0-dev.1772661724; stable versions use GitHub Releases for curl/brew or npm for package-manager installs; nightly artifacts are named sentry-<os>-<arch>.gzwith platform variants; anddownloadNightlyToPathuses the OCI blob protocol while stable downloads use GitHub Releases. 🔴 (20:34) User provided search evidence thatpackages/cli/src/lib/delta-upgrade.tsimports and invokesgithubReleaseSource, with matches at lines 18 and 123. 🔴 (20:34) User provided a repository search returning 100 matches with additional matches truncated; among the surfaced files were packages/cli/src/lib/version-check.ts, upgrade.ts, binary.ts, delta-upgrade.ts, custom-ca.ts, DSN modules under packages/cli/src/lib/dsn/, build/vcs.ts, bash-hook/traceback.ts, jvm-bundle.ts, and dif/scan.ts`.