From 638c68ef9e4db607d6e9c87b5039eecd684b053d Mon Sep 17 00:00:00 2001 From: Grant Reaber Date: Wed, 11 Nov 2026 12:37:19 +0100 Subject: [PATCH 1/2] build: release the fork's server from greaber/t3code The desktop app, `t3 service` self-update, `t3 update` and the install script downloaded server archives from pingdotgg/t3code, so every host ran upstream's build, and the fork had no way to publish its own. - Point CLI_RELEASE_REPOSITORY (the single source for the archive download base, release index and releases page) and scripts/install.sh at greaber/t3code. - Version the fork as -grant., starting at 0.1.9-grant.1, so installs never collide with an upstream build in the runtime cache. Grant builds read as the stable track; version skew now compares full versions between two grant builds so -grant.2 offers an update to a host on -grant.1. install.sh's stable lookup accepts the suffix. - The manual update command no longer suggests `npx t3@`, which does not exist for fork builds; it copies the install script one-liner pinned to the release tag. - Add .github/workflows/fork-release.yml: on a v*-grant.* tag (or by hand) it builds the JS bundle and the linux-x64, linux-arm64 and darwin-arm64 CLI archives on GitHub-hosted runners with upstream's build scripts, smoke-tests them, and publishes a release with SHA256SUMS. - Document versioning, cutting a release, building the desktop app and moving existing hosts to the fork in docs/operations/fork-release.md. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/fork-release.yml | 269 ++++++++++++++++++ apps/desktop/package.json | 2 +- apps/server/package.json | 2 +- apps/web/package.json | 2 +- .../web/src/components/ServerUpdateAction.tsx | 21 +- apps/web/src/versionSkew.test.ts | 20 +- apps/web/src/versionSkew.ts | 27 +- docs/README.md | 1 + docs/operations/fork-release.md | 79 +++++ docs/operations/release.md | 3 +- packages/contracts/package.json | 2 +- packages/shared/src/cliRelease.test.ts | 15 +- packages/shared/src/cliRelease.ts | 8 +- scripts/install.sh | 5 +- scripts/install.test.ts | 7 +- 15 files changed, 410 insertions(+), 53 deletions(-) create mode 100644 .github/workflows/fork-release.yml create mode 100644 docs/operations/fork-release.md diff --git a/.github/workflows/fork-release.yml b/.github/workflows/fork-release.yml new file mode 100644 index 0000000000000..e46c99b622d8f --- /dev/null +++ b/.github/workflows/fork-release.yml @@ -0,0 +1,269 @@ +name: Fork Release + +# Publishes this fork's server as the self-contained CLI archives that the +# desktop app's SSH launcher, `t3 service` self-update, `t3 update` and +# scripts/install.sh download (see packages/shared/src/cliRelease.ts). It runs +# the same build scripts as release.yml's cli_archive jobs on GitHub-hosted +# runners, without signing, npm, relay, web, or desktop installers. +# See docs/operations/fork-release.md. + +on: + push: + tags: + - "v*-grant.*" + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: fork-release-${{ github.ref }} + cancel-in-progress: false + +jobs: + preflight: + name: Preflight + if: github.repository != 'pingdotgg/t3code' + runs-on: ubuntu-24.04 + timeout-minutes: 5 + outputs: + version: ${{ steps.meta.outputs.version }} + clerk_publishable_key: ${{ steps.meta.outputs.clerk_publishable_key }} + clerk_jwt_template: ${{ steps.meta.outputs.clerk_jwt_template }} + clerk_cli_oauth_client_id: ${{ steps.meta.outputs.clerk_cli_oauth_client_id }} + relay_url: ${{ steps.meta.outputs.relay_url }} + steps: + - name: Checkout + uses: actions/checkout@v6 + with: + sparse-checkout: | + /* + !/.repos/ + sparse-checkout-cone-mode: false + + # The version comes from the committed package.json files, so a desktop app + # built locally from this commit asks remote hosts for exactly this release. + - id: meta + name: Resolve version + env: + GH_TOKEN: ${{ github.token }} + run: | + set -euo pipefail + version="$(jq -r .version apps/server/package.json)" + if [[ ! "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+-grant\.[0-9]+$ ]]; then + echo "::error::apps/server/package.json version '$version' is not -grant.." >&2 + exit 1 + fi + for file in apps/desktop/package.json apps/web/package.json packages/contracts/package.json; do + if [[ "$(jq -r .version "$file")" != "$version" ]]; then + echo "::error::$file does not have version $version." >&2 + exit 1 + fi + done + if [[ "$GITHUB_REF_TYPE" == tag && "$GITHUB_REF_NAME" != "v$version" ]]; then + echo "::error::Tag $GITHUB_REF_NAME does not match package version $version." >&2 + exit 1 + fi + if gh release view "v$version" --repo "$GITHUB_REPOSITORY" >/dev/null 2>&1; then + echo "::error::Release v$version already exists; bump the version." >&2 + exit 1 + fi + # The same public T3 Connect identifiers release.yml's preview builds use. + env_example() { sed -n "s|^T3CODE_$1=||p" .env.example; } + { + echo "version=$version" + echo "clerk_publishable_key=$(env_example CLERK_PUBLISHABLE_KEY)" + echo "clerk_jwt_template=$(env_example CLERK_JWT_TEMPLATE)" + echo "clerk_cli_oauth_client_id=$(env_example CLERK_CLI_OAUTH_CLIENT_ID)" + echo "relay_url=$(env_example RELAY_URL)" + } >> "$GITHUB_OUTPUT" + + # Mirrors release.yml's build_bundle: the server bundle and web client, built once. + build_bundle: + name: Build JS bundle + needs: [preflight] + runs-on: ubuntu-24.04 + timeout-minutes: 30 + env: + T3CODE_CLERK_PUBLISHABLE_KEY: ${{ needs.preflight.outputs.clerk_publishable_key }} + T3CODE_CLERK_JWT_TEMPLATE: ${{ needs.preflight.outputs.clerk_jwt_template }} + T3CODE_CLERK_CLI_OAUTH_CLIENT_ID: ${{ needs.preflight.outputs.clerk_cli_oauth_client_id }} + T3CODE_RELAY_URL: ${{ needs.preflight.outputs.relay_url }} + T3CODE_TELEMETRY_CHANNEL: dev + steps: + - name: Checkout + uses: actions/checkout@v6 + with: + sparse-checkout: | + /* + !/.repos/ + sparse-checkout-cone-mode: false + + - name: Setup dependencies + uses: ./.github/actions/setup-ci-deps + with: + install-args: --filter=t3... --filter=@t3tools/web... --filter=@t3tools/desktop... --filter=@t3tools/scripts... + + - name: Align package versions to release version + run: node scripts/update-release-package-versions.ts "${{ needs.preflight.outputs.version }}" + + - name: Build JS bundle + run: vp run build:desktop:bundle + + - name: Upload JS bundle + uses: actions/upload-artifact@v7 + with: + name: js-bundle + path: | + apps/server/dist + apps/desktop/dist-electron + if-no-files-found: error + retention-days: 1 + + # The cli_archive steps of release-desktop.yml, without signing or the desktop app. + cli_archive: + name: CLI ${{ matrix.resource_key }} + needs: [preflight, build_bundle] + runs-on: ${{ matrix.runner }} + timeout-minutes: 60 + strategy: + fail-fast: false + matrix: + include: + - runner: ubuntu-24.04 + platform: linux + arch: x64 + rust_target: x86_64-unknown-linux-gnu + resource_key: linux-x64 + - runner: ubuntu-24.04-arm + platform: linux + arch: arm64 + rust_target: aarch64-unknown-linux-gnu + resource_key: linux-arm64 + - runner: macos-15 + platform: mac + arch: arm64 + rust_target: aarch64-apple-darwin + resource_key: darwin-arm64 + env: + VERSION: ${{ needs.preflight.outputs.version }} + T3CODE_CLERK_PUBLISHABLE_KEY: ${{ needs.preflight.outputs.clerk_publishable_key }} + T3CODE_CLERK_JWT_TEMPLATE: ${{ needs.preflight.outputs.clerk_jwt_template }} + T3CODE_CLERK_CLI_OAUTH_CLIENT_ID: ${{ needs.preflight.outputs.clerk_cli_oauth_client_id }} + T3CODE_RELAY_URL: ${{ needs.preflight.outputs.relay_url }} + T3CODE_TELEMETRY_CHANNEL: dev + steps: + - name: Checkout + uses: actions/checkout@v6 + with: + sparse-checkout: | + /* + !/.repos/ + sparse-checkout-cone-mode: false + + - name: Setup dependencies + uses: ./.github/actions/setup-ci-deps + with: + install-args: --filter=@t3tools/desktop... --filter=t3... --filter=@t3tools/scripts... + + - name: Align package versions to release version + run: node scripts/update-release-package-versions.ts "$VERSION" + + - name: Download JS bundle + uses: actions/download-artifact@v8 + with: + name: js-bundle + path: apps + + - name: Setup Rust + uses: dtolnay/rust-toolchain@6bed0761d98439e5a578e2877258200ad565ba87 # stable + with: + toolchain: stable + targets: ${{ matrix.rust_target }} + + - name: Build resource monitor + run: cargo build --locked --release --manifest-path native/resource-monitor/Cargo.toml --target "${{ matrix.rust_target }}" + + - name: Apply web client branding + run: node scripts/apply-web-brand-assets.ts production apps/server/dist/client + + - name: Build CLI single-executable + run: node apps/server/scripts/cli.ts build-exe --verbose + + - name: Stage resource monitor for the CLI archive + run: | + set -euo pipefail + target_dir="$RUNNER_TEMP/cli-resource-monitor/${{ matrix.resource_key }}" + mkdir -p "$target_dir" + cp "native/resource-monitor/target/${{ matrix.rust_target }}/release/t3-resource-monitor" "$target_dir/" + + # The Linux archive ships libatomic.so.1 and points t3's RUNPATH at it. + - name: Install patchelf + if: matrix.platform == 'linux' + run: command -v patchelf || { sudo apt-get update && sudo apt-get install -y patchelf; } + + # Without a signing identity the macOS executable is signed ad hoc. + - name: Build CLI archive + run: | + node scripts/build-cli-archive.ts \ + --platform "${{ matrix.platform }}" \ + --arch "${{ matrix.arch }}" \ + --version "$VERSION" \ + --resource-monitor-dir "$RUNNER_TEMP/cli-resource-monitor" \ + --output-dir release-cli + + - name: Smoke-test CLI archive + run: node scripts/smoke-cli-archive.ts --archive release-cli/* --expect-version "$VERSION" + + - name: Upload CLI archive + uses: actions/upload-artifact@v7 + with: + name: cli-${{ matrix.resource_key }} + path: release-cli/* + if-no-files-found: error + compression-level: 0 + + release: + name: Publish GitHub Release + needs: [preflight, cli_archive] + runs-on: ubuntu-24.04 + timeout-minutes: 10 + permissions: + contents: write + env: + VERSION: ${{ needs.preflight.outputs.version }} + GH_TOKEN: ${{ github.token }} + steps: + - name: Download CLI archives + uses: actions/download-artifact@v8 + with: + pattern: cli-* + merge-multiple: true + path: release-assets + + # The format scripts/install.sh, pinnedRuntime.ts and the SSH runner verify against. + - name: Write SHA256SUMS + working-directory: release-assets + run: | + set -euo pipefail + shopt -s nullglob + archives=(t3-"$VERSION"-*.tar.gz) + if (( ${#archives[@]} != 3 )); then + echo "::error::Expected 3 CLI archives, found ${#archives[@]}." >&2 + ls -la + exit 1 + fi + sha256sum "${archives[@]}" > SHA256SUMS + cat SHA256SUMS + + # Marked latest and not a prerelease: scripts/install.sh resolves the + # stable track through /releases/latest. + - name: Publish release + run: | + set -euo pipefail + gh release create "v$VERSION" release-assets/* \ + --repo "$GITHUB_REPOSITORY" \ + --target "$GITHUB_SHA" \ + --title "T3 Code v$VERSION" \ + --notes "Server build of the greaber/t3code fork at ${GITHUB_SHA::10}. Install the desktop app from a local build of the same commit." \ + --latest diff --git a/apps/desktop/package.json b/apps/desktop/package.json index ab4e1ed382dab..066f2cc729ff2 100644 --- a/apps/desktop/package.json +++ b/apps/desktop/package.json @@ -1,6 +1,6 @@ { "name": "@t3tools/desktop", - "version": "0.1.8", + "version": "0.1.9-grant.1", "private": true, "type": "module", "main": "dist-electron/boot.cjs", diff --git a/apps/server/package.json b/apps/server/package.json index d7e4d21f08b82..78c5d34e13aa6 100644 --- a/apps/server/package.json +++ b/apps/server/package.json @@ -1,6 +1,6 @@ { "name": "t3", - "version": "0.1.8", + "version": "0.1.9-grant.1", "license": "MIT", "repository": { "type": "git", diff --git a/apps/web/package.json b/apps/web/package.json index e42f4e3bcc61b..a7a2b2b9152f7 100644 --- a/apps/web/package.json +++ b/apps/web/package.json @@ -1,6 +1,6 @@ { "name": "@t3tools/web", - "version": "0.1.8", + "version": "0.1.9-grant.1", "private": true, "type": "module", "scripts": { diff --git a/apps/web/src/components/ServerUpdateAction.tsx b/apps/web/src/components/ServerUpdateAction.tsx index 14e0dd3c192cb..d4e5bb6e9c74f 100644 --- a/apps/web/src/components/ServerUpdateAction.tsx +++ b/apps/web/src/components/ServerUpdateAction.tsx @@ -260,7 +260,6 @@ export function ServerUpdateAction({ environmentId, serverLabel, selfUpdate, - installation, desktopAppUpdate = false, targetVersion, channel, @@ -277,16 +276,12 @@ export function ServerUpdateAction({ const updatesDenial = managedUpdatesDenial(useManagedPolicy(environmentId)); const update = useServerUpdate(); const { copyToClipboard } = useCopyToClipboard<{ command: string }>({ - target: installation?.kind === "npm-global" ? "update command" : "relaunch command", + target: "update command", onCopy: ({ command }) => { toastManager.add({ type: "success", - title: - installation?.kind === "npm-global" ? "Update command copied" : "Relaunch command copied", - description: - installation?.kind === "npm-global" - ? `Run \`${command}\` on ${serverLabel}, then restart t3 with your usual options.` - : `Stop t3 on ${serverLabel}, then relaunch with \`${command}\` using the same subcommand and options. This does not update an installed t3 command.`, + title: "Update command copied", + description: `Run \`${command}\` on ${serverLabel}, then restart t3 with your usual options.`, }); }, onError: (error) => { @@ -349,14 +344,8 @@ export function ServerUpdateAction({ return ; } - const manualCommand = - selfUpdate === null ? manualServerUpdateCommand(targetVersion, installation) : null; - const actionLabel = - manualCommand !== null - ? installation?.kind === "npm-global" - ? "Copy update command" - : "Copy relaunch command" - : label; + const manualCommand = selfUpdate === null ? manualServerUpdateCommand(targetVersion) : null; + const actionLabel = manualCommand !== null ? "Copy update command" : label; const onClick = manualCommand !== null ? () => copyToClipboard(manualCommand, { command: manualCommand }) diff --git a/apps/web/src/versionSkew.test.ts b/apps/web/src/versionSkew.test.ts index 627b974177392..fe3ef16229cbe 100644 --- a/apps/web/src/versionSkew.test.ts +++ b/apps/web/src/versionSkew.test.ts @@ -20,13 +20,10 @@ const MISMATCH_HINT = "Version mismatch. Try syncing the client and server to the same T3 Code version."; describe("versionSkew", () => { - it("updates only the proven npm prefix and safely quotes its path", () => { - expect(manualServerUpdateCommand("0.0.45", { kind: "npm-global", prefix: "/opt/node" })).toBe( - "npm install --global --prefix '/opt/node' t3@0.0.45", + it("installs this fork's release from its own tag, since it is not on npm", () => { + expect(manualServerUpdateCommand("0.1.9-grant.1")).toBe( + "curl -fsSL https://raw.githubusercontent.com/greaber/t3code/v0.1.9-grant.1/scripts/install.sh | T3CODE_VERSION=0.1.9-grant.1 sh", ); - expect( - manualServerUpdateCommand("0.0.45", { kind: "npm-global", prefix: "/opt/maria's node" }), - ).toBe("npm install --global --prefix '/opt/maria'\\''s node' t3@0.0.45"); }); beforeEach(() => { branding.APP_VERSION = "0.0.34"; @@ -86,6 +83,17 @@ describe("versionSkew", () => { ); // regression: #7579 versions were compared as strings, not semver + it("warns when a fork server is behind a newer fork build of the same core version", () => { + branding.APP_VERSION = "0.1.9-grant.2"; + expect(resolveVersionMismatch("0.1.9-grant.1")).toEqual({ + clientVersion: "0.1.9-grant.2", + serverVersion: "0.1.9-grant.1", + hint: MISMATCH_HINT, + }); + expect(resolveVersionMismatch("0.1.9-grant.2")).toBeNull(); + expect(resolveVersionMismatch("0.1.7")).not.toBeNull(); + }); + it("treats a nightly server built past the client as ahead, not skew", () => { expect(resolveVersionMismatch("0.0.35-nightly.20260818.1124")).toBeNull(); }); diff --git a/apps/web/src/versionSkew.ts b/apps/web/src/versionSkew.ts index 321e712f8a124..a194597ae15d4 100644 --- a/apps/web/src/versionSkew.ts +++ b/apps/web/src/versionSkew.ts @@ -1,10 +1,6 @@ -import type { - EnvironmentId, - ServerConfig, - ServerInstallation, - ServerSelfUpdateCapability, -} from "@t3tools/contracts"; +import type { EnvironmentId, ServerConfig, ServerSelfUpdateCapability } from "@t3tools/contracts"; import type { ServerUpdateState } from "@t3tools/client-runtime/state/server"; +import { cliInstallScriptCommand } from "@t3tools/shared/cliRelease"; import { compareSemverVersions, parseSemver } from "@t3tools/shared/semver"; import * as Schema from "effect/Schema"; @@ -56,9 +52,11 @@ export function resolveVersionMismatch( const clientCore = versionCore(normalizedClientVersion); const serverCore = versionCore(normalizedServerVersion); + // Builds of one prerelease track (nightly, or this fork's `grant`) share a core version. + const clientTrack = parseSemver(normalizedClientVersion)?.prerelease[0]; const compareNightlyBuilds = - parseSemver(normalizedClientVersion)?.prerelease[0] === "nightly" && - parseSemver(normalizedServerVersion)?.prerelease[0] === "nightly"; + (clientTrack === "nightly" || clientTrack === "grant") && + parseSemver(normalizedServerVersion)?.prerelease[0] === clientTrack; const serverIsBehind = parseSemver(clientCore) && parseSemver(serverCore) ? compareSemverVersions( @@ -95,17 +93,8 @@ export function supportsDesktopAppUpdate( return serverConfig?.environment.capabilities.desktopAppUpdate === true; } -export function manualServerUpdateCommand( - targetVersion: string, - installation?: ServerInstallation, -): string { - if (installation?.kind === "npm-global") { - const prefix = `'${installation.prefix.replaceAll("'", "'\\''")}'`; - return `npm install --global --prefix ${prefix} t3@${targetVersion}`; - } - const runner = - installation?.kind === "pnpm-dlx" ? "pnpm dlx" : installation?.kind === "bunx" ? "bunx" : "npx"; - return `${runner} t3@${targetVersion}`; +export function manualServerUpdateCommand(targetVersion: string): string { + return cliInstallScriptCommand(targetVersion); } export function buildVersionMismatchDismissalKey( diff --git a/docs/README.md b/docs/README.md index 264d509d97642..291a0cadff255 100644 --- a/docs/README.md +++ b/docs/README.md @@ -68,6 +68,7 @@ source alone does not explain. Most code changes do not need an internal documen - [Scenarios: real-app proof for a fix](./operations/scenarios.md) - [T3 Connect setup](./operations/connect-setup.md) - [Release](./operations/release.md) +- [Fork releases (greaber/t3code)](./operations/fork-release.md) - [Observability](./operations/observability.md) - [Relay observability](./operations/relay-observability.md) - [Mobile app store screenshots](./operations/mobile-app-store-screenshots.md) diff --git a/docs/operations/fork-release.md b/docs/operations/fork-release.md new file mode 100644 index 0000000000000..f5a1bd7ba8d55 --- /dev/null +++ b/docs/operations/fork-release.md @@ -0,0 +1,79 @@ +# Fork releases (greaber/t3code) + +> For this fork's maintainer. Upstream's process is in [Release](./release.md). + +This fork publishes its own server builds so every machine runs the fork, not upstream. The +desktop app, `t3 service` self-update, `t3 update`, and `scripts/install.sh` all download from +`https://github.com/greaber/t3code/releases` (`CLI_RELEASE_REPOSITORY` in +`packages/shared/src/cliRelease.ts`). `T3CODE_RELEASE_BASE_URL` still overrides it. + +## Versions + +Fork versions are `-grant.`, for example `0.1.9-grant.1`: + +- The core is the upstream release the base's nightlies preview (`0.1.9` while upstream ships + `0.1.9-nightly.*`). It sorts above every upstream release the fork already contains, so hosts on + those versions are offered an update. +- The `-grant.` suffix keeps the version from colliding with an upstream build. Installed + runtimes are cached by version in `~/.t3/runtime/versions/`, so a shared version would + be taken as already installed. +- Grant builds are the fork's stable track: `cliReleaseChannelOf` reads only `-nightly.` and + `-preview.` as other tracks, and the version-skew check compares full versions between two grant + builds, so `-grant.2` offers an update to a host on `-grant.1`. + +To bump, edit the version in `apps/server/package.json`, `apps/desktop/package.json`, +`apps/web/package.json`, and `packages/contracts/package.json` (or run +`node scripts/update-release-package-versions.ts `). Increment `` for each fork +release; after rebasing onto upstream commits past a new upstream release, move the core to the +next upstream version and restart at `-grant.1`. The desktop app asks remote hosts for its own +version, so build the desktop app from the same commit as the release. + +## Cutting a release + +1. Commit the version bump and push the branch. +2. Tag and push: `git tag v && git push greaber v`. Pushing the tag runs + `.github/workflows/fork-release.yml`. Running the workflow by hand + (`gh workflow run fork-release.yml --ref -R greaber/t3code`) releases the branch tip + and creates the tag. +3. The workflow checks that the tag matches every package version, builds the JS bundle once, then + builds and smoke-tests the CLI archives for `linux-x64`, `linux-arm64`, and `darwin-arm64` with + the same scripts as upstream's `cli_archive` jobs (unsigned; macOS is signed ad hoc). It + publishes release `v` with the archives and `SHA256SUMS`, marked latest. + +Upstream's `release.yml` also matches the tag, but its jobs are gated on `pingdotgg/t3code` and +skip. + +## Desktop app + +The workflow does not build the desktop app. Build it on the Mac from the release commit: + +```bash +vp run dist:desktop:dmg:arm64 +``` + +The DMG lands in `release/`. A local build has no update feed, so the app's own auto-update is +off; install each new build by hand. + +## Moving a host to the fork + +A host whose service runs an upstream build downloads updates from upstream until told otherwise. +Once, on that host (Linux, systemd user service): + +```bash +systemctl --user edit t3code.service +# add: +# [Service] +# Environment=T3CODE_RELEASE_BASE_URL=https://github.com/greaber/t3code/releases/download +systemctl --user restart t3code.service +``` + +Then click **Update** for that host in the desktop app. After it runs a fork build, the fork's +default points at this repository and the override can be removed. + +On a new host, either connect over SSH from the desktop app, which installs its own version from +this repository, or install the service: + +```bash +curl -fsSL https://raw.githubusercontent.com/greaber/t3code/v/scripts/install.sh | sh +~/.local/bin/t3 service install +``` diff --git a/docs/operations/release.md b/docs/operations/release.md index be74b2ad2982e..7cbad81938465 100644 --- a/docs/operations/release.md +++ b/docs/operations/release.md @@ -1,6 +1,7 @@ # Release Checklist -> For maintainers. Using T3 Code? See [docs/user](../user/). +> For maintainers. Using T3 Code? See [docs/user](../user/). This fork releases with +> [Fork releases](./fork-release.md) instead. This document covers the unified release workflow for stable and nightly desktop releases. diff --git a/packages/contracts/package.json b/packages/contracts/package.json index 171a88d1e5082..f83bdac98b21d 100644 --- a/packages/contracts/package.json +++ b/packages/contracts/package.json @@ -1,6 +1,6 @@ { "name": "@t3tools/contracts", - "version": "0.1.8", + "version": "0.1.9-grant.1", "private": true, "files": [ "dist" diff --git a/packages/shared/src/cliRelease.test.ts b/packages/shared/src/cliRelease.test.ts index b0aa61765e45a..5b0de7e356bd4 100644 --- a/packages/shared/src/cliRelease.test.ts +++ b/packages/shared/src/cliRelease.test.ts @@ -1,6 +1,11 @@ import { describe, expect, it } from "vite-plus/test"; -import { cliArchiveTarCommand, newestCliReleaseVersion, parseChecksums } from "./cliRelease.ts"; +import { + cliArchiveTarCommand, + crossesReleaseTrack, + newestCliReleaseVersion, + parseChecksums, +} from "./cliRelease.ts"; describe("cliRelease", () => { it("parses sha256sum output including binary-mode markers", () => { @@ -39,4 +44,12 @@ describe("cliRelease", () => { expect(newestCliReleaseVersion(releases, "stable")).toBe("1.2.3"); expect(newestCliReleaseVersion([{ tag_name: "v1.2.3" }], "preview")).toBeUndefined(); }); + + it("treats this fork's grant builds as the stable track", () => { + expect(newestCliReleaseVersion([{ tag_name: "v0.1.9-grant.2" }], "stable")).toBe( + "0.1.9-grant.2", + ); + expect(crossesReleaseTrack("0.1.7", "0.1.9-grant.1")).toBe(false); + expect(crossesReleaseTrack("0.1.9-grant.1", "0.1.9-grant.2")).toBe(false); + }); }); diff --git a/packages/shared/src/cliRelease.ts b/packages/shared/src/cliRelease.ts index 07a0c73b17947..ecd63eef7eb39 100644 --- a/packages/shared/src/cliRelease.ts +++ b/packages/shared/src/cliRelease.ts @@ -3,7 +3,8 @@ import * as Schema from "effect/Schema"; import { compareSemverVersions } from "./semver.ts"; -const CLI_RELEASE_REPOSITORY = "pingdotgg/t3code"; +// This fork publishes its own server archives; see docs/operations/fork-release.md. +const CLI_RELEASE_REPOSITORY = "greaber/t3code"; export const CLI_RELEASES_PAGE_URL = `https://github.com/${CLI_RELEASE_REPOSITORY}/releases`; export const CLI_RELEASE_CHECKSUMS_FILE = "SHA256SUMS"; export const CLI_RELEASE_BASE_URL_ENV = "T3CODE_RELEASE_BASE_URL"; @@ -42,6 +43,11 @@ export function cliArchiveFileName(version: string, platformKey: CliArchivePlatf return `t3-${version}-${platformKey}.${platformKey.startsWith("win32") ? "zip" : "tar.gz"}`; } +/** Installs `version` from its own tag's install script; this fork's builds are not on npm. */ +export function cliInstallScriptCommand(version: string): string { + return `curl -fsSL https://raw.githubusercontent.com/${CLI_RELEASE_REPOSITORY}/v${version}/scripts/install.sh | T3CODE_VERSION=${version} sh`; +} + const CLI_RELEASE_DEFAULT_BASE_URL = `https://github.com/${CLI_RELEASE_REPOSITORY}/releases/download`; export function cliReleaseDownloadBaseUrl( diff --git a/scripts/install.sh b/scripts/install.sh index 46df9a715eb8e..aa81607f2a177 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -17,7 +17,7 @@ # instead of fetching the release again. set -eu -repo="pingdotgg/t3code" +repo="greaber/t3code" base_url="${T3CODE_RELEASE_BASE_URL:-https://github.com/${repo}/releases/download}" t3_home="${T3CODE_HOME:-$HOME/.t3}" case "$t3_home" in @@ -186,7 +186,8 @@ channel="${T3CODE_CHANNEL:-stable}" version="${T3CODE_VERSION:-}" if [ -z "$version" ]; then case "$channel" in - stable) tag_pattern='v\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\)' ;; + # This fork's releases carry a -grant.N suffix and are its stable track. + stable) tag_pattern='v\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\(-grant\.[0-9][0-9]*\)\{0,1\}\)' ;; nightly | preview) tag_pattern="v\([0-9][^\"]*-${channel}\.[0-9]*\.[0-9]*\)" ;; *) fail "T3CODE_CHANNEL must be stable, nightly, or preview" ;; esac diff --git a/scripts/install.test.ts b/scripts/install.test.ts index ec4212a89ec5e..6db5ddf47158f 100644 --- a/scripts/install.test.ts +++ b/scripts/install.test.ts @@ -65,6 +65,7 @@ describe.skipIf(HostProcess.Platform.defaultValue() !== "linux")("installer chan it.each([ // regression: #32897 ["stable", "1.2.3", 1], + ["stable", "1.2.3-grant.2", 0], ["preview", "1.2.4-preview.20261019.50", 0], ])("finds %s %s behind nightlies and %i HTTP 504s", async (channel, version, failures) => { const root = await NodeFSP.mkdtemp(NodePath.join(NodeOS.tmpdir(), "t3-install-index-")); @@ -73,10 +74,10 @@ describe.skipIf(HostProcess.Platform.defaultValue() !== "linux")("installer chan if (failures-- > 0) return response.writeHead(504).end(); const url = new URL(request.url ?? "/", "http://fixture"); const body = - url.pathname === "/pingdotgg/t3code/releases/latest" && + url.pathname === "/greaber/t3code/releases/latest" && request.headers.accept === "application/json" - ? { tag_name: "v1.2.3" } - : url.pathname === "/repos/pingdotgg/t3code/releases" + ? { tag_name: channel === "stable" ? `v${version}` : "v1.2.3" } + : url.pathname === "/repos/greaber/t3code/releases" ? { "1": nightlies, "2": [{ tag_name: `v${version}` }, { tag_name: "v1.2.3" }] }[ url.searchParams.get("page") ?? "" ] From f51cfc55336e3b33079547271ffde573ce13e2a3 Mon Sep 17 00:00:00 2001 From: Grant Reaber Date: Wed, 11 Nov 2026 13:19:57 +0100 Subject: [PATCH 2/2] fix(release): pin fork releases to their tag and point install hints at the fork - fork-release.yml refuses to publish when tag v already exists on a different commit, so a manual run from a branch that moved on cannot attach archives that do not match the tag. - The service preflight's install hint and `t3 pair`'s protocol mismatch hint use the fork's install script; grant versions are not on t3.codes or npm. - The manual update toast says to start ~/.local/bin/t3, since an npm global t3 earlier on PATH would otherwise run. The installation prop that only chose between npm and npx wording is gone. - Move the grant version-skew test off the #7579 regression comment, and note in the fork release docs that upstream Blacksmith workflows should be disabled in the fork's Actions settings. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/fork-release.yml | 7 +++++++ apps/server/src/cli/pair.test.ts | 5 ++++- apps/server/src/cli/pair.ts | 3 ++- apps/server/src/cloud/servicePreflight.test.ts | 4 +++- apps/server/src/cloud/servicePreflight.ts | 4 +++- apps/web/src/components/ServerUpdateAction.tsx | 4 +--- .../web/src/components/chat/useAutoBalanceUpdateBanner.tsx | 1 - apps/web/src/components/chat/useSystemComposerBanners.tsx | 2 -- apps/web/src/components/settings/ConnectionsSettings.tsx | 4 ---- apps/web/src/components/settings/SavedEnvironmentRows.tsx | 1 - apps/web/src/components/sidebar/updateEverything.logic.ts | 2 -- apps/web/src/versionSkew.test.ts | 2 +- docs/operations/fork-release.md | 4 +++- 13 files changed, 24 insertions(+), 19 deletions(-) diff --git a/.github/workflows/fork-release.yml b/.github/workflows/fork-release.yml index e46c99b622d8f..12768c271ccac 100644 --- a/.github/workflows/fork-release.yml +++ b/.github/workflows/fork-release.yml @@ -64,6 +64,13 @@ jobs: echo "::error::Tag $GITHUB_REF_NAME does not match package version $version." >&2 exit 1 fi + # A manual run from a branch that moved past an existing tag must not + # publish archives built from a different commit than the tag names. + tag_sha="$(gh api "repos/$GITHUB_REPOSITORY/commits/refs/tags/v$version" --jq .sha 2>/dev/null || true)" + if [[ -n "$tag_sha" && "$tag_sha" != "$GITHUB_SHA" ]]; then + echo "::error::Tag v$version points at $tag_sha, not $GITHUB_SHA." >&2 + exit 1 + fi if gh release view "v$version" --repo "$GITHUB_REPOSITORY" >/dev/null 2>&1; then echo "::error::Release v$version already exists; bump the version." >&2 exit 1 diff --git a/apps/server/src/cli/pair.test.ts b/apps/server/src/cli/pair.test.ts index e626461914a06..09f677ca2a056 100644 --- a/apps/server/src/cli/pair.test.ts +++ b/apps/server/src/cli/pair.test.ts @@ -409,7 +409,10 @@ describe("t3 pair", () => { ]); assert.isTrue(Exit.isFailure(exit)); if (Exit.isFailure(exit)) { - assert.include(String(Cause.squash(exit.cause)), "t3@0.0.45 pair"); + assert.include( + String(Cause.squash(exit.cause)), + "greaber/t3code/v0.0.45/scripts/install.sh | T3CODE_VERSION=0.0.45 sh", + ); } }), "127.0.0.1", diff --git a/apps/server/src/cli/pair.ts b/apps/server/src/cli/pair.ts index 904182ad29c6b..f91d63601d7b3 100644 --- a/apps/server/src/cli/pair.ts +++ b/apps/server/src/cli/pair.ts @@ -5,6 +5,7 @@ import { ORCHESTRATION_PROTOCOL_VERSION, PortSchema, } from "@t3tools/contracts"; +import { cliInstallScriptCommand } from "@t3tools/shared/cliRelease"; import { resolveWorktreeT3Home } from "@t3tools/shared/devHome"; import * as HostProcess from "@t3tools/shared/HostProcess"; import { DEFAULT_SIGNAL_EXPORT } from "@t3tools/shared/observability"; @@ -89,7 +90,7 @@ export class IncompatibleServerProtocolError extends Schema.TaggedError { diff --git a/apps/web/src/components/chat/useAutoBalanceUpdateBanner.tsx b/apps/web/src/components/chat/useAutoBalanceUpdateBanner.tsx index 60f93aa54b965..eae37769f66ec 100644 --- a/apps/web/src/components/chat/useAutoBalanceUpdateBanner.tsx +++ b/apps/web/src/components/chat/useAutoBalanceUpdateBanner.tsx @@ -60,7 +60,6 @@ export function useAutoBalanceUpdateBanner( environmentId: environment.environmentId, serverLabel: environment.label, selfUpdate, - installation: environment.serverConfig?.environment.capabilities.serverInstallation, desktopAppUpdate, targetVersion: state.status === "idle" ? mismatch!.clientVersion : state.targetVersion, connected: environment.connection.phase === "connected", diff --git a/apps/web/src/components/chat/useSystemComposerBanners.tsx b/apps/web/src/components/chat/useSystemComposerBanners.tsx index f172f9e4b7fbc..58c202ae237c7 100644 --- a/apps/web/src/components/chat/useSystemComposerBanners.tsx +++ b/apps/web/src/components/chat/useSystemComposerBanners.tsx @@ -142,7 +142,6 @@ export function useSystemComposerBanners(input: SystemComposerBannersInput) { : "server"; const serverUpdateEnvironmentId = activeThreadEnvironmentId; const versionMismatchSelfUpdate = resolveServerSelfUpdateCapability(serverConfig); - const versionMismatchInstallation = serverConfig?.environment.capabilities.serverInstallation; const versionMismatchDesktopAppUpdate = supportsDesktopAppUpdate(serverConfig); const serverUpdateState = useAtomValue( serverEnvironment.updateStateAtom(serverUpdateEnvironmentId), @@ -241,7 +240,6 @@ export function useSystemComposerBanners(input: SystemComposerBannersInput) { environmentId={serverUpdateEnvironmentId} serverLabel={versionMismatchServerLabel} selfUpdate={versionMismatchSelfUpdate} - installation={versionMismatchInstallation} desktopAppUpdate={versionMismatchDesktopAppUpdate} targetVersion={versionMismatch.clientVersion} label="Retry" diff --git a/apps/web/src/components/settings/ConnectionsSettings.tsx b/apps/web/src/components/settings/ConnectionsSettings.tsx index da46823292cad..8d8c6573997d8 100644 --- a/apps/web/src/components/settings/ConnectionsSettings.tsx +++ b/apps/web/src/components/settings/ConnectionsSettings.tsx @@ -297,7 +297,6 @@ function ConnectionsSettingsContent({ environmentId: environment.environmentId, serverLabel: environment.label, selfUpdate, - installation: environment.serverConfig?.environment.capabilities.serverInstallation, desktopAppUpdate, targetVersion: mismatch.clientVersion, }, @@ -1205,9 +1204,6 @@ function ConnectionsSettingsContent({ primaryEnvironment ? `${primaryEnvironment.label} server` : "server" } selfUpdate={resolveServerSelfUpdateCapability(primaryServerConfig)} - installation={ - primaryServerConfig?.environment.capabilities.serverInstallation - } desktopAppUpdate={supportsDesktopAppUpdate(primaryServerConfig)} targetVersion={primaryVersionMismatch.clientVersion} label={ diff --git a/apps/web/src/components/settings/SavedEnvironmentRows.tsx b/apps/web/src/components/settings/SavedEnvironmentRows.tsx index 866841b4bc6b7..f88d7fe91c155 100644 --- a/apps/web/src/components/settings/SavedEnvironmentRows.tsx +++ b/apps/web/src/components/settings/SavedEnvironmentRows.tsx @@ -372,7 +372,6 @@ export function SavedBackendListRow({ environmentId={environmentId} serverLabel={`${environment.label} server`} selfUpdate={resolveServerSelfUpdateCapability(environment.serverConfig)} - installation={environment.serverConfig?.environment.capabilities.serverInstallation} desktopAppUpdate={supportsDesktopAppUpdate(environment.serverConfig)} targetVersion={versionMismatch.clientVersion} label={serverUpdateState.status === "failed" ? "Retry update" : "Update"} diff --git a/apps/web/src/components/sidebar/updateEverything.logic.ts b/apps/web/src/components/sidebar/updateEverything.logic.ts index cbbd3baa7c776..ccf0278120725 100644 --- a/apps/web/src/components/sidebar/updateEverything.logic.ts +++ b/apps/web/src/components/sidebar/updateEverything.logic.ts @@ -124,7 +124,6 @@ export function collectServerUpdateTargets( environmentId: machine.environmentId, serverLabel: machine.label, selfUpdate, - installation: config.environment.capabilities.serverInstallation, desktopAppUpdate, targetVersion, }; @@ -241,7 +240,6 @@ export function collectChannelSwitchTargets( environmentId: machine.environmentId, serverLabel: machine.label, selfUpdate, - installation: config?.environment.capabilities.serverInstallation, desktopAppUpdate: config !== null && supportsDesktopAppUpdate(config), targetVersion, ...(selfUpdate === "desktop-managed" ? { channel: release.channel } : {}), diff --git a/apps/web/src/versionSkew.test.ts b/apps/web/src/versionSkew.test.ts index fe3ef16229cbe..a246d97fb3208 100644 --- a/apps/web/src/versionSkew.test.ts +++ b/apps/web/src/versionSkew.test.ts @@ -82,7 +82,6 @@ describe("versionSkew", () => { }, ); - // regression: #7579 versions were compared as strings, not semver it("warns when a fork server is behind a newer fork build of the same core version", () => { branding.APP_VERSION = "0.1.9-grant.2"; expect(resolveVersionMismatch("0.1.9-grant.1")).toEqual({ @@ -94,6 +93,7 @@ describe("versionSkew", () => { expect(resolveVersionMismatch("0.1.7")).not.toBeNull(); }); + // regression: #7579 versions were compared as strings, not semver it("treats a nightly server built past the client as ahead, not skew", () => { expect(resolveVersionMismatch("0.0.35-nightly.20260818.1124")).toBeNull(); }); diff --git a/docs/operations/fork-release.md b/docs/operations/fork-release.md index f5a1bd7ba8d55..64368fc658575 100644 --- a/docs/operations/fork-release.md +++ b/docs/operations/fork-release.md @@ -41,7 +41,9 @@ version, so build the desktop app from the same commit as the release. publishes release `v` with the archives and `SHA256SUMS`, marked latest. Upstream's `release.yml` also matches the tag, but its jobs are gated on `pingdotgg/t3code` and -skip. +skip. Upstream workflows that run on Blacksmith runners without such a gate (`ci.yml` and others +that use `blacksmith-*` runners) would sit queued on the fork, so disable them in the fork's +**Actions** settings (Actions → the workflow → **Disable workflow**). ## Desktop app