# amql-selector
> CSS-like selector parsing and matching for AQL annotation trees
## Role
- Parses selectors like `controller[method="POST"] > handler`
- Matches annotations against compound selectors with combinators
- Defines shared newtypes: `TagName`, `AttrName`
- Dependency of [amql-engine](../amql-engine)
## Features
- `wasm` — WASM bindings via `wasm_bindgen`
- `ts` — TypeScript type generation via `ts-rs`
- `jsonschema` — JSON Schema derivation via `schemars`
## Types
- `SelectorAst` — parsed selector tree
- `CompoundSelector` — tag + attribute predicates
- `Combinator` — Child, Descendant, AdjacentSibling, GeneralSibling
- `AttrPredicate` — attribute comparison (name, op, value)
- `TagName` — opaque newtype for annotation/element tag names
- `AttrName` — opaque newtype for attribute keys
## Getting Started
```rust
use aql_selector::{parse_selector, TagName, AttrName};
let ast = parse_selector("controller[method=\"POST\"] > handler")?;
assert_eq!(ast.compounds.len(), 2);
```
## npm
- Package: `@aql/selector`
- Build: `bun run build` (wasm-pack + codegen)
- Types: branded newtypes (`TagName`, `AttrName`), generated via `ts-rs`
## License
[MIT](../../LICENSE)