# Contributing to Hazelnut
Thank you for considering contributing to Hazelnut! ๐งน
## Getting Started
1. Fork the repository
2. Clone your fork: `git clone https://github.com/YOUR_USERNAME/hazelnut`
3. Create a branch: `git checkout -b feature/your-feature`
4. Make your changes
5. Run tests: `cargo test`
6. Run clippy: `cargo clippy`
7. Format code: `cargo fmt`
8. Commit: `git commit -m "Add your feature"`
9. Push: `git push origin feature/your-feature`
10. Open a Pull Request
## Development Setup
```bash
# Clone
git clone https://github.com/ricardodantas/hazelnut
cd hazelnut
# Build
cargo build
# Run TUI
cargo run
# Run daemon
cargo run --bin hazelnutd run
# Run with sample config
cargo run -- --config examples/config.toml
```
## Code Style
- Use `cargo fmt` before committing
- Use `cargo clippy` and address all warnings
- Write tests for new functionality
- Add documentation for public APIs
- Keep commits focused and atomic
## Project Structure
```
src/
โโโ main.rs # TUI binary entry point
โโโ daemon.rs # Daemon binary entry point
โโโ lib.rs # Library root
โโโ app/ # TUI application
โ โโโ events.rs # Key event handling
โ โโโ state.rs # Application state
โ โโโ ui.rs # UI rendering
โโโ config/ # Configuration loading
โโโ rules/ # Rule engine
โ โโโ action.rs # Rule actions
โ โโโ condition.rs # Rule conditions
โ โโโ engine.rs # Rule evaluation
โโโ theme.rs # Color themes
โโโ watcher/ # File system watcher
โโโ ipc/ # TUI-daemon communication
```
## Adding a New Theme
1. Add a variant to `Theme` enum in `src/theme.rs`
2. Add a `ThemeColors::your_theme()` implementation
3. Update `Theme::colors()` match
4. Update `Theme::name()` match
5. Add to `Theme::all()` array
## Adding a New Condition
1. Add field to `Condition` struct in `src/rules/condition.rs`
2. Update `Condition::matches()` to check your condition
3. Add tests
4. Update docs/configuration.md
## Adding a New Action
1. Add variant to `Action` enum in `src/rules/action.rs`
2. Implement the action in `Action::execute()`
3. Add tests
4. Update docs/configuration.md
## Questions?
Open an issue or start a discussion!