From d4888ae17b2a52f96623edf0f0f94799528bbd72 Mon Sep 17 00:00:00 2001 From: CRT Date: Sat, 10 Oct 2026 21:17:00 +0000 Subject: [PATCH] docs: desktop release (keys, privacy gate, signing, runners, hosting, publish); downloads page site/desktop/ --- CHANGELOG.md | 11 ++ docs/desktop-release.md | 253 ++++++++++++++++++++++++++++++++++++++++ docs/desktop.md | 16 ++- site/desktop/index.html | 210 +++++++++++++++++++++++++++++++++ 4 files changed, 489 insertions(+), 1 deletion(-) create mode 100644 docs/desktop-release.md create mode 100644 site/desktop/index.html diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d47dfbc..1a7839c7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,17 @@ ## Unreleased +- **Desktop D5: release pipeline.** The desktop app is a separate signed download from storebound.dev/desktop/ (DMG, + Windows installer, AppImage / deb) that updates itself; the npm package stays the CLI, MCP server and skills. + `storebound desktop` opens the app (in an app folder it adds or selects that folder through + `storebound://open?path=`, after the app's own dialog) or prints the download for this system; `--download` saves + it to ~/Downloads after checking its SHA-256 and minisign signature, and never installs. One desktop version + (`desktopVersion` in package.json, checked in CI), a privacy scan of every artifact (`tools/privacy-scan.ts`), + path-free builds, `tools/desktop-release.ts` (universal macOS app + DMG, Developer ID + notarization when the + certificate exists, otherwise an ad-hoc `-unsigned` preview; self-test of the exact artifacts; signed latest.json), + a Forgejo workflow for Linux and Windows, the root-owned publish step on the server and a downloads page + (`site/desktop/`). Settings > Updates checks and installs signed updates on request. See `docs/desktop-release.md`. + - **Desktop machine interface** (`serve --stdio`): JSON-RPC session for the coming desktop app, built on the MCP core. Typed methods with argument schemas, structured results, progress notifications, cancellation, `project.inspect` and `portfolio.status`: apps across iOS and Android with identity, config check, release trains (current and next diff --git a/docs/desktop-release.md b/docs/desktop-release.md new file mode 100644 index 00000000..79debda8 --- /dev/null +++ b/docs/desktop-release.md @@ -0,0 +1,253 @@ +# Releasing storebound desktop + +How the desktop app (`apps/desktop`) is built, signed, checked and published. For what the app does, see +[desktop.md](desktop.md). + +## Distribution + +- **The desktop app is its own download.** A signed app from storebound.dev/desktop/: + - macOS: a DMG with a universal app (Apple silicon and Intel), macOS 11 or later; + - Windows: an NSIS installer that installs for the current user and brings the WebView2 bootstrapper; + - Linux: an AppImage and a .deb, built on Ubuntu 22.04. +- **It updates itself** with Tauri's updater: storebound.dev/desktop/latest.json, every bundle signed with the + updater key. The app checks the signature before it replaces anything and installs only after the owner clicks + Install in a native dialog (Settings > Updates). +- **It brings its own CLI.** The app bundles the storebound CLI as a sidecar, so it never depends on an npm install. +- **The npm package stays the CLI, the MCP server and the skills.** It contains no Tauri binaries. +- **Bridge: `storebound desktop`.** + - Installed: it opens the app. In an app folder it sends `storebound://open?path=`, and the app selects + that folder, or adds it after a native dialog. + - Not installed: it prints the download for this OS and CPU. + - `--download` saves the installer to ~/Downloads after checking its size, SHA-256 and minisign signature. It never + installs anything. + +## One version + +`desktopVersion` in the root `package.json` is the desktop app's version. The npm package's own `version` belongs +to the CLI and moves on its own. + +- `bun tools/desktop-version.ts` checks the copies: `apps/desktop/package.json`, `tauri.conf.json`, `Cargo.toml` + and the app's entry in `Cargo.lock`. CI runs this check. +- `bun tools/desktop-version.ts --set 0.1.1` writes a new version into all of them. +- `src-tauri/tests/d5.rs` checks the same thing again from the Rust side. + +## Keys and private files (outside every repository) + +`~/.storebound-keys/` (mode 700) on the release Mac holds: + +| file | what | made by | +|---|---|---| +| `updater.key` | minisign private key of the updater (no password; mode 600) | `bunx tauri signer generate -w ~/.storebound-keys/updater.key -p "" --ci` (done once, D5) | +| `updater.key.pub` | its public key; the same text is `plugins.updater.pubkey` in tauri.conf.json and `PUBLIC_KEY` in cli/lib/desktop-dist.ts | the same command | +| `forbidden-terms.txt` | names the privacy scan must never find: one per line (people, accounts, emails, machine names) | the owner | +| `notary.json` | `{"keyId", "issuerId", "keyPath"}` of an App Store Connect API key for notarytool | the owner, once a Developer ID exists | + +**Back up `updater.key`** (password manager or an offline copy). If it is lost, installed apps can never update +again: they only accept bundles signed with this key, so everyone would have to reinstall by hand. Never commit +it, never copy it to a runner. The Forgejo workflow builds unsigned installers, and the Mac signs them. + +## Privacy gate + +`bun tools/privacy-scan.ts ` runs on every artifact before it can ship. + +- **Terms it looks for:** + - the terms file; + - this machine's account name, home folder, full name, host and computer names, and git's global identity; + - the private-name rule of tools/scrub.ts; + - any `/Users/`, `/home/` or `C:\Users\` that is not a generic account. +- **How it reads files:** as bytes, in UTF-8 and UTF-16LE. +- **Archives it opens:** DMG (mounted read-only, never shown in Finder), .tar.gz, .deb, .zip, AppImage (unsquashfs + or 7-Zip) and NSIS (7-Zip). +- **Debug files:** .dSYM, .pdb and source maps fail the scan. +- **Exit codes:** 1 when it finds something, 2 when it cannot open an archive. A term is never printed in full. + +**Path-free builds.** `tools/desktop-release.ts` builds with `--remap-path-prefix` and `-ffile-prefix-map`, which +turn home into `~`, the checkout into `/src`, the cargo and rustup homes into `/cargo` and `/rustup`, and +`CARGO_TARGET_DIR` into `/target`. On Windows it also uses `/PDBALTPATH` and `/d1trimfile`. The target folder must +be outside the home folder. Release profile: `strip = true`, LTO, `panic = "abort"`. + +## macOS (on the owner's Mac) + +```sh +bun tools/desktop-release.ts mac --out ~/.storebound-releases/desktop/0.1.0 # from a clean commit +``` + +**Runs in the owner's logged-in macOS session.** It refuses SSH and background sessions: over SSH `codesign` +cannot use the login keychain (errSecInternalComponent). + +What it does, in order: + +1. Checks the session, the version, a clean checkout, the updater key and that the rustup targets are installed. +2. Picks the signing identity: + - **Developer ID Application found** (`security find-identity -v -p codesigning`): hardened runtime with + `src-tauri/entitlements.plist` (JIT for the Bun sidecar), notarization and stapling. Tauri notarizes the app, + the script notarizes the DMG. + - **None found**: an ad-hoc signed build whose files end in `-unsigned`. +3. Builds the sidecars for arm64 and x64, merges them into one universal file with `lipo`, then runs + `tauri build --target universal-apple-darwin --bundles app` with the path-free environment. +4. Makes the updater bundle (`.app.tar.gz`, root-owned entries, no macOS metadata) and the DMG. The DMG is made with + `hdiutil` only (no Finder scripting, nothing comes to the front). +5. **Checks the exact artifacts:** + - `codesign --verify --deep --strict`; + - the Gatekeeper expectation (signed: `spctl` accepts it as Notarized Developer ID and `stapler validate` passes; + unsigned: ad-hoc, and `spctl` rejects it); + - the self-test, run from the mounted DMG and from the unpacked updater bundle, for both CPU types (x86_64 through + Rosetta). `storebound-desktop --self-test` starts the bundled sidecar, sends `session.hello`, prints one JSON + line and exits, before Tauri starts, so no window opens; + - the privacy scan of the app, the DMG and the updater bundle. +6. Writes minisign `.sig` files with the updater key and checks them right away against tauri.conf.json's key. +7. Writes `latest.json`, `SHA256SUMS` and `evidence-macos-.json`. The evidence file (tool versions, checks, + hashes) stays local. + +### Owner actions for a signed macOS build + +1. **Developer ID certificate.** your Apple developer team's Account Holder creates a **Developer ID Application** + certificate: developer.apple.com > Certificates > +, with a CSR from Keychain Access on this Mac. Install it in + the login keychain. Today the keychain has Apple Distribution and Development identities only, so builds are + unsigned previews. +2. **Notarization key.** An App Store Connect API key (Users and Access > Integrations, role Developer) as + `~/.storebound-keys/notary.json` and its `.p8` file. Or set `APPLE_API_KEY`, `APPLE_API_ISSUER` and + `APPLE_API_KEY_PATH`. +3. **Rebuild.** Run the command above in Terminal on the Mac. + +### Opening an unsigned preview (what the downloads page says) + +macOS: copy storebound to Applications and open it. When macOS refuses, open System Settings > Privacy & Security +and choose Open Anyway (once). + +## Windows and Linux (Forgejo Actions) + +`.forgejo/workflows/desktop.yml` runs on a `desktop-v*` tag or by hand (workflow_dispatch; tick "windows" only when +a Windows runner exists). + +- **Linux** (`runs-on: ubuntu-22.04`, a container): AppImage and .deb built with the path-free environment, then: + - self-tests of the extracted AppImage and the unpacked .deb; + - the privacy scan and SHA256SUMS; + - an artifact `storebound-desktop-linux`. + + `WEBKIT_DISABLE_DMABUF_RENDERER=1`: the app sets it itself at start on Linux unless the user set it (some GPU / VM + setups leave the window blank with DMABUF), and the workflow sets it too. +- **Windows** (`runs-on: windows`): an NSIS installer (`installMode: currentUser`, WebView2 `embedBootstrapper`, + unsigned), then: + - a silent per-user install (`/S`), the self-test of the installed exe, a silent uninstall; + - the privacy scan; + - an artifact `storebound-desktop-windows`. + +Then on the Mac: + +```sh +bun tools/desktop-release.ts add --out ~/.storebound-releases/desktop/0.1.0 \ + storebound_0.1.0_amd64.AppImage storebound_0.1.0_amd64.deb storebound_0.1.0_x64-setup.exe +``` + +It scans and signs each file, renames the unsigned Windows installer to `-unsigned`, and updates latest.json +(`windows-x86_64`, `linux-x86_64`) and SHA256SUMS. For the scan, install `squashfs` and `sevenzip` from Homebrew. + +### Runner setup (not done yet) + +Forgejo runs in Docker on the VDS; Actions is off (`[actions] ENABLED = false` in its app.ini). + +1. **Enable Actions in Forgejo.** In `app.ini`, set `[actions] ENABLED = true` and + `DEFAULT_ACTIONS_URL = https://data.forgejo.org`. Restart the forgejo container, then enable Actions in the + repository settings. +2. **Linux runner on the VDS, in Docker.** + - Get a registration token: Site administration > Actions > Runners > Create new runner. + - Register and run: + + ```sh + mkdir -p /srv/forgejo-runner && cd /srv/forgejo-runner + docker run --rm -v $PWD:/data code.forgejo.org/forgejo/runner:6 forgejo-runner generate-config > config.yml + # in config.yml: runner.labels: ["ubuntu-22.04:docker://ghcr.io/catthehacker/ubuntu:act-22.04"], + # runner.capacity: 1, container.network: bridge, no privileged mode, no docker socket in jobs + docker run --rm -it -v $PWD:/data code.forgejo.org/forgejo/runner:6 forgejo-runner register \ + --no-interactive --instance https://git.crt.fyi --token --name vds-linux --labels ubuntu-22.04 + ``` + + - Run it as a service: the `forgejo-runner daemon` container with `/data` and the Docker socket, restart + unless-stopped. + - Jobs run in throwaway containers. The runner never sees a signing key. +3. **Windows runner (later).** The owner has no Windows machine yet. On one (Windows 10/11 x64): + - install Rust (MSVC, with the Visual Studio Build Tools), Bun and 7-Zip; + - run `forgejo-runner register --labels windows:host`, then `forgejo-runner daemon` as a service. + + Until then, Windows waits; the workflow's Windows job only runs when "windows" is ticked. +4. **Windows code signing (later).** Buy a code-signing certificate, then sign the installer before `add` and pass + `--code-signed`. + +## Hosting on storebound.dev + +| URL | served from | how it gets there | +|---|---|---| +| /desktop/ (downloads page) | /var/www/storebound.dev/desktop/index.html | `site/desktop/index.html`, with the site (Jenkins + /usr/local/sbin/storebound-publish) | +| /desktop/latest.json, /desktop/beta/latest.json | /var/www/storebound-desktop/ | storebound-desktop-publish | +| /desktop/dl// | /var/www/storebound-desktop/dl/ | storebound-desktop-publish | + +**Why the binaries live outside the site's document root.** The site's publish script rsyncs `site/` with +`--delete-after`, so anything not in git would vanish on the next site deploy. Binaries are never committed. +Apache maps the three paths with `Include /etc/apache2/storebound-desktop.conf` in the :443 vhost +(`tools/vds/apache-storebound-desktop.conf`): + +- latest.json is sent `no-cache`; +- version folders are sent `immutable`; +- no directory listings. + +**`/usr/local/sbin/storebound-desktop-publish [stable|beta]`** (`tools/vds/storebound-desktop-publish`, +root:root 755) takes `/var/lib/storebound-desktop/incoming//` (root only, mode 700) and checks it: + +- only plain files with plain names; +- SHA256SUMS matches; +- latest.json is that version, and every URL in it names an uploaded file under /desktop/dl//. + +Then it publishes: + +- a new version folder appears at once (temp folder, then rename); +- a later `add` to the same version only adds files, and a published file is never replaced by other bytes; +- latest.json goes in last (temp file, then rename), so apps see a version only when all its files are there. + +It runs nothing from the upload. + +**No sudoers entry is needed today.** The owner's Mac uploads and runs the script as root over SSH. If a CI job +should publish one day, give its user exactly this script, as the existing Jenkins entries do: +` ALL=(root) NOPASSWD: /usr/local/sbin/storebound-desktop-publish`. + +Both files are installed on the VDS (D5). The Apache vhost was backed up to `/root/storebound.dev.conf.bak-*` first. +To reinstall after a change: + +```sh +scp tools/vds/storebound-desktop-publish root@:/usr/local/sbin/storebound-desktop-publish +scp tools/vds/apache-storebound-desktop.conf root@:/etc/apache2/storebound-desktop.conf +ssh root@ 'chmod 755 /usr/local/sbin/storebound-desktop-publish && apache2ctl configtest && systemctl reload apache2' +``` + +## Publish + +Publishing is the owner's call. Every installed app on the channel offers the update as soon as latest.json is +live. + +```sh +export STOREBOUND_PUBLISH_HOST=root@ # the VDS (not the Cloudflare name) +bun tools/desktop-release.ts verify --out ~/.storebound-releases/desktop/0.1.0 +bun tools/desktop-release.ts publish --out ~/.storebound-releases/desktop/0.1.0 # dry run: the plan +bun tools/desktop-release.ts publish --out ~/.storebound-releases/desktop/0.1.0 --yes # upload + publish +``` + +1. **Checks again:** sums, signatures against tauri.conf.json's key, latest.json and the privacy scan. +2. **Uploads:** rsync into the incoming folder (evidence stays local). +3. **Publishes:** runs the publish script. +4. **Confirms:** reads the live latest.json back. + +`--channel beta` publishes to /desktop/beta/latest.json, which apps on the Beta channel read. + +**Rollback.** Tauri updates only to a higher version, so a bad release is replaced by a fixed higher version. Its +files stay where they are, because links and checksums must not change. + +## Going public: checklist + +1. Developer ID Application certificate and notary key on the Mac, then a signed, notarized macOS build. + Check: `spctl` accepted, `stapler validate` OK, self-test from the DMG. +2. Forgejo Actions enabled, the Linux runner registered, a `desktop-v0.1.0` tag built, `add` of the AppImage and + deb. +3. Windows: a runner, or ship macOS + Linux first. The page and latest.json list only what exists. +4. `publish --yes` to stable. Then open storebound.dev/desktop/ on each OS and run `storebound desktop --download`. +5. An updater round trip: publish 0.1.1 to beta, switch a 0.1.0 install to Beta, Check for updates, Install. +6. Link /desktop/ from the main page, and update README and CHANGELOG. diff --git a/docs/desktop.md b/docs/desktop.md index 98a2bf75..3e486f37 100644 --- a/docs/desktop.md +++ b/docs/desktop.md @@ -129,7 +129,7 @@ host state file (`overrides_set`, every key checked in `workspace.rs`). - Dependencies and the CLI sidecar. - Privacy, with a button that reveals the data folder. - Shortcuts. -- Update channel (placeholder until the updater ships). +- Updates: channel (stable / beta), check and install (D5). - Reset: native confirmation, then the keychain entries and every saved state are removed. ### Writes in the window @@ -189,6 +189,20 @@ Download sources (one click on the Dependencies screen or in the first-run guide - **Progress and cancel** go through the same progress events as sidecar jobs; a cancelled download removes its temporary file. +## Release, updates and the terminal bridge (D5) + +- Releases: [desktop-release.md](desktop-release.md) (version authority, privacy gate, macOS signing and + notarization, Forgejo builds for Linux and Windows, storebound.dev hosting, publish). +- **Updates**: Settings > Updates checks storebound.dev (stable `/desktop/latest.json` or beta + `/desktop/beta/latest.json`) only when asked; Install shows a native dialog, then the updater downloads the bundle, + checks its minisign signature against `plugins.updater.pubkey` and restarts (`update_check`, `update_install`). +- **`storebound://open?path=`** (sent by `storebound desktop` in an app folder): the host accepts + one plain absolute path (`policy::deep_link_open_path`), selects that app folder when it is in the list, otherwise + asks in a native dialog and adds it (`deep-link-folder` event). A folder without a storebound config gets a message, + nothing else. +- **`storebound-desktop --self-test`**: starts the bundled sidecar, checks the `session.hello` handshake, prints one + JSON line and exits, before Tauri starts (no window). The release runs it on the exact artifacts. + ## Develop ```sh diff --git a/site/desktop/index.html b/site/desktop/index.html new file mode 100644 index 00000000..687abaf4 --- /dev/null +++ b/site/desktop/index.html @@ -0,0 +1,210 @@ + + + + + +storebound desktop · download + + + + + + + + + + + + + + + + + + + +
+ +
+ +
+
+
+

