Update `AGENTS.md`
5b01e6e51c9c5b8e70ba19335723d29992e6774f
1 parent
19f8c16d
AGENTS.md
+19 -14
| 1 | 1 | # AGENTS |
|
| 2 | 2 | ||
| 3 | 3 | Before implementing a code change, check the `STYLE` guide. |
|
| 4 | - | After you're done implementing a code or test change: |
|
| 4 | + | After you're done implementing a code or test change, run: |
|
| 5 | 5 | ||
| 6 | - | * ALWAYS run `cargo fmt` |
|
| 7 | - | * ALWAYS run `cargo clippy --all-targets --all-features` |
|
| 8 | - | * ALWAYS run `cargo test --all-targets --all-features` |
|
| 9 | - | * ALWAYS run `RUSTDOCFLAGS="-D warnings" cargo doc --workspace --all-features --no-deps --document-private-items` |
|
| 6 | + | scripts/check |
|
| 10 | 7 | ||
| 8 | + | To ensure that everything's in a good place. |
|
| 11 | 9 | Fix any warnings or errors surfaced by these tools. |
|
| 12 | 10 | ||
| 13 | 11 | When modifying only documentation files, such as Markdown or plain text files, |
|
| 14 | - | do not run the Rust formatting, linting, test, or documentation-generation |
|
| 15 | - | commands. |
|
| 12 | + | do not run the check. |
|
| 16 | 13 | ||
| 17 | - | When modifying code: |
|
| 14 | + | When modifying code, keep these things in mind: |
|
| 18 | 15 | ||
| 19 | - | * Understand that adding lots of new code to fix an issue is almost always wrong. |
|
| 20 | - | * Understand that removing code to fix an issue is almost always right. |
|
| 21 | - | * Understand that code has a cost of maintenance and prefer changing existing |
|
| 22 | - | code rather than adding new code. |
|
| 23 | - | * Understand that all code added should be written in the most performant way, if |
|
| 24 | - | that doesn't result in more code. |
|
| 16 | + | 1. Adding lots of new code to fix an issue is almost always wrong. |
|
| 17 | + | 2. Removing code to fix an issue is almost always right. |
|
| 18 | + | 3. Code has a cost of maintenance and prefer changing existing |
|
| 19 | + | code rather than adding new code. |
|
| 20 | + | 4. All code added should be written in the most performant way, if |
|
| 21 | + | that doesn't result in more code. |
|
| 22 | + | ||
| 23 | + | And follow these rules: |
|
| 25 | 24 | ||
| 26 | 25 | * NEVER add a new dependency to Cargo.toml without first asking me. |
|
| 27 | 26 | * ALWAYS document top-level symbols, even the private ones. |
|
| 28 | 27 | * ALWAYS document struct fields and enum variants, even the private ones. |
|
| 29 | 28 | * ALWAYS structure human-facing terminal output with the existing UI primitives |
|
| 30 | 29 | (`Table`, `VStack`, `HStack`, `Line`, labels, and related renderable types) |
|
| 31 | 30 | instead of hand-aligning text with ad hoc spacing. |
|
| 32 | 31 | * Always do things the proper, idiomatic, robust way. NO HACKS. |
|
| 33 | 32 | * After the tests pass, run the benchmarks for the crate to ensure no regressions. |
|
| 34 | 33 | ||
| 34 | + | When committing code: |
|
| 35 | + | ||
| 36 | + | * Always include a short description of the change in the commit message body, |
|
| 37 | + | explaining why the change was made. |
|
| 38 | + | * In the commit summary, prefix the affected crate name minus `rustik-`. |
|
| 39 | + | ||
| 35 | 40 | When modifying tests: |
|
| 36 | 41 | ||
| 37 | 42 | * NEVER add assertions whose purpose is to reject a previous implementation's |
|
| 38 | 43 | output or behavior. Tests should assert the current required behavior and |
|
| 39 | 44 | externally meaningful invariants, not historical states. |