Example plugins for the jzero CLI.
This repository collects standalone jzero-* plugin examples and keeps the usage model aligned with the official guide:
When jzero receives an unknown command, it can delegate that command to an external executable instead of modifying the main jzero binary.
A plugin should:
- be named
jzero-<command> - be executable
- be available in
PATH
Examples:
jzero hello->jzero-hellojzero foo bar-> first triesjzero-foo-bar, then falls back tojzero-foo
After a plugin is matched, the remaining arguments are passed to the plugin unchanged.
Plugins are discovered dynamically, so they are not part of the static built-in command list shown by jzero --help.
jzero-hello: a minimal Go plugin example built with Cobra
Each plugin directory is an independent Go module that produces its own jzero-* executable.
jzero-hello demonstrates two common patterns:
- exposing a custom
jzero hellocommand - reading parsed project metadata from
desc/api,desc/proto, anddesc/sqlthroughgithub.com/jzero-io/jzero/cmd/jzero/pkg/plugin
Build the example:
cd jzero-hello
go build -o "$GOBIN/jzero-hello" .Make sure $GOBIN is set and included in PATH.
Use the plugin:
jzero hello --help
cd /path/to/your-jzero-project
jzero hello descThe desc command reads the current working directory and prints any API, Proto, and SQL metadata found under desc/.
- Keep the executable name aligned with the subcommand you want to expose.
- Prefer simple command names. Inside each command segment,
jzeronormalizes-to_before lookup, sojzero my-cmdmaps tojzero-my_cmd. plugin.New()reads from the plugin process working directory, so it is typically used from ajzeroproject root.- Multi-level commands are supported. For example,
jzero foo bar bazwill first tryjzero-foo-bar, then fall back tojzero-foo.
- Official guide: https://docs.jzero.io/guide/cli-plugin.html
- Example plugin README: ./jzero-hello/README.md