john-slop/examples/README.md

44 lines
1.8 KiB
Markdown

# Runnable Rust examples
These Cargo examples exercise the same library boundaries used by the three
John Slop binaries:
```sh
cargo run --example analyze_text
cargo run --example analyze_path -- examples/fixtures
cargo run --example plan_replacements
```
- `analyze_text` analyzes an in-memory prose snapshot and prints its explainable
findings.
- `analyze_path` streams a file, directory, or supported ZIP container. Its
optional path defaults to `examples/fixtures`.
- `plan_replacements` prints the exact UTF-8 byte edits that the formatter and
LSP adapters will share.
These examples use embedded defaults so their behavior does not depend on a
developer's user configuration. Applications that want normal configuration
layering should call `john_slop::load_config()` instead.
## Shared fixture corpus
[`fixtures/manifest.toml`](fixtures/manifest.toml) describes small inputs shared
by detector CLI, formatter, and LSP testing. Several directories deliberately
contain an `example.txt`, covering clean prose, copied assistant residue, stock
style, and Unicode punctuation. A Rust source example covers source-only rules.
Each input has a checked-in expected formatted result.
Exercise the currently implemented boundaries with:
```sh
cargo run --bin john-slop -- --output concise examples/fixtures/assistant/example.txt
cargo run --bin john-slop-fmt -- examples/fixtures/typography/example.txt
cargo run --bin john-slop-fmt -- --check examples/fixtures/clean/example.txt
cargo run --example analyze_path -- examples/fixtures
cargo test --test example_fixtures
```
The formatter integration test now executes every case and compares stdout with
its expected ASCII file. The manifest also names `lsp` as a consumer so the
Milestone 6 protocol tests can reuse the same inputs and expected edits.