Desktop app · preview

+

storebound desktop

+

Every app and game you ship, on Google Play and the App Store, in one window: releases on both stores, catalog parity, listings, crash health, reviews and TestFlight. It drives the same open source storebound CLI, keeps store keys in the system keychain, shows a dry run before every change, and never presses Submit.

+ +
+

Looking up the latest release…

+
+ +
+

Already use the CLI? storebound desktop opens the app in your app folder, or prints the download for your system; storebound desktop --download saves the installer to ~/Downloads after checking its signature (it never installs anything).

+
+
+ +
+
+

All downloads

+

Every system, with checksums

+

The app updates itself from this site: each update is signed, and the app checks the signature before it replaces anything. It asks before installing.

+ + + + +
+
+ +
+
+

Verify

+

Check a download yourself

+
    +
  1. Checksum: shasum -a 256 <file> (macOS, Linux) or Get-FileHash <file> (Windows) must print the SHA-256 above.
  2. +
  3. Signature: every file has a .sig next to it (the app's update key, minisign). With minisign: base64 -d <file>.sig > f.minisig && minisign -Vm <file> -x f.minisig -P <key>, with the public key + RWQqOO/ZeIr3RBmolt/fx108m89QNEUndRTFrucjx0CBMoeFb7/xhrvW
  4. +
  5. Or let the CLI do both: storebound desktop --download.
  6. +
+

The npm package storebound stays the CLI, MCP server and agent skills; it does not contain this app. The app brings its own copy of the CLI.

+
+
+
+ + + + + +