Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/release-canary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand Down Expand Up @@ -527,4 +527,4 @@ jobs:
throw "expected canary version string, got: $version"
}
$env:PATH = "$binDir;$env:PATH"
& $btExe self update --check
& $btExe update --check
8 changes: 4 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -432,11 +432,11 @@ 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"
bt self update --check --channel stable
bt update --check --channel stable

smoke-install-macos:
needs:
Expand All @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/smoke-install-minimal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
44 changes: 22 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,19 +65,19 @@ curl -fsSL -O "https://github.com/braintrustdata/bt/releases/download/<tag>/bt-<
shasum -a 256 -c "bt-<target>.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.
Expand All @@ -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`

Expand Down Expand Up @@ -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.
17 changes: 15 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 <PROFILE> Use a saved login profile [env: BRAINTRUST_PROFILE]
Expand Down Expand Up @@ -144,7 +144,9 @@ enum Commands {
Datasets(CLIArgs<datasets::DatasetsArgs>),
/// Manage prompts
Prompts(CLIArgs<prompts::PromptsArgs>),
#[command(name = "self")]
/// Update bt in-place
Update(CLIArgs<self_update::UpdateArgs>),
#[command(name = "self", hide = true)]
/// Self-management commands
SelfCommand(CLIArgs<self_update::SelfArgs>),
/// Manage tools
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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?,
Expand Down
12 changes: 6 additions & 6 deletions src/self_update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down Expand Up @@ -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()
);
}
Expand Down Expand Up @@ -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<UpdateChannel> {
Expand Down Expand Up @@ -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]
Expand Down
30 changes: 30 additions & 0 deletions tests/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Loading