Dashboard › cli › Distillation
08a7e6e7-22ef-4d6c-b1e4-2e922378e57d["lore_tm_v1_1norMsh5f-yYbNYezoFd7eqhfEtMYB7gAozJhh2MSu0"]
/home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli/install, a 488-line Bash installer using set -euo pipefail.packages/cli/install, Sentry installer error telemetry uses the envelope API with SENTRY_INGEST="https://o1.ingest.us.sentry.io" and SENTRY_PROJECT_ID="4510776311808000"; it is described as using the CLIβs public write-only DSN, collecting no PII, and honors opt-out SENTRY_CLI_NO_TELEMETRY=1. The DSN key value is omitted as credential-like material.report_error() runs telemetry in a background subshell so it βnever blocks installation or propagates failures.βreport_error() enforces this with set +e, a background subshell, silent curl output, and curl -sf --max-time 2.packages/cli/install, gen_uuid() tries /proc/sys/kernel/random/uuid, then lowercase output from uuidgen, then an awk fallback generating 32 hexadecimal characters.packages/cli/install, report_error(message, step-name) strips hyphens from the generated event ID, obtains a UTC %Y-%m-%dT%H:%M:%SZ timestamp, JSON-escapes backslashes, double quotes, and newlines through _esc(), and sends an application/x-sentry-envelope event.packages/cli/install, installer telemetry tags include os, arch, libc, channel, step, and install.version; the event uses platform="other", level="error", logger="install", server_name="install-script", and Bash runtime context with ${BASH_VERSION:-unknown}.packages/cli/install, die(message, step-name) prints the message in red to stderr, calls report_error(), and exits with status 1; an ERR trap converts unexpected set -e/pipefail failures into die "Unexpected failure at line $LINENO" "trap".packages/cli/install, UPGRADE_SOURCES must remain synchronized with src/lib/binary.ts and is ordered: 1. getsentry/toolkit|getsentry/toolkit|cli@, 2. getsentry/cli|getsentry/cli|.packages/cli/install, supported options are -h/--help, -v/--version <version>, --no-modify-path, --no-completions, and --no-agent-skills; recognized environment variables are SENTRY_INSTALL_DIR, SENTRY_VERSION, and SENTRY_INIT.packages/cli/install, requested_version starts from ${SENTRY_VERSION:-}; --version overrides it and missing its argument fails via die "Error: --version requires a version argument" "args", while unknown arguments are silently shifted over.packages/cli/install, OS normalization maps Darwin to darwin, Linux to linux, and MINGW*, MSYS*, or CYGWIN* to windows; unsupported systems fail at step detect-os.packages/cli/install, architecture normalization maps x86_64 to x64 and aarch64 or arm64 to arm64; unsupported architectures fail at step detect-arch, and Windows additionally permits only windows-x64 and uses suffix .exe.packages/cli/install, Linux musl detection first checks /lib/ld-musl-${musl_arch}.so.1, then checks whether ldd --version contains musl; detected musl builds use libc_suffix="-musl" and libc_variant="musl".packages/cli/install, musl Bun binaries require libstdc++ and libgcc_s; when libstdc++ is absent and apk exists, root installations run apk add --no-cache libstdc++ libgcc, while non-root users are told to run apk add libstdc++ libgcc and installation fails at step deps.packages/cli/install, temporary artifacts are ${tmpdir}/sentry-install-$$${suffix}, ${tmpdir}/sentry-install-github-response-$$, and ${tmpdir}/sentry-install-nightly-manifest-$$, where tmpdir falls back through TMPDIR, TMP, TEMP, then /tmp; an EXIT trap removes all three until successful setup takes over cleanup.packages/cli/install, github_get(url) uses curl -sS -L -o "$github_response" -w '%{http_code}'; transport failures immediately fail at gh-fetch, while callers alone may treat a genuine HTTP 404 as permission to try the next upgrade source.packages/cli/install, helper functions source_tag_prefix(), source_github_repo(), and source_ghcr_repo() parse pipe-delimited UPGRADE_SOURCES entries using cut -d'|'.packages/cli/install, select_nightly_source() examines upgrade sources in order, first probing https://api.github.com/repos/${github_repo} because GitHub supplies an unambiguous 404; only 404 advances to the next source, while transport errors and all other non-2xx statuses terminate source selection.packages/cli/install, nightly source selection obtains a GHCR pull token from https://ghcr.io/token?scope=repository:${ghcr_repo}:pull, parses the token field with awk, and fails at ghcr-token if retrieval fails or the parsed token is empty.packages/cli/install, select_nightly_source() requests https://ghcr.io/v2/${ghcr_repo}/manifests/nightly with bearer authorization and Accept: application/vnd.oci.image.manifest.v1+json; manifest 404 advances to the next source, other non-2xx statuses fail, and an empty manifest fails at ghcr-manifest.packages/cli/install, successful nightly selection fixes selected_source and selected_ghcr_source for all subsequent requests; if every configured source returns 404, it fails with No CLI upgrade source was found: every source returned HTTP 404 at step gh-source.packages/cli/install, select_stable_source() uses /releases?per_page=100 for an unspecified version on a tag-prefixed source, /releases/latest for an unspecified version on an unprefixed source, and /releases/tags/${tag_path} for an explicit version; @ is encoded as %40.packages/cli/install, stable source selection advances only on HTTP 404; other non-2xx statuses fail at gh-version, and the first successful source fixes selected_source and selected_tag_prefix.packages/cli/install, automatic version extraction for a prefixed source scans up to 100 releases for the first tag_name matching ^cli@v?[0-9]+\.[0-9]+\.[0-9]+(\+[0-9A-Za-z.-]+)?$, strips cli@, and later strips a leading v; an unprefixed source uses the first tag_name.packages/cli/install, failure to parse an automatic stable version reports Failed to find a CLI release in ${github_repo}; if every stable source returns 404, it reports No CLI release was found: every source returned HTTP 404.packages/cli/install, requested_version == "nightly" installs through the GHCR OCI blob protocol without jq; the manifestβs first version field is extracted with awk, and absence of that field fails at ghcr-version.packages/cli/install, the nightly asset name is sentry-${os}-${arch}${libc_suffix}${suffix}.gz; its digest is found with awk by tracking the last digest and returning it when org.opencontainers.image.title equals the target filename, avoiding GNU/BSD sed newline differences.packages/cli/install, missing a nightly platform asset fails with No nightly build found for ${gz_filename} at step ghcr-digest.packages/cli/install, GHCR blob downloads deliberately do not use curl -L with authorization because forwarding the authorization header to Azure Blob Storage produces 404; the script extracts %{redirect_url} from the GHCR blob endpoint and downloads that URL separately without the auth header.packages/cli/install, an absent GHCR blob redirect URL fails at ghcr-redirect; otherwise the nightly .gz blob is streamed through gunzip into $tmp_binary.packages/cli/install, stable assets are downloaded from https://github.com/${selected_source}/releases/download/${selected_tag_prefix}${version}/sentry-${os}-${arch}${libc_suffix}${suffix}.packages/cli/install, stable installation first attempts ${url}.gz piped through gunzip; the compressed artifact is described as approximately 60% smaller, about 37 MB versus 99 MB. If that attempt fails, it falls back to the raw asset with curl -fsSL --progress-bar.packages/cli/install, the downloaded temporary binary is made executable and invoked as "$tmp_binary" cli setup; setup receives --install --method curl --channel nightly|stable plus any requested --no-modify-path, --no-completions, and --no-agent-skills.packages/cli/install, cli setup --install owns directory selection, binary placement, PATH updates, completions, agent skills, welcome messaging, and successful temporary-file cleanup; --channel persists the release channel for later sentry cli upgrade calls.packages/cli/install, immediately before invoking setup, $github_response is removed and the EXIT trap is cleared so the setup binary handles cleanup on success.packages/cli/install, SENTRY_INIT=1 optionally launches the interactive setup wizard after installation and reconnects stdin to /dev/tty, which is necessary for curl | bash.packages/cli/install, post-install binary discovery checks directories in exact order: 1. ${SENTRY_INSTALL_DIR:-}, 2. valid absolute $XDG_BIN_HOME, 3. $HOME/.local/bin, 4. $HOME/bin, 5. $HOME/.sentry/bin; it selects the first executable ${dir}/sentry.packages/cli/install, relative XDG_BIN_HOME values are ignored per the XDG spec, while POSIX absolute paths and Windows drive-letter paths matching ^[A-Za-z]:[\\/] are accepted to remain consistent with Node determineInstallDir behavior.packages/cli/install, SENTRY_INIT=1 fails at step init if the installed sentry binary cannot be found or /dev/tty is unavailable; success replaces the installer process with exec "$sentry_bin" init </dev/tty.