Repository navigation
Add a Settings button that installs the bb CLI for use outside bb - #5441
Merged
Merged
Conversation
Threads in bb already have `bb` on their PATH, but a terminal, a script, or an agent running outside bb (Claude Code, Codex) had no `bb` unless the user installed bb-app globally with npm. Desktop users had no way to get it. Settings → General → Command line now has a "bb CLI" row with Install and Remove. Nothing changes PATH until the user chooses Install. - Every packaged bb-app start writes a launcher to <dataDir>/bin/bb (bb.cmd on Windows) that runs the install's bb CLI with the install's own runtime, including Electron-as-Node and AppImage installs, and passes its path to the server as BB_CLI_LAUNCHER. Source checkouts write none, so the row is hidden. - The server links the launcher into a PATH folder (or appends <dataDir>\bin to the Windows user PATH) and never replaces another bb: install is refused with 409 while one comes first on PATH. - The same action is available as `bb settings cli-command [install|remove]` and as system.experimental_cliCommand / experimental_installCliCommand / experimental_removeCliCommand in the SDK. - The bundled CLI now runs with the launcher's runtime instead of relying on `node` being on PATH. Co-Authored-By: Claude Code <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Human comments
What was wrong
bb had no supported way to use the
bbCLI outside bb. Threads getbbon their PATH from the host daemon, but a terminal, a script, or an agent running outside bb (Claude Code, Codex) only hadbbafter a globalnpm install -g bb-app, and desktop app users had no route at all. The packaged CLI also started through a#!/usr/bin/env nodeshebang, so it failed withenv: 'node': No such file or directoryon a machine with no Node on PATH, which is the normal desktop case.What changed
Settings → General → Command line has a new bb CLI row with Install and Remove. Nothing changes PATH until the user chooses Install.
packages/bb-app/src/cli-launcher.ts,launcher.ts): every packagedbb-appstart writes<dataDir>/bin/bb(bb.cmdon Windows). It runs the install's bb CLI with the install's own runtime, including Electron-as-Node and AppImage installs. The launcher passes the path to its server child asBB_CLI_LAUNCHER. Source checkouts write no launcher, so the row is hidden there.resolveBundledCliLaunch): without aBB_CLIoverride, thebbentry now runs the bundled CLI with the launcher's own Node runtime instead of relying onnodebeing on PATH.apps/server/src/services/system/cli-command.ts,routes/system.ts):GET /api/v1/system/cli-command,POST .../install,POST .../remove. Install links the launcher into the first usable folder of/opt/homebrew/binand/usr/local/bin(macOS),~/.local/bin, and~/bin, preferring one already on PATH; on Windows it appends<dataDir>\binto the user PATH. It never replaces anotherbb: install returns409 cli_command_blockedwhile one comes first on PATH, and the status names it (an npm-installed bb-app, the machine installer's~/.local/bin/bb, or anything else). Remove deletes only links that point at a bb launcher. Machine credentials get 403. The action runs on the server's own computer; there is no host-daemon wire change.system.experimental_cliCommand(),experimental_installCliCommand(),experimental_removeCliCommand(), with an entry indocs/api_to_audit.md.@get-bb/plugin-sdkis bumped to 0.6.43 because its bundled types change.bb settings cli-command(show),install,remove.CliCommandSettingsSection, rendered above the existing bb CLI skills row.docs/configuration.md, both READMEs, the guide template, the bb-cli skill references and command index, the plugin backend SDK table, and the uninstall page.How you verified
sh(argument passing, missing install, AppImage argument handling), server service tests with real symlinks in a fake home and an injected Windows PATH reader, route tests (unsupported, install/remove, machine credentials), a CLI command-output test, and a Settings row component test.pnpm exec turbo run lint typecheck --filter='...[origin/main]'passes (137 tasks).pnpm exec turbo run testfor@bb/server,@bb/cli,@bb/sdk,@bb/config,bb-app,@bb/web,@bb/templates,bb-plugin-bb-guide, and@bb/demo-serverpasses.@bb/apppasses all 5,743 tests; one run reported two unhandled timer errors fromsplitDragSession.test.ts, which passes alone and is not touched here.node apps/app/scripts/check-bundle-budget.mjsandnode packages/plugin-sdk/scripts/check-npm-version-guard.mjspass.bb-app, started it with a sandboxedHOME, clicked Install in Settings, and ranbbfrom a clean shell with no Node on PATH against that server. Remove deleted the link, and a differentbbearlier on PATH blocked install with the 409.AppRun;bbworked with no Node on PATH.🤖 Generated with Claude Code