# Contributing to plk
## Development Setup
```sh
git clone https://github.com/BeepBoopBit/plk.git
cd plk
cargo build
cargo test
```
## Running Tests
```sh
# All tests
cargo test
# A specific test
cargo test test_name
```
Tests use `PLK_DATA_DIR` and `PLK_CONFIG_DIR` environment variables pointed at temp directories, so they never touch your real data.
## Code Quality
Before submitting a PR, make sure:
```sh
cargo fmt # format code
cargo clippy # no warnings
cargo test # all tests pass
```
## Pull Request Process
1. Fork the repo and create a branch from `main`
2. Keep PRs focused — one feature or fix per PR
3. Add tests for new functionality
4. Update documentation if the command surface changes
5. Make sure CI passes (fmt, clippy, test)
## Project Structure
```
src/
main.rs Entry point + command dispatch
cli.rs Clap derive structs
error.rs PlkError via thiserror
history.rs Record + parse history log
sequence.rs Sequence detection algorithm
shortcuts.rs CRUD for saved shortcuts (JSON)
config.rs Config loading (TOML)
shell_hook.rs Shell hook generation (plk init)
completions.rs Dynamic tab-completion output
executor.rs Run shell commands
suggest.rs Proactive save suggestions
swapx.rs swapx integration (read/write rules.plk.yaml)
tests/
cli.rs Integration tests
```
## Coding Standards
- Use `cargo fmt` for formatting
- No clippy warnings (`cargo clippy -- -D warnings`)
- Keep dependencies minimal
- Prefer simple, readable code over clever abstractions