Skip to content

Make the desktop app consumable by downstream distributions: configurable default server, optional builtin runtime, product name, update feed #3168

Description

@apsknight

The workflow

We ship bb as a downstream distribution: a thin launcher pins bb-app as an npm dependency, applies our default settings, and adds our own plugins. Our users want a normal Mac app for it — dock icon, native window, the desktop bridge's file/terminal/browser integrations — the same experience bb.app gives upstream users.

What happens today

The stock bb.app almost works for this: its whole UI is served by whichever server it targets, and Window → Server → Set Server URL… lets us point it at our server. We automate that by writing server-target.json in the app's user-data directory (the same file the menu writes) and then open -a bb. Verified on desktop 0.41.0 against a bb-app 0.42.1 server: the window loads our server's UI, projects, and providers.

What we cannot do:

  1. Stop the builtin runtime. Even when target: "custom", the shell still spawns its bundled bb-app server on 38886 ("This Mac"), with upstream defaults (telemetry, Connect) and a separate ~/.bb data dir. For a distribution whose entire point is different defaults, that is an unwanted second server on every laptop. applyServerTarget only skips ensureBuiltinRuntimeAttached for the current target; nothing lets a deployment declare "never own a runtime".
  2. Set the default server without touching user data. resolveDesktopServerUrl reads BB_SERVER_PORT for the builtin target only; there is no env/config for "default to this custom URL on first launch". Writing server-target.json from outside works but relies on an undocumented file format.
  3. Rebuild it under another name. apps/desktop builds bb-app from the pnpm workspace (prepare-runtime → turbo), hardcodes product name / appId / update feed, and electron-builder.config.json is not a published package input. There is no way to produce <Ours>.app that bundles a given bb-app tarball plus our launcher, without forking the monorepo.
  4. Point auto-update elsewhere. BB_DESKTOP_VERSION_FEED_URL exists at runtime but the packaged app's feed is baked in at build time and a downstream cannot disable the updater for its own artifact.

Code refs (main @ 6cdb4ba):

  • apps/desktop/src/server-target.ts — persisted target store (builtin | connect | custom)
  • apps/desktop/src/main.ts — resolveDesktopServerUrl, applyServerTarget, startOwnedRuntime
  • apps/desktop/package.json — prepare-runtime, package, dist scripts

What you would expect

Two tiers; either alone is useful.

Tier 1 — runtime configuration of the stock app (small):

  • BB_DESKTOP_DEFAULT_SERVER_URL: when no server-target.json exists, seed { target: "custom", customServerUrl } from it.
  • BB_DESKTOP_BUILTIN_RUNTIME=off (or a desktop-config.json next to the app): never spawn the bundled server; hide "This Mac" from the Server menu; show the startup-error page if the custom target is unreachable.
  • Document server-target.json as a stable, supported surface (it already has a zod schema).

Tier 2 — packaging for downstreams (larger, happy to discuss shape first):

  • Publish the desktop shell as a build input (e.g. @bb/desktop-shell) that takes: a bb-app tarball or an alternate launcher entrypoint for the owned runtime, productName / appId / icon, default server URL, builtin-runtime on/off, and an update feed URL or none. electron-builder config generated from that, signing left to the consumer's CSC_* env exactly as today.

Context and alternatives

  • Workaround today: a <launcher> desktop subcommand that writes server-target.json and opens the stock app, plus a README caveat about the stray 38886 server and the bb branding. Works, but depends on an undocumented file and leaves the second server running.
  • Writing our own Electron wrapper loses the desktop bridge (file opener, terminal, browser tabs) and duplicates apps/desktop — a fork in all but name.
  • Not a duplicate of Support multiple desktop servers and remote machine handoff #1451 (multiple servers / remote handoff): that is about adding servers for one user; this is about a distribution choosing the default and removing the builtin one.
  • Related: Make the bb-app self-update check and upgrade command configurable for downstream distributions #3167 (configurable self-update check) covers the server-side row; this covers the Electron shell.
  • Affects anyone packaging bb for an organization: Homebrew cask maintainers, corporate IT distributions, or teams that run bb only against a remote dev box.

Checks

  • I searched open and closed issues for the same request.
  • If an agent wrote this, the body ends with > AGENT GENERATED.

AGENT GENERATED

Activity

  1. added
    desktop
    on Sep 6, 2026
  2. bb-slop-cop commented on Sep 6, 2026

    @bb-slop-cop
    Contributor

    🚨 SLOP COP 🚨 · new-issue-autopilot

    Classification applied:

    • Type: Feature
    • Priority: Medium
    • Effort: High
    • Labels: desktop

    No bug report or pull request: the repository Type is Feature, so this rule stops after triage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    desktop

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions