Dashboard › cli › Distillation
e08057d0-bf79-4a3e-9c78-e3e6fdf73c7e["lore_tm_v1_a9c4vpO1KAz7K8RTuIV_Xo6F9uVHUZvOI4_QEqhjAOg","lore_tm_v1_NWFoC4veJRIYa1Pmsc4PCatWV9-g4yaQiazuLbG3H7M"]
./bspatch: addDiffChunk, applyPatch, applyPatchChainInMemory, applyPatchToMemory, MAX_OUTPUT_SIZE, offtin, parsePatchHeader, and type PatchHeader../patch-cache: types ChainMeta, PatchCache, and PatchStepMeta, plus chainFileName, makeCache, and patchFileName../contract: types ChainStep, DeltaResult, InstrumentHook, PatchChain, and PatchLink, plus MAX_NIGHTLY_CHAIN_DEPTH, MAX_STABLE_CHAIN_DEPTH, PATCH_TAG_PREFIX, and SIZE_THRESHOLD_RATIO.BinpatchError and type BinpatchErrorReason from ./errors; progress types ProgressEvent, ProgressHandler, and ProgressPhase plus safeProgress from ./events../discover: types DeltaSource, DeltaTelemetry, DeltaUnavailableReason, ResolveAndApplyOpts, SourceStrategy, and UnavailableReporter, plus resolveAndApply../sources/ghcr: type GhcrSourceConfig, ghcrSource, getPatchFromVersion, getPatchTargetSha256, filterAndSortChainTags, types NightlyChainFailure and StepFailureReason, and validateChainStep../sources/github-release: extractSha256, extractStableChain, type ExtractStableChainOpts, types GitHubAsset, GitHubRelease, and GitHubReleaseSourceConfig, githubReleaseSource, getStableTargetSha256, and types StableChainFailure and StableChainInfo../sources/oci: OciClient and types OciClientConfig, OciLayer, and OciManifest./home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli/src/lib/version-check.ts implements background version checking: nightly builds whose CLI_VERSION contains -dev.<timestamp> query GHCR through an OCI manifest annotation, stable builds query GitHub Releases, and results are cached in the database for display on later runs.version-check.ts imports Sentry as import * as Sentry from "@sentry/node-core/light" under biome-ignore lint/performance/noNamespaceImport because the Sentry SDK recommends a namespace import; it uses compare as semverCompare from semver.CHECK_INTERVAL_MS = 24 * 60 * 60 * 1000, NOTIFICATION_INTERVAL_MS = 24 * 60 * 60 * 1000, and JITTER_FACTOR = 0.2; the notification interval limits the update banner to once per 24 hours to avoid clutter in scripts, CI output, and screen-sharing sessions, addressing getsentry/cli#785 item #10.SUPPRESSED_ARGS contains, in order, "upgrade", "--version", "-V", "--json", "token", and "init"; "init" is explicitly suppressed because its interactive wizard has its own terminal UI.SUPPRESSED_CLI_SUBCOMMANDS contains "setup" and "fix" and is matched only when preceded by the cli command group, preventing false positives such as --project setup.GLOBAL_VALUE_FLAG_NAMES is derived from GLOBAL_FLAGS.filter((f) => f.kind === "value").map((f) => f.name).skipGlobalValueFlagValue(args, i) advances over the following token only when the current token is a recognized -- global value flag, does not use =, has a next token, and that token does not start with -; otherwise it returns i.cliGroupIndex(args) scans leading global flags and their spaced values for the first command token, returns its index only if that token is "cli", and stops without a result at a -- escape or when the first positional token is not "cli".cliSubcommandAfterGroup(args, start) finds the first positional token after cli while skipping interleaved global flags and their values; it returns undefined if no subcommand exists or a -- escape ends command-path scanning.shouldSuppressNotification(args) first suppresses when any argument appears in SUPPRESSED_ARGS; otherwise it resolves the cli group and its first subcommand past interleaved global flags and suppresses only if that subcommand is in SUPPRESSED_CLI_SUBCOMMANDS.pendingAbortController is an AbortController | null; abortPendingVersionCheck() aborts the pending version-check fetch via optional chaining and then resets the variable to null.shouldCheckForUpdate() immediately returns true when getVersionCheckInfo().lastChecked is null; otherwise it computes elapsed = Date.now() - lastChecked, randomizes the 24-hour interval by Β±20% using (Math.random() - 0.5) * 2 * JITTER_FACTOR, and checks Math.random() < 1 - Math.exp(-elapsed / effectiveInterval).1 - 1/e), and approximately 86% at 200%.maybePrefetchPatches(channel, latestVersion, signal) exits unless semverCompare(latestVersion, CLI_VERSION) === 1; for a newer version it invokes prefetchNightlyPatches(latestVersion, signal) when channel === "nightly" or prefetchStablePatches(latestVersion, signal) otherwise.maybePrefetchPatches() is best-effort: errors are caught and logged with logger.debug("Delta patch pre-fetch failed (best-effort)", error), after which stale patch cleanup is attempted independently via cleanupPatchCache(); cleanup failures are logged with logger.debug("Patch cache cleanup failed (best-effort)", error).checkForUpdateInBackgroundImpl() never throws; errors are caught and reported to Sentry.checkForUpdateInBackgroundImpl() is non-blocking and starts a detached Sentry span; if shouldCheckForUpdate() throws because database access failed, it calls Sentry.captureException(error) and returns without crashing the CLI.checkForUpdateInBackgroundImpl() creates a new AbortController, reads channel = getReleaseChannel(), and calls Sentry.startSpanManual() with { name: "version-check", op: "version.check", forceTransaction: true }."version-check" span, nightly uses fetchLatestNightlyVersion(signal) and stable uses fetchLatestFromGitHub(signal); the result is persisted through setVersionCheckInfo(latestVersion), then maybePrefetchPatches(channel, latestVersion, signal) prefetches deltas so sentry cli upgrade can apply them offline.span.setStatus({ code: 1 }); failure sets span.setStatus({ code: 2 }). Non-AbortError instances of Error are recorded as span attributes version_check.error = error.message and version_check.error_type = error.constructor.name.AbortErrors are not reported. Other network and JSON parsing failures are treated as transient infrastructure issues such as GitHub rate limits or CDN errors and stored as queryable span attributes rather than sent through captureException, avoiding clutter in the Sentry Issues feed.pendingAbortController = null and calls span.end() in finally.isStderrTTY() returns Boolean(process.stderr.isTTY); update banners are human-only and suppressed for non-TTY stderr such as pipelines, CI logs, and editor-captured output, matching gh CLI behavior.version-check.ts documents a per-process notification guard because a process such as sentry help piped into less may read the notification twiceβonce during banner rendering and once through another code pathβbut should count as notified only once.