Dashboard › cli › Distillation
55ca107f-599a-4ccf-8d84-e3ebe95a6a75["lore_tm_v1_4nLAIpi4OWe1KKOqPGK1z8JpRqSwBlwwvLeBxTqC0hY","lore_tm_v1_bBIrl4n6gNx3YnOcDOJeZe5Gc00mrN7c3ZcQ_iawi5I","lore_tm_v1_BpApQBfA6NdLJaVvCbNwXu0DvU1lPPo1ATOhjS2undo","lore_tm_v1__gV4HnZk-5BgfnDta4nCeqO0ndU0hKTEZEhFv0p3mbU","lore_tm_v1_S3IYI0MUe5kXYkl17Vde20gcCLYFakJWwXPIn8KUD8Y","lore_tm_v1_pSU3FRjmokd6TyzFhB7DwfCAczsh3Q5QqZy5fs1aejw","lore_tm_v1_dItIE_2fCDpf6BHT9_695EMmRy6htDDklCFBPV-lNgM","lore_tm_v1_IuQE0vTr_Icd0nl5OSU4GXDg3dImCwkK6SRD3so28cM"]
packages/cli/package.json defines package sentry at version 0.40.0-dev.0, description Sentry CLI - A command-line interface for using Sentry built by robots and humans for robots and humans, repository git+https://github.com/getsentry/cli.git, license FSL-1.1-Apache-2.0, module type module, Node engine >=18.0, development runtime Node >=22.15, and package manager pnpm@10.11.0.packages/cli/package.json publishes ./dist/index.cjs as main, ./dist/index.d.cts as types, dual import exports ./dist/index.mjs/./dist/index.d.mts, dual require exports ./dist/index.cjs/./dist/index.d.cts, and executable sentry at ./dist/bin.cjs.packages/cli/package.json are: dist/bin.cjs, dist/index.cjs, dist/index.mjs, dist/index.d.cts, dist/index.d.mts, dist/ink-app.js, dist/node-sqlite3-wasm.wasm, dist/vendor/symbolic_bg.wasm, LICENSE.md, and README.md.packages/cli/package.json scripts are: cli → tsx --env-file-if-exists=.env.local --import ./script/require-shim.mjs src/bin.ts; dev → generate schema/docs/SDK then run src/bin.ts; build → generate schema/docs/SDK then pnpm tsx script/build.ts --single; build:all uses script/build.ts; bundle uses script/bundle.ts; typecheck runs generated docs/SDK then tsc --noEmit; lint and lint:fix use Biome; test delegates to test:unit; test:unit runs vitest run test/lib test/commands test/types test/script --coverage; test:changed uses vitest run --changed; test:e2e runs vitest run test/e2e; test:init-eval uses --testTimeout 600000.packages/cli/package.json include generate:parser, generate:sdk, generate:skill, generate:banner, generate:docs, generate:docs-sections, generate:schema, generate:command-docs, eval:skill, bench, bench:save, bench:compare, bench:sweep, check:fragments, check:deps, check:errors, check:patches, check:docs-sections, and check:stale-refs, each invoking the correspondingly named file under script/.packages/cli/package.json include semver ^7.8.5, typescript ^5.9.3, tsx ^4.22.4, vitest ^4.1.9, @vitest/coverage-v8 ^4.1.9, esbuild ^0.28.1, @biomejs/biome 2.3.8, ultracite 6.3.10, node-sqlite3-wasm 0.8.59, @sentry/core 10.63.0, @sentry/node-core 10.63.0, @sentry/symbolic 13.7.0, @sentry/api ^0.253.0, and @sentry/sqlish ^1.0.1.packages/cli/src/lib/binary.ts is a 529-line shared binary-management module used by both setup --install and upgrade; it imports compare as semverCompare from semver, filesystem sync/async APIs, customFetch, TLS helpers, UpgradeError, logger, and isProcessRunning.packages/cli/src/lib/binary.ts exports KNOWN_CURL_DIRS = [".local/bin", "bin", ".sentry/bin"] and InstallationMethod = "curl" | "brew" | "npm" | "pnpm" | "bun" | "yarn" | "unknown"; parseInstallationMethod() lowercases input, accepts all listed methods except "unknown", and otherwise throws Invalid method: ${value}. Must be one of: curl, brew, npm, pnpm, bun, yarn.isMusl() in packages/cli/src/lib/binary.ts caches its result in cachedIsMusl; it returns false off Linux, checks /lib/ld-musl-${muslArch}.so.1 first with x64 → x86_64 and all other architectures → aarch64, then runs ldd --version, combines stdout and stderr, and searches case-insensitively for musl; a missing/failed ldd defaults to glibc (false).getPlatformBinaryName() in packages/cli/src/lib/binary.ts generates sentry-<os>-<arch>[-musl][.exe]: darwin → darwin, win32 → windows, every other platform → linux; arm64 → arm64, every other architecture → x64; -musl comes from isMusl() and .exe is added on Windows.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().isNightlyVersion(version) identifies nightlies by version.includes("-dev."); documented nightly form is X.Y.Z-dev.<unix-seconds>.compareVersions(a, b) returns semverCompare(a, b) as -1 | 0 | 1, despite its comment saying it uses Bun.semver.order; isDowngrade(current, target) returns whether compareVersions(current, target) === 1.getBinaryFilename() returns sentry.exe on win32 and sentry elsewhere; getBinaryPaths(installPath) returns exact sibling paths installPath, ${installPath}.download, ${installPath}.old, and ${installPath}.lock.determineInstallDir(homeDir, env) prioritizes: 1. env.SENTRY_INSTALL_DIR; 2. existing ~/.local/bin if exactly present in PATH; 3. existing ~/bin if exactly present in PATH; 4. fallback ~/.sentry/bin. The implementation does not perform the writability check claimed by its comment.fetchWithUpgradeError(url, init, serviceName) calls customFetch; it rethrows AbortError unchanged, converts TLS certificate failures into new UpgradeError("network_error", buildTlsErrorDetail(error)), and wraps all other thrown values as UpgradeError("network_error", "Failed to connect to ${serviceName}: ${stringifyUnknown(error)}").replaceBinarySync(tempPath, installPath) is intentionally synchronous so replacement cannot be interrupted between renames: Unix atomically renames over the target; Windows renames the running executable to ${installPath}.old before moving the temporary file into place because Windows permits renaming, but not deleting or overwriting, a running executable; cleanupOldBinary() removes .old on a later startup.packages/cli/src/lib/delta-upgrade.ts imports ghcrSource, githubReleaseSource, and SourceStrategy, returning githubReleaseSource(...) near line 123 and ghcrSource(...) near line 133.MapSource, FilePair, SourceMappingDirective, and SourcemapResolution in packages/cli/src/lib/sourcemap/inject.ts; SourceMapReport in packages/cli/src/lib/react-native/wrap-call.ts; AttributeSource = Record<string, unknown> in packages/cli/src/lib/formatters/semantic-display.ts; DsnSource = "env" | "env_file" | "config" | "code" | "inferred" in packages/cli/src/lib/dsn/types.ts; AuthSource = "env:SENTRY_AUTH_TOKEN" | "env:SENTRY_TOKEN" | "oauth" in packages/cli/src/lib/db/auth.ts; and CaSource = "default" | "env" | "none" in packages/cli/src/lib/custom-ca.ts.packages/cli/test/commands/cli/upgrade.test.ts, packages/cli/test/commands/cli/uninstall.test.ts, packages/cli/test/lib/version-check.test.ts, packages/cli/test/lib/upgrade.test.ts, packages/cli/test/lib/scan/binary.test.ts, packages/cli/test/lib/scan/binary.property.test.ts, packages/cli/test/lib/release-notes.test.ts, packages/cli/test/lib/release-notes.property.test.ts, packages/cli/test/lib/install-script.test.ts, packages/cli/test/lib/ghcr.test.ts, packages/cli/test/lib/delta-upgrade.test.ts, packages/cli/test/lib/delta-upgrade.mocked.test.ts, packages/cli/test/lib/db/install-info.test.ts, packages/cli/test/lib/binary.test.ts, packages/cli/test/lib/binary.mocked.test.ts, and packages/cli/test/e2e/delta-upgrade.test.ts.packages/cli/test/lib/binary.test.ts is a 678-line Vitest suite covering download URLs, binary filenames and derived paths, install-directory selection, network error wrapping, synchronous binary replacement, installation, locking, SemVer comparison, downgrade detection, musl detection, and platform-specific binary names.getBinaryDownloadUrl() tests use versions 1.0.0 and 2.0.0, require the GitHub Releases prefix, a sentry- platform name, architecture arm64 or x64, and .exe only on Windows; getBinaryPaths("/usr/local/bin/sentry") must yield /usr/local/bin/sentry, /usr/local/bin/sentry.download, /usr/local/bin/sentry.old, and /usr/local/bin/sentry.lock.determineInstallDir() tests verify exact priority and edge cases: SENTRY_INSTALL_DIR overrides all candidates; existing and PATH-listed ~/.local/bin beats ~/bin; PATH-listed ~/bin is used when ~/.local/bin is unavailable; an existing ~/.local/bin not in PATH is skipped; empty or undefined PATH falls back to ~/.sentry/bin.fetchWithUpgradeError() tests verify a successful HTTP 200 response is returned, an AbortError is rethrown without becoming UpgradeError, Error("ECONNREFUSED") becomes an UpgradeError mentioning both GitHub and ECONNREFUSED, and a non-Error object { code: "ECONNRESET", reason: "connection reset" } becomes an UpgradeError mentioning ECONNRESET.replaceBinarySync() tests on non-Windows verify atomic replacement changes content from old binary to new binary, removes the renamed .download file, and supports a fresh install where no previous binary exists.installBinary() tests verify copying ELF bytes [0x7f, 0x45, 0x4c, 0x46], recursive creation of a deep/nested install directory, removal of .lock and .download after installation, overwriting old content with new content, and preservation of executable source mode 0o755.installBinary() has regression tests for sourcePath === tempPath during the upgrade-spawn flow and for logically identical paths reached through a symlinked install directory; the latter reproduces macOS /tmp → /private/tmp, where naive resolve() string comparison could unlink the source before copying. The test canonicalizes with realpathSync(realDir) and expects installed content upgraded binary.acquireLock() tests verify lock creation with String(process.pid), automatic recursive creation of a missing parent install directory, rejection of a lock held by running PID 1 with Another upgrade is already in progress, takeover of stale PID 999999999, and child-process takeover when the lock contains process.ppid.acquireLock() regression coverage for CLI-1E1 / CLI-1RV requires a missing install directory such as ~/.sentry/bin or a purged stale SENTRY_INSTALL_DIR to be created rather than failing with ENOENT during writeFileSync.mkdirSync to remain outside the writeFileSync try/catch: when the parent path is a regular file, acquireLock() must propagate EEXIST directly instead of routing it through existing-lock handling and producing misleading ENOTDIR.compareVersions() tests assert: 0.15.0 > 0.14.0; 0.14.0 < 0.15.0; equal stable versions compare 0; nightly timestamp 1772732047 > 1772724107; equal nightlies compare 0; and stable 0.14.0 is greater than prerelease 0.14.0-dev.1772732047.isDowngrade() tests assert that moving 0.15.0 → 0.14.0 is a downgrade, 0.14.0 → 0.15.0 is not, equal versions are not, nightly timestamp 1772732047 → 1772724107 is a downgrade, and 1772724107 → 1772732047 is not.isMusl() tests require false on non-Linux, a boolean on Linux, and a stable cached result across repeated calls; getPlatformBinaryName() tests require prefix sentry-, architecture arm64 or x64, OS darwin/windows/linux, .exe on Windows, no -musl on glibc Ubuntu CI, and -musl on musl systems.