Run the CLI via bunx bun-workspaces or alias it to bw, such as via alias bw="bunx bun-workspaces", which can be placed in your shell configuration file, like .bashrc, .zshrc, or similar. You can also invoke bw in your rootpackage.json scripts regardless.
Examples use an implied bw alias for brevity instead of bunx bun-workspaces.
Note that you need to run bun install in your project forbun-workspaces to find your project's workspaces, and you likely must run this again after you've updated your workspaces.
See the Glossary for more fundamental concepts.
Required Bun version: ^1.2.0
# You can add this to .bashrc, .zshrc, or similar.
# You can also invoke "bw" in your root package.json scripts.
alias bw="bunx bun-workspaces"
# List all workspaces in your project
bw list-workspaces
# ls is an alias for list-workspaces
bw ls --json --pretty # Output as formatted JSON
# Get info about a workspace
bw workspace-info my-workspace
bw info my-workspace --json --pretty # info is alias for workspace-info
# Get info about a script, such as the workspaces that have it
bw script-info my-script
# Run the lint script for all workspaces
# that have it in their package.json "scripts" field
bw run-script lint
# run is an alias for run-script
bw run lint my-workspace # Run for a single workspace
bw run lint my-workspace-a my-workspace-b # Run for multiple workspaces
bw run lint my-alias-a my-alias-b # Run by alias (set by optional config)
bw run lint "my-workspace-*" # Run for matching workspace names
bw run lint "alias:my-alias-pattern-*" "path:my-glob/**/*" # Use matching specifiers
bw run lint --args="--my-appended-args" # Add args to each script call
bw run lint --args="--my-arg=<workspaceName>" # Use the workspace name in args
bw run "bun build" --inline # Run an inline command via the Bun shell
bw run lint --parallel # Run in parallel (default: "auto", the available CPU count)
bw run lint --parallel=2 # Run in parallel with a max of 2 concurrent scripts
# Show usage (you can pass --help to any command)
bw help
bw --help
# Show version
bw --version
# Pass --cwd to any command
bw --cwd=/path/to/your/project ls
bw --cwd=/path/to/your/project run my-script
# Pass --log-level to any command (debug, info, warn, error, or silent)
bw --log-level=silent run my-script