From ed05c1970fcc484d3b8096068c02ff5d3da5af38 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Tue, 13 Oct 2026 13:28:57 +0200 Subject: [PATCH] Launcher: release workflow for launcher-v tags (Linux, macOS, Windows, draft), README for updates, CLI and MCP; quieter CLI progress Co-Authored-By: Claude Opus 5.5 --- .github/workflows/launcher.yml | 61 ++++++++++++++++++++++++++++++--- launcher/README.md | 62 +++++++++++++++++++++++++++++++++- launcher/src/cli.rs | 11 ++++-- 3 files changed, 126 insertions(+), 8 deletions(-) diff --git a/.github/workflows/launcher.yml b/.github/workflows/launcher.yml index aef3a7fde..608d26914 100644 --- a/.github/workflows/launcher.yml +++ b/.github/workflows/launcher.yml @@ -1,10 +1,16 @@ name: launcher +# Builds the launcher on Linux, macOS and Windows. A pushed `launcher-vX.Y.Z` tag also puts the +# three archives on a draft GitHub release of that tag, to publish by hand. Horizon's own +# releases are tagged `vYYYY.MM.DD`; the launcher reads only `launcher-v*` releases for itself. on: workflow_dispatch: push: branches: [launcher] - paths: ['launcher/**', '.github/workflows/launcher.yml'] + tags: ['launcher-v*'] + +permissions: + contents: read jobs: build: @@ -12,24 +18,69 @@ jobs: fail-fast: false matrix: include: + - os: ubuntu-latest + asset: horizon-launcher-linux-x86_64.tar.gz + binary: horizon-launcher - os: macos-latest - artifact: horizon-launcher-macos-arm64 + asset: horizon-launcher-macos-arm64.zip binary: horizon-launcher - os: windows-latest - artifact: horizon-launcher-windows-x64 + asset: horizon-launcher-windows-x64.zip binary: horizon-launcher.exe runs-on: ${{ matrix.os }} defaults: run: working-directory: launcher + shell: bash steps: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@stable - uses: Swatinem/rust-cache@v2 with: workspaces: launcher + - name: Linux libraries GPUI links to + if: runner.os == 'Linux' + run: | + sudo apt-get update + sudo apt-get install -y libxkbcommon-x11-dev libwayland-dev libx11-xcb-dev libfontconfig-dev libvulkan-dev libasound2-dev + - name: The tag matches Cargo.toml + if: startsWith(github.ref, 'refs/tags/launcher-v') + run: grep -qx "version = \"${GITHUB_REF_NAME#launcher-v}\"" Cargo.toml + - run: cargo test --release --locked --lib - run: cargo build --release --locked + - name: Package + run: | + mkdir -p dist + cp target/release/${{ matrix.binary }} dist/ + cd dist + if [[ "${{ matrix.asset }}" == *.tar.gz ]]; then + tar czf ../${{ matrix.asset }} ${{ matrix.binary }} + elif [[ "$RUNNER_OS" == "Windows" ]]; then + 7z a ../${{ matrix.asset }} ${{ matrix.binary }} + else + zip ../${{ matrix.asset }} ${{ matrix.binary }} + fi - uses: actions/upload-artifact@v4 with: - name: ${{ matrix.artifact }} - path: launcher/target/release/${{ matrix.binary }} + name: ${{ matrix.asset }} + path: launcher/${{ matrix.asset }} + + release: + if: startsWith(github.ref, 'refs/tags/launcher-v') + needs: build + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - uses: actions/download-artifact@v4 + with: + path: dist + merge-multiple: true + # A draft, and never marked latest: Horizon's own releases stay the repository's latest. + - uses: softprops/action-gh-release@v2 + with: + tag_name: ${{ github.ref_name }} + name: Horizon launcher ${{ github.ref_name }} + draft: true + make_latest: false + files: dist/* diff --git a/launcher/README.md b/launcher/README.md index 325f49da4..76f9c7f3d 100644 --- a/launcher/README.md +++ b/launcher/README.md @@ -6,6 +6,10 @@ Zed's UI framework; it has its own Cargo workspace and is not part of the game's ![Play](docs/play.png) +The opening, then Play ([clip](docs/opening.webm)): + +![Opening](docs/opening-1.png) + ## What it does - **Versions**: lists the published releases of ludovic111/horizon, installs the build for @@ -20,13 +24,68 @@ Data lives in the platform's data directory (`~/.local/share/horizon-launcher` o `~/Library/Application Support/horizon-launcher` on macOS, `%APPDATA%\horizon-launcher` on Windows): `versions//`, `server-jars/`, `server/` and `settings.json`. +- **Settings**: install new Horizon versions automatically (off by default; the selected + version only moves to the new one if you were on the newest), the opening animation, and the + launcher's own version and update state. + +## Updates + +The launcher looks for a newer Horizon release when it starts and every four hours while it +is open, and shows a small "available, Install" line on Play. + +It also updates itself from GitHub releases tagged `launcher-vX.Y.Z` (Horizon's own are +`vYYYY.MM.DD`; neither is ever taken for the other). It downloads the new build, replaces its +own binary, and offers "Restart to update" in the sidebar. Development builds and +`HORIZON_LAUNCHER_NO_SELF_UPDATE=1` never replace themselves. + +To release the launcher: set `version` in `Cargo.toml`, then push a tag `launcher-vX.Y.Z`. The +`launcher` workflow builds Linux, macOS and Windows and attaches +`horizon-launcher-linux-x86_64.tar.gz`, `horizon-launcher-macos-arm64.zip` and +`horizon-launcher-windows-x64.zip` to a draft release of that tag, never marked latest. Publish +it by hand. + +## Command line + +The same binary is a command-line tool; without a subcommand it opens the window. + + horizon-launcher versions [--installed] releases on GitHub, or what is installed (* = selected) + horizon-launcher install + horizon-launcher remove + horizon-launcher prepare [--minecraft ] [--version ] + horizon-launcher play [--version ] + horizon-launcher server [--dir ] [--version ] [--accept-eula] + horizon-launcher notes [] patch notes as plain text + horizon-launcher next the roadmap + horizon-launcher update [--check] Horizon and the launcher + +`--json` prints JSON where there is something to report (`versions`, `install`, `notes`, +`next`, `update --check`). Errors go to stderr with exit code 1. `server` runs in the terminal, +so lines you type reach its console. `HORIZON_LAUNCHER_HOME` replaces the data folder (for +scripts and tests). + +## AI agents (MCP) + +`horizon-launcher mcp` is a Model Context Protocol server over stdio. To use it from Claude Code: + + claude mcp add horizon -- horizon-launcher mcp + +(with the full path to the binary if it is not on your `PATH`). Its tools: `list_versions`, +`install_version`, `remove_version`, `prepare_resources`, `launch_client`, `start_server`, +`server_command`, `server_log`, `stop_server`, `patch_notes`, `roadmap` and `check_updates`. +A server started through MCP stops (cleanly, with `stop`) when the session ends. Starting one +needs `accept_eula`, which an agent should only pass with the player's consent. + +The window, the command line and the MCP server all call the same core, `src/backend.rs`. + ## Building cargo build --release On NixOS, `nix-shell` in this folder provides the libraries GPUI links to (Wayland, X11, xkbcommon, Vulkan, fontconfig). macOS needs Xcode's command line tools. The `launcher` -workflow builds macOS and Windows binaries as artifacts. +workflow builds all three platforms on every push to the `launcher` branch. + + cargo test --lib # tag separation, version order, update selection, notes as text Geist, Geist Mono and Instrument Serif (SIL Open Font License, `assets/fonts/OFL-*.txt`) are bundled so the type is the same on every platform. @@ -38,3 +97,4 @@ Background image (`assets/background.jpg`): backgrounds.supply (free preview), l ![Server](docs/server.png) ![Versions](docs/versions.png) ![Patch notes](docs/patch-notes.png) +![Settings](docs/settings.png) diff --git a/launcher/src/cli.rs b/launcher/src/cli.rs index 5513ea03b..8aea88b0f 100644 --- a/launcher/src/cli.rs +++ b/launcher/src/cli.rs @@ -2,7 +2,7 @@ //! command goes through `backend`; this file only parses arguments and prints. use clap::{Parser, Subcommand}; use horizon_launcher::backend::{self, Release}; -use std::io::Write; +use std::io::{IsTerminal, Write}; use std::path::PathBuf; use std::process::Command; @@ -84,9 +84,16 @@ pub fn run() -> Option { }) } +/// Download progress on one terminal line, only when stderr is a terminal and the percentage moves. fn progress(label: String) -> impl Fn(f32) { + let last = std::cell::Cell::new(-1); + let tty = std::io::stderr().is_terminal(); move |p| { - eprint!("\r{label} {:>3.0}%", p * 100.); + let pct = (p * 100.) as i32; + if !tty || pct == last.replace(pct) { + return; + } + eprint!("\r{label} {pct:>3}%"); let _ = std::io::stderr().flush(); if p >= 1.0 { eprintln!();