Dashboard › cli › Distillation
9f867010-4468-4876-b7f7-0d8b4dc70054["lore_tm_v1_FCP0xWyeg7jLQ6_T_F0F_idoj--mT3Ws3LmmH6lifTY","lore_tm_v1_kE1yfKs75eDE7Peey6q2Rsrd-o7_dVGHKnRYNfv6bsE","lore_tm_v1_WZ_mTRSpe0StKhG8qCTJmiwfnqb-Nzg_8JJ85TTiHnE","lore_tm_v1_tvSEWxjGGNLZxfh6tLl9CdfJkgM0Gzsb8Ekvr2kKXis","lore_tm_v1_SoS5sl6thdSqXfCxx3EPkIpoILNeadxJtiA1vDny84c","lore_tm_v1_KSzYgsgNd_YeJLTTzvJzBLyOZucfev_UvOGiIGotbCM"]
packages/cli/src/lib/binary.ts lines 1–240 of 529; the module provides shared binary installation, replacement, and management utilities for both setup --install and upgrade.packages/cli/src/lib/binary.ts defines InstallationMethod as "curl" | "brew" | "npm" | "pnpm" | "bun" | "yarn" | "unknown"; VALID_METHODS accepts the first 6 values in that order, excluding "unknown", and parseInstallationMethod(value) lowercases input and throws Invalid method: ${value}. Must be one of: ${VALID_METHODS.join(", ")} for invalid values.isMusl() in packages/cli/src/lib/binary.ts caches its result and detects musl on Linux using 2 ordered heuristics: 1. check /lib/ld-musl-${muslArch}.so.1, mapping x64 to x86_64 and all other architectures to aarch64; 2. run ldd --version, concatenate stdout and stderr, and case-insensitively search for "musl". Non-Linux returns false; failure to run ldd assumes glibc and caches false.getPlatformBinaryName() produces sentry-<os>-<arch>[-musl][.exe]: Darwin maps to darwin, Windows to windows, other platforms to linux; arm64 remains arm64, other architectures map to x64; musl adds -musl, and Windows adds .exe.getBinaryDownloadUrl(version) currently returns https://github.com/getsentry/cli/releases/download/${version}/${getPlatformBinaryName()}, and GITHUB_RELEASES_URL is currently https://api.github.com/repos/getsentry/cli/releases.isNightlyVersion(version) identifies nightlies by checking version.includes("-dev.").compareVersions(a, b) now calls compare imported as semverCompare from semver, returning -1 | 0 | 1; its JSDoc is stale and still claims it uses Bun.semver.order.isDowngrade(current, target) returns whether compareVersions(current, target) === 1; getBinaryFilename() returns "sentry.exe" on Windows and "sentry" elsewhere.getBinaryPaths(installPath) returns exact sibling paths: installPath, tempPath: \${installPath}.download`, oldPath: `${installPath}.old`, and lockPath: `${installPath}.lock``.packages/cli/src/lib/binary.ts is: 1. writable $SENTRY_INSTALL_DIR; 2. existing ~/.local/bin present in $PATH; 3. existing ~/bin present in $PATH; 4. fallback ~/.sentry/bin, with setup responsible for PATH modification.GHCR_BLOB_TIMEOUT = 30_000, documents observed identical-request cold-start latency spikes from 126 ms to 30 s, uses retry logic in fetchWithRetry(), and targets GHCR_REGISTRY = "https://ghcr.io".package.json for the latest scripts; commands run from packages/cli, or from the repository root via pnpm --filter sentry run <script>.devDependencies, never dependencies, because everything is bundled at build time through esbuild; CI enforces this with pnpm run check:deps.pnpm add -D <package>, including the -D flag.@sentry/api when available instead of creating redundant Zod schemas in src/types/sentry.ts.packages/cli, while its documentation site lives in apps/cli-docs.node:* standard-library APIs because the project migrated from Bun to Node; agents must not reintroduce Bun.* globals, bun:test, or bun CLI commands.packages/cli/AGENTS.md are: file reads/writes via node:fs/promises; existence checks via existsSync from node:fs; processes via spawn()/execFile() or execSync() from node:child_process; executable lookup via the helper in src/lib/which.ts; globs via src/lib/scan/; sleep via setTimeout from node:timers/promises; JSON parsing via JSON.parse(await readFile(path, "utf-8")); permissioned recursive directory creation via mkdirSync(dir, { recursive: true, mode: 0o700 }).execFileSync with an argument array over string-based execSync to prevent shell injection.packages/cli/AGENTS.md are: pnpm install, pnpm run dev, pnpm run cli -- <args>, pnpm run build, pnpm run build:all, pnpm run typecheck, pnpm run lint, pnpm run lint:fix, pnpm run test:unit, pnpm run test:e2e, pnpm exec vitest run test/lib/foo.test.ts, and pnpm exec vitest.project-structure block of apps/cli-docs/src/content/docs/contributing.md, produced by script/generate-docs-sections.ts; the current command list can also be checked with ls src/commands/ or sentry --help.buildCommand from ../../lib/command.js, never directly from @stricli/core, because the wrapper adds telemetry, injects --json/--fields, and handles output rendering.async *func() generators, yield new CommandOutput(data), and may return { hint }; output.human receives the same data serialized to JSON, commands must not define their own json flag, and commands must not branch on flags.json or call stdout.write().src/lib/formatters/<domain>.ts, and files exceeding approximately 400 lines should extract formatting helpers into a formatter module.stderr.write() is banned in command files by a GritQL rule; diagnostics must use logger, while data output must use CommandOutput.buildRouteMap from ../../lib/route-map.js, never directly from @stricli/core; its standard aliases are list → ls, view → show, delete → remove, rm, and create → new. Manually supplied aliases override/merge with generated aliases, but standard aliases must not be manually duplicated.[<org>/<project>/]<id> must use parseSlashSeparatedArg from src/lib/arg-parsing.ts; required identifiers such as trace IDs and span IDs must be positional arguments rather than flags.getsentry/cli release/download and upgrade-related references across tests and source files.packages/cli/test/e2e/delta-upgrade.test.ts:64, packages/cli/test/lib/binary.test.ts:37–53, packages/cli/test/lib/upgrade.test.ts, packages/cli/src/lib/version-check.ts, packages/cli/src/lib/upgrade.ts, and packages/cli/src/lib/release-notes.ts.packages/cli/src/lib/upgrade.ts references GITHUB_RELEASES_URL, getBinaryDownloadUrl, fetchLatestFromGitHub, fetchLatestNightlyVersion, attemptDeltaUpgrade, downloadNightlyToPath, and downloadStableToPath; stable downloads use getBinaryDownloadUrl(version), while nightly downloads use the GHCR path.packages/cli/src/lib/version-check.ts imports fetchLatestFromGitHub and fetchLatestNightlyVersion from ./upgrade.js and calls prefetchStablePatches or prefetchNightlyPatches according to release channel.packages/cli/src/lib/release-notes.ts:662 currently builds commit-history requests from https://api.github.com/repos/getsentry/cli/commits?sha=main&since=${sinceDate}&until=${untilDate}&per_page=100.