pluginlab 0.1.0

Command-line interface host for Terminal REPL with plugin system (using WebAssembly Component Model)
Documentation

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:

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

cargo install pluginlab

Usage

Run the CLI host, loading the plugins from the web (you can also load them from local files).

pluginlab\
  --repl-logic https://topheman.github.io/webassembly-component-model-experiments/plugins/repl_logic_guest.wasm\
  --plugins https://topheman.github.io/webassembly-component-model-experiments/plugins/plugin_greet.wasm\
  --plugins https://topheman.github.io/webassembly-component-model-experiments/plugins/plugin_ls.wasm\
  --plugins https://topheman.github.io/webassembly-component-model-experiments/plugins/plugin_echo.wasm\
  --plugins https://topheman.github.io/webassembly-component-model-experiments/plugins/plugin_weather.wasm

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)>