Dashboard › cli › Distillation
77abcdf6-d803-4737-abad-81e668dba08d["lore_tm_v1_V4GazPqmHAyM0OWVY0ui3Fd_6aNg6s-gd9g5FbZ1Mm0","lore_tm_v1_FwUVu929PSZhQcP6M4JcnLSjlouQ38cn__TdUKVTUnM","lore_tm_v1_KX1uZmuXMovh_DdzzxMUnH4nQwPk11vblzdGJMAxEjc","lore_tm_v1_-_TqfXZ1MhEmlGduGRgEwzoPS_MqubARtqfrGCbj1HA","lore_tm_v1_BglRwpuXEfO2TUSKWTGgATtB5v6DgMmBt4i1fGuY_Aw","lore_tm_v1_mK-xd0rHX8L_ImOdB6rzYnC9mgstsLmwlf8UtYS1LE0","lore_tm_v1_q4OkIQCVLxGW2yaEqMQQwPGIF5XbAmyWOhuU1Fw1X5I","lore_tm_v1_sEEiQ_Ho9UAqhCtjA5e-rFwlKvuoUGJo26Stzhp9uzM"]
/home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli/src/lib/binary.ts lines 90–279. InstallationMethod is "curl" | "brew" | "npm" | "pnpm" | "bun" | "yarn" | "unknown", while VALID_METHODS accepts only curl, brew, npm, pnpm, bun, and yarn.parseInstallationMethod(value) lowercasing input, returning it when included in VALID_METHODS, and otherwise throwing Invalid method: ${value}. Must be one of: ${VALID_METHODS.join(", ")}.UpgradeSource containing readonly githubRepo, ghcrRepo, and tagPrefix. UPGRADE_SOURCES is ordered: 1. { githubRepo: "getsentry/toolkit", ghcrRepo: "getsentry/toolkit", tagPrefix: "cli@" }; 2. { githubRepo: "getsentry/cli", ghcrRepo: "getsentry/cli", tagPrefix: "" }. Resolution falls through only on HTTP 404, and PRIMARY_UPGRADE_SOURCE = UPGRADE_SOURCES[0].isMusl() in packages/cli/src/lib/binary.ts. It returns false outside Linux and caches its Linux result in cachedIsMusl; heuristic 1 checks /lib/ld-musl-${muslArch}.so.1, where muslArch is "x86_64" for process.arch === "x64" and "aarch64" otherwise; heuristic 2 runs spawnSync("ldd", ["--version"], { stdio: ["ignore", "pipe", "pipe"] }), concatenates stdout and stderr, and checks case-insensitively for "musl". If ldd fails, it caches and returns false, assuming glibc.getPlatformBinaryName() producing sentry-<os>-<arch>[-musl][.exe]: OS is darwin, windows, or default linux; architecture is arm64 only when process.arch === "arm64", otherwise x64; -musl comes from isMusl(); .exe is added on win32.packages/cli/src/lib/binary.ts: getBinaryDownloadUrl(version, source) returns https://github.com/${source.githubRepo}/releases/download/${source.tagPrefix}${version}/${getPlatformBinaryName()}; getGitHubReleasesUrl(source) returns https://api.github.com/repos/${source.githubRepo}/releases; getGitHubReleaseByTagUrl(version, source) appends /tags/${encodeURIComponent(source.tagPrefix + version)}.getGitHubLatestReleaseUrl(source) using ${getGitHubReleasesUrl(source)}?per_page=100 for prefixed repositories and ${getGitHubReleasesUrl(source)}/latest when tagPrefix is empty. getGitHubRepositoryUrl(source) returns https://api.github.com/repos/${source.githubRepo}, and GITHUB_RELEASES_URL is the primary source’s releases URL./home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli/test/lib/close-dispatcher.test.ts, where GLOBAL_DISPATCHER = Symbol.for("undici.globalDispatcher.1"); tests cover destroying a registered global dispatcher, no registered dispatcher, a dispatcher lacking destroy, and another non-throwing resolution path./home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli/test/lib/bspatch.test.ts. It imports patch functionality from "binpatch", uses fixtures at join(import.meta.dirname, "../fixtures/patches"), builds synthetic TRDIFF10 diff-only patches, and covers header parsing, truncated-patch rejection, output-size/OOM protection, small and large fixture patching, temporary-file cleanup, empty-chain rejection, fd-backed versus in-memory equivalence, real-fixture single-element chains, and the SWAR Uint32Array diff-add hot path./home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli/test/lib/bspatch.property.test.ts, which imports offtin and parsePatchHeader from "binpatch" and property-tests invalid patch formats; generated patched headers set the TRDIFF10 magic and clear sign bits with patched[15] %= 128, patched[23] %= 128, and patched[31] %= 128.executeUpgrade("curl", "0.0.0-dev.1740000000") test in /home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli/test/lib/upgrade.test.ts: the mocked OCI manifest has schemaVersion: 2, annotation version: "0.0.0-dev.1740000000", and one application/octet-stream layer; /blobs/ returns gzipped bytes directly; the result must contain tempBinaryPath, and decompressed content must equal mockBinaryContent.downloadBinaryToTemp offline-error tests. Test setup records curl installation info with path: offlineInstallPath and version: "0.0.0". downloadBinaryToTemp("0.26.1", undefined, "explicit") must throw UpgradeError with reason === "offline_cache_miss", mention "in offline mode" and "without \--offline`", and not mention "cached patches"`.downloadBinaryToTemp("0.26.1", undefined, "network-fallback") must throw UpgradeError with reason === "offline_cache_miss", mention "network is unavailable" and "Check your internet connection", and not mention "cached patches".downloadBinaryToTemp polls up to 5 times with exponential backoff, approximately 3.1 seconds cumulative, to permit a Windows filesystem-visibility race to self-heal; exhaustion throws an actionable UpgradeError rather than later surfacing Bun’s "Executable not found in $PATH".gzipSync(new Uint8Array(0)) for .gz requests. downloadBinaryToTemp("0.26.1") must throw UpgradeError with reason === "execution_failed" and a message containing "missing or empty" and "sentry cli upgrade"; the test timeout is 10_000 ms.downloadBinaryToTemp("0.26.1") reject, acquireLock(getCurlInstallPaths().lockPath) must succeed, proving the failed download released its lock; the test then calls releaseLock(lockPath).tempPath up to 200 times with sleep(10), waits another 150 ms so the verification probe observes zero bytes at least once, then writes ELF bytes [0x7f, 0x45, 0x4c, 0x46]. downloadBinaryToTemp("0.26.1") must return tempBinaryPath === tempPath, preserve those bytes on disk, and expose a lockPath that the test releases.isEnoentSpawnError() tests covering Bun’s Executable not found in $PATH: "C:\\Users\\x\\.local\\bin\\sentry.exe.download" message and Node’s NodeJS.ErrnoException.code = "ENOENT" as true cases. It must return false for "EBUSY: file locked", "permission denied", a string error, and null./home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli/src/commands/cli/upgrade.ts, where sentry cli upgrade self-updates and then spawns the new binary with cli setup to update completions, agent skills, and installation metadata.main. The channel can be selected via --channel or the "nightly"/"stable" version argument and is persisted so later bare sentry cli upgrade calls reuse it.packages/cli/src/commands/cli/upgrade.ts importing UpgradeSource, determineInstallDir, isDowngrade, LEGACY_INSTALL_SUBDIR, releaseLock, and samePath from ../../lib/binary.js; release-channel persistence uses getReleaseChannel, setReleaseChannel, and ReleaseChannel from ../../lib/db/release-channel.js.