# ryo-mutations
[](https://crates.io/crates/ryo-mutations)
[](https://docs.rs/ryo-mutations)
[](#license)
> **Status:** experimental. APIs may change in v0.x.
> Part of the [ryo](https://github.com/ynishi/ryo-rs) workspace —
> AST-centric Rust programming for AI agents.
Code transformation primitives for Rust source. Unified `Mutation` trait
with validation, serialization, and parallel-execution support. Mutations are
organised into modules by intent: `basic` (add / remove / rename / visibility),
`refactor` (extract / inline / split / merge), `idiom` (`unwrap` → `?`,
loops → iterators, `Default`), `clippy`, `analyzer` (rust-analyzer LSP),
and `debugger`.
## Install
```sh
cargo add ryo-mutations
```
## Quickstart
```rust,ignore
use ryo_mutations::{ValidationStrategy, ValidationLevel, basic::AddField};
let mutation = AddField {
target: "Config".into(),
field_name: "timeout".into(),
field_type: "u64".into(),
// ...
};
// Validate before applying
let result = mutation.validate(&pure_file, ValidationStrategy::BlockConflicts);
if result.max_severity() >= ValidationLevel::Conflict {
// refuse to apply
}
```
## API Summary
| `basic::*` | Fundamental AST edits (add / remove / rename / visibility) |
| `refactor::*` | Structural transformations |
| `idiom::*` | Idiomatic Rust pattern rewrites |
| `clippy::*` | Clippy lint integration |
| `analyzer::*` | rust-analyzer LSP integration |
| `debugger::*` | Debug logging utilities |
| `serializable::*` | Mutation serialization for plan files |
| `AllowAll` | FactionBoard / speculative execution |
| `BlockFatalOnly` | Speculative execution (block only fatal) |
| `BlockConflicts` | Sequential execution |
| `Strict` | Debugging (block all issues) |
## Status
**Experimental.** The Writer side of ryo is still evolving — APIs in this
crate may change between v0.x releases. Production-quality stability is
deferred to v1.0.
## License
Licensed under either of [Apache-2.0](https://github.com/ynishi/ryo-rs/blob/main/LICENSE-APACHE)
or [MIT](https://github.com/ynishi/ryo-rs/blob/main/LICENSE-MIT) at your option.