broccoli-dev-cli installs the broccoli-dev 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.
Competing in a contest instead of writing plugins? That's the separate
broccolicommand (packages/contestant-cli).
cargo install broccoli-dev-cliIf you are working in the Broccoli monorepo and want the local checkout instead:
cargo install --path packages/dev-cliThe 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.
Starts the device-code login flow against a Broccoli server.
broccoli-dev login
broccoli-dev login --server http://localhost:3000On 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-dev plugin watch.
Creates a plugin scaffold from the built-in templates.
broccoli-dev plugin new my-plugin --full
broccoli-dev plugin new judge-tools --backend
broccoli-dev plugin new contest-banner --frontendBy default, broccoli-dev 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.
Builds the plugin described by the plugin.toml in the target directory.
broccoli-dev plugin build
broccoli-dev plugin build plugins/ioi
broccoli-dev plugin build plugins/ioi --install
broccoli-dev plugin build plugins/ioi --releaseWhat 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:
[build]
frontend_dir = "web"
frontend_install_cmd = "pnpm install --ignore-workspace"
frontend_build_cmd = "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.
Watches a plugin directory, rebuilds on changes, and uploads new bundles to a Broccoli server.
broccoli-dev login --server http://localhost:3000
broccoli-dev plugin watch plugins/ioi --server http://localhost:3000For 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.--installforces execution of the frontend install command at startup.--releaseuses release builds for backend rebuilds.--debounce <MS>changes the file-watch debounce interval.
You can customize watch behavior with broccoli.dev.toml:
[watch]
ignore = ["*.log", "coverage/"]
[build]
frontend_dir = "web"
frontend_install_cmd = "pnpm install --ignore-workspace"
frontend_build_cmd = "pnpm build"
frontend_dev_cmd = "pnpm dev"Built-in ignores are always active for target/, .git/, and node_modules/.
Create a plugin, build it once, then switch to watch mode while the server is running:
broccoli-dev plugin new my-plugin --full
cd my-plugin/web
pnpm install
cd ../..
broccoli-dev plugin build my-plugin
broccoli-dev login --server http://localhost:3000
broccoli-dev plugin watch my-plugin --server http://localhost:3000- The published crate name is
broccoli-dev-cli, and the installed binary isbroccoli-dev. broccoli-dev plugin buildandbroccoli-dev plugin watchboth expect to find aplugin.tomlin the target directory.
MIT