Dashboard › cli › Session 0Sur2JFiaKMS
0Sur2JFiaKMSPqD4hWork in /home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade. Implement ONLY packages/cli/src/lib/version-check.ts, packages/cli/src/lib/release-notes.ts, and their existing tests for getsentry/cli#1244. Do write code. Thread one explicitly selected UpgradeSource through stable/nightly background version discovery, patch prefetch, and source-sensitive release-note/changelog lookups so stages never mix Toolkit and legacy. Integrate with source-aware helper APIs from binary.ts/upgrade.ts/delta-upgrade.ts where possible; note upgrade.ts is being changed concurrently, so inspect signatures before final edits and avoid touching it. Defaults can preserve direct API compatibility. Toolkit stable tags use cli@ prefix; legacy tags are unprefixed. Fallthrough is only on HTTP 404 at selection, never independently in later stages. Preserve best-effort/non-throwing background and changelog behavior. Add deterministic focused tests proving exact source affinity and no legacy access after primary success where applicable. Do not edit binary.ts, ghcr.ts, upgrade.ts, delta-upgrade.ts, command files, installer, or unrelated files. Run focused tests and report changed files/results.
No files found
<path>/home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade</path> <type>directory</type> <entries> .craft.yml .git .github/ .gitignore .lore.md .nojekyll .npmrc AGENTS.md apps/ CHANGELOG.md codemods/ LICENSE.md node_modules/ package.json packages/ pnpm-lock.yaml pnpm-workspace.yaml README.md (18 entries) </entries>
<path>/home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/AGENTS.md</path> <type>file</type> <content> 1: # Jared (Outpost agent) 2: 3: Autonomous GitHub coding agent. Work in `/workspace/repo`. 4: 5: ## Model tiers 6: 7: The primary model is chosen per event (see `src/agents/models.ts`): heavy for 8: code-producing situations, cheaper for lightweight ones. 9: 10: | Role | Subagent | Model | 11: | --- | --- | --- | 12: | Triage / plan / review (heavy) | (primary Jared) | Claude Opus 4.8 | 13: | Triage / plan / review (light) | (primary Jared) | xAI Grok 4.3 | 14: | Explore | `explore` | OpenAI gpt-5-mini | 15: | Implement | `implement` | Moonshot kimi-k2.7-code | 16: | Ship (commit/push/PR) | `ship` | xAI Grok (`grok-build-0.1`) | 17: 18: Pipeline: triage → explore → plan → implement → review → ship. 19: (`worker` is a deprecated alias of `implement`.) 20: 21: Operators also talk to Jared directly from the Outpost dashboard. ...
/home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli/AGENTS.md
<path>/home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli/AGENTS.md</path> <type>file</type> <content> 1: # AGENTS.md 2: 3: Guidelines for AI agents working in this codebase. 4: 5: ## Project Overview 6: 7: **Sentry CLI** is a command-line interface for [Sentry](https://sentry.io), built with Node.js, [pnpm](https://pnpm.io), and [Stricli](https://bloomberg.github.io/stricli/). It lives in `packages/cli` of a pnpm workspace; the docs site lives in `apps/cli-docs`. ...
<path>/home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli/.cursor/rules/ultracite.mdc</path>
<type>file</type>
<content>
1: ---
2: description: Ultracite Rules - AI-Ready Formatter and Linter
3: globs: "**/*.{ts,tsx,js,jsx,json,jsonc,html,vue,svelte,astro,css,yaml,yml,graphql,gql,md,mdx,grit}"
4: alwaysApply: false
5: ---
6:
7: # Ultracite Code Standards
8:
9: This project uses **Ultracite**, a zero-config Biome preset that enforces strict code quality standards through automated formatting and linting.
10:
11: ## Quick Reference
12:
13: - **Format code**: `npx ultracite fix`
14: - **Check for issues**: `npx ultracite check`
15: - **Diagnose setup**: `npx ultracite doctor`
16:
17: Biome (the underlying engine) provides extremely fast Rust-based linting and formatting. Most issues are automatically fixable. ...
<path>/home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli/package.json</path>
<type>file</type>
<content>
1: {
2: "name": "sentry",
3: "version": "0.45.0-dev.0",
4: "description": "Sentry CLI - A command-line interface for using Sentry built by robots and humans for robots and humans",
5: "repository": {
6: "type": "git",
7: "url": "git+https://github.com/getsentry/cli.git"
8: },
9: "main": "./dist/index.cjs",
10: "type": "module",
11: "types": "./dist/index.d.cts",
12: "exports": {
13: ".": {
14: "import": {
15: "types": "./dist/index.d.mts",
16: "default": "./dist/index.mjs"
17: },
18: "require": {
19: "types": "./dist/index.d.cts",
20: "default": "./dist/index.cjs"
21: }
22: }
23: },
24: "bin": {
25: "sentry": "./dist/bin.cjs"
26: },
27: "files": [
28: "dist/bin.cjs",
29: "dist/index.cjs",
30: ...
<path>/home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli/src/lib/version-check.ts</path>
<type>file</type>
<content>
1: /**
2: * Background version check for "new version available" notifications.
3: *
4: * For nightly builds (CLI_VERSION contains "-dev.<timestamp>"), checks GHCR for the
5: * latest nightly version via the OCI manifest annotation. For stable builds,
6: * checks GitHub Releases. Results are cached in the database and shown on
7: * subsequent runs.
8: */
9:
10: // biome-ignore lint/performance/noNamespaceImport: Sentry SDK recommends namespace import
11: import * as Sentry from "@sentry/node-core/light";
12: import { compare as semverCompare } from "semver";
13: import { CLI_VERSION } from "./constants.js";
14: import { getReleaseChannel } from "./db/release-channel.js";
15: import {
16: getVersionCheckInfo,
17: markUpdateNotified,
18: setVersionCheckInfo,
19: } from ...
<path>/home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli/src/lib/release-notes.ts</path> <type>file</type> <content> 1: /** 2: * Release Notes Parser & Aggregation 3: * 4: * Extracts user-facing changelog entries from GitHub Release bodies (stable) 5: * or conventional commit messages (nightly). Uses `marked.lexer()` for 6: * AST-based section extraction and produces structured data that can be 7: * re-serialized as filtered markdown for rendering via `renderMarkdown()`. ...
<path>/home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli/src/lib/release-notes.ts</path>
<type>file</type>
<content>
501: for (const { commit } of commits) {
502: const message = commit.message;
503:
504: if (message.includes("#skip-changelog")) {
505: continue;
506: }
507:
508: const firstLine = message.split("\n")[0]?.trim();
509: if (!firstLine) {
510: continue;
511: }
512:
513: const ccMatch = CONVENTIONAL_COMMIT_RE.exec(firstLine);
514: if (!(ccMatch?.[1] && ccMatch[2])) {
515: continue;
516: }
517:
518: const category = COMMIT_PREFIX_TO_CATEGORY.get(ccMatch[1]);
519: if (!category) {
520: continue;
521: }
522:
523: const description = ccMatch[2].trim();
524: const existing = items.get(category) ?? [];
525: existing.push(description);
526: items.set(category, existing);
527: }
528:
529: const sections: ...
/home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli/test/lib/version-check.test.ts /home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli/test/lib/release-notes.test.ts /home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli/test/lib/release-notes.property.test.ts
<path>/home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli/test/lib/version-check.test.ts</path>
<type>file</type>
<content>
1: /**
2: * Version Check Logic Tests
3: */
4:
5: import { setTimeout as sleep } from "node:timers/promises";
6: import { afterEach, beforeEach, describe, expect, test } from "vitest";
7: import { setReleaseChannel } from "../../src/lib/db/release-channel.js";
8: import {
9: getVersionCheckInfo,
10: setVersionCheckInfo,
11: } from "../../src/lib/db/version-check.js";
12: import {
13: ApiError,
14: ContextError,
15: ValidationError,
16: } from "../../src/lib/errors.js";
17: import {
18: abortPendingVersionCheck,
19: getErrorUpdateNotification,
20: getUpdateNotification,
21: maybeCheckForUpdateInBackground,
22: resetUpdateNotificationState,
23: shouldSuppressNotification,
24: } from "../../src/lib/version-check.js";
25: import { mockFetch, useTestConfigDir } from ...
<path>/home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli/test/lib/release-notes.test.ts</path>
<type>file</type>
<content>
1: /**
2: * Unit Tests for Release Notes Parser & Aggregation
3: *
4: * Tests core invariants (section extraction, version filtering, truncation)
5: * that are hard to express as property-based tests due to format specifics.
6: *
7: * Core random-input invariants (category validity, filtering, commit parsing)
8: * are tested via property-based tests in release-notes.property.test.ts.
9: */
10:
11: import { marked } from "marked";
12: import { describe, expect, test } from "vitest";
13: import type { GitHubRelease } from "../../src/lib/delta-upgrade.js";
14: import {
15: buildChangelogSummary,
16: type ChangeCategory,
17: countListItems,
18: extractNightlyTimestamp,
19: extractSections,
20: parseCommitMessages,
21: } from "../../src/lib/release-notes.js";
22:
23: // ...
<path>/home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli/test/lib/release-notes.property.test.ts</path>
<type>file</type>
<content>
1: /**
2: * Property-Based Tests for Release Notes Parser
3: *
4: * Uses fast-check to verify properties that should always hold true
5: * for the release notes extraction and commit parsing, regardless of input.
6: */
7:
8: import {
9: array,
10: constantFrom,
11: assert as fcAssert,
12: nat,
13: property,
14: record,
15: tuple,
16: } from "fast-check";
17: import { describe, expect, test } from "vitest";
18: import {
19: type ChangeCategory,
20: extractNightlyTimestamp,
21: extractSections,
22: parseCommitMessages,
23: } from "../../src/lib/release-notes.js";
24: import { DEFAULT_NUM_RUNS } from "../model-based/helpers.js";
25:
26: // ─────────────────────────── Arbitraries ───────────────────────────────────
27:
28: const VALID_CATEGORIES: readonly ...
Found 72 matches
/home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli/src/lib/delta-upgrade.ts:
Line 72: // GHCR_REPO). Importing as a named import keeps a single source of truth and
Line 437: function telemetry(): DeltaTelemetry & { _source: { current?: string } } {
Line 439: // `delta.source` on the active span even when apply fails AFTER a chain
Line 444: _source: captured,
Line 445: onResolved: ({ source, chain }) => {
Line 446: captured.current = source;
Line 448: span?.setAttribute("delta.source", source);
Line 450: `Resolved patch chain from ${source}: ${chain.patches.length} patch(es), ${formatBytes(chain.totalSize)} total`
Line 455: Sentry.getActiveSpan()?.setAttribute("delta.source", "offline_miss");
Line 465: source: SourceStrategy,
Line 471: ): Promise<{ result: DeltaResult | null; source: string | undefined }> {
Line 474: source,
...
Found 7 matches
/home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli/src/lib/delta-upgrade.ts:
Line 14: type GitHubRelease,
Line 52: GitHubRelease,
Line 155: export async function fetchRecentReleases(
Line 157: ): Promise<GitHubRelease[]> {
Line 174: return data as GitHubRelease[];
Line 615: export function prefetchNightlyPatches(
Line 622: export function prefetchStablePatches(
## feat/toolkit-bridge-upgrade...origin/main [behind 2] M packages/cli/src/lib/binary.ts M packages/cli/src/lib/ghcr.ts M packages/cli/test/lib/binary.test.ts M packages/cli/test/lib/ghcr.test.ts M packages/cli/test/lib/install-script.test.ts
<path>/home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli/src/lib/binary.ts</path>
<type>file</type>
<content>
90: *
91: * Defined here (alongside other installation constants like
92: * {@link KNOWN_CURL_DIRS}) so that both `upgrade.ts` and
93: * `db/install-info.ts` can import it without creating a circular
94: * dependency.
95: */
96: export type InstallationMethod =
97: | "curl"
98: | "brew"
99: | "npm"
100: | "pnpm"
101: | "bun"
102: | "yarn"
103: | "unknown";
104:
105: /** A repository pair that hosts CLI stable releases and nightly OCI images. */
106: export type UpgradeSource = {
107: /** GitHub `owner/repository` containing CLI release assets. */
108: readonly githubRepo: string;
109: /** GHCR `owner/package` containing CLI nightly images and delta patches. */
110: readonly ghcrRepo: string;
111: /** Prefix attached to CLI release tags in this repository. ...
<path>/home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli/src/lib/upgrade.ts</path>
<type>file</type>
<content>
340:
341: return "unknown";
342: }
343:
344: /**
345: * Detect how the CLI was installed.
346: *
347: * Priority:
348: * 1. Homebrew — cheap realpath check, overrides stale stored info
349: * 2. Stored install info in DB (fast path)
350: * 3. Legacy detection: curl paths → subprocess calls → node_modules path
351: * 4. Auto-save detected method for future runs
352: *
353: * @returns Detected installation method, or "unknown" if unable to determine
354: */
355: export async function detectInstallationMethod(): Promise<InstallationMethod> {
356: // Always check for Homebrew first — the stored install info may be stale
357: // (e.g. user previously had a curl install recorded, then switched to
358: // Homebrew). The realpath check is cheap and authoritative. ...
<path>/home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli/src/lib/delta-upgrade.ts</path>
<type>file</type>
<content>
1: /** Delta upgrade discovery and application backed by binpatch. */
2:
3: import { join } from "node:path";
4: // biome-ignore lint/performance/noNamespaceImport: Sentry SDK recommends namespace import
5: import * as Sentry from "@sentry/node-core/light";
6: import {
7: applyPatchChainInMemory,
8: extractStableChain as binpatchExtractStableChain,
9: filterAndSortChainTags as binpatchFilterAndSortChainTags,
10: validateChainStep as binpatchValidateChainStep,
11: type DeltaTelemetry,
12: type DeltaUnavailableReason,
13: type ExtractStableChainOpts,
14: type GitHubRelease,
15: getPatchFromVersion,
16: getPatchTargetSha256,
17: ghcrSource,
18: githubReleaseSource,
19: type InstrumentHook,
20: MAX_NIGHTLY_CHAIN_DEPTH,
21: makeCache,
22: OciClient,
23: type OciManifest,
24: ...
<path>/home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli/src/lib/delta-upgrade.ts</path>
<type>file</type>
<content>
580: // by telemetry().onResolved — stamp it on the span so error spans
581: // don't silently lose the network/cache/offline_miss attribution.
582: const errorSpan = Sentry.getActiveSpan();
583: if (chainSource !== undefined && errorSpan) {
584: errorSpan.setAttribute("delta.source", chainSource);
585: }
586: const message = error instanceof Error ? error.message : String(error);
587: log.warn(
588: `Delta upgrade failed (${message}), falling back to full download`
589: );
590: span.setStatus({ code: 2 });
591: span.setAttribute("delta.result", "error");
592: span.setAttribute("delta.error", message);
593: return null;
594: }
595: },
596: { "delta.channel": channel }
597: ...
toolkit merge: bridge CLI release + dual-source upgrade compatibility · Issue #1244 · getsentry/cli · GitHub
[Skip to content](#start-of-content)
## Navigation Menu
[](/)
[Sign in](/login?return_to=https%3A%2F%2Fgithub.com%2Fgetsentry%2Fcli%2Fissues%2F1244)
Appearance settings
- Platform
- AI CODE CREATION
- [GitHub CopilotWrite better code with AI](https://github.com/features/copilot)
- [GitHub Copilot appDirect agents from issue to merge](https://github.com/features/ai/github-app)
- [MCP RegistryIntegrate external tools](https://github.com/mcp)
- DEVELOPER WORKFLOWS
- [ActionsAutomate any workflow](https://github.com/features/actions)
- [CodespacesInstant dev ...
I’ll keep the public defaults intact, select a source once at discovery, pass it through prefetch and changelog calls, and add request-level tests that fail if a later stage contacts the other repository.
<path>/home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli/src/lib/ghcr.ts</path> <type>file</type> <content> 1: /** 2: * GHCR (GitHub Container Registry) Client 3: * 4: * Encapsulates the OCI download protocol for fetching nightly CLI binaries 5: * from ghcr.io/getsentry/cli. Nightly builds are pushed as OCI artifacts 6: * via ORAS with the version baked into the manifest annotation. 7: * 8: * Key design decisions: 9: * - Anonymous access: nightly package is public; no token needed beyond the 10: * standard ghcr.io anonymous token exchange. 11: * - Version discovery from manifest annotation: `annotations.version` in the 12: * OCI manifest holds the nightly version. Checking the latest version only 13: * requires a token exchange + manifest fetch (2 HTTP requests total). 14: * - Redirect quirk: ghcr.io blob downloads return 307 to Azure Blob Storage. ...
Found 2 matches
/home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli/src/lib/release-notes.ts:
Line 720: export async function fetchChangelog(
/home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli/src/commands/cli/upgrade.ts:
Line 834: return fetchChangelog({
<path>/home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli/src/commands/cli/upgrade.ts</path>
<type>file</type>
<content>
790: versionArg: string | undefined;
791: channelChanged: boolean;
792: method: InstallationMethod;
793: }> {
794: const { channel, versionArg } = resolveChannelAndVersion(version);
795: const currentChannel = getReleaseChannel();
796: const channelChanged = channel !== currentChannel;
797:
798: const method = flags.method ?? (await detectInstallationMethod());
799: validateMethod(method, versionArg, channel, flags.offline);
800: return { channel, versionArg, channelChanged, method };
801: }
802:
803: /**
804: * Persist the release channel preference. Must be called **after** offline
805: * target resolution since `setReleaseChannel()` clears the version check
806: * cache on channel changes, which would prevent `resolveOfflineTarget()`
807: * from reading the cached version. ...
No files found
Found 1 matches
/home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli/test/helpers.ts:
Line 85: export function mockFetch(fn: FetchMockFn): typeof fetch {
<path>/home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli/test/helpers.ts</path> <type>file</type> <content> 65: // Ignore cleanup errors 66: } 67: } 68: 69: /** 70: * Helper type for fetch mock functions. 71: * Bun's fetch type includes extra properties like `preconnect` that our mocks don't have. 72: * Supports both full signature and simpler forms for tests that don't need input/init. 73: */ 74: type FetchMockFn = 75: | ((input: RequestInfo | URL, init?: RequestInit) => Promise<Response>) 76: | (() => Promise<Response>); 77: 78: /** 79: * Create a properly typed fetch mock for tests. 80: * This casts the mock function to handle Bun's extended fetch type. ...
Success. Updated the following files: M ../toolkit-bridge-upgrade/packages/cli/src/lib/release-notes.ts
Success. Updated the following files: M ../toolkit-bridge-upgrade/packages/cli/test/lib/release-notes.test.ts
DEPRECATED `test.poolOptions` was removed in Vitest 4. All previous `poolOptions` are now top-level options. Please, refer to the migration guide: https://vitest.dev/guide/migration#pool-rework
RUN v4.1.10 /home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli
Test Files 2 passed (2)
Tests 38 passed (38)
Start at 12:34:57
Duration 2.35s (transform 1.85s, setup 136ms, import 2.40s, tests 203ms, environment 0ms)
M packages/cli/install M packages/cli/src/lib/binary.ts M packages/cli/src/lib/delta-upgrade.ts M packages/cli/src/lib/ghcr.ts M packages/cli/src/lib/release-notes.ts M packages/cli/src/lib/upgrade.ts M packages/cli/test/lib/binary.test.ts M packages/cli/test/lib/delta-upgrade.test.ts M packages/cli/test/lib/ghcr.test.ts M packages/cli/test/lib/install-script.test.ts M packages/cli/test/lib/release-notes.test.ts M packages/cli/test/lib/upgrade.test.ts
Found 31 matches
/home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli/src/lib/upgrade.ts:
Line 42: resolveUpgradeSource,
Line 43: type UpgradeSource,
Line 100: readonly source: UpgradeSource;
Line 412: export async function fetchLatestFromGitHubWithSource(
Line 415: const { source, response } = await resolveUpgradeSource({
Line 452: export async function fetchLatestFromGitHub(
Line 498: export async function fetchLatestNightlyVersionWithSource(
Line 501: const { source } = await resolveUpgradeSource({
Line 511: export async function fetchLatestNightlyVersion(
Line 565: source: UpgradeSource
Line 597: source?: UpgradeSource
Line 602: : await resolveUpgradeSource({
Line 783: source: UpgradeSource = PRIMARY_UPGRADE_SOURCE
Line 822: source: UpgradeSource = PRIMARY_UPGRADE_SOURCE
Line 965: source: UpgradeSource = PRIMARY_UPGRADE_SOURCE
Line 1056: ...
<path>/home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli/src/lib/upgrade.ts</path>
<type>file</type>
<content>
80: * - `false` — online upgrade (network available)
81: * - `"explicit"` — user passed `--offline` flag
82: * - `"network-fallback"` — network failed, auto-fell back to cache
83: */
84: export type OfflineMode = false | "explicit" | "network-fallback";
85:
86: // Constants
87:
88: /** The git tag used for the rolling nightly GitHub release (stable fallback only). */
89: export const NIGHTLY_TAG = "nightly";
90:
91: /** npm registry base URL */
92: const NPM_REGISTRY_URL = "https://registry.npmjs.org/sentry";
93:
94: /** Regex to strip 'v' prefix from version strings */
95: export const VERSION_PREFIX_REGEX = /^v/;
96:
97: /** A resolved standalone-binary version and the source that must serve it. */
98: export type ResolvedUpgradeVersion = {
99: /** Version without a source-specific tag prefix. ...
<path>/home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli/src/lib/upgrade.ts</path>
<type>file</type>
<content>
389: if (legacyMethod !== "unknown") {
390: try {
391: setInstallInfo({
392: method: legacyMethod,
393: path: process.execPath,
394: version: CLI_VERSION,
395: });
396: } catch {
397: log.debug("Failed to persist install info (DB may be read-only)");
398: }
399: }
400:
401: return legacyMethod;
402: }
403:
404: // Version Fetching
405:
406: /**
407: * Fetch the latest version from GitHub releases.
408: *
409: * @param signal - Optional AbortSignal to cancel the request
410: * @returns Latest version string (without 'v' prefix)
411: * @throws {UpgradeError} When fetch fails or response is invalid
412: * @throws {Error} AbortError if signal is aborted
413: */
414: export async function fetchLatestFromGitHubWithSource(
415: signal?: ...
<path>/home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli/src/lib/delta-upgrade.ts</path>
<type>file</type>
<content>
105: "cache.item_size",
106: chain.patches.reduce((sum, patch) => sum + patch.size, 0)
107: );
108: await base.save(chain, steps);
109: });
110: },
111: cleanup: () => base.cleanup(),
112: clear: () => base.clear(),
113: };
114: }
115:
116: function getPatchCache(): PatchCache {
117: return instrumentCache(makeCache(join(getConfigDir(), "patch-cache")));
118: }
119:
120: function stableSource(source: UpgradeSource): SourceStrategy {
121: return githubReleaseSource({
122: releasesUrl: getGitHubReleasesUrl(source),
123: binaryName: getPlatformBinaryName(),
124: userAgent: `sentry-cli/${CLI_VERSION}`,
125: fetch: customFetch,
126: instrument,
127: });
128: }
129:
130: function nightlySource(source: UpgradeSource): ...
<path>/home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli/src/lib/delta-upgrade.ts</path>
<type>file</type>
<content>
615: source: SourceStrategy,
616: targetVersion: string,
617: signal?: AbortSignal
618: ): Promise<void> {
619: if (!canAttemptDelta(targetVersion) || signal?.aborted) {
620: return;
621: }
622: const chain = await source.resolveChain(CLI_VERSION, targetVersion, signal);
623: if (!chain?.steps || signal?.aborted) {
624: return;
625: }
626: await getPatchCache().save(chain, chain.steps);
627: }
628:
629: export function prefetchNightlyPatches(
630: targetVersion: string,
631: signal?: AbortSignal,
632: source: UpgradeSource = PRIMARY_UPGRADE_SOURCE
633: ): Promise<void> {
634: return prefetch(nightlySource(source), targetVersion, signal);
635: }
636:
637: export function prefetchStablePatches(
638: targetVersion: string,
639: signal?: AbortSignal,
640: source: ...
Success. Updated the following files: M ../toolkit-bridge-upgrade/packages/cli/src/lib/version-check.ts
Success. Updated the following files: M ../toolkit-bridge-upgrade/packages/cli/test/lib/version-check.test.ts
Success. Updated the following files: M ../toolkit-bridge-upgrade/packages/cli/test/lib/version-check.test.ts
DEPRECATED `test.poolOptions` was removed in Vitest 4. All previous `poolOptions` are now top-level options. Please, refer to the migration guide: https://vitest.dev/guide/migration#pool-rework
RUN v4.1.10 /home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli
Test Files 3 passed (3)
Tests 85 passed (85)
Start at 12:38:06
Duration 3.33s (transform 3.27s, setup 135ms, import 4.44s, tests 1.19s, environment 0ms)
Success. Updated the following files: M ../toolkit-bridge-upgrade/packages/cli/test/lib/version-check.test.ts
src/lib/release-notes.ts:431:38 lint/nursery/useMaxParams ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× Function has 5 parameters, but only 4 are allowed.
429 │ * @returns Changelog summary, or null if no relevant changes found
430 │ */
> 431 │ export function buildChangelogSummary(
│ ^
> 432 │ releases: GitHubRelease[],
...
> 436 │ source?: UpgradeSource
> 437 │ ): ChangelogSummary | null {
│ ^
438 │ const inRange = releases.filter((release) => {
439 │ let tagName = release.tag_name;
i Functions with many parameters are hard to read and maintain.
i Consider using an options object, splitting into smaller functions, or grouping related parameters.
src/lib/release-notes.ts:614:36 lint/nursery/useMaxParams ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
× Function has 5 parameters, but only 4 are allowed. ...
Success. Updated the following files: M ../toolkit-bridge-upgrade/packages/cli/src/lib/release-notes.ts
<path>/home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli/src/lib/release-notes.ts</path> <type>file</type> <content> 412: } 413: } 414: 415: return merged; 416: } 417: 418: /** 419: * Build a changelog summary from a list of GitHub releases. 420: * 421: * Filters releases within the version range (exclusive `fromVersion`, 422: * inclusive `toVersion`), extracts and merges sections by category, and 423: * optionally truncates to fit terminal constraints. ...
Success. Updated the following files: M ../toolkit-bridge-upgrade/packages/cli/src/lib/release-notes.ts M ../toolkit-bridge-upgrade/packages/cli/test/lib/version-check.test.ts
Checked 5 files in 2s. Fixed 3 files.
diff --git a/packages/cli/src/lib/release-notes.ts b/packages/cli/src/lib/release-notes.ts
index ddf617535..1d6e79b68 100644
--- a/packages/cli/src/lib/release-notes.ts
+++ b/packages/cli/src/lib/release-notes.ts
@@ -15,8 +15,10 @@
import { marked, type Token, type Tokens } from "marked";
import {
compareVersions,
- GITHUB_RELEASES_URL,
getGitHubHeaders,
+ getGitHubReleasesUrl,
+ PRIMARY_UPGRADE_SOURCE,
+ type UpgradeSource,
} from "./binary.js";
import { customFetch } from "./custom-ca.js";
import type { GitHubRelease } from "./delta-upgrade.js";
@@ -413,27 +415,31 @@ function mergeSectionsByCategory(releases: GitHubRelease[]): ChangeSection[] {
return merged;
}
-/**
- * Build a changelog summary from a list of GitHub releases.
- *
- * Filters releases within the version range (exclusive `fromVersion`,
- * inclusive `toVersion`), extracts and merges sections by category, and
- * optionally truncates to fit terminal constraints. ...
Success. Updated the following files: M ../toolkit-bridge-upgrade/packages/cli/src/lib/version-check.ts
DEPRECATED `test.poolOptions` was removed in Vitest 4. All previous `poolOptions` are now top-level options. Please, refer to the migration guide: https://vitest.dev/guide/migration#pool-rework
RUN v4.1.10 /home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli
❯ test/lib/version-check.test.ts (48 tests | 3 failed) 3891ms
× passes the Toolkit source from stable discovery to patch prefetch without legacy access 1029ms
× keeps stable patch prefetch on the legacy source selected after a Toolkit 404 1015ms
× passes the Toolkit source from nightly discovery to patch prefetch without legacy access 1016ms
⎯⎯⎯⎯⎯⎯⎯ Failed Tests 3 ⎯⎯⎯⎯⎯⎯⎯
FAIL test/lib/version-check.test.ts > maybeCheckForUpdateInBackground > passes the Toolkit source from stable discovery to patch prefetch without legacy access
AssertionError: expected "prefetchStablePatches" to be called with arguments: [ Array(3) ]
Received:
1st ...
Success. Updated the following files: M ../toolkit-bridge-upgrade/packages/cli/src/lib/version-check.ts
Success. Updated the following files: M ../toolkit-bridge-upgrade/packages/cli/test/lib/release-notes.test.ts
Checked 5 files in 1998ms. No fixes applied.
DEPRECATED `test.poolOptions` was removed in Vitest 4. All previous `poolOptions` are now top-level options. Please, refer to the migration guide: https://vitest.dev/guide/migration#pool-rework
RUN v4.1.10 /home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli
Test Files 3 passed (3)
Tests 86 passed (86)
Start at 12:42:23
Duration 4.99s (transform 4.40s, setup 229ms, import 6.54s, tests 1.82s, environment 0ms)
src/commands/cli/upgrade.ts(869,3): error TS1005: ',' expected.
M packages/cli/install M packages/cli/src/commands/cli/upgrade.ts M packages/cli/src/lib/binary.ts M packages/cli/src/lib/delta-upgrade.ts M packages/cli/src/lib/ghcr.ts M packages/cli/src/lib/release-notes.ts M packages/cli/src/lib/upgrade.ts M packages/cli/src/lib/version-check.ts M packages/cli/test/lib/binary.test.ts M packages/cli/test/lib/delta-upgrade.test.ts M packages/cli/test/lib/ghcr.test.ts M packages/cli/test/lib/install-script.test.ts M packages/cli/test/lib/release-notes.test.ts M packages/cli/test/lib/upgrade.test.ts M packages/cli/test/lib/version-check.test.ts
/home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli/tsconfig.json
<path>/home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli/tsconfig.json</path>
<type>file</type>
<content>
1: {
2: "compilerOptions": {
3: "lib": ["ESNext"],
4: "target": "ESNext",
5: "module": "ESNext",
6: "jsx": "react-jsx",
7: "moduleDetection": "force",
8: "allowJs": true,
9: "moduleResolution": "bundler",
10: "allowImportingTsExtensions": true,
11: "verbatimModuleSyntax": true,
12: "noEmit": true,
13: "resolveJsonModule": true,
14: "strict": true,
15: "skipLibCheck": true,
16: "noFallthroughCasesInSwitch": true,
17: "noUncheckedIndexedAccess": true,
18: "noImplicitOverride": true,
19: "esModuleInterop": true,
20: "forceConsistentCasingInFileNames": true,
21: "noUnusedLocals": false,
22: "noUnusedParameters": false,
23: "noPropertyAccessFromIndexSignature": false,
24: "strictNullChecks": true
25: },
26: "include": ...
<path>/home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli/src/commands/cli/upgrade.ts</path>
<type>file</type>
<content>
810: `Your ${method}-installed sentry may still appear earlier in PATH.`
811: );
812: const hint = uninstallHints[method];
813: if (hint) {
814: warnings.push(`Consider removing it: ${hint}`);
815: }
816: return warnings;
817: }
818:
819: /**
820: * Resolve the channel, version arg, method, and channel-changed flag from
821: * the positional version argument and flags. Extracted to keep `func()`
822: * complexity under the biome limit. ...
Found 6 matches /home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli/src/commands/cli/upgrade.ts: Line 218: source: resolved.source, Line 310: let source = latestResolution?.source; Line 360: source = pinnedResolution?.source ?? source; Line 864: function startChangelogFetch( Line 999: result.changelog = await startChangelogFetch( Line 1012: const changelogPromise = startChangelogFetch(
<path>/home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli/src/commands/cli/upgrade.ts</path>
<type>file</type>
<content>
970: },
971: },
972: async *func(this: SentryContext, flags: UpgradeFlags, version?: string) {
973: const { channel, versionArg, channelChanged, method } =
974: await resolveContext(version, flags);
975:
976: log.debug(`Installation method: ${method}`);
977: log.debug(`Current version: ${CLI_VERSION}`);
978:
979: const resolved = await withProgress(
980: { message: "Checking for updates...", json: flags.json },
981: async () =>
982: resolveTargetWithFallback({
983: resolveOpts: { method, channel, versionArg, channelChanged, flags },
984: versionArg,
985: offline: flags.offline,
986: method,
987: persistChannelFn: () =>
988: persistChannel(channel, channelChanged, version),
989: ...
src/lib/binary.ts(236,3): error TS2322: Type 'UpgradeSource | undefined' is not assignable to type 'UpgradeSource'. Type 'undefined' is not assignable to type 'UpgradeSource'. src/lib/binary.ts(244,3): error TS2322: Type 'UpgradeSource | undefined' is not assignable to type 'UpgradeSource'. Type 'undefined' is not assignable to type 'UpgradeSource'. src/lib/binary.ts(252,3): error TS2322: Type 'UpgradeSource | undefined' is not assignable to type 'UpgradeSource'. Type 'undefined' is not assignable to type 'UpgradeSource'. src/lib/binary.ts(260,3): error TS2322: Type 'UpgradeSource | undefined' is not assignable to type 'UpgradeSource'. Type 'undefined' is not assignable to type 'UpgradeSource'. src/lib/binary.ts(269,3): error TS2322: Type 'UpgradeSource | undefined' is not assignable to type 'UpgradeSource'. Type 'undefined' is not assignable to type 'UpgradeSource'. src/lib/ghcr.ts(138,26): error TS18048: 'PRIMARY_UPGRADE_SOURCE' is possibly ...
<path>/home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli/src/lib/binary.ts</path>
<type>file</type>
<content>
112: readonly tagPrefix: string;
113: };
114:
115: /** Ordered CLI release sources. The resolver falls through only on HTTP 404. */
116: export const UPGRADE_SOURCES: readonly UpgradeSource[] = [
117: {
118: githubRepo: "getsentry/toolkit",
119: ghcrRepo: "getsentry/toolkit",
120: tagPrefix: "cli@",
121: },
122: {
123: githubRepo: "getsentry/cli",
124: ghcrRepo: "getsentry/cli",
125: tagPrefix: "",
126: },
127: ];
128:
129: /** The first source used by direct helper calls that do not resolve a source. */
130: export const PRIMARY_UPGRADE_SOURCE = UPGRADE_SOURCES[0];
131:
132: /** Valid methods that can be specified via --method flag */
133: const VALID_METHODS: InstallationMethod[] = [
134: "curl",
135: "brew",
136: "npm",
(Showing lines 112-136 of 726. ...
DEPRECATED `test.poolOptions` was removed in Vitest 4. All previous `poolOptions` are now top-level options. Please, refer to the migration guide: https://vitest.dev/guide/migration#pool-rework
RUN v4.1.10 /home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli
DEPRECATED `test.poolOptions` was removed in Vitest 4. All previous `poolOptions` are now top-level options. Please, refer to the migration guide: https://vitest.dev/guide/migration#pool-rework
·········
Test Files 1 passed (1)
Tests 9 passed (9)
Start at 12:45:12
Duration 830ms (transform 429ms, setup 60ms, import 503ms, tests 86ms, environment 0ms)
RUN v4.1.10 /home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli
·········
Test Files 1 passed (1)
Tests 9 passed (9)
Start at 12:45:14
Duration 722ms (transform 330ms, setup 60ms, import 398ms, tests 83ms, ...
<path>/home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli/src/lib/binary.ts</path> <type>file</type> <content> 124: ghcrRepo: "getsentry/cli", 125: tagPrefix: "", 126: }, 127: ]; 128: 129: /** The first source used by direct helper calls that do not resolve a source. */ 130: export const PRIMARY_UPGRADE_SOURCE = UPGRADE_SOURCES[0]; 131: 132: /** Valid methods that can be specified via --method flag */ 133: const VALID_METHODS: InstallationMethod[] = [ 134: "curl", 135: "brew", (Showing lines 124-135 of 726. Use offset=136 to continue.) </content>
Success. Updated the following files: M ../toolkit-bridge-upgrade/packages/cli/src/lib/release-notes.ts
Success. Updated the following files: M ../toolkit-bridge-upgrade/packages/cli/src/lib/release-notes.ts
src/lib/release-notes.ts(677,3): error TS1016: A required parameter cannot follow an optional parameter.
Success. Updated the following files: M ../toolkit-bridge-upgrade/packages/cli/src/lib/release-notes.ts
(no output)
<path>/home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli/src/lib/binary.ts</path> <type>file</type> <content> 124: ghcrRepo: "getsentry/cli", 125: tagPrefix: "", 126: }, 127: ] as const satisfies readonly [UpgradeSource, ...UpgradeSource[]]; 128: 129: /** The first source used by direct helper calls that do not resolve a source. */ 130: export const PRIMARY_UPGRADE_SOURCE = UPGRADE_SOURCES[0]; 131: 132: /** Valid methods that can be specified via --method flag */ 133: const VALID_METHODS: InstallationMethod[] = [ (Showing lines 124-133 of 726. Use offset=134 to continue.) </content>
Success. Updated the following files: M ../toolkit-bridge-upgrade/packages/cli/src/lib/release-notes.ts
Checked 5 files in 2s. No fixes applied.
DEPRECATED `test.poolOptions` was removed in Vitest 4. All previous `poolOptions` are now top-level options. Please, refer to the migration guide: https://vitest.dev/guide/migration#pool-rework
RUN v4.1.10 /home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli
Test Files 3 passed (3)
Tests 86 passed (86)
Start at 12:48:16
Duration 4.09s (transform 3.83s, setup 268ms, import 5.03s, tests 1.61s, environment 0ms)
(no output)
Found 4 matches /home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli/src/lib/upgrade.ts: Line 413: export async function fetchLatestFromGitHubWithSource( Line 500: export async function fetchLatestNightlyVersionWithSource( /home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli/src/lib/delta-upgrade.ts: Line 634: export function prefetchNightlyPatches( Line 642: export function prefetchStablePatches(
<path>/home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli/src/lib/upgrade.ts</path>
<type>file</type>
<content>
407: *
408: * @param signal - Optional AbortSignal to cancel the request
409: * @returns Latest version string (without 'v' prefix)
410: * @throws {UpgradeError} When fetch fails or response is invalid
411: * @throws {Error} AbortError if signal is aborted
412: */
413: export async function fetchLatestFromGitHubWithSource(
414: signal?: AbortSignal,
415: sources: readonly UpgradeSource[] = UPGRADE_SOURCES
416: ): Promise<ResolvedUpgradeVersion> {
417: const { source, response } = await resolveUpgradeSource({
418: getProbeUrl: getGitHubLatestReleaseUrl,
419: signal,
420: sources,
421: });
422: const data = (await response.json()) as
423: | { tag_name?: string }
424: | Array<{ tag_name?: string; draft?: boolean; prerelease?: boolean }>;
425: const tags = ...
<path>/home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli/src/lib/delta-upgrade.ts</path>
<type>file</type>
<content>
628: if (!chain?.steps || signal?.aborted) {
629: return;
630: }
631: await getPatchCache().save(chain, chain.steps);
632: }
633:
634: export function prefetchNightlyPatches(
635: targetVersion: string,
636: signal?: AbortSignal,
637: source: UpgradeSource = getPrimaryUpgradeSource()
638: ): Promise<void> {
639: return prefetch(nightlySource(source), targetVersion, signal);
640: }
641:
642: export function prefetchStablePatches(
643: targetVersion: string,
644: signal?: AbortSignal,
645: source: UpgradeSource = getPrimaryUpgradeSource()
646: ): Promise<void> {
647: return prefetch(stableSource(source), targetVersion, signal);
648: }
(End of file - total 648 lines)
</content>
M packages/cli/install M packages/cli/src/commands/cli/upgrade.ts M packages/cli/src/lib/binary.ts M packages/cli/src/lib/delta-upgrade.ts M packages/cli/src/lib/ghcr.ts M packages/cli/src/lib/release-notes.ts M packages/cli/src/lib/upgrade.ts M packages/cli/src/lib/version-check.ts M packages/cli/test/commands/cli/upgrade.test.ts M packages/cli/test/lib/binary.test.ts M packages/cli/test/lib/delta-upgrade.test.ts M packages/cli/test/lib/ghcr.test.ts M packages/cli/test/lib/install-script.test.ts M packages/cli/test/lib/release-notes.test.ts M packages/cli/test/lib/upgrade.test.ts M packages/cli/test/lib/version-check.test.ts
<path>/home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli/src/lib/version-check.ts</path>
<type>file</type>
<content>
215:
216: /**
217: * Abort any pending version check to allow process exit.
218: * Call this when main CLI work is complete.
219: */
220: export function abortPendingVersionCheck(): void {
221: pendingAbortController?.abort();
222: pendingAbortController = null;
223: }
224:
225: /**
226: * Pre-fetch delta patches for a newly discovered version.
227: *
228: * Best-effort: errors are silently caught so the version check still succeeds.
229: * After pre-fetching, opportunistically cleans up stale cached patches.
230: */
231: async function maybePrefetchPatches(
232: channel: "stable" | "nightly",
233: latestVersion: string,
234: signal: AbortSignal,
235: source: UpgradeSource
236: ): Promise<void> {
237: if (semverCompare(latestVersion, CLI_VERSION) !== 1) {
238: return;
239: ...
<path>/home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli/src/lib/release-notes.ts</path>
<type>file</type>
<content>
415: return merged;
416: }
417:
418: /** Options for source-aware changelog summary construction. */
419: type ChangelogBuildOptions = {
420: /** Maximum total list items across all sections, or unlimited when omitted. */
421: maxItems?: number;
422: /** Selected release source whose tag prefix filters the release list. */
423: source?: UpgradeSource;
424: };
425:
426: /** Build a changelog summary while filtering source-specific release tags. */
427: function buildChangelogSummaryForSource(
428: releases: GitHubRelease[],
429: fromVersion: string,
430: toVersion: string,
431: options: ChangelogBuildOptions
432: ): ChangelogSummary | null {
433: const { maxItems, source } = options;
434: const inRange = releases.filter((release) => {
435: let tagName = release.tag_name;
436: ...
<path>/home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade/packages/cli/src/lib/release-notes.ts</path>
<type>file</type>
<content>
575: const CHANGELOG_MAX_RELEASES = 30;
576:
577: /**
578: * Fetch recent releases from GitHub for changelog building.
579: *
580: * Uses a higher `per_page` than `fetchRecentReleases()` in delta-upgrade
581: * (which is capped at 12 for patch chain resolution) to cover larger
582: * version jumps without silent truncation.
583: *
584: * @returns Array of releases (newest first), or empty array on failure
585: */
586: async function fetchReleasesForChangelog(
587: source: UpgradeSource
588: ): Promise<GitHubRelease[]> {
589: let response: Response;
590: try {
591: response = await customFetch(
592: `${getGitHubReleasesUrl(source)}?per_page=${CHANGELOG_MAX_RELEASES}`,
593: { headers: getGitHubHeaders() }
594: );
595: } catch (error) {
596: log.debug("Failed to ...
Success. Updated the following files: M ../toolkit-bridge-upgrade/packages/cli/src/lib/release-notes.ts
Checked 5 files in 1382ms. No fixes applied.
packages/cli/src/lib/release-notes.ts | 119 ++++++++++++++++++-------- packages/cli/src/lib/version-check.ts | 21 +++-- packages/cli/test/lib/release-notes.test.ts | 113 ++++++++++++++++++++++++- packages/cli/test/lib/version-check.test.ts | 125 +++++++++++++++++++++++++++- 4 files changed, 331 insertions(+), 47 deletions(-)
Implemented getsentry/cli#1244 source affinity.
Changed:
packages/cli/src/lib/version-check.tspackages/cli/src/lib/release-notes.tspackages/cli/test/lib/version-check.test.tspackages/cli/test/lib/release-notes.test.tsBehavior:
UpgradeSource from stable/nightly discovery into patch prefetch.cli@ tag prefix.Validation:
Concurrent changes in excluded files remain untouched.
Date: Sep 9, 2026 * 🟡 (12:41) Background source-propagation regression tests initially failed: `packages/cli/test/lib/version-check.test.ts` had 3 failures and 45 passes across 48 tests. `prefetchStablePatches()` and `prefetchNightlyPatches()` received only `[targetVersion, AbortSignal]` instead of the expected `[targetVersion, AbortSignal, UpgradeSource]`; failures covered Toolkit stable (`99.0…
Date: Sep 9, 2026 * 🔴 (12:33) User provided `packages/cli/test/helpers.ts` lines 65–124. `FetchMockFn` supports either `(input: RequestInfo | URL, init?: RequestInit) => Promise<Response>` or `() => Promise<Response>`; `mockFetch(fn: FetchMockFn): typeof fetch` casts through `unknown`. `useTestConfigDir()` creates an isolated config directory, saves/restores `SENTRY_CONFIG_DIR`, closes the datab…
* 🔴 (12:31) User emphasized that new binaries and the install script must always check the ordered source list: 1. `getsentry/toolkit` / `ghcr.io/getsentry/toolkit`; 2. `getsentry/cli` / `ghcr.io/getsentry/cli`. * 🔴 (12:31) User stated source fallback is allowed only on HTTP `404`; network and fetch failures are transient errors and must never poison a source. * 🔴 (12:31) User specified that T…
Date: Sep 9, 2026 * 🔴 (12:30) User specified that Internal Changes and Documentation sections must never appear in release-note output; extracted sections must never contain `"internal"`, `"docs"`, or `"documentation"` categories. * 🔴 (12:30) User provided `packages/cli/test/lib/release-notes.property.test.ts`, which uses `fast-check`, Vitest, and `DEFAULT_NUM_RUNS` to enforce 9 properties: 1. …
Date: Sep 9, 2026 * 🔴 (12:29) User specified that `applySectionTruncation()` in `packages/cli/src/lib/release-notes.ts` mutates the `sections` array in place, “replacing markdown with truncated versions” when the total item count exceeds `maxItems`. * 🔴 (12:29) User specified update-check test behavior for the case “never checked before”: `maybeCheckForUpdateInBackground` should check for an up…
Date: Sep 9, 2026 * 🔴 [enforced-workflow] (12:28) User requires agents to always load `repo-setup` before situation skills; this rule is defined in repository-root `AGENTS.md`. * 🔴 [enforced-workflow] (12:29) User requires checking `packages/cli/package.json` for the latest scripts before running project commands. * 🔴 [enforced-dependency-policy] (12:29) User requires all packages to be added …
Date: Sep 9, 2026 * 🔴 (12:26) User directed work in `/home/byk/.local/share/opencode/worktree/0e8c2f3bbe145a3280d6fb6ed900a5121f382cf0/toolkit-bridge-upgrade` for `getsentry/cli#1244`. * 🔴 [enforced-scope] (12:26) User required implementation ONLY in `packages/cli/src/lib/version-check.ts`, `packages/cli/src/lib/release-notes.ts`, and their existing tests. * 🔴 (12:26) User explicitly instructe…