pluginlab
Command-line interface host for Terminal REPL with plugin system (using WebAssembly Component Model).
The goal of this project is to demonstrate the power of the WebAssembly Component Model, with more than a simple hello world.
It is a basic REPL, with a plugin system where:
- plugins can be written in any language compiling to WebAssembly
- plugins are sandboxed by default
- the REPL logic is written in Rust, it also compiles to WebAssembly
There are two kinds of hosts:
- a CLI host, written in Rust running in a terminal (this crate)
- a web host, written in TypeScript running in a browser (see online demo at topheman.github.io/webassembly-component-model-experiments)
Those hosts then run the same codebase which is compiled to WebAssembly:
- the REPL logic
- the plugins
More details on the github repo: topheman/webassembly-component-model-experiments.
Install
Usage
Run the CLI host, loading the plugins from the web (you can also load them from local files).
repl(0)> echo $FOO
toto
repl(0)> greet $FOO
Hello, toto!
repl(0)> ls wit
wit/host-api.wit
wit/plugin-api.wit
wit/shared.wit
repl(0)> weather Paris
Sunny
repl(0)> weather New York
Partly cloudy
repl(0)> azertyuiop
Unknown command: azertyuiop. Try help to see available commands.
repl(1)> echo $?
1
repl(0)> greet $USER
Hello, Tophe!
repl(0)> echo $0
Hello, Tophe!
repl(0)>