Plugins
The Stellar CLI supports plugins in a very simple way. All you need is an executable (it doesn't have to be a binary) in your PATH
that starts with stellar-
and the CLI will automatically detect and load it.
You can also install plugins that are made available publicly. One example is rs-stellar-strkey; you can install it using Rust's cargo:
cargo install --locked stellar-strkey --features cli
That will install the stellar-strkey
binary in your ~/.cargo/bin
directory. For the purpose of this example, we'll assume that directory is already on your $PATH
.
Be careful! Plugins have the same access to your system as the Stellar CLI itself. Only install plugins from sources you trust.
Listing Available Plugins
To list available plugins on your system, use the command stellar plugins --list
:
$ stellar plugins --list
Installed Plugins:
strkey
Creating a New Plugin
As mentioned, before, plugins just need to be an executable available in your PATH
that start with stellar-
. Start by creating a new file named stellar-hello
. This example shows how to create a plugin using bash
, so you need a system that supports it (Unix-based, or Windows' WSL).
touch ~/.bin/stellar-hello
Add the following content to the file:
#!/usr/bin/env bash
echo "hello from stellar plugin"
Now, make the file executable with chmod
:
chmod +x ~/.bin/stellar-hello
If everything is set up properly (i.e. the ~/.bin
is in your PATH
and ~/.bin/stellar-hello
is executable), you should be able to find it:
$ stellar plugins --list
Installed Plugins:
hello
strkey
Finally, you can execute it by calling stellar hello
:
$ stellar hello
hello from stellar plugin
Troubleshooting
If Stellar CLI can't find your plugin, make sure you clear all items above:
- Ensure the file starts with
stellar-
- Verify it's executable (
chmod +x
) - Check that its location is in your
PATH
- Restart your terminal or reload your shell configuration