Plan and generate middleware splice operations for WebAssembly component composition graphs.
splicer reads:
- A composition graph (JSON)
- A splice configuration (YAML)
It produces a modified plan that injects middleware components according to declarative rules.
This tool is designed to work with component-based systems such as WASI HTTP services, but is interface-agnostic and can splice across any interface edge in a component graph.
When building component-based systems, middleware insertion often requires:
- Rewriting instantiation chains
- Re-threading handler references
- Maintaining correct edge ordering
- Traversing nested provider chains
splicer automates that planning step.
Instead of manually restructuring component wiring, you define:
- What interface to target
- Where to inject middleware
- What middleware components to insert
And splicer generates the modified composition plan.
From source:
cargo build --releaseBinary will be located at:
target/release/splicer
splicer <JSON_GRAPH> <SPLICE_CFG> [--output <FILE>]| Argument | Description |
|---|---|
JSON_GRAPH |
Path to the composition graph in JSON format |
SPLICE_CFG |
Path to the splice configuration YAML file |
--output |
Optional output file (defaults to stdout) |
Splicing behavior is defined in a YAML configuration file.
See full specification:
docs/splice-config.md
version: 1
rules:
- before:
interface: wasi:http/handler
provider:
name: auth
inject:
- middleware-a
- middleware-b
- between:
interface: wasi:http/handler
inner:
name: auth
outer:
name: handler
inject:
- tracingsplicer operates on interface edges in the graph.
If no matches are found, the generated wac will produce an identity component (roundtrips to same component).
Two matching modes are supported:
Inject middleware for a given interface, optionally scoped to a specific provider.
before:
interface: wasi:http/handler
provider:
name: authIf provider.name is omitted, all providers of that interface are matched.
Inject middleware between two specific components connected via an interface edge.
between:
interface: wasi:http/handler
inner:
name: auth
outer:
name: handlerThis replaces:
handler → auth
With:
handler → middleware → auth
Middleware chains are traversed in reverse order during injection to preserve declared ordering.
Rules are applied in file order.
Later rules operate on the graph after earlier modifications.
This allows intentional stacking:
auth → logging → metrics → handler
The configuration will fail if:
versionis missing or unsupported- Required fields are absent
- Middleware list is empty
splicer/
├── src/
├── docs/
│ └── splice-config.md
├── README.md
- Declarative configuration
- Deterministic ordering
- Interface-driven matching
- Graph-aware edge replacement
- Middleware-agnostic
splicer does not assume HTTP semantics — it operates on generic interface edges.
The configuration format is versioned:
version: 1Breaking changes will increment the version number.