Skip to content

CLI Reference

Bazelle provides a command-line interface for generating and managing Bazel BUILD files.

Commands

update

Generate and update BUILD files for your project. Learn more →

fix

Fix BUILD files, potentially making breaking changes. Learn more →

init

Initialize a new Bazel project with Gazelle support. Learn more →

watch

Watch for file changes and auto-update BUILD files. Learn more →

daemon

Manage the background daemon for improved performance. Learn more →

Global Options

These flags are available for all commands:

-v, --verbosity int Verbosity level (default 1)
0 = error only
1 = warnings
2 = info
3 = debug
4 = trace
--log-format Log format: text (default) or json

Usage

Terminal window
bazelle [command] [flags] [path...]

Examples

Terminal window
# Update BUILD files in current directory
bazelle update
# Update specific directory
bazelle update ./src
# Check if BUILD files are up to date (CI)
bazelle update --check
# Initialize a new project
bazelle init
# Watch for changes during development
bazelle watch
# Start daemon for improved performance
bazelle daemon start
# Check daemon status
bazelle daemon status
# Show version
bazelle version

Exit Codes

CodeMeaning
0Success
1Error or changes needed (with --check)

Passing Gazelle Flags

Unknown flags are passed through to the underlying Gazelle binary:

Terminal window
# Pass Gazelle-specific flags
bazelle update -go_prefix=github.com/org/repo
# Run in bzlmod mode (passed to gazelle)
bazelle update -bzlmod

Getting Help

Terminal window
# Show help
bazelle --help
bazelle help
# Command-specific help
bazelle update --help
bazelle fix --help