broccoli-cli
broccoli-cli installs the broccoli command.
It is the command-line tool used to scaffold Broccoli plugins, build them locally, and watch a plugin directory while pushing changes to a running Broccoli server.
Install
If you are working in the Broccoli monorepo and want the local checkout instead:
What it does
The CLI currently covers four jobs:
- Sign in to a Broccoli server with the device-code flow.
- Scaffold a new plugin directory with backend, frontend, or full templates.
- Build a plugin's backend WASM and frontend bundle from
plugin.toml. - Watch a plugin directory, rebuild on changes, and upload the result.
Commands
broccoli login
Starts the device-code login flow against a Broccoli server.
On success, credentials are stored in ~/.config/broccoli/credentials.json. You
can also override them per command with BROCCOLI_URL and BROCCOLI_TOKEN, or
by passing --server and --token to broccoli plugin watch.
broccoli plugin new
Creates a plugin scaffold from the built-in templates.
By default, broccoli plugin new asks which kind of scaffold to generate. Use
--backend, --frontend, or --full to make the command non-interactive.
Useful flags:
-o, --output <DIR>writes the scaffold somewhere other than./<name>.--server-sdk <SPEC>changes the backend SDK dependency written into the generatedCargo.toml.--web-sdk <SPEC>changes the frontend SDK dependency written into the generatedpackage.json.
broccoli plugin build
Builds the plugin described by the plugin.toml in the target directory.
What gets built depends on the manifest:
- If the manifest has a
[server]section, the CLI runscargo build --target wasm32-wasip1and copies the built artifact to the manifest's configured entry path. - If the manifest has a
[web]section, the CLI runs a frontend build command and leaves the output in the manifest's configured web root.
If your frontend is not in the default location, add a broccoli.dev.toml next
to plugin.toml:
[]
= "web"
= "pnpm build"
Without that file, the CLI tries to infer the frontend directory from
[web].root, then falls back to web/, frontend/, or the plugin root if a
package.json is present.
broccoli plugin watch
Watches a plugin directory, rebuilds on changes, and uploads new bundles to a Broccoli server.
For backend changes, the CLI rebuilds the WASM module itself. For frontend plugins, it starts a long-running dev command and watches the output directory for fresh assets before packaging and uploading again.
Useful flags:
--server <URL>overrides the saved server URL.--token <TOKEN>overrides the saved token.--releaseuses release builds for backend rebuilds.--debounce <MS>changes the file-watch debounce interval.
You can customize watch behavior with broccoli.dev.toml:
[]
= ["*.log", "coverage/"]
[]
= "web"
= "pnpm build"
= "pnpm dev"
Built-in ignores are always active for target/, .git/, and node_modules/.
Typical workflow
Create a plugin, build it once, then switch to watch mode while the server is running:
Notes
- The published crate name is
broccoli-cli, but the installed binary isbroccoli. broccoli plugin buildandbroccoli plugin watchboth expect to find aplugin.tomlin the target directory.
License
MIT