# slash
A parser and executor for a compact slash-command language designed to be embedded in configuration files (e.g., `settings.json`) and evaluated by a Rust hook orchestration module.
## Crates
| [`slash-lang`](crates/lang) | Lexer, parser, and AST |
| [`slash-lib`](crates/lib) | Executor types and high-level API |
| [`slash-cmd`](crates/cmd) | CLI binary (`slash`) |
| [`slash-testing`](crates/testing) | Proptest strategies and harness |
## Language Overview
Commands are whitespace-tokenized with no quoting, escaping, or variable expansion. Priority is inferred from the **shape** of the command token. Urgency is a trailing suffix.
### Priority (inferred from casing)
| `ALL_CAPS` | Max |
| `TitleCase` | High |
| `camelCase` | Medium |
| `kebab-case` / plain lowercase | Low |
| `snake_case` | Lowest |
### Urgency (trailing `!` suffix)
```
/build! # Low urgency
/build!! # Medium urgency
/build!!! # High urgency
```
### Builder-chain arguments
```
/deploy.env(prod).region(us-east-1)
```
### Optional commands and pipe context
`/cmd?` marks a command optional. When optional commands are piped together, their outputs accumulate into a `Context` object (key = command name, value = `Option<String>`) passed as JSON to the first non-optional command.
```
### Operators
```
/build && /test # run /test only if /build succeeds
/build |& /log # pipe stdout + stderr
/build > out.txt # redirect output (overwrite)
/build >> out.txt # redirect output (append)
```
## Usage
```rust
use slash_lib::parse;
let program = parse("/Build.target(release) && /test!!")?;
println!("{program:#?}");
```
## Building
```bash
cargo build --all-targets
cargo nextest run
cargo clippy --all-targets -- -D warnings
```
## License
Licensed under either of [MIT](LICENSE-MIT) or [Apache-2.0](LICENSE-APACHE) at your option.