# Contributing to Temperlux

Thanks for your interest! Here's how to contribute.

## Development Setup

```bash
# Install dependencies (Debian/Ubuntu)
sudo apt install ddcutil libddcutil-dev libgtk-4-dev libadwaita-1-dev pkg-config

# Build (CLI + GUI)
cargo build --features gui

# Run tests
cargo test

# Lint
cargo clippy -- -D warnings
```

## Pull Request Process

1. Fork the repo and create a feature branch from `master`
2. Make your changes with tests
3. Ensure `cargo test` and `cargo clippy -- -D warnings` pass
4. Open a PR against `master`

CI runs on push to `master` only. PR builds are manual — a maintainer will trigger CI when reviewing.

## Commit Convention

Use [Conventional Commits](https://www.conventionalcommits.org/):

```
feat: add support for VCP code 0x12 (contrast)
fix: resolve crash when no monitors detected
test: add sync mode boundary tests
ci: update rust toolchain to 1.87
docs: update README install instructions
refactor: extract brightness clamping to caps module
```

## Code Style

- `cargo fmt` before committing
- `cargo clippy -- -D warnings` must pass with zero warnings
- Hardware access behind traits (`DdcProvider`, `BacklightProvider`) — mock in tests
- No unwraps in library code — use `anyhow::Result`

## Testing

- All new code must have tests
- Pure logic → unit tests
- GUI/hardware → test via traits with mock implementations
- Coverage tollgate: 70% LINE overall, 80% LINE on new code (diff coverage)

## Architecture

Hardware access is behind `DdcProvider` and `BacklightProvider` traits. When adding new display operations:

1. Add the method to the trait in `src/display/provider.rs`
2. Implement in `src/display/ddc.rs` (CLI) and/or `src/display/ddc_ffi.rs` (FFI)
3. Add a mock implementation in tests
4. Test the logic through the trait

## License

By contributing, you agree your code will be licensed under GPL-3.0-or-later.
