specforge Plugin System
Overview
specforge supports external emitters via WASM plugins. A plugin receives the resolved IR as JSON and returns generated files.
Building a Plugin
- Create a new Rust crate with
crate-type = ["cdylib"] - Add
specforge-pluginas a dependency - Implement the
Plugintrait - Export using
specforge_plugin::export_plugin! - Build with
cargo build --target wasm32-wasi --release
Plugin Protocol
- Input: IR JSON (same as
specforge emitoutput) passed togenerate() - Output:
PluginResultwithfiles(path + content) anderrors - File paths: Relative to the output directory
Example
See examples/plugin-example/ for a minimal plugin that generates a README.
IR Schema
See assets/ir-schema.json for the full IR JSON Schema.