This document outlines essential commands and style conventions for agentic coding in this repository.
driver/- Linux kernel module (C) for mouse accelerationcli/- Rust CLI binary for controlling the drivercrates/core/- Core Rust library shared by CLI and TUItui/- Terminal UI component using ratatuisite/- Documentation website (Astro/TypeScript)udev_rules/- udev rules for device permissionsPKGBUILD- Arch Linux DKMS package definitioninstall.sh- Installation script
make build- Build the kernel modulemake build_debug- Build with debug symbols (-g -DDEBUG)make install- Build and load the kernel modulemake reinstall- Uninstall and reinstall modulemake uninstall- Remove module from kernel
cargo build --bin maccel --release- Build CLI binarymake dev_cli- Run CLI with auto-reload using cargo-watchmake install_cli- Build and install CLI to /usr/local/binmake uninstall_cli- Remove CLI binary
make udev_install- Install udev rulesmake udev_uninstall- Remove udev rulesmake udev_trigger- Reload udev and trigger device discovery
All Tests:
make test- Run all C driver testscargo test --all- Run all Rust tests
Single Test:
TEST_NAME=<pattern> make test- Filter C tests by filenamecargo test <test_name>- Run Rust test by namecargo test --package maccel-core <test_name>- Run test in specific crate
cargo fmt --all- Format all Rust codecargo clippy --all --fix --allow-dirty- Rust linting with auto-fix
- Adhere to existing project conventions
- Mimic surrounding code style and patterns
- Add comments sparingly, focusing on why rather than what
- No trailing whitespace
Naming:
snake_case- functions, variables, modulesPascalCase- types, enums, traitsSCREAMING_SNAKE_CASE- constants
Imports (order matters):
stdimports first- External crates second
- Internal modules third
- Within each group, sort alphabetically
use std::{fmt::Debug, path::PathBuf};
use anyhow::Context;
use crate::params::Param;Error Handling:
- Use
anyhow::Result<()>for application-level code - Use
thiserrorfor library code when needed - Propagate errors with
?operator - Add context with
.context()for better messages - Avoid
unwrap()andexpect()in production code - Use
anyhow::bail!()for early error returns
Testing:
- Unit tests in same file:
#[cfg(test)] mod tests { ... } - Use
#[test]attribute for test functions
Naming:
snake_case- functions and variablesPascalCase- types and structs
Style:
- Follow Linux kernel coding style
- Tabs for indentation
- Braces on same line (K&R style)
- Prefix internal/static functions with
_
Error Handling:
- Return integer error codes (0 = success, negative = error)
- Use
gotofor cleanup on error (common kernel pattern)
Testing:
- Test files:
driver/tests/*.test.c - Use
assert_snapshot()for snapshot testing
- Use TypeScript strict mode
- Use Tailwind CSS utility-first approach
kebab-casefor component filenamescamelCasefor variables and functions
| Language | Functions/Variables | Types/Enums | Files | Constants |
|---|---|---|---|---|
| Rust | snake_case | PascalCase | snake_case.rs | SCREAMING_SNAKE_CASE |
| C | snake_case | PascalCase | snake_case.c | SCREAMING_SNAKE_CASE |
| TypeScript | camelCase | PascalCase | kebab-case.ts | SCREAMING_SNAKE_CASE |
- CLI changes: Bump
cli/Cargo.tomlversion AND create git tag - Driver changes: Update
PKGBUILDpkgver
CLI version bump:
- Update
cli/Cargo.tomlversion cargo update -p maccel-cli- Update lock filegit add -A && git commit -m "Bump CLI version to x.y.z"git tag v<x.y.z> && git push origin v<x.y.z>
- Short subject line (<50 chars), imperative mood
- Capitalize first letter
- Blank line between subject and body
- No period at subject line end
Example:
Add new acceleration curve algorithm
Implements a cubic bezier curve for smoother acceleration
at high DPI values.
| Purpose | File |
|---|---|
| CLI entry point | cli/src/main.rs |
| Core library exports | crates/core/src/lib.rs |
| Parameter definitions | crates/core/src/params.rs |
| Driver entry point | driver/maccel.c |
| Test utilities | driver/tests/test_utils.h |
- Rust: See
Cargo.toml(workspace) and individualCargo.tomlfiles - C: kernel headers, make, gcc
- DKMS: Required for driver installation
- Site: Node.js 24.x (
^24.0.0), npm (seesite/package.json)