|
1 | 1 | # AGENTS Instructions |
2 | 2 |
|
3 | | -General context lives in `README.md` at the repository root. |
| 3 | +General context lives in [README.md](./README.md) at the repository root. |
4 | 4 |
|
5 | 5 | ## Development workflow |
6 | 6 |
|
7 | 7 | - Crate names stay prefixed with `otty-`. |
8 | 8 | - Prefer `format!("{value}")`-style interpolation instead of passing variables as separate arguments when formatting strings. |
9 | | -- When touching Rust code, run `cargo fmt` followed by `cargo clippy --workspace --all-targets`. Fix warnings wherever practical. |
10 | | -- Run `cargo test -p <crate>` (or `cargo test --workspace`) before submitting changes that affect logic-heavy crates like `otty-escape` or `otty-pty`. |
11 | 9 | - Add concise documentation comments to new public items to communicate intent. |
12 | 10 | - Prefer borrowing over cloning; pass `&T`/`&str` where possible and keep ownership at boundaries. |
13 | 11 | - Avoid unnecessary heap allocations; use slices and references for read-only data. |
14 | 12 | - Use `Result`/`Option` for error handling; no `unwrap()` in production code (prefer `expect()` with context during initialization). |
15 | 13 | - Use explicit error types (e.g., with `thiserror`) and propagate with `?`. |
16 | 14 | - Keep APIs minimal and trait-based; use associated types for event/action contracts. |
17 | | -- Prefer `format!("{value}")` style interpolation for strings. |
| 15 | +- Do not expose struct fields as `pub`; use idiomatic Rust accessors for reads (`field()` or `is_*` for booleans), and prefer domain-specific mutators for writes (use `set_*` only when a generic setter is the clearest option, or keep mutation local to the module). Exception: plain input/context structs with no invariants to protect (e.g. feature `Ctx` types passed into `reduce`) MAY use `pub(crate)` fields directly — accessors would be unnecessary boilerplate for parameter bags. |
| 16 | +- For `match` on `enum`, prefer a wildcard arm (`_ => ...`) by default for fallback logic. |
18 | 17 | - Document public items with concise doc comments and examples. |
19 | | -- Run `cargo fmt`, `cargo clippy --workspace --all-targets`, and relevant `cargo test` targets after changes. |
| 18 | +- Run `cargo +nightly fmt`, `cargo clippy --workspace --all-targets --all-features -- -D warnings` and fix all errors and warnings. |
| 19 | +- Run `cargo deny check` and fix all output errors. |
| 20 | +- Run `cargo test --workspace --all-features` all tests MUST be passed |
| 21 | +- Run `cargo llvm-cov --workspace --all-features --fail-under-lines 80` for checking the test coverage level and ensure that it's not decreased for changed code (baseline >= 80%) |
20 | 22 |
|
21 | 23 | ## Terminal emulation |
22 | 24 |
|
|
0 commit comments