scothis/wasm.directory

A meta-registry and package manager for WebAssembly

★ 0Forks 0GitHub ↗Compare

Project website ↗

README

component-cli

Unified developer tools for WebAssembly

Introduction

component-cli is a package manager for WebAssembly Components and WebAssembly Interface Types (WIT). It can search, fetch, and publish WebAssembly to registries like GitHub Packages and Docker Hub. It also automatically resolves dependencies, tracks releases, and generates lockfiles to ensure deterministic builds.

component-cli is intended to be used together with language-specific wasm toolchains. The idea is that you can use a language-specific compiler to compile source code to .wasm binaries. And then use component-cli to handle everything else, including: executing, publishing, linking, and debugging.

component-cli can either be used directly from the command line, or embedded into other applications via the wasm-package-manager Rust crate. This makes it possible for other Wasm tools to search and install Wasm Components without ever leaving the application. Coupled with the "search-by-interface" functionality, this makes it possible to filter the search down only compatible components.

Caution

This repository is under active development and therefore unstable. Breaking changes are expected. Contributions and ideas however are still welcome!

Quick start

$ component init                              # Create a `wasm.toml` and `wasm.lock.toml` locally
$ component install ba:sample-wasi-http-rust  # Install a `wasi:http` server as a dependency
$ component run ba:sample-wasi-http-rust      # Run the `wasi:http` server
$ curl localhost:8080                    # Send a request to the `wasi:http` server

Usage

Unified WebAssembly developer tools

Usage: component [OPTIONS] [COMMAND]

Commands:
  run       Execute a Wasm Component
  init      Create a new wasm component in an existing directory
  install   Install a dependency from an OCI registry
  publish   Publish a component or WIT interface to an OCI registry
  compose   Compose Wasm components from WAC scripts
  local     Detect and manage local WASM files
  registry  Manage Wasm Components and WIT interfaces in OCI registries
  self      Configure the `component(1)` tool, generate completions, & manage state
  help      Print this message or the help of the given subcommand(s)

Options:
  -h, --help     Print help
  -V, --version  Print version

Global Options:
      --color <WHEN>  When to use colored output [default: auto] [possible values: auto, always, never]
      --offline       Run in offline mode
  -v, --verbose...    Increase logging verbosity
  -q, --quiet...      Decrease logging verbosity

Installation

Bash (Linux / macOS)

curl --proto '=https' --tlsv1.2 -LsSf https://github.com/yoshuawuyts/component-cli/releases/latest/download/install.sh | sh

PowerShell (Windows)

irm https://github.com/yoshuawuyts/component-cli/releases/latest/download/install.ps1 | iex

Local development

To stand up the full stack (frontend, backend, and Postgres) locally using Docker:

docker compose up --build
Service URL Description
Frontend http://localhost:8080 WASM component served by wasmtime
Backend http://localhost:8081 Meta-registry API (SQLite-backed)
Postgres localhost:5432 Ready for the SQLite→Postgres migration

To add a new registry namespace, add a .toml file to registry/ then rebuild:

docker compose build backend
docker compose up -d backend

You can also add components and interfaces without editing files by hand: open a Registry entry issue. Automation opens a pull request that adds the entry to the matching registry/<namespace>.toml. Entries in an existing namespace are merged automatically; creating a brand new namespace is flagged for manual review. You can prefill that issue from a project's wasm.toml with component registry publish — see Submitting a Registry Entry.

Crates

This project is composed of several crates:

Crate Description
component The component(1) command-line interface providing unified WebAssembly developer tools
wasm-package-manager A stateful library to interact with OCI registries storing WebAssembly Components
component-detector A library to detect local .wasm files in a repository
wasm-manifest Manifest and lockfile format types for WebAssembly packages
component-meta-registry An HTTP server that indexes OCI registries for WebAssembly package metadata and exposes a search API
xtask Internal development automation tasks (formatting, linting, testing, migrations)

Contributing

Want to join us? Check out our "Contributing" guide and take a look at some of these issues:

Safety

This crate uses #![forbid(unsafe_code)] to ensure everything is implemented in 100% Safe Rust.

Notes on AI

This project is developed with GitHub Copilot. We believe language models can be valuable tools for coding when paired with human oversight, testing, and careful review. For transparency, we mention this in the README.

License

Licensed under Apache License, Version 2.0, with LLVM Exceptions.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the Apache-2.0 license, shall be licensed as above, without any additional terms or conditions.

Contributors

Copilotyoshuawuytsdependabot[bot]asw101github-actions[bot]duffneyericgregory

Issues