# storebound desktop (apps/desktop) A Tauri 2 window around the storebound CLI: every app in a workspace, on iOS and Android, in one place. It is in development; this page is for contributors. ## Shape - **One source of logic.** The app never calls a store itself. It runs the storebound CLI as a sidecar (`storebound serve --stdio`, compiled with `bun tools/build-sidecars.ts`) and asks it for everything. - **App-centric.** One app = one product with up to two platforms (iOS bundle id / App Store Connect app id, Android package name), one `storebound.config.ts` per app folder, many apps per workspace. Navigation: Portfolio -> App (Releases, Catalog, Listings, Health, Reviews, TestFlight) plus the workspace screens (App folders, Accounts, Dependencies, Settings). - **Release trains.** A version (for example 2.3.0) spans both stores: iOS build and Android versionCode, per-store state (TestFlight, review, live, phased release, rollout fraction). `portfolio.status` returns per app the current train (highest version live on a store) and the next one (highest version above it anywhere). - **Catalog parity.** Products (and subscriptions, once the config has them) are defined once; `portfolio.status` compares the config with both stores (ids missing on a store, ids on one store only). Types of the protocol: `cli/lib/desktop-protocol.ts`; pure portfolio logic: `cli/lib/portfolio.ts`. ## Safety model - The sidecar's first request is `session.hello` with a 32-byte secret the Rust host makes per start and writes to the sidecar's stdin. Write methods are dry runs unless the call carries a confirm token: HMAC-SHA256 over the method, the canonical `{ project, args }` and a 60 s expiry, single use. The host mints one only after the owner pressed Apply in a native dialog that shows the summary and the dry run (`write_with_confirm`). - No method submits for review, releases an approved version, publishes, cancels a submission, sends a build to external testers or removes testers. Under `serve`, the CLI's own terminal confirmations answer no, with one exception: the **owner actions** (`owner.play_rollout` share / halt / resume / complete, `owner.ios_phased` on / pause / resume / complete, `owner.reply_send` one approved draft, `owner.testflight_testers` adds the testers of `.storebound/testers.csv`). They are desktop-only (never MCP tools), dry runs from the window like every write, and their real run needs the host token. Only then serve sets `STOREBOUND_OWNER_CONFIRMED` for that one child, which answers the command's question. The native dialog names the action on its button ("Yes: Change the Play staged rollout"). `tests/desktop-d3.test.ts` and `src-tauri/tests/d3_writes.rs` pin the token binding of every write the window offers. - The webview gets no plugin API. It may call the app commands (each re-checks the window label and the page origin in Rust) and listen to two events. Strict CSP, no remote content. `src-tauri/tests/security.rs` pins all of it. - Store keys (Play service account JSON, App Store Connect key id, issuer id and .p8) are picked in native dialogs, stored in the OS keychain (`keyring`), never shown again and passed to the sidecar per call in memory only. ## Screens and data (D2) - **Portfolio**: KPIs (apps, live versions, rolling out, in review, needs attention), one row per app with the version reaching users on each store and its place on the track (build, testing, review, live, rollout %), the next version, the last saved crash rate as a sparkline, catalog parity and the config check; then a "needs attention" list (problems first, then warnings, store read errors, rejected or halted releases, catalog drift, health near a threshold). - **App**: Releases (release timeline, both stores on one track per version; iOS phased release day and share from `apple status --json`), Catalog (parity matrix from `catalog.diff`: matches, differs, missing, not sold there, not compared; price gaps per region), Listings (`project.listings`: per language and store, fields against the limits, rendered screenshots), Health (`health`: daily user-perceived crash and ANR rate against the Play thresholds, worst devices, top issues, App Store metrics and signatures), Reviews (`reviews.list` + `reviews.drafts`: star distribution, filters, the local draft with its send checks, Approve via `reviews.approve`), TestFlight (`apple.testflight_status`), Checks (offline `check` + `validate` with fix hints). - **First-run guide**: what the app does, add or start an app folder (`project.init` = `storebound init --profile`, confirmed in a native dialog), store keys into the keychain and which app uses which, local tools, first read. - **Command palette** (Cmd/Ctrl+K): apps, tabs, screens and actions. Cmd/Ctrl+1 Portfolio, +2-5 workspace screens, Cmd/Ctrl+Shift+[ ] app tabs, arrow keys in the tab list. Toasts show background jobs with progress and Cancel. - **Unknown, never false.** Store reads run on demand (they use the account's API quota) and are saved in app data (`cache.sqlite`, results only, never keys); a screen opens with the saved read and its time ("Last read 3 h ago, saved copy"), a failed read keeps the previous one and says so, and nothing that was not read is shown as fine. Settings clears the saved reads. - **Jobs.** The window tags a call with a job id; the host maps sidecar request ids to it, so progress lines reach the right toast, and `job_cancel` sends `$/cancelRequest` (or stops a download). Live portfolio reads run up to four apps at a time with their own accounts and report n / total. - **i18n**: English and Turkish (`src/i18n`), Settings picks the language (default: the system's); `tools/i18n-check.ts` (CI) checks keys, empty messages and placeholders. **Theme**: text tokens keep 7:1 contrast in both themes (`tests/theme.test.ts`), motion at most 200 ms and off with reduced motion. ## Studios, accounts and store-only apps (D3) ### Accounts and studios - A **studio** is a name, a colour and an optional logo. It groups any number of store accounts: - a Play service account, which can be invited to several Play developer accounts and then sees all their apps; - an App Store Connect team key, one per team. - Keys stay in the keychain. The state file keeps labels and studio ids only. - `storebound apps check` gives each account's health, with the fix in words: - ok; - no-apps; - permission (Play: "invite in Play Console > Users and permissions with ..."); - revoked; - api-disabled. - `storebound apps list` reads the apps an account can see: - App Store Connect: `GET /v1/apps`, the newest version, and an icon from the newest build's `iconAssetToken`, fetched by the CLI and returned as a data URL; - Play: the Reporting API `apps:search`. - Serve exposes both as `apps.list` and `account.check` (kind `account`, one account's key per call, run in an empty temp folder). The host caches app lists under `acct:`. ### One card per app `src/lib/identity.ts` builds one card per app, pure and tested: 1. A folder takes the store apps its config names. Order: an explicit link, then the App Store app id, then the bundle id or package name. The folder's mapped accounts win. 2. The remaining store apps pair iOS + Android, in this order: - manual pairs; - the same id; - a close id (`.ios` / `.android` suffixes, case, punctuation); - the same name. Unpairs block automatic pairs. 3. What is left is a single-store app. Overrides (pairs, unpairs, links, studio moves, the ignore list of apps, folders and whole accounts) live in the host state file (`overrides_set`, every key checked in `workspace.rs`). ### Store-only apps - A store-only app has no folder. It is read through a **store target**: `store:ios:::;android::`. - The host checks the target and the account kinds, and passes `virtual: { name, apple, play }`. The sidecar writes a minimal `storebound.config.json` (store ids, placeholder links) into its temp folder. - Only `apple.status`, `play.status`, `health`, `reviews.list`, `apple.testflight_status` and `apple.ppo_status` work this way, and `portfolio.status` takes store-only entries. - "Link a folder" or "Start an app folder here" turn it into a full app. ### Settings - Studios and accounts. - Pairing and the ignore list. - Store reads: on launch, every 15 min to 12 h (off by default), apps at a time 1-8, icons. - Offline cache: size, keep 7 / 30 / 90 / 365 days or always, clear. - Language, theme and motion. - Notifications, after a read, never on the first one: review / release state changes, new 1-2 star reviews, crash or ANR over the Play threshold. - Dependencies and the CLI sidecar. - Privacy, with a button that reveals the data folder. - Shortcuts. - Update channel (placeholder until the updater ships). - Reset: native confirmation, then the keychain entries and every saved state are removed. ### Writes in the window Each write is a dry run, then the native dialog, then the real run, with one progress toast and Cancel: - **Listings tab:** Play listing text, App Store version and text, Play graphics, App Store screenshots and previews; local render jobs (screenshots, previews, icons, gallery). - **Catalog tab:** Play products and subscriptions, App Store IAPs and subscriptions, price export. Price import stays a terminal step. - **Releases tab:** rollout and phased release owner actions. - **TestFlight tab:** What to Test, internal groups, testers. - **Reviews tab:** reply editor (`reviews.reply`), approve, send (owner action). R&D on a fastlane importer and a RevenueCat adapter: `docs/research/fastlane-revenuecat.md`. ## Dependencies screen storebound needs no local tool for store work. Screenshots, app previews, icons and captures use: | tool | used for | how the app gets it | |---|---|---| | ffmpeg, ffprobe | icons, renders, app previews, frame crops | download into the app data folder (planned, see below) | | Chrome / Chrome for Testing | screenshot renders, captions, web captures | system Chrome, or Chrome for Testing downloaded into the app data folder (planned) | | Xcode command line tools, simctl | iOS builds, Simulator captures | link to Apple only | | adb | Android emulator / device captures | link to the Android platform tools only | | git | release notes, analytics compare | link only | `system.tools` reports each with its path, version and source (`app` or `system`). The host passes app-managed copies to the sidecar: `STOREBOUND_TOOL_PATH` (app data `tools/bin`, put in front of PATH for every command) and `STOREBOUND_CHROME` (app data `tools/chrome/...`, used as Playwright's `executablePath`). Nothing is installed system-wide and nothing is bundled in the installer. `storebound doctor` prints the same detection (plus playwright) with the install commands for the OS. Download sources (one click on the Dependencies screen or in the first-run guide; `src-tauri/src/downloads.rs`): - **ffmpeg, macOS (arm64, x64):** release builds from ffmpeg.martin-riedl.de (static, notarized zip per tool). - **ffmpeg, Linux (x64, arm64) and Windows (x64):** `ffmpeg-n-latest--gpl` release builds from github.com/BtbN/FFmpeg-Builds. - **Verification:** the app ships a manifest (`src-tauri/tools-manifest.json`, written by `bun tools/tools-manifest.ts` before each desktop release, `--check` tests the URLs) with the exact URL, size and SHA-256 of each archive; a download whose hash differs is deleted. Every pinned hash has two independent sources: macOS archives are downloaded and hashed by the tool and must equal the publisher's `.sha256`; BtbN archives (pinned autobuild tag) use the digest GitHub computes for the release asset, which must equal the publisher's `checksums.sha256`. Downloads and their redirects may only use HTTPS and the hosts in `downloads::DOWNLOAD_HOSTS`. Everything is unpacked and checked in a staging folder; only a verified result replaces the installed copy, and the sidecar restarts so it sees the new tool. - **License:** these ffmpeg builds are GPL (v3 for the BtbN `gpl` variants). The app downloads them only on the owner's click, from the original publisher, shows the license and the source link next to the button, and never redistributes them, so the app itself stays MIT. - **Chrome for Testing:** Google's official JSON endpoints (googlechromelabs.github.io/chrome-for-testing/last-known-good-versions-with-downloads.json, Stable channel), archives from storage.googleapis.com over HTTPS. Those endpoints publish no hashes, so the app checks the code signature after unpacking (macOS `codesign --verify` with Google's team, Windows Authenticode); on Linux it checks the version banner. Chrome for Testing is under Google's terms for Chrome / Chromium (BSD-style Chromium license plus third-party notices). - **Progress and cancel** go through the same progress events as sidecar jobs; a cancelled download removes its temporary file. ## Develop ```sh bun install bun tools/build-sidecars.ts --host # apps/desktop/src-tauri/binaries/storebound- cd apps/desktop && bunx tauri dev # Vite on 127.0.0.1:1420 + the Rust host cd apps/desktop/src-tauri && cargo test && cargo clippy --all-targets -- -D warnings ``` Dev-only switches (ignored in release builds): `VITE_START=accounts|app:catalog|app:health:2|welcome:3|palette|...` opens a screen first, `VITE_THEME=light|dark` and `VITE_LANG=en|tr` force theme and language, `VITE_AUTORUN=gallery` starts the confirm flow on the first app (the same names work as `?start=...&theme=...` query parameters on the Vite server). `STOREBOUND_DEV_PROJECTS=:` (debug builds) seeds the app folder list. Fixture mode (dev builds only): `VITE_FIXTURES=1` answers every app command from `src/dev/fixtures.ts` (made-up store data around the two demo apps; `=empty` for a first run, `=cold` for nothing read yet). The window shows a "DEV FIXTURES" badge; release bundles do not contain it (`tests/webview.test.ts` checks `dist/`). Screenshots of every screen in both themes: `VITE_FIXTURES=1 bunx vite --port 1431 &` then `bun scripts/screens.ts --base http://127.0.0.1:1431 --out ` (playwright with the installed Chrome). Gotchas kept from earlier Tauri apps: Cmd+Q quits and the Window menu keeps an entry for the hidden window; platform configs (`tauri..conf.json`) must not set `app.windows` (Tauri replaces the whole array); Linux sets `WEBKIT_DISABLE_DMABUF_RENDERER=1` unless the user set it; a `bun build --compile` binary needs an ad-hoc re-sign on macOS or the kernel kills it on start.