Skip to main content
Version: v2

Wasm Shell Configuration

This document describes the configuration options available for the wash CLI. Configuration can be specified in YAML, JSON, or TOML format (.json, .yaml, .yml, or .toml).

Wasm Shell uses two configuration files:

Configuration hierarchy

Configuration is merged with the following precedence (highest to lowest):

  1. CLI arguments
  2. Environment variables (WASH_ prefix)
  3. Project config (.wash/config.yaml)
  4. User config ($HOME/.config/wash/config.yaml)
  5. Default values

Managing the config file

wash ships three subcommands for managing the project-local config file in .wash/. Together they cover the typical lifecycle: scaffold a working file, check it before you run anything against it, and clean up stale state when something goes wrong.

Creating a new config

Use wash config init to create a starter file. The --example flag populates every section with illustrative values, which is the fastest way to see what wash accepts:

shell
wash config init --example

The --format flag selects the serialization format. yaml is the default; yml, json, and toml are also supported:

shell
wash config init --format toml --example

init always writes to the project-local .wash/ directory. The legacy --global flag is deprecated and has no effect.

Validating a config

Run wash config validate to catch hard errors in the merged project configuration before they show up at runtime:

shell
wash config validate

Validation covers socket-address syntax, redis:// / nats:// / postgres:// URL schemes, paired TLS cert and key files, WebGPU availability on Windows, non-empty build commands, well-formed WIT registry URLs, and local WIT source paths that actually exist on disk. Remote sources (HTTP, Git, OCI) are skipped — validate doesn't reach out to the network. Errors are collected across every section before the command returns, so every issue surfaces in one pass.

To validate a specific file instead of the merged project config (useful when working with multiple variants), pass --file:

shell
wash config validate --file ./alternate-config.yaml

Cleaning up cache and data directories

wash config cleanup removes the wash cache and/or data directories. Use it to reclaim disk space or to recover from a corrupted cache. Always preview with --dry-run first to see what would be removed and how much space it would free:

shell
# Preview
wash config cleanup --all --dry-run

# Apply
wash config cleanup --all

Use --cache or --data instead of --all to target a single directory.

User configuration

By default, user configuration files are found at $HOME/.config/wash/config.yaml.

Under construction

This section is under active development—please check back soon for a more complete reference.

Project configuration

Projects can be configured via a project config file that resides in the .wash directory at the project root, and which may be expressed in JSON, YAML, or TOML format.

Top-level project configuration options include:

OptionTypeDescription
versionstringConfiguration schema version
buildobjectBuild configuration options
devobjectDevelopment server configuration options
witobjectWIT dependency management configuration

version configuration

Specify the wash version for this project.

Example:

yaml
version: 2.2.0

build configuration

Wasm Shell builds WebAssembly component binaries by wrapping language-specific utilities like cargo, go, npm, etc, and project configuration files are used to define configuration for builds.

Wasm Shell executes the build command for your language toolchain specified in your project configuration file.

build options

OptionTypeDefaultDescription
commandstring-Build command to execute
envmap{}Environment variables to set during the build process
component_pathstring-Path to the output Wasm component file

build examples

yaml
build:
  command: cargo build --target wasm32-wasip2 --release
  component_path: target/wasm32-wasip2/release/project_name.wasm

dev configuration

wash dev builds a component according to the specified build options (unless otherwise specified in the dev options) and then starts a local development server. There are a variety of options available for local development.

dev options

OptionTypeDefaultDescription
commandstring-Custom command to run for building during development
addressstring-Address for the development server to listen on
servicebooleanfalseWhether to run as a long-running service with port binding
service_filestring-Path to a service definition file
componentsarray[]Additional components to load during development
volumesarray[]Volumes to mount from host to guest
host_interfacesarray[]WIT interfaces to expose from the host
tls_cert_pathstring-Path to TLS certificate file for HTTPS
tls_key_pathstring-Path to TLS private key file for HTTPS
tls_ca_pathstring-Path to TLS CA certificate file
wasi_webgpubooleanfalseEnable WASI WebGPU support
wasi_keyvalue_pathstring-Path for WASI key-value store data
wasi_blobstore_pathstring-Path for WASI blob store data
dev.components[]

Additional components to load alongside your main component.

FieldTypeDescription
namestringName identifier for the component
filestringPath to the component Wasm file
dev.volumes[]

Volume mounts for filesystem access from within the Wasm component.

FieldTypeDescription
host_pathstringPath on the host filesystem
guest_pathstringPath as seen from within the Wasm component

dev example

yaml
dev:
  command: cargo build --target wasm32-wasip2 --debug
  address: 127.0.0.1:8080
  service: true
  wasi_webgpu: true
  tls_cert_path: "./certs/cert.pem"
  tls_key_path: "./certs/key.pem"

wit configuration

Configuration for WIT (WebAssembly Interface Type) dependency management.

wit options

OptionTypeDefaultDescription
registriesarraywasm.pkg registryRegistries for WIT package fetching
skip_fetchbooleanfalseSkip fetching WIT dependencies
wit_dirstring./witDirectory where WIT files are stored
sourcesmap{}Source overrides for WIT dependencies (target → source mapping)

wit.registries[]

Registry configuration for fetching WIT packages.

FieldTypeDescription
urlstringRegistry URL endpoint
tokenstringOptional authentication token

wit example

yaml
wit:
  wit_dir: "./wit"
  skip_fetch: false
  registries:
    - url: "https://private-registry.example.com"
      token: "${REGISTRY_TOKEN}"
  sources:
    "wasi:http": "https://github.com/WebAssembly/wasi-http/archive/refs/tags/v0.2.0.tar.gz"