CLI
The BugBug CLI (@bugbug-io/cli) runs and manages BugBug tests from the terminal. Use it to run tests or suites in CI/CD pipelines, download JUnit reports, export and import tests and projects, and install BugBug for AI agents.
Use the CLI when you want ready-made commands. Use the TypeScript SDK to build a Node.js or TypeScript integration, and the Public API for direct HTTP calls.
Install
You need Node.js 24 or newer and npm 11 or newer.
Or run it without a global install:
Sign in
On your own machine: browser login
This opens BugBug in the browser and stores a user token in ~/.bugbug/config.yaml. You don't need to copy a token by hand. bugbug logout removes it.
In CI and scripts: project API token
Use the project API token wherever a browser login isn't possible: CI/CD, shared runners, scripts.
Open your project in BugBug.
Go to Integrations → API Token.
Copy the API Token.
The Integrations → CLI tab shows the same token inside a complete command you can copy.
Pass it in an environment variable, which is the usual way in CI:
or as an option:
The token belongs to one project, so commands run with it always work on that project.
Link a directory to a project
Run bugbug init in your repository to pin it to one BugBug project:
In a non-interactive shell, pass the token and the project ID:
init writes the project ID to bugbug.yaml in the current directory and stores the token separately in ~/.bugbug/config.yaml. Commands run from that directory or its subdirectories then use that project.
Find a test or suite ID
In the app, open the test or suite, open its menu and choose Run via CLI or webhook. Or list them in the terminal:
bugbug tests show <test-id> and bugbug suites show <suite-id> print the details of one item.
Run tests and suites
The run starts in the cloud. The CLI prints the run ID, shows status changes, and waits for the final result.
-p, --profile <name>
Run with this profile, by name. Without it, the default profile is used.
--variable <key=value>
Override a variable for this run only. Repeatable. The variable must already exist in the project.
--tag <name>
Assign a tag to the run. Repeatable. Missing tags are created.
--reporter junit
Save a JUnit report when the run ends. The default reporter, inline, prints the result in the terminal.
--output-path <path>
Where to save the JUnit report. Only with --reporter junit. Default: bugbug-test-<run-id>-junit.xml or bugbug-suite-<run-id>-junit.xml.
--timeout <minutes>
How long to wait for the result. Default: 5 minutes for a test, 10 minutes for a suite.
--no-wait
Start the run and exit right away, without waiting for the result.
Exit codes
0
The run passed.
2
The run failed.
3
The run was stopped.
1
Any other result or error: the run ended with an error, the wait timed out, authentication failed, or the command was invalid.
Any code other than 0 fails a CI step, so the build fails when a test fails.
Run in CI/CD
Store the project API token as a secret named
BUGBUG_API_TOKEN. Don't usebugbug loginin CI.--cigives plain, non-interactive output. It's on automatically when theCIenvironment variable istrue, which most CI services set.Use
--jsonto get machine-readable output instead.Publish
report.xmlwith your CI's JUnit test report step.
Work with existing runs
testruns show and suiteruns show also accept --reporter junit --output-path <path>.
Tags and notes
tags set replaces the current tags. Leave out --tag to clear them. See Tags.
Export and import
--conflict-mode overwrite
If a test or component with the same slug already exists, update it.
--conflict-mode skip
If it already exists, leave it unchanged.
--folder-id <id>
Put the imported test in this test folder. Overrides the folder recorded in a ZIP.
Without
--conflict-mode, a test whose slug already exists isn't imported. Always set it in scripts.The file must end in
.yaml,.ymlor.zip.project importalways creates a new project.
For the file format, ZIP layout and how slugs match existing items, see YAML schema and Importing.
Use the CLI with AI agents
The BugBug Plugin is the recommended way to connect an AI coding agent to BugBug. It installs BugBug MCP and BugBug Skills together:
Supported --agent values are cursor, claude, vscode, codex and copilot. Add --dry-run to see what would be installed without writing files. The plugin installer has no --token option: the AI client signs in to BugBug MCP on its own.
Read more: BugBug Plugin.
Configuration
The CLI looks for the token and project in this order, and uses the first value it finds:
Command-line options:
--token,--project-id.Environment variables:
BUGBUG_API_TOKEN,BUGBUG_PROJECT_ID.bugbug.yamlin the current directory or a parent directory..envin the current directory or a parent directory.The global config
~/.bugbug/config.yaml, written bybugbug loginandbugbug init.
BUGBUG_API_TOKEN
API token used to authenticate.
BUGBUG_PROJECT_ID
Project ID. Needed with a user token from bugbug login when no project is linked or selected.
BUGBUG_TELEMETRY
Set to false to disable telemetry.
DO_NOT_TRACK
Set to 1 or true to disable telemetry.
CI
When true, forces plain, non-interactive output.
Global options
-t, --token <token>
API token. Overrides every other source.
-p, --project-id <projectId>
Project ID, when the token isn't tied to one project.
-v, --verbose
Verbose output, including HTTP requests.
--ci
Plain, non-interactive output for CI.
--json
JSON output.
--disable-telemetry
Disable telemetry.
-h, --help
Show help. Works on every command: bugbug tests run --help.
All commands
Run bugbug without arguments in a terminal to open the interactive navigator.
bugbug login / bugbug logout
Sign in with the browser / remove the stored login.
bugbug init
Link the current directory to a project.
bugbug tests list / show <test-id>
List tests / show one test.
bugbug tests run <test-id>
Run a test.
bugbug tests export <test-id>
Export a test as YAML or ZIP.
bugbug tests import <file>
Import a test from YAML or ZIP.
bugbug tests tags set <test-id>
Replace a test's tags.
bugbug suites list / show <suite-id>
List suites / show one suite.
bugbug suites run <suite-id>
Run a suite.
bugbug suites tags set <suite-id>
Replace a suite's tags.
bugbug testruns show/logs/stop/report <run-id>
Show, get logs, stop, or download the JUnit report of a test run.
bugbug testruns tags set / notes set <run-id>
Set a test run's tags / note.
bugbug suiteruns show/stop/report <run-id>
Show, stop, or download the JUnit report of a suite run.
bugbug suiteruns tags set / notes set <run-id>
Set a suite run's tags / note.
bugbug profiles list
List run profiles.
bugbug tags list
List project tags with colors and usage counts.
bugbug project settings
Show project settings.
bugbug project export / import <file>
Export the project as ZIP / import a project ZIP.
bugbug plugin
Install the BugBug Plugin for AI agents.
Shorthands:
bugbug run test <id> / run suite <id>
tests run / suites run
bugbug list test / suite / profile
tests list / suites list / profiles list
bugbug stop test <run-id> / stop suite <run-id>
testruns stop / suiteruns stop
bugbug logs test <run-id>
testruns logs
bugbug export test <id> / export project
tests export / project export
bugbug import test <file> / import project <file>
tests import / project import
FAQ
Last updated
Was this helpful?
