Dashboard › cli › Distillation
bf4cf00a-fccd-4cc2-9cb2-82ceda7a1b8b["lore_tm_v1_fqRHUzLlI9kKj3bJm6HDRfVYZz1oTnicVHtRA3cslJY","lore_tm_v1_cVX9lcMFouUHT5h-Jbx4XVoQ-IGbzD95Oe3XaZwilvc","lore_tm_v1_ie105r-qMmqgC52SA6iDOz0dd4Ja0-48zQR_fwwjJ8Y","lore_tm_v1_Cw0zv0YP8shUylYxJxy6J6zBaMLoopDMZFLUUBZunWU","lore_tm_v1_wIcRVjMZhE_4-Ch-pNZjrP8CNcZrD0zC1y7-Sa8y2vo","lore_tm_v1_FopGHFzZO4u3jscwMlaRecNsgjR4h-iQiUXPxU2eLw0"]
Date: September 9, 2026
packages/cli/src/lib/ghcr.ts treats the nightly package at ghcr.io/getsentry/cli as public, with no token needed beyond anonymous registry access; GHCR_BLOB_TIMEOUT is 30_000.packages/cli/src/lib/ghcr.ts uses structured abort-signal state rather than runtime-dependent error-message text to classify timeouts versus external cancellation, and contains fetchWithRetry() for GHCR cold-start latency spikes documented as ranging from 126ms to 30s for identical requests.packages/cli/src/lib/ghcr.ts blob downloads use a two-step flow: 1. request the GHCR blob endpoint with authorization and manual redirect handling, 2. follow the signed redirect URL without the Authorization header because forwarding it can cause a 404.packages/cli/package.json scripts are "tsx": "tsx --env-file-if-exists=.env.local --import ./script/require-shim.mjs" and "cli": "tsx --env-file-if-exists=.env.local --import ./script/require-shim.mjs src/bin.ts".packages/cli/package.json: dev runs generate:schema, generate:docs, generate:sdk, then tsx --import ./script/require-shim.mjs src/bin.ts; build runs the same generators then pnpm tsx script/build.ts --single; build:all ends with pnpm tsx script/build.ts; bundle ends with pnpm tsx script/bundle.ts.packages/cli/package.json: test delegates to pnpm run test:unit; test:unit generates docs and SDK then runs vitest run test/lib test/commands test/types test/script --coverage; test:changed generates docs and SDK then runs vitest run --changed; test:e2e generates docs and SDK then runs vitest run test/e2e; test:init-eval runs vitest run test/init-eval --testTimeout 600000.packages/cli/package.json defines generate:docs as the ordered pipeline generate:banner, generate:parser, generate:command-docs, generate:skill, and generate:docs-sections.packages/cli/src/lib/delta-upgrade.ts is a 615-line delta-upgrade adapter backed by binpatch; it imports applyPatchChainInMemory, extractStableChain, filterAndSortChainTags, validateChainStep, getPatchFromVersion, getPatchTargetSha256, ghcrSource, githubReleaseSource, makeCache, OciClient, resolveAndApply, MAX_NIGHTLY_CHAIN_DEPTH, PATCH_TAG_PREFIX, and SIZE_THRESHOLD_RATIO from binpatch.packages/cli/src/lib/delta-upgrade.ts preserves its existing public API by re-exporting ExtractStableChainOpts, GitHubAsset, GitHubRelease, PatchChain, StableChainInfo, extractSha256, getPatchFromVersion, getPatchTargetSha256, getStableTargetSha256, and PATCH_TAG_PREFIX from binpatch.DeltaResult in packages/cli/src/lib/delta-upgrade.ts contains sha256: string, patchBytes: number, and chainLength: number.patch-chain:${fromVersion}-${toVersion}; getPatchCache() creates the cache at join(getConfigDir(), "patch-cache").instrumentCache() wraps PatchCache.load() and PatchCache.save() with tracing spans using operations cache.get and cache.put; recorded attributes include cache.key, cache.hit, and cache.item_size.githubReleaseSource() with GITHUB_RELEASES_URL, getPlatformBinaryName(), user agent sentry-cli/${CLI_VERSION}, customFetch, and tracing instrumentation; nightly resolution uses ghcrSource() with registry https://ghcr.io, imported GHCR_REPO, target tags nightly-${version}, compareVersions, the same user agent and fetch implementation, and tracing instrumentation.canAttemptDelta(targetVersion) rejects delta upgrades when CLI_VERSION === "0.0.0-dev", when current and target versions belong to different stable/nightly channels, or when the target is a downgrade.fetchRecentReleases() requests ${GITHUB_RELEASES_URL}?per_page=12 with Accept: application/vnd.github.v3+json and User-Agent: sentry-cli/${CLI_VERSION}; it returns [] for non-OK responses, non-array JSON, or thrown errors.downloadStablePatch() fetches with User-Agent: sentry-cli/${CLI_VERSION} and returns a Uint8Array only for an OK response; failures and exceptions return null.validateChainStep() preserves three detailed failure classifications around binpatch: version-mismatch with expected and actual versions, missing-layer with layerName, and size-exceeded with layerSize and budget; the direct binpatch result is coarser, using "malformed" or "over_budget".resolveNightlyChain() creates an OciClient for https://ghcr.io and GHCR_REPO, optionally uses preloadedTags, otherwise lists tags with PATCH_TAG_PREFIX, filters/sorts them between current and target versions, and returns null when the chain is empty or exceeds MAX_NIGHTLY_CHAIN_DEPTH.Promise.all; each patch layer is named ${getPlatformBinaryName()}.patch, and each stepβs remaining size budget is opts.fullGzSize * SIZE_THRESHOLD_RATIO - totalSize.resolveNightlyChain() records telemetry_reason when validation fails, requires the final chain version to equal opts.targetVersion, requires a target SHA-256 from the last manifest, downloads patch blobs concurrently, and returns patches, summed totalSize, expectedSha256, and ordered { fromVersion, toVersion } steps.applyPatchChain() traces operation upgrade.delta.apply, records patches.count and patches.total_bytes, calls applyPatchChainInMemory(), and throws SHA-256 mismatch after patching: got ${sha256}, expected ${chain.expectedSha256} when the generated binary hash differs.makeByteProgress() with the label Applying patch(es) for the apply phase and Processing patch(es) otherwise; it converts cumulative event byte counts into increments by subtracting previousWritten.delta.source when a chain resolves, uses "offline_miss" for offline cache misses, and records telemetry_reason for DeltaUnavailableReason; the source is also captured internally so apply failures retain source attribution.packages/cli/src/lib/delta-upgrade.ts: failures occurring after successful chain resolution previously lost delta.source; telemetry() now exposes captured _source.current, resolveDelta() returns it with the result, and attemptDeltaUpgrade() stamps it on the active error span.resolveDelta() calls resolveAndApply() with currentVersion: CLI_VERSION, the selected source, old and destination paths, instrumented patch cache, optional offline mode, progress handling, and telemetry.resolveStableDelta() and resolveNightlyDelta() preserve positional APIs (targetVersion, oldBinaryPath, destPath, offline?, setMessage?) and delegate respectively to stableSource() and nightlySource().attemptDeltaUpgrade() selects channel "nightly" or "stable", traces upgrade.delta, records delta.from_version, delta.to_version, delta.patch_bytes, and delta.chain_length, and emits Sentry distributions upgrade.delta.patch_bytes and upgrade.delta.chain_length with the channel attribute.attemptDeltaUpgrade() records delta.result = "unavailable" and span status code 1; on error it captures a warning-level Sentry exception tagged with from-version, to-version, and channel, logs fallback to a full download, records delta.result = "error" and delta.error, sets status code 2, and returns null.CLI_VERSION to the target, and caches it only when chain steps exist and the signal remains active; exported entry points are prefetchNightlyPatches() and prefetchStablePatches()./home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/glowing-cactus/AGENTS.md and /home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/glowing-cactus/packages/cli/AGENTS.md.AGENTS.md directs agents to project-root .lore.md for lore-managed long-term knowledge covering gotchas, patterns, decisions, and architecture.