cyb/wysm/crates/cli.md

The Wasmi CLI Application

A lightweight WebAssembly interpreter CLI built on top of the Wasmi crate.

This application provides a command-line interface for executing WebAssembly modules (.wasm) and WebAssembly script files (.wast). It supports WASI, configurable compilation strategies and fuel metering.

For details about the Wasmi project itself (architecture, design goals, embedding API, no_std support, etc.), see the Wasmi repository or the Wasmi blog.

Overview

wasmi is intended for:

  • Deterministic and efficient WebAssembly execution
  • Embedded and constrained environments
  • WASI-compatible execution

Build / Install

Build from source:

cargo build --release --package wasmi_cli

The resulting binary will be located at target/release/wasmi from the root of the git repository.

Alternatively, build and install the wasmi binary from the latest release on crates.io:

cargo install wasmi_cli

NOTE: codegen-units = 1 is required to avoid stack overflows when not using wasmi's portable-dispatch feature. This configuration is preset in Wasmi's release profile.

Usage

wasmi [OPTIONS] [ARGS]...
wasmi <COMMAND>

Commands

Command Description
run Executes a WebAssembly module
wast Executes a WebAssembly Script (.wast) file
help Prints help information

When no command is provided, the run command is used if the run crate feature is enabled. This feature is enabled by default.

Running a WebAssembly Module

Execute the foo.wasm Wasm module.

wasmi foo.wasm

Execute the foo.wasm Wasm module and provide a b c as WASI arguments.

wasmi foo.wasm a b c

Execute the function bar from the foo.wasm Wasm module and provide a b c as parameters.

wasmi foo.wasm --invoke bar a b c

WASI Integration

Wasmi provides support for WASI 0.1 (preview 1, released in 2019). There is presently no plan to officially add support for WASI 0.2 or newer.

Pre-open Directories

Preopen a host directory for guest access.

wasmi foo.wasm --dir ./data

Environment Variables

Add an environment variable visible to the guest.

wasmi foo.wasm --env FOO=bar

TCP Listening Socket

Provide a listening socket to the module for WASI socket operations.

wasmi foo.wasm --tcplisten 127.0.0.1:8080

Compilation Modes

Control Wasmi’s compilation mode:

wasmi foo.wasm --compilation-mode <MODE>

Where <MODE> is any of eager, lazy-translation or lazy.

Fuel Metering

Enable deterministic execution fuel limits to make sure any execution halts.

wasmi foo.wasm --fuel 1000

Executing .wast Files

wasmi wast foo.wast

Executes the foo.wast Wasm script.

This is primarily intended for specification testing, conformance validation and regression testing of the Wasmi interpreter.

Crate Features

Feature Default Description
run Enables execution of WebAssembly modules (.wasm). This is the primary functionality most users require. Can be disabled via --no-default-features to build a reduced binary.
wat Allows the run command to accept WebAssembly Text (.wat) modules in addition to .wasm.
wast Enables execution of WebAssembly Script (.wast) files. Primarily intended for specification testing and interpreter debugging. Enabled by default for CLI parity with other WebAssembly runtimes.
wasi Enables WASI support when executing modules via run, including environment variables, preopened directories, and socket support.
simd Enables support for WebAssembly SIMD proposal for both module execution and script testing. Disabled by default due to significant bloat.
portable-dispatch Allows to compile Wasmi universally at the cost of execution performance. Use --profile bench to counteract performance regressions to some extend.
indirect-dispatch Uses a slightly more compact IR encoding at the cost of execution performance.
unstable Enables unstable Rust compiler features in Wasmi. (e.g. become) Only usable when disabling default features via --no-default-features and requires a nightly Rust compiler.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Folder

Homonyms

cli
feature of go-cyber cyber query bandwidth load: query the bandwidth load neuron: query the neuron bandwidth params: query the bostrom/bandwidth module parameters information price: query the bandwidth price total: query the total bandwidth
soft3/cli
soft3 CLI `soft3` — command-line interface to the soft3 stack. commands implementation Rust binary. depends on: `hemera` (particle computation) `bbg` (proof verification) `lens` (Lens opening verification) not yet implemented — scaffold only. blocked on: BBG proof serialisation (serde for…
cyber/cli
warriors/trisha/cli
cli
soft3/hemera/cli
cli
soft3/cybergraph/cli
cli
soft3/zheng/cli
cli
soft3/bbg/cli
cli
soft3/nox/cli
cli
soft3/tru/cli
cli
neural/rune/cli
cli
neural/eidos/cli
cli
soft3/strata/nebu/cli
cli
soft3/cybergraph/specs/cli
cybergraph cli a command-line console for the cyberlink processor: declare intents, seal and link signals, query the graph with inf, and inspect the per-neuron chains. `cybergraph`'s verb is **link** — the CLI is the processor's console, one layer above the bbg state store (`bbg` CLI). scope — the…
neural/trident/src/cli
cli
neural/inf/rs/cli
cli
soft3/strata/trop/cli
cli
soft3/strata/genies/cli
cli
soft3/strata/jali/cli
cli
soft3/bbg/specs/cli
bbg cli a command-line tool for the authenticated state layer: inspect the committed state, apply signals, finalize blocks, and prove/verify records. `bbg`'s verb is **store** — the CLI is the store's console, the way `redb`/`sqlite` ship a shell for their engine. scope — what it is, and is not bbg…
neural/trident/reference/cli
⌨️ CLI Reference [← Language Reference](/neural/trident/reference/language) Three-Register Flags Trident uses a **three-register** naming model for targets. Each register has two synonyms — one *geeky* (technical) and one *gamy* (metaphorical) — plus a *universal* shorthand for backward…
soft3/glia/run/cli
cli
soft3/strata/kuro/cli
cli
soft3/zheng/specs/cli
cli the `zheng` command-line face of the proof system. drives the library's five entry points from a shell and emits results as a tape chunk stream. invocation output convention — one channel (stdout), two renderings of the same data: **interactive** (stdout is a terminal) — styled ANSI: a gradient…
soft3/glia/import/specs/cli
import CLI surface What the `mi` binary (the CLI entry point of the `import` crate) exposes today. Subcommands | Subcommand | Purpose | Source | |---|---|---| | `mi import ` | Convert source directory → `~/llm/.model` | `main.rs::run_import` | | `mi list` | List HF cache entries under…
bootloader/space-pussy/x/resources/client/cli
cli
bootloader/go-cyber/x/graph/client/cli
cli
bootloader/space-pussy/x/bandwidth/client/cli
cli
bootloader/space-pussy/x/dmn/client/cli
cli
bootloader/space-pussy/x/rank/client/cli
cli
bootloader/go-cyber/x/bandwidth/client/cli
cli
bootloader/go-cyber/x/resources/client/cli
cli
bootloader/go-cyber/x/tokenfactory/client/cli
cli
bootloader/go-cyber/x/grid/client/cli
cli
bootloader/go-cyber/x/clock/client/cli
cli
bootloader/go-cyber/x/rank/client/cli
cli
bootloader/space-pussy/x/graph/client/cli
cli
bootloader/space-pussy/x/grid/client/cli
cli
bootloader/go-cyber/x/dmn/client/cli
cli
bootloader/go-cyber/x/liquidity/client/cli
cli

Graph