# CLI Reference

Source: https://runvero.dev/docs/cli/
Documentation index: https://runvero.dev/llms.txt

The `runvero` binary builds, tests, runs, distributes, and serves WASI 0.2 tool components. Every command accepts `--help` for the full flag list.

```bash
runvero <COMMAND> [OPTIONS]
```

| Command | Purpose |
| :--- | :--- |
| [`init`](#runvero-init) | Scaffold a new tool project |
| [`build`](#runvero-build) | Compile a project into a `.wasm` component and validate its WIT contract |
| [`test`](#runvero-test) | Run manifest examples and fixtures inside the sandbox |
| [`run`](#runvero-run) | Execute one component, manifest, or OCI reference |
| [`pull`](#runvero-pull) | Download a component from an OCI registry into the local cache |
| [`publish`](#runvero-publish) | Push a built tool to an OCI registry as a digest-bound package |
| [`install`](#runvero-install) | Install a verified OCI tool for local and MCP use |
| [`mcp-installed`](#runvero-mcp-installed) | Serve one installed tool over stdio MCP |
| [`cache`](#runvero-cache) | List, prune, or clear the component cache |
| [`serve`](#runvero-serve) | Start the HTTP and MCP gateway |
| [`keygen`](#runvero-keygen) | Generate a multi-tenant API key for the gateway |
| [`mcp-bridge`](#runvero-mcp-bridge) | Bridge stdio MCP clients to a running gateway |
| [`doctor`](#runvero-doctor) | Check the installation and its packaged helpers |

## Global options

| Flag | Environment | Description | Default |
| :--- | :--- | :--- | :--- |
| `--log-format <FORMAT>` | `RUNVERO_LOG_FORMAT` | Log format: `text` or `json` | `text` |
| `-h, --help` | | Print help | |
| `-V, --version` | | Print version | |

---

## `runvero init`

Scaffold a WASI 0.2 tool project with a `runvero.tool.json` manifest, sample input, test fixtures, a `justfile`, and a README.

```bash
runvero init [PATH] [OPTIONS]
```

`PATH` is the directory to create or populate. It defaults to `--name`, or the current directory when neither is given.

| Flag | Description | Default |
| :--- | :--- | :--- |
| `-l, --lang <LANG>` | Guest language: `rust`, `python`, or `typescript` (`rs`, `py`, `ts` also work) | `rust` |
| `-n, --name <NAME>` | Tool name, normalized to `[a-z0-9_-]` | Directory name |
| `-f, --force` | Overwrite existing files | `false` |

Without `--force`, `init` refuses to write if any generated file already exists. `rust` is the packaged quickstart. The `python` and `typescript` scaffolds currently build only inside a RunVero source checkout, until the `runvero-guest` and `@runvero/guest` SDK packages are published.

The scaffold sets these default resource limits in the manifest:

| Language | Fuel | Memory | Timeout |
| :--- | :--- | :--- | :--- |
| Rust | 5,000,000 | 16 MB | 2,000 ms |
| Python | 50,000,000 | 64 MB | 5,000 ms |
| TypeScript | 50,000,000 | 32 MB | 5,000 ms |

```bash
runvero init weather --lang rust
cd weather
runvero build && runvero test
```

---

## `runvero build`

Compile a tool project into a WASI 0.2 component, then validate it against RunVero's WIT world and the supported WASI 0.2 imports. If a `runvero.tool.json` is present, it is validated too.

```bash
runvero build [PATH] [OPTIONS]
```

`PATH` is a project directory, a `runvero.tool.json` manifest, or a source entrypoint. It defaults to `.`. The language is detected from `Cargo.toml` (Rust), `app.py` or `pyproject.toml` (Python), or `src/app.ts`, `app.ts`, or `package.json` (TypeScript).

| Flag | Description | Default |
| :--- | :--- | :--- |
| `-l, --lang <LANG>` | Override detection: `rust`, `python`, `typescript`, or `wasm` to only validate an existing `.wasm` | Detected |
| `-o, --output <FILE>` | Output `.wasm` path. Must be inside the project; updates the manifest `component` so `runvero test` runs this build | Manifest `component` |
| `--release` | Build Rust in release mode | On for Rust |
| `--debug` | Build Rust in the debug profile (`target/wasm32-wasip2/debug`) for faster iteration | `false` |
| `--emit-manifest` | Regenerate `runvero.tool.json` from the SDK tool definition (Python and TypeScript) | `false` |
| `--json` | Print a machine-readable build and contract report | `false` |

Passing a `.wasm` file as `PATH` validates it without compiling.

### Prerequisites

| Language | Needs | Override |
| :--- | :--- | :--- |
| Rust | `cargo` and the `wasm32-wasip2` target (`rustup target add wasm32-wasip2`) | `RUNVERO_CARGO_BIN`, `RUNVERO_RUSTC_BIN` |
| Python | Python 3.10+ with `componentize-py==0.23.0` | `RUNVERO_PYTHON_BIN` |
| TypeScript | Node.js and `jco` | `RUNVERO_NODE_BIN`, `RUNVERO_TS_CLI_JS` |

---

## `runvero test`

Run fixtures inside the real sandbox. The tool manifest is the ceiling for fuel, memory, timeout, egress, and secrets: flags can only tighten it.

```bash
runvero test [PATH] [OPTIONS]
```

`PATH` is a project directory or a `runvero.tool.json` manifest. It defaults to `.`. By default the suite is the manifest's `examples` plus `tests/fixtures.json`; a fixture in the file replaces an example with the same name.

| Flag | Description | Default |
| :--- | :--- | :--- |
| `--fixtures <FILE>` | Use only this fixtures file instead of the default suite | |
| `-F, --filter <PATTERN>` | Run only fixtures whose name contains this text | |
| `-f, --fuel <N>` | Tighten the fuel budget. Must not exceed the manifest | Manifest, else 10,000,000 |
| `-t, --timeout-ms <MS>` | Tighten the timeout. Must not exceed the manifest | Manifest |
| `-m, --memory-mb <MB>` | Tighten the memory ceiling. Must not exceed the manifest | Manifest, else 64 |
| `--outside-manifest` | Debug run outside the manifest ceiling. Always exits non-zero | `false` |
| `--json` | Print a machine-readable test report | `false` |

`test` also accepts the [egress](#egress-options) and [secret](#secret-options) options, which must stay within the manifest. Raw sockets are always blocked in tests; use `runvero run` for that.

### Fixture format

`tests/fixtures.json` is a JSON array. Each fixture has a `name`, `arguments`, and at most one of `expected_output` or `expected_error`. `expected_error` passes when the error message contains that text, ignoring case. A fixture may also set its own `fuel`, `memory_mb`, `timeout_ms`, and `env`.

```json
[
  {
    "name": "default-greeting",
    "arguments": { "message": "hello runvero" },
    "expected_output": { "processed": "hello runvero", "word_count": 2 }
  },
  {
    "name": "reject-blank-message",
    "arguments": { "message": "   " },
    "expected_error": "message must not be blank"
  }
]
```

The command exits non-zero if any fixture fails or if no fixtures are found.

---

## `runvero run`

Execute a component inside the fuel-metered, epoch-timed sandbox.

```bash
runvero run <COMPONENT> [OPTIONS]
```

`COMPONENT` can be a `.wasm` file, a tool manifest (`runvero.tool.json` or `*.tool.json`), a directory containing `runvero.tool.json`, an OCI reference, or `example` for the bundled example tool.

| Flag | Description | Default |
| :--- | :--- | :--- |
| `-i, --input <INPUT>` | Input payload passed to the tool | `hello runvero`, or the manifest's first example |
| `--args <JSON>` | JSON arguments object, validated against `input_schema` when running a manifest. Conflicts with `--input` | |
| `-f, --fuel <N>` | Instruction fuel budget | `10,000,000` |
| `-m, --memory-mb <MB>` | Memory ceiling in megabytes | `64` |
| `-t, --timeout-ms <MS>` | Wall-clock timeout in milliseconds | Manifest, else none |
| `-r, --raw` | Print only the guest output, without the execution breakdown | `false` |
| `--breakdown-json` | Print output and telemetry as JSON | `false` |

When running a manifest without explicit flags, its `resources` can lower the fuel and memory defaults but never raise them.

`run` also accepts the [egress](#egress-options), [secret](#secret-options), and [registry](#registry-options) options.

```bash
# Run a manifest with structured arguments and a larger budget
runvero run ./weather --args '{"city": "London"}' --fuel 50000000 --memory-mb 32

# Pipe clean output into jq
runvero run tools/analyzer.wasm --input '{"file": "logs.txt"}' --raw | jq .summary

# Let a tool call one API
runvero run ./weather --allow-host api.open-meteo.com
```

---

## `runvero pull`

Download a component from an OCI registry into the local [component cache](#runvero-cache).

```bash
runvero pull <OCI_REFERENCE> [OPTIONS]
```

| Flag | Description | Default |
| :--- | :--- | :--- |
| `--refresh` | Re-resolve a tag against the registry even if it is already cached | `false` |

`pull` accepts the [registry options](#registry-options). A tag pull is refused unless a signature check is configured, the reference is pinned by digest (`@sha256:…`), or `--allow-unverified` is passed.

```bash
runvero pull ghcr.io/runvero-labs/tools/mock-tool:v1 --verify-key cosign.pub
```

---

## `runvero publish`

Publish a built tool project as an OCI package that binds the component and its manifest under one digest.

```bash
runvero publish <OCI_REFERENCE> [OPTIONS]
```

| Flag | Description | Default |
| :--- | :--- | :--- |
| `--path <PATH>` | Project directory or tool manifest to publish | `.` |

`publish` accepts the [registry options](#registry-options). It validates the manifest and component before uploading, then prints the digest-pinned reference and a ready-to-copy `runvero install` command.

Publishing does not sign anything. Sign the printed digest with your cosign or Notation workflow before sharing a tag.

```bash
runvero publish ghcr.io/example/weather:v1 --path ./weather
```

---

## `runvero install`

Download and verify an OCI tool package, then write it to a local directory ready for `run`, `serve`, and MCP clients.

```bash
runvero install <REFERENCE> [OPTIONS]
```

| Flag | Description | Default |
| :--- | :--- | :--- |
| `--tools-dir <DIR>` | Root directory for installs. The tool goes in `<DIR>/<tool-name>/` | `tools` |

`install` accepts the [registry options](#registry-options) and applies the same signature rules as `pull`. It always contacts the registry. An existing tool directory is never overwritten; install upgrades into a separate root.

The install directory contains `tool.wasm`, `runvero.tool.json`, the OCI manifest, an install receipt, and an `mcp-config.json` snippet. `install` prints the tool's requested capabilities and resource defaults; these are requests, not grants.

```bash
runvero install ghcr.io/example/weather@sha256:<digest> --tools-dir ./tools
runvero run ./tools/weather --args '{"city": "London"}'
```

---

## `runvero mcp-installed`

Serve one installed tool to an MCP client over stdio. It opens no network listener and needs no registry access. You normally don't type this yourself: `install` writes it into the generated `mcp-config.json`.

```bash
runvero mcp-installed <DIRECTORY> --reference <PINNED_REFERENCE> [OPTIONS]
```

| Flag | Description | Default |
| :--- | :--- | :--- |
| `--reference <REF>` | The digest-pinned reference recorded at install time (required) | |
| `--fuel <N>` | Fuel ceiling per call | `10,000,000` |
| `--memory-mb <MB>` | Memory ceiling per call | `64` |
| `--timeout-ms <MS>` | Timeout ceiling per call | `10,000` |

The tool gets no egress or secrets unless you add [egress](#egress-options) or [secret](#secret-options) options to the command.

```json
{
  "mcpServers": {
    "weather": {
      "command": "/absolute/path/to/runvero",
      "args": [
        "mcp-installed", "/absolute/path/to/tools/weather",
        "--reference", "ghcr.io/example/weather@sha256:<digest>"
      ]
    }
  }
}
```

---

## `runvero cache`

Manage the local component cache used by `run` and `pull`.

```bash
runvero cache <list|prune|clean>
```

| Subcommand | Description |
| :--- | :--- |
| `list` | List cached components with digest, size, signature status, and reference |
| `prune [--max-mb <MIB>]` | Remove orphaned blobs and evict least recently used components until the cache fits the budget |
| `clean` | Delete every cached component |

| Environment | Description | Default |
| :--- | :--- | :--- |
| `RUNVERO_CACHE_DIR` | Cache location | `~/.runvero/cache` |
| `RUNVERO_CACHE_MAX_MB` | Size budget in MiB (`0` means unlimited) | `2048` |

---

## `runvero serve`

Start the HTTP REST and Model Context Protocol (MCP) gateway.

```bash
runvero serve [OPTIONS]
```

### Network and tools

| Flag | Environment | Description | Default |
| :--- | :--- | :--- | :--- |
| `-H, --host <IP>` | `RUNVERO_HOST` | Address to bind | `127.0.0.1` |
| `-p, --port <PORT>` | `RUNVERO_PORT` | Port to listen on | `8080` |
| `--tools-dir <DIR>` | `RUNVERO_TOOLS_DIR` | Directory of tools to discover | `target/wasm32-wasip2/debug` if it exists |
| `--max-concurrency <N>` | | Maximum concurrently executing sandboxes | `64` |

### Execution limits

Defaults apply when a request doesn't ask for a value. A request may ask for more, up to the maximum.

| Flag | Description | Default |
| :--- | :--- | :--- |
| `-f, --fuel <N>` | Default fuel per execution | `10,000,000` |
| `-m, --memory-mb <MB>` | Default memory per execution | `64` |
| `-t, --timeout-ms <MS>` | Default timeout per execution | `10,000` |
| `--max-fuel <N>` | Maximum fuel a request may ask for | `1,000,000,000` |
| `--max-memory-mb <MB>` | Maximum memory a request may ask for | `512` |
| `--max-timeout-ms <MS>` | Maximum timeout a request may ask for | `60,000` |

### Authentication

Use one of these. Binding to a non-loopback address without any of them is refused unless you pass `--insecure-no-auth`.

| Flag | Environment | Description |
| :--- | :--- | :--- |
| `--auth-token <TOKEN>` | `RUNVERO_AUTH_TOKEN` | Single bearer token (at least 16 characters) required on every route except `/health` |
| `--tenants-file <PATH>` | `RUNVERO_TENANTS_FILE` | JSON file of multi-tenant API key records from [`keygen`](#runvero-keygen) |
| `--tenants-db <PATH>` | `RUNVERO_TENANTS_DB` | SQLite database of multi-tenant API key records |
| `--insecure-no-auth` | | Allow a non-loopback bind with no authentication |

### Usage and billing

| Flag | Environment | Description | Default |
| :--- | :--- | :--- | :--- |
| `--usage-file <PATH>` | `RUNVERO_USAGE_FILE` | Persist per-tenant usage across restarts | |
| `--stripe-secret-key <KEY>` | `RUNVERO_STRIPE_SECRET_KEY` | Stripe test key (`sk_test_*` or `rk_test_*`) for usage metering. Live keys are refused for now | |
| `--stripe-webhook-secret <SECRET>` | `RUNVERO_STRIPE_WEBHOOK_SECRET` | Signing secret (`whsec_*`) for `POST /v1/webhooks/stripe` | |
| `--stripe-meter-event <NAME>` | `RUNVERO_STRIPE_METER_EVENT` | Stripe Billing Meter event name | `runvero_sandbox_fuel` |
| `--stripe-api-base <URL>` | `RUNVERO_STRIPE_API_BASE` | Stripe API base URL | `https://api.stripe.com` |

`serve` also accepts the [egress](#egress-options) and [secret](#secret-options) options. Here they set the operator ceiling: each request inherits it and can only narrow it.

### Endpoints

* `GET /health`, `GET /v1/health` — Health check.
* `GET /healthz`, `GET /readyz` — Liveness and readiness probes.
* `GET /metrics` — Metrics.
* `GET /v1/tools` — List registered tools and their input schemas.
* `POST /v1/execute` — Execute a tool with fuel and memory budgets.
* `GET /v1/usage` — Per-tenant usage.
* `POST /v1/webhooks/stripe` — Stripe webhook receiver.
* `POST /mcp`, `POST /v1/mcp` — JSON-RPC 2.0 endpoint implementing MCP (`initialize`, `tools/list`, `tools/call`).

```bash
runvero serve --tools-dir ./tools --auth-token "$RUNVERO_AUTH_TOKEN"
```

---

## `runvero keygen`

Generate a multi-tenant API key (`rv_live_*` or `rv_test_*`) and its salted SHA-256 record for `serve --tenants-file` or `--tenants-db`. The raw key is printed once and is not stored.

```bash
runvero keygen --tenant <TENANT> [OPTIONS]
```

| Flag | Description | Default |
| :--- | :--- | :--- |
| `--tenant <ID>` | Tenant identifier, for example `tenant_acme` (required) | |
| `--env <ENV>` | `live` or `test`. Test keys don't inherit operator secrets or egress | `live` |
| `--rps <N>` | Sustained requests per second | `50` |
| `--burst <N>` | Token-bucket burst capacity | `100` |
| `--max-concurrency <N>` | Concurrent executions for the tenant | `16` |
| `--max-fuel <N>` | Per-execution fuel ceiling | |
| `--max-memory-mb <MB>` | Per-execution memory ceiling | |
| `--monthly-fuel-quota <N>` | Total fuel per billing period | |
| `--monthly-execution-quota <N>` | Total executions per billing period | |
| `--stripe-customer-id <ID>` | Stripe Customer (`cus_...`) for metered billing | |
| `--stripe-subscription-id <ID>` | Stripe Subscription (`sub_...`) whose status applies to this tenant | |
| `--billing-tier <TIER>` | Label such as `free`, `pro`, or `enterprise` | |
| `--allow-tool <TOOL>` | Allow only these tools (repeatable). Empty allows all | |
| `--allow-host <RULE>` | Egress for this key (repeatable). Live keys inherit the operator ceiling when omitted; test keys get none | |
| `--expires-at <EPOCH>` | Expiry as Unix epoch seconds | |
| `--tenants-db <PATH>` | Also store the record in this SQLite database (`RUNVERO_TENANTS_DB`) | |
| `--json` | Print `api_key` and `record` as JSON | `false` |

Without `--tenants-db`, append the printed record to your tenants JSON file.

```bash
runvero keygen --tenant tenant_acme --env live --rps 20 --allow-tool weather --json
```

---

## `runvero mcp-bridge`

Connect an MCP client that only speaks stdio to a running `runvero serve` gateway. It reads JSON-RPC lines from stdin, forwards each to the gateway, and writes the responses to stdout.

```bash
runvero mcp-bridge [OPTIONS]
```

| Flag | Environment | Description | Default |
| :--- | :--- | :--- | :--- |
| `--gateway-url <URL>` | `RUNVERO_GATEWAY_URL` | Gateway MCP endpoint | `http://127.0.0.1:8080/mcp` |
| `--auth-token <TOKEN>` | `RUNVERO_AUTH_TOKEN` | Bearer token for the gateway | |

```json
{
  "mcpServers": {
    "runvero": {
      "command": "runvero",
      "args": ["mcp-bridge", "--gateway-url", "http://127.0.0.1:8080/mcp"]
    }
  }
}
```

---

## `runvero doctor`

Check the installation: version, platform, executable path, the `runvero-notation` helper (and its `.sha256` file when present), the bundled example tool, and the cache directory. Exits non-zero if the helper is missing or its digest doesn't match.

```bash
runvero doctor [OPTIONS]
```

| Flag | Description | Default |
| :--- | :--- | :--- |
| `--notation-helper <PATH>` | Absolute path of the notation helper | `runvero-notation` beside the `runvero` binary |
| `--json` | Print diagnostics as JSON | `false` |

---

## Shared options

### Egress options

Accepted by `run`, `test`, `serve`, and `mcp-installed`. Tools have no outbound network access unless you grant it.

| Flag | Description | Default |
| :--- | :--- | :--- |
| `--allow-host <RULE>` | Allowed destination (repeatable): `api.example.com` (HTTPS on 443), `*.example.com`, `http://host:8080`, `https://[2001:db8::1]:8443` | None |
| `--allow-all-egress` | Allow HTTP egress to any public destination. Conflicts with `--allow-host` | `false` |
| `--allow-private-egress` | **Dangerous.** Also allow loopback, private, link-local, and cloud-metadata addresses | `false` |
| `--unsafe-raw-sockets` | **Dangerous.** Grant raw TCP/UDP sockets, bypassing HTTP filtering. Requires `--allow-all-egress` | `false` |
| `--max-egress-requests <N>` | Maximum outbound HTTP requests per execution | `64` |
| `--max-egress-mb <MB>` | Maximum response data delivered to the guest per execution | `8` |

### Secret options

Accepted by `run`, `test`, `serve`, and `mcp-installed`. Secret values are never taken as arguments, since arguments show up in `ps` and shell history. By default the guest sees only a placeholder; the host substitutes the real value into outbound requests that match the secret's `--bind-secret` rule.

| Flag | Description |
| :--- | :--- |
| `--secret-env <NAME[=HOST_VAR]>` | Load a secret from an environment variable (repeatable) |
| `--secret-file <NAME=PATH>` | Load a secret from a file; one trailing newline is stripped (repeatable) |
| `--bind-secret <NAME=RULE>` | Inject secret `NAME` into requests matching `RULE`, using `--allow-host` syntax (repeatable) |
| `--expose-secret-to-guest <NAME>` | **Dangerous.** Give the guest the raw value instead of a placeholder (repeatable) |

```bash
runvero run ./weather \
  --allow-host api.example.com \
  --secret-env API_KEY=WEATHER_API_KEY \
  --bind-secret API_KEY=api.example.com
```

### Registry options

Accepted by `run`, `pull`, `publish`, and `install`. Credentials come from `RUNVERO_REGISTRY_USERNAME` and `RUNVERO_REGISTRY_PASSWORD`, else from inline `auths` in Docker's `config.json`, and are only sent to the registry named in the reference.

| Flag | Description |
| :--- | :--- |
| `--verify-key <PEM_FILE>` | Require a cosign signature from this ECDSA P-256 or Ed25519 public key (repeatable; any one suffices) |
| `--revoke-key <FINGERPRINT>` | Reject this key fingerprint (`sha256:<64 hex>`) even if also passed to `--verify-key` (repeatable) |
| `--certificate-identity <IDENTITY>` | Require a keyless Sigstore signature from this Fulcio certificate identity. Requires `--certificate-oidc-issuer` |
| `--certificate-oidc-issuer <URL>` | OIDC issuer for the keyless certificate, matched exactly. Requires `--certificate-identity` |
| `--trust-policy <PATH>` | Notation trust policy. Requires `--trust-store` |
| `--trust-store <DIR>` | Notation config directory containing `truststore/x509/`. Requires `--trust-policy` |
| `--notation-helper <PATH>` | Absolute path of the notation helper. Defaults to `runvero-notation` beside the binary |
| `--allow-unverified` | Pull a tag with no signature check |
| `--insecure-registry <HOST[:PORT]>` | Allow plain HTTP to this registry (repeatable). Loopback registries are always allowed |
| `--no-docker-config` | Don't read credentials from Docker's `config.json` |
| `--allow-credential-helpers` | Run `docker-credential-*` helpers named in Docker's config. Off by default |
