Files
craft-anything/examples/wasm-plugin-readme-check/README.md
Brandon Thomas f64ae3bf3c Craft Anything
A native, pure-Rust app that shows anyone how a piece of software works, with
evidence-backed answers, then helps them rebuild it. It ships a desktop app, a
CLI and an MCP server, all driven by one engine.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 10:52:14 -04:00

38 lines
1.3 KiB
Markdown

# Example check plugin: does the build say how to run it?
A Craft Anything check plugin written in Rust. Its one check, `readme_says_how_to_run`, passes when
the build has a `README.md` at its top that tells a person how to start it, and otherwise says what
to add. It implements `craft-anything:plugin/checks` from
[`crates/engines/wit/plugin.wit`](../../crates/engines/wit/plugin.wit), imports nothing, and asks
only for `.md` files' text (`"extensions": ["md"]`); every other file comes as path and size.
Checks run after the built-in checks of each round. A failed one is shown to the builder to fix,
like any other check.
## Build
```sh
rustup target add wasm32-unknown-unknown
cargo build --release --target wasm32-unknown-unknown
wasm-tools component new target/wasm32-unknown-unknown/release/wasm_plugin_readme_check.wasm -o readme-check.wasm
```
## Use
Craft Anything built with `--features wasm-plugins`, and in `config.toml` (or Settings → Plugins):
```toml
[[plugins.wasm]]
id = "readme"
path = "/full/path/to/readme-check.wasm"
```
Its check is then `readme_readme_says_how_to_run` in each build's check results.
## Check it
```sh
CRAFT_ANYTHING_TEST_WASM_CHECK=/full/path/to/readme-check.wasm \
cargo test -p craft-anything-engines --features wasm-plugins the_example_check
```