Wasm Shell Plugins
The Wasm Shell (wash
) CLI is extensible via a component-driven plugin system. New integrations and functionality can be implemented across any language that compiles to a WebAssembly component target, and then the component can plug in directly to wash
.
Built-in Plugins
wash
comes with a few built-in plugins for functionality like using the wasi-blobstore interface
in wash dev
sessions or facilitating OAuth. Plugin discovery is automatic, so those plugins being "built-in" simply means that they are included "out of the box."
Subcommands
The wash plugin
command takes the following subcommands:
install
- Install a plugin from an OCI reference or fileuninstall
- Uninstall a pluginlist
- List installed pluginstest
- Test a plugin
Install a plugin
Install a plugin from an OCI reference or file:
wash plugin install <SOURCE>
See the command reference for complete command options.
Uninstall a plugin
Uninstall a plugin by name:
wash plugin uninstall <NAME>
See the command reference for complete command options.
List installed plugins
List installed plugins:
wash plugin list
See the command reference for complete command options.
Test a plugin
Test a plugin by filepath to the component or component project, and the argument you wish to pass to the plugin:
wash plugin test <PLUGIN> <ARG>
See the command reference for complete command options.
Developing plugins
The plugin model is under rapid development, and the wasmcloud:wash/plugin
interface is subject to regular changes. Feedback on the interface is welcome on the wash
Issues page.
Wasm Shell plugins are standard component projects, with a wit
directory and WIT world defining imports and exports. You can find examples in the plugins subfolder on GitHub.
Plugins export on the wasmcloud:wash/plugin
interface, and have access to the following WASI interfaces:
wasi@0.2
core interfaces (cli
,filesystem
,io
)wasi:http/incoming-handler
: Enables command plugins (see below) to support use-cases for components that can be interacted with over HTTPwasi:http/outgoing-handler
: To make outgoing HTTP requestswasi:config/runtime
: For configuration fetchingwasi:logging/logging
: For structured/leveled output
wash
plugins are integrated into multiple places in the lifecycle of the CLI:
Hooks
Plugins can run at various hook points before and after any built-in wash
command:
BeforeDev
: Before awash dev
session (e.g., Launch an OTEL dashboard for tracing/logging/metrics data)BeforePush
: Before an OCI push (e.g., Add an additional annotation onto the OCI artifact config)AfterBuild
: After a Wasm binary build (e.g., Usecosign
to sign a component)AfterDev
: After awash dev
session (e.g., Inspect the built component and generate a deployment manifest for it)
Commands
Plugins can also register top-level commands in wash
, or register top-level commands with a list of subcommands.
Command plugins are registered directly into the CLI parsing and appear just like built-in commands, but they execute as component plugins. For example, the oauth
plugin launches an HTTP server on execution of the command. Command plugins do not have their own hooks.
You can see the hook and command flow in the diagram below: