You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: AGENTS.md
+16-3Lines changed: 16 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,11 +2,23 @@
2
2
3
3
General context lives in [README.md](./README.md) at the repository root.
4
4
5
-
## Development workflow
5
+
## Rules
6
6
7
-
- Crate names stay prefixed with `otty-`.
7
+
- You MUST write the tests before writting the implementation.
8
+
- You MUST write tests only for business-significant packages such as usecases, repositories, helpers, and domain logic. Do not add tests for infrastructure/bootstrap packages such as lifecycle, config, metrics, logging, or server wiring unless they contain business-significant behavior.
9
+
- You MUST use `mockall` for mocks in RUST code
10
+
- You MUST ask me before installing the new dependencies with dependency description and reason.
11
+
- You MUST prefer simple, direct, readable code with explicit business logic. Avoid clever generics, macros, type gymnastics, and dense control flow when straightforward code is easier to understand.
12
+
- You MUST keep each source file focused on one cohesive responsibility. When one file combines multiple independent responsibilities or becomes difficult to navigate, split it into clearly named modules and files, with each file owning one responsibility. Do not split tightly coupled logic solely because of line count, and do not introduce empty, pass-through, or speculative modules.
13
+
- Rust modules MUST be organized in this order: imports; structs with their implementations; public functions; private functions; tests. Each struct declaration MUST be followed immediately by its related implementations before declaring the next struct. Within a struct's implementations, use this order: getters; constructors and other logic methods; `#[cfg(test)]` implementations; trait implementations. Use `otty-ui/terminal/src/render_runs.rs` and `otty-ui/terminal/src/shaped_text.rs` as good examples of this layout.
14
+
- You MUST separate distinct logical phases inside Rust functions with a single blank line, including input preparation, validation or branching, external or repository I/O, state changes, and result construction. Keep statements that form one tightly coupled operation together; do not add a blank line after every statement mechanically.
15
+
- You MUST NOT create abstractions by default. Every new trait, interface, layer, factory, manager, service, or extension point MUST solve a current problem and be briefly justified. "Maybe useful later" is not a valid justification; use a concrete implementation or private function instead.
16
+
- You MAY introduce an abstraction only when it has multiple real implementations, crosses an actual infrastructure boundary, protects domain or usecase code from infrastructure, removes duplication with the same business meaning and reason to change, or makes testing significantly simpler without hiding logic.
17
+
- You MUST prefer meaningful domain names over generic names such as `Manager`, `Processor`, `Helper`, `Service`, or `Util`. Split functions, files, and layers only when doing so improves the current design and readability.
18
+
- You MUST apply DRY only when duplicated logic has the same business meaning and changes for the same reason. Duplication is acceptable when extraction would create a vague or harder-to-read abstraction, and speculative traits, configuration, factories, placeholder layers, and unused extension points are forbidden by YAGNI.
19
+
- crate names MUST stay prefixed with `otty-`.
8
20
- Prefer `format!("{value}")`-style interpolation instead of passing variables as separate arguments when formatting strings.
9
-
-Add concise documentation comments to new public items to communicate intent.
21
+
-You MUST add concise documentation comments to new public items to communicate intent.
10
22
- Prefer borrowing over cloning; pass `&T`/`&str` where possible and keep ownership at boundaries.
11
23
- Avoid unnecessary heap allocations; use slices and references for read-only data.
12
24
- Use `Result`/`Option` for error handling; no `unwrap()` in production code (prefer `expect()` with context during initialization).
@@ -15,6 +27,7 @@ General context lives in [README.md](./README.md) at the repository root.
15
27
- 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
28
- For `match` on `enum`, prefer a wildcard arm (`_ => ...`) by default for fallback logic.
17
29
- Document public items with concise doc comments and examples.
30
+
- You MUST run all linters, checks and tests before finishing your work.
18
31
- Run `cargo +nightly fmt`, `cargo clippy --workspace --all-targets --all-features -- -D warnings` and fix all errors and warnings.
19
32
- Run `cargo deny check` and fix all output errors.
20
33
- Run `cargo test --workspace --all-features` all tests MUST be passed
Copy file name to clipboardExpand all lines: deny.toml
+4Lines changed: 4 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,10 @@
2
2
unsound = "workspace"
3
3
unmaintained = "workspace"
4
4
yanked = "warn"
5
+
ignore = [
6
+
{ id = "RUSTSEC-2026-0194", reason = "wayland-scanner 0.31.10 is the latest compatible release and still constrains quick-xml to ^0.39; remove once the iced Wayland stack can use quick-xml >=0.41" },
7
+
{ id = "RUSTSEC-2026-0195", reason = "wayland-scanner 0.31.10 is the latest compatible release and still constrains quick-xml to ^0.39; remove once the iced Wayland stack can use quick-xml >=0.41" },
0 commit comments