Quick Start
This guide will help you install bz and start using it to manage Bazel module dependencies.
Installation
go install github.com/albertocavalcante/bz@latestgit clone https://github.com/albertocavalcante/bz.gitcd bzgo build -o bz .Verify the installation:
bz versionBasic Usage
-
Initialize a Bazel module
Create a new MODULE.bazel file:
Terminal window bz init --name=my_projectThis creates a MODULE.bazel with:
module(name = "my_project",version = "0.0.0",) -
Add dependencies
Add modules from the Bazel Central Registry:
Terminal window bz mod add rules_go@0.50.1bz mod add rules_python@0.35.0Your MODULE.bazel now includes:
bazel_dep(name = "rules_go", version = "0.50.1")bazel_dep(name = "rules_python", version = "0.35.0") -
List your dependencies
View all dependencies in your MODULE.bazel:
Terminal window bz mod listOutput:
rules_go@0.50.1rules_python@0.35.0 -
Check for updates
See if newer versions are available:
Terminal window bz mod outdatedOutput:
Module Current Latest------ ------- ------rules_go 0.50.1 0.50.2 -
Update dependencies
Update to the latest versions:
Terminal window bz mod update
Explore Your Dependencies
Visualize the dependency graph
bz mod graphOutput:
my_project├── rules_go@0.50.1│ ├── bazel_skylib@1.5.0│ └── platforms@0.0.8└── rules_python@0.35.0 └── bazel_skylib@1.5.0Get dependency statistics
bz mod statsOutput:
Dependency Statistics: Direct dependencies: 2 Transitive dependencies: 3 Total modules: 5 Max depth: 2 Dev dependencies: 0Find out why a module is included
bz mod why bazel_skylibOutput:
bazel_skylib is required by: my_project -> rules_go@0.50.1 -> bazel_skylib@1.5.0 my_project -> rules_python@0.35.0 -> bazel_skylib@1.5.0Security Checks
Scan for vulnerabilities
bz auditCheck license compliance
bz mod licensesbz mod licenses --check --deny=GPL-3.0Shell Completions
Enable tab completion for your shell:
bz completion bash > /etc/bash_completion.d/bzbz completion zsh > "${fpath[1]}/_bz"bz completion fish > ~/.config/fish/completions/bz.fishCheck Your Setup
Run the doctor command to verify everything is configured correctly:
bz doctorOutput:
Checking Bazel setup...
✓ Bazel installed (7.0.0)✓ MODULE.bazel found✓ .bazelversion found (7.0.0)✓ Bzlmod enabled (default in Bazel 7+)✓ Registry reachable (bcr.bazel.build)
All checks passed!What’s Next?
- CLI Reference - Complete command documentation
- Configuration - TOML config and environment variables
- Air-gapped Setup - Offline usage guide
- Security Features - Vulnerability scanning and SBOM generation