amql-mutate
Pure source code mutation operations for AQL
Role
- Insert, remove, replace, move nodes in source text
- All functions are pure: source text + node refs in, modified source + updated refs out
- No file I/O — callers handle reading/writing
- Defines shared newtypes:
NodeKind,RelativePath - Dependency of amql-engine
Features
wasm— WASM bindings viawasm_bindgents— TypeScript type generation viats-rsjsonschema— JSON Schema derivation viaschemars
Types
NodeRef— self-contained reference to an AST node (file + byte range + kind)InsertPosition— Before, After, IntoMutationResult— modified source + updated node refsNodeKind— opaque newtype for tree-sitter node kindsRelativePath— opaque newtype for project-relative file paths
Getting Started
use ;
let node = NodeRef ;
let = remove_node?;
npm
- Package:
@aql/mutate - Build:
bun run build(wasm-pack + codegen) - Types: branded newtypes (
NodeKind,RelativePath), generated viats-rs