CLI: Global Options

Try the Web CLI demo right here in your browser!

Running the CLI

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 root package.json scripts directly even without an alias set up.

Examples use an implied bw alias for brevity instead of bunx bun-workspaces.

Using bunx is preferred over a global install, because it ensures version consistency within projects that have installed it.

Stale Workspace Data

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, such as changing a name or adding/removing one. This is because bun.lock lists workspaces and is used as the source of truth.

Required Bun version: ^1.2.0

All Global Options

Global options should come before any commands.

Working Directory

Usage: --cwd | -d

Get the project root from a specific directory. This should be where the root package.json of your project is located.

Examples:
bw --cwd=/path/to/your/project list-workspaces
bw -d /path/to/your/project list-workspaces

Run from Workspace Root

Usage: --workspace-root | -w

Run from the project root when you are in a workspace subdirectory. This is similar to pnpm's -w option.

Examples:
cd packages/my-workspace

# Run from the project root
bw --workspace-root ls
bw -w ls

# Similar to pnpm -w run
# "@root" references the root package like a workspace
bw -w run my-root-script @root

Include Root

Usage: --include-root | -r

Include the root workspace as a normal workspace. This overrides config and environment variable settings.

Examples:
bw --include-root list-workspaces
bw -r list-workspaces

bw --no-include-root list-workspaces # disable (to override config/env)

Disable Executable Configs

Usage: --disable-executable-configs

Disable loading of executable config files (written in TS/JS) for untrusted contexts. This can be set by default using the environment variable BW_DISABLE_EXECUTABLE_CONFIGS_DEFAULT=true.

Examples:
bw --disable-executable-configs list-workspaces

See more on the Root Workspace.



Log Level

Usage: --log-level | -l

Values: debuginfowarnerrorsilent

Default Value: info

Set the logging level. For the run-script (run) command, silence output with --output-style=none.

Examples:
bw --log-level=debug list-workspaces
bw -l error list-workspaces