From bb9a12063d9ae0a51536bbc13565527a43eb4a9b Mon Sep 17 00:00:00 2001 From: Parker Henderson Date: Mon, 6 Jul 2026 14:58:34 -0700 Subject: [PATCH 1/2] Rename `bt self update` command to `bt update` --- .github/workflows/release-canary.yml | 6 +-- .github/workflows/release.yml | 6 +-- .github/workflows/smoke-install-minimal.yml | 4 +- README.md | 42 ++++++++++----------- src/main.rs | 17 ++++++++- src/self_update.rs | 10 ++--- tests/cli.rs | 30 +++++++++++++++ 7 files changed, 79 insertions(+), 36 deletions(-) diff --git a/.github/workflows/release-canary.yml b/.github/workflows/release-canary.yml index ec97ce4..03dd8ce 100644 --- a/.github/workflows/release-canary.yml +++ b/.github/workflows/release-canary.yml @@ -473,7 +473,7 @@ jobs: run: | export PATH="${XDG_BIN_HOME:-$HOME/.local/bin}:$PATH" bt --version | grep -i canary - bt self update --check + bt update --check smoke-install-macos: needs: @@ -496,7 +496,7 @@ jobs: run: | export PATH="${XDG_BIN_HOME:-$HOME/.local/bin}:$PATH" bt --version | grep -i canary - bt self update --check + bt update --check smoke-install-windows: needs: @@ -527,4 +527,4 @@ jobs: throw "expected canary version string, got: $version" } $env:PATH = "$binDir;$env:PATH" - & $btExe self update --check + & $btExe update --check diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 96e473a..d996152 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -436,7 +436,7 @@ jobs: shell: bash run: | export PATH="${XDG_BIN_HOME:-$HOME/.local/bin}:$PATH" - bt self update --check --channel stable + bt update --check --channel stable smoke-install-macos: needs: @@ -459,7 +459,7 @@ jobs: run: | export PATH="${XDG_BIN_HOME:-$HOME/.local/bin}:$PATH" bt --version - bt self update --check --channel stable + bt update --check --channel stable smoke-install-windows: needs: @@ -487,7 +487,7 @@ jobs: } & $btExe --version $env:PATH = "$binDir;$env:PATH" - & $btExe self update --check --channel stable + & $btExe update --check --channel stable publish-npm: needs: diff --git a/.github/workflows/smoke-install-minimal.yml b/.github/workflows/smoke-install-minimal.yml index 1bfd486..0b00719 100644 --- a/.github/workflows/smoke-install-minimal.yml +++ b/.github/workflows/smoke-install-minimal.yml @@ -143,5 +143,5 @@ jobs: export PATH="${CARGO_HOME:-$HOME/.cargo}/bin:$PATH" bt --version bt --help >/dev/null - bt self update --check --channel stable - bt self update --check --channel canary + bt update --check --channel stable + bt update --check --channel canary diff --git a/README.md b/README.md index 7eb2101..de77e90 100644 --- a/README.md +++ b/README.md @@ -65,19 +65,19 @@ curl -fsSL -O "https://github.com/braintrustdata/bt/releases/download//bt-< shasum -a 256 -c "bt-.tar.gz.sha256" ``` -## Self Update +## Update -`bt` can self-update when installed via the official installer. +`bt` can update itself when installed via the official installer. ```bash # update on the current build channel (canary for local/dev builds, stable for official releases) -bt self update +bt update # check without installing -bt self update --check +bt update --check # switch/update to latest mainline canary -bt self update --channel canary +bt update --channel canary ``` If `bt` was installed via npm, use that to update instead. @@ -103,26 +103,26 @@ Remove-Item -Recurse -Force (Join-Path $env:APPDATA "bt") -ErrorAction SilentlyC ## Troubleshooting - If `bt` is not found after install, start a new shell or add `${XDG_BIN_HOME:-$HOME/.local/bin}` to your `PATH`. -- If `bt self update --check --json` hits GitHub API limits in CI, set `GITHUB_TOKEN` in the environment. +- If `bt update --check --json` hits GitHub API limits in CI, set `GITHUB_TOKEN` in the environment. - If your network blocks GitHub asset downloads, install from a machine with direct access or configure your proxy/firewall to allow `github.com` and `api.github.com`. ## Commands -| Command | Description | -| ---------------- | ------------------------------------------------------------------ | -| `bt init` | Initialize `.bt/` config directory and link to a project | -| `bt auth` | Authenticate with Braintrust | -| `bt switch` | Switch org and project context | -| `bt status` | Show current org and project context | -| `bt datasets` | Manage datasets and dataset pipelines | -| `bt eval` | Run eval files (Unix only) | -| `bt sql` | Run SQL queries against Braintrust | -| `bt view` | View logs, traces, and spans | -| `bt projects` | Manage projects (list, create, view, delete) | -| `bt datasets` | Manage remote datasets (list, create, update, view, delete) | -| `bt prompts` | Manage prompts (list, view, delete) | -| `bt sync` | Synchronize project logs between Braintrust and local NDJSON files | -| `bt self update` | Update bt in-place | +| Command | Description | +| ------------- | ------------------------------------------------------------------ | +| `bt init` | Initialize `.bt/` config directory and link to a project | +| `bt auth` | Authenticate with Braintrust | +| `bt switch` | Switch org and project context | +| `bt status` | Show current org and project context | +| `bt datasets` | Manage datasets and dataset pipelines | +| `bt eval` | Run eval files (Unix only) | +| `bt sql` | Run SQL queries against Braintrust | +| `bt view` | View logs, traces, and spans | +| `bt projects` | Manage projects (list, create, view, delete) | +| `bt datasets` | Manage remote datasets (list, create, update, view, delete) | +| `bt prompts` | Manage prompts (list, view, delete) | +| `bt sync` | Synchronize project logs between Braintrust and local NDJSON files | +| `bt update` | Update bt in-place | ## `bt eval` diff --git a/src/main.rs b/src/main.rs index 676e79e..c895ae6 100644 --- a/src/main.rs +++ b/src/main.rs @@ -79,9 +79,9 @@ Data & evaluation Additional docs Manage workflow docs for coding agents - self Self-management commands setup Configure Braintrust setup flows status Show current org and project context + update Update bt in-place Flags --profile Use a saved login profile [env: BRAINTRUST_PROFILE] @@ -144,7 +144,9 @@ enum Commands { Datasets(CLIArgs), /// Manage prompts Prompts(CLIArgs), - #[command(name = "self")] + /// Update bt in-place + Update(CLIArgs), + #[command(name = "self", hide = true)] /// Self-management commands SelfCommand(CLIArgs), /// Manage tools @@ -182,6 +184,7 @@ impl Commands { Commands::Topics(cmd) => &cmd.base, Commands::Datasets(cmd) => &cmd.base, Commands::Prompts(cmd) => &cmd.base, + Commands::Update(cmd) => &cmd.base, Commands::SelfCommand(cmd) => &cmd.base, Commands::Tools(cmd) => &cmd.base, Commands::Scorers(cmd) => &cmd.base, @@ -208,6 +211,7 @@ impl Commands { Commands::Datasets(cmd) => &mut cmd.base, Commands::Topics(cmd) => &mut cmd.base, Commands::Prompts(cmd) => &mut cmd.base, + Commands::Update(cmd) => &mut cmd.base, Commands::SelfCommand(cmd) => &mut cmd.base, Commands::Tools(cmd) => &mut cmd.base, Commands::Scorers(cmd) => &mut cmd.base, @@ -315,6 +319,15 @@ fn try_main() -> Result<()> { Commands::Datasets(cmd) => datasets::run(cmd.base, cmd.args).await?, Commands::Topics(cmd) => topics::run(cmd.base, cmd.args).await?, Commands::Prompts(cmd) => prompts::run(cmd.base, cmd.args).await?, + Commands::Update(cmd) => { + self_update::run( + cmd.base, + self_update::SelfArgs { + command: self_update::SelfSubcommand::Update(cmd.args), + }, + ) + .await? + } Commands::Tools(cmd) => tools::run(cmd.base, cmd.args).await?, Commands::Scorers(cmd) => scorers::run(cmd.base, cmd.args).await?, Commands::Functions(cmd) => functions::run(cmd.base, cmd.args).await?, diff --git a/src/self_update.rs b/src/self_update.rs index e0d2790..cb9a959 100644 --- a/src/self_update.rs +++ b/src/self_update.rs @@ -13,9 +13,9 @@ use crate::http::DEFAULT_HTTP_TIMEOUT; #[derive(Debug, Clone, Args)] #[command(after_help = "\ Examples: - bt self update - bt self update --check - bt self update --channel canary + bt update + bt update --check + bt update --channel canary ")] pub struct SelfArgs { #[command(subcommand)] @@ -388,7 +388,7 @@ fn stable_is_up_to_date(current: &str, release_tag: &str) -> bool { } fn canary_check_message(latest: &str) -> String { - format!("latest canary release: {latest}\nrun `bt self update --channel canary` to install it") + format!("latest canary release: {latest}\nrun `bt update --channel canary` to install it") } fn parse_update_channel(raw: Option<&str>) -> Option { @@ -500,7 +500,7 @@ mod tests { fn canary_check_message_contains_guidance() { let msg = canary_check_message("0.10.0-canary.abc123def456"); assert!(msg.contains("0.10.0-canary.abc123def456")); - assert!(msg.contains("bt self update --channel canary")); + assert!(msg.contains("bt update --channel canary")); } #[test] diff --git a/tests/cli.rs b/tests/cli.rs index 952a95d..acb09bf 100644 --- a/tests/cli.rs +++ b/tests/cli.rs @@ -79,6 +79,36 @@ fn setup_verbose_is_accepted_after_subcommand() { .success(); } +#[test] +fn update_help_exposes_self_update_flags() { + bt_command() + .args(["update", "--help"]) + .assert() + .success() + .stdout(predicate::str::contains("--check")) + .stdout(predicate::str::contains("--channel")); +} + +#[test] +fn self_update_remains_as_hidden_compatibility_path() { + bt_command() + .args(["self", "update", "--help"]) + .assert() + .success() + .stdout(predicate::str::contains("--check")) + .stdout(predicate::str::contains("--channel")); +} + +#[test] +fn top_level_help_shows_update_not_self() { + bt_command() + .args(["--help"]) + .assert() + .success() + .stdout(predicate::str::contains("update Update bt in-place")) + .stdout(predicate::str::contains("self Self-management commands").not()); +} + #[test] fn topics_report_help_accepts_global_org_short_conflict_free() { bt_command() From d02f2e3353bf95bc9a268c1079d814f3f68f66d5 Mon Sep 17 00:00:00 2001 From: Parker Henderson Date: Mon, 6 Jul 2026 17:50:42 -0700 Subject: [PATCH 2/2] ci: update terminology from self-update to update --- .github/workflows/release.yml | 2 +- README.md | 2 +- src/self_update.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d996152..f70e588 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -432,7 +432,7 @@ jobs: export PATH="${XDG_BIN_HOME:-$HOME/.local/bin}:$PATH" bt --version - - name: Verify self-update check + - name: Verify update check shell: bash run: | export PATH="${XDG_BIN_HOME:-$HOME/.local/bin}:$PATH" diff --git a/README.md b/README.md index de77e90..2ff8b7b 100644 --- a/README.md +++ b/README.md @@ -395,7 +395,7 @@ Skill smoke-test harness: ## Roadmap / TODO -- Add richer channel controls for self-update (for example pinned/branch canary selection). +- Add richer channel controls for `bt update` (for example pinned/branch canary selection). - Expand release verification and smoke tests for installer flows across more architectures/environments. - Add `bt eval` support on Windows (today, `bt eval` is Unix-only due to Unix socket usage). - Add signed artifact verification guidance (signature flow) in install and upgrade docs. diff --git a/src/self_update.rs b/src/self_update.rs index cb9a959..e7c3a5e 100644 --- a/src/self_update.rs +++ b/src/self_update.rs @@ -139,7 +139,7 @@ fn ensure_installer_managed_install() -> Result<()> { } anyhow::bail!( - "self-update is only supported for installer-based installs.\ncurrent executable: {}\nif this was installed with Homebrew/apt/choco/etc, update with that package manager", + "update is only supported for official installer installs.\ncurrent executable: {}\nif this was installed with npm, update with npm; otherwise reinstall with the official installer", exe.display() ); }