# ktype

[![CI](https://github.com/hansonguyen/ktype/actions/workflows/ci.yml/badge.svg)](https://github.com/hansonguyen/ktype/actions/workflows/ci.yml)
[![crates.io](https://img.shields.io/crates/v/ktype.svg)](https://crates.io/crates/ktype)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

A terminal-native typing test inspired by Monkeytype — fast, minimal, and offline-first.

## Features

- Timed tests: 15s, 30s, or 60s (cycle with `Tab`)
- Live WPM, raw WPM, accuracy, and character breakdown
- Persistent stats saved to `~/.config/ktype/stats.json`
- Zero config, zero network — runs entirely offline

## Install

### From crates.io

```bash
cargo install ktype
```

### From source

```bash
git clone https://github.com/hansonguyen/ktype
cd ktype
cargo install --path .
```

## Usage

```bash
ktype
```

ktype starts a 15-second timed test immediately. Press `Tab` to cycle through duration options (15s → 30s → 60s) before typing begins.

## Keybindings

| Key               | Action                                    |
|-------------------|-------------------------------------------|
| `Tab`             | Cycle duration (when not typing) / Restart |
| `Space` / `Enter` | Commit current word                       |
| `Backspace`       | Delete last character                     |
| `Esc`             | Quit                                      |

## Results

After each test, ktype shows:

- **WPM** — words per minute (correctly typed words only)
- **Raw WPM** — all keystrokes, including errors
- **Accuracy** — percentage of correct keystrokes
- **Breakdown** — correct / incorrect / extra / missed characters

Stats are saved automatically to `~/.config/ktype/stats.json`.

## Contributing

See [CONTRIBUTING.md](CONTRIBUTING.md).

## License

MIT — see [LICENSE](LICENSE).
